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
fiber this method first reads the input file and downcase sorts it,
def doing_raw_file_to_verified_unique_researches # adjustable line length filter consumer = Fiber.new do |producer, queue| a = File.read("../../Documents/20111224-research.txt") new = a.to_textual #TODO finishe @megadata = a.sort do |x,y| x.downcase <=> y.downcase end @megadata_unique = @megadata.uniq f = open("./tmp/database_doings/doing_uniques/uniques_done.txt", "a") do |f| loop do queue = producer.transfer(consumer, queue) puts f << queue queue.clear end raise StopIteration end end producer = Fiber.new do |consumer, queue| #IO.foreach("./tmp/database_doings/doing_uniques/uniques_todo.txt") do |line| queue = "" puts queue @megadata_unique.each do |line| sequence_text = line.to_textual.de_comma if sequence_text.length < 50 # adjustable puts "line ignored due to length" elsif Sequence.find_by_sequence_text(sequence_text) puts "line ignored as it is already in database : " + "#{sequence_text}" else sequence_creation = sequence_text.de_space unless nil sequence_complete = sequence_text.split(//).sort.join('').strip unless nil sequence_lexigram = lexigram_sequencer(sequence_text) unless nil sequence_singular = sequence_complete.squeeze unless nil description = "research" reference = "literoti" anagram = 0 name = 0 phrase = 0 research = 1 external = 0 internal = 0 created_at = "2011-12-21 12:12:00" #line = "#{sequence_text}\n" line = "#{sequence_text}\t#{sequence_creation}\t#{sequence_complete}\t#{sequence_lexigram}\t#{sequence_singular}\t#{description}\t#{reference}\t#{anagram}\t#{name}\t#{phrase}\t#{research}\t#{external}\t#{internal}\t#{created_at}\n" queue << line break unless line consumer.transfer queue queue.clear end end end raise StopIteration end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def humongous_sort\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n end", "def sorting_file\n a = File.readlines(file_name)\n a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n end", "def textualed\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n while a = full_list.shift\n puts a unless nil? \n end\n end", "def sort_file\n File.open(file_name) do |line|\n line.each do |x|\n puts \"#{x.to_textual}\"\n end\n end\n end", "def doing_phrases_file_sort_and_unique\n a = File.readlines(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\")\n @megadeta = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n queue = \"\"\n puts queue\n\t @megadata_unique = @megadata.uniq\n queue << \"#{@megadata_unique}\"\n break unless @megadata_uniq\n consumer.transfer queue\n queue.clear\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end", "def downcase(input); end", "def sort_temp\n open(file_name) do |line|\n #File.open(\"../database_runs/temp-sort.txt\", \"r\") do |line|\n line.each_with_index do |i,x|\n #puts \"#{x}\" + \"#{i.to_textual}\"\n puts \"#{x}\"\n end\n end\n end", "def downcase() end", "def sort_by_line_length\n a = File.readlines(file_name)\n a.sort do |x,y|\n (y.downcase.length <=> x.downcase.length)\n end\n end", "def swapcase() end", "def analyse(file_path)\n fixed = 0\n words = []\n File.open(file_path, \"r:iso-8859-1\") do |f|\n words = f.readlines(sep=\" \")\n words.dup.each_with_index do |word, i|\n word.delete!(\" \")\n match, dist = @tree.best word.downcase\n if !match.nil? && dist != 0\n fixed+=1\n words[i] = capitalize_if_needed(word, match)\n # puts \"#{word} - #{match}\"\n end\n end\n end\n # print \"file: #{file_path}\\nwords: #{words.size}\\nfixed words:#{((fixed.to_f/(words.size).to_f)*100).round(2)}%\\n\"\n save words, file_path\n end", "def occurences(file) # \n fileString = File.read(file).to_s # the text of the file is stored\n fileString = fileString.chars.sort.join # we sort it\n #puts \"the ordered charactors are\" # \n #puts fileString # \n write_handler = File.new(file+\"_result.out\", \"w\") # create a new file called that _out\n\n # \n result = \"\" # \n values = Hash.new(0) # create new hashtable\n fileString.chars.each do |char| # for each of the chara\\actors\n values[char.to_s] +=1 # add it to the hash\n end # \n values = values.sort_by {|_key, value| value} # sort by lmost common letter\n values = values.reverse # reverse it\n values.each do |val| # for each value\n write_handler.puts val[1].to_s+ \":\"+val[0].to_s # add it to the new file\n end # end\n write_handler.close # close file\n return result # return resullt\nend", "def upcase() end", "def downcase; end", "def upcase(input); end", "def initialize(files)\n @files = files.sort_by { |f| f.name.downcase }\n end", "def sort_files!; end", "def downcase!() end", "def swapcase!() end", "def reverse_words\n\tputs \"ERROR: Please give a valid filename as an argument.\" if ARGV[0] == nil\n\tFile.readlines(ARGV[0]).each do |line|\n\t\tline.gsub!(\"\\n\", \"\") if line.include? \"\\n\"\n\t\tword_reverser(line.split(\" \")) unless line.split[0] == nil\n\tend\nend", "def main\n filelist = split_ts_export_main\n sort_lines_main(filelist)\n #reverse_lines_main\nend", "def sorted(sentence)\n\tsentence.gsub!(/[^a-z0-9\\s]/i, '') #strip out punctuation\n\tsentence_array=sentence.split #split the uppercase sentence into an array using .split\n\tsentence_array.sort{|word1, word2| word1.upcase <=> word2.upcase} #sort the new uppercase array\n\nend", "def downcase_keys\n end", "def wordsorting (sentence)\n\t# removing punctuation and splitting sentence\n\twordlist = sentence.gsub(/\\W/, ' ').split(\" \")\n\t#sorting alpahbetically + upcase\n\tputs wordlist.sort_by { |word| word.upcase }\nend", "def function_a\n#code\n\th = Hash.new\n\tFile.open('capitals.txt').each do |line|\n\t\ta = line.split(/,/)\n\t\ta[1][0] = ''\n\t\ta[1] = a[1].chomp(\"\\n\")\n\t\th[a[0].downcase] = a[1]\n\tend\n\twhile 1\n\t\tprint \"Ready: \"\n\t\tinput = gets.chomp\n\t\tif input.downcase == \"done\"\n\t\t\texit\n\t\telsif h[input.downcase] == nil\n\t\t\tputs \"nil\"\n\t\telsif h[input.downcase] != nil\n\t\t\tputs h[input.downcase]\n\t\tend\n\tend\nend", "def start\n File.open(ARGV[0]).each do |line|\n text = line.chomp\n puts text.split(' ').reverse.join(' ')\n end\nend", "def reorder_files\n files = Dir.glob(File.join(@dir,\"*\"))\n files.each{|f|\n @enroll_file = f if f.downcase.index('enroll')\n @attendance_file = f if f.downcase.index('att')\n @ili_file = f if f.downcase.index('ili') || f.downcase.index('h1n1')\n }\n end", "def sort\n super { |x, y| x.file_name <=> y.file_name }\n end", "def sort_array\n a = File.readlines(file_name)\n b = a.sort\n end", "def initialize(filename=\"data/dictionary.txt\")\n file = File.new(filename, \"r\")\n @data = {}\n while (word = file.gets)\n if (word)\n word = word.chomp.upcase\n add_word(word)\n end\n end\n # @max_word_size = 4\n end", "def sort\n if self.checkDestination\n\n if @interactive\n answer = readUserInput(\"Process '#{@filename}' ([y]/n): \")\n answer = answer.empty? ? 'y' : answer\n self.log('info', \"User Answer for file '#{@filename}': #{answer}\")\n if !answer.match(/y/) \n self.log('info',\"Skipping file '#{@filename}' due to user answer: '#{answer}'.\")\n return\n else\n self.log('info',\"Processing file '#{@filename}' due to user answer: '#{answer}'.\")\n end\n end\n\n if not author = get_author() or author.empty?\n self.log('error', \"File '#{@filename}' has not value for author set. Cannot sort file. Abort.\")\n exit 1\n end\n targetdir = @destination.chomp + '/' + author\n targetfile = targetdir + '/' + Pathname.new(@filename).basename.to_s\n\n # Create the target directory, if it does not exist yet.\n if !File.exists? targetdir\n\n # Check for similiar directory names which might indicate a typo in the\n # current directory name.\n if @typo and foundDir = self.findSimilarTargetdir(targetdir)\n\n self.log('info', \"Similar target found ('\" + foundDir + \"'). Request user input.\")\n puts 'Similar target directory detected:'\n puts 'Found : ' + foundDir\n puts 'Target: ' + targetdir\n while answer = readUserInput('Abort? ([y]/n): ')\n if answer.match(/(y|yes|j|ja|^$)/i)\n self.log('info','User chose to abort sorting.')\n puts 'Abort.'\n exit 0\n elsif answer.match(/(n|no)/i)\n self.log('info', 'User chose to continue sorting.')\n break\n end\n end\n end\n\n if @dryrun\n self.log('info', \"Dryrun: Created Directory '#{targetdir}'.\")\n else\n self.log('info', \"Created directory '#{targetdir}'.\")\n puts 'Created: ' + targetdir\n FileUtils.mkdir_p(targetdir)\n end\n end\n\n # Check if the file already exists\n # This does nothing so far\n if File.exists?(targetfile) and @overwrite\n self.log('info', \"File '#{@filename}' already exists. Overwrite active: replacing file.\")\n elsif File.exists?(targetfile) and !@overwrite\n self.log('info', \"File '#{@filename}' already exists, overwrite disabled: not replacing file.\")\n return true\n end\n\n if @copy\n\n if @dryrun\n self.log('info', \"Dryrun: Copy file '#{@filename}' to '#{targetdir}'.\")\n else\n self.log('info', \"Copy file '#{@filename}' to '#{targetdir}'.\")\n FileUtils.cp(@filename, targetdir)\n end\n\n else\n\n if @dryrun\n self.log('info', \"Dryrun: Move file '#{@filename}' to '#{targetdir}'.\")\n else\n self.log('info', \"Move file '#{@filename}' to '#{targetdir}'.\")\n FileUtils.mv(@filename, targetdir)\n end\n\n end\n\n end\n end", "def alphabetized(s)\n s.scan(/[a-z]/i).sort_by(&:downcase).join\nend", "def run\n fail('Unable to dedup and sort. No filename provided') and return unless @filename\n fail(\"Unable to dedupe and sort. #{@filename} does not exist\") and return unless File.exists?(@filename)\n sort_dedupe_merge\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n\t\t\t\t\t# do not touch this! You have a Mac!\n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\ttitle = cleanup_title line\n\t\t\t\t\tif title != nil\n\t\t\t\t\t\taddtoB(title)\n\t\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tsearch = \"\"\n#\t\twhile search != \"q\" # continues while user doesn't enter 1\n#\t\t\tputs(\"Enter a word [Enter 'q' to quit]:\") # prompts for user input\n#\t\t\tsearch = $stdin.gets.chomp # get input from user\n#\t\t\tif (search != \"q\") # if they typed in q, we don't want to create a title\n#\t\t\t\tprint(create_title(search)) # creates and prints title\n#\t\t\tend\n#\t\t\tputs \"\" # extra line for prettiness! ~\n#\t\tend\n\tend\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit\n\tend", "def sortme(str)\n str.sort_by { |word| word.downcase }\nend", "def alphabetize\n\nend", "def file_2_list(f,lc=true)\n puts \"Loading records from file: #{f}\" if @verbose\n begin\n list=Array.new\n file = File.open(f, \"r\")\n file.each_line do |line|\n line=line.chomp.strip\n next if line.nil?\n next if line.empty?\n next if line =~ /^\\s*#/\n line=line.downcase if lc==true\n list.push(line.chomp.strip)\n end\n file.close\n return list\n rescue => ee\n puts \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n return nil\n end\n end", "def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Please provide the following file: #{text_file}\"\n exit\nend", "def downcase\n\t\tcollect(&:downcase)\n\tend", "def file_2_list(f,lc=true)\n\t\tputs \"Loading records from file: #{f}\" if @verbose\n\t\tbegin\n\t\t\tlist=Array.new\n\t\t\tfile = File.open(f, \"r\")\n\t\t\tfile.each_line do |line|\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tlist.push(line.chomp.strip)\n\t\t\tend\n\t\t\tfile.close\n\t\t\treturn list\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def downcase_fields\n self.handle.downcase!\n end", "def sorter(array)\n loop do\n switched = false\n for i in 0...array.length - 1\n if array[i].downcase > array[i + 1].downcase\n array[i], array[i + 1] = array[i + 1], array[i]\n switched = true\n end\n end\n break if !switched\n end\n array\nend", "def readNames(path)\n return File.read(path).rstrip.split(/\\n/).map{|r| r.downcase.split(/\\|/)}\nend", "def process_file(file_name)\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n puts \"Processing File.... \"\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n \n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\t# Clean Title\n clean_title = cleanup_title(line)\n\t\t\t\t# Split title into words\n\t\t\t\tif clean_title != nil\n\t\t\t\t\t# Array of words in the title\n\t\t\t\t\twords = clean_title.split(' ', 30)\n\t\t\t\t\twords.delete(\"\")\n\t\t\t\t\t\t# For every word in the title\n\t\t\t\t\t\tfor i in 0..words.length - 1\n\t\t\t\t\t\t# \tIf word is not already in first hash as a key\n\t\t\t\t\t\t\tif !$bigrams.key?(words[i])\n\t\t\t\t\t\t\t\t# If it is not the last word in the title\n\t\t\t\t\t\t\t\tif words[i] != words.last\n\t\t\t\t\t\t\t\t\t# Insert first word into hash as key, with a new hash containing next word as key and 1 as value\n\t\t\t\t\t\t\t\t\t$bigrams[words[i]] = {words[i+1] => 1}\n\t\t\t\t\t\t\t\t# Else it is the last word in the title\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t$bigrams[words[i]] = Hash.new\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# Else word is already in first hash \n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# If word is not the last word in title\n\t\t\t\t\t\t\t\tif words[i] != words.last\n\t\t\t\t\t\t\t\t\t# If nested hash contains second word as a key\n\t\t\t\t\t\t\t\t\tif $bigrams[words[i]].key?(words[i+1])\n\t\t\t\t\t\t\t\t\t\t# Increase value that corresponds with second word\n\t\t\t\t\t\t\t\t\t\t$bigrams[words[i]][words[i+1]] += 1\n\t\t\t\t\t\t\t\t\t# Else word that follows is not in second hash\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t# Insert second word as key in second hash and set value to 1\n\t\t\t\t\t\t\t\t\t\t$bigrams[words[i]][words[i+1]] = 1\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t# Else word is last word in title, no words follow\n\t\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue => exception\n\t\tp exception.backtrace\n\t\traise\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend", "def fix_convert_abbreviations_to_lower_case(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.(at|pt|txt)\\z/i,\n \"Converting abbreviations to lower case\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::ConvertAbbreviationsToLowerCase.fix(contents, filename)\n [outcome]\n end\n end", "def initialize(word_list_file_path)\n word_list = ::File.readlines(word_list_file_path).map(&:chomp)\n @words = word_list.map(&:downcase)\n end", "def upcase; end", "def processed_content\n scan(/[a-z]/i).join.downcase\n end", "def sort_name\n sort_constituent\n end", "def upcase!() end", "def name_handler(name)\n name = name.downcase.chars #takes the input and makes it downcase and breaks it into an array to increment through\n name_new = name.map do |letter| #create a new array called name_new and start block to increment through each array\n letter_change(letter)\n end\n #Code addressing capitalization and swapping first / last\n namearr = name_new.join('').split #join the new_name array back into a string\n p namearr\n first_name = namearr[0] #assign first name to a new variable based on index\n last_name = namearr[1] #assign first name to a new variable based on index\n name_new = last_name.capitalize! + \" \" + first_name.capitalize! #capitalize and swap first for last\nend", "def reverse_words(file)\n a = ReverseWords.new\n a.read(file)\n i = 0\n while i < a.counter\n puts \"Case ##{i+1}: #{a.cases[i].split(\" \").reverse.join(\" \")}\"\n i = i + 1\n end\n # puts a.counter\n # print a.cases\nend", "def test_add_case_sensitive_read_case_insensitive\n ::Zip.case_insensitive_match = false\n\n SRC_FILES.each { |fn, _en| assert(::File.exist?(fn)) }\n zf = ::Zip::File.new(EMPTY_FILENAME, ::Zip::File::CREATE)\n\n SRC_FILES.each { |fn, en| zf.add(en, fn) }\n zf.close\n\n ::Zip.case_insensitive_match = true\n\n zfRead = ::Zip::File.new(EMPTY_FILENAME)\n assert_equal(SRC_FILES.collect { |_fn, en| en.downcase }.uniq.size, zfRead.entries.length)\n assert_equal(SRC_FILES.last.last.downcase, zfRead.entries.first.name.downcase)\n AssertEntry.assert_contents(SRC_FILES.last.first,\n zfRead.get_input_stream(SRC_FILES.last.last) { |zis| zis.read })\n end", "def process_str_file(file_array)\n column_headings = []\n file_array.each do |f|\n\n #File.open(params[:inputfile],\"r\") do |file|\n # while (f = file.gets)\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^Order/\n column_headings = f.split(/\\t/)\n next\n end\n\n # Split the biomart dump file on tabs\n the_data = f.split(/\\t/)\n\n case the_data[2]\n when 'TRAIT'\n load_hjj_trait_data(column_headings,the_data)\n when 'SNP'\n load_hjj_snp_data(column_headings,the_data)\n when 'STR'\n load_hjj_str_data(column_headings,the_data)\n end\n\n #end # end of while loop\n end # of File.open\n \n end", "def transliterate_file_name\n\t\t\tfile_names = Array.new\n\t\t\[email protected] { |a| file_names << a if a.match(/_file_name{1}$/) }\n\t\t\tfile_names.each do |local_file_name|\n\t\t\t\tif self.send(local_file_name).present? && self.send(local_file_name+'_changed?')\n\t\t\t\t\textension = File.extname(send(local_file_name)).gsub(/^\\.+/, '')\n\t\t\t\t\tfilename = send(local_file_name).gsub(/\\.#{extension}$/, '')\n\t\t\t\t\tself.send(local_file_name.gsub(/_file_name{1}$/, '')).instance_write(:file_name, \"#{transliterate(filename)}.#{transliterate(extension)}\")\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def processed_content\n scan(/[a-z]/i).join.downcase\n\n # self.letters.downcase\n end", "def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend", "def get_lowercase_name(file_path)\n filename = File.basename(file_path)\n basedir = File.dirname(file_path)\n\n # Make sure the file is all lowercase, for consistency\n filename.downcase!\n new_path = File.join(basedir, filename)\n file_path = new_path\n\n return file_path\nend", "def process_input_file\n\t\t\tinput_file = File.open(@params[:input_file], 'r')\n\t\t\tfile_terms = convert_contents_to_search_string(input_file.read)\n\t\t\tadd_terms(file_terms)\n\t\tend", "def downcase_fields\n self.guess.downcase!\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tall = Hash.new\n\t\tIO.foreach(file_name) do |line|\n\t\t\t# do something for each line\n\t\t\ttitle = cleanup_title(line)\n\t\t\tunless title.nil?\n\t\t\t\tgram = title.split().each_cons(2).to_a\n\t\t\t\tgram = gram.map{ |n| n.join(' ') }\n \t\t\t\tgram = gram.each_with_object(Hash.new(0)) { |word, obj| obj[word] += 1 }\n \t\t\t\tif gram.any?\n\t \t\t\t\tall.merge!(gram) { |k, old, new| old + new }\n\t \t\t\tend\n\t\t\tend\n\t\tend\n\t\t$bigramsArray = all.sort_by { |k, v| -v }\n\t\tcreate_hash()\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend", "def munge(name)\n infile = name + \".txt\"\n outfile = name + \".out\"\n line = File.open(infile) {|f| f.read}\n #i1 points at the first character in a word.\n #i2 points at the first character after a word.\n i1 = i2 = 0;\n while i1 < line.length || i2 < line.length\n i2 += 1 while i2 < line.length && line[i2, 1] =~ /[[:alpha:]]/ #in a word\n line[i1...i2] = permute_word(line[i1...i2])\n i1 = i2\n i1 += 1 while i1 < line.length && line[i1, 1] !~ /[[:alpha:]]/ #not in a word\n i2 = i1\n end\n File.open(outfile, \"w\") {|f| f.write(line)}\n# line\nend", "def reformatInput(word)\n return String.downcase(String.chars.sort(&:casecmp).join)\n end", "def dictionary_sort(list)\n sorted = []\n capitals = []\n \n list.each do |word|\n if capitalized?(word)\n word.downcase!\n capitals << word\n end\n end\n \n until list.empty?\n max_so_far = custom_max(list)\n \n sorted.unshift(max_so_far)\n list.delete(max_so_far)\n end\n \n sorted.each do |word|\n if capitals.include?(word)\n word.capitalize!\n end\n end\n sorted\nend", "def translate(filename)\r\n\t\t@array_translate = []\r\n\t\tFile.open(filename).each do |line|\r\n\t\t\t@array_translate << line.split\r\n\t\tend\r\n\tend", "def sort_by_surname(input, fullname_field)\n input.sort_by { |i| i[fullname_field].downcase.split(/ /)[1] }\n end", "def sort_by_surname(input, fullname_field)\n input.sort_by { |i| i[fullname_field].downcase.split(/ /)[1] }\n end", "def process_file(file_name)\n\n\t# local variables declaration\n\n\t# start time of this program\n t_1 = Time.now\n \n title = nil\n\n\tputs \"Processing File.... \"\n\t\n\tbegin\n\t\tIO.foreach(file_name) do |line|\n\t\t\t# do something for each line\n\t\t\t\n\t\t\t# call the cleanup_title method and pass the line\n\t\t\t# the cleanup_title method will return cleaned up string\n\t\t\t# the cleaned up string will be stored in the title variable\n\t\t\t# title = cleanup_title(line)\n\t\t\ttitle = cleanup_title(line)\n\n\t\t\tif title != nil && title != \"\"\n\t\t\t\tbuildBigram(title)\n createWordsList(title)\n\t\t\tend\n\t\t\t\n\t\t\t\n\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\n # print total amount of titles\n puts \"\\n=======================================\"\n\t\tputs \"Total number of Titels: #{$counter_1}\\n\"\n\n\t\t# end time of this program\n\t\tt_2 = Time.now\n\n\t\t# calculate time needed for computing\n\t\tt_3 = t_2 - t_1\n\n\t\t# print computing time\n puts \"Computing Time: #{t_3}\"\n puts \"=======================================\\n\\n\"\n \n\t\t#countWords()\n\t\t#printWords()\n\t\t#printBigram()\n\t\t#printTitles()\n\n\t\tmcw(\"love\")\n\n\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend", "def diacritize_file(path)\n texts = File.open(path).map do |line|\n line.chomp.strip\n end\n\n # process batches\n out_texts = []\n idx = 0\n while idx + @batch_size <= texts.length\n originals = texts[idx..idx+@batch_size-1]\n src = originals.map.each{|t| preprocess_text(t)}\n lengths = src.map.each{|seq| seq.length}\n ort_inputs = {\n 'src' => src,\n 'lengths' => lengths\n }\n preds = predict_batch(ort_inputs)\n\n out_texts += (0..@batch_size-1).map do |i|\n reconcile_strings(\n originals[i],\n combine_text_and_haraqat(src[i], preds[i])\n )\n end\n idx += @batch_size\n end\n\n # process rest of data\n while idx < texts.length\n out_texts += [diacritize_text(texts[idx])]\n idx += 1\n end\n\n out_texts\n end", "def handleInput(inputs)\n\t\tinputArgs = ARGV.map(&:upcase)\n\t\tinputArgs = inputArgs.sort\n\treturn inputArgs\nend", "def sort_by_encoding_index(files)\n files.sort_by do |file|\n token_pairs = file.scan(/(\\D+)|(\\d+)/)\n\n sort_key = token_pairs.map do |letters, digits|\n if letters\n letters\n else\n padded_numeric_sort_key(digits)\n end\n end\n\n sort_key.flatten\n end\nend", "def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started!\"\n exit\nend", "def set_sort_name\n self.sort_name = name.to_s.downcase.gsub(/^(a|an|the) /, '').gsub(/[^a-zA-Z0-9]/, '')\n end", "def sort_case(value)\n @case_sensitive = value\n end", "def parse_in_order(*files); end", "def canonical(word)\n word.downcase!\n word.chars.sort\nend", "def sort_array_2(arr)\n arr.sort{|a,b| a.downcase <=> b.downcase}\nend", "def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/,\" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started\"\n exit\nend", "def fb_to_ar_case(column_name)\n column_name =~ /[[:lower:]]/ ? column_name : column_name.downcase\n end", "def unique\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.to_textual }\n #uniques = full_list.uniq\n uniques = full_list.uniq\n puts uniques\n end", "def process_file(file_name)\r\n\tputs \"Processing File.... \"\r\n\r\n\tbegin\r\n\t\tcounter = Hash.new\r\n\t\tfile = File.open(file_name)\r\n\t\tuntil file.eof?\r\n\t\t\tfile.each_line do |line|\r\n\t\t\t\t# do something for each line\r\n\t\t\t\ttitle = cleanup_title(line)\r\n\t\t\t\tunless(title == \"\")\r\n\t\t\t\t\tbigram = title.split().each_cons(2).to_a\r\n\t\t\t\t\tbigram = bigram.map{ |n| n.join(' ')}\r\n\t\t\t\t\tbigram = bigram.each_with_object(Hash.new(0)){|word, obj| obj[word] += 1}\r\n\t\t\t\t\tif bigram.any?\r\n\t\t\t\t\t\tcounter.merge!(bigram) { |k, old, new| old + new}\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\tfile.close\r\n\r\n\t\t$bigramsArray = counter.sort_by { |k, v| -v }\r\n\t\tcreate_hash()\r\n\t\t#$bigrams = $bigrams.to_h\r\n\r\n\t\t#$bigramsHash = Hash.new\r\n\t\t#$bigramsHash = $bigrams.to_h\r\n \t#$bigrams.each { |k, v| puts \"#{v} => #{k}\"}\r\n\r\n\r\n\t\tputs \"Finished. Bigram model built.\\n\"\r\n\trescue\r\n\t\tSTDERR.puts \"Could not open file\"\r\n\t\texit 4\r\n\tend\r\n\r\nend", "def import\n print 'Import filename: '\n $stdout.flush\n file = gets.chomp\n fd = File.new(file, \"r\")\n itecky = file.rindex('.')\n raise 'missing dot in filename' if itecky == nil\n fname = file[0,itecky]\n fname.upcase!\n puts\n fd.each do\n |row|\n if row.strip.length == 0 or row[0,1] == '*' or row[0,1] == '#'\n next\n end\n row.chomp!\n items = row.split # deleni row na polozky oddelene mezerou\n nitems = items.length # pocet polozek\n raise \"only one word on the line\\n[#{row}]\" if nitems == 1\n if nitems == 2 # slovicka bez oddelovaci carky\n en = items[0]\n cz = items[1]\n else # slovicka a fraze s oddelovaci carkou\n i = row.index(' - ') # oddelovac anglickeho a ceskeho vyrazu\n raise \"missing ' - ' between English and Czech phrases\\n[#{row}]\" if i == nil\n en = row[0,i+1].strip # prvni cast radku - anglicka\n cz = row[i+3..-1].strip # druha cast radku - ceska\n end\n flag = false\n for iw in 0 ... $words.length do\n if $words[iw].fname == fname and\n ($words[iw].english == en or $words[iw].czech == cz) then\n flag = true\n break\n end\n end\n if flag == true then next end\n $words << Word.new(fname,0,0,en,cz)\n w = konverze($words.last.english + ' | ' + $words.last.czech)\n puts w\n end\n puts\n $stdout.flush\nend", "def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end", "def processed\n self.scan(/[a-z]/i).join.downcase\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\ttitle = cleanup_title(line)\n\t\t\t# If the title is valid continue\n\t\t\tif title != nil\n\t\t\t\t# Split the title into words\n\t\t\t\twords = title.split(\" \")\n\t\t\t\tw_index = 0\n\t\t\t\t# Remove the stop words\n\t\t\t\twords = words - %w{a an and by for from in of on or out the to with}\n\t\t\t\t# If there is more than one word in a title add to biagram\n\t\t\t\tif words.length > 1\n\t\t\t\t\twords.each do |w|\n\t\t\t\t\t\t# If there is no base word add it\n\t\t\t\t\t\tif $bigrams[w] == nil\n\t\t\t\t\t\t\t$bigrams[w] = Hash.new\n\t\t\t\t\t\t\t$bigrams[w][words[w_index + 1]] = 1\n\t\t\t\t\t\t# Else if there is no word following the word add it\n\t\t\t\t\t\telsif $bigrams[w][words[w_index + 1]] == nil\n\t\t\t\t\t\t\t$bigrams[w][words[w_index + 1]] = 1\n\t\t\t\t\t\t# Else increment the count of the word following\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$bigrams[w][words[w_index + 1]] += 1\n\t\t\t\t\t\tend\n\t\t\t\t\t\tw_index += 1\n\t\t\t\t\t\t# Don't include the last word in the title\n\t\t\t\t\t\tif w_index > words.length - 2\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\traise\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend", "def scrambler (name)\n\tswapped = name.split.rotate.join(\" \") # Take name and flip it.\n\tswapped.downcase! # Make string lowercase.\n\tname1 = swapped.tr(\"aeiou\", \"eioua\") # Shift all vowels by 1 place.\n\tname2 = name1.tr(\"bcdfghjklmnpqrstvwxyz\", \"cdfghjklmnpqrstvwxyzb\") # Shift all conconants by 1 place.\n\tname3 = name2.split.map(&:capitalize).join(\" \") # Make string into substrings capitalize and join back.\nend", "def sort(text)\n copy(text.split(\"\\n\").sort)\nend", "def process_file(file_name)\n\tbegin\n\t\tFile.foreach(file_name, encoded: 'ASCII') do |line|\n\t\t\t\tprocess_line(line)\n\t\tend\n\trescue\n\t\tSTDERR.puts \"Could not open file, #{$!}\"\n\t\texit 4\n\tend\nend", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\t#IO.foreach(file_name) do |line|\n\t\tsize = File.new(file_name).size\t# This is the only way I've been able to get the entire unique_tracks.txt to be read\n\t\tfile = File.open(file_name)\n\t\tlines = file.read(size)\n\t\tlines_array = lines.split(\"\\n\")\n\t\tlines_array.each do |line|\t# For each line of the file\n\t\t\tline += \"\\n\"\t# Above file parsing splits lines on the \\n character, but the cleanup_title\n\t\t\t # method uses the \\n charaacter in the non-English characters check so it needs to be added back\n\t\t\ttitle = cleanup_title(line)\t# Removes unwanted text and sets string to downcase\n\t\t\tbuild_bigram(title)\t# Builds the bigram structure\n\t\tend # do lines.each\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue # begin\n\t\tSTDERR.puts \"Could not open file\"\n\t\traise\n\t\texit 4\n\tend # rescue\nend", "def get_converted(line)\n tokens = line.split(/[ ;]/)\n name = tokens[-1].split(/_/)\n name[1..-1].each(&:capitalize!)\n [tokens[-1], name.join]\nend", "def downcase_keys!\n replace(downcase_keys)\n end", "def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\n end", "def capitalize(input); end", "def canonical(word)\n word = word.downcase.split(//).sort\nend", "def doing_textuals\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/insert_internals.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n f.puts << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n list = File.readlines(file_name)\n list = File.readlines(\"./lib/anagrams/anagrams_table_data.txt\")\n #list = File.readlines(\"./lib/anagrams/anagrams_table_data.txt\")\n full_list = list.sort_by { |x| x.downcase }\n #b = IO.readlines(file_name)\n #b = IO.readlines(ARGV)\n #b = IO.readlines(\"./lib/the_input.txt\")\n loop do\n while a = full_list.shift\n queue = a.to_textual unless nil\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end\n end\n consumer.transfer(producer, [])\n after_break\n end", "def fb_to_ar_case(column_name)\n column_name =~ /[[:lower:]]/ ? column_name : column_name.downcase\n end", "def sort_output_file\n FileUtils.rm_rf(order_result_filename)\n\n cmd = \"head -1 #{order_result_filename_temp} | rev | \" + \\\n \"cut -d ',' -f 2- | rev > #{order_result_filename}\"\n\n `#{cmd}`\n\n cmd = \"tail -n +2 #{order_result_filename_temp} | \" + \\\n \"awk -F ',' -v OFS=',' '{print $NF,$0}' | \" + \\\n \"sort -t ',' -k1,1 -n | cut -d ',' -f 2- | \" + \\\n \"rev | cut -d ',' -f 2- | rev >> #{order_result_filename}\"\n\n `#{cmd}`\n\n FileUtils.rm_rf(order_result_filename_temp)\n end", "def read_in\n File.foreach(file_name).map(&:chomp)\n end", "def fdowncase\n downcase.cdowncase\n end", "def convertFile(inputName, outputName)\n # output file\n outputFile = File.open(outputName, \"w\")\n\n # input file\n File.open(inputName, \"r\") do |inputFile|\n pattern = /^(\\S+?,){#{READ_FORM_INDEX}}/\n while line = inputFile.gets\n startIndex = line[pattern].size\n endIndex = line.index(',', startIndex)\n\n x = startIndex\n while x < endIndex do\n kata = line[x,2]\n if $kataHira[kata]\n line[x,2] = $kataHira[kata]\n else\n puts \"line: #{inputFile.lineno}, unkown katakana: #{kata}\"\n end\n x += 2\n end\n\n outputFile.puts line\n end\n end\n\n outputFile.close\nend", "def sort_nums_app\n\tputs \"ERROR: Please give a valid filename as an argument.\" if ARGV[0] == nil\n\tFile.readlines(ARGV[0]).each do |line|\n\t\tline.gsub!(\"\\n\", \"\") if line.include? \"\\n\"\n\t\tsort_nums(line.split(\" \")) unless line.split[0] == nil\n\tend\nend" ]
[ "0.76304334", "0.755775", "0.68935245", "0.63521373", "0.6057862", "0.59918505", "0.58981997", "0.58711994", "0.5859831", "0.5843661", "0.57936025", "0.576914", "0.57135165", "0.5695219", "0.5689491", "0.5680237", "0.56761724", "0.5670575", "0.566158", "0.5625387", "0.5611408", "0.55667347", "0.55632114", "0.5556534", "0.555552", "0.55331403", "0.5533118", "0.5530288", "0.5521528", "0.55097497", "0.54943025", "0.54795665", "0.5451654", "0.5446689", "0.54435617", "0.54060453", "0.54034746", "0.5397897", "0.5386407", "0.5381153", "0.5376295", "0.53696054", "0.5367692", "0.53617257", "0.536169", "0.535083", "0.53487587", "0.53460944", "0.5343658", "0.5326668", "0.5319934", "0.5316878", "0.53147125", "0.53101593", "0.53008646", "0.52988297", "0.5284392", "0.5283521", "0.52832156", "0.5273954", "0.5268009", "0.5265541", "0.5265008", "0.52645755", "0.5258092", "0.52425545", "0.52425545", "0.5242094", "0.5236695", "0.52329457", "0.52189803", "0.52068645", "0.51985735", "0.51965374", "0.5194917", "0.5192949", "0.5187557", "0.51681864", "0.5166736", "0.5163203", "0.51481384", "0.51391965", "0.5133414", "0.51308346", "0.51297003", "0.5123664", "0.51153815", "0.50792575", "0.50729775", "0.5070321", "0.50698084", "0.50682265", "0.50630736", "0.506221", "0.5061973", "0.50584114", "0.505726", "0.50570685", "0.5051158", "0.5050873", "0.50490403" ]
0.0
-1
GET /manage_teams GET /manage_teams.json
def index @manage_teams = ManageTeam.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n end", "def index\n @teams = current_user.teams\n end", "def index\n @teams = current_user.teams\n end", "def team(id)\n get \"/teams/#{id}\"\n end", "def team_information_list\n @teams = Team.find_teams_by_user(current_user.id)\n \n end", "def teams\n render json: @team_query\n end", "def index\n @teams = @organization.teams\n end", "def set_team\n @team = current_user.teams.find(params[:id])\n end", "def team\n fetch('esport.teams')\n end", "def index\n @user_teams = UserTeam.all\n end", "def set_team\n @team = current_user.teams.find(params[:id])\n end", "def set_manage_team\n @manage_team = ManageTeam.find(params[:id])\n end", "def index\n @teams = Team.all\n render json: @teams\n end", "def show\n # @teams = ::Services::TeamService.show_teams\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def team_information_list\n @teams = Team.find_teams_by_user(session[:user_id])\n \n end", "def index\n @mens_teams = MensTeam.all\n end", "def index\n\t\t@teams = Team.all\n\tend", "def index\n @users_teams = UsersTeam.all\n end", "def teams(org)\n get \"/orgs/#{org}/teams\"\n end", "def teams\n @teams ||= ApiFactory.new 'Orgs::Teams'\n end", "def index\n @teams = Team.all\n render :json => @teams\n end", "def index\n if current_user_total?\n @teams = Team.order(:description).page(params[:page]).per(5)\n else\n ids = []\n tus = TeamUser.where(user_id: current_user.id)\n tus.each do |tu| # user_id | team_id\n ids << tu.team_id # [1, 6, 7]\n end\n\n return @teams = Team.where(id: ids).order(:description).page(params[:page]).per(5)\n end\n=======\n\n # GET /teams\n # GET /teams.json\n def index\n @teams = Team.order(:description).page(params[:page]).per(5)\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end\n\n # GET /teams/1\n # GET /teams/1.json\n def show\n<<<<<<< HEAD\n=======\n @team = Team.find(params[:id])\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end", "def index\n authorize! :read, parent_organization\n @teams = MnoEnterprise::Team.where(organization_id: params[:organization_id])\n end", "def manage_team\n @user = User.first\n @project = Organization.first.projects.find_by(id: params[:id])\n end", "def app_teams(org_name:, platform:, app_id:)\n endpoint = \"/api/organizations/#{org_name}/platforms/#{platform}\"\\\n \"/apps/#{app_id}/teams\"\n res = api.get endpoint\n Response.new(res)\n end", "def teams\n @teams ||= @api.client.orgs.teams.list(org: @org)\n end", "def set_team\n @organization = Organization.find(params[:organization_id])\n @team = @organization.teams.find(params[:id])\n end", "def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def teams\n @teams\n end", "def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teams }\n end\n end", "def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teams }\n end\n end", "def show\n @user_teams = @game.team.user_teams\n end", "def index\n # @teams = Team.all\n \n redirect_to \"/members\"\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @teams }\n # end\n end", "def user_team(team_id)\n get(\"/user_teams/#{team_id}\")\n end", "def index\n\t\t@team = Team.find(params[:team_id])\n\tend", "def set_team\n @team = Team.accessible_for(current_user).friendly.find(params[:id])\n end", "def team_members(id)\n get \"/teams/#{id}/members\"\n end", "def set_team\n @team = Team.where(\"id=?\",params[:id]).first\n\n unless @team.present? \n render json:{ status: :error, data: \"team is not find\" }\n\n end\n end", "def index\n @teams = @club.teams\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def show\n @team = Team.find(params[:id])\n\n render json: @team\n end", "def list_teams_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TeamApi.list_teams ...\"\n end\n # resource path\n local_var_path = \"/v2/teams\"\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListTeamsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeamApi#list_teams\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def new\n @team_admin = TeamAdmin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @current_user.team_admin }\n end\n end", "def get_teams\n reply = @client.call(:get_teams)\n data = reply.body.dig(:get_teams_response,\n :get_teams_result,\n :string)\n check_if_data_exists(data)\n rescue Savon::HTTPError => error\n logger.debug error.http.code\n return []\n end", "def get_teams_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}teams/league/#{league_id}\")[\"teams\"]\nend", "def set_team\n @team = Team.friendly.find(params[:id])\n end", "def team\n @response = CompanyApi::Request::Setting.new(\n CompanyApi::Response::Formatter::Manager,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).get_team_details({})\n\n unless @response.success?\n return handle_temporary_redirects(@response)\n end\n\n @presenter_obj = ::WebPresenter::ManagerPresenter.new(@response, params)\n @fe_no_nav = true\n end", "def get_team ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}\"\n end", "def get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\n team.save\r\n\r\n end \r\n end", "def new\n @teammate = Teammate.new\n @teams = Hackathon.find(params[:hackathon_id]).teams\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teammate }\n end\n end", "def set_team\n @team = Team.friendly.find(params[:team_id])\n end", "def set_team\n @team = Team.find(params[:team_id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end" ]
[ "0.7537896", "0.74025214", "0.72080195", "0.72080195", "0.71886444", "0.7104305", "0.7054615", "0.7020705", "0.6986244", "0.69394225", "0.6888179", "0.68863684", "0.6882221", "0.6882011", "0.6860769", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.68204665", "0.681665", "0.68069834", "0.6784944", "0.6769198", "0.6768985", "0.67630583", "0.6759122", "0.67514604", "0.67504525", "0.6723691", "0.67169744", "0.6705426", "0.66853017", "0.66583145", "0.66583145", "0.6608989", "0.66047066", "0.66047066", "0.65752226", "0.65740687", "0.65669644", "0.6562116", "0.65543485", "0.65535676", "0.65146697", "0.6513986", "0.650752", "0.6499553", "0.64979833", "0.64979833", "0.64979833", "0.64979833", "0.64979833", "0.64979833", "0.64979833", "0.64979833", "0.64979833", "0.64979833", "0.6494826", "0.64906806", "0.6489454", "0.6481416", "0.6474435", "0.64701235", "0.64406085", "0.64376724", "0.64358", "0.6430685", "0.6425982", "0.6425982", "0.6425982", "0.6425982", "0.6425982", "0.6425982", "0.6425982", "0.6425982", "0.6425982", "0.6425982", "0.6425982", "0.6425982", "0.6425982" ]
0.73477256
2
GET /manage_teams/1 GET /manage_teams/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "def team(id)\n get \"/teams/#{id}\"\n end", "def index\n @manage_teams = ManageTeam.all\n end", "def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n end", "def index\n @teams = current_user.teams\n end", "def index\n @teams = current_user.teams\n end", "def index\n @teams = Team.all\n render json: @teams\n end", "def teams\n render json: @team_query\n end", "def team_information_list\n @teams = Team.find_teams_by_user(current_user.id)\n \n end", "def show\n @team = Team.find(params[:id])\n\n render json: @team\n end", "def index\n if current_user_total?\n @teams = Team.order(:description).page(params[:page]).per(5)\n else\n ids = []\n tus = TeamUser.where(user_id: current_user.id)\n tus.each do |tu| # user_id | team_id\n ids << tu.team_id # [1, 6, 7]\n end\n\n return @teams = Team.where(id: ids).order(:description).page(params[:page]).per(5)\n end\n=======\n\n # GET /teams\n # GET /teams.json\n def index\n @teams = Team.order(:description).page(params[:page]).per(5)\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end\n\n # GET /teams/1\n # GET /teams/1.json\n def show\n<<<<<<< HEAD\n=======\n @team = Team.find(params[:id])\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end", "def show\n # @teams = ::Services::TeamService.show_teams\n end", "def index\n @teams = @organization.teams\n end", "def set_team\n @team = current_user.teams.find(params[:id])\n end", "def index\n @teams = Team.all\n render :json => @teams\n end", "def set_manage_team\n @manage_team = ManageTeam.find(params[:id])\n end", "def show\n render status: 200, json: Team.find(params[:id])\n end", "def team\n fetch('esport.teams')\n end", "def manage_team\n @user = User.first\n @project = Organization.first.projects.find_by(id: params[:id])\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @teams = Team.all\n end", "def index\n @user_teams = UserTeam.all\n end", "def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def index\n\t\t@team = Team.find(params[:team_id])\n\tend", "def show\n\t\t@team = Team.find(params[:id])\n\t\trender '/teams/show.json.jbuilder'\n\tend", "def set_team\n @team = current_user.teams.find(params[:id])\n end", "def new\n @teammate = Teammate.new\n @teams = Hackathon.find(params[:hackathon_id]).teams\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teammate }\n end\n end", "def get_team ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}\"\n end", "def index\n\t\t@teams = Team.all\n\tend", "def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teams }\n end\n end", "def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teams }\n end\n end", "def index\n authorize! :read, parent_organization\n @teams = MnoEnterprise::Team.where(organization_id: params[:organization_id])\n end", "def index\n @mens_teams = MensTeam.all\n end", "def show\n @team_admin = TeamAdmin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_admin }\n end\n end", "def show\n @team = @club.teams.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end", "def show\n team = Team.find_by(:id => params[:id])\n render :json => team\n end", "def index\n @teams = @club.teams\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end", "def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end", "def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end", "def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end", "def team\n @team = Team.where('team_id = ?', params[:id])\n @active_stats = ActiveStat.where('team_id = ?', params[:id])\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "def team_information_list\n @teams = Team.find_teams_by_user(session[:user_id])\n \n end", "def set_team\n @team = Team.where(\"id=?\",params[:id]).first\n\n unless @team.present? \n render json:{ status: :error, data: \"team is not find\" }\n\n end\n end", "def get\n service_response = ManagerManagement::Team::Get.new(params).perform\n return render_api_response(service_response)\n end", "def index\n # @teams = Team.all\n \n redirect_to \"/members\"\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @teams }\n # end\n end", "def index\n @users_teams = UsersTeam.all\n end", "def show\n @team = Team.find(params[:id])\n \n if flash[:member]\n @member = flash[:member]\n else\n @member = Member.new\n end\n\n \n @roles = Role.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team }\n end\n end", "def show\n @teams = Team.all\n @team_member = Team.friendly.find(params[:id])\n end", "def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team }\n end\n end", "def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team }\n end\n end", "def new\n @team_admin = TeamAdmin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @current_user.team_admin }\n end\n end", "def user_team(team_id)\n get(\"/user_teams/#{team_id}\")\n end", "def set_team\n @organization = Organization.find(params[:organization_id])\n @team = @organization.teams.find(params[:id])\n end", "def show\n @team = Team.find(params[:id])\n end", "def show\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.friendly.find(params[:id])\n end", "def index\n @teams = Team.page(params[:page])\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def get_teams_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}teams/league/#{league_id}\")[\"teams\"]\nend", "def show\n @ultimate_team = UltimateTeam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimate_team }\n end\n end", "def team_members(id)\n get \"/teams/#{id}/members\"\n end", "def set_team\n @team = Team.find(params[:id])\n end", "def show\n @user_teams = @game.team.user_teams\n end", "def set_team\n @team = @resource = Team.find(params[:id])\n end", "def new\n @team_admin = TeamAdmin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team_admin }\n end\n end", "def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @league }\n end\n end", "def team\n @response = CompanyApi::Request::Setting.new(\n CompanyApi::Response::Formatter::Manager,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).get_team_details({})\n\n unless @response.success?\n return handle_temporary_redirects(@response)\n end\n\n @presenter_obj = ::WebPresenter::ManagerPresenter.new(@response, params)\n @fe_no_nav = true\n end", "def app_teams(org_name:, platform:, app_id:)\n endpoint = \"/api/organizations/#{org_name}/platforms/#{platform}\"\\\n \"/apps/#{app_id}/teams\"\n res = api.get endpoint\n Response.new(res)\n end" ]
[ "0.75918406", "0.7432122", "0.7356902", "0.7101455", "0.70920885", "0.70920885", "0.70477575", "0.7011361", "0.7005574", "0.70009863", "0.69872016", "0.69806784", "0.69773656", "0.69548273", "0.6945705", "0.6934425", "0.6920693", "0.6874304", "0.68714315", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6867092", "0.6855658", "0.68527657", "0.68527657", "0.6852076", "0.68425155", "0.68313235", "0.68149984", "0.6814246", "0.6805652", "0.6804319", "0.6804319", "0.67943454", "0.678769", "0.6784527", "0.67809635", "0.6780749", "0.67787284", "0.67249846", "0.67249846", "0.67249846", "0.67249846", "0.67241067", "0.67141426", "0.6709964", "0.6699207", "0.66965437", "0.6693503", "0.66930556", "0.6673981", "0.66704094", "0.6670022", "0.6667235", "0.66417336", "0.66372216", "0.66284", "0.66284", "0.66246766", "0.66188985", "0.66053027", "0.66053027", "0.66053027", "0.66053027", "0.66053027", "0.66053027", "0.66053027", "0.66053027", "0.66053027", "0.66053027", "0.6590234", "0.6588507", "0.65733266", "0.656208", "0.6561885", "0.65530014", "0.6543864", "0.65385133", "0.6538445", "0.6538056" ]
0.0
-1
POST /manage_teams POST /manage_teams.json
def create @manage_team = ManageTeam.new(manage_team_params) respond_to do |format| if @manage_team.save format.html { redirect_to @manage_team, notice: 'Manage team was successfully created.' } format.json { render action: 'show', status: :created, location: @manage_team } else format.html { render action: 'new' } format.json { render json: @manage_team.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @team = @organization.teams.build(team_params)\n\n respond_to do |format|\n if @team.save\n current_user.add_role :admin, @team\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_team = Team.new(admin_team_params)\n\n respond_to do |format|\n if @admin_team.save\n format.html { redirect_to admin_teams_url, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @admin_team }\n else\n format.html { render :new }\n format.json { render json: @admin_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n @team.users << current_user\n\n respond_to do |format|\n if @team.save\n setup_team(@team)\n format.html { redirect_to user_root_url, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html do\n flash[:notice] = 'Team was successfully created.'\n current_user.is_admin? ? (redirect_to teams_path) : (redirect_to user_teams_path(current_user))\n end\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @organization = Organization.find(params[:organization_id])\n @team = @organization.teams.create(team_params)\n\n respond_to do |format|\n if @team.save\n\n Teaminvite.create!(admin_id: current_user.id,name: current_user.name,user_id: current_user.id, accepted: 'true', team_id: @team.id, email: current_user.email, admin: 'true',organization_id: @team.organization_id)\n format.html { redirect_to organization_teams_path(@team.organization_id), notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def team_params\n params.require(:team).permit(:name, :description, :company_id, :opportunity_ids => [], :team_ids => [])\n end", "def team_params\n params.require(:team).permit(:name, :code, :description, :project_id, :members_count, :managers_count, :is_deleted, :pending_tasks, :status, :team_lead_ids => [], :user_ids => [])\n end", "def create\n @team = Team.new(team_params)\n begin\n @team.owner_id = current_user.id\n @team.save!\n\n current_user.add_role :team_owner, @team\n current_user.add_role :member, @team\n current_user.teams << @team\n redirect_to teams_url, notice: 'Team was successfully created.'\n rescue Exception => e\n render :new\n end\n end", "def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to '/teams', notice: 'Team was successfully created.' }\n format.json { render :index, status: :created }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_team(name, params = {})\n params[:name] = name\n post('teams', params)\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n define_team_user\n end", "def create\n @response = HTTParty.get('http://laxapi.herokuapp.com/api/teams')\n CreateTeamService.new.create_team_objects(@response)\n render :json => {\n :message => \" #{Team.count} teams have been created\",\n status: 200\n }\n end", "def create\n @team = Team.new(params[:team])\n\n if @team.save\n render json: @team, status: :created, location: @team\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: \"Team was successfully created.\" }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n newTeam = TeamMemberRelation.new()\n newTeam.team_id = @team.id\n newTeam.user_id = session[:user]\n newTeam.team_role_id = 1\n newTeam.save\n end", "def create\n @team = Team.new(team_params)\n authorize @team\n current_user.update team: @team\n\n respond_to do |format|\n if @team.persisted?\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = @race.teams.build team_params\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to [@race, @team], notice: I18n.t(:create, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @league = League.find(params[:league_id])\n @team = Team.new(params[:team])\n @team.league = @league\n\n # Manager needs to be sent the email to come manage his team.\n # If he needs to sign-up, then he will be directed at the signup_before_action pat\n email = @team.manager_email_address\n\n @team.managers.push(manager_account = Account.create_pending_or_find_existing(email))\n\n respond_to do |format|\n if @team.save\n url_for_manager = team_path(@team)\n\n # The manager is a pending manager so we need to send the link through the onboard url\n if (manager_account.pending?)\n description = \"league_teams/new_manager_description\"\n url_for_manager = onboard_new_account_path_generator(manager_account, url_for_manager, description)\n end\n\n manager_account.send_invite!(:team_created, :team_id => @team.id, :url => url_for_manager)\n\n format.html { redirect_to @team, notice: 'Team was successfully created. Manager was emailed a link to the team.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tTeam.create(params[:team])\n\n\t\tredirect_to teams_path\n\tend", "def create\n @team = Team.new(params.required(:team).permit!)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = @project.ae_teams.new(team_params)\n if @team.save\n redirect_to editor_project_ae_team_path(@project, @team), notice: \"Team was successfully created.\"\n else\n render :new\n end\n end", "def team_params\n params.require(:team).permit(:name, :id, user_ids: [])\n end", "def create\n @team = Team.new(params[:team])\n @team.user = current_user\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_team\n new_team_code = genTeamCode(current_user.id)\n team_params = {\n :team_name => params[:teamname],\n :team_code => new_team_code,\n :advisor_users_id => current_user.id,\n }\n team = Team.new(team_params)\n team.save\n\n current_user.update_attribute( :team_name, params[:teamname] )\n current_user.update_attribute( :team_code, new_team_code)\n\n flash.now[:flash] = 'Team Created'\n render '/advisor/index'\n end", "def create_teams\n parent = Object.const_get(session[:team_type]).find(params[:id])\n Team.randomize_all_by_parent(parent, session[:team_type], params[:team_size].to_i)\n undo_link(\"Random teams have been successfully created.\")\n ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Random teams have been successfully created', request)\n redirect_to action: 'list', id: parent.id\n end", "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, :notice => 'Team was successfully created.' }\n format.json { render :json => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def team_params\n params.require(:team).permit(:user_id, :name)\n end", "def team_params\n params.require(:team).permit(:name, :team_type_id)\n end", "def create\n @team = @competition.teams.build(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to competition_team_url(@competition, @team), notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = current_user.teams.new(team_params)\n @league = League.find_by(id: params[:league_id])\n @team.league = @league\n if @team.save\n LeagueInvite.where(email: current_user.email, league: @league).destroy_all\n flash[:success] = \"Added team to league\"\n if @league.teams.count == 10 && current_season = Season.current.first\n if LeagueSeason.where(league: @league, season: current_season).count == 0\n LeagueSeason.create(league: @league, season: current_season)\n end\n end\n redirect_to league_players_path(@league)\n else\n render action: :new\n end\n end", "def create\n @user_team = UserTeam.new(user_team_params)\n\n respond_to do |format|\n if @user_team.save\n format.html { redirect_to @user_team, notice: 'User team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team created successfully.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n @team.slug = @team.name.downcase.gsub(\" \", \"-\")\n\n @team.community_rating = 0\n\n # Set default picture url\n if [email protected]_url\n @team.picture_url = 'https://d13yacurqjgara.cloudfront.net/users/205424/screenshots/1953810/pandamoniumshot.png'\n end\n\n @user = User.find(session[:session_key])\n\n respond_to do |format|\n if @team.save\n @team.users.push(@user)\n @team.users\n @team.save\n user_teams = @team.user_teams.find_by(user_id: @user.id)\n user_teams.role = params[:role]\n user_teams.status = 1\n user_teams.save!\n\n # TODO: Add game to user profile if it's not already there\n\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @team = @competition.teams.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end", "def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n # current_game.users.push(@team)\n format.html { redirect_to teams_path, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@team = Team.new(team_params)\n\n\t\tif @team.save\n\t\t\trender json: @team\n\t\telse\n\t\t\trender json: {\n\t\t\t\terror: {\n\t\t\t\t\tmessage: @team.errors.full_messages.to_sentence\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\tend", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to root_path, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mm_team = MmTeam.new(params[:mm_team].permit(:name, :user_id))\n @mm_team.user = User.find_by(params[:user_id])\n\n respond_to do |format|\n if @mm_team.save\n format.html { redirect_to(admin_mm_teams_url, :notice => 'Mm team was successfully created.') }\n format.xml { render :xml => @mm_team, :status => :created, :location => @mm_team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mm_team.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n\n @membership = Membership.new(team_id: @team.id, player_id: @team.player_id)\n @membership.save\n end", "def create\n @team_admin = TeamAdmin.new(params[:team_admin])\n\n respond_to do |format|\n if @team_admin.save\n format.html { redirect_to @team_admin, notice: 'Team admin was successfully created.' }\n format.json { render json: @team_admin, status: :created, location: @team_admin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def team_params\n params.require(:team).permit(:name, :user_id, :club_id, :active)\n end", "def create\n @mens_team = MensTeam.new(mens_team_params)\n\n respond_to do |format|\n if @mens_team.save\n format.html { redirect_to @mens_team, notice: 'Mens team was successfully created.' }\n format.json { render :show, status: :created, location: @mens_team }\n else\n format.html { render :new }\n format.json { render json: @mens_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts \"IN CREATE ACTION\"\n if(current_user.role == \"guest\")\n redirect_to login_url and return\n end\n @coaches = Coach.all\n @divisions = Division.all\n @organizations = Organization.all\n @students = Student.all\n @team = Team.new(team_params)\n\n unless current_user.coach.nil?\n @team_organization = current_user.coach.organization\n #@team_name = @team.organization.short_name + \" \" + (@team.organization.teams.count+1).to_s\n @team.organization_id = @team_organization.id\n #@team.name = @team_name\n end\n\n puts \"TEAM IS #{@team.valid?} -- #{@team.to_yaml}\"\n \n respond_to do |format|\n if @team.save\n params[:team][:student_teams_attributes].each do |sta|\n st = StudentTeam.new\n puts \"PREVIEW -- #{@team.id} :: #{sta[1][1]}\"\n # @team.student_teams.each do |st|\n st.team_id = 86\n st.student_id = sta[1][1]\n if st.save\n puts \"StudentTeam ID: #{st.id}\"\n else\n puts \"FAIL\"\n end\n end\n format.html { redirect_to edit_team_url(@team), notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def team_params\n params.require(:team).permit(\n :name, :email, :password, :password_confirmation\n )\n end", "def team_params\n params.require(:team).permit(:team_name, :organization_id)\n end", "def set_team\n @team = current_user.teams.find(params[:id])\n end", "def create\n\t\t@team = Team.new(team_params)\n\n\t\trespond_to do |format|\n\t\t\tif @team.save\n\t\t\t\tformat.html do\n\t\t\t\t\t# Add current user to team.\n\t\t\t\t\tmembership = Membership.new\n\t\t\t\t\tmembership.user_id = current_user.id\n\t\t\t\t\tmembership.team_id = @team.id\n\t\t\t\t\tmembership.started_at = DateTime.now\n\n\t\t\t\t\tredirect_to @team, notice: \"Team was successfully created.\", alert: (membership.save ? nil : \"Could not join created team.\")\n\t\t\t\tend\n\t\t\t\tformat.json { render action: \"show\", status: :created, location: @team }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @team.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n\n params[:team_admin][:user_id] = @current_user.id\n @team_admin = TeamAdmin.new(params[:team_admin])\n\n respond_to do |format|\n if @team_admin.save\n format.html { redirect_to root_url }\n format.json { render json: @team_admin, status: :created, location: @team_admin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def team_params\n params.require(:team).permit(:name, :status)\n end", "def team_params\n params.require(:team).permit(:name, :description, :owner_id, :eaten_doughnuts, :admin,\n :awaiting_doughnuts, :slack_url, :slack_name)\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def team_params\n params[:team].permit(:team_name)\n end", "def create\n unless team_registrable?\n respond_to do |format|\n format.html { redirect_to teams_path, alert: 'Team registration is closed.' }\n format.json { render json: { status: 'closed' } }\n end\n return\n end\n\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\n team.save\r\n\r\n end \r\n end", "def create_teams\n parent = Object.const_get(session[:team_type]).find(params[:id])\n Team.randomize_all_by_parent(parent, session[:team_type], params[:team_size].to_i)\n undo_link(\"Random teams have been created successfully. \")\n redirect_to :action => 'list', :id => parent.id\n end", "def create(_team)\n # stub\n end", "def team_params\n params.require(:team).permit(:league_id, :name)\n end", "def team_params\n params.require(:team).permit(:name)\n end", "def team_params\n params.require(:team).permit(:name)\n end", "def team_params\n params.require(:team).permit(:name)\n end", "def team_params\n params.require(:team).permit(:name)\n end", "def team_params\n params.require(:team).permit(:name)\n end", "def team_params\n params.require(:team).permit(:name)\n end", "def team_params\n params.require(:team).permit(:name)\n end", "def team_params\n params.require(:team).permit(:name)\n end", "def set_manage_team\n @manage_team = ManageTeam.find(params[:id])\n end", "def team_params\n params.require(:team).permit(:name, :game_id)\n end", "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team created successfully.' }\n format.json { render :my_team, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if team.save\n format.html { redirect_to team, notice: 'Team was successfully created.' }\n format.json { render json: team, status: ':created', location: team }\n else\n format.html { render action: 'new' }\n format.json { render json: team.errors, status: ':unprocessable_entity' }\n end\n end\n end", "def create\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n # create team\n team = Team.create(name: params[:team_name], course: $selected_course)\n\n # add students to teams\n student_ids = params[:student_ids]\n student_ids.each do |student_id|\n StudentTeam.create(student_id: student_id, team: team)\n end\n\n render json: { success: true }\n end", "def team_params\n params.require(:team).permit(:name, :description)\n end", "def set_team\n @team = current_user.teams.find(params[:id])\n end", "def team_params\n\t\tparams.require(:team).permit(:name, :contested_opinions, :uncontested_opinions, :contested_objections, :uncontested_objections, :comments, :initiators, :following, :active, :bookmarks, :hot_topics, :categories, :key_words, :levels, :range, :today, :last_week, :last_month)\n\tend", "def add_app_team(org_name:, platform:, app_id:, team_name:)\n endpoint = \"/api/organizations/#{org_name}/platforms/#{platform}\"\\\n \"/apps/#{app_id}/teams\"\n res = api.post endpoint do |request|\n request.headers['Content-Type'] = 'application/x-www-form-urlencoded'\n request.body = URI.encode_www_form(\n team: team_name\n )\n end\n Response.new(res)\n end", "def create\n @team = Team.create({:name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end", "def create\n @team = fetch_team\n authorize @team\n @team.owners << current_user\n\n if @team.save\n @team.create_activity(:create,\n owner: current_user,\n parameters: { team: @team.name })\n respond_with(@team)\n else\n respond_with @team.errors, status: :unprocessable_entity\n end\n end", "def create\n @users_team = UsersTeam.new(users_team_params)\n\n respond_to do |format|\n if @users_team.save\n format.html { redirect_to @users_team, notice: 'Membro adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @users_team }\n else\n format.html { render :new }\n format.json { render json: @users_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n format.html { redirect_to :teams, notice: 'Team creation not allowed... But you seem to have a little bit of knowledge...' }\n end\n nil\n # goes to private load_team\n end", "def create\n\n \t\t\t@team = Team.new team_params\n\n \t\t\tif @team.save\n\n \t\t\t\trender json: @team,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend", "def create\n\t\t@team = Team.new(team_params)\n\n\t\trespond_to do |format|\n\t\t\tif @team.save\n\t\t\t\tformat.html { redirect_to @team, notice: 'Team was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @team }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @team.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @team = Team.new(team_params)\n respond_to do |format|\n begin\n @team.save!\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n rescue => e\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_teams\n number_of_teams.to_i.times do |i|\n self.teams << Team.create!(:name => TEAM_NAMES[i])\n end\n end", "def create\n @mission_team = @game.mission_teams.new(mission_team_params)\n\n respond_to do |format|\n if @mission_team.save\n format.html { redirect_to [@game, @mission_team], notice: 'Mission team was successfully created.' }\n format.json { render :show, status: :created, location: @mission_team }\n else\n format.html { render :new }\n format.json { render json: @mission_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# league admin can add\n\t\t# anyone can add (own team) as pending iff league is addable\n\t\tds = DivisionSeason.find params[:division_season_id]\n\t\tteam = Team.find team[:team_id]\n\n\t\tif can? :manage_teams, ds\n\t\t\tTeamDSService.add_team(ds, team)\n\t\telse\n\t\t\tauthorize! :add_team, ds\n\t\t\tTeamDSService.add_pending_team(ds, team)\n\t\tend\n\n\t\trespond_with tdsr\n\tend", "def create\n @ultimate_team = UltimateTeam.new(params[:ultimate_team])\n\n respond_to do |format|\n if @ultimate_team.save\n format.html { redirect_to @ultimate_team, notice: 'Ultimate team was successfully created.' }\n format.json { render json: @ultimate_team, status: :created, location: @ultimate_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ultimate_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def team_params\n params.require(:team).permit(:game_id, :name, :description, :location, :picture_url, :role)\n end", "def manage_team_params\n params.require(:manage_team).permit(:name, :image, :position, :desc)\n end" ]
[ "0.7127008", "0.6976158", "0.6949987", "0.69198996", "0.6915161", "0.6896242", "0.6895454", "0.68951243", "0.6886849", "0.6885882", "0.6869468", "0.6863314", "0.6819483", "0.67638206", "0.6760003", "0.6749173", "0.6744825", "0.67044556", "0.67005664", "0.66879034", "0.66636074", "0.66627103", "0.6642036", "0.66412824", "0.6636791", "0.66231513", "0.66231513", "0.66231513", "0.6621811", "0.6620118", "0.6610329", "0.6596252", "0.6591794", "0.6587363", "0.6585006", "0.65729105", "0.6569634", "0.65695107", "0.65635127", "0.6559369", "0.6558484", "0.6558484", "0.6558484", "0.6558484", "0.6558484", "0.6558484", "0.6558484", "0.6558484", "0.6557878", "0.6556759", "0.6551151", "0.6549606", "0.6548786", "0.6541536", "0.65392095", "0.65374327", "0.6535429", "0.65352815", "0.65336233", "0.653355", "0.653168", "0.65196806", "0.6518565", "0.65180415", "0.65081406", "0.6506756", "0.6503168", "0.6497771", "0.649698", "0.6493099", "0.6486825", "0.6486825", "0.6486825", "0.6486825", "0.6486825", "0.6486825", "0.6486825", "0.6486825", "0.6486306", "0.6484288", "0.64840996", "0.6481509", "0.6470253", "0.6464449", "0.64632237", "0.6454948", "0.6446408", "0.6440314", "0.64357466", "0.64317775", "0.6423322", "0.6421831", "0.6420218", "0.6419443", "0.640874", "0.640598", "0.640553", "0.640469", "0.640421", "0.640388" ]
0.71856725
0
PATCH/PUT /manage_teams/1 PATCH/PUT /manage_teams/1.json
def update respond_to do |format| if @manage_team.update(manage_team_params) format.html { redirect_to @manage_team, notice: 'Manage team was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @manage_team.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params.required(:team).permit!)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\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\n respond_to do |format|\n ap @team.name\n ap @categorys = Category.where(:team => @team.name)\n ap @admin_tasks = AdminTask.where(:team => @team.name)\n ap @eadmin_tasks = EadminTask.where(:team => @team.name)\n ap @users = User.where(:user_info => @team.name)\n\n if @team.update(team_params)\n ap @team.name\n @admin_tasks.update_all(:team => @team.name )\n @eadmin_tasks.update_all(:team => @team.name )\n @categorys.update_all(:team => @team.name )\n @users.update_all(:user_info => @team.name )\n\n\n format.html { redirect_to team_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render json: @team }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if :opr == 'edit'\n update\n else\n @team = Team.find_by_id(params[:id])\n @team.update_attributes({:id => params[:id], :name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end\n end", "def update\n\t\tteam_id = params[:id]\n\t\t@team = Team.find(team_id)\n\t\tif @team.update(team_params)\n\t\t\trender json: @team\n\t\telse\n\t\t\trender json: {\n\t\t\t\terror: {\n\t\t\t\t\tmessage: @team.errors.full_messages.to_sentence\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to organization_teams_path(@team.organization_id), notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n define_team_user\n end", "def edit_team(id, team_name, options={})\n options.merge!(:name => team_name)\n patch \"/teams/#{id}\", :body => options\n end", "def update\n respond_to do |format|\n @team.name = team_params[:name]\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_team.update(admin_team_params)\n format.html { redirect_to admin_teams_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_team }\n else\n format.html { render :edit }\n format.json { render json: @admin_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = @club.teams.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to club_path(@club), notice: 'Mannschaft wurde aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if team.update(team_params)\n format.html { redirect_to team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: team.errors, status: ':unprocessable_entity' }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to user_path(current_user), notice: 'Team information was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @team, :update?\n\n @team_form = Team::Form.new(team: @team, attributes: team_params)\n\n respond_to do |format|\n if @team_form.save\n format.html { redirect_to team_url(subdomain: @team.subdomain, auth_token: GenerateLoginToken.call(user: current_user)), notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to competition_team_url(@competition, @team), notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_team\n @team.update(team_params)\n end", "def update_team\n \n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to teams_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @team.update(team_params)\n\n render json: @team,status: :ok\n\n else\n\n render json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "def update\n @team = Team.find(params[:team][:team_id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n if params[:players]\n TeamPlayers.update(params[:players], team_name: @team.name)\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to user_root_url, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_team.update(user_team_params)\n format.html { redirect_to @user_team, notice: 'User team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to [@race, @team], notice: I18n.t(:update, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @league = League.find(params[:league_id])\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team_admin = TeamAdmin.find(params[:id])\n\n respond_to do |format|\n if @team_admin.update_attributes(params[:team_admin])\n format.html { redirect_to @team_admin, notice: 'Team admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if (current_user.team_id != @team.id) \n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n else\n if @team.update(team_params)\n #format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n #format.html { render :edit, notice: 'Team was successfully updated.' }\n format.html { redirect_to tracks_url, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: \"Team was successfully updated.\" }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to league_team_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @users = User.active\n @projects = Project.active\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ultimate_team = UltimateTeam.find(params[:id])\n\n respond_to do |format|\n if @ultimate_team.update_attributes(params[:ultimate_team])\n format.html { redirect_to @ultimate_team, notice: 'Ultimate team was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ultimate_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_team(opts)\n HelloSign::Resource::Team.new post('/team', :body => opts)\n end", "def update\n @swim_team = SwimTeam.find(params[:id])\n\n respond_to do |format|\n if @swim_team.update_attributes(params[:swim_team])\n format.html { redirect_to swim_teams_path(), notice: 'Swim team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @swim_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_team\n @team = Team.where(\"id=?\",params[:id]).first\n\n unless @team.present? \n render json:{ status: :error, data: \"team is not find\" }\n\n end\n end", "def update\n respond_to do |format|\n if @my_team.update(my_team_params)\n format.html { redirect_to @my_team, notice: 'My team was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_team }\n else\n format.html { render :edit }\n format.json { render json: @my_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n flash[:success] = 'Team was successfully updated.'\n format.html { redirect_to @team}\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_team(opts)\n HelloSign::Resource::Team.new post('/team', body: opts)\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_team\n @team = @resource = Team.find(params[:id])\n end", "def update\n respond_to do |format|\n if @ab_team.update(ab_team_params)\n format.html { redirect_to @ab_team, notice: 'Record was updated' }\n else\n format.html { render :edit }\n format.json { render json: @ab_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Team was successfully updated.'\n @changed << @team.id\n\n format.html { redirect_to teams_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n else\n @edited << @team.id\n\n format.html { render action: 'edit', template: 'shared/edit' }\n format.js { render 'team' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user_team_request = UserTeamRequest.find_by_id(params[:id])\n\n user_team_request.delete\n\n user_team_request.create_user_team\n flash[:success] = \"Team Request Accepted!\"\n\n redirect_to user_path(current_user)\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to(@team, :notice => 'Team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n t = params[:project][:team]\n team_id = t[:team_id]\n @team = Team.find(team_id)\n @project = Project.find(params[:id])\n params[:project].delete :team\n\n respond_to do |format|\n if @project.update_attributes(params[:project]) and \n @team.update_attribute(:project_id,@project.id)\n format.html { redirect_to admin_projects_url, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update(team_params)\n render_success format, 'updated', :ok\n else\n render_errors format, @team.errors, :edit\n end\n end\n end", "def set_team\n @team = current_user.teams.find(params[:id])\n end", "def update\n @user_team = UserTeam.find(params[:id])\n\n respond_to do |format|\n if @user_team.update_attributes(params[:user_team])\n format.html { redirect_to(@user_team, :notice => 'User team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_team.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mens_team.update(mens_team_params)\n format.html { redirect_to @mens_team, notice: 'Mens team was successfully updated.' }\n format.json { render :show, status: :ok, location: @mens_team }\n else\n format.html { render :edit }\n format.json { render json: @mens_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @club = Club.find_by_slug(params[:club_id])\n @team = @club.teams.find_by_name(params[:id].upcase)\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to([@club, @team], :notice => 'Team was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n @teams = Team.order(:name)\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to \"/retrospectives\", notice: \"Your profile was succesfully updated!\" }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n @sales_team = SalesTeam.find(params[:id])\n\n respond_to do |format|\n if @sales_team.update_attributes(params[:sales_team])\n format.html { redirect_to @sales_team, notice: 'Sales team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mm_team = MmTeam.find(params[:id])\n\n respond_to do |format|\n if @mm_team.update_attributes(params[:mm_team])\n format.html { redirect_to(admin_mm_teams_url, :notice => 'Mm team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mm_team.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n param = team_params\n # There is no need to be changed if the password field is empty.\n param.delete(:password) if param[:password].blank?\n respond_to do |format|\n if @team.update(param)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @users_team.update(users_team_params)\n format.html { redirect_to @users_team, notice: 'Membro atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @users_team }\n else\n format.html { render :edit }\n format.json { render json: @users_team.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:id])\n if @team.update_attributes(team_params)\n flash[:notice] = \"Team successfully updated\"\n redirect_to teams_url\n else\n render 'edit'\n end\n end", "def update\n\t\tteam = Team.find(params[:id])\n\t\tteam.update_attributes(params[:team])\n\n\t\tredirect_to teams_path\n\tend", "def set_team\n @team = current_user.teams.find(params[:id])\n end", "def update\n if @team.update(team_params)\n redirect_to teams_url, notice: 'Team was successfully updated.'\n else\n render :edit\n end\n end", "def update\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n if @team_test.update_attributes(params[:team_test])\n format.html { redirect_to @team_test, notice: 'Team test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team.update_attributes(team_params)\n format.html { redirect_to(@team, :notice => 'Team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @team = Team.find(params[:id])\n end", "def update\n @persona_team = PersonaTeam.find(params[:id])\n\n respond_to do |format|\n if @persona_team.update_attributes(params[:persona_team])\n flash[:notice] = 'Persona team was successfully updated.'\n format.html { redirect_to(@persona_team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @persona_team.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.7077925", "0.70685786", "0.69005555", "0.68992907", "0.68281853", "0.68102705", "0.67890507", "0.6768613", "0.6767848", "0.6767848", "0.67654705", "0.67580426", "0.67580426", "0.67580426", "0.67580426", "0.67580426", "0.67580426", "0.67541224", "0.6725877", "0.6712826", "0.6710385", "0.6694241", "0.667773", "0.6652905", "0.6652402", "0.6649978", "0.6644775", "0.6642942", "0.66380596", "0.66380596", "0.6635926", "0.6624595", "0.66119754", "0.65935683", "0.65696156", "0.6542791", "0.6517639", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.65172315", "0.6514727", "0.65106136", "0.6505735", "0.6504038", "0.64978445", "0.6459263", "0.64349025", "0.64313734", "0.6397305", "0.6386734", "0.6374789", "0.6370812", "0.63695097", "0.6354652", "0.6349709", "0.6348201", "0.63467216", "0.6340939", "0.63326883", "0.63101727", "0.63061666", "0.6298085", "0.6297676", "0.628321", "0.62829554", "0.6279911", "0.62758595", "0.6256127", "0.6255862", "0.62427723", "0.6241104", "0.6237504", "0.62284565", "0.62207705", "0.62142044", "0.6205033", "0.6204261", "0.619994", "0.6197923" ]
0.6883057
4
DELETE /manage_teams/1 DELETE /manage_teams/1.json
def destroy @manage_team.destroy respond_to do |format| format.html { redirect_to manage_teams_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = @club.teams.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to club_teams_url(@club.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :ok }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ultimate_team = UltimateTeam.find(params[:id])\n @ultimate_team.destroy\n\n respond_to do |format|\n format.html { redirect_to ultimate_teams_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user_team.destroy\n respond_to do |format|\n format.html { redirect_to user_teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_team.destroy\n respond_to do |format|\n format.html { redirect_to admin_teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_team\n post('/team/destroy')\n end", "def destroy_team\n post('/team/destroy')\n end", "def delete_team(id)\n boolean_request :delete, \"/teams/#{id}\"\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_teams_url(@competition) }\n format.json { head :no_content }\n end\n end", "def destroy\n team_id = params[:id]\n status = OkrTeam.remove_team_from_system(team_id)\n\n respond_to do |format|\n if status == 200\n format.json { render json: 'Team is removed successfully from the system!', status: :ok }\n else\n format.json { render json: 'Unable to remove team from system!', status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @team_has_d.destroy\n respond_to do |format|\n format.html { redirect_to team_has_ds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n head :no_content\n end", "def destroy\n @team_admin = TeamAdmin.find(params[:id])\n @team_admin.destroy\n\n respond_to do |format|\n format.html { redirect_to team_admins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n allTeamRelation = TeamMemberRelation.where(team_id: @team.id)\n allTeamRelation.each do |r|\n r.destroy\n end\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: \"Team was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @swim_team = SwimTeam.find(params[:id])\n @swim_team.destroy\n\n respond_to do |format|\n format.html { redirect_to swim_teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to view_teams_path, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to user_root_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to organization_teams_url(@organization), notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ab_team.destroy\n respond_to do |format|\n format.html { redirect_to ab_teams_url, notice: 'Record was destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to league_teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id]);\n @team.destroy();\n redirect_to(user_path(current_user) + '/teams');\n end", "def destroy\n\n if @team.destroy\n\n render json: {team: {id: params[:id].to_i}},status: :ok\n\n else\n\n render json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "def destroy\n @mm_team = MmTeam.find(params[:id])\n @mm_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_mm_teams_url) }\n format.xml { head :ok }\n end\n end", "def delete(_team)\n # stub\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to leagues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to race_teams_url(@race), notice: I18n.t(:destroy, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @team, :destroy?\n\n @team.destroy\n respond_to do |format|\n format.html { redirect_to root_url(subdomain: ENV[\"DEFAULT_SUBDOMAIN\"]), notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if (current_user.team_id != @team.id || !current_user.admin?)\n return\n end \n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n \n end", "def destroy\n @my_team.destroy\n respond_to do |format|\n format.html { redirect_to my_teams_url, notice: 'My team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n (kick and return) if not is_god?\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to team_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to teams_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n\n ap @category = Category.where(:team => @team.name)\n ap @admin_tasks = AdminTask.where(:team => @team.name)\n @team.destroy\n @admin_tasks.destroy_all\n @category.destroy_all\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @teammate = Teammate.find(params[:id])\n @teammate.destroy\n\n respond_to do |format|\n format.html { redirect_to teammates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @team.destroy\n # respond_to do |format|\n # format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @user_team = UserTeam.find(params[:id])\n @user_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_teams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @teamstat.destroy\n respond_to do |format|\n format.html { redirect_to teamstats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nba_team = NbaTeam.find(params[:id])\n @nba_team.destroy\n\n respond_to do |format|\n format.html { redirect_to nba_teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @team\n\n @team.destroy\n respond_to do |format|\n format.html { redirect_to admin_event_teams_url, notice: 'Equipe foi EXCLUÍDO com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n team = Team.find(@users_team.team_id)\n @users_team.destroy\n respond_to do |format|\n format.html { redirect_to team_path(team), notice: 'Membro removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mm_team = MmTeam.find(params[:id])\n @mm_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(mm_teams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @team_mate = TeamMate.find(params[:id])\n @team_mate.destroy\n\n respond_to do |format|\n format.html { redirect_to team_mates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sales_team = SalesTeam.find(params[:id])\n @sales_team.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nfl_team = NflTeam.find(params[:id])\n @nfl_team.destroy\n\n respond_to do |format|\n format.html { redirect_to nfl_teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_team_stat.destroy\n respond_to do |format|\n format.html { redirect_to test_team_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n team_id = params[:id]\n @team = Team.find(team_id)\n user = current_user\n @users = [user]\n TeamMembership.find_by(\n team_id: team_id,\n member_id: user.id\n ).destroy\n\n render 'api/teams/show_team_and_members'\n end", "def destroy\n @nhl_team.destroy\n respond_to do |format|\n format.html { redirect_to pool_nhl_teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mens_team.destroy\n respond_to do |format|\n format.html { redirect_to mens_teams_url, notice: 'Mens team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sim_team = SimTeam.find(params[:id])\n @sim_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(sim_teams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @team_test = TeamTest.find(params[:id])\n @team_test.destroy\n\n respond_to do |format|\n format.html { redirect_to team_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @games_team.destroy\n respond_to do |format|\n format.html { redirect_to games_teams_url, notice: 'Games team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n\n Team.destroy(self.id)\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n respond_to do |format|\n format.html { redirect_to course_teams_path, notice: 'Team was successfully removed.' }\n end\n end", "def destroy\n @tournamentteam.destroy\n respond_to do |format|\n format.html { redirect_to tournamentteams_url, notice: 'Tournamentteam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.778806", "0.7686574", "0.76810706", "0.7672189", "0.7672189", "0.7672189", "0.7672189", "0.7672189", "0.7672189", "0.7672189", "0.7672189", "0.7672189", "0.7672189", "0.7672189", "0.7672189", "0.7662108", "0.7662108", "0.7662108", "0.7662108", "0.75636023", "0.75437754", "0.7541788", "0.74842626", "0.74842626", "0.747507", "0.74699444", "0.7468772", "0.74561226", "0.7452556", "0.7440907", "0.7424398", "0.74238026", "0.7413335", "0.741318", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7409164", "0.7405832", "0.73976284", "0.7380606", "0.7377501", "0.73707265", "0.736998", "0.7368563", "0.7362683", "0.7356297", "0.73443586", "0.73403907", "0.7327716", "0.7320084", "0.73198736", "0.7311831", "0.7310406", "0.7302906", "0.730202", "0.7291279", "0.7286882", "0.7286774", "0.7286774", "0.7286774", "0.7286774", "0.7286774", "0.7283264", "0.72573215", "0.7249106", "0.72471684", "0.72458184", "0.72445667", "0.7243287", "0.7231419", "0.72300446", "0.7229618", "0.7225667", "0.72221076", "0.7218651", "0.72168475", "0.7215007", "0.7205194", "0.7195818", "0.71822906", "0.71818864" ]
0.7943891
0
Use callbacks to share common setup or constraints between actions.
def set_manage_team @manage_team = ManageTeam.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 setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\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 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 workflow\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 default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n 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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def manage_team_params params.require(:manage_team).permit(:name, :image, :position, :desc) 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
release is not relevant
def default_docker_image "#{env}/#{appname}:#{image_tag}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release\n end", "def release\n end", "def release\n end", "def finalized; end", "def release()\n res = super(self)\n return res\n end", "def dispose; end", "def finalize!; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def release(resource); end", "def release\n\n a = self.to_a\n self.close\n a\n end", "def finalize\n end", "def release\n # @invObj.releaseObj(self)\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def cleanup!; end", "def cleanup!; end", "def release(point)\n\t\t\n\tend", "def release(point)\n\t\t\n\tend", "def release(point)\n\t\t\n\tend", "def release(point)\n\t\t\n\tend", "def finalize\n\n end", "def release(point)\n\t\t\t\t\n\t\t\tend", "def release_actions; end", "def pausable; end", "def dispose\n\n end", "def finalize\n nil\n end", "def around_release\n yield\n end", "def unlock; end", "def cleanup\r\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def release(resource)\n\t\t\t\t\t# A resource that is not good should also not be reusable.\n\t\t\t\t\t# unless resource.closed?\n\t\t\t\t\t\treuse(resource)\n\t\t\t\t\t# else\n\t\t\t\t\t# \tretire(resource)\n\t\t\t\t\t# end\n\t\t\t\tend", "def cleanup\n super\n end", "def release(number)\n \n end", "def prepareForReuse; end", "def dispose\n call Memory.deAlloc(self)\n end", "def dispose\n call Memory.deAlloc(self)\n end", "def cleanup\n super\n end", "def finalise\n end", "def dispose\n nil\n end", "def cleanup!\n # This method may be left unimplemented if that is applicable\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n\tend", "def cleanup\n\tend", "def finalize()\n # below function is not yet fully functional\n unlock_all_instances()\n end", "def finalize\n close\n end", "def release(point)\n\t\tsuper(point)\n\tend", "def private; end", "def release(plane)\n\n end", "def tear_down; end", "def release!\n @ec.release_temp self\n end", "def finalize\n replace\n _promote\n end", "def finalize_operations\n\tend", "def release\n fail AlreadyRelease unless prerelease?\n @special = ''\n @metadata = ''\n end", "def cleanup\n end", "def cleanup\n end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def released_true?\n self.released\n end", "def released? \n self.released \n end", "def teardown; end", "def teardown; end", "def reconsume; end", "def close() end", "def close() end" ]
[ "0.7480898", "0.7480898", "0.73503584", "0.7184724", "0.7163193", "0.71506006", "0.70466864", "0.7043542", "0.7043542", "0.7043542", "0.7043542", "0.6980772", "0.6922221", "0.68838364", "0.6745545", "0.670832", "0.670832", "0.670832", "0.670832", "0.670832", "0.670832", "0.670832", "0.6662002", "0.6662002", "0.66061527", "0.66061527", "0.66061527", "0.66061527", "0.6598037", "0.6595505", "0.6562379", "0.6545845", "0.65351945", "0.64671123", "0.64509934", "0.64204115", "0.6415979", "0.63814473", "0.63814473", "0.63814473", "0.637102", "0.63534987", "0.63493013", "0.6346254", "0.634359", "0.634359", "0.63384867", "0.630312", "0.62983966", "0.6272998", "0.62283707", "0.62283707", "0.62283707", "0.62283707", "0.62211865", "0.62211865", "0.62134314", "0.61938614", "0.61915374", "0.61911863", "0.6176506", "0.6170944", "0.61633414", "0.61431146", "0.6133165", "0.6100402", "0.60982156", "0.60982156", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.6096366", "0.60697925", "0.6054834", "0.60473895", "0.60473895", "0.6045854", "0.60234964", "0.60221696" ]
0.0
-1
maybe from external image
def dkrun_cmd(labeled: true, opts: nil, named: false) cmd = "docker run" if labeled release_labels = release_label_hash.map do |k, v| "--label=#{k}=#{v}" end.join(' ') cmd += " #{release_labels}" end cmd += " --net #{netname}" if netname cmd += " --name #{container_name}" if named cmd += " #{opts}" if opts cmd end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image; end", "def load_image(path)\n end", "def load_image\n Magick::Image.from_blob(data).first\n end", "def imgurl\n picref.imgurl if picref\n end", "def img\n Magick::Image::read(self.image).first\n end", "def image_from_url\n io = open(URI.parse(image_url))\n def io.original_filename; base_uri.path.split('/').last; end\n self.image = io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...) \n end", "def url() processed_image.try(:url) || fallback_url end", "def svg_image(image)\n raw image.data\n rescue Dragonfly::Job::Fetch::NotFound\n \"Image missing\"\n end", "def svg_image(image)\n raw image.data\n rescue Dragonfly::Job::Fetch::NotFound\n \"Image missing\"\n end", "def get_image2(doc, image)\n x = doc.xpath(image).first.to_s\n end", "def image_location\n src || ''\n end", "def top_image(url)\n og_image = check_og_image(url)\n apple_image = check_apple_image(url)\n mechanize_search = mechanize_search(url)\n if og_image\n return og_image\n elsif apple_image\n return apple_image\n elsif mechanize_search\n mechanize_search \n # In case all else fails ...\n else\n \"../image-dne.jpg\"\n end\n end", "def get_image\n source_file = Item.new(Path.new(params[:source]+\".\"+params[:type]))\n begin\n send_file source_file.path, :filename => source_file.path.basename.to_s, :type => \"image/#{params[:type]}\"\n rescue \n not_found\n end\n end", "def getStockImage(link)\n dog_page = HTTParty.get(link, :verify => false)\n parsed_dog_page = Nokogiri::HTML(dog_page)\n\n info_table = parsed_dog_page.css(\".biota\")[0]\n \n image = info_table.css(\"img\")[0]\n pic = image != nil ? \"https:#{image['src']}\" : nil\nend", "def image\n end", "def image\n end", "def image_src\n lambda do |text|\n hash = parse_text(text)\n image = find_image(hash)\n image.asset_digest_path\n end\n end", "def src\n @img[:src]\n end", "def images; end", "def image\n end", "def image\n end", "def image\n\n end", "def primary_image\n if images.length > 0\n images[0].url\n else\n \"https://vollrath.com/ClientCss/images/VollrathImages/No_Image_Available.jpg\"\n end\n end", "def named_image(name)\n card = named(name)\n return card['image_uris']['normal']\n end", "def get_image1(doc, image)\n x = doc.xpath(image).to_s\n end", "def image\n # 1. TODO Advertisement's image if there is an active Spot play event and has image\n # 2. else Song's image if there is an active song and has image\n return event.try(:image).try(:file) if event.try(:image) != nil\n # 3. TODO else programs's image if there is an active program with image\n # 4. TODO else Station's image if present\n # 5. TODO else App logo\n end", "def image()\n @image__\n end", "def image_url\n model.image_url.presence || h.asset_path('face.jpg')\n end", "def load_image(url)\n require 'open-uri'\n temp = Tempfile.new 'split-vertically'\n image = nil\n\n seems_legit = false\n open(temp.path, 'wb') do |file|\n file << open(url).read\n # Images server returns literally \"0\" if no image exists\n seems_legit = file.size > 1\n end\n sleep 0.25 # Let's try to be nice to the images server\n\n Magick::Image.read(temp.path).first if seems_legit\nend", "def image_url\n self.filename.url \n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def load_image(image)\n @image = Magick::Image.read(image).first\n end", "def reference_image(filename)\n\tpath = \"features/reference/#{iOSVersion}/#{device_str}/#{filename}\"\n\timg = Magick::Image::read(path).first\nend", "def image\n return self.image_custom unless self.image_custom.nil?\n return nil if self.providers.size == 0\n images = self.providers.map(&:image).compact\n return images.first if !images.empty?\n nil\n end", "def image_url\n\t\t\t@data[\"image\"][\"source\"]\n\t\tend", "def has_image?\n false\n end", "def main_image_url?\n main_image_source == ImageSource::URL\n end", "def image\n @path\n end", "def image_url\n is_processed ?\n FileSystem.url(image_path) : \n orig_image_url\n end", "def image_url\n is_processed ?\n FileSystem.url(image_path) : \n orig_image_url\n end", "def image\n self['image'] || self['image_src']\n end", "def get_image_or_placeholder\n return (self.image != \"\") && (self.image != nil) ? self.image : \"http://cdn.browshot.com/static/images/not-found.png\"\n end", "def get_image_or_placeholder\n return (self.image != \"\") && (self.image != nil) ? self.image : \"http://cdn.browshot.com/static/images/not-found.png\"\n end", "def get_image\n blog_contents = Nokogiri::HTML(self.content)\n\n if blog_contents.xpath(\"//img\").blank?\n self.post_image = nil\n else\n image_link = blog_contents.xpath(\"//img\")[0]['src']\n\n if image_link.include?(\"http://\")\n self.post_image = File.open(image_link)\n else\n image_link = Dir.pwd.concat(\"/public\" + image_link)\n self.post_image = File.open(image_link)\n end\n end\n\nend", "def social_image\n @social_image ||= social_image_card&.format(:text)&.render_source\n end", "def image\n 0\n end", "def image\n return unless object.image.attached?\n\n # object.image.blob.attributes\n # .slice('filename', 'byte_size')\n # .merge(url: image_url)\n # .tap { |attrs| attrs['name'] = attrs.delete('filename') }\n object.image.service_url\n \n end", "def scanned_image\n scanned_retreat\n end", "def image_1_is_from_google?\n !image_1_google_thumb.blank?\n end", "def image_url\n\t\t\t@data[\"originalimage\"][\"source\"] if @data[\"originalimage\"]\n\t\tend", "def verify_image(path)\n end", "def imagemagick?; end", "def image_if_present\n image? ? image : nil\n end", "def test_06b\r\n db = build\r\n db.fetch('image-1.jpg',:width => 102)\r\n db.fetch('image-1.jpg',:width => 103)\r\n db.fetch('image-1.jpg',:width => 104)\r\n db.fetch('image-1.jpg',:height => 105)\r\n r = db.image('image-1.jpg')\r\n assert_equal 'image-1.jpg',r[:original]\r\n end", "def image\n MiniMagick::Image.open(filename)\n rescue MiniMagick::Invalid\n # Proceed as if this is not an image\n nil\n end", "def image_url\n image.url\n end", "def imgdata fallback_to_url=true\n if picref && (href = picref.imgdata || (fallback_to_url && picref.url)).present?\n href\n end\n end", "def image\n @data['images']&.first\n end", "def add_image \n image = CARMD.image(self.vin)\n if image == \"\"\n image = \"http://clipart-library.com/img/2050778.png\"\n end\n self.auto_image = image \n self.save \n end", "def description_image\n parsed_description.css('img').first # there's only one\n end", "def fetch_local_image(filename)\r\n filename = ProductImport.settings[:product_image_path] + filename\r\n unless File.exists?(filename) && File.readable?(filename)\r\n log(\"Image #{filename} was not found on the server, so this image was not imported.\", :warn)\r\n return nil\r\n else\r\n return File.open(filename, 'rb')\r\n end\r\n end", "def coupen_img_url\n coupen_img = self.coupen_image.url(:original).split('?')[0]\n coupen_img.include?('missing') ? '' : coupen_img\n end", "def full_image_uri\n return nil if image.nil?\n return image if image.start_with?('http://')\n return 'http://bookmarket.webhop.org/' + image\n end", "def image\n @image ||= MiniMagick::Image.open(source_path)\n end", "def load_image(path)\n begin\n return Gosu::Image.new(path)\n rescue\n return Gosu::Image.new(\"images/error.png\") rescue nil\n end\nend", "def inspire_image\n head = satelliterepo.head.target\n parent = head.parents.first\n diff = head.diff parent\n # in some case diff is nil, which breaks image generation\n # with nilclass error <- TODO: Investivate this further\n return if diff.nil? || diff.deltas.empty?\n path = diff.deltas.last.new_file[:path]\n generate_inspire_image path\n end", "def find_normal_image\n return \"Pictures/pcn%04d.png\" % (80 + id)\n end", "def fetch name,params=nil\n\n fetch_original = !params || !params[:width] && !params[:height]\n use_not_found = (self.use_not_found ||\n params && !params[:not_found].nil?)\n nf_image = (params && params.has_key?(:not_found) ?\n params[:not_found] : self.not_found_image)\n\n if name.nil?\n return nil unless use_not_found\n name = nf_image\n end\n\n o = absolute(name) # Original\n\n # Fetch original image:\n\n if fetch_original\n if params && params[:absolute]\n return o if File.exists?(o)\n return absolute(nf_image) if use_not_found && !nf_image.nil?\n return nil\n else\n return resolve(name) if File.exists?(o)\n return resolve(nf_image) if use_not_found && !nf_image.nil?\n return nil\n end\n end\n \n # Fetch sized image:\n\n s = absolute(name,params)\n\n if File.exists?(o) # original exists\n\n if File.exists?(s)\n create_size(o,s,params) if params[:resize]==true\n return s if params[:absolute]\n return resolve(name,params)\n\n else # sized image doesn't exist\n if params[:resize]==false\n if use_not_found\n return nil if nf_image.nil?\n n = absolute(nf_image)\n ns = absolute(nf_image,params)\n create_size(n,ns,params.merge(:not_found => true))\n # This may return nil if 'a' doesn't exist.\n # Regardless, we return the location.\n return ns if params[:absolute]\n return resolve(nf_image,params)\n else\n return nil\n end\n end\n # Generate sized image:\n create_size(o,s,params.merge(:autogenerated => true))\n return s if params[:absolute]\n return resolve(name,params)\n end\n\n\n else # original doesn't exist\n if use_not_found\n return nil if nf_image.nil?\n n = absolute(nf_image)\n ns = absolute(nf_image,params)\n create_size(n,ns,params.merge(:not_found => true))\n # This may return nil if 'a' doesn't exist.\n # Regardless, we return the location.\n return ns if params[:absolute]\n return resolve(nf_image,params)\n else\n return nil\n end\n end\n\n\n\n end", "def image_url\n image.url.split('?').first if image\n end", "def image_url\n image.url.split('?').first if image\n end", "def image\n images.first\n end", "def image_source=(source)\n if self.lib_image && source == 'lib'\n self.photo = File.open(LibImage.find(self.lib_image).lib_image.path, \"rb\")\n end\n end", "def image(criteria = T.unsafe(nil)); end", "def get_single_image(file,new_image_base_name)\r\n File.basename(file).split('.').first =~ /#{new_image_base_name}[a-z][a-z][a-z]/\r\n end", "def convert_standalone_image(el, _opts, img); end", "def imagemagick7?; end", "def fetch_remote_image(filename)\r\n begin\r\n io = open(URI.parse(filename))\r\n def io.original_filename; base_uri.path.split('/').last; end\r\n return io\r\n rescue OpenURI::HTTPError => error\r\n log(\"Image #{filename} retrival returned #{error.message}, so this image was not imported\")\r\n rescue => error\r\n log(\"Image #{filename} could not be downloaded, so was not imported. #{error.message}\")\r\n end\r\n end", "def photo_from_url(url)\n end", "def path_to_image(source, options = T.unsafe(nil)); end", "def getimage\n if @artist.images.empty?\n @image = \"image1.jpg\"\n else\n @image = @artist.images.first[\"url\"]\n end\n end", "def cl_photo\n if photo?\n photo\n else\n 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSb0kZ2CA6D46RXZVJ3dvJPusC66fBq1uENE8jN3q8golJ73Ayd'\n end\n end", "def base_image\n self\n end", "def has_image?\n \t# self.image.file?\n true\n end", "def get_image_url (origin_url)\n begin\n html = open(origin_url).read\n urls = URI.extract(html)\n .select { |lnk| lnk[/\\.jpg$|\\.png$|\\.gif$|\\.jpeg/m] }\n return urls.empty? ? nil : urls[0]\n rescue Exception => e\n puts \"[ERROR] in 'DavidGetter#get_image': #{e}\"\n return nil\n end\n end", "def pbResolveBitmap(x)\n return nil if !x\n noext=x.gsub(/\\.(bmp|png|gif|jpg|jpeg)$/,\"\")\n filename=nil\n# RTP.eachPathFor(x) {|path|\n# filename=pbTryString(path) if !filename\n# filename=pbTryString(path+\".gif\") if !filename\n# }\n RTP.eachPathFor(noext) {|path|\n filename=pbTryString(path+\".png\") if !filename\n filename=pbTryString(path+\".gif\") if !filename\n# filename=pbTryString(path+\".jpg\") if !filename\n# filename=pbTryString(path+\".jpeg\") if !filename\n# filename=pbTryString(path+\".bmp\") if !filename\n }\n return filename\nend", "def image?\n image ? true : false\n end", "def image\n Pathname.new(\"#{PATH}#{self.path}\").open{|file|\n return Base64.strict_encode64(file.read)\n }\n end", "def get_image_link(page) # someday use regex here\n\t\t\tsource = getHtml(page)\n\t\t\tsource = source.gsub(\"enlarge()\", \"º\")\n\t\t\tsource = source[source.index(\"º\"), source.length]\n\t\t\tsource = source.gsub(\"http://\", \"$\")\n\t\t\tsource = source[source.index(\"$\"), source.length]\n\t\t\treturn source[1, source.index(\"\\\"\") - 1]\n\t\tend", "def extract_image(page)\n imgs = page.css('.thumbimage')\n return unless imgs\n img = imgs.reject { |img| img[:src].starts_with? 'data:' }.first\n img[:src]\n end", "def giant_url\n is_processed ?\n FileSystem.url(giant_path) : \n orig_image_url\n end", "def resolve_image\n\t\t\tif self.image_file\n\t\t\t\tunless self.image_file.is_a? String\n\t\t\t\t\tset_image(image_file)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tself.image_file = 'updates/default.png'\n\t\t\tend\n\t\tend", "def imgdata\n url_usable = fetchable # fetchable may set the thumbdata\n thumbdata || (url if url_usable)\n end", "def image\n TmdbImage.new(@imdb_id.gsub(/^tt/, ''), @api_key, @logger, @filespec) rescue nil\n end", "def image_hash; end", "def image?\n self.image.file?\n end", "def image?\n self.image.file?\n end", "def image_url\n image_uri\n end", "def get_base64_image(image)\n image_base64 = Base64.encode64(open(image) { |io| io.read })\n filter_image = image_base64.gsub(/\\r/,\"\").gsub(/\\n/,\"\")\n end", "def check_our_images!\n self.gsub!(/!image (\\w+\\/)?(\\d+)!/) do\n size, id = $1, $2\n size ||= 'thumb/'\n '\"!%s/%s%d.jpg!\":%s/image/show_image/%d' %\n [IMAGE_DOMAIN, size, id, HTTP_DOMAIN, id]\n end\n end", "def check_our_images!\n self.gsub!(/!image (\\w+\\/)?(\\d+)!/) do\n size, id = $1, $2\n size ||= 'thumb/'\n '\"!%s/%s%d.jpg!\":%s/image/show_image/%d' %\n [IMAGE_DOMAIN, size, id, HTTP_DOMAIN, id]\n end\n end", "def image?\n !!image\n end" ]
[ "0.6854997", "0.679832", "0.66605616", "0.6649216", "0.655588", "0.6523349", "0.64725894", "0.6455004", "0.6455004", "0.64312565", "0.6409965", "0.63859403", "0.6385652", "0.6378157", "0.6366419", "0.6366419", "0.63482726", "0.6345442", "0.6341713", "0.63313997", "0.63313997", "0.6330691", "0.6328886", "0.63242084", "0.6321321", "0.6319878", "0.63034964", "0.62973726", "0.6295834", "0.62914985", "0.6273851", "0.6262056", "0.62516457", "0.6250365", "0.6248342", "0.62443334", "0.6243319", "0.62327254", "0.622055", "0.622055", "0.62161356", "0.621501", "0.621501", "0.6206314", "0.6205694", "0.6200963", "0.61970353", "0.6196607", "0.6173428", "0.616425", "0.6158346", "0.6157542", "0.6156977", "0.6155516", "0.614567", "0.6140067", "0.61300534", "0.6126336", "0.61216336", "0.6119424", "0.6114299", "0.61135924", "0.61073333", "0.6107265", "0.6103497", "0.6102238", "0.6098168", "0.60857254", "0.60840076", "0.60840076", "0.607905", "0.6077364", "0.60678214", "0.60675204", "0.6066542", "0.60610116", "0.60591114", "0.6058744", "0.60458714", "0.6044426", "0.6044344", "0.6042385", "0.60406566", "0.60359985", "0.60343647", "0.60306793", "0.60267884", "0.6019033", "0.60178244", "0.60160357", "0.6014446", "0.60114163", "0.6007962", "0.60068303", "0.60058904", "0.60058904", "0.5998721", "0.59945947", "0.5991084", "0.5991084", "0.59897465" ]
0.0
-1
Note: if img1:t1 = img2:t2 points to same image hashid, they will be selected as same
def containers_for_image(img = docker_image) `docker ps -aq -f ancestor=#{img}`.split("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_refute_png_equal_with_different_image\n refute_png_equal(comparison_png(0), comparison_png(1))\n end", "def hash\n @real.hash ^ @image.hash\n end", "def find_matching_image(image)\n hue = @histogram.set_hue image: image\n bucket = @cache[hue]\n index = rand(bucket.size) # 0 <= index < bucket.size\n random = bucket[index]\n\n if random.class.to_s == 'Picture'\n image = MiniMagick::Image.open(URI::encode(random.url))\n # TODO: Figure out better way to scale\n image.scale \"60x60!\"\n bucket[index] = random = image\n @cache[hue] = bucket\n end\n\n random\n end", "def image_hash; end", "def image_similarity(hash_a, hash_b)\n 1 - image_hamming_distance(hash_a, hash_b) / 64.0\n end", "def hash() source.hash ^ target.hash; end", "def competing_image_labels\n return image.image_labels.select{ |il| (not il.target.nil?) && (not il == self) }\n end", "def init_math_images_copy\n @math_images_copy_id = math_images.model_id if math_images.model_id && math_images.model_id != id\n math_images.model_id = nil\n true\n end", "def diff_images(org, fresh)\n\t\t\t@images = [\n\t\t\t\tChunkyPNG::Image.from_file(org),\n\t\t\t\tChunkyPNG::Image.from_file(fresh)\n\t\t\t]\n\n\t\t\t@diff = []\n\n\t\t\[email protected] do |y|\n\t\t\t\[email protected](y).each_with_index do |pixel, x|\n\t\t\t\t\t@diff << [x,y] unless pixel == @images.last[x,y]\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def make_main_image_unique\n self.class.update_all({:main_image => false}, ['product_id = ? AND id != ?', product_id, id])\n end", "def hash() source.hash ^ (target.hash+1); end", "def hash() source.hash ^ (target.hash+1); end", "def compare_images(actual, expected, diff_image, image_difference_percentage_tolerance)\n images = [\n ChunkyPNG::Image.from_file(actual),\n ChunkyPNG::Image.from_file(expected)\n ]\n\n diff = []\n\n images.first.height.times do |y|\n images.first.row(y).each_with_index do |pixel, x|\n diff << [x, y] unless pixel == images.last[x, y]\n end\n end\n\n diff_percent = (diff.length.to_f / images.first.pixels.length) * 100\n\n if diff_percent > image_difference_percentage_tolerance\n x, y = diff.map { |xy| xy[0] }, diff.map { |xy| xy[1] }\n\n images.last.rect(x.min, y.min, x.max, y.max, ChunkyPNG::Color.rgb(0, 255, 0))\n images.last.save(diff_image)\n puts \"pixels (total): #{images.first.pixels.length}\"\n puts \"pixels changed: #{diff.length}\"\n puts \"pixels changed (%): #{diff_percent}%\"\n embed(diff_image, 'image/png', 'diff-screenshot')\n fail \"Images are not within the tolerence of #{image_difference_percentage_tolerance}%\"\n end\nend", "def does_images_similar?(actual_img_access_type, actual_img_access_name, excp_img_access_type, excp_img_access_name)\n if !compare_image(actual_img_access_type, actual_img_access_name, excp_img_access_type, excp_img_access_name)\n raise TestCaseFailed, 'Actual image is different from expected image'\n end\nend", "def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end", "def image_compare(path1, path2, differencesInPercent=0)\n return $marathon.compareImages(path1,path2,differencesInPercent)\nend", "def image_compare(path1, path2, differencesInPercent=0)\n return $marathon.compareImages(path1,path2,differencesInPercent)\nend", "def same_files?(*files)\n images = files.map { |fname| Digest::MD5.digest(File.binread(fname)) }\n images.all? { |img| img == images[0] }\nend", "def hash\n source.hash ^ target.hash\n end", "def identical_cells\n CodeCell.includes(:notebook).where(md5: md5).where.not(id: id)\n end", "def compare_image(actual_img_access_type, actual_img_access_name, excp_img_access_type, excp_img_access_name)\n if actual_img_access_type == 'url'\n actual_img_url = actual_img_access_name\n else\n actual_img_url = get_element_attribute(actual_img_access_type, actual_img_access_name, 'src')\n end\n\n if excp_img_access_type == 'url'\n expected_img_url = excp_img_access_name\n elsif excp_img_access_type == 'image_name'\n expected_img_url = './features/expected_images/' + excp_img_access_name\n else\n expected_img_url = get_element_attribute(excp_img_access_type, excp_img_access_name, 'src')\n end\n\n # replace 'https' with 'http' from actual image url\n if actual_img_url.include? 'https'\n actual_img_url['https'] = 'http'\n end\n\n # replace 'https' with 'http' from expected image url\n if expected_img_url.include? 'https'\n expected_img_url['https'] = 'http'\n end\n\n if expected_img_url.include? '.png'\n image_type = 'png'\n else\n image_type = 'jpg'\n end\n\n # Storing actual image locally\n open('./features/actual_images/actual_image.' + image_type, 'wb') do |file|\n file << open(actual_img_url).read\n end\n \n actual_img_url = './features/actual_images/actual_image.' + image_type\n\n # Storing Expected image locally\n if excp_img_access_type != 'image_name'\n open('./features/expected_images/expected_image.' + image_type, 'wb') do |file|\n file << open(expected_img_url).read\n end\n expected_img_url = './features/expected_images/expected_image.' + image_type\n end\n\n # Verify image extension and call respective compare function\n if image_type == 'png'\n return compare_png_images(expected_img_url, actual_img_url)\n end\n\n compare_jpeg_images(expected_img_url, actual_img_url)\nend", "def similarity\n size1 = pixel_count(@image_path_1)\n size2 = pixel_count(@image_path_2)\n\n if size1 < size2\n big = @image_path_2\n small = @image_path_1\n else\n big = @image_path_1\n small = @image_path_2\n end\n\n min_size = size(small)\n width = min_size[0] * @resize_factor\n height = min_size[1] * @resize_factor\n\n a = \"convert #{Shellwords.escape(small)} #{Shellwords.escape(big)} -resize '#{width}'x'#{height}'\\! MIFF:- | compare -metric AE -fuzz \\\"#{@color_fuzz}%\\\" - null: 2>&1\"\n result = `#{a}`\n\n result.to_i / (width * height)\n end", "def find_same_files\n # loop over find_similar_files groups\n # diff -b file1 file2\n end", "def compare(other)\n ::GD2::GD2FFI.send(:gdImageCompare, image_ptr, other.image_ptr)\n end", "def duplicate_ids\n return [] if accession_number.nil?\n Image.where(accession_number_ssim: @accession_number)\n end", "def match_items\n pairs = []\n\n originals = original_items\n thumbs = thumbnail_items\n\n until originals.empty?\n left_candidate = originals.shift\n match = thumbs.index do |thumb|\n left_candidate.related_to? thumb\n end\n if match.nil?\n pairs.push [left_candidate, match]\n else\n pairs.push [left_candidate, thumbs.slice!(match)]\n end\n end\n thumbs.each { |thumb| pairs.push [nil, thumb] }\n\n pairs\n end", "def bt_same_snapshot?(other)\n bt_snapshot_attributes == other.bt_snapshot_attributes\n end", "def guess_digest\n matches = dest_glob\n return unless matches.length == 1\n\n # Start and finish of the destination image's hash value\n finish = -name_right.length\n start = finish - 6\n\n # The source image keeps track of this guess, so we hand it off:\n @source.digest_guess = matches.first[start...finish]\n end", "def compare_snapshots(domain_name, baseline_img, candidate_img, log_dir=\"logs\")\n compare_pictures = ImageComparison.new(domain_name, baseline_img, candidate_img, log_dir)\n if compare_pictures.image_dimensions_match?\n compare_pictures.detailed_compare_images\n else\n return 1 #images differ. failing return code for Jenkins\n end\n end", "def rehash() end", "def touching_identical_pixel(pixel_coords,color =nil)\n\t\tcolor ||= pixel_color(pixel_coords)\n\t\tx, y = pixel_coords\n\t\tcandidate_pixels = [[x-1,y],[x+1,y],[x,y-1],[x,y+1]]\n\t\tcandidate_pixels.select do |candidate_pixel| \n\t\t\tpixel_color(candidate_pixel) == color && contain?(candidate_pixel)\n\t\tend.sort\n\tend", "def test_reuse_image_for_user_post1\n image = images(:commercial_inquiry_image)\n params = { mode: \"profile\", img_id: image.id.to_s }\n requires_login(:reuse_image, params)\n assert_redirected_to(user_path(rolf.id))\n assert_equal(rolf.id, session[:user_id])\n assert_equal(image.id, rolf.reload.image_id)\n end", "def test_refute_png_diff_with_1_percent_difference\n refute_png_diff(comparison_png(0), comparison_png(1), @black_white_distance * 0.01)\n end", "def test_reuse_image_for_user_post2\n image = images(:commercial_inquiry_image)\n params = { mode: \"profile\", img_id: image.id.to_s }\n post_requires_login(:reuse_image, params)\n assert_redirected_to(user_path(rolf.id))\n assert_equal(rolf.id, session[:user_id])\n assert_equal(image.id, rolf.reload.image_id)\n end", "def findDups(objArray, dupsHashArray, emptyFileArray)\n objArray.each_with_index do |obj, idx1|\n if obj.is_empty?\n emptyFileArray.push(obj.fileName)\n next \n end\n objArray.each_with_index do |obj2, idx2|\n next if idx1 >= idx2 \n if obj.md5 === obj2.md5\n foundDupHash= {:filePath => obj.fileName, :duplicatePath => obj2.fileName}\n dupsHashArray.push(foundDupHash)\n end\n end\n end \n end", "def whole_images\n ( self.images + self.variant_images ).uniq\n end", "def photos_for_merge\n photo_urls - ignored_photo_urls\n end", "def all_images_by_tags tags\n images = @ec2.images.with_owner('self').tagged( tags.first.first )\n \n images = images.select do | image |\n image_tags = image.tags.to_h\n image_tags.merge( tags ) == image_tags \n end\n \n images\n end", "def images_with_default_or_relevant_first(color_set_ids, pattern)\n images = self.images.dup\n\n if color_set_ids.present? || pattern.present?\n new_first = self.image_from_color_set_or_pattern(color_set_ids, pattern)\n else\n new_first = self.default_image\n #sometimes the default image of a product is not an image. this makes sure we are\n #displaying an image and not an attachment which would cause an error\n new_first = images.first unless self.images.include?(self.default_image)\n end\n images.rotate(images.index(new_first)) if new_first.present?\n end", "def is_pic_url_dup?\n self.class.where(\"pic = ? and id != ?\", pic, id).count > 0\n end", "def images=(image_path_hash)\n @normal_image = image_path_hash[:normal]\n @pressed_image = image_path_hash[:pressed]\n end", "def select_image\n compute.images.map { |i| [i.name, i.id] }\n end", "def avoid_duplicate_image_names(content)\n nodes = content.xpath(\"//draw:frame[@draw:name]\")\n nodes.each_with_index do |node, i|\n node.attribute('name').value = \"pic_#{i}\"\n node.xpath(\".//draw:image\").each do |draw_image|\n if !draw_image.attribute('href').nil?\n href = draw_image.attribute('href').value\n end\n unless href.to_s.empty?\n @global_image_paths_set.add(href) \n end\n end\n end\n end", "def quick_equal?\n return nil unless old_file_exists?\n return true if new_file_size == old_file_size\n old_file, new_file = load_image_files(@old_file_name, @new_file_name)\n return true if old_file == new_file\n images = load_images(old_file, new_file)\n crop_images(images, @dimensions) if @dimensions\n\n old_img = images.first\n new_img = images.last\n\n return false if sizes_changed?(old_img, new_img)\n\n return true if old_img.pixels == new_img.pixels\n\n @left, @top, @right, @bottom = find_top(old_img, new_img)\n\n return true if @top.nil?\n\n if @area_size_limit\n @left, @top, @right, @bottom = find_diff_rectangle(old_img, new_img)\n return true if size <= @area_size_limit\n end\n\n false\n end", "def check_match\n \tif @phase == 1 and @pickedSecond == true\n \t\t# check if they match\n \t\tif(@game_board.get_id(@picked) == @game_board.get_id(@picked2))\n \t\t\t@game_board.matchTile(@picked)\n \t\t\t@game_board.matchTile(@picked2)\n \n # increment match counter\n @game_board.inc_match\n \t\telse\n \t\t\t# flip the tiles \n \t\t\t@game_board.flip_tile(@picked, false)\n \t\t\t@game_board.flip_tile(@picked2, false)\n \t\tend\n \t\t@pickedSecond = false\n \t\t@phase = 0\n \tend\n end", "def get_referencing_images(base_image_uuid)\n images = SLICE_REF.get_object(\"images\", :images)\n images.select! { |image|\n image.respond_to?(:base_image_uuid) && image.base_image_uuid == base_image_uuid && image.uuid != base_image_uuid\n }\n end", "def generate_images_between(old_sha, new_sha, branch)\n head = @sat_repo.lookup(\"#{new_sha}\")\n # tails won't exist if previously repo was empty\n tail = @sat_repo.lookup(\"#{old_sha}\") unless old_sha[0..5] == '000000'\n walker = Rugged::Walker.new(@sat_repo)\n walker.push(head)\n walker.hide(tail) unless old_sha[0..5] == '000000'\n # find diff for each parent child pair\n walker.each do |commit|\n # very first commit has no parent\n if commit.parents.empty?\n generate_for('thumbnail', commit, nil)\n else\n commit.parents.each do|p|\n generate_for('thumbnail', commit, p)\n end\n end\n end\n generate_for('inspire', head, head.parents.first) if branch == 'master'\n end", "def math_images_paths(modality = nil)\n math_images.to_a(modality).uniq_by{ |v| v.basename }\n end", "def selected_image\n @selected_image || self.images[0]\n end", "def ==(other)\n (compare(other) & CMP_IMAGE).zero?\n end", "def image_shallow_copy(another_image)\n\n java_import Java::edu.stanford.cfuller.imageanalysistools.image.ImageFactory\n\n ImageFactory.createShallow(another_image)\n\n end", "def find_similar_files\n \"SELECT * FROM files \n WHERE md5 = md5 AND sha1 = sha1 AND size = size\n GROUP BY md5, sha1, size\"\n end", "def image(hash={})\n\t\tif hash['id'] =~ /nsys|Hand|Arm|Leg|Eye|back|abdomen|chest|head|neck/o\n\t\t\tStatus.sf_update(hash['id'], hash['name'])\n\t\tend\n\tend", "def matchTile(ind)\n\t\t@tile_Array[ind].set_match\n\tend", "def update!(**args)\n @matching_image_reference_key = args[:matching_image_reference_key] if args.key?(:matching_image_reference_key)\n end", "def compare_two_images_in_cloud\n puts('Compares the two images in cloud storage:')\n\n # Compare two images\n image_id1 = File.join(ImagingAiBase::CLOUD_PATH, comparable_image)\n image_id2 = File.join(ImagingAiBase::CLOUD_PATH, comparable_image_similar_more_75)\n folder = nil\n storage = nil # We are using default Cloud Storage\n\n request = AsposeImagingCloud::CompareImagesRequest.new(\n search_context_id, image_id1, nil, image_id2, folder, storage)\n\n puts(\"Call CompareImages with params: image1: #{image_id1}, image2: #{image_id2}\")\n\n search_results = imaging_api.compare_images(request)\n\n similarity = search_results.results[0].similarity\n puts('Images Similarity: ' + similarity.to_s)\n puts\n end", "def RMSE(img_filename_1,img_filename_2)\n\n\n\n\t\timg_1 = Magick::Image::read(img_filename_1).first\n\t\timg_2 = Magick::Image::read(img_filename_2).first\n\n\t\timg_1 = img_1.quantize(number_colors=256, colorspace=RGBColorspace, dither=RiemersmaDitherMethod, tree_depth=0, measure_error=true)\n\t\timg_2 = img_2.quantize(number_colors=256, colorspace=RGBColorspace, dither=RiemersmaDitherMethod, tree_depth=0, measure_error=true)\n\n\t\timg_1 = image_resize(img_1)\n\t img_2 = image_resize(img_2)\n\t \n\t img_1 = img_1.auto_gamma_channel(AllChannels)\n\t img_2 = img_2.auto_gamma_channel(AllChannels)\n\n\t puts \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n\n\t puts \"1: #{img_1.mean_error_per_pixel} 2: #{img_1.normalized_mean_error} 3: #{img_1.normalized_maximum_error}\"\n\n\t \tarray = img_1.difference(img_2)\n\n\t puts \"1: #{img_1.mean_error_per_pixel} 2: #{img_1.normalized_mean_error} 3: #{img_1.normalized_maximum_error}\"\n\n\t puts \" #{array[0]}\"\n\t puts \" #{array[1]}\"\n\t puts \" #{array[2]}\"\n\n\t #1 is the same image - 0 is totaly differente\n\t return (1 - (array[0] / 30509.92))\n\n\t #sum_red = 0\n\t #sum_green = 0\n\t #sum_blue = 0\n\t #img_max_red = 0\n\t #img_min_red = 2**img_1.depth\n\t #img_max_green = 0\n\t #img_min_green = 2**img_1.depth\n\t #img_max_blue = 0\n\t #img_min_blue = 2**img_1.depth\n\t #img_1.each_pixel do |pixel,column,row|\n\t \n\t #sum_red = sum_red + (((img_1.pixel_color(column,row).red - img_2.pixel_color(column,row).red )**2))\n\t #img_max_red = change_max_value(img_max_red,img_1.pixel_color(column,row).red)\n\t #img_min_red = change_min_value(img_min_red,img_1.pixel_color(column,row).red)\n\t #img_max_red = change_max_value(img_max_red,img_2.pixel_color(column,row).red)\n\t #img_min_red = change_min_value(img_min_red,img_2.pixel_color(column,row).red)\n\n\n\t #sum_green = sum_green + (((img_1.pixel_color(column,row).green - img_2.pixel_color(column,row).green)**2))\n\t ##Image 1\n\t #img_max_green = change_max_value(img_max_green,img_1.pixel_color(column,row).green)\n\t #img_min_green = change_min_value(img_min_green,img_1.pixel_color(column,row).green)\n\t ##Ima 2 find max and min value in both \n\t #img_max_green = change_max_value(img_max_green,img_2.pixel_color(column,row).green)\n\t #img_min_green = change_min_value(img_min_green,img_2.pixel_color(column,row).green)\n\n\n\t #sum_blue = sum_blue + (((img_1.pixel_color(column,row).blue - img_2.pixel_color(column,row).blue )**2))\n\t #img_max_blue = change_max_value(img_max_blue,img_1.pixel_color(column,row).blue)\n\t #img_min_blue = change_min_value(img_min_blue,img_1.pixel_color(column,row).blue)\n\t #img_max_blue = change_max_value(img_max_blue,img_2.pixel_color(column,row).blue)\n\t #img_min_blue = change_min_value(img_min_blue,img_2.pixel_color(column,row).blue)\n\n\t #end\n \n \t#value = (Math.sqrt(sum_red) / (img_max_red - img_min_red)) + (Math.sqrt(sum_green) / (img_max_green - img_min_green)) + (Math.sqrt(sum_blue) / (img_max_blue - img_min_blue)) \n\n\t\t#return value \n\tend", "def diff_params\n params.require(:diff).permit(:old_image_id, :new_image_id)\n end", "def collision_attack(bit_size, set_index = 0)\n # randomize the set of preimages to make each trial different\n digests = Array.new(SHUFFLED_RAND_STRINGS[set_index].size)\n found = false\n used_digests=0\n # for every new digest computed, compare it against the list of known digests to find a match\n SHUFFLED_RAND_STRINGS[set_index].each_with_index do |rstring1, index1|\n digests[index1] = create_digest(rstring1, bit_size)\n used_digests += 1\n # the '-1' prevents the digest from being compared with itself\n (index1-1).times.each do |index2|\n if digests[index1] == digests[index2] then\n found = true\n break\n end\n end\n break if found\n end\n raise \"no collision found\" if !found\n used_digests\nend", "def same; end", "def different?\n return nil unless old_file_exists?\n\n old_file, new_file = load_image_files(@old_file_name, @new_file_name)\n\n return not_different if old_file == new_file\n\n images = load_images(old_file, new_file)\n\n crop_images(images, @dimensions) if @dimensions\n\n old_img = images.first\n new_img = images.last\n\n if sizes_changed?(old_img, new_img)\n save_images(@annotated_new_file_name, new_img, @annotated_old_file_name, old_img)\n @left = 0\n @top = 0\n @right = old_img.dimension.width - 1\n @bottom = old_img.dimension.height - 1\n return true\n end\n\n return not_different if old_img.pixels == new_img.pixels\n\n @left, @top, @right, @bottom = find_diff_rectangle(old_img, new_img)\n\n return not_different if @top.nil?\n\n return not_different if @area_size_limit && size <= @area_size_limit\n\n annotated_old_img, annotated_new_img = draw_rectangles(images, @bottom, @left, @right, @top)\n\n save_images(@annotated_new_file_name, annotated_new_img,\n @annotated_old_file_name, annotated_old_img)\n true\n end", "def copy_cheaty(src, srcId, dest, destId, origin, target)\n #We need the tile's offset within its block.\n destPt = [(destId%2)*32 , (destId/2)*32]\n\n #Now, copy it and magnify it.\n for x in (0...16)\n for y in (0...16)\n for iX in (0...2) \n for iY in (0...2)\n srcVal = src[origin[0]+x,origin[1]+y]\n destXY = [target[0]+destPt[0]+2*x+iX,target[1]+destPt[1]+2*y+iY]\n dest[destXY[0], destXY[1]] = srcVal\n end\n end\n end\n end\nend", "def correct(master_pics = nil)\n @correct_pics ||= self.select do |pic|\n pic.bid_id && master_pics.detect { |p| pic.game_id == p.game_id }.bid_id == pic.bid_id\n end\n end", "def image_changes?(params)\n for image in self.images.keys\n if params.include? image.to_sym\n return true\n elsif !params[\"existing_image_for_#{image.to_s}\"].blank?\n return true\n end \n end\n return false\n end", "def image_ids; (images.map(&:id) rescue []); end", "def image_ids; (images.map(&:id) rescue []); end", "def match_position_by_full_string\n\n t_width = template_image.columns\n t_height = template_image.rows\n t_pixels = template_image.export_pixels_to_str(0, 0, t_width, t_height)\n\n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n \n puts \"Checking search image at #{x}, #{y}\" if @verbose\n s_pixels = search_image.export_pixels_to_str(x, y, t_width, t_height)\n \n if s_pixels == t_pixels\n self.match_result = x, y\n throw :found_match\n end\n\n end\n end\n end # catch :found_match\n return match_result\n end", "def quick_equal?\n return nil unless old_file_exists?\n\n old_image, new_image = preprocess_images vips_load_images(@old_file_name, @new_file_name)\n\n return false if dimension_changed?(old_image, new_image)\n\n diff_mask = VipsUtil.difference_mask(@color_distance_limit, old_image, new_image)\n self.difference_region = VipsUtil.difference_region_by(diff_mask)\n\n return true if difference_region_empty?(new_image)\n\n return true if @area_size_limit && size <= @area_size_limit\n\n return true if @tolerance && @tolerance >= difference_level(diff_mask, old_image)\n\n # TODO: Remove this or find similar solution for vips\n if @shift_distance_limit\n warn '[capybara-screenshot-diff] Instead of shift_distance_limit ' \\\n 'please use median_filter_window_size and color_distance_limit options'\n return true if chunky_png_driver.quick_equal?\n end\n\n false\n end", "def image_by_id(image_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking image ID #{image_id.inspect} from pool\"\n images.select { |image| image[:id] == image_id.to_i }.first\n end", "def same_location_taxon_photos\n Photo.find_by_sql([\"SELECT photos.* FROM photos, sightings WHERE sightings.trip_id=? AND photos.location_id=sightings.location_id AND photos.taxon_latin_name=sightings.taxon_latin_name\", self.id])\n end", "def test_monkey_multi_enhanced_mip_setting_tags\n # Setup\n image1 = upload_and_link_image('int_xxid', @int_xxid, @user.oauth_token)\n image2 = upload_and_link_image('int_xxid', @int_xxid, @user.oauth_token)\n tags1 = {\n 'cover' => true,\n 'profile' => true,\n 'logo' => true,\n 'stock' => true\n }\n tags2 = {\n 'cover' => true,\n 'profile' => [true, false].sample,\n 'logo' => false,\n 'stock' => true\n }\n\n # Step 1\n params = {\n 'api_key' => @api_key,\n 'tags' => tags1\n }\n\n post \"/b_image/#{image1}/int_xxid/#{@int_xxid}\", params\n assert_response(@response, :success)\n\n get_images_from_int_xxids(@int_xxid)\n assert_response(@response, :success)\n assert_equal(2, @parsed_response['relations'].length, @parsed_response)\n\n image1_data = @parsed_response['relations'].find { |rel| rel['id'] == image1 }\n refute_nil(image1_data, \"Expected image1 to be returned /b_image/int_xxid/#{@int_xxid}\")\n image2_data = @parsed_response['relations'].find { |rel| rel['id'] == image2 }\n refute_nil(image2_data, \"Expected image1 to be returned /b_image/int_xxid/#{@int_xxid}\")\n\n tags1.each_key { |k|\n assert_includes(image1_data['tags'], k)\n refute_includes(image2_data['tags'], k)\n }\n\n # Step 2\n params = {\n 'api_key' => @api_key,\n 'tags' => tags2\n }\n\n post \"/b_image/#{image2}/int_xxid/#{@int_xxid}\", params\n assert_response(@response, :success)\n\n get_images_from_int_xxids(@int_xxid)\n assert_response(@response, :success)\n assert_equal(2, @parsed_response['relations'].length, @parsed_response)\n\n image1_data = @parsed_response['relations'].find { |rel| rel['id'] == image1 }\n refute_nil(image1_data, \"Expected image1 to be returned /b_image/int_xxid/#{@int_xxid}\")\n image2_data = @parsed_response['relations'].find { |rel| rel['id'] == image2 }\n refute_nil(image2_data, \"Expected image1 to be returned /b_image/int_xxid/#{@int_xxid}\")\n\n tags2.each do |k, v|\n if v\n if k == 'stock'\n assert_includes(image2_data['tags'], k)\n assert_includes(image1_data['tags'], k)\n else\n assert_includes(image2_data['tags'], k)\n refute_includes(image1_data['tags'], k)\n end\n else\n refute_includes(image2_data['tags'], k)\n assert_includes(image1_data['tags'], k)\n end\n end\n end", "def reuse_image # :norobots:\n pass_query_params\n @mode = params[:mode].to_sym\n @observation = Observation.safe_find(params[:obs_id]) if @mode == :observation\n @term = Term.safe_find(params[:term_id])\n done = false\n\n # Make sure user owns the observation.\n if (@mode == :observation) and\n !check_permission!(@observation)\n redirect_to(:controller => 'observer', :action => 'show_observation',\n :id => @observation.id, :params => query_params)\n done = true\n\n # User entered an image id by hand or clicked on an image.\n elsif (request.method == :post) or\n !params[:img_id].blank?\n image = Image.safe_find(params[:img_id])\n if !image\n flash_error(:runtime_image_reuse_invalid_id.t(:id => params[:img_id]))\n\n elsif @mode == :observation\n # Add image to observation.\n @observation.add_image(image)\n @observation.log_reuse_image(image)\n Transaction.put_observation(:id => @observation, :add_image => image)\n redirect_to(:controller => 'observer', :action => 'show_observation',\n :id => @observation.id, :params => query_params)\n done = true\n\n elsif @mode == :term\n # Add image to term\n @term.add_image(image)\n @term.log_reuse_image(image)\n redirect_to(:controller => :glossary, :action => :show_term,\n :id => @term.id, :params => query_params)\n done = true\n else\n # Change user's profile image.\n if @user.image == image\n flash_notice(:runtime_no_changes.t)\n else\n @user.update_attributes(:image => image)\n Transaction.put_user(:id => @user, :set_image => image)\n flash_notice(:runtime_image_changed_your_image.t(:id => image.id))\n end\n redirect_to(:controller => \"observer\", :action => \"show_user\",\n :id => @user.id)\n done = true\n end\n end\n\n # Serve form.\n if !done\n if params[:all_users] == '1'\n @all_users = true\n query = create_query(:Image, :all, :by => :updated_at)\n else\n query = create_query(:Image, :by_user, :user => @user, :by => :updated_at)\n end\n @layout = calc_layout_params\n @pages = paginate_numbers(:page, @layout['count'])\n @objects = query.paginate(@pages,\n :include => [:user, {:observations => :name}])\n end\n end", "def delete_images(old_images)\n old_images.each do |name, image|\n image.delete(:all) if image && image != send(name)\n end\n end", "def shared(other_hash)\n end", "def test_different_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"10b4\")\r\n\t\t\r\n\t\tassert_equal(0, tb.compare_current_hash)\r\n\tend", "def update_images=(image_attributes) \n image_attributes.each do |attributes| \n post = post_images.detect {|n| n.id == attributes[:id].to_i}\n post.attributes = attributes\n end\n end", "def cur_image\n self\n end", "def find_images el, images = Set.new\n el.children.each {|elem| find_images elem, images}\n if el.type == :img\n images << el.attr['src']\n end\n images\n end", "def selectionRectChanged(imageView)\n if imageBrowserView.selectionIndexes.count == 1\n index = imageBrowserView.selectionIndexes.firstIndex\n images[index].crop = NSStringFromRect( imageView.selectionRect )\n end\n end", "def test_same_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"90a2\")\r\n\t\t\r\n\t\tassert_equal(1, tb.compare_current_hash)\r\n\tend", "def input_target2\n old_target = state.target.clone\n unless cell_closest_to_mouse2 == state.star\n state.target = cell_closest_to_mouse2\n end\n unless old_target == state.target\n reset_search\n end\n end", "def eql?(other)\n\t\t\tself.fileid.eql?(other.fileid)\n\t\tend", "def compare_images(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'SearchResultsSet')\n end", "def selection\n @tg.clear\n s1_temp = -1\n s2_temp = -1\n s1_temp = @ep.sample(@ss).max until s1_temp != -1\n s2_temp = @ep.sample(@ss).max until s2_temp != -1\n @s1 = @ep.index(s1_temp)\n @s2 = @ep.index(s2_temp)\n @tg[@s1] = @cg[@s1]\n @tg[@s2] = @cg[@s2]\n end", "def ==(other)\n return true if self.equal?(other)\n self.class == other.class &&\n background_pattern_color == other.background_pattern_color &&\n foreground_pattern_color == other.foreground_pattern_color &&\n texture == other.texture\n end", "def do_overlay_image(image, hash)\n #puts \"get image\"\n #puts \"#{hash.inspect}\"\n #puts \"Image: #{hash[:image_path]}\"\n #puts \"File exists? #{File.exists?(hash[:image_path])}\"\n overlay_i = Magick::ImageList.new(hash[:image_path]).first\n #puts \"Do we want to colorize?\"\n if hash.has_key? :colorize\n \n #opc = hash[:opacity]\n overlay_i = do_colorize(overlay_i, hash.merge({:opacity=>0.5})) #overlay_i.colorize(opc, opc, opc, hash[:colorize])\n end\n return image.composite(overlay_i, 0, image.rows-overlay_i.rows, Magick::OverCompositeOp)\n end", "def copy_math_images\n return true unless @math_images_copy_id\n self.math_images = Slide.find(@math_images_copy_id).math_images.copy_to(id)\n end", "def shared_edges(tile)\n all_edges & tile.all_edges\n end", "def ==(other)\n self.class==other.class && self.hash==other.hash\n end", "def se\r\n db = ITestUtils.newdb\r\n db.store(test_image1,:name => 'orig-1.jpg' )\r\n db.fetch('orig-1.jpg',:width => 102)\r\n db.store(test_image1,:name => 'notfound-1.jpg' )\r\n db.store(test_image1,:name => 'notfound-2.jpg' )\r\n db\r\n end", "def eql?(other_grid)\n return @id == other_grid.id\n #return @id == other_grid.id\n #result = false\n #if other_grid.x == @x && other_grid.y == @y \n # result = true\n # for y in 0...other_grid.y do\n # for x in 0...other_grid.x do\n # unless other_grid.block(x, y) == self.block(x, y)\n#\t result = false\n#\t break\n#\t end\n#\tend\n# end\n# end\n# result\n end", "def refute_png_diff(png1, png2, threshold, diff_method: :distance, msg: nil)\n diff = compare_images(png1, png2, diff_method)\n changed = diff.select { |d| d != 0 }\n difference = (changed.inject(0.0, :+) / diff.length)\n msg ||= \"Expected PNGs to have a distance of greater than #{threshold} but was #{difference}\"\n refute difference < threshold, msg\n end", "def same(x, y)\n find(x) == find(y)\n end", "def test_reuse_image_page_access\n obs = observations(:agaricus_campestris_obs)\n params = { id: obs.id }\n assert_equal(\"rolf\", obs.user.login)\n\n logout\n get(:reuse, params: params)\n assert_response(:login, \"No user: \")\n\n login(\"mary\", \"testpassword\")\n get(:reuse, params: params)\n\n # assert_redirected_to(%r{/#{obs.id}$})\n assert_redirected_to(permanent_observation_path(obs.id))\n\n login(\"rolf\", \"testpassword\")\n get(:reuse, params: params)\n\n assert_response(:success)\n # qr = QueryRecord.last.id.alphabetize\n assert_form_action(action: :attach, id: obs.id)\n end", "def same_hash?(submitted, saved)\n saved.count == submitted.count and\n Hash[saved.map { |key, value| [key, same?(submitted[key], value)] }]\n end", "def match_position_by_pixel_objects\n qfuzz = QuantumRange * fuzz\n \n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n\n catch :try_next_position do\n puts \"Checking search image at #{x}, #{y}\" if @verbose\n\n template_image.rows.times do |j|\n template_image.columns.times do |i|\n\n # #pixel_color returns a Pixel object\n # around 4x slower than export_pixels_to_str\n t_pixel = template_image.pixel_color(i,j)\n s_pixel = search_image.pixel_color(x+i,y+j)\n \n # Pixel objects allow fuzzy comparisions\n # #fcmp returns true/false if pixels are close\n if !s_pixel.fcmp(t_pixel, qfuzz)\n throw :try_next_position\n end\n\n end # template_image.rows.times do\n end # template_image.columns.times do\n\n # Success! We made it through the whole template\n # at this position.\n self.match_result = x, y\n throw :found_match\n\n end # catch :try_next_position\n\n end\n\n end\n end # catch :found_match\n return match_result\n end", "def different?\n return nil unless old_file_exists?\n\n images = vips_load_images(@old_file_name, @new_file_name)\n\n old_img, new_img = preprocess_images(images)\n\n if dimension_changed?(old_img, new_img)\n save(new_img, old_img)\n\n self.difference_region = 0, 0, width_for(old_img), height_for(old_img)\n\n return true\n end\n\n diff_mask = VipsUtil.difference_mask(@color_distance_limit, old_img, new_img)\n self.difference_region = VipsUtil.difference_region_by(diff_mask)\n\n return not_different if difference_region_empty?(old_img)\n return not_different if @area_size_limit && size <= @area_size_limit\n return not_different if @tolerance && @tolerance > difference_level(diff_mask, old_img)\n\n # TODO: Remove this or find similar solution for vips\n if @shift_distance_limit\n warn '[capybara-screenshot-diff] Instead of shift_distance_limit ' \\\n 'please use median_filter_window_size and color_distance_limit options'\n return not_different unless chunky_png_driver.different?\n end\n\n annotate_and_save(images)\n\n true\n end", "def delete_cache_and_img\n # -- out with the old -- #\n\n finger = self.fingerprint_changed? ? self.fingerprint_was : self.fingerprint\n imgfinger = self.image_fingerprint_changed? ? self.image_fingerprint_was : self.image_fingerprint\n\n if finger && imgfinger\n # -- delete our old cache -- #\n Rails.cache.delete(\"img:\"+[self.asset.id,imgfinger,self.output.code].join(\":\"))\n\n # -- delete our AssetOutput -- #\n path = self.asset.image.path(self)\n\n if path\n # this path could have our current values in it. make sure we've\n # got old fingerprints\n path = path.gsub(self.asset.image_fingerprint,imgfinger).gsub(self.fingerprint,finger)\n\n self.asset.image.delete_path(path)\n end\n end\n\n true\n end", "def compare_loaded_image_to_image_in_cloud\n puts('Compares the loaded image to image in cloud storage:')\n\n image = File.join(ImagingAiBase::CLOUD_PATH, comparable_image)\n\n input_stream = File.open(File.join(ImagingAiBase::EXAMPLE_IMAGES_FOLDER, comparable_image_similar_less_15))\n request = AsposeImagingCloud::CompareImagesRequest.new(search_context_id, image, input_stream)\n\n puts('Call CompareImages with params: image: ' + image)\n\n search_results = imaging_api.compare_images(request)\n\n similarity = search_results.results[0].similarity\n puts('Images Similarity: ' + similarity.to_s)\n puts\n end", "def has_same_photo?(fb_photos, f)\n\n # album = Mogli::Album.find(album_id, client)\n # fb_photos = album.photos\n has_photo = false\n \n fb_photos.each do |p|\n break if has_photo\n \n fb_photo_url = p.source\n fb_photo_file = get_photo_as_file_from_url(fb_photo_url)\n \n # Rails.logger.info \"reference photo(from flickr): #{f.path} - exists? #{File.exists?(f.path)}\"\n # Rails.logger.info \"compared to (from fb): #{fb_photo_file.path} - exists? #{File.exists?(fb_photo_file.path)}\" \n # Delayed::Worker.info \"reference photo(from flickr): #{f.path} - exists? #{File.exists?(f.path)}\"\n # Delayed::Worker.logger.info \"comparing incoming flickr photo to fb photos: #{fb_photo_file.path} - exists? #{File.exists?(fb_photo_file.path)}\"\n Delayed::Worker.logger.info \"comparing incoming flickr photo to fb photos: #{p.name} - #{fb_photo_url}\"\n \t\n comparer = ImageCompare.new(f.path, fb_photo_file.path)\n has_photo = true if comparer.identical?(:tolerance => 0.02)\n Delayed::Worker.logger.info \"identical to flickr photo?: #{has_photo.inspect}\"\n end\n\n Delayed::Worker.logger.info \" ********** Found duplicate in album?: #{has_photo.inspect}\"\n Delayed::Worker.logger.info \" \"\n \n return has_photo\n end", "def original_photo(photourl)\n if(current_user.upvotes.find_by(photourl: photourl) || current_user.downvotes.find_by(photourl: photourl)) \n return false\n end\n return true\nend" ]
[ "0.6200108", "0.61960924", "0.5743759", "0.57078624", "0.5675269", "0.5612333", "0.55850804", "0.5549796", "0.55158186", "0.5506872", "0.5486608", "0.5486608", "0.54725033", "0.54370236", "0.5409583", "0.5389876", "0.53847975", "0.53576136", "0.5330202", "0.53106725", "0.53079915", "0.5306761", "0.5306198", "0.5239336", "0.5217979", "0.51859057", "0.5179282", "0.51578456", "0.51433396", "0.5119794", "0.5113047", "0.50963634", "0.5048677", "0.5045414", "0.50238484", "0.50235486", "0.5022279", "0.5018744", "0.5006773", "0.5005884", "0.4998365", "0.4992904", "0.498864", "0.49580047", "0.49555162", "0.4953496", "0.49133152", "0.49086103", "0.49012035", "0.48890817", "0.4888169", "0.4880912", "0.4874345", "0.48549047", "0.4847921", "0.48416805", "0.48403108", "0.48358786", "0.481741", "0.48140615", "0.48104012", "0.48084772", "0.47994173", "0.47874767", "0.47864714", "0.47864714", "0.4758795", "0.4758356", "0.47549316", "0.47480482", "0.47446406", "0.47443557", "0.47413418", "0.4737038", "0.47362292", "0.4710051", "0.47038397", "0.47025", "0.46962392", "0.4688533", "0.46804035", "0.4673653", "0.46707198", "0.46696043", "0.46611694", "0.4659564", "0.46573815", "0.46508116", "0.4647225", "0.46460968", "0.46371362", "0.46370468", "0.46363693", "0.4632552", "0.46306533", "0.46305197", "0.46301523", "0.4623879", "0.46219933", "0.46212235", "0.46182814" ]
0.0
-1
use _ to ensure possible unique
def script_name # not file name sname = fetch(:script_name) return sname if sname name = dklet_script.basename('.rb').to_s pname = script_path.basename.to_s "#{pname}_#{name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allows_unique?\n true\n end", "def unique_safe_name\n \"#{safe_name}_#{id}\"\n end", "def uniq!() end", "def unique?\n false\n end", "def is_unique?(str)\n\nend", "def test_unique\n assert_equal \".archetype-uid-RANDOM_UID\", evaluate(\"unique(class)\")\n assert_equal \"\\#archetype-uid-RANDOM_UID\", evaluate(\"unique(id)\")\n assert_equal \"my-prefix-archetype-uid-RANDOM_UID\", evaluate(\"unique(my-prefix-)\")\n assert_equal \".testing-archetype-uid-RANDOM_UID\", evaluate(\"unique('.testing-')\")\n end", "def non_unique_letters(string)\nend", "def unique_check_key\n @unique_check_key ||= SecureRandom.hex\n end", "def probably_unique_id\n @probably_unique_id||=complete_path.base26_hash\n end", "def ensure_unique_code\n # keep trying new random codes until no match\n while self.class.find_by_code(self.code = Random.letters(CODE_LENGTH)); end\n return true\n end", "def unique?\n self[:unique] ? true : false\n end", "def ensure_unique_code\n # keep trying new random codes until no match\n while self.class.find_by_code(self.code = Random.letters(CODE_LENGTH)); end\n true\n end", "def _unique(name)\n seen = (@_seen ||= Set.new)\n if seen.include?(name)\n raise ArgumentError, \"duplicate field: #{name.inspect}\"\n else\n seen << name\n end\n end", "def create_unique_key\n begin\n self.unique_key = UrlShort.generate_key\n rescue ActiveRecord::RecordNotUnique\n if (count +=1) < 5\n retry\n else\n raise\n end\n end\n end", "def assert_unique(attrs)\n index_key = index_key_for(Array(attrs), read_locals(Array(attrs)))\n assert(db.scard(index_key).zero? || db.sismember(index_key, id), [Array(attrs), :not_unique])\n end", "def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end", "def set_unique_name\n salt = rand 1000000\n salt2 = rand 100\n if self.title.blank?\n self.unique_name = \"#{salt}_#{salt2}\" \n else\n self.unique_name = \"#{self.title.gsub(/[^\\w\\.\\-]/,'_').downcase}_#{salt}\"\n end\n end", "def unique?\n @unique\n end", "def set_unique_name\n salt = rand 1000000\n salt2 = rand 100\n if self.title.blank?\n self.unique_name = \"#{salt}_#{salt2}\" \n else\n self.unique_name = \"#{sanitized_title.downcase}_#{salt}\"\n end\n end", "def unique?\n !! @unique\n end", "def underscore\n dup.underscore!\n end", "def uniq\n :identity\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def unique?(field)\n !multiple?(field)\n end", "def uniqify_fields\n begin\n self.uniq_title = self.title.to_uniq\n self.uniq_position = self.position.to_uniq\n self.uniq_playbacks_count = self.playbacks_count.to_uniq\n self.uniq_likes_count = self.likes_count.to_uniq\n self.uuid = UUIDTools::UUID.timestamp_create().to_s if self.uuid.nil?\n rescue\n end\n end", "def generate_unique_key\n\n # @TODO:need to update the algo. Right now it's very simple algo\n length = self.url.length\n rand(36**length).to_s(36)\n end", "def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end", "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 uniq() end", "def icn_id_unique\n return if icn_id.nil?\n return if (conflicting_name = other_names_with_same_icn_id.first).blank?\n\n errors.add(:base, :name_error_icn_id_in_use.t(\n number: icn_id, name: conflicting_name.real_search_name\n ))\n end", "def unique_id #:nodoc:\n @unique_id = (@unique_id || 0) + 1\n end", "def uniqueness_generate\n self.uniqueness_options.each do |field, options|\n value = send(field)\n unless value.present?\n value = Uniqueness.generate(options)\n self.send(\"#{field}=\", value)\n end\n end\n end", "def ensure_unique\n puts \"Ensuring uniqueness of user #{self.user_id.to_s} to recipe #{self.recipe_id.to_s}\"\n end", "def test_uniqueness_of_name\n client = Client.new(:name => \"XXX\", :tat => 14,\n :partener_bank_group_code => 'KK', :internal_tat => 90, :group_code => 'JO',\n :max_jobs_per_user_payer_wise => 5, :max_jobs_per_user_client_wise => 5,\n :max_eobs_per_job => 5)\n assert_equal(false,client.save)\n end", "def unique_name\n unique_name = @name\n unique_name += \" (#{@disambiguation})\" if @disambiguation\n return unique_name\n end", "def test_uniqueness_of_username\n person_repeat = Person.new(:username => @valid_person.username.upcase)\n assert !person_repeat.valid?\n assert_equal @error_messages[:taken], person_repeat.errors[:username][0], \"Test must be case sensitive.\"\n end", "def uniqable_uid(field)\n loop do\n uniq_code = Nanoid.generate(size: 16)\n if uniq_code =~ /\\D+/\n send(\"#{field}=\", uniq_code)\n break unless self.class.where(field => uniq_code).exists?\n end\n end\n end", "def uniqueness_dictionary\n [*(:A..:Z), *(:a..:z), *(0..9)].map(&:to_s)\n end", "def uniq\n end", "def uniq\n end", "def unique_name(name)\n \"#{name}_#{Time.now.to_i}\"\n end", "def unique_name(name)\n \"#{name}_#{Time.now.to_i}\"\n end", "def verify_uniquness!(tuple)\n stream = tuple[:stream]\n attrs = %i[position event_id]\n attrs.delete(:position) if Stream.new(stream).global?\n\n attrs.each do |key|\n next if key == :position && tuple[key].nil?\n next if restrict(:stream => stream, key => tuple.fetch(key)).none?\n\n raise TupleUniquenessError.public_send(:\"for_stream_and_#{key}\", stream, tuple.fetch(key))\n end\n end", "def check_unique\n bar = Bar.where(:name => self.name, :user_id => self.user_id)\n if bar != nil\n \treturn false\n end\n end", "def ensure_uniqueness_when_replicating(replication)\n # if uniqueness property is set, make sure the specified field is unique\n if params = replicable_opts(:uniqueness)\n # setup the params for the call to the generate_unique_field_value method\n params = params.merge(:mission => replication.to_mission, :dest_obj => replication.dest_obj)\n\n # get a unique field value (e.g. name) for the dest_obj (may be the same as the source object's value)\n unique_field_val = generate_unique_field_value(params)\n\n # set the value on the dest_obj\n replication.dest_obj.send(\"#{params[:field]}=\", unique_field_val)\n end\n end", "def ensure_unique\n puts \"Ensuring uniqueness of tag #{self.tag_id.to_s} to taggable #{self.entity_id.to_s} for user #{self.user_id.to_s}\"\n end", "def unique_id(len = 8)\n @uniq_id_disallowed ||= /[^abcdefhjkmnpqrtvwxyzABCDEFGHJKMNPQRTVWXY2346789]/\n candidate = SecureRandom.urlsafe_base64((len * 2.1).ceil).gsub(@uniq_id_disallowed, '')\n fail RangeError if candidate.size < len\n\n candidate[0...len]\n rescue RangeError\n retry\n end", "def is_unique str\n uniqueness = true\n str.each_char do |char| \n if str.downcase.count(char.downcase) > 1\n uniqueness = false\n break\n end \n end\n uniqueness \nend", "def generate_uid\n def tri vals\n \"#{vals.sample}#{vals.sample}#{vals.sample}\"\n end\n chars = (\"A\"..\"Z\").to_a\n numbers = (\"0\"..\"9\").to_a\n self.uid = loop do\n uid = \"#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}\"\n break uid unless Ticket.where(uid: uid).exists?\n end\n end", "def unique\n self['unique']\n end", "def unique_spaces!\n self.gsub!(ANY_SPACE_PATTERN, UNIQUE_SPACE)\n end", "def unique_id\n generator = Sass::Script::Functions.random_number_generator\n Thread.current[:sass_last_unique_id] ||= generator.rand(36**8)\n # avoid the temptation of trying to guess the next unique value.\n value = (Thread.current[:sass_last_unique_id] += (generator.rand(10) + 1))\n # the u makes this a legal identifier if it would otherwise start with a number.\n identifier(\"u\" + value.to_s(36).rjust(8, '0'))\n end", "def uniqid\n SecureRandom.hex(32)\n end", "def uniqid\n SecureRandom.hex(32)\n end", "def _; end", "def unique?\r\n @opts[:unique]\r\n end", "def unique_name(name)\n \"pedant_#{name}_#{pedant_suffix}\"\n end", "def unique?\n return @data[\"unique\"]==true\n end", "def unique_identifiers\n return super if defined?(super)\n\n raise NotImplementedError\n end", "def generate_uid\n begin\n # .uuid or .hex? both seem to do the same job\n self.uid = SecureRandom.uuid.gsub(/[-]/, '')\n end while self.class.exists?(uid: self.uid)\n 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 unique_id(slug)\n Zlib.crc32 slug\n end", "def slug_uniqueness\n if name? and slug? and Quotum.where(slug: slug).where.not(id: id).exists?\n errors.add(:name, \"is unavailable\")\n end\n end", "def register_uniqueness(field_sym)\n \n @__fields_to_validate_uniqueness ||= {}\n @__fields_to_validate_uniqueness[field_sym] = true\n \n # puts @__fields_to_validate_uniqueness.inspect\n end", "def set_Unique(value)\n set_input(\"Unique\", value)\n end", "def validate\n self.code = generate_unique_code\n end", "def set_unique_random_key(len = 16)\n begin\n chars = ('a'..'z').to_a + ('A'..'Z').to_a\n self.key = (0..(len-1)).collect { chars[Kernel.rand(chars.length)] }.join\n end while Key.find_by_key(self.key)\n end", "def ensure_valid_key( key )\n key.to_s.index( /\\./ ) ? key.to_s.gsub( /\\./, '_' ) : key\n end", "def key=(_); end", "def key=(_); end", "def unique_name?(full_name)\n # Initialize a cache that will return false if a name is not\n # recognized, but will remember the name for next time\n $name_cache ||= Hash.new do |hash, key|\n hash[key] = \"recognized\"\n false\n end\n $name_cache[full_name]\nend", "def unique_hearstring\n HeartString.all.each do |heart_string|\n # byebug\n if (heart_string.user_id == self.user_id && heart_string.tomodachi_id == self.tomodachi_id) || (heart_string.tomodachi_id == self.user_id && heart_string.user_id == self.tomodachi_id)\n errors.add(:heartstring, \"already exists\")\n end\n end\n end", "def assign_unique_token\n unless(self.token)\n begin\n self.token = rand(36**8).to_s(36).downcase # a-z \n end while self.class.exists?(:token => token)\n end\n end", "def supports_unique_keys?\n false\n end", "def unique_id\n # check all_data instead of data, as we have to not reuse deleted key\n ids = Set.new(all_data.map { |e| e[:key] })\n id = 1\n loop do\n return id.to_s unless ids.include?(id.to_s)\n id += 1\n end\n end", "def unique_constraint_sql_fragment(_)\n 'UNIQUE'\n end", "def slug_unique_in_clinic\n errors.add(:slug, \"Slug: #{slug} already in use\") unless\n slug_unique_in_clinic?\n end", "def my_unique\n dict = Hash.new(false)\n self.each_with_index do |el, idx|\n self[idx] = nil if dict[el]\n dict[el] = true\n end\n self.compact!\n end", "def generate_unique_id\n Digest::SHA256.hexdigest unique_id_elements.join\n end", "def create_unique_id\n\t\tself.unique_id = loop do\n\t\t\trandom_token = SecureRandom.urlsafe_base64\n\t\t\tbreak random_token unless User.exists?(unique_id: random_token)\n\t\tend\n\tend", "def unique=(val)\n self['unique'] = val\n end", "def unique_identifier\n @u_id ||= \"T1\"\n @u_id = @u_id.succ\n end", "def Unique(string)\n\n # assumes alphabet of size 128\n return false if string.length > 128\n \n hash={}\n \n for i in 0..string.length-1\n return false if hash[string[i]] \n hash[string[i]]=true\n end\n \n \nreturn true\n\nend", "def assign_uid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n uid = ''\n 1.upto(8) {\n i = rand(62)\n uid += chars[i]\n }\n self.uid = uid\n end", "def test_uniqueness_of_email\n person_repeat = Person.new(:email => @valid_person.email.upcase)\n assert !person_repeat.valid?\n assert_equal @error_messages[:taken], person_repeat.errors[:email][0], \"Test must be case sensitive.\"\n end", "def unique_object_name_for(name)\n \"#{name}_#{SecureRandom.hex(5)}\"\n end", "def beUniqify\n\t\tres = Solver::Solver.uniqify(@indicesLigne,@indicesColonne)\n\t\t@indicesLigne = res[0]\n\t\t@indicesColonne = res[1]\n\t\t@grade = res[2]\n\tend", "def ensure_hash_id\n self.hash_id ||= unique_random_string_of_length(75 + Random.rand(26))\n end", "def test_creates_random_short_name_if_not_given\n num_trials = 1e4\n uniq_names = (1..num_trials).map do\n RequestedShortening.new('http://x.com').short_name\n end.uniq\n assert_equal(num_trials, uniq_names.size,\n 'Generated short names should not collide')\n end", "def show_first_unique()\n \n end", "def uniq_id(*args)\n @uniq_ids[args] || @uniq_ids[args] = (@uniq_id += 1)\n end", "def validate_unique *colnames\n\t\t\tcolnames.each { |colname|\n\t\t\t\tds = self.class.where colname => send(colname)\n\t\t\t\tds.filter!(~{primary_key => send(primary_key)}) unless new?\n\t\t\t\tif ds.count > 0\n\t\t\t\t\terrors.add(colname, 'must be unique.')\n\t\t\t\tend\n\t\t\t}\n\t\tend", "def unique_email(original)\n email = original.is_a?(User) ? original.email : original\n \"#{hex_rand}_#{email}\"\n end", "def preconditions\n validator.kind == :uniqueness\n end", "def validate_unique(child, child_type)\n if child_id_of.has_key?(child_type[0]) and child_id_of[child_type[0]].has_key?(child[child_type[1]])\n raise TPX_2_2::DuplicateElementInsertError, \"Duplicate input object id #{child[child_type[1]]} provided to #{self.class}!\"\n end\n end", "def unique_flag(user, resource)\n flag = user.id.to_s + \"_\" + resource.id.to_s\n flag\n end", "def unique_chars_with_extra_space?(str)\n hash = {}\n for i in 0..str.size-1\n if hash.key?(str[i])\n puts \"dup => #{str[i]}\"\n return false\n end\n hash[str[i]] = true\n end\n true\nend" ]
[ "0.74093693", "0.6758839", "0.6663089", "0.66524804", "0.6634064", "0.658854", "0.6531395", "0.6505814", "0.6499127", "0.64559036", "0.64087635", "0.64051026", "0.6400907", "0.63916856", "0.63460857", "0.6334097", "0.6326431", "0.63120043", "0.63098216", "0.6249823", "0.624881", "0.6218452", "0.6213871", "0.6213871", "0.6213871", "0.61765516", "0.61765516", "0.61607647", "0.6146856", "0.6130303", "0.6127492", "0.6110503", "0.61100173", "0.61031055", "0.6098415", "0.60898477", "0.6080619", "0.60469687", "0.6020255", "0.60132223", "0.60129035", "0.6002477", "0.5988082", "0.5988082", "0.597963", "0.597963", "0.59716207", "0.5965251", "0.5955875", "0.5954679", "0.5952974", "0.5945423", "0.5936543", "0.59345084", "0.5923076", "0.59195584", "0.5915755", "0.5915755", "0.58998835", "0.5894674", "0.58943903", "0.588395", "0.5881478", "0.58812076", "0.58808684", "0.58786476", "0.5878392", "0.58759457", "0.5871605", "0.5864304", "0.5856995", "0.5852001", "0.5850547", "0.5850547", "0.584733", "0.583664", "0.5834054", "0.58340126", "0.58309174", "0.5827719", "0.5826788", "0.58264333", "0.5821428", "0.5817528", "0.5815884", "0.5815847", "0.581393", "0.5808729", "0.58064985", "0.5805444", "0.579976", "0.57988614", "0.57986444", "0.5797092", "0.5795448", "0.57945424", "0.5793086", "0.5786606", "0.578419", "0.5781651", "0.57802105" ]
0.0
-1
Dockerfile for image build
def write_dockerfile(str, path: nil) set_file_for(:dockerfile, str) register_build_root(path) if path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_docker_image\n return if File.exist?(Kubes.config.state.path)\n Build.new(@options).run\n end", "def build_docker_image(image_version)\n @process_runner.execute!(\"cd #{@working_directory} && docker build -t #{repository_name}:latest -t #{repository_name}:#{image_version} .\")\n end", "def setup_dockerfile\n if options[:docker_distro] == 'debian' || options[:database] == 'oracle'\n # This is here because Debian is very compatible with most Ruby/Rails gems\n # => The Oracle InstantClient does have a number of issues when trying to build with Alpine\n template 'Dockerfile.debian.tt', 'Dockerfile'\n else\n template 'Dockerfile.alpine.tt', 'Dockerfile'\n end\n end", "def build_base_docker_image(test_dir)\n @process_runner.execute!(\"cd #{test_dir} && docker build -t test-base:2.3.0 .\")\n end", "def build_blc_base_docker_image(test_dir)\n @process_runner.execute!(\"cd #{test_dir} && docker build -t test-base:0.1.0 .\")\n end", "def build(dockerfile_path)\n dockerfile = IO.read(dockerfile_path)\n @raw = Docker::Image.build(dockerfile)\n @raw # Return the image without having to add .raw\n end", "def build_environment_docker_images(environment, system_exec)\n system_exec.execute_docker_compose(environment, :build)\nend", "def build_base_docker_images(environment, system_exec)\n\n build_args = []\n\n if environment.requires_proxy?\n build_args += create_proxy_environment_docker_build_args(environment)\n end\n\n system_exec.execute_docker(:build, %w(--tag=developer.redhat.com/base:2.0.0).concat(build_args).concat(%w(./base)))\n system_exec.execute_docker(:build, %w(--tag=developer.redhat.com/java:3.0.0).concat(build_args).concat(%w(./java)))\n system_exec.execute_docker(:build, %w(--tag=developer.redhat.com/ruby:2.3.0).concat(build_args).concat(%w(./ruby)))\nend", "def docker_build(filename, workdir)\n cmd = RakeCompilerDock.docker_build_cmd\n return if cmd.nil?\n sh(*RakeCompilerDock.docker_build_cmd, \"-f\", File.join(workdir, filename), \".\")\n end", "def build_image dockerfile_dir, name\n ::Docker.options = {:read_timeout => 6200}\n begin\n ::Docker::Image.build_from_dir(dockerfile_dir, {:t => name}) do |v|\n data = /{\"stream.*:\"(.*)\".*/.match(v)\n data = data[1].encode(Encoding.find('UTF-8'), {invalid: :replace, undef: :replace, replace: ''}) unless data == nil || data.length < 1\n $stdout.puts data unless data == nil\n end\n rescue => e\n @logger.error e\n message = /.*{\"message\":\"(.*?)\"}/.match(e.to_s)\n @logger.error \"Error: #{message[1]}\" unless message == nil || message.length < 1\n end\n end", "def dockerfile_data\n data = [\"FROM #{package}\"]\n data << 'COPY _switch /'\n data << 'COPY wheel /etc/sudoers.d/'\n data << \"RUN /_switch #{userargs} 2>&1 | tee /tmp/oswitch.log\"\n data << 'ENV LC_ALL en_US.UTF-8'\n data << \"USER #{username}\"\n data << \"ENTRYPOINT [\\\"#{shell}\\\", \\\"-c\\\"]\"\n data.join(\"\\n\")\n end", "def build_image(template)\n tpl_file = template[:template]\n tpl_vars_file = \"#{File.dirname(tpl_file)}/vars.json\"\n sh %{ packer build -var-file=#{tpl_vars_file} -var 'image_version=#{template[:vars]['image_version']}' -var 'image_output_directory=#{File.expand_path(Packer::OUTPUT_DIR)}' #{tpl_file}}\nend", "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 set_content\n version = build_config.version || 'latest'\n content = \"FROM #{build_config.image}:#{version}\\r\\n\"\\\n \"RUN apt-get update\\r\\n\"\\\n \"RUN apt-get install git -y\\r\\n\"\\\n \"RUN mkdir -p /app/current\\r\\n\"\\\n \"WORKDIR /app/current\\r\\n\"\\\n \"RUN touch /#{commit} \\r\\n\"\\\n \"RUN git clone #{project.repository.url} /app/current\\r\\n\"\n content\n end", "def render_dockerfile(image_name, version)\n dockerfile = File.join(\n File.expand_path(File.dirname(__FILE__)),\n \"Dockerfiles\",\n image_name,\n \"Dockerfile.erb\"\n )\n template = ERB.new(File.read(dockerfile))\n result = template.result(binding)\n dest = \"#{tempdir}/Dockerfile\"\n\n File.open(dest, 'w') do |file|\n file.write(result)\n end\nend", "def docker_build\n sh 'docker images | grep --quiet \"^centos *6.6-msm\"', verbose: false\nrescue RuntimeError\n sh 'docker build --tag centos:6.6-msm .', verbose: false\nend", "def call(app)\n @app = app\n\n build_dockerfile\n end", "def build(build_number, container)\n docker_cmd = 'docker '\\\n 'build '\\\n \"--file #{container.dockerfile} \" \\\n \"-t \\\"#{container.name}:#{build_number}\\\" \"\\\n '.'\n execute_command docker_cmd\n end", "def build\n info \"Building with image name as: '#{final_image_name}', tagged #{determined_version}\"\n command = \"docker build -t #{final_image_name} .\"\n logged_command = get_loglevel == Logger::INFO ? 'docker build' : command\n retval = Utils::Subprocess.run command do |stdout, stderr, thread|\n info \"[#{logged_command}] [stdout] #{stdout}\"\n info \"[#{logged_command}] [stderr] #{stderr}\" if stderr != nil\n end\n if retval.exitstatus != 0\n raise Athlete::CommandExecutionFailed, \"The command #{command} exited with non-zero status #{retval.exitstatus}\"\n end\n end", "def create_image(path)\n Docker::Image.build_from_dir(path, dockerfile: build.id) do |v|\n log = JSON.parse(v)\n if log && log.key?('stream')\n build.append_to_log log['stream']\n elsif log && log.key?('errorDetail')\n build.append_to_log log['errorDetail']\n @build_error = true\n end\n end\n end", "def build(autoinst)\n Dir.chdir(work_dir) do\n log.info \"Creating #{veewee_provider} image\"\n cmd = \"veewee #{veewee_provider} build #{IMAGE_NAME} --force --auto\"\n cmd << \" --nogui\" if headless\n system(build_environment(autoinst), cmd)\n end\n end", "def build_new_docker_image(directory, dockerfile = 'Dockerfile', debug = false, nocache = false)\n puts \"Building Dockerfile at location #{directory}\"\n @image = Docker::Image.build_from_dir(directory, {'dockerfile' => dockerfile, 'nocache' => nocache}) do |v|\n if (debug && log = JSON.parse(v)) && log.has_key?(\"stream\")\n $stdout.puts log[\"stream\"]\n end\n end\n\n set :docker_image, @image.id\n\n docker_image = @image.id\n puts \"Image build completed, ID: #{docker_image}\"\nend", "def build\n @logger.info \"Build for #{@git_commit_id} ...\"\n\n @logger.info @rgit.checkout(@git_commit_id)\n\n @logger.info 'Start building docker image...'\n build_command = \"docker build -t '#{@repository[:name]}/#{@git_commit_id}' #{@work_dir}/#{@repository[:name]}\"\n last_line = ptywrap(build_command)\n image_id = last_line.split(\" \")[-1]\n @logger.info \"image_id is #{image_id}\"\n\n image_full_id = \\\n `docker inspect --format='{{.Id}}' #{image_id}`.chomp\n write_ids(image_full_id)\n image_full_id\n end", "def parse_dockerfile_for_base\n base_image = Chef::Config[:knife][:docker_image] || 'chef/ubuntu-12.04:latest'\n dockerfile = \"#{docker_context}/Dockerfile\"\n File.open(dockerfile).each do |line|\n if line =~ /\\# BASE (\\S+)/\n base_image = line.match(/\\# BASE (\\S+)/)[1]\n end\n end\n ui.info(\"Rebuilding #{@name_args[0]} on top of #{base_image}\")\n base_image\n end", "def create(template_dir)\n tmp_dir = Dir.mktmpdir(\"sle2docker\")\n tmp_template_dir = File.join(tmp_dir, \"template\")\n result_dir = File.join(tmp_dir, \"result\")\n\n FileUtils.cp_r(File.join(template_dir, \".\"), tmp_template_dir)\n FileUtils.mkdir_p(result_dir)\n\n template_file = find_template_file(tmp_template_dir)\n if template_file.end_with?('.erb')\n template = render_template(template_file)\n File.open(File.join(tmp_template_dir, \"config.xml\"), \"w\") do |file|\n file.write(template)\n end\n end\n\n docker_cmd = \"docker run --rm \"\n # dns entries - otherwise docker uses Google's DNS\n dns_entries.each do |entry|\n docker_cmd += \"--dns=#{entry} \"\n end\n # the HTTP proxy specified by the user\n if @options[:http_proxy]\n docker_cmd += \"-e http_proxy=#{@options[:http_proxy]} \"\n end\n # ensure kiwi cache is persistent\n docker_cmd += \"-v /var/cache/kiwi:/var/cache/kiwi \"\n # share build dir\n docker_cmd += \"-v #{tmp_dir}:/#{tmp_dir} \"\n # required because kiwi needs to bind mount /proc while creating the image\n docker_cmd += \"--privileged \"\n # the image to use\n docker_cmd += \"opensuse/kiwi \"\n # kiwi directives\n docker_cmd += \"--build #{tmp_template_dir} --type docker -d #{result_dir}\"\n begin\n puts \"Starting build process inside of Docker container\"\n if !system(docker_cmd)\n $stderr.printf(\"Something wrong happened during the build process\\n\")\n exit(1)\n end\n end\n Dir[File.join(result_dir, \"*.tbz\")].first\n end", "def build\n cd_and_sh( pkg_dir, build_commands )\n end", "def build_image\n\n build_image = self.clone\n\n build_image.listeners = [$ll = LogfileListener.new(\"build_#{@name}\"), BuildProfilerListener.new]\n build_image.filters = [IgnoreOutputFilter.new, OutputTimestamperFilter.new] if not Rake::application.options.trace\n\n exit_code = build_image.run \"build_#{@name}\"\n\n fail \"build failed: runalias.exe returned #{exit_code}\" if exit_code != 0\n end", "def docker_build_in_path\n build_path = ::Dir.mktmpdir\n write_dockerfile(build_path)\n\n yield build_path\n\n begin\n image = DockerWrapper::Image.build(\"#{new_resource.name}:#{new_resource.tag}\", new_resource.dockerbuild_options.join(' '), build_path)\n ensure\n cleanup_dangling_images\n end\n\n return image\n\n ensure\n r = Chef::Resource::Directory.new(build_path, run_context)\n r.recursive(true)\n r.run_action(:delete)\n end", "def exec\n @build_error = false\n path = File.expand_path('../../../builds', __FILE__)\n image = create_image path\n\n if @build_error\n build.failed('')\n return nil\n end\n image\n end", "def build(name)\n if !File.exists?(File.join(config_dir, \"Dockerfile.#{name}\"))\n raise ArgumentError, \"there is no Dockerfile.#{name} in #{config_dir}\"\n end\n builds[name] = Build.load(name, username, config_dir)\n if block_given?\n builds[name].instance_eval(&proc)\n end\n builds[name]\n end", "def setup_database_dockerfile\n return nil unless options[:database] == 'mysql'\n\n template 'mysql/Dockerfile.tt', 'docker/Dockerfile'\n end", "def build_and_run_container(code,test_code,user_id)\n puts \"Building and running docker container\"\n formatted_code = format_code(code,test_code)\n p formatted_code\n command = [\"#{DOCKER_DIR}/build.sh\",%Q[\\\"#{formatted_code}\\\"],user_id].join(\" \").chomp\n %x[#{command}]\n 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 run_docker(os, architecture=nil)\n top_dir = File.expand_path('../.')\n id = os\n id = \"#{id}-#{architecture}\" if architecture\n docker_tag = \"#{@package}-#{id}\"\n build_command_line = [\n \"docker\",\n \"build\",\n \"--tag\", docker_tag,\n ]\n run_command_line = [\n \"docker\",\n \"run\",\n \"--rm\",\n \"--tty\",\n \"--volume\", \"#{top_dir}:c:/td-agent-builder:rw\",\n ]\n docker_context = \"msi\"\n build_command_line << docker_context\n run_command_line.concat([docker_tag, 'c:\\td-agent-builder\\td-agent\\msi\\build.bat'])\n\n write_env\n\n sh(*build_command_line)\n sh(*run_command_line)\n end", "def prepare_image\n has_image_or_build_arg = @attributes.key?(:image) || @attributes.key?(:build)\n\n raise ArgumentError.new('No Image or Build command provided') unless has_image_or_build_arg\n\n # Build or pull image\n if @attributes.key?(:image)\n if image_exists\n Docker::Image.get(@attributes[:image])\n else\n Docker::Image.create('fromImage' => @attributes[:image])\n end\n elsif @attributes.key?(:build)\n Docker::Image.build_from_dir(@attributes[:build])\n end\n end", "def ensure_image_exists(name, dockerfile)\n # force pull of latest release of the opensuse:13.2 image\n system(\"docker pull #{Settings::BASE_IMAGE}\")\n\n # Do not use cheetah, we want live streaming of what is happening\n puts \"Building #{name}\"\n cmd = \"docker build\" \\\n \" -f #{File.join(Pathname.new(__FILE__).parent.parent, \"docker/#{dockerfile}\")}\" \\\n \" -t #{name}\" \\\n \" #{Pathname.new(__FILE__).parent.parent}\"\n puts cmd\n system(cmd)\n exit(1) if $? != 0\n end", "def write_context\n create_context_dir\n write_dockerfile\n end", "def install\n system \"./build.sh\"\n bin.install \"./bin/pngwolf\"\n end", "def build(repo, **kwd)\n img = repo.to_s(**kwd)\n msg = Simple::Ansi.green(\"Building: #{img}\")\n $stderr.puts msg\n end", "def run\n docker_run(\"placeholder.language_name\", source_file)\n end", "def get_docker_image(directory, dockerfile = 'Dockerfile', debug = false, nocache = false)\n set :backend, :docker\n\n if(ENV['IMAGE_ID'] && Docker::Image.exist?(ENV['IMAGE_ID']))\n get_existing_docker_image()\n else\n build_new_docker_image(directory, dockerfile, debug, nocache)\n end\nend", "def docker_cmd(cmd, container)\n \"docker run -it --rm --name #{cmd} -v #{Dir.pwd}/src:/root -w /root #{container} #{cmd}\"\nend", "def run\n image = options[:image] || app\n config = api.get_config_vars(app).body\n\n Dir.mktmpdir do |dir|\n write_envfile dir, config\n docker_args = [ \"-P\", %{--env-file=\"#{dir}/.env\"}, \"-u daemon\" ]\n docker_args.push (options[:detach] ? \"-d\" : \"-it\")\n system %{ docker run #{docker_args.join(\" \")} #{image} #{args.join(\" \")} }\n end\n end", "def build_stage_only(build_number, container)\n docker_cmd = 'docker '\\\n 'build '\\\n \"--file #{container.dockerfile} \" \\\n '--target builder ' \\\n \"-t \\\"#{container.name}_builder:#{build_number}\\\" \"\\\n '.'\n execute_command docker_cmd\n end", "def docker_rebuild\n docker_composersh(true)\n docker_npmsh(true)\n docker_updb\n docker_compose_stop(false)\n docker_compose_up\n end", "def build\n sh './configure -u couchdb -c'\n make :release\n end", "def build(tag, build_id, registry = '')\n build_id = SecureRandom.hex(10) unless build_id\n\n test_env = env(:build, build_id, registry)\n test_env.clean!\n\n success = test_env.commands\n\n if success\n test_env.tag_image(tag)\n test_env.push(tag)\n end\n\n success\n ensure\n test_env.clean! if test_env\n end", "def build\n clean_build_directory\n copy_templates\n copy_functions\n copy_includes\n build_assets\n end", "def run\n running\n image = MarmotBuild::BuildImage.new(build: self).exec\n return nil if image.nil?\n container = MarmotBuild::CreateContainer.new(image: image).exec\n exec_build_and_tests container\n success if status != 'failed'\n image.id\n rescue StandardError => e\n failed(e.message)\n ensure\n MarmotBuild::KillContainer.new(container: container).exec unless container.nil?\n end", "def create\n\n # Let's get a few things straight\n @work_dir = \"#{@resource[:cache_dir]}/#{@resource[:extension]}\"\n @php_version_prefix = \"#{@resource[:phpenv_root]}/versions/#{@resource[:php_version]}\"\n @resource[:compiled_name] ||= \"#{@resource[:extension]}.so\"\n\n # Update the repository\n fetch @resource[:version], @resource[:extension]\n\n # Prepare for building\n prep_build @resource[:version]\n\n # PHPize, build & install\n phpize\n configure\n make\n install\n end", "def compile_bin(cpu = host_cpu)\n platform = target_platform(cpu)\n native_dir = File.expand_path('../aws-crt-ffi', File.dirname(__FILE__))\n tmp_dir = File.expand_path(\"../tmp/#{platform.cpu}\", File.dirname(__FILE__))\n tmp_build_dir = File.expand_path('build', tmp_dir)\n\n # We need cmake to \"install\" aws-crt-ffi so that the binaries end up in a\n # predictable location. But cmake still adds subdirectories we don't want,\n # so we'll \"install\" under tmp, and manually copy to bin/ after that.\n tmp_install_dir = File.expand_path('install', tmp_dir)\n\n build_type = 'RelWithDebInfo'\n\n config_cmd = [\n CMAKE,\n \"-H#{native_dir}\",\n \"-B#{tmp_build_dir}\",\n \"-DCMAKE_INSTALL_PREFIX=#{tmp_install_dir}\",\n \"-DCMAKE_BUILD_TYPE=#{build_type}\",\n '-DBUILD_TESTING=OFF',\n ]\n\n # macOS can cross-compile for arm64 or x86_64.\n # This lets us prepare both types of gems from either type of machine.\n if platform.os == 'darwin'\n config_cmd.append(\"-DCMAKE_OSX_ARCHITECTURES=#{platform.cpu}\")\n end\n\n build_cmd = [\n CMAKE,\n '--build', tmp_build_dir,\n '--target', 'install',\n '--config', build_type,\n ]\n\n # Build using all processors\n if cmake_has_parallel_flag?\n build_cmd.append('--parallel')\n build_cmd.append(Etc.nprocessors.to_s)\n end\n\n run_cmd(config_cmd)\n run_cmd(build_cmd)\n\n # Move file to bin/, instead of where cmake installed it under tmp/\n bin_dir = crt_bin_dir(platform)\n FileUtils.mkdir_p(bin_dir)\n bin_name = crt_bin_name(platform)\n search_dirs = [\n 'bin', # windows\n 'lib64', # some 64bit unix variants\n 'lib', # some unix variants\n ]\n tmp_path = find_file(bin_name, search_dirs, tmp_install_dir)\n FileUtils.cp(tmp_path, bin_dir, verbose: true)\nend", "def build\n @log.info \"Packaging files\"\n pkgdir = File.join(@path, \"pkg\")\n FileUtils.mkdir_p pkgdir\n\n FileUtils.chmod(0755, Dir[\"#{Ian.debpath(@dir)}/*\"])\n FileUtils.chmod(0755, Ian.debpath(@dir))\n\n pkg = File.join(pkgdir, \"#{pkgname}.deb\")\n output = %x[fakeroot dpkg-deb -b #{@dir} #{pkg}]\n\n return [$?.success?, pkg, output]\n end", "def apply(image_name)\n container_id = Docker.run('run', \"-d\", \"-v\", \"#{local_dir}:#{container_dir}\", image_name, \"true\").strip\n Docker.run('wait', container_id)\n Docker.run('commit', container_id).strip\n end", "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 pull_image image_name\n \[email protected] \"Pulling Image: #{image_name}\"\n ::Docker.options = {:chunk_size => 1, :read_timeout => 3600}\n ::Docker::Image.create('fromImage' => image_name)\n end", "def default_docker_image\n \"#{env}/#{appname}:#{image_tag}\"\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 vm_build_image (image_name, template)\n output_box = template[:box]\n unless File.directory?(Packer::OUTPUT_DIR)\n mkdir(Packer::OUTPUT_DIR)\n end\n if !$dry_run then\n build_image(template)\n else\n touch output_box\n end\n\n version_entry = {\n \"version\" => \"#{template[:vars]['image_version']}\",\n \"providers\" => [{\n \"name\" => \"virtualbox\",\n \"url\" => File.absolute_path(output_box),\n \"checksum_type\" => \"sha1\",\n \"checksum\" => Digest::SHA1.file(output_box).hexdigest\n }]\n }\n\n # Insert the new version entry into its correspondent vagrant JSON file\n vagrant_json_update(image_name, version_entry)\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 search_image(name)\n `docker search #{name}`\n end", "def install\n copy_envrc\n copy_database_yml\n copy_docker_db_setup_sh\n system(`direnv allow`)\n print(\"#{readme}\\n\")\n end", "def gen_blueprint_docker(blueprint_props = {}, cwd = File.expand_path('.'))\n if blueprint_props[:nodes].length > 0\n blueprint_props[:nodes].each do |node|\n blueprint_props[:node] = node\n folder = File.join(cwd, 'docker', blueprint_props[:name], node)\n unless File.exist?(File.join(folder, \"Dockerfile.#{node}.erb\"))\n FileUtils.mkdir_p folder unless File.directory?(folder)\n FileUtils.cp_r(\"#{File.join($RT_GEM_HOME,\n 'template', 'bp',\n 'docker', '.')}\",\n folder,\n :verbose => true)\n FileUtils.cp_r(File.join(folder, 'Dockerfile.node.erb'),\n File.join(folder, \"Dockerfile.#{node}.erb\"),\n :verbose => true)\n # cleanup the node.erb file\n FileUtils.rm(File.join(folder, 'Dockerfile.node.erb'),\n :force => true)\n end\n # convert the folder/Dockerfile.node.erb to folder/Dockerfile.node\n DockerTemplate.new.process_dockerfile(\n File.join(folder, \"Dockerfile.#{node}.erb\"),\n File.join(folder, \"Dockerfile.#{node}\"),\n blueprint_props.merge(:node => node)\n )\n end\n else\n PrcLib.warning('blueprint detected but no nodes found.')\n folder = File.join(cwd, 'docker', blueprint_props[:name])\n FileUtils.mkdir_p folder unless File.directory?(folder)\n FileUtils.cp_r(\"#{File.join($RT_GEM_HOME,\n 'template', 'bpnoop',\n 'docker', '.')}\",\n folder,\n :verbose => true)\n end\n end", "def docker_load(image_filename)\n return unless image_filename\n\n \"\\n# Load the uploaded Docker image to the local registry\\n\" \\\n \"#{IMAGE_ID_VAR}=`docker load < #{image_filename} | sed -n -e 's/^Loaded image: //p'`\\n\"\n end", "def apply(image_name)\n container_id = Docker.run('run', \"-d\", \"--volumes-from=#{name}\", image_name, \"true\").strip\n Docker.run('wait', container_id)\n Docker.run('commit', container_id).strip\n end", "def build(mode=:debug, verbose=false)\n \n verify_and_repair mode, verbose\n\n say \"Building static assets...\" if verbose\n\n report_package_locations if verbose\n \n # Seed the project with any required files to ensure they are built\n buildable_asset_filenames(mode).each do |filename|\n dst_path = assets_root filename\n next if File.exists? dst_path\n FileUtils.mkdir_p File.dirname(dst_path)\n FileUtils.touch dst_path\n end\n \n pipeline = BPM::Pipeline.new self, mode\n pipeline.buildable_assets.each do |asset|\n dst_path = assets_root asset.logical_path\n FileUtils.mkdir_p File.dirname(dst_path)\n\n if asset.kind_of? Sprockets::StaticAsset\n say \"~ Copying #{asset.logical_path}\" if verbose\n FileUtils.rm dst_path if File.exists? dst_path\n FileUtils.cp asset.pathname, dst_path\n else\n $stdout << \"~ Building #{asset.logical_path}...\" if verbose\n File.open(dst_path, 'w+') { |fd| fd << asset.to_s }\n if verbose\n gzip_size = `gzip -c #{dst_path}`.bytesize\n gzip_size = gzip_size < 1024 ? \"#{gzip_size} bytes\" : \"#{gzip_size / 1024} Kb\"\n $stdout << \" (gzipped size: #{gzip_size})\\n\"\n end\n end\n end\n\n say \"\\n\" if verbose\n end", "def build_package\n # Force timestamp to be initialized before anything else. This gives us a\n # stable timestamp for the process.\n timestamp\n # Prepare the work area: copy files from root_path to work_path based on\n # the resolved Manifest.txt.\n prepare_work_area\n # Anything that has been modified locally needs to be reset.\n restore_modified_files\n # Save both the final release metadata and the in-package release metadata.\n save_release_metadata\n # Vendor the dependencies for the package.\n vendor_dependencies\n # Request that supporting plug-ins build the package.\n request_build_package\n end", "def docker_exec (name, script)\n @logger.info(\"Executing docker-exec at #{name}: #{script}\")\n system \"docker exec -it #{name} #{script}\"\nend", "def docker_exec (name, script)\n @logger.info(\"Executing docker-exec at #{name}: #{script}\")\n system \"docker exec -it #{name} #{script}\"\nend", "def create_build_directories\n root_dir = generate_build_location(\"\")\n Dir.mkdir root_dir unless Dir.exists?(root_dir)\n img_dir = generate_image_location(\"\",\"\").split(\"/\")[0...-1].join(\"/\")\n Dir.mkdir img_dir unless Dir.exists?(img_dir)\n end", "def install\n bin.install \"appsody\"\n bin.install \"appsody-controller\" \n ohai \"Checking prerequisites...\"\n #system \"docker\"\n retval=check_prereqs\n\n if retval\n ohai \"Done.\"\n else\n opoo \"Docker not detected. Please ensure docker is installed and running before using appsody.\"\n end\n end", "def build_vm_image\n options.verbose? ? @@log.level = Logger::DEBUG : @@log.level = Logger::ERROR\n def_constants(guess_os(\"fedora\"))\n\n # Override the machine type to launch if necessary\n $amz_options[:instance_type] = options[:instance_type] if options[:instance_type]\n $amz_options[:block_device_mappings] = {\"/dev/sdb\" => \"ephemeral0\"}\n \n # Establish a new connection\n conn = connect(options.region)\n \n image = nil\n # Create a new builder instance\n if (options.region?nil)\n image = conn.images[AMI[\"us-east-1\"]]\n elsif AMI[options.region].nil?\n puts \"No AMI specified for region:\" + options.region\n exit 1\n else\n image = conn.images[AMI[options.region]]\n end\n\n puts \"Launching AMI: #{image.id} - #{image.name}\"\n instance = launch_instance(image, \"oso-image-builder\", 1, SSH_USER)\n hostname = instance.dns_name\n puts \"Done\"\n puts \"Hostname: #{hostname}\"\n ssh(hostname, 'su - -c \"setenforce 0\"' , 60, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"yum update -y\"' , 300, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"yum install -y appliance-tools qemu-img\"' , 60, false, 1, SSH_USER)\n scp_to(hostname, File.expand_path(\"#{__FILE__ }/../templates/openshift-origin.ks\"), '/home/ec2-user/openshift-origin.ks', 60, 5,SSH_USER)\n scp_to(hostname, File.expand_path(\"#{__FILE__ }/../templates/openshift-origin.vmx\"), '/home/ec2-user/openshift-origin.vmx', 60, 5,SSH_USER)\n scp_to(hostname, File.expand_path(\"#{__FILE__ }/../templates/openshift-origin.vbox\"), '/home/ec2-user/openshift-origin.vbox', 60, 5,SSH_USER) \n ssh(hostname, 'su - -c \"mv -f /home/ec2-user/openshift-origin.ks /mnt/\"' , 60, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"mkdir -p /mnt/tmp/build && mkdir -p /mnt/openshift-origin\"', 60, false, 1,SSH_USER)\n ssh(hostname, 'su - -c \"which VBoxManage 2>&1 > /dev/null || yum install -y http://download.virtualbox.org/virtualbox/4.2.8/VirtualBox-4.2-4.2.8_83876_fedora18-1.x86_64.rpm\"', 60, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"cd /mnt && appliance-creator -d -n openshift-origin -c openshift-origin.ks ' +\n '--format=vmdk --vmem=1024 --checksum --logfile=build.log --tmpdir=/mnt/tmp/build --cache /mnt/tmp/cache/\"', 2400, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"' + %{\n /bin/cp -f /mnt/openshift-origin.ks /mnt/openshift-origin/ &&\n /bin/mv -f /home/ec2-user/openshift-origin.v* /mnt/openshift-origin/ && \n mkdir -p /root/.VirtualBox/ &&\n /bin/cp -f /mnt/openshift-origin/openshift-origin.vbox /root/.VirtualBox/openshift-origin.vbox &&\n ln -sf /mnt/openshift-origin/openshift-origin-sda.vmdk /root/.VirtualBox/openshift-origin-sda.vmdk &&\n pushd /root/.VirtualBox/ &&\n VBoxManage registervm openshift-origin.vbox &&\n VBoxManage storageattach \\\\\\\"OpenShift Origin\\\\\\\" --storagectl SATA --type hdd --port 0 --medium openshift-origin-sda.vmdk &&\n /bin/cp -f /root/.VirtualBox/openshift-origin.vbox /mnt/openshift-origin/openshift-origin.vbox && \n popd && \n cd /mnt/openshift-origin && tar zcf openshift-origin.tgz * &&\n VBoxManage unregistervm \\\\\\\"OpenShift Origin\\\\\\\"\n } + '\"' , 2400, false, 1, SSH_USER)\n FileUtils.mkdir_p \"vm/\"\n scp_from(hostname, \"/mnt/openshift-origin/openshift-origin.tgz\", \"vm/\", 1200, SSH_USER)\n begin\n terminate_instance(hostname) if options.terminate?\n rescue\n # suppress termination errors - they have been logged already\n end\n end", "def compile\n puts BUILDPACK_MESSAGE % @buildpack_version\n\n container = component_detection('container', @containers, true).first\n no_container unless container\n\n component_detection('JRE', @jres, true).first.compile\n component_detection('framework', @frameworks, false).each(&:compile)\n\n container.compile\n\n log_cache_contents\n\n return if @deps_dir.nil? || @index.nil?\n\n FileUtils.mkdir_p File.join(@deps_dir, @index)\n File.write(\n File.join(@deps_dir, @index, 'config.yml'),\n { 'name' => 'java', 'config' => {}, 'version' => @buildpack_version.to_s(false) }.to_yaml\n )\n end", "def run\n call(\"/tmp/sonic/bash_scripts/docker-run.sh\")\n end", "def build_files_command\n \"middleman build\"\n end", "def tarball\n return @tarball if defined? @tarball\n\n require 'open3'\n Dir.mktmpdir do |tmpdir|\n definition.each do |options|\n glob = options.fetch(:glob)\n prefix = options[:prefix]\n ignore_hidden = options[:ignore_hidden]\n\n files = Dir[glob]\n files.reject! { |f| f.start_with?('.') } if ignore_hidden\n\n dest = prefix ? File.join(tmpdir, prefix) : tmpdir\n\n FileUtils.mkpath(dest)\n FileUtils.cp_r(files, dest)\n end\n\n excludes.each do |path|\n full_path = File.join(tmpdir, path)\n if File.file?(full_path)\n File.unlink(File.join(tmpdir, path))\n end\n end\n\n # Specify the correct ruby version in the Dockerfile.\n bundle_dockerfile = File.join(tmpdir, \"Dockerfile\")\n content = IO.read(bundle_dockerfile)\n content = content.gsub(\"{{ruby_version}}\", ruby_version)\n IO.write bundle_dockerfile, content\n\n if dockerfile\n File.unlink bundle_dockerfile\n FileUtils.cp dockerfile, bundle_dockerfile\n end\n\n # Find hash of all files we're sending over.\n digest = Digest::SHA1.new\n Dir[File.join(tmpdir, '**/*')].each do |path|\n if File.file? path\n open path, 'r' do |file|\n digest.update file.read\n end\n end\n end\n @image_name = \"hoosegow:#{digest.hexdigest}\"\n\n # Create tarball of the tmpdir.\n stdout, stderr, status = Open3.capture3 'tar', '-c', '-C', tmpdir, '.'\n\n raise Hoosegow::ImageBuildError, stderr unless stderr.empty?\n\n @tarball = stdout\n end\n end", "def initialize(cmd, version = nil)\n\t\t@@containers ||= {}\n\t\tunless ENV['debug'] then\n\t\t\tstderr_fd = $stderr.fcntl(Fcntl::F_DUPFD)\n\t\t\tFile.open('/dev/null','w') {|fh| $stderr.reopen(fh)}\n\t\tend\n\n\t\t@data = {}\n\n\t\t@container = $docker.containers.create(\n\t\t\t'Image' => SDockerImage.id,\n\t\t\t'Hostname' => hostname,\n\t\t\t'Cmd' => ['sh','-c','exec `which sshd` -D']\n\t\t)\n\t\tputs \"Building container #{@container.id}\"\n\t\[email protected]\n\t\tTimeout.timeout(15) do\n\t\t\tsystem(*(sshcmd('true')))\n\t\t\tbreak if $?.exitstatus == 0\n\t\t\tsleep 1\n\t\tend\n\n\t\t@@containers[@container.id] = self\n\t\tself.class.sync\n\n\t\tputs \"Building package version=#{version}\"\n\t\tpackage_io = IO.popen(['rake','package',\"source=#{version}\",\"out=/dev/stdout\"],'r')\n\t\tsystem(*(sshcmd(\"mkdir /#{SDockerImage::PROJECT_NAME}; tar -xzC /#{SDockerImage::PROJECT_NAME} --strip-components=1\")), 0 => package_io)\n\t\tpackage_io.close\n\n\t\tputs \"Installing package\"\n\t\tcmd(\"bundle install --local\")\n\n\t\tputs \"Build complete\"\n\t\tif stderr_fd then\n\t\t\t$stderr.reopen(IO.new(stderr_fd))\n\t\tend\n\tend", "def create(destination_path, mode = 640, &block)\n basename = Pathname.new(destination_path).basename.to_s\n random = random_dir\n\n # Add Dockerfile instruction\n virtual = \"#{random}/#{basename}\"\n self << 'ADD ' + virtual + ' ' + destination_path\n\n # Create directory for this instruction\n tar.mkdir(random, 750)\n\n # Add file with yielded block\n @tar.add_file(virtual, mode, &block)\n end", "def push_image_to_docker_hub(image_version)\n @process_runner.execute!(\"docker push #{@repository_name}:latest\")\n @process_runner.execute!(\"docker push #{@repository_name}:#{image_version}\")\n end", "def evaluate_in_container\n container = create_container(@language.class.docker_image)\n container.copy_package(@package)\n container.execute_package\n container.evaluation_result\n ensure\n container&.delete\n end", "def build\n safesystem \"autoreconf -vfi\"\n configure :prefix => prefix\n make\n end", "def bake\n opts = options.symbolize_keys\n image = Linecook::Image.new(opts[:name], opts[:group], opts[:tag])\n baker = Linecook::Baker::Baker.new(image, directory: opts[:directory])\n baker.bake(snapshot: opts[:snapshot], upload: opts[:upload], keep: opts[:keep])\n end", "def jenkins_download(opts)\n\tputs \"### Downloading jenkins image ###\"\n\trun_in_shell \"docker pull #{opts[:source]}\"\n\tputs \"#################################\"\nend", "def process_dockerfile(fdocker_erb, fdocker_dest, vals = {})\n vals = @properties.merge(vals)\n erb = ERB.new(File.read(fdocker_erb))\n erb.def_method(ErbData, 'render', fdocker_erb)\n begin\n File.open(fdocker_dest, 'w') do |fw|\n fw.write ErbData.new(vals).render\n fw.close\n end\n rescue StandardError => e\n PrcLib.error('failed to process dockerfile for %s : %s',\n vals[:node], e.message)\n end\n end", "def build_assets\n end", "def install_mono(source, file, build_dir, prefix)\n remote_file \"#{Chef::Config[:file_cache_path]}/#{file}\" do\n source source + file\n mode '0644'\n action :create_if_missing\n not_if \"test -e #{prefix}/bin/mono\"\n end\n\n bash \"install-#{build_dir}\" do\n user 'root'\n cwd Chef::Config[:file_cache_path]\n\n code <<-EOH\n set -e\n tar -xf #{file}\n cd #{build_dir}\n ./configure --prefix=#{prefix} --disable-nls\n make\n make install\n EOH\n not_if \"test -e #{prefix}/bin/mono\"\n end\nend", "def docker_preinstall_sf2(dbname)\n Dir.chdir('app/config')\n system 'cp parameters.yml.dist parameters.yml'\n\n @technos.each do |techno|\n technoname = techno[:name].sub(/-.*$/,'').downcase\n containername = \"#{technoname}_#{@projectname}\"\n\n if /mysql/.match(containername)\n system \"perl -pi -e 's/database_host:.*$/database_host: #{containername}/' parameters.yml\"\n system \"perl -pi -e 's/database_name:.*$/database_name: #{dbname}/' parameters.yml\"\n system 'perl -pi -e \"s/database_user:.*$/database_user: root/\" parameters.yml'\n system 'perl -pi -e \"s/database_password:.*$/database_password: 8to9or1/\" parameters.yml'\n end\n\n if /mongo/.match(containername)\n system \"perl -pi -e 's;mongodb_server:.*$;mongodb_server: mongodb://localhost:27017;' parameters.yml\"\n system \"perl -pi -e 's/mongodb_default_name:.*$/mongodb_default_name: #{dbname}/' parameters.yml\"\n system \"perl -pi -e 's/mongodb_database:.*$/mongodb_database: #{dbname}/' parameters.yml\"\n end\n\n system \"perl -pi -e 's/es_host:.*$/es_host: #{containername}/' parameters.yml\" if /elasticsearch/.match(containername)\n system \"perl -pi -e 's/amqp_host:.*$/amqp_host: #{containername}/' parameters.yml\" if /rabbitmq/.match(containername)\n system \"perl -pi -e 's;kibana_url:.*$;kibana_url: \\'http://#{containername}/app/kibana\\';' parameters.yml\" if /kibana/.match(containername)\n end\n\n @endpoints.each do |ep|\n containername = \"ep_#{ep[:path]}_#{@projectname}\"\n containerpath = containername.sub(/^ep_/, '').sub(/_.*$/, '')\n system \"perl -pi -e 's/#{containerpath}_host:.*$/#{containerpath}_host: #{containername}/' parameters.yml\"\n end\n\n Dir.chdir('../..')\n end", "def run_blc_in_docker(test_configuration)\n build_blc_base_docker_image(@test_dir)\n compose_project_name = docker_compose_project_name\n compose_environment_directory = \"#{@test_dir}/#{ENV['rhd_test']}/environments\"\n @log.info(\"Launching #{ENV['rhd_test']} broken-link-checking environment...\")\n @process_runner.execute!(\"cd #{compose_environment_directory} && docker-compose -p #{compose_project_name} build\")\n @process_runner.execute!(\"cd #{compose_environment_directory} && docker-compose -p #{compose_project_name} up -d blinkr_chrome\") if test_configuration[:blinkr]\n @log.info(\"Broken-link-checking environment up and running. Running #{ENV['rhd_test']} tests...\")\n @process_runner.execute!(\"cd #{compose_environment_directory} && docker-compose -p #{compose_project_name} run --rm --no-deps rhd_#{ENV['rhd_test']}_testing #{test_configuration[:run_tests_command]}\")\n @log.info(\"Completed run of #{ENV['rhd_test']} checks.\")\n end", "def docker_image(arg = nil)\n set_or_return(\n :docker_image,\n arg,\n kind_of: [String, NilClass],\n default: install_type == :container ? default_docker_image : nil,\n callbacks: { 'A `docker_image` requires a container install' =>\n ->(a) { a.nil? ? true : install_type == :container },\n 'A `docker_image` cannot be used with a `source`' =>\n ->(a) { a.nil? ? true : source.nil? } }\n )\n end", "def install_dmd(source, file, build_dir, prefix)\n remote_file \"#{Chef::Config[:file_cache_path]}/#{file}\" do\n source source + file\n mode '0644'\n action :create_if_missing\n not_if \"test -e #{prefix}/linux/bin64/dmd\"\n end\n\n bash \"install-#{build_dir}\" do\n user 'root'\n cwd Chef::Config[:file_cache_path]\n\n code <<-EOH\n set -e\n\n rm -r #{build_dir} || true\n tar xf #{file}\n\n rm -r #{prefix} || true\n cp -r #{build_dir} #{prefix}\n rm -r #{build_dir}\n EOH\n\n not_if \"test -e #{prefix}/linux/bin64/dmd\"\n end\nend", "def docker_sql\n containername = \"mysql_#{@projectname}\"\n exec \"docker exec -t -i #{containername} /usr/bin/mysql -u root -p8to9or1\"\n end", "def start\n # Start dependencies\n @dependencies.each do |dependency|\n dependency.start unless dependency.running?\n end\n\n # Create a container object\n if @container.nil?\n prepare_image\n prepare_container\n end\n\n @container.start unless @container.nil?\n end", "def full_image_name\n return generate_name if @options[:generate]\n return \"tongueroo/hi:ufo-12345678\" if ENV['TEST']\n\n unless File.exist?(docker_name_path)\n puts \"Unable to find #{docker_name_path} which contains the last docker image name that was used as a part of `ufo docker build`. Please run `ufo docker build` first.\"\n exit 1\n end\n IO.read(docker_name_path).strip\n end", "def up\n begin\n image_id = build\n container_id = run image_id\n confirm_running container_id\n rescue => ex\n @logger.error ex\n raise\n ensure\n @logger.close\n end\n end", "def docker_context\n File.join(config[:dockerfiles_path], dockerfile_name)\n end", "def docker_updb\n rootFolder = Dir.pwd\n\n # execute updb cmds for each endpoints\n @endpoints.each do |ep|\n framework = ep[:frameworkname]\n Dir.chdir(\"#{rootFolder}/#{ep[:path]}\")\n\n # execute framework specific updb\n case framework\n when /Symfony/\n system \"docker pull nextdeploy/#{framework.downcase}console\"\n system \"docker run --net=#{@projectname}_default -v=#{Dir.pwd}:/var/www/html nextdeploy/#{framework.downcase}console doctrine:schema:update --force\"\n when /Drupal/\n system \"docker pull nextdeploy/drush\"\n system \"docker run --net=#{@projectname}_default -v=#{Dir.pwd}:/app nextdeploy/drush -y updb\"\n end\n end\n Dir.chdir(rootFolder)\n\n docker_cc\n end", "def tempdir\n @tmpdir ||= Dir.mktmpdir(\"dockerfile\")\n File.realpath(@tmpdir)\nend", "def build_site\n sh \"bundle exec jekyll build\"\nend", "def run\n\t\t\tif self.buildpack == 'dockerfile'\n\t\t\t\tBuildPacks::docker_run(self)\n\t\t\telsif self.buildpack == 'docker-compose'\n\t\t\t\tBuildPacks::docker_compose_run(self)\n\t\t\tend\n\t\tend", "def build(name)\n output_path = File.join(__dir__, \"#{name}.yml\")\n File.write(output_path, GENERATED_BANNER + template(name, params: { header: false }))\n end", "def build_gem; end" ]
[ "0.76331735", "0.7375778", "0.72752917", "0.71773374", "0.714699", "0.702284", "0.6941528", "0.69206464", "0.68949676", "0.687601", "0.6792107", "0.6784374", "0.671487", "0.6593091", "0.6569525", "0.65620726", "0.6549633", "0.650985", "0.64788747", "0.64742786", "0.64659786", "0.6385831", "0.6377065", "0.6372877", "0.63510823", "0.6323135", "0.6271682", "0.6206961", "0.620452", "0.61321616", "0.6086892", "0.6071838", "0.5936942", "0.5919149", "0.58908784", "0.5851242", "0.5848714", "0.580368", "0.57793844", "0.5760758", "0.5754345", "0.5711329", "0.5629853", "0.56096655", "0.5583759", "0.5557935", "0.5475231", "0.5446595", "0.5378747", "0.53651047", "0.5355017", "0.531751", "0.53064895", "0.5296761", "0.5284167", "0.52817464", "0.52748126", "0.52463436", "0.5242675", "0.52276427", "0.5208944", "0.5188809", "0.5182705", "0.5181271", "0.5160409", "0.5136967", "0.51342696", "0.51342696", "0.51297027", "0.51278114", "0.5127528", "0.5124151", "0.510623", "0.509638", "0.5089046", "0.5086245", "0.50833106", "0.5079143", "0.50725687", "0.50559264", "0.5050249", "0.50479853", "0.502461", "0.5014475", "0.5009842", "0.5008658", "0.49980998", "0.4984524", "0.4979633", "0.49718487", "0.49660888", "0.49457875", "0.49388227", "0.4933912", "0.49298364", "0.49257055", "0.49212655", "0.4913157", "0.491258", "0.49105036" ]
0.6021984
32
specfile for k8s resources spec manifest
def write_specfile(str) set_file_for(:specfile, str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec\n YAML.load_file(\"#{tmp_folder}/#{repository_name}/#{spec_name}\")\n end", "def load_manifests(path)\n path = Pathname.new(path).freeze\n files = if File.file?(path)\n [path]\n else\n Pathname.glob(path.join('*.{yml,yaml,yml.erb,yaml.erb}')).sort_by(&:to_s)\n end\n resources = files.flat_map do |file|\n Pharos::YamlFile.new(file).load_stream do |doc|\n K8s::Resource.new(doc)\n end\n end.select do |r|\n # Take in only resources that are valid kube resources\n r.kind && r.apiVersion\n end\n\n resources\n end", "def spec_file params\n file = \"\"\n params.each do |k,v|\n file << \"%s: %s\\n\" % [k, v]\n end\n file << \"\\n\"\n @components.each do |name, component|\n next unless component.includes_manifest?\n file << component.manifest_meta \n file << \"\\n\"\n end\n file\n end", "def specfile\n Dir[\"#{@path}/[Ss]pecfile\"].first\n end", "def manifest\n root + '.node.yml'\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 spec_dirs; end", "def build_resource(dir, specs)\n resources = Dir.new(dir)\n to_skip = [ '.', '..', 'resource.def' ]\n record = specs['config']\n resources.entries.each do |entry|\n next if to_skip.include?(entry)\n content = IO.read File.join(resources.path, entry)\n method = File.basename(entry, File.extname(entry)).upcase\n doc = Maruku.new(content)\n record[method.downcase]['content'] = doc.to_html\n end\n record\n end", "def spec_file\n @spec_file ||= File.join spec_dir, \"#{full_name}.gemspec\"\n end", "def spec_for(match, kind)\n File.join(\"spec\", kind + 's', \"#{match}_spec.rb\")\n end", "def manifest\n template \"#{favorite_cleaned}.txt\", 'Song.txt'\n end", "def spec\n File.join root, 'spec'\n end", "def spec\n File.join root, 'spec'\n end", "def spec\n File.join root, 'spec'\n end", "def new_spec_content\n content = JSON.parse(File.read(path = Utils.base + '.shoperb'))\n spec_content = {\n handle: content['handle'],\n compile: {\n stylesheets: ['application.css'],\n javascripts: ['application.js']\n }\n }.to_json\n Dir.mkdir 'config' unless File.exist?('config')\n File.open('config/spec.json', 'w') {|f| f.write(spec_content) }\n spec_content\n end", "def read_resource(name)\n res = YAML.load_file(\n \"#{App.config.resource_directory}/#{name}.yaml\"\n )\n raise 'No name specified...' if res['name'].nil?\n\n res['name'] = \"res-#{res['name']}\"\n res['capabilities'] ||= []\n res['tags'] = stack_meta(res['tags'] || {})\n res['parameters'] = stack_params(res['parameters'] || {})\n res\n end", "def manifest_file_name\n basename = \"#{name}.yml\"\n end", "def specification_path(name, version)\n path = specs_dir + name + version.to_s\n specification_path = path + \"#{name}.podspec.json\"\n unless specification_path.exist?\n specification_path = path + \"#{name}.podspec\"\n end\n unless specification_path.exist?\n raise StandardError, \"Unable to find the specification #{name} \" \\\n \"(#{version}) in the #{name} source.\"\n end\n spec\n end", "def manifest\n case manifest_path.extname.downcase.delete \".\"\n when \"json\"\n JSON.parse(File.read(manifest_path))\n when \"yml\", \"yaml\"\n YAML.load_file(manifest_path)\n end\n end", "def generate_manifests_file\n generate_file_from_template(\"#{templates_path}/puppet/roles/manifests/init.pp.erb\", \"#{self.path}/manifests/init.pp\", {role: self})\n end", "def add_spec_folder\n directory 'templates/dry/spec', \"#{name}/spec\", recursive: true\n end", "def spec_name\n \"#{full_name}.gemspec\"\n end", "def installed_spec_directories; end", "def load_asset_file(spec_filename)\n\n #If we weren't provided with a filename, automatically produce one from the currently\n #running spec's name\n filename = spec_filename.gsub(/spec.rb$/, \"assets.yaml\")\n \n #And parse the YAML file.\n let(:assets) { YAML.load(File.open(filename)) }\n\nend", "def create_node_manifest(manifest_path, master_certname, node_def_name='default')\n manifest = File.read(manifest_path)\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\nnode default {\n\n#{manifest}\n}\nMANIFEST\n\n return site_pp\nend", "def spec_file(filename)\n File.open('spec/files/'+filename) { |f| f.read }\n end", "def manifest_task\n # Load all the gem's files using \"git ls-files\"\n repository_files = `#{git} ls-files`.split(\"\\n\")\n test_files = Dir[test_pattern] + Dir[spec_pattern]\n\n update_gemspec(:files, repository_files)\n update_gemspec(:test_files, repository_files & test_files)\n end", "def spec_for(file)\n base = File.basename(file)\n extension = File.extname(base)\n dir = File.dirname(file)\n dir_array = dir.split('/')\n if extension == '.rb' and dir_array.first=='spec'\n return file\n end\n if extension == '.rb'\n base_without_extension = base[0, base.size - extension.size]\n spec_file = base_without_extension + '_spec' + extension\n else\n spec_file = base + '_spec.rb'\n end\n dir_array[0]='spec'\n spec_dir = dir_array.join('/')\n return File.join(spec_dir, spec_file)\n end", "def initialize_specfile\n @spec = Prigner::Spec.load(specfile)\n end", "def setup_rspec\n template('.rspec.tt', '.rspec')\n template('Rakefile.tt', 'Rakefile')\n template('spec/lib/versioned/version_spec.rb.tt', \"spec/#{version_path.sub(/\\.rb$/, '_spec.rb')}\")\n template('spec/lib/versioned_spec.rb.tt', \"spec/lib/#{namespaced_path}_spec.rb\")\n template('spec/spec_helper.rb.tt', 'spec/spec_helper.rb')\n end", "def puppet_resource_cmd\n UtilityLib::PUPPET_BINPATH + 'resource cisco_X__RESOURCE_NAME__X'\nend", "def arch_spec_path\n File.join(RAILS_ROOT, 'vendor/gems', canonical_arch, 'specifications')\n end", "def manifest_name\n \"MANIFEST.#{name}\"\n end", "def generate_manifest_files iss_file, update_url\n iss = InnoSetup::SourceFile.new(iss_file, Dir.getwd, 'CD_INSTALLER' => 1)\n iss.components.each do |name, component|\n next unless component.includes_manifest?\n manifest = component.manifest\n # TODO - We need to include *.iss file's directory when creating this file.\n File.open(component.manifest_name, 'w') {|f| f.write(manifest) }\n end\n File.open(\"release.spec\", 'w') do |f| \n f.write(iss.spec_file(\"Build\" => release_id || \"DIRTY\", \n \"Update-URL\" => update_url))\n end\n sign_file_with_gpg 'release.spec'\nend", "def create_pod_spec_from_original(pod_spec, app_name)\n {\n \"apiVersion\" => pod_spec[\"apiVersion\"],\n \"kind\" => pod_spec[\"kind\"],\n \"metadata\" => {\n \"generateName\" => pod_spec[\"metadata\"][\"generateName\"] + \"kex-\",\n \"labels\" =>\n pod_spec[\"metadata\"][\"labels\"]\n .merge(\"app\" => pod_spec[\"metadata\"][\"labels\"][\"app\"] + \"-kex\"),\n \"namespace\" => pod_spec[\"metadata\"][\"namespace\"]\n },\n \"spec\" => {\n \"containers\" => patch_containers_for_run(pod_spec[\"spec\"][\"containers\"], app_name),\n \"volumes\" => pod_spec[\"spec\"][\"volumes\"]\n }\n }\nend", "def generate_request_spec\n template 'request_spec.rb', File.join('spec/requests', \"#{name.underscore.pluralize}_spec.rb\")\n end", "def compile_json_specs_with(dir, specs)\n specs['resources'].each_pair { |resource, options|\n resource_spec = JSON.parse(IO.read(File.join(File.join(dir, options['dir']),\"resource.def\")))\n options['config'] = build_resource File.join(dir, options['dir']), resource_spec\n } if (@mode == \"file\")\n flush_specs specs\n specs\n end", "def rsync_resources\n ::ObjectSpace.each_object(::Chef::Resource).select do |resource|\n resource.resource_name == :rsync_serve\n end\nend", "def manifest_path\n build_output_dir.join('manifest.json')\n end", "def specfile\n rendered_file_for(:specfile)\n end", "def manifests\n # TODO: handle s3 case, and use URI for source_location (need to change across batch ingest gem as well)\n Dir[File.join(base_directory, \"**/*.{#{MANIFEST_EXTENSIONS.join(',')}}\")]\n end", "def file_patterns_errors_for_spec(spec, file, platform_name)\n Dir.chdir(config.project_pods_root + spec.name ) do\n messages = []\n messages += check_spec_files_exists(spec, :source_files, platform_name, '*.{h,m,mm,c,cpp}')\n messages += check_spec_files_exists(spec, :resources, platform_name)\n messages << \"license[:file] = '#{spec.license[:file]}' -> did not match any file\" if spec.license[:file] && Pathname.pwd.glob(spec.license[:file]).empty?\n messages.compact\n end\n end", "def find_images_in_k8s_complete_demo\n images = []\n yaml_parts = File.read(REPO_ROOT.join(\"deploy\").join(\"kubernetes\").join(\"complete-demo.yaml\"))\\\n .split(\"---\\n\")\\\n .map { |part| YAML.load(part) }\n\n yaml_parts \\\n .select { |part| part[\"kind\"] == \"Deployment\" }\\\n .map { |part| part[\"spec\"][\"template\"][\"spec\"][\"containers\"].map { |c| c[\"image\"] } }.flatten\\\n .map { |name| if name.include?(\":\") then name; else name + \":latest\"; end }.uniq\nend", "def pkg_path\n \"pkg/#{spec.full_name}\"\n end", "def kubernetes_compressed_file\n \"#{file_cache_path}/kubernetes-#{version}.tar.gz\"\n end", "def load_gemspec\n\n text = File.read(gemspec_file)\n if text =~ /\\A---/ \n require 'yaml'\n spec = YAML.load(text)\n else\n #spec = eval(text) #, gemspec_file)\n spec = ::Gem::Specification.load(gemspec_file)\n end\n\n data = {}\n data[:name] = spec.name\n data[:version] = spec.version.to_s\n data[:date] = spec.date\n\n data[:paths] = {\n 'load' => spec.require_paths \n }\n\n data[:requirements] = []\n\n spec.runtime_dependencies.each do |dep|\n req = { \n 'name' => dep.name,\n 'version' => dep.requirement.to_s\n }\n data[:requirements] << req\n end\n\n spec.development_dependencies.each do |dep|\n req = { \n 'name' => dep.name,\n 'version' => dep.requirement.to_s,\n 'development' => true\n }\n data[:requirements] << req\n end\n\n update(data)\n end", "def all_spec_files\n 'spec/**/*_spec.rb'\nend", "def specification(file:, name: nil, version: nil)\n if name\n desc 'Update Resource Specification' unless ::Rake.application.last_description\n task name, [:cfn_spec_version] => file\n end\n\n @spec_task = file(file, :cfn_spec_version) do |t, args|\n update_specification(t.name, args.with_defaults(cfn_spec_version: version)[:cfn_spec_version])\n end\n @spec_task.define_singleton_method(:needed?) { true } # We always need to check\n self\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def manifest_file_name\n basename = name.gsub(/\\.yml/, '') + \".yml\"\n end", "def load_url_spec\n path = self.class.spec_path\n specs = []\n Dir.new(path).entries.sort.each do |dir_entry|\n specs.push *YAML.load_file(path+dir_entry) if load_spec?( dir_entry )\n end\n @spec = Testcase.expand_specs(specs, @configuration)\n end", "def bare_resource(resource)\n inner_name = \"bare_#{resource.name}\"\n inner_path = bare_d.join(\"#{resource.name}.conf\").to_s\n return inner_name, inner_path\n end", "def package_file\n super || spec_file\n end", "def manifests\n file_list '{manifests,puppet}/**/*.pp'\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 infer_manifest\n if file = root.glob('manifest{,.txt}', :casefold).first\n set :manifest, File.basename(file)\n end\n end", "def generate_specfile(builddir)\n paths = []\n logger.info(\"PWD: #{File.join(builddir, unpack_data_to)}\")\n fileroot = File.join(builddir, unpack_data_to)\n Dir.chdir(fileroot) do\n Find.find(\".\") do |p|\n next if p == \".\"\n paths << p\n end\n end\n logger.info(paths[-1])\n manifests = %w{package.pp package/remove.pp}\n\n ::Dir.mkdir(File.join(builddir, \"manifests\"))\n manifests.each do |manifest|\n dir = File.join(builddir, \"manifests\", File.dirname(manifest))\n logger.info(\"manifests targeting: #{dir}\")\n ::Dir.mkdir(dir) if !File.directory?(dir)\n\n File.open(File.join(builddir, \"manifests\", manifest), \"w\") do |f|\n logger.info(\"manifest: #{f.path}\")\n template = template(File.join(\"puppet\", \"#{manifest}.erb\"))\n ::Dir.chdir(fileroot) do\n f.puts template.result(binding)\n end\n end\n end\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 specific_manifest_file_path\n \"#{get_formatted_controller_name}-#{get_formatted_action_name}\"\n end", "def do_create_namespace(namespace, default_per_namespace_max_pods)\n name = namespace['name']\n annotations = namespace['annotations']\n labels = namespace['labels']\n max_pods = namespace['max_pods']\n filename=\"/var/vcap/data/action/ns_#{name}.yml\"\n filenameresourcequota=\"/var/vcap/data/action/ns_#{name}_quota.yml\"\n File.open(filename, 'w+') do |f|\n f.puts(\"apiVersion: v1\")\n f.puts(\"kind: Namespace\")\n f.puts(\"metadata:\")\n f.puts(\" name: #{name}\")\n f.puts(\" labels:\")\n f.puts(\" name: #{name}\")\n if labels != nil\n labels.each{ |label|\n f.puts(\" #{label['name']}: #{label['value']}\")\n }\n end\n\n if annotations != nil\n f.puts(\" anotations: \")\n annotations.each{ |annotation|\n f.puts(\" #{annotation['name']}: #{annotation['value']}\")\n }\n end\n end\n cmd = \"kubectl apply -f #{filename} \"\n\n if max_pods ==nil\n max_pods = default_per_namespace_max_pods\n end\n if max_pods != \"-1\"\n File.open(filenameresourcequota, 'w+') do |f|\n f.puts(\"apiVersion: v1\")\n f.puts(\"kind: ResourceQuota\")\n f.puts(\"metadata:\")\n f.puts(\" name: quota-#{name}\")\n f.puts(\" namespace: #{name}\")\n f.puts(\"spec:\")\n f.puts(\" hard:\")\n f.puts(\" pods: #{max_pods}\")\n cmd =\"kubectl apply -f #{filename}; kubectl apply -f #{filenameresourcequota}\"\n end\n end\n cmd\nend", "def write_manifest\n generator = ManifestGenerator.new(spec)\n\n File.open(@output_dir.join('manifest.json'), 'w') do |f|\n f.write JSON.pretty_generate(generator.spec_as_json)\n end\n end", "def manifest\n {}\n end", "def install_ark(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:ark, :install, resource_name)\nend", "def check_from_resource\n spec = {}\n spec['check_hooks'] = new_resource.check_hooks if new_resource.check_hooks\n spec['command'] = new_resource.command\n spec['cron'] = new_resource.cron\n spec['metadata'] = {}\n spec['metadata']['name'] = new_resource.name\n spec['metadata']['namespace'] = new_resource.namespace\n spec['metadata']['labels'] = new_resource.labels if new_resource.labels\n spec['metadata']['annotations'] = new_resource.annotations if new_resource.annotations\n spec['handlers'] = new_resource.handlers\n spec['high_flap_threshold'] = new_resource.high_flap_threshold if new_resource.high_flap_threshold\n spec['interval'] = new_resource.interval if new_resource.interval\n spec['low_flap_threshold'] = new_resource.low_flap_threshold if new_resource.low_flap_threshold\n spec['proxy_entity_name'] = new_resource.proxy_entity_name if new_resource.proxy_entity_name\n spec['proxy_requests'] = new_resource.proxy_requests if new_resource.proxy_requests\n spec['publish'] = new_resource.publish if new_resource.publish\n spec['round_robin'] = new_resource.round_robin if new_resource.round_robin\n spec['runtime_assets'] = new_resource.runtime_assets if new_resource.runtime_assets\n spec['stdin'] = new_resource.stdin\n spec['subdue'] = new_resource.subdue if new_resource.subdue\n spec['subscriptions'] = new_resource.subscriptions\n spec['timeout'] = new_resource.timeout if new_resource.timeout\n spec['ttl'] = new_resource.ttl if new_resource.ttl\n spec['output_metric_format'] = new_resource.output_metric_format if new_resource.output_metric_format\n spec['output_metric_handlers'] = new_resource.output_metric_handlers if new_resource.output_metric_handlers\n\n c = {}\n c['type'] = type_from_name\n c['spec'] = spec\n c\n end", "def load_manifest\n files = [config.manifest_path, config.assets_manifest_path].select(&:exist?)\n files.map { |path| JSON.parse(path.read) }.inject({}, &:merge).tap(&method(:resolve_references))\n end", "def show_resources_in_namespace(namespace, *resource_types)\n run \"kubectl get #{resource_types.join(',')} --namespace #{namespace} --output=wide\"\nend", "def generate_manifest(test_resources)\n manifest = ''\n test_resources = [test_resources].flatten # ensure it's an array so we enumerate properly\n test_resources.each do |resource|\n manifest << resource[:pre_code] + \"\\n\" if resource[:pre_code]\n namevar = (resource[:parameters][:namevar] if resource[:parameters]) || \"#{resource[:type]}_#{random_string}\"\n # ensure these are double quotes around the namevar incase users puppet-interpolate inside it\n # FIXME: add test ^^\n manifest << resource[:type] + '{\"' + namevar + '\":' if resource[:type]\n if resource[:parameters]\n resource[:parameters].each do |key,value|\n next if key == :namevar\n manifest << \"#{key} => #{value},\"\n end\n end\n manifest << \"}\\n\" if resource[:type]\n end\n return manifest\n end", "def yaml_path\n File.join(base_path, \"resource_map.yml\")\n end", "def manifest() @opts.manifest; end", "def manifest(type)\n type = type.downcase\n say \"Rendering #{type} manifest\", :green\n @values = parse_cloud_config\n @tf_output = parse_tf_state('terraform/terraform.tfstate') if options[:cloud] == 'aws'\n\n if options[:cloud] == 'aws'\n @private_subnet = IPAddr.new(@values['aws']['private_subnet']['network']).to_range.to_a\n @public_subnet = IPAddr.new(@values['aws']['public_subnet']['network']).to_range.to_a\n else\n @private_subnet = IPAddr.new(@values['gcp']['subnet_cidr']).to_range.to_a\n end\n\n @static_ip_vault = @private_subnet[11].to_s\n @static_ips_concourse = [@private_subnet[12]].map(&:to_s)\n @static_ip_prometheus_stack = @private_subnet[18].to_s\n\n case type\n when \"bosh\"\n directory(\"#{options[:cloud]}/deployments/bosh\", 'deployments/bosh')\n template(\"#{options[:cloud]}/bosh-vars.yml.erb\", 'config/bosh-vars.yml')\n copy_file(\"#{options[:cloud]}/docs/bosh.md\", \"docs/bosh.md\")\n template(\"#{options[:cloud]}/bin/bosh-install.sh.tt\", \"bin/bosh-install.sh\")\n chmod('bin/bosh-install.sh', 0755)\n\n when \"concourse\"\n directory(\"#{options[:cloud]}/deployments/concourse\", \"deployments/concourse\")\n copy_file(\"#{options[:cloud]}/docs/concourse.md\", \"docs/concourse.md\")\n template(\"#{options[:cloud]}/bin/concourse-deploy.sh.tt\", \"bin/concourse-deploy.sh\")\n chmod('bin/concourse-deploy.sh', 0755)\n ingress_add_entry(@values['concourse']['hostname'], @static_ips_concourse, port: 8080)\n\n when \"vault\"\n template(\"#{options[:cloud]}/deployments/vault/vault.yml.erb\", \"deployments/vault/vault.yml\")\n copy_file(\"#{options[:cloud]}/docs/vault.md\", \"docs/vault.md\")\n template(\"#{options[:cloud]}/bin/vault-deploy.sh.tt\", \"bin/vault-deploy.sh\")\n chmod('bin/vault-deploy.sh', 0755)\n ingress_add_entry(@values['vault']['hostname'], [@static_ip_vault], port: 8200)\n\n when \"ingress\"\n template(\"#{options[:cloud]}/deployments/ingress/ingress.yml.erb\", \"deployments/ingress/ingress.yml\")\n copy_file(\"#{options[:cloud]}/docs/ingress.md\", \"docs/ingress.md\")\n template(\"#{options[:cloud]}/bin/ingress-deploy.sh.tt\", \"bin/ingress-deploy.sh\")\n template(\"#{options[:cloud]}/bin/ingress-update.sh.tt\", \"bin/ingress-update.sh\")\n chmod('bin/ingress-deploy.sh', 0755)\n chmod('bin/ingress-update.sh', 0755)\n\n when \"prometheus\"\n directory(\"#{options[:cloud]}/deployments/prometheus\", \"deployments/prometheus\")\n copy_file(\"#{options[:cloud]}/docs/prometheus.md\", \"docs/prometheus.md\")\n template(\"#{options[:cloud]}/bin/prometheus-deploy.sh.tt\", \"bin/prometheus-deploy.sh\")\n chmod('bin/prometheus-deploy.sh', 0755)\n ingress_add_entry(@values['alertmanager']['hostname'], [@static_ip_prometheus_stack], port: 9093)\n ingress_add_entry(@values['grafana']['hostname'], [@static_ip_prometheus_stack], port: 3000)\n ingress_add_entry(@values['prometheus']['hostname'], [@static_ip_prometheus_stack], port: 9090)\n\n else\n say \"Manifest type not specified\"\n\n end\n end", "def read_versions\n spec_files.map do |spec_file|\n spec = File.read(spec_file)\n spec.match(/^\\s*Version:\\s*(\\S+)$/)[1]\n end\nend", "def apply_resource(kuberesource)\n resource = kuberesource.document\n name = resource[\"metadata\"][\"name\"]\n responses = []\n not_found = false\n begin\n response = get(resource)\n rescue RestClient::NotFound => e\n not_found = true\n end\n\n if not_found\n begin\n response = post(resource)\n puts \"Created resource #{response[:resource]}\"\n responses << response\n rescue RestClient::NotFound => e\n pp e\n pp JSON.parse(e.response.body)\n puts \"404 when applying resources might mean one of the following:\"\n puts \"\\t * You're trying to apply a non-namespaced manifest.\"\n puts \"\\t Confirm if your manifests metadata should contain a namespace field or not\"\n rescue RestClient::UnprocessableEntity => e\n pp e\n pp JSON.parse(e.response.body)\n end\n else\n puts \"Updating resource #{response[:resource]}\"\n\n # Get the current full resource from apiserver\n current_resource = response[:body]\n\n update_resource = kuberesource.merge_for_put(current_resource)\n\n begin\n responses << put(update_resource)\n rescue RestClient::BadRequest => e\n handle_bad_request(client, e, body, ns_prefix, resource_name)\n raise e\n rescue RestClient::Exception => e\n puts \"Error updating resource: #{e} #{e.class}\"\n pp JSON.parse(e.response)\n end\n \n return responses\n end\n end", "def manifest\n if File.exists?(manifest_file) && File.readable?(manifest_file) then\n MultiJson.load(File.read(manifest_file))\n else\n {}\n end\n end", "def gemspec_file\n project_path( \"#{ name }.gemspec\" )\n end", "def list\n Dir.glob(\"#{App.config.resource_directory}/*.yaml\").each do |res|\n puts File.basename(res, '.yaml')\n end\n end", "def assets_manifest; end", "def assets_manifest; end", "def pattern\n \"#{@gem}/spec{,/*/**}/*_spec.rb\"\n end", "def config_creates_file(_new_resource)\n return 'Makefile'\n end", "def config_creates_file(_new_resource)\n return 'Makefile'\n end", "def resource name, &block\n specs.each do |spec|\n spec.resource(name, &block) unless spec.resource?(name)\n end\n end", "def resource_template_dir\n \"#{App.config.resource_directory}/templates\"\n end", "def resource_path\n '.' + Dir[File.dirname(__FILE__)][/\\/resource\\/.*/]\n end", "def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end", "def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end", "def spec_files\n glob_files(@root_dir, 'spec', '**/*_spec.rb')\n end", "def read_template(name)\n File.open(\"#{resource_template_dir}/#{name}.yaml\").read\n end", "def gemspecs; end", "def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end", "def assets_manifest_path\n build_output_dir.join('manifest-assets.json')\n end", "def load_spec(name, version, platform, source) # :nodoc:\n @specs.fetch name\n end", "def init\n create_file options[:inventory_config] do\n<<-YML\n# sources:\n# - \"https://supermarket.getchef.com\"\n# cookbooks:\n# cookbook-name:\n# versions:\n# - \"~> 4.0.2\"\n# - \"> 5.0.0\"\n# git:\n# location: url | path\n# branches:\n# - a_branch_name\n# refs:\n# - SHA\n\nYML\n end\n end", "def getresources(resourcesspec)\n components = resourcesspec.split(Split_Regex)\n parent = components.shift()\n childspec = components.join(':')\n prefix = @mgr.stack_family\n if prefix\n parent = prefix + parent unless parent.start_with?(prefix)\n end\n if @resources[parent]\n resources = @resources[parent]\n else\n stack = @resource.stack(parent)\n resources = {}\n @resources[parent] = resources\n tries = 0\n while true\n begin\n if stack.exists?()\n stack.resource_summaries().each() do |r|\n resources[r.data.logical_resource_id] = \"#{r.data.physical_resource_id}=#{r.data.resource_type}\"\n end\n end\n break\n rescue => e\n if /rate exceed/i =~ e.message\n tries += 1\n if tries >= 4\n raise e\n end\n sleep 2 * tries\n else\n raise e\n end # if rate exceeded\n end # begin / rescue\n end # while true\n end\n if childspec == \"\"\n return resources\n end\n children = resources.keys()\n components = childspec.split(Split_Regex)\n parentspec = components.shift()\n childspec = components.join(':')\n stackresource = nil\n if children.include?(\"#{parentspec}\")\n stackresource = parentspec\n elsif children.include?(\"#{parentspec}Stack\")\n stackresource = \"#{parentspec}Stack\"\n elsif children.include?(\"#{parentspec}Template\")\n stackresource = \"#{parentspec}Template\"\n end\n return {} unless stackresource\n # Example stack resource:\n # arn:aws:cloudformation:us-east-1:123456789012:stack/vpc-NetworkAclsStack-1S9R8KNR0ZGPM/1ac14690-cdce-11e6-9688-50fae97e0835\n value, type = resources[stackresource].split('=')\n raise \"Wrong type for #{stackresource} in #{resourcespec}, required: AWS::CloudFormation::Stack, actual: #{type}\" unless type == \"AWS::CloudFormation::Stack\"\n parent = value.split('/')[1]\n if childspec == \"\"\n return getresources(parent)\n else\n return getresources(\"#{parent}:#{childspec}\")\n end\n end", "def find_resource_entry(filename, opts={}, seen=nil)\n extname = File.extname(filename)\n rootname = filename.gsub(/#{extname}$/,'')\n entry_extname = entry_rootname = nil\n\n ret = entries_for(:resource, opts.merge(:hidden => :none)).reject do |entry|\n entry_extname = File.extname(entry.filename)\n entry_rootname = entry.filename.gsub(/#{entry_extname}$/,'')\n\n ext_match = (extname.nil? || extname.size == 0) || (entry_extname == extname)\n !(ext_match && (/#{rootname}$/ =~ entry_rootname))\n end\n\n ret = ret.first\n\n if ret.nil?\n seen = Set.new if seen.nil?\n seen << self\n all_required_bundles.each do |bundle|\n next if seen.include?(bundle) # avoid recursion\n ret = @bundle.find_resource_entry(filename, opts, seen)\n return ret unless ret.nil?\n end\n end\n return ret\n end", "def requirements_path\n if ::File.directory?(new_resource.path)\n ::File.join(new_resource.path, 'requirements.txt')\n else\n new_resource.path\n end\n end", "def generate_resource_tests(pwd, data) end", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend" ]
[ "0.6289966", "0.6240017", "0.60639185", "0.58766145", "0.5859065", "0.5838692", "0.57796484", "0.57654995", "0.5725692", "0.56259096", "0.5619568", "0.5596181", "0.5596181", "0.55631053", "0.5478355", "0.5465605", "0.5458232", "0.54559684", "0.5451283", "0.5424018", "0.54103005", "0.54019505", "0.5384376", "0.53641707", "0.53507763", "0.53502643", "0.53459907", "0.531227", "0.53024006", "0.5281206", "0.52653694", "0.5260492", "0.52598524", "0.52561504", "0.52357996", "0.5232744", "0.5231295", "0.5222823", "0.52048117", "0.51897985", "0.51889163", "0.51844764", "0.51792663", "0.5179093", "0.5166796", "0.51645184", "0.51622736", "0.51525867", "0.5144911", "0.5144911", "0.5144911", "0.51167995", "0.5116328", "0.51103216", "0.5104784", "0.51012635", "0.5095836", "0.50920576", "0.50825596", "0.5072194", "0.5069613", "0.5064525", "0.5059276", "0.505822", "0.5053451", "0.50524926", "0.50279087", "0.5015715", "0.50157034", "0.5012549", "0.5007075", "0.500543", "0.5005421", "0.49961016", "0.49951312", "0.49921328", "0.4989249", "0.49846897", "0.49845648", "0.49830073", "0.49811137", "0.49811137", "0.49801707", "0.49767086", "0.49751055", "0.49744508", "0.49744508", "0.49743712", "0.4968732", "0.4967462", "0.496292", "0.4958699", "0.495863", "0.49520677", "0.49462894", "0.49403274", "0.49398896", "0.49393314", "0.49316764", "0.49316764", "0.49316764" ]
0.0
-1
rendered in current context
def specfile rendered_file_for(:specfile) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rendered; end", "def rendered=(_arg0); end", "def render\n end", "def render; end", "def render; end", "def render; end", "def render; end", "def render; end", "def render\n end", "def render\n end", "def render\n end", "def render(context, options); end", "def render\n end", "def render\n\n end", "def render\n # To be implemented.\n end", "def render\n content\n end", "def rendered_templates; end", "def render_variable(context); end", "def render(*args, &block); end", "def make_render_in_view exp\n make_render exp, true\n end", "def render r\n end", "def render(*args); end", "def render(*args); end", "def _render_\n document.to_s\n end", "def render\n content\n end", "def render\n content\n end", "def render\n content\n end", "def render_template(context, options); end", "def view_renderer; end", "def view_renderer; end", "def render( * )\n\t\tnil\n\tend", "def render( * )\n\t\tnil\n\tend", "def render!(*args); end", "def render_document; end", "def render_plain\n template_content\n end", "def render\n raise NotImplementedError\n end", "def render!\n result\n end", "def renderer; end", "def render( render_state )\n\t\treturn nil\n\tend", "def display\n puts render\n end", "def render(_context)\n @browser_url = @attributes['url']\n render_header + render_contents + render_url + render_footer\n end", "def render(erb)\n erb.result(binding)\n end", "def render (r)\n\tif @init then\n\t\[email protected](@handling.coupled_tests)\n\t\t@init = false\n\tend\n\tr.div.style (\"float:top;\").with {\n\t\tr.render(@menu)\n\t}\n\tr.div {\n\t\tr.render(@current)\n\t} if @current\nend", "def render_body(context, options); end", "def render(*args)\n super *args\n end", "def render_calls; end", "def render\n inspect\n end", "def rendered?\n end", "def sync_render_context\n self\n end", "def sync_render_context\n self\n end", "def render; ''; end", "def render (workitem)\n\n eval_template workitem\n end", "def render(*_arg0); end", "def render\n raise NotImplementedError, 'this should be overridden by concrete sub-class'\n end", "def render\n raise NotImplementedError\n end", "def render(exp)\n renderer.process(exp)\n end", "def render\n generate_content\n @pdf.render\n end", "def render\n render_with_markaby\n end", "def render *args\n @content\n end", "def _render_template(options); end", "def _render_template(options); end", "def markup_context; end", "def render\n if @block\n instance_eval(&@block)\n end\n end", "def render!; raise NotImplementedError end", "def render(*args)\n end", "def render\n Debug.debug { \"Now rendering #{@context} block for #{self}\" }\n @document.playback_attributes @attributes\n out = renderer.render(\"block_#{@context}\", self)\n @document.callouts.next_list if @context == :colist\n out\n end", "def render(props)\n # HTML.\n end", "def inspect\n \"<#{self.class} #{render}>\"\n end", "def render\n @formatted_content.each &:render\n end", "def render\n render_to_string(:inline => '<%= render_grid(grid) %>', :locals => {:grid => self})\n end", "def render\n raise NotImplementedError, \"Subclasses must implement a render method\"\n end", "def render\n return @template.result(@binding._binding)\n end", "def render(&block) #:nodoc:\r\n instance_eval(&block)\r\n @output_buffer\r\n end", "def render\n data\n end", "def render\n @document.playback_attributes @attributes\n renderer.render(@template_name, self)\n end", "def process_render exp\n process exp.last if sexp? exp.last\n\n add_simple_call :render, exp\n\n exp\n end", "def render\n perform(Environment.new).to_s\n end", "def render(options = nil, extra_options = {}, &block) #:doc:\n @flash=flash\nputs \"RENGINE RENDER #1\"\n options=interpret_rengine_options(options)\nputs \"RENGINE RENDER #2\"\n #no layout\n super(options,extra_options,&block)\nputs \"RENGINE RENDER #3\"\n unless self.no_wrap\nputs \"RENGINE RENDER #4a\"\n \n \n txx=render_weblab(setUserJavascript+ self.response_body.join(\"\\n\"))\n puts \"RENGINE RENDER #4b\"\n\n # puts \"===========================\\n\"+txx.join(\"\\n\")+\"\\n!================================!\"\n\n if $render_translation_link\n txx << \"\\n<div style=\\\"background-color:#aaa;color:#0ff;\\\">\\n\"\n txx << translation_tool(@displayed_blurb_names)\n txx << \"\\n</div>\\n\"\n end\nputs \"RENGINE RENDER #5\"\n\n self.response_body=txx\n \n end\n end", "def render_in(view_context, &block)\n self.class.compile\n @view_context = view_context\n @view_renderer ||= view_context.view_renderer\n @lookup_context ||= view_context.lookup_context\n @view_flow ||= view_context.view_flow\n @virtual_path ||= virtual_path\n @variant = @lookup_context.variants.first\n old_current_template = @current_template\n @current_template = self\n\n # Pass self as a block parameter\n @content = render_block(view_context, &block) if block_given?\n validate!\n\n send(self.class.call_method_name(@variant))\n ensure\n @current_template = old_current_template\n end", "def rendered\n @_rendered ||= ( persisted? ) ? Regulate::Git::Interface.find_rendered(id) : build_rendered_html\n @_rendered\n end", "def render(_context=Context.new)\n _context = Context.new(_context) if _context.is_a?(Hash)\n @proc ||= _render()\n return _context.instance_eval(&@proc)\n end", "def rendered_views=(_arg0); end", "def render(context)\n self.class.processor.call(context, data)\n end", "def render data\n @renderer.render(data)\n end", "def rendered_format; end", "def rendered_format; end", "def template\n @_renderer.current_template\n end", "def render(scope = T.unsafe(nil), locals = T.unsafe(nil)); end", "def contents\n rendered_contents\n end", "def render\n Log.dev(\"Action: #{self}\")\n stack do\n if should_cache?\n # Ignore cache if there is flash session data as the response probably\n # expects to include it, making it unique for this user and request.\n if Global.no_cache_flash && !Current.session.flash.empty?\n Log.debug(\"Action caching ignored as session flash data is present.\")\n uncached_render\n else\n cached_render\n end\n else\n uncached_render\n end\n end\n end", "def render\n raise NotImplementedError.new \"Please override 'render' in your \"+\n \"concrete implementation\"\n end", "def render\n render_background\n\n render_heat_maps\n\n render_star\n render_target\n render_hills\n render_walls\n\n render_paths\n end", "def render(object)\n @block.call(object)\n end", "def render\n Vedeu::Output::Viewport.render(current)\n end", "def erb(template) render template end", "def render\n Vedeu.render_output(output) if visible?\n end", "def build_html\n ApplicationController.render(partial: partial, locals: locals)\n end", "def render(scope = T.unsafe(nil), locals = T.unsafe(nil), &block); end", "def render()\n # WARNING! NO NEED TO UNDERSTAND THIS\n self.action = calling_method = caller[0].split(\"`\").pop.gsub(\"'\", \"\")\n template = File.read(view_filename)\n eruby = Erubis::Eruby.new(template)\n eruby.result(binding())\n end", "def render_erb\n end", "def render(binding)\n @template.render(binding)\n end" ]
[ "0.8321957", "0.78472924", "0.7809874", "0.7743724", "0.7743724", "0.7743724", "0.7743724", "0.7743724", "0.75730246", "0.75730246", "0.75730246", "0.7479907", "0.74188644", "0.73201036", "0.724864", "0.7146596", "0.71322936", "0.7111423", "0.71088016", "0.70662886", "0.70428747", "0.7027681", "0.7027681", "0.70022255", "0.6988083", "0.6988083", "0.6988083", "0.69142026", "0.6889244", "0.6889244", "0.6881225", "0.6881225", "0.68637085", "0.6858616", "0.68352735", "0.68152803", "0.68138325", "0.6796115", "0.6777249", "0.675679", "0.6749134", "0.67403924", "0.67294556", "0.67282546", "0.6726547", "0.6723403", "0.67229825", "0.6719615", "0.6714537", "0.6714537", "0.67066413", "0.66962296", "0.667674", "0.6674471", "0.66734934", "0.6669408", "0.66673785", "0.66496426", "0.66479975", "0.6636691", "0.6636691", "0.6632903", "0.66231", "0.6620046", "0.6607065", "0.6599888", "0.6594876", "0.65911937", "0.6580254", "0.6575425", "0.65403986", "0.6535733", "0.6531504", "0.65236354", "0.65214425", "0.65169454", "0.6516846", "0.651467", "0.65144217", "0.649308", "0.6474902", "0.647359", "0.6467608", "0.6465066", "0.64629614", "0.64629614", "0.64476264", "0.6446267", "0.6438799", "0.64375556", "0.64359474", "0.6421763", "0.6421534", "0.6418679", "0.6411431", "0.639757", "0.6395168", "0.6390101", "0.63900626", "0.63802886", "0.63777244" ]
0.0
-1
use label (not name) filter to avoid str part match
def find_net(name) cmd = "docker network ls -q --filter label=#{label_pair(:name, name)}" netid = `#{cmd}`.chomp return netid unless netid.empty? nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_label(label); end", "def includes_special_label?(label)\n ids.first.to_s.downcase == label || usernames.map(&:downcase).include?(label)\n end", "def label_link_filter(text)\n project = context[:project]\n\n self.class.references_in(text) do |match, id, name|\n params = label_params(id, name)\n\n if label = project.labels.find_by(params)\n push_result(:label, label)\n\n url = url_for_label(project, label)\n klass = reference_class(:label)\n\n %(<a href=\"#{url}\"\n class=\"#{klass}\">#{render_colored_label(label)}</a>)\n else\n match\n end\n end\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", "def sanitize_label(label)\n label.gsub(%r![^a-z0-9_\\-.]!i, \"\")\n end", "def clean_label\n return true unless self.label\n self.label = self.label.strip\n true\n end", "def get_label_from_filters(filters)\n props = filters.properties\n return nil if props.empty?\n\n # filters.properties = [['label','Person'],['name','ilya']]\n idx = props.index{|p| p[0] == 'label'}\n props[idx][1] if idx\n end", "def prepare_label_for_suggestion(label, index)\n label.gsub(name, \"(#{index})\")\n end", "def filter_label(filter_name, filters)\n filters[filter_name].try(:[], :label) || filter_name.to_s.humanize\n end", "def label\r\n\t\tname.match(/\\?$/) ? name : name + \":\"\r\n\tend", "def label_with_wildcard_to_list(label,parts)\n if !problems_csv_has_been_read then fatal_error(\"in label_with_wildcard_to_list, problems csv has not been read\") end\n list = []\n l = label.clone\n l.gsub!(/\\.\\.\\./,\"__WILD__\")\n l = Regexp::quote(l) # escape - characters\n l.gsub!(/__WILD__/,\".*\")\n re = Regexp::new(\"\\\\A#{l}\\\\Z\")\n $label_to_num.each { |ll,value|\n if ll=~re then list.push(value + [parts]) end\n }\n if list.length==0 then fatal_error(\"pattern #{label}, containing wildcard ..., doesn't match any labels\") end\n return list\nend", "def filters?(str); end", "def filters?(str); end", "def sanitize_mods_name_label(label)\n label.sub(/:$/, '')\n end", "def label\r\n\t\t\tname.match(/\\?$/) ? name : name + \":\"\r\n\t\tend", "def label=(label)\n @label = label.to_s.gsub(\" \",\"_\").without_superscript_characters.to_sym\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 no_tags label\n return label.gsub(/\\<.+\\/?\\>/,'')\n end", "def regexify(label)\n if label.is_a?(Regexp)\n Regexp.new(label.source, Regexp::IGNORECASE)\n elsif label.is_a?(Symbol)\n if ROW_TYPES.keys.include?(label)\n ROW_TYPES[label]\n else\n Regexp.new(\"^#{label.to_s}$\", Regexp::IGNORECASE)\n end\n else\n Regexp.new(Regexp.escape(label.to_s), Regexp::IGNORECASE)\n end\n end", "def resolve_labels(g)\n g.map! { |a|\n # if input was foo|bar...|baz, where ... is wildcard, a looks like [\"foo/B\",\"bar.../AB\",\"baz\"]\n aa = [] # new version of a with labels and wildcards resolved\n a.each { |b|\n parts = ''\n if b=~/(.*)\\/(.*)/ then\n b,parts = [$1,$2]\n end\n aa = aa + label_to_list(b,parts) # label_to_list can return a list with >1 element if there's a wildcard, 0 elts if no match\n }\n if aa.length==0 then\n aa = [[-1,'','']]\n end # later code assumes not empty list\n aa\n }\n return g\nend", "def labeled(label)\n wrap(\n @inner.select do |event|\n event['event'] == 'labeled' &&\n event['label'].name.downcase == label.downcase\n end,\n )\n end", "def label_to_list(label,parts)\n if !problems_csv_has_been_read then fatal_error(\"in label_to_list, problems csv has not been read\") end\n unless label=~/\\A[a-zA-Z0-9\\-\\._]*\\Z/ then fatal_error(\"label #{label} contains illegal characters; legal ones are a-z, A-Z, 0-9, -, _\") end\n # ... don't allow characters that could be confused with regexp; but do allow -, which is regexp meta char\n # don't want confusion with regexps, because that's how we handle ... wildcard\n # --- for efficiency and clearer error messages, handle the no-wildcard case separately\n if label=~Regexp::new(Regexp::quote(\"...\")) then\n return label_with_wildcard_to_list(label,parts)\n else\n return label_without_wildcard_to_list(label,parts)\n end\nend", "def label(*args)\n super(*args).gsub(/\\?\\s*\\:\\<\\/label\\>/, \"?</label>\").gsub(/\\?\\s*\\:\\s*\\<abbr/, \"? <abbr\")\n end", "def label_for_table\r\n label.to_s.gsub(/ /, '_').downcase\r\n end", "def clean_image_label(label)\n return if label.blank?\n label.gsub(/\\s+/, ' ').gsub(/[_\\-]+/, '_')\n end", "def is_label?(tok)\n #a label is defined as: 1st character = letter, followed by upto 10 chars/digits, followed by \":\"\n return tok.chop if ( (tok =~ /[A-Z_a-z]\\w{0,10}:$/) == 0) and tok[-1] == 58\n return nil\n end", "def match_to_preflabel(name)\n name = name.downcase\n case name\n when /reconstruction/\n standard_name = 'University of York. Post-war Reconstruction and'\\\n ' Development Unit'\n when /applied human rights/\n standard_name = 'University of York. Centre for Applied Human Rights'\n when /health economics/\n standard_name = 'University of York. Centre for Health Economics'\n when /health sciences/\n standard_name = 'University of York. Department of Health Sciences'\n when /lifelong learning/\n standard_name = 'University of York. Centre for Lifelong Learning'\n when /medieval studies/\n standard_name = 'University of York. Centre for Medieval Studies'\n when /renaissance/\n standard_name = 'University of York. Centre for Renaissance and Early'\\\n ' Modern Studies'\n when /reviews/\n standard_name = 'University of York. Centre for Reviews and'\\\n ' Disseminations'\n when /women/\n standard_name = \"University of York. Centre for Women's Studies\"\n when /school of social and political science/\n standard_name = 'University of York. School of Social and Political'\\\n ' Science'\n when /social policy/\n standard_name = 'University of York. Department of Social Policy and'\\\n ' Social Work'\n when /school of politics economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /politics/\n standard_name = 'University of York. Department of Politics'\n when /economics and related/\n standard_name = 'University of York. Department of Economics and Related'\\\n ' Studies'\n when /economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /history of art/\n standard_name = 'University of York. Department of History of Art'\n when /history/\n standard_name = 'University of York. Department of History'\n when /electronic/\n standard_name = 'University of York. Department of Electronic Engineering'\n when /theatre/\n standard_name = 'University of York. Department of Theatre, Film and'\\\n ' Television'\n when /physics/\n standard_name = 'University of York. Department of Physics'\n when /computer/\n standard_name = 'University of York. Department of Computer Science'\n when /psychology/\n standard_name = 'University of York. Department of Psychology'\n when /law/\n standard_name = 'University of York. York Law School'\n when /mathematics/\n standard_name = 'University of York. Department of Mathematics'\n when /advanced architectural/\n standard_name = 'University of York. Institute of Advanced Architectural'\\\n ' Studies'\n when /conservation/\n standard_name = 'University of York. Centre for Conservation Studies'\n when /eighteenth century/\n standard_name = 'University of York. Centre for Eighteenth Century\n Studies'\n when /chemistry/\n standard_name = 'University of York. Department of Chemistry'\n when /sociology/\n standard_name = 'University of York. Department of Sociology'\n when /education/\n standard_name = 'University of York. Department of Education'\n when /music/\n standard_name = 'University of York. Department of Music'\n when /archaeology/\n standard_name = 'University of York. Department of Archaeology'\n when /biology/\n standard_name = 'University of York. Department of Biology'\n when /biochemistry/ # confirmed with metadata team - recheck?\n standard_name = 'University of York. Department of Biology'\n when /english and related/ # confirmed directly with English department\n standard_name = 'University of York. Department of English and Related'\\\n ' Literature'\n when /philosophy/\n standard_name = 'University of York. Department of Philosophy'\n when /management studies/\n standard_name = 'University of York. Department of Management Studies'\n when /management school/\n # older versionof department name which should be retained if match found\n standard_name = 'University of York. The York Management School'\n when /language and linguistic science/\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /language and lingusitic science/ # deal with common typo\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /for all/ # this is 'languages for all' but in some records 'language'\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science. Languages for All'\n when /hull/\n standard_name = 'Hull York Medical School'\n when /international pathway/\n standard_name = 'University of York. International Pathway College'\n when /school of criminology/\n standard_name = 'University of York. School of Criminology'\n when /natural sciences/\n standard_name = 'University of York. School of Natural Sciences'\n when /environment and geography/ # order important, more precise must be first\n standard_name = 'University of York. Department of Environment and Geography'\n when /environment/\n standard_name = 'University of York. Environment Department'\n else\n standard_name = 'COULD NOT MATCH ' + name\n end\n standard_name\n end", "def found_labels\n found = get(\"title\").scan(/\\[(.*?)\\]/).map { |label_arr|\n label = label_arr[0].downcase\n label.to_sym\n }.select{ |label|\n LABEL_MAP.keys.include? label\n }\n end", "def label_target\n :\"#{attribute_name}_gteq\"\n end", "def clean_subject(string)\n without_label = string.gsub(subject_prefix_regex, '')\n if without_label =~ REGARD_RE\n \"Re: #{remove_regard(without_label)}\"\n else\n without_label\n end\n end", "def search_in(label, string)\n if !LABELS.include? label.to_sym\n raise ArgumentError, \"Unknown key: #{label}\"\n end\n\n find_all do |entry|\n text = entry.send(label).str\n text.match(/#{string}/i)\n end\n end", "def label_without_wildcard_to_list(label,parts)\n if !problems_csv_has_been_read then fatal_error(\"in label_with_wildcard_to_list, problems csv has not been read\") end\n if $label_to_num.has_key?(label) then \n return [$label_to_num[label] + [parts]]\n else\n $stderr.print \"warning: name #{label} not found in problems.csv; possibly you need to do a make book, which automatically updates problems.csv if you have a new problem\\n\"\n return []\n end\nend", "def catch_all_label\n return nil unless catch_all\n\n if catch_all.is_a? String\n \"#{catch_all.upcase}...\"\n elsif catch_all.is_a?(Hash) and catch_all['label'].is_a?(String)\n \"#{catch_all['label'].upcase}...\"\n else\n \"...\"\n end\n end", "def filter2(string)\n\nend", "def merge_label(hash, test)\n hash['label'] = test.to_s.strip\n end", "def has_label?(label_set, label)\n label_set && label_set.split(Run::IN_Separator).map(&:strip).include?(label)\n end", "def define_match_any_of\n klass.send(:define_method, :match_any_of) do |tags|\n if tags.empty?\n str(\"\")\n else\n tags.map { |tag| str(tag) }.inject do |tag_chain, tag|\n tag_chain.send :|, tag\n end\n end\n end\n end", "def filter1(string)\n\nend", "def present_field_as_label(field)\n field.to_s.sub(/_id$/, '').split('_').map(&:capitalize).join(' ')\n end", "def filter_text\n attributes.fetch(:filterText)\n end", "def description\n \"#{match.description} #{label}\"\n end", "def tag_labels\n metadata\n .reject { |k| RSPEC_IGNORED_METADATA.include?(k) || special_metadata_tag?(k) }\n .filter_map { |k, v| custom_label(k, v) }\n end", "def label\n @example.description.scan(/Campo\\s(.*?)\\s\\(\\w+\\)/).flatten.first\n rescue\n @example.description\n end", "def name_filter(column, filter)\n value = filter[:value].to_s.parameterize.split('-')\n\n regex = value.map do |v|\n if v =~ /^\\d+$/\n roman = RomanNumerals.to_roman(Integer v).downcase\n v = \"(#{v}|#{roman})\"\n end\n # [[:<:]] begining of a word\n '[[:<:]]' + v + '.*?'\n end.join\n\n sanitize_sql_array([\"name_slug ~ ?\", regex])\n end", "def label_with_id\n text_and_id( :label )\n end", "def label_with_id\n text_and_id( :label )\n end", "def label_with_id\n text_and_id( :label )\n end", "def named_filter; end", "def label\n parse_normal_range\n if self.critical? \n return \"critical\" \n elsif self.warning? \n return \"warning\"\n else\n return \"\"\n end\n end", "def string_pattern?( rule_spec )\n return (rule_spec.expression.type.name == \"sp_exp\" and !rule_spec.expression.slot_filled?(\"label\") and rule_spec.directives.empty?)\n end", "def labels!(lbl)\n save!(\"fields\" => { \"labels\" => lbl.uniq }) unless lbl.empty?\n end", "def custom_label(key, value)\n return if value == false\n return Allure::ResultUtils.tag_label(value.to_s) if value.is_a?(String) || value.is_a?(Symbol)\n\n Allure::ResultUtils.tag_label(key.to_s)\n end", "def all_fields_labeled(label_name)\n @fields.values.reject do |field|\n !field.has_label?(label_name.to_sym)\n end\n end", "def filter_in(str)\n return \"\" if str.nil? || str.empty?\n log.debug(\"(#{@pstack.conn.object_id}) INPUT #{str.inspect}\" )\n str\n end", "def name_filter\n self.gsub(/[^a-zA-Z\\s\\-\\(\\)]/, '')\n end", "def path_label\n set_slug unless slug\n slug.gsub(/\\W/, \"_\").slice(0, MAX_LABEL_LENGTH)\n end", "def path_label\n set_slug unless slug\n slug.gsub(/\\W/, \"_\").slice(0, MAX_LABEL_LENGTH)\n end", "def myfind (str)\n if str.match(/^[[:graph:]]+$/)\n Provider.where(\"lower(name) like ?\", \"%#{str}%\")\n end\n end", "def [](label, check_ptn)\n rgx = check_ptn.is_a?(Regexp) ? check_ptn : Regexp.new(\"\\\\b#{check_ptn}\\\\b\", Regexp::IGNORECASE)\n find_all { |w| w.method(label.to_sym).call =~ rgx }\n end", "def label(attribute_name, *args); end", "def filter(text)\n text.upcase.gsub(@filter, '')\n end", "def test_self_domain_to_labels_converts_input_to_string\n assert_equal %w( com live spaces someone ),\n PublicSuffix::Domain.domain_to_labels(:\"someone.spaces.live.com\")\n end", "def host_label?(str)\n str =~ /^(?!-)[a-zA-Z0-9-]{1,63}(?<!-)$/\n end", "def show_field_label label\n t(:'blacklight.search.show.label', label: label)\n end", "def case_insensitive_match; end", "def filter(val)\n raise \"filter requires a String.\" unless val.is_a? String\n @filter = val\n self\n end", "def filter_select(match, metadata)\n # Break on container_name mismatch\n unless match.hosts.empty? || match.hosts.include?(metadata[:host])\n return false\n end\n # Break on host mismatch\n unless match.container_names.empty? || match.container_names.include?(metadata[:container])\n return false\n end\n # Break if list of namespaces is not empty and does not include actual namespace\n unless match.namespaces.empty? || match.namespaces.include?(metadata[:namespace])\n return false\n end\n\n match_labels(metadata[:labels], match.labels)\n end", "def label_select_home(filter, value)\n html = nil\n if filter&.include?(value)\n html = <<-HTML\n <input class=\"form-check-input hidden required\" type=\"checkbox\" value=\"#{value}\" name=\"criteria[knowledge_level][]\" id=\"criteria_knowledge_level_#{value}\" checked>\n <label class=\"collection_check_boxes category-choice-home active\" for=\"criteria_knowledge_level_#{value}\">\n #{value.capitalize}\n </label>\n HTML\n else\n html = <<-HTML\n <input class=\"form-check-input hidden required\" type=\"checkbox\" value=\"#{value}\" name=\"criteria[knowledge_level][]\" id=\"criteria_knowledge_level_#{value}\">\n <label class=\"collection_check_boxes category-choice-home\" for=\"criteria_knowledge_level_#{value}\">\n #{value.capitalize}\n </label>\n HTML\n end\n html.html_safe\n end", "def matcher_name; end", "def matcher_name; end", "def name label\n label(label)\n end", "def create_match(nominee)\n names = []\n pname = nominee[:name]\n names << pname\n names << pname.sub(%r{ [A-Z]\\. }, ' ') # drop initial\n personname = ASF::Person.find(nominee[:id]).public_name\n names << personname if personname\n list = names.uniq.map{|name| Regexp.escape(name)}.join('|')\n # N.B. \\b does not match if it follows ')', so won't match John (Fred)\n # TODO: Work-round is to also look for EOS, but this needs to be improved\n %r{\\b(#{list})(\\b|$)}i\nend", "def case_insensitive_match=(_arg0); end", "def handle_label(label, lineno_column)\n Literal.new label[0..-2].to_sym\n end", "def filter_string(str)\n str.split(' ').reject do |v|\n @filters.any? { |filter| filter.call(v) }\n end\n end", "def parse_group filter\n /^\\(cn=(.*)\\)$/.match(filter)[1]\n end", "def filter(term)\n if ( term =~ /^[\\d\\.]+$/ )\n nil\n else\n term\n end\n end", "def string_visible_contains(class_name, value)\n value = %(\"#{value}\")\n if class_name == '*'\n return (resource_id(value, \"new UiSelector().resourceId(#{value});\") +\n \"new UiSelector().descriptionContains(#{value});\" \\\n \"new UiSelector().textContains(#{value});\")\n end\n\n class_name = %(\"#{class_name}\")\n resource_id(value, \"new UiSelector().className(#{class_name}).resourceId(#{value});\") +\n \"new UiSelector().className(#{class_name}).descriptionContains(#{value});\" \\\n \"new UiSelector().className(#{class_name}).textContains(#{value});\"\n end", "def nodelabel(node) # :nodoc:\n np = @lproc.call(node)\n case np\n when String, Symbol\n np.to_s\n when Enumerable\n (np.find { |s| s =~ /label=\"(.*?)\"/ } && $1)\n end \n end", "def label(rule, label, &block)\n ext(Label.new(label, rule), block)\n end", "def search_input_label(ctrlr = nil, **opt)\n # noinspection RubyMismatchedReturnType\n search_input_type(ctrlr, **opt)[:label]\n end", "def label\n @label ||= self.new.class.to_s.underscore.gsub('/', '.')\n end", "def sanitize_name\n self.name = Tag.sanitize_name(self.name)\n end", "def set_label(l); end", "def solrize\n return [rdf_subject.to_s] unless label_present\n [rdf_subject.to_s, { label: \"#{preferred_label}$#{rdf_subject}\" }]\n end", "def strict_matching(ingredient_name,item)\n return item.downcase.include?(ingredient_name)\nend", "def label(rule, label, &block)\n rule = ext(rule, block)\n rule.label = label\n rule\n end", "def filter(str)\n FILTERS.each do |f|\n str = f.filter(str)\n end\n str\n end", "def format_filter_na(loc, key)\n\n # if it's \"n/a\" then don't display here\n if loc == \"n/a\"\n return \"\"\n end\n return loc\n end", "def lab_check(str)\n puts str if str =~ /(l|L)ab/\nend", "def imprint_label(field)\n label_subfields = field.subfields.select { |sf| sf.value if sf.code == '3' }\n label_subfields.compact.map { |sf| sf.value.strip }.join(' ').gsub(/[,;:.]*$/, '').strip\n end", "def label\n @label || \"unknown\"\n end", "def label_name(product)\n return product.label_override unless product.label_override.nil?\n Google::StringUtils.underscore(product.name)\n .split('_')\n .map { |x| x[0] }\n .join\n .concat('_label')\n end", "def repository_label(value)\n identifier =\n if value.is_a?(Symbol)\n value\n elsif (v = value.to_s.downcase).include?('solr')\n :solr\n elsif v.include?('ebsco') || v.include?('eds')\n :eds\n end\n case identifier\n when :solr then 'Solr'\n when :eds then 'EBSCO EDS'\n else \"Unknown (#{value})\"\n end\n end", "def label_as_filename\n str = label.to_s\n if str.empty?\n str.object_id\n else\n str.sub(/\\W+/, '-')\n end\n end", "def full_label\n ''\n end", "def label=(label)\n @label = label.to_sym\n end", "def label=(label)\n @label = label.to_sym\n end", "def localized_label(str)\n LabelMap[str] || str || ''\n end", "def related_names_in_use\n @in_use.map { |n| /\\A#{normalised_name}_(\\d+)\\z/.match(n) }.compact\n end", "def label name\n UnknownLabel.new(name)\n end" ]
[ "0.7043509", "0.62652767", "0.6213342", "0.6136195", "0.61010605", "0.6006082", "0.5971048", "0.59525317", "0.5937394", "0.58967113", "0.5894078", "0.58233005", "0.58233005", "0.5818699", "0.58022684", "0.5708786", "0.56704324", "0.5651206", "0.5638042", "0.5632317", "0.56142193", "0.5609958", "0.5597716", "0.55842376", "0.5568412", "0.54950786", "0.54468614", "0.54374486", "0.5430616", "0.54025424", "0.53995997", "0.53894114", "0.5309421", "0.5307674", "0.53037286", "0.52841055", "0.528278", "0.5270086", "0.5269537", "0.5268869", "0.52496475", "0.5244785", "0.523524", "0.5233875", "0.52140874", "0.52140874", "0.52140874", "0.52135915", "0.5208432", "0.5205125", "0.5204086", "0.51972705", "0.51841396", "0.5175777", "0.51687086", "0.51676273", "0.51676273", "0.5160573", "0.51586217", "0.5152396", "0.5145486", "0.5142919", "0.51414216", "0.513161", "0.5125714", "0.5114417", "0.5090326", "0.50842404", "0.5083771", "0.5083771", "0.50576127", "0.50440896", "0.5041502", "0.5040863", "0.50356907", "0.5030794", "0.5027749", "0.5026746", "0.50259364", "0.502402", "0.50234765", "0.50224435", "0.5015386", "0.5012905", "0.50079685", "0.50056374", "0.50005955", "0.49926758", "0.49893636", "0.49867946", "0.4986189", "0.49853474", "0.4976179", "0.49760193", "0.49681416", "0.49639246", "0.4958633", "0.4958633", "0.49552944", "0.49535358", "0.49531814" ]
0.0
-1
project name for dockercompose
def compose_name "#{env}-#{fetch(:compose_name) || appname}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docker_compose_project_name\n compose_project_name = ENV['COMPOSE_PROJECT_NAME']\n if compose_project_name.nil? || compose_project_name.empty?\n compose_project_name = \"rhd_#{ENV['rhd_test']}_testing\"\n end\n compose_project_name\n end", "def docker_compose_project_name\n compose_project_name = ENV['COMPOSE_PROJECT_NAME']\n if compose_project_name.nil? || compose_project_name.empty?\n compose_project_name = \"rhd_#{ENV['rhd_test']}_testing\"\n end\n compose_project_name\n end", "def compose_cmd\n \"docker-compose -f #{specfile} --project-name #{compose_name} --project-directory #{approot}\"\n end", "def docker_compose_container\n get_config(:docker_compose_container).to_s\n end", "def setup_docker_compose\n template 'docker-compose.yml.tt', 'docker-compose.yml'\n end", "def project_name\n \"$PROJECT_NAME v.$PROJECT_VERSION\"\n end", "def project_name\n if arguments[1]\n arguments[1]\n else\n File.basename(repo.root)\n end\n end", "def docker_name(name = nil)\n if name\n @docker_name = name\n else @docker_name\n end\n end", "def name\n project.name\n end", "def name\n project.name\n end", "def container_name(service)\n File.basename(root_dir).gsub(/\\W/, '') + \"_#{service}_1\"\nend", "def project_name\n return config['project_name'] if config['project_name']\n # using Dir.pwd will return something like: \n # /var/www/apps/staging.sweetspot.dm/releases/20061006155448\n # instead of\n # /var/www/apps/staging.sweetspot.dm/current\n pwd = ENV['PWD'] || Dir.pwd\n #another hack..ugh. If using standard capistrano setup, pwd will be the 'current' symlink.\n pwd = File.dirname(pwd) if File.symlink?(pwd)\n File.basename(pwd)\n end", "def webistrano_project_name\n self.name.underscore.gsub(/[^a-zA-Z0-9\\-\\_]/, '_')\n end", "def webistrano_project_name\n self.name.underscore.gsub(/[^a-zA-Z0-9\\-\\_]/, '_')\n end", "def project_name\n DeliveryGolang::Helpers.project_name(node)\n end", "def project_name\n # using Dir.pwd will return something like: \n # /var/www/apps/staging.sweetspot.dm/releases/20061006155448\n # instead of\n # /var/www/apps/staging.sweetspot.dm/current\n pwd = ENV['PWD'] || Dir.pwd\n #another hack..ugh. If using standard capistrano setup, pwd will be the 'current' symlink.\n pwd = File.dirname(pwd) if File.symlink?(pwd)\n File.basename(pwd)\n end", "def git_project_name\n Pkg::Util.in_project_root do\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{GIT} config --get remote.origin.url\")\n stdout.split('/')[-1].chomp(\".git\").chomp\n end\n end", "def name\n 'Project'\n end", "def service_to_container_name(service_name)\n [File.basename(Dir.getwd), service_name].join('_')\nend", "def rings_project_name\n \"#{root_project_name}#{RINGS_PREFIX}\"\n end", "def project_name\n return project.nil? ? \"nil\" : project.name\n end", "def get_config_file_project_name\n @metadata[\"short_dest_repo_name\"]\n end", "def default_container_name\n full_release_name.gsub('_', '-')\n end", "def project\n return \"fake-project\" if ENV[\"LAKA_TEST\"]\n `gcloud config get-value project`.strip\n end", "def launch_config_name \n \"#{APP_NAME}-build-#{VERSION}-#{APP_ENV}\"\nend", "def docker_id(name)\n\t\treturn command_send(\"sudo docker ps -a --no-trunc -f name=#{name} | grep '\\\\s#{name}$' | tail -n 1 | awk '{ print $1 }'\")\n\tend", "def compute_project\n ENV['GOOGLE_CLOUD_PROJECT']\n end", "def full_image_name\n return generate_name if @options[:generate]\n return \"tongueroo/hi:ufo-12345678\" if ENV['TEST']\n\n unless File.exist?(docker_name_path)\n puts \"Unable to find #{docker_name_path} which contains the last docker image name that was used as a part of `ufo docker build`. Please run `ufo docker build` first.\"\n exit 1\n end\n IO.read(docker_name_path).strip\n end", "def name\n @name ||= @project.dir.path.match(/.*\\/(.*)$/).nil? ? \"unknown\" : $1\n end", "def project_name\n \"GS::Basic\"\n end", "def setup_docker_env_vars_str\n \"eval \\\"$(docker-machine env #{project_config['docker-machine']['name']})\\\" && \"\nend", "def docker_mongo\n containername = \"mongo_#{@projectname}\"\n exec \"docker exec -t -i #{containername} /usr/bin/mongo\"\n end", "def project(name)\n @projects.find { |p| p.name == name }\n end", "def project_name\n self.project ? self.project.name : NOT_SET\n end", "def docker_compose_file\n unless @compose_file\n dir = Dir.pwd()\n while dir != \"/\"\n file = File.join(dir, 'docker-compose.yml')\n if FileTest.exists?(file)\n @compose_file = file\n break;\n end\n dir = File.dirname(dir)\n end\n\n if !@compose_file\n abort \"No docker-compose.yml file found.\"\n end\n end\n\n return @compose_file\n end", "def project_path(name)\n project_map[name.to_s]\n end", "def task_for_configuration(config_name)\n \"#{@project_name}:#{config_name}\"\n end", "def service_name\n @service_name ||= InchCI::ProjectUID.new(uid).service\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def project_id\n @grpc.name.split(\"/\")[1]\n end", "def project_id\n @grpc.name.split(\"/\")[1]\n end", "def project_id\n @grpc.name.split(\"/\")[1]\n end", "def project_id\n @grpc.name.split(\"/\")[1]\n end", "def project_id\n @grpc.name.split(\"/\")[1]\n end", "def project_id\n @grpc.name.split(\"/\")[1]\n end", "def project_id\n @grpc.name.split(\"/\")[1]\n end", "def get_project_name\n project_id = params[:project_id]\n name_from_repository = payload.fetch(\"repository\", {}).fetch(\"name\", nil)\n project_id || name_from_repository\n end", "def ingenerator_project_name\n unless node['project'] && node['project']['name']\n raise ArgumentError.new('You must configure a node[project][name] attribute')\n end\n node['project']['name']\n end", "def slug\n case ENV[\"CI_PROJECT_NAME\"]\n when 'gitlab-ce'\n 'ce'\n when 'gitlab-ee'\n 'ee'\n when 'gitlab-runner'\n 'runner'\n when 'omnibus-gitlab'\n 'omnibus'\n end\nend", "def getProjectName()\n\tcurl = 'git config --local remote.origin.url|sed -n \"s#.*/\\([^.]*\\)\\.git#\\1#p\"'\n\tresult = `#{curl}`\n\treturn result.strip()\nend", "def projectizeName(filename)\n return ApplicationController.projectizeName(filename)\n end", "def package_name\n [self.config.organization, self.config.project_name].compact.collect(&:underscore).join('-')\n end", "def gcloud_project_id\n stdout = Open3.capture3(\"gcloud config list project\").first\n stdout.scan(/project = (.*)/).first.first\nend", "def unique_name\n \"#{project.name} / #{name}\"\n end", "def project\n params['project'].gsub('_', '-')\n end", "def gcp_project_number\n ENV['GOOGLE_PROJECT_NUMBER']\n end", "def docker_host d\n d.vagrant_machine = \"#{DOCKER_HOST_NAME}\"\n d.vagrant_vagrantfile = \"#{DOCKER_HOST_VAGRANTFILE}\"\nend", "def project\n service.project\n end", "def project_name\n locales_CEW.websiteName\n end", "def docker_context\n File.join(config[:dockerfiles_path], dockerfile_name)\n end", "def get_docker_container(environment, container_name)\n container_id = \"#{environment.get_compose_project_name}_#{container_name}\"\n container = get_container(container_id)\n until container.json['NetworkSettings']['Ports']\n container = get_container(container_id)\n end\n container\nend", "def setup_cloud_project(cmd_name, *args)\n ensure_docker cmd_name, args\n op = WbOptionsParser.new(cmd_name, args)\n op.add_option(\n \"--cdr-db-name [CDR_DB]\",\n ->(opts, v) { opts.cdr_db_name = v},\n \"Name of the default CDR db to use; required. (example: cdr20180206) This will subsequently \" +\n \"be created by cloudsql-import.\"\n )\n op.add_validator ->(opts) { raise ArgumentError unless opts.cdr_db_name}\n gcc = GcloudContextV2.new(op)\n\n op.parse.validate\n gcc.validate\n\n create_project_resources(gcc)\n setup_project_data(gcc, op.opts.cdr_db_name)\nend", "def restart\n puts \"\\n\\n project:\"\n puts ' command: restart'\n puts \" name: #{File.basename(root_dir)}\"\n puts \"\\n docker-machine:\"\n puts \" name: #{project_config['docker-machine']['name']}\"\n unless vm_running?\n puts ' status: NOT running '\n puts \"\\n\\n docker-machine not even running - thus do regular start\\n\\n\"\n start\n else\n puts ' status: running '\n puts \"\\n docker-compose:\"\n puts \" service: #{project_config['docker-compose']['service']}\"\n unless service_running?\n puts ' status: NOT running '\n puts \"\\n\\n service not even running - thus do regular start\\n\\n\"\n start\n else\n puts \" status: restarting... \\n\\n\"\n exec(\"#{setup_docker_env_vars_str} docker-compose restart\")\n end\n end\nend", "def default_docker_image\n \"#{env}/#{appname}:#{image_tag}\"\n end", "def vm_name\n if !name || name.empty?\n \"#{user.id}-#{project.name.gsub('.','-')}-#{Time.zone.now.to_i.to_s.sub(/^../,'')}\".downcase\n else\n name\n end\n end", "def name\n @config.db_name.gsub(/@thismachinehostname@/, Socket.gethostname).\n gsub(/@prefix@/, prefix)\n end", "def display_name\n return name unless %w(maven gradle).include?(package_manager)\n name.split(\":\").last\n end", "def build_name\n if ENV['TRAVIS_REPO_SLUG']\n \"#{ENV['TRAVIS_REPO_SLUG'][/[^\\/]+$/]}: #{ENV['TRAVIS_JOB_NUMBER']}\"\n elsif ENV['SAUCE_START_TIME']\n ENV['SAUCE_START_TIME']\n else\n \"Ruby-Watir-Selenium: Local-#{Time.now.to_i}\"\n end\n end", "def build_name\n if ENV['CIRCLE_JOB']\n \"#{ENV['CIRCLE_JOB']}: #{ENV['CIRCLE_BUILD_NUM']}\"\n elsif ENV['SAUCE_BUILD_NAME']\n ENV['SAUCE_BUILD_NAME']\n else\n \"Ruby-Cucumber-Selenium: Local-#{Time.now.to_i}\"\n end\nend", "def docker_tag_name(name = nil)\n if name\n @docker_tag_name = name\n end\n @docker_tag_name\n end", "def unique_container_name\n return DockerWrapper::Container.unique_name(new_resource.container_base_name)\n end", "def git_name\n (!GitHosting.multi_repos? || identifier.blank?) ? project.identifier : identifier\n end", "def project_slug\n DeliveryGolang::Helpers.project_slug(node)\n end", "def db_name\n\treturn File.basename($0, \".*\") + \"_db.yml\"\nend", "def project_name(new_name = T.unsafe(nil)); end", "def project\n case namespace\n when /cybox/\n :cybox\n when /stix/, /data-marking/\n :stix\n else\n nil\n end\n end", "def project_by_name(project_name)\n projects.find { |project| project['name'].casecmp(project_name) == 0 }\n end", "def name_and_project\n return name unless project\n\n \"#{::ERB::Util.h name}&nbsp;&nbsp;|&nbsp;&nbsp;#{::ERB::Util.h project.name}\".html_safe\n end", "def app_name\n c.application\n end", "def repo_name\n @repo_name ||= InchCI::ProjectUID.new(uid).repo_name\n end", "def project_name\n \"Ruby/Extensions\"\n end", "def package_name(project)\n \"#{project.name}-#{project.version}-#{project.release}.#{@architecture}.pkg.gz\"\n end", "def name\n @name ||= config(\"name\", \"WorkshopDash\")\n end", "def setup_cloud_project(cmd_name, *args)\n ensure_docker cmd_name, args\n op = WbOptionsParser.new(cmd_name, args)\n op.add_option(\n \"--cdr-db-name [CDR_DB]\",\n lambda {|opts, v| opts.cdr_db_name = v},\n \"Name of the default CDR db to use; required. (example: cdr20180206) This will subsequently \" +\n \"be created by cloudsql-import.\"\n )\n op.add_option(\n \"--public-db-name [PUBLIC_DB]\",\n lambda {|opts, v| opts.public_db_name = v},\n \"Name of the public db to use for the data browser. (example: public20180206) This will \" +\n \"subsequently be created by cloudsql-import.\"\n )\n op.add_validator lambda {|opts| raise ArgumentError unless opts.cdr_db_name}\n op.add_validator lambda {|opts| raise ArgumentError unless opts.public_db_name}\n gcc = GcloudContextV2.new(op)\n\n op.parse.validate\n gcc.validate\n\n create_project_resources(gcc)\n setup_project_data(gcc, op.opts.cdr_db_name, op.opts.public_db_name, args)\n deploy_gcs_artifacts(cmd_name, %W{--project #{gcc.project}})\nend", "def start\n # TODO: if .project.yml and .sh have not been created yet then call init to make them\n puts \"\\n\\n project:\"\n puts ' command: start'\n puts \" name: #{File.basename(root_dir)}\"\n puts \"\\n docker-machine:\"\n puts \" name: #{project_config['docker-machine']['name']}\"\n unless vm_running?\n print \" status: starting...\\r\"\n `docker-machine start #{project_config['docker-machine']['name']}` # > /dev/null 2>&1\n end\n if vm_running?\n puts ' status: running '\n else\n puts ' status: failed to start '\n exit 0\n end\n puts \"\\n watchman:\"\n unless watchman_trigger_installed?\n print \" trigger: installing...\\r\"\n add_watchman_trigger\n end\n puts \" trigger: #{watchman_trigger_installed? ? 'installed' : 'not installed'} \"\n fork do\n 30.times do\n sleep(1)\n if browser_url_responding?\n open_webapp\n break\n end\n end\n exit 0\n end\n puts \"\\n docker-compose:\"\n puts \" service: #{project_config['docker-compose']['service']}\"\n unless service_running?\n print \" status: waiting on docker daemon...\\r\"\n wait_until_docker_daemon_responding # TODO: flip this to before the service_running? check\n puts \" status: starting... \\n\\n\"\n puts \" note: browser will open webapp as soon as service is ready\\n\\n\"\n puts \" tip: execute 'docker-compose logs' to tail the service logs\\n\\n\"\n exec(\"#{setup_docker_env_vars_str} docker-compose start\")\n # stdout_data, stderr_data = Open3.capture3(\"#{setup_docker_env_vars_str} docker-compose start\")\n # 20.times do\n # sleep(1)\n # break if service_running?\n # end\n else\n puts ' status: running'\n end\n # puts \" status: #{service_running? ? 'running' : 'failed to start'} \"\nend", "def project_filename; end", "def project(name)\n Ow2mirror::Project.new(self, name)\n end", "def build_host_name\n raise Vanagon::Error, '#build_host_name has not been implemented for your engine.'\n end", "def project(workspace_name, project_name)\n if project_name.is_a?(Symbol) && project_name.to_s.start_with?('my_tasks')\n my_tasks(workspace_name)\n else\n # @type [Asana::Collection<Asana::Resources::Project>]\n ps = projects_by_workspace_name(workspace_name)\n ps.find do |project|\n project.name == project_name\n end\n end\n end", "def taskname(name)\n case Merb.orm\n when :datamapper : \"dm:db:fixtures:#{name}\"\n when :sequel : \"sequel:db:fixtures:#{name}\"\n when :activerecord : \"db:fixtures:#{name}\"\n end\nend", "def find_project_from_deployment_name(name)\n if project_name = available_deployments[name]\n return project_name\n else \n raise OroGen::DeploymentModelNotFound, \"#{client} has no deployment called #{name}\"\n end\n end", "def start\n system 'docker-compose up -d'\n end", "def project\n connection.project\n end", "def project\n connection.project\n end", "def project_setting(key)\n data.config[config[:environment]][key]\n end", "def get_container_id(name)\n compose_execute(\"ps\", \"-q\", name).chomp\n end", "def project_id\n service.project\n end", "def project_id\n service.project\n end", "def project_id\n service.project\n end" ]
[ "0.8261772", "0.82611597", "0.7155166", "0.646076", "0.6389967", "0.6380868", "0.6370124", "0.6282495", "0.62050664", "0.62050664", "0.61707693", "0.613646", "0.61011755", "0.61011755", "0.60452896", "0.6020921", "0.60172826", "0.5978754", "0.5885832", "0.5870178", "0.58679664", "0.57838345", "0.57817435", "0.57565635", "0.5728506", "0.57236266", "0.5717403", "0.5706085", "0.57020634", "0.56822646", "0.567296", "0.5650378", "0.5646114", "0.5635743", "0.5630668", "0.56174785", "0.5583873", "0.55561", "0.54890466", "0.54890466", "0.5449957", "0.5449957", "0.5449957", "0.5449957", "0.5449957", "0.5449957", "0.5449957", "0.5431639", "0.5421112", "0.53897196", "0.5381386", "0.53588045", "0.53571767", "0.53464496", "0.53369915", "0.53164417", "0.52955693", "0.52700186", "0.5265676", "0.5261687", "0.5252799", "0.5235126", "0.5233377", "0.5227381", "0.52086043", "0.52073234", "0.52038825", "0.5202281", "0.5201098", "0.51975477", "0.518618", "0.51801294", "0.51712984", "0.5167798", "0.515976", "0.5154166", "0.51519316", "0.51440555", "0.5140137", "0.51339567", "0.5114744", "0.5114066", "0.51114887", "0.51077735", "0.51065314", "0.5103525", "0.5096447", "0.5094368", "0.5086089", "0.50824827", "0.507579", "0.50737", "0.5053332", "0.5047338", "0.5047338", "0.504708", "0.5041012", "0.5037804", "0.5037804", "0.5037804" ]
0.71263045
3
f, file p, projectname to altertive project name, eg. default net prefix
def compose_cmd "docker-compose -f #{specfile} --project-name #{compose_name} --project-directory #{approot}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projectizeName(filename)\n return ApplicationController.projectizeName(filename)\n end", "def project_filename; end", "def project_file(fname)\n \"#{@project_path}/#{fname}\"\nend", "def project_name(new_name = T.unsafe(nil)); end", "def change_name!\n @project[:name] = \"#{@project[:name]}-PR#{@number}\" if @project[:name]\n @project[:value][:name] = \"#{@project[:value][:name]}-PR#{@number}\" if @project[:value][:name]\n end", "def project_name\n DeliveryGolang::Helpers.project_name(node)\n end", "def project_name\n \"$PROJECT_NAME v.$PROJECT_VERSION\"\n end", "def get_config_file_project_name\n @metadata[\"short_dest_repo_name\"]\n end", "def set_file_refenrece_name_if_needed(ref, parent_group)\n same_path_of_group = (parent_group.path == Pathname(ref.path).dirname.to_s)\n same_path_project = (Pathname(ref.path).dirname.to_s == '.' && parent_group.path.nil?)\n unless same_path_of_group || same_path_project\n ref.name = Pathname(ref.path).basename.to_s\n end\n end", "def project_name\n if arguments[1]\n arguments[1]\n else\n File.basename(repo.root)\n end\n end", "def project_name\n self.project ? self.project.name : NOT_SET\n end", "def gen_prj\n filename = \"#{@work_dir}/#{@module_name}.prj\"\n printf(\"@I:Generate Prj File(%s)\\n\",filename)\n f = File.open(\"#{filename}\",\"w\")\n tmp = Array.new\n tmp << @file_name\n tmp.uniq!\n tmp.each{|file|\n f.printf(\"verilog work \\\"%s\\\"\\n\",file)\n }\n f.close\n end", "def project\n params['project'].gsub('_', '-')\n end", "def rings_project_name\n \"#{root_project_name}#{RINGS_PREFIX}\"\n end", "def ingenerator_project_name\n unless node['project'] && node['project']['name']\n raise ArgumentError.new('You must configure a node[project][name] attribute')\n end\n node['project']['name']\n end", "def project_name\n return project.nil? ? \"nil\" : project.name\n end", "def unique_name\n \"#{project.name} / #{name}\"\n end", "def get_path_inside_project(file_path)\n file_path.gsub(%r{/#{local_source_path}}, @name)\n end", "def name\n project.name\n end", "def name\n project.name\n end", "def project_path(name)\n project_map[name.to_s]\n end", "def webistrano_project_name\n self.name.underscore.gsub(/[^a-zA-Z0-9\\-\\_]/, '_')\n end", "def webistrano_project_name\n self.name.underscore.gsub(/[^a-zA-Z0-9\\-\\_]/, '_')\n end", "def change_project(name)\n update!(name: name)\n end", "def projects_new_names_map\n {\n @user.private_files_project => \"precisionfda-personal-files-#{orgname}\",\n @user.private_comparisons_project => \"precisionfda-personal-comparisons-#{orgname}\",\n @user.public_files_project => \"precisionfda-public-files-#{orgname}\",\n @user.public_comparisons_project => \"precisionfda-public-comparisons-#{orgname}\",\n }\n end", "def project_name(node)\n node['delivery']['change']['project'] if is_change_loaded?(node)\n end", "def name\n 'Project'\n end", "def name\n @name ||= @project.dir.path.match(/.*\\/(.*)$/).nil? ? \"unknown\" : $1\n end", "def project_filename\n @filename.sub(Regexp.new(\"^#{Regexp.escape(SimpleCov.root)}\"), \"\")\n end", "def project_name\n \"GS::Basic\"\n end", "def set_project\n\n end", "def set_project\n\n end", "def name_and_project\n return name unless project\n\n \"#{::ERB::Util.h name}&nbsp;&nbsp;|&nbsp;&nbsp;#{::ERB::Util.h project.name}\".html_safe\n end", "def project_name\n return config['project_name'] if config['project_name']\n # using Dir.pwd will return something like: \n # /var/www/apps/staging.sweetspot.dm/releases/20061006155448\n # instead of\n # /var/www/apps/staging.sweetspot.dm/current\n pwd = ENV['PWD'] || Dir.pwd\n #another hack..ugh. If using standard capistrano setup, pwd will be the 'current' symlink.\n pwd = File.dirname(pwd) if File.symlink?(pwd)\n File.basename(pwd)\n end", "def project_name\n # using Dir.pwd will return something like: \n # /var/www/apps/staging.sweetspot.dm/releases/20061006155448\n # instead of\n # /var/www/apps/staging.sweetspot.dm/current\n pwd = ENV['PWD'] || Dir.pwd\n #another hack..ugh. If using standard capistrano setup, pwd will be the 'current' symlink.\n pwd = File.dirname(pwd) if File.symlink?(pwd)\n File.basename(pwd)\n end", "def project_identifier(p, length=26)\n truncate([p.shortname, p.description].join(\" - \"), :length => length)\n end", "def project_code\n name[PROJECT_CODE_FORMAT]\n end", "def project=(_arg0); end", "def generate_project_page(p)\n # Redirect page\n write_file(p, '../index.html') { build_from_template('redirect.html') }\n\n # Summaries\n summaries = Dir[\"#{p.path}/*.tsv\"].map do |i|\n b = File.basename(i, '.tsv')\n generate_summary_page(i, p)\n \"<li><a href='s-#{b}.html'>#{format_name(b)}</a></li>\"\n end.join('')\n\n # Project index page\n data = {\n project_active: 'active',\n information: format_metadata(p),\n summaries: summaries.empty? ? 'None' : \"<ul>#{summaries}</ul>\",\n results: format_results(p)\n }\n write_file(p, 'index.html') { build_from_template('index.html', data) }\n end", "def project; end", "def full_name\n \"#{@package}.#{parameterized_name}\"\n end", "def package_name\n [self.config.organization, self.config.project_name].compact.collect(&:underscore).join('-')\n end", "def rename_projects!\n projects_new_names_map.each do |dxid, new_name|\n @user_api.project_update(dxid, name: new_name)\n end\n end", "def name\n read_property('Name') || asmname || proj_filename_noext\n end", "def package_name(project)\n \"#{project.name}-#{project.version}-#{project.release}.#{@architecture}.pkg.gz\"\n end", "def project_name(pid)\n Nokogiri::HTML(pivotal_tracker(project_url(pid)).content).css('project > name').text.split(' ').join\nend", "def anonymize_projects(all_projects)\n all_projects.each do |project|\n # anonymize the project\n project[:name] = 'The ' + random_name(4).capitalize + ' Project'\n project[:description] = 'A description of the project'\n end\n end", "def define_project_name_and_id(git_service, user_token)\n puts \"\\nPlease enter the name of the current project :\"\n puts '----------------------------------------------'\n\n begin\n input = STDIN.gets.chomp\n exit! if input == 'quit'\n\n url = \"#{git_service.routes[:search_projects]}#{input}\"\n\n response = get(url: url, headers: { git_service.token_header => user_token })\n\n if response[:status] == '200' && !response[:body].empty?\n puts \"\\nFound #{response[:body].count} match(es):\"\n response[:body].each_with_index do |project, index|\n puts \"#{index + 1} - #{project['name_with_namespace']}\"\n end\n\n puts \"\\nPlease insert the number of the current project :\"\n puts '-------------------------------------------------'\n input = validate_choice(response[:body])\n {\n project_slug: response[:body][input - 1]['path_with_namespace'],\n project_id: response[:body][input - 1]['id']\n }\n\n else\n puts \"\\nOops, we couldn't find a project called #{input}. Try again or quit (quit) :\"\n puts '-------------------------------------------------------------------' + ('-' * input.length) # Don't be upset, i'm a perfectionist <3\n define_project_name_and_id(git_service, user_token)\n end\n rescue Interrupt\n exit!\n end\n end", "def project_root=(_arg0); end", "def project_slug\n DeliveryGolang::Helpers.project_slug(node)\n end", "def calc_program_name project_symbol\n camel_to_snake_case(project_symbol).downcase\n end", "def fake_config_path_relative_to_project(file_name)\n File.join(\"spec/support/upsteem/deploy/fake_config\", file_name)\n end", "def project_params\n res = params.require(:project).permit(:name, :description, :is_public, :parent_id, :status)\n res[\"github_full_name\"] = params[\"project\"][\"github_full_name\"].gsub(/  /,\"\") unless params[\"project\"][\"github_full_name\"].blank?\n res[\"ruffnote_full_name\"] = params[\"project\"][\"ruffnote_full_name\"].gsub(/  /,\"\") unless params[\"project\"][\"ruffnote_full_name\"].blank?\n return res\n end", "def create_full_filename(tv, q, f)\n ext = helper_make_ext(q,f)\n title = tv['track']['title'].dup\n title.gsub!(/'|\"/, ' ')\n title.gsub!(/[^A-Za-z0-9_ \\-]/, '_')\n title.gsub!(/ /, '')\n prefix = \"#{tv['track_key']} #{title}\"\n # We cut this off at 27 characters, basically trying to keep aif name\n # under 32 characters long.\n prefix.slice!(27..10000) if prefix.length > 27\n \"#{prefix}.#{ext}\"\n end", "def project_name\n locales_CEW.websiteName\n end", "def project_name\n \"Ruby/Extensions\"\n end", "def display_resource(project)\n project.name\n end", "def base_doc(proj, label)\n proj_host = Discovery.parse_host(proj)\n norm_path =\n proj.gsub(/\\\\|\\/|:/, \"_\").chomp.strip.squeeze(\"_\").gsub(/^_|_$/,\"\")\n\n {\n label: label,\n project_id: \"#{label}:#{proj_host}:#{norm_path}\".downcase,\n project_path: proj,\n project_name: File.basename(proj),\n project_home: Discovery.parse_home(proj),\n project_host: proj_host\n }\n end", "def project_params\n params.require(:project).permit(:namespace_id, :dockerfile, :user_id, :group_id, :version_format, :name)\n end", "def fmri_package_name\n version = project.build_version.split(/[^\\d]/)[0..2].join(\".\")\n platform = Ohai[\"platform_version\"]\n \"#{safe_base_package_name}@#{version},#{platform}-#{project.build_iteration}\"\n end", "def getProjectName()\n\tcurl = 'git config --local remote.origin.url|sed -n \"s#.*/\\([^.]*\\)\\.git#\\1#p\"'\n\tresult = `#{curl}`\n\treturn result.strip()\nend", "def to_s\n # First check that we have all necessary fields\n raise 'Missing project name' if(name.nil? || name.empty?)\n raise 'Missing project type' if(type.nil? || type.empty?)\n\n # Now we can build the string and return it\n str = ''\n\n str << 'project ' + name + \" {\\n\"\n str << \" # The project type determines what kind of file will be created, as well as\\n\"\n str << \" # its name. Given a project named 'foo', we can build one of three file types:\\n\"\n str << \" # 1) An application named foo\\n\"\n str << \" # 2) A static library named libfoo.a\\n\"\n str << \" # 3) A shared library named libfoo.so\\n\"\n str << \" type = #{type}\\n\"\n str << \"\\n\"\n str << \" # All files in this project that should be compiled\\n\"\n str << \" files {\\n\"\n files.each { |x| str << \" #{x}\\n\" } if !files.nil?\n str << \" }\\n\"\n str << \"\\n\"\n str << \" # All the other projects that this project depends on\\n\"\n str << \" deps {\\n\"\n deps.each { |x| str << \" #{x}\\n\" } if !deps.nil?\n str << \" }\\n\"\n str << \"\\n\"\n str << \" # A list of third-party libraries used by this project.\\n\"\n str << \" # For a library file named 'libfoo.a' or 'libfoo.so', just write 'foo'.\\n\"\n str << \" libs {\\n\"\n libs.each { |x| str << \" #{x}\\n\" } if !libs.nil?\n str << \" }\\n\"\n str << \"\\n\"\n str << \" # Paths to search for included files\\n\"\n str << \" inc-paths {\\n\"\n inc_paths.each { |x| str << \" #{x}\\n\" } if !inc_paths.nil?\n str << \" }\\n\"\n str << \"\\n\"\n str << \" # Paths to search for third-party library files\\n\"\n str << \" lib-paths {\\n\"\n lib_paths.each { |x| str << \" #{x}\\n\" } if !lib_paths.nil?\n str << \" }\\n\"\n str << \"}\\n\"\n \n return str;\n end", "def project_model_text_from_name(name)\n if text = available_projects[name]\n return text\n else\n raise OroGen::ProjectNotFound, \"#{client} has no project called #{name}, available projects: #{available_projects.keys.sort.join(\", \")}\"\n end\n end", "def adjust_task_output_names_patterns(task) #:nodoc:\n local_name = task.params[:_cb_pipeline][\"0\"][:savename].presence\n global_name = task.params[:_cb_output_renaming_pattern].presence\n if local_name\n task.params[:_cb_output_renaming_pattern] = (local_name || \"\") # crush global name\n else\n task.params[:_cb_pipeline][\"0\"][:savename] = (global_name || \"\")\n end\n end", "def file_name\n # file = full_name\n # file = file.gsub('::', '/')\n # file = file.gsub('#' , '/')\n # file = file.gsub('.' , '-')\n # #file = File.join(output, file + '.html')\n # file\n WebRI.entry_to_path(full_name)\n end", "def localname\n @localname ||= ::File.join(filename + (extension || ''))\n end", "def project(name)\n @projects.find { |p| p.name == name }\n end", "def file_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s\n\tend", "def parse_project(p)\n @builder.outline(\"text\" => p[\"name\"], \"type\" => \"link\", \"url\" => p[\"url\"], \"created\" => p[\"created\"]) do\n p[\"tasks\"].each { |t| parse_task(t) }\n end\n end", "def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end", "def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end", "def git_project_name\n Pkg::Util.in_project_root do\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{GIT} config --get remote.origin.url\")\n stdout.split('/')[-1].chomp(\".git\").chomp\n end\n end", "def task_for_configuration(config_name)\n \"#{@project_name}:#{config_name}\"\n end", "def update_project(project, ptProject)\n project.title = ptProject.name\n project.current_iteration_id = ptProject.current_iteration_number\n project.save\n end", "def configure_app_name(files)\n files.each do |file|\n gsub_file file, /<%= app_name %>/, app_name\n end\n end", "def full_name\n if @prefix != \"\"\n File.join(@prefix, @name)\n else\n @name\n end\n end", "def get_project_name\n project_id = params[:project_id]\n name_from_repository = payload.fetch(\"repository\", {}).fetch(\"name\", nil)\n project_id || name_from_repository\n end", "def to_s\n project.path_to_name\n end", "def projects ; end", "def seed_resource_name(project, resource)\n resource_name = resource.dig_fetch(:metadata, :name)\n if where(deleted_at: nil, resource_name: resource_name).exists?\n resource_name = \"#{project.permalink}-#{resource_name}\".tr('_', '-')\n end\n resource_name\n end", "def path\n File.join @proj_path_base, @proj_filename\n end", "def generateBuildNamePrefix()\n testflight_version_number = get_version_number(\n xcodeproj: \"CICD-DemoApp.xcodeproj\"\n )\n testflight_build_number = get_build_number(\n xcodeproj: \"CICD-DemoApp.xcodeproj\"\n )\n return \"CICD_\" + testflight_version_number.to_s + \"-\" + testflight_build_number.to_s\nend", "def project_by_name(project_name)\n projects.find { |project| project['name'].casecmp(project_name) == 0 }\n end", "def project_slug\n DeliveryTruck::Helpers.project_slug(node)\n end", "def project\n @recipe_file.project\n end", "def project_slug(node)\n change = node['delivery']['change']\n ent = change['enterprise']\n org = change['organization']\n proj = change['project']\n \"#{ent}-#{org}-#{proj}\"\n end", "def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end", "def project_slug(node)\n if is_change_loaded?(node)\n change = node['delivery']['change']\n ent = change['enterprise']\n org = change['organization']\n proj = change['project']\n \"#{ent}-#{org}-#{proj}\"\n end\n end", "def initialize(project:)\n raise ArgumentError, 'Name must not be empty' if project.to_s.empty?\n\n @project = project.to_path\n end", "def file_name_with_path\n root_path.dup + file_name\n end", "def formatted_projects(projects)\n formatted = \"\"\n projects.each do |p|\n formatted << \"%s:\\t%s\\n\" % [p.id, p.path]\n end\n\n formatted\n end", "def projectName\n dateTime = Time.new\n \"DS Demo DSv6_Automation zZz #{dateTime.strftime(\"%d-%b-%Y\")}\"\n # \"DS Demo DSv6_AutomationUS11 zZz 20-Jul-2017\"\nend", "def file name\n \n end", "def generateBuildNamePrefix_Debug()\n prefix = generateBuildNamePrefix\n return prefix + \"-debug\"\nend", "def create_short_filename(tv, q, f)\n ext = helper_make_ext(q,f)\n \"#{tv['track_key']}.#{ext}\"\n end", "def full_filename(for_file)\n #[remote_process!, for_file].join(\".\")\n for_file\n end", "def set_project_path(ppath)\n if File.file? File.join(ppath, 'package.xml')\n @src = ppath\n dump_settings\n else\n pute(\"No package.xml found in #{ppath}\", true)\n end\n end", "def name_prefix=(_arg0); end", "def page_file_name(name, format)\n format.nil? ? name : \"#{name}.#{::Gollum::Page.format_to_ext(format)}\"\n end", "def allow_project\n name = params[:nameproject]\n @project = Project.find_project(@user.id, @space.id, name).take || not_found\n\n # parser token\n @parse_token = Project.token\n end", "def project\n end" ]
[ "0.6794774", "0.6739951", "0.6683074", "0.6572354", "0.6522106", "0.6216885", "0.618316", "0.61010385", "0.6020969", "0.6020866", "0.5960323", "0.59455127", "0.5927612", "0.58929986", "0.5892349", "0.58813894", "0.58737075", "0.58435756", "0.58141893", "0.58141893", "0.58007526", "0.5797845", "0.5797845", "0.5781714", "0.57173496", "0.56881243", "0.5667048", "0.563962", "0.56310695", "0.55864865", "0.5578524", "0.5578524", "0.5564117", "0.5560125", "0.5522494", "0.5515505", "0.5505371", "0.5492102", "0.54841745", "0.54820883", "0.5440124", "0.54283875", "0.54190975", "0.54099965", "0.5402323", "0.538291", "0.5363344", "0.53498304", "0.53473437", "0.5337521", "0.5296998", "0.52886736", "0.52787495", "0.5275398", "0.52657586", "0.52634996", "0.52586484", "0.5253401", "0.524931", "0.52406573", "0.5231335", "0.52294874", "0.52272195", "0.52270234", "0.5225004", "0.5220446", "0.5219208", "0.5206279", "0.51826715", "0.51760113", "0.51760113", "0.5175024", "0.5171675", "0.51625025", "0.51619464", "0.51560915", "0.51555085", "0.5143056", "0.5129899", "0.5129743", "0.5125625", "0.5125181", "0.51161724", "0.5115311", "0.5113474", "0.51049614", "0.51047474", "0.51035136", "0.50964826", "0.5089279", "0.5081141", "0.50797087", "0.50771713", "0.50737596", "0.507263", "0.50596035", "0.50490206", "0.50447434", "0.5035557", "0.50338614", "0.5033278" ]
0.0
-1
todo disentangle here paths
def appname fetch(:appname) || script_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def path() end", "def path() end", "def path() end", "def path(*) end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def split_path; end", "def by_path(path); end", "def base_dir_for_path_parameters; end", "def initial_paths; end", "def path\n end", "def path\n end", "def path\n end", "def build_view_paths(paths); end", "def fullpath; end", "def path=(_arg0); end", "def path=(_arg0); end", "def path=(_arg0); end", "def path=(_arg0); end", "def path=(_arg0); end", "def build_path\n end", "def translate_paths(body, env); end", "def path=(_); end", "def path=(_); end", "def path=(_); end", "def path=(_); end", "def path=(_); end", "def path=(_); end", "def full_path; end", "def path\n end", "def basepath; 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 shortpath(fullpath); end", "def path_without_name_and_ref(path); end", "def path; super; end", "def from_path=(_arg0); end", "def from_path=(_arg0); end", "def from_path; end", "def from_path; end", "def helpers_paths=(_arg0); end", "def helpers_paths=(_arg0); end", "def path_expanded path\n end", "def relative_path; end", "def relative_path; end", "def relative_path; end", "def relative_path; end", "def relative_path; end", "def view_paths; end", "def view_paths; end", "def view_paths; end", "def paths\n paths = {}\n end", "def paths\n paths = {}\n end", "def path\n\t\t@path\n\tend", "def at(path); end", "def full_path=(_arg0); end", "def normalize_path(path); end", "def normalize_path(path); end", "def pathSourceHyper\n\t\"../../HyperOpen/\"\nend", "def relative_directory; end", "def skip_paths; end", "def path(*elements) #Create a path from the elements\n#-------------------------------------------------------------------------------\n path=elements.join('/').strip #Remove leading and trailing whitespace\n while path.gsub!('//','/'); end #Remove duplicate slashes\n return path\nend", "def path\n [name]\n end", "def cleaned_relative_path; end", "def cleaned_relative_path; end" ]
[ "0.767024", "0.767024", "0.767024", "0.767024", "0.767024", "0.7222189", "0.7222189", "0.7222189", "0.71529245", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.70031244", "0.6979619", "0.6884173", "0.6878805", "0.6787143", "0.66975826", "0.66975826", "0.66975826", "0.6605247", "0.6588597", "0.65710855", "0.65710855", "0.65710855", "0.65710855", "0.65710855", "0.655327", "0.65366495", "0.6502148", "0.6502148", "0.6502148", "0.6502148", "0.6502148", "0.6502148", "0.64785576", "0.64534867", "0.6450786", "0.64238065", "0.63828355", "0.6366515", "0.6352574", "0.63424915", "0.63424915", "0.6333996", "0.6333996", "0.6241987", "0.6241987", "0.6236551", "0.6235891", "0.6235891", "0.6235891", "0.6235891", "0.6235891", "0.6218377", "0.6218377", "0.6218377", "0.6208837", "0.6208837", "0.61976105", "0.6194489", "0.6191656", "0.6185996", "0.6185996", "0.61712044", "0.6170947", "0.6162599", "0.61624426", "0.6151138", "0.61503536", "0.61503536" ]
0.0
-1
URI not support underscore hostname
def default_container_name full_release_name.gsub('_', '-') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri_host; end", "def do_url (name)\n name.to_s.downcase.gsub(' ', '_')\n end", "def normalized_host; end", "def http_uri\n \"http://#{hostname}/\"\n end", "def test_absolute_uri_underscores\n parser = HttpParser.new\n req = parser.env\n http = \"GET http://under_score.example.com/foo?q=bar HTTP/1.0\\r\\n\\r\\n\"\n parser.buf << http\n assert_equal req, parser.parse\n assert_equal 'http', req['rack.url_scheme']\n assert_equal '/foo?q=bar', req['REQUEST_URI']\n assert_equal '/foo', req['REQUEST_PATH']\n assert_equal 'q=bar', req['QUERY_STRING']\n\n assert_equal 'under_score.example.com', req['HTTP_HOST']\n assert_equal 'under_score.example.com', req['SERVER_NAME']\n assert_equal '80', req['SERVER_PORT']\n assert_equal \"\", parser.buf\n assert ! parser.keepalive?\n end", "def full_uri\n \"#{host_uri}#{uri}\"\n end", "def host\n URI(self.uri).host\n end", "def test_inexistent_local_name\n assert_equal(\"\", N::URI.new(\"http://somethingelse.com/\").local_name)\n end", "def host_as_string; end", "def test_local_name\n assert_equal(\"master\", N::URI.new(\"http://somethingelse.com/master\").local_name)\n assert_equal(\"slave\", N::URI.new(\"http://somethingelse.com/master#slave\").local_name)\n assert_equal(\"chicken\", N::URI.new(\"http://somethingelse.com/animals/chicken\").local_name)\n end", "def _http_url\n HTTPURI + _uri_path\n end", "def host\n \"#{@url.scheme}://#{@url.host}\"\n end", "def URI(url); end", "def underscore\n gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').tr('-', '_').downcase\n end", "def url_(str)\n encoding = str.encoding\n str.b.gsub(/([^ a-zA-Z0-9_.-]+)/) do |m|\n '%' + m.unpack('H2' * m.bytesize).join('%').upcase\n end.tr(' ', '+').force_encoding(encoding)\n end", "def host\n _, _, host, = URI.split url\n host\n end", "def raw_host_with_port; end", "def fix_host\n if host.blank?\n begin\n uri = URI(url)\n logger.debug (self.host = uri.host.match(/\\w*\\.\\w*$/)[0])\n rescue\n return false\n end\n end\n true\n end", "def short_url\n \"#{HOST_URL}/#{short_code}\"\n end", "def ns_underscore\n to_s.underscore.gsub('/', '__')\n end", "def hostname(value)\n value || BASE_URI\n end", "def uri_normalizer; end", "def url\n URI.escape(\"#{protocol}#{host}/#{path_prefix}#{key}\")\n end", "def uri=(_arg0); end", "def uri=(_arg0); end", "def uri=(_arg0); end", "def uri=(_arg0); end", "def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend", "def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend", "def url_name\n\t\treturn name.gsub(/[\\?\\&\\/\\#\\.]+/, '')\n\tend", "def generate_host\n uri = Addressable::URI.parse(self.url)\n self.site = uri.site\n self.domain_tld = [uri.domain,uri.tld].join('.')\n end", "def resolved_uri; end", "def url(uri=nil)\n @uri = Addressable::Template.new(uri.gsub(/:(?![0-9])(\\w+)/) { \"{#{$1}}\" }) unless uri.nil?\n @uri\n end", "def underscore\n gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z\\d])(A-Z)/, '\\1_\\2').\n tr('-', '_').downcase\n end", "def underscore_name(name)\n name.to_s.sub(/.*::/, \"\").\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end", "def test_domain_part\n assert_kind_of(N::URI, N::URI.new(\"http://somethingelse.com/foobar/bla/\").domain_part)\n assert_equal(\"http://somethingelse.com/foobar/bla/\", N::URI.new(\"http://somethingelse.com/foobar/bla/\").domain_part.to_s)\n assert_equal(\"http://somethingelse.com/foobar/bla/\", N::URI.new(\"http://somethingelse.com/foobar/bla/thing\").domain_part.to_s)\n assert_equal(\"http://somethingelse.com/foobar/bla#\", N::URI.new(\"http://somethingelse.com/foobar/bla#thong\").domain_part.to_s)\n end", "def host_and_path(uri)\n uri = URI.parse(uri) unless uri.is_a? URI\n host = uri.host\n path = uri.path.gsub(/\\/$/, '')\n path = path.empty? ? '/' : uri.path\n URI.parse(\"#{host}#{path}\")\n end", "def build_uri\n unless title.blank?\n self.uri = title.mb_chars.normalize(:d).split(//u).reject { |e| e.length > 1\n }.join.gsub(\"\\n\", \" \").gsub(/[^a-z0-9\\-_ \\.]+/i, '').squeeze(' '\n ).gsub(/ |\\.|_/, '-').gsub(/\\-+/, '-').gsub(/(^\\-)|(\\-$)/, '').downcase\n end\n end", "def same_host?(uri)\n uri.host == @url.host\n end", "def hostname; end", "def hostname; end", "def uri (name,default=\"\")\n \n name=name.to_s\n #FIXME: bad urls (for example just www.example.com will produce an endless-loop\n if name.try(:include?, \"://\")\n return name[0..name.length-2] if name[-1,1]==\"/\"\n return name[0..name.length]\n else\n name +=\"/\" unless (name[name.length-1..name.length-1] == (\"/\" || \"#\")) || name.try(:include?, \":\")\n\n if name.index(\":\") \n t= @object_namespaces[name.split(\":\")[0].to_sym]\n t ||=\"\"\n t += \"/\" unless (t[t.length-1..t.length-1] == (\"/\" || \"#\") || t.blank?) || name.try(:include?, \":\")\n return uri( t+ normalize_local_name(name.split(\":\")[1])+\"/\")\n else \n t= default.blank? ? @base_uri : default\n t += \"/\" unless t[t.length-1..t.length-1]==\"/\"\n return uri( t + normalize_local_name(name))\n end\n end\n end", "def set_url_safe_name\n self.url_safe_name = self.name.downcase.gsub(/[^a-zA-Z0-9]+/, '-').chomp('-')\n end", "def host_with_port\n if uri.port.nil? || uri.port.to_i == 80\n uri.host\n else\n \"#{uri.host}:#{uri.port}\"\n end\n end", "def key_for(url)\n url.to_s.downcase.gsub(\"https\",'http').gsub(/\\s+/,' ')\n end", "def key_for(url)\n url.to_s.downcase.gsub(\"https\",'http').gsub(/\\s+/,' ')\n end", "def shorten!(url, key=nil)\n begin\n key ? named_url(url, key) : autoname_url(url)\n rescue => e\n @error = e and raise\n end\n end", "def url_for(string); end", "def uri_host(url)\n url = uri(url)\n url ? url.host : nil\n end", "def parse_url_host\n url = self.url.gsub(/^https?\\:\\/\\//, '')\n url = url.gsub(/www\\./, '') unless (url.match(/www\\./).blank? && url.gsub(/www\\./, '').match(/[A-Za-z]/))\n self.url = \"https://\" + url\n end", "def external_urlname\n return urlname if urlname =~ /\\A(\\/|[a-z]+:\\/\\/)/\n \"http://#{urlname}\"\n end", "def normalize_uri uri\n (uri =~ /^https?:/) ? uri : \"http://#{uri}\"\n end", "def server_url=(_arg0); end", "def build_hostname\n hostname\n end", "def test_uri\n uri_string = \"http://foobar.com/xyz/\"\n uri = N::URI.new(uri_string)\n assert_equal(uri_string, uri.to_s)\n end", "def host=(_); end", "def build_url(host)\n host.protocol + host.url\n end", "def _uri(uri, absolute = false, format = \"do\")\n return absolute ? \"#{uri}.#{format}\" : \"#{uri_prefix}#{uri ? uri : ''}.#{format}\"\n end", "def host_set(host)\n rebuild_uri :host => host\n end", "def http_stands_for\n # TODO: Return a `string` with the full meaning of the acronym `HTTP`.\n # Hint, the format should look like this: Hxxx-Txxx Txxx Pxxx\n return ''\nend", "def is_internal_uri?(uri, host_name, host_port)\n return ((uri.scheme == \"http\") && (uri.host == host_name) && (uri.port.to_s == host_port)) \n end", "def encode_hostname(hostname); end", "def test_absolute_uri_uri_parse\n \"#{URI::REGEXP::PATTERN::UNRESERVED};:&=+$,\".split(//).each do |char|\n parser = HttpParser.new\n req = parser.env\n http = \"GET http://#{char}@example.com/ HTTP/1.0\\r\\n\\r\\n\"\n assert_equal req, parser.headers(req, http)\n assert_equal 'http', req['rack.url_scheme']\n assert_equal '/', req['REQUEST_URI']\n assert_equal '/', req['REQUEST_PATH']\n assert_equal '', req['QUERY_STRING']\n\n assert_equal 'example.com', req['HTTP_HOST']\n assert_equal 'example.com', req['SERVER_NAME']\n assert_equal '80', req['SERVER_PORT']\n assert_equal \"\", http\n assert ! parser.keepalive?\n end\n end", "def scheme_with_host(domain=nil)\n ['http://', domain || self.name, '/'].join(\"\")\n end", "def decode_hostname(hostname); end", "def ns_pathify\n to_s.gsub('__', '/')\n end", "def base_hostname\n @username.match(/.com/) ? @username : \"#{@username}.tumblr.com\"\n end", "def object_key_from_uri(uri)\n uri.split('/')[3..-1].join('/')\n end", "def autoname_url(url)\n request('POST', @uri.request_uri, url)\n end", "def underscore\n self.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end", "def url=(_); end", "def sub_url (p)\n res = (p != \"\") ? \"http://\" + request.host + \":3000\" + p.sub(\"/execute/\", \"/rest2/\") : p\n end", "def getHost()\n return @uri.host\n end", "def host_url\n proto = request.env['SERVER_PROTOCOL'].downcase.index(\"https\").nil? ? \"http\" : \"https\"\n return \"#{proto}://#{request.env['HTTP_HOST']}\"\n end", "def pdns_pathname(uri)\n require 'pathname'\n require 'uri'\n Pathname.new(URI.parse(uri).path)\nend", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def categorize_uri(str)\n regex = /\\.+/ # really simple host regex to thwart unwanted strings\n str = \"http://#{str}\" unless str.to_s =~ %r{\\Ahttps?://}\n uri = URI.parse(str.to_s)\n path = uri.path.chomp('/')\n return :unknown if (uri.host =~ regex).nil?\n\n path.empty? ? :host : :url\n rescue URI::InvalidURIError\n :unknown\n end", "def url(prefix, stem)\n if prefix == ''\n \"/#{stem}/#{self.id}\"\n else\n \"#{prefix}/#{stem}/#{self.id}\"\n end\n end", "def host_from_uri(domain)\n Addressable::URI.parse(domain).host || Addressable::URI.parse(\"http://#{domain}\").host\n end", "def fix_hostname_in_response_url\n self.padlet_url.gsub!(/.*padlet\\.com/, \"http://#{PadletWrapper.hostname}\")\n end", "def reg_url; /(.+)/; end", "def reg_url; /(.+)/; end", "def host\n \"#{request.env['rack.url_scheme']}://#{request.host}:#{request.port}\".sub(':80','')# rescue 'http://locahost:3000'\n end", "def normalized_host\n # Remove trailing '.' characters\n host.sub(/\\.*$/, '').downcase if host\n end", "def underscore\n self.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end", "def host=(_arg0); end", "def host=(_arg0); end", "def underscore\n word = self.dup\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end", "def normalize_uri(uri)\n (uri =~ /^(https?|ftp|file):/) ? uri : \"http://#{uri}\"\n end", "def create_uri\n end", "def request_uri(uri)\n if has_colon_path_separator?(uri)\n path = hostname_and_path(uri).split(':').all_but_first.join('/')\n else\n path = hostname_and_path(uri).split('/').all_but_first.join('/')\n path.blank? ? nil : '/' + path\n end\n end", "def short(host,port)\n Rails.application.routes.url_helpers.short_url(slug: self.slug,host: host, port: port)\n end", "def uri\n \"http://#{hostname}:#{port}#{path}\"\n end", "def url_with_prefix\n\t\t( url.blank? ) ? '' :\n\t\t\t( url.match(/^http(s)?:\\/\\//) ? url : \"http://#{url}\" )\n\tend", "def test_only_local_name\n assert_equal(nil, N::URI.new(\"file:thingy\").local_name)\n end" ]
[ "0.73826665", "0.6853446", "0.6795866", "0.6704539", "0.6463444", "0.6461036", "0.6426392", "0.63171715", "0.6282429", "0.62471646", "0.6220746", "0.6214699", "0.619488", "0.6167247", "0.61516565", "0.6143218", "0.6142354", "0.61412287", "0.61328757", "0.61328495", "0.6125854", "0.6125475", "0.6121334", "0.6109894", "0.6109894", "0.6109894", "0.6109894", "0.61048543", "0.61048543", "0.6076074", "0.6068128", "0.60585374", "0.6039997", "0.6000868", "0.59925187", "0.5989415", "0.59827435", "0.5982294", "0.59807163", "0.5976425", "0.5976425", "0.5976169", "0.5975583", "0.5975521", "0.59730864", "0.59730864", "0.5952179", "0.5951898", "0.5949043", "0.5940708", "0.59307796", "0.5930702", "0.59304845", "0.5920968", "0.59178936", "0.5913696", "0.59101737", "0.5906402", "0.5896758", "0.5886871", "0.58811444", "0.587437", "0.58724546", "0.5862062", "0.5859165", "0.5856647", "0.58551604", "0.58424234", "0.5842305", "0.5841633", "0.58408624", "0.58351785", "0.58286154", "0.5823811", "0.5810409", "0.58078456", "0.58078456", "0.58078456", "0.58078456", "0.58078456", "0.58078456", "0.58078456", "0.5789393", "0.57730144", "0.5768956", "0.576249", "0.5748038", "0.5748038", "0.57476526", "0.5745979", "0.5740664", "0.573932", "0.573932", "0.5733871", "0.5731142", "0.5729909", "0.57271343", "0.572259", "0.57211876", "0.5720941", "0.57165575" ]
0.0
-1
fix appname in top domain( eg ab app for ab.c top domain)
def smart_proxy_domain if proxy_base_domain =~ /^#{appname}/ return proxy_base_domain end proxy_domains end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitized_app_name\n app_name.gsub(' ', '_').downcase\n end", "def sanitized_app_name\n application.gsub(' ', '_').downcase\n end", "def safe_app_name\n app_name.gsub(/[^a-zA-Z0-9_-]/, \"_\")\n end", "def subdomain\n ([self.short_name] + self.class.dalianshops.domain.split('.')[1..-1]).join('.')\n end", "def subdomain\n #for debug at localhost\n return self.class.system_top_domain if self.class.system_top_domain == 'localhost'\n short_name + '.' + self.class.system_top_domain\n end", "def heroku_appname(env)\n max_env_length = 10\n max_app_name_length = 30 - 2 - max_env_length - prefs[:heroku_app_prefix].length\n truncated_app_name = app_name.slice(0, max_app_name_length)\n [prefs[:heroku_app_prefix], truncated_app_name, env].join('-')\nend", "def app_name\n to_s.underscore\n end", "def subdomain\n self.name.gsub('_', '.')\n end", "def app_name\n @app_name ||= Rails.app_class.module_parent_name.demodulize.underscore.dasherize\n end", "def get_application_name\r\n root_info = get_rails_root_info\r\n root_info.split('/').last.capitalize\r\n end", "def resolve_domain\n domain = prompt(\"example.com\", \"Add domain where app will run (will be used in nginx configuration)\\n\")\n @app_config.write(\"domain\", domain)\n end", "def get_account_subdomain(request_host, app_host)\n if request_host =~ /(.*?)\\.?#{app_host}$/ && !($1.empty? || $1 == 'www')\n $1\n elsif APP_CONFIG[:restricted_names].include?(request_host.split('.').last)\n request_host\n else\n nil\n end\n end", "def change_app_name!\n end", "def module_app_name(name)\n name.split(\"_\").map!{|x| x.capitalize}.join\n end", "def app_name ; self.class.rootname.snake_case.to_sym ; end", "def domain_name(str)\n str = str.split('//')\n str = str[str.size - 1].split('.')\n str.delete('www')\n str[0]\nend", "def subdomain\n ([self.short_name] + self.class.admin_site.domain.split('.')[1..-1]).join('.')\n end", "def application_name\n Rails.root.to_s.split('/').last.underscore\n end", "def app_name\n Dir.pwd.split(\"/\").last.gsub(/\\./, \"_\")\n end", "def get_heroku_app_url(name)\n if @config[\"config\"][\"organization_domain\"]\n # Establishes a uniform prefix of http:// for whatever domain inputted\n domain_no_prefix = get_stripped_url(@config[\"config\"][\"organization_domain\"], true)\n \"http://#{domain_no_prefix}\"\n else\n # Gets domain from Heroku\n url_str = @cmd.run(\"heroku info #{name}\").out.lines[-1]\n url_str[url_str.rindex(' ')+1..-1].strip\n end\nend", "def fixup_url\n unless @view.app.url.starts_with?('http')\n unless @view.app.url.starts_with?('www')\n @view.app.url = 'www.' << @view.app.url\n end\n @view.app.url = 'http://' << @view.app.url\n end\n @view.app.url\n end", "def modify_application(app_name, namespace, public_hostname)\n end", "def downcase_subdomain\n self.subdomain.downcase! if attribute_present?('subdomain')\n end", "def fqdn\n \"#{to_label}.example.com\"\n end", "def cleanse_domain(domain)\n domain.downcase!\n domain = domain.sub(/^https?\\:\\/\\//, '').sub(/^www./,'')\n domain = domain.split(\"/\").first\n domain = domain.split(\"@\").last\n\n domain = PublicSuffix.parse(domain)\n domain = \"#{domain.sld}.#{domain.tld}\"\n domain\n end", "def apphelp_site_name\n t( :'uk.org.pond.canvass.site_name' )\n end", "def canonical_hostname(domain)\n # Allow hostname overrides\n return $override_dashboard if $override_dashboard && domain == 'studio.code.org'\n return $override_pegasus if $override_pegasus && domain == 'code.org'\n\n return \"#{name}.#{domain}\" if ['console', 'hoc-levels'].include?($node_name)\n return domain if $node_env == 'production'\n\n # our HTTPS wildcard certificate only supports *.code.org\n # 'env', 'studio.code.org' over https must resolve to 'env-studio.code.org' for non-prod environments\n sep = (domain.include?('.code.org')) ? '-' : '.'\n return \"localhost#{sep}#{domain}\" if $node_env == 'development'\n return \"translate#{sep}#{domain}\" if $node_name == 'crowdin'\n \"#{$node_env}#{sep}#{domain}\"\nend", "def default_account_subdomain\n\t\t'www'\n\tend", "def app_name\n if CurrentUser.safe_mode?\n \"Safebooru\"\n else\n \"Danbooru\"\n end\n end", "def app_name\n return @app_name\n end", "def app_name\n return @app_name\n end", "def canonical_cname(cname)\n # DNS host names are case-insensitive. Trim trailing dot(s).\n cname &&= cname.downcase.sub(/\\.*\\Z/, '')\n cname\n end", "def fqdn(gear_name = nil)\n \"#{gear_name || canonical_name}-#{domain_namespace}.#{Rails.configuration.openshift[:domain_suffix]}\"\n end", "def default_short_domain\n Fanforce::Base::DomainEnvironments.method(environment).call[:default_short_domain]\n end", "def name=(app_name)\n self.canonical_name = app_name.downcase\n super\n end", "def app_name\n Rails.application.class.to_s.split(\"::\").first\n end", "def normalize_domain(domain)\n return domain.downcase.gsub(/\\.$/,'')\n end", "def subdomain\n get()[\"app\"][\"subdomain\"]\n end", "def app_name\n @app_name || Sapience.app_name\n end", "def site_name\n\t\treturn get_configuration['sa_application_name']\n\tend", "def appname\n fetch(:capnotify_appname, \"\")\n end", "def lang2host(lang)\n\t\thost = request.host.split('.')\n\t\tunless host[-1].in? ['dev','io'] # don't touch development TLDs\n\t\t\tcase lang\n\t\t\twhen 'cn' then host[-1] = 'cn'\n\t\t\telse host[-1] = 'com'\n\t\t\tend\n\t\tend\n\t\thost.join('.')\n\tend", "def subdomain\n host.split(\".\").first\n end", "def guess_company_domain\n if self.company_domain.blank?\n string = self.company_name.to_s.downcase.gsub(' ', '') + \".fr\"\n self.company_domain = string\n end\n end", "def absolute_domain\n domain.end_with?(\".\") ? domain : \"#{domain}.\"\n end", "def domain_name(url)\n #url.gsub(/http:|https:|www.|\\/\\/|.com.*/,'')\n url.gsub(/http:|https:|www.|\\/\\//,'').split('.').first\nend", "def domain_name(url)\n url.gsub(\"www.\",\"\").split(\"//\")[1].split(\"/\")[0].split('.')[0]\nend", "def default_host\n primary_host = hosts.primary.first\n primary_host.blank? ? \"#{subdomain}.adaptapp.com\" : primary_host.hostname\n end", "def client_domain\n 'app.' + base_domain\n end", "def app_name\n c.application\n end", "def app_display_name\n return @app_display_name\n end", "def app_display_name\n return @app_display_name\n end", "def app_display_name\n return @app_display_name\n end", "def short\n return '' if name == domain.name\n return '' if name.blank?\n\n File.basename(name, \".#{domain.name}\")\n end", "def main_url\n if is_main?\n \"#{::AppConfig.main_protocol}#{self.subdomain}.#{::AppConfig.main_domain}\"\n else\n \"#{::AppConfig.main_protocol}#{self.main_company.subdomain}.#{::AppConfig.main_domain}\"\n end\n end", "def deduce_tenant_host\n if request.host.downcase.start_with?('www.')\n request.host[4..-1]\n else\n request.host\n end\n end", "def appname\n @appname = \"Jazzify\"\n end", "def app_name # :nodoc:\n app_cls = Rails.application.class\n parent = begin\n # Rails 6.1+\n app_cls.module_parent_name\n rescue NoMethodError\n app_cls.parent.to_s\n end\n parent.underscore\n end", "def hyperdomain_prefix(url)\n hyperdomains = target.config.hyper_domaining\n index = url.hash % hyperdomains.length\n\n return \"#{hyperdomains[index]}\"\n end", "def developer_domain\n 'developer.' + base_domain\n end", "def canonical_tld?; end", "def normalized_host\n # Remove trailing '.' characters\n host.sub(/\\.*$/, '').downcase if host\n end", "def replace_heroku_domain(permalink_url, custom_domain)\n if permalink_url.include?(\"http://inuni-blog.herokuapp.com\") \n return custom_domain + permalink_url.split(\"http://inuni-blog.herokuapp.com\")[1] \n elsif permalink_url.include?(\"http://localhost:3000\")\n return custom_domain + permalink_url.split(\"http://localhost:3000\")[1]\n else\n return permalink_url\n end \nend", "def app_name\n t('descriptions.product_name').remove(' ')\n end", "def app_company\n 'BarkerEST'\n end", "def website_domain\n 'www.' + base_domain\n end", "def app_name\n return File.basename(File.expand_path(root)).freeze\n end", "def sexy_app_name\n # puts \"gml_application=#{gml_application.inspect} application=#{application.inspect}\"\n (!application.blank? && application) || (!gml_application.blank? && gml_application) || ''\n end", "def app_name\n @app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root)\n end", "def appname\n fetch(:appname) || script_name\n end", "def app_name\n ApplicationService.application_name\n end", "def fix_hostname_in_response_url\n self.padlet_url.gsub!(/.*padlet\\.com/, \"http://#{PadletWrapper.hostname}\")\n end", "def normalize_email_address email_address\n email_address.downcase.sub(/swan\\.ac\\.uk/,'swansea.ac.uk')\nend", "def app_name\n @@app_name\n end", "def app_name\n Rucola::InfoPlist.open((RUBYCOCOA_ROOT + 'config/Info.plist').to_s).app_name\n end", "def app_name_slogan\n \"#{app_name} - #{slogan}\"\n end", "def server_name\n \"#{fetch(:application)}.richardwigley.co.uk\"\nend", "def domain_name(url)\n return nil unless url\n if m=url.match(/([^.\\/ ]+)\\.(com|net|info|org|name|biz|gov|\\w\\w)(\\.\\w+)?(\\/.*)*(\\?.*)*$/)\n \"#{m[1]}.#{m[2]}\"\n else\n url\n end\n end", "def unobtrusive_flash_domain\n if request.host =~ /\\.herokuapp\\.com$/ || request.host =~ /\\.amazonaws\\.com$/\n request.host\n else\n :all\n end\n end", "def domain_name(url)\n url.gsub(/http(s)?:\\/\\/(www.)?/, '').match(/[^.]+/)[0]\nend", "def app_name=(value)\n @app_name = value\n end", "def app_name=(value)\n @app_name = value\n end", "def heroku_git_domain\n suffix = %x{ git config heroku.account }\n suffix = \"com\" if suffix.nil? or suffix.strip == \"\"\n \"heroku.#{suffix.strip}\"\n end", "def app_name_on_heroku(string)\n app_name, env = string.split(SEPARATOR)\n apps[app_name][env]\n end", "def parse_remote_app_name\n @remote_app_name ||= parse_pushand(\".pushand\")\n end", "def set_name\n @appname = \"Bike London\"\n end", "def build_domain_name(env)\n config = env[:machine].provider_config\n domain_name =\n if config.default_prefix.nil?\n env[:root_path].basename.to_s.dup.concat('_')\n elsif config.default_prefix.empty?\n # don't have any prefix, not even \"_\"\n String.new\n else\n config.default_prefix.to_s.dup\n end\n domain_name << env[:machine].name.to_s\n domain_name.gsub!(/[^-a-z0-9_\\.]/i, '')\n domain_name << \"_#{Time.now.utc.to_i}_#{SecureRandom.hex(10)}\" if config.random_hostname\n domain_name\n end", "def www\n \"www.#{domain}\"\n end", "def configure_app_name(files)\n files.each do |file|\n gsub_file file, /<%= app_name %>/, app_name\n end\n end", "def host_without_subdomain\n parts = request.host_with_port.split('.').last(2)\n parts.join('.')\n end", "def app_name\n 'BarkerEST'\n end", "def clean_name\n global? ? registry.hostname : name\n end", "def clean_name\n global? ? registry.hostname : name\n end", "def domain\n unless @domain\n if defined? ActiveSupport::CoreExtensions::String::Inflections\n @domain = name.tableize\n else\n @domain = name.downcase\n end\n end\n @domain\n end", "def normalize(domain)\n domain = domain.chomp(DOT).unicode_normalize(:nfc) unless domain.ascii_only?\n Punycode.encode_hostname(domain).downcase\n end", "def homeserver_suffix\n \":#{homeserver}\" if domain\n end", "def homeserver_suffix\n \":#{homeserver}\" if domain\n end", "def parse_user_domain(hostname)\n return hostname.split('.').first if Rails.configuration.url_host.empty?\n Rails.configuration.url_host.split(',').each do |url_host|\n return hostname.chomp(url_host).chomp('.') if hostname.include?(url_host)\n end\n ''\n end", "def app_root_for app, version\n\t\t\t\"#{Nacreon::Config.deploy_root}/#{app.name}/#{version.name}\"\n\t\tend", "def get_url_domain\n uri = URI.parse(url)\n host = uri.host.downcase\n host.start_with?('www.') ? host[4..-1] : host\n end" ]
[ "0.738992", "0.7350941", "0.6876867", "0.667217", "0.6657035", "0.6636623", "0.6589322", "0.65572685", "0.65468764", "0.648841", "0.6462511", "0.64286095", "0.6367601", "0.6339413", "0.63339216", "0.63218164", "0.62802386", "0.6254827", "0.6251783", "0.62161", "0.6151194", "0.6140232", "0.6111323", "0.6108551", "0.6099833", "0.608874", "0.60821956", "0.60616463", "0.60473776", "0.60411423", "0.60411423", "0.6036917", "0.6034113", "0.6026587", "0.60261345", "0.6022954", "0.5999912", "0.59805435", "0.5979804", "0.5965701", "0.5957303", "0.59024197", "0.58989435", "0.58973265", "0.58911645", "0.58910143", "0.5888254", "0.5884688", "0.5868548", "0.5868192", "0.58544147", "0.58544147", "0.58544147", "0.58483535", "0.58479553", "0.5840585", "0.5833462", "0.5827654", "0.58255255", "0.5823266", "0.5790793", "0.5789767", "0.5785777", "0.57853186", "0.5776995", "0.57711595", "0.5767626", "0.5749914", "0.57461476", "0.57426757", "0.5736293", "0.57230055", "0.57196087", "0.57129765", "0.57096165", "0.5707987", "0.56990165", "0.56985414", "0.56838614", "0.56673104", "0.566196", "0.566196", "0.56590134", "0.5655064", "0.56520987", "0.5644999", "0.56439704", "0.5636222", "0.563523", "0.56336844", "0.5631378", "0.56296676", "0.56296676", "0.5618917", "0.560537", "0.56016845", "0.56016845", "0.5601416", "0.55963963", "0.5586125" ]
0.619268
20
Confirms the correct user.
def correct_user @user = User.find(params[:id]) redirect_to(root_url) unless current_user?(@user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end", "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend", "def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end", "def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end", "def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end", "def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end", "def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end", "def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end", "def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user_help?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end", "def correct_user\n if !is_correct_user\n redirect_to incorrect_user_path_for\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Please don't mess with others' profiles!\"\n # redirect_to root_url\n redirect_to @user\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end", "def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend", "def correct_user\n unless @user == current_user\n redirect_to user_notes_path(current_user)\n end\n end", "def correct_user\n redirect_to(root_url) unless @user == current_user\n end", "def confirm_with_user\n confirmed = Helper::Util.confirm \"Is this OK? \", true\n return if confirmed\n\n loop do\n Helper::Util.clear\n\n print_identification\n\n say \"<%= color('The following options may be adjusted before continuing.', BOLD) %>\"\n choice = choose do |menu|\n self.class.available_options.reject(&:skip_confirmation).each do |option|\n value = send option.confirm_symbol\n menu.choice \"#{option.label}: #{option.display_value(value)}\"\n end\n\n menu.choice \"Accept and continue\"\n menu.choice \"Quit\"\n menu.readline = true\n menu.prompt = \"What would you like to do?\"\n end\n\n Helper::Util.clear\n\n print_identification\n\n if (option = self.class.available_options.find { |o| choice =~ /^#{Regexp.quote(o.label)}/ })\n loop do\n break if prompt_for_option(option)\n say \"Invalid value for option.\\n\\n\"\n end\n elsif choice =~ /^Accept/\n log\n return\n else\n exit(0)\n end\n end\n end", "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end", "def correct_user(user)\n user == current_user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend", "def correct_user\n @user = HoacUser.find(params[:id])\n redirect_to(edit_hoac_user_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end", "def correct_user\n user_id = params[:user_id] || params[:id] || session[:user_id]\n @user = User.find_by(id: user_id)\n unless @user.nil?\n unless current_user?(@user) || current_user.administrator?\n flash[:danger] = \"Only the account owner or an adminstrator to do that.\"\n redirect_to(root_path)\n end\n else\n nonexistent_user_error\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:user_id])\n unless current_user?(@user)\n flash[:danger] = \"You don't have permission for that action.\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n logger.debug \"***correct_user - Detected User - #{@user.name}\"\n redirect_to(root_url) unless current_user?(@user) || admin_user\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end", "def correct_user\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_url, notice: \"You do not have permission to view or edit this information because it isn't yours.\" unless current_user?(@user)\n end", "def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end" ]
[ "0.7474727", "0.73414856", "0.73176336", "0.7183247", "0.71750194", "0.705034", "0.7012752", "0.7011754", "0.7006919", "0.70057875", "0.70035315", "0.6966616", "0.6913424", "0.6911236", "0.69037426", "0.68929136", "0.6844362", "0.6843171", "0.68401915", "0.68352634", "0.68265426", "0.6823926", "0.6811928", "0.6801258", "0.679937", "0.6793733", "0.6779026", "0.67669207", "0.67422676", "0.67411923", "0.6741162", "0.67369705", "0.67369705", "0.67369705", "0.67369705", "0.67369705", "0.67369705", "0.67369705", "0.67369705", "0.67369705", "0.67330515", "0.67286086", "0.6725004", "0.6723909", "0.6721372", "0.6721372", "0.6721372", "0.6721372", "0.6721372", "0.6721372", "0.6721372", "0.6721372", "0.6721177", "0.671572", "0.671218", "0.66842717", "0.66766816", "0.6666027", "0.66632396", "0.66632396", "0.66632396", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6658762", "0.6653659", "0.66536057", "0.6651736", "0.6648704", "0.6643693" ]
0.0
-1
Checks more licenses are available
def moreLicenses unless current_user.clearance>=2&&current_user.organization.numLicenses-current_user.organization.users.length+1>=3 store_location redirect_to current_user end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_license()\n return true\n end", "def validate_license_info\n # First check the project licensing information\n\n # Check existence of licensing information\n if project.license == \"Unspecified\"\n licensing_warning(\"Project '#{project.name}' does not contain licensing information.\")\n end\n\n # Check license file exists\n if project.license != \"Unspecified\" && project.license_file.nil?\n licensing_warning(\"Project '#{project.name}' does not point to a license file.\")\n end\n\n # Check used license is a standard license\n if project.license != \"Unspecified\" && !STANDARD_LICENSES.include?(project.license)\n licensing_info(\"Project '#{project.name}' is using '#{project.license}' which is not one of the standard licenses identified in https://opensource.org/licenses/alphabetical. Consider using one of the standard licenses.\")\n end\n\n # Now let's check the licensing info for software components\n license_map.each do |software_name, license_info|\n # First check if the software specified a license\n if license_info[:license] == \"Unspecified\"\n licensing_warning(\"Software '#{software_name}' does not contain licensing information.\")\n end\n\n # Check if the software specifies any license files\n if license_info[:license] != \"Unspecified\" && license_info[:license_files].empty?\n licensing_warning(\"Software '#{software_name}' does not point to any license files.\")\n end\n\n # Check if the software license is one of the standard licenses\n if license_info[:license] != \"Unspecified\" && !STANDARD_LICENSES.include?(license_info[:license])\n licensing_info(\"Software '#{software_name}' uses license '#{license_info[:license]}' which is not one of the standard licenses identified in https://opensource.org/licenses/alphabetical. Consider using one of the standard licenses.\")\n end\n end\n end", "def licenses\n @licenses ||= []\n end", "def has_license?\n !license.nil?\n end", "def check_redhat_licenses(nodes=nil)\n timeout = Astute.config[:REDHAT_GET_LICENSES_POOL_TIMEOUT]\n get_redhat_licenses_cmd = 'get_redhat_licenses ' + \\\n \"#{@username} \" + \\\n \"#{@password}\"\n\n response = exec_cmd_with_timeout(get_redhat_licenses_cmd, timeout, @network_error)\n\n licenses_count = nil\n begin\n licenses_pool = JSON.load(response.results[:data][:stdout])\n licenses_count = licenses_pool['openstack_licenses_physical_hosts_count']\n rescue JSON::ParserError\n report(response.results[:data])\n\n return\n end\n\n if licenses_count <= 0\n report_error(@user_does_not_have_licenses)\n elsif nodes && licenses_count < nodes.count\n report_success(format(@not_enough_licenses, licenses_count))\n else\n report_success\n end\n end", "def licenses\n data[:licenses]\n end", "def accepted_agreement?\n return license != DEFAULT_LICENSE\n end", "def potential_licenses\n @potential_licenses ||= begin\n Licensee.licenses(hidden: true).select do |license|\n if license.creative_commons? && file.potential_false_positive?\n false\n else\n license.wordset && license.length_delta(file) <= license.max_delta\n end\n end\n end\n end", "def licenses *names\n names.to_strings.each do |name| \n begin\n module_name = \"#{name.camelize}License\"\n clazz = module_name.constantize\n clazz.new(self).enforce!\n rescue\n raise \"License #{module_name} not found\"\n end\n end\n end", "def invalid_license\n validate_values('license', :valid_licenses)\n end", "def check_if_stolen\n unless license_number != \"1111111\"\n errors.add(:license_number, \"is stolen\")\n end\n end", "def licensing?\n @config[:licensing].present? and licensing.present?\n end", "def licensed?\n end", "def licenses *names\n names.to_strings.each do |name| \n begin\n module_name = \"#{name.camelize}License\"\n clazz = module_name.constantize\n rescue\n raise \"License #{module_name} is not defined\"\n end\n\n begin\n clazz.new(self).enforce!\n rescue\n raise \"License #{clazz} could not be enforced using #{self.inspect}\"\n end\n end\n end", "def license_allows_download?(document)\n document[:license_ss] =~ /(Creative Commons|No known restrictions)/\n end", "def invalid_license\n validate_values(:license, :valid_licenses)\n end", "def valid_es_license?(license)\n license.fetch(\"license\", {}).fetch(\"status\", nil) == \"active\"\n end", "def appropriate_license?(pool, url)\n return true if pool.serverless?\n\n license = extract_license(pool.get_license(url))\n case license_status(license)\n when 'active'\n true\n when nil\n warn_no_license(url)\n false\n else # 'invalid', 'expired'\n warn_invalid_license(url, license)\n true\n end\n end", "def licensed_by?(context)\n if context.guest?\n false\n else\n accepted_licenses.exists?(user_id: context.user_id, state: [nil, 'active'])\n end\n end", "def accept_licenses\n license_ids = unsafe_params[\"license_ids\"]\n fail \"License license_ids needs to be an Array of Integers\" unless license_ids.is_a?(Array) && license_ids.all? do |license_id|\n license_id.is_a?(Numeric) && (license_id.to_i == license_id)\n end && !license_ids.empty?\n license_ids.uniq!\n fail \"Some license_ids do not exist\" unless License.where(id: license_ids).count == license_ids.count\n\n AcceptedLicense.transaction do\n license_ids.each do |license_id|\n AcceptedLicense.find_or_create_by(license_id: license_id, user_id: @context.user_id)\n end\n end\n\n render json: { accepted_licenses: license_ids }\n end", "def licenses(options = {})\n Licensee::License.all(options)\n end", "def licensed?\n page = Nokogiri::HTML(open(manga_url))\n\n # if there is no match then unlicensed! yay!\n match = page.xpath(MANGA_LICENSED_XPATH).children[0].to_s\n return false if match.nil?\n match.include?(\"licensed\")\n end", "def licenses(top, output_file = nil, prv_release = nil, cur_release = nil)\n api_licenses = CLicenseModuleInfo.new(top, \"MESA\")\n\n license_options = Hash.new()\n license_options[:release_version_prv] = prv_release\n license_options[:release_version_cur] = cur_release\n\n license_options[:hdr_pre] = \"This file provides a summary of the licenses included in or used by the MESA\\n\"\n license_options[:hdr_pre] += \"sources, along with the raw licenses for each package.\\n\"\n license_options[:hdr_pre] += \"\\n\"\n license_options[:hdr_pre] += \"Notice: The MESA package includes pre-built binary firmware images. These\\n\"\n license_options[:hdr_pre] += \" images consist of the binary MESA artifacts appended to a BSP.\\n\"\n license_options[:hdr_pre] += \" The combined set of licenses for these images can be found in\\n\"\n license_options[:hdr_pre] += \" ./bin/<preset>/licenses.txt\\n\"\n license_options[:hdr_pre] += \"\\n\"\n\n license_options[:hdr_post] = \"\\n\"\n license_options[:hdr_post] += \"To obtain the source, please contact sales/marketing\\n\\n\"\n license_options[:hdr_post] += \"\\n\"\n\n licenses = CLicenseCollection.new(\"MESA\", license_options)\n licenses.concat(api_licenses)\n if output_file\n File.open(output_file, \"w\") do |lic|\n licenses.write(lic)\n end\n else\n licenses.write()\n end\nend", "def has_correct_license_key?\n has_license_key? && correct_license_length\n end", "def licenses\n if @licenses.nil?\n @licenses = self.links.select do |link|\n link.rel == \"license\"\n end\n end\n return @licenses\n end", "def should_load_nz_licenses\n assert_difference 'License.count', 4 do\n License.import_from_yaml('nz_default_creative_commons_licenses.yml', false)\n end\n end", "def _validate_license(l)\n type = l[:type]\n file = l[:file]\n if type.nil?\n results.add_warning('license', 'Missing license type.')\n end\n if type && type.delete(' ').delete(\"\\n\").empty?\n results.add_warning('license', 'Invalid license type.')\n end\n if type && type =~ /\\(example\\)/\n results.add_error('license', 'Sample license type.')\n end\n if file && Pathname.new(file).extname !~ /^(\\.(txt|md|markdown|))?$/i\n results.add_error('license', 'Invalid file type')\n end\n end", "def licenses\n licenses = []\n uris = metadata[dataset_uri][dct.license.to_s]\n if uris.nil?\n []\n else\n uris.each do |uri|\n l = metadata[uri]\n licenses << License.new(:uri => uri, :name => l[dct.title.to_s])\n end\n return licenses\n end\n rescue\n []\n end", "def licenses=(licenses)\n @licenses = Array licenses\n end", "def appropriate_license?(pool, url)\n return true if oss?\n\n license = pool.get_license(url)\n if valid_es_license?(license)\n true\n else\n # As this version is to be shipped with Logstash 7.x we won't mark the connection as unlicensed\n #\n # @logger.error(\"Cannot connect to the Elasticsearch cluster configured in the Elasticsearch output. Logstash requires the default distribution of Elasticsearch. Please update to the default distribution of Elasticsearch for full access to all free features, or switch to the OSS distribution of Logstash.\", :url => url.sanitized.to_s)\n # meta[:state] = :unlicensed\n #\n # Instead we'll log a deprecation warning and mark it as alive:\n #\n log_license_deprecation_warn(url)\n true\n end\n end", "def add_licenses\n return @add_licenses\n end", "def check_for_installed_software_only\n check_all_installed @options\n end", "def licenses=(new_licenses)\n @licenses = new_licenses\n end", "def complete_licenses\n License.selectable\n .sort_by(&:identifier)\n .map { |license| [\"#{license.identifier} (#{license.name})\", license.id] }\n end", "def check_for_release\n\t \tcheck_count = 0\n\t \tmax_checks = configatron.lending_club.max_checks\n\t \tstarting_loan_list_size = fresh_loan_list.values[1].size\n\t \tputs \"starting_loan_list_size: #{starting_loan_list_size}\"\n\t \twhile check_count < max_checks\n\t \t\tcheck_count = check_count + 1\n\t \t\tputs \"check_for_release #{check_count}\"\n\t \t\tcurrent_loan_list_size = fresh_loan_list.values[1].size\n\t \t\tputs \"current_loan_list_size: #{current_loan_list_size}\"\n\t \t\tif current_loan_list_size > starting_loan_list_size \n\t \t\t\tputs \"Loans have been released. Preparing to purchasing loans.\"\n\t \t\t\[email protected]_line(\"Pre-Filtered Loan Count: #{current_loan_list_size}\")\n\t \t\t\treturn true\n\t \t\tend\n\t \t\tputs \"Pre-Filtered Loan Count: #{current_loan_list_size}\"\n\t \t\tsleep(1) # wait X seconds before checking again\n\t \tend\n\t \[email protected]_line(\"After #{check_count} checks the number of available loans remained at or below #{starting_loan_list_size}.\")\n\t \treturn false\n\t end", "def add_licenses=(value)\n @add_licenses = value\n end", "def licenses=(licenses)\n @licenses = [licenses].flatten\n end", "def license_status?(user, status)\n accepted_licenses.exists?(user_id: user.id, state: [nil, status])\n end", "def upload_licenses\n \n end", "def index\n if params[:software_id] then\n @licenses = current_user.licenses.where(:software_id => params[:software_id]) \n else\n @licenses = current_user.licenses.all\n end\n end", "def licenses\r\n LicensesController.instance\r\n end", "def prompt_for_license(resource, versioned_resource)\n license = Seek::License.find(versioned_resource.license)\n return unless (license.nil? || license.is_null_license?) && resource.can_manage?\n content_tag(:hr) +\n content_tag(:p) do\n link_to('Click here to choose a license', polymorphic_path(resource, action: :edit, anchor: 'license-section'))\n end\n end", "def license_evaluation\n require_license_params\n\n create_metric(\n @cookbook_version,\n QualityMetric.license_metric,\n params[:license_failure],\n params[:license_feedback]\n )\n\n head 200\n end", "def remove_licenses\n return @remove_licenses\n end", "def uk_driving_licence(*args); end", "def customized_licenses\n @research_output.plan.template.licenses.map { |license| [\"#{license.identifier} (#{license.name})\", license.id] }\n end", "def no_remote_instructions(unlicensed)\n puts <<-INST\nThere is no license defined for #{counter(unlicensed)}. You are running with the `--disable-api`\noption. If you remove this option, gemterms will attempt to use RubyGems and \nother sources for license information.\nINST\n true\n end", "def can_rent_truck?\n !license.expired? && age >= 60 && license.to_drive_truck?\n end", "def list_licenses\n check_scope!\n licenses = License.\n editable_by(@context).\n eager_load(user: :org).\n includes(:taggings).\n order(:title)\n\n licenses = licenses.where(scope: params[:scopes]) if params[:scopes].present?\n\n render json: licenses, root: \"licenses\", adapter: :json\n end", "def retrieve_license(url)\n (@licenses ||= {})[url] ||= Net::HTTP.get(URI(url))\n end", "def check_rbs_availability!; end", "def enable_auto_project_license?\n resource_for_controller.try(:new_record?) && logged_in_and_registered? &&\n default_license_for_current_user\n end", "def check_book_availability\n if self.book.book_copies.unassigned_copies.where(is_active: true).count < 1\n errors.add(:base, \"Book out of stock\")\n end\n end", "def northern_irish_driving_licence; end", "def license_items\n license_id = unsafe_params[\"license_id\"]\n unless license_id.is_a?(Numeric) && (license_id.to_i == license_id) ||\n license_id.is_a?(String) && license_id.to_i.positive?\n raise \"License license_id needs to be an Integer\"\n end\n\n # Check if the license exists and is editable by the user. Throw 404 if otherwise.\n License.editable_by(@context).find(license_id)\n\n items_to_license = unsafe_params[\"items_to_license\"]\n if items_to_license.is_a?(String)\n items_to_license = [items_to_license]\n elsif items_to_license.is_a?(Array) && items_to_license.any? { |item| item.is_a?(String) }\n raise \"License items_o_license needs to be an Array of Strings\"\n end\n\n items_licensed = []\n LicensedItem.transaction do\n items_to_license.each do |item_uid|\n item = item_from_uid(item_uid)\n if item.editable_by?(@context) && %w(asset file).include?(item.klass)\n items_licensed << LicensedItem.find_or_create_by(license_id: license_id,\n licenseable: item).id\n end\n end\n end\n\n render json: { license_id: license_id, items_licensed: items_licensed }\n end", "def available?(count = 1)\n headers, params = build_request_data(count) do |config, headers, hshstr|\n [config.api_version.to_s, Digest::SHA1.hexdigest(hshstr), count.to_s]\n end\n urlstr = generate_url('/%s/coupons/available.json?hash=%s&count=%s', params)\n JSON.parse(RestClient.get(urlstr, headers))[\"status\"] == 0\n end", "def is_available?\n count_available > 0\n end", "def validate_license_file\n msg_delim = '***************************************************'\n\n contact_msg = <<-END\n\n#{msg_delim}\n\nChef Delivery requires a valid license to run.\nTo acquire a license, please contact your CHEF\naccount representative.\n\n END\n\n fail \"#{contact_msg}Please set `#{node['delivery-cluster']['delivery']['license_file']}`\\n\" \\\n \"in your environment file.\\n\\n#{msg_delim}\" if node['delivery-cluster']['delivery']['license_file'].nil?\n end", "def recheck_available\n update_attribute(:available, true) if\n documents.present? || subjects.present? || folders.present?\n end", "def correct_license_length\n key = Agent.config[:license_key]\n\n if key.length == 40\n true\n else\n ::NewRelic::Agent.logger.error(\"Invalid license key: #{key}\")\n false\n end\n end", "def licenses_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OtherApi.licenses_list ...\"\n end\n # resource path\n local_var_path = \"/licenses\"\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'Array<License>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OtherApi#licenses_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def license=(o)\n self.licenses = [o]\n end", "def with_licenses(licenses)\n @licenses.concat licenses\n self\n end", "def license\n licenses.first\n end", "def multiplex_be_under_license_number\r\n\r\n\t\tsql = <<-'EOL'\r\n\t\t\twith\r\n\t\t\t\tranges as (\r\n\t\t\t\t\tselect *\r\n\t\t\t\t\t\tfrom reservations\r\n\t\t\t\t\t\twhere ? <= end_date and start_date <= ? and id <> ?\r\n\t\t\t\t),\r\n\t\t\t\tpoints as (\r\n\t\t\t\t\tselect distinct start_date as date from ranges\r\n\t\t\t\t\tunion\r\n\t\t\t\t\tselect distinct end_date as date from ranges\r\n\t\t\t\t)\r\n\t\t\tselect max(v) as num from (\r\n\t\t\t\tselect count(*) as v\r\n\t\t\t\t\tfrom points,ranges\r\n\t\t\t\t\twhere points.date between ranges.start_date and ranges.end_date\r\n\t\t\t\t\tgroup by points.date\r\n\t\t\t);\r\n\t\tEOL\r\n\r\n\t\tid_not_null = id || -1 # dirty hack NULL回避\r\n\t\tin_use = Reservation.find_by_sql([sql,start_date,end_date,id_not_null]).first.num\r\n\r\n\t\tif !in_use.nil? && in_use >= 2\r\n\t\t\terrors.add(:hoge,\"対象期間中は既に#{in_use}件の利用があります。dynaTraceの最大同時利用システム数は2件です。\")\r\n\t\tend\r\n\tend", "def legal_terms_acceptance_on!\n @legal_terms_acceptance = true\n end", "def license_files\n @license_files ||= []\n end", "def has_license_key?\n if Agent.config[:license_key] && Agent.config[:license_key].length > 0\n true\n else\n ::NewRelic::Agent.logger.warn('No license key found. ' +\n 'This often means your newrelic.yml file was not found, or it lacks a section for the running ' \\\n \"environment, '#{NewRelic::Control.instance.env}'. You may also want to try linting your newrelic.yml \" \\\n 'to ensure it is valid YML.')\n false\n end\n end", "def CheckAvailable(gedit)\n\tif gedit.versionNumber()<1.29\n\t\tputs \"This script requires GEDitCOM II, Version 1.3 or newer.\"\n\t\treturn 0\n\telsif gedit.documents().count()<1\n\t\tprint \"You have to open a document in GEDitCOM II to use this script\"\n\t\treturn 0\n\tend\n\treturn 1\nend", "def available?\n self.available_product_supplies.length > 0 and not self.delete?\n end", "def shares_available_for_purchase?\n if Stock.all.find_by(id: trade.stock_id).shares_available < trade.num_shares\n return false\n else\n return true\n end\n end", "def index\n @licenses = License.all\n end", "def index\n @licenses = License.all\n end", "def airframes_available\n if self.creator && self.creator.over_airframes_quota?\n self.errors.add :base, \"Please <a href='/profile'>upgrade your account</a> to create more aircraft.\"\n end\n end", "def index\n @licenses = License.page(params[:page]).per(10)\n end", "def renewal_or_review_mandatory?\n existing_agreement? && waste_producer_water_discount?\n end", "def return_resources(user_group, desktop_license, desktop_quota, server_license, server_quota)\n wait_until_bus_section_load\n return_group_select.select(user_group) unless user_group.nil?\n wait_until_bus_section_load\n server_license_tb.type_text(server_license) unless server_license.nil?\n server_quota_tb.type_text(server_quota) unless server_quota.nil?\n desktop_license_tb.type_text(desktop_license) unless desktop_license.nil?\n desktop_quota_tb.type_text(desktop_quota) unless desktop_quota.nil?\n continue_btn.click\n end", "def licenses\n publisher_id = current_user.id\n @licenses = PowerChip.where(:publisher_id=>publisher_id)\n respond_to do |format|\n format.html # licenses.html.erb\n format.json { render json: @licenses }\n end\n end", "def preferred_licenses\n License.preferred.map { |license| [\"#{license.identifier} (#{license.name})\", license.id] }\n end", "def validate_driving_license_number?\n if !:driving_licence_number.nil? && :driving_license_state.nil?\n errors.add(\"You must provide the state of issue of your driving license\")\n end\n end", "def index\n @diriving_licenses = DirivingLicense.all\n end", "def supports_device_licensing\n return @supports_device_licensing\n end", "def available; end", "def available; end", "def manga_available?\n return false if licensed?\n [email protected]?\n end", "def no_of_commercial_supporters\n @commercial_sources.length\n end", "def license name\n self.licenses << name.to_s\n end", "def can_add_course?\n self.available_courses > 0 || self.clearance?\n end", "def has_own_providers?\n if is_reseller?\n common_use_provider_count > 0\n else\n raise \"User is not reseller, he cannot have providers\"\n end\n end", "def has_resources_for?(price)\r\n return true if @organisation.limit.nil? || @organisation.is_admin?(@user)\r\n\r\n resources = @organisation.limit - (@spend + price)\r\n resources > 0\r\n end", "def check_access\n permission_denied unless can_census?(year)\n end", "def check_for_requirements; end", "def check_buyable\n raise PermissionDeniedError, \"出品したアイテムはサポートできません\" if @item.owner?(current_user)\n end", "def license\n @licenses.first\n end", "def remove_licenses=(value)\n @remove_licenses = value\n end", "def has_valid_releases?\n @releases = scm_connection.releases(full_name) || []\n if @releases.empty? || @releases.kind_of?(ErrorExchange)\n spin_log('[ERROR] The Spin should have at least a release, please add it to the source control and refresh the Spin')\n else\n spin_log('[OK] The Spin has releases')\n return true\n end\n false\n end", "def license_url\n case self.license\n when \"cc-by-sa-3.0\"\n \"http://creativecommons.org/licenses/by-sa/3.0/\"\n when \"cc-by-nc-sa-2.0-uk\"\n \"http://creativecommons.org/licenses/by-nc-sa/2.0/uk\"\n end\n end", "def index \n @sims_biga_licenses = SimsBigaLicense.order(cnh_pes_id: :asc).page(params[:page]).per(20) \n authorize @sims_biga_licenses \n end", "def index\n if current_user.user_type==0\n @distributor_licenses = DistributorLicense.where(:approved => 0)\n elsif current_user.user_type == 2\n @distributor_licenses = DistributorLicense.where(:user_id => current_user.id)\n else\n redirect_to \"/\"\n end\n end", "def check_multiple_courses\n \n end" ]
[ "0.73579264", "0.7127158", "0.6927624", "0.68518174", "0.6771183", "0.65903586", "0.6578795", "0.6572097", "0.6542428", "0.65185803", "0.6499136", "0.6475447", "0.6465352", "0.6452822", "0.641776", "0.64027387", "0.63427246", "0.63095415", "0.6287338", "0.62574804", "0.6235049", "0.6188758", "0.6181138", "0.6176063", "0.61696976", "0.61590505", "0.6126637", "0.6117236", "0.6088805", "0.6084979", "0.6078379", "0.60555625", "0.60335547", "0.60274464", "0.59802353", "0.5932391", "0.58411545", "0.5831112", "0.5821878", "0.5812193", "0.58066326", "0.57984734", "0.5784595", "0.57837874", "0.57825464", "0.57555884", "0.5721767", "0.57099044", "0.5706593", "0.5703069", "0.5697297", "0.5697221", "0.56929374", "0.5660089", "0.5655652", "0.564938", "0.5640335", "0.5638799", "0.5624882", "0.5605344", "0.55969626", "0.55948037", "0.5585209", "0.5582269", "0.558208", "0.5577065", "0.5571047", "0.555821", "0.5553149", "0.5537387", "0.5531143", "0.55288017", "0.55288017", "0.5520956", "0.5509468", "0.5498141", "0.5483396", "0.5479264", "0.5461198", "0.5459222", "0.5453135", "0.54495525", "0.54473996", "0.54473996", "0.5414414", "0.5405986", "0.5405866", "0.53989106", "0.5398189", "0.53943443", "0.5393102", "0.53883106", "0.53823763", "0.5373536", "0.5372006", "0.53605556", "0.5357512", "0.5345503", "0.5338529", "0.5334688" ]
0.7096969
2
Not converted to the new system since this will be refactored a lot
def serialize(biome) name = biome.fetch('DisplayName', biome.name) color = biome.color('Color', '#000000') bg_color = biome.color('BackgroundColor', '#000000') symbol = biome.symbol('Symbol', 0) height = biome.fetch('Height', '0 0').split(' ').map{|x| x.strip.to_i} temperature = biome.fetch('Temperature', '0 1000').split(' ').map{|x| x.strip.to_i} rain = biome.fetch('Rain', '0 1000').split(' ').map{|x| x.strip.to_i} drainage = biome.fetch('Drainage', '0 1000').split(' ').map{|x| x.strip.to_i} layer_top = biome.ref(:material, 'LayerTop', 'Air') layer_middle = biome.ref(:material, 'LayerMiddle', 'Air') layer_bottom = biome.ref(:material, 'LayerBottom', 'Air') noise_amplitude = biome.integer('NoiseAmplitude', 20) noise_power = biome.fetch('NoisePower', '1.0').to_f tree_density = biome.fetch('TreeDensity', '0').to_i tree_tile, tree_mat = tile_pair(biome.fetch('TreeType', 'Nothing:Air')) flags = 0 flags |= (biome.boolean('NoEmbark') ? 0x01 : 0) emit(biome.id, 'S<') emit([name.size, name], 'S<a*') emit(color, 'C3') emit(bg_color, 'C3') emit(symbol, 'S<') emit(height, 'S<2') emit(temperature, 'S<2') emit(rain, 'S<2') emit(drainage, 'S<2') emit(layer_top, 'C') emit(layer_middle, 'C') emit(layer_bottom, 'C') emit(noise_amplitude, 'C') emit(noise_power, 'F') emit(tree_density, 'S<') emit(tree_tile, 'C') emit(tree_mat, 'C') emit(flags, 'S<') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def implementation; end", "def implementation; end", "def custom; end", "def custom; end", "def intensifier; end", "def formation; end", "def operations; end", "def operations; end", "def suivre; end", "def refutal()\n end", "def internal; end", "def terpene; end", "def anchored; end", "def transformations; end", "def verdi; end", "def wrapper; end", "def identify; end", "def stderrs; end", "def processor; end", "def villian; end", "def weber; end", "def trd; end", "def berlioz; end", "def who_we_are\r\n end", "def strategy; end", "def common\n \n end", "def jack_handey; end", "def from; end", "def from; end", "def from; end", "def from; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def extra; end", "def transforms; end", "def operation; end", "def reflector; end", "def reflector; end", "def user_os_complex\r\n end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def isolated; end", "def isolated; end", "def original_result; end", "def sitemaps; end", "def transform; end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def celebration; end", "def offences_by; end", "def schumann; end", "def overrides; end", "def zuruecksetzen()\n end", "def loc; end", "def loc; end", "def loc; end", "def r; end", "def r; end", "def init; end", "def init; end", "def init; end", "def init; end", "def methods() end", "def implemented_in; end", "def used?; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def feruchemist; end", "def romeo_and_juliet; end", "def rossini; end", "def code_of_conduct; end", "def ext; end", "def ext; end", "def parts; end", "def parts; end", "def parts; end", "def internal?; end", "def original; end", "def malts; end", "def missing; end", "def private_method\n end", "def scientist; end", "def initialize() end", "def upc_e; end", "def checks; end", "def helpers; end", "def helpers; end", "def helpers; end", "def extended(*) end" ]
[ "0.75085455", "0.6450165", "0.63193375", "0.6286371", "0.6286371", "0.6286371", "0.6286371", "0.61530834", "0.61530834", "0.60867906", "0.60867906", "0.6049085", "0.60185874", "0.59923214", "0.59923214", "0.5987173", "0.59864175", "0.59112334", "0.58637273", "0.5808186", "0.5781062", "0.5777758", "0.57564414", "0.57501465", "0.57140553", "0.5697417", "0.5697234", "0.567835", "0.5668611", "0.563908", "0.5626273", "0.56033933", "0.55769193", "0.55431277", "0.5530326", "0.5530326", "0.5530326", "0.5530326", "0.55283135", "0.55283135", "0.55074453", "0.55028844", "0.5492163", "0.5479218", "0.5479218", "0.5462925", "0.5452366", "0.5452366", "0.5452366", "0.54457223", "0.54457223", "0.54402345", "0.5435528", "0.542987", "0.5423698", "0.5423698", "0.5423698", "0.5423698", "0.54227364", "0.5408376", "0.54076666", "0.53997046", "0.53959954", "0.53910476", "0.53910476", "0.53910476", "0.5387008", "0.5387008", "0.5374344", "0.5374344", "0.5374344", "0.5374344", "0.5368758", "0.5368711", "0.5364597", "0.5362632", "0.5362632", "0.5362632", "0.5362632", "0.53584874", "0.5345304", "0.53442436", "0.53428066", "0.5334136", "0.5334136", "0.5332641", "0.5332641", "0.5332641", "0.53296393", "0.5328583", "0.5327633", "0.53259623", "0.53239805", "0.5313899", "0.5313042", "0.53125656", "0.53106314", "0.5304431", "0.5304431", "0.5304431", "0.53036094" ]
0.0
-1
Returns the current workitem if no fei is given. If a fei is given, it will return the applied workitem for that fei (if any). The optional fei is mostly here for backward compatibility (with 2.2.0)
def workitem(fei=nil) return fetch_workitem(fei) if fei @workitem ? @workitem : applied_workitem end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applied_workitem(_fei=nil)\n\n fetch_workitem(_fei || fei)\n end", "def [](fei)\n\n doc = fetch(fei)\n\n doc ? Ruote::Workitem.new(doc) : nil\n end", "def applied_workitem\n\n @awi ||= Ruote::Workitem.new(h.applied_workitem)\n end", "def fei\n\n @fei ? @fei : @workitem.fei\n end", "def fetch(workitem_or_fei)\n\n hfei = Ruote::FlowExpressionId.extract_h(workitem_or_fei)\n\n @context.storage.get('workitems', to_id(hfei))\n end", "def workitem\n Workitem.new(@flow_expression.applied_workitem)\n end", "def get_workitem (args)\n\n args.find { |a| a.is_a?(WorkItem) }\n end", "def [] (fei)\n\n if e = find(fei)\n e.as_owfe_expression(self.application_context)\n else\n nil\n end\n end", "def to_owfe_workitem\n\n wi = OpenWFE::InFlowWorkItem.new\n\n wi.fei = full_fei\n wi.participant_name = participant_name\n wi.fields = YAML.load(self.wi_fields)\n\n wi.dispatch_time = dispatch_time\n wi.last_modified = last_modified\n\n wi\n end", "def wfid\n\n l = [ @expressions, @errors, @stored_workitems ].find { |l| l.any? }\n\n l ? l.first.fei.wfid : nil\n end", "def apply (workitem)\n\n get_parent.reply(workitem) if @parent_id\n end", "def apply (exp_or_fei, workitem)\n\n get_workqueue.push(\n self, :do_apply_reply, :apply, exp_or_fei, workitem)\n end", "def to_owfe_workitem (options={})\n\n wi = OpenWFE::InFlowWorkItem.new\n\n wi.fei = full_fei\n wi.participant_name = participant_name\n wi.attributes = fields_hash\n\n wi.dispatch_time = dispatch_time\n wi.last_modified = last_modified\n\n wi.db_id = self.id\n\n wi\n end", "def consume (workitem)\n\n workitem.attributes['compact_workitems'] = true if compact_workitems\n\n Workitem.from_owfe_workitem(workitem, @store_name)\n end", "def currentStep\n steps = @workflow[:steps]\n\n step = nil\n if @current_step_index < steps.size\n step = WorkflowStep_Shim.new(steps[@current_step_index])\n end\n return Optional_Shim.new(step)\n end", "def root_workitem\n\n return nil unless root_expression\n\n Ruote::Workitem.new(root_expression.h.applied_workitem)\n end", "def parent_work\n find_related_frbr_objects( :is_part_of, :which_works?) \n end", "def selected_itinerary\n if selected?\n return itineraries.valid.selected.first\n else\n return nil\n end\n end", "def by_wfid(wfid, opts={})\n\n if @context.storage.respond_to?(:by_wfid)\n return @context.storage.by_wfid('workitems', wfid, opts)\n end\n\n wis(@context.storage.get_many('workitems', wfid, opts))\n end", "def narrow_filter(fi, workitem)\n\n if fi.is_a?(Array) or fi.respond_to?(:consume) or fi.respond_to?(:filter)\n\n fi\n\n elsif fi.is_a?(Hash)\n\n workitem ? fi['out'] || fi['reply'] : fi['in'] || fi['apply']\n\n elsif fi.is_a?(String)\n\n filter =\n lookup_variable(fi) ||\n @context.plist.lookup(fi, workitem || h.applied_workitem)\n\n if filter.respond_to?(:consume) or filter.respond_to?(:filter)\n (workitem || h.applied_workitem)['participant_name'] = fi\n end\n\n filter\n\n else\n\n nil\n end\n end", "def consume (workitem)\n\n workitem.attributes['compact_workitems'] = true if compact_workitems\n\n Workitem.from_owfe_workitem workitem\n # does the 'saving to db'\n end", "def current_workplace\n if @workplace && current_admin\n @workplace.name\n else#fail safe\n end \n end", "def item\n\t\tself.bmet_work_order.bmet_item\n\tend", "def work_packaged_thing\n return @work_packaged_thing if @work_packaged_thing\n return nil unless respond_to?(:workPackageHasWorkPackagedThing)\n\n @work_packaged_thing = Helpers::Utils.type_safe_first(workPackageHasWorkPackagedThing, Parliament::Grom::Decorator::WorkPackagedThing)\n end", "def full_fei\n\n @full_fei ||= OpenWFE::FlowExpressionId.from_s(fei)\n end", "def full_fei\n\n @full_fei ||= OpenWFE::FlowExpressionId.from_s(fei)\n end", "def current_item\n current_window.item\n end", "def load_workitem (workitem_id)\n\n @worklist = Worklist.new(session[:user])\n\n @workitem = OpenWFE::Extras::Workitem.find workitem_id\n\n @delegation_targets = @worklist.delegation_targets(@workitem)\n\n @fields, hidden_fields = filter_fields @workitem\n\n session[:workitem] = @workitem.id\n\n\n #@process_definition, @json_process_definition =\n # LaunchPermission.load_process_definition(\n # @workitem.full_fei.workflow_definition_url)\n\n pwfid = @workitem.full_fei.parent_wfid\n\n @json_process_definition =\n $openwferu_engine.process_representation(pwfid).to_json.to_s\n\n @paused = $openwferu_engine.is_paused?(pwfid)\n # a small digression (out of the worklist, into the engine)\n end", "def set_workitem\n @workitem = Workitem.find(params[:id])\n end", "def edit\n\n wid = get_wid or return\n\n load_workitem wid\n end", "def item\n IITWindow.new(@ole.Item)\n end", "def getCurrentItem\n return @scroll_field.getCurrentItem\n end", "def current_job\n return @job_current\n end", "def dwp_work(work_item)\n dwp_log{ \"Working, item: #{work_item.inspect}\" }\n dwp_run_callback('before_work', work_item)\n work!(work_item)\n dwp_run_callback('after_work', work_item)\n end", "def item\n IITEQPreset.new(@ole.Item)\n end", "def reply (exp_or_fei, workitem)\n\n get_workqueue.push(\n self, :do_apply_reply, :reply, exp_or_fei, workitem)\n end", "def current_chef\n @current_chef ||= Chef.find(session[:chef_id]) if session[:chef_id]\n end", "def workitems\n\n @expressions.select { |fexp|\n #fexp.is_a?(Ruote::Exp::ParticipantExpression)\n fexp.h.name == 'participant'\n }.collect { |fexp|\n Ruote::Workitem.new(fexp.h.applied_workitem)\n }\n end", "def current_item\n items[current_row]\n end", "def get_fei (args)\n\n args.each do |a|\n return a.fei if a.respond_to?(:fei)\n return a if a.is_a?(FlowExpressionId)\n end\n\n nil\n end", "def consume (workitem)\n ArWorkitem.from_owfe_workitem(workitem, @store_name)\n end", "def firm(force_reload=false)\n return @firm unless @firm.nil? || force_reload\n @firm = case @firm_type\n when \"company\"\n Company.get(@firm_permalink)\n when \"financial_org\"\n FinancialOrganization.get(@firm_permalink)\n else\n raise CrunchException, \"Not implemented\"\n end\n return @firm\n end", "def worker\n read_attribute(:worker) || extract_worker || ''\n end", "def work!(work_item)\n raise NotImplementedError\n end", "def current_menu_item\n return @current_menu_item if @current_menu_item_determined\n\n @current_menu_item = menu_items[controller_name.to_sym][:actions][action_name.to_sym] ||\n menu_items[controller_name.to_sym][:default]\n\n @current_menu_item = if @current_menu_item.is_a?(Symbol)\n @current_menu_item\n elsif @current_menu_item.is_a?(Proc)\n @current_menu_item.call(self)\n else\n raise ArgumentError \"Invalid\"\n end\n\n @current_menu_item_determined = true\n\n @current_menu_item\n end", "def set_work\n @works_item = Work.find(params[:id])\n end", "def fox_item\n @item\n end", "def item_by_name\n IITWindow.new(@ole.ItemByName)\n end", "def fetch_exp (fei_or_wfid)\n\n exp = if fei_or_wfid.is_a?(String)\n\n get_expression_pool.fetch_root(fei_or_wfid)\n\n else\n\n get_expression_pool.fetch_expression(fei_or_wfid)\n end\n\n exp || raise(\"no expression found for '#{fei_or_wfid.to_s}'\")\n end", "def determine_file_name (workitem)\n\n fei = workitem.fei\n\n OpenWFE::ensure_for_filename(\n \"#{fei.wfid}_#{fei.expression_id}__\" +\n \"#{fei.workflow_definition_name}__\" +\n \"#{fei.workflow_definition_revision}__\" +\n \"#{workitem.participant_name}.yaml\")\n end", "def to_ruote_workitem\n\n wi = Ruote::Workitem.new\n\n wi.fei = Ruote::FlowExpressionId.from_s(fei)\n wi.fields = Ruote::Json.decode(wi_fields)\n wi.participant_name = participant_name\n\n wi\n end", "def item\n IITSource.new(@ole.Item)\n end", "def pbItemIconFile(item)\n return nil if !item\n bitmapFileName = nil\n if item==0\n bitmapFileName = sprintf(\"Graphics/Icons/itemBack\")\n else\n bitmapFileName = sprintf(\"Graphics/Icons/item%s\",getConstantName(PBItems,item)) rescue nil\n if !pbResolveBitmap(bitmapFileName)\n bitmapFileName = sprintf(\"Graphics/Icons/item%03d\",item)\n if !pbResolveBitmap(bitmapFileName) && pbIsMachine?(item)\n move = pbGetMachine(item)\n type = PBMoveData.new(move).type\n bitmapFileName = sprintf(\"Graphics/Icons/itemMachine%s\",getConstantName(PBTypes,type)) rescue nil\n if !pbResolveBitmap(bitmapFileName)\n bitmapFileName = sprintf(\"Graphics/Icons/itemMachine%03d\",type)\n end\n end\n end\n end\n return bitmapFileName\nend", "def item\n @item ||= item_class.where(id: item_id).first if item_class\n end", "def lookup_variable_or_field_value (workitem)\n\n lookup_var_value(workitem) || lookup_field_value(workitem)\n end", "def fei\n\n Ruote::FlowExpressionId.new(h.fei)\n end", "def find_or_new_work(primary_id, title)\n work_found = Work.where(identifier_ssi: primary_id).last\n return work_found if work_found\n Work.new(\n identifier: primary_id,\n title: title,\n depositor: job_owner,\n admin_set: admin_set_for_work\n )\n end", "def current_package\n @cur_pkg = nil\n if self.employee_package_id\n @cur_pkg = EmployeePackage.find(self.employee_package_id)\n end\n if @cur_pkg == nil\n @cur_pkg = self.get_latest_effective_package\n end\n if @cur_pkg == nil\n errors.add(:employee_package_id, \"Error - cannot find current benefit package.\")\n end\n return @cur_pkg\n end", "def iiif_manifest_builder\n self.class.iiif_manifest_builder ||\n (Flipflop.cache_work_iiif_manifest? ? Hyrax::CachingIiifManifestBuilder : Hyrax::ManifestBuilderService)\n end", "def recent_goal_item\n @recent_goal.stake_item\n end", "def get_path (fei_or_wfid)\n\n \"#{@workdir}/#{extract_wfid(fei_or_wfid, true)}.ejournal\"\n end", "def get_working_listing_file\n local_instances_list_file_locations.reject {|f| f unless File.file?(f) }.first\n end", "def pbItemIconFile(item)\n return nil if !item\n bitmapFileName = nil\n if item==0\n bitmapFileName = sprintf(\"Graphics/Icons/itemBack\")\n else\n bitmapFileName = sprintf(\"Graphics/Icons/item%s\",getConstantName(PBItems,item)) rescue nil\n if !pbResolveBitmap(bitmapFileName)\n bitmapFileName = sprintf(\"Graphics/Icons/item%03d\",item)\n if !pbResolveBitmap(bitmapFileName) && pbIsMachine?(item)\n move = pbGetMachine(item)\n type = pbGetMoveData(move,MOVE_TYPE)\n bitmapFileName = sprintf(\"Graphics/Icons/itemMachine%s\",getConstantName(PBTypes,type)) rescue nil\n if !pbResolveBitmap(bitmapFileName)\n bitmapFileName = sprintf(\"Graphics/Icons/itemMachine%03d\",type)\n end\n end\n bitmapFileName = \"Graphics/Icons/item000\" if !pbResolveBitmap(bitmapFileName)\n end\n end\n return bitmapFileName\nend", "def work_day()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::WorkDay::WorkDayRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def item\n @recipe_window.item\n end", "def gather_item\n local_item = FoodItem.fetch_local_item @item_id\n return local_item unless local_item.nil?\n\n item_id = @item_id.split('-')\n remote_item = fetch_remote_item item_id[0], item_id[1]\n remote_item = FoodItem.new_item remote_item\n\n return remote_item unless remote_item.nil?\n\n nil # fallback\n end", "def lookup_attribute (attname, workitem)\n\n attname\n end", "def reserve(workitem_or_fei, owner)\n\n hwi = fetch(workitem_or_fei)\n\n fail ArgumentError.new(\"workitem not found\") if hwi.nil?\n\n return nil if hwi['owner'] && hwi['owner'] != owner\n\n hwi['owner'] = owner\n\n r = @context.storage.put(hwi, :update_rev => true)\n\n fail ArgumentError.new(\"workitem is gone\") if r == true\n fail ArgumentError.new(\"workitem got modified meanwhile\") if r != nil\n\n Workitem.new(hwi)\n end", "def work_type\n self[Solrizer.solr_name('work_type')]\n end", "def workflow\n return @workflow\n end", "def do_apply_reply (direction, exp_or_fei, workitem)\n\n fei = nil\n\n begin\n\n exp, fei = if exp_or_fei.is_a?(FlowExpressionId)\n fetch(exp_or_fei)\n else\n [ exp_or_fei, exp_or_fei.fei ]\n end\n\n #p [ direction, fei.wfid, fei.expid, fei.expname ]\n #\n # I uncomment that sometimes to see how the stack\n # grows (wfids and expids)\n\n if not exp\n\n #raise \"apply() cannot apply missing #{_fei.to_debug_s}\"\n # not very helpful anyway\n\n lwarn { \"do_apply_reply() :#{direction} but cannot find #{fei}\" }\n\n return\n end\n\n check_if_paused(exp)\n\n workitem.fei = exp.fei if direction == :apply\n\n onotify(direction, exp, workitem)\n\n exp.send(direction, workitem)\n\n rescue Exception => e\n\n handle_error(e, fei, direction, workitem)\n end\n end", "def on_workitem\n\n doc = workitem.to_h\n\n doc.merge!(\n 'type' => 'workitems',\n '_id' => to_id(doc['fei']),\n 'participant_name' => doc['participant_name'],\n 'wfid' => doc['fei']['wfid'])\n\n doc['store_name'] = @store_name if @store_name\n\n @context.storage.put(doc, :update_rev => true)\n end", "def get_work_by_id( work_id )\n\n begin\n return LibraWork.find( work_id )\n rescue => e\n end\n\n return nil\n end", "def fei\n\n FlowExpressionId.new(h.fei)\n end", "def item\n @item_window.item\n end", "def do_merge\n\n return @workitem if @workitem\n\n list = if first?\n @workitems_by_arrival.reverse\n elsif last?\n @workitems_by_arrival\n elsif highest?\n @workitems_by_altitude.reverse\n elsif lowest?\n @workitems_by_altitude\n end\n\n list.inject(nil) do |result, wi|\n result = merge_workitems(result, wi, override?) if wi\n result\n end\n end", "def current_step\n @current_step || steps.first\n end", "def current_step\n @current_step || steps.first\n end", "def getwork(data = nil)\n coind.getwork data\n end", "def base_item\n if self.is_base_item == true\n return self\n elsif self.is_base_item == false\n return Item.find_by_id self.base_item_id\n end\n end", "def current_price\n curr = self.item_prices.current.first\n if curr.nil?\n return nil\n else\n return curr.price\n end\n end", "def current_menu_item\n if action_name == \"index\"\n loaded_menu_items[-2]\n else\n loaded_menu_items[-1]\n end\n end", "def current_wishlist_user\n @current_wishlist_user ||= begin\n if params[:user_id] && @current_user_roles.include?('admin')\n Spree.user_class.find(params[:user_id])\n else\n # if the API user is not an admin, or didn't ask for another user,\n # return themselves.\n current_api_user\n end\n end\n end", "def item\r\n @item_window.item\r\n end", "def item_by_name\n IITEQPreset.new(@ole.ItemByName)\n end", "def job_class(item = nil)\n # noinspection RubyMismatchedArgumentType\n item and super or @job_class ||= super(self)\n end", "def item\n IITArtwork.new(@ole.Item)\n end", "def selected_item\n get_content()[focussed_index()]\n end", "def shipping_item\n shipping_scope.first || shipping_scope.build(shipping_options)\n end", "def current_resource\n @current_resource ||= @item\n end", "def first_item\n items.first\n end", "def workflow\n @workflow ||= Workflow.find(self.workflow_id)\n end", "def do_update(workitem=@workitem)\n\n r = update(workitem)\n\n fail ArgumentError.new(\"workitem is gone\") if r == true\n return nil if r.nil?\n\n r.h['fields'] = workitem.fields\n do_update(r)\n end", "def find (fei)\n\n DataMapper.repository(@dm_repository) {\n DmExpression.first(:fei => fei.as_string_key)\n }\n end", "def fexp(wi_or_fei=nil)\n\n flow_expression(wi_or_fei || fei)\n end", "def current_filter\n filters[1..-1].inject(filters.first){|a,b| @object.send(b[1].to_sym) ? b : a }[1]\n end", "def [](key)\n raise Wfe::Exception.new(\"workflow context hash accessed outside of execution scope\") unless ! @wf.nil?\n return @wf.run_time_ctx[key]\n end", "def _on_workitem(wi)\n Ruote.participant_send(\n self, [ :on_workitem, :consume ], 'workitem' => wi)\n end", "def set_working_specific_small_item\n @working_specific_small_item = WorkingSpecificSmallItem.find(params[:id])\n end", "def parent_workflow_task\n if ! (_classifications = parent_classifications.limit(1)).empty?\n _classifications.first.workflow_task\n end\n end" ]
[ "0.84802353", "0.684329", "0.6823826", "0.68020475", "0.643721", "0.6433544", "0.6280204", "0.54779565", "0.54373527", "0.54275143", "0.53904945", "0.53726786", "0.5338978", "0.53344524", "0.530411", "0.5216317", "0.52095455", "0.5204724", "0.5140214", "0.5126467", "0.51243466", "0.50320375", "0.50311714", "0.50301343", "0.50158983", "0.50158983", "0.4930191", "0.49088824", "0.48996088", "0.48981336", "0.48957744", "0.48840585", "0.48825368", "0.48231584", "0.48118135", "0.4807097", "0.47998053", "0.4797094", "0.47948745", "0.47660193", "0.47144", "0.47099206", "0.46987924", "0.46953592", "0.4673525", "0.4649742", "0.4635539", "0.4624901", "0.46191123", "0.461593", "0.45955592", "0.45948225", "0.45804796", "0.45641083", "0.4559695", "0.4556438", "0.45536047", "0.4550249", "0.45388868", "0.45347193", "0.45309058", "0.4529349", "0.45292866", "0.45259535", "0.4514875", "0.44989595", "0.44753864", "0.44665393", "0.4456701", "0.4450886", "0.44351667", "0.44328713", "0.4429375", "0.44283512", "0.44270325", "0.4423567", "0.441768", "0.44172594", "0.44136128", "0.44015872", "0.43973422", "0.43866256", "0.438603", "0.438157", "0.43801215", "0.43755916", "0.43706912", "0.43685675", "0.4352606", "0.4341637", "0.4340016", "0.4335122", "0.43333963", "0.4330316", "0.43303037", "0.43296018", "0.43220446", "0.43193623", "0.43122467", "0.43087813" ]
0.8818345
0
Returns the current fei (Ruote::FlowExpressionId).
def fei @fei ? @fei : @workitem.fei end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fei\n\n Ruote::FlowExpressionId.new(h.fei)\n end", "def fei\n\n FlowExpressionId.new(h.fei)\n end", "def full_fei\n\n @full_fei ||= OpenWFE::FlowExpressionId.from_s(fei)\n end", "def full_fei\n\n @full_fei ||= OpenWFE::FlowExpressionId.from_s(fei)\n end", "def get_fei (args)\n\n args.each do |a|\n return a.fei if a.respond_to?(:fei)\n return a if a.is_a?(FlowExpressionId)\n end\n\n nil\n end", "def fei\n\n @dict.fexp.fei\n end", "def expression\n Bumbleworks::Expression.from_fei(fei)\n end", "def efi\n Efi.find(self.efi_id)\n end", "def fexp(fei)\n\n fei = Ruote.extract_fei(fei)\n\n @expressions.find { |e| e.fei == fei }\n end", "def flow_expression\n\n @dict.fexp\n end", "def fare_io_id\n fare.present? ? fare.io_id : nil\n end", "def wfid\n\n l = [ @expressions, @errors, @stored_workitems ].find { |l| l.any? }\n\n l ? l.first.fei.wfid : nil\n end", "def sid\n\n Ruote::FlowExpressionId.to_storage_id(h.fei)\n end", "def get_ef_id(ef)\n $tracer.trace(\"GameStopAnalyticsFunctions: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n id = ef.split(\"ef_id=\")\n\t\tef_id = id[1].split(\":\")\n\t\t$tracer.report(\"EF ID from URL: #{ef_id[0]}\")\n\t\treturn ef_id[0]\n end", "def engine_environment_id\n\n @eei ||= new_fei(\n :workflow_definition_url => 'ee',\n :workflow_definition_name => 'ee',\n :workflow_instance_id => '0',\n :expression_name => EN_ENVIRONMENT)\n end", "def new_fei (h)\n\n h[:engine_id] = OpenWFE::stu(get_engine.engine_name)\n\n %w{ url name revision }.each { |k| stu(h, k) }\n\n FlowExpressionId.new_fei(h)\n end", "def current_event_id\n return @data[@index][:id]\n end", "def id\n @rf['id']\n end", "def parent_id\n\n h.parent_id ?\n Ruote::FlowExpressionId.new(h.parent_id) :\n nil\n end", "def fexp(wi_or_fei=nil)\n\n flow_expression(wi_or_fei || fei)\n end", "def child_id\n\n fei.child_id\n end", "def fid\n @fretboard.open_notes.map{|n| n.class.title}.to_s + \n @positions.map{|pos| pos.nil? ? 'x' : pos}.to_s\n end", "def root_expression_for(fei)\n\n sfei = Ruote.sid(fei)\n\n exp = @expressions.find { |fe| sfei == Ruote.sid(fe.fei) }\n\n return nil unless exp\n return exp if exp.parent_id.nil?\n\n root_expression_for(exp.parent_id)\n end", "def id\n read_attribute(:pf_id)\n end", "def engine_id\n\n @dict.fexp.context.engine_id\n end", "def get_fte(page)\n page.css(WebScraper::JOB_DETAILS_SELECTOR)[WebScraper::JOB_FTE_POS].content.strip.to_i\n end", "def current\n if global_id = @cursor_instance.get_value\n global_id = global_id.to_i\n end\n # return ID\n return global_id\n end", "def _execution_id\n attributes['id']\n end", "def facture_id\n @facture_id ||= data[:id][0..31]\n end", "def get_intention_id\n @state_items[\"admin\"].state[\"intention_id\"] += 1\n return @state_items[\"admin\"].state[\"intention_id\"]\n end", "def id; frame[:id]; end", "def get_stock_exchange_id()\n anchor_set = @stock_page.parser().xpath(\"//div[@id='exchangesLayer']/ul/li/a[contains(.,'#{@stock_exchange}')]\")\n raise RuntimeError, \"Could not extract onVista stock exchange ID for #{@stock_exchange}\", caller if anchor_set.nil? || anchor_set.size < 1\n stock_exchange_id = anchor_set[0].attr('href').sub(/.*=/, '')\n Rails.logger.debug(\"#{self.class}: ID of stock exchange #{@stock_exchange}: #{stock_exchange_id}\")\n return stock_exchange_id\n end", "def id\n value[0]\n end", "def set_fiestum\n @fiestum = Fiestum.find(params[:id])\n end", "def getWorkflowId()\n @workflowId\n end", "def workflow_id\n self.decision_context.workflow_context.decision_task.workflow_execution.workflow_id\n end", "def to_id(fei)\n\n a = [ Ruote.to_storage_id(fei) ]\n\n a.unshift(@store_name) if @store_name\n\n a.unshift('wi')\n\n a.join('!')\n end", "def calculate_fstfwd_id\n # Internal id for fstfwd\n self._id\n end", "def next_fab\n fab = self.user.fabs.where('period > ?', self.period).last\n end", "def fetch_exp (fei_or_wfid)\n\n exp = if fei_or_wfid.is_a?(String)\n\n get_expression_pool.fetch_root(fei_or_wfid)\n\n else\n\n get_expression_pool.fetch_expression(fei_or_wfid)\n end\n\n exp || raise(\"no expression found for '#{fei_or_wfid.to_s}'\")\n end", "def getforwardingentityid\r\n return getvalue(SVTags::FORWARDING_ENTITY_ID)\r\n end", "def get_id()\n return @id\n end", "def flow?\n parse\n @flow_id\n end", "def pid\n @fields.first\n end", "def fetch(workitem_or_fei)\n\n hfei = Ruote::FlowExpressionId.extract_h(workitem_or_fei)\n\n @context.storage.get('workitems', to_id(hfei))\n end", "def label\n return computing_id\n end", "def find (fei)\n\n DataMapper.repository(@dm_repository) {\n DmExpression.first(:fei => fei.as_string_key)\n }\n end", "def current_step\n return (workflow - chosen_categories.collect(&:workflow_id) - session[:skipped_steps].to_a).first\n end", "def getId()\n\t\t\treturn @_id\n\t\tend", "def workitem\n Workitem.new(@flow_expression.applied_workitem)\n end", "def id\n @pe_id\n end", "def trace_id\n self.current_trace ? self.current_trace.id : nil\n end", "def current_invoice\n invoices.opened.first\n end", "def fice_code\n @data['ficeCode']\n end", "def call_transcript_i_cal_uid\n return @call_transcript_i_cal_uid\n end", "def task_definition_id\n return @task_definition_id\n end", "def current_foodie\n # User.find would throw an error if we cannot find the user\n Foodie.find_by({ id: session[:foodie_id] })\n end", "def callee_number\n return @callee_number\n end", "def id\n fields['id']\n end", "def wfid\n\n h.fei['wfid']\n end", "def wfid\n\n h.fei['wfid']\n end", "def id\n @block\n end", "def id\n @block\n end", "def unit_of_work_id\n context[:unit_of_work_id]\n end", "def find_flow name\n @flows.select { |f| f.name == name }.first\n end", "def ofx_id() \n if @ofx_id.nil?\n text = \"#{@date}:#{@raw_description}:#{@type}:#{@amount}:#{@new_balance}\"\n @ofx_id= Digest::MD5.hexdigest(text)\n end\n return @ofx_id\n end", "def [] (fei)\n\n if e = find(fei)\n e.as_owfe_expression(self.application_context)\n else\n nil\n end\n end", "def current_id\n not_applicable\n end", "def preview_id\n @attributes[:preview_id]\n end", "def fare_io_id=(val)\n self.fare = FareAttribute.find_by(io_id: val)\n end", "def id\n object.evss_id\n end", "def label\n return computing_id\n end", "def flow_object_id\n @flow_object_id ||= params[:flow_object_id]&.to_s || @company.id\n end", "def parse_id(fhir_formulary)\n\t\treturn fhir_formulary.id\n\tend", "def current_step\n @current_step || steps.first\n end", "def execution_id\n value = @execution_id.value\n return if value.instance_of?(Object)\n\n value\n end", "def id\n self.event['id'].to_i\n end", "def first_core_item_id\n @core_items.first.freq_item_id\n end", "def currentStepIndex\n @current_step_index\n end", "def GEI\n\t\treturn @gei\n\tend", "def get_id()\n return @id\n end", "def current_dispatch\n @aemo_market_node.current_dispatch\n end", "def identity()\n\t\t\treturn @metadata.attributes[:identity].to_i\n\t\tend", "def identity\n return @identity\n end", "def current_step\n\t\t@current_step || steps.first\t\n\tend", "def next_child_index (returning_fei)\n\n next_id = if returning_fei.is_a?(Integer)\n returning_fei + 1\n elsif returning_fei == self.fei\n 0\n else\n returning_fei.child_id.to_i + 1\n end\n\n loop do\n\n break if next_id > raw_children.length\n\n raw_child = raw_children[next_id]\n\n return next_id \\\n if raw_child.is_a?(Array) or raw_child.is_a?(FlowExpressionId)\n\n next_id += 1\n end\n\n nil\n end", "def office_id\n self.dig_for_string(\"agentSummary\", \"office\", \"officeId\")\n end", "def id()\n #This is a stub, used for indexing\n end", "def parent\n\n h.parent_id ?\n Ruote::Exp::FlowExpression.fetch(@context, h.parent_id) :\n nil\n end", "def live_lookup_item_id\n id || folio_item&.id || barcode\n end", "def id(index)\n i = get_field_index_by_external_id(index,@fields[:id])\n fields(index, i).to_i unless i.nil?\n end", "def id(index)\n i = get_field_index_by_external_id(index,@fields[:id])\n fields(index, i).to_i unless i.nil?\n end", "def current_request_id\n RequestStore.store[:current_request_id] || \"NONE\"\n end", "def id\n @id ||= Time.now.utc.to_i\n end", "def line_item_id\n @row[\"売上詳細ID\"].to_s\n end", "def current_trace_id\n if @@spans.empty?\n nil\n else\n @@spans.slice(-1).trace_id\n end\n end", "def entity(index)\n i = get_field_index_by_external_id(index,@fields[:entity])\n fields(index, i)['item_id'].to_i unless i.nil?\n end", "def definition_id\n @attribute.definition_id\n end", "def id\n @values.fetch('ai.operation.id') { \n @values['ai.operation.id'] = nil\n }\n end", "def attendee_id(current_user)\n\n\t\tuser = self.attendees.where('user_id = ?', current_user.id.to_s).first\n\n\t\tif user.present?\n\t\t\tuser.id\n\t\telse\n\t\t\t0\n\t\tend\n\n\tend" ]
[ "0.88221747", "0.8765431", "0.72101337", "0.72101337", "0.7183698", "0.6429862", "0.6220795", "0.61703753", "0.61633503", "0.609138", "0.5986439", "0.591195", "0.5887307", "0.58856684", "0.58752126", "0.5804085", "0.5781046", "0.5652986", "0.55530804", "0.5544083", "0.55001074", "0.5491313", "0.5466974", "0.5389143", "0.53717834", "0.53400415", "0.5323646", "0.531964", "0.526539", "0.52533716", "0.5245597", "0.52141255", "0.5196823", "0.51912063", "0.5183865", "0.5170443", "0.51664764", "0.5161224", "0.51058203", "0.50989074", "0.5093837", "0.50855774", "0.508524", "0.50821817", "0.5078007", "0.5074843", "0.5072343", "0.5063666", "0.50544906", "0.5050339", "0.50418633", "0.50393236", "0.50347763", "0.50318253", "0.50242645", "0.5021666", "0.50215393", "0.5021203", "0.5018563", "0.50169694", "0.50169694", "0.5007324", "0.5007324", "0.5006979", "0.5005209", "0.5003596", "0.498102", "0.49742112", "0.49561912", "0.49521196", "0.49437597", "0.49270692", "0.4924769", "0.4918447", "0.4914003", "0.49074504", "0.49074116", "0.4903853", "0.48969993", "0.4890942", "0.48908937", "0.4889173", "0.48861456", "0.48853898", "0.48830852", "0.487597", "0.4873592", "0.48713028", "0.48674965", "0.48602837", "0.48596656", "0.48596656", "0.48548928", "0.48540136", "0.4849972", "0.48499268", "0.4846306", "0.48460492", "0.4844516", "0.48404604" ]
0.69209236
5
Returns the Ruote::ParticipantExpression that corresponds with this participant. If a wi_or_fei arg is given, will return the corresponding flow expression. This arg is mostly here for backward compatibility.
def fexp(wi_or_fei=nil) flow_expression(wi_or_fei || fei) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expression\n Bumbleworks::Expression.from_fei(fei)\n end", "def fei\n\n Ruote::FlowExpressionId.new(h.fei)\n end", "def workitems\n\n @expressions.select { |fexp|\n #fexp.is_a?(Ruote::Exp::ParticipantExpression)\n fexp.h.name == 'participant'\n }.collect { |fexp|\n Ruote::Workitem.new(fexp.h.applied_workitem)\n }\n end", "def to_ruote_workitem\n\n wi = Ruote::Workitem.new\n\n wi.fei = Ruote::FlowExpressionId.from_s(fei)\n wi.fields = Ruote::Json.decode(wi_fields)\n wi.participant_name = participant_name\n\n wi\n end", "def fei\n\n FlowExpressionId.new(h.fei)\n end", "def workitem\n Workitem.new(@flow_expression.applied_workitem)\n end", "def participant\n ScriptoriaCore::Ruote.engine.participant(participant_name)\n end", "def participant_name\n\n workitem.participant_name\n end", "def to_owfe_workitem\n\n wi = OpenWFE::InFlowWorkItem.new\n\n wi.fei = full_fei\n wi.participant_name = participant_name\n wi.fields = YAML.load(self.wi_fields)\n\n wi.dispatch_time = dispatch_time\n wi.last_modified = last_modified\n\n wi\n end", "def fexp(fei)\n\n fei = Ruote.extract_fei(fei)\n\n @expressions.find { |e| e.fei == fei }\n end", "def fei\n\n @fei ? @fei : @workitem.fei\n end", "def flow_expression\n\n @dict.fexp\n end", "def fetch_exp (fei_or_wfid)\n\n exp = if fei_or_wfid.is_a?(String)\n\n get_expression_pool.fetch_root(fei_or_wfid)\n\n else\n\n get_expression_pool.fetch_expression(fei_or_wfid)\n end\n\n exp || raise(\"no expression found for '#{fei_or_wfid.to_s}'\")\n end", "def expression\n node_parts.last\n end", "def get_fei (args)\n\n args.each do |a|\n return a.fei if a.respond_to?(:fei)\n return a if a.is_a?(FlowExpressionId)\n end\n\n nil\n end", "def to_expr\n return self.return_value\n end", "def build_raw_expression (param, launchitem=nil)\n\n procdef = get_def_parser.determine_rep(param)\n\n # procdef is a nested [ name, attributes, children ] structure now\n\n atts = procdef[1]\n\n h = {\n :workflow_instance_id =>\n get_wfid_generator.generate(launchitem),\n :workflow_definition_name =>\n atts['name'] || procdef[2].first || 'no-name',\n :workflow_definition_revision =>\n atts['revision'] || '0',\n :expression_name =>\n procdef[0]\n }\n\n h[:workflow_definition_url] = (\n launchitem.workflow_definition_url || LaunchItem::FIELD_DEF\n ) if launchitem\n\n RawExpression.new_raw(\n new_fei(h), nil, nil, @application_context, procdef)\n end", "def presented_expressions\n find_related_frbr_objects( :has_presented, :which_expressions?) \n end", "def to_owfe_workitem (options={})\n\n wi = OpenWFE::InFlowWorkItem.new\n\n wi.fei = full_fei\n wi.participant_name = participant_name\n wi.attributes = fields_hash\n\n wi.dispatch_time = dispatch_time\n wi.last_modified = last_modified\n\n wi.db_id = self.id\n\n wi\n end", "def [] (fei)\n\n if e = find(fei)\n e.as_owfe_expression(self.application_context)\n else\n nil\n end\n end", "def expression\n return additive_expression\n end", "def expression\n @expression ||= :mp\n end", "def evaluate_expression(expression, eval_string = '')\n if expression.is_a? Yarpler::Models::Expression\n eval_string << evaluate_expression_inner(expression).to_s\n elsif expression.is_a? Yarpler::Models::Field\n obj = @problem.objects[expression.variable].get_value(expression.attribute)\n if (obj.is_a? Yarpler::Models::Relation)\n obj = @problem.objects[obj.to.first.to_s].id\n end\n eval_string << obj.to_s\n elsif expression.is_a? Yarpler::Models::Literal\n eval_string << expression.value.to_s\n else\n fail Yarpler::Exceptions::InvalidWhereExpression.new, 'Where Expression is illegal'\n end\n eval_string\n end", "def expr\n or_expr\n end", "def operator\n node_parts[1]\n end", "def to_expr\n return @signal.to_expr\n end", "def recipient\n return self.unless_nil?('invitee.email', deliveries.unless_nil?('first.recipients', '') )\n end", "def participant_name\n\n h.participant_name\n end", "def current_project_participant(project_id)\n # if self.has_accepted?(project_id)\n Participant.where(project_id: project_id, user_id: self.id).first\n # end\n end", "def participant\n self_link.try(:participant)\n end", "def participant_id\n return @participant_id\n end", "def participant_id\n return @participant_id\n end", "def root_expression_for(fei)\n\n sfei = Ruote.sid(fei)\n\n exp = @expressions.find { |fe| sfei == Ruote.sid(fe.fei) }\n\n return nil unless exp\n return exp if exp.parent_id.nil?\n\n root_expression_for(exp.parent_id)\n end", "def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.FlexApi.V1.InteractionChannelParticipantContext #{context}>\"\n end", "def get_participant_event(event)\n unless event.nil?\n return participant_event_class.find_by_event_id_and_schedule_id(event.id, self.id)\n end\n end", "def my_participant_id\n return @my_participant_id\n end", "def full_fei\n\n @full_fei ||= OpenWFE::FlowExpressionId.from_s(fei)\n end", "def full_fei\n\n @full_fei ||= OpenWFE::FlowExpressionId.from_s(fei)\n end", "def participant\n market.participants[env['REMOTE_USER'].to_i]\n end", "def to_citrus # :nodoc:\n rule.to_embedded_s + operator\n end", "def relationship_to_person_via_participant(person)\n return 'N/A' if person.nil?\n\n rel = person.participant_person_links.find { |ppl|\n ppl.participant == participant\n }.try(:relationship)\n\n rel.try(:display_text) || 'None'\n end", "def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Api.V2010.ParticipantContext #{context}>\"\n end", "def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.FlexApi.V1.InteractionChannelParticipantContext #{context}>\"\n end", "def narrow_filter(fi, workitem)\n\n if fi.is_a?(Array) or fi.respond_to?(:consume) or fi.respond_to?(:filter)\n\n fi\n\n elsif fi.is_a?(Hash)\n\n workitem ? fi['out'] || fi['reply'] : fi['in'] || fi['apply']\n\n elsif fi.is_a?(String)\n\n filter =\n lookup_variable(fi) ||\n @context.plist.lookup(fi, workitem || h.applied_workitem)\n\n if filter.respond_to?(:consume) or filter.respond_to?(:filter)\n (workitem || h.applied_workitem)['participant_name'] = fi\n end\n\n filter\n\n else\n\n nil\n end\n end", "def find_ep(email)\n ExchangeParticipant.find_by(email: email, podio_id: nil)\n end", "def issue_assignee(issue)\n issue.assignee\n end", "def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Api.V2010.ParticipantContext #{context}>\"\n end", "def determine_file_name (workitem)\n\n fei = workitem.fei\n\n OpenWFE::ensure_for_filename(\n \"#{fei.wfid}_#{fei.expression_id}__\" +\n \"#{fei.workflow_definition_name}__\" +\n \"#{fei.workflow_definition_revision}__\" +\n \"#{workitem.participant_name}.yaml\")\n end", "def role_str\n if (role == nil)\n role_result = \"participant\"\n else\n role_result = role\n end\n role_result\n end", "def get_relational(expr)\n\t\t[\"==\", \"!=\", \">\", \"<\", \">=\", \"<=\"].each do |ope|\n\t\t\tif expr.scan(ope).length == 1\n\t\t\t\treturn ope\n\t\t\tend\n\t\tend\n\tend", "def to_ruby\n @expression.respond_to?(:to_ruby) ? @expression.to_ruby : @expression\n end", "def to_s\n context = @solution.map {|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Api.V2010.ParticipantContext #{context}>\"\n end", "def tir_f\n format_f(self.tir)\n end", "def to_s\n rule.embed + operator\n end", "def expander\n # convert or-clause into expander\n elements = @elements.map do |elt|\n elt.kind_of?(OrExpr) ? elt.expander : elt\n end\n # return an enumerator\n return Enumerator.new {|y| choose_concrete_expr(y, elements, [], nil, 0) }\n end", "def expression\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_in( __method__, 1 )\r\n result = nil\r\n a = nil\r\n b = nil\r\n\r\n begin\r\n # at line 9:4: a= NUMBER '+' b= NUMBER\r\n a = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_expression_28 )\r\n match( T__6, TOKENS_FOLLOWING_T__6_IN_expression_30 )\r\n b = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_expression_34 )\r\n # --> action\r\n result = a.text.to_i + b.text.to_i \r\n # <-- action\r\n\r\n rescue ANTLR3::Error::RecognitionError => re\r\n report_error(re)\r\n recover(re)\r\n\r\n ensure\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_out( __method__, 1 )\r\n\r\n end\r\n \r\n return result\r\n end", "def or_expr\n expr = and_expr()\n\n while match(:or)\n operator = previous()\n right = and_expr()\n expr = Expr::Logical.new expr, operator, right\n end\n\n expr\n end", "def working_equation\n default_equation || ''\n end", "def rhs\n node_parts[1]\n end", "def worker\n read_attribute(:worker) || extract_worker || ''\n end", "def filter(workitem=nil)\n\n filter = lookup_filter(workitem)\n\n return unless filter\n\n unless filter.is_a?(Array)\n #\n # filter is a participant\n\n def filter.receive(wi); end\n # making sure the participant never replies to the engine\n\n hwi = workitem || h.applied_workitem\n\n if filter.respond_to?(:filter)\n hwi['fields'] = filter.filter(hwi['fields'], workitem ? 'out' : 'in')\n else\n hwi['fields']['__filter_direction__'] = workitem ? 'out' : 'in'\n filter.consume(Ruote::Workitem.new(hwi))\n end\n\n hwi['fields'].delete('__filter_direction__')\n\n return\n end\n\n #\n # filter is a not a participnat\n\n unless workitem # in\n\n h.fields_pre_filter =\n Rufus::Json.dup(h.applied_workitem['fields'])\n h.applied_workitem['fields'] =\n Ruote.filter(filter, h.applied_workitem['fields'], {})\n\n else # out\n\n workitem['fields'] =\n Ruote.filter(\n filter,\n workitem['fields'],\n :double_tilde =>\n h.fields_pre_filter || h.applied_workitem['fields'])\n\n workitem['fields'].delete('params')\n # take and discard tend to copy it over, so let's remove it\n end\n end", "def operator\n return @operator\n end", "def operator\n return @operator\n end", "def operator\n return @operator\n end", "def invite(email, role, label_or_expression, value)\n muf = prepare label_or_expression, value\n\n invitation = {\n \"invitations\" => [ {\n \"invitation\" => {\n \"content\" => {\n \"email\" => email,\n \"userFilters\" => [ muf[:url] ],\n \"role\" => role\n }\n }\n } ]\n }\n pp invitation\n GoodData.post \"/gdc/projects/#{@project_id}/invitations\", invitation\n end", "def expression_parts\n find_related_frbr_objects( :contains, :which_expressions?) \n end", "def cancel_participant\n\n return unless @applied_workitem\n #\n # if there is an applied workitem, it means there\n # is a participant to cancel...\n\n participant = get_participant_map.lookup_participant(@participant_name)\n\n cancelitem = CancelItem.new(@applied_workitem)\n\n get_participant_map.dispatch(participant, @participant_name, cancelitem)\n end", "def fir_role\n self.roles.detect { |r| r.name == 'FIR' }\n end", "def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.FlexApi.V1.InteractionChannelParticipantInstance #{values}>\"\n end", "def to_s\n @expression.to_s\n end", "def parsed_expression\n return @parsed_expression\n end", "def applied_workitem\n\n @awi ||= Ruote::Workitem.new(h.applied_workitem)\n end", "def registration(participant)\n registrations.detect { |registration| registration.participant == participant }\n end", "def invited_by_wus_user\n user = self.organization.users.where(self.invited_by_id).first\n user.full_name.present? ? user.full_name : user.email\n end", "def work_phone_number_field\n # unit_test_no_generate: work_phone_number_field, input.className(create_ats_regex_string(\"ats-workphonefield\"))\n $tracer.trace(__method__)\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-workphonefield\")), __method__)\n end", "def get_equation(n)\n eval \"@yp#{n}\"\n end", "def operand\n operands.first\n end", "def happening_expressions\n find_related_frbr_objects( :has_happening, :which_expressions?) \n end", "def participant?\n !participant.nil?\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.FlexApi.V1.InteractionChannelParticipantInstance #{values}>\"\n end", "def record_expr(record = 'record_of_the_death')\n record\n end", "def choose_concrete_expr(y, orig, list, fiber, i)\n if orig.size == i\n # when reach the terminateion of elements, yield a concrete expression\n y << AndExpr.new(*convert_cons_list_into_array(list))\n else\n # or-clause\n if orig[i].kind_of?(Enumerator)\n # create a new fiber\n _fiber = Fiber.new do\n loop do\n # rewind unreached enumerators\n orig.each_with_index do |e, ii|\n e.rewind if ii > i && e.kind_of?(Enumerator)\n end\n # choose next\n choose_concrete_expr(y, orig, [orig[i].next, list], _fiber, i+1)\n # retrun fiber loop\n Fiber.yield\n end\n end\n # fiber loop\n begin\n _fiber.transfer while true\n rescue FiberError => e\n fiber.transfer if fiber\n end\n else\n # other elements\n choose_concrete_expr(y, orig, [orig[i], list], fiber, i+1)\n end\n end\n end", "def participant=(part)\n @participant = part\n end", "def expression; end", "def workitem(fei=nil)\n\n return fetch_workitem(fei) if fei\n\n @workitem ? @workitem : applied_workitem\n end", "def fetch(workitem_or_fei)\n\n hfei = Ruote::FlowExpressionId.extract_h(workitem_or_fei)\n\n @context.storage.get('workitems', to_id(hfei))\n end", "def expression\n super\n end", "def expression\n Fast.expression(@pattern)\n end", "def get_operator(expression, default)\n f = rules_for_type(expression[:type])\n if f[:operators].include?(default)\n if f[:multiple] && range?(expression[:value]) && default == 'Bt'\n return \"Bt\"\n elsif f[:multiple] && multiple_values?(expression[:value])\n return nil unless operator_supports_multiples?(default)\n\n return default == \"Ne\" ? \"Not In\" : \"In\"\n elsif default == \"Ne\"\n return \"Not Eq\"\n end\n\n default\n else\n nil\n end\n end", "def to_nfa\n exec(:expression)\n end", "def service_payee_identification\n code, qual = nil, nil\n claim = eob.claim_information\n fac = facility\n\n if (claim && !claim.payee_npi.blank?)\n code = claim.payee_npi\n qual = 'XX'\n Output835.log.info \"Payee NPI from the 837 is chosen\"\n elsif (claim && !claim.payee_tin.blank?)\n code = claim.payee_tin\n qual = 'FI'\n Output835.log.info \"Payee TIN from 837 is chosen\"\n elsif !fac.facility_npi.blank?\n code = fac.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !fac.facility_tin.blank?\n code = fac.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def expression\n lterm = term\n loop do\n if accept(:T_PLUS)\n lterm = Addition.new(lterm, term)\n elsif accept(:T_MINUS)\n lterm = Subtraction.new(lterm, term)\n else\n break\n end\n end\n lterm\n end", "def efi\n Efi.find(self.efi_id)\n end", "def get_instance(payload)\n InteractionChannelParticipantInstance.new(@version, payload, interaction_sid: @solution[:interaction_sid], channel_sid: @solution[:channel_sid])\n end", "def invitee_string\n\t\n\tend", "def other_participant\n @_cache_other_participant ||= object.user_participants.where.not(id: current_user.id).first.try(:decorate)\n end", "def fei\n\n @dict.fexp.fei\n end", "def root_workitem\n\n return nil unless root_expression\n\n Ruote::Workitem.new(root_expression.h.applied_workitem)\n end", "def participant=(participant)\n ppl = self_link\n if ppl\n ppl.participant = participant\n else\n participant_person_links.build(:relationship_code => 1, :person => self, :participant => participant, :psu => self.psu)\n end\n end", "def orientation\n return nil if not @rep\n\n # get the transformation from the group or component instance\n t = @rep.transformation\n eye = t.origin\n dir = t.xaxis\n up = t.zaxis\n y = t.yaxis\n\n # See if there is an offset that needs to be applied to the eye position\n eo = self.get_offset\n if( eo )\n offset = Geom::Vector3d.linear_combination eo.x, dir, eo.y, y, eo.z, up\n eye.offset!(offset)\n end\n\n [eye, dir, up]\nend" ]
[ "0.57996374", "0.5785982", "0.5749371", "0.54768634", "0.5452336", "0.5304602", "0.5132638", "0.50958204", "0.49156335", "0.48420572", "0.4831378", "0.4815506", "0.4800935", "0.4784268", "0.47835112", "0.4621719", "0.46015272", "0.4573871", "0.456725", "0.4551349", "0.454514", "0.45154846", "0.44976038", "0.449396", "0.44791976", "0.4449355", "0.44420815", "0.44327873", "0.43905672", "0.4384783", "0.43441662", "0.43441662", "0.4330843", "0.432659", "0.42866197", "0.42561102", "0.4250159", "0.4250159", "0.4249526", "0.4243421", "0.42313635", "0.42295817", "0.42196333", "0.41891798", "0.41810754", "0.4175019", "0.41556817", "0.41358298", "0.4131509", "0.41300213", "0.41284972", "0.41227758", "0.41216412", "0.41122016", "0.4112152", "0.41089103", "0.4089567", "0.40529692", "0.40299538", "0.4021536", "0.40190288", "0.400302", "0.400302", "0.400302", "0.39882416", "0.39789325", "0.3978089", "0.39715186", "0.39662358", "0.3958", "0.3955386", "0.39545456", "0.39494658", "0.3941334", "0.3936826", "0.3935487", "0.3929614", "0.3924451", "0.39216655", "0.39051956", "0.38947928", "0.38891044", "0.3885681", "0.38836616", "0.38656464", "0.386093", "0.38550246", "0.38514844", "0.38417408", "0.38416857", "0.3837109", "0.38357028", "0.38249037", "0.38226295", "0.38136634", "0.38117668", "0.38065794", "0.3804567", "0.38023505", "0.37998223" ]
0.5659175
3
Returns the workitem as was applied when the Ruote::ParticipantExpression was reached. If the _fei arg is specified, it will return the corresponding applied workitem. This args is mostly here for backward compatibility.
def applied_workitem(_fei=nil) fetch_workitem(_fei || fei) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workitem(fei=nil)\n\n return fetch_workitem(fei) if fei\n\n @workitem ? @workitem : applied_workitem\n end", "def workitems\n\n @expressions.select { |fexp|\n #fexp.is_a?(Ruote::Exp::ParticipantExpression)\n fexp.h.name == 'participant'\n }.collect { |fexp|\n Ruote::Workitem.new(fexp.h.applied_workitem)\n }\n end", "def workitem\n Workitem.new(@flow_expression.applied_workitem)\n end", "def to_ruote_workitem\n\n wi = Ruote::Workitem.new\n\n wi.fei = Ruote::FlowExpressionId.from_s(fei)\n wi.fields = Ruote::Json.decode(wi_fields)\n wi.participant_name = participant_name\n\n wi\n end", "def fei\n\n @fei ? @fei : @workitem.fei\n end", "def get_workitem (args)\n\n args.find { |a| a.is_a?(WorkItem) }\n end", "def applied_workitem\n\n @awi ||= Ruote::Workitem.new(h.applied_workitem)\n end", "def to_owfe_workitem\n\n wi = OpenWFE::InFlowWorkItem.new\n\n wi.fei = full_fei\n wi.participant_name = participant_name\n wi.fields = YAML.load(self.wi_fields)\n\n wi.dispatch_time = dispatch_time\n wi.last_modified = last_modified\n\n wi\n end", "def participant_name\n\n workitem.participant_name\n end", "def narrow_filter(fi, workitem)\n\n if fi.is_a?(Array) or fi.respond_to?(:consume) or fi.respond_to?(:filter)\n\n fi\n\n elsif fi.is_a?(Hash)\n\n workitem ? fi['out'] || fi['reply'] : fi['in'] || fi['apply']\n\n elsif fi.is_a?(String)\n\n filter =\n lookup_variable(fi) ||\n @context.plist.lookup(fi, workitem || h.applied_workitem)\n\n if filter.respond_to?(:consume) or filter.respond_to?(:filter)\n (workitem || h.applied_workitem)['participant_name'] = fi\n end\n\n filter\n\n else\n\n nil\n end\n end", "def to_owfe_workitem (options={})\n\n wi = OpenWFE::InFlowWorkItem.new\n\n wi.fei = full_fei\n wi.participant_name = participant_name\n wi.attributes = fields_hash\n\n wi.dispatch_time = dispatch_time\n wi.last_modified = last_modified\n\n wi.db_id = self.id\n\n wi\n end", "def fetch(workitem_or_fei)\n\n hfei = Ruote::FlowExpressionId.extract_h(workitem_or_fei)\n\n @context.storage.get('workitems', to_id(hfei))\n end", "def cancel_participant\n\n return unless @applied_workitem\n #\n # if there is an applied workitem, it means there\n # is a participant to cancel...\n\n participant = get_participant_map.lookup_participant(@participant_name)\n\n cancelitem = CancelItem.new(@applied_workitem)\n\n get_participant_map.dispatch(participant, @participant_name, cancelitem)\n end", "def [](fei)\n\n doc = fetch(fei)\n\n doc ? Ruote::Workitem.new(doc) : nil\n end", "def _on_workitem(wi)\n Ruote.participant_send(\n self, [ :on_workitem, :consume ], 'workitem' => wi)\n end", "def apply (workitem)\n\n get_parent.reply(workitem) if @parent_id\n end", "def apply (exp_or_fei, workitem)\n\n get_workqueue.push(\n self, :do_apply_reply, :apply, exp_or_fei, workitem)\n end", "def filter(workitem=nil)\n\n filter = lookup_filter(workitem)\n\n return unless filter\n\n unless filter.is_a?(Array)\n #\n # filter is a participant\n\n def filter.receive(wi); end\n # making sure the participant never replies to the engine\n\n hwi = workitem || h.applied_workitem\n\n if filter.respond_to?(:filter)\n hwi['fields'] = filter.filter(hwi['fields'], workitem ? 'out' : 'in')\n else\n hwi['fields']['__filter_direction__'] = workitem ? 'out' : 'in'\n filter.consume(Ruote::Workitem.new(hwi))\n end\n\n hwi['fields'].delete('__filter_direction__')\n\n return\n end\n\n #\n # filter is a not a participnat\n\n unless workitem # in\n\n h.fields_pre_filter =\n Rufus::Json.dup(h.applied_workitem['fields'])\n h.applied_workitem['fields'] =\n Ruote.filter(filter, h.applied_workitem['fields'], {})\n\n else # out\n\n workitem['fields'] =\n Ruote.filter(\n filter,\n workitem['fields'],\n :double_tilde =>\n h.fields_pre_filter || h.applied_workitem['fields'])\n\n workitem['fields'].delete('params')\n # take and discard tend to copy it over, so let's remove it\n end\n end", "def get_fei (args)\n\n args.each do |a|\n return a.fei if a.respond_to?(:fei)\n return a if a.is_a?(FlowExpressionId)\n end\n\n nil\n end", "def fei\n\n Ruote::FlowExpressionId.new(h.fei)\n end", "def determine_file_name (workitem)\n\n fei = workitem.fei\n\n OpenWFE::ensure_for_filename(\n \"#{fei.wfid}_#{fei.expression_id}__\" +\n \"#{fei.workflow_definition_name}__\" +\n \"#{fei.workflow_definition_revision}__\" +\n \"#{workitem.participant_name}.yaml\")\n end", "def reply (exp_or_fei, workitem)\n\n get_workqueue.push(\n self, :do_apply_reply, :reply, exp_or_fei, workitem)\n end", "def parent_work\n find_related_frbr_objects( :is_part_of, :which_works?) \n end", "def participant\n ScriptoriaCore::Ruote.engine.participant(participant_name)\n end", "def [] (fei)\n\n if e = find(fei)\n e.as_owfe_expression(self.application_context)\n else\n nil\n end\n end", "def lookup_info(pname, workitem)\n\n return nil unless pname\n\n wi = workitem ?\n Ruote::Workitem.new(workitem.merge('participant_name' => pname)) :\n nil\n\n get_list['list'].each do |regex, pinfo|\n\n next unless pname.match(regex)\n\n return pinfo if workitem.nil?\n\n pa = instantiate(pinfo, :if_respond_to? => :accept?)\n\n return pinfo if pa.nil?\n return pinfo if Ruote.participant_send(pa, :accept?, 'workitem' => wi)\n end\n\n # nothing found...\n\n nil\n end", "def test_update_workitem_alt\n\n @dashboard.register_participant 'alpha', Ruote::StorageParticipant\n\n wfid = @dashboard.launch(Ruote.process_definition { alpha })\n\n wait_for(:alpha)\n\n #wi = @dashboard.process(wfid).workitems.first\n # doesn't work: the returned workitem isn't a workite document, it's\n # just a fragment of info\n\n wi = @dashboard.process(wfid).stored_workitems.first\n # works OK\n\n #wi = alpha.first\n # works OK, but you have to grab alpha first...\n\n alpha = @dashboard.participant(wi.participant_name)\n\n wi.set_field('my_field', 'abc123')\n\n alpha.update(wi)\n\n assert_equal nil, @dashboard.process(wfid).workitems.first.fields['my_field']\n assert_equal 'abc123', alpha.first.fields['my_field']\n end", "def current_project_participant(project_id)\n # if self.has_accepted?(project_id)\n Participant.where(project_id: project_id, user_id: self.id).first\n # end\n end", "def fei\n\n FlowExpressionId.new(h.fei)\n end", "def worker\n read_attribute(:worker) || extract_worker || ''\n end", "def on_workitem\n\n doc = workitem.to_h\n\n doc.merge!(\n 'type' => 'workitems',\n '_id' => to_id(doc['fei']),\n 'participant_name' => doc['participant_name'],\n 'wfid' => doc['fei']['wfid'])\n\n doc['store_name'] = @store_name if @store_name\n\n @context.storage.put(doc, :update_rev => true)\n end", "def item_requester\n participants.reject { |p| p.id == item_owner.id }.first\n end", "def action_handle(action, fei, exception)\n\n fexp = Ruote::Exp::FlowExpression.fetch(@context, fei)\n\n msg = {\n 'action' => action,\n 'fei' => fei,\n 'participant_name' => fexp.h.participant_name,\n 'workitem' => fexp.h.applied_workitem,\n 'put_at' => Ruote.now_to_utc_s }\n\n handle(msg, fexp, exception)\n end", "def _accept?(wi)\n Ruote.participant_send(self, :accept?, 'workitem' => wi)\n end", "def expression\n Bumbleworks::Expression.from_fei(fei)\n end", "def do_apply_reply (direction, exp_or_fei, workitem)\n\n fei = nil\n\n begin\n\n exp, fei = if exp_or_fei.is_a?(FlowExpressionId)\n fetch(exp_or_fei)\n else\n [ exp_or_fei, exp_or_fei.fei ]\n end\n\n #p [ direction, fei.wfid, fei.expid, fei.expname ]\n #\n # I uncomment that sometimes to see how the stack\n # grows (wfids and expids)\n\n if not exp\n\n #raise \"apply() cannot apply missing #{_fei.to_debug_s}\"\n # not very helpful anyway\n\n lwarn { \"do_apply_reply() :#{direction} but cannot find #{fei}\" }\n\n return\n end\n\n check_if_paused(exp)\n\n workitem.fei = exp.fei if direction == :apply\n\n onotify(direction, exp, workitem)\n\n exp.send(direction, workitem)\n\n rescue Exception => e\n\n handle_error(e, fei, direction, workitem)\n end\n end", "def reply(workitem)\n\n puts '-' * 80\n puts '*** WARNING : please use the Ruote::StorageParticipant#proceed(wi)'\n puts ' instead of #reply(wi) which is deprecated'\n #caller.each { |l| puts l }\n puts '-' * 80\n\n proceed(workitem)\n end", "def lookup(participant_name, workitem, opts={})\n\n pinfo = participant_name.is_a?(String) ?\n lookup_info(participant_name, workitem) : participant_name\n\n instantiate(pinfo, opts)\n end", "def encode_workitem(wi)\n wi.params['participant_options'] = @options\n Rufus::Json.encode(wi.to_h)\n end", "def consume (workitem)\n\n #first, we specify the reply queue for the 'real' participant. \n\n workitem.reply_queue = workitem.params['reply_queue'] ||= @queue_name+\"_FIN\"\n workitem.pid = workitem.params['pid']\n\n msg = encode_workitem(workitem)\n\n message = @queue.send_message(msg)\n\n ldebug { \"consume() msg sent to queue #{@queue.url} id is #{message.id}\" }\n\n if workitem.params['reply_by_default'] || workitem.params['reply-anyway'] == true\n reply_to_engine( workitem )\n end\n \n \n end", "def get_child_id (workitem)\n\n return workitem.fei.child_id \\\n if workitem.fei.wfid == @synchable_fei.wfid\n\n workitem.fei.last_sub_instance_id\n end", "def root_workitem\n\n return nil unless root_expression\n\n Ruote::Workitem.new(root_expression.h.applied_workitem)\n end", "def participant\n self_link.try(:participant)\n end", "def encode_workitem(wi)\n\n wi.params['participant_options'] = @options\n\n Rufus::Json.encode(wi.to_h)\n end", "def use_item_to_actors\n $game_party.members[0].item_apply(user, item)\n end", "def participant\n market.participants[env['REMOTE_USER'].to_i]\n end", "def by_participant(participant_name, opts={})\n\n return @context.storage.by_participant(\n 'workitems', participant_name, opts\n ) if @context.storage.respond_to?(:by_participant)\n\n do_select(opts) do |hwi|\n hwi['participant_name'] == participant_name\n end\n end", "def issue_assignee(issue)\n issue.assignee\n end", "def reply (workitem)\n\n reply_to_parent(workitem)\n end", "def reply (workitem)\n\n reply_to_parent(workitem)\n end", "def do_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n participant.consume(workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name)\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end", "def proceed!\n participant.proceed(_workitem)\n end", "def decode_workitem( email )\n ldebug { \"decoding workitem from: #{email}\" }\n analysis_error_response( email )\n arwi_id = get_arwi_id_for_decode( email )\n puts \"listener got arwi:#{arwi_id}\"\n return unless arwi_id && arwi_id.to_s.size > 0\n workitem = MailItem.get_workitem( arwi_id, 'delete', \"listener\" )\n puts \"listener can not got workitem for arwi:#{arwi_id}\" unless workitem\n return unless workitem\n puts \"listener got wi:#{workitem.class}, #{workitem}\"\n workitem[\"attachment\"] = email[:attachment]\n workitem[\"email_from\"] = email[:from].join(',')\n begin\n SMOperation.build( email, workitem )\n email[:subject] = Kconv.toutf8(email[:subject])\n # _ps_type = $1 if /\\+([a-z]+)?_?([\\d]+)@/ =~ email[:to]\n # step = SMSpreadsheet.get_stepname_from_spreadsheet( workitem.fei.wfname, _ps_type )\n event = Hash.new\n event[:title] = \"#{email[:subject]}\"\n event[:desc] = \"#{email[:body]}\"\n calendar_name = workitem.fields['user_name'] || 'default'\n SMGoogleCalendar.create_event( event, calendar_name )\n rescue Exception => e\n puts \"decode_workitem error: #{e.message}\"\n end\n print \"#{@blue_underline}3.listener processed workitem:#{@normal} #{workitem}\\n\"\n workitem\n end", "def fexp(fei)\n\n fei = Ruote.extract_fei(fei)\n\n @expressions.find { |e| e.fei == fei }\n end", "def reply(workitem)\n\n reply_to_parent(workitem)\n end", "def recent_goal_item\n @recent_goal.stake_item\n end", "def do_raw_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n Ruote.participant_send(\n participant, [ :on_workitem, :consume ], 'workitem' => workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name,\n 'workitem' => msg['workitem'])\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end", "def dwp_work(work_item)\n dwp_log{ \"Working, item: #{work_item.inspect}\" }\n dwp_run_callback('before_work', work_item)\n work!(work_item)\n dwp_run_callback('after_work', work_item)\n end", "def my_participant_id\n return @my_participant_id\n end", "def load_workitem (workitem_id)\n\n @worklist = Worklist.new(session[:user])\n\n @workitem = OpenWFE::Extras::Workitem.find workitem_id\n\n @delegation_targets = @worklist.delegation_targets(@workitem)\n\n @fields, hidden_fields = filter_fields @workitem\n\n session[:workitem] = @workitem.id\n\n\n #@process_definition, @json_process_definition =\n # LaunchPermission.load_process_definition(\n # @workitem.full_fei.workflow_definition_url)\n\n pwfid = @workitem.full_fei.parent_wfid\n\n @json_process_definition =\n $openwferu_engine.process_representation(pwfid).to_json.to_s\n\n @paused = $openwferu_engine.is_paused?(pwfid)\n # a small digression (out of the worklist, into the engine)\n end", "def decode_workitem( msg )\n ldebug { \"decoding workitem from: #{msg}\" }\n\n # YAML?\n if msg.index('ruby/object:OpenWFE::InFlowWorkItem')\n YAML.load( msg )\n # XML?\n elsif msg =~ /^<.*>$/m\n OpenWFE::Xml.workitem_from_xml( msg )\n # Assume JSON encoded Hash\n else\n hash = OpenWFE::Json.decode(msg)\n OpenWFE.workitem_from_h( hash )\n end\n end", "def work!(work_item)\n raise NotImplementedError\n end", "def _on_reply(wi)\n Ruote.participant_send(self, :on_reply, 'workitem' => wi)\n end", "def recipient\n return self.unless_nil?('invitee.email', deliveries.unless_nil?('first.recipients', '') )\n end", "def participant_id\n return @participant_id\n end", "def participant_id\n return @participant_id\n end", "def workflow\n return @workflow\n end", "def pick_workitem (workitem_id)\n\n user = session[:user]\n\n workitem = OpenWFE::Extras::Workitem.find workitem_id\n\n workitem.store_name = \"users\"\n workitem.participant_name = user.name\n workitem.save!\n end", "def apply_notification\n @engine.send_notification({\n id: @intention_id,\n intention_type: self.class.to_s,\n },\n type: Demiurge::Notifications::IntentionApplied,\n zone: @item.zone_name,\n location: @item.location_name,\n actor: @item.name,\n include_context: true)\n nil\n end", "def work_influences\n find_related_frbr_objects( :is_influenced_by, :which_works?) \n end", "def selected_itinerary\n if selected?\n return itineraries.valid.selected.first\n else\n return nil\n end\n end", "def wfid\n\n l = [ @expressions, @errors, @stored_workitems ].find { |l| l.any? }\n\n l ? l.first.fei.wfid : nil\n end", "def first_name\n self.participant.user.first_name\n end", "def work_first_slice(worker, &block)\n raise 'Job must be running and in :before sub_state when calling #before_work' unless before_processing?\n if slice = input.first\n process_slice(worker, slice, &block)\n else\n 0\n end\n end", "def consume (workitem)\n\n workitem.attributes['compact_workitems'] = true if compact_workitems\n\n Workitem.from_owfe_workitem workitem\n # does the 'saving to db'\n end", "def reply_to_parent (workitem)\n\n get_expression_pool.reply_to_parent(self, workitem)\n end", "def working(args = {})\n args[:work_type] = WORK_TYPE\n workpattern(args)\n end", "def recurrence\n return @recurrence\n end", "def recurrence\n return @recurrence\n end", "def full_fei\n\n @full_fei ||= OpenWFE::FlowExpressionId.from_s(fei)\n end", "def full_fei\n\n @full_fei ||= OpenWFE::FlowExpressionId.from_s(fei)\n end", "def apply_notification\n @engine.send_notification({\n id: @intention_id,\n intention_type: self.class.to_s,\n queue_number: @action_queue_number,\n action_name: @action_name,\n action_args: @action_args,\n },\n type: Demiurge::Notifications::IntentionApplied,\n zone: @item.zone_name,\n location: @item.location_name,\n actor: @item.name,\n include_context: true)\n nil\n end", "def launch (raw_exp, workitem)\n\n onotify(:launch, raw_exp.fei, workitem)\n\n apply(raw_exp, workitem)\n end", "def consume (workitem)\n\n DataMapper.repository(@dm_repository) do\n\n kf = if @key_field and expstorage and @key_field.match(/\\$\\{[^\\}]+\\}/)\n Ruote.dosub(@key_field, expstorage[workitem.fei], workitem)\n elsif @key_field\n workitem.fields[@key_field]\n else\n nil\n end\n\n kf = kf ? kf.to_s : nil\n\n @dm_workitem_class.from_ruote_workitem(\n workitem, :store_name => @store_name, :key_field => kf)\n end\n end", "def selected_actor(i=nil)\n actor = nil\n if i == nil\n actor = @data[self.index]\n else\n actor = (index < 0 || self.index(i) < 0 ? nil : @data[self.index(i)])\n end\n return actor\n end", "def selected_actor(i=nil)\n actor = nil\n if i == nil\n actor = @data[self.index]\n else\n actor = (index < 0 || self.index(i) < 0 ? nil : @data[self.index(i)])\n end\n return actor\n end", "def consume (workitem)\n\n workitem.attributes['compact_workitems'] = true if compact_workitems\n\n Workitem.from_owfe_workitem(workitem, @store_name)\n end", "def item\n\t\tself.bmet_work_order.bmet_item\n\tend", "def fexp(wi_or_fei=nil)\n\n flow_expression(wi_or_fei || fei)\n end", "def experiment_applied\n application = Application.first\n ParticipantMailer.experiment_applied(application.participant, [application.schedule])\n end", "def item\n IITEQPreset.new(@ole.Item)\n end", "def item\n IITTrack.new(@ole.Item)\n end", "def reg_participants\n puts \"#{self.thread_name} engine particpant setup\"\n # SETUP MUST BE CALLED.\n # ANY exceptions or errors in the participants aborts the workflow and are hard to find. YOU HAVE BEEN WARNED\n self.wfe_engine.register_participant :setup do |workitem|\n puts \"------> setup got a workitem...\" if @debug\n target = ['[email protected]', '[email protected]']\n workitem.sms_source = \"992\"\n workitem.my_hostname = Socket.gethostname \n workitem.sms_message = \"no message\"\n workitem.email_target = target\n # workitem.email_from = \"[email protected]\"\n workitem.workflow_status = \"false\"\n workitem.process_result = \"false\"\n workitem.final_response=\"failure\"\n puts \"<------- end of setup\" if @debug\n end\n # self.wfe_engine.register_participant( \n # 'bal_transfer', \n # OpenWFE::Extras::ActiveStoreParticipant.new('bal_transfer\n#self.wfe_engine.register_participant :bal_transfer do |workitem|\n# puts \"bal_transfer got a workitem...\"\n# workitem.particpant = 'bal_transfer'\n# workitem.store = 'bal_transfer'\n# workitem.save\n#end\n#FIX LATER\n s=%w(bal_transfer pasaload dispense_pin dealer_load load process2 )\n s.each {|i|# self.wfe_engine.register_participant( \"#{i}_store\", ActiveTracker.new(\"#{i}\")) \n puts \"---REG PARticipant #{i}_store \"\n self.wfe_engine.register_participant \"#{i}_store\" do |workitem|\n puts \"#{i}_store got a workitem...\"\n #workitem.monkey_comment = \"this thing looks interesting\"\n end \n }\n \n self.wfe_engine.register_participant :credit do |workitem|\n puts \"----> credit action got a workitem...\" if @debug\n workitem.credit_result=false\n res= self.billing_action('credit',workitem.credit_msisdn,workitem.peso_value )\n puts \"action credit msisdn #{workitem.credit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n puts \"<----credit action finished res #{res}...\" if @debug\n workitem.process_result=res\n end\n self.wfe_engine.register_participant :pasaload do |workitem|\n puts \"----> pasaload action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"992\"\n puts \"before action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('pasaload',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----pasaload action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dealer_load do |workitem|\n puts \"----> dealer load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"913\"\n puts \"before action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dealer_load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----dealer load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n end\n self.wfe_engine.register_participant :load do |workitem|\n puts \"----> load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"990\"\n puts \"before action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.loadvalue=res[1] if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dispense_pin do |workitem|\n puts \"----> dispense_pin action got a workitem...\" if @debug\n workitem.process_result=false\n puts \"before action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dispense_pin', workitem.source_msisdn, workitem.value, workitem.dest_msisdn)\n puts \"action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res.to_s}\"\n puts \"<----load action finished res #{res}...\" if @debug\n # result = YAML.load\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.pin=res[1] if res[0]=='true'\n \n end\n \n \n self.wfe_engine.register_participant :debit do |workitem|\n puts \"----> debit action got a workitem...\" if @debug\n workitem.debit_result=false \n # peso charge -- could be variable\n value=-1*workitem.peso_value.to_i-1\n res=self.billing_action('debit',workitem.debit_msisdn,value.to_s )\n puts \"action debit msisdn #{workitem.debit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n workitem.process_result=res\n workitem.process_message=res\n puts \"<----debit action finsihed res #{res}...\" if @debug\n end\n self.wfe_engine.register_participant :monkey do |workitem|\n puts \"monkey got a workitem...\"\n workitem.monkey_comment = \"this thing looks interesting\"\n end\n self.wfe_engine.register_participant :intprocess2 do |workitem|\n puts \"process2 got a workitem...\"\n workitem.process2_comment = \"yeah process 2\"\n end\n self.wfe_engine.register_participant :bob do |workitem|\n puts \"bob got a workitem...\"\n workitem.bob_comment = \"not for me, I prefer VB\"\n workitem.bob_comment2 = \"Bob rules\"\n workitem.final_response = \"all ok\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.final_response\n end\n self.wfe_engine.register_participant :sms do |workitem|\n puts \"sms got a workitem...\"\n puts \"sms #{workitem.sms_destination} message: #{workitem.sms_message}\"\n res=send_sms(workitem.sms_message,workitem.sms_destination, workitem.sms_source)\n workitem.problem=!res \n end\n # needs workitem.email_target set\n mailp=OpenWFE::MailParticipant.new(\n :smtp_server => \"mail2.cure.com.ph\",\n :smtp_port => 25,\n :from_address => \"[email protected]\"\n ) do |workitem|\n puts \"----> mail got workitem\"\n s = \"\"\n duration=Time.now-self.start_time\n s << \"Subject: Workflow PROCESS [#{workitem.process_name}] [#{workitem.final_response}]\\n\\n\"\n s << \"result is #{workitem.final_response}\\n\"\n s << \"Processing Time so far: #{duration} \\n\"\n s << \"summary of process #{workitem.fei.workflow_instance_id}\\n\"\n workitem.attributes.each do |k, v|\n s << \" - #{k} : '#{v}'\\n\"\n end \n s << \"Time: #{Time.new.to_s}\\n\"\n puts \"----> leaving mail\"\n s\n end\n self.wfe_engine.register_participant( \n \"mail\", mailp)\n \n \n self.wfe_engine.register_participant :debug do |workitem|\n puts \"--->debug got a workitem...\"\n puts \"--status of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n puts \" - #{k} : '#{v}'\"\n end\n puts '<------end of debug'\n end\n # summarize must be called to set final_response\n self.wfe_engine.register_participant :summarize do |workitem|\n puts \"---->Summarize got a workitem...\"\n # workitem.final_response=\"all ok\" if workitem.attributes['process_result']=='true' \n puts \"result is #{workitem.final_response}\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.process_message\n puts \"summary of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n # next unless k.match \".*_comment$\"\n puts \" - #{k} : '#{v}'\"\n end\n puts '<-------end of summary'\n end\n self.wfe_engine.register_participant :reverse_charges do |workitem|\n puts \"-----> reverse got a workitem...\"\n res=false\n if workitem.attributes['debit_result']=='true'\n value=1*workitem.peso_value.to_i+1\n res=self.billing_action('credit',workitem.debit_msisdn,value.to_s )\n puts \"return from reversing debit: #{res}\"\n end\n if workitem.attributes['credit_result']=='true'\n res= self.billing_action('debit',workitem.credit_msisdn,workitem.peso_value )\n puts \"return from reversing credit: #{res}\"\n end\n puts 'end of reverse charges'\n end\n self.wfe_engine.register_participant :process_failure do |workitem|\n puts \"----> process_failure got a workitem...\"\n res=false\n # res=send_sms(\"There was a problem with your request (process id:'#{workitem.fei.workflow_instance_id})'. Call *999 if you require further information\", workitem.source_msisdn, workitem.sms_source)\n puts \"<------ out of process failure\"\n end\n self.wfe_engine.register_participant :inform_success_pasa do |workitem|\n puts \"---->Inform_success_pasa got a workitem...\"\n res=true\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have sent #{workitem.value} pesos to #{workitem.dest_msisdn}: (process id:'#{workitem.fei.workflow_instance_id})'\", workitem.source_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.value} pesos from #{workitem.source_msisdn}: To check your balance, text BAL to 991\", workitem.dest_msisdn,workitem.sms_source) and res\n #(process id:#{workitem.fei.workflow_instance_id})\n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success_dispense_pin do |workitem|\n puts \"---->Inform_success_dispense_pin got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"Your pin is #{workitem.loadvalue} via tracking process id:'#{workitem.fei.workflow_instance_id}'\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_success_dispense_pin\"\n res\n end\n self.wfe_engine.register_participant :inform_success_load do |workitem|\n puts \"---->Inform_success_load got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have loaded #{workitem.loadvalue} pesos (process id: #{workitem.fei.workflow_instance_id})\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success do |workitem|\n puts \"Inform_success got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"You have sent #{workitem.peso_value} peso to #{workitem.credit_msisdn}: (process id:'#{workitem.fei.workflow_instance_id}')\", workitem.debit_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.peso_value} pesos from #{workitem.debit_msisdn}: tracking process id:'#{workitem.fei.workflow_instance_id}' \",workitem.credit_msisdn,workitem.sms_source) and res\n end\n end\n \nend", "def lookup_attribute (attname, workitem)\n\n attname\n end", "def get_meeting_participaton(user_to_search)\n\t\tmeeting_participations.find_by(user_id: user_to_search.id)\n\tend", "def consume (workitem)\n\n reply_to_engine(workitem)\n end", "def lookup_variable_or_field_value (workitem)\n\n lookup_var_value(workitem) || lookup_field_value(workitem)\n end", "def save!\n ScriptoriaCore::Ruote.engine.storage_participant.do_update(_workitem)\n end", "def job_placeholder_of(task, cycle)\n if task.kind_of?(Roby::Interface::Job)\n _, snapshot, * = history[cycle]\n task\n .enum_parent_objects(snapshot.relations[Roby::TaskStructure::PlannedBy])\n .first\n end\n end", "def util_item_open_party_sequence(item, extend_data, result_process)\n call_scene(GamePlay::Party_Menu, @team || $actors, :item, extend_data, no_leave: false) do |scene|\n if $game_temp.in_battle && scene.return_data != -1\n @return_data = [item.id, extend_data, scene.return_data]\n @running = false\n next\n end\n $bag.remove_item(item.id, 1) if item.limited && scene.return_data != -1\n result_process&.call\n end\n return false unless @running\n\n return extend_data\n end" ]
[ "0.69228023", "0.673776", "0.64550436", "0.6228524", "0.621126", "0.620049", "0.6040509", "0.6015035", "0.5945306", "0.59317875", "0.570277", "0.5623642", "0.55669945", "0.5513758", "0.5512242", "0.5394764", "0.5365102", "0.53589064", "0.5353701", "0.53218883", "0.52656335", "0.5262282", "0.5114896", "0.508559", "0.5058784", "0.50543255", "0.5036681", "0.50042516", "0.5001964", "0.49957335", "0.49863258", "0.49354336", "0.49062577", "0.48956612", "0.48097122", "0.48055866", "0.47996876", "0.47787663", "0.47466964", "0.4737251", "0.4714977", "0.4692381", "0.46736366", "0.46697733", "0.466335", "0.46492735", "0.4633196", "0.46242607", "0.46215472", "0.46215472", "0.4618488", "0.46093214", "0.45990038", "0.4586875", "0.45848647", "0.45822442", "0.45791", "0.4573456", "0.4565483", "0.45555463", "0.45134604", "0.4481211", "0.44590116", "0.44366223", "0.44223708", "0.44223708", "0.4416315", "0.44053894", "0.4390154", "0.4389318", "0.43772674", "0.4346344", "0.4331881", "0.43260628", "0.43245432", "0.43187425", "0.43184426", "0.430905", "0.430905", "0.4302805", "0.4302805", "0.42984995", "0.4296387", "0.42865813", "0.42680693", "0.42680693", "0.42645556", "0.42625815", "0.4259622", "0.42589262", "0.42467424", "0.42430344", "0.42220026", "0.42217126", "0.42156598", "0.42130795", "0.42121395", "0.41990826", "0.41966474", "0.41864288" ]
0.6482672
2
Up until ruote 2.3.0, the participant name had to be fetched from the workitem. This is a shortcut, it lets you write participant code that look like def on_workitem (workitem.fields['supervisors'] || []) << participant_name reply end
def participant_name workitem.participant_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def participant_name\n\n h.participant_name\n end", "def participant\n ScriptoriaCore::Ruote.engine.participant(participant_name)\n end", "def first_name\n self.participant.user.first_name\n end", "def per_participant\n\n each_with_object({}) { |wi, h| (h[wi.participant_name] ||= []) << wi }\n end", "def participant=(part)\n @participant = part\n end", "def my_participant_id\n return @my_participant_id\n end", "def by_participant(participant_name, opts={})\n\n return @context.storage.by_participant(\n 'workitems', participant_name, opts\n ) if @context.storage.respond_to?(:by_participant)\n\n do_select(opts) do |hwi|\n hwi['participant_name'] == participant_name\n end\n end", "def add_participant(user) # :nodoc:\n id = user.to_s.downcase\n if @participant_ids.include?(id)\n logger.warning(\"Attempted to add a participant who was already in the wavelet(#{@id}): #{id}\")\n return nil\n end\n\n # Allow string names to be used as participant.\n user = if @context.users[id]\n @context.users[id]\n else\n @context.add_user(:id => id)\n end\n\n @context.add_operation(:type => Operation::WAVELET_ADD_PARTICIPANT,\n :wave_id => @wave_id, :wavelet_id => @id, :property => user)\n @participant_ids << id\n \n user\n end", "def add_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n comment = params[\"comment\"].nil? ? \"\" : params[\"comment\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n participant_ids.each do |participant_id|\n unless meeting.participants.exists?(participant_id)\n new_participant = User.find(participant_id)\n meeting.participants << new_participant\n # add default vote for the new added participant to each suggestion\n meeting.suggestions.each do |suggestion|\n suggestion.votes << Vote.new(:voter => new_participant, :decision => \"?\")\n end\n\n NotificationService.send_meeting_invitation(user, new_participant, meeting, comment)\n end\n end\n self.send_ok\n else\n self.send_error 401\n end\n end", "def ab_add_participant(experiment, alternative, identity)\n VanityParticipant.retrieve(experiment, identity, true, seen: alternative)\n end", "def subject_for_recommand_friends_stage_1(invited_user)\n return \"#{@referrer.name} vous invite à créer votre profil sur CoursAvenue\"\n end", "def participant_staff(participant)\n if participant && participant.completed_event?(screener_event)\n staff_name(originating_staff_id(participant))\n end\n end", "def ab_add_participant(_experiment, _alternative, _identity)\n raise \"Not implemented\"\n end", "def participants_list_name\n @browser.text_field(:id=>\"addarea_participants_name\")\n end", "def participant\n self_link.try(:participant)\n end", "def lookup_info(pname, workitem)\n\n return nil unless pname\n\n wi = workitem ?\n Ruote::Workitem.new(workitem.merge('participant_name' => pname)) :\n nil\n\n get_list['list'].each do |regex, pinfo|\n\n next unless pname.match(regex)\n\n return pinfo if workitem.nil?\n\n pa = instantiate(pinfo, :if_respond_to? => :accept?)\n\n return pinfo if pa.nil?\n return pinfo if Ruote.participant_send(pa, :accept?, 'workitem' => wi)\n end\n\n # nothing found...\n\n nil\n end", "def participants\n attributes['participants'] ||= []\n attributes['participants']\n end", "def prepare\n [ \"alpha\", \"bravo\", \"charly\" ].each do |name|\n\n @engine.register_participant(name) do |workitem|\n\n workitem.attributes[name] = true\n workitem.attributes[\"key\"] = name\n end\n end\n\n #@engine.register_participant(\"display_workitem\") do |workitem|\n # puts\n # puts\n #end\n end", "def participant\n market.participants[env['REMOTE_USER'].to_i]\n end", "def lookup(participant_name, workitem, opts={})\n\n pinfo = participant_name.is_a?(String) ?\n lookup_info(participant_name, workitem) : participant_name\n\n instantiate(pinfo, opts)\n end", "def reg_participants\n puts \"#{self.thread_name} engine particpant setup\"\n # SETUP MUST BE CALLED.\n # ANY exceptions or errors in the participants aborts the workflow and are hard to find. YOU HAVE BEEN WARNED\n self.wfe_engine.register_participant :setup do |workitem|\n puts \"------> setup got a workitem...\" if @debug\n target = ['[email protected]', '[email protected]']\n workitem.sms_source = \"992\"\n workitem.my_hostname = Socket.gethostname \n workitem.sms_message = \"no message\"\n workitem.email_target = target\n # workitem.email_from = \"[email protected]\"\n workitem.workflow_status = \"false\"\n workitem.process_result = \"false\"\n workitem.final_response=\"failure\"\n puts \"<------- end of setup\" if @debug\n end\n # self.wfe_engine.register_participant( \n # 'bal_transfer', \n # OpenWFE::Extras::ActiveStoreParticipant.new('bal_transfer\n#self.wfe_engine.register_participant :bal_transfer do |workitem|\n# puts \"bal_transfer got a workitem...\"\n# workitem.particpant = 'bal_transfer'\n# workitem.store = 'bal_transfer'\n# workitem.save\n#end\n#FIX LATER\n s=%w(bal_transfer pasaload dispense_pin dealer_load load process2 )\n s.each {|i|# self.wfe_engine.register_participant( \"#{i}_store\", ActiveTracker.new(\"#{i}\")) \n puts \"---REG PARticipant #{i}_store \"\n self.wfe_engine.register_participant \"#{i}_store\" do |workitem|\n puts \"#{i}_store got a workitem...\"\n #workitem.monkey_comment = \"this thing looks interesting\"\n end \n }\n \n self.wfe_engine.register_participant :credit do |workitem|\n puts \"----> credit action got a workitem...\" if @debug\n workitem.credit_result=false\n res= self.billing_action('credit',workitem.credit_msisdn,workitem.peso_value )\n puts \"action credit msisdn #{workitem.credit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n puts \"<----credit action finished res #{res}...\" if @debug\n workitem.process_result=res\n end\n self.wfe_engine.register_participant :pasaload do |workitem|\n puts \"----> pasaload action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"992\"\n puts \"before action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('pasaload',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----pasaload action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dealer_load do |workitem|\n puts \"----> dealer load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"913\"\n puts \"before action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dealer_load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----dealer load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n end\n self.wfe_engine.register_participant :load do |workitem|\n puts \"----> load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"990\"\n puts \"before action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.loadvalue=res[1] if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dispense_pin do |workitem|\n puts \"----> dispense_pin action got a workitem...\" if @debug\n workitem.process_result=false\n puts \"before action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dispense_pin', workitem.source_msisdn, workitem.value, workitem.dest_msisdn)\n puts \"action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res.to_s}\"\n puts \"<----load action finished res #{res}...\" if @debug\n # result = YAML.load\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.pin=res[1] if res[0]=='true'\n \n end\n \n \n self.wfe_engine.register_participant :debit do |workitem|\n puts \"----> debit action got a workitem...\" if @debug\n workitem.debit_result=false \n # peso charge -- could be variable\n value=-1*workitem.peso_value.to_i-1\n res=self.billing_action('debit',workitem.debit_msisdn,value.to_s )\n puts \"action debit msisdn #{workitem.debit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n workitem.process_result=res\n workitem.process_message=res\n puts \"<----debit action finsihed res #{res}...\" if @debug\n end\n self.wfe_engine.register_participant :monkey do |workitem|\n puts \"monkey got a workitem...\"\n workitem.monkey_comment = \"this thing looks interesting\"\n end\n self.wfe_engine.register_participant :intprocess2 do |workitem|\n puts \"process2 got a workitem...\"\n workitem.process2_comment = \"yeah process 2\"\n end\n self.wfe_engine.register_participant :bob do |workitem|\n puts \"bob got a workitem...\"\n workitem.bob_comment = \"not for me, I prefer VB\"\n workitem.bob_comment2 = \"Bob rules\"\n workitem.final_response = \"all ok\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.final_response\n end\n self.wfe_engine.register_participant :sms do |workitem|\n puts \"sms got a workitem...\"\n puts \"sms #{workitem.sms_destination} message: #{workitem.sms_message}\"\n res=send_sms(workitem.sms_message,workitem.sms_destination, workitem.sms_source)\n workitem.problem=!res \n end\n # needs workitem.email_target set\n mailp=OpenWFE::MailParticipant.new(\n :smtp_server => \"mail2.cure.com.ph\",\n :smtp_port => 25,\n :from_address => \"[email protected]\"\n ) do |workitem|\n puts \"----> mail got workitem\"\n s = \"\"\n duration=Time.now-self.start_time\n s << \"Subject: Workflow PROCESS [#{workitem.process_name}] [#{workitem.final_response}]\\n\\n\"\n s << \"result is #{workitem.final_response}\\n\"\n s << \"Processing Time so far: #{duration} \\n\"\n s << \"summary of process #{workitem.fei.workflow_instance_id}\\n\"\n workitem.attributes.each do |k, v|\n s << \" - #{k} : '#{v}'\\n\"\n end \n s << \"Time: #{Time.new.to_s}\\n\"\n puts \"----> leaving mail\"\n s\n end\n self.wfe_engine.register_participant( \n \"mail\", mailp)\n \n \n self.wfe_engine.register_participant :debug do |workitem|\n puts \"--->debug got a workitem...\"\n puts \"--status of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n puts \" - #{k} : '#{v}'\"\n end\n puts '<------end of debug'\n end\n # summarize must be called to set final_response\n self.wfe_engine.register_participant :summarize do |workitem|\n puts \"---->Summarize got a workitem...\"\n # workitem.final_response=\"all ok\" if workitem.attributes['process_result']=='true' \n puts \"result is #{workitem.final_response}\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.process_message\n puts \"summary of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n # next unless k.match \".*_comment$\"\n puts \" - #{k} : '#{v}'\"\n end\n puts '<-------end of summary'\n end\n self.wfe_engine.register_participant :reverse_charges do |workitem|\n puts \"-----> reverse got a workitem...\"\n res=false\n if workitem.attributes['debit_result']=='true'\n value=1*workitem.peso_value.to_i+1\n res=self.billing_action('credit',workitem.debit_msisdn,value.to_s )\n puts \"return from reversing debit: #{res}\"\n end\n if workitem.attributes['credit_result']=='true'\n res= self.billing_action('debit',workitem.credit_msisdn,workitem.peso_value )\n puts \"return from reversing credit: #{res}\"\n end\n puts 'end of reverse charges'\n end\n self.wfe_engine.register_participant :process_failure do |workitem|\n puts \"----> process_failure got a workitem...\"\n res=false\n # res=send_sms(\"There was a problem with your request (process id:'#{workitem.fei.workflow_instance_id})'. Call *999 if you require further information\", workitem.source_msisdn, workitem.sms_source)\n puts \"<------ out of process failure\"\n end\n self.wfe_engine.register_participant :inform_success_pasa do |workitem|\n puts \"---->Inform_success_pasa got a workitem...\"\n res=true\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have sent #{workitem.value} pesos to #{workitem.dest_msisdn}: (process id:'#{workitem.fei.workflow_instance_id})'\", workitem.source_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.value} pesos from #{workitem.source_msisdn}: To check your balance, text BAL to 991\", workitem.dest_msisdn,workitem.sms_source) and res\n #(process id:#{workitem.fei.workflow_instance_id})\n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success_dispense_pin do |workitem|\n puts \"---->Inform_success_dispense_pin got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"Your pin is #{workitem.loadvalue} via tracking process id:'#{workitem.fei.workflow_instance_id}'\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_success_dispense_pin\"\n res\n end\n self.wfe_engine.register_participant :inform_success_load do |workitem|\n puts \"---->Inform_success_load got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have loaded #{workitem.loadvalue} pesos (process id: #{workitem.fei.workflow_instance_id})\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success do |workitem|\n puts \"Inform_success got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"You have sent #{workitem.peso_value} peso to #{workitem.credit_msisdn}: (process id:'#{workitem.fei.workflow_instance_id}')\", workitem.debit_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.peso_value} pesos from #{workitem.debit_msisdn}: tracking process id:'#{workitem.fei.workflow_instance_id}' \",workitem.credit_msisdn,workitem.sms_source) and res\n end\n end\n \nend", "def workitems\n\n @expressions.select { |fexp|\n #fexp.is_a?(Ruote::Exp::ParticipantExpression)\n fexp.h.name == 'participant'\n }.collect { |fexp|\n Ruote::Workitem.new(fexp.h.applied_workitem)\n }\n end", "def append_name\n self.name = \"Guest Answer: #{self.survey.name}: #{self.answer.content}\"\n end", "def my_participant_id=(value)\n @my_participant_id = value\n end", "def add_participants(participants)\n participants.each do |p|\n self.add_default_contact_reason(p)\n end\n end", "def pt_memb_name\n {:name=>$game_party.members[@party_index_tb].name}\n end", "def recupNom(participant_nom)\n @participants.each do |participant|\n if participant.nom == participant_nom\n return participant\n end\n end\n end", "def add_participants_to_global_competition\n\t\tusers = User.where({:in_grand_competition=>true})\n\t\t\n\t\tinvitation_count = 0\n\t\tusers.each do |user|\n\t\t\tCompetitionParticipant.add_participant(user.id, self.id)\n\t\t\tinvitation_count += 1\n\t\tend\n\t\tAppMailer.global_race_admin_notify(self.id, users.length, invitation_count).deliver\n\t\t\n\t\treturn \"#{self.name} created. #{invitation_count}/#{users.length} users invited.\"\n\tend", "def participant_id\n return @participant_id\n end", "def participant_id\n return @participant_id\n end", "def register(name, participant, options, block)\n\n entry = to_entry(name, participant, options, block)\n\n key = entry.first\n options = entry.last.last\n\n list = get_list\n\n position = options['position'] || options['pos'] || 'last'\n\n if position == 'before'\n\n position = list['list'].index { |e| e.first == key } || -1\n\n elsif position == 'after'\n\n position = (list['list'].rindex { |e| e.first == key } || -2) + 1\n\n elsif position == 'over'\n\n position = list['list'].index { |e| e.first == key } || -1\n list['list'].delete_at(position) unless position == -1\n\n elsif options.delete('override') != false\n\n list['list'].delete_if { |e| e.first == key }\n # enforces only one instance of a participant per key/regex\n end\n\n case position\n when 'last' then list['list'] << entry\n when 'first' then list['list'].unshift(entry)\n when Fixnum then list['list'].insert(position, entry)\n else raise \"cannot insert participant at position '#{position}'\"\n end\n\n if r = @context.storage.put(list)\n #\n # if put returns something it means the put failed, have to redo the\n # work...\n #\n return register(name, participant, options, block)\n end\n\n if entry.last.first == 'Ruote::StorageParticipant'\n Ruote::StorageParticipant.new(@context)\n else\n nil\n end\n end", "def participants=(value)\n @participants = value\n end", "def participants=(value)\n @participants = value\n end", "def to_ruote_workitem\n\n wi = Ruote::Workitem.new\n\n wi.fei = Ruote::FlowExpressionId.from_s(fei)\n wi.fields = Ruote::Json.decode(wi_fields)\n wi.participant_name = participant_name\n\n wi\n end", "def encode_workitem(wi)\n wi.params['participant_options'] = @options\n Rufus::Json.encode(wi.to_h)\n end", "def object_participant_name( object )\n case object\n when Symbol, String\n object.to_s.dasherize\n else\n (object.class.to_s + '-' + object.id.to_s).downcase\n end\n end", "def subject_for_recommand_friends(invited_user)\n return \"#{@referrer.name} vous invite à créer votre profil sur CoursAvenue\"\n end", "def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Api.V2010.ParticipantContext #{context}>\"\n end", "def reporthelp_work_breakdown_item_name( item )\n item = item[ :item ]\n\n if ( item.class == User )\n return \"by #{ h( item.name ) }\".html_safe()\n else\n return \"on '#{ h( item.augmented_title ) }'\".html_safe()\n end\n end", "def add_participant_list(list)\n participants_list\n participants_list_name.set list[:name]\n participants_list_permissions.select list[:visible]\n \n create\n end", "def participants(*vals)\n\t\t\[email protected] = Array(vals).map{|v| v.to_sym}\n\t\tend", "def participation employer_name, employer_id, total, enrolled, waived, plan_years, contacts\n total_employees = total_employees employer_name\n summary = summary_details employer_name, total_employees\n employer_details = summary.clone\n employer_util = ::EmployerUtil.new details: employer_details, plan_years: plan_years, total_employees: total_employees\n employer_util.add_plan_details\n\n employee_util = ::EmployeeUtil.new use_case_directory: @use_case_directory,\n employer_name: employer_name,\n enrolled: enrolled, plan_years: plan_years,\n total_employees: total_employees, waived: waived\n roster = employee_util.add_roster\n add_to_summary contacts, employer_util, plan_years, roster, summary, total_employees\n summary\n end", "def new_participants=(value)\n @new_participants = value\n end", "def pick_workitem (workitem_id)\n\n user = session[:user]\n\n workitem = OpenWFE::Extras::Workitem.find workitem_id\n\n workitem.store_name = \"users\"\n workitem.participant_name = user.name\n workitem.save!\n end", "def listerParticipants\n puts \"\"\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n @participants.each do |participant|\n puts \" #{participant.nom.upcase}[#{participant.initiative}] - PV(#{participant.pv} / #{participant.pv_max}) >> #{participant.etat}\"\n end\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n puts \"\"\n end", "def encode_workitem(wi)\n\n wi.params['participant_options'] = @options\n\n Rufus::Json.encode(wi.to_h)\n end", "def child\n participant.person\n end", "def participant=(participant)\n ppl = self_link\n if ppl\n ppl.participant = participant\n else\n participant_person_links.build(:relationship_code => 1, :person => self, :participant => participant, :psu => self.psu)\n end\n end", "def invitee_string\n\t\n\tend", "def getParticipants\r\n\t\t\t\t\treturn @participants\r\n\t\t\t\tend", "def participant_params\n params.require(:participant).permit(:name)\n end", "def name_of_person_of_ticket\n self.viewer.name\n \n end", "def participant_id=(value)\n @participant_id = value\n end", "def participant_id=(value)\n @participant_id = value\n end", "def insured_name\n id, qual = eob.member_id_and_qualifier\n sub_name_ele = []\n sub_name_ele << 'NM1'\n sub_name_ele << 'IL'\n sub_name_ele << '1'\n sub_name_ele << eob.subscriber_last_name\n sub_name_ele << eob.subscriber_first_name\n sub_name_ele << eob.subscriber_middle_initial\n sub_name_ele << ''\n sub_name_ele << eob.subscriber_suffix\n sub_name_ele << qual\n sub_name_ele << id\n sub_name_ele = Output835.trim_segment(sub_name_ele)\n sub_name_ele.join(@element_seperator)\n end", "def focusParticipants(compteur)\n puts @participants[compteur].nom\n end", "def challenge_participants\n search_param = params[params[:fieldname]]\n collection_id = params[:collection_id]\n render_output(Pseud.limit(10).order(:name).joins(:challenge_signups)\n .where([\"pseuds.name LIKE ? AND challenge_signups.collection_id = ?\", \n '%' + search_param + '%', collection_id]).map(&:byline))\n end", "def add_owner_to_participants\n EventParticipant.create(user_id: self.user_id, event_id: self.id)\n end", "def invite_subject\n \"Your invitation to #{org_name.possessive} Creative Difference Dashboard\"\n end", "def byline\n parens = self.support_response? ? \" (volunteer)\" : \"\"\n self.support_identity.name + parens\n end", "def welcome_new_webinar_participant(participant)\n @participant = participant\n mail(to: @participant.email, from: \"Eventos <[email protected]>\", subject: \"Kleer | #{@participant.event.event_type.name}\" )\n end", "def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Api.V2010.ParticipantContext #{context}>\"\n end", "def to_s\n '#<Twilio.Api.V2010.ParticipantList>'\n end", "def reply(workitem)\n\n puts '-' * 80\n puts '*** WARNING : please use the Ruote::StorageParticipant#proceed(wi)'\n puts ' instead of #reply(wi) which is deprecated'\n #caller.each { |l| puts l }\n puts '-' * 80\n\n proceed(workitem)\n end", "def participant_params\n params.require(:participant).permit(:first_name, :last_name, :email, :company, :location, :job_title)\n end", "def print_tribe_name\n\t\tputs \"\\nParticipating Tribe: #{@name.blue}\"\n\tend", "def on_workitem\n\n doc = workitem.to_h\n\n doc.merge!(\n 'type' => 'workitems',\n '_id' => to_id(doc['fei']),\n 'participant_name' => doc['participant_name'],\n 'wfid' => doc['fei']['wfid'])\n\n doc['store_name'] = @store_name if @store_name\n\n @context.storage.put(doc, :update_rev => true)\n end", "def invite_people\n end", "def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.ParticipantInstance #{values}>\"\n end", "def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.ParticipantInstance #{values}>\"\n end", "def custom_advisor(advisor)\n advisor.employee.person.name\n end", "def participant_params\n\t\tparams.require(:myo_participant).permit(:participant_id, :tracms_myo_id, :name, :scheduled_date, :exam_date, :myo_visit, :redcap_intake_q, :redcap_ms_info, :redcap_whodas, :redcap_health_intake, :mrn)\n\tend", "def to_s\n context = @solution.map {|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Api.V2010.ParticipantContext #{context}>\"\n end", "def insured_name\n if @eob_type != 'Patient'\n id, qual = @eob.member_id_and_qualifier\n ['NM1', 'IL', '1', @eob.subscriber_last_name, @eob.subscriber_first_name,\n @eob.subscriber_middle_initial, '', @eob.subscriber_suffix, qual,id].trim_segment.join(@element_seperator)\n end\n end", "def partners\n end", "def to_s\n '#<Twilio.Api.V2010.ParticipantList>'\n end", "def no_participants\n \"No se admiten participantes\"\n end", "def name\n if @actors.size == 0\n return ''\n elsif @actors.size == 1\n return members[0].name\n else\n return sprintf(Vocab::PartyName, members[0].name)\n end\n end", "def new_participant(user, testmail=nil)\n @user = user\n @study = user.study\n email_with_name = testmail || \"#{@user.name} <#{user.email}>\"\n mail(:to => email_with_name, :subject => I18n.t('users.participant.new.mail.subject', :study => @study.title))\n end", "def add_participant(course_id, user)\n if CourseParticipant.find_by(parent_id: course_id, user_id: user.id).nil?\n CourseParticipant.create(parent_id: course_id, user_id: user.id, permission_granted: user.master_permission_granted)\n end\n end", "def yourself(stage_name, firstname, surname, quirk, special_talent)\n\n if check_if_exists?(stage_name)\n you = SpiceGirl.new(stage_name, firstname, surname, quirk, special_talent)\n append_member(you)\n else\n raise \"You already have a girl of that name\"\n end\n end", "def existing_workplace_invite(sender, invite, recipient_email, recipient_name, workplace)\n @sender = sender\n @invite = invite\n @recipient_email = recipient_email\n @recipient_name = recipient_name\n @workplace = workplace \n mail(to: \"#{@recipient_email}\", subject: \"#{@sender.name} added you to an Ossemble Workplace\")\n end", "def participant_params\n params.require(:participant).permit(:name)\n end", "def participants\n @participants ||= AssignmentParticipant.find(:all, :conditions => ['parent_id = ? and user_id IN (?)', parent_id, users])\n end", "def participants\n @participants ||= AssignmentParticipant.find(:all, :conditions => ['parent_id = ? and user_id IN (?)', parent_id, users])\n end", "def participants\n @participants ||= AssignmentParticipant.find(:all, :conditions => ['parent_id = ? and user_id IN (?)', parent_id, users])\n end", "def the_title\n if object.is_group_conversation?\n object.group_title\n else\n other_participant.try(:full_name, false, :now) || \"Anonymous\"\n end\n end", "def add_to_database\n Partner.add({\"assignment_id\" => \"#{self.assignment_id}\", \"name_worked\" => \"#{self.name_worked}\"})\n end", "def test_participant_re_dispatch_no_params\n\n @dashboard.register_participant :alpha, ReluctantParticipant\n\n assert_trace(%w[ x x ], Ruote.define { alpha })\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.ParticipantInstance #{values}>\"\n end", "def name\n person_name\n end", "def interviewer_full_name\n \"#{self.interviewer_first_name.capitalize} #{self.interviewer_last_name.upcase}\"\n end", "def userinfo\n @participant = Participant.find(session[:user])\n end", "def pbRegisterPartner(trainerid,trainername,partyid=0)\n Kernel.pbCancelVehicles\n trainer=pbLoadTrainer(trainerid,trainername,partyid)\n Events.onTrainerPartyLoad.trigger(nil,trainer)\n trainerobject=PokeBattle_Trainer.new(_INTL(trainer[0].name),trainerid)\n trainerobject.setForeignID($Trainer)\n for i in trainer[2]\n i.trainerID=trainerobject.id\n i.ot=trainerobject.name\n i.calcStats\n end\n $PokemonGlobal.partner=[trainerid,trainerobject.name,trainerobject.id,trainer[2]]\nend", "def participant_id\n case claimant_class_name\n when VeteranClaimant.name\n veteran.participant_id\n when OtherClaimant.name\n \"\"\n when HealthcareProviderClaimant.name\n \"\"\n else\n request_params[:claimant]\n end\n end", "def participants\n recipients\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.ParticipantInstance #{values}>\"\n end", "def invite_user(username)\n pending_msg = \"The reviewer already has a pending invitation.\\n\\n#{username} please accept the invite here: #{invitations_url}\"\n collaborator_msg = \"#{username} already has access.\"\n added_msg = \"OK, invitation sent!\\n\\n#{username} please accept the invite here: #{invitations_url}\"\n error_msg = \"It was not possible to invite #{username}\"\n\n return pending_msg if is_invited? username\n return collaborator_msg if is_collaborator? username\n return added_msg if add_collaborator username\n return error_msg\n end", "def setParticipants(participants)\r\n\t\t\t\t\t@participants = participants\r\n\t\t\t\tend", "def his_her\n \"[his_her]\"\n end" ]
[ "0.6996525", "0.6951807", "0.6424882", "0.63494736", "0.6316345", "0.604646", "0.5998308", "0.595223", "0.59515834", "0.594469", "0.59238636", "0.5910781", "0.59065545", "0.5887175", "0.58622307", "0.5847711", "0.5793256", "0.5784561", "0.5768779", "0.5760542", "0.5757097", "0.5727307", "0.57188535", "0.5708779", "0.56994444", "0.5678181", "0.5665754", "0.5665037", "0.5624622", "0.5624622", "0.55664074", "0.5560193", "0.5560193", "0.5551366", "0.554719", "0.5530274", "0.5530186", "0.55133754", "0.5505226", "0.5504933", "0.5486964", "0.5482276", "0.5468331", "0.546459", "0.5455535", "0.54381317", "0.5428223", "0.54159796", "0.54141253", "0.54108024", "0.540249", "0.53888685", "0.5379289", "0.5379289", "0.537677", "0.5373811", "0.53681207", "0.536337", "0.53548235", "0.5354586", "0.5350841", "0.5350765", "0.53504175", "0.53500104", "0.5348094", "0.53480345", "0.53476834", "0.53379697", "0.53346765", "0.5331691", "0.5331404", "0.5330336", "0.5327485", "0.5315326", "0.5314527", "0.531193", "0.531092", "0.5305467", "0.5302563", "0.5295741", "0.5288495", "0.52866685", "0.5277354", "0.52724165", "0.52724165", "0.52724165", "0.52638507", "0.525564", "0.52488905", "0.5242363", "0.5225749", "0.5220976", "0.5220975", "0.52197665", "0.52126867", "0.52084434", "0.52044", "0.5200706", "0.5189709", "0.51820153" ]
0.7839455
0
A shortcut for fexp.lookup_variable(key)
def lookup_variable(key) fexp.lookup_variable(key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(key)\n @variables[key.to_sym]\n end", "def lookup_variable (varname)\n\n env, var = lookup_environment(varname)\n env[var]\n end", "def lookup(key)\n if @data[\"vars\"] && @data[\"vars\"].has_key?(key)\n return true, @data[\"vars\"][key]\n end\n return false, nil\n end", "def look_up_variable(name, expr)\n distance = @locals[expr]\n if distance.nil?\n @globals[name]\n else\n @environment.get_at distance, name.lexeme\n end\n end", "def find_variable(key, raise_on_not_found: T.unsafe(nil)); end", "def [](key)\n @vars.detect { |v| v.lhs == key }.rhs rescue nil\n end", "def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend", "def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend", "def [](key, name = nil)\n if name\n h = @var_map[key]\n h && h[name]\n else\n @var_map[key]\n end\n end", "def lookup(key)\n @@registry[registry_key(key)]\n end", "def [](key)\n\n lookup(key.to_s)\n end", "def lookup(key)\n if key_pair = pair(key, hash(key))\n key_pair[1]\n end\n end", "def lookup(key)\n @map.each { |k, v| return v if key == k }\n nil\n end", "def lookup(key)\n @map.each { |pair| return pair[1] if pair[0] == key }\n nil\n end", "def lookup_value(key, context=nil)\n [named_context[context] || {}, global].map {|c| c[key]}.compact.first\n end", "def lookup(key)\n @map.each do |pair|\n return pair[1] if pair[0] == key\n end\n end", "def lookup(key, container_lookup=false)\n\n Ruote.lookup(h.fields, key, container_lookup)\n end", "def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end", "def get(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key \n return ele[1]\n end\n end\n end", "def lookupvar(name)\n puppet_scope.lookupvar name\n end", "def reg_resolve(key)\n return key unless Utils.ident?(key)\n\n spec = @registry_ref.value[key]\n\n if Utils.ident?(spec)\n deep_resolve(registry, spec)\n else\n spec\n end\n end", "def [](key)\n local[key]\n end", "def get_var(key)\n @varset.get_var(key)\n end", "def [](key)\n instance_variable_get(\"@#{key}\")\n end", "def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend", "def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend", "def [](key)\n local_fiber_variables[key]\n end", "def resolve(key, identifier: false)\n if identifier\n key_identifier = find(Regexp.new(key.to_s)).map(&:name).last\n OpenStruct.new @contexts.values.detect{|hash| hash[:name].to_s == key_identifier.to_s}\n else\n OpenStruct.new @contexts.values.detect{|hash| hash[:name].to_s == key.to_s}\n end\n \n end", "def look_up(variable)\n \ti = @@scope\n \twhile(i>=@@scope_base.last)\n \tif @@variables[i][variable] != nil\n \t\treturn @@variables[i][variable][0]\n \t\tputs \"#{@@variables[i][variable]} is found\" if (@@Debug)\n \t\t#return var[0]\n \tend\n \ti -= 1\n \tend\n \tputs \"Variable '#{variable}' does not exist.\"\n \t:FALSE\nend", "def [](variable_name)\n variables.find { |c| c.name == variable_name }\n end", "def table_lookup(key, arg, table = nil)\n lookup_key = key[1..-1].to_sym\n\n lookup_table = table || @tables[lookup_key]\n\n if lookup_table.kind_of? Hash\n lookup_table[arg.to_sym] \n elsif lookup_table.kind_of? Array\n if lookup_table.member? arg or lookup_table.member? arg.to_sym\n arg\n else\n raise \"Invalid argument\"\n end\n elsif lookup_table.kind_of? Proc\n table_lookup(key, arg, lookup_table.call)\n else\n raise \"Unknown lookup table type\"\n end\n #table[1][arg.to_sym] unless table.nil?\n end", "def [](key)\n @varset[key]\n end", "def lookup_key(translations, key)\n translations[key]\n end", "def [](key)\n resolve(key)\n end", "def method_missing(sym, *args)\n lookup(sym.to_sym)\n end", "def lookup_name(arg)\n all_by_name[arg]\n end", "def lookup(key)\n @stack.reverse_each do |level|\n return level[key] if level.has_key?(key)\n end\n nil\n end", "def get(key)\n self.map_var.each do |pair|\n return pair[1] if pair[0] == key\n end\n nil\n end", "def lookup(key=nil)\n silo = self.lookup_silo_name\n dict = nil\n ActiveRecord::Base.benchmark(\"Lookup: #{silo}#{key.ergo{'#'+to_s}}\") do\n dict = self.fetch_object(silo){\n # FIXME Exceptions within this block are silently swallowed by something. This is bad.\n self.find(:all, self.lookup_opts).inject(Dictionary.new){|s,v| s[v.send(self.lookup_key)] = v; s}\n }\n end\n return key ? dict[key.with{kind_of?(Symbol) ? to_s : self}] : (dict.values || [])\n end", "def lookup_key(translations, key)\n translations[key]\n end", "def lookup(const_key)\n case\n when const_key.kind_of?(Numeric) then const_key\n when const_key.kind_of?(String) then const_key\n when const_key.kind_of?(Symbol) then\n if has_const?(const_key)\n value = consts[const_key]\n value.is_a?(Proc) ? value.call : value\n elsif proper_type_names.include?(const_key)\n class_for(:type, const_key).new\n elsif const_key.to_s =~ /vector$/\n Array.new\n end\n when const_key.kind_of?(Array) then\n if has_const?(const_key.first) and const_key.size == 2\n key, value =[const_key.first, const_key.last]\n consts[key][value]\n end\n when const_key.kind_of?(Proc) then\n const_key.call\n end\n end", "def [](key)\n global[key]\n end", "def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end", "def get(name)\n lookup(key(name.to_s))\n end", "def variable_value(key)\n 'value'\n end", "def variable_by_name(name)\n @var_set[name]\n end", "def get key; call key; end", "def get(key); end", "def get(key); end", "def get(key); end", "def get(key); end", "def parse_and_resolve_variable(input)\n @stack[-1].get_variable(parse_variable(input))\n end", "def lookup(identifier)\n\t\tif @symbols.has_key?(identifier)\n\t\t\treturn @symbols[identifier]\n\t\telse\n\t\t\tprint \"Identificador: #{identifier}, no se encuentra en ningun alcance\"\n\t\tend\n\tend", "def get_variable(id) #method\n @variables[id]\n end", "def [](key)\n instance_variable_get(\"@#{key}\")\n end", "def [](key)\n if instance_variable_get(\"@#{key}\")\n instance_variable_get(\"@#{key}\")\n end\n end", "def get(key)\n case key\n when Symbol\n return instance_variable_get(\"@#{key}\")\n when String\n return instance_variable_get(\"@#{key}\")\n end\n\n end", "def lookup(context, name)\n\t\t\tlookup = context\n\t\t\tname.split(\".\").each { |value| lookup = lookup[value] }\n\t\t\tlookup\n\t\tend", "def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end", "def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end", "def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end", "def instance_variable(key)\n instance_variable_get(\"@#{key}\")\n end", "def [](key)\n $game_variables[key]\n end", "def replace(key)\n instance_variable_get(\"@#{key}\").to_s\n end", "def lookup(key, scope, order_override, _resolution_type)\n setup_context(scope, order_override)\n @connect.lookup_value(key)\n end", "def [](key)\n if key.to_s[0] == '@'\n instance_variable_get(key.to_sym)\n else\n instance_variable_get(\"@#{key}\")\n end\n end", "def plan_lookup(key, vars: {})\n pal.plan_hierarchy_lookup(key, plan_vars: vars)\n end", "def reg_resolve!(key)\n return key unless Utils.ident?(key)\n spec = reg_resolve(key)\n\n if spec\n spec\n else\n raise \"Unable to resolve spec: #{key}\"\n end\n end", "def liner_get(key)\n key = key.to_sym\n with_valid_attribute(key) do\n instance_variable_get \"@#{key}\"\n end\n end", "def []( key )\n hash = load_hash\n hash[key]\n end", "def find_by_key(key)\n by_key[key]\n end", "def find_by_key(key)\n by_key[key]\n end", "def get named\n raise VariableError, \"Used variable '#{named}' without setting it to something first\" unless @vars.key? named\n refurbish(named)\n end", "def lookup(city)\n puts $dial_book[city]\nend", "def find_variable(variable)\n for scope in $current_scope_list.sort{|a, b| b <=> a}\n if $var_list[scope][variable] != nil\n return $var_list[scope][variable]\n end\n end\n return nil\nend", "def variable(project, key)\n get(\"/projects/#{url_encode project}/variables/#{key}\")\n end", "def _pv_opts_lookup(opts, key)\n if opts.has_key?(key.to_s)\n opts[key.to_s]\n elsif opts.has_key?(key.to_sym)\n opts[key.to_sym]\n else\n nil\n end\n end", "def find(key)\n new(key: key, name: TYPES[key.to_sym]) if TYPES.has_key?(key.to_sym)\n end", "def get_local(locals: {}, key: \"\", alt: false ) \n\t\t_local = alt\n\t\tif locals.has_key?(key.to_sym)\n\t\t\t_local = locals[key.to_sym]\n\t\telsif locals.has_key?(key.to_s)\n\t\t\t_local = locals[key.to_s]\n\t\tend\n\n\t\treturn _local \n\tend", "def [](key)\n @env[key]\n end", "def [](key)\n @env[key]\n end", "def [](key)\n @map[key.to_sym]\n end", "def get_lookup(name)\n @lookups = {} unless defined?(@lookups)\n @lookups[name] = spawn_lookup(name) unless @lookups.include?(name)\n @lookups[name]\n end", "def lookup(source_or_key)\n case source_or_key\n when nil\n nil\n when String\n lookup(Tag[source_or_key])\n when Tag\n provides_map[source_or_key]\n when SourceFile\n source_or_key\n else\n raise \"Illegal lookup query. Expected String, Tag or SourceFile, \" <<\n \"given #{source_or_key.inspect}, an instance of #{source_or_key.class.name}.\"\n end\n end", "def [](key)\n @data[@aliases[key]]\n end", "def group_variable(group, key)\n get(\"/groups/#{url_encode group}/variables/#{key}\")\n end", "def lookup(aName)\n symbol_table.lookup(aName)\n end", "def local(key)\n if respond_to?(key)\n __send__(key)\n else\n locals.fetch(key) { NullLocal.new(key) }\n end\n end", "def [](kinvar) \n @kinvars.each{|kv| return kv if(kv.name == kinvar)}; nil \n end", "def variable_get(name)\n assert_type name, :String, :name\n environment.caller.var(name.value)\n end", "def get_context_var(group, key, context = @context)\n context[\"#{group}::#{key}\"]\n end", "def reference(key)\n descriptors = mapping(key).descriptors\n instance_eval(&descriptors)\n end", "def get(key)\n end", "def [](key)\n @_hash[key.to_sym]\n end", "def lookup_variable_stack (varname)\n\n get_environment.lookup_variable_stack(varname)\n end", "def get_variable(name)\n @variables[name]\n end", "def lookup(lkupName, xParamName, yParamName)\r\n\r\n\r\n refout = 'lookup(\"' + \"#{lkupName}\" + '\", ' + \"#{xParamName}, #{yParamName})\"\r\n\r\n return refout\r\n\r\n end", "def [](key)\n @map[key.to_sym]\n end", "def [](key)\n find_value(key)\n end", "def get(key)\n @map[key]\n end" ]
[ "0.7180863", "0.7162888", "0.7091131", "0.6904678", "0.6882745", "0.6804528", "0.67784435", "0.67784435", "0.6759197", "0.6651394", "0.66347355", "0.6626815", "0.65954655", "0.6576653", "0.6562062", "0.65050054", "0.65023965", "0.6495059", "0.6487961", "0.643238", "0.6425157", "0.6412277", "0.6377506", "0.63768816", "0.63484746", "0.63484746", "0.63389164", "0.63140243", "0.63128424", "0.63086313", "0.62848854", "0.62610215", "0.6257908", "0.62424093", "0.6235688", "0.62344193", "0.61944664", "0.6188092", "0.618564", "0.6173141", "0.61711615", "0.61711025", "0.6134801", "0.6129435", "0.6118487", "0.6105314", "0.6099952", "0.609367", "0.609367", "0.609367", "0.609367", "0.6092878", "0.6090735", "0.6072256", "0.60701597", "0.6016653", "0.60030705", "0.59914225", "0.5988326", "0.5988326", "0.5988326", "0.5984682", "0.596495", "0.5955926", "0.5929072", "0.5925893", "0.5918208", "0.5897897", "0.5892515", "0.5890702", "0.5880388", "0.5880388", "0.5878318", "0.5874989", "0.5874777", "0.58703476", "0.58665496", "0.5860088", "0.58548546", "0.585451", "0.585451", "0.58468544", "0.5839257", "0.58332556", "0.58308214", "0.5830506", "0.58282727", "0.5824649", "0.58177876", "0.58013994", "0.57990736", "0.5794254", "0.5786235", "0.5780598", "0.5772566", "0.5772129", "0.5769291", "0.57640064", "0.57386136", "0.5736818" ]
0.941451
0
Participant implementations call this method when their on_workitem (consume) methods are done and they want to hand back the workitem to the engine so that the flow can resume. the (wi=workitem) is mostly for backward compatibility (or for passing a totally different workitem to the engine).
def reply_to_engine(wi=workitem) receive(wi) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_workitem(wi)\n Ruote.participant_send(\n self, [ :on_workitem, :consume ], 'workitem' => wi)\n end", "def consume (workitem)\n # does nothing and does not reply to the engine.\n end", "def consume (workitem)\n\n reply_to_engine(workitem)\n end", "def consume (workitem)\n\n #first, we specify the reply queue for the 'real' participant. \n\n workitem.reply_queue = workitem.params['reply_queue'] ||= @queue_name+\"_FIN\"\n workitem.pid = workitem.params['pid']\n\n msg = encode_workitem(workitem)\n\n message = @queue.send_message(msg)\n\n ldebug { \"consume() msg sent to queue #{@queue.url} id is #{message.id}\" }\n\n if workitem.params['reply_by_default'] || workitem.params['reply-anyway'] == true\n reply_to_engine( workitem )\n end\n \n \n end", "def work!(work_item)\n raise NotImplementedError\n end", "def proceed!\n participant.proceed(_workitem)\n end", "def reply(workitem)\n\n puts '-' * 80\n puts '*** WARNING : please use the Ruote::StorageParticipant#proceed(wi)'\n puts ' instead of #reply(wi) which is deprecated'\n #caller.each { |l| puts l }\n puts '-' * 80\n\n proceed(workitem)\n end", "def consume(workitem)\n\n RuoteStomp.start!\n target_queue = determine_queue(workitem)\n\n raise 'no queue specified (outbound delivery)' unless target_queue\n\n forget = determine_forget(workitem)\n\n opts = {\n :persistent => RuoteStomp.use_persistent_messages?,\n :content_type => 'application/json' }\n\n if message = workitem.fields['message'] || workitem.params['message']\n\n forget = true # sending a message implies 'forget' => true\n $stomp.send target_queue, message, opts \n else\n $stomp.send target_queue, encode_workitem(workitem), opts\n end\n\n reply_to_engine(workitem) if forget\n end", "def consume( workitem )\n ldebug { \"consuming workitem\" }\n ensure_reactor!\n\n if target_queue = workitem.params['queue']\n\n q = MQ.queue( target_queue, :durable => true )\n\n # Message or workitem?\n if message = ( workitem.attributes['message'] || workitem.params['message'] )\n ldebug { \"sending message to queue: #{target_queue}\" }\n q.publish( message )\n\n else\n ldebug { \"sending workitem to queue: #{target_queue}\" }\n\n q.publish( encode_workitem( workitem ) )\n end\n else\n lerror { \"no queue in workitem params!\" }\n end\n\n if @options[:reply_by_default] || workitem.params['reply-anyway'] == true\n reply_to_engine( workitem )\n end\n\n ldebug { \"done\" }\n end", "def consume (workitem)\n ArWorkitem.from_owfe_workitem(workitem, @store_name)\n end", "def do_raw_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n Ruote.participant_send(\n participant, [ :on_workitem, :consume ], 'workitem' => workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name,\n 'workitem' => msg['workitem'])\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end", "def consume (workitem)\n\n workitem.attributes['compact_workitems'] = true if compact_workitems\n\n Workitem.from_owfe_workitem workitem\n # does the 'saving to db'\n end", "def do_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n participant.consume(workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name)\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end", "def on_workitem\n\n doc = workitem.to_h\n\n doc.merge!(\n 'type' => 'workitems',\n '_id' => to_id(doc['fei']),\n 'participant_name' => doc['participant_name'],\n 'wfid' => doc['fei']['wfid'])\n\n doc['store_name'] = @store_name if @store_name\n\n @context.storage.put(doc, :update_rev => true)\n end", "def consume (workitem)\n\n FileUtils.mkdir_p(@workdir) unless File.exist?(@workdir)\n\n file_name = @workdir + determine_file_name(workitem)\n\n dump_to_file(file_name, workitem)\n\n reply_to_engine(workitem) if @reply_anyway\n end", "def consume (workitem)\n\n workitem.attributes['compact_workitems'] = true if compact_workitems\n\n Workitem.from_owfe_workitem(workitem, @store_name)\n end", "def dwp_work(work_item)\n dwp_log{ \"Working, item: #{work_item.inspect}\" }\n dwp_run_callback('before_work', work_item)\n work!(work_item)\n dwp_run_callback('after_work', work_item)\n end", "def decode_workitem( email )\n ldebug { \"decoding workitem from: #{email}\" }\n analysis_error_response( email )\n arwi_id = get_arwi_id_for_decode( email )\n puts \"listener got arwi:#{arwi_id}\"\n return unless arwi_id && arwi_id.to_s.size > 0\n workitem = MailItem.get_workitem( arwi_id, 'delete', \"listener\" )\n puts \"listener can not got workitem for arwi:#{arwi_id}\" unless workitem\n return unless workitem\n puts \"listener got wi:#{workitem.class}, #{workitem}\"\n workitem[\"attachment\"] = email[:attachment]\n workitem[\"email_from\"] = email[:from].join(',')\n begin\n SMOperation.build( email, workitem )\n email[:subject] = Kconv.toutf8(email[:subject])\n # _ps_type = $1 if /\\+([a-z]+)?_?([\\d]+)@/ =~ email[:to]\n # step = SMSpreadsheet.get_stepname_from_spreadsheet( workitem.fei.wfname, _ps_type )\n event = Hash.new\n event[:title] = \"#{email[:subject]}\"\n event[:desc] = \"#{email[:body]}\"\n calendar_name = workitem.fields['user_name'] || 'default'\n SMGoogleCalendar.create_event( event, calendar_name )\n rescue Exception => e\n puts \"decode_workitem error: #{e.message}\"\n end\n print \"#{@blue_underline}3.listener processed workitem:#{@normal} #{workitem}\\n\"\n workitem\n end", "def consume( workitem )\n p [ :em_running?, EM.reactor_running?, EM.reactor_thread? ]\n p [ :ping, :requested ]\n debugger if $DEBUG\n http = EM::HttpRequest.new('http://www.google.com/').get :timeout => 5\n http.callback {\n p [ :ping, :ok ]\n workitem.fields['ping'] = 'ok'\n reply_to_engine( workitem )\n }\n http.errback {\n p [ :ping, :failed ]\n workitem.fields['ping'] = 'failed'\n reply_to_engine( workitem )\n }\n end", "def consume(workitem)\n\n RuoteAMQP.start!\n\n target_queue = determine_queue(workitem)\n\n raise 'no queue specified (outbound delivery)' unless target_queue\n\n q = AMQP.channel.queue(target_queue, :durable => true)\n forget = determine_forget(workitem)\n\n opts = {\n :persistent => RuoteAMQP.use_persistent_messages?,\n :content_type => 'application/json' }\n\n if message = workitem.fields['message'] || workitem.params['message']\n\n forget = true # sending a message implies 'forget' => true\n\n q.publish(message, opts)\n\n else\n\n wi = encode_workitem(workitem)\n raise ArgumentError, \"encoded workitem is nil\" if wi.nil?\n q.publish(wi, opts)\n end\n\n reply_to_engine(workitem) if forget\n end", "def consume (workitem)\n\n msg = encode_workitem(workitem)\n\n msg_id = @queue_service.put_message(@queue, msg)\n\n ldebug { \"consume() msg sent to queue #{@queue.path} id is #{msg_id}\" }\n end", "def _on_reply(wi)\n Ruote.participant_send(self, :on_reply, 'workitem' => wi)\n end", "def reply_to_engine (workitem)\n\n super(workitem.as_owfe_workitem)\n #\n # replies to the workflow engine\n\n workitem.destroy\n #\n # removes the workitem from the database\n end", "def reply (workitem)\n\n @items.delete(workitem.fei.to_storage_id)\n reply_to_engine(workitem)\n end", "def _accept?(wi)\n Ruote.participant_send(self, :accept?, 'workitem' => wi)\n end", "def proceed(workitem)\n\n r = remove_workitem('proceed', workitem)\n\n return proceed(workitem) if r != nil\n\n workitem.h.delete('_rev')\n\n reply_to_engine(workitem)\n end", "def apply (workitem)\n\n get_parent.reply(workitem) if @parent_id\n end", "def save!\n ScriptoriaCore::Ruote.engine.storage_participant.do_update(_workitem)\n end", "def reply (workitem)\n\n workitem = workitem.to_ruote_workitem \\\n if workitem.respond_to?(:to_ruote_workitem)\n\n destroy(workitem.fei)\n reply_to_engine(workitem)\n end", "def reply (workitem)\n\n reply_to_parent(workitem)\n end", "def reply (workitem)\n\n reply_to_parent(workitem)\n end", "def to_owfe_workitem\n\n wi = OpenWFE::InFlowWorkItem.new\n\n wi.fei = full_fei\n wi.participant_name = participant_name\n wi.fields = YAML.load(self.wi_fields)\n\n wi.dispatch_time = dispatch_time\n wi.last_modified = last_modified\n\n wi\n end", "def encode_workitem( wi )\n wi.attributes['reply_queue'] = AMQPListener.queue\n OpenWFE::Json.encode( wi.to_h )\n end", "def process_message(msg)\n write_thread_var :wi, wi = WorkItem.new(msg) # Save workitem object for later\n turn_off_thinking_sphinx\n \n log_info \"Processing incoming workitem: #{workitem.to_s}\"\n begin\n run_backup_job(wi) do |job|\n # Start backup job & pass info in BackupSourceJob\n if backup(job) \n save_success_data\n end\n end\n rescue BackupSourceExecutionFlood => e\n # Too many jobs should not be an error\n save_success_data e.to_s\n log_info \"*** BackupSourceExecutionFlood error\"\n rescue BackupWorker::Base::BackupIncomplete => e\n workitem.reprocess!\n log_info \"*** Backup job requires reprocessing\"\n rescue Exception => e\n save_error \"#{e.to_s}\\n#{e.backtrace}\"\n log_info \"*** Unexpected error #{e.message}\"\n # Always set job finish flag\n if j = thread_job\n job_finished(j)\n end\n end\n log_info \"Done processing workitem\"\n\n workitem\n end", "def applied_workitem\n\n @awi ||= Ruote::Workitem.new(h.applied_workitem)\n end", "def reply(workitem)\n\n reply_to_parent(workitem)\n end", "def perform_work\n object_client.notify_goobi\n end", "def reply (engine)\n\n engine.reply(self.as_owfe_workitem)\n self.destroy\n end", "def workitem\n Workitem.new(@flow_expression.applied_workitem)\n end", "def handle_work_message(type, data, connection)\n case type\n when :no_job\n logger.info \"Got NO_JOB from #{connection}\"\n run_no_job_callback\n when :job_assign\n @status = :working\n run_job_assign_callback\n return worker_enabled if handle_job_assign(data, connection)\n when :noop\n # We'll have to read again\n logger.debug \"Received NOOP while polling. Ignoring NOOP\"\n else\n logger.error \"Got unexpected #{type.to_s} from #{connection}\"\n end\n end", "def applied_workitem(_fei=nil)\n\n fetch_workitem(_fei || fei)\n end", "def workitem(fei=nil)\n\n return fetch_workitem(fei) if fei\n\n @workitem ? @workitem : applied_workitem\n end", "def consume (workitem)\n\n DataMapper.repository(@dm_repository) do\n\n kf = if @key_field and expstorage and @key_field.match(/\\$\\{[^\\}]+\\}/)\n Ruote.dosub(@key_field, expstorage[workitem.fei], workitem)\n elsif @key_field\n workitem.fields[@key_field]\n else\n nil\n end\n\n kf = kf ? kf.to_s : nil\n\n @dm_workitem_class.from_ruote_workitem(\n workitem, :store_name => @store_name, :key_field => kf)\n end\n end", "def cancel_participant\n\n return unless @applied_workitem\n #\n # if there is an applied workitem, it means there\n # is a participant to cancel...\n\n participant = get_participant_map.lookup_participant(@participant_name)\n\n cancelitem = CancelItem.new(@applied_workitem)\n\n get_participant_map.dispatch(participant, @participant_name, cancelitem)\n end", "def nuixWorkerItemCallbackClose\nend", "def reply (workitem)\n\n unschedule_timeout(workitem)\n\n super\n end", "def decode_workitem( msg )\n ldebug { \"decoding workitem from: #{msg}\" }\n\n # YAML?\n if msg.index('ruby/object:OpenWFE::InFlowWorkItem')\n YAML.load( msg )\n # XML?\n elsif msg =~ /^<.*>$/m\n OpenWFE::Xml.workitem_from_xml( msg )\n # Assume JSON encoded Hash\n else\n hash = OpenWFE::Json.decode(msg)\n OpenWFE.workitem_from_h( hash )\n end\n end", "def do_work\n end", "def on_work_requested(work)\n script = <<-eos\n this.reply = function() {\n this.result = Array.prototype.slice.call(arguments);\n };\n #{work['args'][0]}\n eos\n context = ExecJS.compile(script)\n result = context.eval('this.result')\n\n api('sp/work_done', result)\n end", "def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end", "def consume_item(item)\n lose_item(item, 1, false, nil, nil, false) if item.is_a?(RPG::Item) && item.consumable\n end", "def consume (workitem)\n\n get_expression_pool.launch_subprocess(\n get_flow_expression(workitem),\n @template,\n false, # don't forget\n workitem,\n nil) # no params for the new subprocess env\n end", "def consume_item(item)\n if item.is_a?(RPG::Item) and item.consumable\n lose_item(item, 1)\n end\n end", "def nuixWorkerItemCallbackInit\nend", "def to_ruote_workitem\n\n wi = Ruote::Workitem.new\n\n wi.fei = Ruote::FlowExpressionId.from_s(fei)\n wi.fields = Ruote::Json.decode(wi_fields)\n wi.participant_name = participant_name\n\n wi\n end", "def apply (exp_or_fei, workitem)\n\n get_workqueue.push(\n self, :do_apply_reply, :apply, exp_or_fei, workitem)\n end", "def reg_participants\n puts \"#{self.thread_name} engine particpant setup\"\n # SETUP MUST BE CALLED.\n # ANY exceptions or errors in the participants aborts the workflow and are hard to find. YOU HAVE BEEN WARNED\n self.wfe_engine.register_participant :setup do |workitem|\n puts \"------> setup got a workitem...\" if @debug\n target = ['[email protected]', '[email protected]']\n workitem.sms_source = \"992\"\n workitem.my_hostname = Socket.gethostname \n workitem.sms_message = \"no message\"\n workitem.email_target = target\n # workitem.email_from = \"[email protected]\"\n workitem.workflow_status = \"false\"\n workitem.process_result = \"false\"\n workitem.final_response=\"failure\"\n puts \"<------- end of setup\" if @debug\n end\n # self.wfe_engine.register_participant( \n # 'bal_transfer', \n # OpenWFE::Extras::ActiveStoreParticipant.new('bal_transfer\n#self.wfe_engine.register_participant :bal_transfer do |workitem|\n# puts \"bal_transfer got a workitem...\"\n# workitem.particpant = 'bal_transfer'\n# workitem.store = 'bal_transfer'\n# workitem.save\n#end\n#FIX LATER\n s=%w(bal_transfer pasaload dispense_pin dealer_load load process2 )\n s.each {|i|# self.wfe_engine.register_participant( \"#{i}_store\", ActiveTracker.new(\"#{i}\")) \n puts \"---REG PARticipant #{i}_store \"\n self.wfe_engine.register_participant \"#{i}_store\" do |workitem|\n puts \"#{i}_store got a workitem...\"\n #workitem.monkey_comment = \"this thing looks interesting\"\n end \n }\n \n self.wfe_engine.register_participant :credit do |workitem|\n puts \"----> credit action got a workitem...\" if @debug\n workitem.credit_result=false\n res= self.billing_action('credit',workitem.credit_msisdn,workitem.peso_value )\n puts \"action credit msisdn #{workitem.credit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n puts \"<----credit action finished res #{res}...\" if @debug\n workitem.process_result=res\n end\n self.wfe_engine.register_participant :pasaload do |workitem|\n puts \"----> pasaload action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"992\"\n puts \"before action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('pasaload',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action pasaload msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----pasaload action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dealer_load do |workitem|\n puts \"----> dealer load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"913\"\n puts \"before action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dealer_load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action dealer load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----dealer load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n end\n self.wfe_engine.register_participant :load do |workitem|\n puts \"----> load action got a workitem...\" if @debug\n workitem.process_result=false\n workitem.sms_source = \"990\"\n puts \"before action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('load',workitem.source_msisdn,workitem.value, workitem.dest_msisdn)\n puts \"action load msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res}\"\n puts \"<----load action finished res #{res}...\" if @debug\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.loadvalue=res[1] if res[0]=='true'\n \n end\n self.wfe_engine.register_participant :dispense_pin do |workitem|\n puts \"----> dispense_pin action got a workitem...\" if @debug\n workitem.process_result=false\n puts \"before action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn}\"\n res= self.billing_action('dispense_pin', workitem.source_msisdn, workitem.value, workitem.dest_msisdn)\n puts \"action dispense_pin msisdn #{workitem.source_msisdn} value #{workitem.value} dest: #{workitem.dest_msisdn} RES: #{res.to_s}\"\n puts \"<----load action finished res #{res}...\" if @debug\n # result = YAML.load\n workitem.process_message=res.to_yaml\n workitem.final_response=\"all ok\" if res[0]=='true'\n workitem.pin=res[1] if res[0]=='true'\n \n end\n \n \n self.wfe_engine.register_participant :debit do |workitem|\n puts \"----> debit action got a workitem...\" if @debug\n workitem.debit_result=false \n # peso charge -- could be variable\n value=-1*workitem.peso_value.to_i-1\n res=self.billing_action('debit',workitem.debit_msisdn,value.to_s )\n puts \"action debit msisdn #{workitem.debit_msisdn} value #{workitem.peso_value} RES: #{res}\"\n workitem.process_result=res\n workitem.process_message=res\n puts \"<----debit action finsihed res #{res}...\" if @debug\n end\n self.wfe_engine.register_participant :monkey do |workitem|\n puts \"monkey got a workitem...\"\n workitem.monkey_comment = \"this thing looks interesting\"\n end\n self.wfe_engine.register_participant :intprocess2 do |workitem|\n puts \"process2 got a workitem...\"\n workitem.process2_comment = \"yeah process 2\"\n end\n self.wfe_engine.register_participant :bob do |workitem|\n puts \"bob got a workitem...\"\n workitem.bob_comment = \"not for me, I prefer VB\"\n workitem.bob_comment2 = \"Bob rules\"\n workitem.final_response = \"all ok\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.final_response\n end\n self.wfe_engine.register_participant :sms do |workitem|\n puts \"sms got a workitem...\"\n puts \"sms #{workitem.sms_destination} message: #{workitem.sms_message}\"\n res=send_sms(workitem.sms_message,workitem.sms_destination, workitem.sms_source)\n workitem.problem=!res \n end\n # needs workitem.email_target set\n mailp=OpenWFE::MailParticipant.new(\n :smtp_server => \"mail2.cure.com.ph\",\n :smtp_port => 25,\n :from_address => \"[email protected]\"\n ) do |workitem|\n puts \"----> mail got workitem\"\n s = \"\"\n duration=Time.now-self.start_time\n s << \"Subject: Workflow PROCESS [#{workitem.process_name}] [#{workitem.final_response}]\\n\\n\"\n s << \"result is #{workitem.final_response}\\n\"\n s << \"Processing Time so far: #{duration} \\n\"\n s << \"summary of process #{workitem.fei.workflow_instance_id}\\n\"\n workitem.attributes.each do |k, v|\n s << \" - #{k} : '#{v}'\\n\"\n end \n s << \"Time: #{Time.new.to_s}\\n\"\n puts \"----> leaving mail\"\n s\n end\n self.wfe_engine.register_participant( \n \"mail\", mailp)\n \n \n self.wfe_engine.register_participant :debug do |workitem|\n puts \"--->debug got a workitem...\"\n puts \"--status of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n puts \" - #{k} : '#{v}'\"\n end\n puts '<------end of debug'\n end\n # summarize must be called to set final_response\n self.wfe_engine.register_participant :summarize do |workitem|\n puts \"---->Summarize got a workitem...\"\n # workitem.final_response=\"all ok\" if workitem.attributes['process_result']=='true' \n puts \"result is #{workitem.final_response}\"\n self.final_response[workitem.fei.workflow_instance_id.to_s] = workitem.process_message\n puts \"summary of process #{workitem.fei.workflow_instance_id}\"\n workitem.attributes.each do |k, v|\n # next unless k.match \".*_comment$\"\n puts \" - #{k} : '#{v}'\"\n end\n puts '<-------end of summary'\n end\n self.wfe_engine.register_participant :reverse_charges do |workitem|\n puts \"-----> reverse got a workitem...\"\n res=false\n if workitem.attributes['debit_result']=='true'\n value=1*workitem.peso_value.to_i+1\n res=self.billing_action('credit',workitem.debit_msisdn,value.to_s )\n puts \"return from reversing debit: #{res}\"\n end\n if workitem.attributes['credit_result']=='true'\n res= self.billing_action('debit',workitem.credit_msisdn,workitem.peso_value )\n puts \"return from reversing credit: #{res}\"\n end\n puts 'end of reverse charges'\n end\n self.wfe_engine.register_participant :process_failure do |workitem|\n puts \"----> process_failure got a workitem...\"\n res=false\n # res=send_sms(\"There was a problem with your request (process id:'#{workitem.fei.workflow_instance_id})'. Call *999 if you require further information\", workitem.source_msisdn, workitem.sms_source)\n puts \"<------ out of process failure\"\n end\n self.wfe_engine.register_participant :inform_success_pasa do |workitem|\n puts \"---->Inform_success_pasa got a workitem...\"\n res=true\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have sent #{workitem.value} pesos to #{workitem.dest_msisdn}: (process id:'#{workitem.fei.workflow_instance_id})'\", workitem.source_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.value} pesos from #{workitem.source_msisdn}: To check your balance, text BAL to 991\", workitem.dest_msisdn,workitem.sms_source) and res\n #(process id:#{workitem.fei.workflow_instance_id})\n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success_dispense_pin do |workitem|\n puts \"---->Inform_success_dispense_pin got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"Your pin is #{workitem.loadvalue} via tracking process id:'#{workitem.fei.workflow_instance_id}'\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_success_dispense_pin\"\n res\n end\n self.wfe_engine.register_participant :inform_success_load do |workitem|\n puts \"---->Inform_success_load got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n # res=send_sms(\"You have loaded #{workitem.loadvalue} pesos (process id: #{workitem.fei.workflow_instance_id})\", workitem.source_msisdn, workitem.sms_source)\n \n end\n puts \"<---- end inform_sucess\"\n res\n end\n self.wfe_engine.register_participant :inform_success do |workitem|\n puts \"Inform_success got a workitem...\"\n res=false\n if workitem.final_response==\"all ok\"\n res=send_sms(\"You have sent #{workitem.peso_value} peso to #{workitem.credit_msisdn}: (process id:'#{workitem.fei.workflow_instance_id}')\", workitem.debit_msisdn, workitem.sms_source)\n res=send_sms(\"You have received #{workitem.peso_value} pesos from #{workitem.debit_msisdn}: tracking process id:'#{workitem.fei.workflow_instance_id}' \",workitem.credit_msisdn,workitem.sms_source) and res\n end\n end\n \nend", "def nuixWorkerItemCallback(worker_item)\n\t# :pull_properties => Do we copy down properties from MSG?\n\t# :pulled_property_prefix => Differentiate MSG properties pulled down.\n\t# :pull_digest => Do we copy MSG MD5 as property to item? Nuix 7.6 and up only!\n\t# :pull_size => Do we copy MSG file size as property to item?\n\tmsg_pulldown(worker_item,{\n\t\t:pull_properties => true,\n\t\t:pulled_property_prefix => \"MSG \",\n\t\t:pull_digest => true,\n\t\t:pull_size => true,\n\t})\nend", "def finished_work(worker, work_unit, result)\n end", "def filter(workitem=nil)\n\n filter = lookup_filter(workitem)\n\n return unless filter\n\n unless filter.is_a?(Array)\n #\n # filter is a participant\n\n def filter.receive(wi); end\n # making sure the participant never replies to the engine\n\n hwi = workitem || h.applied_workitem\n\n if filter.respond_to?(:filter)\n hwi['fields'] = filter.filter(hwi['fields'], workitem ? 'out' : 'in')\n else\n hwi['fields']['__filter_direction__'] = workitem ? 'out' : 'in'\n filter.consume(Ruote::Workitem.new(hwi))\n end\n\n hwi['fields'].delete('__filter_direction__')\n\n return\n end\n\n #\n # filter is a not a participnat\n\n unless workitem # in\n\n h.fields_pre_filter =\n Rufus::Json.dup(h.applied_workitem['fields'])\n h.applied_workitem['fields'] =\n Ruote.filter(filter, h.applied_workitem['fields'], {})\n\n else # out\n\n workitem['fields'] =\n Ruote.filter(\n filter,\n workitem['fields'],\n :double_tilde =>\n h.fields_pre_filter || h.applied_workitem['fields'])\n\n workitem['fields'].delete('params')\n # take and discard tend to copy it over, so let's remove it\n end\n end", "def util_item_on_use_sequence(item, extend_data)\n message = parse_text(22, 46, ::PFM::Text::TRNAME[0] => $trainer.name,\n ::PFM::Text::ITEM2[1] => item.exact_name)\n\n if extend_data[:use_before_telling]\n if extend_data[:on_use].call != :unused\n $bag.remove_item(item.id, 1) if item.limited\n display_message(message) if $scene == self\n return extend_data\n end\n return false\n end\n\n $bag.remove_item(item.id, 1) if item.limited\n display_message(message)\n extend_data[:on_use].call\n\n return extend_data\n end", "def reply (exp_or_fei, workitem)\n\n get_workqueue.push(\n self, :do_apply_reply, :reply, exp_or_fei, workitem)\n end", "def util_item_open_party_sequence(item, extend_data, result_process)\n call_scene(GamePlay::Party_Menu, @team || $actors, :item, extend_data, no_leave: false) do |scene|\n if $game_temp.in_battle && scene.return_data != -1\n @return_data = [item.id, extend_data, scene.return_data]\n @running = false\n next\n end\n $bag.remove_item(item.id, 1) if item.limited && scene.return_data != -1\n result_process&.call\n end\n return false unless @running\n\n return extend_data\n end", "def consume_mix_items\n @mix_items.shift\n end", "def process_queue\n begin\n while blk = Merb::Dispatcher.work_queue.pop\n # we've been blocking on the queue waiting for an item sleeping.\n # when someone pushes an item it wakes up this thread so we \n # immediately pass execution to the scheduler so we don't \n # accidentally run this block before the action finishes \n # it's own processing\n Thread.pass\n blk.call\n end\n rescue Exception => e\n Merb.logger.warn! %Q!Worker Thread Crashed with Exception:\\n#{Merb.exception(e)}\\nRestarting Worker Thread!\n retry\n end\n end", "def to_wires_event; self; end", "def perform( action, workitem )\n @action, @workitem = action, workitem\n\n begin\n send( action )\n run_callbacks\n rescue => e\n handle_exception( e )\n end\n end", "def on_item_ok; item_ok(@item_window, @trade_win1, @tb_unit); end", "def work\n\t\tsuper\n\t\t@story = @work\n\tend", "def on_part(connection, channel, user)\n end", "def do_work\n raise NotImplementedError\n end", "def work(context)\n raise NotImplementedError.new\n end", "def to_owfe_workitem (options={})\n\n wi = OpenWFE::InFlowWorkItem.new\n\n wi.fei = full_fei\n wi.participant_name = participant_name\n wi.attributes = fields_hash\n\n wi.dispatch_time = dispatch_time\n wi.last_modified = last_modified\n\n wi.db_id = self.id\n\n wi\n end", "def work\n\t\tsuper\n\t\t@link = @work\n\tend", "def load_workitem (workitem_id)\n\n @worklist = Worklist.new(session[:user])\n\n @workitem = OpenWFE::Extras::Workitem.find workitem_id\n\n @delegation_targets = @worklist.delegation_targets(@workitem)\n\n @fields, hidden_fields = filter_fields @workitem\n\n session[:workitem] = @workitem.id\n\n\n #@process_definition, @json_process_definition =\n # LaunchPermission.load_process_definition(\n # @workitem.full_fei.workflow_definition_url)\n\n pwfid = @workitem.full_fei.parent_wfid\n\n @json_process_definition =\n $openwferu_engine.process_representation(pwfid).to_json.to_s\n\n @paused = $openwferu_engine.is_paused?(pwfid)\n # a small digression (out of the worklist, into the engine)\n end", "def message; opt('message') || encode_workitem; end", "def re_dispatch(wi=nil, opts=nil)\n\n wi, opts = [ nil, wi ] if wi.is_a?(Hash) && opts.nil?\n wi ||= workitem()\n opts ||= {}\n\n wi.h.re_dispatch_count = wi.h.re_dispatch_count.to_s.to_i + 1\n\n msg = {\n 'action' => 'dispatch',\n 'fei' => wi.h.fei,\n 'workitem' => wi.to_h,\n 'participant_name' => wi.participant_name\n }\n\n if t = opts[:in] || opts[:at]\n\n sched_id = @context.storage.put_schedule('at', wi.h.fei, t, msg)\n\n exp = fexp(wi)\n exp.h['re_dispatch_sched_id'] = sched_id\n exp.try_persist\n\n else\n\n @context.storage.put_msg('dispatch', msg)\n end\n end", "def test_update_workitem_alt\n\n @dashboard.register_participant 'alpha', Ruote::StorageParticipant\n\n wfid = @dashboard.launch(Ruote.process_definition { alpha })\n\n wait_for(:alpha)\n\n #wi = @dashboard.process(wfid).workitems.first\n # doesn't work: the returned workitem isn't a workite document, it's\n # just a fragment of info\n\n wi = @dashboard.process(wfid).stored_workitems.first\n # works OK\n\n #wi = alpha.first\n # works OK, but you have to grab alpha first...\n\n alpha = @dashboard.participant(wi.participant_name)\n\n wi.set_field('my_field', 'abc123')\n\n alpha.update(wi)\n\n assert_equal nil, @dashboard.process(wfid).workitems.first.fields['my_field']\n assert_equal 'abc123', alpha.first.fields['my_field']\n end", "def on_item_ok2; item_ok(@item_window2, @trade_win2, @tb_unit2); end", "def item\n\t\tself.bmet_work_order.bmet_item\n\tend", "def fetch(workitem_or_fei)\n\n hfei = Ruote::FlowExpressionId.extract_h(workitem_or_fei)\n\n @context.storage.get('workitems', to_id(hfei))\n end", "def workitems\n\n @expressions.select { |fexp|\n #fexp.is_a?(Ruote::Exp::ParticipantExpression)\n fexp.h.name == 'participant'\n }.collect { |fexp|\n Ruote::Workitem.new(fexp.h.applied_workitem)\n }\n end", "def reply_to_parent (workitem)\n\n get_expression_pool.reply_to_parent(self, workitem)\n end", "def on_item_ok\n return back_to_items if (item = @item_window.item).nil?\n $game_party.lose_item(item, 1)\n @unit_item_list.tb_unit.gain_item(item, 1)\n TactBattleManager.store_unit_item(@actor.id, item)\n back_to_items\n end", "def work( payload, metadata )\n\t\tself.job_counter.mark\n\t\tself.job_timer.time do\n\t\t\tsuper\n\t\tend\n\tend", "def each_item\n return enum_for(:each_item) unless block_given?\n begin\n notice 'start!'\n @receive.each do |payload|\n notice payload\n case\n when payload.has_start?\n receive_start(payload.start)\n when payload.has_response?\n receive_response(payload.response)\n when payload.has_resolve?\n receive_resolve(payload.resolve)\n end\n yield send_queue.pop\n end\n notice 'filter end normally.'\n rescue StandardError => e\n error e\n fail e # signal completion via an error\n ensure\n warn 'filter end!'\n end\n end", "def _work(context)\n # pre step hook\n ret = work(context)\n # post step hook\n ret\n end", "def reply_to_parent(workitem)\n\n @context.tracker.remove_tracker(h.fei)\n\n super(workitem)\n end", "def encode_workitem(wi)\n wi.params['participant_options'] = @options\n Rufus::Json.encode(wi.to_h)\n end", "def process_item(item)\n raise NotImplementedError\n end", "def encode_workitem(wi)\n\n wi.params['participant_options'] = @options\n\n Rufus::Json.encode(wi.to_h)\n end", "def send_pending; end", "def do_work\n # does things\n end", "def perform_work\n raise NotImplementedError\n end", "def be_worker\n before_work\n super\n end", "def delegate(workitem, new_owner)\n\n hwi = fetch(workitem)\n\n fail ArgumentError.new(\n \"workitem not found\"\n ) if hwi == nil\n\n fail ArgumentError.new(\n \"cannot delegate, workitem doesn't belong to anyone\"\n ) if hwi['owner'] == nil\n\n fail ArgumentError.new(\n \"cannot delegate, \" +\n \"workitem owned by '#{hwi['owner']}', not '#{workitem.owner}'\"\n ) if hwi['owner'] != workitem.owner\n\n hwi['owner'] = new_owner\n\n r = @context.storage.put(hwi, :update_rev => true)\n\n fail ArgumentError.new(\"workitem is gone\") if r == true\n fail ArgumentError.new(\"workitem got modified meanwhile\") if r != nil\n\n Workitem.new(hwi)\n end", "def on_mixitem_cancel\n case @mix_window.last_window\n when :skill_window\n on_mixitem_cancel_to_skill_window\n when :yea_bcl # $imported[\"YEA-BattleCommandList\"]\n on_mixitem_cancel_to_yea_bcl\n end\n end", "def handle_presence(pres)\n item = self[pres.from]\n item ||= create(pres.from) if auto_subscribe\n return unless item\n\n case pres.type\n when :subscribed\n # XXX I wanted to pub the functionality currently in subscribed into this subscribe section\n # but some clients (I'm talking to you Adium) never respond with a subscribed presence\n # subscribe!\n nil\n\n when :subscribe\n # XXX Wish we could call subscribe against the roster_item\n item.subscribe!\n item.online!\n\n # if a user has our bot in their roster but without a subscription\n # type of \"both\" then they will never probe for our presence when they log in.\n # So we must send a user a subscribe presence when they ask us to subscribe\n # from: http://www.xmpp.org/extensions/xep-0162.html\n subscribed = pres.answer\n subscribed.type = :subscribed\n subscribe = pres.answer\n subscribe.from = subscribe.from.bare\n [subscribed, subscribe, pres.to.online_presence(pres.from), item.dequeue_deferred_messages].flatten\n\n when :unsubscribe\n item.unsubscribe!\n\n unsubscribed = pres.answer\n unsubscribed.type = :unsubscribed\n unsubscribed\n\n when :unsubscribed\n # ?\n return nil\n\n when nil, :online\n item.online!\n\n # Try sending back our online presence when people tell us their online\n pres.to.online_presence(pres.from) if pres.to\n\n when :unavailable: :unavailable\n item.offline!\n return nil\n\n when :probe\n # What's weird about having this here, is usually they are probing for the components presence.\n # Yet here we are in the roster as if our component were in our own roster. Maybe thats ok.\n item.online!\n pres.to.online_presence(pres.from)\n\n when :error\n if [404,503].include?(pres.error.code)\n item.offline!\n end\n return nil\n end\n\n end", "def get_workitem (args)\n\n args.find { |a| a.is_a?(WorkItem) }\n end", "def done_working_with_restriction\n begin\n payload = job['payload']\n job_class = Resque.constantize(payload['class'])\n job_args = payload['args']\n job_class.release_restriction(*job_args) if job_class.is_a?(Plugins::Restriction)\n ensure\n return done_working_without_restriction\n end\n end" ]
[ "0.86300087", "0.7754322", "0.7484925", "0.69160575", "0.6657702", "0.6639928", "0.662259", "0.66056997", "0.6591868", "0.64952314", "0.64819765", "0.64460456", "0.63810974", "0.63067853", "0.6274159", "0.62303877", "0.61929846", "0.6155849", "0.6145177", "0.608055", "0.60208505", "0.5982067", "0.5956235", "0.59546626", "0.588771", "0.58380234", "0.5720538", "0.5705623", "0.5703395", "0.5682729", "0.5682729", "0.5640152", "0.5625858", "0.5624941", "0.56011736", "0.5589114", "0.5584368", "0.55840534", "0.55790627", "0.55451643", "0.55293804", "0.5524399", "0.5498496", "0.5482449", "0.5453824", "0.54083526", "0.5399751", "0.5375872", "0.5366914", "0.5356423", "0.53444016", "0.5341457", "0.5330569", "0.53026223", "0.5294125", "0.5293907", "0.5285676", "0.5276927", "0.52719575", "0.524691", "0.5239139", "0.523605", "0.5235047", "0.5223902", "0.5219222", "0.52132225", "0.5208783", "0.52080035", "0.52025694", "0.51976186", "0.51718366", "0.51703626", "0.5167006", "0.515403", "0.5150569", "0.5143224", "0.51403856", "0.5131762", "0.51280254", "0.5109352", "0.50819886", "0.5081947", "0.50775844", "0.50655526", "0.5059348", "0.5030457", "0.50283504", "0.5025793", "0.5024461", "0.4986393", "0.49831364", "0.49788478", "0.49752477", "0.49667838", "0.496404", "0.49598417", "0.49367183", "0.49350834", "0.49183324", "0.4912997" ]
0.65715486
9
Use this method to re_dispatch the workitem. It takes two options :in and :at for "later re_dispatch". Look at the unschedule_re_dispatch method for an example of participant implementation that uses re_dispatch. Without one of those options, the method is a "reject".
def re_dispatch(wi=nil, opts=nil) wi, opts = [ nil, wi ] if wi.is_a?(Hash) && opts.nil? wi ||= workitem() opts ||= {} wi.h.re_dispatch_count = wi.h.re_dispatch_count.to_s.to_i + 1 msg = { 'action' => 'dispatch', 'fei' => wi.h.fei, 'workitem' => wi.to_h, 'participant_name' => wi.participant_name } if t = opts[:in] || opts[:at] sched_id = @context.storage.put_schedule('at', wi.h.fei, t, msg) exp = fexp(wi) exp.h['re_dispatch_sched_id'] = sched_id exp.try_persist else @context.storage.put_msg('dispatch', msg) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requeue\n @action = :requeue\n end", "def reply (workitem)\n\n unschedule_timeout(workitem)\n\n super\n end", "def unschedule_re_dispatch(fei=nil)\n\n if s = fexp.h.re_dispatch_sched_id\n @context.storage.delete_schedule(s)\n end\n end", "def reschedule\n @req = Request.last\n RequestMailer.reschedule(@req)\n end", "def reschedule(job, time = T.unsafe(nil)); end", "def resched\n action('resched')\n end", "def reschedule\n\n h.schedule_id = @context.storage.put_schedule(\n 'cron',\n h.fei,\n h.schedule,\n 'action' => 'reply',\n 'fei' => h.fei,\n 'workitem' => h.applied_workitem)\n\n @context.storage.delete_schedule(h.schedule_id) if try_persist\n #\n # if the persist failed, immediately unschedule\n # the just scheduled job\n #\n # this is meant to cope with cases where one worker reschedules\n # while another just cancelled\n end", "def reschedule_job(scheduled_at = Time.current)\n with_advisory_lock do\n execution = head_execution(reload: true)\n\n raise ActionForStateMismatchError if execution.finished_at.present?\n\n execution.update(scheduled_at: scheduled_at)\n end\n end", "def do_trigger\n\n hit_exception = false\n\n begin\n\n @block.call @job_id, @at, @params\n\n rescue Exception => e\n\n @scheduler.send(:log_exception, e)\n\n hit_exception = true\n end\n\n if \\\n @scheduler.instance_variable_get(:@exit_when_no_more_jobs) or\n (@params[:dont_reschedule] == true) or\n (hit_exception and @params[:try_again] == false)\n\n @scheduler.instance_variable_get(:@non_cron_jobs).delete(job_id)\n # maybe it'd be better to wipe that reference from here anyway...\n\n return\n end\n\n #\n # ok, reschedule ...\n\n\n params[:job] = self\n\n @at = @at + Rufus.duration_to_f(params[:every])\n\n @scheduler.send(:do_schedule_at, @at, params)\n end", "def operation_relaunch(opid, param)\n call('operation_relaunch', opid, param)\n end", "def requeue\n __requeue__(\"RPUSH\")\n end", "def reschedule(time)\r\n \"missing time\" if time.nil?\r\n\r\n time_rufus = Rufus.to_datetime time\r\n\r\n @job.unschedule unless (self.time == :forever)\r\n\r\n @job = @scheduler.at time_rufus.to_s do\r\n @timed_out = true\r\n @subscribers.each { |object| object.timed_out }\r\n end\r\n\r\n @time = time\r\n end", "def requeue_perform_delay\n 1.0\n end", "def requeue_perform_delay\n 1.0\n end", "def _run\n super.tap { reenqueue }\n end", "def do_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n participant.consume(workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name)\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end", "def requeue\n update_attributes(failed: false, failed_at: nil, failure_reason: nil,\n delivered: false, delivered_at: nil)\n queue\n end", "def reschedule(time)\n assert_kind_of(Time, time)\n fail \"Time should not be in past\" if time < Time.now\n\n time = Rufus.to_datetime time\n\n self.job.unschedule\n\n self.job = self.scheduler.at time.to_s do\n self.timed_out = true\n self.subscribers.each { |object| object.timed_out }\n end\n end", "def trigger_dispatch_if_required\n return :ok if dispatch_pending.nil? or dispatch_pending == dispatched?\n if dispatch_pending\n run_callbacks :dispatched do\n self.dispatch_date = Time.now\n self.dispatch_pending = nil\n end\n else\n self.dispatch_date = nil\n end\n end", "def reschedule(job, time = nil)\n if (job.attempts += 1) < max_attempts(job)\n time ||= job.reschedule_at\n job.run_at = time\n job.unlock\n job.save!\n else\n job_say job, \"REMOVED permanently because of #{job.attempts} consecutive failures\", 'error'\n failed(job)\n end\n end", "def perform_later(*args, **options)\n __debug_job(__method__) { \"options = #{item_inspect(options)}\" } # TODO: remove\n job_warn { \"ignoring method args #{args.inspect}\" } if args.present?\n enqueue(options)\n end", "def reschedule(message, backtrace = [], time = nil)\n if self.attempts < MAX_ATTEMPTS\n time ||= Job.db_time_now + (attempts ** 4) + 5\n\n self.attempts += 1\n self.run_at = time\n self.last_error = message + \"\\n\" + backtrace.join(\"\\n\")\n self.unlock\n save!\n else\n logger.info \"* [JOB] PERMANENTLY removing #{self.name} because of #{attempts} consequetive failures.\"\n destroy_failed_jobs ? destroy : update_attribute(:failed_at, Delayed::Job.db_time_now)\n end\n end", "def dispatch(options = nil) # we can overwrite the operation if we want to\n\t\tif options.class == String\n\t\t\tself._operation = options\n\t\telsif options.class == Hash\n\t\t\tself._operation = options[:operation] if options[:operation]\n\t\tend\n\t\tif not self.class.dispatchable? or not self._operation\n\t\t\tlogger.info(\"#{self.class}/#{self._operation} not dispatchable, will not dispatch anything.\")\n\t\t\treturn\n\t\tend\n\t\tlogger.info(\"######### DISPATCHING: #{self.class}/#{self._operation}\")\n\t\tretry_at = Time.now\n\t\tif a = self.class._inki_dispatch_at\n\t\t\tretry_at = self.send(a)\n\t\t\tlogger.error(\"in da loop\")\n\t\tend\n\t\tlogger.error(\"#{self.class}/#{self._operation} will be dispatched at #{retry_at}.\")\n\t\tdispatch_hash = {\n\t\t\t:inki_model_name => self.class.table_name,\n\t\t\t:model_id => self.id,\n\t\t\t:model_operation => self._operation.to_s,\n\t\t\t:model_description => self._dispatch_model_description,\n\t\t\t:retry_at => retry_at,\n :lock_version => 1,\n\t\t\t:done => false,\n\t\t\t:locked => false, \n\t\t\t:owner_mail_address => self._owner_id\n\t\t}\n\t\tif options.class == Hash and options[:retry_at]\n\t\t\tdispatch_hash[:retry_at] = options[:retry_at]\t\n\t\tend\n\t\t# add 'yourself' to the dispatch-process, just to be sure\n\t\tif not self._dispatch_model_description \n\t\t\tdispatch_hash[:model_description] = self.to_yaml\n\t\tend\n\t\tdispatch = DispatchJob.new(dispatch_hash)\n\t\tsearch_filter = dispatch_hash.clone\n\t\tsearch_filter.delete(:retry_at)\n\t\t# there's nothing to do if there is already a dispatch-job in the queue that matches our dispatch-job.\n\t\tif DispatchJob.where(search_filter).first\n\t\t\tlogger.warn(\"Not inserting Dispatch-Job for #{dispatch_hash.inspect}, as this dispatch job already exists in the database.\")\n\t\t\treturn\n\t\telse\n\t\t\tdispatch.save\n\t\t\tlogger.info(\"owner id: #{self._owner_id}\")\n\t\t\tdispatch.update_owner(self._owner_id, self._owner_name)\n\t\tend\n\t\t# find out if this object has been deleted and if there is either a has_and_belongs_to_many or has_many_through association. \n\t\t# why? because the object on the \"other side\" has to be notified about the change (:update) - rails hasn't consistelnty im-\n\t\t# plemented that: http://guides.rubyonrails.org/association_basics.html#the-has-and-belongs-to-many-association\n\t\tif @notify_after_dispatch\n\t\t\t@notify_after_dispatch.each do |association|\n\t\t\t\tself.send(association).each do |other_object|\n\t\t\t\t\tother_object.dispatch(:update)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def reschedule_appointment\n if @client.appointments.length < 1\n puts \"You currently have no appointments\"\n sleep(2)\n else\n @prompt.select \"Which appointment would you like to Reschedule?\" do |menu|\n @client.appointments.each do |appt|\n menu.choice appt.time, -> { change_appt(appt) }\n end\n menu.choice \"<Go Back>\", -> { appointment_system } #back \n end\n end\n @client.reload\n\n appointment_system\n end", "def reschedule(message, backtrace = [], time = nil)\n if self.attempts < MAX_ATTEMPTS\n time ||= Job.db_time_now + (attempts ** 4) + 5\n\n self.attempts += 1\n self.run_at = time\n self.last_error = message + \"\\n\" + backtrace.join(\"\\n\")\n self.unlock\n save!\n else\n ::Rails.logger.info \"* [JOB] PERMANENTLY removing #{self.name} because of #{attempts} consequetive failures.\"\n destroy_failed_jobs ? destroy : update(:failed_at, Delayed::Job.db_time_now)\n end\n end", "def do_raw_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n Ruote.participant_send(\n participant, [ :on_workitem, :consume ], 'workitem' => workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name,\n 'workitem' => msg['workitem'])\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end", "def reschedule (scheduler)\n to_reschedule(scheduler)\n end", "def re_enqueue\n BulkImportWorker.perform_in(PERFORM_DELAY, @bulk_import.id)\n end", "def reschedule_appointment\n if @patient.appointments.length < 1\n puts \"You currently have no appointments\"\n sleep(2)\n else\n @prompt.select \"Which appointment would you like to Reschedule?\" do |menu|\n @patient.appointments.each do |appt|\n menu.choice appt.time, -> { change_appt(appt) }\n end\n menu.choice \"<Go Back>\", -> { appointment_system } #back \n end\n end\n @patient.reload\n appointment_system\n end", "def reschedule\n Logger.debug(klass: self.class, name: :reschedule, message: '')\n timers = @timers.to_a.dup\n @timers.clear\n\n timers.each do |timer|\n timer.reschedule\n add timer\n end\n end", "def resend\n if @resending && !@busy\n begin\n @busy = !@busy\n @fiat_config[:fiat][:transfer_type].each do |fiat|\n @resend_server ||= @fiat_server.send(fiat)\n count = @resend_server.resend\n @logger.info \"*** #{fiat} resend #{count} transfers ***\"\n end\n @busy_count = 0\n rescue Exception => e\n puts e.message\n ensure\n @busy = !@busy if @busy\n end\n elsif @resending && @busy\n @busy_count ||= 0\n @logger.info \"*** #Last resending job is still processing ***\"\n @busy_count += 1\n $logger.error \"[Fiat Resend] job processing for too long time: over '#{@busy_count}' times\" if @busy_count > 10\n end\n end", "def requeue\n Sidekiq.redis { |conn| conn.rpush(QueueName.expand(queue_name), job) }\n end", "def requeue_rapsheet_job(db_connection = nil)\n # if we're not being used inside a pipelined request, grab an\n # existing connection from the db pool\n if(db_connection.nil?)\n # call the rapsheet validation job with 'mute' paramter as true\n # to supress notifications when re-queing\n Store.db.rpush(queue_pending, job_rapsheet_validation_data(true))\n else\n # when a connection is provided, such as for a pipelined request\n # use it:\n # call the rapsheet validation job with 'mute' paramter as true to\n # supress notifications when re-queing\n db_connection.rpush(queue_pending, job_rapsheet_validation_data(true))\n end\n\n # update the status\n @status = \"requeued\"\n @location = \"PR.gov GMQ\"\n @state = :validating_rapsheet_with_sijc\n # save the transaction state\n save\n return true\n end", "def retry_item(item)\n @queue.retry_item(item)\n raise Timberline::ItemRetried\n end", "def retry\n self.class.enqueue(\n object,\n method_name,\n *(args << {\n :job_options => {\n :parent_id => parent_id || id,\n :run_at => Time.now + times_failed ** 4,\n :priority => priority\n }\n })\n )\n end", "def test_participant_re_dispatch_later_cancel\n\n pdef = Ruote.process_definition do\n alpha\n end\n\n @dashboard.register_participant :alpha, RetryParticipant, 'delay' => '1m'\n\n #noisy\n\n wfid = @dashboard.launch(pdef)\n sleep 0.7\n\n @dashboard.cancel_process(wfid)\n wait_for(wfid)\n\n assert_equal 0, @dashboard.storage.get_many('schedules').size\n end", "def try_again(job)\n if job['period'] && job['period'] > 0\n job['make_after'] = job['period']\n else\n job['make_after'] = job['attempt'] * JobReactor.config[:retry_multiplier]\n end\n job['args'].delete(:job_itself)\n self.storage.save(job) do |job|\n self.schedule(job)\n end\n end", "def work!(work_item)\n raise NotImplementedError\n end", "def requeue(queue, opts = {})\n queue_name = case queue\n when String, Symbol then queue\n else queue.name\n end\n\n note_state_change :requeue do\n @client.call('requeue', @client.worker_name, queue_name, @jid, @klass_name,\n JSON.dump(opts.fetch(:data, @data)),\n opts.fetch(:delay, 0),\n 'priority', opts.fetch(:priority, @priority),\n 'tags', JSON.dump(opts.fetch(:tags, @tags)),\n 'retries', opts.fetch(:retries, @original_retries),\n 'depends', JSON.dump(opts.fetch(:depends, @dependencies))\n )\n end\n end", "def perform_in_helper(item, interval, *args)\n int = interval.to_f\n now = Time.now.to_f\n ts = (int < 1_000_000_000 ? now + int : int)\n\n item.merge!('class' => self, 'args' => args, 'at' => ts)\n\n # Optimization to enqueue something now that is scheduled to go out now or in the past\n item.delete('at') if ts <= now\n\n client_push(item)\n end", "def requeue_request(req)\n msg = req[:sqs_msg]\n body = YAML.load(msg.body)\n if body[:original_req_id]\n @request_queue.send_message(message_body: msg.body, delay_seconds: 10)\n else\n body[:original_req_id] = msg.message_id\n @request_queue.send_message(message_body: YAML.dump(body), delay_seconds: 10)\n end\n msg.delete\n end", "def retry\n reque_single_job(params[:id])\n redirect_to failures_path(redirect_params)\n end", "def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end", "def requeue_request(job_id, opts = {})\n requeue_request_with_http_info(job_id, opts)\n return nil\n end", "def reque_single_job(id)\n if Resque::Failure.respond_to?(:requeue_and_remove)\n Resque::Failure.requeue_and_remove(id)\n else\n Resque::Failure.requeue(id)\n Resque::Failure.remove(id)\n end\n end", "def trigger_requeue!\n false\n end", "def dispatched!\n update dispatched: true\n end", "def appointment_reschedule_for_tutor(appointment_id, original_time)\n @appt = Appointment.find(appointment_id)\n @original_time = original_time\n set_appt_variables\n mail(to: @tutor.email, subject: \"Your Axon tutoring appointment has changed\")\n end", "def dispatch\n @queue.pop.run while @queue.ready?\n end", "def schedule_at_absolute_with_state(state, due_time, action)\n raise 'action cannot be nil' unless action\n\n due_time = now + 1 if due_time <= now && @increment_on_simultaneous\n\n super(state, due_time, action)\n end", "def sidekiq_enqueue\n ReminderDisplayWorker.perform_at(displayed_at, id)\n end", "def retry\n job = Job.find(params[:id])\n job.enter(Job::Scheduled)\n respond_with job do |format|\n format.html { redirect_to jobs_path }\n end\n end", "def retry_later\n @meta[Cworked_at] = nil\n @meta[Crt_count] += 1\n @meta[Crt_at] = Time.now.utc + (queue.rt_at_interval * @meta[Crt_count])\n put_meta\n\n rcache.lpush(queue.retries_cache_key, trx_id)\n rcache.lrem(queue.working_cache_key, 0, trx_id)\n end", "def dispatch!(clazz, method, options)\n Workling.find(clazz, method).dispatch_to_worker_method(method, options)\n end", "def trigger (scheduler)\n\n ldebug { \"trigger() timeout requested for #{@fei.to_debug_s}\" }\n\n set_timedout_flag(@applied_workitem)\n\n cancel\n\n reply_to_parent(@applied_workitem)\n end", "def requeue(exception)\n warn \"Re-queue: #{payload}\"\n warn exception.message\n main_exchange.nack(delivery_tag, false, true)\n end", "def reschedule\n reminders = DB.read_all(:shrk_reminders)\n reminders.each do |reminder|\n begin\n if Time.parse(reminder[:at]) <= Time.now\n send_reminder(\n SHRK.user(reminder[:user]),\n SHRK.channel(reminder[:channel]),\n Time.parse(reminder[:scheduled]),\n reminder[:message],\n )\n DB.delete_value(:shrk_reminders, :job_id, reminder[:job_id])\n else\n schedule_reminder(\n SHRK.user(reminder[:user]),\n SHRK.channel(reminder[:channel]),\n reminder[:at],\n reminder[:message],\n renew: true\n )\n end\n rescue Exception\n # Bot doesn't have the permissions to send a reminder somewhere.\n DB.delete_value(:shrk_reminders, :job_id, reminder[:job_id])\n end\n end\n end", "def reschedule_at(time, attempts)\n case attempts\n when (0..4)\n interval = 1.minute\n when (5..6)\n interval = 5.minutes\n else\n interval = 10.minutes\n end\n time + interval\n end", "def reschedule_at(time, attempts)\n case attempts\n when (0..4)\n interval = 1.minute\n when (5..6)\n interval = 5.minutes\n else\n interval = 10.minutes\n end\n time + interval\n end", "def cancel\n\n get_expression_pool.cancel(@children[0]) if @applied_workitem\n\n unschedule_timeout(nil)\n\n trigger_on_cancel # if any\n\n #super\n @applied_workitem\n end", "def perform_reactions(target, item)\n @log_window.display_reaction(target, item)\n BattleManager.reaction_processing = true\n last_subject = @subject\n @subject = target\n while @subject.current_action\n process_action\n end\n @subject = last_subject\n BattleManager.clear_reaction_processing\n end", "def retry(job, old_job, at)\n raise NotImplementedError\n end", "def call\n request_no = @request_queue.length\n Rails.logger.debug(\"Scheduling #{request_no} UN ComTrade requests\")\n\n interval =\n if request_no > MAX_REQUESTS_PER_HOUR\n BATCH_REQUEST_INTERVAL\n else\n REQUEST_INTERVAL\n end\n\n start_time = Time.now\n @request_queue.each.with_index do |uri, idx|\n Rails.logger.debug(\"Scheduling #{uri} ComTrade request\")\n ComTradeRequestWorker.perform_in(interval * idx, uri)\n end\n ComTradeRefreshWorker.perform_in(\n REQUEST_INTERVAL * request_no + 1.hour,\n start_time\n )\n end", "def retry_later\n IngestWorkflowMonitorJob.set(wait: 15.minutes).perform_later(flow.id, @params)\n end", "def reschedule\n\n return if @stopped\n\n t = OpenWFE::Timer.new\n\n linfo { 'reschedule() initiating...' }\n\n options = { :include_classes => Rufus::Schedulable }\n\n get_expression_storage.find_expressions(options).each do |fexp|\n\n linfo { \"reschedule() for #{fexp.fei.to_s}...\" }\n\n onotify(:reschedule, fexp.fei)\n\n fexp.reschedule(get_scheduler)\n end\n\n linfo { \"reschedule() done. (took #{t.duration} ms)\" }\n end", "def retract_tweet\n Resque.enqueue(RetractTweet, id)\n end", "def dispatch(*args)\n log(:debug) { 'Dispatch message to worker.' }\n\n fetch_idle_worker.future :dispatch, args\n end", "def reschedule_following_issues_with_fast_update\n if start_date_changed? || due_date_changed?\n cache_and_apply_changes do\n reschedule_dependent_issue\n end\n end\n end", "def reopen(circuit, opened_at, previous_opened_at)\n raise NotImplementedError\n end", "def reindex_later(**args)\n Spotlight::ReindexJob.perform_later(self, **args)\n end", "def queue_reload(queue)\n raise NotImplementedError\n end", "def do_reply_to_parent(workitem, delete=true)\n\n # propagate the cancel \"flavour\" back, so that one can know\n # why a branch got cancelled.\n\n flavour = if @msg.nil?\n nil\n elsif @msg['action'] == 'cancel'\n @msg['flavour'] || 'cancel'\n elsif h.state.nil?\n nil\n else\n @msg['flavour']\n end\n\n # deal with the timers and the schedules\n\n %w[ timeout_schedule_id job_id ].each do |sid|\n @context.storage.delete_schedule(h[sid]) if h[sid]\n end\n #\n # legacy schedule ids, to be removed for ruote 2.4.0\n\n @context.storage.delete_schedule(h.schedule_id) if h.schedule_id\n #\n # time-driven exps like cron, wait and once now all use h.schedule_id\n\n h.timers.each do |schedule_id, action|\n @context.storage.delete_schedule(schedule_id)\n end if h.timers\n\n # cancel flanking expressions if any\n\n cancel_flanks(h.state == 'dying' ? 'kill' : nil)\n\n # trigger or vanilla reply\n\n if h.state == 'failing' # on_error is implicit (#do_fail got called)\n\n trigger('on_error', workitem)\n\n elsif h.state == 'cancelling' && h.on_cancel\n\n trigger('on_cancel', workitem)\n\n elsif h.state == 'cancelling' && h.on_re_apply\n\n trigger('on_re_apply', workitem)\n\n elsif h.state == 'timing_out' && h.on_timeout\n\n trigger('on_timeout', workitem)\n\n elsif h.state == nil && h.on_reply\n\n trigger('on_reply', workitem)\n\n elsif h.flanking && h.state.nil?\n #\n # do vanish\n\n do_unpersist\n\n elsif h.lost && h.state.nil?\n #\n # do not reply, sit here (and wait for cancellation probably)\n\n do_persist\n\n elsif h.trigger && workitem['fields'][\"__#{h.trigger}__\"]\n #\n # the \"second take\"\n\n trigger(h.trigger, workitem)\n\n else # vanilla reply\n\n filter(workitem) if h.state.nil?\n\n f = h.state.nil? && attribute(:vars_to_f)\n Ruote.set(workitem['fields'], f, h.variables) if f\n\n workitem['sub_wf_name'] = h.applied_workitem['sub_wf_name']\n workitem['sub_wf_revision'] = h.applied_workitem['sub_wf_revision']\n\n leave_tag(workitem) if h.tagname\n\n (do_unpersist || return) if delete\n # remove expression from storage\n\n if h.parent_id && ! h.attached\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => h.parent_id,\n 'workitem' => workitem.merge!('fei' => h.fei),\n 'updated_tree' => h.updated_tree, # nil most of the time\n 'flavour' => flavour)\n\n else\n\n @context.storage.put_msg(\n (h.forgotten || h.attached) ? 'ceased' : 'terminated',\n 'wfid' => h.fei['wfid'],\n 'fei' => h.fei,\n 'workitem' => workitem,\n 'variables' => h.variables,\n 'flavour' => flavour)\n\n if\n h.state.nil? &&\n h.on_terminate == 'regenerate' &&\n ! (h.forgotten || h.attached)\n then\n @context.storage.put_msg(\n 'regenerate',\n 'wfid' => h.fei['wfid'],\n 'tree' => h.original_tree,\n 'workitem' => workitem,\n 'variables' => h.variables,\n 'flavour' => flavour)\n #'stash' =>\n end\n end\n end\n end", "def retry_send_submission\n now = DateTime.now.utc\n queued_at = efile_submission_transitions.where(to_state: \"queued\").pluck(:created_at).max\n if queued_at.nil?\n transition_to!(:failed, error_code: \"TRANSMISSION-SERVICE\", raw_response: \"Unable to retry_send_submission because submission was never queued.\")\n return\n end\n\n age = now.to_time - queued_at.to_time\n if age > 1.days\n transition_to!(:failed, error_code: \"TRANSMISSION-SERVICE\", raw_response: \"Deadline exceeded when retrying send submission. Waited for about 1 day.\")\n return\n end\n\n max_backoff = 60.minutes\n backoff =\n if age > max_backoff\n max_backoff\n else\n age ** 1.25\n end\n retry_wait = backoff + SecureRandom.rand(30)\n GyrEfiler::SendSubmissionJob.set(wait_until: now + retry_wait).perform_later(self)\n end", "def dispatch\n body = {\n 'command' => @command,\n 'nodes' => @nodes,\n 'run_timeout' => @timeout\n }\n\n ::Chef_Delivery::ClientHelper.enter_client_mode_as_delivery\n resp = @rest.post_rest('/pushy/jobs', body)\n ::Chef_Delivery::ClientHelper.leave_client_mode_as_delivery\n\n @job_uri = resp['uri']\n refresh\n end", "def test_participant_re_dispatch_later\n\n pdef = Ruote.process_definition do\n alpha\n end\n\n @dashboard.register_participant :alpha, RetryParticipant\n\n wfid = @dashboard.launch(pdef)\n wait_for(wfid)\n\n times = @tracer.to_s.split(\"\\n\").collect { |t| Float(t) }\n t = times.last - times.first\n\n assert t >= 1.0, \"took less that 1 second\"\n assert t < 2.8, \"took more than 2.8 second\"\n end", "def schedule_timeout (workitem, timeout_attname=:timeout)\n\n determine_timeout(workitem, timeout_attname)\n to_reschedule(get_scheduler)\n end", "def reschedule?(delayed_job)\n return false if finished_at.present?\n\n instance = name.constantize.new(self)\n return false if !instance.respond_to?(:reschedule?)\n\n instance.reschedule?(delayed_job)\n end", "def reschedule_at(current_time, attempts)\n current_time + ((attempts**4) + 1).hours\n end", "def reschedule\n timers = nil\n\n timers = @timers.dup\n @timers.clear\n\n timers.each do |timer|\n timer.reschedule\n add timer\n end\n end", "def perform( action, workitem )\n @action, @workitem = action, workitem\n\n begin\n send( action )\n run_callbacks\n rescue => e\n handle_exception( e )\n end\n end", "def dispatch_cancel(msg)\n\n flavour = msg['flavour']\n\n participant = @context.plist.instantiate(msg['participant'])\n\n begin\n participant.cancel(Ruote::FlowExpressionId.new(msg['fei']), flavour)\n rescue => e\n raise(e) if flavour != 'kill'\n end\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => msg['fei'],\n 'workitem' => msg['workitem'])\n end", "def redo!\n send_request\n end", "def requeue_timed_out_jobs\n # older than x\n jobs.where{started_working_at <= (Time.now - EQ.config.job_timeout)}\\\n .update(started_working_at: nil)\n end", "def dispatch(ticket_id = self.id)\n get_lock? ? push_to_client(ticket_id) : blocking(ticket_id)\n end", "def extend()\n # Get the appointment\n appointment = current_user.appointments.last\n student_id = current_user.id\n tutor_id = appointment.tutor.id\n # Get the sidekiq job\n jids = appointment.jids.split('|')\n jid_reminder = jids[0]\n jid_complete = jids[1]\n job_reminder = Sidekiq::ScheduledSet.new.find_job(jid_reminder)\n job_complete = Sidekiq::ScheduledSet.new.find_job(jid_complete)\n complete_new_time = job_complete.at + Settings.call_extend_time\n reminder_new_time = complete_new_time - Settings.call_speak_reminder_time\n\n if job_complete.reschedule(complete_new_time) &&\n job_reminder.reschedule(reminder_new_time)\n # update the appointment cost and call time\n appointment.update_attribute(:amount, appointment.amount + Settings.call_extend_cost)\n appointment.update_attribute(:tutor_earned, appointment.tutor_earned + Settings.call_extend_earned)\n # notify the student and the tutor\n msg = I18n.t('appointment.conference_room.call_extend', \n time: Settings.call_extend_time)\n MessageBroadcastJob.perform_later(msg, 'notification',\n student_id: student_id,\n tutor_id: tutor_id)\n else\n msg = I18n.t('students.errors.appointment.call_extend')\n MessageBroadcastJob.perform_later(msg, 'notification',\n student_id: student_id)\n end\n end", "def replay(replay_upto = nil)\n task = @task_provider.get_decision_task(replay_upto)\n @task_handler.handle_decision_task(task) unless task.nil?\n end", "def schedule_at_absolute_with_state(state, due_time, action)\n raise 'action cannot be nil' unless action\n\n si = nil\n run = lambda {|scheduler, state1|\n @queue.delete si\n action.call(scheduler, state1)\n }\n\n si = ScheduledItem.new(self, state, due_time, &run)\n @queue.push si\n\n Subscription.create { si.cancel }\n end", "def to_reschedule (scheduler)\n\n #return if @timeout_job_id\n #\n # already rescheduled\n\n return unless @timeout_at\n #\n # no need for a timeout\n\n @timeout_job_id = \"timeout_#{self.fei.to_s}\"\n\n scheduler.schedule_at(\n @timeout_at,\n { :schedulable => self,\n :job_id => @timeout_job_id,\n :do_timeout! => true,\n :tags => [ \"timeout\", self.class.name ] })\n\n ldebug do\n \"to_reschedule() will timeout at \" +\n \"#{Rufus::to_iso8601_date(@timeout_at)}\" +\n \" @timeout_job_id is #{@timeout_job_id}\" +\n \" (oid #{object_id})\"\n end\n\n #store_itself()\n #\n # done in the including expression\n end", "def request_recalculate\n @pending_recalculate_request = true\n end", "def step_unschedule\n\n loop do\n\n break if @unschedule_queue.empty?\n\n do_unschedule(@unschedule_queue.pop)\n end\n end", "def planning_work\n self.planned_at = Time.now\n self.unfreeze_request! if self.frozen?\n self.push_msg\n end", "def around_perform_insist(*args)\n if redis.get \"plugin:insist:wait:#{insist_key(args)}\"\n Resque.enqueue constantize(self.to_s), *args\n else\n begin\n yield\n redis.del \"plugin:insist:attempts:#{insist_key(args)}\"\n rescue => e\n attempts = redis.incr \"plugin:insist:attempts:#{insist_key(args)}\"\n if attempts.to_i >= insist_times\n redis.del \"plugin:insist:wait:#{insist_key(args)}\"\n redis.del \"plugin:insist:attempts:#{insist_key(args)}\"\n raise e\n else\n redis.set \"plugin:insist:wait:#{insist_key(args)}\", 1\n redis.expire \"plugin:insist:wait:#{insist_key(args)}\", wait_time(attempts)\n Resque.enqueue constantize(self.to_s), *args\n end\n end\n end\n end", "def work( payload, metadata )\n\t\tself.job_counter.mark\n\t\tself.job_timer.time do\n\t\t\tsuper\n\t\tend\n\tend", "def confirm_reschedule\n reschedule = ApptRescheduler.new(@appt.id, params).format_new_time\n if reschedule[:success] == true\n @new_start_time = reschedule[:new_start_time]\n @new_slot_id = reschedule[:new_slot_id]\n end\n render layout: '../dashboard/student/home/confirm_reschedule'\n end", "def submit( klass, data, opts)\n data[:root_job] = true\n if @opts[:recur] then \n recur_time = @opts[:recur].to_i\n LOGGER.info \"submitting #{klass} job, every #{recur_time} seconds\" \n # add timestamp : submit_time \n @queue.recur( klass, data, recur_time )\n else\n LOGGER.info \"submitting #{klass} single (non recurring) job\" \n \n @queue.put(klass, data)\n end\n end", "def apply\n unless agent.state[\"busy\"] > 0 || agent.state[\"queued_actions\"].empty?\n # Pull the first entry off the action queue\n queue = @agent.state[\"queued_actions\"]\n if queue && queue.size > 0\n if @action_queue_number != queue[0][2]\n @engine.admin_warning(\"Somehow the agent's action queue has gotten screwed up mid-offer!\", \"agent\" => @name)\n else\n queue.shift # Remove the queue entry\n end\n end\n agent.run_action(@action_name, *@action_args, current_intention: self)\n agent.state[\"busy\"] += (@action_struct[\"busy\"] || 1)\n end\n end", "def process_queue\n begin\n while blk = Merb::Dispatcher.work_queue.pop\n # we've been blocking on the queue waiting for an item sleeping.\n # when someone pushes an item it wakes up this thread so we \n # immediately pass execution to the scheduler so we don't \n # accidentally run this block before the action finishes \n # it's own processing\n Thread.pass\n blk.call\n end\n rescue Exception => e\n Merb.logger.warn! %Q!Worker Thread Crashed with Exception:\\n#{Merb.exception(e)}\\nRestarting Worker Thread!\n retry\n end\n end", "def re_dispatch_count\n\n h.re_dispatch_count || 0\n end", "def perform_scrap_item_replacement( scrap_recover_quantity) \n self.scrapped_quantity -= scrap_recover_quantity \n self.save \n \n self.unmark_as_finished \n \n item.deduct_scrap_quantity( scrap_recover_quantity ) \n \n return self\n end", "def perform_scrap_item_replacement( scrap_recover_quantity) \n self.scrapped_quantity -= scrap_recover_quantity \n self.save \n \n self.unmark_as_finished \n \n item.deduct_scrap_quantity( scrap_recover_quantity ) \n \n return self\n end" ]
[ "0.6316928", "0.6085091", "0.60215694", "0.5790598", "0.57287294", "0.5726804", "0.5712782", "0.5612365", "0.56099004", "0.5555017", "0.55294377", "0.5504642", "0.5460236", "0.5460236", "0.5415176", "0.5389228", "0.5353655", "0.53491056", "0.52825385", "0.52738285", "0.52719975", "0.5257132", "0.52535284", "0.5252989", "0.52496755", "0.5159231", "0.5146283", "0.51415133", "0.5051987", "0.5022514", "0.5006401", "0.49995723", "0.4965658", "0.49548662", "0.4954052", "0.49433666", "0.49376068", "0.49364823", "0.49308094", "0.4922018", "0.48644724", "0.4838181", "0.4821205", "0.48081955", "0.47998527", "0.47945428", "0.47847944", "0.47754738", "0.47697422", "0.47562194", "0.47421223", "0.47322923", "0.47321883", "0.47316992", "0.47240072", "0.47188082", "0.47158676", "0.47128922", "0.47128922", "0.47086516", "0.47013366", "0.4695313", "0.46919787", "0.4685359", "0.46850806", "0.46490985", "0.46475434", "0.46018508", "0.4599008", "0.45931923", "0.4592956", "0.45908102", "0.45862976", "0.4583649", "0.4579558", "0.45747653", "0.45644432", "0.4563791", "0.45610553", "0.45389822", "0.4531951", "0.45315686", "0.45294127", "0.45171416", "0.45118192", "0.44986022", "0.4496573", "0.44962937", "0.4489144", "0.4481148", "0.44713724", "0.4469617", "0.4468925", "0.4468841", "0.44630635", "0.44527605", "0.44412673", "0.4440821", "0.44398892", "0.44398892" ]
0.78486353
0
Cancels the scheduled re_dispatch, if any. An example of 'retrying participant' : class RetryParticipant include Ruote::LocalParticipant def initialize(opts)
def unschedule_re_dispatch(fei=nil) if s = fexp.h.re_dispatch_sched_id @context.storage.delete_schedule(s) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_participant_re_dispatch_later_cancel\n\n pdef = Ruote.process_definition do\n alpha\n end\n\n @dashboard.register_participant :alpha, RetryParticipant, 'delay' => '1m'\n\n #noisy\n\n wfid = @dashboard.launch(pdef)\n sleep 0.7\n\n @dashboard.cancel_process(wfid)\n wait_for(wfid)\n\n assert_equal 0, @dashboard.storage.get_many('schedules').size\n end", "def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end", "def set_retry(opts)\n opts = check_params(opts,[:retries])\n super(opts)\n end", "def test_participant_re_dispatch_later\n\n pdef = Ruote.process_definition do\n alpha\n end\n\n @dashboard.register_participant :alpha, RetryParticipant\n\n wfid = @dashboard.launch(pdef)\n wait_for(wfid)\n\n times = @tracer.to_s.split(\"\\n\").collect { |t| Float(t) }\n t = times.last - times.first\n\n assert t >= 1.0, \"took less that 1 second\"\n assert t < 2.8, \"took more than 2.8 second\"\n end", "def retry\n self.solved(:retry)\n end", "def cancel\n @client.call('unrecur', @jid)\n end", "def retry!\n raise RetryMessage\n end", "def initialize\n @sleep_time = nil\n @number_of_retries = nil\n end", "def cancel_participant\n\n return unless @applied_workitem\n #\n # if there is an applied workitem, it means there\n # is a participant to cancel...\n\n participant = get_participant_map.lookup_participant(@participant_name)\n\n cancelitem = CancelItem.new(@applied_workitem)\n\n get_participant_map.dispatch(participant, @participant_name, cancelitem)\n end", "def uncancel\r\n @plan = check_security(params[:id])\r\n @plan.uncancel(current_user)\r\n\r\n #MES- Every user is notified of an uncancel- it's like an\r\n # invitation.\r\n @plan.planners.each do | plnr |\r\n user = plnr.owner\r\n if user != current_user &&\r\n UserAttribute::FALSE_USER_ATT_VALUE != user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL).to_i &&\r\n UserAttribute::INVITE_NOTIFICATION_ALWAYS == user.get_att_value(UserAttribute::ATT_INVITE_NOTIFICATION_OPTION).to_i\r\n UserNotify.deliver_uncancel_plan(current_user, plnr.owner, @plan)\r\n end\r\n end\r\n flash[:notice] = \"This plan is reinstated.<br/>All attendees have been re-invited.\"\r\n redirect_back\r\n end", "def retry(timeout_or_schedule)\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:retry]}=#{timeout_or_schedule}\"\n self\n end", "def dispatch_cancel(msg)\n\n flavour = msg['flavour']\n\n participant = @context.plist.instantiate(msg['participant'])\n\n result = begin\n\n Ruote.participant_send(\n participant,\n [ :on_cancel, :cancel ],\n 'fei' => Ruote::FlowExpressionId.new(msg['fei']),\n 'flavour' => flavour)\n\n rescue => e\n raise(e) if flavour != 'kill'\n end\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => msg['fei'],\n 'workitem' => msg['workitem']\n ) if result != false\n end", "def cancel(*)\n super.tap do\n __debug_sim('USER has decided to withdraw the submission.')\n end\n end", "def cancel\n # Define this later\n end", "def retry\n super\n end", "def dispatch_cancel(msg)\n\n flavour = msg['flavour']\n\n participant = @context.plist.instantiate(msg['participant'])\n\n begin\n participant.cancel(Ruote::FlowExpressionId.new(msg['fei']), flavour)\n rescue => e\n raise(e) if flavour != 'kill'\n end\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => msg['fei'],\n 'workitem' => msg['workitem'])\n end", "def cancellor\n @cancellor ||= Cancellor.new(self)\nend", "def retry_options\n {tries: 15, sleep: 1}\n end", "def cancel_rebilling_cycle(rebill_id)\n @PARAM_HASH[\"TRANS_TYPE\"] = \"SET\"\n @PARAM_HASH[\"STATUS\"] = \"stopped\"\n @PARAM_HASH[\"REBILL_ID\"] = rebill_id\n end", "def cancel!; end", "def cancel \n unless self.status == 'canceled'\n ev = Event.create(\n :event_type => :subscription,\n :event_subtype => :cancel,\n :user => self.user,\n :detail_i1 => self.id\n ) \n \n Rails::logger.debug \"Calling chargify to cancel subscription ID #{self.chargify_id}\" \n Sherlock::Chargify.new.cancel(self.chargify_id) \n \n Rails::logger.debug \"Adjusting my own status to 'canceled'\" \n \n self.status = 'canceled'\n self.save\n \n ev.finish\n \n InfusionsoftUtils.update_contact(self)\n end\n \n end", "def test_cancel\n\n pdef = Ruote.process_definition do\n sequence do\n bravo :flank => true\n alpha\n end\n end\n\n @dashboard.register_participant '.+', Ruote::NullParticipant\n\n wfid = @dashboard.launch(pdef)\n\n @dashboard.wait_for(:alpha)\n @dashboard.wait_for(1)\n\n fei = @dashboard.ps(wfid).expressions[1].fei\n\n @dashboard.cancel(fei)\n\n @dashboard.wait_for(wfid)\n sleep 1.0\n\n assert_nil @dashboard.ps(wfid)\n end", "def cancelled_requests; end", "def initialize(name, last_run_timestamp, auto_retry)\n # name is a string\n # last_run_timestamp can either be a Time object, or a string denoting a time\n # In the case of queued jobs, last_run_timestamp > between the scheduled_timestamp (passed into get_task_objects) and\n # less than the current timestamp. Scheduled_timestamp pluss .1 second should work well\n raise ScheduledTaskException, \"initialize not overridden in #{self.class}\"\n end", "def test_on_error_retry\n\n pdef = Ruote.process_definition do\n sequence :on_error => :retry do\n troublemaker\n end\n end\n\n @dashboard.register_participant :troublemaker, TroubleMaker\n\n assert_trace(%w[ 1 2 done. ], pdef)\n end", "def cancel_rebilling_cycle(rebill_id)\r\n @PARAM_HASH[\"TRANS_TYPE\"] = \"SET\"\r\n @PARAM_HASH[\"STATUS\"] = \"stopped\"\r\n @PARAM_HASH[\"REBILL_ID\"] = rebill_id\r\n @api = \"bp20rebadmin\"\r\n end", "def cancel_rebilling_cycle(rebill_id)\r\n @PARAM_HASH[\"TRANS_TYPE\"] = \"SET\"\r\n @PARAM_HASH[\"STATUS\"] = \"stopped\"\r\n @PARAM_HASH[\"REBILL_ID\"] = rebill_id\r\n @api = \"bp20rebadmin\"\r\n end", "def cancel\n self.solved(:abort)\n end", "def test_restart\n\n start_new_engine\n\n pdef = Ruote.process_definition :name => 'test' do\n participant 'alpha', :timeout => '2d'\n end\n\n @dashboard.register_participant 'alpha', Ruote::NullParticipant\n\n wfid = @dashboard.launch(pdef)\n\n wait_for(3)\n\n assert_equal 1, @dashboard.processes.size\n assert_equal 1, @dashboard.storage.get_many('schedules').size\n\n @dashboard.shutdown\n\n # restart...\n\n start_new_engine\n\n @dashboard.register_participant 'alpha', Ruote::NullParticipant\n\n assert_equal 1, @dashboard.processes.size\n assert_equal 1, @dashboard.storage.get_many('schedules').size\n\n @dashboard.cancel_process(wfid)\n\n wait_for(wfid)\n\n assert_equal 0, @dashboard.processes.size\n assert_equal 0, @dashboard.storage.get_many('schedules').size\n end", "def cancel\n @timers.cancel self\n end", "def resign!(delay = nil)\n @strategy.resign delay\n end", "def mission_abort_protocol\n puts \"\"\n puts \"The launch was aborted!\"\n puts \"\"\n puts \"Would you like to retry mission: #{@mission.name}? (y/n):\"\n\n if affirm_prompt\n @mission.reset\n execute_mission\n end\n end", "def cancel!\n self.type = :unsubscribed\n reply_if_needed!\n end", "def retry!\n raise 'Not implemented!'\n end", "def initialize(participants, reschedule_date, psc)\n @participants = participants\n @reschedule_date = reschedule_date\n @psc = psc\n end", "def reply (workitem)\n\n unschedule_timeout(workitem)\n\n super\n end", "def cancel_timer\n if @restart_vote_timer\n @restart_vote_timer.cancel\n @restart_vote_timer = nil\n @restart_vote_count = 0\n end\n true\n end", "def cancel_launch\n destination = \"\" #just create local variable\n self.destination = \"\" #here self refers to instance\n end", "def re_dispatch(wi=nil, opts=nil)\n\n wi, opts = [ nil, wi ] if wi.is_a?(Hash) && opts.nil?\n wi ||= workitem()\n opts ||= {}\n\n wi.h.re_dispatch_count = wi.h.re_dispatch_count.to_s.to_i + 1\n\n msg = {\n 'action' => 'dispatch',\n 'fei' => wi.h.fei,\n 'workitem' => wi.to_h,\n 'participant_name' => wi.participant_name\n }\n\n if t = opts[:in] || opts[:at]\n\n sched_id = @context.storage.put_schedule('at', wi.h.fei, t, msg)\n\n exp = fexp(wi)\n exp.h['re_dispatch_sched_id'] = sched_id\n exp.try_persist\n\n else\n\n @context.storage.put_msg('dispatch', msg)\n end\n end", "def cancel!\r\n return if [:cancel].include? m.status\r\n raise \"Invalid state: message must be new, retry, or fail to cancel!\" unless [:new, :retry, :fail].include? m.status\r\n self.status = :cancel\r\n self.save!\r\n end", "def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end", "def retry\n reque_single_job(params[:id])\n redirect_to failures_path(redirect_params)\n end", "def lock_timeout_retry_delay=(_arg0); end", "def do_cancel (msg)\n\n flavour = msg['flavour']\n\n return if h.state == 'cancelling' && flavour != 'kill'\n # cancel on cancel gets discarded\n\n return if h.state == 'failed' && flavour == 'timeout'\n # do not timeout expressions that are \"in error\" (failed)\n\n @msg = Ruote.fulldup(msg)\n\n h.state = case flavour\n when 'kill' then 'dying'\n when 'timeout' then 'timing_out'\n else 'cancelling'\n end\n\n h.applied_workitem['fields']['__timed_out__'] = [\n h.fei, Ruote.now_to_utc_s\n ] if h.state == 'timing_out'\n\n if h.state == 'cancelling'\n\n if t = msg['on_cancel']\n\n h.on_cancel = t\n\n elsif hra = msg['re_apply']\n\n hra = {} if hra == true\n h.on_cancel = hra['tree'] || tree\n if fs = hra['fields']\n h.applied_workitem['fields'] = fs\n end\n if mfs = hra['merge_in_fields']\n h.applied_workitem['fields'].merge!(mfs)\n end\n end\n end\n\n cancel(flavour)\n end", "def cancel(id); end", "def lock_timeout_retries=(_arg0); end", "def retryable( options = {}, &block )\n opts = { :tries => 1, :on => Exception }.merge(options)\n\n return nil if opts[:tries] == 0\n \n retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]\n \n begin\n return yield\n rescue *retry_exception\n retry if (tries -= 1) > 0\n end\n \n yield\nend", "def cancel_old_tasks\n if disposition == \"granted\"\n old_docket_stream.cancel_active_tasks\n else\n docket_switchable_tasks.reject(&:post_distribution?).each(&:cancel_task_and_child_subtasks)\n end\n end", "def cancel; end", "def cancel; end", "def retry\n self.class.enqueue(\n object,\n method_name,\n *(args << {\n :job_options => {\n :parent_id => parent_id || id,\n :run_at => Time.now + times_failed ** 4,\n :priority => priority\n }\n })\n )\n end", "def cancel\n @timers.cancel self\n end", "def cancel(params={})\n self.request(__method__, params)\n end", "def reset_failed_attempts!; end", "def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end", "def cancel\n to_run.clear\n reset\n current_self\n end", "def cancel\n @active = false\n\t\t\[email protected]_sorted self\n end", "def trigger_failover_retry pref, attempt\n trigger_failover_event :retry, pref, attempt, self.active_client\n end", "def cancel_recurring_subscription(subscriber_id, merchant_account)\n fetch_route = find_route(__method__.to_s)\n requested_path = fetch_route[:path]\n\n client.post(\n requested_path,\n fetch_route[:api],\n {\n 'contract' => 'RECURRING',\n 'shopperReference' => subscriber_id,\n 'merchantAccount' => merchant_account\n }\n )\n end", "def test_participant_re_dispatch_no_params\n\n @dashboard.register_participant :alpha, ReluctantParticipant\n\n assert_trace(%w[ x x ], Ruote.define { alpha })\n end", "def initialize(args = {})\n # The default behavior is to retry forever.\n @retries = args[:retries] || ForeverSentinel\n end", "def do_job\r\n# disable recycle invites\r\n# min = Time.now.min\r\n# #recycle invites 1 min per hour\r\n# if min == 0\r\n# ret = ActiveRecord::Base.connection.execute(\"delete from invites where invitee_id is null and created_at < subdate(now(), interval 3 day)\")\r\n# puts \"recycle invites: #{ret}\"\r\n# end\r\n end", "def resubscribe!\n update!(unsubscribed_at: nil, resubscribed_at: ::Caffeinate.config.time_now)\n\n caffeinate_campaign.to_dripper.run_callbacks(:on_resubscribe, self)\n end", "def reschedule(message, backtrace = [], time = nil)\n if self.attempts < MAX_ATTEMPTS\n time ||= Job.db_time_now + (attempts ** 4) + 5\n\n self.attempts += 1\n self.run_at = time\n self.last_error = message + \"\\n\" + backtrace.join(\"\\n\")\n self.unlock\n save!\n else\n logger.info \"* [JOB] PERMANENTLY removing #{self.name} because of #{attempts} consequetive failures.\"\n destroy_failed_jobs ? destroy : update_attribute(:failed_at, Delayed::Job.db_time_now)\n end\n end", "def retry_change_requests=(retri); end", "def retryable(opts = nil)\n opts = { tries: 1, on: Exception }.merge(opts || {})\n\n begin\n return yield\n rescue *opts[:on] => e\n if (opts[:tries] -= 1) > 0\n $stderr.puts(\"Retryable exception raised: #{e.inspect}\")\n\n sleep opts[:sleep].to_f if opts[:sleep]\n retry\n end\n raise\n end\nend", "def calculate_retry_after(env); end", "def retrymsg(msgid)\n req(\"retrymsg\", \"\", \"\", msgid, \"\")\n end", "def cancel_action(msg=nil)\n raise_hook_failure(msg)\n end", "def cancel_action(msg=nil)\n raise_hook_failure(msg)\n end", "def cancel\n super\nend", "def retry_interval\n @retry_interval ||= options[:retry_interval] || RETRY_INTERVAL\n end", "def reschedule(job, time = T.unsafe(nil)); end", "def initialize(retryable)\n @retryable = retryable\n end", "def cancel_scheduled_play(params)\n path = @version + '/Call/Play/Schedule/Cancel/'\n method = 'POST'\n return request(path, method, params)\n end", "def retry_scenario(_scenario)\n raise NotImplementedError.new \\\n \"#{self.class.name}#retry_scenario must be implemented in subclass.\"\n end", "def reschedule\n @req = Request.last\n RequestMailer.reschedule(@req)\n end", "def restart_actor(actor, reason)\n start_actor\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n end", "def cancel\n end", "def cancel!\n if charged && !canceled\n refund!\n recharge!\n end\n end", "def reschedule(message, backtrace = [], time = nil)\n if self.attempts < MAX_ATTEMPTS\n time ||= Job.db_time_now + (attempts ** 4) + 5\n\n self.attempts += 1\n self.run_at = time\n self.last_error = message + \"\\n\" + backtrace.join(\"\\n\")\n self.unlock\n save!\n else\n ::Rails.logger.info \"* [JOB] PERMANENTLY removing #{self.name} because of #{attempts} consequetive failures.\"\n destroy_failed_jobs ? destroy : update(:failed_at, Delayed::Job.db_time_now)\n end\n end", "def retry_change_requests; end", "def retry_change_requests; end" ]
[ "0.7231477", "0.6118492", "0.61060846", "0.60801023", "0.58072376", "0.5660678", "0.5636772", "0.5621804", "0.5502451", "0.5500963", "0.5495482", "0.5494649", "0.5482683", "0.54642874", "0.5449592", "0.54485846", "0.5436719", "0.541484", "0.5372443", "0.53614", "0.5355417", "0.5348621", "0.53431624", "0.5341906", "0.5325981", "0.5309833", "0.5309833", "0.529697", "0.5250427", "0.5241589", "0.5238835", "0.5225582", "0.52215844", "0.5219579", "0.5212216", "0.52098703", "0.5192595", "0.51898736", "0.5185808", "0.51808006", "0.5177526", "0.5156763", "0.5156707", "0.51563567", "0.5150112", "0.5144838", "0.5144115", "0.51416445", "0.51410544", "0.51410544", "0.5140532", "0.5131143", "0.5126029", "0.5114966", "0.5111292", "0.5109845", "0.5108078", "0.5098516", "0.50982326", "0.5097205", "0.50922954", "0.5092283", "0.5088981", "0.5081267", "0.5077122", "0.507563", "0.50749993", "0.5074834", "0.50746524", "0.50746524", "0.5073453", "0.50731695", "0.50728995", "0.5069632", "0.5068733", "0.5066534", "0.5066", "0.50545895", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5049596", "0.5037001", "0.5037001", "0.50244707", "0.502385", "0.5014153", "0.5014153" ]
0.0
-1
test methods prefixed with an underscore ++ Test shortcut, alleviates the need to set the workitem before calling consume / on_workitem.
def _on_workitem(wi) Ruote.participant_send( self, [ :on_workitem, :consume ], 'workitem' => wi) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_tests\n end", "def _test_message ; process_test_case(\"message\") ; end", "def test_case; end", "def stest_method_1(test); end", "def tests; end", "def tests; end", "def work!(work_item)\n raise NotImplementedError\n end", "def running_test_case; end", "def test_setup\r\n \r\n end", "def __dummy_test__\n end", "def test \n end", "def test_step; end", "def test_method\n end", "def test\n end", "def test\n end", "def test\n end", "def self_test; end", "def self_test; end", "def testing\n # ...\n end", "def tests=(_arg0); end", "def tests=(_arg0); end", "def test\n\n end", "def test; end", "def ptest_method_1(test); end", "def consume (workitem)\n # does nothing and does not reply to the engine.\n end", "def _test_text ; process_test_case(\"text\") ; end", "def xit(description, &block)\n @tests[description] = :pending\n end", "def running_test_step; end", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def testloop\n \n end", "def test_cases; end", "def default_test; end", "def run(test)\r\n @tests << test\r\n end", "def test_a\n end", "def test_nothing; end", "def test_nothing\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def test_marked\n end", "def _it( test )\n puts \"--- On saute les tests pour \\\"#{test}\\\" ---\"\n end", "def test_nothing\n end", "def default_test\r\n end", "def test_acknowledgement \n end", "def testing\n yield @test if @test\n end", "def method_missing(m)\n if m.to_s =~ /test_/\n @untested += 1\n else\n super\n end\n end", "def before_test(test); end", "def before_test(test); end", "def message_for(test); end", "def message_for(test); end", "def test_legacy\n # Set up legacy handlers\n setup_legacy_handling\n\n common_tests\n end", "def test_playlist\n end", "def test_entry\n raise 'Implement the method \"test_entry\" in your test class'\n end", "def test05_NoteTwoComments_TC_24319\n\t\tcommentNotePop\n\t\tcommentPopSubmit\n\tend", "def run(test)\n @tests << test\n end", "def test_0_dummy\n\t\tend", "def test_the_application_can_update_a_previous_item_description_on_our_to_do_list\n #Implement the test\n #Implement the controller action\n end", "def test_steps; end", "def test_steps; end", "def testShortcut\n execute_Deliver_WithConf({\n :WaveFiles => { :FilesList => [ { :Name => 'Wave1.wav' } ] },\n :Mix => { 'Mix1' => { :Tracks => { 'Wave1.wav' => {} } } },\n :Deliver => {\n :Formats => {\n 'Test' => {\n :FileFormat => 'Wave'\n }\n },\n :Deliverables => {\n 'Deliverable' => {\n :Mix => 'Mix1',\n :Format => 'Test'\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Mixed_Wave1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert_wave_lnk '01_Source/Wave/Wave1', '06_Deliver/Deliverable/Track.wav'\n end\n end", "def test desc, &block\n self.setup {}\n desc = Testing::Functions.make_constantizeable(desc)\n if block_given?\n test = \"test_#{desc.gsub(/\\W+/, '_').downcase}\"\n define_method(test, &lambda {$current_spec = self; instance_eval(&block)})\n (@@_tests ||= []) << test.to_sym\n (@own_tests ||= []) << test.to_sym\n end\n self.teardown {}\n end", "def dwp_work(work_item)\n dwp_log{ \"Working, item: #{work_item.inspect}\" }\n dwp_run_callback('before_work', work_item)\n work!(work_item)\n dwp_run_callback('after_work', work_item)\n end", "def setup\r\n\r\n # Save the Global variable's original settings so that they can be changed in this\r\n # test without affecting other test, so long as they are restored by teardown\r\n @@VERBOSE_ORIG = $VERBOSE\r\n @@DEBUG_ORIG = $DEBUG\r\n @@FAST_SPEED_ORIG = $FAST_SPEED\r\n @@HIDE_IE_ORIG = $HIDE_IE\r\n\r\n # Record the time that current test case starts\r\n @@tTestCase_StartTime = Time.now\r\n\r\n # Start a new Logger Object and assign it to a Global Object\r\n #\r\n # Using the default values:\r\n # Create a \"waitr_works/results\" directory within the OS's Temporary directory\r\n # That directory will contain the single log file used for all tests.\r\n # If the current log file gets too big, output rolls to another log file.\r\n if(@@bLogOutput == true)\r\n $logger = capture_results()\r\n end\r\n\r\n # Hide the annoying console window so that it doesn't cover any of the screen\r\n minimize_ruby_console()\r\n\r\n # Record the test environment if it hasen't already been recorded\r\n if($bEnvironmentRecorded != true)\r\n $bEnvironmentRecorded = record_environment()\r\n @@bContinue = $bEnvironmentRecorded\r\n end\r\n\r\n # Open the Workbook containing the data for the test cases,\r\n # and read the data into memory if it hasen't already been read\r\n if((@@bContinue == true) and ($bDataSetRead != true))\r\n #$bDataSetRead = read_dataset()\r\n @@bContinue = $bDataSetRead\r\n end\r\n\r\n # Open a browser and access the site if it hasen't already been recorded\r\n #if((@@bContinue == true) and ($bWebSiteAccessed != true))\r\n\r\n $browser = start_browser($sDefaultBrowser)\r\n #$browser.goto(\"www.ask.com\")\r\n\r\n #$bWebSiteAccessed = access_dishonline()\r\n @@bContinue = $bWebSiteAccessed\r\n #end\r\n\r\n\r\n\r\n end", "def test_entry\n raise \"Implement this method in your test class\"\n end", "def test_acknowledgement\n\n end", "def test_acknowledgement\n\n end", "def test_acknowledgement\n\n end", "def test_acknowledgement\n\n end", "def setup\r\n puts 'starting a new test: ' + self.name\r\n cfT1 = CustomField.new(\"testField\", \"kuku\")\r\n cfT2 = CustomField.new(\"tester\", \"new_tester\")\r\n @reportiumClient.testStart(self.name, TestContext.new(TestContext::TestContextBuilder\r\n\t .withCustomFields(cfT1, cfT2)\r\n .withTestExecutionTags('TagYW1', 'TagYW2', 'unittest')\r\n .build()))\r\n end", "def default_test\n end", "def run(test, &block)\n target = self.target\n\n raise_pending(test.procedure) unless test.procedure\n\n begin\n target_class.class_eval do\n alias_method \"_lemon_#{target}\", target\n define_method(target) do |*a,&b|\n test.tested = true\n __send__(\"_lemon_#{target}\",*a,&b)\n end\n end\n rescue => error\n Kernel.eval <<-END, test.to_proc.binding\n raise #{error.class}, \"#{target} not tested\"\n END\n end\n\n begin\n super(test, &block)\n #block.call\n\n ensure\n target_class.class_eval %{\n alias_method \"#{target}\", \"_lemon_#{target}\"\n }\n end\n\n raise_pending(test.procedure) unless test.tested\n end", "def example_passed(_)\n end", "def test04_EventOneComment_TC_24319\n\t\tcommentEventPop\n\t\tcommentPopSubmit\n\tend", "def test_0\n\n #log_level_to_debug\n\n li = OpenWFE::LaunchItem.new\n li.wfdurl = 'file:test/_testdef.rb'\n\n dotest(li, %w(a b c).join(\"\\n\"))\n end", "def run\n begin\n self.class.roby_should_run(self, Roby.app)\n super\n rescue MiniTest::Skip => e\n puke self.class, self.name, e\n end\n end", "def test_related_event\n flunk \"Todo\"\n end", "def default_test\n end", "def test_update_workitem_alt\n\n @dashboard.register_participant 'alpha', Ruote::StorageParticipant\n\n wfid = @dashboard.launch(Ruote.process_definition { alpha })\n\n wait_for(:alpha)\n\n #wi = @dashboard.process(wfid).workitems.first\n # doesn't work: the returned workitem isn't a workite document, it's\n # just a fragment of info\n\n wi = @dashboard.process(wfid).stored_workitems.first\n # works OK\n\n #wi = alpha.first\n # works OK, but you have to grab alpha first...\n\n alpha = @dashboard.participant(wi.participant_name)\n\n wi.set_field('my_field', 'abc123')\n\n alpha.update(wi)\n\n assert_equal nil, @dashboard.process(wfid).workitems.first.fields['my_field']\n assert_equal 'abc123', alpha.first.fields['my_field']\n end", "def method_missing(sym, *args, &block)\n m = sym.to_s\n if m =~ /^check$/ or m =~ /^check_.+$/\n new_method = m.gsub(/^check/, 'assert')\n begin\n self.send(new_method.to_sym, *args, &block)\n rescue AssertionFailedError => e\n add_failure(e.message, e.backtrace)\n false\n end\n else\n if sym == :setup\n return\n end\n if m !~ /(.*)__([A-Z_]+)$/\n super(sym, *args, &block)\n end\n test_name = self.class.modified_test_methods[m][0]\n param_key = self.class.modified_test_methods[m][1]\n test_params = self.class.testparameters[param_key]\n if test_params.nil?\n raise \"Could not find parameters for test '#{test_name}'\"\n end\n\n param_setup test_params\n send test_name\n end\n end", "def graffiti_test\n end", "def test_order; end", "def test2 &action\n puts \"Testing:\\n\\n\"\n action.call\n end", "def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end", "def test_Method_InstanceMethods_to_proc\n\t\tpass\n\tend", "def scope_test\n end", "def run(test, &block)\n #hooks[:before].each do |match, block|\n # next if Symbol == match\n # if test.match?(match)\n # scope.instance_exec(test, &block) #block.call(unit)\n # end\n #end\n\n block.call\n\n #hooks[:after].each do |match, block|\n # next if Symbol == match\n # if test.match?(match)\n # scope.instance_exec(test, &block) #block.call(unit)\n # end\n #end\n end", "def default_test\n info \"self: #{self}\"\n end", "def test_write\n write_message(:todo, \"Hey, it worked\")\n end", "def test2Actions\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ],\n [ 'DummyTool', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ],\n 'DummyAction2' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def test_http_listener\n\n fei = RuoteRest.engine.launch %{\n class TestHttpListener < OpenWFE::ProcessDefinition\n sequence do\n alpha\n bravo\n end\n end\n }\n\n sleep 0.450\n\n get \"/workitems/#{fei.wfid}/0_0_0\"\n\n workitem = OpenWFE::Xml.workitem_from_xml(@response.body)\n\n post(\n '/workitems',\n workitem.to_h().to_json,\n { 'CONTENT_TYPE' => 'application/json' })\n\n sleep 0.450\n\n get \"/workitems/#{fei.wfid}/0_0_1\"\n\n workitem = OpenWFE::Xml.workitem_from_xml(@response.body)\n\n assert_equal 'bravo', workitem.participant_name\n end", "def test_second_take\n\n @dashboard.register_participant :troublemaker, TroubleMaker\n\n pdef = Ruote.define do\n define 'sub0' do\n set '__on_error__' => 'redo'\n end\n sequence :on_error => 'sub0' do\n troublemaker\n end\n end\n\n wfid = @dashboard.launch(pdef)\n r = @dashboard.wait_for(wfid)\n\n assert_equal 'terminated', r['action']\n assert_equal 3, r['workitem']['fields']['_trace'].size\n end", "def test02_ArticleOneComment_TC_24319\n\t\tcommentArticlePop\n\t\tcommentPopSubmit\n\tend", "def testNominal\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGem ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end", "def test1ActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [WEACE::Master::TransferFile.new(iTmpFileName)] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n }\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal([], getSlaveClientQueue)\n assert_equal({iTmpFileName => 1}, getTransferFiles)\n end\n end\n end\n end", "def start_test(test_status)\n # Abstract\n end", "def test_cyclic\n end", "def love_test\nend", "def test\n @test_facade = test_facade\n end", "def action_run\n notifying_block do\n # Top level directory for this test.\n directory new_resource.path do\n mode '777'\n end\n\n # Install and log the version.\n python_runtime new_resource.name do\n provider new_resource.runtime_provider if new_resource.runtime_provider\n version new_resource.version\n end\n test_version\n\n # Test python_package.\n python_package 'argparse' do\n # Needed for sqlparse but not in the stdlib until 2.7.\n python new_resource.name\n end\n python_package 'sqlparse remove before' do\n action :remove\n package_name 'sqlparse'\n python new_resource.name\n end\n test_import('sqlparse', 'sqlparse_before')\n python_package 'sqlparse' do\n python new_resource.name\n notifies :create, sentinel_file('sqlparse'), :immediately\n end\n test_import('sqlparse', 'sqlparse_mid')\n python_package 'sqlparse again' do\n package_name 'sqlparse'\n python new_resource.name\n notifies :create, sentinel_file('sqlparse2'), :immediately\n end\n python_package 'sqlparse remove after' do\n action :remove\n package_name 'sqlparse'\n python new_resource.name\n end\n test_import('sqlparse', 'sqlparse_after')\n\n # Use setuptools to test something that should always be installed.\n python_package 'setuptools' do\n python new_resource.name\n notifies :create, sentinel_file('setuptools'), :immediately\n end\n\n # Multi-package install.\n python_package ['pep8', 'pytz'] do\n python new_resource.name\n end\n test_import('pep8')\n test_import('pytz')\n\n # Create a virtualenv.\n python_virtualenv ::File.join(new_resource.path, 'venv') do\n python new_resource.name\n end\n\n # Install a package inside a virtualenv.\n python_package 'Pytest' do\n virtualenv ::File.join(new_resource.path, 'venv')\n end\n test_import('pytest')\n test_import('pytest', 'pytest_venv', python: nil, virtualenv: ::File.join(new_resource.path, 'venv'))\n\n # Create and install a requirements file.\n # Running this in a venv because of pip 8.0 and Ubuntu packaing\n # both requests and six.\n python_virtualenv ::File.join(new_resource.path, 'venv2') do\n python new_resource.name\n end\n file ::File.join(new_resource.path, 'requirements.txt') do\n content <<-EOH\nrequests==2.7.0\nsix==1.8.0\nEOH\n end\n pip_requirements ::File.join(new_resource.path, 'requirements.txt') do\n virtualenv ::File.join(new_resource.path, 'venv2')\n end\n test_import('requests', python: nil, virtualenv: ::File.join(new_resource.path, 'venv2'))\n test_import('six', python: nil, virtualenv: ::File.join(new_resource.path, 'venv2'))\n\n # Install a non-latest version of a package.\n python_virtualenv ::File.join(new_resource.path, 'venv3') do\n python new_resource.name\n end\n python_package 'requests' do\n version '2.8.0'\n virtualenv ::File.join(new_resource.path, 'venv3')\n end\n test_import('requests', 'requests_version', python: nil, virtualenv: ::File.join(new_resource.path, 'venv3'))\n\n # Don't run the user tests on Windows.\n unless node.platform_family?('windows')\n # Create a non-root user and test installing with it.\n test_user = \"py#{new_resource.name}\"\n test_home = ::File.join('', 'home', test_user)\n group 'g'+test_user do\n system true\n end\n user test_user do\n comment \"Test user for python_runtime_test #{new_resource.name}\"\n gid 'g'+test_user\n home test_home\n shell '/bin/false'\n system true\n end\n directory test_home do\n mode '700'\n group 'g'+test_user\n user test_user\n end\n test_venv = python_virtualenv ::File.join(test_home, 'env') do\n python new_resource.name\n user test_user\n end\n python_package 'docopt' do\n user test_user\n virtualenv test_venv\n end\n test_import('docopt', python: nil, virtualenv: test_venv, user: test_user)\n end\n\n end\n end" ]
[ "0.6321941", "0.6216913", "0.60990405", "0.6000415", "0.59984595", "0.59984595", "0.5987207", "0.59119505", "0.5909353", "0.59074557", "0.59007967", "0.5885891", "0.5876107", "0.5870387", "0.5870387", "0.5870387", "0.5852583", "0.5852583", "0.58299494", "0.5825924", "0.5825924", "0.58095646", "0.5777599", "0.56945014", "0.5674298", "0.566555", "0.5647427", "0.56467134", "0.5633369", "0.5633369", "0.5633369", "0.56297594", "0.56214666", "0.5584554", "0.5576225", "0.5564913", "0.5564358", "0.5550627", "0.5548399", "0.5548399", "0.5544172", "0.55422413", "0.5541587", "0.55303895", "0.552763", "0.55251986", "0.5522557", "0.54985666", "0.54985666", "0.5494686", "0.5494686", "0.54751676", "0.5458892", "0.5458154", "0.54396236", "0.54392004", "0.54356176", "0.5433793", "0.5428983", "0.5428983", "0.54175836", "0.5412231", "0.53904784", "0.5384255", "0.5380647", "0.53738666", "0.53738666", "0.53738666", "0.53738666", "0.53606874", "0.53522253", "0.5340509", "0.5336244", "0.53172094", "0.5298056", "0.52789485", "0.52726686", "0.52606833", "0.52544916", "0.5241785", "0.52393365", "0.52235144", "0.52200246", "0.52171004", "0.52156776", "0.5210444", "0.51925117", "0.51782733", "0.5176877", "0.5168388", "0.51630723", "0.51622516", "0.515447", "0.5142112", "0.51379174", "0.51370525", "0.5133747", "0.51334995", "0.5125642", "0.5124511" ]
0.5680749
24
Test shortcut, alleviates the need to set fei and flavour before calling cancel / on_consume.
def _on_cancel(fei, flavour) Ruote.participant_send( self, [ :on_cancel, :cancel ], 'fei' => fei, 'flavour' => flavour) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testShortcut\n execute_Deliver_WithConf({\n :WaveFiles => { :FilesList => [ { :Name => 'Wave1.wav' } ] },\n :Mix => { 'Mix1' => { :Tracks => { 'Wave1.wav' => {} } } },\n :Deliver => {\n :Formats => {\n 'Test' => {\n :FileFormat => 'Wave'\n }\n },\n :Deliverables => {\n 'Deliverable' => {\n :Mix => 'Mix1',\n :Format => 'Test'\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Mixed_Wave1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert_wave_lnk '01_Source/Wave/Wave1', '06_Deliver/Deliverable/Track.wav'\n end\n end", "def test_illegal_shortcuts\n N::URI.shortcut(:illegal_short, \"http://illegal.shortcut.com/\")\n assert_raises(NameError) { N::URI.shortcut(:illegal_short, \"xxx\") }\n assert_raises(NameError) { N::URI.shortcut(:legal_short, \"http://illegal.shortcut.com/\")}\n end", "def test_check_shortcut\n N::Namespace.shortcut(:xyshortcut, \"http://xyz/\")\n assert_equal(:xyshortcut, N::URI.new(\"http://xyz/\").my_shortcut)\n end", "def test_inexistent_shortcut\n assert_equal(nil, N::URI.new(\"http://noshortcut/\").my_shortcut)\n end", "def test_shortcuts\n N::URI.shortcut(:at_least_one, \"http://atleast.com\")\n N::URI.shortcut(:at_least_two, \"http://atleasttwo.com\")\n assert(N::URI.shortcuts.size > 1, \"There should be at least two shortcuts\")\n assert(N::URI.shortcuts.keys.include?(:at_least_one))\n assert(N::URI.shortcuts.keys.include?(:at_least_two))\n end", "def test_it_can_distinguish_i_through_main_menu\n runner = Runner.new\n $stdout = StringIO.new\n input = \"i\"\n result = runner.main_menu_options(input)\n\n assert_equal false, runner.play?(result)\n end", "def pbPlayCancelSE()\n if $data_system && $data_system.respond_to?(\"cancel_se\") &&\n $data_system.cancel_se && $data_system.cancel_se.name!=\"\"\n pbSEPlay($data_system.cancel_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[2] && $data_system.sounds[2].name!=\"\"\n pbSEPlay($data_system.sounds[2])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel cancel\")\n pbSEPlay(\"GUI sel cancel\",80)\n end\nend", "def applicationDidFinishLaunching(notification)\n @hotkeys = HotKeys.new\n\n # Seriously for a second; For some reason a global hotkey or at least \n # the way I've got it to working blocks the keystroke. Which I guess is normal?\n #\n # Maybe I'll hack around that with system events for a bypass option, it wouldn't \n # be elegate, but this is new territory anywho\n #\n @hotkeys.addHotString(\"S+OPTION\") do\n puts \"PRESSED: S+OPTION\"\n end\n\n # Will only trigger if Safari is frontmost application, second option can be left blank\n # for a global shortcut\n @hotkeys.addHotString(\"S+OPTION\", :bundle_identifier => \"com.apple.Safari\") do\n puts \"PRESSED: S+OPTION IN SAFARI TOO\"\n end\n\nend", "def process_ok\n if current_item_enabled?\n Sound.play_ok \n Input.update\n deactivate unless @symbol.nil?\n call_ok_handler\n else\n Sound.play_buzzer\n end\n end", "def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend", "def random_category_action\n category = (QuickSearch::Engine::APP_CONFIG['searchers'] + ['spelling-suggestion', 'result-types', 'doi-trap', 'more-options']).sample.dasherize\n # Default action is a click\n action = 'click'\n\n # Typically, serves only happen for these categories\n if category == 'best-bets' || category == 'spelling-suggestion'\n action = ['click', 'serve'].sample\n end\n\n return category, action\nend", "def audios_test\n end", "def process_ok\n if current_item_enabled?\n Input.update\n deactivate\n call_ok_handler\n else\n Sound.play_buzzer\n end\n end", "def kgio_accept()\n #This is a stub, used for indexing\n end", "def testchoose\n # list filters as you type\n $log.debug \"called CHOOSE \" if $log.debug?\n filter = \"*\"\n filter = ENV['PWD']+\"/*\"\n str = choose filter, :title => \"Files\", :prompt => \"Choose a file: \"\n message \"We got #{str} \"\nend", "def exit_shortcut_not_found(name)\n puts \"Shortcut \\033[1m#{name}\\033[0m not found :(\"\n if Fast.shortcuts.any?\n puts \"Available shortcuts are: #{Fast.shortcuts.keys.join(', ')}.\"\n Fast.load_fast_files!\n end\n exit 1\n end", "def test04_L1DLT04_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Tweet\" button\n\tend", "def test_suggest_word_with_one_word_inserted_and_three_letter_string\n @completion.insert(\"pizza\")\n assert_equal [\"pizza\"], @completion.suggest(\"pi\")\n end", "def cancel?\n name.downcase == 'touchcancel'\n end", "def run_suggest\n puts suggest_pattern if suggest_pattern\n end", "def pbPlayCursorSE()\n if $data_system && $data_system.respond_to?(\"cursor_se\") &&\n $data_system.cursor_se && $data_system.cursor_se.name!=\"\"\n pbSEPlay($data_system.cursor_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[0] && $data_system.sounds[0].name!=\"\"\n pbSEPlay($data_system.sounds[0])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel cursor\")\n pbSEPlay(\"GUI sel cursor\",80)\n end\nend", "def test\n @commands_and_opts.push OPTIONAL_OPTS[:test]\n self\n end", "def switch_to_functional\n return unless ( \n name = path_matcher.controller_name || path_matcher.view_name\n )\n \n test_file = \"/test/functional/#{name}_test.rb\"\n if !file_exists? test_file\n test_file = \"/test/functional/#{name}_controller_test.rb\"\n end\n \n if path_matcher.is_view?\n action = File.basename(file_path).split(\".\").first\n regexp = Regexp.new(action)\n \n candidates = get_tests(test_file).select { |t| t =~ regexp } \n \n if candidates.length > 0\n log \"Jumping to #{test_file}##{candidates.first}\"\n return goto_definition test_file, candidates.first\n end\n \n elsif ( function = find_function_under_cursor )\n # select a candidate to jump tp\n regexp = Regexp.new(function)\n candidates = get_tests(test_file).select { |t| t =~ regexp } \n \n if candidates.length > 0\n log \"Jumping to #{test_file}##{candidates.first}\"\n return goto_definition test_file, candidates.first\n end \n end\n \n open_file test_file\n end", "def command_126(*args, &block)\n $game_temp.affix_gain_item_event_flag = true\n marw_command126_8qu7(*args, &block) # Call Original Method\n $game_temp.affix_gain_item_event_flag = false\n end", "def test_fan\n @rc.on_button_was_pushed(1)\n @rc.off_button_was_pushed(1)\n p @rc\n @rc.undo_button_was_pushed\n @rc.on_button_was_pushed(2)\n p @rc\n @rc.undo_button_was_pushed\n assert_equal \\\n \"Living Room ceiling fan is on medium\\n\" \\\n \"Living Room ceiling fan is off\\n\" \\\n \"\\n------ Remote Control -------\\n\" \\\n \"[slot 0] LightOnCommand LightOffCommand\\n\" \\\n \"[slot 1] CeilingFanMediumCommand CeilingFanOffCommand\\n\"\\\n \"[slot 2] CeilingFanHighCommand CeilingFanOffCommand\\n\" \\\n \"[slot 3] NoCommand NoCommand\\n\" \\\n \"[slot 4] NoCommand NoCommand\\n\" \\\n \"[slot 5] NoCommand NoCommand\\n\" \\\n \"[slot 6] NoCommand NoCommand\\n\" \\\n \"[undo] CeilingFanOffCommand\\n\\n\" \\\n \"Living Room ceiling fan is on medium\\n\" \\\n \"Living Room ceiling fan is on high\\n\" \\\n \"\\n------ Remote Control -------\\n\" \\\n \"[slot 0] LightOnCommand LightOffCommand\\n\" \\\n \"[slot 1] CeilingFanMediumCommand CeilingFanOffCommand\\n\"\\\n \"[slot 2] CeilingFanHighCommand CeilingFanOffCommand\\n\" \\\n \"[slot 3] NoCommand NoCommand\\n\" \\\n \"[slot 4] NoCommand NoCommand\\n\" \\\n \"[slot 5] NoCommand NoCommand\\n\" \\\n \"[slot 6] NoCommand NoCommand\\n\" \\\n \"[undo] CeilingFanHighCommand\\n\\n\" \\\n \"Living Room ceiling fan is on medium\\n\", @out.string\n end", "def filter_files_by_pattern\n @title = 'Search Results: (Press Esc to cancel)'\n @mode = 'SEARCH'\n if @toggles[:instant_search]\n search_as_you_type\n else\n @patt = readline '/'\n end\nend", "def eat(w)\n w.refresh\n text = w.read_text\n return false if text.include?('This is too far')\n\n # Don't know what a kitchen looks like yet. \n if w.click_on 'Consume'\n sleep 5\n w.refresh\n return true\n else\n return false\n end\n end", "def on_gold_cancel\n Sound.play_cancel\n if @storage_category == false && @storage_gold == true\n @command_window.activate\n else\n start_category_selection\n end\n @gold_window.hide\n end", "def command_128(*args, &block)\n $game_temp.affix_gain_item_event_flag = true\n marw_command128_8qu7(*args, &block) # Call Original Method\n $game_temp.affix_gain_item_event_flag = false\n end", "def change_shortcut(slot_id, actor, recipe)\n if actor.nil? || recipe.nil?\n @cooking_shortcuts[slot_id].clear \n else\n @cooking_shortcuts[slot_id].shortcut(actor, recipe)\n end\n end", "def kgio_accept(*several_variants)\n #This is a stub, used for indexing\n end", "def process_ok\n if enabled?\n Sound.play_ok\n Input.update\n deactivate\n call_ok_handler\n else\n Sound.play_buzzer\n end\n end", "def on_help(menu)\n end", "def set_favorite\n end", "def handle_action?(handler, event)\n event[:action] != :flapping ||\n (event[:action] == :flapping && !!handler[:handle_flapping])\n end", "def open(keywords, files, original_files, test = false)\n nons, keywords = sort_keywords(keywords)\n print \"keywords: #{keywords} \".cyan\n puts \"nons: #{nons}\".red\n\n if keywords.size > 0\n regex = Regexp.new(\"#{keywords.join('.*')}.*\")\n puts \"[regex: #{regex}] test: #{test} size: #{files.size} nons.size: #{nons.size}\".yellow\n files = files.select { |file| /_test\\.rb/ =~ file } if test\n files = files.select { |file| regex =~ file }\n files = Dir[\"./**/*\"].select { |file| regex =~ file } if files.size == 0\n end \n if nons.size > 0\n puts \"\\n0 result\\n\".red\n return\n end \n\n if files.size > 30\n files[0..5].each_with_index { |file, i|\n puts \"#{i} #{paint(keywords, file)}\"\n }\n puts \"...\"\n puts \"...\"\n else\n files.each_with_index { |file, i|\n puts \"#{i} #{paint(keywords, file)}\"\n }\n end\n\n puts \"\\n[test mode: #{test ? 'on'.green : 'off'.red}]\"\n puts \"[q: quit t: test c: cmd ]\"\n puts \"[a: all -: diff g: grep ]\"\n puts \"[@: test all A: entire dir D: git diff range]\"\n puts \"[o: open index zero ]\"\n puts \"[,{@}: open the index with comma size ]\"\n puts \"[lc: load caches][cc: clean caches]\"\n puts \"[oo: open all] [ss: shorter first]\"\n puts \"[:m: macdown]\"\n puts \"[tt: auto test all][--: ancestor][--e: ancestor editor mode]\"\n print \"> \"\n\n input = get_input\n if input == \":m\"\n files.select{|f| f.end_with?(\".md\")}.each_with_index do |f, i|\n puts \"[#{i}] #{f}\"\n end \n print \"> \"\n input = $stdin.gets.chomp.to_i\n if files.size > input\n system \"macdown #{files[input]}\"\n else\n puts \"\\nindex out of range\\n\"\n end\n elsif input == \"--\"\n see_ancestor(files, false)\n elsif input == \"--e\"\n see_ancestor(files, true)\n elsif input == \"ss\"\n files = files.sort_by(&:length)\n elsif input == \"lc\"\n cache = read_cache\n return open([], cache, cache, test) \n elsif input == \"cc\"\n clean_cache\n elsif input == \"tt\"\n files.select{ |file| !file.include?(\"_test\") }.map {|file|\n file.gsub(\"app/\", \"test/\").gsub(\".rb\", \"_test.rb\")\n }.select{ |file|\n File.exist?(file)\n }.each { |test|\n system \"ruby -I test #{test}\"\n }\n elsif input == \"oo\"\n vim \"#{files.select{|f| File.exist?(f)}.join(' ')}\"\n elsif /^[,]+$/ =~ input\n vim_or_test(input.size-1, test, files)\n elsif /^\\s*$/ =~ input\n keywords = []\n elsif /^D\\s*/ =~ input\n files = `git diff develop --name-only`\n keywords = input.gsub(\"D \", \"\").split(\" \")\n original_files = files\n elsif /^A\\s*/ =~ input\n files = Dir[\"./**/*\"]\n keywords = input.gsub(\"A\", \"\").strip.split(\" \")\n original_files = files\n elsif /^o\\s*$/ =~ input\n vim_or_test(0, test, files)\n elsif /^g\\s/ =~ input\n regex = Regexp.new(input[1..-1].strip.gsub(\" \", \".+\"))\n puts \"regex: #{regex.to_s.green}\"\n files = Dir[\"./**/*\"] if files.size == 0\n files = files\n .select { |file| File.file?(file) }\n .select { |file| match?(regex, file) }\n files = Dir[\"./**/*\"] if files.size == 0\n files = files\n .select { |file| File.file?(file) }\n .select { |file| match?(regex, file) }\n puts \"non found \".red if files.size == 0\n files = files\n files.each { |file|\n puts \"[#{file}]\".blue\n File.open(file, \"r\").each { |line| puts line[1..100].yellow if regex =~ line }\n }\n keywords = input[1..-1].strip.split(\" \")\n return open(keywords, files, original_files, test) \n elsif /^c\\s*$/ =~ input\n system input.gsub(/^c\\s/, \"\")\n elsif /^-\\s*$/ =~ input\n system \"git diff develop #{files.join(' ')}\" \n elsif /^a\\s*$/ =~ input\n return open(input[1..-1].split(\" \"), original_files, original_files, test) \n elsif /^t\\s*$/ =~ input\n return open(\n input.split(\" \"),\n files,\n original_files,\n !test\n )\n elsif /^@/ =~ input\n files.each do |file|\n system \"ruby -I test #{file}\" if /_test\\.rb$/ =~ file\n end\n keywords = []\n elsif /^\\d+$/ =~ input\n vim_or_test(input.to_i, test, files)\n else \n keywords = input.strip != \"\" ? input.split(\" \") : keywords\n end \n open(keywords, files, original_files, test) \n end", "def pbPlayBuzzerSE()\n if $data_system && $data_system.respond_to?(\"buzzer_se\") &&\n $data_system.buzzer_se && $data_system.buzzer_se.name!=\"\"\n pbSEPlay($data_system.buzzer_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[3] && $data_system.sounds[3].name!=\"\"\n pbSEPlay($data_system.sounds[3])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel buzzer\")\n pbSEPlay(\"GUI sel buzzer\",80)\n end\nend", "def reusable_hot? options\n case reusable\n when \"for_all\"\n true\n when \"for_other\"\n !is_hit? options\n when \"no\"\n spelling_hot? options\n end\n end", "def file_actions action=nil\n h = { :d => :delete, :m => :move, :r => :rename, :v => ENV[\"EDITOR\"] || :vim,\n :c => :copy, :C => :chdir,\n :l => :less, :s => :most , :f => :file , :o => :open, :x => :dtrx, :z => :zip }\n #acttext = h[action.to_sym] || action\n acttext = action || \"\"\n file = nil\n\n sct = $selected_files.size\n if sct > 0\n text = \"#{sct} files\"\n file = $selected_files\n else\n #print \"[#{acttext}] Choose a file [#{$view[$cursor]}]: \"\n t = \"[#{acttext}] Choose a file [#{$view[$cursor]}]: \"\n file = ask_hint t, $view[$cursor]\n return unless file\n text = file\n end\n\n case file\n when Array\n # escape the contents and create a string\n files = Shellwords.join(file)\n when String\n files = Shellwords.escape(file)\n end\n\n\n ch = nil\n if action\n menu_text = action\n else\n ch, menu_text = menu \"File Menu for #{text}\", h\n menu_text = :quit if ch == \"q\"\n end\n return unless menu_text\n case menu_text.to_sym\n when :quit\n when :delete\n ch = get_single \"rmtrash #{files} ?[yn]: \"\n #print \"rmtrash #{files} ?[yn]: \"\n #ch = get_char\n return if ch != \"y\"\n c_system \"rmtrash #{files}\"\n c_refresh\n when :move\n #print \"move #{text} to : \"\n #target = gets().chomp\n #target = Readline::readline('>', true)\n target = get_line \"move #{text} to : \"\n text=File.expand_path(text)\n return if target.nil? || target == \"\"\n if File.directory? target\n FileUtils.mv text, target\n c_refresh\n else\n perror \"Target not a dir\"\n end\n when :copy\n target = get_line \"copy #{text} to : \"\n #target = Readline::readline('>', true)\n return if target.nil? || target == \"\"\n text=File.expand_path(text)\n target = File.basename(text) if target == \".\"\n if File.exists? target\n perror \"Target (#{target}) exists\"\n else\n FileUtils.cp text, target\n c_refresh\n end\n when :chdir\n change_dir File.dirname(text)\n when :zip\n target = get_line \"Archive name: \"\n #target = gets().chomp\n #target = Readline::readline('>', true)\n return if target.nil? || target == \"\"\n # don't want a blank space or something screwing up\n if target && target.size > 3\n if File.exists? target\n perror \"Target (#{target}) exists\"\n else\n c_system \"tar zcvf #{target} #{files}\"\n c_refresh\n end\n end\n when :rename\n when :most, :less, :vim, ENV['EDITOR']\n c_system \"#{menu_text} #{files}\"\n else\n return unless menu_text\n $log.debug \"XXX: menu_text #{menu_text.to_sym}\"\n get_single \"#{menu_text} #{files}\"\n #pause\n #print\n c_system \"#{menu_text} #{files}\"\n pause\n c_refresh\n end\n # remove non-existent files from select list due to move or delete or rename or whatever\n if sct > 0\n $selected_files.reject! {|x| x = File.expand_path(x); !File.exists?(x) }\n end\nend", "def get_action(str)\n puts \"Received '#{str.strip}'\" unless @quiet\n ['f','c','r'].choice\n end", "def process_ok\n Sound.play_ok\n super\n end", "def testAdaptationDefinition\n @quietContext = Context.named(\"quiet\")\n # \"This adaptation definition is known to work from testAdaptationDefinition.\"\n @quietContext.adaptClass(Phone, \"advertise\", Phone.advertiseQuietly)\n \n # \"The following tests plain behaviour adaptation to context.\n # The adaptation completely overrides the original behaviour.\"\n phone = Phone.new\n call = PhoneCall.new \n call.from = \"Bob\"\n phone.receive(call) \n assert(phone.class.advertise == \"ringtone\", \"A phone should play a ringtone by default\")\n \n @quietContext.activate\n assert(phone.class.advertise == \"vibrator\", \"The vibration behavior for quiet environments should be expressed\")#to fix\n \n @quietContext.deactivate\n assert(phone.class.advertise == \"ringtone\", \"The default behaviour should be restored once the quiet context is deactivated\")#to fix\n \n end", "def rl_possible_completions(ignore, invoking_key)\r\n rl_complete_internal('?')\r\n end", "def process_handling\n super\n #return unless cursor_movable?\n #return process_confirm if handle?(:confirm) && Input.trigger?(:X)\n end", "def faint; end", "def faint; end", "def do_special_input_stuff(input)\n case input\n when \"save\"\n save\n []\n when \"reset\"\n puts \"Choose different piece:\"\n \"reset\"\n when \"quit\"\n puts \"QUITTING\"\n exit\n else\n false\n end\n end", "def someone_did_gain_usermode(stem, nick, mode, argument, bestower)\n end", "def command_127(*args, &block)\n $game_temp.affix_gain_item_event_flag = true\n marw_command127_8qu7(*args, &block) # Call Original Method\n $game_temp.affix_gain_item_event_flag = false\n end", "def play_options(prompt)\r\n choices = [\r\n {name: \"Hit\", value: 1},\r\n {name: \"Stand\", value: 2},\r\n {name: \"Exit\", value: 3}\r\n ]\r\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keyboard Arrow Keys)\", show_help: :start, filter: true)\r\nend", "def gentest; catdet.button(:name, 'testEvent'); end", "def cancel_attack\n @windows[Win_Status].clear_dmg_preview\n @cursor.active = true \n end", "def play_options(prompt)\n choices = [\n {name: \"Hit\", value: 1},\n {name: \"Stand\", value: 2},\n {name: \"Exit\", value: 3}\n ]\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keybvoard keys)\", show_help: :start, filter: true)\nend", "def test_magic_ball_silent_shake\n magic_ball = Predictor.new\n assert_silent { magic_ball.shake() }\n end", "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 command_file prompt, *command\n pauseyn = command.shift\n command = command.join \" \"\n #print \"[#{prompt}] Choose a file [#{$view[$cursor]}]: \"\n t = \"[#{prompt}] Choose a file [#{$view[$cursor]}]: \"\n file = ask_hint t, $view[$cursor]\n #print \"#{prompt} :: Enter file shortcut: \"\n #file = ask_hint\n perror \"Command Cancelled\" unless file\n return unless file\n file = File.expand_path(file)\n if File.exists? file\n file = Shellwords.escape(file)\n pbold \"#{command} #{file} (press a key)\"\n c_system \"#{command} #{file}\"\n pause if pauseyn == \"y\"\n c_refresh\n else\n perror \"File #{file} not found\"\n end\nend", "def process_cancel\n Sound.play_cancel\n Input.update\n deactivate if @symbol.nil?\n @symbol = nil\n call_cancel_handler\n end", "def process_x\n if current_item_enabled?\n Sound.play_ok\n super\n else\n Sound.play_buzzer\n end\n end", "def cancel_enabled?; handle?(:cancel); end", "def beep(type = 'ok')\n process_command :beep, type\n end", "def select_hint view, ch\n # a to y is direct\n # if z or Z take a key IF there are those many\n #\n ix = get_index(ch, view.size)\n if ix\n f = view[ix]\n return unless f\n $cursor = $sta + ix\n\n if $mode == 'SEL'\n toggle_select f\n elsif $mode == 'COM'\n run_command f\n else\n open_file f\n end\n #selectedix=ix\n end\nend", "def sound; end", "def default_test; end", "def setup_cutin\n return unless PONY::ERRNO::check_sequence(current_act)\n #reserved\n end", "def play what\n case Avalon::Config[:alert_sounds]\n when false, :none, :no\n when Hash\n tunes = [Avalon::Config[:alert_sounds][what] || what].compact.flatten\n\n tunes.each do |tune|\n file = find_file( tune, \"../../../sound/#{tune}\",\n \"~/.avalon/sound/#{tune}\", \"/System/Library/Sounds/#{tune}\")\n case system\n when 'Darwin'\n `afplay #{file}`\n when 'Linux'\n raise 'Please install sox package: sudo apt-get install sox' if `which sox`.empty?\n `play -q #{file}`\n end\n end\n end\n end", "def no_tutorial\n click_link \"ok, got it\"\n end", "def on_target_cancel\n @target_window.hide\n case @actor_command_window.current_symbol\n when :attack\n @actor_command_window.activate\n when :skill\n @skill_window.activate\n when :item\n @item_window.activate\n end\n end", "def run(songs) # I thought we were supposed to call this bit 'runner'?\n puts \"Welcome to my Jukebox!\\n\\n Please enter a command:\\n\\n Help, List, Play, or Exit\\n\\n\"\n help\n command = gets.strip.to_s\n case command # I originally used if-else\n when \"help\"\n help\n when \"list\"\n list(songs)\n when \"play\"\n play(songs) # runs play songs method\n when \"exit\" # or use unless\n exit_jukebox\n # else\n # puts \"Erroneous Command\"\n # exit_jukebox\n end\nend", "def cancel!; end", "def act q = nil\n\n if !q.nil? && q != \"\" then\n topic = q\n else\n puts \"What would you like to work on?\"\n puts \"(summaries, arcs, or scenes)\"\n topic = STDIN.gets.chomp\n end\n\n case topic\n when \"arcs\"\n listen_arcs\n when \"scenes\"\n listen_scenes\n else\n puts \"#{topic} is not a valid option\"\n return nil\n end\n\n end", "def suggest_movie\n\t\t# Take 5 random movies\n\t\tmovies = self.get_source_content.shuffle[0..4]\n\n\t\t# Create a readable list of movie names\n\t\tdisplay_list = movies.collect { |filepath|\n\t\t\tFile.basename(filepath).gsub(File.extname(filepath), '')\n\t\t}\n\n\t\t# Ask the user to veto a movie\n\t\tallowed_answers = (1..display_list.size).to_a\n\t\tusers = ['Tim', 'Maud'].shuffle\n\t\tuser = rand(1)\n\t\tmovie_id = nil\n\t\twhile movie_id.nil? do\n\t\t\tsystem 'clear'\n\t\t\tputs \n\n\t\t\t# Display list\n\t\t\tdisplay_list.each_with_index do |movie, i|\n\t\t\t\tputs \"#{i+1}: #{movie}\"\n\t\t\tend\n\t\t\tputs\n\n\t\t\t# If only one movie left, we select it\n\t\t\tif allowed_answers.size == 1\n\t\t\t\tmovie_id = allowed_answers[0] \n\t\t\t\tdisplay_name = display_list[movie_id-1]\n\t\t\t\tfilepath = movies[movie_id-1]\n\t\t\t\tputs \"On regarde donc #{display_name}, qui se trouve dans\"\n\t\t\t\tputs filepath\n\n\t\t\t\t# We remove it from the list\n\t\t\t\tself.remove_movie_from_list filepath\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\t# Ask user for a veto\n\t\t\tputs \"#{users[user]}, à toi de mettre un véto\"\n\t\t\tanswer = gets.chomp.to_i\n\n\t\t\t# Incorrect answer\n\t\t\tif !allowed_answers.include? answer\n\t\t\t\tputs \"#{answer} n'est pas une réponse valide.\"\n\t\t\t\tputs \"Les seuls réponses valides sont : #{allowed_answers.join(', ')}\"\n\t\t\t\tputs \"Appuyez sur Entrée pour recommencer\"\n\t\t\t\tgets\n\t\t\telse\n\t\t\t\t# We remove this answer from the list\n\t\t\t\tallowed_answers.delete(answer)\n\t\t\t\tdisplay_list[answer-1].gsub!(/./, '#')\n\t\t\t\t# Switch to next user\n\t\t\t\tuser = (user+1)%2\n\t\t\tend\n\t\tend\n\n\tend", "def whiny; end", "def free_shortcut(shortcut)\n found = false\n alpha_numbers = '1234567890abcdefghijklmnopqrstuvwxyz'\n elements = @parser.find('[accesskey]').list_results\n elements.each do |element|\n shortcuts = element.get_attribute('accesskey').downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, shortcut)\n next\n end\n\n (0..alpha_numbers.length - 1).each do |i|\n key = alpha_numbers[i, i + 1]\n found = true\n elements.each do |element_with_shortcuts|\n shortcuts = element_with_shortcuts.get_attribute(\n 'accesskey'\n ).downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, key)\n next\n end\n\n element.set_attribute('accesskey', key)\n found = false\n break\n end\n break if found\n end\n break if found\n end\n end", "def test04_CancelFlagMediaDialog\n\t\tcommentMediaPop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCloseFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPST04: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def test_shortcut_register\n uri = N::URI.new(\"http://foo.foo.com/\")\n N::URI.shortcut(:foo, uri.to_s)\n assert_equal(N::FOO, uri)\n assert_kind_of(N::URI, N::FOO)\n end", "def test_gesture\r\n @point_poller.kill\r\n @current_gesture.name = \"match gesture\"\r\n @current_gesture.action = \"none\"\r\n @current_gesture.convert_points_to_gesture\r\n @recording = false\r\n @matching = false\r\n @current_gesture.test_gesture(@gestures)\r\n end", "def test_customCommandsText\n w = Window_Confirmation.new(0,80,320,\"Êtes-vous certain ?\", \"Oui\", \"Non\")\n @windows.push(w)\n return true\n end", "def test02_pre_open_board_MediaCancel\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_media)\n\t\t\n\t\tsleep 2\n\t\tassert $post_media_description.exists?\n\t\t$post_media_description.set(\"Media Description #{random}.\")\n \t\trepostGroupPop\n\t\t$post_media_button.click\n\t\tfile_upload \"GlacierBasinTrailMtRainier.JPG\"\n\t\t$post_cancel.click\n\n\t\tsleep 3\n\t\tassert $post_cancel.exists?\n\tend", "def cook_sink_eat\n delay = 4\n refresh\n HowMuch.amount(6) if click_on 'Mix/Add Honey'\n sleep delay\n refresh\n HowMuch.amount(1) if click_on 'Mix/Add Coconut'\n\n sleep delay\n refresh\n click_on 'Cook'\n popup = PopupWindow.find\n popup.click_on 'OK' if popup\n sleep delay\n\n # Eat!\n refresh\n click_on 'Enjoy'\n sleep delay\n end", "def play_random_song_from_band(term)\n response = search_itunes(term)\n results = response[\"results\"]\n pick = results.sample\n system(\"open\", pick[\"previewUrl\"]) \nend", "def test_read_guard\n song_file = File.expand_path('../song.txt', __FILE__)\n [\"IO.read '#{song_file}'\", \"File.open '#{song_file}'\"].each do |trigger|\n assert_raises(NoCheating) { FoodChain.send :class_eval, trigger }\n end\n end", "def support_autocorrect?; end", "def test_cancel_flank_when_done\n\n pdef = Ruote.process_definition do\n sequence do\n sub0 :flank => true\n echo 'over'\n end\n define 'sub0' do\n stall\n end\n end\n\n wfid = @dashboard.launch(pdef)\n\n @dashboard.wait_for(19)\n\n assert_nil @dashboard.ps(wfid)\n end", "def jukebox\n\n songs = [\n \"1. The Phoenix - 1901\",\n \"2. Tokyo Police Club - Wait Up\",\n \"3. Sufjan Stevens - Too Much\",\n \"4. The Naked and the Famous - Young Blood\",\n \"5. (Far From) Home - Tiga\",\n \"6. The Cults - Abducted\",\n \"7. The Phoenix - Consolation Prizes\"\n ]\n \n puts \"What would you like to do? \"\n \n command = gets.downcase.chomp\n\n case command\n when \"help\"\n helper\n when \"play\"\n player(songs)\n when \"list\"\n lister(songs)\n when \"exit\"\n exiter\n else \n puts \"That was an invalid command\"\n jukebox\n end\nend", "def on_mixitem_cancel\n case @mix_window.last_window\n when :skill_window\n on_mixitem_cancel_to_skill_window\n when :yea_bcl # $imported[\"YEA-BattleCommandList\"]\n on_mixitem_cancel_to_yea_bcl\n end\n end", "def example_passed(_)\n end", "def open_suggestion(suggestion)\n suggestion.hover\n wait_until { suggestion.hovered? }\n end", "def prompt_with_and_then(prompt, items, action)\n choice = `echo \"#{self.send(items)}\" | theme-dmenu -p \"#{prompt}\"`\n if (choice.length > 0)\n out, err, code = Open3.capture3(self.send(action, \"#{mountable_path}/#{choice}\"))\n if (err.length > 0)\n `notify-send -u critical Easymount \"#{err}\"`\n else\n `notify-send Easymount \"#{out}\"`\n end\n end\nend", "def play_special player\n\t\t\tif @spec_action\n\t\t\t\t@spec_action.call player, self\n\t\t\tend\n\t\t\t\n\t\t\ttrue\n\t\tend", "def register_alias(type, shortcut); end", "def choose_first_click; end", "def default_test\r\n end", "def search_input(passthrough)\t\t\n\tcase passthrough\n\t\twhen \"mv\"\n\t\t\tputs `man mv`\n\t\twhen \"cp\"\n\t\t\tputs `man cp`\n\t\twhen \"mkdir\"\n\t\t\tputs `man mkdir`\n\t\twhen \"ls\"\n\t\t\tputs `man ls`\n\t\twhen \"rm\"\n\t\t\tputs `man rm`\n\t\telse\t\n\t\t\tputs \"Not a valid search term. Common search terms are: 'mv', 'cp', 'mkdir', 'ls', 'rm'.\"\n\t\tsearch\n\tend\n\tmenu\nend", "def valid_attack_pair_callback(previous_answer=nil)\n ->(text) do\n text =~ /([a-z]*)_([a-z]*)/\n base_name = $2\n style_name = $1\n if previous_answer\n previous_answer =~ /([a-z]*)_([a-z]*)/\n return false if $2 == base_name || $1 == style_name\n end\n return false if (style_name == \"specialaction\") && !@special_action_available\n bases.map(&:name).include?(base_name) && styles.map(&:name).include?(style_name)\n end\n end", "def update_empty_sell_selection()\n if Input.trigger?(Input::B)\n Sound.play_cancel\n cancel_command()\n elsif Input.repeat?(Input::Y) || Input.repeat?(Input::Z)\n update_character_select(Input.press?(Input::Z))\n elsif Input.trigger?(Input::C)\n Sound.play_buzzer\n end\n end", "def atb_press_valid\n if @selected == @active_battler\n #open menu actor\n actor_menu_open\n #@windows[Win_Help].show\n disable_cursor\n else\n #move cursor to active battler\n Sound.play_decision\n set_active_cursor\n end\n end", "def command_use\n puts(\"Use item\")\n end", "def select_hint view, ch\n ix = get_index(ch, view.size)\n #ix = $IDX.index(ch)\n if ix\n f = view[ix]\n return unless f\n if $mode == 'SEL'\n toggle_select f\n elsif $mode == 'COM'\n run_command f\n else\n open_file f\n end\n #selectedix=ix\n end\nend", "def trigger_quit(entered_name)\n entered_name.downcase == \"quit\" || entered_name.downcase == \"q\"\nend", "def buz; Sound.play_buzzer; end" ]
[ "0.60770327", "0.5641215", "0.53163886", "0.527576", "0.5110359", "0.5054678", "0.50456005", "0.49956292", "0.49534383", "0.49175087", "0.48714948", "0.4857888", "0.48518184", "0.48454732", "0.47849166", "0.4767513", "0.4757586", "0.47565967", "0.4740271", "0.47304425", "0.47258037", "0.47156262", "0.47146147", "0.4705748", "0.46995372", "0.46837947", "0.4675467", "0.46473873", "0.46432954", "0.4639953", "0.4639458", "0.46228364", "0.46140155", "0.46136132", "0.4607266", "0.46068007", "0.46002245", "0.45968524", "0.45920277", "0.45889837", "0.45667922", "0.4561796", "0.4555931", "0.45482144", "0.45367786", "0.45367786", "0.45319274", "0.45310327", "0.45268968", "0.45187446", "0.45166087", "0.45127985", "0.45122498", "0.45099795", "0.45008317", "0.44995478", "0.44977492", "0.44929132", "0.44816014", "0.44754836", "0.44708598", "0.44590455", "0.44559202", "0.44555753", "0.44516936", "0.4450487", "0.44498405", "0.44481787", "0.44433716", "0.44410697", "0.44383508", "0.44377133", "0.44307894", "0.442517", "0.44215646", "0.4421164", "0.44211444", "0.44189638", "0.44184783", "0.44153142", "0.44141853", "0.4413594", "0.44105685", "0.44095403", "0.44078845", "0.44009292", "0.44007218", "0.4398024", "0.43967658", "0.439512", "0.439487", "0.43922734", "0.439101", "0.43901145", "0.43776157", "0.43747532", "0.4368555", "0.4366236", "0.4362038", "0.43559462" ]
0.438795
94
Test shortcut, alleviates the need to set the workitem before calling on_reply.
def _on_reply(wi) Ruote.participant_send(self, :on_reply, 'workitem' => wi) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testShortcut\n execute_Deliver_WithConf({\n :WaveFiles => { :FilesList => [ { :Name => 'Wave1.wav' } ] },\n :Mix => { 'Mix1' => { :Tracks => { 'Wave1.wav' => {} } } },\n :Deliver => {\n :Formats => {\n 'Test' => {\n :FileFormat => 'Wave'\n }\n },\n :Deliverables => {\n 'Deliverable' => {\n :Mix => 'Mix1',\n :Format => 'Test'\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Mixed_Wave1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert_wave_lnk '01_Source/Wave/Wave1', '06_Deliver/Deliverable/Track.wav'\n end\n end", "def reply(workitem)\n\n puts '-' * 80\n puts '*** WARNING : please use the Ruote::StorageParticipant#proceed(wi)'\n puts ' instead of #reply(wi) which is deprecated'\n #caller.each { |l| puts l }\n puts '-' * 80\n\n proceed(workitem)\n end", "def reply (workitem)\n\n reply_to_parent(workitem)\n end", "def reply (workitem)\n\n reply_to_parent(workitem)\n end", "def reply(workitem)\n\n reply_to_parent(workitem)\n end", "def test_check_shortcut\n N::Namespace.shortcut(:xyshortcut, \"http://xyz/\")\n assert_equal(:xyshortcut, N::URI.new(\"http://xyz/\").my_shortcut)\n end", "def reply (exp_or_fei, workitem)\n\n get_workqueue.push(\n self, :do_apply_reply, :reply, exp_or_fei, workitem)\n end", "def change_shortcut(slot_id, actor, recipe)\n if actor.nil? || recipe.nil?\n @cooking_shortcuts[slot_id].clear \n else\n @cooking_shortcuts[slot_id].shortcut(actor, recipe)\n end\n end", "def test_create_reply_to_up_in_chain_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @kevin, reply_to, about)\r\n end", "def test_create_reply_to_reply_to_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:matt_reply_to__kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @matt, reply_to, about)\r\n end", "def test_inexistent_shortcut\n assert_equal(nil, N::URI.new(\"http://noshortcut/\").my_shortcut)\n end", "def test_shortcuts\n N::URI.shortcut(:at_least_one, \"http://atleast.com\")\n N::URI.shortcut(:at_least_two, \"http://atleasttwo.com\")\n assert(N::URI.shortcuts.size > 1, \"There should be at least two shortcuts\")\n assert(N::URI.shortcuts.keys.include?(:at_least_one))\n assert(N::URI.shortcuts.keys.include?(:at_least_two))\n end", "def reply (workitem)\n\n unschedule_timeout(workitem)\n\n super\n end", "def test_create_reply_to_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@matt, @kevin, reply_to, about)\r\n end", "def test_create_reply_to_standalone_message_about_nothing\r\n reply_to = messages(:andy_to_kevin_about_nothing)\r\n about = nil\r\n send_message(@kevin, @andy, reply_to, about)\r\n end", "def test_illegal_shortcuts\n N::URI.shortcut(:illegal_short, \"http://illegal.shortcut.com/\")\n assert_raises(NameError) { N::URI.shortcut(:illegal_short, \"xxx\") }\n assert_raises(NameError) { N::URI.shortcut(:legal_short, \"http://illegal.shortcut.com/\")}\n end", "def reply (workitem)\n\n workitem = workitem.to_ruote_workitem \\\n if workitem.respond_to?(:to_ruote_workitem)\n\n destroy(workitem.fei)\n reply_to_engine(workitem)\n end", "def set_shortcut\n @shortcut = Shortcut.with_normalized_target(params[:target]).first\n raise ActiveRecord::RecordNotFound.new(\"No Shortcut found with target='#{params[:target]}'\") unless @shortcut\n end", "def set_shortcut_text\n @shortcut_text = ShortcutText.find(params[:id])\n end", "def test_create_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:tim_reply_to__andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@matt, @tim, reply_to, about)\r\n end", "def test_handle_roulette_shot_2_repeat\n @plugin.stubs(:shot).returns(1)\n @plugin.stubs(:draw).returns(0)\n @plugin.handle(Time.now, \"John\", \"roulette\")\n assert_equal( [\"John: you can't shoot twice in a row, dolt!\"], @plugin.reply_to.replies )\n end", "def reply (workitem)\n\n @items.delete(workitem.fei.to_storage_id)\n reply_to_engine(workitem)\n end", "def test05_search_repost_note_TC_28838\n\t\trepostNotePop\n\t\tsleep 2\n\t\trepost\n\t\tsleep 2\n\t\t\n\t\t$search_text_field.when_present.set(\"Repost text\")\n\t\t$search_button.click\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Repost text\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T5: FAILED! User unable to locate repost.\"\n\t\tend\n\tend", "def reply\n end", "def test_create_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@tim, @andy, reply_to, about)\r\n end", "def test_05_1_show_me_how_TC_24406\n\t\t\n\t\tprofileLogin\n\t\t$browser.goto($patch_note)\n\t\t$help_post_note.when_present.click\n\t\tsleep 4 \n\t\t$browser.window(:title, /Post a Note/).use do\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Post a Note\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"J1_T5.1: FAILED! User unable to navigate to zendesk.\"\n\t\tend\n\t\tend\n\tend", "def set_reply(reply)\n @reply = reply\n end", "def reply_to_parent(workitem, delete=true)\n\n do_reply_to_parent(workitem, delete)\n end", "def test03_flag_repost_event_TC_24323\n\t\trepostEventPop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T3: FAILED! User unable to flag post.\"\n\t\tend\n\tend", "def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend", "def update_help\n @help_window.quest = item\n end", "def reply_to_engine(wi=workitem)\n\n receive(wi)\n end", "def add_shortcut(shortcut)\n @shortcuts.push(shortcut) unless @shortcuts.index(shortcut)\n end", "def work!(work_item)\n raise NotImplementedError\n end", "def test02_repostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\trepost \"\" #No note\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend", "def free_shortcut(shortcut)\n found = false\n alpha_numbers = '1234567890abcdefghijklmnopqrstuvwxyz'\n elements = @parser.find('[accesskey]').list_results\n elements.each do |element|\n shortcuts = element.get_attribute('accesskey').downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, shortcut)\n next\n end\n\n (0..alpha_numbers.length - 1).each do |i|\n key = alpha_numbers[i, i + 1]\n found = true\n elements.each do |element_with_shortcuts|\n shortcuts = element_with_shortcuts.get_attribute(\n 'accesskey'\n ).downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, key)\n next\n end\n\n element.set_attribute('accesskey', key)\n found = false\n break\n end\n break if found\n end\n break if found\n end\n end", "def test03_R1_post_note_TC_24423\n\t\t@msg = \"It's nice to see small businesses in #{$local_patch} #{random}\"\n\t\t$browser.goto($patch_login)\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_directory_listing)\n\t\twait_for_ajax\n\t\tsleep 4\n\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n\t\tsleep 3\n\t\t$business_review_note_button.click\n\t\tsleep 2\n\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t$business_review_text.set(@msg)\n\n\t\tsleep 2\n\t\t$business_review_post.fire_event(\"onclick\")\n\n\t\tsleep 5\n\t\tassert $browser.text.include? \"#{@msg}\"\n\tend", "def test_create_reply_to_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:matt_reply_to__tim_reply_to__andy_to_kevin_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n notified_users = send_message(@kevin, @matt, reply_to, about)\r\n assert !notified_users.include?(@kevin),\r\n \"Owner of the review should not receive their own comments on the review.\"\r\n end", "def admin_approve_reply_or_post(title, answer_text=nil, descrip=nil, tab_type)\n navigate_in\n switch_to_tab tab_type\n @browser.wait_until { empty_admin_mod_post.present? || mod_tab_posts_block.div(:class => \"post\", :index => 0).present? }\n for index in 0...mod_tab_posts_block.divs(:class => \"post\").size\n if (mod_tab_posts_block.element(:css => \".post .media-heading a\", :index => index).text == title)\n if answer_text == nil\n answer_text = \"Answer by watir\"\n next # this is the reply, continue\n end\n mod_tab_posts_block.button(:css => \".mod-button.approve\", :index => index).when_present.click\n @browser.wait_until { empty_admin_mod_post.present? || mod_tab_posts_block.div(:class => \"post\", :index => 0).present? }\n return true\n end\n end\n return false\n end", "def test_shortcut_accessor\n assert_equal(N::LOCAL, N::URI[:local])\n end", "def notifyShortcutCreate(iSC)\n notifyRegisteredGUIs(:onShortcutCreate, iSC)\n end", "def dwp_work(work_item)\n dwp_log{ \"Working, item: #{work_item.inspect}\" }\n dwp_run_callback('before_work', work_item)\n work!(work_item)\n dwp_run_callback('after_work', work_item)\n end", "def test1ActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [WEACE::Master::TransferFile.new(iTmpFileName)] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n }\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal([], getSlaveClientQueue)\n assert_equal({iTmpFileName => 1}, getTransferFiles)\n end\n end\n end\n end", "def content_reply_comment_action_item(text=nil, &block)\n icon = content_tag(:div, '', :class => 'iconReplyCommentSmall')\n content_action_item(text, icon, &block)\n end", "def do_reply_to_parent(workitem, delete=true)\n\n # propagate the cancel \"flavour\" back, so that one can know\n # why a branch got cancelled.\n\n flavour = if @msg.nil?\n nil\n elsif @msg['action'] == 'cancel'\n @msg['flavour'] || 'cancel'\n elsif h.state.nil?\n nil\n else\n @msg['flavour']\n end\n\n # deal with the timers and the schedules\n\n %w[ timeout_schedule_id job_id ].each do |sid|\n @context.storage.delete_schedule(h[sid]) if h[sid]\n end\n #\n # legacy schedule ids, to be removed for ruote 2.4.0\n\n @context.storage.delete_schedule(h.schedule_id) if h.schedule_id\n #\n # time-driven exps like cron, wait and once now all use h.schedule_id\n\n h.timers.each do |schedule_id, action|\n @context.storage.delete_schedule(schedule_id)\n end if h.timers\n\n # cancel flanking expressions if any\n\n cancel_flanks(h.state == 'dying' ? 'kill' : nil)\n\n # trigger or vanilla reply\n\n if h.state == 'failing' # on_error is implicit (#do_fail got called)\n\n trigger('on_error', workitem)\n\n elsif h.state == 'cancelling' && h.on_cancel\n\n trigger('on_cancel', workitem)\n\n elsif h.state == 'cancelling' && h.on_re_apply\n\n trigger('on_re_apply', workitem)\n\n elsif h.state == 'timing_out' && h.on_timeout\n\n trigger('on_timeout', workitem)\n\n elsif h.state == nil && h.on_reply\n\n trigger('on_reply', workitem)\n\n elsif h.flanking && h.state.nil?\n #\n # do vanish\n\n do_unpersist\n\n elsif h.lost && h.state.nil?\n #\n # do not reply, sit here (and wait for cancellation probably)\n\n do_persist\n\n elsif h.trigger && workitem['fields'][\"__#{h.trigger}__\"]\n #\n # the \"second take\"\n\n trigger(h.trigger, workitem)\n\n else # vanilla reply\n\n filter(workitem) if h.state.nil?\n\n f = h.state.nil? && attribute(:vars_to_f)\n Ruote.set(workitem['fields'], f, h.variables) if f\n\n workitem['sub_wf_name'] = h.applied_workitem['sub_wf_name']\n workitem['sub_wf_revision'] = h.applied_workitem['sub_wf_revision']\n\n leave_tag(workitem) if h.tagname\n\n (do_unpersist || return) if delete\n # remove expression from storage\n\n if h.parent_id && ! h.attached\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => h.parent_id,\n 'workitem' => workitem.merge!('fei' => h.fei),\n 'updated_tree' => h.updated_tree, # nil most of the time\n 'flavour' => flavour)\n\n else\n\n @context.storage.put_msg(\n (h.forgotten || h.attached) ? 'ceased' : 'terminated',\n 'wfid' => h.fei['wfid'],\n 'fei' => h.fei,\n 'workitem' => workitem,\n 'variables' => h.variables,\n 'flavour' => flavour)\n\n if\n h.state.nil? &&\n h.on_terminate == 'regenerate' &&\n ! (h.forgotten || h.attached)\n then\n @context.storage.put_msg(\n 'regenerate',\n 'wfid' => h.fei['wfid'],\n 'tree' => h.original_tree,\n 'workitem' => workitem,\n 'variables' => h.variables,\n 'flavour' => flavour)\n #'stash' =>\n end\n end\n end\n end", "def register_alias(type, shortcut); end", "def test05_post_closed_news_NoNoteRepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepost \"\" #No note\n \t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend", "def create\n @shortcut = Shortcut.new(shortcut_params)\n @shortcut.assign_target\n\n respond_to do |format|\n if @shortcut.save\n format.html { redirect_to @shortcut, notice: 'Shortcut was successfully created.' }\n format.json { render :show, status: :created, location: @shortcut }\n else\n format.html { render :new }\n format.json { render json: @shortcut.errors, status: :unprocessable_entity }\n end\n end\n end", "def items_shortcut\n (config_params||DEFAULT_CONFIG_PARAMS)[\"Items Shortcut\"]\n end", "def reply_without_prefix arg\n reply arg, false\n end", "def test_suggest_word_with_one_word_inserted_and_three_letter_string\n @completion.insert(\"pizza\")\n assert_equal [\"pizza\"], @completion.suggest(\"pi\")\n end", "def test05_NoteTwoComments_TC_24319\n\t\tcommentNotePop\n\t\tcommentPopSubmit\n\tend", "def command_126(*args, &block)\n $game_temp.affix_gain_item_event_flag = true\n marw_command126_8qu7(*args, &block) # Call Original Method\n $game_temp.affix_gain_item_event_flag = false\n end", "def content_reply_comment_action_link(text, comment)\n content_reply_comment_action_item(comment_link_to_function(text, comment))\n end", "def delegate(workitem, new_owner)\n\n hwi = fetch(workitem)\n\n fail ArgumentError.new(\n \"workitem not found\"\n ) if hwi == nil\n\n fail ArgumentError.new(\n \"cannot delegate, workitem doesn't belong to anyone\"\n ) if hwi['owner'] == nil\n\n fail ArgumentError.new(\n \"cannot delegate, \" +\n \"workitem owned by '#{hwi['owner']}', not '#{workitem.owner}'\"\n ) if hwi['owner'] != workitem.owner\n\n hwi['owner'] = new_owner\n\n r = @context.storage.put(hwi, :update_rev => true)\n\n fail ArgumentError.new(\"workitem is gone\") if r == true\n fail ArgumentError.new(\"workitem got modified meanwhile\") if r != nil\n\n Workitem.new(hwi)\n end", "def test02_R1_disappointed_TC_24423\n\t\t@msg = \"The office isn't open at 3 AM! I am disappointed times #{random}!!\"\n\t\t$browser.goto($patch_login)\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_directory_listing)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n\t\tsleep 3\n\t\t$business_review_disappointed.click\n\t\tsleep 2\n\t\t$business_review_text.set(@msg)\n\t\t$business_review_post.fire_event(\"onclick\")\n\n\t\tsleep 2\n\t\tassert $browser.text.include? \"#{@msg}\"\n\t\tassert $browser.text.include? \"disappointed times\"\n\n\tend", "def command_128(*args, &block)\n $game_temp.affix_gain_item_event_flag = true\n marw_command128_8qu7(*args, &block) # Call Original Method\n $game_temp.affix_gain_item_event_flag = false\n end", "def reply(event)\n msg = event.message['text']\n mk_reply(msg)\nend", "def test_doOnce_Museum_one_Choice\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Museum\";\n\tend\n\tdef d.location=(n); n;\n\tend\n\tassert_equal \"Hillman\", do_once(d,1,0)\nend", "def _on_workitem(wi)\n Ruote.participant_send(\n self, [ :on_workitem, :consume ], 'workitem' => wi)\n end", "def command_127(*args, &block)\n $game_temp.affix_gain_item_event_flag = true\n marw_command127_8qu7(*args, &block) # Call Original Method\n $game_temp.affix_gain_item_event_flag = false\n end", "def shortcut(short, command)\n (@@shortcuts[command.to_s] ||= []).push short\n @@shortcut_table[short] = command.to_s\n end", "def test02_flag_repost_article_TC_24323\n\t\trepostArticlePop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T2: FAILED! User unable to flag post.\"\n\t\tend\n\tend", "def check_unique_shortcut?\n if (not new_record? and Node.where('nodes.shortcut = ? AND nodes.id != ?', shortcut, id).exists?) or (new_record? and Node.exists?(:shortcut => shortcut))\n puts \"Problem Node: (Title: #{title}, ID: #{id} URL: #{shortcut}), new_record: #{new_record?}\"\n addition = Node.where('shortcut LIKE ?', shortcut).count\n suggested = self.shortcut + \"_\" + addition.to_s\n errors.add(:shortcut, \"URL shortcut already exists in this site. Suggested Shortcut: '#{suggested}'\")\n end\n end", "def test_shortcut_register\n uri = N::URI.new(\"http://foo.foo.com/\")\n N::URI.shortcut(:foo, uri.to_s)\n assert_equal(N::FOO, uri)\n assert_kind_of(N::URI, N::FOO)\n end", "def test04_L1DLT04_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Tweet\" button\n\tend", "def open_suggestion(suggestion)\n suggestion.hover\n wait_until { suggestion.hovered? }\n end", "def test03_post_open_news_250RepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepostPopulate250\n \t\tsleep 3\n\n\t\tassert $repost_confirmation.exists?\n\tend", "def test_guests_react_to_their_favourite_song_being_queued\n @office.check_guest_in(@room1, @guest1)\n assert_equal(\"Elizabeth says 'Choon!'\", @room1.queue_song(@song1))\n end", "def consume (workitem)\n\n reply_to_engine(workitem)\n end", "def increment_helper_no_reply_count\n return true if seen_second_helper_no_reply?\n if seen_first_helper_no_reply\n self.seen_second_helper_no_reply = true\n else\n self.seen_first_helper_no_reply = true\n end\n end", "def test1FailActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n lTransferFile = WEACE::Master::TransferFile.new(iTmpFileName)\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [lTransferFile] ]\n ]\n $Context[:DummySenderSendError] = RuntimeError.new('Sending error')\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n },\n :Error => RuntimeError\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal(\n [\n [ 'DummyUser',\n { 'DummyTool' => {\n 'DummyAction' => [\n [lTransferFile]\n ]\n }\n }\n ]\n ],\n getSlaveClientQueue\n )\n assert_equal({iTmpFileName => 2}, getTransferFiles)\n end\n end\n end\n end", "def consume (workitem)\n # does nothing and does not reply to the engine.\n end", "def test_02_comment_on_post_as_guest\n end", "def direct_reply(event, data)\n raise NotImplementedError.new(\"Kosmonaut::Message#direct_reply is not implemented yet\")\n end", "def proceed(workitem)\n\n r = remove_workitem('proceed', workitem)\n\n return proceed(workitem) if r != nil\n\n workitem.h.delete('_rev')\n\n reply_to_engine(workitem)\n end", "def nlu_handle_input\n # Wit processing will take a while, so we want to show activity\n @message.mark_seen\n @message.typing_on\n return if acted_on_non_questions?\n # Non-questions ruled out, we can\n # save a question to correct later, if needed\n @user.session[:needs_correction] = @message.text\n # Act on a type of question\n act_on_question_types\n # We're done replying\n @message.typing_off\n end", "def test_create_standalone_message_about_nothing\r\n reply_to = nil\r\n about = nil\r\n send_message(@andy, @kevin, reply_to, about)\r\n end", "def testExactMatch2Actions\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ],\n [ 'DummyTool', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ],\n 'DummyAction2' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def test03_250RepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepostPopulate250\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS4T003: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend", "def test_handler_queueing_when_triggered_in_cell_state\n m = mouse_mock('mommy')\n m << s= mouse_mock('sender', :fire_event) do\n def fire_event\n trigger :click \n render :nothing => true\n end\n end\n \n m << r= mouse_mock('receiver', :receive_event) do\n def receive_event; render :text => \"gotcha!\"; end\n end\n m.respond_to_event :click, :on => 'receiver', :with => :receive_event\n \n s.invoke # trigger :click\n \n assert_equal 1, @processor.queue.size\n a = @processor.queue.first\n # test [handler, event]:\n assert_equal \"InvokeEventHandler:receiver#receive_event\", a.first.to_s\n assert_equal s.name, a.last.source.name\n end", "def set_safe_shortcut(desired_shortcut, node_id, increment=0)\n prefix = increment == 0 ? \"\" : increment.to_s + \"-\"\n while Node.where('nodes.shortcut = ? AND nodes.id != ?', prefix + desired_shortcut, node_id).exists?\n increment += 1\n prefix = increment.to_s + \"-\"\n end\n self.shortcut = prefix + desired_shortcut\n return increment\n end", "def shortcut_params\n params.require(:shortcut).permit(:url, :target)\n end", "def reply( r )\n @main << r\n end", "def default_shortcuts\r\n {\r\n \"Ctrl+Shift+S\" => {\"description\"=>\"Displays Tr8n shortcuts\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_shortcuts', {width:400});\"},\r\n \"Ctrl+Shift+I\" => {\"description\"=>\"Turns on/off inline translations\", \"script\"=>\"Tr8n.UI.LanguageSelector.toggleInlineTranslations();\"},\r\n \"Ctrl+Shift+L\" => {\"description\"=>\"Shows/hides settings selector\", \"script\"=>\"Tr8n.UI.LanguageSelector.show(true);\"},\r\n \"Ctrl+Shift+N\" => {\"description\"=>\"Displays notifications\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/translator/notifications/lb_notifications', {width:600});\"},\r\n \"Ctrl+Shift+K\" => {\"description\"=>\"Adds software keyboard for each entry field\", \"script\"=>\"Tr8n.Utils.toggleKeyboards();\"},\r\n \"Ctrl+Shift+C\" => {\"description\"=>\"Display current component status\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_source?source=' + Tr8n.source, {width:420});\"},\r\n \"Ctrl+Shift+T\" => {\"description\"=>\"Displays Tr8n statistics\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_stats', {width:420});\"},\r\n \"Ctrl+Shift+D\" => {\"description\"=>\"Debug Tr8n Proxy\", \"script\"=>\"Tr8n.SDK.Proxy.debug();\"},\r\n\r\n \"Alt+Shift+C\" => {\"description\"=>\"Displays Tr8n credits\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/help/credits';\"},\r\n \"Alt+Shift+D\" => {\"description\"=>\"Opens dashboard\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/translator/dashboard';\"},\r\n \"Alt+Shift+M\" => {\"description\"=>\"Opens sitemap\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/sitemap';\"},\r\n \"Alt+Shift+P\" => {\"description\"=>\"Opens phrases\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/phrases';\"},\r\n \"Alt+Shift+T\" => {\"description\"=>\"Opens translations\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/translations';\"},\r\n \"Alt+Shift+A\" => {\"description\"=>\"Opens awards\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/awards';\"},\r\n \"Alt+Shift+B\" => {\"description\"=>\"Opens message board\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/forum';\"},\r\n \"Alt+Shift+G\" => {\"description\"=>\"Opens glossary\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/glossary';\"},\r\n \"Alt+Shift+H\" => {\"description\"=>\"Opens help\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/help';\"}\r\n }\r\n end", "def notifyShortcutDelete(iSC)\n notifyRegisteredGUIs(:onShortcutDelete, iSC)\n end", "def test_doOnce_cathedral_one_Choice\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Cathedral\";\n\tend\n\tdef d.location=(n); n;\n\tend\n\tassert_equal \"Museum\", do_once(d,1,0)\nend", "def reply_to(message_title)\n self.h1(:class=>\"discussion_topic_subject\", :text=>message_title).parent.button(:text=>\"Reply\").click\n self.wait_until { self.h1(:class=>\"discussion_topic_subject\", :text=>message_title).parent.text_field(:id=>\"discussion_topic_reply_text\").present? }\n end", "def ask_post\n page(MorePage).select_more_actions(\"Ask HN\")\n page(MorePage).page_handler(\"Ask HN\")\n page(FeedDetailsPage).touch_row\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n page(SubmissionPage).await\n page(MorePage).backpage\n page(MorePage).page_handler(\"Ask HN\")\n page(MorePage).backpage\n end", "def iSetTargetWifi(client)\n\t\tbegin\n\t\t\tclient.launch(\"com.apple.Preferences\", true, true)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='Wi-Fi' and @x=118]\", 0, 1)\n\t\t\tclient.sleep(3000)\n\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='QA2-2G' and @x>700 and @y<400]\", 0)\n\t\t\t\tputs \"::MSG:: 既に接続しました「 Already connected to Main environment\"\n\t\t\t\tclient.sleep(3000)\n\t\t\telse\n\t\t\t\tclient.sleep(7000)\n\t\t\t\tclient.longClick(\"NATIVE\", \"xpath=//*[@text='QA2-2G' and @x>700 and @y>400]\", 0, 1, 0, 0)\n\t\t\t\tclient.sleep(3000)\n\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='このネットワーク設定を削除' and ./parent::*[@text='このネットワーク設定を削除']]\", 0)\n\t\t\t\t\tputs \"::MSG:: 既に接続しました「 Already connected to Main environment\"\n\t\t\t\t\tclient.sleep(2000)\n\t\t\t\telse\n\t\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='パスワード' and ./parent::*[@text='パスワード' and ./parent::*[@text='パスワード']]]\", 0)\n\t\t\t\t\t\tclient.elementSendText(\"NATIVE\", \"xpath=//*[@text='パスワード' and ./parent::*[@text='パスワード' and ./parent::*[@text='パスワード']]]\", 0, \"unexttest\")\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tend\n\t\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='接続']\", 0)\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='接続']\", 0, 1)\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tend\n\t\t\t\t\tputs \"::MSG:: 本番環境に接続しました「 Conencted to Main environment\"\n\t\t\t\t\tclient.sendText(\"{HOME}\")\n\t\t\t\tend\n\t\t\tend\n\t\trescue Exception => e\n\t\t\t$errMsgCcast = \"::MSG:: Exception occurrred while setting wifi \" + e.message\n\t\tend\t\t\n\t\tclient.launch(\"jp.unext.mediaplayer\", true, false)\n\t\tclient.sleep(5000)\n\tend", "def test05_post_open_news_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_note)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\tassert $comment_flag_success.exists?\n\tend", "def answering!(to_whom, &block)\n @asker, @askers_callback = to_whom, block\n self\n end", "def test_QuestionSetHandlerAlways\n randomName = SecureRandom.hex(4)\n randomReq = \"0\" + SecureRandom.hex(4)\n randomReq2 = \"0\" + SecureRandom.hex(4)\n \n randomEmail = SecureRandom.hex(4) \n randomLastName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n #Must be set on \"Custom Settings\", Question Set Handler = Always.\n Common.go_to_custom_settings()\n CustomSettings.QuestionSetHandler(\"Always\")\n \n #Create an empty Question Sets\n Common.CreateQuestionSetEmpty(randomName)\n \n # Go to \"Question Sets\" Tab\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n \n test = [\n {\"displayed\" => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH},\n {\"click_and_load\" => QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\"},\n {\"displayed\" => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH},\n ]\n Common.main(test) \n \n # Click on \"New Question\" \n test = [\n {\"click_and_load\" => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH},\n {\"displayed\" => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH}\n ]\n Common.main(test)\n \n # Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n elementText = $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_TEXT_XPATH)\n if elementText.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_TEXT_XPATH).click\n end\n elementOptional = $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_OPTIONAL_XPATH)\n if elementOptional.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).click\n end\n \n test = [\n # Click on \"Save\" \n {\"click_and_load\" => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH},\n {\"displayed\" => QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH},\n ]\n Common.main(test)\n \n #Add Answers\n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH).displayed?\n }\n test = [ \n {\"click_and_load\" => QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH},\n {\"displayed\" => AnswerEditPage::ANSWER_EDIT_NAME_XPATH},\n {\"displayed\" => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH},\n ]\n Common.main(test) \n \n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_NAME_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ORDER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_ORDER_1_INT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH).send_keys AnswerEditPage::ANSWER_DATA_SCORE_1_INT\n test = [ \n {\"click_and_load\" => AnswerEditPage::ANSWER_EDIT_BTN_SAVE_NEW_XPATH},\n ]\n Common.main(test) \n sleep(1)\n $wait.until{\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_NAME_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH).displayed?\n } \n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_NAME_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_2_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_2_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ORDER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_ORDER_2_INT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH).send_keys AnswerEditPage::ANSWER_DATA_SCORE_2_INT\n test = [ \n {\"click_and_load\" => AnswerEditPage::ANSWER_EDIT_BTN_SAVE_NEW_XPATH},\n ]\n Common.main(test)\n \n # Create Job with Question Set asociated\n \n Common.goToTab(HomePage::REQUISITIONS_LINK_XPATH)\n test = [ \n {\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"displayed\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH},\n {\"click_and_load\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH},\n {\"displayed\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH},\n ]\n Common.main(test)\n \n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).send_keys randomReq\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_PRIMARY_RECRUITER_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_LOCATION_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_OPTION_XPATH).click\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MIN_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MAX_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).send_keys randomName\n unless $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).click\n end\n \n test = [ \n {\"click_and_load\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH}\n ]\n Common.main(test)\n \n \n # Create Job with Question Set asociated\n Common.goToTab(HomePage::REQUISITIONS_LINK_XPATH)\n test = [ \n {\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"displayed\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH},\n {\"click_and_load\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH},\n {\"displayed\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH},\n ]\n Common.main(test)\n \n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).send_keys randomReq2\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_PRIMARY_RECRUITER_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_LOCATION_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_OPTION_XPATH).click\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MIN_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MAX_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).send_keys randomName\n unless $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).click\n end\n \n test = [ \n {\"click_and_load\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH}\n ]\n Common.main(test)\n \n #JobBoard without login\n CustomSettings.JobBoardLogin(false)\n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.displayed(BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.ResumeRequired(false)\n CustomSettings.DefineEEOQuestions(false, false, false, false, false)\n \n # 1 - Go to Job Board\n $browser.get(HomePage::JOB_BOARD_URL)\n \n # 2 - Apply to a job from the job board site, with Question Set asociated.\n test = [ \n {\"displayed\" => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH},\n {\"click_and_load\" => JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomReq + \"')]]\"},\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH},\n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH},\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH},\n ]\n Common.main(test)\n \n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).send_keys randomEmail + Users::EMAIL_DOMAIN\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_FIRST_NAME_XPATH).send_keys randomEmail\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LAST_NAME_XPATH).send_keys randomLastName\n \n #If How did you hear about us? is displayed\n begin\n aboutUsSelect = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).displayed?\n rescue\n aboutUsSelect = false\n end \n if aboutUsSelect\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).send_keys \"Job Board\"\n end\n test = [\n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH},\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH},\n ] \n Common.main(test) \n \n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n test = [\n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH}\n ] \n Common.main(test) \n end\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n test = [\n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH}\n ] \n Common.main(test) \n end\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH).displayed?\n }\n # 3 - Complete the fields from the question set\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_1_INPUT_XPATH + \"//select\").send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n \n test = [\n # 4 - Click on Submit \n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_BTN_SUBMIT_XPATH},\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH},\n # 5 - Click on \"Return to Job Search\" \n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH},\n {\"displayed\" => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH},\n ]\n Common.main(test)\n \n # 6 - Apply to another job\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomReq2 + \"')]]\").click\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH).displayed?\n }\n test = [\n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH},\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH}\n ] \n Common.main(test) \n \n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).send_keys randomEmail + Users::EMAIL_DOMAIN\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_FIRST_NAME_XPATH).send_keys randomEmail\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LAST_NAME_XPATH).send_keys randomLastName\n \n #If How did you hear about us? is displayed\n begin\n aboutUsSelect = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).displayed?\n rescue\n aboutUsSelect = false\n end \n if aboutUsSelect\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).send_keys \"Job Board\"\n end\n \n test = [\n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH},\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH}\n ] \n Common.main(test) \n \n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n test = [\n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH}\n ] \n Common.main(test) \n end\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n test = [\n {\"click_and_load\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH}\n ] \n Common.main(test) \n end\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH).displayed?\n }\n \n # RESULT \n # The Questions page would propose to complete each question from the question set.\n assert $wait.until{\n $browser.find_element(:xpath =>JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_1_INPUT_XPATH + \"//select/option[1]\").selected?\n }\n\n end", "def set_reply\n @reply = Replie.find(params[:id])\n end", "def test04_flag_repost_media_TC_24323\n\t\trepostMediaPop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T4: FAILED! User unable to flag post.\"\n\t\tend\n\tend", "def reply(opts = {})\n self.dup.reply! opts\n end", "def should_reply?(params)\n !$redis.exists?('snarkov:shush') &&\n (settings.ignore_regex.nil? || !params[:text].match(settings.ignore_regex)) &&\n (rand <= ENV['RESPONSE_CHANCE'].to_f || (!settings.reply_regex.nil? && params[:text].match(settings.reply_regex)))\nend", "def reply_to_parent(workitem)\n\n @context.tracker.remove_tracker(h.fei)\n\n super(workitem)\n end", "def post_reply_notification_key(reply)\n \"post_reply_#{reply.id}\"\n end", "def test01_post_open_news_NoNoteRepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\trepost \"\" #No note\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend" ]
[ "0.6283067", "0.6050339", "0.6001547", "0.6001547", "0.5951583", "0.5847452", "0.56966007", "0.56752044", "0.56427646", "0.56338197", "0.5612089", "0.559568", "0.5581304", "0.55049735", "0.5406963", "0.5389959", "0.5356444", "0.5343097", "0.53312415", "0.5303894", "0.52936673", "0.52746785", "0.52253443", "0.5212973", "0.51741594", "0.51732534", "0.51253307", "0.50602317", "0.49990803", "0.49902827", "0.49896392", "0.49496335", "0.49377325", "0.49353954", "0.49314427", "0.49294826", "0.4896089", "0.48889685", "0.48811388", "0.48591486", "0.48546404", "0.48428395", "0.4826013", "0.4822378", "0.48215714", "0.48078677", "0.48059705", "0.47943196", "0.47910842", "0.4779503", "0.47700718", "0.47645935", "0.47635663", "0.47395277", "0.47176522", "0.47171295", "0.47020513", "0.46866363", "0.4668901", "0.46628454", "0.46620253", "0.46605068", "0.4659827", "0.46533534", "0.46426597", "0.46420434", "0.4631811", "0.46303383", "0.46240476", "0.4623625", "0.46185893", "0.4617835", "0.46168566", "0.461058", "0.46086782", "0.4608664", "0.4607339", "0.4604947", "0.46045214", "0.46029556", "0.45992064", "0.45924857", "0.45911872", "0.45823905", "0.45747885", "0.4567471", "0.45673066", "0.456472", "0.4563607", "0.45622823", "0.45611307", "0.45598385", "0.45586896", "0.45577812", "0.45508456", "0.45460913", "0.45457304", "0.45366403", "0.4533671", "0.45334238" ]
0.5595258
12
Test shortcut, alleviates the need to set the workitem before calling accept?
def _accept?(wi) Ruote.participant_send(self, :accept?, 'workitem' => wi) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testShortcut\n execute_Deliver_WithConf({\n :WaveFiles => { :FilesList => [ { :Name => 'Wave1.wav' } ] },\n :Mix => { 'Mix1' => { :Tracks => { 'Wave1.wav' => {} } } },\n :Deliver => {\n :Formats => {\n 'Test' => {\n :FileFormat => 'Wave'\n }\n },\n :Deliverables => {\n 'Deliverable' => {\n :Mix => 'Mix1',\n :Format => 'Test'\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Mixed_Wave1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert_wave_lnk '01_Source/Wave/Wave1', '06_Deliver/Deliverable/Track.wav'\n end\n end", "def test_check_shortcut\n N::Namespace.shortcut(:xyshortcut, \"http://xyz/\")\n assert_equal(:xyshortcut, N::URI.new(\"http://xyz/\").my_shortcut)\n end", "def test_inexistent_shortcut\n assert_equal(nil, N::URI.new(\"http://noshortcut/\").my_shortcut)\n end", "def test_illegal_shortcuts\n N::URI.shortcut(:illegal_short, \"http://illegal.shortcut.com/\")\n assert_raises(NameError) { N::URI.shortcut(:illegal_short, \"xxx\") }\n assert_raises(NameError) { N::URI.shortcut(:legal_short, \"http://illegal.shortcut.com/\")}\n end", "def test_shortcuts\n N::URI.shortcut(:at_least_one, \"http://atleast.com\")\n N::URI.shortcut(:at_least_two, \"http://atleasttwo.com\")\n assert(N::URI.shortcuts.size > 1, \"There should be at least two shortcuts\")\n assert(N::URI.shortcuts.keys.include?(:at_least_one))\n assert(N::URI.shortcuts.keys.include?(:at_least_two))\n end", "def change_shortcut(slot_id, actor, recipe)\n if actor.nil? || recipe.nil?\n @cooking_shortcuts[slot_id].clear \n else\n @cooking_shortcuts[slot_id].shortcut(actor, recipe)\n end\n end", "def free_shortcut(shortcut)\n found = false\n alpha_numbers = '1234567890abcdefghijklmnopqrstuvwxyz'\n elements = @parser.find('[accesskey]').list_results\n elements.each do |element|\n shortcuts = element.get_attribute('accesskey').downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, shortcut)\n next\n end\n\n (0..alpha_numbers.length - 1).each do |i|\n key = alpha_numbers[i, i + 1]\n found = true\n elements.each do |element_with_shortcuts|\n shortcuts = element_with_shortcuts.get_attribute(\n 'accesskey'\n ).downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, key)\n next\n end\n\n element.set_attribute('accesskey', key)\n found = false\n break\n end\n break if found\n end\n break if found\n end\n end", "def test_shortcut_register\n uri = N::URI.new(\"http://foo.foo.com/\")\n N::URI.shortcut(:foo, uri.to_s)\n assert_equal(N::FOO, uri)\n assert_kind_of(N::URI, N::FOO)\n end", "def test_it_can_distinguish_i_through_main_menu\n runner = Runner.new\n $stdout = StringIO.new\n input = \"i\"\n result = runner.main_menu_options(input)\n\n assert_equal false, runner.play?(result)\n end", "def kgio_accept()\n #This is a stub, used for indexing\n end", "def set_shortcut\n @shortcut = Shortcut.with_normalized_target(params[:target]).first\n raise ActiveRecord::RecordNotFound.new(\"No Shortcut found with target='#{params[:target]}'\") unless @shortcut\n end", "def add_shortcut(shortcut)\n @shortcuts.push(shortcut) unless @shortcuts.index(shortcut)\n end", "def applicationDidFinishLaunching(notification)\n @hotkeys = HotKeys.new\n\n # Seriously for a second; For some reason a global hotkey or at least \n # the way I've got it to working blocks the keystroke. Which I guess is normal?\n #\n # Maybe I'll hack around that with system events for a bypass option, it wouldn't \n # be elegate, but this is new territory anywho\n #\n @hotkeys.addHotString(\"S+OPTION\") do\n puts \"PRESSED: S+OPTION\"\n end\n\n # Will only trigger if Safari is frontmost application, second option can be left blank\n # for a global shortcut\n @hotkeys.addHotString(\"S+OPTION\", :bundle_identifier => \"com.apple.Safari\") do\n puts \"PRESSED: S+OPTION IN SAFARI TOO\"\n end\n\nend", "def work!(work_item)\n raise NotImplementedError\n end", "def testchoose\n # list filters as you type\n $log.debug \"called CHOOSE \" if $log.debug?\n filter = \"*\"\n filter = ENV['PWD']+\"/*\"\n str = choose filter, :title => \"Files\", :prompt => \"Choose a file: \"\n message \"We got #{str} \"\nend", "def test_defun_command_3\n sum = nil\n##### [my_command3]\n interactive_proc = lambda { [1+1, 1] }\n defun(:my_command3,\n :interactive => interactive_proc) { |a, b|\n sum = a + b\n }\n##### [/my_command3]\n assert_equal nil, sum\n call_interactively :my_command3\n assert_equal 3, sum\n end", "def match_action(action, item)\n action = \"*\" if action == \"all\"\n action == item\n end", "def interact(prompt_id, default, dir = @test_case.folder, &block)\n if @test_case.interactive?\n relative_path = Pathname.new(dir).relative_path_from(Pathname.new(Dir.pwd))\n print \"\\nIn test case: #{relative_path}\"\n return SassSpec::Interactor.interact_with_memory(@@interaction_memory, prompt_id, &block)\n else\n return default\n end\n end", "def test_add_option02c\n assert_raise( RuntimeError ) { \n ArgumentManager.add_option(\n [ 'e' ],\n :bind => :bind\n )\n }\n end", "def notifyShortcutCreate(iSC)\n notifyRegisteredGUIs(:onShortcutCreate, iSC)\n end", "def test_shortcut_accessor\n assert_equal(N::LOCAL, N::URI[:local])\n end", "def test_suggest_word_with_one_word_inserted_and_three_letter_string\n @completion.insert(\"pizza\")\n assert_equal [\"pizza\"], @completion.suggest(\"pi\")\n end", "def enable_kb_shortcuts(user)\n visit edit_user_registration_path\n unless page.find('#user_kb_shortcuts_enabled').checked?\n page.execute_script('$(\"#user_kb_shortcuts_enabled\").click()')\n\n fill_in 'user_current_password', with: user.password\n show_update_account_button\n click_on 'Update account'\n expect(current_path).to eq read_path\n end\n visit read_path unless current_path == read_path\nend", "def register_alias(type, shortcut); end", "def action_want_to_perform(arg)\r\n self.class.actions_allowed[arg]\r\n end", "def test\n @commands_and_opts.push OPTIONAL_OPTS[:test]\n self\n end", "def choose_first_click; end", "def set_shortcut_text\n @shortcut_text = ShortcutText.find(params[:id])\n end", "def action(name, altname=nil, &block) \n Runner.instance.add_action name, altname, &block\n end", "def command_126(*args, &block)\n $game_temp.affix_gain_item_event_flag = true\n marw_command126_8qu7(*args, &block) # Call Original Method\n $game_temp.affix_gain_item_event_flag = false\n end", "def prompt_with_and_then(prompt, items, action)\n choice = `echo \"#{self.send(items)}\" | theme-dmenu -p \"#{prompt}\"`\n if (choice.length > 0)\n out, err, code = Open3.capture3(self.send(action, \"#{mountable_path}/#{choice}\"))\n if (err.length > 0)\n `notify-send -u critical Easymount \"#{err}\"`\n else\n `notify-send Easymount \"#{out}\"`\n end\n end\nend", "def command_use\n puts(\"Use item\")\n end", "def consume (workitem)\n # does nothing and does not reply to the engine.\n end", "def testExactMatch2Actions\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ],\n [ 'DummyTool', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ],\n 'DummyAction2' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def select_item(what)\n item = find_item(what)\n item.click if item\n end", "def macNativeShortcut(element, key)\n\t\tputs key\n\t\tcase key\n\t\twhen 'x'\n\t\t\tputs \"something\"\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar event = new Event('cut', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(event);\n\t\t\t\t\")\n\n\t\twhen 'p'\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar pasteevent = new Event('paste', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(pasteevent);\n\t\t\t\t\")\n\t\tend\n\n\t\telement.native.send_keys [:command, key]\n\tend", "def inventory_shortcut\n (config_params||DEFAULT_CONFIG_PARAMS)[\"Inventory Shortcut\"]\n end", "def open_suggestion(suggestion)\n suggestion.hover\n wait_until { suggestion.hovered? }\n end", "def command_127(*args, &block)\n $game_temp.affix_gain_item_event_flag = true\n marw_command127_8qu7(*args, &block) # Call Original Method\n $game_temp.affix_gain_item_event_flag = false\n end", "def shortcut_params\n params.require(:shortcut).permit(:url, :target)\n end", "def items_shortcut\n (config_params||DEFAULT_CONFIG_PARAMS)[\"Items Shortcut\"]\n end", "def test_method\n prompt('test method')\nend", "def exit_shortcut_not_found(name)\n puts \"Shortcut \\033[1m#{name}\\033[0m not found :(\"\n if Fast.shortcuts.any?\n puts \"Available shortcuts are: #{Fast.shortcuts.keys.join(', ')}.\"\n Fast.load_fast_files!\n end\n exit 1\n end", "def do_special_input_stuff(input)\n case input\n when \"save\"\n save\n []\n when \"reset\"\n puts \"Choose different piece:\"\n \"reset\"\n when \"quit\"\n puts \"QUITTING\"\n exit\n else\n false\n end\n end", "def play_special player\n\t\t\tif @spec_action\n\t\t\t\t@spec_action.call player, self\n\t\t\tend\n\t\t\t\n\t\t\ttrue\n\t\tend", "def test_default\n w = Window_Confirmation.new(0,0,320,nil)\n @windows.push(w)\n return true\n end", "def send_key(keycode, ctrl=false, alt=false, shift=false)\n matchingshortcuts = @shortcuts.select { |shortcut|\n shortcut.keycode == keycode && shortcut.ctrl == ctrl &&\n shortcut.alt == alt && shortcut.shift == shift\n }\n counter = 0\n matchingshortcuts.each { |shortcut|\n action = shortcut.action\n @actions[action].each { |handler|\n handler.call(shortcut)\n counter+=1\n }\n }\n counter\n end", "def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend", "def rl_possible_completions(ignore, invoking_key)\r\n rl_complete_internal('?')\r\n end", "def set_up_file_shortcut\n @up_file_shortcut = UpFileShortcut.find(params[:id])\n end", "def test_comfirm(type, quiz_name, quiz, user_name, time)\r\n clear\r\n test_banner\r\n puts\r\n puts \"Hello, #{user_name}. The #{quiz_name} test of #{type} collections is going to apply.\\n\\nThe test time of answering each question is limited to #{time}s\\n\\n\"\r\n # Provide regret access\r\n options = [\r\n { name: \"Let's get started!!!!\", value: lambda {\r\n test_loop(type, quiz_name, quiz, user_name, time)\r\n } },\r\n { name: 'I want to reset the test', value: lambda {\r\n interface\r\n } }\r\n ]\r\n\r\n option = @prompt.select(\"Please comfirm that you are ready or go back to main menu to run a new test.\\n\\n\",\r\n options, help: \"(Pressing Enter to go back)\\n\\n\", show_help: :always)\r\n end", "def check_unique_shortcut?\n if (not new_record? and Node.where('nodes.shortcut = ? AND nodes.id != ?', shortcut, id).exists?) or (new_record? and Node.exists?(:shortcut => shortcut))\n puts \"Problem Node: (Title: #{title}, ID: #{id} URL: #{shortcut}), new_record: #{new_record?}\"\n addition = Node.where('shortcut LIKE ?', shortcut).count\n suggested = self.shortcut + \"_\" + addition.to_s\n errors.add(:shortcut, \"URL shortcut already exists in this site. Suggested Shortcut: '#{suggested}'\")\n end\n end", "def _on_workitem(wi)\n Ruote.participant_send(\n self, [ :on_workitem, :consume ], 'workitem' => wi)\n end", "def test1ActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [WEACE::Master::TransferFile.new(iTmpFileName)] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n }\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal([], getSlaveClientQueue)\n assert_equal({iTmpFileName => 1}, getTransferFiles)\n end\n end\n end\n end", "def test05_search_repost_note_TC_28838\n\t\trepostNotePop\n\t\tsleep 2\n\t\trepost\n\t\tsleep 2\n\t\t\n\t\t$search_text_field.when_present.set(\"Repost text\")\n\t\t$search_button.click\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Repost text\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T5: FAILED! User unable to locate repost.\"\n\t\tend\n\tend", "def display_shortcut(element)\n # Interface method\n end", "def test_method\n prompt(\"test message\")\nend", "def example_passed(_)\n end", "def allow_in_control=(_arg0); end", "def default_interaction\n Whatever\n end", "def interact\n end", "def test_edit(pid)\n result = super\n if result\n return result\n else\n return test_edit_from_policy(pid)\n end\n end", "def valid_item\n @windows[Win_Help].move_to(2)\n #@windows[Win_Help].show\n @active_battler.current_action.clear\n @active_battler.current_action.set_item(@item.id)\n if @item.for_dead_friend? and !$game_system.actors_bodies? \n if $game_map.passable?(@cursor.x, @cursor.y, 0) and\n (occupied_by?(@cursor.x, @cursor.y) == nil)\n open_revive_window\n end\n else\n @active_battler.current_action.set_item(@item.id)\n @targets = get_targets\n if @targets.empty?\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Item) \n @windows[Win_Status].dmg_preview(3, @active_battler, @item, @targets)\n @windows[Win_Help].move_to(2)\n #@windows[Win_Help].show\n end\n end\n end", "def xit(description, &block)\n @tests[description] = :pending\n end", "def eat(w)\n w.refresh\n text = w.read_text\n return false if text.include?('This is too far')\n\n # Don't know what a kitchen looks like yet. \n if w.click_on 'Consume'\n sleep 5\n w.refresh\n return true\n else\n return false\n end\n end", "def command_128(*args, &block)\n $game_temp.affix_gain_item_event_flag = true\n marw_command128_8qu7(*args, &block) # Call Original Method\n $game_temp.affix_gain_item_event_flag = false\n end", "def switch_to_functional\n return unless ( \n name = path_matcher.controller_name || path_matcher.view_name\n )\n \n test_file = \"/test/functional/#{name}_test.rb\"\n if !file_exists? test_file\n test_file = \"/test/functional/#{name}_controller_test.rb\"\n end\n \n if path_matcher.is_view?\n action = File.basename(file_path).split(\".\").first\n regexp = Regexp.new(action)\n \n candidates = get_tests(test_file).select { |t| t =~ regexp } \n \n if candidates.length > 0\n log \"Jumping to #{test_file}##{candidates.first}\"\n return goto_definition test_file, candidates.first\n end\n \n elsif ( function = find_function_under_cursor )\n # select a candidate to jump tp\n regexp = Regexp.new(function)\n candidates = get_tests(test_file).select { |t| t =~ regexp } \n \n if candidates.length > 0\n log \"Jumping to #{test_file}##{candidates.first}\"\n return goto_definition test_file, candidates.first\n end \n end\n \n open_file test_file\n end", "def ask_bookmark ch=nil\n unless ch\n ch = @window.getchar\n ch = ch.chr.upcase rescue nil\n return unless ch\n end\n str = $bookmarks[ch.to_sym]\n if str\n display_text str\n # set focus to that in the left list\n set_focus_on str\n else\n $message.value = \"No bookmark for #{ch}. Use m to create.\"\n ## No bookmark, jumping to first char \n listb = @form.by_name[\"mylist\"]; \n listb.set_selection_for_char ch\n end\nend", "def test_add_option02d\n assert_raise( RuntimeError ) { \n ArgumentManager.add_option(\n [ 'f' ],\n :bind => 'boolean opt'\n )\n }\n end", "def test_that_it_catches_redefines\r\n x = @s.add_entry('fubar', :word)\r\n assert_raises(XfOOrth::XfOOrthError) { @s.add_entry('fubar', :method) }\r\n end", "def trigger_quit(entered_name)\n entered_name.downcase == \"quit\" || entered_name.downcase == \"q\"\nend", "def testRunActionWithoutUser\n executeSlave(\n [\n '--tool', 'DummyTool',\n '--action', 'DummyAction'\n ],\n :AddRegressionActions => true,\n :Error => WEACE::Slave::Client::CommandLineError\n )\n end", "def click; end", "def click; end", "def click; end", "def hotkey\n @link.HotKey\n end", "def attempt(message, &block)\n perform_action(message, false, @passfail, nil, true, false, &block)\nend", "def get_action(str)\n puts \"Received '#{str.strip}'\" unless @quiet\n ['f','c','r'].choice\n end", "def set_safe_shortcut(desired_shortcut, node_id, increment=0)\n prefix = increment == 0 ? \"\" : increment.to_s + \"-\"\n while Node.where('nodes.shortcut = ? AND nodes.id != ?', prefix + desired_shortcut, node_id).exists?\n increment += 1\n prefix = increment.to_s + \"-\"\n end\n self.shortcut = prefix + desired_shortcut\n return increment\n end", "def command_shortcuts(cmd)\n shortcuts[cmd] \n end", "def content_accept_action_item(text=nil, &block)\n icon = content_tag(:div, '', :class => 'iconAcceptSmall')\n content_action_item(text, icon, &block)\n end", "def test1ActionFileParameter\n # Create a local file name to transfer\n setupTempFile do |iTempFileName|\n executeTest(\n 'DummyUser',\n {\n 'DummyTool' => {\n 'DummyAction' => [\n [ WEACE::Master::TransferFile.new(iTempFileName) ]\n ]\n }\n }\n )\n end\n end", "def click_shortcut(text, seconds = 5)\n\t\t@main_window.click(text)\n\n\t\[email protected](\"Clicked \\\"#{text}\\\" shortcut, waiting #{seconds} seconds for Central window to close...\")\n\t\ttimeout(seconds) do\n\t\t\tsleep 0.2 while running?\n\t\tend\n\tend", "def dwp_work(work_item)\n dwp_log{ \"Working, item: #{work_item.inspect}\" }\n dwp_run_callback('before_work', work_item)\n work!(work_item)\n dwp_run_callback('after_work', work_item)\n end", "def send_keys(*args); end", "def plz_be_quiet\n if find('.ytp-mute-button')['title'] == 'Mute'\n page.find('.ytp-mute-button').click\n puts 'shhh!'\n end\nend", "def accessibilityPerformPress\n select!\n true\n end", "def test_direct\n\t\ttestfn = @playground+'/linktestfile'\n\t\ttestln = @playground+'/linktestlink'\n\t\tCfruby::FileOps.touch testfn\n\t\tassert(File.exist?(testfn))\n\t\t# Test syntax parsing\n\t\tCfruby::Parser.new.links \"#{testln} -> #{testfn}\"\n\t\tassert(File.symlink?(testln))\n\t\tCfruby::FileOps.delete testln\n\t\t# Cleanup\n\t\tCfruby::FileOps.delete testfn\n\tend", "def test_default\n w = Window_Selectable_Implemented.new(0,0,160,128,$data_items.compact)\n @windows.push(w)\n end", "def tests=(_arg0); end", "def tests=(_arg0); end", "def accept=(_arg0); end", "def launch (raw_exp, workitem)\n\n onotify(:launch, raw_exp.fei, workitem)\n\n apply(raw_exp, workitem)\n end", "def check_on_item_use(user,target,item,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Item_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_item_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end", "def click_run_file_dialog_popup(title)\n click_button_popup(title, \"&Run\")\nend", "def test_05_1_show_me_how_TC_24406\n\t\t\n\t\tprofileLogin\n\t\t$browser.goto($patch_note)\n\t\t$help_post_note.when_present.click\n\t\tsleep 4 \n\t\t$browser.window(:title, /Post a Note/).use do\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Post a Note\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"J1_T5.1: FAILED! User unable to navigate to zendesk.\"\n\t\tend\n\t\tend\n\tend", "def find_shortcut(name)\n unless defined? Fast::Shortcut\n require 'fast/shortcut'\n Fast.load_fast_files!\n end\n\n shortcut = Fast.shortcuts[name] || Fast.shortcuts[name.to_sym]\n shortcut || exit_shortcut_not_found(name)\n end", "def menu_ok?\n fail NotImplementedError\n end", "def watch_prompt(ch, stream, data, regex_to_watch)\n\n # the regex can be an array or a single regex -> we force it to always be an array with [*xx]\n if [*regex_to_watch].find { |regex| data =~ regex}\n # prompt, and then send the response to the remote process\n ch.send_data(Capistrano::CLI.password_prompt(data) + \"\\n\")\n else\n # use the default handler for all other text\n Capistrano::Configuration.default_io_proc.call(ch, stream, data)\n end\nend", "def filter_files_by_pattern\n @title = 'Search Results: (Press Esc to cancel)'\n @mode = 'SEARCH'\n if @toggles[:instant_search]\n search_as_you_type\n else\n @patt = readline '/'\n end\nend" ]
[ "0.6379436", "0.62393254", "0.60731393", "0.60169333", "0.59492135", "0.5410678", "0.5377292", "0.5250186", "0.52102816", "0.5125814", "0.51195455", "0.49969402", "0.49882382", "0.49752152", "0.48895246", "0.48823044", "0.48383337", "0.4837686", "0.48165548", "0.4811047", "0.48038816", "0.47895256", "0.47818708", "0.47732106", "0.47395235", "0.4739513", "0.47370613", "0.47353908", "0.4734745", "0.47289583", "0.47278216", "0.47187006", "0.47136933", "0.4707435", "0.4700223", "0.4683985", "0.46786454", "0.46750674", "0.46724343", "0.4659669", "0.46568066", "0.4649386", "0.46492112", "0.46328402", "0.46180564", "0.46138477", "0.46111265", "0.46014157", "0.46001175", "0.46000928", "0.45970175", "0.45957774", "0.45857534", "0.45845163", "0.45821998", "0.45768815", "0.45729372", "0.45664752", "0.45643336", "0.45638013", "0.45597133", "0.4558416", "0.45526937", "0.45504302", "0.45500228", "0.45498535", "0.4548203", "0.4545318", "0.45392364", "0.45390835", "0.4537116", "0.45300728", "0.4514572", "0.4514572", "0.4514572", "0.45137095", "0.45075655", "0.45017788", "0.45012552", "0.44878268", "0.44853163", "0.44851208", "0.44784883", "0.44762775", "0.44752082", "0.44737145", "0.44726923", "0.4468072", "0.44677603", "0.44630176", "0.44630176", "0.44600877", "0.44585475", "0.44541156", "0.4452405", "0.4439368", "0.44379178", "0.44375202", "0.44339934", "0.44300157" ]
0.5083653
11
Test shortcut, alleviates the need to set the workitem before calling dont_thread?, do_not_thread? or do_not_thread.
def _dont_thread?(wi) Ruote.participant_send( self, [ :dont_thread?, :do_not_thread?, :do_not_thread ], 'workitem' => wi) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_not_thread; true; end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def do_not_thread\n\n true\n end", "def do_not_thread\n true\n end", "def do_not_thread\n true\n end", "def do_not_thread\n true\n end", "def do_not_thread(participant, msg)\n\n return false unless participant.respond_to?(:do_not_thread)\n\n if participant.method(:do_not_thread).arity == 0\n participant.do_not_thread\n else\n participant.do_not_thread(Ruote::Workitem.new(msg['workitem']))\n end\n end", "def do_not_thread?(participant, msg)\n\n # :default => false makes participant_send return false if no method\n # were found (else it would raise a NoMethodError)\n\n Ruote.participant_send(\n participant,\n [ :do_not_thread, :do_not_thread?, :dont_thread, :dont_thread? ],\n 'workitem' => Ruote::Workitem.new(msg['workitem']), :default => false)\n end", "def work!(work_item)\n raise NotImplementedError\n end", "def allowing_other_threads; end", "def test_handles_multiple_threads\n threads = CW::Threads.new(self, [:a_thread, :sleep_thread])\n threads.start_threads\n assert threads.threads[0][:thread].is_a? Thread\n assert threads.threads[1][:thread].is_a? Thread\n assert_nil threads.threads[2]\n end", "def thread?\n false\n end", "def with_own_thread()\n true\n end", "def dwp_work(work_item)\n dwp_log{ \"Working, item: #{work_item.inspect}\" }\n dwp_run_callback('before_work', work_item)\n work!(work_item)\n dwp_run_callback('after_work', work_item)\n end", "def test_not_run?(test_case)\n test_case[:exec_status] == 'n'\n end", "def run_default_test(test_proc)\r\n thd = Thread.new do\r\n test_proc.call\r\n end\r\n test_proc.call\r\n thd.join\r\nend", "def test03_CancelFlagNoteComment_TC_24319\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCancelFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS05T03: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def test02_flag_repost_article_TC_24323\n\t\trepostArticlePop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T2: FAILED! User unable to flag post.\"\n\t\tend\n\tend", "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 do_not\n redirect_to(workout_path(@workout), alert: t('.already_done')) if @workout.done?\n redirect_to(workout_path(@workout), alert: t('.already_skipped')) if @workout.skipped?\n @workout.skipped = true\n @workout.weight_before = current_user.latest_weight_before\n end", "def test1ActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [WEACE::Master::TransferFile.new(iTmpFileName)] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n }\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal([], getSlaveClientQueue)\n assert_equal({iTmpFileName => 1}, getTransferFiles)\n end\n end\n end\n end", "def test04_CancelFlagArticleComment_TC_24319\n\t\tcommentArticlePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCancelFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS05T04: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def thread_helper\n PWork::Helpers::Threads\n end", "def test03_flag_repost_event_TC_24323\n\t\trepostEventPop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T3: FAILED! User unable to flag post.\"\n\t\tend\n\tend", "def test1FailActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n lTransferFile = WEACE::Master::TransferFile.new(iTmpFileName)\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [lTransferFile] ]\n ]\n $Context[:DummySenderSendError] = RuntimeError.new('Sending error')\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n },\n :Error => RuntimeError\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal(\n [\n [ 'DummyUser',\n { 'DummyTool' => {\n 'DummyAction' => [\n [lTransferFile]\n ]\n }\n }\n ]\n ],\n getSlaveClientQueue\n )\n assert_equal({iTmpFileName => 2}, getTransferFiles)\n end\n end\n end\n end", "def testRunActionWithoutUser\n executeSlave(\n [\n '--tool', 'DummyTool',\n '--action', 'DummyAction'\n ],\n :AddRegressionActions => true,\n :Error => WEACE::Slave::Client::CommandLineError\n )\n end", "def _test_threads\n m = Mutex.new \n threads = []\n @custom_number_of_users.times do\n threads << Thread.new do\n m.synchronize {threaded_mage_checkout}\n threaded_mage_checkout\n end\n end\n threads.each {|x| x.join}\n end", "def test04_FlagNoteComment\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_success.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS04T04: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def test2ActionsDifferentTools\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ],\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n },\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def trigger_condition_met?(_job)\n true\n end", "def always_run=(_arg0); end", "def simulate_work(time)\n return\n sleep time unless Softcover::test?\n end", "def test_ApplyToAJobWithLinkedInEEOQuestionsDisable\n randomName = SecureRandom.hex(4)\n #PRECONDITIONS\n #Login\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n Common.go_to_social_settings()\n CustomSettings.ApplyToLinkedIn(true)\n \n Common.go_to_parser_settings()\n CustomSettings.DefineResumeAllowedTypesJobBoard(\"pdf\")\n \n CustomSettings.JobBoardLogin(false)\n \n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.displayed(BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.DefineEEOQuestions(false, false, false, false, false)\n \n Common.CreateRequisitionPostJob(randomName, true)\n \n # 1 - Go to Job Board\n $browser.get(HomePage::JOB_BOARD_URL)\n \n # 2 - Apply to a job from the job board site\n $browser.get(HomePage::JOB_BOARD_URL)\n $wait.until{\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\").click\n test = [\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_WITH_LINKEDIN_XPATH},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_APPLY_WITH_LINKEDIN_XPATH}\n ]\n Common.main(test)\n sleep(5)\n newWindow= $browser.window_handles.last\n $browser.switch_to.window(newWindow)\n \n test = [\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_EMAIL_XPATH},\n {\"set_text\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_EMAIL_XPATH, \"text\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_DATA_EMAIL_TEXT},\n {\"set_text\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_PASSWORD_XPATH, \"text\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_DATA_PASSWORD_TEXT},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_BTN_ALLOW_XPATH}\n ]\n Common.main(test)\n $browser.switch_to.window($browser.window_handles.first)\n \n assert $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_LINKEDIN_SUCCESS_DIALOG_XPATH).displayed?\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_LINKEDIN_SUCCESS_DIALOG_XPATH).text == \"Your application for the \"+ randomName +\" position was submitted successfully.\"\n }\n end", "def test05_CancelFlagMediaComment_TC_24319\n\t\tcommentMediaPop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCancelFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS05T05: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def test1PrepareFailActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n lTransferFile = WEACE::Master::TransferFile.new(iTmpFileName)\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [lTransferFile] ]\n ]\n $Context[:DummySenderPrepareError] = RuntimeError.new('Preparing error')\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n },\n :Error => RuntimeError\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal(\n [\n [ 'DummyUser',\n { 'DummyTool' => {\n 'DummyAction' => [\n [lTransferFile]\n ]\n }\n }\n ]\n ],\n getSlaveClientQueue\n )\n assert_equal({iTmpFileName => 2}, getTransferFiles)\n end\n end\n end\n end", "def ignore_force?(task)\n !(metadata[\"run_#{task}\"].nil? || metadata[\"run_#{task}\"])\n end", "def test_05_1_show_me_how_TC_24406\n\t\t\n\t\tprofileLogin\n\t\t$browser.goto($patch_note)\n\t\t$help_post_note.when_present.click\n\t\tsleep 4 \n\t\t$browser.window(:title, /Post a Note/).use do\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Post a Note\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"J1_T5.1: FAILED! User unable to navigate to zendesk.\"\n\t\tend\n\t\tend\n\tend", "def test02_pre_open_blog_CancelFlagArticleComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_article_to_edit)\n\t\t\n\t\tsleep 4\n\t\tcommentCancelFlag\n\t\t\n\t\tassert $comment_flag_link.exists?\n\tend", "def action_hook?(self_only = T.unsafe(nil)); end", "def test_collision\n\n pdef = Ruote.process_definition do\n concurrence do\n echo 'a'\n echo 'b'\n end\n end\n\n wfid = @dashboard0.launch(pdef)\n\n replies = []\n\n while replies.size < 2\n\n msg = @dashboard0.next_msg\n\n if msg['action'] == 'reply'\n replies << msg\n else\n @dashboard0.do_process(msg)\n end\n end\n\n replies.sort! { |a, b| a['put_at'] <=> b['put_at'] }\n\n #replies.each { |r| p r }\n\n t0 = Thread.new { @dashboard1.do_process(replies[0]) }\n t1 = Thread.new { @dashboard0.do_process(replies[1]) }\n t0.join\n t1.join\n\n msgs = @dashboard0.gather_msgs\n\n assert_equal 1, msgs.size, 'exactly 1 message was expected'\n\n msg = msgs.first\n\n assert_equal 'reply', msg['action']\n assert_equal '0', msg['fei']['expid']\n end", "def __dummy_test__\n end", "def test_a_few_nonfunctional_cases\n run_test_as('wizard') do\n assert_equal 0, simplify(command(%Q|; fork (0); suspend(0); endfork|))\n send_string %Q|; kill_task(task_id());|\n end\n end", "def testRunActionWithoutTool\n executeSlave(\n [\n '--user', 'DummyUser',\n '--action', 'DummyAction'\n ],\n :AddRegressionActions => true,\n :Error => WEACE::Slave::Client::CommandLineError\n )\n end", "def testWaitingActionsOnHold\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n $Context[:DummySenderSendError] = RuntimeError.new('Sending error')\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser2' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddSlaveClientQueues => {\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ]\n } => [\n [ 'DummyUser1',\n {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n }\n ]\n ]\n },\n :Error => RuntimeError\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser1', {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal(\n [\n [ 'DummyUser1',\n { 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n }\n ],\n [ 'DummyUser2',\n { 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n }\n ]\n ],\n getSlaveClientQueue\n )\n end\n end\n end", "def sticky?() end", "def test_second_take\n\n @dashboard.register_participant :troublemaker, TroubleMaker\n\n pdef = Ruote.define do\n define 'sub0' do\n set '__on_error__' => 'redo'\n end\n sequence :on_error => 'sub0' do\n troublemaker\n end\n end\n\n wfid = @dashboard.launch(pdef)\n r = @dashboard.wait_for(wfid)\n\n assert_equal 'terminated', r['action']\n assert_equal 3, r['workitem']['fields']['_trace'].size\n end", "def test02_FlagEventComment_TC_24319\n\t\tcommentEventPop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_success.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS05T02: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def test05_NoteTwoComments_TC_24319\n\t\tcommentNotePop\n\t\tcommentPopSubmit\n\tend", "def test_cyclic\n end", "def default_fail_queue_target\n false\n end", "def setup\r\n\r\n # Save the Global variable's original settings so that they can be changed in this\r\n # test without affecting other test, so long as they are restored by teardown\r\n @@VERBOSE_ORIG = $VERBOSE\r\n @@DEBUG_ORIG = $DEBUG\r\n @@FAST_SPEED_ORIG = $FAST_SPEED\r\n @@HIDE_IE_ORIG = $HIDE_IE\r\n\r\n # Record the time that current test case starts\r\n @@tTestCase_StartTime = Time.now\r\n\r\n # Start a new Logger Object and assign it to a Global Object\r\n #\r\n # Using the default values:\r\n # Create a \"waitr_works/results\" directory within the OS's Temporary directory\r\n # That directory will contain the single log file used for all tests.\r\n # If the current log file gets too big, output rolls to another log file.\r\n if(@@bLogOutput == true)\r\n $logger = capture_results()\r\n end\r\n\r\n # Hide the annoying console window so that it doesn't cover any of the screen\r\n minimize_ruby_console()\r\n\r\n # Record the test environment if it hasen't already been recorded\r\n if($bEnvironmentRecorded != true)\r\n $bEnvironmentRecorded = record_environment()\r\n @@bContinue = $bEnvironmentRecorded\r\n end\r\n\r\n # Open the Workbook containing the data for the test cases,\r\n # and read the data into memory if it hasen't already been read\r\n if((@@bContinue == true) and ($bDataSetRead != true))\r\n #$bDataSetRead = read_dataset()\r\n @@bContinue = $bDataSetRead\r\n end\r\n\r\n # Open a browser and access the site if it hasen't already been recorded\r\n #if((@@bContinue == true) and ($bWebSiteAccessed != true))\r\n\r\n $browser = start_browser($sDefaultBrowser)\r\n #$browser.goto(\"www.ask.com\")\r\n\r\n #$bWebSiteAccessed = access_dishonline()\r\n @@bContinue = $bWebSiteAccessed\r\n #end\r\n\r\n\r\n\r\n end", "def non_blocking?()\n #This is a stub, used for indexing\n end", "def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend", "def test_RolloverDifferentQuestionSets\n randomName = \"a\" + SecureRandom.hex(4)\n randomName2 = \"a\" + SecureRandom.hex(4)\n randomQS = SecureRandom.hex(4)\n randomQS2 = SecureRandom.hex(4)\n randomContact = SecureRandom.hex(4)\n randomContact2 = SecureRandom.hex(4)\n \n #PRECONDITIONS\n #Login\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n Common.go_to_custom_settings\n CustomSettings.EnableEnhancedApplyToJob(true)\n \n Common.CreateQuestionSetEmpty(randomQS)\n \n Common.CreateQuestionSetEmpty(randomQS2)\n \n Common.CreateRequisitionPostJob(randomName, true, false, randomQS)\n \n Common.CreateRequisitionPostJob(randomName2, true, false, randomQS2)\n \n #Must have several accounts\n Common.CreateAccount(randomContact) \n \n #Must have several contacs\n Common.CreateContact(randomContact, randomContact)\n \n #Must have several accounts\n Common.CreateAccount(randomContact2) \n \n #Must have several contacs\n Common.CreateContact(randomContact2, randomContact2)\n \n # Application was moved to any further stage: Submittal, Interview, Offer or Placement.\n \n Common.goToTab(HomePage::CONTACTS_TAB_LINK_XPATH)\n \n test = [\n {\"displayed\" => ContactsHomePage::CONTACT_HOME_VIEW_SELECT_XPATH},\n {\"set_text\" => ContactsHomePage::CONTACT_HOME_VIEW_SELECT_XPATH, \"text\" => \"CRM Contacts - All\"},\n {\"click_and_load\" => ContactsHomePage::CONTACT_HOME_BTN_GO_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_HOME_CONTACT_LIST_XPATH}\n ]\n Common.main(test)\n \n # Select a Candidate\n $browser.find_element(:xpath => ContactsHomePage::CONTACT_HOME_CONTACT_LIST_XPATH + \"//*[text()[contains(.,'\" + randomContact + \"')]]/../../../..//td[1]//input\").click\n \n # Select a Candidate\n $browser.find_element(:xpath => ContactsHomePage::CONTACT_HOME_CONTACT_LIST_XPATH + \"//*[text()[contains(.,'\" + randomContact2 + \"')]]/../../../..//td[1]//input\").click\n \n # Click on \"Apply to jobs\"\n Common.click(ContactsHomePage::CONTACT_HOME_APPLY_TO_JOB_XPATH)\n sleep(2)\n #A pop up window will be disaplyed\n newWindow= $browser.window_handles.last\n $browser.switch_to.window(newWindow)\n \n sleep(2)\n \n test = [\n # Select a job\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_JOB_TITLE_XPATH},\n {\"set_text\" => ContactsHomePage::CONTACT_JOB_POPUP_JOB_TITLE_XPATH, \"text\" => randomName},\n #Click \"Next\" \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_BTN_NEXT_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_RADIO_INVITE_XPATH},\n # Click on Exception \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_RADIO_EXCEP_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_REASON_XPATH},\n # Select Referral in picklist \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_REASON_OTHER_OPTION_XPATH},\n {\"set_text\" => ContactsHomePage::CONTACT_JOB_POPUP_REASON_OTHER_XPATH, \"text\" => \"some text\"},\n # Click \"Save\" \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_SAVE_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_TOTAL_APP_XPATH},\n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_BTN_CLOSE_XPATH} \n ]\n Common.main(test)\n \n newWindow2= $browser.window_handles.first\n $browser.switch_to.window(newWindow2)\n \n # 1 - Click on \"Requisitions\"\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n \n test= [\n {\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_LIST_XPATH}\n ]\n Common.main(test)\n sleep(3)\n \n test= [\n # 2 - Select a Job Order \n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\"},\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_DETAIL_BTN_ROLLOVER_CONTACTS_XPATH},\n # 3 - Click on \"Rollover Contacts\" \n {\"click\" => RequisitionsDetail::REQUISITIONS_DETAIL_BTN_ROLLOVER_CONTACTS_XPATH},\n ]\n Common.main(test)\n \n sleep(2)\n newWindow3= $browser.window_handles.last\n $browser.switch_to.window(newWindow3)\n sleep(2)\n \n test= [\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_JOB_INPUT_XPATH},\n # 4 - Select another job order that fits the preconditions \n {\"set_text\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_JOB_INPUT_XPATH, \"text\" => randomName2},\n # 5 - Click on \"Rollover\" \n {\"click\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_BTN_ROLLOVER_XPATH},\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_MSG_CELL_XPATH}\n ]\n Common.main(test)\n sleep(3)\n # RESULT \n # A message stating that Rollover is impossible and prompt to apply contacts to the selected job order will be displayed.\n assert_equal(RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_MSG_WARNING_TEXT, $browser.find_element(:xpath, RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_MSG_CELL_XPATH).text)\n \n $browser.close\n \n newWindow9= $browser.window_handles.first\n $browser.switch_to.window(newWindow9)\n \n end", "def test05_FlagArticleComment\n\t\tcommentArticlePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_success.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS04T05: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def default_fail_queue_target\n true\n end", "def test02_R1_disappointed_TC_24423\n\t\t@msg = \"The office isn't open at 3 AM! I am disappointed times #{random}!!\"\n\t\t$browser.goto($patch_login)\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_directory_listing)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n\t\tsleep 3\n\t\t$business_review_disappointed.click\n\t\tsleep 2\n\t\t$business_review_text.set(@msg)\n\t\t$business_review_post.fire_event(\"onclick\")\n\n\t\tsleep 2\n\t\tassert $browser.text.include? \"#{@msg}\"\n\t\tassert $browser.text.include? \"disappointed times\"\n\n\tend", "def default_test; end", "def ignore_task?(task)\n why_ignore(task) != :execute\n end", "def testWaitingActions\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser2' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddSlaveClientQueues => {\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ]\n } => [\n [ 'DummyUser1',\n {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n }\n ]\n ]\n }\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser1', {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n } ]\n ],\n [ 'sendMessage', [ 'DummyUser2', {\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def default_test\r\n end", "def running?; !!@thread end", "def defuseForThread! thread\n return unless request = @threadIdx[thread]\n\n if request.respond_to? :each\n\trequest.each { |r| r.defuse! }\n else\n\trequest.defuse!\n end\n end", "def test04_flag_repost_media_TC_24323\n\t\trepostMediaPop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T4: FAILED! User unable to flag post.\"\n\t\tend\n\tend", "def reply (workitem)\n\n unschedule_timeout(workitem)\n\n super\n end", "def testNoAction\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal(nil, $Variables[:DummySenderCalls])\n end\n end", "def thread_safe?\n false\n end", "def test05_post_open_news_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_note)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\tassert $comment_flag_success.exists?\n\tend", "def test_refute\r\n a = false\r\n refute a\r\n end", "def should_be_notified\n @should_be_notified ||= true\n end", "def default_fail_queue_target\n true\n end", "def testExactDifference2Actions\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool2', 'DummyAction', [] ],\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal(nil, $Variables[:DummySenderCalls])\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def test_RolloverSameQuestionSets\n randomName = \"a\" + SecureRandom.hex(4)\n randomName2 = \"a\" + SecureRandom.hex(4)\n randomQS = SecureRandom.hex(4)\n randomContact = SecureRandom.hex(4)\n randomContact2 = SecureRandom.hex(4)\n \n #PRECONDITIONS\n #Login\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n Common.go_to_custom_settings\n CustomSettings.EnableEnhancedApplyToJob(true)\n \n Common.CreateQuestionSetEmpty(randomQS)\n \n Common.CreateRequisitionPostJob(randomName, true, false, randomQS)\n \n Common.CreateRequisitionPostJob(randomName2, true, false, randomQS)\n \n #Must have several accounts\n Common.CreateAccount(randomContact) \n \n #Must have several contacs\n Common.CreateContact(randomContact, randomContact)\n \n #Must have several accounts\n Common.CreateAccount(randomContact2) \n \n #Must have several contacs\n Common.CreateContact(randomContact2, randomContact2)\n \n # Application was moved to any further stage: Submittal, Interview, Offer or Placement.\n \n Common.goToTab(HomePage::CONTACTS_TAB_LINK_XPATH)\n \n test = [\n {\"displayed\" => ContactsHomePage::CONTACT_HOME_VIEW_SELECT_XPATH},\n {\"set_text\" => ContactsHomePage::CONTACT_HOME_VIEW_SELECT_XPATH, \"text\" => \"CRM Contacts - All\"},\n {\"click_and_load\" => ContactsHomePage::CONTACT_HOME_BTN_GO_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_HOME_CONTACT_LIST_XPATH}\n ]\n Common.main(test)\n \n # Select a Candidate\n $browser.find_element(:xpath => ContactsHomePage::CONTACT_HOME_CONTACT_LIST_XPATH + \"//*[text()[contains(.,'\" + randomContact + \"')]]/../../../..//td[1]//input\").click\n \n # Select a Candidate\n $browser.find_element(:xpath => ContactsHomePage::CONTACT_HOME_CONTACT_LIST_XPATH + \"//*[text()[contains(.,'\" + randomContact2 + \"')]]/../../../..//td[1]//input\").click\n \n # Click on \"Apply to jobs\"\n Common.click(ContactsHomePage::CONTACT_HOME_APPLY_TO_JOB_XPATH)\n sleep(3)\n #A pop up window will be disaplyed\n newWindow= $browser.window_handles.last\n $browser.switch_to.window(newWindow)\n \n sleep(4)\n \n test = [\n # Select a job\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_JOB_TITLE_XPATH},\n {\"set_text\" => ContactsHomePage::CONTACT_JOB_POPUP_JOB_TITLE_XPATH, \"text\" => randomName},\n #Click \"Next\" \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_BTN_NEXT_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_RADIO_INVITE_XPATH},\n # Click on Exception \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_RADIO_EXCEP_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_REASON_XPATH},\n # Select Referral in picklist \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_REASON_OTHER_OPTION_XPATH},\n {\"set_text\" => ContactsHomePage::CONTACT_JOB_POPUP_REASON_OTHER_XPATH, \"text\" => \"some text\"},\n # Click \"Save\" \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_SAVE_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_TOTAL_APP_XPATH},\n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_BTN_CLOSE_XPATH} \n ]\n Common.main(test)\n \n newWindow2= $browser.window_handles.first\n $browser.switch_to.window(newWindow2)\n sleep(2)\n # 1 - Click on \"Requisitions\"\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n \n test= [\n {\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_LIST_XPATH}\n ]\n Common.main(test)\n sleep(4)\n # 2 - Select a Job Order\n $browser.find_element(:xpath => RequisitionsHomePage::REQUISITIONS_PAGE_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\").click\n \n test= [\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_DETAIL_BTN_ROLLOVER_CONTACTS_XPATH},\n # 3 - Click on \"Rollover Contacts\" \n {\"click\" => RequisitionsDetail::REQUISITIONS_DETAIL_BTN_ROLLOVER_CONTACTS_XPATH},\n ]\n Common.main(test)\n \n sleep(2)\n newWindow3= $browser.window_handles.last\n $browser.switch_to.window(newWindow3)\n sleep(2)\n \n test= [\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_JOB_INPUT_XPATH},\n # 4 - Select another job order that fits the preconditions \n {\"set_text\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_JOB_INPUT_XPATH, \"text\" => randomName2},\n # 5 - Click on \"Rollover\" \n {\"click\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_BTN_ROLLOVER_XPATH},\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_MSG_CELL_XPATH}\n ]\n Common.main(test)\n sleep(3)\n # RESULT \n # New applications will be created for selected job order, they will have the same status, stage and prescreen as applications from original job order. Message will be displayed.\n assert_equal(RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_MSG_SUCCESS_TEXT, $browser.find_element(:xpath, RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_MSG_CELL_XPATH).text)\n \n Common.click(RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_BTN_OK_XPATH)\n \n \n newWindow9= $browser.window_handles.first\n $browser.switch_to.window(newWindow9)\n \n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n \n test= [\n {\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_LIST_XPATH}\n ]\n Common.main(test)\n sleep(3)\n Common.click_and_load(RequisitionsHomePage::REQUISITIONS_PAGE_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName2 + \"')]]\")\n \n test= [\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_DETAIL_APP_LIST_XPATH}\n ]\n Common.main(test)\n \n currentUrl = $browser.current_url\n \n test= [\n {\"click_and_load\" => RequisitionsDetail::REQUISITIONS_DETAIL_FIRST_APP_LIST_XPATH},\n {\"displayed\" => ApplicationsDetailPage::APP_DETAIL_APP_STATUS_XPATH}\n ]\n Common.main(test)\n \n assert_equal(\"New\", $browser.find_element(:xpath, ApplicationsDetailPage::APP_DETAIL_STATUS_XPATH).text)\n assert_equal(\"Application\", $browser.find_element(:xpath, ApplicationsDetailPage::APP_DETAIL_OVERALL_STAGE_XPATH).text)\n \n $browser.get(currentUrl)\n \n test= [\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_DETAIL_APP_LIST_XPATH}\n ]\n Common.main(test)\n \n currentUrl = $browser.current_url\n \n test= [\n {\"click_and_load\" => RequisitionsDetail::REQUISITIONS_DETAIL_SECOND_APP_LIST_XPATH},\n {\"displayed\" => ApplicationsDetailPage::APP_DETAIL_APP_STATUS_XPATH}\n ]\n Common.main(test)\n \n assert_equal(\"New\", $browser.find_element(:xpath, ApplicationsDetailPage::APP_DETAIL_STATUS_XPATH).text)\n assert_equal(\"Application\", $browser.find_element(:xpath, ApplicationsDetailPage::APP_DETAIL_OVERALL_STAGE_XPATH).text)\n \n #$browser.switch_to.window($browser.window_handles.last)\n #$browser.close\n \n #$browser.switch_to.window($browser.window_handles.last)\n #$browser.close\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 run(*args) #:nodoc:\n return if @method_name == \"default_test\"\n super\n end", "def test_inexistent_shortcut\n assert_equal(nil, N::URI.new(\"http://noshortcut/\").my_shortcut)\n end", "def test_disabled?\n ENV['NO_TEST'] == '1'\nend", "def test_disabled?\n ENV['NO_TEST'] == '1'\nend", "def testShortcut\n execute_Deliver_WithConf({\n :WaveFiles => { :FilesList => [ { :Name => 'Wave1.wav' } ] },\n :Mix => { 'Mix1' => { :Tracks => { 'Wave1.wav' => {} } } },\n :Deliver => {\n :Formats => {\n 'Test' => {\n :FileFormat => 'Wave'\n }\n },\n :Deliverables => {\n 'Deliverable' => {\n :Mix => 'Mix1',\n :Format => 'Test'\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Mixed_Wave1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert_wave_lnk '01_Source/Wave/Wave1', '06_Deliver/Deliverable/Track.wav'\n end\n end", "def testRun2ActionsSameToolDifferentProducts\n executeSlave(\n [\n '--user', 'DummyUser',\n '--tool', 'DummyTool4',\n '--action', 'DummyAction4'\n ],\n :AddRegressionActions => true,\n :Repository => 'Dummy/AllDummyActionsAvailable'\n ) do |iError|\n assert_equal('DummyUser', $Variables[:DummyAction4_User])\n assert_equal(true, $Variables[:DummyAction4_DummyProduct])\n assert_equal(true, $Variables[:DummyAction4_DummyProduct2])\n end\n end", "def lock_windows(menu_item)\n Configuration.windows_locked ? menu_item.title = :lock_windows._ : menu_item.title = :unlock_windows._\n\n Configuration.windows_locked = !Configuration.windows_locked\n end", "def test_nothing\n end", "def testRun2ActionsDifferentToolsDifferentProducts\n executeSlave(\n [\n '--user', 'DummyUser',\n '--tool', 'DummyTool',\n '--action', 'DummyAction',\n '--tool', 'DummyTool3',\n '--action', 'DummyAction3'\n ],\n :AddRegressionActions => true,\n :Repository => 'Dummy/AllDummyActionsAvailable'\n ) do |iError|\n assert_equal('DummyUser', $Variables[:DummyAction_User])\n assert_equal('DummyUser', $Variables[:DummyAction3_User])\n end\n end", "def test_nothing\n end", "def running_test_case; end", "def test05_post_closed_news_NoNoteRepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepost \"\" #No note\n \t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend", "def thread()\n #This is a stub, used for indexing\n end", "def sync_exec_required?\n Thread.current != DisplayProxy.thread\n end", "def test2ActionsDifferentTools\n executeTest(\n 'DummyUser',\n {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n },\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n }\n )\n end", "def testMissingComment\n setupTest do |iTasksFileName, iTicketsFileName|\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ],\n :Error => WEACE::MissingVariableError\n )\n end\n end", "def open_fertility_tests\n touch \"* marked:'Fertility testing and workup'\"\n end", "def test_that_it_is_thread_safe\r\n start_syms = ['aaa0000000', 'bbb0000000', 'ccc0000000', 'ddd0000000',\r\n 'eee0000000', 'fff0000000', 'ggg0000000', 'hhh0000000',\r\n 'iii0000000', 'jjj0000000', 'kkk0000000', 'lll0000000',\r\n 'mmm0000000', 'nnn0000000', 'ppp0000000', 'qqq0000000']\r\n threads = []\r\n \r\n start_syms.each do |sym|\r\n threads << Thread.new(sym) do |x|\r\n (1000).times do\r\n @s.add_entry(x, :word)\r\n x = x.succ\r\n end\r\n end \r\n end\r\n \r\n threads.each {|t| t.join }\r\n \r\n assert_equal(@s.fwd_count, @s.rev_count)\r\n end", "def test_marked\n end", "def message\n 'Background used with only one test'\n end", "def test_ApplyToAJobWithLinkedInEEOQuestionsEnable\n randomName = \"0\" + SecureRandom.hex(4)\n #PRECONDITIONS\n #Login\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n Common.go_to_social_settings()\n CustomSettings.ApplyToLinkedIn(true)\n \n Common.go_to_parser_settings()\n CustomSettings.DefineResumeAllowedTypesJobBoard(\"pdf\")\n \n CustomSettings.JobBoardLogin(false)\n \n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.displayed(BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.DefineEEOQuestions(true, true, true, true, false)\n \n Common.CreateRequisitionPostJob(randomName, true)\n \n # 1 - Go to Job Board\n $browser.get(HomePage::JOB_BOARD_URL)\n \n # 2 - Apply to a job from the job board site\n $browser.get(HomePage::JOB_BOARD_URL)\n $wait.until{\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\").click\n test = [\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_WITH_LINKEDIN_XPATH},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_APPLY_WITH_LINKEDIN_XPATH}\n ]\n Common.main(test)\n sleep(5)\n newWindow= $browser.window_handles.last\n $browser.switch_to.window(newWindow)\n \n test = [\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_EMAIL_XPATH},\n {\"set_text\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_EMAIL_XPATH, \"text\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_DATA_EMAIL_TEXT},\n {\"set_text\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_PASSWORD_XPATH, \"text\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_DATA_PASSWORD_TEXT},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_LINKEDIN_BTN_ALLOW_XPATH}\n ]\n Common.main(test)\n $browser.switch_to.window($browser.window_handles.first)\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_EEO_QUESTIONS_GENDER_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_EEO_QUESTIONS_BTN_SUBMIT_XPATH).click\n assert $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_LINKEDIN_SUCCESS_MSG_XPATH).displayed?\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_LINKEDIN_SUCCESS_MSG_XPATH).text == \"Your application for the \"+ randomName +\" position was submitted successfully.\"\n }\n end", "def test_collision\n\n pdef = Ruote.process_definition do\n concurrence do\n iterator :on => (1..10).to_a, :tag => 'it' do\n echo '${v:i}'\n end\n sequence do\n sequence do\n stop :ref => 'it'\n end\n end\n end\n end\n\n wfid = @dashboard0.launch(pdef)\n\n stop_msg = nil\n\n loop do\n m = @dashboard0.next_msg\n if m['command']\n stop_msg = m\n break\n end\n @dashboard0.do_process(m)\n end\n\n assert_equal 'stop', stop_msg['command'].first\n assert_equal '0_0_0', stop_msg['fei']['expid']\n\n msg = @dashboard0.next_msg\n\n t0 = Thread.new { @dashboard1.do_process(stop_msg) }\n t1 = Thread.new { @dashboard0.do_process(msg) }\n t0.join\n t1.join\n\n loop do\n m = @dashboard0.next_msg\n break if m['action'] == 'terminated'\n @dashboard0.do_process(m)\n end\n\n assert_equal \"1\\n2\", @tracer0.to_s\n assert_equal '', @tracer1.to_s\n end", "def multi_threaded?\n !@single_threaded\n end", "def multi_threaded?\n !@single_threaded\n end", "def explain_false(task); end" ]
[ "0.63700503", "0.63700503", "0.63700503", "0.60720485", "0.60569835", "0.6045292", "0.6045292", "0.5916683", "0.5628588", "0.5460189", "0.54113245", "0.5293728", "0.528961", "0.5265767", "0.5254842", "0.5206723", "0.5185462", "0.505428", "0.5046881", "0.50449824", "0.5035791", "0.500487", "0.4996044", "0.4994651", "0.4973492", "0.49701312", "0.49648437", "0.49537796", "0.49395376", "0.49168798", "0.48929608", "0.4892127", "0.48782903", "0.48643512", "0.48614812", "0.4849543", "0.48320365", "0.48320055", "0.48299068", "0.48276967", "0.48169944", "0.48139125", "0.48122796", "0.4810684", "0.4801239", "0.4797417", "0.47768947", "0.47731137", "0.47682148", "0.47657824", "0.47645178", "0.47623178", "0.47607592", "0.47604203", "0.4757818", "0.4755128", "0.47523448", "0.47421047", "0.47393173", "0.47365427", "0.47276223", "0.4722148", "0.47208822", "0.4712145", "0.47070312", "0.47046274", "0.46998692", "0.4698874", "0.4696619", "0.46951583", "0.4686189", "0.4680835", "0.46785215", "0.4676209", "0.4673807", "0.46673796", "0.4663864", "0.46635514", "0.46635514", "0.4649519", "0.4647994", "0.46477592", "0.46457458", "0.464522", "0.46363297", "0.46355608", "0.46307957", "0.4630236", "0.4629063", "0.46244702", "0.46228963", "0.46221653", "0.46213925", "0.46189123", "0.46180877", "0.4616458", "0.46103346", "0.4610311", "0.4610311", "0.46058252" ]
0.64119935
0
Test shortcut, alleviates the need to set the workitem before calling rtimeout.
def _rtimeout(wi) Ruote.participant_send(self, :rtimeout, 'workitem' => wi) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_shortcut\n N::Namespace.shortcut(:xyshortcut, \"http://xyz/\")\n assert_equal(:xyshortcut, N::URI.new(\"http://xyz/\").my_shortcut)\n end", "def testShortcut\n execute_Deliver_WithConf({\n :WaveFiles => { :FilesList => [ { :Name => 'Wave1.wav' } ] },\n :Mix => { 'Mix1' => { :Tracks => { 'Wave1.wav' => {} } } },\n :Deliver => {\n :Formats => {\n 'Test' => {\n :FileFormat => 'Wave'\n }\n },\n :Deliverables => {\n 'Deliverable' => {\n :Mix => 'Mix1',\n :Format => 'Test'\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Mixed_Wave1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert_wave_lnk '01_Source/Wave/Wave1', '06_Deliver/Deliverable/Track.wav'\n end\n end", "def test_inexistent_shortcut\n assert_equal(nil, N::URI.new(\"http://noshortcut/\").my_shortcut)\n end", "def test_shortcuts\n N::URI.shortcut(:at_least_one, \"http://atleast.com\")\n N::URI.shortcut(:at_least_two, \"http://atleasttwo.com\")\n assert(N::URI.shortcuts.size > 1, \"There should be at least two shortcuts\")\n assert(N::URI.shortcuts.keys.include?(:at_least_one))\n assert(N::URI.shortcuts.keys.include?(:at_least_two))\n end", "def test_illegal_shortcuts\n N::URI.shortcut(:illegal_short, \"http://illegal.shortcut.com/\")\n assert_raises(NameError) { N::URI.shortcut(:illegal_short, \"xxx\") }\n assert_raises(NameError) { N::URI.shortcut(:legal_short, \"http://illegal.shortcut.com/\")}\n end", "def test05_search_repost_note_TC_28838\n\t\trepostNotePop\n\t\tsleep 2\n\t\trepost\n\t\tsleep 2\n\t\t\n\t\t$search_text_field.when_present.set(\"Repost text\")\n\t\t$search_button.click\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Repost text\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T5: FAILED! User unable to locate repost.\"\n\t\tend\n\tend", "def click_shortcut(text, seconds = 5)\n\t\t@main_window.click(text)\n\n\t\[email protected](\"Clicked \\\"#{text}\\\" shortcut, waiting #{seconds} seconds for Central window to close...\")\n\t\ttimeout(seconds) do\n\t\t\tsleep 0.2 while running?\n\t\tend\n\tend", "def change_shortcut(slot_id, actor, recipe)\n if actor.nil? || recipe.nil?\n @cooking_shortcuts[slot_id].clear \n else\n @cooking_shortcuts[slot_id].shortcut(actor, recipe)\n end\n end", "def reply (workitem)\n\n unschedule_timeout(workitem)\n\n super\n end", "def free_shortcut(shortcut)\n found = false\n alpha_numbers = '1234567890abcdefghijklmnopqrstuvwxyz'\n elements = @parser.find('[accesskey]').list_results\n elements.each do |element|\n shortcuts = element.get_attribute('accesskey').downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, shortcut)\n next\n end\n\n (0..alpha_numbers.length - 1).each do |i|\n key = alpha_numbers[i, i + 1]\n found = true\n elements.each do |element_with_shortcuts|\n shortcuts = element_with_shortcuts.get_attribute(\n 'accesskey'\n ).downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, key)\n next\n end\n\n element.set_attribute('accesskey', key)\n found = false\n break\n end\n break if found\n end\n break if found\n end\n end", "def set_shortcut\n @shortcut = Shortcut.with_normalized_target(params[:target]).first\n raise ActiveRecord::RecordNotFound.new(\"No Shortcut found with target='#{params[:target]}'\") unless @shortcut\n end", "def set_timedout_flag (workitem)\n\n workitem.attributes['__timed_out__'] = 'true'\n end", "def test_second_take\n\n @dashboard.register_participant :troublemaker, TroubleMaker\n\n pdef = Ruote.define do\n define 'sub0' do\n set '__on_error__' => 'redo'\n end\n sequence :on_error => 'sub0' do\n troublemaker\n end\n end\n\n wfid = @dashboard.launch(pdef)\n r = @dashboard.wait_for(wfid)\n\n assert_equal 'terminated', r['action']\n assert_equal 3, r['workitem']['fields']['_trace'].size\n end", "def cwWatchExecute(watchCommand,resBuffer,resBufferSize,wantResult,timtimeout=10.0)\r\n begin\r\n Timeout::timeout(timtimeout) { \r\n res = eval(watchCommand).to_s + \"\\000\"\r\n cwSetWatchResult(resBuffer,resBufferSize,res.to_s) if(wantResult && resBuffer.to_i!=0)\r\n return true\r\n }\r\n rescue Exception => e\r\n res = e.class.to_s + \"\\000\"\r\n cwSetWatchResult(resBuffer,resBufferSize,res.to_s) if(resBuffer.to_i!=0)\r\n return false\r\n end\r\nend", "def open_suggestion(suggestion)\n suggestion.hover\n wait_until { suggestion.hovered? }\n end", "def schedule_timeout (workitem, timeout_attname=:timeout)\n\n determine_timeout(workitem, timeout_attname)\n to_reschedule(get_scheduler)\n end", "def exit_shortcut_not_found(name)\n puts \"Shortcut \\033[1m#{name}\\033[0m not found :(\"\n if Fast.shortcuts.any?\n puts \"Available shortcuts are: #{Fast.shortcuts.keys.join(', ')}.\"\n Fast.load_fast_files!\n end\n exit 1\n end", "def test_link_tab(link, expected_title = nil, expected_url = nil)\n wait = Selenium::WebDriver::Wait.new(timeout: 3)\n \n #Open link\n js_scroll_up(link)\n link.click\n $test_driver.switch_to.window( $test_driver.window_handles.last )\n #Test it for URL or title\n begin\n if expected_title == nil\n wait.until { $test_driver.current_url.downcase.include? expected_url.downcase }\n elsif expected_url == nil\n wait.until { $test_driver.title.include? expected_title }\n else\n fail(\"Did not specify expected title or expected url\")\n end\n #Print detalied error message\n rescue Selenium::WebDriver::Error::TimeOutError\n if expected_title == nil\n fail(\"Expected URL did not include \" + expected_url + \", was instead: \" + $test_driver.current_url)\n elsif expected_url == nil\n fail(\"Expected title did not include \" + expected_title + \", was instead: \" + $test_driver.title)\n end\n end\n\n #Close tab that was opened\n if ENV['BROWSER_TYPE'] == 'IE'\n $test_driver.execute_script(\"window.open('', '_self', ''); window.close();\")\n else\n $test_driver.execute_script(\"window.close();\")\n end\n $test_driver.switch_to.window( $test_driver.window_handles.first )\nend", "def check_unique_shortcut?\n if (not new_record? and Node.where('nodes.shortcut = ? AND nodes.id != ?', shortcut, id).exists?) or (new_record? and Node.exists?(:shortcut => shortcut))\n puts \"Problem Node: (Title: #{title}, ID: #{id} URL: #{shortcut}), new_record: #{new_record?}\"\n addition = Node.where('shortcut LIKE ?', shortcut).count\n suggested = self.shortcut + \"_\" + addition.to_s\n errors.add(:shortcut, \"URL shortcut already exists in this site. Suggested Shortcut: '#{suggested}'\")\n end\n end", "def test05_L1DLT05_TC_24418\n\t\t$browser.goto($patch_login)\n\t\tloginDirectory\n\t\t$browser.goto($patch_directory_listing)\n\t\t$directory_listing_manager.when_present.click\n\t\t\n\t\t\n\t\tsleep 2\n\t\tbegin\n\t\tassert $browser.text.include? \"Recent Activity\"\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"L1DLT05: FAILED! Unable to click directory listing\"\n\t\tend\n\tend", "def set_safe_shortcut(desired_shortcut, node_id, increment=0)\n prefix = increment == 0 ? \"\" : increment.to_s + \"-\"\n while Node.where('nodes.shortcut = ? AND nodes.id != ?', prefix + desired_shortcut, node_id).exists?\n increment += 1\n prefix = increment.to_s + \"-\"\n end\n self.shortcut = prefix + desired_shortcut\n return increment\n end", "def timeout_tarpit(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"timeout tarpit \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def test_shortcut_accessor\n assert_equal(N::LOCAL, N::URI[:local])\n end", "def test_doOnce_Museum_one_Choice\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Museum\";\n\tend\n\tdef d.location=(n); n;\n\tend\n\tassert_equal \"Hillman\", do_once(d,1,0)\nend", "def enable_kb_shortcuts(user)\n visit edit_user_registration_path\n unless page.find('#user_kb_shortcuts_enabled').checked?\n page.execute_script('$(\"#user_kb_shortcuts_enabled\").click()')\n\n fill_in 'user_current_password', with: user.password\n show_update_account_button\n click_on 'Update account'\n expect(current_path).to eq read_path\n end\n visit read_path unless current_path == read_path\nend", "def test_tmb_is_true_when_thumbs_enabled_and_images_exist_without_thumbnail\n @elfinder.options = { :thumbs => true }\n h, r = @elfinder.run(:cmd => 'open', :init => 'true', :target => '')\n assert_equal true, r[:tmb]\n end", "def timeout!; end", "def set_shortcut_text\n @shortcut_text = ShortcutText.find(params[:id])\n end", "def test_doOnce_cathedral_one_Choice\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Cathedral\";\n\tend\n\tdef d.location=(n); n;\n\tend\n\tassert_equal \"Museum\", do_once(d,1,0)\nend", "def register_alias(type, shortcut); end", "def find_shortcut(name)\n unless defined? Fast::Shortcut\n require 'fast/shortcut'\n Fast.load_fast_files!\n end\n\n shortcut = Fast.shortcuts[name] || Fast.shortcuts[name.to_sym]\n shortcut || exit_shortcut_not_found(name)\n end", "def test_shortcut_register\n uri = N::URI.new(\"http://foo.foo.com/\")\n N::URI.shortcut(:foo, uri.to_s)\n assert_equal(N::FOO, uri)\n assert_kind_of(N::URI, N::FOO)\n end", "def test_search_suggestions\r\n\r\n @place_holder.login_with_proper_credentials\r\n\r\n @place_holder.enter_search_text(@search_term)\r\n\r\n # Wait for only one seconds before timing out if the suggestions container that displays the suggestions for the given search term does not appear\r\n @place_holder.get_search_suggestion_container.wait_until_present(1)\r\n\r\n # Verify that there are 4 suggestion containers, one for each profile type suggested\r\n @place_holder.assert_suggestion_container_count(PropertiesReader.get_exp_suggestions_type_count)\r\n @place_holder.print_html_contents\r\n\r\n #sleep(60)\r\n # Verify the title of the first suggestion\r\n @place_holder.assert_first_suggestion_title\r\n\r\n end", "def disable_kb_shortcuts(user)\n visit edit_user_registration_path\n if page.find('#user_kb_shortcuts_enabled').checked?\n page.execute_script('$(\"#user_kb_shortcuts_enabled\").click()')\n\n fill_in 'user_current_password', with: user.password\n show_update_account_button\n click_on 'Update account'\n expect(current_path).to eq read_path\n end\n visit read_path unless current_path == read_path\nend", "def test03_250RepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepostPopulate250\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS4T003: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend", "def test_loop(options)\n Snooper.watch options\nrescue Interrupt\n puts # This is where the ^C is on unix\n puts \"Testing over, time for a coffee...\".yellow\nend", "def test_doOnce_Museum_zero_Choice\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Museum\";\n\tend\n\tdef d.location=(n); n;\n\tend\n\tassert_equal \"Cathedral\", do_once(d,0,0)\nend", "def click_word(word)\n 5.times do |i|\n p = super\n if p.nil?\n sleep 0.1\n else\n return p\n end\n end\n return nil\n end", "def test_ref_and_subprocess_timeout\n\n @dashboard.register_participant :alpha, Ruote::StorageParticipant\n\n pdef = Ruote.process_definition do\n define 'sub0' do\n alpha\n end\n ref 'sub0', :timeout => '2d'\n end\n\n wfid = @dashboard.launch(pdef)\n @dashboard.wait_for(:alpha)\n\n scheds = @dashboard.schedules\n\n assert_equal 1, scheds.size\n assert_equal '0_1', scheds.first['target'].expid\n end", "def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend", "def test02_D3LRT03\n\t\t$browser.goto($patch_login)\n\t\tloginDirectory\n\t\t$browser.goto($patch_directory)\n\t\t$directory_title.fire_event(\"onclick\")\n\t\t\n\t\tsleep 2\n\t\tbegin\n\t\tassert $browser.text.include? \"Directory Group\"\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"D2FLT03: FAILED! Unable to click directory listing\"\n\t\tend\n\tend", "def test_link_back(link, parent_title, expected_title, lowercase = false, timeout = 5, dont_scroll = false)\n $logger.info(\"Link for \" + expected_title)\n wait = Selenium::WebDriver::Wait.new(timeout: timeout)\n\n if !dont_scroll\n js_scroll_up(link,true)\n end\n wait.until { link.displayed? }\n link.click\n begin\n if lowercase\n wait.until { $test_driver.title.downcase.include? expected_title }\n else\n wait.until { $test_driver.title.include? expected_title }\n end\n rescue Selenium::WebDriver::Error::TimeOutError\n fail(\"Error loading page \" + expected_title)\n end\n #Go back; some browsers have problems navigating back the first time\n num_retry = 0\n begin\n $test_driver.navigate.back\n wait.until { $test_driver.title.include? parent_title }\n rescue Selenium::WebDriver::Error::TimeOutError\n num_retry += 1\n retry if num_retry == 1\n fail(\"Error navigating back from \" + expected_title)\n end\nend", "def test03_post_open_news_250RepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepostPopulate250\n \t\tsleep 3\n\n\t\tassert $repost_confirmation.exists?\n\tend", "def te_st_DOL_016_Access_SupportHome\r\n\r\n sTestCase_Name = \"test_DOL_016_Access_SupportHome\"\r\n sPageName = \"Support Home\"\r\n puts2(\"\")\r\n puts2(\"Starting Testcase: #{sTestCase_Name}\")\r\n\r\n # Continue since prior test cases have passed\r\n if(@@bContinue == true)\r\n #@@bContinue = false # Clear flag since this test has NOT passed yet\r\n\r\n begin # Access Validation DOL page: Support Home\r\n\r\n puts2(\"\\t Get the identifiers of the current window...\")\r\n sMainWindowTitle = $browser.title\r\n sMainWindowURL = $browser.url\r\n puts2(\"\\t sMainWindowTitle: '\" + sMainWindowTitle + \"'\")\r\n puts2(\"\\t sMainWindowURL: \" + sMainWindowURL)\r\n if($browser.is_ie? == true)\r\n iMainWindowHWND = $browser.hwnd() # Not supported in FireWatir\r\n puts2(\"\\t iMainWindowHWND \" + iMainWindowHWND.to_s)\r\n end\r\n\r\n=begin\r\n ################## Support Home ##################\r\n=end\r\n\r\n # Capture time before navigating to next page\r\n tPageLoadTime = Time.now\r\n\r\n puts2(\"Accessing page - \" + sPageName)\r\n assert($browser.access_quicklink_Help?())\r\n\r\n puts2(\"\\t Attach to the new window...\")\r\n\r\n # Secondary window\r\n $browser.window(:url => EXTERNAL_SITE_URL[\"SupportHome\"]).use do\r\n\r\n $browser.wait_until_status(\"Done\")\r\n\r\n # Calculate and record the elapsed time for the current test case\r\n puts2(\"\\t Page load time - \" + sPageName + \", \" + calc_elapsed_time(tPageLoadTime, false))\r\n puts2(\"\\t Url - \" + sPageName + \" : \"+ $browser.url)\r\n puts2(\"\\t Title - \" + sPageName + \" : \"+ $browser.title)\r\n\r\n sActualSecondaryBrowserUrl = $browser.url\r\n sExpectedSecondaryBrowserUrl = EXTERNAL_SITE_URL[\"SupportHome\"]\r\n\r\n puts2(\"\\t Validating on the page: \" + sPageName)\r\n if(sExpectedSecondaryBrowserUrl != sActualSecondaryBrowserUrl)\r\n raise(\"*** URL's don't match. \\n\\t Expected: \" + sExpectedSecondaryBrowserUrl + \"\\n\\t Actual: \" + sActualSecondaryBrowserUrl)\r\n else\r\n assert($browser.isPage_dishonline_SupportHome?()== true)\r\n end\r\n\r\n puts2(\"Close the second window...\")\r\n $browser.window(:url => EXTERNAL_SITE_URL[\"SupportHome\"]).close\r\n\r\n end # Secondary window\r\n\r\n puts2(\"Back to the main window...\")\r\n puts2(\"\\t Current browser Url: \" + $browser.url.to_s)\r\n puts2(\"\\t Current browser Title: \" + $browser.title.to_s)\r\n\r\n puts2(\"\\t Validating on the page: Home\")\r\n assert($browser.isPage_dishonline_Home?() == true)\r\n\r\n\r\n rescue => e\r\n\r\n puts2(\"*** ERROR Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"), \"ERROR\")\r\n\r\n puts2(\"\")\r\n puts2(\"\\t Current Url - : \"+ $browser.url)\r\n puts2(\"\\t Current Title - : \"+ $browser.title)\r\n #$browser.save_screencapture(\"Dish\" + sPageName , false) # Save the desktop\r\n $browser.save_html(\"Dish\" + sPageName)\r\n\r\n #$browser.generate_testcode_html_tag_counts()\r\n #$browser.generate_testcode_html_tag_attributes()\r\n\r\n raise(\"*** TESTCASE - #{sTestCase_Name}\")\r\n\r\n ensure\r\n\r\n #@@bContinue = true # Set flag since testcase passed\r\n\r\n # Set the flag to close the $browser after the last test case runs\r\n #@@bCloseBrowser = true\r\n\r\n\r\n end # Access Validation DOL page: Support Home\r\n\r\n end # Continue since prior test cases have passed\r\n\r\nend", "def test_05_1_show_me_how_TC_24406\n\t\t\n\t\tprofileLogin\n\t\t$browser.goto($patch_note)\n\t\t$help_post_note.when_present.click\n\t\tsleep 4 \n\t\t$browser.window(:title, /Post a Note/).use do\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Post a Note\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"J1_T5.1: FAILED! User unable to navigate to zendesk.\"\n\t\tend\n\t\tend\n\tend", "def waitForSearchResultToPassLambda(searchParam, test)\n total_wait_time = 0\n loop do\n fill_in 'q', with: searchParam\n click_button 'reg-search'\n break if test.call(page) || (total_wait_time > 20)\n puts '... Waiting 1 second before re-trying search '\\\n '(maximum wait time is 20 seconds)'\n sleep 1\n total_wait_time += 1\n end\nend", "def add_shortcut(shortcut)\n @shortcuts.push(shortcut) unless @shortcuts.index(shortcut)\n end", "def timeouts_set=(_arg0); end", "def test_019\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #Click link M of a directory\n click $xpath[\"task\"][\"m_link\"]\n sleep 2\n\n #The name of the directory which pushed [M] goes into the field of right-hand side make_root.\n assert_equal \"sample_c/\", get_value( $xpath[\"task\"][\"make_root_link\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end", "def simulate_work(time)\n return\n sleep time unless Softcover::test?\n end", "def redirect_to_full_url(shortcut)\n # Log shortcut access\n access = ShortcutAccess.create(shortcut: shortcut, access_date: DateTime.now, access_ip: request.remote_ip)\n\n # Increment shortcut hit\n shortcut.hits += 1\n shortcut.save\n\n # Redirect\n if shortcut.full_url.starts_with?('http')\n redirect_to shortcut.full_url\n else\n redirect_to \"http://#{shortcut.full_url}\"\n end\n end", "def retry_item(item)\n @queue.retry_item(item)\n raise Timberline::ItemRetried\n end", "def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end", "def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end", "def test02_L1DLT02_TC_24418\n\t\t$browser.goto($patch_login)\n\t\tloginDirectory\n\t\t$browser.goto($patch_directory_listing)\n\t\t$directory_review_follow.click\n\t\t\n\t\tsleep 2\n\t\tbegin\n\t\tassert $browser.text.include? \"Follow\"\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"L1DLT02: FAILED! Unable to click directory listing\"\n\t\tend\n\tend", "def test_reboot_user_function\n #Call reboot terminal user function located in file\n reboot_terminal @@hostname\n\n #Wait till device completes rebooting\n sleep(15)\n end", "def lock_timeout_retries=(_arg0); end", "def test02_R1_disappointed_TC_24423\n\t\t@msg = \"The office isn't open at 3 AM! I am disappointed times #{random}!!\"\n\t\t$browser.goto($patch_login)\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_directory_listing)\n\t\twait_for_ajax\n\t\tsleep 3\n\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n\t\tsleep 3\n\t\t$business_review_disappointed.click\n\t\tsleep 2\n\t\t$business_review_text.set(@msg)\n\t\t$business_review_post.fire_event(\"onclick\")\n\n\t\tsleep 2\n\t\tassert $browser.text.include? \"#{@msg}\"\n\t\tassert $browser.text.include? \"disappointed times\"\n\n\tend", "def lock_timeout_retry_delay=(_arg0); end", "def timeout=(_arg0); end", "def get_key(char)\nTimeout::timeout(0){\n return read_char == char\n}\nreturn false\nend", "def test04_login_search_event_TC_24325\n\t\t$browser.goto($patch)\n\t\t$search_text_field.set(\"Automated event\")\n\t\t$search_button.click\n\t\t$search_result_event.when_present.click\n\t\tsleep 4\n\t\t\n\t\tassert $browser.text.include?(\"Comment\")\n\tend", "def test03_flag_repost_event_TC_24323\n\t\trepostEventPop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T3: FAILED! User unable to flag post.\"\n\t\tend\n\tend", "def test_doOnce_hillman_zero_Choice\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Hillman\";\n\tend\n\tdef d.location=(n); n;\n\tend\n\tassert_equal \"Downtown\", do_once(d,0,0)\nend", "def test_re_dispatch_count_is_initially_zero\n\n @dashboard.register { catchall }\n\n wfid = @dashboard.launch(Ruote.define { alpha })\n r = @dashboard.wait_for(:alpha)\n\n assert_equal 0, r['workitem']['re_dispatch_count']\n end", "def test_020\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n\n #A subwindow carries out fade-out and closes.\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end", "def iSetTargetWifi(client)\n\t\tbegin\n\t\t\tclient.launch(\"com.apple.Preferences\", true, true)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='Wi-Fi' and @x=118]\", 0, 1)\n\t\t\tclient.sleep(3000)\n\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='QA2-2G' and @x>700 and @y<400]\", 0)\n\t\t\t\tputs \"::MSG:: 既に接続しました「 Already connected to Main environment\"\n\t\t\t\tclient.sleep(3000)\n\t\t\telse\n\t\t\t\tclient.sleep(7000)\n\t\t\t\tclient.longClick(\"NATIVE\", \"xpath=//*[@text='QA2-2G' and @x>700 and @y>400]\", 0, 1, 0, 0)\n\t\t\t\tclient.sleep(3000)\n\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='このネットワーク設定を削除' and ./parent::*[@text='このネットワーク設定を削除']]\", 0)\n\t\t\t\t\tputs \"::MSG:: 既に接続しました「 Already connected to Main environment\"\n\t\t\t\t\tclient.sleep(2000)\n\t\t\t\telse\n\t\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='パスワード' and ./parent::*[@text='パスワード' and ./parent::*[@text='パスワード']]]\", 0)\n\t\t\t\t\t\tclient.elementSendText(\"NATIVE\", \"xpath=//*[@text='パスワード' and ./parent::*[@text='パスワード' and ./parent::*[@text='パスワード']]]\", 0, \"unexttest\")\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tend\n\t\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='接続']\", 0)\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='接続']\", 0, 1)\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tend\n\t\t\t\t\tputs \"::MSG:: 本番環境に接続しました「 Conencted to Main environment\"\n\t\t\t\t\tclient.sendText(\"{HOME}\")\n\t\t\t\tend\n\t\t\tend\n\t\trescue Exception => e\n\t\t\t$errMsgCcast = \"::MSG:: Exception occurrred while setting wifi \" + e.message\n\t\tend\t\t\n\t\tclient.launch(\"jp.unext.mediaplayer\", true, false)\n\t\tclient.sleep(5000)\n\tend", "def dwp_work(work_item)\n dwp_log{ \"Working, item: #{work_item.inspect}\" }\n dwp_run_callback('before_work', work_item)\n work!(work_item)\n dwp_run_callback('after_work', work_item)\n end", "def test05_post_closed_news_NoNoteRepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepost \"\" #No note\n \t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend", "def test1ActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [WEACE::Master::TransferFile.new(iTmpFileName)] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n }\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal([], getSlaveClientQueue)\n assert_equal({iTmpFileName => 1}, getTransferFiles)\n end\n end\n end\n end", "def start_rerun(test_run)\n\n end", "def click_act_as_link\n act_as_link.click\n sleep(10)\n end", "def test_doOnce_hillman_one_Choice\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Hillman\";\n\tend\n\tdef d.location=(n); n;\n\tend\n\tassert_equal \"Hospital\", do_once(d,1,0)\nend", "def test_handle_roulette_shot_2_repeat\n @plugin.stubs(:shot).returns(1)\n @plugin.stubs(:draw).returns(0)\n @plugin.handle(Time.now, \"John\", \"roulette\")\n assert_equal( [\"John: you can't shoot twice in a row, dolt!\"], @plugin.reply_to.replies )\n end", "def test01_L1DLT01_TC_24418\n\t\t$browser.goto($patch_login)\n\t\tloginDirectory\n\t\t$browser.goto($patch_directory_listing)\n\t\t$directory_review_follow.when_present.fire_event(\"onclick\")\n\t\t\n\t\tsleep 5\n\t\tbegin\n\t\tassert $directory_group_follow_ok.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"L1DLT01: FAILED! Unable to click directory listing\"\n\t\tend\n\t\t\n\t\t$directory_group_follow_ok.click\n\tend", "def items_shortcut\n (config_params||DEFAULT_CONFIG_PARAMS)[\"Items Shortcut\"]\n end", "def click_selenium_test1\n @session.click_link(@link_text)\n end", "def test05_TwoGroupsRepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\ttwoGroupSelect\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS2T05: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend", "def test02_repostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\trepostNoNote\n\t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS4T02: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend", "def handle_reader_popup()\n if ENV['BROWSER_TYPE'] == 'FIREFOX'\n $test_driver.navigate.refresh\n sleep 1\n end\nend", "def default_shortcuts\r\n {\r\n \"Ctrl+Shift+S\" => {\"description\"=>\"Displays Tr8n shortcuts\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_shortcuts', {width:400});\"},\r\n \"Ctrl+Shift+I\" => {\"description\"=>\"Turns on/off inline translations\", \"script\"=>\"Tr8n.UI.LanguageSelector.toggleInlineTranslations();\"},\r\n \"Ctrl+Shift+L\" => {\"description\"=>\"Shows/hides settings selector\", \"script\"=>\"Tr8n.UI.LanguageSelector.show(true);\"},\r\n \"Ctrl+Shift+N\" => {\"description\"=>\"Displays notifications\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/translator/notifications/lb_notifications', {width:600});\"},\r\n \"Ctrl+Shift+K\" => {\"description\"=>\"Adds software keyboard for each entry field\", \"script\"=>\"Tr8n.Utils.toggleKeyboards();\"},\r\n \"Ctrl+Shift+C\" => {\"description\"=>\"Display current component status\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_source?source=' + Tr8n.source, {width:420});\"},\r\n \"Ctrl+Shift+T\" => {\"description\"=>\"Displays Tr8n statistics\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_stats', {width:420});\"},\r\n \"Ctrl+Shift+D\" => {\"description\"=>\"Debug Tr8n Proxy\", \"script\"=>\"Tr8n.SDK.Proxy.debug();\"},\r\n\r\n \"Alt+Shift+C\" => {\"description\"=>\"Displays Tr8n credits\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/help/credits';\"},\r\n \"Alt+Shift+D\" => {\"description\"=>\"Opens dashboard\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/translator/dashboard';\"},\r\n \"Alt+Shift+M\" => {\"description\"=>\"Opens sitemap\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/sitemap';\"},\r\n \"Alt+Shift+P\" => {\"description\"=>\"Opens phrases\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/phrases';\"},\r\n \"Alt+Shift+T\" => {\"description\"=>\"Opens translations\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/translations';\"},\r\n \"Alt+Shift+A\" => {\"description\"=>\"Opens awards\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/awards';\"},\r\n \"Alt+Shift+B\" => {\"description\"=>\"Opens message board\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/forum';\"},\r\n \"Alt+Shift+G\" => {\"description\"=>\"Opens glossary\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/glossary';\"},\r\n \"Alt+Shift+H\" => {\"description\"=>\"Opens help\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/help';\"}\r\n }\r\n end", "def click_and_change_window(how, what, tag_name, resulting_url)\n e = $driver.find_element(how, what)\n 3.times do \n e.tag_name.should == tag_name\n e.click.should be_nil\n\n quiesce\n\n if $driver.window_handles.length > 1\n break\n end\n end\n\n # The actual window switching\n $driver.switch_to.window($driver.window_handles.last).should be_nil\n\n check_url_match(resulting_url)\n return e\n end", "def test02_D3LRT03\n\t\t$browser.goto($patch_login)\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_directory)\n\t\t$directory_title.fire_event(\"onclick\")\n\t\t\n\t\tsleep 2\n\t\tassert $browser.text.include? \"Directory Group\"\n\tend", "def test01_post_open_news_NoNoteRepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\trepost \"\" #No note\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend", "def test03_post_closed_board_repostMedia_TC_24313_243414\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_media_to_edit)\n\t\t\n\t\tsleep 3\n\t\trepost \"Repost text #{random}\" \n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend", "def wait_for_relevancy(query, wanted_relevancy, hit_idx = 0, timeout = 30, eps = 1e-6, qrserver_id = 0)\n timeout = calculateQueryTimeout(timeout)\n relevancy = 0\n timeout.times do |x|\n begin\n result = search(query, qrserver_id)\n\tif result.hit[hit_idx] and result.hit[hit_idx].field['relevancy']\n relevancy = result.hit[hit_idx].field[\"relevancy\"].to_f\n\telse\n\t relevancy = 0\n\tend\n rescue Interrupt\n puts \"low-level timeout, retry #{x}\"\n end\n if check_approx(wanted_relevancy, relevancy, eps)\n break\n end\n sleep 1\n end\n assert_approx(wanted_relevancy, relevancy, eps, \"Expected relevancy #{wanted_relevancy} for hit #{hit_idx} but was #{relevancy}\")\n end", "def trigger (scheduler)\n\n ldebug { \"trigger() timeout requested for #{@fei.to_debug_s}\" }\n\n set_timedout_flag(@applied_workitem)\n\n cancel\n\n reply_to_parent(@applied_workitem)\n end", "def move_feed_to_new_folder(feed, title, user)\n read_feed feed, user\n open_folder_dropdown\n within '#folder-management-dropdown ul.dropdown-menu' do\n find('a[data-folder-id=\"new\"]').click\n end\n expect(page).to have_css '#new-folder-popup'\n sleep 0.5\n within '#new-folder-popup' do\n fill_in 'Title', with: title\n find('#new-folder-submit').click\n end\n # Ensure new feed appears in the sidebar\n within '#folders-list' do\n expect(page).to have_text title\n end\nend", "def jump_to(path, &block)\n Dir.chdir(test_content_dirs(path), &block)\nend", "def test1FailActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n lTransferFile = WEACE::Master::TransferFile.new(iTmpFileName)\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [lTransferFile] ]\n ]\n $Context[:DummySenderSendError] = RuntimeError.new('Sending error')\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n },\n :Error => RuntimeError\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal(\n [\n [ 'DummyUser',\n { 'DummyTool' => {\n 'DummyAction' => [\n [lTransferFile]\n ]\n }\n }\n ]\n ],\n getSlaveClientQueue\n )\n assert_equal({iTmpFileName => 2}, getTransferFiles)\n end\n end\n end\n end", "def applicationDidFinishLaunching(notification)\n @hotkeys = HotKeys.new\n\n # Seriously for a second; For some reason a global hotkey or at least \n # the way I've got it to working blocks the keystroke. Which I guess is normal?\n #\n # Maybe I'll hack around that with system events for a bypass option, it wouldn't \n # be elegate, but this is new territory anywho\n #\n @hotkeys.addHotString(\"S+OPTION\") do\n puts \"PRESSED: S+OPTION\"\n end\n\n # Will only trigger if Safari is frontmost application, second option can be left blank\n # for a global shortcut\n @hotkeys.addHotString(\"S+OPTION\", :bundle_identifier => \"com.apple.Safari\") do\n puts \"PRESSED: S+OPTION IN SAFARI TOO\"\n end\n\nend", "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 test02_D3LRT02\n\t\t$browser.goto($patch_login)\n\t\tloginDirectory\n\t\t$browser.goto($patch_directory)\n\t\t$directory_image.when_present.fire_event(\"onclick\")\n\t\t\n\t\tsleep 2\n\t\tbegin\n\t\tassert $browser.text.include? \"Directory Group\"\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"D2FLT02: FAILED! Unable to click directory listing\"\n\t\tend\n\tend", "def test02_repostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\trepost \"\" #No note\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend", "def test_failing_job_with_retry()\n # FIXME: check that the job has been effectively tried twice\n # FIXME: test a job working the second time\n assert_nothing_thrown() do\n s = generate_spawner(1, false, 1, @jobs_log_file, @spawner_log_file)\n generate_tasks_addition(s, 1, true, 2) {plop}\n end\n end", "def setup\r\n\r\n # Save the Global variable's original settings so that they can be changed in this\r\n # test without affecting other test, so long as they are restored by teardown\r\n @@VERBOSE_ORIG = $VERBOSE\r\n @@DEBUG_ORIG = $DEBUG\r\n @@FAST_SPEED_ORIG = $FAST_SPEED\r\n @@HIDE_IE_ORIG = $HIDE_IE\r\n\r\n # Record the time that current test case starts\r\n @@tTestCase_StartTime = Time.now\r\n\r\n # Start a new Logger Object and assign it to a Global Object\r\n #\r\n # Using the default values:\r\n # Create a \"waitr_works/results\" directory within the OS's Temporary directory\r\n # That directory will contain the single log file used for all tests.\r\n # If the current log file gets too big, output rolls to another log file.\r\n if(@@bLogOutput == true)\r\n $logger = capture_results()\r\n end\r\n\r\n # Hide the annoying console window so that it doesn't cover any of the screen\r\n minimize_ruby_console()\r\n\r\n # Record the test environment if it hasen't already been recorded\r\n if($bEnvironmentRecorded != true)\r\n $bEnvironmentRecorded = record_environment()\r\n @@bContinue = $bEnvironmentRecorded\r\n end\r\n\r\n # Open the Workbook containing the data for the test cases,\r\n # and read the data into memory if it hasen't already been read\r\n if((@@bContinue == true) and ($bDataSetRead != true))\r\n #$bDataSetRead = read_dataset()\r\n @@bContinue = $bDataSetRead\r\n end\r\n\r\n # Open a browser and access the site if it hasen't already been recorded\r\n #if((@@bContinue == true) and ($bWebSiteAccessed != true))\r\n\r\n $browser = start_browser($sDefaultBrowser)\r\n #$browser.goto(\"www.ask.com\")\r\n\r\n #$bWebSiteAccessed = access_dishonline()\r\n @@bContinue = $bWebSiteAccessed\r\n #end\r\n\r\n\r\n\r\n end", "def test02_CloseFlagNoteDialog\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCloseFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPST02: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend", "def test_simpleRecoveryItem\n w = Window_ItemDetails.new(0,96,640,96,$data_items[1])\n @windows.push(w)\n return true\n end", "def test04_GroupRepostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\tgroupAddRemoveAdd \"Repost text #{random}.\"\n \t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend", "def retry_action_with_scroll_down\n tries ||= 2\n yield\nrescue Capybara::ElementNotFound, Selenium::WebDriver::Error::UnknownError\n navigation.scroll_down\n retry unless (tries -= 1).zero?\nend" ]
[ "0.58481675", "0.5791252", "0.5766254", "0.5631291", "0.5610015", "0.5375871", "0.5327903", "0.5195429", "0.51676375", "0.5136263", "0.5132085", "0.5082546", "0.50743175", "0.49227077", "0.49002203", "0.48898408", "0.48631418", "0.48252332", "0.48249716", "0.4813007", "0.48003405", "0.47478873", "0.47420847", "0.47399276", "0.47341067", "0.4729517", "0.47194645", "0.4711925", "0.46974352", "0.4666848", "0.46657103", "0.46595803", "0.4655785", "0.46523878", "0.46514654", "0.46454453", "0.46439666", "0.46417403", "0.4632071", "0.46315965", "0.46195894", "0.46169218", "0.46108282", "0.46013424", "0.45838204", "0.45796022", "0.45770895", "0.45753312", "0.45721704", "0.45713013", "0.45547438", "0.45449352", "0.45418304", "0.45418304", "0.45386216", "0.45354986", "0.45332044", "0.4532377", "0.45199823", "0.45190763", "0.45187467", "0.45185247", "0.4518274", "0.45175678", "0.45172188", "0.45161298", "0.45124593", "0.45116052", "0.45085245", "0.45083943", "0.45072138", "0.44945952", "0.44906756", "0.44893664", "0.44873026", "0.44768223", "0.4469775", "0.44696623", "0.4467103", "0.44598973", "0.44595805", "0.4456932", "0.4455415", "0.4454761", "0.4446817", "0.444597", "0.44412184", "0.444104", "0.442345", "0.44229606", "0.4421911", "0.44203725", "0.44178626", "0.4412843", "0.441019", "0.43970966", "0.43965894", "0.43951017", "0.43872207", "0.43782154" ]
0.49013478
14
Returns true if the underlying participant expression is 'gone' (probably cancelled somehow).
def is_gone? fexp.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_orphaned?\n participants.reduce(true) do |is_orphaned, participant|\n is_orphaned && is_deleted?(participant)\n end\n end", "def is_cancelled?\n\n if fe = fexp\n return fe.h.state == 'cancelling'\n else\n true\n end\n end", "def canceled?\n special_message == \"This talk has been canceled/deleted\"\n end", "def pending?\n !self.canceled?\n end", "def cancelled?\n # the establishment has been cancelled by the user\n request_cancelled?\n end", "def cancelled?\n false\n end", "def cancelled?\n return @cancelled\n end", "def participant?\n !participant.nil?\n end", "def is_deleted?(participant)\n return false if participant.nil?\n return receipt_for(participant).first.deleted\n end", "def canceled?\n (confirmations.last.try(:confirmed) == false)\n end", "def ending?\n active? && !canceled_at.nil?\n end", "def cancelled?\n @cancelled\n end", "def cancelled?\n @cancelled\n end", "def still_valid?\n return false if self.reply_type == 'conversation'\n participation_request = ParticipationRequest.find self.participation_request_id\n\n return false if participation_request.state != 'pending'\n return false if participation_request.date < Time.current\n\n !used\n end", "def continued?\n @continued\n end", "def cancelled?\n return self.status == 'canceled'\n end", "def deleted?\n return (withdrawn || record.nil?)\n end", "def concluded?\n state == :answered || state == :canceled\n end", "def eliminated?\n\t\t@eliminated\n\tend", "def running?\n\t\t!cancelled?\n\tend", "def canceled?\n @state == :cancel\n end", "def cancellation_pending?\n if self.state_changed?\n before_after_states = self.state_change.map { |st| st.nil? ? nil : st.to_sym }\n \n # It would be nice if Ruby could do pattern matching (like in Elixir and Scala).\n # We could sure use it here.\n if before_after_states[1] == :canceled\n true\n elsif (before_after_states[0] != :awaiting_sale_docs) && (before_after_states[1] == :ready_for_seller_billing)\n true\n else\n false\n end\n else\n false\n end\n end", "def can_be_canceled?\n !self.lapsed? \n end", "def closed?\n # the conference has been created the virtual hearing was deleted\n conference_id.present? && conference_deleted?\n end", "def is_deleted?(participant)\n return false unless participant\n return receipts_for(participant).deleted.count == receipts_for(participant).count\n end", "def discarded?\n finished? && error.present?\n end", "def on_call_not(context, expression)\n return !on_call_boolean(context, expression)\n end", "def game_unactive?\n !@game_active\n end", "def cancelled?\n !cancellation_date.nil? && cancellation_reason.present?\n end", "def cancelled?\n (status == CANCELLED)\n end", "def cancelled?\n @status == :cancelled\n end", "def peer_auditor_checked?\n !(self.auditor_result == 'None' || self.auditor_result == 'Comment')\n end", "def active?\n !canceled?\n end", "def alive?\n super && !@cancelled\n #!!@alive# && !@cancelled\n end", "def not_started?\n self.round.not_started?\n end", "def isRemoved?\n is_removed?\n end", "def undone?\n !done?\n end", "def is_paused? (expression)\n\n (@paused_instances[expression.fei.parent_wfid] != nil)\n end", "def unsent?\n !@_sended\n end", "def ongoing?\n \tself.active and self.winner.nil?\n end", "def removed?\n @removed\n end", "def not_tracked?\n\t\treturn self.status == '?'\n\tend", "def is_still_ongoing?\n return @human_player.life_points > 0 && @enemies.length > 0 ? true : false\n end", "def is_canceled?\n return self.status == Erp::QuickOrders::Order::STATUS_CANCELED\n end", "def destroyed?\n !!destroyed\n end", "def destroyed?\n @_deleted || (!new_record? && !exist?)\n end", "def cancellable?\n !cancelled? and !missed? and (start_time - Time.now) > CANCELLATION_DEADLINE\n end", "def destructive?\n @destructive ||= !!(dependent && (dependent == :delete_all || dependent == :destroy))\n end", "def unsent?\n !sent?\n end", "def discard_past?\n\n dp = @scheduler.discard_past\n dp = @discard_past if @discard_past != nil\n dp = @resume_discard_past if @resume_discard_past != nil\n\n dp\n end", "def pending?\n !trailing.nil?\n end", "def unfinished?\n !finished?\n end", "def removed?\n\t\treturn self.status == 'R'\n\tend", "def is_still_ongoing?\n\t\tif @enemies.length > 0 && @human_player.life_points > 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def tracked?\n\t\treturn !self.not_tracked?\n\tend", "def complement?\n @complement\n end", "def destroyed?\n !!@destroyed\n end", "def cancelled?\n @callback.nil?\n end", "def invisible?\n false\n end", "def invisible?\n false\n end", "def incomplete?\r\n !complete?\r\n end", "def finished?\n @turns_allowed < 0\n end", "def step_completed?\n !object.waiting_on.include?(scope)\n end", "def cancelled?\n Sidekiq.redis { |c| c.exists(\"cancelled-#{jid}\") }\n end", "def away?\n ! self.active.blank?\n end", "def cancelled?\n @callback.nil?\n end", "def canceled?\n @current_state == Psc::ScheduledActivity::CANCELED\n end", "def is_experiment_completed?(experiment) # rubocop:todo Naming/PredicateName\n !!VanityExperiment.retrieve(experiment).completed_at\n end", "def impossible?\n !possible?\n end", "def incomplete?\n !completed\n end", "def cancelled?\n [email protected]? && @call.status.code == Core::StatusCodes::CANCELLED\n end", "def ended\n !!(cancelled && !on_grace_period)\n end", "def canceled?\n procedure = @procedure\n if procedure\n procedure.canceled?\n else\n @cancel\n end\n end", "def invisible?\n false\n end", "def invisible?\n resolved_rules.members.all? {|seq| seq.invisible?}\n end", "def deuce?\n @points == @opponent.points\n end", "def paused?\n\n get_expression_pool.is_paused?(self)\n end", "def is_removed?\n self.has_current_status_of?(ArticleSubmission::ADMIN_REMOVED) || self.has_current_status_of?(ArticleSubmission::REMOVED)\n end", "def destroyed?\n @destroyed ||= false\n end", "def destroyed?\n @destroyed ||= false\n end", "def destroyed?\n @destroyed ||= false\n end", "def destroyed?\n @destroyed ||= false\n end", "def destroyed?\n @destroyed == true\n end", "def missing?\n\t\treturn self.status == '!'\n\tend", "def ended?\n !!winner\n end", "def unmatched?\r\n @partner.nil?\r\n end", "def destroyed?\n @destroyed == true\n end", "def destroyed?\n @destroyed == true\n end", "def destroyed?\n @destroyed == true\n end", "def destroyed?\n @destroyed == true\n end", "def rejected?\n !!self.rejected_at\n end", "def owner_retain_canceled?\n self.abnormal_close_type.present? && self.abnormal_close_type.owner_retain_canceled?\n end", "def recording?\n @decision != Decision::DROP\n end", "def is_still_going?\n if ((gamer.life_points > 0) && (@enemies.size > 0))\n \treturn true\n else\n \treturn false\n end\n end", "def is_dead?\n @lifespan < 0.0\n end", "def is_dead?\n @lifespan < 0.0\n end", "def future?\n !current? && !complete?\n end", "def killed?\n false\n end", "def unsubscribed?\n @gate.synchronize do\n return @unsubscribed\n end\n end", "def pending_deletable?\n !pending_delete_prohibited?\n end" ]
[ "0.65181994", "0.6196268", "0.618774", "0.6095869", "0.60403264", "0.6031088", "0.60306865", "0.5997672", "0.5996893", "0.59890646", "0.59806854", "0.59496784", "0.59496784", "0.5936161", "0.58958703", "0.5894774", "0.58602965", "0.584036", "0.5831636", "0.5800843", "0.579707", "0.5789029", "0.5787506", "0.5774512", "0.5747206", "0.5744393", "0.5727799", "0.5715721", "0.5705812", "0.5703486", "0.5698246", "0.5677404", "0.5665574", "0.56585485", "0.56583583", "0.565513", "0.5654629", "0.56541806", "0.5631075", "0.56243193", "0.56035763", "0.5598586", "0.55960613", "0.5593176", "0.55930114", "0.559171", "0.5574776", "0.55728346", "0.5568452", "0.5565794", "0.5563049", "0.55524945", "0.5550027", "0.55480003", "0.5543794", "0.5538673", "0.55336744", "0.55284274", "0.55260974", "0.55260974", "0.55247205", "0.55219334", "0.55197734", "0.5506882", "0.550333", "0.55025065", "0.5499334", "0.5496241", "0.5495527", "0.5495441", "0.5495227", "0.54914564", "0.548376", "0.54828274", "0.54818654", "0.5480493", "0.547826", "0.5477482", "0.54682004", "0.54682004", "0.54682004", "0.54682004", "0.5456883", "0.5453394", "0.54512095", "0.54491705", "0.544569", "0.544569", "0.544569", "0.544569", "0.544492", "0.5436584", "0.5435664", "0.54258144", "0.5424096", "0.5424096", "0.54232043", "0.5416245", "0.5415002", "0.54142946" ]
0.7242993
0
Returns true if the underlying participant expression is gone or cancelling.
def is_cancelled? if fe = fexp return fe.h.state == 'cancelling' else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancelled?\n !cancellation_date.nil? && cancellation_reason.present?\n end", "def pending?\n !self.canceled?\n end", "def canceled?\n special_message == \"This talk has been canceled/deleted\"\n end", "def cancellation_pending?\n if self.state_changed?\n before_after_states = self.state_change.map { |st| st.nil? ? nil : st.to_sym }\n \n # It would be nice if Ruby could do pattern matching (like in Elixir and Scala).\n # We could sure use it here.\n if before_after_states[1] == :canceled\n true\n elsif (before_after_states[0] != :awaiting_sale_docs) && (before_after_states[1] == :ready_for_seller_billing)\n true\n else\n false\n end\n else\n false\n end\n end", "def cancelled?\n return @cancelled\n end", "def ending?\n active? && !canceled_at.nil?\n end", "def cancelled?\n # the establishment has been cancelled by the user\n request_cancelled?\n end", "def cancelled?\n return self.status == 'canceled'\n end", "def canceled?\n (confirmations.last.try(:confirmed) == false)\n end", "def can_be_canceled?\n !self.lapsed? \n end", "def cancelled?\n false\n end", "def cancellable?\n !cancelled? and !missed? and (start_time - Time.now) > CANCELLATION_DEADLINE\n end", "def cancelled?\n @cancelled\n end", "def cancelled?\n @cancelled\n end", "def concluded?\n state == :answered || state == :canceled\n end", "def active?\n !canceled?\n end", "def canceled?\n @state == :cancel\n end", "def cancelled?\n (status == CANCELLED)\n end", "def cancelled?\n @status == :cancelled\n end", "def owner_retain_canceled?\n self.abnormal_close_type.present? && self.abnormal_close_type.owner_retain_canceled?\n end", "def running?\n\t\t!cancelled?\n\tend", "def is_gone?\n\n fexp.nil?\n end", "def canceled?\n @current_state == Psc::ScheduledActivity::CANCELED\n end", "def canceled?\n procedure = @procedure\n if procedure\n procedure.canceled?\n else\n @cancel\n end\n end", "def canceled?\n #if canceled_on && approved_on && canceled_on.to_time > approved_on.to_time\n if canceled_on != nil\n return true\n else\n return false\n end\n end", "def peer_auditor_checked?\n !(self.auditor_result == 'None' || self.auditor_result == 'Comment')\n end", "def is_canceled?\n return self.status == Erp::QuickOrders::Order::STATUS_CANCELED\n end", "def client_cancel?\n !!(self.close_reason && self.close_reason =~ /^client_cancel/i)\n end", "def closed?\n # the conference has been created the virtual hearing was deleted\n conference_id.present? && conference_deleted?\n end", "def cancelled?\n [email protected]? && @call.status.code == Core::StatusCodes::CANCELLED\n end", "def continued?\n @continued\n end", "def canceled_by_user?\n cancel_reason == PAYMENT_CANCELED\n end", "def donor_can_cancel?\n !received?\n end", "def still_valid?\n return false if self.reply_type == 'conversation'\n participation_request = ParticipationRequest.find self.participation_request_id\n\n return false if participation_request.state != 'pending'\n return false if participation_request.date < Time.current\n\n !used\n end", "def cancelled?\n Sidekiq.redis { |c| c.exists(\"cancelled-#{jid}\") }\n end", "def alive?\n super && !@cancelled\n #!!@alive# && !@cancelled\n end", "def canceled?\n ['canceled', 'unpaid'].include?(status)\n end", "def cancellable?\n status.to_sym.in? [:pending]\n end", "def on_grace_period?\n (canceled? && Time.current < ends_at) || (paused? && pause_starts_at? && Time.current < pause_starts_at)\n end", "def participant?\n !participant.nil?\n end", "def cancel?\n self.type == :cancel\n end", "def is_deleted?(participant)\n return false if participant.nil?\n return receipt_for(participant).first.deleted\n end", "def canceled?\n @__status == TaskStatus::CANCELED\n end", "def failed? participate\n return participate.continuous_check_in == 0 || participate.updated_at.to_date != Time.now.utc.to_date\nend", "def ongoing?\n \tself.active and self.winner.nil?\n end", "def is_canceled?\n return self.status == Erp::Reservations::Reservation::STATUS_CANCELED\n end", "def can_cancel_and_reschedule?\n return true unless follow_up_for_dose\n\n Time.zone.now > can_change_after\n end", "def cancelled?\n\t\[email protected] {\n\t\t\[email protected]_a? Cancel\n\t\t}\n\tend", "def cancelled?\r\n ['2', '3', '6', '7', '888'].include?(self['trans_status'])\r\n end", "def ended\n !!(cancelled && !on_grace_period)\n end", "def recurring\n !on_trial && !cancelled\n end", "def cancelled?\n @callback.nil?\n end", "def cancelled?\n status_code == 'ABORT'\n end", "def expired_and_uncompleted?\n self.expired? and !self.completed?\n end", "def can_cancel?\n !canceled? && reserve_start_at > Time.current && actual_start_at.nil? && actual_end_at.nil?\n end", "def rejected?\n !!self.rejected_at\n end", "def can_be_canceled?\n return true if actionable_date.nil?\n\n cancel_by = actionable_date - SolidusSubscriptions.configuration.minimum_cancellation_notice\n cancel_by.future? || cancel_by.today?\n end", "def cancelled?\n @callback.nil?\n end", "def not_started?\n self.round.not_started?\n end", "def discard_past?\n\n dp = @scheduler.discard_past\n dp = @discard_past if @discard_past != nil\n dp = @resume_discard_past if @resume_discard_past != nil\n\n dp\n end", "def cancelled_by_customer?\n @cancelled_by_customer\n end", "def cancelable?\n eventbookingstatus.key != 'cancelled'\n end", "def deleted?\n return (withdrawn || record.nil?)\n end", "def previous_parliament?\n respond_to?(:parliamentPeriodHasImmediatelyPreviousParliamentPeriod)\n end", "def not_tracked?\n\t\treturn self.status == '?'\n\tend", "def discarded?\n finished? && error.present?\n end", "def time_removed?\n self.impact == 'Removed'\n end", "def paused?\n\n get_expression_pool.is_paused?(self)\n end", "def active?\n [email protected]? || !connection.is_experiment_completed?(@id)\n end", "def cancelled?\n\t\t\t\[email protected]?\n\t\t\tend", "def rejected?\n !self.rejected_at.nil?\n end", "def result_pending?\n !!@result_pending\n end", "def is_paused? (expression)\n\n (@paused_instances[expression.fei.parent_wfid] != nil)\n end", "def inactive?\n @recurrence.busy_count >= 3\n end", "def can_reject?\n !accepted? && !rejected? && !withdrawn?\n end", "def alive?\n !(self.closed? || self.suspended? || self.deleted?)\n end", "def game_unactive?\n !@game_active\n end", "def cancellable?\n status.to_sym.in? [StatusNotSent, StatusPending]\n end", "def active?\n !expired? && !revoked?\n end", "def recording?\n @decision != Decision::DROP\n end", "def isPending?\n self.pending\n end", "def is_replaying?\n decision_context.workflow_clock.replaying\n end", "def is_replaying?\n decision_context.workflow_clock.replaying\n end", "def pending?\n tangible? && pending != 0\n end", "def in_future?\n elapsed.negative?\n end", "def not_completed?\n status == NOT_COMPLETED\n end", "def active?\n !self.trial_over? or self.paid?\n end", "def is_active_recurring\n recurring_period? && !recurring_stopped_at?\n end", "def payment_intent_cancelled?\n status == 'Payment Intent Cancelled'\n end", "def comp_noncomp_past_step_1?\n !spectator? && status_is_active?(\"base_details\")\n end", "def charged?\n return (@time <= 0)\n end", "def is_deleted?(participant)\n return false unless participant\n return receipts_for(participant).deleted.count == receipts_for(participant).count\n end", "def running?\n return ![:deleted, :archived, :cancelled, :complete].include?(self.state)\n end", "def occurred?\n @current_state == Psc::ScheduledActivity::OCCURRED\n end", "def future?\n !current? && !complete?\n end", "def temporary?\n !new_record? && valid_until\n end", "def expired?\n !self.active?\n end", "def edible?\n#true \n !expired\n \nend", "def rejected?\n self.status == Task::Status::CANCELLED\n end", "def has_trialed?\n current_user.subscriptions.any? {|s| !s.canceled_at.nil? && s.canceled_at > s.created_at + 13.days }\n end" ]
[ "0.68071556", "0.68060905", "0.677476", "0.6774061", "0.6765638", "0.67286915", "0.6709092", "0.66983825", "0.6658313", "0.66545635", "0.6653472", "0.6650867", "0.6645448", "0.6645448", "0.66445667", "0.6553049", "0.6543486", "0.6527468", "0.6495556", "0.6450873", "0.6405137", "0.6372145", "0.63661313", "0.6294166", "0.62909675", "0.6282084", "0.6277416", "0.62728184", "0.6257202", "0.61862475", "0.61822426", "0.61821383", "0.61762553", "0.6162249", "0.6150694", "0.6129974", "0.61127275", "0.6105998", "0.60745233", "0.6071814", "0.60272914", "0.60257894", "0.6022471", "0.60197735", "0.6009016", "0.5997417", "0.59959817", "0.59936494", "0.59861517", "0.59714186", "0.59623355", "0.59400237", "0.5925982", "0.59194416", "0.5911583", "0.59050214", "0.58941704", "0.5883584", "0.58799917", "0.5861836", "0.5861682", "0.5860338", "0.5853131", "0.5846577", "0.5844756", "0.58443886", "0.58204526", "0.5812893", "0.5810496", "0.5806571", "0.57955813", "0.5790703", "0.5784023", "0.57708305", "0.5770628", "0.57626426", "0.5760445", "0.5760413", "0.57592267", "0.57529044", "0.5750422", "0.5750195", "0.5750195", "0.5746391", "0.57403535", "0.57237935", "0.57176536", "0.5712835", "0.5706228", "0.57040226", "0.57037324", "0.5703034", "0.5701495", "0.56980217", "0.569207", "0.56920546", "0.5691849", "0.5690007", "0.5689445", "0.56732523" ]
0.7062001
0
Receivers and local participants share the stash_put and stash_get methods. The local participant has put and get which don't need an initial fei, thus get and put deal with the participant expression directly, whereas stash_put and stash_get can point at any expression. 'put' can be called as put('secret' => 'message', 'to' => 'embassy') or put('secret', 'message')
def put(key, value=nil) stash_put(fei, key, value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(action, **args); end", "def put(*args, &block); end", "def setup(stash, point)\n\t\t@stash = stash\n\t\t\n\t\t\n\tend", "def put(*args, &block)\n map_method(:put, args, &block)\n end", "def store *args, &block; put *args, &block; end", "def put(obj)\n end", "def stash(kwds={})\n @stash = default_stash if @stash.nil?\n kwds.empty? ? @stash : @stash.update(kwds)\n @stash\n end", "def put(*params); raise('Stub or mock required.') end", "def put\n raise NotImplementedError\n end", "def stash\n stashes[@context]\n end", "def stash()\n merge(stash: 'true')\n end", "def storeStakeholder(param) \n #TODO\n end", "def put!\n request! :put\n end", "def put(key, value); end", "def put(key, value)\n \n end", "def stash_bottle(bottle)\n Stash.new(self, bottle)\n end", "def test_stash\n\n BLACKBOARD.clear\n\n pdef = Ruote.process_definition do\n alpha :token0 => 'of esteem', :token1 => 'of whatever'\n end\n\n @dashboard.register_participant :alpha, StashingParticipant\n\n #@dashboard.noisy = true\n\n wfid = @dashboard.launch(pdef)\n wait_for(:alpha)\n wait_for(1)\n\n ps = @dashboard.process(wfid)\n fexp = ps.expressions.find { |e| e.fei.expid == '0_0' }\n\n assert_equal(\n { 'token0' => 'of esteem', 'token1' => 'of whatever' },\n fexp.h.stash)\n\n @dashboard.cancel_process(wfid)\n wait_for(wfid)\n\n assert_equal(\n 'of esteem',\n BLACKBOARD['token0'])\n assert_equal(\n { 'token0' => 'of esteem', 'token1' => 'of whatever' },\n BLACKBOARD['all'])\n end", "def update\n ## Normal update behavior\n @stash = Stash.find(params[:id])\n \n ## check to make sure we're not adding a networked stash tunnel\n unless params[:create_tunnel] == \"true\"\n Rails.logger.debug \"Regular update\"\n respond_to do |format|\n if @stash.update_attributes(params[:stash])\n format.html { redirect_to @stash, :notice => 'Stash was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stash.errors, :status => :unprocessable_entity }\n end\n end\n else\n \n ## Begin create tunnel behavior\n Rails.logger.debug \"Create tunnel behavior begin\"\n unless params[\"stash\"][\"id\"].blank?\n Rails.logger.debug \"Params check out\"\n Rails.logger.debug \"Tunnel to #{params[\"stash\"][\"id\"]}\"\n tunnel_to = (params[\"stash\"][\"id\"]).to_i\n @tunnel_to_stash = Stash.find(tunnel_to)\n @stash.network_stashes << @tunnel_to_stash\n else\n @stash.errors.add :base, \"There was no stash id provided to create a new tunnel.\"\n end\n \n respond_to do |format|\n if @stash.save\n format.html { redirect_to @stash, :notice => 'Stash was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stash.errors, :status => :unprocessable_entity }\n end\n end\n \n end ## end create tunnel behavior \n end", "def push_test\n #@catchpoint.put(x)\n end", "def put *args, &block\n handle @conn.put *args, &block\n end", "def put(*args)\n execute(:put, *args)\n end", "def put(*args, &block)\n self.client.put *args\n end", "def put(path, **args); end", "def put(data)\n end", "def poteti_put(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, 'PUT')\n end", "def put(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('put')\n end\n end", "def put(msg)\n abstract_method_error\n end", "def smash!(options = {})\n\t\tself.replace(smash, options)\n\tend", "def put(*args)\n request(:put, *args)\n end", "def put(*args)\n request :put, *args\n end", "def method_missing(method, *args)\n if method.to_s[-1,1] == '='\n self.put(method.to_s.tr('=',''), *args)\n else\n self.get(method)\n end\n end", "def push! &put\n ( put || proc {|obj|} ).call @blocks[ @push_at & (@depth-1) ]\n @push_at += 1\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def put(path, &block)\n route 'PUT', path, &block\n end", "def setup(*_)\n @http_path = args.fetch(:path, '/')\n @http_method = args.fetch(:method, 'get').to_s.downcase.to_sym\n super\n if(message_queues[queue_key])\n raise ArgumentError.new \"Conflicting HTTP path source provided! path: #{http_path} method: #{http_method}\"\n else\n message_queues[queue_key] = Smash.new(\n :queue => Queue.new\n )\n end\n message_queues[queue_key].merge!(\n Smash.new(:config => args.to_smash)\n )\n end", "def set_stash_element\n @stash_element = StashElement.find(params[:id])\n end", "def put (item, tube_alias = nil)\n begin\n self.attempt_to_log \"Puter#put message received. #{item} and tube_alias #{tube_alias}\"\n tube = self.tube(alias: tube_alias)\n payload = self.generate_message item\n r = tube.put payload\n self.attempt_to_log \"Puter#put message queued containing #{item}, result = #{r}\"\n rescue => e\n self.attempt_to_log \"Puter#put failure - exception encountered type = #{e.class} and message = #{e.message}\"\n raise e\n end\n r\n end", "def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end", "def put(cache_method, value)\n cache.send(\"#{cache_method}=\", value)\n end", "def put(data)\n enter(canonical(data))\n nil\n end", "def universal_put\n catch :flash_now do \n @entity = put\n end\n list_again\n rescue ActiveRecord::RecordInvalid => e\n render_error_messages(e)\n end", "def put( text, destination = @channel )\n $reby.putserv \"PRIVMSG #{destination} :#{text}\"\n end", "def show\n @shelter = Shelter.find(params[:id])\n @user = @shelter.user\n @mailbox ||= current_user.mailbox\n end", "def << s\n peeraddrs[s] = s.peeraddr\n stashes[@context] << s\n end", "def put(key, value)\n @first.put(key, value)\n end", "def itemized_stash_data(users)\n user = users.first\n # enable stash for the user?\n end", "def put(code)\n Log.put(code)\n puts\nend", "def put(value)\n $_api_queue.clear\n puts \"#{ApiSettings::API_PUT_PREFIX}#{value.to_s}#{ApiSettings::API_CMD_SUFFIX}\"\nend", "def store(object)\n @collector.sending_stream.puts pack(:store, object)\n end", "def put(splat)\n bad_request if splat.empty?\n _put resolve_uri(splat[0]), request.body.read\n end", "def put(path, *data, &block)\n map(path, R3::PUT, *data, &block)\n end", "def stash_params\n params.require(:stash).permit(:name, :comment)\n end", "def push(id, body)\n mods = @entrance.push(id, body)\n return mods if @remotes.all.empty?\n mods.each do |m|\n next if @seen.include?(m)\n @mutex.synchronize { @seen << m }\n @modified.push(m)\n @log.debug(\"Spread-push scheduled for #{m}, queue size is #{@modified.size}\")\n end\n mods\n end", "def put_on_a_hat\n\n # set all instance variables we have in the sinatra request object\n self.instance_variables.each { |v| @sinatra.instance_variable_set(v, self.instance_variable_get(v)) }\n\n end", "def put(path, options={}, &b)\n event(:put, path, options, &b)\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @security_origin = args[:security_origin] if args.key?(:security_origin)\n @value = args[:value] if args.key?(:value)\n end", "def puts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:put,path,params,opts,&block)\n end", "def ticket=(ticket)\n ticket.passenger = self\nend", "def put(namespace, key, entry); end", "def fputm(fname, sname, args)\n put = false\n if fexists fname, sname\n if eval \"$#{fname}['#{sname},facets'].include? 'ref'\"\n fname2 = eval \"$#{fname}['#{sname},ref']\"\n if eval \"$#{fname}['#{sname},facets'].include? 'ifref'\"\n eval \"eval $#{fname}['#{sname},ifref']\"\n end\n put = fputm(fname2,sname,args)\n else\n if eval \"$#{fname}['#{sname},facets'].include? 'method'\"\n if eval \"$#{fname}['#{sname},ref'].include? 'ifputm'\"\n eval \"eval $#{fname}['#{sname},ifputm']\"\n end\n eval \"$#{fname}['#{sname},method'] = args\"\n put = true\n end\n end\n end\n return put\nend", "def put(key, value)\n return if @cap <= 0\n fav = @c[key]\n if fav\n return\n end\n \n end", "def put(data = \"\")\n submit :Put, data\n end", "def sinterstore!(*other_keys)\n redis_client.sinterstore(key, *other_keys)\n end", "def tell_op(message)\n @Mailbox.push_op(message).then(self) { |_ch, actor| actor }\n end", "def put(item)\n @inv.push(item)\n end", "def put(payload = {})\n request! do\n api[url.path].put(to_payload(payload), API_HEADERS)\n end\n end", "def store(from, nonce, data)\n fail ReportError.new self, msg: 'mailbox.store() : wrong params' unless data and\n from and from.length == HPK_LEN\n\n b64_from = b64enc from\n b64_nonce = b64enc nonce\n b64_data = b64enc data\n\n item = {\n from: b64_from, # hpk of mailbox sending this message\n nonce: b64_nonce, # the nonce originator used for his encryption\n data: b64_data, # encrypted payload\n time: Time.new.to_f # time message is received by relay\n }\n\n _resetCount()\n res = runMbxTransaction(@hpk, 'store') do\n # store message itself on the msg_hpk_nonce tag\n rds.set(msg_tag(b64_nonce), item.to_json)\n rds.expire(msg_tag(b64_nonce), @tmout_msg)\n\n # mbx_hpk is used as index hash\n rds.hset(hpk_tag, b64_nonce, Time.new + @tmout_msg)\n rds.expire(hpk_tag, @tmout_mbx)\n # by default everytihing in mailbox will expire in 3 days\n end\n return res\n end", "def local_spares\n #super.merge(:rear_shock => rear_shock)\n {:rear_shock => rear_shock}\n end", "def put(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.put('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end", "def store(key, value)\r\n obj = for_context(self) { |c| c.store(key, value); c }\r\n return if obj != self \r\n super(key, value)\r\n end", "def put(ps)\n @piece += ps\n self\n end", "def method_missing(sym, *args, &block)\n @mash.send(sym, *args, &block)\n end", "def put(name,&block)\n build_resource(name, :put, &block)\n end", "def put(request)\n request.method = :put\n request.call\n end", "def put\n\t\t\tputs STACK.last \n\t\tend", "def put(path, headers = {})\n process :put, path, headers\n end", "def put(name, start, value)\n access.put(unwrap, name, value) { super }\n end", "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def send!\n return false unless valid?\n Stalker.instance_for(self.recipient).put(self)\n end", "def put\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n put_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 296:6: ( 'P' | 'p' ) ( 'U' | 'u' ) ( 'T' | 't' )\n if @input.peek( 1 ).between?( T__12, T__13 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__14, T__15 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__16, T__17 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 19 )\n memoize( __method__, put_start_index, success ) if @state.backtracking > 0\n\n end\n \n return \n end", "def put(io, context)\n copy(io, context)\n end", "def put_clone\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/clone\", { \n headers: {\"Fastly-Key\" => $key} \n })\n end", "def set(key, value)\n peek[key.to_sym] = value\n end", "def stash_id\n data[:stash_id]\n end", "def put?\r\nHTTP_METHOD_LOOKUP[request_method] == :put\r\nend", "def put path, payload\n response = connection.put path, payload\n return true if response.empty?\n return symbolize_keys(response.keys, response)\n end", "def put(path, options = {}, &block)\n map(path, options, :put, &block)\n end", "def put(key, value)\n\n # FIXME: insert code that connects to the backend and affects the put\n # operation\n #\n # - This delete should be done atomically\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => false, :err_msg => 'FIXME: not implemented' }\n end", "def setup(stash, point)\n\t\t@stash = stash\n\t\t\n\t\t# ah, but this assumes that all Entity objects can be created without parameters\n\t\tobj = @klass.new\n\t\tobj[:physics].body.p = point\n\t\[email protected] obj\n\t\t\n\tend", "def put(obj)\n # TODO high watermark check\n # NOTE: predicate will call #try_connect\n @work_queue.schedule {\n send(obj)\n }\n \n @work_queue.exclusive {\n # If we're connected, shut down the worker thread, do all the work\n # here.\n check_connection_state\n }\n \n @work_queue.try_work\n end", "def receive(location, op)\n t = Tracker.new(@id, Array.new(@track) << Stamp.new(location, op).freeze())\n t.track.freeze()\n t.freeze()\n end", "def put(path, payload)\n req = Net::HTTP::Put.new(path)\n action(req, payload)\n end", "def put(*args)\n request, adapter = request_and_adapter_from(args)\n\n with_adapter :put, request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.put request\n end\n end", "def get_and_set(key, value); end", "def put(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, \"PUT\")\n end", "def raw_put(path, body, options = {})\n # Allow format override\n format = options.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Create PUT request\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", \n :verbose => DEBUG,\n :method => \"put\",\n :body => body,\n :headers => { :'Content-type' => options[:content_type] || content_type(format) }\n )\n # Send request\n do_request(put, format)\n end", "def store(value, *key)\n @cache[key] = value\n end", "def update!(**args)\n @payload = args[:payload] if args.key?(:payload)\n end", "def put(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, 'PUT')\n end", "def put(message)\n message.recipient ||= self.tube_name\n raise \"message invalid: #{message.errors}\" unless message.valid?\n @tube.put message.to_json\n end" ]
[ "0.5950176", "0.5928903", "0.5537035", "0.5534227", "0.54704285", "0.54209244", "0.53131396", "0.5263091", "0.52621305", "0.52610976", "0.52190435", "0.51065546", "0.5093494", "0.5082537", "0.5081666", "0.5049095", "0.50184506", "0.50062263", "0.4982559", "0.48761484", "0.48724836", "0.48362625", "0.48030636", "0.47833377", "0.47758836", "0.47622907", "0.47393718", "0.4698387", "0.46712327", "0.46667755", "0.46561697", "0.4651877", "0.46471092", "0.46470442", "0.4632738", "0.4632402", "0.4618315", "0.45811024", "0.45806772", "0.45730907", "0.45668006", "0.45608014", "0.4539532", "0.45330277", "0.45255736", "0.45184752", "0.4512238", "0.45122123", "0.4496894", "0.44870484", "0.44749472", "0.44485983", "0.44453892", "0.44359007", "0.44228968", "0.44172022", "0.44163033", "0.44062307", "0.43990168", "0.4394825", "0.43907732", "0.43853462", "0.4382613", "0.43723422", "0.4371109", "0.43656462", "0.43649203", "0.43646628", "0.43617183", "0.43605417", "0.4354952", "0.43507913", "0.43491584", "0.43366134", "0.43220598", "0.4318265", "0.43174464", "0.43152434", "0.4309459", "0.43093625", "0.43044105", "0.43041757", "0.43036136", "0.4281344", "0.4277386", "0.42739648", "0.42689428", "0.42664889", "0.42657414", "0.42652714", "0.42650414", "0.42630038", "0.42603052", "0.42516834", "0.42508316", "0.4242133", "0.4231665", "0.4231454", "0.4226684", "0.42259112" ]
0.5914395
2
give random card from existing deck
def random_card result = @deck.sample(1) @deck.delete result result.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_card\n return @deck[rand(@deck.length)]\n end", "def get_card (random_num)\n\t\t@deck[random_num]\n\tend", "def create_card(deck)\n card = deck.shuffle.pop\nend", "def random\n card_dealt = @possible_cards.sample\n end", "def random_card\n # @deck[1].rank\n size = @deck.size\n \"#{@deck[rand(size)].rank} #{@deck[rand(size)].suit}\"\n end", "def get_card\n all_cards = self.deck.cards\n correct_cards = self.guesses.where(correct: true).map { |guess| guess.card }\n (all_cards - correct_cards).shuffle.sample\n end", "def pick_random_card\n random_card = @all_cards.sample\n remove_card(random_card)\n return random_card\n end", "def randomCard\n\t\trarity = randomRarity\n\t\tgolden = randomGold(rarity)\n\t\tmakeCard(rarity, golden)\n\tend", "def get_card()\n return @cards.delete_at(rand(@cards.length))\n end", "def pick_player_card\n # TODO: Use Random to get a new random card\n rand(1..11)\nend", "def draw_card\n cards_in_deck = @playing_deck.length - 1\n draw_num = rand(0..cards_in_deck)\n card = @playing_deck[draw_num]\n @playing_deck = @playing_deck - [@playing_deck[draw_num]]\n\n card\n end", "def select_card\n num_random = rand(@cards.length)\n card = @cards[num_random]\n @cards.delete_at(num_random)\n card\n end", "def get_random_card\n return self.cards.where(:location => -1)[rand(self.cards.where(:location => -1).length)]\n end", "def pick_random\n @card_list.pick_random\n end", "def pick_random\n @card_list.pick_random\n end", "def pick_random\r\n @card_list.pick_random\r\n end", "def deal_card\n return rand(1..11)\nend", "def deal_card\n rand(1...12)\nend", "def newCard\n\t@card = Cards.new\n \[email protected]\n end", "def draw # draw one card at random\n build_deck if cards.empty?\n ndx = (0...cards.size).to_a.sample\n cards.delete_at(ndx)\n end", "def show_card\n\t\[email protected]\n\tend", "def deal_card\n card = rand(11) + 1\nend", "def deal_card\n random = rand(@playable_cards.size)\n @playable_cards.delete_at(random)\n end", "def random\n random_card = self.class.get('/cards/random')\n end", "def random_remaining_card\n correct_guesses_array = self.guesses.where(correctness: true)\n correct_guess_id_array = correct_guesses_array.map do |guess|\n guess.card_id\n end\n if correct_guess_id_array == []\n cards = self.deck.cards\n else\n cards = self.deck.cards.where('id not in (?)', correct_guess_id_array)\n end\n cards.sample\n end", "def load_card #(draw card?)\n @cards_array.shuffle!.shift\n end", "def deal_card\r\n random = rand(@playable_cards.size)\r\n @playable_cards.delete_at(random)\r\n end", "def the_draw_card(deck_value, deck_card_name, cards, cards_value, random)\n cards = cards[random]\n deck_card_name.delete_at(random.to_i)\n return cards\n end", "def pick_random\n if @cards.length == 0\n return false\n end\n index = rand(@cards.length)\n card = @cards[index]\n @cards.delete_at(index)\n card\n end", "def generate_card\n\t suit = %w[s d h c]\n\t rank = %w[1 2 3 4 5 6 7 8 9 10 j q k]\n\t #(0...size).map{ charset.to_a[rand(charset.size)] }.join\n\t suit[rand(suit.size)] + rank[rand(rank.size)] + \".gif\"\n\tend", "def get_card()\n card = @cards[@deck_index % @max_deck_mod]\n @deck_index += 1\n if @deck_index == @max_deck_mod\n #recreate shoe\n puts \"\\n\\n****CREATING NEW DECK****\\n\\n\"\n create_deck(@num_decks )\n end\n return card\n end", "def random\n card = rand(1..52)\n card.to_i\n end", "def random\n card = rand(1..52)\n card.to_i\n end", "def get_card_and_put_in_hand(which_hand)\n the_card = @deck_current.delete_at(rand(@deck_current.length))\n\n if which_hand === \"dealer\"\n @hand_dealer.push(the_card)\n\n elsif which_hand === \"player\"\n @hand_player.push(the_card)\n\n end\n \nend", "def hand_over_player \r\n puts \"Player getting 1 random card...\"\r\n @random_card = @game_deck.random_card # def random card\r\n random_card_val = @game_deck.deck[@random_card]\r\n @player_deck[@random_card] = random_card_val # to player\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@player_deck = #{@player_deck}\"\r\n\r\n end", "def draw_card\n #suit = Card::SUITS.sample\n #rank = Card::RANKS.sample\n #Card.new(suit: suit, rank: rank)\n @cards.pop\n end", "def random_card\r\nsuit = [' of hearts', ' of spades', ' of diamonds', ' of clubs']\r\nrank = [2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King', 'Ace']\r\n\tcard_rank = rank[rand(13)]\r\n\tcard_suit = suit[rand(4)]\r\n\tcard = card_rank.to_s + card_suit\r\n card\r\nend", "def hit(deck)\n rand_card = deck.sample # pulls a random card from the playing deck.\n deck.delete(rand_card)\nend", "def create_deck\n @deck = CARDS.product(SUITS).shuffle\n end", "def hand_over_dealer\r\n puts \"Dealer getting 1 random card...\"\r\n @random_card = @game_deck.random_card # def random card\r\n random_card_val = @game_deck.deck[@random_card]\r\n @dealer_deck[@random_card] = random_card_val # to dealer\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@dealer_deck = #{@dealer_deck}\"\r\n end", "def deal_card(hand)\n\t# pick a random card and add to the hand\n\tindex = rand($card_deck.length)\n\thand << $card_deck[index]\n\n\t# remove the card from the deck\n\t$card_deck.delete_at(index)\nend", "def playcard\n @cards.shuffle.slice!(0,2)\n end", "def draw_card(cards)\n card = cards.to_a.sample(1).flatten\n cards.delete(card[0])\n card\nend", "def get_new_card\r\n\r\n #Assign a random number between 1 and 13 as the value of the card being\r\n #created\r\n card = 1 + rand(13)\r\n\r\n #A value of 1 is an ace, so reassign the card a value of 11\r\n return 11 if card == 1\r\n\r\n #A value of 10 or more equals a face card so reassign the card a value\r\n #of 10\r\n return 10 if card >= 10\r\n\r\n return card #Return the value assigned to the new card\r\n\r\n end", "def get_new_card\n \n #Assign a random number between 1 and 13 as the value of the card being \n #created\n card = 1 + rand(13)\n \n #A value of 1 is an ace, so reassign the card a value of 11\n return 11 if card == 1 \n\n #A value of 10 or more equals a face card so reassign the card a value\n #of 10 \n return 10 if card >= 10\n \n return card #Return the value assigned to the new card\n \n end", "def deal_cards(old_deck, num_cards)\n hand = old_deck.sample(num_cards)\n new_deck = old_deck - hand\n return [hand, new_deck]\nend", "def build_deck\n CARD_SUITS.product(CARD_VALUES).shuffle\nend", "def random_flush\n suit = [\"♠\", \"♣\", \"♡\", \"♢\"].sample\n Card.where(suit: suit).sample(5)\nend", "def get_trump_card\n if self.trump_card.nil?\n trump_index = rand(self.cards_set.length)\n self.trump_card = self.cards_set[trump_index]\n self.cards_set.delete_at(trump_index)\n end \n send_update\n return self.trump_card\n end", "def take_card\n @deck.shift\n end", "def shuffle\n @deck.sort_by{rand}\n end", "def insert_random(card)\n @cards.insert(Random.new().rand([email protected]), card)\n end", "def shuffle!\n @cards = self.cards.sort_by { rand }\n end", "def select_card(dck)\n # sample the deck array, returns a suit return the value obj and sample\n dck.sample.each_with_object({}) do |suit, obj|\n crd = suit[1].to_a.sample\n suit = suit[0]\n obj[suit] = { crd[0] => crd[1] }\n # remove card from deck\n dck = dck.each do |val|\n val.each do |k, v|\n if k == suit\n # mutate the deck\n v.reject! { |key, _| key == crd[0] }\n end\n end\n end\n end\nend", "def createDeck\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\[email protected]!\t\n\tend", "def create_shuffled_deck\n # value = (2..10).to_a\n ranks = (2..10).to_a + [\"J\", \"Q\", \"k\", \"A\"]\n values = (2..14).to_a\n suits = [\"Spades\", \"Diamonds\", \"Hearts\", \"Clubs\"]\n\n # suits.each do |suit|\n # ranks.each_with_index do |rank|\n # @deck << Card.new(rank, value[index], suit)\n # end\n # end\n\n i = 0\n counter = 0\n temp_deck = []\n until i == 4\n (0...ranks.length).each do |j|\n temp_deck << Card.new(ranks[j], values[j], suits[i])\n counter += 1\n end\n i += 1\n end\n\n #Shuffling cards\n until temp_deck.length == 0\n index = rand(0...temp_deck.length)\n self.add_card(temp_deck[index])\n temp_deck.delete_at(index)\n end\n counter\n end", "def draw_random\n @cards.delete_at(Random.new().rand([email protected]))\n end", "def choose_cards(turn, player)\n num = rand(turn.turn_stack_inspect.size)\n num += 1\n\n if turn.turn_card_on_deck?\n rand_num = rand(2)\n case\n when rand_num == 0: Array.new.push(turn.turn_get_a_card_from_deck)\n when rand_num == 1: turn.turn_get_cards_from_stack(num)\n end\n else\n turn.turn_get_cards_from_stack(num)\n end\n end", "def choose_cards(turn, player)\n if turn.turn_card_on_deck?\n rand_num = rand(2)\n list_of_cards = case\n when rand_num == 0: Array.new.push(turn.turn_get_a_card_from_deck)\n when rand_num == 1: turn.turn_get_cards_from_stack(1)\n end\n else\n list_of_cards = turn.turn_get_cards_from_stack(1)\n end\n list_of_cards.concat(turn.turn_get_cards_from_stack(1))\n end", "def play_like_a_dummy\r\n # very brutal algorithm , always play the first card\r\n card = @cards_on_hand.pop\r\n return card\r\n end", "def get_card\n @deck.pop\n end", "def generate_new_card\n new_card = @my_deck.grab_single_card\n old_card = @old_card\n user_guess = @guess\n puts \"\"\n puts new_card\n puts \"\"\n compare_cards(new_card, old_card, user_guess)\n end", "def deal_card\n if @unshuffled_deck[-1] == nil\n @unshuffled_deck = @addhand\n @addhand = @emptyarray\n @x = 0\n end\n card = @unshuffled_deck[@x]\n @unshuffled_deck[@x] = nil\n @x+=1\n return card\n end", "def shuffle(name = @cur_deck_name)\n getDeck\n end", "def choose_cards(turn, player)\n num = rand(turn.turn_stack_inspect.size)\n num += 2\n\n turn.turn_get_cards_from_stack(num)\n end", "def generate_deck\n (1..3).to_a.product(@colors, @shapes, @textures).each{|arr| @deck.push(Card.new(arr[0], arr[1], arr[2], arr[3]))}\n @deck.shuffle!\nend", "def discard_card(player)\n if player.player_hand.size == 0\n return nil\n elsif player.player_hand.size == 1\n return player.player_hand.hand_to_list.first\n else\n rand_index = rand(player.player_hand.size)\n return player.player_hand.hand_to_list.fetch(rand_index)\n end\n end", "def shuffle\n @cards.replace @cards.sort_by {rand}\n end", "def draw_from(deck)\n cards.concat(deck.take(1))\n end", "def deal_cards\n if @deck.length != 0\n puts \"Dealt 3 more cards\"\n for i in 0...3\n r = rand([email protected])\n @cards_in_play.append(@deck[r])\n @deck.delete_at(r)\n end\n else\n puts \"There are no more cards in the deck!\"\n end\nend", "def shuffle\r\n @deck_of_cards.shuffle!\r\n end", "def choose_card \n\n @cards.shift\n end", "def deal_a_card(from_the_deck)\n #delete any empty hashes from the deck array otherwise there will be an error because it will be picking a nil result\n if from_the_deck.include?({})\n from_the_deck.delete({})\n end\n \n deck_chosen_from = from_the_deck.sample\n key_chosen_from_deck = deck_chosen_from.keys.sample\n value_chosen_from_deck = deck_chosen_from[key_chosen_from_deck].sample\n \n remove_from_deck(deck_chosen_from, key_chosen_from_deck, value_chosen_from_deck)\n\n #delete any hash key with an empty array value otherwise there will be an error because it will be picking a nil result\n if deck_chosen_from[key_chosen_from_deck].empty?\n deck_chosen_from.delete(key_chosen_from_deck)\n end\n\n picked_card = [key_chosen_from_deck, value_chosen_from_deck]\nend", "def create_deck\n suits = [\"Hearts\", \"Diamonds\", \"Spades\", \"Clubs\"]\n values = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Ace', 'Jack', 'Queen', 'King']\n\n deck = []\n\n suits.each do |suit|\n values.each do |value|\n deck << \"#{suit}: #{value}\"\n end\n end\n\n return deck.sample(52) # .sample method returns a random element \nend", "def drawcard\n @deck.pop\n end", "def generate_deck # ANTHONY\n @suits.each do |suit|\n @rank.each do |rank|\n color = (suit == 'Spades' || suit == 'Clubs') ? 'Black' : 'Red'\n @cards << Card.new(rank, suit, color)\n end\n end\n end", "def get_random_number\n\t\trandom_num = rand(@deck.length)\n\tend", "def shuffle!\n cards.shuffle!\n end", "def shuffle_cards\n n = self.cards.length - 1\n while n > 0\n i = rand(n -= 1 )\n temp = self.cards[i]\n self.cards[i] = self.cards[n]\n self.cards[n] = temp\n # can be written more elegantly like:\n # self.cards[i], self.cards[n] = self.cards[n], self.cards[i]\n end\n self.cards.each do |c|\n puts c.face\n end\n self\n end", "def initialize_deck\n deck = []\n SUIT.each do |suit|\n CARDS.each do |card|\n deck << [suit, card]\n end\n end\n deck.shuffle!\nend", "def discard_card(player)\n if player.player_hand.size == 0\n return nil\n elsif player.player_hand.size == 1\n return player.player_hand.hand_to_list.first\n elsif player.player_hand.wildcards.size > 0\n wildcards = player.player_hand.wildcards\n rand_index = rand(wildcards.size)\n return wildcards.fetch(rand_index)\n else\n rand_index = rand(player.player_hand.size)\n return player.player_hand.hand_to_list.fetch(rand_index)\n end\n end", "def add card\r\n # Unlucky for some !\r\n # Sometimes Moody Players won't play.\r\n if rand(40)==13\r\n puts \"Moody player didn't play!\"\r\n else\r\n @card_list.add card\r\n end\r\n end", "def shuffleCards!()\n\t\[email protected]!\n\tend", "def shuffle\n @cards.shuffle! \n end", "def shuffle\r\n @cards.shuffle!\r\n end", "def randomRare\n\t\tgolden = randomGold(:rare)\n\t\tmakeCard(:rare, golden)\n\tend", "def get_question\n index = rand(@question_cards.count)\n q_card = @question_cards[index]\n @question_cards.delete_at(index)\n return q_card.value\n end", "def shuffle_deck\n if [email protected]?\n @cards = manual_shuffle\n end\n end", "def random \n if params[:random]\n @card = Card.where(:first => params[:random]).sample\n else\n # @card = Card.all.sample\n rand_id = rand(Card.count)\n @card = Card.first(:conditions => ['id >= ?', rand_id])\n end\n\n respond_to do |format|\n format.html #first.html.erb\n format.json { render json: @card }\n end\n end", "def shuffle\n @cards.shuffle!\n end", "def current_repetition\n @cards = current_user.cards_due\n @card = @cards.sample\n end", "def index\n @card = @deck.cards.find(:first, :order => 'RAND()')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cards }\n end\n end", "def shuffle\n @cards.shuffle!\n end", "def shuffle!\n @deck.shuffle!\n end", "def shuffle!\n @deck.shuffle!\n end", "def draw_for(player)\n @cards.shuffle!\n player.cards << @cards.pop\n end", "def initialize_deck\n VALUES.product(SUITS).shuffle\nend", "def generate_a_deck\n Card::SUITS.map do |suit|\n Card::RANKS.map do |rank|\n Card.new(suit: suit, rank: rank)\n end\n end.flatten\n end", "def shuffle\n @deck.shuffle! # Contents of @deck will be permanently changed\n end", "def get_cards(deck)\n\n end" ]
[ "0.8859846", "0.8326462", "0.8264971", "0.8244094", "0.8235121", "0.8228347", "0.82211405", "0.8096481", "0.80816954", "0.8058726", "0.79990375", "0.7897901", "0.7888068", "0.7815481", "0.7815481", "0.7799077", "0.773085", "0.7695517", "0.7694014", "0.7665135", "0.76401836", "0.76371926", "0.76246506", "0.76214606", "0.757327", "0.7572698", "0.7566794", "0.75552636", "0.7549424", "0.75160986", "0.74896663", "0.7481332", "0.74793184", "0.74744135", "0.74258083", "0.74044317", "0.7383486", "0.73781306", "0.73675454", "0.73153925", "0.7288892", "0.7245272", "0.72122276", "0.7211911", "0.7209917", "0.718593", "0.71675634", "0.7133148", "0.7114301", "0.71083796", "0.7099267", "0.7068135", "0.7063703", "0.70633316", "0.70620847", "0.7042648", "0.70189863", "0.7011528", "0.70106643", "0.7009622", "0.70016384", "0.69991213", "0.69871444", "0.6977806", "0.6952987", "0.6950155", "0.6950119", "0.6915821", "0.6913493", "0.69107723", "0.6904473", "0.68959314", "0.687766", "0.6868904", "0.684764", "0.6845928", "0.6835249", "0.6826231", "0.6821195", "0.6804471", "0.67881715", "0.6771674", "0.67690563", "0.67676824", "0.67664725", "0.67611355", "0.6757443", "0.67539525", "0.67371494", "0.673307", "0.6730995", "0.67246985", "0.67095166", "0.6697036", "0.6697036", "0.6696984", "0.669672", "0.6695577", "0.6692891", "0.6691403" ]
0.8746319
1
game is active now?
def game_unactive? !@game_active end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_active_game\n # TODO\n end", "def active?\n game.winner.nil?\n end", "def game_paused? ; @game_paused end", "def game_running?\n @game_running\nend", "def in_battle?\n Game_Temp.in_battle\n end", "def event_running?\n @battle_event.active?\n end", "def game_has_started?\n game.move > 0\n end", "def is_alive\n @state == ALIVE\n end", "def game_started_for (user)\n user_state[user] == :playing\n end", "def active?\n\t\tstatus == STATUSES[2]\n\tend", "def current_player_is_alive?\n @players[@current_player_index].is_alive?\n end", "def active?\n activated == true\n end", "def active?\n true\n end", "def game_state\n end", "def active?\r\n @event.parallel? && $game_switches[@event.switch_id]\r\n end", "def active?\n if is_active\n return true\n else\n return false\n end\n end", "def active?\n end", "def active?\n end", "def current?\n return self.tournament.live?\n end", "def game_over?\n true\n end", "def active?\n if is_active\n return true\n else\n return false\n end\n end", "def active?\r\n self.team.active?\r\n end", "def active?\n true\n end", "def game_over?\n return @gamestate.checkmate?(@current_player.team)\n end", "def active?\n active\n end", "def started?\n !game_over? && status == Game::RUNNING && started_at.present?\n end", "def game_over?\n alive_players.count == 1\n end", "def idle\n gateway_check\n update_status((Time.now.to_f * 1000), @game, nil)\n end", "def active\n active?\n end", "def active?; status == :active; end", "def ongoing?\n \tself.active and self.winner.nil?\n end", "def active?\n return false if status != :active\n !ended?\n end", "def over?\n \t@game_over = true\n end", "def game_over?\n @game_over\n end", "def active?\n active\n end", "def active?\n\t\t\treturn account_life_cycle_status == ACTIVE \n\t\tend", "def active?\n\t\t\tstate == 'active'\n\t\tend", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def playable?\n @my_turn && @game_status != :ended\n end", "def membership_active?\n active_at?(Time.now)\n end", "def ongoing_game\n games(game_state: \"ongoing\", role: \"player\").any? ? games(game_state: \"ongoing\", role: \"player\")[0] : false\n end", "def any_active_game\n games.where(\"status = 1\").any?\n end", "def game_mode; end", "def active?\n true\n end", "def active?\n true\n end", "def active?\n true\n end", "def active?\n return extender_active? if not in_battle?\n @event.for_battle? && @event.battle_trigger.call()\n end", "def is_active?\n is_active\n end", "def is_active?\n is_active\n end", "def active?\n @status == :established\n end", "def active?\n status == STATUS[:active]\n end", "def game_play?()\n if self.admin\n return false\n elsif self.team.nil?\n return false\n elsif !self.team_adopt\n return false\n end\n game=Game[self.team.active_game]\n if game.nil?\n return false\n end\n\n if game.run?\n return true\n elsif game.owner?(self)\n return true\n end\n\n return false\n end", "def is_active?\n @@instance ? true : false\n end", "def idle?\n @state == :idle\n end", "def active?\n (status == ACTIVE)\n end", "def active?\n (status == ACTIVE)\n end", "def game_available_for? (user)\n user_state[user] == :invited\n end", "def idle?\n @idle\n end", "def active?\n @active != false\n end", "def active?\n return @active\n end", "def won?()\r\n\t\twin_game = false\r\n\t\t\r\n\t\tif()\r\n\t\t win_game = true\r\n\t end\r\n\t\t\r\n\t\treturn win_game\r\n\tend", "def became_active?\n active_changed? && active\n end", "def is_active?\n\t\tactive\n\tend", "def active?\n return true if status == 'active'\n\n false\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def is_alive?\n\t\treturn @alive\n\tend", "def active?\n status == 'active'\n end", "def game_ended?\n\t\treturn @game_ended\n\t end", "def is_active \n\t\tif self.servings == 0\n\t\t\tself.active = false\n\t\tend\n\t\tactive\n\tend", "def win?\n sleep(3)\n check_points\n end", "def won?\n @state.id == 14\n end", "def active?\n status == 'active'\n end", "def active?\n schedule.active?\n end", "def active?\n Time.current - recent_at <= PERIOD_ACTIVE\n end", "def is_alive;\t@alive \t\tend", "def currentgamemode\r\n\t\t\t@gamemode\r\n\t\tend", "def game_over?\n alive_robots.count == 1\n end", "def active?\n self.active\n end", "def active?\n self.active\n end", "def won?\n @game.started? && !detectives_won? && detectives_cannot_move?\n end", "def active?\n !!@active\n end", "def active?\n\t\tactive\n\tend", "def active?\n status == 'active'\n end", "def game_played?\n minutes > 0\n end", "def run_on_busy_tb?\n $game_message.busy?\n end", "def active?\n @state.active?\n end", "def ready_to_idle?\n logged_in? && !idling?\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def alive?\n self.status == \"Alive\"\n end", "def idle?\n @idle_time > 0\n end", "def in_use\n active? \n end", "def active?; end" ]
[ "0.85417086", "0.7637689", "0.75576115", "0.75097305", "0.7384127", "0.72765917", "0.7228609", "0.7218822", "0.7160009", "0.71311605", "0.71208596", "0.70827085", "0.7066289", "0.7065482", "0.7022806", "0.69871336", "0.6986222", "0.6986222", "0.69861585", "0.69831055", "0.6976126", "0.69751906", "0.69654804", "0.6952735", "0.6947554", "0.6944114", "0.6939317", "0.69374216", "0.6931609", "0.6914402", "0.6907299", "0.6896371", "0.6888357", "0.6881318", "0.6868991", "0.6863018", "0.6859754", "0.6855924", "0.6855924", "0.6855924", "0.6855924", "0.68507475", "0.68459517", "0.6835973", "0.6834333", "0.6827655", "0.6817019", "0.6817019", "0.6817019", "0.681634", "0.68092287", "0.68092287", "0.68084747", "0.6806711", "0.6805596", "0.6802819", "0.6797085", "0.67944527", "0.67944527", "0.67716616", "0.6767578", "0.6763579", "0.67559713", "0.6751353", "0.6738774", "0.6738616", "0.67220277", "0.6721154", "0.6721154", "0.6721154", "0.67165554", "0.67137986", "0.6712536", "0.6688105", "0.66868454", "0.6686103", "0.66859955", "0.6685822", "0.6685612", "0.66837156", "0.6669866", "0.66687226", "0.66609275", "0.66609275", "0.6658433", "0.6656492", "0.66550046", "0.66529727", "0.6651058", "0.66474515", "0.664697", "0.6639812", "0.66393507", "0.66369337", "0.66369337", "0.66369337", "0.66338253", "0.66300213", "0.66290015", "0.66280323" ]
0.74526805
4
Security stuff applies here Public it applies a single security check given by its name name the security check to be applied Examples engine.apply("CVE20131800") => boolean Returns a true value if the security check was successfully applied or false otherwise
def apply(name) load_knowledge_base if @checks.nil? return false if @checks.empty? @checks.each do |check| if check.name == name unless ((check.kind == Codesake::Dawn::KnowledgeBase::PATTERN_MATCH_CHECK || check.kind == Codesake::Dawn::KnowledgeBase::COMBO_CHECK ) && @name == "Gemfile.lock") debug_me "applying check #{check.name}" @applied_checks += 1 @applied << { :name=>name } check.ruby_version = @ruby_version[:version] check.detected_ruby = @ruby_version if check.kind == Codesake::Dawn::KnowledgeBase::RUBY_VERSION_CHECK check.dependencies = self.connected_gems if check.kind == Codesake::Dawn::KnowledgeBase::DEPENDENCY_CHECK check.root_dir = self.target if check.kind == Codesake::Dawn::KnowledgeBase::PATTERN_MATCH_CHECK check.options = {:detected_ruby => self.ruby_version, :dependencies => self.connected_gems, :root_dir => self.target } if check.kind == Codesake::Dawn::KnowledgeBase::COMBO_CHECK check_vuln = check.vuln? @vulnerabilities << {:name=> check.name, :message=>check.message, :remediation=>check.remediation, :evidences=>check.evidences, :vulnerable_checks=>nil} if check_vuln && check.kind != Codesake::Dawn::KnowledgeBase::COMBO_CHECK @vulnerabilities << {:name=> check.name, :message=>check.message, :remediation=>check.remediation, :evidences=>check.evidences, :vulnerable_checks=>check.vulnerable_checks} if check_vuln && check.kind == Codesake::Dawn::KnowledgeBase::COMBO_CHECK @mitigated_issues << {:name=> check.name, :message=>check.message, :remediation=>check.remediation, :evidences=>check.evidences, :vulnerable_checks=>nil} if check.mitigated? return true else debug_me "skipping check #{check.name}" @skipped_checks += 1 end end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(name)\n load_knowledge_base if @checks.nil?\n return false if @checks.empty?\n\n @checks.each do |check|\n if check.name == name\n @applied << { :name=>name }\n check.ruby_version = self.ruby_version[:version]\n check.detected_ruby = self.ruby_version if check.kind == Codesake::Dawn::KnowledgeBase::RUBY_VERSION_CHECK\n check.dependencies = self.connected_gems if check.kind == Codesake::Dawn::KnowledgeBase::DEPENDENCY_CHECK\n check.root_dir = self.target if check.kind == Codesake::Dawn::KnowledgeBase::PATTERN_MATCH_CHECK\n @vulnerabilities << {:name=> check.name, :message=>check.message, :remediation=>check.remediation, :evidences=>check.evidences} if check.vuln?\n @mitigated_issues << {:name=> check.name, :message=>check.message, :remediation=>check.remediation, :evidences=>check.evidences} if check.mitigated?\n return true\n end\n end\n\n false\n end", "def apply(name)\n load_knowledge_base if @checks.nil?\n return false if @checks.empty?\n\n @checks.each do |check|\n if check.name == name\n @applied << { :name=>name }\n check.ruby_version = @ruby_version[:version]\n check.detected_ruby = @ruby_version if check.kind == Codesake::Dawn::KnowledgeBase::RUBY_VERSION_CHECK\n check.dependencies = self.connected_gems if check.kind == Codesake::Dawn::KnowledgeBase::DEPENDENCY_CHECK\n check.root_dir = self.target if check.kind == Codesake::Dawn::KnowledgeBase::PATTERN_MATCH_CHECK\n check.options = {:detected_ruby => self.ruby_version, :dependencies => self.connected_gems, :root_dir => self.target } if check.kind == Codesake::Dawn::KnowledgeBase::COMBO_CHECK\n\n check_vuln = check.vuln?\n\n @vulnerabilities << {:name=> check.name, :message=>check.message, :remediation=>check.remediation, :evidences=>check.evidences, :vulnerable_checks=>nil} if check_vuln && check.kind != Codesake::Dawn::KnowledgeBase::COMBO_CHECK\n\n @vulnerabilities << {:name=> check.name, :message=>check.message, :remediation=>check.remediation, :evidences=>check.evidences, :vulnerable_checks=>check.vulnerable_checks} if check_vuln && check.kind == Codesake::Dawn::KnowledgeBase::COMBO_CHECK\n\n @mitigated_issues << {:name=> check.name, :message=>check.message, :remediation=>check.remediation, :evidences=>check.evidences, :vulnerable_checks=>nil} if check.mitigated?\n return true\n end\n end\n\n false\n end", "def check\n\t\treturn Exploit::CheckCode::Vulnerable\n\tend", "def run_for_deploy\n require_dsl\n\n return true if dsl.nil?\n run_check_classes(check_classes_named(dsl.deploy_checks))\n end", "def lint(name)\n before_lint\n public_send name\n after_lint\n true # for assertions\n end", "def check\n return Exploit::CheckCode::Vulnerable\n end", "def applyPhysicalAttack(x)\n if x.physical_attack == @value\n return true\n else\n return false\n end\n end", "def check_on_attack(attacker,target,atk_skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Attack[name]\n error = \"Kernel.eval Error | \"+name+\" | on_attack\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end end", "def check\n \n end", "def check\n \n end", "def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end", "def exec_granted?(controler, xllave)\n\t\tauth = Execremotekey.where(\"controler= '#{controler}' AND llave = '#{xllave}' \").first\n\t\tif auth == nil\n\t\t\tredirect_to noautorizado_url, notice: \"No esta autorizado a entrar a esta opcion\"\n\t\t\tfalse\n\t\telse\n\t\t\tauth.delete #para que no se reutilice la misma validacion\n\t\t\ttrue\n\t\tend\n\tend", "def check\r\n # Find a valid CGI target\r\n target_uri = find_target_cgi\r\n unless target_uri\r\n return Exploit::CheckCode::Unknown\r\n end\r\n return Exploit::CheckCode::Vulnerable\r\n end", "def allowSecurityManagement()\n banner(\"Allow Security\")\n @run.society.each_enclave() do |enclave|\n securityAgents = getSecurityAgents(enclave)\n securityAgentsName = \"SecurityAgentsIn#{enclave}\"\n declareSet(securityAgentsName, securityAgents)\n permit(enclaveAgentsName(enclave), securityAgentsName,\n \"AllowSecurityManagement-#{enclave}-I\",\n [ enclave ])\n permit(securityAgentsName, enclaveAgentsName(enclave),\n \"AllowSecurityManagement-#{enclave}-II\",\n [ enclave ])\n end\n end", "def check(*args)\n process_using(*args.unshift(:check))\n end", "def run\n super\n \n require_enrichment\n \n # check our fingerprints for a version\n our_version = nil\n fp = _get_entity_detail(\"fingerprint\")\n fp.each do |f|\n if f[\"vendor\"] == \"Wordpress\" && f[\"product\"] == \"Loginizer\"\n our_version = f[\"version\"]\n break\n end\n end\n \n if our_version\n _log \"Got version: #{our_version}\"\n else\n _log_error \"Unable to get version, failing.\"\n return\n end\n \n # check the version to see if its vulnerable.\n # versions smaller than 1.6.4 are vulnerable as per https://wpdeeply.com/loginizer-before-1-6-4-sqli-injection/\n _log \"Checking version against known vulnerable versions\"\n \n if ::Versionomy.parse(our_version) < ::Versionomy.parse(\"1.6.4\")\n _log_good \"Vulnerable!\"\n _create_linked_issue(\"wordpress_loginizer_cve_2020_27615\", {\n proof: {\n detected_version: our_version\n }\n })\n else\n _log \"Not vulnerable!\"\n end\n end", "def run\n super\n \n require_enrichment\n \n # check our fingerprints for a version\n our_version = nil\n fp = _get_entity_detail(\"fingerprint\")\n fp.each do |f|\n if f[\"vendor\"] == \"SolarWinds\" && f[\"version\"] != \"\" && f[\"version\"] != nil\n our_version = f[\"version\"]\n break\n end\n end\n \n if our_version\n _log \"Got version: #{our_version}\"\n else\n _log_error \"Unable to get version, failing\"\n return\n end\n \n # affected versions are 2019.4 through 2020.2.1 HF1\n if compare_versions_by_operator(our_version, \"2019.4\", \">=\") && compare_versions_by_operator(our_version, \"2020.2.1 HF1\", \"<=\")\n _log_good \"Vulnerable!\"\n _create_linked_issue(\"solarwinds_orion_code_compromise\", {\n proof: {\n detected_version: our_version\n }\n })\n return\n else\n _log \"Version does not appear to be vulnerable\"\n end\n \n end", "def run\n super\n\n require_enrichment\n\n vulnerable_version = \"1.920\"\n\n # check our fingerprints for a version\n our_version = nil\n fp = _get_entity_detail(\"fingerprint\")\n fp.each do |f|\n if f[\"product\"] == \"Webmin\" && f[\"version\"] != \"\"\n our_version = f[\"version\"]\n break\n end\n end\n\n if our_version\n _log \"Got version: #{our_version}\"\n\n if ::Versionomy.parse(our_version) <= ::Versionomy.parse(vulnerable_version)\n _log_good \"Potentially Vulnerable!\"\n\n ###\n # check passwd change priv\n ####\n url = \"#{_get_entity_name}/password_change.cgi\"\n cookies = \"redirect=1; testing=1; sid=x; sessiontest=1\"\n headers = { \"Referer\" => \"#{_get_entity_name}/session_login.cgi\", \"Cookie\" => cookies }\n res = http_request :post, url, nil, headers\n\n # make sure we got a response\n unless res\n _log \"Not vulnerable, no response!\"\n return\n end\n\n # check to see if we got a failure immediately\n if res.code == 500 && res.body =~ /Password changing is not enabled/\n _log \"Not vulnerable, Password changing not enabled!\"\n return\n end\n\n ### okay if we made it this far, create an issue\n _create_linked_issue(\"vulnerability_webmin_cve_2019_15107\", {\n proof: {\n detected_version: our_version,\n response_code: res.code,\n response_body: res.body\n }\n })\n else\n _log \"Version #{our_version} is newer than vulnerable version: #{vulnerable_version}\"\n\n end\n\n else\n _log_error \"Unable to get version, failing\"\n return\n end\n\n end", "def postConditionalGLSConnection\n# 4A107\n dataProtection = DataProtection.new\n result = (dataProtection.checkDataEncrypted('cougaar') >= 100)\n saveResult(result, \"4a107\", \"no persisted data encrypted if dataprotection is not turned on\")\n#exit 0\n\n end", "def check ; true ; end", "def check\n # run a nuclei\n uri = _get_entity_name\n template = 'vulnerabilities/wordpress/wordpress-woocommerce-sqli'\n\n # if this returns truthy value, an issue will be raised\n # the truthy value will be added as proof to the issue\n run_nuclei_template uri, template\n end", "def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def check!\n true\n end", "def perform_validation(challenge_password, certname, raw_csr)\n # override this after inheriting\n # should return true to indicate success validating\n # or false to indicate that the validator was unable to validate\n raise NotImplementedError\n end", "def can_compute?(user)\n if user.nil? || !user.registered_for_firecloud?\n false\n else\n # don't check permissions if API is not 'ok'\n if ApplicationController.firecloud_client.services_available?(FireCloudClient::SAM_SERVICE, FireCloudClient::RAWLS_SERVICE, FireCloudClient::AGORA_SERVICE)\n begin\n workspace_acl = ApplicationController.firecloud_client.get_workspace_acl(self.firecloud_project, self.firecloud_workspace)\n if workspace_acl['acl'][user.email].nil?\n # check if user has project-level permissions\n user.is_billing_project_owner?(self.firecloud_project)\n else\n workspace_acl['acl'][user.email]['canCompute']\n end\n rescue => e\n ErrorTracker.report_exception(e, user, { study: self.attributes.to_h})\n Rails.logger.error \"Unable to retrieve compute permissions for #{user.email}: #{e.message}\"\n false\n end\n else\n false\n end\n end\n end", "def confection(name, *args)\n config_block = Confection[name.to_sym]\n if config_block\n Confection::Controller.new(config_block) do |*args|\n instance_exec *args, &config_block\n end\n else\n warn \"no configuration -- `#{name}'\"\n end\nend", "def validate(challenge_password, certname, raw_csr)\n @log.debug \"running validate\"\n fail unless challenge_password.is_a?(String)\n fail unless certname.is_a?(String)\n\n case perform_validation(challenge_password, certname, raw_csr)\n when true\n @log.debug \"validated successfully\"\n @log.info \"Validated '#{certname}' using '#{name}' validator\"\n return true\n when false\n @log.debug \"validation failed\"\n @log.debug \"Unable to validate '#{certname}' using '#{name}' validator\"\n return false\n else\n @log.error \"perform_validation returned a non-boolean result\"\n raise \"perform_validation returned a non-boolean result\"\n end\n end", "def run\n raise \"Not implemented for this check.\"\n end", "def test_set3_13_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'ALL_PRIVILEGES'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'ALTER'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n priv_name = 'ALTER'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n priv_name = 'DROP'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def cmd_check(*args)\n\t\tdefanged?\n\n\t\tbegin\n\n\t\t\tcode = mod.check_simple(\n\t\t\t\t'LocalInput' => driver.input,\n\t\t\t\t'LocalOutput' => driver.output)\n\n\t\t\tif (code)\n\t\t\t\tstat = '[*]'\n\n\t\t\t\tif (code == Msf::Exploit::CheckCode::Vulnerable)\n\t\t\t\t\tstat = '[+]'\n\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\tprint_line(stat + ' ' + code[1])\n\t\t\telse\n\t\t\t\tprint_error(\n\t\t\t\t\t\"Check failed: The state could not be determined.\")\n\t\t\tend\n\t\trescue\n\t\t\tlog_error(\"Check failed: #{$!}\")\n\t\tend\n\tend", "def allow?(*args)\n true\n end", "def update?\n @current_user.permission('Currency', :clerk)\n end", "def check \n @checker.check @program_node\n end", "def inject_acl_object_check(method_name,mode)\n class_eval <<-EOV\n unless respond_to?(:no_acl_#{method_name})\n alias_method :no_acl_#{method_name}, :#{method_name} unless respond_to?(:no_acl_#{method_name})\n private :no_acl_#{method_name}\n end\n EOV\n command = <<-EOV\n def #{method_name}(*args,&block)\n permitted_to!(:#{mode}_#{method_name}) if (!permitted_to?(:#{mode}))\n return send(:no_acl_#{method_name},*args,&block)\n end\n EOV\n instance_eval command\n end", "def compute_allow_and_deny(action_name)\n @__deny_fields = []\n @__allow_fields = []\n\n # Skip permissions can be run on the server to ignore the permissions\n return if Volt.in_mode?(:skip_permissions)\n\n # Run the permission blocks\n action_name ||= new? ? :create : :update\n\n # Run each of the permission blocks for this action\n permissions = self.class.__permissions__\n if permissions && (blocks = permissions[action_name])\n results = blocks.map do |block|\n # Call the block, pass the action name\n instance_exec(action_name, &block)\n end\n\n # Wait for any promises returned\n Promise.when(*results)\n end\n end", "def security\n app = detect_product(DALVIK) || detect_product(MOZILLA)\n\n Security[app.comment[1]] if app\n end", "def user?(name)\n eval(USER_CHECK, binding, __FILE__, USER_CHECK_LINE)\n nil\nend", "def insecure_parameter?(cfn_model, key_to_check)\n # We only want to perform the check against a hash\n return false unless key_to_check.is_a? Hash\n\n # We don't care if any other intrinsic function is used here. We only want to\n # verify that Ref is being used properly\n return false unless key_to_check.key? 'Ref'\n\n # Check if the key parameter is Ref and if that corresponding reference is\n # setup securely by stating NoEcho=true & Default is not present\n if cfn_model.parameters.key? key_to_check['Ref']\n parameter = cfn_model.parameters[key_to_check['Ref']]\n if truthy?(parameter.noEcho) && parameter.default.nil?\n return false\n end\n end\n\n # Return true if key_to_check is a hash and/or a key Ref that does not have\n # the NoEcho parameter set to true and a Default parameter that is not nil\n true\nend", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def check(name=:default, options={}, &block)\n @checks[name.to_sym] = Check.new(name, options, &block)\n end", "def perform_validation(_token, certname, raw_csr)\n results = []\n @log.debug 'validating using multiplexed external executables'\n policy_executables.each do |executable|\n @log.debug \"attempting to validate using #{executable}\"\n results << IO.popen(executable + ' ' + certname.to_s, 'r+') { |obj| obj.puts raw_csr; obj.close_write; obj.read; obj.close; $CHILD_STATUS.to_i }\n @log.debug \"exit code from #{executable}: #{results.last}\"\n end\n bool_results = results.map { |val| val == 0 }\n validate_using_strategy(bool_results)\n end", "def check\n # run a nuclei \n uri = _get_entity_name\n template = \"cves/2021/CVE-2021-26295\"\n\n # if this returns truthy value, an issue will be raised\n # the truthy value will be added as proof to the issue\n run_nuclei_template uri, template\n end", "def check\n # run a nuclei\n uri = _get_entity_name\n _log \"Running on #{uri}\"\n\n template = 'cves/2021/CVE-2021-26084'\n\n # if this returns truthy value, an issue will be raised\n # the truthy value will be added as proof to the issue\n run_nuclei_template uri, template\n end", "def apply()\n end", "def check\n # run a nuclei \n uri = _get_entity_name\n template = \"cves/2020/CVE-2020-8982\"\n\n # if this returns truthy value, an issue will be raised\n # the truthy value will be added as proof to the issue\n run_nuclei_template uri, template\n end", "def allow?(user, target)\n @condition.call(user, target)\n end", "def check_security(people)\n found_miscreant(people)\n some_later_code(found)\nend", "def enforce_ex(*rvals)\n return [false, []] unless enabled?\n\n raise 'model is undefined' unless model.model&.key?('m')\n raise 'model is undefined' unless model.model['m']&.key?('m')\n\n r_tokens = model.model['r']['r'].tokens\n p_tokens = model.model['p']['p'].tokens\n raise StandardError, 'invalid request size' unless r_tokens.size == rvals.size\n\n exp_string = model.model['m']['m'].value\n has_eval = Util.has_eval(exp_string)\n expression = exp_string\n policy_effects = Set.new\n r_parameters = load_params(r_tokens, rvals)\n policy_len = model.model['p']['p'].policy.size\n explain_index = -1\n if policy_len.positive?\n model.model['p']['p'].policy.each_with_index do |pvals, i|\n raise StandardError, 'invalid policy size' unless p_tokens.size == pvals.size\n\n p_parameters = load_params(p_tokens, pvals)\n parameters = r_parameters.merge(p_parameters)\n\n if has_eval\n rule_names = Util.get_eval_value(exp_string)\n rules = rule_names.map { |rule_name| Util.escape_assertion(p_parameters[rule_name]) }\n expression = Util.replace_eval(exp_string, rules)\n end\n\n result = evaluate(expression, functions, parameters)\n case result\n when TrueClass, FalseClass\n unless result\n policy_effects.add(Effect::Effector::INDETERMINATE)\n next\n end\n when Numeric\n if result.zero?\n policy_effects.add(Effect::Effector::INDETERMINATE)\n next\n end\n else\n raise 'matcher result should be true, false or a number'\n end\n\n if parameters.keys.include?('p_eft')\n case parameters['p_eft']\n when 'allow'\n policy_effects.add(Effect::Effector::ALLOW)\n when 'deny'\n policy_effects.add(Effect::Effector::DENY)\n else\n policy_effects.add(Effect::Effector::INDETERMINATE)\n end\n else\n policy_effects.add(Effect::Effector::ALLOW)\n end\n\n if effector.intermediate_effect(policy_effects) != Effect::Effector::INDETERMINATE\n explain_index = i\n break\n end\n end\n\n else\n raise 'please make sure rule exists in policy when using eval() in matcher' if has_eval\n\n parameters = r_parameters.clone\n model.model['p']['p'].tokens.each { |token| parameters[token] = '' }\n result = evaluate(expression, functions, parameters)\n if result\n policy_effects.add(Effect::Effector::ALLOW)\n else\n policy_effects.add(Effect::Effector::INDETERMINATE)\n end\n end\n\n final_effect = effector.final_effect(policy_effects)\n result = Effect::DefaultEffector.effect_to_bool(final_effect)\n\n # Log request.\n log_request(rvals, result)\n\n explain_rule = []\n explain_rule = model.model['p']['p'].policy[explain_index] if explain_index != -1 && explain_index < policy_len\n [result, explain_rule]\n end", "def evaluate_permission(permission, *args)\n # object; Event, Discount, etc\n o = args[0]\n # default to allow\n result = true\n role = get_role_of(o)\n\n\n # evaluate procs\n if (proc = PermissionUtilities.has_procs?(permission))\n result &= proc.call(o, self)\n end\n\n # Here is where the addition of adding collaborations may reside\n\n # finally, determine if the user (self) can do the requested action\n result &= allowed_to_perform?(permission, role)\n\n # so we don't need to do everything again\n cache.set_for_role(\n name: permission,\n value: result,\n role: role\n )\n\n result\n end", "def applyName(x)\n if x.name == @value\n return true\n else\n return false\n end\n end", "def check_access\n permission_denied unless can_census?(year)\n end", "def applyAttack(x)\n if (applyHealing(x) == !@value && applySupport(x) == !@value &&\n applyGrowth(x) == !@value)\n return true\n else\n return false\n end\n end", "def check(params)\n false\n end", "def able_to_operate?(_entity, _train, _name)\n true\n end", "def update!(**args)\n @can_apply = args[:can_apply] if args.key?(:can_apply)\n @can_read = args[:can_read] if args.key?(:can_read)\n @can_remove = args[:can_remove] if args.key?(:can_remove)\n end", "def can?(thing)\n return true if admin?\n # Check if user is granted the function\n return true if granted?(thing)\n # Check if user is denied the function\n return false if denied?(thing)\n # Ignore \"System Admin\" function from CSUM/CSEM users\n return false if thing.include?(\"System Admin\")\n roles.include?(thing)\n end", "def check(name = nil, options = nil, &block)\n @checks[name] = Check.new(name, options, &block)\n end", "def whitelisted?\n\n # Initialise method variables\n result = false\n\n # Setup the options to call the verify endpoint to see if this installation\n # has been whitelisted or not\n options = build_options\n\n # Set the data in the options\n options[:body] = {\n \"subscription_id\": new_resource.subscription_id,\n \"automate_licence\": new_resource.license,\n }\n\n @headers = {\n \"x-functions-key\": new_resource.apikey\n }\n options[:headers] = @headers\n\n # Configure the url that needs to be accessed\n url = format('%s/verify', new_resource.url)\n\n # Make the call\n response = make_request('post', url, [200, 401, 404], options)\n\n if response[:status_code] == 401\n log 'Unauthorised access to central functions' do\n level :warn\n end\n end\n\n # Use the status code to determine if the workspace id and key have been returned\n result = response[:data] if response[:status_code] == 200\n\n result\n\n end", "def can? action, &block\n @action = action.to_s.sub('?','') + '?'\n @action = @action.to_sym\n\n # pre check\n raise RuntimeError, 'Method name not allowed' if %w(can).index(@action)\n raise NoMethodError, %[Policy check \"#{action}\" not found in #{self.class}] unless respond_to?(@action)\n\n call &block\n end", "def dataProviderCheck()\n\n logger.debug \"#{self.class.to_s}:#{__method__}: #{__LINE__}: DataProviderCheck\"\n\n dataProviderInit\n\n check = @fileCheck.() if @useFileProvider\n check = @esbCheck.() if @useEsbProvider\n\n logIfUnavailable(check, \"verify the check url configuration\")\n\n check\n end", "def update?\n @current_user.permission('Ration', :clerk)\n end", "def apply_filter_expression(scope, expression)\n ast = calculator.ast(expression)\n if ast.is_a?(Keisan::AST::LogicalOperator) || boolean_function?(ast)\n apply_ast(scope, ast)\n else\n raise Kaprella::Errors::InvalidFilterExpression.new\n end\n end", "def update?\n @current_user.permission('Commodity', :clerk)\n end", "def change_permitted?(risk)\n # Ensure config is loaded\n call_function('include', 'change_risk')\n\n risk_not_found_action = closure_scope.lookupvar('change_risk::risk_not_found_action')\n Puppet.debug { \"change_risk(#{risk}): risk_not_found_action=#{risk_not_found_action}\" }\n\n permitted = closure_scope.lookupvar('change_risk::permitted_risk_normalized')[risk]\n Puppet.debug { \"change_risk(#{risk}): permitted=#{permitted}\" }\n\n # If we have a valid directive, we can just return it\n return permitted unless permitted.nil?\n\n # No valid directive means we need to figure out a return value ourselves\n if risk_not_found_action == 'none'\n true\n elsif risk_not_found_action == 'noop'\n false\n elsif risk_not_found_action == 'fail'\n call_function('fail', \"Permitted risk data unavailable for risk '#{risk}'\")\n else\n raise \"Unexpected value for change_risk::risk_not_found_action: #{risk_not_found_action}\"\n end\n end", "def can_apply?(opportunity)\n\n if alum_signed_in? && !current_user.is_owner?(opportunity) && !current_user.applied?(opportunity)\n true\n else\n false \n end\n end", "def use_security?\n response = api_get_request(\"\", \"tree=useSecurity\")\n response[\"useSecurity\"]\n end", "def update?\n @current_user.permission('Fdp', :clerk)\n end", "def enabled_checks=(_arg0); end", "def create?\n @current_user.permission('Currency', :clerk)\n end", "def checks; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "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 check\n # run a nuclei \n uri = _get_entity_name\n template = \"cves/2020/CVE-2020-8163\"\n\n # if this returns truthy value, an issue will be raised\n # the truthy value will be added as proof to the issue\n run_nuclei_template uri, template\n end", "def name_is_valid?(user, name)\n\t\tuser.respond_to? \"#{name}s_administrating\" and (this_is_offering?(name) || this_is_multisession?(name))\n\tend", "def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def run_valid_user?\n\t\t\tif v.valid_user?(ev.user, ev.user_groups, \"railsdep\")\n\t\t\t\t$stdout.puts Rainbow(\"Success: '#{ev.user}' is member of 'railsdep' group\").green\n\t\t\telse\n\t\t\t\texit 1\n\t\t\tend\n\t\tend", "def can_perform_role(name, *keys)\n getRole(name.to_s).isAllowedForKeys(Set.new keys.map { |x|\n x.is_a?(PrivateKey) ? x.public_key : x\n })\n end", "def test_should_detect_simple_check\n e = RulesEngine.new\n place_pieces(e, \"\n - - - - - - - K\n - - - - - - - -\n - - - - - - - -\n - - - R - - - -\n - - - - - - - - \n - - - - - - - - \n - - - - - - - - \n - - - k - - - - \n \")\n e.calculate_colour_attack(Colour::BLACK)\n assert(e.in_check?(Colour::WHITE))\n end", "def update\n @security = Security.find(params[:id])\n company = session[:company_id].c\n if (@security.name == \"common\")\n params[:security][:name] = \"common\" \n notice = \"cannot rename common\"\n else\n notice = 'Security was successfully updated.'\n end\n\n respond_to do |format|\n if @security.update_attributes(params[:security])\n format.html { redirect_to(company, :notice => notice) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @security.errors, :status => :unprocessable_entity }\n end\n end\n end", "def run_authorization_check\n if instance_authority_resource.is_a?(Array)\n # Array includes options; pass as separate args\n authorize_action_for(*instance_authority_resource)\n else\n # *resource would be interpreted as resource.to_a, which is wrong and\n # actually triggers a query if it's a Sequel model\n authorize_action_for(instance_authority_resource)\n end\n end", "def run\n print_status(\"Running module against #{ sysinfo['Computer'] }\")\n \n domain = get_domain()\n return if domain.nil?\n print_status(\"Host is part of #{domain}\")\n get_gpo_info()\n tradecraft_check(find_audit(domain))\n \n end", "def check_permissions\n require_privilege(Privilege::USE, @environment)\n end", "def can_be_approved?\n self.applied?\n end", "def check\n\n # run a nuclei\n uri = _get_entity_name\n template = 'cves/2019/CVE-2019-3396'\n\n # if this returns truthy value, an issue will be raised\n # the truthy value will be added as proof to the issue\n run_nuclei_template uri, template\n end", "def check\n\n # run a nuclei\n uri = _get_entity_name\n template = 'cves/2019/CVE-2019-3403'\n\n # if this returns truthy value, an issue will be raised\n # the truthy value will be added as proof to the issue\n run_nuclei_template uri, template\n end", "def potential_checks=(enable)\n checks = REXML::XPath.first(@xml, 'ScanTemplate/VulnerabilityChecks')\n checks.attributes['potential'] = enable ? '1' : '0'\n end", "def canExecute(type,args={})\n return false unless @ability[type]\n execute = @ability[type].execute_permission\n return callSetArgs(execute,args) if execute.respond_to? :call\n execute\n end", "def authorize (permission_name)\n self.allowances.detect {|a| a.permission.name == permission_name.to_s}\n end", "def eval_policy(policy_type) \n\n # Bail out on the policy evaluation if 'override_policy' is defined \n # in the current Thread. This indicates that there is some function \n # privileging that should take the place of the actual policy.\n\n return Thread.current['override_policy'].call unless Thread.current['override_policy'].nil?\n\n # If there is no policy object defined, then we assume that \n # access should be allowed. This is part of our philopsophy that\n # GuardRails should not interfere with existing functionality\n # unless explicity told to do so.\n\n if policy_object.nil?\n if policy_type == :append_access\n # Not sure whether defering to :write_access in this case\n # actually does anything since the entire object is nil\n return eval_policy(:write_access)\n else\n return true\n end\n end\n\n # If there is a policy_object, but it has no rule for the \n # specific type of access we are concerned with, true is the\n # default response, except in the case of append access, which\n # should defer to write access if undefined. After all, if\n # you do not have write access, you should not be able to\n # append anything.\n\n function = policy_object[policy_type]\n if function.nil?\n if policy_type == :append_access\n return eval_policy(:write_access)\n else\n return true\n end\n end\n\n # Loopbreak is a thread variable that prevents infinite loops\n # from occuring when an access control check occurs within\n # an annotation's function that are mutually dependent.\n # For now, we just run the annotation functions in a universally\n # privileged environment.\n\n return true if Thread.current['loopbreak'] == true\n Thread.current['loopbreak'] = true\n\n # The number of parameters passed to the policy's function depends\n # on how many parameters it wants. It can have no parameters, the\n # current user if it has one parameter, and the current user and \n # response information if it has two.\n\n func = eval(function)\n if func.arity == 0\n ret = eval(function).call\n elsif func.arity == 1\n ret = eval(function).call(Thread.current['user'])\n elsif func.arity == 2\n ret = eval(function).call(Thread.current['user'], Thread.current['response'])\n else\n raise GuardRailsError, \"Annotation Policy Requires Too Many Parameters\"\n end\n\n # Turn of the extra privileges\n Thread.current['loopbreak'] = false\n\n # Return true if the access is allowed, false otherwise\n ret\n end", "def action_allowed?(action_name)\n # TODO: this does some unnecessary work\n compute_allow_and_deny(action_name).then do\n\n deny = @__deny_fields == true || (@__deny_fields && @__deny_fields.size > 0)\n\n clear_allow_and_deny\n\n !deny\n end\n end", "def run_check\n check_for_default_routes\n check_for_action_globs\n check_for_cve_2014_0130\n end", "def include name\n rules = self.ctx[name]\n raise 'undefined referenced policy' if rules == nil\n self.active_policy = self.active_policy.merge rules\n end", "def execute(named_context, target)\n raise(ArgumentError, 'invalid context specified') if !named_context || (contexts.length > 0 && !contexts[named_context])\n target.errors.clear!\n result = true\n context(named_context).each do |validator|\n next unless validator.execute?(target)\n result = false unless validator.call(target)\n end\n\n result\n end", "def execute(named_context, target)\n raise(ArgumentError, 'invalid context specified') if !named_context || (contexts.length > 0 && !contexts[named_context])\n target.errors.clear!\n result = true\n context(named_context).each do |validator|\n next unless validator.execute?(target)\n result = false unless validator.call(target)\n end\n\n result\n end", "def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n update_user_kyc_status\n\n update_aml_match_status\n\n log_admin_action\n\n send_denied_email\n\n success_with_data(@api_response_data)\n\n end", "def check\n\n # run a nuclei\n uri = _get_entity_name\n template = 'cves/2021/CVE-2021-21975'\n\n # if this returns truthy value, an issue will be raised\n # the truthy value will be added as proof to the issue\n run_nuclei_template uri, template\n end", "def allow_production=(_arg0); end", "def check(name=nil)\n env = env(name)\n env.index == env.lookup_index\n end", "def is_cassandra_node settings\n has_role settings, \"cassandra_node\"\n security_group 'cassandra_node' do\n authorize :group_name => 'cassandra_node'\n end\nend" ]
[ "0.70551425", "0.6566007", "0.553612", "0.542689", "0.5353791", "0.53266376", "0.52394813", "0.5206308", "0.5162355", "0.5162355", "0.5080505", "0.50774515", "0.5066082", "0.5057112", "0.501505", "0.5014266", "0.49934995", "0.49897236", "0.4985214", "0.49814662", "0.49698296", "0.49686837", "0.49662822", "0.49635315", "0.49279627", "0.4925686", "0.49241084", "0.4922931", "0.49204767", "0.48700392", "0.48647818", "0.48645535", "0.4861752", "0.48419756", "0.48419076", "0.48175842", "0.48159727", "0.48048332", "0.47946945", "0.47926477", "0.4785555", "0.47832152", "0.477987", "0.4775602", "0.47709328", "0.47688085", "0.47685027", "0.47645754", "0.47613573", "0.47519168", "0.4739329", "0.47331166", "0.47303718", "0.4725577", "0.47244486", "0.4724108", "0.47230783", "0.47158888", "0.47111565", "0.4709008", "0.4700821", "0.46960542", "0.46923077", "0.46914235", "0.4690346", "0.46897537", "0.4687999", "0.4680248", "0.4678391", "0.46742523", "0.4672875", "0.4672875", "0.46718302", "0.46712297", "0.46712258", "0.4665808", "0.46638465", "0.46634805", "0.46623927", "0.46618012", "0.46548188", "0.46546704", "0.46537012", "0.46502203", "0.464657", "0.46465358", "0.46443227", "0.46422687", "0.46380845", "0.46356776", "0.4633674", "0.46335205", "0.46319053", "0.46277148", "0.46277148", "0.46253982", "0.46233588", "0.4622689", "0.4618435", "0.46145463" ]
0.6096549
2
How does this even work in core? Oh, nevermind, it doesn't. Patch submitted. :)
def conditions_with_metawhere @conditions ||= interpolate_sql(association_class.send(:sanitize_sql, @reflection.options[:conditions])) if @reflection.options[:conditions] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def internship_passed; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def anchored; end", "def schubert; end", "def isolated; end", "def isolated; end", "def internal; end", "def wrapper; end", "def custom; end", "def custom; end", "def same; end", "def implementation; end", "def implementation; end", "def extra; end", "def terpene; end", "def used?; end", "def gounod; end", "def original; end", "def ibu; end", "def weber; end", "def implemented_in; end", "def pass; end", "def pass; end", "def r; end", "def r; end", "def extended(*) end", "def operations; end", "def operations; end", "def original_result; end", "def berlioz; end", "def internal?; end", "def g; end", "def g; end", "def refutal()\n end", "def called_from; end", "def called_from; end", "def semact?; false; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def herald; end", "def probers=(_arg0); end", "def offences_by; end", "def stderrs; end", "def with_repl_like_sigint; end", "def tell()\n #This is a stub, used for indexing\n end", "def returns; end", "def who_we_are\r\n end", "def sld; end", "def how_it_works\r\n end", "def intensifier; end", "def op; end", "def escaper=(_); end", "def final; end", "def big_bad; end", "def cops; end", "def cops; end", "def cops; end", "def ignores; end", "def standalone=(_arg0); end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def as_you_like_it_quote; end", "def overload; end", "def silly_adjective; end", "def frozen?; end", "def loc; end", "def loc; end", "def loc; end", "def explicit; end", "def spec; end", "def spec; end", "def operation; end", "def my955; end", "def trd; end", "def missing; end", "def mitch_hedberg; end", "def blg; end", "def surge; end", "def offences_by=(_arg0); end" ]
[ "0.6922895", "0.6533438", "0.61480564", "0.61338806", "0.61338806", "0.61338806", "0.61338806", "0.60601676", "0.6008689", "0.59750587", "0.59750587", "0.5940247", "0.58633757", "0.5856138", "0.5856138", "0.5854709", "0.58337164", "0.58337164", "0.5825243", "0.58144903", "0.5804194", "0.57773995", "0.575947", "0.57458645", "0.5724122", "0.5702146", "0.5695584", "0.5695584", "0.56945854", "0.56945854", "0.5685861", "0.5669502", "0.5669502", "0.565416", "0.5648296", "0.56447786", "0.5644159", "0.5644159", "0.56355923", "0.5634541", "0.5634541", "0.5625104", "0.56243545", "0.56243545", "0.56243545", "0.56243545", "0.56243545", "0.56243545", "0.56243545", "0.56243545", "0.56241715", "0.5617187", "0.56097054", "0.5609532", "0.5570365", "0.5567542", "0.556224", "0.5557792", "0.5555362", "0.5547696", "0.5547352", "0.5547154", "0.55459607", "0.55437934", "0.5533694", "0.5532878", "0.5523442", "0.5523442", "0.5523442", "0.5520259", "0.5512745", "0.55098903", "0.55098903", "0.55098903", "0.55098903", "0.55098903", "0.55098903", "0.55098903", "0.55098903", "0.55098903", "0.55060804", "0.55060804", "0.55060804", "0.5502872", "0.54987025", "0.5494846", "0.548556", "0.54851526", "0.54851526", "0.54851526", "0.54842764", "0.54820156", "0.54820156", "0.5476441", "0.54749805", "0.5473141", "0.547178", "0.5470111", "0.54682285", "0.5466917", "0.5460421" ]
0.0
-1
Write a function add_numbers(nums_array) that takes in an array of Integers and returns the sum of those numbers. Write this method recursively.
def add_numbers(nums_array) return nil if nums_array.length == 0 return nums_array.first if nums_array.length == 1 nums_array.first + add_numbers(nums_array[1..-1]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_numbers(nums_array)\n\treturn nil if nums_array.length == 0\n\n\treturn nums_array.first if nums_array.length == 1\n\n\treturn nums_array.shift + add_numbers(nums_array)\nend", "def add_numbers(num_array)\n return num_array[0] if num_array.length <= 1\n sum = num_array[0]\n sum += add_numbers(num_array[1..-1])\nend", "def add_numbers(nums_array)\n return 0 if nums_array.length == 0\n\n first = nums_array.shift\n\n first + add_numbers(nums_array)\nend", "def add_numbers(nums_array)\n return nums_array.first if nums_array.length == 1 || nums_array.empty?\n nums_array.last + add_numbers(nums_array[0...-1])\n end", "def add_numbers(nums_array = nil)\r\n return nil if nums_array.nil?\r\n return nums_array[0] if nums_array.length == 1\r\n nums_array[0] + add_numbers(nums_array[1..-1])\r\n end", "def add_numbers(nums_array)\n return nums_array.first if nums_array.length == 1 #=> base case if the array is length 1 then just return the first element\n return nil if nums_array.length < 1 #=> return nil if the array length is less than 1\n \n nums_array.pop + add_numbers(nums_array) #=> inductive/recursive case taking the sum of the array and #pop the the last ele each time\nend", "def add_numbers(num_array)\n num_array.count > 1 ? num_array.first + add_numbers(num_array.drop(1)) : num_array.first\n end", "def add_numbers(nums_array)\n nums_array.inject { |sum, el| sum + el }\nend", "def add_numbers(nums_array)\n return nums_array[0] if nums_array.length <= 1\n n = nums_array[0] + add_numbers(nums_array[1..-1])\nend", "def add_numbers(nums_array)\n if nums_array.empty? \n 0\n else \n n = nums_array.pop\n return n + add_numbers(nums_array)\n end \nend", "def add_numbers(nums_array)\n return nums_array[0] if nums_array.length <= 1\n nums_array[0] +add_numbers(nums_array[1..-1])\nend", "def add_numbers(nums_array)\n return nums_array[0] if nums_array.size ==1\n return nil if nums_array.empty?\n\n nums_array[0] + add_numbers(nums_array[1..-1])\nend", "def add_numbers(nums_array)\n return nil if nums_array.empty?\n return nums_array[0] if nums_array.length == 1\n nums_array[0] + add_numbers(nums_array[1..-1])\nend", "def add_numbers(nums_array)\n return nil if nums_array.empty?\n first_elem = nums_array.first\n return first_elem if nums_array.length == 1\n first_elem + add_numbers(nums_array[1..-1])\nend", "def add_numbers(nums_array)\n return nil if nums_array.empty?\n return nums_array.pop if nums_array.length == 1\n return nums_array.pop + add_numbers(nums_array)\nend", "def add_numbers(num_array = nil)\n return nil if num_array.nil?\n return num_array[0] if num_array.length == 1\n num_array[0] + add_numbers(num_array[1..-1])\nend", "def add_numbers(nums_array)\n return nums_array.first if nums_array.length <= 1\n nums_array.shift + add_numbers(nums_array)\nend", "def add_numbers(nums_array)\n return nil if nums_array.empty?\n return nums_array.pop if nums_array.length == 1\n return nums_array.pop + add_numbers(nums_array)\nend", "def add_numbers(nums_array)\n return nums_array[0] if nums_array.length < 2\n nums_array[0] + add_numbers(nums_array[1..-1])\nend", "def add_numbers(nums_array)\n return nums_array[0] if nums_array.length < 2\n nums_array[0] + add_numbers(nums_array[1..-1])\nend", "def add_numbers(nums_array)\n return nil if nums_array.length < 1\n return nums_array.first if nums_array.length == 1\n nums_array[0] + add_numbers(nums_array[1..-1])\nend", "def add_numbers(nums_array)\n return nil if nums_array.empty?\n return nums_array.pop if nums_array.length == 1\n\n nums_array.pop + add_numbers(nums_array)\nend", "def add_numbers(nums_array)\n return nil if nums_array.empty?\n return nums_array[0] if nums_array.length == 1\n add_numbers(nums_array[1..-1]) + nums_array[0]\nend", "def add_numbers(nums_array)\n # Base Case: Is the array empty?\n return nums_array[0] if nums_array.length <= 1\n nums_array.shift + add_numbers(nums_array)\nend", "def add_array_numbers(array)\n result = array.sum\n # .sum cannot be used on a string, only integars and floats\n return result\nend", "def add_numbers(nums_array)\n return nums_array.first if nums_array.length <= 1\n\n nums_array.pop + add_numbers(nums_array)\nend", "def add_numbers(nums_array)\n if nums_array.length == 1\n return nums_array.last\n elsif nums_array.empty?\n return nil\n end\n\n nums_array.pop + add_numbers(nums_array)\nend", "def sum_numbers(numbers)\r\n # Your code here\r\n #initalize the sum\r\n sum = 0\r\n #iterate through every element of a given array\r\n numbers.each do |number|\r\n #add the previous sum and next number in the array\r\n sum += number\r\n end\r\n \r\n return sum\r\nend", "def add_numbers(nums_array)\n return nums_array[0] if nums_array.length <= 1\n nums_array.pop + add_numbers(nums_array)\nend", "def add_all_numbers(array)\n array.inject(:+)\nend", "def add_numbers(nums_array)\n return nums_array.first if nums_array.length <= 1\n last = nums_array.pop\n last + add_numbers(nums_array)\nend", "def add_numbers(arr)\n return nil if arr.length < 1\n return arr[0] if arr.length == 1\n arr[0] += add_numbers(arr[1..-1])\n end", "def sum_array(numbers)\n return numbers.sum()\nend", "def sum_array(numbers)\n total = 0\n for number in numbers\n total = total + number\n end\n return total\nend", "def add_nums_iterative(arr)\n return nil if arr.length == 0\n total = 0\n arr.each do |num|\n total += num\n end\n total\nend", "def sum_array(array)\n sum = 0\n array.each do |number|\n sum += number\n end\n sum\nend", "def sum_array(array)\n sum = 0\n\n array.each do |number|\n sum += number\n end\n\n return sum\nend", "def RecursiveSum(arrayofNumbers) \n \n # Base Case: If the array is empty, return 0. \n \n if arrayofNumbers? \n return 0\n \n # Recursive code: Adding each element to the variable by calling the method. \n \n else\n Sum = arrayofNumbers.pop \n return Sum + RecursiveSum(arrayofNumbers) \n end\nend", "def total(array_of_numbers)\n sum = 0\n array_of_numbers.each do |num|\n sum += num\n end\n return sum\nend", "def sum_array(array)\n sum = 0\n array.each do |num|\n sum = sum + num\n end\n sum\nend", "def sum array\n\tsum = 0\n\tarray.each do |number|\n\t\tsum = sum + number\n\tend\n\tsum\nend", "def add_numbers(arr_of_ints)\n return arr_of_ints[0] if arr_of_ints.length <= 1\n arr_of_ints[0] + add_numbers(arr_of_ints[1..-1])\nend", "def add_numbers(arr)\n return arr[0] if arr.length <= 1\n arr[0] + add_numbers(arr[1..-1])\nend", "def sum_array(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend", "def add_numbers(array)\n#add first in array to next in array. replace next in array\n#until array.length < 1\n return array[0] if array.length <= 1\n num1, num2 = array.pop, array.pop\n sum = num1.to_i + num2.to_i\n array.unshift(sum)\n add_numbers(array)\nend", "def add_nums(arr)\n return nil if arr.length == 0\n return arr[0] if arr.length == 1\n arr[0] + add_nums(arr[1..-1])\nend", "def sum(array)\n sum = 0\n\n array.each { |number|\n sum += number\n }\n\n return sum\nend", "def arr_sum(array)\n sum = 0 # Declares initial value for variable 'sum' as 0\n array.each do |i| # Begin iterating each item of arr\n sum += i # add each number in array to the next item, continue until items exhausted\n end\n return sum # Returns new sum value\nend", "def sum_nums(num)\n\t\n\tnumbers = []\n\tnum_sum = num\n\t\nuntil numbers.length == num_sum\n\tnumbers.push(num)\n\tnum = num - 1\nend\n return\tnumbers.inject(:+)\nend", "def sum_array(array)\n sum = 0\n array.each{ |num| sum += num }\n sum\nend", "def sum_array(array)\n sum = 0\n array.each do |num|\n sum+=num\n end\n sum\nend", "def total(array_of_numbers)\n return array_of_numbers.reduce(:+)\nend", "def add_numbers(nums_array)\n #if array has >1 element, then take first element and then ...\n return nums_array.first if nums_array.length <= 1\n nums_array.first + add_numbers(nums_array[1..-1])\nend", "def sum_array(array_num)\n\nend", "def sum(numbers)\n numbers.reduce(&:+)\n end", "def sum_array(array)\n total = 0\n array.each do |num|\n total += num\n end\n total\nend", "def sum(array_of_integers)\n # TODO\nend", "def add_numbers(arr)\n if arr == []\n return nil\n elsif arr[0] == arr[-1]\n return arr[0]\n end\n arr[-1] + add_numbers(arr[0...-1])\nend", "def sum_array(array)\n return array.sum\n\n # sum_total_of_array = 0\n # for number in array\n # sum_total_of_array += number\n # end\n # return sum_total_of_array\nend", "def add_numbers(arr)\n return arr[0] if arr.length == 1\n return nil if arr.length == 0\n tot = arr.pop + add_numbers(arr)\nend", "def sum(array)\n\ttotal = 0\n\tfor number in array #could do each do instead of for loop\n\t\ttotal += number\n\tend\n\treturn total\nend", "def sum(nums)\n\treturn 0 if nums == []\n\tnums.reduce(:+)\nend", "def numbers_sum(input_array)\n output = input_array[0] + input_array[1] # Sums the first array's input with the second array's input\n return output\nend", "def sum_array( numbers )\r\n numbers.inject(0, :+)\r\nend", "def sum(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend", "def add(*nums) \r\n p @result.class\r\n for num in nums\r\n if num.class == Array\r\n #loop through the array and sum the elements\r\n for x in num\r\n @result += x.to_f\r\n end\r\n else\r\n @result += num.to_f# @result = @result + num\r\n end\r\n end\r\n self\r\n end", "def add_array(array)\n sum = 0\n for i in array do\n sum += i\n end\n sum\nend", "def add_numbers(arr)\n return nil if arr.empty?\n return arr[0] if arr.length == 1\n arr.shift + add_numbers(arr)\nend", "def sum_nums(num)\n (1..num).inject(&:+)\nend", "def sum_array(array)\n sum = 0\n array.each do |x|\n sum += x\n end\n return sum\nend", "def sum_rec(num_array)\n return 0 if num_array.empty?\n\n num[0] + sum_rec(num_array.drop(1))\nend", "def rec_sum(nums)\n\nend", "def rec_sum(nums)\n\nend", "def add(numbers)\n numbers.inject { |sum, n| sum + n }\n end", "def add_numbers(arr)\n return arr.first if arr.length <= 1\n\n arr.pop + add_numbers(arr)\nend", "def sum1(array)\r\n sum = 0\r\n array.each do |number|\r\n sum += number\r\n end\r\n sum\r\nend", "def my_sum(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend", "def sum_array(int_array)\n int_array.reduce(:+)\nend", "def sum_of_sums(array)\n sum = 0\n sum_array = array.map { |x| sum += x }\n sum_array.inject(:+)\nend", "def sum_array(array)\n\tarray.inject { |sum, n| sum + n }\nend", "def sum_only_numbers(an_array)\n if an_array.length == 0\n \treturn 0\n end\n if an_array[0].is_a?(Numeric)\n \tan_array[0] + sum_only_numbers(an_array.drop(1))\n else\n \tsum_only_numbers(an_array.drop(1))\n end\n\nend", "def sum(array)\n sum = 0\n array.each { |n| sum += n } \n sum\nend", "def sum_of_sums(numbers)\n numbers_to_add = Array.new\n numbers.each_index do |index|\n numbers_to_add += numbers[0..index]\n end\n numbers_to_add.reduce(:+)\nend", "def sum_array(array)\n sum = 0\n array.each do |value|\n sum += value\n end\n sum\nend", "def sum_array(array)\n sum = 0\n array.each do |element|\n sum += element\n end\n sum\nend", "def total(array)\n sum = 0\n array.each do |number|\n sum = sum += number\n end\n sum\nend", "def sum_array(array)\n\tarray.inject do |sum, n| sum + n\n\tend\nend", "def sum(numbers)\n\ttotal = 0\n\tnumbers.each do |number|\n\t\ttotal += number if number.is_a? Integer\n\tend\n\ttotal\nend", "def sum_array(array)\n array.reduce(:+)\nend", "def sum(nums)\n total = 0\n nums.each do |n|\n total+= n\n end\n return total\nend", "def sum_of_array(array)\n sum = 0\n array.each do |item|\n if item.is_a?(Integer) == true\n sum = sum + item\n else\n sum = sum + num_value(item)\n end\n end\n sum\nend", "def sum(nums)\n nums.reduce(&:+)\nend", "def sum_array(integers)\n integers.sum\nend", "def sum arr\n sum_array = 0 \n arr.each { |x| sum_array = sum_array + x } \n return sum_array\nend", "def sum(nums)\n return 0 if nums.empty?\n nums[0] + sum_rec(nums[1..-1])\nend", "def sum_of_sums(int_arr)\n sum = 0\n current_numbers = []\n int_arr.each { |int|\n current_numbers << int\n sum += current_numbers.sum\n }\n sum\nend", "def sum_digits(array)\n return array.inject(:+) #explanation? combines all elements of array by applying binary operation, same as reduce\n # array.reduce do |product = 0, n| \n # product + n\n # end\n end", "def summing_method(single_digit_array)\n summed_array = single_digit_array.sum\nend", "def sum(array)\n sum = 0\n array.each do |a|\n sum += a\n end\n return sum\nend", "def sum_array(array)\n sum = 0\n array.each do |i|\n sum+=i\n end\n sum\nend" ]
[ "0.8435391", "0.8267358", "0.82461274", "0.8147379", "0.8099505", "0.8067153", "0.8012289", "0.79946655", "0.79374665", "0.79179955", "0.7890794", "0.7866834", "0.78535163", "0.7849921", "0.78071046", "0.77837145", "0.775841", "0.77236456", "0.77192", "0.77192", "0.7710903", "0.76886624", "0.76851684", "0.7671037", "0.76514685", "0.76160777", "0.76058924", "0.7604376", "0.7585171", "0.7562777", "0.75006807", "0.74877304", "0.7478993", "0.7463549", "0.74529535", "0.7441028", "0.7428352", "0.7407174", "0.74039507", "0.7398872", "0.73686546", "0.73416054", "0.7341463", "0.7321837", "0.7320387", "0.73170114", "0.7299371", "0.7288943", "0.7282684", "0.7281884", "0.72760236", "0.72658646", "0.725374", "0.7231546", "0.72291315", "0.72263896", "0.7208406", "0.72083086", "0.72066075", "0.71864367", "0.7178002", "0.7173296", "0.7169508", "0.71628946", "0.71237445", "0.7120015", "0.71146107", "0.7107022", "0.70974445", "0.7092284", "0.7084948", "0.70827043", "0.70827043", "0.7064527", "0.70617604", "0.70462286", "0.7043614", "0.7004435", "0.7000741", "0.6988286", "0.69877607", "0.6978318", "0.6958777", "0.69557893", "0.694319", "0.69421905", "0.6937088", "0.69325286", "0.69250494", "0.69217604", "0.6917959", "0.68949383", "0.6892032", "0.6889383", "0.6888913", "0.6888113", "0.6887751", "0.68876797", "0.6885014", "0.6883341" ]
0.7911742
10
=> returns 5040 Write a function ice_cream_shop(flavors, favorite) that takes in an array of ice cream flavors available at the ice cream shop, as well as the user's favorite ice cream flavor. Recursively find out whether or not the shop offers their favorite flavor.
def ice_cream_shop(flavors, favorite) return false if flavors.length.zero? return flavors.first == favorite if flavors.length == 1 flavors.first == favorite || ice_cream_shop(flavors[1..-1], favorite) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ice_cream_shop(flavors, favorite)\n # Base step\n return false if flavors.empty?\n return true if flavors[0] == favorite\n # Recursive Step\n ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return false if flavors == []\n return true if flavors[0] == favorite\n ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors[0] == favorite\n ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return true if flavors[0] == favorite\n return false if flavors.length < 1\n ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return false if flavors.length == 0\n\n flavors[0] == favorite ? true : ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return true if flavors[-1] == favorite\n return false if flavors.empty?\n\n ice_cream_shop(flavors[0...-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return true if favorite == flavors[0]\n return false if flavors.length <= 1\n ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return true if flavors.first == favorite\n return false if flavors.empty?\n\n ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors.first == favorite\n ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return true if flavors.last == favorite\n return false if flavors.length == 1 || flavors.empty?\n ice_cream_shop(flavors[0...-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n\treturn false if flavors.empty?\n\n\treturn true if flavors.first == favorite\n\n\t_, *remaining = flavors\n\n\treturn ice_cream_shop(remaining, favorite)\nend", "def ice_cream_shop(flavors,favorite)\n return true if flavors[0] == favorite\n return false if flavors.length < 1\n ice_cream_shop(flavors[1..-1],favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors.pop == favorite\n ice_cream_shop(flavors[0...-1],favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return true if flavors[0] == favorite\n return false if flavors.length <= 1\n\n ice_cream_shop(flavors[1..-1],favorite)\nend", "def ice_cream_shop(flavors, favorite)\n if flavors.empty?\n return false\n end\n\n return true if favorite == flavors.pop\n ice_cream_shop(flavors, favorite)\nend", "def ice_cream_shop(flavors, favorite)\n checker = flavors.pop\n return true if checker == favorite\n return false if flavors.length == 0\n ice_cream_shop(flavors, favorite)\nend", "def ice_cream_shop(flavors, favorite) \n offers = flavors[0] == favorite \n return offers if offers == true\n return offers if flavors.length <= 1\n ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors.pop == favorite\n return ice_cream_shop(flavors, favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return true if flavors.pop == favorite\n return false if flavors.length == 1 || flavors.empty?\n ice_cream_shop(flavors, favorite)\nend", "def ice_cream_shop(flavors,favorite)\r\n return false if flavors.length == 0\r\n return true if flavors[0] == favorite\r\n ice_cream_shop(flavors[1..-1],favorite)\r\nend", "def ice_cream_shop(flavors, favorite)\n return favorite == flavors[0] if flavors.length <= 1\n flavors[0] == favorite || ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return true if flavors.first == favorite\n ice_cream_shop(flavors[1..-1],favorite) until flavors.first == nil\nend", "def ice_cream_shop(flavors, favorite)\n return false if flavors.length == 0 #=> returns false if flavors arrray is empty\n last_flavor = flavors.pop #=> #pop the last flavor from the array \n return true if last_flavor == favorite #=> checking if the last flavor equals the favorite flavor is so return true\n # above is base case\n\n ice_cream_shop(flavors, favorite) #=> recusive case check the flavors array again with one less flavor now that since #pop was called\nend", "def ice_cream_shop(flavor, favorite)\n return false if flavor.empty?\n return flavor[0] == favorite if flavor.length == 1\n return flavor[0] == favorite || ice_cream_shop(flavor[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n flavors.empty? ? false : flavors.first == favorite ? true : ice_cream_shop(flavors.drop(1), favorite)\n end", "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n # favorite == flavors[0] if flavors.length == 1 #错的\n return true if favorite == flavors[0]\n ice_cream_shop(flavors[1..-1], favorite)\nend", "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n if flavors[0] == favorite && flavors.length == 1\n return true\n else\n pick_one_flavors = flavors.sample\n flavors.delete(pick_one_flavors) unless pick_one_flavors == favorite\n ice_cream_shop(flavors, favorite)\n end\nend", "def ice_cream_shop(flavors, favorite)\n flavors.select{|word| word == favorite }.empty? == false \nend", "def ice_cream_shop(arr, favorite)\n\n return false if arr.length == 0 \n\n if favorite == arr.pop \n return true\n else\n ice_cream_shop(arr, favorite)\n end\nend", "def ice_cream_shop(arr,flav)\n return true if arr[-1] == flav\n return false if arr.length == 0\n arr.pop\n ice_cream_shop(arr,flav)\nend", "def is_fav_food(person, test_food)\n fav_snacks = person[:favourites][:snacks]\n for snack in fav_snacks\n if snack == test_food\n return true\n end\n end\n return false\nend", "def favourites\n\t\tfavourites = Partay.get('http://shoponline.tescolotus.com/api/v1/favorites/by-category?page=1&sortby=Relevance&issecure=False', :headers => {'Content-Type' => 'application/json','language' => 'en-GB', 'region' => 'TH', 'userId' => access_token, 'Host' => 'r.tesco.com.my'})\n\t\tfavourites_counter = JSON(favourites)\n\t\tself.favourite_count(JSON(favourites_counter)[\"pageInformation\"][\"totalCount\"])\n\t\tif fav_count >= 1\n\t\t\tputs \"Your favourites count is:#{fav_count}\"\n\t\telse\n\t\t\traise \"There are no products in your favourites list.\"\n\t\tend\n\tend", "def describe_favorites(games)\n for game in games\n puts \"Favorite Game: #{game}\"\n end\nend", "def likes_to_eat(person, food)\n\n for x in person[:favourites][:snacks]\n if x == food\n return true\n end\n end\n return false\nend", "def get_favorites\n @user = User.find(self.id)\n return Shop.where(id: \n { :$in => @user.favorite_places })\n .each { |shop| pp \"#{shop.picture}, #{shop.name}, #{shop.email}, #{shop.city}, #{shop.location}\"}\n end", "def favorite_beverage_list(name, favorite_beverage)\n puts \"#{name}'s favorite beverage is #{favorite_beverage}!\"\nend", "def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # Hash of avaialble foods and associated counts\n \n pie_qty = 0\n cake_qty = 0 # quantity of the foods equals to 0 \n cookie_qty = 0\n \n has_fave = false # Initializes our has_fave tood to false\n\n my_list.each_key do |key| # iterating over my_list keys to do a comparison \n if key == fav_food # Favorite food comparison\n has_fave = true # confirms fav_food is in the list \n end\n # has_fave = true if key == fav_food\n end\n \n if has_fave == false # my_list does not contain fav_food \n raise ArgumentError.new(\"You can't make that food\") # Raise error if fav_food was not found\n else # Fav_food was in the list\n fav_food_qty = my_list[fav_food] #.values_at(fav_food)[0] # if in the list, return the quantity on hand *** refactor\n if num_of_people % fav_food_qty == 0 # Checks if num_of_people is evenly divisable by the fav_food_qty\n num_of_food = num_of_people / fav_food_qty # returns num_of_food eq to number of people / fav foods \n return \"You need to make #{num_of_food} #{fav_food}(s).\" # Return favorite food along with quantity\n else #num_of_people % fav_food_qty != 0 # num_of_people was not evenly divisable by fav_food_qty\n while num_of_people > 0 # while num_of_people is greater than zero \n if num_of_people / my_list[\"pie\"] > 0 # At least more people than the quantity of pie will feed \n pie_qty = num_of_people / my_list[\"pie\"] # quantity of pie is equal the number of people divided by my_list of pie \n num_of_people = num_of_people % my_list[\"pie\"] # number of people ramaining after distributing pies\n elsif num_of_people / my_list[\"cake\"] > 0 # At least more people than the quantity of cake \n cake_qty = num_of_people / my_list[\"cake\"] # quantity of cake is equal to the number of people divided by qty of people cake will feed\n num_of_people = num_of_people % my_list[\"cake\"] # number of people remaining after distributing cakes \n else # num_of_people is less than both qty that pie and cake will feed\n cookie_qty = num_of_people # cookie quantity is equal to the number of people \n num_of_people = 0 # Set num_of_people to 0 in order to end the loop\n end # Ending if-else conditions\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend", "def food_tastes(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend", "def find_the_cheese(snacks)\n cheeses = %w(gouda cheddar camembert)\n snacks.find do |maybe_cheese|\n cheeses.include?(maybe_cheese)\n end\nend", "def favorited?(user, coffeeshop)\n coffeeshop.users.each do |coffeeshop_user|\n return true if coffeeshop_user == user\n end\n return false\n end", "def favourite_foods(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend", "def favorite_recipes\n favorites.each do |f|\n f.recipe\n end\n end", "def likes_to_eat(person, food)\n food_array = person[:favourites][:snacks]\nreturn food_array.include?food\nend", "def any_apples?\n # code to check if tree has any oranges goes here\n @apples.length > 0\n end", "def likes_to_eat(person, food)\nreturn person[:favourites][:snacks].include?(food)\nend", "def favorite_brewery\n favorite :brewery\n end", "def true_for_food(hash, item)\n food= hash[:favourites][:things_to_eat]\n\n for i in hash\n if i == food\n\n return \"Yes I like this food\"\n end\n end\n return \"No I don't like this\"\n end", "def describe_favorites(*games)\n for game in games\n puts \"Favorite Game: #{game}\"\n end\nend", "def has_favourite_shop?(shop_id)\n return self.user_favourite_shops.find_by(shop_id: shop_id)\n end", "def find_the_cheese(ingredients)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n ingredients.detect {|item| cheese_types.include?(item)}\n #ingredients.find {|item| cheese_types.include?(item)}\n #ingredients.each {|item| return item if cheese_types.include?(item)}\n #else\n #return nil\nend", "def every_favourite_food(people)\n #Create a empty array to save all the strings\n all_food = \"\"\n #For loop to iterate person in the array people\n for person in people\n #For loop to iterate in snacks in person\n for snacks in person[:favourites][:snacks]\n #adds new items to the array\n p snacks\n all_food += snacks += \" \"\n end\n end\n all_food.chop!\n return all_food\nend", "def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n serving_sizes = { \"pie\" => 8, \"cake\" => 6, \"cookie\" => 1 } # Hash of available foods and associated counts\n food_quantities = { \"fav_food\" => 0, \"pie\" => 0, \"cake\" => 0, \"cookie\" => 0 } # Hash of food quantities\n\n # Raise error if serving sizes doesn't contain food\n raise ArgumentError.new(\"You can't make that food\") if !serving_sizes.has_key? (fav_food)\n\n # Returns the necessary number of food items needed to satisfy each serving if the \n # number of people attending is evenly divisible by the quantity of the passed favorite food.\n return \"You need to make #{num_of_people / serving_sizes[fav_food]} #{fav_food}(s).\" if num_of_people % serving_sizes[fav_food] == 0\n\n # Loop through each key in food_quantities to determine how many of each food item is needed.\n food_quantities.each do |key, value|\n if key == \"fav_food\" \n food_quantities[key] = num_of_people / serving_sizes[fav_food] # Setting \"fav_food\" property for future use in food_quantities\n food_quantities[fav_food] = food_quantities[key]\n num_of_people = num_of_people % serving_sizes[fav_food] # Setting remaining amount of people left after fav_food is determined.\n elsif num_of_people / serving_sizes[key] > 0 # key is not fav_food and number of remaining people divided by the next food item serving size is greater than zero\n food_quantities[key] = num_of_people / serving_sizes[key] # Setting count for additional food items needed for remaining people\n num_of_people = num_of_people % serving_sizes[key] # Setting number of remaining people after the additional food item\n end # Ending conditional\n end # Ending .each loop\n\n return \"You need to make #{food_quantities[\"pie\"]} pie(s), #{food_quantities[\"cake\"]} cake(s), and #{food_quantities[\"cookie\"]} cookie(s).\"\nend", "def find_the_cheese(food)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n food.find do |item|\n cheese_types.include?(item)\n end\n end", "def find_the_cheese(food)# code an argument here\n # the array below is here to help\n # check if elements in food are included in cheese_types\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n food.find do |i|\n if !cheese_types.include?(i)\n nil\n else\n true\n end\n end\nend", "def is_favorite?\n\t favorite?\n\tend", "def favorite_brewery\n favorite :brewery\n end", "def view_all_favorites(customer)\n customer_favs = customer.favorites # get favorites from customer\n\n get_res_id = customer_favs.map do |fav_res| # get restaurant IDs from favorites\n fav_res.restaurant_id\n end\n\n get_res = Restaurant.all.select do |res| # get restaurants from their IDs\n get_res_id.include?(res.id)\n end\n\n res_names = get_res.map do |res| # get names from restaurants\n res.name\n end\n\n new_res = res_names.each_with_index do |fav_res_name, index|\n puts \"#{index + 1}. #{fav_res_name}\"\n end\n # favorite_restaurants = Restaurant.where(id: customer.favorites.map(&:restaurant_id))\n # puts favorite_restaurants.map(&:name)\n main_menu($customer)\nend", "def favorite_check user, img\n user.favorites.each do |fav|\n if fav.image_id == img.id\n return true\n end\n end\n\n return false\n end", "def find_the_cheese(food)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n food.find do |item|\n cheese_types.find do |cheese|\n item == cheese\n end\n end\nend", "def ice_cream_shop(arr, str)\n return false if arr.empty?\n if arr[0] != str \n ice_cream_shop(arr[1..-1], str)\n else \n true\n end \n end", "def fruit([])\n\nend", "def get_basket(variety)\n basket_with_space = find_basket_with_space()\n basket_with_same_variety = basket_with_space.find { |b| b.apples.first.variety == variety && b.apples.size > 0 }\n if basket_with_same_variety.nil?\n # return some other completely empty basket\n basket_with_space.find { |b| b.apples.size == 0 }\n else\n # return basket with same variety of apples\n basket_with_same_variety\n end\nend", "def bake_cake servings\n\t#in the beginning the oven is off, and the bowl is empty\n\toven_on = false\n\tbowl = \"\"\n\t#Step 1: turn on the oven\n\n\tputs \"Is the oven on? \" + oven_on.to_s\n\n\t#Step 2: add flour, add eggs, add sugar\n\n\tputs \"The bowl currently has: \" + bowl #should have all ingredients listed with the right quantities!\n\t\nend", "def bakery_num(num_of_people, fav_food) # this is defining bakery_num and takes 2 inputs\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # creates hash, keys are baked goods, values are how many you can feed\n pie_qty = 0 # sets pie_qty to zero\n cake_qty = 0\n cookie_qty = 0\n \n has_fav = false # rename?\n\n my_list.each_key do |k| # iterates through each key in my_list\n if k == fav_food # if they key matches fav_food input\n has_fav = true # change has_fav to true\n end\n end\n \n if has_fav == false # If food isn't in stock/ isn't found\n raise ArgumentError.new(\"You can't make that food\")\n \n else\n fav_food_qty = my_list.values_at(fav_food)[0] # quantity of people favorite food can feed\n \n if num_of_people % fav_food_qty == 0 # if num_of_people can be divided evenly by fav_food_qty\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n else\n num_of_fav_food = num_of_people / fav_food_qty\n num_of_people = num_of_people % fav_food_qty\n \n while num_of_people > 0\n cake_qty = num_of_people / my_list[\"cake\"]\n if num_of_people % my_list[\"cake\"] > 0\n cookie_qty = num_of_people\n num_of_people = 0\n end \n end\n \n if fav_food == \"pie\"\n pie_qty = num_of_fav_food\n elsif fav_food == \"cake\"\n cake_qty = num_of_fav_food\n else\n cookie_qty = num_of_fav_food\n end\n\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n \n \n end \n end\nend", "def find_the_cheese(potentially_cheesy_items)\n cheeses = %w(gouda cheddar camembert)\n\n potentially_cheesy_items.find do |maybe_cheese|\n cheeses.include?(maybe_cheese)\n end\nend", "def user_favourites(current_user, product)\n Favourite.where(user_id: current_user, product_id: product) > 0\n end", "def person_cheers_song(pl, favourite_song)\n \n for tune in pl\n if tune == favourite_song\n return \"yaaay!\"\n else \n return \"didn't find my favourite\" \n end \n end \n end", "def find_the_cheese(array)\n cheeses = %w[gouda cheddar camembert]\n\n array.find do |cheese_flavor|\n cheeses.include?(cheese_flavor)\n end\nend", "def find_the_cheese(foods) # code an argument here\n # the array below is here to help\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n\n cheese_types.find do |cheese|\n foods.include?(cheese)\n end\n\nend", "def find_the_cheese(foods)\n foods.find{ |cheese| cheese == \"cheddar\" || cheese == \"gouda\" || cheese ==\n \"camembert\"}\nend", "def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n favorite_array = Favorite.where(user_id:current_user.id)\n \n favorite_array.each do |favorite|\n puts Brewery.find(favorite.brewery_id).name\n puts Brewery.find(favorite.brewery_id).street\n puts Brewery.find(favorite.brewery_id).city\n puts Brewery.find(favorite.brewery_id).state\n end \n # current_user.favorites\n end", "def favorited?(test_image)\n favorites.where(image_id: test_image.id).any?\n end", "def like_food?(food, person)\n person[:favourites][:things_to_eat].include?(food)\nend", "def favorites(action=nil)\n my.favorites(action)\n end", "def select_by_flavors \n\n selections = @@prompt.multi_select(\"Select flavors. Returns a list of all dishes that include those flavors.\", Flavor.active_flavor_names, cycle: true)\n # if dish's flavors - selections == 0, then that dish should be included! \n # iterate through all the dishes \n dishes_to_return = []\n # push that dish to dishes_to_return if that dish's flavors match our selections array \n Dish.all.select{ |dish| \n dish_flavor_array = dish.flavors.map{|flavor|flavor.name} \n if selections - dish_flavor_array == [] && selections != []\n dishes_to_return << dish \n # binding.pry\n end \n if selections == []\n system 'clear'\n puts \"Please select at least one flavor\"\n select_by_flavors\n end\n }\n # print each dish that matches \n if dishes_to_return.length == 0 \n puts \"There are no dishes matching those flavors\"\n if @@prompt.yes?(\"Would you like to search again?\")\n system 'clear'\n select_by_flavors\n else\n main_menu\n end \n else \n puts \"These dishes match those flavors: \"\n dishes_to_return.map{|dish| dish.print_dish}\n if @@prompt.yes?(\"Would you like to search again?\")\n system 'clear'\n select_by_flavors\n else\n main_menu\n end\n end \n end", "def bakery_num(num_of_people, fav_food) #Defining a function that takes two parameters\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #Declaring a my_list hash\n pie_qty = 0 # Assigning three other variables \n cake_qty = 0\n cookie_qty = 0\n \n has_fave = false #setting a default value of false \n\n my_list.each_key do |k| #looping through the keys of my_list\n if k == fav_food #An if statement, where the condition is comapred to one of the parameters\n has_fave = true #If true, declaring a has_fave to true \n fav_food = k #Assigning fav_food to that key\n end\n end\n if has_fave == false #If no matec ==> error\n raise ArgumentError.new(\"You can't make that food\")\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #If match ==> find value from Hash \n if num_of_people % fav_food_qty == 0 #Module of the first function parameter, number of people by fav food quantity\n num_of_food = num_of_people / fav_food_qty #If true, get portions \n return \"You need to make #{num_of_food} #{fav_food}(s).\" #return an order \n else num_of_people % fav_food_qty != 0 #redundant but if not \n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if there are more people than pies\n pie_qty = num_of_people / my_list[\"pie\"] #This gets portions\n num_of_people = num_of_people % my_list[\"pie\"] #this gets amount of people for leftovers \n elsif num_of_people / my_list[\"cake\"] > 0 #If the number of people is not rgeater than pies, we go into cakes\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend", "def favourite_food name\r\n\tif name == \"Lister\"\r\n\t\treturn \"vindaloo\"\r\n\tend\r\n\r\n\tif name == \"Rimmer\"\r\n\t\treturn \"mashed potatoes\"\r\n\tend\r\n\r\n\t\"hard to say...maybe fired plantain?\"\r\nend", "def grill_cheese(bread, cheese, cheese_num, melt)\n # If cheese_num is greater than 3 cheese slices you want it extra cheesy.\n if cheese_num > 3\n # Patty melt instead of grilled cheese sando.\n if melt == true\n puts \"We got one extra cheesy #{cheese} patty melt on #{bread}, coming right up!\"\n else\n puts \"We got one extra cheesy #{cheese} grilled cheese on #{bread}, coming right up!\"\n end\n # For less cheesey sandwich\n else\n # Patty melt instead of grilled cheese sando.\n if melt == true\n puts \"We got one cheesy #{cheese} patty melt on #{bread}, coming right up!\"\n else\n puts \"We got one cheesy #{cheese} grilled cheese on #{bread}, coming right up!\"\n end\n end\nend", "def apple_picker(fruits)\n apple_array = []\n fruits.each do |fruit|\n if fruit == \"apple\"\n apple_array << fruit\n end\n end\n apple_array\nend", "def find_the_cheese(ingredients)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n #I originally did it this way, but the instructions said to use \"include?\"\n #ingredients.detect { |ingredient| ingredient == cheese_types[0] || ingredient == cheese_types[1] || ingredient == cheese_types[2]}\n ingredients.find do |ingredient|\n cheese_types.include?(ingredient)\n end\nend", "def favorite\n puts FAVE\n end", "def bakery_num(num_of_people, fav_food) #defining method bakery_num, which takes 2 arguments\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1, \"pudding\" => 2, \"bunt cake\" => 4, \"mega-cupcakes\" => 3} #creates hash my_list, key is food, value is number\n pie_qty = cake_qty = cookie_qty = has_fave = 0 \n \n\n my_list.each_key do |k| #iterating through array my_list\n if k == fav_food #tests if each item in array my_list = fav_food\n has_fave = 1 #if test above passes, set has_fave to true\n # fav_food = k #if test above passes, set fav_food to k\n end\n end\n \n if has_fave == 0 #if fav_food is not a key, end program\n raise ArgumentError.new(\"You can't make that food\")\n else #if fav_food is a key\n fav_food_qty = my_list.values_at(fav_food)[0] #set fav_food_qty equal to the value of fav_food\n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty #if num_of_people is evenly divisible by fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n #num_of_food = num_of_people / fav_food_qty #then perform division by integer\n #return \"You need to make #{num_of_food} #{fav_food}(s).\" #return \"You need to make (num_of_food) (fav_food)s\"\n else num_of_people % fav_food_qty != 0 #redundant else\n while num_of_people > 0 #while num_of_people is greater than 0\n if num_of_people / my_list[\"pie\"] > 0 #if num_of_people divided by value of pie is greater than 0\n pie_qty = num_of_people / my_list[\"pie\"] #set pie_qty equal to num_of_people divided by value of pie in hash\n num_of_people = num_of_people % my_list[\"pie\"] #set num_of_people equal to the remainder of num_of_people divided by value of pie in hash\n elsif num_of_people / my_list[\"cake\"] > 0 #if num_of_people divided by hash value of cake is greater than 0\n cake_qty = num_of_people / my_list[\"cake\"] #set cake_qty equal to num_of_people divided by hash value of cake\n num_of_people = num_of_people % my_list[\"cake\"] #set num_of_people equal to the remainder of num_of_people divided by value of cake in hash\n else\n cookie_qty = num_of_people #set cookie_qty equal to num_of_people\n num_of_people = 0 #set num_of_people equal to 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\" #print out\n end\n end\n \nend", "def bakery_num(num_of_people, fav_food) #defines the method and accepts arguments num_of_people and fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n pie_qty = 0 #declaring variables at 0\n cake_qty = 0 #declaring variables at 0\n cookie_qty = 0 #declaring variables at 0\n \n has_fave = false\n\n my_list.each_key do |k| #iterates through the keys in my_list\n if k == fav_food #checks if passed argument fav_food is in the hash as a key\n has_fave = true #sets boolean has_fave to true\n fav_food = k #re-assigns fav_food to the key in the hash\n end\n end\n \n if has_fave == false #if fav_food is not found in the list\n raise ArgumentError.new(\"You can't make that food\") #raise an error\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #declares a variable that is the quantity of fav food argument and sets it equal to first element in the value\n \n if num_of_people % fav_food_qty == 0 #if number of people is divisable by quantity of fav food\n num_of_food = num_of_people / fav_food_qty #number of food is set to number of people divided by fav food quantity\n return \"You need to make #{num_of_food} #{fav_food}(s).\" #returns string concatenated declaring how much of the food to make\n \n else num_of_people % fav_food_qty != 0 #if num of people is not divisable by fav food qty\n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if number of people divided by number of pies floor is greater than 0 \n pie_qty = num_of_people / my_list[\"pie\"] #sets pie quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"pie\"] #num of people reassigned to remainder \n elsif num_of_people / my_list[\"cake\"] > 0 #if number of people divided by number of cakes floor is greater than 0\n cake_qty = num_of_people / my_list[\"cake\"] #sets cake quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"cake\"] #num of people reassigned to remainder \n else\n cookie_qty = num_of_people #sets cookie qty to number of people remaining\n num_of_people = 0 #ends the loop if \"cookie else\" is reached\n end\n end\n \n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\" #returns the string, whole combination\n end\n end\nend", "def flavors()\n return get_request(address(\"/flavors/detail\"), @token)\t\n end", "def my_favorites\n\tend", "def bakery_num(num_of_people, fav_food) #defining a method bakery_number. Takes number of people and favorite food as parameters \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #hash- my_list that has type of food as a key and amount of food as a value\n pie_qty = 0 # set default quantity to zero \n cake_qty = 0 # set default quantity to zero \n cookie_qty = 0 # set default quantity to zero \n \n ##has_fave = false # setting has_fave to false ##\n\n #my_list.each_key do |k| # we are iterating over my_list key values \n #if k == fav_food # if one of the keys matches fav_food, then...\n #has_fave = true # has_fave is set to true \n ##fav_food = k ##not necessary \n #closed out if statement \n if my_list.has_key?(fav_food) \n fav_food_qty = my_list.values_at(fav_food)[0] \n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty \n return \"You need to make #{num_of_food} #{fav_food}(s).\" \n else \n case fav_food\n when \"pie\"\n if num_of_people / my_list[\"pie\"] > 0 \n pie_qty = num_of_people / my_list[\"pie\"] \n num_of_people = num_of_people % my_list[\"pie\"] \n elsif num_of_people / my_list[\"cake\"] > 0 \n cake_qty = num_of_people / my_list[\"cake\"] \n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n when \"cake\"\n if num_of_people / my_list[\"cake\"] > 0 \n cake_qty = num_of_people / my_list[\"cake\"] \n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n when \"cookie\"\n cookie_qty = num_of_people\n num_of_people = 0\n else\n \"You need to pick pie, cake, or cookie\"\n end \n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end \n end \n else \n raise ArgumentError.new(\"You can't make that food\") # raise argument using a string \n end", "def baskets_full(apple_count)\n puts \"All baskets are full. We couldn't find the place for #{apple_count} apples\"\nend", "def favorite_hashtags\n favorite_stuffs(:hashtags, :text, 3)\n end", "def get_info_on_club(fixture)\n puts \"See when your favourites are playing:(enter favourite club name)\"\n fav_club = gets.chomp\n all_fav_matches = fixture.map do |game|\n if game[:home_team].downcase.include?(fav_club) || game[:away_team].downcase.include?(fav_club)\n game\n end\n end.compact\n\n if all_fav_matches.empty?\n puts \"Did not match the database!\"\n else\n puts all_fav_matches\n end\nend", "def favorite(category, user)\n shows_by_category = user.shows.group_by({|show| show.send(category.downcase + \"_id\")})\n category_count = shows_by_category.each { |k,v| shows_by_category[k] = v.count}\n if category_count.empty?\n \"None.\"\n else\n Object.const_get(category).find(category_count.max_by{|k,v| v}[0]).name\n end\nend", "def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n \n current_user.breweries.each do |brewery|\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n puts brewery.name\n puts brewery.street\n puts brewery.city\n puts brewery.state\n puts brewery.phone\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n end \n end", "def favorite?\n @favorite\n end", "def favorite?\n @favorite\n end", "def favorite_for(user)\n favs.find_by(user_id: user)\n end", "def check_favorite username, password, slideshow_id\n do_request 'check_favorite', username: username, password: password, slideshow_id: slideshow_id\n end", "def likes?(food)\n\tresult = [\"bananas\", \"eggs\", \"bacon\", \"cheese\"].detect{|x| x == food}\n\t if result.nil?\n\t \tfalse\n\t else\n\t \ttrue\n\t end\nend", "def favoriter?\n true\n end", "def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n has_fave = false\n\n my_list.each_key do |k|\n if k == fav_food\n has_fave = true\n fav_food = k\n end\n end\n if has_fave == false\n raise ArgumentError.new(\"You can't make that food\")\n else\n fav_food_qty = my_list.values_at(fav_food)[0]\n if num_of_people % fav_food_qty == 0\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else num_of_people % fav_food_qty != 0\n while num_of_people > 0\n if num_of_people / my_list[\"pie\"] > 0\n pie_qty = num_of_people / my_list[\"pie\"]\n num_of_people = num_of_people % my_list[\"pie\"]\n elsif num_of_people / my_list[\"cake\"] > 0\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend", "def check_fav\n print \"Are they a favorite? (y/n): \"\n user_fav = gets.strip\n if user_fav == \"y\"\n return true\n elsif user_fav == \"n\"\n return false \n else\n puts \"not vaild input\"\n check_fav\n end\nend", "def has_favourite_recipe?(user_id, yummly_id)\n return self.user_favourite_recipes.has_user_favourites_for_recipe?(user_id, yummly_id)\n end" ]
[ "0.85914654", "0.8256179", "0.8204483", "0.81669104", "0.81622183", "0.8137911", "0.8128142", "0.8102174", "0.81006896", "0.80890834", "0.80784893", "0.8051379", "0.803514", "0.8023674", "0.7987004", "0.7960586", "0.79499376", "0.7944276", "0.7929472", "0.7905324", "0.78563327", "0.7823775", "0.77798384", "0.77686083", "0.7763812", "0.7542697", "0.73067635", "0.71039206", "0.6901007", "0.60819864", "0.5849156", "0.56843746", "0.55890125", "0.5566099", "0.55395114", "0.55239964", "0.5461452", "0.5451341", "0.5450393", "0.5421387", "0.5420439", "0.5415793", "0.5387261", "0.5381154", "0.53579324", "0.5324014", "0.53228116", "0.53204733", "0.53146046", "0.53121156", "0.5302932", "0.52982235", "0.5287896", "0.52780974", "0.5259746", "0.5252258", "0.5218084", "0.52072394", "0.5187903", "0.5176709", "0.51706713", "0.5139619", "0.51334655", "0.51214653", "0.5120264", "0.51060724", "0.51034546", "0.5102587", "0.50998324", "0.5087665", "0.5087646", "0.5085142", "0.5082176", "0.50796723", "0.5072861", "0.5068296", "0.5059662", "0.5047051", "0.5046179", "0.50430864", "0.50302374", "0.500245", "0.49941722", "0.49936622", "0.49850416", "0.4980594", "0.4976783", "0.4972905", "0.4961995", "0.4953417", "0.4946852", "0.49465722", "0.49465722", "0.49372804", "0.4933553", "0.49318486", "0.49294958", "0.49281025", "0.49212995", "0.4920284" ]
0.80819464
10
=> returns false Write a function reverse(string) that takes in a string and returns it reversed.
def reverse(string) return "" if string.length == 0 return string[0] if string.length == 1 reverse(string[1..-1]) + string[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_string(string)\n answer = string.reverse\n return answer\nend", "def reverse_string(string)\n reverse = string.reverse\n return reverse\nend", "def reverse(string)\nend", "def reverse_string(s)\n s.reverse!\nend", "def reverse(str)\n return str.reverse()\nend", "def reverse(str)\n return str.reverse()\nend", "def reverse_string(string)\n\treturn string.reverse\nend", "def reverse_string(string)\r\n return string.reverse\r\nend", "def reverse(string)\n\tstring.reverse\nend", "def reverse(string)\n\tstring.reverse\nend", "def reverse(string)\n\tstring.reverse\nend", "def reverse(string)\n \n string.reverse!\nend", "def reverse_string(string)\nreturn string.reverse\nend", "def Reverse(str)\n return str.reverse! # Okay, completely useless\nend", "def reverseString(string)\n\nend", "def reverse(string)\n string.reverse\nend", "def reverse(string)\n string.reverse\nend", "def reverse_string input\n input.reverse\nend", "def reverse_string string\n\tstring.reverse\nend", "def reverse_string(str)\nend", "def reverse(s)\nend", "def reverse(s)\n return s.reverse\nend", "def reverse_string str \n str.reverse\nend", "def reverse_string string \n\tstring.reverse\nend", "def reverse_string string\n string.reverse\nend", "def reverse_string(str)\n str.reverse\n end", "def reverse(str)\n str.reverse\nend", "def palindrome (input_string)\n input_string == input_string.reverse\nend", "def isPalindrome(string)\n return string.reverse == string\nend", "def isPalindrome(string)\n string == string.reverse\nend", "def reverse (string)\n # Your code here\nend", "def palindrome (string)\n\n if string.reverse == string\n return true\n else\n return false\n end\n \nend", "def reverse(string)\n return \"\" if string == \"\"\n return string if string.length == 1\n return string[-1] + reverse(string[0..-2])\nend", "def reverse(string)\n return \"\" if string.length == 0\n\n string[-1] + reverse(string[0...-1])\nend", "def reverse_str(str)\n str.reverse\nend", "def reverse(string)\n return string if string.length <= 1\n string[-1] + reverse.string[0...-1]\nend", "def reverse(string)\n return \"\" if string.length == 0\n return string if string.length == 1\n return string[-1] + reverse(string[0..-2])\nend", "def palindrome?(string)\r\n string.reverse == string\r\nend", "def palindrome?(string)\r\n string.reverse == string\r\nend", "def palindrome?(string)\r\n string.reverse == string\r\nend", "def palinodrome?(string)\n string == my_reverse(string)\nend", "def reverse(s)\n s.reverse\nend", "def reverse(string)\n return string if string.empty?\n string.last + reverse(string[0...-1])\nend", "def palindrome(str)\n str == str.reverse\nend", "def palindrome string #func param: string, name: palindrome\n string = string.downcase.scan(/\\w/) #make sure the value is lower case\n string == string.reverse #see if it equals its reverse, and return as boolean statement \nend", "def reverse(string)\n string.length > 1 ? string[-1] + reverse(string[0...-1]) : string\n end", "def is_palindrome(str)\n return str == str.reverse\nend", "def palindrome?(string)\n string.reverse == string\nend", "def palindrome?(string)\n string.reverse == string\nend", "def palindrome?(string)\n string.reverse == string\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome('')\n if string == string.reverse\n return true\n else\n puts \"String is not a palindrome\"\n end\nend", "def reverse(string)\n return string if string.length <= 1\n return string[-1] + reverse(string[0...-1])\nend", "def reverse_string(string1)\n\tstring1.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def reverse(string)\n return string if string.empty?\n string[-1] + reverse(string[0..-2])\nend", "def palindrome?(string)\n if string == string.reverse\n return true\n else \n return false\n end\nend", "def reverse(string)\n return string if string.empty?\n\n reverse(string[1..-1]) + string[0]\nend", "def test(string)\n reverse_string = string.reverse\n if string == reverse_string\n puts \"#{string} is a palindrome\"\n else\n puts \"#{string} is not a palindrome\"\n end\nend", "def reverse(s)\n # raise NotImplementedError, \"Method not implemented\"\n return s.slice(-1) + reverse(s.slice(0, s.length - 1)) unless s.length.zero?\n return \"\" if s.length.zero?\nend", "def reverse(string)\n return string if string.length <= 1\n\n string.slice!(-1) + reverse(string)\nend", "def reverse_string s1\n s1.reverse\nend", "def palindrome?(str)\r\n str == str.reverse\r\nend", "def reverse(string)\n return string if string.length <= 1\n string[-1] + reverse(string[0..-2])\nend", "def reverse(string)\n return string if string.length <= 1\n string[-1] + reverse(string[0..-2])\nend", "def reverse(string)\n return string if string.length <= 1\n string[-1] + reverse(string[0..-2])\nend", "def reverse(string)\n return string if string.length <= 1\n string[-1] + reverse(string[0..-2])\nend", "def reverse(string)\n return string if string.length < 2\n reverse(string[1..-1]) + string[0]\nend", "def is_palindrome(str)\n str.to_s == str.to_s.reverse\nend", "def reverse(s)\n # raise NotImplementedError, \"Method not implemented\"\n if s.length <= 1 # will stop once string is equal to 1 or less\n return s\n else\n return s[-1] + reverse(s[0..-2])\n end\nend", "def reverse(str)\n return \"\" if str == \"\"\n str[-1] + reverse(str[0..-2])\nend", "def palindrome(string)\n\tif string == string.reverse\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def reverse(string)\n return string if string.length <= 1\n return string[-1] + reverse(string[0..-2])\nend", "def palindrome?(str)\n str.reverse == str\nend", "def palindrome?(str)\n str.reverse == str\nend", "def palindrome?(str)\n str.reverse == str\nend", "def palindrome?(str)\n str.reverse == str\nend", "def reverse(string)\n return string if string.length == 0\n reverse(string[1..-1]) + string[0]\nend", "def isPalidrome(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend", "def palindrome?(str)\n str == str.reverse\nend" ]
[ "0.84106237", "0.8379405", "0.8349062", "0.8336613", "0.83336335", "0.83160585", "0.8314077", "0.8284059", "0.82519865", "0.82519865", "0.82519865", "0.82319546", "0.82033616", "0.817473", "0.8174294", "0.8157376", "0.8157376", "0.8092723", "0.8075627", "0.806348", "0.80587727", "0.8047013", "0.8037958", "0.803103", "0.8026306", "0.8025515", "0.7987015", "0.7984937", "0.7978535", "0.79710394", "0.79700893", "0.79460347", "0.7921611", "0.7899417", "0.78783035", "0.7877666", "0.7872487", "0.7866698", "0.7866698", "0.7866698", "0.78353554", "0.78262174", "0.78171235", "0.7808806", "0.7803785", "0.7800214", "0.77974826", "0.7794043", "0.7794043", "0.7794043", "0.7786633", "0.7782773", "0.77825123", "0.7767109", "0.7765104", "0.7765104", "0.7765104", "0.7765104", "0.7765104", "0.7765104", "0.7765104", "0.7765104", "0.7765104", "0.7765104", "0.7765104", "0.77479374", "0.77450585", "0.7742761", "0.7735126", "0.7730923", "0.7728052", "0.77213067", "0.7702423", "0.7701633", "0.7701633", "0.7701633", "0.7701633", "0.76912004", "0.7690584", "0.7689908", "0.7688698", "0.768789", "0.7676752", "0.76763827", "0.76763827", "0.76763827", "0.76763827", "0.7669925", "0.7668259", "0.7667417", "0.7667417", "0.7667417", "0.7667417", "0.7667417", "0.7667417", "0.7667417", "0.7667417", "0.7667417", "0.7667417", "0.7667417", "0.7667417" ]
0.0
-1
GET /logs GET /logs.json
def index if current_user.admin @logs = Log.all else @logs = Log.where(:reference_code => current_user.content_code) @clientlogs = Log.where(:client_code => current_user.client_code) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end", "def log\n @client.get(\"#{path}/log\")\n end", "def index\n @wr_logs = WrLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wr_logs }\n end\n end", "def show\n render json: @log\n end", "def index\n @logs = @goal.logs.order('log_date DESC')\n @log = Log.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "def logs\n ret = @uri.logs\n render plain: ret[:message], status: ret[:status]\n end", "def logs(app_name)\n\t\tget(\"/apps/#{app_name}/logs\")\n\tend", "def index\n @logs = Log\n .order(start_time: :desc)\n .limit(100)\n .offset(params[:offset])\n\n render json: @logs\n end", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log }\n end\n end", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log }\n end\n end", "def index\n @d_loggers = DLogger.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @d_loggers }\n end\n end", "def list_logs_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs ...'\n end\n # resource path\n local_var_path = '/api/v2/logs/events/search'\n\n # query parameters\n query_params = opts[:query_params] || {}\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'])\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 = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'LogsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_logs,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsAPI#list_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end", "def index\n @logs = Log.all\n end", "def show\n @d_logger = DLogger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @d_logger }\n end\n end", "def logs_get(opts = {})\n data, _status_code, _headers = logs_get_with_http_info(opts)\n data\n end", "def index\n @deployment_logs = DeploymentLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deployment_logs }\n end\n end", "def food_logs(user_id: '-', date: Date.today)\n return get(\"#{API_URI}/#{FOOD_API_VERSION}/user/#{user_id}/foods/log/date/#{date}.json\")\n end", "def index\n @user_logs = UserLog.paginate(:page => params[:page], :per_page => 30).order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_logs }\n end\n end", "def index\n @log_items = @goal.log_items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @log_items }\n end\n end", "def show\n @dlog = Dlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dlog }\n end\n end", "def logs\n cloud = Cloud.instance\n cloud.auth_for_accounts [id]\n cloud.get(['cloud-service-logging', 'accounts', id, 'logs', 'paginated?lang=DE']).body.logs\n end", "def show\n @log_entry = LogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @log_entry }\n end\n end", "def index\n @web_service_logs = WebServiceLog.limit(20).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @web_service_logs }\n end\n end", "def index\n @interaction_logs = InteractionLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interaction_logs }\n end\n end", "def index\n @daily_logs = current_user.daily_logs.order(\"updated_at DESC\")\n render json: @daily_logs, each_serializer: Rest::DailyLogSerializer\n end", "def index\n @server_monitor_logs = ServerMonitorLog.fetch_log(params) \n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log_item }\n end\n end", "def show\n @web_service_log = WebServiceLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_service_log }\n end\n end", "def list(options={})\n Mailgun.submit(:get, log_url, options)\n end", "def read_logs_all()\n logs = Log.find(:all, :order => 'created_at asc')\n end", "def show\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n\n respond_to do |format|\n format.html { render :show, layout: false } # show.html.erb\n format.json { render json: @httping_log }\n end\n end", "def logs(options = {})\n request_params = {\n q: options.fetch(:q, nil),\n page: options.fetch(:page, nil),\n per_page: options.fetch(:per_page, nil),\n sort: options.fetch(:sort, nil),\n fields: options.fetch(:fields, nil),\n include_fields: options.fetch(:include_fields, nil),\n include_totals: options.fetch(:include_totals, nil),\n from: options.fetch(:from, nil),\n take: options.fetch(:take, nil)\n }\n if request_params[:take].to_i > 100\n raise Auth0::InvalidParameter, 'The total amount of entries to retrieve should be less than 100'\n end\n if request_params[:per_page].to_i > 100\n raise Auth0::InvalidParameter, 'The total amount of entries per page should be less than 100'\n end\n get(logs_path, request_params)\n end", "def show\n @user_log = UserLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_log }\n end\n end", "def show\n @log = @client.logs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log }\n end\n end", "def index\n @user = current_user;\n @toeic_logs = ToeicLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @toeic_logs }\n end\n end", "def index\n @log_types = LogType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @log_types }\n end\n end", "def recent_foods\n get(\"/user/#{@user_id}/foods/log/recent.json\")\n end", "def index\n\t\t\t@logs = AppTracker::Log.order('created_at DESC').paginate(:page => params[:page], :per_page => 50)\n\t\tend", "def index\n @ncr_api_logs = NcrApiLog.all\n end", "def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end", "def logs\n\n end", "def list\n websites = @logs.records\n @view.show(websites)\n end", "def show\n respond_to do |f| \n f.json {\n render :json => { \n :activity_log => @activity_log,\n :snapshots => @activity_log.snapshots.order(\"id ASC\")\n }\n }\n end\n end", "def get_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsApi.get_logs ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling LogsApi.get_logs, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling LogsApi.get_logs, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/logs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\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] || 'LogsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"LogsApi.get_logs\",\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: LogsApi#get_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_logs(user_id:, queries: nil)\n path = '/users/{userId}/logs'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n queries: queries,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::LogList\n )\n end", "def get_logs(opts = {})\n data, _status_code, _headers = get_logs_with_http_info(opts)\n data\n end", "def index\n fetch_activity_logs\n\n respond_to do |format|\n format.html\n format.js\n format.json do\n query = params[:query]\n if query\n actions = ActivityLog.all_actions(query)\n render json: actions\n else\n render json: @activity_logs\n end\n end\n end\n end", "def new\n @log = Log.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @log }\n end\n end", "def logs\n end", "def show\n @message_log = MessageLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_log }\n end\n end", "def index\n @entry_logs = EntryLog.all\n end", "def show\n @logstash = Logstash.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logstash }\n end\n end", "def log_contents\n if API_KEYS[\"logentries\"]\n account_key = API_KEYS[\"logentries\"][Rails.env][\"account_key\"]\n log_set = API_KEYS[\"logentries\"][Rails.env][\"log_set\"]\n log_name = \"nsc\"\n url = \"https://pull.logentries.com/#{account_key}/hosts/#{log_set}/#{log_name}/?filter=#{log_prefix}\"\n Rails.logger.debug { \"Fetching log from #{url}\" }\n open(url).read\n else\n File.read(log_path)\n end\n end", "def retrieve_logs_for_download\n parse_files_for_download\n\n output = ''\n jsons.reverse_each do |elem|\n output.insert(0, insert_log_line_for_download(elem))\n end\n\n output\n end", "def get_webhook_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsApi.get_webhook_logs ...'\n end\n # resource path\n local_var_path = '/logs/webhooks'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'created_at_from'] = opts[:'created_at_from'] if !opts[:'created_at_from'].nil?\n query_params[:'created_at_to'] = opts[:'created_at_to'] if !opts[:'created_at_to'].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 = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'WebhookLogListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsApi#get_webhook_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_logs_get_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs_get ...'\n end\n allowable_values = ['indexes', 'online-archives']\n if @api_client.config.client_side_validation && opts[:'filter_storage_tier'] && !allowable_values.include?(opts[:'filter_storage_tier'])\n fail ArgumentError, \"invalid value for \\\"filter_storage_tier\\\", must be one of #{allowable_values}\"\n end\n allowable_values = ['timestamp', '-timestamp']\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_limit\"]\" when calling LogsAPI.list_logs_get, must be smaller than or equal to 1000.'\n end\n # resource path\n local_var_path = '/api/v2/logs/events'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil?\n query_params[:'filter[indexes]'] = @api_client.build_collection_param(opts[:'filter_indexes'], :csv) if !opts[:'filter_indexes'].nil?\n query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?\n query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil?\n query_params[:'filter[storage_tier]'] = opts[:'filter_storage_tier'] if !opts[:'filter_storage_tier'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?\n query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].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'])\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] || 'LogsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_logs_get,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsAPI#list_logs_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_user_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LogsApi.get_user_logs ...\"\n end\n # resource path\n local_var_path = \"/audit/logs\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_user'] = opts[:'filter_user'] if !opts[:'filter_user'].nil?\n query_params[:'filter_action_name'] = opts[:'filter_action_name'] if !opts[:'filter_action_name'].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 => 'PageResourceUserActionLog')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsApi#get_user_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @exercise_log = ExerciseLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_log }\n end\n end", "def show\n @applicationlog = Applicationlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicationlog }\n end\n end", "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "def show\n @event_log_entry = EventLogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_log_entry }\n end\n end", "def index\n @data_logs = DataLog.all\n end", "def read_logs_all()\n #logs = Log.find(:all, :order => 'created_at asc')\n logs = Log.all.order('created_at asc')\n end", "def get_logs(opt={})\n opt[:from] ||= Date.today\n #opt[:to] ||= Date.today - 1\n opt[:parse] = opt[:parse].nil? ? true : opt[:parse]\n \n #raise \":from date must preceed :to date.\" if opt[:to] && opt[:to] < opt[:from]\n \n uri_str = \"#{API_URL}/GetDailyReportLogs/#{options[:site]}?#{self.generate_authorization_token}\"\n uri_str << \"&StartDate=#{opt[:from]}\"\n uri_str << \"&EndDate=#{opt[:to]}\" if opt[:to]\n url = URI.parse uri_str\n \n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n resp = http.start {\n request = Net::HTTP::Get.new(url.to_s)\n response = http.request(request)\n response.body\n }\n if resp =~ /No.*?log data found/\n return opt[:parse] ? [] : resp\n end\n \n return opt[:parse] ? Log.parse(resp) : resp\n end", "def list_logs_get(opts = {})\n data, _status_code, _headers = list_logs_get_with_http_info(opts)\n data\n end", "def index\n @weight_logs = current_user.weight_logs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weight_logs }\n end\n end", "def index\n# @time_logs = TimeLog.all\n @time_logs = TimeLog.paginate :page => params[:page], :per_page => 10, :order => 'site_id'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_logs }\n end\n end", "def log\n count = default_log_lines(params)\n lines = get_file_lines(log: true, tail: count)\n respond_with(lines)\n end", "def show\n @heat_log = HeatLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_log }\n end\n end", "def logs(app_name)\n deprecate # 07/31/2012\n get(\"/apps/#{app_name}/logs\").to_s\n end", "def read_logs\n @@logs\n end", "def show\n @b_log = BLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b_log }\n end\n end", "def show\n @deployment_log = DeploymentLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deployment_log }\n end\n end", "def index\n @user = current_user\n if ( params[:search] && (params[:search].size > 0) )\n @logs = search( Log, params[:search], [ \"msg\" ] )\n @paginate = false\n else\n @logs = Log.paginate( page: params[ :page ], per_page: 100, order: \"created_at desc\" )\n @paginate = true\n end\n end", "def show\n @unit = Unit.find(params[:id])\n @logs = @unit.logs.limit(15).order(:created_at)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end", "def show\n @steps_log = StepsLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @steps_log }\n end\n end", "def log( *files, **options )\n\t\toptions[:graph] = false\n\n\t\tentries = self.server.run_with_json_template( :log, *files, **options )\n\n\t\treturn entries.map {|entry| Hglib::Repo::LogEntry.new(entry) }\n\tend", "def index\n @rjlogs = Rjlog.all\n end", "def index\n #Does nothing really... (Except create log)\n\n render json: \"success\"\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", "def cron_logs(app_name)\n\t\tget(\"/apps/#{app_name}/cron_logs\")\n\tend", "def show\n @search_list = SearchList.find(params[:id])\n sendLog([{\n \"logType_id\"=> 3, \n \"details\"=>\"Viewed Recent Searches\"\n }])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @search_list }\n end\n end", "def index\n @action_logs = ActionLog.page(params.permit![:page])\n respond_to do |format|\n format.html {render 'index'}\n format.json {render json:@action_logs}\n end\n end", "def index\n myarray = Log.all\n @logs = Kaminari.paginate_array(myarray).page(params[:page])\n \n \n readlogs = ::ReadLogs.new\n @filesize = readlogs.size('development.log')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "def index\n @config_logs = ConfigLog.all\n end", "def show\n @foodlog = Foodlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @foodlog }\n end\n end", "def index\n @timelogs = Timelog.all\n end", "def new\n @dlog = Dlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dlog }\n end\n end", "def show\n @log_type = LogType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log_type }\n end\n end", "def index\n begin\n start_time, end_time = get_start_time_and_end_time(params)\n longitude, latitude = get_longitude_and_latitude(params)\n fields = get_fields(params)\n if longitude and latitude\n q = WeatherLog.nearby(100, longitude, latitude)\n else\n q = WeatherLog.all\n end\n if start_time and end_time\n q = q.where(datetime: start_time..end_time)\n elsif start_time\n q = q.where(\"datetime >= ?\", start_time)\n elsif end_time\n q = q.where(\"datetime <= ?\", end_time)\n end\n\n @weather_logs = q.order(datetime: :asc).limit(2000)\n\n respond_to do |format|\n if fields\n format.json { render json: @weather_logs.as_json(only: fields)}\n else\n format.json { render json: @weather_logs.as_json(only: get_all_valid_fields)}\n end\n end\n rescue Exception => e\n respond_to do |format|\n format.json { render json: {status: \"Invalid Request #{e}\"} }\n end\n end\n end", "def new\n @user_log = UserLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_log }\n end\n end", "def show\n @food_intake_log = FoodIntakeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_intake_log }\n end\n end", "def index\n @user = User.find(current_user.id)\n @history_logs = @user.history_logs\n end", "def show\n @contact_log = ContactLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_log }\n end\n end", "def find_log\n @logs = Log.find(params[:id])\n end", "def get_bre_event_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LogsApi.get_bre_event_logs ...\"\n end\n # resource path\n local_var_path = \"/bre/logs/event-log\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_start_date'] = opts[:'filter_start_date'] if !opts[:'filter_start_date'].nil?\n query_params[:'filter_event_name'] = opts[:'filter_event_name'] if !opts[:'filter_event_name'].nil?\n query_params[:'filter_event_id'] = opts[:'filter_event_id'] if !opts[:'filter_event_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 query_params[:'filter_rule_id'] = opts[:'filter_rule_id'] if !opts[:'filter_rule_id'].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 => 'PageResourceBreEventLog')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsApi#get_bre_event_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @log = Dmt::SiteLogger::Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log }\n end\n end", "def get_all_logs(date_range_start, date_range_end, search = '', log_level = '',\n logger_assembly = '', user_id = 0, message_group_id = 0,\n include_traces = nil, org_unit_id = 0, bookmark = '')\n path = \"/d2l/api/lp/#{$lp_ver}/logging/\"\n path += \"?dateRangeStart=#{date_range_start}\"\n path += \"&dateRangeEnd=#{date_range_end}\"\n path += \"&search=#{search}\" if search != ''\n path += \"&logLevel=#{log_level}\" if log_level != ''\n path += \"&loggerAssembly=#{logger_assembly}\" if logger_assembly != ''\n path += \"&userId=#{user_id}\" if user_id != 0\n path += \"&messageGroupId=#{message_group_id}\" if message_group_id != 0\n path += \"&includeTraces=#{include_traces}\" unless include_traces.nil?\n path += \"&orgUnitId=#{org_unit_id}\" if org_unit_id != 0\n path += \"&bookmark=#{bookmark}\" if bookmark != ''\n ap path\n _get(path)\n # returns paged result set of Message data blocks\nend", "def list_logs_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_logs ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.list_logs\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n if @api_client.config.client_side_validation && opts[:'direction'] && !['next', 'prev'].include?(opts[:'direction'])\n fail ArgumentError, 'invalid value for \"direction\", must be one of next, prev'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_logs, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_logs, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && opts[:'order'] && !['asc', 'desc'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of asc, desc'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/logs\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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 = ['GenieKey']\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 => 'ListAlertLogsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend" ]
[ "0.73838407", "0.7217653", "0.70543104", "0.6947491", "0.6945824", "0.6937659", "0.6903222", "0.68449336", "0.6843485", "0.6843485", "0.6810154", "0.67356384", "0.6704352", "0.6674407", "0.66210747", "0.6616622", "0.65853655", "0.6546039", "0.6533585", "0.6505296", "0.6480125", "0.6479392", "0.6456697", "0.64552045", "0.64332855", "0.64279515", "0.6418157", "0.6409996", "0.6403016", "0.63940126", "0.63930005", "0.6385449", "0.63788235", "0.6376682", "0.6373123", "0.6350738", "0.6318549", "0.6300101", "0.6279577", "0.6270901", "0.6270128", "0.6227453", "0.62241656", "0.622369", "0.6215941", "0.62133044", "0.6180938", "0.61778563", "0.61755913", "0.6175173", "0.61618423", "0.6147361", "0.6146809", "0.6145389", "0.6124269", "0.6114902", "0.61120033", "0.6109874", "0.6105731", "0.6101411", "0.60925", "0.60650426", "0.6061262", "0.60598516", "0.60477054", "0.6019532", "0.60172725", "0.6008402", "0.60026604", "0.59959096", "0.5980381", "0.59714365", "0.59649014", "0.5950177", "0.5948942", "0.59480315", "0.594605", "0.59381366", "0.593455", "0.592869", "0.5927182", "0.5920046", "0.59188944", "0.59164184", "0.5875036", "0.58672094", "0.5850092", "0.58435756", "0.5841942", "0.5836929", "0.58347875", "0.5832872", "0.58313894", "0.58259404", "0.58216006", "0.5821398", "0.5817028", "0.5816503", "0.5804838", "0.57956636", "0.5794442" ]
0.0
-1
GET /logs/1 GET /logs/1.json
def show is_admin? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log\n @client.get(\"#{path}/log\")\n end", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log }\n end\n end", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log }\n end\n end", "def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end", "def index\n @logs = @goal.logs.order('log_date DESC')\n @log = Log.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "def index\n @logs = Log\n .order(start_time: :desc)\n .limit(100)\n .offset(params[:offset])\n\n render json: @logs\n end", "def logs(app_name)\n\t\tget(\"/apps/#{app_name}/logs\")\n\tend", "def index\n @wr_logs = WrLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wr_logs }\n end\n end", "def show\n @log = @client.logs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log }\n end\n end", "def show\n render json: @log\n end", "def show\n @d_logger = DLogger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @d_logger }\n end\n end", "def show\n @log_entry = LogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @log_entry }\n end\n end", "def show\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n\n respond_to do |format|\n format.html { render :show, layout: false } # show.html.erb\n format.json { render json: @httping_log }\n end\n end", "def index\n @logs = Log.all\n end", "def show\n @web_service_log = WebServiceLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_service_log }\n end\n end", "def show\n @dlog = Dlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dlog }\n end\n end", "def index\n @server_monitor_logs = ServerMonitorLog.fetch_log(params) \n end", "def index\n @web_service_logs = WebServiceLog.limit(20).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @web_service_logs }\n end\n end", "def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end", "def show\n @user_log = UserLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_log }\n end\n end", "def logs\n ret = @uri.logs\n render plain: ret[:message], status: ret[:status]\n end", "def index\n @deployment_logs = DeploymentLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deployment_logs }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log_item }\n end\n end", "def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end", "def index\n @d_loggers = DLogger.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @d_loggers }\n end\n end", "def index\n @log_items = @goal.log_items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @log_items }\n end\n end", "def show\n @logstash = Logstash.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logstash }\n end\n end", "def show\n @event_log_entry = EventLogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_log_entry }\n end\n end", "def show\n @exercise_log = ExerciseLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_log }\n end\n end", "def index\n @interaction_logs = InteractionLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interaction_logs }\n end\n end", "def show\n respond_to do |f| \n f.json {\n render :json => { \n :activity_log => @activity_log,\n :snapshots => @activity_log.snapshots.order(\"id ASC\")\n }\n }\n end\n end", "def list_logs_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs ...'\n end\n # resource path\n local_var_path = '/api/v2/logs/events/search'\n\n # query parameters\n query_params = opts[:query_params] || {}\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'])\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 = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'LogsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_logs,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsAPI#list_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @deployment_log = DeploymentLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deployment_log }\n end\n end", "def recent_foods\n get(\"/user/#{@user_id}/foods/log/recent.json\")\n end", "def food_logs(user_id: '-', date: Date.today)\n return get(\"#{API_URI}/#{FOOD_API_VERSION}/user/#{user_id}/foods/log/date/#{date}.json\")\n end", "def show\n @deployment = Deployment.find(params[:id])\n @log = Rails.cache.read(\"log_#{@deployment.id}\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deployment }\n end\n end", "def new\n @log = Log.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @log }\n end\n end", "def index\n @user_logs = UserLog.paginate(:page => params[:page], :per_page => 30).order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_logs }\n end\n end", "def show\n @heat_log = HeatLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_log }\n end\n end", "def show\n @message_log = MessageLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_log }\n end\n end", "def show\n @b_log = BLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b_log }\n end\n end", "def show\n @log_type = LogType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log_type }\n end\n end", "def read_logs_all()\n logs = Log.find(:all, :order => 'created_at asc')\n end", "def index\n @log_types = LogType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @log_types }\n end\n end", "def index\n\t\t\t@logs = AppTracker::Log.order('created_at DESC').paginate(:page => params[:page], :per_page => 50)\n\t\tend", "def show\n @applicationlog = Applicationlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicationlog }\n end\n end", "def find_log\n @logs = Log.find(params[:id])\n end", "def show\n @steps_log = StepsLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @steps_log }\n end\n end", "def show\n @unit = Unit.find(params[:id])\n @logs = @unit.logs.limit(15).order(:created_at)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end", "def index\n @daily_logs = current_user.daily_logs.order(\"updated_at DESC\")\n render json: @daily_logs, each_serializer: Rest::DailyLogSerializer\n end", "def index\n @ncr_api_logs = NcrApiLog.all\n end", "def show\n @environment = Environment.find(params[:id])\n @last_deployment_log = @environment.deployment_logs.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @environment }\n end\n end", "def logs_get(opts = {})\n data, _status_code, _headers = logs_get_with_http_info(opts)\n data\n end", "def log(log_id)\n raise Auth0::MissingParameter, 'Must supply a valid log_id' if log_id.to_s.empty?\n path = \"#{logs_path}/#{log_id}\"\n get(path)\n end", "def show\n @interaction_log = InteractionLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interaction_log }\n end\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", "def show\n @log = Dmt::SiteLogger::Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log }\n end\n end", "def index\n @entry_logs = EntryLog.all\n end", "def log\n count = default_log_lines(params)\n lines = get_file_lines(log: true, tail: count)\n respond_with(lines)\n end", "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "def logs\n\n end", "def index\n @user = current_user;\n @toeic_logs = ToeicLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @toeic_logs }\n end\n end", "def show\n @user = User.find(params[:user_id])\n @log = @user.logs.find(log_params[:id])\n end", "def list\n websites = @logs.records\n @view.show(websites)\n end", "def show\n @food_intake_log = FoodIntakeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_intake_log }\n end\n end", "def read_logs_all()\n #logs = Log.find(:all, :order => 'created_at asc')\n logs = Log.all.order('created_at asc')\n end", "def index\n #Does nothing really... (Except create log)\n\n render json: \"success\"\n end", "def logs(options = {})\n request_params = {\n q: options.fetch(:q, nil),\n page: options.fetch(:page, nil),\n per_page: options.fetch(:per_page, nil),\n sort: options.fetch(:sort, nil),\n fields: options.fetch(:fields, nil),\n include_fields: options.fetch(:include_fields, nil),\n include_totals: options.fetch(:include_totals, nil),\n from: options.fetch(:from, nil),\n take: options.fetch(:take, nil)\n }\n if request_params[:take].to_i > 100\n raise Auth0::InvalidParameter, 'The total amount of entries to retrieve should be less than 100'\n end\n if request_params[:per_page].to_i > 100\n raise Auth0::InvalidParameter, 'The total amount of entries per page should be less than 100'\n end\n get(logs_path, request_params)\n end", "def logs(app_name)\n deprecate # 07/31/2012\n get(\"/apps/#{app_name}/logs\").to_s\n end", "def show\n @log = Log.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log }\n end\n end", "def index\n @action_logs = ActionLog.page(params.permit![:page])\n respond_to do |format|\n format.html {render 'index'}\n format.json {render json:@action_logs}\n end\n end", "def log_contents\n if API_KEYS[\"logentries\"]\n account_key = API_KEYS[\"logentries\"][Rails.env][\"account_key\"]\n log_set = API_KEYS[\"logentries\"][Rails.env][\"log_set\"]\n log_name = \"nsc\"\n url = \"https://pull.logentries.com/#{account_key}/hosts/#{log_set}/#{log_name}/?filter=#{log_prefix}\"\n Rails.logger.debug { \"Fetching log from #{url}\" }\n open(url).read\n else\n File.read(log_path)\n end\n end", "def logs\n end", "def list(options={})\n Mailgun.submit(:get, log_url, options)\n end", "def show\n @foodlog = Foodlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @foodlog }\n end\n end", "def get_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsApi.get_logs ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling LogsApi.get_logs, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling LogsApi.get_logs, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/logs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\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] || 'LogsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"LogsApi.get_logs\",\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: LogsApi#get_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get(uuid)\n new(@@data_store.get(:logs, uuid))\n end", "def index\n myarray = Log.all\n @logs = Kaminari.paginate_array(myarray).page(params[:page])\n \n \n readlogs = ::ReadLogs.new\n @filesize = readlogs.size('development.log')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "def index\n fetch_activity_logs\n\n respond_to do |format|\n format.html\n format.js\n format.json do\n query = params[:query]\n if query\n actions = ActivityLog.all_actions(query)\n render json: actions\n else\n render json: @activity_logs\n end\n end\n end\n end", "def show\n @log_entry = LogEntry.find(params[:id])\n end", "def show\n @logtransfer = Logtransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logtransfer }\n end\n end", "def index\n @data_logs = DataLog.all\n end", "def get_user_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LogsApi.get_user_logs ...\"\n end\n # resource path\n local_var_path = \"/audit/logs\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_user'] = opts[:'filter_user'] if !opts[:'filter_user'].nil?\n query_params[:'filter_action_name'] = opts[:'filter_action_name'] if !opts[:'filter_action_name'].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 => 'PageResourceUserActionLog')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsApi#get_user_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @search_list = SearchList.find(params[:id])\n sendLog([{\n \"logType_id\"=> 3, \n \"details\"=>\"Viewed Recent Searches\"\n }])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @search_list }\n end\n end", "def new\n @logstash = Logstash.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @logstash }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def show\n @turn_log = TurnLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turn_log }\n end\n end", "def load_log(log_id)\n service.get log_path(log_id)\n end", "def logs_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.logs_get ...'\n end\n # resource path\n local_var_path = '/logs'\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'min_date'] = opts[:'min_date'] if !opts[:'min_date'].nil?\n query_params[:'max_date'] = opts[:'max_date'] if !opts[:'max_date'].nil?\n query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?\n query_params[:'period'] = opts[:'period'] if !opts[:'period'].nil?\n query_params[:'id_user'] = opts[:'id_user'] if !opts[:'id_user'].nil?\n query_params[:'id_connection'] = opts[:'id_connection'] if !opts[:'id_connection'].nil?\n query_params[:'id_connector'] = opts[:'id_connector'] if !opts[:'id_connector'].nil?\n query_params[:'charged'] = opts[:'charged'] if !opts[:'charged'].nil?\n query_params[:'id_source'] = opts[:'id_source'] if !opts[:'id_source'].nil?\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#logs_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log }\n end\n end", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log }\n end\n end", "def show\n @order_log = OrderLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_log }\n end\n end", "def cron_logs(app_name)\n\t\tget(\"/apps/#{app_name}/cron_logs\")\n\tend", "def index\n# @time_logs = TimeLog.all\n @time_logs = TimeLog.paginate :page => params[:page], :per_page => 10, :order => 'site_id'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_logs }\n end\n end", "def index\n @config_logs = ConfigLog.all\n end", "def show\n @logjuego = Logjuego.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logjuego }\n end\n end", "def new\n @wr_log = WrLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wr_log }\n end\n end", "def logs\n cloud = Cloud.instance\n cloud.auth_for_accounts [id]\n cloud.get(['cloud-service-logging', 'accounts', id, 'logs', 'paginated?lang=DE']).body.logs\n end", "def show\n @trade_log = TradeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @trade_log }\n end\n end", "def show\n @weight_log = WeightLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weight_log }\n end\n end", "def index\n @rjlogs = Rjlog.all\n end" ]
[ "0.70589846", "0.68281573", "0.68281573", "0.676178", "0.665446", "0.6634931", "0.6577052", "0.655347", "0.6544362", "0.6542115", "0.6509032", "0.64878905", "0.6466216", "0.6396822", "0.63887364", "0.63504505", "0.63151747", "0.62759453", "0.6271731", "0.62654126", "0.6260569", "0.62595385", "0.62462467", "0.62295675", "0.62251115", "0.6217722", "0.62150127", "0.6201912", "0.619187", "0.6172979", "0.6165405", "0.61283815", "0.6116122", "0.61080045", "0.6089265", "0.60670775", "0.6061927", "0.6061705", "0.6052102", "0.60338783", "0.60305107", "0.6015601", "0.601347", "0.60006416", "0.59980315", "0.599693", "0.5996285", "0.59771335", "0.5976924", "0.5954699", "0.59544", "0.5953621", "0.5946106", "0.5939197", "0.5927415", "0.5920631", "0.5912205", "0.5886622", "0.5878197", "0.5859734", "0.585952", "0.58571124", "0.5848175", "0.58210415", "0.5813285", "0.58007544", "0.579442", "0.57935065", "0.5792315", "0.5785709", "0.57818747", "0.57782596", "0.5776418", "0.5773444", "0.57707846", "0.57645696", "0.57557285", "0.5753148", "0.5750116", "0.5749542", "0.5747163", "0.5744394", "0.5735646", "0.57341796", "0.57301325", "0.57201564", "0.5715951", "0.5697904", "0.56751525", "0.56751454", "0.56751454", "0.56643045", "0.566303", "0.5659741", "0.565784", "0.5656975", "0.56562847", "0.5654619", "0.56541854", "0.5653781", "0.5653538" ]
0.0
-1
POST /logs POST /logs.json
def create @log = Log.new(log_params) respond_to do |format| if @log.save format.html { redirect_to @log, notice: 'Log was successfully created.' } format.json { render :show, status: :created, location: @log } else format.html { render :new } format.json { render json: @log.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "def create\n # If the request body contains a single log (request body is not an array)\n if ( !JSON.parse(request.body.read).is_a?(Array) )\n log_data = JSON.parse(request.body.read)\n status, log = create_new_log(log_data)\n if (status)\n render json: log, status: :created\n else\n render json: log.errors, status: :unprocessable_entity\n end\n # If the request body contains multiple logs (request body is an array)\n else\n logs = []\n # Loop through all logs. Each array element is considered a single log\n JSON.parse(request.body.read).each do |log_data|\n status, log = create_new_log(log_data)\n if (!status)\n render render json: log.errors, status: :unprocessable_entity\n else\n logs.push(log)\n end\n end\n render json: logs, status: :created\n end\n \tend", "def create\n @log = Log.new(log_params)\n\n if @log.save\n render json: @log, status: :created, location: @log\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def create\n params[:logs].each { |message| Passbook::Log.create(message: message) }\n head :ok\n end", "def create\n case raw_json\n when Array then handle_many_logs\n when Hash then handle_single_log\n else; sorry \"Post a JSON array or object.\", 422\n end\n end", "def create\n @log = Log.new(params[:log])\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render json: @log, status: :created, location: @log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log_entry = LogEntry.new(params[:log_entry])\n\n respond_to do |format|\n if @log_entry.save\n format.html { redirect_to log_entries_path, :notice => 'Log entry was successfully created.' }\n format.json { render :json => @log_entry, :status => :created, :location => @log_entry }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @log_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(params[:log])\n @log.goal = @goal\n @logs = @goal.logs\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to :back, notice: 'Log was successfully created.' }\n format.json { render json: @log, status: :created, location: @log }\n else\n format.html { render action: 'index' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entry_log = EntryLog.new(entry_log_params)\n\n respond_to do |format|\n if @entry_log.save\n format.html { redirect_to @entry_log, notice: 'Entry log was successfully created.' }\n format.json { render :show, status: :created, location: @entry_log }\n else\n format.html { render :new }\n format.json { render json: @entry_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_log = DataLog.new(data_log_params)\n\n respond_to do |format|\n if @data_log.save\n format.html { redirect_to @data_log, notice: 'Data log was successfully created.' }\n format.json { render :show, status: :created, location: @data_log }\n else\n format.html { render :new }\n format.json { render json: @data_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @log }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_cdn_logs\n authorize! :manage, CdnLog\n @log_data = JSON.load(params[:logdata])\n CdnLog.create(@log_data)\n respond_to do |format|\n format.json{ head :ok }\n end\n end", "def create\n @log = @task.logs.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @log }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_log = TimeLog.new(params[:time_log])\n \n puts \"Creating a new time_log\"\n\n respond_to do |format|\n if @time_log.save\n format.html { redirect_to @time_log, notice: 'Time log was successfully created.' }\n format.json { render json: @time_log, status: :created, location: @time_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find(params[:user_id])\n # @log = @user.logs.create!(log_params)\n @log = @user.logs.create!\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to user_logs_url, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wr_log = WrLog.new(params[:wr_log])\n\n respond_to do |format|\n if @wr_log.save\n format.html { redirect_to @wr_log, notice: 'Wr log was successfully created.' }\n format.json { render json: @wr_log, status: :created, location: @wr_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wr_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @logs = @goal.logs.order('log_date DESC')\n @log = Log.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "def create\n @input_log = InputLog.new(input_log_params)\n\n respond_to do |format|\n if @input_log.save\n format.html { redirect_to @input_log, notice: 'Input log was successfully created.' }\n format.json { render :show, status: :created, location: @input_log }\n else\n format.html { render :new }\n format.json { render json: @input_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_log = UserLog.new(params[:user_log])\n\n respond_to do |format|\n if @user_log.save\n format.html { redirect_to @user_log, notice: 'User log was successfully created.' }\n format.json { render json: @user_log, status: :created, location: @user_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dlog = Dlog.new(params[:dlog])\n\n respond_to do |format|\n if @dlog.save\n format.html { redirect_to @dlog, notice: 'Dlog was successfully created.' }\n format.json { render json: @dlog, status: :created, location: @dlog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timelog = Timelog.new(timelog_params)\n\n respond_to do |format|\n if @timelog.save\n format.html { redirect_to @timelog, notice: 'Timelog was successfully created.' }\n format.json { render :show, status: :created, location: @timelog }\n else\n format.html { render :new }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to admin_log_path(@log), notice: 'Log was successfully created.' }\n# format.json { render action: 'show', status: :created, location: @log }\n format.json {render :json => { :success => :created}}\n else\n format.html { render action: 'new' }\n# format.json { render json: @log.errors, status: :unprocessable_entity }\n format.json { render :json => {:errors => @log.errors, :success => :failed}, status: :unprocessable_entity }\n end\n end\n end", "def log(data)\n t = Thread.new do\n uri = URI(\"http://logs-01.loggly.com/inputs/.../tag/ost/\")\n req = Net::HTTP::Post.new(uri)\n req['content-type'] = \"content-type:application/x-www-form-urlencoded\"\n req.body = data.to_json\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n end\nend", "def create\n @exercise_log = ExerciseLog.new(params[:exercise_log])\n\n respond_to do |format|\n if @exercise_log.save\n format.html { redirect_to @exercise_log, notice: 'Exercise log was successfully created.' }\n format.json { render json: @exercise_log, status: :created, location: @exercise_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @web_service_log = WebServiceLog.new(params[:web_service_log])\n\n respond_to do |format|\n if @web_service_log.save\n format.html { redirect_to @web_service_log, notice: 'Web service log was successfully created.' }\n format.json { render json: @web_service_log, status: :created, location: @web_service_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @web_service_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @steps_log = StepsLog.new(params[:steps_log])\n\n respond_to do |format|\n if @steps_log.save\n format.html { redirect_to @steps_log, notice: 'Steps log was successfully created.' }\n format.json { render json: @steps_log, status: :created, location: @steps_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @steps_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def logs\n\n end", "def create\n @audit_log = AuditLog.new(audit_log_params)\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully created.' }\n format.json { render :show, status: :created, location: @audit_log }\n else\n format.html { render :new }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_log_entry = EventLogEntry.new(params[:event_log_entry])\n\n respond_to do |format|\n if @event_log_entry.save\n format.html { redirect_to @event_log_entry, notice: 'Event log entry was successfully created.' }\n format.json { render json: @event_log_entry, status: :created, location: @event_log_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_log_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rjlog = Rjlog.new(rjlog_params)\n\n respond_to do |format|\n if @rjlog.save\n format.html { redirect_to @rjlog, notice: 'Rjlog was successfully created.' }\n format.json { render :show, status: :created, location: @rjlog }\n else\n format.html { render :new }\n format.json { render json: @rjlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @d_logger = DLogger.new(params[:d_logger])\n\n respond_to do |format|\n if @d_logger.save\n format.html { redirect_to @d_logger, notice: 'D logger was successfully created.' }\n format.json { render json: @d_logger, status: :created, location: @d_logger }\n else\n format.html { render action: \"new\" }\n format.json { render json: @d_logger.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @foodlog = Foodlog.new(params[:foodlog])\n\n respond_to do |format|\n if @foodlog.save\n format.html { redirect_to @foodlog, :notice => 'Foodlog was successfully created.' }\n format.json { render :json => @foodlog, :status => :created, :location => @foodlog }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @foodlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n #Does nothing really... (Except create log)\n\n render json: \"success\"\n end", "def create\n @server_monitor_log = ServerMonitorLog.new(server_monitor_log_params)\n\n respond_to do |format|\n if @server_monitor_log.save\n format.html { redirect_to @server_monitor_log, notice: 'Server monitor log was successfully created.' }\n format.json { render :show, status: :created, location: @server_monitor_log }\n else\n format.html { render :new }\n format.json { render json: @server_monitor_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @log = Log.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @log }\n end\n end", "def request_bulk(logs, token, dimensions, application_type)\n # NOTE: X-ApplicationType is not supported for V3 API.\n post_headers = {\n x_auth_token: token,\n content_type: 'application/json'\n }\n\n data = {\n \"dimensions\" => dimensions,\n \"logs\" => logs.map {|message, log_dimensions|\n {\n \"message\" => message,\n # Currently monasca errors if per-message dimensions are omitted.\n \"dimensions\" => log_dimensions,\n }\n }\n }.to_json\n\n @rest_client['logs'].post(data, post_headers)\n end", "def create\n @weather_log = WeatherLog.new(weather_log_params)\n\n respond_to do |format|\n if @weather_log.save\n format.html { redirect_to @weather_log, notice: 'Weather log was successfully created.' }\n format.json { render :show, status: :created, location: @weather_log }\n else\n format.html { render :new }\n format.json { render json: @weather_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_applogs(options={})\n self.class.post(\"#{applogs_endpoint}/applogs.json?apikey=#{apikey}\", :body => MultiJson.encode({applog: options}))\n end", "def create\n @search_log = SearchLog.new(search_log_params)\n\n respond_to do |format|\n if @search_log.save\n format.html { redirect_to @search_log, notice: \"Search log was successfully created.\" }\n format.json { render :show, status: :created, location: @search_log }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @search_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vlog = Vlog.new(vlog_params)\n\n respond_to do |format|\n if @vlog.save\n format.html { redirect_to @vlog, notice: 'Vlog was successfully created.' }\n format.json { render :show, status: :created, location: @vlog }\n else\n format.html { render :new }\n format.json { render json: @vlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def webhook\n header = \"<h4>#{params[:verb]} #{params[:url]}</h4><p>Server: <b>#{params[:mode]}</b></p>\"\n query = if params[:params] then \"<p>Params: <pre>#{params[:params]}</pre></p>\" else \"\" end\n session = if params[:session] then \"<p>Session Attribute: <pre>#{params[:session]}</pre></p>\" else \"\" end\n exception = \"<p>Exception: <pre>#{params[:exception]}</pre></p>\"\n content = header + query + session + exception\n @project_logs = ProjectLog.create(project: @project, category: 'ERROR', content: content, date: Date.today)\n render nothing: true\n end", "def create\n @message_log = MessageLog.new(params[:message_log])\n\n respond_to do |format|\n if @message_log.save\n format.html { redirect_to @message_log, notice: 'Message log was successfully created.' }\n format.json { render json: @message_log, status: :created, location: @message_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @heat_log = HeatLog.new(params[:heat_log])\n\n respond_to do |format|\n if @heat_log.save\n format.html { redirect_to @heat_log, notice: 'Heat log was successfully created.' }\n format.json { render json: @heat_log, status: :created, location: @heat_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @heat_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ncr_api_log = NcrApiLog.new(ncr_api_log_params)\n # authorize(@ncr_api_log)\n respond_to do |format|\n if @ncr_api_log.save\n format.html { redirect_to @ncr_api_log, notice: 'Ncr api log was successfully created.' }\n format.json { render :show, status: :created, location: @ncr_api_log }\n else\n format.html { render :new }\n format.json { render json: @ncr_api_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity_log = ActivityLog.new(create_params)\n\n respond_to do |format|\n if @activity_log.save\n format.html { redirect_to @activity_log, notice: 'Activity log was successfully created.' }\n format.json { render :show, status: :created, location: @activity_log }\n else\n format.html { render :new }\n format.json { render json: @activity_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def logs\n end", "def create\n @temperature_log = TemperatureLog.new(temperature_log_params)\n\n respond_to do |format|\n if @temperature_log.save\n format.html { redirect_to @temperature_log, notice: 'Temperature log was successfully created.' }\n format.json { render :show, status: :created, location: @temperature_log }\n else\n format.html { render :new }\n format.json { render json: @temperature_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hour_log = HourLog.new(hour_log_params)\n if @hour_log.save\n render json: @hour_log, status: 201\n else\n render json: { error: \"Please make sure to fill all required fields.\" }, status: 400\n end\n end", "def create\n @ai_log = AiLog.new(ai_log_params)\n\n respond_to do |format|\n if @ai_log.save\n format.html { redirect_to @ai_log, notice: 'Ai log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ai_log }\n else\n format.html { render action: 'new' }\n format.json { render json: @ai_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def log\n parametros = {}\n parametros['action'] = params['action']\n parametros['controller'] = params['controller']\n parametros['fecha'] = Time.zone.now\n parametros['token'] = false\n puts parametros\n log = Log.create(parametros)\n\n # parametros['usuario'] = revisar_token()\n parametros['token'] = true\n log.update(parametros)\n end", "def create\n @message_log = MessageLog.new(message_log_params)\n\n respond_to do |format|\n if @message_log.save\n format.html { redirect_to @message_log, notice: 'Message log was successfully created.' }\n format.json { render :show, status: :created, location: @message_log }\n else\n format.html { render :new }\n format.json { render json: @message_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @outgoing_message_log = OutgoingMessageLog.new(params[:outgoing_message_log])\n\n respond_to do |format|\n if @outgoing_message_log.save\n format.html { redirect_to @outgoing_message_log, notice: 'Outgoing message log was successfully created.' }\n format.json { render json: @outgoing_message_log, status: :created, location: @outgoing_message_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @outgoing_message_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @action_log = ActionLog.new(action_log_params)\n\n respond_to do |format|\n if @action_log.save\n format.html { redirect_to @action_log, notice: 'Action log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @action_log }\n else\n format.html { render action: 'new' }\n format.json { render json: @action_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sample_storage_log = SampleStorageLog.new(sample_storage_log_params)\n\n respond_to do |format|\n if @sample_storage_log.save\n format.html { redirect_to @sample_storage_log, notice: 'Sample storage log was successfully created.' }\n format.json { render :show, status: :created, location: @sample_storage_log }\n else\n format.html { render :new }\n format.json { render json: @sample_storage_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timelog = Timelog.new(timelog_params)\n @timelog.user_id = current_user.id unless @timelog.user_id\n\n respond_to do |format|\n if @timelog.save\n format.html { redirect_to timelogs_url, notice: 'Timelog was successfully created.' }\n format.json { render :show, status: :created, location: @timelog }\n else\n format.html { render :new }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ventilation_log = VentilationLog.new(ventilation_log_params)\n\n respond_to do |format|\n if @ventilation_log.save\n format.html { redirect_to @ventilation_log, notice: 'Ventilation log was successfully created.' }\n format.json { render :show, status: :created, location: @ventilation_log }\n else\n format.html { render :new }\n format.json { render json: @ventilation_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @signout_log = SignoutLog.new(params[:signout_log])\n\n respond_to do |format|\n if @signout_log.save\n format.html { redirect_to @signout_log, :notice => 'Signout log was successfully created.' }\n format.json { render :json => @signout_log, :status => :created, :location => @signout_log }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @signout_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @like_log = LikeLog.new(like_log_params)\n\n respond_to do |format|\n if @like_log.save\n format.html { redirect_to @like_log, notice: \"Like log was successfully created.\" }\n format.json { render :show, status: :created, location: @like_log }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @like_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = current_user.create_log params[:log]\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to(@log, :notice => 'Log was successfully created.') }\n format.xml { render :xml => @log, :status => :created, :location => @log }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @change_log = ChangeLog.new(change_log_params)\n\n respond_to do |format|\n if @change_log.save\n format.html { redirect_to @change_log, notice: 'Change log was successfully created.' }\n format.json { render :show, status: :created, location: @change_log }\n else\n format.html { render :new }\n format.json { render json: @change_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |f|\n \n # formats decimal digits on level\n @level = params[:level].to_f.to_s[0..5]\n \n # the activities are clustered in a string, stored in a single row of the db, unless they are far apart,\n # in which case a new row is created\n # the interval is determined by INTERVAL_BETWEEN_ACTIVITY_CHUNKS\n # see config/application.rb\n if !@last_log or Time.now - @last_log.updated_at > OmniEye::INTERVAL_BETWEEN_ACTIVITY_CHUNKS\n @activity_log = @camera.activity_logs.build( :level => @level, :datetime => params[:datetime] )\n else\n @activity_log = @last_log\n @activity_log.level = @activity_log.level + ' ' + @level\n end\n\n # uploads snapshot if the interval since the last upload is greater than INTERVAL_BETWEEN_SNAPSHOTS\n # see config/application.rb\n @last_snapshot = @activity_log.snapshots.last\n if (!@last_snapshot or Time.now - @last_snapshot.created_at > OmniEye::INTERVAL_BETWEEN_SNAPSHOTS) \n @activity_log.snapshots.build( :img_data => params[:image] ) \n end\n \n if @activity_log.save\n f.json { \n render :json => { :success => true } \n }\n else\n f.json { \n render :json => { :success => false, :errors => @activity_log.errors.as_json }\n }\n end\n end\n end", "def create\n @interaction_log = InteractionLog.new(params[:interaction_log])\n\n respond_to do |format|\n if @interaction_log.save\n format.html { redirect_to @interaction_log, notice: 'Interaction log was successfully created.' }\n format.json { render json: @interaction_log, status: :created, location: @interaction_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interaction_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @wr_log = WrLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wr_log }\n end\n end", "def create\n @daily_task_log = DailyTaskLog.new(daily_task_log_params)\n\n respond_to do |format|\n if @daily_task_log.save\n format.html { redirect_to @daily_task_log, notice: 'Daily task log was successfully created.' }\n format.json { render :show, status: :created, location: @daily_task_log }\n else\n format.html { render :new }\n format.json { render json: @daily_task_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_log = WorkLog.new(params[:work_log])\n\n respond_to do |format|\n if @work_log.save\n format.html { redirect_to @work_log, notice: 'Work log was successfully created.' }\n format.json { render json: @work_log, status: :created, location: @work_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @web_service_log = WebServiceLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @web_service_log }\n end\n end", "def create\n @ethernet_log = EthernetLog.new(ethernet_log_params)\n\n respond_to do |format|\n if @ethernet_log.save\n format.html { redirect_to @ethernet_log, notice: 'Ethernet log was successfully created.' }\n format.json { render :show, status: :created, location: @ethernet_log }\n else\n format.html { render :new }\n format.json { render json: @ethernet_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def log(service, level, summary, details: nil, host: nil, payload: {}, valid_for_secs: nil)\n service ||= @service\n if not service\n raise 'log: service must be passed, or set previously with set_service'\n end\n host ||= get_hostname\n post_body = {\n 'service' => service,\n 'datetime' => get_datetime(),\n 'host' => host,\n 'level' => level,\n 'summary' => summary,\n 'details' => details,\n 'payload' => payload,\n 'valid_for_secs' => valid_for_secs\n }\n \n url = \"https://#{@server_hostname}/api/log\"\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n vlog(0, \"url is #{url} host #{uri.host} port #{uri.port}\")\n http.use_ssl = true\n http.read_timeout = 20\n\n request = Net::HTTP::Post.new(url)\n request.content_type = \"application/json\" \n request.body = post_body.to_json\n\n vlog(0, \"request.body #{request.body}\")\n\n begin\n response = http.request(request)\n\n if response.code != '200'\n $stderr.puts \"POST to #{url} failed with status code #{response.code} and response #{response.body}\"\n return\n end\n rescue StandardError => error\n $stderr.puts \"POST to #{url} failed: #{error}\"\n end\n end", "def create\n @applicationlog = Applicationlog.new(params[:applicationlog])\n\n respond_to do |format|\n if @applicationlog.save\n format.html { redirect_to @applicationlog, notice: 'Applicationlog was successfully created.' }\n format.json { render json: @applicationlog, status: :created, location: @applicationlog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @applicationlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order_log = OrderLog.new(params[:order_log])\n\n respond_to do |format|\n if @order_log.save\n format.html { redirect_to @order_log, notice: 'Order log was successfully created.' }\n format.json { render json: @order_log, status: :created, location: @order_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @dlog = Dlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dlog }\n end\n end", "def create\n @update_log = UpdateLog.new(params[:update_log])\n\n respond_to do |format|\n if @update_log.save\n flash[:notice] = 'UpdateLog was successfully created.'\n format.html { redirect_to(update_logs_path) }\n format.xml { render :xml => @update_log, :status => :created, :location => @update_log }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @update_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\tif user_signed_in?\n\t\t@eventlog = Eventlog.new(params[:eventlog])\n\t\[email protected] = @eventlog.event.title\n\t\[email protected] = @eventlog.visitor.fname\n\t\[email protected] = \"not approved\"\n\t\trespond_to do |format|\n\t\t if @eventlog.save\n\t\t\tformat.html { redirect_to @eventlog, notice: 'Eventlog was successfully created.' }\n\t\t\tformat.json { render json: @eventlog, status: :created, location: @eventlog }\n\t\t else\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @eventlog.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tflash[:notice] = \"You don't have access to do that\"\n\t\tredirect_to :controller=>'eventlogs', :action => 'index'\n\tend\n end", "def create\n @tmpr_log = Temp.new(tmpr_log_params)\n\n respond_to do |format|\n if @tmpr_log.save\n format.html { redirect_to @tmpr_log, notice: 'Tmpr log was successfully created.' }\n format.json { render :show, status: :created, location: @tmpr_log }\n else\n format.html { render :new }\n format.json { render json: @tmpr_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @actlog = Actlog.new(actlog_params)\n\n respond_to do |format|\n if @actlog.save\n format.html { redirect_to @actlog, notice: 'Actlog was successfully created.' }\n format.json { render :show, status: :created, location: @actlog }\n else\n format.html { render :new }\n format.json { render json: @actlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log_type = LogType.new(params[:log_type])\n\n respond_to do |format|\n if @log_type.save\n format.html { redirect_to @log_type, notice: 'Log type was successfully created.' }\n format.json { render json: @log_type, status: :created, location: @log_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @log_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @audit_trail = AuditTrail.new(audit_trail_params)\n\n respond_to do |format|\n if @audit_trail.save\n format.html { redirect_to @audit_trail, notice: \"Audit trail was successfully created.\" }\n format.json { render :show, status: :created, location: @audit_trail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @audit_trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @topic_log = TopicLog.new(topic_log_params)\n\n respond_to do |format|\n if @topic_log.save\n format.html { redirect_to @topic_log, notice: 'Topic log was successfully created.' }\n format.json { render :show, status: :created, location: @topic_log }\n else\n format.html { render :new }\n format.json { render json: @topic_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @logstash = Logstash.new(params[:logstash])\n\n respond_to do |format|\n if @logstash.save\n format.html { redirect_to @logstash, notice: 'Logstash was successfully created.' }\n format.json { render json: @logstash, status: :created, location: @logstash }\n else\n format.html { render action: \"new\" }\n format.json { render json: @logstash.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @event_log_entry = EventLogEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event_log_entry }\n end\n end", "def add_user_log_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LogsApi.add_user_log ...\"\n end\n # resource path\n local_var_path = \"/audit/logs\"\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[:'log_entry'])\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsApi#add_user_log\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @driver_log = DriverLog.new(driver_log_params)\n\n respond_to do |format|\n if @driver_log.save\n format.html { redirect_to @driver_log, notice: 'Driver log was successfully created.' }\n format.json { render :show, status: :created, location: @driver_log }\n else\n format.html { render :new }\n format.json { render json: @driver_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_create\n response = self.class.post(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end", "def create\n @search_log = SearchLog.new(params[:search_log])\n\n respond_to do |format|\n if @search_log.save\n format.html { redirect_to(@search_log, :notice => 'Search log was successfully created.') }\n format.xml { render :xml => @search_log, :status => :created, :location => @search_log }\n format.json { render :json => 'ok' }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @search_log.errors, :status => :unprocessable_entity }\n format.json { render :json => 'fail' }\n end\n end\n end", "def create\n @log = Log.new(log_params)\n @log.user_id = current_user.id\n @log.place_id = params[:post][:place_id]\n\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to logs_path, notice: 'Shift was successfully created.' }\n format.json { render :index, status: :created, location: @log }\n # UserMailer.log_email(@log, '1', current_user).deliver\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def log\n @client.get(\"#{path}/log\")\n end", "def create\n @devlog = Devlog.new(devlog_params)\n\n respond_to do |format|\n if @devlog.save\n format.html { redirect_to [:admin, @devlog], notice: 'Devlog was successfully created.' }\n format.json { render :show, status: :created, location: @devlog }\n else\n format.html { render :new }\n format.json { render json: @devlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log_hour = LogHour.new(log_hour_params)\n\n respond_to do |format|\n if @log_hour.save\n format.html { redirect_to root_path, notice: 'Successfully logged your hours.' }\n format.json { render :show, status: :created, location: @log_hour }\n else\n format.html { render :new }\n format.json { render json: @log_hour.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @wr_logs = WrLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wr_logs }\n end\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def new\n @time_log = TimeLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_log }\n end\n end", "def create\n @steplog = Steplog.new(steplog_params)\n\n respond_to do |format|\n if @steplog.save\n format.html { redirect_to @steplog, notice: 'Steplog was successfully created.' }\n format.json { render :show, status: :created, location: @steplog }\n else\n format.html { render :new }\n format.json { render json: @steplog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log_entry = LogEntry.new(log_entry_params)\n\n if @log_entry.save\n redirect_to @log_entry\n else\n render 'new'\n end\n end", "def log_request\n ServerRequestLog.create! default_log_hash\n end", "def list_logs_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs ...'\n end\n # resource path\n local_var_path = '/api/v2/logs/events/search'\n\n # query parameters\n query_params = opts[:query_params] || {}\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'])\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 = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'LogsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_logs,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsAPI#list_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def jsonlogger(status,certname,jsonuuid)\n tempHash = {\n \"status\" => status,\n \"certname\" => certname,\n \"uuid\" => jsonuuid\n }\n File.open(logfile,\"a\") do |f|\n f.puts(tempHash.to_json)\n end\nend", "def new\n @logstash = Logstash.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @logstash }\n end\n end", "def new\n @user_log = UserLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_log }\n end\n end" ]
[ "0.750983", "0.73959804", "0.7082373", "0.70688707", "0.6887694", "0.6584805", "0.6558032", "0.65430963", "0.648967", "0.64812374", "0.64736736", "0.6473286", "0.64448255", "0.64101034", "0.63376373", "0.63022965", "0.62919223", "0.6282118", "0.6264109", "0.62557644", "0.625113", "0.6234063", "0.62215674", "0.61442405", "0.6135843", "0.6128577", "0.61245924", "0.6112014", "0.6087669", "0.6071813", "0.6064773", "0.60630655", "0.6054993", "0.60366493", "0.60221666", "0.60172796", "0.60128903", "0.59969324", "0.59937906", "0.59920716", "0.59818", "0.59802693", "0.5970185", "0.5969593", "0.59668505", "0.594602", "0.58963865", "0.58925885", "0.5882289", "0.58813685", "0.58759314", "0.5852339", "0.5850628", "0.5842916", "0.58423746", "0.5840037", "0.58345395", "0.5805637", "0.5797022", "0.5796728", "0.57951146", "0.57801837", "0.57712585", "0.57664615", "0.57631284", "0.57614756", "0.57595444", "0.5739657", "0.57395345", "0.5738669", "0.573387", "0.572334", "0.5716167", "0.57146", "0.5711133", "0.57089293", "0.5707051", "0.5696397", "0.56895226", "0.568719", "0.5680245", "0.5670534", "0.5663275", "0.5661011", "0.5658663", "0.5658019", "0.56478894", "0.5647039", "0.56442183", "0.5641738", "0.5640073", "0.5639739", "0.5637713", "0.5634157", "0.56311405", "0.56301814", "0.5629517", "0.5627406" ]
0.6532103
10
PATCH/PUT /logs/1 PATCH/PUT /logs/1.json
def update respond_to do |format| if @log.update(log_params) format.html { redirect_to @log, notice: 'Log was successfully updated.' } format.json { render :show, status: :ok, location: @log } else format.html { render :edit } format.json { render json: @log.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @log = Log.find(params[:id])\n\n if @log.update(log_params)\n head :no_content\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def update\n @log = Log.find(params[:id])\n\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @proto_payload = args[:proto_payload] if args.key?(:proto_payload)\n @text_payload = args[:text_payload] if args.key?(:text_payload)\n @json_payload = args[:json_payload] if args.key?(:json_payload)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @severity = args[:severity] if args.key?(:severity)\n @insert_id = args[:insert_id] if args.key?(:insert_id)\n @http_request = args[:http_request] if args.key?(:http_request)\n @labels = args[:labels] if args.key?(:labels)\n @operation = args[:operation] if args.key?(:operation)\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @log }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def s3LogJsonUpdate(kafka_log_dir)\n println \"kafka log dir : #{kafka_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n if section['typeName'] == 'SYSTEM_LOG' then\n user_log = section['logFilePatterns']\n user_log << {\n \"fileGlob\" => \"#{kafka_log_dir}/var/log/(.*)\",\n \"s3Path\" => \"node/$instance-id/apps/kafka/$0\",\n \"delayPush\" => \"true\"\n }\n break\n end\n }\n new_json=JSON.pretty_generate(json_obj)\n File.open('/tmp/logs.json','w') do |file_w|\n file_w.write(\"#{new_json}\")\n end\n sudo \"mv /tmp/logs.json #{logs_json_path}\"\nend", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @logstash = Logstash.find(params[:id])\n\n respond_to do |format|\n if @logstash.update_attributes(params[:logstash])\n format.html { redirect_to @logstash, notice: 'Logstash was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @logstash.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_log = ExerciseLog.find(params[:id])\n\n respond_to do |format|\n if @exercise_log.update_attributes(params[:exercise_log])\n format.html { redirect_to @exercise_log, notice: 'Exercise log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to admin_log_path(@log), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @input_log.update(input_log_params)\n format.html { redirect_to @input_log, notice: 'Input log was successfully updated.' }\n format.json { render :show, status: :ok, location: @input_log }\n else\n format.html { render :edit }\n format.json { render json: @input_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @request_logging = args[:request_logging] if args.key?(:request_logging)\n end", "def update\n respond_to do |format|\n if @audit_log.update(audit_log_params)\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit_log }\n else\n format.html { render :edit }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log_file.update(log_file_params)\n format.html { redirect_to @log_file, notice: 'Log file was successfully updated.' }\n format.json { render :show, status: :ok, location: @log_file }\n else\n format.html { render :edit }\n format.json { render json: @log_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @log_entry = LogEntry.find(params[:id])\n\n respond_to do |format|\n if @log_entry.update_attributes(params[:log_entry])\n format.html { redirect_to @log_entry, :notice => 'Log entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @log_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @change_log.update(change_log_params)\n format.html { redirect_to @change_log, notice: 'Change log was successfully updated.' }\n format.json { render :show, status: :ok, location: @change_log }\n else\n format.html { render :edit }\n format.json { render json: @change_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ncr_api_log.update(ncr_api_log_params)\n format.html { redirect_to @ncr_api_log, notice: 'Ncr api log was successfully updated.' }\n format.json { render :show, status: :ok, location: @ncr_api_log }\n else\n format.html { render :edit }\n format.json { render json: @ncr_api_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @entry_log.update(entry_log_params)\n format.html { redirect_to @entry_log, notice: 'Entry log was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry_log }\n else\n format.html { render :edit }\n format.json { render json: @entry_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to(@log, :notice => 'Log was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ai_log.update(ai_log_params)\n format.html { redirect_to @ai_log, notice: 'Ai log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ai_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def s3LogJsonUpdate(presto_log_dir)\n println \"presto log dir : #{presto_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n if section['typeName'] == 'SYSTEM_LOG' then\n user_log = section['logFilePatterns']\n user_log << {\n \"fileGlob\" => \"#{presto_log_dir}/var/log/(.*)\",\n \"s3Path\" => \"node/$instance-id/apps/presto/$0\",\n \"delayPush\" => \"true\"\n }\n break\n end\n }\n new_json=JSON.pretty_generate(json_obj)\n File.open('/tmp/logs.json','w') do |file_w|\n file_w.write(\"#{new_json}\")\n end\n sudo \"mv /tmp/logs.json #{logs_json_path}\"\n end", "def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end", "def update\n respond_to do |format|\n if @data_log.update(data_log_params)\n format.html { redirect_to @data_log, notice: 'Data log was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_log }\n else\n format.html { render :edit }\n format.json { render json: @data_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update\n @foodlog = Foodlog.find(params[:id])\n\n respond_to do |format|\n if @foodlog.update_attributes(params[:foodlog])\n format.html { redirect_to @foodlog, :notice => 'Foodlog was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @foodlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @labels = args[:labels] if args.key?(:labels)\n @entries = args[:entries] if args.key?(:entries)\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 @interaction_log = InteractionLog.find(params[:id])\n\n respond_to do |format|\n if @interaction_log.update_attributes(params[:interaction_log])\n format.html { redirect_to @interaction_log, notice: 'Interaction log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interaction_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wr_log = WrLog.find(params[:id])\n\n respond_to do |format|\n if @wr_log.update_attributes(params[:wr_log])\n format.html { redirect_to @wr_log, notice: 'Wr log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wr_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @heat_log = HeatLog.find(params[:id])\n\n respond_to do |format|\n if @heat_log.update_attributes(params[:heat_log])\n format.html { redirect_to @heat_log, notice: 'Heat log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heat_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event_log_entry = EventLogEntry.find(params[:id])\n\n respond_to do |format|\n if @event_log_entry.update_attributes(params[:event_log_entry])\n format.html { redirect_to @event_log_entry, notice: 'Event log entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_log_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @log = Log.find(params[:id])\n @logs = @goal.logs\n\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to goal_logs_url(@goal), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'index' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @config_log.update(config_log_params)\n format.html { redirect_to @config_log, notice: 'Config log was successfully updated.' }\n format.json { render :show, status: :ok, location: @config_log }\n else\n format.html { render :edit }\n format.json { render json: @config_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n @steps_log = StepsLog.find(params[:id])\n\n respond_to do |format|\n if @steps_log.update_attributes(params[:steps_log])\n format.html { redirect_to @steps_log, notice: 'Steps log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @steps_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @user_log = UserLog.find(params[:id])\n\n respond_to do |format|\n if @user_log.update_attributes(params[:user_log])\n format.html { redirect_to @user_log, notice: 'User log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:user_id])\n @log = @user.logs.find(params[:id])\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to user_logs_url, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.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 respond_to do |format|\n if @change_log_entry.update(change_log_entry_params)\n format.html { redirect_to change_log_entries_path, notice: 'Activity log entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @change_log_entry }\n else\n format.html { render :edit }\n format.json { render json: @change_log_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @action_log.update(action_log_params)\n format.html { redirect_to @action_log, notice: 'Action log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @action_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @iptable_log.update(iptable_log_params)\n format.html { redirect_to @iptable_log, notice: 'Iptable log was successfully updated.' }\n format.json { render :show, status: :ok, location: @iptable_log }\n else\n format.html { render :edit }\n format.json { render json: @iptable_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n if @time_log.update_attributes(params[:time_log])\n format.html { redirect_to @time_log, notice: 'Time log was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tmpr_log.update(tmpr_log_params)\n format.html { redirect_to @tmpr_log, notice: 'Tmpr log was successfully updated.' }\n format.json { render :show, status: :ok, location: @tmpr_log }\n else\n format.html { render :edit }\n format.json { render json: @tmpr_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @d_logger = DLogger.find(params[:id])\n\n respond_to do |format|\n if @d_logger.update_attributes(params[:d_logger])\n format.html { redirect_to @d_logger, notice: 'D logger was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @d_logger.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity_log.update(update_params)\n format.html { redirect_to @activity_log, notice: 'Activity log was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_log }\n else\n format.html { render :edit }\n format.json { render json: @activity_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n=begin\n @notification_log = NotificationLog.find(params[:id])\n\n respond_to do |format|\n if @notification_log.update_attributes(params[:notification_log])\n format.html { redirect_to @notification_log, notice: 'Notification log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification_log.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def update\n @update_log = UpdateLog.find(params[:id])\n\n respond_to do |format|\n if @update_log.update_attributes(params[:update_log])\n flash[:notice] = 'UpdateLog was successfully updated.'\n format.html { redirect_to(@update_log) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @update_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @contact_log = ContactLog.find(params[:id])\n\n respond_to do |format|\n if @contact_log.update_attributes(params[:contact_log])\n format.html { redirect_to @contact_log, notice: 'Contact log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update\n respond_to do |format|\n if @rjlog.update(rjlog_params)\n format.html { redirect_to @rjlog, notice: 'Rjlog was successfully updated.' }\n format.json { render :show, status: :ok, location: @rjlog }\n else\n format.html { render :edit }\n format.json { render json: @rjlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @audit_log = AuditLog.find(params[:id])\n\n respond_to do |format|\n if @audit_log.update_attributes(params[:audit_log])\n format.html { redirect_to(@audit_log, :notice => 'Audit log was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @audit_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vlog.update(vlog_params)\n format.html { redirect_to @vlog, notice: 'Vlog was successfully updated.' }\n format.json { render :show, status: :ok, location: @vlog }\n else\n format.html { render :edit }\n format.json { render json: @vlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message_log = MessageLog.find(params[:id])\n\n respond_to do |format|\n if @message_log.update_attributes(params[:message_log])\n format.html { redirect_to @message_log, notice: 'Message log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update\n respond_to do |format|\n if @sample_storage_log.update(sample_storage_log_params)\n format.html { redirect_to @sample_storage_log, notice: 'Sample storage log was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample_storage_log }\n else\n format.html { render :edit }\n format.json { render json: @sample_storage_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @timelog.update(timelog_params)\n format.html { redirect_to @timelog, notice: 'Timelog was successfully updated.' }\n format.json { render :show, status: :ok, location: @timelog }\n else\n format.html { render :edit }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @logentry.update(logentry_params)\n format.html { redirect_to @logentry, notice: 'Logentry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @logentry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dlog = Dlog.find(params[:id])\n\n respond_to do |format|\n if @dlog.update_attributes(params[:dlog])\n format.html { redirect_to @dlog, notice: 'Dlog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @applicationlog = Applicationlog.find(params[:id])\n\n respond_to do |format|\n if @applicationlog.update_attributes(params[:applicationlog])\n format.html { redirect_to @applicationlog, notice: 'Applicationlog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @applicationlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @b_log = BLog.find(params[:id])\n\n respond_to do |format|\n if @b_log.update_attributes(params[:b_log])\n format.html { redirect_to @b_log, notice: 'B log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @b_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work_log = WorkLog.find(params[:id])\n\n respond_to do |format|\n if @work_log.update_attributes(params[:work_log])\n format.html { redirect_to @work_log, notice: 'Work log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @payload = args[:payload] if args.key?(:payload)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update\n @web_service_log = WebServiceLog.find(params[:id])\n\n respond_to do |format|\n if @web_service_log.update_attributes(params[:web_service_log])\n format.html { redirect_to @web_service_log, notice: 'Web service log was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @web_service_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @clothing_log = current_account.clothing_logs.find(params[:id])\n authorize! :update, @clothing_log\n params[:clothing_log].delete(:user_id)\n @clothing_log.update_attributes(clothing_log_params[:clothing_log])\n respond_with @clothing_log\n end", "def update\n @log_type = LogType.find(params[:id])\n\n respond_to do |format|\n if @log_type.update_attributes(params[:log_type])\n format.html { redirect_to @log_type, notice: 'Log type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @log_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @calllog.update(calllog_params)\n format.html { redirect_to @calllog, notice: 'Calllog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @calllog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user;\n @toeic_log = ToeicLog.find(params[:id])\n\n respond_to do |format|\n if @toeic_log.update_attributes(params[:toeic_log])\n format.html { redirect_to @toeic_log, notice: 'Toeic log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @toeic_log.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 patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def update\n if current_user.has_role? :admin\n respond_to do |format|\n if @shift_log.update(shift_log_params)\n format.html {redirect_to @shift_log, notice: 'Shift log was successfully updated.'}\n format.json {render :show, status: :ok, location: @shift_log}\n else\n format.html {render :edit}\n format.json {render json: @shift_log.errors, status: :unprocessable_entity}\n end\n end\n else\n flash[:alert] = \"Access To Logs Denied\"\n redirect_to root_path\n end\n end", "def update\n respond_to do |format|\n if @actlog.update(actlog_params)\n format.html { redirect_to @actlog, notice: 'Actlog was successfully updated.' }\n format.json { render :show, status: :ok, location: @actlog }\n else\n format.html { render :edit }\n format.json { render json: @actlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log_item.update_attributes(params[:log_item])\n format.html { redirect_to goal_log_items_path, notice: 'Log item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @log_item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.63702244", "0.6192638", "0.6142398", "0.6072837", "0.602619", "0.6021332", "0.6009091", "0.59995717", "0.5970933", "0.5964536", "0.5951586", "0.5923268", "0.59215367", "0.5919344", "0.59146863", "0.59006196", "0.58807683", "0.58788246", "0.5866625", "0.5855332", "0.5851782", "0.5850788", "0.5840592", "0.5834004", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5828212", "0.5827708", "0.5823261", "0.5815979", "0.58068514", "0.58021003", "0.57871467", "0.57614547", "0.5756278", "0.57501686", "0.57406914", "0.5722377", "0.57149214", "0.57012886", "0.569868", "0.5687701", "0.5657173", "0.56478405", "0.56350106", "0.5628823", "0.5623118", "0.56203586", "0.56148994", "0.5609749", "0.5605644", "0.56029576", "0.5594564", "0.559334", "0.5589463", "0.5576432", "0.5575609", "0.55657446", "0.55642015", "0.5563756", "0.55631924", "0.55600125", "0.555396", "0.55482996", "0.55388796", "0.5537945", "0.5537791", "0.55174756", "0.5516635", "0.55164754", "0.5514934", "0.55113083", "0.550183", "0.5497125", "0.54802644", "0.5476945", "0.54734856", "0.5465277", "0.5448548", "0.54473877", "0.54449767", "0.5444893", "0.5440214" ]
0.6026794
6
DELETE /logs/1 DELETE /logs/1.json
def destroy @log.destroy respond_to do |format| format.html { redirect_to logs_url, notice: 'Log was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n respond_to do |format|\n format.html { redirect_to index_logs_path(params[:device_id], :page => 1) }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n\n head :no_content\n end", "def destroy\n @dlog = Dlog.find(params[:id])\n @dlog.destroy\n\n respond_to do |format|\n format.html { redirect_to dlogs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ai_log.destroy\n respond_to do |format|\n format.html { redirect_to ai_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @d_logger = DLogger.find(params[:id])\n @d_logger.destroy\n\n respond_to do |format|\n format.html { redirect_to d_loggers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to admin_logs_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @wr_log = WrLog.find(params[:id])\n @wr_log.destroy\n\n respond_to do |format|\n format.html { redirect_to wr_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @user = User.find(params[:user_id])\n # @log = @user.logs.find(params[:id])\n @log.destroy\n respond_to do |format|\n format.html { redirect_to user_logs_url, notice: 'Log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_log = ExerciseLog.find(params[:id])\n @exercise_log.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_storage_log.destroy\n respond_to do |format|\n format.html { redirect_to sample_storage_logs_url, notice: 'Sample storage log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @audit_log.destroy\n respond_to do |format|\n format.html { redirect_to audit_logs_url, notice: 'Audit log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @update_log = UpdateLog.find(params[:id])\n @update_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(update_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @foodlog = Foodlog.find(params[:id])\n @foodlog.destroy\n\n respond_to do |format|\n format.html { redirect_to foodlogs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n @httping_log.destroy\n\n respond_to do |format|\n format.html { redirect_to servers_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_logs_url(@goal) }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_log = UserLog.find(params[:id])\n @user_log.destroy\n\n respond_to do |format|\n format.html { redirect_to user_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heat_log = HeatLog.find(params[:id])\n @heat_log.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log_file.destroy\n respond_to do |format|\n format.html { redirect_to log_files_url, notice: 'Log file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @logentry.destroy\n respond_to do |format|\n format.html { redirect_to logentries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_log.destroy\n respond_to do |format|\n format.html { redirect_to action_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @web_service_log = WebServiceLog.find(params[:id])\n @web_service_log.destroy\n\n respond_to do |format|\n format.html { redirect_to web_service_logs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @log_entry = LogEntry.find(params[:id])\n @log_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to log_entries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @time_log = TimeLog.find(params[:id])\n @time_log.destroy\n\n respond_to do |format|\n format.html { redirect_to time_logs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @dlog = Dlog.find(params[:id])\n @dlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(dlogs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @b_log = BLog.find(params[:id])\n @b_log.destroy\n\n respond_to do |format|\n format.html { redirect_to b_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n redirect_to acm300_logs_path\n \n # @acm_logs300_log.destroy\n # respond_to do |format|\n # format.html { redirect_to acm300_logs_url, notice: 'Acm300 log was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @audit_log = AuditLog.find(params[:id])\n @audit_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(audit_logs_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @data_log.destroy\n respond_to do |format|\n format.html { redirect_to data_logs_url, notice: 'Data log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @steps_log = StepsLog.find(params[:id])\n @steps_log.destroy\n\n respond_to do |format|\n format.html { redirect_to steps_logs_url }\n format.json { head :no_content }\n end\n end", "def delete\n CONNECTION.execute(\"DELETE FROM logs WHERE id = #{self.id};\")\n end", "def destroy\n @message_log = MessageLog.find(params[:id])\n @message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to message_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ncr_api_log.destroy\n respond_to do |format|\n format.html { redirect_to ncr_api_logs_url, notice: 'Ncr api log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_log = ActionLog.find(params[:id])\n @action_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @interaction_log = InteractionLog.find(params[:id])\n @interaction_log.destroy\n\n respond_to do |format|\n format.html { redirect_to interaction_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @entry_log.destroy\n respond_to do |format|\n format.html { redirect_to entry_logs_url, notice: 'Entry log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to logs_url, notice: 'Shift was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @history_log = HistoryLog.find(params[:id])\n @history_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(history_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @food_intake_log = FoodIntakeLog.find(params[:id])\n @food_intake_log.destroy\n\n respond_to do |format|\n format.html { redirect_to food_intake_logs_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @vlog.destroy\n respond_to do |format|\n format.html { redirect_to vlogs_url, notice: 'Vlog was successfully destroyed.' }\n format.json { head :no_content }\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 @event_log_entry = EventLogEntry.find(params[:id])\n @event_log_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to event_log_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tasks_log.destroy\n respond_to do |format|\n format.html { redirect_to tasks_logs_url, notice: 'Tasks log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rjlog.destroy\n respond_to do |format|\n format.html { redirect_to rjlogs_url, notice: 'Rjlog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_log.destroy\n respond_to do |format|\n format.html { redirect_to config_logs_url, notice: 'Config log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @input_log.destroy\n respond_to do |format|\n format.html { redirect_to input_logs_url, notice: 'Input log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render json: current_device.logs.destroy_all && \"\"\n end", "def destroy\n @order_log = OrderLog.find(params[:id])\n @order_log.destroy\n\n respond_to do |format|\n format.html { redirect_to order_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end", "def destroy\n @rcadmin_login_log.destroy\n respond_to do |format|\n format.html { redirect_to rcadmin_login_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tcpdump_log.destroy\n respond_to do |format|\n format.html { redirect_to tcpdump_logs_url, notice: 'Tcpdump log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @change_log.destroy\n respond_to do |format|\n format.html { redirect_to change_logs_url, notice: 'Change log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @log_item.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_log_items_url }\n format.json { head :ok }\n end\n end", "def delete_log name\n ensure_connection!\n resp = connection.delete_log name\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end", "def destroy\n @change_log_entry.destroy\n respond_to do |format|\n format.html { redirect_to change_log_entries_url, notice: 'Activity log entry was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tmpr_log.destroy\n respond_to do |format|\n format.html { redirect_to tmpr_logs_url, notice: 'Tmpr log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formlog = Formlog.find(params[:id])\n @formlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(formlogs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @logtransfer = Logtransfer.find(params[:id])\n @logtransfer.destroy\n\n respond_to do |format|\n format.html { redirect_to logtransfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n @outgoing_message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to outgoing_message_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @timelog.destroy\n respond_to do |format|\n format.html { redirect_to timelogs_url, notice: 'Timelog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server_monitor_log.destroy\n respond_to do |format|\n format.html { redirect_to server_monitor_logs_url, notice: 'Server monitor log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_task_log.destroy\n respond_to do |format|\n format.html { redirect_to daily_task_logs_url, notice: 'Daily task log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @iptable_log.destroy\n respond_to do |format|\n format.html { redirect_to iptable_logs_url, notice: 'Iptable log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @signout_log = SignoutLog.find(params[:id])\n @signout_log.destroy\n\n respond_to do |format|\n format.html { redirect_to signout_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact_log = ContactLog.find(params[:id])\n @contact_log.destroy\n\n respond_to do |format|\n format.html { redirect_to contact_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log_type = LogType.find(params[:id])\n @log_type.destroy\n\n respond_to do |format|\n format.html { redirect_to log_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measurement_log = current_account.measurement_logs.find(params[:id])\n @measurement_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurement_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n \n respond_to do |format|\n flash[:notice] = flash_helper('Log was deleted.')\n format.html { redirect_to logs_path }\n format.xml { head :ok }\n format.js\n end\n end", "def destroy\n @actlog.destroy\n respond_to do |format|\n format.html { redirect_to actlogs_url, notice: 'Actlog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @sleep_log = SleepLog.find(params[:id])\n @sleep_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(sleep_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @redirect_log.destroy\n respond_to do |format|\n format.html { redirect_to redirect_logs_url, notice: 'Redirect log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = current_user;\n @toeic_log = ToeicLog.find(params[:id])\n @toeic_log.destroy\n\n respond_to do |format|\n format.html { redirect_to toeic_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @accession_log.destroy\n respond_to do |format|\n format.html { redirect_to accession_logs_url, notice: 'Accession log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @steplog.destroy\n respond_to do |format|\n format.html { redirect_to steplogs_url, notice: 'Steplog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message_log.destroy\n respond_to do |format|\n format.html { redirect_to message_logs_url, notice: 'Message log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @weight_log = WeightLog.find(params[:id])\n @weight_log.destroy\n\n respond_to do |format|\n format.html { redirect_to weight_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @block_log = BlockLog.find(params[:id])\n @block_log.destroy\n\n respond_to do |format|\n format.html { redirect_to block_logs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @log_load_time.destroy\n respond_to do |format|\n format.html { redirect_to log_load_times_url, notice: 'Log load time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @topic_log.destroy\n respond_to do |format|\n format.html { redirect_to topic_logs_url, notice: 'Topic log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ventilation_log.destroy\n respond_to do |format|\n format.html { redirect_to ventilation_logs_url, notice: 'Ventilation log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_body_fat_log(user_id: '-', log_id:)\n delete(\"#{API_URI}/#{BODY_API_VERSION}/user/#{user_id}/body/log/fat/#{log_id}.json\")\n end", "def destroy\n @applicationlog = Applicationlog.find(params[:id])\n @applicationlog.destroy\n\n respond_to do |format|\n format.html { redirect_to applicationlogs_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @patient_log.destroy\n respond_to do |format|\n format.html { redirect_to patient_logs_url, notice: 'Patient log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def destroy\n @trade_log = TradeLog.find(params[:id])\n @trade_log.destroy\n\n respond_to do |format|\n format.html { redirect_to trade_logs_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.71921927", "0.71642995", "0.71139425", "0.71139425", "0.7061044", "0.6956337", "0.6928689", "0.6925817", "0.69248325", "0.68974054", "0.6888822", "0.68592334", "0.6852717", "0.68110347", "0.6801446", "0.67904896", "0.67643666", "0.67599887", "0.67484516", "0.6746382", "0.673478", "0.6726725", "0.67111224", "0.6699271", "0.6689394", "0.66852456", "0.6676492", "0.6667859", "0.6657428", "0.66479796", "0.66468763", "0.66358066", "0.66357076", "0.66163695", "0.6613469", "0.66134465", "0.6610349", "0.6593222", "0.6588732", "0.6585259", "0.6584992", "0.6566328", "0.65521824", "0.65476865", "0.6546687", "0.6544343", "0.65395856", "0.6522543", "0.651704", "0.6502437", "0.6500598", "0.65000176", "0.6497852", "0.6487491", "0.6479975", "0.6471195", "0.6468469", "0.6465148", "0.645483", "0.64490825", "0.64453846", "0.64385146", "0.6437421", "0.64337456", "0.6418233", "0.6415449", "0.6413871", "0.63997227", "0.6399291", "0.63941497", "0.63932836", "0.6392702", "0.63915735", "0.63897985", "0.6382905", "0.63766897", "0.6369537", "0.63677955", "0.63658893", "0.63545316", "0.6354464", "0.63299096", "0.6321871", "0.63208675", "0.63207525", "0.63163644", "0.63084626", "0.6303367", "0.62902576", "0.6289653", "0.6283597", "0.62788934", "0.62762636", "0.62626225", "0.625988", "0.62552166", "0.62531775", "0.62504053", "0.62484956" ]
0.68093884
15
Use callbacks to share common setup or constraints between actions.
def set_log @log = Log.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 setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\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 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 workflow\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 default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n 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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def log_params params.require(:log).permit(:date_of_session, :time_of_sesion, :details, :reference_code, :client_code, :iname) 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
Use callbacks to share common setup or constraints between actions.
def set_memorial @memorial = Memorial.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 memorial_params params.require(:memorial).permit(:title, :name, :description, :birth_date, :death_date, :path, :crop_top, :crop_left, :crop_width) 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 user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n 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 safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 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 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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\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.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586", "0.629103", "0.6282451", "0.6243152", "0.62413", "0.6219024", "0.6213724", "0.62103724", "0.61945", "0.61786324", "0.61755824", "0.6173267", "0.6163613", "0.6153058", "0.61521065", "0.6147508", "0.61234015", "0.61168665", "0.6107466", "0.6106177", "0.6091159", "0.60817343", "0.6071238", "0.6062299", "0.6021663", "0.60182893", "0.6014239", "0.6011563", "0.60080767", "0.60080767", "0.60028875", "0.60005623", "0.59964156", "0.5993086", "0.5992319", "0.5992299", "0.59801805", "0.59676576", "0.59606016", "0.595966", "0.59591126", "0.59589803", "0.5954058", "0.5953234", "0.5944434", "0.5940526", "0.59376484", "0.59376484", "0.5935253", "0.5930846", "0.5926387", "0.59256274", "0.5917907", "0.5910841", "0.590886", "0.59086543", "0.59060425", "0.58981544", "0.5898102", "0.5896809", "0.5895416", "0.58947027", "0.58923644", "0.5887903", "0.58830196", "0.5880581", "0.5873854", "0.58697754", "0.5869004", "0.58669055", "0.5866886", "0.58664906", "0.5864619", "0.58630043", "0.5862495", "0.5861368", "0.5859712", "0.5855544", "0.58551925", "0.5851284", "0.5850602" ]
0.0
-1
Return the enumerated lines of the command's output
def getCommandOutput(command) #N If we don't output the command it won't be echoed before it's output appears puts "#{command.inspect} ..." #N If we don't call this, the command won't run(?) and it's output won't be available return IO.popen(command) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_output\n [command.stdout, command.stderr].join(\"\\n\\n\")\n end", "def read_lines(cmd)\n IO.popen(cmd + ' 2>&1') do |child|\n child.read.split(\"\\n\")\n end\n end", "def exec_read\n lines = []\n MEX.synchronize do\n puts \"% \" + to_s\n end\n IO.popen(to_s, mode=\"r\") do |cmdout|\n lines = cmdout.readlines\n end\n raise CmvcError.new(\"Failed to exec '#{to_s}'\") unless $?.success?\n return lines\n end", "def output lines\n nil\n end", "def all_output\n aruba.command_monitor.all_output\n end", "def knife_output_as_array(sub_cmd)\n execute(knife_cmd(sub_cmd)).split(/\\n/).reject(&:empty?)\nend", "def entries\n @output\n end", "def completed_lines\n lines\n end", "def get_list(command)\n out = []\n cmd(command)\n get_result(:array => true).each do |line|\n out << line.split(/\\s+/)\n end\n out\n end", "def lines\n (1..buffer.length.to_i - 1).map { |ix| buffer[ix.to_i] }.flatten\n end", "def stdout_lines\n if @stdout_lines.nil?\n stdout = self.stdout\n return nil unless stdout\n @stdout_lines = stdout.split(/\\n/)\n end\n @stdout_lines\n end", "def lines\n\t\t\[email protected](Ruvim::API::CR)\n\t\tend", "def all_stdout\n aruba.command_monitor.all_stdout\n end", "def lines\n self\n end", "def print_output output_lines\n # printing the two lines on terminal\n puts output_lines[0]\n puts output_lines[1]\nend", "def stdouts; end", "def all_stdout\n registered_commands.each(&:stop)\n\n registered_commands.each_with_object(\"\") { |e, a| a << e.stdout }\n end", "def getLines\n\t\t@lines\n\tend", "def adb_get_lines(incmd)\n adb_devices = []\n\n lines = []\n\n cmd = [ 'adb' ]\n cmd += incmd\n Open3.popen3(*cmd) { |sin, sout, serr, thr|\n pid = thr[:pid]\n outlines = sout.readlines\n errlines = serr.readlines\n\n if errlines.length > 0\n lines << \"ERROR:\"\n errlines.each { |ln|\n lines << ln\n }\n end\n\n outlines.each { |ln|\n lines << ln.chomp\n }\n }\n\n return lines\nend", "def stdout\n @cmd_result.stdout\n end", "def lines; end", "def lines; end", "def raw_stdout_to_parts(c)\n raise IncompleteCommandError if !command_complete?(c)\n before, after = c.split(COMMAND_EPILOG_START, 2)\n epilog, after = after.split(COMMAND_EPILOG_END, 2)\n return before, YAML.load(epilog.strip), after\n end", "def lines\n content.lines.map(&:chomp)\n end", "def cmd_cmds\n puts self.methods.grep(/^cmd_/).map {|m| m[4..-1]} * \" \"\n end", "def lines\n @transcript_lines\n end", "def gather_command\n @command = []\n @lines.each do |x|\n if x[0,1].is_i?\n @command.push(x.split(/ /).s_to_i)\n else\n @command.push(x.split(//))\n end\n end\n end", "def lines\n result = Array.new\n @theLines.each { |l| result << String.new(l) }\n return result\n end", "def old_get_lines\n lines = nil\n #$stdin.flush\n $stdin.each_line do |line|\n line.chomp!\n if line =~ /^bye$/\n break\n end\n if lines\n lines << \"\\n\" + line\n else\n lines = line\n end\n end\n return lines\n end", "def lines\n\t\tcontents.split(\"\\n\")\n\tend", "def lines\n\t\tcontents.split(\"\\n\")\n\tend", "def description_lines\n string = @challenge.description\n lines = 0\n string.each_line('|') { |i|\n lines += 1\n }\n return lines+1\n end", "def do_and_report(command)\n f = open(\"| #{command}\")\n g = Array.new\n while (foo = f.gets)\n g << foo\n end\n g.each do |element|\n puts element\n end\nend", "def subcommands_presentation\n return nil unless command.commands.size > 0\n command.commands.values.uniq.map(&:summarize).join(\"\\n\")\n end", "def output\n []\n end", "def commandGetOut _args\n \"commandGetOut _args;\" \n end", "def command_output(command)\n command command\n last_command_output\n end", "def raw_output\n @raw_output ||= begin\n lines = path.read.split(\"\\n\")\n lines.shift\n [titre, lines.join(' ').strip_tags(' ')]\n end\n end", "def get_lines\n lines = []\n line = \"\"\n until line == \".\"\n line = Readline.readline\n lines << line\n end\n lines.join(\"\\n\")\n end", "def with_filter(command)\n io = IO.popen(command, 'r+')\n yield io.method(:puts)\n\n io.close_write\n io.readlines.map(&:chomp)\nend", "def lines\n @data.split(/^:/m)[1..-1].map do |line|\n \":#{line}\"\n end\n end", "def output\n @output.map(&:to_s)\n end", "def get_lines\n lines = []\n read_file.each_line{|l| lines << l.chomp }\n @total_lines = lines.shift.to_i\n lines\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 box_lines\n return [] if output.match NO_BOXES\n output.lines\n end", "def command_output_each_line(command, options)\n Open3::popen3(command, options) do |_, stdout, stderr, wait_thread|\n loop do\n check_output_with_timeout(stdout)\n\n begin\n yield stdout.readline\n rescue EOFError\n break\n end\n end\n status = wait_thread.value.exitstatus\n if status > 0\n message = \"Bot <#{command}> exited with status #{status}: #{stderr.read}\"\n raise RuntimeError.new(message)\n end\n end\nend", "def command_showAll\n entries = @log.get_entries()\n entries.each { |i|\n puts i.to_s\n }\n end", "def read_command_output( cmd, *args )\n\t\t\t# output = IO.read( '|-' ) or exec cmd, *args # No popen on some platforms. :(\n\t\t\targstr = Shellwords.join( args )\n\t\t\toutput = `#{cmd} #{argstr}`.chomp\n\t\t\treturn output\n\t\tend", "def commands_list\n out = \"\"\n # If there are no commands set\n if COMMANDS.empty?\n out << \" ooops! commands are not here!\"\n else\n # Get the longest command's name, so we can output it nice 'n' clean\n # This '+ int' at the end is a distance (in spaces) from the longest\n # command to descriptions\n longest = COMMANDS.max_by(&:size).size + 8\n COMMANDS.each do |cmd|\n # Calc, calc.\n spaces = longest - cmd.size\n # Check if there is a 'desc' method\n desc = if eval \"Command::#{cmd}.new.respond_to? 'desc'\"\n # If there is - execute it\n eval \"Command::#{cmd}.new.desc\"\n else\n # If there is not\n \"---\"\n end\n out << \" \" << cmd.downcase.to_s << \" \" * spaces << desc\n # If this command is the last one, don't make a new line\n unless cmd == COMMANDS.last\n out << \"\\n\"\n end\n end\n end\n out\n end", "def output\n @all[:output]\n end", "def extract_rye\n @stdout = original.stdout.map(&:to_s).join(\"\\n\")\n @stderr = original.stderr.map(&:to_s).join(\"\\n\")\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_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 pipeline\n parts = []\n @commands.each_with_index do |command, index|\n parts << %({ #{command} 2>&4 ; echo \"#{index}|$?:\" >&3 ; })\n end\n %({ #{parts.join(\" | \")} } 3>&1 1>&2 4>&2)\n end", "def lines\n @lines ||= line_codes.map {|l| Line.get(l)}\n end", "def lines; [to_s]; end", "def get_output\n output = []\n tokens = 0\n @queue_mutex.synchronize do\n tokens = @queue.size\n tokens.times { output << @queue.shift }\n end\n @mutex.synchronize do\n @enqueued_tokens -= tokens\n end\n\n # Nil if nothing to process in the pipe.\n # Possible only after flushing the pipe.\n if @enqueued_tokens > 0\n output\n else\n output.any? ? output : nil\n end\n end", "def get_command_output(shell_id, command_id, &block)\r\n done_elems = []\r\n output = Output.new\r\n\r\n while done_elems.empty?\r\n resp_doc = nil\r\n builder = get_builder_obj(shell_id, command_id, &block)\r\n request_msg = builder.target!\r\n resp_doc = send_get_output_message(request_msg)\r\n\r\n REXML::XPath.match(resp_doc, \"//#{NS_WIN_SHELL}:Stream\").each do |n|\r\n next if n.text.nil? || n.text.empty?\r\n stream = { n.attributes['Name'].to_sym => Base64.decode64(n.text).force_encoding('utf-8').sub(\"\\xEF\\xBB\\xBF\", \"\") }\r\n output[:data] << stream\r\n yield stream[:stdout], stream[:stderr] if block_given?\r\n end\r\n\r\n # We may need to get additional output if the stream has not finished.\r\n # The CommandState will change from Running to Done like so:\r\n # @example\r\n # from...\r\n # <rsp:CommandState CommandId=\"...\" State=\"http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Running\"/>\r\n # to...\r\n # <rsp:CommandState CommandId=\"...\" State=\"http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done\">\r\n # <rsp:ExitCode>0</rsp:ExitCode>\r\n # </rsp:CommandState>\r\n done_elems = REXML::XPath.match(resp_doc, \"//*[@State='http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done']\")\r\n end\r\n output[:exitcode] = REXML::XPath.first(resp_doc, \"//#{NS_WIN_SHELL}:ExitCode\").text.to_i\r\n output\r\n end", "def count_lines\n linecount = 0\n\n @output_buffer.each do |line|\n linecount += line.scan(/\\n/).count\n end\n\n linecount - 1\n end", "def outlinks\n return @outputs\n end", "def lines\n @lines ||= text.map do |line|\n line.split /\\s{2}/\n end.flatten.reject!{|l| l == '' }\n #puts \"LINES? #{@lines}\"\n @lines\n end", "def lines\n return [] unless @value && text\n\n text.split(/\\r\\n|\\r|\\n/)\n end", "def current_line\n # get the actual offset\n start = @buffer.get_iter_at_offset(@@offset)\n\n # get the command\n line = @buffer.get_text(start, @buffer.end_iter)\n\n return line\n end", "def print_execute(execute)\r\n execute.each do |line|\r\n line_info = []\r\n line.each do |name, value|\r\n if name.is_a? String\r\n line_info << value\r\n end\r\n end\r\n puts line_info.join(\"|\")\r\n end\r\n end", "def ls\n std_keys = [:class, :args, :arg_type, :start, :end, :result]\n extra_keys = key_counts.to_a.reject{|entry| std_keys.include?(entry[0])}\n extra_keys = extra_keys.sort_by{|entry| [-entry[-1], entry[0].to_s]}.map{|entry| entry[0]} # keys in descending order by frequency\n keys = std_keys + extra_keys\n table = []\n table << keys\n selected_log.each do |line|\n table << keys.map do |k|\n v = line[k]\n if k.to_s =~ /class/\n v\n elsif k == :args\n v.inspect[1...-1]\n elsif v.nil?\n ''\n else\n v.inspect\n end\n end\n end\n if table.size <= 1\n puts \"No matching data\"\n else\n puts table.justify_rows.map{|row| row.join(' ')}.join(\"\\n\")\n end\n end", "def last_command_output\n Output.new(@result.stdout)\n end", "def get_lines(filename); end", "def lines\n return self.sale.file_content.lines[self.begins_at_line..self.ends_at_line]\n end", "def lines\n @lines\nend", "def inspect\n inspect_lines = []\n self.lines.each do |l|\n start = l[:start]\n line_descriptor = l[:descriptor]\n line_length = line_descriptor.half_word[0]\n line_flags = line_descriptor.half_word[1]\n line_codes = []\n line_codes << 'D' if l[:status]==:deleted\n line_codes << '+' if line_length > 0777 # Upper bits not zero\n line_codes << '*' if (line_descriptor & 0777) != 0600 # Bottom descriptor byte is normally 0600\n inspect_lines << %Q{#{\"%06o\" % start}: len #{\"%06o\" % line_length} (#{\"%6d\" % line_length}) [#{'%06o' % line_flags} #{'%-3s' % (line_codes.join)}] #{l[:raw].inspect}}\n end\n inspect_lines.join(\"\\n\")\n end", "def xe_open(cmd)\n a = Array.new\n popen4(cmd) do |pid, stdin, stdout, stderr|\n stdin.close\n stdout.each {|line| a << line.chomp}\n end\n return a\nend", "def output_results\n CukeSniffer::Formatter.output_console(self)\n end", "def get_command(_str=\"\")\n @read_pt.next\n rescue StopIteration\n @eoi = true\n \"\\n\"\n end", "def tim_get_output(subcommand, *flags)\n tim_get_command(subcommand, *flags) do |command|\n %x[#{command.join(' ')}]\n end\n end", "def capture_command_output(*command, **kwargs, &block)\n # Default block returns what's passed in\n block ||= -> line { line }\n IO.popen(command.flatten, **kwargs) { |io| io.each_line { |line| print block.call(line) } }\n end", "def get_outputs()\n return @outputs\n end", "def outputs\n @outputs || []\n end", "def lines\n line_list = []\n\n supported_wifi_devices = %w[\n ath\n athn\n iwn\n ral\n rum\n wi\n wpi\n ]\n\n supported_virtual_devices = [\n 'bridge',\n 'carp',\n 'enc',\n 'gif',\n 'gre',\n 'pflog',\n 'pflow',\n 'pfsync',\n 'trunk',\n 'tun',\n # 'vether',\n 'vlan'\n ]\n\n # please_help_add_support_for = [\n # 'mpe',\n # 'mpw',\n # 'ppp',\n # 'pppoe',\n # 'sl',\n # 'svlan',\n # 'vxlan',\n # ]\n\n if has_addresses?\n PuppetX::BSD::HostnameIf::Inet.new(@addresses).process do |i|\n line_list << i\n end\n end\n\n # Supported interfaces return the already processed lines.\n if supported_virtual_devices.include?(@iftype)\n line_list.push(*@items)\n elsif supported_wifi_devices.include?(@iftype)\n line_list.push(*@items)\n else\n process_items(@addresses) do |line|\n line_list.push(*line)\n end\n\n # The process_items method is only used for items to ensure that\n # options who need to be on their own line are yieled as such. A\n # failure to process a line as a a known option or an IP address will\n # result in the complete item being sent back.\n process_items(@items) do |line|\n line_list.push(*line)\n end\n end\n\n options_string = @options.join(' ') if has_options?\n\n if @config.keys.include? :desc\n description_string = \"description \\\"#{@config[:desc]}\\\"\"\n end\n\n # Set the interface options\n #\n # If we have received interface options, append it to the content of\n # the first line.\n if has_options?\n tmp = line_list.shift\n line_list.unshift([tmp, options_string].join(' '))\n end\n\n # Include the description string\n #\n # If we have received a description string, include it as the first\n # line in the absense of interface options. In the presense of\n # interface options, we append the description to the end of the first\n # line.\n if @config.keys.include? :desc\n if has_options?\n tmp = line_list.shift\n line_list.unshift([tmp, description_string].join(' '))\n else\n line_list.unshift(description_string)\n end\n end\n\n line_list\n end", "def each_cracked_password\n ::IO.popen(show_command, \"rb\").readlines\n end", "def list_exec(session,cmdlst)\n\tprint_status(\"Running Command List ...\")\n\ttmpout = \"\"\n\tcmdout = \"\"\n\tr=''\n\tsession.response_timeout=120\n\tcmdlst.each do |cmd|\n\t\tbegin\n\t\t\tprint_status \"\\trunning command #{cmd}\"\n\t\t\ttmpout = \"\"\n\t\t\ttmpout << \"*****************************************\\n\"\n\t\t\ttmpout << \" Output of #{cmd}\\n\"\n\t\t\ttmpout << \"*****************************************\\n\"\n\t\t\tr = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})\n\t\t\twhile(d = r.channel.read)\n\n\t\t\t\ttmpout << d\n\t\t\tend\n\t\t\tcmdout << tmpout\n\t\t\tr.channel.close\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error Running Command #{cmd}: #{e.class} #{e}\")\n\t\tend\n\tend\n\tcmdout\nend", "def last_cmds(n=1)\n puts Readline::HISTORY.entries[-(n+1)..-2].join(\"\\n\")\nend", "def parse_out\n out = []; out << popline while peektype == ':'\n err = []; err << popline while peektype == '!'\n [out, err]\n end", "def lines\n @stats ||= stats\n end", "def run_capture_lines(command, *args)\n run_capture(command, args).split(\"\\n\")\n end", "def get_lines prompt=nil\n #prompt ||= \"Enter multiple lines, to quit enter . on empty line\"\n message prompt if prompt\n str = \"\"\n while $stdin.gets # reads from STDIN\n case $_.chomp \n when \".\"\n break\n when \".vim\"\n return edit_text str\n end\n str << $_\n #puts \"Read: #{$_}\" # writes to STDOUT\n end\n return nil if str == \"\"\n return str.chomp\n end", "def each_char(output, command)\n end", "def uncovered_lines(results)\n results.fetch(:lines)\n .each_with_index\n .select { |c, _| c == 0 }\n .map { |_, i| i }\n .compact\n end", "def get_console_output(length=50)\n data = JSON.generate(\"os-getConsoleOutput\" => {:length => length})\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n JSON::parse(response.body)[\"output\"]\n end", "def lines\n escaped = value.to_s.scan(/(\\\\n|\\\\t|\\\\r)/)\n escaped.empty? ? value.to_s.split(/\\n/, -1) : [value.to_s]\n end", "def input_lines; end", "def lines\n # TODO: data should be required to be a String, no nils\n @lines ||= data ? data.split(\"\\n\", -1) : []\n end", "def read_output(bytes=4086)\n output = \"\"\n raw_output = nil\n if @tail != \"\"\n raw_output = @tail\n else\n begin\n raw_output = @io_read.read_nonblock(bytes)\n rescue Errno::EAGAIN\n end\n end\n if raw_output\n @tail = \"\"\n raw_output.gsub!(/\\r/, '')\n Vorax.debug(\"read_output: #{raw_output.inspect}\")\n scanner = StringScanner.new(raw_output)\n while not scanner.eos?\n if @look_for == @start_marker\n if text = scanner.scan_until(/#{@look_for}/)\n if text !~ /pro #{@look_for}/\n # Only if it's not part of a PROMPT sqlplus command.\n # This might happen when the \"echo\" sqlplus option\n # is ON and the begin marker is included into the\n # sql pack file. Because we are using big chunks to\n # read data it's very unlikely that the echoing of the\n # prompt command to be split in the middle.\n @look_for = @end_marker\n end\n else\n scanner.terminate\n end\n end\n if @look_for == @end_marker\n output = scanner.scan(/[^#{@look_for}]*/)\n if scanner.scan(/#{@look_for}/)\n # end of output reached?\n # There's no perfect method to figure out, but we can\n # employ some heuristics: \n # 1) if \"set echo on\", expected tail is:\n #\n # \\n<SQL_PROMPT>#pro .EOF\n # .EOF\n #\n # 2) if \"set echo off\", expected tail is:\n #\n # EOF\n #\n Vorax.debug(\"read_output: end_marker detected\")\n @tail = scanner.rest\n Vorax.debug(\"read_output: @tail=#{@tail.inspect}\")\n if @tail =~ /^#{EOF}/ || @tail =~ /^\\n[^\\n]*?#{EOF}/ || @tail =~ /^\\n<br>\\n[^\\n]*?#{EOF}/\n Vorax.debug(\"read_output: end_marker confirmed\")\n @busy = false\n @tail = \"\"\n else\n Vorax.debug(\"read_output: end_marker NOT confirmed\")\n end\n scanner.terminate\n end\n end\n end\n end\n chunk = output.force_encoding('UTF-8')\n if @current_funnel && !chunk.empty?\n # nokogiri may be confused about those unclosed <p> tags\n # sqlplus emits, so it's better to get rid of them and use\n # <br> instead. \n @current_funnel.write(br_only(chunk))\n chunk = @current_funnel.read\n end\n return chunk\n end", "def lines(source); end", "def next_output_properties\n this_execute_count = $ant_execute_count\n $ant_execute_count += 1\n [ 'executer_output_%d' % this_execute_count, 'executer_error_%d' % this_execute_count, 'executer_result_code_%d' % this_execute_count ]\n end", "def lines(sep=$/) # added for 1.8.7\n return IoEnumerator.new(self, :each_line, sep)\n end", "def lines\n if string.respond_to?(:lines)\n string.lines.to_a\n else\n string.to_a\n end\n end", "def lines\n if string.respond_to?(:lines)\n string.lines.to_a\n else\n string.to_a\n end\n end", "def run_for_output(cmd)\n LOG.debug \"RUNNING (for output): #{cmd}\"\n out, _status = Open3.capture2e(cmd)\n out.strip\n end", "def output\n enum = parent.get(@value)\n \n return else_commands.output if enum.blank?\n \n enum = [enum] if enum.is_a?(String) || !enum.is_a?(Enumerable)\n enum.inject_with_index(\"\") do |output, item, i|\n set_block_params(item)\n set_metavariables(enum, i)\n str = commands.output\n output << str\n end\n end" ]
[ "0.68375665", "0.6826725", "0.66310817", "0.65137786", "0.65059036", "0.6493662", "0.6324124", "0.6252752", "0.62455964", "0.62303513", "0.6177085", "0.61643153", "0.616375", "0.61044544", "0.60965055", "0.6002687", "0.59949625", "0.5969165", "0.59628254", "0.59436184", "0.59324044", "0.59324044", "0.59009445", "0.58953834", "0.5874992", "0.5873419", "0.5869237", "0.5860322", "0.5855974", "0.58485407", "0.58485407", "0.58149964", "0.5813546", "0.5806524", "0.5804727", "0.580116", "0.5799674", "0.5786393", "0.57855684", "0.5783997", "0.57791895", "0.5773861", "0.575892", "0.57512224", "0.57394856", "0.57074004", "0.56885934", "0.5660759", "0.5653522", "0.56480026", "0.56219774", "0.5592791", "0.5592791", "0.55915487", "0.5587739", "0.5561433", "0.555985", "0.5558383", "0.5549928", "0.5525984", "0.55259305", "0.5525335", "0.55180866", "0.5515215", "0.55113834", "0.550109", "0.54984176", "0.54977345", "0.54955786", "0.5485324", "0.5483081", "0.54779255", "0.54749686", "0.54670423", "0.54649377", "0.5460441", "0.54563195", "0.54480386", "0.5444366", "0.5434385", "0.5433453", "0.5429032", "0.54165745", "0.5414139", "0.5412518", "0.5410981", "0.5392719", "0.5389844", "0.5384772", "0.5380825", "0.5378289", "0.53718656", "0.53650516", "0.53650314", "0.5354484", "0.5348498", "0.53479624", "0.53479624", "0.5343915", "0.53211284" ]
0.5599947
51
Check if the last executed process exited with status 0, if not, raise an exception
def checkProcessStatus(description) #N Without this, we won't know the status of the last process processStatus = $? #N If we don't check for exited, then we might report an invalid or undefined status value if not processStatus.exited? raise "#{description}: process did not exit normally" end #N Without this, we won't know if the status was non-zero exitStatus = processStatus.exitstatus #N If we don't check for zero, then we'll always raise an error, even for success if exitStatus != 0 #N If we don't raise the error, then an invalid exit status will seem to exit successfully raise "#{description}: exit status = #{exitStatus}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exit_status_from_exception; end", "def last_command_successful?\n $?.exitstatus == 0\n end", "def exit_status\n @failure_count == 0 ? exit(0) : exit(1)\n end", "def exitcode\n run unless @process\n @process.exitstatus\n end", "def last_exit_successful?\n $!.nil? || $!.is_a?(SystemExit) && $!.success?\nend", "def exitcode\n run unless @process\n @process.exitstatus\n end", "def exitstatus\n subexec.try(:exitstatus)\n end", "def failure?\n exit_code != 0\n end", "def nonzero_exit?\n exit_code != 0\n end", "def check_exit_code!(executable, command, output)\n if $?.exitstatus != 0\n raise DownloaderError, \"Error on `#{executable} #{command}`.\\n#{output}\"\n end\n end", "def exited?(*) end", "def exit_status\n wait_until_done\n @status && @status.exitstatus\n end", "def exitcode\n @process_status ? @process_status.exitstatus : nil\n end", "def dead?\n !!@exitstatus\n end", "def exitstatus(*) end", "def exitstatus; end", "def system_exit(status)\n exit(status)\n end", "def exited?\n # instances of Process::Status not available while a child is running\n true\n end", "def failing?\n @status.exitstatus & (1 << 3) != 0\n end", "def failing?\n @status.exitstatus & (1 << 3) != 0\n end", "def success?\n status == Process::EXIT_SUCCESS\n end", "def exit_status\n @status\n end", "def self_log?\n @status.exitstatus & (1 << 7) != 0\n end", "def exit(res=0) end", "def try(command)\n system command\n if $? != 0 then\n raise \"Command: `#{command}` exited with code #{$?.exitstatus}\"\n end\nend", "def try(command)\n system command\n if $? != 0 then\n raise \"Command: `#{command}` exited with code #{$?.exitstatus}\"\n end\nend", "def try(command)\n system command\n if $? != 0 then\n raise \"Command: `#{command}` exited with code #{$?.exitstatus}\"\n end\nend", "def set_exit_status\n @exit_status =\n if exception\n exception.is_a?(StandardError) ? 2 : 3\n else\n Logger.has_warnings? ? 1 : 0\n end\n end", "def system_exit\n exit 1\n end", "def prefail?\n @status.exitstatus & (1 << 4) != 0\n end", "def success?\n # note that Linux ruby returns nil when exitstatus is nil and a termsig\n # value is set instead.\n return @exitstatus ? (0 == @exitstatus) : nil\n end", "def last_exit_code\n Integer(capture(\"echo $?\"))\n end", "def success?\n\t\t!!( @status and @status.exitstatus == 0 )\n\tend", "def done?\n !!@exitstatus\n end", "def assert_error_occurred\n assert_not_exit_status 0\n end", "def self_log?\n @status.exitstatus & (1 << 7) != 0\n end", "def success?\n exit_status == 0\n end", "def exit_status\n status = 0\n if @metrics[\"changes\"] && @metrics[\"changes\"][TOTAL] &&\n @metrics[\"resources\"] && @metrics[\"resources\"][\"failed\"] &&\n @metrics[\"resources\"][\"failed_to_restart\"]\n status |= 2 if @metrics[\"changes\"][TOTAL] > 0\n status |= 4 if @metrics[\"resources\"][\"failed\"] > 0\n status |= 4 if @metrics[\"resources\"][\"failed_to_restart\"] > 0\n else\n status = -1\n end\n status\n end", "def prefail?\n @status.exitstatus & (1 << 4) != 0\n end", "def exited?\n return true\n end", "def exit!(res=0) end", "def exit_status\n status = 0\n status |= 2 if @metrics[\"changes\"][\"total\"] > 0\n status |= 4 if @metrics[\"resources\"][\"failed\"] > 0\n status\n end", "def executed\n @process_status.nil? ? false : true\n end", "def error_log?\n @status.exitstatus & (1 << 6) != 0\n end", "def assert_clean_exit\n assert(0 == exit_status)\n end", "def puppet_successful?(exit_status)\n [0, 2].include?(exit_status)\n end", "def has_errors?\n return @exitcode == 2 || @exitcode == 1\n end", "def successful?\n exit_code == 0\n end", "def exit_status()\n unless @exit_status.nil?\n Thread === @exit_status ? @exit_status.value().exitstatus() : \n @exit_status.exitstatus()\n end\n end", "def exit_status()\n unless @exit_status.nil?\n Thread === @exit_status ? @exit_status.value().exitstatus() : \n @exit_status.exitstatus()\n end\n end", "def system_check(cmd)\n success = system cmd\n raise \"Error running '#{cmd}'\" unless success \nend", "def exit_process!\n abort\n end", "def exit_code\n return nil unless done?\n\n events.each do |event|\n status = event.dig('containerStopped', 'exitStatus')\n return status.to_i if status\n end\n nil # catch-all\n end", "def success?\n exit_code == 0\n end", "def no_command?\n exit_code == 127\n end", "def exit?\n !exit_code.nil?\n end", "def error_log?\n @status.exitstatus & (1 << 6) != 0\n end", "def test_missing_command\n ChildProcess.exec({}, 'nosuch') do |child|\n assert !child.wait.success?\n end\n end", "def succeeds?(command)\n system(\"#{command} > /dev/null 2> /dev/null\")\n $? == 0\n end", "def exit(status = 0)\n say BLANK\n Kernel.exit(status)\n end", "def system_exitcode(t, stderr, name)\t\n\t\tif t.value.success?\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: Running #{name} finished.\"\n\t\t\tif stderr.any?\n\t\t\t\t$logfile.puts \"#{name} output:\"\n\t\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\tend\n\t\telse\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: Error in #{name}:\"\n\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\texit\n\t\tend\n\tend", "def done?\n exit_status.present?\n end", "def test_exitstatus\n with_fixture 'exitstatus' do\n assert system(\"ruby\", ocra, \"exitstatus.rb\", *DefaultArgs)\n system(\"exitstatus.exe\")\n assert_equal 167, $?.exitstatus\n end\n end", "def assert_no_clean_exit\n assert(0 != exit_status)\n end", "def run_with_status(*args)\n _print_command(*args)\n args.last.delete :errexit if args.last.is_a? Hash\n args.last.delete :xtrace if args.last.is_a? Hash\n pid = Process.spawn(*args)\n return Process.wait2(pid).last\nend", "def exit_process(exit_code)\n exit exit_code\n end", "def dead(why)\n puts \"#{why} Good job!\"\n Process.exit(0)\nend", "def set_exit_exception; end", "def past_prefail?\n @status.exitstatus & (1 << 5) != 0\n end", "def waitForAllProcesses\n begin\n Process.wait while true\n\n rescue SystemCallError\n #No need to do anything here, just go\n end\nend", "def dead(why)\n puts \"#{why} Good job!\"\n Process.exit(0)\nend", "def rescue_at_exit!\n logger.info \"Attached to application exit.\"\n at_exit { report($!) if $! && !last_reported.equal?($!) }\n end", "def exit_exception; end", "def terminated?\n !! @status\n end", "def system_check(cmd)\n puts \"=> '#{cmd}'\"\n success = system cmd\n raise \"Error running '#{cmd}'\" unless success \nend", "def exit(ret)\n @exit_status = ret\n if defined? Rbkb::Cli::TESTING\n throw(((ret==0)? :exit_zero : :exit_err), ret)\n else\n Kernel.exit(ret)\n end\n end", "def exit!(msg, err = -1)\n Backdat::Log.debug(msg)\n Process.exit err\n end", "def process_running?(pid)\n Process.kill(0,pid)\n return true\nrescue Errno::ESRCH\n return false\nend", "def waitForProcess(pid)\n begin\n waitpid(pid, 0)\n\n rescue SystemCallError\n end\nend", "def system_exitcode(t, stderr, name)\t\n\t\tif t.value.success?\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: #{name} succeded.\"\n\t\t\tif stderr.any?\n\t\t\t\t$logfile.puts \"#{name} output:\"\n\t\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\tend\n\t\telse\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: Error in #{name}:\"\n\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\texit\n\t\tend\n\tend", "def get_ssh_exitcode( index = 1 )\n index.is_a?(Fixnum) and index > 0 ? self.ssh_exitcode[-index] : self.ssh_exitcode[index]\n end", "def check_status\n return status if pid.nil?\n\n pre_status = `#{check_status_command}`\n unless pre_status.nil? || pre_status.empty?\n state = check_process_status(pre_status)\n completed?(state) ? check_completed_status : state\n else\n failed? ? status : check_completed_status\n end\n end", "def exit_status\n effective_targets.each do |target|\n process_target(target)\n break if @fail_fast && !@success\n end\n\n @success ? EXIT_SUCCESS : EXIT_FAILURE\n end", "def error!(status, msg)\n error msg\n exit status\n end", "def wexitstatus \n DRMAA.wexitstatus(@stat) \n end", "def finished!(process_status)\n summary = \"(#{@pid}/#{@pids.inspect}/self_started=#{@self_started}/killed=#{@killed})\"\n if process_status.nil? && !@self_started\n log :debug, \"#{summary} I am no longer blocked.\"\n @pid = nil\n @backoff.died unless @killed\n elsif !process_status.nil? && @self_started\n alive_time_sec = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_time\n @config.after_exit(WorkerSummary.new(alive_time_sec: alive_time_sec, process_status: process_status))\n\n log :debug, \"#{summary} I exited: #{process_status}\"\n @pid = nil\n @backoff.died unless @killed\n else\n log :debug, \"#{summary} Reports of my death are highly exaggerated (#{process_status.inspect})\"\n end\n end", "def handle_errors(output)\n if $? != 0\n puts output\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts \"~ FATAL: Command failed with status #{$?}\"\n exit 1\n end\nend", "def assert_no_error_occurred\n assert_exit_status(0)\n end", "def run_or_fail(cmd, redact: nil)\n put_command(cmd, redact: redact)\n Open3.popen3(*cmd) do |i, o, e, t|\n i.close\n if not t.value.success?\n STDERR.write red_term_text(e.read)\n exit t.value.exitstatus\n end\n end\n end", "def wait_for_exit\n @out_log.wait\n @err_log.wait unless @err_log.nil?\n\n Process.wait(@pid)\n @exit_status = $CHILD_STATUS\n\n @pid = nil\n @exit_status == 0\n end", "def gets_exit_status(status = 0)\n script.gets_channel_request(self, \"exit-status\", false, status)\n end", "def systemOrDie(*cmd)\n puts 'executes: ' + cmd.join(' ')\n ret = system(*cmd)\n raise \"Failed to execute command: \" + cmd.join(' ') if !ret\n end", "def past_prefail?\n @status.exitstatus & (1 << 5) != 0\n end", "def status\n raise ProcessNotRunningError.new \"#@prefix called .status before .run.\" unless @pid\n waitpid unless @status\n @status\n end", "def execute_and_rescue\n begin\n yield if block_given?\n rescue SystemExit\n end\nend", "def dead(why)\n\tputs \"#{why} Good job!\"\n\tProcess.exit(0)\nend", "def exit\n case @status\n when :sleep\n wake_resume(:exit)\n when :run\n throw :exit\n end\n end", "def exit_code\n self.__options[:exit_code]\n end", "def wait\n log.info 'Waiting for all processes to finish'\n loop do\n failed = db[:process_items].filter(:id => @all_ids, :status => BlueColr.get_error_states).first\n return failed[:exit_code] if failed\n not_ok_count = db[:process_items].filter(:id => @all_ids).exclude(:status => BlueColr.get_ok_states).count\n return 0 if not_ok_count == 0 # all ok, finish\n sleep 10\n end\n end", "def waitpid(pid)\n ::Process::waitpid(pid)\n $?\n end" ]
[ "0.6983408", "0.6960143", "0.6929326", "0.68289566", "0.6827344", "0.6754732", "0.67523843", "0.6647697", "0.6574119", "0.6560714", "0.65605265", "0.6555435", "0.64986783", "0.648988", "0.64773035", "0.64683384", "0.6449335", "0.64396006", "0.6414914", "0.6333834", "0.6330399", "0.6283154", "0.6268922", "0.62589127", "0.6217071", "0.6217071", "0.6217071", "0.62009054", "0.61747074", "0.6167553", "0.6161161", "0.61465746", "0.61253166", "0.6124973", "0.60933876", "0.6082727", "0.60473037", "0.60289806", "0.60233754", "0.6021676", "0.60014683", "0.5994616", "0.5974961", "0.5970025", "0.5956994", "0.59531724", "0.5948685", "0.5938972", "0.5927373", "0.5927373", "0.59233135", "0.5915006", "0.5903229", "0.58987415", "0.5863559", "0.586276", "0.5841017", "0.58406514", "0.5819988", "0.58196414", "0.57794905", "0.5779157", "0.57756716", "0.5773779", "0.57716054", "0.57672906", "0.5747959", "0.5742291", "0.5733118", "0.57225233", "0.5719287", "0.5716522", "0.5708024", "0.57059723", "0.5698502", "0.5684386", "0.5659993", "0.56553596", "0.5655118", "0.5642982", "0.56371987", "0.56295615", "0.5624697", "0.56228065", "0.5604243", "0.5592577", "0.5592269", "0.5589171", "0.55632764", "0.55599385", "0.5548986", "0.55416065", "0.5537738", "0.5532813", "0.5531134", "0.55174696", "0.5504541", "0.5492018", "0.5489965", "0.54886264" ]
0.71758777
0
N Without this, we won't be able to construct the object representing the file path and the hash of its contents in a single expression (also there is no other way to set the readonly attributes)
def initialize(relativePath, hash) #N Without this, we won't rememeber the relative path value @relativePath = relativePath #N Without this, we won't remember the file's cryptographic hash of its contents @hash = hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n return (path + file_id.to_s).hash\n end", "def file_digest(pathname)\n key = pathname.to_s\n if @digests.key?(key)\n @digests[key]\n else\n @digests[key] = super\n end\n end", "def hash\n path.hash\n end", "def file_sha256\n Digest::SHA256.file(self).hexdigest\n end", "def internal_file_attributes=(_arg0); end", "def hash\n folder.hash ^ name.hash # eXclusive OR operator\n end", "def hash\n raise NotImplementedError.new(\"hash() must be implemented by subclasses of AbstractVersionedFile.\")\n end", "def hash_file path, hash_store\r\n\thexdigest = HASH_DIGEST.hexdigest(open(path, 'rb') { |io| io.read })\r\n\thash_store[hexdigest] << path\r\nend", "def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end", "def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end", "def hexdigest\n self.class.hexdigest_for(path)\n end", "def initialize(name, hash, parentPathElements)\n #N Without this we won't remember the name of the file\n @name = name\n #N Without this we won't know the hash of the contents of the file\n @hash = hash\n #N Without this we won't know the path elements of the sub-directory (within the directory tree) containing the file\n @parentPathElements = parentPathElements\n #N Without this the file object won't be in a default state of _not_ to be copied\n @copyDestination = nil\n #N Without this the file object won't be in a default state of _not_ to be deleted\n @toBeDeleted = false\n end", "def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end", "def internal_file_attributes; end", "def file_sha1\n Digest::SHA1.file(self).hexdigest\n end", "def external_file_attributes=(_arg0); end", "def file_hash\n return @file_hash\n end", "def hash(pathname)\n ext = pathname.extname\n ext = ('' == ext || nil == ext) ? :none : ext.to_sym\n digest = Digest::MD5.hexdigest(File.read(pathname.to_s))\n @scanned[ext] ||= {}\n @scanned[ext][digest] ||= []\n @scanned[ext][digest] << pathname\n end", "def file_hash=(value)\n @file_hash = value\n end", "def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend", "def file_md5\n Digest::MD5.file(self).hexdigest\n end", "def checksum_file(digest_class, path)\n digester = digest_class.new\n digester.file(path)\n digester.hexdigest\n end", "def initialize(file)\n self.stathash = stat(file) if (file)\n end", "def hash\n\t\t\[email protected]\n\t\tend", "def file_digest_key(stat)\n \"file_digest:#{compressed_path}:#{stat}\"\n end", "def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end", "def file_digest(path)\n if stat = self.stat(path)\n self.stat_digest(path, stat)\n end\n end", "def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end", "def immutable_files\n @attributes[:immutable_files]\n end", "def hash\n @path.hash\n end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end", "def initialize(filename, mode=\"r\", perm=0) end", "def hash\n [class_id, object_type, action, cache_state, cached_time, last_access_time, md5sum, original_sha512sum, path, registered_workflows, used_count, file, network_element].hash\n end", "def hashFromFile(file, auth, algo)\n u = URI::NI.buildFromFile(auth, file, nil, algo)\n type=`file --mime-type #{file}`.split[1]\n u.contentType!(type)\n u\nend", "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_attributes\n {}\n end", "def file_attributes\n {}\n end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def hash\n [_hash, name, owner].hash\n end", "def external_file_attributes; end", "def digest_path\n if DigestUtils.already_digested?(@name)\n logical_path\n else\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{etag}#{ext}\" }\n end\n end", "def file_digest(path, data = nil)\n if stat = self.stat(path)\n # `data` maybe provided\n if data\n digest.update(data)\n\n # If its a file, digest the contents\n elsif stat.file?\n digest.file(path)\n\n # If its a directive, digest the list of filenames\n elsif stat.directory?\n contents = self.entries(path).join(',')\n digest.update(contents)\n end\n end\n end", "def getHash element\n\tfile = File.new(element)\n\thash = Digest::SHA256.file file\n\tfile.close\n\treturn hash.hexdigest \n\tend", "def digest\n Digest::MD5.file(file).hexdigest\n end", "def initialize(hashCommand, pathPrefix = \"\")\n #N Without this, would not know the how to execute and parse the result of the hash command\n @hashCommand = hashCommand\n #N Without this, would not know how to execute 'find' if it's not on the path\n @pathPrefix = pathPrefix\n end", "def file_record_for(path)\n\t\t\tmetadata = metadata_for(:file, path)\n\t\t\t\n\t\t\t# Should this be here or in metadata_for?\n\t\t\t# metadata.merge!(digests_for(path))\n\t\t\t\n\t\t\tRecord.new(:file, path.relative_path, metadata)\n\t\tend", "def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end", "def git_object(hash)\n return `git cat-file -p #{hash}`\nend", "def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend", "def file_digest(file)\n # Get the actual file by #tempfile if the file is an `ActionDispatch::Http::UploadedFile`.\n Digest::SHA256.file(file.try(:tempfile) || file).hexdigest\n end", "def inspect\n \"#<#{self.class.name}:0x#{object_id} bucket=\\\"#{@bucket}\\\" file=\\\"#{@file_path}\\\">\"\n end", "def hash\n name.hash ^ version.hash\n end", "def /(fname)\n FileObject[path, fname]\n end", "def etag\n stat = ::File.stat(@path)\n '\"' + Digest::SHA1.hexdigest(stat.ino.to_s + stat.size.to_s + stat.mtime.to_s) + '\"'\n end", "def file=(_); end", "def hash\n @real.hash ^ @image.hash\n end", "def file_ids_hash\n if @file_ids_hash.blank?\n # load the file sha's from cache if possible\n cache_file = File.join(self.path,'.loopoff')\n if File.exists?(cache_file)\n @file_ids_hash = YAML.load(File.read(cache_file))\n else\n # build it\n @file_ids_hash = {}\n self.loopoff_file_names.each do |f|\n @file_ids_hash[File.basename(f)] = Grit::GitRuby::Internal::LooseStorage.calculate_sha(File.read(f),'blob')\n end\n # write the cache\n File.open(cache_file,'w') do |f|\n f.puts YAML.dump(@file_ids_hash) \n end\n end \n end\n @file_ids_hash\n end", "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def initialize(baseDirectory, hashClass, cachedContentFile = nil)\n #N Without this, we won't remember the cached content file name\n super(cachedContentFile)\n #N Without this, we won't remember the base directory\n @baseDirectory = baseDirectory\n #N Without this, we won't remember the hash function\n @hashClass = hashClass\n end", "def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end", "def checksum(file_path, hash_class, _bit_size)\n # Size of each chunk\n chunk_size = 2048\n # Hash that is the checksum function\n # when a bitsize was specified\n if _bit_size\n hash = hash_class.new(_bit_size)\n else\n hash = hash_class.new\n end\n # File handler\n file_object = File.open(file_path, 'r')\n # loop to update the hash\n while true\n content = file_object.read chunk_size\n # Break the loop if we don't get any byte\n unless content\n return hash.hexdigest\n end\n # Update the hash\n hash.update content\n end\nend", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def path_to(hash = T.unsafe(nil)); end", "def file_field(object_name, method, options = T.unsafe(nil)); end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def initialize stat, location = nil\n @data = Hash.new\n @tags = nil\n if location\n begin\n IO.popen([\"sha256sum\", location]) do |io|\n @hash = io.read.split(' ')[0]\n end\n rescue Exception => e\n logger.error \"Can't hash #{location.inspect}: #{e}\"\n end\n @mimetype = MimeType.detect location\n @location = location\n @ctime = stat.ctime\n @mtime = stat.mtime\n @size = stat.size\n tags = location.split File::SEPARATOR\n tags.shift if tags[0].empty?\n @name = tags.pop\n @tags = tags\n else\n stdin\n end\n end", "def contents_hash(paths)\n return if paths.nil?\n\n paths = paths.compact.select { |path| File.file?(path) }\n return if paths.empty?\n # rubocop:disable GitHub/InsecureHashAlgorithm\n paths.sort\n .reduce(Digest::XXHash64.new, :file)\n .digest\n .to_s(16) # convert to hex\n # rubocop:enable GitHub/InsecureHashAlgorithm\n end", "def id(source_file)\n Digest::SHA1.hexdigest(source_file.filename)\n end", "def md5; Digest::MD5.file(fname).hexdigest; end", "def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end", "def filename\n self.class.path(hash)\n end", "def initialize\n @data = ::Hash.new { |h, k| h[k] = File.new(k, mtime: 0) }\n @mutex = Mutex.new\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def to_h\n { path: @path.to_s,\n name: name,\n load_as_module?: load_as_module? }\n end", "def id(source_file)\n Digest::SHA1.hexdigest(filename(source_file))\n end", "def initialize file_path\n\t\t\t@file_path = file_path\n\t\t\t@meta = {}\n\t\tend", "def hash=(_arg0); end", "def create_sha1 str, namespace\nsha1 = Digest::SHA1.new\nsha1.update namespace.raw_bytes\nsha1.update str\nsum = sha1.digest\nraw = mask 5, sum[0..15]\nret = new raw\nret.freeze\nret\nend", "def sha1\n @sha1 ||= digest(path, :sha1)\n end", "def hash\n @relative_name.hash\n end", "def initialize(raw_content, attributes, identifier, params=nil)\n # Get mtime and checksum\n params ||= {}\n params = { :mtime => params } if params.is_a?(Time)\n @new_checksum = params[:checksum]\n @mtime = params[:mtime]\n\n @raw_content = raw_content\n @attributes = attributes.symbolize_keys\n @identifier = identifier.cleaned_identifier\n end", "def hash()\n #This is a stub, used for indexing\n end", "def hash_file(filename)\n file = File.read(filename)\n tlsh_hash(file.bytes)\n end", "def generate_sha(file)\n\n sha1 = Digest::SHA1.file file\n return sha1\n\nend", "def regenerate_hash\n path = tempfile_path\n unless File.exist?(path)\n path = file_path\n end\n\n unless File.exist?(path)\n errors.add(:file, \"not found\")\n return false\n end\n\n hashes = Moebooru::Hasher.compute(path, [:crc32, :md5])\n\n self.md5 = hashes[:md5]\n self.crc32 = hashes[:crc32]\n end", "def hash(handle, offset, length, block_size=0)\n if block_size != 0 && block_size < 255\n block_size = 256\n end\n send_request(FXP_EXTENDED, :string, \"check-file-handle\", :string, handle, :string, \"md5,sha256,sha384,sha512\", :int64, offset, :int64, length, :long, block_size)\n end", "def initialize(pth=nil, priv=nil, own=nil, grp=nil)\n # duplicat instance if initilize is called with an instance as the first argument\n if pth.is_a?(UFS::FS::File) || pth.is_a?(UFS::FS::Dir)\n priv = pth.permissions\n own = pth.owner\n grp = pth.group\n pth = pth.path\n end\n self.path = ::File.expand_path(pth) unless pth.nil?\n self.permissions = priv unless priv.nil?\n self.owner = own unless own.nil?\n self.group = grp unless grp.nil?\n end", "def create_lock_object\n @bucket.create_file(\n StringIO.new,\n @path,\n acl: @object_acl,\n cache_control: 'no-store',\n metadata: {\n expires_at: (Time.now + @ttl).to_f,\n identity: identity,\n },\n if_generation_match: 0,\n )\n rescue Google::Cloud::FailedPreconditionError\n nil\n end", "def integrity(path)\n \"sha256-#{Base64.encode64(Digest::SHA256.digest(File.read(path))).chomp}\"\n end", "def <<( file_path )\n if file_path.is_a?( Array )\n file = file_path.shift\n path = file_path\n else\n file = file_path\n path = []\n end\n File.open( file ) do |file_io|\n while( piece = file_io.read( @contents['info']['piece length'] - ( @carry_over ? @carry_over.length : 0 ) ) ) do\n if @carry_over\n piece = @carry_over + piece\n @carry_over = nil\n end\n if piece.length < @contents['info']['piece length']\n @carry_over = piece\n else\n @contents['info']['pieces'] << Digest::SHA1.digest( piece )\n end\n end\n @contents['info']['files'] << {\n 'path' => [ path, File.basename( file ) ].flatten,\n 'length' => file_io.pos\n }\n end\n self\n end", "def initialize(hash)\n @file = hash.fetch(:file) { fail InvalidFile }\n @major = hash.fetch(:major) { fail InvalidFile }\n @minor = hash.fetch(:minor) { fail InvalidFile }\n @patch = hash.fetch(:patch) { fail InvalidFile }\n @special = hash.fetch(:special) { fail InvalidFile }\n @metadata = hash.fetch(:metadata) { fail InvalidFile }\n validate\n end", "def files_hash\n @files_hash\n end", "def file_field(method, options = T.unsafe(nil)); end" ]
[ "0.64729065", "0.6364296", "0.6325907", "0.6279384", "0.6247734", "0.6226727", "0.61595744", "0.6123822", "0.60323095", "0.60049224", "0.5966486", "0.595585", "0.59557825", "0.59490746", "0.5922426", "0.58755106", "0.58542365", "0.58368963", "0.5832685", "0.578687", "0.5786576", "0.5781915", "0.57264984", "0.57240725", "0.5711989", "0.57011724", "0.5700539", "0.56361985", "0.56221676", "0.5607175", "0.5563436", "0.55307585", "0.5484814", "0.54796064", "0.5459938", "0.5449517", "0.5449517", "0.5445907", "0.5445907", "0.544161", "0.5440421", "0.54349536", "0.5431923", "0.5413727", "0.5407352", "0.5398169", "0.539716", "0.5390339", "0.5375912", "0.5369144", "0.5363491", "0.53625464", "0.5354078", "0.5345141", "0.5342165", "0.5339964", "0.5330723", "0.5321704", "0.5320745", "0.53203833", "0.53094006", "0.53068995", "0.53042036", "0.53042036", "0.53042036", "0.53042036", "0.53042036", "0.53042036", "0.53042036", "0.52941144", "0.5294043", "0.5291385", "0.5286302", "0.52818584", "0.5281318", "0.52750903", "0.52744013", "0.5271972", "0.5240642", "0.52378666", "0.52279884", "0.52245694", "0.5219934", "0.5217822", "0.5217056", "0.5215348", "0.5210964", "0.52078974", "0.5207705", "0.52037644", "0.520355", "0.5193219", "0.51925194", "0.5180724", "0.51739717", "0.5171028", "0.5169094", "0.5165607", "0.5162781", "0.51619333" ]
0.64585716
1
N Without this, it's more work to output the description of this object
def inspect #N Without this output, we won't know what class it belongs to or what the relative path and file content hash is return "RelativePathWithHash[#{relativePath}, #{hash}]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inspect\n \"#{self.class}<#{@description.inspect}>\"\n end", "def inspect\n \"#<#{self.class.name}: #{to_s}>\"\n end", "def inspect\n \"#<#{self.class} @label=#{label} docs=#{docs}>\"\n end", "def inspect()\n #This is a stub, used for indexing\n end", "def inspect\n \"#<#{self.class.name}: #{to_s}>\"\n end", "def desc; end", "def inspect\n\t\treturn \"#<%s:0x%0x %s(%s) %p -> %p >\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.name,\n\t\t\tself.oid,\n\t\t\tself.desc,\n\t\t\tself.attr_oids,\n\t\t]\n\tend", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect\n result = \"#{self.class}[\"\n each_with_index { |obj, i| result << ', ' if i > 0; result << obj.inspect }\n result << \"]\"\n end", "def inspect\n return \"#<#{self.class.name}: #{self}>\"\n end", "def inspect\n \"#<#{self.class.inspect}(#{@name})>\"\n end", "def inspect\n return \"#<#{self.class.name}: #{self.name}>\"\n end", "def inspect\n end", "def inspect\n end", "def inspect\n self.to_s\n end", "def inspect\n self.to_s\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def inspect\n end", "def formatted_info\n \"#{self.name} - #{self.description}\"\n end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def inspect\n # Concise to not dump too much information on the dev\n \"#<#{self.class.name}>\"\n end", "def inspect\n \"#<#{self.class} #{self}>\"\n end", "def object_nl()\n #This is a stub, used for indexing\n end", "def inspect\n \"#<#{ self.class.name } (#{ length } x #{ document_class.name })>\"\n end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def to_s; description end", "def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{@obj.getName}>\"\n end", "def base_description(_); end", "def inspect\n +\"#<#{self.class}:#{object_id.to_s(16)}>\"\n end", "def inspect\n return self.to_s\n end", "def insp\r\n self.inspect\r\n end", "def desc() summary; end", "def inspect\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n \"#<#{self}>\"\n end", "def inspect\n sprintf(\"#<%s:%#0x(%s)>\", self.class.name, __id__, count.to_s)\n end", "def inspect(*) end" ]
[ "0.72545236", "0.7052086", "0.7047996", "0.7016574", "0.69726527", "0.6956438", "0.6951416", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.6930877", "0.68670595", "0.6865752", "0.6852827", "0.684724", "0.6844458", "0.6844458", "0.68306476", "0.68306476", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68228376", "0.68005", "0.67991686", "0.67991686", "0.67991686", "0.67991686", "0.67991686", "0.67991686", "0.67991686", "0.67991686", "0.67991686", "0.67991686", "0.6791311", "0.67816305", "0.6772328", "0.6764769", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6764722", "0.6751532", "0.672742", "0.671609", "0.66709876", "0.6647692", "0.6644665", "0.6634673", "0.6626431", "0.6616647", "0.6616647", "0.6616647", "0.6616647", "0.66140425", "0.659811", "0.6589224" ]
0.0
-1
N Without this we won't be able to construct the hash command object in a single expression (also there is no other way to set the readonly attributes)
def initialize(command, length, spacerLen) #N Without this we won't remember the command to execute (on each file) @command = command #N Without this we won't remember how long a hash value to expect from the output line @length = length #N Without this we won't remember how many space characters to expect in the output line between the file name and the hash value @spacerLen = spacerLen end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n self.class.hash ^ operand.hash\n end", "def hash=(_arg0); end", "def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end", "def hash\n expr.hash\n end", "def hash_for(expression)\n\n end", "def hash\n [name, operator, expanded].hash\n end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def initialize(hashCommand, pathPrefix = \"\")\n #N Without this, would not know the how to execute and parse the result of the hash command\n @hashCommand = hashCommand\n #N Without this, would not know how to execute 'find' if it's not on the path\n @pathPrefix = pathPrefix\n end", "def hash\n self.class.name.hash ^ @key.hash\n end", "def hash\n folder.hash ^ name.hash # eXclusive OR operator\n end", "def hash(*) end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end", "def hash\n self.class.hash ^ key_attributes.hash\n end", "def will_create_new_hash(**hash)\n hash[:x] = 10 # Change\n p hash\n p hash.object_id \nend", "def hash()\n #This is a stub, used for indexing\n end", "def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end", "def elevate_hash(hsh)\n # Commander::Command::Options stripped all of the methods from parent\n # objects. I have not nice thoughts about that.\n begin\n hsh = hsh.__hash__\n rescue NoMethodError\n # swallow this.\n end\n # build a hash where the default is 'false' instead of 'nil'\n Hash.new(false).merge(Hash.transform_keys_to_symbols(hsh))\n end", "def hash # :nodoc:\n identifier.hash ^ requirement.hash\n end", "def hexdigest!()\n #This is a stub, used for indexing\n end", "def hash\n super ^ number.hash\n end", "def command\n\n h.fields['__command__']\n end", "def hash!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n type = HASH\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 157:8: '#'\n match( 0x23 )\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__, 23 )\n\n end", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def hash()\n #This is a stub, used for indexing\nend", "def execute(command, opts = T.unsafe(nil), command_hash = T.unsafe(nil)); end", "def evalsha(*args); end", "def evalsha(*args); end", "def hash *args, &block\n command \"hash\", args.join(\"/\"), &block\n end", "def process_hash(exp)\n kv_list = exp\n raise if kv_list.length % 2 != 0 \n\n args = \n without_result do\n want_expression do\n kv_list.map {|i| process(i)}.join(\",\")\n end\n end\n\n str = @model.lookup_constant('::Hash') + \".\"\n if kv_list.empty?\n # empty Hash\n @model.add_method_call(m = @model.encode_method(\"new\"))\n str << \"#{m}()\" \n else\n @model.add_method_call(m = @model.encode_method(\"new_from_key_value_list\"))\n str << \"#{m}(#{@model.encode_nil},#{args})\" \n end\n\n exp.clear\n\n return str\n end", "def initialize(hash)\n @hash = hash.dup\n @escape_asterisks = [email protected](:*)\n end", "def sha1=(_); end", "def read_command(command)\n Patriot::Command::COMMON_ATTRIBUTES.each do |attr|\n value = command.instance_variable_get(\"@#{attr}\".to_sym)\n self[attr] = _to_stdobj(value) unless value.nil?\n end\n _to_stdobj(command).each{|k,v| self[k] = v}\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash_method\n super\n end", "def _key(*args); args.hash; end", "def hash(sexp, level)\n \"$hash(#{sexp.map { |p| process p, :expression }.join ', '})\"\n end", "def __hash\n @hash\n end", "def digest!()\n #This is a stub, used for indexing\n end", "def command\n attributes.fetch(:command)\n end", "def command\n attributes.fetch(:command)\n end", "def hash\n hash_args.hash\n end", "def rehash\n @system_commands = {}\n end", "def command(index, &block)\n if index.is_a? Command\n cmd = index\n else\n cmd = Command.new\n cmd.index= index\n cmd.instance_eval(&block)\n end\n @commands = {} unless @commands\n @flags = [] unless @flags\n if cmd.flags?\n @flags << cmd.flags.short if cmd.flags.short?\n @flags << cmd.flags.long if cmd.flags.long?\n elsif cmd.index # just use index\n @flags << cmd.index.to_s\n else\n raise \"No index or flags were given to use this command.\"\n end\n if cmd.options?\n cmd.options.each do |_, option|\n if option.flags?\n @flags << option.flags.short if option.flags.short?\n @flags << option.flags.long if option.flags.long?\n else # just use index\n @flags << option.index.to_s\n end\n @commands[option.index] = option\n end\n end\n @commands[cmd.index] = cmd\n cmd\n end", "def token_hash=(_arg0); end", "def hash_length\n super\n end", "def validate_hashes\n super unless BYPASS_COMMANDS.include?(command)\n end", "def formulate_command\n @command\n end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend", "def incoming_command_hasher=(hasher)\n @in_command_hasher = hasher\n end", "def sha512; end", "def hash(key); end", "def hash(*args, **_arg1, &block); end", "def crypto_hash(name, digest_class)\n digest_length = digest_class.digest('').length\n\n defines = Proc.new do \n define_method :\"#{name}\" do |data|\n data = data.pack 'C*' unless data.kind_of? String\n digest_class.digest(data).unpack 'C*'\n end\n define_method(:\"#{name}_digest_class\") { digest_class }\n define_method(:\"#{name}_length\") { digest_length }\n end\n \n @target.class_eval(&defines)\n (class << @target; self; end).module_eval(&defines) \n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n to_h.hash ^ self.class.hash\n end", "def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def method_missing(cmd, *args)\n if cmd.to_s[-1,1] == '='\n @attrs[cmd.to_s[0...-1].to_sym] = args.first\n else\n @attrs[cmd.to_sym]\n end\n end", "def set_secret_hash(opts = {})\n unless ['md5', 'sha512', nil].include?(opts[:value])\n raise ArgumentError, 'secret hash must be md5 or sha512'\n end\n cmd = command_builder(\"secret hash #{opts[:value]}\")\n cmds = ['management defaults', cmd]\n configure(cmds)\n end", "def hash\n [_hash, name, owner].hash\n end", "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[command data]\n end", "def hash\n model.hash + key.hash\n end", "def hash\n name.hash ^ provider.hash\n end", "def hash() source.hash ^ (target.hash+1); end", "def hash() source.hash ^ (target.hash+1); end", "def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend", "def target= exp\n expect :call, :attrasgn, :safe_call, :safe_attrasgn\n @my_hash_value = nil\n self[1] = exp\n end", "def key=(_arg0); end", "def key=(_arg0); end", "def key=(_arg0); end", "def clone\n Chord::new self.to_hash\n end", "def rehash() end", "def hash\n @hash || calculate_hash!\n end", "def attr(symbol, writable=false) end", "def readonly(*syms)\nreturn if syms.size == 0 # If no arguments, do nothing\ncode = \"\"\n# Start with an empty string of code\n# Generate a string of Ruby code to define attribute reader methods.\n# Notice how the symbol is interpolated into the string of code.\nsyms.each do |s|\n# For each symbol\ncode << \"def #{s}; @#{s}; end\\n\"\n# The method definition\nend\n# Finally, class_eval the generated code to create instance method\nclass_eval code\nend", "def command\n @attributes['command']\n end", "def raw_hash\n @raw_hash ||= raw_hash_with_cycles[:block]\n end", "def digest_command(command:, cutoff: nil)\n \"#{command} | #{@run} digest#{\" cutoff #{cutoff}\" if cutoff}\"\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def test_nonequal_hash\n chain = \"Person1<Person2(360):Person3<Person4(930)\"\n block = Blockchain.new(0,0,chain, 1.5,\"ch77\")\n block.setHash(\"m1p0\")\n\n assert_equal(0, block.check_curr())\n end" ]
[ "0.63045603", "0.61514795", "0.59913", "0.59377694", "0.58837736", "0.58124214", "0.57262135", "0.57143325", "0.56628305", "0.56608355", "0.56062055", "0.5605712", "0.5605712", "0.5605712", "0.5605712", "0.5605712", "0.5605712", "0.5605712", "0.55969113", "0.5593327", "0.5589129", "0.55720377", "0.55518043", "0.55266863", "0.5515148", "0.5509256", "0.5503671", "0.55024827", "0.54798377", "0.5476403", "0.54236674", "0.54156256", "0.54141337", "0.5410972", "0.5410972", "0.5400299", "0.535828", "0.5354411", "0.5351094", "0.53256637", "0.5313012", "0.53127724", "0.5310839", "0.53101176", "0.5308196", "0.5283439", "0.5283418", "0.5283418", "0.5278478", "0.5265631", "0.52642196", "0.526417", "0.5250386", "0.5247031", "0.5243372", "0.52400666", "0.5240055", "0.5224405", "0.5218658", "0.5206389", "0.5201108", "0.5199966", "0.5199966", "0.5199966", "0.51974547", "0.51974547", "0.51974547", "0.51974547", "0.51974547", "0.51974547", "0.51974547", "0.51974547", "0.51974547", "0.51974547", "0.5188279", "0.51858395", "0.5183612", "0.51825297", "0.5182352", "0.5179225", "0.5173492", "0.5167023", "0.5161872", "0.51563776", "0.51563776", "0.51555884", "0.5154788", "0.5153948", "0.5153948", "0.5153948", "0.5137358", "0.5134579", "0.5126174", "0.5125064", "0.5122979", "0.5119743", "0.51167023", "0.51160616", "0.51090693", "0.51084095" ]
0.5271131
49
Parse a hash line relative to a base directory, returning a RelativePathWithHash N Without this method, we won't know how to parse the line of output from the hash command applied to the file
def parseFileHashLine(baseDir, fileHashLine) #N Without this we won't get the hash line from the last <length> characters of the output line hash = fileHashLine[0...length] #N Without this we won't read the full file path from the output line preceding the spacer and the hash value fullPath = fileHashLine[(length + spacerLen)..-1] #N Without checking that the full path matches the base directory, we would fail to make this redundant check that the remote system has applied to the hash to the file we expected it to be applied to if fullPath.start_with?(baseDir) #N If we won't return this, we will fail to return the object representing the relative path & hash. return RelativePathWithHash.new(fullPath[baseDir.length..-1], hash) else #N If we don't raise this error (which hopefully won't ever happen anyway), there won't be any sensible value we can return from this method raise "File #{fullPath} from hash line is not in base dir #{baseDir}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listFileHashLines(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this, we wouldn't know what command to run remotely to loop over the output of the file-files command and run the hash command on each line of output\n remoteFileHashLinesCommand = findFilesCommand(baseDir) + [\"|\", \"xargs\", \"-r\"] + @hashCommand.command\n #N Without this we wouldn't actually run the command just defined\n ssh(remoteFileHashLinesCommand.join(\" \")) do |line| \n #N Without this the line of output wouldn't be echoed to the user\n puts \" #{line}\"\n #N Without this the line of output (with a file name and a hash value) wouldn't be available to the caller of this method\n yield line \n end\n end", "def relative_path(line)\n line = line.sub(relative_path_regex, \"\\\\1.\\\\2\".freeze)\n line = line.sub(/\\A([^:]+:\\d+)$/, '\\\\1'.freeze)\n return nil if line == '-e:1'.freeze\n line\n rescue SecurityError\n nil\n end", "def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end", "def initialize(relativePath, hash)\n #N Without this, we won't rememeber the relative path value\n @relativePath = relativePath\n #N Without this, we won't remember the file's cryptographic hash of its contents\n @hash = hash\n end", "def rev_parse # :nodoc:\n hash = nil\n\n Dir.chdir repo_cache_dir do\n hash = Gem::Util.popen(@git, 'rev-parse', @reference).strip\n end\n\n raise Gem::Exception,\n \"unable to find reference #{@reference} in #{@repository}\" unless\n $?.success?\n\n hash\n end", "def line_uri\n branch.commit_uri.chomp(\"commit/$commit\")\n end", "def short_hash_id(hash_id)\n out = Temppath.create.open(\"w+\")\n\n # git rev-parse\n process = ChildProcess.build(\"git\", \"rev-parse\", \"--short\", hash_id)\n process.cwd = local.path.to_s\n process.io.stdout = out\n process.start\n process.wait\n\n # check the process result\n if process.crashed?\n raise GitError.new(self, message: \"Hash ID '%s' is unknown or too short\" % hash_id)\n end\n\n # show debug message\n out.rewind\n return out.read.chomp\n end", "def get_entry_hash(path, commit = @commit)\n if path.start_with?(File::SEPARATOR) # transform from absolute to relative\n path = path[1..-1]\n end\n if path == '' # root Tree\n entry_hash = { name: path, oid: commit.tree_id, type: :tree, filemode: 0 } # mimic Tree#path output\n else # Tree or Blob\n begin\n entry_hash = commit.tree.path(path)\n rescue Rugged::TreeError # path not valid\n entry_hash = nil\n end\n end\n entry_hash\n end", "def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end", "def hash\n @relative_name.hash\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 hash\n return (path + file_id.to_s).hash\n end", "def path\n return nil if self.hash_string.blank?\n File.join(*self.hash_string.scan(/(.)(.)(.*)/).flatten)\n end", "def relative_working_dir\n invoke(:rev_parse, '--show-prefix')\n end", "def relative_path_from(entry)\n @path.relative_path_from(entry.path)\n end", "def hash\n path.hash\n end", "def uri_hash # :nodoc:\n normalized =\n if @repository =~ %r%^\\w+://(\\w+@)?% then\n uri = URI(@repository).normalize.to_s.sub %r%/$%,''\n uri.sub(/\\A(\\w+)/) { $1.downcase }\n else\n @repository\n end\n\n Digest::SHA1.hexdigest normalized\n end", "def get_path(sha1)\n sha1[0...2] + '/' + sha1[2..40]\n end", "def listFileHashes(baseDir)\n #N Un-normalised, an off-by-one error would occur when 'subtracting' the base dir off the full paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this, we would have nowhere to accumulate the file hash objects\n fileHashes = []\n #N Without this, we would not be executing and parsing the results of the file-listing command\n listFileHashLines(baseDir) do |fileHashLine|\n #N Without this, we would not be parsing the result line containing this file and its hash value\n fileHash = self.hashCommand.parseFileHashLine(baseDir, fileHashLine)\n #N Without this check we would be accumulating spurious nil values returned from listFileHashLines (even though listFileHashLines doesn't actually do that)\n if fileHash != nil\n #N Without this, we would fail to include this file & hash in the list of file hashes.\n fileHashes << fileHash\n end\n end\n return fileHashes\n end", "def uri_hash # :nodoc:\n require_relative '../openssl'\n\n normalized =\n if @repository =~ %r{^\\w+://(\\w+@)?}\n uri = URI(@repository).normalize.to_s.sub %r{/$},''\n uri.sub(/\\A(\\w+)/) { $1.downcase }\n else\n @repository\n end\n\n OpenSSL::Digest::SHA1.hexdigest normalized\n end", "def extract_commit_hash(commit)\n return commit.lines.first.strip!\nend", "def resolve_rev(hashish)\n hash = @git.rev_parse({:verify => true}, hashish)\n return nil if $?.exitstatus != 0\n return hash.strip\n end", "def path_from_sha1(sha1)\n raise NotImplementedError, 'Implemented in subclasses. See filesystem_pool for example.'\n end", "def initialize(hashCommand, pathPrefix = \"\")\n #N Without this, would not know the how to execute and parse the result of the hash command\n @hashCommand = hashCommand\n #N Without this, would not know how to execute 'find' if it's not on the path\n @pathPrefix = pathPrefix\n end", "def find_relative(uri, base, options)\n nil\n end", "def base_id\n\t\tbase_file = File.basename(sorted_files.first)\n\t\tif base_file =~ /^\\d+\\=.*\\+(.*)\\.zip$/\n\t\t\t$1\n\t\telse\n\t\t\traise RuntimeError, \"Malformed patch file #{base_file}.\"\n\t\tend\n\tend", "def commit_hash(branch_or_tag = nil)\n version = 'HEAD'\n working_dir do\n version = git 'rev-parse', branch_or_tag || 'HEAD'\n end\n version.strip\n end", "def is_valid_hash(entry)\n\n return false if entry.nil?\n return false unless entry.parse_ok?\n\n last_line = _get_last_line(entry.pid)\n unless last_line.nil?\n computed_hash = ChainLog::Formatter.hash_str(last_line.chomp)\n entry.valid_chain = (computed_hash == entry.hash)\n\n if @verbose\n puts '\"' + last_line + '\"'\n puts computed_hash + \" vs #{entry.hash}\"\n end\n\n end\n\n # compute hash of this line for next call\n\n _set_last_line(entry.pid, entry.line)\n\n entry.valid_chain\n end", "def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end", "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 rev_parse # :nodoc:\n # HACK no safe equivalent of ` exists on 1.8.7\n Dir.chdir repo_cache_dir do\n Gem::Util.popen(@git, 'rev-parse', @reference).strip\n end\n end", "def sha1\n RunLoop::Directory.directory_digest(path)\n end", "def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end", "def path_to_sha(path, head=@current_branch)\n # Return the root of the repo if no path is specified\n return root_sha(head) if (not path) || (path.empty?)\n\n if staging?\n @staging_index.sync\n head = @staging_index.current_tree.id\n end\n\n dir = tree(head, [path])\n (dir && dir.contents.length > 0) ? dir.contents.first.id : nil\n end", "def hash(block, stored_hash, hash_calc, block_check, line)\r\n return 'Block empty' if block.nil?\r\n\r\n # calculate hash value for line\r\n error = \"Line #{line}: Invalid hash set to #{stored_hash.strip}\"\r\n\r\n # if hash stored as with capital letters, return error\r\n stored_hash = stored_hash.strip # get rid of trailing white space\r\n int_hash = stored_hash.to_i(16) # get stored hash and convert to decimal\r\n # check lenght of stored hash(max4)...may be optiaml to place elsewhere\r\n return error + \"\\nHash length is too big\" if stored_hash.size >= 5\r\n\r\n # check hash for leading 0's\r\n return error + \"\\nHash contains leading zeros\" if stored_hash[0] == '0' && stored_hash.size > 1\r\n\r\n # check to make sure value is valid hex values\r\n return error + \"\\nInvalid hex value, must be lowercase and from 0-f\" unless block_check.check_hex(stored_hash)\r\n\r\n # see if calculated hash and stored has match\r\n hash = block_check.get_hash(block, hash_calc) # get hash value\r\n # removes last hash from string\r\n output_string = block_check.parse(block, '|' + stored_hash)\r\n error_two = \"Line #{line}: String '#{output_string[0]}' hash set to #{stored_hash.strip},\"\\\r\n \"should be #{hash.to_s(16)}\"\r\n return error_two unless block_check.check_hash(hash, int_hash)\r\n\r\n nil\r\n end", "def parse_commit_line!(commit_line)\n # Parse the full commit line\n line_parts = commit_line.split(\"\\t\")\n sha = line_parts.fetch(0)\n message = line_parts.fetch(1)\n author = line_parts.fetch(2)\n date = Time.parse(line_parts.fetch(3))\n message_data = parse_commit_message!(message)\n pr_number = message_data.fetch(\"pr_number\")\n\n attributes =\n {\n \"sha\" => sha,\n \"message\" => message,\n \"author\" => author,\n \"date\" => date,\n \"pr_number\" => pr_number\n }\n\n # Parse the stats\n stats = get_commit_stats(attributes.fetch(\"sha\"))\n if /^\\W*\\p{Digit}+ files? changed,/.match(stats)\n stats_attributes = parse_commit_stats!(stats)\n attributes.merge!(stats_attributes)\n end\n\n attributes\nend", "def line_to_github_url(file_path, line_str)\n return nil unless file_url = url_for(file_path)\n project_url = file_url.sub(%r{/blob/.*/#{File.basename(file_path)}$}, '')\n commit = git.find_commit_with_line(line_str)\n return nil unless commit\n file_index = commit.file_paths.index(git.relative_file(file_path))\n \"#{project_url}/commit/#{commit.to_s}#diff-#{file_index}\"\n end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end", "def make_relative_uri(hash={})\n @urigen.make_relative_uri(hash)\n end", "def file() = pathname.relative_path_from(Cnfs.config.paths.definitions)", "def read_head_id\n if File.exists?(head_path)\n File.read(head_path).strip\n elsif File.exists?(\"#{path}/packed-refs\")\n File.open(\"#{path}/packed-refs\", 'rb') do |io|\n while line = io.gets\n line.strip!\n next if line[0..0] == '#'\n line = line.split(' ')\n return line[0] if line[1] == \"refs/heads/#{branch}\"\n end\n end\n end\n end", "def raw_gitdir\n\t\t\twith_dir do\n\t\t\t\treturn Pathname.new(%x/git rev-parse --git-dir/.chomp)\n\t\t\tend\n\t\tend", "def hexdigest\n self.class.hexdigest_for(path)\n end", "def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend", "def relative_path\n @relative_path ||= PathManager.join(@dir, @name).delete_prefix(\"/\")\n end", "def get_sha1(path)\n return @cache_sha1 unless @cache_sha1.nil?\n sha1 = \"\"\n if File.exist?(path)\n Dir.chdir(path) do\n sha1 = %x(git rev-parse HEAD).delete(\"\\n\")\n end\n end\n\n @cache_sha1 = sha1\n sha1\n end", "def relative_path\n @relative_path ||= File.join(@dir, @name)\n end", "def relative_path(path)\n path[self.prefix.size..-1].gsub(%r{^/}, '').tap do |pth|\n #puts \"self.prefix=#{self.prefix}, path=#{path}, result=#{pth}\"\n end\n end", "def git_sha_for(path)\n website.git_repository.git_sha path\n end", "def _relative(root) # :nodoc:\n return self unless root\n HRX::File._new_without_checks(HRX::Util.relative(root, path), content, comment)\n end", "def hash(pathname)\n ext = pathname.extname\n ext = ('' == ext || nil == ext) ? :none : ext.to_sym\n digest = Digest::MD5.hexdigest(File.read(pathname.to_s))\n @scanned[ext] ||= {}\n @scanned[ext][digest] ||= []\n @scanned[ext][digest] << pathname\n end", "def hash_file path, hash_store\r\n\thexdigest = HASH_DIGEST.hexdigest(open(path, 'rb') { |io| io.read })\r\n\thash_store[hexdigest] << path\r\nend", "def relative_path_from(from); end", "def digest_dirname(file_path)\n slash_path(File.dirname(file_path)).sub(slash_path(source.path), \"\")\n end", "def split_relative_url(relative_url)\n relative_url.match(%r{^/([^/#]+)(.*?)$}).to_a\n end", "def sha\n result_hash['sha']\n end", "def get_tree_sha(dir)\n get_trees['tree'].find { |t| t['path'] == dir }['sha']\n end", "def relative_path\n @relative_path ||= absolute_path.sub(/^#{Bookshelf::remote_folder}\\/?/,'')\n end", "def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end", "def relative_path\n @relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).delete_prefix(\"/\")\n end", "def get_checksums(commit)\n # Reset @currenthash\n @currenthash = Hash.new\n path = find_relative_git_cookbook_path\n #puts \"path is '#{path}' commit hash is #{commit}\"\n #puts \"commit.tree is #{commit.tree}\"\n unless path == '.'\n tree = commit.tree / path\n git_checksum_hash(tree)\n else\n git_checksum_hash(commit.tree)\n end\n end", "def parseRevision()\r\n pieces=@complete_rev.split(\".\")\r\n @revision=pieces.last.to_i\r\n baseSize=1\r\n baseSize+=(pieces.size/2)\r\n @base=pieces[0..-baseSize].join(\".\")\r\n if baseSize > 2\r\n @branchid=pieces[-2]\r\n end \r\n end", "def hash\n @path.hash\n end", "def commit_hash(branch_or_tag = nil)\n git 'rev-parse', branch_or_tag || 'HEAD'\n end", "def full_digest_path\n File.join(@load_path, digest_path)\n end", "def relative_path path, base\n (root? path) && (offset = descends_from? path, base) ? (path.slice offset, path.length) : path\n end", "def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end", "def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end", "def dirHash(directory, regexp)\n directory = Pathname.new(directory)\n contents = \"\"\n Dir.foreach(directory) {\n | entry |\n if entry =~ regexp\n contents += IO::read(directory + entry)\n end\n }\n return Digest::SHA1.hexdigest(contents)\nend", "def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, type) = info.split\n hsh[file] = {:path => file, :mode_file => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_file => sha_src, :sha_index => sha_dest, :type => type}\n end\n hsh\n end", "def rel_path(file)\n File.dirname(file)\n end", "def file_and_line\n path, line = *@proc.inspect.match(PROC_PATTERN)[1..2]\n path = File.expand_path(path)\n pwd = File.expand_path(PWD)\n if path.index(pwd)\n path = path[pwd.length+1..-1]\n elsif path =~ /.*\\/gems\\/(.*\\.rb)$/\n path = $1\n end\n [path, line.to_i]\n end", "def relative_pathname\n @relative_pathname ||= Pathname.new(relativize_root_path(pathname))\n end", "def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, status) = info.split\n hsh[file] = {:path => file, :mode_repo => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_repo => sha_src, :sha_index => sha_dest, :status => status}\n end\n hsh\n end", "def rev_parse(ref)\n commit = git \"rev-parse #{ref}^{commit}\", :path => @full_path\n commit.chomp\n rescue R10K::ExecutionFailure => e\n logger.error \"Could not resolve ref #{ref.inspect} for git repo #{@full_path}\"\n raise\n end", "def resolve_relative_path(path, base_path)\n p = Pathname(base_path)\n p = p.dirname unless p.extname.empty?\n p += path\n\n p.cleanpath.to_s\n end", "def selfHash\n dirHash(Pathname.new(__FILE__).dirname, /\\.rb$/)\nend", "def git_sha(length = 40)\n Pkg::Util.in_project_root do\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{GIT} rev-parse --short=#{length} HEAD\")\n stdout.strip\n end\n end", "def full_path(relative_filename)\n File.join(@mount_dir, relative_filename)\n end", "def hash\n\t\t\[email protected]\n\t\tend", "def relative_path(options = {})\n @relative_path ||= Pathname.new(filename).relative_path_from(Pathname.new(base)).to_s\n path_with_cache_buster(@relative_path, options)\n end", "def cleaned_relative_path; end", "def cleaned_relative_path; end", "def normalized_path(file); end", "def blob_path(relative = true)\n blob_path = File.join(self.class.name, hash.to_s)\n if relative\n blob_path\n else\n File.join(repository_path, blob_path)\n end\n end", "def pid_path\n #need to memoize this, becasuse the base path could be relative and the cwd can change in the yield block of wrap\n @path ||= File.join(pid_dir, pid_file)\n end", "def entry2hash(entry)\n hash = Hash.new('')\n entry.each_line do |line|\n tag = tag_get(line)\n next if tag == 'XX'\n tag = 'R' if tag =~ /^R./\t# Reference lines\n hash[tag] += line\n end\n return hash\n end", "def genhash(absolute_filename)\n HDB.debug and puts \"Absolute filename #{absolute_filename}\"\n if File.file?(absolute_filename)\n HDB.debug and puts \"Digesting\"\n hash = Digest::SHA512.new\n # Save atime\n PRESERVE_ATIME and atime = File.stat(absolute_filename).atime\n File.open(absolute_filename, 'r') do |fh|\n while buffer = fh.read(BUFSIZE)\n hash << buffer\n end\n end\n # Reset atime, preserve mtime\n PRESERVE_ATIME and File.utime(atime, File.stat(absolute_filename).mtime, absolute_filename)\n return hash.to_s\n else\n HDB.debug and puts \"Not a file\"\n return NAHASH\n end\n end", "def git_HEAD\n Dir.chdir(@dir) do\n commit = `git rev-parse HEAD`\n raise \"git rev-parse HEAD failed: #{$?.exitstatus}\" if $?.exitstatus != 0\n commit.chomp\n end\n end", "def parse_file\n IO.binread(@auth_log.file).split(\"\\n\").each { |line| build_block(line) }\n end", "def position(relative_to=nil)\n l = line()\n\n if l == 0\n if @ip < 0\n file(relative_to)\n else\n \"#{file(relative_to)}+#{@ip}\"\n end\n else\n \"#{file(relative_to)}:#{l}\"\n end\n end", "def digest_path\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{digest}#{ext}\" }\n end", "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def find_ancestor(left, right=nil)\n right ||= resolve_rev \"HEAD\"\n hash = @git.merge_base({}, left, right)\n return nil if $?.exitstatus != 0\n return hash.strip\n end", "def cleaned_relative_path\n @cleaned_relative_path ||=\n relative_path[0..-extname.length - 1]\n .sub(collection.relative_directory, \"\")\n .gsub(%r!\\.*\\z!, \"\")\n end", "def extract_heading(line)\n if line =~ /^(#+)\\s(.*)/\n prefix = $1\n title = $2\n depth = prefix.size\n anchor = \"#\" + title.\n downcase.\n gsub(/[\\/:]/,\"\"). # titles like \"/url/:id\" are transformed by Github into \"#urlid\" anchors\n gsub(/\\W+/,\"-\").gsub(/(\\d)\\-(\\d)/,\"\\\\1\\\\2\").\n gsub(/^\\-+/,\"\").\n gsub(/\\-+$/,\"\")\n\n [depth, title, anchor]\n end \nend", "def sha\n @sha ||= ENV['HEROKU_SLUG_COMMIT'] || ENV['GIT_SHA'] || `git rev-parse HEAD`.chomp\n end", "def initialize stat, location = nil\n @data = Hash.new\n @tags = nil\n if location\n begin\n IO.popen([\"sha256sum\", location]) do |io|\n @hash = io.read.split(' ')[0]\n end\n rescue Exception => e\n logger.error \"Can't hash #{location.inspect}: #{e}\"\n end\n @mimetype = MimeType.detect location\n @location = location\n @ctime = stat.ctime\n @mtime = stat.mtime\n @size = stat.size\n tags = location.split File::SEPARATOR\n tags.shift if tags[0].empty?\n @name = tags.pop\n @tags = tags\n else\n stdin\n end\n end", "def __build_path(entries)\n parts = entries[0][:path].split('/')\n parts.pop(entries[0][:chunks].length)\n parts.join('/') # stitch parts together to form a path\n end" ]
[ "0.5887747", "0.58208567", "0.5716864", "0.5669151", "0.56038135", "0.55389607", "0.5512642", "0.5444282", "0.54402876", "0.54324114", "0.54298586", "0.5364812", "0.5314956", "0.5281662", "0.5218624", "0.5170875", "0.51430035", "0.513666", "0.51208264", "0.5110224", "0.5104553", "0.50833374", "0.5072584", "0.507211", "0.50629944", "0.5038565", "0.5037477", "0.49845773", "0.4977956", "0.4976823", "0.4972369", "0.4967128", "0.49348772", "0.49314788", "0.49238828", "0.49206874", "0.4914244", "0.49120906", "0.49116245", "0.48759946", "0.48567033", "0.4839514", "0.4838601", "0.48249355", "0.48226887", "0.48217267", "0.48173642", "0.4816097", "0.4792131", "0.4772345", "0.4768451", "0.47638986", "0.47608817", "0.47586268", "0.4747804", "0.47432366", "0.47361425", "0.47265828", "0.4726374", "0.4718646", "0.4714909", "0.47044626", "0.4702622", "0.46895903", "0.46871427", "0.46825936", "0.46660545", "0.46619672", "0.4657167", "0.46510795", "0.46440086", "0.4641215", "0.4636098", "0.4632405", "0.46278334", "0.46184492", "0.46111384", "0.45995152", "0.4596666", "0.45944688", "0.45859328", "0.45854688", "0.45854688", "0.45829383", "0.45751706", "0.45751444", "0.4574648", "0.45703426", "0.4562579", "0.45592457", "0.45577517", "0.4554349", "0.45527062", "0.45527062", "0.45494434", "0.45474607", "0.45461833", "0.45444557", "0.45443484", "0.4539874" ]
0.79346603
0
N Without this, the default string value of the hash command object will be less indicative of what it is
def to_s #N Without this we won't see the command as a command and a list of arguments return command.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash=(_arg0); end", "def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash_length\n super\n end", "def default_hash_function(plain_token)\n ::Digest::SHA256.hexdigest plain_token\n end", "def hash\n 0\n end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end", "def outgoing_command_hasher=(hasher)\n @out_command_hasher = hasher\n end", "def hash\n super ^ number.hash\n end", "def incoming_command_hasher=(hasher)\n @in_command_hasher = hasher\n end", "def hash(*) end", "def sha1=(_); end", "def hash\n self.class.name.hash ^ @key.hash\n end", "def initialize(hashCommand, pathPrefix = \"\")\n #N Without this, would not know the how to execute and parse the result of the hash command\n @hashCommand = hashCommand\n #N Without this, would not know how to execute 'find' if it's not on the path\n @pathPrefix = pathPrefix\n end", "def hash()\n #This is a stub, used for indexing\n end", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def rehash\n @system_commands = {}\n end", "def hash_method\n super\n end", "def command_name; end", "def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end", "def command\n\n h.fields['__command__']\n end", "def hash\n guid.hash\n end", "def hash_code; end", "def hash\n name.hash ^ version.hash\n end", "def hash\n name.hash ^ provider.hash\n end", "def command_name(name = T.unsafe(nil)); end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def hash_key\n send(self.class.hash_key)\n end", "def hash_key\n send(self.class.hash_key)\n end", "def digest\n Digest::SHA1.hexdigest(self)\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash\n self.class.hash ^ operand.hash\n end", "def initialize(command, length, spacerLen)\n #N Without this we won't remember the command to execute (on each file)\n @command = command\n #N Without this we won't remember how long a hash value to expect from the output line\n @length = length\n #N Without this we won't remember how many space characters to expect in the output line between the file name and the hash value\n @spacerLen = spacerLen\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def default_command(command)\n @@default_command = command.to_sym\n end", "def hash *args, &block\n command \"hash\", args.join(\"/\"), &block\n end", "def rehash\n raw \"REHASH\\r\\n\"\n end", "def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end", "def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end", "def hash\n swap\n scatter\n completed_string\n end", "def command_name=(_arg0); end", "def hash99999\n return nil unless @parts\n\n k = construct\n return nil unless k\n\n Digest::SHA256.hexdigest(construct[0..-6] << '99999')[0..23]\n end", "def hash_key(key, options = T.unsafe(nil)); end", "def short_sha\n self.sha[0..6]\n end", "def shortsha(n = 7)\n @sha.slice(0,n)\n end", "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[command data]\n end", "def sha\n result_hash['sha']\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def sha1; end", "def sha1; end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def hash(key); end", "def __hash\n @hash\n end", "def generate_hash_token\n\t\t\tbegin\n\t\t\t\tself.hash_token = (0...5).map { (65 + rand(26)).chr }.join\n\t\t\tend while self.class.exists?(hash_token: hash_token)\n\t\tend", "def validate_hashes\n super unless BYPASS_COMMANDS.include?(command)\n end", "def hash\n hash_args.hash\n end", "def hash\n @string.hash\n end", "def hash\n @string.hash\n end", "def hash\n @string.hash\n end", "def hash\n @hash || calculate_hash!\n end", "def hash\n folder.hash ^ name.hash # eXclusive OR operator\n end", "def call_hash\n raise NotImplementedException.new(\"Must implement call_hash\")\n end", "def test_nonequal_hash\n chain = \"Person1<Person2(360):Person3<Person4(930)\"\n block = Blockchain.new(0,0,chain, 1.5,\"ch77\")\n block.setHash(\"m1p0\")\n\n assert_equal(0, block.check_curr())\n end", "def test_hash_empty_string\n knot = KnotHash.new\n assert_equal \"a2582a3a0e66e6e86e3812dcb672a272\", knot.hash('')\n end", "def token_hash=(_arg0); end", "def quick_command\n @raw[0] || \"\"\n end", "def version_guid\n \"#{digest_type}:#{checksum}\"\n end", "def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\n end", "def hexdigest!()\n #This is a stub, used for indexing\n end", "def hash\n [_hash, name, owner].hash\n end", "def sha1?; @sha1; end", "def hash\r\n @_hash ||= _hash\r\n end", "def hash\n if @_hash.nil?\n @_hash = {}\n run\n end\n @_hash\n end", "def hash_function_label\n hash_function.nil? ? '' : HASH_FUNCTION_LABELS[ hash_function ]\n end", "def command_string\n\t\treturn datastore['CMD'] || ''\n\tend", "def execute(command, opts = T.unsafe(nil), command_hash = T.unsafe(nil)); end", "def hash()\n #This is a stub, used for indexing\nend" ]
[ "0.6394411", "0.62673795", "0.61873937", "0.61873937", "0.61873937", "0.61873937", "0.61873937", "0.61873937", "0.61873937", "0.609414", "0.6066696", "0.6030287", "0.60247064", "0.6000437", "0.5975495", "0.59492004", "0.5910227", "0.5891778", "0.5850345", "0.58478415", "0.58421546", "0.5832453", "0.5808641", "0.5802443", "0.5802443", "0.5802443", "0.5802443", "0.5802443", "0.5802443", "0.5802443", "0.5802443", "0.5802443", "0.5802443", "0.5793403", "0.57849866", "0.57825637", "0.5781443", "0.57799476", "0.5771252", "0.5767477", "0.5765737", "0.5753492", "0.5741782", "0.5713045", "0.5709571", "0.5709571", "0.5674738", "0.5669444", "0.5669444", "0.56633526", "0.5660429", "0.5660429", "0.5660429", "0.5654936", "0.56507945", "0.56504697", "0.56497604", "0.56186324", "0.5595574", "0.55926496", "0.5592071", "0.55904496", "0.55881476", "0.5562373", "0.5556832", "0.55426615", "0.55173945", "0.5515539", "0.5514825", "0.5506126", "0.5506126", "0.5506126", "0.5505493", "0.5505493", "0.5503232", "0.5492402", "0.54904056", "0.54900956", "0.54873747", "0.54855084", "0.54787534", "0.54787534", "0.54787534", "0.5469606", "0.5468411", "0.54646754", "0.5458707", "0.5455381", "0.5454538", "0.5450348", "0.54449296", "0.5443348", "0.5441389", "0.54400426", "0.5439193", "0.54363734", "0.5432223", "0.54267275", "0.54207945", "0.5412069", "0.5404933" ]
0.0
-1
Put "/" at the end of a directory name if it is not already there. N Without this method, we will constantly be testing if directory paths have '/' at the end and adding it if it doesn't
def normalisedDir(baseDir) return baseDir.end_with?("/") ? baseDir : baseDir + "/" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_directory(dir)\n format_dir = dir.strip\n format_dir = \"/#{format_dir}\" unless format_dir.start_with?('/')\n format_dir\nend", "def build_dir_path(dir_path)\r\n dir_builder = \"\"\r\n dir_path.split(\"/\").each { |dir|\r\n unless Dir.exists?(dir_builder + dir)\r\n Dir.mkdir(dir_builder + dir)\r\n end\r\n dir_builder += dir + \"/\"\r\n }\r\n end", "def rewrite_path # :nodoc:\n if uri.path[0] != ?/\n prepend_path File.join('/', options[:dir].to_s)\n end\n end", "def add_directory(directories, path)\n target = Pathname(path).each_filename.to_a.first\n if directories.select{|s| Pathname(s).each_filename.to_a.first == target}.empty?\n directories << path\n end\n end", "def fix_dir(dir)\n (dir.nil? || dir.empty?) && '/' || dir\n end", "def subdir(dir)\n dir = Pathname.new(dir) if dir.instance_of? String\n dir = Pathname.new('.') if dir.to_s =~ /\\.\\./ or dir.to_s =~ /^\\//\n dir = Pathname.new('.') if any_symlinks_in dir\n newdir = @path + dir\n Filesystem.new newdir\n end", "def directoryname\n new_parts = @parts[0..-2]\n new_parts[0] = absolute_prefix + new_parts[0]\n FilePath.new(*new_parts).to_s\n end", "def path_name\n str = name.dup\n str << '/' if is_dir\n str = parent.path_name + str if parent\n str\n end", "def cleanpath\n names = []\n split('/').each do |name|\n case name\n when '..'\n names.pop\n when '.'\n when ''\n else\n names.push name\n end\n end\n names.join('/')\n end", "def set_directory(path)\n if File.exists? path and File.directory? path\n @directory = path.reverse.index(\"/\") == 0 ? path.chop : path\n else\n raise Error, \"Invalid path name\"\n end \n end", "def dir_name string\n string.split('/')[0..-2].join('/')\nend", "def add_base_dir(name, base_dir_string)\n if name.to_s !~ BASE_DIR_NAME_REGEX\n raise ArgumentError.new(\"A base dir name must match this regex: #{ BASE_DIR_NAME_REGEX.inspect }\")\n end\n # guarantee trailing slash\n bd = base_dir_string.to_s.gsub(/\\/\\z/, '') + '/'\n @base_dirs[name.to_sym] = bd\n end", "def ensure_url_ends_with_slash(url)\n return \"#{url}/\" unless url.end_with?(\"/\")\n\n return url\n end", "def rewrite_base_path(path) # :nodoc:\n if path !~ %r(^/)\n File.join('/', dir, path)\n else\n path\n end\n end", "def simplify_path(str)\n directory_names = str.split('/')\n stack = Stack.new\n\n directory_names.each do |name|\n next if name == '.' || name.empty?\n next stack.pop if name == '..'\n stack.push(\"/#{name}\")\n end\n\n result = ''\n until stack.empty?\n result.prepend(stack.pop || '')\n end\n result == '' ? '/' : result\nend", "def subdirs_to_create(dir, user)\n Chef::Log.info(\"Dir to create: #{dir}, user: #{user}\")\n existing_subdirs = []\n remaining_subdirs = dir.split('/')\n remaining_subdirs.shift # get rid of '/'\n\n until remaining_subdirs.empty?\n Chef::Log.debug(\"remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}\")\n path = existing_subdirs.push('/' + remaining_subdirs.shift).join\n break unless File.exist?(path)\n raise \"Path #{path} exists and is a file, expecting directory.\" unless File.directory?(path)\n raise \"Directory #{path} exists but is not traversable by #{user}.\" unless can_traverse?(user, path)\n end\n\n new_dirs = [existing_subdirs.join]\n new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty?\n new_dirs\n end", "def eponymous_directory_path\n path.sub(ext, '/').sub(/\\/$/, '') + '/'\n end", "def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end", "def cleanpath_aggressive\n # cleanpath_aggressive assumes:\n # * no symlink\n # * all pathname prefix contained in the pathname is existing directory\n return Path::Name.create([],@absolute,@trail) if path.empty?\n absolute = absolute?\n trail = trail?\n names = []\n @path.each {|name|\n next if name == '.'\n if name == '..'\n if names.empty?\n next if absolute\n else\n if names.last != '..'\n names.pop\n next\n end\n end\n end\n names << name\n }\n return Path::Name.new(absolute ? '/' : '.') if names.empty?\n #path = []\n #path << '' if absolute\n #path.concat(names)\n Path::Name.create(names, absolute) #, trail)\n end", "def append_to_home_if_not_absolute( p )\n path = Pathname.new( p )\n unless path.absolute? then\n path = Pathname.new( home_dir ) + path\n end\n return path.to_s\n end", "def clean_path(directory)\n directory.gsub(/\\/\\//, '/')\n end", "def checkDir(s)\n gracefulExit(\"#{s} is not a valid directory.\") if !File.directory?(s || \"\")\n if s.include? \"\\\\\" then\n s << \"\\\\\" unless s[s.length-1] == \"\\\\\" #we are using windows\n else\n s << \"/\" unless s[s.length-1] == \"/\" #we are using linux\n end\n debugLog(\"input directory #{s} is OK\")\n s\nend", "def subdirs_to_create(dir, user)\n Chef::Log.debug(\"Dir to create: #{dir}, user: #{user}\")\n existing_subdirs = []\n remaining_subdirs = dir.split('/')\n remaining_subdirs.shift # get rid of '/'\n reason = ''\n \n until remaining_subdirs.empty?\n Chef::Log.debug(\"remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}\")\n path = existing_subdirs.push('/' + remaining_subdirs.shift).join\n break unless File.exist?(path)\n reason = \"Path \\'#{path}\\' exists and is a file, expecting directory.\" unless File.directory?(path)\n reason = \"Directory \\'#{path}\\' exists but is not traversable by user \\'#{user}\\'.\" unless can_traverse?(user, path)\n end\n\n new_dirs = [existing_subdirs.join]\n new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty?\n [new_dirs, reason]\n end", "def add_slash_if_needed(filename)\n CGI::escape(filename[0..0] == '/' ? filename : \"/#{filename}\").gsub('%2F', '/')\n end", "def join(basedir, dir)\n return \"#{basedir}#{dir[2..-1]}\" if windows? && !basedir.empty? && (dir.length > 2)\n\n \"#{basedir}#{dir}\"\n end", "def dirname_up(path)\n path =~ /(.*)\\\\(.*)$/\n\n return $1 || path\n end", "def addDir(dirPath)\n #N Without this, the directory path won't be broken up into its elements\n pathElements = getPathElements(dirPath)\n #N Without this check, it will fail in the case where dirPath has no elements in it\n if pathElements.length > 0\n #N Without this, we won't know the first element in the path (which is needed to construct the immediate sub-directory content-tree representing the first part of the path)\n pathStart = pathElements[0]\n #N Without this we won't know the rest of the elements so that we can add that part of the dir path into the content tree we've just created\n restOfPath = pathElements[1..-1]\n #N Without this the immedate sub-directory content tree and the chain of sub-directories within that won't be created\n getContentTreeForSubDir(pathStart).addDir(restOfPath)\n end\n end", "def merge_path(base, rel)\n\n # RFC2396, Section 5.2, 5)\n # RFC2396, Section 5.2, 6)\n base_path = split_path(base)\n rel_path = split_path(rel)\n\n # RFC2396, Section 5.2, 6), a)\n base_path << '' if base_path.last == '..'\n while i = base_path.index('..')\n base_path.slice!(i - 1, 2)\n end\n\n if (first = rel_path.first) and first.empty?\n base_path.clear\n rel_path.shift\n end\n\n # RFC2396, Section 5.2, 6), c)\n # RFC2396, Section 5.2, 6), d)\n rel_path.push('') if rel_path.last == '.' || rel_path.last == '..'\n rel_path.delete('.')\n\n # RFC2396, Section 5.2, 6), e)\n tmp = []\n rel_path.each do |x|\n if x == '..' &&\n !(tmp.empty? || tmp.last == '..')\n tmp.pop\n else\n tmp << x\n end\n end\n\n add_trailer_slash = !tmp.empty?\n if base_path.empty?\n base_path = [''] # keep '/' for root directory\n elsif add_trailer_slash\n base_path.pop\n end\n while x = tmp.shift\n if x == '..'\n # RFC2396, Section 4\n # a .. or . in an absolute path has no special meaning\n base_path.pop if base_path.size > 1\n else\n # if x == '..'\n # valid absolute (but abnormal) path \"/../...\"\n # else\n # valid absolute path\n # end\n base_path << x\n tmp.each {|t| base_path << t}\n add_trailer_slash = false\n break\n end\n end\n base_path.push('') if add_trailer_slash\n\n return base_path.join('/')\n end", "def end_of_path?(dir, root = nil)\n dir.nil? || dir.empty? || dir == '.' || dir == root\n end", "def set_dir(new_dir)\n # checking for / at the end of the env variable\n new_dir = '' unless new_dir\n new_dir += '/' unless new_dir[-1, 1] == '/'\n @dir = new_dir\n end", "def create_dirs_if_missing (*paths)\n\tpaths.each do |path|\n\t\tcurrpath = File.join('.', '')\n\t\tpath.split(File::SEPARATOR).each do |dir|\n\t\t\tcurrpath = File.join(currpath, dir)\n\t\t\tDir.mkdir(currpath) unless File.directory?(currpath)\n\t\tend\n\tend\nend", "def fully_qualified_dir_path?(path)\n path[0, 1] == '/'\n end", "def munge(value)\n if value.is_a?(String) && value =~ /[\\\\\\/]$/\n @path_ends_with_slash = true\n end\n super\n end", "def ensure_leading_slash(path); end", "def directory_path\n @directory_path ||= url_file_path.sub /([^\\/]*)\\z/, ''\n end", "def path_join(base, path)\n return path if path_is_absolute(path)\n base.gsub(/[\\/]+$/, '') + '/' + path.gsub(/^[\\/]+/, '')\n end", "def subdir\n (@subdir) ? Pathname.new(@subdir) : Pathname.new('.')\n end", "def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end", "def dir\n if url.end_with?(\"/\")\n url\n else\n url_dir = File.dirname(url)\n url_dir.end_with?(\"/\") ? url_dir : \"#{url_dir}/\"\n end\n end", "def add_dir(path)\n Dir.foreach(@new_base + path) do |fname|\n path_fname = path + fname\n next if fname == '.' || fname == '..' || filter_fname(path_fname)\n type = File.ftype(@new_base + path_fname).to_sym\n @entries << [path_fname, type, :added]\n add_dir(path_fname + '/') if type == :directory\n end\n end", "def create_folders_for full_path\n full_path = File.dirname(full_path)\n\n return if File.directory?(full_path) || [\"/\", \".\"].include?(full_path)\n create_folders_for(full_path)\n Dir::mkdir(full_path)\n end", "def directory(from, to = nil)\n @directories[from.chomp('/')] = to\n end", "def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end", "def cleanpath_aggressive\n path = @path\n names = []\n pre = path\n while r = chop_basename(pre)\n pre, base = r\n case base\n when '.'\n when '..'\n names.unshift base\n else\n if names[0] == '..'\n names.shift\n else\n names.unshift base\n end\n end\n end\n if File.basename(pre).include? '/'\n names.shift while names[0] == '..'\n end\n Path.new(prepend_prefix(pre, File.join(*names)))\n end", "def has_directory? name\n File.directory? path / name\n end", "def remove_leading_slash(path); end", "def makedirs(*dirs)\n path = dirs.pop[:path].sub(%r[/$],'') if dirs.last.is_a? Hash\n dirs.map! { |dir| \"#{path}/#{dir}\" } if path\n super(dirs)\nend", "def cleanpath\n path = @path\n names = []\n pre = path\n while r = chop_basename(pre)\n pre, base = r\n case base\n when '.'\n when '..'\n names.unshift base\n else\n if names[0] == '..'\n names.shift\n else\n names.unshift base\n end\n end\n end\n if /#{SEPARATOR_PAT}/o =~ File.basename(pre)\n names.shift while names[0] == '..'\n end\n self.class.new(prepend_prefix(pre, File.join(*names)))\n end", "def add_directory(path, parent_baton,\n copyfrom_path, copyfrom_revision)\n # Output 'A' to indicate that the directory was added.\n # Also put a trailing slash since it's a directory.\n puts \"A #{path}/\"\n\n # The directory has been printed -- don't print it again.\n [false, path]\n end", "def add_directory(name)\n full_path = File.join(path, name)\n\n Dir.mkdir(full_path) unless File.directory?(full_path)\n\n self.class.new(full_path)\n end", "def set_folder_name\n media_regexp = Regexp.new(\"^#{media_path.filesystem_path}[/]?\")\n write_attribute(:folder_name, File.dirname(file_name).gsub(media_regexp, ''))\n end", "def ensure_directory_exists\r\n dir = File.dirname(full_path_from_current_attributes)\r\n FileUtils.mkdir_p(dir) unless File.exists?(dir)\r\n end", "def join(prefix, path, suffix=nil)\n root = prefix.nil? ? path.relative : prefix + \"/\" + path.relative\n suffix.nil? ? root : root + \"/\" + suffix\n end", "def chop_leading_slash filename\n filename.sub %r{^/}, \"\"\n end", "def escape_dirname\n mgsub( [ [/[\\s\\:\\)\\(\\?\\,]+/, \"-\"], [/\\*/, \"star\"] ] )\n end", "def url_safe_name\n name == '/' ? \"root-dir--#{file_type}\" : \"#{name}--#{file_type}\"\n end", "def simplify_path(path)\n stack = []\n result = ''\n\n path.split('/').each do |dir|\n if dir == '' || dir == '.'\n next\n elsif dir == '..'\n stack.pop()\n else\n stack.push(dir)\n end\n end\n\n while stack.length > 0\n result = '/' + stack.pop() + result\n end\n\n return '/' if result == ''\n\n result\nend", "def dir\n url.end_with?(\"/\") ? url : url_dir\n end", "def dir_path(locale, category, section = nil, article = nil)\n # each resource has an id and name attribute\n # let's use this to build a path where we can store the actual data\n log(\" buidling dir_path for #{[locale, category, section, article].compact.map{|r| r['name']}}\", :verbose)\n [locale, category, section, article].compact.inject(\"./\") do |dir_path, resource|\n # check if we have existing folder that needs to be renamed\n path_to_append = output_type == :slugified ? \"#{resource['id']}-#{slugify(resource['name'])}\" : \"#{resource['id']}\"\n rename_dir_or_file_starting_with_id!(dir_path, resource['id'], path_to_append)\n # build path and check if folder exists\n log(\" #{path_to_append} appended to #{dir_path}\", :verbose)\n dir_path += path_to_append + \"/\"\n Dir.mkdir(dir_path) unless File.exists?(dir_path)\n # end point is begin point of next iteration\n dir_path\n end\n end", "def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end", "def format_path(entry)\n server_path = entry.path\n if base_path && server_path[0,base_path.length] == base_path\n if server_path == base_path\n return \".\"\n elsif server_path[base_path.length,1] == \"/\"\n return server_path[base_path.length + 1, server_path.length - base_path.length - 1]\n elsif base_path == \"/\" && server_path[0,1] == \"/\"\n return server_path[1, server_path.length - 1]\n end\n end\n server_path\n end", "def subdirs(*name)\n\t\treturn File.join(name, \"*/\")\n\tend", "def force_trailing_slash\n force_slash :slash\n end", "def join_path(path)\n if path.include?('\\\\') && path.include?('/')\n path.gsub('\\\\', '/')\n else\n path\n end\n end", "def join_paths(paths)\n paths.join('/').gsub(%r{/+}, '/')\n end", "def mkdir(name)\n return self if name == '.'\n name = name[1..-1] if name[0] == '/'\n newdir, *remainder = name.split('/')\n subdir = get(newdir)\n unless subdir.dir?\n result = @od.request(\"#{api_path}/children\",\n name: newdir,\n folder: {},\n '@microsoft.graph.conflictBehavior': 'rename'\n )\n subdir = OneDriveDir.new(@od, result)\n end\n remainder.any? ? subdir.mkdir(remainder.join('/')) : subdir\n end", "def split_paths(path)\n dir_list = path.split('/').drop(1) # drops the \"\" because of the first \"/\"\n path_list = ['/'+dir_list.first]\n dir_list.drop(1).each do |dir|\n path = path_list.last + '/' + dir\n path_list.push path\n end\n path_list\nend", "def container_path(no_filename: nil, final_slash: nil, use_archive_file_name: nil, leading_dot: nil)\n parts = []\n parts << '.' if leading_dot\n parts << path unless path.blank?\n parts << file_name unless no_filename\n res = File.join parts\n res += '/' if final_slash && !res.empty?\n res\n end", "def relativize_path(path)\n path.to_s.gsub(/^\\/?#{Regexp.escape(root_path.to_s)}\\/?/, '')\n end", "def dirname(delimiter = '/', start = nil)\n prefix = self.key\n unless start.nil?\n prefix = prefix.gsub(start,'')\n end\n \n arr = prefix.split(delimiter)\n if arr.length > 1\n arr[0] + delimiter\n elsif arr.length == 1 && is_placeholder_directory?\n arr[0] + delimiter\n else\n nil\n end\n end", "def smart_slash(input)\n if !(input =~ /\\.\\w+$/)\n input = File.join(input, '/')\n end\n input\n end", "def normalised_name(path)\n path == '/' ? '/' : File.basename(path)\n end", "def _dir label\n path = (@path =~ %r{\\A(.*[^/])/?}) ? $1 : @path # strip trailing slash\n (%r{\\A(.*)/#{SkylabFolder}\\Z} =~ path) and path = $1\n path = File.join(path, SkylabFolder)\n File.directory?(path) or return @err.puts(\"#{label} must be directory: #{path}\")\n path\n end", "def path_for_url(dir, subdir, url)\n path = url.gsub(/^[|[:alpha:]]+:\\/\\//, '')\n path.gsub!(/^[.\\/]+/, '')\n path.gsub!(/[^-_.\\/[:alnum:]]/, '_')\n File.join(dir, subdir, path)\n end", "def build_path(parent_path)\n return name if (not parent_path) || parent_path.empty?\n parent_path + ::File::SEPARATOR + name\n end", "def clean_path(path)\n if path\n (path[0] != '/' ? path.insert(0, '/') : path).gsub(/\\/{2,}/, '/')\n end\n end", "def chop_path(path, base='.')\n full_base = File.expand_path(base)\n full_path = File.expand_path(path)\n if full_path == full_base\n '.'\n elsif full_path.start_with?(full_base)\n full_path[full_base.size+1..-1]\n else\n full_path\n end\n end", "def addNameToPath(name)\n @root = name if @currentPath.empty?\n @currentPath.addName(name)\n end", "def addDir(basefile)\n\t\tdir = File.dirname(basefile)\n\n\t\t# recurse - add parent dirs also\n\t\tif (dir != \".\") then\n\t\t\t@dirList << dir\n\t\t\taddDir(dir)\n\t\tend\n\tend", "def trailingslashit(string)\n untrailingslashit(string) + '/'\n end", "def make_dir(output_path)\r\n constructed_dir = \"\"\r\n i = 0\r\n\r\n folders = output_path.split(\"/\")\r\n folders.each {|subdir|\r\n if (i == 0)\r\n constructed_dir = subdir\r\n else\r\n constructed_dir = constructed_dir + \"/\" + subdir\r\n end\r\n i += 1\r\n if not (Dir.exist? constructed_dir)\r\n puts(\"Constructed dir: \" + constructed_dir)\r\n Dir.mkdir constructed_dir\r\n end\r\n }\r\nend", "def +(other)\n path = self.class.new(File.join(to_s, other.to_s))\n path.cleanpath\n\n #other = Path::Name.new(other) unless Path::Name === other\n #return other if other.absolute?\n #pth = (@path + other.pathlist)\n #pth.delete('.')\n #Path::Name.create(pth, @absolute, other.trail?)\n\n # path1 = @path#\n # path2 = other.to_s\n # while m2 = %r{\\A\\.\\.(?:/+|\\z)}.match(path2) and\n # m1 = %r{(\\A|/+)([^/]+)\\z}.match(path1) and\n # %r{\\A(?:\\.|\\.\\.)\\z} !~ m1[2]\n # path1 = m1[1].empty? ? '.' : '/' if (path1 = m1.pre_match).empty?\n # path2 = '.' if (path2 = m2.post_match).empty?\n # end\n # if %r{\\A/+\\z} =~ path1\n # while m2 = %r{\\A\\.\\.(?:/+|\\z)}.match(path2)\n # path2 = '.' if (path2 = m2.post_match).empty?\n # end\n # end\n #\n # return Path::Name.new(path2) if path1 == '.'\n # return Path::Name.new(path1) if path2 == '.'\n #\n # if %r{/\\z} =~ path1\n # Path::Name.new(path1 + path2)\n # else\n # Path::Name.new(path1 + '/' + path2)\n # end\n end", "def relativize( path ) # :doc:\n p = Pathname.new( path )\n unless p.relative?\n p = p.relative_path_from( Pathname.pwd ).to_s\n p += '/' if path[-1] == '/'\n path = p if p.length < path.length\n end\n path\n end", "def join_files(base_dir, path)\n if(Pathname.new(path).relative?)\n File.join(base_dir, path)\n else\n path\n end\n end", "def new_path\n if conf[:options][:dest].nil? or conf[:options][:dest].empty?\n File.join(@dir_path, @new_name)\n else\n File.join(conf[:options][:dest], @new_name)\n end\n end", "def new_dirs; end", "def valid_directory_name?(directory_name, metadata_name)\n normalized = metadata_name.tr('/', '-').split('-').last\n normalized == directory_name\n end", "def merge_path_elements(dir, name, format)\n result = ::File.join([@page_file_dir, dir, self.page_file_name(name, format)].compact)\n result = Pathname.new(result).cleanpath.to_s\n if @page_file_dir\n raise Gollum::IllegalDirectoryPath unless result.start_with?(\"#{@page_file_dir}/\")\n result\n else\n result[0] == '/' ? result[1..-1] : result\n end\n end", "def relativize_paths(paths)\n return paths unless relativize_paths?\n paths.map do |path|\n path.gsub(%r{^#{@directory}/}, '')\n end\n end", "def path_write path, content = \"\", mode = \"a+\"\n\t\t\tif File.exist?(path)\n\t\t\t\tFile.open(path, mode){|f| f.write content} unless path[-1] == '/'\n\t\t\telse\n\t\t\t\tarrs\t= path.split('/')\n\t\t\t\tcount\t= arrs.count - 1\n\t\t\t\tprve\t= \"\"\n\n \t\t\t\tif arrs[0] == \"\"\n \t\t\t\t\tarrs.delete(\"\")\n\t\t\t\t\tprve = \"/\"\n \t\t\t\tend\n\n\t\t\t\t(0..count).each do | i |\n\t\t\t\t\tsub_path = prve + arrs[0..i].join(\"/\")\n\t\t\t\t\tunless File.exist? sub_path\n\t\t\t\t\t\tsub_path == path ? File.open(path, mode){|f| f.write content} : Dir.mkdir(sub_path)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def empty_directory?\n directory? && Dir.entries(to_s).reject { |entry| entry == '.' || entry == '..' }.empty?\n end", "def directory(dir, options = nil)\n options ||= self.options if self.respond_to?(:options)\n options ||= {}\n if File.exists?(dir) && File.directory?(dir)\n # do nothing\n elsif File.exists?(dir)\n msg = \"#{basename(dir)} already exists and is not a directory.\"\n raise Compass::FilesystemConflict.new(msg)\n else\n log_action :directory, separate(\"#{basename(dir)}/\"), options\n FileUtils.mkdir_p(dir)\n end\n end", "def collect_path_string(dir_set)\n path = \"/\"\n dir_set.each { |dir| path += \"#{dir}/\" }\n path\n end", "def find_common_directory_path(paths)\n case paths.length\n when 0\n return '/'\n when 1\n return paths.first.split('/').slice(0...-1).join('/')\n else\n arr = paths.sort\n first = arr.first.split('/')\n last = arr.last.split('/')\n i = 0\n i += 1 while first[i] == last[i] && i <= first.length\n first.slice(0, i).join('/')\n end\nend", "def make_dir(output_path)\n constructed_dir = \"\"\n i = 0\n\n folders = output_path.split(\"/\")\n folders.each {|subdir|\n if (i == 0)\n constructed_dir = subdir\n else\n constructed_dir = constructed_dir + \"/\" + subdir\n end\n i += 1\n if not (Dir.exist? constructed_dir)\n puts(\"Constructed dir: \" + constructed_dir)\n Dir.mkdir constructed_dir\n end\n }\nend", "def cleanup_dirs\n @cleanup_dirs ||= ['.']\n end", "def directory?(path)\n ensure_relative_path! :directory?, path\n chdir path\n chdir '..'\n true\n rescue\n false\n end", "def dir_name(name)\n name = name.dup\n name.gsub!(\":\", VAGRANT_COLON) if Util::Platform.windows?\n name.gsub!(\"/\", VAGRANT_SLASH)\n name\n end", "def rootify_path path\n path = normalize_path(path, true)\n path.size > 0 ? '/%s/' % path : '/'\n end", "def ensureDir(dir)\n\tdir = File.expand_path(dir)\n\tif !File.directory? dir\n\t\tFileUtils::mkpath(dir)\n\tend\n\treturn dir\nend" ]
[ "0.6624387", "0.661011", "0.656361", "0.63372576", "0.6265527", "0.6183738", "0.61595523", "0.61358327", "0.60846496", "0.6037723", "0.5943778", "0.59264416", "0.5878882", "0.5826261", "0.5824257", "0.58223414", "0.5818853", "0.5810974", "0.58080727", "0.5804661", "0.5802477", "0.5796641", "0.57902473", "0.576447", "0.57580954", "0.57520604", "0.57319164", "0.5725985", "0.5725921", "0.570001", "0.56970346", "0.5677432", "0.5676323", "0.5655365", "0.5644926", "0.5635342", "0.56194204", "0.5610984", "0.56095403", "0.56048447", "0.5602589", "0.5598997", "0.55881345", "0.5578335", "0.5577845", "0.55680233", "0.5563381", "0.55578387", "0.5557589", "0.5551765", "0.55495125", "0.55221045", "0.5518989", "0.55170065", "0.55118066", "0.5510198", "0.54920506", "0.5474703", "0.5470236", "0.54650253", "0.5462656", "0.5458806", "0.5457539", "0.5438984", "0.54324657", "0.54229003", "0.54196", "0.5415904", "0.5411845", "0.54118276", "0.54064524", "0.53874475", "0.53729635", "0.53711075", "0.53664804", "0.5365124", "0.5343118", "0.533483", "0.53346443", "0.5331172", "0.53125185", "0.52989936", "0.5297946", "0.5296219", "0.52938056", "0.5288251", "0.5281955", "0.5281093", "0.5279127", "0.527195", "0.52717036", "0.5262009", "0.5257675", "0.5246846", "0.5245645", "0.5242806", "0.5230201", "0.52295476", "0.52223766", "0.5213625" ]
0.61220855
8
N Without constructor we could not create object with readonly attribute values
def initialize(hashCommand, pathPrefix = "") #N Without this, would not know the how to execute and parse the result of the hash command @hashCommand = hashCommand #N Without this, would not know how to execute 'find' if it's not on the path @pathPrefix = pathPrefix end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(*args)\n result = super(*args)\n ensure\n readonly! if result\n end", "def koan_6\n c = Class::new {\n attribute 'a' => 42\n }\n\n o = c::new\n\n assert{ o.a == 42 }\n assert{ o.a? }\n assert{ (o.a = nil) == nil }\n assert{ not o.a? }\nend", "def immutable\n obj = self.class.const_get(:Immutable).send(:new)\n self.class.attribute_descriptors.each do |name, attr|\n if attr.is_attribute?\n value = self.instance_variable_get(:\"@#{name}\")\n obj.instance_variable_set(:\"@#{name}\", value)\n end\n end\n\n obj\n end", "def readonly_attributes\n read_inheritable_attribute(:attr_readonly)\n end", "def koan_6\n c = Class.new {\n attribute 'a' => 42\n }\n\n o = c.new\n\n assert{ o.a == 42 }\n assert{ o.a? }\n assert{ (o.a = nil) == nil }\n assert{ not o.a? }\n end", "def koan_5\n o = Object.new\n\n class << o\n attribute 'a'\n end\n\n assert{ not o.a? }\n assert{ o.a = 42 }\n assert{ o.a == 42 }\n assert{ o.a? }\n end", "def koan_5\n o = Object::new\n\n class << o\n attribute 'a'\n end\n\n assert{ not o.a? }\n assert{ o.a = 42 }\n assert{ o.a == 42 }\n assert{ o.a? }\nend", "def attr_reader(*)\n end", "def attr_reader(sym, *more) end", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def koan_7\n c = Class::new {\n attribute('a'){ fortytwo }\n def fortytwo\n 42\n end\n }\n\n o = c::new\n\n assert{ o.a == 42 }\n assert{ o.a? }\n assert{ (o.a = nil) == nil }\n assert{ not o.a? }\nend", "def readonly! #:nodoc:\n @readonly = true\n end", "def readonly?; true; end", "def readonly?; true; end", "def readonly?; true; end", "def koan_8\n b = Class::new {\n class << self\n attribute 'a' => 42\n attribute('b'){ a }\n end\n attribute 'a' => 42\n attribute('b'){ a }\n }\n\n c = Class::new b\n\n assert{ c.a == 42 }\n assert{ c.a? }\n assert{ (c.a = nil) == nil }\n assert{ not c.a? }\n\n o = c::new\n\n assert{ o.a == 42 }\n assert{ o.a? }\n assert{ (o.a = nil) == nil }\n assert{ not o.a? }\nend", "def createit(xclass,params,field)\n cloned = xclass.new(params)\n cloned.instance_eval do\n @errors = nil\n end\n cloned.member_id = nil\n assert(cloned.valid?, \"Creatit not valid at start\")\n cloned.send(\"#{field}=\", 9995)\n cloned.member_id = nil\n assert(!cloned.valid?, \"Createit not valid when nil\") \n end", "def koan_8\n b = Class.new {\n class << self\n attribute 'a' => 42\n attribute('b'){ a }\n end\n\n attribute 'a' => 42\n attribute('b'){ a }\n }\n\n c = Class.new b\n\n assert{ c.a == 42 }\n assert{ c.a? }\n assert{ (c.a = nil) == nil }\n assert{ not c.a? }\n\n o = c::new\n\n assert{ o.a == 42 }\n assert{ o.a? }\n assert{ (o.a = nil) == nil }\n assert{ not o.a? }\n end", "def initialize attr={}\n super\n self.attributes = attr\n end", "def attributes=(_arg0); end", "def readonly(*syms)\nreturn if syms.size == 0 # If no arguments, do nothing\ncode = \"\"\n# Start with an empty string of code\n# Generate a string of Ruby code to define attribute reader methods.\n# Notice how the symbol is interpolated into the string of code.\nsyms.each do |s|\n# For each symbol\ncode << \"def #{s}; @#{s}; end\\n\"\n# The method definition\nend\n# Finally, class_eval the generated code to create instance method\nclass_eval code\nend", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def readonly!\n @readonly = true\n end", "def read_only(attributes)\n if !attributes.is_a?(Hash) || attributes.empty?\n raise ArgumentError, \"`attributes` must be a hash of attribute/value pairs\"\n end\n unless attributes.key?(:id)\n raise ArgumentError, \"`attributes` must contain a key for `id`\"\n end\n attributes = attributes.symbolize_keys\n STRUCT_CACHE[attributes.keys.hash] ||= struct_object(attributes.keys)\n cls = STRUCT_CACHE[attributes.keys.hash]\n instance = cls.new\n instance.klass = self\n attributes.each {|k,v| instance[k] = v}\n instance\n end", "def initialize(**kwargs)\n assert_required_attributes(kwargs)\n assert_no_extra_attributes(kwargs)\n @attributes = Valuables::DeepFreeze.deep_freeze(kwargs)\n @hash = self.class.hash ^ @attributes.hash\n freeze\n end", "def attr(symbol, writable=false) end", "def read(object, attribute, ivar = T.unsafe(nil)); end", "def attr_accessor(sym, *more) end", "def koan_7\n c = Class.new {\n attribute('a'){ fortytwo }\n def fortytwo\n 42\n end\n }\n\n o = c.new\n\n assert{ o.a == 42 }\n assert{ o.a? }\n assert{ (o.a = nil) == nil }\n assert{ not o.a? }\n end", "def initialize(obj); end", "def attr_readonly(*attributes)\n write_inheritable_attribute(:attr_readonly, Set.new(attributes.map(&:to_s)) + (readonly_attributes || []))\n end", "def transient=(_arg0); end", "def test_immutable\n assert_raises(NoMethodError) {Style.new(1).key=2}\n end", "def attr_accessor( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end", "def koan_2\n c = Class.new {\n class << self\n attribute 'a'\n end\n }\n\n assert{ not c.a? }\n assert{ c.a = 42 }\n assert{ c.a == 42 }\n assert{ c.a? }\n end", "def initialize_copy(obj)\n #This is a stub, used for indexing\n end", "def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end", "def initialize(n, a)\n self.name = n #attr_accessor method gives us self.name=() method (and with that the @name variable) vs @name declaration\n self.age = a * DOG_YEARS\n end", "def initialize(node, discount_repeated_attributes: T.unsafe(nil)); end", "def initialize(params={})\n params.each do |attribute, value|\n if @@object_attributes.include? attribute\n objs = []\n value.each do |sub_val|\n objs << Ottoman.const_get(self.get_object_name(attribute)).new(sub_val)\n end if value\n self.public_send(\"#{attribute}=\", objs)\n elsif @@object_attribute.include? attribute\n self.public_send(\"#{attribute}=\", Object::const_get(self.get_object_name(attribute)).new(value)) if value\n else\n self.public_send(\"#{attribute}=\", value)\n end\n end if params\n\n super()\n end", "def new\n puts \"xxxxxxx NodesC a:new xxxxxxx\"\n # @node = Node.new # orig \n \n @node = Node.new\n #@node.build ==> this does not work as there is m\n #@node.node_attrbs.build\n #byebug\n end", "def object=(_arg0); end", "def object=(_arg0); end", "def object=(_arg0); end", "def object=(_arg0); end", "def create_accessible_attributes\n read_inheritable_attribute(:attr_create_accessible)\n end", "def test_ro\n base = RoBaseIf.new( 'lab1', '', true )\n ex = assert_raise( RuntimeError ) { base.value = 1; }\n assert_equal( \"Model 'lab1' is read-only\", ex.message )\n end", "def initialize(left, right)\n super(left, Immutable.freeze_object(right))\n end", "def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end", "def attr_read_only(*attributes)\n self.read_only_attributes = Set.new(attributes.map { |a| a.to_s }) + (read_only_attributes || [])\n end", "def create_attr( name , ro = false)\n unless ro\n create_method( \"#{name}=\".to_sym ) { |val| \n instance_variable_set( \"@\" + name, val)\n }\n end\n\n create_method( name.to_sym ) { \n instance_variable_get( \"@\" + name )\n }\n end", "def new_with_default_fields(*a, &b) \n object = new_without_default_fields(*a, &b)\n # object.attributes = a.first || {} <- removed, as we initialize the fields w/ new in previous line already \n object\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def double\n OpenStruct.new(id: rand(0..9))\n end", "def readonly(*syms)\n return if syms.size == 0 # If no arguments, do nothing \n code = \"\" # Start with an empty string of code \n # Generate a string of Ruby code to define attribute reader methods.\n # Notice how the symbol is interpolated into the string of code.\n syms.each do |s|\n code << \"def #{s}; #{s}; end\\n\"\n end \n # Finally, class_eval the generated code to create instance methods.\n class_eval code \n end", "def attr_writer(sym, *more) end", "def read_only\n @attributes[:read_only]\n end", "def initialize params, only_public = true\n self.params = params.dup\n self.only_public = only_public\n self.interpret\n end", "def initialize(attr={})\n super\n end", "def attr_writer( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end", "def initialize(n)\n @n = n\n end", "def initialize(attributes = {})\n self.class.set_attrb_accessors\n\n #cheeto = Student.new(name: \"cheeto\", grade: 6)\n attributes.each do |property, value|\n #interpolation converts symbol to string\n self.send(\"#{property}=\", value)\n end\n end", "def test_immutable\n assert_raises(NoMethodError) {BlockStyle.new(1).key=2}\n end", "def initialize(attributes={})\n super\n attributes[:type] ||= T_REGULAR\n end", "def initialize(args = {})\n # We must set flags before the other values\n @flags = [false, false, false, false]\n update_attributes(ATTR_DEFAULTS.merge(args))\n end", "def read_only?; end", "def read_only?; end", "def clone(freeze: T.unsafe(nil)); end", "def initialize(attributes = {})\n mass_assign(attributes)\n end", "def koan_3\n m = Module.new {\n class << self\n attribute 'a'\n end\n }\n\n assert{ not m.a? }\n assert{ m.a = 42 }\n assert{ m.a == 42 }\n assert{ m.a? }\n end", "def koan_4\n m = Module.new {\n attribute 'a'\n }\n\n c = Class.new {\n include m\n extend m\n }\n\n o = c.new\n\n assert{ not o.a? }\n assert{ o.a = 42 }\n assert{ o.a == 42 }\n assert{ o.a? }\n\n assert{ not c.a? }\n assert{ c.a = 42 }\n assert{ c.a == 42 }\n assert{ c.a? }\n end", "def initialize(**attrs)\n prune(attrs).each { |name, value| instance_variable_set(:\"@#{name}\", value) }\n end", "def constructor; end", "def create_random\nrnd = [\nrand(0x100000000),\nrand(0x100000000),\nrand(0x100000000),\nrand(0x100000000),\n].pack \"N4\"\nraw = mask 4, rnd\nret = new raw\nret.freeze\nret\nend", "def initialize(data) # will accept the attribute data. \r\n\r\n @data = data # store the attribute data, and allows it to be used each time. \r\n\r\n end", "def singleton_attr_reader( *names )\n\n singleton_class.instance_eval { attr_reader *names }\n \n return self\n\n end", "def initialize(attributes = {})\n attributes.each do |name, value|\n public_send(\"#{name}=\", value)\n end\n end", "def initialize(attributes = {})\n attributes.each do |name, value|\n public_send(\"#{name}=\", value)\n end\n end", "def attributes(*args)\n attr_accessor(*args)\n end", "def attr_accessor(*fields)\n attr_reader *fields\n attr_writer *fields\n end", "def initialize(attributes = {})\n @attributes = attributes\n super @attributes.slice(*self.class.special_attrs).merge(data: @attributes.except(*self.class.special_attrs))\n end", "def initialize(*args)\n @attributes = HashWithIndifferentAccess[ self.class.attribute_names.zip([]) ]\n @attributes_cache = HashWithIndifferentAccess.new\n @previously_changed = HashWithIndifferentAccess.new\n @changed_attributes = HashWithIndifferentAccess.new\n super()\n end", "def initialize(params = {})\n params&.each { |attr, value| public_send(\"#{attr}=\", value) }\n\n super()\n end", "def initialize(data, start, constant_pool)\r\n creator = AttributesCreator.new(data, start, constant_pool)\r\n creator.create!\r\n @attributes = creator.attributes\r\n @size = creator.size\r\n end", "def initialize(m, n)\n\t\tsuper()\n\t\t@m = m\n\t\t@n = n\n\t\treturn\n\tend", "def initialize(n)\n self.nome = n\n end", "def initialize(*args)\n set(*args)\n @freeform = false\n end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def attr_reader_init(*symbols)\n generate_attr_reader(symbols)\n generate_initializer(symbols)\n end", "def attr_reader(*vars)\n super *(add_tracked_attrs(true, false, *vars))\n end", "def readonly\n true\n end" ]
[ "0.61288303", "0.60933834", "0.6062224", "0.60028726", "0.5981488", "0.5977132", "0.5973516", "0.5934166", "0.59296185", "0.5836796", "0.5836796", "0.5833756", "0.5830253", "0.58220136", "0.58220136", "0.58220136", "0.57861567", "0.576626", "0.56919235", "0.56653786", "0.56645054", "0.56472254", "0.5641002", "0.5641002", "0.5626148", "0.5622663", "0.56184214", "0.5617868", "0.561694", "0.5611831", "0.5590022", "0.55758345", "0.5561911", "0.5539622", "0.55319875", "0.5525643", "0.55158985", "0.5502317", "0.55002815", "0.54871523", "0.5484591", "0.5482009", "0.54809207", "0.54769474", "0.54769474", "0.54769474", "0.54769474", "0.54725486", "0.5453679", "0.541955", "0.54149383", "0.54073817", "0.5393594", "0.5385408", "0.5383036", "0.5383036", "0.5383036", "0.5383036", "0.5383036", "0.5361511", "0.5338224", "0.53307223", "0.53277785", "0.5316889", "0.53152984", "0.5315167", "0.5310728", "0.53093237", "0.5307992", "0.5300573", "0.52981895", "0.5295136", "0.5295136", "0.5287843", "0.5285669", "0.5280803", "0.5280345", "0.52791774", "0.5271115", "0.5242505", "0.5237355", "0.52284026", "0.5227505", "0.5227505", "0.52251506", "0.52241683", "0.5221861", "0.5221098", "0.52197254", "0.5217313", "0.5216858", "0.52058583", "0.5202664", "0.5201938", "0.5201938", "0.5201938", "0.5201938", "0.5201938", "0.51979166", "0.51974833", "0.51949745" ]
0.0
-1
Generate the find command which will list all the subdirectories of the base directory N Without this, wouldn't know how to execute 'find' command to list all subdirectories of specified directory
def findDirectoriesCommand(baseDir) #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type d' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?) return ["#{@pathPrefix}find", baseDir, "-type", "d", "-print"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findFilesCommand(baseDir)\n #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type f' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?)\n return [\"#{@pathPrefix}find\", baseDir, \"-type\", \"f\", \"-print\"]\n end", "def find(dirs); end", "def folders_listing path\n cmd = \"find #{path} -type d \"\n if @folder_regexp\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@folder_regexp}\\\"\"\n end\n folders = exec_cmd(cmd)\n folders\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def dir_list(path, bases, paging)\n items = paging[:items]\n page = paging[:page]\n offset = paging[:offset]\n raise 'Disabling paging is not supported for a directory listing' if paging[:disable_paging]\n\n max_items = 1000\n\n child_paths, total = FileSystems::Combined.directory_list(path, items, offset, max_items)\n\n children = child_paths.map { |full_path|\n if FileSystems::Combined.directory_exists?(full_path)\n dir_info(full_path, bases)\n else\n raise 'File should exist' unless FileSystems::Combined.file_exists?(full_path)\n\n file_info(full_path)\n end\n }\n\n paging[:total] = total\n paging[:warning] = \"Only first #{max_items} results are available\" if total >= max_items\n\n children\n end", "def all_directories dir\n Dir[\"#{dir}**/\"]\nend", "def directory_subdirectories(path)\n\tputs ''\n\tfor i in subdir_paths(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend", "def find_in(dir); end", "def getDirs dir\n\t\tFind.find(dir)\t\n\tend", "def listDirectories(baseDir)\n #N if un-normalised, code assuming '/' at the end might be one-off\n baseDir = normalisedDir(baseDir)\n #N without the command, we don't know what command to execute to list the directories\n command = findDirectoriesCommand(baseDir)\n #N without this, the command won't execute, or we it might execute in a way that doesn't let us read the output\n output = getCommandOutput(command)\n #N without initial directories, we would have nowhere to accumulate the directory relative paths\n directories = []\n #N without the base dir length, we don't know how much to chop off the path names to get the relative path names\n baseDirLen = baseDir.length\n #N without this, would not get feedback that we are listing directories (which might be a slow remote command)\n puts \"Listing directories ...\"\n #N without looping over the output, we wouldn't be reading the output of the listing command\n while (line = output.gets)\n #N without chomping, eoln would be included in the directory paths\n line = line.chomp\n #N without this, would not get feedback about each directory listed\n puts \" #{line}\"\n #N without this check, unexpected invalid output not including the base directory would be processed as if nothing had gone wrong\n if line.start_with?(baseDir)\n #N without this, the directory in this line of output wouldn't be recorded\n directories << line[baseDirLen..-1]\n else\n #N if we don't raise the error, an expected result (probably a sign of some important error) would be ignored\n raise \"Directory #{line} is not a sub-directory of base directory #{baseDir}\"\n end\n end\n #N if we don't close the output, then un-opened output stream objects will accumulate (and leak resources)\n output.close()\n #N if we don't check the process status, then a failed command will be treated as if it had succeeded (i.e. as if there were no directories found)\n checkProcessStatus(command)\n return directories\n end", "def list_directories(options = {})\n options = DEFAULTS.merge(options)\n\n path = options[:path]\n all = options[:all]\n\n path = \"#{path}/\" unless path == '' or path.end_with?('/')\n path = path+'**/' if all\n \n\n Dir.glob(\"#{path}*/\")\n end", "def recursive_find_directories_and_files dirname\r\n base_path = self.class.lookup('ExtAdminSection').path + \"/templates/\"\r\n \r\n directories = []\r\n files = []\r\n \r\n Find.find(File.join(base_path, dirname)) do |path|\r\n if FileTest.directory?(path)\r\n directories << path.gsub(base_path, '')\r\n else\r\n files << path.gsub(base_path, '')\r\n end\r\n end\r\n \r\n return directories, files\r\n end", "def find_files(base_dir, flags); end", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def list_directory(directory)\n return if directory == nil\n \n repo = File.join(path, directory)\n return unless File.directory?(repo) \n \n Dir.chdir(repo)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end", "def retrieve_dirs(_base, dir, dot_dirs); end", "def ls( *args )\r\n \r\n directory = nil\r\n opts = {}\r\n \r\n case args.count\r\n when 1\r\n if args[0].kind_of? Hash\r\n opts = args[0]\r\n else\r\n directory = args[0]\r\n end\r\n when 2\r\n directory = args[0]\r\n opts = args[1] \r\n end\r\n \r\n # args are the RPC arguments ...\r\n args = {}\r\n args[:path] = directory if directory\r\n args[:recursive] = true if opts[:recurse]\r\n args[:detail] = true if opts[:detail] \r\n args.delete(:detail) if( args[:detail] and args[:recursive])\r\n \r\n # RPC output format, default is XML\r\n outf = { :format => 'text' } if opts[:format] == :text\r\n \r\n got = @ndev.rpc.file_list( args, outf )\r\n return nil unless got\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n # if we're here, then we need to conver the output \r\n # to a Hash. Joy!\r\n \r\n collect_detail = args[:detail] || args[:recursive]\r\n \r\n ls_hash = {}\r\n got.xpath('directory').each do |dir|\r\n \r\n dir_name = dir.xpath('directory-name').text.strip\r\n dir_hash = {}\r\n \r\n dir_hash[:fileblocks] = dir.xpath('total-file-blocks').text.to_i\r\n files_info = dir.xpath('file-information')\r\n \r\n dir_hash[:files] = {} \r\n dir_hash[:dirs] = {} # sub-directories\r\n \r\n files_info.each do |file|\r\n f_name = file.xpath('file-name').text.strip\r\n f_h = {} \r\n \r\n if file.xpath('file-directory')[0]\r\n dir_hash[:dirs][f_name] = f_h\r\n else\r\n dir_hash[:files][f_name] = f_h \r\n end\r\n \r\n next unless collect_detail\r\n \r\n f_h[:owner] = file.xpath('file-owner').text.strip\r\n f_h[:group] = file.xpath('file-group').text.strip\r\n f_h[:links] = file.xpath('file-links').text.to_i\r\n f_h[:size] = file.xpath('file-size').text.to_i\r\n \r\n xml_when_item(file.xpath('file-symlink-target')) { |i|\r\n f_h[:symlink] = i.text.strip\r\n }\r\n \r\n fp = file.xpath('file-permissions')[0]\r\n f_h[:permissions_text] = fp.attribute('format').value\r\n f_h[:permissions] = fp.text.to_i\r\n \r\n fd = file.xpath('file-date')[0]\r\n f_h[:date] = fd.attribute('format').value\r\n f_h[:date_epoc] = fd.text.to_i\r\n \r\n end # each directory file\r\n ls_hash[ dir_name ] = dir_hash \r\n end # each directory\r\n \r\n return nil if ls_hash.empty?\r\n ls_hash\r\n end", "def find(args, mode)\n return target_files_in_dir if args.empty?\n\n files = []\n\n args.uniq.each do |arg|\n files += if File.directory?(arg)\n target_files_in_dir(arg.chomp(File::SEPARATOR))\n else\n process_explicit_path(arg, mode)\n end\n end\n\n files.map { |f| File.expand_path(f) }.uniq\n end", "def find_files( directory, pattern='*')\n `find -H '#{directory}' -name \"#{pattern}\"`.split(\"\\n\").reject{|f| f==directory}\n end", "def list_directories\n Dir.chdir(path)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end", "def find_files(recusive,sort)\n ext_list = $config[\"series\"][\"media_extentions\"].gsub(/,/,\"|\")\n files = [] \n if File.directory? sort\n Find.find(sort) do |path|\n next if File.dirname(path) != sort and not recusive\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if path !~ /#{ext_list}$/\n files << path\n end\n else\n log(\"error: source directory of \\\"#{sort}\\\" does not exist!\")\n exit 2\n end\n files\nend", "def get_directories(src)\n directories = Array.new\n #return directories\n Find.find(src) do |path|\n # not too sure what this was intended to do but its getting in the way\n # and can not be matched correctly.\n #next if File.dirname(path) != src \n next if path == src\n next if not File.directory? path\n directories.push path\n end\n directories.reverse\nend", "def command(arguments, _ = nil)\n search_string = Array(arguments).first\n raise 'missing specification argument' unless search_string\n\n search(search_string)\n .map { |e| e.file.folder }\n .each { |folder| Settings.console.say folder }\n end", "def each_directory_in_tree(include_self: true)\n self.directories_in_tree(include_self: include_self).find_each do |directory|\n yield directory\n end\n end", "def dir_children(dirname=mpwd)\n simple_entries(dirname).find_all {|e|\n File.directory?(File.join(dirname, e))\n }\n end", "def enumerate_directories(directory)\n return directory.\n children.\n select(&:directory?).\n map(&:expand_path)\n end", "def subdirectories()\n children.select { |c| c.directory? }\n end", "def detected_directories\n sub_directories.reject do |on_disk|\n children.any? { |in_db| in_db.full_path == on_disk }\n end.map do |found|\n children.new(relative_path: found.relative_path_from(disk.path), disk: disk)\n end.each(&:valid?) # build paths\n end", "def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend", "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 list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend", "def code_files_in_recursive(some_dir, extensions)\n raise ArgumentError, 'some_dir is not a Pathname' unless some_dir.is_a? Pathname\n return [] unless some_dir.exist? && some_dir.directory?\n\n Find.find(some_dir).map { |p| Pathname.new(p) }.select(&:directory?).map { |d| code_files_in(d, extensions) }.flatten\n end", "def GetLevelDirs()\n directories = Dir.entries($level_folder)\n\n for i in 0...directories.length do\n\n if not directories[i].include? \".\" then\n $current_folder = $level_folder + directories[i] + \"/\"\n GetLevels($current_folder)\n end\n\n end\n\nend", "def dir_files(dir)\n Find.find(dir).to_a.reject!{|f| File.directory?(f) }\nend", "def children( with_directory = ( self != '.' ) )\n ( Dir.entries( expand_tilde ) - DOTS ).map do | entry |\n with_directory ? join( entry ) : self.class.new( entry )\n end\n end", "def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end", "def files_listing path\n cmd = \"find #{path} -type f \"\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@file_regexp}\\\" \" if @file_regexp\n out = exec_cmd(cmd)\n end", "def all\n Directory.all.map do |node_id|\n find node_id\n end\n end", "def find_files( config )\n files = []\n config.each do |c|\n Config.verify_config_dirs( c )\n\n dir = c[\"directory\"].chomp(\"/\")\n recursive = Config.convert_yaml_bools( c[\"recursive\"] ) \n \n if File.directory? dir \n unless recursive\n Dir.glob( \"#{dir}/*\" ).each do |d|\n files << d unless File.directory? d or File.symlink? d\n end\n else\n Dir.glob(\"#{dir}/**/*\").each do |d|\n files << d unless File.directory? d or File.symlink? d \n end \n end\n else\n Dir.glob( dir ).each do |d|\n files << d \n end\n end\n end\n files\nend", "def query\n parent_folders = @pattern.split('/')[0..-2]\n parent_folders << '*' if parent_folders[-1] != '*'\n File.join(*parent_folders)\n end", "def subdirectories\n Dir.glob(File.join(base_path, \"*\")).reject { |i| !File.directory?(i) }\n end", "def findPaths (conf)\n puts aktTime()+' collecting files...'\n STDOUT.flush #write out immediately\n\tconf[:saveDirs].each do |d|\n\t\tif File.directory?(d)\n\t\t\tDir.chdir(d)\n\t\t\tgetFiles(conf)\n\t\telse\n\t\t\tputs \"\\nWarning: Directory: \\n\"+d+\" **not** found !\"\n\t\tend\n\tend\nend", "def find_files_in_dir dir\n unless dir.exist?\n warn \"Can't find files in dir %s as it doesn't exist!\",\n dir.relative_path_from(project.path + '..').to_s\n return []\n end\n Dir.chdir dir do\n Dir['**/*'].map { |path| Pathname(path) }\n end\n end", "def list_files_in_directory(dir, options)\n normalized_file_list(options, Dir.glob(File.join(dir, \"*\")), false, options.exclude)\n end", "def list_files_from (path,opts = {})\n safe_fetch do\n list_files = Set.new\n var = \"Search in #{path} at #{@host}... \"\n cmd = \"find #{path}\"\n cmd = \"(cd #{path} && ls \" ### dont know why cd alone doesn't work\n cmd << \"-td */\" if opts[:directories]\n cmd << opts[:regexp] if opts[:regexp]\n cmd << \" 2>/dev/null)\"\n out = @ssh.exec!(cmd)\n list_files = out.split\n list_files = out.split(\"/\\n\") if opts[:directories]\n\n var << \"Found #{list_files.size} entries\\n\"\n Logger.<<(__FILE__,\"INFO\",var)\n list_files\n end\n end", "def scan_sub_dirs_in_path(path)\n puts 'Scanning destination directories'\n Dir.chdir(path)\n sub_dirs = Dir['*'].select { |o| File.directory?(o) }\n Dir.chdir(root_dir)\n sub_dirs\nend", "def get_directory_files(directory, verbose_flag=false)\n exists = File.directory?(directory)\n if exists\n files = Dir[\"#{directory}/*\"] # grab all the files inside that directory\n return files\n else\n puts \"Unable to find a directory at #{directory}\" if verbose_flag\n return nil\n end\nend", "def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= self.get_root_folder_id\n return nil if params[:folder_id].blank?\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n parameters = {}\n parameters['q'] = \"'#{params[:folder_id]}' in parents\"\n parameters['maxResults'] = result[:per_page]\n \n # Make api request\n begin\n drive = @client.discovered_api('drive', 'v2')\n api_result = @client.execute(:api_method => drive.files.list, :parameters => parameters)\n rescue\n return nil\n end\n \n \n if api_result.status == 200\n files = api_result.data\n files.items.each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n else\n result[:error] = {:code => api_result.status, :message => api_result.data['error']['message']} \n end\n result\n end", "def find_files dir = test_dir\n glob file_pattern(dir)\n end", "def explore(dir)\n\tterminate if $interrupted\n\tDir.new(dir).each do |node|\n\t\tnode_path = dir + '/' + node\n\t\tif File.directory?(node_path) && !File.symlink?(node_path) && node[0,1] != '.'\n\t\t\texplore node_path\n\t\telsif File.file?(node_path) && node[0] != '.'\n\t\t\tif greppable node_path\n\t\t\t\tif node =~ /#{ARGV[0]}/\n\t\t\t\t\tputs colorize(node_path, 'yellow')\n\t\t\t\t\tStats['name_matches'] += 1\n\t\t\t\tend\n\t\t\t\tgrep_file node_path unless Opts['names']\n\t\t\t\tStats['files_grepped'] += 1\n\t\t\telse\n\t\t\t\tStats['nodes_skipped'] += 1\n\t\t\tend\n\t\telse\n\t\t\tStats['nodes_skipped'] += 1\n\t\tend\n\tend\nend", "def list_files_in_directory(dir, options)\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list options, files, false, options.exclude\n end", "def list_files_in_directory(dir, options)\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list options, files, false, options.exclude\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 list_files_in_directory dir\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list files, false, @options.exclude\n end", "def grep_search search_dir\n args = ['-r']\n end", "def files_in_directory name, glob = '**' / '*'\n Dir[path / name / glob]\n end", "def list_of_directories\n Dir.entries(\"./inspections\").select {|d| !d.start_with?(\".\") }\n end", "def directories\n directory.directoires\n end", "def ls\n table Dir.entries( Dir.pwd ).reject { |f| f.match /^\\..*$/ }\n end", "def ls(directory)\n out = []\n tmp = cmd_exec(\"ls -a -m #{directory}\")\n tmp = session.remove_colors(tmp)\n if tmp\n tmp.delete!(\"\\r\")\n tmp.delete!(\"\\n\")\n tmp.split(/,\\s{0,1}/).each do |f|\n next if f.empty?\n next if f == './'\n next if f == '../'\n next if f == '.'\n next if f == '..'\n out << f\n end\n end\n out\n end", "def get_subdirs(directory)\n Dir.entries(directory).select { |entry|\n entry != '.' and entry != '..' and is_dir?(\"#{directory}/#{entry}\")\n }\n end", "def find_paths(dir=\"\")\n base = File.join(@source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir[\"*\"]) }\n paths = []\n\n entries.each do |entry|\n absolute_path = File.join(base, entry)\n relative_path = File.join(dir, entry)\n\n if File.directory?(absolute_path)\n paths.concat find_paths(relative_path)\n else\n paths << absolute_path\n end\n end\n paths\n end", "def ls dir,regex = \"\"\n cmd = regex.empty? ? \"ls #{dir}\" : \"ls #{File.join(dir,regex)}\"\n exec_cmd(cmd) \n end", "def descend()\n @path.scan(%r{[^/]*/?})[0...-1].inject('') do |path, dir|\n yield self.class.new(path << dir)\n path\n end\n end", "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n `git ls-tree --name-only #{ref} #{paths.join(' ')}`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end", "def get_subdir_pages( directory )\n Dir[ File.join( directory, \"*.src\" ) ] - Dir[ File.join( directory, \"index.src\" ) ]\n end", "def get_entries(dir, subfolder); end", "def folders\n xpath './folder'\n end", "def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scanner.included_files.collect{|f| @context.filepath_from_root(f) }\r\n end", "def find_sauce_files(cwd=@opts[:basedir], depth=@opts[:search_depth], file_ext=@opts[:sauce_file_extension])\n files = []\n (0..depth).each do |i|\n prefix = \"*/\"*i\n files << Dir.glob(File.join(cwd, \"#{prefix}*#{file_ext}\"))\n end\n return files.flatten.uniq\n end", "def scan\n glob = File.join(\"**\", Command::FILENAME)\n\n commands = load_path.flat_map do |path|\n path = Pathname.new(path)\n\n path.glob(glob).map do |file|\n root = file.dirname\n name = root.relative_path_from(path)\n name = name.to_s.tr(File::SEPARATOR, Command::SEPARATOR)\n build(name, root.to_s)\n end\n end\n\n commands.sort_by(&:name)\n end", "def dirglob(dir='')\n pattern = dir.sub(/\\/+$/, ?/) + ?*\n files = []\n dirs = []\n Dir[pattern].flat_map do |f|\n if File.directory?(f)\n f = f.sub(/\\/*$/, ?/)\n dirs += ['', f] + dirglob(f)\n else\n files << f\n end\n end\n files + dirs\nend", "def get_ls(path)\n #repo = @repo\n #head = repo.commits.first\n #tree = head.tree @branch\n\n tree = @repo.tree @branch\n\n #strip trailing /\n path.sub! /[\\/]*$/, ''\n\n # find dir\n while !path.empty?\n tdir = tree / path\n break if tdir.is_a?(Grit::Tree)\n # strip last conponent to /\n path.sub! /(^|\\/)[^\\/]*$/, ''\n end\n\n if path.empty?\n tdir = tree\n else\n path += '/'\n end\n print \"path:\", path, \"\\n\"\n print \"tdir:\", tdir, \"\\n\"\n\n files = tdir.blobs.map do |b|\n { path: \"#{path}#{b.name}\", name: b.name, siz: b.size }\n end\n dirs = tdir.trees.map do |t|\n { path: \"#{path}#{t.name}\", name: t.name}\n end\n if !path.empty?\n dirs.push( { path: path.sub(/(^|\\/)[^\\/]*\\/$/, ''),\n name: '..'} )\n end\n\n [files, dirs, path]\n end", "def test_subdirectories\n sd = @td.subdirectories\n assert_equal(5, sd.length)\n assert(sd.find \"failed\")\n assert(sd.find \"inactive\")\n assert(sd.find \"new\")\n assert(sd.find \"passed\")\n assert(sd.find \"unclassified\")\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(directory,f)) &&\n f != '.' && f != '..' }\n files = allFiles.reject{ |f| File.directory?(File.join(directory,f)) }\n result += files\n dirs.each do |subdir|\n result += visible_files_under(File.join(directory,subdir))\n end\n end\n return result\n end", "def ls(pattern = '**/*', **opts)\n Enumerator.new do |acc|\n walk(pattern, **opts) do |path, _|\n acc << path\n end\n end\n end", "def find_files_recursive (base_directory, relative_path)\n result = []\n directory = File.join(base_directory, relative_path)\n Dir.foreach(directory) do |file|\n relative_file = relative_path.empty? ? file : File.join(relative_path, file)\n if matchesFilters(file, relative_file)\n full_path = File.join(base_directory, relative_file)\n if File.directory?(full_path)\n result = result + find_files_recursive(base_directory, relative_file)\n else\n result << relative_file\n end\n end\n end\n result\n end", "def list_all_in_current_directory\n Dir.glob('**/*').sort\nend", "def dir(directory)\n if session.type == 'meterpreter'\n return session.fs.dir.entries(directory)\n end\n\n if session.platform == 'windows'\n return session.shell_command_token(\"dir #{directory}\").split(/[\\r\\n]+/)\n end\n\n if command_exists?('ls')\n return session.shell_command_token(\"ls #{directory}\").split(/[\\r\\n]+/)\n end\n\n # Result on systems without ls command\n if directory[-1] != '/'\n directory = directory + \"/\"\n end\n result = []\n data = session.shell_command_token(\"for fn in #{directory}*; do echo $fn; done\")\n parts = data.split(\"\\n\")\n parts.each do |line|\n line = line.split(\"/\")[-1]\n result.insert(-1, line)\n end\n\n result\n end", "def listDirectories(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this, we won't know that directories are about to be listed\n puts \"Listing directories ...\"\n #N Without this, we won't have an empty array ready to accumulate directory relative paths\n directories = []\n #N Without this, we won't know the length of the base directory to remove from the beginning of the absolute directory paths\n baseDirLen = baseDir.length\n #N Without this, the directory-listing command won't be executed\n ssh(findDirectoriesCommand(baseDir).join(\" \")) do |line|\n #N Without this, we won't get feedback about which directories were found\n puts \" #{line}\"\n #N Without this check, we might ignore an error that somehow resulted in directories being listed that aren't within the specified base directory\n if line.start_with?(baseDir)\n #N Without this, the relative path of this directory won't be added to the list\n directories << line[baseDirLen..-1]\n else\n #N Without raising this error, an unexpected directory not in the base directory would just be ignored\n raise \"Directory #{line} is not a sub-directory of base directory #{baseDir}\"\n end\n end\n return directories\n end", "def index\n\t\t@directories = []\n\t\troot_directory = Jedd::Directory.joins(:v_user).where(:v_users => {:nick => params[:v_user_nick]}).includes(:jedd_file_nodes).first\n\t\t# root_directory = V::User.find_by_nick(params[:v_user_nick]).jedd_directories.where(:jedd_directory_id => nil).joins(:jedd_directories => [:jedd_file_nodes]).first\n\t\tnot_found unless root_directory\n\n\t\tif root_directory\n\t\t\t@directories << root_directory\n\t\tend\n\tend", "def enumerate_files(directory)\n return directory.\n children.\n reject(&:directory?).\n map(&:expand_path)\n end", "def scanDir(dirname, matchfn, callfn, recurse)\n\tDir.foreach(dirname) do |filename|\n\t\tfullfilename = dirname + \"/\" + filename;\n\t\tif File.directory?(fullfilename)\n\t\t\tif recurse && filename != \".\" && filename != \"..\"\t\t# don't infinite loop kthx\n\t\t\t\tscanDir(fullfilename, matchfn, callfn, recurse)\n\t\t\tend\n\t\telsif matchfn.call(filename)\n\t\t\tcallfn.call(fullfilename)\n\t\tend\n\tend\nend", "def get_dirs\n Dir.glob(\"#{@options[:load_path]}/*/**/\")\n end", "def gen_sub_directories\n @outputdir.mkpath\n end", "def subdirectories\n path_length - 1\n end", "def descendants\n self.subfolders.collect do |s|\n [s] + s.descendants\n end.flatten\n end", "def dirs_until_dodona_dir\n dir = @pwd\n children = [dir]\n loop do\n return [] if dir.root?\n return children if dir == @dodona_dir\n children.unshift dir\n dir = dir.parent\n end\n end", "def initialize root_dir\n find_files root_dir\n end", "def find_files(search_pattern, opts = {})\n fetch!\n search_pattern = Regexp.new(search_pattern)\n res = []\n unless @repo.empty?\n tree = @repo.head.target.tree\n _find_files(search_pattern, tree, nil, res)\n end\n res\n end", "def sub_tree\n files = ProjectFile.where(directory_id: id)\n files = files.nil? ? [] : files \n\n files.sort{|x,y| \n if x.is_directory and not y.is_directory\n -1\n elsif not x.is_directory and y.is_directory\n 1\n else\n x.name <=> y.name\n end\n }\n end", "def query\n dir, _, file = @pattern.gsub(/[_\\-\\*]+/, '').rpartition '/'\n dir.gsub(%r{/(\\w{,2})[^/]+}, '\\1') + # map 2 chars per folder\n file.gsub(/\\.\\w+/, '') # remove extension\n end", "def crawl_hiera_directory(directory)\n files = []\n Dir[directory + '/**/*.yaml'].each { |f| files << File.absolute_path(f) }\n return files\n end", "def option_search_all(options)\n if(directory = options[:in_dir])\n search_in(:directory => directory, :for_files => search_all_files)\n else\n search_all_files\n end\n end", "def search(command)\n resp = @client.files.search('/', clean_up(command[1]))\n\n for item in resp\n puts item.path\n end\n end", "def directories; end" ]
[ "0.63822263", "0.6259442", "0.59495145", "0.5918191", "0.5823449", "0.5777494", "0.57679945", "0.57384145", "0.5724316", "0.5708177", "0.57043", "0.5600914", "0.5598248", "0.55707324", "0.5567015", "0.55295247", "0.54997355", "0.54976577", "0.54235226", "0.54173493", "0.54105735", "0.5410121", "0.53282416", "0.5297268", "0.5295364", "0.52593327", "0.52133703", "0.52109027", "0.5153248", "0.51372063", "0.5127588", "0.5111251", "0.5109573", "0.51071835", "0.5105504", "0.5085356", "0.50675416", "0.50517076", "0.5048517", "0.5043327", "0.5020876", "0.5011372", "0.5006469", "0.50028193", "0.49914634", "0.4987295", "0.49836957", "0.49836823", "0.49824297", "0.49807122", "0.4975354", "0.49628493", "0.49607822", "0.49607822", "0.4959169", "0.4956498", "0.49451753", "0.49442238", "0.4942918", "0.4941395", "0.4936953", "0.4936835", "0.4936785", "0.4922375", "0.49192286", "0.49118626", "0.4905461", "0.4904499", "0.4894148", "0.48933992", "0.48912048", "0.48860517", "0.48852754", "0.48836595", "0.4871214", "0.48646286", "0.4858174", "0.48531973", "0.48531967", "0.48520252", "0.4851048", "0.48355815", "0.4835093", "0.48275822", "0.4823671", "0.482324", "0.48210695", "0.48167622", "0.48031107", "0.47949222", "0.47945374", "0.47932422", "0.47842658", "0.476942", "0.476822", "0.47671622", "0.47650713", "0.47618642", "0.47612017", "0.475756" ]
0.7117432
0
Return the list of subdirectories relative to the base directory N Without this method, would not be able to list the directories of a base directory, as part of getting the content tree (be it local or remote)
def listDirectories(baseDir) #N if un-normalised, code assuming '/' at the end might be one-off baseDir = normalisedDir(baseDir) #N without the command, we don't know what command to execute to list the directories command = findDirectoriesCommand(baseDir) #N without this, the command won't execute, or we it might execute in a way that doesn't let us read the output output = getCommandOutput(command) #N without initial directories, we would have nowhere to accumulate the directory relative paths directories = [] #N without the base dir length, we don't know how much to chop off the path names to get the relative path names baseDirLen = baseDir.length #N without this, would not get feedback that we are listing directories (which might be a slow remote command) puts "Listing directories ..." #N without looping over the output, we wouldn't be reading the output of the listing command while (line = output.gets) #N without chomping, eoln would be included in the directory paths line = line.chomp #N without this, would not get feedback about each directory listed puts " #{line}" #N without this check, unexpected invalid output not including the base directory would be processed as if nothing had gone wrong if line.start_with?(baseDir) #N without this, the directory in this line of output wouldn't be recorded directories << line[baseDirLen..-1] else #N if we don't raise the error, an expected result (probably a sign of some important error) would be ignored raise "Directory #{line} is not a sub-directory of base directory #{baseDir}" end end #N if we don't close the output, then un-opened output stream objects will accumulate (and leak resources) output.close() #N if we don't check the process status, then a failed command will be treated as if it had succeeded (i.e. as if there were no directories found) checkProcessStatus(command) return directories end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_list(path, bases, paging)\n items = paging[:items]\n page = paging[:page]\n offset = paging[:offset]\n raise 'Disabling paging is not supported for a directory listing' if paging[:disable_paging]\n\n max_items = 1000\n\n child_paths, total = FileSystems::Combined.directory_list(path, items, offset, max_items)\n\n children = child_paths.map { |full_path|\n if FileSystems::Combined.directory_exists?(full_path)\n dir_info(full_path, bases)\n else\n raise 'File should exist' unless FileSystems::Combined.file_exists?(full_path)\n\n file_info(full_path)\n end\n }\n\n paging[:total] = total\n paging[:warning] = \"Only first #{max_items} results are available\" if total >= max_items\n\n children\n end", "def listDirectories\n return contentHost.listDirectories(baseDir)\n end", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def listDirectories(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this, we won't know that directories are about to be listed\n puts \"Listing directories ...\"\n #N Without this, we won't have an empty array ready to accumulate directory relative paths\n directories = []\n #N Without this, we won't know the length of the base directory to remove from the beginning of the absolute directory paths\n baseDirLen = baseDir.length\n #N Without this, the directory-listing command won't be executed\n ssh(findDirectoriesCommand(baseDir).join(\" \")) do |line|\n #N Without this, we won't get feedback about which directories were found\n puts \" #{line}\"\n #N Without this check, we might ignore an error that somehow resulted in directories being listed that aren't within the specified base directory\n if line.start_with?(baseDir)\n #N Without this, the relative path of this directory won't be added to the list\n directories << line[baseDirLen..-1]\n else\n #N Without raising this error, an unexpected directory not in the base directory would just be ignored\n raise \"Directory #{line} is not a sub-directory of base directory #{baseDir}\"\n end\n end\n return directories\n end", "def retrieve_dirs(_base, dir, dot_dirs); end", "def subdirectories\n Dir.glob(File.join(base_path, \"*\")).reject { |i| !File.directory?(i) }\n end", "def directories\n directory.directoires\n end", "def subdirectories()\n children.select { |c| c.directory? }\n end", "def findDirectoriesCommand(baseDir)\n #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type d' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?)\n return [\"#{@pathPrefix}find\", baseDir, \"-type\", \"d\", \"-print\"]\n end", "def subdirectories\n path_length - 1\n end", "def directory_subdirectories(path)\n\tputs ''\n\tfor i in subdir_paths(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend", "def retrieve_dirs(_base, dir, dot_dirs)\n dot_dirs.each do |file|\n dir_path = site.in_source_dir(dir, file)\n rel_path = PathManager.join(dir, file)\n @site.reader.read_directories(rel_path) unless @site.dest.chomp(\"/\") == dir_path\n end\n end", "def descendants\n self.subfolders.collect do |s|\n [s] + s.descendants\n end.flatten\n end", "def list_directories\n Dir.chdir(path)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end", "def list_folders\n http_get(:uri=>\"/folders\", :fields=>x_cookie)\n end", "def GetDirectoryTreeFromRelativeBase(baseDirectory, excludePatterns=[], excludeEmpty=false)\n tree = GetDirectoryPathsFromRelativeBase(baseDirectory)\n tree.pop() # remove the base directory which is added again in the GetDirectoryTree call\n \n tree.concat(GetDirectoryTree(baseDirectory, excludePatterns, excludeEmpty))\n \n return tree\n end", "def directories\n @directories.values\n end", "def get_subdir_pages( directory )\n Dir[ File.join( directory, \"*.src\" ) ] - Dir[ File.join( directory, \"index.src\" ) ]\n end", "def GetLevelDirs()\n directories = Dir.entries($level_folder)\n\n for i in 0...directories.length do\n\n if not directories[i].include? \".\" then\n $current_folder = $level_folder + directories[i] + \"/\"\n GetLevels($current_folder)\n end\n\n end\n\nend", "def all_directories dir\n Dir[\"#{dir}**/\"]\nend", "def getDirs dir\n\t\tFind.find(dir)\t\n\tend", "def index(base_path, glob = nil)\n\t\tglob = '*' if glob == '' or glob.nil?\n\t\tdirs = []\n\t\tfiles = []\n\t\t::Dir.chdir(base_path) do\n\t\t\t::Dir.glob(glob).each do |fname|\n\t\t\t\tif ::File.directory?(fname)\n\t\t\t\t\tdirs << fname + '/'\n\t\t\t\telse\n\t\t\t\t\tfiles << fname\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdirs.sort + files.sort\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, base_path\n\tend", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def recursive_find_directories_and_files dirname\r\n base_path = self.class.lookup('ExtAdminSection').path + \"/templates/\"\r\n \r\n directories = []\r\n files = []\r\n \r\n Find.find(File.join(base_path, dirname)) do |path|\r\n if FileTest.directory?(path)\r\n directories << path.gsub(base_path, '')\r\n else\r\n files << path.gsub(base_path, '')\r\n end\r\n end\r\n \r\n return directories, files\r\n end", "def list_directories(options = {})\n options = DEFAULTS.merge(options)\n\n path = options[:path]\n all = options[:all]\n\n path = \"#{path}/\" unless path == '' or path.end_with?('/')\n path = path+'**/' if all\n \n\n Dir.glob(\"#{path}*/\")\n end", "def directories; end", "def directories; end", "def directory_paths\n pages.map { |p| File.dirname(p.path).split(\"/\")[0] }.uniq\n end", "def dirs_until_dodona_dir\n dir = @pwd\n children = [dir]\n loop do\n return [] if dir.root?\n return children if dir == @dodona_dir\n children.unshift dir\n dir = dir.parent\n end\n end", "def dir_children(dirname=mpwd)\n simple_entries(dirname).find_all {|e|\n File.directory?(File.join(dirname, e))\n }\n end", "def index\n\t\t@directories = []\n\t\troot_directory = Jedd::Directory.joins(:v_user).where(:v_users => {:nick => params[:v_user_nick]}).includes(:jedd_file_nodes).first\n\t\t# root_directory = V::User.find_by_nick(params[:v_user_nick]).jedd_directories.where(:jedd_directory_id => nil).joins(:jedd_directories => [:jedd_file_nodes]).first\n\t\tnot_found unless root_directory\n\n\t\tif root_directory\n\t\t\t@directories << root_directory\n\t\tend\n\tend", "def directories\n @directories ||= []\n end", "def directories\n @directories ||= []\n end", "def submodule_dirs\n # Implementation is a little hacky; we run a git command and parse the\n # output.\n cmd = %(git submodule)\n %x(#{cmd}).split(/\\n/).map {|line| line.split(\" \")[1] }\n end", "def children( with_directory = ( self != '.' ) )\n ( Dir.entries( expand_tilde ) - DOTS ).map do | entry |\n with_directory ? join( entry ) : self.class.new( entry )\n end\n end", "def children\n files = if index?\n # about/index.html => about/*\n File.expand_path('../*', @file)\n else\n # products.html => products/*\n base = File.basename(@file, '.*')\n File.expand_path(\"../#{base}/*\", @file)\n end\n\n Set.new Dir[files].\n reject { |f| f == @file || project.ignored_files.include?(f) }.\n map { |f| self.class[f, project] }.\n compact.sort\n end", "def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend", "def read_directories(dir = \"\")\n base = site.in_source_dir(dir)\n\n return unless File.directory?(base)\n\n dot_dirs = []\n dot_pages = []\n dot_static_files = []\n\n dot = Dir.chdir(base) { filter_entries(Dir.entries(\".\"), base) }\n dot.each do |entry|\n file_path = @site.in_source_dir(base, entry)\n if File.directory?(file_path)\n dot_dirs << entry\n elsif Utils.has_yaml_header?(file_path)\n dot_pages << entry\n else\n dot_static_files << entry\n end\n end\n\n retrieve_posts(dir)\n retrieve_dirs(base, dir, dot_dirs)\n retrieve_pages(dir, dot_pages)\n retrieve_static_files(dir, dot_static_files)\n end", "def parent_dirs(file); end", "def dirs; end", "def dirs; end", "def children\n return [] unless directory_index?\n\n base_path = if eponymous_directory?\n eponymous_directory_path\n else\n path.sub(@app.config[:index_file].to_s, '')\n end\n\n prefix = %r{^#{base_path.sub(\"/\", \"\\\\/\")}}\n\n @store.resources.select do |sub_resource|\n if sub_resource.path == path || sub_resource.path !~ prefix\n false\n else\n inner_path = sub_resource.path.sub(prefix, '')\n parts = inner_path.split('/')\n if parts.length == 1\n true\n elsif parts.length == 2\n parts.last == @app.config[:index_file]\n else\n false\n end\n end\n end\n end", "def get_level_children(dirname,level) #:nodoc:\n dir_children = full_entries(dirname)\n @level_children += dir_children\n if level < @max_level\n dir_children.each {|e|\n if File.directory?(e)\n get_level_children(e,level + 1)\n end\n }\n end\n end", "def list(path, recursive=true, dirs=false)\n # TODO : this might need to be changed as it returns dir and contents\n # if there are contents\n nodes = []\n prune = recursive ? nil : 2\n @content_tree.with_subtree(path, nil, prune, dirs) do |node|\n nodes << node.path\n end\n nodes.sort.uniq\n end", "def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend", "def get_entries(dir, subfolder); end", "def list_of_directories\n Dir.entries(\"./inspections\").select {|d| !d.start_with?(\".\") }\n end", "def get_directories(src)\n directories = Array.new\n #return directories\n Find.find(src) do |path|\n # not too sure what this was intended to do but its getting in the way\n # and can not be matched correctly.\n #next if File.dirname(path) != src \n next if path == src\n next if not File.directory? path\n directories.push path\n end\n directories.reverse\nend", "def GetDirectoryPathsFromRelativeBase(path)\n pathParts = path.RelativePathParts\n paths = []\n for i in 1..pathParts.length\n\tsubPath = ProjectPath.new(JoinPaths(pathParts.slice(0, i)))\n\tpaths.push(subPath)\n end\n return paths\n end", "def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end", "def directories\n [root_path, deploys_path, shared_path,\n log_path, checkout_path, scripts_path]\n end", "def directories\n directory_entries.map{ |f| FileObject[path, f] }\n end", "def directories\n return @expanded_dirs if @expanded_dirs\n\n raw_dirs = File.readlines(settings.check_dirs).map(&:chomp)\n simple_dirs = raw_dirs.reject{ |line| line.empty? || line.start_with?('#') }\n expanded_dirs = simple_dirs.map do |line|\n expanded = Dir.glob(line)\n if expanded.empty?\n # return original line for error reporting\n line\n else\n # only return directories\n expanded.select{ |dir| File.directory?(dir) }\n end\n end\n @expanded_dirs = expanded_dirs.flatten.sort_by(&:downcase)\n end", "def children(with_directory=true)\n with_directory = false if @path == ['.']\n result = []\n Dir.foreach(to_s) {|e|\n next if e == '.' || e == '..'\n if with_directory\n result << Path::Name.create(@path + [e], absolute?)\n else\n result << Path::Name.new(e)\n end\n }\n result\n end", "def get_dirs\n Dir.glob(\"#{@options[:load_path]}/*/**/\")\n end", "def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(directory,f)) &&\n f != '.' && f != '..' }\n files = allFiles.reject{ |f| File.directory?(File.join(directory,f)) }\n result += files\n dirs.each do |subdir|\n result += visible_files_under(File.join(directory,subdir))\n end\n end\n return result\n end", "def enumerate_directories(directory)\n return directory.\n children.\n select(&:directory?).\n map(&:expand_path)\n end", "def list_subfolders(logged_in_user, order)\n folders = []\n if logged_in_user.can_read(self.id)\n self.children.find(:all, :order => order).each do |sub_folder|\n folders << sub_folder if logged_in_user.can_read(sub_folder.id)\n end\n end\n\n # return the folders:\n return folders\n end", "def get_ls(path)\n #repo = @repo\n #head = repo.commits.first\n #tree = head.tree @branch\n\n tree = @repo.tree @branch\n\n #strip trailing /\n path.sub! /[\\/]*$/, ''\n\n # find dir\n while !path.empty?\n tdir = tree / path\n break if tdir.is_a?(Grit::Tree)\n # strip last conponent to /\n path.sub! /(^|\\/)[^\\/]*$/, ''\n end\n\n if path.empty?\n tdir = tree\n else\n path += '/'\n end\n print \"path:\", path, \"\\n\"\n print \"tdir:\", tdir, \"\\n\"\n\n files = tdir.blobs.map do |b|\n { path: \"#{path}#{b.name}\", name: b.name, siz: b.size }\n end\n dirs = tdir.trees.map do |t|\n { path: \"#{path}#{t.name}\", name: t.name}\n end\n if !path.empty?\n dirs.push( { path: path.sub(/(^|\\/)[^\\/]*\\/$/, ''),\n name: '..'} )\n end\n\n [files, dirs, path]\n end", "def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end", "def folders\n @conn.list(\"#{@full_name}#{@delim}\", '%').map do |f|\n Folder.new(@conn, f.name, f.delim)\n end\n end", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= self.get_root_folder_id\n return nil if params[:folder_id].blank?\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n parameters = {}\n parameters['q'] = \"'#{params[:folder_id]}' in parents\"\n parameters['maxResults'] = result[:per_page]\n \n # Make api request\n begin\n drive = @client.discovered_api('drive', 'v2')\n api_result = @client.execute(:api_method => drive.files.list, :parameters => parameters)\n rescue\n return nil\n end\n \n \n if api_result.status == 200\n files = api_result.data\n files.items.each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n else\n result[:error] = {:code => api_result.status, :message => api_result.data['error']['message']} \n end\n result\n end", "def folders\n @conn.list('', '%').map do |f|\n Folder.new(@conn, f.name, f.delim)\n end\n end", "def GetDirectoryTree(baseDirectory, excludePatterns=[], excludeEmpty=false)\n subdirs = [baseDirectory]\n baseDirectory.SubPaths().each do |subPath|\n\tpathExcluded = false\n\n excludePatterns.each do |pattern|\n if(subPath.RelativePath.match(pattern) != nil)\n pathExcluded = true\n break\n end\n end\n\n if(pathExcluded)\n #puts \"Excluding path #{subdirPath}\"\n next\n end\n\n if(subPath.directory?() && !(excludeEmpty && subPath.EmptyDirectory?()))\n\t subTree = GetDirectoryTree(subPath, excludePatterns, excludeEmpty)\t \n\t subdirs = subdirs + subTree\n end\n end\n return subdirs\n end", "def list_dirs(path)\n dir = pathname(path)\n\n Dir.chdir(dir) do\n Dir['*/'].sort\n end\n\n rescue\n raise FileNotFound, \"no such file in repo - #{path}\"\n end", "def net_excluded_directories\n net = []\n all = self.excluded_directories.map { |dir| buildr_project._(dir.to_s) }.sort_by { |d| d.size }\n all.each_with_index do |dir, i|\n unless all[0 ... i].find { |other| dir =~ /^#{other}/ }\n net << dir\n end\n end\n net\n end", "def net_excluded_directories\n net = []\n all = self.excluded_directories.map { |dir| buildr_project._(dir.to_s) }.sort_by { |d| d.size }\n all.each_with_index do |dir, i|\n unless all[0 ... i].find { |other| dir =~ /^#{other}/ }\n net << dir\n end\n end\n net\n end", "def get_subdirs(directory)\n Dir.entries(directory).select { |entry|\n entry != '.' and entry != '..' and is_dir?(\"#{directory}/#{entry}\")\n }\n end", "def read_directories(dir = \"\")\n base = site.in_source_dir(dir)\n\n return unless File.directory?(base)\n\n entries_dirs = []\n entries_pages = []\n entries_static_files = []\n\n entries = Dir.chdir(base) { filter_entries(Dir.entries(\".\"), base) }\n entries.each do |entry|\n file_path = @site.in_source_dir(base, entry)\n if File.directory?(file_path)\n entries_dirs << entry\n elsif Utils.has_yaml_header?(file_path) || Utils.has_rbfm_header?(file_path)\n entries_pages << entry\n else\n entries_static_files << entry\n end\n end\n\n retrieve_dirs(dir, entries_dirs)\n retrieve_pages(dir, entries_pages)\n retrieve_static_files(dir, entries_static_files)\n end", "def SubPaths()\n #puts \"Searching subpaths in #{to_s()}\"\n entries = Dir.entries(AbsolutePath())\n subPaths = []\n \n #puts \"Found entries #{entries}\"\n \n entries.each do |entry|\n if(entry == \"..\" || entry == \".\")\n next\n end\n \n copy = CreateCopy()\n \n #puts \"Copy is #{copy}\"\n \n copy.RelativePath = JoinPaths([copy.RelativePath, entry])\n subPaths.push(copy)\n \n #puts \"Created path #{copy} for entry #{entry}\"\n end\n \n return subPaths\n end", "def get_directories_names path\n get_directories_absolute_paths(path).map {|dir| File.basename(dir) }\n end", "def list_all_in_current_directory\n Dir.glob('**/*').sort\nend", "def list_directory(directory)\n return if directory == nil\n \n repo = File.join(path, directory)\n return unless File.directory?(repo) \n \n Dir.chdir(repo)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end", "def get_dirs(dir_path)\n dirs = Array.new\n Dir[dir_path + \"/*\"].each do |i|\n if Dir.exists?(i)\n dirs.push(i) if File.directory?(i)\n # Recursive\n dirs.push(get_dirs(i)) \n end\n end\n dirs.flatten!\n dirs.compact!\n dirs\n end", "def childModules()\n\t\t\t\tlist = []\t\t\t\n\t\t\t\tdir = Dir.new( path() )\n\t\n\t\t\t\tdir.each do |file|\n\t\t\t\t\tnext unless File.directory?( path() + \"/\" + file )\n\t\t\t\t\tnext if ( file[/^([A-Z][a-z]*)+$/] == nil )\n\t\t\t\t\tlist << childModule( $1 )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend", "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 dirs\n @dirs.each { |_, dir| apply_defaults_to_dir(dir) }\n end", "def visible_files\n result = []\n for dir in @dirs\n result += visible_files_under(dir)\n end\n return result\n end", "def read_directories(dir = T.unsafe(nil)); end", "def base_directories\n @base_dirs ||= names.map { |name| ::Gem::Specification.find_by_name(name).gem_dir }\n end", "def index\n @directories = Directory.all\n end", "def get_file_list relative_path\n\t\t\t\tpath = File.join(@src, relative_path)\n\t\t\t\tresult = nil\n\t\t\t\tFileUtils.cd(path) do\n\t\t\t\t\tresult = Dir.glob(\"**/*\", File::FNM_DOTMATCH)\n\t\t\t\t\tresult.reject! { |fn| File.directory?(fn) }\n\t\t\t\t\tresult.reject! { |fn| fn =~ /(^_|\\/_)/ }\n\t\t\t\tend\n\t\t\t\tresult\n\t\t\tend", "def detected_directories\n sub_directories.reject do |on_disk|\n children.any? { |in_db| in_db.full_path == on_disk }\n end.map do |found|\n children.new(relative_path: found.relative_path_from(disk.path), disk: disk)\n end.each(&:valid?) # build paths\n end", "def folders_listing path\n cmd = \"find #{path} -type d \"\n if @folder_regexp\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@folder_regexp}\\\"\"\n end\n folders = exec_cmd(cmd)\n folders\n end", "def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end", "def read_dirs(indir)\n @all_files = []\n Dir.chdir(indir)\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n\n @all_files = Dir.glob(\"**/*\").select { |f| File.file? f }\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n all_dirs.each do |subdir|\n read_dir(subdir)\n end\n end", "def directories\n @@directories ||= default_directories\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def listFiles(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this we wouldn't be executing the command to list all files in the remote directory\n ssh(findFilesCommand(baseDir).join(\" \")) do |line| \n #N Without this we wouldn't be echoing the file name on this line for the user to read\n puts \" #{line}\"\n end\n end", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= '/'\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n\n begin\n api_result = @client.metadata(result[:folder_id], 1000, true)\n rescue\n return nil\n end\n \n if api_result.present? && api_result['contents'].present?\n api_result['contents'].each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n end\n \n result\n end", "def sub_tree\n files = ProjectFile.where(directory_id: id)\n files = files.nil? ? [] : files \n\n files.sort{|x,y| \n if x.is_directory and not y.is_directory\n -1\n elsif not x.is_directory and y.is_directory\n 1\n else\n x.name <=> y.name\n end\n }\n end", "def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend", "def crawl_hiera_directory(directory)\n files = []\n Dir[directory + '/**/*.yaml'].each { |f| files << File.absolute_path(f) }\n return files\n end", "def _directories wd\n $log.debug \" directories got XXX: #{wd} \"\n d = Dir.new(wd)\n ent = d.entries.reject{|e| !File.directory? File.join(wd,e)}\n $log.debug \" directories got XXX: #{ent} \"\n ent.delete(\".\");ent.delete(\"..\")\n return ent\n end", "def recursive_subdirectory_ids\n if self.root?\n CfsDirectory.where(root_cfs_directory_id: self.id).ids\n else\n ids = [self.id]\n while true\n new_ids = (CfsDirectory.non_roots.where(parent_id: ids).ids << self.id).sort\n return new_ids if ids == new_ids\n ids = new_ids\n end\n end\n end", "def lsdir(dirpath = nil)\n dirpath << '/' unless dirpath.nil? || dirpath.end_with?('/')\n offset = dirpath.nil? ? 0 : dirpath.length\n bucket.as_tree(:prefix => dirpath).children.select(&:branch?).map{|f| f.prefix[offset..-1]}\n end", "def child_folder_list(parent_folder)\n if parent_folder.child_folder_count == 0\n [parent_folder]\n else\n # recurse over the children to find all descendants\n children = parent_folder.find_folders(FolderView.new(parent_folder.child_folder_count)).folders\n children.flat_map(&method(:child_folder_list)).unshift(parent_folder)\n end\n end", "def find(dirs); end", "def get_folder_list\n\n ################################\n # \n # prep: list\n #\n ################################\n #ref __FILE__ http://stackoverflow.com/questions/37101151/what-does-file-program-name-mean-in-ruby\n path = Pathname.new(__FILE__)\n# path = Pathname.new('.')\n \n #ref https://ruby-doc.org/stdlib-2.1.0/libdoc/pathname/rdoc/Pathname.html\n p \"path.dirname => #{path.dirname}\"\n \n dpath = path.dirname\n# dpath = \"c:/works_2\"\n \n #ref http://stackoverflow.com/questions/1899072/getting-a-list-of-folders-in-a-directory\n Dir.chdir(dpath)\n# Dir.chdir(\"c:/works_2\")\n# Dir.chdir(path.dirname)\n# Dir.chdir('/destination_directory')\n# list = Dir.glob('*').select\n# list = Dir.glob('*').select {|f| File.directory? f}\n files = Dir.glob('*').select {|f| File.file? f}\n dirs = Dir.glob('*').select {|f| File.directory? f}\n \n puts\n puts \"[#{__LINE__}] directory => #{dpath}\" \n \n puts\n puts \"[#{__LINE__}] folders ....\"\n p dirs\n \n puts\n puts \"[#{__LINE__}] files ....\"\n p files.sort\n# p files\n \n# p files.methods.sort\n \n# p __FILE__\n \n# target_directory = \n# \n# Dir.chdir('/destination_directory')\n## Dir.chdir('/destination_directory')\n# \n# list = Dir.glob('*').select {|f| File.directory? f}\n# \n# p list\n \n ################################\n # \n # file: write data\n #\n ################################\n time_label = get_time_label(\"serial\")\n \n fname = \"directory_list.#{time_label}.txt\"\n \n f = File.new(fname, \"w\")\n \n # header\n f.write(\"program file path = #{FILE_PATH}\")\n f.write(\"\\n\")\n f.write(\"version = #{VERSION}\")\n f.write(\"\\n\")\n \n f.write(\"list file created at = #{time_label}\")\n f.write(\"\\n\")\n \n f.write(\"dir path = #{dpath}\")\n f.write(\"\\n\")\n f.write(\"dirs = #{dirs.size}\")\n f.write(\"\\n\")\n f.write(\"files = #{files.size}\")\n f.write(\"\\n\")\n f.write(\"\\n\")\n \n # data: dirs\n f.write \"<directories> #{dirs.size}\"\n f.write \"\\n\"\n \n dirs.each do |elem|\n \n f.write(elem)\n f.write(\"\\n\")\n \n end\n \n f.write(\"\\n\")\n f.write(\"\\n\")\n \n # data: files\n f.write \"<files> #{files.size}\"\n f.write \"\\n\"\n\n files.each do |elem|\n \n f.write(elem)\n f.write(\"\\n\")\n \n end\n \n f.close\n \n puts \"[#{__LINE__}] file written => #{fname}\"\n \nend", "def get_directories_absolute_paths path\n dir_list = Dir[\"#{path}/*/\"]\n \n #Remove unnecessary directories\n dir_list.delete(File.join(path, \".\"))\n dir_list.delete(File.join(path, \"..\"))\n \n dir_list\n end" ]
[ "0.7064652", "0.6976425", "0.679826", "0.67918026", "0.6723324", "0.67213833", "0.65266395", "0.6350759", "0.6289712", "0.62105185", "0.6205237", "0.6143932", "0.60980284", "0.6033957", "0.60284305", "0.6017417", "0.5995194", "0.5980907", "0.5976133", "0.5961318", "0.5927347", "0.5900131", "0.58828276", "0.5879013", "0.5861838", "0.5856751", "0.5856751", "0.58498085", "0.5841085", "0.5841043", "0.5840737", "0.5826657", "0.5826657", "0.58244824", "0.5812908", "0.5786991", "0.5785041", "0.57794285", "0.5774162", "0.57409483", "0.57409483", "0.57305986", "0.572679", "0.5719423", "0.5715365", "0.56812495", "0.56704354", "0.5665798", "0.56617653", "0.5651871", "0.56465155", "0.5630854", "0.5629832", "0.5627825", "0.5623272", "0.5605429", "0.5595322", "0.5591436", "0.5586571", "0.5582913", "0.5570594", "0.55692196", "0.554577", "0.5537086", "0.5514281", "0.55110157", "0.55110157", "0.5497781", "0.5496972", "0.5488073", "0.54790395", "0.54738384", "0.5456736", "0.54566383", "0.54555535", "0.54554415", "0.5415992", "0.54157335", "0.5415587", "0.5414554", "0.54103625", "0.5408521", "0.5394766", "0.5394532", "0.5385233", "0.5379205", "0.53737783", "0.53712076", "0.5363312", "0.53533995", "0.53512347", "0.5340694", "0.5339433", "0.5336898", "0.533061", "0.53248787", "0.53081864", "0.53039634", "0.52965784", "0.5287935" ]
0.697383
2
Generate the find command which will list all the files within the base directory N without this method, we wouldn't know what command to use to list all the files in the base directory
def findFilesCommand(baseDir) #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type f' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?) return ["#{@pathPrefix}find", baseDir, "-type", "f", "-print"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_files(base_dir, flags); end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def find(dirs); end", "def findDirectoriesCommand(baseDir)\n #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type d' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?)\n return [\"#{@pathPrefix}find\", baseDir, \"-type\", \"d\", \"-print\"]\n end", "def find_in(dir); end", "def files_listing path\n cmd = \"find #{path} -type f \"\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@file_regexp}\\\" \" if @file_regexp\n out = exec_cmd(cmd)\n end", "def find(args, mode)\n return target_files_in_dir if args.empty?\n\n files = []\n\n args.uniq.each do |arg|\n files += if File.directory?(arg)\n target_files_in_dir(arg.chomp(File::SEPARATOR))\n else\n process_explicit_path(arg, mode)\n end\n end\n\n files.map { |f| File.expand_path(f) }.uniq\n end", "def find_files dir = test_dir\n glob file_pattern(dir)\n end", "def find_files(recusive,sort)\n ext_list = $config[\"series\"][\"media_extentions\"].gsub(/,/,\"|\")\n files = [] \n if File.directory? sort\n Find.find(sort) do |path|\n next if File.dirname(path) != sort and not recusive\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if path !~ /#{ext_list}$/\n files << path\n end\n else\n log(\"error: source directory of \\\"#{sort}\\\" does not exist!\")\n exit 2\n end\n files\nend", "def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end", "def find_files(search_pattern, opts = {})\n fetch!\n search_pattern = Regexp.new(search_pattern)\n res = []\n unless @repo.empty?\n tree = @repo.head.target.tree\n _find_files(search_pattern, tree, nil, res)\n end\n res\n end", "def find_files( directory, pattern='*')\n `find -H '#{directory}' -name \"#{pattern}\"`.split(\"\\n\").reject{|f| f==directory}\n end", "def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scanner.included_files.collect{|f| @context.filepath_from_root(f) }\r\n end", "def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end", "def search(command)\n resp = @client.files.search('/', clean_up(command[1]))\n\n for item in resp\n puts item.path\n end\n end", "def find_files(base_dir, flags)\n # get all wanted directories first to improve speed of finding all files\n exclude_pattern = combined_exclude_glob_patterns(base_dir)\n dir_flags = flags | File::FNM_PATHNAME | File::FNM_EXTGLOB\n patterns = wanted_dir_patterns(base_dir, exclude_pattern, dir_flags)\n patterns.map! { |dir| File.join(dir, '*') }\n # We need this special case to avoid creating the pattern\n # /**/* which searches the entire file system.\n patterns = [File.join(dir, '**/*')] if patterns.empty?\n\n Dir.glob(patterns, flags).select { |path| FileTest.file?(path) }\n end", "def create_list_of_files\n @path=find_repository_and_basepath\n @table.window.setTitle(@path)\n files=[]\n Find.find(@path) do |file|\n # we don't want any files from a repository in the list \n next if file=~/(\\.hg|\\.svn|\\.git|\\.pyc)/ \n\n # neither do we want dotfiles in the list\n next if File.basename(file)=~/^\\./ \n \n # file matches, add it to the resulting list\n files << file if FileTest.file?(file)\n\n # wir bauen hier mal einen kleinen Idiotentest ein. Wenn wir mehr\n # als 10000 Dateien gefunden haben dann sind wir vermtl. in einem \n # falschen Verzeichniss und brechen die Suche ab.\n if files.length>10000\n NSRunInformationalAlertPanel('Large directory found!',\n \"Gathered more than 10k files from directory '#{@path}', aborting search!\",'OK',nil,nil)\n NSApp.stop(self)\n raise 'error'\n end\n end\n #@files=files.sort_by { |match| File.basename(match) }\n @files=files.sort\n end", "def list_files_from (path,opts = {})\n safe_fetch do\n list_files = Set.new\n var = \"Search in #{path} at #{@host}... \"\n cmd = \"find #{path}\"\n cmd = \"(cd #{path} && ls \" ### dont know why cd alone doesn't work\n cmd << \"-td */\" if opts[:directories]\n cmd << opts[:regexp] if opts[:regexp]\n cmd << \" 2>/dev/null)\"\n out = @ssh.exec!(cmd)\n list_files = out.split\n list_files = out.split(\"/\\n\") if opts[:directories]\n\n var << \"Found #{list_files.size} entries\\n\"\n Logger.<<(__FILE__,\"INFO\",var)\n list_files\n end\n end", "def find(args, mode); end", "def find_files folder\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n if @subfolders\n files = sub_listing folder\n else\n path = ::File.join(@source.base_dir,folder)\n files = files_listing path\n end\n files = files_filtering files\n files = files.take(@take) if @take\n to_file(files)\n end", "def initialize root_dir\n find_files root_dir\n end", "def find file\n unless defined? @find_dirs_glob\n base_dirs = ENV['WMII_CONFPATH'].to_s.split(/:+/).unshift(DIR)\n ruby_dirs = base_dirs.map {|dir| File.join(dir, 'ruby') }\n @find_dirs_glob = '{' + base_dirs.zip(ruby_dirs).join(',') + '}'\n end\n\n Dir[\"#{@find_dirs_glob}/#{file}\"].first\n end", "def find_files(*file_patterns)\n FileFinder.new.version(self).files(file_patterns)\n end", "def find_files(search_pattern, opts = {})\n raise \"Missing implementation\"\n end", "def find_files(search_pattern, opts = {})\n raise \"Missing implementation\"\n end", "def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend", "def find_files()\n require 'find'\n directory = File.dirname(__FILE__) + '/../templates/' + @template\n @files = Array.new()\n Find.find(directory) do |f|\n if FileTest.file?f\n @files.push(f)\n end\n end\n @files\n end", "def _find_files(*paths)\n paths.flatten!\n paths.map! { |p| Pathname.new(p) }\n files = paths.select(&:file?)\n\n (paths - files).each do |dir|\n files << _find_files(dir.children)\n end\n\n files.flatten.map(&:to_s)\n end", "def scan\n glob = File.join(\"**\", Command::FILENAME)\n\n commands = load_path.flat_map do |path|\n path = Pathname.new(path)\n\n path.glob(glob).map do |file|\n root = file.dirname\n name = root.relative_path_from(path)\n name = name.to_s.tr(File::SEPARATOR, Command::SEPARATOR)\n build(name, root.to_s)\n end\n end\n\n commands.sort_by(&:name)\n end", "def find_files_in_dir dir\n unless dir.exist?\n warn \"Can't find files in dir %s as it doesn't exist!\",\n dir.relative_path_from(project.path + '..').to_s\n return []\n end\n Dir.chdir dir do\n Dir['**/*'].map { |path| Pathname(path) }\n end\n end", "def find_files( dirs, lang, name, exts )\n results = []\n glob_files( dirs, lang, name, exts ) { |file,base,ext| results << file }\n results\n end", "def find_sauce_files(cwd=@opts[:basedir], depth=@opts[:search_depth], file_ext=@opts[:sauce_file_extension])\n files = []\n (0..depth).each do |i|\n prefix = \"*/\"*i\n files << Dir.glob(File.join(cwd, \"#{prefix}*#{file_ext}\"))\n end\n return files.flatten.uniq\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def find_files\n @files = []\n\n Dir.foreach(configured_file_path) do |file_name|\n next if file_name == '.' || file_name == '..'\n next if file_name =~ /^\\./ && Ferver.configuration.serve_hidden == false\n\n found_file = FoundFile.new(configured_file_path, file_name)\n @files << found_file if found_file.valid?\n end\n end", "def dir_list(path, bases, paging)\n items = paging[:items]\n page = paging[:page]\n offset = paging[:offset]\n raise 'Disabling paging is not supported for a directory listing' if paging[:disable_paging]\n\n max_items = 1000\n\n child_paths, total = FileSystems::Combined.directory_list(path, items, offset, max_items)\n\n children = child_paths.map { |full_path|\n if FileSystems::Combined.directory_exists?(full_path)\n dir_info(full_path, bases)\n else\n raise 'File should exist' unless FileSystems::Combined.file_exists?(full_path)\n\n file_info(full_path)\n end\n }\n\n paging[:total] = total\n paging[:warning] = \"Only first #{max_items} results are available\" if total >= max_items\n\n children\n end", "def list_files\n Find.find(path) do |element| yield element end\n end", "def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end", "def each_file_batch(batch_size: FIND_BATCH_SIZE, &block)\n cmd = build_find_command(ABSOLUTE_UPLOAD_DIR)\n\n Open3.popen2(*cmd) do |stdin, stdout, status_thread|\n yield_paths_in_batches(stdout, batch_size, &block)\n\n raise \"Find command failed\" unless status_thread.value.success?\n end\n end", "def grep_search search_dir\n args = ['-r']\n end", "def recursive_find_directories_and_files dirname\r\n base_path = self.class.lookup('ExtAdminSection').path + \"/templates/\"\r\n \r\n directories = []\r\n files = []\r\n \r\n Find.find(File.join(base_path, dirname)) do |path|\r\n if FileTest.directory?(path)\r\n directories << path.gsub(base_path, '')\r\n else\r\n files << path.gsub(base_path, '')\r\n end\r\n end\r\n \r\n return directories, files\r\n end", "def listFiles(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this we wouldn't be executing the command to list all files in the remote directory\n ssh(findFilesCommand(baseDir).join(\" \")) do |line| \n #N Without this we wouldn't be echoing the file name on this line for the user to read\n puts \" #{line}\"\n end\n end", "def command(arguments, _ = nil)\n search_string = Array(arguments).first\n raise 'missing specification argument' unless search_string\n\n search(search_string)\n .map { |e| e.file.folder }\n .each { |folder| Settings.console.say folder }\n end", "def target_files_in_dir(base_dir = Dir.pwd)\n # Support Windows: Backslashes from command-line -> forward slashes\n base_dir = base_dir.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR\n all_files = find_files(base_dir, File::FNM_DOTMATCH)\n # use file.include? for performance optimization\n hidden_files = all_files.select { |file| file.include?(HIDDEN_PATH_SUBSTRING) }\n base_dir_config = @config_store.for(base_dir)\n\n target_files = all_files.select do |file|\n to_inspect?(file, hidden_files, base_dir_config)\n end\n\n target_files.sort_by!(&order)\n end", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def find(root, params)\n FileSearcher.call(root, params)\nend", "def index(base_path, glob = nil)\n\t\tglob = '*' if glob == '' or glob.nil?\n\t\tdirs = []\n\t\tfiles = []\n\t\t::Dir.chdir(base_path) do\n\t\t\t::Dir.glob(glob).each do |fname|\n\t\t\t\tif ::File.directory?(fname)\n\t\t\t\t\tdirs << fname + '/'\n\t\t\t\telse\n\t\t\t\t\tfiles << fname\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdirs.sort + files.sort\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, base_path\n\tend", "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n `git ls-tree --name-only #{ref} #{paths.join(' ')}`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def find(path); end", "def find(path); end", "def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end", "def query\n dir, _, file = @pattern.gsub(/[_\\-\\*]+/, '').rpartition '/'\n dir.gsub(%r{/(\\w{,2})[^/]+}, '\\1') + # map 2 chars per folder\n file.gsub(/\\.\\w+/, '') # remove extension\n end", "def folders_listing path\n cmd = \"find #{path} -type d \"\n if @folder_regexp\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@folder_regexp}\\\"\"\n end\n folders = exec_cmd(cmd)\n folders\n end", "def find_files(pattern)\n Dir[File.join(folder, pattern, \"*.#{pattern}\")].sort{|f1, f2|\n File.basename(f1) <=> File.basename(f2)\n }.collect{|f|\n File.join(pattern, File.basename(f))\n }\n end", "def find_migration_file(d, n)\n migration_file_re = Regexp.new(\"[0-9]+_(#{n}).rb$\")\n name = nil\n infile = nil\n curdir = Dir.getwd\n Dir.chdir(d)\n Dir.glob('*.rb') do |fn|\n if fn =~ migration_file_re\n name = Regexp.last_match[1]\n infile = fn\n break\n end\n end\n Dir.chdir(curdir)\n\n [ name, infile ]\n end", "def option_search_all(options)\n if(directory = options[:in_dir])\n search_in(:directory => directory, :for_files => search_all_files)\n else\n search_all_files\n end\n end", "def files(args = {})\n opts = {\n base_dir: Dir.pwd,\n recursive: false,\n exts: [],\n non_exts: []\n }.merge(args)\n\n base_dir = opts[:base_dir]\n fail CustomError, \"The directory #{base_dir} is not valid or or not readable!\" unless File.exist?(base_dir)\n\n wildcard = opts[:recursive] ? '**' : ''\n exts = opts[:exts]\n non_exts = opts[:non_exts]\n\n file_with_extension = Dir.glob(File.join(base_dir, wildcard, \"*.{#{exts.join(',')}}\"))\n file_with_no_extension = no_extension_files(base_dir, wildcard, non_exts)\n\n (file_with_extension + file_with_no_extension).sort\n end", "def findPaths (conf)\n puts aktTime()+' collecting files...'\n STDOUT.flush #write out immediately\n\tconf[:saveDirs].each do |d|\n\t\tif File.directory?(d)\n\t\t\tDir.chdir(d)\n\t\t\tgetFiles(conf)\n\t\telse\n\t\t\tputs \"\\nWarning: Directory: \\n\"+d+\" **not** found !\"\n\t\tend\n\tend\nend", "def all_files\n loc_pat = File.join(@base, '**/*')\n Dir.glob(loc_pat, File::FNM_DOTMATCH)\n .select { |e| File.file?(e) }\n .map { |f| f[@base.size + 1..-1] }\n end", "def list_files(options = {}) \n options = DEFAULTS.merge(options)\n\n path = options[:path]\n all = options[:all]\n extension = options[:extension]\n\n extension = \".#{extension}\" unless extension == '' or extension.start_with?('.') \n file_wildcard = \"*#{extension}\"\n\n path = \"#{path}/\" unless path == '' or path.end_with?('/')\n path = path+'**/' if all \n\n Dir.glob(\"#{path}#{file_wildcard}\")\n end", "def find_files( config )\n files = []\n config.each do |c|\n Config.verify_config_dirs( c )\n\n dir = c[\"directory\"].chomp(\"/\")\n recursive = Config.convert_yaml_bools( c[\"recursive\"] ) \n \n if File.directory? dir \n unless recursive\n Dir.glob( \"#{dir}/*\" ).each do |d|\n files << d unless File.directory? d or File.symlink? d\n end\n else\n Dir.glob(\"#{dir}/**/*\").each do |d|\n files << d unless File.directory? d or File.symlink? d \n end \n end\n else\n Dir.glob( dir ).each do |d|\n files << d \n end\n end\n end\n files\nend", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def get_files(src)\n files = Array.new\n if File.directory? src\n Find.find(src) do |path|\n next if File.directory? path\n files.push path\n end\n else\n log(\"error: source directory of \\\"#{src}\\\" does not exist!\")\n exit 2\n end\n files.reverse\nend", "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 scan\n results = []\n dirs.each do |dir|\n files_in_dir = Dir.glob(File.join(dir,'**','*'))\n results.concat(files_in_dir)\n end\n @known_files = results\n end", "def find_files_not(sort)\n files = []\n Find.find(sort) do |path|\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if (tv_file File.basename(path))\n files << path\n end\n files\nend", "def all_files_in(dir_name)\n Nanoc::FilesystemTools.all_files_in(dir_name)\n end", "def ls\n table Dir.entries( Dir.pwd ).reject { |f| f.match /^\\..*$/ }\n end", "def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend", "def _find_files(*paths)\n paths.flatten.map do |path|\n path = Pathname.new(path)\n path.file? ? [path.to_s] : _find_files(path.children)\n end.flatten\n end", "def find_files_recursive (base_directory, relative_path)\n result = []\n directory = File.join(base_directory, relative_path)\n Dir.foreach(directory) do |file|\n relative_file = relative_path.empty? ? file : File.join(relative_path, file)\n if matchesFilters(file, relative_file)\n full_path = File.join(base_directory, relative_file)\n if File.directory?(full_path)\n result = result + find_files_recursive(base_directory, relative_file)\n else\n result << relative_file\n end\n end\n end\n result\n end", "def search(query, page = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def enumerate_files search_path\n Enumerator.new do |e|\n Dir\n .glob(search_path)\n .each do |filename|\n if File.file?(filename)\n $stderr.puts \"Reading #{filename}\" if $verbose\n File.open filename do |file|\n e.yield file.read()\n end\n end\n end\n end\nend", "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n\n result = Overcommit::Utils.execute(%W[git ls-tree --name-only #{ref}], args: paths)\n unless result.success?\n raise Overcommit::Exceptions::Error,\n \"Error listing files. EXIT STATUS(es): #{result.statuses}.\\n\" \\\n \"STDOUT(s): #{result.stdouts}.\\n\" \\\n \"STDERR(s): #{result.stderrs}.\"\n end\n\n result.stdout.split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def ls( *args )\r\n \r\n directory = nil\r\n opts = {}\r\n \r\n case args.count\r\n when 1\r\n if args[0].kind_of? Hash\r\n opts = args[0]\r\n else\r\n directory = args[0]\r\n end\r\n when 2\r\n directory = args[0]\r\n opts = args[1] \r\n end\r\n \r\n # args are the RPC arguments ...\r\n args = {}\r\n args[:path] = directory if directory\r\n args[:recursive] = true if opts[:recurse]\r\n args[:detail] = true if opts[:detail] \r\n args.delete(:detail) if( args[:detail] and args[:recursive])\r\n \r\n # RPC output format, default is XML\r\n outf = { :format => 'text' } if opts[:format] == :text\r\n \r\n got = @ndev.rpc.file_list( args, outf )\r\n return nil unless got\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n # if we're here, then we need to conver the output \r\n # to a Hash. Joy!\r\n \r\n collect_detail = args[:detail] || args[:recursive]\r\n \r\n ls_hash = {}\r\n got.xpath('directory').each do |dir|\r\n \r\n dir_name = dir.xpath('directory-name').text.strip\r\n dir_hash = {}\r\n \r\n dir_hash[:fileblocks] = dir.xpath('total-file-blocks').text.to_i\r\n files_info = dir.xpath('file-information')\r\n \r\n dir_hash[:files] = {} \r\n dir_hash[:dirs] = {} # sub-directories\r\n \r\n files_info.each do |file|\r\n f_name = file.xpath('file-name').text.strip\r\n f_h = {} \r\n \r\n if file.xpath('file-directory')[0]\r\n dir_hash[:dirs][f_name] = f_h\r\n else\r\n dir_hash[:files][f_name] = f_h \r\n end\r\n \r\n next unless collect_detail\r\n \r\n f_h[:owner] = file.xpath('file-owner').text.strip\r\n f_h[:group] = file.xpath('file-group').text.strip\r\n f_h[:links] = file.xpath('file-links').text.to_i\r\n f_h[:size] = file.xpath('file-size').text.to_i\r\n \r\n xml_when_item(file.xpath('file-symlink-target')) { |i|\r\n f_h[:symlink] = i.text.strip\r\n }\r\n \r\n fp = file.xpath('file-permissions')[0]\r\n f_h[:permissions_text] = fp.attribute('format').value\r\n f_h[:permissions] = fp.text.to_i\r\n \r\n fd = file.xpath('file-date')[0]\r\n f_h[:date] = fd.attribute('format').value\r\n f_h[:date_epoc] = fd.text.to_i\r\n \r\n end # each directory file\r\n ls_hash[ dir_name ] = dir_hash \r\n end # each directory\r\n \r\n return nil if ls_hash.empty?\r\n ls_hash\r\n end", "def dir_files(dir)\n Find.find(dir).to_a.reject!{|f| File.directory?(f) }\nend", "def find\n results = [] unless block_given?\n # paths = @path.is_a?(String) ? [@path] : @path\n\n begin\n exclude_dir_regex = @exclude_dir\n rescue => ex\n puts \"--exclude_dir regex Skipping, #{ex.message}\"\n exit\n end\n\n begin\n file_regex = (Regexp.new(@regex) if @regex)\n rescue => ex\n puts \"--rname regex : Skipping, #{ex.message}\"\n exit\n end\n\n recursively_find_file(exclude_dir_regex, path, results, file_regex)\n\n block_given? ? nil : results\n end", "def find_files(*paths)\n Find.find(*paths).select do |path|\n File.file?(path)\n end\n end", "def files() = files_path.glob('**/*')", "def query\n parent_folders = @pattern.split('/')[0..-2]\n parent_folders << '*' if parent_folders[-1] != '*'\n File.join(*parent_folders)\n end", "def find_repository_and_basepath\n # zuerst lesen wir den Startpfad aus der Datei ein\n unless File.exists?(PATH_TMP_FILE) and (@basepath=IO.read(PATH_TMP_FILE).strip)\n NSRunInformationalAlertPanel('Invalid start directory!',\n \"No directory information could be found in the configuration file '#{PATH_TMP_FILE}'!\",\n 'OK',nil,nil)\n NSApp.stop(self)\n end\n\n # jetzt gehen wir max. 5 Ebenen nach oben und suchen\n # nach einem Rakefile im Verzeichnis\n path=@basepath\n (0..5).each do |step|\n Dir.entries(path).each do |entry|\n return path if entry=~/^(.git|.hg)$/\n end\n path+=\"/..\"\n end\n\n # no reasonable rakefile was found, let's just use\n # the current directory for the files\n @basepath # Dir.pwd\n end", "def search(*dirs)\n Options[:custom_dir] += dirs\n nil\n end", "def all_matching_files\n @all_matching_files ||= find_files\n end", "def all_matching_files\n @all_matching_files ||= find_files\n end", "def target_files_in_dir(base_dir = T.unsafe(nil)); end", "def files_in(dir)\n Dir.chdir(dir) do\n Dir.glob('**/*').select { |f| File.file?(f) }\n end\nend", "def retrieve_dirs(_base, dir, dot_dirs); end", "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "def find_files(levels=[\"0\"],up_to=300)\n\tarr = []\n\tnames = []\n\t(0...up_to).each do |i|\n\t\tlevels.each do |j|\n\t\t\tif (File.exists?(\"../scraper_and_data/scraped_genomes/level_\" + j + \"/\"+i.to_s))\n\t\t\t\tarr << \"../scraper_and_data/scraped_genomes/level_\" + j + \"/\"+i.to_s\n\t\t\t\tnames << i.to_s\n\t\t\tend\n\t\tend\n\tend\n\treturn arr,names\nend", "def search_filenames\n # * => all files\n # r => search from its subdirectories\n # i => ignore cases\n # l => list file name\n # c => show word occurence count\n # w => words\n\n args = set_args\n # grep -ril '#keyword1' --include=\\*.rb *\n `grep -ril '#{args}' #{search_extension} *`\n end", "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "def process()\n scan_dir('.', '.')\n end", "def find\n list = Dir.glob(File.join(@pages_folder, '**/*'))\n list.map! { |name| name.gsub(@pages_folder + '/', '')}\n list.map { |name| name.force_html_extension }\n end", "def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end", "def list_files_from path,opts = {}\n unless Dir.exists? path\n Logger.<<(__FILE__,\"ERROR\",\"Local fetcher: path does not exists for listing... #{path} \")\n raise \"Error LocalFileFetcher !\"\n end\n if opts[:directories]\n cmd = \"ls -td #{path}/*/\"\n else\n cmd = \"ls #{path}\"\n cmd += \"/#{opts[:regexp]}\" if opts[:regexp]\n end\n out = `#{cmd}`\n return out.split(\"\\n\")\n end", "def search_in(options)\n files = options[:for_files]\n directory = options[:directory]\n if directory\n dir_files = files_in_directory(directory)\n files.select { |file| dir_files.include?(file) }\n else\n files\n end\n end", "def ls dir,regex = \"\"\n cmd = regex.empty? ? \"ls #{dir}\" : \"ls #{File.join(dir,regex)}\"\n exec_cmd(cmd) \n end", "def sub_listing switch\n path = ::File.join(@source.base_dir,switch)\n folders = folders_listing path\n folders = folders_filtering folders\n files = []\n folders.each do |folder|\n files += files_listing folder\n end\n files\n end", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def command_find(prefix)\n items = @database.find_matches(prefix)\n items.each { |i|\n puts i.to_s\n }\n end" ]
[ "0.6947323", "0.66125506", "0.6553254", "0.65213066", "0.636708", "0.6217633", "0.61417025", "0.59928054", "0.5979982", "0.59361076", "0.5914705", "0.57880175", "0.5741297", "0.5728098", "0.5701846", "0.56588197", "0.5651589", "0.5610105", "0.5595152", "0.55942845", "0.5586856", "0.5543625", "0.5535018", "0.5532217", "0.5532217", "0.54774696", "0.5462468", "0.54504937", "0.5424625", "0.53912055", "0.53892785", "0.5373938", "0.537391", "0.53693587", "0.5354702", "0.53153294", "0.5306527", "0.53028244", "0.5293236", "0.52928674", "0.527804", "0.52666014", "0.5262448", "0.52585655", "0.5245943", "0.5231214", "0.52300334", "0.5215242", "0.5215242", "0.52138823", "0.5207013", "0.51796937", "0.517481", "0.5174467", "0.51682615", "0.51594347", "0.5158946", "0.51487845", "0.5144047", "0.51348376", "0.5132598", "0.5132598", "0.5130311", "0.51252097", "0.51242775", "0.5119456", "0.511348", "0.50838035", "0.5080741", "0.507988", "0.5079203", "0.5069709", "0.5048444", "0.5040215", "0.5038449", "0.50342673", "0.5027785", "0.501485", "0.50133127", "0.5012141", "0.50106573", "0.5002635", "0.49983346", "0.49983346", "0.49855936", "0.49666548", "0.49658054", "0.49629688", "0.49611732", "0.4959257", "0.4951367", "0.49498057", "0.49409956", "0.4937733", "0.4937482", "0.4936192", "0.49334788", "0.49243847", "0.4922438", "0.49218252" ]
0.7599086
0
List file hashes by executing the command to hash each file on the output of the find command which lists all files, and parse the output. N Without this, would not be able to list all the files in the base directory and the hashes of their contents (as part of getting the content tree)
def listFileHashes(baseDir) #N Un-normalised, an off-by-one error would occur when 'subtracting' the base dir off the full paths to get relative paths baseDir = normalisedDir(baseDir) #N Without this, we would have nowhere to accumulate the file hash objects fileHashes = [] #N Without this, we would not be executing and parsing the results of the file-listing command listFileHashLines(baseDir) do |fileHashLine| #N Without this, we would not be parsing the result line containing this file and its hash value fileHash = self.hashCommand.parseFileHashLine(baseDir, fileHashLine) #N Without this check we would be accumulating spurious nil values returned from listFileHashLines (even though listFileHashLines doesn't actually do that) if fileHash != nil #N Without this, we would fail to include this file & hash in the list of file hashes. fileHashes << fileHash end end return fileHashes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listFileHashes\n return contentHost.listFileHashes(baseDir)\n end", "def listFileHashLines(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this, we wouldn't know what command to run remotely to loop over the output of the file-files command and run the hash command on each line of output\n remoteFileHashLinesCommand = findFilesCommand(baseDir) + [\"|\", \"xargs\", \"-r\"] + @hashCommand.command\n #N Without this we wouldn't actually run the command just defined\n ssh(remoteFileHashLinesCommand.join(\" \")) do |line| \n #N Without this the line of output wouldn't be echoed to the user\n puts \" #{line}\"\n #N Without this the line of output (with a file name and a hash value) wouldn't be available to the caller of this method\n yield line \n end\n end", "def contents_hash(paths)\n return if paths.nil?\n\n paths = paths.compact.select { |path| File.file?(path) }\n return if paths.empty?\n # rubocop:disable GitHub/InsecureHashAlgorithm\n paths.sort\n .reduce(Digest::XXHash64.new, :file)\n .digest\n .to_s(16) # convert to hex\n # rubocop:enable GitHub/InsecureHashAlgorithm\n end", "def file_list(hash)\n\nend", "def file_list(hash)\n\nend", "def files_digest(paths)\n self.digest(paths.map { |path| self.file_digest(path) })\n end", "def files_digest(paths)\n digest(paths.map { |path| file_digest(path) })\n end", "def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend", "def files_commits(num_commits)\n @repo = Grit::Repo.new(@directory)\n related_files = []\n commits_all(num_commits) do |commits|\n commits.each do |commit|\n paths = []\n begin\n commit.diffs.each do |diff|\n if diff.a_path != diff.b_path\n related_files += [[diff.a_path, diff.b_path]]\n end\n paths += [diff.a_path, diff.b_path]\n end\n rescue Grit::Git::GitTimeout\n puts \"Failed to diff for %s\" % commit.sha\n end\n paths.uniq!\n yield commit, paths, related_files\n end\n end\n end", "def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end", "def manifested_files\n\n manifest_files.inject([]) do |acc, mf|\n\n files = open(mf) do |io|\n\n io.readlines.map do |line|\n digest, path = line.chomp.split /\\s+/, 2\n path\n end\n\n end\n\n (acc + files).uniq\n end\n\n end", "def list_files(env, res, tag, path)\n files = []\n git(\"ls-tree\", \"-z\", \"#{tag}:#{path}\") do |io|\n io.each_line(\"\\0\") do |line|\n line.chomp!(\"\\0\")\n #STDERR.puts line\n info, file = line.split(/\\t/, 2)\n mode, type, object = info.split(/ /)\n files << {\n :mode => mode,\n :type => type,\n :object => object,\n :file => file,\n }\n end\n end\n files = files.sort_by{|h| h[:file] }\n E_list_files.result(binding)\n end", "def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, type) = info.split\n hsh[file] = {:path => file, :mode_file => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_file => sha_src, :sha_index => sha_dest, :type => type}\n end\n hsh\n end", "def file_ids_hash\n if @file_ids_hash.blank?\n # load the file sha's from cache if possible\n cache_file = File.join(self.path,'.loopoff')\n if File.exists?(cache_file)\n @file_ids_hash = YAML.load(File.read(cache_file))\n else\n # build it\n @file_ids_hash = {}\n self.loopoff_file_names.each do |f|\n @file_ids_hash[File.basename(f)] = Grit::GitRuby::Internal::LooseStorage.calculate_sha(File.read(f),'blob')\n end\n # write the cache\n File.open(cache_file,'w') do |f|\n f.puts YAML.dump(@file_ids_hash) \n end\n end \n end\n @file_ids_hash\n end", "def sha256(files)\n sha = Digest::SHA2.new\n files.each do |f|\n next if File.directory?(f)\n\n content = File.binread(f)\n # work around possible git checkout issues by removing CR and LF from the file\n content.gsub!(\"\\n\", \"\")\n content.gsub!(\"\\r\", \"\")\n sha << content\n end\n sha.hexdigest\n end", "def manifested_files\n manifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n decode_filename(path)\n end\n }\n\n (acc + files).uniq\n end\n end", "def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, status) = info.split\n hsh[file] = {:path => file, :mode_repo => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_repo => sha_src, :sha_index => sha_dest, :status => status}\n end\n hsh\n end", "def compute_checksums data\n\n digest = OpenSSL::Digest::Digest.new('sha256')\n tree_digest = OpenSSL::Digest::Digest.new('sha256')\n tree_parts = []\n\n until data.eof?\n\n chunk = data.read(1024 * 1024) # read 1MB\n tree_parts << tree_digest.update(chunk).digest\n tree_digest.reset\n\n digest.update(chunk)\n\n end\n\n data.rewind\n\n [digest.to_s, compute_tree_hash(tree_parts)]\n\n end", "def ls( *args )\r\n \r\n directory = nil\r\n opts = {}\r\n \r\n case args.count\r\n when 1\r\n if args[0].kind_of? Hash\r\n opts = args[0]\r\n else\r\n directory = args[0]\r\n end\r\n when 2\r\n directory = args[0]\r\n opts = args[1] \r\n end\r\n \r\n # args are the RPC arguments ...\r\n args = {}\r\n args[:path] = directory if directory\r\n args[:recursive] = true if opts[:recurse]\r\n args[:detail] = true if opts[:detail] \r\n args.delete(:detail) if( args[:detail] and args[:recursive])\r\n \r\n # RPC output format, default is XML\r\n outf = { :format => 'text' } if opts[:format] == :text\r\n \r\n got = @ndev.rpc.file_list( args, outf )\r\n return nil unless got\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n # if we're here, then we need to conver the output \r\n # to a Hash. Joy!\r\n \r\n collect_detail = args[:detail] || args[:recursive]\r\n \r\n ls_hash = {}\r\n got.xpath('directory').each do |dir|\r\n \r\n dir_name = dir.xpath('directory-name').text.strip\r\n dir_hash = {}\r\n \r\n dir_hash[:fileblocks] = dir.xpath('total-file-blocks').text.to_i\r\n files_info = dir.xpath('file-information')\r\n \r\n dir_hash[:files] = {} \r\n dir_hash[:dirs] = {} # sub-directories\r\n \r\n files_info.each do |file|\r\n f_name = file.xpath('file-name').text.strip\r\n f_h = {} \r\n \r\n if file.xpath('file-directory')[0]\r\n dir_hash[:dirs][f_name] = f_h\r\n else\r\n dir_hash[:files][f_name] = f_h \r\n end\r\n \r\n next unless collect_detail\r\n \r\n f_h[:owner] = file.xpath('file-owner').text.strip\r\n f_h[:group] = file.xpath('file-group').text.strip\r\n f_h[:links] = file.xpath('file-links').text.to_i\r\n f_h[:size] = file.xpath('file-size').text.to_i\r\n \r\n xml_when_item(file.xpath('file-symlink-target')) { |i|\r\n f_h[:symlink] = i.text.strip\r\n }\r\n \r\n fp = file.xpath('file-permissions')[0]\r\n f_h[:permissions_text] = fp.attribute('format').value\r\n f_h[:permissions] = fp.text.to_i\r\n \r\n fd = file.xpath('file-date')[0]\r\n f_h[:date] = fd.attribute('format').value\r\n f_h[:date_epoc] = fd.text.to_i\r\n \r\n end # each directory file\r\n ls_hash[ dir_name ] = dir_hash \r\n end # each directory\r\n \r\n return nil if ls_hash.empty?\r\n ls_hash\r\n end", "def buildCodeFilesHashFromFiles()\n\t\tdir = @cacheDirPath \n\t\tfilesList = Dir.glob(dir + \"**/*\").select{|e| File.file? e}\n\t\tfilesList.map.with_index{|file,index|\n\t\t\t#p \"cacheFile: \" + index.to_s if index % 1000 == 0\n\t\t\tp \"cacheFile: \" + index.to_s \n\t\t\tfilePath = dir + index.to_s + \".yaml\"\n\t\t\tfile = File.read(filePath)\n\t\t\tYAML.load(file)\n\t\t}.to_h\n\tend", "def dirHash(directory, regexp)\n directory = Pathname.new(directory)\n contents = \"\"\n Dir.foreach(directory) {\n | entry |\n if entry =~ regexp\n contents += IO::read(directory + entry)\n end\n }\n return Digest::SHA1.hexdigest(contents)\nend", "def recurse_and_hash_tree(node)\n\n ## exit program if given a bunk file/dir\n print_and_exit \"given a bunk file/node\" unless File.exist? node\n\n ## if we have a file then return it's hash\n return Digest::MD5.hexdigest( node + File.read(node) ) if File.file? node\n\n ## we should have a directory now. exit otherwise...\n print_and_exit \"is there a strange device in this dir?\" unless File.directory? node\n\n ## recurse through each element in the directory and remember their hashes\n children_hash = \"\"\n Dir.glob(File.join node, '*' ) { |element| children_hash << recurse_and_hash_tree(element) }\n \n ## return the mashed up hash\n return Digest::MD5.hexdigest( node + children_hash ) \n\n end", "def hash(pathname)\n ext = pathname.extname\n ext = ('' == ext || nil == ext) ? :none : ext.to_sym\n digest = Digest::MD5.hexdigest(File.read(pathname.to_s))\n @scanned[ext] ||= {}\n @scanned[ext][digest] ||= []\n @scanned[ext][digest] << pathname\n end", "def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end", "def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend", "def digests_for(path)\n\t\t\ttotal = 0\n\n\t\t\[email protected] do |key, digest|\n\t\t\t\tdigest.reset\n\t\t\tend\n\n\t\t\tFile.open(path, \"rb\") do |file|\n\t\t\t\tbuffer = \"\"\n\t\t\t\twhile file.read(1024 * 1024 * 10, buffer)\n\t\t\t\t\ttotal += buffer.bytesize\n\t\t\t\t\t\n\t\t\t\t\[email protected](total) if @progress\n\t\t\t\t\t\n\t\t\t\t\[email protected] do |key, digest|\n\t\t\t\t\t\tdigest << buffer\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tmetadata = {}\n\t\t\t\n\t\t\[email protected] do |key, digest|\n\t\t\t\tmetadata[\"key.\" + key] = digest.hexdigest\n\t\t\tend\n\t\t\t\n\t\t\treturn metadata\n\t\tend", "def all_files\n @all_files ||= `git ls-files 2> /dev/null`.split(\"\\n\")\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def find_md5(dir, excludes)\n found = []\n (Dir.entries(dir) - %w[. ..]).map { |e| File.join(dir, e) }.each do |path|\n if File.directory?(path)\n unless exclude?(excludes, path)\n found += find_md5(path, excludes)\n end\n elsif File.file?(path)\n if (file = new(path))\n unless exclude?(excludes, file.path)\n file.md5 = Digest::MD5.file(file.path).hexdigest\n found << file\n end\n end\n end\n end\n found\n end", "def list_files\n Find.find(path) do |element| yield element end\n end", "def find_similar_files\n \"SELECT * FROM files \n WHERE md5 = md5 AND sha1 = sha1 AND size = size\n GROUP BY md5, sha1, size\"\n end", "def list_files_from (path,opts = {})\n safe_fetch do\n list_files = Set.new\n var = \"Search in #{path} at #{@host}... \"\n cmd = \"find #{path}\"\n cmd = \"(cd #{path} && ls \" ### dont know why cd alone doesn't work\n cmd << \"-td */\" if opts[:directories]\n cmd << opts[:regexp] if opts[:regexp]\n cmd << \" 2>/dev/null)\"\n out = @ssh.exec!(cmd)\n list_files = out.split\n list_files = out.split(\"/\\n\") if opts[:directories]\n\n var << \"Found #{list_files.size} entries\\n\"\n Logger.<<(__FILE__,\"INFO\",var)\n list_files\n end\n end", "def create_list_of_files\n @path=find_repository_and_basepath\n @table.window.setTitle(@path)\n files=[]\n Find.find(@path) do |file|\n # we don't want any files from a repository in the list \n next if file=~/(\\.hg|\\.svn|\\.git|\\.pyc)/ \n\n # neither do we want dotfiles in the list\n next if File.basename(file)=~/^\\./ \n \n # file matches, add it to the resulting list\n files << file if FileTest.file?(file)\n\n # wir bauen hier mal einen kleinen Idiotentest ein. Wenn wir mehr\n # als 10000 Dateien gefunden haben dann sind wir vermtl. in einem \n # falschen Verzeichniss und brechen die Suche ab.\n if files.length>10000\n NSRunInformationalAlertPanel('Large directory found!',\n \"Gathered more than 10k files from directory '#{@path}', aborting search!\",'OK',nil,nil)\n NSApp.stop(self)\n raise 'error'\n end\n end\n #@files=files.sort_by { |match| File.basename(match) }\n @files=files.sort\n end", "def path_hash(path)\n if File.exist?(path)\n %x{\n { cd cookbooks;\n export LC_ALL=C;\n find #{path} -type f -exec md5sum {} + | sort; echo;\n find #{path} -type d | sort;\n find #{path} -type d | sort | md5sum;\n } | md5sum\n }.split(' ', 2).first\n end\n end", "def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end", "def load_checksums\n result = []\n\n @pkgdb.query(\"select md5, sha1, sha256 from checksums where basename = '#{@basename}' and mtime = '#{@mtime.iso8601}' and suitename = '#{@suitename}'\").each do |row|\n result = row\n end\n result\n end", "def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end", "def file_hashes\n @file_hashes ||= file_field_sets.map do |file_field_set|\n instantiation_fields, file_fields = file_field_set.partition do |field|\n instantiation_header?(field.header)\n end\n\n file_hash = fields_to_hash(file_fields)\n file_hash['files'] = [fields_to_hash(instantiation_fields)]\n\n file_hash\n end\n end", "def applicable_owners_files_hash\n return @applicable_owners_files_hash if !@applicable_owners_files_hash.nil?\n\n # Make hash of (directory => [files in that directory in this commit]) pairs\n\n puts \"changed files: #{changed_files.inspect}\"\n\n affected_dirs_hash = changed_files.collect_to_reverse_hash do |file|\n File.dirname(file)\n end\n\n puts \"affected_dirs_hash: #{affected_dirs_hash.inspect}\"\n\n affected_dirs = affected_dirs_hash.keys\n\n # Make hash of owners file => [file1, file2, file3]\n res = affected_dirs.inject(Hash.new) do |hash, dir|\n owner = find_owners_file(dir)\n\n # If there's no OWNERS file for this dir, just skip it\n if owner.nil?\n return hash\n end\n\n data = {\n :owner_data => owner,\n :files => affected_dirs_hash[dir]\n }\n\n key = owner[:path]\n\n if (hash.include?(key))\n combined_data = hash[key]\n combined_data[:files] = combined_data[:files] + data[:files]\n\n hash[key] = combined_data\n else\n hash[key] = data\n end\n hash\n end \n\n @applicable_owners_files_hash = res\n end", "def enumerate_scripts\n Dir.glob(\"**/*\").\n reject { |f| File.directory?(f) }.\n select { |f| File.extname(f) == \".rb\" }.\n map do |filename|\n stat = File.stat(filename)\n\n OpenStruct.new(\n id: SecureRandom.uuid,\n path: filename,\n absolute_path: File.expand_path(filename),\n virtual_url: \"#{ROOT_URL}/#{filename}\",\n size: stat.size,\n last_modified_time: stat.mtime\n )\n end\n end", "def digest_sha2(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::SHA2.hexdigest(File.read(file)) : nil\n }\n end", "def disk_hash_tree\n tree_size = SpStore::Merkle::HashTreeHelper.full_tree_node_count @blocks\n node_hashes = Array.new(tree_size+1)\n File.open(disk_hash_file, 'rb') do |file|\n file.seek(hash_byte_size, IO::SEEK_SET)\n (1..tree_size).each do |idx|\n node_hashes[idx] = file.read(hash_byte_size)\n end\n end\n node_hashes\n end", "def processFile dir\n\tdir.each do |file|\n\t\tif File.directory?(file) then next;\n\t\t\telse \n\t\t\t\th = {File.basename(file) => getHash(file)}\n\t\t\t\[email protected]!(h)\n\t\tend\n\tend\n\t@hash\nend", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def get_checksums(commit)\n # Reset @currenthash\n @currenthash = Hash.new\n path = find_relative_git_cookbook_path\n #puts \"path is '#{path}' commit hash is #{commit}\"\n #puts \"commit.tree is #{commit.tree}\"\n unless path == '.'\n tree = commit.tree / path\n git_checksum_hash(tree)\n else\n git_checksum_hash(commit.tree)\n end\n end", "def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend", "def git_grep\n # grep on the root object implies searching on HEAD\n grep = @repo.grep(query, nil, ignore_case: true)\n grep.map do |treeish, matches|\n _sha, filename = treeish.split(':', 2)\n SearchResult.new(filename, @score, *matches)\n end.sort\n end", "def fetch_commit_hash_list()\n `git rev-list --all --reverse`.strip.split(/\\n/)\nend", "def hash_file(filename)\n file = File.read(filename)\n tlsh_hash(file.bytes)\n end", "def content_of file:, for_sha:\n result = output_of \"git show #{for_sha}:#{file}\"\n result = '' if result == default_file_content_for(file)\n result\nend", "def get_changed_file_list\n command = \"git log -m -1 --name-only --pretty='format:' $(git rev-parse origin/master)\"\n file_paths = []\n features = {}\n features.compare_by_identity\n\n Open3.popen3(command) do |stdin, stdout, stderr|\n files = stdout.read.gsub! \"\\n\", \",\"\n file_paths = files.split(\",\")\n puts \"Found files:\\n#{file_paths}\"\n end\n\n puts \"Count files in push: #{file_paths.count}\"\n\n file_paths.each do |file_path|\n if file_path.include?(\".feature\")\n puts \"Added: #{file_path}\"\n folder = get_name_folder_from_path file_path\n features.store(folder, file_path)\n end\n end\n\n puts \"\\n\"\n puts \"Count feature files: #{features.count}\"\n features.sort\nend", "def find_s3_files\n output = `s3cmd ls #{self.location}/`\n output.gsub!(/DIR/,\"\")\n output.gsub!(/ +/,\" \")\n dir_listing = output.split(/\\n/)\n logger.debug(\"dir_listing #{dir_listing.inspect}\")\n files = Hash.new\n dir_listing.each do |list|\n if (list.match(/^ /)) then\n # found a directory - not going to worry about going down the directory for now\n else\n # found a file\n (date, time, size, path) = list.split(/ /)\n filename = File.basename(path).split(\"/\").last\n FILE_TYPES.each { |filepart, filehash| \n type = filehash[\"type\"]\n vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.debug( \"filename is #{filename}\")\n files[type] = Hash.new\n files[type][\"path\"] = path\n files[type][\"vendor\"] = vendor\n end\n }\n end\n end\n logger.debug(\" files is #{files.inspect}\")\n return files\n end", "def hash *args, &block\n command \"hash\", args.join(\"/\"), &block\n end", "def get_committed_files\n # set the current branch name to be the current branch you're on --> need to check that this works as part of push\n curr_branch_name = `git rev-parse --abbrev-ref HEAD`\n\n # raw_sha_list lists all the local, unpushed commit SHAs from your current branch\n raw_sha_list = `git log --graph --pretty=format:'%H' #{curr_branch_name}`\n\n committed_files = []\n # loop through the raw_sha_list and push properly formatted SHAs into the all_shas arr\n raw_sha_list.each_line { |sha|\n # using the .tr method on the sha makes a copy of the sha and replaces instances that matches with the to_str (second arg),\n # unless the range starts with a ^ carrot, in which case, it replaces on matches outside the range\n curr_sha = sha.tr('^A-Za-z0-9', '')\n\n # this `git diff-tree --no-commit-id --name-only -r <SHA>` will list the files of an individual commit when you add the SHA\n # on each iteration, set the changed_files variable to be the list of files from a particular commit, based its SHA\n changed_files = `git diff-tree --no-commit-id --name-only -r #{curr_sha}`\n\n # loop over the changed_files and add in each file that's part of a commit and add into the committed_files arr\n changed_files.each_line { |file|\n # remove any trailing whitespace from the file name and add into our arr\n committed_files << file.rstrip()\n }\n }\n # return the final, no-repeat array of committed files in this push\n return committed_files.uniq\nend", "def files_listing path\n cmd = \"find #{path} -type f \"\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@file_regexp}\\\" \" if @file_regexp\n out = exec_cmd(cmd)\n end", "def tag_manifested_files\n tagmanifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n path\n end\n }\n (acc + files).uniq\n end\n end", "def hash\n return (path + file_id.to_s).hash\n end", "def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend", "def diff_files_from(commit)\n git_args = ['diff', '--stat', '--name-only', commit]\n result = default_repository.git_output(git_args).lines.map { |line| line.strip }.sort\n # not sure if git would ever mention directories in a diff, but ignore them.\n result.delete_if { |item| ::File.directory?(item) }\n return result\n end", "def hash_file path, hash_store\r\n\thexdigest = HASH_DIGEST.hexdigest(open(path, 'rb') { |io| io.read })\r\n\thash_store[hexdigest] << path\r\nend", "def hashDirectory(directory)\n count = 0\n hash = {}\n Dir.foreach(directory) do |item|\n next if item == '.' || item == '..'\n hash[count] = item\n count = count + 1\n end\n hash\nend", "def files_in branch:\n array_output_of(\"git ls-tree -r --name-only #{branch}\")\nend", "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "def list_files dir='*', sorto=@sorto, hidden=@hidden, _filter=@filterstr\n dir += '/*' if File.directory?(dir)\n dir = dir.gsub('//', '/')\n\n # decide sort method based on second character\n # first char is o or O (reverse)\n # second char is macLn etc (as in zsh glob)\n so = sorto ? sorto[1] : nil\n func = case so\n when 'm'\n :mtime\n when 'a'\n :atime\n when 'c'\n :ctime\n when 'L'\n :size\n when 'n'\n :path\n when 'x'\n :extname\n end\n\n # sort by time and then reverse so latest first.\n sorted_files = if hidden == 'D'\n Dir.glob(dir, File::FNM_DOTMATCH) - %w[. ..]\n else\n Dir.glob(dir)\n end\n\n # WARN: crashes on a deadlink since no mtime\n if func\n sorted_files = sorted_files.sort_by do |f|\n if File.exist? f\n File.send(func, f)\n else\n sys_stat(func, f)\n end\n end\n end\n\n sorted_files.sort! { |w1, w2| w1.casecmp(w2) } if func == :path && @ignore_case\n\n # zsh gives mtime sort with latest first, ruby gives latest last\n sorted_files.reverse! if sorto && sorto[0] == 'O'\n\n # add slash to directories\n sorted_files = add_slash sorted_files\n # return sorted_files\n @files = sorted_files\n calculate_bookmarks_for_dir # we don't want to override those set by others\nend", "def get_checksums(gf_pid, gf_identifier)\n query = \"SELECT algorithm, datetime, digest, generic_file_id \" +\n \"FROM checksums where generic_file_id = ?\"\n if @checksum_query.nil?\n @checksum_query = @db.prepare(query)\n end\n checksums = []\n result_set = @checksum_query.execute(gf_pid)\n result_set.each_hash do |row|\n cs = {}\n cs['algorithm'] = row['algorithm']\n cs['datetime'] = row['datetime']\n cs['digest'] = row['digest']\n checksums.push(cs)\n end\n checksums\n end", "def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end", "def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end", "def digest_md5(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::MD5.hexdigest(File.read(file)) : nil\n }\n end", "def rec_output(match, out=$stdout)\n out.flush\n #match = (location == dir ? '*' : File.join(dir,'*'))\n files = Dir.glob(match) - exclusions\n files.sort!\n files.each do |file|\n sum = checksum(file,digest)\n sum = sum + ' ' if sum\n out << \"#{sum}#{file}\\n\"\n if File.directory?(file)\n rec_output(File.join(file,'*'), out)\n end\n end\n #return out\n end", "def checksum\n render json: content_files_checksums(druid).to_json\n end", "def hash\n raise NotImplementedError.new(\"hash() must be implemented by subclasses of AbstractVersionedFile.\")\n end", "def file_digest(path)\n if stat = self.stat(path)\n self.stat_digest(path, stat)\n end\n end", "def snapshots\n return @snapshots if @snapshots\n\n @snapshots = []\n @files.each do |f|\n io = File.open(f)\n\n begin\n @parser.read(io)\n @snapshots << @parser.snapshot\n rescue EOFError => e\n puts \"#{e.inspect}\\n#{f}\"\n end\n end\n\n return @snapshots\n end", "def get_tree_sha(dir)\n get_trees['tree'].find { |t| t['path'] == dir }['sha']\n end", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n def lslr(tree, path = '')\n all_files = []\n for f in tree.map{|x| x}\n f[:path] = path + '/' + f[:name]\n if f[:type] == :tree\n begin\n all_files << lslr(repo.lookup(f[:oid]), f[:path])\n rescue Exception => e\n STDERR.puts e\n all_files\n end\n else\n all_files << f\n end\n end\n all_files.flatten\n end\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n begin\n files = lslr(repo.lookup(base_commit).tree)\n files.select{|x| filter.call(x)}\n rescue Exception => e\n STDERR.puts \"Cannot find commit #{base_commit} in base repo\"\n []\n end\n end", "def files_hash\n @files_hash\n end", "def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end", "def git_checksum_hash(tree, prefix=nil)\n\n tree.contents.each do |obj|\n if obj.class == Grit::Blob\n item = [prefix, obj.name].join\n @currenthash[item] = Digest::MD5.hexdigest(obj.data)\n #puts \"#{item} : \" + @currenthash[item]\n else\n git_checksum_hash(obj, [prefix, obj.name, \"/\"].join)\n end\n end\n\n return @currenthash\n end", "def files_to_analyze\n require 'find'\n ignore_dirs = ['.git','bin','test','assets','lib','log','vendor','tmp','img', 'images', 'uploads', 'fonts']\n ignore_files = Regexp.union(/^\\..*$/i, /^.*(.md)$/i, /^.*(.json)$/i, /^.*(.yml)$/i, /^.*(.log)$/i, /^.*(.png)$/i, /^.*(.jpg)$/i, /^.*(.jpeg)$/i)\n final_files = []\n # for every file in repository - keep the files to process\n Find.find('.') do |path|\n path_name = File.basename(path)\n if FileTest.directory?(path)\n if ignore_dirs.include?(path_name)\n Find.prune\n else\n next\n end\n else\n if path_name.match(ignore_files)\n next\n else\n path.gsub!(/^\\.\\//, '')\n final_files.push(path)\n end\n end\n end\n return final_files\n end", "def find_all(repo, options = {})\n refs = []\n already = {}\n Dir.chdir(repo.path) do\n files = Dir.glob(prefix + '/**/*')\n files.each do |ref|\n next if !File.file?(ref)\n id = File.read(ref).chomp\n name = ref.sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => id)\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n\n if File.file?('packed-refs')\n File.readlines('packed-refs').each do |line|\n if m = /^(\\w{40}) (.*?)$/.match(line)\n next if !Regexp.new('^' + prefix).match(m[2])\n name = m[2].sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => m[1])\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n end\n end\n end\n\n refs\n end", "def all_matching_files\n @all_matching_files ||= find_files\n end", "def all_matching_files\n @all_matching_files ||= find_files\n end", "def file_sha256\n Digest::SHA256.file(self).hexdigest\n end", "def get_files_modified\r\n\tgit_result = IO.popen('git status -u --porcelain').read\r\n\tgit_result.split(/[\\r\\n]+/).uniq.map!{|file| file.slice 3..-1}\r\nend", "def digest_sha1(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::SHA1.hexdigest(File.read(file)) : nil\n }\n end", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n files = repo.lstree(base_commit, :recursive => true)\n\n files.select{|x| filter.call(x)}\n end", "def main\n # Arguments base to be use for reference\n args = {:hash_function => 1,:compare => false, :debugmode => false, :samefolder => false, :hash => nil, :file => nil, :output_file => nil}\n # Options to be parsed\n opt = OptionParser.new\n opt.banner = \"Checksum handler; Usage: checksum.rb <options> FILE\"\n opt.on(\"-c\", \"--compare HASH/HASHDB\", \"Set the mode to compare an input hash with the FILE or to compare all hashes of the with all file inside it\") do |value|\n args[:compare] = value\n end\n opt.on('-v', '--verbose', 'Verbose mode ON') do\n args[:debugmode] = true\n end\n opt.on('-s', '--same-folder', 'Change the target file path to ./ as this script was working in the same folder; useful shareable files') do\n args[:samefolder] = true\n end\n opt.on(\"-o\", \"--output-file FILENAME\", \"Output file for the checksum (csv)\") do |value|\n args[:output_file] = value\n end\n opt.on('-5', \"--md5\", \"Use MD5 algorithm\") do\n args[:hash_function] = 5\n end\n opt.on('-1', '--sha1', 'Use SHA1 algorithm (Set by default)') do\n args[:hash_function] = 1\n end\n opt.on('-2', '--sha2 BITSLENGTH', 'Use SHA2 algorithm with your specific bit lenth can be 256, 384 or 512') do |bit_size|\n # SHA2 can have different bit sizes like 224, 256, 384, 512\n if [256, 384, 512].find bit_size.to_i\n args[:bit_size] = bit_size.to_i\n end\n args[:hash_function] = 2\n end\n opt.on('-h', '--help') do\n puts opt\n return\n end.parse!\n # Get the FILE variable\n args[:file] = ARGV.pop\n # When no target is specified\n unless args[:file]\n # iif compare mode isn't enabled\n unless args[:compare]\n puts opt\n end\n\n end\n begin\n # If the mode is set to compare\n if args[:compare]\n compare_hashes_handler args[:compare], args[:file], args[:hash_function], args[:bit_size]\n else\n # Get check sum from file\n checksum_handler args[:file], args[:output_file], args[:hash_function], args[:bit_size],args[:debugmode], args[:samefolder]\n end\n rescue => error\n # For debugging\n puts error\n # Print options\n puts opt\n end\nend", "def changed_files(parent_sha, change_sha, node)\n response = shell_out!(\n \"git diff --name-only #{parent_sha} #{change_sha}\",\n cwd: repo_path(node)\n ).stdout.strip\n\n changed_files = []\n response.each_line do |line|\n changed_files << line.strip\n end\n changed_files\n end", "def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end", "def all_chunk_hashes\n\t\t\n\t\tbegin\n\t\t\t@all_chunk_map = \"\"\n\t\t\t0.upto(num_chunks-1) { |i|\n\t\t\t\t@all_chunk_map += sha1_chunk(i)\n\t\t\t}\n\n\t\tend unless @all_chunk_map\n\t\t@all_chunk_map\n\tend", "def log_commits_by_files(logopts=nil)\n\t\t\tr={}\n\t\t\tfiles=run_simple(\"git log #{DefaultLogOptions} --name-only --format=\"\" #{logopts}\", chomp: :lines)\n\t\t\tuniq=files.uniq\n\t\t\tuniq.each do |file|\n\t\t\t\tr[file]=files.count(file)\n\t\t\tend\n\t\t\tr\n\t\tend", "def get_file_listing\n execute!(drive.files.list).data\n end", "def refresh\n list.clear\n\n Ginatra.load_config[\"git_dirs\"].map do |git_dir|\n if Dir.exist?(git_dir.chop)\n dirs = Dir.glob(git_dir).sort\n else\n dir = File.expand_path(\"../../../#{git_dir}\", __FILE__)\n dirs = Dir.glob(dir).sort\n end\n\n dirs = dirs.select {|f| File.directory? f }\n dirs.each {|d| add(d) }\n end\n\n list\n end", "def hash (site)\n\t#hash_in_hash = Array.new\n\t#hash_in_hash = {\"URL\" => \"MD5_Digest\"}\n\topen (site) do |s|\n\t\tresponse = s.read\n\t\tdigest = Digest::MD5.hexdigest(response)\n\t\t#string1 = site + \" - \" + digest + \"\\n\"\n\t\t#file2 = File.open(\"/Users/ismeet/code/ruby/js_scan/hashes\", \"a\")\n\t\t#file2.write(string1)\n\t\treturn site, digest #Return site and digest. The hash has to be created in the outside function where we area calling the hash function.\n\tend\nend", "def files_in_branches\n result = Mortadella::Horizontal.new headers: %w[BRANCH NAME CONTENT]\n existing_local_branches(order: :main_first).each do |branch|\n files_in(branch: branch).each do |file|\n result << [branch, file, content_of(file: file, for_sha: branch)]\n end\n end\n result.table\nend", "def hash\n [file_info, output_path, encoding, recognize_lists, leading_spaces, trailing_spaces, enable_pagination].hash\n end", "def files\n i = 0\n @@arr_path.each do |path|\n if path.include?(params[:fold])\n # Remove path from current path\n @@arr_path = @@arr_path[0..i]\n @path = ''\n\n @@arr_path.each do |e| # Put path from array to @path\n @path = @path + e + ' >> '\n end\n @@temp_path = @path\n\n # Get content: folders, file, count\n @content = BrowsingFile.bind_folder params[:fold]\n @file = BrowsingFile.bind_files params[:fold]\n\n render 'index' # Reload index page\n return\n end\n i += 1\n end\n end", "def hash(handle, offset, length, block_size=0)\n if block_size != 0 && block_size < 255\n block_size = 256\n end\n send_request(FXP_EXTENDED, :string, \"check-file-handle\", :string, handle, :string, \"md5,sha256,sha384,sha512\", :int64, offset, :int64, length, :long, block_size)\n end", "def search(command)\n resp = @client.files.search('/', clean_up(command[1]))\n\n for item in resp\n puts item.path\n end\n end" ]
[ "0.73317564", "0.6945365", "0.62079465", "0.5961802", "0.5961802", "0.59590673", "0.59041077", "0.5857626", "0.57781035", "0.5773977", "0.5767927", "0.5757519", "0.57531357", "0.5749062", "0.5730316", "0.5708884", "0.56661063", "0.5659761", "0.5649932", "0.56416607", "0.56304055", "0.5618022", "0.5615744", "0.5581862", "0.5574501", "0.5556204", "0.5551779", "0.5538199", "0.5538199", "0.5519861", "0.5517231", "0.5513197", "0.5507981", "0.54908085", "0.54726446", "0.54650307", "0.54600394", "0.5455391", "0.54471475", "0.54458684", "0.54327035", "0.5432001", "0.5416057", "0.5406965", "0.53848773", "0.53791445", "0.53746754", "0.5357901", "0.5342472", "0.53405786", "0.5321858", "0.53185385", "0.53155077", "0.53044957", "0.5293402", "0.52881455", "0.52708834", "0.5244047", "0.5243705", "0.5234574", "0.52312815", "0.5229901", "0.52230924", "0.5218658", "0.5212844", "0.52039695", "0.5203276", "0.5195515", "0.5191753", "0.51902", "0.51884526", "0.5188214", "0.5176644", "0.5171901", "0.515318", "0.5149483", "0.5148013", "0.5143539", "0.51388013", "0.51346487", "0.5124099", "0.51237404", "0.51237404", "0.5123689", "0.5121493", "0.5116805", "0.51167405", "0.5115631", "0.5111915", "0.5109221", "0.5103799", "0.50893843", "0.5085953", "0.5085514", "0.5084878", "0.50840706", "0.5082559", "0.5081712", "0.5081507", "0.50757635" ]
0.6718793
2
Construct the ContentTree for the given base directory N Without this, wouldn't know how to construct a content tree from a list of relative directory paths and relative file paths with associated hash values
def getContentTree(baseDir) #N Without this, wouldn't have an empty content tree that we could start filling with dir & file data contentTree = ContentTree.new() #N Without this, wouldn't record the time of the content tree, and wouldn't be able to determine from a file's modification time that it had been changed since that content tree was recorded. contentTree.time = Time.now.utc #N Without this, the listed directories won't get included in the content tree for dir in listDirectories(baseDir) #N Without this, this directory won't get included in the content tree contentTree.addDir(dir) end #N Without this, the listed files and hashes won't get included in the content tree for fileHash in listFileHashes(baseDir) #N Without this, this file & hash won't get included in the content tree contentTree.addFile(fileHash.relativePath, fileHash.hash) end return contentTree end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getContentTree\n #N Without this we won't have timestamp and the map of file hashes used to efficiently determine the hash of a file which hasn't been modified after the timestamp\n cachedTimeAndMapOfHashes = getCachedContentTreeMapOfHashes\n #N Without this we won't have the timestamp to compare against file modification times\n cachedTime = cachedTimeAndMapOfHashes[0]\n #N Without this we won't have the map of file hashes\n cachedMapOfHashes = cachedTimeAndMapOfHashes[1]\n #N Without this we won't have an empty content tree which can be populated with data describing the files and directories within the base directory\n contentTree = ContentTree.new()\n #N Without this we won't have a record of a time which precedes the recording of directories, files and hashes (which can be used when this content tree is used as a cached for data when constructing some future content tree)\n contentTree.time = Time.now.utc\n #N Without this, we won't record information about all sub-directories within this content tree\n for subDir in @baseDirectory.subDirs\n #N Without this, this sub-directory won't be recorded in the content tree\n contentTree.addDir(subDir.relativePath)\n end\n #N Without this, we won't record information about the names and contents of all files within this content tree\n for file in @baseDirectory.allFiles\n #N Without this, we won't know the digest of this file (if we happen to have it) from the cached content tree\n cachedDigest = cachedMapOfHashes[file.relativePath]\n #N Without this check, we would assume that the cached digest applies to the current file, even if one wasn't available, or if the file has been modified since the time when the cached value was determined.\n # (Extra note: just checking the file's mtime is not a perfect check, because a file can \"change\" when actually it or one of it's enclosing sub-directories has been renamed, which might not reset the mtime value for the file itself.)\n if cachedTime and cachedDigest and File.stat(file.fullPath).mtime < cachedTime\n #N Without this, the digest won't be recorded from the cached digest in those cases where we know the file hasn't changed\n digest = cachedDigest\n else\n #N Without this, a new digest won't be determined from the calculated hash of the file's actual contents\n digest = hashClass.file(file.fullPath).hexdigest\n end\n #N Without this, information about this file won't be added to the content tree\n contentTree.addFile(file.relativePath, digest)\n end\n #N Without this, the files and directories in the content tree might be listed in some indeterminate order\n contentTree.sort!\n #N Without this check, a new version of the cached content file will attempt to be written, even when no name has been specified for the cached content file\n if cachedContentFile != nil\n #N Without this, a new version of the cached content file (ready to be used next time) won't be created\n contentTree.writeToFile(cachedContentFile)\n end\n return contentTree\n end", "def build_hash_tree(filenames)\n files_tree = filenames.inject({}) { |h, i| t = h; i.split(\"/\").each { |n| t[n] ||= {}; t = t[n] }; h }\nend", "def tree(root = '')\n build_hash(files(root), root)\n end", "def create_new_tree_with_blobs(oauth_token, file_information, sha_base_tree)\n client = Octokit::Client.new(access_token: oauth_token)\n blob_information = []\n file_information.each do |file|\n # This mode property on this hash represents the file mode for a GitHub tree. \n # The mode is 100644 for a file blob. See https://developer.github.com/v3/git/trees/ for more information\n blob_information << { path: file[:path],\n mode: '100644',\n type: 'blob',\n sha: file[:blob_sha] }\n end\n client.create_tree(full_repo_name, blob_information, base_tree: sha_base_tree)[:sha]\n end", "def initialize root_dir\n find_files root_dir\n end", "def build\n Dir.chdir(@directory) do\n\n Dir['**/*'].reduce({}) do |result, f|\n if File.file?(f) && is_erb?(f)\n\n node = build_node(f)\n cat = node[:category]\n result[cat] = (result[cat] || []).push(node)\n result\n\n else\n\n result\n\n end\n end\n\n end\n end", "def build_tree tree_root=nil\n tree_root ||= self.tree_root\n Dir.mkdir(tree_root) unless File.directory?(tree_root)\n Dir.chdir(tree_root) do\n self.files.each do |entry|\n visit_tree entry do |type, name|\n case type\n when :file\n FileUtils.touch(name)\n when :directory\n Dir.mkdir(name)\n else\n throw \"BAD VISIT TREE TYPE. #{type}\"\n end\n end\n end\n end\n end", "def build_hash(files, root)\n tree = {}\n files.each do |path|\n build_tree(tree, path.split(File::SEPARATOR), root)\n end\n tree\n end", "def build_index\n to_index = [@dir]\n index = {}\n while (dir = to_index.shift)\n Dir.new(dir).each { |entry| index_entry to_index, index, dir, entry }\n end\n\n index\n end", "def import_content(directory, parent_folder = nil)\n Dir.new(directory).each do |path|\n next if path.match(/^\\.+/)\n \n # Create a new Webbastic::ContentDir object for every folders\n if FileTest.directory?(File.join(directory, path))\n if parent_folder\n @folder = parent_folder.children.create :name => path\n else\n @folder = self.folders.create :name => path\n end\n import_content(File.join(directory, path), @folder)\n \n # Create a new Webbastic::Page object for every files\n # and read its content to put it in a static widget\n else\n if parent_folder\n @page = parent_folder.pages.create :name => path, :layout => self.default_layout\n else\n @page = self.pages.create :name => path, :layout => self.default_layout\n end\n \n file = File.new(File.join(directory, path), \"r\")\n content = \"\"\n while (line = file.gets)\n content << line\n end\n file.close\n \n @page.add_static_content\n end\n end\n end", "def create_from_files_in(base, klass)\n all_files_in(base).map do |base_filename, (meta_ext, content_ext)|\n # Get filenames\n meta_filename = meta_ext ? base_filename + '.' + meta_ext : nil\n content_filename = content_ext ? base_filename + '.' + content_ext : nil\n\n # Get meta and content\n meta = (meta_filename ? YAML.load_file(meta_filename) : nil) || {}\n content = (content_filename ? File.read(content_filename) : nil) || ''\n\n # Get attributes\n attributes = {}\n attributes[:file] = Nanoc3::Extra::FileProxy.new(content_filename) if content_filename\n attributes[:extension] = File.extname(content_filename)[1..-1] if content_filename\n attributes.merge!(meta)\n\n # Get identifier\n if meta_filename\n identifier = identifier_for_filename(meta_filename[(base.length+1)..-1])\n elsif content_filename\n identifier = identifier_for_filename(content_filename[(base.length+1)..-1])\n else\n raise RuntimeError, \"meta_filename and content_filename are both nil\"\n end\n\n # Get modification times\n meta_mtime = meta_filename ? File.stat(meta_filename).mtime : nil\n content_mtime = content_filename ? File.stat(content_filename).mtime : nil\n if meta_mtime && content_mtime\n mtime = meta_mtime > content_mtime ? meta_mtime : content_mtime\n elsif meta_mtime\n mtime = meta_mtime\n elsif content_mtime\n mtime = content_mtime\n else\n raise RuntimeError, \"meta_mtime and content_mtime are both nil\"\n end\n\n # Create layout object\n klass.new(content, attributes, identifier, mtime)\n end\n end", "def get_contents \n @contents = []\n\n sub_directory_names = Dir[CONTENT_ROOT_DIRECTORY + \"/*\"]\n\n sub_directory_names.each do |sub_directory_name|\n sub_directory_basename = File.basename(sub_directory_name)\n @contents.push(Content.new(sub_directory_basename))\n end\n end", "def dir_list(path, bases, paging)\n items = paging[:items]\n page = paging[:page]\n offset = paging[:offset]\n raise 'Disabling paging is not supported for a directory listing' if paging[:disable_paging]\n\n max_items = 1000\n\n child_paths, total = FileSystems::Combined.directory_list(path, items, offset, max_items)\n\n children = child_paths.map { |full_path|\n if FileSystems::Combined.directory_exists?(full_path)\n dir_info(full_path, bases)\n else\n raise 'File should exist' unless FileSystems::Combined.file_exists?(full_path)\n\n file_info(full_path)\n end\n }\n\n paging[:total] = total\n paging[:warning] = \"Only first #{max_items} results are available\" if total >= max_items\n\n children\n end", "def initialize(root_dir, module_set, data)\n @module_set = module_set\n @name = data[:name]\n @root = FilePath.new(root_dir, @name).canonicalize\n @compiler_version = data[:compiler_version] \n @aspectj = data[:aspectj] || false\n @dependencies = data[:dependencies] || [ ]\n\n assert(\"Root ('#{@root.to_s}') must be an absolute path\") { @root.absolute? }\n assert(\"Root ('#{@root.to_s}') must exist, and be a directory\") { FileTest.directory?(@root.to_s) }\n assert(\"Compiler version must be specified.\") { ! @compiler_version.nil? }\n \n @subtrees = [ ]\n # Run through all the factories and add a new subtree for each one.\n BuildSubtreeFactory::ALL_BUILD_SUBTREE_FACTORIES.each { |factory| @subtrees << factory.create(self) }\n end", "def build_directory_tree\n\n # Add the user's config directories to the \"ignore_dir\" option because these are all things we won't need printed in a NavTree.\n options.ignore_dir << app.config[:js_dir]\n options.ignore_dir << app.config[:css_dir]\n options.ignore_dir << app.config[:fonts_dir]\n options.ignore_dir << app.config[:images_dir]\n options.ignore_dir << app.config[:helpers_dir]\n options.ignore_dir << app.config[:layouts_dir]\n options.ignore_dir << app.config[:partials_dir]\n\n # Build a hash out of our directory information\n tree_hash = scan_directory(app.config[:source], options)\n\n # Write our directory tree to file as YAML.\n FileUtils.mkdir_p(app.config[:data_dir])\n data_path = app.config[:data_dir] + '/' + options.data_file\n IO.write(data_path, YAML::dump(tree_hash))\n end", "def create_root_tree_with_entries(path, objects, entries_tree_sha)\n create_tree_with_objects(\n objects.map {|object|\n if object.path.include?(\"/\")\n nil\n elsif object.path == \"entries\"\n {\n :mode => \"040000\",\n :path => \"entries\",\n :type => \"object\",\n :sha => entries_tree_sha,\n }\n else\n object\n end\n }.compact\n )\n end", "def build_tree(tree, parts, path)\n path += '/' unless path.empty? || path.end_with?('/')\n parts[0...-1].each do |p|\n path += \"#{p}/\"\n tree[p] ||= { type: :directory, path: path, sub: {} }\n tree = tree[p][:sub]\n end\n fname = parts[-1]\n tree[fname] = { type: :text, path: path + fname }\n end", "def init_existing\n return unless current_directory?\n\n FolderTree.for_path linked_path, root: directory, limit: folder_limit\n end", "def initialize_directory_structure # rubocop:disable Metrics/MethodLength\n result = []\n\n %w[day hour minute].each do |unit|\n @intervals[unit].reverse.each do |i|\n dir = File.join(@to_dir, \"#{unit}s_ago\", i.to_s)\n FileUtils.mkdir_p(dir)\n fname = File.join(dir, @tarfile)\n $stderr << fname << \"\\n\"\n result << SnapshotFile.new(fname, unit)\n end\n end\n\n result\n end", "def init_new(levels)\n FolderTree.empty directory, levels: levels, limit: folder_limit\n end", "def build_file_sets\n return [] if file_nodes.empty?\n file_nodes.each_with_index.map do |node, index|\n file_set = create_file_set(node, files[index])\n file_set\n end\n end", "def build_category_tree(n, child = nil)\n amz_node = BrowseNode.parse(n.to_s)\n amz_node.child = child unless child.nil?\n\n if n.search(\"./IsCategoryRoot\").size > 0\n @category_tree[amz_node.name] ||= []\n @category_tree[amz_node.name] << amz_node\n else\n parents = n.search(\"./Ancestors/BrowseNode\")\n if parents.size > 0\n build_category_tree(parents[0], amz_node)\n end\n end\n\n\n end", "def browse_tree(tree = nil, cur = nil)\n return [[], []] if barerepo.empty?\n tree ||= barerepo.head.target.tree\n images = []\n directories = []\n tree.each do |item|\n next if item[:name][0] == '.'\n dest = cur.nil? ? item[:name] : File.join(cur, item[:name])\n if item[:type] == :blob\n images.push({\n data: barerepo.read(item[:oid]).data,\n dest: dest, name: item[:name]\n })\n else\n directories.push({\n dest: dest, name: item[:name]\n })\n end\n end\n [images, directories]\n end", "def generate_directory_index(path)\n html = generate_header(path.blank? ? '/' : path, path)\n\n node = @server.tree.node_for_path(path)\n if node.is_a?(ICollection)\n html << '<section><h1>Nodes</h1>'\n html << '<table class=\"nodeTable\">'\n\n sub_nodes = @server.properties_for_children(\n path,\n [\n '{DAV:}displayname',\n '{DAV:}resourcetype',\n '{DAV:}getcontenttype',\n '{DAV:}getcontentlength',\n '{DAV:}getlastmodified'\n ]\n )\n\n sub_nodes.each do |sub_path, _sub_props|\n sub_node = @server.tree.node_for_path(sub_path)\n full_path = @server.base_uri + Http::UrlUtil.encode_path(sub_path)\n (_, display_path) = Http::UrlUtil.split_path(sub_path)\n\n sub_nodes[sub_path]['subNode'] = sub_node\n sub_nodes[sub_path]['fullPath'] = full_path\n sub_nodes[sub_path]['displayPath'] = display_path\n end\n sub_nodes.sort { |a, b| compare_nodes(a, b) }\n\n sub_nodes.each do |_, sub_props|\n type = {\n 'string' => 'Unknown',\n 'icon' => 'cog'\n }\n if sub_props.key?('{DAV:}resourcetype')\n type = map_resource_type(sub_props['{DAV:}resourcetype'].value, sub_props['subNode'])\n end\n\n html << '<tr>'\n html << '<td class=\"nameColumn\"><a href=\"' + escape_html(sub_props['fullPath']) + '\"><span class=\"oi\" data-glyph=\"' + escape_html(type['icon']) + '\"></span> ' + escape_html(sub_props['displayPath']) + '</a></td>'\n html << '<td class=\"typeColumn\">' + escape_html(type['string']) + '</td>'\n html << '<td>'\n if sub_props.key?('{DAV:}getcontentlength')\n html << escape_html(sub_props['{DAV:}getcontentlength'].to_s + ' bytes')\n end\n html << '</td><td>'\n if sub_props.key?('{DAV:}getlastmodified')\n last_mod = sub_props['{DAV:}getlastmodified'].time\n html << escape_html(last_mod.strftime('%B %e, %Y, %l:%M %P'))\n end\n html << '</td>'\n\n button_actions = ''\n if sub_props['sub_node'].is_a?(IFile)\n button_actions = '<a href=\"' + escape_html(sub_props['fullPath']) + '?sabreAction=info\"><span class=\"oi\" data-glyph=\"info\"></span></a>'\n end\n\n box = Box.new(button_actions)\n @server.emit('browserButtonActions', [sub_props['fullPath'], sub_props['subNode'], box])\n button_actions = box.value\n\n html << \"<td>#{button_actions}</td>\"\n html << '</tr>'\n end\n\n html << '</table>'\n\n end\n\n html << '</section>'\n html << '<section><h1>Properties</h1>'\n html << '<table class=\"propTable\">'\n\n # Allprops request\n prop_find = PropFindAll.new(path)\n properties = @server.properties_by_node(prop_find, node)\n\n properties = prop_find.result_for_multi_status[200]\n\n properties.each do |prop_name, prop_value|\n if @uninteresting_properties.include?(prop_name)\n html << draw_property_row(prop_name, prop_value)\n end\n end\n\n html << '</table>'\n html << '</section>'\n\n # Start of generating actions\n\n output = ''\n if @enable_post\n box = Box.new(output)\n @server.emit('onHTMLActionsPanel', [node, box])\n output = box.value\n end\n\n if output\n html << '<section><h1>Actions</h1>'\n html << '<div class=\"actions\">'\n html << output\n html << '</div>'\n html << '</section>'\n end\n\n html << generate_footer\n\n @server.http_response.update_header('Content-Security-Policy', \"img-src 'self'; style-src 'self';\")\n\n html\n end", "def make_directory_tree\n project_tmp = \"/tmp/#{@package_name}\"\n @scratch = \"#{project_tmp}/#{@title}\"\n @working_tree = {\n 'scripts' => \"#{@scratch}/scripts\",\n 'resources' => \"#{@scratch}/resources\",\n 'working' => \"#{@scratch}/root\",\n 'payload' => \"#{@scratch}/payload\",\n }\n puts \"Cleaning Tree: #{project_tmp}\"\n FileUtils.rm_rf(project_tmp)\n @working_tree.each do |key,val|\n puts \"Creating: #{val}\"\n FileUtils.mkdir_p(val)\n end\n File.open(\"#{@scratch}/#{'prototype.plist'}\", \"w+\") do |f|\n f.write(ERB.new(File.read('tasks/templates/prototype.plist.erb')).result())\n end\n File.open(\"#{@working_tree[\"scripts\"]}/preflight\", \"w+\") do |f|\n f.write(ERB.new(File.read('ext/osx/preflight.erb')).result())\n end\nend", "def generate_directory_index(dir)\n @log.debug(\" creating an index for #{dir}\")\n link_root = dir.gsub(@site_path, @config[:site_path]) \n \n links = {}\n\n # Construct a list of links.\n Dir.foreach(dir) do |entry|\n unless ['.', '..'].include?(entry)\n if File.directory?(File.join(dir, entry))\n #@log.debug(\" adding entry for #{entry}\")\n links[entry] = File.join(link_root, entry)\n end\n \n if entry =~ /(\\d{2})(\\d{2})\\.post/\n #@log.debug(\" adding entry for #{entry}\")\n links[\"#{$1}:#{$2}\"] = File.join(link_root, entry.gsub('post', 'html'))\n end\n end\n end\n\n page = {}\n page[:body] = ''\n\n # If we're at the top of the 'posts' directory, assign the page the title\n # of @config[:archive_title].\n if File.join(@site_path, @config[:post_path]) == dir\n page[:title] = @config[:archive_title]\n else\n page[:title] = File.basename(dir)\n end\n\n links.keys.sort.reverse.each do |k|\n page[:body] << \"<h3><a href='#{links[k]}'>#{k}</a></h3>\"\n end\n\n File.open(File.join(dir, 'index.html'), 'w') do |f|\n f << generate_page(page)\n end\n\n #@log.debug(\" generated an index for #{dir}\")\n end", "def build_skeleton(dirs,path=@path)\n \n dirs.each{\n |node|\n \n if node.kind_of?(Hash) && !node.empty?()\n node.each_pair{\n |dir,content| \n \n dir = replace_tags(dir)\n \n puts 'Creating directory ' + File.join(path,dir)\n Dir.mkdir(File.join(path,dir))\n \n if content.kind_of?(Array) && !content.empty?()\n build_skeleton(content,File.join(path,dir))\n end\n \n }\n elsif node.kind_of?(Array) && !node.empty?()\n node.each{\n |file|\n \n write_file(file,path)\n \n }\n end\n \n }\n \n end", "def ingest(base_directory)\n Dir[\"#{base_directory}/*\"].sort.each do |entry|\n next unless File.directory?(entry)\n\n bib_id = File.basename(entry)\n\n ingest_directory(directory: entry, property_value: bib_id)\n end\n end", "def build_node(file)\n parent = parent_folder(file)\n category = parent == \".\" ? to_symbol(@directory) : to_symbol(parent)\n basename = basename(file)\n title = basename_to_title(basename)\n html = Renderer.new.render_internal(file)\n\n { title: title,\n basename: basename,\n path: File.realpath(file),\n category: category,\n html: html }\n end", "def initialize(fname, basedir=nil, datafile=nil, indexfile=nil)\n base = basedir || Dir.pwd\n @fname = File.absolute_path(fname, base)\n if @fname == fname\n raise \"CONSTRUCTED WITH ABSOLUTE PATH #{fname}\"\n end\n indexdir = File.join base, HIDDEN_DIR, \"index\"\n datadir = File.join base, HIDDEN_DIR, \"data\"\n @indexfile = indexfile || (File.join indexdir, fname)\n @datafile = datafile || (File.join datadir, fname)\n [indexdir, datadir].each do |d|\n unless File.directory?(d)\n FileUtils.mkdir_p(d)\n end\n end\n end", "def scan_pages0( index, directory )\n unless index\n index = Page.new( File.join( directory, \"index.src\" ) )\n @root = index \n end\n \n @subdir_pages = get_nondir_pages( directory )\n @nondir_pages = get_subdir_pages( directory )\n \n @nondir_pages.each do |page_src|\n Page.new( page_src, index )\n end\n @subdir_pages.each do |page_src|\n page = Page.new( page_src, index )\n scan_pages( config, page, File.dirname( page_src ) )\n end\n end", "def load_instance(sub_paths, sub_paths_index, size, modification_time)\n # initialize dirs and files.\n @dirs = {} unless @dirs\n @files = {} unless @files\n if sub_paths.size-1 == sub_paths_index\n # Add File case - index points to last entry - leaf case.\n file_stat = FileStat.new(sub_paths[sub_paths_index], FileStatEnum::STABLE, size, modification_time, true)\n add_file(file_stat)\n else\n # Add Dir to tree if not present. index points to new dir path.\n dir_stat = @dirs[sub_paths[sub_paths_index]]\n #create new dir if not exist\n unless dir_stat\n dir_stat = DirStat.new(sub_paths[sub_paths_index])\n add_dir(dir_stat)\n end\n # continue recursive call on tree with next sub path index\n dir_stat.load_instance(sub_paths, sub_paths_index+1, size, modification_time)\n end\n end", "def bp_directory_index\n tree_hash = BP.same_level_views(\"/base_project#{request.env['PATH_INFO']}\")\n\n p tree_hash\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks\", \"\")\n\n out += content_tag :li, thk.gsub(\"/\", \"\")\n\n out += \"<ul>\"\n tree_hash[tree_hash_key].each do |tree_hash_value|\n thv = tree_hash_value.gsub(\".html.erb\", \"\")\n if thv != \"index\"\n out += content_tag :li, link_to(\"#{thv}\", \"/mocks?t=#{thk}/#{thv}\")\n end\n\n end\n out += \"</ul>\"\n\n out += \"</li>\"\n end\n out += \"</ul>\"\n\n out.html_safe\nend", "def retrieve_dirs(_base, dir, dot_dirs); end", "def build_tree\n c1 = ComponentNode.new(110)\n c2 = ComponentNode.new(20)\n c3 = ComponentNode.new(20)\n c4 = ComponentNode.new(150)\n c5 = ComponentNode.new(80)\n c6 = ComponentNode.new(120, [c1, c2, c3])\n c7 = ComponentNode.new(180, [c4, c5])\n return(ComponentNode.new(200, [c6, c7]))\n end", "def build_tree(arr, root, i, n)\n\tif i < n\n\t\troot = TreeNode.new(arr[i])\n\t\troot.left = build_tree(arr, root.left, i*2+1, n)\n\t\troot.right = build_tree(arr, root.right, i*2+2, n)\n\tend\n\treturn root\nend", "def index(base_path, glob = nil)\n\t\tglob = '*' if glob == '' or glob.nil?\n\t\tdirs = []\n\t\tfiles = []\n\t\t::Dir.chdir(base_path) do\n\t\t\t::Dir.glob(glob).each do |fname|\n\t\t\t\tif ::File.directory?(fname)\n\t\t\t\t\tdirs << fname + '/'\n\t\t\t\telse\n\t\t\t\t\tfiles << fname\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdirs.sort + files.sort\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, base_path\n\tend", "def tree(n)\n SegmentTree.new list(n)\nend", "def sub_content \n sub_contents = []\n\n if @is_post == false\n root_regexp = Regexp.new(@root, Regexp::IGNORECASE)\n sub_directories = Dir.glob(@absolute_path + '*');\n\n sub_directories.each do |sub_directory|\n begin\n # Remove the root from the path we pass to the new Content instance.\n # REVIEW: Should we be flexible and allow for the root dir to be present?\n content = Content.new(sub_directory.sub(root_regexp, ''))\n sub_contents.push(content)\n rescue ArgumentError\n next\n end\n end\n end\n\n sub_contents.reverse\n end", "def build_file_sets\n return if file_nodes.empty? || processing_derivatives?\n file_nodes.each_with_index.map do |node, index|\n file_set = create_file_set(node, files[index])\n file_set\n end\n end", "def build_repo repo_path, file_structure\n file_structure.each do |entry|\n add_file entry\n end\n end", "def file_tree(root, tree_contents)\n set_pwd = nil\n tree_contents.each do |tree_entry|\n if tree_entry.start_with?('pwd:')\n raise 'Already have a pwd selected' if set_pwd\n tree_entry = tree_entry.sub(/^pwd:/, '')\n raise \"#{tree_entry} is not a directory entry (must end with /), can't use as pwd\" unless tree_entry.end_with?('/')\n set_pwd = true # Set later\n end\n\n # Avoid a simple mistake\n tree_entry = tree_entry[1..-1] if tree_entry[0] == '/'\n\n path = File.absolute_path(tree_entry, root)\n set_pwd = path if set_pwd == true\n\n if tree_entry.end_with?('/')\n FileUtils.mkdir_p(path)\n else\n FileUtils.mkdir_p(File.dirname(path))\n content = if REQUIRABLE_EXTENSIONS[File.extname(path)] == :native_extension\n File.read(SAMPLE_NATIVE_LIB)\n else\n <<-RUBY\n $last_test_tree_file_executed = #{tree_entry.inspect}\n RUBY\n end\n File.write(path, content)\n end\n end\n\n Dir.chdir(set_pwd || '.')\n end", "def buildParentReadMeIndex\n x = 0\n fileOutArr = Array.new\n\n # Build list of reference pages\n fileOutArr.push \"### Fn Command Reference\\n\\n\"\n @cmdListArr.each do |command|\n # Add each command to output\n fileOutArr.push \"[\" + command + \"](ref/\" + @fileNameArr[x] + \".md\" + \") \\n\"\n x = x + 1 # Counter for syncing arrays\n end\n \n # Add Fn Version\n fileOutArr.push(\"\\n<sub>\" + @fnVersion + \"</sub>\")\n\n\n # Write REFLIST.md file to disk\n puts \"Writing: \" + \"REFLIST\" + \".md\"\n File.open(\"REFLIST.md\", \"w\") do |f|\n f.puts(fileOutArr)\n end\n\n end", "def build_subtree(folder, include_files = true)\n folder_metadata = {}\n folder_metadata['subfolders'] = (folder.is_virtual? ?\n folder.subfolders : MaterialFolder.accessible_by(current_ability).where(:parent_folder_id => folder))\n .map { |subfolder|\n build_subtree(subfolder, include_files)\n }\n if (folder.parent_folder == nil) and not (folder.is_virtual?) then\n folder_metadata['subfolders'] += virtual_folders.map { |subfolder|\n build_subtree(subfolder, include_files)\n }\n end\n\n folder_metadata['id'] = folder.id\n folder_metadata['name'] = folder.name\n folder_metadata['url'] = folder.is_virtual? ? course_material_virtual_folder_path(@course, folder) : course_material_folder_path(@course, folder)\n folder_metadata['parent_folder_id'] = folder.parent_folder_id\n folder_metadata['count'] = folder.files.length\n folder_metadata['is_virtual'] = folder.is_virtual?\n if include_files then\n folder_metadata['files'] = (folder.is_virtual? ?\n folder.files : Material.accessible_by(current_ability).where(:folder_id => folder))\n .map { |file|\n current_file = {}\n\n current_file['id'] = file.id\n current_file['name'] = file.filename\n current_file['description'] = file.description\n current_file['folder_id'] = file.folder_id\n current_file['url'] = course_material_file_path(@course, file)\n\n if not(folder.is_virtual? || @curr_user_course.seen_materials.exists?(file.id)) then\n current_file['is_new'] = true\n folder_metadata['contains_new'] = true\n end\n\n current_file\n }\n end\n\n folder_metadata\n end", "def generate_content_paths\n\n # This code for updating the uid field with the id (primary key)\n self.update_attributes(:uid => self.id)\n\n # The first entry with the self parent\n first = ContentPath.new\n first.ancestor = self.id\n first.descendant = self.id\n first.depth = 0\n first.save\n\n # Getting the parent id of the content\n parent_id = ContentData.get_parent_id(self.id)\n\n # If a parent is found then putting all the Content Path Entries\n if parent_id > 0\n\n # Getting the parent id data\n parent = Content.find(parent_id)\n # Getting all the parents of the parent (NOTE: This also contains the current parent id)\n parent_parents = parent.parents\n if(parent_parents.length > 0)\n parent_parents.each do |p|\n\n # Creating the new content paths\n path = ContentPath.new\n path.ancestor = p[\"ancestor\"]\n path.descendant = self.id\n path.depth = p[\"depth\"]+1\n path.save\n end\n end\n end\n\n end", "def populate_links\n stack = [[[], @source]]\n until stack.empty?\n roots, dir = *stack.pop\n dir.children.each do |child|\n name = block_given? && yield(child) || child.basename.to_s\n path = roots + [name]\n\n if child.directory?\n stack.push [path, child]\n else\n if IGNORED_FILES.include? child.basename.to_s\n @links[File.join(roots)] = true\n else\n @links[File.join(path)] = child.relative_path_from(@source).to_s\n end\n end\n end\n end\n end", "def initialize(baseDirectory, hashClass, cachedContentFile = nil)\n #N Without this, we won't remember the cached content file name\n super(cachedContentFile)\n #N Without this, we won't remember the base directory\n @baseDirectory = baseDirectory\n #N Without this, we won't remember the hash function\n @hashClass = hashClass\n end", "def build_partial_navigation_tree(value, depth = Float::INFINITY, key = nil, level = 0)\n navigation_tree = \"\"\n\n if value.is_a?(String)\n\n # This is a file.\n # Get the Sitemap resource for this file.\n # note: sitemap.extensionless_path converts the path to its 'post-build' extension.\n this_resource = resource_from_value(value)\n\n return \"\" if this_resource.nil?\n\n unless extensions[:navtree].options[:directory_index] && this_resource.directory_index?\n navigation_tree << child_li(this_resource) if this_resource\n end\n else\n\n # This is the first level source directory. We treat it special because it has no key and needs no list item.\n if key.nil?\n value.each do |newkey, child|\n navigation_tree << build_partial_navigation_tree(child, depth, newkey, level + 1)\n end\n\n # Continue rendering deeper levels of the tree, unless restricted by depth.\n elsif depth >= (level + 1)\n\n # Loop through all the directory's contents.\n directory_content = \"\"\n value.each do |newkey, child|\n directory_content << build_partial_navigation_tree(child, depth, newkey, level + 1)\n end\n\n directory_content_html = render_partial(extensions[:navtree].options[:navigation_tree_items_container], { :directory_content => directory_content })\n\n # This is a directory.\n # The directory has a key and should be listed in the page hieararcy with HTML.\n navigation_tree << parent_li(key, value, directory_content_html)\n end\n end\n\n return navigation_tree\n end", "def initialize(parent,relative_path=\"-\") # NUANCE the \"-\" is instead of \".\" because I don't wnat the URL to encode it\n @parent = parent\n @relative_path = relative_path\n @info = \"\"\n @rows = []\n @last_modified = Time.now - 3.days\n end", "def initialize(name = nil, parentPathElements = nil)\n #N Without this we won't remember the name of the directory\n @name = name\n #N Without this we won't know the path elements of the sub-directory (within the directory tree) containing this directory\n @pathElements = name == nil ? [] : parentPathElements + [name]\n #N Without this we won't be ready to add files to the list of files in this directory\n @files = []\n #N Without this we won't be ready to add directories to the list of sub-directories immediately contained in this directory\n @dirs = []\n #N Without this we won't be ready to add files so we can look them up by name\n @fileByName = {}\n #N Without this we won't be ready to add immediate sub-directories so we can look them up by name\n @dirByName = {}\n #N Without this the directory object won't be in a default state of _not_ to be copied\n @copyDestination = nil\n #N Without this the directory object won't be in a default state of _not_ to be deleted\n @toBeDeleted = false\n #N Without this the directory object won't be in a default state of not yet having set the timestamp\n @time = nil\n end", "def tree\n # Caution: use only for small projects, don't use in root.\n $title = \"Full Tree\"\n $files = `zsh -c 'print -rl -- **/*(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\nend", "def build_tree(data)\n @root = Node.new(data[0])\n data.shift\n data.each { |value| @root.insert(value) }\n end", "def initialize(dir, **opts)\n raise Errors::NoDirectoryError, dir: dir unless File.directory? dir\n\n @options = { nesting_levels: 2, folder_limit: 10_000 }.update(opts)\n @directory = dir\n @current_directory = File.join @options.fetch(:link_location, directory),\n CURRENT_STORE_PATH\n\n @tree = init_existing || init_new(nesting_levels)\n link_target\n end", "def expand!\n @children = {}\n for child in Dir[\"#{@target}/*\"]\n name = File.basename child\n @children[name] = Symlink::Node.new name, child\n end\n @target = nil\n end", "def initialize(node)\n super(node)\n @children = []\n rev = node.xpath(\"./commit\").first['revision'].to_i\n date = node.xpath(\"./commit/date\").text.split('T')[0]\n @info = {type: 'dir', rev: rev, date: date}\n end", "def file_nodes\n @file_nodes ||= files.map { |file| create_node(file) }.compact\n end", "def file_nodes\n @file_nodes ||= files.map { |file| create_node(file) }.compact\n end", "def tree_list(ref = @ref, pages=true, files=true)\n if (sha = @access.ref_to_sha(ref))\n commit = @access.commit(sha)\n tree_map_for(sha).inject([]) do |list, entry|\n if ::Gollum::Page.valid_page_name?(entry.name)\n list << entry.page(self, commit) if pages\n elsif files && !entry.name.start_with?('_') && !::Gollum::Page.protected_files.include?(entry.name)\n list << entry.file(self, commit)\n end\n list\n end\n else\n []\n end\n end", "def tree\n # Caution: use only for small projects, don't use in root.\n @title = 'Full Tree'\n # @files = `zsh -c 'print -rl -- **/*(#{@sorto}#{@hidden}M)'`.split(\"\\n\")\n @files = Dir['**/*']\n message \"#{@files.size} files.\"\nend", "def build_tree(arr)\n @root = insert_node(nil, arr.shift)\n arr.each { |value| insert_node(@root, value) }\n end", "def make_nodes\n nodes = {}\n @files.each_with_index do |file, ind|\n @ranks.each do |rank|\n symbol = \"#{file}#{rank}\".to_sym\n nodes[symbol] = Node.new([rank - 1, ind])\n end\n end\n nodes\n end", "def create_sub_index(data, folder_num)\n create_partials data[:sub_file], data\n data[:header] = read_file(get_header_path(data[:sub_file]))\n data[:footer] = read_file(get_footer_path(data[:sub_file]))\n data[:stylesheetloc] = sub_file_stylesheet_locs\n system \"mkdir page#{folder_num}\"\n write_data data, 'data'\n system \"erb _templates/_index.html.erb > page#{folder_num}/index.html\"\n end", "def visit_tree(files, &block)\n case files\n when Array\n files.each { | f| visit_tree(f,&block)}\n when String\n yield(:file, files) if block_given?\n when Hash\n files.each do |k,v|\n yield(:directory, k) if block_given?\n Dir.chdir(k) {visit_tree(v, &block) }\n end\n else\n throw \"Bad directory structure #{files}\"\n end\n end", "def visit(dir)\n # Create the directory.\n Dir.mkdir(target_path(dir))\n\n # Collect links to put on index later.\n links = []\n\n # Convert .md files to .html files.\n render_source_files = Dir.glob(File.join(dir, \"*.md\"))\n posts = render_source_files.collect{|source| Post.load_file(source)}\n\n posts_with_date = posts.select{|post| not post.date.nil?}.sort_by{|post| post.date}\n unless posts_with_date.empty?\n posts_with_date[0..-2].each_with_index do |post, i|\n later_post = posts_with_date[i+1]\n post.next_post = later_post\n later_post.prev_post = post\n end\n end\n\n posts.each do |post|\n rendered_post = POST_TEMPLATE.result(post.get_binding)\n page = Page.new(title: post.title, body: rendered_post)\n result = DEFAULT_TEMPLATE.result(page.get_binding)\n f = File.open(target_path(post.source), \"w\")\n f.write(result)\n\n links << Link.new(\n url: post.url,\n title: post.title,\n date: post.date,\n )\n end\n\n # Copy other files.\n entries = Dir.glob(File.join(dir, \"*\"))\n source_subdirs = entries.select{|e| File.directory?(e)}\n mirror_source_files = entries - render_source_files - source_subdirs\n\n mirror_source_files.each do |source|\n FileUtils.cp(source, target_path(source))\n links << Link.new(url: File.basename(target_path(source)))\n end\n\n # Recursively visit subdirectories.\n source_subdirs.each do |subdir|\n visit(subdir)\n links << Link.new(url: File.basename(target_path(subdir)))\n end\n\n # Create index if it's not already there.\n index_target_path = File.join(target_path(dir), \"index.html\")\n unless File.exist?(index_target_path)\n index = Index.new(\n links: links,\n dirname: File.join(target_url(target_path(dir)), \"/\"),\n )\n result = INDEX_TEMPLATE.result(index.get_binding)\n page = Page.new(title: index.dirname, body: result)\n result = DEFAULT_TEMPLATE.result(page.get_binding)\n f = File.open(index_target_path, \"w\")\n f.write(result)\n end\nend", "def build_tree(arr)\n @root = Node.new(arr.shift)\n arr.each { |data| insert_data(data, @root) }\n end", "def file_get_initialization(structure = ENV[\"HOME\"]) # this is linux specific for now\n @file_information = {} # {\"/directory\"=>[\"file\"], \"/directory/directory\"=>[\"file\", \"file\"]\n files = [] \n directory = \"\"\n directories = [] \n things = structure.split('/')\n things.each do |thing|\n if thing == \"\"\n directories.push(\"/root\")\n else\n directory = \"#{directory}/#{thing}\" \n @current_directory = directory\n directories.push(\"#{directory}\") if File.directory?(\"#{directory}\")\n end\n end \n return directories\n end", "def build_tree(tree_size, input)\n nodes = Array.new(tree_size) { Node.new(nil, nil, nil) }\n\n tree_size.times do |i|\n line = input.next\n val, left, right = line.chomp.split.map(&:to_i)\n nodes[i].val = val\n nodes[i].left = nodes[left] unless left == -1\n nodes[i].right = nodes[right] unless right == -1\n end\n \n nodes.first\nend", "def children\n files = if index?\n # about/index.html => about/*\n File.expand_path('../*', @file)\n else\n # products.html => products/*\n base = File.basename(@file, '.*')\n File.expand_path(\"../#{base}/*\", @file)\n end\n\n Set.new Dir[files].\n reject { |f| f == @file || project.ignored_files.include?(f) }.\n map { |f| self.class[f, project] }.\n compact.sort\n end", "def initialize\n @dir = N\n end", "def build_directories_records\n directories_records.each { |r| r.build }\n end", "def directory_hash(path, name=nil, exclude = [])\n exclude.concat(['..', '.', '.git', '__MACOSX', '.DS_Store'])\n data = {'name' => (name || path), 'type' => 'folder'}\n data[:children] = children = []\n Dir.entries(path).sort.each do |entry|\n # Dir.entries(path).each\n # puts entry\n next if exclude.include?(entry)\n full_path = File.join(path, entry)\n if File.directory?(full_path)\n if entry.include?(\"credit app\")\n kids = Dir.entries(full_path)\n kids.reject! {|x|exclude.include?(x)}\n if kids.length >= 1\n # can add a kids.each loop here if mom ever wants more than one credit app\n child_path = File.join(full_path, kids[0])\n true_path = child_path.partition(\"app/assets/images/\")[2]\n link = ActionController::Base.helpers.image_path(true_path)\n # puts full_path\n # puts link\n entry = entry.split('.')[0]\n if entry.include?('--')\n entry = entry.split('--')[1]\n end\n entry = entry.upcase\n\n children << \"<li class='category'>CREDIT APP<li class='kid'><a href='#{link}'>#{entry}</a></li></li>\"\n else\n # gotta fix these two somehow\n children << \"<li><a href='#'>NO APP</a></li>\"\n end\n elsif entry.include?('flipbook')\n # Dir.entries(full_path).each do |flipbook|\n # next if exclude.include?(flipbook)\n # if File.directory?(full_path)\n name = entry.split(\"-\")[1]\n name = name.upcase\n if @account==\"UNDER ARMOUR\" && full_path.include?('UA GOLF')\n uasub = 'UA GOLF'\n elsif @account==\"UNDER ARMOUR\" && full_path.include?('UA FITNESS')\n uasub = 'UA FITNESS'\n end\n\n linky = view_context.link_to name, controller: 'catalogues', action: 'flipbook', id: @account, subid: entry, :data => { :uaname => uasub }\n children << \"<li class='kid'>#{linky}</li>\"\n # catfolder = full_path.split('/flipbook')[0]\n # end\n\n # end\n elsif entry.include?(\"toplevel\")\n # replace toplevel with a better check, something like if parent = pictures\n entryname=entry.split('-')[0].upcase\n children << \"<li class='kid'><a href='/catalogues/#{@account}/pictures/#{entry}'>#{entryname}</a></li>\"\n\n else\n children << directory_hash(full_path, entry)\n end\n else\n # true_path = full_path.partition(\"app/assets/images/\")[2]\n\n true_path = full_path.partition(\"app/assets/images/\")[2]\n # puts true_path\n link = ActionController::Base.helpers.image_path(true_path)\n\n # puts link\n entry = entry.split('.')[0]\n if entry.include?('--')\n entry = entry.split('--')[1]\n end\n # this is where final kids are created\n entry = entry.upcase\n children << \"<li class='kid'><a href='#{link}'>#{entry}</a></li>\"\n end\n end\n return data\n end", "def initialize(base)\n self.count = 0\n self.boards = []\n self.maxvalue = 0\n # base directory/path where images are stored\n self.base = base\n %x{mkdir -p #{base}}\n %x{mkdir -p #{File.join(base, \"data\")}}\n end", "def sha1_hash_directory_tree(directory, prefix='', hash={})\n Dir.entries(directory).each do |file|\n next if file =~ /^\\./\n pathname = File.join(directory,file)\n if File.directory?(pathname)\n sha1_hash_directory_tree(pathname, File.join(prefix,file), hash)\n else\n hash[File.join(prefix,file)] = Digest::SHA1.hexdigest(File.read(pathname))\n end\n end\n \n hash\n end", "def initialize(contents = [])\n @root = NonLeafNode.new(nil, [], true)\n contents.each do |content|\n insert_privileged(content, true)\n end\n root.update_subtree\n end", "def build_server_tree(tree, options= {})\n result = ''\n tree = Array.wrap tree\n opts = {\n # node and base node params\n :id => :id, # node id field\n :title => :title, # name of title fileld\n :node => nil, # node\n\n # base options\n :type => :tree, # tree type\n :root => false, # is it root node?\n :level => 0, # recursion level\n :namespace => [], # :admin\n\n # BOOST! hash\n :boost => {}\n }.merge!(options)\n\n # Basic vars\n root = opts[:root]\n node = opts[:node]\n\n # namespace prepare [Rails require]\n opts[:namespace] = Array.wrap opts[:namespace]\n\n # Module with **Render** class\n opts[:render_module] = TREE_RENDERERS[opts[:type]] unless opts[:render_module]\n\n # Define tree class\n opts[:klass] = define_class_of_elements_of(tree) unless opts[:klass]\n\n # BOOST PATCH (BUILD ONCE)\n # solution of main perfomance problem\n # magick index-hash, which made me happy!\n\n # Performance comparison\n # Boost OFF: 8000 nodes, 3 levels => (Views: 176281.9ms | ActiveRecord: 189.8ms)\n # Boost ON: 8000 nodes, 3 levels => (Views: 8987.8ms | ActiveRecord: 141.6ms)\n\n if opts[:boost].empty?\n tree.each do |item|\n num = item.parent_id || -1\n opts[:boost][num.to_s] = [] unless opts[:boost][num.to_s]\n opts[:boost][num.to_s].push item\n end\n end\n\n unless node\n # RENDER ROOTS\n roots = opts[:boost]['-1']\n\n # Boost OFF\n # roots = tree.select{ |node| node.parent_id.blank? }\n\n # define roots, if it's need\n if roots.nil? && !tree.empty?\n # Looks like the new algo really does what we need (28 sept. 2016)\n # Thanks to: https://github.com/patrick-nits\n #\n ids = tree.map(&:id)\n opt_ids = opts[:boost].keys.map(&:to_i)\n candidate_ids = (ids + opt_ids).uniq - (ids & opt_ids) # xor\n roots = candidate_ids.map {|c| opts[:boost][c.to_s]}.compact.flatten\n end\n\n # children rendering\n if roots\n roots.each do |root|\n _opts = opts.merge({ :node => root, :root => true, :level => opts[:level].next, :boost => opts[:boost] })\n result << build_server_tree(tree, _opts)\n end\n end\n else\n # RENDER NODE'S CHILDREN\n children_res = ''\n children = opts[:boost][node.id.to_s]\n\n # Boost OFF\n # children = tree.select{ |_node| _node.parent_id == node.id }\n\n opts.merge!({ :has_children => children.blank? })\n\n unless children.nil?\n children.each do |elem|\n _opts = opts.merge({ :node => elem, :root => false, :level => opts[:level].next, :boost => opts[:boost] })\n children_res << build_server_tree(tree, _opts)\n end\n end\n\n result << build_tree_html(self, opts[:render_module], opts.merge({ :root => root, :node => node, :children => children_res }))\n end\n\n raw result\n end", "def create_list_of_files\n @path=find_repository_and_basepath\n @table.window.setTitle(@path)\n files=[]\n Find.find(@path) do |file|\n # we don't want any files from a repository in the list \n next if file=~/(\\.hg|\\.svn|\\.git|\\.pyc)/ \n\n # neither do we want dotfiles in the list\n next if File.basename(file)=~/^\\./ \n \n # file matches, add it to the resulting list\n files << file if FileTest.file?(file)\n\n # wir bauen hier mal einen kleinen Idiotentest ein. Wenn wir mehr\n # als 10000 Dateien gefunden haben dann sind wir vermtl. in einem \n # falschen Verzeichniss und brechen die Suche ab.\n if files.length>10000\n NSRunInformationalAlertPanel('Large directory found!',\n \"Gathered more than 10k files from directory '#{@path}', aborting search!\",'OK',nil,nil)\n NSApp.stop(self)\n raise 'error'\n end\n end\n #@files=files.sort_by { |match| File.basename(match) }\n @files=files.sort\n end", "def build_tree(item_list = @sorted_list,root_node = nil)\n #sorted root sorts and removes duplicates from the item list\n if (item_list[0] == nil)\n return nil\n else\n start = 0\n end_of_item_list = item_list.length - 1\n mid = (start + item_list.length) / 2\n #set the root node then start creating a tree node for the left and right side of the array\n #Then after that branch is created attach it to the correct position\n root_node = Node.new(item_list[item_list.length/2])\n root_node.right = build_tree(item_list[0,mid],root_node) \n root_node.left = build_tree(item_list[mid+1,end_of_item_list],root_node)\n return root_node\n end\n \n end", "def create_components\n component_file_paths.each do |path_name|\n nodes.create(type: 'Node::Component', path: path_name.to_s)\n end\n end", "def get_entries(dir, subfolder); end", "def build_repo(repo_path, file_structure)\n file_structure.each do |entry|\n path = repo_path.join(entry)\n dir, filename = path.split unless entry.end_with?(\"/\")\n FileUtils.mkdir_p(dir || entry)\n\n next unless filename\n\n build_file(dir, filename)\n end\n end", "def get_remote_files_hierarchy(files, root = '/', hierarchy = { dirs: [], files: [] })\n files.each do |node|\n case node['node_type']\n when 'directory'\n hierarchy[:dirs] << \"#{root}#{node['name']}\"\n get_remote_files_hierarchy(node['files'], root + node['name'] + '/', hierarchy)\n when 'file'\n hierarchy[:files] << \"#{root}#{node['name']}\"\n end\n end\n\n hierarchy\nend", "def build_tree(data, parent = nil)\n return if data.size.zero?\n center = half(data)\n value = data[center]\n @depth_first << value\n\n # Recusion to split halves until zero then execute logic\n build_tree(l_half = data[0...center], value)\n build_tree(r_half = data[center + 1..-1], value)\n\n # Node creation and set node properties\n l_child = l_half[half(l_half)]\n r_child = r_half[half(r_half)]\n Node.new(value, parent, l_child, r_child)\n end", "def initialize(arr)\n @value = arr.sort.uniq\n @root = build_tree(value)\n end", "def setup_test_tree\n @root << @child1\n @root << @child2\n @root << @child3 << @child4\n end", "def parse_directories(files, diffs)\n files.sort!\n\n # Initialize those hashes, where each key will map to hash, in wich\n # each key maps to an array:\n # {\n # key1: {\n # },\n # key2: {\n # },\n # }\n #\n without_diffs = Hash.new { |h,k| h[k] = {} }\n with_diffs = Hash.new { |h,k| h[k] = {} }\n\n directories = files.map { |f| f.split('/').first }.uniq\n groups = directories.map { |dir| dir.split('_').first }.uniq\n\n\n # Fill in the files as variants\n directories.each do |directory|\n group = directory.split('_')[0]\n test_name = test_name_from_dir(directory)\n\n # Determines the type of test by the presence of the diff.png\n # file in the folder.\n # Ideally the manifest file format would be different and\n # include the test type with\n if files.select { |file_name| file_name.start_with?(directory) }.any? { |file_name| file_name.include?('diff.png') }\n variants = variants_for_page(directory, diffs)\n else\n variants = variants_for_api_endpoint(directory, diffs, files)\n end\n\n if diffs[directory]\n with_diffs[group][test_name] = variants\n else\n without_diffs[group][test_name] = variants\n end\n end\n\n return groups, without_diffs, with_diffs\n\n # For reference\n # gallery_format = {\n # \"1080\" => {\n # \"name\" => [\n # {\n # image: \"full_img_src\",\n # thumb: \"thumb_src\",\n # domain: \"production\"\n # }, {\n # image: \"foo_src\",\n # thumb: \"thumb_src\",\n # domain: \"test\"\n # }, {\n # image: \"diff_src\",\n # thumb: \"diff_thumb_src\",\n # domain: \"diff\",\n # diff_amt: 0.1\n # }\n # }\n # }\n # }\n end", "def folder_tree\n parent_folder_id =\n unsafe_params[:parent_folder_id] == \"\" ? nil : unsafe_params[:parent_folder_id].to_i\n scoped_parent_folder_id =\n unsafe_params[:scoped_parent_folder_id] == \"\" ? nil : unsafe_params[:scoped_parent_folder_id].to_i\n\n if unsafe_params[:scopes].present?\n check_scope!\n # exclude 'public' scope\n if unsafe_params[:scopes].first =~ /^space-(\\d+)$/\n spaces_members_ids = Space.spaces_members_ids(unsafe_params[:scopes])\n spaces_params = {\n context: @context,\n spaces_members_ids: spaces_members_ids,\n scopes: unsafe_params[:scopes],\n scoped_parent_folder_id: scoped_parent_folder_id,\n }\n files = UserFile.batch_space_files(spaces_params)\n folders = Folder.batch_space_folders(spaces_params)\n else\n files = UserFile.batch_private_files(@context, [\"private\", nil], parent_folder_id)\n folders = Folder.batch_private_folders(@context, parent_folder_id)\n end\n end\n\n folder_tree = []\n Node.folder_content(files, folders).each do |item|\n folder_tree << {\n id: item[:id],\n name: item[:name],\n type: item[:sti_type],\n uid: item[:uid],\n scope: item[:scope],\n }\n end\n\n render json: folder_tree\n end", "def parent_dirs(file); end", "def populate(level)\n\t\tinitialize\n\t\tself.name = level\n\t\tself.path = \"#{self.path}/#{level}\"\n\n\t\tDir.new(base_dir = \"#{self.path}\").each do |name|\n\t\tpath = \"#{base_dir}/#{name}\"\n\t\t\tif name !~ /^\\./\n\t\t\t\tif FileTest.directory?(path)\n\t\t\t\t\ttemp_dir = Directory.new\n\t\t\t\t\ttemp_dir.populate(\"#{level}/#{name}\")\n\t\t\t\t\tself.directories << temp_dir\n\t\t\t\telse\n\t\t\t\t\tself.files << name\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def find_nodes(src_dir=\"./\",full_tree=false)\n file = File.open(\"#{@name}\") if !self.is_leaf\n file.each_line do |line|\n match = /.*#include\\s+[<|\"](.*?)[\\>|\"]\\s*/.match(line)\n if !match.nil? and !match[1].nil?\n header = match[1]\n name = Dir.glob(\"#{src_dir}/**/#{header}\").first\n if name.nil? or name == \"\"\n node = Node.new(header,self,true)\n else\n node = Node.new(name,self,false)\n end\n existed = full_tree ? my_parents_has?(node) : tree_has?(node)\n if full_tree\n add_child(node) if !existed\n else\n node.is_leaf = existed if !node.is_leaf\n add_child(node)\n end\n end\n end\n self.childs\n end", "def make_tree(pre, inord)\n return if pre.size == 0\n root_node = Node.new(pre[0])\n idx = inord.index(pre[0])\n root_node.left = make_tree(pre[1..idx], inord[0...idx])\n root_node.right = make_tree(pre[idx+1...pre.size], inord[idx+1...inord.size])\n return root_node\nend", "def initialize(hsh, opener, content = nil)\n if content\n @hash_id, @opener = hsh, opener\n @type = 'tree'\n @content = content\n else\n super(hsh, opener)\n end\n parse!\n end", "def make_child_entry(name)\n if CHILDREN.include?(name)\n return nil unless root_dir\n\n return root_dir.child(name)\n end\n\n paths = (child_paths[name] || []).select { |path| File.exist?(path) }\n if paths.size == 0\n return NonexistentFSObject.new(name, self)\n end\n\n case name\n when \"acls\"\n dirs = paths.map { |path| AclsDir.new(name, self, path) }\n when \"client_keys\"\n dirs = paths.map { |path| ClientKeysDir.new(name, self, path) }\n when \"clients\"\n dirs = paths.map { |path| ClientsDir.new(name, self, path) }\n when \"containers\"\n dirs = paths.map { |path| ContainersDir.new(name, self, path) }\n when \"cookbooks\"\n if versioned_cookbooks\n dirs = paths.map { |path| VersionedCookbooksDir.new(name, self, path) }\n else\n dirs = paths.map { |path| CookbooksDir.new(name, self, path) }\n end\n when \"cookbook_artifacts\"\n dirs = paths.map { |path| CookbookArtifactsDir.new(name, self, path) }\n when \"data_bags\"\n dirs = paths.map { |path| DataBagsDir.new(name, self, path) }\n when \"environments\"\n dirs = paths.map { |path| EnvironmentsDir.new(name, self, path) }\n when \"groups\"\n dirs = paths.map { |path| GroupsDir.new(name, self, path) }\n when \"nodes\"\n dirs = paths.map { |path| NodesDir.new(name, self, path) }\n when \"policy_groups\"\n dirs = paths.map { |path| PolicyGroupsDir.new(name, self, path) }\n when \"policies\"\n dirs = paths.map { |path| PoliciesDir.new(name, self, path) }\n when \"roles\"\n dirs = paths.map { |path| RolesDir.new(name, self, path) }\n when \"users\"\n dirs = paths.map { |path| UsersDir.new(name, self, path) }\n else\n raise \"Unknown top level path #{name}\"\n end\n MultiplexedDir.new(dirs)\n end", "def build_file_list\n puts_and_logs 'Finding files...'\n file_list = []\n config[:source].each do |entry|\n if File.directory?(entry)\n populate_list_of_files_from_directory(file_list, entry) \n next\n end\n if File.file?(entry)\n populate_list_of_files_from_file(file_list, entry) \n next\n end\n logger.warn \"\\\"#{entry}\\\" is neither a directory nor a regular file. Ignored...\"\n end\n logger.debug(file_list)\n file_list\n end", "def initialize(site, base, dir, name)\n @config = Tenji::Config\n\n @site = site\n @base = base\n @dir = dir\n @name = name ? name : 'index.html'\n @path = name ? File.join(base, dir, name) : ''\n\n read_file base, dir, name\n\n process_dir config.dir(:galleries), config.dir(:galleries, :out)\n process_name \n \n paginate config.items_per_page\n \n data.default_proc = proc do |_, key|\n site.frontmatter_defaults.find(File.join(dir, @name), type, key)\n end\n\n Jekyll::Hooks.trigger :pages, :post_init, self \n end", "def target_files_in_dir(base_dir = T.unsafe(nil)); end", "def build_document_hash\n # Generate the base version keys for the doc_hash by gobbing all files and folders in the base directory. This means that any folder in the base directory will be treated as a version when being migrated. **You must have at least one version folder**.\n Dir.glob(\"*.*.*\").each {|version| GuidesGenerator::Parser::doc_hash[version] = {};}\n\n # With the version added to the base level of the `doc_hash` now we recursively generate the document structure for each version.\n GuidesGenerator::Parser::doc_hash.each {|version, hash| add_files_and_sections(version, hash);} \n end", "def build_tree( arr, first_index = 0, last_index = arr.length - 1 )\n return nil if first_index > last_index\n \n middle_of_array = (first_index + last_index)/2\n \n root = Node.new(arr[middle_of_array])\n \n root.left_child = build_tree(arr, first_index, middle_of_array - 1)\n root.right_child = build_tree(arr, middle_of_array + 1, last_index)\n \n return root \n end", "def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n current_dir = current_dir + \"/\" + name\n when :file\n file_list.push(current_dir + \"/\" + name)\n else\n throw \"BAD VISIT TYREE TYPE. #{type}\"\n end\n end\n file_list\n end", "def ls( *args )\r\n \r\n directory = nil\r\n opts = {}\r\n \r\n case args.count\r\n when 1\r\n if args[0].kind_of? Hash\r\n opts = args[0]\r\n else\r\n directory = args[0]\r\n end\r\n when 2\r\n directory = args[0]\r\n opts = args[1] \r\n end\r\n \r\n # args are the RPC arguments ...\r\n args = {}\r\n args[:path] = directory if directory\r\n args[:recursive] = true if opts[:recurse]\r\n args[:detail] = true if opts[:detail] \r\n args.delete(:detail) if( args[:detail] and args[:recursive])\r\n \r\n # RPC output format, default is XML\r\n outf = { :format => 'text' } if opts[:format] == :text\r\n \r\n got = @ndev.rpc.file_list( args, outf )\r\n return nil unless got\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n # if we're here, then we need to conver the output \r\n # to a Hash. Joy!\r\n \r\n collect_detail = args[:detail] || args[:recursive]\r\n \r\n ls_hash = {}\r\n got.xpath('directory').each do |dir|\r\n \r\n dir_name = dir.xpath('directory-name').text.strip\r\n dir_hash = {}\r\n \r\n dir_hash[:fileblocks] = dir.xpath('total-file-blocks').text.to_i\r\n files_info = dir.xpath('file-information')\r\n \r\n dir_hash[:files] = {} \r\n dir_hash[:dirs] = {} # sub-directories\r\n \r\n files_info.each do |file|\r\n f_name = file.xpath('file-name').text.strip\r\n f_h = {} \r\n \r\n if file.xpath('file-directory')[0]\r\n dir_hash[:dirs][f_name] = f_h\r\n else\r\n dir_hash[:files][f_name] = f_h \r\n end\r\n \r\n next unless collect_detail\r\n \r\n f_h[:owner] = file.xpath('file-owner').text.strip\r\n f_h[:group] = file.xpath('file-group').text.strip\r\n f_h[:links] = file.xpath('file-links').text.to_i\r\n f_h[:size] = file.xpath('file-size').text.to_i\r\n \r\n xml_when_item(file.xpath('file-symlink-target')) { |i|\r\n f_h[:symlink] = i.text.strip\r\n }\r\n \r\n fp = file.xpath('file-permissions')[0]\r\n f_h[:permissions_text] = fp.attribute('format').value\r\n f_h[:permissions] = fp.text.to_i\r\n \r\n fd = file.xpath('file-date')[0]\r\n f_h[:date] = fd.attribute('format').value\r\n f_h[:date_epoc] = fd.text.to_i\r\n \r\n end # each directory file\r\n ls_hash[ dir_name ] = dir_hash \r\n end # each directory\r\n \r\n return nil if ls_hash.empty?\r\n ls_hash\r\n end", "def new_paths_in(folder, count)\n first_node = ensure_unique_node(folder.path, SecureRandom.hex(8))\n remainder = count - 1\n remainder.times.inject([first_node]) do |nodes|\n path = File.join nodes.last.path, SecureRandom.hex(8)\n nodes << Folder.new(path)\n end\n end" ]
[ "0.6141361", "0.60677546", "0.55811995", "0.5536122", "0.5411839", "0.5408992", "0.53689533", "0.53160125", "0.5287648", "0.52826625", "0.5224509", "0.52074564", "0.5200433", "0.51936454", "0.51655424", "0.51397675", "0.5049832", "0.50456506", "0.5010944", "0.5000327", "0.49979985", "0.49969026", "0.49787012", "0.49753323", "0.4961284", "0.49544796", "0.49485964", "0.4947681", "0.49426442", "0.49219528", "0.489989", "0.489979", "0.48959398", "0.4895054", "0.48949715", "0.48759001", "0.48753223", "0.48732957", "0.48555878", "0.48529112", "0.4849941", "0.48466173", "0.48325408", "0.48270112", "0.48009655", "0.4786196", "0.47853017", "0.47835502", "0.4781989", "0.47808143", "0.4780104", "0.47646886", "0.47583577", "0.47570992", "0.47436506", "0.47426367", "0.47426367", "0.47360766", "0.47331125", "0.4731141", "0.4725701", "0.47256058", "0.4711193", "0.47099403", "0.47090453", "0.47038868", "0.46973854", "0.46934953", "0.4692202", "0.46904957", "0.46900895", "0.46890026", "0.46885458", "0.46855342", "0.4684299", "0.46842712", "0.4679637", "0.467884", "0.4675784", "0.46683896", "0.4667912", "0.46632773", "0.4661067", "0.46597546", "0.46474895", "0.46474454", "0.46466145", "0.46464553", "0.4638529", "0.46384144", "0.46304974", "0.46269634", "0.46236572", "0.4618448", "0.4603312", "0.46011096", "0.45987305", "0.45981687", "0.45979607", "0.45974872" ]
0.6081249
1
Execute a (local) command, or, if dryRun, just pretend to execute it. Raise an exception if the process exit status is not 0. N Without this method, wouldn't have an easy way to execute a command, echoing the command before it's executed, and optionally only doing a 'dry run', i.e. not running the command at all.
def executeCommand(command, dryRun) #N Without this, the command won't be echoed puts "EXECUTE: #{command}" #N Without this check, the command will be executed even if it is meant to be a dry run if not dryRun #N Without this, the command won't actualy be execute even when it is meant to be run system(command) #N Without this check, a failed command will be treated as if it had executed successfully checkProcessStatus(command) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def executeCommand(command, dryRun)\n #N Without this, the command won't be echoed to the user\n puts \"EXECUTE: #{command}\"\n #N Without this check, the command will be executed, even though it is intended to be a dry run\n if not dryRun\n #N Without this, the command won't be executed (when it's not a dry run)\n system(command)\n #N Without this, a command that fails with error will be assumed to have completed successfully (which will result in incorrect assumptions in some cases about what has changed as a result of the command, e.g. apparently successful execution of sync commands would result in the assumption that the remote directory now matches the local directory)\n checkProcessStatus(command)\n end\n end", "def execute!\n if Mcir::Core.instance.dryrun?\n Mcir::Core.instance.debug(\"CMD: \".purple << \"#{self.to_s.gsub(\"\\r\", \"\")}\")\n \"skipped execution due to dryrun\"\n else\n case @mode\n when :exec then exec(self.to_s)\n when :open then IO.new(self).open3\n when :capture then IO.new(self).capture3\n when :backticks then IO.new(self).backtick\n end\n end\n end", "def execute_command!(*argv)\n execute_command(argv)\n raise Error.new(\"Command failed!\") unless $?.success?\n end", "def execute(command, params={})\n unless params[:dry_run]\n if params[:return]\n System.execute(command, :return => true)\n else\n $stdout.puts\n System.execute(command)\n end\n end\n end", "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def run_command cmd, silent=false\n puts \"Running command: #{cmd}\" unless silent\n\n if silent\n `#{cmd}`\n else\n puts `#{cmd}`\n end\n\n return true if $?.exitstatus == 0\n\n puts \"Error running command '#{cmd}'\" unless silent\n false\nend", "def run_locally(cmd)\n if dry_run\n return logger.debug \"executing locally: #{cmd.inspect}\"\n end\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Benchmark.realtime do\n output_on_stdout = `#{cmd}`\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd} returned status code #{$?}\"\n end\n logger.trace \"command finished in #{(elapsed * 1000).round}ms\" if logger\n output_on_stdout\n end", "def execute_command(*argv)\n command = argv.flatten.reject(&:blank?).join(\" \\\\\\n \")\n if settings[:dry_run]\n log.info(\"Dry run:\")\n puts command\n else\n output = `#{command}`\n puts output unless output.empty?\n end\n end", "def exec!(command, input = nil)\n result = exec command, input\n return result.stdout if result.succeeded?\n \n raise \"exec! command exited with non-zero code #{result.exit_code}\"\n end", "def execute_command(cmd, verbose = true)\n puts \"Executing: #{cmd}\" if verbose\n cmd += \" > /dev/null 2>&1\" if verbose\n %x[#{cmd}]\n success = $?.success?\n puts success if verbose\n success\n end", "def try_to_run(command, verbose = false)\n r = system \"#{command}\";\n return r if r;\n $stderr.puts \"Process '#{command}' exited with #{$?.exitstatus}\"\n exit ($?.exitstatus)\nend", "def execute(command, ignore_failure = false)\n return Simp::Cli::ExecUtils::execute(command, ignore_failure, logger)\n end", "def run_command(command, ignore_failure = false)\n return Simp::Cli::ExecUtils::run_command(command, ignore_failure, logger)\n end", "def sh(command,options={},&block)\n sh_logger.debug(\"Executing '#{command}'\")\n\n stdout,stderr,status = execution_strategy.run_command(command)\n process_status = OptparsePlus::ProcessStatus.new(status,options[:expected])\n\n sh_logger.warn(\"stderr output of '#{command}': #{stderr}\") unless stderr.strip.length == 0\n\n if process_status.success?\n sh_logger.debug(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n call_block(block,stdout,stderr,process_status.exitstatus) unless block.nil?\n else\n sh_logger.info(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n sh_logger.warn(\"Error running '#{command}'\")\n end\n\n process_status.exitstatus\n rescue *exception_meaning_command_not_found => ex\n sh_logger.error(\"Error running '#{command}': #{ex.message}\")\n 127\n end", "def execute\n unless args.skip?\n if args.chained?\n execute_command_chain\n else\n exec(*args.to_exec)\n end\n end\n end", "def run_or_fail(cmd, redact: nil)\n put_command(cmd, redact: redact)\n Open3.popen3(*cmd) do |i, o, e, t|\n i.close\n if not t.value.success?\n STDERR.write red_term_text(e.read)\n exit t.value.exitstatus\n end\n end\n end", "def exec!(cmd, options={})\n exit_status, stdout, stderr, cmd = exec(cmd, options)\n error_msg = options[:error_msg] || \"The following command exited with an error\"\n raise Appd::RemoteError.new(stdout, stderr, exit_status, cmd), error_msg if exit_status != 0\n return stdout\n end", "def exec_local(opts = {})\n sh = Mixlib::ShellOut.new(\"#{@cmd}\")\n sh.timeout = 60 * 60 * 24 # 24hours\n sh.run_command\n\n @result = ShellCommandResult.new(@cmd, sh.stdout, sh.stderr, sh.exitstatus.to_i)\n\n raise_error! if opts[:abort_on_error]\n\n return @result\n end", "def execute command\n log command\n system(command) unless @options[:test]\n end", "def exec cmd\n puts cmd\n system cmd or die\nend", "def execute(command)\n system command\n code = $?.exitstatus\n if code > 0\n LOGGER.warn \"Failed to execute command `#{command}` with code #{code}.\"\n false\n else\n true\n end\n end", "def run(*args, verbose: true)\n pretty_command = prettify_command(*args)\n puts(\" $ #{pretty_command}\") if verbose\n unless system(*args)\n raise Exception.new(\"Could not execute `#{pretty_command}`, status nil\") if $?.nil?\n status = $?.exitstatus\n if status == 127\n raise Exception.new(\"Command not found... `#{pretty_command}` (#{status})\")\n else\n raise Exception.new(\"Command failed... `#{pretty_command}` (#{status})\")\n end\n end\n end", "def run_command(*command)\n print_command command\n result = system *command\n if result.nil?\n puts \"Failed to run command.\"\n exit 255\n elsif !result\n exit $?.exitstatus\n end\nend", "def run_cmd cmd\n info cmd\n status = system(cmd)\n if status\n info(\"Woot! Woot! - command succeeded #{cmd}\")\n else\n error(\"Gahhhh! Bad status from #{cmd}\")\n end\n status\n end", "def execute_with_exit(command) # rubocop:disable Lint/UnusedMethodArgument\n end", "def run_command!(name, *args)\n run_command(name, *args) rescue nil\n end", "def run_local(cmd)\n require 'English'\n\n system cmd\n return unless $CHILD_STATUS.exitstatus != 0\n\n puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s\n abort('Shell command failed, assuming you want to abort'.foreground(:red))\nend", "def sh(command)\n puts command\n system command unless dry_run\nend", "def run!\n # rubocop:disable Metrics/LineLength\n fail LaunchError, %(Command \"#{command}\" not found in PATH-variable \"#{environment['PATH']}\".) unless which(command, environment['PATH'])\n # rubocop:enable Metrics/LineLength\n\n if RUBY_VERSION < '1.9'\n begin\n old_env = ENV.to_hash\n ENV.update environment\n\n Dir.chdir @working_directory do\n @exit_status = system(@cmd) ? 0 : 1\n end\n ensure\n ENV.clear\n ENV.update old_env\n end\n elsif RUBY_VERSION < '2'\n Dir.chdir @working_directory do\n @exit_status = system(environment, @cmd) ? 0 : 1\n end\n else\n @exit_status = system(environment, @cmd, :chdir => @working_directory) ? 0 : 1\n end\n end", "def run_command(command, *args)\n `#{command} #{args.join(' ')} 2>/dev/null`\n end", "def run_command(cmd)\n if config[:simulate]\n puts_and_logs \" - Simulate running \\\"#{cmd}\\\"\"\n return\n end\n if config[:debug]\n if config[:verbose]\n puts_and_logs \" - Running \\\"#{cmd}\\\"\"\n else\n logger.debug \" - Running \\\"#{cmd}\\\"\"\n end\n system cmd\n return\n end\n puts_and_logs \" - Running \\\"#{cmd}\\\"\" if config[:verbose]\n system(cmd + ' > /dev/null 2>&1')\n\n end", "def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Benchmark.realtime do\n output_on_stdout = `#{cmd}`\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd} returned status code #{$?}\"\n end\n logger.trace \"command finished in #{(elapsed * 1000).round}ms\" if logger\n output_on_stdout\n end", "def run_command(command, options = {})\n status = run(command, options)\n fail \"#{command} failed\" unless status\nend", "def run_command(command, options = {})\n status = run(command, options)\n fail \"#{command} failed\" unless status\nend", "def exec_command(cmd)\n exec(cmd)\n # windows? ? exec(cmd) : fake_exec(cmd)\n end", "def run(cmd)\n puts \"#{cmd}\"\n success = system(cmd)\n exit $?.exitstatus unless success\nend", "def run\n system(command)\n $?\n end", "def run\n system(command)\n $?\n end", "def exec_shell(command, error_message, options = {})\n puts \"Running command: #{command}\" unless options[:silent] == true\n result = `#{command}`\n if options[:dont_fail_on_error] == true\n puts error_message unless $?.success?\n else\n fail_script_unless($?.success?, \"#{error_message}\\nShell failed: #{command}\\n#{result}\")\n end\n\n return result\n end", "def run_cmd(cmd)\n print_e(\"Run: #{cmd}\")\n exit_code = system(cmd)\n fail SystemCallError, cmd unless exit_code\n exit_code\n end", "def _run_command(command)\n require \"posix-spawn\"\n\n pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command)\n Process.waitpid(pid)\n\n # $?.exitstatus contains exit status do something with it if non zero raise error maybe\n end", "def execute\n raise errors.to_sentences unless valid?\n\n # default failing command\n result = false\n\n # protect command from recursion\n mutex = Mutagem::Mutex.new('revenc.lck')\n lock_successful = mutex.execute do\n result = system_cmd(cmd)\n end\n\n raise \"action failed, lock file present\" unless lock_successful\n result\n end", "def exec(command)\n ensure_mode(:privileged)\n run(command)\n end", "def execute_cmd(cmd)\n class_invariant\n pre_execute_cmd(cmd)\n begin\n env = {\"PWD\" => @pwd}\n exec(env, [cmd[0], \"\"], *cmd[1..-1], :unsetenv_others=>true, :chdir=>@pwd)\n rescue Errno::ENOENT\n puts \"Command '#{cmd[0]}' not found.\"\n end\n class_invariant\n end", "def try(command)\n system command\n if $? != 0 then\n raise \"Command: `#{command}` exited with code #{$?.exitstatus}\"\n end\nend", "def try(command)\n system command\n if $? != 0 then\n raise \"Command: `#{command}` exited with code #{$?.exitstatus}\"\n end\nend", "def try(command)\n system command\n if $? != 0 then\n raise \"Command: `#{command}` exited with code #{$?.exitstatus}\"\n end\nend", "def execute_command_from_command_line\n cmd = ARGV[0]\n if not cmd\n puts CMD_LINE_HELP\n elsif OPERATION_NAMES.include?(cmd) && !options.force_command\n begin\n self.send(*ARGV)\n rescue ArgumentError => ex\n $stderr.puts \"Wrong number of arguments (#{ARGV.size-1}) for operation: #{cmd}\"\n end\n else\n send_roku_command cmd\n end\n end", "def run_command(cmd, exit_on_error = false)\n Bundler.with_clean_env do\n system(cmd)\n status = $CHILD_STATUS.exitstatus\n\n return false unless status != 0\n return true unless exit_on_error\n exit status\n end\nend", "def run_shell_cmd(args)\n system(*args)\n raise \"command exited with a nonzero status code #{$?.exitstatus} (command: #{args.join(' ')})\" if !$?.success?\n end", "def safe_system cmd, *args\n raise ExecutionError.new($?) unless system(cmd, *args)\n end", "def exec!(cmd, *args)\n cmd = Command.new(cmd, args)\n cmd.exec!\n end", "def plain_command cmd, options={}\n system(cmd)\n exitstatus = $?.exitstatus == 0 || $?.exitstatus == 1\n show_output(exitstatus, options)\n exitstatus\n end", "def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($CHILD_STATUS.exitstatus.zero?)\nend", "def execute(command)\n if remote?\n @remote.exec(command)\n else\n rays_exec(command)\n end\n end", "def runSystemSafe(*cmdAndArgs)\n if cmdAndArgs.length < 1\n onError \"Empty runSystemSafe command\"\n end\n\n if !File.exists? cmdAndArgs[0] or !Pathname.new(cmdAndArgs[0]).absolute?\n # check that the command exists if it is not a full path to a file\n requireCMD cmdAndArgs[0]\n end\n\n system(*cmdAndArgs)\n $?.exitstatus\nend", "def run_cmd(cmd)\n puts blue(cmd)\n raise unless system cmd\n end", "def sh(cmd)\n output = `#{cmd}`\n if !$?.success?\n puts \"Command exited with failure code: #{cmd}\"\n puts \"Aborting.\"\n exit(1)\n end\n output\nend", "def execute_with_exit_code(command)\n if elevated\n session = elevated_session\n command = \"$env:temp='#{unelevated_temp_dir}';#{command}\"\n else\n session = unelevated_session\n end\n\n begin\n response = session.run(command) do |stdout, _|\n logger << stdout if stdout\n end\n [response.exitcode, response.stderr]\n ensure\n close\n end\n end", "def normaldo *args\n Kitchenplan::Log.info(*args)\n raise RuntimeError,\"'#{args}' returned non-zero\" unless system(*args)\n end", "def execute_option_or_command(options, command, args)\n options[:execute] ? eval_execute_option(options[:execute]) :\n execute_command(command, args)\n end", "def runSystemSafe(*cmd_and_args)\n onError 'Empty runSystemSafe command' if cmd_and_args.empty?\n\n if !File.exist?(cmd_and_args[0]) || !Pathname.new(cmd_and_args[0]).absolute?\n # check that the command exists if it is not a full path to a file\n requireCMD cmd_and_args[0]\n end\n\n system(*cmd_and_args)\n $CHILD_STATUS.exitstatus\nend", "def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Benchmark.realtime do\n output_on_stdout = `#{cmd}`\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd} returned status code #{$?}\"\n end\n logger.trace \"command finished in #{(elapsed * 1000).round}ms\" if logger\n output_on_stdout\n end", "def exec(command)\n command = \"sudo #{command}\"\n logger.debug \"Executing command: #{command}\"\n\n unless Config.dry_run\n Open3.popen3(command) { |stdin, stdout, stderr, wait_thr|\n pid = wait_thr.pid # pid of the started process.\n logger.debug \"Running pid: #{pid}\"\n\n logger.debug stdout.readlines\n\n exit_status = wait_thr.value.to_i # Process::Status object returned.\n logger.debug \"Exit status: #{exit_status}\"\n unless exit_status == 0\n logger.error 'Some error happended during execution:' \n logger.error stderr.readlines\n end\n }\n end\n end", "def systemOrDie(*cmd)\n puts 'executes: ' + cmd.join(' ')\n ret = system(*cmd)\n raise \"Failed to execute command: \" + cmd.join(' ') if !ret\n end", "def run\n begin\n execute\n say('')\n success \"Done.\"\n rescue CommandAborted, UnrecoverableError => e\n error(e.message)\n exit(255)\n end\n end", "def exec(_cmd, _args = {})\n false\n end", "def execute\n $logger.debug \"Main arguments are #{$main_args}\"\n $logger.debug \"Sub-command is #{$sub_command}\"\n $logger.debug \"Sub-arguments are #{$sub_args}\"\n if $main_args.include?('-h') || $main_args.include?('--help')\n # Help is next in short-circuiting everything. Print\n # the help and exit.\n help\n return 0\n end\n\n if !parse_main_args($main_args)\n help\n return 1\n end\n\n # -e commands detected\n if !$eval_cmds.empty?\n $eval_cmds.each do |cmd|\n $logger.debug \"Executing cmd: #{cmd}\"\n eval(cmd)\n end\n if $sub_command\n $logger.warn \"Evaluate mode detected, ignoring sub_command #{$sub_command}\"\n return 0\n end\n return 0\n end\n\n # If we reached this far then we must have a command. If not,\n # then we also just print the help and exit.\n command_plugin = nil\n if $sub_command\n command_plugin = command_list[$sub_command.to_sym]\n end\n\n if !command_plugin || !$sub_command\n help\n return 1\n end\n\n command_class = command_plugin[0].call\n $logger.debug(\"Invoking command class: #{command_class} #{$sub_args.inspect}\")\n\n # Initialize and execute the command class, returning the exit status.\n result = 0\n begin\n result = command_class.new.execute($sub_args)\n rescue Interrupt\n $logger.error '?'\n result = 1\n end\n\n result = 0 unless result.is_a?(Integer)\n result\n end", "def execute(*command, &block)\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info('Exit code != 0, but interrupted. Ignoring.')\n else\n # If there was an error running command, show the error and the\n # output.\n raise VagrantPlugins::Parallels::Errors::ExecutionError,\n command: command.inspect,\n stderr: r.stderr\n end\n end\n r.stdout\n end", "def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($?.exitstatus.zero?)\nend", "def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($?.exitstatus.zero?)\nend", "def run_command(command, quiet=false)\n log_stdout \"Executing command: #{command}\", quiet\n out, _, _ = guestcontrol_exec \"cmd.exe\", \"cmd.exe /c \\\"#{command}\\\"\"\n out\n end", "def run_cmd_no_exception(cmd)\n #TODO: find a better way to handle command with errors\n begin\n result = Puppet::Util::Execution.execute([cmd], {:combine => true})\n rescue\n result\n end\n end", "def run_cmd_no_exception(cmd)\n #TODO: find a better way to handle command with errors\n begin\n result = Puppet::Util::Execution.execute([cmd], {:combine => true})\n rescue\n result\n end\n end", "def run(command)\n\traise \"non-zero exit status: `#{command}`\" if !system(\"cd #{$root} && #{command}\")\nend", "def run_inline(cmd, redact: nil)\n put_command(cmd, redact: redact)\n\n # `system`, by design (?!), hides stderr when the command fails.\n if ENV[\"PROJECTRB_USE_SYSTEM\"] == \"true\"\n if not system(*cmd)\n exit $?.exitstatus\n end\n else\n pid = spawn(*cmd)\n Process.wait pid\n if $?.exited?\n if !$?.success?\n exit $?.exitstatus\n end\n else\n error \"Command exited abnormally.\"\n exit 1\n end\n end\n end", "def execute(*args, env: nil, log: true, &block)\n env ||= environment\n status(\"Execute: #{args.join(\" \")}\") if log\n env.execute(*args, &block)\n end", "def execute(*command, &block)\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n raise Errors::VBoxManageError, :command => command.inspect\n end\n end\n\n # Return the output\n r.stdout\n end", "def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end", "def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end", "def run(*args)\n opts = $opts.dup\n opts.merge! args.last if args.last.is_a? Hash\n status = run_with_status(*args)\n return unless opts[:errexit]\n unless status.success?\n # Print an error at the failure site\n puts \"#{c_red}Command exited with #{status.exitstatus}#{c_reset}\"\n fail \"Command exited with #{status.exitstatus}\"\n end\nend", "def execute\n parse_command\n run_command(command)\n end", "def execute_command command_text\r\n #TODO: really, what is point of this \"convenience\" method!?\r\n create_command( command_text ).execute\r\n end", "def run(method: :run, exec: nil, env: {}, opts: {})\n return if @result || @exit_error\n\n @exec = exec if exec\n @env.merge!(env)\n @opts.merge!(opts).transform_keys!(&:to_sym)\n @result = command.send(method, @env, @exec, run_opts)\n self\n rescue TTY::Command::ExitError => e\n @exit_error = e\n ensure\n # binding.pry\n self\n end", "def run( *cmd )\n\t\t\tcmd.flatten!\n\n\t\t\tif cmd.length > 1\n\t\t\t\ttrace( \"Running:\", quotelist(*cmd) )\n\t\t\telse\n\t\t\t\ttrace( \"Running:\", cmd )\n\t\t\tend\n\n\t\t\tif Rake.application.options.dryrun\n\t\t\t\tlog \"(dry run mode)\"\n\t\t\telse\n\t\t\t\tsystem( *cmd )\n\t\t\t\tunless $?.success?\n\t\t\t\t\tfail \"Command failed: [%s]\" % [cmd.join(' ')]\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def exec_cmd(cmd, as_su: false, chdir: nil)\n cmd = cmd.map(&:to_s).map(&:shell_escape).join(\" \") if cmd.is_a?(Array)\n\n full_cmd = as_su ? \"sudo #{cmd}\" : cmd\n\n run_mode = defined?(@run_mode) ? @run_mode : :normal\n\n really_run = case run_mode\n when :normal then true\n when :paranoid\n ask(\"Do you want to run command `#{full_cmd}`\")\n when :dry then false\n else true\n end\n\n if really_run || run_mode == :dry\n tell(as_su ? \"{m{[sudo]}} #{cmd}\" : cmd)\n end\n\n status = nil\n if really_run\n if chdir\n FileUtils.cd(chdir) do\n status = system(full_cmd)\n end\n else\n status = system(full_cmd)\n end\n warning(\"Command `#{full_cmd}` failed.\") unless status\n end\n status\n end", "def run(command, args = nil)\n line = nil\n if args\n args = args.map(&:to_s)\n line = \"#{command} #{args.join(\" \")}\"\n vputs line\n system(command, *args)\n else\n line = command\n vputs line\n system(command)\n end\n if $? != 0\n if $?.termsig == Signal.list[\"INT\"]\n raise \"#{line} interrupted\"\n end\n raise RunError, \"#{line} failed : #{$?.to_i / 256}\"\n end\n end", "def exec!(cmd)\n connect! unless @connected\n if using_ssh?\n logger.debug(\"ssh: \" + cmd)\n ssh_session.exec!(cmd)\n else\n logger.debug(cmd)\n `#{cmd}`\n end\n end", "def execute(command)\n if valid_command?(command)\n apply_command(command)\n else\n return 'Invalid command.'\n end\n end", "def exec_command_or_do(command, from, &block)\n return if self.exec_command(command, from)\n\n unless block.nil?\n @log.info \"Executing default action\"\n block.call(command, from)\n end\n end", "def run_local(cmd)\n require 'English'\n\n system cmd\n return unless $CHILD_STATUS.exitstatus != 0\n puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s\n exit\nend", "def exec\n binding.pry\n # command.run(*service.exec(args.command))\n end", "def exec?(cmd, options={})\n exit_status, stdout, stderr, cmd = exec(cmd, options)\n return (exit_status == 0)\n end", "def run(*params)\n opts = params.extract_options!\n command = Array.wrap(params).join(' ')\n info command unless opts[:quiet]\n\n begin\n cmdrunner = Mixlib::ShellOut.new(command, timeout: opts[:timeout] || Conveyor::Foreman.instance.config[:command_timeout] || 600)\n cmdrunner.run_command()\n\n info cmdrunner.stdout.chomp unless cmdrunner.stdout.chomp.length == 0\n\n \t\t\t\tif cmdrunner.error!\n \terror \"Error running: `#{command}`\", cmdrunner.stderr.chomp\n \[email protected]!\n \t\t\t\telse\n \t\t\t\t\tif cmdrunner.stderr.chomp.length > 0\n \t\t\t\t\t\twarning \"Error output recieved, but no error code recieved\"\n \t\t\t\t\t\twarning cmdrunner.stderr.chomp\n \t\t\t\t\tend\n \t\t\t\tend\n\n return !cmdrunner.error!\n rescue Mixlib::ShellOut::CommandTimeout => e\n error e.class, e.message, \"Command: #{command}\"\n # raise e unless opts[:ignore_error]\n rescue => e\n error e.class, e.message, e.backtrace.join(\"\\n\")\n # raise e unless opts[:ignore_error]\n end\n end", "def execute(*command)\n UI.say \"=> #{command.join(' ')}\".color(:green)\n success = system(*command)\n unless success\n UI.error(command.join(' '))\n exit 1\n end\n end", "def sh!(*cmd)\n sh?(*cmd) || raise(\"returned #{$CHILD_STATUS}\")\nend", "def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end", "def check_execute\n unless executed?\n execute\n end\n end", "def ct_exec_run(opts)\n pid = Process.fork do\n STDIN.reopen(opts[:stdin])\n STDOUT.reopen(opts[:stdout])\n STDERR.reopen(opts[:stderr])\n\n setup_exec_env\n\n cmd = [\n 'lxc-execute',\n '-P', @lxc_home,\n '-n', opts[:id],\n '-o', @log_file,\n '-s', \"lxc.environment=PATH=#{PATH.join(':')}\",\n '--',\n opts[:cmd],\n ]\n\n # opts[:cmd] can contain an arbitrary command with multiple arguments\n # and quotes, so the mapping to process arguments is not clear. We use\n # the shell to handle this.\n Process.exec(\"exec #{cmd.join(' ')}\")\n end\n\n _, status = Process.wait2(pid)\n ok(exitstatus: status.exitstatus)\n end", "def execute(cmd)\n res = eval(cmd, @pure_binding)\n $last_res = res\n eval(\"_ = $last_res\", @pure_binding)\n print_result res\n rescue Rush::Exception => e\n puts \"Exception #{e.class} -> #{e.message}\"\n rescue ::Exception => e\n puts \"Exception #{e.class} -> #{e.message}\"\n e.backtrace.each do |t|\n puts \" #{::File.expand_path(t)}\"\n end\n end" ]
[ "0.76763886", "0.71551645", "0.6957548", "0.679227", "0.6657023", "0.6637209", "0.65126526", "0.6484159", "0.648315", "0.63907516", "0.63817585", "0.63771355", "0.6376905", "0.63291615", "0.63220257", "0.63069695", "0.6257568", "0.62249607", "0.6215184", "0.6151733", "0.6142183", "0.612768", "0.609515", "0.6094472", "0.60630906", "0.6054519", "0.60510176", "0.6047982", "0.60477656", "0.604643", "0.603459", "0.6027867", "0.6021906", "0.6021906", "0.60209745", "0.60068065", "0.6004015", "0.6004015", "0.6002508", "0.5988575", "0.59874725", "0.59860605", "0.5971813", "0.59548527", "0.59514445", "0.59514445", "0.59514445", "0.59369594", "0.59357274", "0.5935402", "0.5933105", "0.5918505", "0.5901629", "0.58924335", "0.5890214", "0.58849895", "0.5874218", "0.5861735", "0.5852981", "0.5852392", "0.58291507", "0.58254474", "0.5816922", "0.58159137", "0.5806806", "0.58050334", "0.5800994", "0.57966274", "0.57748544", "0.57601637", "0.57601637", "0.5743751", "0.57332367", "0.57332367", "0.5725338", "0.57239175", "0.57235026", "0.570739", "0.5700723", "0.5700723", "0.56935793", "0.5666586", "0.5664599", "0.5663264", "0.5652642", "0.56465405", "0.56439793", "0.5642133", "0.5637843", "0.56293505", "0.5625073", "0.561756", "0.56173843", "0.5609359", "0.5607441", "0.5605374", "0.5593069", "0.5591713", "0.5579984", "0.5575527" ]
0.74745876
1
N Without a base close method, implementations that don't need anything closed will fail when 'close' is called on them.
def close # by default do nothing - close any cached connections end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n # no-op\n end", "def close\n # NOOP\n end", "def close\n # NOOP\n end", "def close\n\t\traise NotImplementedError\n\tend", "def close?\n fail NotImplementedError\n end", "def close\n super\n rescue IOError\n # Already closed\n end", "def close\n raise NotImplementedError\n end", "def closed?() end", "def closed?() end", "def closed?() end", "def _close\n end", "def close() end", "def close() end", "def close() end", "def close() end", "def close() end", "def close_read(*) end", "def close; true; end", "def close; true; end", "def close *args\n end", "def closed?; end", "def closed?; end", "def closed?; end", "def closed?; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def closing; end", "def closing; end", "def do_close; end", "def close_file_descriptors; end", "def close\n raise NotImplementedError\n end", "def closed?() @closed end", "def closing?; end", "def close_read() end", "def close_read() end", "def close_read() end", "def close\n # Do nothing.\n end", "def close!\n safe_close\n end", "def closed\n raise NotImplementedError\n end", "def can_close?; end", "def close\n raise NotImplementedError, \"You must implement #close in your driver.\"\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close!\n end", "def closed?\n raise NotImplementedError\n end", "def close\n nil\n end", "def test_close_twice\n nc = Dataset.new('test/data/simple.nc')\n nc.close()\n assert_raise NetCDFError do\n nc.close()\n end\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n # this method may be left unimplemented if that is applicable\n end", "def close!\n # Not implemented\n end", "def close(reason: T.unsafe(nil), reconnect: T.unsafe(nil)); end", "def close_write(*) end", "def close(error = nil)\n self.close_read\n self.close_write\n\n return nil\n ensure\n @closed = true\n end", "def disable_close()\n #This is a stub, used for indexing\n end", "def close\n # ..\n end", "def closed?()\n #This is a stub, used for indexing\n end", "def close(close_delegate = true)\n super()\n @io.close if close_delegate\n end", "def close(close_delegate = true)\n super()\n @io.close if close_delegate\n end", "def close()\n #This is a stub, used for indexing\n end", "def test_redef_closed\n nc = Dataset.new('test/data/simple.nc')\n nc.close()\n assert_raise NetCDFError do\n nc.define_mode()\n end\n end", "def closed\n end", "def close\n Native.close == 1\n end", "def local_closed?; end", "def close\n [@in, @out, @err].each {|f| f.close if f && !f.closed? }\n wait unless @waited\n end", "def close\n\n # nothing to do here.\n end", "def close\n super\n @closing_method.call\n end", "def close(close_delegate = true)\n super()\n io.close if close_delegate\n end", "def test_double_close()\n rdht = Scalaroid::ReplicatedDHT.new()\n rdht.close_connection()\n rdht.close_connection()\n end" ]
[ "0.6287926", "0.6172954", "0.6172954", "0.6170204", "0.6131228", "0.6066422", "0.6061416", "0.60394496", "0.60394496", "0.60394496", "0.6004966", "0.59934956", "0.59934956", "0.59934956", "0.59934956", "0.5993111", "0.5969297", "0.5947212", "0.5947212", "0.59210753", "0.59110075", "0.59110075", "0.59110075", "0.59110075", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.5881537", "0.582959", "0.582959", "0.5811584", "0.5809524", "0.5800854", "0.5779438", "0.57740235", "0.5721019", "0.5721019", "0.5721019", "0.5700316", "0.5696372", "0.5694604", "0.56419164", "0.5622483", "0.5592115", "0.5592115", "0.5592115", "0.5592115", "0.5592115", "0.5592115", "0.5592115", "0.5592115", "0.5592115", "0.5573687", "0.55715746", "0.55646324", "0.5560593", "0.5560306", "0.5560306", "0.5560306", "0.555296", "0.55403763", "0.55061793", "0.54877806", "0.5474604", "0.5459588", "0.5444096", "0.5389683", "0.5385701", "0.5385701", "0.5384634", "0.53619844", "0.5356383", "0.5347363", "0.5338653", "0.5328669", "0.5323287", "0.5322026", "0.5314678", "0.5313819" ]
0.0
-1
delete remote directory (if dryRun is false) using "rm r" N Without this method, there won't be any way to delete a directory and it's contents on a remote system
def deleteDirectory(dirPath, dryRun) #N Without this, the required ssh command to recursive remove a directory won't be (optionally) executed. Without the '-r', the attempt to delete the directory won't be successful. ssh("rm -r #{dirPath}", dryRun) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rm_r(path)\n cmd 'rm', '-r', path\nend", "def deleteDirectory(dirPath, dryRun)\n #N Without this, the deletion command won't be run at all\n sshAndScp.deleteDirectory(dirPath, dryRun)\n end", "def files_remote_remove(options = {})\n post('files.remote.remove', options)\n end", "def rm_rf(path)\n cmd 'rm', '-rf', path\nend", "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def delete(rmdir: false)\n # FIXME: rethink this interface... should qdel be idempotent?\n # After first call, no errors thrown after?\n\n if pbsid\n\n @torque.qdel(pbsid, host: @host)\n # FIXME: removing a directory is always a dangerous action.\n # I wonder if we can add more tests to make sure we don't delete\n # something if the script name is munged\n\n # recursively delete the directory after killing the job\n Pathname.new(path).rmtree if path && rmdir && File.exist?(path)\n end\n end", "def clear_remote\n execute(:rm, '-rf', File.join(remote_cache_path, '*')) if test!(\"[ -d #{remote_cache_path} ]\")\n end", "def rm_r\n util.rm_r(path)\n end", "def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:node_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n project = get_default_project()\n\n NodeModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end", "def deleteFile(filePath, dryRun)\n #N Without this, the required ssh command to delete a file won't be (optionally) executed.\n ssh(\"rm #{filePath}\", dryRun)\n end", "def rm(path)\n cmd 'rm', path\nend", "def rmdir(path)\n send_request(FXP_RMDIR, :string, path)\n end", "def rm_rf path\n execute(\"rm -rf #{path}\")\n end", "def rm(path)\n run_via \"rm #{path}\"\n end", "def rmdir(dirname)\n ensure_relative_path! :rmdir, path\n @sftp.rmdir! remote_path(dirname)\n end", "def rmdir() Dir.rmdir( expand_tilde ) end", "def destroy(remote_path)\n get_adapter.delete_file(remote_path)\n end", "def rm_rf(path)\n run_via \"rm -rf #{path}\"\n end", "def smb_rmdir(dirname, rdir=nil)\n if rdir.nil?\n dir=''\n else\n dir=' -D ' + rdir\n end\n file = Tempfile.new('ruby_smbclient')\n if @hashpass\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass} -c 'rmdir #{dirname}'#{dir} > #{file.path} 2>&1\")\n else\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass} -c 'rmdir #{dirname}'#{dir} > #{file.path} 2>&1\")\n end\n file.unlink\n if success\n return true\n else\n return false\n end\n end", "def rmtree\n # The name \"rmtree\" is borrowed from File::Path of Perl.\n # File::Path provides \"mkpath\" and \"rmtree\".\n FileUtils.rm_r( expand_tilde )\n end", "def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:test_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n\n project = get_default_project()\n TestModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end", "def rm_rf(z, path)\n z.get_children(:path => path).tap do |h|\n if h[:rc].zero?\n h[:children].each do |child|\n rm_rf(z, File.join(path, child))\n end\n elsif h[:rc] == ZNONODE\n # no-op\n else\n raise \"Oh noes! unexpected return value! #{h.inspect}\"\n end\n end\n\n rv = z.delete(:path => path)\n\n unless (rv[:rc].zero? or rv[:rc] == ZNONODE)\n raise \"oh noes! failed to delete #{path}\" \n end\n\n path\n end", "def destroy_file\n start_ssh do |ssh|\n ssh.exec!(\"rm #{e full_filename}\")\n dir = File.dirname(full_filename)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n dir = File.dirname(dir)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n end\n end", "def rmdir() Dir.rmdir(path) end", "def smb_rm(filename, rdir=nil)\n if rdir.nil?\n dir=''\n else\n dir=' -D ' + rdir\n end\n file = Tempfile.new('ruby_smbclient')\n if @hashpass\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n else\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n end\n file.unlink\n if success\n return true\n else\n return false\n end\n end", "def rmdir\n util.rmdir(path)\n end", "def remove_local_copy\n Dir.chdir(self.study.data_store_path)\n if File.exists?(self.download_location)\n File.delete(self.download_location)\n subdir = self.remote_location.blank? ? self.id : self.remote_location.split('/').first\n if Dir.exist?(subdir) && Dir.entries(subdir).delete_if {|e| e.start_with?('.')}.empty?\n Dir.rmdir(subdir)\n end\n end\n end", "def rmdir(dirname)\n voidcmd(\"RMD \" + dirname)\n end", "def remove(rm_path)\n\t\t# ver si hacer el git remove aca o dejarlo antes del sync como esta ahora\n\t\tif(File.ftype(rm_path) == 'directory')\n\t\t\tFileUtils.remove_dir(rm_path)\n\t\telse\n\t\t\tFileUtils.remove_file(rm_path)\n\t\tend\n\tend", "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "def delete(rpm_remote_href, opts = {})\n data, _status_code, _headers = delete_with_http_info(rpm_remote_href, opts)\n data\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 destroy\n FileUtils.rm_r(@repository.path)\n end", "def action_delete\n if (!dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } doesn't exist; delete action not taken\")\n else\n converge_by(\"Delete #{ @new_resource }\") do\n @client.delete(@path)\n end\n new_resource.updated_by_last_action(true)\n end\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def rmdir(dirname)\n\t\tvoidcmd(\"RMD \" + dirname)\n\t end", "def remove_dir(sftp_session, remote_path, local_path)\n\n if local_path\n\n # remove the local directory\n FileUtils.remove_dir(local_path)\n elsif remote_path\n\n # remove all of the files in the remote location\n sftp_session.dir.foreach(remote_path) do |remote_entry|\n\n # don't remove the links to the current or parent directory\n if(remote_entry.name != \".\" && remote_entry.name != \"..\")\n\n if remote_entry.directory?\n\n remove_dir(sftp_session, remote_path + \"/\" + remote_entry.name, nil)\n else\n\n remove_file(sftp_session, remote_path + \"/\" + remote_entry.name,\n nil)\n end\n end\n end\n \n # remove the remote directory, we block in case this is a\n # recursive call and the parent directory is going to be deleted\n # when this call returns\n sftp_session.rmdir!(remote_path)\n end\n end", "def deleteFile(filePath, dryRun)\n #N Without this, the deletion command won't be run at all\n sshAndScp.deleteFile(filePath, dryRun)\n end", "def unlink!\n FileUtils.rm_rf(directory)\n end", "def delete_directories account\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n \n # Tell the user\n puts \"> Tar bort kontot från filsystemet\".green\n\n # Build the paths\n mail_dir = BASE_PATH_MAIL + account['mail']\n home_dir = BASE_PATH_HOME + account['home']\n\n # Remove the directories\n fu.rm_r mail_dir\n fu.rm_r home_dir\nend", "def destroy\n FileUtils.rm_r(directory) if exist?\n end", "def delete_dir\n FileUtils.rm_rf(@server_dir)\n @queue = []\n end", "def delete_directory(client, options)\n if !options[:directory].nil?\n directory = client.directories.get options[:directory]\n directory.delete\n puts \"Directory deleted.\"\n return\n else\n puts \"Missing arguments\"\n return nil\n end\nend", "def delete_directory_contents(options)\n Process::Delete::DirectoryContents.delete(options[:directory_path])\n end", "def rmtree\n # The name \"rmtree\" is borrowed from File::Path of Perl.\n # File::Path provides \"mkpath\" and \"rmtree\".\n require 'fileutils'\n FileUtils.rm_r(path)\n nil\n end", "def rest__delete_remote\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n version = ret_request_params(:version)\n\n opts = {}\n opts.merge!(namespace: remote_namespace) unless remote_namespace.empty?\n\n remote_namespace, remote_module_name = Repo::Remote.split_qualified_name(ret_non_null_request_params(:remote_module_name), opts)\n remote_params = remote_params_dtkn(:component_module, remote_namespace, remote_module_name, version)\n\n project = get_default_project()\n response = ComponentModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n\n rest_ok_response response\n end", "def rmtree\n\t\t\t\trequire 'fileutils'\n\t\t\t\tFileUtils.rm_rf(@path)\n\t\t\t\tnil\n\t\t\tend", "def rmdir(dirname)\n ensure_relative_path! :rmdir, dirname\n @ftp.rmdir dirname\n end", "def delete_dir_contents(target_dir)\n Find.find(target_dir) do |x|\n if File.file?(x)\n FileUtils.rm(x)\n elsif File.directory?(x) && x != target_dir\n FileUtils.remove_dir(x)\n end\n end\n end", "def destroy_directory!(directory)\n system(\"trash #{directory}\")\n end", "def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end", "def recursively_delete_dir(dir)\n FileUtils.rm_rf(dir) # or use FileUtils.rm_r(dir, :force => true)\n # system(\"rm -rf #{dir}\")\n end", "def rm path\n end", "def rm_r(dir)\n Dir.entries(dir).each do |entrada|\n if (File.directory?(\"#{dir}/#{entrada}\") and (entrada != \".\" and entrada != \"..\") )\n rm_r(\"#{dir}/#{entrada}\")\n Dir.delete(\"#{dir}/#{entrada}\")\n else\n File.delete(\"#{dir}/#{entrada}\") if (entrada != \".\" and entrada != \"..\")\n end\n end\nend", "def rm_r(options={})\n #list = list.to_a\n fileutils.rm_r(list, options)\n end", "def clean_directory(path, types=nil, run_context=nil)\n raise 'clean_directory path must be a non-empty string!' if path.nil? or path.empty?\n types ||= [\n Chef::Resource::File,\n Chef::Resource::Link,\n Chef::Resource::CookbookFile,\n Chef::Resource::RemoteFile,\n Chef::Resource::Template,\n ]\n run_context ||= node.run_context\n\n # find the chef files generated\n chef_files_generated = run_context.resource_collection.select { |r|\n types.include?(r.class) and r.path.start_with?(path)\n }.map { |r| r.path }\n\n # find the fileststem files present\n filesystem_files_present = Dir[\"#{path}/**/*\"].select { |f|\n ::File.file?(f) or ::File.symlink?(f)\n }\n\n # calculate the difference, and remove the extraneous files\n (filesystem_files_present - chef_files_generated).each do |f|\n if ::File.symlink?(f)\n link \"clean_directory: #{f}\" do\n target_file f\n action :delete\n end\n else\n file \"clean_directory: #{f}\" do\n path f\n action :delete\n end\n end\n end\nend", "def delete_directory domain\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n\n # Tell the user\n puts \"> Tar bort domänen från filsystemet\".green\n\n # Build the paths\n mail_dir = BASE_PATH_MAIL + domain['domain']\n home_dir = BASE_PATH_HOME + domain['domain']\n\n # Remove the directories\n fu.rm_r mail_dir\n fu.rm_r home_dir\nend", "def cmd_rmdir(*args)\n\t\tif (args.length == 0 or args.include?(\"-h\"))\n\t\t\tprint_line(\"Usage: rmdir dir1 dir2 dir3 ...\")\n\t\t\treturn true\n\t\tend\n\n\t\targs.each { |dir|\n\t\t\tprint_line(\"Removing directory: #{dir}\")\n\t\t\tclient.fs.dir.rmdir(dir)\n\t\t}\n\n\t\treturn true\n\tend", "def destroy(context={})\n self.class.rpc_execute('unlink', self.id, context)\n end", "def delete_remote\n policy = get_policy(\"remove\")\n signature = get_signature(policy)\n remote = url+\"?signature=\"+signature+\"&policy=\"+policy\n try = self.class.delete(remote)\n\n # If file not found in filepicker, destroy anyway, else only if success\n if try.not_found?\n true\n else\n try.success?\n end\n end", "def delete\n File.delete fullpath\n dirname = File.dirname(fullpath)\n while dirname != root\n Dir.rmdir(dirname)\n dirname = File.dirname(dirname)\n end\n rescue Errno::ENOTEMPTY\n end", "def rm_r(*paths)\n paths.each do |path|\n path = File.expand_path path\n\n prefix = SPEC_TEMP_DIR\n unless path[0, prefix.size] == prefix\n raise ArgumentError, \"#{path} is not prefixed by #{prefix}\"\n end\n\n # File.symlink? needs to be checked first as\n # File.exists? returns false for dangling symlinks\n if File.symlink? path\n File.unlink path\n elsif File.directory? path\n Dir.entries(path).each { |x| rm_r \"#{path}/#{x}\" unless x =~ /^\\.\\.?$/ }\n Dir.rmdir path\n elsif File.exists? path\n File.delete path\n end\n end\n end", "def rm!( path )\r\n got = @ndev.rpc.file_delete( :path => path )\r\n return true if got.nil? # got no error\r\n # otherwise, there was an error, check output\r\n raise IOError, got.text\r\n end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def destroy(context={})\n rpc_execute('unlink', [self.id], context)\n end", "def remove!\n messages = []\n transferred_files do |local_file, remote_file|\n messages << \"#{storage_name} started removing '#{ local_file }'.\"\n end\n Logger.message messages.join(\"\\n\")\n\n FileUtils.rm_r(remote_path)\n end", "def delete\n FileUtils.rm_rf(to_s)\n self\n end", "def rmdir(list, options = {})\r\n fu_check_options options, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message \"rmdir #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n list.each do |dir|\r\n Dir.rmdir dir.sub(%r</\\z>, '')\r\n end\r\n end", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def rm_rf(list, options = {})\r\n fu_check_options options, :noop, :verbose\r\n options = options.dup\r\n options[:force] = true\r\n rm_r list, options\r\n end", "def rmdir_ie path\n rmdir path if File.exist?(path)\n end", "def delete(remote_filepath)\n @request = Net::HTTP::Delete.new(::File.join(@uri.path, remote_filepath))\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.body.presence || @response.code.to_i\n end", "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 rm_rf(options={})\n #list = list.to_a\n fileutils.rm_rf(list, options)\n end", "def ftp_remove path\n return ftp_action(true, path)\n end", "def delete_gdom_dir(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n destroy_zfs_fs(gdom_dir)\n return\nend", "def rm_rf(list, noop: nil, verbose: nil, secure: nil)\n rm_r list, force: true, noop: noop, verbose: verbose, secure: secure\n end", "def remove(path, force: false, recursive: false, quote_with: '\"')\n command = [ \"rm\" ]\n command << \"-f\" if force\n command << \"-r\" if recursive\n command << path\n quote_command(command, quote_with: quote_with)\n end", "def cmd_rm(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\"Usage: rm file\")\n\t\t\treturn true\n\t\tend\n\n\t\tclient.fs.file.rm(args[0])\n\n\t\treturn true\n\tend", "def rmdir(list, options = {})\r\n fu_check_options options, OPT_TABLE['rmdir']\r\n list = fu_list(list)\r\n fu_output_message \"rmdir #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n list.each do |dir|\r\n Dir.rmdir dir.sub(%r</\\z>, '')\r\n end\r\n end", "def rmdir(list, options = {})\r\n fu_check_options options, OPT_TABLE['rmdir']\r\n list = fu_list(list)\r\n fu_output_message \"rmdir #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n list.each do |dir|\r\n Dir.rmdir dir.sub(%r</\\z>, '')\r\n end\r\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 rm(key, options = {})\n return 1 unless self.class.subkeys.include?(key)\n begin\n puts \"Removing directory: #{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"\n FileUtils.rm_rf(Dir[\"#{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"].first)\n 0\n rescue\n 1\n end\n end", "def rmdir(dir)\n FileUtils.rm_rf dir\n puts \" ✔ rm -rf #{dir}\".colorize(:magenta).bold\n end", "def destroy(_)\n paths = [\n instance.provisioner[:root_path], instance.verifier[:root_path]\n ]\n paths.each do |p|\n FileUtils.rm_rf(p)\n logger.info(\"[Localhost] Deleted temp dir '#{p}'.\")\n end\n self.class.unlock!\n end", "def delete_completely(root, resource)\n path = File.join(root, resource.path(identifying_sym))\n FileUtils.rm_rf(path)\n\n # removes the empty directories upward\n (resource.identifiers(identifying_sym).size - 1).times do |t|\n path = File.split(path).first\n begin\n FileUtils.rmdir(path)\n rescue Errno::ENOTEMPTY\n break\n end\n end\n end", "def destroy\n run_callbacks :destroy do\n if directory?\n logger.info \"Delete directory at #{absolute_path}\"\n FileUtils.rmdir absolute_path\n else\n logger.info \"Delete file at #{absolute_path}\"\n # TODO if the file has added state (not committed), reset it to HEAD\n if status_file.untracked\n FileUtils.rm absolute_path\n else\n remove\n end\n end\n true\n end\n end", "def remove_remote(name)\n self.lib.remote_remove(name)\n end", "def delete_gdom_disk(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n client_disk = gdom_dir+\"/vdisk0\"\n message = \"Information:\\tRemoving disk \"+client_disk\n command = \"rm #{client_disk}\"\n execute_command(options,message,command)\n return\nend", "def rmd(msg)\n msg = msg.join(\" \") if msg.is_a? Array\n\n if File.directory? msg\n Dir::delete msg\n elsif File.file? msg\n File::delete msg\n end\n log \"[DEBUG] #{thread[:user]} deleted #{Dir::pwd}/#{msg}\"\n \"200 OK, deleted #{msg}\"\n end", "def unlink_file\n unless is_placeholder_directory?\n FileUtils.rm path if File.file?(path)\n else\n FileUtils.rmdir path if Dir.entries(path) == [\".\", \"..\"]\n end\n end", "def destroy\n FileUtils.rm_rf(target)\n end", "def rsync!(host, remote_folder)\n \tputs \"rsync #{folder}/#{name}* #{host}:#{remote_folder}\"\n \t`rsync --delete #{folder}/#{name}* #{host}:#{remote_folder}`\n end", "def delete\n FileUtils.remove_entry_secure(@directory)\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::ENOENT\n end", "def rm(location)\n @client.file_delete(location)\n rescue\n puts $! if @@verbose\n nil\n end", "def destroy\n @folder_to_delete = @repository.get_secret_path\n if @repository.destroy\n FileUtils.rm_rf(@folder_to_delete, :secure =>true)\n puts @path\n respond_to do |format|\n format.html { redirect_to repositories_url, notice: 'Repository was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n format.html { redirect_to @repository, notice: 'Repository was not destroyed.' }\n end\n end", "def doDeleteOperations(destinationContent, dryRun)\n #N Without this loop, we won't delete all sub-directories or files and directories within sub-directories which have been marked for deletion\n for dir in destinationContent.dirs\n #N Without this check, we would delete directories which have not been marked for deletion (which would be incorrect)\n if dir.toBeDeleted\n #N Without this, we won't know the full path of the remote directory to be deleted\n dirPath = destinationLocation.getFullPath(dir.relativePath)\n #N Without this, the remote directory marked for deletion won't get deleted\n destinationLocation.contentHost.deleteDirectory(dirPath, dryRun)\n else\n #N Without this, files and sub-directories within this sub-directory which are marked for deletion (even though the sub-directory as a whole hasn't been marked for deletion) won't get deleted.\n doDeleteOperations(dir, dryRun)\n end\n end\n #N Without this loop, we won't delete files within this directory which have been marked for deletion.\n for file in destinationContent.files\n #N Without this check, we would delete this file even though it's not marked for deletion (and therefore should not be deleted)\n if file.toBeDeleted\n #N Without this, we won't know the full path of the file to be deleted\n filePath = destinationLocation.getFullPath(file.relativePath)\n #N Without this, the file won't actually get deleted\n destinationLocation.contentHost.deleteFile(filePath, dryRun)\n end\n end\n end", "def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end" ]
[ "0.7130752", "0.6805416", "0.66199857", "0.65953046", "0.65492356", "0.6544834", "0.65383387", "0.652285", "0.6471513", "0.64702445", "0.64633733", "0.64335304", "0.64040303", "0.6390499", "0.63491863", "0.6349054", "0.6345273", "0.6340789", "0.63024414", "0.62994343", "0.6279114", "0.62680805", "0.62339556", "0.62310874", "0.6221009", "0.6161951", "0.6135738", "0.61298764", "0.6128927", "0.6117944", "0.61027294", "0.60995084", "0.6085417", "0.6041337", "0.6039269", "0.6039269", "0.6038377", "0.601709", "0.6011094", "0.60017526", "0.599251", "0.59790534", "0.59789735", "0.59763366", "0.5968541", "0.59653986", "0.5951235", "0.59391403", "0.592576", "0.5922045", "0.5913562", "0.59131104", "0.5901003", "0.5899684", "0.5884358", "0.58725667", "0.5871839", "0.5870208", "0.5862812", "0.5828118", "0.5823214", "0.58206344", "0.58188564", "0.58107466", "0.58087295", "0.5807521", "0.5798054", "0.5794103", "0.5793662", "0.5789177", "0.5789177", "0.57860726", "0.5785833", "0.5778347", "0.57773185", "0.577447", "0.5773299", "0.57617867", "0.5750269", "0.5739631", "0.57316226", "0.5720645", "0.5720645", "0.57088107", "0.57056546", "0.56970966", "0.56957716", "0.5690187", "0.5687838", "0.5685615", "0.5669039", "0.5666296", "0.5663331", "0.5661653", "0.5661466", "0.5653858", "0.5651142", "0.56456524", "0.56341094", "0.5617006" ]
0.75328726
0
delete remote file (if dryRun is false) using "rm" N Without this method, there won't be any way to delete a file from the remote system
def deleteFile(filePath, dryRun) #N Without this, the required ssh command to delete a file won't be (optionally) executed. ssh("rm #{filePath}", dryRun) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def files_remote_remove(options = {})\n post('files.remote.remove', options)\n end", "def deleteFile(filePath, dryRun)\n #N Without this, the deletion command won't be run at all\n sshAndScp.deleteFile(filePath, dryRun)\n end", "def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def delete_remote\n policy = get_policy(\"remove\")\n signature = get_signature(policy)\n remote = url+\"?signature=\"+signature+\"&policy=\"+policy\n try = self.class.delete(remote)\n\n # If file not found in filepicker, destroy anyway, else only if success\n if try.not_found?\n true\n else\n try.success?\n end\n end", "def destroy(remote_path)\n get_adapter.delete_file(remote_path)\n end", "def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:node_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n project = get_default_project()\n\n NodeModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def delete(remote_filepath)\n @request = Net::HTTP::Delete.new(::File.join(@uri.path, remote_filepath))\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.body.presence || @response.code.to_i\n end", "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "def rm_r(path)\n cmd 'rm', '-r', path\nend", "def destroy_file\n start_ssh do |ssh|\n ssh.exec!(\"rm #{e full_filename}\")\n dir = File.dirname(full_filename)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n dir = File.dirname(dir)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n end\n end", "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:test_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n\n project = get_default_project()\n TestModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end", "def rm!( path )\r\n got = @ndev.rpc.file_delete( :path => path )\r\n return true if got.nil? # got no error\r\n # otherwise, there was an error, check output\r\n raise IOError, got.text\r\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def rm(path)\n cmd 'rm', path\nend", "def rm(path)\n run_via \"rm #{path}\"\n end", "def cmd_rm(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\"Usage: rm file\")\n\t\t\treturn true\n\t\tend\n\n\t\tclient.fs.file.rm(args[0])\n\n\t\treturn true\n\tend", "def update_remotely_deleted(file, node)\n #\n if node != ancestor.file_node(file) && !overwrite?\n if UI.ask(\"local changed #{file} which remote deleted\\n\" +\n \"use (c)hanged version or (d)elete?\") == \"d\"\n then remove file\n else add file\n end\n else\n remove file\n end\n end", "def smb_file_rm(file)\n fd = smb_open(file, 'ro')\n fd.delete\nend", "def remove!\n messages = []\n transferred_files do |local_file, remote_file|\n messages << \"#{storage_name} started removing '#{ local_file }'.\"\n end\n Logger.message messages.join(\"\\n\")\n\n FileUtils.rm_r(remote_path)\n end", "def smb_rm(filename, rdir=nil)\n if rdir.nil?\n dir=''\n else\n dir=' -D ' + rdir\n end\n file = Tempfile.new('ruby_smbclient')\n if @hashpass\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n else\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n end\n file.unlink\n if success\n return true\n else\n return false\n end\n end", "def rm(file)\n cmd_exec(\"rm -rf #{file}\")\n end", "def delete(rpm_remote_href, opts = {})\n data, _status_code, _headers = delete_with_http_info(rpm_remote_href, opts)\n data\n end", "def destroy\n file&.delete\n end", "def rm(location)\n @client.file_delete(location)\n rescue\n puts $! if @@verbose\n nil\n end", "def rm_r\n util.rm_r(path)\n end", "def destroy(context={})\n self.class.rpc_execute('unlink', self.id, context)\n end", "def rest__delete_remote\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n version = ret_request_params(:version)\n\n opts = {}\n opts.merge!(namespace: remote_namespace) unless remote_namespace.empty?\n\n remote_namespace, remote_module_name = Repo::Remote.split_qualified_name(ret_non_null_request_params(:remote_module_name), opts)\n remote_params = remote_params_dtkn(:component_module, remote_namespace, remote_module_name, version)\n\n project = get_default_project()\n response = ComponentModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n\n rest_ok_response response\n end", "def destroy(context={})\n rpc_execute('unlink', [self.id], context)\n end", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def ftp_remove path\n return ftp_action(true, path)\n end", "def delete\n conn.delete(escaped_path)\n true\n rescue StandardError => e\n puts \"carrierwave-upyun delete failed: #{e.inspect}\"\n nil\n end", "def test_delete_file\n remote_file_name = 'TestDeleteFile.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = DeleteFileRequest.new(path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.delete_file(request)\n end", "def clear_remote\n execute(:rm, '-rf', File.join(remote_cache_path, '*')) if test!(\"[ -d #{remote_cache_path} ]\")\n end", "def destroy_file\n File.delete full_file_path\n rescue\n end", "def rm path\n end", "def destroy\n @repo = Repository.find(params[:id])\n\n\t\t#REMOVE FILE FROM FILE SYSTEM AND DO A GIT commit\n\t\tif(FileUtils.rm(params[:path]))\n\t\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Removed file :: #{params[:path]}\")\n\t\tend\n end", "def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend", "def destroy_remote(options = {}, &block)\n raise MotionModelResource::URLNotDefinedError.new \"URL is not defined for #{self.class.name}!\" unless self.class.respond_to?(:url)\n \n model = self\n\n BW::HTTP.delete(save_url, {payload: options[:params]}) do |response|\n if response.ok? || options[:force] == true\n model.delete\n end\n\n block.call if block.present? && block.respond_to?(:call)\n end\n end", "def rm(*path)\n super; on_success{ nil }\n end", "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 remove_remote(name)\n self.lib.remote_remove(name)\n end", "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "def delete_file( path )\n # removes a file at path\n connection.delete( path )\n last_ftp_command_ok?\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def destroy\n @remote_image_content = RemoteImageContent.find(params[:id])\n @remote_image_content.destroy\n\n respond_to do |format|\n format.html { redirect_to(remote_image_contents_url) }\n format.xml { head :ok }\n end\n end", "def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end", "def del\n File.delete(@file)\n end", "def del_file( file_path )\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_rm_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} rm #{file_path}\"\n log.info(x) { \"[git] file remove command => #{git_rm_cmd}\" }\n %x[#{git_rm_cmd}];\n log.info(x) { \"[git] has removed #{file_path} from repo and working copy.\" }\n\n end", "def delete_remote?\n true\n end", "def delete_file\n\n #delete the file\n Chef::Log.debug \"DEBUG: Removing file #{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf!\"\n ::File.delete(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf\")\n\nend", "def delete(filename); end", "def delete(path, **options)\n execute :delete, path, options\n end", "def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end", "def delete_with_http_info(rpm_remote_href, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RemotesRpmApi.delete ...'\n end\n # verify the required parameter 'rpm_remote_href' is set\n if @api_client.config.client_side_validation && rpm_remote_href.nil?\n fail ArgumentError, \"Missing the required parameter 'rpm_remote_href' when calling RemotesRpmApi.delete\"\n end\n # resource path\n local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', rpm_remote_href.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 = nil\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'AsyncOperationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RemotesRpmApi#delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete\n rpc_execute('unlink', [id], context) if persisted?\n @destroyed = true\n freeze\n end", "def file_delete(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/delete\", params)\n parse_response(response)\n end", "def remove!(package)\n remote_path = remote_path_for(package)\n\n messages = []\n transferred_files_for(package) do |local_file, remote_file|\n messages << \"#{storage_name} started removing '#{ local_file }'.\"\n end\n Logger.info messages.join(\"\\n\")\n\n FileUtils.rm_r(remote_path)\n end", "def destroy\n @file_version.destroy\n head :no_content\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 delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end", "def destroy\n @q_resource = QResource.find(params[:id])\n @q_resource.bfile.remove!\n @q_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to q_resources_url }\n format.json { head :ok }\n end\n end", "def delete\n ::File.unlink(@path)\n end", "def destroy\n @resource_file = ResourceFile.find(params[:id])\n @resource_file.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_files_url }\n format.json { head :no_content }\n end\n end", "def delete_file(filename)\n http.delete([204,404], luwak, escape(filename))\n true\n end", "def destroy\n @file.destroy\n respond_to do |format|\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n end\n end", "def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end", "def delete!\n Recliner.delete(uri)\n end", "def remove!(package)\n remote_path = remote_path_for(package)\n\n transferred_files_for(package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started removing '#{ local_file }' \" +\n \"from container '#{ container }'.\"\n connection.delete_object(container, File.join(remote_path, remote_file))\n end\n end", "def test_remove_a_file\n a.rm(\"one\").commit(\"a removed one\")\n \n assert_equal nil, a['one']\n assert_equal \"one content\", b['one']\n \n b.pull\n \n assert_equal nil, a['one']\n assert_equal nil, b['one']\n \n assert_log_equal [\n \"a added one\",\n \"a removed one\"\n ], b\n end", "def destroy\n notice \"Removing #{@resource_copy[:path]}\"\n FileUtils.rm_rf(@resource_copy[:path])\n end", "def delete\n @file = nil\n # file.delete\n end", "def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end", "def delete\n unless FileDescriptor.exists?(filename: params[:fname])\n fpath = filePath params[:fname]\n begin\n File.delete fpath\n result = {status: 'ok'}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n else\n result = {status: 'error', message: 'File is open'}\n status = 403 # Forbidden\n end\n render json: result.to_json, status: status\n end", "def delete(session, id)\n write_task('rvpe.image.delete', session) do\n err_msg = \"You don't have permission to delete the image.\"\n sanity_check(session, id, err_msg) do\n call_one_xmlrpc('one.image.delete', session, id)\n end\n end\n end", "def rm_str(options, src)\n\t\targ = \"rm \" + options + \" \" + src\n\t\tputs arg\n\t\tsystem arg\n\tend", "def delete(resource)\n finder_or_run(:delete, resource)\n end", "def delete\n begin\n conn.delete(escaped_path)\n true\n rescue => e\n puts \"carrierwave-ucloud delete failed: #{e.inspect}\"\n nil\n end\n end", "def rm_file(file)\n @files.delete(file.path)\n end", "def delete_github_repo_file\n # commit\n commit_to_github(@repo, post_params)\n end", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def delete(path, options = {}, raw = false)\n request(:delete, path, options, raw)\n end", "def delete\n path = @p.path\n File::unlink path\n end", "def delete(path, options={}, raw=false)\n request(:delete, path, options, raw)\n end", "def unlink!( target = path )\n delete_file_and_folder! target if target\n end", "def delete(path, options = {})\n execute('DELETE', path, options)\n end", "def delete\n begin\n uy_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end", "def http_delete(_request, h_r, temp_location)\n return nil unless ::File.exist?(temp_location)\n\n ::File.unlink(temp_location)\n h_r.update_header('X-Sabre-Temp', 'true')\n h_r.status = 204\n false\n end", "def rm_r(options={})\n #list = list.to_a\n fileutils.rm_r(list, options)\n end", "def destroy_link_remote(path)\n\t\tlink_to get_icon('remove'), path, \"data-type\" => :json, :remote => true, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-danger', :title => t('site.destroy')\n\tend", "def delete_file(file)\n delete_attachment(file)\n end", "def rm\n FileUtils.rm path if File.exist?(path)\n end", "def rm_rf(path)\n cmd 'rm', '-rf', path\nend" ]
[ "0.75129706", "0.7461836", "0.7266126", "0.7093599", "0.7048033", "0.7048033", "0.69546664", "0.69349205", "0.6753107", "0.67431206", "0.66946757", "0.6642938", "0.6627236", "0.6626439", "0.6622883", "0.660031", "0.6517856", "0.64861757", "0.6485835", "0.6485835", "0.64798725", "0.64746916", "0.640664", "0.640359", "0.6362777", "0.6359343", "0.63293606", "0.6296312", "0.6244579", "0.6195892", "0.61639065", "0.61559606", "0.61541545", "0.614188", "0.61372596", "0.6133552", "0.6133552", "0.6083929", "0.60711944", "0.606971", "0.6064092", "0.60435045", "0.60401314", "0.6036817", "0.6033288", "0.6018871", "0.6000544", "0.5996888", "0.5992125", "0.5988817", "0.5985353", "0.5969792", "0.5958287", "0.59533656", "0.59527385", "0.59402484", "0.5936732", "0.5916257", "0.5909789", "0.5897876", "0.5894684", "0.58849883", "0.5867382", "0.5856425", "0.58360004", "0.5829338", "0.5803158", "0.58006215", "0.580019", "0.5792938", "0.57927775", "0.5788783", "0.5778982", "0.5763019", "0.57603264", "0.5760138", "0.57557625", "0.575017", "0.5743787", "0.57422763", "0.5741814", "0.5740531", "0.57402056", "0.5738624", "0.57385373", "0.5738494", "0.5733622", "0.57307816", "0.57292086", "0.5728573", "0.57282186", "0.57267135", "0.5722122", "0.57190603", "0.57143724", "0.5709667", "0.57062966", "0.56980586", "0.5696609", "0.5694592" ]
0.7606322
0
N Without this method, we can't get a cached SSH connection (opening a new one if necessary)
def connection #N Without this check, we would get a new connection even though we already have a new one if @connection == nil #N Without this, we don't get feedback about an SSH connection being opened puts "Opening SSH connection to #{user}@#{host} ..." #N Without this, we won't actually connect to the SSH host @connection = Net::SSH.start(host, user) end return @connection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ssh_connection\n conn = nil\n attempts = 0\n 5.times do |attempt|\n @lock.synchronize do\n if @connection_pool.count > 0\n conn = @connection_pool.shift\n end\n end\n unless conn\n params = {\n :paranoid => false,\n :user_known_hosts_file => '/dev/null',\n :timeout => 5,\n }\n params[:keys] = Jetpants.ssh_keys if Jetpants.ssh_keys\n begin\n @lock.synchronize do \n conn = Net::SSH.start(@ip, 'root', params)\n end\n rescue => ex\n output \"Unable to SSH on attempt #{attempt + 1}: #{ex.to_s}\"\n conn = nil\n next\n end\n end\n \n # Confirm that the connection works\n if conn\n begin\n result = conn.exec!('echo ping').strip\n raise \"Unexpected result\" unless result == 'ping'\n @available = true\n return conn\n rescue\n output \"Discarding nonfunctional SSH connection\"\n conn = nil\n end\n end\n end\n @available = false\n raise \"Unable to obtain working SSH connection to #{self} after 5 attempts\"\n end", "def ssh\n tries = 1\n @ssh ||= begin\n Net::SSH.start(self, self['user'], self['ssh'])\n rescue\n tries += 1\n if tries < 4\n puts \"Try #{tries} -- Host Unreachable\"\n puts 'Trying again in 20 seconds'\n sleep 20\n retry\n end\n end\n end", "def ssh_connection\n @ssh_connection ||= Net::SSH.start(@host, config[:user], config[:ssh_options] || {})\n end", "def get_new\n logger.debug \"Establishing connection for #{creep.user}@#{creep.host} passwd:#{creep.password}\"\n ssh = Net::SSH.start(creep.host, creep.user, {:password => creep.password, :verbose => (ENV['SSH_DEBUG'] && ENV['SSH_DEBUG'].to_sym) || :fatal })\n ssh.send_global_request(\"[email protected]\")\n ssh\n rescue Net::SSH::Exception => ex\n logger.error \"There was an exception in method get_new for SSConnection. Details #{ex}:\\n#{ex.backtrace}\"\n return nil\n rescue SystemCallError => ex\n logger.error \"There was an system error in method get_new for SSConnection. Details #{ex}:\\n#{ex.backtrace}\"\n return nil\n end", "def ssh_session\n retry_flag=true\n @log.debug \"ssh is #{@config['ssh'].inspect}\"\n ssh_config = @config['ssh'].clone\n host = ssh_config['host']\n ssh_config.delete('host')\n user = ssh_config['user']\n ssh_config.delete('user')\n # Convert strings to symbols..\n ssh_config = ssh_config.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n ssh_config[:port] = @vm_ssh_port\n begin\n Net::SSH.start(host,user,ssh_config) do |session|\n yield session\n end\n rescue EOFError => e\n raise(e) unless retry_flag\n retry_flag = false\n @log.info \"SSH session creation failed, retrying!\"\n retry\n end\n end", "def reuse_connection\n logger.debug(\"[SSH] reusing existing connection #{@connection}\")\n yield @connection if block_given?\n @connection\n end", "def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end", "def reuse_connection\n logger.debug(\"[SSH] reusing existing connection #{@connection}\")\n yield @connection if block_given?\n @connection\n end", "def getSSHConnectionHelper()\n return SSHConnection.new\n end", "def save_ssh_connection(conn)\n conn.exec! 'cd ~'\n @lock.synchronize do\n @connection_pool << conn\n end\n rescue\n output \"Discarding nonfunctional SSH connection\"\n end", "def connect\n if @connection && [email protected]?\n # There is a chance that the socket is closed despite us checking\n # 'closed?' above. To test this we need to send data through the\n # socket.\n begin\n @connection.exec!(\"\")\n rescue IOError\n @logger.info(\"Connection has been closed. Not re-using.\")\n @connection = nil\n end\n\n # If the @connection is still around, then it is valid,\n # and we use it.\n if @connection\n @logger.debug(\"Re-using SSH connection.\")\n return yield @connection if block_given?\n return\n end\n end\n\n # XXX: We need to raise some exception if SSH is not ready\n ssh_info = @machine.ssh_info\n\n # Build the options we'll use to initiate the connection via Net::SSH\n opts = {\n :port => ssh_info[:port],\n :keys => [ssh_info[:private_key_path]],\n :keys_only => true,\n :user_known_hosts_file => [],\n :paranoid => false,\n :config => false,\n :forward_agent => ssh_info[:forward_agent]\n }\n\n # Check that the private key permissions are valid\n Vagrant::Util::SSH.check_key_permissions(ssh_info[:private_key_path])\n\n # Connect to SSH, giving it a few tries\n connection = nil\n begin\n exceptions = [Errno::ECONNREFUSED, Net::SSH::Disconnect, Timeout::Error]\n connection = retryable(:tries => @machine.config.ssh.max_tries, :on => exceptions) do\n Timeout.timeout(@machine.config.ssh.timeout) do\n @logger.info(\"Attempting to connect to SSH: #{ssh_info[:host]}:#{ssh_info[:port]}\")\n Net::SSH.start(ssh_info[:host], ssh_info[:username], opts)\n end\n end\n rescue Timeout::Error\n # This happens if we continued to timeout when attempting to connect.\n raise Vagrant::Errors::SSHConnectionTimeout\n rescue Net::SSH::AuthenticationFailed\n # This happens if authentication failed. We wrap the error in our\n # own exception.\n raise Vagrant::Errors::SSHAuthenticationFailed\n rescue Net::SSH::Disconnect\n # This happens if the remote server unexpectedly closes the\n # connection. This is usually raised when SSH is running on the\n # other side but can't properly setup a connection. This is\n # usually a server-side issue.\n raise Vagrant::Errors::SSHDisconnected\n rescue Errno::ECONNREFUSED\n # This is raised if we failed to connect the max amount of times\n raise Vagrant::Errors::SSHConnectionRefused\n rescue NotImplementedError\n # This is raised if a private key type that Net-SSH doesn't support\n # is used. Show a nicer error.\n raise Vagrant::Errors::SSHKeyTypeNotSupported\n end\n\n @connection = connection\n\n # This is hacky but actually helps with some issues where\n # Net::SSH is simply not robust enough to handle... see\n # issue #391, #455, etc.\n sleep 4\n\n # Yield the connection that is ready to be used and\n # return the value of the block\n return yield connection if block_given?\n end", "def dup_ssh(&block)\n Snapsync.debug \"Opening new ssh session: \"+uri.to_s\n Net::SSH.start(uri.host, uri.user, password: uri.password, non_interactive: true, &block)\n end", "def get_ssh_session\n ssh = nil\n begin\n ssh = Net::SSH.start(@node, @user, :password => @password)\n ssh.loop(true)\n rescue Exception => e\n puts \"Unknown Net:SSH Exception : #{e.message}\"\n return nil\n end\n ssh\n end", "def ssh\n @ssh ||= @remote.connect\n @remote\n end", "def initialize_ssh; end", "def connect!\n @ssh = Net::SSH.start(@host, @user, :password => @pass)\n end", "def init_ssh_session\n @ssh_session.close if !(@ssh_session.nil? or !@ssh_session.closed?)\n ssh_opts = ssh_connection_options\n @log.info(\"Opening ssh connection to #{ssh_opts[:host]} as user #{ssh_opts[:user]}\")\n @ssh_session = ::Net::SSH.start(ssh_opts[:host], ssh_opts[:user])\n return @ssh_session\n end", "def open\n connect\n rescue Object => anything\n begin\n @ssh.shutdown!\n rescue ::Exception # rubocop:disable Lint/HandleExceptions, Lint/RescueException\n # swallow exceptions that occur while trying to shutdown\n end\n\n raise anything\n end", "def ssh\n @ssh ||= Net::SSH.start(self, self['user'] || \"root\" , self['ssh'])\n end", "def is_available_via_ssh?\n res = nil\n\n if @cache_timeout\n if @cache.has_key?(:is_available_via_ssh?)\n if (Time.now.to_i - @cache[:is_available_via_ssh?][:time]) < @cache_timeout\n @logger.debug(sprintf('using cached is_available_via_ssh?[%s] from [%s]', @cache[:is_available_via_ssh?][:status], @cache[:is_available_via_ssh?][:time]))\n return @cache[:is_available_via_ssh?][:status]\n end\n end\n end\n\n if @ssh.nil? or @ssh.closed?\n begin\n res = self.connect_ssh_tunnel()\n rescue Rouster::InternalError, Net::SSH::Disconnect, Errno::ECONNREFUSED, Errno::ECONNRESET => e\n res = false\n end\n\n end\n\n if res.nil? or res.is_a?(Net::SSH::Connection::Session)\n begin\n self.run('echo functional test of SSH tunnel')\n res = true\n rescue\n res = false\n end\n end\n\n if @cache_timeout\n @cache[:is_available_via_ssh?] = Hash.new unless @cache[:is_available_via_ssh?].class.eql?(Hash)\n @cache[:is_available_via_ssh?][:time] = Time.now.to_i\n @cache[:is_available_via_ssh?][:status] = res\n @logger.debug(sprintf('caching is_available_via_ssh?[%s] at [%s]', @cache[:is_available_via_ssh?][:status], @cache[:is_available_via_ssh?][:time]))\n end\n\n res\n end", "def connection\n Net::SSH.start(\n ip, username, :password => password, :port => port\n ) {|ssh| yield ssh }\n end", "def open(&block)\n\t\tif @ssh_session && !@ssh_session.closed? then\n\t\t\t@@logger.warn(\"trying to open an already opened ssh connection\")\n\t\t\traise \"trying to open an already opened ssh connection\"\n\t\tend\n\t\t\n\t\t@@logger.info(\"opening ssh connection with parameters: \" + @parameters.to_s)\n\t\n\t\tparameters = @parameters.clone()\n\t\thost = @parameters[:host]\n\t\tuser = @parameters[:user]\n\t\t\n\t\tparameters.delete(:host)\n\t\tparameters.delete(:user)\n\t\t\n\t\tif @parameters[:keys] then\n\t\t\t@@logger.info(\"Starting SSH session with public key authentication\")\n\t\telsif @parameters[:key_data] then\n\t\t\t@@logger.info(\"Starting SSH session with public key authentication\")\n\t\telsif @parameters[:password] then\n\t\t\t@@logger.info(\"Starting SSH session with password authentication\")\n\t\telse\n\t\t\t@@logger.error(\"No SSH authentication method found in parameters\")\n\t\t\traise \"No authentication method found\"\n\t\tend\n\n\t\tconnected = false\n\t\ttrials = 5\n\t\twhile !connected and trials > 0\n\t\t\tbegin\n\t\t\t\t@ssh_session = Net::SSH.start(host, user, parameters)\n\t\t\t\tconnected = true\n\t\t\trescue Exception => e\n\t\t\t\t@@logger.warn(\"connection attempt failed due to #{e.backtrace}\")\n\t\t\tend\n\t\t\ttrials -= 1\n\t\t\tif !connected\n\t\t\t\tsleep(20)\n\t\t\tend\n\t\tend\n\t\n\t\tif block then\n\t\t\tyield self\n\t\t\tclose\n\t\tend\n\tend", "def connection(options = {})\n @connection ||= Net::SSH::Connection::Session.new(transport(options), options)\n end", "def open_ssh([email protected])\n command = ssh_cli_string(id)\n exec(command)\n end", "def ssh?\n true\n end", "def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n Travis::Worker::Utils::HardTimeout.timeout(15) do\n @connector.connect\n end\n if @config.platform == :osx\n info \"unlocking keychain\" unless silent\n exec(\"security unlock-keychain -p #{config.keychain_password}\")\n end\n true\n rescue Timeout::Error\n warn \"Timed out attempting to open SSH connection\"\n raise\n end", "def config_ssh(username, host, options = nil)\n @ssh = SSH.new(username, host, options)\n end", "def connect(opts={})\n if Mario::Platform.windows?\n raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,\n :ssh_port => port(opts)\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n options = {}\n options[:port] = port(opts)\n [:host, :username, :private_key_path].each do |param|\n options[param] = opts[param] || env.config.ssh.send(param)\n end\n\n check_key_permissions(options[:private_key_path])\n\n # Command line options\n command_options = [\"-p #{options[:port]}\", \"-o UserKnownHostsFile=/dev/null\",\n \"-o StrictHostKeyChecking=no\", \"-o IdentitiesOnly=yes\",\n \"-i #{options[:private_key_path]}\"]\n command_options << \"-o ForwardAgent=yes\" if env.config.ssh.forward_agent\n\n if env.config.ssh.forward_x11\n # Both are required so that no warnings are shown regarding X11\n command_options << \"-o ForwardX11=yes\"\n command_options << \"-o ForwardX11Trusted=yes\"\n end\n\n # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails\n # (GH-51). As a workaround, we fork and wait. On all other platforms,\n # we simply exec.\n pid = nil\n pid = fork if Util::Platform.leopard? || Util::Platform.tiger?\n Kernel.exec \"ssh #{command_options.join(\" \")} #{options[:username]}@#{options[:host]}\".strip if pid.nil?\n Process.wait(pid) if pid\n end", "def establish_connection(opts)\n retry_connection(opts) do\n Net::SSH.start(hostname, username, options)\n end\n end", "def run_session\n first_try = true\n\n begin\n Net::SSH.start(@host, @user, @options) do |ssh|\n yield(ssh)\n end\n rescue Net::SSH::HostKeyMismatch => e\n if @remember_host == true && first_try\n # Save fingerprint and try again\n first_try = false\n e.remember_host!\n retry\n else\n # Re-raise error\n raise e\n end\n end\n end", "def create_new_connection(options, &block)\n cleanup!\n @connection_options = options\n @connection = Kitchen::Transport::Ssh::Connection.new(options, &block)\n end", "def test_should_report_not_connected_when_new\n c = LibSSH.connect 'hostname'\n assert (not c.connected?)\n end", "def run_session\n first_try = true\n\n begin\n Net::SSH.start(@host, @user, @options) do |ssh|\n yield(ssh)\n end\n rescue Net::SSH::HostKeyMismatch => err\n if remember_host? && first_try\n # Save fingerprint and try again\n first_try = false\n err.remember_host!\n retry\n else\n # Re-raise error\n raise err\n end\n end\n end", "def connect(&block)\n begin\n Puppet.debug \"Trying to connect to #{host} as #{user}\"\n @ssh = Net::SSH.start(host, user, :port => port, :password => password, :timeout => timeout,\n :paranoid => Net::SSH::Verifiers::Null.new,\n :global_known_hosts_file=>\"/dev/null\")\n rescue TimeoutError\n raise TimeoutError, \"SSH timed out while trying to connect to #{host}\"\n rescue Net::SSH::AuthenticationFailed\n raise Puppet::Error, \"SSH auth failed while trying to connect to #{host} as #{user}\"\n rescue Net::SSH::Exception => error\n raise Puppet::Error, \"SSH connection failure to #{host}\"\n end\n\n @buf = ''\n @eof = false\n @channel = nil\n @ssh.open_channel do |channel|\n channel.request_pty {|ch, success| raise \"Failed to open PTY\" unless success}\n\n channel.send_channel_request('shell') do |ch, success|\n raise 'Failed to open SSH SHELL Channel' unless success\n\n ch.on_data {|ch, data| @buf << data}\n ch.on_extended_data {|ch, type, data| @buf << data if type == 1}\n ch.on_close {@eof = true}\n\n @channel = ch\n expect(default_prompt, &block)\n return\n end\n end\n @ssh.loop\n end", "def do_ssh\n validate_parameters\n\n auth_types = []\n auth_types << 'PASSWORD' if @password && [email protected]?\n auth_types << \"KEY (#{@key_type})\"\n\n connection = @host\n connection += \" port #{@port}\" if @port != 0\n\n write_output(\"\\nConnecting to #{connection} as #{@user} using auth [#{auth_types.join(', ')}]\")\n\n options = {\n :host_key => @key_type,\n :password => @password,\n :port => @port == 0 ? DEFAULT_PORT : @port,\n :timeout => @timeout,\n }\n options[:keys] = [@key_path] unless @key_path.empty?\n\n session = start(@host, @user, options, @retries, @wait)\n yield(session)\n rescue PluginError\n # Re-raise\n raise\n rescue Exception => e\n raise PluginError, \"Error in SSH connection: #{e.class} #{e}\\n\" + e.backtrace.join(\"\\n\")\n ensure\n close\n end", "def connect(&block)\n options = { port: @port }\n\n if @password then\n options[:password] = @password\n else\n options[:keys] = @key\n end\n\n if block\n Net::SSH.start @host, @user, options do |ssh|\n @ssh = ssh\n yield ssh\n @ssh = nil\n end\n else\n @ssh = Net::SSH.start @host, @user, options\n end\n end", "def ensure_connected! \n if @ssh_options[:timeout]\n total_timeout = @ssh_options[:timeout] * 2\n else\n total_timeout = 30\n end\n # puts \"Total timeout: #{total_timeout}\"\n @connections=[]\n hosts_to_connect = @hosts.inject(0) {|sum,h| sum += (h.connect_failed ? 0:1)}\n # puts \"#{hosts_to_connect} to connect\"\n @hosts.each do |host|\n if @connection_cache[host.name] || host.connected\n @connection_mutex.synchronize { @connections << {:connection=>@connection_cache[host.name], :host=>host} }\n host.connected=true\n elsif !host.connect_failed\n Thread.new {\n begin\n #puts \"Connecting #{host.name}\" \n c = Net::SSH.start(host.name, @user_name, @ssh_options)\n @connection_cache[host.name] = c\n @connection_mutex.synchronize { @connections << {:connection=>c, :host=>host} }\n host.connected=true\n #puts \"Connected #{host.name}\" \n rescue Exception => e\n host.connect_failed = true\n host.connected=false\n error \"Unable to connect to #{host.name}\\n#{e.message}\"\n @connection_mutex.synchronize {@connections << {:connection=>nil, :host=>host} }\n host.exception=e\n end \n }\n end\n end\n s = Time.now\n loop do\n l=0\n @connection_mutex.synchronize { l = @connections.length }\n break if l == hosts_to_connect\n sleep(0.1)\n if Time.now - s > total_timeout\n puts \"Warning -- total connection time expired\"\n puts \"Failed to connect:\"\n hosts.each do |h|\n unless h.connected\n puts \" #{h.name}\" \n h.connect_failed=true\n # TODO: Need to handle this situations much better. Attempt to kill thread and/or mark connection in cache as unreachable\n end\n end\n break\n end\n end \n end", "def start_session\n ssh_opts = filter_ssh_options(options)\n @ssh = Net::SSH.start(options[:hostname], options[:username], ssh_opts)\n rescue Net::SSH::Disconnect\n retry_count = retry_count.to_i + 1\n sleep 30 and retry if retry_count < 5\n raise(SSHCannotConnect, Errstr::CANNOT_CONNECT % options[:hostname])\n end", "def ssh_channel_mock\n channel = described_class::FakeChannel.new\n ssh = double('ssh')\n ssh.stub(:open_channel).and_yield(channel).and_return(channel)\n Net::SSH.stub(:start).and_yield(ssh)\n channel\n end", "def exec_new(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t channel = @ssh_session.open_channel do |ch|\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.info(\"SshConnection: starts executing '#{command}'\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-status: #{exit_status}\")\n\t if exit_status != 0\n\t @@logger.error(\"SshConnection.on_request: Remote command execution failed with code: #{exit_status}\")\n\t end\n end\n\t ch.on_request \"exit-signal\" do |ch, data|\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-signal: #{data.read_string}\")\n\t end\n ch.on_close do |ch|\n\t @@logger.info(\"SshConnection.on_close: remote end is closing!\")\n #@close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n\t @@logger.info(\"SshConnection.on_eof: remote end is done sending data\")\n #@close_handler.call() unless @close_handler.nil?\n end\n\t ch.on_open_failed do |ch, code, desc|\n\t @@logger.info(\"SshConnection.on_open_failed: code=#{code} desc=#{desc}\")\n\t end\n\t ch.on_process do |ch|\n\t #@@logger.debug(\"SshConnection.on_process; send line-feed/sleep\")\n\t ch.send_data(\"\\n\")\n\t end\n\n #ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"SshConnection: the remote command could not be invoked!\")\n exit_status = 127\n end\n end\n\t #ch.wait\n\t end\n\t channel.wait\n\t return exit_status\n\tend", "def conn(pty_needed=false)\n Scutil.find_connection(@hostname, @username, pty_needed=false, @options)\n end", "def execute(opts={})\n # Check the key permissions to avoid SSH hangs\n check_key_permissions(env.config.ssh.private_key_path)\n\n # Merge in any additional options\n opts = opts.dup\n opts[:forward_agent] = true if env.config.ssh.forward_agent\n opts[:port] ||= port\n\n retryable(:tries => 5, :on => Errno::ECONNREFUSED) do\n Net::SSH.start(env.config.ssh.host,\n env.config.ssh.username,\n opts.merge( :keys => [env.config.ssh.private_key_path],\n :keys_only => true,\n :user_known_hosts_file => [],\n :paranoid => false,\n :config => false)) do |ssh|\n yield SSH::Session.new(ssh, env)\n end\n end\n rescue Errno::ECONNREFUSED\n raise Errors::SSHConnectionRefused\n end", "def create_ssh_session\n return Net::SSH.start(JUMPSRV_NMC, JUMPSRV_NMC_USER, password: JUMPSRV_NMC_PW, timeout: 40) # verbose: :info,\n end", "def return_client()\n Net::SSH.start('qa-host','root',:password=>'fortigate')\nend", "def spawn_connection\n connect\n end", "def connect(&block)\n @output = []\n @channel_data = ''\n\n begin\n Puppet.debug(\"connecting to #{host} as #{user}\")\n @ssh = Net::SSH.start(host, user, port: port, password: password, timeout: timeout, verify_host_key: false)\n rescue TimeoutError\n raise TimeoutError, _('timed out while opening an ssh connection to the host'), $ERROR_INFO.backtrace\n rescue Net::SSH::AuthenticationFailed\n raise Puppet::Error, _('SSH authentication failure connecting to %{host} as %{user}') % { host: host, user: user }, $ERROR_INFO.backtrace\n rescue Net::SSH::Exception\n raise Puppet::Error, _('SSH connection failure to %{host}') % { host: host }, $ERROR_INFO.backtrace\n end\n\n @buf = ''\n @eof = false\n @channel = nil\n @ssh.open_channel do |channel|\n channel.request_pty { |_ch, success| raise _('failed to open pty') unless success }\n\n channel.send_channel_request('shell') do |ch, success|\n raise _('failed to open ssh shell channel') unless success\n\n ch.on_data { |_, data| @buf << data }\n ch.on_extended_data { |_, type, data| @buf << data if type == 1 }\n ch.on_close { @eof = true }\n\n @channel = ch\n expect(default_prompt, &block)\n # this is a little bit unorthodox, we're trying to escape\n # the ssh loop there while still having the ssh connection up\n # otherwise we wouldn't be able to return ssh stdout/stderr\n # for a given call of command.\n # rubocop:disable Lint/NonLocalExitFromIterator\n return\n # rubocop:enable Lint/NonLocalExitFromIterator\n end\n end\n @ssh.loop\n end", "def session\n @session ||= Ssh::Session.new(name,\n :host => '127.0.0.1',\n :port => ssh_port,\n :username => ENV.fetch(\"TRAVIS_CI_ENV_USERNAME\", 'travis'),\n :private_key_path => File.expand_path('keys/vagrant'),\n :buffer => Travis::Worker.config.shell.buffer,\n :timeouts => Travis::Worker.config.timeouts\n )\n end", "def sshAndScp\n return contentHost.sshAndScp\n end", "def new_connection; end", "def activate_ssh_loop symbol\n @connections[symbol][:thread] = Thread.new(@connections[symbol]) {|c| c.loop {true}}\n end", "def cache_connect(spec)\n spec_key = spec.spec_key\n konn = nil\n unless spec_key.nil?\n\n # wrap the calls below in a mutex to prevent, multiple threads from\n # updating the conn cache at the same time, causing unpredictable\n # behaviour!\n @conn_cache_mutex.synchronize do\n konn = if @conn_cache.key?(spec_key)\n logger.debug \"#{Thread.current} Cached connection: #{spec_key}\\n\"\n @conn_cache[spec_key]\n else\n logger.debug \"#{Thread.current} New connection: #{spec_key}\\n\"\n @conn_cache[spec_key] = real_connect(spec)\n end\n verify_conn!(konn) unless konn.nil?\n wake_up!(konn)\n\n konn\n end\n end\n konn\n end", "def remote_connections; end", "def retry_connection(opts)\n log_msg = \"[SSH] opening connection to #{self}\"\n log_msg += \" via #{ssh_gateway_username}@#{ssh_gateway}:#{ssh_gateway_port}\" if ssh_gateway\n logger.debug(log_msg)\n yield\n rescue *RESCUE_EXCEPTIONS_ON_ESTABLISH => e\n if (opts[:retries] -= 1) > 0\n message = if opts[:message]\n logger.debug(\"[SSH] connection failed (#{e.inspect})\")\n opts[:message]\n else\n \"[SSH] connection failed, retrying in #{opts[:delay]} seconds \" \\\n \"(#{e.inspect})\"\n end\n logger.info(message)\n sleep(opts[:delay])\n retry\n else\n logger.warn(\"[SSH] connection failed, terminating (#{e.inspect})\")\n raise SshFailed, \"SSH session could not be established\"\n end\n end", "def connect!(force_reconnect = false)\n if self.connected?\n @logger.debug(\"SSH connection to server name='#{@name}', host=#{self.hostname} already established\")\n if not force_reconnect\n return\n else\n @logger.debug(\"Forcing SSH reconnect for server name='#{@name}', host=#{self.hostname}\")\n end\n end\n\n @logger.info(\"Establishing SSH connection to server name='#{@name}', host='#{self.hostname}', user '#{self.username}'\")\n begin\n @ssh = Net::SSH.start(self.hostname, self.username, port: @config['ssh_port'] || 22, timeout: 2, non_interactive: true)\n rescue Net::SSH::AuthenticationFailed => msg\n raise Acme::Distributed::ServerError, \"Could not establish SSH connection to server name='#{@name}': #{msg}\"\n rescue StandardError => msg\n raise Acme::Distributed::ServerError, \"Could not establish SSH connection to server name='#{@name}': #{msg}\"\n end\n end", "def close\n ssh.close if @_ssh\n end", "def connected?\n if @ssh\n return true\n else\n return false\n end\n end", "def disconnect\n @ssh.close if @ssh\n @ssh = nil\n end", "def start_ssh(&session)\n config = self.class.ssh_config\n Net::SSH.start( config[:host],\n config[:user],\n config.fetch(:options, { }),\n &session )\n end", "def session(retry_options = {})\n if ssh_gateway\n @session ||= establish_connection_via_gateway({\n retries: connection_retries.to_i,\n delay: connection_retry_sleep.to_i,\n }.merge(retry_options))\n else\n @session ||= establish_connection({\n retries: connection_retries.to_i,\n delay: connection_retry_sleep.to_i,\n }.merge(retry_options))\n end\n end", "def connected?\n start_ssh {|ssh| } # do nothing\n rescue *CONNECTION_EXCEPTIONS => ex\n @connection_error = ex\n return false\n else\n return true\n end", "def ssh_with_proxy(urlstr, params)\n url = URI(urlstr)\n sock = TCPSocket.open(url.hostname, url.port)\n\n data = JSON.dump(params) + \"\\r\\n\"\n inp_buf = \"POST /ssh/session HTTP/1.1\\r\\nConnection: upgrade\\r\\nUpgrade: raw\\r\\nContent-Length: #{data.length}\\r\\n\\r\\n#{data}\"\n out_buf = \"\"\n\n ws_eof = false\n bridge_eof = false\n expecting_http_header = true\n\n status = \"\"\n\n while true\n readers = [ ]\n writers = [ ]\n\n readers.append($stdin) unless ws_eof\n readers.append(sock) unless bridge_eof\n writers.append(sock) unless inp_buf == \"\"\n\n if out_buf.length > 0\n if expecting_http_header\n header_end = out_buf.index(\"\\r\\n\\r\\n\")\n if header_end\n status_line, headers_text = out_buf[0, header_end].split(\"\\r\\n\", 2)\n status = status_line.split(\" \")[1]\n out_buf = out_buf[header_end+4..-1]\n expecting_http_header = false\n if status != \"101\"\n m = /^Content-Length:[ \\t]*([0-9]+)\\r?$/i.match(headers_text)\n if m\n expected_len = m[1].to_i\n else\n expected_len = -1\n end\n while expected_len < 0 || out_buf.length < expected_len\n begin\n out_buf += sock.readpartial(4096)\n rescue EOFError\n break\n end\n end\n if status[0] == \"4\"\n exit_with_problem(\"access-denied\", out_buf, nil)\n else\n $stderr.write(\"Error talking to smart proxy: #{out_buf}\\n\")\n exit 1\n end\n end\n end\n end\n writers.append($stdout) unless out_buf == \"\"\n end\n\n break if readers.length + writers.length == 0\n\n r, w, x = IO.select(readers, writers)\n\n if r.include?(sock)\n begin\n out_buf += sock.readpartial(4096)\n rescue EOFError\n bridge_eof = true\n break if out_buf == \"\"\n end\n end\n\n if w.include?(sock)\n n = sock.write(inp_buf)\n sock.flush()\n inp_buf = inp_buf[n..-1]\n if inp_buf == \"\" and ws_eof\n sock.close_write()\n end\n end\n\n if r.include?($stdin)\n begin\n inp_buf += $stdin.readpartial(4096)\n rescue EOFError\n ws_eof = true\n sock.close_write() if inp_buf == \"\"\n end\n end\n\n if w.include?($stdout)\n n = $stdout.write(out_buf)\n $stdout.flush()\n out_buf = out_buf[n..-1]\n break if out_buf == \"\" and bridge_eof\n end\n\n end\nend", "def retrieve\n raise RetrieverError.new(\"git retriever is unavailable\") unless available?\n RightScraper::Processes::SSHAgent.with do |agent|\n agent.add_key(@repository.first_credential) unless\n @repository.first_credential.nil?\n super\n end\n end", "def connect\n begin\n Net::SSH.start(@host,@login,password:@password) do |sf|\n @ssh = sf\n Logger.<<(__FILE__,\"INFO\",\"Connected at #{@login}@#{@host}\")\n yield\n end\n rescue => e\n Logger.<<(__FILE__,\"ERROR\",e.message)\n raise e\n end\t\n Logger.<<(__FILE__,\"INFO\",\"Disconnected from #{@login}@#{@host}\")\n @sftp = nil\t\n end", "def kind\n :ssh\n end", "def start\n conf = RecursiveOpenStruct.new(Net::SSH::Config.load(SSH_CONFIG, @server.host))\n chost = @server.host.colorize((@server.color || 'default').to_sym)\n\n Net::SSH.start(conf.host, conf.user, keys: conf.identityfile) do |ssh|\n ssh.open_channel do |channel|\n channel.on_data do |ch, data|\n data.lines.each do |line|\n @queue.push(\"[#{chost}] #{line}\")\n end\n end\n\n channel.exec(\"tail -f #{@path}\")\n end\n end\n end", "def run_instance(o={})\n raise StandardError.new(\"You have no available hosts\") if available_hosts.empty?\n host = available_hosts.first\n new_host = SshInstance.new(instance_options(o.merge(:name=>host)))\n new_host.keypair\n if new_host && new_host.refresh!\n available_hosts.delete host\n new_host\n else\n raise StandardError.new(\"Unable to connect to host #{host}\")\n end\n end", "def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend", "def connect\n nodes.each do |k,v|\n rs_storage = RSpec.configuration.rs_storage[:nodes][k]\n raise RuntimeError, \"No internal storage for node #{k}\" if rs_storage.nil?\n\n ipaddress = rs_storage[:ipaddress]\n raise RuntimeError, \"No ipaddress provided from launch phase for node #{k}\" if ipaddress.nil?\n\n chan = ssh_connect(:host => k, :user => 'root', :net_ssh_options => {\n :keys => vmconf[:ssh_keys].split(\":\"),\n :host_name => ipaddress,\n })\n RSpec.configuration.rs_storage[:nodes][k][:ssh] = chan\n end\n\n nil\n end", "def powercli_connect_exec(cmd)\n # used cached powershell runtime AND used cached PowerCLI connection\n # caching the powershell runtime is a huge savings, caching the PowerCLI connection\n # is another huge savings, worth about 5-10s total per call\n PuppetX::PowerCLI::Helper.instance.powercli_connect_exec(resource[:vcenter_connection],\n cmd)\n end", "def getSshCheckThread(key, host)\n return Thread.new(key, host) { |hostKey, actual_host|\n \n shutDown = false\n \r\n # sleep for the time specified for SSH_TIMEOUT\n sleep($SSH_TIMEOUT)\n \n while($exit_flag == false)\n \n sshConnectionAttempt = 0\n checkSuccessfull = false\n \n # Try to establish a ssh connection\n # On success reset error counter\n begin\n ssh = Net::SSH.start(host[:IP], $SSH_USER, {:auth_methods => \"publickey\"})\n ssh.close\n \n $Log.info \"SSH: Host #{host[:Name]} alive...\"\n \n # if host has been successfully checked earlier\n # we don't need to set the \"wakeSSH\" flag\n # that prevents us from unnecessary locking of the host list\n if(checkSuccessfull != true)\n checkSuccessfull = true\n $hostListMutex.synchronize{\n $state.change(hostKey,$state.wakeSSH)\n }\n end\n \n sshConnectionAttempt = 0\n \n \n # If connection is refused error counter is incremented\n rescue(Errno::ECONNREFUSED)\n $Log.warn \"SSH: Host #{host[:Name]} refused ssh connection...\"\n $Log.warn \"SSH: Attempt #{host[:wakeAttempt]}\"\n \n sshConnectionAttempt += 1\n \n checkSuccessfull = false\n \n $hostListMutex.synchronize{\n $state.change(hostKey,$state.isWake)\n }\n \n # On authetication error something seriously is wrong\n # so the error counter is set to maximum\n rescue(Net::SSH::AuthenticationFailed)\n $Log.error \"SSH: Authentication failed on host #{host[:Name]}\"\n \n sshConnectionAttempt = $NUM_WAKE_ATTEMPTS\n \n checkSuccessfull = false\n \n $hostListMutex.synchronize{\n $state.change(hostKey,$state.isWake)\n }\n \n # On socket error something seriously is wrong\n # so the error counter is set to maximum\n rescue\n $Log.error \"SSH: Socket error on host #{host[:Name]}\"\n \n sshConnectionAttempt = $NUM_WAKE_ATTEMPTS\n \n checkSuccessfull = false\n \n $hostListMutex.synchronize{\n $state.change(hostKey,$state.isWake)\n }\n end\n \n # If error counter is at maximum the time when that happens is recorded\n # and the thread is terminated\n if(sshConnectionAttempt >= $NUM_WAKE_ATTEMPTS )\n \n $hostListMutex.synchronize{\r\n \r\n # if the host is intended to run always\r\n # the something seriously is wrong and therefore\r\n # error status is set\n if($hostList[hostKey][:PXE][:wake] == true)\n $Log.error \"SSH: Fatal Error (#{actual_host[:Name]})\"\n $state.change(hostKey,$state.sshError)\r\n \r\n # else a ping thread is created because it is assumed\r\n # that someone shut down the host\n else\n $state.change(hostKey,$state.ReadyForWakeUp)\n $hostList[hostKey][:pingThread] = getPingThread(key, host)\n $hostList[hostKey][:sshThread] = nil\n end\n }\n break\n end\n \r\n # sleep for the time specified for SSH_CHECK_INTERVAL\n sleep($SSH_CHECK_INTERVAL)\n \n end\n $Log.info \"SSH: ssh thread for \\\"#{host[:Name]}\\\" terminated\"\n }\nend", "def scp_connect\n # Connect to SCP and yield the SCP object\n connect do |connection|\n scp = Net::SCP.new(connection)\n return yield scp\n end\n rescue Net::SCP::Error => e\n # If we get the exit code of 127, then this means SCP is unavailable.\n raise Vagrant::Errors::SCPUnavailable if e.message =~ /\\(127\\)/\n\n # Otherwise, just raise the error up\n raise\n end", "def establish_connection_via_gateway(opts)\n retry_connection(opts) do\n gateway_options = options.merge(port: ssh_gateway_port)\n Net::SSH::Gateway.new(ssh_gateway,\n ssh_gateway_username, gateway_options).ssh(hostname, username, options)\n end\n end", "def http_connection\n (@shared_tcp_connection ||\n (@in_session && establish_shared_connection) ||\n create_http_connection)\n end", "def close_ssh\n puts \"Close connection\"\n @ssh.close unless @ssh.closed?\n end", "def ssh(path_of_servers, command)\n _path_of_servers = path_of_servers.dup\n remove_first_localhost!(_path_of_servers)\n Open3.capture3(ssh_str(_path_of_servers, command))\n end", "def start id, ip = \"localhost\", user = \"sjfaber\", keys = \"/Users/sjfaber/.ssh/id_rsa\"\n # We may need to do special start for the master\n channel = nil\n channel_thread = Thread.new {\n puts \" Inside thread\"\n Net::SSH.start(ip, user, :keys => keys) do |ssh|\n puts \"Starting #{id}\"\n Thread.current[:ssh] = ssh\n channel = ssh.open_channel do |ch|\n puts \"About to exec #{id}\"\n\n ch.exec \"echo HI there from #{id}; bash\" do |ch, success|\n puts \"Execing #{id}\"\n raise \"could not execute command\" unless success\n ch.on_data do |c, data|\n $stdout.print data\n end\n\n ch.on_extended_data do |c, data|\n $stdout.print data\n end\n\n ch.on_close { puts \"disconnecting #{id}\" }\n\n\n ch.send_data(\"echo hi2\\n\")\n end\n\n ch.send_data(\"echo hi3\\n\")\n\n end\n\n Thread.current[:channel]=channel\n Thread.current[:channel].send_data(\"echo hi4\\n\")\n\n # This is finally working hooray!! but we should really consider using simple ssh\n # this will handle timeouts, and keep_alive\n Thread.current[:continue] = true\n ssh.loop(1) do\n Thread.current[:continue] && channel.active?\n end\n end\n }\n\n channel_thread\nend", "def connect\n @connection_pool.get_connection\n end", "def ssh\n platform_service(:ssh)\n end", "def ssh_type; end", "def ssh_type; end", "def ssh_type; end", "def ssh_type; end", "def close\n @net_ssh.close\n @net_ssh = nil\n end", "def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n options = { :port => config.port, :keys => [config.private_key_path] }\n @shell = Net::SSH.start(config.host, config.username, options).shell\n end", "def connect(&block)\n return_result = nil\n # the sftp.start method does not seem to return the last thing you execute\n start_sftp_session do |sftp_session|\n return_result = yield SessionWrapper.new(self, sftp_session)\n end\n return_result\n end", "def ssh_ip\n 5.times do\n ip = read_guest_ip_dhcp\n return ip unless ip.empty?\n\n ip = read_guest_ip_prlctl\n return ip unless ip.empty?\n\n sleep 2\n end\n\n # We didn't manage to determine IP - return nil and\n # expect SSH client to do a retry\n return nil\n end", "def within_ssh_session(machine)\n options = Net::SSH.configuration_for(machine['network'], true)\n options[:auth_methods] = %w[publickey none]\n options[:verify_host_key] = :never\n options[:keys] = [machine['keyfile']]\n options[:non_interactive] = true\n options[:timeout] = 5\n Net::SSH.start(machine['network'], machine['whoami'], options) do |ssh|\n yield ssh\n end\n end", "def ssh?\n @session.transport.class.to_s.include?('SSH')\n end", "def connection_for nick\n @connection_cache[nick]\n end", "def connect_sftp(hostname, username, password, port=22)\n log_error(\"Connecting to remote server #{hostname} by sFTP protocol\")\n sftp = Net::SFTP.start(hostname, username, :password => password, :port => port, :timeout => 20) #, :number_of_password_prompts => \"#{prompts}\") #:verbose=>:debug,\n counter = 0\n state = sftp.state\n unless state =~ /open$/ \n log_error(\"Establishing connection...\") \n counter +=1\n sleep 4\n at_exit do \n log_error(\"Unable to connect to the sFTP server: #{hostname}\")\n\tend\n exit 3 if counter > 5\n else\n log_error(\"Connected to the sFTP server #{hostname}\")\n return sftp\n end\n rescue Net::SSH::ConnectionTimeout => timeout_error\n log_error(\"Timed out: #{timeout_error}\")\n rescue Net::SSH::AuthenticationFailed => login_error\n log_error(\"Authentication failure\")\n rescue Errno::EHOSTUNREACH => login_error\n log_error(\"Host unreachable\")\n rescue Errno::ECONNREFUSED => login_error\n log_error(\"Connection refused\")\n ensure\n=begin\n if sftp.open? == true\n log_error(\"Connected to the sFTP server #{hostname}\")\n else\n log_error(\"Unable to connect to the sFTP server: #{hostname}\")\n end\n=end\n# return sftp\nend", "def remember_new_host_key!\n run \"true\"\n rescue Net::SSH::HostKeyMismatch => e\n puts \"remembering new key: #{e.fingerprint}\"\n e.remember_host!\n end", "def connect\r\n if @opts[:threadsafe]\r\n @conns = Knj::Threadhandler.new\r\n \r\n @conns.on_spawn_new do\r\n self.spawn\r\n end\r\n \r\n @conns.on_inactive do |data|\r\n data[:obj].close\r\n end\r\n \r\n @conns.on_activate do |data|\r\n data[:obj].reconnect\r\n end\r\n else\r\n @conn = self.spawn\r\n end\r\n end", "def socket(options = {})\n @socket ||= Net::SSH::Test::Socket.new\n end", "def connection(options={})\n raise NoToken if @token.to_s.empty?\n\n @connections ||= {}\n\n cached_connection? && !protocol_changed? ? cached_connection : new_connection\n end", "def connect\n return true if connected?\n\n cmd = ssh_cmd quote_cmd(LOGIN_LOOP), :sudo => false\n\n @parent_pid, inn, out, err = popen4 cmd.join(\" \")\n inn.sync = true\n\n data = \"\"\n ready = nil\n start_time = Time.now.to_i\n\n until ready || out.eof?\n data << out.readpartial(1024)\n ready = data =~ /ready/\n\n raise TimeoutError if timed_out?(start_time, LOGIN_TIMEOUT)\n end\n\n unless connected?\n disconnect\n host_info = [@user, @host].compact.join(\"@\")\n raise ConnectionError, \"Can't connect to #{host_info}\"\n end\n\n inn.close rescue nil\n out.close rescue nil\n err.close rescue nil\n\n @parent_pid\n end", "def open\n ENV['SSH_ASKPASS'] = File.expand_path(File.join(File.dirname(__FILE__),\n '..', '..', '..',\n 'scripts',\n 'stub_ssh_askpass'))\n ENV['HOME'] = \"/dev/null\"\n @dir = Dir.mktmpdir\n @socketfile = File.join(@dir, \"agent\")\n @monitor = ProcessWatcher::ProcessMonitor.new\n @pid = @monitor.spawn('ssh-agent', '-a', @socketfile, '-d') {}\n timeout = 0\n until File.exists?(@socketfile)\n timeout += 1\n sleep 0.1\n if timeout > 100\n raise \"Couldn't find SSH agent control socket in time. Timing out\"\n end\n end\n ENV['SSH_AGENT_PID'] = @pid.to_s\n ENV['SSH_AUTH_SOCK'] = @socketfile\n end", "def exec(opts={})\n # Get the SSH information and cache it here\n ssh_info = info\n\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],\n :port => ssh_info[:port],\n :username => ssh_info[:username],\n :key_path => ssh_info[:private_key_path]\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n # If plain mode is enabled then we don't do any authentication (we don't\n # set a user or an identity file)\n plain_mode = opts[:plain_mode]\n\n options = {}\n options[:host] = ssh_info[:host]\n options[:port] = ssh_info[:port]\n options[:username] = ssh_info[:username]\n options[:private_key_path] = ssh_info[:private_key_path]\n\n # Command line options\n command_options = [\"-p\", options[:port].to_s, \"-o\", \"UserKnownHostsFile=/dev/null\",\n \"-o\", \"StrictHostKeyChecking=no\", \"-o\", \"LogLevel=FATAL\", \"-p\", options[:password].to_s]\n\n # Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option\n # (Also don't use it in plain mode, it'll skip user agents.)\n command_options += [\"-o\", \"IdentitiesOnly=yes\"] if !(Util::Platform.solaris? || plain_mode)\n\n command_options += [\"-i\", options[:private_key_path]] if !plain_mode\n command_options += [\"-o\", \"ForwardAgent=yes\"] if ssh_info[:forward_agent]\n\n # If there are extra options, then we append those\n command_options.concat(opts[:extra_args]) if opts[:extra_args]\n\n if ssh_info[:forward_x11]\n # Both are required so that no warnings are shown regarding X11\n command_options += [\"-o\", \"ForwardX11=yes\"]\n command_options += [\"-o\", \"ForwardX11Trusted=yes\"]\n end\n\n host_string = options[:host]\n host_string = \"#{options[:username]}@#{host_string}\" if !plain_mode\n command_options << host_string\n @logger.info(\"Invoking SSH: #{command_options.inspect}\")\n safe_exec(\"ssh\", *command_options)\n end", "def work\n \n # First we need to open the session.\n # I create a helper because we will have to\n # (dis)connect several times during this task.\n connect\n\n # Set terminal length to 0 otherwise too long outputs will cause\n # Net::Telnet to timeout while waiting for the prompt.\n @session.privileged { set 'terminal length', 0 }\n\n # Check ip http secure-server\n https = /^ip http secure-server/.match(@session.get('run | i ip http'))\n \n # Get hostname from show version.\n match = /(?<hostname>.+)\\s+uptime.+/.match(@session.get('version'))\n\n # Check if we found the hostname\n # and convert it if needed.\n # `match['hostname'].downcase!` return nil\n # if the hostname is already in lowercase.\n if !https && match && match['hostname'].downcase!\n \n # If we are connected using SSH we enable Telnet\n # in case bad crypto key prevent us from logging.\n enable_telnet if ssh?\n \n # Convert the hostname\n info \"Converting #{ match['hostname'] } => #{ match['hostname'].downcase }\"\n @session.configuration(:enforce_save) { set 'hostname', match['hostname'].downcase }\n \n # If SSH is enabled regenerate crypto key\n # and verify SSH is still working.\n if ssh?\n\n # Delete the existing crypto key\n # then regenerate it.\n regenerate_crypto\n \n # Close the session and reopen it\n # to see if we are still able to\n # connect via SSH.\n info 'Verifying SSH is still working'\n reconnect\n \n # If SSH is still working we can disable Telnet.\n if ssh?\n info 'Hooray SSH is still working !'\n disable_telnet\n else warn 'SSH is not working :('\n end\n \n end\n\n elsif match && !match['hostname'].downcase! then info 'Nothing to do'\n else error 'Unable to find hostname'; end\n \n @session.close\n end", "def with_duplicate_conn\n\t\toriginal_conn = self.conn\n\t\t@conn = original_conn.dup\n\t\tself.log.info \"Executing with %p, a copy of connection %p\" % [ @conn, original_conn ]\n\t\tyield\n\tensure\n\t\tself.log.info \" restoring original connection %p.\" % [ original_conn ]\n\t\t@conn = original_conn\n\tend", "def ssh_into(instance=nil)\n Kernel.system \"#{ssh_command(instance)}\" if instance\n end" ]
[ "0.7308735", "0.70887524", "0.7011901", "0.6992324", "0.69500595", "0.67557055", "0.6741859", "0.66920483", "0.6656344", "0.66263884", "0.6623412", "0.6534857", "0.65147537", "0.6505765", "0.650505", "0.6498305", "0.6469774", "0.6390665", "0.6361739", "0.63234186", "0.62700146", "0.61955863", "0.6130321", "0.6081806", "0.60497534", "0.5987066", "0.5979915", "0.5943331", "0.59376234", "0.5917642", "0.5913341", "0.5908221", "0.58941996", "0.5893595", "0.58933276", "0.58698463", "0.58627975", "0.5857771", "0.5845207", "0.58310974", "0.58246547", "0.5820543", "0.5820391", "0.5809442", "0.5798168", "0.5792367", "0.5779205", "0.5773008", "0.5751763", "0.57451713", "0.5710777", "0.570822", "0.56841356", "0.5648051", "0.56478167", "0.56420666", "0.56346846", "0.56303316", "0.56135553", "0.5612965", "0.5599305", "0.55955714", "0.5592781", "0.5589123", "0.55680466", "0.55566615", "0.5556008", "0.5553583", "0.5552052", "0.5551407", "0.5551207", "0.5538756", "0.553129", "0.5523214", "0.5520497", "0.5518946", "0.5518541", "0.551688", "0.5488596", "0.5488596", "0.5488596", "0.5488596", "0.548633", "0.5479808", "0.54736054", "0.5472088", "0.5451021", "0.54317576", "0.5429346", "0.5427214", "0.5423733", "0.5420248", "0.54197234", "0.54139346", "0.540109", "0.5386518", "0.5373158", "0.5369801", "0.5364277", "0.5360827" ]
0.6975452
4
N Without this method, we can't get a connection for doing SCP commands (i.e. copying files or directories from local to remote system)
def scpConnection return connection.scp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scp_connect\n # Connect to SCP and yield the SCP object\n connect do |connection|\n scp = Net::SCP.new(connection)\n return yield scp\n end\n rescue Net::SCP::Error => e\n # If we get the exit code of 127, then this means SCP is unavailable.\n raise Vagrant::Errors::SCPUnavailable if e.message =~ /\\(127\\)/\n\n # Otherwise, just raise the error up\n raise\n end", "def scp options = {}\n self.__commands << options.merge({:type => :scp})\n end", "def scp(src_file, path_of_servers, dst_file, option = \"\")\n _path_of_servers = path_of_servers.dup\n remove_first_localhost!(_path_of_servers)\n\n #generate session uuid and make temp dir string\n sid = SecureRandom.uuid\n temp_file = \"#{temp_dir(sid)}#{File.basename(src_file)}\"\n\n #first, local src file to edge server's temp dir\n #(/tmp/onion_ssh/<session uuid>/<files>)\n first = _path_of_servers.shift\n ssh([first], \"mkdir -p #{temp_dir(sid)} >& /dev/null\")\n `#{one_scp_str(src_file, first, temp_file)}`\n \n #second to last - 1 , scp temp dir to temp dir\n last = _path_of_servers.pop\n temp_path = [first]\n _second_to_last_minus_one = _path_of_servers\n _second_to_last_minus_one.each do |sv|\n temp_path << sv\n ssh(temp_path,\"mkdir -p #{temp_dir(sid)} >& /dev/null\")\n end\n\n temp_path = [first]\n _second_to_last_minus_one.each do |sv|\n ssh(temp_path, \"#{one_scp_str(temp_file, sv, temp_dir(sid))}\")\n temp_path << sv\n end\n\n #last minus one's path=(temp_path above) and last\n ssh(temp_path, \"#{one_scp_str(temp_file, last, dst_file)}\")\n #delete garbage\n clear_temp([first] + _second_to_last_minus_one, sid)\n end", "def scp(local_path,remote_path = \"#{dnsName}:\")\n if /([^:]+):(.*)/.match(remote_path)\n host = /([^:]+):(.*)/.match(remote_path)[1]\n remote_path_without_host = /([^:]+):(.*)/.match(remote_path)[2]\n else\n host = dnsName\n remote_path_without_host = remote_path\n end\n HCluster.scp_to(host,local_path,remote_path_without_host)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the file\n executeCommand(\"#{@scpCommandString} #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def sftp_copy(username, password, server, files_map)\n ssh = FileCopy.ssh_connect(username, password, server)\n ssh.sftp.connect do |sftp|\n uploads = files_map.map { |from,to|\n remote_dir = File.dirname(to)\n sftp_mkdir_recursive(sftp, File.dirname(to))\n Log.debug1(\"Copying %s to %s\",from, to)\n sftp.upload(from, to)\n }\n uploads.each { |u| u.wait }\n Log.debug1(\"Done.\")\n end # ssh.sftp.connect\n end", "def uploadViaSSH(host , login , path, files_to_upload)\n\n # on vérifie si le dossier existe\n check_command = \"if [ ! -d \\\"#{path}\\\" ]; then mkdir \\\"#{path}\\\"; fi\"\n \n Net::SSH.start(host, login) do |ssh|\n # capture all stderr and stdout output from a remote process\n output = ssh.exec!(check_command)\n \n puts \"check: #{check_command}\"\n puts \"output : #{output}\"\n end\n\n Net::SCP.start(host, login) do |scp|\n files_to_upload.each do |names|\n puts 'Envoi du fichier ' + names[0] + ' vers ' + names[1]\n scp.upload!(names[0].to_s, names[1])\n end\n end\n\nend", "def remote_clone\n raise CommandNotImplemented\n end", "def scp_cmd(source_file,destination_dir,backup_options = nil,backup_name = nil)\n backup_options ||= @backup_options\n backup_name ||= @backup_name\n ssh_user = backup_options[:user_name]\n ssh_host = backup_options[:hostname]\n ssh_password = backup_options[:password]\n if ssh_password\n # Need to use expect for the password if certs don't work\n cmd_exe = File.expand_path(File.join(::UBSAFE_ROOT, 'bin','ubsafe_scp_cmd.expect'))\n full_cmd = \"#{cmd_exe} #{ssh_user}@#{ssh_host} \\\"#{ssh_password}\\\" #{source_file} #{destination_dir}\"\n masked_full_cmd = \"#{cmd_exe} #{ssh_user}@#{ssh_host} [PASSWORD] #{source_file} #{destination_dir}\"\n else\n # Certs assumed if no password\n full_cmd = \"scp #{source_file} #{ssh_user}@#{ssh_host}:#{destination_dir}\"\n masked_full_cmd = full_cmd\n end\n #puts \"About to issue \\\"#{full_cmd}\\\"\"\n cmd_output = `#{full_cmd}`\n cmd_status = $?\n @log.debug(\"Executed scp status #{cmd_status} command \\\"#{masked_full_cmd}\\\"\")\n cmd_output_lines = cmd_output.split(\"\\n\").reject {|line| line =~ /spawn/i or line =~ /password/i }\n cmd_output_cleaned = []\n cmd_output_lines.each do |cmd_output_line|\n cmd_output_cleaned << cmd_output_line.strip.chomp\n end\n cmd_status = cmd_status == 0 ? :success : :failure\n return [cmd_status,cmd_output_cleaned]\n end", "def sshAndScp\n return contentHost.sshAndScp\n end", "def upload(source, destination, options = {} )\n options = @connection_options.clone\n host = options.delete(:host)\n username = options.delete(:username)\n channel = session.scp.upload(source,destination)\n channel.wait\n end", "def ssh\n @ssh ||= @remote.connect\n @remote\n end", "def ssh(path_of_servers, command)\n _path_of_servers = path_of_servers.dup\n remove_first_localhost!(_path_of_servers)\n Open3.capture3(ssh_str(_path_of_servers, command))\n end", "def scp(src, dest, *opts)\n run \"scp #{Array.wrap(src).join(' ')} #{dest}\", *opts\n end", "def command_for_rsync\n args = []\n args << \"-l #{@options[:user]}\" if @options[:user]\n args << \"-p #{@options[:port]}\" if @options[:port]\n if @options[:keys]\n @options[:keys].each { |key| args << \"-i #{key}\" }\n end\n \"ssh #{args.join(' ')}\"\n end", "def scp(src, dest, hosts=self.hosts)\n Array(hosts).each do |host|\n output = `scp -q #{src} #{\"#{host}:\" unless host == :localhost}#{dest} 2>&1`\n case output\n when /Permission denied/i\n raise Errno::EACCES, output.chomp\n when /No such file or directory/i\n raise Errno::ENOENT, output.chomp\n end unless $?.exitstatus == 0\n end\n\n return nil\n end", "def ssh_cmd(destination_host, cmd)\n\n if strict_host_checking\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n else\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n '-o', 'UserKnownHostsFile=/dev/null',\n '-o', 'StrictHostKeyChecking=no',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n end\n end", "def copy files, host, dir\n dest = \"#{dir}/#{host}\"\n File.directory?(dest) || mkdir_p(dest)\n #puts \"Connecting to #{host}\"\n begin\n Net::SFTP.start(host, \"root\", :auth_methods => [\"publickey\"], :keys => [$key], :timeout => 1) do |sftp|\n files.each do |file|\n begin\n dir = File.dirname \"#{dest}/#{file}\"\n stats = sftp.stat! file\n if stats\n File.directory?(dir) || mkdir_p(dir)\n if stats.directory?\n sftp.download! file, \"#{dest}/#{file}\", :recursive => true\n chmod stats.permissions, \"#{dest}/#{file}\"\n else\n sftp.download! file, \"#{dest}/#{file}\"\n chmod stats.permissions, \"#{dest}/#{file}\"\n end\n touch \"#{dest}/.completed\" #at least one copied file. Too intensive?\n end\n rescue\n #puts \"Next for #{file}\"\n next #file does not exist\n end\n end\n end\n rescue Net::SFTP::Exception => e\n puts \"#{host} sftp exception: #{e}\"\n return false\n #rescue Net::SCP::Error => e\n # puts \"#{host} scp error: #{e}\"\n # return false\n rescue Timeout::Error => e\n puts \"#{host} timeout: #{e}\"\n return false\n rescue Errno::ECONNREFUSED => e\n puts \"#{host} refused: #{e}\"\n return false\n rescue SocketError => e\n puts \"#{host} resolve: #{e}\"\n return false\n rescue Net::SSH::AuthenticationFailed => e\n puts \"#{host} auth failed: #{e}\"\n return false\n rescue Net::SSH::Disconnect => e\n puts \"#{host} disconnected: #{e}\"\n return false #no access to host\n end\n return true\nend", "def scp?\n true\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy file #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the file will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the file won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath)\n end\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the directory\n executeCommand(\"#{@scpCommandString} -r #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def rcp(opts)\n dest = opts[:d].name\n source = opts[:sp]\n dest_path = opts[:dp]\n\n # Grab a remote path for temp transfer\n tmpdest = tmppath\n\n # Do the copy and print out results for debugging\n cmd = \"scp -r '#{source}' #{dest}:#{tmpdest}\"\n output << bold(color(\"localhost$\", :green)) << \" #{cmd}\\n\"\n ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]\n ssh.scp.upload! source.to_s, tmpdest.to_s, :recursive => true\n\n # Now we move the file into their final destination\n result = shell(:n => opts[:d], :c => \"mv #{tmpdest} #{dest_path}\")\n result[:exit_code] == 0\n end", "def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend", "def net_scp_transfer!(direction, recursive, *files)\n \n unless [:upload, :download].member?(direction.to_sym)\n raise \"Must be one of: upload, download\" \n end\n \n if @rye_current_working_directory\n debug \"CWD (#{@rye_current_working_directory})\"\n end\n \n files = [files].flatten.compact || []\n\n # We allow a single file to be downloaded into a StringIO object\n # but only when no target has been specified. \n if direction == :download \n if files.size == 1\n debug \"Created StringIO for download\"\n target = StringIO.new\n else\n target = files.pop # The last path is the download target.\n end\n \n elsif direction == :upload\n# p :UPLOAD, @rye_templates\n raise \"Cannot upload to a StringIO object\" if target.is_a?(StringIO)\n if files.size == 1\n target = self.getenv['HOME'] || guess_user_home\n debug \"Assuming upload to #{target}\"\n else\n target = files.pop\n end\n \n # Expand fileglobs (e.g. path/*.rb becomes [path/1.rb, path/2.rb]).\n # This should happen after checking files.size to determine the target\n unless @rye_safe\n files.collect! { |file| \n file.is_a?(StringIO) ? file : Dir.glob(File.expand_path(file)) \n }\n files.flatten! \n end\n end\n \n # Fail early. We check whether the StringIO object is available to read\n files.each do |file|\n if file.is_a?(StringIO)\n raise \"Cannot download a StringIO object\" if direction == :download\n raise \"StringIO object not opened for reading\" if file.closed_read?\n # If a StringIO object is at end of file, SCP will hang. (TODO: SCP)\n file.rewind if file.eof?\n end\n end\n \n debug \"FILES: \" << files.join(', ')\n \n # Make sure the target directory exists. We can do this only when\n # there's more than one file because \"target\" could be a file name\n if files.size > 1 && !target.is_a?(StringIO)\n debug \"CREATING TARGET DIRECTORY: #{target}\"\n self.mkdir(:p, target) unless self.file_exists?(target)\n end\n \n Net::SCP.start(@rye_host, @rye_user, @rye_opts || {}) do |scp|\n transfers = []\n prev = \"\"\n files.each do |file|\n debug file.to_s\n prev = \"\"\n line = nil\n transfers << scp.send(direction, file, target, :recursive => recursive) do |ch, n, s, t|\n line = \"%-50s %6d/%-6d bytes\" % [n, s, t]\n spaces = (prev.size > line.size) ? ' '*(prev.size - line.size) : ''\n pinfo \"[%s] %s %s %s\" % [direction, line, spaces, s == t ? \"\\n\" : \"\\r\"] # update line: \"file: sent/total\"\n @rye_info.flush if @rye_info # make sure every line is printed\n prev = line\n end\n end\n transfers.each { |t| t.wait } # Run file transfers in parallel\n end\n \n target.is_a?(StringIO) ? target : nil\n end", "def initialize_ssh; end", "def scp(name, user, opts={}, &block)\n local_port = open(name, opts[:port] || 22)\n begin\n Net::SCP.start(\"127.0.0.1\", user, opts.merge(:port => local_port), &block)\n ensure\n close(local_port) if block || $!\n end\n end", "def scp(source, destination)\n ssh.scp.upload!(source, destination) do |ch, name, rec, total|\n percentage = format('%.2f', rec.to_f / total.to_f * 100) + '%'\n print \"Saving to #{name}: Received #{rec} of #{total} bytes\" + \" (#{percentage}) \\r\"\n $stdout.flush\n end\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy directory #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the files will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the files won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath, :recursive => true)\n end\n end", "def send_blobs(ssh,srcpath,despath)\n if File.exist?srcpath\n #puts srcpath.split('/').inspect+\" srcfile\"\n #puts srcpath.split('/')[-1] + \" src file\"\n #puts ssh.exec!(\"ls\").inspect\n if ssh.exec!(\"ls\").inspect.include? srcpath.split('/')[-1]\n\n#return\n end\n ssh.scp.upload!( srcpath , despath , :recursive => true )do|ch, name, sent, total|\n percent = (sent.to_f*100 / total.to_f).to_i\n print \"\\r#{@host}: #{name}: #{percent}%\"\n end\n print \"\\n\"\n puts \"#{srcpath} upload Done.\"\n else\n abort(\"ERROR: Don't have such File: #{srcpath}\")\n end\n end", "def upload_server_file(hostname,username,password,remote_file,local_file)\n Net::SCP.upload!(hostname, username, remote_file, local_file, :ssh => { :password => password })\n return\nend", "def send_to(ip, files)\n begin\n puts \"[*] copying #{files} to ip : #{ip}\"\n sock = TCPSocket::new ip, RNCP::PORT\n sock.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1\n\n data = tar files\n \n sock.send data.string, 0\n sock.flush\n\n rescue Exception => e\n puts \"[!] cannot create connection to host, bailing out\"\n puts e\n ensure\n sock.close if sock.nil? == false\n puts \"[#] finished\"\n end\n end", "def ssh(commandString, dryRun = false)\n contentHost.sshAndScp.ssh(commandString, dryRun)\n end", "def scp(iFileSrc, iFileDst)\n check_expected_call('SCP', :Host => @SSHHost, :Login => @SSHLogin, :FileSrc => iFileSrc, :FileDst => iFileDst) do\n scp_RBPTest(iFileSrc, iFileDst)\n end\n end", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def ssh(*arguments)\n options = []\n\n # Add the -p option if an alternate destination port is given\n if @uri.port\n options += ['-p', @uri.port.to_s]\n end\n\n # append the SSH URI\n options << ssh_uri\n\n # append the additional arguments\n arguments.each { |arg| options << arg.to_s }\n\n return system('ssh',*options)\n end", "def remote_copy(from, to, sudo: false, owner: nil, group: nil)\n extra_opts = {}\n extra_opts[:sudo] = sudo if sudo\n extra_opts[:owner] = owner if owner\n extra_opts[:group] = group if group\n @calls << [:remote_copy, from, to] + (extra_opts.empty? ? [] : [extra_opts])\n @remote_copy_code&.call(@stdout_io, @stderr_io, self)\n end", "def ssh( commands=[], extra_ssh_ops={})\n commands = commands.compact.join(' && ') if commands.is_a?(Array)\n cmd_string = \"ssh #{user}@#{host} #{ssh_options(extra_ssh_ops)} \"\n if commands.empty?\n #TODO: replace this with a IO.popen call with read_nonblocking to show progress, and accept input\n Kernel.system(cmd_string)\n else\n system_run(cmd_string+\"'#{commands}'\")\n end\n end", "def transfer!\n write_password_file! unless local\n\n remote_path = remote_path_for(@package)\n\n create_remote_path!(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n if local\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ remote_path }'.\"\n run(\n \"#{ utility(:rsync) } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ File.join(remote_path, remote_file) }'\"\n )\n else\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ ip }'.\"\n run(\n \"#{ utility(:rsync) } #{ rsync_options } #{ rsync_port } \" +\n \"#{ rsync_password_file } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ username }@#{ ip }:#{ File.join(remote_path, remote_file) }'\"\n )\n end\n end\n\n ensure\n remove_password_file! unless local\n end", "def download_server_file(hostname,username,password,remote_file,local_file)\n Net::SCP.download!(hostname, username, remote_file, local_file, :ssh => { :password => password })\n return\nend", "def rsync_from(source, target, dest, port = 22, extra_flags = [])\n rsync = find_program_on_path('rsync')\n flags = \"-rHlv -O --no-perms --no-owner --no-group\"\n unless extra_flags.empty?\n flags << \" \" << extra_flags.join(\" \")\n end\n ex(\"#{rsync} -e '#{ssh_command(port)}' #{flags} #{target}:#{source} #{dest}\")\n end", "def connect_to_host(host,port,user,password,sftp=false)\n begin\n if sftp\n @log.info(\"SFTP connect to host #{host}:#{port}\")\n @ssh_connect = Net::SFTP.start(host,user,:password=>password,:port=>port)\n else\n @log.info(\"SSH connect to host #{host}:#{port}\")\n @ssh_connect = Net::SSH.start(host,user,:password=>password,:port=>port)\n end\n rescue Exception => error\n @log.error(\"#{error}\")\n exit\n end\n end", "def exec_ssh(command, args, setting)\n puts \"#{Time.now} call #{self.class}##{__method__}\"\n ssh_options = ssh_option_init(setting)\n\n user = setting[\"ssh\"][\"user\"]\n host = setting[\"ssh\"][\"host\"]\n remote_dir = setting[\"dir\"][\"remote\"]\n\n Net::SSH.start(host, user, ssh_options) do |session|\n case command\n when :scp\n puts \"#{Time.now} scp: from #{args} to #{user}@#{host}:#{remote_dir}\"\n return Net::SCP.new(session).upload!(args, remote_dir, {:verbose => 'useful'})\n when :ssh\n return session.exec!(\"bash -c '#{args}'\").chomp!\n end\n end\n rescue Net::SSH::AuthenticationFailed => ex\n puts \"1\"\n puts \"class:#{ex.class} #{ex.message}\"\n return ex.class\n rescue Errno::ECONNREFUSED => ex\n puts \"2\"\n puts \"class:#{ex.class} #{ex.message}\"\n rescue => ex\n puts \"3\"\n puts \"class:#{ex.class} #{ex.message}\"\n end", "def copy(src, dst)\n\t\t# TODO: make cp able to handle strings, where it will create an entry based\n\t\t# on the box it's run from.\n\t\t\n\t\tif !(src.kind_of?(Rush::Entry) && dst.kind_of?(Rush::Entry))\n\t\t\traise ArgumentError, \"must operate on Rush::Dir or Rush::File objects\"\n\t\tend\n\t\t\n\t\t# 5 cases:\n\t\t# 1. local-local\n\t\t# 2. local-remote (uploading)\n\t\t# 3. remote-local (downloading)\n\t\t# 4. remote-remote, same server\n\t\t# 5. remote-remote, cross-server\n\t\tif src.box == dst.box # case 1 or 4\n\t\t\tif src.box.remote? # case 4\n\t\t\t\tsrc.box.ssh.exec!(\"cp -r #{src.full_path} #{dst.full_path}\") do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # case 1\n\t\t\t\tFileUtils.cp_r(src.full_path, dst.full_path)\n\t\t\tend\n\t\telse # case 2, 3, or 5\n\t\t\tif src.local? && !dst.local? # case 2\n\t\t\t\t# We use the connection on the remote machine to do the upload\n\t\t\t\tdst.box.ssh.scp.upload!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telsif !src.local? && dst.local? # case 3\n\t\t\t\t# We use the connection on the remote machine to do the download\n\t\t\t\tsrc.box.ssh.scp.download!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telse # src and dst not local, case 5\n\t\t\t\tremote_command = \"scp #{src.full_path} #{dst.box.user}@#{dst.box.host}:#{dst.full_path}\"\n\t\t\t\t# doesn't matter whose connection we use\n\t\t\t\tsrc.box.ssh.exec!(remote_command) do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# TODO: use tar for cross-server transfers.\n\t\t# something like this?:\n\t\t# archive = from.box.read_archive(src)\n\t\t# dst.box.write_archive(archive, dst)\n\n\t\tnew_full_path = dst.dir? ? \"#{dst.full_path}#{src.name}\" : dst.full_path\n\t\tsrc.class.new(new_full_path, dst.box)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(to)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, from\n\tend", "def download(remote, local, port:, user:, password:)\n Net::SSH::Simple.scp_get(ip, remote.to_s, local.to_s,\n user: user, port: port, password: password, paranoid: false)\n true\n rescue Net::SSH::Simple::Error => e\n log.info \"Downloading '#{remote}' failed: #{e.inspect}\"\n false\n end", "def connect(opts={})\n if Mario::Platform.windows?\n raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,\n :ssh_port => port(opts)\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n options = {}\n options[:port] = port(opts)\n [:host, :username, :private_key_path].each do |param|\n options[param] = opts[param] || env.config.ssh.send(param)\n end\n\n check_key_permissions(options[:private_key_path])\n\n # Command line options\n command_options = [\"-p #{options[:port]}\", \"-o UserKnownHostsFile=/dev/null\",\n \"-o StrictHostKeyChecking=no\", \"-o IdentitiesOnly=yes\",\n \"-i #{options[:private_key_path]}\"]\n command_options << \"-o ForwardAgent=yes\" if env.config.ssh.forward_agent\n\n if env.config.ssh.forward_x11\n # Both are required so that no warnings are shown regarding X11\n command_options << \"-o ForwardX11=yes\"\n command_options << \"-o ForwardX11Trusted=yes\"\n end\n\n # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails\n # (GH-51). As a workaround, we fork and wait. On all other platforms,\n # we simply exec.\n pid = nil\n pid = fork if Util::Platform.leopard? || Util::Platform.tiger?\n Kernel.exec \"ssh #{command_options.join(\" \")} #{options[:username]}@#{options[:host]}\".strip if pid.nil?\n Process.wait(pid) if pid\n end", "def transfer_file(login, password, file)\n\thost = 'stdlinux.cse.ohio-state.edu'\n\n\tNet::SCP.start(host, login, :password => password) do |scp|\n\t\tputs 'File Transfer Started'\n\t\tscp.upload(file, '.')\n\tend\n\n\tputs 'File Transfer Ended'\nend", "def local_to_remote!\n if not @remote_io or not @local_io\n raise Exception::new(\"Copy request from local to remote stream, but no local and/or remote stream have been assigned.\")\n end\n\n @local_io.acquire do |lio|\n lio.seek(@local_position)\n @remote_io.acquire :write do |rio|\n #p rio\n rio.write(self.to_s)\n File.copy_stream(lio, rio, @local_size)\n end\n end\n\n end", "def ssh(*ssh_args)\n args = ['ssh',\n '-o', 'BatchMode=yes',\n '-o', 'ConnectionAttempts=5',\n '-o', 'ConnectTimeout=30',\n '-o', 'ServerAliveInterval=60',\n '-o', 'TCPKeepAlive=yes',\n '-x', '-a',\n '-i', @ssh_key,\n '-l', @destination_user,\n @destination_host\n ] +\n ssh_args.map { |a| a ? a : '' }\n\n puts args.join(\" \" ) if @verbose\n system(*args)\nend", "def remote_connect(host,user,password)\n log_file = File.open(File.join(\"log\",host+\".log\"),\"w+\")\n begin\n #send_as_root(host,user,password)\n @error = []\n Net::SSH.start(host,user,:password=>password) do |ssh|\n puts host+\" connected.\"\n send_all ssh\n exec ssh,log_file,\"bash #{@filename+'.sh'}\"\n end\n if @error.size!=0\n puts \"ERROR OCCURS:\"\n end\n @error.each do |str|\n puts str\n end\n end while @error.size != 0\n log_file.close\n end", "def scp(file)\n\t\tif pull_request_where == \"jackrabbit\"\n\t\t\tNet::SSH.start(pull_request_host, pull_request_user) do |ssh|\n\t\t\t\t# when testing, make sure to use cedar['upload_test_dir'] - this is the sftp user account home directory\n\t\t\t\t# when ready to move into production testing change this to cedar['upload_dir'] - this is the ALF automated ingest directory\n\t\t\t\tsuccess = ssh.scp.upload!(file, pull_request_upload_dir+'/#{file}')\n\t\t\t\traise \"Failed to scp file to #{pull_request_where}\" unless success\n\t\t\t\tlogger.info \"scp.upload! returned #{success}\"\n\t\t\t\tsuccess\n\t\t\tend\n\t\telsif pull_request_where == \"cedar\"\n\t\t\tNet::SCP.start(pull_request_host, pull_request_user, password: ALF_CFG['cedar_password']) do |scp|\n\t\t\t\t# when testing, make sure to use alf['upload_test_dir'] - this is the sftp user account home directory\n\t\t\t\t# when ready to move into production testing change this to alf['upload_dir'] - this is the ALF automated ingest directory\n\t\t\t\tsuccess = scp.upload!(file, \"#{pull_request_upload_dir}\")\n\t\t\t\traise \"Failed to scp file to #{pull_request_where}\" unless success\n\t\t\t\tlogger.info \"scp.upload! returned #{success}\"\n\t\t\t\tsuccess\n\t\t\tend\n\t\telse\n\t\t\traise \"Alf.yml does not have a valid 'where' value defined\"\n\t\tend\n\tend", "def rsync_port\n \"-e 'ssh -p #{port}'\"\n end", "def upload\n @files.each do |fn|\n sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}\n end\n end", "def connect!\n @ssh = Net::SSH.start(@host, @user, :password => @pass)\n end", "def kind\n :ssh\n end", "def ssh(*args)\n options = []\n\n # Add the -p option if an alternate destination port is given\n if @uri.port\n options += ['-p', @uri.port.to_s]\n end\n\n options << ssh_uri\n options += args\n\n return system('ssh',*options)\n end", "def rsync(source, target, exclude = [], options = [], verbose = false)\n excludes = exclude.map {|e| \"--exclude=#{e} \"}\n host = source.split(/\\//)[2]\n port = 873\n\n # Make the target directory if it's not there.\n FileUtils.mkdir(target) if !File.directory?(target)\n\n begin\n raise Exception, \"Unable to connect to remote host #{source}\" unless port_open?(host, port)\n\n log(\"rsync #{options} #{excludes} #{source} #{target}\")\n\n if verbose\n puts \"RUNNING: rsync #{options} #{excludes} #{source} #{target}\"\n system \"rsync #{options} #{excludes} #{source} #{target}\"\n else\n `rsync #{options} #{excludes} #{source} #{target}`\n end\n\n rescue Errno::EACCES, Errno::ENOENT, Errno::ENOTEMPTY, Exception => e\n log(e.to_s)\n end\nend", "def initialize(shell, scpProgram)\n #N Without this we won't have the remote shell command as an array of executable + arguments\n @shell = shell.is_a?(String) ? [shell] : shell\n #N Without this we won't have the SCP command as an array of executable + arguments\n @scpProgram = scpProgram.is_a?(String) ? [scpProgram] : scpProgram\n #N Without this we won't have the SCP command as single string of white-space separated executable + arguments\n @scpCommandString = @scpProgram.join(\" \")\n end", "def transfer(frames, target)\n files = frames.map { |f| \"#{INSTALL_LOCATION}/install/lab21-mov#{sprintf(\"%04d\", f)}.xwd\" }\n print(\"transferring frames #{frames.first} to #{frames.last} from #{target[:host]}\\n\".blue)\n begin\n transfers = Array.new\n Net::SCP.start(target[:host], target[:user], {password: target[:pass], compression: true}) do |scp|\n files.each do |file|\n transfers << scp.download(file, \"./results/\")\n end\n end\n transfers.each{|t| t.wait}\n print \"All transfers completed on #{target[:host]}\\n\".green\n rescue Exception => e\n puts e\n printf \"error caused by machine #{target[:host]}.\\n\".red\n end\nend", "def tunnel\n system @opts[:ssh][:bin],\n @opts[:ssh][:opts],\n '-p', @opts[:remote][:ssh_port].to_s,\n '-i', @opts[:ssh][:identity],\n '-R', [\n @opts[:remote][:fwd_port],\n @opts[:local][:host],\n @opts[:local][:port]\n ].join(':'),\n \"#{@opts[:remote][:user]}@#{@opts[:remote][:host]}\"\n end", "def rsync_to(source, target, dest, port = 22, extra_flags = [\"--ignore-existing\"])\n rsync = find_program_on_path('rsync')\n flags = \"-rHlv --no-perms --no-owner --no-group\"\n unless extra_flags.empty?\n flags << \" \" << extra_flags.join(\" \")\n end\n ex(\"#{rsync} -e '#{ssh_command(port)}' #{flags} #{source} #{target}:#{dest}\")\n end", "def scp_results(filename)\n for scp_host in scp_hosts\n host, port = scp_host.split(\",\")\n puts \"Copying file to host #{host}...\" if options[:verbose]\n `scp -r -P #{port.strip} #{filename} #{host}`\n end\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def get_backup\n safe_run \"scp #{user}@#{host}:#{remote_path} #{local_path}\"\n local_path\n end", "def copy_from_remote(remote_file, local_path)\n\t\tbegin\n\t\t\t@@logger.info { \"Copying file from #{remote_file} to #{local_path}\" }\n\t\t\t@ssh_session.scp.download!(remote_file, local_path)\n\t\t\treturn true\n\t\trescue => err\n\t\t\t@@logger.error { \"SCP failed: #{err.message}\" }\n\t\t\t@@logger.error { \"\\t #{err.backtrace}\" }\n\t\tend\n\tend", "def get_new\n logger.debug \"Establishing connection for #{creep.user}@#{creep.host} passwd:#{creep.password}\"\n ssh = Net::SSH.start(creep.host, creep.user, {:password => creep.password, :verbose => (ENV['SSH_DEBUG'] && ENV['SSH_DEBUG'].to_sym) || :fatal })\n ssh.send_global_request(\"[email protected]\")\n ssh\n rescue Net::SSH::Exception => ex\n logger.error \"There was an exception in method get_new for SSConnection. Details #{ex}:\\n#{ex.backtrace}\"\n return nil\n rescue SystemCallError => ex\n logger.error \"There was an system error in method get_new for SSConnection. Details #{ex}:\\n#{ex.backtrace}\"\n return nil\n end", "def file_upload(*paths); net_scp_transfer!(:upload, false, *paths); end", "def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end", "def remote_command(command)\n return %x(ssh #{self.sar_host} \"#{command}\")\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n cmd = self.class.curr_host == host ? cmd : \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"#{cmd}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n op = try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev ? 'mv' : 'cp -r'\n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ?\n \"#{op} #{local_path.shellescape} #{dst_path.shellescape}\" :\n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def sync_cmd\n \"rsync --delete -avzhe '#{@ssh_path} -p #{@port}' #{cygdrive_path @log_dir} #{user_at_host}:#{@remote_log_parent_dir}\"\n end", "def copy_contents\n cmd = rsync_cmd\n\n @log.debug \"Copying contents with: #{cmd}\"\n\n %x[#{cmd}]\n $?.success?\n end", "def ssh_connection\n @ssh_connection ||= Net::SSH.start(@host, config[:user], config[:ssh_options] || {})\n end", "def spawn_connection\n connect\n end", "def rsync( srcs, target, opts )\n @commands << rsync_args( host, srcs, target, opts )\n ( rand(2) == 1 ) ? [ [ 'something', 'somefile' ] ] : []\n end", "def powercli_connect_exec(cmd)\n # used cached powershell runtime AND used cached PowerCLI connection\n # caching the powershell runtime is a huge savings, caching the PowerCLI connection\n # is another huge savings, worth about 5-10s total per call\n PuppetX::PowerCLI::Helper.instance.powercli_connect_exec(resource[:vcenter_connection],\n cmd)\n end", "def ssh\n platform_service(:ssh)\n end", "def tunnel_cmd remote_port, local_port\n \"ssh -NT -R #{remote_port}:localhost:#{local_port} #{user_at_host} -p #{@port}\"\n end", "def MonitoringSftp host\n\n\n\n localPath = host[:lp]\n remotePath = host[:rp]\n login = host[:username]\n host = host[:host]\n\n system 'clear'\n puts localPath\n\n # Mettre en place un tableau pour le systeme de monitoring\n FileWatcher.new([\"#{localPath}\"]).watch() do |filename, event|\n\n scp = \"scp -r #{localPath} #{login}@#{host}:#{remotePath}\"\n\n if(event == :changed)\n puts filename.colorize :light_blue\n `#{scp}`\n end\n\n if(event == :delete)\n p uts \"File deleted: \" + filename\n end\n\n if(event == :new)\n puts filename.blue.on_red\n `#{scp}`\n end\n\n end\n\nend", "def current_data\n start_ssh do |ssh|\n return ssh.scp.download!(full_filename)\n end\n end", "def upload_base_on_boa\n cmd = \"scp -p #{base_local_path.expanded_path} #{serveur_ssh_boa}:#{base_distant_path_boa}\"\n res = `#{cmd}`\n end", "def pull\n if self.connect then\n @config = UBNT::Configuration.parse(@ssh_connection.scp.download!(\"/tmp/system.cfg\"))\n end\n end", "def connect &block\n options = {password: password }.merge(@net_ssh_options)\n Net::SFTP.start(host, username, options) do |sftp|\n connection = Euromail::SFTPConnection.new(self, sftp)\n block.call(connection)\n end\n end", "def remote_connections; end", "def cp (from, to, as: user, on: hosts, quiet: false, once: nil, delete: false)\n self.once once, quiet: quiet do\n log.info \"cp: #{from} -> #{to}\", quiet: quiet do\n Dir.chdir File.dirname(file) do\n hash_map(hosts) do |host|\n host.cp from, to, as: as, quiet: quiet, delete: delete\n end\n end\n end\n end\n end", "def scp_upload(src_file, remote_folder)\n scp_connect\n success = false\n unless @scp_session.nil? or is_dryrun\n begin\n scp_mkdir_p(remote_folder) unless scp_dir_exist?(remote_folder)\n rem_file = File.join(remote_folder, File.basename(src_file)).to_s\n @scp_session.upload!(src_file, rem_file)\n # some files don't take permissions of their parent folder, not sure why!\n # forcing file permissions as well!\n scp_set_file_perms(rem_file)\n success = true\n rescue => ex\n puts(\"ERR: failed to upload #{src_file} to remote #{remote_folder}: response #{ex.to_s}\")\n $stdout.flush\n end\n ssh_disconnect\n end\n success\n end", "def cp(from_location, to_location)\n @client.file_copy(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end", "def rsync(*sources)\n # Default options include --inplace because we only care about consistency\n # at the end of the job, and rsync will do more work for big files without\n # it.\n #\n # rsync can spend a long time at the far end checking over its files at\n # the far end without transfer, so we want to wait as long as possible\n # without jeopardising the timing of the next backup run.\n #\n #\n args = %w( rsync --archive --xattrs --numeric-ids --delete-excluded --delete-during --inplace --relative )\n\n #\n # Add on the I/O-timeout\n #\n args += ['--timeout', @io_timeout.to_s ] unless ( @io_timeout.nil? )\n\n\n args += ['--rsh', \"ssh -o BatchMode=yes -x -a -i #{@ssh_key} -l #{@destination_user}\"]\n args << '--verbose' if @verbose\n args += @excludes.map { |x| ['--exclude', x] }.flatten\n\n #\n # Add in the rsync excludes and sources files, if present.\n #\n if File.exist?('/etc/byteback/excludes')\n args += ['--exclude-from', '/etc/byteback/excludes']\n end\n\n #\n # Add in an rsync_filter if required.\n #\n if File.exist?('/etc/byteback/rsync_filter')\n args += ['--filter', 'merge /etc/byteback/rsync_filter']\n end\n\n #\n # To add extra rsync flags, a file can be used. This can have flags all on one line, or one per line.\n #\n if File.exist?('/etc/byteback/rsync_flags')\n args += File.readlines('/etc/byteback/rsync_flags').map(&:chomp)\n end\n\n args += ['--rsync-path', 'rsync --fake-super']\n\n args += sources\n args << @destination\n\n log_system(*args)\nend", "def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end", "def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend", "def sftp\n @_sftp ||= Net::SFTP.start(host, user, options)\n end", "def cp_into(options={})\n cmd = \"/bin/cp #{options[:src]} #{@config.ve_private}/#{options[:dst]}\"\n execute(cmd)\n end", "def rsync_command\n if @config[:rsync][:direction] == 'up'\n from = absolute_path(@config[:local_path])\n to = @config.ssh_user_and_host + ':' + @config[:remote_path]\n else\n from = @config.ssh_user_and_host + ':' + @config[:remote_path]\n to = absolute_path(@config[:local_path])\n end\n \"rsync #{rsync_command_options.join(' ')} '#{from}/' '#{to}'\"\n end", "def provision_on(config)\n check_compatibility!(config)\n\n return if config.commands.nil?\n\n # this will initialize the SSH tunnel based on the connection settings\n @tunnel = Tunnel.new($connection.settings.to_h)\n @errors = []\n\n @results = nil\n\n stdout = []\n @sftp = nil\n @tunnel.on_shh do |session|\n while config.commands.count > 0\n cmd = config.commands.shift\n \n if cmd.type.eql? Command::DOWNLOAD_FILE\n catch_sftp_exception do\n @sftp = init_sftp\n DevOn::print({:title => \"Preparing SFTP Download\", :value => cmd.value})\n @sftp.download!(cmd.value[:source], cmd.value[:destination], {:verbose => @tunnel.verbose})\n DevOn::print({:title => \"File Download Complete\", :value => cmd.value[:destination]})\n end\n end\n\n if cmd.type.eql? Command::UPLOAD_FILE\n catch_sftp_exception do\n @sftp = init_sftp\n DevOn::print({:title => \"Preparing SFTP Upload\", :value => cmd.value})\n @sftp.upload!(cmd.value[:source], cmd.value[:destination], {:verbose => @tunnel.verbose})\n DevOn::print({:title => \"File Uploaded\", :value => cmd.value[:destination]})\n end\n end\n\n if cmd.type.eql? Command::SHELL\n catch_ssh_exception do \n command = cmd.value\n command = command.gsub(\"$output\", $output) if(command.include?\"$output\") \n \n DevOn::print({:title => \"Preparing SSH command\", :value => command})\n session.exec!(command) do |channel, stream, data|\n if stream == :stdout\n arr = data.split(\"\\n\")\n stdout = arr.empty? ? data : arr\n @results = stdout\n end\n end\n $output = stdout.flatten.join(' ')\n DevOn::print({:title => \"[SHELL OUTPUT]\", :output => stdout})\n end\n end\n end\n end\n \n if [email protected]?\n ap \"Please correct the following ERRORS:\"\n ap @errors\n else\n ap \"NO ERRORS ENCOUNTERED!\"\n end\n\n @results\n end", "def ssh_command\n args = domain!\n args = \"#{user}@#{args}\" if user?\n args << \" -i #{identity_file}\" if identity_file?\n args << \" -p #{ssh_port}\" if ssh_port?\n args << \" -t\"\n \"ssh #{args}\"\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def exec(opts={})\n # Get the SSH information and cache it here\n ssh_info = info\n\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],\n :port => ssh_info[:port],\n :username => ssh_info[:username],\n :key_path => ssh_info[:private_key_path]\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n # If plain mode is enabled then we don't do any authentication (we don't\n # set a user or an identity file)\n plain_mode = opts[:plain_mode]\n\n options = {}\n options[:host] = ssh_info[:host]\n options[:port] = ssh_info[:port]\n options[:username] = ssh_info[:username]\n options[:private_key_path] = ssh_info[:private_key_path]\n\n # Command line options\n command_options = [\"-p\", options[:port].to_s, \"-o\", \"UserKnownHostsFile=/dev/null\",\n \"-o\", \"StrictHostKeyChecking=no\", \"-o\", \"LogLevel=FATAL\", \"-p\", options[:password].to_s]\n\n # Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option\n # (Also don't use it in plain mode, it'll skip user agents.)\n command_options += [\"-o\", \"IdentitiesOnly=yes\"] if !(Util::Platform.solaris? || plain_mode)\n\n command_options += [\"-i\", options[:private_key_path]] if !plain_mode\n command_options += [\"-o\", \"ForwardAgent=yes\"] if ssh_info[:forward_agent]\n\n # If there are extra options, then we append those\n command_options.concat(opts[:extra_args]) if opts[:extra_args]\n\n if ssh_info[:forward_x11]\n # Both are required so that no warnings are shown regarding X11\n command_options += [\"-o\", \"ForwardX11=yes\"]\n command_options += [\"-o\", \"ForwardX11Trusted=yes\"]\n end\n\n host_string = options[:host]\n host_string = \"#{options[:username]}@#{host_string}\" if !plain_mode\n command_options << host_string\n @logger.info(\"Invoking SSH: #{command_options.inspect}\")\n safe_exec(\"ssh\", *command_options)\n end", "def exec_cmd cmd\n t = Time.now\n results = \"\"\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch,success|\n unless success\n Logger.<<(__FILE__,\"INFO\",\"Could Not execute command #{cmd}\")\n abort\n end\n # stdout\n channel.on_data do |ch,data|\n results += data\n end\n # stderr\n channel.on_extended_data do |ch,type,data|\n Logger.<<(__FILE__,\"ERROR\",\"Error from the cmd #{cmd} : #{data}\")\n abort\n end\n channel.on_close do |ch|\n end\n end\n end\n # wait for the command to finish\n @ssh.loop\n Logger.<<(__FILE__,\"DEBUG\",\"SFTP Command executed in #{Time.now - t} sec\") if @opts[:v]\n results.split\n end", "def file_download(*paths); net_scp_transfer!(:download, false, *paths); end" ]
[ "0.68333906", "0.6414909", "0.64033014", "0.6350961", "0.6203266", "0.6192439", "0.617495", "0.61690027", "0.6163215", "0.60408545", "0.6029382", "0.6021623", "0.60060203", "0.6000578", "0.5997791", "0.59711623", "0.5958206", "0.5952393", "0.5935774", "0.59356195", "0.589367", "0.58592916", "0.5856949", "0.5834091", "0.5819505", "0.57898766", "0.57857865", "0.5765628", "0.5743543", "0.5742023", "0.5731561", "0.57208276", "0.57075685", "0.5707364", "0.5704901", "0.5701029", "0.5692137", "0.56721693", "0.5643329", "0.56422925", "0.56332475", "0.5615885", "0.5608698", "0.55999863", "0.55994385", "0.55899197", "0.5579586", "0.55714726", "0.5568539", "0.5560823", "0.5548442", "0.5537782", "0.55347687", "0.5533871", "0.55199075", "0.5519621", "0.55189455", "0.5502484", "0.5495968", "0.54919463", "0.5491681", "0.54768425", "0.54674923", "0.54664373", "0.5448587", "0.5441857", "0.54387265", "0.5437172", "0.5418798", "0.5408408", "0.5405055", "0.5391731", "0.5386789", "0.53748333", "0.53744537", "0.53708434", "0.53701603", "0.53546166", "0.53444153", "0.5342912", "0.53380716", "0.5337862", "0.532327", "0.53218824", "0.5313653", "0.5312388", "0.5311902", "0.53036857", "0.52997625", "0.52955496", "0.52892303", "0.52863294", "0.528459", "0.52845025", "0.52820563", "0.5279967", "0.5279618", "0.52770174", "0.52716607", "0.52714205" ]
0.7044333
0
N Without this we can't close the connection when we have finished with it (so it might "leak")
def close() #N Without this check, we'll be trying to close the connection even if there isn't one, or it was already closed if @connection != nil #N Without this we won't get feedback about the SSH connection being closed puts "Closing SSH connection to #{user}@#{host} ..." #N Without this the connection won't actually get closed @connection.close() #N Without this we won't know the connection has been closed, because a nil @connection represents "no open connection" @connection = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_connection; end", "def connection_closed\n end", "def close_connection\n @connection.finish\n end", "def disconnect; @connection.close end", "def connection_closed\n close\n end", "def close\n connection.close if connection\n end", "def close_connection_after_writing\n\t\tclose_connection true\n\tend", "def close\n close_connection_after_writing\n end", "def close\n if self.conn && !self.conn.closed?\n self.conn.shutdown\n self.conn.close\n end\n\n self.conn = nil\n end", "def close\n @conn.close\n super\n end", "def close\n\t\[email protected]\n\tend", "def close\n @connection.close\n end", "def close\n @connection.close\n end", "def close\n @conn.disconnect\n end", "def close\n @mutex.synchronize { @conn.close }\n end", "def close\n @mutex.synchronize { @conn.close }\n end", "def close\n return if @conn.nil?\n @conn.close\n @conn = nil\n end", "def disconnect!\n super\n @raw_connection&.close\n @raw_connection = nil\n end", "def close\n connection.close\n end", "def finish\n disconnect_read_pool!\n end", "def disconnect\n @conn.close\nend", "def terminate_connection\n @intentionally_closed = true\n close_connection\n end", "def close\n @conn.close if @conn && [email protected]?\n @conn = nil\n end", "def close\r\n\t\[email protected]\r\n\tend", "def close\n @connection.close\n end", "def close\n @connection.close\n end", "def close\n close_connection(CLOSED, true)\n end", "def finish\n release_read_pool_connection\n end", "def connection_status_done; end", "def close\n @conn.close\n end", "def close\n if @connection\n @connection.close unless @connection.closed?\n end\n @connection = nil\n end", "def close()\n @connection.disconnect\n @connection = nil\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect!\n super\n @connection.close rescue nil\n end", "def close_connection\n @connection.close\n end", "def close()\n\t\[email protected]\n\t\t@connection = nil\n\tend", "def wait_connection; end", "def wait_connection; end", "def __close_connections\n # to be implemented by specific transports\n end", "def disconnected?; connection_state == :disconnected end", "def raw_connection; end", "def read_more( connection ); end", "def state_done\n close_connection_after_writing\n end", "def close\n\t\t\[email protected]\n\t\tend", "def without_reconnect(&block); end", "def disconnect!\n @connection.close rescue nil\n end", "def close_connection()\n super()\n puts \"#{self} close_connection done!\"\n end", "def close_connection()\n super()\n puts \"#{self} close_connection done!\"\n end", "def start_closing\n close_connection_after_writing\n end", "def finalize\n @server.close if @server\n end", "def disconnect; end", "def disconnect; end", "def disconnect!\n clear_cache!(new_connection: true)\n reset_transaction\n @raw_connection_dirty = false\n end", "def shutdown\n @conn.shutdown\n end", "def close_connection\n cls if connected?\n stop_read_loop\n stop_write_loop\n @socket.close if @socket\n @socket = nil\n @connected = false\n end", "def new_connection; end", "def close_read() end", "def close_read() end", "def close_read() end", "def connection_ended\n end", "def connection_ended\n end", "def disconnect!; end", "def destroy_connection\r\n\tbegin\r\n\t\[email protected] if @sock\r\n\tensure\r\n\t\t@connected=false\r\n\tend\r\n end", "def connection_completed\n\tend", "def disconnect\n super\n\n @transport.close rescue nil\n @transport = nil\n \n debug 'connections closed'\n end", "def network_connection_closed network\n emit :connection_close, network\n end", "def reset_connection\n #close if \n @socket_server = nil\n connect\n end", "def disconnect!\n retrieve_connection.close if @connection\n @connection = nil\n true\n end", "def closed?\n @connection.closed?\n end", "def test_connection\n @pool.hold {|conn|}\n true\n end", "def connection_completed\n end", "def disconnecting?; connection_state == :disconnecting end", "def closed?\n @connection.nil?\n end", "def _server_close_connection! in_stream, out_stream\n raise Error::SubclassResponsibility, \"_server_close_connection!\"\n end", "def finish\n @connections.each_value do |connection|\n begin\n connection.finish\n rescue Exception => e\n logger.error(\"Failed to close metadata http connection: #{e.backtrace.join(\"\\n\")}\")\n end\n end\n @connections = {}\n end", "def finish\n begin\n @socket.close\n rescue\n end\n on_disconnected\n end", "def closeConnections()\n #N Without this, the connections won't be closed\n @sshAndScp.close()\n end", "def conn_close(key)\n c = get_connection_by_key(key)\n c && c.close_connection_after_writing\n end", "def test_connection_closed?\n assert_equal false, @conn.closed?\n @conn.disconnect\n assert_equal true, @conn.closed?\n end", "def close_read(*) end", "def on_close(env)\n @connection.destroy if @connection\n end", "def closeDBConn()\n if ( !@db_conn.nil? )\n begin\n @db_conn.finish()\n rescue Exception => e\n #ignore it\n end\n end\n end", "def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end", "def close!\n\n\t @connected = false\n\t return nil\n\n\tend", "def connection_stale!\n log(:debug, :socket, 'connection is stale.')\n close_connection\n end", "def forceclose\n @sentConnect = false # set in connect()\n @signedOn=false # set in signOn() inside connect()\n @socket.close()\n @socket = nil\n @duz = \"0\"\n @currentContext = nil\n @lastvistaerror=nil\n return true\n end", "def testDoubleClose()\n conn = Scalaris::PubSub.new()\n conn.close_connection()\n conn.close_connection()\n end", "def test_double_close()\n rdht = Scalaroid::ReplicatedDHT.new()\n rdht.close_connection()\n rdht.close_connection()\n end", "def reset_connection!\n @@socket = nil\n end", "def force_close_connection\n destroy_transport\n connection.transition_state_machine :closed\n end", "def disconnect\r\n @connection.close_connection\r\n @connection = nil\r\n end", "def close\n inactive!\n close_connections\n end", "def disconnect!; true; end", "def closeConnections\n #N Without this the cached connections won't get closed\n @contentHost.closeConnections()\n end", "def destroy_connection\n begin\n @ssock.close if @ssock\n @rsock.close if @rsock\n ensure\n @connected=false\n end\n end", "def close(reason: T.unsafe(nil), reconnect: T.unsafe(nil)); end", "def disconnect\n @streams.each { |_, stream| try { stream.finalize } }\n @conn.Disconnect()\n end", "def term(conn)\r\n if conn\r\n begin\r\n conn.quit\r\n ensure\r\n conn.close\r\n\t \r\n end\r\n end\r\n exit\r\nend" ]
[ "0.7510732", "0.7180008", "0.7137829", "0.7107519", "0.7085904", "0.7050359", "0.69946563", "0.6952209", "0.69191736", "0.6900246", "0.68631774", "0.6840803", "0.6840803", "0.68220145", "0.67939407", "0.67939407", "0.6788303", "0.67876893", "0.6725066", "0.6717042", "0.6708632", "0.6692217", "0.66807735", "0.66764075", "0.66690844", "0.66690844", "0.66574115", "0.6654042", "0.66376853", "0.66274726", "0.66264", "0.6614505", "0.66110307", "0.66110307", "0.66110307", "0.66110307", "0.66075397", "0.66010153", "0.65937215", "0.6527204", "0.6527204", "0.646924", "0.6463642", "0.6441106", "0.6439295", "0.64310825", "0.63896084", "0.63752466", "0.6372492", "0.63647836", "0.63647836", "0.6349363", "0.6346351", "0.6344722", "0.6344722", "0.6344253", "0.6329684", "0.63239795", "0.6309236", "0.6298988", "0.6298988", "0.6298988", "0.62858254", "0.62858254", "0.6280681", "0.6271795", "0.625867", "0.62085897", "0.618595", "0.61803746", "0.6170358", "0.61641926", "0.61607975", "0.6148104", "0.61456376", "0.61425364", "0.6140454", "0.6126609", "0.61231005", "0.61203384", "0.6118773", "0.6118601", "0.61155224", "0.61043197", "0.609289", "0.608832", "0.6086913", "0.60860443", "0.6085252", "0.6080888", "0.60755205", "0.6071704", "0.6064886", "0.60642695", "0.60569304", "0.60563654", "0.60552084", "0.6054534", "0.6047174", "0.6038817", "0.6026526" ]
0.0
-1
execute command on remote host (if dryRun is false), yielding lines of output N Without this method, we can't execute SSH commands on the remote host, echoing the command first, and optionally executing the command (or optionally not executing it and just doing a "dry run")
def ssh(commandString, dryRun) #N Without this we won't have a description to display (although the value is only used in the next statement) description = "SSH #{user}@#{host}: executing #{commandString}" #N Without this the command description won't be echoed puts description #N Without this check, the command will execute even when it's only meant to be a dry run if not dryRun #N Without this, the command won't execute, and we won't have the output of the command outputText = connection.exec!(commandString) #N Without this check, there might be a nil exception, because the result of exec! can be nil(?) if outputText != nil then #N Without this, the output text won't be broken into lines for line in outputText.split("\n") do #N Without this, the code iterating over the output of ssh won't receive the lines of output yield line end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh(commandString, dryRun)\n #N Without this, command being executed won't be echoed to output\n puts \"SSH #{userAtHost} (#{shell.join(\" \")}): executing #{commandString}\"\n #N Without this check, the command will execute even it it's meant to be a dry run\n if not dryRun\n #N Without this, the command won't actually execute and return lines of output\n output = getCommandOutput(shell + [userAtHost, commandString])\n #N Without this loop, the lines of output won't be processed\n while (line = output.gets)\n #N Without this, the lines of output won't be passed to callers iterating over this method\n yield line.chomp\n end\n #N Without closing, the process handle will leak resources\n output.close()\n #N Without a check on status, a failed execution will be treated as a success (yielding however many lines were output before an error occurred)\n checkProcessStatus(\"SSH #{userAtHost} #{commandString}\")\n end\n end", "def ssh(commandString, dryRun = false)\n #N Without this, the command won't actually be executed\n sshAndScp.ssh(commandString, dryRun) do |line|\n #N Without this, this line of output won't be available to the caller\n yield line\n end\n end", "def ssh(commandString, dryRun = false)\n contentHost.sshAndScp.ssh(commandString, dryRun)\n end", "def executeCommand(command, dryRun)\n #N Without this, the command won't be echoed to the user\n puts \"EXECUTE: #{command}\"\n #N Without this check, the command will be executed, even though it is intended to be a dry run\n if not dryRun\n #N Without this, the command won't be executed (when it's not a dry run)\n system(command)\n #N Without this, a command that fails with error will be assumed to have completed successfully (which will result in incorrect assumptions in some cases about what has changed as a result of the command, e.g. apparently successful execution of sync commands would result in the assumption that the remote directory now matches the local directory)\n checkProcessStatus(command)\n end\n end", "def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end", "def execute(command)\n if remote?\n @remote.exec(command)\n else\n rays_exec(command)\n end\n end", "def executeCommand(command, dryRun)\n #N Without this, the command won't be echoed\n puts \"EXECUTE: #{command}\"\n #N Without this check, the command will be executed even if it is meant to be a dry run\n if not dryRun\n #N Without this, the command won't actualy be execute even when it is meant to be run\n system(command)\n #N Without this check, a failed command will be treated as if it had executed successfully\n checkProcessStatus(command)\n end\n end", "def remote_command command, options={}\n return unless running?\n returning({ :stdout => '', :stderr => '', :exit_status => nil }) do |output|\n remote_stdout, remote_stderr, exit_code = '', '', nil\n Net::SSH.start(public_ip, options[:user] || \"root\", {:paranoid => false}.merge(options)) do |connection|\n connection.open_channel do |channel|\n channel.on_data { |ch, data| output[:stdout] += data }\n channel.on_extended_data { |ch, type, data| output[:stderr] += data }\n channel.on_request(\"exit-status\") do |p, data|\n output[:exit_status] = data.read_long\n end\n channel.exec(command) do |ch, executing|\n raise \"Could not execute: #{command}\" unless executing\n end\n end\n end\n end\n end", "def execute(command, params={})\n unless params[:dry_run]\n if params[:return]\n System.execute(command, :return => true)\n else\n $stdout.puts\n System.execute(command)\n end\n end\n end", "def run(command)\n result = connection.exec!(command)\n puts \"[BEGIN #{@host}: #{command}]\"\n puts \" #{result}\"\n puts \"[END #{@host}: #{command}]\"\n end", "def exec(*args)\n command = args.shift\n\n arguments = Array.new\n arguments << %(sudo) if (@use_sudo == true)\n arguments << command\n arguments << args\n arguments = arguments.flatten.compact.join(' ')\n\n output = Array.new\n\n if @ssh.is_a?(ZTK::SSH)\n output << @ssh.exec(arguments, :silence => true, :ignore_exit_status => true).output\n else\n if @ssh.respond_to?(:exec!)\n output << @ssh.exec!(arguments)\n else\n raise SSHError, \"The object you assigned to ssh does not respond to #exec!\"\n end\n end\n\n output.join.strip\n end", "def execute!\n if Mcir::Core.instance.dryrun?\n Mcir::Core.instance.debug(\"CMD: \".purple << \"#{self.to_s.gsub(\"\\r\", \"\")}\")\n \"skipped execution due to dryrun\"\n else\n case @mode\n when :exec then exec(self.to_s)\n when :open then IO.new(self).open3\n when :capture then IO.new(self).capture3\n when :backticks then IO.new(self).backtick\n end\n end\n end", "def exec!(command, timeout=nil)\n logger.info(\"Executing: #{command}\")\n stderr,stdout = '', ''\n stdout, stderr = timeout_execution(timeout, \"exec!(#{command})\") do\n @connection_pool.exec(command)\n end\n logger.info(\"STDERR: #{stderr}\") unless stderr.empty?\n logger.info(\"STDOUT: #{stdout}\") unless stdout.empty?\n logger.info(\"Executing done\")\n stdout\n end", "def exec(command, options={})\n ssh.exec(command, options)\n end", "def exec(command, input = nil)\n result = command_results.build\n result.start! command, input\n exit_code = nil\n ssh_channel = @net_ssh.open_channel do |channel|\n channel.exec command do |_, success|\n if success\n channel.send_data input if input\n channel.eof!\n channel.on_data do |_, data|\n result.append_to_stdout! data\n end\n channel.on_extended_data do |_, type, data|\n result.append_to_stderr! data if type == :stderr\n end\n channel.on_request 'exit-status' do |_, data|\n exit_code = data.read_long\n end\n channel.on_request 'exit-signal' do |_, data|\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = data.read_long\n end\n else\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = 255\n channel.close\n end\n end\n end\n ssh_channel.wait\n result.completed! exit_code || 0\n end", "def ssh_exec!(ssh)\n output_data = ''\n exit_code = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.exec(@command) do |ch, success|\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\" unless success\n\n channel.on_data do |_, data|\n output_data += data\n yield data if block_given?\n end\n\n channel.on_extended_data do |_, type, data|\n output_data += data\n yield data if block_given?\n end\n\n channel.on_request('exit-status') { |_, data| exit_code = data.read_long }\n\n channel.on_request('exit-signal') { |_, data| exit_signal = data.read_long }\n end\n end\n\n ssh.loop\n [output_data, exit_code, exit_signal]\n end", "def ssh_exec!(ssh, command)\n stdout_data = ''\n stderr_data = ''\n exit_code = nil\n exit_signal = nil\n ssh.open_channel do |channel|\n channel.exec(command) do |_ch, success|\n unless success\n abort 'FAILED: couldn\\'t execute command (ssh.channel.exec)'\n end\n channel.on_data do |_ch, data|\n stdout_data += data\n puts stdout_data\n end\n\n channel.on_extended_data do |_ch, _type, data|\n stderr_data += data\n puts stderr_data\n end\n\n channel.on_request('exit-status') do |_ch, data|\n exit_code = data.read_long\n end\n\n channel.on_request('exit-signal') do |_ch, data|\n exit_signal = data.read_long\n end\n end\n end\n ssh.loop\n [stdout_data, stderr_data, exit_code, exit_signal]\nend", "def simple_ssh_command(host, user, command, timeout = 300)\n over_ssh(host: host, user: user, timeout: timeout) do |server|\n server.cd '/tmp'\n # Need to use sudo\n server.enable_sudo\n # scary...\n server.disable_safe_mode\n\n server.execute command\n end\n end", "def remote_shell args\n remote(args) do |ssh|\n command = true\n while command\n print \"> \"\n command = gets\n if command\n result = ssh.exec! command\n puts result.split(\"\\n\").awesome_inspect if not result.nil?\n end\n end\n ssh.exec! \"exit\"\n end\n end", "def ssh_exec_simple!(ssh, command, print_no_chain) \n out, err, exit_code = ssh_exec!(ssh, command, print_no_chain)\n abort err if exit_code != 0\n\n # try converting the output to prettified JSON.\n begin\n parsed = JSON.parse(out) \n return JSON.pretty_generate(parsed)\n rescue\n # otherwise, just return the string as-is.\n return out\n end\nend", "def execute(command, live_stream = false)\n machine = @chef_provisioning.connect_to_machine(name, @current_chef_server)\n machine.execute_always(command, stream: live_stream)\n end", "def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n sleep = opts.fetch(:sleep, 1)\n\n # Variable to store our execution result\n r = nil\n\n retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n raise LXC::Errors::ExecuteError, :command => command.inspect\n end\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n r.stdout.gsub(\"\\r\\n\", \"\\n\")\n end", "def execute_command(*argv)\n command = argv.flatten.reject(&:blank?).join(\" \\\\\\n \")\n if settings[:dry_run]\n log.info(\"Dry run:\")\n puts command\n else\n output = `#{command}`\n puts output unless output.empty?\n end\n end", "def execute(*command, &block)\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info('Exit code != 0, but interrupted. Ignoring.')\n else\n # If there was an error running command, show the error and the\n # output.\n raise VagrantPlugins::Parallels::Errors::ExecutionError,\n command: command.inspect,\n stderr: r.stderr\n end\n end\n r.stdout\n end", "def execute_ssh(commands)\n commands = [commands] unless commands.is_a? Array\n result = \"\"\n Net::SSH.start settings.remote_server, settings.remote_user do |ssh|\n commands.each do |command|\n was_error = false\n logger.info \"ssh: #{command}\"\n ssh.exec! command do |channel, stream, data|\n case stream\n when :stdout\n logger.info data\n result += \"#{data}\\n\" unless data.empty?\n when :stderr\n logger.error data\n was_error = true\n end\n end\n throw \"Exception during ssh, look in log file\" if was_error\n end\n end\n result\n end", "def execute!(command=nil)\n @command = command if command\n @result = \"\"\n if @ruby_impl\n # pure ruby implementation call\n rsh_ruby do |line|\n yield(line) if block_given?\n @result << line\n end\n else\n # OS'es rsh(1) call\n open \"|#{@executable} #{\"-n\" if @nullr} -l#{@ruser} -t#{@to} #{@host} #{@command}\" do |io|\n io.each do |line|\n yield(line) if block_given?\n @result << line\n end\n end\n end\n @result\n end", "def ssh_exec(command)\n stdout_data = ''\n stderr_data = ''\n exit_status = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.request_pty do |ch, success|\n raise 'Could not obtain pty' unless success\n\n ch.on_data do |ch, data|\n good_info data\n\n if data.match /sudo\\] password/\n unless ssh_options[:password]\n ssh_options[:password] = prompt(\"\\n<ROSH> Enter your password: \", false)\n end\n\n ch.send_data \"#{ssh_options[:password]}\\n\"\n ch.eof!\n end\n\n stdout_data << data\n end\n\n run_info(command)\n r = ch.exec(command)\n channel.close if r\n end\n\n channel.on_extended_data do |_, data|\n bad_info data.to_s\n stderr_data << data\n end\n\n channel.on_request('exit-status') do |_, data|\n exit_status = data.read_long\n end\n\n channel.on_request('exit-signal') do |_, data|\n exit_signal = data.read_long\n end\n end\n\n ssh.loop\n\n SSHResult.new(stdout_data, stderr_data, exit_status, exit_signal)\n end", "def execute_ssh_command(command)\n\t\tresult = ''\n\t\tNet::SSH.start(ip_string, settings.ssh[\"user\"]) do |ssh|\n\t\t\tresult = ssh.exec!(\"cmd /c #{command}\")\n\t\tend\n\t\tresult\n\tend", "def exec!(cmd)\n connect! unless @connected\n if using_ssh?\n logger.debug(\"ssh: \" + cmd)\n ssh_session.exec!(cmd)\n else\n logger.debug(cmd)\n `#{cmd}`\n end\n end", "def exec_cmd cmd\n t = Time.now\n results = \"\"\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch,success|\n unless success\n Logger.<<(__FILE__,\"INFO\",\"Could Not execute command #{cmd}\")\n abort\n end\n # stdout\n channel.on_data do |ch,data|\n results += data\n end\n # stderr\n channel.on_extended_data do |ch,type,data|\n Logger.<<(__FILE__,\"ERROR\",\"Error from the cmd #{cmd} : #{data}\")\n abort\n end\n channel.on_close do |ch|\n end\n end\n end\n # wait for the command to finish\n @ssh.loop\n Logger.<<(__FILE__,\"DEBUG\",\"SFTP Command executed in #{Time.now - t} sec\") if @opts[:v]\n results.split\n end", "def remote_command(command)\n return %x(ssh #{self.sar_host} \"#{command}\")\n end", "def runner_execute!(host, commands, options = {})\n result = host.execute commands, options\n if result && result[1] == :stdout\n Trooper.logger.info \"#{result[2]}\\n\"\n true\n else \n false\n end\n end", "def echo(s)\n\n instructions = 'echo ' + s\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n @results[:echo] = r.chomp\n\n end", "def command_send(command)\n\t\t# Check target\n\t\traise \"Target machine is not accessible\" if (!@config[\"ssh\"] or !@ip)\n\n\t\t# Prepare command\n\t\tcommand = command.gsub('\"', '\\\\\"')\n\t\tcommand = command.gsub('$', '\\\\$')\n\n\t\t# Execute and return result\n\t\t_ssh = `ssh -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" -t #{@config[\"ssh\"][\"username\"]}@#{@ip} \"#{command}\" 2>/dev/null`\n\t\treturn _ssh.strip\n\tend", "def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n sleep = opts.fetch(:sleep, 1)\n\n # Variable to store our execution result\n r = nil\n\n retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n raise LXC::Errors::SubprocessInterruptError, command.inspect\n else\n raise LXC::Errors::ExecuteError,\n command: command.inspect, stderr: r.stderr, stdout: r.stdout, exitcode: r.exit_code\n end\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n stdout = r.stdout.gsub(\"\\r\\n\", \"\\n\")\n if opts[:show_stderr]\n { :stdout => stdout, :stderr => r.stderr.gsub(\"\\r\\n\", \"\\n\") }\n else\n stdout\n end\n end", "def run_command(user, host, cmd)\n ping(user, host) do\n my_text = IO.popen(\"ssh #{user}@#{host} 'bash'\", \"w+\")\n my_text.write(cmd)\n my_text.close_write\n my_rtn = my_text.readlines.join('\\n')\n Process.wait(my_text.pid)\n my_text.close\n return my_rtn\n end\n end", "def ssh( commands=[], extra_ssh_ops={})\n commands = commands.compact.join(' && ') if commands.is_a?(Array)\n cmd_string = \"ssh #{user}@#{host} #{ssh_options(extra_ssh_ops)} \"\n if commands.empty?\n #TODO: replace this with a IO.popen call with read_nonblocking to show progress, and accept input\n Kernel.system(cmd_string)\n else\n system_run(cmd_string+\"'#{commands}'\")\n end\n end", "def remote_command(type, command, options)\n # If the VM is not running, then we can't run SSH commands...\n raise Errors::VMNotRunningError if @vm.state != :running\n\n # Initialize the result object, execute, and store the data\n result = OpenStruct.new\n result.stderr = \"\"\n result.stdout = \"\"\n result.exit_code = @vm.channel.send(type, command,\n :error_check => false) do |type, data|\n if type == :stdout\n result.stdout += data\n elsif type == :stderr\n result.stderr += data\n end\n\n # If we're echoing data, then echo it!\n if options[:echo]\n @vm.ui.info(data.to_s,\n :prefix => false,\n :new_line => false)\n end\n end\n\n # Return the result\n result\n end", "def exec(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t @ssh_session.open_channel do |ch|\n\t @@logger.info(\"Executing command '#{command}'\")\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.debug(\"Command sucessfully executed\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n end\n ch.on_close do |ch|\n @close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n @close_handler.call() unless @close_handler.nil?\n end\n\n ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"\")\n exit_status = 127\n end\n end\n\t ch.wait\n\t end\n\t\n\t return exit_status\n\tend", "def run!\n while @commands.length > 0\n command = @commands.shift\n puts command\n @run_success = run command unless @dry_run\n end \n end", "def run(*args)\n case args.size\n when 3\n ssh_host, ssh_user, ssh_command = args \n when 2\n ssh_host, ssh_command = args\n ssh_user = self.user\n when 1\n ssh_host, ssh_user = self.host, self.user\n ssh_command = args.first\n else\n raise ArgumentError\n end\n return ssh_host.map{|host| run(host, ssh_user, ssh_command)} if ssh_host.is_a? Array\n \n key = \"#{ssh_user}@#{ssh_host}\"\n puts \" #{key}$ #{ssh_command}\"\n @ssh_sessions[key] ||= Net::SSH.start(ssh_host, ssh_user)\n output = @ssh_sessions[key].exec!(ssh_command)\n puts output.split(\"\\n\").map{|l| \" #{key}> #{l}\"}.join(\"\\n\") if output\n output\n end", "def execute(task_family, ip, command)\n cmd = \"docker exec -i -t `#{docker_ps_task(task_family)}` #{command}\"\n Open3.popen2e(ssh_cmd(ip) + \" '#{cmd}' \") do |stdin, stdout, stderr, status_thread|\n stdout.each_line do |line|\n puts line\n end\n end\n end", "def ssh_execute(server, username, password, key, cmd)\n return lambda {\n exit_status = 0\n result = []\n\n params = {}\n params[:password] = password if password\n params[:keys] = [key] if key\n\n begin\n Net::SSH.start(server, username, params) do |ssh|\n puts \"Connecting to #{server}\"\n ch = ssh.open_channel do |channel|\n # now we request a \"pty\" (i.e. interactive) session so we can send data\n # back and forth if needed. it WILL NOT WORK without this, and it has to\n # be done before any call to exec.\n\n channel.request_pty do |ch_pty, success|\n raise \"Could not obtain pty (i.e. an interactive ssh session)\" if !success\n end\n\n channel.exec(cmd) do |ch_exec, success|\n puts \"Executing #{cmd} on #{server}\"\n # 'success' isn't related to bash exit codes or anything, but more\n # about ssh internals (i think... not bash related anyways).\n # not sure why it would fail at such a basic level, but it seems smart\n # to do something about it.\n abort \"could not execute command\" unless success\n\n # on_data is a hook that fires when the loop that this block is fired\n # in (see below) returns data. This is what we've been doing all this\n # for; now we can check to see if it's a password prompt, and\n # interactively return data if so (see request_pty above).\n channel.on_data do |ch_data, data|\n if data =~ /Password:/\n password = get_sudo_pw unless !password.nil? && password != \"\"\n channel.send_data \"#{password}\\n\"\n elsif data =~ /password/i or data =~ /passphrase/i or\n data =~ /pass phrase/i or data =~ /incorrect passphrase/i\n input = get_input_for_pw_prompt(data)\n channel.send_data \"#{input}\\n\"\n else\n result << data unless data.nil? or data.empty?\n end\n end\n\n channel.on_extended_data do |ch_onextdata, type, data|\n print \"SSH command returned on stderr: #{data}\"\n end\n\n channel.on_request \"exit-status\" do |ch_onreq, data|\n exit_status = data.read_long\n end\n end\n end\n ch.wait\n ssh.loop\n end\n if $debug\n puts \"==================================================\\nResult from #{server}:\"\n puts result.join\n puts \"==================================================\"\n end\n rescue Net::SSH::AuthenticationFailed\n exit_status = 1\n puts \"Bad username/password combination\"\n rescue Exception => e\n exit_status = 1\n puts e.inspect\n puts e.backtrace\n puts \"Can't connect to server\"\n end\n\n return exit_status\n }\n end", "def remote_command(command)\n socket = TCPSocket.new(@host, @port)\n socket.puts command\n\n data = \"\"\n until (line = socket.readline) =~ /END/\n data << line\n end\n\n socket.close\n data\n end", "def run(command)\n retried = false\n\n begin\n result = ssh_exec(command)\n Rosh::Shell::CommandResult.new(nil, result.exit_status, result.stdout, result.stderr)\n rescue StandardError => ex\n log \"Error: #{ex.class}\"\n log \"Error: #{ex.message}\"\n log \"Error: #{ex.backtrace.join(\"\\n\")}\"\n\n if ex.class == Net::SSH::AuthenticationFailed\n if retried\n bad_info 'Authentication failed.'\n else\n retried = true\n password = prompt(\"\\n<ROSH> Enter your password: \", false)\n ssh_options.merge! password: password\n log \"Password added. options: #{ssh_options}\"\n @ssh = new_ssh\n retry\n end\n end\n\n if ex.class == Net::SSH::Disconnect\n if retried\n bad_info 'Tried to reconnect to the remote host, but failed.'\n else\n log 'Host disconnected us; retrying to connect...'\n retried = true\n @ssh = new_ssh\n run(command)\n retry\n end\n end\n\n Rosh::Shell::CommandResult.new(ex, 1)\n end\n end", "def provision_execute(s, commands)\n errors = []\n return errors if (commands.nil? or commands.empty?)\n \n if (!get_field(\"cloud_ips\").nil? and !get_field(\"cloud_ips\").empty?)\n host = get_field(\"cloud_ips\")[0]\n elsif (!get_field(\"cloud_private_ips\").nil? and !get_field(\"cloud_private_ips\").empty?)\n host = get_field(\"cloud_private_ips\")[0]\n else\n msg = \"No IP address associated to the machine #{host} - cannot run SSH command\"\n errors << msg\n log_output(msg, :info)\n return errors\n end\n \n ssh_password = get_field('ssh_password')\n ssh_options = {}\n msg = \"Running SSH Commands On New Machine #{s.username}@#{host}\"\n msg_options = {}\n if (ssh_password and !ssh_password.empty?)\n ssh_options[:password] = ssh_password\n msg_options[:password] = \"*\" * ssh_password.size\n end\n msg_options[:private_key_path] = s.private_key_path if s.private_key_path\n msg_options[:private_key] = mask_private_key(s.private_key.strip) if s.private_key # show only last 5 chars\n log_output(\"#{msg} using #{msg_options}: #{commands.join(\", \")}\", :info)\n\n for i in 1..10\n begin\n log_output(\"[#{host}] Running Commands:\\n #{commands.join(\"\\n \")}\\n\")\n responses = s.ssh(commands, ssh_options) do |data, extended_data|\n write_output(data, :buffer => true) unless data.empty? #stdout\n write_output(extended_data, :buffer => true) unless extended_data.empty? #stderr\n end\n\n responses.each do |result|\n if result.status != 0\n msg = \"[#{host}] Command '#{result.command}' failed with status #{result.status}\"\n errors << msg\n log_output(msg, :info)\n end\n end unless responses.nil?\n break\n rescue Errno::EHOSTUNREACH, Timeout::Error, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Net::SSH::Disconnect => e\n log_output(\"[#{host}] Try #{i} - failed to connect: #{e}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"[#{host}] Try #{i} - failed to connect: authentication failed for user #{e.message}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts, authentication failed for user #{e.message}\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n end\n end\n return errors\n end", "def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend", "def run_command(cmd, *options, **shellout_options)\n so = Mixlib::ShellOut.new(create_command(cmd, *options), shellout_options)\n so.run_command\n so.error!\n so\n rescue Mixlib::ShellOut::ShellCommandFailed => e\n # Knife commands can include the password, so show a redacted version\n # of the command line along with the exit code, instead of the mixlib output\n pwd_index = options.index(\"--ssh-password\")\n options[pwd_index+1] = \"(hidden)\" if pwd_index && options.length > pwd_index+1\n redacted_cmd = create_command(cmd, options)\n message = \"#{redacted_cmd} returned #{so.exitstatus}\"\n if so.stderr\n message += \"\\n***********\\n\"\n message += so.stderr\n message += \"***********\\n\"\n end\n raise Runner::Exceptions::KnifeCommandFailed.new(message)\n end", "def exec(cmd)\n\t\tbegin\n\t\t\tout = cmd_exec(cmd).chomp\n\t\trescue ::Timeout::Error => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\trescue EOFError => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\tend\n\tend", "def execute(*command, &block)\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n raise Errors::VBoxManageError, :command => command.inspect\n end\n end\n\n # Return the output\n r.stdout\n end", "def dispatch(command, return_output = false)\n Vanagon::Utilities.remote_ssh_command(\"#{@target_user}@#{@target}\", command, @target_port, return_command_output: return_output)\n end", "def run( command, expected_exitcode = 0, sudo = self.uses_sudo? )\n\n cmd = {\n :command => command,\n :sudo => sudo,\n :stdout => String.new,\n :stderr => String.new,\n :expected_exitcode => Array( expected_exitcode ),\n :exitcode => nil,\n :final_command => sudo ? sprintf( 'sudo bash -c \"%s\"', command ) : command,\n }\n\n if @ssh.nil?\n self.connect_ssh_tunnel\n end\n\n @logger.info( sprintf( 'vm running: [%s]', cmd[:final_command] ) ) # TODO decide whether this should be changed in light of passthroughs.. 'remotely'?\n\n 0.upto(@retries) do |try|\n begin\n if self.is_passthrough? and self.passthrough[:type].eql?(:local)\n cmd[:stdout] = `#{cmd[:final_command]}`\n cmd[:exitcode] = $?\n else\n cmd = remote_exec( cmd )\n end\n break\n rescue => e\n @logger.error(sprintf('failed to run [%s] with [%s], attempt[%s/%s]', cmd[:final_command], e, try, retries)) if self.retries > 0\n sleep 10 # TODO need to expose this as a variable\n end\n end\n\n if cmd[:stdout].nil?\n cmd[:stdout] = \"error gathering output, last logged output:\\nSTDOUT: [#{self.get_ssh_stdout}]\\nSTDERR: [#{self.get_ssh_stderr}]\"\n cmd[:exitcode] = 256\n elsif cmd[:exitcode].nil?\n cmd[:exitcode] = 255\n end\n\n self.ssh_stdout.push( cmd[:stdout] )\n self.ssh_stderr.push( cmd[:stderr] )\n self.ssh_exitcode.push( cmd[:exitcode] )\n @logger.debug( sprintf( 'ssh_stdout: [%s]', cmd[:stdout] ) )\n @logger.debug( sprintf( 'ssh_stderr: [%s]', cmd[:stderr] ) )\n\n unless cmd[:expected_exitcode].member?( cmd[:exitcode] )\n # TODO technically this could be a 'LocalPassthroughExecutionError' now too if local passthrough.. should we update?\n raise RemoteExecutionError.new(\"stdout[#{cmd[:stdout]}], stderr[#{cmd[:stderr]}], exitcode[#{cmd[:exitcode]}], expected[#{cmd[:expected_exitcode]}]\")\n end\n\n cmd[:stdout]\n end", "def execute(command, options = { })\n defaults = { :out_console => true }\n options = defaults.merge(options)\n # open a new channel and configure a minimal set of callbacks, then run\n # the event loop until the channel finishes (closes)\n last_exit = -1\n channel = session.open_channel do |ch|\n\n #request pty for sudo stuff and so\n ch.request_pty do |ch, success|\n raise \"Error requesting pty\" unless success\n end\n \n ch.exec \"#{command}\" do |ch, success|\n raise \"could not execute command\" unless success\n\n\n # \"on_data\" is called when the process writes something to stdout\n ch.on_data do |c, data|\n STDOUT.print data if options[:out_console]\n\n end\n\n # \"on_extended_data\" is called when the process writes something to stderr\n ch.on_extended_data do |c, type, data|\n STDOUT.print data if options[:out_console]\n end\n\n channel.on_request(\"exit-signal\") do |ch, data|\n last_exit = data.read_long\n end\n\n channel.on_request(\"exit-status\") do |ch,data|\n last_exit = data.read_long\n end\n\n end\n end\n channel.wait\n last_exit\n end", "def call command_str, options={}, &block\n Sunshine.logger.info @host, \"Running: #{command_str}\" do\n execute build_remote_cmd(command_str, options), &block\n end\n end", "def shell_execute(connection, command, **opts)\n opts = {\n sudo: false,\n shell: nil\n }.merge(opts)\n\n sudo = opts[:sudo]\n shell = (opts[:shell] || machine_config_ssh.shell).to_s\n\n @logger.info(\"Execute: #{command} (sudo=#{sudo.inspect})\")\n exit_status = nil\n\n # Open the channel so we can execute or command\n channel = connection.open_channel do |ch|\n marker_found = false\n data_buffer = ''\n stderr_marker_found = false\n stderr_data_buffer = ''\n\n tfile = Tempfile.new('vagrant-ssh')\n remote_ext = shell == \"powershell\" ? \"ps1\" : \"bat\"\n remote_name = \"#{machine_config_ssh.upload_directory}\\\\#{File.basename(tfile.path)}.#{remote_ext}\"\n\n if shell == \"powershell\"\n base_cmd = \"powershell -File #{remote_name}\"\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nRemove-Item #{remote_name}\nWrite-Host #{CMD_GARBAGE_MARKER}\n[Console]::Error.WriteLine(\"#{CMD_GARBAGE_MARKER}\")\n#{command}\nSCRIPT\n else\n base_cmd = remote_name\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nECHO OFF\nECHO #{CMD_GARBAGE_MARKER}\nECHO #{CMD_GARBAGE_MARKER} 1>&2\n#{command}\nSCRIPT\n end\n\n tfile.close\n upload(tfile.path, remote_name)\n tfile.delete\n\n base_cmd = shell_cmd(opts.merge(shell: base_cmd))\n @logger.debug(\"Base SSH exec command: #{base_cmd}\")\n\n ch.exec(base_cmd) do |ch2, _|\n # Setup the channel callbacks so we can get data and exit status\n ch2.on_data do |ch3, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n\n if !marker_found\n data_buffer << data\n marker_index = data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(data_buffer)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stdout, data\n end\n end\n\n ch2.on_extended_data do |ch3, type, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stderr: #{data}\")\n if !stderr_marker_found\n stderr_data_buffer << data\n marker_index = stderr_data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n stderr_data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(stderr_data_buffer.lstrip)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stderr, data\n end\n end\n\n ch2.on_request(\"exit-status\") do |ch3, data|\n exit_status = data.read_long\n @logger.debug(\"Exit status: #{exit_status}\")\n\n # Close the channel, since after the exit status we're\n # probably done. This fixes up issues with hanging.\n ch.close\n end\n\n end\n end\n\n begin\n keep_alive = nil\n\n if @machine.config.ssh.keep_alive\n # Begin sending keep-alive packets while we wait for the script\n # to complete. This avoids connections closing on long-running\n # scripts.\n keep_alive = Thread.new do\n loop do\n sleep 5\n @logger.debug(\"Sending SSH keep-alive...\")\n connection.send_global_request(\"[email protected]\")\n end\n end\n end\n\n # Wait for the channel to complete\n begin\n channel.wait\n rescue Errno::ECONNRESET, IOError\n @logger.info(\n \"SSH connection unexpected closed. Assuming reboot or something.\")\n exit_status = 0\n pty = false\n rescue Net::SSH::ChannelOpenFailed\n raise Vagrant::Errors::SSHChannelOpenFail\n rescue Net::SSH::Disconnect\n raise Vagrant::Errors::SSHDisconnected\n end\n ensure\n # Kill the keep-alive thread\n keep_alive.kill if keep_alive\n end\n\n # Return the final exit status\n return exit_status\n end", "def run_command(machine, command, logger = @log)\n logger.info(\"Running command '#{command}' on the '#{machine['network']}' machine\")\n within_ssh_session(machine) do |connection|\n ssh_exec(connection, command, logger)\n end\n end", "def sh(command,options={},&block)\n sh_logger.debug(\"Executing '#{command}'\")\n\n stdout,stderr,status = execution_strategy.run_command(command)\n process_status = OptparsePlus::ProcessStatus.new(status,options[:expected])\n\n sh_logger.warn(\"stderr output of '#{command}': #{stderr}\") unless stderr.strip.length == 0\n\n if process_status.success?\n sh_logger.debug(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n call_block(block,stdout,stderr,process_status.exitstatus) unless block.nil?\n else\n sh_logger.info(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n sh_logger.warn(\"Error running '#{command}'\")\n end\n\n process_status.exitstatus\n rescue *exception_meaning_command_not_found => ex\n sh_logger.error(\"Error running '#{command}': #{ex.message}\")\n 127\n end", "def execute command, ignore_error=false\n @logger.debug command\n \n Open3.popen2e(command) do |stdin, stdout_err, wait_thr|\n while line = stdout_err.gets\n @logger.debug line\n end\n \n exit_status = wait_thr.value\n unless exit_status.success? || ignore_error == true\n raise \"Error executing command: #{command}\"\n end\n end\n end", "def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end", "def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end", "def execute_remote_command(server, cmd)\n ssh(server, cmd).status == 0\n end", "def exec(cmd)\n container.exec(cmd) { |_, chunk| puts \"#{fqdn.purple}: #{chunk}\" }\n end", "def ssh_exec!(ssh, command)\n\n stdout_data = \"\"\n stderr_data = \"\"\n exit_code = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.exec(command) do |ch, success|\n unless success\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\"\n end\n channel.on_data do |ch,data|\n stdout_data+=data\n end\n\n channel.on_extended_data do |ch,type,data|\n stderr_data+=data\n end\n\n channel.on_request(\"exit-status\") do |ch,data|\n exit_code = data.read_long\n end\n\n channel.on_request(\"exit-signal\") do |ch, data|\n exit_signal = data.read_long\n end\n end\n end\n ssh.loop\n\n {\n :out => stdout_data,\n :err => stderr_data,\n :exit_code => exit_code,\n :exit_signal => exit_signal\n }\n end", "def execute\n begin\n rout, wout = IO.pipe\n rerr, werr = IO.pipe\n stdout, stderr = nil\n\n pid = Process.spawn(command_line, :pgroup => true, :out => wout, :err => werr)\n Timeout.timeout(timeout) do\n Process.wait(pid)\n\n wout.close\n werr.close\n\n stdout = rout.readlines.join\n stderr = rerr.readlines.join\n end\n rescue Timeout::Error\n Process.kill(-9, pid)\n Process.detach(pid)\n ensure\n wout.close unless wout.closed?\n werr.close unless werr.closed?\n\n rout.close\n rerr.close\n end\n stdout\n end", "def run(host, command, options = {})\n execute(__method__, host, command, options)\n end", "def exec(command)\n ensure_mode(:privileged)\n run(command)\n end", "def send_command(command)\n begin\n @ssh_connect.exec!(command)\n rescue Exception => error\n @log.error(\"#{error}\")\n end\n end", "def exec(cmd, done_string = nil, stdin = nil)\n error_buffer = \"\"\n output_buffer = \"\"\n status = 0\n signal = nil\n header = \"#{self.class}##{__method__}\"\n\n # If passwordless sudo is true then prepend every command with 'sudo'.\n cmd = 'sudo ' + cmd if @passwordless_sudo\n\n run_session do |ssh|\n ssh.open_channel do |channel|\n channel.exec(cmd) do |chan, success|\n raise \"#{header} - Could not execute command #{cmd}\" unless success\n\n $log&.debug(\"#{header} - Command: #{cmd} started.\")\n\n if stdin.present?\n chan.send_data(stdin)\n chan.eof!\n end\n\n channel.on_data do |_channel, data|\n $log&.debug(\"#{header} - STDOUT: #{data}\")\n output_buffer << data\n data.each_line { |l| return output_buffer if done_string == l.chomp } unless done_string.nil?\n end\n\n channel.on_extended_data do |_channel, _type, data|\n $log&.debug(\"#{header} - STDERR: #{data}\")\n error_buffer << data\n end\n\n channel.on_request('exit-status') do |_channel, data|\n status = data.read_long || 0\n $log&.debug(\"#{header} - STATUS: #{status}\")\n end\n\n channel.on_request('exit-signal') do |_channel, data|\n signal = data.read_string\n $log&.debug(\"#{header} - SIGNAL: #{signal}\")\n end\n\n channel.on_eof do |_channel|\n $log&.debug(\"#{header} - EOF RECEIVED\")\n end\n\n channel.on_close do |_channel|\n $log&.debug(\"#{header} - Command: #{cmd}, exit status: #{status}\")\n if signal.present? || status.nonzero? || error_buffer.present?\n raise \"#{header} - Command '#{cmd}' exited with signal #{signal}\" if signal.present?\n raise \"#{header} - Command '#{cmd}' exited with status #{status}\" if status.nonzero?\n raise \"#{header} - Command '#{cmd}' failed: #{error_buffer}\"\n end\n return output_buffer\n end\n end # exec\n end # open_channel\n ssh.loop\n end # run_session\n end", "def run_command(*args, &blk)\n debug \"run_command\"\n \n cmd, args = prep_args(*args)\n \n #p [:run_command, cmd, blk.nil?]\n \n connect if !@rye_ssh || @rye_ssh.closed?\n raise Rye::NotConnected, @rye_host unless @rye_ssh && !@rye_ssh.closed?\n \n cmd_clean = Rye.escape(@rye_safe, cmd, args)\n \n # This following is the command we'll actually execute. cmd_clean\n # can be used for logging, otherwise the output is confusing.\n cmd_internal = prepend_env(cmd_clean)\n \n # Add the current working directory before the command if supplied. \n # The command will otherwise run in the user's home directory.\n if @rye_current_working_directory\n cwd = Rye.escape(@rye_safe, 'cd', @rye_current_working_directory)\n cmd_internal = '(%s; %s)' % [cwd, cmd_internal]\n end\n \n # ditto (same explanation as cwd)\n if @rye_current_umask\n cwd = Rye.escape(@rye_safe, 'umask', @rye_current_umask)\n cmd_internal = [cwd, cmd_internal].join(' && ')\n end\n \n ## NOTE: Do not raise a CommandNotFound exception in this method.\n # We want it to be possible to define methods to a single instance\n # of Rye::Box. i.e. def rbox.rm()...\n # can? returns the methods in Rye::Cmd so it would incorrectly\n # return false. We could use self.respond_to? but it's possible\n # to get a name collision. I could write a work around but I think\n # this is good enough for now. \n ## raise Rye::CommandNotFound unless self.can?(cmd)\n \n begin\n debug \"COMMAND: #{cmd_internal}\"\n\n if !@rye_quiet && @rye_pre_command_hook.is_a?(Proc)\n @rye_pre_command_hook.call(cmd_clean, user, host, nickname) \n end\n \n rap = Rye::Rap.new(self)\n rap.cmd = cmd_clean\n \n channel = net_ssh_exec!(cmd_internal, &blk)\n \n if channel[:exception]\n rap = channel[:exception].rap\n else\n rap.add_stdout(channel[:stdout].read || '')\n rap.add_stderr(channel[:stderr].read || '')\n rap.add_exit_status(channel[:exit_status])\n rap.exit_signal = channel[:exit_signal]\n end\n \n debug \"RESULT: %s \" % [rap.inspect]\n \n # It seems a convention for various commands to return -1\n # when something only mildly concerning happens. (ls even \n # returns -1 for apparently no reason sometimes). Anyway,\n # the real errors are the ones that are greater than zero.\n raise Rye::Err.new(rap) if rap.exit_status != 0\n \n rescue Exception => ex\n return rap if @rye_quiet\n choice = nil\n @rye_exception_hook.each_pair do |klass,act|\n next unless ex.kind_of? klass\n choice = act.call(ex, cmd_clean, user, host, nickname)\n break\n end\n if choice == :retry\n retry\n elsif choice == :skip\n # do nothing\n elsif choice == :interactive && !@rye_shell\n @rye_shell = true\n previous_state = @rye_sudo\n disable_sudo\n bash\n @rye_sudo = previous_state\n @rye_shell = false\n elsif !ex.is_a?(Interrupt)\n raise ex, ex.message\n end\n end\n \n if !@rye_quiet && @rye_post_command_hook.is_a?(Proc)\n @rye_post_command_hook.call(rap)\n end\n \n rap\n end", "def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend", "def run_ssh(host, shell_command, ssh_timeout = 60)\n begin\n # define basic query\n ssh_query = {\n :ssh_host => host,\n :ssh_auth_type => :password, # password is set on ssh method (default per os during provisioning)\n :ssh_timeout => ssh_timeout,\n :ssh_debug => @debug,\n :ssh_command => shell_command\n }\n\n # instantiate the ssh method and pull the command status\n $evm.instantiate(SSH_INSTANCE_PATH + '?' + ssh_query.to_query)\n status = $evm.root['ssh_command_status']\n\n # pull and inspect our results if we succeeded\n if status\n results = $evm.root['ssh_results']\n return results\n else\n log(:error, \"run_ssh: Command #{shell_command} failed. Returning nil.\")\n return nil\n end\n rescue => err\n log(:error, \"run_ssh: Unable to run command: #{shell_command}. Returning nil.\")\n return nil\n end\nend", "def exec_command(command)\n log = ''\n puts \"\\n=> Executing \\\"#{command}\\\"\"\n log += \"\\n\\n=> Executing \\\"#{command}\\\"\\n\"\n Open3.popen2e(command) { |stdin, stdout_and_stderr, wait_thr|\n stdout_and_stderr.each {|line|\n puts line\n log += line\n }\n }\n return log\nend", "def execute_command(command)\n @stdin.puts command\n end", "def execute(command, ignore_failure = false)\n return Simp::Cli::ExecUtils::execute(command, ignore_failure, logger)\n end", "def run\n begin\n IO.popen(@cmd_line).read\n rescue\n @logger.error(\"Failed to execute command on #{@host}\")\n \"\"\n end\n end", "def shell_execute(connection, command, sudo=false)\n @logger.info(\"Execute: #{command} (sudo=#{sudo.inspect})\")\n exit_status = nil\n\n # Determine the shell to execute. If we are using `sudo` then we\n # need to wrap the shell in a `sudo` call.\n shell = @machine.config.ssh.shell\n shell = \"sudo -H #{shell}\" if sudo\n\n # Open the channel so we can execute or command\n channel = connection.open_channel do |ch|\n ch.exec(shell) do |ch2, _|\n # Setup the channel callbacks so we can get data and exit status\n ch2.on_data do |ch3, data|\n if block_given?\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stdout: #{data}\")\n yield :stdout, data\n end\n end\n\n ch2.on_extended_data do |ch3, type, data|\n if block_given?\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stderr: #{data}\")\n yield :stderr, data\n end\n end\n\n ch2.on_request(\"exit-status\") do |ch3, data|\n exit_status = data.read_long\n @logger.debug(\"Exit status: #{exit_status}\")\n end\n\n # Set the terminal\n ch2.send_data \"export TERM=vt100\\n\"\n\n # Output the command\n ch2.send_data \"#{command}\\n\"\n\n # Remember to exit or this channel will hang open\n ch2.send_data \"exit\\n\"\n\n # Send eof to let server know we're done\n ch2.eof!\n end\n end\n\n # Wait for the channel to complete\n channel.wait\n\n # Return the final exit status\n return exit_status\n end", "def sh (command, as: user, on: hosts, quiet: false, once: nil)\n self.once once, quiet: quiet do\n log.info \"sh: #{command}\", quiet: quiet do\n hash_map(hosts) do |host|\n host.sh command, as: as, quiet: quiet\n end\n end\n end\n end", "def remote\n log_and_exit read_template('help') if options.empty?\n \n # Attempts to run the specified command\n run_remote_command(options[0])\n end", "def rcon_exec(command)\n raise RCONNoAuthError unless @rcon_authenticated\n\n @rcon_socket.send RCONExecRequest.new(@rcon_request_id, command)\n @rcon_socket.send RCONTerminator.new(@rcon_request_id)\n\n response = []\n begin\n response_packet = @rcon_socket.reply\n if response_packet.is_a? RCONAuthResponse\n @rcon_authenticated = false\n raise RCONNoAuthError\n end\n response << response_packet.response\n end while response.size < 3 || response_packet.response.size > 0\n\n response.join('').strip\n end", "def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n Chef::Log.debug(\"RVM::Shell::ChefWrapper executing: \" +\n \"[#{wrapped_command(command)}]\")\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end", "def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n Chef::Log.debug(\"RVM::Shell::ChefWrapper executing: \" +\n \"[#{wrapped_command(command)}]\")\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end", "def cmd_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\n\t\t\t\tprin_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 #{cmd}: #{e.class} #{e}\")\n\t\tend\n\telse\n\t\tbegin\n print_status \"\\trunning command #{cmdexe}\"\n r = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => false})\n r.close\n rescue ::Exception => e\n print_status(\"Error Running Command #{cmd}: #{e.class} #{e}\")\n end\n\tend\nend", "def exec!(command, opts = {}, &block)\n # Options\n stdout = ''\n stderr = ''\n defaults = {\n :check_exit_status => true\n }\n \n opts = defaults.merge opts\n\n # First, set up the environment...\n if @env.size > 0\n command = (\n @env.map { |k,v| k.to_s.upcase + '=' + v } << command\n ).join(' ')\n end\n\n # Before execution, cd to cwd\n command = \"cd #{escape(@cwd)}; \" + command\n\n # Input redirection\n if opts[:from]\n command += \" <#{escape(opts[:from])}\"\n end\n\n # Output redirection\n if opts[:to]\n command += \" >#{escape(opts[:to])}\"\n end\n\n # After command, add a semicolon...\n unless command =~ /;\\s*\\z/\n command += ';'\n end\n\n # Then echo the exit status.\n command += ' echo $?; '\n\n\n # If applicable, wrap the command in a sudo subshell...\n if @sudo\n command = \"sudo -S -u #{@sudo} bash -c #{escape(command)}\"\n if @password\n opts[:stdin] = @password + \"\\n\" + opts[:stdin].to_s\n end\n end\n\n buffer = ''\n echoed = 0\n stderr_echoed = 0\n status = nil\n written = false\n\n # Run ze command with callbacks.\n # Return status.\n channel = ssh.open_channel do |ch|\n ch.exec command do |ch, success|\n raise \"could not execute command\" unless success\n\n # Handle STDOUT\n ch.on_data do |c, data|\n # Could this data be the status code?\n if pos = (data =~ /(\\d{1,3})\\n\\z/)\n # Set status\n status = $1\n\n # Flush old buffer\n opts[:stdout].call(buffer) if opts[:stdout]\n stdout << buffer\n\n # Save candidate status code\n buffer = data[pos .. -1]\n\n # Write the other part of the string to the callback\n opts[:stdout].call(data[0...pos]) if opts[:stdout]\n stdout << data[0...pos]\n else\n # Write buffer + data to callback\n opts[:stdout].call(buffer + data) if opts[:stdout]\n stdout << buffer + data\n buffer = ''\n end\n \n if opts[:echo] and echoed < stdout.length\n stdout[echoed..-1].split(\"\\n\")[0..-2].each do |fragment|\n echoed += fragment.length + 1\n log fragment\n end\n end\n end\n\n # Handle STDERR\n ch.on_extended_data do |c, type, data|\n # STDERR\n if type == 1\n # Callback\n opts[:stderr].call(data) if opts[:stderr]\n\n # Accrue in stderr string\n stderr << data\n\n # Play forward any unwritten lines\n if opts[:echo] and stderr_echoed < stderr.length\n stderr[stderr_echoed..-1].split(\"\\n\")[0..-2].each do |fragment|\n stderr_echoed += fragment.length + 1\n log :stderr, fragment\n end\n end\n end\n end\n \n # Write stdin\n if opts[:stdin]\n ch.on_process do\n unless written\n ch.send_data opts[:stdin]\n written = true\n else\n # Okay, we wrote stdin\n unless block or ch.eof?\n ch.eof!\n end\n end\n end\n end\n\n # Handle close\n ch.on_close do\n if opts[:echo]\n # Echo last of input data\n stdout[echoed..-1].split(\"\\n\").each do |fragment|\n echoed += fragment.length + 1\n log fragment\n end\n\n # Last of stderr\n stderr[stderr_echoed..-1].split(\"\\n\").each do |fragment|\n echoed += fragment.length + 1\n log :stderr, fragment\n end\n end\n end\n end\n end\n \n if block\n # Run the callback\n callback_thread = Thread.new do\n if opts[:stdin]\n # Wait for stdin to be written before calling...\n until written\n sleep 0.1\n end\n end\n\n block.call(channel)\n end\n end\n\n # Wait for the command to complete.\n channel.wait\n\n # Let the callback thread finish as well\n callback_thread.join if callback_thread\n\n if opts[:check_exit_status]\n # Make sure we have our status.\n if status.nil? or status.empty?\n raise \"empty status in host#exec() for #{command}, hmmm\"\n end\n\n # Check status.\n status = status.to_i\n if status != 0\n raise \"#{command} exited with non-zero status #{status}!\\nSTDERR:\\n#{stderr}\\nSTDOUT:\\n#{stdout}\"\n end\n end\n\n stdout.chomp\n end", "def !(*commands)\n options = commands.last.is_a?(Hash) ? commands.pop : {}\n\n commands.unshift(\"cd #{options[:base_path]}\") if options[:base_path]\n\n ssh_command = ssh_command(commands, config)\n\n log(:info, ssh_command)\n\n clear_inject\n response = nil\n\n if options.fetch(:interactive, false)\n response = system(ssh_command)\n else\n response = `#{ssh_command}`\n end\n log(:debug, \"SSH Response: #{response.to_s}\")\n\n response\n end", "def remote_exec(cmd)\n req = JsonRequest.new(\"remote_exec:exec\", [@agent_id, cmd])\n res = Bixby.client.exec_api(req)\n assert res\n assert_kind_of JsonResponse, res\n assert res.success?\n\n cr = CommandResponse.from_json_response(res)\n assert cr\n assert cr.success?, \"remote exec should succeed\"\n cr\n end", "def run_ssh_command(ssh_command, loops = 5, command_delay = 5)\n result = ''\n done = true\n (0...loops).each do\n begin\n Net::SSH.start(get_access_ip, 'ubuntu', keys: @aws_setup_information[@environment.to_sym][:keyPath]) do |ssh|\n result = ssh.exec!(ssh_command).to_s\n end\n rescue StandardError\n done = false\n sleep command_delay\n end\n break if done\n end\n result\n end", "def execute_command(cmd, verbose = true)\n puts \"Executing: #{cmd}\" if verbose\n cmd += \" > /dev/null 2>&1\" if verbose\n %x[#{cmd}]\n success = $?.success?\n puts success if verbose\n success\n end", "def execute_command(command)\n raw(*command)\n end", "def run_command_for_host\n ready_to_open_host_session do |spawn_cmd|\n open_interactive_process(spawn_cmd) do\n before_run_command\n run_command\n end\n end\n end", "def verbose_command(c)\n raise \"executor already shows all commands, maybe use `quiet` ?\" if @verbose\n print_and_execute c, resolve: false\n end", "def psexec(host, command)\n exec = \"psexec \\\\\\\\#{Array(host).join ','}\"\n if @options[:user]\n exec << \" -u \\\"#{@options[:user]}\\\"\"\n @options[:password] = ask(\"--> Enter password for #{@options[:user]}@#{host}: \") {|q| q.echo = '*'} unless @options[:password]\n exec << \" -p \\\"#{@options[:password]}\\\"\"\n end\n exec << \" /accepteula\"\n exec << \" cmd /c \\\"#{command}\\\"\"\n exec << ' > NUL 2>&1' unless logger.debug?\n logger.debug \"--> #{exec}\"\n system exec\n raise \"Failed to execute command \\\"#{command}\\\" on host: #{host}\" if $?.to_i != 0\n end", "def execute\n parse_command\n run_command(command)\n end", "def run_command(command, quiet=false)\n log_stdout \"Executing command: #{command}\", quiet\n out, _, _ = guestcontrol_exec \"cmd.exe\", \"cmd.exe /c \\\"#{command}\\\"\"\n out\n end", "def exec(command)\n cmd = Open3.popen3(command) do |i, o, e|\n i.close\n t0 = Thread.new do\n o.each_line do |line|\n $stdout.puts \" \" << line\n end\n end\n t1 = Thread.new do\n e.each_line do |line|\n $stderr.puts \" \" << line\n end\n end\n t0.join\n t1.join\n end\n end", "def execute(*cmd)\n yield \"$ #{cmd.join(' ')}\" if block_given?\n output = ''\n\n Open3.popen2e(*cmd) do |_stdin, stdout_err, wait_thread|\n loop do\n line = stdout_err.gets\n break unless line\n\n output << line\n yield line if block_given?\n end\n\n exit_status = wait_thread.value\n raise ExecutionError, \"#{cmd.join(' ')} failed\" unless exit_status.success?\n end\n output\n end", "def ssh_cmd(cmd, attempts=3)\n attempts ||= 1\n conn = get_ssh_connection\n cmd = [cmd] unless cmd.is_a? Array\n result = nil\n cmd.each do |c|\n failures = 0\n begin\n result = conn.exec! c\n rescue\n failures += 1\n raise if failures >= attempts\n output \"Command \\\"#{c}\\\" failed, re-trying after delay\"\n sleep(failures)\n retry\n end\n end\n save_ssh_connection conn\n return result\n end", "def exec(command, &block); end", "def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n # Variable to store our execution result\n r = nil\n\n retryable(on: Vagrant::Errors::VBoxManageError, tries: tries, sleep: 1) do\n # If there is an error with VBoxManage, this gets set to true\n errored = false\n\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n errored = true\n end\n end\n\n # If there was an error running VBoxManage, show the error and the\n # output.\n if errored\n raise Vagrant::Errors::VBoxManageError,\n command: command.inspect,\n stderr: r.stderr,\n stdout: r.stdout\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n r.stdout.gsub(\"\\r\\n\", \"\\n\")\n end", "def ssh(host, user_name, *commands)\n global_cmd = \"ssh #{SSH_OPTIONS} #{user_name}@#{host} \\\"#{commands.join(';echo -;')}\\\"\"\n @logger.info(\"[SystemGateway][ssh] Executing #{global_cmd}...\")\n out = `#{global_cmd}`\n\n # SSH command failures (host unreachable, authentication errors)\n if $?.to_i != 0\n @logger.error(\"[SystemGateway][ssh] Command terminated abnormally: #{$?}\")\n raise(SSHError)\n end\n\n @logger.info(\"[SystemGateway][ssh] Command ended. Output: #{out}\")\n out\n end", "def run_remote_command(command)\n # Finds the remote ip and stores it in \"remote_ip\"\n parse_remote_ip\n \n # Finds the remote ip and stores it in \"remote_app_name\"\n parse_remote_app_name\n \n begin\n remote_command(command)\n rescue Net::SSH::AuthenticationFailed\n HighLine.track_eof = false\n password = ask(\"Enter your password: \") { |q| q.echo = '' }\n remote_command(command, password)\n end\n end" ]
[ "0.7706527", "0.7246989", "0.66088617", "0.65754145", "0.64343476", "0.6330856", "0.6329962", "0.6301226", "0.62073845", "0.61928236", "0.61751336", "0.6160614", "0.61470526", "0.61143106", "0.61039174", "0.6091824", "0.60885215", "0.60855305", "0.6029195", "0.6012004", "0.60100293", "0.6006853", "0.59555644", "0.59552085", "0.5952755", "0.59451586", "0.5945032", "0.5914934", "0.5905594", "0.58908105", "0.58875865", "0.588064", "0.5874714", "0.5860704", "0.5854781", "0.58426285", "0.58293045", "0.5823023", "0.5822986", "0.5821434", "0.5818474", "0.5805916", "0.5798956", "0.5791106", "0.576431", "0.57616514", "0.5747709", "0.57300776", "0.5721063", "0.57077557", "0.5705356", "0.5702909", "0.5701685", "0.56958807", "0.5686458", "0.56639844", "0.5655366", "0.56431955", "0.56225866", "0.56225866", "0.5607557", "0.55989766", "0.5588752", "0.5582844", "0.5582695", "0.5576644", "0.5574252", "0.5573883", "0.55725384", "0.55722576", "0.5567142", "0.5556706", "0.5552948", "0.5548861", "0.5546581", "0.55420697", "0.5536602", "0.5535237", "0.55226034", "0.5522139", "0.5522139", "0.5515575", "0.55108845", "0.5508554", "0.5506371", "0.5505735", "0.550456", "0.5495396", "0.5487274", "0.5485796", "0.5470218", "0.546212", "0.54608166", "0.54569936", "0.54550594", "0.5451288", "0.54490703", "0.54417926", "0.5439572", "0.543058" ]
0.76521194
1
copy a local directory to a remote directory (if dryRun is false) N Without this method there won't be an easy way to copy a local directory to a remote directory (optionally doing only a dry run)
def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun) #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback description = "SCP: copy directory #{sourcePath} to #{user}@#{host}:#{destinationPath}" #N Without this the user won't see the echoed description puts description #N Without this check, the files will be copied even if it is only meant to be a dry run. if not dryRun #N Without this, the files won't actually be copied. scpConnection.upload!(sourcePath, destinationPath, :recursive => true) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the directory\n executeCommand(\"#{@scpCommandString} -r #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the file\n executeCommand(\"#{@scpCommandString} #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy file #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the file will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the file won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath)\n end\n end", "def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend", "def cp_r(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n if File.directory?(s)\r\n fu_copy_dir s, d, '.', options[:preserve]\r\n else\r\n fu_p_copy s, d, options[:preserve]\r\n end\r\n end\r\n end", "def copy_dir(src, dest)\n output = `rsync -r --exclude='.svn' --exclude='.git' --exclude='.gitignore' --filter=':- .gitignore' 2>&1 #{Shellwords.escape(src.to_s)}/ #{Shellwords.escape(dest.to_s)}`\n [output, $?]\n end", "def rcp(opts)\n dest = opts[:d].name\n source = opts[:sp]\n dest_path = opts[:dp]\n\n # Grab a remote path for temp transfer\n tmpdest = tmppath\n\n # Do the copy and print out results for debugging\n cmd = \"scp -r '#{source}' #{dest}:#{tmpdest}\"\n output << bold(color(\"localhost$\", :green)) << \" #{cmd}\\n\"\n ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]\n ssh.scp.upload! source.to_s, tmpdest.to_s, :recursive => true\n\n # Now we move the file into their final destination\n result = shell(:n => opts[:d], :c => \"mv #{tmpdest} #{dest_path}\")\n result[:exit_code] == 0\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def remote_copy(from, to, sudo: false, owner: nil, group: nil)\n extra_opts = {}\n extra_opts[:sudo] = sudo if sudo\n extra_opts[:owner] = owner if owner\n extra_opts[:group] = group if group\n @calls << [:remote_copy, from, to] + (extra_opts.empty? ? [] : [extra_opts])\n @remote_copy_code&.call(@stdout_io, @stderr_io, self)\n end", "def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end", "def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end", "def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end", "def cp_dir(src, dst)\n puts \"#{cmd_color('copying')} #{dir_color(src)}\"\n puts \" -> #{dir_color(dst)}\"\n Find.find(src) do |fn|\n next if fn =~ /\\/\\./\n r = fn[src.size..-1]\n if File.directory? fn\n mkdir File.join(dst,r) unless File.exist? File.join(dst,r)\n else\n cp(fn, File.join(dst,r))\n end\n end\nend", "def cp(src, dest)\n unless dest.dirname.exist?\n LOG.info \"MKDIR: #{dest.dirname}\"\n FileUtils.mkdir_p(dest.dirname)\n end\n\n LOG.info \"COPY: #{src} #{dest}\"\n FileUtils.cp_r(src, dest)\n end", "def copy(src, dst)\n\t\t# TODO: make cp able to handle strings, where it will create an entry based\n\t\t# on the box it's run from.\n\t\t\n\t\tif !(src.kind_of?(Rush::Entry) && dst.kind_of?(Rush::Entry))\n\t\t\traise ArgumentError, \"must operate on Rush::Dir or Rush::File objects\"\n\t\tend\n\t\t\n\t\t# 5 cases:\n\t\t# 1. local-local\n\t\t# 2. local-remote (uploading)\n\t\t# 3. remote-local (downloading)\n\t\t# 4. remote-remote, same server\n\t\t# 5. remote-remote, cross-server\n\t\tif src.box == dst.box # case 1 or 4\n\t\t\tif src.box.remote? # case 4\n\t\t\t\tsrc.box.ssh.exec!(\"cp -r #{src.full_path} #{dst.full_path}\") do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # case 1\n\t\t\t\tFileUtils.cp_r(src.full_path, dst.full_path)\n\t\t\tend\n\t\telse # case 2, 3, or 5\n\t\t\tif src.local? && !dst.local? # case 2\n\t\t\t\t# We use the connection on the remote machine to do the upload\n\t\t\t\tdst.box.ssh.scp.upload!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telsif !src.local? && dst.local? # case 3\n\t\t\t\t# We use the connection on the remote machine to do the download\n\t\t\t\tsrc.box.ssh.scp.download!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telse # src and dst not local, case 5\n\t\t\t\tremote_command = \"scp #{src.full_path} #{dst.box.user}@#{dst.box.host}:#{dst.full_path}\"\n\t\t\t\t# doesn't matter whose connection we use\n\t\t\t\tsrc.box.ssh.exec!(remote_command) do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# TODO: use tar for cross-server transfers.\n\t\t# something like this?:\n\t\t# archive = from.box.read_archive(src)\n\t\t# dst.box.write_archive(archive, dst)\n\n\t\tnew_full_path = dst.dir? ? \"#{dst.full_path}#{src.name}\" : dst.full_path\n\t\tsrc.class.new(new_full_path, dst.box)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(to)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, from\n\tend", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil,\n dereference_root: true, remove_destination: nil)\n fu_output_message \"cp -r#{preserve ? 'p' : ''}#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_entry s, d, preserve, dereference_root, remove_destination\n end\n end", "def copy\n FileUtils.cp_r(@src, @dest)\n end", "def git_clone(remote, dest)\n Dir.chdir(__dir__) do\n system \"git clone #{remote} #{dest}\"\n end\nend", "def copy_folder(dir_source, dir_dest)\n ftp = Net::FTP.new(@host)\n begin\n ftp.login(@user, @password)\n ftp.passive = @passive\n puts \"FTP => logged in, start copying #{dir_source} to #{dir_dest}...\"\n\n # create a tmp folder locally\n tmp_folder = 'tmp/ftp_sync'\n unless File.exist?(tmp_folder)\n FileUtils.mkdir tmp_folder\n end\n Dir.chdir tmp_folder\n\n # download whole folder\n ftp.chdir File.dirname(dir_source)\n target = File.basename(dir_source)\n download_folder(target, ftp)\n\n # upload to dest\n ftp.chdir dir_dest\n upload_folder(target, ftp)\n\n # TODO: delete local tmp folder\n Dir.chdir '..'\n FileUtils.rm_rf tmp_folder\n\n puts 'FTP => Copy finished.'\n end\n end", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend", "def copy_to!(dest)\n Pow(dest).parent.create_directory\n copy_to(dest)\n end", "def copy_dir(origin_path, dest_path)\n \n p origin_path if $DEBUG\n\n real_dir = get_non_linked_dir_path_for_path(origin_path)\n \n unless File.exist?(dest_path) and File.directory?(dest_path) then\n \n Dir.mkdir(dest_path)\n \n end\n \n Dir.foreach(real_dir) do |f|\n \n next if f == \".\" or f == \"..\"\n \n full_path= File.join(real_dir, f)\n \n #check if this is a hard link to a directory\n if File.exist?(full_path) and (not File.directory?(full_path)) and File.stat(full_path).nlink > @min_link_count then\n full_path = get_non_linked_dir_path_for_path(full_path)\n end\n \n if File.directory?(full_path) then\n copy_dir(full_path, File.join(dest_path, f))\n else\n \n if File.exist?(full_path) and not File.symlink?(full_path) then\n \n FileUtils.cp(full_path, dest_path)\n \n end\n \n end\n \n end\n \n nil\n \n end", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def copy_file(src_file, dest_file)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(dest_file)) unless File.directory?(File.dirname(dest_file))\n FileUtils.cp(ROOT_DIR.join(src_file), dest_file)\n end\n end", "def cp_r(dest)\n util.cp_r(path, dest)\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n cmd = self.class.curr_host == host ? cmd : \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"#{cmd}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n op = try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev ? 'mv' : 'cp -r'\n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ?\n \"#{op} #{local_path.shellescape} #{dst_path.shellescape}\" :\n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def rel_copy(full_src, rel_dest, opts={})\n \n dest_path = File.dirname(rel_dest)\n \n fname = Pathname.new(full_src).basename\n \n if !File.directory?(dest_path)\n cmd = \"mkdir -p #{dest_path}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end \n end\n \n cmd = \"cp #{full_src} #{dest_path}/#{fname}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end\n\nend", "def cp(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(cp -a -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end", "def unpack_to(dir)\n sh \"cp -R #{local_path} #{dir}\"\n end", "def rsync(local_folder, remote_destination, delete)\n @log.info(\"rsyncing folder '#{local_folder}' to '#{remote_destination}'...\")\n @process_runner.execute!(\"rsync --filter='P *.css' --filter='P apidocs' --filter='P cdn' --filter='P get-started' --partial --archive --checksum --compress --omit-dir-times --quiet#{' --delete' if delete} --chmod=Dg+sx,ug+rw,Do+rx,o+r --protocol=28 --exclude='.snapshot' #{local_folder}/ #{remote_destination}\")\n end", "def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def copy(destination, file, folder = './downloads')\n FileUtils.mkdir_p(File.dirname(\"#{destination}/#{file}\"))\n FileUtils.cp_r(\"#{folder}/#{file}\", \"#{destination}/#{file}\")\n end", "def copy_dir(source, dest)\n files = Dir.glob(\"#{source}/**\")\n mkdir_p dest\n cp_r files, dest\n end", "def cp(src, dest, preserve: nil, noop: nil, verbose: nil)\n fu_output_message \"cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_file s, d, preserve\n end\n end", "def put_r(local_dir, remote_dir)\n return false if !File.directory?(local_dir)\n upload_dir(local_dir, remote_dir)\n end", "def rsync(source, target, exclude = [], options = [], verbose = false)\n excludes = exclude.map {|e| \"--exclude=#{e} \"}\n host = source.split(/\\//)[2]\n port = 873\n\n # Make the target directory if it's not there.\n FileUtils.mkdir(target) if !File.directory?(target)\n\n begin\n raise Exception, \"Unable to connect to remote host #{source}\" unless port_open?(host, port)\n\n log(\"rsync #{options} #{excludes} #{source} #{target}\")\n\n if verbose\n puts \"RUNNING: rsync #{options} #{excludes} #{source} #{target}\"\n system \"rsync #{options} #{excludes} #{source} #{target}\"\n else\n `rsync #{options} #{excludes} #{source} #{target}`\n end\n\n rescue Errno::EACCES, Errno::ENOENT, Errno::ENOTEMPTY, Exception => e\n log(e.to_s)\n end\nend", "def copy_dir(src_dir, dest_dir = \"/\")\n # Copy all the files into the home directory\n source = Dir.glob(ROOT_DIR.join(name).join(\"*\").to_s)\n FileUtils.cp_r(source, @workdir_path.to_s)\n end", "def cp(srcpath,dstpath)\n FileUtils.cp_r(srcpath,dstpath)\n end", "def cp(path, dest)\n FileUtils.rm_rf(expand dest)\n if File.directory?(expand path)\n FileUtils.mkdir_p(expand dest)\n FileUtils.cp_r(expand(path), expand(dest))\n else\n FileUtils.mkdir_p(File.dirname(expand dest))\n FileUtils.cp(expand(path), expand(dest))\n end\n end", "def rsync_to_temp\n\t\tputs \"\\n=> copying to temp dir.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_src, @@dir_temp)\n\tend", "def cp_with_mkdir(src, dst, owner = nil, mode = nil)\n mkdir_if_necessary(File.dirname(dst))\n cp(src, dst, owner, mode)\n end", "def scp(src, dest, *opts)\n run \"scp #{Array.wrap(src).join(' ')} #{dest}\", *opts\n end", "def cp_r(source, dest)\n FileUtils.cp_r(source, dest)\n puts \" ✔ cp -R #{source} #{dest}\".colorize(:blue).bold\n end", "def update_copied_remote_file(file, copy)\n # the remote has a file that has been copied or moved from copy[file] to file.\n # file is also destination.\n src = copy[file]\n \n # If the user doen't even have the source, then we apparently renamed a directory.\n if !(working_changeset.include?(file2))\n directory nil, file, src, remote.flags(file)\n elsif remote.include? file2\n # If the remote also has the source, then it was copied, not moved\n merge src, file, file, flag_merge(src, file, src), false\n else\n # If the source is gone, it was moved. Hence that little \"true\" at the end there.\n merge src, file, file, flag_merge(src, file, src), true\n end\n end", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, src unless File.exist?(src)\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\tend", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, src\n\tend", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def doCopyOperations(sourceContent, destinationContent, dryRun)\n #N Without this loop, we won't copy the directories that are marked for copying\n for dir in sourceContent.dirs\n #N Without this check, we would attempt to copy those directories _not_ marked for copying (but which might still have sub-directories marked for copying)\n if dir.copyDestination != nil\n #N Without this, we won't know what is the full path of the local source directory to be copied\n sourcePath = sourceLocation.getFullPath(dir.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(dir.copyDestination.relativePath)\n #N Without this, the source directory won't actually get copied\n destinationLocation.contentHost.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n else\n #N Without this, we wouldn't copy sub-directories marked for copying of this sub-directory (which is not marked for copying in full)\n doCopyOperations(dir, destinationContent.getDir(dir.name), dryRun)\n end\n end\n #N Without this loop, we won't copy the files that are marked for copying\n for file in sourceContent.files\n #N Without this check, we would attempt to copy those files _not_ marked for copying\n if file.copyDestination != nil\n #N Without this, we won't know what is the full path of the local file to be copied\n sourcePath = sourceLocation.getFullPath(file.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(file.copyDestination.relativePath)\n #N Without this, the file won't actually get copied\n destinationLocation.contentHost.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end\n end\n end", "def push_dir(local_path,remote_path)\n debug_p(\"push_dir from #{local_path} to #{remote_path}\")\n begin\n @sftp_session.upload!(local_path,remote_path)\n rescue\n @ssh.exec!(\"rm -rf #{remote_path}\")\n retry\n end\n end", "def pull_dir(localpath, remotepath, options = {}, &block)\n connect! unless @connection\n @recursion_level += 1\n\n todelete = Dir.glob(File.join(localpath, '*'))\n \n tocopy = []\n recurse = []\n\n # To trigger error if path doesnt exist since list will\n # just return and empty array\n @connection.chdir(remotepath)\n\n @connection.list(remotepath) do |e|\n entry = Net::FTP::List.parse(e)\n \n paths = [ File.join(localpath, entry.basename), \"#{remotepath}/#{entry.basename}\".gsub(/\\/+/, '/') ]\n\n if entry.dir?\n recurse << paths\n elsif entry.file?\n if options[:since] == :src\n tocopy << paths unless File.exist?(paths[0]) and entry.mtime < File.mtime(paths[0]) and entry.filesize == File.size(paths[0])\n elsif options[:since].is_a?(Time)\n tocopy << paths unless entry.mtime < options[:since] and File.exist?(paths[0]) and entry.filesize == File.size(paths[0])\n else\n tocopy << paths\n end\n end\n todelete.delete paths[0]\n end\n \n tocopy.each do |paths|\n localfile, remotefile = paths\n unless should_ignore?(localfile)\n begin\n @connection.get(remotefile, localfile)\n log \"Pulled file #{remotefile}\"\n rescue Net::FTPPermError\n log \"ERROR READING #{remotefile}\"\n raise Net::FTPPermError unless options[:skip_errors]\n end\n end\n end\n \n recurse.each do |paths|\n localdir, remotedir = paths\n Dir.mkdir(localdir) unless File.exist?(localdir)\n pull_dir(localdir, remotedir, options, &block)\n end\n \n if options[:delete]\n todelete.each do |p|\n block_given? ? yield(p) : FileUtils.rm_rf(p)\n log \"Removed path #{p}\"\n end\n end\n \n @recursion_level -= 1\n close! if @recursion_level == 0\n rescue Net::FTPPermError\n close!\n raise Net::FTPPermError\n end", "def cp srcpath, dstpath\n end", "def copy(options)\n destination = copy_destination options\n to_path = join_paths @root_dir, destination\n to_path_exists = File.exist? to_path\n\n preserve_existing = false? options[:overwrite]\n\n copy_resource_to_path to_path, preserve_existing\n copy_pstore_to_path to_path, preserve_existing\n\n to_path_exists\n end", "def clone_file source, target, *opts\n cmd = ['cp']\n cmd << '-R' if opts.include? :recursive\n\n if RUBY_PLATFORM.include? 'darwin'\n sh *(cmd + ['-c', source, target]) do |ok|\n break if ok\n if Jekyll.env != 'production'\n $stderr.puts \"Cannot use file cloning, falling back to regular copying\"\n end\n sh *(cmd + [source, target])\n end\n else\n # macOS requires explicit clone argument for copy (see\n # above). Behavior on other platforms is uknown, except for Linux\n # where it occur automatically. Therefore, just doing copy should\n # be fine.\n sh *(cmd + [source, target])\n end\nend", "def cp_r(src,dst)\n src_root = Pathname.new(src)\n FileUtils.mkdir_p(dst, :verbose => VERBOSE) unless File.exists? dst\n Dir[\"#{src}/**/**\"].each do |abs_path|\n src_path = Pathname.new(abs_path)\n rel_path = src_path.relative_path_from(src_root)\n dst_path = \"#{dst}/#{rel_path.to_s}\"\n \n next if abs_path.include? '.svn'\n \n if src_path.directory?\n FileUtils.mkdir_p(dst_path, :verbose => VERBOSE)\n elsif src_path.file?\n FileUtils.cp(abs_path, dst_path, :verbose => VERBOSE)\n end\n end\nend", "def copy_site\n target_dir = File.join(@deploy_dir, @remote_path).sub(/\\/$/,'')\n FileUtils.cp_r @local + '/.', target_dir\n message = \"Site updated at: #{Time.now.utc}\"\n `git add --all .`\n `git commit -m \\\"#{message}\\\"`\n end", "def cp(src, dst, owner = nil, mode = nil)\n FileUtils.cp_r(src, dst, :preserve => true, :verbose => verbose?)\n if owner && !File.symlink?(dst) \n chown(dst, owner) \n end\n if mode\n chmod(dst, mode)\n end\n end", "def push_dir(localpath, remotepath)\n connect!\n \n Dir.glob(File.join(localpath, '**', '*')) do |f|\n f.gsub!(\"#{localpath}/\", '')\n local = File.join localpath, f\n remote = \"#{remotepath}/#{f}\".gsub(/\\/+/, '/')\n \n if File.directory?(local)\n @connection.mkdir remote rescue Net::FTPPermError\n log \"Created Remote Directory #{local}\"\n elsif File.file?(local)\n @connection.put local, remote\n log \"Pushed file #{remote}\"\n end\n end\n \n close!\n end", "def upload(locals, remote)\n # evaluate $env:temp on Windows\n real_remote = remote.to_s == \"\\$env:TEMP\\\\kitchen\" ? kitchen_temp : remote\n FileUtils.mkdir_p(real_remote)\n Array(locals).each do |local|\n FileUtils.cp_r(local, real_remote)\n end\n end", "def fetch\n log.info(log_key) { \"Copying from `#{source_path}'\" }\n\n create_required_directories\n FileSyncer.sync(source_path, project_dir, source_options)\n # Reset target shasum on every fetch\n @target_shasum = nil\n target_shasum\n end", "def pull(remote_path, local_path, delete)\n\n # load our sync data\n sync_data = load_sync_data(local_path)\n\n Net::SFTP.start(@remote_host,\n @remote_username,\n :password => @remote_password) do |sftp|\n\n pull_dir(sftp, remote_path, local_path, delete, sync_data)\n end\n\n # save our sync data\n save_sync_data(local_path, sync_data)\n end", "def cp(from_location, to_location)\n @client.file_copy(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end", "def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend", "def copy(dest, overwrite=false)\n @resource.copy(dest, overwrite)\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n recreate_dirs_cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n\n # recreate dirs anyway if local op\n if try_move && self.class.curr_host == host\n r = `#{recreate_dirs_cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n # if we can make mv command\n if try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev\n r = `mv #{local_path.shellescape} #{dst_path.shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n else\n local_path += '/' if File.stat(local_path).directory?\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"#{recreate_dirs_cmd} && ionice -c 2 -n 7 rsync\\\" #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n end", "def local_copy(source, target)\n FileUtils.mkpath(File.dirname(target))\n FileUtils.copy(source, \"#{target}.in_progress\")\n FileUtils.move(\"#{target}.in_progress\", target)\n end", "def cp_single_file_or_directory(options={})\n from = options[:from]\n from_path = expand_path(from)\n to = options[:to]\n if to.to_s =~ %r{(.*)/$}\n to = $1\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n end\n case\n when File.directory?(from_path)\n if to && to != '-'\n if File.exists?(to)\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n creating_to_directory = false\n else\n creating_to_directory = true\n end\n end\n if options[:recursive]\n Dir.glob(\"#{from_path}/**/*\") do |from_item|\n suffix = File.relative_path(from_item, :relative_to=>from_path)\n suffix = File.join(from, suffix) unless creating_to_directory\n target_dir = File.dirname(File.join(to, suffix))\n FileUtils.mkdir_p(target_dir)\n if File.directory?(from_item)\n new_directory = File.join(target_dir,File.basename(from_item))\n if File.exists?(new_directory)\n raise CopyToNonDirectory \"Can't copy directory #{from_item } to non-directory #{new_directory}\" \\\n unless File.directory?(new_directory)\n else\n FileUtils.mkdir(new_directory)\n end\n else\n cp_single_file(options.merge(:from=>from_item, :to=>target_dir + '/'))\n end\n end\n else\n if options[:tolerant]\n STDERR.puts \"cp: Skipping directory #{from}\" unless options[:quiet]\n else\n raise CopyDirectoryNonRecursive, \"Can't non-recursively copy directory #{from}\"\n end\n end\n when File.exists?(from_path)\n cp_single_file(options.merge(:from=>from_path))\n else\n raise CopyMissingFromFile, \"#{from} does not exist\"\n end\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n fu_preserve_attr(options[:preserve], s, d) {\r\n copy_file s, d\r\n }\r\n end\r\n end", "def copy_from_remote(remote_file, local_path)\n\t\tbegin\n\t\t\t@@logger.info { \"Copying file from #{remote_file} to #{local_path}\" }\n\t\t\t@ssh_session.scp.download!(remote_file, local_path)\n\t\t\treturn true\n\t\trescue => err\n\t\t\t@@logger.error { \"SCP failed: #{err.message}\" }\n\t\t\t@@logger.error { \"\\t #{err.backtrace}\" }\n\t\tend\n\tend", "def copy_with_path(src, dst, filename)\n FileUtils.mkdir_p(dst)\n FileUtils.cp(src, dst + filename)\nend", "def copy(dest_path, overwrite = false, depth = nil)\n NotImplemented\n end", "def copy(path, destination, options = {})\n opts = options.nil? ? {} : options.dup\n opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup\n opts[:headers]['Destination'] = destination\n execute('COPY', path, opts)\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n \n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ? \n \"cp -r #{src_path.shellescape} #{local_path.shellescape}\" : \n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def copyfile from, to\n FileUtils.mkdir_p File.dirname to\n cp from, to\n end", "def copy(url, dest, headers = {})\n headers['Destination'] = dest\n request(:copy, url, headers)\n end", "def safe_cp(from, to, owner, group, cwd = '', include_paths = [], exclude_paths = [])\n credentials = ''\n credentials += \"-o #{owner} \" if owner\n credentials += \"-g #{group} \" if group\n excludes = find_command_excludes(from, cwd, exclude_paths).join(' ')\n\n copy_files = proc do |from_, cwd_, path_ = ''|\n cwd_ = File.expand_path(File.join('/', cwd_))\n \"if [[ -d #{File.join(from_, cwd_, path_)} ]]; then \" \\\n \"#{dimg.project.find_path} #{File.join(from_, cwd_, path_)} #{excludes} -type f -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -D #{credentials} {} \" \\\n \"#{File.join(to, '$(echo {} | ' \\\n \"#{dimg.project.sed_path} -e \\\"s/#{File.join(from_, cwd_).gsub('/', '\\\\/')}//g\\\")\")}' \\\\; ;\" \\\n 'fi'\n end\n\n commands = []\n commands << [dimg.project.install_path, credentials, '-d', to].join(' ')\n commands.concat(include_paths.empty? ? Array(copy_files.call(from, cwd)) : include_paths.map { |path| copy_files.call(from, cwd, path) })\n commands << \"#{dimg.project.find_path} #{to} -type d -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -d #{credentials} {}' \\\\;\"\n commands.join(' && ')\n end", "def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end", "def transfer!\n write_password_file! unless local\n\n remote_path = remote_path_for(@package)\n\n create_remote_path!(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n if local\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ remote_path }'.\"\n run(\n \"#{ utility(:rsync) } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ File.join(remote_path, remote_file) }'\"\n )\n else\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ ip }'.\"\n run(\n \"#{ utility(:rsync) } #{ rsync_options } #{ rsync_port } \" +\n \"#{ rsync_password_file } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ username }@#{ ip }:#{ File.join(remote_path, remote_file) }'\"\n )\n end\n end\n\n ensure\n remove_password_file! unless local\n end", "def copy_back_from_temporary_clone(clone_dir)\n FileUtils.mkdir_p work_dir\n FileUtils.cp_r clone_dir, work_dir\n end", "def clone\n # We do the clone against the target repo using the `--reference` flag so\n # that doing a normal `git pull` on a directory will work.\n git \"clone --reference #{@cache.path} #{@remote} #{@full_path}\"\n git \"remote add cache #{@cache.path}\", :path => @full_path\n end", "def copy_file_if_missing(src, dest, opt={})\n unless File.exists? dest\n touch_directory File.dirname(dest), opt\n FileUtils.cp src, dest\n STDOUT.write \"Created #{dest.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n end", "def copy_with_path(src, dst)\n\tsrc_folder = File.basename(File.dirname(src))\n\tnewpath = (dst + src_folder)\n\tFileUtils.mkdir_p(newpath)\n \tFileUtils.cp(src, newpath)\nend", "def exec(src, dest, options={})\n @failures.synchronize do\n @failures.clear\n end\n rsync_cmd = command(src, dest, options)\n if options[:chdir]\n rsync_cmd = \"cd '#{options[:chdir]}'; #{rsync_cmd}\"\n end\n @logger.debug rsync_cmd if @logger\n ok = system(rsync_cmd)\n unless ok\n @failures.synchronize do\n @failures << {:source => src, :dest => dest, :options => options.dup}\n end\n end\n end", "def push(remote_path, local_path, delete)\n\n # load our sync data\n sync_data = load_sync_data(local_path)\n \n Net::SFTP.start(@remote_host,\n @remote_username,\n :password => @remote_password) do |sftp|\n\n push_dir(sftp, remote_path, local_path, delete, sync_data)\n end\n\n # save our sync data\n save_sync_data(local_path, sync_data)\n end", "def cp_to(filename, mounted_dest) # Always returns the destination as an explicit location relative to the mount directory\n dest = File.join(@mount_dir, mounted_dest )#, File.basename(filename))\n FileUtils.mkdir_p(dest)\n FileUtils.cp( filename, dest, :preserve => true)\n File.join(dest, File.basename(filename))\n end", "def cp_lr(src, dest, noop: nil, verbose: nil,\n dereference_root: true, remove_destination: false)\n fu_output_message \"cp -lr#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n link_entry s, d, dereference_root, remove_destination\n end\n end", "def upload_directory(local_dir, remote_path)\n Net::SFTP.start(HOSTNAME, USERNAME, :password => PASSWORD) do |sftp|\n dir_perm = 0755\n file_perm = 0644\n Find.find(local_dir) do |f|\n #next if f.include?('.part') or f.include?('.table') or f.include?('.sh') or f.include?('.rb') or f.include?('.csv')\n if File.stat(f).directory?\n begin\n remote_dir = remote_path + \"/\" + f\n sftp.stat!(remote_dir)\n rescue Net::SFTP::StatusException => e\n raise unless e.code == 2\n puts \"Creating remote directory #{remote_dir}\"\n sftp.mkdir(remote_dir, :permissions => dir_perm)\n end\n next\n end\n local_file = f\n remote_file = remote_path + \"/\" + local_file\n \n begin\n remote_dir = File.dirname(remote_file)\n sftp.stat!(remote_dir)\n rescue Net::SFTP::StatusException => e\n raise unless e.code == 2\n puts \"Creating remote directory #{remote_dir}\"\n sftp.mkdir(remote_dir, :permissions => dir_perm)\n end\n \n begin\n rstat = sftp.stat!(remote_file)\n rescue Net::SFTP::StatusException => e\n raise unless e.code == 2\n puts \"Copying #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n sftp.setstat(remote_file, :permissions => file_perm)\n next\n end\n \n if File.stat(local_file).mtime > Time.at(rstat.mtime + SERVER_TIME_OFFSET)\n puts \"Updating #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n end\n end\n end\n end", "def copy_remote_shared_cache_to_release_path\n logger.debug \"Copying the remote shared cache to release path\"\n run \"mkdir -p #{configuration[:release_path]} && cp -RPp #{revision_cache_dir}/* #{configuration[:release_path]}\"\n end", "def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end", "def copy(source, destination, **options); end", "def transfer!\n create_local_directories!\n\n files_to_transfer do |local_file, remote_file|\n Logger.message \"#{storage_name} started transferring '#{ local_file }'.\"\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end\n end", "def copy_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end", "def copy_to(path)\n raise CommandError, 'Destination exists' if File.exist?(expand path)\n FileUtils.mkdir_p(File.dirname(expand path))\n FileUtils.cp_r(@working_dir, expand(path))\n end" ]
[ "0.8446901", "0.8436639", "0.82682866", "0.80182594", "0.745539", "0.7195446", "0.6848897", "0.6643685", "0.6643246", "0.6632449", "0.6631437", "0.6595472", "0.65916073", "0.65916073", "0.6571246", "0.64980274", "0.6489907", "0.6474773", "0.64021623", "0.64021623", "0.6401248", "0.6400446", "0.6382293", "0.6350165", "0.6342819", "0.6342391", "0.63356495", "0.6287373", "0.62786", "0.6272674", "0.62448716", "0.62397593", "0.62345946", "0.62271637", "0.6220752", "0.6212789", "0.61980593", "0.61909163", "0.6183525", "0.6168257", "0.6166147", "0.61518663", "0.6107434", "0.6094802", "0.60910547", "0.6088091", "0.608198", "0.6080954", "0.6064782", "0.6038691", "0.60300446", "0.6025668", "0.60184973", "0.6016228", "0.6016228", "0.6015568", "0.60132873", "0.6007231", "0.5998786", "0.59967476", "0.5966797", "0.5964054", "0.5948698", "0.59345603", "0.59191346", "0.59174246", "0.58960986", "0.58950716", "0.58907056", "0.5883523", "0.58753717", "0.58699816", "0.58671236", "0.5858914", "0.5857379", "0.58375067", "0.5836323", "0.58317053", "0.58210814", "0.58189803", "0.5810419", "0.580538", "0.58007216", "0.58003706", "0.57892054", "0.57876813", "0.5787388", "0.5780778", "0.5756179", "0.5751937", "0.57206583", "0.5719631", "0.5711663", "0.571156", "0.57104623", "0.57093626", "0.5695166", "0.56939536", "0.5688383", "0.5680625" ]
0.7848379
4
copy a local file to a remote directory (if dryRun is false) N Without this method there won't be an easy way to copy a single local file to a remove directory (optionally doing only a dry run)
def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun) #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback description = "SCP: copy file #{sourcePath} to #{user}@#{host}:#{destinationPath}" #N Without this the user won't see the echoed description puts description #N Without this check, the file will be copied even if it is only meant to be a dry run. if not dryRun #N Without this, the file won't actually be copied. scpConnection.upload!(sourcePath, destinationPath) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the file\n executeCommand(\"#{@scpCommandString} #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the directory\n executeCommand(\"#{@scpCommandString} -r #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy directory #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the files will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the files won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath, :recursive => true)\n end\n end", "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def update_copied_remote_file(file, copy)\n # the remote has a file that has been copied or moved from copy[file] to file.\n # file is also destination.\n src = copy[file]\n \n # If the user doen't even have the source, then we apparently renamed a directory.\n if !(working_changeset.include?(file2))\n directory nil, file, src, remote.flags(file)\n elsif remote.include? file2\n # If the remote also has the source, then it was copied, not moved\n merge src, file, file, flag_merge(src, file, src), false\n else\n # If the source is gone, it was moved. Hence that little \"true\" at the end there.\n merge src, file, file, flag_merge(src, file, src), true\n end\n end", "def rcp(opts)\n dest = opts[:d].name\n source = opts[:sp]\n dest_path = opts[:dp]\n\n # Grab a remote path for temp transfer\n tmpdest = tmppath\n\n # Do the copy and print out results for debugging\n cmd = \"scp -r '#{source}' #{dest}:#{tmpdest}\"\n output << bold(color(\"localhost$\", :green)) << \" #{cmd}\\n\"\n ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]\n ssh.scp.upload! source.to_s, tmpdest.to_s, :recursive => true\n\n # Now we move the file into their final destination\n result = shell(:n => opts[:d], :c => \"mv #{tmpdest} #{dest_path}\")\n result[:exit_code] == 0\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n \n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ? \n \"cp -r #{src_path.shellescape} #{local_path.shellescape}\" : \n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n cmd = self.class.curr_host == host ? cmd : \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"#{cmd}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n op = try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev ? 'mv' : 'cp -r'\n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ?\n \"#{op} #{local_path.shellescape} #{dst_path.shellescape}\" :\n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def move_from_remote(remote_file, local_path)\n\t\tcopy_from_remote(remote_file, local_path)\n\t\tdelete_remote(remote_file)\n\tend", "def copy_file(src_file, dest_file)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(dest_file)) unless File.directory?(File.dirname(dest_file))\n FileUtils.cp(ROOT_DIR.join(src_file), dest_file)\n end\n end", "def copy_from_remote(remote_file, local_path)\n\t\tbegin\n\t\t\t@@logger.info { \"Copying file from #{remote_file} to #{local_path}\" }\n\t\t\t@ssh_session.scp.download!(remote_file, local_path)\n\t\t\treturn true\n\t\trescue => err\n\t\t\t@@logger.error { \"SCP failed: #{err.message}\" }\n\t\t\t@@logger.error { \"\\t #{err.backtrace}\" }\n\t\tend\n\tend", "def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil,\n dereference_root: true, remove_destination: nil)\n fu_output_message \"cp -r#{preserve ? 'p' : ''}#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_entry s, d, preserve, dereference_root, remove_destination\n end\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n if File.directory?(s)\r\n fu_copy_dir s, d, '.', options[:preserve]\r\n else\r\n fu_p_copy s, d, options[:preserve]\r\n end\r\n end\r\n end", "def update_remote_file(file, node, copy, copied_files)\n return if should_filter?(file) ||\n local_manifest[file] ||\n copied_files[file]\n \n if copy[file]\n # If it's been copied, then we might need to do some work.\n update_copied_remote_file file, copy\n elsif ancestor.include? file\n # If the ancestor has the file, and the target has the file, and we don't,\n # then we'll probably have to do some merging to fix that up.\n update_remotely_modified_file file, node\n else\n # Just get the god damned file\n get file, remote.flags(file)\n end\n end", "def local_copy_file(source, options = {})\n Uploadcare::File.local_copy(source, options)\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n recreate_dirs_cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n\n # recreate dirs anyway if local op\n if try_move && self.class.curr_host == host\n r = `#{recreate_dirs_cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n # if we can make mv command\n if try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev\n r = `mv #{local_path.shellescape} #{dst_path.shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n else\n local_path += '/' if File.stat(local_path).directory?\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"#{recreate_dirs_cmd} && ionice -c 2 -n 7 rsync\\\" #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def clone_file source, target, *opts\n cmd = ['cp']\n cmd << '-R' if opts.include? :recursive\n\n if RUBY_PLATFORM.include? 'darwin'\n sh *(cmd + ['-c', source, target]) do |ok|\n break if ok\n if Jekyll.env != 'production'\n $stderr.puts \"Cannot use file cloning, falling back to regular copying\"\n end\n sh *(cmd + [source, target])\n end\n else\n # macOS requires explicit clone argument for copy (see\n # above). Behavior on other platforms is uknown, except for Linux\n # where it occur automatically. Therefore, just doing copy should\n # be fine.\n sh *(cmd + [source, target])\n end\nend", "def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end", "def update_local_file(file, node, copy, copied_files)\n return if should_filter? file\n\n # Is the file also in the target changeset?\n if remote.include? file\n update_common_file file, node\n elsif copied_files[file]\n return\n elsif copy[file]\n update_locally_copied file, copy[file]\n elsif ancestor_manifest[file]\n update_remotely_deleted file, node\n else\n # Are we overwriting with empty data, or going backwards to when the\n # file didn't exist?\n if (overwrite? && node[20..-1] == \"u\") || (backwards? && node.size <= 20)\n remove file\n end\n end\n end", "def copy\n FileUtils.cp_r(@src, @dest)\n end", "def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend", "def upload_file local_source, remote_dest, options = {}\n add [local_source, remote_dest], check_file(remote_dest)\n chmod options[:perms], remote_dest if options[:perms]\n chown options[:owner], remote_dest if options[:owner]\n end", "def copy_file(source, destination)\n FileUtils.cp(source, destination)\n destination\n end", "def copy_file(source, destination)\n FileUtils.cp(source, destination)\n destination\n end", "def rsync(local_folder, remote_destination, delete)\n @log.info(\"rsyncing folder '#{local_folder}' to '#{remote_destination}'...\")\n @process_runner.execute!(\"rsync --filter='P *.css' --filter='P apidocs' --filter='P cdn' --filter='P get-started' --partial --archive --checksum --compress --omit-dir-times --quiet#{' --delete' if delete} --chmod=Dg+sx,ug+rw,Do+rx,o+r --protocol=28 --exclude='.snapshot' #{local_folder}/ #{remote_destination}\")\n end", "def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end", "def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end", "def copy_file(source_file, dest_file, settings)\n\tFileUtils.cp_r(source_file, dest_file)\nend", "def copy_file_if_missing(src, dest, opt={})\n unless File.exists? dest\n touch_directory File.dirname(dest), opt\n FileUtils.cp src, dest\n STDOUT.write \"Created #{dest.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n end", "def cp_r(dest)\n util.cp_r(path, dest)\n end", "def cp!( from_file, to_file, opts = {} )\r\n args = { :source => from_file, :destination => to_file }\r\n args[:source_address] = opts[:source_address] if opts[:source_address]\r\n \r\n begin\r\n got = @ndev.rpc.file_copy( args )\r\n rescue => e\r\n raise IOError, e.rsp.xpath('rpc-error/error-message').text.strip\r\n else\r\n return true\r\n end\r\n end", "def remote_copy(from, to, sudo: false, owner: nil, group: nil)\n extra_opts = {}\n extra_opts[:sudo] = sudo if sudo\n extra_opts[:owner] = owner if owner\n extra_opts[:group] = group if group\n @calls << [:remote_copy, from, to] + (extra_opts.empty? ? [] : [extra_opts])\n @remote_copy_code&.call(@stdout_io, @stderr_io, self)\n end", "def pull(remote_path, local_path, delete)\n\n # load our sync data\n sync_data = load_sync_data(local_path)\n\n Net::SFTP.start(@remote_host,\n @remote_username,\n :password => @remote_password) do |sftp|\n\n pull_dir(sftp, remote_path, local_path, delete, sync_data)\n end\n\n # save our sync data\n save_sync_data(local_path, sync_data)\n end", "def copy_file_to_remote(host, file_path, file_content)\n block_on host do |host|\n Tempfile.open 'beaker' do |tempfile|\n File.open(tempfile.path, 'w') { |file| file.puts file_content }\n\n host.do_scp_to(tempfile.path, file_path, @options)\n end\n end\n end", "def copy_file(path:, copy_destination:)\n BrickFTP::API::FileOperation::Copy.create(path: path, 'copy-destination': copy_destination)\n end", "def copy(destination, file, folder = './downloads')\n FileUtils.mkdir_p(File.dirname(\"#{destination}/#{file}\"))\n FileUtils.cp_r(\"#{folder}/#{file}\", \"#{destination}/#{file}\")\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def copy_file(path:, copy_destination:)\n BrickFTP::API::FileOperation::Copy.create(path: path, :'copy-destination' => copy_destination)\n end", "def cp(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(cp -a -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end", "def pull_dir(localpath, remotepath, options = {}, &block)\n connect! unless @connection\n @recursion_level += 1\n\n todelete = Dir.glob(File.join(localpath, '*'))\n \n tocopy = []\n recurse = []\n\n # To trigger error if path doesnt exist since list will\n # just return and empty array\n @connection.chdir(remotepath)\n\n @connection.list(remotepath) do |e|\n entry = Net::FTP::List.parse(e)\n \n paths = [ File.join(localpath, entry.basename), \"#{remotepath}/#{entry.basename}\".gsub(/\\/+/, '/') ]\n\n if entry.dir?\n recurse << paths\n elsif entry.file?\n if options[:since] == :src\n tocopy << paths unless File.exist?(paths[0]) and entry.mtime < File.mtime(paths[0]) and entry.filesize == File.size(paths[0])\n elsif options[:since].is_a?(Time)\n tocopy << paths unless entry.mtime < options[:since] and File.exist?(paths[0]) and entry.filesize == File.size(paths[0])\n else\n tocopy << paths\n end\n end\n todelete.delete paths[0]\n end\n \n tocopy.each do |paths|\n localfile, remotefile = paths\n unless should_ignore?(localfile)\n begin\n @connection.get(remotefile, localfile)\n log \"Pulled file #{remotefile}\"\n rescue Net::FTPPermError\n log \"ERROR READING #{remotefile}\"\n raise Net::FTPPermError unless options[:skip_errors]\n end\n end\n end\n \n recurse.each do |paths|\n localdir, remotedir = paths\n Dir.mkdir(localdir) unless File.exist?(localdir)\n pull_dir(localdir, remotedir, options, &block)\n end\n \n if options[:delete]\n todelete.each do |p|\n block_given? ? yield(p) : FileUtils.rm_rf(p)\n log \"Removed path #{p}\"\n end\n end\n \n @recursion_level -= 1\n close! if @recursion_level == 0\n rescue Net::FTPPermError\n close!\n raise Net::FTPPermError\n end", "def copy(src, dst)\n\t\t# TODO: make cp able to handle strings, where it will create an entry based\n\t\t# on the box it's run from.\n\t\t\n\t\tif !(src.kind_of?(Rush::Entry) && dst.kind_of?(Rush::Entry))\n\t\t\traise ArgumentError, \"must operate on Rush::Dir or Rush::File objects\"\n\t\tend\n\t\t\n\t\t# 5 cases:\n\t\t# 1. local-local\n\t\t# 2. local-remote (uploading)\n\t\t# 3. remote-local (downloading)\n\t\t# 4. remote-remote, same server\n\t\t# 5. remote-remote, cross-server\n\t\tif src.box == dst.box # case 1 or 4\n\t\t\tif src.box.remote? # case 4\n\t\t\t\tsrc.box.ssh.exec!(\"cp -r #{src.full_path} #{dst.full_path}\") do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # case 1\n\t\t\t\tFileUtils.cp_r(src.full_path, dst.full_path)\n\t\t\tend\n\t\telse # case 2, 3, or 5\n\t\t\tif src.local? && !dst.local? # case 2\n\t\t\t\t# We use the connection on the remote machine to do the upload\n\t\t\t\tdst.box.ssh.scp.upload!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telsif !src.local? && dst.local? # case 3\n\t\t\t\t# We use the connection on the remote machine to do the download\n\t\t\t\tsrc.box.ssh.scp.download!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telse # src and dst not local, case 5\n\t\t\t\tremote_command = \"scp #{src.full_path} #{dst.box.user}@#{dst.box.host}:#{dst.full_path}\"\n\t\t\t\t# doesn't matter whose connection we use\n\t\t\t\tsrc.box.ssh.exec!(remote_command) do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# TODO: use tar for cross-server transfers.\n\t\t# something like this?:\n\t\t# archive = from.box.read_archive(src)\n\t\t# dst.box.write_archive(archive, dst)\n\n\t\tnew_full_path = dst.dir? ? \"#{dst.full_path}#{src.name}\" : dst.full_path\n\t\tsrc.class.new(new_full_path, dst.box)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(to)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, from\n\tend", "def copy_or_move(original, target)\n if(@delete_original_file)\n FileUtils.move(original, target)\n else\n # Delay can be enabled through enviroment\n if(delay_copies)\n DelayedCopier.cp(original, target)\n elsif(fast_copies)\n FileUtils.copy(original, target)\n else\n # Call the copy as an external command. This is to work around the\n # crashes that occurred using the builtin copy\n from_file = File.expand_path(original)\n to_file = File.expand_path(target)\n system_success = system(\"cp '#{from_file}' '#{to_file}'\")\n raise(IOError, \"copy error '#{from_file}' '#{to_file}'\") unless system_success\n end\n end\n end", "def cp(srcpath,dstpath)\n FileUtils.cp_r(srcpath,dstpath)\n end", "def rsync_to_temp\n\t\tputs \"\\n=> copying to temp dir.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_src, @@dir_temp)\n\tend", "def cp(from_location, to_location)\n @client.file_copy(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end", "def copyFileToTarget(file, srcDir, destDir) \n inFileName = \"#{srcDir}/#{file}\";\n outFileName = \"#{destDir}/#{file}\";\n puts \"copying: [#{inFileName}]\";\n puts \"\\tto: [#{outFileName}]\";\n system(\"cp #{inFileName} #{outFileName}\");\nend", "def transfer!\n write_password_file! unless local\n\n remote_path = remote_path_for(@package)\n\n create_remote_path!(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n if local\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ remote_path }'.\"\n run(\n \"#{ utility(:rsync) } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ File.join(remote_path, remote_file) }'\"\n )\n else\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ ip }'.\"\n run(\n \"#{ utility(:rsync) } #{ rsync_options } #{ rsync_port } \" +\n \"#{ rsync_password_file } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ username }@#{ ip }:#{ File.join(remote_path, remote_file) }'\"\n )\n end\n end\n\n ensure\n remove_password_file! unless local\n end", "def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend", "def dup_file(source, destination)\n return nil if source.blank? || destination.blank?\n\n FileUtils.cp(source, destination) if file_exists?(source)\n end", "def copy_to_local srcfile, dstfile\n @hdfs.copy_to_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def copy_to_local srcfile, dstfile\n @hdfs.copy_to_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def copy_files\n file_candidates.each do |remote_file|\n local_file = File.basename(remote_file)\n if File.exist?(local_file)\n if same_file?(local_file, remote_file)\n info \"\\n>> '#{local_file}' has the same contents here as in the repo. Leaving it alone.\"\n else\n if config['answer_yes']\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo.\"\n info \"Copying #{remote_file} to #{local_file}... (answer_yes is true)\"\n copy_file(remote_file, local_file)\n else\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo (see below)\"\n git_diff(local_file, remote_file)\n prompt \"\\nDo you want to overwrite #{local_file} with the version from the repo? [y/N]: \"\n\n answer = $stdin.gets.chomp\n case answer\n when ''\n error 'Moving on.' # Default behavior.\n when /y/i\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n when /n/i\n error 'Moving on.'\n else\n error 'Unknown selection. Moving on.'\n end\n end\n\n end\n else\n info \"\\n>> '#{local_file}' does not exist locally.\"\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n end\n end\n end", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend", "def rel_copy(full_src, rel_dest, opts={})\n \n dest_path = File.dirname(rel_dest)\n \n fname = Pathname.new(full_src).basename\n \n if !File.directory?(dest_path)\n cmd = \"mkdir -p #{dest_path}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end \n end\n \n cmd = \"cp #{full_src} #{dest_path}/#{fname}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end\n\nend", "def copy(from, to, options={})\n expanded_to = File.expand_path(to)\n unless options[:force]\n raise FileOverwriteError, \"File #{expanded_to} already exists\" if File.exists?(expanded_to)\n end\n system(['rm', '-rf', expanded_to].shelljoin)\n system(['cp', '-r', File.expand_path(from) + \"/\", expanded_to + \"/\"].shelljoin)\n end", "def local_copy(source, target)\n FileUtils.mkpath(File.dirname(target))\n FileUtils.copy(source, \"#{target}.in_progress\")\n FileUtils.move(\"#{target}.in_progress\", target)\n end", "def copy_file(filename,dst_dir='/',dst_repo=self.repo,src_repo=self.repo)\n post_copy(src_repo,{\"file_names\"=>filename, \"dst_repo\" => dst_repo, \"dst_dir\"=>dst_dir})\n end", "def rsync(source, target, exclude = [], options = [], verbose = false)\n excludes = exclude.map {|e| \"--exclude=#{e} \"}\n host = source.split(/\\//)[2]\n port = 873\n\n # Make the target directory if it's not there.\n FileUtils.mkdir(target) if !File.directory?(target)\n\n begin\n raise Exception, \"Unable to connect to remote host #{source}\" unless port_open?(host, port)\n\n log(\"rsync #{options} #{excludes} #{source} #{target}\")\n\n if verbose\n puts \"RUNNING: rsync #{options} #{excludes} #{source} #{target}\"\n system \"rsync #{options} #{excludes} #{source} #{target}\"\n else\n `rsync #{options} #{excludes} #{source} #{target}`\n end\n\n rescue Errno::EACCES, Errno::ENOENT, Errno::ENOTEMPTY, Exception => e\n log(e.to_s)\n end\nend", "def ftp_copy(ftp, local_file, remote_file)\n in_ftp_dir(ftp, File.dirname(remote_file)) do |_ftp|\n basename = File.basename(remote_file)\n _ftp.putbinaryfile(local_file, \"#{basename}.in_progress\")\n _ftp.rename(\"#{basename}.in_progress\", basename)\n end\n end", "def cp(src, dest, preserve: nil, noop: nil, verbose: nil)\n fu_output_message \"cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_file s, d, preserve\n end\n end", "def run(path)\n # Strip a leading / off the path to avoid any problems\n path.sub!(/^\\//, '')\n\n # Build the source and destination paths\n source = \"#{guest_sf_path}/#{path}\"\n dest = \"#{guest_path}/#{path}\"\n\n # Check if the source is a directory on the host - if so, add a / for rsync\n if ((path != '') && (File.directory?(File.join(host_path, path))))\n source << '/'\n dest << '/'\n end\n\n\n # Build the rsync command\n args = ['rsync -av']\n\n if (delete)\n args << '--del'\n end\n\n args = args + exclude_args\n\n args << source\n args << dest\n\n cmd = args.join(' ')\n\n # Run rsync\n vm.channel.sudo(cmd)\n end", "def remote_file_resource\n Chef::Log.info \"Remote file: #{file_location}\"\n Chef::Log.info \"Local file: #{new_resource.name}\"\n @remote_file_resource ||= remote_file new_resource.name do\n source file_location\n checksum new_resource.checksum if !new_resource.checksum.nil?\n owner new_resource.owner\n group new_resource.group\n backup false\n action :nothing\n end\nend", "def cp( file )\n src = ::File.join(data, file)\n dst = ::File.join(site, file)\n test(?e, dst) ? updating(dst) : creating(dst)\n# FileUtils.cp(src, dst)\n if WINDOWS then win_line_endings(src, dst)\n else FileUtils.cp(src, dst) end\n end", "def cp srcpath, dstpath\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def file_copy(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/copy\", params)\n parse_response(response)\n end", "def FileCopy(src, dst)\n success?(parse(cmd(with_args(src, dst))))\n end", "def copy_file!(f, target)\n # directory?\n if File.directory?(f)\n if File.directory?(target)\n done = 'exists'.green\n else\n FileUtils.mkdir_p target\n done = 'created'.bold.green\n end\n else\n if newer?(f, target)\n target_dir = File.dirname(target)\n FileUtils.mkdir_p target_dir unless File.directory?(target_dir)\n FileUtils.copy f, target\n done = 'copied'.bold.green\n else\n done = 'keep'.white\n end\n end\n done\n end", "def transfer!\n create_local_directories!\n\n files_to_transfer do |local_file, remote_file|\n Logger.message \"#{storage_name} started transferring '#{ local_file }'.\"\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end\n end", "def cp( file )\n src = template / file\n dst = site / file\n\n if test(?e, dst)\n if identical?(src, dst)\n identical(dst)\n return\n end\n\n choice = case options[:collision]\n when :force then :force\n when :skip then :skip\n else force_file_collision?( dst ) end\n\n case choice\n when :force then force(dst)\n when :skip then skip(dst); return\n else raise \"Invalid collision choice: #{choice.inspect}\" end\n else\n create(dst)\n end\n return if pretend?\n\n FileUtils.cp(src, dst)\n end", "def pull_file(user, host, copy_path, place_path, sudo = false)\n ping(user, host) do\n begin\n my_text = IO.popen(\"ssh #{user}@#{host} 'cat \\\"#{copy_path}\\\"'\")\n my_text.write(\"sudo bash -c 'cat #{copy_path}'\\n\") if sudo\n file_saved = save_local(place_path, my_text)\n my_text.close\n return file_saved\n rescue\n \"No such file.\"\n end\n end\n end", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, src unless File.exist?(src)\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\tend", "def copy!(new_path)\n if exists?\n FileUtils.cp(path, new_path) unless new_path == path\n else\n File.open(new_path, \"wb\") { |f| f.write(read) }\n end\n end", "def copy(path, destination, options = {})\n opts = options.nil? ? {} : options.dup\n opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup\n opts[:headers]['Destination'] = destination\n execute('COPY', path, opts)\n end", "def copy_from_local srcfile, dstfile\n @hdfs.copy_from_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def copy_from_local srcfile, dstfile\n @hdfs.copy_from_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def local_to_remote!\n if not @remote_io or not @local_io\n raise Exception::new(\"Copy request from local to remote stream, but no local and/or remote stream have been assigned.\")\n end\n\n @local_io.acquire do |lio|\n lio.seek(@local_position)\n @remote_io.acquire :write do |rio|\n #p rio\n rio.write(self.to_s)\n File.copy_stream(lio, rio, @local_size)\n end\n end\n\n end", "def copyfile from, to\n FileUtils.mkdir_p File.dirname to\n cp from, to\n end", "def copy_file file, destination, clobber=nil\n validate file, destination\n target = File.expand_path( File.join(destination, File.basename(file)) )\n if(File.exists?(target) && clobber != :clobber)\n raise Sprout::Errors::DestinationExistsError.new \"Unable to copy #{file} to #{target} because target already exists and we were not asked to :clobber it\"\n end\n FileUtils.mkdir_p destination\n FileUtils.cp_r file, destination\n\n destination\n end", "def execute()\r\n FileUtils.cp(@FilePath, @CopiedFilePath)\r\n File.delete(@FilePath) if File.exist?(@FilePath)\r\n end", "def cp_r(source, dest)\n FileUtils.cp_r(source, dest)\n puts \" ✔ cp -R #{source} #{dest}\".colorize(:blue).bold\n end", "def remove_local_copy\n Dir.chdir(self.study.data_store_path)\n if File.exists?(self.download_location)\n File.delete(self.download_location)\n subdir = self.remote_location.blank? ? self.id : self.remote_location.split('/').first\n if Dir.exist?(subdir) && Dir.entries(subdir).delete_if {|e| e.start_with?('.')}.empty?\n Dir.rmdir(subdir)\n end\n end\n end", "def download_file_from_guest(guest_path, local_path, quiet=false)\n\n log_stdout \"Copying #{guest_path} to #{local_path}\", quiet\n # 1 run cp command in machine\n guestcontrol_exec \"cmd.exe\", \"cmd.exe /c copy \\\"#{guest_path}\\\" \\\"E:\\\\#{File.basename(local_path)}\\\"\"\n\n # 2 copy to tmp location in .ievms\n FileUtils.cp File.join(IEVMS_HOME,File.basename(local_path)), local_path\n\n # 3 remove tmp file in .ievms\n FileUtils.rm File.join(IEVMS_HOME,File.basename(local_path))\n end", "def copy_file(src, dest)\r\n File.open(src, 'rb') {|r|\r\n File.open(dest, 'wb') {|w|\r\n copy_stream r, w\r\n }\r\n }\r\n end", "def copy_from_local srcpath, destpath\n bucket,key = split_path(destpath)\n if File.exists?(srcpath)\n if File.directory?(srcpath)\n raise \"NotYetImplemented\"\n else\n @s3.interface.put(bucket, key, File.open(srcpath))\n end\n else\n raise Errno::ENOENT, \"No such file or directory - #{srcpath}\"\n end\n end", "def copy_to_local_file(style, local_dest_path)\n @filesystem.copy_to_local_file(style, local_dest_path)\n end", "def copy_to_local_file(style, local_dest_path)\n @filesystem.copy_to_local_file(style, local_dest_path)\n end", "def scp(src_file, path_of_servers, dst_file, option = \"\")\n _path_of_servers = path_of_servers.dup\n remove_first_localhost!(_path_of_servers)\n\n #generate session uuid and make temp dir string\n sid = SecureRandom.uuid\n temp_file = \"#{temp_dir(sid)}#{File.basename(src_file)}\"\n\n #first, local src file to edge server's temp dir\n #(/tmp/onion_ssh/<session uuid>/<files>)\n first = _path_of_servers.shift\n ssh([first], \"mkdir -p #{temp_dir(sid)} >& /dev/null\")\n `#{one_scp_str(src_file, first, temp_file)}`\n \n #second to last - 1 , scp temp dir to temp dir\n last = _path_of_servers.pop\n temp_path = [first]\n _second_to_last_minus_one = _path_of_servers\n _second_to_last_minus_one.each do |sv|\n temp_path << sv\n ssh(temp_path,\"mkdir -p #{temp_dir(sid)} >& /dev/null\")\n end\n\n temp_path = [first]\n _second_to_last_minus_one.each do |sv|\n ssh(temp_path, \"#{one_scp_str(temp_file, sv, temp_dir(sid))}\")\n temp_path << sv\n end\n\n #last minus one's path=(temp_path above) and last\n ssh(temp_path, \"#{one_scp_str(temp_file, last, dst_file)}\")\n #delete garbage\n clear_temp([first] + _second_to_last_minus_one, sid)\n end", "def safe_copy(original, target)\n if(fast_copies)\n FileUtils.copy(original, target)\n else\n # Call the copy as an external command. This is to work around the\n # crashes that occurred using the builtin copy\n from_file = File.expand_path(original)\n to_file = File.expand_path(target)\n system_success = system(\"cp '#{from_file}' '#{to_file}'\")\n raise(IOError, \"copy error '#{from_file}' '#{to_file}'\") unless system_success\n end\n end", "def copy(source_path, target_path)\n _ensure_directory_exists(target_path)\n target_path.open('wb', @permissions[:file]) do |io|\n lines = source_path.read.split(\"\\n\")\n lines.each do |line|\n\tio.write(line.chomp + @ending)\n end\n end\n puts \"#{source_path.to_s.ljust(25)} -> #{target_path}\"\n end" ]
[ "0.76276386", "0.7606336", "0.7373558", "0.7336695", "0.7267998", "0.7042028", "0.69630325", "0.696159", "0.6896305", "0.6853501", "0.67238754", "0.6649978", "0.65474635", "0.6505691", "0.6497019", "0.6368123", "0.63333625", "0.6302963", "0.6252137", "0.6243156", "0.6202148", "0.62005603", "0.61845356", "0.61845356", "0.6177599", "0.6143583", "0.6131872", "0.61227393", "0.6120496", "0.60959023", "0.60814786", "0.60814786", "0.6045756", "0.6038092", "0.60374516", "0.60367244", "0.6034469", "0.6032557", "0.60272574", "0.6017431", "0.60173094", "0.60118055", "0.5996576", "0.59736717", "0.59676427", "0.59656423", "0.59596443", "0.59536767", "0.5950193", "0.59439754", "0.5939583", "0.5923672", "0.59225905", "0.5920996", "0.5906818", "0.59053713", "0.59011006", "0.58689517", "0.58593905", "0.58593905", "0.58582723", "0.58558786", "0.58471626", "0.5840005", "0.5836152", "0.58192587", "0.5818583", "0.5816643", "0.5809395", "0.58070105", "0.5806262", "0.58051515", "0.57965803", "0.5794979", "0.5794979", "0.57892835", "0.57860374", "0.5785068", "0.5782456", "0.5757792", "0.5756868", "0.5745893", "0.57444483", "0.5744095", "0.57419264", "0.57419264", "0.5739412", "0.5734398", "0.573407", "0.5724978", "0.57244563", "0.5723345", "0.5721808", "0.5721738", "0.5719809", "0.5713183", "0.5713183", "0.5705986", "0.56986624", "0.56969" ]
0.7188568
5
N Without initialize, we won't be able to construct an SSH/SCP object initialised with readonly attributes representing the SSH shell application and the SCP application.
def initialize(shell, scpProgram) #N Without this we won't have the remote shell command as an array of executable + arguments @shell = shell.is_a?(String) ? [shell] : shell #N Without this we won't have the SCP command as an array of executable + arguments @scpProgram = scpProgram.is_a?(String) ? [scpProgram] : scpProgram #N Without this we won't have the SCP command as single string of white-space separated executable + arguments @scpCommandString = @scpProgram.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_ssh; end", "def initialize(userAtHost, hashCommand, sshAndScp = nil)\n #N Without calling super, the hash command won't be configured\n super(hashCommand)\n #N Without this, the SSH & SCP implementation won't be configured\n @sshAndScp = sshAndScp != nil ? sshAndScp : InternalSshScp.new()\n #N Without this, the SSH & SCP implementation won't be configured with the user/host details to connect to.\n @sshAndScp.setUserAtHost(userAtHost)\n end", "def initialize\n extend(Net::SSH::Transport::PacketStream)\n super \"SSH-2.0-Test\\r\\n\"\n\n @script = Script.new\n\n script.sends(:kexinit)\n script.gets(:kexinit, 1, 2, 3, 4, \"test\", \"ssh-rsa\", \"none\", \"none\", \"none\", \"none\", \"none\", \"none\", \"\", \"\", false)\n script.sends(:newkeys)\n script.gets(:newkeys)\n end", "def initialize shell, id = \"id_rsa\"\n @shell = shell\n @ssh_home = File.join ENV[\"HOME\"], \".ssh\"\n @ssh_id = id\n end", "def initialize(sftp)\n @sftp = sftp\n end", "def initialize(repository, ssh_key, deploy_task)\n ssh_key = File.expand_path(ssh_key) if ssh_key\n @repository, @ssh_key, @deploy_task = repository, ssh_key, deploy_task\n end", "def initialize host, options={}\n super $stdout, options\n\n @host, @user = host.split(\"@\").reverse\n\n @user ||= options[:user]\n\n @rsync_flags = [\"-azrP\"]\n @rsync_flags.concat [*options[:rsync_flags]] if options[:rsync_flags]\n\n @ssh_flags = [\n \"-o ControlMaster=auto\",\n \"-o ControlPath=~/.ssh/sunshine-%r@%h:%p\"\n ]\n @ssh_flags.concat [\"-l\", @user] if @user\n @ssh_flags.concat [*options[:ssh_flags]] if options[:ssh_flags]\n\n @parent_pid = nil\n\n self.class.register self\n end", "def initialize(params_obj, options = {})\n @standard_properties = [\"SS_application\", \"SS_component\", \"SS_environment\", \"SS_component_version\", \"request_number\"]\n @p = params_obj\n super @p\n lib_path = @p.get(\"SS_script_support_path\")\n @action_platforms = {\"default\" => {\"transport\" => \"nsh\", \"platform\" => \"linux\", \"language\" => \"bash\", \"comment_char\" => \"#\", \"env_char\" => \"\", \"lb\" => \"\\n\", \"ext\" => \"sh\"}}\n @action_platforms.merge!(ACTION_PLATFORMS) if defined?(ACTION_PLATFORMS)\n @automation_category = get_option(options, \"automation_category\", @p.get(\"SS_automation_category\", \"shell\"))\n @output_dir = get_option(options, \"output_dir\", @p.get(\"SS_output_dir\"))\n action_platform(options)\n @nsh_path = get_option(options,\"nsh_path\", NSH_PATH)\n @debug = get_option(options, \"debug\", false)\n @nsh = NSH.new(@nsh_path)\n set_transfer_properties(options)\n timeout = get_option(options, \"timeout\", @p.get(\"step_estimate\", \"60\"))\n @timeout = timeout.to_i * 60\n end", "def initialize(name, parent, path, *parameters)\n \n params = case parameters.last\n when Hash then parameters.pop\n else {}\n end \n # Make sure class actually works\n #checkSetup()\n\n @name = params.fetch('name', name)\n @privateDirs = params.fetch('privateDirs', [])\n @inNamespace = params.fetch('inNamespace', true)\n\n # Stash configuration parameters for future reference\n @params = params\n\n @intfs = Hash.new # dict of port numbers to interfaces\n @ports = Hash.new # dict of interfaces to port numbers\n # replace with Port objects, eventually ?\n @nameToIntf = Hash.new # dict of interface names to Intfs\n\n @parent = parent\n @path = path\n @shell = nil \n @execed=nil \n @pid = nil\n @stdin = nil \n @stdout = nil\n @lastPid = nil \n @lastCmd = nil \n @pollOut = nil\n\n @waiting = false\n @readbuf = ''\n end", "def initialize\n super(\"ssh-userauth\")\n end", "def initialize(args = {})\n @ip = args[:ip]\n @username = args[:username] || \"admin\"\n @password = args[:password] || \"admin\"\n @initial_args = args\n @session = ssh_session(@ip,@username,@password)\n @device_type = args[:device_type]\n end", "def initialize(ssh, opts={})\n super(nil,opts)\n\t\tinit_ssh(ssh,opts)\n self.console = Rex::Post::MetaSSH::Ui::Console.new(self)\n\tend", "def initialize(shell)\n\t\tsuper\n\tend", "def initialize()\n @remote_host = \"192.168.1.1\"\n @rsa_key = \"~/.ssh/router_rsa\"\n @dns_source = \"http://www.netflixdnscodes.com\"\n end", "def scp options = {}\n self.__commands << options.merge({:type => :scp})\n end", "def initialize(args = {})\n super(args)\n \n @community_ro = args[:community_ro] || args[:community] || \"public\"\n @community_rw = args[:community_rw] || args[:community] || \"public\"\n end", "def initialize(client)\n super(\"metaSSH\")\n\t\t# The meterpreter client context\n\t\tself.client = client\n\n\t\t# Queued commands array\n\t\tself.commands = []\n\n\t\t# Point the input/output handles elsewhere\n\t\treset_ui\n\n\t\tenstack_dispatcher(Console::CommandDispatcher::Core)\n enstack_dispatcher(Console::CommandDispatcher::Stdapi)\n\n\t\t# Set up logging to whatever logsink 'core' is using\n\t\tif ! $dispatcher['ssh']\n\t\t\t$dispatcher['ssh'] = $dispatcher['core']\n\t\tend\n\tend", "def initialize(sid=nil, mode=nil)\n super()\n self.sid = sid\n self.mode = mode\n end", "def shell_init()\n\t\traise NotImplementedError\n\tend", "def create\n sharing(\"-a\", name)\n @property_hash[:ensure] = :present\n\n # Setters for configuring the share are not automatically called on create, so we call them\n resource.properties.each do |property|\n property.sync unless property.name == :ensure\n end\n end", "def initialize( *args )\n @open = false\n @agent_forwarded = false\n\n process_arguments( *args )\n\n @registry.define do |b|\n b.crypto_backend { @crypto_backend }\n b.transport_host { @host }\n b.transport_options { @options }\n\n b.userauth_keys { @keys }\n b.userauth_host_keys { @host_keys }\n b.userauth_method_order { @auth_methods }\n\n b.host_key_verifier { @host_key_verifier }\n\n # Register myself with the registry, so that other services may\n # access me.\n b.session( :pipeline => [] ) { self }\n\n b.prompter do\n require 'net/ssh/util/prompter'\n Net::SSH::Util::Prompter.new\n end\n\n b.require 'net/ssh/transport/services', \"Net::SSH::Transport\"\n b.require 'net/ssh/connection/services', \"Net::SSH::Connection\"\n b.require 'net/ssh/userauth/services', \"Net::SSH::UserAuth\"\n\n b.require 'net/ssh/service/services', \"Net::SSH::Service\"\n end\n\n userauth = @registry[:userauth][:driver]\n if userauth.authenticate( \"ssh-connection\", @username, @password )\n @open = true\n @connection = @registry[:connection][:driver]\n if block_given?\n yield self\n close\n end\n else\n @registry[:transport][:session].close\n raise AuthenticationFailed, @username\n end\n end", "def initialize(host, user, password)\n @host = host\n @connection = Net::SSH.start(@host, user, :password => password)\n end", "def initialize(argv=[], openstack_server_create=OpenstackServerCreate.new)\n super(argv) # Thanks, mixlib-cli\n\n # This loads the config\n configure_chef\n\n @profiles = YAMLProfiles.new(config[:yaml_config])\n @openstack_server_create = openstack_server_create\n end", "def initialize(options={})\n @options = options\n\n self.safe = options[:safe]\n #self.file = options[:file]\n self.keep = options[:keep]\n self.scope = options[:scope] || BasicObject.new\n self.multi_key = options[:multikey]\n end", "def init_shell()\n\t\traise NotImplementedError\n\tend", "def initialize(cmd, args = [], options = {})\n @usable = true\n @powershell_command = cmd\n @powershell_arguments = args\n\n raise \"Bad configuration for ENV['lib']=#{ENV['lib']} - invalid path\" if Pwsh::Util.invalid_directories?(ENV['lib'])\n\n if Pwsh::Util.on_windows?\n # Named pipes under Windows will automatically be mounted in \\\\.\\pipe\\...\n # https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs#L34\n named_pipe_name = \"#{SecureRandom.uuid}PsHost\"\n # This named pipe path is Windows specific.\n pipe_path = \"\\\\\\\\.\\\\pipe\\\\#{named_pipe_name}\"\n else\n require 'tmpdir'\n # .Net implements named pipes under Linux etc. as Unix Sockets in the filesystem\n # Paths that are rooted are not munged within C# Core.\n # https://github.com/dotnet/corefx/blob/94e9d02ad70b2224d012ac4a66eaa1f913ae4f29/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs#L49-L60\n # https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs#L44\n # https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs#L298-L299\n named_pipe_name = File.join(Dir.tmpdir, \"#{SecureRandom.uuid}PsHost\")\n pipe_path = named_pipe_name\n end\n pipe_timeout = options[:pipe_timeout] || self.class.default_options[:pipe_timeout]\n debug = options[:debug] || self.class.default_options[:debug]\n native_cmd = Pwsh::Util.on_windows? ? \"\\\"#{cmd}\\\"\" : cmd\n\n ps_args = args + ['-File', self.class.template_path, \"\\\"#{named_pipe_name}\\\"\"]\n ps_args << '\"-EmitDebugOutput\"' if debug\n # @stderr should never be written to as PowerShell host redirects output\n stdin, @stdout, @stderr, @ps_process = Open3.popen3(\"#{native_cmd} #{ps_args.join(' ')}\")\n stdin.close\n\n # TODO: Log a debug for \"#{Time.now} #{cmd} is running as pid: #{@ps_process[:pid]}\"\n\n # Wait up to 180 seconds in 0.2 second intervals to be able to open the pipe.\n # If the pipe_timeout is ever specified as less than the sleep interval it will\n # never try to connect to a pipe and error out as if a timeout occurred.\n sleep_interval = 0.2\n (pipe_timeout / sleep_interval).to_int.times do\n begin # rubocop:disable Style/RedundantBegin\n @pipe = if Pwsh::Util.on_windows?\n # Pipe is opened in binary mode and must always <- always what??\n File.open(pipe_path, 'r+b')\n else\n UNIXSocket.new(pipe_path)\n end\n break\n rescue StandardError\n sleep sleep_interval\n end\n end\n if @pipe.nil?\n # Tear down and kill the process if unable to connect to the pipe; failure to do so\n # results in zombie processes being left after a caller run. We discovered that\n # closing @ps_process via .kill instead of using this method actually kills the\n # watcher and leaves an orphaned process behind. Failing to close stdout and stderr\n # also leaves clutter behind, so explicitly close those too.\n @stdout.close unless @stdout.closed?\n @stderr.close unless @stderr.closed?\n Process.kill('KILL', @ps_process[:pid]) if @ps_process.alive?\n raise \"Failure waiting for PowerShell process #{@ps_process[:pid]} to start pipe server\"\n end\n\n # TODO: Log a debug for \"#{Time.now} PowerShell initialization complete for pid: #{@ps_process[:pid]}\"\n\n at_exit { exit }\n end", "def initialize\n key_pair = ECDSA.generate_key_pair\n self.private_key, self.public_key = key_pair.values_at(:private_key, :public_key)\n end", "def initialize(host, prefix: nil, **opts)\n super(**opts)\n\n @prefix = prefix\n @client = Net::SCP.start(host, nil, **opts.slice(*Net::SSH::VALID_OPTIONS), non_interactive: true)\n\n if @prefix # rubocop:disable Style/GuardClause\n @prefix = \"#{norm_path(@prefix)}/\"\n mkdir_p abs_path(@prefix)\n end\n end", "def initialize(ssh_uri)\n uri = URI(ssh_uri)\n @host = uri.host\n @port = uri.port || 22\n @user = uri.user || ENV['USER']\n if uri.password\n @password = uri.password\n else\n @key = \"#{ENV['HOME']}/.ssh/id_rsa\"\n end\n end", "def initialize(adapter)\n %w(ip user password path).each do |method|\n send(\"#{method}=\", adapter.procedure.get_storage_configuration.attributes[method])\n end\n \n final_file = adapter.final_file\n tmp_path = adapter.tmp_path\n \n Net::SSH.start(ip, user, :password => password) do |ssh|\n ssh.exec \"mkdir -p #{path}\"\n end\n \n puts \"Storing \\\"#{final_file}\\\" to path \\\"#{path}\\\" on remote server (#{ip}).\"\n Net::SCP.start(ip, user, :password => password) do |scp|\n scp.upload! File.join(tmp_path, final_file).gsub('\\ ', ' '), path\n end\n end", "def initialize(spcfg, atrb = Hashx.new)\n super(spcfg)\n update(atrb)\n @par = self[:par]\n @id = self[:cid]\n verbose { \"Config\\n\" + path }\n end", "def initialize(private_key, options = {})\n @passphrase = options[:passphrase]\n @comment = options[:comment] || \"\"\n self.directives = options[:directives] || []\n\n begin\n @key_object = OpenSSL::PKey::RSA.new(private_key, passphrase)\n @type = \"rsa\"\n @typestr = \"ssh-rsa\"\n rescue OpenSSL::PKey::RSAError\n @type = nil\n end\n\n return if @type\n\n begin\n @key_object = OpenSSL::PKey::DSA.new(private_key, passphrase)\n @type = \"dsa\"\n @typestr = \"ssh-dss\"\n rescue OpenSSL::PKey::DSAError\n @type = nil\n end\n\n return if @type\n\n @key_object = OpenSSL::PKey::EC.new(private_key, passphrase)\n @type = \"ecdsa\"\n bits = ECDSA_CURVES.invert[@key_object.group.curve_name]\n @typestr = \"ecdsa-sha2-nistp#{bits}\"\n end", "def initialize(attributes={})\n super(attributes)\n @share_edit_args = []\n end", "def initialize(process)\n\t\t\t\tsuper(IO.popen(process, Writeable))\n\t\t\tend", "def initialize(type, version, username, sid, master_password = nil)\n self.version = version.to_f\n self.username = username\n self.sid = sid\n self.master_password = master_password\n md5 = OpenSSL::Digest::MD5.new\n sha256 = OpenSSL::Digest::SHA256.new\n if (self.version > 0) && (self.version < 5.1)\n self.key = (type == 'Xshell') ? md5.digest('!X@s#h$e%l^l&') : md5.digest('!X@s#c$e%l^l&')\n elsif (self.version >= 5.1) && (self.version <= 5.2)\n self.key = sha256.digest(self.sid)\n elsif (self.version > 5.2)\n if self.master_password.nil?\n self.key = sha256.digest(self.username + self.sid)\n else\n self.key = sha256.digest(self.master_password)\n end\n else\n raise 'Invalid argument: version'\n end\n end", "def initialize(shell)\n super\n\n self.extensions = []\n self.bgjobs = []\n self.bgjob_id = 0\n\n # keep a lookup table to refer to transports by index\n @transport_map = {}\n\n end", "def config_ssh(username, host, options = nil)\n @ssh = SSH.new(username, host, options)\n end", "def ssh_type; end", "def ssh_type; end", "def ssh_type; end", "def ssh_type; end", "def initialize(attributes)\n super()\n self.identity = attributes[:identity]\n self.identity_type = attributes[:identity_type]\n self.public_key = attributes[:raw_public_key]\n self.scope = attributes[:scope] || Card::APPLICATION\n self.data = attributes[:data]\n self.info = attributes[:info]\n end", "def new(*args) dup.initialize(*args) end", "def initialize(pth=nil, priv=nil, own=nil, grp=nil)\n # duplicat instance if initilize is called with an instance as the first argument\n if pth.is_a?(UFS::FS::File) || pth.is_a?(UFS::FS::Dir)\n priv = pth.permissions\n own = pth.owner\n grp = pth.group\n pth = pth.path\n end\n self.path = ::File.expand_path(pth) unless pth.nil?\n self.permissions = priv unless priv.nil?\n self.owner = own unless own.nil?\n self.group = grp unless grp.nil?\n end", "def initialize(session, options = {})\n @session = session\n @key_manager = options[:key_manager]\n @options = options\n @prompt = options[:password_prompt]\n @pubkey_algorithms = options[:pubkey_algorithms] \\\n || %w[[email protected]\n [email protected]\n rsa-sha2-256\n ssh-rsa]\n self.logger = session.logger\n end", "def initialize\n fail InstanceError, 'Pipes are not supposed to be instantiated'\n end", "def initialize(*args)\n \n super\n\n # if this type is called during a puppet run than do a send a notify to the splunk service\n self[:notify] = [\"Service[splunk]\", \"Service[splunkd]\", ].select { |ref| catalog.resource(ref) } unless catalog.nil?\n\n end", "def initialize(host, user, options={})\n @session = Net::SSH.start(host, user, options)\n @session_mutex = Mutex.new\n @port_mutex = Mutex.new\n @next_port = MAX_PORT\n @loop_wait = options.delete(:loop_wait) || 0.001\n initiate_event_loop!\n end", "def initialize(process); end", "def initialize(handle, socket, useroptions = Hash.new)\n self.handle = handle\n self.socket = socket\n self.options = {\n 'smb_user' => '',\n 'smb_pass' => '',\n 'smb_pipeio' => 'rw',\n 'smb_name' => nil,\n 'read_timeout' => 10,\n 'connect_timeout' => 5\n }\n\n self.options.merge!(useroptions)\n\n # If the caller passed us a smb_client object, use it and\n # and skip the connect/login/ipc$ stages of the setup\n if (self.options['smb_client'])\n self.smb = self.options['smb_client']\n end\n\n # we must have a valid handle, regardless of everything else\n raise ArgumentError, 'handle is not a Rex::Proto::DCERPC::Handle' if !self.handle.is_a?(Rex::Proto::DCERPC::Handle)\n\n # we do this in case socket needs setup first, ie, socket = nil\n if !self.options['no_socketsetup']\n self.socket_check()\n end\n\n raise ArgumentError, 'socket can not read' if !self.socket.respond_to?(:read)\n raise ArgumentError, 'socket can not write' if !self.socket.respond_to?(:write)\n\n if !self.options['no_autobind']\n self.bind()\n end\n end", "def initialize(host, options = T.unsafe(nil)); end", "def setup(credentials = {})\n requires :public_key, :ssh_ip_address, :username\n\n credentials[:proxy]= ssh_proxy unless ssh_proxy.nil?\n credentials[:password] = password unless self.password.nil?\n credentials[:key_data] = [private_key] if self.private_key\n\n commands = [\n %{mkdir .ssh},\n # %{passwd -l #{username}}, #Not sure if we need this here\n # %{echo \"#{Fog::JSON.encode(attributes)}\" >> ~/attributes.json}\n ]\n if public_key\n commands << %{echo \"#{public_key}\" >> ~/.ssh/authorized_keys}\n end\n\n # wait for domain to be ready\n Timeout::timeout(360) do\n begin\n Timeout::timeout(8) do\n Fog::SSH.new(ssh_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')\n end\n rescue Errno::ECONNREFUSED\n sleep(2)\n retry\n rescue Net::SSH::AuthenticationFailed, Timeout::Error\n retry\n end\n end\n Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)\n end", "def initialize(hostname: nil, process_name: nil, process_id: nil, config: nil)\n @hostname = (hostname || Skein::Support.hostname).dup.freeze\n @process_name = (process_name || Skein::Support.process_name).dup.freeze\n @process_id = process_id || Skein::Support.process_id\n end", "def kind\n :ssh\n end", "def run_instance(o={})\n raise StandardError.new(\"You have no available hosts\") if available_hosts.empty?\n host = available_hosts.first\n new_host = SshInstance.new(instance_options(o.merge(:name=>host)))\n new_host.keypair\n if new_host && new_host.refresh!\n available_hosts.delete host\n new_host\n else\n raise StandardError.new(\"Unable to connect to host #{host}\")\n end\n end", "def initialize(options={})\n # Thor::Base.initialize(args = [], local_options = {}, config = {}) <= original signature\n options[:force] = options[:yes]\n super([], options)\n self.destination_root = Dir.pwd # Thor::Actions require destination_root to be set\n end", "def initialize()\n @ip = Settings.get[\"cpe\"][\"ip\"]\n @port = Settings.get[\"cpe\"][\"port\"]\n @path = Settings.get[\"cpe\"][\"path\"]\n @username = Settings.get[\"cpe\"][\"username\"]\n @password = Settings.get[\"cpe\"][\"password\"]\n @file_root = Settings.get[\"cpe\"][\"file_root\"]\n @firmware = Settings.get[\"cpe\"][\"firmware\"]\n @config = Settings.get[\"cpe\"][\"config\"]\n @log = Settings.get[\"cpe\"][\"log\"]\n end", "def initialize(*args)\n super\n @action = :create_ec2\nend", "def scp_connect\n # Connect to SCP and yield the SCP object\n connect do |connection|\n scp = Net::SCP.new(connection)\n return yield scp\n end\n rescue Net::SCP::Error => e\n # If we get the exit code of 127, then this means SCP is unavailable.\n raise Vagrant::Errors::SCPUnavailable if e.message =~ /\\(127\\)/\n\n # Otherwise, just raise the error up\n raise\n end", "def setup(credentials = {})\n requires :public_key, :public_ip_address, :username\n\n credentials[:password] = password unless self.password.nil?\n credentails[:key_data] = [private_key] if self.private_key\n\n commands = [\n %{mkdir .ssh},\n ]\n if public_key\n commands << %{echo \"#{public_key}\" >> ~/.ssh/authorized_keys}\n end\n\n # wait for domain to be ready\n Timeout::timeout(360) do\n begin\n Timeout::timeout(8) do\n Fog::SSH.new(public_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')\n end\n rescue Errno::ECONNREFUSED\n sleep(2)\n retry\n rescue Net::SSH::AuthenticationFailed, Timeout::Error\n retry\n end\n end\n Fog::SSH.new(public_ip_address, username, credentials).run(commands)\n end", "def initialize\n @name = \"\"\n @public_key = nil\n @private_key = nil\n @admin = false\n @validator = false\n @create_key = nil\n end", "def initialize(options = {})\n require_options(options, [:name, :key_name, :image_id])\n @name = options[:name]\n @key_name = options[:key_name]\n @image_id = options[:image_id]\n @instance_type = options[:instance_type]\n @security_groups = options[:security_groups]\n end", "def initialize up_stream\n super(up_stream)\n end", "def initialize(host, user, comm = nil)\n\n ssh_opts = {\n :port => host.port,\n :config => true,\n :keys => \"~/.ssh/id_rsa\",\n :verbose => :debug,\n :timeout => 20\n #:paranoid => true\n }\n\n ssh_opts.merge!(:password => host.pass) if host.pass && host.pass != \"\"\n p ssh_opts\n Net::SSH.start(host.addr, user, ssh_opts) do |ssh|\n # puts hostname = ssh.exec_with_status(\"hostname\").result\n if comm\n ex = ssh.exec_with_status(comm)\n ssh.loop\n @buffer = ex.result\n\n else\n @result = { }\n for sample in Stat::comm(host)\n puts \"Executing #{sample}\"\n @result[sample[0]] = ssh.exec_with_status(sample[1])\n end\n\n ssh.loop\n @result.map { |k, v| @result[k] = v.result}\n s = host.stats.create(@result)\n end\n\n #s.save!\n end\n end", "def scp?\n true\n end", "def initialize\n @totalReadData = 0\t\t# variable for counting bytes read from rsync\n @rsync_path = \"/opt/local/bin/rsync\"\n end", "def initialize\n @ups = UPS.new(:login => UPS_LOGIN, :password => UPS_PASSWORD, :key => UPS_KEY)\n end", "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[command data]\n end", "def initialize(attributes = {})\n super\n self.api_endpoint ||= Orias.configuration.api_endpoint\n self.per_request ||= Orias.configuration.per_request\n self.private_key ||= Orias.configuration.private_key\n end", "def initialize(key, secret)\n super()\n self.key = key\n self.secret = secret\n end", "def ssh_common_opts\n [\"-i #{@machine.ssh_info[:private_key_path]}\",\n \"-p #{@machine.ssh_info[:port]}\",\n \"-o StrictHostKeyChecking=no\",\n \"-o UserKnownHostsFile=/dev/null\",\n \"-o IdentitiesOnly=yes\",\n \"-o LogLevel=ERROR\"]\n end", "def initialize(account=nil)\n if account == nil\n account = Etc.getlogin\n end\n\n @account = account\n @agent = Net::SSH::Authentication::Agent.new\n @use_agent = true\n @use_authorized_keys = true\n @sshd_config_file = \"/etc/ssh/sshd_config\"\n @authorized_keys_file = nil\n @logger = Logger.new(STDERR)\n @logger.level = $DEBUG ? Logger::DEBUG : Logger::WARN\n @keys = []\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(sewn, shreds=sewn, m=2, n: m)\n @sewn = sewn\n @shreds = shred_files(shreds, n)\n raise \"Need at least 2 shreds\" unless @shreds.length > 1\n end", "def initialize(command_output = run_command)\n @command_output = command_output\n @physical_disks = PhysicalDiskList.new\n @partitions = PartitionList.new\n end", "def initialize(host, user, password, options = {})\n @host = host\n @user = user\n @password = password\n @status = 0\n @shell = nil\n @options = {\n :password => @password,\n :remember_host => false,\n :verbose => :warn,\n :non_interactive => true,\n :use_agent => false\n }.merge(options)\n\n # Pull the 'remember_host' key out of the hash because the SSH initializer will complain\n @remember_host = @options.delete(:remember_host)\n @su_user = @options.delete(:su_user)\n @su_password = @options.delete(:su_password)\n @passwordless_sudo = @options.delete(:passwordless_sudo)\n\n # Obsolete, delete if passed in\n @options.delete(:authentication_prompt_delay)\n end", "def initialize(creds)\n if(creds[:rackspace_region].to_s == 'lon')\n endpoint = AUTH_ENDPOINT[:uk]\n else\n endpoint = AUTH_ENDPOINT[:us]\n end\n super Smash.new(\n :open_stack_username => creds[:rackspace_username],\n :open_stack_token => creds[:rackspace_api_key],\n :open_stack_region => creds[:rackspace_region],\n :open_stack_identity_url => endpoint\n )\n end", "def initialize(flavor = 1, image = 112, name = 'my_server', instance = nil)\n region = config.get(:region)\n connection = self.class.find_service(region)\n\n # Get our SSH key to attach it to the server.\n instance ? @node = instance : @node = build(connection, flavor, image, name)\n end", "def create_ssh_setup\n command = \"echo 'y\\\\\\n' \\| ssh-keygen -f /tmp/#{@name_args[0]}.key -N \\\"\\\" -P \\\"\\\"\"\n result = run_remote_command(command)\n\n if config[:username].eql? \"root\"\n auth_keys_file = '/root/.ssh/authorized_keys'\n else\n auth_keys_file = \"/home/#{config[:username]}/.ssh/authorized_keys\"\n end\n\n # we don't want to overwrite anything that may already exist here\n command = \"echo \\\"\\##{@name_args[0]}\\\" >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key.pub >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"chmod 0600 #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key\"\n ssh_key = run_remote_command(command)\n end", "def initialize(command_output = run_command)\n @command_output = command_output\n @disks = PartitionList.new\n end", "def ssh_create(host, user, key)\n\n if key.start_with?('-----BEGIN RSA PRIVATE KEY-----')\n ssh = Net::SSH.start(host, user,\n {\n :key_data => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n elsif File.exist?(key)\n ssh = Net::SSH.start(host, user,\n {\n :key_data => IO.read(key),\n :user_known_hosts_file => \"/dev/null\"\n } )\n else\n ssh = Net::SSH.start(host, user,\n {\n :password => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n end\n\n ssh\n end", "def initialize()\n props = project_properties\n \n @app_id = props[:id]\n @app_name = props[:name]\n @app_is_desktop = props[:desktop]\n end", "def initialize_buffered_io\n @input = Net::SSH::Buffer.new\n @input_errors = []\n @output = Net::SSH::Buffer.new\n @output_errors = []\n end", "def setup_server(s)\n unless s.public_key.nil? || s.public_key.empty?\n s.setup(:password => s.password)\n end\n end", "def setup_server(s)\n unless s.public_key.nil? || s.public_key.empty?\n s.setup(:password => s.password)\n end\n end", "def initialize(*args)\r\n super\r\n @action = :assign\r\nend", "def initialize(task, stream)\n super(stream)\n\n begin\n @type = stream.type\n rescue Exception => e\n raise InitializePortError.new( e.message, @name )\n end\n @task = task\n @connections = Set.new\n @current_data = nil\n @tracked = false\n @readers = Array.new\n @last_update = Time.now\n end", "def sftp\n @_sftp ||= Net::SFTP.start(host, user, options)\n end", "def initialize(args={})\n @cfg = {\n :path => \"/Users/cremes/dev/mygit/proto-rina/README.md\", \n :id => 25,\n :len => 1024,\n :mode => Shared::IPC_CREAT, \n :access => Shared::IPC_W | Shared::IPC_R\n }\n @cfg.merge! args\n @key = Shared::try(\"ftok\") {Shared::ftok(@cfg[:path], @cfg[:id])}\n @id = Shared::try(\"shmget\") {Shared::shmget(@key, @cfg[:len], 0666 | @cfg[:mode])}\n p @id, @key, @cfg[:len], (0666 | @cfg[:mode])\n @mem = Shared::shmat(@id, 0, @cfg[:access])\n p @mem, @id\n end", "def initialize\n define_os\n define_path\n read_settings\n end", "def initialize(socket, direct = false, versions = [1, 2, 3], always_encrypt: true, backend: nil)\n self.socket = socket\n self.direct = direct\n self.versions = versions\n self.shares = {}\n self.server_max_buffer_size = 1024 # 4356 (workstation) or 16644 (server) expected\n\n if (self.versions == [1] && backend.nil?) || backend == :rex\n self.client = Rex::Proto::SMB::Client.new(socket)\n elsif (backend.nil? || backend == :ruby_smb)\n self.client = RubySMB::Client.new(RubySMB::Dispatcher::Socket.new(self.socket, read_timeout: 60),\n username: '',\n password: '',\n smb1: self.versions.include?(1),\n smb2: self.versions.include?(2),\n smb3: self.versions.include?(3),\n always_encrypt: always_encrypt\n )\n self.client.evasion_opts = {\n # Padding is performed between packet headers and data\n 'pad_data' => EVADE::EVASION_NONE,\n # File path padding is performed on all open/create calls\n 'pad_file' => EVADE::EVASION_NONE,\n # Modify the \\PIPE\\ string in trans_named_pipe calls\n 'obscure_trans_pipe' => EVADE::EVASION_NONE,\n }\n end\n end", "def initialize\n self.imap = OpenStruct.new\n self.smtp = OpenStruct.new\n self.service = OpenStruct.new\n self.application = OpenStruct.new\n end", "def initialize(resource = nil)\n super(resource)\n @compilator = PuppetX::Coi::Jboss::Internal::CommandCompilator.new\n @execlogic = PuppetX::Coi::Jboss::Internal::ExecuteLogic.new\n @cli_executor = nil\n ensure_cli_executor\n end", "def initialize(*args)\n super\n @action = :create\n @provider = Chef::Provider::LinodeDomainApi\nend", "def initialize\n super\n\n if self.prototype.nil?\n self.prototype = Prototype.new(:configurable => self)\n self.prototype.save\n end\n end", "def start\n begin\n SSH::Home.new( ssh_home, @debug_options ).setup\n rescue\n maybe_cleanup_old_key_pair\n ssh_keygen\n retry unless dry_run\n end\n end" ]
[ "0.63484156", "0.62579525", "0.58904535", "0.56857866", "0.564141", "0.5612764", "0.55691224", "0.5514253", "0.54923546", "0.54875916", "0.5448789", "0.53873605", "0.53124034", "0.5292555", "0.5263233", "0.52530557", "0.5239517", "0.5230193", "0.52048624", "0.5201732", "0.51754904", "0.5168015", "0.5149823", "0.5139631", "0.5130742", "0.51262444", "0.5125597", "0.51232827", "0.5121608", "0.51022", "0.50850695", "0.5084926", "0.50545955", "0.50533104", "0.50188833", "0.5016096", "0.5013224", "0.50088507", "0.50088507", "0.50088507", "0.50088507", "0.49947616", "0.49934283", "0.49923453", "0.49876934", "0.4980866", "0.49660623", "0.49517176", "0.49460706", "0.493307", "0.49311998", "0.49302322", "0.49286026", "0.49273577", "0.49256358", "0.4915989", "0.49071327", "0.49065349", "0.490501", "0.4904981", "0.49045554", "0.48897547", "0.48785827", "0.48782608", "0.48759338", "0.48744586", "0.48731935", "0.48688495", "0.48581135", "0.4847184", "0.48450646", "0.4844087", "0.48381242", "0.48381242", "0.48381242", "0.48381242", "0.48381242", "0.48332196", "0.4830035", "0.48290426", "0.48247987", "0.481974", "0.4813826", "0.4811777", "0.48114693", "0.48110306", "0.4809866", "0.48087242", "0.48087242", "0.48079938", "0.48072526", "0.48045316", "0.48014843", "0.47896123", "0.4782745", "0.47826505", "0.47820234", "0.4780081", "0.4779716", "0.47724736" ]
0.6842911
0
execute command on remote host (if dryRun is false), yielding lines of output N Without this, won't be able to execute ssh commands using an external ssh application
def ssh(commandString, dryRun) #N Without this, command being executed won't be echoed to output puts "SSH #{userAtHost} (#{shell.join(" ")}): executing #{commandString}" #N Without this check, the command will execute even it it's meant to be a dry run if not dryRun #N Without this, the command won't actually execute and return lines of output output = getCommandOutput(shell + [userAtHost, commandString]) #N Without this loop, the lines of output won't be processed while (line = output.gets) #N Without this, the lines of output won't be passed to callers iterating over this method yield line.chomp end #N Without closing, the process handle will leak resources output.close() #N Without a check on status, a failed execution will be treated as a success (yielding however many lines were output before an error occurred) checkProcessStatus("SSH #{userAtHost} #{commandString}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh(commandString, dryRun)\n #N Without this we won't have a description to display (although the value is only used in the next statement)\n description = \"SSH #{user}@#{host}: executing #{commandString}\"\n #N Without this the command description won't be echoed\n puts description\n #N Without this check, the command will execute even when it's only meant to be a dry run\n if not dryRun\n #N Without this, the command won't execute, and we won't have the output of the command\n outputText = connection.exec!(commandString)\n #N Without this check, there might be a nil exception, because the result of exec! can be nil(?)\n if outputText != nil then\n #N Without this, the output text won't be broken into lines\n for line in outputText.split(\"\\n\") do\n #N Without this, the code iterating over the output of ssh won't receive the lines of output\n yield line\n end\n end\n end\n end", "def ssh(commandString, dryRun = false)\n #N Without this, the command won't actually be executed\n sshAndScp.ssh(commandString, dryRun) do |line|\n #N Without this, this line of output won't be available to the caller\n yield line\n end\n end", "def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end", "def remote_shell args\n remote(args) do |ssh|\n command = true\n while command\n print \"> \"\n command = gets\n if command\n result = ssh.exec! command\n puts result.split(\"\\n\").awesome_inspect if not result.nil?\n end\n end\n ssh.exec! \"exit\"\n end\n end", "def ssh(commandString, dryRun = false)\n contentHost.sshAndScp.ssh(commandString, dryRun)\n end", "def run(command)\n result = connection.exec!(command)\n puts \"[BEGIN #{@host}: #{command}]\"\n puts \" #{result}\"\n puts \"[END #{@host}: #{command}]\"\n end", "def ssh_exec!(ssh, command)\n stdout_data = ''\n stderr_data = ''\n exit_code = nil\n exit_signal = nil\n ssh.open_channel do |channel|\n channel.exec(command) do |_ch, success|\n unless success\n abort 'FAILED: couldn\\'t execute command (ssh.channel.exec)'\n end\n channel.on_data do |_ch, data|\n stdout_data += data\n puts stdout_data\n end\n\n channel.on_extended_data do |_ch, _type, data|\n stderr_data += data\n puts stderr_data\n end\n\n channel.on_request('exit-status') do |_ch, data|\n exit_code = data.read_long\n end\n\n channel.on_request('exit-signal') do |_ch, data|\n exit_signal = data.read_long\n end\n end\n end\n ssh.loop\n [stdout_data, stderr_data, exit_code, exit_signal]\nend", "def ssh_exec_simple!(ssh, command, print_no_chain) \n out, err, exit_code = ssh_exec!(ssh, command, print_no_chain)\n abort err if exit_code != 0\n\n # try converting the output to prettified JSON.\n begin\n parsed = JSON.parse(out) \n return JSON.pretty_generate(parsed)\n rescue\n # otherwise, just return the string as-is.\n return out\n end\nend", "def remote_command command, options={}\n return unless running?\n returning({ :stdout => '', :stderr => '', :exit_status => nil }) do |output|\n remote_stdout, remote_stderr, exit_code = '', '', nil\n Net::SSH.start(public_ip, options[:user] || \"root\", {:paranoid => false}.merge(options)) do |connection|\n connection.open_channel do |channel|\n channel.on_data { |ch, data| output[:stdout] += data }\n channel.on_extended_data { |ch, type, data| output[:stderr] += data }\n channel.on_request(\"exit-status\") do |p, data|\n output[:exit_status] = data.read_long\n end\n channel.exec(command) do |ch, executing|\n raise \"Could not execute: #{command}\" unless executing\n end\n end\n end\n end\n end", "def ssh_exec!(ssh)\n output_data = ''\n exit_code = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.exec(@command) do |ch, success|\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\" unless success\n\n channel.on_data do |_, data|\n output_data += data\n yield data if block_given?\n end\n\n channel.on_extended_data do |_, type, data|\n output_data += data\n yield data if block_given?\n end\n\n channel.on_request('exit-status') { |_, data| exit_code = data.read_long }\n\n channel.on_request('exit-signal') { |_, data| exit_signal = data.read_long }\n end\n end\n\n ssh.loop\n [output_data, exit_code, exit_signal]\n end", "def run(*args)\n case args.size\n when 3\n ssh_host, ssh_user, ssh_command = args \n when 2\n ssh_host, ssh_command = args\n ssh_user = self.user\n when 1\n ssh_host, ssh_user = self.host, self.user\n ssh_command = args.first\n else\n raise ArgumentError\n end\n return ssh_host.map{|host| run(host, ssh_user, ssh_command)} if ssh_host.is_a? Array\n \n key = \"#{ssh_user}@#{ssh_host}\"\n puts \" #{key}$ #{ssh_command}\"\n @ssh_sessions[key] ||= Net::SSH.start(ssh_host, ssh_user)\n output = @ssh_sessions[key].exec!(ssh_command)\n puts output.split(\"\\n\").map{|l| \" #{key}> #{l}\"}.join(\"\\n\") if output\n output\n end", "def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend", "def provision_execute(s, commands)\n errors = []\n return errors if (commands.nil? or commands.empty?)\n \n if (!get_field(\"cloud_ips\").nil? and !get_field(\"cloud_ips\").empty?)\n host = get_field(\"cloud_ips\")[0]\n elsif (!get_field(\"cloud_private_ips\").nil? and !get_field(\"cloud_private_ips\").empty?)\n host = get_field(\"cloud_private_ips\")[0]\n else\n msg = \"No IP address associated to the machine #{host} - cannot run SSH command\"\n errors << msg\n log_output(msg, :info)\n return errors\n end\n \n ssh_password = get_field('ssh_password')\n ssh_options = {}\n msg = \"Running SSH Commands On New Machine #{s.username}@#{host}\"\n msg_options = {}\n if (ssh_password and !ssh_password.empty?)\n ssh_options[:password] = ssh_password\n msg_options[:password] = \"*\" * ssh_password.size\n end\n msg_options[:private_key_path] = s.private_key_path if s.private_key_path\n msg_options[:private_key] = mask_private_key(s.private_key.strip) if s.private_key # show only last 5 chars\n log_output(\"#{msg} using #{msg_options}: #{commands.join(\", \")}\", :info)\n\n for i in 1..10\n begin\n log_output(\"[#{host}] Running Commands:\\n #{commands.join(\"\\n \")}\\n\")\n responses = s.ssh(commands, ssh_options) do |data, extended_data|\n write_output(data, :buffer => true) unless data.empty? #stdout\n write_output(extended_data, :buffer => true) unless extended_data.empty? #stderr\n end\n\n responses.each do |result|\n if result.status != 0\n msg = \"[#{host}] Command '#{result.command}' failed with status #{result.status}\"\n errors << msg\n log_output(msg, :info)\n end\n end unless responses.nil?\n break\n rescue Errno::EHOSTUNREACH, Timeout::Error, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Net::SSH::Disconnect => e\n log_output(\"[#{host}] Try #{i} - failed to connect: #{e}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"[#{host}] Try #{i} - failed to connect: authentication failed for user #{e.message}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts, authentication failed for user #{e.message}\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n end\n end\n return errors\n end", "def run_command(user, host, cmd)\n ping(user, host) do\n my_text = IO.popen(\"ssh #{user}@#{host} 'bash'\", \"w+\")\n my_text.write(cmd)\n my_text.close_write\n my_rtn = my_text.readlines.join('\\n')\n Process.wait(my_text.pid)\n my_text.close\n return my_rtn\n end\n end", "def exec(command, input = nil)\n result = command_results.build\n result.start! command, input\n exit_code = nil\n ssh_channel = @net_ssh.open_channel do |channel|\n channel.exec command do |_, success|\n if success\n channel.send_data input if input\n channel.eof!\n channel.on_data do |_, data|\n result.append_to_stdout! data\n end\n channel.on_extended_data do |_, type, data|\n result.append_to_stderr! data if type == :stderr\n end\n channel.on_request 'exit-status' do |_, data|\n exit_code = data.read_long\n end\n channel.on_request 'exit-signal' do |_, data|\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = data.read_long\n end\n else\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = 255\n channel.close\n end\n end\n end\n ssh_channel.wait\n result.completed! exit_code || 0\n end", "def execute_ssh(commands)\n commands = [commands] unless commands.is_a? Array\n result = \"\"\n Net::SSH.start settings.remote_server, settings.remote_user do |ssh|\n commands.each do |command|\n was_error = false\n logger.info \"ssh: #{command}\"\n ssh.exec! command do |channel, stream, data|\n case stream\n when :stdout\n logger.info data\n result += \"#{data}\\n\" unless data.empty?\n when :stderr\n logger.error data\n was_error = true\n end\n end\n throw \"Exception during ssh, look in log file\" if was_error\n end\n end\n result\n end", "def exec(*args)\n command = args.shift\n\n arguments = Array.new\n arguments << %(sudo) if (@use_sudo == true)\n arguments << command\n arguments << args\n arguments = arguments.flatten.compact.join(' ')\n\n output = Array.new\n\n if @ssh.is_a?(ZTK::SSH)\n output << @ssh.exec(arguments, :silence => true, :ignore_exit_status => true).output\n else\n if @ssh.respond_to?(:exec!)\n output << @ssh.exec!(arguments)\n else\n raise SSHError, \"The object you assigned to ssh does not respond to #exec!\"\n end\n end\n\n output.join.strip\n end", "def exec_cmd cmd\n t = Time.now\n results = \"\"\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch,success|\n unless success\n Logger.<<(__FILE__,\"INFO\",\"Could Not execute command #{cmd}\")\n abort\n end\n # stdout\n channel.on_data do |ch,data|\n results += data\n end\n # stderr\n channel.on_extended_data do |ch,type,data|\n Logger.<<(__FILE__,\"ERROR\",\"Error from the cmd #{cmd} : #{data}\")\n abort\n end\n channel.on_close do |ch|\n end\n end\n end\n # wait for the command to finish\n @ssh.loop\n Logger.<<(__FILE__,\"DEBUG\",\"SFTP Command executed in #{Time.now - t} sec\") if @opts[:v]\n results.split\n end", "def execute(command)\n if remote?\n @remote.exec(command)\n else\n rays_exec(command)\n end\n end", "def ssh_execute(server, username, password, key, cmd)\n return lambda {\n exit_status = 0\n result = []\n\n params = {}\n params[:password] = password if password\n params[:keys] = [key] if key\n\n begin\n Net::SSH.start(server, username, params) do |ssh|\n puts \"Connecting to #{server}\"\n ch = ssh.open_channel do |channel|\n # now we request a \"pty\" (i.e. interactive) session so we can send data\n # back and forth if needed. it WILL NOT WORK without this, and it has to\n # be done before any call to exec.\n\n channel.request_pty do |ch_pty, success|\n raise \"Could not obtain pty (i.e. an interactive ssh session)\" if !success\n end\n\n channel.exec(cmd) do |ch_exec, success|\n puts \"Executing #{cmd} on #{server}\"\n # 'success' isn't related to bash exit codes or anything, but more\n # about ssh internals (i think... not bash related anyways).\n # not sure why it would fail at such a basic level, but it seems smart\n # to do something about it.\n abort \"could not execute command\" unless success\n\n # on_data is a hook that fires when the loop that this block is fired\n # in (see below) returns data. This is what we've been doing all this\n # for; now we can check to see if it's a password prompt, and\n # interactively return data if so (see request_pty above).\n channel.on_data do |ch_data, data|\n if data =~ /Password:/\n password = get_sudo_pw unless !password.nil? && password != \"\"\n channel.send_data \"#{password}\\n\"\n elsif data =~ /password/i or data =~ /passphrase/i or\n data =~ /pass phrase/i or data =~ /incorrect passphrase/i\n input = get_input_for_pw_prompt(data)\n channel.send_data \"#{input}\\n\"\n else\n result << data unless data.nil? or data.empty?\n end\n end\n\n channel.on_extended_data do |ch_onextdata, type, data|\n print \"SSH command returned on stderr: #{data}\"\n end\n\n channel.on_request \"exit-status\" do |ch_onreq, data|\n exit_status = data.read_long\n end\n end\n end\n ch.wait\n ssh.loop\n end\n if $debug\n puts \"==================================================\\nResult from #{server}:\"\n puts result.join\n puts \"==================================================\"\n end\n rescue Net::SSH::AuthenticationFailed\n exit_status = 1\n puts \"Bad username/password combination\"\n rescue Exception => e\n exit_status = 1\n puts e.inspect\n puts e.backtrace\n puts \"Can't connect to server\"\n end\n\n return exit_status\n }\n end", "def ssh( commands=[], extra_ssh_ops={})\n commands = commands.compact.join(' && ') if commands.is_a?(Array)\n cmd_string = \"ssh #{user}@#{host} #{ssh_options(extra_ssh_ops)} \"\n if commands.empty?\n #TODO: replace this with a IO.popen call with read_nonblocking to show progress, and accept input\n Kernel.system(cmd_string)\n else\n system_run(cmd_string+\"'#{commands}'\")\n end\n end", "def remote_command(command)\n socket = TCPSocket.new(@host, @port)\n socket.puts command\n\n data = \"\"\n until (line = socket.readline) =~ /END/\n data << line\n end\n\n socket.close\n data\n end", "def execute!(command=nil)\n @command = command if command\n @result = \"\"\n if @ruby_impl\n # pure ruby implementation call\n rsh_ruby do |line|\n yield(line) if block_given?\n @result << line\n end\n else\n # OS'es rsh(1) call\n open \"|#{@executable} #{\"-n\" if @nullr} -l#{@ruser} -t#{@to} #{@host} #{@command}\" do |io|\n io.each do |line|\n yield(line) if block_given?\n @result << line\n end\n end\n end\n @result\n end", "def execute\n begin\n rout, wout = IO.pipe\n rerr, werr = IO.pipe\n stdout, stderr = nil\n\n pid = Process.spawn(command_line, :pgroup => true, :out => wout, :err => werr)\n Timeout.timeout(timeout) do\n Process.wait(pid)\n\n wout.close\n werr.close\n\n stdout = rout.readlines.join\n stderr = rerr.readlines.join\n end\n rescue Timeout::Error\n Process.kill(-9, pid)\n Process.detach(pid)\n ensure\n wout.close unless wout.closed?\n werr.close unless werr.closed?\n\n rout.close\n rerr.close\n end\n stdout\n end", "def ssh_exec(command)\n stdout_data = ''\n stderr_data = ''\n exit_status = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.request_pty do |ch, success|\n raise 'Could not obtain pty' unless success\n\n ch.on_data do |ch, data|\n good_info data\n\n if data.match /sudo\\] password/\n unless ssh_options[:password]\n ssh_options[:password] = prompt(\"\\n<ROSH> Enter your password: \", false)\n end\n\n ch.send_data \"#{ssh_options[:password]}\\n\"\n ch.eof!\n end\n\n stdout_data << data\n end\n\n run_info(command)\n r = ch.exec(command)\n channel.close if r\n end\n\n channel.on_extended_data do |_, data|\n bad_info data.to_s\n stderr_data << data\n end\n\n channel.on_request('exit-status') do |_, data|\n exit_status = data.read_long\n end\n\n channel.on_request('exit-signal') do |_, data|\n exit_signal = data.read_long\n end\n end\n\n ssh.loop\n\n SSHResult.new(stdout_data, stderr_data, exit_status, exit_signal)\n end", "def run( command, expected_exitcode = 0, sudo = self.uses_sudo? )\n\n cmd = {\n :command => command,\n :sudo => sudo,\n :stdout => String.new,\n :stderr => String.new,\n :expected_exitcode => Array( expected_exitcode ),\n :exitcode => nil,\n :final_command => sudo ? sprintf( 'sudo bash -c \"%s\"', command ) : command,\n }\n\n if @ssh.nil?\n self.connect_ssh_tunnel\n end\n\n @logger.info( sprintf( 'vm running: [%s]', cmd[:final_command] ) ) # TODO decide whether this should be changed in light of passthroughs.. 'remotely'?\n\n 0.upto(@retries) do |try|\n begin\n if self.is_passthrough? and self.passthrough[:type].eql?(:local)\n cmd[:stdout] = `#{cmd[:final_command]}`\n cmd[:exitcode] = $?\n else\n cmd = remote_exec( cmd )\n end\n break\n rescue => e\n @logger.error(sprintf('failed to run [%s] with [%s], attempt[%s/%s]', cmd[:final_command], e, try, retries)) if self.retries > 0\n sleep 10 # TODO need to expose this as a variable\n end\n end\n\n if cmd[:stdout].nil?\n cmd[:stdout] = \"error gathering output, last logged output:\\nSTDOUT: [#{self.get_ssh_stdout}]\\nSTDERR: [#{self.get_ssh_stderr}]\"\n cmd[:exitcode] = 256\n elsif cmd[:exitcode].nil?\n cmd[:exitcode] = 255\n end\n\n self.ssh_stdout.push( cmd[:stdout] )\n self.ssh_stderr.push( cmd[:stderr] )\n self.ssh_exitcode.push( cmd[:exitcode] )\n @logger.debug( sprintf( 'ssh_stdout: [%s]', cmd[:stdout] ) )\n @logger.debug( sprintf( 'ssh_stderr: [%s]', cmd[:stderr] ) )\n\n unless cmd[:expected_exitcode].member?( cmd[:exitcode] )\n # TODO technically this could be a 'LocalPassthroughExecutionError' now too if local passthrough.. should we update?\n raise RemoteExecutionError.new(\"stdout[#{cmd[:stdout]}], stderr[#{cmd[:stderr]}], exitcode[#{cmd[:exitcode]}], expected[#{cmd[:expected_exitcode]}]\")\n end\n\n cmd[:stdout]\n end", "def exec!(command, timeout=nil)\n logger.info(\"Executing: #{command}\")\n stderr,stdout = '', ''\n stdout, stderr = timeout_execution(timeout, \"exec!(#{command})\") do\n @connection_pool.exec(command)\n end\n logger.info(\"STDERR: #{stderr}\") unless stderr.empty?\n logger.info(\"STDOUT: #{stdout}\") unless stdout.empty?\n logger.info(\"Executing done\")\n stdout\n end", "def simple_ssh_command(host, user, command, timeout = 300)\n over_ssh(host: host, user: user, timeout: timeout) do |server|\n server.cd '/tmp'\n # Need to use sudo\n server.enable_sudo\n # scary...\n server.disable_safe_mode\n\n server.execute command\n end\n end", "def execute_ssh_command(command)\n\t\tresult = ''\n\t\tNet::SSH.start(ip_string, settings.ssh[\"user\"]) do |ssh|\n\t\t\tresult = ssh.exec!(\"cmd /c #{command}\")\n\t\tend\n\t\tresult\n\tend", "def run!\n while @commands.length > 0\n command = @commands.shift\n puts command\n @run_success = run command unless @dry_run\n end \n end", "def exec_command(command)\n log = ''\n puts \"\\n=> Executing \\\"#{command}\\\"\"\n log += \"\\n\\n=> Executing \\\"#{command}\\\"\\n\"\n Open3.popen2e(command) { |stdin, stdout_and_stderr, wait_thr|\n stdout_and_stderr.each {|line|\n puts line\n log += line\n }\n }\n return log\nend", "def exec(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t @ssh_session.open_channel do |ch|\n\t @@logger.info(\"Executing command '#{command}'\")\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.debug(\"Command sucessfully executed\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n end\n ch.on_close do |ch|\n @close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n @close_handler.call() unless @close_handler.nil?\n end\n\n ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"\")\n exit_status = 127\n end\n end\n\t ch.wait\n\t end\n\t\n\t return exit_status\n\tend", "def runner_execute!(host, commands, options = {})\n result = host.execute commands, options\n if result && result[1] == :stdout\n Trooper.logger.info \"#{result[2]}\\n\"\n true\n else \n false\n end\n end", "def remote_command(command)\n return %x(ssh #{self.sar_host} \"#{command}\")\n end", "def run_ssh(host, shell_command, ssh_timeout = 60)\n begin\n # define basic query\n ssh_query = {\n :ssh_host => host,\n :ssh_auth_type => :password, # password is set on ssh method (default per os during provisioning)\n :ssh_timeout => ssh_timeout,\n :ssh_debug => @debug,\n :ssh_command => shell_command\n }\n\n # instantiate the ssh method and pull the command status\n $evm.instantiate(SSH_INSTANCE_PATH + '?' + ssh_query.to_query)\n status = $evm.root['ssh_command_status']\n\n # pull and inspect our results if we succeeded\n if status\n results = $evm.root['ssh_results']\n return results\n else\n log(:error, \"run_ssh: Command #{shell_command} failed. Returning nil.\")\n return nil\n end\n rescue => err\n log(:error, \"run_ssh: Unable to run command: #{shell_command}. Returning nil.\")\n return nil\n end\nend", "def exec(cmd)\n\t\tbegin\n\t\t\tout = cmd_exec(cmd).chomp\n\t\trescue ::Timeout::Error => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\trescue EOFError => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\tend\n\tend", "def exec(command, options={})\n ssh.exec(command, options)\n end", "def execute(command, live_stream = false)\n machine = @chef_provisioning.connect_to_machine(name, @current_chef_server)\n machine.execute_always(command, stream: live_stream)\n end", "def executeCommand(command, dryRun)\n #N Without this, the command won't be echoed to the user\n puts \"EXECUTE: #{command}\"\n #N Without this check, the command will be executed, even though it is intended to be a dry run\n if not dryRun\n #N Without this, the command won't be executed (when it's not a dry run)\n system(command)\n #N Without this, a command that fails with error will be assumed to have completed successfully (which will result in incorrect assumptions in some cases about what has changed as a result of the command, e.g. apparently successful execution of sync commands would result in the assumption that the remote directory now matches the local directory)\n checkProcessStatus(command)\n end\n end", "def command_send(command)\n\t\t# Check target\n\t\traise \"Target machine is not accessible\" if (!@config[\"ssh\"] or !@ip)\n\n\t\t# Prepare command\n\t\tcommand = command.gsub('\"', '\\\\\"')\n\t\tcommand = command.gsub('$', '\\\\$')\n\n\t\t# Execute and return result\n\t\t_ssh = `ssh -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" -t #{@config[\"ssh\"][\"username\"]}@#{@ip} \"#{command}\" 2>/dev/null`\n\t\treturn _ssh.strip\n\tend", "def ssh_exec!(ssh, command)\n\n stdout_data = \"\"\n stderr_data = \"\"\n exit_code = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.exec(command) do |ch, success|\n unless success\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\"\n end\n channel.on_data do |ch,data|\n stdout_data+=data\n end\n\n channel.on_extended_data do |ch,type,data|\n stderr_data+=data\n end\n\n channel.on_request(\"exit-status\") do |ch,data|\n exit_code = data.read_long\n end\n\n channel.on_request(\"exit-signal\") do |ch, data|\n exit_signal = data.read_long\n end\n end\n end\n ssh.loop\n\n {\n :out => stdout_data,\n :err => stderr_data,\n :exit_code => exit_code,\n :exit_signal => exit_signal\n }\n end", "def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end", "def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end", "def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n sleep = opts.fetch(:sleep, 1)\n\n # Variable to store our execution result\n r = nil\n\n retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n raise LXC::Errors::ExecuteError, :command => command.inspect\n end\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n r.stdout.gsub(\"\\r\\n\", \"\\n\")\n end", "def dispatch(command, return_output = false)\n Vanagon::Utilities.remote_ssh_command(\"#{@target_user}@#{@target}\", command, @target_port, return_command_output: return_output)\n end", "def remote_command(type, command, options)\n # If the VM is not running, then we can't run SSH commands...\n raise Errors::VMNotRunningError if @vm.state != :running\n\n # Initialize the result object, execute, and store the data\n result = OpenStruct.new\n result.stderr = \"\"\n result.stdout = \"\"\n result.exit_code = @vm.channel.send(type, command,\n :error_check => false) do |type, data|\n if type == :stdout\n result.stdout += data\n elsif type == :stderr\n result.stderr += data\n end\n\n # If we're echoing data, then echo it!\n if options[:echo]\n @vm.ui.info(data.to_s,\n :prefix => false,\n :new_line => false)\n end\n end\n\n # Return the result\n result\n end", "def cmd_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\n\t\t\t\tprin_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 #{cmd}: #{e.class} #{e}\")\n\t\tend\n\telse\n\t\tbegin\n print_status \"\\trunning command #{cmdexe}\"\n r = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => false})\n r.close\n rescue ::Exception => e\n print_status(\"Error Running Command #{cmd}: #{e.class} #{e}\")\n end\n\tend\nend", "def run(command)\n retried = false\n\n begin\n result = ssh_exec(command)\n Rosh::Shell::CommandResult.new(nil, result.exit_status, result.stdout, result.stderr)\n rescue StandardError => ex\n log \"Error: #{ex.class}\"\n log \"Error: #{ex.message}\"\n log \"Error: #{ex.backtrace.join(\"\\n\")}\"\n\n if ex.class == Net::SSH::AuthenticationFailed\n if retried\n bad_info 'Authentication failed.'\n else\n retried = true\n password = prompt(\"\\n<ROSH> Enter your password: \", false)\n ssh_options.merge! password: password\n log \"Password added. options: #{ssh_options}\"\n @ssh = new_ssh\n retry\n end\n end\n\n if ex.class == Net::SSH::Disconnect\n if retried\n bad_info 'Tried to reconnect to the remote host, but failed.'\n else\n log 'Host disconnected us; retrying to connect...'\n retried = true\n @ssh = new_ssh\n run(command)\n retry\n end\n end\n\n Rosh::Shell::CommandResult.new(ex, 1)\n end\n end", "def exec_new(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t channel = @ssh_session.open_channel do |ch|\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.info(\"SshConnection: starts executing '#{command}'\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-status: #{exit_status}\")\n\t if exit_status != 0\n\t @@logger.error(\"SshConnection.on_request: Remote command execution failed with code: #{exit_status}\")\n\t end\n end\n\t ch.on_request \"exit-signal\" do |ch, data|\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-signal: #{data.read_string}\")\n\t end\n ch.on_close do |ch|\n\t @@logger.info(\"SshConnection.on_close: remote end is closing!\")\n #@close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n\t @@logger.info(\"SshConnection.on_eof: remote end is done sending data\")\n #@close_handler.call() unless @close_handler.nil?\n end\n\t ch.on_open_failed do |ch, code, desc|\n\t @@logger.info(\"SshConnection.on_open_failed: code=#{code} desc=#{desc}\")\n\t end\n\t ch.on_process do |ch|\n\t #@@logger.debug(\"SshConnection.on_process; send line-feed/sleep\")\n\t ch.send_data(\"\\n\")\n\t end\n\n #ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"SshConnection: the remote command could not be invoked!\")\n exit_status = 127\n end\n end\n\t #ch.wait\n\t end\n\t channel.wait\n\t return exit_status\n\tend", "def exec(command)\n cmd = Open3.popen3(command) do |i, o, e|\n i.close\n t0 = Thread.new do\n o.each_line do |line|\n $stdout.puts \" \" << line\n end\n end\n t1 = Thread.new do\n e.each_line do |line|\n $stderr.puts \" \" << line\n end\n end\n t0.join\n t1.join\n end\n end", "def execute(task_family, ip, command)\n cmd = \"docker exec -i -t `#{docker_ps_task(task_family)}` #{command}\"\n Open3.popen2e(ssh_cmd(ip) + \" '#{cmd}' \") do |stdin, stdout, stderr, status_thread|\n stdout.each_line do |line|\n puts line\n end\n end\n end", "def run_ssh_command(ssh_command, loops = 5, command_delay = 5)\n result = ''\n done = true\n (0...loops).each do\n begin\n Net::SSH.start(get_access_ip, 'ubuntu', keys: @aws_setup_information[@environment.to_sym][:keyPath]) do |ssh|\n result = ssh.exec!(ssh_command).to_s\n end\n rescue StandardError\n done = false\n sleep command_delay\n end\n break if done\n end\n result\n end", "def execute(*cmd)\n yield \"$ #{cmd.join(' ')}\" if block_given?\n output = ''\n\n Open3.popen2e(*cmd) do |_stdin, stdout_err, wait_thread|\n loop do\n line = stdout_err.gets\n break unless line\n\n output << line\n yield line if block_given?\n end\n\n exit_status = wait_thread.value\n raise ExecutionError, \"#{cmd.join(' ')} failed\" unless exit_status.success?\n end\n output\n end", "def run!\n old_sync = $stdout.sync\n $stdout.sync = true\n begin\n open(\"| #{@command}\", \"r\") do |file|\n until file.eof? do\n test_line = file.getc \n break unless test_line\n putc(test_line)\n @line.push(test_line)\n push_in_the_results(test_line)\n end\n end\n ensure\n $stdout.sync = old_sync\n end\n @results = @results.join\n self\n end", "def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend", "def stream_locally(cmd,opts={})\n shell = opts[:shell] || 'bash'\n tee = opts[:tee]\n redact = opts[:redact]\n redact_replacement = opts[:redact_replacment] || '-REDACTED-'\n cmd = [shell,'-c \"',cmd.gsub(/\"/,'\\\"'),'\" 2>&1'].join(' ')\n cmd_text = redact ? redact.inject(cmd.inspect){|ct,r| ct.gsub(r,redact_replacement)} : cmd.inspect\n logger.trace %Q{executing locally: #{cmd_text}} if logger\n $stdout.sync = true\n elapsed = Benchmark.realtime do\n Open3.popen3(cmd) do |stdin, out, err, external|\n # Create a thread to read from each stream\n { :out => out, :err => err }.each do |key, stream|\n Thread.new do\n until (line = stream.gets).nil? do\n redact.each {|r| line.gsub!(r,redact_replacement)} if redact\n $stdout << line\n File.open(tee,'a') {|f| f.write(line) } if tee\n end\n end\n end\n # Don't exit until the external process is done\n external.join\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd_text} returned status code #{$?}\"\n end\n end\n $stdout.sync = false\n logger.trace \"\\ncommand finished in #{(elapsed * 1000).round}ms\" if logger\n end", "def execute command, ignore_error=false\n @logger.debug command\n \n Open3.popen2e(command) do |stdin, stdout_err, wait_thr|\n while line = stdout_err.gets\n @logger.debug line\n end\n \n exit_status = wait_thr.value\n unless exit_status.success? || ignore_error == true\n raise \"Error executing command: #{command}\"\n end\n end\n end", "def exec(command, &block); end", "def run\n begin\n IO.popen(@cmd_line).read\n rescue\n @logger.error(\"Failed to execute command on #{@host}\")\n \"\"\n end\n end", "def run_command(cmd, *options, **shellout_options)\n so = Mixlib::ShellOut.new(create_command(cmd, *options), shellout_options)\n so.run_command\n so.error!\n so\n rescue Mixlib::ShellOut::ShellCommandFailed => e\n # Knife commands can include the password, so show a redacted version\n # of the command line along with the exit code, instead of the mixlib output\n pwd_index = options.index(\"--ssh-password\")\n options[pwd_index+1] = \"(hidden)\" if pwd_index && options.length > pwd_index+1\n redacted_cmd = create_command(cmd, options)\n message = \"#{redacted_cmd} returned #{so.exitstatus}\"\n if so.stderr\n message += \"\\n***********\\n\"\n message += so.stderr\n message += \"***********\\n\"\n end\n raise Runner::Exceptions::KnifeCommandFailed.new(message)\n end", "def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n sleep = opts.fetch(:sleep, 1)\n\n # Variable to store our execution result\n r = nil\n\n retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n raise LXC::Errors::SubprocessInterruptError, command.inspect\n else\n raise LXC::Errors::ExecuteError,\n command: command.inspect, stderr: r.stderr, stdout: r.stdout, exitcode: r.exit_code\n end\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n stdout = r.stdout.gsub(\"\\r\\n\", \"\\n\")\n if opts[:show_stderr]\n { :stdout => stdout, :stderr => r.stderr.gsub(\"\\r\\n\", \"\\n\") }\n else\n stdout\n end\n end", "def execute(*command, &block)\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info('Exit code != 0, but interrupted. Ignoring.')\n else\n # If there was an error running command, show the error and the\n # output.\n raise VagrantPlugins::Parallels::Errors::ExecutionError,\n command: command.inspect,\n stderr: r.stderr\n end\n end\n r.stdout\n end", "def execute!\n if Mcir::Core.instance.dryrun?\n Mcir::Core.instance.debug(\"CMD: \".purple << \"#{self.to_s.gsub(\"\\r\", \"\")}\")\n \"skipped execution due to dryrun\"\n else\n case @mode\n when :exec then exec(self.to_s)\n when :open then IO.new(self).open3\n when :capture then IO.new(self).capture3\n when :backticks then IO.new(self).backtick\n end\n end\n end", "def remote_exec(cmd)\n req = JsonRequest.new(\"remote_exec:exec\", [@agent_id, cmd])\n res = Bixby.client.exec_api(req)\n assert res\n assert_kind_of JsonResponse, res\n assert res.success?\n\n cr = CommandResponse.from_json_response(res)\n assert cr\n assert cr.success?, \"remote exec should succeed\"\n cr\n end", "def _ssh(path_of_servers, sshpass_command, user_exec_command)\n if path_of_servers.size == 0\n return \"#{sshpass_command} #{user_exec_command}\"\n end\n\n server = path_of_servers.shift\n #shell command needs double quote's escape\n sshpass_command += \"\\\"#{one_ssh_str(server)}\"\n _ssh(path_of_servers, sshpass_command, user_exec_command)\n end", "def echo(s)\n\n instructions = 'echo ' + s\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n @results[:echo] = r.chomp\n\n end", "def exec!(cmd)\n connect! unless @connected\n if using_ssh?\n logger.debug(\"ssh: \" + cmd)\n ssh_session.exec!(cmd)\n else\n logger.debug(cmd)\n `#{cmd}`\n end\n end", "def execute(command, params={})\n unless params[:dry_run]\n if params[:return]\n System.execute(command, :return => true)\n else\n $stdout.puts\n System.execute(command)\n end\n end\n end", "def m_exec(session, cmd)\n\tr = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})\n\tb = \"\"\n\twhile(d = r.channel.read)\n\t\tb << d\n\tend\n\tr.channel.close\n\tr.close\n\tb\nend", "def m_exec(session, cmd)\n\tr = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})\n\tb = \"\"\n\twhile(d = r.channel.read)\n\t\tb << d\n\tend\n\tr.channel.close\n\tr.close\n\tb\nend", "def !(*commands)\n options = commands.last.is_a?(Hash) ? commands.pop : {}\n\n commands.unshift(\"cd #{options[:base_path]}\") if options[:base_path]\n\n ssh_command = ssh_command(commands, config)\n\n log(:info, ssh_command)\n\n clear_inject\n response = nil\n\n if options.fetch(:interactive, false)\n response = system(ssh_command)\n else\n response = `#{ssh_command}`\n end\n log(:debug, \"SSH Response: #{response.to_s}\")\n\n response\n end", "def exec(cmd)\n container.exec(cmd) { |_, chunk| puts \"#{fqdn.purple}: #{chunk}\" }\n end", "def execute_remote_command(server, cmd)\n ssh(server, cmd).status == 0\n end", "def call command_str, options={}, &block\n Sunshine.logger.info @host, \"Running: #{command_str}\" do\n execute build_remote_cmd(command_str, options), &block\n end\n end", "def exec(cmd, done_string = nil, stdin = nil)\n error_buffer = \"\"\n output_buffer = \"\"\n status = 0\n signal = nil\n header = \"#{self.class}##{__method__}\"\n\n # If passwordless sudo is true then prepend every command with 'sudo'.\n cmd = 'sudo ' + cmd if @passwordless_sudo\n\n run_session do |ssh|\n ssh.open_channel do |channel|\n channel.exec(cmd) do |chan, success|\n raise \"#{header} - Could not execute command #{cmd}\" unless success\n\n $log&.debug(\"#{header} - Command: #{cmd} started.\")\n\n if stdin.present?\n chan.send_data(stdin)\n chan.eof!\n end\n\n channel.on_data do |_channel, data|\n $log&.debug(\"#{header} - STDOUT: #{data}\")\n output_buffer << data\n data.each_line { |l| return output_buffer if done_string == l.chomp } unless done_string.nil?\n end\n\n channel.on_extended_data do |_channel, _type, data|\n $log&.debug(\"#{header} - STDERR: #{data}\")\n error_buffer << data\n end\n\n channel.on_request('exit-status') do |_channel, data|\n status = data.read_long || 0\n $log&.debug(\"#{header} - STATUS: #{status}\")\n end\n\n channel.on_request('exit-signal') do |_channel, data|\n signal = data.read_string\n $log&.debug(\"#{header} - SIGNAL: #{signal}\")\n end\n\n channel.on_eof do |_channel|\n $log&.debug(\"#{header} - EOF RECEIVED\")\n end\n\n channel.on_close do |_channel|\n $log&.debug(\"#{header} - Command: #{cmd}, exit status: #{status}\")\n if signal.present? || status.nonzero? || error_buffer.present?\n raise \"#{header} - Command '#{cmd}' exited with signal #{signal}\" if signal.present?\n raise \"#{header} - Command '#{cmd}' exited with status #{status}\" if status.nonzero?\n raise \"#{header} - Command '#{cmd}' failed: #{error_buffer}\"\n end\n return output_buffer\n end\n end # exec\n end # open_channel\n ssh.loop\n end # run_session\n end", "def run_command_for_host\n ready_to_open_host_session do |spawn_cmd|\n open_interactive_process(spawn_cmd) do\n before_run_command\n run_command\n end\n end\n end", "def run(cmd, host_ip)\n user = 'root'\n ip = host_ip\n port = 22\n\n @cmd = system \"ssh -p #{port} #{user}@#{ip} '#{cmd}'\" \n logger.info @cmd\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 exec_interactive(command,data)\n id = @gardener.seed(\"#{command} #{data}\")\n result = @gardener.harvest(:one,id)\n\t\t\t$log_sambala.debug(\"exec_interactive result\") {\"#{result.inspect}\"}\n return result[:success], result[:message]\n end", "def execute(command, testcase, params={})\n if params[:exceptiononfailure].nil?\n if params[:exitcode]\n exceptiononfailure = false\n else\n exceptiononfailure = true\n end\n else\n exceptiononfailure = params[:exceptiononfailure]\n end\n\n testcase_output(\"#{@short_hostname}$ #{command}\", testcase) if not params[:noecho]\n # wrap command in order to see stderr when command is not found\n if params[:nostderr]\n command = \"( #{command} ) 2>/dev/null\"\n else\n command = \"( #{command} ) 2>&1\"\n end\n\n stdout = IO.popen(command)\n data = \"\"\n batch_lines = \"\"\n interval_start = Time.now.to_i\n while line = stdout.gets\n duration = Time.now.to_i - interval_start\n batch_lines = batch_lines + line\n\n # only send back output through DRb once every 2 seconds to avoid using up all resources\n if duration > 2\n testcase_output(batch_lines, testcase, false) if not params[:noecho]\n batch_lines = \"\"\n interval_start = Time.now.to_i\n end\n data = data + line;\n end\n testcase_output(batch_lines, testcase, false) if not params[:noecho]\n stdout.close\n\n maxsize = 200*1024\n if (data.length < maxsize)\n output = data\n else\n output = data[-maxsize..-1] + \"\\n\\nStdout buffer for command '#{command}' was too large, last #{maxsize/1024}KB returned\\n\"\n end\n\n if exceptiononfailure && $?.exitstatus != 0\n ex = ExecuteError.new(\"non-zero exit status (#{$?.exitstatus.to_i}) from #{command}\")\n ex.output = output\n raise ex\n end\n\n # check that the output won't be too large for passing\n # through DRb, setting 100kb as a hard limit\n if params[:exitcode]\n return [$?.exitstatus.to_s, output]\n else\n return output\n end\n end", "def executeCommand(command, dryRun)\n #N Without this, the command won't be echoed\n puts \"EXECUTE: #{command}\"\n #N Without this check, the command will be executed even if it is meant to be a dry run\n if not dryRun\n #N Without this, the command won't actualy be execute even when it is meant to be run\n system(command)\n #N Without this check, a failed command will be treated as if it had executed successfully\n checkProcessStatus(command)\n end\n end", "def exec!(command, opts = {}, &block)\n # Options\n stdout = ''\n stderr = ''\n defaults = {\n :check_exit_status => true\n }\n \n opts = defaults.merge opts\n\n # First, set up the environment...\n if @env.size > 0\n command = (\n @env.map { |k,v| k.to_s.upcase + '=' + v } << command\n ).join(' ')\n end\n\n # Before execution, cd to cwd\n command = \"cd #{escape(@cwd)}; \" + command\n\n # Input redirection\n if opts[:from]\n command += \" <#{escape(opts[:from])}\"\n end\n\n # Output redirection\n if opts[:to]\n command += \" >#{escape(opts[:to])}\"\n end\n\n # After command, add a semicolon...\n unless command =~ /;\\s*\\z/\n command += ';'\n end\n\n # Then echo the exit status.\n command += ' echo $?; '\n\n\n # If applicable, wrap the command in a sudo subshell...\n if @sudo\n command = \"sudo -S -u #{@sudo} bash -c #{escape(command)}\"\n if @password\n opts[:stdin] = @password + \"\\n\" + opts[:stdin].to_s\n end\n end\n\n buffer = ''\n echoed = 0\n stderr_echoed = 0\n status = nil\n written = false\n\n # Run ze command with callbacks.\n # Return status.\n channel = ssh.open_channel do |ch|\n ch.exec command do |ch, success|\n raise \"could not execute command\" unless success\n\n # Handle STDOUT\n ch.on_data do |c, data|\n # Could this data be the status code?\n if pos = (data =~ /(\\d{1,3})\\n\\z/)\n # Set status\n status = $1\n\n # Flush old buffer\n opts[:stdout].call(buffer) if opts[:stdout]\n stdout << buffer\n\n # Save candidate status code\n buffer = data[pos .. -1]\n\n # Write the other part of the string to the callback\n opts[:stdout].call(data[0...pos]) if opts[:stdout]\n stdout << data[0...pos]\n else\n # Write buffer + data to callback\n opts[:stdout].call(buffer + data) if opts[:stdout]\n stdout << buffer + data\n buffer = ''\n end\n \n if opts[:echo] and echoed < stdout.length\n stdout[echoed..-1].split(\"\\n\")[0..-2].each do |fragment|\n echoed += fragment.length + 1\n log fragment\n end\n end\n end\n\n # Handle STDERR\n ch.on_extended_data do |c, type, data|\n # STDERR\n if type == 1\n # Callback\n opts[:stderr].call(data) if opts[:stderr]\n\n # Accrue in stderr string\n stderr << data\n\n # Play forward any unwritten lines\n if opts[:echo] and stderr_echoed < stderr.length\n stderr[stderr_echoed..-1].split(\"\\n\")[0..-2].each do |fragment|\n stderr_echoed += fragment.length + 1\n log :stderr, fragment\n end\n end\n end\n end\n \n # Write stdin\n if opts[:stdin]\n ch.on_process do\n unless written\n ch.send_data opts[:stdin]\n written = true\n else\n # Okay, we wrote stdin\n unless block or ch.eof?\n ch.eof!\n end\n end\n end\n end\n\n # Handle close\n ch.on_close do\n if opts[:echo]\n # Echo last of input data\n stdout[echoed..-1].split(\"\\n\").each do |fragment|\n echoed += fragment.length + 1\n log fragment\n end\n\n # Last of stderr\n stderr[stderr_echoed..-1].split(\"\\n\").each do |fragment|\n echoed += fragment.length + 1\n log :stderr, fragment\n end\n end\n end\n end\n end\n \n if block\n # Run the callback\n callback_thread = Thread.new do\n if opts[:stdin]\n # Wait for stdin to be written before calling...\n until written\n sleep 0.1\n end\n end\n\n block.call(channel)\n end\n end\n\n # Wait for the command to complete.\n channel.wait\n\n # Let the callback thread finish as well\n callback_thread.join if callback_thread\n\n if opts[:check_exit_status]\n # Make sure we have our status.\n if status.nil? or status.empty?\n raise \"empty status in host#exec() for #{command}, hmmm\"\n end\n\n # Check status.\n status = status.to_i\n if status != 0\n raise \"#{command} exited with non-zero status #{status}!\\nSTDERR:\\n#{stderr}\\nSTDOUT:\\n#{stdout}\"\n end\n end\n\n stdout.chomp\n end", "def ssh_cmd(destination_host, cmd)\n\n if strict_host_checking\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n else\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n '-o', 'UserKnownHostsFile=/dev/null',\n '-o', 'StrictHostKeyChecking=no',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n end\n end", "def shell_execute(connection, command, **opts)\n opts = {\n sudo: false,\n shell: nil\n }.merge(opts)\n\n sudo = opts[:sudo]\n shell = (opts[:shell] || machine_config_ssh.shell).to_s\n\n @logger.info(\"Execute: #{command} (sudo=#{sudo.inspect})\")\n exit_status = nil\n\n # Open the channel so we can execute or command\n channel = connection.open_channel do |ch|\n marker_found = false\n data_buffer = ''\n stderr_marker_found = false\n stderr_data_buffer = ''\n\n tfile = Tempfile.new('vagrant-ssh')\n remote_ext = shell == \"powershell\" ? \"ps1\" : \"bat\"\n remote_name = \"#{machine_config_ssh.upload_directory}\\\\#{File.basename(tfile.path)}.#{remote_ext}\"\n\n if shell == \"powershell\"\n base_cmd = \"powershell -File #{remote_name}\"\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nRemove-Item #{remote_name}\nWrite-Host #{CMD_GARBAGE_MARKER}\n[Console]::Error.WriteLine(\"#{CMD_GARBAGE_MARKER}\")\n#{command}\nSCRIPT\n else\n base_cmd = remote_name\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nECHO OFF\nECHO #{CMD_GARBAGE_MARKER}\nECHO #{CMD_GARBAGE_MARKER} 1>&2\n#{command}\nSCRIPT\n end\n\n tfile.close\n upload(tfile.path, remote_name)\n tfile.delete\n\n base_cmd = shell_cmd(opts.merge(shell: base_cmd))\n @logger.debug(\"Base SSH exec command: #{base_cmd}\")\n\n ch.exec(base_cmd) do |ch2, _|\n # Setup the channel callbacks so we can get data and exit status\n ch2.on_data do |ch3, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n\n if !marker_found\n data_buffer << data\n marker_index = data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(data_buffer)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stdout, data\n end\n end\n\n ch2.on_extended_data do |ch3, type, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stderr: #{data}\")\n if !stderr_marker_found\n stderr_data_buffer << data\n marker_index = stderr_data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n stderr_data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(stderr_data_buffer.lstrip)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stderr, data\n end\n end\n\n ch2.on_request(\"exit-status\") do |ch3, data|\n exit_status = data.read_long\n @logger.debug(\"Exit status: #{exit_status}\")\n\n # Close the channel, since after the exit status we're\n # probably done. This fixes up issues with hanging.\n ch.close\n end\n\n end\n end\n\n begin\n keep_alive = nil\n\n if @machine.config.ssh.keep_alive\n # Begin sending keep-alive packets while we wait for the script\n # to complete. This avoids connections closing on long-running\n # scripts.\n keep_alive = Thread.new do\n loop do\n sleep 5\n @logger.debug(\"Sending SSH keep-alive...\")\n connection.send_global_request(\"[email protected]\")\n end\n end\n end\n\n # Wait for the channel to complete\n begin\n channel.wait\n rescue Errno::ECONNRESET, IOError\n @logger.info(\n \"SSH connection unexpected closed. Assuming reboot or something.\")\n exit_status = 0\n pty = false\n rescue Net::SSH::ChannelOpenFailed\n raise Vagrant::Errors::SSHChannelOpenFail\n rescue Net::SSH::Disconnect\n raise Vagrant::Errors::SSHDisconnected\n end\n ensure\n # Kill the keep-alive thread\n keep_alive.kill if keep_alive\n end\n\n # Return the final exit status\n return exit_status\n end", "def run_command(shell, whether_show_log=true, whether_reject_empty=true)\n result = IO.popen(shell) do |stdout| \n stdout.readlines#.reject(&method) \n end.map { |l| l.is_a?(String) ? string_format(l) : l }\n status = $?.exitstatus.zero?\n if !status or whether_show_log\n shell = string_format(shell).split(/\\n/).map { |line| \"\\t`\" + line + \"`\" }.join(\"\\n\")\n result = [\"bash: no output\"] if result.empty?\n if result.length > 100\n resstr = \"\\t\\tbash: output line number more than 100 rows.\"\n else\n resstr = result.map { |line| \"\\t\\t\" + line }.join\n end\n puts \"%s\\n\\t\\t==> %s\\n%s\\n\" % [shell, status, resstr]\n end\n return result.unshift(status)\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 ssh!(hostspec, script)\n CommandRunner.instance.ssh! hostspec, script\n end", "def run_cluster(nids, cmds, o={})\n o[:timeout] ||= 3\n nids.each_with_index do |nid, i|\n thr = Thread.new do\n Thread.current[:nid] = nid\n Thread.current[:idx] = i\n s = nil\n begin\n timeout(o[:timeout]) do\n cmd = (cmds.class == String)? cmds : cmds[i]\n s = `ssh #{nid} '#{cmd}'`\n end\n rescue TimeoutError\n puts \"Timeout #{nid}(#{i})\"\n end#begin\n s\n end#thread\n end\n \n #Collect results\n results = []\n Thread.list.each_with_index do |t,i|\n if t == Thread.main then next end\n t.join\n result = [t[:nid], t.value, t[:idx]]\n if t[:nid] && t.value\n if block_given?\n yield *result\n end\n results << result\n end\n end\n results\nend", "def send_command(command)\n begin\n @ssh_connect.exec!(command)\n rescue Exception => error\n @log.error(\"#{error}\")\n end\n end", "def ssh(host, user_name, *commands)\n global_cmd = \"ssh #{SSH_OPTIONS} #{user_name}@#{host} \\\"#{commands.join(';echo -;')}\\\"\"\n @logger.info(\"[SystemGateway][ssh] Executing #{global_cmd}...\")\n out = `#{global_cmd}`\n\n # SSH command failures (host unreachable, authentication errors)\n if $?.to_i != 0\n @logger.error(\"[SystemGateway][ssh] Command terminated abnormally: #{$?}\")\n raise(SSHError)\n end\n\n @logger.info(\"[SystemGateway][ssh] Command ended. Output: #{out}\")\n out\n end", "def ssh_cmd(cmd, attempts=3)\n attempts ||= 1\n conn = get_ssh_connection\n cmd = [cmd] unless cmd.is_a? Array\n result = nil\n cmd.each do |c|\n failures = 0\n begin\n result = conn.exec! c\n rescue\n failures += 1\n raise if failures >= attempts\n output \"Command \\\"#{c}\\\" failed, re-trying after delay\"\n sleep(failures)\n retry\n end\n end\n save_ssh_connection conn\n return result\n end", "def exec\n binding.pry\n # command.run(*service.exec(args.command))\n end", "def execute_remote\n\t\tcurAp = @apListBox.value;\n\t\tcmd = getVal(\"exec-remote on #{curAp.ip}\");\n\t\treturn if cmd.nil? or cmd == \"\";\n\n\t\ta = curAp.execute_remote(cmd).split( \"\\n\" );\n\t\[email protected]\n\t\ta.each { |line|\n\t\t\[email protected]( \"#{line}\", {});\n\t\t}\n\tend", "def system_run(cmd, o={})\n opts = {:quiet => false, :sysread => 1024}.merge(o)\n buf = \"\"\n ddputs(\"Running command: #{cmd}\")\n Open3.popen3(cmd) do |stdout, stdin, stderr|\n begin\n while (chunk = stdin.readpartial(opts[:sysread]))\n buf << chunk\n unless chunk.nil? || chunk.empty?\n $stdout.write(chunk) #if debugging? || verbose?\n end\n end\n err = stderr.readlines\n $stderr.write_nonblock(err)\n rescue SystemCallError => error\n err = stderr.readlines\n $stderr.write_nonblock(err)\n rescue EOFError => error\n err = stderr.readlines\n $stderr.write_nonblock(err)\n # used to do nothing\n end\n end\n buf\n end", "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 dpExecuteAction(host, cmd)\n mc = rpcclient \"deploop\"\n h = Socket.gethostbyname(host)\n mc.identity_filter \"#{h[1][0]}\"\n mc.progress = false\n\n result = mc.execute(:cmd=> cmd)\n\n mc.disconnect\n\n result[0][:data].each do |a|\n puts a\n end\n\n result[0][:data][:exitcode]\n end", "def run_command(machine, command, logger = @log)\n logger.info(\"Running command '#{command}' on the '#{machine['network']}' machine\")\n within_ssh_session(machine) do |connection|\n ssh_exec(connection, command, logger)\n end\n end", "def ssh_exec(executable, dir = Rails.application.config.vm_benchmark_dir, log = Rails.application.config.vm_error_log_file)\n shell_cmd = ssh_shell_cmd(executable, dir, log)\n shell(shell_cmd, dir: @vagrant_dir)\n end", "def do_ssh_cmd(cmd='uname -a')\n stdout_data = \"\"\n stderr_data = \"\"\n exit_code = nil\n \n begin\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch, success|\n unless success\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\"\n end\n channel.on_data do |ch,data|\n stdout_data += data\n end\n \n channel.on_extended_data do |ch,type,data|\n stderr_data+=data\n end\n \n channel.on_request(\"exit-status\") do |ch,data|\n exit_code = data.read_long\n end\n end\n end\n @ssh.loop\n rescue Net::SSH::Exception => e\n abort \"Net:SSH Exception : #{e.message}\"\n rescue Exception => e\n abort \"Unknown Exception : #{e.message}\"\n end\n {:stdout => stdout_data, :stderr => stderr_data, :exit_code => exit_code}\n end", "def execute_command(command, &blk)\n so, se = nil\n\n time_obj = Time.now\n ts = time_obj.to_i\n dt = time_obj.strftime(\"%Y-%m-%d\")\n\n tmp_dir_base = @config.get(PATRIOT_TMP_DIR_KEY, DEFAULT_PATRIOT_TMP_DIR)\n\n # the forked variable is used for checking whether fork invocation hangs.\n # (due to https://redmine.ruby-lang.org/issues/5240 ?)\n forked = false\n until forked\n cid = do_fork(command, dt, ts, tmp_dir_base)\n tmpdir = tmp_dir(cid, dt, ts, tmp_dir_base)\n i = 0\n # If fork hangs, output directory would not be created.\n # wait at most 5 seconds for the directory created.\n until forked || i > 5\n sleep(1)\n forked = File.exist?(tmpdir)\n i = i+1\n end\n # fork hanged, kill the hanged process.\n unless forked\n # check whether cid is id of child process to avoid to kill unrelated processes\n begin\n if Process.waitpid(cid, Process::WNOHANG).nil?\n @logger.warn(\"forked process :#{cid} hanged. kill #{cid}\")\n Process.kill(\"KILL\", cid)\n @logger.warn(\"SIGKILL sent to #{cid}\")\n Process.waitpid(cid)\n @logger.warn(\"#{cid} is killed\")\n else\n raise ExternalCommandException, \"#{cid} is not a child of this\"\n end\n rescue Exception => e\n @logger.warn \"failed to kill hanged process #{cid}\"\n raise e\n end\n end\n end\n\n @logger.info \"executing #{command}: results stored in #{tmpdir}\" \n pid, status = Process.waitpid2(cid)\n so = File.join(tmpdir, \"#{cid.to_i}#{STDOUT_SUFFIX}\")\n se = File.join(tmpdir, \"#{cid.to_i}#{STDERR_SUFFIX}\")\n\n @logger.info \"#{command} is finished\" \n return so if status.exitstatus == 0\n @logger.warn \"#{command} end with exit status #{status.exitstatus}\" \n if block_given?\n yield(status, so, se)\n else\n max_err_size = @config.get(MAX_ERROR_MSG_SIZE_KEY, DEFAULT_MAX_ERROR_MSG_SIZE)\n err_size = File.stat(se).size\n err_msg = \"#{command}\\n#{se} :\"\n if err_size < max_err_size\n File.open(se){|f| err_msg = \"#{err_msg}\\n#{f.read}\"}\n else\n err_msg = \"#{err_msg} \\n the size of stderr is #{err_size} (> #{max_err_size}\" \n end\n raise ExternalCommandException, err_msg\n end\n end" ]
[ "0.7485441", "0.72331065", "0.6559856", "0.6510699", "0.6482226", "0.6452301", "0.644141", "0.6405239", "0.6391583", "0.63715464", "0.6363025", "0.63483626", "0.6316167", "0.62552166", "0.6223655", "0.6214566", "0.61449265", "0.6117743", "0.60976374", "0.60766476", "0.6061096", "0.6035068", "0.6022051", "0.602132", "0.6019336", "0.60145295", "0.60106695", "0.59722245", "0.59665644", "0.59627914", "0.5959898", "0.59583277", "0.5948614", "0.59482384", "0.5944926", "0.59427077", "0.5935687", "0.59157354", "0.59045684", "0.58917946", "0.5887028", "0.58642095", "0.58642095", "0.5859599", "0.5853849", "0.5838162", "0.58372384", "0.5820595", "0.5819561", "0.58110046", "0.5805515", "0.5803466", "0.58011866", "0.5799862", "0.5799539", "0.5798694", "0.57820404", "0.575553", "0.5754103", "0.5751973", "0.57487607", "0.5743146", "0.5742104", "0.57417643", "0.5735936", "0.5723001", "0.5720823", "0.57157415", "0.5713948", "0.5713948", "0.57131433", "0.5707451", "0.56993884", "0.56993693", "0.56906456", "0.5683905", "0.5683488", "0.56796646", "0.56769115", "0.5675257", "0.56716573", "0.5664997", "0.56641024", "0.5659604", "0.5656345", "0.56533426", "0.5651922", "0.56499445", "0.5644292", "0.5636827", "0.56363577", "0.56265235", "0.56249857", "0.5607696", "0.56024194", "0.56007886", "0.5599962", "0.55958736", "0.55918926", "0.55870134" ]
0.7549649
0
copy a local directory to a remote directory (if dryRun is false) N Without this method, a local directory cannot be copied to a remote directory using an external SCP application
def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun) #N Without this, the external SCP application won't actually be run to copy the directory executeCommand("#{@scpCommandString} -r #{sourcePath} #{userAtHost}:#{destinationPath}", dryRun) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the file\n executeCommand(\"#{@scpCommandString} #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy directory #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the files will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the files won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath, :recursive => true)\n end\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy file #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the file will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the file won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath)\n end\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n if File.directory?(s)\r\n fu_copy_dir s, d, '.', options[:preserve]\r\n else\r\n fu_p_copy s, d, options[:preserve]\r\n end\r\n end\r\n end", "def rcp(opts)\n dest = opts[:d].name\n source = opts[:sp]\n dest_path = opts[:dp]\n\n # Grab a remote path for temp transfer\n tmpdest = tmppath\n\n # Do the copy and print out results for debugging\n cmd = \"scp -r '#{source}' #{dest}:#{tmpdest}\"\n output << bold(color(\"localhost$\", :green)) << \" #{cmd}\\n\"\n ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]\n ssh.scp.upload! source.to_s, tmpdest.to_s, :recursive => true\n\n # Now we move the file into their final destination\n result = shell(:n => opts[:d], :c => \"mv #{tmpdest} #{dest_path}\")\n result[:exit_code] == 0\n end", "def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend", "def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end", "def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def copy_dir(src, dest)\n output = `rsync -r --exclude='.svn' --exclude='.git' --exclude='.gitignore' --filter=':- .gitignore' 2>&1 #{Shellwords.escape(src.to_s)}/ #{Shellwords.escape(dest.to_s)}`\n [output, $?]\n end", "def cp(src, dest)\n unless dest.dirname.exist?\n LOG.info \"MKDIR: #{dest.dirname}\"\n FileUtils.mkdir_p(dest.dirname)\n end\n\n LOG.info \"COPY: #{src} #{dest}\"\n FileUtils.cp_r(src, dest)\n end", "def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil,\n dereference_root: true, remove_destination: nil)\n fu_output_message \"cp -r#{preserve ? 'p' : ''}#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_entry s, d, preserve, dereference_root, remove_destination\n end\n end", "def scp(src, dest, *opts)\n run \"scp #{Array.wrap(src).join(' ')} #{dest}\", *opts\n end", "def cp_dir(src, dst)\n puts \"#{cmd_color('copying')} #{dir_color(src)}\"\n puts \" -> #{dir_color(dst)}\"\n Find.find(src) do |fn|\n next if fn =~ /\\/\\./\n r = fn[src.size..-1]\n if File.directory? fn\n mkdir File.join(dst,r) unless File.exist? File.join(dst,r)\n else\n cp(fn, File.join(dst,r))\n end\n end\nend", "def copy(src, dst)\n\t\t# TODO: make cp able to handle strings, where it will create an entry based\n\t\t# on the box it's run from.\n\t\t\n\t\tif !(src.kind_of?(Rush::Entry) && dst.kind_of?(Rush::Entry))\n\t\t\traise ArgumentError, \"must operate on Rush::Dir or Rush::File objects\"\n\t\tend\n\t\t\n\t\t# 5 cases:\n\t\t# 1. local-local\n\t\t# 2. local-remote (uploading)\n\t\t# 3. remote-local (downloading)\n\t\t# 4. remote-remote, same server\n\t\t# 5. remote-remote, cross-server\n\t\tif src.box == dst.box # case 1 or 4\n\t\t\tif src.box.remote? # case 4\n\t\t\t\tsrc.box.ssh.exec!(\"cp -r #{src.full_path} #{dst.full_path}\") do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # case 1\n\t\t\t\tFileUtils.cp_r(src.full_path, dst.full_path)\n\t\t\tend\n\t\telse # case 2, 3, or 5\n\t\t\tif src.local? && !dst.local? # case 2\n\t\t\t\t# We use the connection on the remote machine to do the upload\n\t\t\t\tdst.box.ssh.scp.upload!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telsif !src.local? && dst.local? # case 3\n\t\t\t\t# We use the connection on the remote machine to do the download\n\t\t\t\tsrc.box.ssh.scp.download!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telse # src and dst not local, case 5\n\t\t\t\tremote_command = \"scp #{src.full_path} #{dst.box.user}@#{dst.box.host}:#{dst.full_path}\"\n\t\t\t\t# doesn't matter whose connection we use\n\t\t\t\tsrc.box.ssh.exec!(remote_command) do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# TODO: use tar for cross-server transfers.\n\t\t# something like this?:\n\t\t# archive = from.box.read_archive(src)\n\t\t# dst.box.write_archive(archive, dst)\n\n\t\tnew_full_path = dst.dir? ? \"#{dst.full_path}#{src.name}\" : dst.full_path\n\t\tsrc.class.new(new_full_path, dst.box)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(to)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, from\n\tend", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def copy_to!(dest)\n Pow(dest).parent.create_directory\n copy_to(dest)\n end", "def cp(src, dest, preserve: nil, noop: nil, verbose: nil)\n fu_output_message \"cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_file s, d, preserve\n end\n end", "def remote_copy(from, to, sudo: false, owner: nil, group: nil)\n extra_opts = {}\n extra_opts[:sudo] = sudo if sudo\n extra_opts[:owner] = owner if owner\n extra_opts[:group] = group if group\n @calls << [:remote_copy, from, to] + (extra_opts.empty? ? [] : [extra_opts])\n @remote_copy_code&.call(@stdout_io, @stderr_io, self)\n end", "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def cp(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(cp -a -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend", "def copy_dir(source, dest)\n files = Dir.glob(\"#{source}/**\")\n mkdir_p dest\n cp_r files, dest\n end", "def copy_file(src_file, dest_file)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(dest_file)) unless File.directory?(File.dirname(dest_file))\n FileUtils.cp(ROOT_DIR.join(src_file), dest_file)\n end\n end", "def copy(destination, file, folder = './downloads')\n FileUtils.mkdir_p(File.dirname(\"#{destination}/#{file}\"))\n FileUtils.cp_r(\"#{folder}/#{file}\", \"#{destination}/#{file}\")\n end", "def copy_folder(dir_source, dir_dest)\n ftp = Net::FTP.new(@host)\n begin\n ftp.login(@user, @password)\n ftp.passive = @passive\n puts \"FTP => logged in, start copying #{dir_source} to #{dir_dest}...\"\n\n # create a tmp folder locally\n tmp_folder = 'tmp/ftp_sync'\n unless File.exist?(tmp_folder)\n FileUtils.mkdir tmp_folder\n end\n Dir.chdir tmp_folder\n\n # download whole folder\n ftp.chdir File.dirname(dir_source)\n target = File.basename(dir_source)\n download_folder(target, ftp)\n\n # upload to dest\n ftp.chdir dir_dest\n upload_folder(target, ftp)\n\n # TODO: delete local tmp folder\n Dir.chdir '..'\n FileUtils.rm_rf tmp_folder\n\n puts 'FTP => Copy finished.'\n end\n end", "def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end", "def cp(path, dest)\n FileUtils.rm_rf(expand dest)\n if File.directory?(expand path)\n FileUtils.mkdir_p(expand dest)\n FileUtils.cp_r(expand(path), expand(dest))\n else\n FileUtils.mkdir_p(File.dirname(expand dest))\n FileUtils.cp(expand(path), expand(dest))\n end\n end", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def copy_dir(origin_path, dest_path)\n \n p origin_path if $DEBUG\n\n real_dir = get_non_linked_dir_path_for_path(origin_path)\n \n unless File.exist?(dest_path) and File.directory?(dest_path) then\n \n Dir.mkdir(dest_path)\n \n end\n \n Dir.foreach(real_dir) do |f|\n \n next if f == \".\" or f == \"..\"\n \n full_path= File.join(real_dir, f)\n \n #check if this is a hard link to a directory\n if File.exist?(full_path) and (not File.directory?(full_path)) and File.stat(full_path).nlink > @min_link_count then\n full_path = get_non_linked_dir_path_for_path(full_path)\n end\n \n if File.directory?(full_path) then\n copy_dir(full_path, File.join(dest_path, f))\n else\n \n if File.exist?(full_path) and not File.symlink?(full_path) then\n \n FileUtils.cp(full_path, dest_path)\n \n end\n \n end\n \n end\n \n nil\n \n end", "def cp srcpath, dstpath\n end", "def copy\n FileUtils.cp_r(@src, @dest)\n end", "def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend", "def cp(srcpath,dstpath)\n FileUtils.cp_r(srcpath,dstpath)\n end", "def cp_with_mkdir(src, dst, owner = nil, mode = nil)\n mkdir_if_necessary(File.dirname(dst))\n cp(src, dst, owner, mode)\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n fu_preserve_attr(options[:preserve], s, d) {\r\n copy_file s, d\r\n }\r\n end\r\n end", "def copy_dir(src_dir, dest_dir = \"/\")\n # Copy all the files into the home directory\n source = Dir.glob(ROOT_DIR.join(name).join(\"*\").to_s)\n FileUtils.cp_r(source, @workdir_path.to_s)\n end", "def copy(options)\n destination = copy_destination options\n to_path = join_paths @root_dir, destination\n to_path_exists = File.exist? to_path\n\n preserve_existing = false? options[:overwrite]\n\n copy_resource_to_path to_path, preserve_existing\n copy_pstore_to_path to_path, preserve_existing\n\n to_path_exists\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n cmd = self.class.curr_host == host ? cmd : \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"#{cmd}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n op = try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev ? 'mv' : 'cp -r'\n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ?\n \"#{op} #{local_path.shellescape} #{dst_path.shellescape}\" :\n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def cp(from_location, to_location)\n @client.file_copy(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end", "def cp_r(dest)\n util.cp_r(path, dest)\n end", "def cp_to(filename, mounted_dest) # Always returns the destination as an explicit location relative to the mount directory\n dest = File.join(@mount_dir, mounted_dest )#, File.basename(filename))\n FileUtils.mkdir_p(dest)\n FileUtils.cp( filename, dest, :preserve => true)\n File.join(dest, File.basename(filename))\n end", "def doCopyOperations(sourceContent, destinationContent, dryRun)\n #N Without this loop, we won't copy the directories that are marked for copying\n for dir in sourceContent.dirs\n #N Without this check, we would attempt to copy those directories _not_ marked for copying (but which might still have sub-directories marked for copying)\n if dir.copyDestination != nil\n #N Without this, we won't know what is the full path of the local source directory to be copied\n sourcePath = sourceLocation.getFullPath(dir.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(dir.copyDestination.relativePath)\n #N Without this, the source directory won't actually get copied\n destinationLocation.contentHost.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n else\n #N Without this, we wouldn't copy sub-directories marked for copying of this sub-directory (which is not marked for copying in full)\n doCopyOperations(dir, destinationContent.getDir(dir.name), dryRun)\n end\n end\n #N Without this loop, we won't copy the files that are marked for copying\n for file in sourceContent.files\n #N Without this check, we would attempt to copy those files _not_ marked for copying\n if file.copyDestination != nil\n #N Without this, we won't know what is the full path of the local file to be copied\n sourcePath = sourceLocation.getFullPath(file.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(file.copyDestination.relativePath)\n #N Without this, the file won't actually get copied\n destinationLocation.contentHost.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end\n end\n end", "def cp_single_file_or_directory(options={})\n from = options[:from]\n from_path = expand_path(from)\n to = options[:to]\n if to.to_s =~ %r{(.*)/$}\n to = $1\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n end\n case\n when File.directory?(from_path)\n if to && to != '-'\n if File.exists?(to)\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n creating_to_directory = false\n else\n creating_to_directory = true\n end\n end\n if options[:recursive]\n Dir.glob(\"#{from_path}/**/*\") do |from_item|\n suffix = File.relative_path(from_item, :relative_to=>from_path)\n suffix = File.join(from, suffix) unless creating_to_directory\n target_dir = File.dirname(File.join(to, suffix))\n FileUtils.mkdir_p(target_dir)\n if File.directory?(from_item)\n new_directory = File.join(target_dir,File.basename(from_item))\n if File.exists?(new_directory)\n raise CopyToNonDirectory \"Can't copy directory #{from_item } to non-directory #{new_directory}\" \\\n unless File.directory?(new_directory)\n else\n FileUtils.mkdir(new_directory)\n end\n else\n cp_single_file(options.merge(:from=>from_item, :to=>target_dir + '/'))\n end\n end\n else\n if options[:tolerant]\n STDERR.puts \"cp: Skipping directory #{from}\" unless options[:quiet]\n else\n raise CopyDirectoryNonRecursive, \"Can't non-recursively copy directory #{from}\"\n end\n end\n when File.exists?(from_path)\n cp_single_file(options.merge(:from=>from_path))\n else\n raise CopyMissingFromFile, \"#{from} does not exist\"\n end\n end", "def unpack_to(dir)\n sh \"cp -R #{local_path} #{dir}\"\n end", "def push_dir(local_path,remote_path)\n debug_p(\"push_dir from #{local_path} to #{remote_path}\")\n begin\n @sftp_session.upload!(local_path,remote_path)\n rescue\n @ssh.exec!(\"rm -rf #{remote_path}\")\n retry\n end\n end", "def cp_r(src,dst)\n src_root = Pathname.new(src)\n FileUtils.mkdir_p(dst, :verbose => VERBOSE) unless File.exists? dst\n Dir[\"#{src}/**/**\"].each do |abs_path|\n src_path = Pathname.new(abs_path)\n rel_path = src_path.relative_path_from(src_root)\n dst_path = \"#{dst}/#{rel_path.to_s}\"\n \n next if abs_path.include? '.svn'\n \n if src_path.directory?\n FileUtils.mkdir_p(dst_path, :verbose => VERBOSE)\n elsif src_path.file?\n FileUtils.cp(abs_path, dst_path, :verbose => VERBOSE)\n end\n end\nend", "def rsync(local_folder, remote_destination, delete)\n @log.info(\"rsyncing folder '#{local_folder}' to '#{remote_destination}'...\")\n @process_runner.execute!(\"rsync --filter='P *.css' --filter='P apidocs' --filter='P cdn' --filter='P get-started' --partial --archive --checksum --compress --omit-dir-times --quiet#{' --delete' if delete} --chmod=Dg+sx,ug+rw,Do+rx,o+r --protocol=28 --exclude='.snapshot' #{local_folder}/ #{remote_destination}\")\n end", "def cp_r(source, dest)\n FileUtils.cp_r(source, dest)\n puts \" ✔ cp -R #{source} #{dest}\".colorize(:blue).bold\n end", "def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend", "def cp_lr(src, dest, noop: nil, verbose: nil,\n dereference_root: true, remove_destination: false)\n fu_output_message \"cp -lr#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n link_entry s, d, dereference_root, remove_destination\n end\n end", "def git_clone(remote, dest)\n Dir.chdir(__dir__) do\n system \"git clone #{remote} #{dest}\"\n end\nend", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, src\n\tend", "def safe_cp(from, to, owner, group, cwd = '', include_paths = [], exclude_paths = [])\n credentials = ''\n credentials += \"-o #{owner} \" if owner\n credentials += \"-g #{group} \" if group\n excludes = find_command_excludes(from, cwd, exclude_paths).join(' ')\n\n copy_files = proc do |from_, cwd_, path_ = ''|\n cwd_ = File.expand_path(File.join('/', cwd_))\n \"if [[ -d #{File.join(from_, cwd_, path_)} ]]; then \" \\\n \"#{dimg.project.find_path} #{File.join(from_, cwd_, path_)} #{excludes} -type f -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -D #{credentials} {} \" \\\n \"#{File.join(to, '$(echo {} | ' \\\n \"#{dimg.project.sed_path} -e \\\"s/#{File.join(from_, cwd_).gsub('/', '\\\\/')}//g\\\")\")}' \\\\; ;\" \\\n 'fi'\n end\n\n commands = []\n commands << [dimg.project.install_path, credentials, '-d', to].join(' ')\n commands.concat(include_paths.empty? ? Array(copy_files.call(from, cwd)) : include_paths.map { |path| copy_files.call(from, cwd, path) })\n commands << \"#{dimg.project.find_path} #{to} -type d -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -d #{credentials} {}' \\\\;\"\n commands.join(' && ')\n end", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, src unless File.exist?(src)\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\tend", "def cp(src, dst, owner = nil, mode = nil)\n FileUtils.cp_r(src, dst, :preserve => true, :verbose => verbose?)\n if owner && !File.symlink?(dst) \n chown(dst, owner) \n end\n if mode\n chmod(dst, mode)\n end\n end", "def copy_with_path(src, dst)\n\tsrc_folder = File.basename(File.dirname(src))\n\tnewpath = (dst + src_folder)\n\tFileUtils.mkdir_p(newpath)\n \tFileUtils.cp(src, newpath)\nend", "def copy_with_path(src, dst, filename)\n FileUtils.mkdir_p(dst)\n FileUtils.cp(src, dst + filename)\nend", "def copyfile from, to\n FileUtils.mkdir_p File.dirname to\n cp from, to\n end", "def sftp_copy(username, password, server, files_map)\n ssh = FileCopy.ssh_connect(username, password, server)\n ssh.sftp.connect do |sftp|\n uploads = files_map.map { |from,to|\n remote_dir = File.dirname(to)\n sftp_mkdir_recursive(sftp, File.dirname(to))\n Log.debug1(\"Copying %s to %s\",from, to)\n sftp.upload(from, to)\n }\n uploads.each { |u| u.wait }\n Log.debug1(\"Done.\")\n end # ssh.sftp.connect\n end", "def rsync(source, target, exclude = [], options = [], verbose = false)\n excludes = exclude.map {|e| \"--exclude=#{e} \"}\n host = source.split(/\\//)[2]\n port = 873\n\n # Make the target directory if it's not there.\n FileUtils.mkdir(target) if !File.directory?(target)\n\n begin\n raise Exception, \"Unable to connect to remote host #{source}\" unless port_open?(host, port)\n\n log(\"rsync #{options} #{excludes} #{source} #{target}\")\n\n if verbose\n puts \"RUNNING: rsync #{options} #{excludes} #{source} #{target}\"\n system \"rsync #{options} #{excludes} #{source} #{target}\"\n else\n `rsync #{options} #{excludes} #{source} #{target}`\n end\n\n rescue Errno::EACCES, Errno::ENOENT, Errno::ENOTEMPTY, Exception => e\n log(e.to_s)\n end\nend", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end", "def copy_to(path)\n raise CommandError, 'Destination exists' if File.exist?(expand path)\n FileUtils.mkdir_p(File.dirname(expand path))\n FileUtils.cp_r(@working_dir, expand(path))\n end", "def scp(local_path,remote_path = \"#{dnsName}:\")\n if /([^:]+):(.*)/.match(remote_path)\n host = /([^:]+):(.*)/.match(remote_path)[1]\n remote_path_without_host = /([^:]+):(.*)/.match(remote_path)[2]\n else\n host = dnsName\n remote_path_without_host = remote_path\n end\n HCluster.scp_to(host,local_path,remote_path_without_host)\n end", "def copy(dest, overwrite=false)\n @resource.copy(dest, overwrite)\n end", "def preform_copy_directory\n @destination_directories.each do |destination|\n @sources.each do |source|\n write_mode = 'w'\n new_path = Pathname.new(destination.to_s).join(source.basename)\n # Check if the specified file is a directory\n if new_path.directory?\n return false if get_input(\"Destination path '\" + new_path.to_s + \"' is a directory. (S)kip the file or (C)ancel: \", ['s','c']) == 'c'\n next\n end\n # Copy the file\n return false unless copy_file(source, new_path)\n end\n end\n return true\n end", "def copy_from_remote(remote_file, local_path)\n\t\tbegin\n\t\t\t@@logger.info { \"Copying file from #{remote_file} to #{local_path}\" }\n\t\t\t@ssh_session.scp.download!(remote_file, local_path)\n\t\t\treturn true\n\t\trescue => err\n\t\t\t@@logger.error { \"SCP failed: #{err.message}\" }\n\t\t\t@@logger.error { \"\\t #{err.backtrace}\" }\n\t\tend\n\tend", "def copyFileToTarget(file, srcDir, destDir) \n inFileName = \"#{srcDir}/#{file}\";\n outFileName = \"#{destDir}/#{file}\";\n puts \"copying: [#{inFileName}]\";\n puts \"\\tto: [#{outFileName}]\";\n system(\"cp #{inFileName} #{outFileName}\");\nend", "def clone_file source, target, *opts\n cmd = ['cp']\n cmd << '-R' if opts.include? :recursive\n\n if RUBY_PLATFORM.include? 'darwin'\n sh *(cmd + ['-c', source, target]) do |ok|\n break if ok\n if Jekyll.env != 'production'\n $stderr.puts \"Cannot use file cloning, falling back to regular copying\"\n end\n sh *(cmd + [source, target])\n end\n else\n # macOS requires explicit clone argument for copy (see\n # above). Behavior on other platforms is uknown, except for Linux\n # where it occur automatically. Therefore, just doing copy should\n # be fine.\n sh *(cmd + [source, target])\n end\nend", "def rsync_to_temp\n\t\tputs \"\\n=> copying to temp dir.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_src, @@dir_temp)\n\tend", "def cp_r srcpath, dstpath\n src_bucket,src_key_path = split_path(srcpath)\n dst_bucket,dst_key_path = split_path(dstpath)\n mkdir_p(dstpath) unless exists?(dstpath)\n if directory? srcpath\n paths_to_copy = ls_r(srcpath)\n common_dir = common_directory(paths_to_copy)\n paths_to_copy.each do |path|\n bkt,key = split_path(path)\n src_key = key\n dst_key = File.join(dst_key_path, path.gsub(common_dir, ''))\n @s3.interface.copy(src_bucket, src_key, dst_bucket, dst_key)\n end\n else\n @s3.interface.copy(src_bucket, src_key_path, dst_bucket, dst_key_path)\n end\n end", "def copy_site\n target_dir = File.join(@deploy_dir, @remote_path).sub(/\\/$/,'')\n FileUtils.cp_r @local + '/.', target_dir\n message = \"Site updated at: #{Time.now.utc}\"\n `git add --all .`\n `git commit -m \\\"#{message}\\\"`\n end", "def copy(path, destination, options = {})\n opts = options.nil? ? {} : options.dup\n opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup\n opts[:headers]['Destination'] = destination\n execute('COPY', path, opts)\n end", "def copy_files(source_path, destination_path, directory)\n source, destination = File.join(directory, source_path), File.join(Rails.root, destination_path)\n FileUtils.mkdir(destination) unless File.exist?(destination)\n FileUtils.cp_r(Dir.glob(source+'/*.*'), destination)\nend", "def upload_directory(local_dir, remote_path)\n Net::SFTP.start(HOSTNAME, USERNAME, :password => PASSWORD) do |sftp|\n dir_perm = 0755\n file_perm = 0644\n Find.find(local_dir) do |f|\n #next if f.include?('.part') or f.include?('.table') or f.include?('.sh') or f.include?('.rb') or f.include?('.csv')\n if File.stat(f).directory?\n begin\n remote_dir = remote_path + \"/\" + f\n sftp.stat!(remote_dir)\n rescue Net::SFTP::StatusException => e\n raise unless e.code == 2\n puts \"Creating remote directory #{remote_dir}\"\n sftp.mkdir(remote_dir, :permissions => dir_perm)\n end\n next\n end\n local_file = f\n remote_file = remote_path + \"/\" + local_file\n \n begin\n remote_dir = File.dirname(remote_file)\n sftp.stat!(remote_dir)\n rescue Net::SFTP::StatusException => e\n raise unless e.code == 2\n puts \"Creating remote directory #{remote_dir}\"\n sftp.mkdir(remote_dir, :permissions => dir_perm)\n end\n \n begin\n rstat = sftp.stat!(remote_file)\n rescue Net::SFTP::StatusException => e\n raise unless e.code == 2\n puts \"Copying #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n sftp.setstat(remote_file, :permissions => file_perm)\n next\n end\n \n if File.stat(local_file).mtime > Time.at(rstat.mtime + SERVER_TIME_OFFSET)\n puts \"Updating #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n end\n end\n end\n end", "def local_copy(source, target)\n FileUtils.mkpath(File.dirname(target))\n FileUtils.copy(source, \"#{target}.in_progress\")\n FileUtils.move(\"#{target}.in_progress\", target)\n end", "def rel_copy(full_src, rel_dest, opts={})\n \n dest_path = File.dirname(rel_dest)\n \n fname = Pathname.new(full_src).basename\n \n if !File.directory?(dest_path)\n cmd = \"mkdir -p #{dest_path}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end \n end\n \n cmd = \"cp #{full_src} #{dest_path}/#{fname}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end\n\nend", "def cp_into(options={})\n cmd = \"/bin/cp #{options[:src]} #{@config.ve_private}/#{options[:dst]}\"\n execute(cmd)\n end", "def copy_file_if_missing(src, dest, opt={})\n unless File.exists? dest\n touch_directory File.dirname(dest), opt\n FileUtils.cp src, dest\n STDOUT.write \"Created #{dest.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n \n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ? \n \"cp -r #{src_path.shellescape} #{local_path.shellescape}\" : \n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def push_dir(localpath, remotepath)\n connect!\n \n Dir.glob(File.join(localpath, '**', '*')) do |f|\n f.gsub!(\"#{localpath}/\", '')\n local = File.join localpath, f\n remote = \"#{remotepath}/#{f}\".gsub(/\\/+/, '/')\n \n if File.directory?(local)\n @connection.mkdir remote rescue Net::FTPPermError\n log \"Created Remote Directory #{local}\"\n elsif File.file?(local)\n @connection.put local, remote\n log \"Pushed file #{remote}\"\n end\n end\n \n close!\n end", "def copy_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end", "def copy(dest_path, overwrite = false, depth = nil)\n NotImplemented\n end", "def copy(source_path, target_path)\n _ensure_directory_exists(target_path)\n target_path.open('wb', @permissions[:file]) do |io|\n lines = source_path.read.split(\"\\n\")\n lines.each do |line|\n\tio.write(line.chomp + @ending)\n end\n end\n puts \"#{source_path.to_s.ljust(25)} -> #{target_path}\"\n end", "def push(remote_path, local_path, delete)\n\n # load our sync data\n sync_data = load_sync_data(local_path)\n \n Net::SFTP.start(@remote_host,\n @remote_username,\n :password => @remote_password) do |sftp|\n\n push_dir(sftp, remote_path, local_path, delete, sync_data)\n end\n\n # save our sync data\n save_sync_data(local_path, sync_data)\n end", "def cp(source, destination)\n # possibly helpful pieces of information\n\n # if both fs's are the same class a \"cp\" will work in any case\n if @source.class.to_s == @dest.class.to_s\n @source.cp(source, destination)\n return\n end\n\n if same_node?\n case @dest.class.to_s\n when \"MoveIt::FileSystem::Hdfs\"\n @dest.hadoop_fs(\"-copyFromLocal #{source} #{destination}\")\n else\n raise \"cp from same node with different classses is not complete: #{@source.class.to_s} to #{@dest.class.to_s}\"\n end\n else\n raise \"cp from different nodes via proxy is not complete\"\n end\n\n # possible sources:\n # * s3\n # * hdfs\n # * posix\n\n # if same_node?\n # else\n # # tricky!\n # end\n end", "def transfer!\n write_password_file! unless local\n\n remote_path = remote_path_for(@package)\n\n create_remote_path!(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n if local\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ remote_path }'.\"\n run(\n \"#{ utility(:rsync) } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ File.join(remote_path, remote_file) }'\"\n )\n else\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ ip }'.\"\n run(\n \"#{ utility(:rsync) } #{ rsync_options } #{ rsync_port } \" +\n \"#{ rsync_password_file } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ username }@#{ ip }:#{ File.join(remote_path, remote_file) }'\"\n )\n end\n end\n\n ensure\n remove_password_file! unless local\n end", "def copy(destdir)\n # Make sure destination is a directory\n File.directory? destdir or raise ArgumentError, \"#{destdir} is not a directory\"\n # Go through files in sorted order\n num_files = self.files.length()\n # These are the files that didn't get copied to the destination dir\n uncopied = []\n self.files.each_index do |i|\n fe = self.files[i]\n # This is the destination filename\n dest = File.join(destdir, fe.archive_filename)\n # If @prune_leading_dir=true, then all files lack the leading\n # directories, so we need to prepend them.\n if @prune_leading_dir\n src = Pathname.new(@dir) + fe.archive_filename\n else\n src = fe.archive_filename\n end\n HDB.verbose and puts \"Copying (##{i+1}/#{num_files}) #{src} to #{dest}\"\n begin\n # Try and copy f to dest\n # NOTE: FileUtils.copy_entry does not work for us since it operates recursively\n # NOTE: FileUtils.copy only works on files\n self.copy_entry(src, dest)\n rescue Errno::ENOSPC\n HDB.verbose and puts \"... out of space\"\n # If the source was a file, we might have a partial copy.\n # If the source was not a file, copying it is likely atomic.\n if File.file?(dest)\n begin\n File.delete(dest)\n rescue Errno::ENOENT\n # None of the file was copied.\n end\n end\n uncopied.push(fe)\n # TODO: This may happen if destination dir doesn't exist\n rescue Errno::ENOENT\n # Src file no longer exists (was removed) - remove from\n # FileSet, as if out of space.\n HDB.verbose and puts \"... deleted before I could copy it!\"\n uncopied.push(fe)\n end\n end\n self.subtract!(uncopied)\n end", "def copyItem(srcItem,destItem)\n copyWentWell = false # not yet...\n\n begin\n\n # directory?\n FiRe::filesys.mkpath(destItem) if FiRe::filesys.directory?(srcItem)\n \n # file?\n if FiRe::filesys.file?(srcItem)\n FiRe::log.info \"#{FiRe::filesys.basename(srcItem)} ----> #{destItem}\"\n FiRe::filesys.cp(srcItem, destItem)\n end\n\n copyWentWell = true\n\n rescue StandardError => e\n FiRe::log.error e\n end\n\n copyWentWell\n\n end", "def copy\n if args.dest.instance_of?(Pathname)\n n = args.dest.to_s.delete_prefix(project.write_path(:services).to_s).delete_prefix('/')\n w = project.write_path(:services).join(service.name)\n w.join(Pathname.new(n).split.first).mkpath\n @args = args.merge('dest' => w.join(n).to_s)\n end\n cmd = service.copy(args.src, args.dest)\n Cnfs.logger.info cmd.join(\"\\n\")\n result = command.run!(*cmd)\n raise Cnfs::Error, result.err if result.failure?\n\n # Signal.trap('INT') do\n # warn(\"\\n#{caller.join(\"\\n\")}: interrupted\")\n # # exit 1\n # end\n end", "def update_copied_remote_file(file, copy)\n # the remote has a file that has been copied or moved from copy[file] to file.\n # file is also destination.\n src = copy[file]\n \n # If the user doen't even have the source, then we apparently renamed a directory.\n if !(working_changeset.include?(file2))\n directory nil, file, src, remote.flags(file)\n elsif remote.include? file2\n # If the remote also has the source, then it was copied, not moved\n merge src, file, file, flag_merge(src, file, src), false\n else\n # If the source is gone, it was moved. Hence that little \"true\" at the end there.\n merge src, file, file, flag_merge(src, file, src), true\n end\n end", "def pull(remote_path, local_path, delete)\n\n # load our sync data\n sync_data = load_sync_data(local_path)\n\n Net::SFTP.start(@remote_host,\n @remote_username,\n :password => @remote_password) do |sftp|\n\n pull_dir(sftp, remote_path, local_path, delete, sync_data)\n end\n\n # save our sync data\n save_sync_data(local_path, sync_data)\n end", "def put_r(local_dir, remote_dir)\n return false if !File.directory?(local_dir)\n upload_dir(local_dir, remote_dir)\n end" ]
[ "0.8529124", "0.84920573", "0.8481336", "0.8209311", "0.7828138", "0.7116001", "0.69933236", "0.6935151", "0.68590575", "0.68590575", "0.6774887", "0.6774887", "0.67535084", "0.6748667", "0.67113864", "0.6676996", "0.6663779", "0.6655769", "0.6624962", "0.6624124", "0.66022664", "0.6595056", "0.6561456", "0.65539765", "0.6494176", "0.64827824", "0.64827824", "0.6466761", "0.64647204", "0.6454929", "0.64428324", "0.6436212", "0.6429035", "0.6423656", "0.64187634", "0.64091885", "0.63896596", "0.6376553", "0.63580275", "0.6343368", "0.630571", "0.62994915", "0.62947553", "0.62892646", "0.628696", "0.6265316", "0.6243986", "0.6234304", "0.62119716", "0.6189467", "0.6151015", "0.61408395", "0.6135678", "0.6133922", "0.6130886", "0.6125113", "0.6123004", "0.612016", "0.61190635", "0.6114116", "0.6108068", "0.6102182", "0.6038346", "0.6030115", "0.6024671", "0.60124075", "0.6001844", "0.59856164", "0.5984932", "0.59799725", "0.5977625", "0.595919", "0.59492356", "0.5944609", "0.59336245", "0.59280366", "0.5922383", "0.59192693", "0.5917249", "0.59104115", "0.59010243", "0.58966637", "0.58927315", "0.58907896", "0.5888708", "0.5880967", "0.58700764", "0.58689314", "0.5865815", "0.5858137", "0.5853203", "0.58506846", "0.5849393", "0.5847136", "0.58374923", "0.58370024", "0.58363485", "0.5805633", "0.5803617", "0.58013827" ]
0.8691553
0
copy a local file to a remote directory (if dryRun is false) N Without this method, a local file cannot be copied to a remote directory using an external SCP application
def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun) #N Without this, the external SCP application won't actually be run to copy the file executeCommand("#{@scpCommandString} #{sourcePath} #{userAtHost}:#{destinationPath}", dryRun) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy file #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the file will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the file won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath)\n end\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the directory\n executeCommand(\"#{@scpCommandString} -r #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy directory #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the files will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the files won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath, :recursive => true)\n end\n end", "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend", "def rcp(opts)\n dest = opts[:d].name\n source = opts[:sp]\n dest_path = opts[:dp]\n\n # Grab a remote path for temp transfer\n tmpdest = tmppath\n\n # Do the copy and print out results for debugging\n cmd = \"scp -r '#{source}' #{dest}:#{tmpdest}\"\n output << bold(color(\"localhost$\", :green)) << \" #{cmd}\\n\"\n ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]\n ssh.scp.upload! source.to_s, tmpdest.to_s, :recursive => true\n\n # Now we move the file into their final destination\n result = shell(:n => opts[:d], :c => \"mv #{tmpdest} #{dest_path}\")\n result[:exit_code] == 0\n end", "def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def copy_file(src_file, dest_file)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(dest_file)) unless File.directory?(File.dirname(dest_file))\n FileUtils.cp(ROOT_DIR.join(src_file), dest_file)\n end\n end", "def copy_from_remote(remote_file, local_path)\n\t\tbegin\n\t\t\t@@logger.info { \"Copying file from #{remote_file} to #{local_path}\" }\n\t\t\t@ssh_session.scp.download!(remote_file, local_path)\n\t\t\treturn true\n\t\trescue => err\n\t\t\t@@logger.error { \"SCP failed: #{err.message}\" }\n\t\t\t@@logger.error { \"\\t #{err.backtrace}\" }\n\t\tend\n\tend", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n \n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ? \n \"cp -r #{src_path.shellescape} #{local_path.shellescape}\" : \n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def local_copy_file(source, options = {})\n Uploadcare::File.local_copy(source, options)\n end", "def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend", "def cp(from_location, to_location)\n @client.file_copy(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end", "def scp(src, dest, *opts)\n run \"scp #{Array.wrap(src).join(' ')} #{dest}\", *opts\n end", "def copy_file_to_remote(host, file_path, file_content)\n block_on host do |host|\n Tempfile.open 'beaker' do |tempfile|\n File.open(tempfile.path, 'w') { |file| file.puts file_content }\n\n host.do_scp_to(tempfile.path, file_path, @options)\n end\n end\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n cmd = self.class.curr_host == host ? cmd : \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"#{cmd}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n op = try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev ? 'mv' : 'cp -r'\n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ?\n \"#{op} #{local_path.shellescape} #{dst_path.shellescape}\" :\n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def cp(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(cp -a -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end", "def cp!( from_file, to_file, opts = {} )\r\n args = { :source => from_file, :destination => to_file }\r\n args[:source_address] = opts[:source_address] if opts[:source_address]\r\n \r\n begin\r\n got = @ndev.rpc.file_copy( args )\r\n rescue => e\r\n raise IOError, e.rsp.xpath('rpc-error/error-message').text.strip\r\n else\r\n return true\r\n end\r\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n if File.directory?(s)\r\n fu_copy_dir s, d, '.', options[:preserve]\r\n else\r\n fu_p_copy s, d, options[:preserve]\r\n end\r\n end\r\n end", "def cp(src, dest, preserve: nil, noop: nil, verbose: nil)\n fu_output_message \"cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_file s, d, preserve\n end\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def cp( file )\n src = ::File.join(data, file)\n dst = ::File.join(site, file)\n test(?e, dst) ? updating(dst) : creating(dst)\n# FileUtils.cp(src, dst)\n if WINDOWS then win_line_endings(src, dst)\n else FileUtils.cp(src, dst) end\n end", "def copy_file(path:, copy_destination:)\n BrickFTP::API::FileOperation::Copy.create(path: path, 'copy-destination': copy_destination)\n end", "def cp srcpath, dstpath\n end", "def copy_file(path:, copy_destination:)\n BrickFTP::API::FileOperation::Copy.create(path: path, :'copy-destination' => copy_destination)\n end", "def copy_file(source_file, dest_file, settings)\n\tFileUtils.cp_r(source_file, dest_file)\nend", "def copy_file(source, destination)\n FileUtils.cp(source, destination)\n destination\n end", "def copy_file(source, destination)\n FileUtils.cp(source, destination)\n destination\n end", "def update_copied_remote_file(file, copy)\n # the remote has a file that has been copied or moved from copy[file] to file.\n # file is also destination.\n src = copy[file]\n \n # If the user doen't even have the source, then we apparently renamed a directory.\n if !(working_changeset.include?(file2))\n directory nil, file, src, remote.flags(file)\n elsif remote.include? file2\n # If the remote also has the source, then it was copied, not moved\n merge src, file, file, flag_merge(src, file, src), false\n else\n # If the source is gone, it was moved. Hence that little \"true\" at the end there.\n merge src, file, file, flag_merge(src, file, src), true\n end\n end", "def remote_copy(from, to, sudo: false, owner: nil, group: nil)\n extra_opts = {}\n extra_opts[:sudo] = sudo if sudo\n extra_opts[:owner] = owner if owner\n extra_opts[:group] = group if group\n @calls << [:remote_copy, from, to] + (extra_opts.empty? ? [] : [extra_opts])\n @remote_copy_code&.call(@stdout_io, @stderr_io, self)\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def copyFileToTarget(file, srcDir, destDir) \n inFileName = \"#{srcDir}/#{file}\";\n outFileName = \"#{destDir}/#{file}\";\n puts \"copying: [#{inFileName}]\";\n puts \"\\tto: [#{outFileName}]\";\n system(\"cp #{inFileName} #{outFileName}\");\nend", "def cp(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n fu_preserve_attr(options[:preserve], s, d) {\r\n copy_file s, d\r\n }\r\n end\r\n end", "def cp_to(filename, mounted_dest) # Always returns the destination as an explicit location relative to the mount directory\n dest = File.join(@mount_dir, mounted_dest )#, File.basename(filename))\n FileUtils.mkdir_p(dest)\n FileUtils.cp( filename, dest, :preserve => true)\n File.join(dest, File.basename(filename))\n end", "def scp(local_path,remote_path = \"#{dnsName}:\")\n if /([^:]+):(.*)/.match(remote_path)\n host = /([^:]+):(.*)/.match(remote_path)[1]\n remote_path_without_host = /([^:]+):(.*)/.match(remote_path)[2]\n else\n host = dnsName\n remote_path_without_host = remote_path\n end\n HCluster.scp_to(host,local_path,remote_path_without_host)\n end", "def put(local_file, remote_file=nil)\n remote_file = remote_file.nil? ? File.basename(local_file) : remote_file\n @logger.debug(sprintf('scp from host[%s] to VM[%s]', local_file, remote_file))\n\n raise FileTransferError.new(sprintf('unable to put[%s], local file does not exist', local_file)) unless File.file?(local_file)\n\n begin\n @ssh.scp.upload!(local_file, remote_file)\n rescue => e\n raise FileTransferError.new(sprintf('unable to put[%s], exception[%s]', local_file, e.message()))\n end\n\n return true\n end", "def copy(src, dst)\n\t\t# TODO: make cp able to handle strings, where it will create an entry based\n\t\t# on the box it's run from.\n\t\t\n\t\tif !(src.kind_of?(Rush::Entry) && dst.kind_of?(Rush::Entry))\n\t\t\traise ArgumentError, \"must operate on Rush::Dir or Rush::File objects\"\n\t\tend\n\t\t\n\t\t# 5 cases:\n\t\t# 1. local-local\n\t\t# 2. local-remote (uploading)\n\t\t# 3. remote-local (downloading)\n\t\t# 4. remote-remote, same server\n\t\t# 5. remote-remote, cross-server\n\t\tif src.box == dst.box # case 1 or 4\n\t\t\tif src.box.remote? # case 4\n\t\t\t\tsrc.box.ssh.exec!(\"cp -r #{src.full_path} #{dst.full_path}\") do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # case 1\n\t\t\t\tFileUtils.cp_r(src.full_path, dst.full_path)\n\t\t\tend\n\t\telse # case 2, 3, or 5\n\t\t\tif src.local? && !dst.local? # case 2\n\t\t\t\t# We use the connection on the remote machine to do the upload\n\t\t\t\tdst.box.ssh.scp.upload!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telsif !src.local? && dst.local? # case 3\n\t\t\t\t# We use the connection on the remote machine to do the download\n\t\t\t\tsrc.box.ssh.scp.download!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telse # src and dst not local, case 5\n\t\t\t\tremote_command = \"scp #{src.full_path} #{dst.box.user}@#{dst.box.host}:#{dst.full_path}\"\n\t\t\t\t# doesn't matter whose connection we use\n\t\t\t\tsrc.box.ssh.exec!(remote_command) do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# TODO: use tar for cross-server transfers.\n\t\t# something like this?:\n\t\t# archive = from.box.read_archive(src)\n\t\t# dst.box.write_archive(archive, dst)\n\n\t\tnew_full_path = dst.dir? ? \"#{dst.full_path}#{src.name}\" : dst.full_path\n\t\tsrc.class.new(new_full_path, dst.box)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(to)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, from\n\tend", "def copy(destination, file, folder = './downloads')\n FileUtils.mkdir_p(File.dirname(\"#{destination}/#{file}\"))\n FileUtils.cp_r(\"#{folder}/#{file}\", \"#{destination}/#{file}\")\n end", "def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end", "def copy_file(filename,dst_dir='/',dst_repo=self.repo,src_repo=self.repo)\n post_copy(src_repo,{\"file_names\"=>filename, \"dst_repo\" => dst_repo, \"dst_dir\"=>dst_dir})\n end", "def copy_file_if_missing(src, dest, opt={})\n unless File.exists? dest\n touch_directory File.dirname(dest), opt\n FileUtils.cp src, dest\n STDOUT.write \"Created #{dest.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n end", "def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil,\n dereference_root: true, remove_destination: nil)\n fu_output_message \"cp -r#{preserve ? 'p' : ''}#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_entry s, d, preserve, dereference_root, remove_destination\n end\n end", "def clone_file source, target, *opts\n cmd = ['cp']\n cmd << '-R' if opts.include? :recursive\n\n if RUBY_PLATFORM.include? 'darwin'\n sh *(cmd + ['-c', source, target]) do |ok|\n break if ok\n if Jekyll.env != 'production'\n $stderr.puts \"Cannot use file cloning, falling back to regular copying\"\n end\n sh *(cmd + [source, target])\n end\n else\n # macOS requires explicit clone argument for copy (see\n # above). Behavior on other platforms is uknown, except for Linux\n # where it occur automatically. Therefore, just doing copy should\n # be fine.\n sh *(cmd + [source, target])\n end\nend", "def copy\n FileUtils.cp_r(@src, @dest)\n end", "def cp(srcpath,dstpath)\n FileUtils.cp_r(srcpath,dstpath)\n end", "def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend", "def upload_file local_source, remote_dest, options = {}\n add [local_source, remote_dest], check_file(remote_dest)\n chmod options[:perms], remote_dest if options[:perms]\n chown options[:owner], remote_dest if options[:owner]\n end", "def FileCopy(src, dst)\n success?(parse(cmd(with_args(src, dst))))\n end", "def scp(src_file, path_of_servers, dst_file, option = \"\")\n _path_of_servers = path_of_servers.dup\n remove_first_localhost!(_path_of_servers)\n\n #generate session uuid and make temp dir string\n sid = SecureRandom.uuid\n temp_file = \"#{temp_dir(sid)}#{File.basename(src_file)}\"\n\n #first, local src file to edge server's temp dir\n #(/tmp/onion_ssh/<session uuid>/<files>)\n first = _path_of_servers.shift\n ssh([first], \"mkdir -p #{temp_dir(sid)} >& /dev/null\")\n `#{one_scp_str(src_file, first, temp_file)}`\n \n #second to last - 1 , scp temp dir to temp dir\n last = _path_of_servers.pop\n temp_path = [first]\n _second_to_last_minus_one = _path_of_servers\n _second_to_last_minus_one.each do |sv|\n temp_path << sv\n ssh(temp_path,\"mkdir -p #{temp_dir(sid)} >& /dev/null\")\n end\n\n temp_path = [first]\n _second_to_last_minus_one.each do |sv|\n ssh(temp_path, \"#{one_scp_str(temp_file, sv, temp_dir(sid))}\")\n temp_path << sv\n end\n\n #last minus one's path=(temp_path above) and last\n ssh(temp_path, \"#{one_scp_str(temp_file, last, dst_file)}\")\n #delete garbage\n clear_temp([first] + _second_to_last_minus_one, sid)\n end", "def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end", "def copy_file(src, dest)\r\n File.open(src, 'rb') {|r|\r\n File.open(dest, 'wb') {|w|\r\n copy_stream r, w\r\n }\r\n }\r\n end", "def file_copy(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/copy\", params)\n parse_response(response)\n end", "def copyfile from, to\n FileUtils.mkdir_p File.dirname to\n cp from, to\n end", "def copy from, to\n add \"cp #{from} #{to}\", check_file(to)\n end", "def dup_file(source, destination)\n return nil if source.blank? || destination.blank?\n\n FileUtils.cp(source, destination) if file_exists?(source)\n end", "def cp_r(dest)\n util.cp_r(path, dest)\n end", "def ftp_copy(ftp, local_file, remote_file)\n in_ftp_dir(ftp, File.dirname(remote_file)) do |_ftp|\n basename = File.basename(remote_file)\n _ftp.putbinaryfile(local_file, \"#{basename}.in_progress\")\n _ftp.rename(\"#{basename}.in_progress\", basename)\n end\n end", "def copy(path, destination, options = {})\n opts = options.nil? ? {} : options.dup\n opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup\n opts[:headers]['Destination'] = destination\n execute('COPY', path, opts)\n end", "def copy_to_local srcfile, dstfile\n @hdfs.copy_to_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def copy_to_local srcfile, dstfile\n @hdfs.copy_to_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def scp_upload(src_file, remote_folder)\n scp_connect\n success = false\n unless @scp_session.nil? or is_dryrun\n begin\n scp_mkdir_p(remote_folder) unless scp_dir_exist?(remote_folder)\n rem_file = File.join(remote_folder, File.basename(src_file)).to_s\n @scp_session.upload!(src_file, rem_file)\n # some files don't take permissions of their parent folder, not sure why!\n # forcing file permissions as well!\n scp_set_file_perms(rem_file)\n success = true\n rescue => ex\n puts(\"ERR: failed to upload #{src_file} to remote #{remote_folder}: response #{ex.to_s}\")\n $stdout.flush\n end\n ssh_disconnect\n end\n success\n end", "def push_file(user, host, copy_path, paste_path, sudo = false)\n ping(user, host) do\n begin\n file = open(copy_path)\n write_body(user, host, file.read(File.size(copy_path)), paste_path)\n file.close if file\n rescue\n \"No such file.\"\n end\n end\n end", "def cp( file )\n src = template / file\n dst = site / file\n\n if test(?e, dst)\n if identical?(src, dst)\n identical(dst)\n return\n end\n\n choice = case options[:collision]\n when :force then :force\n when :skip then :skip\n else force_file_collision?( dst ) end\n\n case choice\n when :force then force(dst)\n when :skip then skip(dst); return\n else raise \"Invalid collision choice: #{choice.inspect}\" end\n else\n create(dst)\n end\n return if pretend?\n\n FileUtils.cp(src, dst)\n end", "def cp_into(options={})\n cmd = \"/bin/cp #{options[:src]} #{@config.ve_private}/#{options[:dst]}\"\n execute(cmd)\n end", "def upload(local, remote = nil, opts={})\n remote ||= File.split(local).last\n remote = expand_path remote\n ssh.scp.upload!(local, remote, opts)\n end", "def cp(src, dest)\n unless dest.dirname.exist?\n LOG.info \"MKDIR: #{dest.dirname}\"\n FileUtils.mkdir_p(dest.dirname)\n end\n\n LOG.info \"COPY: #{src} #{dest}\"\n FileUtils.cp_r(src, dest)\n end", "def copy(source_path, target_path)\n _ensure_directory_exists(target_path)\n target_path.open('wb', @permissions[:file]) do |io|\n lines = source_path.read.split(\"\\n\")\n lines.each do |line|\n\tio.write(line.chomp + @ending)\n end\n end\n puts \"#{source_path.to_s.ljust(25)} -> #{target_path}\"\n end", "def transfer!\n write_password_file! unless local\n\n remote_path = remote_path_for(@package)\n\n create_remote_path!(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n if local\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ remote_path }'.\"\n run(\n \"#{ utility(:rsync) } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ File.join(remote_path, remote_file) }'\"\n )\n else\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ ip }'.\"\n run(\n \"#{ utility(:rsync) } #{ rsync_options } #{ rsync_port } \" +\n \"#{ rsync_password_file } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ username }@#{ ip }:#{ File.join(remote_path, remote_file) }'\"\n )\n end\n end\n\n ensure\n remove_password_file! unless local\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def copy_to_local_file(style, local_dest_path)\n @filesystem.copy_to_local_file(style, local_dest_path)\n end", "def copy_to_local_file(style, local_dest_path)\n @filesystem.copy_to_local_file(style, local_dest_path)\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def cp(src, dst, owner = nil, mode = nil)\n FileUtils.cp_r(src, dst, :preserve => true, :verbose => verbose?)\n if owner && !File.symlink?(dst) \n chown(dst, owner) \n end\n if mode\n chmod(dst, mode)\n end\n end", "def cp (from, to, as: user, on: hosts, quiet: false, once: nil, delete: false)\n self.once once, quiet: quiet do\n log.info \"cp: #{from} -> #{to}\", quiet: quiet do\n Dir.chdir File.dirname(file) do\n hash_map(hosts) do |host|\n host.cp from, to, as: as, quiet: quiet, delete: delete\n end\n end\n end\n end\n end", "def copy_from_local srcfile, dstfile\n @hdfs.copy_from_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def copy_from_local srcfile, dstfile\n @hdfs.copy_from_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def remote_file_resource\n Chef::Log.info \"Remote file: #{file_location}\"\n Chef::Log.info \"Local file: #{new_resource.name}\"\n @remote_file_resource ||= remote_file new_resource.name do\n source file_location\n checksum new_resource.checksum if !new_resource.checksum.nil?\n owner new_resource.owner\n group new_resource.group\n backup false\n action :nothing\n end\nend", "def upload_file(local_file, remote_path)\n Net::SFTP.start(HOSTNAME, USERNAME, :password => PASSWORD) do |sftp|\n file_perm = 0644\n next if File.stat(local_file).directory?\n remote_file = remote_path + \"/\" + local_file\n \n begin\n rstat = sftp.stat!(remote_file)\n rescue Net::SFTP::StatusException => e\n raise unless e.code == 2\n puts \"Copying #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n sftp.setstat(remote_file, :permissions => file_perm)\n next\n end\n \n #puts File.stat(local_file).mtime \n #puts Time.at(rstat.mtime)\n if File.stat(local_file).mtime > Time.at(rstat.mtime)\n puts \"Updating #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n end\n end\n end", "def cp_r(source, dest)\n FileUtils.cp_r(source, dest)\n puts \" ✔ cp -R #{source} #{dest}\".colorize(:blue).bold\n end", "def copy_file(src, dst)\n File.open(src) do |fin|\n File.open(dst, 'w') do |fout|\n fout.write(fin.read)\n end\n end\n end", "def google_copy_file(client)\n notify \"Command : Google copy file\"\n # result : error message\n # google treat folders as files\n src_files = move_copy_file_source\n dest_path = CGI::unescape(@fields[:dst_path].to_s)\n result = client.copy_files(src_files,dest_path)\n end", "def copy_file(src, base, dest_dir)\n return if src == '/dev/null' or not File.exists?(src)\n dest = File.expand_path(base, dest_dir)\n puts \"Added: #{base}\"\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp src, dest\nend", "def sftp_copy(username, password, server, files_map)\n ssh = FileCopy.ssh_connect(username, password, server)\n ssh.sftp.connect do |sftp|\n uploads = files_map.map { |from,to|\n remote_dir = File.dirname(to)\n sftp_mkdir_recursive(sftp, File.dirname(to))\n Log.debug1(\"Copying %s to %s\",from, to)\n sftp.upload(from, to)\n }\n uploads.each { |u| u.wait }\n Log.debug1(\"Done.\")\n end # ssh.sftp.connect\n end", "def cp( file )\n src = ::File.join( data, file )\n dest = ::File.join( project, file )\n creating dest\n FileUtils.cp( src, dest )\n end", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, src unless File.exist?(src)\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\tend", "def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end", "def copy_from_local srcpath, destpath\n bucket,key = split_path(destpath)\n if File.exists?(srcpath)\n if File.directory?(srcpath)\n raise \"NotYetImplemented\"\n else\n @s3.interface.put(bucket, key, File.open(srcpath))\n end\n else\n raise Errno::ENOENT, \"No such file or directory - #{srcpath}\"\n end\n end", "def pull_file(user, host, copy_path, place_path, sudo = false)\n ping(user, host) do\n begin\n my_text = IO.popen(\"ssh #{user}@#{host} 'cat \\\"#{copy_path}\\\"'\")\n my_text.write(\"sudo bash -c 'cat #{copy_path}'\\n\") if sudo\n file_saved = save_local(place_path, my_text)\n my_text.close\n return file_saved\n rescue\n \"No such file.\"\n end\n end\n end", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, src\n\tend", "def cp_single_file(options={})\n from = options[:from]\n to = options[:to]\n raise RuntimeError, \"#{from} should not be a directory\" if File.directory?(from)\n if to.to_s =~ %r{(.*)/$}\n to = $1\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n end\n if to && to != '-' && File.directory?(to)\n to = File.join(to, File.basename(from))\n end\n cp_file_to_file(:from=>from, :to=>to)\n end", "def upload\n @files.each do |fn|\n sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}\n end\n end", "def copy_file file, destination, clobber=nil\n validate file, destination\n target = File.expand_path( File.join(destination, File.basename(file)) )\n if(File.exists?(target) && clobber != :clobber)\n raise Sprout::Errors::DestinationExistsError.new \"Unable to copy #{file} to #{target} because target already exists and we were not asked to :clobber it\"\n end\n FileUtils.mkdir_p destination\n FileUtils.cp_r file, destination\n\n destination\n end", "def test_copy_file\n remote_file_name = 'TestCopyFileSrc.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = CopyFileRequest.new(dest_path: remote_data_folder + '/TestCopyFileDest.docx', src_path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.copy_file(request)\n end" ]
[ "0.816521", "0.8074268", "0.8028088", "0.77565366", "0.77083254", "0.76527417", "0.7611533", "0.7346336", "0.71129376", "0.71005017", "0.70374", "0.69821036", "0.69817716", "0.6946812", "0.69423676", "0.6940771", "0.69298744", "0.6915015", "0.68877095", "0.68843323", "0.6782787", "0.67561287", "0.672934", "0.6688406", "0.6675027", "0.6675027", "0.6646949", "0.661125", "0.66106033", "0.6592808", "0.6592034", "0.6576411", "0.6576411", "0.6565741", "0.65580064", "0.65429723", "0.65429723", "0.6536088", "0.65099204", "0.6507922", "0.64970016", "0.64865506", "0.6482812", "0.64492375", "0.6447225", "0.6442805", "0.64426875", "0.6441326", "0.6434105", "0.64266086", "0.64240193", "0.64167434", "0.6409894", "0.63860023", "0.63791406", "0.63785744", "0.6359972", "0.63471353", "0.63466126", "0.63464165", "0.6338696", "0.6331083", "0.6322663", "0.6319286", "0.6312331", "0.6303802", "0.6303802", "0.62709635", "0.6255692", "0.6255618", "0.6254209", "0.624079", "0.62232083", "0.62193656", "0.6195865", "0.6186507", "0.61856925", "0.61856925", "0.61841047", "0.6181083", "0.61702245", "0.61701524", "0.61701524", "0.6170106", "0.6166786", "0.6163009", "0.61562544", "0.61548436", "0.6149305", "0.6148305", "0.61477995", "0.61457205", "0.6141988", "0.61319226", "0.61214024", "0.6114339", "0.61136", "0.61095595", "0.60949016", "0.6091366" ]
0.85354877
0
N Without initialize, it won't be possible to construct an object representing a remote host and the means to execute SSH & SCP commands and return hash values of remote file contents (with readonly attributes)
def initialize(userAtHost, hashCommand, sshAndScp = nil) #N Without calling super, the hash command won't be configured super(hashCommand) #N Without this, the SSH & SCP implementation won't be configured @sshAndScp = sshAndScp != nil ? sshAndScp : InternalSshScp.new() #N Without this, the SSH & SCP implementation won't be configured with the user/host details to connect to. @sshAndScp.setUserAtHost(userAtHost) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_ssh; end", "def initialize(host, user, comm = nil)\n\n ssh_opts = {\n :port => host.port,\n :config => true,\n :keys => \"~/.ssh/id_rsa\",\n :verbose => :debug,\n :timeout => 20\n #:paranoid => true\n }\n\n ssh_opts.merge!(:password => host.pass) if host.pass && host.pass != \"\"\n p ssh_opts\n Net::SSH.start(host.addr, user, ssh_opts) do |ssh|\n # puts hostname = ssh.exec_with_status(\"hostname\").result\n if comm\n ex = ssh.exec_with_status(comm)\n ssh.loop\n @buffer = ex.result\n\n else\n @result = { }\n for sample in Stat::comm(host)\n puts \"Executing #{sample}\"\n @result[sample[0]] = ssh.exec_with_status(sample[1])\n end\n\n ssh.loop\n @result.map { |k, v| @result[k] = v.result}\n s = host.stats.create(@result)\n end\n\n #s.save!\n end\n end", "def sshAndScp\n return contentHost.sshAndScp\n end", "def get_ssh_info\n\n h = Hash.new()\n\n if @ssh_info.class.eql?(Hash)\n @logger.debug('using cached SSH info')\n h = @ssh_info\n else\n\n res = self.vagrant(sprintf('ssh-config %s', @name))\n\n res.split(\"\\n\").each do |line|\n if line.match(/HostName (.*?)$/)\n h[:hostname] = $1\n elsif line.match(/User (\\w*?)$/)\n h[:user] = $1\n elsif line.match(/Port (\\d*?)$/)\n h[:ssh_port] = $1\n elsif line.match(/IdentityFile (.*?)$/)\n h[:identity_file] = $1\n @logger.info(sprintf('vagrant specified key[%s] differs from provided[%s], will use both', @sshkey, h[:identity_file]))\n end\n end\n\n @ssh_info = h\n end\n\n h\n end", "def ssh_hostfile(file)\n CommandRunner.instance.ssh_hostfile file\n end", "def initialize(host, remote_command=nil)\n @host = host\n @remote_command = remote_command\n end", "def ssh\n @ssh ||= @remote.connect\n @remote\n end", "def kind\n :ssh\n end", "def initialize(shell, scpProgram)\n #N Without this we won't have the remote shell command as an array of executable + arguments\n @shell = shell.is_a?(String) ? [shell] : shell\n #N Without this we won't have the SCP command as an array of executable + arguments\n @scpProgram = scpProgram.is_a?(String) ? [scpProgram] : scpProgram\n #N Without this we won't have the SCP command as single string of white-space separated executable + arguments\n @scpCommandString = @scpProgram.join(\" \")\n end", "def remote_clone\n raise CommandNotImplemented\n end", "def ssh_type; end", "def ssh_type; end", "def ssh_type; end", "def ssh_type; end", "def ssh_host_signature(host)\n Config::Core::File.new(@path + \"ssh-host-#{host}\")\n end", "def ssh_info\n # Run a custom action called \"read_ssh_info\" which does what it says\n # and puts the resulting SSH info into the `:machine_ssh_info` key in\n # the environment.\n #\n # Ssh info has following format..\n #\n #{\n # :host => \"1.2.3.4\",\n # :port => \"22\",\n # :username => \"mitchellh\",\n # :private_key_path => \"/path/to/my/key\"\n #}\n env = @machine.action(\"read_ssh_info\")\n env[:machine_ssh_info]\n end", "def remote_command(command)\n return %x(ssh #{self.sar_host} \"#{command}\")\n end", "def ssh(path_of_servers, command)\n _path_of_servers = path_of_servers.dup\n remove_first_localhost!(_path_of_servers)\n Open3.capture3(ssh_str(_path_of_servers, command))\n end", "def inspect\n if @hostname.nil?\n if @ssh.is_a?(ZTK::SSH)\n @hostname ||= @ssh.exec(%(hostname -s)).output.strip\n else\n if @ssh.respond_to?(:exec!)\n @hostname ||= @ssh.exec!(%(hostname -s)).strip\n else\n raise SSHError, \"The object you assigned to ssh does not respond to #exec!\"\n end\n end\n end\n\n tags = Array.new\n tags << \"host=#{@hostname.inspect}\"\n tags << \"use_sudo=#{@use_sudo.inspect}\"\n tags = tags.join(' ')\n\n \"#<#{self.class} #{tags}>\"\n end", "def prepare metadata\n ssh = @export_obj.ssh_to_source\n metadata.ssh = ssh\n end", "def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend", "def info\n results = {\n :host => @vm.config.ssh.host,\n :port => @vm.config.ssh.port || @vm.driver.ssh_port(@vm.config.ssh.guest_port),\n :username => @vm.config.ssh.username,\n :forward_agent => @vm.config.ssh.forward_agent,\n :forward_x11 => @vm.config.ssh.forward_x11,\n :password => @vm.config.ssh.password\n }\n\n # This can happen if no port is set and for some reason Vagrant\n # can't detect an SSH port.\n raise Errors::SSHPortNotDetected if !results[:port]\n\n # Determine the private key path, which is either set by the\n # configuration or uses just the built-in insecure key.\n pk_path = @vm.config.ssh.private_key_path || @vm.env.default_private_key_path\n results[:private_key_path] = File.expand_path(pk_path, @vm.env.root_path)\n\n # We need to check and fix the private key permissions\n # to make sure that SSH gets a key with 0600 perms.\n check_key_permissions(results[:private_key_path])\n\n # Return the results\n return results\n end", "def ssh_create(host, user, key)\n\n if key.start_with?('-----BEGIN RSA PRIVATE KEY-----')\n ssh = Net::SSH.start(host, user,\n {\n :key_data => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n elsif File.exist?(key)\n ssh = Net::SSH.start(host, user,\n {\n :key_data => IO.read(key),\n :user_known_hosts_file => \"/dev/null\"\n } )\n else\n ssh = Net::SSH.start(host, user,\n {\n :password => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n end\n\n ssh\n end", "def build_ssh_command(host)\n user_opt = ''\n key_opt = ''\n port_opt = ''\n ssh_options = config.rsync_options\n\n if user = host.user || ssh_options[:user]\n user_opt = \" -l #{user}\"\n end\n\n if keys = (host.keys.empty? ? ssh_options[:keys] : host.keys)\n keys = keys.is_a?(Array) ? keys : [keys]\n key_opt = keys.map { |key| \" -i #{key}\" }.join('')\n end\n\n if port = host.port || ssh_options[:port]\n port_opt = \" -p #{port}\"\n end\n\n \"ssh#{user_opt}#{key_opt}#{port_opt}\"\n end", "def initialize(ssh_uri)\n uri = URI(ssh_uri)\n @host = uri.host\n @port = uri.port || 22\n @user = uri.user || ENV['USER']\n if uri.password\n @password = uri.password\n else\n @key = \"#{ENV['HOME']}/.ssh/id_rsa\"\n end\n end", "def ssh_data\n <<-SSH_DATA\n ssh-keys = \"#{@user}:#{@public_key_value}}\"\n enable-oslogin = \"FALSE\"\n SSH_DATA\n end", "def initialize(hash = {})\n # Emulate the XMLRPC client\n server = hash[:Server]\n port = hash[:Port] || Puppet[:masterport]\n environment = Puppet[:environment]\n\n if hash.include?(:Path)\n @local_path = hash[:Path]\n @rest_path = nil\n else\n @local_path = nil\n @rest_path = \"https://#{server}:#{port}/#{environment}/file_bucket_file/\"\n end\n end", "def initialize()\n @remote_host = \"192.168.1.1\"\n @rsa_key = \"~/.ssh/router_rsa\"\n @dns_source = \"http://www.netflixdnscodes.com\"\n end", "def to_blob\n #@blob ||= Net::SSH::Buffer.from(:string, ssh_type,\n # :bignum, p, :bignum, q, :bignum, g, :bignum, pub_key).to_s\n SSHUtils.convert_string(ssh_type)<<\n SSHUtils.convert_bignum(p)<<\n SSHUtils.convert_bignum(q)<<\n SSHUtils.convert_bignum(g)<<\n SSHUtils.convert_bignum(pub_key)\n end", "def initialize\n extend(Net::SSH::Transport::PacketStream)\n super \"SSH-2.0-Test\\r\\n\"\n\n @script = Script.new\n\n script.sends(:kexinit)\n script.gets(:kexinit, 1, 2, 3, 4, \"test\", \"ssh-rsa\", \"none\", \"none\", \"none\", \"none\", \"none\", \"none\", \"\", \"\", false)\n script.sends(:newkeys)\n script.gets(:newkeys)\n end", "def git_object(hash)\n return `git cat-file -p #{hash}`\nend", "def remote_command(type, command, options)\n # If the VM is not running, then we can't run SSH commands...\n raise Errors::VMNotRunningError if @vm.state != :running\n\n # Initialize the result object, execute, and store the data\n result = OpenStruct.new\n result.stderr = \"\"\n result.stdout = \"\"\n result.exit_code = @vm.channel.send(type, command,\n :error_check => false) do |type, data|\n if type == :stdout\n result.stdout += data\n elsif type == :stderr\n result.stderr += data\n end\n\n # If we're echoing data, then echo it!\n if options[:echo]\n @vm.ui.info(data.to_s,\n :prefix => false,\n :new_line => false)\n end\n end\n\n # Return the result\n result\n end", "def initialize host, options={}\n super $stdout, options\n\n @host, @user = host.split(\"@\").reverse\n\n @user ||= options[:user]\n\n @rsync_flags = [\"-azrP\"]\n @rsync_flags.concat [*options[:rsync_flags]] if options[:rsync_flags]\n\n @ssh_flags = [\n \"-o ControlMaster=auto\",\n \"-o ControlPath=~/.ssh/sunshine-%r@%h:%p\"\n ]\n @ssh_flags.concat [\"-l\", @user] if @user\n @ssh_flags.concat [*options[:ssh_flags]] if options[:ssh_flags]\n\n @parent_pid = nil\n\n self.class.register self\n end", "def setup(credentials = {})\n requires :public_key, :ssh_ip_address, :username\n\n credentials[:proxy]= ssh_proxy unless ssh_proxy.nil?\n credentials[:password] = password unless self.password.nil?\n credentials[:key_data] = [private_key] if self.private_key\n\n commands = [\n %{mkdir .ssh},\n # %{passwd -l #{username}}, #Not sure if we need this here\n # %{echo \"#{Fog::JSON.encode(attributes)}\" >> ~/attributes.json}\n ]\n if public_key\n commands << %{echo \"#{public_key}\" >> ~/.ssh/authorized_keys}\n end\n\n # wait for domain to be ready\n Timeout::timeout(360) do\n begin\n Timeout::timeout(8) do\n Fog::SSH.new(ssh_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')\n end\n rescue Errno::ECONNREFUSED\n sleep(2)\n retry\n rescue Net::SSH::AuthenticationFailed, Timeout::Error\n retry\n end\n end\n Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)\n end", "def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end", "def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end", "def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end", "def ssh_array\n [\"-o StrictHostKeyChecking=no\", \"-l '#{Base.user}'\", '-i \"'+full_keypair_path+'\"']\n end", "def initialize(host, user, password)\n @host = host\n @connection = Net::SSH.start(@host, user, :password => password)\n end", "def current_data\n start_ssh do |ssh|\n return ssh.scp.download!(full_filename)\n end\n end", "def initialize(hashCommand, pathPrefix = \"\")\n #N Without this, would not know the how to execute and parse the result of the hash command\n @hashCommand = hashCommand\n #N Without this, would not know how to execute 'find' if it's not on the path\n @pathPrefix = pathPrefix\n end", "def config_ssh(username, host, options = nil)\n @ssh = SSH.new(username, host, options)\n end", "def bits\n self.class.ssh_public_key_bits(ssh_public_key)\n end", "def remote_file_resource\n Chef::Log.info \"Remote file: #{file_location}\"\n Chef::Log.info \"Local file: #{new_resource.name}\"\n @remote_file_resource ||= remote_file new_resource.name do\n source file_location\n checksum new_resource.checksum if !new_resource.checksum.nil?\n owner new_resource.owner\n group new_resource.group\n backup false\n action :nothing\n end\nend", "def to_s()\n return \"ssh:#{@parameters[:user]}@#{@parameters[:host]}\"\n end", "def initialize (params = {})\n\t\t\t@verbose=params.fetch(:verbose, false)\n @data_dir=params.fetch(:data_dir, File.dirname(__FILE__)+'/../../../data/')\n\t\t\t# Set default instance variables\n\t\t\t@hosts_file=params.fetch(:hosts_file, @data_dir + 'prime_hosts')\n\t\t\t# Initialize the instance variables\n File.write(@hosts_file, \"\") unless File.exist?(@hosts_file)\n\t\t\t@known_hosts=load_known_hosts_from_file(@hosts_file)\n\t\t\t@known_ips=Hash.new\n\t\t\tde_duplicate\n\t\tend", "def initialize shell, id = \"id_rsa\"\n @shell = shell\n @ssh_home = File.join ENV[\"HOME\"], \".ssh\"\n @ssh_id = id\n end", "def ssh(commandString, dryRun = false)\n contentHost.sshAndScp.ssh(commandString, dryRun)\n end", "def remote_command command, options={}\n return unless running?\n returning({ :stdout => '', :stderr => '', :exit_status => nil }) do |output|\n remote_stdout, remote_stderr, exit_code = '', '', nil\n Net::SSH.start(public_ip, options[:user] || \"root\", {:paranoid => false}.merge(options)) do |connection|\n connection.open_channel do |channel|\n channel.on_data { |ch, data| output[:stdout] += data }\n channel.on_extended_data { |ch, type, data| output[:stderr] += data }\n channel.on_request(\"exit-status\") do |p, data|\n output[:exit_status] = data.read_long\n end\n channel.exec(command) do |ch, executing|\n raise \"Could not execute: #{command}\" unless executing\n end\n end\n end\n end\n end", "def private_file\n File.join @ssh_home, @ssh_id\n end", "def over_ssh(opts = {})\n raise 'MissingSSHHost' unless opts[:host]\n raise 'MissingSSHUser' unless opts[:user]\n opts[:timeout] ||= 300 # default to a 5 minute timeout\n\n remote = Rye::Box.new(\n opts[:host],\n user: opts[:user],\n auth_methods: ['publickey'],\n password_prompt: false,\n error: STDOUT # send STDERR to STDOUT for things that actually print\n )\n\n exception = nil\n\n # Getting serious about not crashing Lita...\n output = begin\n # pass our host back to the user to work with\n Timeout.timeout(opts[:timeout]) { yield remote }\n rescue Rye::Err, Timeout::Error => e\n exception = e\n ensure\n remote.disconnect\n end\n\n calculate_result(output, exception)\n end", "def to_blob\n #@blob ||= Net::SSH::Buffer.from(:string, ssh_type, :bignum, e, :bignum, n).to_s\n SSHUtils.convert_string(ssh_type)<<\n SSHUtils.convert_bignum(e)<<\n SSHUtils.convert_bignum(n)\n end", "def run_instance(o={})\n raise StandardError.new(\"You have no available hosts\") if available_hosts.empty?\n host = available_hosts.first\n new_host = SshInstance.new(instance_options(o.merge(:name=>host)))\n new_host.keypair\n if new_host && new_host.refresh!\n available_hosts.delete host\n new_host\n else\n raise StandardError.new(\"Unable to connect to host #{host}\")\n end\n end", "def run\n Shef::Extensions.extend_context_object(self)\n ssh_config = []\n\n ssh_config << \"\\n\\n### BEGIN KNIFE BLOCK ###\"\n ssh_config << \"## This was generated by `knife setup ssh`:\"\n\n STDOUT.sync = true\n\n nodes.all do |n|\n next if /vagrant/.match(n.name)\n name = n.name\n name << '.lisausa.net' unless /\\.lisausa.net\\Z/.match(n.name)\n\n begin\n hostname = n.ipaddress\n rescue => ex\n ui.warn(\"Error (#{ex.inspect}) while getting #ipaddress for #{n.name}\")\n next\n end\n\n ssh_config << [\n \"Host #{name}\",\n \" HostName #{hostname}\",\n \" HostKeyAlias #{[name,hostname,n.macaddress].join('-')}\"\n ]\n end\n\n if (c = Chef::Config.knife).keys.grep(/identity_file|ssh_user/).any?\n ssh_config.push [\n \"Host *.lisausa.net\",\n \" IdentitiesOnly yes\",\n \" PasswordAuthentication no\",\n \" ForwardAgent yes\"\n ]\n ssh_config.push \" IdentityFile #{c[:identity_file]}\" if c[:identity_file]\n ssh_config.push \" User #{c[:ssh_user]}\" if c[:ssh_user]\n end\n\n ssh_config << \"### END KNIFE BLOCK ###\"\n ssh_config = ssh_config.flatten.join(\"\\n\")\n\n file_path = File.join(ENV['HOME'], '.ssh', 'config')\n if config[:write] or ui.ask_question(\"Write config to #{file_path} (Y/N)?\", default: 'N').downcase == 'y'\n FileUtils.copy_file(file_path, \"#{file_path}~\")\n File.open(file_path, File::RDWR|File::CREAT) do |f|\n f.flock(File::LOCK_EX)\n\n contents = f.read.gsub(/\\n*### BEGIN KNIFE BLOCK ###.+?(### END KNIFE BLOCK ###|\\Z)/m, ssh_config)\n unless contents.include?('### BEGIN KNIFE BLOCK ###')\n contents << ssh_config\n end\n f.rewind\n f.truncate(0)\n f.write contents\n end\n ui.msg \"Wrote to #{file_path}. Previous contents were backed up to #{file_path}~\"\n else\n ui.msg \"Copy and paste the following into your #{file_path} file:\"\n ui.msg ssh_config\n end\n end", "def sync\n # preparation\n check_remote_path_valid\n check_git_repo\n reset_remote_repo\n\n diff_text = local_diff\n apply_diff_to_remote diff_text\n\n # output = @ssh.exec! 'hostname'\n # puts output\n end", "def fetch_host_keys(hosts_stat, verbose = false)\n\n #\n # 1. Remove keys from known_hosts, using ssh-keygen -R <host>\n #\n\n hosts_stat.each do |hs|\n\n hs[:names].each do |hn|\n system(\n \"ssh-keygen -f \\\"#{$known_hosts}\\\" -R #{hn} > /dev/null 2> /dev/null\" )\n end\n\n end\n\n #\n # 2. Fetch new keys using ssh-keyscan\n #\n\n begin\n\n $stderr.print \"Fetching host keys to #{$known_hosts}:\\n \" if verbose\n\n open($known_hosts, 'a') do |file|\n\n tot = hosts_stat.length\n count = 1\n\n hosts_stat.each do |hs|\n\n if verbose\n pct = 100. * count.to_f / tot.to_f\n $stderr.printf( \"\\r\\033[0K[% 3d%%] %s\", pct.round, hs[:names].first )\n $stderr.flush\n end\n\n keys = %x[ ssh-keyscan -t rsa,dsa #{hs[:names].first} 2> /dev/null ]\n keys.gsub!( hs[:names].first, hs[:names].join(',') )\n\n file << keys\n\n count += 1\n\n end\n\n file.close\n\n end\n\n warn \"\\r\\033[0KDone!\" if verbose\n\n rescue\n return false\n end\n\n return true\n\nend", "def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end", "def get_ssh_auth_keys(host)\n return on(host, 'cat ~/.ssh/authorized_keys').stdout\nend", "def remote_the\n\n end", "def run_ssh(host, shell_command, ssh_timeout = 60)\n begin\n # define basic query\n ssh_query = {\n :ssh_host => host,\n :ssh_auth_type => :password, # password is set on ssh method (default per os during provisioning)\n :ssh_timeout => ssh_timeout,\n :ssh_debug => @debug,\n :ssh_command => shell_command\n }\n\n # instantiate the ssh method and pull the command status\n $evm.instantiate(SSH_INSTANCE_PATH + '?' + ssh_query.to_query)\n status = $evm.root['ssh_command_status']\n\n # pull and inspect our results if we succeeded\n if status\n results = $evm.root['ssh_results']\n return results\n else\n log(:error, \"run_ssh: Command #{shell_command} failed. Returning nil.\")\n return nil\n end\n rescue => err\n log(:error, \"run_ssh: Unable to run command: #{shell_command}. Returning nil.\")\n return nil\n end\nend", "def file(options={}, &block)\n ssh.file(options, &block)\n end", "def ssh!(hostspec, script)\n CommandRunner.instance.ssh! hostspec, script\n end", "def Host(rh)\n if rh.is_a?(SSHKit::Host)\n rh\n else\n SSHKit::Host.new(rh)\n end\n end", "def construct_cmd\n cmd = \"ssh -i #{@key} \" \\\n \"-o StrictHostKeyChecking=no -o BatchMode=yes \" \\\n \"-o ConnectTimeout=#{@timeout} \" \\\n \"#{@user}@#{@host} \\\"#{@cmd}\\\"\"\n @logger.debug(cmd)\n cmd\n end", "def initialize(host, data)\n @host = host\n @data = data\n end", "def ssh_info\n # If the VM is not running that we can't possibly SSH into it\n return nil if state.id != :running\n\n detected_ip = @driver.ssh_ip\n\n # If ip couldn't be detected then we cannot possibly SSH into it,\n # and should return nil too.\n return nil if !detected_ip\n\n # Return ip from running machine, use ip from config if available\n {\n host: detected_ip,\n port: @driver.ssh_port(@machine.config.ssh.guest_port)\n }\n end", "def create_ssh_setup\n command = \"echo 'y\\\\\\n' \\| ssh-keygen -f /tmp/#{@name_args[0]}.key -N \\\"\\\" -P \\\"\\\"\"\n result = run_remote_command(command)\n\n if config[:username].eql? \"root\"\n auth_keys_file = '/root/.ssh/authorized_keys'\n else\n auth_keys_file = \"/home/#{config[:username]}/.ssh/authorized_keys\"\n end\n\n # we don't want to overwrite anything that may already exist here\n command = \"echo \\\"\\##{@name_args[0]}\\\" >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key.pub >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"chmod 0600 #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key\"\n ssh_key = run_remote_command(command)\n end", "def setup(credentials = {})\n requires :public_key, :public_ip_address, :username\n\n credentials[:password] = password unless self.password.nil?\n credentails[:key_data] = [private_key] if self.private_key\n\n commands = [\n %{mkdir .ssh},\n ]\n if public_key\n commands << %{echo \"#{public_key}\" >> ~/.ssh/authorized_keys}\n end\n\n # wait for domain to be ready\n Timeout::timeout(360) do\n begin\n Timeout::timeout(8) do\n Fog::SSH.new(public_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')\n end\n rescue Errno::ECONNREFUSED\n sleep(2)\n retry\n rescue Net::SSH::AuthenticationFailed, Timeout::Error\n retry\n end\n end\n Fog::SSH.new(public_ip_address, username, credentials).run(commands)\n end", "def read\n connection.open(full_remote_path).read\n end", "def local_clone\n raise CommandNotImplemented\n end", "def initialize\n @totalReadData = 0\t\t# variable for counting bytes read from rsync\n @rsync_path = \"/opt/local/bin/rsync\"\n end", "def initialize stat, location = nil\n @data = Hash.new\n @tags = nil\n if location\n begin\n IO.popen([\"sha256sum\", location]) do |io|\n @hash = io.read.split(' ')[0]\n end\n rescue Exception => e\n logger.error \"Can't hash #{location.inspect}: #{e}\"\n end\n @mimetype = MimeType.detect location\n @location = location\n @ctime = stat.ctime\n @mtime = stat.mtime\n @size = stat.size\n tags = location.split File::SEPARATOR\n tags.shift if tags[0].empty?\n @name = tags.pop\n @tags = tags\n else\n stdin\n end\n end", "def ssh_command(ssh_info)\n command_options = %W[\n -o Compression=yes\n -o DSAAuthentication=yes\n -o LogLevel=#{ssh_info[:log_level] || 'FATAL'}\n -o StrictHostKeyChecking=no\n -o UserKnownHostsFile=/dev/null\n ]\n\n if ssh_info[:forward_x11]\n command_options += %w[\n -o ForwardX11=yes\n -o ForwardX11Trusted=yes\n ]\n end\n\n if ssh_info[:forward_agent]\n command_options += %w[-o ForwardAgent=yes]\n end\n\n ssh_info[:private_key_path].each do |path|\n command_options += ['-i', path]\n end\n\n if ssh_info[:port]\n command_options += ['-p', ssh_info[:port]]\n end\n\n \"ssh #{command_options.join(' ')}\"\n end", "def exec(opts={})\n # Get the SSH information and cache it here\n ssh_info = info\n\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],\n :port => ssh_info[:port],\n :username => ssh_info[:username],\n :key_path => ssh_info[:private_key_path]\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n # If plain mode is enabled then we don't do any authentication (we don't\n # set a user or an identity file)\n plain_mode = opts[:plain_mode]\n\n options = {}\n options[:host] = ssh_info[:host]\n options[:port] = ssh_info[:port]\n options[:username] = ssh_info[:username]\n options[:private_key_path] = ssh_info[:private_key_path]\n\n # Command line options\n command_options = [\"-p\", options[:port].to_s, \"-o\", \"UserKnownHostsFile=/dev/null\",\n \"-o\", \"StrictHostKeyChecking=no\", \"-o\", \"LogLevel=FATAL\", \"-p\", options[:password].to_s]\n\n # Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option\n # (Also don't use it in plain mode, it'll skip user agents.)\n command_options += [\"-o\", \"IdentitiesOnly=yes\"] if !(Util::Platform.solaris? || plain_mode)\n\n command_options += [\"-i\", options[:private_key_path]] if !plain_mode\n command_options += [\"-o\", \"ForwardAgent=yes\"] if ssh_info[:forward_agent]\n\n # If there are extra options, then we append those\n command_options.concat(opts[:extra_args]) if opts[:extra_args]\n\n if ssh_info[:forward_x11]\n # Both are required so that no warnings are shown regarding X11\n command_options += [\"-o\", \"ForwardX11=yes\"]\n command_options += [\"-o\", \"ForwardX11Trusted=yes\"]\n end\n\n host_string = options[:host]\n host_string = \"#{options[:username]}@#{host_string}\" if !plain_mode\n command_options << host_string\n @logger.info(\"Invoking SSH: #{command_options.inspect}\")\n safe_exec(\"ssh\", *command_options)\n end", "def ssh_common_opts\n [\"-i #{@machine.ssh_info[:private_key_path]}\",\n \"-p #{@machine.ssh_info[:port]}\",\n \"-o StrictHostKeyChecking=no\",\n \"-o UserKnownHostsFile=/dev/null\",\n \"-o IdentitiesOnly=yes\",\n \"-o LogLevel=ERROR\"]\n end", "def ssh_info\n # If the Container is not created then we cannot possibly SSH into it, so\n # we return nil.\n return nil if state == :not_created\n\n network = @driver.inspect_container(@machine.id)['NetworkSettings']\n ip = network['IPAddress']\n\n # If we were not able to identify the container's IP, we return nil\n # here and we let Vagrant core deal with it ;)\n return nil unless ip\n\n {\n :host => ip,\n :port => @machine.config.ssh.guest_port\n }\n end", "def create_ssh_transport(host, options)\n require 'chef/provisioning/transport/ssh'\n ssh_user = options[:user]\n options = options.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }\n Chef::Provisioning::Transport::SSH.new(\n host,\n ssh_user,\n options.to_hash,\n @config[:machine_options][:sudo] ? { prefix: 'sudo ' } : {},\n config\n )\n end", "def ssh_info_check(session, host, user, pass)\n sshdump=@@outdir + host + '-ssh_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 hostname = session.exec!(\"hostname\").chomp\n print_good(\"Hostname: #{hostname}\") unless hostname.nil? or hostname == ''\n f.puts \"Hostname: #{hostname}\" unless hostname.nil? or hostname == ''\n id = session.exec!(\"id\").chomp\n print_good(\"UserID: #{id}\") if id =~ /uid=\\d+/\n f.puts \"UserID: #{id}\" if id =~ /uid=\\d+/\n uname = session.exec!(\"uname -a\").chomp\n print_good(\"Uname: #{uname}\") unless uname.nil? or uname == ''\n f.puts \"Uname: #{uname}\" unless uname.nil? or uname == ''\n uptime = session.exec!(\"uptime\").chomp\n print_good(\"Uptime: #{uptime}\") unless uptime.nil? or uptime == ''\n f.puts \"Uptime: #{uptime}\" unless uptime.nil? or uptime == ''\n f.puts\n puts\n session.close\n end", "def ssh_credential_for(username)\n ssh_credentials.where(:username => username).first\n end", "def build_remote_cmd(task, cmd_str, input, given_opts, ssh_opts)\n Remote::Cmd.new(cmd_str, ssh_opts)\n end", "def initialize(host, remote_dir, local_dir, *files)\n @host = host\n @remote_dir = remote_dir\n @local_dir = local_dir\n @files = files\n end", "def remote; end", "def clone\n Chord::new self.to_hash\n end", "def ssh_config_for(node, ssh_config: nil, nodes: nil, ssh_exec: nil, known_hosts_file: nil)\n if ssh_config.nil?\n params = {}\n params[:nodes] = nodes unless nodes.nil?\n params[:ssh_exec] = ssh_exec unless ssh_exec.nil?\n params[:known_hosts_file] = known_hosts_file unless known_hosts_file.nil?\n ssh_config = test_connector.ssh_config(**params)\n end\n ssh_config_lines = ssh_config.split(\"\\n\")\n begin_marker = node.nil? ? /^Host \\*$/ : /^# #{Regexp.escape(node)} - .+$/\n start_idx = ssh_config_lines.index { |line| line =~ begin_marker }\n return nil if start_idx.nil?\n\n end_markers = [\n /^\\# \\w+ - .+$/,\n /^\\#+$/\n ]\n end_idx = ssh_config_lines[start_idx + 1..].index { |line| end_markers.any? { |end_marker| line =~ end_marker } }\n end_idx = end_idx.nil? ? -1 : start_idx + end_idx\n \"#{\n ssh_config_lines[start_idx..end_idx].select do |line|\n stripped_line = line.strip\n !stripped_line.empty? && stripped_line[0] != '#'\n end.join(\"\\n\")\n }\\n\"\n end", "def newobj(type, name, hash)\n transport = Puppet::TransObject.new(name, \"file\")\n transport[:path] = path\n transport[:ensure] = \"file\"\n assert_nothing_raised {\n file = transport.to_ral\n }\n end", "def ssh_exec_simple!(ssh, command, print_no_chain) \n out, err, exit_code = ssh_exec!(ssh, command, print_no_chain)\n abort err if exit_code != 0\n\n # try converting the output to prettified JSON.\n begin\n parsed = JSON.parse(out) \n return JSON.pretty_generate(parsed)\n rescue\n # otherwise, just return the string as-is.\n return out\n end\nend", "def run(*args)\n case args.size\n when 3\n ssh_host, ssh_user, ssh_command = args \n when 2\n ssh_host, ssh_command = args\n ssh_user = self.user\n when 1\n ssh_host, ssh_user = self.host, self.user\n ssh_command = args.first\n else\n raise ArgumentError\n end\n return ssh_host.map{|host| run(host, ssh_user, ssh_command)} if ssh_host.is_a? Array\n \n key = \"#{ssh_user}@#{ssh_host}\"\n puts \" #{key}$ #{ssh_command}\"\n @ssh_sessions[key] ||= Net::SSH.start(ssh_host, ssh_user)\n output = @ssh_sessions[key].exec!(ssh_command)\n puts output.split(\"\\n\").map{|l| \" #{key}> #{l}\"}.join(\"\\n\") if output\n output\n end", "def ssh(command = nil,\n stdout_line_reader = HCluster.echo_stdout,\n stderr_line_reader = HCluster.echo_stderr,\n host = self.master.dnsName,\n begin_output = nil,\n end_output = nil)\n if (host == @dnsName)\n raise HClusterStateError,\n \"This HCluster has no master hostname. Cluster summary:\\n#{self.to_s}\\n\" if (host == nil)\n end\n \n HCluster.ssh_with_host(command,stdout_line_reader,stderr_line_reader,host,begin_output,end_output)\n end", "def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend", "def unix_create_remote_endpoint\n head = __method__\n set_status(\"Create\")\n log \"#{head}: Creating #{endpoint.at_type} #{remote_user}@#{remote_host}. Should already exist!\"\n uadmin_unix_ssh(\"sudo adduser #{remote_user} --quiet --disabled-password || exit 0\")\n uadmin_unix_ssh(\"sudo -u #{remote_user} mkdir -p ~#{remote_user}/.ssh\")\n uadmin_unix_ssh(\"sudo -u #{remote_user} chmod 777 ~#{remote_user}/.ssh\")\n file = pub_cert(ssh_cert)\n deploy_cert_path = deploy_cert\n begin\n uadmin_unix_scp(file.path, \"~#{remote_user}/.ssh/endpoint-#{name}.pub\")\n uadmin_unix_ssh(\"cat ~#{remote_user}/.ssh/endpoint-#{name}.pub | sudo -u #{remote_user} tee -a ~#{remote_user}/.ssh/authorized_keys\")\n rescue Exception => boom4\n log \"#{head}: error creating ~#{remote_user}/.ssh/endpoint-#{name}.pub on #{remote_host} - #{boom4} - trying to ignore\"\n end\n file.unlink\n uadmin_unix_ssh(\"sudo chown #{remote_user}:#{remote_user} ~#{remote_user} ~#{remote_user}/.ssh ~#{remote_user}/.ssh/*\")\n uadmin_unix_ssh(\"sudo -u #{remote_user} chmod 700 -f ~#{remote_user}/.ssh ~#{remote_user}/.ssh/*.pem\")\n\n unix_scp(deploy_cert_path, \"~/.ssh/endpoint-#{name}-deploy.pem\")\n unix_ssh(\"chmod 700 ~/.ssh/endpoint-#{name}-deploy.pem\")\n unix_ssh(\"mkdir -p ~/bin\")\n file = Tempfile.new(\"gitssh\")\n file.write(\"exec /usr/bin/ssh -o StrictHostKeyChecking=no -i ~/.ssh/endpoint-#{name}-deploy.pem $@\\n\")\n file.close\n unix_scp(file.path, \"~/bin/endpoint-#{name}-git\")\n unix_ssh(\"chmod +x ~/bin/endpoint-#{name}-git\")\n unix_ssh(\"ls -la\")\n unix_ssh(\"gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3\")\n unix_ssh(\"test -e .rvm || \\\\curl -L https://get.rvm.io | bash -s stable --autolibs=read-fail\")\n unix_ssh(\"test -e .rvm && bash --login -c \\\"rvm install #{ruby_version}\\\"\")\n log \"#{head}: Remote #{endpoint.at_type} #{remote_user}@#{remote_host} exists.\"\n set_status(\"Success:Create\")\n rescue Exception => boom\n log \"#{head}: error creating ~#{remote_user}@#{remote_host} on remote server - #{boom}\"\n set_status(\"Error:Create\")\n end", "def exec_new(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t channel = @ssh_session.open_channel do |ch|\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.info(\"SshConnection: starts executing '#{command}'\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-status: #{exit_status}\")\n\t if exit_status != 0\n\t @@logger.error(\"SshConnection.on_request: Remote command execution failed with code: #{exit_status}\")\n\t end\n end\n\t ch.on_request \"exit-signal\" do |ch, data|\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-signal: #{data.read_string}\")\n\t end\n ch.on_close do |ch|\n\t @@logger.info(\"SshConnection.on_close: remote end is closing!\")\n #@close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n\t @@logger.info(\"SshConnection.on_eof: remote end is done sending data\")\n #@close_handler.call() unless @close_handler.nil?\n end\n\t ch.on_open_failed do |ch, code, desc|\n\t @@logger.info(\"SshConnection.on_open_failed: code=#{code} desc=#{desc}\")\n\t end\n\t ch.on_process do |ch|\n\t #@@logger.debug(\"SshConnection.on_process; send line-feed/sleep\")\n\t ch.send_data(\"\\n\")\n\t end\n\n #ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"SshConnection: the remote command could not be invoked!\")\n exit_status = 127\n end\n end\n\t #ch.wait\n\t end\n\t channel.wait\n\t return exit_status\n\tend", "def public_file\n File.join @ssh_home, @ssh_id + \".pub\"\n end", "def peer_hash\n {\n :info_hash => sha,\n :peer_id => peer_id,\n :left => piece_length,\n :pieces => stream['info']['files']\n }\n end", "def configuration_for(host, use_ssh_config); end", "def ssh_into(instance=nil)\n Kernel.system \"#{ssh_command(instance)}\" if instance\n end", "def ssh(command = nil,\n stdout_line_reader = HCluster.echo_stdout,\n stderr_line_reader = HCluster.echo_stderr,\n host = self.master.dnsName,\n begin_output = nil,\n end_output = nil)\n if (host == @dnsName)\n raise HClusterStateError,\n \"This HCluster has no master hostname. Cluster summary:\\n#{self.to_s}\\n\" if (host == nil)\n end\n HCluster.ssh_with_host(command,stdout_line_reader,stderr_line_reader,host,begin_output,end_output)\n end", "def initialize( *args )\n @open = false\n @agent_forwarded = false\n\n process_arguments( *args )\n\n @registry.define do |b|\n b.crypto_backend { @crypto_backend }\n b.transport_host { @host }\n b.transport_options { @options }\n\n b.userauth_keys { @keys }\n b.userauth_host_keys { @host_keys }\n b.userauth_method_order { @auth_methods }\n\n b.host_key_verifier { @host_key_verifier }\n\n # Register myself with the registry, so that other services may\n # access me.\n b.session( :pipeline => [] ) { self }\n\n b.prompter do\n require 'net/ssh/util/prompter'\n Net::SSH::Util::Prompter.new\n end\n\n b.require 'net/ssh/transport/services', \"Net::SSH::Transport\"\n b.require 'net/ssh/connection/services', \"Net::SSH::Connection\"\n b.require 'net/ssh/userauth/services', \"Net::SSH::UserAuth\"\n\n b.require 'net/ssh/service/services', \"Net::SSH::Service\"\n end\n\n userauth = @registry[:userauth][:driver]\n if userauth.authenticate( \"ssh-connection\", @username, @password )\n @open = true\n @connection = @registry[:connection][:driver]\n if block_given?\n yield self\n close\n end\n else\n @registry[:transport][:session].close\n raise AuthenticationFailed, @username\n end\n end", "def get_file(from, to)\n run_session do |ssh|\n $log&.debug(\"#{self.class}##{__method__} - Copying file #{host}:#{from} to #{to}.\")\n data = ssh.sftp.download!(from, to)\n $log&.debug(\"#{self.class}##{__method__} - Copying of #{host}:#{from} to #{to}, complete.\")\n return data\n end\n end", "def initialize(repository, ssh_key, deploy_task)\n ssh_key = File.expand_path(ssh_key) if ssh_key\n @repository, @ssh_key, @deploy_task = repository, ssh_key, deploy_task\n end", "def setup_proc\n comp = self\n raise ArgumentError.new( \"File #{comp.local} is not exist!\" ) if !File.exists? comp.local\n\n set_check( ->(host) do \n if !test(\" [ -f #{comp.remote} ] \" )\n next false\n end\n\n local_checksum = `md5sum #{comp.local}`\n remote_checksum = capture( :md5sum, comp.remote )\n local_checksum.strip.split(\" \")[0] == remote_checksum.strip.split(\" \")[0]\n end )\n\n set_up( Proc.new{ |host|\n upload! comp.local, \"tmp\"\n if comp.permission\n execute( :chmod, comp.permission, \"tmp\" )\n end\n if test( \" [ -w '#{File.dirname comp.remote}' ] \" )\n execute( :mv, \"tmp\", comp.remote ) \n else\n prepare_sudo_password( host ) do\n as :root do\n execute( :mv, \"tmp\", comp.remote ) \n end\n end\n end\n if comp.owner\n prepare_sudo_password( host ) do\n as :root do\n execute( :chmod, comp.permission, comp.remote )\n end\n end\n end\n })\n\n set_down( Proc.new{ |host|\n if test( \" [ -w '#{File.dirname comp.remote}' ] \" )\n execute( :rm, comp.remote ) \n else\n prepare_sudo_password( host ) do \n as :root do\n execute( :rm, comp.remote ) \n end\n end\n end\n } )\n end" ]
[ "0.66841555", "0.640424", "0.6091002", "0.60506135", "0.5983183", "0.5975798", "0.5973566", "0.59719867", "0.59036124", "0.5883768", "0.58589464", "0.58589464", "0.58589464", "0.58589464", "0.5791261", "0.5717099", "0.5709597", "0.5641079", "0.5618762", "0.5617753", "0.5612619", "0.55969757", "0.5588379", "0.5547686", "0.551339", "0.55107564", "0.55066025", "0.55007154", "0.5499853", "0.54956114", "0.54909515", "0.54876125", "0.54834425", "0.54719317", "0.5471877", "0.5471877", "0.5471877", "0.5445607", "0.54450995", "0.5428786", "0.54018885", "0.5390697", "0.53876084", "0.53864026", "0.53757024", "0.53734803", "0.5352576", "0.5345416", "0.5322849", "0.5309643", "0.52968776", "0.52924305", "0.52885854", "0.5269182", "0.5266348", "0.5255765", "0.5221801", "0.52079237", "0.52013844", "0.5196259", "0.5196042", "0.5184244", "0.51808107", "0.5169599", "0.5168833", "0.5168072", "0.51660526", "0.51634425", "0.5151913", "0.51511854", "0.5146409", "0.5145569", "0.51349926", "0.51246023", "0.5123954", "0.5115181", "0.5110398", "0.51064026", "0.51016843", "0.5096669", "0.50911474", "0.5082177", "0.50820893", "0.50802386", "0.5079249", "0.50761676", "0.5075305", "0.50731874", "0.50729126", "0.50595737", "0.5054941", "0.50531393", "0.5051124", "0.5050456", "0.5048102", "0.50348157", "0.50325674", "0.5032038", "0.5026823", "0.5024371" ]
0.5890126
9
N Without this method, we cannot easily close any cached connections in the SSH & SCP implementation
def closeConnections() #N Without this, the connections won't be closed @sshAndScp.close() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeConnections\n #N Without this, cached SSH connections to the remote system won't get closed\n destinationLocation.closeConnections()\n end", "def closeConnections\n #N Without this the cached connections won't get closed\n @contentHost.closeConnections()\n end", "def close\n @net_ssh.close\n @net_ssh = nil\n end", "def connection_pool_maximum_reuse\n super\n end", "def close\n @channel.close if @channel\n @channel = nil\n @ssh.close if @close_all and @ssh\n end", "def close_ssh\n puts \"Close connection\"\n @ssh.close unless @ssh.closed?\n end", "def __close_connections\n # to be implemented by specific transports\n end", "def close\n ssh.close if @_ssh\n end", "def close\n log 'closing connection'\n @ssh.close\n end", "def empty_connection_pools!; end", "def sftp_close_connection(connection)\n connection.close!(connection)\nend", "def sftp_close_connection(connection)\n connection.close!(connection)\nend", "def close_expired_connections\n raise NotImplementedError\n end", "def close\n # by default do nothing - close any cached connections\n end", "def close\n Timeout.timeout(3) { @connector.close }\n true\n rescue\n warn \"ssh connection could not be closed gracefully\"\n Metriks.meter('worker.vm.ssh.could_not_close').mark\n false\n ensure\n buffer.stop\n @buffer = nil\n end", "def disconnect\n @ssh.close if @ssh\n @ssh = nil\n end", "def close_connections\n @connections.values.each(&:close)\n end", "def close_pipes; end", "def remote_connections; end", "def close\n pool.checkin self\n end", "def close\n pool.checkin self\n end", "def close_client_connections\n @pending_data.each_key(&:close)\n @pending_data.clear\n end", "def dispose\n return if @connection_pool.nil?\n\n until @connection_pool.empty?\n conn = @connection_pool.pop(true)\n conn&.close\n end\n\n @connection_pool = nil\n end", "def close\n @pool.each do |s|\n #@pool.remove(s)\n s.close\n #@pool.remove(s)\n end\n end", "def test_double_close()\n rdht = Scalaroid::ReplicatedDHT.new()\n rdht.close_connection()\n rdht.close_connection()\n end", "def save_ssh_connection(conn)\n conn.exec! 'cd ~'\n @lock.synchronize do\n @connection_pool << conn\n end\n rescue\n output \"Discarding nonfunctional SSH connection\"\n end", "def disconnect!() @connections.each_value(&:disconnect) end", "def open\n connect\n rescue Object => anything\n begin\n @ssh.shutdown!\n rescue ::Exception # rubocop:disable Lint/HandleExceptions, Lint/RescueException\n # swallow exceptions that occur while trying to shutdown\n end\n\n raise anything\n end", "def close_connection; end", "def reuse_connection\n logger.debug(\"[SSH] reusing existing connection #{@connection}\")\n yield @connection if block_given?\n @connection\n end", "def reuse_connection\n logger.debug(\"[SSH] reusing existing connection #{@connection}\")\n yield @connection if block_given?\n @connection\n end", "def close\n @pool.close\n end", "def stop\n @ssh.close if @ssh\n super.stop\n end", "def disconnect\n return unless pool\n pool.map(&:close)\n @pool = nil\n end", "def set_connection_pool_maximum_reuse(opts)\n opts = check_params(opts,[:reuses])\n super(opts)\n end", "def close()\n #N Without this check, we'll be trying to close the connection even if there isn't one, or it was already closed\n if @connection != nil\n #N Without this we won't get feedback about the SSH connection being closed\n puts \"Closing SSH connection to #{user}@#{host} ...\"\n #N Without this the connection won't actually get closed\n @connection.close()\n #N Without this we won't know the connection has been closed, because a nil @connection represents \"no open connection\"\n @connection = nil\n end\n end", "def disconnect; @connection.close end", "def cleanup\n\t\tcleanup_ssh\n\n\tend", "def connection_closed\n end", "def testDoubleClose()\n rdht = Scalaris::ReplicatedDHT.new()\n rdht.close_connection()\n rdht.close_connection()\n end", "def testDoubleClose()\n rdht = Scalaris::ReplicatedDHT.new()\n rdht.close_connection()\n rdht.close_connection()\n end", "def close_connections\n @connections ||= {}\n @connections.values.each do |connection|\n begin\n connection.disconnect!\n rescue\n end\n end\n\n @connections = {}\n end", "def close_all\n @connections.close_all\n end", "def freeVNCPool\n $VNC_SCREEN_POOL.each { @connection_controller.close_connection(0) }\n @connection_controller = false\n end", "def close\n inactive!\n close_connections\n end", "def realize_pending_connections! #:nodoc:\n return unless concurrent_connections\n\n server_list.each do |server|\n server.close if !server.busy?(true)\n server.update_session!\n end\n\n @connect_threads.delete_if { |t| !t.alive? }\n\n count = concurrent_connections ? (concurrent_connections - open_connections) : @pending_sessions.length\n count.times do\n session = @pending_sessions.pop or break\n # Increment the open_connections count here to prevent\n # creation of connection thread again before that is\n # incremented by the thread.\n @session_mutex.synchronize { @open_connections += 1 }\n @connect_threads << Thread.new do\n session.replace_with(next_session(session.server, true))\n end\n end\n end", "def close_file_descriptors; end", "def close\n @pool.dispose\n end", "def close\n @mutex.lock do\n unless @connection_pool.nil? or @connection_pool.is_closed\n @connection_pool.close\n @connection_pool = nil\n end\n end\n end", "def close\n @clients.each { |c| c.reset(); c.close() } if @clients\n end", "def disconnect; end", "def disconnect; end", "def disconnect!\n @logger.info(\"Terminating SSH connection to server name=#{@name}\")\n @ssh.close\n @ssh = nil\n end", "def cleanup_connections\n @connections.keep_if do |thread, conns|\n thread.alive?\n end\n end", "def without_reconnect(&block); end", "def connection_pool_replenish_state\n super\n end", "def release()\n fiber = Fiber.current\n if fiber[connection_pool_key]\n @busy_connections.delete(fiber)\n @connections << fiber[connection_pool_key]\n fiber[connection_pool_key] = nil\n end\n end", "def test_reap_flush_on_discarded_pool\n pool_config = duplicated_pool_config\n pool = ConnectionPool.new(pool_config)\n\n pool.discard!\n pool.reap\n pool.flush\n end", "def redis_pool; end", "def finish\n release_read_pool_connection\n end", "def close_conn(spec, h_conn, for_real = false)\n case @handling_mode\n when :cache\n # do nothing i think?\n when :pool\n # return the conn back to the pool\n else\n nil\n end\n end", "def clear_active_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:release_connection)\n end", "def disconnect_read_pool!\n @read_pool.disconnect!\n end", "def connection_closed\n close\n end", "def connection_pool_maximum_size\n super\n end", "def before_fork\n return unless (defined? ::DataObjects::Pooling)\n return if ::DataMapper.repository.adapter.to_s =~ /Sqlite3Adapter/\n ::DataMapper.logger.debug \"+-+-+-+-+ Cleaning up connection pool (#{::DataObjects::Pooling.pools.length}) +-+-+-+-+\"\n ::DataObjects::Pooling.pools.each {|p| p.dispose} \n end", "def finalize\n @server.close if @server\n end", "def disconnect!; end", "def disconnect!(timeout: 120)\n start_time = ::Gitlab::Metrics::System.monotonic_time\n\n while (::Gitlab::Metrics::System.monotonic_time - start_time) <= timeout\n break if pool.connections.none?(&:in_use?)\n\n sleep(2)\n end\n\n pool.disconnect!\n end", "def disconnect_ssh_tunnel\n @logger.debug('closing SSH tunnel..')\n\n @ssh.shutdown! unless @ssh.nil?\n @ssh = nil\n end", "def initialize_ssh; end", "def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end", "def dispose; end", "def throw_away!\n pool.remove self\n disconnect!\n end", "def shutdown(how = 2)\n begin\n super\n ensure\n @tunnel.remove if closed?\n end\n return 0\n end", "def cleanup\n super\n disconnect\n end", "def disconnect!\n super\n @raw_connection&.close\n @raw_connection = nil\n end", "def shutdown\n @pool.shutdown do |connection|\n connection.quit\n end\n end", "def shutdown\n @pool.shutdown do |connection|\n connection.quit\n end\n end", "def do_close; end", "def cleanup\n @channel.close if @channel\n\n nil\n end", "def reexecute_connections?\n return true\n end", "def disconnect!\n @reserved_connections.each do |name,conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect!\n end\n @connections = []\n end", "def disconnect\n @conn.close\nend", "def steal! # :nodoc:\n if in_use?\n if @owner != Thread.current\n pool.send :remove_connection_from_thread_cache, self, @owner\n\n @owner = Thread.current\n end\n else\n raise ActiveRecordError, \"Cannot steal connection, it is not currently leased.\"\n end\n end", "def close\n connection.close if connection\n end", "def close\n if self.conn && !self.conn.closed?\n self.conn.shutdown\n self.conn.close\n end\n\n self.conn = nil\n end", "def retry\n @channel_control.release\n end", "def connection_pool_idle_timeout\n super\n end", "def close()\n @connected = false\n @my.close()\n @my = nil\n end", "def close() end", "def close() end", "def close() end", "def close() end", "def ignore_disconnect; end", "def close() end", "def close()\n @connection.disconnect\n @connection = nil\n end", "def clear_reloadable_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:clear_reloadable_connections!)\n end", "def close; true; end", "def close; true; end" ]
[ "0.7229412", "0.69069695", "0.66445017", "0.6554237", "0.6432202", "0.6409133", "0.6390772", "0.6328181", "0.62917966", "0.625158", "0.6216336", "0.6216336", "0.61963433", "0.6148562", "0.61121523", "0.60858256", "0.60329705", "0.6009913", "0.5998809", "0.5927027", "0.5927027", "0.59112823", "0.5904944", "0.5876678", "0.58748674", "0.58704144", "0.58692294", "0.5848115", "0.5845694", "0.5810145", "0.57984984", "0.5796736", "0.57507616", "0.5745945", "0.57264733", "0.57129204", "0.5712883", "0.5708916", "0.56952256", "0.56951284", "0.56951284", "0.56945103", "0.56924665", "0.56764865", "0.5673856", "0.56536126", "0.56437784", "0.5621554", "0.56208736", "0.5613571", "0.55510855", "0.55510855", "0.55473614", "0.5546262", "0.55443484", "0.55399567", "0.55351543", "0.5502514", "0.54947907", "0.5493924", "0.5490191", "0.5479515", "0.5477849", "0.54752", "0.5470459", "0.546931", "0.54687154", "0.5467733", "0.54597133", "0.5458036", "0.5451741", "0.5451335", "0.5447958", "0.5436384", "0.54241586", "0.5423782", "0.5390118", "0.5389241", "0.5389241", "0.53827876", "0.5378836", "0.53709865", "0.53640217", "0.5360652", "0.53601605", "0.53488886", "0.5348313", "0.5346074", "0.5344752", "0.5344615", "0.5342606", "0.5342606", "0.5342606", "0.5342606", "0.5342356", "0.5342218", "0.53339636", "0.53283465", "0.5321016", "0.5321016" ]
0.7248976
0
Return readable description of base directory on remote system N Without this, we have no easy way to display a description of a directory location on this remote host
def locationDescriptor(baseDir) #N Without this, the directory being displayed might be missing the final '/' baseDir = normalisedDir(baseDir) return "#{userAtHost}:#{baseDir} (connect = #{shell}/#{scpProgram}, hashCommand = #{hashCommand})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_remote_dir\n return @resource[:remote_dir]\n end", "def full_path_to_remote_dir\n (remote_dir[0] == ?/ ? remote_dir : \"$(pwd)/#{remote_dir}\").chomp('/')\n end", "def describe\n\t\t\"Shows the folder and files of the present working directory.\"\n\tend", "def pathBaseSummary()\n return \"#{@resultBaseDir}/#{getConf(:basenameSummary)}\" ;\n end", "def pwd\r\n ndev.rpc.command(\"show cli directory\").text.strip\r\n end", "def to_s\n return contentHost.locationDescriptor(baseDir)\n end", "def fs_description\n repo_paths = root_paths || [ File.dirname(child_paths[\"cookbooks\"][0]) ]\n result = \"repository at #{repo_paths.join(\", \")}\"\n if versioned_cookbooks\n result << \" (Multiple versions per cookbook)\"\n else\n result << \" (One version per cookbook)\"\n end\n child_paths.each_pair do |name, paths|\n if paths.any? { |path| !repo_paths.include?(File.dirname(path)) }\n result << \" #{name} at #{paths.join(\", \")}\\n\"\n end\n end\n result\n end", "def tar_directory #:nodoc:\n rp = Pathname.new(remote_directory)\n rp.dirname.to_s\n end", "def describe\n\t\t\"Show the present working directory.\"\n\tend", "def dir\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Fs::Dir)\n\tend", "def dir\n @data['info']['name']\n end", "def dir\n @directory\n end", "def directory\r\n \[email protected]\r\n end", "def fs_description\n repo_path = File.dirname(child_paths['cookbooks'][0])\n result = \"repository at #{repo_path}\\n\"\n if Chef::Config[:versioned_cookbooks]\n result << \" Multiple versions per cookbook\\n\"\n else\n result << \" One version per cookbook\\n\"\n end\n child_paths.each_pair do |name, paths|\n if paths.any? { |path| File.dirname(path) != repo_path }\n result << \" #{name} at #{paths.join(', ')}\\n\"\n end\n end\n result\n end", "def repository_display\n if ENV['EAD'].present?\n if File.directory?(Rails.root.join(ENV['EAD']))\n return ENV['EAD'].split(\"\\/\")[-1]\n else\n return ENV['EAD'].split(\"\\/\")[-2]\n end\n end\n end", "def dir; end", "def dir; end", "def dir; end", "def description()\r\n #out puts what the command is doing and the path it is taking to do it\r\n puts \"Creating a Directory: #{@DirectoryPath}\"\r\n end", "def directory_uri\n template = Addressable::Template.new(\n \"https://{host}/discovery/v1/apis\"\n )\n return template.expand({\"host\" => self.host})\n end", "def dir\n # config.repos_dir + @name\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def to_s\n @directory\n end", "def listFiles(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this we wouldn't be executing the command to list all files in the remote directory\n ssh(findFilesCommand(baseDir).join(\" \")) do |line| \n #N Without this we wouldn't be echoing the file name on this line for the user to read\n puts \" #{line}\"\n end\n end", "def pretty_info\n s = ''\n dev = self.device\n return \"Disk image: #{self.image_path.basename} (na, detached, na)\\n\" if dev.nil?\n return dev.pretty_info\n end", "def remote_fs_dir_resource\n return @remote_fs_dir_resource if @remote_fs_dir_resource\n @remote_fs_dir_resource = Chef::Resource::Directory.new(new_resource.remote_fs, run_context)\n @remote_fs_dir_resource.owner(new_resource.user)\n @remote_fs_dir_resource.group(new_resource.group)\n @remote_fs_dir_resource.recursive(true)\n @remote_fs_dir_resource\n end", "def directory; end", "def directory; end", "def dir\n calc_dir(@basename)\n end", "def base\n [location, Puppet[:ldapbase]].join(\",\")\n end", "def displayname\n path\n end", "def dir\n @working_directory\n end", "def relative_to_mount(remote_file) # :nodoc:\n remote_file\n end", "def inspect\n \"#<#{self.class}: #{@cwd}>\"\n end", "def inspect\n \"#<#{self.class}: #{@cwd}>\"\n end", "def command_pwd\n # Respond with absolute path for this client\n puts \"Sending #{@directory.path}\"\n @client.puts @directory.path\n end", "def dir_shortref # :nodoc:\n rev_parse[0..11]\n end", "def dir_shortref # :nodoc:\n rev_parse[0..11]\n end", "def rc_dirs; end", "def get_local_dir\n return @resource[:local_dir]\n end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def base_dir; end", "def path\n @base\n end", "def path\n File.join(RH_CONFIG[\"location\"], self.parent.pid.gsub(/:/,\"_\"), \"data\", self.name.first) unless self.parent.nil? or self.name.empty?\n end", "def path\n @directory.path\n end", "def dir\n self\n end", "def pretty_info\n volinfo = self.info\n mountpoint = volinfo['MountPoint']\n mountpoint = 'Not mounted' if mountpoint.empty?\n rw = volinfo['WritableVolume'] ? 'writable' : 'read-only'\n ownership = self.ownership_enabled? ? 'ownership enabled' : 'no ownership'\n return volinfo['VolumeName'] + \" (#{self.dev_node}, #{mountpoint}, #{rw}, #{ownership})\\n\" \n end", "def list_directories(client)\n client.directories.each do |directory|\n puts \"Directory: #{directory.name}\"\n puts \" Description: #{directory.description}\"\n puts \" Status: #{directory.status}\"\n puts \" Href: #{directory.href}\"\n end\nend", "def directories; end", "def directories; end", "def remote_fs_dir_resource\n return @remote_fs_dir_resource if @remote_fs_dir_resource\n @remote_fs_dir_resource = Chef::Resource::Directory.new(new_resource.remote_fs, run_context)\n @remote_fs_dir_resource.rights(:full_control, new_resource.user)\n @remote_fs_dir_resource.recursive(true)\n @remote_fs_dir_resource\n end", "def download_display_name\n if self.name == '/'\n self.name\n else\n '/' + self.name + '/'\n end\n end", "def directory\n return _meta_data['directory'] if _meta_data.has_key? 'directory'\n dir\n end", "def listDirectories(baseDir)\n #N if un-normalised, code assuming '/' at the end might be one-off\n baseDir = normalisedDir(baseDir)\n #N without the command, we don't know what command to execute to list the directories\n command = findDirectoriesCommand(baseDir)\n #N without this, the command won't execute, or we it might execute in a way that doesn't let us read the output\n output = getCommandOutput(command)\n #N without initial directories, we would have nowhere to accumulate the directory relative paths\n directories = []\n #N without the base dir length, we don't know how much to chop off the path names to get the relative path names\n baseDirLen = baseDir.length\n #N without this, would not get feedback that we are listing directories (which might be a slow remote command)\n puts \"Listing directories ...\"\n #N without looping over the output, we wouldn't be reading the output of the listing command\n while (line = output.gets)\n #N without chomping, eoln would be included in the directory paths\n line = line.chomp\n #N without this, would not get feedback about each directory listed\n puts \" #{line}\"\n #N without this check, unexpected invalid output not including the base directory would be processed as if nothing had gone wrong\n if line.start_with?(baseDir)\n #N without this, the directory in this line of output wouldn't be recorded\n directories << line[baseDirLen..-1]\n else\n #N if we don't raise the error, an expected result (probably a sign of some important error) would be ignored\n raise \"Directory #{line} is not a sub-directory of base directory #{baseDir}\"\n end\n end\n #N if we don't close the output, then un-opened output stream objects will accumulate (and leak resources)\n output.close()\n #N if we don't check the process status, then a failed command will be treated as if it had succeeded (i.e. as if there were no directories found)\n checkProcessStatus(command)\n return directories\n end", "def directory\n self.path.directory\n end", "def get_dir_name\n return @builder['dir_label'].text\n end", "def directory\n return @directory\n end", "def working_directory\n @link.WorkingDirectory\n end", "def base_relative_dir\n \t\[email protected](/^\\//,\"\")\n \tend", "def remote_backup_path\n [remote_directory, Confluence.filename].join('/')\n end", "def directory_name\n return @directory_name.to_s if @directory_name\n return local_path.basename.to_s if exist?\n return name\n end", "def dir\n Rails.root.join(ROOT, type, name).to_s\n end", "def directory_index\n return @directory_index\n end", "def dir_name\n @dir_name ||= select { |type,value| type == :dir_name }.map do |(type,value)|\n value\n end\n end", "def dirs; end", "def dirs; end", "def stat\n factory.system.dir_stat(@path)\n end", "def download_display_name\n\t\tif self.name == '/'\n\t\t\tself.name\n\t\telse\n\t\t\t'/' + self.name + '/'\n\t\tend\n\tend", "def directory\n @directory ||= cursor(pos_directory).backward.name(\"page_directory\") do |c|\n directory_slots.times.map { |n| c.name(\"slot[#{n}]\") { c.read_uint16 } }\n end\n end", "def given_destination\n dir\n end", "def base_directory\n @base_directory\n end", "def home_path\n @ssh_home\n end", "def z_interface\n file = File.expand_path('~/.z')\n return unless File.exist? file\n\n @title = 'Directories from ~/.z'\n @files = `sort -rn -k2 -t '|' ~/.z | cut -f1 -d '|'`.split(\"\\n\")\n home = ENV['HOME']\n # shorten file names\n @files.collect! do |f|\n f.sub(/#{home}/, '~')\n end\nend", "def fullpath; end", "def dir\n \"#{@output_prefix}#{Time.new.strftime \"%Y-%m-%d-%H:%M:%S\"}__#{@handle}:#{@id.to_s.rjust(3, '0')}\"\n end", "def base_info_file\n ck_valid\n File.join(SysConf.value_for(:pid_dir), '%s_%03d' % [@laboratory.name, @num])\n end", "def mountpoint\n self\n end", "def mountpoint\n self\n end", "def dir(*) end", "def get_clone_directory()\n\n if @to\n folder_exists = File.directory?( @to )\n FileUtils.mkdir_p( @to ) unless folder_exists\n return @to\n end\n\n if @verse.has_key?( Indices::GIT_CLONE_BASE_PATH )\n folder_exists = File.directory?( @verse[ Indices::GIT_CLONE_BASE_PATH ] )\n FileUtils.mkdir_p( @verse[ Indices::GIT_CLONE_BASE_PATH ] ) unless folder_exists\n return @verse[ Indices::GIT_CLONE_BASE_PATH ]\n end\n\n return Dir.pwd()\n\n end", "def local_to_remote local\n local.match /#{config[:relative_dir_regex]}/\n subdir = $2\n basename = File.basename local\n File.join(config[:root_dir], subdir, basename)\n end", "def provider_readdir(dirname, recursive=true, allowed_types = [:regular, :directory]) #:nodoc:\n\n dirname = Pathname.new(dirname)\n allowed_types = Array(allowed_types)\n\n list = []\n\n # Syscall caches\n uid_to_owner = {}\n gid_to_group = {}\n\n # Call the datalad repository method to get the short\n # reports about each entry\n DataladRepository.list_contents_from_dataset(dirname,recursive).each do |fname|\n\n # There are only three attributes in the reports\n name = fname[:name] # relative path, e.g. \"a/b/c.txt\"\n size = fname[:size_in_bytes]\n type = fname[:type]\n\n dl_full_path = dirname.join(name)\n\n # fix type\n type = :regular if type == :file || type == :gitannexlink\n\n next unless allowed_types.include? type\n next if is_excluded?(name)\n\n # get stat with lstat\n stat = File.lstat(dl_full_path)\n\n # Look up user name from uid\n uid = stat.uid\n owner_name = (uid_to_owner[uid] ||= (Etc.getpwuid(uid).name rescue uid.to_s))\n\n # Lookup group name from gid\n gid = stat.gid\n group_name = (gid_to_group[gid] ||= (Etc.getgrgid(gid).name rescue gid.to_s))\n\n # Create a FileInfo\n fileinfo = FileInfo.new\n\n # From Datalad\n fileinfo.name = name\n fileinfo.symbolic_type = type\n fileinfo.size = size\n\n # From lstat():\n fileinfo.permissions = stat.mode\n fileinfo.atime = stat.atime\n fileinfo.ctime = stat.ctime\n fileinfo.mtime = stat.mtime\n fileinfo.uid = uid\n fileinfo.owner = owner_name\n fileinfo.gid = gid\n fileinfo.group = group_name\n\n list << fileinfo\n end\n\n list.sort! { |a,b| a.name <=> b.name }\n list\n end", "def show_folders\n\n w=WinReg.new(@file)\n w.debug=@debug\n\n FOLDER_DEFAULTS.each do |key|\n @location = w.read_key(FOLDERS_BASE+'\\\\'+key[:name])\n puts \"#{key[:name]} -> #{@location}\" if @verbose\n end\n end", "def remote_storage_base_path\n File.join(self.class.model_path_segment(model), dynamic_segment)\n end", "def dir\n \"/photos\"\n end", "def path\n\t\tif self.instance_of?(UNIXServer)\n\t\t\t@path\n\t\telse\n\t\t\t\"\"\n\t\tend\n\tend", "def do_ls()\n\t\tif @system_type == WINDOWS then \n\t\t\treturn %x(dir #{@path})\n\t\tend \n\t\tif @system_type == UNIX then \n\t\t\treturn %x(ls #{@path})\n\t\tend\n\tend", "def bits_full_local_path_dl\n \"#{bits_full_local_path}.dl\"\n end", "def base_path\n Dir.pwd + \"/\"\n end", "def get_user_remote_path app_base, server_type\n path = File.join app_base, '/app/servers/', server_type, 'remote'\n File.exists?(path) ? path : nil\n end", "def object_dir\n ::File.join(new_resource.config_home, type_from_name) + 's'\n end", "def raw_gitdir\n\t\t\twith_dir do\n\t\t\t\treturn Pathname.new(%x/git rev-parse --git-dir/.chomp)\n\t\t\tend\n\t\tend", "def base_dir\n raise NotImplementedError\n end", "def test_listedpath\n server = nil\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n\n # create a deep dir\n basedir = tempfile\n testdir = \"#{basedir}/with/some/sub/directories/for/testing\"\n oldfile = File.join(testdir, \"oldfile\")\n assert_nothing_raised {\n system(\"mkdir -p #{testdir}\")\n File.open(oldfile, \"w\") { |f|\n 3.times { f.puts rand(100) }\n }\n @@tmpfiles << basedir\n }\n\n # mounty mounty\n assert_nothing_raised {\n server.mount(basedir, \"localhost\")\n }\n\n list = nil\n # and then check a few dirs\n assert_nothing_raised {\n list = server.list(\"/localhost/with\", :manage, false, false)\n }\n\n assert(list !~ /with/)\n\n assert_nothing_raised {\n list = server.list(\"/localhost/with/some/sub\", :manage, true, false)\n }\n\n assert(list !~ /sub/)\n end" ]
[ "0.66585267", "0.64245605", "0.63922226", "0.634003", "0.62467635", "0.6228812", "0.60992074", "0.6099058", "0.60652155", "0.6019648", "0.60022634", "0.59377795", "0.5921625", "0.59187955", "0.5873931", "0.5818918", "0.5818918", "0.5818918", "0.57985294", "0.5767316", "0.57669246", "0.57512254", "0.575095", "0.5701699", "0.5679705", "0.5663451", "0.5663417", "0.566238", "0.566238", "0.56322074", "0.56103593", "0.5599872", "0.5596437", "0.55886734", "0.5572353", "0.5572353", "0.5561257", "0.55569446", "0.55569446", "0.5549381", "0.5537397", "0.5536355", "0.5536355", "0.5536355", "0.5536355", "0.5536355", "0.5536355", "0.5536355", "0.5527672", "0.5499994", "0.5493079", "0.54847336", "0.5474103", "0.54729337", "0.54678804", "0.54678804", "0.54674536", "0.5462069", "0.54592115", "0.54585844", "0.5454534", "0.545217", "0.5449415", "0.5445487", "0.5426065", "0.5423116", "0.5414746", "0.54130787", "0.54125947", "0.5412439", "0.5399222", "0.5399222", "0.5394254", "0.5391188", "0.53859395", "0.5385365", "0.5377598", "0.5375339", "0.53632486", "0.5357597", "0.5350304", "0.53336555", "0.53310573", "0.53310573", "0.53299874", "0.53279454", "0.5327264", "0.5324224", "0.53215176", "0.5320727", "0.5319231", "0.5312543", "0.53124595", "0.5310412", "0.5305404", "0.5303468", "0.5300355", "0.5297617", "0.5295808", "0.52797693" ]
0.692154
0
execute an SSH command on the remote system, yielding lines of output (or don't actually execute, if dryRun is false) N Without this method, we won't have an easy way to execute a remote command on the host, echoing the command details first (so that we can see what command is to be executed), and possibly only doing a dry run and not actually executing the command
def ssh(commandString, dryRun = false) #N Without this, the command won't actually be executed sshAndScp.ssh(commandString, dryRun) do |line| #N Without this, this line of output won't be available to the caller yield line end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh(commandString, dryRun)\n #N Without this we won't have a description to display (although the value is only used in the next statement)\n description = \"SSH #{user}@#{host}: executing #{commandString}\"\n #N Without this the command description won't be echoed\n puts description\n #N Without this check, the command will execute even when it's only meant to be a dry run\n if not dryRun\n #N Without this, the command won't execute, and we won't have the output of the command\n outputText = connection.exec!(commandString)\n #N Without this check, there might be a nil exception, because the result of exec! can be nil(?)\n if outputText != nil then\n #N Without this, the output text won't be broken into lines\n for line in outputText.split(\"\\n\") do\n #N Without this, the code iterating over the output of ssh won't receive the lines of output\n yield line\n end\n end\n end\n end", "def ssh(commandString, dryRun)\n #N Without this, command being executed won't be echoed to output\n puts \"SSH #{userAtHost} (#{shell.join(\" \")}): executing #{commandString}\"\n #N Without this check, the command will execute even it it's meant to be a dry run\n if not dryRun\n #N Without this, the command won't actually execute and return lines of output\n output = getCommandOutput(shell + [userAtHost, commandString])\n #N Without this loop, the lines of output won't be processed\n while (line = output.gets)\n #N Without this, the lines of output won't be passed to callers iterating over this method\n yield line.chomp\n end\n #N Without closing, the process handle will leak resources\n output.close()\n #N Without a check on status, a failed execution will be treated as a success (yielding however many lines were output before an error occurred)\n checkProcessStatus(\"SSH #{userAtHost} #{commandString}\")\n end\n end", "def remote_command command, options={}\n return unless running?\n returning({ :stdout => '', :stderr => '', :exit_status => nil }) do |output|\n remote_stdout, remote_stderr, exit_code = '', '', nil\n Net::SSH.start(public_ip, options[:user] || \"root\", {:paranoid => false}.merge(options)) do |connection|\n connection.open_channel do |channel|\n channel.on_data { |ch, data| output[:stdout] += data }\n channel.on_extended_data { |ch, type, data| output[:stderr] += data }\n channel.on_request(\"exit-status\") do |p, data|\n output[:exit_status] = data.read_long\n end\n channel.exec(command) do |ch, executing|\n raise \"Could not execute: #{command}\" unless executing\n end\n end\n end\n end\n end", "def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end", "def exec(command, options={})\n ssh.exec(command, options)\n end", "def ssh(commandString, dryRun = false)\n contentHost.sshAndScp.ssh(commandString, dryRun)\n end", "def ssh_exec(command)\n stdout_data = ''\n stderr_data = ''\n exit_status = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.request_pty do |ch, success|\n raise 'Could not obtain pty' unless success\n\n ch.on_data do |ch, data|\n good_info data\n\n if data.match /sudo\\] password/\n unless ssh_options[:password]\n ssh_options[:password] = prompt(\"\\n<ROSH> Enter your password: \", false)\n end\n\n ch.send_data \"#{ssh_options[:password]}\\n\"\n ch.eof!\n end\n\n stdout_data << data\n end\n\n run_info(command)\n r = ch.exec(command)\n channel.close if r\n end\n\n channel.on_extended_data do |_, data|\n bad_info data.to_s\n stderr_data << data\n end\n\n channel.on_request('exit-status') do |_, data|\n exit_status = data.read_long\n end\n\n channel.on_request('exit-signal') do |_, data|\n exit_signal = data.read_long\n end\n end\n\n ssh.loop\n\n SSHResult.new(stdout_data, stderr_data, exit_status, exit_signal)\n end", "def ssh_exec!(ssh)\n output_data = ''\n exit_code = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.exec(@command) do |ch, success|\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\" unless success\n\n channel.on_data do |_, data|\n output_data += data\n yield data if block_given?\n end\n\n channel.on_extended_data do |_, type, data|\n output_data += data\n yield data if block_given?\n end\n\n channel.on_request('exit-status') { |_, data| exit_code = data.read_long }\n\n channel.on_request('exit-signal') { |_, data| exit_signal = data.read_long }\n end\n end\n\n ssh.loop\n [output_data, exit_code, exit_signal]\n end", "def ssh_exec!(ssh, command)\n stdout_data = ''\n stderr_data = ''\n exit_code = nil\n exit_signal = nil\n ssh.open_channel do |channel|\n channel.exec(command) do |_ch, success|\n unless success\n abort 'FAILED: couldn\\'t execute command (ssh.channel.exec)'\n end\n channel.on_data do |_ch, data|\n stdout_data += data\n puts stdout_data\n end\n\n channel.on_extended_data do |_ch, _type, data|\n stderr_data += data\n puts stderr_data\n end\n\n channel.on_request('exit-status') do |_ch, data|\n exit_code = data.read_long\n end\n\n channel.on_request('exit-signal') do |_ch, data|\n exit_signal = data.read_long\n end\n end\n end\n ssh.loop\n [stdout_data, stderr_data, exit_code, exit_signal]\nend", "def exec(*args)\n command = args.shift\n\n arguments = Array.new\n arguments << %(sudo) if (@use_sudo == true)\n arguments << command\n arguments << args\n arguments = arguments.flatten.compact.join(' ')\n\n output = Array.new\n\n if @ssh.is_a?(ZTK::SSH)\n output << @ssh.exec(arguments, :silence => true, :ignore_exit_status => true).output\n else\n if @ssh.respond_to?(:exec!)\n output << @ssh.exec!(arguments)\n else\n raise SSHError, \"The object you assigned to ssh does not respond to #exec!\"\n end\n end\n\n output.join.strip\n end", "def exec_cmd cmd\n t = Time.now\n results = \"\"\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch,success|\n unless success\n Logger.<<(__FILE__,\"INFO\",\"Could Not execute command #{cmd}\")\n abort\n end\n # stdout\n channel.on_data do |ch,data|\n results += data\n end\n # stderr\n channel.on_extended_data do |ch,type,data|\n Logger.<<(__FILE__,\"ERROR\",\"Error from the cmd #{cmd} : #{data}\")\n abort\n end\n channel.on_close do |ch|\n end\n end\n end\n # wait for the command to finish\n @ssh.loop\n Logger.<<(__FILE__,\"DEBUG\",\"SFTP Command executed in #{Time.now - t} sec\") if @opts[:v]\n results.split\n end", "def execute_ssh(commands)\n commands = [commands] unless commands.is_a? Array\n result = \"\"\n Net::SSH.start settings.remote_server, settings.remote_user do |ssh|\n commands.each do |command|\n was_error = false\n logger.info \"ssh: #{command}\"\n ssh.exec! command do |channel, stream, data|\n case stream\n when :stdout\n logger.info data\n result += \"#{data}\\n\" unless data.empty?\n when :stderr\n logger.error data\n was_error = true\n end\n end\n throw \"Exception during ssh, look in log file\" if was_error\n end\n end\n result\n end", "def remote_command(type, command, options)\n # If the VM is not running, then we can't run SSH commands...\n raise Errors::VMNotRunningError if @vm.state != :running\n\n # Initialize the result object, execute, and store the data\n result = OpenStruct.new\n result.stderr = \"\"\n result.stdout = \"\"\n result.exit_code = @vm.channel.send(type, command,\n :error_check => false) do |type, data|\n if type == :stdout\n result.stdout += data\n elsif type == :stderr\n result.stderr += data\n end\n\n # If we're echoing data, then echo it!\n if options[:echo]\n @vm.ui.info(data.to_s,\n :prefix => false,\n :new_line => false)\n end\n end\n\n # Return the result\n result\n end", "def exec!(cmd)\n connect! unless @connected\n if using_ssh?\n logger.debug(\"ssh: \" + cmd)\n ssh_session.exec!(cmd)\n else\n logger.debug(cmd)\n `#{cmd}`\n end\n end", "def execute(command)\n if remote?\n @remote.exec(command)\n else\n rays_exec(command)\n end\n end", "def exec(command, input = nil)\n result = command_results.build\n result.start! command, input\n exit_code = nil\n ssh_channel = @net_ssh.open_channel do |channel|\n channel.exec command do |_, success|\n if success\n channel.send_data input if input\n channel.eof!\n channel.on_data do |_, data|\n result.append_to_stdout! data\n end\n channel.on_extended_data do |_, type, data|\n result.append_to_stderr! data if type == :stderr\n end\n channel.on_request 'exit-status' do |_, data|\n exit_code = data.read_long\n end\n channel.on_request 'exit-signal' do |_, data|\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = data.read_long\n end\n else\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = 255\n channel.close\n end\n end\n end\n ssh_channel.wait\n result.completed! exit_code || 0\n end", "def remote_shell args\n remote(args) do |ssh|\n command = true\n while command\n print \"> \"\n command = gets\n if command\n result = ssh.exec! command\n puts result.split(\"\\n\").awesome_inspect if not result.nil?\n end\n end\n ssh.exec! \"exit\"\n end\n end", "def ssh_exec_simple!(ssh, command, print_no_chain) \n out, err, exit_code = ssh_exec!(ssh, command, print_no_chain)\n abort err if exit_code != 0\n\n # try converting the output to prettified JSON.\n begin\n parsed = JSON.parse(out) \n return JSON.pretty_generate(parsed)\n rescue\n # otherwise, just return the string as-is.\n return out\n end\nend", "def remote_command(command)\n return %x(ssh #{self.sar_host} \"#{command}\")\n end", "def ssh( commands=[], extra_ssh_ops={})\n commands = commands.compact.join(' && ') if commands.is_a?(Array)\n cmd_string = \"ssh #{user}@#{host} #{ssh_options(extra_ssh_ops)} \"\n if commands.empty?\n #TODO: replace this with a IO.popen call with read_nonblocking to show progress, and accept input\n Kernel.system(cmd_string)\n else\n system_run(cmd_string+\"'#{commands}'\")\n end\n end", "def execute_ssh_command(command)\n\t\tresult = ''\n\t\tNet::SSH.start(ip_string, settings.ssh[\"user\"]) do |ssh|\n\t\t\tresult = ssh.exec!(\"cmd /c #{command}\")\n\t\tend\n\t\tresult\n\tend", "def ssh_exec!(ssh, command)\n\n stdout_data = \"\"\n stderr_data = \"\"\n exit_code = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.exec(command) do |ch, success|\n unless success\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\"\n end\n channel.on_data do |ch,data|\n stdout_data+=data\n end\n\n channel.on_extended_data do |ch,type,data|\n stderr_data+=data\n end\n\n channel.on_request(\"exit-status\") do |ch,data|\n exit_code = data.read_long\n end\n\n channel.on_request(\"exit-signal\") do |ch, data|\n exit_signal = data.read_long\n end\n end\n end\n ssh.loop\n\n {\n :out => stdout_data,\n :err => stderr_data,\n :exit_code => exit_code,\n :exit_signal => exit_signal\n }\n end", "def simple_ssh_command(host, user, command, timeout = 300)\n over_ssh(host: host, user: user, timeout: timeout) do |server|\n server.cd '/tmp'\n # Need to use sudo\n server.enable_sudo\n # scary...\n server.disable_safe_mode\n\n server.execute command\n end\n end", "def ssh_execute(server, username, password, key, cmd)\n return lambda {\n exit_status = 0\n result = []\n\n params = {}\n params[:password] = password if password\n params[:keys] = [key] if key\n\n begin\n Net::SSH.start(server, username, params) do |ssh|\n puts \"Connecting to #{server}\"\n ch = ssh.open_channel do |channel|\n # now we request a \"pty\" (i.e. interactive) session so we can send data\n # back and forth if needed. it WILL NOT WORK without this, and it has to\n # be done before any call to exec.\n\n channel.request_pty do |ch_pty, success|\n raise \"Could not obtain pty (i.e. an interactive ssh session)\" if !success\n end\n\n channel.exec(cmd) do |ch_exec, success|\n puts \"Executing #{cmd} on #{server}\"\n # 'success' isn't related to bash exit codes or anything, but more\n # about ssh internals (i think... not bash related anyways).\n # not sure why it would fail at such a basic level, but it seems smart\n # to do something about it.\n abort \"could not execute command\" unless success\n\n # on_data is a hook that fires when the loop that this block is fired\n # in (see below) returns data. This is what we've been doing all this\n # for; now we can check to see if it's a password prompt, and\n # interactively return data if so (see request_pty above).\n channel.on_data do |ch_data, data|\n if data =~ /Password:/\n password = get_sudo_pw unless !password.nil? && password != \"\"\n channel.send_data \"#{password}\\n\"\n elsif data =~ /password/i or data =~ /passphrase/i or\n data =~ /pass phrase/i or data =~ /incorrect passphrase/i\n input = get_input_for_pw_prompt(data)\n channel.send_data \"#{input}\\n\"\n else\n result << data unless data.nil? or data.empty?\n end\n end\n\n channel.on_extended_data do |ch_onextdata, type, data|\n print \"SSH command returned on stderr: #{data}\"\n end\n\n channel.on_request \"exit-status\" do |ch_onreq, data|\n exit_status = data.read_long\n end\n end\n end\n ch.wait\n ssh.loop\n end\n if $debug\n puts \"==================================================\\nResult from #{server}:\"\n puts result.join\n puts \"==================================================\"\n end\n rescue Net::SSH::AuthenticationFailed\n exit_status = 1\n puts \"Bad username/password combination\"\n rescue Exception => e\n exit_status = 1\n puts e.inspect\n puts e.backtrace\n puts \"Can't connect to server\"\n end\n\n return exit_status\n }\n end", "def exec(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t @ssh_session.open_channel do |ch|\n\t @@logger.info(\"Executing command '#{command}'\")\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.debug(\"Command sucessfully executed\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n end\n ch.on_close do |ch|\n @close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n @close_handler.call() unless @close_handler.nil?\n end\n\n ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"\")\n exit_status = 127\n end\n end\n\t ch.wait\n\t end\n\t\n\t return exit_status\n\tend", "def command_send(command)\n\t\t# Check target\n\t\traise \"Target machine is not accessible\" if (!@config[\"ssh\"] or !@ip)\n\n\t\t# Prepare command\n\t\tcommand = command.gsub('\"', '\\\\\"')\n\t\tcommand = command.gsub('$', '\\\\$')\n\n\t\t# Execute and return result\n\t\t_ssh = `ssh -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" -t #{@config[\"ssh\"][\"username\"]}@#{@ip} \"#{command}\" 2>/dev/null`\n\t\treturn _ssh.strip\n\tend", "def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend", "def shell_execute(connection, command, **opts)\n opts = {\n sudo: false,\n shell: nil\n }.merge(opts)\n\n sudo = opts[:sudo]\n shell = (opts[:shell] || machine_config_ssh.shell).to_s\n\n @logger.info(\"Execute: #{command} (sudo=#{sudo.inspect})\")\n exit_status = nil\n\n # Open the channel so we can execute or command\n channel = connection.open_channel do |ch|\n marker_found = false\n data_buffer = ''\n stderr_marker_found = false\n stderr_data_buffer = ''\n\n tfile = Tempfile.new('vagrant-ssh')\n remote_ext = shell == \"powershell\" ? \"ps1\" : \"bat\"\n remote_name = \"#{machine_config_ssh.upload_directory}\\\\#{File.basename(tfile.path)}.#{remote_ext}\"\n\n if shell == \"powershell\"\n base_cmd = \"powershell -File #{remote_name}\"\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nRemove-Item #{remote_name}\nWrite-Host #{CMD_GARBAGE_MARKER}\n[Console]::Error.WriteLine(\"#{CMD_GARBAGE_MARKER}\")\n#{command}\nSCRIPT\n else\n base_cmd = remote_name\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nECHO OFF\nECHO #{CMD_GARBAGE_MARKER}\nECHO #{CMD_GARBAGE_MARKER} 1>&2\n#{command}\nSCRIPT\n end\n\n tfile.close\n upload(tfile.path, remote_name)\n tfile.delete\n\n base_cmd = shell_cmd(opts.merge(shell: base_cmd))\n @logger.debug(\"Base SSH exec command: #{base_cmd}\")\n\n ch.exec(base_cmd) do |ch2, _|\n # Setup the channel callbacks so we can get data and exit status\n ch2.on_data do |ch3, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n\n if !marker_found\n data_buffer << data\n marker_index = data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(data_buffer)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stdout, data\n end\n end\n\n ch2.on_extended_data do |ch3, type, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stderr: #{data}\")\n if !stderr_marker_found\n stderr_data_buffer << data\n marker_index = stderr_data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n stderr_data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(stderr_data_buffer.lstrip)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stderr, data\n end\n end\n\n ch2.on_request(\"exit-status\") do |ch3, data|\n exit_status = data.read_long\n @logger.debug(\"Exit status: #{exit_status}\")\n\n # Close the channel, since after the exit status we're\n # probably done. This fixes up issues with hanging.\n ch.close\n end\n\n end\n end\n\n begin\n keep_alive = nil\n\n if @machine.config.ssh.keep_alive\n # Begin sending keep-alive packets while we wait for the script\n # to complete. This avoids connections closing on long-running\n # scripts.\n keep_alive = Thread.new do\n loop do\n sleep 5\n @logger.debug(\"Sending SSH keep-alive...\")\n connection.send_global_request(\"[email protected]\")\n end\n end\n end\n\n # Wait for the channel to complete\n begin\n channel.wait\n rescue Errno::ECONNRESET, IOError\n @logger.info(\n \"SSH connection unexpected closed. Assuming reboot or something.\")\n exit_status = 0\n pty = false\n rescue Net::SSH::ChannelOpenFailed\n raise Vagrant::Errors::SSHChannelOpenFail\n rescue Net::SSH::Disconnect\n raise Vagrant::Errors::SSHDisconnected\n end\n ensure\n # Kill the keep-alive thread\n keep_alive.kill if keep_alive\n end\n\n # Return the final exit status\n return exit_status\n end", "def run(command)\n result = connection.exec!(command)\n puts \"[BEGIN #{@host}: #{command}]\"\n puts \" #{result}\"\n puts \"[END #{@host}: #{command}]\"\n end", "def run(*args)\n case args.size\n when 3\n ssh_host, ssh_user, ssh_command = args \n when 2\n ssh_host, ssh_command = args\n ssh_user = self.user\n when 1\n ssh_host, ssh_user = self.host, self.user\n ssh_command = args.first\n else\n raise ArgumentError\n end\n return ssh_host.map{|host| run(host, ssh_user, ssh_command)} if ssh_host.is_a? Array\n \n key = \"#{ssh_user}@#{ssh_host}\"\n puts \" #{key}$ #{ssh_command}\"\n @ssh_sessions[key] ||= Net::SSH.start(ssh_host, ssh_user)\n output = @ssh_sessions[key].exec!(ssh_command)\n puts output.split(\"\\n\").map{|l| \" #{key}> #{l}\"}.join(\"\\n\") if output\n output\n end", "def dispatch(command, return_output = false)\n Vanagon::Utilities.remote_ssh_command(\"#{@target_user}@#{@target}\", command, @target_port, return_command_output: return_output)\n end", "def run_command(cmd, *options, **shellout_options)\n so = Mixlib::ShellOut.new(create_command(cmd, *options), shellout_options)\n so.run_command\n so.error!\n so\n rescue Mixlib::ShellOut::ShellCommandFailed => e\n # Knife commands can include the password, so show a redacted version\n # of the command line along with the exit code, instead of the mixlib output\n pwd_index = options.index(\"--ssh-password\")\n options[pwd_index+1] = \"(hidden)\" if pwd_index && options.length > pwd_index+1\n redacted_cmd = create_command(cmd, options)\n message = \"#{redacted_cmd} returned #{so.exitstatus}\"\n if so.stderr\n message += \"\\n***********\\n\"\n message += so.stderr\n message += \"***********\\n\"\n end\n raise Runner::Exceptions::KnifeCommandFailed.new(message)\n end", "def echo(s)\n\n instructions = 'echo ' + s\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n @results[:echo] = r.chomp\n\n end", "def execute(command, live_stream = false)\n machine = @chef_provisioning.connect_to_machine(name, @current_chef_server)\n machine.execute_always(command, stream: live_stream)\n end", "def run(command)\n retried = false\n\n begin\n result = ssh_exec(command)\n Rosh::Shell::CommandResult.new(nil, result.exit_status, result.stdout, result.stderr)\n rescue StandardError => ex\n log \"Error: #{ex.class}\"\n log \"Error: #{ex.message}\"\n log \"Error: #{ex.backtrace.join(\"\\n\")}\"\n\n if ex.class == Net::SSH::AuthenticationFailed\n if retried\n bad_info 'Authentication failed.'\n else\n retried = true\n password = prompt(\"\\n<ROSH> Enter your password: \", false)\n ssh_options.merge! password: password\n log \"Password added. options: #{ssh_options}\"\n @ssh = new_ssh\n retry\n end\n end\n\n if ex.class == Net::SSH::Disconnect\n if retried\n bad_info 'Tried to reconnect to the remote host, but failed.'\n else\n log 'Host disconnected us; retrying to connect...'\n retried = true\n @ssh = new_ssh\n run(command)\n retry\n end\n end\n\n Rosh::Shell::CommandResult.new(ex, 1)\n end\n end", "def provision_execute(s, commands)\n errors = []\n return errors if (commands.nil? or commands.empty?)\n \n if (!get_field(\"cloud_ips\").nil? and !get_field(\"cloud_ips\").empty?)\n host = get_field(\"cloud_ips\")[0]\n elsif (!get_field(\"cloud_private_ips\").nil? and !get_field(\"cloud_private_ips\").empty?)\n host = get_field(\"cloud_private_ips\")[0]\n else\n msg = \"No IP address associated to the machine #{host} - cannot run SSH command\"\n errors << msg\n log_output(msg, :info)\n return errors\n end\n \n ssh_password = get_field('ssh_password')\n ssh_options = {}\n msg = \"Running SSH Commands On New Machine #{s.username}@#{host}\"\n msg_options = {}\n if (ssh_password and !ssh_password.empty?)\n ssh_options[:password] = ssh_password\n msg_options[:password] = \"*\" * ssh_password.size\n end\n msg_options[:private_key_path] = s.private_key_path if s.private_key_path\n msg_options[:private_key] = mask_private_key(s.private_key.strip) if s.private_key # show only last 5 chars\n log_output(\"#{msg} using #{msg_options}: #{commands.join(\", \")}\", :info)\n\n for i in 1..10\n begin\n log_output(\"[#{host}] Running Commands:\\n #{commands.join(\"\\n \")}\\n\")\n responses = s.ssh(commands, ssh_options) do |data, extended_data|\n write_output(data, :buffer => true) unless data.empty? #stdout\n write_output(extended_data, :buffer => true) unless extended_data.empty? #stderr\n end\n\n responses.each do |result|\n if result.status != 0\n msg = \"[#{host}] Command '#{result.command}' failed with status #{result.status}\"\n errors << msg\n log_output(msg, :info)\n end\n end unless responses.nil?\n break\n rescue Errno::EHOSTUNREACH, Timeout::Error, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Net::SSH::Disconnect => e\n log_output(\"[#{host}] Try #{i} - failed to connect: #{e}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"[#{host}] Try #{i} - failed to connect: authentication failed for user #{e.message}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts, authentication failed for user #{e.message}\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n end\n end\n return errors\n end", "def exec(cmd, done_string = nil, stdin = nil)\n error_buffer = \"\"\n output_buffer = \"\"\n status = 0\n signal = nil\n header = \"#{self.class}##{__method__}\"\n\n # If passwordless sudo is true then prepend every command with 'sudo'.\n cmd = 'sudo ' + cmd if @passwordless_sudo\n\n run_session do |ssh|\n ssh.open_channel do |channel|\n channel.exec(cmd) do |chan, success|\n raise \"#{header} - Could not execute command #{cmd}\" unless success\n\n $log&.debug(\"#{header} - Command: #{cmd} started.\")\n\n if stdin.present?\n chan.send_data(stdin)\n chan.eof!\n end\n\n channel.on_data do |_channel, data|\n $log&.debug(\"#{header} - STDOUT: #{data}\")\n output_buffer << data\n data.each_line { |l| return output_buffer if done_string == l.chomp } unless done_string.nil?\n end\n\n channel.on_extended_data do |_channel, _type, data|\n $log&.debug(\"#{header} - STDERR: #{data}\")\n error_buffer << data\n end\n\n channel.on_request('exit-status') do |_channel, data|\n status = data.read_long || 0\n $log&.debug(\"#{header} - STATUS: #{status}\")\n end\n\n channel.on_request('exit-signal') do |_channel, data|\n signal = data.read_string\n $log&.debug(\"#{header} - SIGNAL: #{signal}\")\n end\n\n channel.on_eof do |_channel|\n $log&.debug(\"#{header} - EOF RECEIVED\")\n end\n\n channel.on_close do |_channel|\n $log&.debug(\"#{header} - Command: #{cmd}, exit status: #{status}\")\n if signal.present? || status.nonzero? || error_buffer.present?\n raise \"#{header} - Command '#{cmd}' exited with signal #{signal}\" if signal.present?\n raise \"#{header} - Command '#{cmd}' exited with status #{status}\" if status.nonzero?\n raise \"#{header} - Command '#{cmd}' failed: #{error_buffer}\"\n end\n return output_buffer\n end\n end # exec\n end # open_channel\n ssh.loop\n end # run_session\n end", "def run_command(user, host, cmd)\n ping(user, host) do\n my_text = IO.popen(\"ssh #{user}@#{host} 'bash'\", \"w+\")\n my_text.write(cmd)\n my_text.close_write\n my_rtn = my_text.readlines.join('\\n')\n Process.wait(my_text.pid)\n my_text.close\n return my_rtn\n end\n end", "def run( command, expected_exitcode = 0, sudo = self.uses_sudo? )\n\n cmd = {\n :command => command,\n :sudo => sudo,\n :stdout => String.new,\n :stderr => String.new,\n :expected_exitcode => Array( expected_exitcode ),\n :exitcode => nil,\n :final_command => sudo ? sprintf( 'sudo bash -c \"%s\"', command ) : command,\n }\n\n if @ssh.nil?\n self.connect_ssh_tunnel\n end\n\n @logger.info( sprintf( 'vm running: [%s]', cmd[:final_command] ) ) # TODO decide whether this should be changed in light of passthroughs.. 'remotely'?\n\n 0.upto(@retries) do |try|\n begin\n if self.is_passthrough? and self.passthrough[:type].eql?(:local)\n cmd[:stdout] = `#{cmd[:final_command]}`\n cmd[:exitcode] = $?\n else\n cmd = remote_exec( cmd )\n end\n break\n rescue => e\n @logger.error(sprintf('failed to run [%s] with [%s], attempt[%s/%s]', cmd[:final_command], e, try, retries)) if self.retries > 0\n sleep 10 # TODO need to expose this as a variable\n end\n end\n\n if cmd[:stdout].nil?\n cmd[:stdout] = \"error gathering output, last logged output:\\nSTDOUT: [#{self.get_ssh_stdout}]\\nSTDERR: [#{self.get_ssh_stderr}]\"\n cmd[:exitcode] = 256\n elsif cmd[:exitcode].nil?\n cmd[:exitcode] = 255\n end\n\n self.ssh_stdout.push( cmd[:stdout] )\n self.ssh_stderr.push( cmd[:stderr] )\n self.ssh_exitcode.push( cmd[:exitcode] )\n @logger.debug( sprintf( 'ssh_stdout: [%s]', cmd[:stdout] ) )\n @logger.debug( sprintf( 'ssh_stderr: [%s]', cmd[:stderr] ) )\n\n unless cmd[:expected_exitcode].member?( cmd[:exitcode] )\n # TODO technically this could be a 'LocalPassthroughExecutionError' now too if local passthrough.. should we update?\n raise RemoteExecutionError.new(\"stdout[#{cmd[:stdout]}], stderr[#{cmd[:stderr]}], exitcode[#{cmd[:exitcode]}], expected[#{cmd[:expected_exitcode]}]\")\n end\n\n cmd[:stdout]\n end", "def run_ssh(host, shell_command, ssh_timeout = 60)\n begin\n # define basic query\n ssh_query = {\n :ssh_host => host,\n :ssh_auth_type => :password, # password is set on ssh method (default per os during provisioning)\n :ssh_timeout => ssh_timeout,\n :ssh_debug => @debug,\n :ssh_command => shell_command\n }\n\n # instantiate the ssh method and pull the command status\n $evm.instantiate(SSH_INSTANCE_PATH + '?' + ssh_query.to_query)\n status = $evm.root['ssh_command_status']\n\n # pull and inspect our results if we succeeded\n if status\n results = $evm.root['ssh_results']\n return results\n else\n log(:error, \"run_ssh: Command #{shell_command} failed. Returning nil.\")\n return nil\n end\n rescue => err\n log(:error, \"run_ssh: Unable to run command: #{shell_command}. Returning nil.\")\n return nil\n end\nend", "def sh(command,options={},&block)\n sh_logger.debug(\"Executing '#{command}'\")\n\n stdout,stderr,status = execution_strategy.run_command(command)\n process_status = OptparsePlus::ProcessStatus.new(status,options[:expected])\n\n sh_logger.warn(\"stderr output of '#{command}': #{stderr}\") unless stderr.strip.length == 0\n\n if process_status.success?\n sh_logger.debug(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n call_block(block,stdout,stderr,process_status.exitstatus) unless block.nil?\n else\n sh_logger.info(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n sh_logger.warn(\"Error running '#{command}'\")\n end\n\n process_status.exitstatus\n rescue *exception_meaning_command_not_found => ex\n sh_logger.error(\"Error running '#{command}': #{ex.message}\")\n 127\n end", "def execute(command, params={})\n unless params[:dry_run]\n if params[:return]\n System.execute(command, :return => true)\n else\n $stdout.puts\n System.execute(command)\n end\n end\n end", "def executeCommand(command, dryRun)\n #N Without this, the command won't be echoed to the user\n puts \"EXECUTE: #{command}\"\n #N Without this check, the command will be executed, even though it is intended to be a dry run\n if not dryRun\n #N Without this, the command won't be executed (when it's not a dry run)\n system(command)\n #N Without this, a command that fails with error will be assumed to have completed successfully (which will result in incorrect assumptions in some cases about what has changed as a result of the command, e.g. apparently successful execution of sync commands would result in the assumption that the remote directory now matches the local directory)\n checkProcessStatus(command)\n end\n end", "def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end", "def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end", "def execute!(command=nil)\n @command = command if command\n @result = \"\"\n if @ruby_impl\n # pure ruby implementation call\n rsh_ruby do |line|\n yield(line) if block_given?\n @result << line\n end\n else\n # OS'es rsh(1) call\n open \"|#{@executable} #{\"-n\" if @nullr} -l#{@ruser} -t#{@to} #{@host} #{@command}\" do |io|\n io.each do |line|\n yield(line) if block_given?\n @result << line\n end\n end\n end\n @result\n end", "def execute(command, options = { })\n defaults = { :out_console => true }\n options = defaults.merge(options)\n # open a new channel and configure a minimal set of callbacks, then run\n # the event loop until the channel finishes (closes)\n last_exit = -1\n channel = session.open_channel do |ch|\n\n #request pty for sudo stuff and so\n ch.request_pty do |ch, success|\n raise \"Error requesting pty\" unless success\n end\n \n ch.exec \"#{command}\" do |ch, success|\n raise \"could not execute command\" unless success\n\n\n # \"on_data\" is called when the process writes something to stdout\n ch.on_data do |c, data|\n STDOUT.print data if options[:out_console]\n\n end\n\n # \"on_extended_data\" is called when the process writes something to stderr\n ch.on_extended_data do |c, type, data|\n STDOUT.print data if options[:out_console]\n end\n\n channel.on_request(\"exit-signal\") do |ch, data|\n last_exit = data.read_long\n end\n\n channel.on_request(\"exit-status\") do |ch,data|\n last_exit = data.read_long\n end\n\n end\n end\n channel.wait\n last_exit\n end", "def ssh_command\n args = domain!\n args = \"#{user}@#{args}\" if user?\n args << \" -i #{identity_file}\" if identity_file?\n args << \" -p #{ssh_port}\" if ssh_port?\n args << \" -t\"\n \"ssh #{args}\"\n end", "def !(*commands)\n options = commands.last.is_a?(Hash) ? commands.pop : {}\n\n commands.unshift(\"cd #{options[:base_path]}\") if options[:base_path]\n\n ssh_command = ssh_command(commands, config)\n\n log(:info, ssh_command)\n\n clear_inject\n response = nil\n\n if options.fetch(:interactive, false)\n response = system(ssh_command)\n else\n response = `#{ssh_command}`\n end\n log(:debug, \"SSH Response: #{response.to_s}\")\n\n response\n end", "def send_command(command)\n begin\n @ssh_connect.exec!(command)\n rescue Exception => error\n @log.error(\"#{error}\")\n end\n end", "def exec!(command, timeout=nil)\n logger.info(\"Executing: #{command}\")\n stderr,stdout = '', ''\n stdout, stderr = timeout_execution(timeout, \"exec!(#{command})\") do\n @connection_pool.exec(command)\n end\n logger.info(\"STDERR: #{stderr}\") unless stderr.empty?\n logger.info(\"STDOUT: #{stdout}\") unless stdout.empty?\n logger.info(\"Executing done\")\n stdout\n end", "def execute(*command, &block)\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info('Exit code != 0, but interrupted. Ignoring.')\n else\n # If there was an error running command, show the error and the\n # output.\n raise VagrantPlugins::Parallels::Errors::ExecutionError,\n command: command.inspect,\n stderr: r.stderr\n end\n end\n r.stdout\n end", "def execute_remote_command(server, cmd)\n ssh(server, cmd).status == 0\n end", "def exec!(command, opts = {}, &block)\n # Options\n stdout = ''\n stderr = ''\n defaults = {\n :check_exit_status => true\n }\n \n opts = defaults.merge opts\n\n # First, set up the environment...\n if @env.size > 0\n command = (\n @env.map { |k,v| k.to_s.upcase + '=' + v } << command\n ).join(' ')\n end\n\n # Before execution, cd to cwd\n command = \"cd #{escape(@cwd)}; \" + command\n\n # Input redirection\n if opts[:from]\n command += \" <#{escape(opts[:from])}\"\n end\n\n # Output redirection\n if opts[:to]\n command += \" >#{escape(opts[:to])}\"\n end\n\n # After command, add a semicolon...\n unless command =~ /;\\s*\\z/\n command += ';'\n end\n\n # Then echo the exit status.\n command += ' echo $?; '\n\n\n # If applicable, wrap the command in a sudo subshell...\n if @sudo\n command = \"sudo -S -u #{@sudo} bash -c #{escape(command)}\"\n if @password\n opts[:stdin] = @password + \"\\n\" + opts[:stdin].to_s\n end\n end\n\n buffer = ''\n echoed = 0\n stderr_echoed = 0\n status = nil\n written = false\n\n # Run ze command with callbacks.\n # Return status.\n channel = ssh.open_channel do |ch|\n ch.exec command do |ch, success|\n raise \"could not execute command\" unless success\n\n # Handle STDOUT\n ch.on_data do |c, data|\n # Could this data be the status code?\n if pos = (data =~ /(\\d{1,3})\\n\\z/)\n # Set status\n status = $1\n\n # Flush old buffer\n opts[:stdout].call(buffer) if opts[:stdout]\n stdout << buffer\n\n # Save candidate status code\n buffer = data[pos .. -1]\n\n # Write the other part of the string to the callback\n opts[:stdout].call(data[0...pos]) if opts[:stdout]\n stdout << data[0...pos]\n else\n # Write buffer + data to callback\n opts[:stdout].call(buffer + data) if opts[:stdout]\n stdout << buffer + data\n buffer = ''\n end\n \n if opts[:echo] and echoed < stdout.length\n stdout[echoed..-1].split(\"\\n\")[0..-2].each do |fragment|\n echoed += fragment.length + 1\n log fragment\n end\n end\n end\n\n # Handle STDERR\n ch.on_extended_data do |c, type, data|\n # STDERR\n if type == 1\n # Callback\n opts[:stderr].call(data) if opts[:stderr]\n\n # Accrue in stderr string\n stderr << data\n\n # Play forward any unwritten lines\n if opts[:echo] and stderr_echoed < stderr.length\n stderr[stderr_echoed..-1].split(\"\\n\")[0..-2].each do |fragment|\n stderr_echoed += fragment.length + 1\n log :stderr, fragment\n end\n end\n end\n end\n \n # Write stdin\n if opts[:stdin]\n ch.on_process do\n unless written\n ch.send_data opts[:stdin]\n written = true\n else\n # Okay, we wrote stdin\n unless block or ch.eof?\n ch.eof!\n end\n end\n end\n end\n\n # Handle close\n ch.on_close do\n if opts[:echo]\n # Echo last of input data\n stdout[echoed..-1].split(\"\\n\").each do |fragment|\n echoed += fragment.length + 1\n log fragment\n end\n\n # Last of stderr\n stderr[stderr_echoed..-1].split(\"\\n\").each do |fragment|\n echoed += fragment.length + 1\n log :stderr, fragment\n end\n end\n end\n end\n end\n \n if block\n # Run the callback\n callback_thread = Thread.new do\n if opts[:stdin]\n # Wait for stdin to be written before calling...\n until written\n sleep 0.1\n end\n end\n\n block.call(channel)\n end\n end\n\n # Wait for the command to complete.\n channel.wait\n\n # Let the callback thread finish as well\n callback_thread.join if callback_thread\n\n if opts[:check_exit_status]\n # Make sure we have our status.\n if status.nil? or status.empty?\n raise \"empty status in host#exec() for #{command}, hmmm\"\n end\n\n # Check status.\n status = status.to_i\n if status != 0\n raise \"#{command} exited with non-zero status #{status}!\\nSTDERR:\\n#{stderr}\\nSTDOUT:\\n#{stdout}\"\n end\n end\n\n stdout.chomp\n end", "def run_command(machine, command, logger = @log)\n logger.info(\"Running command '#{command}' on the '#{machine['network']}' machine\")\n within_ssh_session(machine) do |connection|\n ssh_exec(connection, command, logger)\n end\n end", "def shell_execute(connection, command, sudo=false)\n @logger.info(\"Execute: #{command} (sudo=#{sudo.inspect})\")\n exit_status = nil\n\n # Determine the shell to execute. If we are using `sudo` then we\n # need to wrap the shell in a `sudo` call.\n shell = @machine.config.ssh.shell\n shell = \"sudo -H #{shell}\" if sudo\n\n # Open the channel so we can execute or command\n channel = connection.open_channel do |ch|\n ch.exec(shell) do |ch2, _|\n # Setup the channel callbacks so we can get data and exit status\n ch2.on_data do |ch3, data|\n if block_given?\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stdout: #{data}\")\n yield :stdout, data\n end\n end\n\n ch2.on_extended_data do |ch3, type, data|\n if block_given?\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stderr: #{data}\")\n yield :stderr, data\n end\n end\n\n ch2.on_request(\"exit-status\") do |ch3, data|\n exit_status = data.read_long\n @logger.debug(\"Exit status: #{exit_status}\")\n end\n\n # Set the terminal\n ch2.send_data \"export TERM=vt100\\n\"\n\n # Output the command\n ch2.send_data \"#{command}\\n\"\n\n # Remember to exit or this channel will hang open\n ch2.send_data \"exit\\n\"\n\n # Send eof to let server know we're done\n ch2.eof!\n end\n end\n\n # Wait for the channel to complete\n channel.wait\n\n # Return the final exit status\n return exit_status\n end", "def exec(opts={})\n # Get the SSH information and cache it here\n ssh_info = info\n\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],\n :port => ssh_info[:port],\n :username => ssh_info[:username],\n :key_path => ssh_info[:private_key_path]\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n # If plain mode is enabled then we don't do any authentication (we don't\n # set a user or an identity file)\n plain_mode = opts[:plain_mode]\n\n options = {}\n options[:host] = ssh_info[:host]\n options[:port] = ssh_info[:port]\n options[:username] = ssh_info[:username]\n options[:private_key_path] = ssh_info[:private_key_path]\n\n # Command line options\n command_options = [\"-p\", options[:port].to_s, \"-o\", \"UserKnownHostsFile=/dev/null\",\n \"-o\", \"StrictHostKeyChecking=no\", \"-o\", \"LogLevel=FATAL\", \"-p\", options[:password].to_s]\n\n # Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option\n # (Also don't use it in plain mode, it'll skip user agents.)\n command_options += [\"-o\", \"IdentitiesOnly=yes\"] if !(Util::Platform.solaris? || plain_mode)\n\n command_options += [\"-i\", options[:private_key_path]] if !plain_mode\n command_options += [\"-o\", \"ForwardAgent=yes\"] if ssh_info[:forward_agent]\n\n # If there are extra options, then we append those\n command_options.concat(opts[:extra_args]) if opts[:extra_args]\n\n if ssh_info[:forward_x11]\n # Both are required so that no warnings are shown regarding X11\n command_options += [\"-o\", \"ForwardX11=yes\"]\n command_options += [\"-o\", \"ForwardX11Trusted=yes\"]\n end\n\n host_string = options[:host]\n host_string = \"#{options[:username]}@#{host_string}\" if !plain_mode\n command_options << host_string\n @logger.info(\"Invoking SSH: #{command_options.inspect}\")\n safe_exec(\"ssh\", *command_options)\n end", "def execute!\n if Mcir::Core.instance.dryrun?\n Mcir::Core.instance.debug(\"CMD: \".purple << \"#{self.to_s.gsub(\"\\r\", \"\")}\")\n \"skipped execution due to dryrun\"\n else\n case @mode\n when :exec then exec(self.to_s)\n when :open then IO.new(self).open3\n when :capture then IO.new(self).capture3\n when :backticks then IO.new(self).backtick\n end\n end\n end", "def do_ssh_cmd(cmd='uname -a')\n stdout_data = \"\"\n stderr_data = \"\"\n exit_code = nil\n \n begin\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch, success|\n unless success\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\"\n end\n channel.on_data do |ch,data|\n stdout_data += data\n end\n \n channel.on_extended_data do |ch,type,data|\n stderr_data+=data\n end\n \n channel.on_request(\"exit-status\") do |ch,data|\n exit_code = data.read_long\n end\n end\n end\n @ssh.loop\n rescue Net::SSH::Exception => e\n abort \"Net:SSH Exception : #{e.message}\"\n rescue Exception => e\n abort \"Unknown Exception : #{e.message}\"\n end\n {:stdout => stdout_data, :stderr => stderr_data, :exit_code => exit_code}\n end", "def exec_new(command, stdin = nil)\n\t exit_status = 0 # define variable so that it will be available in the block at method scope\n\t channel = @ssh_session.open_channel do |ch|\n\t ch.exec(command) do|ch, success|\n\n if success then\n\t @@logger.info(\"SshConnection: starts executing '#{command}'\")\n ch.on_data() do|ch, data|\n #process_stdout(data) unless data\n @stdout_handler.call(data) unless @stdout_handler.nil? or data.nil?\n end\n ch.on_extended_data() do|ch, type, data|\n @stderr_handler.call(data) unless @stderr_handler.nil? or data.nil?\n end\n ch.on_request \"exit-status\" do|ch, data|\n exit_status = data.read_long unless data.nil?\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-status: #{exit_status}\")\n\t if exit_status != 0\n\t @@logger.error(\"SshConnection.on_request: Remote command execution failed with code: #{exit_status}\")\n\t end\n end\n\t ch.on_request \"exit-signal\" do |ch, data|\n\t @@logger.info(\"SshConnection.on_request: process terminated with exit-signal: #{data.read_string}\")\n\t end\n ch.on_close do |ch|\n\t @@logger.info(\"SshConnection.on_close: remote end is closing!\")\n #@close_handler.call() unless @close_handler.nil?\n end\n ch.on_eof do |ch|\n\t @@logger.info(\"SshConnection.on_eof: remote end is done sending data\")\n #@close_handler.call() unless @close_handler.nil?\n end\n\t ch.on_open_failed do |ch, code, desc|\n\t @@logger.info(\"SshConnection.on_open_failed: code=#{code} desc=#{desc}\")\n\t end\n\t ch.on_process do |ch|\n\t #@@logger.debug(\"SshConnection.on_process; send line-feed/sleep\")\n\t ch.send_data(\"\\n\")\n\t end\n\n #ch.send_data stdin if stdin\n else\n\t @@logger.debug(\"SshConnection: the remote command could not be invoked!\")\n exit_status = 127\n end\n end\n\t #ch.wait\n\t end\n\t channel.wait\n\t return exit_status\n\tend", "def ssh(host, user_name, *commands)\n global_cmd = \"ssh #{SSH_OPTIONS} #{user_name}@#{host} \\\"#{commands.join(';echo -;')}\\\"\"\n @logger.info(\"[SystemGateway][ssh] Executing #{global_cmd}...\")\n out = `#{global_cmd}`\n\n # SSH command failures (host unreachable, authentication errors)\n if $?.to_i != 0\n @logger.error(\"[SystemGateway][ssh] Command terminated abnormally: #{$?}\")\n raise(SSHError)\n end\n\n @logger.info(\"[SystemGateway][ssh] Command ended. Output: #{out}\")\n out\n end", "def remote_command(command)\n socket = TCPSocket.new(@host, @port)\n socket.puts command\n\n data = \"\"\n until (line = socket.readline) =~ /END/\n data << line\n end\n\n socket.close\n data\n end", "def ssh_cmd(destination_host, cmd)\n\n if strict_host_checking\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n else\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n '-o', 'UserKnownHostsFile=/dev/null',\n '-o', 'StrictHostKeyChecking=no',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n end\n end", "def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n sleep = opts.fetch(:sleep, 1)\n\n # Variable to store our execution result\n r = nil\n\n retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n raise LXC::Errors::ExecuteError, :command => command.inspect\n end\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n r.stdout.gsub(\"\\r\\n\", \"\\n\")\n end", "def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend", "def execute(connection, command)\n stdout = \"\"\n stderr = \"\"\n connection.exec!(command) do |ch, stream, data|\n stderr << data if stream == :stderr\n stdout << data if stream == :stdout\n end\n [stdout, stderr]\n rescue Net::SSH::Exception => ex\n logger.error \"There was an exception in method execute for SSHConnection. Details #{ex}:\\n#{ex.backtrace}\"\n kill_connection(connection)\n raise NoFreeConnectionError\n rescue SystemCallError => ex\n logger.error \"There was an system error in method get_new for SSConnection. Details #{ex}:\\n#{ex.backtrace}\"\n kill_connection(connection)\n raise NoFreeConnectionError\n end", "def remote_exec(cmd)\n req = JsonRequest.new(\"remote_exec:exec\", [@agent_id, cmd])\n res = Bixby.client.exec_api(req)\n assert res\n assert_kind_of JsonResponse, res\n assert res.success?\n\n cr = CommandResponse.from_json_response(res)\n assert cr\n assert cr.success?, \"remote exec should succeed\"\n cr\n end", "def runner_execute!(host, commands, options = {})\n result = host.execute commands, options\n if result && result[1] == :stdout\n Trooper.logger.info \"#{result[2]}\\n\"\n true\n else \n false\n end\n end", "def exec(cmd)\n\t\tbegin\n\t\t\tout = cmd_exec(cmd).chomp\n\t\trescue ::Timeout::Error => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\trescue EOFError => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\tend\n\tend", "def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n sleep = opts.fetch(:sleep, 1)\n\n # Variable to store our execution result\n r = nil\n\n retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n raise LXC::Errors::SubprocessInterruptError, command.inspect\n else\n raise LXC::Errors::ExecuteError,\n command: command.inspect, stderr: r.stderr, stdout: r.stdout, exitcode: r.exit_code\n end\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n stdout = r.stdout.gsub(\"\\r\\n\", \"\\n\")\n if opts[:show_stderr]\n { :stdout => stdout, :stderr => r.stderr.gsub(\"\\r\\n\", \"\\n\") }\n else\n stdout\n end\n end", "def chef_exec(cmd)\n @ssh.exec! \"#{CHEF_RUBY_INSTANCE_BASE}/bin/#{cmd}\", sudo: true\n end", "def remote\n log_and_exit read_template('help') if options.empty?\n \n # Attempts to run the specified command\n run_remote_command(options[0])\n end", "def ssh_exec(executable, dir = Rails.application.config.vm_benchmark_dir, log = Rails.application.config.vm_error_log_file)\n shell_cmd = ssh_shell_cmd(executable, dir, log)\n shell(shell_cmd, dir: @vagrant_dir)\n end", "def execute(task_family, ip, command)\n cmd = \"docker exec -i -t `#{docker_ps_task(task_family)}` #{command}\"\n Open3.popen2e(ssh_cmd(ip) + \" '#{cmd}' \") do |stdin, stdout, stderr, status_thread|\n stdout.each_line do |line|\n puts line\n end\n end\n end", "def run_remote_command(command)\n # Finds the remote ip and stores it in \"remote_ip\"\n parse_remote_ip\n \n # Finds the remote ip and stores it in \"remote_app_name\"\n parse_remote_app_name\n \n begin\n remote_command(command)\n rescue Net::SSH::AuthenticationFailed\n HighLine.track_eof = false\n password = ask(\"Enter your password: \") { |q| q.echo = '' }\n remote_command(command, password)\n end\n end", "def exec!(cmd, options={})\n exit_status, stdout, stderr, cmd = exec(cmd, options)\n error_msg = options[:error_msg] || \"The following command exited with an error\"\n raise Appd::RemoteError.new(stdout, stderr, exit_status, cmd), error_msg if exit_status != 0\n return stdout\n end", "def expect_ssh(host, user, password, commands, verbose=false, opts={})\n @verbose = verbose\n\n def log(message)\n STDERR.puts message if @verbose\n end\n\n output = \"\"\n opts[:password] = password if opts[:password].nil?\n Net::SSH.start(host, user, opts) do |ssh|\n log \"started session\"\n channel = ssh.open_channel do |channel, success|\n log \"opened channel\"\n channel.send_channel_request \"shell\" do |ch, success|\n raise \"couldn't start shell\" unless success\n ch.on_data do |ch, data|\n log \"received data: #{data}\"\n output << data\n end\n commands.each do |command|\n log \"sending command: #{command}\"\n ch.send_data \"#{command}\\n\"\n end\n yield channel if block_given?\n end\n end\n ssh.loop\n end\n return output\nend", "def call command_str, options={}, &block\n Sunshine.logger.info @host, \"Running: #{command_str}\" do\n execute build_remote_cmd(command_str, options), &block\n end\n end", "def execute_command(command)\n @stdin.puts command\n end", "def exec(command)\n #logger.debug { \"Github: Executing command: '#{command}'\" }\n #p \"Github: Executing command: '#{command}'\"\n \n # Get a path to a temp file\n #logfile = Tempfile.new('github__exec')\n #logfile.close\n \n #success = system(\"#{command} > #{logfile.path} 2>&1\")\n #output_from_command = File.readlines(logfile.path)\n #output_from_command = %x[command]\n shell = Shell.new(command)\n shell.run\n success = (shell.exitstatus == 0)\n output_from_command = shell.output\n if success\n #logger.debug { \"Github: Command output: #{output_from_command.inspect}\"}\n #p \"Github: Command output: #{output_from_command.inspect}\"\n return output_from_command\n else\n #logger.error { \"Github: Command '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"}\n p \"Github: Command failed '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"\n end\n \n #ensure\n #logfile.unlink\n end", "def run_command(*args, &blk)\n debug \"run_command\"\n \n cmd, args = prep_args(*args)\n \n #p [:run_command, cmd, blk.nil?]\n \n connect if !@rye_ssh || @rye_ssh.closed?\n raise Rye::NotConnected, @rye_host unless @rye_ssh && !@rye_ssh.closed?\n \n cmd_clean = Rye.escape(@rye_safe, cmd, args)\n \n # This following is the command we'll actually execute. cmd_clean\n # can be used for logging, otherwise the output is confusing.\n cmd_internal = prepend_env(cmd_clean)\n \n # Add the current working directory before the command if supplied. \n # The command will otherwise run in the user's home directory.\n if @rye_current_working_directory\n cwd = Rye.escape(@rye_safe, 'cd', @rye_current_working_directory)\n cmd_internal = '(%s; %s)' % [cwd, cmd_internal]\n end\n \n # ditto (same explanation as cwd)\n if @rye_current_umask\n cwd = Rye.escape(@rye_safe, 'umask', @rye_current_umask)\n cmd_internal = [cwd, cmd_internal].join(' && ')\n end\n \n ## NOTE: Do not raise a CommandNotFound exception in this method.\n # We want it to be possible to define methods to a single instance\n # of Rye::Box. i.e. def rbox.rm()...\n # can? returns the methods in Rye::Cmd so it would incorrectly\n # return false. We could use self.respond_to? but it's possible\n # to get a name collision. I could write a work around but I think\n # this is good enough for now. \n ## raise Rye::CommandNotFound unless self.can?(cmd)\n \n begin\n debug \"COMMAND: #{cmd_internal}\"\n\n if !@rye_quiet && @rye_pre_command_hook.is_a?(Proc)\n @rye_pre_command_hook.call(cmd_clean, user, host, nickname) \n end\n \n rap = Rye::Rap.new(self)\n rap.cmd = cmd_clean\n \n channel = net_ssh_exec!(cmd_internal, &blk)\n \n if channel[:exception]\n rap = channel[:exception].rap\n else\n rap.add_stdout(channel[:stdout].read || '')\n rap.add_stderr(channel[:stderr].read || '')\n rap.add_exit_status(channel[:exit_status])\n rap.exit_signal = channel[:exit_signal]\n end\n \n debug \"RESULT: %s \" % [rap.inspect]\n \n # It seems a convention for various commands to return -1\n # when something only mildly concerning happens. (ls even \n # returns -1 for apparently no reason sometimes). Anyway,\n # the real errors are the ones that are greater than zero.\n raise Rye::Err.new(rap) if rap.exit_status != 0\n \n rescue Exception => ex\n return rap if @rye_quiet\n choice = nil\n @rye_exception_hook.each_pair do |klass,act|\n next unless ex.kind_of? klass\n choice = act.call(ex, cmd_clean, user, host, nickname)\n break\n end\n if choice == :retry\n retry\n elsif choice == :skip\n # do nothing\n elsif choice == :interactive && !@rye_shell\n @rye_shell = true\n previous_state = @rye_sudo\n disable_sudo\n bash\n @rye_sudo = previous_state\n @rye_shell = false\n elsif !ex.is_a?(Interrupt)\n raise ex, ex.message\n end\n end\n \n if !@rye_quiet && @rye_post_command_hook.is_a?(Proc)\n @rye_post_command_hook.call(rap)\n end\n \n rap\n end", "def run\n begin\n IO.popen(@cmd_line).read\n rescue\n @logger.error(\"Failed to execute command on #{@host}\")\n \"\"\n end\n end", "def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n Chef::Log.debug(\"RVM::Shell::ChefWrapper executing: \" +\n \"[#{wrapped_command(command)}]\")\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end", "def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n Chef::Log.debug(\"RVM::Shell::ChefWrapper executing: \" +\n \"[#{wrapped_command(command)}]\")\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end", "def execute(*command, &block)\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n raise Errors::VBoxManageError, :command => command.inspect\n end\n end\n\n # Return the output\n r.stdout\n end", "def cmd_execute(*args)\n\t\tif (args.length == 0)\n\t\t\targs.unshift(\"-h\")\n\t\tend\n channel = nil\n\t\tsession = nil\n\t\tinteract = false\n\t\tchannelized = nil\n\t\tcmd_args = nil\n\t\tcmd_exec = nil\n\t\tuse_thread_token = false\n\n\t\t@@execute_opts.parse(args) { |opt, idx, val|\n\t\t\tcase opt\n\t\t\t\twhen \"-a\"\n\t\t\t\t\tcmd_args = val\n\t\t\t\twhen \"-c\"\n\t\t\t\t\tchannelized = true\n\t\t\t\twhen \"-f\"\n\t\t\t\t\tcmd_exec = val\n\t\t\t\twhen \"-H\"\n\t\t\t\t\thidden = true\n\t\t\t\twhen \"-m\"\n\t\t\t\t\tfrom_mem = true\n\t\t\t\twhen \"-d\"\n\t\t\t\t\tdummy_exec = val\n\t\t\t\twhen \"-k\"\n\t\t\t\t\tdesktop = true\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint(\n\t\t\t\t\t\t\"Usage: execute -f file [options]\\n\\n\" +\n\t\t\t\t\t\t\"Executes a command on the remote machine.\\n\" +\n\t\t\t\t\t\t@@execute_opts.usage)\n\t\t\t\t\treturn true\n\t\t\t\twhen \"-i\"\n\t\t\t\t\tchannelized = true\n\t\t\t\t\tinteract = true\n\t\t\t\twhen \"-t\"\n\t\t\t\t\tuse_thread_token = true\n\t\t\t\twhen \"-s\"\n\t\t\t\t\tsession = val.to_i\n\t\t\tend\n\t\t}\n\t if(channelized)\t\n channel=Channel.new(client) {|c| c.channel.exec(cmd_exec)}\n channel.type=\"exec\"\n channel.info=cmd_exec\n print_line(\"Channel #{channel.cid} created.\") if channel\n else\n print_line(client.sys.exec(cmd_exec,cmd_args))\n end\n\t\tif (interact and channel)\n\t\t\tshell.interact_with_channel(channel)\n\t\tend\n\tend", "def run(cmd, host_ip)\n user = 'root'\n ip = host_ip\n port = 22\n\n @cmd = system \"ssh -p #{port} #{user}@#{ip} '#{cmd}'\" \n logger.info @cmd\n end", "def exec(cmd, doneStr = nil, stdin = nil)\n errBuf = \"\"\n outBuf = \"\"\n status = nil\n signal = nil\n\n # If passwordless sudo is true, we will just prepend every command by sudo\n cmd = 'sudo ' + cmd if @passwordless_sudo\n\n run_session do |ssh|\n ssh.open_channel do |channel|\n $log.debug \"MiqSshUtil::exec - Command: #{cmd} started.\" if $log\n channel.exec(cmd) do |chan, success|\n raise \"MiqSshUtil::exec - Could not execute command #{cmd}\" unless success\n unless stdin.nil?\n chan.send_data(stdin)\n chan.eof!\n end\n end\n\n channel.on_data do |_channel, data|\n $log.debug \"MiqSshUtil::exec - STDOUT: #{data}\" if $log\n outBuf << data\n data.each_line { |l| return outBuf if doneStr == l.chomp } unless doneStr.nil?\n end\n\n channel.on_extended_data do |_channel, _type, data|\n $log.debug \"MiqSshUtil::exec - STDERR: #{data}\" if $log\n errBuf << data\n end\n\n channel.on_request('exit-status') do |_channel, data|\n status = data.read_long\n $log.debug \"MiqSshUtil::exec - STATUS: #{status}\" if $log\n end\n\n channel.on_request('exit-signal') do |_channel, data|\n signal = data.read_string.strip\n $log.debug \"MiqSshUtil::exec - SIGNAL: #{signal}\" if $log\n end\n\n channel.on_eof do |_channel|\n $log.debug \"MiqSshUtil::exec - EOF RECEIVED\" if $log\n end\n\n channel.on_close do |_channel|\n $log.debug \"MiqSshUtil::exec - Command: #{cmd}, exit status: #{status}\" if $log\n if signal.present? || status.nonzero? || errBuf.present?\n raise \"MiqSshUtil::exec - Command '#{cmd}', exited with signal #{signal}\" if signal.present?\n raise \"MiqSshUtil::exec - Command '#{cmd}', exited with status #{status}\" if errBuf.empty?\n raise \"MiqSshUtil::exec - Command '#{cmd}' failed: #{errBuf.chomp}, status: #{status}\"\n end\n return outBuf\n end\n end\n ssh.loop\n end\n end", "def executeCommand(command, dryRun)\n #N Without this, the command won't be echoed\n puts \"EXECUTE: #{command}\"\n #N Without this check, the command will be executed even if it is meant to be a dry run\n if not dryRun\n #N Without this, the command won't actualy be execute even when it is meant to be run\n system(command)\n #N Without this check, a failed command will be treated as if it had executed successfully\n checkProcessStatus(command)\n end\n end", "def command(args = {}, escape = true)\n SSH.command compile(args), escape\n end", "def exec(argv, options = {}, &block)\n sshcmd = %W( ssh #{@remote} -tS #{controlsocket} )\n\n sshcmd += %W( cd #{options[:chdir]} && ) if options.has_key?(:chdir)\n\n @local.exec(sshcmd + argv, &block)\n end", "def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end", "def ssh_with_password(hostname, username, password, command, exit_codes = [0], stdout = false)\n stdout_data = \"\"\n exit_code = nil\n\n begin\n Net::SSH.start(hostname, username, :password => password) do |ssh_session|\n ssh_session.open_channel do |channel|\n channel.exec(command) do |ch, success|\n unless success\n abort \"FAILED: couldn't execute command\"\n end\n\n channel.on_data do |ch, data|\n stdout_data += data\n end\n\n channel.on_request(\"exit-status\") do |ch, data|\n exit_code = data.read_long.to_i\n end\n end\n end\n ssh_session.loop\n end\n rescue\n fail_test(\"Unable to connect to #{hostname}!\")\n end\n\n if not Array(exit_codes).include?(exit_code)\n fail_test(\"Unexpected exit code returned: #{exit_code}!\")\n end\n\n if stdout\n return stdout_data\n end\nend", "def ssh_command(ssh_info)\n command_options = %W[\n -o Compression=yes\n -o DSAAuthentication=yes\n -o LogLevel=#{ssh_info[:log_level] || 'FATAL'}\n -o StrictHostKeyChecking=no\n -o UserKnownHostsFile=/dev/null\n ]\n\n if ssh_info[:forward_x11]\n command_options += %w[\n -o ForwardX11=yes\n -o ForwardX11Trusted=yes\n ]\n end\n\n if ssh_info[:forward_agent]\n command_options += %w[-o ForwardAgent=yes]\n end\n\n ssh_info[:private_key_path].each do |path|\n command_options += ['-i', path]\n end\n\n if ssh_info[:port]\n command_options += ['-p', ssh_info[:port]]\n end\n\n \"ssh #{command_options.join(' ')}\"\n end", "def _ssh(path_of_servers, sshpass_command, user_exec_command)\n if path_of_servers.size == 0\n return \"#{sshpass_command} #{user_exec_command}\"\n end\n\n server = path_of_servers.shift\n #shell command needs double quote's escape\n sshpass_command += \"\\\"#{one_ssh_str(server)}\"\n _ssh(path_of_servers, sshpass_command, user_exec_command)\n end", "def exec(command, options={})\n return destination_server.run(command, options)\n end", "def run_ssh_command(ssh_command, loops = 5, command_delay = 5)\n result = ''\n done = true\n (0...loops).each do\n begin\n Net::SSH.start(get_access_ip, 'ubuntu', keys: @aws_setup_information[@environment.to_sym][:keyPath]) do |ssh|\n result = ssh.exec!(ssh_command).to_s\n end\n rescue StandardError\n done = false\n sleep command_delay\n end\n break if done\n end\n result\n end", "def exec_ssh(command, args, setting)\n puts \"#{Time.now} call #{self.class}##{__method__}\"\n ssh_options = ssh_option_init(setting)\n\n user = setting[\"ssh\"][\"user\"]\n host = setting[\"ssh\"][\"host\"]\n remote_dir = setting[\"dir\"][\"remote\"]\n\n Net::SSH.start(host, user, ssh_options) do |session|\n case command\n when :scp\n puts \"#{Time.now} scp: from #{args} to #{user}@#{host}:#{remote_dir}\"\n return Net::SCP.new(session).upload!(args, remote_dir, {:verbose => 'useful'})\n when :ssh\n return session.exec!(\"bash -c '#{args}'\").chomp!\n end\n end\n rescue Net::SSH::AuthenticationFailed => ex\n puts \"1\"\n puts \"class:#{ex.class} #{ex.message}\"\n return ex.class\n rescue Errno::ECONNREFUSED => ex\n puts \"2\"\n puts \"class:#{ex.class} #{ex.message}\"\n rescue => ex\n puts \"3\"\n puts \"class:#{ex.class} #{ex.message}\"\n end", "def sudo_exec!(command, input = nil)\n stdout = String.new\n sudo_prompt = nil\n input_sent = !input\n \n ssh_channel = @net_ssh.open_channel do |channel|\n channel.request_pty do |_, success|\n raise \"Failed to get pty (interactive ssh session)\" unless success\n end\n channel.exec command do |_, success|\n raise \"Failed to exec command \\\"#{command}\\\"\" unless success\n channel.on_data do |_, data|\n stdout << data\n if sudo_prompt.nil?\n if /sudo[^\\n]*password/i =~ stdout\n sudo_prompt = true\n unless password = @live_ssh_credential.password\n raise ArgumentError, \"sudo requires password credential\" \n end\n channel.send_data \"#{password}\\n\"\n else\n lines = stdout.split(\"\\n\").map(&:strip).reject(&:empty?)\n unless lines.all? { |line| /sudo/ =~ line }\n sudo_prompt = false\n end\n end\n elsif !input_sent\n channel.send_data input\n channel.send_data \"\\004\"\n channel.eof!\n input_sent = true\n end\n end\n channel.on_extended_data { |_, _, data| stdout << data }\n end\n end\n ssh_channel.wait\n # Remove the sudo prompt from the output.\n sudo_prompt ? stdout[(stdout.index(\"\\n\") + 1)..-1] : stdout\n end", "def run(*args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n { :sep => \" \"}.merge(options)\n\n # If we give a block we run commands one by one\n if block_given?\n options.merge!(:sep => \" && \")\n yield args\n end\n\n # Set default options if not given\n options[:pty] = request_pty unless options.has_key?(:pty)\n options[:hidden] = hidden unless options.has_key?(:hidden)\n options[:silent] = silent unless options.has_key?(:silent)\n\n cmd = args.join(options[:sep] || ' ')\n if options[:as]\n if options[:as] == 'root'\n cmd = \"sudo #{cmd}\"\n else\n cmd = \"su #{options[:as]} -c '#{cmd.gsub(\"'\", \"'\\\\\\\\''\")}'\"\n end\n end\n log(cmd) unless options[:hidden]\n result = \"\"\n ssh.open_channel do |channel|\n channel.request_pty if options[:input] || options[:pty]\n channel.exec cmd\n channel.on_data do |c, data|\n result << data\n unless options[:silent] || options[:hidden]\n DO_LOGGER.print(data); DO_LOGGER.flush\n end\n if options[:input]\n match = options[:match] || /password/i\n if data =~ match\n options[:input] += \"\\n\" if options[:input][-1] != ?\\n\n channel.send_data(options[:input])\n DO_LOGGER.puts(options[:input]) unless options[:silent] || options[:hidden] || data =~ /password/i\n end\n end\n end\n end\n ssh.loop\n result.chomp\n end" ]
[ "0.80623156", "0.7998833", "0.72342867", "0.70143723", "0.69197494", "0.6885934", "0.68766254", "0.68601596", "0.6830038", "0.67334074", "0.6721422", "0.66990197", "0.6686303", "0.6633429", "0.662474", "0.6609969", "0.6594626", "0.656683", "0.65378016", "0.6530301", "0.65062225", "0.64689493", "0.6454625", "0.6441205", "0.6430085", "0.6422995", "0.6420839", "0.6358958", "0.633798", "0.6316073", "0.6313892", "0.63075364", "0.6302715", "0.6299103", "0.6273171", "0.62377864", "0.6227021", "0.62036496", "0.62035066", "0.6192363", "0.6184451", "0.6181558", "0.6162705", "0.6149874", "0.6149874", "0.6132073", "0.6124729", "0.6113945", "0.6111471", "0.6084398", "0.6067063", "0.6047374", "0.6045928", "0.60406625", "0.6040658", "0.6040293", "0.60329735", "0.6027554", "0.6009207", "0.6006371", "0.5998925", "0.59648615", "0.5963253", "0.5952176", "0.59348685", "0.59206057", "0.5917327", "0.59123737", "0.5893324", "0.5884551", "0.5882812", "0.5866105", "0.5854353", "0.5845833", "0.58418065", "0.5839976", "0.58358896", "0.5832847", "0.5831299", "0.5825697", "0.58204037", "0.58082795", "0.5802729", "0.5802729", "0.5798774", "0.5792299", "0.57913935", "0.5790633", "0.5775882", "0.57736075", "0.5769846", "0.5768652", "0.5766192", "0.57621396", "0.57565707", "0.5725187", "0.57222944", "0.5721932", "0.57190645", "0.57175344" ]
0.7554006
2
delete a remote directory, if dryRun is false N Without this, we won't have an easy way to delete a directory on the remote system, echoing the command used to delete the directory, and optionally only doing a dry run
def deleteDirectory(dirPath, dryRun) #N Without this, the deletion command won't be run at all sshAndScp.deleteDirectory(dirPath, dryRun) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteDirectory(dirPath, dryRun)\n #N Without this, the required ssh command to recursive remove a directory won't be (optionally) executed. Without the '-r', the attempt to delete the directory won't be successful.\n ssh(\"rm -r #{dirPath}\", dryRun)\n end", "def deleteFile(filePath, dryRun)\n #N Without this, the required ssh command to delete a file won't be (optionally) executed.\n ssh(\"rm #{filePath}\", dryRun)\n end", "def doDeleteOperations(destinationContent, dryRun)\n #N Without this loop, we won't delete all sub-directories or files and directories within sub-directories which have been marked for deletion\n for dir in destinationContent.dirs\n #N Without this check, we would delete directories which have not been marked for deletion (which would be incorrect)\n if dir.toBeDeleted\n #N Without this, we won't know the full path of the remote directory to be deleted\n dirPath = destinationLocation.getFullPath(dir.relativePath)\n #N Without this, the remote directory marked for deletion won't get deleted\n destinationLocation.contentHost.deleteDirectory(dirPath, dryRun)\n else\n #N Without this, files and sub-directories within this sub-directory which are marked for deletion (even though the sub-directory as a whole hasn't been marked for deletion) won't get deleted.\n doDeleteOperations(dir, dryRun)\n end\n end\n #N Without this loop, we won't delete files within this directory which have been marked for deletion.\n for file in destinationContent.files\n #N Without this check, we would delete this file even though it's not marked for deletion (and therefore should not be deleted)\n if file.toBeDeleted\n #N Without this, we won't know the full path of the file to be deleted\n filePath = destinationLocation.getFullPath(file.relativePath)\n #N Without this, the file won't actually get deleted\n destinationLocation.contentHost.deleteFile(filePath, dryRun)\n end\n end\n end", "def delete_directory(client, options)\n if !options[:directory].nil?\n directory = client.directories.get options[:directory]\n directory.delete\n puts \"Directory deleted.\"\n return\n else\n puts \"Missing arguments\"\n return nil\n end\nend", "def action_delete\n if (!dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } doesn't exist; delete action not taken\")\n else\n converge_by(\"Delete #{ @new_resource }\") do\n @client.delete(@path)\n end\n new_resource.updated_by_last_action(true)\n end\n end", "def delete(rmdir: false)\n # FIXME: rethink this interface... should qdel be idempotent?\n # After first call, no errors thrown after?\n\n if pbsid\n\n @torque.qdel(pbsid, host: @host)\n # FIXME: removing a directory is always a dangerous action.\n # I wonder if we can add more tests to make sure we don't delete\n # something if the script name is munged\n\n # recursively delete the directory after killing the job\n Pathname.new(path).rmtree if path && rmdir && File.exist?(path)\n end\n end", "def deleteFile(filePath, dryRun)\n #N Without this, the deletion command won't be run at all\n sshAndScp.deleteFile(filePath, dryRun)\n end", "def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:node_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n project = get_default_project()\n\n NodeModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end", "def delete_directories account\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n \n # Tell the user\n puts \"> Tar bort kontot från filsystemet\".green\n\n # Build the paths\n mail_dir = BASE_PATH_MAIL + account['mail']\n home_dir = BASE_PATH_HOME + account['home']\n\n # Remove the directories\n fu.rm_r mail_dir\n fu.rm_r home_dir\nend", "def rmdir(dirname)\n voidcmd(\"RMD \" + dirname)\n end", "def rmdir(dirname)\n\t\tvoidcmd(\"RMD \" + dirname)\n\t end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:test_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n\n project = get_default_project()\n TestModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end", "def rmdir(dirname)\n ensure_relative_path! :rmdir, path\n @sftp.rmdir! remote_path(dirname)\n end", "def delete_directory domain\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n\n # Tell the user\n puts \"> Tar bort domänen från filsystemet\".green\n\n # Build the paths\n mail_dir = BASE_PATH_MAIL + domain['domain']\n home_dir = BASE_PATH_HOME + domain['domain']\n\n # Remove the directories\n fu.rm_r mail_dir\n fu.rm_r home_dir\nend", "def clear_remote\n execute(:rm, '-rf', File.join(remote_cache_path, '*')) if test!(\"[ -d #{remote_cache_path} ]\")\n end", "def smb_rmdir(dirname, rdir=nil)\n if rdir.nil?\n dir=''\n else\n dir=' -D ' + rdir\n end\n file = Tempfile.new('ruby_smbclient')\n if @hashpass\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass} -c 'rmdir #{dirname}'#{dir} > #{file.path} 2>&1\")\n else\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass} -c 'rmdir #{dirname}'#{dir} > #{file.path} 2>&1\")\n end\n file.unlink\n if success\n return true\n else\n return false\n end\n end", "def delete_directory_contents(options)\n Process::Delete::DirectoryContents.delete(options[:directory_path])\n end", "def destroy\n @folder_to_delete = @repository.get_secret_path\n if @repository.destroy\n FileUtils.rm_rf(@folder_to_delete, :secure =>true)\n puts @path\n respond_to do |format|\n format.html { redirect_to repositories_url, notice: 'Repository was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n format.html { redirect_to @repository, notice: 'Repository was not destroyed.' }\n end\n end", "def rmdir() Dir.rmdir( expand_tilde ) end", "def rm_r(path)\n cmd 'rm', '-r', path\nend", "def rm_rf(path)\n cmd 'rm', '-rf', path\nend", "def destroy_file\n start_ssh do |ssh|\n ssh.exec!(\"rm #{e full_filename}\")\n dir = File.dirname(full_filename)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n dir = File.dirname(dir)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n end\n end", "def delete_dir\n FileUtils.rm_rf(@server_dir)\n @queue = []\n end", "def cmd_rmdir(*args)\n\t\tif (args.length == 0 or args.include?(\"-h\"))\n\t\t\tprint_line(\"Usage: rmdir dir1 dir2 dir3 ...\")\n\t\t\treturn true\n\t\tend\n\n\t\targs.each { |dir|\n\t\t\tprint_line(\"Removing directory: #{dir}\")\n\t\t\tclient.fs.dir.rmdir(dir)\n\t\t}\n\n\t\treturn true\n\tend", "def rmdir(dirname)\n ensure_relative_path! :rmdir, dirname\n @ftp.rmdir dirname\n end", "def clean_directory(path, types=nil, run_context=nil)\n raise 'clean_directory path must be a non-empty string!' if path.nil? or path.empty?\n types ||= [\n Chef::Resource::File,\n Chef::Resource::Link,\n Chef::Resource::CookbookFile,\n Chef::Resource::RemoteFile,\n Chef::Resource::Template,\n ]\n run_context ||= node.run_context\n\n # find the chef files generated\n chef_files_generated = run_context.resource_collection.select { |r|\n types.include?(r.class) and r.path.start_with?(path)\n }.map { |r| r.path }\n\n # find the fileststem files present\n filesystem_files_present = Dir[\"#{path}/**/*\"].select { |f|\n ::File.file?(f) or ::File.symlink?(f)\n }\n\n # calculate the difference, and remove the extraneous files\n (filesystem_files_present - chef_files_generated).each do |f|\n if ::File.symlink?(f)\n link \"clean_directory: #{f}\" do\n target_file f\n action :delete\n end\n else\n file \"clean_directory: #{f}\" do\n path f\n action :delete\n end\n end\n end\nend", "def delete_gdom_dir(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n destroy_zfs_fs(gdom_dir)\n return\nend", "def files_remote_remove(options = {})\n post('files.remote.remove', options)\n end", "def rest__delete_remote\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n version = ret_request_params(:version)\n\n opts = {}\n opts.merge!(namespace: remote_namespace) unless remote_namespace.empty?\n\n remote_namespace, remote_module_name = Repo::Remote.split_qualified_name(ret_non_null_request_params(:remote_module_name), opts)\n remote_params = remote_params_dtkn(:component_module, remote_namespace, remote_module_name, version)\n\n project = get_default_project()\n response = ComponentModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n\n rest_ok_response response\n end", "def delete_gdom_disk(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n client_disk = gdom_dir+\"/vdisk0\"\n message = \"Information:\\tRemoving disk \"+client_disk\n command = \"rm #{client_disk}\"\n execute_command(options,message,command)\n return\nend", "def remove_local_copy\n Dir.chdir(self.study.data_store_path)\n if File.exists?(self.download_location)\n File.delete(self.download_location)\n subdir = self.remote_location.blank? ? self.id : self.remote_location.split('/').first\n if Dir.exist?(subdir) && Dir.entries(subdir).delete_if {|e| e.start_with?('.')}.empty?\n Dir.rmdir(subdir)\n end\n end\n end", "def rmd(msg)\n msg = msg.join(\" \") if msg.is_a? Array\n\n if File.directory? msg\n Dir::delete msg\n elsif File.file? msg\n File::delete msg\n end\n log \"[DEBUG] #{thread[:user]} deleted #{Dir::pwd}/#{msg}\"\n \"200 OK, deleted #{msg}\"\n end", "def destroy\n @directory = @user.directory\n @directory.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_directory_url, :flash => { success: 'Directory deleted.' } }\n format.json { head :no_content }\n end\n end", "def delete(rpm_remote_href, opts = {})\n data, _status_code, _headers = delete_with_http_info(rpm_remote_href, opts)\n data\n end", "def delete_dir!(path)\n # do nothing, because there's no such things as 'empty directory'\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 destroy(remote_path)\n get_adapter.delete_file(remote_path)\n end", "def rm_rf(z, path)\n z.get_children(:path => path).tap do |h|\n if h[:rc].zero?\n h[:children].each do |child|\n rm_rf(z, File.join(path, child))\n end\n elsif h[:rc] == ZNONODE\n # no-op\n else\n raise \"Oh noes! unexpected return value! #{h.inspect}\"\n end\n end\n\n rv = z.delete(:path => path)\n\n unless (rv[:rc].zero? or rv[:rc] == ZNONODE)\n raise \"oh noes! failed to delete #{path}\" \n end\n\n path\n end", "def delete\n if processable? or unset?\n dir.delete\n else\n raise JobError.cannot_delete(@id, state)\n end\n end", "def rmdir(path)\n send_request(FXP_RMDIR, :string, path)\n end", "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def destroy\n run_callbacks :destroy do\n if directory?\n logger.info \"Delete directory at #{absolute_path}\"\n FileUtils.rmdir absolute_path\n else\n logger.info \"Delete file at #{absolute_path}\"\n # TODO if the file has added state (not committed), reset it to HEAD\n if status_file.untracked\n FileUtils.rm absolute_path\n else\n remove\n end\n end\n true\n end\n end", "def delete_dir!(dir)\n result = interact(:delete_test, :proceed) do |i|\n files = Dir.glob(File.join(dir, \"**\", \"*\"))\n i.prompt(\"The following files will be removed:\\n * \" + files.join(\"\\n * \"))\n i.choice('D', \"Delete them.\") do\n FileUtils.rm_rf(@test_case.folder)\n end\n i.choice('x', \"I changed my mind.\") do\n end\n end\n result == :proceed\n end", "def remove_dir(sftp_session, remote_path, local_path)\n\n if local_path\n\n # remove the local directory\n FileUtils.remove_dir(local_path)\n elsif remote_path\n\n # remove all of the files in the remote location\n sftp_session.dir.foreach(remote_path) do |remote_entry|\n\n # don't remove the links to the current or parent directory\n if(remote_entry.name != \".\" && remote_entry.name != \"..\")\n\n if remote_entry.directory?\n\n remove_dir(sftp_session, remote_path + \"/\" + remote_entry.name, nil)\n else\n\n remove_file(sftp_session, remote_path + \"/\" + remote_entry.name,\n nil)\n end\n end\n end\n \n # remove the remote directory, we block in case this is a\n # recursive call and the parent directory is going to be deleted\n # when this call returns\n sftp_session.rmdir!(remote_path)\n end\n end", "def rm(path)\n cmd 'rm', path\nend", "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "def run_destroy\n run(\n result:\n ::Kitchen::Terraform::Client::Command\n .destroy(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .enable_lock\n .lock_timeout(duration: config_lock_timeout)\n .disable_input\n .maybe_no_color(toggle: !config_color)\n .parallelism(concurrent_operations: config_parallelism)\n .enable_refresh\n .state(path: config_state)\n .state_out(path: config_state)\n .vars(keys_and_values: config_variables)\n .var_files(paths: config_variable_files)\n .force,\n working_directory: instance_directory\n )\n )\n end", "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 destroy_directory!(directory)\n system(\"trash #{directory}\")\n end", "def rsync!(host, remote_folder)\n \tputs \"rsync #{folder}/#{name}* #{host}:#{remote_folder}\"\n \t`rsync --delete #{folder}/#{name}* #{host}:#{remote_folder}`\n end", "def delete(remote_filepath)\n @request = Net::HTTP::Delete.new(::File.join(@uri.path, remote_filepath))\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.body.presence || @response.code.to_i\n end", "def pull_dir(localpath, remotepath, options = {}, &block)\n connect! unless @connection\n @recursion_level += 1\n\n todelete = Dir.glob(File.join(localpath, '*'))\n \n tocopy = []\n recurse = []\n\n # To trigger error if path doesnt exist since list will\n # just return and empty array\n @connection.chdir(remotepath)\n\n @connection.list(remotepath) do |e|\n entry = Net::FTP::List.parse(e)\n \n paths = [ File.join(localpath, entry.basename), \"#{remotepath}/#{entry.basename}\".gsub(/\\/+/, '/') ]\n\n if entry.dir?\n recurse << paths\n elsif entry.file?\n if options[:since] == :src\n tocopy << paths unless File.exist?(paths[0]) and entry.mtime < File.mtime(paths[0]) and entry.filesize == File.size(paths[0])\n elsif options[:since].is_a?(Time)\n tocopy << paths unless entry.mtime < options[:since] and File.exist?(paths[0]) and entry.filesize == File.size(paths[0])\n else\n tocopy << paths\n end\n end\n todelete.delete paths[0]\n end\n \n tocopy.each do |paths|\n localfile, remotefile = paths\n unless should_ignore?(localfile)\n begin\n @connection.get(remotefile, localfile)\n log \"Pulled file #{remotefile}\"\n rescue Net::FTPPermError\n log \"ERROR READING #{remotefile}\"\n raise Net::FTPPermError unless options[:skip_errors]\n end\n end\n end\n \n recurse.each do |paths|\n localdir, remotedir = paths\n Dir.mkdir(localdir) unless File.exist?(localdir)\n pull_dir(localdir, remotedir, options, &block)\n end\n \n if options[:delete]\n todelete.each do |p|\n block_given? ? yield(p) : FileUtils.rm_rf(p)\n log \"Removed path #{p}\"\n end\n end\n \n @recursion_level -= 1\n close! if @recursion_level == 0\n rescue Net::FTPPermError\n close!\n raise Net::FTPPermError\n end", "def delete\n if options.master?\n delete_master(options)\n elsif options.slave?\n delete_slave(options)\n else\n invoke :help, [:delete]\n end\n end", "def ftp_remove path\n return ftp_action(true, path)\n end", "def delete(conn_id, path, *args)\n options = args.extract_options!\n options.assert_valid_keys(VALID_DELETE_OPTIONS)\n \n timeout = resolve_timeout_option(options[:timeout], 10.seconds)\n path = resolve_folderpath_option(conn_id, path)\n \n with_connection(conn_id, timeout) { |conn|\n conn.folder_delete(path, options[:recursive])\n }\n end", "def rmdir(list, options = {})\r\n fu_check_options options, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message \"rmdir #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n list.each do |dir|\r\n Dir.rmdir dir.sub(%r</\\z>, '')\r\n end\r\n end", "def delete_remote?\n true\n end", "def rmdir(dir)\n FileUtils.rm_rf dir\n puts \" ✔ rm -rf #{dir}\".colorize(:magenta).bold\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n # Dir.chdir(\"public/images\")\n Dir.delete(@album['directory'])\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n error = nil\n\n if @file.directory_id.nil?\n render_error \"Cannot remove root directory. Delete the project, instead.\"\n else\n begin\n ActiveRecord::Base.transaction do\n delete_file(@file, true);\n render json: \"\", serializer: SuccessSerializer\n end\n rescue\n render_error \"Files could not be deleted.\"\n end\n end\n end", "def rmdir() Dir.rmdir(path) end", "def destroy\n @directory = Directory.find(params[:id])\n @directory.destroy\n\n respond_to do |format|\n format.html { redirect_to directories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @directory.destroy\n respond_to do |format|\n format.html { redirect_to directories_url, notice: 'Directory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @winddir.destroy\n respond_to do |format|\n format.html { redirect_to winddirs_url, notice: 'Winddir was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_remote\n policy = get_policy(\"remove\")\n signature = get_signature(policy)\n remote = url+\"?signature=\"+signature+\"&policy=\"+policy\n try = self.class.delete(remote)\n\n # If file not found in filepicker, destroy anyway, else only if success\n if try.not_found?\n true\n else\n try.success?\n end\n end", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def rmdir\n util.rmdir(path)\n end", "def rm_rf path\n execute(\"rm -rf #{path}\")\n end", "def destroy\n temp = @folder_client.destroy(get_id, force)\n if temp[:status]\n flash_message(:notice,\"#{t('folder.folder')} #{t('succesfully_destroyed')}\")\n redirect_to folders_path\n else\n if temp[:code] == 403\n @id = get_id\n @message = temp[:response]['message']\n else\n flash_message(:error, temp[:response]['message'])\n redirect_to root_path\n end\n\n end\n @success = temp[:status]\n end", "def rmdir(list, options = {})\r\n fu_check_options options, OPT_TABLE['rmdir']\r\n list = fu_list(list)\r\n fu_output_message \"rmdir #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n list.each do |dir|\r\n Dir.rmdir dir.sub(%r</\\z>, '')\r\n end\r\n end", "def rmdir(list, options = {})\r\n fu_check_options options, OPT_TABLE['rmdir']\r\n list = fu_list(list)\r\n fu_output_message \"rmdir #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n list.each do |dir|\r\n Dir.rmdir dir.sub(%r</\\z>, '')\r\n end\r\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def delete_dir_contents(target_dir)\n Find.find(target_dir) do |x|\n if File.file?(x)\n FileUtils.rm(x)\n elsif File.directory?(x) && x != target_dir\n FileUtils.remove_dir(x)\n end\n end\n end", "def delete\n File.delete fullpath\n dirname = File.dirname(fullpath)\n while dirname != root\n Dir.rmdir(dirname)\n dirname = File.dirname(dirname)\n end\n rescue Errno::ENOTEMPTY\n end", "def runcmd(cmd, dest)\n Chef::Log.debug(\"fb_rsync[#{dest}]: Running command: #{cmd}\")\n # Throw normal errors except on 25 which is a max-delete limit error\n s = Mixlib::ShellOut.new(cmd, :returns => [0, 25])\n s.run_command.error!\n Chef::Log.debug(\"STDOUT:\\n#{s.stdout}\")\n Chef::Log.debug(\"STDERR:\\n#{s.stderr}\")\n return s.exitstatus\nend", "def delete\n if (exists?)\n list.each do |children|\n children.delete\n end\n factory.system.delete_dir(@path)\n end\n end", "def delete\n if stat.directory?\n FileUtils.rm_rf(file_path)\n else\n ::File.unlink(file_path)\n end\n ::File.unlink(prop_path) if ::File.exist?(prop_path)\n @_prop_hash = nil\n NoContent\n end", "def destroy\n\t\t@directory = Directory.find(params[:id])\n\t\[email protected]_flag = 'N'\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(directories_url) }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend", "def rmtree\n # The name \"rmtree\" is borrowed from File::Path of Perl.\n # File::Path provides \"mkpath\" and \"rmtree\".\n FileUtils.rm_r( expand_tilde )\n end", "def rm(key, options = {})\n return 1 unless self.class.subkeys.include?(key)\n begin\n puts \"Removing directory: #{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"\n FileUtils.rm_rf(Dir[\"#{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"].first)\n 0\n rescue\n 1\n end\n end", "def delete(path, **options)\n execute :delete, path, options\n end", "def delete(volume)\n dest_path = dest_path_resolver.path(volume)\n removed = fs.remove(dest_path)\n log(volume, removed ? \"removed\" : \"not present\")\n fs.rm_empty_tree(dest_path.parent)\n end", "def delete\n data = Storm::Base::SODServer.remote_call '/Network/Pool/delete',\n :uniq_id => @uniq_id\n data[:deleted]\n end", "def sync_cmd\n \"rsync --delete -avzhe '#{@ssh_path} -p #{@port}' #{cygdrive_path @log_dir} #{user_at_host}:#{@remote_log_parent_dir}\"\n end", "def update_remotely_deleted(file, node)\n #\n if node != ancestor.file_node(file) && !overwrite?\n if UI.ask(\"local changed #{file} which remote deleted\\n\" +\n \"use (c)hanged version or (d)elete?\") == \"d\"\n then remove file\n else add file\n end\n else\n remove file\n end\n end", "def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end", "def delete\n conn.delete(escaped_path)\n true\n rescue StandardError => e\n puts \"carrierwave-upyun delete failed: #{e.inspect}\"\n nil\n end", "def delete\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = running?\n return running_response unless running_response.successful?\n\n if running_response.data\n message = 'The VM must not be running in order to delete it.'\n return Response.new :code => 1, :message => message\n end\n\n FileUtils.rm_rf path\n Metadata.delete_vm_info path\n\n Response.new :code => 0\n end", "def delete\n execute_prlctl('delete', @uuid)\n end", "def delete_directory_or_file(dir_or_file)\n if File.exist?(dir_or_file)\n FileUtils.rm_rf(dir_or_file)\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def delete_user_folder(id)\n @client.raw('delete', \"/helpers/folders/#{id}\")\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @folder.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def smb_rm(filename, rdir=nil)\n if rdir.nil?\n dir=''\n else\n dir=' -D ' + rdir\n end\n file = Tempfile.new('ruby_smbclient')\n if @hashpass\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n else\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n end\n file.unlink\n if success\n return true\n else\n return false\n end\n end", "def remove_dir path\r\n files = []\r\n dirs = []\r\n\r\n @ftp.list path do |line|\r\n name = line.split(' ', 9)[8] #should be file or dir name\r\n is_dir = line.chars.to_a[0] == 'd' #first character is 'd' for dirs\r\n if is_dir\r\n dirs << name\r\n else\r\n files << name\r\n end\r\n end\r\n\r\n files.each do |file|\r\n remove_file(File.join(path, file))\r\n end\r\n\r\n dirs.each do |dir|\r\n unless dir == '.' || dir == '..'\r\n remove_dir(File.join(path, dir))\r\n end\r\n end\r\n\r\n begin\r\n @ftp.rmdir path\r\n rescue Net::FTPPermError\r\n end\r\n end", "def destroy\n @directory = Directory.find(params[:id])\n @directory.destroy\n\n respond_to do |format|\n format.html { redirect_to(directories_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.72875273", "0.60775054", "0.60387176", "0.5988651", "0.594037", "0.582975", "0.5825996", "0.5807917", "0.5720745", "0.5713057", "0.56959915", "0.56953317", "0.56894636", "0.5675578", "0.56639045", "0.54741323", "0.5473462", "0.54661775", "0.5463827", "0.54415953", "0.54240084", "0.540321", "0.54007745", "0.5400458", "0.5372995", "0.53435826", "0.5341765", "0.53119546", "0.53112364", "0.530718", "0.5292642", "0.5290974", "0.52821153", "0.5279443", "0.5268242", "0.5257377", "0.52569485", "0.5244823", "0.52363694", "0.5229344", "0.5222049", "0.52061343", "0.5202846", "0.5194694", "0.5177689", "0.51681244", "0.5146435", "0.5144137", "0.5141161", "0.5138153", "0.5119385", "0.5114366", "0.5111626", "0.51013", "0.50851136", "0.50844926", "0.5069398", "0.5062257", "0.5056169", "0.50381035", "0.50231254", "0.50159615", "0.5006114", "0.50025934", "0.4991281", "0.4988332", "0.49849123", "0.49849123", "0.49779892", "0.4977244", "0.49757844", "0.49690208", "0.49690208", "0.49634767", "0.49634767", "0.49590087", "0.49432403", "0.49415457", "0.49319986", "0.4929316", "0.4926369", "0.49082097", "0.49071378", "0.4896148", "0.4881214", "0.48721084", "0.48714226", "0.48690897", "0.48681504", "0.4865395", "0.48506156", "0.48478615", "0.48345837", "0.48340958", "0.4832813", "0.4829816", "0.48277524", "0.48264715", "0.4825646", "0.4822755" ]
0.68658614
1
delete a remote file, if dryRun is false N Without this, we won't have an easy way to delete a file on the remote system, echoing the command used to delete the file, and optionally only doing a dry run
def deleteFile(filePath, dryRun) #N Without this, the deletion command won't be run at all sshAndScp.deleteFile(filePath, dryRun) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteFile(filePath, dryRun)\n #N Without this, the required ssh command to delete a file won't be (optionally) executed.\n ssh(\"rm #{filePath}\", dryRun)\n end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def files_remote_remove(options = {})\n post('files.remote.remove', options)\n end", "def delete(remote_filepath)\n @request = Net::HTTP::Delete.new(::File.join(@uri.path, remote_filepath))\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.body.presence || @response.code.to_i\n end", "def delete_remote\n policy = get_policy(\"remove\")\n signature = get_signature(policy)\n remote = url+\"?signature=\"+signature+\"&policy=\"+policy\n try = self.class.delete(remote)\n\n # If file not found in filepicker, destroy anyway, else only if success\n if try.not_found?\n true\n else\n try.success?\n end\n end", "def destroy_file\n start_ssh do |ssh|\n ssh.exec!(\"rm #{e full_filename}\")\n dir = File.dirname(full_filename)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n dir = File.dirname(dir)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n end\n end", "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end", "def destroy(remote_path)\n get_adapter.delete_file(remote_path)\n end", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def update_remotely_deleted(file, node)\n #\n if node != ancestor.file_node(file) && !overwrite?\n if UI.ask(\"local changed #{file} which remote deleted\\n\" +\n \"use (c)hanged version or (d)elete?\") == \"d\"\n then remove file\n else add file\n end\n else\n remove file\n end\n end", "def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:node_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n project = get_default_project()\n\n NodeModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end", "def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:test_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n\n project = get_default_project()\n TestModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end", "def del_file( file_path )\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_rm_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} rm #{file_path}\"\n log.info(x) { \"[git] file remove command => #{git_rm_cmd}\" }\n %x[#{git_rm_cmd}];\n log.info(x) { \"[git] has removed #{file_path} from repo and working copy.\" }\n\n end", "def delete_file( path )\n # removes a file at path\n connection.delete( path )\n last_ftp_command_ok?\n end", "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def test_delete_file\n remote_file_name = 'TestDeleteFile.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = DeleteFileRequest.new(path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.delete_file(request)\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "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 delete_remote?\n true\n end", "def doDeleteOperations(destinationContent, dryRun)\n #N Without this loop, we won't delete all sub-directories or files and directories within sub-directories which have been marked for deletion\n for dir in destinationContent.dirs\n #N Without this check, we would delete directories which have not been marked for deletion (which would be incorrect)\n if dir.toBeDeleted\n #N Without this, we won't know the full path of the remote directory to be deleted\n dirPath = destinationLocation.getFullPath(dir.relativePath)\n #N Without this, the remote directory marked for deletion won't get deleted\n destinationLocation.contentHost.deleteDirectory(dirPath, dryRun)\n else\n #N Without this, files and sub-directories within this sub-directory which are marked for deletion (even though the sub-directory as a whole hasn't been marked for deletion) won't get deleted.\n doDeleteOperations(dir, dryRun)\n end\n end\n #N Without this loop, we won't delete files within this directory which have been marked for deletion.\n for file in destinationContent.files\n #N Without this check, we would delete this file even though it's not marked for deletion (and therefore should not be deleted)\n if file.toBeDeleted\n #N Without this, we won't know the full path of the file to be deleted\n filePath = destinationLocation.getFullPath(file.relativePath)\n #N Without this, the file won't actually get deleted\n destinationLocation.contentHost.deleteFile(filePath, dryRun)\n end\n end\n end", "def delete\n conn.delete(escaped_path)\n true\n rescue StandardError => e\n puts \"carrierwave-upyun delete failed: #{e.inspect}\"\n nil\n end", "def rm!( path )\r\n got = @ndev.rpc.file_delete( :path => path )\r\n return true if got.nil? # got no error\r\n # otherwise, there was an error, check output\r\n raise IOError, got.text\r\n end", "def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end", "def ftp_remove path\n return ftp_action(true, path)\n end", "def remove!\n messages = []\n transferred_files do |local_file, remote_file|\n messages << \"#{storage_name} started removing '#{ local_file }'.\"\n end\n Logger.message messages.join(\"\\n\")\n\n FileUtils.rm_r(remote_path)\n end", "def delete_file\n\n #delete the file\n Chef::Log.debug \"DEBUG: Removing file #{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf!\"\n ::File.delete(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf\")\n\nend", "def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end", "def delete(rpm_remote_href, opts = {})\n data, _status_code, _headers = delete_with_http_info(rpm_remote_href, opts)\n data\n end", "def clear_remote\n execute(:rm, '-rf', File.join(remote_cache_path, '*')) if test!(\"[ -d #{remote_cache_path} ]\")\n end", "def destroy_file\n File.delete full_file_path\n rescue\n end", "def delete(path, **options)\n execute :delete, path, options\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 rest__delete_remote\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n version = ret_request_params(:version)\n\n opts = {}\n opts.merge!(namespace: remote_namespace) unless remote_namespace.empty?\n\n remote_namespace, remote_module_name = Repo::Remote.split_qualified_name(ret_non_null_request_params(:remote_module_name), opts)\n remote_params = remote_params_dtkn(:component_module, remote_namespace, remote_module_name, version)\n\n project = get_default_project()\n response = ComponentModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n\n rest_ok_response response\n end", "def delete(session, id)\n write_task('rvpe.image.delete', session) do\n err_msg = \"You don't have permission to delete the image.\"\n sanity_check(session, id, err_msg) do\n call_one_xmlrpc('one.image.delete', session, id)\n end\n end\n end", "def file_delete(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/delete\", params)\n parse_response(response)\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 deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend", "def destroy\n file&.delete\n end", "def delete\n begin\n conn.delete(escaped_path)\n true\n rescue => e\n puts \"carrierwave-ucloud delete failed: #{e.inspect}\"\n nil\n end\n end", "def delete_file(filename)\n http.delete([204,404], luwak, escape(filename))\n true\n end", "def delete\n begin\n uy_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end", "def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end", "def delete(filename); end", "def rm_r(path)\n cmd 'rm', '-r', path\nend", "def rm(path)\n cmd 'rm', path\nend", "def rm(location)\n @client.file_delete(location)\n rescue\n puts $! if @@verbose\n nil\n end", "def delete\n unless FileDescriptor.exists?(filename: params[:fname])\n fpath = filePath params[:fname]\n begin\n File.delete fpath\n result = {status: 'ok'}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n else\n result = {status: 'error', message: 'File is open'}\n status = 403 # Forbidden\n end\n render json: result.to_json, status: status\n end", "def delete_file\n begin\n File.delete(stored_file_path)\n rescue => e\n logger.error(\"Could not delete #{stored_file_path}. Ignored.\")\n logger.error(e)\n end\n end", "def smb_rm(filename, rdir=nil)\n if rdir.nil?\n dir=''\n else\n dir=' -D ' + rdir\n end\n file = Tempfile.new('ruby_smbclient')\n if @hashpass\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n else\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass} -c 'rm #{filename}'#{dir} > #{file.path} 2>&1\")\n end\n file.unlink\n if success\n return true\n else\n return false\n end\n end", "def destroy\n @repo = Repository.find(params[:id])\n\n\t\t#REMOVE FILE FROM FILE SYSTEM AND DO A GIT commit\n\t\tif(FileUtils.rm(params[:path]))\n\t\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Removed file :: #{params[:path]}\")\n\t\tend\n end", "def destroy\n @remote_image_content = RemoteImageContent.find(params[:id])\n @remote_image_content.destroy\n\n respond_to do |format|\n format.html { redirect_to(remote_image_contents_url) }\n format.xml { head :ok }\n end\n end", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def delete_github_repo_file\n # commit\n commit_to_github(@repo, post_params)\n end", "def delete!(creds = {}, section = \"file\", reason = \"because\")\n BlipTV::ApiSpec.check_attributes('videos.delete', creds)\n\n reason = reason.gsub(\" \", \"%20\") # TODO write a method to handle this and other illegalities of URL\n\n if creds[:username] && !creds[:userlogin]\n creds[:userlogin] = creds[:username]\n end\n\n url, path = \"www.blip.tv\", \"/?userlogin=#{creds[:userlogin]}&password=#{creds[:password]}&cmd=delete&s=file&id=#{@id}&reason=#{reason}&skin=api\"\n request = Net::HTTP.get(url, path)\n hash = Hash.from_xml(request)\n make_sure_video_was_deleted(hash)\n end", "def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend", "def remove_challenge(challenge)\n check_connection!\n @logger.debug(\"Removing challenge file at #{challenge} on server=#{self.name}\")\n retval = @ssh.exec!(\"test -f '#{challenge}' && rm -f '#{challenge}' && echo -n success\").chomp\n if retval != \"success\"\n return false\n end\n return true\n end", "def cmd_rm(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\"Usage: rm file\")\n\t\t\treturn true\n\t\tend\n\n\t\tclient.fs.file.rm(args[0])\n\n\t\treturn true\n\tend", "def action_delete\n if (!dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } doesn't exist; delete action not taken\")\n else\n converge_by(\"Delete #{ @new_resource }\") do\n @client.delete(@path)\n end\n new_resource.updated_by_last_action(true)\n end\n end", "def delete\n msg = FileOperations.id_exist?(self) ? FileOperations.delete(self) : 'Product\n Not Found'\n puts msg\n end", "def delete(cloud_file)\n\n payload = {\n root: \"auto\",\n path: cloud_file.path\n }\n\n connexion = Dropbox.start(:delete, access_token)\n response = connexion.post do |req|\n req.url \"fileops/delete\"\n req.body = payload\n end\n response = format_response(response)\n Filetree.new('dropbox').update([response[:path], nil])\n\n end", "def delete(path, options = {})\n execute('DELETE', path, options)\n end", "def rm(file)\n cmd_exec(\"rm -rf #{file}\")\n end", "def test_remove_a_file\n a.rm(\"one\").commit(\"a removed one\")\n \n assert_equal nil, a['one']\n assert_equal \"one content\", b['one']\n \n b.pull\n \n assert_equal nil, a['one']\n assert_equal nil, b['one']\n \n assert_log_equal [\n \"a added one\",\n \"a removed one\"\n ], b\n end", "def delete\n @file = nil\n # file.delete\n end", "def action_delete\n if current_resource.exists?\n converge_by(\"Delete #{new_resource}\") do\n executor.execute!('delete-node', escape(new_resource.slave_name))\n end\n else\n Chef::Log.debug(\"#{new_resource} does not exist - skipping\")\n end\n end", "def delete(resource)\n finder_or_run(:delete, resource)\n end", "def deleteDirectory(dirPath, dryRun)\n #N Without this, the required ssh command to recursive remove a directory won't be (optionally) executed. Without the '-r', the attempt to delete the directory won't be successful.\n ssh(\"rm -r #{dirPath}\", dryRun)\n end", "def delete_with_http_info(rpm_remote_href, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RemotesRpmApi.delete ...'\n end\n # verify the required parameter 'rpm_remote_href' is set\n if @api_client.config.client_side_validation && rpm_remote_href.nil?\n fail ArgumentError, \"Missing the required parameter 'rpm_remote_href' when calling RemotesRpmApi.delete\"\n end\n # resource path\n local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', rpm_remote_href.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 = nil\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'AsyncOperationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RemotesRpmApi#delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @file_version.destroy\n head :no_content\n end", "def destroy\n @file.destroy\n respond_to do |format|\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n end\n end", "def delete_file(f)\n #return false if !f.kind_of?(Fog::Storage::AWS::File) || !storage_provider.eql?(:aws)\n log \"Deleting: #{f.key}\"\n return f.destroy\n end", "def delete(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = self.no_response_wrapper, signed = sign_requests)\n request(:delete, path, options, signature, raw, unformatted, no_response_wrapper, signed)\n end", "def destroy\n @other_file.destroy\n respond_to do |format|\n format.html { redirect_to other_files_url, notice: 'Other file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end", "def delete\n data = Storm::Base::SODServer.remote_call '/Network/Pool/delete',\n :uniq_id => @uniq_id\n data[:deleted]\n end", "def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "def http_delete(_request, h_r, temp_location)\n return nil unless ::File.exist?(temp_location)\n\n ::File.unlink(temp_location)\n h_r.update_header('X-Sabre-Temp', 'true')\n h_r.status = 204\n false\n end", "def destroy\n \n @user_file = UserFile.find(params[:id])\n authorize! :destroy, @user_file\n name=@user_file.uploaded_file_file_name\n @user_file.destroy\n\n respond_to do |format|\n format.html { redirect_to :back,:notice=>\"Deleted file: \"+name }\n format.json { head :ok }\n end\n end", "def userfiles_delete_files_delete_with_http_info(multi_userfile_mod_req, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_delete_files_delete ...'\n end\n # verify the required parameter 'multi_userfile_mod_req' is set\n if @api_client.config.client_side_validation && multi_userfile_mod_req.nil?\n fail ArgumentError, \"Missing the required parameter 'multi_userfile_mod_req' when calling UserfilesApi.userfiles_delete_files_delete\"\n end\n # resource path\n local_var_path = '/userfiles/delete_files'\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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(multi_userfile_mod_req)\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:DELETE, 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: UserfilesApi#userfiles_delete_files_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @resource_file = ResourceFile.find(params[:id])\n @resource_file.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_files_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 destroy\n @ftpfile.destroy\n respond_to do |format|\n format.html { redirect_to ftpfiles_url, notice: 'Ftpfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def rm(path)\n run_via \"rm #{path}\"\n end", "def run_destroy\n run(\n result:\n ::Kitchen::Terraform::Client::Command\n .destroy(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .enable_lock\n .lock_timeout(duration: config_lock_timeout)\n .disable_input\n .maybe_no_color(toggle: !config_color)\n .parallelism(concurrent_operations: config_parallelism)\n .enable_refresh\n .state(path: config_state)\n .state_out(path: config_state)\n .vars(keys_and_values: config_variables)\n .var_files(paths: config_variable_files)\n .force,\n working_directory: instance_directory\n )\n )\n end", "def delete_repository_file(project_id, options = {})\n delete \"/projects/#{project_id}/repository/files\", options\n end", "def delete(path, options = {}, raw = false)\n request(:delete, path, options, raw)\n end", "def destroy_remote(options = {}, &block)\n raise MotionModelResource::URLNotDefinedError.new \"URL is not defined for #{self.class.name}!\" unless self.class.respond_to?(:url)\n \n model = self\n\n BW::HTTP.delete(save_url, {payload: options[:params]}) do |response|\n if response.ok? || options[:force] == true\n model.delete\n end\n\n block.call if block.present? && block.respond_to?(:call)\n end\n end", "def file_delete(file)\n\t\tputs \"Delete the local host repository entries from file: #{file}\"\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\thosts=file_2_list(file)\n\t\tchanges=bulk_delete(hosts)\n\t\tputs \"Delete done.\"\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def destroy\n @nthfile.destroy\n respond_to do |format|\n format.html { redirect_to nthfiles_url, notice: 'Nthfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_sftp_files\n log \"Deleting related sftp files\"\n return false if detail_report_filename.blank? || ftp_password.blank?\n all_files = nsc.interpolate_file_names_from_detail_file_path(detail_report_filename)\n nsc.delete_retrieved_files!(all_files)\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def delete(path, options={}, raw=false)\n request(:delete, path, options, raw)\n end", "def delete!\n response = @connection.csreq(\"DELETE\",@connection.svrmgmthost,\"#{@connection.svrmgmtpath}/images/#{URI.escape(self.id.to_s)}\",@connection.svrmgmtport,@connection.svrmgmtscheme)\n CloudServers::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end" ]
[ "0.7648883", "0.6528032", "0.6501078", "0.63450044", "0.63450044", "0.62438625", "0.6195591", "0.6190072", "0.6120277", "0.6110655", "0.6108295", "0.6097406", "0.60720545", "0.60720545", "0.5911697", "0.590147", "0.5888189", "0.57554114", "0.5752706", "0.56581146", "0.56448305", "0.56106335", "0.5589136", "0.5588685", "0.55633545", "0.55596066", "0.5540689", "0.5536845", "0.5515436", "0.55129504", "0.5486904", "0.5476146", "0.54638064", "0.5446705", "0.54353046", "0.54273117", "0.53898394", "0.5380038", "0.5331812", "0.5324603", "0.5322974", "0.532049", "0.53173774", "0.531575", "0.53067803", "0.52909255", "0.5290553", "0.5289149", "0.5280255", "0.52755606", "0.5269642", "0.5269441", "0.52588063", "0.5254154", "0.5253342", "0.5252995", "0.52458686", "0.5245012", "0.5245012", "0.52310646", "0.5219982", "0.5218703", "0.52166766", "0.51922464", "0.5191034", "0.51895684", "0.5187199", "0.518152", "0.51802", "0.5176855", "0.5174654", "0.51730615", "0.51649237", "0.5156273", "0.5149791", "0.5147506", "0.51468074", "0.5145719", "0.5144444", "0.51414216", "0.51315695", "0.51303744", "0.5128409", "0.5126299", "0.51163864", "0.5113197", "0.50928545", "0.5091743", "0.5087433", "0.50789165", "0.5073682", "0.5072051", "0.5071579", "0.5066657", "0.50584084", "0.50522274", "0.50450134", "0.5043311", "0.5043016", "0.50390786" ]
0.7520168
1
copy a local directory to a remote directory, if dryRun is false N Without this, we won't have an easy way to copy a local directory to a directory in the remote system, echoing the command used to copy the directory, and optionally only doing a dry run
def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun) #N Without this, the copy command won't be run at all sshAndScp.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy directory #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the files will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the files won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath, :recursive => true)\n end\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the directory\n executeCommand(\"#{@scpCommandString} -r #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the file\n executeCommand(\"#{@scpCommandString} #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy file #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the file will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the file won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath)\n end\n end", "def copy_dir(src, dest)\n output = `rsync -r --exclude='.svn' --exclude='.git' --exclude='.gitignore' --filter=':- .gitignore' 2>&1 #{Shellwords.escape(src.to_s)}/ #{Shellwords.escape(dest.to_s)}`\n [output, $?]\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n if File.directory?(s)\r\n fu_copy_dir s, d, '.', options[:preserve]\r\n else\r\n fu_p_copy s, d, options[:preserve]\r\n end\r\n end\r\n end", "def remote_copy(from, to, sudo: false, owner: nil, group: nil)\n extra_opts = {}\n extra_opts[:sudo] = sudo if sudo\n extra_opts[:owner] = owner if owner\n extra_opts[:group] = group if group\n @calls << [:remote_copy, from, to] + (extra_opts.empty? ? [] : [extra_opts])\n @remote_copy_code&.call(@stdout_io, @stderr_io, self)\n end", "def cp_dir(src, dst)\n puts \"#{cmd_color('copying')} #{dir_color(src)}\"\n puts \" -> #{dir_color(dst)}\"\n Find.find(src) do |fn|\n next if fn =~ /\\/\\./\n r = fn[src.size..-1]\n if File.directory? fn\n mkdir File.join(dst,r) unless File.exist? File.join(dst,r)\n else\n cp(fn, File.join(dst,r))\n end\n end\nend", "def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend", "def rcp(opts)\n dest = opts[:d].name\n source = opts[:sp]\n dest_path = opts[:dp]\n\n # Grab a remote path for temp transfer\n tmpdest = tmppath\n\n # Do the copy and print out results for debugging\n cmd = \"scp -r '#{source}' #{dest}:#{tmpdest}\"\n output << bold(color(\"localhost$\", :green)) << \" #{cmd}\\n\"\n ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]\n ssh.scp.upload! source.to_s, tmpdest.to_s, :recursive => true\n\n # Now we move the file into their final destination\n result = shell(:n => opts[:d], :c => \"mv #{tmpdest} #{dest_path}\")\n result[:exit_code] == 0\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def rel_copy(full_src, rel_dest, opts={})\n \n dest_path = File.dirname(rel_dest)\n \n fname = Pathname.new(full_src).basename\n \n if !File.directory?(dest_path)\n cmd = \"mkdir -p #{dest_path}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end \n end\n \n cmd = \"cp #{full_src} #{dest_path}/#{fname}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end\n\nend", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def doCopyOperations(sourceContent, destinationContent, dryRun)\n #N Without this loop, we won't copy the directories that are marked for copying\n for dir in sourceContent.dirs\n #N Without this check, we would attempt to copy those directories _not_ marked for copying (but which might still have sub-directories marked for copying)\n if dir.copyDestination != nil\n #N Without this, we won't know what is the full path of the local source directory to be copied\n sourcePath = sourceLocation.getFullPath(dir.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(dir.copyDestination.relativePath)\n #N Without this, the source directory won't actually get copied\n destinationLocation.contentHost.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n else\n #N Without this, we wouldn't copy sub-directories marked for copying of this sub-directory (which is not marked for copying in full)\n doCopyOperations(dir, destinationContent.getDir(dir.name), dryRun)\n end\n end\n #N Without this loop, we won't copy the files that are marked for copying\n for file in sourceContent.files\n #N Without this check, we would attempt to copy those files _not_ marked for copying\n if file.copyDestination != nil\n #N Without this, we won't know what is the full path of the local file to be copied\n sourcePath = sourceLocation.getFullPath(file.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(file.copyDestination.relativePath)\n #N Without this, the file won't actually get copied\n destinationLocation.contentHost.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end\n end\n end", "def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil,\n dereference_root: true, remove_destination: nil)\n fu_output_message \"cp -r#{preserve ? 'p' : ''}#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_entry s, d, preserve, dereference_root, remove_destination\n end\n end", "def rsync(local_folder, remote_destination, delete)\n @log.info(\"rsyncing folder '#{local_folder}' to '#{remote_destination}'...\")\n @process_runner.execute!(\"rsync --filter='P *.css' --filter='P apidocs' --filter='P cdn' --filter='P get-started' --partial --archive --checksum --compress --omit-dir-times --quiet#{' --delete' if delete} --chmod=Dg+sx,ug+rw,Do+rx,o+r --protocol=28 --exclude='.snapshot' #{local_folder}/ #{remote_destination}\")\n end", "def git_clone(remote, dest)\n Dir.chdir(__dir__) do\n system \"git clone #{remote} #{dest}\"\n end\nend", "def copy(src, dst)\n\t\t# TODO: make cp able to handle strings, where it will create an entry based\n\t\t# on the box it's run from.\n\t\t\n\t\tif !(src.kind_of?(Rush::Entry) && dst.kind_of?(Rush::Entry))\n\t\t\traise ArgumentError, \"must operate on Rush::Dir or Rush::File objects\"\n\t\tend\n\t\t\n\t\t# 5 cases:\n\t\t# 1. local-local\n\t\t# 2. local-remote (uploading)\n\t\t# 3. remote-local (downloading)\n\t\t# 4. remote-remote, same server\n\t\t# 5. remote-remote, cross-server\n\t\tif src.box == dst.box # case 1 or 4\n\t\t\tif src.box.remote? # case 4\n\t\t\t\tsrc.box.ssh.exec!(\"cp -r #{src.full_path} #{dst.full_path}\") do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # case 1\n\t\t\t\tFileUtils.cp_r(src.full_path, dst.full_path)\n\t\t\tend\n\t\telse # case 2, 3, or 5\n\t\t\tif src.local? && !dst.local? # case 2\n\t\t\t\t# We use the connection on the remote machine to do the upload\n\t\t\t\tdst.box.ssh.scp.upload!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telsif !src.local? && dst.local? # case 3\n\t\t\t\t# We use the connection on the remote machine to do the download\n\t\t\t\tsrc.box.ssh.scp.download!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telse # src and dst not local, case 5\n\t\t\t\tremote_command = \"scp #{src.full_path} #{dst.box.user}@#{dst.box.host}:#{dst.full_path}\"\n\t\t\t\t# doesn't matter whose connection we use\n\t\t\t\tsrc.box.ssh.exec!(remote_command) do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# TODO: use tar for cross-server transfers.\n\t\t# something like this?:\n\t\t# archive = from.box.read_archive(src)\n\t\t# dst.box.write_archive(archive, dst)\n\n\t\tnew_full_path = dst.dir? ? \"#{dst.full_path}#{src.name}\" : dst.full_path\n\t\tsrc.class.new(new_full_path, dst.box)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(to)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, from\n\tend", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend", "def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end", "def exec(src, dest, options={})\n @failures.synchronize do\n @failures.clear\n end\n rsync_cmd = command(src, dest, options)\n if options[:chdir]\n rsync_cmd = \"cd '#{options[:chdir]}'; #{rsync_cmd}\"\n end\n @logger.debug rsync_cmd if @logger\n ok = system(rsync_cmd)\n unless ok\n @failures.synchronize do\n @failures << {:source => src, :dest => dest, :options => options.dup}\n end\n end\n end", "def safe_cp(from, to, owner, group, cwd = '', include_paths = [], exclude_paths = [])\n credentials = ''\n credentials += \"-o #{owner} \" if owner\n credentials += \"-g #{group} \" if group\n excludes = find_command_excludes(from, cwd, exclude_paths).join(' ')\n\n copy_files = proc do |from_, cwd_, path_ = ''|\n cwd_ = File.expand_path(File.join('/', cwd_))\n \"if [[ -d #{File.join(from_, cwd_, path_)} ]]; then \" \\\n \"#{dimg.project.find_path} #{File.join(from_, cwd_, path_)} #{excludes} -type f -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -D #{credentials} {} \" \\\n \"#{File.join(to, '$(echo {} | ' \\\n \"#{dimg.project.sed_path} -e \\\"s/#{File.join(from_, cwd_).gsub('/', '\\\\/')}//g\\\")\")}' \\\\; ;\" \\\n 'fi'\n end\n\n commands = []\n commands << [dimg.project.install_path, credentials, '-d', to].join(' ')\n commands.concat(include_paths.empty? ? Array(copy_files.call(from, cwd)) : include_paths.map { |path| copy_files.call(from, cwd, path) })\n commands << \"#{dimg.project.find_path} #{to} -type d -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -d #{credentials} {}' \\\\;\"\n commands.join(' && ')\n end", "def rsync(source, target, exclude = [], options = [], verbose = false)\n excludes = exclude.map {|e| \"--exclude=#{e} \"}\n host = source.split(/\\//)[2]\n port = 873\n\n # Make the target directory if it's not there.\n FileUtils.mkdir(target) if !File.directory?(target)\n\n begin\n raise Exception, \"Unable to connect to remote host #{source}\" unless port_open?(host, port)\n\n log(\"rsync #{options} #{excludes} #{source} #{target}\")\n\n if verbose\n puts \"RUNNING: rsync #{options} #{excludes} #{source} #{target}\"\n system \"rsync #{options} #{excludes} #{source} #{target}\"\n else\n `rsync #{options} #{excludes} #{source} #{target}`\n end\n\n rescue Errno::EACCES, Errno::ENOENT, Errno::ENOTEMPTY, Exception => e\n log(e.to_s)\n end\nend", "def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end", "def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end", "def cp(src, dest)\n unless dest.dirname.exist?\n LOG.info \"MKDIR: #{dest.dirname}\"\n FileUtils.mkdir_p(dest.dirname)\n end\n\n LOG.info \"COPY: #{src} #{dest}\"\n FileUtils.cp_r(src, dest)\n end", "def copy_dir(origin_path, dest_path)\n \n p origin_path if $DEBUG\n\n real_dir = get_non_linked_dir_path_for_path(origin_path)\n \n unless File.exist?(dest_path) and File.directory?(dest_path) then\n \n Dir.mkdir(dest_path)\n \n end\n \n Dir.foreach(real_dir) do |f|\n \n next if f == \".\" or f == \"..\"\n \n full_path= File.join(real_dir, f)\n \n #check if this is a hard link to a directory\n if File.exist?(full_path) and (not File.directory?(full_path)) and File.stat(full_path).nlink > @min_link_count then\n full_path = get_non_linked_dir_path_for_path(full_path)\n end\n \n if File.directory?(full_path) then\n copy_dir(full_path, File.join(dest_path, f))\n else\n \n if File.exist?(full_path) and not File.symlink?(full_path) then\n \n FileUtils.cp(full_path, dest_path)\n \n end\n \n end\n \n end\n \n nil\n \n end", "def cp(src, dest, preserve: nil, noop: nil, verbose: nil)\n fu_output_message \"cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_file s, d, preserve\n end\n end", "def cp(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(cp -a -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end", "def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def copy_to!(dest)\n Pow(dest).parent.create_directory\n copy_to(dest)\n end", "def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end", "def update_copied_remote_file(file, copy)\n # the remote has a file that has been copied or moved from copy[file] to file.\n # file is also destination.\n src = copy[file]\n \n # If the user doen't even have the source, then we apparently renamed a directory.\n if !(working_changeset.include?(file2))\n directory nil, file, src, remote.flags(file)\n elsif remote.include? file2\n # If the remote also has the source, then it was copied, not moved\n merge src, file, file, flag_merge(src, file, src), false\n else\n # If the source is gone, it was moved. Hence that little \"true\" at the end there.\n merge src, file, file, flag_merge(src, file, src), true\n end\n end", "def copy_file_if_missing(src, dest, opt={})\n unless File.exists? dest\n touch_directory File.dirname(dest), opt\n FileUtils.cp src, dest\n STDOUT.write \"Created #{dest.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n end", "def rsync_to_temp\n\t\tputs \"\\n=> copying to temp dir.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_src, @@dir_temp)\n\tend", "def cp_r(source, dest)\n FileUtils.cp_r(source, dest)\n puts \" ✔ cp -R #{source} #{dest}\".colorize(:blue).bold\n end", "def cp_lr(src, dest, noop: nil, verbose: nil,\n dereference_root: true, remove_destination: false)\n fu_output_message \"cp -lr#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n link_entry s, d, dereference_root, remove_destination\n end\n end", "def copy\n FileUtils.cp_r(@src, @dest)\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n fu_preserve_attr(options[:preserve], s, d) {\r\n copy_file s, d\r\n }\r\n end\r\n end", "def clone_file source, target, *opts\n cmd = ['cp']\n cmd << '-R' if opts.include? :recursive\n\n if RUBY_PLATFORM.include? 'darwin'\n sh *(cmd + ['-c', source, target]) do |ok|\n break if ok\n if Jekyll.env != 'production'\n $stderr.puts \"Cannot use file cloning, falling back to regular copying\"\n end\n sh *(cmd + [source, target])\n end\n else\n # macOS requires explicit clone argument for copy (see\n # above). Behavior on other platforms is uknown, except for Linux\n # where it occur automatically. Therefore, just doing copy should\n # be fine.\n sh *(cmd + [source, target])\n end\nend", "def rsyncd(remote_name, folder)\n namehost, remote_folder, _barefolder = split_url(remote_name)\n rpath = relative_path(folder)\n if File.expand_path(folder) == File.expand_path(dir.to_s)\n raise \"Cannot run rsyncd in the top level of a repository\"\n end \n string = \"rsync -av #{namehost}:#{remote_folder}/#{rpath}/ #{folder}/\"\n if changed_in_folder(folder).size > 0\n raise \"You have some uncommitted changes in the folder #{folder}. Please commit these changes before calling rsyncd\"\n end\n puts string\n system string\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n cmd = self.class.curr_host == host ? cmd : \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"#{cmd}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n op = try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev ? 'mv' : 'cp -r'\n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ?\n \"#{op} #{local_path.shellescape} #{dst_path.shellescape}\" :\n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def copy_folder(dir_source, dir_dest)\n ftp = Net::FTP.new(@host)\n begin\n ftp.login(@user, @password)\n ftp.passive = @passive\n puts \"FTP => logged in, start copying #{dir_source} to #{dir_dest}...\"\n\n # create a tmp folder locally\n tmp_folder = 'tmp/ftp_sync'\n unless File.exist?(tmp_folder)\n FileUtils.mkdir tmp_folder\n end\n Dir.chdir tmp_folder\n\n # download whole folder\n ftp.chdir File.dirname(dir_source)\n target = File.basename(dir_source)\n download_folder(target, ftp)\n\n # upload to dest\n ftp.chdir dir_dest\n upload_folder(target, ftp)\n\n # TODO: delete local tmp folder\n Dir.chdir '..'\n FileUtils.rm_rf tmp_folder\n\n puts 'FTP => Copy finished.'\n end\n end", "def cp_with_mkdir(src, dst, owner = nil, mode = nil)\n mkdir_if_necessary(File.dirname(dst))\n cp(src, dst, owner, mode)\n end", "def copy_command_for(source, destination)\n if windows?\n %Q{copy \"#{source}\" \"#{destination}\"}.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)\n else\n \"cp -r #{source} #{destination}\"\n end\n end", "def copy_command_for(source, destination)\n if windows?\n %Q{copy \"#{source}\" \"#{destination}\"}.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)\n else\n \"cp -r #{source} #{destination}\"\n end\n end", "def cp_r(dest)\n util.cp_r(path, dest)\n end", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, src\n\tend", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, src unless File.exist?(src)\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\tend", "def FileCopy(src, dst)\n success?(parse(cmd(with_args(src, dst))))\n end", "def scp(src, dest, *opts)\n run \"scp #{Array.wrap(src).join(' ')} #{dest}\", *opts\n end", "def rsync_command\n if @config[:rsync][:direction] == 'up'\n from = absolute_path(@config[:local_path])\n to = @config.ssh_user_and_host + ':' + @config[:remote_path]\n else\n from = @config.ssh_user_and_host + ':' + @config[:remote_path]\n to = absolute_path(@config[:local_path])\n end\n \"rsync #{rsync_command_options.join(' ')} '#{from}/' '#{to}'\"\n end", "def rsync_from(source, target, dest, port = 22, extra_flags = [])\n rsync = find_program_on_path('rsync')\n flags = \"-rHlv -O --no-perms --no-owner --no-group\"\n unless extra_flags.empty?\n flags << \" \" << extra_flags.join(\" \")\n end\n ex(\"#{rsync} -e '#{ssh_command(port)}' #{flags} #{target}:#{source} #{dest}\")\n end", "def preform_copy_directory\n @destination_directories.each do |destination|\n @sources.each do |source|\n write_mode = 'w'\n new_path = Pathname.new(destination.to_s).join(source.basename)\n # Check if the specified file is a directory\n if new_path.directory?\n return false if get_input(\"Destination path '\" + new_path.to_s + \"' is a directory. (S)kip the file or (C)ancel: \", ['s','c']) == 'c'\n next\n end\n # Copy the file\n return false unless copy_file(source, new_path)\n end\n end\n return true\n end", "def copy_file(src_file, dest_file)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(dest_file)) unless File.directory?(File.dirname(dest_file))\n FileUtils.cp(ROOT_DIR.join(src_file), dest_file)\n end\n end", "def copy(options)\n destination = copy_destination options\n to_path = join_paths @root_dir, destination\n to_path_exists = File.exist? to_path\n\n preserve_existing = false? options[:overwrite]\n\n copy_resource_to_path to_path, preserve_existing\n copy_pstore_to_path to_path, preserve_existing\n\n to_path_exists\n end", "def copy_contents\n cmd = rsync_cmd\n\n @log.debug \"Copying contents with: #{cmd}\"\n\n %x[#{cmd}]\n $?.success?\n end", "def cp(src, dst, owner = nil, mode = nil)\n FileUtils.cp_r(src, dst, :preserve => true, :verbose => verbose?)\n if owner && !File.symlink?(dst) \n chown(dst, owner) \n end\n if mode\n chmod(dst, mode)\n end\n end", "def rsync_to(source, target, dest, port = 22, extra_flags = [\"--ignore-existing\"])\n rsync = find_program_on_path('rsync')\n flags = \"-rHlv --no-perms --no-owner --no-group\"\n unless extra_flags.empty?\n flags << \" \" << extra_flags.join(\" \")\n end\n ex(\"#{rsync} -e '#{ssh_command(port)}' #{flags} #{source} #{target}:#{dest}\")\n end", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def rsync(origin, final)\n if !File.directory? final\n FileUtils.mkdir_p(final)\n end\n Helpers::log(\"rsync -avz pipeline@#{@ip}:#{origin} #{final}\")\n `rsync -avz pipeline@#{@ip}:#{origin} #{final}`\n end", "def get_rsync(options)\n 'rsync ./ ' + options[:full_path]\n end", "def unpack_to(dir)\n sh \"cp -R #{local_path} #{dir}\"\n end", "def copy(destination, file, folder = './downloads')\n FileUtils.mkdir_p(File.dirname(\"#{destination}/#{file}\"))\n FileUtils.cp_r(\"#{folder}/#{file}\", \"#{destination}/#{file}\")\n end", "def copy\n if args.dest.instance_of?(Pathname)\n n = args.dest.to_s.delete_prefix(project.write_path(:services).to_s).delete_prefix('/')\n w = project.write_path(:services).join(service.name)\n w.join(Pathname.new(n).split.first).mkpath\n @args = args.merge('dest' => w.join(n).to_s)\n end\n cmd = service.copy(args.src, args.dest)\n Cnfs.logger.info cmd.join(\"\\n\")\n result = command.run!(*cmd)\n raise Cnfs::Error, result.err if result.failure?\n\n # Signal.trap('INT') do\n # warn(\"\\n#{caller.join(\"\\n\")}: interrupted\")\n # # exit 1\n # end\n end", "def copy_dir(source, dest)\n files = Dir.glob(\"#{source}/**\")\n mkdir_p dest\n cp_r files, dest\n end", "def copy(dest_path, overwrite = false, depth = nil)\n NotImplemented\n end", "def copy(path, destination, options = {})\n opts = options.nil? ? {} : options.dup\n opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup\n opts[:headers]['Destination'] = destination\n execute('COPY', path, opts)\n end", "def copy_dir(src_dir, dest_dir = \"/\")\n # Copy all the files into the home directory\n source = Dir.glob(ROOT_DIR.join(name).join(\"*\").to_s)\n FileUtils.cp_r(source, @workdir_path.to_s)\n end", "def cp(path, dest)\n FileUtils.rm_rf(expand dest)\n if File.directory?(expand path)\n FileUtils.mkdir_p(expand dest)\n FileUtils.cp_r(expand(path), expand(dest))\n else\n FileUtils.mkdir_p(File.dirname(expand dest))\n FileUtils.cp(expand(path), expand(dest))\n end\n end", "def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend", "def cp_to(filename, mounted_dest) # Always returns the destination as an explicit location relative to the mount directory\n dest = File.join(@mount_dir, mounted_dest )#, File.basename(filename))\n FileUtils.mkdir_p(dest)\n FileUtils.cp( filename, dest, :preserve => true)\n File.join(dest, File.basename(filename))\n end", "def fetch\n log.info(log_key) { \"Copying from `#{source_path}'\" }\n\n create_required_directories\n FileSyncer.sync(source_path, project_dir, source_options)\n # Reset target shasum on every fetch\n @target_shasum = nil\n target_shasum\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def copy_site\n target_dir = File.join(@deploy_dir, @remote_path).sub(/\\/$/,'')\n FileUtils.cp_r @local + '/.', target_dir\n message = \"Site updated at: #{Time.now.utc}\"\n `git add --all .`\n `git commit -m \\\"#{message}\\\"`\n end", "def copyFileToTarget(file, srcDir, destDir) \n inFileName = \"#{srcDir}/#{file}\";\n outFileName = \"#{destDir}/#{file}\";\n puts \"copying: [#{inFileName}]\";\n puts \"\\tto: [#{outFileName}]\";\n system(\"cp #{inFileName} #{outFileName}\");\nend", "def copy(source_repo_id, destination_repo_id, optional = {})\n criteria = {:type_ids => [content_type], :filters => {}}\n criteria[:filters]['association'] = {'unit_id' => {'$in' => optional[:ids]}} if optional[:ids]\n criteria[:filters] = optional[:filters] if optional[:filters]\n criteria[:fields] = {:unit => optional[:fields]} if optional[:fields]\n\n payload = {:criteria => criteria}\n payload[:override_config] = optional[:override_config] if optional.key?(:override_config)\n\n if optional[:copy_children]\n payload[:override_config] ||= {}\n payload[:override_config][:recursive] = true\n end\n\n Runcible::Extensions::Repository.new(self.config).unit_copy(destination_repo_id, source_repo_id, payload)\n end", "def pull_dir(localpath, remotepath, options = {}, &block)\n connect! unless @connection\n @recursion_level += 1\n\n todelete = Dir.glob(File.join(localpath, '*'))\n \n tocopy = []\n recurse = []\n\n # To trigger error if path doesnt exist since list will\n # just return and empty array\n @connection.chdir(remotepath)\n\n @connection.list(remotepath) do |e|\n entry = Net::FTP::List.parse(e)\n \n paths = [ File.join(localpath, entry.basename), \"#{remotepath}/#{entry.basename}\".gsub(/\\/+/, '/') ]\n\n if entry.dir?\n recurse << paths\n elsif entry.file?\n if options[:since] == :src\n tocopy << paths unless File.exist?(paths[0]) and entry.mtime < File.mtime(paths[0]) and entry.filesize == File.size(paths[0])\n elsif options[:since].is_a?(Time)\n tocopy << paths unless entry.mtime < options[:since] and File.exist?(paths[0]) and entry.filesize == File.size(paths[0])\n else\n tocopy << paths\n end\n end\n todelete.delete paths[0]\n end\n \n tocopy.each do |paths|\n localfile, remotefile = paths\n unless should_ignore?(localfile)\n begin\n @connection.get(remotefile, localfile)\n log \"Pulled file #{remotefile}\"\n rescue Net::FTPPermError\n log \"ERROR READING #{remotefile}\"\n raise Net::FTPPermError unless options[:skip_errors]\n end\n end\n end\n \n recurse.each do |paths|\n localdir, remotedir = paths\n Dir.mkdir(localdir) unless File.exist?(localdir)\n pull_dir(localdir, remotedir, options, &block)\n end\n \n if options[:delete]\n todelete.each do |p|\n block_given? ? yield(p) : FileUtils.rm_rf(p)\n log \"Removed path #{p}\"\n end\n end\n \n @recursion_level -= 1\n close! if @recursion_level == 0\n rescue Net::FTPPermError\n close!\n raise Net::FTPPermError\n end", "def action_sync\n assert_target_directory_valid!\n if ::File.exist?(::File.join(@new_resource.destination, 'CVS'))\n Chef::Log.debug \"#{@new_resource} update\"\n converge_by(\"sync #{@new_resource.destination} from #{@new_resource.repository}\") do\n run_command(run_options(:command => sync_command))\n Chef::Log.info \"#{@new_resource} updated\"\n end\n else\n action_checkout\n end\n end", "def cp_single_file_or_directory(options={})\n from = options[:from]\n from_path = expand_path(from)\n to = options[:to]\n if to.to_s =~ %r{(.*)/$}\n to = $1\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n end\n case\n when File.directory?(from_path)\n if to && to != '-'\n if File.exists?(to)\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n creating_to_directory = false\n else\n creating_to_directory = true\n end\n end\n if options[:recursive]\n Dir.glob(\"#{from_path}/**/*\") do |from_item|\n suffix = File.relative_path(from_item, :relative_to=>from_path)\n suffix = File.join(from, suffix) unless creating_to_directory\n target_dir = File.dirname(File.join(to, suffix))\n FileUtils.mkdir_p(target_dir)\n if File.directory?(from_item)\n new_directory = File.join(target_dir,File.basename(from_item))\n if File.exists?(new_directory)\n raise CopyToNonDirectory \"Can't copy directory #{from_item } to non-directory #{new_directory}\" \\\n unless File.directory?(new_directory)\n else\n FileUtils.mkdir(new_directory)\n end\n else\n cp_single_file(options.merge(:from=>from_item, :to=>target_dir + '/'))\n end\n end\n else\n if options[:tolerant]\n STDERR.puts \"cp: Skipping directory #{from}\" unless options[:quiet]\n else\n raise CopyDirectoryNonRecursive, \"Can't non-recursively copy directory #{from}\"\n end\n end\n when File.exists?(from_path)\n cp_single_file(options.merge(:from=>from_path))\n else\n raise CopyMissingFromFile, \"#{from} does not exist\"\n end\n end", "def cp_r(src,dst)\n src_root = Pathname.new(src)\n FileUtils.mkdir_p(dst, :verbose => VERBOSE) unless File.exists? dst\n Dir[\"#{src}/**/**\"].each do |abs_path|\n src_path = Pathname.new(abs_path)\n rel_path = src_path.relative_path_from(src_root)\n dst_path = \"#{dst}/#{rel_path.to_s}\"\n \n next if abs_path.include? '.svn'\n \n if src_path.directory?\n FileUtils.mkdir_p(dst_path, :verbose => VERBOSE)\n elsif src_path.file?\n FileUtils.cp(abs_path, dst_path, :verbose => VERBOSE)\n end\n end\nend", "def copy(source, destination, **options); end", "def cp srcpath, dstpath\n end", "def copy_files\n file_candidates.each do |remote_file|\n local_file = File.basename(remote_file)\n if File.exist?(local_file)\n if same_file?(local_file, remote_file)\n info \"\\n>> '#{local_file}' has the same contents here as in the repo. Leaving it alone.\"\n else\n if config['answer_yes']\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo.\"\n info \"Copying #{remote_file} to #{local_file}... (answer_yes is true)\"\n copy_file(remote_file, local_file)\n else\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo (see below)\"\n git_diff(local_file, remote_file)\n prompt \"\\nDo you want to overwrite #{local_file} with the version from the repo? [y/N]: \"\n\n answer = $stdin.gets.chomp\n case answer\n when ''\n error 'Moving on.' # Default behavior.\n when /y/i\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n when /n/i\n error 'Moving on.'\n else\n error 'Unknown selection. Moving on.'\n end\n end\n\n end\n else\n info \"\\n>> '#{local_file}' does not exist locally.\"\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n end\n end\n end", "def cp(srcpath,dstpath)\n FileUtils.cp_r(srcpath,dstpath)\n end", "def rsyncu(remote_name, folder)\n namehost, remote_folder, _barefolder = split_url(remote_name)\n rpath = relative_path(folder)\n if File.expand_path(folder) == File.expand_path(dir.to_s)\n raise \"Cannot run rsyncd in the top level of a repository\"\n end \n string = \"rsync -av #{folder}/ #{namehost}:#{remote_folder}/#{rpath}/\"\n\n cif = `ssh #{namehost} \"cd #{remote_folder}/#{rpath} && echo \"START\" && git status\"`\n if cif =~ /START.*modified/m\n raise \"You have some uncommitted changes in the remote folder #{rpath}. Please commit these changes before calling rsyncu\"\n end\n puts string\n system string\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n recreate_dirs_cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n\n # recreate dirs anyway if local op\n if try_move && self.class.curr_host == host\n r = `#{recreate_dirs_cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n # if we can make mv command\n if try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev\n r = `mv #{local_path.shellescape} #{dst_path.shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n else\n local_path += '/' if File.stat(local_path).directory?\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"#{recreate_dirs_cmd} && ionice -c 2 -n 7 rsync\\\" #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n end", "def copy(dest, overwrite=false)\n @resource.copy(dest, overwrite)\n end", "def copy_unpacked!(metadata, vmcatcher_configuration)\n Itchy::Log.info \"[#{self.class.name}] Copying image \" \\\n \"for #{metadata.dc_identifier.inspect}\"\n unpacking_dir = prepare_image_temp_dir(metadata, vmcatcher_configuration).flatten.first\n begin\n ::FileUtils.cp(\n orig_image_file(metadata, vmcatcher_configuration),\n unpacking_dir\n )\n rescue SystemCallError => ex\n Itchy::Log.fatal \"[#{self.class.name}] Failed to create a copy \" \\\n \"for #{metadata.dc_identifier.inspect}: \" \\\n \"#{ex.message}\"\n fail Itchy::Errors::PrepareEnvError, ex\n end\n\n unpacking_dir\n end", "def transfer!\n write_password_file! unless local\n\n remote_path = remote_path_for(@package)\n\n create_remote_path!(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n if local\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ remote_path }'.\"\n run(\n \"#{ utility(:rsync) } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ File.join(remote_path, remote_file) }'\"\n )\n else\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ ip }'.\"\n run(\n \"#{ utility(:rsync) } #{ rsync_options } #{ rsync_port } \" +\n \"#{ rsync_password_file } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ username }@#{ ip }:#{ File.join(remote_path, remote_file) }'\"\n )\n end\n end\n\n ensure\n remove_password_file! unless local\n end", "def copy from, to\n add \"cp #{from} #{to}\", check_file(to)\n end", "def rsync_to_usb\n\t\tputs \"\\n=> copying to usb.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_temp, @@dir_dest)\n\tend", "def copy_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end", "def clone_to_local\n out = Temppath.create.open(\"w+\")\n\n # call git clone\n process = ChildProcess.build(\"git\", \"clone\", @address, local.path.to_s)\n process.io.stdout = out\n process.start\n process.wait\n\n # check the process result\n if process.crashed?\n raise GitError.new(self, message: \"'git clone' failed\")\n end\n\n # show debug message\n out.rewind\n Log::Debug.system(\"git clone: %s\" % out.read)\n end", "def clone\n # We do the clone against the target repo using the `--reference` flag so\n # that doing a normal `git pull` on a directory will work.\n git \"clone --reference #{@cache.path} #{@remote} #{@full_path}\"\n git \"remote add cache #{@cache.path}\", :path => @full_path\n end" ]
[ "0.7924269", "0.7891084", "0.7789641", "0.75127715", "0.7503792", "0.6595715", "0.65707874", "0.65075445", "0.6326693", "0.63083494", "0.62250787", "0.6197228", "0.6197228", "0.61680806", "0.6136275", "0.6134887", "0.6109418", "0.6078698", "0.60196143", "0.6013813", "0.6005577", "0.59800065", "0.5977155", "0.59453875", "0.59062713", "0.58911085", "0.58614635", "0.58614635", "0.5860961", "0.5840825", "0.58232784", "0.582009", "0.5817599", "0.5798103", "0.5798103", "0.5787343", "0.5783057", "0.5751529", "0.57374716", "0.5729412", "0.57220775", "0.5719563", "0.5711902", "0.5685084", "0.5628968", "0.5604723", "0.56037194", "0.56013185", "0.5591846", "0.556584", "0.556584", "0.55602837", "0.55552924", "0.5554689", "0.55512834", "0.5549549", "0.55454195", "0.55346054", "0.5532945", "0.5531921", "0.55016255", "0.5495516", "0.54949784", "0.5493776", "0.548705", "0.5484001", "0.54711217", "0.54687643", "0.54660654", "0.5464855", "0.545053", "0.5432935", "0.5429453", "0.54248995", "0.5424205", "0.54199165", "0.5418993", "0.54051965", "0.5403791", "0.54033387", "0.53966165", "0.5389514", "0.5382457", "0.5369817", "0.5363279", "0.5354962", "0.5346522", "0.5327074", "0.53236496", "0.5308978", "0.5302544", "0.5298531", "0.5291821", "0.5288325", "0.5282816", "0.5269906", "0.5267707", "0.5266641", "0.5265483", "0.5240183" ]
0.7968297
0
copy a local file to a remote directory, if dryRun is false N Without this, we won't have an easy way to copy a local file to a directory in the remote system, echoing the command used to copy the file, and optionally only doing a dry run
def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun) #N Without this, the copy command won't be run at all sshAndScp.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy file #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the file will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the file won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath)\n end\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the file\n executeCommand(\"#{@scpCommandString} #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy directory #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the files will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the files won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath, :recursive => true)\n end\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the directory\n executeCommand(\"#{@scpCommandString} -r #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def update_copied_remote_file(file, copy)\n # the remote has a file that has been copied or moved from copy[file] to file.\n # file is also destination.\n src = copy[file]\n \n # If the user doen't even have the source, then we apparently renamed a directory.\n if !(working_changeset.include?(file2))\n directory nil, file, src, remote.flags(file)\n elsif remote.include? file2\n # If the remote also has the source, then it was copied, not moved\n merge src, file, file, flag_merge(src, file, src), false\n else\n # If the source is gone, it was moved. Hence that little \"true\" at the end there.\n merge src, file, file, flag_merge(src, file, src), true\n end\n end", "def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end", "def remote_copy(from, to, sudo: false, owner: nil, group: nil)\n extra_opts = {}\n extra_opts[:sudo] = sudo if sudo\n extra_opts[:owner] = owner if owner\n extra_opts[:group] = group if group\n @calls << [:remote_copy, from, to] + (extra_opts.empty? ? [] : [extra_opts])\n @remote_copy_code&.call(@stdout_io, @stderr_io, self)\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def rcp(opts)\n dest = opts[:d].name\n source = opts[:sp]\n dest_path = opts[:dp]\n\n # Grab a remote path for temp transfer\n tmpdest = tmppath\n\n # Do the copy and print out results for debugging\n cmd = \"scp -r '#{source}' #{dest}:#{tmpdest}\"\n output << bold(color(\"localhost$\", :green)) << \" #{cmd}\\n\"\n ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]\n ssh.scp.upload! source.to_s, tmpdest.to_s, :recursive => true\n\n # Now we move the file into their final destination\n result = shell(:n => opts[:d], :c => \"mv #{tmpdest} #{dest_path}\")\n result[:exit_code] == 0\n end", "def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end", "def copy_file_if_missing(src, dest, opt={})\n unless File.exists? dest\n touch_directory File.dirname(dest), opt\n FileUtils.cp src, dest\n STDOUT.write \"Created #{dest.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n end", "def FileCopy(src, dst)\n success?(parse(cmd(with_args(src, dst))))\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n if File.directory?(s)\r\n fu_copy_dir s, d, '.', options[:preserve]\r\n else\r\n fu_p_copy s, d, options[:preserve]\r\n end\r\n end\r\n end", "def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend", "def clone_file source, target, *opts\n cmd = ['cp']\n cmd << '-R' if opts.include? :recursive\n\n if RUBY_PLATFORM.include? 'darwin'\n sh *(cmd + ['-c', source, target]) do |ok|\n break if ok\n if Jekyll.env != 'production'\n $stderr.puts \"Cannot use file cloning, falling back to regular copying\"\n end\n sh *(cmd + [source, target])\n end\n else\n # macOS requires explicit clone argument for copy (see\n # above). Behavior on other platforms is uknown, except for Linux\n # where it occur automatically. Therefore, just doing copy should\n # be fine.\n sh *(cmd + [source, target])\n end\nend", "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n cmd = self.class.curr_host == host ? cmd : \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"#{cmd}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n op = try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev ? 'mv' : 'cp -r'\n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ?\n \"#{op} #{local_path.shellescape} #{dst_path.shellescape}\" :\n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def rel_copy(full_src, rel_dest, opts={})\n \n dest_path = File.dirname(rel_dest)\n \n fname = Pathname.new(full_src).basename\n \n if !File.directory?(dest_path)\n cmd = \"mkdir -p #{dest_path}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end \n end\n \n cmd = \"cp #{full_src} #{dest_path}/#{fname}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end\n\nend", "def copy_file(src_file, dest_file)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(dest_file)) unless File.directory?(File.dirname(dest_file))\n FileUtils.cp(ROOT_DIR.join(src_file), dest_file)\n end\n end", "def cp(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(cp -a -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end", "def update_remote_file(file, node, copy, copied_files)\n return if should_filter?(file) ||\n local_manifest[file] ||\n copied_files[file]\n \n if copy[file]\n # If it's been copied, then we might need to do some work.\n update_copied_remote_file file, copy\n elsif ancestor.include? file\n # If the ancestor has the file, and the target has the file, and we don't,\n # then we'll probably have to do some merging to fix that up.\n update_remotely_modified_file file, node\n else\n # Just get the god damned file\n get file, remote.flags(file)\n end\n end", "def copyFileToTarget(file, srcDir, destDir) \n inFileName = \"#{srcDir}/#{file}\";\n outFileName = \"#{destDir}/#{file}\";\n puts \"copying: [#{inFileName}]\";\n puts \"\\tto: [#{outFileName}]\";\n system(\"cp #{inFileName} #{outFileName}\");\nend", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n \n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ? \n \"cp -r #{src_path.shellescape} #{local_path.shellescape}\" : \n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end", "def copy_from_remote(remote_file, local_path)\n\t\tbegin\n\t\t\t@@logger.info { \"Copying file from #{remote_file} to #{local_path}\" }\n\t\t\t@ssh_session.scp.download!(remote_file, local_path)\n\t\t\treturn true\n\t\trescue => err\n\t\t\t@@logger.error { \"SCP failed: #{err.message}\" }\n\t\t\t@@logger.error { \"\\t #{err.backtrace}\" }\n\t\tend\n\tend", "def cp(src, dest, preserve: nil, noop: nil, verbose: nil)\n fu_output_message \"cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_file s, d, preserve\n end\n end", "def exec(src, dest, options={})\n @failures.synchronize do\n @failures.clear\n end\n rsync_cmd = command(src, dest, options)\n if options[:chdir]\n rsync_cmd = \"cd '#{options[:chdir]}'; #{rsync_cmd}\"\n end\n @logger.debug rsync_cmd if @logger\n ok = system(rsync_cmd)\n unless ok\n @failures.synchronize do\n @failures << {:source => src, :dest => dest, :options => options.dup}\n end\n end\n end", "def cp(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n fu_preserve_attr(options[:preserve], s, d) {\r\n copy_file s, d\r\n }\r\n end\r\n end", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend", "def pull_file(user, host, copy_path, place_path, sudo = false)\n ping(user, host) do\n begin\n my_text = IO.popen(\"ssh #{user}@#{host} 'cat \\\"#{copy_path}\\\"'\")\n my_text.write(\"sudo bash -c 'cat #{copy_path}'\\n\") if sudo\n file_saved = save_local(place_path, my_text)\n my_text.close\n return file_saved\n rescue\n \"No such file.\"\n end\n end\n end", "def cp!( from_file, to_file, opts = {} )\r\n args = { :source => from_file, :destination => to_file }\r\n args[:source_address] = opts[:source_address] if opts[:source_address]\r\n \r\n begin\r\n got = @ndev.rpc.file_copy( args )\r\n rescue => e\r\n raise IOError, e.rsp.xpath('rpc-error/error-message').text.strip\r\n else\r\n return true\r\n end\r\n end", "def copy_files\n file_candidates.each do |remote_file|\n local_file = File.basename(remote_file)\n if File.exist?(local_file)\n if same_file?(local_file, remote_file)\n info \"\\n>> '#{local_file}' has the same contents here as in the repo. Leaving it alone.\"\n else\n if config['answer_yes']\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo.\"\n info \"Copying #{remote_file} to #{local_file}... (answer_yes is true)\"\n copy_file(remote_file, local_file)\n else\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo (see below)\"\n git_diff(local_file, remote_file)\n prompt \"\\nDo you want to overwrite #{local_file} with the version from the repo? [y/N]: \"\n\n answer = $stdin.gets.chomp\n case answer\n when ''\n error 'Moving on.' # Default behavior.\n when /y/i\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n when /n/i\n error 'Moving on.'\n else\n error 'Unknown selection. Moving on.'\n end\n end\n\n end\n else\n info \"\\n>> '#{local_file}' does not exist locally.\"\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n end\n end\n end", "def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend", "def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil,\n dereference_root: true, remove_destination: nil)\n fu_output_message \"cp -r#{preserve ? 'p' : ''}#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_entry s, d, preserve, dereference_root, remove_destination\n end\n end", "def copy(src, dst)\n\t\t# TODO: make cp able to handle strings, where it will create an entry based\n\t\t# on the box it's run from.\n\t\t\n\t\tif !(src.kind_of?(Rush::Entry) && dst.kind_of?(Rush::Entry))\n\t\t\traise ArgumentError, \"must operate on Rush::Dir or Rush::File objects\"\n\t\tend\n\t\t\n\t\t# 5 cases:\n\t\t# 1. local-local\n\t\t# 2. local-remote (uploading)\n\t\t# 3. remote-local (downloading)\n\t\t# 4. remote-remote, same server\n\t\t# 5. remote-remote, cross-server\n\t\tif src.box == dst.box # case 1 or 4\n\t\t\tif src.box.remote? # case 4\n\t\t\t\tsrc.box.ssh.exec!(\"cp -r #{src.full_path} #{dst.full_path}\") do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # case 1\n\t\t\t\tFileUtils.cp_r(src.full_path, dst.full_path)\n\t\t\tend\n\t\telse # case 2, 3, or 5\n\t\t\tif src.local? && !dst.local? # case 2\n\t\t\t\t# We use the connection on the remote machine to do the upload\n\t\t\t\tdst.box.ssh.scp.upload!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telsif !src.local? && dst.local? # case 3\n\t\t\t\t# We use the connection on the remote machine to do the download\n\t\t\t\tsrc.box.ssh.scp.download!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telse # src and dst not local, case 5\n\t\t\t\tremote_command = \"scp #{src.full_path} #{dst.box.user}@#{dst.box.host}:#{dst.full_path}\"\n\t\t\t\t# doesn't matter whose connection we use\n\t\t\t\tsrc.box.ssh.exec!(remote_command) do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# TODO: use tar for cross-server transfers.\n\t\t# something like this?:\n\t\t# archive = from.box.read_archive(src)\n\t\t# dst.box.write_archive(archive, dst)\n\n\t\tnew_full_path = dst.dir? ? \"#{dst.full_path}#{src.name}\" : dst.full_path\n\t\tsrc.class.new(new_full_path, dst.box)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(to)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, from\n\tend", "def copy_file(path:, copy_destination:)\n BrickFTP::API::FileOperation::Copy.create(path: path, 'copy-destination': copy_destination)\n end", "def copy from, to\n add \"cp #{from} #{to}\", check_file(to)\n end", "def cp(from_location, to_location)\n @client.file_copy(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def copy_file(path:, copy_destination:)\n BrickFTP::API::FileOperation::Copy.create(path: path, :'copy-destination' => copy_destination)\n end", "def copy_file(filename,dst_dir='/',dst_repo=self.repo,src_repo=self.repo)\n post_copy(src_repo,{\"file_names\"=>filename, \"dst_repo\" => dst_repo, \"dst_dir\"=>dst_dir})\n end", "def copy\n FileUtils.cp_r(@src, @dest)\n end", "def local_copy_file(source, options = {})\n Uploadcare::File.local_copy(source, options)\n end", "def copy_file!(f, target)\n # directory?\n if File.directory?(f)\n if File.directory?(target)\n done = 'exists'.green\n else\n FileUtils.mkdir_p target\n done = 'created'.bold.green\n end\n else\n if newer?(f, target)\n target_dir = File.dirname(target)\n FileUtils.mkdir_p target_dir unless File.directory?(target_dir)\n FileUtils.copy f, target\n done = 'copied'.bold.green\n else\n done = 'keep'.white\n end\n end\n done\n end", "def cp_r(source, dest)\n FileUtils.cp_r(source, dest)\n puts \" ✔ cp -R #{source} #{dest}\".colorize(:blue).bold\n end", "def copy_contents\n cmd = rsync_cmd\n\n @log.debug \"Copying contents with: #{cmd}\"\n\n %x[#{cmd}]\n $?.success?\n end", "def cp( file )\n src = ::File.join(data, file)\n dst = ::File.join(site, file)\n test(?e, dst) ? updating(dst) : creating(dst)\n# FileUtils.cp(src, dst)\n if WINDOWS then win_line_endings(src, dst)\n else FileUtils.cp(src, dst) end\n end", "def copy(path, destination, options = {})\n opts = options.nil? ? {} : options.dup\n opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup\n opts[:headers]['Destination'] = destination\n execute('COPY', path, opts)\n end", "def copy_file_to_remote(host, file_path, file_content)\n block_on host do |host|\n Tempfile.open 'beaker' do |tempfile|\n File.open(tempfile.path, 'w') { |file| file.puts file_content }\n\n host.do_scp_to(tempfile.path, file_path, @options)\n end\n end\n end", "def scp(src, dest, *opts)\n run \"scp #{Array.wrap(src).join(' ')} #{dest}\", *opts\n end", "def copy_dir(src, dest)\n output = `rsync -r --exclude='.svn' --exclude='.git' --exclude='.gitignore' --filter=':- .gitignore' 2>&1 #{Shellwords.escape(src.to_s)}/ #{Shellwords.escape(dest.to_s)}`\n [output, $?]\n end", "def cp_to(filename, mounted_dest) # Always returns the destination as an explicit location relative to the mount directory\n dest = File.join(@mount_dir, mounted_dest )#, File.basename(filename))\n FileUtils.mkdir_p(dest)\n FileUtils.cp( filename, dest, :preserve => true)\n File.join(dest, File.basename(filename))\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n recreate_dirs_cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n\n # recreate dirs anyway if local op\n if try_move && self.class.curr_host == host\n r = `#{recreate_dirs_cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n # if we can make mv command\n if try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev\n r = `mv #{local_path.shellescape} #{dst_path.shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n else\n local_path += '/' if File.stat(local_path).directory?\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"#{recreate_dirs_cmd} && ionice -c 2 -n 7 rsync\\\" #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n end", "def transfer!\n write_password_file! unless local\n\n remote_path = remote_path_for(@package)\n\n create_remote_path!(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n if local\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ remote_path }'.\"\n run(\n \"#{ utility(:rsync) } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ File.join(remote_path, remote_file) }'\"\n )\n else\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ ip }'.\"\n run(\n \"#{ utility(:rsync) } #{ rsync_options } #{ rsync_port } \" +\n \"#{ rsync_password_file } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ username }@#{ ip }:#{ File.join(remote_path, remote_file) }'\"\n )\n end\n end\n\n ensure\n remove_password_file! unless local\n end", "def rsync_from(source, target, dest, port = 22, extra_flags = [])\n rsync = find_program_on_path('rsync')\n flags = \"-rHlv -O --no-perms --no-owner --no-group\"\n unless extra_flags.empty?\n flags << \" \" << extra_flags.join(\" \")\n end\n ex(\"#{rsync} -e '#{ssh_command(port)}' #{flags} #{target}:#{source} #{dest}\")\n end", "def rsync(source, target, exclude = [], options = [], verbose = false)\n excludes = exclude.map {|e| \"--exclude=#{e} \"}\n host = source.split(/\\//)[2]\n port = 873\n\n # Make the target directory if it's not there.\n FileUtils.mkdir(target) if !File.directory?(target)\n\n begin\n raise Exception, \"Unable to connect to remote host #{source}\" unless port_open?(host, port)\n\n log(\"rsync #{options} #{excludes} #{source} #{target}\")\n\n if verbose\n puts \"RUNNING: rsync #{options} #{excludes} #{source} #{target}\"\n system \"rsync #{options} #{excludes} #{source} #{target}\"\n else\n `rsync #{options} #{excludes} #{source} #{target}`\n end\n\n rescue Errno::EACCES, Errno::ENOENT, Errno::ENOTEMPTY, Exception => e\n log(e.to_s)\n end\nend", "def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end", "def safe_cp(from, to, owner, group, cwd = '', include_paths = [], exclude_paths = [])\n credentials = ''\n credentials += \"-o #{owner} \" if owner\n credentials += \"-g #{group} \" if group\n excludes = find_command_excludes(from, cwd, exclude_paths).join(' ')\n\n copy_files = proc do |from_, cwd_, path_ = ''|\n cwd_ = File.expand_path(File.join('/', cwd_))\n \"if [[ -d #{File.join(from_, cwd_, path_)} ]]; then \" \\\n \"#{dimg.project.find_path} #{File.join(from_, cwd_, path_)} #{excludes} -type f -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -D #{credentials} {} \" \\\n \"#{File.join(to, '$(echo {} | ' \\\n \"#{dimg.project.sed_path} -e \\\"s/#{File.join(from_, cwd_).gsub('/', '\\\\/')}//g\\\")\")}' \\\\; ;\" \\\n 'fi'\n end\n\n commands = []\n commands << [dimg.project.install_path, credentials, '-d', to].join(' ')\n commands.concat(include_paths.empty? ? Array(copy_files.call(from, cwd)) : include_paths.map { |path| copy_files.call(from, cwd, path) })\n commands << \"#{dimg.project.find_path} #{to} -type d -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -d #{credentials} {}' \\\\;\"\n commands.join(' && ')\n end", "def rsync_to(source, target, dest, port = 22, extra_flags = [\"--ignore-existing\"])\n rsync = find_program_on_path('rsync')\n flags = \"-rHlv --no-perms --no-owner --no-group\"\n unless extra_flags.empty?\n flags << \" \" << extra_flags.join(\" \")\n end\n ex(\"#{rsync} -e '#{ssh_command(port)}' #{flags} #{source} #{target}:#{dest}\")\n end", "def remote_file_resource\n Chef::Log.info \"Remote file: #{file_location}\"\n Chef::Log.info \"Local file: #{new_resource.name}\"\n @remote_file_resource ||= remote_file new_resource.name do\n source file_location\n checksum new_resource.checksum if !new_resource.checksum.nil?\n owner new_resource.owner\n group new_resource.group\n backup false\n action :nothing\n end\nend", "def safe_copy(original, target)\n if(fast_copies)\n FileUtils.copy(original, target)\n else\n # Call the copy as an external command. This is to work around the\n # crashes that occurred using the builtin copy\n from_file = File.expand_path(original)\n to_file = File.expand_path(target)\n system_success = system(\"cp '#{from_file}' '#{to_file}'\")\n raise(IOError, \"copy error '#{from_file}' '#{to_file}'\") unless system_success\n end\n end", "def copy\n if args.dest.instance_of?(Pathname)\n n = args.dest.to_s.delete_prefix(project.write_path(:services).to_s).delete_prefix('/')\n w = project.write_path(:services).join(service.name)\n w.join(Pathname.new(n).split.first).mkpath\n @args = args.merge('dest' => w.join(n).to_s)\n end\n cmd = service.copy(args.src, args.dest)\n Cnfs.logger.info cmd.join(\"\\n\")\n result = command.run!(*cmd)\n raise Cnfs::Error, result.err if result.failure?\n\n # Signal.trap('INT') do\n # warn(\"\\n#{caller.join(\"\\n\")}: interrupted\")\n # # exit 1\n # end\n end", "def upload_file local_source, remote_dest, options = {}\n add [local_source, remote_dest], check_file(remote_dest)\n chmod options[:perms], remote_dest if options[:perms]\n chown options[:owner], remote_dest if options[:owner]\n end", "def post_copy(src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/fileops/copy/\",data).body_str\n end", "def cp_r(dest)\n util.cp_r(path, dest)\n end", "def ftp_copy(ftp, local_file, remote_file)\n in_ftp_dir(ftp, File.dirname(remote_file)) do |_ftp|\n basename = File.basename(remote_file)\n _ftp.putbinaryfile(local_file, \"#{basename}.in_progress\")\n _ftp.rename(\"#{basename}.in_progress\", basename)\n end\n end", "def copy_file(source_file, dest_file, settings)\n\tFileUtils.cp_r(source_file, dest_file)\nend", "def copy_from_remote_file_copy_from_remote_file_with_http_info(file_name, copy_from_remote_file_properties, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.copy_from_remote_file_copy_from_remote_file ...\"\n end\n # verify the required parameter 'file_name' is set\n if @api_client.config.client_side_validation && file_name.nil?\n fail ArgumentError, \"Missing the required parameter 'file_name' when calling NsxComponentAdministrationApi.copy_from_remote_file_copy_from_remote_file\"\n end\n # verify the required parameter 'copy_from_remote_file_properties' is set\n if @api_client.config.client_side_validation && copy_from_remote_file_properties.nil?\n fail ArgumentError, \"Missing the required parameter 'copy_from_remote_file_properties' when calling NsxComponentAdministrationApi.copy_from_remote_file_copy_from_remote_file\"\n end\n # resource path\n local_var_path = \"/node/file-store/{file-name}?action=copy_from_remote_file\".sub('{' + 'file-name' + '}', file_name.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(copy_from_remote_file_properties)\n auth_names = ['BasicAuth']\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 => 'FileProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#copy_from_remote_file_copy_from_remote_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def copy_to_remote_file_copy_to_remote_file_with_http_info(file_name, copy_to_remote_file_properties, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.copy_to_remote_file_copy_to_remote_file ...\"\n end\n # verify the required parameter 'file_name' is set\n if @api_client.config.client_side_validation && file_name.nil?\n fail ArgumentError, \"Missing the required parameter 'file_name' when calling NsxComponentAdministrationApi.copy_to_remote_file_copy_to_remote_file\"\n end\n # verify the required parameter 'copy_to_remote_file_properties' is set\n if @api_client.config.client_side_validation && copy_to_remote_file_properties.nil?\n fail ArgumentError, \"Missing the required parameter 'copy_to_remote_file_properties' when calling NsxComponentAdministrationApi.copy_to_remote_file_copy_to_remote_file\"\n end\n # resource path\n local_var_path = \"/node/file-store/{file-name}?action=copy_to_remote_file\".sub('{' + 'file-name' + '}', file_name.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(copy_to_remote_file_properties)\n auth_names = ['BasicAuth']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#copy_to_remote_file_copy_to_remote_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def cp_into(options={})\n cmd = \"/bin/cp #{options[:src]} #{@config.ve_private}/#{options[:dst]}\"\n execute(cmd)\n end", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, src unless File.exist?(src)\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\tend", "def test_copy_file\n remote_file_name = 'TestCopyFileSrc.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = CopyFileRequest.new(dest_path: remote_data_folder + '/TestCopyFileDest.docx', src_path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.copy_file(request)\n end", "def push_file(user, host, copy_path, paste_path, sudo = false)\n ping(user, host) do\n begin\n file = open(copy_path)\n write_body(user, host, file.read(File.size(copy_path)), paste_path)\n file.close if file\n rescue\n \"No such file.\"\n end\n end\n end", "def rsync_to_temp\n\t\tputs \"\\n=> copying to temp dir.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_src, @@dir_temp)\n\tend", "def cp(src, dst, owner = nil, mode = nil)\n FileUtils.cp_r(src, dst, :preserve => true, :verbose => verbose?)\n if owner && !File.symlink?(dst) \n chown(dst, owner) \n end\n if mode\n chmod(dst, mode)\n end\n end", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, src\n\tend", "def cp( file )\n src = template / file\n dst = site / file\n\n if test(?e, dst)\n if identical?(src, dst)\n identical(dst)\n return\n end\n\n choice = case options[:collision]\n when :force then :force\n when :skip then :skip\n else force_file_collision?( dst ) end\n\n case choice\n when :force then force(dst)\n when :skip then skip(dst); return\n else raise \"Invalid collision choice: #{choice.inspect}\" end\n else\n create(dst)\n end\n return if pretend?\n\n FileUtils.cp(src, dst)\n end", "def copy_site\n target_dir = File.join(@deploy_dir, @remote_path).sub(/\\/$/,'')\n FileUtils.cp_r @local + '/.', target_dir\n message = \"Site updated at: #{Time.now.utc}\"\n `git add --all .`\n `git commit -m \\\"#{message}\\\"`\n end", "def update_local_file(file, node, copy, copied_files)\n return if should_filter? file\n\n # Is the file also in the target changeset?\n if remote.include? file\n update_common_file file, node\n elsif copied_files[file]\n return\n elsif copy[file]\n update_locally_copied file, copy[file]\n elsif ancestor_manifest[file]\n update_remotely_deleted file, node\n else\n # Are we overwriting with empty data, or going backwards to when the\n # file didn't exist?\n if (overwrite? && node[20..-1] == \"u\") || (backwards? && node.size <= 20)\n remove file\n end\n end\n end", "def doCopyOperations(sourceContent, destinationContent, dryRun)\n #N Without this loop, we won't copy the directories that are marked for copying\n for dir in sourceContent.dirs\n #N Without this check, we would attempt to copy those directories _not_ marked for copying (but which might still have sub-directories marked for copying)\n if dir.copyDestination != nil\n #N Without this, we won't know what is the full path of the local source directory to be copied\n sourcePath = sourceLocation.getFullPath(dir.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(dir.copyDestination.relativePath)\n #N Without this, the source directory won't actually get copied\n destinationLocation.contentHost.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n else\n #N Without this, we wouldn't copy sub-directories marked for copying of this sub-directory (which is not marked for copying in full)\n doCopyOperations(dir, destinationContent.getDir(dir.name), dryRun)\n end\n end\n #N Without this loop, we won't copy the files that are marked for copying\n for file in sourceContent.files\n #N Without this check, we would attempt to copy those files _not_ marked for copying\n if file.copyDestination != nil\n #N Without this, we won't know what is the full path of the local file to be copied\n sourcePath = sourceLocation.getFullPath(file.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(file.copyDestination.relativePath)\n #N Without this, the file won't actually get copied\n destinationLocation.contentHost.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end\n end\n end", "def git_clone(remote, dest)\n Dir.chdir(__dir__) do\n system \"git clone #{remote} #{dest}\"\n end\nend", "def copy_file(source, destination)\n FileUtils.cp(source, destination)\n destination\n end", "def copy_file(source, destination)\n FileUtils.cp(source, destination)\n destination\n end", "def rsync(local_folder, remote_destination, delete)\n @log.info(\"rsyncing folder '#{local_folder}' to '#{remote_destination}'...\")\n @process_runner.execute!(\"rsync --filter='P *.css' --filter='P apidocs' --filter='P cdn' --filter='P get-started' --partial --archive --checksum --compress --omit-dir-times --quiet#{' --delete' if delete} --chmod=Dg+sx,ug+rw,Do+rx,o+r --protocol=28 --exclude='.snapshot' #{local_folder}/ #{remote_destination}\")\n end", "def copy_command_for(source, destination)\n if windows?\n %Q{copy \"#{source}\" \"#{destination}\"}.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)\n else\n \"cp -r #{source} #{destination}\"\n end\n end", "def copy_command_for(source, destination)\n if windows?\n %Q{copy \"#{source}\" \"#{destination}\"}.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)\n else\n \"cp -r #{source} #{destination}\"\n end\n end", "def get_rsync(options)\n 'rsync ./ ' + options[:full_path]\n end", "def copy(destination, file, folder = './downloads')\n FileUtils.mkdir_p(File.dirname(\"#{destination}/#{file}\"))\n FileUtils.cp_r(\"#{folder}/#{file}\", \"#{destination}/#{file}\")\n end", "def cp srcpath, dstpath\n end", "def copy_or_move(original, target)\n if(@delete_original_file)\n FileUtils.move(original, target)\n else\n # Delay can be enabled through enviroment\n if(delay_copies)\n DelayedCopier.cp(original, target)\n elsif(fast_copies)\n FileUtils.copy(original, target)\n else\n # Call the copy as an external command. This is to work around the\n # crashes that occurred using the builtin copy\n from_file = File.expand_path(original)\n to_file = File.expand_path(target)\n system_success = system(\"cp '#{from_file}' '#{to_file}'\")\n raise(IOError, \"copy error '#{from_file}' '#{to_file}'\") unless system_success\n end\n end\n end", "def download_file_from_guest(guest_path, local_path, quiet=false)\n\n log_stdout \"Copying #{guest_path} to #{local_path}\", quiet\n # 1 run cp command in machine\n guestcontrol_exec \"cmd.exe\", \"cmd.exe /c copy \\\"#{guest_path}\\\" \\\"E:\\\\#{File.basename(local_path)}\\\"\"\n\n # 2 copy to tmp location in .ievms\n FileUtils.cp File.join(IEVMS_HOME,File.basename(local_path)), local_path\n\n # 3 remove tmp file in .ievms\n FileUtils.rm File.join(IEVMS_HOME,File.basename(local_path))\n end", "def copy_file(src, base, dest_dir)\n return if src == '/dev/null' or not File.exists?(src)\n dest = File.expand_path(base, dest_dir)\n puts \"Added: #{base}\"\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp src, dest\nend", "def scp_cmd(source_file,destination_dir,backup_options = nil,backup_name = nil)\n backup_options ||= @backup_options\n backup_name ||= @backup_name\n ssh_user = backup_options[:user_name]\n ssh_host = backup_options[:hostname]\n ssh_password = backup_options[:password]\n if ssh_password\n # Need to use expect for the password if certs don't work\n cmd_exe = File.expand_path(File.join(::UBSAFE_ROOT, 'bin','ubsafe_scp_cmd.expect'))\n full_cmd = \"#{cmd_exe} #{ssh_user}@#{ssh_host} \\\"#{ssh_password}\\\" #{source_file} #{destination_dir}\"\n masked_full_cmd = \"#{cmd_exe} #{ssh_user}@#{ssh_host} [PASSWORD] #{source_file} #{destination_dir}\"\n else\n # Certs assumed if no password\n full_cmd = \"scp #{source_file} #{ssh_user}@#{ssh_host}:#{destination_dir}\"\n masked_full_cmd = full_cmd\n end\n #puts \"About to issue \\\"#{full_cmd}\\\"\"\n cmd_output = `#{full_cmd}`\n cmd_status = $?\n @log.debug(\"Executed scp status #{cmd_status} command \\\"#{masked_full_cmd}\\\"\")\n cmd_output_lines = cmd_output.split(\"\\n\").reject {|line| line =~ /spawn/i or line =~ /password/i }\n cmd_output_cleaned = []\n cmd_output_lines.each do |cmd_output_line|\n cmd_output_cleaned << cmd_output_line.strip.chomp\n end\n cmd_status = cmd_status == 0 ? :success : :failure\n return [cmd_status,cmd_output_cleaned]\n end" ]
[ "0.7723254", "0.7532556", "0.73338854", "0.7277002", "0.7147048", "0.6654628", "0.66349113", "0.65113837", "0.64394206", "0.64373875", "0.63955307", "0.632376", "0.62834203", "0.6182566", "0.6164122", "0.61620396", "0.6141504", "0.6138029", "0.61282855", "0.61193615", "0.6109105", "0.60636914", "0.60002875", "0.59844977", "0.59700084", "0.59382194", "0.59382194", "0.59344065", "0.5931599", "0.5931599", "0.5901862", "0.58921784", "0.58886355", "0.5847703", "0.5837464", "0.58161867", "0.58133876", "0.5811041", "0.58072394", "0.5795341", "0.5780023", "0.57646734", "0.5764169", "0.5759661", "0.57391226", "0.5736333", "0.57295173", "0.57266223", "0.57103705", "0.57100254", "0.56960064", "0.56932884", "0.5692976", "0.5685002", "0.5677063", "0.5671998", "0.56668174", "0.56610686", "0.5640295", "0.5631524", "0.5623929", "0.5619474", "0.5617259", "0.5610271", "0.560157", "0.5597835", "0.5592385", "0.5583492", "0.5582414", "0.55798423", "0.5574031", "0.557387", "0.5573624", "0.5557568", "0.55447483", "0.5541344", "0.5530169", "0.55240816", "0.5522584", "0.55125546", "0.5506905", "0.55038214", "0.5477681", "0.5470937", "0.54642856", "0.5459245", "0.5458913", "0.54504555", "0.54471576", "0.54471576", "0.54456913", "0.54353994", "0.54353994", "0.5434499", "0.54284865", "0.54259384", "0.5422601", "0.5416273", "0.5414756", "0.54066503" ]
0.7578403
1
Return a list of all subdirectories of the base directory (as paths relative to the base directory) N Without this we won't have a way to list the relative paths of all directories within a particular base directory on the remote system.
def listDirectories(baseDir) #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths baseDir = normalisedDir(baseDir) #N Without this, we won't know that directories are about to be listed puts "Listing directories ..." #N Without this, we won't have an empty array ready to accumulate directory relative paths directories = [] #N Without this, we won't know the length of the base directory to remove from the beginning of the absolute directory paths baseDirLen = baseDir.length #N Without this, the directory-listing command won't be executed ssh(findDirectoriesCommand(baseDir).join(" ")) do |line| #N Without this, we won't get feedback about which directories were found puts " #{line}" #N Without this check, we might ignore an error that somehow resulted in directories being listed that aren't within the specified base directory if line.start_with?(baseDir) #N Without this, the relative path of this directory won't be added to the list directories << line[baseDirLen..-1] else #N Without raising this error, an unexpected directory not in the base directory would just be ignored raise "Directory #{line} is not a sub-directory of base directory #{baseDir}" end end return directories end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listDirectories(baseDir)\n #N if un-normalised, code assuming '/' at the end might be one-off\n baseDir = normalisedDir(baseDir)\n #N without the command, we don't know what command to execute to list the directories\n command = findDirectoriesCommand(baseDir)\n #N without this, the command won't execute, or we it might execute in a way that doesn't let us read the output\n output = getCommandOutput(command)\n #N without initial directories, we would have nowhere to accumulate the directory relative paths\n directories = []\n #N without the base dir length, we don't know how much to chop off the path names to get the relative path names\n baseDirLen = baseDir.length\n #N without this, would not get feedback that we are listing directories (which might be a slow remote command)\n puts \"Listing directories ...\"\n #N without looping over the output, we wouldn't be reading the output of the listing command\n while (line = output.gets)\n #N without chomping, eoln would be included in the directory paths\n line = line.chomp\n #N without this, would not get feedback about each directory listed\n puts \" #{line}\"\n #N without this check, unexpected invalid output not including the base directory would be processed as if nothing had gone wrong\n if line.start_with?(baseDir)\n #N without this, the directory in this line of output wouldn't be recorded\n directories << line[baseDirLen..-1]\n else\n #N if we don't raise the error, an expected result (probably a sign of some important error) would be ignored\n raise \"Directory #{line} is not a sub-directory of base directory #{baseDir}\"\n end\n end\n #N if we don't close the output, then un-opened output stream objects will accumulate (and leak resources)\n output.close()\n #N if we don't check the process status, then a failed command will be treated as if it had succeeded (i.e. as if there were no directories found)\n checkProcessStatus(command)\n return directories\n end", "def listDirectories\n return contentHost.listDirectories(baseDir)\n end", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def retrieve_dirs(_base, dir, dot_dirs); end", "def directories\n directory.directoires\n end", "def findDirectoriesCommand(baseDir)\n #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type d' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?)\n return [\"#{@pathPrefix}find\", baseDir, \"-type\", \"d\", \"-print\"]\n end", "def subdirectories\n Dir.glob(File.join(base_path, \"*\")).reject { |i| !File.directory?(i) }\n end", "def dir_list(path, bases, paging)\n items = paging[:items]\n page = paging[:page]\n offset = paging[:offset]\n raise 'Disabling paging is not supported for a directory listing' if paging[:disable_paging]\n\n max_items = 1000\n\n child_paths, total = FileSystems::Combined.directory_list(path, items, offset, max_items)\n\n children = child_paths.map { |full_path|\n if FileSystems::Combined.directory_exists?(full_path)\n dir_info(full_path, bases)\n else\n raise 'File should exist' unless FileSystems::Combined.file_exists?(full_path)\n\n file_info(full_path)\n end\n }\n\n paging[:total] = total\n paging[:warning] = \"Only first #{max_items} results are available\" if total >= max_items\n\n children\n end", "def paths_to_pull\n sep = mode == :ssh ? \":\" : \"::\"\n directories.map do |dir|\n \"#{sep}'#{dir.sub(%r{^~/}, \"\").sub(%r{/$}, \"\")}'\"\n end.join(\" \").sub(%r{^#{sep}}, \"\")\n end", "def listFiles(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this we wouldn't be executing the command to list all files in the remote directory\n ssh(findFilesCommand(baseDir).join(\" \")) do |line| \n #N Without this we wouldn't be echoing the file name on this line for the user to read\n puts \" #{line}\"\n end\n end", "def submodule_dirs\n # Implementation is a little hacky; we run a git command and parse the\n # output.\n cmd = %(git submodule)\n %x(#{cmd}).split(/\\n/).map {|line| line.split(\" \")[1] }\n end", "def descendants\n self.subfolders.collect do |s|\n [s] + s.descendants\n end.flatten\n end", "def retrieve_dirs(_base, dir, dot_dirs)\n dot_dirs.each do |file|\n dir_path = site.in_source_dir(dir, file)\n rel_path = PathManager.join(dir, file)\n @site.reader.read_directories(rel_path) unless @site.dest.chomp(\"/\") == dir_path\n end\n end", "def subdirectories()\n children.select { |c| c.directory? }\n end", "def get_remotes()\n to_return = {}\n count = 1\n num_dirs = Dir.glob('./*/').size() -2 # exclude . and ..\n Dir.glob('./*/').each() do |dir|\n next if dir == '.' or dir == '..'\n\n print \"Processing directories...#{count}/#{num_dirs}\\r\" if !$verbose\n count += 1\n\n if(File.directory?(dir) and File.exists?(dir + '/.git'))\n Dir.chdir dir\n remotes = `git remote -v`.split(\"\\n\")\n\n vprint(dir.ljust(25))\n remotes.each() do |remote|\n if(remote.index('(fetch)'))\n parts = remote.split(\"\\t\")\n\n remote_name = get_remote_name(parts[1])\n vprint(\"[#{parts[0]} #{remote_name}]\".ljust(20))\n if(remote_name != nil)\n index = parts[0] + ' - ' + remote_name\n if(to_return[index] == nil)\n to_return[index] = Array.new()\n end\n to_return[index].push(dir)\n else\n puts \"\\nDon't know what to do with #{remote} in dir #{dir}\"\n end\n end\n end # end remotes loop\n\n vprint \"\\n\"\n Dir.chdir '..'\n end # end if file.directory\n end\n\n print \"\\n\"\n return to_return\nend", "def SubPaths()\n #puts \"Searching subpaths in #{to_s()}\"\n entries = Dir.entries(AbsolutePath())\n subPaths = []\n \n #puts \"Found entries #{entries}\"\n \n entries.each do |entry|\n if(entry == \"..\" || entry == \".\")\n next\n end\n \n copy = CreateCopy()\n \n #puts \"Copy is #{copy}\"\n \n copy.RelativePath = JoinPaths([copy.RelativePath, entry])\n subPaths.push(copy)\n \n #puts \"Created path #{copy} for entry #{entry}\"\n end\n \n return subPaths\n end", "def directories\n @directories.values\n end", "def net_excluded_directories\n net = []\n all = self.excluded_directories.map { |dir| buildr_project._(dir.to_s) }.sort_by { |d| d.size }\n all.each_with_index do |dir, i|\n unless all[0 ... i].find { |other| dir =~ /^#{other}/ }\n net << dir\n end\n end\n net\n end", "def net_excluded_directories\n net = []\n all = self.excluded_directories.map { |dir| buildr_project._(dir.to_s) }.sort_by { |d| d.size }\n all.each_with_index do |dir, i|\n unless all[0 ... i].find { |other| dir =~ /^#{other}/ }\n net << dir\n end\n end\n net\n end", "def GetDirectoryPathsFromRelativeBase(path)\n pathParts = path.RelativePathParts\n paths = []\n for i in 1..pathParts.length\n\tsubPath = ProjectPath.new(JoinPaths(pathParts.slice(0, i)))\n\tpaths.push(subPath)\n end\n return paths\n end", "def directory_subdirectories(path)\n\tputs ''\n\tfor i in subdir_paths(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend", "def all_directories dir\n Dir[\"#{dir}**/\"]\nend", "def getDirs dir\n\t\tFind.find(dir)\t\n\tend", "def get_remote_files_hierarchy(files, root = '/', hierarchy = { dirs: [], files: [] })\n files.each do |node|\n case node['node_type']\n when 'directory'\n hierarchy[:dirs] << \"#{root}#{node['name']}\"\n get_remote_files_hierarchy(node['files'], root + node['name'] + '/', hierarchy)\n when 'file'\n hierarchy[:files] << \"#{root}#{node['name']}\"\n end\n end\n\n hierarchy\nend", "def list_of_directories\n Dir.entries(\"./inspections\").select {|d| !d.start_with?(\".\") }\n end", "def get_remote_files_hierarchy(files, root = '/', hierarchy = { dirs: [], files: [] })\n files.each do |node|\n case node['node_type']\n when 'directory'\n hierarchy[:dirs] << \"#{root}#{node['name']}\"\n get_remote_files_hierarchy(node['files'], root + node['name'] + '/', hierarchy)\n when 'file'\n hierarchy[:files] << \"#{root}#{node['name']}\"\n end\n end\n\n return hierarchy\nend", "def GetDirectoryTreeFromRelativeBase(baseDirectory, excludePatterns=[], excludeEmpty=false)\n tree = GetDirectoryPathsFromRelativeBase(baseDirectory)\n tree.pop() # remove the base directory which is added again in the GetDirectoryTree call\n \n tree.concat(GetDirectoryTree(baseDirectory, excludePatterns, excludeEmpty))\n \n return tree\n end", "def recursive_find_directories_and_files dirname\r\n base_path = self.class.lookup('ExtAdminSection').path + \"/templates/\"\r\n \r\n directories = []\r\n files = []\r\n \r\n Find.find(File.join(base_path, dirname)) do |path|\r\n if FileTest.directory?(path)\r\n directories << path.gsub(base_path, '')\r\n else\r\n files << path.gsub(base_path, '')\r\n end\r\n end\r\n \r\n return directories, files\r\n end", "def directories\n [root_path, deploys_path, shared_path,\n log_path, checkout_path, scripts_path]\n end", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def directories\n @directories ||= []\n end", "def directories\n @directories ||= []\n end", "def dirs_until_dodona_dir\n dir = @pwd\n children = [dir]\n loop do\n return [] if dir.root?\n return children if dir == @dodona_dir\n children.unshift dir\n dir = dir.parent\n end\n end", "def get_directories(src)\n directories = Array.new\n #return directories\n Find.find(src) do |path|\n # not too sure what this was intended to do but its getting in the way\n # and can not be matched correctly.\n #next if File.dirname(path) != src \n next if path == src\n next if not File.directory? path\n directories.push path\n end\n directories.reverse\nend", "def children( with_directory = ( self != '.' ) )\n ( Dir.entries( expand_tilde ) - DOTS ).map do | entry |\n with_directory ? join( entry ) : self.class.new( entry )\n end\n end", "def list_folders\n http_get(:uri=>\"/folders\", :fields=>x_cookie)\n end", "def children\n return [] unless directory_index?\n\n base_path = if eponymous_directory?\n eponymous_directory_path\n else\n path.sub(@app.config[:index_file].to_s, '')\n end\n\n prefix = %r{^#{base_path.sub(\"/\", \"\\\\/\")}}\n\n @store.resources.select do |sub_resource|\n if sub_resource.path == path || sub_resource.path !~ prefix\n false\n else\n inner_path = sub_resource.path.sub(prefix, '')\n parts = inner_path.split('/')\n if parts.length == 1\n true\n elsif parts.length == 2\n parts.last == @app.config[:index_file]\n else\n false\n end\n end\n end\n end", "def get_remote_files_hierarchy(files, root = '/', hierarchy = { dirs: [], files: [] })\n files.each do |node|\n case node['node_type']\n when 'branch'\n get_remote_files_hierarchy(node['files'], root + node['name'] + '/', hierarchy)\n when 'directory'\n hierarchy[:dirs] << \"#{root}#{node['name']}\"\n get_remote_files_hierarchy(node['files'], root + node['name'] + '/', hierarchy)\n when 'file'\n hierarchy[:files] << \"#{root}#{node['name']}\"\n end\n end\n\n return hierarchy\nend", "def subdirectories\n path_length - 1\n end", "def base_directories\n @base_dirs ||= names.map { |name| ::Gem::Specification.find_by_name(name).gem_dir }\n end", "def list_directories(options = {})\n options = DEFAULTS.merge(options)\n\n path = options[:path]\n all = options[:all]\n\n path = \"#{path}/\" unless path == '' or path.end_with?('/')\n path = path+'**/' if all\n \n\n Dir.glob(\"#{path}*/\")\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def list_files\n files = remote_directory.files.map { |file| file.key }\n\n # The first item in the array is only the path an can be discarded.\n files = files.slice(1, files.length - 1) || []\n\n files\n .map { |file| Pathname.new(file).basename.to_s }\n .sort\n .reverse\n end", "def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend", "def repositories_to_fetch\n # Find all .git Repositories - Ignore *.wiki.git\n repos = Dir.glob(\"#{@config['git']['repos']}/*/*{[!.wiki]}.git\")\n\n # Build up array of NOT ignored repositories\n delete_path = []\n @config['ignore'].each do |ignored|\n path = File.join(@config['git']['repos'], ignored)\n delete_path += repos.grep /^#{path}/\n repos.delete(delete_path)\n end\n\n return repos - delete_path\n\n end", "def binary_tree_paths(root)\n paths = []\n binary_tree_paths_recursive(root, [], paths)\n\n paths.map do |path|\n path.join(\"->\")\n end\nend", "def children(with_directory=true)\n with_directory = false if @path == ['.']\n result = []\n Dir.foreach(to_s) {|e|\n next if e == '.' || e == '..'\n if with_directory\n result << Path::Name.create(@path + [e], absolute?)\n else\n result << Path::Name.new(e)\n end\n }\n result\n end", "def get_file_list relative_path\n\t\t\t\tpath = File.join(@src, relative_path)\n\t\t\t\tresult = nil\n\t\t\t\tFileUtils.cd(path) do\n\t\t\t\t\tresult = Dir.glob(\"**/*\", File::FNM_DOTMATCH)\n\t\t\t\t\tresult.reject! { |fn| File.directory?(fn) }\n\t\t\t\t\tresult.reject! { |fn| fn =~ /(^_|\\/_)/ }\n\t\t\t\tend\n\t\t\t\tresult\n\t\t\tend", "def dir_children(dirname=mpwd)\n simple_entries(dirname).find_all {|e|\n File.directory?(File.join(dirname, e))\n }\n end", "def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end", "def base_paths\n @base_paths ||= find_base_paths\n end", "def directories; end", "def directories; end", "def directory_paths\n pages.map { |p| File.dirname(p.path).split(\"/\")[0] }.uniq\n end", "def find_paths(dir=\"\")\n base = File.join(@source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir[\"*\"]) }\n paths = []\n\n entries.each do |entry|\n absolute_path = File.join(base, entry)\n relative_path = File.join(dir, entry)\n\n if File.directory?(absolute_path)\n paths.concat find_paths(relative_path)\n else\n paths << absolute_path\n end\n end\n paths\n end", "def dir_list\n path_from_env || default_path\n end", "def expand_all path\n real_path = VirtualLayer.realpath(path)\n elems = real_path.split('/'); elems.shift # throw away the first element which is empty for a FQ pathname\n if path[-1] == '/'\n filt_fn = ->(p) { VirtualLayer.directory?(p) }\n else\n filt_fn = ->(p) { p }\n end\n result = rejoin(walk_globs(elems)).flatten.select(&filt_fn).sort\n\n if path[0] == '/'\n result\n else\n cwd = VirtualLayer.pwd\n result.map {|p| p[(cwd.length+1)..] }\n end\nend", "def dirs; end", "def dirs; end", "def detected_directories\n sub_directories.reject do |on_disk|\n children.any? { |in_db| in_db.full_path == on_disk }\n end.map do |found|\n children.new(relative_path: found.relative_path_from(disk.path), disk: disk)\n end.each(&:valid?) # build paths\n end", "def directories\n return @expanded_dirs if @expanded_dirs\n\n raw_dirs = File.readlines(settings.check_dirs).map(&:chomp)\n simple_dirs = raw_dirs.reject{ |line| line.empty? || line.start_with?('#') }\n expanded_dirs = simple_dirs.map do |line|\n expanded = Dir.glob(line)\n if expanded.empty?\n # return original line for error reporting\n line\n else\n # only return directories\n expanded.select{ |dir| File.directory?(dir) }\n end\n end\n @expanded_dirs = expanded_dirs.flatten.sort_by(&:downcase)\n end", "def folders\n @conn.list('', '%').map do |f|\n Folder.new(@conn, f.name, f.delim)\n end\n end", "def get_ls(path)\n #repo = @repo\n #head = repo.commits.first\n #tree = head.tree @branch\n\n tree = @repo.tree @branch\n\n #strip trailing /\n path.sub! /[\\/]*$/, ''\n\n # find dir\n while !path.empty?\n tdir = tree / path\n break if tdir.is_a?(Grit::Tree)\n # strip last conponent to /\n path.sub! /(^|\\/)[^\\/]*$/, ''\n end\n\n if path.empty?\n tdir = tree\n else\n path += '/'\n end\n print \"path:\", path, \"\\n\"\n print \"tdir:\", tdir, \"\\n\"\n\n files = tdir.blobs.map do |b|\n { path: \"#{path}#{b.name}\", name: b.name, siz: b.size }\n end\n dirs = tdir.trees.map do |t|\n { path: \"#{path}#{t.name}\", name: t.name}\n end\n if !path.empty?\n dirs.push( { path: path.sub(/(^|\\/)[^\\/]*\\/$/, ''),\n name: '..'} )\n end\n\n [files, dirs, path]\n end", "def get_dirs\n Dir.glob(\"#{@options[:load_path]}/*/**/\")\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 recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend", "def folders\n @conn.list(\"#{@full_name}#{@delim}\", '%').map do |f|\n Folder.new(@conn, f.name, f.delim)\n end\n end", "def mount_paths_listing\n Dir[\"#{mounts_path}/*\"]\n end", "def get_win_server_folder_path(ends_with_slash,starting_path,arr,sep)\n list = []\n if Dir.exists?(app_config(:win_ftp_root)) && Dir.chdir(app_config(:win_ftp_root))\n glob_value = ends_with_slash ? \"#{arr.join(sep)}/*\" : \"#{arr.join(sep)}*\"\n count = starting_path.count \"/\"\n glob_value = \"#{starting_path.split(\"/\").last}*\" if count == 1 and starting_path[0] == \"/\"\n #list=Dir.glob(glob_value)\n glob_value_dc = glob_value.downcase\n glob_value_cc = glob_value.camelcase.split(\"::\").join(\"/\")\n glob_value_uc = glob_value.upcase\n list=Dir.glob(glob_value_dc)\n list=list+Dir.glob(glob_value_cc)\n list=list+Dir.glob(glob_value_uc)\n end\n return list\n end", "def index\n\t\t@directories = []\n\t\troot_directory = Jedd::Directory.joins(:v_user).where(:v_users => {:nick => params[:v_user_nick]}).includes(:jedd_file_nodes).first\n\t\t# root_directory = V::User.find_by_nick(params[:v_user_nick]).jedd_directories.where(:jedd_directory_id => nil).joins(:jedd_directories => [:jedd_file_nodes]).first\n\t\tnot_found unless root_directory\n\n\t\tif root_directory\n\t\t\t@directories << root_directory\n\t\tend\n\tend", "def visible_files\n result = []\n for dir in @dirs\n result += visible_files_under(dir)\n end\n return result\n end", "def subdir_paths(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tsubdir_paths = []\n\tfor i in contents\n\t\tif i['is_dir']\n\t\t\tsubdir_paths << i['path']\n\t\tend\n\tend\n\tsubdir_paths\nend", "def index(base_path, glob = nil)\n\t\tglob = '*' if glob == '' or glob.nil?\n\t\tdirs = []\n\t\tfiles = []\n\t\t::Dir.chdir(base_path) do\n\t\t\t::Dir.glob(glob).each do |fname|\n\t\t\t\tif ::File.directory?(fname)\n\t\t\t\t\tdirs << fname + '/'\n\t\t\t\telse\n\t\t\t\t\tfiles << fname\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdirs.sort + files.sort\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, base_path\n\tend", "def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end", "def get_directories_absolute_paths path\n dir_list = Dir[\"#{path}/*/\"]\n \n #Remove unnecessary directories\n dir_list.delete(File.join(path, \".\"))\n dir_list.delete(File.join(path, \"..\"))\n \n dir_list\n end", "def findFilesCommand(baseDir)\n #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type f' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?)\n return [\"#{@pathPrefix}find\", baseDir, \"-type\", \"f\", \"-print\"]\n end", "def scanDir()\n suffix = \".config.json\"\n Dir.glob(\"#{@logBaseDir}/*/*#{suffix}\") {|path|\n #basename = File.basename(path, \".config.json\") ;\n basename = path.gsub(/^#{@logBaseDir}\\//,'').gsub(/#{suffix}$/,'') ;\n p [:basename, basename] ;\n @basenameList.push(basename) ;\n }\n @basenameList.sort!() ;\n return @basenameList ;\n end", "def list_directories\n Dir.chdir(path)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end", "def GetLevelDirs()\n directories = Dir.entries($level_folder)\n\n for i in 0...directories.length do\n\n if not directories[i].include? \".\" then\n $current_folder = $level_folder + directories[i] + \"/\"\n GetLevels($current_folder)\n end\n\n end\n\nend", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def rc_dirs; 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 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 rpaths\n command(:LC_RPATH).map(&:path).map(&:to_s)\n end", "def get_directories_names path\n get_directories_absolute_paths(path).map {|dir| File.basename(dir) }\n end", "def all\n return @raw_repos unless @raw_repos.empty?\n return [Template.root.basename.to_s] if Template.project?\n Template.root.join(Meta.new({}).repos_dir).children.map do |path|\n path.basename.to_s\n end\n\n rescue Errno::ENOENT\n then raise(\n Error::RepoNotFound\n )\n end", "def get_to_links\n to_links = []\n\n dotfiles_dir = File.dirname(__FILE__)\n\n Dir.entries(dotfiles_dir).each do |filename|\n if File.directory? filename and not $exclude_list.include? filename\n subfiles = Dir.entries File.join dotfiles_dir, filename\n\n subfiles.each do |sfilename|\n if not sfilename.eql? '..' and not sfilename.eql? '.'\n full_path = File.join dotfiles_dir, filename, sfilename\n to_links << full_path\n end\n end\n\n end\n end\n\n to_links\nend", "def fakedir_get_all_names(root, basename = '')\n result = (['.', '..'] + root[:files] + root[:dirs].keys).map{|e| basename + e}\n root[:dirs].each do |name, content|\n result += fakedir_get_all_names(content, \"#{basename}#{name}/\")\n end\n result\n end", "def find(dirs); end", "def list(path, recursive=true, dirs=false)\n # TODO : this might need to be changed as it returns dir and contents\n # if there are contents\n nodes = []\n prune = recursive ? nil : 2\n @content_tree.with_subtree(path, nil, prune, dirs) do |node|\n nodes << node.path\n end\n nodes.sort.uniq\n end", "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n `git ls-tree --name-only #{ref} #{paths.join(' ')}`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all\n rootdir = Cfg.rootdir\n dirlist = [\"#{rootdir}/*/*\", \"#{rootdir}/*/*/*/*\"]\n filelist = [\"Packages\", \"Packages.gz\", \"Release\", \"Release.gpg\" ]\n files = []\n\n dirlist.each do |dirs|\n Dir.glob(dirs).each do |dir|\n filelist.each do |file|\n fullname = File.join(dir, file)\n files << fullname if File.exists? fullname\n end\n end\n end\n return files\n end", "def client_directories\n return @client_dirs unless @client_dirs.nil?\n client_path = File.join(@root_path, 'clients')\n if File.exists?(client_path)\n @client_dirs = Dir.entries(client_path).reject do |x|\n (/^\\./ =~ x) || !File.directory?(File.join(client_path,x))\n end\n else\n @client_dirs = []\n end\n\n return @client_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 directories\n directory_entries.map{ |f| FileObject[path, f] }\n end", "def hiera_datadirs(hiera)\n configpath = hiera_configpath(hiera)\n config = YAML.load_file(configpath)\n backends = [config[:backends]].flatten\n datadirs = backends.map { |be| config[be.to_sym][:datadir] }.uniq\n datadirs.map do |datadir|\n localpath = File.join('config', 'hieras', hiera, File.basename(datadir))\n [localpath, datadir]\n end\nend", "def paths\n root.paths\n end", "def find_files_recursive (base_directory, relative_path)\n result = []\n directory = File.join(base_directory, relative_path)\n Dir.foreach(directory) do |file|\n relative_file = relative_path.empty? ? file : File.join(relative_path, file)\n if matchesFilters(file, relative_file)\n full_path = File.join(base_directory, relative_file)\n if File.directory?(full_path)\n result = result + find_files_recursive(base_directory, relative_file)\n else\n result << relative_file\n end\n end\n end\n result\n end", "def ascendants\n paths = []\n path = @path\n paths << self\n while (r = chop_basename(path))\n path = r.first\n break if path.empty?\n\n paths << self.class.new(del_trailing_separator(path))\n end\n paths\n end" ]
[ "0.71614486", "0.6702439", "0.66858256", "0.65969807", "0.6452298", "0.6432997", "0.6388576", "0.62940454", "0.62447226", "0.61075294", "0.6099555", "0.6071435", "0.59856206", "0.5985451", "0.59788847", "0.59520894", "0.5933878", "0.5927118", "0.5927118", "0.59236586", "0.59197867", "0.58989805", "0.58500564", "0.5835116", "0.58285123", "0.5823744", "0.57743305", "0.57664967", "0.57571846", "0.57312584", "0.57266927", "0.57266927", "0.5714093", "0.5693474", "0.56896156", "0.5674313", "0.56538934", "0.5649479", "0.56494343", "0.5637294", "0.56322783", "0.56222945", "0.56222945", "0.5600764", "0.5579113", "0.55785626", "0.5571874", "0.5564916", "0.55614656", "0.55579424", "0.55544555", "0.55541384", "0.5553711", "0.5553711", "0.5551719", "0.5538688", "0.55350834", "0.5533187", "0.553153", "0.553153", "0.5530396", "0.5521721", "0.5504753", "0.5499042", "0.5496349", "0.54860836", "0.5485084", "0.5482877", "0.54802763", "0.5472038", "0.5471134", "0.5468678", "0.5467371", "0.5436287", "0.54347396", "0.5433536", "0.54315245", "0.5422015", "0.54161704", "0.5411052", "0.54073733", "0.53961784", "0.5388418", "0.5377553", "0.5371692", "0.53608626", "0.53507", "0.53433734", "0.53302556", "0.53216296", "0.53214175", "0.53196967", "0.53170586", "0.53128237", "0.5312792", "0.5306442", "0.5301174", "0.5298983", "0.52983683", "0.5298265" ]
0.6923882
1
Yield lines of output from the command to display hash values and file names of all files within the base directory N Without this, where would be no way to list all files in a directory on the remote system and determine the hash of the contents of the file
def listFileHashLines(baseDir) #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths baseDir = normalisedDir(baseDir) #N Without this, we wouldn't know what command to run remotely to loop over the output of the file-files command and run the hash command on each line of output remoteFileHashLinesCommand = findFilesCommand(baseDir) + ["|", "xargs", "-r"] + @hashCommand.command #N Without this we wouldn't actually run the command just defined ssh(remoteFileHashLinesCommand.join(" ")) do |line| #N Without this the line of output wouldn't be echoed to the user puts " #{line}" #N Without this the line of output (with a file name and a hash value) wouldn't be available to the caller of this method yield line end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listFileHashes\n return contentHost.listFileHashes(baseDir)\n end", "def listFileHashes(baseDir)\n #N Un-normalised, an off-by-one error would occur when 'subtracting' the base dir off the full paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this, we would have nowhere to accumulate the file hash objects\n fileHashes = []\n #N Without this, we would not be executing and parsing the results of the file-listing command\n listFileHashLines(baseDir) do |fileHashLine|\n #N Without this, we would not be parsing the result line containing this file and its hash value\n fileHash = self.hashCommand.parseFileHashLine(baseDir, fileHashLine)\n #N Without this check we would be accumulating spurious nil values returned from listFileHashLines (even though listFileHashLines doesn't actually do that)\n if fileHash != nil\n #N Without this, we would fail to include this file & hash in the list of file hashes.\n fileHashes << fileHash\n end\n end\n return fileHashes\n end", "def ls( *args )\r\n \r\n directory = nil\r\n opts = {}\r\n \r\n case args.count\r\n when 1\r\n if args[0].kind_of? Hash\r\n opts = args[0]\r\n else\r\n directory = args[0]\r\n end\r\n when 2\r\n directory = args[0]\r\n opts = args[1] \r\n end\r\n \r\n # args are the RPC arguments ...\r\n args = {}\r\n args[:path] = directory if directory\r\n args[:recursive] = true if opts[:recurse]\r\n args[:detail] = true if opts[:detail] \r\n args.delete(:detail) if( args[:detail] and args[:recursive])\r\n \r\n # RPC output format, default is XML\r\n outf = { :format => 'text' } if opts[:format] == :text\r\n \r\n got = @ndev.rpc.file_list( args, outf )\r\n return nil unless got\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n # if we're here, then we need to conver the output \r\n # to a Hash. Joy!\r\n \r\n collect_detail = args[:detail] || args[:recursive]\r\n \r\n ls_hash = {}\r\n got.xpath('directory').each do |dir|\r\n \r\n dir_name = dir.xpath('directory-name').text.strip\r\n dir_hash = {}\r\n \r\n dir_hash[:fileblocks] = dir.xpath('total-file-blocks').text.to_i\r\n files_info = dir.xpath('file-information')\r\n \r\n dir_hash[:files] = {} \r\n dir_hash[:dirs] = {} # sub-directories\r\n \r\n files_info.each do |file|\r\n f_name = file.xpath('file-name').text.strip\r\n f_h = {} \r\n \r\n if file.xpath('file-directory')[0]\r\n dir_hash[:dirs][f_name] = f_h\r\n else\r\n dir_hash[:files][f_name] = f_h \r\n end\r\n \r\n next unless collect_detail\r\n \r\n f_h[:owner] = file.xpath('file-owner').text.strip\r\n f_h[:group] = file.xpath('file-group').text.strip\r\n f_h[:links] = file.xpath('file-links').text.to_i\r\n f_h[:size] = file.xpath('file-size').text.to_i\r\n \r\n xml_when_item(file.xpath('file-symlink-target')) { |i|\r\n f_h[:symlink] = i.text.strip\r\n }\r\n \r\n fp = file.xpath('file-permissions')[0]\r\n f_h[:permissions_text] = fp.attribute('format').value\r\n f_h[:permissions] = fp.text.to_i\r\n \r\n fd = file.xpath('file-date')[0]\r\n f_h[:date] = fd.attribute('format').value\r\n f_h[:date_epoc] = fd.text.to_i\r\n \r\n end # each directory file\r\n ls_hash[ dir_name ] = dir_hash \r\n end # each directory\r\n \r\n return nil if ls_hash.empty?\r\n ls_hash\r\n end", "def listFiles(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this we wouldn't be executing the command to list all files in the remote directory\n ssh(findFilesCommand(baseDir).join(\" \")) do |line| \n #N Without this we wouldn't be echoing the file name on this line for the user to read\n puts \" #{line}\"\n end\n end", "def list_files\n files = remote_directory.files.map { |file| file.key }\n\n # The first item in the array is only the path an can be discarded.\n files = files.slice(1, files.length - 1) || []\n\n files\n .map { |file| Pathname.new(file).basename.to_s }\n .sort\n .reverse\n end", "def files_commits(num_commits)\n @repo = Grit::Repo.new(@directory)\n related_files = []\n commits_all(num_commits) do |commits|\n commits.each do |commit|\n paths = []\n begin\n commit.diffs.each do |diff|\n if diff.a_path != diff.b_path\n related_files += [[diff.a_path, diff.b_path]]\n end\n paths += [diff.a_path, diff.b_path]\n end\n rescue Grit::Git::GitTimeout\n puts \"Failed to diff for %s\" % commit.sha\n end\n paths.uniq!\n yield commit, paths, related_files\n end\n end\n end", "def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end", "def file_list(hash)\n\nend", "def file_list(hash)\n\nend", "def manifested_files\n\n manifest_files.inject([]) do |acc, mf|\n\n files = open(mf) do |io|\n\n io.readlines.map do |line|\n digest, path = line.chomp.split /\\s+/, 2\n path\n end\n\n end\n\n (acc + files).uniq\n end\n\n end", "def list_files(env, res, tag, path)\n files = []\n git(\"ls-tree\", \"-z\", \"#{tag}:#{path}\") do |io|\n io.each_line(\"\\0\") do |line|\n line.chomp!(\"\\0\")\n #STDERR.puts line\n info, file = line.split(/\\t/, 2)\n mode, type, object = info.split(/ /)\n files << {\n :mode => mode,\n :type => type,\n :object => object,\n :file => file,\n }\n end\n end\n files = files.sort_by{|h| h[:file] }\n E_list_files.result(binding)\n end", "def manifested_files\n manifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n decode_filename(path)\n end\n }\n\n (acc + files).uniq\n end\n end", "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend", "def all_files\n @all_files ||= `git ls-files 2> /dev/null`.split(\"\\n\")\n end", "def files_in branch:\n array_output_of(\"git ls-tree -r --name-only #{branch}\")\nend", "def repo_files\n @vault.sys.auths.select { |_,v| v.type == 'ldap' }\n .keys\n .inject([]) { |acc, elem| acc + group_files(elem) }\n end", "def get_remotes()\n to_return = {}\n count = 1\n num_dirs = Dir.glob('./*/').size() -2 # exclude . and ..\n Dir.glob('./*/').each() do |dir|\n next if dir == '.' or dir == '..'\n\n print \"Processing directories...#{count}/#{num_dirs}\\r\" if !$verbose\n count += 1\n\n if(File.directory?(dir) and File.exists?(dir + '/.git'))\n Dir.chdir dir\n remotes = `git remote -v`.split(\"\\n\")\n\n vprint(dir.ljust(25))\n remotes.each() do |remote|\n if(remote.index('(fetch)'))\n parts = remote.split(\"\\t\")\n\n remote_name = get_remote_name(parts[1])\n vprint(\"[#{parts[0]} #{remote_name}]\".ljust(20))\n if(remote_name != nil)\n index = parts[0] + ' - ' + remote_name\n if(to_return[index] == nil)\n to_return[index] = Array.new()\n end\n to_return[index].push(dir)\n else\n puts \"\\nDon't know what to do with #{remote} in dir #{dir}\"\n end\n end\n end # end remotes loop\n\n vprint \"\\n\"\n Dir.chdir '..'\n end # end if file.directory\n end\n\n print \"\\n\"\n return to_return\nend", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def rec_output(match, out=$stdout)\n out.flush\n #match = (location == dir ? '*' : File.join(dir,'*'))\n files = Dir.glob(match) - exclusions\n files.sort!\n files.each do |file|\n sum = checksum(file,digest)\n sum = sum + ' ' if sum\n out << \"#{sum}#{file}\\n\"\n if File.directory?(file)\n rec_output(File.join(file,'*'), out)\n end\n end\n #return out\n end", "def contents_hash(paths)\n return if paths.nil?\n\n paths = paths.compact.select { |path| File.file?(path) }\n return if paths.empty?\n # rubocop:disable GitHub/InsecureHashAlgorithm\n paths.sort\n .reduce(Digest::XXHash64.new, :file)\n .digest\n .to_s(16) # convert to hex\n # rubocop:enable GitHub/InsecureHashAlgorithm\n end", "def search(command)\n resp = @client.files.search('/', clean_up(command[1]))\n\n for item in resp\n puts item.path\n end\n end", "def list_files_from (path,opts = {})\n safe_fetch do\n list_files = Set.new\n var = \"Search in #{path} at #{@host}... \"\n cmd = \"find #{path}\"\n cmd = \"(cd #{path} && ls \" ### dont know why cd alone doesn't work\n cmd << \"-td */\" if opts[:directories]\n cmd << opts[:regexp] if opts[:regexp]\n cmd << \" 2>/dev/null)\"\n out = @ssh.exec!(cmd)\n list_files = out.split\n list_files = out.split(\"/\\n\") if opts[:directories]\n\n var << \"Found #{list_files.size} entries\\n\"\n Logger.<<(__FILE__,\"INFO\",var)\n list_files\n end\n end", "def get_remote_files\n manager = @current_source.file_manager\n manager.start do \n @current_source.folders.each do |folder|\n @files[folder] = manager.find_files folder\n @files[folder] = @files[folder].take(@take) if @take\n Logger.<<(__FILE__,\"INFO\",\"Found #{@files[folder].size} files for #{@current_source.base_dir}/#{folder} at #{@current_source.host.address}\")\n SignalHandler.check\n end\n end\n end", "def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end", "def files_digest(paths)\n digest(paths.map { |path| file_digest(path) })\n end", "def files_digest(paths)\n self.digest(paths.map { |path| self.file_digest(path) })\n end", "def files_on_remote\n @bucket_contents = nil\n bucket_contents.map {|item| File.basename(item['Key']) }.sort\n end", "def content_of file:, for_sha:\n result = output_of \"git show #{for_sha}:#{file}\"\n result = '' if result == default_file_content_for(file)\n result\nend", "def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, status) = info.split\n hsh[file] = {:path => file, :mode_repo => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_repo => sha_src, :sha_index => sha_dest, :status => status}\n end\n hsh\n end", "def digests_for(path)\n\t\t\ttotal = 0\n\n\t\t\[email protected] do |key, digest|\n\t\t\t\tdigest.reset\n\t\t\tend\n\n\t\t\tFile.open(path, \"rb\") do |file|\n\t\t\t\tbuffer = \"\"\n\t\t\t\twhile file.read(1024 * 1024 * 10, buffer)\n\t\t\t\t\ttotal += buffer.bytesize\n\t\t\t\t\t\n\t\t\t\t\[email protected](total) if @progress\n\t\t\t\t\t\n\t\t\t\t\[email protected] do |key, digest|\n\t\t\t\t\t\tdigest << buffer\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tmetadata = {}\n\t\t\t\n\t\t\[email protected] do |key, digest|\n\t\t\t\tmetadata[\"key.\" + key] = digest.hexdigest\n\t\t\tend\n\t\t\t\n\t\t\treturn metadata\n\t\tend", "def get_file_listing\n execute!(drive.files.list).data\n end", "def dirHash(directory, regexp)\n directory = Pathname.new(directory)\n contents = \"\"\n Dir.foreach(directory) {\n | entry |\n if entry =~ regexp\n contents += IO::read(directory + entry)\n end\n }\n return Digest::SHA1.hexdigest(contents)\nend", "def list_files\n [].tap do |files|\n remote_files do |file|\n files << file\n end\n end\n end", "def find_password_files(output_file, verbose)\r\n #try to write timestamp to file\r\n begin\r\n file_local_write(output_file,\"#Started at #{Time.now}:\")\r\n rescue ::Exception => e\r\n print_error(\"Error opening file #{output_file}:\\n #{e.class} #{e}\")\r\n raise e\r\n end\r\n begin\r\n count = 0\r\n count_view = 0\r\n print_status(\"Starting search. #{Time.now}:\")\r\n print_status(\"Printing output to #{output_file}\")\r\n #search filesystems for /pass/\r\n results = client.fs.file.search(nil,'*pass*',true)\r\n\r\n #for each result - echo to output file, show output by verbosity\r\n results.each do |file|\r\n file_local_write(output_file,\"#{file['path']}\\\\#{file['name']}\")\r\n count += 1\r\n #if quiet - no output.\r\n next if verbose == 'q'\r\n #if NOT verbose - prune windir\r\n next if verbose != 'v' and (file['path'].to_s)[4..12] =~ /windows\\\\/i\r\n #if minimal - only show txt, doc, xml, csv files\r\n next if verbose == 'm' and file['name'] !~ /\\.txt|\\.doc|\\.xml|\\.csv|\\.xls/i\r\n print_status(\"\\t#{file['path']}\\\\#{file['name']} (#{file['size']} bytes)\")\r\n count_view += 1\r\n end\r\n print_status(\"End Search. #{Time.now}:\")\r\n print_status(\"Found #{count} files. Showing #{count_view} files\")\r\n rescue ::Exception => e\r\n print_error(\"Error searching:\\n #{e.class} #{e}\")\r\n raise e\r\n end\r\nend", "def ls\n Dir.entries(@working_dir)\n end", "def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend", "def sha256(files)\n sha = Digest::SHA2.new\n files.each do |f|\n next if File.directory?(f)\n\n content = File.binread(f)\n # work around possible git checkout issues by removing CR and LF from the file\n content.gsub!(\"\\n\", \"\")\n content.gsub!(\"\\r\", \"\")\n sha << content\n end\n sha.hexdigest\n end", "def list_files\n Find.find(path) do |element| yield element end\n end", "def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, type) = info.split\n hsh[file] = {:path => file, :mode_file => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_file => sha_src, :sha_index => sha_dest, :type => type}\n end\n hsh\n end", "def files\n return get_result('files')\n end", "def processFile dir\n\tdir.each do |file|\n\t\tif File.directory?(file) then next;\n\t\t\telse \n\t\t\t\th = {File.basename(file) => getHash(file)}\n\t\t\t\[email protected]!(h)\n\t\tend\n\tend\n\t@hash\nend", "def find_similar_files\n \"SELECT * FROM files \n WHERE md5 = md5 AND sha1 = sha1 AND size = size\n GROUP BY md5, sha1, size\"\n end", "def hashDirectory(directory)\n count = 0\n hash = {}\n Dir.foreach(directory) do |item|\n next if item == '.' || item == '..'\n hash[count] = item\n count = count + 1\n end\n hash\nend", "def fetch_commit_hash_list()\n `git rev-list --all --reverse`.strip.split(/\\n/)\nend", "def list\n Lib.list @path, @no_follow\n end", "def get_files_modified\r\n\tgit_result = IO.popen('git status -u --porcelain').read\r\n\tgit_result.split(/[\\r\\n]+/).uniq.map!{|file| file.slice 3..-1}\r\nend", "def enumerate_scripts\n Dir.glob(\"**/*\").\n reject { |f| File.directory?(f) }.\n select { |f| File.extname(f) == \".rb\" }.\n map do |filename|\n stat = File.stat(filename)\n\n OpenStruct.new(\n id: SecureRandom.uuid,\n path: filename,\n absolute_path: File.expand_path(filename),\n virtual_url: \"#{ROOT_URL}/#{filename}\",\n size: stat.size,\n last_modified_time: stat.mtime\n )\n end\n end", "def all_files\n @files_hash.values\n end", "def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end", "def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end", "def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end", "def files\n page = get_page\n offset = PER_PAGE * page\n get_run_logs(:limit => PER_PAGE, :offset => offset)\n end", "def retrieve_files_in_main_dir\n ensure_file_open!\n @file.glob('*').map do |entry|\n next if entry.directory?\n\n entry_file_name = Pathname.new(entry.name)\n [entry_file_name, entry.get_input_stream(&:read)]\n end.compact.to_h\n end", "def each_file\n @sftp.dir.foreach(@path.to_s) do |entry|\n filename = entry.name\n yield filename unless directory? filename\n end\n end", "def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end", "def get_ls(path)\n #repo = @repo\n #head = repo.commits.first\n #tree = head.tree @branch\n\n tree = @repo.tree @branch\n\n #strip trailing /\n path.sub! /[\\/]*$/, ''\n\n # find dir\n while !path.empty?\n tdir = tree / path\n break if tdir.is_a?(Grit::Tree)\n # strip last conponent to /\n path.sub! /(^|\\/)[^\\/]*$/, ''\n end\n\n if path.empty?\n tdir = tree\n else\n path += '/'\n end\n print \"path:\", path, \"\\n\"\n print \"tdir:\", tdir, \"\\n\"\n\n files = tdir.blobs.map do |b|\n { path: \"#{path}#{b.name}\", name: b.name, siz: b.size }\n end\n dirs = tdir.trees.map do |t|\n { path: \"#{path}#{t.name}\", name: t.name}\n end\n if !path.empty?\n dirs.push( { path: path.sub(/(^|\\/)[^\\/]*\\/$/, ''),\n name: '..'} )\n end\n\n [files, dirs, path]\n end", "def info(filename, nohash = nil)\n\tf = filename\n\tif test_file(f)\n\t\th = nohash ? (nil) : (Digest::SHA1.hexdigest(File.read(f)))\n\t\treturn [File.mtime(f), File.stat(f).mode.to_s(8).to_i, h]\n\tend\n\treturn []\nend", "def list_shares_credentialed\n file = Tempfile.new('ruby_smbclient')\n begin\n if @hashpass\n # We use PTY so we can leverage the built-in expect function to wait and enter password at proper moment\n # The output is written to tempfile thanks to our redirection in intial spawned command\n # Read results from file after and do what you need....\n PTY.spawn(\"#{@smbclient} -L #{@host} -p #{@port} --pw-nt-hash -U #{@user} > #{file.path} 2>&1\") do |read,write,pid|\n read.expect(/^Enter Administrator's password:/i, 10) do |output|\n write.puts(@pass)\n shares = read.expect(/Domain=\\[.+\\]\\s+Sharename\\s+Type\\s+Comment\\s+[-]{1,}\\s+[-]{1,}\\s+[-]{1,}\\s+(.+)\\s+Domain/m)\n end\n end\n else\n PTY.spawn(\"#{@smbclient} -L #{@host} -p #{@port} -U #{@user} > #{file.path} 2>&1\") do |read,write,pid|\n read.expect(/^Enter Administrator's password:/i, 10) do\n write.puts(@pass)\n shares = read.expect(/Domain=\\[.+\\]\\s+Sharename\\s+Type\\s+Comment\\s+[-]{1,}\\s+[-]{1,}\\s+[-]{1,}\\s+(.+)\\s+Domain/m)\n end\n end\n end\n rescue Errno::EIO\n # We will generate an error due to our piped redirection to tempfile in OS cmd\n # This simply catches it so we can continue after results are read in.....\n end\n output = File.open(file.path).readlines\n output = output.uniq\n file.unlink\n return output\n end", "def dir_list(dir)\n ls_out = ssh_cmd \"ls --color=never -1AgGF #{dir}\" # disable color, 1 file per line, all but . and .., hide owner+group, include type suffix\n result = {}\n ls_out.split(\"\\n\").each do |line|\n next unless matches = line.match(/^[\\w-]+\\s+\\d+\\s+(?<size>\\d+).*(?:\\d\\d:\\d\\d|\\d{4})\\s+(?<name>.*)$/)\n file_name = matches[:name]\n file_name = file_name[0...-1] if file_name =~ %r![*/=>@|]$!\n result[file_name.split('/')[-1]] = (matches[:name][-1] == '/' ? '/' : matches[:size].to_i)\n end\n result\n end", "def buildCodeFilesHashFromFiles()\n\t\tdir = @cacheDirPath \n\t\tfilesList = Dir.glob(dir + \"**/*\").select{|e| File.file? e}\n\t\tfilesList.map.with_index{|file,index|\n\t\t\t#p \"cacheFile: \" + index.to_s if index % 1000 == 0\n\t\t\tp \"cacheFile: \" + index.to_s \n\t\t\tfilePath = dir + index.to_s + \".yaml\"\n\t\t\tfile = File.read(filePath)\n\t\t\tYAML.load(file)\n\t\t}.to_h\n\tend", "def find_md5(dir, excludes)\n found = []\n (Dir.entries(dir) - %w[. ..]).map { |e| File.join(dir, e) }.each do |path|\n if File.directory?(path)\n unless exclude?(excludes, path)\n found += find_md5(path, excludes)\n end\n elsif File.file?(path)\n if (file = new(path))\n unless exclude?(excludes, file.path)\n file.md5 = Digest::MD5.file(file.path).hexdigest\n found << file\n end\n end\n end\n end\n found\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def fetch_md5\n # Create a hash digest for the current file.\n digest = Digest::MD5.new\n File.open(@path, 'r') do |handle|\n while buffer = handle.read(1024)\n digest << buffer\n end\n end\n digest\n end", "def each\n git.tree.each_pair(true) do |ab, xyz_tree|\n next unless ab.length == 2\n \n xyz_tree.each_pair(true) do |xyz, target_tree|\n source = \"#{ab}#{xyz}\"\n \n target_tree.keys.each do |target|\n doc_sha = assoc_sha(source, target)\n yield(doc_sha) if doc_sha\n end\n end\n end\n end", "def applicable_owners_files_hash\n return @applicable_owners_files_hash if !@applicable_owners_files_hash.nil?\n\n # Make hash of (directory => [files in that directory in this commit]) pairs\n\n puts \"changed files: #{changed_files.inspect}\"\n\n affected_dirs_hash = changed_files.collect_to_reverse_hash do |file|\n File.dirname(file)\n end\n\n puts \"affected_dirs_hash: #{affected_dirs_hash.inspect}\"\n\n affected_dirs = affected_dirs_hash.keys\n\n # Make hash of owners file => [file1, file2, file3]\n res = affected_dirs.inject(Hash.new) do |hash, dir|\n owner = find_owners_file(dir)\n\n # If there's no OWNERS file for this dir, just skip it\n if owner.nil?\n return hash\n end\n\n data = {\n :owner_data => owner,\n :files => affected_dirs_hash[dir]\n }\n\n key = owner[:path]\n\n if (hash.include?(key))\n combined_data = hash[key]\n combined_data[:files] = combined_data[:files] + data[:files]\n\n hash[key] = combined_data\n else\n hash[key] = data\n end\n hash\n end \n\n @applicable_owners_files_hash = res\n end", "def ssh_md5sum_file(file)\n df = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n df = ssh.exec! \"md5sum #{file}\"\n end\n df\n end", "def files_in_branches\n result = Mortadella::Horizontal.new headers: %w[BRANCH NAME CONTENT]\n existing_local_branches(order: :main_first).each do |branch|\n files_in(branch: branch).each do |file|\n result << [branch, file, content_of(file: file, for_sha: branch)]\n end\n end\n result.table\nend", "def ls\n table Dir.entries( Dir.pwd ).reject { |f| f.match /^\\..*$/ }\n end", "def directory_contents(path)\n\tputs ''\n\tfor i in get_dir_contents(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend", "def load_checksums\n result = []\n\n @pkgdb.query(\"select md5, sha1, sha256 from checksums where basename = '#{@basename}' and mtime = '#{@mtime.iso8601}' and suitename = '#{@suitename}'\").each do |row|\n result = row\n end\n result\n end", "def dir_contents(path, &b)\n path = Pathname.new(path).cleanpath\n if fs.directory?(path)\n entries = fs.entries(path).map do |entry|\n entry_path = path + entry\n if fs.directory?(entry_path)\n dir_item(entry)\n else\n file_item(entry, fs.get_size(entry_path))\n end\n end\n yield entries\n else\n yield Set.new\n end\n end", "def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end", "def compute_checksums data\n\n digest = OpenSSL::Digest::Digest.new('sha256')\n tree_digest = OpenSSL::Digest::Digest.new('sha256')\n tree_parts = []\n\n until data.eof?\n\n chunk = data.read(1024 * 1024) # read 1MB\n tree_parts << tree_digest.update(chunk).digest\n tree_digest.reset\n\n digest.update(chunk)\n\n end\n\n data.rewind\n\n [digest.to_s, compute_tree_hash(tree_parts)]\n\n end", "def get_current_files\n get_files(OcflTools::Utils.version_string_to_int(@head))\n end", "def file_ids_hash\n if @file_ids_hash.blank?\n # load the file sha's from cache if possible\n cache_file = File.join(self.path,'.loopoff')\n if File.exists?(cache_file)\n @file_ids_hash = YAML.load(File.read(cache_file))\n else\n # build it\n @file_ids_hash = {}\n self.loopoff_file_names.each do |f|\n @file_ids_hash[File.basename(f)] = Grit::GitRuby::Internal::LooseStorage.calculate_sha(File.read(f),'blob')\n end\n # write the cache\n File.open(cache_file,'w') do |f|\n f.puts YAML.dump(@file_ids_hash) \n end\n end \n end\n @file_ids_hash\n end", "def files\n @header.dirindexes.map { |idx|\n @header.dirnames[idx]\n }.zip(@header.basenames).map { |dir, name|\n ::File.join(dir, name)\n }.zip(@header.filesizes).map { |path, size|\n Rupert::RPM::File.new(path, size)\n }\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def enumerate_files search_path\n Enumerator.new do |e|\n Dir\n .glob(search_path)\n .each do |filename|\n if File.file?(filename)\n $stderr.puts \"Reading #{filename}\" if $verbose\n File.open filename do |file|\n e.yield file.read()\n end\n end\n end\n end\nend", "def get_digest(file, version)\n # Make a hash with each individual file as a key, with the appropriate digest as value.\n inverted = get_state(version).invert\n my_files = {}\n inverted.each do |files, digest|\n files.each do |i_file|\n my_files[i_file] = digest\n end\n end\n # Now see if the requested file is actually here.\n unless my_files.key?(file)\n raise OcflTools::Errors::FileMissingFromVersionState, \"Get_digest can't find requested file #{file} in version #{version}.\"\n end\n\n my_files[file]\n end", "def get_changed_file_list\n command = \"git log -m -1 --name-only --pretty='format:' $(git rev-parse origin/master)\"\n file_paths = []\n features = {}\n features.compare_by_identity\n\n Open3.popen3(command) do |stdin, stdout, stderr|\n files = stdout.read.gsub! \"\\n\", \",\"\n file_paths = files.split(\",\")\n puts \"Found files:\\n#{file_paths}\"\n end\n\n puts \"Count files in push: #{file_paths.count}\"\n\n file_paths.each do |file_path|\n if file_path.include?(\".feature\")\n puts \"Added: #{file_path}\"\n folder = get_name_folder_from_path file_path\n features.store(folder, file_path)\n end\n end\n\n puts \"\\n\"\n puts \"Count feature files: #{features.count}\"\n features.sort\nend", "def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end", "def find_s3_files\n output = `s3cmd ls #{self.location}/`\n output.gsub!(/DIR/,\"\")\n output.gsub!(/ +/,\" \")\n dir_listing = output.split(/\\n/)\n logger.debug(\"dir_listing #{dir_listing.inspect}\")\n files = Hash.new\n dir_listing.each do |list|\n if (list.match(/^ /)) then\n # found a directory - not going to worry about going down the directory for now\n else\n # found a file\n (date, time, size, path) = list.split(/ /)\n filename = File.basename(path).split(\"/\").last\n FILE_TYPES.each { |filepart, filehash| \n type = filehash[\"type\"]\n vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.debug( \"filename is #{filename}\")\n files[type] = Hash.new\n files[type][\"path\"] = path\n files[type][\"vendor\"] = vendor\n end\n }\n end\n end\n logger.debug(\" files is #{files.inspect}\")\n return files\n end", "def recurse_and_hash_tree(node)\n\n ## exit program if given a bunk file/dir\n print_and_exit \"given a bunk file/node\" unless File.exist? node\n\n ## if we have a file then return it's hash\n return Digest::MD5.hexdigest( node + File.read(node) ) if File.file? node\n\n ## we should have a directory now. exit otherwise...\n print_and_exit \"is there a strange device in this dir?\" unless File.directory? node\n\n ## recurse through each element in the directory and remember their hashes\n children_hash = \"\"\n Dir.glob(File.join node, '*' ) { |element| children_hash << recurse_and_hash_tree(element) }\n \n ## return the mashed up hash\n return Digest::MD5.hexdigest( node + children_hash ) \n\n end", "def read_filecache_index(filecache)\n CachedFile.reset_seq\n headers = []\n filecache.syswrite('ls')\n filecache.rewind\n filecache.each_line do |line|\n if line[0] == ?#\n headers = line.split\n headers.shift\n if headers[0] == 'filecache' then\n module_version = headers[1]\n end\n next\n end\n\n fields = {}\n tmp = line.split\n headers.each_index { |index| fields[headers[index]] = tmp[index] }\n\n file = fields['file']\n dev = fields['dev']\n next if file == '(noname)'\n if file.include? ?\\\\\n file.gsub! '\\011', \"\\011\" # ht\n file.gsub! '\\012', \"\\012\" # nl\n file.gsub! '\\040', \"\\040\" # sp\n file.gsub! '\\\\', \"\\\\\" # \\\n end\n\n if file =~ /\\([0-9a-f]{2}:[0-9a-f]{2}\\)/ then\n # handle block device\n # - transform file name from digital form to real ones\n fs = @@fstab[file.delete('(:)').hex]\n next unless fs\n file = fs.device_file\n dev = $BDEV_ID\n else\n # handle normal files\n # - expand file name to full path name\n # - ignore dirs/symlinks\n dev = dev[0,5].delete(':').hex\n fs = @@fstab[dev]\n next unless fs\n file = fs.mount_point + file unless fs.mount_point == '/'\n next unless File.file?(file)\n end\n\n cfile = CachedFile.new file\n cfile.dev = dev\n cfile.state = fields['state']\n cfile.ino = fields['ino'].to_i\n cfile.size = fields['size'].to_i\n cfile.cached = fields['cached'].to_i\n cfile.cachedp = fields['cached%'].to_i\n cfile.refcnt = fields['refcnt'].to_i\n cfile.process = fields['process']\n cfile.uid = fields['uid'].to_i\n cfile.accessed = fields['accessed'].to_i\n @cfile_by_name[file] = cfile\n end # filecache.each_line\n end", "def output_files\n get_info :output_files\n end", "def create_list_of_files\n @path=find_repository_and_basepath\n @table.window.setTitle(@path)\n files=[]\n Find.find(@path) do |file|\n # we don't want any files from a repository in the list \n next if file=~/(\\.hg|\\.svn|\\.git|\\.pyc)/ \n\n # neither do we want dotfiles in the list\n next if File.basename(file)=~/^\\./ \n \n # file matches, add it to the resulting list\n files << file if FileTest.file?(file)\n\n # wir bauen hier mal einen kleinen Idiotentest ein. Wenn wir mehr\n # als 10000 Dateien gefunden haben dann sind wir vermtl. in einem \n # falschen Verzeichniss und brechen die Suche ab.\n if files.length>10000\n NSRunInformationalAlertPanel('Large directory found!',\n \"Gathered more than 10k files from directory '#{@path}', aborting search!\",'OK',nil,nil)\n NSApp.stop(self)\n raise 'error'\n end\n end\n #@files=files.sort_by { |match| File.basename(match) }\n @files=files.sort\n end", "def tag_manifested_files\n tagmanifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n path\n end\n }\n (acc + files).uniq\n end\n end", "def vagrant_virtualbox_mastervms_guid\n Dir[\"#{vagrant_home}/boxes/**/virtualbox/master_id\"].map do |path|\n read_file(path)\n end\nend", "def get_files(version)\n my_state = get_state(version)\n my_files = {}\n\n my_state.each do |digest, filepaths| # filepaths is [Array]\n filepaths.each do |logical_filepath|\n # look up this file via digest in @manifest.\n physical_filepath = @manifest[digest]\n # physical_filepath is an [Array] of files, but they're all the same so only need 1.\n my_files[logical_filepath] = physical_filepath[0]\n end\n end\n my_files\n end", "def file_get_files(directories) \n directory = \"\"\n files = []\n directories.each do |directory| \n unless directory == \"/root\"\n Dir.chdir(\"#{directory}\") \n Dir.foreach(\"#{directory}\") do |d| \n files.push(d) unless d == \".\" || d == \"..\" \n end\n @file_information.store(directory, files)\n files = []\n end\n end\n return @file_information\n end", "def all\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n files(-1)\n end", "def dir_git(git,branch='master',reg=nil)\n path = http_uri + git + '/trees/master' \n raw = raw_file(path)\n # find all files\n array = Array.new\n reg = Regexp.new(reg) if reg.is_a?(String)\n raw.scan(/file.*\\n.*<a href=\"\\/.*>(.*)<\\/a>.*<\\/td>/) do |name|\n if reg\n array << name.to_s if name.to_s.match(reg)\n else \n array << name.to_s\n end\n end\n return array\n end", "def get_checksums(gf_pid, gf_identifier)\n query = \"SELECT algorithm, datetime, digest, generic_file_id \" +\n \"FROM checksums where generic_file_id = ?\"\n if @checksum_query.nil?\n @checksum_query = @db.prepare(query)\n end\n checksums = []\n result_set = @checksum_query.execute(gf_pid)\n result_set.each_hash do |row|\n cs = {}\n cs['algorithm'] = row['algorithm']\n cs['datetime'] = row['datetime']\n cs['digest'] = row['digest']\n checksums.push(cs)\n end\n checksums\n end", "def files\n i = 0\n @@arr_path.each do |path|\n if path.include?(params[:fold])\n # Remove path from current path\n @@arr_path = @@arr_path[0..i]\n @path = ''\n\n @@arr_path.each do |e| # Put path from array to @path\n @path = @path + e + ' >> '\n end\n @@temp_path = @path\n\n # Get content: folders, file, count\n @content = BrowsingFile.bind_folder params[:fold]\n @file = BrowsingFile.bind_files params[:fold]\n\n render 'index' # Reload index page\n return\n end\n i += 1\n end\n end", "def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend", "def hash *args, &block\n command \"hash\", args.join(\"/\"), &block\n end", "def generate_hexdigest_indexed_list(size_indexed_list, head_size = nil)\n result = {}\n size_indexed_list.each_pair{|old_key, filename_arr|\n filename_arr.each{|filename|\n if head_size == nil\n $stdout.puts \"SHA512 hash calculation: #{filename}\"\n else\n $stdout.puts \"Header (#{head_size}) SHA512 hash calculation: #{filename}\"\n end\n\n hexdigest = get_file_header_sha512(filename, head_size)\n\n if result.has_key?(hexdigest) == false\n result[hexdigest] = []\n end\n result[hexdigest].push(filename)\n }\n }\n return result\nend", "def checksum\n render json: content_files_checksums(druid).to_json\n end" ]
[ "0.6758", "0.636422", "0.60122323", "0.59544075", "0.5839591", "0.5820808", "0.5805336", "0.57254446", "0.57254446", "0.57133675", "0.5705163", "0.56717473", "0.5663655", "0.56469375", "0.562107", "0.5612269", "0.55898225", "0.5586432", "0.5569841", "0.5569841", "0.5546227", "0.5488847", "0.54710966", "0.5469727", "0.5445307", "0.5437286", "0.54140866", "0.54078627", "0.53977746", "0.5377749", "0.5376938", "0.53724265", "0.53665787", "0.5356099", "0.533524", "0.5333821", "0.5329934", "0.5327259", "0.5322953", "0.5322758", "0.531788", "0.5302125", "0.52969754", "0.5296804", "0.5286923", "0.52835554", "0.52773255", "0.52767146", "0.52620393", "0.5249978", "0.5249023", "0.52442914", "0.52442914", "0.5243405", "0.52343667", "0.5234088", "0.5228809", "0.52287203", "0.5216139", "0.5202668", "0.5200473", "0.51972693", "0.51929206", "0.51905197", "0.51870954", "0.51834637", "0.5170529", "0.51684237", "0.51491153", "0.5149023", "0.5135825", "0.51219934", "0.5120385", "0.5114682", "0.51017433", "0.5100259", "0.5096448", "0.5086495", "0.5079415", "0.507728", "0.5068088", "0.50675386", "0.50658125", "0.5065546", "0.5065403", "0.5055222", "0.50406486", "0.5039962", "0.5039299", "0.503549", "0.50324297", "0.5028272", "0.50276333", "0.5014526", "0.5014453", "0.50142837", "0.50070035", "0.5004527", "0.50027555", "0.50002867" ]
0.76697594
0
List all files within the base directory to stdout N Without this, we wouldn't have a way to list what files are currently in the target directory on the remote host (i.e. if we wanted to see what files where currently there)
def listFiles(baseDir) #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths baseDir = normalisedDir(baseDir) #N Without this we wouldn't be executing the command to list all files in the remote directory ssh(findFilesCommand(baseDir).join(" ")) do |line| #N Without this we wouldn't be echoing the file name on this line for the user to read puts " #{line}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end", "def list_files\n [].tap do |files|\n remote_files do |file|\n files << file\n end\n end\n end", "def list(client, current_path)\n\n\tfiles = Dir.glob(\"#{current_path}/files/*\")\n\tclient.puts \"\\nList of Files:\"\n\tfiles.each{ |file|\n\tfile.slice! \"#{current_path}/files/\"}\n\tclient.puts files\n\nend", "def get_remote_files\n manager = @current_source.file_manager\n manager.start do \n @current_source.folders.each do |folder|\n @files[folder] = manager.find_files folder\n @files[folder] = @files[folder].take(@take) if @take\n Logger.<<(__FILE__,\"INFO\",\"Found #{@files[folder].size} files for #{@current_source.base_dir}/#{folder} at #{@current_source.host.address}\")\n SignalHandler.check\n end\n end\n end", "def list_files\n files = remote_directory.files.map { |file| file.key }\n\n # The first item in the array is only the path an can be discarded.\n files = files.slice(1, files.length - 1) || []\n\n files\n .map { |file| Pathname.new(file).basename.to_s }\n .sort\n .reverse\n end", "def files_remote_list(options = {})\n options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]\n if block_given?\n Pagination::Cursor.new(self, :files_remote_list, options).each do |page|\n yield page\n end\n else\n post('files.remote.list', options)\n end\n end", "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end", "def display_files(pathname)\n # `find` doesn't follow symlinks, so we should instead\n realpath = ArduinoCI::Host.symlink?(pathname) ? ArduinoCI::Host.readlink(pathname) : pathname\n\n # suppress directories and dotfile-based things\n all_files = realpath.find.select(&:file?)\n non_hidden = all_files.reject { |path| file_is_hidden_somewhere?(path) }\n\n # print files with an indent\n puts \" Files (excluding hidden files): #{non_hidden.size}\"\n non_hidden.each { |p| puts \" #{p}\" }\nend", "def list\n Lib.list @path, @no_follow\n end", "def findFilesCommand(baseDir)\n #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type f' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?)\n return [\"#{@pathPrefix}find\", baseDir, \"-type\", \"f\", \"-print\"]\n end", "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "def list_all_files_in_dir(target)\n all = Pathname.new(target).children\n dirs = all.select { |c| c.directory? }\n dirs.each do |d|\n Puppet.debug(\"Ignoring directory #{d.to_s}\")\n end\n all.select { |c| c.file? }\n end", "def list(directory = nil)\n @ftp.nlst(directory)\n end", "def all_files; end", "def all_files; end", "def ls\n Dir.entries(@working_dir)\n end", "def get_file_listing\n execute!(drive.files.list).data\n end", "def files\n page = get_page\n offset = PER_PAGE * page\n get_run_logs(:limit => PER_PAGE, :offset => offset)\n end", "def ls( *args )\r\n \r\n directory = nil\r\n opts = {}\r\n \r\n case args.count\r\n when 1\r\n if args[0].kind_of? Hash\r\n opts = args[0]\r\n else\r\n directory = args[0]\r\n end\r\n when 2\r\n directory = args[0]\r\n opts = args[1] \r\n end\r\n \r\n # args are the RPC arguments ...\r\n args = {}\r\n args[:path] = directory if directory\r\n args[:recursive] = true if opts[:recurse]\r\n args[:detail] = true if opts[:detail] \r\n args.delete(:detail) if( args[:detail] and args[:recursive])\r\n \r\n # RPC output format, default is XML\r\n outf = { :format => 'text' } if opts[:format] == :text\r\n \r\n got = @ndev.rpc.file_list( args, outf )\r\n return nil unless got\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n # if we're here, then we need to conver the output \r\n # to a Hash. Joy!\r\n \r\n collect_detail = args[:detail] || args[:recursive]\r\n \r\n ls_hash = {}\r\n got.xpath('directory').each do |dir|\r\n \r\n dir_name = dir.xpath('directory-name').text.strip\r\n dir_hash = {}\r\n \r\n dir_hash[:fileblocks] = dir.xpath('total-file-blocks').text.to_i\r\n files_info = dir.xpath('file-information')\r\n \r\n dir_hash[:files] = {} \r\n dir_hash[:dirs] = {} # sub-directories\r\n \r\n files_info.each do |file|\r\n f_name = file.xpath('file-name').text.strip\r\n f_h = {} \r\n \r\n if file.xpath('file-directory')[0]\r\n dir_hash[:dirs][f_name] = f_h\r\n else\r\n dir_hash[:files][f_name] = f_h \r\n end\r\n \r\n next unless collect_detail\r\n \r\n f_h[:owner] = file.xpath('file-owner').text.strip\r\n f_h[:group] = file.xpath('file-group').text.strip\r\n f_h[:links] = file.xpath('file-links').text.to_i\r\n f_h[:size] = file.xpath('file-size').text.to_i\r\n \r\n xml_when_item(file.xpath('file-symlink-target')) { |i|\r\n f_h[:symlink] = i.text.strip\r\n }\r\n \r\n fp = file.xpath('file-permissions')[0]\r\n f_h[:permissions_text] = fp.attribute('format').value\r\n f_h[:permissions] = fp.text.to_i\r\n \r\n fd = file.xpath('file-date')[0]\r\n f_h[:date] = fd.attribute('format').value\r\n f_h[:date_epoc] = fd.text.to_i\r\n \r\n end # each directory file\r\n ls_hash[ dir_name ] = dir_hash \r\n end # each directory\r\n \r\n return nil if ls_hash.empty?\r\n ls_hash\r\n end", "def listCmd(cmdSock, sock)\n\tputs \"Client sent a list command\"\n\t#get all files from the directory but ignore hidden . and ..\n\tpath = File.expand_path(\"..\", Dir.pwd) + \"/testFiles\"\n\tdirFiles = Dir.entries(path).reject{|entry| entry == \".\" || entry ==\"..\"}\n\t#tell the client how many files there are\n\tnumFiles = dirFiles.length\n\tcmdSock.puts(numFiles)\n\tputs \"Sent # of files to client\"\n\t#for each file in the directoy\n\tfor fileName in dirFiles\n\t\t#send the filename\n\t\tsock.puts(fileName)\n\tend\n\tputs \"Sent all file names\"\nend", "def visible_files\n result = []\n for dir in @dirs\n result += visible_files_under(dir)\n end\n return result\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end", "def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end", "def ls\n table Dir.entries( Dir.pwd ).reject { |f| f.match /^\\..*$/ }\n end", "def list_files\n User.sync_files!(@context)\n files = user_real_files(params, @context)\n\n if unsafe_params[:limit] && unsafe_params[:offset]\n files = files.limit(unsafe_params[:limit]).offset(unsafe_params[:offset])\n end\n\n search_string = params[:search_string].presence || \"\"\n\n result = files.eager_load(:license, user: :org).\n where(\"nodes.name LIKE ?\", \"%#{search_string}%\").\n order(id: :desc).map do |file|\n describe_for_api(file, unsafe_params[:describe])\n end.compact\n\n render json: unsafe_params[:offset]&.zero? ? { objects: result, count: result.length } : result\n end", "def list_files_from path,opts = {}\n unless Dir.exists? path\n Logger.<<(__FILE__,\"ERROR\",\"Local fetcher: path does not exists for listing... #{path} \")\n raise \"Error LocalFileFetcher !\"\n end\n if opts[:directories]\n cmd = \"ls -td #{path}/*/\"\n else\n cmd = \"ls #{path}\"\n cmd += \"/#{opts[:regexp]}\" if opts[:regexp]\n end\n out = `#{cmd}`\n return out.split(\"\\n\")\n end", "def list(msg) # :yields: nil\n response \"125 Opening ASCII mode data connection for file list\"\n send_data(`ls -l`.split(\"\\n\").join(LNBR) << LNBR)\n \"226 Transfer complete\"\n end", "def files\n return get_result('files')\n end", "def files(treeish = nil)\n tree_list(treeish || @ref, false, true)\n end", "def display_all_files(project)\r\n @server.projects.each{ |p|\r\n next if project != '*' and project != p.name\r\n puts p.name\r\n p.views.each { |v|\r\n puts \"== View == #{v.name}\"\r\n display_folder(v.rootfolder,2)\r\n }\r\n }\r\n end", "def list(current_folder)\n # Ensure API availability\n api.call(\"system\", \"greet\")\n\n api.call(files_project, \"listFolder\", { folder: current_folder, only: 'folders' })\n end", "def cmd_list(param)\n send_unauthorised and return unless logged_in?\n send_response \"150 Opening ASCII mode data connection for file list\"\n\n param = '' if param.to_s == '-a'\n\n dir = File.join(@name_prefix.to_s, param.to_s)\n\n now = Time.now\n\n items = list_dir(build_path(param))\n lines = items.map do |item|\n \"#{item.directory ? 'd' : '-'}#{item.permissions || 'rwxrwxrwx'} 1 #{item.owner || 'owner'} #{item.group || 'group'} #{item.size || 0} #{(item.time || now).strftime(\"%b %d %H:%M\")} #{item.name}\"\n end\n send_outofband_data(lines)\n # send_action_not_taken\n end", "def target_files_in_dir(base_dir = Dir.pwd)\n # Support Windows: Backslashes from command-line -> forward slashes\n base_dir = base_dir.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR\n all_files = find_files(base_dir, File::FNM_DOTMATCH)\n # use file.include? for performance optimization\n hidden_files = all_files.select { |file| file.include?(HIDDEN_PATH_SUBSTRING) }\n base_dir_config = @config_store.for(base_dir)\n\n target_files = all_files.select do |file|\n to_inspect?(file, hidden_files, base_dir_config)\n end\n\n target_files.sort_by!(&order)\n end", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def listFileHashLines(baseDir)\n #N Without this, the base directory might be missing the final '/', which might cause a one-off error when 'subtracting' the base directory name from the absolute paths to get relative paths\n baseDir = normalisedDir(baseDir)\n #N Without this, we wouldn't know what command to run remotely to loop over the output of the file-files command and run the hash command on each line of output\n remoteFileHashLinesCommand = findFilesCommand(baseDir) + [\"|\", \"xargs\", \"-r\"] + @hashCommand.command\n #N Without this we wouldn't actually run the command just defined\n ssh(remoteFileHashLinesCommand.join(\" \")) do |line| \n #N Without this the line of output wouldn't be echoed to the user\n puts \" #{line}\"\n #N Without this the line of output (with a file name and a hash value) wouldn't be available to the caller of this method\n yield line \n end\n end", "def all\n @files\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def index(base_path, glob = nil)\n\t\tglob = '*' if glob == '' or glob.nil?\n\t\tdirs = []\n\t\tfiles = []\n\t\t::Dir.chdir(base_path) do\n\t\t\t::Dir.glob(glob).each do |fname|\n\t\t\t\tif ::File.directory?(fname)\n\t\t\t\t\tdirs << fname + '/'\n\t\t\t\telse\n\t\t\t\t\tfiles << fname\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdirs.sort + files.sort\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, base_path\n\tend", "def files\n i = 0\n @@arr_path.each do |path|\n if path.include?(params[:fold])\n # Remove path from current path\n @@arr_path = @@arr_path[0..i]\n @path = ''\n\n @@arr_path.each do |e| # Put path from array to @path\n @path = @path + e + ' >> '\n end\n @@temp_path = @path\n\n # Get content: folders, file, count\n @content = BrowsingFile.bind_folder params[:fold]\n @file = BrowsingFile.bind_files params[:fold]\n\n render 'index' # Reload index page\n return\n end\n i += 1\n end\n end", "def all_files\n @all_files ||= `git ls-files 2> /dev/null`.split(\"\\n\")\n end", "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n\n result = Overcommit::Utils.execute(%W[git ls-tree --name-only #{ref}], args: paths)\n unless result.success?\n raise Overcommit::Exceptions::Error,\n \"Error listing files. EXIT STATUS(es): #{result.statuses}.\\n\" \\\n \"STDOUT(s): #{result.stdouts}.\\n\" \\\n \"STDERR(s): #{result.stderrs}.\"\n end\n\n result.stdout.split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def cmd_nlst(param)\n send_unauthorised and return unless logged_in?\n send_response \"150 Opening ASCII mode data connection for file list\"\n\n files = list_dir(build_path(param))\n send_outofband_data(files.map { |f| f.name })\n end", "def files_list(params = {})\n response = @session.do_post \"#{SCOPE}.list\", params\n Slack.parse_response(response)\n end", "def list_files_to_be_processed(filenames, dest_name)\n unless filenames.empty?\n puts \"\\r\\n - #{dest_name} diffs to be processed:\"\n filenames.each { |filename| puts \" #{filename}\" }\n end\n end", "def all\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n files(-1)\n end", "def list(msg)\n response \"125 Opening ASCII mode data connection for file list\"\n send_data(`ls -l`.split(\"\\n\").join(LBRK) << LBRK)\n \"226 Transfer complete\"\n end", "def list_files_from (path,opts = {})\n safe_fetch do\n list_files = Set.new\n var = \"Search in #{path} at #{@host}... \"\n cmd = \"find #{path}\"\n cmd = \"(cd #{path} && ls \" ### dont know why cd alone doesn't work\n cmd << \"-td */\" if opts[:directories]\n cmd << opts[:regexp] if opts[:regexp]\n cmd << \" 2>/dev/null)\"\n out = @ssh.exec!(cmd)\n list_files = out.split\n list_files = out.split(\"/\\n\") if opts[:directories]\n\n var << \"Found #{list_files.size} entries\\n\"\n Logger.<<(__FILE__,\"INFO\",var)\n list_files\n end\n end", "def index\n @nthfiles = Nthfile.all\n end", "def filelist\n puts_message \"filelist start\" \n\n user = current_user\n\n request = params[:request].force_encoding(\"UTF-8\")\n puts_message \"Requested Path: \" + params[:request]\n \n if user and check_existance_of_path(request) \n if request == nil\n @file_names = 'error'\n elsif request_is_directory?(request)\n fire_the_list(request)\n # @file_names = absolute_path(request)\n elsif request_is_file?(request)\n last = request.split('/').last\n path = absolute_path(request)\n send_file_info(last, request) \n else\n @file_names = 'error'\n end\n else \n @file_names = 'error'\n end\n\n puts_message \"filelist end\" \n \n @output = <<-END\n\n END\n \n if request == \"/images/\"\n @folders = Folder.all(:user_id => current_user.id)\n \n @output << \"photo\" + \"\\n\"\n \n @folders.each do |f|\n @output << f.name + \"\\n\"\n end\n \n @file_names = @output\n end\n \n return @file_names\n\n end", "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n `git ls-tree --name-only #{ref} #{paths.join(' ')}`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def test_getfilelist\n server = nil\n testdir, pattern, tmpfile = mktestdir\n\n file = nil\n\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n assert_nothing_raised {\n server.mount(testdir, \"test\")\n }\n\n # get our listing\n list = nil\n sfile = \"/test/tmpfile\"\n assert_nothing_raised {\n list = server.list(sfile, :manage, true, false)\n }\n\n output = \"/\\tfile\"\n\n # verify it got listed as a file\n assert_equal(output, list)\n\n # verify we got all fields\n assert(list !~ /\\t\\t/)\n\n # verify that we didn't get the directory itself\n list.split(\"\\n\").each { |line|\n assert(line !~ %r{remotefile})\n }\n\n # and then verify that the contents match\n contents = File.read(tmpfile)\n\n ret = nil\n assert_nothing_raised {\n ret = server.retrieve(sfile)\n }\n\n assert_equal(contents, ret)\n end", "def files(*args)\r\n LocalDirectory.current.files(*args)\r\n end", "def log_files\n raise \"no log host specified for #{self}\" unless log_host\n raise \"no log file patterns specified for #{self}\" unless log_file_patterns\n\n redirect_stderr = $DEBUG ? '' : '2>/dev/null'\n command = \"ssh -oClearAllForwardings=yes '#{host}' 'sudo sh -c \\\"ls -1 #{log_file_patterns.join ' '} #{redirect_stderr}\\\"' #{redirect_stderr}\"\n\n `#{command}`.split(\"\\n\")\n end", "def listCmd (cmdSock, sock)\n\tcmdSock.puts('LIST')\n\tnumFiles = cmdSock.gets.chomp\n\ti = 0\n\tif numFiles == 0\n\t\tputs \"No files available in the servers current file directory, try sending some files.\"\n\telse\n\t\trun = 1\n\t\twhile run == 1\n\t\t\ti += 1\n\t\t\tfName = sock.gets.chomp\n\t\t\tout = i.to_s + \") \" + fName\n\t\t\tputs out\n\t\t\tif i == numFiles.to_i\n\t\t\t\trun = 0\n\t\t\tend\n\t\tend\n\t\tputs \"End of list\"\n\tend\nend", "def list_files\n fail('Requires implementation')\n end", "def list\n FileOperations.find_all(self)\n end", "def output_files\n get_info :output_files\n end", "def info_files\n @queue << \"i f\"\n end", "def find_files(base_dir, flags); end", "def get_current_files\n get_files(OcflTools::Utils.version_string_to_int(@head))\n end", "def describe\n f = file!\n puts \"Current target: #{f.basename}\"\n puts '*' * 70\n File.open(f).each do |line|\n puts \" #{line}\"\n end\n puts '*' * 70\n end", "def all_files_in(dir_name)\n Nanoc::FilesystemTools.all_files_in(dir_name)\n end", "def ls_report_dir(branch = proj_branch)\n files = proj.show(report_branch, report_path(branch)).split(\"\\n\")\n files.shift(2)\n files\n end", "def print_all(f)\n # print the whole files\n puts f.read\n # end of function block\nend", "def get_list(dir = nil)\n @ftp.ls(dir)[3..-1]\n end", "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "def list_files(dir)\n # Getting all the files names in the directory\n file_names = Dir[dir + \"*\"]\n\n return file_names\n\nend", "def target_files_in_dir(base_dir = T.unsafe(nil)); end", "def listDirectories\n return contentHost.listDirectories(baseDir)\n end", "def files options = {}\n ensure_connection!\n resp = connection.list_files name, options\n if resp.success?\n File::List.from_resp resp, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "def list_files dir='*', sorto=@sorto, hidden=@hidden, _filter=@filterstr\n dir += '/*' if File.directory?(dir)\n dir = dir.gsub('//', '/')\n\n # decide sort method based on second character\n # first char is o or O (reverse)\n # second char is macLn etc (as in zsh glob)\n so = sorto ? sorto[1] : nil\n func = case so\n when 'm'\n :mtime\n when 'a'\n :atime\n when 'c'\n :ctime\n when 'L'\n :size\n when 'n'\n :path\n when 'x'\n :extname\n end\n\n # sort by time and then reverse so latest first.\n sorted_files = if hidden == 'D'\n Dir.glob(dir, File::FNM_DOTMATCH) - %w[. ..]\n else\n Dir.glob(dir)\n end\n\n # WARN: crashes on a deadlink since no mtime\n if func\n sorted_files = sorted_files.sort_by do |f|\n if File.exist? f\n File.send(func, f)\n else\n sys_stat(func, f)\n end\n end\n end\n\n sorted_files.sort! { |w1, w2| w1.casecmp(w2) } if func == :path && @ignore_case\n\n # zsh gives mtime sort with latest first, ruby gives latest last\n sorted_files.reverse! if sorto && sorto[0] == 'O'\n\n # add slash to directories\n sorted_files = add_slash sorted_files\n # return sorted_files\n @files = sorted_files\n calculate_bookmarks_for_dir # we don't want to override those set by others\nend", "def list_files(dir)\n# Getting all the files names in the directory\n file_names = Dir[dir + \"*\"]\n return file_names\nend", "def file_list\n end", "def select_all\n dir = Dir.pwd\n # check this out with visited_files TODO FIXME\n @selected_files = @view.map { |file| File.join(dir, file) }\n message \"#{@selected_files.count} files selected.\"\nend", "def all_files\n loc_pat = File.join(@base, '**/*')\n Dir.glob(loc_pat, File::FNM_DOTMATCH)\n .select { |e| File.file?(e) }\n .map { |f| f[@base.size + 1..-1] }\n end", "def files_remote_info(options = {})\n post('files.remote.info', options)\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def file_name_list\n @target.source_build_phase.file_display_names\n end", "def list\n BakFile.where('saved = ?', true).each do |file|\n Log.instance.info(\"#{file.fid},#{file.dkey},#{file.length},#{file.classname}\")\n break if SignalHandler.instance.should_quit\n end\n end", "def list_files_in_directory(dir, options)\n normalized_file_list(options, Dir.glob(File.join(dir, \"*\")), false, options.exclude)\n end", "def index\n Dir[\"#{@base_path}/*.json\"].map{|p| File.basename(p)}\n end", "def list\n \tputs \"The list of backups for #{self.name}\"\n \tself.each do |bck|\n \t puts bck.filepath\n \tend\n end", "def find_files\n @files = []\n\n Dir.foreach(configured_file_path) do |file_name|\n next if file_name == '.' || file_name == '..'\n next if file_name =~ /^\\./ && Ferver.configuration.serve_hidden == false\n\n found_file = FoundFile.new(configured_file_path, file_name)\n @files << found_file if found_file.valid?\n end\n end", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def list(path='root')\n puts \"#list('#{path}')\"\n listed_files =[]\n @drive.folder = path\n children = @drive.children\n list_files_metadata(children)\n raise 'There are no files in directory' if children.count < 1\n children.each do |item|\n listed_files << \"#{item.path.gsub('/drive/', 'drive/')}/#{item.name}\" unless item.folder?\n end\n @logger.info 'Children list acquired.'\n pp listed_files\n end", "def ls(filename)\n if File.directory?(filename)\n puts(Dir['./' + filename + '/*'])\n elsif File.file?(filename)\n puts(filename)\n else \n puts(\"error\")\n end\nend", "def list_files_in_directory dir\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list files, false, @options.exclude\n end", "def list_all_in_current_directory\n Dir.glob('**/*').sort\nend", "def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end", "def index\n @ftpfiles = Ftpfile.all\n end", "def listFileHashes\n return contentHost.listFileHashes(baseDir)\n end", "def listDirectories(baseDir)\n #N if un-normalised, code assuming '/' at the end might be one-off\n baseDir = normalisedDir(baseDir)\n #N without the command, we don't know what command to execute to list the directories\n command = findDirectoriesCommand(baseDir)\n #N without this, the command won't execute, or we it might execute in a way that doesn't let us read the output\n output = getCommandOutput(command)\n #N without initial directories, we would have nowhere to accumulate the directory relative paths\n directories = []\n #N without the base dir length, we don't know how much to chop off the path names to get the relative path names\n baseDirLen = baseDir.length\n #N without this, would not get feedback that we are listing directories (which might be a slow remote command)\n puts \"Listing directories ...\"\n #N without looping over the output, we wouldn't be reading the output of the listing command\n while (line = output.gets)\n #N without chomping, eoln would be included in the directory paths\n line = line.chomp\n #N without this, would not get feedback about each directory listed\n puts \" #{line}\"\n #N without this check, unexpected invalid output not including the base directory would be processed as if nothing had gone wrong\n if line.start_with?(baseDir)\n #N without this, the directory in this line of output wouldn't be recorded\n directories << line[baseDirLen..-1]\n else\n #N if we don't raise the error, an expected result (probably a sign of some important error) would be ignored\n raise \"Directory #{line} is not a sub-directory of base directory #{baseDir}\"\n end\n end\n #N if we don't close the output, then un-opened output stream objects will accumulate (and leak resources)\n output.close()\n #N if we don't check the process status, then a failed command will be treated as if it had succeeded (i.e. as if there were no directories found)\n checkProcessStatus(command)\n return directories\n end", "def tree\n # Caution: use only for small projects, don't use in root.\n @title = 'Full Tree'\n # @files = `zsh -c 'print -rl -- **/*(#{@sorto}#{@hidden}M)'`.split(\"\\n\")\n @files = Dir['**/*']\n message \"#{@files.size} files.\"\nend", "def index\n # Fetches space files.\n respond_with_space_files && return if params[:space_id]\n\n # Fetches all user 'private' files.\n filter_tags = params.dig(:filters, :tags)\n\n files = UserFile.\n real_files.\n editable_by(@context).\n accessible_by_private.\n where.not(parent_type: [\"Comparison\", nil]).\n includes(:taggings).\n eager_load(user: :org).\n search_by_tags(filter_tags)\n\n return render(plain: files.size) if show_count\n\n files = files.where(parent_folder_id: @parent_folder_id)\n files = FileService::FilesFilter.call(files, params[:filters])\n\n folders = private_folders(@parent_folder_id).includes(:taggings).\n eager_load(user: :org).search_by_tags(filter_tags)\n folders = FileService::FilesFilter.call(folders, params[:filters])\n\n user_files = Node.eager_load(user: :org).where(id: (files + folders).map(&:id)).\n order(order_params).page(page_from_params).per(page_size)\n page_dict = pagination_dict(user_files)\n\n render json: user_files, root: \"files\", adapter: :json,\n meta: files_meta.\n merge(count(UserFile.private_count(@context.user))).\n merge({ pagination: page_dict })\n end", "def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end", "def fls(file)\n end", "def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend", "def ls(path = '/')\n agency = options[:agency]\n ::Taxi::SFTP.new(agency).print_ls(path)\n end" ]
[ "0.71905494", "0.6553604", "0.64859414", "0.6302285", "0.6161784", "0.6137971", "0.608298", "0.60754967", "0.6050267", "0.5998176", "0.5972664", "0.59714186", "0.5927817", "0.5909759", "0.5909759", "0.59042823", "0.5853349", "0.5811345", "0.578424", "0.5782921", "0.57507265", "0.5750051", "0.5750051", "0.57261413", "0.5723776", "0.5707256", "0.57052755", "0.56868005", "0.56771487", "0.56657416", "0.5664804", "0.56642556", "0.5659728", "0.5645659", "0.56455576", "0.5644943", "0.5644549", "0.56391954", "0.5635556", "0.5624233", "0.56147856", "0.56120765", "0.56081265", "0.5581613", "0.55773634", "0.55697525", "0.55687803", "0.556254", "0.55547136", "0.55528086", "0.555238", "0.55459833", "0.55306506", "0.55111384", "0.55069625", "0.54949474", "0.5485979", "0.5480265", "0.54787415", "0.54758734", "0.54742736", "0.54506993", "0.5438565", "0.5434167", "0.5429433", "0.5427557", "0.5419653", "0.54106957", "0.5404951", "0.53971577", "0.5390298", "0.5388702", "0.53884166", "0.53817475", "0.53778976", "0.5373638", "0.5363768", "0.53542507", "0.53530806", "0.53515166", "0.53497064", "0.5346567", "0.53446287", "0.53440076", "0.53433293", "0.53349555", "0.53112173", "0.53062874", "0.530086", "0.5297509", "0.52870566", "0.5286971", "0.5282242", "0.5276546", "0.527581", "0.527239", "0.5267409", "0.52616525", "0.52459425", "0.52430004" ]
0.74977964
0
N Without this we can't construct an object representing our initial knowledge of a file that exists (and which we might later decide to mark for copying or for deletion)
def initialize(name, hash, parentPathElements) #N Without this we won't remember the name of the file @name = name #N Without this we won't know the hash of the contents of the file @hash = hash #N Without this we won't know the path elements of the sub-directory (within the directory tree) containing the file @parentPathElements = parentPathElements #N Without this the file object won't be in a default state of _not_ to be copied @copyDestination = nil #N Without this the file object won't be in a default state of _not_ to be deleted @toBeDeleted = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(filename, mode=\"r\", perm=0) end", "def initialize(file_name)\n create(file_name)\n end", "def existing_files; end", "def newobj(type, name, hash)\n transport = Puppet::TransObject.new(name, \"file\")\n transport[:path] = path\n transport[:ensure] = \"file\"\n assert_nothing_raised {\n file = transport.to_ral\n }\n end", "def initialize(path_or_io, create = false, buffer = false, options = {})\n super()\n options = DEFAULT_OPTIONS.merge(options)\n @name = path_or_io.respond_to?(:path) ? path_or_io.path : path_or_io\n @comment = ''\n @create = create ? true : false # allow any truthy value to mean true\n\n if ::File.size?(@name.to_s)\n # There is a file, which exists, that is associated with this zip.\n @create = false\n @file_permissions = ::File.stat(@name).mode\n\n if buffer\n read_from_stream(path_or_io)\n else\n ::File.open(@name, 'rb') do |f|\n read_from_stream(f)\n end\n end\n elsif buffer && path_or_io.size > 0\n # This zip is probably a non-empty StringIO.\n read_from_stream(path_or_io)\n elsif @create\n # This zip is completely new/empty and is to be created.\n @entry_set = EntrySet.new\n elsif ::File.zero?(@name)\n # A file exists, but it is empty.\n raise Error, \"File #{@name} has zero size. Did you mean to pass the create flag?\"\n else\n # Everything is wrong.\n raise Error, \"File #{@name} not found\"\n end\n\n @stored_entries = @entry_set.dup\n @stored_comment = @comment\n @restore_ownership = options[:restore_ownership]\n @restore_permissions = options[:restore_permissions]\n @restore_times = options[:restore_times]\n end", "def initialize myFileName\n\t\t@handle = File.new(myFileName, \"r\")\n\tend", "def file\n FileFactory.new(self)\n end", "def test_fileobject\n prov = mkprovider\n\n path = tempfile\n obj = nil\n assert_nothing_raised do\n obj = prov.target_object(path)\n end\n\n # The default filetype is 'ram'\n assert_instance_of(Puppet::Util::FileType.filetype(:ram), obj)\n\n newobj = nil\n assert_nothing_raised do\n newobj = prov.target_object(path)\n end\n\n assert_equal(obj, newobj, \"did not reuse file object\")\n\n # now make sure clear does the right thing\n assert_nothing_raised do\n prov.clear\n end\n assert_nothing_raised do\n newobj = prov.target_object(path)\n end\n\n assert(obj != newobj, \"did not reuse file object\")\n end", "def initialize (mp3File, nameFile)\n if File.exists?(mp3File)\n @mp3 = mp3File\n else\n puts \"File #{mp3File} does not exist!\"\n end\n \n if File.exists?(nameFile)\n if File.readable?(nameFile)\n @file = File.open(nameFile)\n @filename = nameFile\n else \n puts \"File is not readable! Are the permissions correct? :(\"\n end\n \n else\n puts \"File #{nameFile} does not exist!\"\n end\n end", "def create_from_file\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file() nil; end", "def initialize(pth=nil, priv=nil, own=nil, grp=nil)\n # duplicat instance if initilize is called with an instance as the first argument\n if pth.is_a?(UFS::FS::File) || pth.is_a?(UFS::FS::Dir)\n priv = pth.permissions\n own = pth.owner\n grp = pth.group\n pth = pth.path\n end\n self.path = ::File.expand_path(pth) unless pth.nil?\n self.permissions = priv unless priv.nil?\n self.owner = own unless own.nil?\n self.group = grp unless grp.nil?\n end", "def initialize(object, file)\n super(object, file)\n @name = object.name\n end", "def initialize(object, file)\n super(object, file)\n @name = object.name\n end", "def basic_file_object(path)\n bf = BasicFile.new\n file = File.open(path)\n raise 'file cannot be nil!' if file.nil?\n bf.add_file(file, true)\n bf.save\n bf\n end", "def file\n @file ||= Operations::FileFactory.new(self)\n end", "def initialize(file)\n self.stathash = stat(file) if (file)\n end", "def initialize(filename, from_mem = false)\n if from_mem\n initialize_copy(filename, from_mem)\n else\n Exts.each do |i|\n filename2 = filename+i\n if File.exist?(filename2)\n return initialize_copy(filename2)\n end\n end\n initialize_copy(filename)\n end\n initialize_copy(16, 16) if width == 0 || height == 0\n end", "def initialize(doctor_path = nil, patient_path = nil)\n @@doctor_file_path = doctor_path\n @@patient_file_path = patient_path\n # Locate file paths for doctor or patient json files\n file_exists?(doctor_path)\n file_exists?(patient_path)\n # Check if file exist, writable, readable\n # Create file if it doesn't exist\n # Return file found if exist\n # Hard exit \n end", "def initialize\n @data = ::Hash.new { |h, k| h[k] = File.new(k, mtime: 0) }\n @mutex = Mutex.new\n end", "def initialize(in_file)\n @file = File.new(in_file, \"a+\")\n @filename = in_file\n end", "def initialize(object, file)\n super(object, file)\n @name = object.name\n @parent_class = object.parent_class\n end", "def initialize(*args)\n @options = {\n :access_level => 'public-read',\n :file_mapping => nil,\n :object => nil\n }\n @options.update(args.extract_options!)\n @options.stringify_keys!\n\n @raw_file = args.first\n @config = configuration\n @connection = Uv::Storage::Connection.new(self.config)\n @object = @options['object']\n\n debug \"Initializing new Uv::Storage::File\"\n debug \"Args First is a: #{args.first.class.to_s}\"\n debug \"Config loaded: #{config.present?}\"\n debug \"Connection loaded: #{connection.present?}\"\n debug \"Object given: #{object.present?}\"\n debug \"Raw File given: #{@raw_file.present?}\"\n debug \"Options given: #{options.present?}\"\n debug \"Identifier given: #{options['identifier'].present?}\"\n\n validate_object(@object) if @object.present?\n end", "def test_file_begin_is_created\n file_name = 'some_file.txt'\n assert(!File.exist?(file_name))\n FileBegin.new(file_name)\n assert(File.exist?(file_name))\n File.unlink(file_name)\n end", "def initialize(file_path)\n\t\tbegin\n\t\t\t@file_desc = File.open(file_path)\n\t\trescue\n\t\t\traise \"File not found\"\n\t\tend\n\tend", "def initialize(name, metadata = {})\n super\n @files = {}\n end", "def local_file\n @local_file ||= LocalFile.new self\n end", "def file(at_path = nil)\n at_path ||= @full_path\n File.new at_path\n end", "def file(at_path = nil)\n at_path ||= @full_path\n File.new at_path\n end", "def initialize(filename:, directory: '.')\n @directory = directory.gsub(/\\/$/, '')\n @qualified_filename = @directory + '/' + filename\n @filename = filename\n @obj_metadata = {} # If we failed to read file\n diphot_metadata_to_h if File.extname(filename) == '.dat'\n end", "def initialize(filename_or_handle)\n if filename_or_handle.is_a?(File)\n @file = filename_or_handle\n elsif filename_or_handle.is_a?(String)\n if File.exists? filename_or_handle\n @file = open(filename_or_handle)\n else\n raise \"File does not exist: #{filename_or_handle}\"\n end\n else\n raise \"You need to pass a filename or a File object\"\n end\n \n parseHeader\n end", "def initialize(model_path)\n\t\t\tif File.exists?(model_path)\n\t\t\t\t@file = File.open(model_path,'r')\n\t\t\telse\n\t\t\t\traise NoFileError.new(model_path), \"file not found: #{model_path}\"\n\t\t\tend\n\t\tend", "def initialize(info, prefix_dir) \r\n @info_dictionary = info\r\n @files = Array.new\r\n @piece_files = Array.new\r\n @pieceLength = info[\"piece length\"]\r\n @numBytes = 0\r\n @totalPieces = info[\"pieces\"].bytesize / 20\r\n \r\n build_dir_path(prefix_dir)\r\n \r\n unless prefix_dir.chars.last == File::SEPARATOR \r\n prefix_dir += File::SEPARATOR \r\n end\r\n \r\n no_files_existed = true\r\n if info[\"files\"] != nil\r\n # multiple file mode\r\n \r\n unless Dir.exists?(prefix_dir + info[\"name\"])\r\n Dir.mkdir(prefix_dir + info[\"name\"])\r\n end\r\n \r\n info[\"files\"].each { |file|\r\n @numBytes += file[\"length\"]\r\n filename = file[\"path\"].last\r\n \r\n build_dir = prefix_dir + info[\"name\"] + File::SEPARATOR # for making directory trees\r\n file[\"path\"].rotate(-1).drop(1).each { |dir| # don't use filename (last element)\r\n build_dir += (dir + File::SEPARATOR) # use constant separator for portability\r\n unless Dir.exists?(build_dir)\r\n Dir.mkdir(build_dir)\r\n end\r\n }\r\n \r\n if File.exists?(build_dir + filename)\r\n no_files_existed = false\r\n end\r\n @files << [File.open(build_dir + filename, File::RDWR | File::CREAT), file[\"length\"]]\r\n if @files.last[0].size < @files.last[1]\r\n @files.last[0].seek(@files.last[0].size, IO::SEEK_SET)\r\n @files.last[0].write(\"\\0\" * (@files.last[1] - @files.last[0].size))\r\n end\r\n }\r\n else\r\n # single file mode\r\n @numBytes = info[\"length\"] \r\n if File.exists?(prefix_dir + info[\"name\"])\r\n no_files_existed = false\r\n end\r\n @files << [File.open(prefix_dir + info[\"name\"], File::RDWR | File::CREAT), info[\"length\"]]\r\n if @files.last[0].size < @files.last[1] # still needs to be checked even if file exists\r\n @files.last[0].seek(@files.last[0].size, IO::SEEK_SET)\r\n (0..((@files.last[1] - @files.last[0].size)/1024)).each {\r\n @files.last[0].write(\"\\0\" * 1024)\r\n }\r\n end\r\n end\r\n unless no_files_existed\r\n recheckComplete()\r\n else\r\n gen_initial_states()\r\n end\r\n \r\n #puts @bitfield.to_binary_string\r\n end", "def initialize(path); end", "def initialize file_path\n\t\t\t@file_path = file_path\n\t\t\t@meta = {}\n\t\tend", "def initialize(file_name)\n super()\n @name = nil\n @relative_name = file_name\n @absolute_name = file_name\n @file_stat = File.stat(file_name) rescue nil # HACK for testing\n @diagram = nil\n @parser = nil\n\n RDoc::TopLevel.lock.synchronize do\n RDoc::TopLevel.files_hash[file_name] = self\n end\n end", "def initialize(filename)\n @fname = filename\n end", "def mk_file_resource(path)\n # Force deletion, so directories actually get deleted.\n Puppet::Type.type(:file).new :path => path, :ensure => :absent, :force => true, :before => self[:before]\n end", "def create_lock_object\n @bucket.create_file(\n StringIO.new,\n @path,\n acl: @object_acl,\n cache_control: 'no-store',\n metadata: {\n expires_at: (Time.now + @ttl).to_f,\n identity: identity,\n },\n if_generation_match: 0,\n )\n rescue Google::Cloud::FailedPreconditionError\n nil\n end", "def new(*args)\n file = super\n if file.invalid?\n Logger.warn(\"\\s\\s[skipping] #{file.path}\\n\" \\\n \"\\s\\sPath Contains Invalid UTF-8 byte sequences\")\n file = nil\n end\n file\n end", "def exist; File.exist?(@fname); end", "def initialize(path, stable_state = DEFAULT_STABLE_STATE)\n @path ||= path\n @size = nil\n @modification_time = nil\n @cycles = 0 # number of iterations from the last file modification\n @state = FileStatEnum::NON_EXISTING\n\n @stable_state = stable_state # number of iteration to move unchanged file to stable state\n end", "def initialize(filename, check_id3 = nil)\n if FILE_OBJ_METHODS.each{|method| break unless filename.respond_to?(method)}\n @file = filename\n @check_id3 = check_id3.nil? ? @@check_id3 : check_id3 \n else\n @filename = filename.to_s\n @check_id3 = check_id3.nil? ? (MP3_RE.match(@filename) ? true : nil) : check_id3 \n end\n end", "def file_exists\n end", "def initialize filename\n\t\t@filename = filename\n\tend", "def new_files; end", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def initialize_container_file\n container_file.create true if container_file && !container_file.exists?\n end", "def new_file(path, sub_group_path = nil, set_name = true)\n file = project.new(PBXFileReference)\n file.path = path.to_s\n file.update_last_known_file_type\n\n target = find_subpath(sub_group_path, true)\n target.children << file\n\n same_path_of_group = target.path == file.pathname.dirname.to_s\n same_path_project = file.pathname.dirname.to_s == '.' && target.path.nil?\n unless same_path_of_group || same_path_project\n file.name = file.pathname.basename.to_s\n end\n file\n end", "def open\n _close\n mode = @mode & ~(File::CREAT|File::EXCL)\n @tmpfile = File.open(@tmpfile.path, mode, **@opts)\n __setobj__(@tmpfile)\n end", "def file=(_); end", "def initialize(path, state=FileStatEnum::NEW, size=-1, mod_time=-1, indexed=false, cycles=0)\n # File\\Dir path\n @path = path\n\n # File size\n @size = size\n\n # File modification time\n @modification_time = mod_time\n\n # File sate. see class FileStatEnum for states.\n @state = state\n\n # indicates if path EXISTS in file system.\n # If true, file will not be removed during removed_unmarked_paths phase.\n @marked = false\n\n # Number of times that file was monitored and not changed.\n # When @cycles exceeds ::FileMonitoring::stable_state, @state is set to Stable and can be indexed.\n @cycles = cycles\n\n # flag to indicate if file was indexed\n @indexed = indexed\n end", "def file\n @file ||= find_file\n end", "def initialize(fname, basedir=nil, datafile=nil, indexfile=nil)\n base = basedir || Dir.pwd\n @fname = File.absolute_path(fname, base)\n if @fname == fname\n raise \"CONSTRUCTED WITH ABSOLUTE PATH #{fname}\"\n end\n indexdir = File.join base, HIDDEN_DIR, \"index\"\n datadir = File.join base, HIDDEN_DIR, \"data\"\n @indexfile = indexfile || (File.join indexdir, fname)\n @datafile = datafile || (File.join datadir, fname)\n [indexdir, datadir].each do |d|\n unless File.directory?(d)\n FileUtils.mkdir_p(d)\n end\n end\n end", "def initialize(file_name, file_mode)\r\n @file = File.new(file_name, file_mode)\r\n rescue\r\n error \"F51: Unable to open the file #{file_name} for writing.\"\r\n end", "def file( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::FileInfo.new( self, name )\n\t\t\tend", "def init_filedata(file_index)\r\n @file_index = file_index\r\n @time_stamp = Time.at(0)\r\n @file_exist = FileTest.exist?(@filename)\r\n @selected = false\r\n end", "def initialize(filename)\n @path = filename\n end", "def initialize(name)\n @fh = File.open(name, 'r')\n end", "def for(file_or_dir); end", "def load\n initialize(File.info(uuid).entity)\n end", "def initialize(filename_or_io, content_type, filename = nil, opts = {})\n io = filename_or_io\n local_path = \"\"\n if io.respond_to? :read\n # in Ruby 1.9.2, StringIOs no longer respond to path\n # (since they respond to :length, so we don't need their local path, see parts.rb:41)\n local_path = filename_or_io.respond_to?(:path) ? filename_or_io.path : \"local.path\"\n else\n io = File.open(filename_or_io)\n local_path = filename_or_io\n end\n filename ||= local_path\n\n @content_type = content_type\n @original_filename = File.basename(filename)\n @local_path = local_path\n @io = io\n @opts = opts\n end", "def filename\n return Pathname.new(file_object.io.path) if file_object.io.respond_to?(:path) && File.exist?(file_object.io.path)\n end", "def filename\n return Pathname.new(file_object.io.path) if file_object.io.respond_to?(:path) && File.exist?(file_object.io.path)\n end", "def filename\n return Pathname.new(file_object.io.path) if file_object.io.respond_to?(:path) && File.exist?(file_object.io.path)\n end", "def initialize(file_path)\n @file_path = file_path\n end", "def open(file_name, create = T.unsafe(nil), options = T.unsafe(nil)); end", "def initialize(path, file, storage_name = nil)\n self.path = path\n self.file = file\n self.storage_name = storage_name\n end", "def initialize(fname,mode=\"r\")\n case mode\n when \"r\",\"rb\"\n\tmode = \"rb\"\n when \"w\",\"wb\"\n\tmode = \"wb\"\n else\n raise \"Unsupported file mode '#{mode}'. Use 'r' or 'w'.\"\n end\n @file = File.open(fname, mode)\n @vars = Hash.new\n @attr = Hash.new\n end", "def initialize( fn )\n @path = fn\n @dir = ::Webby::Resources.dirname(@path)\n @name = ::Webby::Resources.basename(@path)\n @ext = ::Webby::Resources.extname(@path)\n @mtime = ::File.mtime @path\n\n @_meta_data = {}\n self._reset\n end", "def initialize(input_file)\n @input_file = input_file\n @source = File.new(input_file)\n end", "def file?() end", "def initialize\n\t\t@file_table = Hash.new \t\t\t\t\t\t#hash table, unique for each instance\n\tend", "def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end", "def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end", "def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end", "def has_file\n if id == nil \n false\n else\n FileTest.exists?( local_file_path )\n end\n end", "def initialize(file, &sentinel)\n @file=file\n @sentinel=sentinel\n load_data\n self\n end", "def file\n #load_file\n @file ||= load_file\n end", "def file_exist(file)\n FileExistAssertion.new(file)\n end", "def instance\n @instance ||= if File.exists?(path) && File.readable?(path)\n new(JSON.parse(File.read(path)))\n else\n new\n end\n end", "def initialize path\n @path = path.freeze\n\n if valid_file?\n @data = File.read @path\n @success = true\n else\n @error = 'Error: the given file have not read and write right'\n @success = false\n end\n end", "def initialize (file = '/etc/fstab')\n\n @source_file = file\n @fs_by_id = Hash.new\n\n File.foreach(file) do |line|\n\n dev, mp, fstype, options = line.split\n\n next if options == nil\n next if line[0] == ?#\n next if mp[0] != ?/ # skip pseudo fs\n next if NOFS.has_key? fstype\n next if options =~ /loop/ # no need to readahead loop fs\n\n fs = FileSystem.new(dev, mp, fstype)\n @fs_by_id[fs.device_id] ||= fs\n\n end\n\n @fs_by_id.delete(0) # in case we get device_id=0 for hotplug devices.\n\n # the filesystem for block special files\n @fs_by_id[$BDEV_ID] = FileSystem.new($BDEV_NAME, '', $BDEV_NAME)\n\n self\n end", "def obj_file source\n ext = @data['extensions'][@language]['source']\n obj, src = builddir(source.sub(/#{ext}$/, objext)), srcdir(source)\n d = File.dirname(obj)\n\n directory d\n file obj => [ d, src ] do\n make_object obj, src\n end\n CLEAN.include obj\n\n obj\n end", "def init_file; end", "def open_file!\n @raw_file = ::File.open(new_resource.absolute_path, 'rb')\n @file = case new_resource.absolute_path\n when /\\.tar$/\n nil # So it uses @raw_file instead.\n when /\\.t?gz/\n Zlib::GzipReader.wrap(@raw_file)\n when /\\.t?bz/\n # This can't take a block, hence the gross non-block forms for everything.\n PoiseArchive::Bzip2::Decompressor.new(@raw_file)\n else\n raise RuntimeError.new(\"Unknown or unsupported file extension for #{new_resource.path}\")\n end\n @tar_reader = Gem::Package::TarReader.new(@file || @raw_file)\n end", "def file=(_arg0); end", "def file=(_arg0); end", "def file=(_arg0); end", "def file(path)\n data = self.files[path.to_sym]\n \n if data.nil?\n data = { }\n self.files[path.to_sym] = data\n end\n \n StateModule::File::new(path, data)\n end", "def init_file=(_arg0); end", "def existent; end", "def initialize( short_name, path, options = {} )\n @short_name = short_name\n @path = path\n @partial = ( options[:partial] or false )\n @shared = ( options[:shared] or false )\n @no_default = (options[:no_default] or false )\n \n path_parts = File.split( @path )\n path_parts.shift if @shared\n path_parts[-1] = \"_#{path_parts[-1]}\" if @partial\n \n @file_path = File.join( path_parts )\n 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 test_file_missing(filename)\n end", "def initialize(file_path)\n\t\t@path = file_path\n\tend" ]
[ "0.6378086", "0.63116616", "0.62711704", "0.6256389", "0.62529093", "0.622761", "0.6196516", "0.6140266", "0.6137014", "0.6136738", "0.6133041", "0.6133041", "0.6133041", "0.6115019", "0.60814065", "0.6069924", "0.6069924", "0.60565966", "0.6044891", "0.6038416", "0.6000153", "0.59697336", "0.5959527", "0.5900798", "0.5900444", "0.5893231", "0.58893675", "0.5829319", "0.58256155", "0.5823408", "0.581596", "0.581596", "0.58046716", "0.5796164", "0.5783963", "0.5781712", "0.5781004", "0.5774832", "0.57728124", "0.5763644", "0.575846", "0.5751432", "0.5730575", "0.56727284", "0.56711864", "0.56670904", "0.56660455", "0.5656818", "0.5649302", "0.5640414", "0.5640414", "0.5631159", "0.56291103", "0.56227136", "0.56217486", "0.5613342", "0.56128716", "0.5595963", "0.5594998", "0.5592478", "0.55829406", "0.558258", "0.5569368", "0.5561271", "0.55513304", "0.55483764", "0.5546661", "0.5546661", "0.5546661", "0.55454445", "0.5543658", "0.5540822", "0.5532732", "0.5531172", "0.5528213", "0.5522281", "0.55219424", "0.5520596", "0.5520596", "0.5520596", "0.54970026", "0.5488885", "0.5484196", "0.5474592", "0.54680514", "0.5464505", "0.54574996", "0.5457175", "0.54555637", "0.54552126", "0.54547286", "0.54547286", "0.54547286", "0.5454133", "0.54465795", "0.54464364", "0.54406106", "0.5438669", "0.54383916", "0.54364294" ]
0.68079025
0
Mark this file to be copied to a destination directory (from a destination content tree) N Without this we can't decide to copy a local file to a remote directory
def markToCopy(destinationDirectory) #N Without this we won't remember that the file is to be copied to the destination directory @copyDestination = destinationDirectory end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_copied_remote_file(file, copy)\n # the remote has a file that has been copied or moved from copy[file] to file.\n # file is also destination.\n src = copy[file]\n \n # If the user doen't even have the source, then we apparently renamed a directory.\n if !(working_changeset.include?(file2))\n directory nil, file, src, remote.flags(file)\n elsif remote.include? file2\n # If the remote also has the source, then it was copied, not moved\n merge src, file, file, flag_merge(src, file, src), false\n else\n # If the source is gone, it was moved. Hence that little \"true\" at the end there.\n merge src, file, file, flag_merge(src, file, src), true\n end\n end", "def markToCopy(destinationDirectory)\n #N Without this it won't be marked for copying\n @copyDestination = destinationDirectory\n end", "def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end", "def copy_to_folder=(value)\n @copy_to_folder = value\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def preform_copy_directory\n @destination_directories.each do |destination|\n @sources.each do |source|\n write_mode = 'w'\n new_path = Pathname.new(destination.to_s).join(source.basename)\n # Check if the specified file is a directory\n if new_path.directory?\n return false if get_input(\"Destination path '\" + new_path.to_s + \"' is a directory. (S)kip the file or (C)ancel: \", ['s','c']) == 'c'\n next\n end\n # Copy the file\n return false unless copy_file(source, new_path)\n end\n end\n return true\n end", "def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the file\n executeCommand(\"#{@scpCommandString} #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def notify_file_cp(src, dst)\r\n if @files.key?(src)\r\n @files[dst] = @files[src].clone\r\n else\r\n @files[src] = { exist: true }\r\n @files[dst] = { exist: true }\r\n end\r\n register_file_in_dirs(dst)\r\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end", "def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy file #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the file will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the file won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath)\n end\n end", "def cp_to(filename, mounted_dest) # Always returns the destination as an explicit location relative to the mount directory\n dest = File.join(@mount_dir, mounted_dest )#, File.basename(filename))\n FileUtils.mkdir_p(dest)\n FileUtils.cp( filename, dest, :preserve => true)\n File.join(dest, File.basename(filename))\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy directory #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the files will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the files won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath, :recursive => true)\n end\n end", "def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the directory\n executeCommand(\"#{@scpCommandString} -r #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end", "def copy(destination, file, folder = './downloads')\n FileUtils.mkdir_p(File.dirname(\"#{destination}/#{file}\"))\n FileUtils.cp_r(\"#{folder}/#{file}\", \"#{destination}/#{file}\")\n end", "def copy_file_if_missing(src, dest, opt={})\n unless File.exists? dest\n touch_directory File.dirname(dest), opt\n FileUtils.cp src, dest\n STDOUT.write \"Created #{dest.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n end", "def copy_file(filename,dst_dir='/',dst_repo=self.repo,src_repo=self.repo)\n post_copy(src_repo,{\"file_names\"=>filename, \"dst_repo\" => dst_repo, \"dst_dir\"=>dst_dir})\n end", "def copy_file!(f, target)\n # directory?\n if File.directory?(f)\n if File.directory?(target)\n done = 'exists'.green\n else\n FileUtils.mkdir_p target\n done = 'created'.bold.green\n end\n else\n if newer?(f, target)\n target_dir = File.dirname(target)\n FileUtils.mkdir_p target_dir unless File.directory?(target_dir)\n FileUtils.copy f, target\n done = 'copied'.bold.green\n else\n done = 'keep'.white\n end\n end\n done\n end", "def ftp_copy(ftp, local_file, remote_file)\n in_ftp_dir(ftp, File.dirname(remote_file)) do |_ftp|\n basename = File.basename(remote_file)\n _ftp.putbinaryfile(local_file, \"#{basename}.in_progress\")\n _ftp.rename(\"#{basename}.in_progress\", basename)\n end\n end", "def copy(source_path, target_path)\n _ensure_directory_exists(target_path)\n target_path.open('wb', @permissions[:file]) do |io|\n lines = source_path.read.split(\"\\n\")\n lines.each do |line|\n\tio.write(line.chomp + @ending)\n end\n end\n puts \"#{source_path.to_s.ljust(25)} -> #{target_path}\"\n end", "def update_remote_file(file, node, copy, copied_files)\n return if should_filter?(file) ||\n local_manifest[file] ||\n copied_files[file]\n \n if copy[file]\n # If it's been copied, then we might need to do some work.\n update_copied_remote_file file, copy\n elsif ancestor.include? file\n # If the ancestor has the file, and the target has the file, and we don't,\n # then we'll probably have to do some merging to fix that up.\n update_remotely_modified_file file, node\n else\n # Just get the god damned file\n get file, remote.flags(file)\n end\n end", "def local_copy(source, target)\n FileUtils.mkpath(File.dirname(target))\n FileUtils.copy(source, \"#{target}.in_progress\")\n FileUtils.move(\"#{target}.in_progress\", target)\n end", "def upload_file local_source, remote_dest, options = {}\n add [local_source, remote_dest], check_file(remote_dest)\n chmod options[:perms], remote_dest if options[:perms]\n chown options[:owner], remote_dest if options[:owner]\n end", "def copy_to!(dest)\n Pow(dest).parent.create_directory\n copy_to(dest)\n end", "def move_to_target_directory!\n return if new_record? || !readable?\n\n src = diskfile\n self.disk_directory = target_directory\n dest = diskfile\n\n return if src == dest\n\n if !RedmicaS3::Connection.move_object(src, dest)\n Rails.logger.error \"Could not move attachment from #{src} to #{dest}\"\n return\n end\n\n update_column :disk_directory, disk_directory\n end", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def cp srcpath, dstpath\n end", "def copy_to(dest_file)\n\t\treturn false if !file_exist?\n\t\t\n\t\treturn false if !dest_file.path.create_structure\n\n\t\treturn false if !FileManager.copy(@path,dest_file.path)\n\n\t\treturn true\n\tend", "def given_destination\n dir\n end", "def set_move_target cf=current_file\n ff = expand_path(cf)\n return unless File.directory? ff\n\n @move_target = ff\n message \"Move target set to #{cf}.\"\nend", "def transfer!\n remote_path = remote_path_for(@package)\n FileUtils.mkdir_p(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started transferring '#{ local_file }'.\"\n\n src_path = File.join(local_path, local_file)\n dst_path = File.join(remote_path, remote_file)\n FileUtils.send(transfer_method, src_path, dst_path)\n end\n end", "def cp_dir(src, dst)\n puts \"#{cmd_color('copying')} #{dir_color(src)}\"\n puts \" -> #{dir_color(dst)}\"\n Find.find(src) do |fn|\n next if fn =~ /\\/\\./\n r = fn[src.size..-1]\n if File.directory? fn\n mkdir File.join(dst,r) unless File.exist? File.join(dst,r)\n else\n cp(fn, File.join(dst,r))\n end\n end\nend", "def copy_file(src_file, dest_file)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(dest_file)) unless File.directory?(File.dirname(dest_file))\n FileUtils.cp(ROOT_DIR.join(src_file), dest_file)\n end\n end", "def directory(file, remote_file, file_dest, flags)\n @actions << Action::DirectoryAction.new(file, remote_file, file_dest, flags)\n end", "def destination_rel_dir\n @_dest_dir\n end", "def destination(dest); end", "def destination(dest); end", "def transfer!\n create_local_directories!\n\n files_to_transfer do |local_file, remote_file|\n Logger.message \"#{storage_name} started transferring '#{ local_file }'.\"\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end\n end", "def copy(dest_path, overwrite = false, depth = nil)\n NotImplemented\n end", "def destination(base_directory); end", "def copy_to_local srcfile, dstfile\n @hdfs.copy_to_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def copy_to_local srcfile, dstfile\n @hdfs.copy_to_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def markCopyOperations(destinationDir)\n #N Without this we can't loop over the immediate sub-directories to determine how each one needs to be marked for copying\n for dir in dirs\n #N Without this we won't have the corresponding sub-directory in the other directory with the same name as this sub-directory (if it exists)\n destinationSubDir = destinationDir.getDir(dir.name)\n #N Without this check, we won't be able to correctly process a sub-directory based on whether or not one with the same name exists in the other directory\n if destinationSubDir != nil\n #N Without this, files and directories missing or changed from the other sub-directory (which does exist) won't get copied\n dir.markCopyOperations(destinationSubDir)\n else\n #N Without this, the corresponding missing sub-directory in the other directory won't get updated from this sub-directory\n dir.markToCopy(destinationDir)\n end\n end\n #N Without this we can't loop over the files to determine how each one needs to be marked for copying\n for file in files\n #N Without this we won't have the corresponding file in the other directory with the same name as this file (if it exists)\n destinationFile = destinationDir.getFile(file.name)\n #N Without this check, this file will get copied, even if it doesn't need to be (it only needs to be if it is missing, or the hash is different)\n if destinationFile == nil or destinationFile.hash != file.hash\n #N Without this, a file that is missing or changed won't get copied (even though it needs to be)\n file.markToCopy(destinationDir)\n end\n end\n end", "def update_locally_copied(file, renamed_file)\n if !remote_manifest[renamed_file]\n # directory rename (I don't know what's going on here)\n then directory file, nil, renamed_file, working_changeset.flags[file]\n # We found the old name of the file in the remote manifest.\n else merge file, renamed_file, file, flag_merge[file, renamed_file, renamed_file], false\n end\n end", "def update_local_file(file, node, copy, copied_files)\n return if should_filter? file\n\n # Is the file also in the target changeset?\n if remote.include? file\n update_common_file file, node\n elsif copied_files[file]\n return\n elsif copy[file]\n update_locally_copied file, copy[file]\n elsif ancestor_manifest[file]\n update_remotely_deleted file, node\n else\n # Are we overwriting with empty data, or going backwards to when the\n # file didn't exist?\n if (overwrite? && node[20..-1] == \"u\") || (backwards? && node.size <= 20)\n remove file\n end\n end\n end", "def copy_to_folder\n return @copy_to_folder\n end", "def cp(from, to, mode: :default, &block)\n target_file = scope.get(from)\n InvalidStore.raise! {!target_file}\n\n dest_dirname = Utils.dir to\n dest_file = scope.get(to)\n dest_dir = scope.get(dest_dirname) || self.mkdir(dest_dirname)\n\n params = make_params :name => Utils.tokenize(to).last,\n :dir_id => dest_dir.try(:id)\n\n resolve_conflict(params, dest_file, mode) do |params, rename|\n copy = File.new target_file.raw_attributes\n copy.update_attributes params\n block.call(copy) if block_given?\n copy\n end\n end", "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 copy_file_to_output(source, destination)\n d = dir(File.join(\"output\", destination))\n FileUtils.copy source, d\n @touchedfiles << undir(d)\n end", "def mark_as_copied(file)\n cmd = cmd(\"setlabel\", [ file, COPIED ])\n system(cmd)\nend", "def mirror_file(source, dest, copied = [], duplicated = [], postfix = '_override')\n base, rest = split_name(source)\n dst_dir = File.dirname(dest)\n dup_path = dst_dir / \"#{base}#{postfix}.#{rest}\" \n if File.file?(source)\n mkdir_p(dst_dir) unless File.directory?(dst_dir)\n if File.exists?(dest) && !File.exists?(dup_path) && !FileUtils.identical?(source, dest)\n # copy app-level override to *_override.ext\n copy_entry(dest, dup_path, false, false, true)\n duplicated << dup_path.relative_path_from(Merb.root)\n end\n # copy gem-level original to location\n if !File.exists?(dest) || (File.exists?(dest) && !FileUtils.identical?(source, dest))\n copy_entry(source, dest, false, false, true) \n copied << dest.relative_path_from(Merb.root)\n end\n end\n end", "def FileCopy(src, dst)\n success?(parse(cmd(with_args(src, dst))))\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def remote_dir\n @remote_dir ||= configuration[:copy_remote_dir] || \"/tmp\"\n end", "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def attach_to_factory_report_from_remote(node_proxy, path)\n if node_proxy.file?(path)\n node_proxy.copy_remote_file_into_local_directory(path, dirs.filesdir)\n elsif node_proxy.directory?(path)\n node_proxy.copy_remote_directory_into_local_directory(path, dirs.filesdir)\n else\n raise path + \" is neither a file nor a directory on \" + node_proxy.name\n end\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 copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, src\n\tend", "def copy(src, dst)\n\t\tFileUtils.cp_r(src, dst)\n\t\ttrue\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, src unless File.exist?(src)\n\t\traise Rush::DoesNotExist, File.dirname(dst)\n\tend", "def cp(src, dst, owner = nil, mode = nil)\n FileUtils.cp_r(src, dst, :preserve => true, :verbose => verbose?)\n if owner && !File.symlink?(dst) \n chown(dst, owner) \n end\n if mode\n chmod(dst, mode)\n end\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n cmd = self.class.curr_host == host ? cmd : \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"#{cmd}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n op = try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev ? 'mv' : 'cp -r'\n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ?\n \"#{op} #{local_path.shellescape} #{dst_path.shellescape}\" :\n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def copy_to(destination, name=nil)\n parent = {'parent' => {'id' => destination.id}}\n parent.merge!('name' => name) if name\n\n RubyBox::Folder.new(@session, post(folder_method(:copy), parent))\n end", "def copyItem(srcItem,destItem)\n copyWentWell = false # not yet...\n\n begin\n\n # directory?\n FiRe::filesys.mkpath(destItem) if FiRe::filesys.directory?(srcItem)\n \n # file?\n if FiRe::filesys.file?(srcItem)\n FiRe::log.info \"#{FiRe::filesys.basename(srcItem)} ----> #{destItem}\"\n FiRe::filesys.cp(srcItem, destItem)\n end\n\n copyWentWell = true\n\n rescue StandardError => e\n FiRe::log.error e\n end\n\n copyWentWell\n\n end", "def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend", "def cp!( from_file, to_file, opts = {} )\r\n args = { :source => from_file, :destination => to_file }\r\n args[:source_address] = opts[:source_address] if opts[:source_address]\r\n \r\n begin\r\n got = @ndev.rpc.file_copy( args )\r\n rescue => e\r\n raise IOError, e.rsp.xpath('rpc-error/error-message').text.strip\r\n else\r\n return true\r\n end\r\n end", "def copy(dest, overwrite = false)\n# if(dest.path == path)\n# Conflict\n# elsif(stat.directory?)\n# dest.make_collection\n# FileUtils.cp_r(\"#{file_path}/.\", \"#{dest.send(:file_path)}/\")\n# OK\n# else\n# exists = File.exists?(file_path)\n# if(exists && !overwrite)\n# PreconditionFailed\n# else\n# open(file_path, \"rb\") do |file|\n# dest.write(file)\n# end\n# exists ? NoContent : Created\n# end\n# end\n\n # ディレクトリなら末尾に「/」をつける。\n # (dstにもともと「/」が付いているかどうか、クライアントに依存している)\n # CarotDAV : 「/」が付いていない\n # TeamFile : 「/」が付いている\n dest.collection! if collection?\n\n src = @bson['filename']\n dst = dest.file_path\n exists = nil\n\n @collection.find({:filename => /^#{Regexp.escape(src)}/}).each do |bson|\n src_name = bson['filename']\n dst_name = dst + src_name.slice(src.length, src_name.length)\n\n exists = @collection.find_one({:filename => dst_name}) rescue nil\n\n return PreconditionFailed if (exists && !overwrite && !collection?)\n\n @filesystem.open(src_name, \"r\") do |src|\n @filesystem.open(dst_name, \"w\") do |dst|\n dst.write(src) if src.file_length > 0\n end\n end\n\n @collection.remove(exists) if exists\n end\n\n collection? ? Created : (exists ? NoContent : Created)\n end", "def copy_to(target)\n target.parent.mkdirs\n factory.system.copy_dir(@path, target.path)\n end", "def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end", "def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end", "def copy_to(new_path)\n res = conn.put(new_path) do |req|\n req.headers = {\n \"X-Upyun-Copy-Source\" => \"/#{@uploader.upyun_bucket}/#{path}\",\n \"Content-Length\" => 0,\n \"Mkdir\" => \"true\"\n }\n end\n\n check_put_response!(res)\n\n File.new(@uploader, @base, new_path)\n rescue ConcurrentUploadError\n retry\n end", "def copy_with_path(src, dst, filename)\n FileUtils.mkdir_p(dst)\n FileUtils.cp(src, dst + filename)\nend", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def copy_file(src, dest, preserve = false, dereference = true)\r\n ent = Entry_.new(src, nil, dereference)\r\n ent.copy_file dest\r\n ent.copy_metadata dest if preserve\r\n end", "def copy_file(src, dest, preserve = false, dereference = true)\r\n ent = Entry_.new(src, nil, dereference)\r\n ent.copy_file dest\r\n ent.copy_metadata dest if preserve\r\n end", "def auto_destination= dest\n @auto_destination = (dest == '/') ? nil : dest\n end", "def copy_to_local_file(style, local_dest_path)\n @filesystem.copy_to_local_file(style, local_dest_path)\n end", "def copy_to_local_file(style, local_dest_path)\n @filesystem.copy_to_local_file(style, local_dest_path)\n end", "def copy_dir(origin_path, dest_path)\n \n p origin_path if $DEBUG\n\n real_dir = get_non_linked_dir_path_for_path(origin_path)\n \n unless File.exist?(dest_path) and File.directory?(dest_path) then\n \n Dir.mkdir(dest_path)\n \n end\n \n Dir.foreach(real_dir) do |f|\n \n next if f == \".\" or f == \"..\"\n \n full_path= File.join(real_dir, f)\n \n #check if this is a hard link to a directory\n if File.exist?(full_path) and (not File.directory?(full_path)) and File.stat(full_path).nlink > @min_link_count then\n full_path = get_non_linked_dir_path_for_path(full_path)\n end\n \n if File.directory?(full_path) then\n copy_dir(full_path, File.join(dest_path, f))\n else\n \n if File.exist?(full_path) and not File.symlink?(full_path) then\n \n FileUtils.cp(full_path, dest_path)\n \n end\n \n end\n \n end\n \n nil\n \n end", "def copy_file file, destination, clobber=nil\n validate file, destination\n target = File.expand_path( File.join(destination, File.basename(file)) )\n if(File.exists?(target) && clobber != :clobber)\n raise Sprout::Errors::DestinationExistsError.new \"Unable to copy #{file} to #{target} because target already exists and we were not asked to :clobber it\"\n end\n FileUtils.mkdir_p destination\n FileUtils.cp_r file, destination\n\n destination\n end", "def copyFileToTarget(file, srcDir, destDir) \n inFileName = \"#{srcDir}/#{file}\";\n outFileName = \"#{destDir}/#{file}\";\n puts \"copying: [#{inFileName}]\";\n puts \"\\tto: [#{outFileName}]\";\n system(\"cp #{inFileName} #{outFileName}\");\nend", "def post_move(filename,src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/file/?p=#{filename}\",data).body_str\n end", "def copyPreserveSymlinks(source_file, target_folder)\n if File.symlink? source_file\n\n link_data = File.readlink source_file\n\n target_file = File.join(target_folder, File.basename(source_file))\n\n if File.symlink? target\n\n existing_link = File.readlink target_file\n\n if link_data == existing_link\n # Already up to date\n return\n end\n end\n\n FileUtils.ln_sf link_data, target_file\n\n else\n\n # Recursive copy should work for normal files and directories\n FileUtils.cp_r source_file, target_folder, preserve: true\n\n end\nend", "def write(site_destination_dir)\n if modified?\n dst_path = destination(site_destination_dir)\n Files.copy_p(path, dst_path)\n\n # respect user's umask; Ruby's tempfile has mode 0o600\n File.chmod(0o666 & ~File.umask, dst_path)\n\n @is_modified = false\n true\n else\n false\n end\n end", "def copyPreserveSymlinks(sourceFile, targetFolder)\n\n if File.symlink? sourceFile\n\n linkData = File.readlink sourceFile\n\n targetFile = File.join(targetFolder, File.basename(sourceFile))\n\n if File.symlink? target\n\n existingLink = File.readlink targetFile\n\n if linkData == existingLink\n # Already up to date\n return\n end\n end\n\n FileUtils.ln_sf linkData, targetFile\n \n else\n\n # Recursive copy should work for normal files and directories\n FileUtils.cp_r sourceFile, targetFolder, preserve: true\n \n end\nend", "def cp (from, to, as: user, on: hosts, quiet: false, once: nil, delete: false)\n self.once once, quiet: quiet do\n log.info \"cp: #{from} -> #{to}\", quiet: quiet do\n Dir.chdir File.dirname(file) do\n hash_map(hosts) do |host|\n host.cp from, to, as: as, quiet: quiet, delete: delete\n end\n end\n end\n end\n end", "def copy_file(src, dest, preserve = false, dereference = true)\n ent = Entry_.new(src, nil, dereference)\n ent.copy_file dest\n ent.copy_metadata dest if preserve\n end", "def destination_file_name=(value)\n @destination_file_name = value\n end", "def copy(options)\n destination = copy_destination options\n to_path = join_paths @root_dir, destination\n to_path_exists = File.exist? to_path\n\n preserve_existing = false? options[:overwrite]\n\n copy_resource_to_path to_path, preserve_existing\n copy_pstore_to_path to_path, preserve_existing\n\n to_path_exists\n end", "def move_to(dest_file)\n\t\treturn false if !exist?\n\t\t\n\t\treturn false if !dest_file.path.create_structure\n\n\t\treturn false if !FileManager.move(@path,dest_file.path)\n\n\t\treturn true\n\tend", "def move_to!(dest)\n Pow(dest).parent.create_directory\n move_to(dest)\n end", "def copy from, to\n add \"cp #{from} #{to}\", check_file(to)\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 find_or_create_remote_directory(file)\n begin\n return unless File.directory?(local_path(file))\n self.ftp_connection.chdir(remote_path(file))\n rescue\n puts \"Creating directory: #{file}\"\n self.ftp_connection.mkdir(remote_path(file))\n end\n end", "def copy_path(local_path, file_name, try_move = false, speed_limit = nil)\n dst_path = \"#{self.path}#{file_name}\"\n\n recreate_dirs_cmd = \"rm -rf #{dst_path.shellescape}; mkdir -p #{File.dirname(dst_path).shellescape}\"\n\n # recreate dirs anyway if local op\n if try_move && self.class.curr_host == host\n r = `#{recreate_dirs_cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n # if we can make mv command\n if try_move && self.class.curr_host == host && File.stat(local_path).dev == File.stat(File.dirname(dst_path)).dev\n r = `mv #{local_path.shellescape} #{dst_path.shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n else\n local_path += '/' if File.stat(local_path).directory?\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"#{recreate_dirs_cmd} && ionice -c 2 -n 7 rsync\\\" #{local_path.shellescape} #{self.host}:\\\"#{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end\n end", "def rel_copy(full_src, rel_dest, opts={})\n \n dest_path = File.dirname(rel_dest)\n \n fname = Pathname.new(full_src).basename\n \n if !File.directory?(dest_path)\n cmd = \"mkdir -p #{dest_path}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end \n end\n \n cmd = \"cp #{full_src} #{dest_path}/#{fname}\"\n \n if !opts[:mock]\n run cmd\n else\n puts \"mocking #{cmd}\"\n end\n\nend", "def copy(destination)\n return unless @converted\n \n puts \"Generating #{Rails.root}/tmp/images/#{@full}\"\n puts \"Generating #{Rails.root}/tmp/images/#{@icon}\"\n \n FileUtils.cp(\"#{Rails.root}/tmp/images/#{@full}\", \n \"#{destination}/#{@full}\")\n puts \"Moving #{destination}/#{@full}\"\n \n FileUtils.chmod(0644, \"#{destination}/#{@full}\")\n FileUtils.cp(\"#{Rails.root}/tmp/images/#{@icon}\",\n \"#{destination}/#{@icon}\")\n puts \"Moving #{destination}/#{@icon}\"\n FileUtils.chmod(0644, \"#{destination}/#{@icon}\")\n end", "def destination(dest)\n File.join(dest, @ddir, @name)\n end", "def copy_from_local srcfile, dstfile\n @hdfs.copy_from_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def copy_from_local srcfile, dstfile\n @hdfs.copy_from_local_file(Path.new(srcfile), Path.new(dstfile))\n end", "def copyfile from, to\n FileUtils.mkdir_p File.dirname to\n cp from, to\n end" ]
[ "0.6833985", "0.67162126", "0.6716197", "0.6524444", "0.65067613", "0.6400878", "0.63855714", "0.6340511", "0.626542", "0.6263418", "0.62446815", "0.62236696", "0.6202445", "0.6194939", "0.6185554", "0.6178778", "0.61633927", "0.61369395", "0.6132378", "0.6118917", "0.6107427", "0.6102033", "0.60901695", "0.60866004", "0.60763615", "0.60649866", "0.6020168", "0.60063046", "0.5998225", "0.599133", "0.59881616", "0.59589475", "0.5951582", "0.5944144", "0.59310913", "0.5923541", "0.5923541", "0.5910651", "0.5902467", "0.5895106", "0.58891016", "0.58891016", "0.5887428", "0.58814526", "0.5878754", "0.5878738", "0.58750504", "0.5851476", "0.5826299", "0.5825845", "0.5816195", "0.5811676", "0.5803461", "0.58028233", "0.58019567", "0.57814974", "0.57755446", "0.5773434", "0.57714564", "0.5761662", "0.5759066", "0.57481045", "0.57428694", "0.5739121", "0.5736522", "0.57339907", "0.57337224", "0.57316", "0.57316", "0.57198536", "0.57198054", "0.5717562", "0.5710369", "0.5710369", "0.5706699", "0.57053477", "0.57053477", "0.56894904", "0.568782", "0.5686286", "0.56858724", "0.5685623", "0.56824714", "0.56682116", "0.5667492", "0.56656116", "0.56648475", "0.5656087", "0.5652323", "0.56491643", "0.56429267", "0.56321174", "0.5624649", "0.5624305", "0.5621603", "0.562087", "0.5617804", "0.5617559", "0.5617559", "0.5616321" ]
0.6681991
3
Mark this file to be deleted N Without this we can't decide to delete a remote file
def markToDelete #N Without this we won't remember that this file is to be deleted @toBeDeleted = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(filename); end", "def update_remotely_deleted(file, node)\n #\n if node != ancestor.file_node(file) && !overwrite?\n if UI.ask(\"local changed #{file} which remote deleted\\n\" +\n \"use (c)hanged version or (d)elete?\") == \"d\"\n then remove file\n else add file\n end\n else\n remove file\n end\n end", "def markToDelete\n #N Without this it won't be marked for deletion\n @toBeDeleted = true\n end", "def delete_from_disk; end", "def delete\n @file = nil\n # file.delete\n end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def del\n File.delete(@file)\n end", "def destroy\n file&.delete\n end", "def delete_file(filename)\n http.delete([204,404], luwak, escape(filename))\n true\n end", "def make_deleted(data_file:)\n case data_file.file_state\n when 'created' # delete from db since it's new in this version\n my_hate = { _links: StashApi::File.new(file_id: data_file.id).links.except(:self) }\n data_file.destroy\n return my_hate\n when 'copied' # make 'deleted' which will remove in this version on next submission\n data_file.update!(file_state: 'deleted')\n end\n StashApi::File.new(file_id: data_file.id).metadata\n end", "def notify_file_rm(file)\r\n @files[file] = { exist: false }\r\n unregister_file_from_dirs(file)\r\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def delete(bucket, file); end", "def delete_file\n @file = []\n end", "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def delete uri\n @change_semaphore.synchronize do\n filename = uri_to_file(uri)\n library.delete filename\n # Remove diagnostics for deleted files\n send_notification \"textDocument/publishDiagnostics\", {\n uri: uri,\n diagnostics: []\n }\n end\n end", "def delete\n Modeles::File.delete @fileInTable.id\n @errors = nil\n @fileInTable = nil\n @path = nil\n @user = nil\n @group = nil\n @userRights = nil\n @groupRights = nil\n @othersRights = nil\n end", "def super_delete(filepath)\n # Thanks, Windows. http://alx.github.io/2009/01/27/ruby-wundows-unlink.html\n 10.times do\n begin\n File.delete(filepath)\n break\n rescue\n @logger.warn(\"Unable to delete file #{filepath}\")\n sleep 0.05\n end\n end\n end", "def delete(filename)\n File.delete File.join(@base_path, filename)\n end", "def delete\n File.delete(file_name)\n rescue\n # ignore\n end", "def delete_file(filename)\r\n DeleteFile.new(filename)\r\n end", "def remove(filename); end", "def destroy\n @nthfile.destroy\n respond_to do |format|\n format.html { redirect_to nthfiles_url, notice: 'Nthfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end", "def delete\n begin\n object = bucket.objects.find(@path)\n object.destroy\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end", "def destroy\n @f = F.find(params[:id])\n if @f\n filename = version_path + '/' + @f.name\n if File.exists?(filename)\n puts \"delete #{filename}\"\n puts File.delete(filename)\n end\n \n #if not delete last file, must reorder all file sn \n if @f.sn != @package.fs.size\n @package.fs.each do |x|\n if x.sn > @f.sn\n x.sn -= 1\n x.save\n end\n end\n end\n \n @f.destroy\n end\n \n redirect_to software_package_fs_path(@software, @package) \n end", "def deleteFile(filePath, dryRun)\n #N Without this, the deletion command won't be run at all\n sshAndScp.deleteFile(filePath, dryRun)\n end", "def delete_file(uid, info = {})\n grid_info = files_collection.find(filename: uid).first\n bucket.delete(grid_info[:_id]) if grid_info\n end", "def destroy_file\n File.delete full_file_path\n rescue\n end", "def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end", "def mark_as_deleted(options = {})\n update_receipts({ deleted: true }, options)\n end", "def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end", "def delete\n ::File.unlink(@path)\n end", "def flag_as_deleted!\n set(:deleted, true)\n end", "def destroy\n @file_version.destroy\n head :no_content\n end", "def delete_remote\n policy = get_policy(\"remove\")\n signature = get_signature(policy)\n remote = url+\"?signature=\"+signature+\"&policy=\"+policy\n try = self.class.delete(remote)\n\n # If file not found in filepicker, destroy anyway, else only if success\n if try.not_found?\n true\n else\n try.success?\n end\n end", "def mark_as_deleted(options={})\n update_receipts({:deleted => true}, options)\n end", "def mark_as_deleted(options={})\n update_receipts({:deleted => true}, options)\n end", "def delete\n unless FileDescriptor.exists?(filename: params[:fname])\n fpath = filePath params[:fname]\n begin\n File.delete fpath\n result = {status: 'ok'}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n else\n result = {status: 'error', message: 'File is open'}\n status = 403 # Forbidden\n end\n render json: result.to_json, status: status\n end", "def delete_file(uid, info = {})\n if info[\"multipart_id\"]\n multipart_upload = object(uid).multipart_upload(info[\"multipart_id\"])\n abort_multipart_upload(multipart_upload)\n\n delete [object(\"#{uid}.info\")]\n else\n delete [object(uid), object(\"#{uid}.info\")]\n end\n end", "def remove(filename)\n send_request(FXP_REMOVE, :string, filename)\n end", "def skip_deletion\n @mark_for_delete = false\n end", "def delete\n if empty?\n @perforce.run(\"change\", \"-d\", @number)\n end\n end", "def delete\n CMark.node_unlink(@pointer)\n end", "def delete_media_segment(filename)\n @headers.increment_media_sequence if @playlist\n .delete_media_segment(filename)\n end", "def delete!\n safe_close\n File.delete(@file_path)\n end", "def destroy_dirty_file!(file)\n system(\"trashtrash #{file}\")\n end", "def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue Errno::ENOENT\n end", "def delete!\n exist!\n File.unlink @path\n @path = nil\n end", "def mark_as_not_deleted(options = {})\n update_receipts({ deleted: false }, options)\n end", "def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end", "def mark_for_delete=(value = true)\n @mark_for_delete = value\n end", "def RenDeletingFiles\n\t#arquivo = File.new(\"arquivo1.txt\", \"w\")\n\t#arquivo.close()\n\t#File.delete(\"arquivo1.txt\")\nend", "def delete (fei)\n\n fei_path = compute_file_path(fei)\n\n #ldebug { \"delete() for #{fei.to_debug_s} at #{fei_path}\" }\n\n File.delete(fei_path)\n end", "def deleteFile(filePath, dryRun)\n #N Without this, the required ssh command to delete a file won't be (optionally) executed.\n ssh(\"rm #{filePath}\", dryRun)\n end", "def destroy\n @nasfile.destroy\n respond_to do |format|\n format.html { redirect_to nasfiles_url, notice: 'Nasfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(files)\n # sync before we delete\n sync\n Array.wrap(files).each do |f|\n info \"removing #{f}\"\n FileUtils.rm(f)\n error \"#{f} wasn't removed\" if File.exists?(f)\n end\n end", "def delete(uuid, key)\n request(method: 'DELETE', uri: \"/files/#{uuid}/metadata/#{key}/\")\n end", "def delete\n @lock.synchronize do\n ::File.unlink(@tmpfile) if ::File.exist?(@tmpfile)\n end\n end", "def delete_from_disk!\n if disk_filename.present?\n diskfile_s3 = diskfile\n Rails.logger.debug(\"Deleting #{diskfile_s3}\")\n RedmicaS3::Connection.delete(diskfile_s3)\n end\n\n Redmine::Thumbnail.batch_delete!(\n thumbnail_path('*').sub(/\\*\\.thumb$/, '')\n )\n end", "def remove(filename)\n not_implemented('remove')\n end", "def delete_file( path )\n # removes a file at path\n connection.delete( path )\n last_ftp_command_ok?\n end", "def mark_as_not_deleted(options={})\n update_receipts({:deleted => false}, options)\n end", "def mark_as_not_deleted(options={})\n update_receipts({:deleted => false}, options)\n end", "def deleted\n @is_deleted = true\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue nil\n end", "def remove_file!\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n self.file = nil\n self.send(:write_attribute, :file, nil)\n end\n end", "def read_me_delete( file_set: )\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"id=#{id}\",\n \"read_me_file_set_id=#{read_me_file_set_id}\",\n \"file_set.id=#{file_set.id}\",\n \"\" ] if umrdr_work_behavior_debug_verbose\n return unless Array( read_me_file_set_id ).first == file_set.id\n self[:read_me_file_set_id] = nil\n save!( validate: false )\n end", "def delete_file(file)\n delete_attachment(file)\n end", "def delete_at(line_number)\n self[line_number].delete\n super(line_number)\n update_line_numbers!\n end", "def remove file\n file.delete\n @files -= [file]\n end", "def destroy\n pid = @generic_file.noid\n @generic_file.delete\n begin\n Resque.enqueue(ContentDeleteEventJob, pid, current_user.user_key)\n rescue Redis::CannotConnectError\n logger.error \"Redis is down!\"\n end\n redirect_to sufia.dashboard_path, :notice => render_to_string(:partial=>'generic_files/asset_deleted_flash', :locals => { :generic_file => @generic_file })\n end", "def remove!(filename, &callback)\n wait_for(remove(filename, &callback))\n end", "def delete\n begin\n uy_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end", "def delete(x)\n @contents.delete x\n end", "def delete_file\n begin\n File.delete(stored_file_path)\n rescue => e\n logger.error(\"Could not delete #{stored_file_path}. Ignored.\")\n logger.error(e)\n end\n end", "def mark_deleted!\n mark_deleted\n self.save\n end", "def mark_as_deleted\n update_attribute(:is_deleted, true)\n end", "def delete(file_name)\n key = key_from_filename(file_name)\n puts \"Deleting object from s3 with key #{key}\"\n Aws::S3::Object.new(key: key, bucket_name: bucket, client: s3_client).tap do |obj|\n obj.delete\n obj.wait_until_not_exists\n end\n sync_down\n end", "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def ztest_file_deletes_on_failure\n task :obj\n file NEWFILE => [:obj] do |t|\n FileUtils.touch NEWFILE\n fail \"Ooops\"\n end\n assert Task[NEWFILE]\n begin\n Task[NEWFILE].invoke\n rescue Exception\n end\n assert( ! File.exist?(NEWFILE), \"NEWFILE should be deleted\")\n end", "def delete_rdf_file\n public_path = public_rdf_storage_path\n private_path = private_rdf_storage_path\n FileUtils.rm(public_path) if File.exist?(public_path)\n FileUtils.rm(private_path) if File.exist?(private_path)\n end", "def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end", "def ztest_file_deletes_on_failure\n task :obj\n file NEWFILE => [:obj] do |t|\n FileUtils.touch NEWFILE\n fail \"Ooops\"\n end\n assert Task[NEWFILE]\n begin\n Task[NEWFILE].invoke\n rescue Exception\n end\n assert(! File.exist?(NEWFILE), \"NEWFILE should be deleted\")\n end", "def delete_files(files)\n not_found = []\n files.each do |file|\n file_stored = Files.where({ '_id' => file[:uuid]}).first\n if file_stored.nil?\n logger.error 'File not found ' + file.to_s\n not_found << file\n else\n if file_stored['pkg_ref'] == 1\n # Referenced only once. Delete in this case\n file_stored.destroy\n del_ent_dict(file_stored, :files)\n file_md5 = Files.where('md5' => file_stored['md5'])\n if file_md5.size.to_i.zero?\n # Remove files from grid\n grid_fs = Mongoid::GridFs\n grid_fs.delete(file_stored['grid_fs_id'])\n end\n else\n # Referenced above once. Decrease counter\n file_stored.update_attributes(pkg_ref: file_stored['pkg_ref'] - 1)\n end\n # file_stored.destroy\n # del_ent_dict(file_stored, :files)\n #\n # # Remove files from grid\n # grid_fs = Mongoid::GridFs\n # grid_fs.delete(file_stored['grid_fs_id'])\n end\n end\n not_found\n end", "def destroy\n self.update_attribute :deleted, true\n end", "def delete(name)\n File.delete(path(name))\n end", "def delete(*path)\n self[*path] = Utils::DeletedMarker\n end", "def deleteIgnoreFile(fileName)\n @fileAccess.deleteIgnoreFile(fileName)\n end", "def delete_files(*files)\n files = files.flatten\n unless files.empty?\n @perforce.run(\"delete\", \"-c\", @number, *files)\n end\n end", "def delete\n ensure_connection!\n resp = connection.delete_file bucket, name\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end", "def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end", "def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end", "def rm!( path )\r\n got = @ndev.rpc.file_delete( :path => path )\r\n return true if got.nil? # got no error\r\n # otherwise, there was an error, check output\r\n raise IOError, got.text\r\n end", "def delete\n Mutagen::Util::delete_bytes(@fileobj, @size, @offset)\n @parent_chunk.resize(@parent_chunk.data_size - @size) unless @parent_chunk.nil?\n end", "def soft_delete!\n update_attribute(:mark_as_deleted, true)\n end" ]
[ "0.66196465", "0.6512705", "0.6489451", "0.621683", "0.61120754", "0.6106331", "0.60709137", "0.60230595", "0.5995096", "0.5991736", "0.59622043", "0.59556276", "0.59556276", "0.593416", "0.5933601", "0.59313464", "0.5926523", "0.5926523", "0.5829114", "0.58247", "0.5819209", "0.5816894", "0.58090746", "0.5801099", "0.57956564", "0.5783769", "0.5757645", "0.57556283", "0.5749686", "0.5742018", "0.5740071", "0.57333446", "0.5726121", "0.57244396", "0.57038313", "0.5703642", "0.56836116", "0.5674053", "0.5668541", "0.56484056", "0.56484056", "0.5638724", "0.5637249", "0.5629772", "0.562938", "0.5625768", "0.5625302", "0.56197566", "0.5615763", "0.561133", "0.5599135", "0.5597685", "0.5597085", "0.5589534", "0.5586823", "0.5582339", "0.55793816", "0.5577782", "0.5576005", "0.55748296", "0.55741173", "0.5572744", "0.5561897", "0.55603004", "0.5552689", "0.55524933", "0.55524933", "0.5547304", "0.55437845", "0.55399346", "0.55351794", "0.55342126", "0.55286586", "0.551437", "0.5513751", "0.55103755", "0.5510088", "0.5509365", "0.55061364", "0.55035216", "0.54958296", "0.549354", "0.5492169", "0.54857045", "0.54828703", "0.5468797", "0.54666257", "0.546335", "0.5460068", "0.5459757", "0.5456709", "0.54559153", "0.5447022", "0.5440108", "0.5437937", "0.54338944", "0.54338944", "0.54320985", "0.54285216", "0.5417147" ]
0.71494764
0