query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Delete file (recursive/force) ==== Options +path+:: Path to delete
def rm_rf(path) run_via "rm -rf #{path}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_file(path)\n path = File.join('/', path)\n raise ArgumentError if path == '/'\n self.class.delete(path, request_options)\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(path, options = {})\n execute('DELETE', path, options)\n end", "def delete(path, **options)\n execute :delete, path, options\n end", "def remove_file(path)\n FileUtils.rm_f(path)\n end", "def remove_file(path)\n FileUtils.rm_f(path)\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, options = nil)\n add(path, options).delete\n end", "def rm\n FileUtils.rm path if File.exist?(path)\n end", "def delete\n ::File.unlink(@path)\n end", "def delete(path = '/files/', params = {})\n request :delete, path, params\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 delete_file(path, &b)\n path = Pathname.new(path).cleanpath\n dir = path.dirname\n filename = path.basename\n if fs.directory?(dir) and fs.entries(dir).include?(filename)\n fs.delete_file(path)\n yield true\n else\n yield false\n end\n end", "def delete(path, options = {})\n connection.delete path, options\n end", "def delete(path, opts = {})\n input_json = {\n path: path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/delete\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def deleteFile(path)\n File.delete(path) if File.exist?(path)\nend", "def rm(path)\n run_via \"rm #{path}\"\n end", "def _delete(path)\n forbidden unless is_allowed? path\n not_found unless File.exists? path\n forbidden unless File.file? path\n File.delete path\n ok\n rescue SystemCallError => e\n logger.error e.message\n internal_server_error\n end", "def delete(path = nil, options = {})\n connection.delete(path, options)\n end", "def delete_file(path, opts = {})\r\n delete_file_with_http_info(path, opts)\r\n nil\r\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 rm(path)\n FileUtils.rm_rf(expand path)\n end", "def unlink(path)\n path = expand_path(path)\n if File.directory?(path)\n\tDir.unlink(path)\n else\n\tIO.unlink(path)\n end\n end", "def delete!\n return true unless File.exist?(path)\n FileUtils.rm(path)\n end", "def delete!\n exist!\n File.unlink @path\n @path = nil\n end", "def rm path\n end", "def rm(path)\n FileUtils.rm_rf(path)\n end", "def rm(path)\n remove(path, nil, true, false)\n end", "def delete(path, options={})\n send_request 'delete', path, options\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def delete_file_and_folder!( file_path )\n FileUtils.rm_f file_path\n boundary = adapter_path + '/'\n loop do\n file_path = File.dirname file_path\n break unless file_path.index boundary\n FileUtils.rmdir file_path\n end\n end", "def rm(path = '.', opts = {})\n self.lib.rm(path, opts)\n end", "def deleteFile(file_path)\n puts \"Delete file: \" + file_path.to_s\n File.delete(file_path) if File.exist?(file_path)\nend", "def delete(path)\n root.delete(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 delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def destroy(path)\n output { delete(path) }\n end", "def delete(path, options = {})\n request(:delete, path, options)\n end", "def delete(path, options = {})\n request(:delete, path, options)\n end", "def delete(path, options = {})\n request(:delete, path, options)\n end", "def rm_rf path\n execute(\"rm -rf #{path}\")\n end", "def delete_content_dir(path)\n FileUtils.rm_rf(Dir.glob(\"#{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(path)\n request(:delete, path)\n end", "def rm_rf(path)\n FileUtils.rm_rf(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 perform_delete(path, options = {})\n perform_request(:delete, path, options)\n end", "def delete(path)\n path = self.class.path(path).to_s\n zip.fopen(path).delete\n entries.delete(path)\n end", "def delete(path, options = {}, &block)\n map(path, options, :delete, &block)\n end", "def delete(path)\n abs_path = full_path(path)\n begin\n file = @client.file(abs_path)\n return false if file.nil?\n file.delete\n rescue RubyBox::AuthError\n box_error\n end\n true\n end", "def destroy\n remove_files(@path + \"*\")\n end", "def delete(path, options = {})\n request = Net::HTTP::Delete.new(request_uri(path))\n make_request(request, options.merge(no_callbacks: true))\n end", "def delete(path)\n request(:delete, path)\n end", "def remove_file_and_clean_directories( path )\n # first, delete the file\n delete_file( path )\n # recursively remove any parent directories, but only if they are empty, stop if they are not\n remove_empty_folders_recursively( path )\n end", "def rm_rf_ie file, options = {}\n rm_rf file, options if File.exist?(file)\n end", "def delete_repository_file(project_id, options = {})\n delete \"/projects/#{project_id}/repository/files\", options\n end", "def delete(path)\n path = normalize_path(path)\n if path.empty?\n raise 'Empty path'\n elsif path.size == 1\n child = @children.delete(path.first)\n @modified = true if child\n child\n else\n tree = @children[path.first]\n raise 'Not a tree' if tree.type != :tree\n tree.delete(path[1..-1])\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 destroy_file\n File.delete full_file_path\n rescue\n end", "def delete(path, options = {}, raw = false)\n request(:delete, path, options, raw)\n end", "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "def remove_directory(path)\n FileUtils.rm_rf(path)\n end", "def remove_directory(path)\n FileUtils.rm_rf(path)\n end", "def delete(path, headers = {})\n process :delete, path, headers\n end", "def delete(path, options={}, raw=false)\n request(:delete, path, options, raw)\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(path, options={}, format=format)\n request(:delete, path, options, format)\n end", "def rm_r(path)\n cmd 'rm', '-r', path\nend", "def destroy(path)\n directory = connection.directories.get(self.bucket)\n directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))\n\n file = directory.files.get(path)\n file.destroy if file\n end", "def delete\n File.delete(file_name)\n rescue\n # ignore\n end", "def delete_directory_contents(options)\n Process::Delete::DirectoryContents.delete(options[:directory_path])\n end", "def delete(path, options={}, &b)\n event(:delete, path, options, &b)\n end", "def delete(path, options = {})\n request(:delete, parse_query_and_convenience_headers(path, options))\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(path)\n request 'DELETE', path\n end", "def rm(path)\n file = scope.get(path)\n return if !file\n file.remove!\n end", "def delete\n FileUtils.rm(self.path) if exists?\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 fileCleanPath(pathName) \n pathName.mkpath()\n begin\n pathName.rmtree()\n rescue\n puts \"Cannot delete: \" + pathName.to_s\n end\n pathName.mkpath()\nend", "def delete!\n safe_close\n File.delete(@file_path)\n end", "def delete(path)\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n date = gmtdate\n headers = {\n 'Host' => @aliyun_upload_host,\n 'Date' => date,\n 'Authorization' => sign('DELETE', bucket_path, '', '', date)\n }\n url = path_to_url(path)\n response = RestClient.delete(url, headers)\n response.code == 204 ? url : nil\n end", "def delete_file(basepath = MP3_STORAGE_PATH)\n FileUtils.rm_rf(\"#{basepath}/#{id}\")\n end", "def delete_file(file)\n delete_attachment(file)\n end", "def delete_recursive(path=nil,recursive=nil)\n if path.class == String && (recursive.class == TrueClass || recursive.class == FalseClass) && block_given?\n @j_del.java_method(:deleteRecursive, [Java::java.lang.String.java_class,Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call(path,recursive,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling delete_recursive(path,recursive)\"\n end", "def deleteUploadFile\n\n filepath = Rails.root.join(path, file_name)\n\n if File.exist? filepath \n File.delete filepath\n end\n\n end", "def delete(path_info)\n @file_store.delete path_info\n\n @bucket.objects[gem_object_name(path_info)].delete\n end", "def delete_csv(path_to_delete)\n file_to_del = path_to_delete.split(\"/\").last\n path_to_del = path_to_delete.gsub(\"/original/\"+file_to_del,\"\")\n FileUtils.rm_r path_to_del\n end", "def remove(path)\n obj = self\n chdir do\n super \n obj.git.rm({}, '-f', '-r', path)\n end\n end", "def cleanup_tar_file(path)\n Mongolicious.logger.info(\"Cleaning up local path #{path}\")\n begin\n File.delete(path)\n rescue => exception\n Mongolicious.logger.error(\"Error trying to delete: #{path}\")\n Mongolicious.logger.info(exception.message)\n end\n end", "def delete(name)\n File.delete(path(name))\n end", "def rm(path)\n cmd 'rm', path\nend", "def remove_file_if_present(path)\n if File.exist?(path)\n info \"unlinking #{path}\"\n File::unlink(path)\n end\n end", "def rmdir() Dir.rmdir(path) end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\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(path, headers = {})\n with_auth { request(:delete, path, nil, build_request_headers(headers, :delete, build_uri(path))) }\n end", "def delete(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.delete\n end", "def delete(path)\n exec { index.delete(path) }\n end", "def delete_file \n #pp \"deleting file_asset: path is\" + full_filepath\n File.delete(full_filepath) if File.exists?(full_filepath)\n end" ]
[ "0.81161565", "0.7969207", "0.76214314", "0.752448", "0.73158216", "0.73158216", "0.7306531", "0.7178963", "0.7162978", "0.7143399", "0.71231925", "0.7102016", "0.70914054", "0.70842975", "0.7054071", "0.7040268", "0.70382375", "0.7026214", "0.7025417", "0.699993", "0.69972503", "0.6981731", "0.6964299", "0.6954606", "0.69441724", "0.69375527", "0.6937258", "0.68767834", "0.6862578", "0.68545145", "0.68468124", "0.6840606", "0.68213475", "0.67574716", "0.6736976", "0.67028415", "0.67028415", "0.6700086", "0.669913", "0.669913", "0.66641235", "0.66602105", "0.6651456", "0.6648936", "0.66419375", "0.6633231", "0.6588104", "0.6584061", "0.65776134", "0.6576557", "0.6558588", "0.6535772", "0.65040755", "0.6502304", "0.6499823", "0.6498649", "0.6492194", "0.649189", "0.64867795", "0.6484552", "0.6481005", "0.6478577", "0.64761317", "0.64761317", "0.64408004", "0.6429866", "0.6429126", "0.6422283", "0.6410888", "0.640532", "0.6397656", "0.63872975", "0.63789546", "0.6358151", "0.6358063", "0.63542634", "0.6348051", "0.6346832", "0.6341963", "0.63369787", "0.63231933", "0.6310702", "0.6310319", "0.6308966", "0.6303995", "0.6297853", "0.62958837", "0.62825346", "0.627228", "0.626559", "0.6264774", "0.6263391", "0.6255974", "0.625078", "0.62489724", "0.6245891", "0.62454253", "0.62363136", "0.62362355", "0.6217121" ]
0.68171066
33
Load template and install it. Removes temporary files during transfer and ensures desination directory is created before install. See template plugin for where template paths are loaded from. ==== Options +template_path+:: Path to template +destination+:: Remote path to evaluated template +options+:: Options (see Install template options) ==== Install template options +user+:: User to install (o). Defaults to root. +mode+:: Mode to install file (m) ==== Example utils.install_template("monit/memcached.monitrc.erb", "/etc/monit/memcached.monitrc", :user => "root", :mode => "600")
def install_template(template_path, destination, options = {}) # Truncate extension tmp_file_path = template_path.gsub("/", "_").gsub(/.erb$/, "") tmp_path = "/tmp/#{tmp_file_path}" options[:user] ||= "root" install_options = [] install_options << "-o #{options[:user]}" install_options << "-m #{options[:mode]}" if options.has_key?(:mode) put template.load(template_path), tmp_path # TOOD: Ensure directory exists? mkdir -p #{File.dirname(destination)} run_via "install #{install_options.join(" ")} #{tmp_path} #{destination} && rm -f #{tmp_path}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_template(path)\n puts \"Installing project template to #{path} ...\"\n template_dir = File.expand_path('../template', __FILE__)\n FileUtils.cp_r(\"#{template_dir}/.\", path)\n end", "def template(target, options={})\n template_name = options[:source] || File.basename(target)\n locals = options[:locals] || {}\n \n source = template_path(template_name, locals)\n install(source, target, options)\nend", "def install_file(path, options = {})\n source_path = \"#{TEMPLATES_REPOSITORY}/file_templates/\" +\n if options[:source] ; options[:source]\n elsif options[:flavor] ; \"#{options[:flavor]}/#{path}\"\n else path\n end\n method = options.delete(:method) || (TEMPLATES_REPOSITORY =~ /^https?:/ ? :get : :copy_file)\n send method, source_path, path\nend", "def copy_template(*args)\n args.each do |path|\n # puts \"Installing #{path}...\".magenta\n remove_file path\n file path, File.read(File.join(@path_templates, path))\n # puts \"\\n\"\n end\nend", "def create_template(source_template, path, notify)\n\n if notify\n service 'nscp' do\n action :start\n end\n template path do\n source source_template\n notifies :restart, 'service[nscp]', :immediately\n end\n else\n template path do\n source source_template\n end\n end\nend", "def upload_template(src,dst,options = {})\n raise Capistrano::Error, \"put_template requires Source and Destination\" if src.nil? or dst.nil?\n put ERB.new(File.read(src)).result(binding), dst, options\n end", "def add_template_path( args )\n files = args[:files]\n if !(options.templates.frozen?)\n files.each do |fn|\n options.templates << File.expand_path(fn)\n end\n end\n if args[:freeze] == true\n options.templates.freeze\n end\n end", "def install(template)\n # Load & parse\n return false unless ( File.exists?(template) && \n YAMLDoc::YAMLFile.template?(template) )\n\n target = associated_filename(template)\n\n documents = YAMLDoc::Parser.load_file(template)\n\n # Validate (only proceed if all pass)\n return false unless YAMLDoc::Validator.validate_documents(documents)\n \n # Generate YAML\n yaml = documents.map { |d| d.to_yaml }.join(\"\\n\")\n\n # Write to file\n File.open(target, 'w+') { |f| f << yaml }\n end", "def sudo_upload_template(src,dst,options = {})\n raise Capistrano::Error, \"sudo_upload_template requires Source and Destination\" if src.nil? or dst.nil?\n put ERB.new(File.read(src),nil,'-').result(binding), \"/tmp/#{File.basename(dst)}\", options\n sudo \"mv /tmp/#{File.basename(dst)} #{dst}\", options\n sudo \"chmod #{options[:mode]} #{dst}\", options if options[:mode]\n sudo \"chown #{options[:owner]} #{dst}\", options if options[:owner]\n end", "def copy_template name, options = {}\n FileUtils.mkdir_p dest\n FileUtils.cp_r path_to_template(name), options[:to] ?\n \"#{dest}/#{options[:to]}\" :\n dest\n end", "def overwrite_template(source, destination, *args, &block)\n FileUtils.rm(destination) if File.exist?(destination)\n template(source, destination, *args, &block)\n end", "def generate_file_from_template(template_path, file_path, options)\n write_content_to_file(file_path, render_erb_template(template_path, options))\n end", "def template(relative_source, relative_destination, template_options = {})\n create_file(relative_source, relative_destination, template_options) do |file|\n # Evaluate any assignments in a temporary, throwaway binding.\n vars = template_options[:assigns] || {}\n b = template_options[:binding] || binding\n vars.each { |k,v| eval \"#{k} = vars[:#{k}] || vars['#{k}']\", b }\n\n # Render the source file with the temporary binding.\n ERB.new(file.read, nil, '-').result(b)\n end\n end", "def install_template(file_parts, dest, subs = {})\n content = String.new\n file_parts.each do |file_part|\n full_path = File.join(File.dirname(__FILE__), file_part)\n begin\n content += File.open(full_path).read\n rescue\n end\n end\n subs.keys.each do |k|\n content.gsub!(/#{k}/, subs[k])\n end\n File.open(dest, 'w') {|file| file.write(content)}\n end", "def setup(template_path, config_path)\n if !File.directory? config_path and !File.exists? config_path\n logger.info \"Config path #{config_path} was not found, creating from template...\"\n FileUtils.mkdir_p(config_path)\n FileUtils.cp_r(Dir[File.join(template_path, \"*\")], config_path)\n elsif !File.directory? config_path\n err_msg = \"Config path #{config_path} exists, but is not a valid gitsy \"\n err_msg += \"configuration directory. Delete it to create a new one from a template.\"\n logger.error err_msg\n raise \"Gitsy is not configured correctly. Please check the logs for more details.\"\n end\n end", "def provider_template(template, options)\n require 'erb'\n require 'ostruct'\n ERB.new(File.read(template)).result(\n OpenStruct.new(options).instance_eval {binding}\n )\n end", "def call\n INSTALL_DIRS.each do |dir|\n FileUtils.mkdir_p Karafka.root.join(dir)\n end\n\n INSTALL_FILES_MAP.each do |source, target|\n target = Karafka.root.join(target)\n next if File.exist?(target)\n\n source = Karafka.core_root.join(\"templates/#{source}\")\n FileUtils.cp_r(source, target)\n end\n end", "def copy_template\n FileUtils.mkdir_p(self.source) unless File.exists?(self.source)\n File.open(File.join(self.source, 'template.erb'), 'w') do |file|\n erb = File.read(File.join(generator_path, 'template.erb'))\n erb.gsub!('{{query}}', self.query) if self.query\n file.write(erb)\n end\n FileUtils.cp_r File.join(generator_path, '_assets'), self.source\n end", "def template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/#{TEMPLATE_EXTNAME}$/, \"\")\n\n source = File.expand_path(find_in_source_paths(source.to_s))\n context = config.delete(:context) || instance_eval(\"binding\")\n\n create_file destination, nil, config do\n content = CapturableERB.new(::File.binread(source), nil, \"-\", \"@output_buffer\").result(context)\n content = yield(content) if block\n content\n end\n end", "def build_template(template_path)\n # FIXME: this is called every time build_template is called.\n # although this is idepodent, it's got room for optimization\n self.build_components!\n\n ERB.new( File.open( template_path ).read, nil, '<>' ).result(self.binding)\n end", "def render_template(source_path, destination_path = nil)\n return unless source_path.end_with?('.erb')\n\n destination_path = source_path.chomp('.erb') if destination_path.nil?\n\n File.open(source_path) do |file|\n erb = ERB.new(file.read)\n File.open(destination_path, 'w') do |out|\n out.write(erb.result(binding))\n end\n\n remove_file(source_path)\n end\n end", "def template_path(template_name, target_name=template_name.chomp('.erb'), mode=0600, locals={'attrs' => attrs})\r\n _package_.build_template(target_name, template_name, mode, locals)\r\n target_path target_name\r\n end", "def apply_template(client)\n ERB.new(open(template_path).read, nil, \"-\").result(binding)\n end", "def apply_template(client)\n ERB.new(open(template_path).read, nil, \"-\").result(binding)\n end", "def load_html_template\n template = @options.template\n\n unless template =~ %r{/|\\\\} then\n generator_name = @options.generator.name.sub(/^RDoc::Generator::/, '')\n template = File.join('rdoc', 'generator', generator_name.downcase,\n template)\n end\n\n begin\n require template\n\n @template = self.class.const_get @options.template.upcase\n @options.template_class = @template\n rescue LoadError => e\n # The template did not exist in the default template directory, so\n # see if require can find the template elsewhere (in a gem, for\n # instance).\n if(e.message[template] && template != @options.template)\n template = @options.template\n retry\n end\n\n $stderr.puts \"Could not find HTML template '#{template}': #{e.message}\"\n exit 99\n end\n end", "def template(template)\n @template = \"#{Aina::TEMPLATES_DIR}/#{template}\" if template\n end", "def add_template(filepath)\n # templates must be strings for ERB\n @template = File.read(filepath)\n end", "def assign_template\n @template = if opts[:template]\n Base.sources.template_for(opts[:template], :from => dep_source).tap {|t|\n raise DepError, \"There is no template named '#{opts[:template]}' to define '#{name}' against.\" if t.nil?\n }\n else\n (Base.sources.template_for(suffix, :from => dep_source) || self.class.base_template).tap {|t|\n opts[:suffixed] = (t != BaseTemplate)\n }\n end\n end", "def get_template(name, options)\n t_hash = nil\n if !options[:template_name].nil? || !options[:template_id].nil?\n t_hash = template_from_one(options)\n elsif !options[:template_file].nil?\n t_hash = template_from_file(options)\n elsif !options[:template].nil?\n t_hash = template_from_hash(options)\n else\n fail \"To create a VM you must specify one of ':template', \" \\\n \"':template_id', or ':template_name' option \" \\\n \"in ':bootstrap_options'\"\n end\n fail \"Inavlid VM template : #{t_hash}\" if t_hash.nil? || t_hash.empty?\n tpl_updates = options[:template_options] || {}\n if options[:user_variables]\n Chef::Log.warn(\"':user_variables' will be deprecated in next \" \\\n \"version in favour of ':template_options'\")\n recursive_merge(tpl_updates, options[:user_variables])\n end\n recursive_merge(t_hash, tpl_updates) unless tpl_updates.empty?\n if options[:enforce_chef_fqdn]\n Chef::Log.warn(':enforce_chef_fqdn has been deprecated. VM name ' \\\n 'will be set to the machine resource name.')\n end\n # FQDN is the machine resource name, unless overridden by e.g. cloud-init\n t_hash['NAME'] = name\n unless t_hash['CONTEXT']['SSH_PUBLIC_KEY']\n t_hash['CONTEXT']['SSH_PUBLIC_KEY'] = \"$USER[SSH_PUBLIC_KEY]\"\n end\n tpl = create_template(t_hash)\n Chef::Log.debug(tpl)\n tpl\n end", "def template!(path, full_paths = nil)\n full_paths ||= [path]\n full_paths = [full_paths] unless full_paths.is_a?(Array)\n name = template_module_name(full_paths.first)\n begin; return const_get(name); rescue NameError; nil end\n\n mod = const_set(name, Module.new)\n mod.send(:include, Template)\n mod.send(:initialize, path, full_paths)\n mod\n end", "def create_template(filename, _context=nil)\n template = @templateclass.new(nil, @init_opts_for_template)\n template.timestamp = Time.now()\n cache_filename = cachename(filename)\n _context = hook_context(Context.new) if _context.nil?\n if !@cache\n input = read_template_file(filename, _context)\n template.convert(input, filename)\n elsif !test(?f, cache_filename) || File.mtime(cache_filename) < File.mtime(filename)\n #$stderr.puts \"*** debug: load original\"\n input = read_template_file(filename, _context)\n template.convert(input, filename)\n store_cachefile(cache_filename, template)\n else\n #$stderr.puts \"*** debug: load cache\"\n template.filename = filename\n load_cachefile(cache_filename, template)\n end\n return template\n end", "def use_template(template)\n @template = template\n end", "def use_template(template)\n @template = template\n end", "def template_for path, engine=nil\n templates.cache([path, engine]) do\n if file = template_files(path).first\n ext = File.extname(file)\n ext = ext.empty? ? nil : ext[1..-1]\n engine ||= template_engines[ext].first\n engine.new(file) if engine\n end\n end\n end", "def template_path\n File.join path, 'templates'\n end", "def template(src, dst, **context)\n rendered = TemplateRenderer.render(File.read(src), context)\n File.write(dst, rendered)\n end", "def install_site(site, opts={})\n user = opts[:user] || \"root\"\n group = opts[:group] || \"root\"\n mode = opts[:mode] || 0444\n enable = opts[:enable] != false\n source = opts[:source] || \"#{interpreter.dist}/#{self.sites_available}/#{site}\"\n target = opts[:target] || \"#{self.sites_available}/#{site}\"\n template = opts[:template] || false\n params = opts[:params] || {}\n\n modified = false\n if template\n template_source = template == true ? \"#{source}.erb\" : template\n modified |= interpreter.render(template_source, target, :user => user, :group => group, :mode => mode, :params => params)\n else\n modified |= interpreter.cp(source, target, :user => user, :group => group, :mode => mode)\n end\n if enable\n modified |= self.enable_site(site)\n end\n return modified\n end", "def template_resource\n @template_resource ||= template new_resource.path do\n source new_resource.source\n cookbook new_resource.cookbook\n owner 'root'\n group 'root'\n mode 00644\n variables name: new_resource.name,\n priority: new_resource.priority,\n extensions: new_resource.extensions,\n directives: new_resource.directives\n action :nothing\n end\n end", "def template(pathname, b = binding)\n pathname = Pathname.new(pathname) unless pathname.kind_of?(Pathname)\n\n template_contents = if pathname.exist?\n template_contents = pathname.read\n else\n raise LoadError, \"Can't find template #{pathname}\"\n end\n ERB.new(template_contents).result(b)\n end", "def migration_template(source, destination=nil, config={})\n destination = File.expand_path(destination || source, self.destination_root)\n\n migration_dir = File.dirname(destination)\n @migration_number = self.class.next_migration_number(migration_dir)\n @migration_file_name = File.basename(destination).sub(/\\.rb$/, '')\n @migration_class_name = @migration_file_name.camelize\n\n destination = self.class.migration_exists?(migration_dir, @migration_file_name)\n\n if !(destination && options[:skip]) && behavior == :invoke\n if destination && options.force?\n remove_file(destination)\n elsif destination\n raise Error, \"Another migration is already named #{@migration_file_name}: #{destination}. Use --force to remove the old migration file and replace it.\"\n end\n destination = File.join(migration_dir, \"#{@migration_number}_#{@migration_file_name}.rb\")\n end\n\n template(source, destination, config)\n end", "def register_template_path(path)\n template_paths.unshift(path)\n end", "def load_template( templatepath )\n\t\treturn ERB.new( templatepath.read, nil, '%<>' ).freeze\n\tend", "def view_template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/\\.tt$/, '')\n \n source = File.expand_path(source.to_s)\n context = instance_eval('binding')\n \n create_file destination, nil, config do\n content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)\n content = block.call(content) if block\n content\n end\n end", "def template_for(path)\n path = File.expand_path(path) \n METHOD_LIST[path] ||= begin\n unless File.exists?(path) \n raise ArgumentError, \"Could not find a template at #{path}.*\"\n end\n inline_template(path)\n end\n end", "def load_template(template_path)\n if ! File.exist?(template_path)\n return nil\n end\n\n return File.read(template_path)\nend", "def create(path)\n self.destination_root = path\n\n copy_file(\".gitignore\")\n copy_file(\"config.ru\")\n copy_file(\"Gemfile\")\n copy_file(\"Procfile\")\n copy_file(\"README.md\")\n\n copy_content\n copy_themes\n end", "def render template, options={}\n put_on_a_hat\n\n if options.has_key? :dir\n template = :\"#{options[:dir]}/#{template}\" if options[:dir]\n\n elsif view_dir\n template = :\"#{view_dir}/#{template}\"\n end\n\n return erubis template, options\n end", "def template_path\n \"#{template_dir}/#{template_name}\"\n end", "def render_path(template, options = {:partial => true, :con_name => nil})\n options[:con_name] ||= controller_name\n template_file = \"_#{template}\" if options[:partial]\n File.exist?(File.join(RAILS_ROOT, 'app', 'views', options[:con_name], template_file + \".rhtml\")) ? template : \"../../vendor/plugins/streamlined/templates/generic_views/#{template}\"\n end", "def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend", "def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend", "def render_template(options)\n @assigns_added = nil\n template, layout, partial = options.values_at(:_template, :_layout, :_partial)\n _render_template(template, layout, options, partial)\n end", "def add_template(*args)\n templates.add_template(*args)\n end", "def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend", "def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend", "def create_template(erb, dest)\n template(erb, File.join(target_dir, dest), config)\n end", "def template_create(path, section_name, section_id, system_name, title, layout_name, type, filename, liquid)\n check_path_or_raise path\n check_section_name_or_raise section_name\n check_id_or_raise section_id\n check_title_or_raise title\n check_layout_name_or_raise layout_name\n check_template_type_or_raise type\n check_filename_or_raise filename\n\n params = { :provider_key => @provider_key,\n :type => type,\n :title => title,\n :section_name => section_name,\n :section_id => section_id,\n :layout_name => layout_name,\n :path => path,\n :liquid_enabled => liquid,\n :draft => File.read(filename),\n :multipart => true }\n\n unless type == 'page'\n check_system_name_or_raise system_name\n params[:system_name] = system_name\n end\n\n response = http_request_multipart :post, @base_url + '/templates.xml', 201, params\n\n parse_response response, type\n end", "def local_template(path)\n # Is there a better way to specify alternate template locations with sinatra?\n File.read(File.join(File.dirname(__FILE__), \"server/views/#{path}\"))\n end", "def template(*path); end", "def load_template(template)\n begin\n template = File.join(File.dirname(__FILE__), \"/recipes/#{template}\")\n code = open(template).read\n in_root { self.instance_eval(code) }\n rescue LoadError, Errno::ENOENT => e\n raise \"The template [#{template}] could not be loaded. Error: #{e}\"\n end\nend", "def template_path\n File.expand_path(File.join(File.dirname(__FILE__), \"template.rb\"))\n end", "def local_template(path)\n # Is there a better way to specify alternate template locations with sinatra?\n File.read(File.join(File.dirname(__FILE__), \"server/views/#{path}\"))\n end", "def load_html_template\n template = @options.template\n\n unless template =~ %r{/|\\\\} then\n template = File.join('rdoc', 'generator', @options.generator.key,\n template)\n end\n\n require template\n\n @template = self.class.const_get @options.template.upcase\n @options.template_class = @template\n\n rescue LoadError\n $stderr.puts \"Could not find HTML template '#{template}'\"\n exit 99\n end", "def execute!\n config[:print_only] = true\n file = load_template_file\n\n output_content = parameter_scrub!(template_content(file))\n if config[:yaml]\n require \"yaml\"\n output_content = YAML.dump(output_content)\n else\n output_content = format_json(output_content)\n end\n\n if config[:write_to_file]\n unless File.directory?(File.dirname(config[:write_to_file]))\n run_action \"Creating parent directory\" do\n FileUtils.mkdir_p(File.dirname(config[:write_to_file]))\n nil\n end\n end\n run_action \"Writing template to file - #{config[:write_to_file]}\" do\n File.write(config[:write_to_file], output_content)\n nil\n end\n else\n ui.puts output_content\n end\n end", "def render_template(*args)\n options = args.extract_options!\n filename, content = *args\n render_tilt(filename, content, options) || render_static(filename)\n end", "def template_result template, context, template_file\n template.filename = template_file.to_s\n template.result context\n rescue NoMethodError => e\n raise RDoc::Error, \"Error while evaluating %s: %s\" % [\n template_file.expand_path,\n e.message,\n ], e.backtrace\n end", "def template_upload(*paths)\n remote_path = paths.pop\n templates = []\n paths.collect! do |path| \n if StringIO === path\n path.rewind\n template = Rye::Tpl.new(path.read, \"inline-template\")\n elsif String === path\n raise \"No such file: #{Dir.pwd}/#{path}\" unless File.exists?(path)\n template = Rye::Tpl.new(File.read(path), File.basename(path))\n end\n template.result!(binding)\n templates << template\n template.path\n end\n paths << remote_path\n ret = self.file_upload *paths\n templates.each { |template| \n tmp_path = File.join(remote_path, File.basename(template.path))\n if file_exists?(tmp_path)\n mv tmp_path, File.join(remote_path, template.basename)\n end\n template.delete \n }\n ret\n end", "def render(path, options={})\n # render template\n template = File.read(path)\n\n # assign locals to the render binding\n # this almost surely may be optimized...\n locals = options[:locals]\n binding = empty_binding\n\n locals.each_pair do |key, value|\n @assignment_value = value\n eval(\"#{key} = remove_instance_variable(:@assignment_value)\", binding)\n end if locals\n\n erb = ERB.new(template, nil, \"<>\")\n erb.filename = path\n erb.result(binding)\n end", "def render_to_remote template, remote_file, *param_array\n perm = if param_array.first.is_a? Fixnum\n param_array.shift \n else\n 0600\n end\n \n locals = param_array.pop || {}\n \n # remote_dir = File.dirname remote_file\n # begin\n # @host.sftp.dir.entries remote_dir\n # rescue Exception => e\n # puts \"Directory #{remote_dir} does not exist, creating it (#{e})\"\n # mkdir_p remote_dir\n # end\n \n content = render(template, locals) \n \n @host.sftp.file.open(remote_file, 'w', perm) do |f|\n f.puts content\n end\n end", "def create_yaml_templates_dir(templates_yaml_source, templates_yaml_destination)\n log(\"Creating #{templates_yaml_destination}\")\n remote_directory templates_yaml_destination do\n source templates_yaml_source # files/default/templates_yaml\n files_owner node['jmxtrans']['user']\n files_group node['jmxtrans']['user']\n files_mode \"0755\"\n owner node['jmxtrans']['user']\n group node['jmxtrans']['user']\n mode \"0755\"\n purge true\n action :nothing\n # because we need all the templates on disk for\n # rendering, we force this to happen at compile time\n end.run_action(:create)\nend", "def render_template(opts={})\n template_file_path = @bootstrap_template_path || File.expand_path(TEMPLATE_PATH, __FILE__)\n template_file = File.read(template_file_path)\n erb_template = ERB.new(template_file)\n last_bootstrap_line = LAST_BOOTSTRAP_LINE\n generated_template = erb_template.result(binding)\n @log.debug \"generated template is #{generated_template}\"\n return generated_template\n end", "def render(template_name, options = {})\n template_file_path = get_sql_template_path(template_name)\n\n if !File.exists?(template_file_path)\n raise \"File #{template_file_path} does not exist\"\n end\n\n begin\n sql_template_path_stack.push(File.dirname(template_file_path))\n result = render_text(IO.read(template_file_path, {:mode => 'r:BOM|UTF-8'}), options)\n rescue => detail\n # Report errors in the template\n if detail.backtrace[0] =~ /^\\(erb\\)/\n raise \"Template error in #{template_name}:\\n#{detail.backtrace[0]} : #{detail.message}\\n\"\n else\n raise detail\n end\n ensure\n sql_template_path_stack.pop\n end\n\n result\n end", "def _pick_template(template_path)\n return template_path if template_path.respond_to?(:render)\n\n path = template_path.sub(/^\\//, '')\n if m = path.match(/(.*)\\.(\\w+)$/)\n template_file_name, template_file_extension = m[1], m[2]\n else\n template_file_name = path\n end\n\n # OPTIMIZE: Checks to lookup template in view path\n if template = self.view_paths[\"#{template_file_name}.#{template_format}\"]\n template\n elsif template = self.view_paths[template_file_name]\n template\n elsif (first_render = @_render_stack.first) && first_render.respond_to?(:format_and_extension) &&\n (template = self.view_paths[\"#{template_file_name}.#{first_render.format_and_extension}\"])\n template\n elsif template_format == :js && template = self.view_paths[\"#{template_file_name}.html\"]\n @template_format = :html\n template\n else\n template = ActionView::Template.new(template_path, view_paths)\n template.registerView(self)\n\n if self.class.warn_cache_misses && logger\n logger.debug \"[PERFORMANCE] Rendering a template that was \" +\n \"not found in view path. Templates outside the view path are \" +\n \"not cached and result in expensive disk operations. Move this \" +\n \"file into #{view_paths.join(':')} or add the folder to your \" +\n \"view path list\"\n end\n\n template\n end\n end", "def template\n @template ||= File.read(template_full_path)\n end", "def generate_populate_folder\n empty_directory 'db/populate'\n # copy_file \"template_filename\", \"final_directory\" # With this we will copy the file straigh from tempaltes folder to the final destination\n # template \"template_filename\", \"final_directory\" # With this we can pass arguments to the template\n # if option_name ...\n end", "def process_template(template)\n @dlogger.debug \"Processing template #{template} for file #{@file}\"\n # The '-' arg allows folks to use <% -%> or <%- -%> to instruct ERB to\n # not insert a newline for that line, which helps avoid a bunch of blank\n # lines in the processed file where there was code in the template.\n erb = ERB.new(IO.read(template), nil, '-')\n # The binding arg ties the template's namespace to this point in the\n # code, thus ensuring that all of the variables above (@file, etc.)\n # are visible to the template code.\n begin\n erb.result(binding)\n rescue Exception => e\n # Help the user figure out where the exception occurred, otherwise they\n # just get told it happened here, which isn't very helpful.\n raise Etch.wrap_exception(e, \"Exception while processing template #{template} for file #{@file}:\\n\" + e.message)\n ensure\n restore_globals\n end\n end", "def render(template_path, locals = {})\n old_locals = @locals\n @locals = locals.with_indifferent_access\n erb = VizBuilder.erb_new(template_path)\n ret = erb.result(binding)\n @locals = old_locals\n ret\n end", "def init_config_template\n return false if config_template_exist?\n\n Chef::Log.info(\"init_config_template: Creating config template resource for #{new_resource.config_file}\")\n\n config_variables = if new_resource.load_existing_config_file\n load_method = new_resource.config_file.match?('grafana.ini') ? :load_file_grafana_config : :load_file_ldap_config\n Chef::Log.debug(\"init_config_template: Loading existing config file #{new_resource.config_file} into template variables via #{load_method}\")\n\n existing_config_load = send(load_method, new_resource.config_file) || {}\n Chef::Log.debug(\"init_config_template: Existing config load data: #{existing_config_load}\")\n\n existing_config_load\n else\n {}\n end\n\n with_run_context(:root) do\n declare_resource(:chef_gem, 'deepsort') { compile_time true } unless gem_installed?('deepsort')\n declare_resource(:chef_gem, 'inifile') { compile_time true } unless gem_installed?('inifile')\n declare_resource(:chef_gem, 'toml-rb') { compile_time true } unless gem_installed?('toml-rb')\n\n declare_resource(:template, ::File.join(new_resource.config_file)) do\n source new_resource.source\n cookbook new_resource.cookbook\n\n owner new_resource.owner\n group new_resource.group\n mode new_resource.filemode\n\n sensitive new_resource.sensitive\n\n variables(config: config_variables)\n\n helpers(Grafana::Cookbook::IniHelper)\n helpers(Grafana::Cookbook::TomlHelper)\n\n action :nothing\n delayed_action :create\n end\n end\n\n true\n end", "def render_template( templatefile, context, outfile )\n\t\ttemplate_src = templatefile.read\n\t\ttemplate = ERB.new( template_src, nil, '<>' )\n\t\ttemplate.filename = templatefile.to_s\n\n\t\toutput = begin\n\t\t\ttemplate.result( context )\n\t\trescue NoMethodError => err\n\t\t\traise \"Error while evaluating %s: %s (at %p)\" % [\n\t\t\t\ttemplatefile.to_s,\n\t\t\t\terr.message,\n\t\t\t\teval( \"_erbout[-50,50]\", context )\n\t\t\t]\n\t\tend\n\n\t\tunless $dryrun\n\t\t\toutfile.dirname.mkpath\n\t\t\toutfile.open( 'w', 0644 ) do |ofh|\n\t\t\t\tofh.print( output )\n\t\t\tend\n\t\telse\n\t\t\tdebug_msg \" would have written %d bytes to %s\" %\n\t\t\t[ output.length, outfile ]\n\t\tend\n\tend", "def render_template( templatefile, context, outfile )\n\t\ttemplate_src = templatefile.read\n\t\ttemplate = ERB.new( template_src, nil, '<>' )\n\t\ttemplate.filename = templatefile.to_s\n\n\t\toutput = begin\n\t\t\ttemplate.result( context )\n\t\trescue NoMethodError => err\n\t\t\traise \"Error while evaluating %s: %s (at %p)\" % [\n\t\t\t\ttemplatefile.to_s,\n\t\t\t\terr.message,\n\t\t\t\teval( \"_erbout[-50,50]\", context )\n\t\t\t]\n\t\tend\n\n\t\tunless $dryrun\n\t\t\toutfile.dirname.mkpath\n\t\t\toutfile.open( 'w', 0644 ) do |ofh|\n\t\t\t\tofh.print( output )\n\t\t\tend\n\t\telse\n\t\t\tdebug_msg \" would have written %d bytes to %s\" %\n\t\t\t[ output.length, outfile ]\n\t\tend\n\tend", "def prepare_template(name)\n if @loader.needs_compile?(name)\n lua = @compiler.compile(name, @loader.load_template(name))\n @loader.save_compiled(name, lua)\n end\n end", "def check_template_exists(template_path)\n unless File.exist?(template_path)\n puts \"The template #{template_path} does not exist. Are you sure you use the right template name? The template name does not require the extension.\".color(:red)\n exit 1\n end\n end", "def compile_template(template)\n return unless compile_template?(template)\n\n render_symbol = assign_method_name(template)\n render_source = create_template_source(template, render_symbol)\n line_offset = self.template_args[render_symbol].size + self.line_offset\n\n begin\n file_name = template.filename || 'compiled-template'\n ActionView::Base::CompiledTemplates.module_eval(render_source, file_name, -line_offset)\n rescue Exception => e # errors from template code\n if @view.logger\n @view.logger.debug \"ERROR: compiling #{render_symbol} RAISED #{e}\"\n @view.logger.debug \"Function body: #{render_source}\"\n @view.logger.debug \"Backtrace: #{e.backtrace.join(\"\\n\")}\"\n end\n\n raise ActionView::TemplateError.new(template, @view.assigns, e)\n end\n\n self.compile_time[render_symbol] = Time.now\n # logger.debug \"Compiled template #{file_name || template}\\n ==> #{render_symbol}\" if logger\n end", "def determine_template(options)\n keys = options.has_key?(:locals) ? options[:locals].keys : []\n\n if options.key?(:body)\n Template::Text.new(options[:body])\n elsif options.key?(:plain)\n Template::Text.new(options[:plain])\n elsif options.key?(:html)\n Template::HTML.new(options[:html], formats.first)\n elsif options.key?(:file)\n if File.exist?(options[:file])\n Template::RawFile.new(options[:file])\n else\n if Pathname.new(options[:file]).absolute?\n raise ArgumentError, \"File #{options[:file]} does not exist\"\n else\n raise ArgumentError, \"`render file:` should be given the absolute path to a file. '#{options[:file]}' was given instead\"\n end\n end\n elsif options.key?(:inline)\n handler = Template.handler_for_extension(options[:type] || \"erb\")\n format = if handler.respond_to?(:default_format)\n handler.default_format\n else\n @lookup_context.formats.first\n end\n Template::Inline.new(options[:inline], \"inline template\", handler, locals: keys, format: format)\n elsif options.key?(:renderable)\n Template::Renderable.new(options[:renderable])\n elsif options.key?(:template)\n if options[:template].respond_to?(:render)\n options[:template]\n else\n @lookup_context.find_template(options[:template], options[:prefixes], false, keys, @details)\n end\n else\n raise ArgumentError, \"You invoked render but did not give any of :body, :file, :html, :inline, :partial, :plain, :renderable, or :template option.\"\n end\n end", "def init_template(page_template, template_file)\n tmpl = Liquid::Template.new\n tmpl.assigns['page_title'] = 'Page title'\n tmpl.assigns['template'] = page_template\n tmpl.registers[:file_system] = ThemeRunner::FileSystem.new(File.dirname(template_file))\n tmpl\n end", "def template_source\n @template_source ||= @options[:template_content] || read_file(template_file)\n end", "def copy_template_files_to(answer)\n template_files.each do |template_file|\n template_file.copy_template_to(answer)\n end\n end", "def template_to_s(template_name, locals = {})\n config_file = \"#{fetch(:templates_path)}/#{template_name}\"\n # if no customized file, proceed with default\n unless File.exists?(config_file)\n config_file = File.join(File.dirname(__FILE__), \"../../generators/capistrano/delayed_job/templates/#{template_name}\")\n end\n\n ERB.new(File.read(config_file), nil, '-').result(ERBNamespace.new(locals).get_binding)\n end", "def process_template(source_file)\n rfile = ERB.new(File.read(source_file))\n @cookbook = @metadata.name\n\n rfile.result(binding)\n end", "def fill_template\n @log.debug(\"Reading erb template from file: '#{@template}'.\")\n erb = ERB.new(File.read(@template), nil, '-')\n erb.filename = @template\n erb.result(binding)\n end", "def render_template(full_path)\n @current_template = TemplateRenderer.new(@volt_app, @target, @controller, @binding_name, full_path)\n\n call_ready\n end", "def check_template_exists(template_path)\n unless File.exist?(template_path)\n puts \"The template #{template_path} does not exist. Are you sure you use the right template name? The template name does not require the extension.\".color(:red)\n exit 1\n end\n end", "def write_template(template, target, config)\n\n File.write(\n\n target,\n ERB.new(File.read(template)).result(binding)\n )\nend", "def process_template(template_path)\n if @processed_templates[template_path]\n return @processed_templates[template_path]\n end\n\n unprocessed_template = read_template(template_path)\n @processed_templates[template_path] = unprocessed_template.gsub(/{{[^{}()\\[\\]]+}}/) do |to_replace|\n replacement_path = to_replace.gsub(/[{}]/, '')\n process_template(replacement_path)\n end.strip\n end", "def evaluate_template(template_name,bind)\n template_dir = File.expand_path('./scripts',File.dirname(__FILE__))\n template = File.read(File.expand_path(\"./#{template_name}\",template_dir))\n ERB.new(template, nil, '-').result(bind)\nend", "def evaluate_template(template_name,bind)\n template_dir = File.expand_path('./scripts',File.dirname(__FILE__))\n template = File.read(File.expand_path(\"./#{template_name}\",template_dir))\n ERB.new(template, nil, '-').result(bind)\nend", "def add_template(name, *args)\n if args.size == 1 and Template===args[0]\n @templates[name] = args[0]\n else\n @templates[name] = template(*args)\n end\n end", "def install\n template 'Guardfile'\n end", "def template(value = nil)\n if value\n @template = value\n options[:template] = @template\n end\n @template ||= nil\n end", "def render_template(path)\n render(path)\n exit\n end" ]
[ "0.7118178", "0.7028229", "0.6262468", "0.6239971", "0.5836827", "0.57992494", "0.5749228", "0.564967", "0.56440383", "0.5638322", "0.55855095", "0.552526", "0.55077505", "0.5486212", "0.54749334", "0.5378448", "0.5371758", "0.5335664", "0.53325105", "0.5305625", "0.5277993", "0.52400327", "0.5196674", "0.519642", "0.5190768", "0.5188511", "0.51875234", "0.5116751", "0.5102101", "0.5100354", "0.50987977", "0.5091791", "0.5083059", "0.5056094", "0.5052257", "0.5050309", "0.5024542", "0.50056124", "0.5003168", "0.49894005", "0.49825224", "0.49629158", "0.49348646", "0.49331832", "0.49260378", "0.49239954", "0.49170908", "0.49167034", "0.49115944", "0.49109927", "0.49109927", "0.49098185", "0.49054307", "0.49000233", "0.49000233", "0.48902792", "0.48833624", "0.48794562", "0.48789912", "0.48743844", "0.48675492", "0.48654217", "0.4861138", "0.48599863", "0.48542023", "0.48448998", "0.48439348", "0.4840164", "0.48395133", "0.48394912", "0.48353514", "0.48329532", "0.4831247", "0.4830056", "0.4824096", "0.481064", "0.4809888", "0.48020527", "0.47977003", "0.47977003", "0.479346", "0.4791438", "0.47854704", "0.47819057", "0.47771847", "0.47627658", "0.4758462", "0.47476137", "0.47433314", "0.47394717", "0.47285658", "0.47114462", "0.47093305", "0.47091547", "0.4708001", "0.4708001", "0.47046113", "0.46985194", "0.46959606", "0.4695758" ]
0.86968935
0
Grep file for regex. Returns true if found, false otherwise. ==== Options +grep+:: Regular expression +path+:: Path to file ==== Example utils.egrep("^mail.\\", "/etc/syslog.conf") => true
def egrep(grep, path) found = true run_via %{egrep '#{grep}' #{path} || echo $?} do |channel, stream, data| if data =~ /^(\d+)/ if $1.to_i > 0 logger.trace "Not found" found = false end end end found end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def egrep(pattern)\n Dir['**/*'].\n find_all { |fn| FileTest.file?(fn) }.\n reject { |fn| File.basename(fn) =~ /^\\./ }.\n reject { |fn| fn =~ /^hosting\\// }.\n each do |fn|\n line_count = 0\n open(fn) do |f|\n while line = f.gets\n line_count += 1\n if line =~ pattern\n puts \"#{fn}:#{line_count}:#{line.strip}\"\n end\n end\n end\n end\nend", "def ruby_grep(filename, pattern)\n regexp = Regexp.new(pattern)\n File.open(filename, 'r') do |file|\n file.each_line {|line| puts line if regexp =~ line}\n end\nend", "def grep_file(file_path, grep_pattern)\n logc(\"method: #{__method__}, params: #{file_path}, #{grep_pattern}\")\n\n # with File.open(file_path, 'r').each.grep(grep_pattern) possible invalid byte sequence in UTF-8 (ArgumentError)\n # so we use \"match\" to check if line match pattern and 'scrub' to skip bad encoding symbols\n res = []\n File.open(file_path, 'r').each {|line| res << line if line.scrub.match(grep_pattern)}\n return res\nend", "def file_contains(filename, pattern)\n unless pattern.kind_of?(Regexp)\n pattern = Regexp.new(pattern)\n end\n detected = nil\n File.open(filename) { |f|\n detected = f.detect { |line|\n line =~ pattern\n }\n }\n ! detected.nil?\n end", "def simple_grep(filename, phrase)\n regexp = Regexp.new(phrase)\n File.open(filename, 'r') do |file|\n # file.each_line {|line| puts line if regexp =~line}\n file.each_line do |line|\n puts \"#{$.} - #{line}\" if regexp =~line \n end\n end\nend", "def egrep(pattern, *options)\n matched = 0\n each do |fn|\n begin\n File.open(fn, \"r\", *options) do |inf|\n count = 0\n inf.each do |line|\n count += 1\n if pattern.match(line)\n matched += 1\n if block_given?\n yield fn, count, line\n else\n puts \"#{fn}:#{count}:#{line}\"\n end\n end\n end\n end\n rescue StandardError => ex\n $stderr.puts \"Error while processing '#{fn}': #{ex}\"\n end\n end\n matched\n end", "def grepper(fileName,expression)\n IO.foreach(fileName){|line| puts line if line =~ /#{expression}(.*)/}\nend", "def grep *args\n if exists?\n matches = read.split(\"\\n\").grep(*args)\n matches unless matches.empty?\n end\n end", "def grep(expr, filename='')\n\tif filename == ''\n\t\tlines = STDIN.readlines\n\telse\n\t\tbegin\n\t\t\tFile.open(filename, \"r\") do |f|\n\t\t\t\tlines = f.readlines\n\t\t\tend\n\t\trescue SystemCallError => e\n\t\t\tSTDERR.puts \"#{filename}: Error: could not read from file (#{e}).\"\n\t\t\treturn\n\t\tend\n\tend\n\tfor line in lines\n\t\tif line =~ Regexp.new(expr)\n\t\t\tputs \"#{filename}: #{line}\"\n\t\tend\n\tend\n\nend", "def do_grep(name, line, greps) \n log = \"[#{name}] - #{line}\" \n \n # default output to screen \n puts log \n \n # grep patterns to sepecific files \n for log_file, patterns in greps \n pattern = (patterns.class == Array) ? patterns.join(\"|\") : patterns \n File.open('log/' + log_file, 'a') {|f| f.puts log} if line =~ /#{pattern}/ \n # TODO: auto mail for errors \n # TODO: horizontal log for different products, and delete after each process over. \n end \nend", "def grep(search, filename)\n regexp = Regexp.new(search)\n File.foreach(filename).with_index { |line, line_number|\n puts \"#{line_number+1}: #{line}\" if regexp =~ line\n }\nend", "def grep(filename, phrase)\n File.open(filename) do |lines|\n lines.each do |line|\n puts \"#{lines.lineno}. #{line}\" if line =~ Regexp.new(phrase)\n end\n end\nend", "def egrep(filelist, pattern, egrepoptions={})\n lines = []\n filelist.each do |fn|\n open(fn) do |inf|\n count = 0\n\n inf.each do |line|\n count += 1\n if pattern.match(line)\n if block_given?\n yield fn, count, line\n else\n #puts \"#{fn}:#{count}:#{line}\"\n lines << \"#{fn}#{@todo_delim}#{count}#{@todo_delim}#{line}\"\n end\n end\n end\n\n end\n end\n unless block_given?\n ret = lines.empty? nil:lines\n return ret\n end\n end", "def grep_for(text, where = \"./\", double_quote = false, perl_regex = false)\n # If they're on Windows, they probably don't have grep.\n @probably_has_grep ||= (Config::CONFIG['host_os'].downcase =~ /mswin|windows|mingw/).nil?\n\n # protect against double root paths in Rails 3\n where.gsub!(Regexp.new(base_path),'')\n\n lines = if @probably_has_grep\n find_with_grep(text, base_path + where, double_quote, perl_regex)\n else\n find_with_rak(text, base_path + where, double_quote)\n end\n\n # ignore comments\n lines.gsub /^(\\/[^:]+:)?\\s*#.+$/m, \"\"\n end", "def run_grep\n args = ['grep', '-HoRI']\n [:include, :exclude].each do |opt|\n next unless (val = grep_config[opt]).present?\n args += Array(val).map { |v| \"--#{opt}=#{v}\" }\n end\n args += [%q{\\\\bt(\\\\?\\\\s*['\"]\\\\([^'\"]*\\\\)['\"]}, *grep_config[:paths]]\n args.compact!\n run_command *args\n end", "def occurGrep(pattern, filename)\n\tregexp = Regexp.new(pattern)\n\tFile.foreach(filename).with_index { |line, line_num| \n\t\tputs \"#{line_num}: #{line}\" if regexp =~ line }\nend", "def grep(pattern)\n return self unless pattern\n\n pattern = Regexp.new(pattern)\n\n select do |loc|\n loc.line =~ pattern\n end\n end", "def grep(file, regexp, &block)\n if block_given?\n File.open(file, 'r').each {|line| line.chomp!; block[line] if line =~ regexp }\n else\n lines = []\n File.open(file, 'r').each {|line| line.chomp!; lines << line if line =~ regexp }\n lines\n end\n end", "def grep_search search_dir\n args = ['-r']\n end", "def egrep(pattern)\n each do |fn|\n open(fn) do |inf|\n count = 0\n\n inf.each do |line|\n count += 1\n if pattern.match(line)\n if block_given?\n yield fn, count, line\n else\n puts \"#{fn}:#{count}:#{line}\"\n end\n end\n end\n \n end\n end\n end", "def search(pattern)\n entries.grep(Regexp.new(pattern))\n end", "def fnmatch?(pattern, *args) File.fnmatch?(pattern, path, *args) end", "def grep(pattern)\n return self unless pattern\n pattern = Regexp.new(pattern)\n\n select do |l, ln|\n l =~ pattern\n end\n end", "def cmd_pgrep(*args)\n f_flag = false\n l_flag = false\n\n @@pgrep_opts.parse(args) do |opt, idx, val|\n case opt\n when '-h'\n cmd_pgrep_help\n return true\n when '-l'\n l_flag = true\n when '-f'\n f_flag = true\n end\n end\n\n all_processes = client.sys.process.get_processes\n processes = match_processes(all_processes, args, quiet: true)\n\n if processes.length == 0 || processes.length == all_processes.length\n return true\n end\n\n processes.each do |p|\n if l_flag\n if f_flag\n full_path = [p['path'], p['name']].join(client.fs.file.separator)\n\n print_line(\"#{p['pid']} #{full_path}\")\n else\n print_line(\"#{p['pid']} #{p['name']}\")\n end\n else\n print_line(\"#{p['pid']}\")\n end\n end\n true\n end", "def matching_file_regex\n file_regex ? file_regex : /\\.js$/\n end", "def warning_on(*args)\n options = (args[-1].kind_of?(Hash) ? args.pop : {})\n each_changed_file(options[:in] || [:all]) do |file|\n Open3.popen3(\"fgrep -nH \\\"#{args.join(\"\\n\")}\\\" #{file}\") do |stdin, stdout, stderr|\n err = stdout.read\n err.split(\"\\n\").each do |msg|\n args.each do |string|\n @result.warn(\"#{msg.split(\" \").first} contains #{string}\") if msg =~ /#{string}/\n end\n end\n end\n end\n end", "def grep(filename, phrase)\n File.open(filename) do |f|\n f.each { |line| puts \"#{f.lineno}: #{line}\" if line[phrase]}\n end\nend", "def grep(filename, needle)\n File.open(filename).each_with_index do |line, line_number|\n puts \"#{line_number + 1}: #{line}\" if line.include? needle\n end\nend", "def grep(what, options = {})\n options = GREP_OPTIONS.merge(options)\n git.grep(git_opts.merge(options), what).\n split(\"\\n\").\n map{|line|\n file, line, *others = line.split(':')\n {:file => file, :line => line, :text => others.join(':')}\n }\n end", "def grep(filename, phrase)\n File.open(filename) do |f|\n f.each { |line| puts \"#{f.lineno}: #{line}\" if line[phrase] }\n end\nend", "def glob(pat, path='/')\n # FIXME : implement\n raise('not implemented')\n # FIXME: verify and update\n # FIXME: test\n #regex = /^#{pat.gsub('*','.*').gsub('?','.?')}$/ \n #find(path) { |fname| fname =~ regex }\n end", "def contains? path\n @contents.any? do |line|\n File.fnmatch? line, path\n end\n end", "def fnmatch?(pattern, *args) File.fnmatch?(pattern, @path, *args) end", "def fnmatch(pattern, *args) File.fnmatch(pattern, path, *args) end", "def grep(filename, phrase)\n matches = []\n lines = IO.readlines filename\n (1..lines.length).each do |num|\n matches.push([num, lines[num-1]]) if lines[num-1].match(phrase)\n end\n puts \"Found #{matches.length} matches\\n\"\n matches.each { |line| puts \"#{line[0]} #{line[1]}\"}\nend", "def find_with_grep(text, where, double_quote, perl_regex = false)\n value = \"\"\n # Specifically double quote for finding 'test_help'\n command = if double_quote\n \"grep -rH \\\"#{text}\\\" #{where} | grep -v \\.svn\"\n else\n \"grep -rH '#{text}' #{where} | grep -v \\.svn\"\n end\n\n Open3.popen3(command) do |stdin, stdout, stderr|\n value = stdout.read\n end\n value\n end", "def glob_match(filenames, pattern)\n pattern = pattern.gsub(/[\\*\\?\\.]/, '*' => '.*', '.' => '\\.', '?' => '.')\n regex = Regexp.new(pattern)\n filenames.select do |filename|\n filename =~ regex\n end\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 searchABatch(directory, extension, searchString)\n return Dir.entries(directory).select{|file| File.open(file, \"r\").include?(searchString)}\nend", "def grep_cmd\n sprintf 'grep -Fq \"%s\" %s', key_set_string, @file\n end", "def find_file_by_text (start_dir, file_mask=\"*.*\", text_pattern='')\n match_files = Dir[ File.join(start_dir.split(/\\\\/), \"**\", file_mask)]\n if match_files.length > 0\n file_path = nil\n match_files.each do |file|\n matching_text = File.read(file).include?(text_pattern) rescue false\n if matching_text\n file_path = file\n break\n end\n end\n p \"#{file_path ? 'First searching file is: '+file_path : 'No files found'}\"\n else\n \"No files with mask '#{file_mask}' in directory '#{start_dir}'\"\n end\n end", "def glob_match (filenames, pattern)\n\t# Escape the '*', '?', and '.' characters\n\tpattern.gsub!(/[\\*\\?\\.]/, '*' => '.*', '?' => '.', '.' => '\\.') \t\n\tregex = Regexp.new(pattern)\n\t#select returns a new array\n\tfilenames.select do |filename|\n\t\tfilename =~ regex\n\tend\nend", "def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end", "def only(files,patterns)\n if !patterns.kind_of?(Array)\n patterns = [patterns]\n end\n files.select do |file|\n matches = false\n patterns.each do |pattern|\n if File.fnmatch(pattern,file)\n matches = true\n break\n end\n end\n matches\n end\n end", "def contain?(*patterns)\n content = File.open(zipfile) { |zip| zip.read(@name) }\n patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.\n all? { |pattern| content =~ pattern }\n end", "def glob_matches?(rule)\n File.fnmatch?(rule, @host_name)\n end", "def matches_path?(pattern, path)\n File.fnmatch?(\n pattern, path,\n File::FNM_PATHNAME | # Wildcard doesn't match separator\n File::FNM_DOTMATCH # Wildcards match dotfiles\n )\n end", "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 mayuse(opts, path)\n if not opts.excludefiles.empty? then\n findme = path\n if opts.use_basename then\n findme = File.basename(path)\n end\n opts.excludefiles.each do |rx|\n if findme.match(rx) != nil then\n return false\n end\n end\n end\n return true\nend", "def grepp(file, string)\t\n\tFile.open(file) do |f|\n\t\tline = 0\n\t\tf.each_line do |l|\n\t\t\tline+=1\n\t\t\tputs \"line #{line}: #{l}\" if l.include? string\n\t\tend\n\tend\nend", "def ls_grep? dir_str, grep_str, dir_parent_sym_or_s=\"/\"\n dir_str.gsub /^\\//, '' # remove starting '/' if found\n case parent_path \n when :ror then parent = Rails.root\n when :home then parent = Dir.home\n when String then parent = dir_parent_sym_or_s\n end\n ls_cmd = \"ls #{Rails.root}/#{dir_str} | grep '#{grep_str}'\"\n (%x[ #{ls_cmd} ]) != ''\n end", "def matches?(file); matches_exprs?(file,[@reg_expr]); end", "def grep_ruby(loglist, search, options={})\n rxp = Regexp.new(search)\n hash = {}\n files = []\n case loglist\n when Logs::Server #one server\n loglist.each do |chatroom| \n files += chatroom.to_a\n end \n when Logs::Chatroom #one chatroom\n files = loglist.to_a #convert to an array\n when Logs::LogList #all servers\n loglist.each do |server| \n server.each do |chatroom|\n files += chatroom.to_a\n end\n end\n when Logs::LogFile\n [loglist]\n end\n benchmark = Benchmark.measure() do\n #find file\n files.each do |file|\n data = []\n open(file) do |io|\n data = io.grep(rxp)\n end\n hash[file] = data\n end\n end\n hash\nend", "def matched_in_patternfile?(filepath, matchthis)\n\n patternlist = []\n\n begin\n open(filepath).each do |l|\n l.chomp!\n\n next if l =~ /^$/\n next if l =~ /^#/\n\n if l =~ /^\\s*(\\S+)/\n m = Regexp.last_match\n log(\"found a non-comment line, transforming [#{l}] into [#{m[1]}]\")\n l.gsub!(l,m[1])\n else\n next l\n end\n\n pattern = %r{#{l}}\n patternlist << pattern\n log(\"appending [#{pattern}] to patternlist for [#{filepath}]\")\n end\n rescue StandardError\n log(\"Problem reading #{filepath}: #{$!}\",:err)\n exit(1)\n end\n\n log(\"list of patterns for #{filepath}: #{patternlist}\")\n\n if matchthis =~ Regexp.union(patternlist)\n log(\"matched #{$~} in #{matchthis}, returning true\")\n return true\n\n else # hostname didn't match anything in patternlist\n log(\"#{matchthis} unmatched, returning false\")\n return nil\n end\n\n end", "def regex_files(files, regex=nil)\n array = files.nil? ? [] : files\n if !files.nil? && !regex.nil?\n exp = Regexp.new(regex)\n array = files.select do |file|\n file_name = File.basename(file, \".*\")\n match = exp.match(file_name)\n !match.nil? # return this line\n end\n end\n return array\nend", "def infile(str, filename)\n\t\t\t\tregex = Regexp.new(\"^#{Regexp.escape(str)}:\")\n\t\t\t\tFile.open(filename, File::RDONLY) { |fp|\n\t\t\t\t\tfp.each_line() { |line|\n\t\t\t\t\t\tif(regex.match(line))\n\t\t\t\t\t\t\treturn(true)\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn(false)\n\t\t\tend", "def matching_file(spec, path) # :doc:\n glob = \"#{@lib_dirs[spec.object_id]}/#{path}#{SUFFIX_PATTERN}\"\n return true unless Dir[glob].select { |f| File.file?(f) }.empty?\n end", "def glob(*globs)\n files.find_all do |path|\n globs.any? { |pattern| File.fnmatch(pattern, path, File::FNM_EXTGLOB) }\n end\n end", "def matcher_for_path(path)\n\n path = path.to_s\n\n if path.include?('*')\n quoted_path = path.gsub('.', '\\.')\n quoted_path = quoted_path.gsub('*', '.+?')\n Regexp.new(\"^#{quoted_path}$\")\n else\n path\n end\n\n end", "def match?(path)\n path =~ to_regexp\n end", "def match?(path)\n @regex.match?(path)\n end", "def glob_match(filenames, pattern)\n\t\n\tnewPattern = pattern.gsub( '*', '.*').gsub( '?', '.')\n\n\treturn filenames.select{|i| i.match(/#{newPattern}/)}\n\t\nend", "def matches_path?(pattern, path); end", "def matches(ext)\n ext =~ /^\\.org$/i\n end", "def match_against filename\n @regexp.match(filename)\n end", "def fsearch(file, regex)\n\tooo = File.stat(file)\n\toatime=foo.atime #atime before edit\n\tomtime=foo.mtime #mtime before edit\n\n\tf = File.open(file)\n\tfoo = f.readlines\n\tf.close\n\tif foo.to_s.match(/#{regex}/im) #Check for needle in haystack :p\n\t\tputs \"#{HC}#{FGRN}Found matches to '#{FWHT}#{regex}#{FGRN}' in File#{FWHT}: #{file}#{RS}\"\n\t\tocc = foo.to_s.scan(/#{regex}/im).count #How many times does it occur in file?\n\t\tputs \"\\t#{FGRN}Number of Occurances#{FWHT}: #{occ}#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}No Matches to '#{FWHT}#{regex}#{FRED}' in File#{FWHT}: #{file}#{RS}\"\n\tend\n\n\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\nend", "def fnmatch?( pattern, *args ) File.fnmatch?( pattern, self, *args ) end", "def match(pattern, flags = 0)\n\t\t\t\tpath = pattern.start_with?('/') ? full_path : relative_path\n\t\t\t\t\n\t\t\t\treturn File.fnmatch(pattern, path, flags)\n\t\t\tend", "def read_regexps_from_file(file_name)\n matchers = []\n File.open(file_name).each_line do |l|\n next if (l =~ /^(#.*|\\s*)$/) # emtpy lines and lines starting with #\n matchers << Regexp.new(l.strip)\n end\n end", "def find_first_match(options)\n return unless options[:in_file]\n\n open(File.join(base_dir, options[:in_file])) do |file|\n regexp = options[:matching] || Regexp.new(\"^#{options[:starting_with]}\")\n regexp.match(file.read)\n end\n end", "def check_for_the_message (line) \n File.readlines(get_system_log).grep(line).any? \n end", "def content_exists(file, regex, mode)\n\tooo = File.stat(file)\n\toatime=foo.atime #atime before edit\n\tomtime=foo.mtime #mtime before edit\n\n\tif mode.to_i == 1\n\t\tf = File.open(file, 'r')\n\telse\n\t\tf = File.open(file, 'rb') #Open file in binary mode (utmp/wtmp/etc)\n\tend\n\tfoo = f.readlines #Read file into array we can search through as wel like\n\tf.close\n\tif foo.to_s.match(/#{regex}/im) #Check for needle in haystack :p\n\t\tif mode.to_i == 1\n\t\t\tputs \"#{HC}#{FGRN}Found in Non-Binary File#{FWHT}: #{file}#{RS}\"\n\t\telse\n\t\t\tputs \"#{HC}#{FGRN}Found in Binary File#{FWHT}: #{file}#{RS}\"\n\t\tend\n\t\tocc = foo.to_s.scan(/#{regex}/im).count #How many times does it occur in file?\n\t\tputs \"\\t#{FGRN}Number of Occurances#{FWHT}: #{occ}#{RS}\"\n\tend\n\n\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\nend", "def contains?(str)\n return false unless ::File.exist?(self)\n ::File.open(self, &:readlines).collect { |l| return true if l.match(str) }\n false\n end", "def glob(path, pattern, flags=0)\n flags |= ::File::FNM_PATHNAME\n path = path.chop if path[-1,1] == \"/\"\n\n results = [] unless block_given?\n queue = entries(path).reject { |e| e.name == \".\" || e.name == \"..\" }\n while queue.any?\n entry = queue.shift\n\n if entry.directory? && !%w(. ..).include?(::File.basename(entry.name))\n queue += entries(\"#{path}/#{entry.name}\").map do |e|\n e.name.replace(\"#{entry.name}/#{e.name}\")\n e\n end\n end\n\n if ::File.fnmatch(pattern, entry.name, flags)\n if block_given?\n yield entry\n else\n results << entry\n end\n end\n end\n\n return results unless block_given?\n end", "def paths_to_regex(path_config, req='req')\n paths = normalize_paths(path_config)\n paths.empty? ? 'false' : paths.map {|path| \"#{req}.url ~ \\\"#{path}\\\"\"}.join(' || ')\nend", "def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end", "def =~(path)\n #puts \"STATIC-SERVER-ARRAY#=~ path: #{path.inspect}\"\n detect {|x| x =~ path}\n end", "def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend", "def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend", "def contain?(*patterns)\n content = read_content_from_tar\n patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.\n all? { |pattern| content =~ pattern }\n end", "def exclude?(excludes, path)\n excludes.any? do |ex|\n if ex.is_a?(String)\n File.fnmatch?(ex, path)\n elsif ex.is_a?(Regexp)\n ex.match(path)\n end\n end\n end", "def search_file(pattern, file)\n node = ast_from_file(file)\n search node, pattern\n end", "def search_in(files, host, options = T.unsafe(nil)); end", "def grep_csv(file)\n csv = CSV.read(file)\n csv.each do |row|\n if row[@opts[:col]] =~ @regex\n @matches.push(row)\n end\n end\n end", "def path_regex\n Regexp.new path_pattern, 'i'\n end", "def find_haproxy_setting(config_file, regex_group, regex_setting)\n raise 'file missing' unless ::File.exist?(config_file)\n hapcfg = IO.readlines(config_file)\n # puts hapcfg.length\n hapcfg.reject! { |line| line =~ /^#/ || line =~ /^\\s*#/ || line =~ /^\\s*$/ }\n\n begin_non_white_space = /^\\S/\n in_group = false\n\n hapcfg.each do |line|\n if in_group == false && line =~ begin_non_white_space && line =~ /#{regex_group}/\n in_group = true\n next\n elsif in_group == true && line =~ begin_non_white_space\n in_group = false\n elsif in_group == true && line =~ /#{regex_setting}/\n return true\n end\n end\n\n false\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 excluded?(path)\n strings = EXCLUDES.select { |item| item.class == String }\n regexps = EXCLUDES.select { |item| item.class == Regexp }\n excluded = strings.include? path\n regexps.each do |pattern|\n excluded = true if path =~ pattern\n end\n return excluded\nend", "def filename_matches_pattern?(filename)\n @file_matchers.each do |pattern|\n return true if File.fnmatch(pattern, filename)\n end\n return false\n end", "def extension_conf_files\n manifest.grep( /extconf.rb\\Z/ )\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 test_grep\n match = @lib.grep('search', :object => 'gitsearch1')\n assert_equal('to search one', match['gitsearch1:scott/text.txt'].assoc(6)[1])\n assert_equal(2, match['gitsearch1:scott/text.txt'].size)\n assert_equal(2, match.size)\n\n match = @lib.grep('search', :object => 'gitsearch1', :path_limiter => 'scott/new*')\n assert_equal(\"you can't search me!\", match[\"gitsearch1:scott/newfile\"].first[1])\n assert_equal(1, match.size)\n\n match = @lib.grep('search', :object => 'gitsearch1', :path_limiter => ['scott/new*', 'scott/text.*'])\n assert_equal(\"you can't search me!\", match[\"gitsearch1:scott/newfile\"].first[1])\n assert_equal('to search one', match['gitsearch1:scott/text.txt'].assoc(6)[1])\n assert_equal(2, match['gitsearch1:scott/text.txt'].size)\n assert_equal(2, match.size)\n\n match = @lib.grep('SEARCH', :object => 'gitsearch1')\n assert_equal(0, match.size)\n\n match = @lib.grep('SEARCH', :object => 'gitsearch1', :ignore_case => true)\n assert_equal(\"you can't search me!\", match[\"gitsearch1:scott/newfile\"].first[1])\n assert_equal(2, match.size)\n\n match = @lib.grep('search', :object => 'gitsearch1', :invert_match => true)\n assert_equal(6, match['gitsearch1:scott/text.txt'].size)\n assert_equal(2, match.size)\n\n match = @lib.grep(\"you can't search me!|nothing!\", :object => 'gitsearch1', :extended_regexp => true)\n assert_equal(\"you can't search me!\", match[\"gitsearch1:scott/newfile\"].first[1])\n assert_equal(\"nothing!\", match[\"gitsearch1:scott/text.txt\"].first[1])\n assert_equal(2, match.size)\n\n match = @lib.grep('Grep', :object => 'grep_colon_numbers')\n assert_equal(\"Grep regex doesn't like this:4342: because it is bad\", match['grep_colon_numbers:colon_numbers.txt'].first[1])\n assert_equal(1, match.size)\n end", "def find_files(search_pattern, opts = {})\n Dir.chdir(@top_dir)\n Dir.glob(\"**/*#{search_pattern}*\").map do |path|\n next if File.directory?(path)\n next unless File.readable?(path)\n begin\n mt = mime_type_for_file(path)\n {\n name: path,\n url: get_url_for_path(path),\n mime_type: mt,\n size: File.size(path)\n }\n rescue\n debug \"Can't seem to look at '#{path}'\"\n nil\n end\n end.compact\n end", "def grep(pattern, treeish=head) # :yields: path, blob\n options = pattern.respond_to?(:merge) ? pattern.dup : {:e => pattern}\n options.delete_if {|key, value| nil_or_empty?(value) }\n options = options.merge!(\n :cached => true,\n :name_only => true,\n :full_name => true\n )\n \n unless commit = grit.commit(treeish)\n raise \"unknown commit: #{treeish}\"\n end\n \n sandbox do |git, work_tree, index_file|\n git.read_tree({:index_output => index_file}, commit.id)\n git.grep(options).split(\"\\n\").each do |path|\n yield(path, (commit.tree / path))\n end\n end\n self\n end", "def filepath_match?(path, *acceptable_matches)\n acceptable_matches.any? { |match| path.fnmatch?(match, File::FNM_EXTGLOB) }\n end", "def filepath_match?(path, *acceptable_matches)\n acceptable_matches.any? { |match| path.fnmatch?(match, File::FNM_EXTGLOB) }\n end", "def =~(options)\n options && options[:file].respond_to?(:open) ? true : false\n end", "def matches(_ext); end", "def matches(_ext); end", "def check_file_existence (file_path)\n \"[ -f '#{file_path}' ]\"\n end" ]
[ "0.6894042", "0.6479809", "0.6439984", "0.6224579", "0.6024856", "0.59779793", "0.5928665", "0.58295995", "0.5786929", "0.57851905", "0.5760323", "0.56986886", "0.568912", "0.5663096", "0.56393987", "0.55635476", "0.55056506", "0.5457294", "0.53684425", "0.5338383", "0.51593715", "0.5157226", "0.5117736", "0.51167977", "0.51107794", "0.5110768", "0.51083314", "0.5107754", "0.5106178", "0.5103363", "0.5093681", "0.5074573", "0.5072063", "0.5041811", "0.50382596", "0.5036965", "0.500901", "0.49792945", "0.4958873", "0.49551302", "0.4953364", "0.49458912", "0.4937187", "0.4918011", "0.48987174", "0.48828968", "0.48811668", "0.4874551", "0.48648146", "0.48623797", "0.48551863", "0.48533794", "0.4837165", "0.48298183", "0.4824094", "0.48240483", "0.4816789", "0.48151487", "0.48097116", "0.47888425", "0.47711685", "0.47514942", "0.47467557", "0.47463983", "0.47449392", "0.47362703", "0.4717964", "0.47021714", "0.46908042", "0.46864673", "0.4671963", "0.46652675", "0.46560165", "0.46534786", "0.46520013", "0.46506938", "0.4639808", "0.4637424", "0.4637424", "0.46345386", "0.4634449", "0.46315497", "0.46292135", "0.46256185", "0.46244884", "0.46201295", "0.46041626", "0.45917347", "0.4583654", "0.45787516", "0.45680702", "0.45669904", "0.45560268", "0.4553995", "0.4550003", "0.4550003", "0.45491654", "0.45450628", "0.45450628", "0.45450374" ]
0.71789104
0
Check if file exists. ==== Options +path+:: Path to file
def exist?(path) found = true run_via "head -1 #{path} >/dev/null 2>&1 || echo $?" do |channel, stream, data| if data =~ /^(\d+)/ if $1.to_i > 0 logger.trace "Not found" found = false end end end found end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_file_exist(path)\n raise \"Cannot find: #{path}\" unless File.exist?(path)\n end", "def file_exists?(path)\n parse_boolean(transport.execute(\"Test-Path #{escape(path)}\", :read_only => true).stdout)\n end", "def check_file(path)\n raise Error, \"The path '#{path}' does not exist or is not a file\" unless path.file? || attrs[:exists] == false\n end", "def file_exists?(path)\n end", "def file_exist?(path)\n exist?(path) && is_file?(path)\n end", "def exists?\n File.exists?(path)\n end", "def file_exist?(file_path)\n File.exist?(file_path)\n end", "def path_exists?(path)\n File.exists?(path)\n end", "def file_exists?(path)\n response = self.class.head(File.join('/', path), request_options)\n response.code >= 200 && response.code < 300\n end", "def exist?( path )\r\n File.exist?(path)\r\n end", "def file_exists?(path)\n run(\"test -f #{path}\").success?\n end", "def exists?\n File.exist?(path)\n end", "def exists?\n File.exists?(path)\n end", "def exists?\n File.exists? path\n end", "def exists?\n File.exists?(path)\n end", "def exists?\n File.exist?(@path)\n end", "def exists?\n File.exist? file_path\n end", "def exists?(path)\n GLib.g_file_test(path, GLib::GFileTest::G_FILE_TEST_EXISTS)\n end", "def file_exists?(path)\n result = transport.execute(\"ls -d #{path}\", :read_only => true)\n result.exitstatus == 0 && result.stdout != ''\n end", "def exist?\n File.exist?(@path)\n end", "def file_exists?(path)\n result = transport.execute(\"ls -d #{path}\")\n result.exitstatus == 0 && result.stdout != ''\n end", "def exists? path\n end", "def strict_file_exists?(path)\n directory = `dirname #{path}`.chomp\n name = `basename #{path}`.chomp\n !`find \"#{directory}\" -name \"#{name}\"`.empty?\n end", "def exist?\n ::File.exist?(file_path)\n end", "def check_exists\n raise GlusterFS::Error, \"File does not exist: #{@path}\" unless exists?\n end", "def file_exists?\r\n File.file?(full_path)\r\n end", "def check_file_existence (file_path)\n \"[ -f '#{file_path}' ]\"\n end", "def exist?(path)\n ::File.exist?(abspath(path))\n end", "def file_exists(file_path)\n s = read_file(file_path)\n if s and s.length\n return true\n end\n return false\n end", "def check_file?(path)\n Actions.check_file path\n rescue FileError\n false\n else true\n end", "def file_exists?\n !!file_path\n end", "def file_exists?\n !!file_path\n end", "def exists?(path)\n files.include?(path)\n end", "def file_exists?(name)\n File.file?(File.join(path, name))\n end", "def exist; File.exist?(@fname); end", "def file?(path)\n File.file?(path_of(path))\n end", "def file_exists?(file_path)\n File.exist? @site.in_source_dir(file_path)\n end", "def has_file?(path)\n @files.has_key?(path)\n end", "def existent(path)\n expanded(path).select { |f| File.exist?(f) }\n end", "def has_file?(path)\n @files.has_key?(path)\n end", "def check_existance_of_path(path)\n\n if not path == nil\n question = absolute_path(path)\n File.exists?(question)\n else\n nil\n end\n end", "def file_exist?(path)\n full_path = ::File.join(@static_server.root, ::Merb::Parse.unescape(path))\n ::File.file?(full_path) && ::File.readable?(full_path)\n end", "def exist?(path)\n ::File.exist?(prefixed(path))\n end", "def file_exists?(path)\n begin\n ret = self.quietly { ls(path) }\n rescue Rye::Err => ex\n ret = ex.rap\n end\n # \"ls\" returns a 0 exit code regardless of success in Linux\n # But on OSX exit code is 1. This is why we look at STDERR. \n !(ret.exit_status > 0) || ret.stderr.empty?\n end", "def file_exists(file)\n File.exists?(file)\n end", "def has_file? name\n File.file? path / name\n end", "def file_exists?(file)\n File.file? file\n end", "def exists?(path)\n true if ftype(path) rescue false\n end", "def file_exists?(file)\n false\n end", "def exists?\n file.exists?\n end", "def assert_file_exists(path)\n assert File.exist?(\"#{path}\"), \"The file '#{path}' should exist\"\n end", "def exist?\n File.exist? fullpath\n end", "def file_exists?(file)\n File.exists?(file)\n end", "def valid_path path\n path and File.exists? path\n end", "def file_exists?\n File.exists?(@filename)\n end", "def file_exists(path)\n # Use `ls` command to check file exists\n # If file exists, `ls [path]` will echo the varible `path`\n # Or `ls` command will report an error message\n # But we can not ensure that the implementation of ls command are the same on different destribution\n # So just check the success flag not error message\n # eg:\n # $ ls /etc/passwd\n # /etc/passwd\n # $ ls /etc/nosuchfile\n # ls: cannot access '/etc/nosuchfile': No such file or directory\n result = shell_command_token(\"ls #{path}\").to_s.strip\n if result.eql?(path)\n return true\n end\n return false\n end", "def exists?\n FileTest.exists?(@file)\n end", "def is_file?(path)\n ::File.file? abspath(path)\n end", "def exists?\n File.exists?(filename)\n end", "def remote_file_exists?(aPath)\n\t\tremote_ruby(\"puts File.exists?('#{aPath}').to_s\")==\"true\\n\"\n\tend", "def file?(path)\n if session.type == 'meterpreter'\n stat = session.fs.file.stat(path) rescue nil\n return false unless stat\n return stat.file?\n else\n if session.platform == 'windows'\n f = cmd_exec(\"cmd.exe /C IF exist \\\"#{path}\\\" ( echo true )\")\n if f =~ /true/\n f = cmd_exec(\"cmd.exe /C IF exist \\\"#{path}\\\\\\\\\\\" ( echo false ) ELSE ( echo true )\")\n end\n else\n f = session.shell_command_token(\"test -f \\\"#{path}\\\" && echo true\")\n end\n return false if f.nil? || f.empty?\n return false unless f =~ /true/\n true\n end\n end", "def file_exists\n end", "def file_exists?(file_name)\n test(\"[ -f #{file_name} ]\")\n end", "def fail_script_unless_file_exists(path)\n fail_script_unless path != nil && (File.directory?(path) || File.exists?(path)), \"File doesn't exist: '#{path}'\"\n end", "def fail_script_unless_file_exists(path)\n fail_script_unless path != nil && (File.directory?(path) || File.exists?(path)), \"File doesn't exist: '#{path}'\"\n end", "def file_exists_on(host, file_path)\n if host[:platform].include?('windows')\n command = %(Test-Path #{file_path})\n\n if file_path.include?(':')\n split_path = win_ads_path(file_path)\n\n command = %(Test-Path #{split_path[:path]})\n command += %( -AND Get-Item -path #{split_path[:path]} -stream #{split_path[:ads]}) if split_path[:ads]\n end\n\n command = powershell(command)\n else\n command = %(test -f \"#{file_path}\")\n end\n\n return on(host, command, { :accept_all_exit_codes => true }).exit_code.zero?\n end", "def test_file_existence(filename, path, file_data = nil)\n return true if file_data&.exists?(filename.downcase)\n return true if File.exist?(format(Common_filename_format, path, filename).downcase)\n false\n end", "def assert_path_exists(path, additional_message = '')\n if ! File.file? path and ! File.directory? path\n stdout.out_error \"path [#{path}] does not exist\"\n stdout.out_error additional_message\n exit 1\n end\n end", "def user_file_exist?(file)\n File.exist? user_file_path(file)\n end", "def exist?\n filepath.file? and filepath.readable?\n end", "def file_chk( path )\n if File.exist?( path ) == false\n raise JackRDF_Critical, \"#{path} is not a valid file\"\n end\n end", "def local_file_exists?(full_path)\n File.exists?(full_path)\nend", "def exists? path\n find_blob(full_path(path))\n end", "def exist?(path)\n if session.type == 'meterpreter'\n stat = session.fs.file.stat(path) rescue nil\n return !!(stat)\n else\n if session.platform == 'windows'\n f = cmd_exec(\"cmd.exe /C IF exist \\\"#{path}\\\" ( echo true )\")\n else\n f = cmd_exec(\"test -e \\\"#{path}\\\" && echo true\")\n end\n return false if f.nil? || f.empty?\n return false unless f =~ /true/\n true\n end\n end", "def file_exists?(filename)\n shell_exec(\"test -f #{filename}\")\n rescue\n false\n else\n true\n end", "def file?(path)\n ::File.file?(prefixed(path))\n end", "def exists?(path)\n @exists[path]\n end", "def exists?(file)\n out = File.exist?(file) &&\n !File.zero?(file)\n raise \"File #{file} does not exist or is empty!\" unless out\n out\nend", "def exists?\n self.path.present? && File.exist?(self.path)\n end", "def dir_exist?(path)\n exist?(path) && !is_file?(path)\n end", "def path_exists?(path, create_if_not_exist = false)\n return true if path.empty?\n end", "def file?\n File.exist?(path) && File.directory?(path)\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 assert_file_exists(path)\n assert File.exists?(\"#{APP_ROOT}/#{path}\"),\"The file '#{path}' should exist\"\n end", "def valid_file_path?(path)\n path && File.exist?(path) && File.readable?(path)\n end", "def fileExists?(filename)\n shell_exec(\"test -f #{filename}\") rescue return false\n true\n end", "def exists?\n File.exist? @src_path\n end", "def check_file(path, extnames)\n check_file_extname(path, extnames)\n check_file_exist(path)\n end", "def exist?(name)\n File.exist?(path(name))\n end", "def has_file?(path)\n @data[:files].has_key? path.to_sym\n end", "def remote_file_exists?(full_path)\n remote_filetest_passes?('-e', full_path)\n end", "def exists?\n File.exist? absolute_path\n end", "def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end", "def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end", "def exists?(path)\n eval(EXISTS_CHECK, binding, __FILE__, EXISTS_CHECK_LINE)\n nil\nend", "def ensure_exists\n create unless Dir.exist? path\n end", "def exists?(path)\n head(path).empty? ? false : true\n end", "def exists?\n return true if File.directory?(@path)\n false\n end", "def dir_entry_exists(path)\n files = session.fs.dir.entries(path)\n rescue\n return nil\n else\n return path\n end", "def file_exist?\n return FileTest.exist?(@fileurl)\n end" ]
[ "0.82054025", "0.8067295", "0.77563083", "0.77016383", "0.76747197", "0.7668749", "0.7635254", "0.7626826", "0.76249313", "0.760843", "0.76075596", "0.75958204", "0.75824624", "0.7555375", "0.7511181", "0.74788857", "0.74575865", "0.7443056", "0.7394763", "0.73857033", "0.73844814", "0.7374272", "0.73493665", "0.73235214", "0.72902524", "0.72492725", "0.72287196", "0.72279173", "0.7207363", "0.7205806", "0.71973974", "0.7196036", "0.7185668", "0.7183356", "0.7181749", "0.71299046", "0.7092084", "0.70887667", "0.70841646", "0.70640725", "0.7049896", "0.7046775", "0.7024217", "0.6998925", "0.6991703", "0.6990805", "0.69902265", "0.69810796", "0.6970367", "0.69703287", "0.6939954", "0.6934611", "0.693197", "0.6923787", "0.69090927", "0.68663305", "0.6864899", "0.68575245", "0.68479043", "0.6838086", "0.6815691", "0.6814459", "0.6807771", "0.67959106", "0.67959106", "0.6785841", "0.67699414", "0.67374504", "0.6736268", "0.67343813", "0.673196", "0.6710705", "0.6708201", "0.6664664", "0.6644074", "0.6640679", "0.661405", "0.6613127", "0.66098577", "0.66029245", "0.66022915", "0.6594205", "0.6582761", "0.65793216", "0.6577621", "0.6562097", "0.6550285", "0.6542728", "0.65416867", "0.65394735", "0.653358", "0.6525227", "0.65238", "0.65238", "0.6514932", "0.6506138", "0.649449", "0.6485416", "0.64847463", "0.6481271" ]
0.6882429
55
Get the hostname of the remote server ==== Example utils.hostname => "localhost.localdomain"
def hostname hostname = nil run "hostname" do |channel, stream, data| hostname = data.chomp end hostname end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_server_hostname\n (`hostname`).strip\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n Socket.gethostname.split('.').first.strip\n end", "def hostname\n @hostname ||= `hostname`.chomp\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n @hostname ||= `hostname`.strip\n end", "def hostname\n ssh.exec!(\"hostname\").chomp\n end", "def hostname\n return 'unknown' unless available?\n @hostname ||= ssh_cmd('hostname').chomp\n end", "def hostname\n name + '.localhost'\n end", "def fqdn\n ssh.exec!(\"hostname --fqdn\").chomp\n end", "def hostname\n @hostname ||= ENV['HOSTNAME'] || `hostname`.delete(\"\\n\")\n end", "def fqdn\n exit_code, stdout = ssh.exec(\"hostname --fqdn\")\n (exit_code == 0) ? stdout.chomp : \"\"\n end", "def determine_hostname\n @info[:hostname] = @shell.query('HOST', 'hostname')\n end", "def hostname\n @hostname ||= ENV['HOSTNAME'] || `hostname`.chomp\n end", "def hostname\n return @hostname\n end", "def server_host\n Socket.gethostname\n end", "def get_public_hostname\n rpc_get_fact_direct('public_hostname')\n end", "def hostname\n Resolv.getname(ip_address) rescue nil\n end", "def get_server_domain\n @hostname ||= Socket.gethostname\n end", "def host\n Socket.gethostname\n end", "def host\n Socket.gethostname\n end", "def hostname\n v = self.host\n v&.start_with?('[') && v.end_with?(']') ? v[1..-2] : v\n end", "def ssh_hostname\n name = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n name = ssh.exec! \"hostname -s\"\n end\n name.downcase.chomp\n end", "def public_hostname\n get_proxy.get_public_hostname\n end", "def hostname\n if @hostname.nil?\n @hostname = ENV[\"COMPUTERNAME\"]\n @hostname = ENV[\"HOSTNAME\"] if @hostname.blank?\n @hostname = `hostname` if @hostname.blank?\n @hostname = @hostname.gsub(/\\.terracotta\\.lan/, '').strip\n end\n \n @hostname\n end", "def get_hostname\n cmd_exec('uname -n').to_s\n rescue\n raise 'Unable to retrieve hostname'\n end", "def server_hostname\n @node['serverHostname']\n end", "def client_hostname\n @opts[:hostname]\n end", "def host\n\t\t\t# FIXME: This is both a hack and the best way I know to do this.\n\t\t\tSocket.getaddrinfo(Socket.gethostname, 0)[0][2]\n\t\tend", "def private_hostname_of(server)\n server[:fqdn]\n end", "def build_hostname\n hostname\n end", "def hostname; end", "def hostname; end", "def hostname()\n unless @host.is_str?\n @host = ENV['HOSTNAME']\n @host = `/bin/hostname` unless @host.is_str?\n raise \"Failed to determine current HOSTNAME\" unless @host.is_str?\n\n @host = @host.downcase.sub(/\\..*$/, '').strip\n raise \"Failed to determine current HOSTNAME\" unless @host.is_str?\n end\n @host = @host.to_sym\n end", "def hostname\n if (host = @host.at('tag[name=host-fqdn]'))\n host.inner_text\n end\n end", "def name\n ssh.exec!(\"hostname\").chomp\n end", "def hostname\n protocol = request.headers['HTTP_X_FORWARDED_PROTO'] ||\n request.protocol ||\n 'http'\n protocol += '://' unless protocol.match?(%r{://})\n\n \"#{protocol}#{request.host}\"\n end", "def hostname\n raise 'empty hostname, something wrong' if @in_hostname.empty?\n @in_hostname\n end", "def hostname\n options[:hostname]\n end", "def public_hostname_of(server)\n server[:cloud][:public_hostname] rescue public_ip_of(server)\n end", "def hostinfo\n return self.host.to_s + (self.port ? ':' + self.port.to_s : '')\n end", "def hostname(arg = nil)\n set_or_return(:hostname, arg, kind_of: [String])\n end", "def remote_host\n # NOTE: Celluloid::IO does not yet support non-blocking reverse DNS\n @socket.peeraddr(true)[2]\n end", "def hostname\n FFI::Libvirt.virConnectGetHostname(pointer)\n end", "def this_host_name\n if is_zz?\n return zz[:local_hostname]\n end\n\n return @this_host_name if @this_host_name != nil\n\n instances = ey['environment']['instances']\n # assume localhost if can't find\n @this_host_name = 'localhost'\n\n this_id = this_instance_id\n instances.each do |instance|\n if instance['id'] == this_id\n @this_host_name = instance['private_hostname']\n break\n end\n end\n @this_host_name\n end", "def hostname(node)\n \"#{node.to_s}.smartengine.local\"\nend", "def hostname\n host_hash['vmhostname'] || @name\n end", "def hostname\n (request.env['HTTP_X_FORWARDED_SERVER'] =~ /[a-z]*/) ? request.env['HTTP_X_FORWARDED_SERVER'] : request.env['HTTP_HOST']\n end", "def hostname\n session.transport.socket.client_name\n end", "def hostname\n @options[:host][:name] if @options[:host]\n end", "def remote_host\n @remote_host || ::REMOTE_HOST\n end", "def hostname\n Rails.env.development? ? h.root_url(port: 3000).chomp!('/') : h.root_url.chomp!('/')\n end", "def hostname\n if resolution = CloudModel::AddressResolution.where(ip: ip).first\n resolution.name\n else\n begin\n Resolv.getname(ip)\n rescue\n ip\n end\n end\n end", "def peer_hostname\n (error, name) = Cproton.pn_ssl_get_peer_hostname(@impl, 1024)\n raise SSLError.new if error < 0\n return name\n end", "def new_hostname\n host || incremented_hostname || local_host_name\n end", "def get_host\n @host\n end", "def host_as_string; end", "def ssh_host_name( host )\n # This is included here for expected Space-wide policy settings.\n host[ :internet_name ] || host[ :internet_ip ] || host.name\n end", "def local_host\n get('beef.http.host') || '0.0.0.0'\n end", "def full_host\n if(request.host =~ /^localhost/ && request.port != 80)\n \"#{request.host}:#{request.port}\"\n else\n request.host\n end\n end", "def hostname\n unless defined?(@hostname)\n @hostname = solr_url.host if solr_url\n @hostname ||= user_configuration_from_key('solr', 'hostname')\n @hostname ||= default_hostname\n end\n @hostname\n end", "def resolve_fqdn\n hostname = from_cmd(\"hostname\")\n addrinfo = Socket.getaddrinfo(hostname, nil).first\n iaddr = IPAddr.new(addrinfo[3])\n Socket.gethostbyaddr(iaddr.hton)[0]\n rescue\n nil\n end", "def get_mysql_hostname \n @mysql_hostname = @sequel[\"SELECT @@hostname;\"].first[:@@hostname]\n end", "def get_mysql_hostname \n @mysql_hostname = @sequel[\"SELECT @@hostname;\"].first[:@@hostname]\n end", "def lookup_hostname(host)\n Socket.getaddrinfo(host, nil, nil, Socket::SOCK_STREAM)[0][3]\n rescue SocketError\n raise(InvalidHostname, Errstr::INVALID_HOST % 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 configured_hostname\n running_config.scan(/hostname\\s*(\\S+)/).flatten.first\n end", "def hostname\n Rails.env.development? ? 'http://localhost:3000' : 'http://coderalert.com'\n end", "def fqdn\n [ hostname, domain ].join('.') unless hostname.nil? and domain.nil?\n end", "def normalized_host; end", "def hostname(value)\n value || BASE_URI\n end", "def read_hostname\n return nil unless running?\n\n begin\n return ContainerControl::Commands::GetHostname.run!(self)\n rescue ContainerControl::Error => e\n log(:warn, \"Unable to read container hostname: #{e.message}\")\n return nil\n end\n end", "def client_name\n return @hostname if defined? @hostname\n\n sockaddr = @socket.getsockname\n begin\n @hostname =\n Socket.getnameinfo( sockaddr, Socket::NI_NAMEREQD ).first\n rescue\n begin\n @hostname = Socket.getnameinfo( sockaddr ).first\n rescue\n begin\n @hostname = Socket.gethostbyname( Socket.gethostname ).first\n rescue\n @logger.error \"the client ipaddr/name could not be determined\"\n end\n end\n end\n\n return @hostname\n end", "def host\n request.host\n end", "def getServerName(servers, hostname, port)\n servername = nil\n upperCaseHostname = hostname.upcase;\n for server in servers\n hostFromServerName, portFromServerName = getHostPortFromServerName(server)\n hostFromServerName = hostFromServerName.upcase\n if hostFromServerName == upperCaseHostname and portFromServerName == port\n servername = server\n break\n end\n end\n raise ArgumentError, \"Server %s:%d not online\" % [hostname, port] unless servername\n return servername\nend", "def hostname(m_configuration)\n 'http' + (m_configuration[:use_secure] ? 's' : '') + \"://\" + m_configuration[:highrise_account_name] + \".highrisehq.com/dl/avatars/person/\"\n end", "def tls_hostname; end", "def socket_host; end", "def host\n @request['Host']\n end", "def hostname(ip_address)\n @resolver.getname(ip_address).to_s\n rescue\n 'IP address not found'\n end", "def public_host\n get('beef.http.public.host')\n end", "def host\n _, _, host, = URI.split url\n host\n end", "def domain\n server_name || http_host\n end", "def getHost()\n return @uri.host\n end", "def host\n @host ||= target.split(':',2).first\n end", "def host\n domain\n end", "def host_on_header\n request.headers['HTTP_HOST']\n end", "def host\n \"#{@url.scheme}://#{@url.host}\"\n end", "def name\n \"#{self[:host]}\"\n end", "def sshhost\n \"#{script.cluster}.osc.edu\"\n end", "def host\n return @host\n end", "def host\n return @host\n end", "def test_server_ip\n ip = `hostname -i`\n ip.gsub(\"\\n\", \"\")\n end", "def host\n @host\n end", "def host\n 'localhost'\n end", "def host\n \"#{request.env['rack.url_scheme']}://#{request.host}:#{request.port}\".sub(':80','')# rescue 'http://locahost:3000'\n end", "def hostname_to_ip hostname\n begin \n ip = Resolv.getaddress(config[:host])\n rescue Resolv::ResolvError => resolv_err\n raise Exception.new(\"Resolver error: #{resolv_err}\")\n end\n return ip\n end", "def get_vm_host(_pool_name, _vm_name)\n\n #for v1 virtualbox support this is all local so the hostname will always be localhost\n return 'localhost'\n end", "def remote_addr; end" ]
[ "0.84309983", "0.83373976", "0.83373976", "0.83363235", "0.8276696", "0.8187103", "0.81652224", "0.8154142", "0.812036", "0.8043678", "0.79622984", "0.78744024", "0.7870252", "0.7869312", "0.7801229", "0.77977604", "0.7745484", "0.7702154", "0.76578045", "0.7657553", "0.7638339", "0.76374704", "0.76188797", "0.7615849", "0.75976294", "0.7566794", "0.7527259", "0.7525318", "0.7509173", "0.74695766", "0.74670506", "0.7452941", "0.74240243", "0.74240243", "0.734088", "0.73256683", "0.7320855", "0.72711885", "0.72591835", "0.72556466", "0.7250389", "0.7231447", "0.7225012", "0.7222858", "0.720985", "0.7187465", "0.71370375", "0.7131498", "0.7117433", "0.7096771", "0.7094211", "0.7092631", "0.7072104", "0.70683914", "0.70669246", "0.699682", "0.6993677", "0.6977883", "0.696518", "0.69597405", "0.69218683", "0.69078755", "0.68878305", "0.68611276", "0.68611276", "0.68334454", "0.6819318", "0.6800462", "0.6794191", "0.67801887", "0.6770928", "0.67659193", "0.6734225", "0.67311656", "0.67078733", "0.670748", "0.6686288", "0.6680203", "0.66648144", "0.6644095", "0.6639702", "0.66343135", "0.6622495", "0.66200536", "0.6611325", "0.6602787", "0.65870464", "0.657696", "0.65735465", "0.6532438", "0.65286946", "0.6523909", "0.6523909", "0.65119135", "0.65006816", "0.64899135", "0.6484575", "0.6475135", "0.646817", "0.645427" ]
0.8037145
10
Append data to a file. Optionally check that it exists before adding. ==== Options +path+:: Path to file to append to +data+:: String data to append +check+:: If not nil, will check to see if egrep matches this regex and will not reappend +left_strip+:: If true (default), remove whitespace before lines +should_exist+:: If true (default), raise error if file does not exist
def append_to(path, data, check = nil, left_strip = true, should_exist = true) # If checking and found expression then abort append return if check and egrep(check, path) # If should exist and doesn't then abort append raise "Can't append to file. File should exist: #{path}" if should_exist and !exist?(path) data.split("\n").each do |line| line = line.gsub(/^\s+/, "") if left_strip run_via "echo '#{line}' >> #{path}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(path, data)\n append_all(path, [data])\n end", "def append_to_file(path, *args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n options.merge!(before: /\\z/)\n insert_into_file(path, *(args << options), &block)\n end", "def append_to_file(path, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n config[:before] = /\\z/\n insert_into_file(path, *(args << config), &block)\n end", "def add_file path\n if File.exist? path\n @files << path\n else\n raise Errno::ENOENT, \"File '#{path}' doesn't exist\"\n end\n end", "def ensure_line_appended_to_file(path, line)\n remove_line_from_file(path, line)\n append_line_to_file(path, line)\n end", "def add?(path)\n paths = read()\n\n add_entry = !paths.include?(path)\n\n if add_entry\n paths << path\n write(paths)\n end\n\n add_entry\n end", "def append(data)\n begin\n # convert old data to array\n old_data_array = CSV.read(@file, headers: true, header_converters: :symbol).to_a\n\n # extend the headers by the ones for new testcases\n data.each do |result|\n old_data_array[0] << result[:identifier] if not old_data_array[0].include?(result[:identifier].to_sym)\n end unless data.empty?\n\n # create the new line column by column in the right order\n line = []\n old_data_array[0].each do |header|\n line << (data.detect{ |field| field[:identifier] == header.to_s }[:runtime] rescue nil)\n end unless old_data_array[0].empty?\n\n # append the new line of data to existing data\n old_data_array << line\n\n # write the CSV\n file = File.open(@file, \"w\")\n CSV(file, col_sep: \",\") do |csv|\n old_data_array.each do |line|\n csv << line\n end\n end\n file.close\n rescue\n create(data)\n end\n end", "def file(data, path)\n File.open(path, 'w') { |f| f << data }\n end", "def append_file(filename,data)\n begin\n File.open(filename, \"a+\") do |f|\n f<< data\n end\n rescue Exception => e\n puts e.message \n end\n end", "def append(str, file, opts = {})\n file = expand_path(file)\n if opts[:uniq] and exists? file\n # Check to ensure the file does not contain the line already.\n begin\n grep(str, file) or raise\n rescue\n # We're clear, go ahead.\n tee '-a', file, :stdin => str\n end\n else\n # No need to check, just append.\n tee '-a', file, :stdin => str\n end\n end", "def append_to_file(full_path, contents)\n\t\t::File.open(full_path, 'a') do |f|\n\t\t\tf.write contents\n\t\tend\n\t\ttrue\n\tend", "def append(data)\n open('a') do |f|\n f.write(data)\n end\n end", "def add_file_with_data(file_path, data)\n # 600 is the default permission the file will have. Readable/writable by owner only.\n @tar.add_file_simple(file_path, 0o600, data.bytesize) do |io|\n io.write(data)\n end\n @total_size_processed += data.bytesize\n end", "def ok_to_add_file(file, file_path)\n file_tags = file[\"tags\"] || []\n (files.size == 0 || files.any_matches?(file_path)) &&\n !exclude_files.any_matches?(file_path) &&\n (tags.size == 0 || (cross_any_matches?(file_tags, tags)) &&\n !cross_any_matches?(file_tags, exclude_tags))\n end", "def append_file(file_name, data)\n if session.type == \"meterpreter\"\n fd = session.fs.file.new(file_name, \"ab\")\n fd.write(data)\n fd.close\n elsif session.respond_to? :shell_command_token\n if session.platform == 'windows'\n session.shell_command_token(\"<nul set /p=\\\"#{data}\\\" >> \\\"#{file_name}\\\"\")\n else\n _write_file_unix_shell(file_name, data, true)\n end\n end\n true\n end", "def add(path)\n if File.directory?(path)\n add_directory(path)\n elsif File.file?(path)\n add_file(path)\n else\n fail \"#{path} doesn't exist\"\n end\n end", "def append_test(file, test)\n return if test.strip.empty?\n if dryrun?\n puts \"[DRYRUN] append #{file}\"\n else\n dir = File.dirname(file)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n File.open(file, 'a'){ |f| f << \"\\n\" + test.to_s }\n puts \"append #{file}\"\n end\n end", "def add_after_or_append(filename, matching_text, text_to_add, before_text, after_text)\n content = File.read(filename)\n if content.include?(matching_text)\n add_after(filename, matching_text, text_to_add)\n else\n append_file(filename, [before_text, text_to_add, after_text].join(\"\\n\"))\n end\n end", "def write_to_file file, *text\n text.flatten!\n\n File.open(File.expand_path(file), 'a+') do |file|\n full_text = (text * \"\\n\") + \"\\n\"\n\n unless file.read.include? full_text\n file.write full_text\n end\n end\n end", "def fast_add(path, data='', on_fs=false)\n # TODO: verify that this will suffice\n index.add(path, data, on_fs)\n end", "def append(content)\n\t\t\tFile.open(path,'a'){|target| target << content}\n\t\t\tnew_file = FileAry.new(path)\n\t\t\t@read = new_file.read\n\t\t\t@head = read.lines.first\n\t\t\t@lines = read.lines\n\t\tend", "def write_file(path, content)\n file_exists = File.exists?(path)\n if file_exists and not @force\n fail \"File #{path} already exists. Not overwritten. Use --force to overwrite\"\n end\n save_file(path,content)\n message = file_exists ? \"File #{path} overwriten with new content\" : \"File #{path} created\"\n Puppet.notice message\n end", "def verify_file(path, initial_content = \"\")\n unless File.exists?(path)\n FileUtils.mkdir_p File.dirname(path)\n File.open(path, \"w\") do |file|\n file.puts initial_content\n end\n end\n end", "def add(entry, src_path, &continue_on_exists_proc); end", "def file_write(path, content, append = false)\n dddebug('file_write', [path, '...', append])\n\n append == true ? mode = 'a' : mode = 'w'\n\n ::File.open(prefixed(path), mode) do |file|\n file.write(content)\n end\n end", "def add(path, data='', on_fs=false)\n exec { index.add(path, data, on_fs) }\n end", "def add(path, data='', on_fs=false)\n self.stage { |idx| idx.add(path, data, on_fs) }\n end", "def add(path, data, ctype=DEFAULT_CTYPE)\n # FIXME: determine if ADD or UPDATE EVENT\n # evt = File.exist? @content_tree.node_path(path)\n # FIXME: should this always be create-or-update? what about replace=false?\n n = @content_tree.add(path, data, ctype)\n notify(EVENT_ADD, path, ctype)\n n\n end", "def add_file(path)\n File.readlines(path).each { |s| self << s.strip }\n nil\n end", "def add_to_file(path, contents)\n dir = File.dirname(path)\n\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\n\n # Using technique outlined here: http://www.dzone.com/snippets/ruby-open-file-write-it-and\n\n File.open(path, 'a') {|f| f.write(\"#{contents}\\n\") }\n\n \"#{path} updated\"\n end", "def add_to_file(path, contents)\n dir = File.dirname(path)\n\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\n\n # Using technique outlined here: http://www.dzone.com/snippets/ruby-open-file-write-it-and\n\n File.open(path, 'a') {|f| f.write(\"#{contents}\\n\") }\n\n \"#{path} updated\"\n end", "def check_and_add(path)\n $:.unshift path unless $:.include?(path)\n end", "def append_raw(path, format, data)\n path = relativize_path path\n\n content_type = if format == :json then\n 'application/json'\n elsif format == :json_stream\n 'application/x-json-stream'\n elsif CSV === format\n 'text/csv'\n elsif format == :csv\n format = DEFAULT_CSV\n 'text/csv'\n else\n raise \"invalid format: #{format}\" # todo\n end\n\n csv_params = if CSV == format then\n { :escape => CSV.escape, :delimiter => CSV.delimiter, :quote => CSV.quote }\n else\n {}\n end\n\n header = { 'Content-Type' => content_type }\n params = { :apiKey => api_key, :receipt => true, :mode => 'batch' }.merge csv_params\n resp = Precog.post(self, \"/ingest/v#{VERSION}/fs/#{path}\", data, header, params)\n\n results = JSON.parse resp.body\n [results[\"ingested\"], results[\"errors\"]]\n end", "def append_file(relative_destination, data)\r\n path = destination_path(relative_destination)\r\n File.open(path, 'ab') { |file| file.write(data) }\r\n end", "def test_file_must_contain_append_empty()\n\t\tCfruby::FileEdit.file_must_contain(@emptyfilename, \"new line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@emptyfilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"new line\\n\", lines[-1])\n\t\t}\n\tend", "def add_to_file entry, content\n path = repo_path.join entry\n File.write path, content, :mode => \"a\"\n end", "def append_file(relative_destination, data)\n path = destination_path(relative_destination)\n File.open(path, 'ab') { |file| file.write(\"\\n#{data}\") }\n end", "def check_file(path)\n raise Error, \"The path '#{path}' does not exist or is not a file\" unless path.file? || attrs[:exists] == false\n end", "def add_content_to_file(file_path, content)\n names = file_path.split('/')\n file_name = names.pop\n directory = self.mkdir(names.join('/'))\n directory.add_content_to_file(file_name, content)\n end", "def safe_make_empty_file(path)\n if File.exist? path\n File.open(path, 'r') do |f|\n if !f.read.empty?\n raise Error, Error::MSG_EMPTY_FILE_NOT_EMPTY% path\n end\n end\n end\n\n # make an empty file\n File.open(path, 'a') do |f|\n end\n end", "def write data, path\n\t\t\tcontent = \"\"\n\t\t\tfile_type = data.class.to_s\n\n\t\t\tif file_type == 'Array'\n\t\t\t\tdata.each do | line |\n\t\t\t\t\tline.each do | key, val |\n\t\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\tcontent << \"\\n\"\n\t\t\t\tend\n\n\t\t\telsif file_type == 'Hash'\n\t\t\t\tdata.each do | key, val |\n\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tpath = File.expand_path path\n\t\t\tFile.open(path, 'w+') do |f|\n\t\t\t\tf.write content\n\t\t\tend\n\t\tend", "def write(file_name, unique_keys, data, options = {})\n mode = (!options.empty? && options[:overwrite]) ? \"w\" : \"a\"\n open(file_name + \".json\", mode) do |f|\n unless rec_exists?(file_name, unique_keys, data)\n f.puts data\n end\n end\nend", "def append(data)\n append_array = data.split\n append_array.each do |item|\n if list.allowed(item)\n @list.append(item)\n else\n 0\n end\n end\n end", "def add_file entry, content = nil\n path = repo_path.join entry\n dir, filename = path.split unless entry.end_with? \"/\"\n\n FileUtils.mkdir_p dir.to_s == '.' ? repo_path : dir\n FileUtils.touch path if filename\n File.write path, content if filename && content\n end", "def prepend_to_file(path, *args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n options.merge!(after: /\\A/)\n insert_into_file(path, *(args << options), &block)\n end", "def append_file(fname, content)\n begin\n aFile = File.new(fname,\"a\")\n aFile.puts content\n aFile.close\n rescue Exception=>e\n # logger.error e\n p e.inspect\n end\nend", "def test_file_must_contain_append()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"new line\\n\", lines[-1])\n\t\t}\n\tend", "def put_file(path, data, &b)\n path = Pathname.new(path).cleanpath\n dir = path.dirname\n filename = path.basename\n if fs.directory?(dir) and filename\n fs.put_file(path, data)\n yield data.size\n else\n yield false\n end\n end", "def check_file_existence (file_path)\n \"[ -f '#{file_path}' ]\"\n end", "def append_line_to_file(path, line)\n run \"echo '#{line}' | #{sudo} tee -a #{path}\", options\n end", "def put_file(path, data)\n raise NotImplemented\n end", "def data_file!(path)\n path = Pathname.new(path)\n if relative_data_files.include?(path)\n data_dir/path\n else\n raise FileNotFoundError, \"No such file #{path} in bag\"\n end\n end", "def add_file(file_name, data, flags)\n data = filter \"decode\", file_name, data\n path = working_join file_name\n \n File.unlink path rescue nil\n \n if flags.include? 'l' # if it's a link\n @file_opener.symlink path, data\n else\n @file_opener.open(path, 'w') {|f| f.write data }\n File.set_flag path, false, true if flags.include? 'x'\n end\n end", "def check_file_exist(path)\n raise \"Cannot find: #{path}\" unless File.exist?(path)\n end", "def write( path, data )\n FileUtils.mkdir_p( File.dirname( path ) )\n File.open( path, 'w' ) do |f|\n f.write( data )\n end\n \n data.length\n end", "def write_to(path)\n if !File.exists?(path)\n FileUtils.mkdir_p(path)\n else\n raise FileExists.new(\"#{path} already exists\")\n end\nend", "def prepend_to_file(path, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n config[:after] = /\\A/\n insert_into_file(path, *(args << config), &block)\n end", "def file_exactly(path, contents, *extra_args)\n path = File.expand_path(path)\n changed = (File.exist?(path) == false)\n\n if contents.kind_of?(Array)\n changed ||= (File.open(path).readlines.map(&:chomp) != contents)\n else\n changed ||= (File.open(path).read.chomp != contents)\n end\n\n if changed\n backup_file(path)\n puts \"Updating #{path}:\\n #{BOLD}#{contents}#{NORMAL}\"\n File.open(path, 'w', *extra_args) do |f|\n f.puts(contents)\n end\n elsif extra_args.count == 1 && extra_args[0].is_a?(Integer)\n chmod(path, extra_args[0])\n end\n\n @changed ||= changed\n changed\n end", "def add_host\n entry_line = \"#{ipaddress?} www.example.com test.example.com\"\n\n if open('/etc/hosts') { |f| f.grep(/^#{entry_line}$/).empty? }\n open('/etc/hosts', 'a') { |p| p.puts \"\\n#{entry_line}\" }\n end\n\n if open('/etc/hosts') { |f| f.grep(/^#{entry_line}$/).empty? }\n false\n else\n true\n end\nend", "def append(filename, text)\n File.open(filename,\"a\") {|f| f << text + \"\\n\"}\n end", "def append(filename, text)\n File.open(filename,\"a\") {|f| f << text + \"\\n\"}\n end", "def check_exists\n raise GlusterFS::Error, \"File does not exist: #{@path}\" unless exists?\n end", "def test_file_existence(filename, path, file_data = nil)\n return true if file_data&.exists?(filename.downcase)\n return true if File.exist?(format(Common_filename_format, path, filename).downcase)\n false\n end", "def add(path)\n return true unless File.exist?(path)\n\n metadata[path] = {\n \"mtime\" => File.mtime(path),\n \"deps\" => [],\n }\n cache[path] = true\n end", "def file_chk( path )\n if File.exist?( path ) == false\n raise JackRDF_Critical, \"#{path} is not a valid file\"\n end\n end", "def append_line_to_file(filename, line)\n FileUtils.touch(filename)\n File.open(filename, 'a') do |f|\n f.puts line\n end\nend", "def append_line\n File.open(path, 'w') do |fh|\n lines.each do |l|\n fh.puts(l)\n end\n fh.puts line\n end\n end", "def gsub_file(path, regexp, *args, &block)\n #path = destination_path(relative_destination)\n content = File.read(path)\n check_for = args.first || yield('')\n regex = Regexp.new(regexp.source + Regexp.escape(check_for))\n return if content =~ regex # if we can match the text and its leadin regex, don't add again\n content = content.gsub(regexp, *args, &block)\n File.open(path, 'wb') { |file| file.write(content) }\n end", "def write_to_file(data)\n\t\t\tref = File.join(@root, \"tarrifs_\" + @page[:name])\n\n\t\t\tif File.exists?(ref)\n\t\t\t\tdiff = \"\"\n\t\t\t\tstatus = Open4::popen4(\"diff #{ref} -\") do |pid, stdin, stdout, stderr|\n\t\t\t\t\tstdin.puts data\n\t\t\t\t\tstdin.close\n\t\t\t\t\tdiff = stdout.read\n\t\t\t\tend\n\t\t\t\t#sent mail if content is different\n\t\t\t\tif status != 0\n\t\t\t\t\twrite \"change detected.\"\n\t\t\t\t\tnotify_changed_site(url, diff)\n\t\t\t\tend\n\t\t\tend\n\t\t\tFile.open(ref, \"w\") do |f|\n\t\t\t\tf.puts data\n\t\t\tend\n\t\tend", "def attach_report_file(file_name, file_data)\n unless (@user.report_files.blobs.find {|blob| blob.filename === file_name}).nil?\n raise ::Rbt::User::Document::Error::DuplicateDocumentError.new(\"File with name: #{file_name} already exists for user: #{@user.id}\")\n end\n\n @user.report_files.attach(io: StringIO.new(file_data), filename: file_name)\n return @user.report_files.blobs.find {|blob| blob.filename === file_name}\n end", "def overwrite_file(name, data, commit = {})\n write(merge_path_elements(nil, name, nil), data, commit, force_overwrite = true)\n end", "def add_after(filename, matching_text, data=nil, &block)\n gsub_file filename, /(\\s*#{Regexp.escape(matching_text)})/mi do |match|\n \"#{match}\\n#{data || block.call}\"\n end\n end", "def update(path, content)\n file = pathname(path)\n\n # fail if path is a dir or similar\n fail FileNotFound unless file.file?\n\n # get rid of CRLFs\n content.gsub!(/\\r\\n?/, \"\\n\")\n\n # don't do anything if the contents are identical\n return if file.read == content\n\n # write, add, commit\n file.write(content)\n git :add, path.shellescape\n git :commit, \"-m 'update #{path}' -- #{path.shellescape}\"\n end", "def append(contents)\n\t\tconnection.append_to_file(full_path, contents)\n\tend", "def add_dependency(path)\n path = path.to_s\n if dependencies.include?(path)\n false\n else\n dependencies << path\n path\n end\n end", "def add_stored(entry, src_path, &continue_on_exists_proc); end", "def has(line, opt = {})\n @matchers << [line, opt]\n end", "def write_to_file(path, content)\n directory = File.dirname(path)\n FileUtils.mkdir_p(directory)\n File.write(path, content)\n after_rendering_run(\"rm -rf #{path}\")\n path\n end", "def assert_path_exist(path, message=nil)\n _wrap_assertion do\n failure_message = build_message(message,\n \"<?> expected to exist\",\n path)\n assert_block(failure_message) do\n File.exist?(path)\n end\n end\n end", "def find_data_file(path)\n each_data_path(path).find { |full_path| File.file?(full_path) }\n end", "def write_file(path, content)\n File.open(path, 'w') do |file|\n case content\n when ''\n # Create empty file.\n when String\n file.puts content\n when Array\n file.puts content.join(\"\\n\")\n end\n end\n end", "def append_to_log_file( data_import_session, text )\n full_pathname = log_full_pathname( data_import_session )\n File.open( full_pathname, 'a+' ) do |f|\n f.puts( text )\n end if Rails.env != 'test' # (Avoid creating thousands of files during specs running)\n end", "def add_file(*args)\n context = args.pop\n file_path_hash_or_string, content, commit_msg = args\n file_path_hash = file_path_hash_form(file_path_hash_or_string)\n get_adapter_repo(context).add_file(file_path_hash, content, commit_msg)\n end", "def handle(path)\n File.exist?(path) ? attach(path) : failed!\n end", "def handle(path)\n File.exist?(path) ? attach(path) : failed!\n end", "def handle(path)\n File.exist?(path) ? attach(path) : failed!\n end", "def append(pattern, file, where=:bottom)\n was = sftp.file.open(file, \"r\") { |f| f.read }\n\n if was.include?(pattern)\n log \"'%s' already match your pattern\" % file\n return false\n else\n pattern += \"\\n\" unless pattern[-1] == ?\\n\n replacement = case where\n when :top, :start then pattern+was\n when :bottom, :end then was+pattern\n else raise \"%s is not a valid, available values are (:top, :start, :bottom, :end)\" % where.inspect\n end\n end\n\n log \"append to '%s' in '%s'\" % [where, file]\n sftp.file.open(file, \"w\") { |f| f.write(replacement) }\n end", "def append_path(path)\n @paths.push(File.expand_path(path, root))\n end", "def append_report_for(command)\n checker.append_report_for(command, self.title, self.variant)\n end", "def append_from_file(path, format, file)\n path = relativize_path path\n\n content_type = if format == :json then\n 'application/json'\n elsif format == :json_stream\n 'application/x-json-stream'\n elsif CSV === format\n 'text/csv'\n elsif format == :csv\n format = DEFAULT_CSV\n 'text/csv'\n else\n raise \"invalid format: #{format}\" # todo\n end\n\n csv_params = if CSV == format then\n { :escape => CSV.escape, :delimiter => CSV.delimiter, :quote => CSV.quote }\n else\n {}\n end\n\n header = { 'Content-Type' => content_type }\n params = { :apiKey => api_key, :receipt => true, :mode => 'batch' }.merge csv_params\n\n File.open(file, 'r') do |stream|\n back = []\n stream.each_line do |chunk|\n resp = Precog.post(self, \"/ingest/v#{VERSION}/fs/#{path}\", chunk, header, params)\n\n results = JSON.parse resp.body\n back << [results[\"ingested\"], results[\"errors\"]]\n end\n back\n end\n end", "def append2file(file, name, string)\n\t_block_start = \"# #{name} added by chef {\"\n\t_block_end = \"# }\\n\"\n\t_block = \"#{_block_start}\\n#{string}\\n#{_block_end}\\n\"\n\n\tbash \"Remove #{name} from #{file}\" do\n\t\tcode <<-EOC\n\t\t\tperl -0777 -pi -e 's/\\n*#{_block_start}.*?#{_block_end}//gs' #{file}\n\t\tEOC\n\t\tonly_if \"cat #{file} | grep -q '#{_block_start}'\"\n\tend\n\tbash \"Add #{name} to #{file}\" do\n\t\tcode <<-EOC\n\t\t\techo '' >> #{file}\n\t\t\techo '#{_block_start}' >> #{file}\n\t\t\techo '#{string}' >> #{file}\n\t\t\techo '#{_block_end}' >> #{file}\n\t\tEOC\n\t\tnot_if \"cat #{file} | grep -q '#{_block_start}'\"\n\tend\nend", "def append(filename)\n return @filemgr.append(filename, @contents)\n end", "def write_to_file(text)\n open(file_path, 'w') do |f|\n f.write(text)\n end\n file_update\n rescue Errno::ENOENT\n raise InvalidCache\n end", "def test_reuse_existing_chunks_when_append\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'test content updated', ['test ', 'conte', 'nt', ' upda', 'ted']\n end", "def test_file_append()\n\t\t# test the empty file\n\t\tCfruby::FileEdit.file_append(@emptyfilename, \"new line\")\n\t\tlines = File.open(@emptyfilename, File::RDONLY).readlines()\n\t\tassert_equal(1, lines.length)\n\t\tassert_equal(\"new line\", lines[-1])\n\t\t\n\t\t# test the multiline file\n\t\tCfruby::FileEdit.file_append(@multilinefilename, \"new line\")\n\t\tlines = File.open(@multilinefilename, File::RDONLY).readlines()\n\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length+1, lines.length)\n\t\tassert_equal(\"new line\", lines[-1])\t\t\n\tend", "def atomic_write(data, path, name, options = {})\n main_file = File.join(path, name) + '.yml'\n dup_file = File.join(path, name) + '.yml2'\n \n # append verification info at the end of the file to guard from incomplete writes\n ts = Time.now\n ts_checksum = Digest::MD5.hexdigest(\"#{ts.tv_sec}.#{ts.tv_usec}\")\n if options[:owner]\n # secure the file\n File.open(dup_file, 'w').close\n uid = uid_for_username options[:owner]\n gid = gid_for_username options[:owner]\n File.chown uid, gid, dup_file\n File.chmod options[:permissions] || 0660, dup_file\n end\n File.open(dup_file, 'w') { |f| YAML::dump [data, ts.tv_sec, ts.tv_usec, ts_checksum], f }\n \n # move the file atomically to the main copy\n FileUtils.mv(dup_file, main_file)\n end", "def test_file_must_contain_fuzzy()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"\\tnew line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"\\tnew line\\n\", lines[-1])\n\t\t}\n\n\t\tadded = Cfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :fuzzymatch => true, :position => Cfruby::FileEdit::APPEND)\n\t\tassert_equal(false, added, \"file_must_contain added the fuzzy match when it shouldn't have\")\n\n\t\tadded = Cfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :fuzzymatch => false, :position => Cfruby::FileEdit::APPEND)\n\t\tassert_equal(true, added, \"file_must_contain didn't add the strict match when it should have\")\n\t\t\n\t\t# test regexp escaping with fuzzymatch\n\t\tassert_nothing_raised() {\n\t\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, '0 0 * * 5 /usr/local/sbin/pkg_version -v -L =', :fuzzymatch=>true)\n\t\t}\n\t\t\n\t\t@resolvfile = Tempfile.new('test')\n\t\t@resolvefilecontents = <<FILEBLOCK\n# our servers\nnameserver 69.9.164.130\nnameserver 69.9.164.131\nFILEBLOCK\n\t\t@resolvfile.write(@multilinefilecontents)\n\t\t@resolvfile.close(false)\n\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'domain titanresearch.com', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.164.130', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.164.131', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 66.180.175.18', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.191.4', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.160.191', :fuzzymatch=>true)\n\t\t\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'domain titanresearch.com'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.164.130'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.164.131'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 66.180.175.18'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.191.4'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.160.191'))\n\tend", "def create_file_with_content(file_path: '/tmp/temp_file.ext', content: '')\n File.open(file_path, 'w') { |f| f.write(content) }\n LoggerHelper.print_to_log(\"Created file: #{file_path} with content: #{content}\")\n file_path\n end", "def append(args={})\n\t\t\t\tarray_to_file(args.merge(:append => true))\n\t\t\tend", "def check_exists(original_paths, audio_params)\n check_file_exists = !original_paths[:existing].empty?\n\n if check_file_exists\n @logger.debug(@class_name) {\n \"Existing files #{original_paths} given #{audio_params}\"\n }\n else\n msg = \"No existing files for #{original_paths} given #{audio_params}\"\n\n # log error\n @logger.error(@class_name) { msg }\n\n # write row of csv into log file\n log_csv_line(original_paths[:possible][0], false, nil,\n nil, nil, nil,\n :high_original_file_does_not_exist,\n audio_params[:id])\n\n raise BawAudioTools::Exceptions::FileNotFoundError, msg\n end\n end" ]
[ "0.56431776", "0.56079525", "0.554554", "0.52561873", "0.5220501", "0.5192943", "0.5103816", "0.51016814", "0.5072856", "0.50637037", "0.5056971", "0.49248248", "0.4906291", "0.4896212", "0.48764458", "0.483463", "0.4824028", "0.47990674", "0.47815636", "0.4780256", "0.4768747", "0.47642922", "0.47485414", "0.47426656", "0.47267026", "0.47128567", "0.47118852", "0.47028846", "0.46918237", "0.46604112", "0.46604112", "0.46335474", "0.46111432", "0.45973107", "0.45953143", "0.45935735", "0.4584591", "0.45660394", "0.4559355", "0.45573863", "0.45247462", "0.45191252", "0.45011717", "0.44998363", "0.44883892", "0.4484729", "0.44454476", "0.44449905", "0.44387525", "0.4429341", "0.44252196", "0.4415319", "0.440214", "0.43840775", "0.43797708", "0.43753907", "0.43675345", "0.43600672", "0.4356491", "0.4350721", "0.4350721", "0.43433583", "0.4340615", "0.43287423", "0.43219692", "0.4315567", "0.42895228", "0.42720613", "0.42586583", "0.42472893", "0.4234226", "0.42257747", "0.42210853", "0.4207959", "0.42028168", "0.42000258", "0.41973445", "0.41955945", "0.41928077", "0.41907758", "0.41862807", "0.41850686", "0.41749838", "0.4174758", "0.4174758", "0.4174758", "0.417389", "0.41580302", "0.41517338", "0.4150006", "0.41463017", "0.41390982", "0.41303834", "0.41266498", "0.4126453", "0.4121911", "0.41160706", "0.41127178", "0.4110728", "0.41028666" ]
0.8033233
0
Method returns the state of an object at given time point
def state_at(time_string) return {} if time_string.blank? changes = state_changes.where('changed_at <= ?', DateTime.parse(time_string)).pluck(:changed_values) changes.inject({}) { |c, state| c.merge(state) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(object)\n tracker.fetch(object)\n end", "def state_at(t)\n\n if @time_span.include?(t)\n \n leg_percent = (t - @launch_time) / @flight_time\n dist = leg_percent * @distance\n dist_rad = leg_percent * @distance_rad\n\n alt_track = @alt1 + @v_init * (t - @launch_time) * Math.sin(@theta_init) - 0.5 * @g * (t - @launch_time)**2\n\n lat_track = @lat1 + dist_rad * Math.cos(@tc)\n\n d_phi = Math.log(Math.tan(lat_track/ 2.0 + QUARTER_PI)/ Math.tan(@lat1 / 2.0 + QUARTER_PI))\n\n if (lat_track - @lat1).abs < 1e-8\n q = Math.cos(@lat1)\n else\n q = (lat_track - @lat1) / d_phi\n end\n\n lng_track = @lng1 + dist_rad * Math.sin(@tc) / q\n\n lat_track = lat_track * DEG_PER_RAD\n lng_track = lng_track * DEG_PER_RAD\n\n lla_track = LlaCoordinate.new( lat_track, lng_track, alt_track)\n\n ## Attitude Calculations\n theta_track = Math.atan( Math.tan(@theta_init) - @g * (t - @launch_time) / (@v_init * Math.cos(@theta_init)) )\n bearing_track = @tc * DEG_PER_RAD\n velocity_track = @v_init / Math.cos(@theta_init) * Math.cos(theta_track)\n\n theta_track *= DEG_PER_RAD\n\n velocity_vector = ecef_rotation( lla_track, bearing_track, theta_track, velocity_track)\n attitude_vector = ecef_rotation( lla_track, bearing_track, theta_track, 1)\n\n return [lla_track, velocity_vector, attitude_vector]\n \n else\n return [nil, nil, nil]\n end\n\n end", "def times_walked_to(state); end", "def next_state_at(state)\n @state_at[state+1..-1].inspect\n @state_at[state+1..-1].detect{ |time| !time.nil? }\n end", "def state\n object.state_code\n end", "def state\n return :finished if finished?\n return :yet unless started?\n return :terminated if (Time.now - latest_modified_time > @alive_time)\n return :started \n end", "def state_obj; @_hegemon_states[@_hegemon_state]; end", "def state\n @state.first\n end", "def get_timer_state\n return current_user.timer.get_state\n end", "def state\n @state\n end", "def state\n @game.state\n end", "def state\n data.state\n end", "def state\n data.state\n end", "def state\n @@states[@state]\n end", "def current_state\n events.first\n end", "def state\n @state\n end", "def aws_obj_state(opts)\n opts[:obj].state\n end", "def state\n @current_state\n end", "def state\n State.instance\n end", "def state\n @state\n end", "def state\n [@identifier, @estimated_time, @priority, @completed_at]\n end", "def state\n @gameState.state\n end", "def state_time\n\t\tarr = []\n\t\t@state_in_stock.each do |state|\n\t\t\tarr << state.time\n\t\tend\n\t\tarr.shift\n\t\tarr\n\tend", "def state\n self.well_info.state\n end", "def state\n object.human_state_name\n end", "def last_known_state\n s = DB[:gauge_values].where('gauge = ?', node.path.to_s).select(:time, :value).order(:time).last\n s ||= { value: nil, time: Time.at(0) }\n s\n end", "def state_changed_at\n if occurred_at\n now = Time.zone.now\n occurred_at + now.hour.hours + now.min.minutes\n else\n Time.zone.now\n end\n end", "def state\n # pending, open, closed\n now = Time.now\n if now < opening\n return :pending\n elsif now < closing\n return :open\n else\n return :closed\n end\n end", "def state\n end", "def state\n states.first\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state_datetime\r\n if failed?\r\n failed_at\r\n elsif completed?\r\n completed_at\r\n else\r\n updated_at\r\n end\r\n end", "def [](time)\n prev_time = prev_time time\n fetch prev_time if prev_time\n end", "def state_at(state)\n @state_at[state_to_const(state)]\n end", "def reservation_state(base = self.date_from)\n\t\t\t\t\t@reservation_states = {} if @reservation_state.nil?\n\t\t\t\t\t@reservation_state_behaviors = {} if @reservation_state_behaviors.nil?\n\t\t\t\t\tif @reservation_states[base.to_s].nil?\n\t\t\t\t\t\t\n\t\t\t\t\t\t# Now\n\t\t\t\t\t\tnow = Time.current\n\t\t\t\t\t\t\n\t\t\t\t\t\t# States\n\t\t\t\t\t\treservation_states = config(:reservation_states)\n\n\t\t\t\t\t\t# Break times\n\t\t\t\t\t\tif config(:reservation_state_policy) == \"time_fixed\"\n\t\t\t\t\t\t\tbreak_times = []\n\t\t\t\t\t\t\treservation_states.reverse_each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\t\tif index != 0 # Do not consider first state\n\t\t\t\t\t\t\t\t\tstate_name = reservation_state_spec[:name]\n\t\t\t\t\t\t\t\t\ttime_fixed = self.send(\"time_fixed_#{state_name}\")\n\t\t\t\t\t\t\t\t\tif time_fixed\n\t\t\t\t\t\t\t\t\t\tbreak_times << time_fixed\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tbreak_times << break_times.last\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\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbreak_times = [self.datetime_from(base)]\n\t\t\t\t\t\t\treservation_states.reverse_each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\t\tif index != 0 && index != (reservation_states.length - 1) # Do not consider first and last state\n\t\t\t\t\t\t\t\t\tstate_name = reservation_state_spec[:name]\n\t\t\t\t\t\t\t\t\ttime_window = self.send(\"time_window_#{state_name}\")\n\t\t\t\t\t\t\t\t\tif time_window\n\t\t\t\t\t\t\t\t\t\tbreak_times << (break_times.last - time_window.days_since_new_year.days - time_window.seconds_since_midnight.seconds)\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tbreak_times << break_times.last\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\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\t# State recognititon\n\t\t\t\t\t\treservation_states.each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\tif index < reservation_states.length - 1\n\t\t\t\t\t\t\t\tif !break_times[reservation_states.length - 2 - index].nil? && now < break_times[reservation_states.length - 2 - index]\n\t\t\t\t\t\t\t\t\t@reservation_states[base.to_s] = reservation_state_spec[:name].to_sym\n\t\t\t\t\t\t\t\t\t@reservation_state_behaviors[base.to_s] = reservation_state_spec[:behavior].to_sym\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse # Last fallback state\n\t\t\t\t\t\t\t\t@reservation_states[base.to_s] = reservation_state_spec[:name].to_sym\n\t\t\t\t\t\t\t\t@reservation_state_behaviors[base.to_s] = reservation_state_spec[:behavior].to_sym\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\treturn @reservation_states[base.to_s]\n\t\t\t\tend", "def state\n data[:state]\n end", "def is_started\n self.set_at < DateTime.current\n end", "def get_transition(v1,x)\nif has_state?(v1)\n@transition[v1][x]\nelse\nnil\nend\nend", "def state\n @__state\n end", "def state\n info[:state]\n end", "def state()\n info[:state]\n end", "def time_began\n return @time_began\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state\n @state.last\n end", "def state\n @state.last\n end", "def as_of(time)\n history.as_of(time)\n end", "def state\n return 3 if deleted_at\n self[:state]\n end", "def now\n @clock\n end", "def state(timer)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n if timer.handle.ptr == nil\n raise \"timer is disposed\"\n end\n result = CurrentPaceComponentState.new(Native.CurrentPaceComponent_state(@handle.ptr, timer.handle.ptr))\n result\n end", "def state(timer)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n if timer.handle.ptr == nil\n raise \"timer is disposed\"\n end\n result = PossibleTimeSaveComponentState.new(Native.PossibleTimeSaveComponent_state(@handle.ptr, timer.handle.ptr))\n result\n end", "def as_point_in_time\n if time\n time\n elsif start_time\n start_time\n else\n end_time\n end\n end", "def state\n @state ||= getStateData()\n end", "def get_state\n return self.state == 't' || self.state == true\n end", "def _reservation_state(base)\n\t\t\t\t\t\n\t\t\t\t\t# Now\n\t\t\t\t\tnow = Time.current\n\t\t\t\t\t\n\t\t\t\t\t# States\n\t\t\t\t\treservation_states = config(:reservation_states)\n\n\t\t\t\t\t# Break times\n\t\t\t\t\tif config(:reservation_state_policy) == \"time_fixed\"\n\t\t\t\t\t\tbreak_times = []\n\t\t\t\t\t\treservation_states.reverse_each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\tif index != 0 # Do not consider first state\n\t\t\t\t\t\t\t\treservation_state_name = reservation_state_spec[:name]\n\t\t\t\t\t\t\t\ttime_fixed = self.send(\"time_fixed_#{reservation_state_name}\")\n\t\t\t\t\t\t\t\tif time_fixed\n\t\t\t\t\t\t\t\t\tbreak_times << time_fixed\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tbreak_times << break_times.last\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak_times = [base]\n\t\t\t\t\t\treservation_states.reverse_each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\tif index != 0 && index != (reservation_states.length - 1) # Do not consider first and last reservation_state\n\t\t\t\t\t\t\t\treservation_state_name = reservation_state_spec[:name]\n\t\t\t\t\t\t\t\ttime_window = self.send(\"time_window_#{reservation_state_name}\")\n\t\t\t\t\t\t\t\tif time_window\n\t\t\t\t\t\t\t\t\tbreak_times << (break_times.last - time_window.days_since_new_year.days - time_window.seconds_since_midnight.seconds)\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tbreak_times << break_times.last\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t# State recognititon\n\t\t\t\t\tresult_reservation_state = nil\n\t\t\t\t\tresult_reservation_state_behavior = nil\n\t\t\t\t\treservation_states.each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\tif index < reservation_states.length - 1\n\t\t\t\t\t\t\tif !break_times[reservation_states.length - 2 - index].nil? && now < break_times[reservation_states.length - 2 - index]\n\t\t\t\t\t\t\t\tresult_reservation_state = reservation_state_spec[:name].to_sym\n\t\t\t\t\t\t\t\tresult_reservation_state_behavior = reservation_state_spec[:behavior].to_sym\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse # Last fallback state\n\t\t\t\t\t\t\tresult_reservation_state = reservation_state_spec[:name].to_sym\n\t\t\t\t\t\t\tresult_reservation_state_behavior = reservation_state_spec[:behavior].to_sym\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\t\t\n\t\t\t\t\treturn [result_reservation_state, result_reservation_state_behavior]\n\t\t\t\tend", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def state\n self[:ST]\n end", "def now\n ret = self.dup\n ret.xset self.x\n ret.yset self.y\n ret\n end", "def as_of(time)\n superclass.from(virtual_table_at(time)).as_of_time!(time)\n end", "def transition_time\n end", "def motion_active(a)\n\n rawtime, raw_motion = a.last\n time = Time.at(rawtime.to_s[0..-4].to_i)\n motion = raw_motion.first.to_i == 1\n \n if @exe_motion[0] and motion and not @prev_motion then\n \n @exe_motion[0].call() \n\n \n elsif @exe_motion[1] and not motion and @prev_motion then\n \n @exe_motion[1].call() \n \n end\n\n @prev_motion = motion \n\n puts [time, motion] if @debug\n \n return motion == true\n\n end", "def time()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.PreviousSegmentComponentState_time(@handle.ptr)\n result\n end", "def control_points_to_states(control_points, timestep)\n bez = Bezier::Curve.new(*control_points.map{ |point| [point[\"x\"], point[\"y\"], point[\"z\"], point[\"rz\"]]})\n max_time = control_points.last[\"t\"]\n states = []\n time = 0\n while time <= max_time do\n point = bez.point_on_curve(time / max_time)\n states.push({\n :t => time,\n :x => point.x,\n :y => point.y,\n :z => point.z,\n :rx => 0.0,\n :ry => 0.0,\n :rz => point.r,\n })\n time += timestep\n end\n states\n end", "def game_state\n end", "def get_state(key)\n computation.get_state(key)\n end", "def time\n @time\n end", "def get_state(key)\n @state[key]\n end", "def as_of(time)\n self.class.as_of(time).where(:id => self.id).first!\n end", "def state\n return self.endpoint.state(self.id)\n end", "def acceleration(state_object, t)\n k = 10\n b = 1\n (- k * state_object.x) - (b * state_object.v)\nend", "def active_time\n (active?) ? (Time.now - @created_at) : (@finished_at - @created_at)\n end", "def time_class; end", "def past; end", "def get_state(instance)\n if instance.new? then @states[:create] else @states[:update] end\n end", "def get_state(instance)\n if instance.new? then @states[:create] else @states[:update] end\n end", "def at\n execution_time\n end", "def transition_at; end" ]
[ "0.64406633", "0.63835573", "0.6351832", "0.6287118", "0.6150739", "0.6089149", "0.6011625", "0.59686357", "0.5946129", "0.59131664", "0.5797158", "0.5792409", "0.5792409", "0.57847303", "0.57585275", "0.5749631", "0.57465136", "0.57293934", "0.57126606", "0.56720215", "0.56714195", "0.5662321", "0.5632178", "0.56287056", "0.56212145", "0.5610458", "0.56032836", "0.5592762", "0.5585129", "0.55722255", "0.5554462", "0.5554462", "0.5554462", "0.5554462", "0.5554462", "0.5554462", "0.5554462", "0.5554462", "0.5554462", "0.5554462", "0.5550757", "0.5548213", "0.55231196", "0.5514043", "0.55135876", "0.5499373", "0.54940015", "0.5486714", "0.5484763", "0.5464342", "0.5461021", "0.54563695", "0.54563695", "0.54563695", "0.54563695", "0.54563695", "0.54563695", "0.54563695", "0.54563695", "0.5454264", "0.5454264", "0.54511714", "0.5445484", "0.5434722", "0.54322535", "0.5432206", "0.5422646", "0.5417869", "0.5411601", "0.5411295", "0.539526", "0.539526", "0.539526", "0.539526", "0.539526", "0.539526", "0.539526", "0.539526", "0.539526", "0.5394903", "0.5387413", "0.5382489", "0.5378296", "0.5373332", "0.53724533", "0.53657436", "0.5356678", "0.5313807", "0.5307902", "0.52978957", "0.52931875", "0.52712065", "0.5267808", "0.5259684", "0.5256511", "0.5253048", "0.5252625", "0.5252625", "0.52495366", "0.5245529" ]
0.55703676
30
Updates the project's config/stations.yml with the latest data
def update_station_list log('This script overwrites your local copy of config/stations.yml with the latest data from nationalrail.co.uk and '\ 'railwaycodes.org.uk') log('Press [ENTER] to continue or [Ctrl+c] to quit') gets # Fetch data from the web stations = fetch_stations locations = fetch_locations # Add location data to the current active station list stations.each { |crs, data| data.merge!(locations[crs]) if locations[crs] } write_yaml(stations) log('Your station list has been updated') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_stations\n\n State.all.each do |s|\n fetch_stations(s)\n end\n\n end", "def reload_config\n @config = YAML.load_file('config/mse_router_info.yml')\n end", "def update\n\t\t\tpath = File.join(Config[:lists_directory], @name.downcase.gsub(/ /, '_') +'.yml')\n\t\t\tFile.open(path, 'w') do |fh|\n\t\t\t\tfh.puts(self.to_yaml)\n\t\t\tend\n\t\tend", "def updateStation()\n uri=URI.parse(ViaggiatrenoURLs.STATION_INFO)\n response = Net::HTTP.post_form(uri,{\"stazione\" => @stationFrom, \"lang\" => \"IT\"})\n doc = Nokogiri::HTML(response.body)\n\n doc.xpath(XPathMatchInfo.XPATH_STATION).each do |x|\n \n StringUtils.remove_newlines_tabs_and_spaces(x)\n\n train_number_complete = x.xpath(XPathMatchInfo.XPATH_TRAIN_NUMBER()).to_s\n train_destination = x.xpath(XPathMatchInfo.XPATH_TRAIN_DESTINATION()).to_s\n train_schedule =x.xpath(XPathMatchInfo.XPATH_TRAIN_SCHEDULED()).to_s\n train_description = \"#{train_number_complete} #{train_destination} #{train_schedule}\"\n \n train_number=train_number_complete.match(\"[0-9]+\")[0]\n \n @trains[train_number]=train_description\n @destinations.push(train_destination)\n ### TODO #### #@trains[train_number][description]=train_description\n end\n end", "def write_yaml(stations)\n log(' - Writing YAML...', false)\n File.open(YAML_PATH.to_s, 'w') { |file| file.write(stations.to_yaml) }\n log('DONE')\nend", "def update_last_run(gauges_config)\n gauges_config[:last_run] = Date.today\n File.open(\"#{CACHE_DIR_PATH}/config\", 'w') do |file|\n file.puts YAML.dump(gauges_config)\n end\n end", "def update_config\n if File.directory?(yolo_dir) and File.exist?(yaml_path)\n @yaml = YAML::load_file yaml_path\n update_yaml_setting(@yaml, \"deployment\", \"api_token\", \"example\")\n update_yaml_setting(@yaml, \"deployment\", \"team_token\", \"example\")\n end\n end", "def sync_configuration!\n load_configuration_if_needed! and save\n save_configuration_if_needed!\n end", "def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end", "def config_updated(config)\n puts green(\"Config updated at: #{config}\")\n end", "def sync_configuration\n end", "def dew_config\n start = Time.now\n @connected_apis.each { |api_name|\n puts \"\\n\\#\\#\\#\\# #{api_name} Config Begin \\#\\#\\#\\#\"\n api = instance_variable_get(\"@\" + api_name)\n api.dew_config @config\n puts \"\\n\\#\\#\\#\\# #{api_name} Config End \\#\\#\\#\\#\"\n }\n puts \"Took %.2f seconds to resolve and configure.\" % (Time.now - start)\n end", "def weather_stations(options = {})\n if options.delete(:reload) { false } || @weather_stations.nil?\n @weather_stations = Services::WeatherStations.new(options).fetch\n end\n @weather_stations\n end", "def update_configuration\n if @@initialized\n url = 'http://'+ENV['CONSUL_IP']+':8500/v1/kv/docker_nodes?raw'\n #log_message('Updating configuration from: ' + url)\n response = HTTPService.get_request(url)\n log_message('Dynamo changed, updating configuration to: ' + response.body)\n response = JSON.parse(response.body)\n replicate_data(response)\n end\n respond_to do |format|\n format.json { render :json => { :configuration => @@dynamo_nodes } }\n end\n end", "def sync_config\n return unless config.config_files\n upload_files(config.config_files, release_path.join('config'))\n end", "def put_config config = { 'room' => [ { 'name' => 'default-room', 'device' => [ 'light' => { 'name' => 'default-device' } ] } ] }\n File.open( self.get_config_file, 'w' ) do | handle |\n handle.write YAML.dump( config )\n end\n self.get_config_file\n end", "def set_station_info\n @station_info = StationInfo.find(params[:id])\n end", "def stations\n doc = request(@user, \"stations\")\n stations = []\n doc.xpath('//rss/channel/item').each do |node|\n stations << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :artwork => node.xpath('pandora:stationAlbumArtImageUrl').text.strip,\n :songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text.strip,\n :songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text.strip,\n :composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text.strip,\n :artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist').text.strip}\n end\n stations\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 update_solr_config\n [:solr, :blacklight].each do |key|\n say_status(\"warning\", \"COPYING #{key}.YML\".upcase, :yellow)\n\n remove_file \"config/#{key}.yml\"\n copy_file \"config/solr.yml\", \"config/#{key}.yml\"\n end\n end", "def update_config(watchers)\n # if we support updating backends, try that whenever possible\n if @opts['do_socket']\n update_backends(watchers)\n else\n @restart_required = true\n end\n\n # generate a new config\n generate_config(watchers)\n\n end", "def update_config(watchers)\n # if we support updating backends, try that whenever possible\n if @opts['do_socket']\n update_backends(watchers)\n else\n @restart_required = true\n end\n \n # generate new config\n new_config = generate_config(watchers)\n new_config = new_config.flatten.join(\"\\n\")\n \n # if we write config files, lets do that and then possibly restart\n if @opts['do_writes']\n write_config(new_config)\n restart if @opts['do_reloads'] && @restart_required\n end\n end", "def update_from_darksky(historical_dates=[Date.today-1], forecast=true)\n darksky_secret = ApiKey.where(:service => 'Darksky').first.key\n hydra = Typhoeus::Hydra.new\n requests = Hash.new\n forecast_request = nil\n\n logger.debug(\"Updating Station #{name} for dates: #{historical_dates}\")\n \n # Construct the HTTP requests to Darksky: one for each of the past days we care about, and one for today to get the forecast\n historical_dates.each do |d|\n endpoint = \"https://api.darksky.net/forecast/#{darksky_secret}/#{self.latitude},#{self.longitude},#{d.to_time.to_i}\"\n request = Typhoeus::Request.new(endpoint) \n hydra.queue(request)\n requests[d] = request\n end\n forecast_request = Typhoeus::Request.new(\"https://api.darksky.net/forecast/#{darksky_secret}/#{self.latitude},#{self.longitude}\")\n hydra.queue(forecast_request) if forecast\n\n # Run the whole lot of them!\n hydra.run\n\n # Parse out the observed precipitation from the historical queries\n reports = []\n requests.each_pair do |d, request|\n if request.response.timed_out?\n logger.error \"Request to Darksky timed out: #{request}\"\n next\n end\n if request.response.nil?\n logger.error \"No response from Darksky for request #{request}\"\n next\n end\n if request.response.code != 200\n logger.error \"Unable to fetch weather data from #{request.base_url}: #{request.response.code} #{request.response.status_message}\"\n next\n end\n\n # With error trapping done, let's parse the body and update the db with the report data.\n data = JSON.load(request.response.body)\n data['daily']['data'].each do |report|\n logger.debug(report)\n d = Time.at(report['time']).to_date\n datestamp = \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"\n logger.debug(\"Using timestamp #{datestamp}\")\n # We want to update an existing row in place if we've previously computed one\n r = weather_reports.find_or_create_by(\n :latitude => self.latitude,\n :longitude => self.longitude,\n :date => datestamp,\n )\n \n \n # TODO: multiply by the actual number of hours in the time period.\n precip = report['precipIntensity'] # This is in inches per hour\n logger.debug(\"Extracted precipitation report: #{precip} from report #{report}\")\n r.precip = precip * 24.0\n logger.debug(\"Constructed WeatherReport: #{r}\")\n logger.debug(\"Coordinates: #{r.latitude},#{r.longitude}\")\n logger.debug(\"Datestamp: #{r.date}\")\n logger.debug(\"Recorded Precip: #{r.precip}\")\n \n r.save\n reports.push(r)\n end\n end\n\n # Add the forecast data as well\n forecasts = []\n if forecast\n logger.info(\"Parsing forecasts for station #{self}\")\n logger.debug(\"Got response: #{forecast_request.response}\")\n if forecast_request.response.timed_out?\n logger.error \"Request to Darksky timed out: #{forecast_request}\"\n return\n end\n if forecast_request.response.nil?\n logger.error \"No response from Darksky for request #{forecast_request}\"\n return\n end\n if forecast_request.response.code != 200\n logger.error \"Unable to fetch weather data from #{forecast_request.base_url}: #{forecast_request.response.code} #{forecast_request.response.message}\"\n return\n end\n\n logger.debug(\"Successful response from Darksky\")\n data = JSON.load(forecast_request.response.body)\n data['daily']['data'].each do |report|\n logger.debug(report)\n d = Time.at(report['time']).to_date\n datestamp = \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"\n r = weather_reports.find_or_create_by(\n :latitude => self.latitude,\n :longitude => self.longitude,\n :date => datestamp,\n )\n r.precip = report['precipIntensity'] * 24.0 # The Darksky report gives us inches per hour\n\n logger.debug(\"Created forecast object: #{r}\")\n r.save\n forecasts.push(r)\n end\n end\n\n # TODO: add a column that we can record when this update was last run, for display on the webpage.\n {:reports => reports, :forecasts => forecasts}\n end", "def update\n save_setting('program_name', Setting::NAME_CURR_PROGRAM_NAME)\n save_setting('timelapse_mode', Setting::NAME_TIMELAPSE_MODE)\n save_setting('interval', Setting::NAME_INTERVAL)\n save_setting_with('sensor_proximity', Setting::NAME_SENSOR_PROXIMITY, params['sensor_proximity'].include?('active') ? \"1\" : \"0\") if params['sensor_proximity']\n save_setting_with('sensor_vibration', Setting::NAME_SENSOR_VIBRATION, params['sensor_vibration'].include?('active') ? \"1\" : \"0\") if params['sensor_vibration']\n save_setting('sensor_time_between_photos', Setting::NAME_SENSOR_TIME_BETWEEN_PHOTOS)\n\n head :ok\n end", "def update_config(current, new)\n current.merge! new\n end", "def update\n @station = Station.find(params[:id])\n\n if @station.update(station_params)\n head :no_content\n else\n render json: @station.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @configs = args[:configs] if args.key?(:configs)\n end", "def place_config\n if self.valid? and self.connect then\n @ssh_connection.scp.upload!(StringIO.new(@config.to_s), \"/tmp/system.cfg\")\n end\n end", "def download_local\n nsd_cccc = Metar::Station.download_stations\n File.open(Metar::Station.local_nsd_path, 'w') do |fil|\n fil.write nsd_cccc\n end\n end", "def stations_status(options={})\n get(stations_path, options.merge(:updateOnly => true))\n end", "def load_station_data\n data = Net::HTTP.get(URI.parse(stations_url))\n JSON.parse(data)[\"result\"]\n end", "def save_project_config(yaml, repo_name, ready)\n update!(configuration: yaml, ready: ready)\n update!(repo_name: repo_name) unless repo_name.blank?\n end", "def owncloud_config_update\n owncloud_config.merge(owncloud_cookbook_config)\n owncloud_config.write\n owncloud_config\n end", "def main\n # Get config file from the config.yml file\n load_config\n \n # Get the status from the saved 'state' file\n load_state\n \n # For each configuration\n @@configs.each_pair do |name, config|\n # Get data\n print \"fetching data\\n\"\n rawdata = open(config['data_uri']).read\n # Parse datafile\n print \"parsing data\\n\"\n data = parse(rawdata)\n # Check if data feed has been updated\n latest_year = data.last[config['year_col']].to_i\n latest_month = data.last[config['month_col']].to_i\n unless @@state and @@state[name] and latest_year == @@state[name]['year'] and latest_month == @@state[name]['month']\n # Send updates\n @@state = {} unless @@state\n @@state[name] = {}\n @@state[name]['year'] = latest_year\n @@state[name]['month'] = latest_month\n print \"sending updates\\n\"\n # Twitter\n send_update_to_twitter(data, name, config)\n end\n save_state\n end\nend", "def update_config(attributes = {})\n current_attrs = @config.attributes\n new_attrs = current_attrs.merge!(attributes)\n @config.attributes = new_attrs\n @config.save\n end", "def update\n respond_to do |format|\n if @set_station.update(set_station_params)\n format.html { redirect_to set_stations_path, notice: 'Set station was successfully updated.' }\n format.json { render :index, status: :ok, location: @set_stations }\n else\n format.html { render :edit }\n format.json { render json: @set_station.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_config\n {}.update(local_config)\nend", "def data_add_stations\n @routes[0].stations.insert(-2, @stations[1])\n @routes[0].stations.insert(-2, @stations[2])\n @routes[2].stations.insert(-2, @stations[1])\n end", "def configure(update); end", "def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end", "def save_config\n self.data = JSON.dump(self.config)\n end", "def save_config\n self.data = JSON.dump(self.config)\n end", "def merge_local_with_api(filename)\n project = YAML.safe_load_file(filename)\n api_data = JSON.parse(open(\"_data/projects/all.json\").read)\n unless project.nil?\n new_data = update_from_api(project, api_data[project['name']])\n end\nend", "def update_server_info\n @adapter.update_server_info(repository_path.to_s)\n end", "def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end", "def index\n @stations = Station.all\n end", "def save_config\n self.config['scheduling_criteria'] = '' if self.config['scheduling_criteria'] == 'null'\n self.config['from_time'] = self.config['from_time'].gsub(I18n.t('time.am'), \"am\").gsub(I18n.t('time.pm'), \"pm\")\n self.config['to_time'] = self.config['to_time'].gsub(I18n.t('time.am'), \"am\").gsub(I18n.t('time.pm'), \"pm\")\n self.data = JSON.dump(self.config)\n end", "def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end", "def reload_config\n @config = Configuration.new(@editor.path_to_current_file)\n end", "def update\n update_save(@sensor_datum, sensor_datum_params, \"Sensor datum\")\n end", "def set_station\n @station = Station.find(params[:id])\n end", "def save_reading()\n\tStation.all.each do |x|\n\t\tstation_id = x.station_id\n\t\tlat = x.lat\n\t\tlong = x.long\n\t\tlat_long = \"#{lat},#{long}\"\n\t\tforecast = JSON.parse(open(\"#{BASE_URL}/#{API_KEY}/#{lat_long}\").read)\n\t\tr = WeatherReading.new\n\t\tr.build_reading(station_id,lat,long,current_date(forecast),current_time(forecast),current_temperature(forecast),current_dew_point(forecast),\n\t\t\tcurrent_wind_direction(forecast),current_wind_speed(forecast),current_rainfall(forecast),\"forecast.io\")\n\t\tr.save\n\tend\n\nend", "def update_all_config\n @admin.updateConfiguration\n end", "def save_config\n config = $bot[:config].clone\n config.delete :client\n File.open \"./#{Twittbot::CONFIG_FILE_NAME}\", 'w' do |f|\n f.write config.to_yaml\n end\n end", "def list_stations\n @stations.each_with_index { |station, i| puts \"#{i + 1} #{station.name}\" }\n end", "def set_station_daily\n @station_daily = StationDaily.find(params[:id])\n end", "def persistData!\n File.open(getWorkingDir+'/data.host', 'w') do |f|\n f.write(@plataforms.to_yaml)\n end\n end", "def set_station\n @station = Station.find(params[:id])\n end", "def set_station\n @station = Station.find(params[:id])\n end", "def set_station\n @station = Station.find(params[:id])\n end", "def update\n respond_to do |format|\n if @station_info.update(station_info_params)\n format.html { redirect_to @station_info, notice: 'Station info was successfully updated.' }\n format.json { render :show, status: :ok, location: @station_info }\n else\n format.html { render :edit }\n format.json { render json: @station_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def stations_status\n Citibikenyc.stations_status\n end", "def list_stations\n if @stations.empty?\n stations_void\n else\n stations_list\n end\n end", "def [](config)\n ensure_config_file_exists\n @@config ||= HashWithIndifferentAccess.new(YAML.parse_file(CONFIG_FILE).to_ruby)\n @@config[:watch_tower].send(:[], config)\n end", "def update\n respond_to do |format|\n if @station.update(station_params)\n format.html { redirect_to @station, notice: 'Станция обновлена.' }\n format.json { render :show, status: :ok, location: @station }\n else\n format.html { render :edit }\n format.json { render json: @station.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @main_station.update(main_station_params)\n format.html { redirect_to @main_station, notice: 'Main station was successfully updated.' }\n format.json { render :show, status: :ok, location: @main_station }\n else\n format.html { render :edit }\n format.json { render json: @main_station.errors, status: :unprocessable_entity }\n end\n end\n end", "def config=(config); end", "def write\n self.open_file('config/site.yml') do |file|\n self.output_resource_op self.mounting_point.site\n\n file.write(self.mounting_point.site.to_yaml)\n\n self.output_resource_op_status self.mounting_point.site\n end\n end", "def up\n @prefix = config[:prefix] || 'feeds'\n @syndicate_since = Time.parse(config[:syndicate_since] || 'Jan 01 00:00:01 GMT 1969')\n end", "def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end", "def parse_config\n %w(/etc/steel/steel.yml steel.yml).each do |cfg|\n if File.exist?(cfg)\n begin\n y = YAML.load_file(cfg)\n rescue Psych::SyntaxError => e\n error \"[#{e.class}] Failed to parse '#{cfg}'!!\"\n error e.message\n exit 1\n end\n # Merge the contents of the config into @config.\n config.merge!(y)\n end\n end\n end", "def load_configuration\n @config = {\n :start_date => Date.today - 1,\n :data_dir => default_data_dir\n }\n\n if File.exist?(config_file)\n @config = YAML.load_file(config_file)\n end\n\n @config\n end", "def push!\n self.place_config\n self.apply_config!\n end", "def configure(new_configurations=[])\n run_migrations\n\n new_configurations.each do |config|\n GTFS::Realtime::Configuration.create!(config) unless GTFS::Realtime::Configuration.find_by(name: config[:name])\n end\n end", "def update_worldmap\n if data = (@environment[\"gps\"] || @environment[\"network\"])\n worldmap_request \"PUT\", \"/hoc\", data.to_json\n end\n end", "def update_config(show_main_tour: nil, show_mobile_tour: nil, show_feed_tour: nil, show_entry_tour: nil,\n show_kb_shortcuts_tour: nil)\n new_config = {}\n new_config[:show_main_tour] = show_main_tour if !show_main_tour.nil?\n new_config[:show_mobile_tour] = show_mobile_tour if !show_mobile_tour.nil?\n new_config[:show_feed_tour] = show_feed_tour if !show_feed_tour.nil?\n new_config[:show_entry_tour] = show_entry_tour if !show_entry_tour.nil?\n new_config[:show_kb_shortcuts_tour] = show_kb_shortcuts_tour if !show_kb_shortcuts_tour.nil?\n Rails.logger.info \"Updating user #{self.id} - #{self.email} with show_main_tour #{show_main_tour}, \" +\n \"show_mobile_tour #{show_mobile_tour}, show_feed_tour #{show_feed_tour}, \" +\n \"show_entry_tour #{show_entry_tour}, show_kb_shortcuts_tour #{show_kb_shortcuts_tour}\"\n self.update new_config if new_config.length > 0\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n @workstation_configs = args[:workstation_configs] if args.key?(:workstation_configs)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n @workstation_configs = args[:workstation_configs] if args.key?(:workstation_configs)\n end", "def update_config\n # hier könnte man nur bestime Sachen erlauben\n #config/set?framerate=2\n url = Rails.application.config.motion_api_base_path + '0/config/set?' + params[:key] + '=' + params[:value]\n result = HTTParty.get(url)\n # Hi er könnte man die Rückgabe noch anschauen und ggf ein Fehler schmeissen\n redirect_to :back\n end", "def update_config\n @config_id = (@config_id + 1) % 2**24\n stop_ssdp_server\n notify :alive\n end", "def update_click_config\n if @mobiles.length > 0\n if @bstype == 'nec'\n new_config = gen_nec_config\n else\n new_config = gen_airspan_config\n end\n else\n new_config = ''\n end\n\n debug(\"Loading new click configuration for datapath #{name}\")\n begin\n @click_socket.send(\"WRITE hotconfig #{new_config}\\n\", 0)\n rescue Errno::EPIPE => e\n # click has probably crashed, so don't do anything because\n # it will be automatically restarted with the new config\n debug(\"Error writing on control socket: #{e.message}\")\n else\n while line = @click_socket.gets\n case line\n when /^2\\d\\d/\n debug(\"New config loaded successfully\")\n break\n when /^5\\d\\d/\n error(\"Could not load new config, old config still running: #{line}\")\n break\n end\n end\n end\n end", "def update_config(params)\n services = services_from_params(params)\n to = get_param(params, :to)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would update the configuration of #{agent.host} (#{agent.type}) to version #{to}\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::UpdateConfigCommand.new([ to ], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Updated the configuration of #{agent.host} (#{agent.type}) to ' + to,\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end", "def update\n super if defined? super\n @systems.each_value do |system|\n system.update\n end\n end", "def stations\r\n return @stations\r\n end", "def index\n @main_stations = MainStation.all\n end", "def extract_station(url, state)\n\n id, json_url = nil\n\n doc = Nokogiri::HTML(open(\"#{Global::BOM_BASE_URL}#{url}\"))\n doc.css('a').each do |l|\n\n if l.attr('href').include?('json')\n json_url = l.attr('href')\n id = l.attr('href').split('.')\n id = id[1]\n end\n\n end\n\n begin\n station = Station.find(id)\n scraper_logger.info(\"Updating existing station #{id}\")\n\n rescue\n station = Station.new\n station.id = id\n scraper_logger.info(\"Creating new station #{id}\")\n\n end\n\n begin\n station.state = state\n\n name = doc.css('h1').first\n station.name = name.text.gsub('Latest Weather Observations for ','')\n\n station.station_url = \"#{Global::BOM_BASE_URL}#{url}\"\n station.json_url = \"#{Global::BOM_BASE_URL}#{json_url}\"\n\n json = extract_observations(station.json_url)\n station.latitude = json['observations']['data'].first['lat']\n station.longitude = json['observations']['data'].first['lon']\n\n tz = Timezone.where(abbreviation: json['observations']['header'].first['time_zone'])\n if tz.size > 0\n station.timezone = tz.first\n station.save\n\n scraper_logger.info(\"#{station.id} - #{station.name} has been saved\")\n\n else\n scraper_logger.warn(\"#{station.id} - #{station.name} could not be saved due to unknown TZ (#{json['observations']['header'].first['time_zone']})\")\n\n end\n\n rescue\n scraper_logger.warn(\"#{station.id} - #{station.name} could not be saved due missing data in JSON file)\")\n\n end\n \n end", "def merge_into(another_station)\n self.lifts.each do |lift|\n lift.station = another_station\n lift.save!\n end\n\n self.lines_stations.each do |line_station|\n line_station.station_id = another_station.id\n line_station.save!\n end\n\n another_station.location = self.location if self.location\n self.delete\n end", "def show\n @station = @property.stations\n end", "def index\n @station_infos = StationInfo.all\n end", "def index\n @stations = Station.all\n end", "def set_main_station\n @main_station = MainStation.find(params[:id])\n end", "def load_config\n self.config = JSON.load(self.data)\n end", "def ensure_config\n if ! in_sync?\n File.open(configfile,\"w\") do |f|\n f.write(@config.to_json)\n end\n end\n end", "def index\n @stations = Station.all\n\n #response = HTTParty.get('http://0.0.0.0:3000/convertcsv.json')\n # r = HTTParty.get('http://0.0.0.0:3000/convertcsv.json')\n # r = HTTParty.get('http://rubygems.org/api/v1/versions/httparty.json')\n # r = HTTParty.get('http://0.0.0.0:3000/convertcsv.json') \n\n linestation_list = JSON.parse(File.read('app/assets/javascripts/convertcsv.json'))\n # puts \"first record\"\n # puts linestation_list[0][\"From Station\"]\n $i = 0\n $stops = 5\n \n origin_stations = [\"East Ham\"]\n\n\n final_to_station_array =[]\n processed_stations = []\n\n\n while $i < $stops do\n puts(\"*******Stations from East Ham with the following stops (1+) #$i **********\" )\n to_station = \"\"\n\n final_to_station_array = []\n statition_detail = {}\n\n\n\n # origin_stations.each do | origin_station |\n # origin_station = origin_stations[0]\n\n\n linestation_list.each do | ls |\n\n\n # puts ls[\"To Station\"] == old_origin_station\n # if final_to_station_array.include?(ls[\"From Station\"])\n # puts \"include the From Station in the final\"\n # end\n from_tube_lines = []\n \n\n if origin_stations.include?(ls[\"From Station\"]) || origin_stations.include?(ls[\"To Station\"])\n \n from_tube_lines.push(ls[\"Tube Line\"])\n\n\n origin_tube_line = \"District\"\n updated_tube_lines =\"\"\n\n origin_stations.each do | origin_station |\n\n # updated_tube_lines = updated_tube_lines.present?? updated_tube_lines : origin_tube_line\n puts \"initialiezed updated_tube_lines\"\n puts updated_tube_lines\n\n unless processed_stations.include?(origin_station) \n puts \"*****adding to the processed_station now\"\n processed_stations.push(origin_station)\n puts \"origin_station\"\n puts origin_station\n puts \"*****processed_stations\"\n puts processed_stations\n end \n\n unless processed_stations.include?(ls[\"To Station\"]) \n unless final_to_station_array.include?(ls[\"To Station\"])\n puts \"***adding to the final stations now\"\n puts ls[\"To Station\"]\n final_to_station_array.push(ls[\"To Station\"])\n statition_detail[ls[\"To Station\"]] = \"#{ls['To Station']} (lines = #{ls['Tube Line']})\"\n end\n end\n\n unless processed_stations.include?(ls[\"From Station\"])\n unless final_to_station_array.include?(ls[\"From Station\"])\n puts \"***adding to the final stations now\"\n puts ls[\"From Station\"]\n final_to_station_array.push(ls[\"From Station\"])\n statition_detail[ls[\"From Station\"]] = \"#{ls['From Station']} (lines = #{ls['Tube Line']})\"\n end\n end\n\n puts \" old updated_tube_lines ???\"\n puts updated_tube_lines\n\n puts \" old origin_tube_line ???\"\n puts origin_tube_line \n\n if origin_tube_line == ls[\"Tube Line\"]\n updated_tube_lines = origin_tube_line \n puts \"original is the same as the current, assign to the updated one\"\n else\n\n puts \"----- the updated_tube_lines\"\n puts updated_tube_lines \n updated_tube_lines = origin_tube_line + \", \" + ls[\"Tube Line\"]\n puts \" **** new updated_tube_line\"\n puts updated_tube_lines\n\n end\n\n \n \n end \n\n origin_tube_line = updated_tube_lines\n puts \" **** new updated_tube_line\"\n puts updated_tube_lines\n puts \"-----from_tube_lines----\"\n puts from_tube_lines\n\n\n end\n end\n\n\n # end\n \n\n origin_stations = []\n origin_stations = final_to_station_array\n $i +=1\n\n puts \"&&&&&&& the needed information &&&&&&\" \n puts \"*******final_to_station_array\"\n puts final_to_station_array\n puts final_to_station_array.size\n puts \"** station detail\"\n puts statition_detail\n puts \"-----\"\n end\n\n\n # origin_station = \"East Ham\"\n # to_station = \"\"\n # linestation_list.each do | ls |\n # while $i < $stops do\n # puts(\"Inside the loop i = #$i\" )\n # puts ls[\"From Station\"]\n # if ls[\"From Station\"] == origin_station\n # # to_station = ls[\"To Station\"]\n # puts ls\n # end\n # # origin_station = to_station\n # # puts \"new origin_station\"\n # # puts origin_station\n # puts \"-----\"\n # $i +=1\n # end\n\n # end\n\n\n\n\n end", "def data\n YAML::load_file(files[:config])\n end", "def update\n self.publish_json\n end", "def fetch!\n cm = @api.api('v1').resource('configmaps', namespace: @ns).get(@name)\n @_current = cm.data[@key]\n end", "def update\n raise NoMapFound, \"your have to load a gps track first\" unless funkygps.map\n #show it on the PaPiRus display\n @display.show(data:to_bit_stream, command: 'F')\n end", "def config\n $stdout.puts \"The current configuration of the pow server is:\\n\\n\"\n result = %x{curl localhost/config.json --silent --header host:pow}\n json = JSON.parse(result)\n json.each_pair {|k,v| $stdout.puts \" #{k}: #{v}\"}\n $stdout.puts \"\\n\"\n end", "def update_local_outdated\n update_local(@outdated) if outdated?\n end" ]
[ "0.60823065", "0.6051133", "0.5908637", "0.586426", "0.5831725", "0.5792561", "0.5762153", "0.56759757", "0.5665405", "0.5652359", "0.56044865", "0.5520707", "0.54454124", "0.5413685", "0.5391292", "0.5369639", "0.5365964", "0.5365936", "0.5360263", "0.53476155", "0.5311275", "0.53086", "0.53073055", "0.5290572", "0.52791053", "0.52715874", "0.5245428", "0.522927", "0.5216749", "0.52115506", "0.52085865", "0.5193615", "0.51882726", "0.51770157", "0.5164335", "0.5150011", "0.5139227", "0.51321274", "0.513024", "0.5120565", "0.51068145", "0.51068145", "0.50920683", "0.50777376", "0.50775844", "0.50709295", "0.5064352", "0.5061615", "0.5047296", "0.5031428", "0.50314206", "0.5027352", "0.50243425", "0.5012114", "0.5010033", "0.49957135", "0.4985236", "0.4979387", "0.4979387", "0.4979387", "0.49786058", "0.49760896", "0.4974595", "0.49735022", "0.49691942", "0.49679488", "0.4963185", "0.49580708", "0.4956367", "0.49556276", "0.49370655", "0.49288958", "0.49287325", "0.49241632", "0.4916401", "0.4915889", "0.4914739", "0.49136776", "0.49121246", "0.49071512", "0.48942748", "0.4886371", "0.48784533", "0.48747146", "0.4868501", "0.48670906", "0.48641545", "0.4860666", "0.48600182", "0.4859381", "0.4856594", "0.48528934", "0.4845744", "0.4843741", "0.48270026", "0.48221573", "0.4816677", "0.48134547", "0.48062137", "0.48044688" ]
0.7758356
0
Gets the current list of stations from the national rail website's station codes csv file
def fetch_stations log(' - Fetching station list...', false) results = {} response = get_response('https://www.nationalrail.co.uk/static/documents/content/station_codes.csv') CSV.new(response, headers: true).each do |row| results[row['CRS Code']] ||= {} results[row['CRS Code']][:name] = row['Station Name'] end log('DONE') results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stations\n stations = []\n CSV.foreach(LOCAL_DATA, :col_sep =>':') do |row|\n callsign, origin, destination, client = row[0].to_s, row[11].to_s, row[13].to_s, row[3].to_s\n for cs in @callsign\n stations << row if callsign[0...cs.length] == cs # && client == \"ATC\") unless @role == \"pilot\"\n # stations << row if (origin[0...icao.length] == icao || destination[0...icao.length] == icao) unless @role == \"atc\"\n end\n end\n stations\n end", "def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end", "def stations_on_line(code)\n Station.get_on_line(code)\n end", "def list_stations\n if @stations.empty?\n stations_void\n else\n stations_list\n end\n end", "def stations_list\n @route.get_stations_list\n end", "def stations\n [\n master_station,\n SLCStationReport.new(@fields[5..9], false),\n SLCStationReport.new(@fields[10..14], false),\n SLCStationReport.new(@fields[15..19], false),\n SLCStationReport.new(@fields[20..24], false),\n SLCStationReport.new(@fields[25..29], false)\n ]\n end", "def stations\n doc = request(@user, \"stations\")\n stations = []\n doc.xpath('//rss/channel/item').each do |node|\n stations << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :artwork => node.xpath('pandora:stationAlbumArtImageUrl').text.strip,\n :songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text.strip,\n :songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text.strip,\n :composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text.strip,\n :artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist').text.strip}\n end\n stations\n end", "def stations\r\n return @stations\r\n end", "def stations_list\n @route.stations_list\n end", "def get_station_names\n\n\t\t# Typhoeus is used to submit http requests\n\n\t\t response = Typhoeus.get(\"http://api.bart.gov/api/stn.aspx?cmd=stns&key=ZZLI-UU93-IMPQ-DT35\")\n\n\t\t # Extract the station names and short names\n\n\t\t response_XML = Nokogiri.XML(response.body)\n\n\t\t @station_names = {}\n\n\t\t # Create a hash list of the station names and abbreviations\n\t\t # node provides the full name of the station and next node is \n\t\t # the abbreviation\n\n\t\t response_XML.xpath(\"//stations/station/name\").each do |node|\n\t\t \t\t@station_names[node.text] = node.next.text\n\t\t end\n\n\t\t return @station_names\n\n\tend", "def list_stations\n @stations.each_with_index { |station, i| puts \"#{i + 1} #{station.name}\" }\n end", "def find_stations(mta, start_station, end_station)\n\n # Find the lines the stations are on\n lines = find_lines mta, start_station, end_station\n\n # Find the indexes on the found lines\n origin_index = mta[lines[0]].index(start_station)\n origin_union_index = mta[lines[0]].index(\"Union Square\")\n dest_union_index = mta[lines[1]].index(\"Union Square\")\n dest_index = mta[lines[1]].index(end_station)\n\n # Return an array of the results\n stations = [lines[0], origin_index, origin_union_index, lines[1], dest_union_index, dest_index]\nend", "def load_station_data\n data = Net::HTTP.get(URI.parse(stations_url))\n JSON.parse(data)[\"result\"]\n end", "def stations_status\n Citibikenyc.stations_status\n end", "def stations\n @stations ||= (exact_match? ? parse_station : parse_stations)\n end", "def get_stationList(uPos)\n stationList = []\n for n in @@networks\n resp = Net::HTTP.get_response(URI.parse(n)).body\n result = JSON.parse(resp)['network']['stations']\n (stationList << result).flatten!\n end\n stationList.sort! {|s1, s2| dist_user(s1, uPos) <=> dist_user(s2, uPos)}\n end", "def fetch_stations(state)\n\n scraper_logger.info(\"Fetching stations for #{state.name}\")\n\n doc = Nokogiri::HTML(open(state.url))\n doc.css('a').each do |s|\n\n Global::OBSERVATION_PRODUCT_CODE.each do |c|\n if s.attr('href').include?(c) and s.attr('href').include?(state.product_group)\n extract_station(s.attr('href'), state)\n end\n end\n\n end\n\n scraper_logger.info(\"Completed fetching stations for #{state.name}\")\n\n end", "def index\n @stations = Station.all\n end", "def list_stations\n Station.all.collect{|obj| obj.name}.sort\n end", "def index\n @stations = Station.all\n\n #response = HTTParty.get('http://0.0.0.0:3000/convertcsv.json')\n # r = HTTParty.get('http://0.0.0.0:3000/convertcsv.json')\n # r = HTTParty.get('http://rubygems.org/api/v1/versions/httparty.json')\n # r = HTTParty.get('http://0.0.0.0:3000/convertcsv.json') \n\n linestation_list = JSON.parse(File.read('app/assets/javascripts/convertcsv.json'))\n # puts \"first record\"\n # puts linestation_list[0][\"From Station\"]\n $i = 0\n $stops = 5\n \n origin_stations = [\"East Ham\"]\n\n\n final_to_station_array =[]\n processed_stations = []\n\n\n while $i < $stops do\n puts(\"*******Stations from East Ham with the following stops (1+) #$i **********\" )\n to_station = \"\"\n\n final_to_station_array = []\n statition_detail = {}\n\n\n\n # origin_stations.each do | origin_station |\n # origin_station = origin_stations[0]\n\n\n linestation_list.each do | ls |\n\n\n # puts ls[\"To Station\"] == old_origin_station\n # if final_to_station_array.include?(ls[\"From Station\"])\n # puts \"include the From Station in the final\"\n # end\n from_tube_lines = []\n \n\n if origin_stations.include?(ls[\"From Station\"]) || origin_stations.include?(ls[\"To Station\"])\n \n from_tube_lines.push(ls[\"Tube Line\"])\n\n\n origin_tube_line = \"District\"\n updated_tube_lines =\"\"\n\n origin_stations.each do | origin_station |\n\n # updated_tube_lines = updated_tube_lines.present?? updated_tube_lines : origin_tube_line\n puts \"initialiezed updated_tube_lines\"\n puts updated_tube_lines\n\n unless processed_stations.include?(origin_station) \n puts \"*****adding to the processed_station now\"\n processed_stations.push(origin_station)\n puts \"origin_station\"\n puts origin_station\n puts \"*****processed_stations\"\n puts processed_stations\n end \n\n unless processed_stations.include?(ls[\"To Station\"]) \n unless final_to_station_array.include?(ls[\"To Station\"])\n puts \"***adding to the final stations now\"\n puts ls[\"To Station\"]\n final_to_station_array.push(ls[\"To Station\"])\n statition_detail[ls[\"To Station\"]] = \"#{ls['To Station']} (lines = #{ls['Tube Line']})\"\n end\n end\n\n unless processed_stations.include?(ls[\"From Station\"])\n unless final_to_station_array.include?(ls[\"From Station\"])\n puts \"***adding to the final stations now\"\n puts ls[\"From Station\"]\n final_to_station_array.push(ls[\"From Station\"])\n statition_detail[ls[\"From Station\"]] = \"#{ls['From Station']} (lines = #{ls['Tube Line']})\"\n end\n end\n\n puts \" old updated_tube_lines ???\"\n puts updated_tube_lines\n\n puts \" old origin_tube_line ???\"\n puts origin_tube_line \n\n if origin_tube_line == ls[\"Tube Line\"]\n updated_tube_lines = origin_tube_line \n puts \"original is the same as the current, assign to the updated one\"\n else\n\n puts \"----- the updated_tube_lines\"\n puts updated_tube_lines \n updated_tube_lines = origin_tube_line + \", \" + ls[\"Tube Line\"]\n puts \" **** new updated_tube_line\"\n puts updated_tube_lines\n\n end\n\n \n \n end \n\n origin_tube_line = updated_tube_lines\n puts \" **** new updated_tube_line\"\n puts updated_tube_lines\n puts \"-----from_tube_lines----\"\n puts from_tube_lines\n\n\n end\n end\n\n\n # end\n \n\n origin_stations = []\n origin_stations = final_to_station_array\n $i +=1\n\n puts \"&&&&&&& the needed information &&&&&&\" \n puts \"*******final_to_station_array\"\n puts final_to_station_array\n puts final_to_station_array.size\n puts \"** station detail\"\n puts statition_detail\n puts \"-----\"\n end\n\n\n # origin_station = \"East Ham\"\n # to_station = \"\"\n # linestation_list.each do | ls |\n # while $i < $stops do\n # puts(\"Inside the loop i = #$i\" )\n # puts ls[\"From Station\"]\n # if ls[\"From Station\"] == origin_station\n # # to_station = ls[\"To Station\"]\n # puts ls\n # end\n # # origin_station = to_station\n # # puts \"new origin_station\"\n # # puts origin_station\n # puts \"-----\"\n # $i +=1\n # end\n\n # end\n\n\n\n\n end", "def get_csv_station_keys\n @cvs_station_keys ||= [:location, :block_number, :station_number, :place, :state, :country, :region, :latitude, :longitude, :upper_air_latitude, :upper_air_longitude, :elevation, :upper_air_elevation, :rsbn]\n end", "def index\n @courier_stations = CourierStation.find_by_sql [\"SELECT cs.id, cs.courier_id, cs.station_id, cs.status, cs.created_at, cs.updated_at, s.station_name, c.courier_name FROM courier_stations cs, couriers c, stations s WHERE cs.courier_id = c.id AND cs.station_id = s.id\"]\n end", "def get_all_stations\n url = 'radio/station'\n options = {query: {'alt': 'json', 'tier': 'aa', 'hl': 'en_US'}}\n\n make_post_request(url, options)\n end", "def index\n @stations = Station.all\n end", "def lineL_stations \n puts \"The list of stations for line L: \"\n puts \"[0] - 8th\"\n puts \"[1] - 6th\"\n puts \"[2] - Union Square\"\n puts \"[3] - 3rd\"\n puts \"[4] - 1st\"\nend", "def find_stations(si, ei, line) # si is short for start index and ei is short for end index\n if ei >= si\n line_stop_count = ei - si\n passing_stations = line[(si+1)..ei].join(\", \")\n else\n line_stop_count = si - ei\n passing_stations = line[(ei)..(si-1)].reverse.join(\", \")\n end\n return {:num_stops => line_stop_count, :stops => passing_stations}\nend", "def station_init router = Router.new\n\n\tchannel = 0\n\tstep = 1\n\tstations = Array.new\n\tCSV.foreach(\"focus_out.csv\") do |row|\n\t\t\n\t\tif step == 1\n\t\t\tchannel = row[3]\n\t\telse\n\t\t\ts = Station.new\n\t\t\ts.stmac = row[0]\n\t\t\ts.bssid = row[5]\n\t\t\ts.channel = channel\n\t\t\trouter.stations << s\n\t\tend\n\t\t\n\t\tstep += 1\t\t\t\t\n\t\t\t\t\n\tend\n\t\n\tsystem(\"clear\")\n\t\n\treturn router\nend", "def index\n @line_station_2s = LineStation2.all\n end", "def index\n @raiway_stations = RaiwayStation.all\n end", "def index\n @station_infos = StationInfo.all\n end", "def initialize_stations\r\n @stations = Array.new\r\n i = 0\r\n\r\n @lines.each {|line, stations|\r\n stations.each_with_index {|item, index|\r\n @stations.push(Station.new(item))\r\n if index == 0\r\n @stations.at(-1).set_train(@trains.at(i))\r\n i += 1\r\n end\r\n }\r\n }\r\n\r\n @stations = @stations.uniq { |s| s.station.to_s}\r\n end", "def get_upstream_stations(origin_station)\n\t\t\n\t\tstarting_station = Bartstation.where(\"short_name = '#{origin_station}'\").pluck(\"id\")[0]\n\t\t\n\t\t# Find all the instances of the starting station\n\t\t# The station may appear on multiple routes\n\t\t\n\t\tstation_routes = {}\n\t\t\n\t\tBartroutestation.where(\"bartstation_id = #{starting_station}\").each do |routestation|\n\t\t\t\tstation_routes[routestation.bartroute_id] = routestation.route_station_sequence\n\t\tend\n\n\t\t# For each route that has the starting station:\n\t\t# Find the starting station \n\t\t# Find the next 5 stations in the reverse direction\n\t\t# (The stations are sequenced in the database to increment from the east \n\t\t# bay direction)\n\n\t\tupstream_stations = {}\n\t\tstation_routes.each do |station_route,station_sequence|\n\t\t\tbartroute_id = station_route\n\t\t\tbartstation_sequence = station_sequence\t\t\t\n\t\t\tupstream_stations[bartroute_id] = \n\t\t\t\tBartroutestation.where(\"bartroute_id = #{bartroute_id} AND \n\t\t\t\t\troute_station_sequence >= #{bartstation_sequence}\").order('route_station_sequence').take(6)\n\t\tend\n\n\t\t# Return the list of upstream stations for each route from the origin station\n\n\t\treturn upstream_stations\n\n\tend", "def station_codes\n [@attrs['StationCode1'], @attrs['StationCode2']].compact\n end", "def line6_stations \n puts \"The list of stations for line 6: \"\n puts \"[0] - Grand Central\"\n puts \"[1] - 33rd\"\n puts \"[2] - 28th\"\n puts \"[3] - 23rd\"\n puts \"[4] - Union Square\"\n puts \"[5] - Astor Place\"\nend", "def list_trains_on_station\n if @trains.empty? || @stations.empty?\n trains_or_stations_void\n else\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n check_the_trains(station)\n end\n end", "def index\n @railway_stations = RailwayStation.all\n end", "def station(code)\n Station.get(code)\n end", "def regional_sitelist\n query('txt/wxfcs/regionalforecast/json/sitelist')\n end", "def find_station_lines(station) #calling the relationship between the station and the station line\n station.station_lines\n end", "def show_trains_by_station\n if @stations.empty?\n stations_void\n else\n request = [\"Enter station name: [#{@stations.keys.join(', ')}]: \"]\n getting(request, :approve_station_selection, :show_train)\n end\n end", "def lines_at_station(station)\r\n line_array = Array.new\r\n\r\n lines.each {|lines, stations|\r\n stations.each {|x| \r\n if x == station\r\n line_array.push(lines)\r\n end \r\n } \r\n }\r\n\r\n return line_array\r\n end", "def index\n @main_stations = MainStation.all\n end", "def nationalparks_sitelist\n query('txt/wxfcs/nationalpark/json/sitelist')\n end", "def get_all_addresses\n response = []\n\n CSV.foreach(FILE_NAME) do |row|\n response << row[0]\n end\n\n response\nend", "def load_imported_sites\n arr = Array.new\n CSV.foreach(file.path, headers: true) do |row|\n site = Site.find_by_code(row[\"code\"]) || Site.new\n\n site.build_address if site.address.nil?\n site.build_partner if site.partner.nil?\n site.build_audit if site.audit.nil?\n\n site.attributes = row.to_hash.slice(*Site.accessible_attributes)\n\n site.address.attributes = row.to_hash.dup.inject({}) do |result, (k, v)|\n result[k.gsub(/^address_/,'')] = v if k.start_with?('address_')\n result\n end\n\n site.partner.attributes = row.to_hash.dup.inject({}) do |result, (k, v)|\n result[k.gsub(/^partner_/,'')] = v if k.start_with?('partner_')\n result\n end\n\n site.audit.attributes = row.to_hash.dup.inject({}) do |result, (k, v)|\n result[k.gsub(/^audit_/,'')] = v if k.start_with?('audit_')\n result\n end\n\n sector_attributes = row.to_hash.dup.inject({site_id: site.id}) do |result, (k, v)|\n result[k.gsub(/^sector_/,'')] = v if k.start_with?('sector_')\n result\n end\n\n s = site.sectors.where(\"site_id = ? AND code = ?\", site.id, sector_attributes[\"code\"]).first\n if s.nil?\n s = site.sectors.build(sector_attributes)\n else\n s.attributes = sector_attributes\n end\n\n antenna_attributes = row.to_hash.dup.inject({sector_id: s.id}) do |result, (k, v)|\n result[k.gsub(/^antenna_/,'')] = v if k.start_with?('antenna_')\n result\n end\n\n a = s.antennas.where(\"sector_id = ? AND id = ?\", s.id, antenna_attributes[\"id\"]).first\n if a.nil?\n s.antennas.build(antenna_attributes)\n else\n a.attributes = antenna_attributes\n end\n\n\n arr.push(site)\n end\n arr\n end", "def fetch_students\n @students = []\n CSV.foreach('data/students_info.csv', headers: true, col_sep: ',') do |row|\n @students << { name: row['name'], detention: row['detention'], tt_path: row['tt_path'] }\n end\n end", "def extract_station(url, state)\n\n id, json_url = nil\n\n doc = Nokogiri::HTML(open(\"#{Global::BOM_BASE_URL}#{url}\"))\n doc.css('a').each do |l|\n\n if l.attr('href').include?('json')\n json_url = l.attr('href')\n id = l.attr('href').split('.')\n id = id[1]\n end\n\n end\n\n begin\n station = Station.find(id)\n scraper_logger.info(\"Updating existing station #{id}\")\n\n rescue\n station = Station.new\n station.id = id\n scraper_logger.info(\"Creating new station #{id}\")\n\n end\n\n begin\n station.state = state\n\n name = doc.css('h1').first\n station.name = name.text.gsub('Latest Weather Observations for ','')\n\n station.station_url = \"#{Global::BOM_BASE_URL}#{url}\"\n station.json_url = \"#{Global::BOM_BASE_URL}#{json_url}\"\n\n json = extract_observations(station.json_url)\n station.latitude = json['observations']['data'].first['lat']\n station.longitude = json['observations']['data'].first['lon']\n\n tz = Timezone.where(abbreviation: json['observations']['header'].first['time_zone'])\n if tz.size > 0\n station.timezone = tz.first\n station.save\n\n scraper_logger.info(\"#{station.id} - #{station.name} has been saved\")\n\n else\n scraper_logger.warn(\"#{station.id} - #{station.name} could not be saved due to unknown TZ (#{json['observations']['header'].first['time_zone']})\")\n\n end\n\n rescue\n scraper_logger.warn(\"#{station.id} - #{station.name} could not be saved due missing data in JSON file)\")\n\n end\n \n end", "def update_station_list\n log('This script overwrites your local copy of config/stations.yml with the latest data from nationalrail.co.uk and '\\\n 'railwaycodes.org.uk')\n log('Press [ENTER] to continue or [Ctrl+c] to quit')\n gets\n # Fetch data from the web\n stations = fetch_stations\n locations = fetch_locations\n # Add location data to the current active station list\n stations.each { |crs, data| data.merge!(locations[crs]) if locations[crs] }\n write_yaml(stations)\n log('Your station list has been updated')\nend", "def go_through_all_the_lines(url)\n list = CSV.read(url)\nend", "def routes_list\n Route.all.each.with_index(1) do |(route), index|\n puts \"#{index}. Маршрут: #{route.stations.first.name} - #{route.stations.last.name}\"\n end\n end", "def get_msan_csv_list\n filename = '../config/msan_alternative_imput.csv'\n result = []\n\n # The [1 .. -1] argument bypass the head row\n CSV.read(filename, 'r', col_sep: ';')[1..-1].each do |row|\n result << { model: row[0], dms_id: row[1], rin: row[2], ip: row[3] }\n end\n\n result\n end", "def index\n @asos_stations = AsosStation.all\n end", "def find_station(input) #grab their input to find their station\n Station.find_by(stations: input)\n end", "def sanitize_station(path)\n data = CSV.open(path, headers: true, header_converters: :symbol)\n\n data.map do |row|\n # binding.pry\n {\n :id => row[:id],\n :name => row[:name],\n :dock_count => row[:dock_count].to_i,\n :city => row[:city],\n :date => row[:installation_date] # Should we make this an integer for calcs?\n }\n end\n end", "def getSeas()\n puts \" getting sea forecasts\"\n html = Net::HTTP.get(UrlHost, \"#{UrlPath}/#{@uri}\")\n \n #------------------------------------------------------------------\n # extract the juicy center\n #------------------------------------------------------------------\n prePattern = %r{<PRE>(.*)</PRE>}m\n match = prePattern.match(html)\n if (!match)\n @seas = \"<p>Unable to parse sea forecast.</p>\"\n return\n end\n \n html = match[1]\n \n #------------------------------------------------------------------\n # split the file at bolded terms; this will give us header/body/header/...\n #------------------------------------------------------------------\n sections = html.split(%r{<B>|</B>})\n\n #------------------------------------------------------------------\n # remove all the initial sections until we have a known header\n #------------------------------------------------------------------\n firstPattern = %r{<FONT .* COLOR=\"#800000\">}\n while (!firstPattern.match(sections.first))\n sections.shift\n end\n\n #------------------------------------------------------------------\n # now build the table, one row per 'day'\n #------------------------------------------------------------------\n html = \"\\n<table>\\n\"\n while (!sections.empty?)\n header, body, *sections = sections\n\n header.gsub!(%r{<.*?>},'')\n\n header = header.downcase.strip\n body = body.downcase.strip\n body = getWaveInfo(body)\n\n header = header.gsub(\" \",\"&nbsp;\")\n \n next if header.include?(\"night\")\n\n html += \"<tr><td><b>#{header}</b></td><td>&nbsp;&nbsp;</td><td>#{body}</tr>\\n\"\n end\n \n @seas = \"#{html}</table>\\n\"\n end", "def index\n @set_stations = SetStation.all\n end", "def station_info\n\t\tarray = JSON.parse(response.body)\n\t\tarray.each do |station_info| \n\t\t\tif station_info[\"borough\"] == \"Manhattan\"\n\t\t\t\tputs \"Facility Name:\"\n\t\t\t\tputs station_info[\"facilityname\"]\n\t\t\t\tputs \"Facility Address:\"\n\t\t\t\tputs station_info[\"facilityaddress\"]\n\t\t\t\tputs \"Borough:\"\n\t\t\t\tputs station_info[\"borough\"]\n\t\t\t\tputs \"-------------------\"\n\t\t\tend\n\t\tend\n\tend", "def find_user_stations\n stations = profile_user.stations.all(:limit => 5, :include => [:abstract_station])\n artist_ids = stations.map{|s| s.abstract_station.artist_id}\n Artist.find_all_by_id artist_ids\n rescue\n end", "def list_of_trains_based_on_direction\n #put puts a list of train stations based on the rail line chosen\n list_stations_from_direction(@get_line)\n\n #receives the input from user to select from an available list of stations based on a rail line\n get_station = gets.strip.to_i\n\n if !get_station.between?(1, @station.length)\n puts \"Lets try this again:\"\n list_of_trains_based_on_direction\n else\n list_trains_from_station_and_dir(get_station)\n end\n end", "def info\n puts \"All stations:\"\n @stations.each.with_index(1) do |station|\n puts \"#{station.name}: \"\n station.show_trains(\"Cargo\")\n station.show_trains(\"Passenger\")\n end\n\n puts \"All routes:\"\n show_routes\n puts \"All trains:\"\n show_trains\n puts \"All wagons:\"\n show_wagons\n end", "def index\n @fire_stations = FireStation.all\n end", "def index\n @tollstations = Tollstation.all\n end", "def getRoutesFrom(station)\n routeList = @fromNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end", "def lineN_stations \n puts \"The list of stations for line N: \"\n puts \"[0] - Time Square\"\n puts \"[1] - 34th\"\n puts \"[2] - 28th\"\n puts \"[3] - 23rd\"\n puts \"[4] - Union Square\"\n puts \"[5] - 8th\"\nend", "def get_trainer_team_stations(uri)\n sparql = \"SELECT DISTINCT ?uri ?career_station_uri ?years ?team_uri ?clubname ?name ?nickname ?label ?altname\n WHERE {\n {\n ?uri <http://dbpedia.org/ontology/careerStation> ?career_station_uri .\n <#{uri}> <http://dbpedia.org/ontology/careerStation> ?career_station_uri .\n ?career_station_uri <http://dbpedia.org/ontology/years> ?years .\n ?career_station_uri <http://dbpedia.org/ontology/team> ?team_uri .\n OPTIONAL { ?team_uri <http://dbpedia.org/property/clubname> ?clubname . FILTER(LANG(?clubname) = 'en')}.\n OPTIONAL { ?team_uri <http://dbpedia.org/property/nickname> ?nickname . FILTER(LANG(?nickname) = 'en')}.\n OPTIONAL { ?team_uri <http://xmlns.com/foaf/0.1/name> ?name . FILTER(LANG(?name) = 'en')}.\n OPTIONAL { ?team_uri <#{RDF::RDFS.label}> ?label . FILTER(LANG(?label) = 'en') }.\n OPTIONAL { ?team_uri <http://dbpedia.org/property/fullname> ?altname . FILTER(LANG(?altname) = 'en') }.\n }\n }\n ORDER BY DESC(?years)\"\n solutions = DBPEDIA.query(sparql)\n # do uniq\n Hash[solutions.reverse.map { |sol| [sol.career_station_uri.to_s, sol] }].values.reverse\n end", "def station\n @station ||= Station.get(station_codes.first)\n end", "def getMinivanTestFile(url)\n\tarray_of_records = []\n\tinput_csv = open(url)\n\twhile !input_csv.eof?\n\t\tline = input_csv.readline.delete(\"\\n\")\n\t\tarray_of_records.push(line.split(',')[1..-1])\n\tend\n\treturn array_of_records\nend", "def plan_trip (first_l, first_s, last_l, last_s)\n# Get the program to work for a single line:\n# Different way to do global use $\n stations = [ ]\n start = $train_lines[first_l.to_s].index(first_s.to_s)\n finish = $train_lines[last_l.to_s].index(last_s.to_s)\n\n# 2.7.2 :012 > $train_lines.values\n# => [[\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"], [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]]\n# 2.7.2 :013 > $train_lines.keys\n# => [\"lineN\", \"lineL\", \"line6\"]\n\n if start < finish\n stations = $lineN[start..finish]\n elsif\n stations = $lineN[finish..start].reverse\n end\n\n return stations\n\nend", "def station\n @station ||= Station.get(@attrs['StationCode'])\n end", "def for_station(station_key)\n # STATIONS[station_key] can return either an array of RO keys or a single RO key\n [STATIONS[station_key]]\n .flatten\n .map(&RegionalOffice.method(:find!))\n end", "def index\n @police_stations = PoliceStation.all\n end", "def find_stations(&blk)\n sectors.inject([]) do |a, e|\n a.push(*e.stations.select(&(blk || TRUEBLOCK)))\n end\n end", "def show\n @courier_stations = CourierStation.find_by_sql [\"SELECT cs.id, cs.courier_id, cs.station_id, cs.status, cs.created_at, cs.updated_at, s.station_name, c.courier_name FROM courier_stations cs, couriers c, stations s WHERE cs.courier_id = c.id AND cs.station_id = s.id AND cs.id = ?\", params[:id]]\n end", "def get_stations(array)\n origin = array[0].scan(/\\b[a-z][\\w\\s\\/]+/i)[0].split.map(&:capitalize)*' '\n destination = array[1].scan(/\\b[a-z][\\w\\s\\/]+/i)[0].split.map(&:capitalize)*' '\n origin.sub!(/[\\/]+[A-Za-z]+/){ $&.upcase }\n destination.sub!(/([\\/])\\w+/){ $&.upcase }\n origin.sub!(/(?: *town)/i, \"town\")\n destination.sub!(/(?: *town)/i, \"town\")\n\n # TODO: search our @@routes hash for the origin and destination, kick out if either invalid\n set_routes(origin, destination)\n end", "def nearby_station_ids\n @nearby_station_ids ||= self.nearby_stations.map { |s| s['id'] }\n end", "def stations_status(options={})\n get(stations_path, options.merge(:updateOnly => true))\n end", "def get_station_data(qty = 10)\n filter = { zip: @zip, limit: qty}\n EnergyService.new(filter).get_stations[:fuel_stations]\n end", "def selectInStationDB(lat, long)\n\t\t\tstationArray = Array.new()\n\t\t\tSQLite3::Database.open( @filePath + \"stationDB.db\" ) do |db|\n\t\t \t\tdb.execute( \"SELECT stationID, GeoBreite, GeoLaenge FROM stations as distance\n\t\t \t\twhere #{@element.gsub(/\\s+/, \"\").gsub('oe','ö')} = 1 \n\t\t \t\tand StartDate <= '#{@start_date}' and EndDate >= '#{@end_date}'\n\t\t \t\tORDER BY ABS((#{lat} - GeoBreite)*(#{lat} - GeoBreite)) +\n\t\t \t\tABS((#{long} - GeoLaenge)*(#{long} - GeoLaenge)) ASC LIMIT 250;\" ) do |row|\n\t\t \t\tstationArray.insert(0, row)\n\t\t \t\tend\n\t\t\tend\n\t\treturn stationArray\n\tend", "def next_station\n if @index + 1 != @stations.size\n @stations[@index + 1]\n else\n 'Это последняя станция'\n end\n end", "def get_station_tracks(station_id, number_of_tracks = 25, recently_played = [])\n url = 'radio/stationfeed'\n options = {\n query: {'alt': 'json', 'include-tracks': 'true', 'tier': 'aa', 'hl': 'en_US'},\n headers: {'Content-Type': 'application/json'},\n body: {'contentFilter': 1,\n 'stations': [\n {\n 'numEntries': number_of_tracks,\n 'recentlyPlayed': recently_played.map { |rec| add_track_type rec},\n 'seed': { \n \"#{get_typename_from_id(station_id)}\": station_id, \n 'kind': 'sj#radioSeed', \n 'seedType': get_seed_type_from_id(station_id)\n }\n }\n ]}.to_json\n }\n\n res = make_post_request(url, options)\n return res['data']['stations']\n end", "def city_scraper\n #Id,Id2,Geography,Target Geo Id,Target Geo Id2,Geographical Area,Geographical Area,,,Total area,Water area,Land area,Population,Housing units\n #0400000US01,01,Alabama,1600000US0107000,0107000,\"Alabama - PLACE - Birmingham city, Alabama\",\"Birmingham city, Alabama\",242820,111927,151.95,2.04,149.92,1619.7,746.6\n # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 \n @states = Array.new\n @cities = Array.new\n \n count = 0\n state_name = \"\"\n CSV.foreach(\"data/DEC_10_SF1_GCTPH1.ST13.csv\") do |row|\n count = count + 1\n city_name = \"\"\n population = 0\n elevation = 0\n lat_dir = \"\"\n lat_deg = 0\n lat_min = 0\n lat_sec = 0\n lon_dir = \"\"\n lon_deg = 0\n lon_min = 0\n lon_sec = 0\n if(row[2] == row[5])\n #its a state\n puts \"State: #{row[2]}\"\n state_name = row[2]\n state = State.new(:name => row[2])\n if(@states.length == 51)\n break\n end\n @states << state\n next\n end\n \n geographical_area = CSV.parse(row[6])\n city_name = geographical_area[0][0]\n if(city_name.match(/(part)/))\n #puts \"skipping #{city_name}\"\n next\n end\n \n city_name = city_name.downcase.gsub(/ city/,'').gsub(/ town/,'').gsub(/ village/,'').gsub(/ cdp/,'').gsub(/ borough/,'').gsub(/ municipality/,'').gsub(/ and/,'')\n city_name.strip.capitalize!\n city_name = city_name.capitalize\n #puts \"#{city_name} #{count}\"\n \n city_name_uri = URI.escape(city_name, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n state_name_uri = URI.escape(state_name, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n city_html = Net::HTTP.get(URI.parse(\"http://www.geonames.org/search.html?q=#{city_name_uri}%2C+#{state_name_uri}&country=US\"))\n #puts \"http://www.geonames.org/search.html?q=#{city_name}%2C+#{state_name}&country=US\"\n @city_doc = Hpricot(city_html)\n \n @city_doc.search(\"//table[@class='restable']\") do |table|\n tr_count = 0\n table.search(\"//tr\") do |tr|\n #puts \"in tr search\"\n tr_count = tr_count + 1\n if(tr_count < 3)\n next\n end\n #puts \"in tr search 2\"\n td_count = 0\n tr.search(\"//td\") do |td|\n #puts \"in td search\"\n td_count = td_count + 1\n if(td_count < 4)\n next\n end\n if(td_count == 4)\n td.search(\"//small\") do |small|\n #population = \"#{small.match(/\\\\d+/)[1]}\"\n #puts \"!!!!!!!!!!!!!!!!!!\"\n #puts td_count\n #puts \"#{small.inner_html}\"\n #puts \"!!!!!!!!!!!!!!!!!!\"\n pop_elev = small.inner_html\n #population = \"#{pop_elev.match(/\\d+,\\d*/)}\".gsub(/,/,'')\n elevation = \"#{pop_elev.match(/\\d+m/)}\".gsub(/m/,'')\n #puts population\n #puts elevation\n end\n end\n if(td_count == 5)\n lat_dir = td.inner_html[0]\n matches = td.inner_html.scan(/(\\d+)/)\n lat_deg = matches[0][0]\n lat_min = matches[1][0]\n lat_sec = matches[2][0]\n end\n if(td_count == 6)\n lon_dir = td.inner_html[0]\n matches = td.inner_html.scan(/(\\d+)/)\n lon_deg = matches[0][0]\n lon_min = matches[1][0]\n lon_sec = matches[2][0]\n end\n end\n break\n \n end \n end\n city = City.new(\n :name => city_name,\n :states_id => @states.length,\n :total_area => row[9],\n :water_area => row[10],\n :land_area => row[11],\n :population => row[7],\n :population_density => row[12],\n :lat_deg => lat_deg,\n :lat_min => lat_min,\n :lat_sec => lat_sec,\n :lat_dir => lat_dir,\n :lon_deg => lon_deg, \n :lon_min => lon_min,\n :lon_sec => lon_sec,\n :lon_dir => lon_dir,\n :elevation => elevation)\n \n @cities << city\n if(count % 10 == 0)\n puts count\n end\n end\n \n @states.each do |state|\n state.save\n end\n \n @cities.each do |state|\n state.save\n end\n \n end", "def student_list\n file = File.open('student_directory.csv', 'r')\n file.readlines.each do |student|\n puts student\n end\n file.close\n set_menu\nend", "def plan_trip (first_s, last_s)\n stations = []\n beginning = $lineN.index(first_s.to_s)\n ending = $lineN.index(last_s.to_s)\n this_many = beginning + ending\n stations = $lineN[beginning, this_many]\n return stations\nend", "def download_local\n nsd_cccc = Metar::Station.download_stations\n File.open(Metar::Station.local_nsd_path, 'w') do |fil|\n fil.write nsd_cccc\n end\n end", "def updateStation()\n uri=URI.parse(ViaggiatrenoURLs.STATION_INFO)\n response = Net::HTTP.post_form(uri,{\"stazione\" => @stationFrom, \"lang\" => \"IT\"})\n doc = Nokogiri::HTML(response.body)\n\n doc.xpath(XPathMatchInfo.XPATH_STATION).each do |x|\n \n StringUtils.remove_newlines_tabs_and_spaces(x)\n\n train_number_complete = x.xpath(XPathMatchInfo.XPATH_TRAIN_NUMBER()).to_s\n train_destination = x.xpath(XPathMatchInfo.XPATH_TRAIN_DESTINATION()).to_s\n train_schedule =x.xpath(XPathMatchInfo.XPATH_TRAIN_SCHEDULED()).to_s\n train_description = \"#{train_number_complete} #{train_destination} #{train_schedule}\"\n \n train_number=train_number_complete.match(\"[0-9]+\")[0]\n \n @trains[train_number]=train_description\n @destinations.push(train_destination)\n ### TODO #### #@trains[train_number][description]=train_description\n end\n end", "def loci\n CSV.read(@file).map do |row|\n {\n :name => row[@columns[:name]],\n :target => row[@columns[:target]],\n :strand => STRAND_TOKENS[row[@columns[:strand]]],\n :start => row[@columns[:start]].to_i - 1, # This arithmetic gives\n :stop => row[@columns[:stop]].to_i, # inclusive, one-indexed\n # slices\n }\n end\n end", "def current_station_index\n @route.stations.find_index(@current_station)\n end", "def getLocations\n # create locations table\n locations = Array.new\n \n # turn page into Nokogiri object\n parsed_page = Nokogiri::HTML(@page)\n\n # get table of drop info from page\n locations = parsed_page.css(\"#mw-content-text\").css(\"ul\").css(\"li\").css(\"a\").children.map { |r| r.text }\n\n # prints table for debugging\n# puts(\"table = #{locations}\")\n\n # save locations globally\n @locations = locations\n end", "def generate_stations\n\t\n\t\tcase @inputs.generation_method\n\t\twhen 'Centroïd'\n\t\n\t\t\tnbStationsInsideCentroid = Integer(@inputs.nb_stations * (@inputs.centroid_density.to_f / 100))\n\t\t\n\t\t\t(1..@inputs.nb_stations).each do |id|\n\t\t\t\n\t\t\t\tstation = CS_station.new(id)\n\t\t\t\t\n\t\t\t\tstation.insideCentroid = (id <= nbStationsInsideCentroid)\n\t\t\t\tstation.maxSize = Random.rand(@inputs.parking_range_L..@inputs.parking_range_U)\n\t\t\n\t\t\t\tif(station.insideCentroid)\n\t\t\t\t\tstation.xPos, station.yPos = generateCoords(\"inside\")\n\t\t\t\t\t@list_stations_insideCentroid.push(station)\n\t\t\t\telse\n\t\t\t\t\tstation.xPos, station.yPos = generateCoords(\"outside\")\n\t\t\t\t\t@list_stations_outsideCentroid.push(station)\n\t\t\t\tend\n\t\t\t\t@list_stations.push(station)\n\t\t\t\t\n\t\t\tend\n\t\twhen 'Uniform'\n\t\telse \n\t\tend\n\tend", "def index\n @train_routes = TrainRoute.includes(:departure_station, :arrival_station).all\n byebug\n end", "def find(id)\n stations.find { |station| station.id == id }\n end", "def observations(stations, lang = 'is', time = '1h', anytime = '0')\n Apis.client.get(\"/weather/forecasts/#{lang}\" \\\n \"/?stations=#{stations.join(',')}&time=#{time}&anytime=#{anytime}\")\n end", "def load_students(filename = \"students.csv\")\n file = File.open(filename, \"r\")\n file.readlines.each do |line|\n name, cohort, hobby, country = line.chomp.split(\",\")\n add_student_to_array(name, cohort, hobby, country)\n end\n file.close\nend", "def get_all_countries\n puts \"collecting countries infomation..\"\n f1 = open(@CIA_URL)\n doc = Nokogiri::HTML(f1)\n open('countries.txt', 'wb') do |file|\n file << open(@CIA_URL)\n end\n doc.css(\"ul#GetAppendix_TextVersion li a\").each do |item|\n country_name = item.text\n next if country_name == \"World\" or country_name == \"European Union\" or country_name == \"Antarctica\"\n country_url = @CIA_URL\n new_url = (country_url.split('/')[0..-2]).join('/')\n country_url = new_url << '/' << item['href']\n puts \"#{country_name}\"\n f = open(country_url)\n doc = f.read()\n f.close()\n country = CountryInfo.new(country_name, country_url, doc)\n continent = get_continent(doc)\n if continent != nil\n continent.downcase!\n @country_lists[continent] += [country]\n end\n \n end\n # helper_save\n puts \"========================================================================\"\n puts \"========================================================================\"\n puts \"==============================start parsing=============================\"\n puts \"========================================================================\"\n puts \"========================================================================\"\n end", "def index\n @recordingstations = Recordingstation.all\n end", "def fetch_locations\n log(' - Fetching location data (takes ~25s)...', false)\n results = {}\n ('a'..'z').to_a.each do |letter|\n response = get_response(\"http://www.railwaycodes.org.uk/stations/station#{letter}.shtm\")\n Nokogiri::HTML(response).xpath('//table/tr').each do |row|\n cols = row.xpath('./td').map(&:text)\n crs = row.xpath('./td').first.xpath('./a').first['name'].upcase rescue nil\n unless [crs, cols[6], cols[7]].include?(nil) || [crs, cols[6], cols[7]].include?('')\n results[crs] = { latitude: cols[7].to_f, longitude: cols[6].to_f }\n end\n end\n sleep(1) # be nice to railwaycodes.org.uk\n end\n log('DONE')\n results\nend", "def index\n @station_dailies = StationDaily.all\n end", "def show\n @stid = @day_road_listid.station\n @stname = Station.find(@stid)\n @stn = @stname.name\n end", "def get_city_list\r\n url = \r\n page = Nokogiri::HTML(URI.open('http://annuaire-des-mairies.com/val-d-oise.html'))\r\n citys = page.css('a.lientxt[href]').each {|city| @citys_list << city.text.downcase.gsub(' ', '-')}\r\nend", "def get_zips\n zips = CSV.read('./zips.csv', :headers => true)\n return zips\nend" ]
[ "0.74480873", "0.69337845", "0.6796676", "0.6729238", "0.67204165", "0.67038745", "0.65798676", "0.64318585", "0.6427037", "0.63155234", "0.6304272", "0.6202676", "0.615029", "0.6125535", "0.6075097", "0.6074721", "0.6069872", "0.58857256", "0.5827722", "0.58218485", "0.5804868", "0.5802495", "0.5784393", "0.57688737", "0.57502687", "0.5740234", "0.56858283", "0.5679713", "0.56710374", "0.56538427", "0.56505406", "0.56274325", "0.56217855", "0.5611575", "0.55932707", "0.559058", "0.55631965", "0.55574423", "0.5533206", "0.55261713", "0.5514623", "0.5512344", "0.54928774", "0.54889655", "0.548669", "0.54720575", "0.54619455", "0.5452486", "0.54516596", "0.54389817", "0.5416213", "0.5394068", "0.53911006", "0.53828835", "0.5373927", "0.5368969", "0.5368539", "0.5349802", "0.53366935", "0.5331417", "0.5317275", "0.5307777", "0.5292997", "0.5286611", "0.5271914", "0.52691513", "0.5260717", "0.52524644", "0.52365553", "0.52364266", "0.5233025", "0.5226055", "0.5224581", "0.5215161", "0.52112716", "0.51977086", "0.5187325", "0.5185805", "0.51857007", "0.51834685", "0.5182994", "0.51812446", "0.51795256", "0.5178665", "0.5177342", "0.5173695", "0.51735306", "0.5148627", "0.5142288", "0.51420903", "0.51393163", "0.5138578", "0.51351726", "0.5134867", "0.5133904", "0.51182693", "0.5105131", "0.51033384", "0.50995106", "0.5098608" ]
0.74827105
0
Scrapes location data for stations from the railwaycodes.org.uk website
def fetch_locations log(' - Fetching location data (takes ~25s)...', false) results = {} ('a'..'z').to_a.each do |letter| response = get_response("http://www.railwaycodes.org.uk/stations/station#{letter}.shtm") Nokogiri::HTML(response).xpath('//table/tr').each do |row| cols = row.xpath('./td').map(&:text) crs = row.xpath('./td').first.xpath('./a').first['name'].upcase rescue nil unless [crs, cols[6], cols[7]].include?(nil) || [crs, cols[6], cols[7]].include?('') results[crs] = { latitude: cols[7].to_f, longitude: cols[6].to_f } end end sleep(1) # be nice to railwaycodes.org.uk end log('DONE') results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_stations\n log(' - Fetching station list...', false)\n results = {}\n response = get_response('https://www.nationalrail.co.uk/static/documents/content/station_codes.csv')\n CSV.new(response, headers: true).each do |row|\n results[row['CRS Code']] ||= {}\n results[row['CRS Code']][:name] = row['Station Name']\n end\n log('DONE')\n results\nend", "def fetch_stations(state)\n\n scraper_logger.info(\"Fetching stations for #{state.name}\")\n\n doc = Nokogiri::HTML(open(state.url))\n doc.css('a').each do |s|\n\n Global::OBSERVATION_PRODUCT_CODE.each do |c|\n if s.attr('href').include?(c) and s.attr('href').include?(state.product_group)\n extract_station(s.attr('href'), state)\n end\n end\n\n end\n\n scraper_logger.info(\"Completed fetching stations for #{state.name}\")\n\n end", "def get_by_location\n \tlat = params[:lat]\n \tlng = params[:lng]\n \tnext_start = params[:next_start]\n \tshops = Hotpepper.search_location(lat, lng, next_start);\n \tset_to_results(shops);\n end", "def load_station_data\n data = Net::HTTP.get(URI.parse(stations_url))\n JSON.parse(data)[\"result\"]\n end", "def getLocations\n # create locations table\n locations = Array.new\n \n # turn page into Nokogiri object\n parsed_page = Nokogiri::HTML(@page)\n\n # get table of drop info from page\n locations = parsed_page.css(\"#mw-content-text\").css(\"ul\").css(\"li\").css(\"a\").children.map { |r| r.text }\n\n # prints table for debugging\n# puts(\"table = #{locations}\")\n\n # save locations globally\n @locations = locations\n end", "def yahoo_loc_search(loc)\n return [loc] if loc =~ /\\d/ #places usually don't have numbers in their names\n locs = []\n open(\"http://weather.yahoo.com/search/weather2?p=#{URI.escape(loc)}\") do |http|\n return [$1] if http.base_uri.to_s =~ LOC_MATCH\n http.each {|line| locs << $1 if line =~ LOC_MATCH }\n end\n locs\nend", "def scrapeAirBNB(location=\"\", pmin=\"\", pmax=\"\", indate=\"\", outdate=\"\", bednum=\"\")\n\n\t\turl = \"https://www.airbnb.com/s/hong-kong/homes?hosting_amenities%5B%5D=6\"\n\t\tif location != \"\"\n\t\t\turl = \"https://www.airbnb.com/s/#{location}/homes?hosting_amenities%5B%5D=6\"\n\t\tend\n\t\tif pmin != \"\"\n\t\t\turl << \"&price_min=#{pmin}\"\n\t\tend\n\t\tif pmax != \"\"\n\t\t\turl << \"&price_max=#{pmax}\"\n\t\tend\n\t\tif indate != \"\"\n\t\t\turl << \"&checkin=#{indate}\"\n\t\tend\n\t\tif outdate != \"\"\n\t\t\turl << \"&checkout=#{outdate}\"\n\t\tend\n\t\tif bednum != \"\"\n\t\t\turl << \"&adults=#{bednum}\"\n\t\tend\t\n\t\tputs url\n\n\t\ttitle = []\n\t\tprice = [] \n\t\troomtype = []\n\t\tbedno = []\n\t\tlinks = []\n\n\t\trating = []\n\t\tlocation = [] #e.g. central, tst, mong kok, disneyland, etc\t\n\n\t\t#information = [title, price, roomtype, bedno]\n\n\n\t\tpage = Nokogiri::HTML(open(url))\n\n\t\ta_tag = page.at('a')\n\t\tlink = a_tag.attributes[\"href\"].value\n\t\t#handles title and price\n\t\tcounter = 1\n\t\tpage.css(\"span.text_5mbkop-o_O-size_small_1gg2mc-o_O-weight_bold_153t78d-o_O-inline_g86r3e\").each do |line|\n\t\t\tif (counter+1) % 3 == 0\n\t\t\t\tprice << line.text.strip.delete(\"Price\")\t\t\t\n\t\t\t\tcounter += 1\n\t\t\telsif (counter+0) % 3 == 0\n\t\t\t\tcounter += 1\n\t\t\telsif (counter-1) % 3 == 0\n\t\t\t\ttitle << line.text.strip\n\t\t\t\tcounter += 1\n\t\t\tend\n\t\tend\n\n\t\t#Handles room type and number of beds\n\t\tcounter = 1\n\t\tpage.css(\"span.detailWithoutWrap_j1kt73\").each do |line|\n\t\t\tif (counter) % 2 == 1\n\t\t\t\troomtype << line.text.strip\n\t\t\t\tcounter += 1\n\t\t\telsif (counter) % 2 == 0\n\t\t\t\tbedno << line.text.strip\n\t\t\t\tcounter += 1\n\t\t\tend\n\t\tend\n\n\t\t#handles links\n\t\tcounter = 1\n\t\tpage.css('a').each do |line|\t\t\n\t\t\tif line.attributes[\"href\"].value[0..3] == \"/roo\" && counter % 2 == 0\n\t\t\t\tlinks << \"https://www.airbnb.com\" + line.attributes[\"href\"].value\n\t\t\t\tcounter += 1\n\t\t\telse\n\t\t\t\tcounter += 1\n\t\t\tend\n\t\tend\n\n\t\t#Creates CSV files\n\t\tCSV.open(\"airbnb_listings.csv\", \"w\") do |file|\n\t\t\tfile << [\"Title\", \"Price\", \"Room Type\", \"No. Beds\", \"Link\", \"Location\"]\n\t\t\tprice.length.times do |i|\n\t\t\t\tfile << [title[i], price[i], roomtype[i], bedno[i], links[i], location[i]]\n\t\t\tend\n\t\tend\n\n\t\t#Creates JSON\n\t\textracted_data = CSV.table('airbnb_listings.csv')\n\t\ttransformed_data = extracted_data.map { |row| row.to_hash }\n\t\tFile.open('airbnb.json', 'w') do |file|\n\t \t\tfile.puts JSON.pretty_generate(transformed_data)\n\t\tend\n\tend", "def extract_station(url, state)\n\n id, json_url = nil\n\n doc = Nokogiri::HTML(open(\"#{Global::BOM_BASE_URL}#{url}\"))\n doc.css('a').each do |l|\n\n if l.attr('href').include?('json')\n json_url = l.attr('href')\n id = l.attr('href').split('.')\n id = id[1]\n end\n\n end\n\n begin\n station = Station.find(id)\n scraper_logger.info(\"Updating existing station #{id}\")\n\n rescue\n station = Station.new\n station.id = id\n scraper_logger.info(\"Creating new station #{id}\")\n\n end\n\n begin\n station.state = state\n\n name = doc.css('h1').first\n station.name = name.text.gsub('Latest Weather Observations for ','')\n\n station.station_url = \"#{Global::BOM_BASE_URL}#{url}\"\n station.json_url = \"#{Global::BOM_BASE_URL}#{json_url}\"\n\n json = extract_observations(station.json_url)\n station.latitude = json['observations']['data'].first['lat']\n station.longitude = json['observations']['data'].first['lon']\n\n tz = Timezone.where(abbreviation: json['observations']['header'].first['time_zone'])\n if tz.size > 0\n station.timezone = tz.first\n station.save\n\n scraper_logger.info(\"#{station.id} - #{station.name} has been saved\")\n\n else\n scraper_logger.warn(\"#{station.id} - #{station.name} could not be saved due to unknown TZ (#{json['observations']['header'].first['time_zone']})\")\n\n end\n\n rescue\n scraper_logger.warn(\"#{station.id} - #{station.name} could not be saved due missing data in JSON file)\")\n\n end\n \n end", "def city_scraper\n #Id,Id2,Geography,Target Geo Id,Target Geo Id2,Geographical Area,Geographical Area,,,Total area,Water area,Land area,Population,Housing units\n #0400000US01,01,Alabama,1600000US0107000,0107000,\"Alabama - PLACE - Birmingham city, Alabama\",\"Birmingham city, Alabama\",242820,111927,151.95,2.04,149.92,1619.7,746.6\n # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 \n @states = Array.new\n @cities = Array.new\n \n count = 0\n state_name = \"\"\n CSV.foreach(\"data/DEC_10_SF1_GCTPH1.ST13.csv\") do |row|\n count = count + 1\n city_name = \"\"\n population = 0\n elevation = 0\n lat_dir = \"\"\n lat_deg = 0\n lat_min = 0\n lat_sec = 0\n lon_dir = \"\"\n lon_deg = 0\n lon_min = 0\n lon_sec = 0\n if(row[2] == row[5])\n #its a state\n puts \"State: #{row[2]}\"\n state_name = row[2]\n state = State.new(:name => row[2])\n if(@states.length == 51)\n break\n end\n @states << state\n next\n end\n \n geographical_area = CSV.parse(row[6])\n city_name = geographical_area[0][0]\n if(city_name.match(/(part)/))\n #puts \"skipping #{city_name}\"\n next\n end\n \n city_name = city_name.downcase.gsub(/ city/,'').gsub(/ town/,'').gsub(/ village/,'').gsub(/ cdp/,'').gsub(/ borough/,'').gsub(/ municipality/,'').gsub(/ and/,'')\n city_name.strip.capitalize!\n city_name = city_name.capitalize\n #puts \"#{city_name} #{count}\"\n \n city_name_uri = URI.escape(city_name, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n state_name_uri = URI.escape(state_name, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n city_html = Net::HTTP.get(URI.parse(\"http://www.geonames.org/search.html?q=#{city_name_uri}%2C+#{state_name_uri}&country=US\"))\n #puts \"http://www.geonames.org/search.html?q=#{city_name}%2C+#{state_name}&country=US\"\n @city_doc = Hpricot(city_html)\n \n @city_doc.search(\"//table[@class='restable']\") do |table|\n tr_count = 0\n table.search(\"//tr\") do |tr|\n #puts \"in tr search\"\n tr_count = tr_count + 1\n if(tr_count < 3)\n next\n end\n #puts \"in tr search 2\"\n td_count = 0\n tr.search(\"//td\") do |td|\n #puts \"in td search\"\n td_count = td_count + 1\n if(td_count < 4)\n next\n end\n if(td_count == 4)\n td.search(\"//small\") do |small|\n #population = \"#{small.match(/\\\\d+/)[1]}\"\n #puts \"!!!!!!!!!!!!!!!!!!\"\n #puts td_count\n #puts \"#{small.inner_html}\"\n #puts \"!!!!!!!!!!!!!!!!!!\"\n pop_elev = small.inner_html\n #population = \"#{pop_elev.match(/\\d+,\\d*/)}\".gsub(/,/,'')\n elevation = \"#{pop_elev.match(/\\d+m/)}\".gsub(/m/,'')\n #puts population\n #puts elevation\n end\n end\n if(td_count == 5)\n lat_dir = td.inner_html[0]\n matches = td.inner_html.scan(/(\\d+)/)\n lat_deg = matches[0][0]\n lat_min = matches[1][0]\n lat_sec = matches[2][0]\n end\n if(td_count == 6)\n lon_dir = td.inner_html[0]\n matches = td.inner_html.scan(/(\\d+)/)\n lon_deg = matches[0][0]\n lon_min = matches[1][0]\n lon_sec = matches[2][0]\n end\n end\n break\n \n end \n end\n city = City.new(\n :name => city_name,\n :states_id => @states.length,\n :total_area => row[9],\n :water_area => row[10],\n :land_area => row[11],\n :population => row[7],\n :population_density => row[12],\n :lat_deg => lat_deg,\n :lat_min => lat_min,\n :lat_sec => lat_sec,\n :lat_dir => lat_dir,\n :lon_deg => lon_deg, \n :lon_min => lon_min,\n :lon_sec => lon_sec,\n :lon_dir => lon_dir,\n :elevation => elevation)\n \n @cities << city\n if(count % 10 == 0)\n puts count\n end\n end\n \n @states.each do |state|\n state.save\n end\n \n @cities.each do |state|\n state.save\n end\n \n end", "def get_aditional_data\n require 'hpricot'\n require 'open-uri'\n doc = Hpricot(open(\"http://gc.kls2.com/airport/#{iata_code}\",\n \"User-Agent\" => \"Ruby\"))\n self.lat = doc.at(\"abbr.latitude\")['title'].to_f\n self.lng = doc.at(\"abbr.longitude\")['title'].to_f\n self.city = doc.at(\"span.locality\").inner_html\n self.country = doc.at(\"span.country-name\").inner_html\n self.name = doc.at(\"td.fn\").inner_html.gsub(/<[^>]+>/,'')\n end", "def search_trip(city_start, city_end, date)\n dputs __method__.to_s\n req = setup_http_request($search_req, @cookie, {:url_arg => [city_start, city_end, CGI.escape(date)]})\n res = @http.request(req)\n res=JSON.parse(res.body)['html']['results'].force_encoding('utf-8')\n results = []\n url = res.scan(/<meta itemprop=\"url\" content=\"([^>]*)\">/).flatten\n user = res.scan(/<div class=\"user-info\">\\s*<h2 class=\"username\">(.*)<\\/h2>\\s*/)#(.*)<br \\/>\\s*<\\/div>/)\n user = res.scan(/<strong class=\"MemberCard-name u-block\">([^<]*)<\\/strong>/).flatten\n user_bis = res.scan(/<h2 class=\"ProfileCard-info ProfileCard-info--name u-truncate\">\\s*(.*)\\s*<\\/h2>/).flatten\n users = user+user_bis\n #prefs = res.scan(/ <div class=\\\"preferences-container\\\">\\s*((?:<span class=\"[^ ]* prefs tip\" title=\".*\"><\\/span>)*)\\s*((?:<span class=\"[^ ]* prefs tip\" title=\".*\"><\\/span>)*)\\s*((?:<span class=\"[^ ]* prefs tip\" title=\".*\"><\\/span>)*)\\s*((?:<span class=\"[^ ]* prefs tip\" title=\".*\"><\\/span>)*)/)\n trip_time = res.scan(/<h3 class=\"time light-gray\" itemprop=\"startDate\" content=\"([^\"]*)\">\\s*(.*)\\s*<\\/h3>/)\n trip = res.scan(/<span class=\"from trip-roads-stop\">(.*)<\\/span>\\s*<span class=\"arrow-ie\">.*<\\/span>\\s*<span class=\"trip-roads-stop\">([^<]*)<\\/span>/)\n start = res.scan(/<dd class=\"js-tip-custom\" title=\"D.part\">\\s*(.*)\\s*<\\/dd>/).flatten\n stop = res.scan(/<dd class=\"js-tip-custom\" title=\"Arriv.e\">\\s*(.*)\\s*<\\/dd>/).flatten\n #car = res.scan(/<dd class=\"js-tip-custom\" title=\"Arriv.e\">\\s*.*\\s*<\\/dd>\\s*<\\/dl>\\s*((?:<dl class=\"car-type\" [^>]*>\\s*<dt>V.hicule : <strong>.*<\\/strong><\\/dt>)){0,1}/)\n #car = res.scan(/Véhicule : <strong>(.*)<\\/strong><\\/dt>/)\n place = res.scan(/<div class=\"availability\">\\s*<strong>(.*)<\\/strong>(?: <span>.*<\\/span>){0,1}/).flatten\n price = res.scan(/<div class=\"price price-[^\"]+\" itemprop=\"location\">\\s*<strong>\\s*<span class=\"\" >\\s*(\\d+)*<span class=\"size20\">(,[^<]*)<\\/span>/)\n acceptation = res.scan(/title=\"Acceptation : ([^\"]+)\"/).flatten\n url.each_with_index{|u, ind|\n results[ind] = {\n :url => u[ind],\n :user => users[ind],\n #:preferences => prefs[ind].map{|p| p.scan(/<span class=\".*\" title=\"(.*)\"><\\/span>/)}.flatten,\n :time => trip_time[ind].join(\" \"),\n :trip => trip[ind].join(\" -> \"),\n :start => start[ind],\n :stop => stop[ind],\n #:car => car[ind].first ==nil ? \"no info\" : car[ind].first.scan(/hicule : <strong>(.*)<\\/strong>/).flatten.first,\n :place => place[ind]==\"Complet\" ? \"Complet\" : \"%s disponible(s)\"%place[ind],\n :price => \"%s\" % price[ind].join(\"\"),\n :acceptation => acceptation[ind]\n }\n }\n puts \"[+] Got results\"\n results\n end", "def get_nearby_locations(nelat, nelng, swlat, swlng, user_id)\n @locations = []\n validLocations = []\n\n validLocations = Location.where(\"latitude > ? AND latitude < ? AND longitude > ? AND longitude < ?\", swlat, nelat, swlng, nelng)\n validLocations = validLocations.sort_by { |k| k[\"latitude\"] }\n validLocations = validLocations[0..49]\n\n validLocations.each do|loc|\n @locations << loc.to_hash_with_follow(user_id)\n end\n\n end", "def parser_engine\n\n\t\tjob_start_time = Time.now\n\n\t\tputs \"Parsing locations...\"\n\t\tlinks = parse_locations\n\n\t\tputs \"Finished finding all locations' pages\"\n\t\tputs \"Total Time: #{Time.now - job_start_time} seconds\"\n\n\t\tputs \"Scraping Data from Each Location...\"\n\n\t\t# Spin up a cloud browser to execute JS with (Mac desktop with Chrome)\n\t\t# browser = get_saucy\n\n\t\t# Spin up browser locally\n\t\tbrowser = run_browser_locally\n\n\t\t# Parse all pages on the returned pages\n\t\tfound_details = links.collect do |location_link|\n\t\t\tparse_location_page(location_link, browser)\n\t\tend\n\n\t\t# Close browser session on saucelabs\n\t\tbrowser.close\n\n\t\t# Remove any nil values from the returned array then flatten array of hashes to one-dimensional array of hashes\n\t\tdetails = found_details.compact.flatten\n\n\t\tputs \"Finished Scrapping All Locations' Data.\"\n\t\tputs \"Total Time to Scrape All Data: #{((Time.now - job_start_time)/60).to_i} minutes\"\n\n\t\t# Uses CSV from Ruby Core lib, this data has no owner so won't interact with our DB.\n\t\tCSV.open(\"#{Rails.root}/lib/exported_lists/#{@source}_#{@directory_listing}.csv\", \"wb\") do |row|\n\t\t\t#Headers for reference, uncomment if you need headers. Each website doesn't need them.\n\t\t\t#row << [ \"name\", \"url\", \"rating\", \"address\", \"total_reviews\", \"cuisine\", \"price\", \"neighborhood\", \"website\", \"email\", \"phone\", \"review_rating\", \"review_description\", \"review_dine_date\", \"marketing_url\", \"marketing_id\" ]\n\t\t\t\n\t\t\tdetails.each do |location|\n\t\t\t\tnext if location[:email].empty? #skip adding rows if no email is present\n\t\t\t\trow << [ location[:name], \n\t\t\t\t\t\t location[:url], \n\t\t\t\t\t\t location[:rating], \n\t\t\t\t\t\t location[:address],\n\t\t\t\t\t\t location[:total_reviews], \n\t\t\t\t\t\t location[:cuisine], \n\t\t\t\t\t\t location[:price], \n\t\t\t\t\t\t location[:neighborhood], \n\t\t\t\t\t\t location[:website], \n\t\t\t\t\t\t location[:email], \n\t\t\t\t\t\t location[:phone], \n\t\t\t\t\t\t location[:review_rating], \n\t\t\t\t\t\t location[:review_description], \n\t\t\t\t\t\t location[:review_dine_date],\n\t\t\t\t\t\t location[:marketing_url],\n\t\t\t\t\t\t location[:marketing_id] ]\n\t\t\tend\n\t\tend\n\t\tputs \"File outputted as '#{@source}_#{@directory_listing}.csv'\"\n\t\texported_csv = \"#{Rails.root}/lib/exported_lists/#{@source}_#{@directory_listing}.csv\"\n\t\texported_csv\n\tend", "def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end", "def scrape_job_listings\n queries = [\"Rails+Developer\", \"front+end+Developer\", \"ruby+developer\", \"junior+web+Developer\", \"javascript+Developer\"]\n locations = [\"San+Francisco\"]\n\n locations.each do |location|\n queries.each do |query|\n scrape_indeed(query, location)\n scrape_github(query, location)\n # scrape_glassdoor(query, location)\n ; scrape_careerbuilder(query, location)\n end\n end\nend", "def get_station_names\n\n\t\t# Typhoeus is used to submit http requests\n\n\t\t response = Typhoeus.get(\"http://api.bart.gov/api/stn.aspx?cmd=stns&key=ZZLI-UU93-IMPQ-DT35\")\n\n\t\t # Extract the station names and short names\n\n\t\t response_XML = Nokogiri.XML(response.body)\n\n\t\t @station_names = {}\n\n\t\t # Create a hash list of the station names and abbreviations\n\t\t # node provides the full name of the station and next node is \n\t\t # the abbreviation\n\n\t\t response_XML.xpath(\"//stations/station/name\").each do |node|\n\t\t \t\t@station_names[node.text] = node.next.text\n\t\t end\n\n\t\t return @station_names\n\n\tend", "def get_locations(user_entered_location)\n if user_entered_location.include? \"Arat kilo\"\n user_entered_location = \"4 Kilo\"\n end\n location = user_entered_location.to_s + \" Addis Ababa Ethiopia\"\n location = location.gsub!(\" \", \"+\")\n @google_locations = HTTParty.get(URI::encode(API_BASE_URL + location.to_s + APP_KEY))\n #Get Results from Google\n @result = Array.new\n @google_location_names = Array.new\n @google_locations['results'].each do |google_location|\n if(google_location['address_components'][0]['long_name'] != \"Addis Ababa\")\n location = Hash.new\n location['name'] = google_location['address_components'][0]['long_name']\n location['lat'] = google_location['geometry']['location']['lat']\n location['long'] = google_location['geometry']['location']['lng']\n @google_location_names.push(location['name'])\n @result.push(location)\n end\n end\n #Get Results from system\n @sys_locations = Location.where(\"location_name Like '%#{user_entered_location}%'\")\n @sys_locations.each do |sys_location|\n if(! @google_location_names.include? sys_location.location_name)\n location = Hash.new\n location['name'] = sys_location.location_name\n location['lat'] = sys_location.latitude\n location['long'] = sys_location.longitude\n @result.push(location)\n end\n end\n return @result\n end", "def find_closest_stations\n\tuserLoc = [params[:lat], params[:lng]]\n\tbounds = Geokit::Bounds.from_point_and_radius(userLoc, 10) \n\t@stations = Station.in_bounds(bounds).all # get all stations within 10 miles\t\n\t@stations.each do |s| # calc distance\n\t\ts['distance'] = s.distance_from(userLoc, :units => :miles)\n\tend\n\t@stations.sort! { |a, b| a.distance <=> b.distance }\n\tputs \"num stations found: \" + @stations.size.to_s\n\trender :json => @stations.to_json\n\t#render :json => Station.find_all_by_stop_lat_and_stop_lng(params[:lat], params[:lng]).to_json #works\n\t#repond_with was not working, not sure why\n end", "def find_nearby\n locations = read_locations_from FILE\n locations.select_within_radius 100 \n locations.sort.filter_fields\n end", "def extract_location_weather(url)\n page = Nokogiri::HTML(open(url))\n\n # We are aiming at find detail string in a structure like:\n # <html>\n # ...\n # <td>METAR text:</td>\n # <td ...>\n # KVGT 080253Z 26005KT 10SM CLR 27/00 A2983 RMK AO2 SLP098 T02670000 56000\n # ...\n\n metar_tds = page.css('td').select { |node| node.text.strip == 'METAR text:' }\n return nil unless metar_tds.count > 0\n metar_td = metar_tds[0]\n\n metar_td.next_element.text.strip.split(\"\\n\").map(&:strip).join(' ')\n end", "def create_waypoint(city, state)\n url = \"http://local.yahooapis.com/MapsService/V1/geocode?appid=#{APP_ID}\"\n res = Net::HTTP.get(URI.parse( URI.escape(url + \"&state=#{state}&city=#{city}\") ))\n \n lat = res.slice(/Latitude\\>(.*)\\<\\/Latitude/,1)\n lon = res.slice(/Longitude\\>(.*)\\<\\/Longitude/,1)\n point = Waypoint.new :name=>city, :lon=>lon, :lat=>lat\n puts point\n point\nend", "def yahoo_geocode\n\t\t yk = \"zJTs83vV34Eev5u7qgZIhICrZ0f20bNkRyvl9_XZmMMygNWXkDscK.z030x6UB4-\"\n\n\t\t # ungeocoded = Restaurant.where(:county => \"Clackamas\", :loc => {'$size' => 0 })\n\t\t ungeocoded = Restaurant.where(:county => \"Clackamas\")\n\t\t total = ungeocoded.count\n\t\t ungeocoded.each_with_index do |restaurant, idx|\n\t\t next if restaurant.street.nil? \n\t\t sleep 0.5\n\t\t geocode_url= \"http://where.yahooapis.com/\"\n\t\t geocode_url += \"geocode?location=#{URI.escape(restaurant.address)}\"\n\t\t geocode_url += \"&flags=J&appid=#{yk}\"\n\n\t\t begin\n\t\t result_json = open(geocode_url).read\n\t\t result = JSON.parse(result_json)\n\t\t r = result['ResultSet']['Results'].first\n\n\t\t lat = r['latitude'].to_f\n\t\t lng = r['longitude'].to_f\n\t\t coords = [lng, lat]\n\t\t next if coords.nil?\n\t\t restaurant.loc = [lng, lat]\n\t\t puts \"#{restaurant.name} -> #{restaurant.address} -> #{restaurant.loc} (#{idx} of #{total})\"\n\t\t restaurant.save\n\t\t rescue Exception => e\n\t\t puts \"Error getting geocoder result: #{e.inspect}\"\n\t\t end\n\n\t\t end\n\n\t\tend", "def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend", "def scrape\n request = BoundingBox.new(\n :term => keyword,\n :sw_latitude => sw_lat,\n :sw_longitude => sw_long,\n :ne_latitude => ne_lat,\n :ne_longitude => ne_long,\n :sort => 2)\n\n request2 = BoundingBox.new(\n :term => keyword,\n :sw_latitude => sw_lat,\n :sw_longitude => sw_long,\n :ne_latitude => ne_lat,\n :ne_longitude => ne_long,\n :sort => 2,\n :limit => 20,\n :offset => 20)\n\n\n [ client.search(request), client.search(request2) ]\n end", "def locations\n @client.get('/BikePoint')\n end", "def index\n\t\tif params[:search].present?\n\t\t\t@locations = Location.near(params[:search], 10, :order => distance)\n\t\telse\n\t\t\t@locations = Location.all\n\t\tend\n\tend", "def crawl\n $list.regions.each do |r|\n url = \"http://\" << r.name << :query\n puts r.name\n peel(url)\n end\n end", "def nationalparks_sitelist\n query('txt/wxfcs/nationalpark/json/sitelist')\n end", "def search\n \n # Populate the @traveler variable\n get_traveler\n \n query = params[:query]\n query_str = query + \"%\"\n Rails.logger.debug query_str\n\n # This array will hold the list of matching places\n matches = [] \n # We create a unique index for mapping etc for each place we find\n counter = 0 \n \n # First search for matching names in my places\n rel = Place.arel_table[:name].matches(query_str)\n places = @traveler.places.active.where(rel)\n places.each do |place|\n matches << {\n \"index\" => counter,\n \"type\" => PLACES_TYPE,\n \"name\" => place.name,\n \"id\" => place.id,\n \"lat\" => place.location.first,\n \"lon\" => place.location.last,\n \"address\" => place.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => place.name, :address => place.address} })\n }\n counter += 1\n end\n \n # Second search for matching address in trip_places. We manually filter these to find unique addresses\n rel = TripPlace.arel_table[:raw_address].matches(query_str)\n tps = @traveler.trip_places.where(rel).order(\"raw_address\")\n old_addr = \"\"\n tps.each do |tp|\n if old_addr != tp.raw_address\n matches << {\n \"index\" => counter,\n \"type\" => CACHED_ADDRESS_TYPE,\n \"name\" => tp.raw_address,\n \"id\" => tp.id,\n \"lat\" => tp.lat,\n \"lon\" => tp.lon,\n \"address\" => tp.raw_address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => tp.name, :address => tp.raw_address} })\n }\n counter += 1\n old_addr = tp.raw_address\n end \n end\n \n # Lastly search for matching names in the POI table\n rel = Poi.arel_table[:name].matches(query_str)\n pois = Poi.where(rel).limit(MAX_POIS_FOR_SEARCH)\n pois.each do |poi|\n matches << {\n \"index\" => counter,\n \"type\" => POI_TYPE,\n \"name\" => poi.name,\n \"id\" => poi.id,\n \"lat\" => poi.lat,\n \"lon\" => poi.lon,\n \"address\" => poi.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => poi.name, :address => poi.address} })\n }\n counter += 1\n end\n \n respond_to do |format|\n format.js { render :json => matches.to_json }\n format.json { render :json => matches.to_json }\n end\n end", "def explore\n @center = Geocoder.coordinates(params[:city])\n @trips = Trip.nearest_with_index(@center) \n end", "def find_lat_long(sites)\n sites.each do |site|\n if site.zip\n location_input = site.zip\n elsif site.state\n location_input = \"#{site.city}, #{site.state}\"\n else\n location_input = \"#{site.city}, #{site.country}\"\n end\n coordinates = Geocoder::Calculations.extract_coordinates(location_input)\n site.latitude = coordinates[0]\n site.longitude = coordinates[1]\n site.save\n end\nend", "def parser_engine\n\n\t\tjob_start_time = Time.now\n\n\t\tputs \"Parsing locations...\"\n\t\tlinks = parse_locations\n\n\t\tputs \"Finished finding all locations' pages\"\n\t\tputs \"Total Time: #{Time.now - job_start_time} seconds\"\n\n\t\tputs \"Scraping Data from Each Location...\"\n\n\t\t# Spin up a cloud browser to execute JS with (Mac desktop with Chrome)\n\t\t# browser = get_saucy\n\n\t\t# Spin up browser locally\n\t\tbrowser = run_browser_locally\n\n\t\t# Parse all pages on the returned pages\n\t\tfound_details = links.collect do |location_link|\n\t\t\tparse_location_page(location_link, browser)\n\t\tend\n\n\t\t# Close browser session on saucelabs\n\t\tbrowser.close\n\n\t\t# Remove any nil values from the returned array then flatten array of hashes to one-dimensional array of hashes\n\t\tdetails = found_details.compact.flatten\n\n\t\tputs \"Finished Scrapping All Locations' Data.\"\n\t\tputs \"Total Time to Scrape All Data: #{((Time.now - job_start_time)/60).to_i} minutes\"\n\n\t\t# Uses CSV from Ruby Core lib, this data has no owner so won't interact with our DB.\n\t\tCSV.open(\"#{Rails.root}/lib/exported_lists/#{@source}_#{@directory_listing}.csv\", \"wb\") do |row|\n\t\t\t#Headers for reference, uncomment if you need headers. Each website doesn't need them.\n\t\t\trow << [ \"Location Name\", \"City\", \"Review Count\", \"Total Reviews\", \"Rating\", \"OT URL\", \"Phone\", \"Email\" ]\n\t\t\t\n\t\t\tdetails.each do |location|\n\t\t\t\tnext if location[:total_reviews] < 11\n\t\t\t\trow << [ location[:location_name], \n\t\t\t\t\t\t location[:location_city], \n\t\t\t\t\t\t location[:review_count],\n\t\t\t\t\t\t location[:total_reviews],\n\t\t\t\t\t\t location[:rating],\n\t\t\t\t\t\t location[:url],\n\t\t\t\t\t\t location[:phone],\n\t\t\t\t\t\t location[:email] ]\n\t\t\tend\n\t\tend\n\t\tputs \"File outputted as 'ot_#{@directory_listing}_last30daysreviewcount.csv'\"\n\t\texported_csv = \"#{Rails.root}/lib/stats/ot_#{@directory_listing}_last30daysreviewcount.csv\"\n\t\texported_csv\n\tend", "def find_lat_long_for_many_sites(missing_lat_long_sites)\n missing_lat_long_sites.each do |missing_lat_long_site|\n find_lat_long_for_individual_site(missing_lat_long_site)\n end\nend", "def city_list(url)\n\troot = Nokogiri::HTML(open(url))\n list = root.css(\"a\").map do |link|\n\n\t\t# This makes sure that we only store actual links, then stores the text & link for each valid link in an array.\n\n if link[:href] =~ /http/ \n [link.text, link[:href]] \n end \n end\n\n\t# This cleans up the array and gets rid of nil elements\n\n\tlist = list.reject {|x| x.nil?} \n\t\t\n\t## Here we have various sections of CL that we can search in for various gigs. \n\t## If you wanted to see more software development stuff, you may search in /sof and /eng\n\t\n\t\t\n\t# list.map! {|f,l| [f, l + \"/cpg/\"]}\n\t# list.map! {|f,l| [f, l + \"/web/\"]}\n\tlist.map! {|f,l| [f, l + \"/web/\", l + \"/cpg/\"]}\t\n\t# list.map! {|f,l| [f, l + \"/web/\", l + \"/cpg/\", l + \"/eng/\", l + \"/sof/\", l + \"/sad/\"]}\n\t\nend", "def stations_list\n @route.get_stations_list\n end", "def find_stations(mta, start_station, end_station)\n\n # Find the lines the stations are on\n lines = find_lines mta, start_station, end_station\n\n # Find the indexes on the found lines\n origin_index = mta[lines[0]].index(start_station)\n origin_union_index = mta[lines[0]].index(\"Union Square\")\n dest_union_index = mta[lines[1]].index(\"Union Square\")\n dest_index = mta[lines[1]].index(end_station)\n\n # Return an array of the results\n stations = [lines[0], origin_index, origin_union_index, lines[1], dest_union_index, dest_index]\nend", "def ShowHomeDetails(streetAddress, citystatezip)\n #Key to access Zillow API\n zwsID = 'X1-ZWz1dn6tpoopvv_18y6r'\n #uri = \"http://www.zillow.com/webservice/GetSearchResults.htm?#{'zws-id=X1-ZWz1dmvv3i5qtn_3fm17&address=2114+Bigelow+Ave&citystatezip=Seattle%2C+WA'}\"\n uri = \"http://www.zillow.com/webservice/GetDeepSearchResults.htm?#{'zws-id=' + zwsID + '&address=' + streetAddress + '&citystatezip=' + citystatezip}\"\n #@uri = uri\n rest_resource = RestClient::Resource.new(uri, '', '')\n users = rest_resource.get\n users= users.gsub('SearchResults:searchresults','SearchResults')\n users= users.gsub('xsi:schemaLocation','schemaLocation')\n xmldoc = Document.new(users)\n root = xmldoc.root\n longitude=\"\"\n latitude=\"\"\n xmldoc.elements.each('SearchResults/response/results/result/taxAssessmentYear') do |long|\n @taxAssessmentYear = long.text\n end\n xmldoc.elements.each('SearchResults/response/results/result/taxAssessment') do |long|\n @taxAssessment = number_to_currency(long.text, :unit => \"$\")\n end\n xmldoc.elements.each('SearchResults/response/results/result/yearBuilt') do |long|\n @yearBuilt = long.text\n end\n xmldoc.elements.each('SearchResults/response/results/result/lotSizeSqFt') do |long|\n @lotSizeSqFt = number_with_delimiter(long.text)\n end\n xmldoc.elements.each('SearchResults/response/results/result/finishedSqFt') do |long|\n @finishedSqFt = number_with_delimiter(long.text)\n end\n xmldoc.elements.each('SearchResults/response/results/result/bathrooms') do |long|\n @bathrooms = long.text\n end\n xmldoc.elements.each('SearchResults/response/results/result/bedrooms') do |long|\n @bedrooms = long.text\n end\n xmldoc.elements.each('SearchResults/response/results/result/lastSoldDate') do |long|\n @lastSoldDate = long.text\n end\n xmldoc.elements.each('SearchResults/response/results/result/lastSoldPrice') do |long|\n @lastSoldPrice = number_to_currency(long.text, :unit => \"$\")\n end\n end", "def from_search\n name = params[:id]\n lat = params[:lat]\n lon = params[:lon]\n @locations = Location.locations_from_candy_ids(Candy.ids_by_name(name))\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end", "def nationalparks_forecasts(location_id='all')\n query(\"txt/wxfcs/nationalpark/json/#{location_id}\")\n end", "def mountain_area_sitelist\n query('txt/wxfcs/mountainarea/json/sitelist')\n end", "def get_locations( fsl = true )\n loc = run( 'http://' + domain + '/redetrack/bin/mylocations.php?pid=249&rnd=3865&uid=2366&org=33&rdt_site_id=222&si=243')\n loc.column(1).delete\n loc.range('D:G').delete\n loc.insert_rows( 1, 1 )\n loc['A1:C1'] = [ 'Name', 'City', 'Parent Location' ]\n hash = {}\n loc.rows(2) do |row|\n hash[ row['A'].upcase.strip ] = if row['B'].nil? || row['B'] !~ /Milton Keynes/i \n fsl ? 'FSL' : ( row['B'].nil? ? 'Blank' : row['B'] )\n else \n 'MILTON KEYNES'\n end\n end\n hash\n end", "def list_dubious_locations # :nologin:\n query = create_query(:Location, :all, :by => :name)\n show_selected_locations(query, :link_all_sorts => true,\n :action => :list_dubious_locations, :num_per_page => 1000)\n end", "def locations(place)\n get :loc => place\n end", "def getAllLocations()\n coll = self.coll_locations\n puts coll.find()\n coll.find.each { |row| puts row.inspect }\n end", "def stops_by_position\n get '/gtfs/stops/geosearch/'\n end", "def stations\n @stations ||= (exact_match? ? parse_station : parse_stations)\n end", "def stations\n doc = request(@user, \"stations\")\n stations = []\n doc.xpath('//rss/channel/item').each do |node|\n stations << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :artwork => node.xpath('pandora:stationAlbumArtImageUrl').text.strip,\n :songSeed_song => node.xpath('pandora:seeds/pandora:songSeed/pandora:song').text.strip,\n :songSeed_artist => node.xpath('pandora:seeds/pandora:songSeed/pandora:artist').text.strip,\n :composerSeed => node.xpath('pandora:seeds/pandora:composerSeed/pandora:composer').text.strip,\n :artistSeed => node.xpath('pandora:seeds/pandora:artistSeed/pandora:artist').text.strip}\n end\n stations\n end", "def location\n fetch('books.the_kingkiller_chronicle.locations')\n end", "def get_stations(array)\n origin = array[0].scan(/\\b[a-z][\\w\\s\\/]+/i)[0].split.map(&:capitalize)*' '\n destination = array[1].scan(/\\b[a-z][\\w\\s\\/]+/i)[0].split.map(&:capitalize)*' '\n origin.sub!(/[\\/]+[A-Za-z]+/){ $&.upcase }\n destination.sub!(/([\\/])\\w+/){ $&.upcase }\n origin.sub!(/(?: *town)/i, \"town\")\n destination.sub!(/(?: *town)/i, \"town\")\n\n # TODO: search our @@routes hash for the origin and destination, kick out if either invalid\n set_routes(origin, destination)\n end", "def regional_sitelist\n query('txt/wxfcs/regionalforecast/json/sitelist')\n end", "def run\n getPage\n getLocations\n printLocations\n end", "def list_locations # :nologin:\n query = create_query(:Location, :all, :by => :name)\n show_selected_locations(query, :link_all_sorts => true)\n end", "def locate_pins(location); end", "def map_locations # :nologin: :norobots:\n @query = find_or_create_query(:Location)\n if @query.flavor == :all\n @title = :map_locations_global_map.t\n else\n @title = :map_locations_title.t(:locations => @query.title)\n end\n @query = restrict_query_to_box(@query)\n @timer_start = Time.now\n columns = %w(name north south east west).map {|x| \"locations.#{x}\"}\n args = { :select => \"DISTINCT(locations.id), #{columns.join(', ')}\" }\n @locations = @query.select_rows(args).map do |id, name, n,s,e,w|\n MinimalMapLocation.new(id, name, n,s,e,w)\n end\n @num_results = @locations.count\n @timer_end = Time.now\n end", "def index\n if params[:search].present?\n @locations = Location.near(params[:search], 50)#, :order => :distance)\n else\n @locations = Location.all\n end\n end", "def stations_list\n @route.stations_list\n end", "def station_info\n\t\tarray = JSON.parse(response.body)\n\t\tarray.each do |station_info| \n\t\t\tif station_info[\"borough\"] == \"Manhattan\"\n\t\t\t\tputs \"Facility Name:\"\n\t\t\t\tputs station_info[\"facilityname\"]\n\t\t\t\tputs \"Facility Address:\"\n\t\t\t\tputs station_info[\"facilityaddress\"]\n\t\t\t\tputs \"Borough:\"\n\t\t\t\tputs station_info[\"borough\"]\n\t\t\t\tputs \"-------------------\"\n\t\t\tend\n\t\tend\n\tend", "def get_localities(query)\n p query_escaped = CGI::escape(query)\n @url = \"#{URLBASE}/feed/search.ashx?key=#{KEY}&q=#{query_escaped}&format=#{FORMAT}&num_of_days=2\"\n\n rawdata = ''\n open(@url).each do |line|\n rawdata << line\n end\n data = JSON.parse(rawdata)\n return data[\"search_api\"][\"result\"]\n \n# @city = data[0][\"areaName\"][0][\"value\"]\n# @country = data[0][\"country\"][0][\"value\"]\n# @latitude = data[0][\"latitude\"]\n# @longitude = data[0][\"longitude\"]\n# @population = data[0][\"population\"]\n# @weatherUrl = data[0][\"weatherUrl\"][0][\"value\"]\n end", "def locations()\n sql = \"SELECT dives.*\n FROM dives\n INNER JOIN schedules\n ON schedules.dive_id = dives.id\n WHERE schedules.id = $1\"\n values = [@schedule_id]\n result = SqlRunner.run(sql,values)\n dive = Dive.map_items(result)\n return dive\n end", "def get_cities\n cities = {}\n doc = nil\n retry_if_exception do\n doc = Nokogiri::HTML( easy_curl(@host_url) )\n end\n return [] if not doc\n a_cities = doc.css(\"ul[class='s-dropdown afh-dd-city'] li a\")\n a_cities.each do |city|\n city_name = city.text\n city_code = city['href'].scan(/\\w+(?=\\/changecity)/).pop\n next if not city_code\n cities[city_code] = city_name\n end\n cities\nend", "def list\n # list possible locations \n\n @location_suggest = get_location_suggest\n\n if params[:location]\n locations = WoeidHelper.search_by_name params[:location]\n if not locations.nil? and locations.count == 1\n set_location locations[0]\n else\n @location_asked = locations\n end\n end\n end", "def resort_scraper\nstates = [\"CO\", \"CA\", \"WY\", \"ID\", \"MT\", \"NY\", \"UT\", \"VT\", \"WA\"]\n states.map do |state|\n url = \"https://opensnow.com/state/#{state}#forecasts\"\n unparsed_page = HTTParty.get(url)\n parsed_page = Nokogiri::HTML(unparsed_page)\n resorts_array = Array.new\n all_resorts = parsed_page.css('div.compare-item')\n all_resorts.each do |resort|\n resort = {\n state_id: states.index(state) + 1, \n name: resort.css('div.title-location').text\n }\n resorts_array << resort\n end \n resorts_array.each do |resort|\n Resort.create(resort)\n puts \"creating #{resort[:name]}\" \n end \n end\nend", "def stations\n stations = []\n CSV.foreach(LOCAL_DATA, :col_sep =>':') do |row|\n callsign, origin, destination, client = row[0].to_s, row[11].to_s, row[13].to_s, row[3].to_s\n for cs in @callsign\n stations << row if callsign[0...cs.length] == cs # && client == \"ATC\") unless @role == \"pilot\"\n # stations << row if (origin[0...icao.length] == icao || destination[0...icao.length] == icao) unless @role == \"atc\"\n end\n end\n stations\n end", "def findAllPepLocations\n hits = @doc.xpath(\"//#{@xmlns}search_hit\")\n all = []\n @locations = []\n i = 0\n \n # Parses out each peptide and protein\n hits.each do |hit|\n all << [hit.xpath(\"./@peptide\").to_s, proteinID(hit.xpath(\"./@protein\").to_s)]\n i += 1\n end\n \n all.uniq!\n dataHash = Hash.new\n \n Ms::Fasta.foreach(@database) do |entry|\n @sequences += 1\n pID = proteinID(entry.header)\n dataHash[pID] = entry.sequence\n @proteinIndices << pID\n end\n \n all.each do |set|\n if dataHash[set[1]] != nil\n startVal = dataHash[set[1]].scan_i(set[0])[0]\n \n if startVal != nil\n @locations << [set[0], set[1], startVal + 1, startVal + set[0].length]\n end\n end\n end\n end", "def stations\n [\n master_station,\n SLCStationReport.new(@fields[5..9], false),\n SLCStationReport.new(@fields[10..14], false),\n SLCStationReport.new(@fields[15..19], false),\n SLCStationReport.new(@fields[20..24], false),\n SLCStationReport.new(@fields[25..29], false)\n ]\n end", "def call_api\n\t\tputs \"Getting info on elected officials for zipcode: #{zip_code}\"\n\t\t@api_data_on_electeds = JSON.load RestClient.get \"https://congress.api.sunlightfoundation.com/legislators/locate?zip=#{zip_code}&apikey=952d630dfb75498ab63de7a362a85335\"\n\tend", "def get_search_results(address,citystatezip)\n url_s=@@zillow_webservice_url+'GetSearchResults.htm?zws-id='+@zwsid+'&address='+address.to_s+'&citystatezip='+citystatezip.to_s\n fetch_result(url_s)\n end", "def getRoutes\n # [[\"MTA NYCT_B65\", \"B65\", \"Downtown Brooklyn - Crown Heights\", \"via Bergen St & Dean St\"]...]\n url = \"http://bustime.mta.info/api/where/routes-for-agency/MTA%20NYCT.xml?key=#{APIKEY}\"\n xml_str = Net::HTTP.get URI(url)\n xml = Nokogiri::XML(xml_str)\n xml.css(\"response data list route\").to_a.map{|rte| [rte.css('id').text, rte.css('shortName').text, rte.css('longName').text, rte.css('description').text]}\nend", "def get_locations\n response = execute_get(\"/reference/location\")\n Location.from_array(decode(response))\n end", "def get_nearby_locations(nelat, nelng, swlat, swlng, user_id)\n @locations = []\n all_locations = Locations.all\n all_locations = all_locations.sort_by {|x| x.latitude}\n all_locations.each do |loc|\n if loc.latitude <= nelat && loc.latitude >= swlat && loc.longitude <= nelng && loc.longitude >= swlng\n if Following.find_by_follower_id_and_location_id(user_id, loc.id)\n @locations << {:id => loc.id, :name => loc.name, :latitude => loc.latitude, :longitude => loc.longitude, :follows => true }\n else\n @locations << {:id => loc.id, :name => loc.name, :latitude => loc.latitude, :longitude => loc.longitude, :follows => false }\n end\n end\n end\n # locations_following = Following.find_by_sql(\"SELECT f.location_id FROM following f WHERE f.follower_id = ?\", user_id)\n # locations_not_following = Locations.find_by_sql(\"SELECT l.location_id FROM locations l\")\n # while @locations.length <= 50\n # locations_following.each do |l1|\n # locations_following.each do |l_id|\n # l = Locations.find(:id => l_id)\n # if l1.latitude <= nelat and l1.latitude >= swlat and l1.longitude <= nelng and l1.longitude >= swlng\n # @locations << {:id => l1.id, :name => l1.name, :latitude => l1.latitude, :longitude => l1.longitude, :follows => true}\n # end\n # end\n # locations_not_following.each do |l2_id|\n # l2 = Locations.find(:id => l2_id)\n # if l2.latitude <= nelat and l2.latitude >= swlat and l2.longitude <= nelng and l2.longitude >= swlng\n # @locations << {:id => l.id, :name => l.name, :latitude => l.latitude, :longitude => l.longitude, :follows => false}\n # end\n # end\n # end\n end", "def get_nearby_locations(nelat, nelng, swlat, swlng, user_id)\n @locations = []\n locs = Location.where(\"gps_lat >= ? AND gps_lat <= ? AND gps_long >= ? AND gps_long <= ?\", swlat, nelat, swlng, nelng).limit(50).order(\"gps_lat\")\n get_following_locations(user_id)\n following_loc_ids = []\n @following_locations.each do |f_loc|\n following_loc_ids << f_loc[:id]\n end\n\n locs.each do |loc|\n result = loc.to_hash\n if following_loc_ids.include?(loc.id)\n result[:follows] = true\n else\n result[:follows] = false\n end\n @locations << result\n end\n end", "def location\n fetch('hey_arnold.locations')\n end", "def search(start_lat, start_long, end_lat, end_long, radius, term)\n latitude=start_lat\n longitude=start_long\n puts latitude\n puts end_lat\n # place = []\n # address= []\n places_hash={\n \n }\n while ((latitude-end_lat).abs>0.05) do \n puts \"------------------------------------------\"\n # latitude=((start_lat)..(end_lat)).step(0.001).to_a\n # longitude=((start_long)..(end_long)).step(0.001).to_a\n # s=start_long\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n\n params = {\n # categories: term,\n term: term,\n latitude: latitude,\n longitude: longitude,\n radius: radius\n \n # limit: SEARCH_LIMIT\n }\n\n response = HTTP.auth(bearer_token).get(url, params: params)\n\n \n puts result=response.parse\n if result[\"businesses\"]!=nil\n result[\"businesses\"].each do |place|\n #need to change each loop\n places_hash[place[\"name\"]]=place[\"location\"][\"address1\"]\n end\n end\n \n puts latitude\n puts end_lat\n latitude=(latitude+(end_lat-start_lat)/5.0)\n longitude=(longitude+(end_long-start_long)/5.0)\n end\n puts places_hash\n return places_hash\nend", "def location\n fetch('doraemon.locations')\n end", "def load_locations\n\t \t\n\t \tself.locations = []\n\n\t \tsearch_request = Geo::Location.search({\n\t \t\tquery: {\n\t \t\t\tterm: {\n\t \t\t\t\tmodel_id: self.id.to_s\n\t \t\t\t}\n\t \t\t}\n\t \t})\n\n\t \tsearch_request.response.hits.hits.each do |hit|\n\t \t\tlocation = Geo::Location.new(hit[\"_source\"])\n\t \t\tlocation.id = hit[\"_id\"]\n\t \t\tlocation.run_callbacks(:find)\n\t \t\tself.locations << location\n\t \tend\n\t \t\n\tend", "def show_location\n\t\trecords = University.where(['state LIKE ?', \"%#{params[:location]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend", "def get_city_list\r\n url = \r\n page = Nokogiri::HTML(URI.open('http://annuaire-des-mairies.com/val-d-oise.html'))\r\n citys = page.css('a.lientxt[href]').each {|city| @citys_list << city.text.downcase.gsub(' ', '-')}\r\nend", "def find\n placenames = []\n begin\n placenames = Mapbox::Geocoder.geocode_forward(\n @search_text, \n {:proximity => {:longitude => @lng, :latitude => @lat}}\n )\n rescue Exception => e\n puts \"====================== Exception - MapboxApi - Places - find ======================\"\n puts e.message\n end\n\n return placenames\n end", "def fetch_trips(origin_city)\r\n return if origin_city.nil?\r\n\r\n airport_type = AIRPORT_TYPE_MEDIUM_KEY\r\n\r\n case\r\n when origin_city.downcase == 'helsinki'\r\n # Helsinki-Vantaa on ainoa poikkeus!\r\n airport_type = AIRPORT_TYPE_LARGE_KEY\r\n end\r\n\r\n # Suomesta tapahtuvien lähtöjen lentokentät ovat pääsääntöisesti medium-luokkaa.\r\n journey_airports = AIRPORTS.find({MUNICIPALITY_KEY => origin_city.capitalize, AIRPORT_TYPE_KEY => airport_type})\r\n unless journey_airports.nil?\r\n journey_airports.each do |airport|\r\n\r\n fetch_origin_country(airport)\r\n\r\n @trips = TRIPS.find({AIRPORT_ORIGIN_CITY => airport[MUNICIPALITY_KEY]})\r\n end\r\n end\r\n\r\n #@wikipedia_link = COUNTRIES.find(\r\n\r\nend", "def locations; end", "def get_nationwide_data\n\n #scrape page for top ranking cities\n @html = AirQualityIndex::Scraper.new.nationwide_aqi_scraper\n\n #create and store first rank data\n @first_city = AirQualityIndex::City.new\n\n self.first_city.location_name_full = self.html.search(\"a.NtnlSummaryCity\")[0].text.strip\n self.first_city.index = self.html.search(\"div.TabbedPanelsContent\").children.css(\"tr td\")[1].children.text.strip\n self.first_city.message = aqi_message_set(self.first_city.index)\n self.first_city.link = html.search(\"a.NtnlSummaryCity\")[0]['href']\n\n #store second rank data\n @second_city = AirQualityIndex::City.new\n\n self.second_city.location_name_full = self.html.search(\"a.NtnlSummaryCity\")[1].text.strip\n self.second_city.index = self.html.search(\"div.TabbedPanelsContent\").children.css(\"tr td\")[6].children.text.strip\n self.second_city.message = aqi_message_set(self.second_city.index)\n self.second_city.link = html.search(\"a.NtnlSummaryCity\")[1]['href']\n\n #store third rank data\n @third_city = AirQualityIndex::City.new\n\n self.third_city.location_name_full = self.html.search(\"a.NtnlSummaryCity\")[2].text.strip\n self.third_city.index = self.html.search(\"div.TabbedPanelsContent\").children.css(\"tr td\")[11].children.text.strip\n self.third_city.message = aqi_message_set(self.third_city.index)\n self.third_city.link = html.search(\"a.NtnlSummaryCity\")[2]['href']\n\n #store fourth rank data\n @fourth_city = AirQualityIndex::City.new\n\n self.fourth_city.location_name_full = self.html.search(\"a.NtnlSummaryCity\")[3].text.strip\n self.fourth_city.index = self.html.search(\"div.TabbedPanelsContent\").children.css(\"tr td\")[16].children.text.strip\n self.fourth_city.message = aqi_message_set(self.fourth_city.index)\n self.fourth_city.link = html.search(\"a.NtnlSummaryCity\")[3]['href']\n\n #store fifth rank data\n @fifth_city = AirQualityIndex::City.new\n\n self.fifth_city.location_name_full = self.html.search(\"a.NtnlSummaryCity\")[4].text.strip\n self.fifth_city.index = self.html.search(\"div.TabbedPanelsContent\").children.css(\"tr td\")[21].children.text.strip\n self.fifth_city.message = aqi_message_set(self.fifth_city.index)\n self.fifth_city.link = html.search(\"a.NtnlSummaryCity\")[4]['href']\n\n end", "def location\n @location ||= Station.get(@attrs['LocationCode'])\n end", "def stations_on_line(code)\n Station.get_on_line(code)\n end", "def crawl\n event_ids = []\n\n url = \"https://www.residentadvisor.net/events.aspx?ai=#{@city_id}&v=day&mn=#{@date.month}&yr=#{@date.year}&dy=#{@date.day}\"\n doc = Nokogiri::HTML(open(url))\n doc.search('.bbox').each do |link|\n event_id = link.at(\"h1 a[href]\").to_s.scan(/(\\d\\d\\d\\d\\d\\d)/).flatten.first\n event_ids << event_id unless event_id.blank?\n end\n\n event_ids.map do |event_id|\n \"https://www.residentadvisor.net/event.aspx?#{event_id}\"\n end\n end", "def index\n if params[:address].present?\n @q = Restroom.near(params[:address], 60, order: :distance).search(params[:q])\n @restrooms = @q.result(distinct: true).page(params[:page]).per(5)\n @search_coordinates = Geocoder.coordinates(params[:address])\n @is_search = true\n else\n @q = Restroom.near(request.remote_ip, 60, order: :distance).search(params[:q])\n @restrooms = @q.result(distinct: true).page(params[:page]).per(5)\n @search_coordinates = Geocoder.coordinates(request.remote_ip)\n @is_search = false\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restrooms }\n end\n end", "def get_area_details\n response = RestClient.get \"http://www.broadbandmap.gov/broadbandmap/census/block?latitude=#{self.location_lat}&longitude=#{self.location_lng}&format=json\"\n if response.code == 200\n response = JSON.parse(response)\n self.fips_block_type = response['Results']['block'][0]['geographyType']\n self.fips_state = response['Results']['block'][0]['FIPS'][0..1]\n self.fips_county = response['Results']['block'][0]['FIPS'][2..4]\n self.fips_tract = response['Results']['block'][0]['FIPS'][5..10]\n true\n end\n false\n end", "def index\n @locations = Location.search(params[:search])\n end", "def location\n fetch('rick_and_morty.locations')\n end", "def location\n fetch('simpsons.locations')\n end", "def build_data\n agent = Mechanize.new\n\n # Raise an particular ConnectionToBBCError exception\n # on connectivity issues\n begin\n page = agent.get(URL)\n rescue *CONNECTION_ERRORS => error\n raise ConnectionToBBCError, error\n end\n\n locations = {}\n\n # For each location...\n 1.upto(NUMBER_OF_LOCATIONS) do |i|\n area = page.search(\"#area-#{i}\")\n location = area.search(\"h2\").text\n\n # Warnings, if any\n warning = nil\n warning_detail = area.search(\".warning-detail\")\n\n # Search for the warning title\n warning_title = warning_detail.search(\"strong\").text.gsub(':', '')\n\n # Check if there is a warning before proceeding\n if !warning_title.empty?\n warning = {}\n\n # Breakout the particular warnings\n warning[:title] = warning_title\n warning[:issued] = warning_detail.search(\".issued\").text\n warning[:summary] = warning_detail.search(\".summary\").text\n end\n\n # Build up all the conditions\n location_report = {}\n breakdown = area.search(\"ul\").children.search(\"span\")\n\n location_report[:warning] = warning\n location_report[:location] = location\n location_report[:wind] = breakdown[0].text\n location_report[:seas] = breakdown[1].text\n location_report[:weather] = breakdown[2].text\n location_report[:visibility] = breakdown[3].text\n\n # Set the report for this location in the locations hash\n locations[location] = location_report\n end\n\n locations\n end", "def locations\n locations_params = Hashie::Mash.new( {f: params.f} )\n response = make_request(LOCATIONS_BASE, locations_params)\n return not_available (response) unless response.status == 200\n response_body = Hashie::Mash.new(JSON.parse(response.body))\n response_body.data\n end", "def ice_cream_places(location, radius)\n places_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/place/nearbysearch/json\",\n :query_values => {:key => \"AIzaSyC3od3aEKzgeEb8H3_6b29HX3qHXWIB248\",\n :location => location,\n :radius => radius,\n :sensor => false,\n :keyword => \"ice cream\"}\n ).to_s\n\n response = JSON.parse(RestClient.get(places_url))[\"results\"]\n all_locations = {}\n response.each do |place|\n name = place[\"name\"]\n location = place[\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\n all_locations[name] = location_string\n end\n all_locations\nend", "def index\n @q = params['q']\n\n if params['underground']\n tube = \" AND underground = 1\"\n else\n tube = \"\"\n end\n if params['lat'] and params['lng']\n lat = params['lat'].to_f\n lng = params['lng'].to_f\n @stations = Station.unscoped.select(\"stations.*, #{distance_sql(lat,lng)} AS distance\").where(\"lat IS NOT NULL AND lng IS NOT NULL\" + tube).order(\"distance ASC\").limit(1)\n elsif @q && !@q.empty?\n @stations = Station.where(\"(upper(crs) LIKE ? OR upper(name) LIKE ?)\" + tube, @q.upcase, \"%#{@q.upcase}%\").page(params[:page])\n else\n @stations = Station.page(params[:page])\n end\n\n respond_to do |format|\n format.html\n format.xml { render xml: @stations }\n format.json { render json: @stations, callback: params['callback'] }\n end\n end", "def search_by_city\n space(1)\n puts \"Where would you like to look?\"\n space(1)\n city = get_input\n url = \"https://app.ticketmaster.com/discovery/v2/events?apikey=pyLDDCYURYJ8LZfAUnOayESRsPBTWnKM&locale=*&city=#{city}&sort=date,asc\"\n response = RestClient.get(url)\n if JSON.parse(response).key?(\"_embedded\")\n events = JSON.parse(response)[\"_embedded\"][\"events\"]\n events[0...20]\n else\n puts \"Sorry, your search returned no results. Try again.\"\n search_by_city\n end\nend", "def index\n if params[:search].present?\n # When using Postgres along with the Geocoder gem, your queries cannot use symbolized keys, for example :distance\n @locations = Geolocation.near(params[:search], 0.50, :order => 'distance' )\n else\n @locations = Geolocation.limit(5)\n end\n\n # if the index returns false for search, it will display a random title\n @preview = Geolocation.find(rand(208))\n @movieAPIdata = Api.new(@preview.scenes.pluck(:title))\n @MAP = ENV['SECRET_GLOBE']\n end", "def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end", "def get_lat_lng(search_term)\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=AIzaSyD1eA_mMwy_51cCkRHu06g2GeFw8rdJmgU&location=12.9923408,77.5947617&sensor=false&radius=50000&keyword=#{search_term}\"\n p URI::escape(url)\n response = JSON.parse(RestClient.get(URI::escape(url)), :symbolize_names => true )\n p response\n location_hash = response[:results][0][:geometry][:location]\n lat = location_hash[:lat]\n lng = location_hash[:lng]\n name = response[:results][0][:name]\n [name, lat, lng]\n\nend", "def geolocate(location)\n\t\tkey = \"f94d9fe40481b0a044edc8f729724335\"\n\t\tlocation = URI.escape(location, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n\t\t# location = CGI.escape(location)\n\t\t# location = URI.escape(location)\n\t\thost = \"ondemand.metacarta.com\"\n\t\tpath = \"/webservices/GeoTagger/JSON/basic?version=1.0.0\"\n\t\tpath = \"#{path}&doc=#{location}\"\n\t\tdata = {}\n\t\tbegin\n\t\t\treq = Net::HTTP::Get.new(path)\n\t\t\treq.basic_auth SITE_METACARTA_USERID, SITE_METACARTA_PASSWORD\n\t\t\thttp = Net::HTTP.start(host)\n\t\t\t#if response.is_a?(Net::HTTPSuccess)\n\t\t\t\tresponse = http.request(req)\n\t\t\t\tdata = JSON.parse(response.body)\n\t\t\t#end\n\t\trescue Timeout::Error\n\t\t\t# DO SOMETHING WISER\n\t\t\treturn 0,0\n\t\trescue\n\t\t\treturn 0,0\n\t\tend\n\t\tbegin\n\t\t\tlat = data[\"Locations\"][0][\"Centroid\"][\"Latitude\"]\n\t\t\tlon = data[\"Locations\"][0][\"Centroid\"][\"Longitude\"]\n\t\t\treturn lat,lon\n\t\trescue\n\t\tend\n\t\treturn 0,0\n\tend", "def get_page_results(date_str)\n url = \"http://losangeles.craigslist.org/search/lac/pet\"\n page = Nokogiri::HTML(open(url))\n\n # map page elements to a hash with date, title, location\n all_rows = page.css(\".row .txt\").map do |row| {\n date: row.css(\".pl time\").text,\n title: row.css(\".pl a\").text,\n location: row.css(\".l2 .pnr small\").text,\n pic: row.css(\"span .p\").text\n }\n end\n\n get_todays_results(all_rows, date_str)\nend", "def index\n\t\trender text: \"Cannot show nearby locations without a lat and lon.\", status: :bad_request and return unless params[\"lat\"] && params[\"lon\"]\n\t\tlat = Location.convert_lat_or_lon_to_d(params[\"lat\"])\n\t\tlon = Location.convert_lat_or_lon_to_d(params[\"lon\"])\n\t\tputs \"LAT:#{lat}\", \"LON:#{lon}\"\n\n\t\tangular_radius = @@DISTANCE / @@EARTH_RADIUS\n\t\tlat_min = lat - angular_radius\n\t\tlat_max = lat + angular_radius\n\t\tputs \"LAT_MAX:#{lat_max}\", \"LAT_MIN:#{lat_min}\"\n\n\t\tdelta_lon = Math.asin(Math.sin(angular_radius) / Math.cos(lat))\n\t\tlon_min = lon - delta_lon\n\t\tlon_max = lon + delta_lon\n\t\tputs \"LON_MAX:#{lon_max}\", \"LON_MIN:#{lat_min}\"\n\n\t\tlocations = nil\n\t\tif params[\"food\"]\n\t\t\tlocations = Location.joins({ vehicles: { vendor: :foods}})\n\t\t\t\t\t\t\t.where(\"foods.name ilike ? OR foods.name ilike '%everything%'\", \"%#{params['food']}%\").where(\"status = 'APPROVED'\")\n\t\t\t\t\t\t\t.where(\"lat BETWEEN ? AND ?\", lat_min, lat_max).where(\"lon BETWEEN ? AND ?\", lon_min, lon_max)\n\t\t\t\t\t\t\t.where(\"acos(sin(?) * sin(lat) + cos(?) * cos(lat) * cos(lon - ?)) <= ?\", lat, lat, lon, angular_radius)\n\t\t\t\t\t\t\t# formula distance = arccos(sin(lat1) · sin(lat2) + cos(lat1) · cos(lat2) · cos(lon1 - lon2)) * earth_radius\n\t\t\t\t\t\t\t# doesn't take into account poles or the 180th Meridian\n\t\telse\n\t\t\tlocations = Location.joins(:vehicles).where(\"status = 'APPROVED'\")\n\t\t\t\t\t\t\t.where(\"lat BETWEEN ? AND ?\", lat_min, lat_max).where(\"lon BETWEEN ? AND ?\", lon_min, lon_max)\n\t\t\t\t\t\t\t.where(\"acos(sin(?) * sin(lat) + cos(?) * cos(lat) * cos(lon - ?)) <= ?\", lat, lat, lon, angular_radius)\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: locations }\n\t\t\tformat.html { render :nothing }\n\t\tend\n\tend" ]
[ "0.7019532", "0.69721776", "0.6619542", "0.6406317", "0.63550836", "0.6291045", "0.62364876", "0.62285507", "0.6129416", "0.61175174", "0.6115178", "0.6086678", "0.6082721", "0.60765636", "0.6068141", "0.6032643", "0.600311", "0.598479", "0.5962095", "0.5952711", "0.5949453", "0.5924109", "0.59238285", "0.59235924", "0.5921834", "0.59193367", "0.58982795", "0.5892886", "0.5892493", "0.58905226", "0.5878218", "0.58743876", "0.5865593", "0.5863095", "0.5856338", "0.5851892", "0.58434474", "0.5835923", "0.58217245", "0.58122987", "0.58097523", "0.58037937", "0.57895523", "0.5787582", "0.5781761", "0.5780478", "0.57747", "0.576986", "0.5764729", "0.5761912", "0.5761141", "0.5738725", "0.5738649", "0.5733791", "0.57326484", "0.57302964", "0.5729943", "0.5728085", "0.5726327", "0.5714982", "0.57138294", "0.57046545", "0.5700494", "0.5700144", "0.5698851", "0.56896985", "0.56889623", "0.56877285", "0.56788546", "0.5678364", "0.5674789", "0.566825", "0.5667764", "0.56670374", "0.56607276", "0.5655109", "0.56539804", "0.56443584", "0.564326", "0.56400657", "0.56365997", "0.56271076", "0.5624632", "0.56215453", "0.56205356", "0.5609831", "0.56096494", "0.5597958", "0.5594931", "0.55917513", "0.5586429", "0.5585708", "0.55852467", "0.5585222", "0.558269", "0.5581003", "0.5579037", "0.5575828", "0.5575769", "0.5571402" ]
0.7884202
0
Write the stations.yml to disk
def write_yaml(stations) log(' - Writing YAML...', false) File.open(YAML_PATH.to_s, 'w') { |file| file.write(stations.to_yaml) } log('DONE') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end", "def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end", "def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end", "def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end", "def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end", "def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end", "def save\n File.open(file_path, 'w') do |file|\n YAML.dump(data, file)\n end\n end", "def save\n File.open(path, 'w') do |out|\n YAML.dump(data, out)\n end\n end", "def save\n File.write(yfile, to_yaml)\n end", "def write\n require 'yaml'\n open config_file_name, 'w' do |io|\n io.write to_yaml\n end\n end", "def save_moves\n\t\tFile.open(@filename, 'w') {|f| f.write(@past_moves.to_yaml)}\n\tend", "def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end", "def save_data\n puts \"saving data\"\n\n File.open(generate_filename(self), \"w\") do |f|\n f.write(ostruct_to_hash(self.json).to_yaml)\n end\n end", "def store\n File.open(@file_name, 'w') do |file|\n file.write YAML::dump(@data)\n end\n end", "def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end", "def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end", "def save_configuration\n File.open(config_file, \"w\") do |file|\n file.write(YAML.dump(@config))\n end\n end", "def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end", "def save(dir = \".\")\n File.open(File.join(dir, \"#{name}.yaml\"), 'w') do |f|\n f.print YAML.dump(self)\n end\n end", "def write\n self.open_file('config/site.yml') do |file|\n self.output_resource_op self.mounting_point.site\n\n file.write(self.mounting_point.site.to_yaml)\n\n self.output_resource_op_status self.mounting_point.site\n end\n end", "def save!\n File.open(connections_file, 'w') {|f| f.write(@connections.to_yaml) }\n end", "def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end", "def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end", "def save(path = self.path)\n File.open(path, 'w') do |io|\n marshalled_packages = packages.values.map do |v|\n Hash['name' => v.name,\n 'srcdir' => v.srcdir,\n 'builddir' => (v.builddir if v.respond_to?(:builddir)),\n 'prefix' => v.prefix,\n 'dependencies' => v.dependencies]\n end\n YAML.dump(marshalled_packages, io)\n end\n end", "def store ( yml, name )\n storefile = File.new( name, \"w\")\n storefile.puts(yml)\n storefile.close\n return [yml]\n end", "def save\n require 'yaml'\n File.open(output_file, 'w') { |f| f.puts(generate.to_yaml) }\n end", "def write_config\n File.open(@config_file, \"w\"){|f| YAML.dump(config, f)}\n end", "def save(file = nil)\n @file = file if file\n raise Error.new(Error::FileError) unless @file\n File.open(@file, 'w') do |f|\n f.puts(@prefix) if @prefix\n YAML.dump(@cfg, f)\n f.puts ''\n f.puts(@suffix) if @suffix\n end\n end", "def persistData!\n File.open(getWorkingDir+'/data.host', 'w') do |f|\n f.write(@plataforms.to_yaml)\n end\n end", "def write_to_file(workbook, file_loc)\r\n yml_file = File.join(SAF::DATA_YML, \"#{workbook.sheet_name}.yml\")\r\n File.open(yml_file, \"w\") do |file|\r\n file.puts(\"#Workbook: \" + file_loc)\r\n file.puts(\"#Worksheet: \" + workbook.sheet_name)\r\n file.puts(@test_data.to_yaml)\r\n end\r\n end", "def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end", "def save_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getSaveFileName(self, \"Save configuration file\", \"./myconfig.yml\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin\n config_hash = Hash.new\n @container_hash.each do |pos, container|\n config_hash[pos] = container.config\n end\n File.open(path, \"w\") {|f| f.write(config_hash.to_yaml) }\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to write configuration to '#{path}': \\n#{e.message}\"\n end\n end", "def save\n FileUtils.mkdir_p(File.dirname(path)) unless File.directory?(File.dirname(path))\n File.open(path, \"w+\") { |f| f.puts(JSON.pretty_generate(secrets_hash)) }\n true\n end", "def save_yml_test_case_map()\n new_test_case_map_path = self.class.test_case_map_path + '.new'\n yaml_content = @tc_id_map.to_yaml\n File.open(new_test_case_map_path, \"w:UTF-8\"){ |file| file.write(yaml_content) } if yaml_content\n FileUtils.mv(self.class.test_case_map_path, self.class.test_case_map_path + \".bak\")\n FileUtils.mv(new_test_case_map_path, self.class.test_case_map_path)\n end", "def save(hash)\n File.open(\"#{@directory}/#{@store}.yml\", 'w+') {|f| f.write(hash.to_yaml) }\n end", "def save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end", "def save\n unless File.exist?(config_dir)\n FileUtils.mkdir_p(config_dir, :mode => 0700)\n end\n\n tmpfile = File.join(config_dir, \"tmpconfig_#{rand 999999}\")\n File.open(tmpfile, \"w\") do |f|\n YAML.dump(conf, f )\n end\n\n FileUtils.mv(tmpfile, config_file)\n end", "def save\n File.write @path, @index.to_yaml, encoding: \"UTF-8\"\n end", "def save\n File.open(@path, \"w\") do |file|\n Psych.dump({version: VERSION}, file)\n doc = {}\n @stats.each_pair do |article_path, article_stat|\n doc[article_path] = {\n stat: article_stat,\n related: @related[article_path] || [],\n }\n end\n Psych.dump(doc, file)\n end\n end", "def yaml_save(packages)\n FileUtils.mkdir_p(File.dirname(yaml_file))\n File.open(yaml_file, \"w\") do |file|\n file.write(packages.to_yaml)\n end\n end", "def save!\n FileUtils.mkdir_p File.dirname(self.file)\n\n File.open(self.file, \"w+\") do |f|\n f << %(#{self.namespace}.translations || (#{self.namespace}.translations = {});\\n)\n self.translations.each do |locale, translations_for_locale|\n f << %(#{self.namespace}.translations[\"#{locale}\"] = #{translations_for_locale.to_json};\\n);\n end\n end\n end", "def save( file )\n begin\n File.open( file, 'w' ) { |f| f.write( YAML.dump( self ) ) }\n rescue\n File.open( file, 'wb' ) { |f| f.write( Marshal.dump( self ) ) }\n end\n end", "def save( file = @hobix_yaml )\n unless file\n raise ArgumentError, \"Missing argument: path to save configuration (0 of 1)\"\n end\n File::open( file, 'w' ) do |f|\n YAML::dump( self, f )\n end\n self\n end", "def persist!\n raise \"Robut::Storage::YamlStore.file must be set\" unless file\n File.open(file, \"w\") do |f|\n f.puts internal.to_yaml\n end\n end", "def save_settings!\n File.open(settings_path, \"w\") { |f| f << settings.to_nested_hash.to_yaml }\n settings.create_accessors!\n end", "def logyml(service, yml)\n File.open(\"/tmp/#{service}.yml\", 'w') do |f| f.write(yml) end\n end", "def save_configuration\n create_config_dir_if_needed\n\n if configuration_writable?\n File.write(configuration_path, configuration_data.deep_stringify_keys!.to_yaml)\n configuration_data = read_configuration\n else\n throw StandardError.new \"Configuration cannot be saved at '#{configuration_path}'\"\n end\n end", "def save\n if any?\n FileUtils.mkdir_p basedir if !Dir.exist? basedir\n backup if @backup\n\n # I do this the long way because I want an immediate sync.\n f = open(@file, 'w')\n f.write YAML::dump self\n f.sync\n f.close\n\n set_mode if @mode\n end\n true\n end", "def write()\n\t\tdata = {\"rows\"=>@rows, \"cols\"=>@cols , \"moves\"=>@moves , \"time\"=> @time, \"nbGames\" => @nbGames}\n\t\tFile.open(@path, \"w\") {|out| out.puts data.to_yaml }\n\t\treturn self\n\tend", "def save_yaml( f_enzyme, f_reference=nil, f_supplier=nil )\n File.open(f_enzyme, 'w') { |f| f.puts YAML.dump(@enzyme_data) }\n File.open(f_reference, 'w') { |f| f.puts YAML.dump(@reference_data) } if f_reference\n File.open(f_supplier, 'w') { |f| f.puts YAML.dump(@supplier_data) } if f_supplier\n end", "def write_to_fixture(name)\n File.open(self.class.file_path(name), \"w\") do |file|\n file.write to_yaml\n end\n end", "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"./lib/save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end", "def persist\n settings = {\n area: @focus[:key]\n }\n File.open(@path, 'w') do |file|\n file.write settings.to_yaml\n end\n end", "def save(filename)\n data_to_save = @metadata.merge({\n \"licenses\" => licenses.map(&:to_cache),\n \"notices\" => notices\n })\n\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, data_to_save.to_yaml)\n end", "def save_state()\n server_hash = @server_manager.get_server_hash(@servers)\n\n File.open(@data_path,\"w\") do |f|\n f.write(server_hash.to_json)\n end\n end", "def generate_save\n YAML.dump(self)\n end", "def write_machines(f)\n @machines.each do |m|\n f.write(\"#{m['name']}\\tansible_ssh_host=#{m['ip']}\\t\")\n f.write('ansible_ssh_private_key_file=')\n f.write(\"/vagrant/.vagrant/machines/#{m['name']}\")\n f.write(\"/virtualbox/private_key\\n\")\n end\n end", "def update\n\t\t\tpath = File.join(Config[:lists_directory], @name.downcase.gsub(/ /, '_') +'.yml')\n\t\t\tFile.open(path, 'w') do |fh|\n\t\t\t\tfh.puts(self.to_yaml)\n\t\t\tend\n\t\tend", "def to_yaml\n\t\tFile.write(\"save.yaml\", YAML.dump({\n\t\t\t:board => @board.board,\n\t\t\t:positions => @board.positions,\n\t\t\t:current_turn => @current_turn,\n\t\t\t:ai_on => @ai_on\n\t\t\t}))\n\tend", "def yaml_save object, filename\nFile.open filename, 'w' do |f| f.write(object.to_yaml)\nend end", "def save\n File.open( @plugins_file, 'w' ) do |out|\n YAML.dump( @plugins, out )\n end\n end", "def save!(file_path)\n File.open(file_path, \"w\") do |f|\n f.write(YAML.dump(@log))\n end\n end", "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end", "def save_locations(locations)\n File.open('location_data.json', 'w') do |file|\n file.puts locations\n end\n end", "def dotfile!( name )\n File.open( dotfile( name ), \"w\" ) do |f|\n h = { 'name' => self.name, 'version' => self.version, \"#{name}_timestsamp\" => Time.now }\n f.puts h.to_yaml\n end\n end", "def save_settings\n open(@@FN_CREDENTIALS, \"wb\") { |fd| fd.write(YAML::dump(@credentials)) }\n open(@@FN_CONFIG, \"wb\") { |fd| fd.write(YAML::dump(@configuration)) }\n open(@@FN_SETTINGS, \"wb\") { |fd| fd.write(YAML::dump(@settings)) }\n end", "def save_configuration_files(server)\n puts \"Saving config files\"\n object_behavior(server, :spot_check_command, 'mkdir -p /root/start_stop_backup')\n object_behavior(server, :spot_check_command, 'cp /etc/postfix/main.cf /root/start_stop_backup/.')\n object_behavior(server, :spot_check_command, 'cp /etc/syslog-ng/syslog-ng.conf /root/start_stop_backup/.')\n end", "def write_yaml\n File.open(@path, \"w\") do |f| \n if !@comments.empty?\n f.write @comments.join(\"\\n\")\n f.write(\"\\n\")\n end\n f.write YAML.dump(yaml)\n end\n end", "def save( directory )\n File.open( \"parsed_data/#{directory}.yaml\", 'w' ) do |f|\n f.write( @pages.to_yaml )\n end\n end", "def save_config_file(locale, key)\n locale_config = {}\n locale_config[locale] = {}\n unless @config[key].nil?\n locale_config[locale][key] = @config[key]\n path = \"config/locales/org/#{key}/#{locale}.yml\"\n File.delete(path) if File.exist?(path)\n TTY::File.create_file(path, locale_config.to_yaml)\n end\nend", "def write_yml(filename,object)\n File.open(filename,'w') do |f|\n f.write(YAML.dump(object))\n end\n end", "def save_to_file(path)\n variables_to_save = instance_variables.reject { |v| v =~ /_proc$/ || v =~ /^@med/ }\n File.open(path, 'w') { |f| f.puts(\n variables_to_save.inject({}) { |h,n| h[n] = instance_variable_get(n); h }.to_yaml\n ) }\n end", "def save(filepath)\n File.open(filepath, \"w\") do |f|\n f.write((@proxies + @dead_proxies).to_yaml)\n end\n end", "def save(path = @path)\n Ops.atomic_write(path) do |io|\n marshalled_package_sets = each_package_set.map do |pkg_set|\n set = pkg_set.to_h.transform_keys(&:to_s)\n set[\"package_set\"] = set[\"name\"]\n set\n end\n marshalled_packages = each_package.map do |pkg|\n pkg.to_h.transform_keys(&:to_s)\n end\n io.write YAML.dump(marshalled_package_sets + marshalled_packages)\n end\n end", "def write_to_file\n f = File.new('db/seeds.rb', 'w')\n @strings.each do |x|\n f.write(\"#{x}\\n\")\n end\n f.close\n end", "def export path\n File.write path, to_zonefile\n end", "def dump\n File.open(\"saved_games.yaml\", \"a\") do |out|\n YAML::dump(self, out)\n end\n end", "def save\n fann.save(\"#{Rails.root}/data/#{self.class.to_s.tableize.singularize}.conf\")\n end", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def store\n File.open(@config_file, 'w') do |f|\n f.chmod(0600)\n f.write(@config.to_json)\n end\n end", "def save\n File.open(@base_file, \"w\") do |f|\n f.puts(JSON.pretty_generate(@config))\n end\n File.open(@completions_file, \"w\") do |f|\n f.puts(JSON.pretty_generate(@completions.to_a))\n end\n end", "def config_write\n # Putting it in a format that zfm can also read and write\n f1 = File.expand_path(CONFIG_FILE)\n hash = {}\n hash['DIRS'] = @used_dirs.select { |dir| File.exist? dir }\n hash['FILES'] = @visited_files.select { |file| File.exist? file }\n # NOTE bookmarks is a hash and contains FILE:cursor_pos\n hash['BOOKMARKS'] = @bookmarks # .select {|file| File.exist? file}\n writeYML hash, f1\n @writing = @modified = false\n message \"Saved #{f1}\"\nend", "def save_keys\n key_file = File.open(key_file_path, 'w')\n\n key_file.write(YAML::dump(@@keys))\n\n key_file.close\n end", "def save_yaml(yaml)\n yaml_file = File.join(thor_root, \"thor.yml\")\n\n unless File.exist?(yaml_file)\n FileUtils.mkdir_p(thor_root)\n yaml_file = File.join(thor_root, \"thor.yml\")\n FileUtils.touch(yaml_file)\n end\n\n File.open(yaml_file, \"w\") { |f| f.puts yaml.to_yaml }\n end", "def write\n FileUtils.mkdir_p File.dirname(destination_path)\n File.open(destination_path, 'w') { |f| f.write(sitemap_content) }\n end", "def save!(file=nil)\n file = file || @file || self.class.default_filename\n file = @root + file if String === file\n now! # update date\n File.open(file, 'w'){ |f| f << yaml }\n end", "def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend", "def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend", "def yaml_save(object, filename)\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def save\n if file\n # Ensure the current store has been loaded before we try to re-write it, this\n # is necessary if the program generator has crashed before creating a test\n store\n p = Pathname.new(file)\n FileUtils.mkdir_p(p.dirname)\n File.open(p, 'w') { |f| f.puts JSON.pretty_generate(store) }\n end\n end", "def save(name = @name)\n raise OneCfg::Config::Exception::NoContent if @content.nil?\n\n file_operation(name, 'w') {|file| file.write(to_s) }\n end", "def save(filename)\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, YAML.dump(@metadata) + \"---\\n#{text}\")\n end", "def to_file filename\n File.open(filename, 'w') do |io|\n io.write self.to_yaml\n end\n end", "def save\n File.open(file, 'w') do |f|\n self.attributes.each {|key, value| f.write \"#{key}: '#{value}'\\n\" }\n end\n end" ]
[ "0.71399915", "0.71231467", "0.6833124", "0.67595303", "0.6741323", "0.67238617", "0.6718801", "0.6692962", "0.66747785", "0.65909904", "0.6585045", "0.65687835", "0.65416473", "0.64866114", "0.6483459", "0.64626855", "0.6445233", "0.6388901", "0.6383342", "0.6336774", "0.63074946", "0.6287286", "0.62825716", "0.6223605", "0.62226963", "0.62013125", "0.6196738", "0.6193984", "0.6177387", "0.61744386", "0.6169631", "0.61570436", "0.61194515", "0.61155015", "0.61138755", "0.60979205", "0.60925335", "0.60685545", "0.6055084", "0.60476196", "0.6034115", "0.6033881", "0.6021891", "0.60214573", "0.60170597", "0.59983987", "0.5994534", "0.5990418", "0.5986313", "0.59849143", "0.5942823", "0.5940685", "0.59267277", "0.5905302", "0.5895113", "0.5894222", "0.5894118", "0.5883789", "0.5878679", "0.5875698", "0.5874351", "0.5862993", "0.5862854", "0.58618736", "0.5859782", "0.5858106", "0.58565897", "0.5848868", "0.58479846", "0.58321285", "0.5831921", "0.5830214", "0.58286", "0.5826953", "0.5824294", "0.5823984", "0.5820885", "0.58146703", "0.5807152", "0.5807152", "0.5807152", "0.5807152", "0.5807152", "0.5807152", "0.5807152", "0.580542", "0.58045644", "0.57826495", "0.5782463", "0.5782048", "0.57770044", "0.57750756", "0.57749945", "0.57749945", "0.5770789", "0.5769274", "0.575371", "0.5752679", "0.5750969", "0.57406855" ]
0.78969675
0
Returns the response body for a GET request
def get_response(url) uri = URI(url) Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http| request = Net::HTTP::Get.new uri return http.request(request).body end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n response = Net::HTTP.get_response(endpoint_uri)\n case response\n when Net::HTTPSuccess, Net::HTTPRedirection\n return response.body\n else \n raise response.body\n end\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get()\n return @http.request(@req)\n end", "def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end", "def get\n begin\n response = Net::HTTP.get_response(URI.parse(uri))\n rescue => e\n raise InterfaceError, \"#{e.message}\\n\\n#{e.backtrace}\"\n end\n response.code == '200' ? response.body : response_error(response)\n end", "def get_response_body\n uri = URI.parse(@url)\n response = Net::HTTP.get_response(uri)\n response.body\n end", "def get\n check_response( @httpcli.get(@endpoint) )\n end", "def get\n JSON.parse(self.class.get(url).response.body)\n end", "def raw_response\n Net::HTTP.get(endpoint)\n end", "def get\n start { |connection| connection.request http :Get }\n end", "def get\n @response = Net::HTTP.get_response(URI(@url))\n end", "def get(path, params = {}, headers = {})\n request(:get, path, params, headers).body\n end", "def body\n connection.get(@url.path).body\n end", "def http_get_body(uri, credentials=nil, headers={})\n response = http_request(:get, uri, credentials, headers)\n\n ### filter body\n if response\n return response.body_utf8\n end\n\n nil\n end", "def get(url, params = {})\n client.get(url, params).body\n end", "def get(path)\n connection.get do |req|\n req.url path\n end.body\n end", "def get path, header={}, body_string_or_hash=\"\"\n env.http 'GET', path, header, body_string_or_hash\n end", "def get endpoint\n do_request :get, endpoint\n end", "def get(_endpoint_path, _extra_headers = {})\n response\n end", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end", "def get(path, options={})\n response = request(path, :get, options)\n validate response\n parsed_response = parse response\n data = { headers: response.headers, body: parsed_response }\n end", "def get_response\n parse_response(parse_JSON(get_request))\n end", "def get\n url = prefix + \"get\" + id_param\n return response(url)\n end", "def get\n subclass(:Response).new connection.get do |req|\n req.url uri\n end\n end", "def get(path, query = { }, headers = { })\n clear_response\n path = process_path(path, query)\n @success_code = 200\n @response = http.get(path, headers)\n parse_response? ? parsed_response : response.body\n end", "def _get\n http_method(:get)\n end", "def get\n request = Net::HTTP::Get.new endpoint_uri.path\n request.basic_auth Dawanda.http_basic[:user], Dawanda.http_basic[:password] if Dawanda.http_basic\n request.set_form_data parameters\n response = Net::HTTP.new(endpoint_uri.host, endpoint_uri.port).start {|http| http.request(request) }\n \n case response\n when Net::HTTPSuccess, Net::HTTPRedirection\n return response.body\n else \n raise response.body\n end\n end", "def get\n execute_request { faraday_connection.get(href || '') }\n end", "def get_response_body\n uri = URI.parse(@url) #parse the url being passed in with 'URI.parse'\n response = Net::HTTP.get_response(uri) # 'GET' the response of the uri with 'Net::HTTP.get_resonse' and pass in the uri variable\n response.body #return the 'body' from the 'response' variable\n end", "def download\n if verb == :get\n body = get_http_content\n elsif verb == :post\n body = post_http_content\n end\n\n body\n end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def http_get(url)\n Net::HTTP.get_response(URI.parse(url)).body.to_s\n end", "def read\n res = conn.get(escaped_path)\n @headers = res.headers\n res.body\n end", "def get(path)\n req = Net::HTTP::Get.new(@base_url + path)\n response = handle_request(req)\n response.each {|k,v| puts \"#{k}: #{v}\"}\n response\n end", "def get(path) # code generated from moviedb website\n url = URI(\"#{HOST_URL}#{path}#{ENV['API_KEY']}\")\n response = Net::HTTP.get_response(url)\n begin\n response_hash = JSON.parse(response.read_body)\n return response_hash\n rescue\n {}\n end\n end", "def get\n res = connection.get url.to_s\n Response.const_get(class_basename).new res.body, res.status\n end", "def body(path)\n get(path).body\n end", "def get(request, response)\n @resource.get(request, response)\n end", "def read\n res = conn.get(escaped_path)\n @headers = res.headers\n res.body\n end", "def get path = \"\", payload = {}\n make_request(path, \"get\", payload)\n end", "def response\n get_header_and_body\n end", "def rest_get\n ##define the url path\n url =\"/get\"\n\n ##This is headers definition.\n headers = [\n ['Cached-Control', \"no-cache\" ],\n [\"Content-Type\", \"application/x-www-form-urlencoded\"]\n ]\n begin\n #------------------------\n # Send Get Request\n #------------------------\n request, response = send_get(url, headers)\n\n if response.code.to_i == 200\n actual_value = response.body.chop!\n actual_value.gsub!(\"\\n\",\"\")\n return actual_value.gsub!(/\\s+/, \"\")\n else\n return false\n end\n rescue Exception => ex\n @log.error \"#### Response code is: #{response.code} #####\"\n @log.error ex.message\n puts \"#### Response code is: #{response.code} #####\"\n puts ex.message\n return false\n end\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def get\n\t\t\tself.make_request!({uri: self.to_uri, method: :get})\n\t\tend", "def response_body\n @response[:body]\n end", "def http_get(path, headers = { })\n clear_response\n path = process_path(path)\n @success_code = 200\n @response = http.get(path, headers)\n parse_response? ? parsed_response : response.body\n end", "def get(url)\n\n data = nil\n resp = HTTParty.get(url)\n\n if resp.code == 200\n return resp.body\n end\n end", "def http_get(url)\n response = client.get(url, follow_redirect: true)\n\n raise HTTPClient::BadResponseError, response.reason unless HTTP::Status.successful?(response.status)\n\n response\n end", "def get(path, query={})\n request_json :get, path, query\n end", "def get\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def http_fetch_body(url)\n res = http_fetch(url)\n case res\n when Net::HTTPSuccess\n res.body\n else res.error!\n end\n end", "def get(uri, options = {})\n build_response(request.get(uri, build_request_options({:input => options.to_params})))\n end", "def get(path)\n request(:get, path, {})\n end", "def get(params = {})\n request! do\n api[url.path + to_query(params)].get(API_HEADERS)\n end\n end", "def get(url, headers={})\n RestClient.get url, headers\n end", "def get(request)\n do_request(request) { |client| client.http_get }\n end", "def response_body(uri)\n req = Net::HTTP::Get.new(uri)\n req.basic_auth(@username, @password)\n resp = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http|\n http.request(req)\n }\n JSON.parse resp.body\n end", "def get(path, params = {})\n debug_log \"GET #{connection.build_url(\"#{@host}#{path}\", params)}\"\n res = connection.get path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def get(options={}, &block)\n response = http.get_uri(options, &block)\n handle_response(response)\n end", "def get\n if @data == nil\n url = make_url\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n\n return @data\n end", "def get(endpoint)\n response = HTTP.headers(headers).get(endpoint)\n\n Response.new(JSON.parse(response.body), response.status != 200)\n end", "def get!\n self.https.request self.http_request # Net::HTTPResponse object\n end", "def get(url, headers={})\n do_request(\"get\", url, nil, headers)\n end", "def get\n Iterable.request(conf, base_path).get\n end", "def get\n Iterable.request(conf, base_path).get\n end", "def get(uri, request_headers)\n request('get', uri, request_headers)\n end", "def get_body(env)\n Kickbox::HttpClient::ResponseHandler.get_body(env)\n end", "def http_get_body(uri)\n response = http_get(uri)\n\n ### filter body\n if response\n return response.body.encode('UTF-8', {:invalid => :replace, :undef => :replace, :replace => '?'})\n end\n\n nil\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(options = {}, all = true)\n uri = URI.parse(request_path(options, all))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n puts \"Request URL (GET) is #{uri.request_uri}\" \n\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n response.body\n end", "def get_body(addr)\n http = Curl.get(addr, timeout: 2)\n http.body_str\nend", "def get(additional_desc = nil, &block)\n _request('get', Net::HTTP::Get, additional_desc, &block)\n end", "def get(url)\n result = JSON.parse self.class.get(url, @request_options).body\n status = result['status']\n fail StandardError, \"Returned status: #{status}\" unless status == 'OK'\n result['response']\n end", "def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get_http_content\n uri.query = URI.encode_www_form(params)\n res = Net::HTTP.get_response(uri)\n\n raise HTTPError.new(\"invalid #{res.code} response\") unless res.is_a?(Net::HTTPSuccess)\n\n puts res.code\n res.body\n end", "def hnl_http_get(uri, include_http_response = false)\n # setup the request\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n\n # make the request\n response = http.request(request)\n\n # and return the result\n return [JSON.parse(response.body)[\"response\"], response] if include_http_response\n JSON.parse(response.body)[\"response\"]\n end", "def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end", "def get(params={})\n body = get_body(params)\n raw_request = post(body)\n\n parse(raw_request)\n end", "def get(url, headers = {})\n request(:get, url, headers)\n end", "def get(url, headers = {})\n request(:get, url, headers)\n end", "def http( *args )\n p http_get( *args )\n end", "def send_get(url)\r\n result = @client.get(self.target_uri(url))\r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200')\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end", "def get(url, options = {})\n options[\"apikey\"] = @api_key\n uri = generate_uri(url, @default_options.merge(options))\n\n response = Net::HTTP.get_response(uri)\n json? ? JSON.parse(response.body) : response.body\n end", "def do_GET(request, response)\n status = 200\n content_type = \"text/html\"\n body = \"bender version #{BENDER_VERSION}\"\n body += \"\\n\"\n\n response.status = status\n response['Content-Type'] = content_type\n response.body = body\n response.body = body\n end", "def get\n execute(:get).to_s\n end", "def body\n response.body\n end", "def http_get_early(request, response)\n params = request.query_parameters\n return http_get(request, response) if params['sabreAction'] == 'info'\n end", "def get(path, params = {}, request_options = {})\n request(:get, path, params)\n end" ]
[ "0.77841413", "0.77799475", "0.77799475", "0.77258235", "0.77258235", "0.7521605", "0.74256873", "0.7364632", "0.7308463", "0.72702736", "0.7257912", "0.72103703", "0.7190221", "0.71405685", "0.7136288", "0.7098193", "0.7094688", "0.70913947", "0.69861037", "0.6973668", "0.694541", "0.69399065", "0.6921998", "0.69020945", "0.68812406", "0.6836649", "0.68312263", "0.6811188", "0.68057376", "0.6803388", "0.67742157", "0.67664623", "0.6762604", "0.67569864", "0.6753144", "0.6723391", "0.6710328", "0.6705931", "0.670421", "0.6688161", "0.66526943", "0.6647776", "0.66290706", "0.66282445", "0.6618439", "0.6616876", "0.661611", "0.6609915", "0.66059726", "0.66004837", "0.6596932", "0.65957344", "0.65747625", "0.65726817", "0.6559684", "0.654253", "0.653958", "0.6537096", "0.65369904", "0.6534535", "0.6526003", "0.6524823", "0.65209115", "0.6511503", "0.65049344", "0.65041846", "0.65027916", "0.65027916", "0.65019506", "0.6500845", "0.6499727", "0.6492815", "0.6491876", "0.6484108", "0.6482444", "0.6481629", "0.6480862", "0.6474511", "0.6474511", "0.6474511", "0.6474511", "0.6474511", "0.6474511", "0.6474511", "0.6474511", "0.6474511", "0.6474511", "0.64660686", "0.6460543", "0.64581174", "0.645614", "0.64558744", "0.64558744", "0.64534533", "0.64454585", "0.6440847", "0.6438238", "0.64374024", "0.64371693", "0.6435788", "0.643322" ]
0.0
-1
Puts without a linebreak
def log(str, newline = true) return puts(str) if newline print str.ljust(60, ' ') STDOUT.flush end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_a_line\n puts \"\\n\"\n puts \"/\\\\\" * 40\n puts \"\\n\"\n end", "def empty_line\r\n puts \"\\n\"\r\n end", "def blank_line\n output \"\"\n end", "def render_spacer\n puts \"\\n\"\n end", "def lineBreak \n \"lineBreak\" \n end", "def line_feed\n write_raw \"\\n\"\n end", "def nl\n @linebreak = true\n end", "def clear_line\n print \"\\r%s\\r\" % ' ' * columns\n end", "def print_new_line\n puts ''\nend", "def empty_line\n puts\" \" * 70\nend", "def break_to_newline\n end", "def br\n output \"\"\n end", "def accept_blank_line blank_line\n @res << \"\\n\"\n end", "def adjust(val)\n val.gsub!(/\\n/, ' ')\n val.strip!\n end", "def clear_line; print \"\\e[2K\" end", "def newline; end", "def spacer\n puts \"\\n----------------------------\\n\"\nend", "def break_to_newline\n end", "def p_blankline\n p do\n nbsp\n end\n end", "def write_no_newline(text)\n print(sanitize(text))\n end", "def new_line\n puts \"\\n\"\nend", "def new_line\n puts \"\\n\"\nend", "def hputs(str=\"\")\n str << \"\\n\" unless str[-1] == ?\\n\n print str.gsub(/\\n/, \"<br />\\n\")\nend", "def clear_line\n puts \"\\e[0A\\e[0G\"\n end", "def begin_of_line\n write_raw \"\\r\"\n end", "def write_separator\n @stream.puts('')\n end", "def print_empty_line\n print_in_same_line(\" \")\n end", "def linebreak(char='')\n puts \"#{char*50}\"\n end", "def line_break(character)\n quickly do\n character * 150\n end\n puts \"\"\n end", "def clear_line_before\n CSI + '1K'\n end", "def clear_line!\n print \"\\r\\e[2K\"\n end", "def fancy_newline\n @results += '|'\n newline\n end", "def line_break\n append '(?:\\n|(?:\\r\\n))'\n end", "def spacing\n puts \"\"\n puts \"\"\n puts \"\"\n end", "def writeln(text)\n write \"\\n\" if @buf.last && @buf.last[-1] != ?\\n\n write text\n write \"\\n\"\n end", "def empty_line\n end", "def newline\n incr_y\n end", "def clear_line_after\n CSI + '0K'\n end", "def space; txt ' ','' end", "def clear_line\n CLEAR_LINE\n end", "def clear_eol\n print \"\\e[0K\"\n end", "def writeln(string)\n write string.end_with?(\"\\n\") ? string : \"#{string}\\n\"\n end", "def erase_line_to_end\n ConsoleGlitter.escape('0K')\n end", "def space()\n # pocitanie riadkov\n self.line.push position if /\\n/ === data[position]\n /\\s/ === data[position]\n\n end", "def erase_line_to_both\n ConsoleGlitter.escape('2K')\n end", "def newline\n puts\n end", "def linebreak(amount=1)\n $stdout.print \"\\n\" * amount\n end", "def wrapped\n @lines.join(\"\\n\")\n end", "def draw_blank\n puts \"[ o ] [ o ] [ o ] [ o ]\\n\\n\"\n end", "def normal_line(text)\n end", "def output()\n add_newline if @linebreak\n @text\n end", "def puts(msg)\n # print msg\n # print \"\\n\"\n @lines << \"#{msg}\\n\"\nend", "def put_line(line = nil)\n commit_status()\n puts line\n STDOUT.flush\n end", "def clear_line\n CSI + '2K' + column(1)\n end", "def endline\n\t\t@@bold = @@objs = false\n\tend", "def erase_line_to_beginning\n ConsoleGlitter.escape('1K')\n end", "def space\n 3.times { puts \"\\n\"}\n end", "def add_linebreaks(definition)\n definition.gsub(\"\\r\", '<br>')\nend", "def insert_break_points\n\n # I have no idea why the new lines seem to have two back slashes before\n # them. Ruby is automatically escaping new lines? If so... when? How\n # TODO how to I avoid this.\n self.content.gsub(/\\\\n/, \"<br>\")\n end", "def line\n\tputs \"-\" * 100\nend", "def newline\n print \"\\n\"\n end", "def draw_eol\n print \"\\r\\e[#{columns - 1}C#{V_SEP}\\n\"\n end", "def _rl_overwrite_rubout(count, key)\r\n if (@rl_point == 0)\r\n rl_ding()\r\n return 1\r\n end\r\n\r\n opoint = @rl_point\r\n\r\n # L == number of spaces to insert\r\n l = 0\r\n count.times do\r\n rl_backward_char(1, key)\r\n l += rl_character_len(@rl_line_buffer[@rl_point,1], @rl_point) # not exactly right\r\n end\r\n\r\n rl_begin_undo_group()\r\n\r\n if (count > 1 || @rl_explicit_arg)\r\n rl_kill_text(opoint, @rl_point)\r\n else\r\n rl_delete_text(opoint, @rl_point)\r\n end\r\n # Emacs puts point at the beginning of the sequence of spaces.\r\n if (@rl_point < @rl_end)\r\n opoint = @rl_point\r\n _rl_insert_char(l, ' ')\r\n @rl_point = opoint\r\n end\r\n\r\n rl_end_undo_group()\r\n\r\n 0\r\n end", "def line_to_wrap; end", "def put_new_lines(no_of_newlines)\n no_of_newlines.times do\n puts \"\"\n end\nend", "def newline\n @results += nl\n end", "def puts(string)\n string += \"\\n\" unless string.end_with? \"\\n\"\n print string\n end", "def a_puts(line, bold = false)\n new_line = pad(line)\n line = bold && STDOUT.tty? ? Term::ANSIColor.bold(new_line) : new_line\n puts line\nend", "def newline_to_nothing(input)\n input.to_s.gsub(/\\n/, NOTHING)\n end", "def flush_left text\n indent = 9999\n\n text.each_line do |line|\n line_indent = line =~ /\\S/ || 9999\n indent = line_indent if indent > line_indent\n end\n\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, text.encoding\n\n text.gsub(/^ {0,#{indent}}/, empty)\n end", "def putc(*line)\n raise unless @state == :asm\n @outp.puts(formatDump(\" \" + line.join(''), lastComment))\n end", "def blank\n print \"\\r\"\n if @last_print_msg\n print ' ' * IO.console.winsize[1]\n end\n print \"\\r\"\n end", "def write(x,y,text)\n Curses.setpos(x,y)\n text.each_line do |line|\n break if x == Curses.lines-1\n Curses.addstr(line) \n x += 1\n end\n for x in 1..Curses.lines\n Curses.deleteln\n end\n Curses.setpos(text.lines.count-1,0)\n Curses.addstr(text.lines.take(3)[2]) unless text.lines.take(3)[2].nil?\n Curses.setpos(text.lines.count-1,0)\n end", "def insert_text(out = nil)\n print out if out\n exit 203\n end", "def throw_away_meaningless_line\n\t\tputs \"I have no idea what you are talking about\"\n\tend", "def puts_clear; puts \"\\e[0J\" end", "def insert_after\r\n @lines.insert(@line_num, TextLineBuffer.new(\"\"))\r\n @line_num = @line_num + 1\r\n end", "def show_blank(p)\r\n set_cursor p\r\n print Normal\r\n print \" \"*@disks + \"|\" + \" \"*@disks\r\n update\r\n end", "def clear\n\n # remove the trailing newline, otherwise an upper line will get eaten\n @rendered.sub!(/\\n\\z/, '')\n\n # determine how many lines to move up\n lines = @rendered.scan(/\\n/).length\n\n if @bottomline\n print IOChar.cursor_down + IOChar.carriage_return + IOChar.clear_line + IOChar.cursor_up\n end\n\n # jump back to the first position and clear the line\n print IOChar.cursor_down + IOChar.carriage_return + IOChar.clear_line + IOChar.cursor_up + IOChar.clear_line + IOChar.carriage_return + ( IOChar.cursor_up + IOChar.clear_line ) * lines + IOChar.clear_line\n end", "def h_line\n puts \"-\" * 50\n nil\nend", "def br\n print(\"\\n\")\nend", "def single_line?; end", "def newline\n @printer.nl\n end", "def skip_row(value_width)\n sprintf(\"%#{value_width}s ~\\n\", \" \")\n end", "def puts(str = '')\n @io << str << \"<br/>\\n\"\n end", "def accept_blank_line(blank_line)\n # @res << annotate(\"<p />\") << \"\\n\"\n end", "def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end", "def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end", "def space\n 20.times do\n puts \"\"\n end\n end", "def line(text, length=20)\n puts \"-\" * length\n puts text \nend", "def append_with_nl(base, add)\n base.strip!\n base.sub!(/\\S\\z/, \"\\\\&\\n\")\n base << add\n base << \"\\n\"\n end", "def print_in_box(message)\n width = message.length + 2\n line = '++'\n space = '||'\n banner = \"| #{message} |\"\n\n (width).times do |i|\n line.insert(1,'-')\n space.insert(1,' ')\n end\n\n puts line\n puts space\n puts banner\n puts space\n puts line\nend", "def space_to_eol(count)\r\n if @hConsoleHandle\r\n csbi = 0.chr * 24\r\n @GetConsoleScreenBufferInfo.Call(@hConsoleHandle,csbi)\r\n cursor_pos = csbi[4,4].unpack('L').first\r\n written = 0.chr * 4\r\n @FillConsoleOutputCharacter.Call(@hConsoleHandle,0x20,count,cursor_pos,written)\r\n else\r\n @rl_outstream.write(' ' * count)\r\n end\r\n @_rl_last_c_pos += count\r\n end", "def clear_break\n \"<br clear='all' style='clear: both;'/>\"\n end", "def rnl(string)\n\tstring.delete \"\\n\"\nend", "def newline()\n @file.write(\"\\n\")\n end", "def puts(string=\"\\n\")\n io.puts(string)\n end", "def breakable(sep=' ', width=nil)\n @output << sep\n end", "def strip_lines(value)\n value.to_s.gsub(/\\n\\s*/, ' ')\n end", "def optional_newline\n \"\\n\"\n end", "def new_line(times = 1)\n times.times do\n print \"\\n\"\n end\n\n end" ]
[ "0.7111479", "0.7045081", "0.69562393", "0.69230783", "0.67122835", "0.6678514", "0.6643383", "0.6600773", "0.6599524", "0.6577277", "0.65621376", "0.65601504", "0.6470468", "0.6459504", "0.64575213", "0.6451263", "0.64300156", "0.64070874", "0.6396748", "0.63712376", "0.6349406", "0.6349406", "0.6344871", "0.63317937", "0.6323706", "0.63180405", "0.6317047", "0.63161063", "0.6302223", "0.6297347", "0.6296836", "0.6264189", "0.62561107", "0.62439555", "0.6215986", "0.6209712", "0.6209448", "0.6201639", "0.6190825", "0.6170004", "0.6167324", "0.61430854", "0.61409086", "0.6135329", "0.6123358", "0.6122461", "0.61191505", "0.61106044", "0.60704386", "0.60686374", "0.60655653", "0.606078", "0.6054592", "0.60400456", "0.60171044", "0.6013941", "0.60099596", "0.6008817", "0.5985081", "0.59831315", "0.59830564", "0.59713745", "0.5967826", "0.5964598", "0.5958988", "0.5949661", "0.5937757", "0.5925839", "0.5919825", "0.59025097", "0.5885041", "0.58840126", "0.58839834", "0.5883684", "0.58718294", "0.5860315", "0.5860208", "0.58509123", "0.58451444", "0.5843126", "0.5834197", "0.5823359", "0.5808628", "0.57997835", "0.5797584", "0.5796945", "0.57900655", "0.57900655", "0.5769537", "0.5760179", "0.57595426", "0.57535654", "0.57450616", "0.57450366", "0.57384545", "0.57312614", "0.57286376", "0.57267064", "0.5715654", "0.5713323", "0.5702709" ]
0.0
-1
there is no cli updatejob command
def action_update if job_exists post_job(job_url) else post_job(new_job_url) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @job = args[:job] if args.key?(:job)\n end", "def update!(**args)\n @job = args[:job] if args.key?(:job)\n end", "def update!(**args)\n @failed_jobs = args[:failed_jobs] if args.key?(:failed_jobs)\n @job = args[:job] if args.key?(:job)\n end", "def update!(**args)\n @job = args[:job] if args.key?(:job)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @latest_job = args[:latest_job] if args.key?(:latest_job)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @failed_main_jobs = args[:failed_main_jobs] if args.key?(:failed_main_jobs)\n @failed_pre_caching_check_jobs = args[:failed_pre_caching_check_jobs] if args.key?(:failed_pre_caching_check_jobs)\n @main_job = args[:main_job] if args.key?(:main_job)\n @pre_caching_check_job = args[:pre_caching_check_job] if args.key?(:pre_caching_check_job)\n end", "def update_job(job:)\n response = HTTParty.put(\"#{@host}/api/jobs/#{job[:id]}\", body: {job: job, api_key: @api_key})\n \n return response.success?\n end", "def update!(**args)\n @advance_child_rollout_job_run = args[:advance_child_rollout_job_run] if args.key?(:advance_child_rollout_job_run)\n @create_child_rollout_job_run = args[:create_child_rollout_job_run] if args.key?(:create_child_rollout_job_run)\n @create_time = args[:create_time] if args.key?(:create_time)\n @deploy_job_run = args[:deploy_job_run] if args.key?(:deploy_job_run)\n @end_time = args[:end_time] if args.key?(:end_time)\n @etag = args[:etag] if args.key?(:etag)\n @job_id = args[:job_id] if args.key?(:job_id)\n @name = args[:name] if args.key?(:name)\n @phase_id = args[:phase_id] if args.key?(:phase_id)\n @postdeploy_job_run = args[:postdeploy_job_run] if args.key?(:postdeploy_job_run)\n @predeploy_job_run = args[:predeploy_job_run] if args.key?(:predeploy_job_run)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @uid = args[:uid] if args.key?(:uid)\n @verify_job_run = args[:verify_job_run] if args.key?(:verify_job_run)\n end", "def update!(**args)\n @deploy_job = args[:deploy_job] if args.key?(:deploy_job)\n @postdeploy_job = args[:postdeploy_job] if args.key?(:postdeploy_job)\n @predeploy_job = args[:predeploy_job] if args.key?(:predeploy_job)\n @verify_job = args[:verify_job] if args.key?(:verify_job)\n end", "def update!(**args)\n @allow_queueing = args[:allow_queueing] if args.key?(:allow_queueing)\n @catch_up = args[:catch_up] if args.key?(:catch_up)\n @create_pipeline_job_request = args[:create_pipeline_job_request] if args.key?(:create_pipeline_job_request)\n @create_time = args[:create_time] if args.key?(:create_time)\n @cron = args[:cron] if args.key?(:cron)\n @display_name = args[:display_name] if args.key?(:display_name)\n @end_time = args[:end_time] if args.key?(:end_time)\n @last_pause_time = args[:last_pause_time] if args.key?(:last_pause_time)\n @last_resume_time = args[:last_resume_time] if args.key?(:last_resume_time)\n @last_scheduled_run_response = args[:last_scheduled_run_response] if args.key?(:last_scheduled_run_response)\n @max_concurrent_run_count = args[:max_concurrent_run_count] if args.key?(:max_concurrent_run_count)\n @max_run_count = args[:max_run_count] if args.key?(:max_run_count)\n @name = args[:name] if args.key?(:name)\n @next_run_time = args[:next_run_time] if args.key?(:next_run_time)\n @start_time = args[:start_time] if args.key?(:start_time)\n @started_run_count = args[:started_run_count] if args.key?(:started_run_count)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @advance_child_rollout_job = args[:advance_child_rollout_job] if args.key?(:advance_child_rollout_job)\n @create_child_rollout_job = args[:create_child_rollout_job] if args.key?(:create_child_rollout_job)\n @deploy_job = args[:deploy_job] if args.key?(:deploy_job)\n @id = args[:id] if args.key?(:id)\n @job_run = args[:job_run] if args.key?(:job_run)\n @postdeploy_job = args[:postdeploy_job] if args.key?(:postdeploy_job)\n @predeploy_job = args[:predeploy_job] if args.key?(:predeploy_job)\n @skip_message = args[:skip_message] if args.key?(:skip_message)\n @state = args[:state] if args.key?(:state)\n @verify_job = args[:verify_job] if args.key?(:verify_job)\n end", "def update!(**args)\n @job_results = args[:job_results] if args.key?(:job_results)\n end", "def update!(**args)\n @job_results = args[:job_results] if args.key?(:job_results)\n end", "def update!(**args)\n @job_results = args[:job_results] if args.key?(:job_results)\n end", "def update\n # FIXME: this should use retry_it\n xml = render_template\n begin\n print \"Updating #{job_name}\\n\"\n xml_debug(xml) if @debug\n Jenkins.job.create_or_update(job_name, xml)\n rescue => e\n # FIXME: use retry_it to fail after a number of tries\n puts e\n retry\n end\n job_name\n end", "def update!(**args)\n @advance_rollout_jobs = args[:advance_rollout_jobs] if args.key?(:advance_rollout_jobs)\n @create_rollout_jobs = args[:create_rollout_jobs] if args.key?(:create_rollout_jobs)\n end", "def update!(**args)\n @backing_custom_job = args[:backing_custom_job] if args.key?(:backing_custom_job)\n end", "def update!(**args)\n @disable_retries = args[:disable_retries] if args.key?(:disable_retries)\n @restart_job_on_worker_restart = args[:restart_job_on_worker_restart] if args.key?(:restart_job_on_worker_restart)\n @timeout = args[:timeout] if args.key?(:timeout)\n end", "def update\n # cyber-dojo.sh does actual [update]\nend", "def update!(**args)\n @commute_info = args[:commute_info] if args.key?(:commute_info)\n @job = args[:job] if args.key?(:job)\n @job_summary = args[:job_summary] if args.key?(:job_summary)\n @job_title_snippet = args[:job_title_snippet] if args.key?(:job_title_snippet)\n @search_text_snippet = args[:search_text_snippet] if args.key?(:search_text_snippet)\n end", "def update!(**args)\n @commute_info = args[:commute_info] if args.key?(:commute_info)\n @job = args[:job] if args.key?(:job)\n @job_summary = args[:job_summary] if args.key?(:job_summary)\n @job_title_snippet = args[:job_title_snippet] if args.key?(:job_title_snippet)\n @search_text_snippet = args[:search_text_snippet] if args.key?(:search_text_snippet)\n end", "def update!(**args)\n @job_manifests_path = args[:job_manifests_path] if args.key?(:job_manifests_path)\n @manifest_path = args[:manifest_path] if args.key?(:manifest_path)\n @skaffold_config_path = args[:skaffold_config_path] if args.key?(:skaffold_config_path)\n end", "def job_klass\n VoyagerUpdateJob\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @latest_job_end_time = args[:latest_job_end_time] if args.key?(:latest_job_end_time)\n @latest_job_start_time = args[:latest_job_start_time] if args.key?(:latest_job_start_time)\n end", "def update!(**args)\n @job_id = args[:job_id] if args.key?(:job_id)\n @report_time = args[:report_time] if args.key?(:report_time)\n @state = args[:state] if args.key?(:state)\n @task_group_id = args[:task_group_id] if args.key?(:task_group_id)\n @tasks = args[:tasks] if args.key?(:tasks)\n end", "def update(job)\n mass_assign(job)\n self\n end", "def update!(**args)\n @job_runs = args[:job_runs] if args.key?(:job_runs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @disable_street_address_resolution = args[:disable_street_address_resolution] if args.key?(:disable_street_address_resolution)\n @job = args[:job] if args.key?(:job)\n @processing_options = args[:processing_options] if args.key?(:processing_options)\n @update_job_fields = args[:update_job_fields] if args.key?(:update_job_fields)\n end", "def update!(**args)\n @disable_street_address_resolution = args[:disable_street_address_resolution] if args.key?(:disable_street_address_resolution)\n @job = args[:job] if args.key?(:job)\n @processing_options = args[:processing_options] if args.key?(:processing_options)\n @update_job_fields = args[:update_job_fields] if args.key?(:update_job_fields)\n end", "def update!(**args)\n @multi_trial_job_output = args[:multi_trial_job_output] if args.key?(:multi_trial_job_output)\n end", "def update!(**args)\n @child_rollout_jobs = args[:child_rollout_jobs] if args.key?(:child_rollout_jobs)\n @deployment_jobs = args[:deployment_jobs] if args.key?(:deployment_jobs)\n @id = args[:id] if args.key?(:id)\n @skip_message = args[:skip_message] if args.key?(:skip_message)\n @state = args[:state] if args.key?(:state)\n end", "def update\n byebug\n respond_to do |format|\n if @job.update(send(\"#{@job.type.underscore.to_sym}_params\"))\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @assignee = args[:assignee] if args.key?(:assignee)\n @job_type = args[:job_type] if args.key?(:job_type)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @end_time = args[:end_time] if args.key?(:end_time)\n @execution_spec = args[:execution_spec] if args.key?(:execution_spec)\n @labels = args[:labels] if args.key?(:labels)\n @message = args[:message] if args.key?(:message)\n @name = args[:name] if args.key?(:name)\n @retry_count = args[:retry_count] if args.key?(:retry_count)\n @service = args[:service] if args.key?(:service)\n @service_job = args[:service_job] if args.key?(:service_job)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @trigger = args[:trigger] if args.key?(:trigger)\n @uid = args[:uid] if args.key?(:uid)\n end", "def update(id, job)\n connection.put do |req|\n req.url \"job/#{id}\"\n req.body = job\n end\n end", "def update\n\n @job = current_member.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(job_params)\n format.html { redirect_to @job, notice: 'The stuff you want done was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.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 @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @execution_spec = args[:execution_spec] if args.key?(:execution_spec)\n @execution_status = args[:execution_status] if args.key?(:execution_status)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @notebook = args[:notebook] if args.key?(:notebook)\n @spark = args[:spark] if args.key?(:spark)\n @state = args[:state] if args.key?(:state)\n @trigger_spec = args[:trigger_spec] if args.key?(:trigger_spec)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @job_run = args[:job_run] if args.key?(:job_run)\n @message = args[:message] if args.key?(:message)\n @pipeline_uid = args[:pipeline_uid] if args.key?(:pipeline_uid)\n @release_uid = args[:release_uid] if args.key?(:release_uid)\n @rollout_uid = args[:rollout_uid] if args.key?(:rollout_uid)\n @target_id = args[:target_id] if args.key?(:target_id)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @job_id = args[:job_id] if args.key?(:job_id)\n @phase_id = args[:phase_id] if args.key?(:phase_id)\n end", "def update!(**args)\n @job_id = args[:job_id] if args.key?(:job_id)\n @phase_id = args[:phase_id] if args.key?(:phase_id)\n end", "def update\n respond_to do |format|\n if @launched_job.update(launched_job_params)\n format.html { redirect_to @launched_job, notice: 'Launched job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @launched_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def update!(**args)\n @data_labeling_job = args[:data_labeling_job] if args.key?(:data_labeling_job)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @operation = args[:operation] if args.key?(:operation)\n end", "def update!(**args)\n @runnable = args[:runnable] if args.key?(:runnable)\n @task_id = args[:task_id] if args.key?(:task_id)\n @task_status = args[:task_status] if args.key?(:task_status)\n end", "def update\n @job = Mugen::Job.update(params[:id])\n \n redirect_to mygengo_jobs_path\n end", "def update!(**args)\n @backfill_job = args[:backfill_job] if args.key?(:backfill_job)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @errors = args[:errors] if args.key?(:errors)\n @name = args[:name] if args.key?(:name)\n @source_object = args[:source_object] if args.key?(:source_object)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @args = args[:args] if args.key?(:args)\n @kms_key = args[:kms_key] if args.key?(:kms_key)\n @max_job_execution_lifetime = args[:max_job_execution_lifetime] if args.key?(:max_job_execution_lifetime)\n @project = args[:project] if args.key?(:project)\n @service_account = args[:service_account] if args.key?(:service_account)\n end", "def update!(**args)\n @always_run = args[:always_run] if args.key?(:always_run)\n @background = args[:background] if args.key?(:background)\n @barrier = args[:barrier] if args.key?(:barrier)\n @container = args[:container] if args.key?(:container)\n @environment = args[:environment] if args.key?(:environment)\n @ignore_exit_status = args[:ignore_exit_status] if args.key?(:ignore_exit_status)\n @labels = args[:labels] if args.key?(:labels)\n @script = args[:script] if args.key?(:script)\n @timeout = args[:timeout] if args.key?(:timeout)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @end_time = args[:end_time] if args.key?(:end_time)\n @error = args[:error] if args.key?(:error)\n @job_spec = args[:job_spec] if args.key?(:job_spec)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n @web_access_uris = args[:web_access_uris] if args.key?(:web_access_uris)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @run_time = args[:run_time] if args.key?(:run_time)\n @status = args[:status] if args.key?(:status)\n end", "def update\n respond_to do |format|\n if @myjob.update(myjob_params)\n format.html { redirect_to @myjob, notice: 'Myjob was successfully updated.' }\n format.json { render :show, status: :ok, location: @myjob }\n else\n format.html { render :edit }\n format.json { render json: @myjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @available_memory_mb = args[:available_memory_mb] if args.key?(:available_memory_mb)\n @description = args[:description] if args.key?(:description)\n @entry_point = args[:entry_point] if args.key?(:entry_point)\n @environment_variables = args[:environment_variables] if args.key?(:environment_variables)\n @event_trigger = args[:event_trigger] if args.key?(:event_trigger)\n @https_trigger = args[:https_trigger] if args.key?(:https_trigger)\n @labels = args[:labels] if args.key?(:labels)\n @max_instances = args[:max_instances] if args.key?(:max_instances)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @runtime = args[:runtime] if args.key?(:runtime)\n @service_account_email = args[:service_account_email] if args.key?(:service_account_email)\n @source_archive_url = args[:source_archive_url] if args.key?(:source_archive_url)\n @source_repository = args[:source_repository] if args.key?(:source_repository)\n @source_upload_url = args[:source_upload_url] if args.key?(:source_upload_url)\n @status = args[:status] if args.key?(:status)\n @timeout = args[:timeout] if args.key?(:timeout)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version_id = args[:version_id] if args.key?(:version_id)\n @vpc_connector = args[:vpc_connector] if args.key?(:vpc_connector)\n end", "def update!(**args)\n @end_time = args[:end_time] if args.key?(:end_time)\n @execution_trigger = args[:execution_trigger] if args.key?(:execution_trigger)\n @job_id = args[:job_id] if args.key?(:job_id)\n @message = args[:message] if args.key?(:message)\n @retries = args[:retries] if args.key?(:retries)\n @service = args[:service] if args.key?(:service)\n @service_job = args[:service_job] if args.key?(:service_job)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @client_id = args[:client_id] if args.key?(:client_id)\n @custom_job = args[:custom_job] if args.key?(:custom_job)\n @end_time = args[:end_time] if args.key?(:end_time)\n @final_measurement = args[:final_measurement] if args.key?(:final_measurement)\n @id = args[:id] if args.key?(:id)\n @infeasible_reason = args[:infeasible_reason] if args.key?(:infeasible_reason)\n @measurements = args[:measurements] if args.key?(:measurements)\n @name = args[:name] if args.key?(:name)\n @parameters = args[:parameters] if args.key?(:parameters)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @web_access_uris = args[:web_access_uris] if args.key?(:web_access_uris)\n end", "def update!(**args)\n @cron = args[:cron] if args.key?(:cron)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_jobs = args[:patch_jobs] if args.key?(:patch_jobs)\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_sauce_job_status(json_data = {})\n host = \"http://#{settings.sl_user}:#{settings.sl_api_key}@saucelabs.com\"\n path = \"/rest/v1/#{settings.sl_user}/jobs/#{session_id}\"\n url = \"#{host}#{path}\"\n ::RestClient.put url, json_data.to_json, content_type: :json, accept: :json\n end", "def install\n bin.install \"job\"\n end", "def update!(**args)\n @job_templates = args[:job_templates] if args.key?(:job_templates)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(edit_admin_job_path(@job), :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @available_memory_mb = args[:available_memory_mb] if args.key?(:available_memory_mb)\n @entry_point = args[:entry_point] if args.key?(:entry_point)\n @environment_variables = args[:environment_variables] if args.key?(:environment_variables)\n @event_trigger = args[:event_trigger] if args.key?(:event_trigger)\n @https_trigger = args[:https_trigger] if args.key?(:https_trigger)\n @labels = args[:labels] if args.key?(:labels)\n @latest_operation = args[:latest_operation] if args.key?(:latest_operation)\n @max_instances = args[:max_instances] if args.key?(:max_instances)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @runtime = args[:runtime] if args.key?(:runtime)\n @service_account = args[:service_account] if args.key?(:service_account)\n @source_archive_url = args[:source_archive_url] if args.key?(:source_archive_url)\n @source_repository = args[:source_repository] if args.key?(:source_repository)\n @source_repository_url = args[:source_repository_url] if args.key?(:source_repository_url)\n @source_upload_url = args[:source_upload_url] if args.key?(:source_upload_url)\n @status = args[:status] if args.key?(:status)\n @timeout = args[:timeout] if args.key?(:timeout)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version_id = args[:version_id] if args.key?(:version_id)\n @vpc_connector = args[:vpc_connector] if args.key?(:vpc_connector)\n end", "def update_jobs!\n @jobs.each_value do |job|\n name = job[:name]\n changes = nil\n # Search the generator for changes\n @generator[:jobs].each do |gen|\n changes = gen[name.to_sym] if gen.is_a?(Hash) && gen.keys[0] == name.to_sym\n end\n # Apply changes\n Utils.hash_merge!(job[:value], changes) unless changes.nil?\n end\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @download_url = args[:download_url] if args.key?(:download_url)\n @end_time = args[:end_time] if args.key?(:end_time)\n @id = args[:id] if args.key?(:id)\n @job_expire_time = args[:job_expire_time] if args.key?(:job_expire_time)\n @job_id = args[:job_id] if args.key?(:job_id)\n @start_time = args[:start_time] if args.key?(:start_time)\n end", "def update!(**args)\n @backing_hyperparameter_tuning_job = args[:backing_hyperparameter_tuning_job] if args.key?(:backing_hyperparameter_tuning_job)\n @best_trial_backing_custom_job = args[:best_trial_backing_custom_job] if args.key?(:best_trial_backing_custom_job)\n end", "def update\n #@job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if UbiquoJobs.manager.update(params[:id], params[:job])\n flash[:notice] = t(\"ubiquo.jobs.job_edited\")\n format.html { redirect_to(ubiquo.jobs_path) }\n format.xml { head :ok }\n format.js\n else\n flash[:error] = t(\"ubiquo.jobs.cant_edit\")\n format.html { render :action => \"edit\" }\n format.xml { render :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def update!(**args)\n @apt = args[:apt] if args.key?(:apt)\n @goo = args[:goo] if args.key?(:goo)\n @mig_instances_allowed = args[:mig_instances_allowed] if args.key?(:mig_instances_allowed)\n @post_step = args[:post_step] if args.key?(:post_step)\n @pre_step = args[:pre_step] if args.key?(:pre_step)\n @reboot_config = args[:reboot_config] if args.key?(:reboot_config)\n @windows_update = args[:windows_update] if args.key?(:windows_update)\n @yum = args[:yum] if args.key?(:yum)\n @zypper = args[:zypper] if args.key?(:zypper)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @end_time = args[:end_time] if args.key?(:end_time)\n @error = args[:error] if args.key?(:error)\n @job_detail = args[:job_detail] if args.key?(:job_detail)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @pipeline_spec = args[:pipeline_spec] if args.key?(:pipeline_spec)\n @reserved_ip_ranges = args[:reserved_ip_ranges] if args.key?(:reserved_ip_ranges)\n @runtime_config = args[:runtime_config] if args.key?(:runtime_config)\n @schedule_name = args[:schedule_name] if args.key?(:schedule_name)\n @service_account = args[:service_account] if args.key?(:service_account)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @template_metadata = args[:template_metadata] if args.key?(:template_metadata)\n @template_uri = args[:template_uri] if args.key?(:template_uri)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: \"Job was successfully updated.\" }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @new_job_state = args[:new_job_state] if args.key?(:new_job_state)\n @new_task_state = args[:new_task_state] if args.key?(:new_task_state)\n @type = args[:type] if args.key?(:type)\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to root_path, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n record_activity :update, @job\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job! changed_job\n jobs.where(id: changed_job[:id]).update(changed_job)\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end", "def run_job\n end", "def update\n puts \"Updating...\"\n end", "def update!(**args)\n @additional_links = args[:additional_links] if args.key?(:additional_links)\n @gcloud_commands = args[:gcloud_commands] if args.key?(:gcloud_commands)\n @steps = args[:steps] if args.key?(:steps)\n end", "def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job job\n job.check_number = '0' if job.check_number.blank?\n job.pages_from = 1\n job.payer = Payer.find_by_payer(\"No Payer\")\n return job\n end", "def update_job job\n job.check_number = '0' if job.check_number.blank?\n job.pages_from = 1\n job.payer = Payer.find_by_payer(\"No Payer\")\n return job\n end", "def update!(**args)\n @image_url = args[:image_url] if args.key?(:image_url)\n @job_title = args[:job_title] if args.key?(:job_title)\n @name = args[:name] if args.key?(:name)\n @same_as = args[:same_as] if args.key?(:same_as)\n end", "def update!(**args)\n @always_run = args[:always_run] if args.key?(:always_run)\n @background = args[:background] if args.key?(:background)\n @container = args[:container] if args.key?(:container)\n @environment = args[:environment] if args.key?(:environment)\n @ignore_exit_status = args[:ignore_exit_status] if args.key?(:ignore_exit_status)\n @script = args[:script] if args.key?(:script)\n @timeout = args[:timeout] if args.key?(:timeout)\n end", "def update!\n scheduling.total_runs = scheduling.total_runs.to_i + qjob.stats['releases']\n scheduling.last_run = Time.now\n end", "def update!(**args)\n @completed_work = args[:completed_work] if args.key?(:completed_work)\n @estimated_work = args[:estimated_work] if args.key?(:estimated_work)\n end", "def update_job_config(job_name, xml)\n jobs.update(job_name, xml.to_s)\n end", "def update!(**args)\n @custom_jobs = args[:custom_jobs] if args.key?(:custom_jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @parent = args[:parent] if args.key?(:parent)\n @pipeline_job = args[:pipeline_job] if args.key?(:pipeline_job)\n @pipeline_job_id = args[:pipeline_job_id] if args.key?(:pipeline_job_id)\n end", "def update\n @job = Job.find(params[:id])\n @job.update({\n name: params[:job][:name],\n description: params[:job][:description],\n origin: params[:job][:origin],\n destination: params[:job][:destination],\n cost: params[:job][:cost],\n containers_needed: params[:job][:containers_needed]\n })\n\n if (@job)\n redirect_to url_for(:controller => :jobs, :action => :index)\n else\n redirect_to url_for(:controller => :jobs, :action => :edit)\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n if @job.update_attributes(params[:job])\n flash[:success] = \"The job has been updated!\"\n redirect_to root_url\n end\n\n end" ]
[ "0.75874716", "0.75874716", "0.7297529", "0.7289962", "0.7039567", "0.69346386", "0.68443626", "0.6808775", "0.6788607", "0.67065394", "0.66502607", "0.6609347", "0.6609347", "0.66064775", "0.66060036", "0.6543909", "0.6506621", "0.6504699", "0.649269", "0.6491358", "0.64909786", "0.63582003", "0.63510936", "0.63510305", "0.63510305", "0.62977916", "0.62761045", "0.62745357", "0.6265396", "0.6258011", "0.6258011", "0.6250889", "0.62404996", "0.6238483", "0.6220193", "0.6214337", "0.6193742", "0.61933106", "0.6182636", "0.6180363", "0.616062", "0.616062", "0.6147041", "0.6146793", "0.6146793", "0.6141046", "0.6139453", "0.6129748", "0.6122867", "0.6121415", "0.61053836", "0.60996675", "0.60996675", "0.6091715", "0.6085335", "0.6085335", "0.6085335", "0.60689616", "0.60682136", "0.60554636", "0.6051467", "0.60431457", "0.6030433", "0.6029146", "0.602857", "0.602776", "0.6019309", "0.6017672", "0.60145396", "0.6011639", "0.60048026", "0.5994356", "0.5991563", "0.5985745", "0.5974859", "0.5961878", "0.59616256", "0.59585446", "0.59471136", "0.59432364", "0.5939389", "0.5939024", "0.592987", "0.59283113", "0.5926141", "0.5920569", "0.5916035", "0.5915536", "0.5915536", "0.59054154", "0.59053975", "0.59003496", "0.58971465", "0.5896867", "0.5896498", "0.5893237", "0.5892904", "0.5890554", "0.589", "0.58889914" ]
0.65943944
15
POST /tasks POST /tasks.json
def create task = Task.create(task_params) @artist = Artist.find_by_id(task_params[:artist_id]) task.artist = @artist task.save! render json: task end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end", "def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def create_task(options = {})\n request(:post, \"tasks\", options)\n end", "def create\n @task = Task.new(task_params)\n @task.save\n render json: full_task(@task)\n end", "def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, serializer: TaskSerializer\n else\n render json: { error: t('task_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n task = Task.new(task_params)\n if task.save\n render json: task, status: :created\n else\n render_errors(task)\n end\n end", "def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end", "def create\n # raise params.inspect\n @task = Task.new(task_params)\n if @task.save\n redirect_to tasks_url\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n\n end\n end", "def create\n\t\t@task = Task.new(task_params)\n\t\t@task.user = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @task.save\n\t\t\t\tformat.html { render json: @task }\n\t\t\t\tformat.json { render json: @task }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: tasks_path }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n projusers = ProjectsUser.find(params[:task][:project_users_id])\n @task = projuser.tasks.build(task_params)\n\n if @task.save\n render json: @task , status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def create\n @task = Task.new(task_params)\n\n if @task.save\n render :show, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n @users = User.all\n @users.each do |user|\n user.tasks << @task\n end\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @user= User.find_by_id(session[:user_id])\n @task = @user.tasks.create(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = @project.tasks.new(task_params)\n @task.user = current_user if current_user.developer?\n @statuses = Task.statuses.keys\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to edit_project_task_path(@project, @task.id), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n puts @task.errors.as_json\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_param)\n if @task.save\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages \n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = current_user.tasks.build(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #byebug\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = current_user.tasks.new task_params\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def add task_details\n\n #prepare payload\n now = Time.now.to_i \n defaults = {\n \"method\" => \"task.save\",\n \"id\" => UUID.generate,\n \"type\" => 0,\n \"_type\" => now,\n \"state\" => 0,\n \"_state\" => now,\n }\n\n task = defaults.merge(task_details)\n self.post [task].to_json\n end", "def create\n @api_task = Api::Task.new(api_task_params)\n\n respond_to do |format|\n if @api_task.save\n format.html { redirect_to @api_task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @api_task }\n else\n format.html { render :new }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = current_user.tasks.build(task_params)\n respond_to do |format|\n if @task.save \n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_user_task\n task = Task.create(task_params)\n puts \"New task: #{task}\"\n if task\n render json: {task: task}\n else\n render json: task.error.full_messages, status: 402\n end\n end", "def create\n \n @task = params[:task] ? Task.create(params[:task]) : Task.create(:description=>params[:description], :isDone=>params[:isDone], :order=>params[:order] )\n respond_with(@task)\n \n end", "def create\n @task = Task.new(task_params)\n @task.start\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = current_user.tasks.build(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to :action => :index, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new do |t|\n t.title = params[:title]\n t.picture = params[:picture]\n t.description = params[:description]\n t.color = params[:color]\n t.date = params[:date]\n t.order = params.has_key?(:order) ? params[:order] : 0\n end\n\n if @task.save\n render json: @task, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def create(task)\n validate_type!(task)\n\n attributes = sanitize(task)\n _, _, root = @client.post(\"/tasks\", attributes)\n\n Task.new(root[:data])\n end", "def create\n @task = current_user.tasks.new(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'タスクを登録しました!' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.create!(task_params)\n end", "def create\n @task = @project.tasks.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to [@project, @task], notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = @project.tasks.create!(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to project_url(@project), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.find(params[:project_id])\n @task = @project.tasks.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @project, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @task = Task.new(task_params)\n @task = current_user.tasks.build(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, success: t('.notice') }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n @task.save\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task }\n else\n format.html { render action: 'new' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task }\n else\n format.html { render action: 'new' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task }\n else\n format.html { render action: 'new' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\t\t\n\t\t# Assume none are taken at creation...\n\t\t@task.taken = 0\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@task = Task.new(params[:task])\n\n\n @task = current_user.tasks.build(params[:task])\n\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to action: \"index\", notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@task = Task.new(task_params)\n\n\t\trespond_to do |format|\n\t\t\tif @task.save\n\t\t\t\tformat.html { redirect_to [:admin, @task], notice: 'Task was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: [:admin, @task] }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: [:admin, @task].errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @task = Task.create(task_params)\n redirect_to tasks_path\n end", "def create\n @task = current_user.tasks.build(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path, notice: 'Task was successfully created.' }\n format.json {render inline: \"location.reload();\" }\n format.json { render :show, status: :created, location: tasks_path }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.find(params[:user_task][:tasks_id])\n\tcurrent_user.craete_task!(@task)\n respond_to do |format|\n if @user_task.save\n format.html { redirect_to @user_task, notice: 'User Task was successfully created.' }\n format.json { render json: @user_task, status: :created, location: @user_task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def tasks_post(cbrain_task, opts = {})\n data, _status_code, _headers = tasks_post_with_http_info(cbrain_task, opts)\n data\n end", "def create\n @task = Task.new(params[:task])\n @task.user_id = current_user.id\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:event_id]\n @event = Event.find(params[:event_id])\n if @event.user == current_user\n @task = @event.tasks.create(task_params)\n render json: @task\n else\n render json: { error: \"No such event for user\" }, status: :unauthorized\n end\n else\n @task = @current_user.tasks.create(task_params)\n render json: @task\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n if params[:create_and_continue]\n format.html { redirect_to new_task_url, notice: 'Task was successfully created.' }\n else\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n end\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #puts \"=====\"\n #puts task_params.inspect\n @task = Task.new(task_params)\n \n # add user id.\n @task.user_id = current_user.id\n #puts @task.inspect\n \n # save to db.\n respond_to do |format|\n if @task.save\n #format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.html { redirect_to action: 'index' }\n #format.json { render action: 'show', status: :created, location: @task }\n #format.json { render action: 'index', status: :created }\n else\n format.html { render action: 'new' }\n #format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = @list.tasks.build(task_params)\n\n if @task.save\n return render_success_task_created\n else\n return render_error_save @task\n end\n end", "def create\n task = Task.new(task_params)\n\n if task.save\n render json: task, include: [:user, :column], except: [:user_id, :column_id], status: :created, location: task\n else\n render json: task.errors, status: :unprocessable_entity\n end\n \n end", "def create\n @event_task = @event.event_tasks.new(event_task_params)\n\n respond_to do |format|\n if @event_task.save\n format.html { redirect_to @event_task, notice: 'Event task was successfully created.' }\n format.json { render :show, status: :created, location: @event_task }\n else\n format.html { render :new }\n format.json { render json: @event_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n @task[:authorization_id] = Authorization.current_id\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n @task.user = current_user\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def tasks\n @todos = Todo.all\n render json: @todos\n end", "def create\n @task = Task.new(task_params)\n @task.user_id = current_user.id\n\n respond_to do |format|\n if @task.save\n format.html {redirect_to @task, notice: 'Task was successfully created.'}\n format.json {render :show, status: :created, location: @task}\n else\n format.html {render :new}\n format.json {render json: @task.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @task = Task.new(task_params)\n @task.save\n redirect_to task_path(@task)\n end", "def create\n @task_list = TaskList.new(task_list_params)\n\n if @task_list.save\n render json: @task_list, status: :created, location: @task_list\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end", "def create\n @post_task = PostTask.new(post_task_params)\n\n respond_to do |format|\n if @post_task.save\n format.html { redirect_to @post_task, notice: 'Post task was successfully created.' }\n format.json { render :show, status: :created, location: @post_task }\n else\n format.html { render :new }\n format.json { render json: @post_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = TaskTracker::Task.new(task_params)\n @task.fractal_interface = @user.task_tracker_interface\n\n if @task.save\n render :show, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def create\n @default_task = DefaultTask.new(params[:default_task])\n\n if @default_task.save\n render json: @default_task, status: :created, location: @default_task\n else\n render json: @default_task.errors, status: :unprocessable_entity\n end\n end", "def create\n @task = Task.new(task_params)\n @task.users << current_user\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = \"Task was successfully created.\" if task.save\n respond_with(task)\n end", "def create\n @task = Task.new(task_param)\n @task.user_id = current_user.id\n\n respond_to do |format|\n if @task.save\n format.json { render json: @task, status: :created, location: @task }\n format.js { render }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(action, task=nil, params={})\n @action = action\n @task = task\n request(:post, params)\n end", "def create\n @task = Task.create!(params[:task])\n @task.complete = 0\n if @task.save\n \t#logger.debug \"New task: #{@task.attributes.inspect}\"\n \trespond_to do |format|\n \t\tformat.html {redirect_to tasks_url, notice: 'Task was successfully created.' }\n \t\tformat.js\n \tend\n end\n end", "def create\n task = Task.new(task_params)\n task.save ? respond_with(task) : false\n end", "def create\n @task = Task.new(\n name: params[:task][:name],\n description: params[:task][:description],\n completed_at: params[:task][:completed_at]\n )\n if @task.save\n redirect_to task_path(@task.id)\n else\n render :new\n end\n end", "def create\n @task = Task.new(params[:task])\n if @task.save\n flash[:notice] = 'Task was successfully created.' \n end\n respond_with(@task)\n end", "def create_tasks_with_http_info(task_payload, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.create_tasks ...\"\n end\n # verify the required parameter 'task_payload' is set\n fail ArgumentError, \"Missing the required parameter 'task_payload' when calling DevicesManagementApi.create_tasks\" if task_payload.nil?\n # resource path\n local_var_path = \"/devicemgmt/tasks\".sub('{format}','json')\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 = @api_client.object_to_http_body(task_payload)\n auth_names = ['artikcloud_oauth']\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 => 'TaskEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#create_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @task = current_user.tasks.new(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path, notice: 'Task was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n @feature.tasks << @task\n @iteration.tasks << @task\n @feature.save\n @iteration.save\n get_tasks\n format.js\n format.html { redirect_to(@task, :notice => 'Task was successfully created.') }\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n format.js\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # This prevents \n @task = current_user.tasks.build(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task }\n else\n format.html { render action: 'new' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: '已建立任务.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t @user = User.find(current_user)\n\t @clients = Client.all\n\t @projects = Project.all\n\t @places = Place.all\n\t @types = Type.all\n\t @responsibles = Responsible.all\n\t @task = @user.tasks.create(task_params)\n\n\t redirect_to task_path(@tasks) \n\n end", "def create\n @task = Task.new(task_params)\n @task.creator_id = current_user.id\n @task.workspace_id = current_user.homespace_id\n if @task.save\n render :show, status: :created\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def task_params\n params.require(:task).permit(:task)\n end", "def create\n @taks = Task.new()\n @task.save\n redirect_to task_path(@task)\n end", "def create_task(list_id, text)\n path = \"lists/#{list_id}/tasks\"\n params = {task: {text: text}}\n request(path, params, :post)\n\n # output full list again\n show_list(list_id)\n end", "def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n set_tasks\n format.js { render_index }\n format.json { render :show, status: :created, location: @task }\n else\n format.js { render :index }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task.project, notice: 'Tarefa criada com sucesso.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # 'params_task' returns the value that is authorized by this function\n # rails in default blocks any modifications so we have to give this access\n @task = Task.new(task_params)\n @task.save\n # we don't want to go to a kind of 'create's page' so we are redirecting to\n # out root page\n redirect_to tasks_path(@task)\n end" ]
[ "0.7529737", "0.74976224", "0.7411092", "0.7389878", "0.7261207", "0.72587913", "0.7183996", "0.7147952", "0.71120256", "0.70759165", "0.70639485", "0.70576006", "0.70560944", "0.70294535", "0.7016957", "0.7012058", "0.70110804", "0.7009976", "0.6993863", "0.69896185", "0.69874805", "0.6979071", "0.6959856", "0.69576937", "0.69558054", "0.69531894", "0.69487214", "0.692395", "0.6923908", "0.69125044", "0.69125044", "0.69125044", "0.69125044", "0.69125044", "0.69125044", "0.69125044", "0.69125044", "0.69125044", "0.69053763", "0.69053763", "0.69053763", "0.69053763", "0.6901512", "0.6901512", "0.6901512", "0.68694705", "0.6859745", "0.68524545", "0.68371534", "0.68277967", "0.6816359", "0.6814556", "0.6810082", "0.6806421", "0.6798081", "0.6797092", "0.6797092", "0.67956513", "0.67945486", "0.67939824", "0.6776601", "0.677122", "0.67588496", "0.6754308", "0.67512786", "0.6744059", "0.6737928", "0.6732478", "0.6732421", "0.67183125", "0.670832", "0.6705496", "0.66870415", "0.6680263", "0.66769254", "0.6664806", "0.6664068", "0.66593945", "0.66548383", "0.6652324", "0.66382337", "0.6627153", "0.6623946", "0.6623037", "0.66139346", "0.65943986", "0.6590727", "0.65901965", "0.65810376", "0.65792674", "0.6574959", "0.65713674", "0.6569045", "0.65646166", "0.65613085", "0.6557063", "0.65470684", "0.6545884", "0.6540133", "0.65356857", "0.6533326" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def task_params params.require(:task).permit(:title, :start, :end, :allDay,:genre,:note,:controller,:action,:artist_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def 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
def inc_vote_count increment! :vote_count planet.inc_vote_count, self end def dec_vote_count decrement! :vote_count planet.dec_vote_count, self end
def add_vote_from_user(user) votes.create(user: user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrease_vote_count\n \tcount = voteable.votes_count\n \tcount = count - 1\n \tvoteable.update_attributes(votes_count: count)\n end", "def add_vote\n self.increment!(:votes, 1)\n end", "def increase_vote_count\n \tcount = voteable.votes_count\n \tcount = count + 1\n \tvoteable.update_attributes(votes_count: count)\n end", "def vote_up\n 15\n end", "def upvote\n\t\tvotes = self.nov\n\t\tupdate(nov: votes +1)\n\tend", "def set_vote_tally!\n self.vote_tally = self.get_upvotes.size - self.get_downvotes.size\n end", "def upvote\n self.votes += 1\n save\n end", "def vote up\n end", "def votes_count\n upvotes + downvotes\n end", "def upvote_question\n self.update(votes_count: self.votes_count + 1)\n end", "def vote_up\n update_votes(1)\n end", "def increment_votes\n Article.increment_vote_cache(article_id)\n end", "def vote_down\n 100\n end", "def upvote_count\n self.up_retweet_count\n end", "def total_votes\n self.up - self.down\n end", "def votes\n up_votes - down_votes\n end", "def get_vote_count\n\t\treturn calculate_vote_count\n\tend", "def voted\n new_total = self.votes + 1\n return self.update(votes: new_total)\n end", "def up_votes\n\t#\tself.votes.where(value: 1).count\n\t\tvotes.where(value: 1).count\n\tend", "def vote_count\n self.votes.count\n end", "def vote\n\tend", "def after_create\n election.vote_count = election.vote_count + 1\n election.save\n end", "def tally\n up_votes - down_votes\n end", "def calculate_tallied_votes\n self.tallied_votes = upvotes - downvotes\n self.save\n end", "def get_vote_tally\n return self.get_upvotes.size - self.get_downvotes.size\n end", "def add_vote(vote)\n self.score = self.score + vote.value\n self.votes_count = self.votes_count + 1\n end", "def vote(vtr, value)\n\n original_points = self.point #Record original points to update user \n\n #Check that voter is not self's voter \n return nil if vtr == self.voter\n\n vt = Vote.where(voter_id:vtr.id, voteable_id:self.id).first\n if vt && vt.vote == value\n unvote(vtr,vt)\n return nil\n elsif vt\n self.point -= self.class.options(vt.vote) #Remove old vote points\n vtr.reputation -= self.class.vtback(vt.vote)\n else\n self.count += 1\n vt = Vote.new(voter_id:vtr.id, voteable_id:self.id)\n votes << vt\n end\n\n case value\n when :up ; self.up += 1\n when :down ; self.down += 1\n end\n\n self.point += self.class.options(value) #Add new vote points\n vtr.reputation += self.class.vtback(value)\n self.save\n vtr.save\n\n #Update votee reputation\n self.voter.reputation += self.point - original_points\n self.voter.save\n\n # Set vote to up or down\n vt.vote= value\n vt.save\n return vt\n end", "def quit_vote\n self.decrement!(:votes, 1)\n end", "def up_likes\n self.likes += 1\n end", "def up\n vote_status = $redis.hget(\"#{@instance_type}:#{@instance.id}:votes\", current_user.id).to_i\n same_vote = vote_status != 1\n \n if current_user.credit > Settings.vote_up_limit and current_user.vote_per_day > 0 and same_vote\n if vote_status == -1\n @instance.update_attribute(:votes_count, @instance.votes_count + 1)\n @instance.user.update_attribute(:credit, @instance.user.credit + Settings.vote_down)\n current_user.update_attribute(:credit, current_user.credit + Settings.answer_voter_down) if @instance_type == \"answer\"\n current_user.update_attribute(:vote_per_day, current_user.vote_per_day + 1)\n end\n $redis.hset(\"#{@instance_type}:#{@instance.id}:votes\", current_user.id, 1)\n @instance.update_attribute(:votes_count, @instance.votes_count + 1)\n \n case @instance_type\n when \"question\"\n @instance.user.update_attribute(:credit, @instance.user.credit + Settings.question_vote_up)\n when \"answer\"\n @instance.user.update_attribute(:credit, @instance.user.credit + Settings.answer_vote_up)\n end\n \n current_user.update_attribute(:vote_per_day, current_user.vote_per_day - 1)\n \n case @instance_type\n when \"question\"\n record = Vote.where(:user_id => current_user.id, :question_id => @instance.id).first\n if record\n record.update_attribute(:value, 1)\n else\n Vote.create(:user_id => current_user.id, :question_id => @instance.id, :value => 1)\n end\n when \"answer\"\n record = Vote.where(:user_id => current_user.id, :answer_id => @instance.id).first\n if record\n record.update_attribute(:value, 1)\n else\n Vote.create(:user_id => current_user.id, :answer_id => @instance.id, :value => 1)\n end\n end\n end\n end", "def upvote_count\n self.get_upvotes.size\n end", "def increment_click_count!\n self.increment! :click_count\n end", "def up_votes # We'll want a way to see only \"up\" or \"down\" votes\n self.votes.where(value: 1).count\n end", "def up_votes\n votes.where(value: 1).count\n end", "def up_votes\n votes.where(value: 1).count\n end", "def up_votes\n votes.where(value: 1).count\n end", "def up_votes\n votes.where(value: 1).count\n end", "def total_up_votes\n self.reload\n self.votes.are(:up).count\n end", "def total_up_votes\n self.reload\n self.votes.are(:up).count\n end", "def total_votes\n self.reload\n self.votes.count\n end", "def total_votes\n self.reload\n self.votes.count\n end", "def vote_count\n votes.sum('direction')\n end", "def add_to_count\n @count += 1\n end", "def total_down_votes\n self.reload\n self.votes.are(:down).count\n end", "def total_down_votes\n self.reload\n self.votes.are(:down).count\n end", "def vote_up insert_before_id=false\n register_vote :up, insert_before_id\nend", "def update_vote_count(card)\n card.increment!(:votes)\n self.used_cards.push(self.unused_cards.shift, self.unused_cards.shift)\n end", "def votes_left\n vote_total = 10\n # @submissions = Submission.find_all_by_story_id(params[:id])\n @submissions.each do |submission|\n vote_total -= submission.vote\n end\n vote_total\nend", "def up_votes\n RedisVoteable.redis.scard prefixed(\"#{class_key(self)}:#{UP_VOTES}\")\n end", "def total_votes\n up_votes + down_votes\n end", "def increment \n\t\t@counter = @counter + 1\n\tend", "def vote_down\n update_votes(-1)\n end", "def update_votes(count)\n update votes: @data[:votes] + count do |data|\n self.data = data\n end\n end", "def incr_count\n @count ||= 0\n @count += 1\n end", "def increment\n @counter = @counter + 1\n end", "def thumbs_up\n \t@rank +=1 # => @prank +1\n end", "def total_votes\n self.get_upvotes.size - self.get_downvotes.size\n end", "def upvotes_index\n self.get_upvotes.count\n end", "def votar\n @votos += 1 \n end", "def voteCounter\n\t\t\tcounter = Counter.find_by(champ_name: self.champ_name, champ_gegner: self.champ_gegner)\n\t\t\tvuser = User.find(self.current_user)\n counter.liked_by vuser\n\t\tend", "def upvote\n\t\t\t@review = Review.find(params[:review_id])\n\t\t\t@review.update_attribute(:upvotes, (@review.upvotes + 1))\n\t\tend", "def auto_upvote\n upvote(self.user)\n end", "def vote(voteable, options = {})\n raise ArgumentError, \"you must specify :up or :down in order to vote\" unless options[:direction] && [:up, :down].include?(options[:direction].to_sym)\n direction = (options[:direction].to_sym == :up)\n\n # if options[:exclusive]\n # self.clear_votes(voteable,direction)\n # end\n if options[:id]\n if self.vote_exists?(options[:id]) and !self.voted_which_way? voteable,options[:direction].to_sym\n #Vote.update(options[:id],:vote => direction)\n vote_obj = Vote.find(options[:id])\n \n vote_count_obj = VoteCount.find(self.fetch_vote_counter(voteable).id)\n if direction == true\n count = vote_count_obj.vote_count_positive + 1\n # if\n negative_count = vote_obj.vote == false ? vote_count_obj.vote_count_negative - 1 : vote_count_obj.vote_count_negative\n #end\n vote_count_obj.update_attributes(:vote_count => self.fetch_updated_vote_count(voteable, direction), :vote_count_positive => count, :vote_count_negative => negative_count)\n else\n count = vote_count_obj.vote_count_negative + 1\n positive_count = vote_obj.vote == true ? vote_count_obj.vote_count_positive - 1 : vote_count_obj.vote_count_positive\n vote_count_obj.update_attributes(:vote_count => self.fetch_updated_vote_count(voteable, direction), :vote_count_negative => count, :vote_count_positive => positive_count)\n end\n vote_obj.update_attributes(:vote => direction)\n #VoteCount.update(self.fetch_vote_counter(voteable).id, :vote_count => self.fetch_updated_vote_count(voteable, direction))\n end\n else\n #:voteable_type => voteable.class.name, :voteable_id => voteable.id,\n Vote.create!(:vote => direction, :voteable => voteable, :voter => self)\n if fetch_vote_counter(voteable).nil?\n VoteCount.create!(:vote_count => (direction ? 1 : -1), :voteable => voteable, :vote_count_positive => (direction ? 1 : 0), :vote_count_negative => (direction ? 0 : 1))\n else\n vote_count_obj = VoteCount.find(self.fetch_vote_counter(voteable).id)\n if direction == true\n count = vote_count_obj.vote_count_positive + 1\n vote_count_obj.update_attributes(:vote_count => self.fetch_updated_vote_count(voteable, direction), :vote_count_positive => count)\n else\n count = vote_count_obj.vote_count_negative + 1\n vote_count_obj.update_attributes(:vote_count => self.fetch_updated_vote_count(voteable, direction), :vote_count_negative => count)\n end\n # VoteCount.update(self.fetch_vote_counter(voteable).id, :vote_count => self.fetch_updated_vote_count(voteable, direction))\n end\n end\n end", "def vote\n value = params[:type] == \"up\" ? 1 : -1\n @post.add_or_update_evaluation(:votes, value, current_user)\n redirect_to :back\n end", "def pv_up\n self.update!(pv: pv + 1)\n end", "def update_rating!\n # not using count because lates some votes might be something other than +/- 1\n self.positive_vote_count = votes.positive.sum(:value).abs\n self.negative_vote_count = votes.negative.sum(:value).abs\n self.rating = votes.sum(:value)\n save!\n end", "def decrease(counter)\r\n counter - 1\r\nend", "def up_votes\n # we find the up votes for a post by passing value: 1 to where. This fetches a collection of votes with a value of 1. \n # We then call count on the collection to get a total of all up votes.\n votes.where(value: 1).count\n end", "def uvote\n question = Question.find(params[:question_id])\n if params[:action].to_i == 1\n question.upvote += 1\n else\n question.downvote += 1\n end\n question.save!\n\n render :json => {:success => 1}\nend", "def decrease(counter)\n counter - 1\nend", "def decrease(counter)\n counter - 1\nend", "def decrease(counter)\n counter - 1\nend", "def decrease(counter)\n counter - 1\nend", "def decrease(counter)\n counter - 1\nend", "def upvote\n @vote[:direction] = true\n @vote.save!\n redirect_to :back\n end", "def score\n \tself.get_upvotes.size - self.get_downvotes.size\n end", "def repute_vote_up(voter)\n Reputation.handle(self, :vote_up, self.person, :sender => voter, :tier => self.tier)\n end", "def upvote\n\t@post = Post.find(params[:id])\n\t@post.votes = @post.votes + 1\n puts @post.votes\n\n\n\n\trespond_to do |format|\n if @post.update(post_par2)\n\t\tformat.html { redirect_to @post, notice: 'Post was successfully upvoted.' }\n\t\tformat.json { render :show, status: :ok, location: @post }\n end\n\tend\n end", "def increment(points_count)\n\t\t@story_count += 1\n\t\t@points_count += points_count\n\tend", "def score\n\t\tupvotes.count\n\tend", "def increment_counter\n unless self.count.nil?\n self.count += 1\n else\n self.count = 1\n end\n end", "def toggle_up_video_count\n self.videos_checked_out_count += 1\n\n self.save\n\n return self.videos_checked_out_count\n end", "def decrease(counter)\n counter -= 1\nend", "def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end", "def up_down_votes\n Vote.seperate_votes(self.votes)\n end", "def decrement\n @counter = @counter - 1\n end", "def score\n \tself.get_upvotes.size - self.get_downvotes.size\n\tend", "def vote(value)\n args = self.state_properties\n args[:vote] += value[0]\n self.state_properties=args\n end", "def increment_click_count\n update(click_count: click_count + 1)\n end", "def total_votes\n \tself.shout_votes.count\n end", "def remove_vote(vote)\n self.score = self.score - vote.value\n self.votes_count = self.votes_count - 1\n end", "def number_of_votes\n self.votes.size\n end", "def plusminus\n respond_to?(:plusminus_tally) ? plusminus_tally : (votes_for - votes_against)\n end", "def upVote\n current_brother.upVote(@rushee)\n redirect_to :back\n end", "def score\n self.up_votes - self.down_votes\n end", "def decrement_counter(following)\n User.decrement_counter(:followings_count,following.user_id)\n User.decrement_counter(:inverse_followings_count,following.follower_id) \n end", "def add_review_votes_to_review\n # increment the count of votes regardless of stance\n if self.review.helpful_count.nil?\n self.review.helpful_count = 1\n else\n self.review.helpful_count += 1\n end\n\n # adjust the score to incorporate the up-vote, if it's an up-vote\n if self.helpful?\n if self.review.helpful_score.nil?\n self.review.helpful_score = 1\n else\n self.review.helpful_score += 1\n end\n end\n \n self.review.save!\n end", "def upvote(current, category)\n\tif category.capitalize == \"Cats\"\n\t\tcurrent = current * 5\n\telsif category.capitalize == \"Bacon\"\n\t\tcurrent = current * 8\n\telsif category.capitalize == \"Food\"\n\t\tcurrent = current * 3\n\tend\n\n\t# Returns the number of upvotes\n\treturn current\nend", "def new_vote(vote, votable, voter)\n vote == 'up' ? votable.upvote_by(voter) : votable.downvote_by(voter)\n change_carma(vote, votable, voter,\n ex_up: 2, ex_down: -1, ph_up: 4, ph_down: -2, usr: 1)\n flash[:notice] = 'Thank you for your vote.'\n end", "def increment_count(current_count)\n current_count.to_i + 1\n end", "def increment\n @value += 1\n end" ]
[ "0.77159476", "0.768117", "0.7681033", "0.7553056", "0.7552907", "0.75069547", "0.74648917", "0.74441564", "0.73987687", "0.7398378", "0.72785795", "0.72116786", "0.7199402", "0.717111", "0.71554273", "0.7087474", "0.70762724", "0.7048536", "0.7002394", "0.699287", "0.6902745", "0.68999946", "0.6895385", "0.6889182", "0.6875611", "0.6807704", "0.68027014", "0.6787695", "0.6718473", "0.6717778", "0.6692718", "0.66669816", "0.6651863", "0.66450745", "0.66450745", "0.66450745", "0.66450745", "0.66414124", "0.66414124", "0.6615924", "0.6615924", "0.6579712", "0.65422046", "0.652323", "0.652323", "0.6509201", "0.6499073", "0.6492072", "0.6484839", "0.64846045", "0.6484443", "0.6481146", "0.6479954", "0.64714396", "0.646592", "0.6449997", "0.64324665", "0.64205277", "0.6414206", "0.63981223", "0.6390737", "0.63838947", "0.6381512", "0.6374695", "0.63712996", "0.6367986", "0.63577235", "0.6355683", "0.63500684", "0.633814", "0.633814", "0.633814", "0.633814", "0.633814", "0.6328289", "0.6311029", "0.6310064", "0.6309056", "0.6301349", "0.629771", "0.6296281", "0.6293394", "0.62900037", "0.62750053", "0.62703365", "0.6269326", "0.626912", "0.6263908", "0.6252454", "0.6245765", "0.62411", "0.62274575", "0.62151796", "0.6205394", "0.62023824", "0.62015176", "0.61976475", "0.6179915", "0.6170445", "0.61633754", "0.6149735" ]
0.0
-1
Get tags for an S3 bucket
def get_bucket_tagging(bucket_name) unless bucket_name raise ArgumentError.new('bucket_name is required') end request({ :expects => 200, :headers => {}, :bucket_name => bucket_name, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::AWS::Storage::GetBucketTagging.new, :query => {'tagging' => nil} }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objects\n bucket_obj = Aws::S3::Bucket.new(name: bucket, client: s3_client)\n bucket_obj.objects( prefix: prefix)\n end", "def list_s3_buckets()\n\n s3 = connect_to_s3()\n response = s3.list_buckets\n\n response.buckets.each do |bucket|\n puts \"#{bucket.creation_date} #{bucket.name}\"\n end\n\nend", "def list\n ::Taxi::S3.instance.list_buckets\n end", "def buckets\n response = send_s3_request\n parser = Awsum::S3::BucketParser.new(self)\n parser.parse(response.body)\n end", "def keys(bucket_name, options = {})\n paramters = {}\n paramters['prefix'] = options[:prefix] if options[:prefix]\n paramters['marker'] = options[:marker] if options[:marker]\n paramters['max_keys'] = options[:max_keys] if options[:max_keys]\n paramters['prefix'] = options[:prefix] if options[:prefix]\n\n response = send_s3_request('GET', :bucket => bucket_name, :paramters => paramters)\n parser = Awsum::S3::ObjectParser.new(self)\n parser.parse(response.body)\n end", "def ls(bucket)\n ::Taxi::S3.instance.ls(bucket)\n end", "def list_my_buckets(s3)\n resp = s3.list_buckets\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def list_my_buckets(s3)\n resp = s3.list_buckets()\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def list_buckets\n s3 = Aws::S3::Client.new(\n region: 'us-east-1'\n )\n resp = s3.list_buckets({})\n # get the total number of buckets\n num_buckets = resp.buckets.length\n # loop through and puts name\n num_buckets.times do |i|\n puts resp.buckets[i].name.colorize(:light_magenta).colorize(:background => :black)\n end\nend", "def retrieve_objects_via_http(bucket)\n _log 'Retrieving objects via unauthenticated method.'\n r = http_request :get, \"https://#{bucket}.s3.amazonaws.com\"\n if r.code != '200'\n _log 'Failed to retrieve any objects using the unauthenticated technique as bucket listing is disabled.'\n return\n end\n\n xml_doc = Nokogiri::XML(r.body)\n xml_doc.remove_namespaces!\n results = xml_doc.xpath('//ListBucketResult//Contents//Key').children.map(&:text)\n results[0...999] # return first 1k results as some buckets may have tons of objects\n\n # format before\n results.reject! { |b| b =~ %r{.+/$} } unless results.nil? # remove folder names if bucket_objs is not nil\n results unless results.empty? \n end", "def get_s3_bucket_object(bucket_name)\n resource.bucket(bucket_name)\n end", "def aws_S3_bucket_get(opts)\n AWS::S3.new.buckets[opts[:name]]\n end", "def list_s3_bucket_files(bucket)\n\n s3 = connect_to_s3()\n resp = s3.list_objects_v2(bucket: bucket)\n counter = 1\n\n resp.contents.each do |obj|\n puts \"#{bucket} bucket file #{counter}: #{obj.key}\"\n counter += 1\n end\n\nend", "def tagBucket\n tagset = []\n\n MU::MommaCat.listStandardTags.each_pair { |key, value|\n tagset << { :key => key, :value => value }\n }\n\n if @config['tags']\n @config['tags'].each { |tag|\n tagset << { :key => tag['key'], :value => tag['value'] }\n }\n end\n\n if @config['optional_tags']\n MU::MommaCat.listOptionalTags.each { |key, value|\n tagset << { :key => key, :value => value }\n }\n end\n\n MU::Cloud::AWS.s3(credentials: @config['credentials'], region: @config['region']).put_bucket_tagging(\n bucket: @cloud_id,\n tagging: {\n tag_set: tagset\n }\n )\n\n end", "def list_objects(s3_client, bucket_name)\r\n response = s3_client.list_objects_v2(bucket: bucket_name)\r\n if response.contents.count.zero?\r\n puts 'No objects.'\r\n else\r\n response.contents.each do |object|\r\n puts object.key\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error listing objects: #{e.message}\"\r\nend", "def []( bucket_name, opts = {} )\n jbucket = @jservice.get_bucket( bucket_name )\n S3Bucket.new( self, jbucket, opts )\n end", "def find(key, bucket = nil)\n # N.B. This is arguably a hack. From what the current S3 API exposes, when you retrieve a bucket, it\n # provides a listing of all the files in that bucket (assuming you haven't limited the scope of what it returns).\n # Each file in the listing contains information about that file. It is from this information that an S3Object is built.\n #\n # If you know the specific file that you want, S3 allows you to make a get request for that specific file and it returns\n # the value of that file in its response body. This response body is used to build an S3Object::Value object. \n # If you want information about that file, you can make a head request and the headers of the response will contain \n # information about that file. There is no way, though, to say, give me the representation of just this given file the same \n # way that it would appear in a bucket listing.\n #\n # When fetching a bucket, you can provide options which narrow the scope of what files should be returned in that listing.\n # Of those options, one is <tt>marker</tt> which is a string and instructs the bucket to return only object's who's key comes after\n # the specified marker according to alphabetic order. Another option is <tt>max-keys</tt> which defaults to 1000 but allows you\n # to dictate how many objects should be returned in the listing. With a combination of <tt>marker</tt> and <tt>max-keys</tt> you can\n # *almost* specify exactly which file you'd like it to return, but <tt>marker</tt> is not inclusive. In other words, if there is a bucket\n # which contains three objects who's keys are respectively 'a', 'b' and 'c', then fetching a bucket listing with marker set to 'b' will only\n # return 'c', not 'b'. \n #\n # Given all that, my hack to fetch a bucket with only one specific file, is to set the marker to the result of calling String#previous on\n # the desired object's key, which functionally makes the key ordered one degree higher than the desired object key according to \n # alphabetic ordering. This is a hack, but it should work around 99% of the time. I can't think of a scenario where it would return\n # something incorrect.\n \n # We need to ensure the key doesn't have extended characters but not uri escape it before doing the lookup and comparing since if the object exists, \n # the key on S3 will have been normalized\n key = key.remove_extended unless key.valid_utf8?\n bucket = Bucket.find(bucket_name(bucket), :marker => key.previous, :max_keys => 1)\n # If our heuristic failed, trigger a NoSuchKey exception\n if (object = bucket.objects.first) && object.key == key\n object \n else \n raise NoSuchKey.new(\"No such key `#{key}'\", bucket)\n end\n end", "def list_buckets(s3_client)\r\n response = s3_client.list_buckets\r\n if response.buckets.count.zero?\r\n puts 'No buckets.'\r\n else\r\n response.buckets.each do |bucket|\r\n puts bucket.name\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error listing buckets: #{e.message}\"\r\nend", "def list_buckets\n puts '> AWS Buckets'.yellow\n response = s3_client.list_buckets\n buckets = response.buckets.map do |bucket|\n \"#{bucket.name.yellow} - created: #{bucket.creation_date.to_s.greenish}\"\n end\n buckets.each do |bucket|\n puts bucket\n end\n end", "def s3_bucket\n Lono::S3::Bucket.name\n end", "def get_aws(name)\n buckets.fetch(name)\n rescue KeyError\n puts \"No S3 bucket named #{name}\"\n exit\n end", "def bucket; ::AWS::S3.new( { :secure => false } ).buckets[DC::SECRETS['bucket']]; end", "def s3_bucket(name)\n s3_client.buckets[name]\n end", "def ls(bucket)\n puts \"> AWS Bucket: ls #{bucket}\".yellow\n response = s3_client.list_objects_v2(bucket: bucket)\n files = response.contents\n files_str = files.map do |entry|\n \"#{entry.last_modified.to_s.greenish}\\t#{entry.size.to_s.blueish}\\t#{entry.key.yellow}\"\n end\n files_str.each do |entry|\n puts entry\n end\n end", "def buckets( opts = {} )\n jbuckets = @jservice.list_all_buckets\n jbuckets.map { |jb| S3Bucket.new( self, jb, opts ) }\n end", "def bucket; ::AWS::S3.new({ secure: true }).buckets[DC::SECRETS['bucket']]; end", "def s3_bucket(bucket, **opt)\n s3_resource(**opt).bucket(bucket)\n end", "def [] bucket_name\n bucket_named(bucket_name)\n end", "def aws_list_objects(bucket, filter = nil, **opt)\n __debug_items(binding)\n meth = opt.delete(:meth) || calling_method\n client = opt.delete(:client)\n client ||= (bucket.client if bucket.is_a?(Aws::S3::Bucket))\n client ||= s3_client(**opt)\n params = { bucket: bucket }\n filter =\n case filter.presence\n when nil then nil # No filter means list all objects in the bucket.\n when '*' then nil # An explicit request for all objects.\n when /\\.$/ then filter\n when /\\.\\*$/ then filter.delete_suffix('*')\n else \"#{filter}.\"\n end\n # @type [Aws::S3::Types::ListObjectsV2Output] response\n response = client.list_objects_v2(params, **opt)\n result = Array.wrap(response.contents)\n filter ? result.select { |obj| obj.key.start_with?(filter) } : result\n rescue => error\n set_error(error)\n # noinspection RubyScope\n Log.warn { \"#{meth}: AWS S3 failure: #{error.class}: #{error.message}\" }\n end", "def bucket\n begin\n # Find existing bucket:\n bucket = service.buckets.find(s3_bucket)\n rescue ::S3::Error::NoSuchBucket => e\n # Apparently the bucket doesn't exist yet, so create a new one:\n bucket = service.buckets.build(s3_bucket)\n bucket.save\n end\n bucket.retrieve\n end", "def get(bucket:, path:, access_key_id:, secret_access_key:, token: nil, region: nil)\n region ||= 'us-east-1' # Most buckets.\n path = path[1..-1] if path[0] == '/'\n\n verb = 'GET'\n uri_path = \"/#{bucket}/#{path}\"\n body = ''\n\n datetime = Time.now.utc.strftime('%Y%m%dT%H%M%SZ')\n date = datetime[0,8]\n\n c_scope = _credential_scope(date, region)\n credential = \"#{access_key_id}/#{c_scope}\"\n\n algorithm = 'AWS4-HMAC-SHA256'\n\n if region == 'us-east-1'\n hostname = 's3.amazonaws.com'\n else\n hostname = \"s3-#{region}.amazonaws.com\"\n end\n\n headers = {\n 'host' => hostname,\n 'x-amz-content-sha256' => hexdigest(body),\n 'x-amz-date' => datetime,\n 'x-amz-expires' => '900', # 15 minutes\n }\n headers['x-amz-security-token'] = token if token\n\n canonical_request = _canonical_request(verb: verb, path: uri_path,\n querystring: '', headers: headers,\n content_hash: hexdigest(body))\n signed_headers = headers.keys.sort.join(';')\n\n to_sign = _string_to_sign(datetime, c_scope, canonical_request)\n signed = _signature(secret_access_key, date, region, 's3', to_sign)\n\n headers['authorization'] = \"#{algorithm} Credential=#{credential}, SignedHeaders=#{signed_headers}, Signature=#{signed}\"\n\n # Debug information useful if the signature is wrong\n Chef::Log.debug { \"CanonicalRequest: \" + canonical_request.inspect }\n Chef::Log.debug { \"StringToSign: \" + to_sign.inspect }\n Chef::Log.debug { \"headers: \" + headers.inspect }\n\n client = Chef::HTTP.new(\"https://#{hostname}\")\n begin\n content = client.get(uri_path[1..-1], headers)\n rescue Net::HTTPServerException => e\n raise CitadelError.new(\"Unable to download #{path}: #{e}\")\n end\n\n response = client.last_response\n\n case response\n when Net::HTTPOK\n return content\n when Net::HTTPRedirection\n # When you request a bucket at the wrong region endpoint, S3 returns an\n # HTTP 301, but it doesn't set a Location header, so chef doesn't\n # follow it and returns a nil response.\n true_region = response.header['x-amz-bucket-region']\n raise CitadelError.new(\n \"Bucket #{bucket} is actually in #{true_region}, not #{region}\")\n else\n Chef::Log.warn(\"Unexpected HTTP response: #{response.inspect}\")\n Chef::Log.warn(\"Response body: #{response.body.inspect}\")\n raise CitadelError.new(\"Unexpected HTTP response: #{response.inspect}\")\n end\n end", "def list_bucket(bucket, options={}, headers={})\n path_args = {}\n options.each { |k, v|\n path_args[k] = v.to_s\n }\n\n return ListBucketResponse.new(make_request('GET', bucket, '', path_args, headers))\n end", "def upload_bucket\n ::AWS::S3.new( { :secure => false } ).buckets['s3.documentcloud.org']\n end", "def aws_S3_object_get_and_read(bucket, name)\n log \"AWS: getting S3Object 'name'\"\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n log \"AWS: reading S3Object '#{object.key}'\"\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end", "def get_bucket_info\n bucket = \"#{ENV['S3_BUCKET_PREFIX']}#{ENV['S3_BUCKET_SEPARATOR']}#{ENV['SERVER_NAME']}\"\n output = (`#{ENV['S3CMD_PATH']} du s3://#{bucket}`).split(' ')\n return [output[0], output[1]]\nend", "def bucket_meta_objects(bucket_name, *args)\n options = {\n :delimeter => nil,\n :marker => nil,\n :max_keys => nil,\n :prefix => nil\n }\n options.merge!(args.pop) if args.last.is_a? Hash\n\n path = \"/?\"\n path << \"delimeter=#{options[:delimeter]}&\" if !options[:delimeter].nil?\n path << \"marker=#{options[:marker]}&\" if !options[:marker].nil?\n path << \"max-keys=#{options[:max_keys]}&\" if !options[:max_keys].nil?\n path << \"prefix=#{options[:prefix]}&\" if !options[:prefix].nil?\n path.gsub!(/[&]$/, '')\n\n hpr = Hpricot(connection.get(path, bucket_name))\n hpr.search(\"contents\").map do |el|\n BucketMetaObject.new(\n {\n :bucket_name => bucket_name,\n :key => el.search(\"key\").inner_html,\n :last_modified => el.search(\"lastmodified\").inner_html,\n :e_tag => el.search(\"etag\").inner_html,\n :size => el.search(\"size\").inner_html,\n :storage_class => el.search(\"storageclass\").inner_html,\n :owner_id => el.search(\"id\").inner_html,\n :owner_display_name => el.search(\"displayname\").inner_html\n }\n )\n end\n end", "def list_bucket(bucket, options={}, headers={})\n path_args = {}\n options.each { |k, v|\n path_args[k] = v.to_s\n }\n return generate_url('GET', bucket, '', path_args, headers)\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n list_bucket_objects(s3_client, bucket_name)\r\nend", "def s3_bucket\n photo.s3_bucket\n end", "def show\n client = Aws::S3::Client.new(\n region: Rails.application.credentials.aws[:aws_region],\n access_key_id: Rails.application.credentials.aws[:access_key_id],\n secret_access_key: Rails.application.credentials.aws[:secret_access_key])\n @objects = client.list_objects({bucket:'awsprojectbuckett'}).contents\n end", "def checkBucket(bucket, client)\n\tbegin\n\t\tresp = client.list_objects({ bucket: bucket })\n\trescue Aws::S3::Errors::NoSuchBucket => err\n\t\t# Catching errors case name informed is wrong\n\t\tputs \"#{err}!\" \n\t\tresp = client.list_buckets\n\t\t# Informe current buckets\n\t\tputs \"Valid buckets currently are: \"\n\t\tresp.buckets.map(&:name).each do |item|\n\t\t\tputs \"=> #{item}\"\n\t\tend\n\t\texit\n\tend\n\treturn resp\nend", "def get_bucket(bucket_name, options={})\n resp = get(bucket_name, '/', options)\n resp_obj = Crack::XML.parse(resp.body)\n if resp.code == \"200\"\n resp_obj[:success] = true\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = \"Bucket retrieved successfully\"\n contents = resp_obj[\"ListBucketResult\"][\"Contents\"] ? Array.new : nil\n resp_obj[\"ListBucketResult\"][\"Contents\"].is_a?(Array) ? \\\n (contents = resp_obj[\"ListBucketResult\"][\"Contents\"]) : \\\n (contents[0] = resp_obj[\"ListBucketResult\"][\"Contents\"]) unless contents.nil?\n resp_obj[:contents] = contents\n resp_obj[:raw] = Crack::XML.parse(resp.body)\n resp_obj.each_key {|key| resp_obj.delete(key) unless [:success, :bucket_name, :message, :contents, :raw].include?(key) }\n\n else\n resp_obj[:success] = false\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = resp_obj[\"Error\"][\"Message\"]\n resp_obj[:contents] = nil\n resp_obj[:code] = resp_obj[\"Error\"][\"Code\"]\n resp_obj[:raw] = Crack::XML.parse(resp.body)\n resp_obj.each_key {|key| resp_obj.delete(key) unless [:success, :bucket_name, :message, :contents, :code, :raw].include?(key) }\n\n end\n return resp_obj\n end", "def s3_bucket(bucket_name)\n S3Bucket.new(bucket_name)\n end", "def fetch_s3(package)\n\tbucket = $s3client.bucket(\"rogoodpractice\")\n\t\n\t# get all objects\n obs = bucket.objects;\n \n # pull out those matching package name\n obs = obs.select { |a| a.key.match(/#{package}/) };\n\n # pull out those with .txt files\n obstxt = obs.select { |a| a.key.match(/\\.txt/) }\n\n # pull out latest file by timestamp\n\ttarget = obstxt.max_by { |a| a.last_modified }\n\n\t# get URL\n\ttarget.temporary_url\nend", "def object_content_by_bucket_unsigned_request(bucket_name, region)\r\n bucket_path = \"https://s3.#{region}.amazonaws.com/#{bucket_name}\"\r\n response = Net::HTTP.get(URI(bucket_path))\r\n puts \"Content of unsigned request to '#{bucket_path}':\\n\\n#{response}\\n\\n\"\r\nend", "def tags(query = {})\n Request.new(self, '/cdn/tags', query).get\n end", "def tags(query = {})\n Request.new(self, '/cdn/tags', query).get\n end", "def aws_tags_list\n @aws.tags\n end", "def s3_object\n @s3_object ||= bucket.objects[full_key]\n end", "def aws_S3_object_get_and_read_no_log(bucket, name)\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end", "def ls(bucket) # s3://BUCKET[/PREFIX]]\n send_command \"ls\", bucket\n end", "def list_objects(key)\n\n puts \"Objects in bucket #{@bucket_name}/#{key}:\"\n files = @client.buckets[@bucket_name].objects.with_prefix(key)\n\n resp = files.each do |o|\n puts \"\\t#{o.key} => #{o.etag}\"\n end\n end", "def files bucket_name\n body_wrap = b2_list_file_names bucketId: (bucket_id bucket_name: bucket_name)\n # ignoring the top-level {files:, nextFileName:} structure\n body_wrap.files\n end", "def list_bucket_objects(s3_client, bucket_name, max_objects = 50)\r\n if max_objects < 1 || max_objects > 1000\r\n puts 'Maximum number of objects to request must be between 1 and 1,000.'\r\n return\r\n end\r\n\r\n objects = s3_client.list_objects_v2(\r\n bucket: bucket_name,\r\n max_keys: max_objects\r\n ).contents\r\n\r\n if objects.count.zero?\r\n puts \"No objects in bucket '#{bucket_name}'.\"\r\n return\r\n else\r\n if objects.count == max_objects\r\n puts \"First #{objects.count} objects in bucket '#{bucket_name}':\"\r\n else\r\n puts \"Objects in bucket '#{bucket_name}':\"\r\n end\r\n objects.each do |object|\r\n puts object.key\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error accessing bucket '#{bucket_name}' \" \\\r\n \"or listing its objects: #{e.message}\"\r\nend", "def bucket_field\n 'bucket'\n end", "def bucket_and_key(url)\n if url =~ /s3:\\/\\/([^\\/]+)\\/?(.*)/\n bucket = $1\n key = $2\n elsif url =~ /([^:]+):(.*)/\n bucket = $1\n key = $2\n end\n [bucket, key]\n end", "def getBucketsList\n begin\n s3 = createS3Connection\n list = s3.buckets.collect(&:name)\n buckets_array = []\n\n #for each S3 bucket collect statistics\n list.each do |bucket_name|\n obj_count = 0\n total_size = 0\n bucket = s3.buckets[bucket_name]\n\n #for each object in the bucket\n bucket.objects.each do |obj|\n obj_count +=1\n total_size += obj.content_length\n end\n\n #convert total_size from bytes to MB\n total_size = (total_size / 1024.0).round(2)\n #build the array of buckets\n buckets_array.push({:name => bucket_name, :objects => obj_count, :size => total_size})\n end\n return buckets_array\n rescue Exception => error\n return createEmptyBucketsArray\n flash.now[:danger] = \"<strong>Success!</strong>\".html_safe + \" Problem creating S3 buckets list: #{error}.\"\n end\n end", "def load_from_s3(bucket)\n suspended = s3_object(\"suspended.json\").read\n return JSON.parse(suspended)\n end", "def find_bucket(bucket_name)\n if bucket = AWS::S3::Bucket.find(bucket_name)\n puts \"Bucket #{bucket_name} found.\"\n bucket\n else\n puts \"The bucket #{bucket_name} could not be found\"\n nil\n end\nend", "def get(key)\n s3_read key\n end", "def s3_files\n S3File.find_by_project_name(folder_name + \"/\") unless folder_name.nil?\n end", "def get_bucket_logging(bucket_name)\n unless bucket_name\n raise ArgumentError.new('bucket_name is required')\n end\n request({\n :expects => 200,\n :headers => {},\n :bucket_name => bucket_name,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::Parsers::AWS::Storage::GetBucketLogging.new,\n :query => {'logging' => nil}\n })\n end", "def retrieve_objects_via_api(client, bucket)\n _log 'Retrieving objects via authenticated method.'\n begin\n objs = client.list_objects_v2(bucket: bucket).contents.collect(&:key) # maximum of 1000 objects\n rescue Aws::S3::Errors::AccessDenied, Aws::S3::Errors::AllAccessDisabled\n objs = []\n _log_error 'Could not retrieve bucket objects using the authenticated technique due to insufficient permissions.'\n end\n\n objs.reject! { |b| b =~ %r{.+/$} } unless objs.nil? # remove folder names if bucket_objs is not nil\n objs unless objs.empty? # force a nil return if an empty array as we are catching the nil reference\n end", "def s3_bucket\n return @s3_bucket if defined? @s3_bucket\n\n s3 = AWS::S3.new(@task.aws_config)\n @s3_bucket = s3.buckets[@task.bucket]\n end", "def bucket bucket_name\n resp = connection.get_bucket bucket_name\n if resp.success?\n Bucket.from_gapi resp.data, connection\n else\n return nil if resp.data[\"error\"][\"code\"] == 404\n fail ApiError.from_response(resp)\n end\n end", "def list_buckets(count)\n puts \"Found these buckets:\"\n @s3_resource.buckets.each do |bucket|\n puts \"\\t#{bucket.name}\"\n count -= 1\n break if count.zero?\n end\n true\n rescue Aws::Errors::ServiceError => e\n puts \"Couldn't list buckets. Here's why: #{e.message}\"\n false\n end", "def buckets\n resp = connection.list_buckets\n if resp.success?\n resp.data[\"items\"].map do |gapi_object|\n Bucket.from_gapi gapi_object, connection\n end\n else\n fail ApiError.from_response(resp)\n end\n end", "def info(bucket) # s3://BUCKET[/OBJECT]\n send_command \"info\", bucket\n end", "def get(local_path, s3_path, bucket)\n client.get_object(\n response_target: local_path,\n bucket: bucket,\n key: s3_path)\n end", "def search(bucket, pattern)\n return [] if bucket.nil?\n\n begin\n pattern = /#{pattern}/ unless pattern.kind_of? Regexp\n s3.list_objects(bucket: bucket).contents.select do |o|\n o.key =~ pattern || /#{o.key}/ =~ pattern.to_s\n end\n rescue Aws::S3::Errors::NoSuchBucket => e\n logger.info format_error_message e\n return # log that the bucket doesn't exist but don't explode\n end\n end", "def read(key)\n bucket.objects[key].read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end", "def get_bucket(bucket_id:)\n path = '/storage/buckets/{bucketId}'\n .gsub('{bucketId}', bucket_id)\n\n if bucket_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"bucketId\"')\n end\n\n params = {\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::Bucket\n )\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n list_object_acls(s3_client, bucket_name, object_key)\r\nend", "def print_bucket(name)\n msg \"#{bucket_name(name)} Bucket\"\n AWS::S3::Bucket.find(bucket_name(name)).objects.each do |o| \n puts \"size: #{o.size/1.megabyte}MB, Name: #{o.key}, Last Modified: #{o.last_modified.to_s(:short)} UTC\"\n end\n rescue AWS::S3::NoSuchBucket\n end", "def bucket\n @bucket ||= connection.directories.get(@bucket_name, :prefix => @prefix)\n end", "def aws_list_object_keys(bucket, filter = nil, **opt)\n unless filter.blank? || (filter == '*') || filter.match?(/\\.\\*?$/)\n return [filter] if filter.remove(%r{^.*/}).include?('.')\n end\n aws_list_objects(bucket, filter, **opt)&.map(&:key) || []\n end", "def get_bucket_versioning(bucket_name)\n unless bucket_name\n raise ArgumentError.new('bucket_name is required')\n end\n request({\n :expects => 200,\n :headers => {},\n :bucket_name => bucket_name,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::Parsers::AWS::Storage::GetBucketVersioning.new,\n :query => {'versioning' => nil}\n })\n end", "def find_bucket(bucket)\n begin\n Bucket.find(bucket) \n rescue NoSuchBucket\n S3.create_bucket(bucket)\n find_bucket(bucket)\n end\n end", "def bucket\n @gapi[\"bucket\"]\n end", "def find_bucket bucket_name\n resp = connection.get_bucket bucket_name\n if resp.success?\n Bucket.from_gapi resp.data, connection\n else\n return nil if resp.data[\"error\"][\"code\"] == 404\n fail ApiError.from_response(resp)\n end\n end", "def find_bucket bucket_name\n resp = connection.get_bucket bucket_name\n if resp.success?\n Bucket.from_gapi resp.data, connection\n else\n return nil if resp.data[\"error\"][\"code\"] == 404\n fail ApiError.from_response(resp)\n end\n end", "def s3_info()\n verbose_or_debug_msg(\"Checking S3 resources in all regions for profile \\\"#{$profile}\\\"\")\n s3_resource=Aws::S3::Resource.new(region: \"eu-west-1\", credentials: $credentials)\n if $audit_mode\n opfile=File.open(\"#{$audit_dir}/all/s3_buckets\",\"w\")\n else\n opfile=$stdout\n end\n \n # If we've not specified details, then simply list the buckets and return.\n if ! $s3_details\n s3_resource.buckets.each do |b|\n if not $quiet\n opfile.print(\"\\\"#{$profile}\\\",\\\"S3 Bucket\\\",\\\"All\\\",\\\"#{b.name}\\\",\\\"#{b.creation_date}\\\"\\n\")\n end\n $bucket_count+=1\n end\n return\n end\n \n # get a list of buckets:\n debug_msg(\"Generating a list of all buckets:\\n\")\n all_buckets=Hash.new()\n s3_resource.buckets.each do |bucket|\n all_buckets[bucket.name] = false\n end\n all_buckets.each do |b|\n debug_msg (\"#{b}\")\n end\n\n # Attempt to show all objects in each bucket - this is region-dependent - see comment above\n $regions.each do |region|\n begin\n s3_resource=Aws::S3::Resource.new(region: region, credentials: $credentials)\n s3_resource.buckets.each do |bucket|\n total_size=0\n if all_buckets[bucket.name] == false\n bucket.objects.each do |object|\n total_size+=object.size\n end\n end\n if not $quiet\n print(\"\\\"#{$profile}\\\",\\\"s3 bucket\\\",\\\"#{region}\\\",\\\"#{bucket.name}\\\",\\\"#{total_size}\\\"\\n\")\n all_buckets[bucket.name]=true\n end\n end\n $bucket_count+=1\n rescue Aws::S3::Errors::ServiceError => err\n debug_msg(\"#{err.inspect()}\\n\")\n end\n end\nend", "def list_objects(bucket_name, options={})\n params = { maxKeys: 1000 }\n params.merge! options\n send_request(GET, bucket_name, params)\n end", "def get_s3_object(bucket_name, object_name)\n s3_client = AWS::S3.new()\n bucket = s3_client.buckets[bucket_name]\n raise S3BucketNotFoundError.new(bucket_name) unless bucket.exists?\n\n object = bucket.objects[object_name]\n raise S3ArtifactNotFoundError.new(bucket_name, object_name) unless object.exists?\n object\n end", "def s3_read(key)\n obj = @s3.get_object bucket: ENV.fetch(\"AWS_BUCKET\"), key: key\n obj.body.read\n end", "def get_object_list(s3_client, object_info)\n\tobject_list = []\n\n\tparams = {\n\t\tbucket: object_info[:bucket], # required\n\t\tprefix: object_info[:prefix],\n\t\tmax_keys: 1000,\n\t}\n\n\tmore = true # will go false when there are no more results\n\twhile more do\n\t\tputs params.inspect if Options[:verbose]\n\n\t\tresp = s3_client.list_objects_v2(params)\n\t\tputs \"Got #{resp.contents.length} objects\".yellow\n\n\t\tresp.contents.each do |o|\n\t\t\tobject_list.push(o.key)\n\t\tend\n\n\t\tmore = resp.is_truncated\n\t\tif resp.is_truncated \n\t\t\tparams[:continuation_token] = resp.next_continuation_token\n\t\tend\n\n\tend\n\n\treturn object_list\nend", "def get_bucket_versioning(bucket_name)\n unless bucket_name\n raise ArgumentError.new('bucket_name is required')\n end\n request({\n :expects => 200,\n :headers => {},\n :host => \"#{bucket_name}.#{@host}\",\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::Parsers::Storage::AWS::GetBucketVersioning.new,\n :query => {'versioning' => nil}\n })\n end", "def getObjectsList\n begin\n #get a handle on the user selected bucket\n s3 = createS3Connection\n bucket = s3.buckets[session[:s3bucket]]\n\n #pull down a list of the object names only\n objects_array = []\n # final_objects_array = []\n\n #bucket.objects.each do |obj|\n # objects_array.push(obj.key)\n #end\n\n bucket.objects.each do |obj|\n objects_array.push({:name => obj.key, :size => (obj.content_length / 1024.0).round(2), :type => obj.content_type, :last_mod => obj.last_modified})\n end\n\n objects_array = createEmptyObjectsArray if objects_array.empty?\n\n return objects_array\n #if !objects_array.empty?\n # objects_array.each do |obj_name|\n # final_objects_array.push({:name => obj_name, :size => '', :type => ''})\n # end\n # else\n # final_objects_array = [{:name => '', :size => '', :type => ''}]\n # end\n # return final_objects_array\n rescue Exception => error\n # return createEmptyObjectsArray\n return createEmptyObjectsArray\n flash.now[:danger] = \"<strong>Error!</strong>\".html_safe + \" Problem creating S3 object list: #{error}.\"\n end\n end", "def read\n object = bucket.objects.find(@path)\n object.content\n end", "def do_bucket_key(bucket_name, object_name, options)\n access_key_id, secret_access_key, security_token = if ENV.has_key? \"AWS_SESSION_TOKEN\"\n get_temporary_keys_from_environment\n else\n get_temporary_keys_via_sts\n end\n\n expiration = options[:expires].to_i\n\n string_to_sign = \"GET\\n\\n\\n#{expiration}\\nx-amz-security-token:#{security_token}\\n/#{bucket_name}/#{object_name}\"\n\n signature = CGI.escape(\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret_access_key,\n string_to_sign,\n )\n ).gsub(\"\\n\",\"\")\n )\n\n object_url = if options[:path_style]\n \"https://s3.amazonaws.com/#{bucket_name}/#{object_name}\"\n elsif options[:insecure]\n \"http://#{bucket_name}.s3.amazonaws.com/#{object_name}\"\n else\n \"https://#{bucket_name}.s3.amazonaws.com/#{object_name}\"\n end\n\n url = object_url + \"?AWSAccessKeyId=#{access_key_id}&Expires=#{expiration}&Signature=#{signature}&x-amz-security-token=#{CGI.escape(security_token)}\"\n\n puts url\nend", "def object_headers(bucket_name, key)\n response = send_s3_request('HEAD', :bucket => bucket_name, :key => key)\n Headers.new(response)\n end", "def list_objects(bucket_name:, fetch_object_content_type: false, **opts)\n response_objects = s3_client.list_objects(bucket: bucket_name, **opts)\n formatted_objects = response_objects.contents.map do |obj|\n metadata = {\n key: obj.key,\n last_modified: obj.last_modified,\n }\n if fetch_object_content_type\n metadata.merge!(object_details(bucket_name: bucket_name, key: obj.key))\n end\n metadata\n end\n end", "def bucket\n @bucket = AWS::S3.new(:access_key_id => ENV[\"S3_ACCESS_KEY_ID\"], :secret_access_key => ENV[\"S3_SECRET_ACCESS_KEY\"]).buckets[ENV[\"S3_BUCKET\"]] if @bucket.nil?\n @bucket\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end" ]
[ "0.74992913", "0.7484136", "0.7456256", "0.7429592", "0.73793685", "0.7342721", "0.7334377", "0.7285206", "0.7279083", "0.7237538", "0.72151196", "0.71678525", "0.7045226", "0.697166", "0.6909694", "0.6908615", "0.6889206", "0.6872525", "0.6863063", "0.68106854", "0.6795594", "0.67951655", "0.6772743", "0.6716088", "0.6706657", "0.66625184", "0.66582084", "0.6654053", "0.6635669", "0.6629725", "0.6600424", "0.65814054", "0.6535011", "0.65188265", "0.65135115", "0.65111357", "0.64909786", "0.64658713", "0.6461428", "0.64464694", "0.64395887", "0.6429876", "0.64082736", "0.63983375", "0.63589716", "0.6342594", "0.6342594", "0.6339458", "0.63230824", "0.63183355", "0.6314769", "0.63094825", "0.62978125", "0.6286288", "0.62741244", "0.624725", "0.6233012", "0.62286884", "0.6189843", "0.6180855", "0.6165337", "0.6160848", "0.6143489", "0.6098573", "0.6091479", "0.60607195", "0.6047982", "0.6046692", "0.60440075", "0.6006315", "0.5993499", "0.5984855", "0.5972984", "0.59698457", "0.5965315", "0.5963703", "0.5957886", "0.5945133", "0.5945038", "0.59208095", "0.59208095", "0.59203434", "0.591897", "0.59176695", "0.59163254", "0.5912251", "0.59047323", "0.590128", "0.5899836", "0.5896794", "0.5896161", "0.5888985", "0.58623594", "0.58568496", "0.58568496", "0.58568496", "0.58568496", "0.58568496", "0.58568496", "0.58568496" ]
0.76849705
0
Rails 3.1 adds update_column. Rails > 3.2.6 deprecates update_attribute, gone in Rails 4.
def update_attribute_or_column(*args) respond_to?(:update_attribute) ? update_attribute(*args) : update_column(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_attribute_or_column(*args)\n respond_to?(:update_column) ? update_column(*args) : update_attribute(*args)\n end", "def update_attribute_or_column(*args)\n respond_to?(:update_column) ? update_column(*args) : update_attribute(*args)\n end", "def update_mark_only_attribute_or_column(*args)\n respond_to?(:update_column) ? update_column(*args) : update_attribute(*args)\n end", "def update_attribute\n end", "def update_column(name, value)\n update_columns(name => value)\n end", "def update_column(name, value)\n update_columns(name => value)\n end", "def update_column(name, value)\n update_columns(name => value)\n end", "def update_table_column(column)\n changes_to_commit << ColumnChange::Update.from_column(column)\n end", "def update_column name, value\n name = name.to_s\n self.dynamic_record.send \"#{name}=\", value\n self.raw_write_attribute name, value\n end", "def update!(**args)\n @column = args[:column] if args.key?(:column)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end", "def _update_columns(columns)\n @columns_updated ||= DeprecatedColumnsUpdated.new(columns) # SEQUEL5: Remove\n _update(columns) unless columns.empty?\n end", "def update\n eqs = self.class.columns.map { |column| \"#{column} = ?\"}.join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values, id)\n UPDATE\n #{self.class.table_name}\n SET\n #{eqs}\n WHERE\n id = ?\n SQL\n end", "def update\n column_sets = self.class.columns.map { |attr_name| \"#{attr_name} = ?\" }.join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values, self.id)\n UPDATE\n #{self.class.table_name}\n SET\n #{column_sets}\n WHERE\n #{self.class.table_name}.id = ?\n SQL\n # ...\n end", "def update\n set_line = self.class.columns.map { |attr| \"#{attr} = ?\" }.join(\", \")\n\n DBConnection.execute(<<-SQL, *attribute_values, self.id)\n UPDATE\n #{self.class.table_name} \n SET\n #{set_line}\n WHERE\n id = ?\n SQL\n end", "def update\n @column = Column.find(params[:id])\n\n respond_to do |format|\n if @column.update_attributes(params[:column])\n flash[:notice] = 'Column was successfully updated.'\n format.html { redirect_to columns_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @column.errors.to_xml }\n end\n end\n end", "def update_attribute!(attribute, value)\n send(\"#{attribute}=\", value)\n self.save!\n end", "def update!(**args)\n @column_items = args[:column_items] if args.key?(:column_items)\n end", "def update_column\n do_update_column\n @column_span_id = params.delete(:editor_id) || params.delete(:editorId)\n end", "def update!(**args)\n @column = args[:column] if args.key?(:column)\n @columns = args[:columns] if args.key?(:columns)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n @value = args[:value] if args.key?(:value)\n end", "def update_attribute(attribute, value)\n send(\"#{attribute}=\", value)\n self.save\n end", "def update!(**args)\n @attribute = args[:attribute] if args.key?(:attribute)\n end", "def update\n respond_to do |format|\n if @app_model_column.update(app_model_column_params)\n format.html { redirect_to @app_model_column, notice: 'App model column was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_model_column }\n else\n format.html { render :edit }\n format.json { render json: @app_model_column.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_columns(attributes)\n # `@record.update_columns` skips dirty-tracking, so we can't just use\n # `@record.changes` or @record.saved_changes` from `ActiveModel::Dirty`.\n # We need to build our own hash with the changes that will be made\n # directly to the database.\n changes = {}\n attributes.each do |k, v|\n changes[k] = [@record[k], v]\n end\n @record.update_columns(attributes)\n record_update_columns(changes)\n end", "def _update_without_checking(columns)\n if use_prepared_statements_for?(:update)\n _set_prepared_statement_server(model.send(:prepared_update, columns.keys)).call(Hash[columns].merge!(pk_hash))\n else\n super\n end\n end", "def update_with_custom_method(attribute_names = @attributes.keys)\n # check if class has custom create method\n return update_without_custom_method unless self.class.custom_update_method\n return 0 if attribute_names.empty?\n self.class.connection.log_custom_method(\"custom update method with #{self.class.primary_key}=#{self.id}\", \"#{self.class.name} Update\") do\n self.class.custom_update_method.bind(self).call\n end\n 1\n end", "def update_attribute(attr_name, attr_value)\n update_attributes(attr_name => attr_value)\n end", "def update\n $all_columns.each do |col|\n col[0] = col[1].call unless col[1].nil?\n end\nend", "def update_columns(attributes)\n # `@record.update_columns` skips dirty tracking, so we can't just use `@record.changes` or\n # @record.saved_changes` from `ActiveModel::Dirty`. We need to build our own hash with the\n # changes that will be made directly to the database.\n changes = {}\n attributes.each do |k, v|\n changes[k] = [@record[k], v]\n end\n @record.update_columns(attributes)\n record_update_columns(changes)\n end", "def update_columns=(column_names)\n @update_columns = Array(column_names)\n end", "def after_update(updated)\n # not required\n end", "def update_attribute(name, value)\n send(\"#{name}=\", value)\n save\n end", "def update_attribute(name, value)\n send(\"#{name}=\", value)\n save\n end", "def update!(**args)\n @attribute_id = args[:attribute_id] if args.key?(:attribute_id)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n @invalid_values_allowed = args[:invalid_values_allowed] if args.key?(:invalid_values_allowed)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n @invalid_values_allowed = args[:invalid_values_allowed] if args.key?(:invalid_values_allowed)\n end", "def update\n if @column.update(column_params)\n BoardChannel.broadcast_to(@board, {action: 'updateColumn', column: @column})\n render :show, status: :ok\n else\n render json: @column.errors, status: :unprocessable_entity\n end\n end", "def update_attribute(attr_name, value)\n if self.class.has_custom_attribute?(attr_name.to_sym)\n find_or_build_custom_attribute_by_name(attr_name).update_attribute(:value, value)\n else\n super\n end\n end", "def write(object, attribute, value)\n result = super\n column = self.attribute.to_sym\n object.changed_columns << column if attribute == :state && owner_class.columns.include?(column) && !object.changed_columns.include?(column)\n result\n end", "def after_update_save(record); end", "def update_attribute(key, value)\n send(\"#{key}=\", value)\n end", "def update\n respond_to do |format|\n if @item_column.update(item_column_params)\n format.html { redirect_to @item_column, notice: 'Item column was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_column.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @custom_columns = args[:custom_columns] if args.key?(:custom_columns)\n end", "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n end", "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n end", "def update!(**args)\n @column = args[:column] if args.key?(:column)\n @data_type = args[:data_type] if args.key?(:data_type)\n @length = args[:length] if args.key?(:length)\n @nullable = args[:nullable] if args.key?(:nullable)\n @ordinal_position = args[:ordinal_position] if args.key?(:ordinal_position)\n @precision = args[:precision] if args.key?(:precision)\n @primary_key = args[:primary_key] if args.key?(:primary_key)\n @scale = args[:scale] if args.key?(:scale)\n end", "def before_update_save(record); end", "def update_attribute(key, value)\n self.update_attributes(key => value)\n end", "def update!(**args)\n @attribute_protos = args[:attribute_protos] if args.key?(:attribute_protos)\n end", "def update_attribute(attribute, attribute_type, value)\n\t\tresults = submit_cmd('update app attribute',:db, \"-env #{self.belongs_to.env} \\\n -app_instance #{self.name} -attribute #{attribute} -attribute_type #{attribute_type} \\\n -new_value #{value}\")\n\t \n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \traise \"update attribute failed\" \n\t else\n\t \tself.attributes[attribute.intern] = value\n\t end\n\tend", "def update(attribute_names = @attributes.keys)\r\n quoted_attributes = attributes_with_quotes(false, false, attribute_names)\r\n return 0 if quoted_attributes.empty?\r\n connection.update(\r\n \"UPDATE #{self.class.quoted_table_name} \" +\r\n \"SET #{quoted_comma_pair_list(connection, quoted_attributes)} \" +\r\n \"WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)}\",\r\n \"#{self.class.name} Update\"\r\n )\r\n end", "def _update_columns(columns)\n _update(columns) unless columns.empty?\n end", "def update!(**args)\n @column = args[:column] if args.key?(:column)\n @data_type = args[:data_type] if args.key?(:data_type)\n @encoding = args[:encoding] if args.key?(:encoding)\n @length = args[:length] if args.key?(:length)\n @nullable = args[:nullable] if args.key?(:nullable)\n @ordinal_position = args[:ordinal_position] if args.key?(:ordinal_position)\n @precision = args[:precision] if args.key?(:precision)\n @primary_key = args[:primary_key] if args.key?(:primary_key)\n @scale = args[:scale] if args.key?(:scale)\n end", "def update_salesforce_attribute(attribute)\n # updated the synced attribute...if we can't connect, don't raise an exception.\n begin\n synced_class.find_by_id(id).update_attribute(attribute,send(attribute))\n rescue SocketError\n logger.warn(\"Unable to connect to Salesforce and update [#{synced_class}] attribute [#{attribute}]\n with value [#{send(attribute)}]\")\n end\n end", "def update_attribute key, value\n setter = :\"#{key}=\"\n send(setter, value) if respond_to?(setter)\n save(:changes => true, :validate => false)\n end", "def update!(columns)\n update(nil, columns)\n end", "def update\n @default_adverse_event_column = DefaultAdverseEventColumn.find(params[:id])\n\n respond_to do |format|\n if @default_adverse_event_column.update_attributes(params[:default_adverse_event_column])\n format.html { redirect_to(@default_adverse_event_column, :notice => 'Default adverse event column was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @default_adverse_event_column.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_attribute.update(admin_attribute_params)\n format.html { redirect_to admin_attributes_path, notice: 'Attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_attribute }\n else\n format.html { render :edit }\n format.json { render json: @admin_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommend_other_column = Recommend::OtherColumn.find(params[:id])\n\n respond_to do |format|\n if @recommend_other_column.update_attributes(params[:recommend_other_column])\n format.html { redirect_to @recommend_other_column, notice: 'Other column was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_other_column.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n @invalid_values_allowed = args[:invalid_values_allowed] if args.key?(:invalid_values_allowed)\n @time_format = args[:time_format] if args.key?(:time_format)\n end", "def update_attribute(name, value)\n raise NotImplemented\n end", "def db_column_func(&block)\n new_structure = self.class.db_structure\n\n yield(new_structure)\n self.class.update_db(new_structure)\n new_structure\n end", "def update\n @columna = Columna.find(params[:id])\n\n respond_to do |format|\n if @columna.update_attributes(params[:columna])\n flash[:notice] = 'Columna actualizado correctamente.'\n format.html { redirect_to(@columna) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @columna.errors, :status => :unprocessable_entity }\n end\n end\n end", "def before_update; end", "def update(attribute, new_value)\n case attribute\n when \"1\"\n @first_name = new_value\n when \"2\"\n @last_name = new_value\n when \"3\"\n @email = new_value\n when \"4\"\n @note = new_value\n end\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n @time_format = args[:time_format] if args.key?(:time_format)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n @time_format = args[:time_format] if args.key?(:time_format)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n @time_format = args[:time_format] if args.key?(:time_format)\n end", "def rename_column_concurrently(table, old_column, new_column, type: nil, batch_column_name: :id)\n Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas.require_ddl_mode!\n\n setup_renamed_column(__callee__, table, old_column, new_column, type, batch_column_name)\n\n with_lock_retries do\n install_bidirectional_triggers(table, old_column, new_column)\n end\n end", "def increment_column!(attribute, by = 1)\n # \"foo\"\n increment(attribute, by).update_column(attribute, self[attribute])\n end", "def update(field, new_value)\n\t\tself.send(\"#{field}=\", new_value)\n\tend", "def _update(columns)\n model.cti_models.each do |m|\n h = {}\n m.cti_table_columns.each{|c| h[c] = columns[c] if columns.include?(c)}\n cti_this(m).update(h) unless h.empty?\n end\n end", "def update_attribute(id, name, estimated_time, clue, description)\n req = UpdateAttributeRequest.new(id, name, estimated_time, clue, description)\n resp = @@room_service.update_attribute(req)\n render json: { success: resp.success, message: resp.message }, status: :ok\n rescue StandardError\n render json: { success: false, message: 'Server Error when Updating' }, status: :bad_request\n end", "def update\n @product_attribute_field = ProductAttributeField.find(params[:id])\n\n respond_to do |format|\n if @product_attribute_field.update_attributes(params[:product_attribute_field])\n flash[:notice] = 'Product_attribute_fields was successfully updated.'\n format.html { redirect_to(admin_product_attribute_field_path(@product_attribute_field)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_attribute_field.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @equivalent_attribute_id = args[:equivalent_attribute_id] if args.key?(:equivalent_attribute_id)\n end", "def def_column_accessor(*columns)\n clear_setter_methods_cache\n columns, bad_columns = columns.partition{|x| /\\A[A-Za-z_][A-Za-z0-9_]*\\z/.match(x.to_s)}\n bad_columns.each{|x| def_bad_column_accessor(x)}\n im = instance_methods\n columns.each do |column|\n meth = \"#{column}=\"\n overridable_methods_module.module_eval(\"def #{column}; self[:#{column}] end\", __FILE__, __LINE__) unless im.include?(column)\n overridable_methods_module.module_eval(\"def #{meth}(v); self[:#{column}] = v end\", __FILE__, __LINE__) unless im.include?(meth)\n end\n end", "def def_column_accessor(*columns)\n clear_setter_methods_cache\n columns, bad_columns = columns.partition{|x| /\\A[A-Za-z_][A-Za-z0-9_]*\\z/.match(x.to_s)}\n bad_columns.each{|x| def_bad_column_accessor(x)}\n im = instance_methods.map(&:to_s)\n columns.each do |column|\n meth = \"#{column}=\"\n overridable_methods_module.module_eval(\"def #{column}; self[:#{column}] end\", __FILE__, __LINE__) unless im.include?(column.to_s)\n overridable_methods_module.module_eval(\"def #{meth}(v); self[:#{column}] = v end\", __FILE__, __LINE__) unless im.include?(meth)\n end\n end", "def update_attribute_without_callbacks(name, value)\n send(\"#{name}=\", value)\n update_attributes_without_callbacks(name => value)\n end", "def update(attribute,new_value)\n case attribute\n when \"1\"\n @first_name = new_value\n when \"2\"\n @last_name = new_value\n when \"3\"\n @email = new_value\n when \"4\"\n @note = new_value\n end\n end", "def update\n respond_to do |format|\n if @tm_table_column.update(tm_table_column_params)\n format.html { redirect_to @tm_table_column, notice: 'Tm table column was successfully updated.' }\n format.json { render :show, status: :ok, location: @tm_table_column }\n else\n format.html { render :edit }\n format.json { render json: @tm_table_column.errors, status: :unprocessable_entity }\n end\n end\n end", "def column_changed?\n model.send(:\"#{column}_changed?\")\n end", "def update attributes\n attributes.each do |name, value|\n send \"#{name}=\", value if respond_to? \"#{name}=\"\n end\n save\n end", "def upgrade_fallback_value(instance, attr)\n plain_token = instance.public_send attr\n instance.update_column(attr, hashed_or_plain_token(plain_token))\n end" ]
[ "0.7466455", "0.7466455", "0.69622284", "0.6838364", "0.6625082", "0.6625082", "0.6625082", "0.6522453", "0.64334697", "0.61733955", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.6120923", "0.60621446", "0.60441583", "0.60264665", "0.5938375", "0.58834726", "0.585292", "0.57997745", "0.5792782", "0.57394385", "0.573863", "0.573604", "0.5724123", "0.57196724", "0.57149833", "0.57062346", "0.57010853", "0.5696563", "0.56768864", "0.5661003", "0.5639778", "0.56169504", "0.5597054", "0.5597054", "0.5590963", "0.5581815", "0.5581815", "0.5577035", "0.55601364", "0.55353945", "0.55321723", "0.55221474", "0.55192226", "0.55086595", "0.5485429", "0.5485429", "0.54835", "0.5469707", "0.5460484", "0.5454742", "0.5436487", "0.5435986", "0.542749", "0.53996474", "0.5396945", "0.5395718", "0.5386695", "0.53861886", "0.5384642", "0.5381904", "0.53785276", "0.53783655", "0.5364343", "0.536342", "0.5361673", "0.53599304", "0.535469", "0.535469", "0.535469", "0.5349911", "0.5345619", "0.53455204", "0.5345121", "0.53435785", "0.53421897", "0.5324423", "0.5324388", "0.5323022", "0.53114915", "0.5311307", "0.5307733", "0.5305181", "0.5301785", "0.5299602" ]
0.7391719
2
DB Here we can actually make an efficient query with both the domain and locale at the same time
def query_request db = PhoneDNS::DB.new return db.find(@domain, @locale) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def website_locales\n WebsiteLocale.where(locale: self.code)\n end", "def query_context_values_for_locale(locale)\n case locale\n when \"US\"\n US_QUERY_CONTEXT_VALUES \n else\n US_QUERY_CONTEXT_VALUES\n end\n end", "def with_locales(*locales)\r\n locales = locales.flatten.map(&:to_s)\r\n #where(:locale.in => locales)\r\n where(:locale => {\"$in\" => locales})\r\n end", "def locale(locale)\n @query[:locale] = locale\n self\n end", "def domain_to_locale code\n\t\t\tdomain_locale_map[code.to_sym] || flag_locale_map[code.to_sym] || code\n\t\tend", "def load_all_entries\n results = self.all :order=>\"locale, key\"\n data = {}\n\n results.each do |result|\n #create an empty hash for each locale initially\n data[result.locale] ||= {}\n\n # create the deep nested scopes from the dotted key\n scopes = result.key.split(\".\").map{|k| k.to_sym}\n key = scopes.pop\n scope = scopes.inject(data[result.locale]) do |scope, s|\n # a new scope is empty initially\n # if its a simple string override it with a empty hash\n scope[s] = {} unless scope[s] and scope[s].is_a?(Hash)\n scope[s]\n end\n\n # if we have a pluralization form and the translation key already exists add the specific pluralization form\n if scope[key] && scope[key].is_a?(Hash) && !result.pluralization_index.blank?\n scope[key][result.pluralization_index] = result.text\n\n # if we have a pluralization index add the initial hash\n elsif !result.pluralization_index.blank?\n scope[key] = { result.pluralization_index.to_sym => result.text.to_s }\n\n # else we just add the simple text\n else\n scope[key] = result.text\n end\n\n end\n return data\n end", "def locale_select(locale)\n select(locale, :from => localization[:id])\n end", "def available_locales\n translation_model.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def lookup(locale, key, scope = [], options = {})\n init_translations unless initialized?\n \n # only formal address: [:de, :de_formal]\n # only multi tenancy: [:de, :tenant_name_de]\n # formal address & multi tenancy: [:de, :tenant_name_de, :de_formal, :tenant_name_de_formal]\n \n locales = []\n \n base_locale = locale.to_s.gsub(FORMAL_LOCALE_PATTERN, '')\n \n tenant = tenant_from_locale?(locale)\n base_locale.gsub!(/^#{tenant}_/, '') if tenant\n \n locales << base_locale.to_sym \n \n if locale.to_s.match(FORMAL_LOCALE_PATTERN) && tenant && locale.to_s.match(/^#{tenant}_/)\n locales << locale.to_s.gsub(FORMAL_LOCALE_PATTERN, '').to_sym\n locales << locale.to_s.gsub(/^#{tenant}_/, '').to_sym\n end\n \n locales << locale unless locales.include?(locale)\n \n entry, last_entry = nil, nil\n \n locales.each do |locale|\n keys = I18n.normalize_keys(locale, key, scope, options[:separator])\n \n entry = keys.inject(translations) do |result, _key|\n _key = _key.to_sym\n \n unless result.is_a?(Hash) && result.has_key?(_key)\n nil\n else\n result = result[_key]\n result = resolve(locale, _key, result, options.merge(:scope => nil)) if result.is_a?(Symbol)\n result\n end\n end\n \n if entry.nil?\n entry = last_entry\n else\n last_entry = entry\n end\n end\n \n entry\n end", "def integrate_locale_attributes \n self.class.locale_class_name.constantize.column_names.each{|key|\n attrs = self.attributes.keys\n if !attrs.include?(key) && !self.respond_to?(key)&&\n self.class.to_s.underscore+\"_id\" != key &&\n # except these keys\n ![\"id\",\"created_at\",\"updated_at\"].include?(key)\n self.class.class_eval <<-EOF\n \n def #{key}\n if locales.loaded?\n l = correct_locale\n l && l.#{key}\n else\n (current_locale || locales.first).#{key}\n end\n end\n EOF\n \n end\n }\n end", "def get_by_domain\n render json: Url.where(\"domain LIKE :dom\", {:dom => \"%#{params[:domain]}%\"})\n end", "def regionals\n @regionals ||= is_primary? ?\n Locale.where(\"code LIKE ?\", \"#{code}-%\").where.not(id: self.id) :\n nil\n end", "def query_for_existing_model(options)\n model_class(options).where(\n locale: options['locale'],\n id_field(options) => options['object_to_translate'].id\n )\n end", "def with_globalize(conditions = {})\n conditions = {:locale => ::Globalize.locale.to_s}.merge(conditions)\n globalized_conditions = {}\n conditions.keys.each do |key|\n if (translated_attribute_names.map(&:to_s) | %w(locale)).include?(key.to_s)\n globalized_conditions[\"#{self.translation_class.table_name}.#{key}\"] = conditions.delete(key)\n end\n end\n # A join implies readonly which we don't really want.\n joins(:translations).where(globalized_conditions).where(conditions).readonly(false)\n end", "def locale\n (self.country.blank? or self.country.indonesia?) ? :id : :en\n end", "def fetch(locale, name)\r\n Mongoid::Globalize.fallbacks(locale).each do |fallback|\r\n value = fetch_stash(fallback, name) || fetch_attribute(fallback, name)\r\n return value unless fallbacks_for?(value)\r\n end\r\n return nil\r\n end", "def apply_locale; end", "def locale_conditions\n cond = conditions.dup\n\n cond[:path_info] = RouteLocalize.translate_path(\n conditions[:path_info],\n locale,\n by_subdomain: by_subdomain?)\n\n if by_subdomain?\n cond[:subdomain] = locale.to_s\n else\n cond[:locale] = locale.to_s\n end\n\n # For good measure\n cond[:required_defaults] -= [:localize, :localize_subdomain]\n\n cond\n end", "def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n \n end", "def filter_by_locale(events)\n included_locales = [nil, '', AvailableLocale.default_id]\n if AvailableLocale.exists?(key: I18n.locale)\n included_locales << AvailableLocale.find_by(key: I18n.locale).id\n end\n events.where(original_locale_id: included_locales)\n end", "def load_entry(locale, key)\n locale, key = locale.to_s, key.to_s\n data = self.find_all_by_locale_and_key(locale, key)\n result = {}\n data.each do |row|\n #only return the simple translation if one is set\n return row.text if row.pluralization_index.blank?\n result[row.pluralization_index.to_sym] = row.text\n end\n return result\n end", "def set_gettext_locale_db\n params[:locale] ||= User.current.try(:locale)\n end", "def available_locales\n resource.translations.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def lookup_chain = locale(true).lookup", "def update_locale\n @moas_model.update_all(\"lp2 = CASE WHEN lower(platformcompatibility) like '%leappad2%' or lower(platformcompatibility) like '%leappad 2%' THEN 'X' ELSE '' END\")\n @moas_model.update_all(\"lp1 = CASE WHEN lower(platformcompatibility) like '%leappad explorer%' or lower(platformcompatibility) like '%leappad1%' or lower(platformcompatibility) like '%leappad 1%' THEN 'X' ELSE '' END\")\n @moas_model.update_all(\"lpu = CASE WHEN lower(platformcompatibility) like '%leappad ultra%' or lower(platformcompatibility) like '%leappadultra%' THEN 'X' ELSE '' END\")\n @moas_model.update_all(\"lex = CASE WHEN lower(platformcompatibility) like '%leapster explorer%' THEN 'X' ELSE '' END\")\n @moas_model.update_all(\"lgs = CASE WHEN lower(platformcompatibility) like '%leapstergs explorer%' THEN 'X' ELSE '' END\")\n @moas_model.update_all(\"lpr = CASE WHEN lower(platformcompatibility) like '%leapreader%' THEN 'X' ELSE '' END\")\n @moas_model.update_all(\"lp3 = CASE WHEN lower(platformcompatibility) like '%leappad3%' THEN 'X' ELSE '' END\")\n end", "def sql_query\n case @operator\n when :equals\n arel_field.eq(transmogrified_value)\n when :does_not_equal\n arel_field.not_eq(transmogrified_value)\n when :contains\n arel_field.matches(\"%#{transmogrified_value}%\")\n when :does_not_contain\n arel_field.does_not_match(\"%#{transmogrified_value}%\")\n when :starts_with\n arel_field.matches(\"#{transmogrified_value}%\")\n when :ends_with\n arel_field.matches(\"%#{transmogrified_value}\")\n when :greater_than\n arel_field.gt(transmogrified_value)\n when :greater_than_or_equal_to\n arel_field.gteq(transmogrified_value)\n when :less_than\n arel_field.lt(transmogrified_value)\n when :less_than_or_equal_to\n arel_field.lteq(transmogrified_value)\n when :in\n arel_field.in(transmogrified_value.split(/\\,\\s*/))\n when :not_in\n arel_field.not_in(transmogrified_value.split(/\\,\\s*/))\n when :blank\n arel_field.eq(nil)\n when :not_blank\n arel_field.not_eq(nil)\n end\n end", "def index\r\n\r\n filter = params[:filter] || \"locales\"\r\n limit = params[:limit].to_i || 25\r\n page = params[:page].to_i || 1\r\n @locales = case filter\r\n when \"locales\"\r\n locales = Dir.entries(\"#{Rails.root}/po\").select do |entry|\r\n File.directory?(File.join(Rails.root, \"po\", entry)) and !(entry =='.' || entry == '..')\r\n end\r\n when \"locale\"\r\n locales = GetPomo::PoFile.parse(File.read(\"#{Rails.root}/po/#{params[:locale]}/#{APP_SID}.po\"))\r\n locales.reject!{|l| l.msgid == \"\"}\r\n if params.has_key?(:fuzzy) and (params[:fuzzy] =~ /(t|1|true|on|f|0|false|off)/i)\r\n fuzzy = (params[:fuzzy] =~ /(t|1|true|on)/i) ? true : false\r\n if fuzzy\r\n locales.reject{|l| l.fuzzy?.nil?}[((page - 1) * limit + (page - 1))..(((page - 1) * limit) + limit + (page - 1))]\r\n else\r\n locales.select{|l| l.fuzzy?.nil?}[((page - 1) * limit + (page - 1))..(((page - 1) * limit) + limit + (page - 1))]\r\n end\r\n else\r\n locales[((page - 1) * limit + (page - 1))..(((page - 1) * limit) + limit + (page - 1))]\r\n end\r\n else nil\r\n end\r\n respond_with @locales\r\n end", "def find_by_locale(locale)\r\n with_locale(locale.to_s).first\r\n end", "def locales(locale_type)\n locs = Set.new\n\n each_bathing_water do |bw|\n l = bw[locale_type]\n locs << l if l.is_a?(LdaResource)\n end\n\n locs.to_a.sort_by(&:label)\n end", "def extract_locale_from_subdomain\n @parsed_locale = request.subdomains.first\n if @parsed_locale.blank?\n @parsed_locale = 'en'\n end\n I18n.available_locales.include?(@parsed_locale.to_sym) ? @parsed_locale : 'en'\n end", "def load_localization(locale = nil)\n if locale.blank?\n @current_localization = load_default_localizations\n else\n @current_localization = localizations.where(\"locale_id = ? AND path LIKE ?\", locale.id, \"#{path}%\").first\n end\n end", "def translated_locales\r\n all.distinct(\"locale\").sort{ |x,y| x.to_s <=> y.to_s }.map(&:to_sym)\r\n end", "def locale_idx; end", "def map_search(search,compare,year,rain_fall_type)\n if search == \"All\"\n if rain_fall_type == \"All\"\n where(Year: year).order(:id)\n else\n where(Year: year).order(rain_fall_type)\n end\n \n \n else\n # where(Districts: search)\n where(Year: year).order(rain_fall_type)\n end\n end", "def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\nend", "def lookup(locale, key, scope = [], options = {})\n\n init_translations unless initialized?\n result = nil\n _locale = ::Locale.first(:code => locale)\n key = pluralizer(_locale, key, options[:count])\n value = _locale.translations.first(:code => key)\n result = value.value unless value.nil?\n result = options[:default] if !value.nil? && value.value == key && options[:default]\n return result unless value.nil? || value.value == key\n \n # check devise messages for remaining keys\n result = _locale.translations.first(:code => \"devise.sessions.#{key}\")\n return result.value unless result.nil?\n\n # fall back on yaml file if no object is found in db\n keys = I18n.normalize_keys(locale, key, scope, options[:separator])\n keys.inject(translations) do |result, _key|\n return nil unless result.is_a?(Hash) && result.has_key?(_key)\n result = result[_key]\n result = resolve(locale, _key, result, options.merge(:scope => nil)) if result.is_a?(Symbol)\n result = options[:default] if options[:default] && result.nil?\n result\n end\n \n end", "def index_page_languages\n ids = connection.select_values %{select distinct language_id from contents where related_object_id = #{id} AND related_object_type = '#{toplevel_class.name}' AND data is not null AND data != '' AND ((type = 'Page' AND page_name = 'index') OR type = 'Abstract')}\n Language.find(ids)\n end", "def my_rents_office\n sc = SearchCondition.new(:user_id => session[:user_id],\n :city => \"Москва\", #todo: add code to process several cities in SearchCondition\n :realty_types => [\"office\",\"trading_floor\",\"warehouse\",\"catering\",\"free_app\",\"garage\",\"manufacture\",\"legal_address\",\"autoservice\",\"selling_business\"]\n )\n @entries = Entry.find_with_search_condition(sc)\n \n end", "def index\n# @entries = Entry.order('lower(de)')\n @q = Entry.order('lower(de)').ransack(params[:q])\n @entries = @q.result(distinct: true)\n end", "def get_locale_from_subdomain\n locale = @rh.match( /(.+)\\.demowatch\\.[a-z]{2,3}$/i)[1]\n return locale if ( I18N_ALL_LANGUAGES.include?( locale))\n return nil\n end", "def localized_search_text_in(field)\n options[:organization].available_locales.map do |l|\n \"#{field} ->> '#{l}' ILIKE :text\"\n end.join(\" OR \")\n end", "def extract_locale_from_subdomain\n\t\t parsed_locale = request.subdomains.first || I18n.default_locale\n\t\t I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n\t\tend", "def query queryString\n\t\t\tif queryString == nil\n\t\t\t\treturn \"simplelion:err:invalid_query: nil\"\n\t\t\tend\n\t\t\tif queryString.empty?\n\t\t\t\treturn \"simplelion:err:invalid_query: empty\"\n\t\t\tend\n\t\t\tsplittedQuery = queryString.split('.')\n\t\t\tif @file == nil || @file.empty?\n\t\t\t\treturn \"simplelion:err:no_locale\"\n\t\t\tend\n\t\t\tcat = nil\n\t\t\tsplittedQuery.each do |curr|\n\t\t\t\tif curr == \"\"\n\t\t\t\t\treturn \"simplelion:err:invalid_query: \" + queryString\n\t\t\t\telse\n\t\t\t\t\tif cat == nil\n\t\t\t\t\t\tfound = false\n\t\t\t\t\t\t@file.each do |entry|\n\t\t\t\t\t\t\tif entry.name.to_s == curr\n\t\t\t\t\t\t\t\tif splittedQuery.last == curr\n\t\t\t\t\t\t\t\t\tif entry.is_a?(SimpleLion::LocalizationString)\n\t\t\t\t\t\t\t\t\t\treturn entry.value\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tif entry.is_a?(SimpleLion::LocalizationCategory)\n\t\t\t\t\t\t\t\t\t\tcat = entry\n\t\t\t\t\t\t\t\t\t\tfound = true\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\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif !found\n\t\t\t\t\t\t\treturn \"simplelion:err:translation_missing: \" + queryString\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tentry = cat.getLocalizationEntryByName curr\n\t\t\t\t\t\tif entry == nil\n\t\t\t\t\t\t\treturn \"simplelion:err:translation_missing: \" + queryString\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif splittedQuery.last == curr\n\t\t\t\t\t\t\tif entry.is_a?(SimpleLion::LocalizationString)\n\t\t\t\t\t\t\t\treturn entry.value\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\treturn \"simplelion:err:translation_missing: \" + queryString\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif entry.is_a?(SimpleLion::LocalizationCategory)\n\t\t\t\t\t\t\t\tcat = entry\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\treturn \"simplelion:err:translation_missing: \" + queryString\n\t\t\t\t\t\t\tend\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", "def published_locales\n StoryTranslation.where(:story_id => self.id, :published => true).pluck(:locale).uniq\n end", "def with_given_locale(attributes, &block)\r\n attributes.symbolize_keys! if attributes.respond_to?(:symbolize_keys!)\r\n if locale = attributes.try(:delete, :locale)\r\n Mongoid::Globalize.with_locale(locale, &block)\r\n else\r\n yield\r\n end\r\n end", "def domicilios_en_uso\n\t\tdomicilios.find_all do |d| \n\t\t\tlogger.debug(\"domcilio #{d.id}: #{d.deleted_at}\")\n\t\t\td.deleted_at.nil? \n\t\tend\n\tend", "def by_locale(locale_name)\n loc = Locale.find_by_name(locale_name)\n page_i18ns.by_locale(loc).first or page_i18ns.first\n end", "def initialize(query, languages)\n @query = query\n @languages = languages\n end", "def translation_for(locale)\n success = true\n tries ||= 3\n translation = self.translations.detect{ |t| t.locale == locale }\n return translation if translation\n return nil if self.new_record\n request = Net::HTTP::Get.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}/locales/#{locale}/translations.yaml\")\n WebTranslateIt::Util.add_fields(request)\n begin\n response = Util.handle_response(Connection.http_connection.request(request), true, true)\n array = YAML.load(response)\n return nil if array.empty?\n translations = []\n array.each do |translation|\n term_translation = WebTranslateIt::TermTranslation.new(translation)\n translations.push(term_translation)\n end\n return translations\n \n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end", "def uhook_index_search_subject\n ::Category.locale(current_locale, :all)\n end", "def getLocaleCode\n # first default locale to default locale\n @locale_code = Rails.application.config.i18n.default_locale\n # next set locale to the locale in user record\n @locale_code = current_user.try(:locale) || @locale_code\n # next set locale to the locale passed as the locale param\n if (params.present? &&\n params['locale'].present? &&\n BaseRec::VALID_LOCALES.include?(params['locale'].to_s)\n )\n @locale_code = params['locale']\n end\n # set the locale in I18n\n I18n.locale = @locale_code\n Rails.logger.debug \"@locale_code: #{@locale_code.inspect}\"\n end", "def locale_from_params\n params[:locale] if (params[:locale] && ['en', 'se'].include?(params[:locale]))\n end", "def utf8_locale\n if params[:lang]\n cookies[:lang] = params[:lang]\n elsif cookies[:lang]\n params[:lang] = cookies[:lang]\n end\n I18n.locale = params[:lang]\n # TODO remove blood with Dean\n Dean.columns\n end", "def locale_picker(locale)\n paths = {\n '/nl/collections' => '/nl/collecties',\n '/en/collecties' => '/en/collections',\n '/nl/how-to-use' => '/nl/handleiding',\n '/en/handleiding' => '/en/how-to-use',\n '/nl/open-data' => '/nl/open-gegevens',\n '/en/open-gegevens' => '/en/open-data',\n '/nl/open-source' => '/nl/open-bron',\n '/en/open-bron' => '/en/open-source',\n '/nl/contact-en' => '/nl/contact-nl',\n '/en/contact-nl' => '/en/contact-en',\n '/nl/legal-notification' => '/nl/juridische-kennisgeving',\n '/en/juridische-kennisgeving' => '/en/legal-notification'\n }\n\n url = url_for(locale: locale)\n \n # get rid of the 'en:' prefix if the id is en:groeningemuseum:1234\n url = url.gsub(/#{I18n.locale.to_s}:/, '')\n\n unless paths[url].nil?\n translated = paths[url]\n \"#{translated}\"\n else\n \"#{url}\"\n end\n end", "def build_query\n query = PhoneNumberGeolocation::Location.where(\n phone_numbers: { '$in' => customer_numbers }\n )\n query = query.of_country(@country) if same_country\n query\n end", "def fetch_translations(locale)\n self.translations ||= {}\n return if self.translations[locale]\n\n # Tml.logger.debug(\"Fetching translations for #{label}\")\n\n results = self.application.api_client.get(\n \"translation_keys/#{self.key}/translations\",\n {:locale => locale, :per_page => 10000},\n {:cache_key => Tml::TranslationKey.cache_key(locale, self.key)}\n ) || []\n\n update_translations(locale, results)\n\n self\n rescue Tml::Exception => ex\n self.translations = {}\n self\n end", "def localization_info_for_language(lang, connection)\n\t# Starting iOS9, the localization format is <language>-<country_code>\n\t# For example he-IL : he (hebrew language preffered) and IL (Israel)\n\t# We only care here about the preffered language.\n\tif lang =~ /-/i\n\t\tlang = lang.split(\"-\")[0]\n\tend\n\n\t# Some android devices send \"iw\" when hebrew is the preffered language\n\tif lang == \"iw\" then lang = \"he\" end\n\t\n\t# Search for the exact language\n\tinfo = connection.db().collection(\"translations\").find({\"_id\"=>lang}).to_a\t\n\t\n\t# If not found, search for the more general one.\n\tls_lang = less_specific_language(lang)\n\tinfo = connection.db().collection(\"translations\").find({\"_id\"=>ls_lang}).to_a if ls_lang != nil && info.count != 1\t\n\n # If still not found, just get english as fallback\n\tinfo = connection.db().collection(\"translations\").find({\"_id\"=>\"en\"}).to_a if info.count != 1\n\n\t# return the localisation info\n\tif info.count == 1\n\t\treturn info[0]\n\tend\n\t\n\treturn nil\nend", "def for_language(locale)\n translations.select { |word| word.locale == locale }\n end", "def all_published_locales\n translations.where(published: true).map{|x| x.locale}.uniq.sort\n end", "def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n I18n.available_locales.include?(parsed_locale.try(:to_sym)) ? parsed_locale : nil\n end", "def index\n @translations = @locale.translations.all(:order => \"raw_key, pluralization_index\")\n end", "def envia_taxones_query\n end", "def other_locales_with_translations(website)\n all_locales_with_translations(website) - [I18n.locale.to_s]\n end", "def i18n_scope\n :mongoid\n end", "def get_domain domain\n\n # Connect to the database\n conn = PG.connect( dbname: DB_DATABASE_NAME, user: DB_USER, password: DB_PASSWORD )\n\n # Get the info on the domain from the DB\n res = conn.exec \"SELECT * FROM #{DB_DOMAINS_TABLE} WHERE domain = '#{domain}'\"\n\n # Close the connection\n conn.close\n\n # The query resulted in nothing?!\n unless res.ntuples > 0\n puts \"Kunde inte hitta domänen '#{domain}'!\".red\n exit\n end\n\n return res[0]\nend", "def uhook_filtered_search filters = {}\n create_scopes(filters) do |filter, value|\n case filter\n when :locale\n {:conditions => {:locale => value}}\n end\n end\n end", "def get_matching_ui_locale(locale)\n lang = locale[0,2].downcase\n\n # Check with exact matching\n if Globalite.ui_locales.values.include?(local_case(locale))\n local_case(locale)\n end\n\n # Check on the language only\n Globalite.ui_locales.values.each do |value|\n value.to_s =~ /#{lang}-*/ ? value : nil\n end\n end", "def db_countries\r\n\t\tLocation.find :all, :order=>\"country ASC\", :select => \"DISTINCT country\"\r\n\tend", "def locales(website)\n if product_families.size > 0\n @locales ||= product_families.map do |pf|\n pf.find_ultimate_parent.locales(website)\n end.flatten.uniq - locales_where_hidden\n else\n @locales ||= website.list_of_all_locales - locales_where_hidden\n end\n end", "def set_locale\n I18n.locale = params[:locale] if params[:locale].present?\n # \"en\"\n # params[:locale] if params[:locale].present?\n # current_user.locale\n # request.subdomain\n # request.env[\"HTTP_ACCEPT_LANGUAGE\"]\n # request.remote_ip\n end", "def translation_for(locale, **)\n translation = model.send(association_name).find { |t| t.__send__(key_column) == attribute && t.locale == locale.to_s }\n translation ||= class_name.new(locale: locale, key_column => attribute)\n translation\n end", "def country_code_locales(c)\n if c.nil? || ! @cc.has_key?(c.downcase.to_sym)\n Rails.logger.warn \"Unknown country code: #{c}\"\n c = DEFAULT_COUNTRY_CODE\n end\n\n @cc[c.downcase.to_sym][:locales]\n end", "def search_conditions_as_hash(locale)\n [\n { :value => I18n.t(\"advanced_searches.text_search_field.all_words\", locale: locale), :key => \"all_words\"},\n { :value => I18n.t(\"advanced_searches.text_search_field.one_word\", locale: locale), :key => \"one_word\"},\n { :value => I18n.t(\"advanced_searches.text_search_field.exact\", locale: locale), :key => \"exact\"}\n ]\n end", "def locale=(locale); end", "def extract_locale_from_subdomain\n parsed_locale = request.subdomains.first\n if parsed_locale != nil\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n else\n return nil\n end\n end", "def search_result_domain\n if s = super\n s\n else\n domain = SitescanCommon::SearchResultDomain\n .find_or_create_by domain: URI(link).host\n # search_result_domain= domain\n self.search_result_domain_id = domain.id\n save\n super\n end\n end", "def cctld_from_locale( locale )\n # return \"il\" if locale.to_s == \"he\"\n return if locale.to_s.split( \"-\" ).size < 2\n\n region = locale.to_s.split( \"-\" ).last\n case region\n # There are a few exceptions to ISO 3166-1 / ccTLD mapping\n when \"gb\" then \"uk\"\n else region\n end\n end", "def scope_langs\n if params[:language_id].present?\n langs_scope = []\n langs_scope << \"langs.language_id = #{params[:language_id]}\"\n langs_condition = \"SELECT user_id FROM langs WHERE #{langs_scope.join('AND')}\"\n @users = @users.where(\"users.id IN (#{langs_condition})\")\n end\n end", "def extract_locale_from_subdomain\n unless request.subdomains.empty?\n parsed_locale = request.subdomains.first\n else # Assume no tld if no subdomains (assume something like \"es.localhost\")\n parsed_locale = request.domain.split('.')[0]\n end\n if parsed_locale\n if I18n.available_locales.include?(parsed_locale.intern)\n parsed_locale.intern\n else\n nil\n end\n end\n end", "def build_indexes(doc, scope_key = nil, by_model_type = false, locales = nil)\n if locales.is_a?(Array)\n locales.each { |locale| build_index(doc, scope_key, by_model_type, locale) }\n else\n build_index(doc, scope_key, by_model_type, locales)\n end\n end", "def extract_locale_from_tld\n # parsed_locale = request.host.split('.').last\n # I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n parsed_locale = request.url.split('/')\n if !parsed_locale[3].blank?\n I18n.available_locales.include?(parsed_locale[3].to_sym) ? parsed_locale[3] : nil\n end\n end", "def extract_locale_from_tld\n parsed_locale = request.host.split('.').last\n \n end", "def translation\r\n translation_for(Mongoid::Globalize.locale)\r\n end", "def index\n @queries = Query.where(language_id: params[:language_id])\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 verificar_locale\n \n end", "def translate(locale, key, options = {})\n @locale = locale_in_context(locale)\n\n options[:scope] = [options[:scope]] unless options[:scope].is_a?(Array) || options[:scope].blank?\n key = \"#{options[:scope].join('.')}.#{key}\".to_sym if options[:scope] && key.is_a?(Symbol)\n count = options[:count]\n # pull out values for interpolation\n values = options.reject { |name, value| [:scope, :default].include?(name) }\n\n entry = lookup(@locale, key)\n cache_lookup = true unless entry.nil?\n\n # if no entry exists for the current locale and the current locale is not the default locale then lookup translations for the default locale for this key\n unless entry || @locale.default_locale?\n entry = use_and_copy_default_locale_translations_if_they_exist(@locale, key)\n end\n\n # if we have no entry and some defaults ... start looking them up\n unless entry || key.is_a?(String) || options[:default].blank?\n default = options[:default].is_a?(Array) ? options[:default].shift : options.delete(:default)\n return translate(@locale.code, default, options.dup)\n end\n\n # this needs to be folded into the above at some point.\n # this handles the case where the default of the string key is a space\n if !entry && key.is_a?(String) && options[:default] == \" \"\n default = options[:default].is_a?(Array) ? options[:default].shift : options.delete(:default)\n return translate(@locale.code, default, options.dup)\n end\n\n # The requested key might not be a parent node in a hierarchy of keys instead of a regular 'leaf' node\n # that would simply result in a string return. If so, check the database for possible children \n # and return them in a nested hash if we find them.\n # We can safely ignore pluralization indeces here since they should never apply to a hash return\n if !entry && (key.is_a?(String) || key.is_a?(Symbol))\n #We need to escape % and \\. Rails will handle the rest.\n escaped_key = key.to_s.gsub('\\\\', '\\\\\\\\\\\\\\\\').gsub(/%/, '\\%')\n children = @locale.translations.find(:all, :conditions => [\"raw_key like ?\", \"#{escaped_key}.%\"]).select{|child| child.raw_key =~ /^#{key}/}\n if children.size > 0\n entry = hashify_record_array(key.to_s, children)\n @cache_store.write(Translation.ck(@locale, key), entry) unless cache_lookup == true\n return entry\n end\n end\n\n # we check the database before creating a translation as we can have translations with nil values\n # if we still have no blasted translation just go and create one for the current locale!\n unless entry \n pluralization_index = (options[:count].nil? || options[:count] == 1) ? 1 : 0\n translation = @locale.translations.find_by_key_and_pluralization_index(Translation.hk(key), pluralization_index) ||\n @locale.create_translation(key, key, pluralization_index)\n entry = translation.value_or_default\n end\n\n # write to cache unless we've already had a successful cache hit\n @cache_store.write(Translation.ck(@locale, key), entry) unless cache_lookup == true\n\n entry = pluralize(@locale, entry, count)\n entry = interpolate(@locale.code, entry, values)\n entry.is_a?(Array) ? entry.dup : entry # array's can get frozen with cache writes\n end", "def all_domains(page: nil, per: nil, params:, requester: nil)\n filter_sql = qualified_domain_ids(params[:domain_filter])\n\n # get sorting rules\n sorts = params.fetch(:sort, {}).first || []\n sort = %w[name registrar_name valid_to].include?(sorts.first) ? sorts.first : 'valid_to'\n order = %w[asc desc].include?(sorts.second) ? sorts.second : 'desc'\n\n # fetch domains\n domains = qualified_domain_name_list(requester, filter_sql)\n domains = domains.includes(:registrar).page(page).per(per)\n\n # using small rails hack to generate outer join\n domains = if sorts.first == 'registrar_name'.freeze\n domains.where.not(registrars: { id: nil })\n .order(\"registrars.name #{order} NULLS LAST\")\n else\n domains.order(\"#{sort} #{order} NULLS LAST\")\n end\n\n # adding roles. Need here to make faster sqls\n domain_c = Hash.new([])\n registrant_domains.where(id: domains.map(&:id)).each do |d|\n domain_c[d.id] |= ['Registrant'.freeze]\n end\n\n DomainContact.where(contact_id: id, domain_id: domains.map(&:id)).each do |d|\n domain_c[d.domain_id] |= [d.type]\n end\n\n domains.each { |d| d.roles = domain_c[d.id].uniq }\n domains\n end", "def load_locale!(locale)\n @projects.each do |project|\n @adapter.allowed_extensions.each do |extension|\n result = project.export locale, extension, @fallback\n\n if result.nil?\n raise \"Could not load project #{project} with extension #{extension} and locale #{locale}\"\n end\n\n strings, plurals = @adapter.parse result, extension\n\n strings = project.filter strings\n plurals = project.filter plurals\n\n warn \"Did not find any strings or plurals in #{project}\" if strings.empty? && plurals.empty?\n\n @strings[locale] = (@strings[locale] || {}).merge(strings)\n @plurals[locale] = (@plurals[locale] || {}).merge(plurals)\n end\n end\n end", "def find_locale_entry\n @locale_entry = @source_entry.locale_glossary_entries.find_by_rfc5646_locale! params[:id]\n end", "def index\n @locales = query(LOCALE, :code)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @locales }\n end\n end", "def translations_for(language = nil, rank = nil)\n translations = Tr8n::Translation.where(\"translation_key_id = ?\", self.id)\n if language\n translations = translations.where(\"language_id in (?)\", [language].flatten.collect{|lang| lang.id})\n end\n translations = translations.where(\"rank >= ?\", rank) if rank\n translations.order(\"rank desc\").all\n end", "def translations_for(language = nil, rank = nil)\n translations = Tr8n::Translation.where(\"translation_key_id = ?\", self.id)\n if language\n translations = translations.where(\"language_id in (?)\", [language].flatten.collect{|lang| lang.id})\n end\n translations = translations.where(\"rank >= ?\", rank) if rank\n translations.order(\"rank desc\").all\n end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end" ]
[ "0.63859767", "0.60368353", "0.60186625", "0.589506", "0.5874854", "0.57998365", "0.5765718", "0.57459337", "0.56993604", "0.56993604", "0.5674319", "0.56723654", "0.5597257", "0.55960816", "0.5562583", "0.5527979", "0.55152065", "0.5492132", "0.5490525", "0.5482087", "0.5441648", "0.5423363", "0.5419911", "0.541863", "0.5396202", "0.5393264", "0.5345817", "0.534489", "0.5334959", "0.53305364", "0.5327459", "0.5317585", "0.5313038", "0.53040004", "0.5296547", "0.52746415", "0.52714705", "0.5264283", "0.52561235", "0.52515686", "0.5250542", "0.52224016", "0.5218281", "0.5214748", "0.5205208", "0.52006114", "0.52002716", "0.5190468", "0.51896614", "0.5180881", "0.51718634", "0.5170178", "0.51665455", "0.5147471", "0.51439244", "0.51394045", "0.51354384", "0.51341575", "0.51337314", "0.5126898", "0.5122547", "0.5114767", "0.51042527", "0.51027817", "0.5087226", "0.5077289", "0.5070744", "0.5066231", "0.50654215", "0.5054688", "0.5053048", "0.5051518", "0.50515085", "0.5040191", "0.5034394", "0.5028492", "0.5027065", "0.5025786", "0.5008544", "0.50076145", "0.5002391", "0.50000477", "0.499888", "0.49984303", "0.4990086", "0.4989761", "0.49812862", "0.49780765", "0.49765012", "0.4974403", "0.49737954", "0.4973211", "0.49698877", "0.49682388", "0.49682388", "0.4967242", "0.4967242", "0.4967242", "0.4967242", "0.4967242" ]
0.6122164
1
event type http method URI path (without host or query params) session id props props[nid] network id (e.g. IP address) props[cid] customer ID props[ua] User Agent props[ref] HTTP referrer
def add_request meth, uri props = { MrBelvedere::Fields::HTTP_METHOD => meth.to_s.downcase, MrBelvedere::Fields::REQUEST_URI => uri.to_s, MrBelvedere::Fields::CURRENT_TIME => Familia.now }.merge @props requests.unshift props # add to the end so we can read in reverse-chronological end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_for_event type, opts={}\n p = HashWithIndifferentAccess.new\n parent_controller.request.parameters.each do |k,v|\n if k.end_with? \"_id\" or k == \"id\"\n p[k] = v\n end\n end\n\n super type, p.merge(opts)\n end", "def url_for_event(type, options)\n options.reverse_merge!(:type => type)\n \n apotomo_event_path(apotomo_request_processor.address_for(options))\n end", "def event\n params.payload[:event].to_sym\n end", "def ==(event)\n @http_verb == event.http_verb && @url == event.url && @params == event.params && @headers == event.headers\n end", "def generate_url( name, props = {}, params = {}, request = nil )\n event_props = props.dup\n event_props[:token] = @token\n event_props[:time] = Time.now.to_i if( !props[:time] )\n if( request.respond_to?(:remote_ip) )\n event_props[:ip] = request.remote_ip if( !props[:ip] )\n event_props[:distinct_id] = request.remote_ip if( !props[:distinct_id] )\n end\n\n data = { :event => name, :properties => event_props }\n encoded = Base64::encode64(data.to_json).gsub(/\\s/, '')\n params[:data] = encoded\n param_strings = []\n params.each_pair {|key,val|\n param_strings << \"#{key}=#{CGI.escape(val.to_s)}\"\n }\n\n endpoint = @options[:ssl] ? @@https_endpoint : @@http_endpoint\n url = \"#{endpoint}/track/?#{param_strings.join('&')}\"\n return url\n end", "def request_method\n {:filter => :post,\n :sample => :get,\n :firehose => :get,\n :retweet => :get\n }.fetch(@path, :get)\n end", "def my_event_params\n params.require(:my_event).permit(:event_type, :remote_ip,\n :referer => [:scheme, :host, :path, :query, :fragment])\n # TODO: Use if you want get info from request\n # .merge(request: request)\n end", "def event_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'event',\n 'Event' => 'click',\n 'EventKey' => 'ping', # will send a pong\n }\nend", "def request(event)\n log_action_summary(event)\n log_request_details(event)\n log_response_details(event)\n end", "def http_method(v)\n endpoint_info[:http_method] = v\n end", "def request_method_symbol; end", "def request_method; end", "def request_uri; end", "def requested_method\n\t\t\t\t# respond to websocket special case\n\t\t\t\treturn :pre_connect if request.upgrade?\n\t\t\t\t# respond to save 'new' special case\n\t\t\t\treturn (self.class.has_method?(:save) ? :save : false) if (request.request_method =~ /POST|PUT|PATCH/i.freeze) && (params[:id].nil? || params[:id] == 'new'.freeze)\n\t\t\t\t# set DELETE method if simulated\n\t\t\t\trequest.request_method = 'DELETE'.freeze if params[:_method] && params[:_method].to_s.downcase == 'delete'.freeze\n\t\t\t\t# respond to special :id routing\n\t\t\t\tparams[:id].to_s.downcase.to_sym.tap { |met| return met if self.class.has_exposed_method?(met) } if params[:id]\n\t\t\t\t#review general cases\n\t\t\t\tcase request.request_method\n\t\t\t\twhen 'GET'.freeze, 'HEAD'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:index) ? :index : false) unless params[:id]\n\t\t\t\t\treturn (self.class.has_method?(:show) ? :show : false)\n\t\t\t\twhen 'POST'.freeze, 'PUT'.freeze, 'PATCH'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:update) ? :update : false)\n\t\t\t\twhen 'DELETE'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:delete) ? :delete : false)\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend", "def info(event)\n get(:standard, {:method => \"event.getInfo\", :event => event})\n end", "def request_method\n @attributes[:request_method]\n end", "def trace_event_info(event)\n {\n stamp: Time.now,\n event: event[0]\n }.merge(\n send(:\"event_props_#{event[0]}\", event)\n )\n end", "def request_path; end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def log_request_details(event)\n env = event.payload\n debug do\n \"[#{req_id(env)}] #{req_dest(env)} > \" \\\n \"#{env.request_headers.sort.to_h.to_json}\"\n end\n end", "def netnoop_parse_request_details(request)\n protocol = use_ssl? ? \"https\" : \"http\"\n\n path = request.path\n path = URI.parse(request.path).request_uri if request.path =~ /^http/\n\n if request[\"authorization\"] =~ /^Basic /\n userinfo = FakeWeb::Utility.decode_userinfo_from_header(request[\"authorization\"])\n userinfo = FakeWeb::Utility.encode_unsafe_chars_in_userinfo(userinfo) + \"@\"\n else\n userinfo = \"\"\n end\n \n # TODO: optionally store the port\n # uri = \"#{protocol}://#{userinfo}#{self.address}:#{self.port}#{path}\"\n uri = \"#{protocol}://#{userinfo}#{self.address}#{path}\"\n method = request.method.downcase.to_sym\n \n return uri, method\n end", "def event_params\n params[:event]\n end", "def event_params\n params[:event]\n end", "def event_params\n params[:event]\n end", "def event\r\n @event\r\n @comments\r\n @replies \r\n end", "def event_url\n \"http://gigs.gigatools.com/gig/#{self.id}\"\n end", "def event_params\n params[:event]\n end", "def event_type\n headers = {}\n request.headers.each {|k, v| headers[k] = v}\n if headers.key? 'X-GitHub-Event'\n \"github_#{headers['X-GitHub-Event']}\".to_sym\n else\n 'tracker'\n end\n end", "def request_type; \"RequestType\"; end", "def further_details \n {\n 'referer_host' => 'referer_path',\n 'referer_path' => 'referer_params',\n \n 'agent.name' => 'agent.major_version',\n 'agent.os' => 'agent.name',\n 'agent.major_version' => 'agent.full_version',\n 'agent.engine_name' => 'agent.engine_version', \n }\n end", "def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end", "def track\n # Log an event\n params.reject{|k,v| ['action', 'controller'].include? k}.each do |event_type, event_detail|\n Event.create :name => event_type, :description => event_detail,\n :ip => request.remote_ip, :useragent => request.headers['user-agent']\n end\n render :nothing => true\n end", "def path ; @request.path_info ; end", "def event_params\n params[:event]\n end", "def get_request_id\n\t\treturn @transport.get_path(\"meta\",\"id\")\n\tend", "def get_requested_route(env)\n request = Rack::Request.new(env)\n \n http_method = request.request_method.downcase\n path = request.path_info\n\n [http_method, path]\n end", "def events\n # ignore messages from bots!\n\n case params[:type]\n when 'url_verification'\n logger.info \"verifying url\"\n render json: { challenge: params[:challenge] }\n when 'event_callback'\n return unless event_params[:bot_id].nil?\n\n render json: nil\n ProcessSlackMessageJob.perform_later(event_params.as_json)\n\n else\n logger.info '*'*10\n logger.info \"Unknown event type: #{params[:type]}\"\n logger.info params.inspect\n end\n end", "def click_url\n @hash[\"ClickUrl\"]\n end", "def extract_request_class( endpoint )\n endpoint.options[:via].const_get(:Request)\n end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def edge kind, params\n send(\"edge_#{kind.downcase}\".to_sym, params)\n end", "def request_method_symbol\r\nHTTP_METHOD_LOOKUP[request_method]\r\nend", "def log_event(params)\n puts \"Log Details:\"\n puts \"<====================>\"\n puts \"Event Type: #{params['event']}\"\n puts \"Recepient: #{params['recipient']}\"\n puts \"City: #{params['city']}\"\n puts \"Country: #{params['country']}\"\n puts \"Client Type: #{params['client-type']}\"\n puts \"Client Name: #{params['client-name']}\"\n puts \"Device Type: #{params['device-type']}\"\n puts \"Client OS: #{params['client-os']}\"\n puts \"Url Clicked: #{params['url']}\" if params['event'] == \"clicked\"\n puts \"Logged at: #{Time.at(params['timestamp'].to_i).utc.to_datetime}\"\n puts \"<====================>\"\n end", "def request_path(*args)\n if has_attribute? :uri then uri else super end\n end", "def route_onestop_id\n route.onestop_id\n end", "def event_code\n @payload.fetch('event')\n end", "def request_keys\n [:created_at, :user_agent, :referrer, :remote_ip]\n end", "def track_event args\n unless APP_CONFIG[:actions_to_track].include?(args[:action])\n Rails.logger.error \"Invalid action name #{args[:action]} has been send to track. Args is #{args}\"\n return\n end\n begin\n if args[:type] != 'delete' && args[:type] != 'qgeoinfo'\n detail = {\n actor_gender: current_user.gender,\n actor_id: current_user.id.to_s,\n ip: (Rails.env == 'production' ? request.remote_ip : '73.222.0.206'), \n platform: browser.platform, \n is_mobile: @is_mobile, \n user_agent: request.user_agent,\n browser: browser.name\n }.merge args\n obj = Tracking.create(detail.except(:type))\n end\n Resque.enqueue RunTrackingResqueJob, { \n packet: args.merge(actor_id: current_user.id.to_s),\n tid: (obj.id.to_s rescue nil)\n }\n rescue => e\n Rails.logger.error \"Tracking job could not get added. Error is #{e.message} and args is #{args}\"\n end\n end", "def event_params\n\n\n end", "def request_id; end", "def get_api_endpoint(type_to_scrape, obj)\n reader = CSV.read('keys/eventbrite_key.csv')\n token = reader.shift[0]\n organizer_id = reader.shift[0]\n prefix = \"https://www.eventbriteapi.com/v3\"\n case type_to_scrape\n when \"eid\"\n endpoint = \"#{prefix}/users/#{organizer_id}/owned_events/\" \\\n \"?order_by=start_desc&token=#{token}\"\n when \"event\"\n endpoint = \"#{prefix}/events/#{obj}/?token=#{token}\"\n when \"attendee\"\n endpoint = \"#{prefix}/events/#{obj}/attendees/?token=#{token}&expand=\" \\\n \"category,attendees,subcategory,format,venue,event\" \\\n \",ticket_classes,organizer,order,promotional_code\"\n when \"vid\"\n endpoint = \"#{prefix}/users/#{organizer_id}/venues/?token=#{token}\"\n when \"venue\"\n endpoint = \"#{prefix}/venues/#{obj}/?token=#{token}\"\n end\n end", "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def handle_get_request(client_request)\n parse_uri(client_request)\n path_name(uri)\n end", "def request=(request)\n return unless request\n\n self.remote_ip = request.remote_ip\n self.event_type = request.request_method.to_s.downcase.to_sym\n\n # URI constructor class convert referer URL into an object\n # https://ruby-doc.org/stdlib-2.4.2/libdoc/uri/rdoc/URI.html#module-URI-label-Basic+example\n if request.referer\n uri = URI(request.referer)\n\n write_attribute(:referer, {\n scheme: uri.scheme,\n host: uri.host,\n path: uri.path,\n query: uri.query,\n fragment: uri.fragment\n })\n end\n end", "def as_collector_uri(endpoint, protocol, port, method)\n port_string = port == nil ? '' : \":#{port.to_s}\"\n path = method == 'get' ? '/i' : '/com.snowplowanalytics.snowplow/tp2'\n\n \"#{protocol}://#{endpoint}#{port_string}#{path}\"\n end", "def dispatch_request(env)\n @params = Hash.recursively_symbolize_graph!(Rack::Utils::parse_query(env['QUERY_STRING']))\n @json_data = @internal_proxy ? (EventMachineRPC.parse_json_from_file(@params[:json_path]) rescue {}) : {}\n method = strip_base(env)\n self.send(method.to_sym, env)\n end", "def event_action_tuple(event)\n params = common_event_params(event)\n params[:_type] = get_event_type(event) if use_event_type?(nil)\n\n if @parent\n if @join_field\n join_value = event.get(@join_field)\n parent_value = event.sprintf(@parent)\n event.set(@join_field, { \"name\" => join_value, \"parent\" => parent_value })\n params[routing_field_name] = event.sprintf(@parent)\n else\n params[:parent] = event.sprintf(@parent)\n end\n end\n\n action = event.sprintf(@action || 'index')\n raise UnsupportedActionError, action unless VALID_HTTP_ACTIONS.include?(action)\n\n if action == 'update'\n params[:_upsert] = LogStash::Json.load(event.sprintf(@upsert)) if @upsert != \"\"\n params[:_script] = event.sprintf(@script) if @script != \"\"\n params[retry_on_conflict_action_name] = @retry_on_conflict\n end\n\n params[:version] = event.sprintf(@version) if @version\n params[:version_type] = event.sprintf(@version_type) if @version_type\n\n EventActionTuple.new(action, params, event)\n end", "def request_path\n \"/nodes/id/681e84fd-b06b-4044-9c51-2b74a9e2dc24/storage/id/d66570fa-9d51-4f6e-ab26-bdace295353e\"\nend", "def events\n if params[:id]\n url_id = Base64.decode64(params[:id])\n ids = url_id.split('_')\n #a[:id].to_s+'_'+a[:user_id].to_s+'_'+@aff[:id].to_s+'_'+@event[:id].to_s\n user_join_id = ids[0]\n user_id = ids[1]\n affiliate_id = ids[2]\n event_id = ids[3]\n @aff = Affiliate.find(affiliate_id)\n \n if user_id==session[:user_id] || @aff[:user_id]==session[:user_id]\n redirect_to :controller => 'home', :action => 'index'\n #render :text => session[:user_id] \n else \n \n if Event.exists?(event_id) \n UserJoin.update_all([\"site_visits = site_visits+1 \"], [\"id = ?\",user_join_id])\n session[:aff_user_join_id] = user_join_id\n session[:aff_visiter_id] = session[:user_id]\n session[:aff_event_id] = event_id\n session[:aff_affiliate_id] = affiliate_id\n \n @event = Event.find(event_id) \n if @event[:event_url_link]=='' || @event[:event_url_link]==nil \n page_url = APP_CONFIG['development']['site_url']+'events/view/'+@event[:id].to_s \n else\n page_url = APP_CONFIG['development']['site_url']+'event/'+@event[:event_url_link]\n end\n \n redirect_to(page_url)\n else\n redirect_to :controller => 'home', :action => 'index' \n end \n \n end\n else\n redirect_to :controller => 'home', :action => 'index' \n end\n end", "def path_for_event(event, filters = nil, last_view = nil)\n return \"/\" unless event\n\n unless filters.nil?\n filters[:location] ||= ''\n filters[:theme] ||= ''\n end\n\n path = \"/events/#{event.start.year}/#{Date::MONTHNAMES[event.start.month]}/#{event.start.day}/#{event.slug}?\"\n\n path += \"last_view=#{last_view}\" unless last_view.nil? || last_view.empty?\n path += \"&amp;filter%5Btheme%5D=#{URI.encode(filters[:theme])}&amp;filter%5Blocation%5D=#{URI.encode(filters[:location])}\" unless filters.nil? || filters.empty?\n\n path\n end", "def remote_method_uri(method, format='ruby')\n params = {'run_id' => @agent_id, 'marshal_format' => format}\n uri = \"/agent_listener/#{PROTOCOL_VERSION}/#{@license_key}/#{method}\"\n uri << '?' + params.map do |k,v|\n next unless v\n \"#{k}=#{v}\"\n end.compact.join('&')\n uri\n end", "def route\n \"#{@http_verb.to_s.upcase} #{@url}\"\n end", "def woopra_http_request(is_tracking, event = nil)\n base_url = 'www.woopra.com'\n get_params = {}\n\n # Configuration\n get_params['host'] = @current_config[:domain].to_s\n get_params['cookie'] = @current_config[:cookie_value].to_s\n get_params['ip'] = @current_config[:ip_address].to_s\n get_params['timeout'] = @current_config[:idle_timeout].to_s\n\n # Identification\n @user.each do |key, value|\n get_params['cv_' + key.to_s] = value.to_s\n end\n\n if !is_tracking\n url = '/track/identify/?'\n else\n if event[0].nil?\n get_params['event'] = 'pv'\n get_params['ce_url'] = @current_config[:url]\n else\n get_params['event'] = event[0].to_s\n event[1]&.each do |key, value|\n get_params['ce_' + key.to_s] = value.to_s\n end\n end\n url = '/track/ce/?'\n end\n\n get_params.each do |key, value|\n url += CGI.escape(key) + '=' + CGI.escape(value) + '&'\n end\n\n url = url[0..-1] + '&ce_app=' + SDK_ID\n\n http = Net::HTTP.new(base_url)\n user_agent = @current_config[:user_agent]\n\n req = if !user_agent.nil?\n Net::HTTP::Get.new(url, 'User-Agent' => user_agent)\n else\n Net::HTTP::Get.new(url)\n end\n\n http.request(req)\n end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def click_on_event option\n visits event_path(option.event)\n clicks_link option.description\n end", "def type ; :event ; end", "def event_types; end", "def method_hash(m)\n hash = {:name=>m.name, :visibility=>m.visibility, :params=>m.params, :url=>\"#{path}\\##{m.aref}\", :anchor=>m.aref, :description=>m.description.strip}\n hash[:callseq] = m.call_seq.gsub(/->/, '&rarr;') if m.call_seq\n hash\n end", "def append_info_to_payload(payload)\n super\n payload[:referrer] = request&.referrer\n payload[:session_id] = request&.session&.id\n payload[:user_agent] = request&.user_agent\n end", "def components(the_body)\n super\n @transfer_time = the_body.dig(\"event\", \"resource\", \"transfer_time\")\n @transfer_type = the_body.dig(\"event\", \"resource\", \"transfer_type\")\n @destination = the_body.dig(\"event\", \"resource\", \"destination\")\n @destination_type = the_body.dig(\"event\", \"resource\", \"destination\", \"type\")\n @msisdn = the_body.dig(\"event\", \"resource\", \"destination\", \"msisdn\")\n @destination_mm_system = the_body.dig(\"event\", \"resource\", \"destination\", \"mm_system\")\n end", "def method\n request.method\n end", "def event_props_block(event)\n {\n fiber: event[1],\n caller: event[2]\n }\n end", "def event_context\n {\n service: service,\n category: category,\n name: name,\n data: data,\n timestamp: Time.now.utc,\n uuid: SecureRandom.uuid\n }\n end", "def event_url(options = {}) \n\t option = Proc.new {|o| {:controller => 'wkexpense', :action => 'reportdetail', :project_id => o.project, :issue_id => o.issue}} \t \n\t if option.is_a?(Proc)\n\t\toption.call(self)\n\t end\n\tend", "def http_method\n METHODS[self[:method]]\n end", "def event_params\n params.fetch(:event, [:address, :held_at, :maximum_guest_count, :image, :time, :price, :dishname, :ingredients, :address, :seats])\n end", "def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end", "def beacon_url(event_collection, properties)\n json = MultiJson.encode(properties)\n data = [json].pack(\"m0\").tr(\"+/\", \"-_\").gsub(\"\\n\", \"\")\n \"https://#{api_host}#{api_event_resource_path(event_collection)}?data=#{data}\"\n end", "def hash\n [id, user, client, remote_ip, service_name, event_date, message, action, entity, entity_type, property_changes, context].hash\n end", "def type; return :\"incoming_#{@type.to_s}\"; end", "def normalized_request_method\n method = @env[\"REQUEST_METHOD\"]\n method == 'HEAD' ? 'get' : method.downcase\n end", "def to_h\n network_request.to_h.tap do |attrs|\n attrs[:type] = CONTEXT_TYPE\n attrs[:path] = attrs.delete(:url)\n end\n end", "def view_event(user, event) \n\tend", "def handler(event, *meths)\n meths.each do |meth|\n events[event.to_sym] ||= []\n events[event.to_sym] << {type: :method, method: meth.to_sym}\n end\n self\n end", "def link\n \"/events/#{id}\"\n end", "def endpoint\n data[:endpoint]\n end" ]
[ "0.61553514", "0.5900639", "0.5629537", "0.5620052", "0.5591432", "0.5470911", "0.5437945", "0.5300553", "0.52429897", "0.52094793", "0.5208593", "0.51889414", "0.51594347", "0.5091299", "0.50741374", "0.50623083", "0.50455517", "0.5042859", "0.5028692", "0.5010657", "0.5009813", "0.49972454", "0.49972454", "0.49972454", "0.4983802", "0.49623045", "0.49617717", "0.49594006", "0.4948963", "0.49394557", "0.493231", "0.49237224", "0.49148485", "0.4905457", "0.4899155", "0.4880919", "0.4880355", "0.48716384", "0.48558164", "0.48551303", "0.48551303", "0.48551303", "0.48551303", "0.48517814", "0.48416334", "0.48363942", "0.4822407", "0.4820492", "0.48086086", "0.48072195", "0.48053834", "0.47983032", "0.4794113", "0.47895318", "0.47883582", "0.47855526", "0.4777201", "0.47736657", "0.47710255", "0.47687727", "0.47666642", "0.47635937", "0.47543544", "0.4749478", "0.47469798", "0.47469774", "0.47453883", "0.47453883", "0.47453883", "0.47453883", "0.47453883", "0.47453883", "0.47453883", "0.47453883", "0.47453883", "0.47453883", "0.47453883", "0.47453883", "0.4737452", "0.47329375", "0.4730911", "0.47293255", "0.47247952", "0.47113895", "0.47099003", "0.4709654", "0.47027475", "0.4698455", "0.46919334", "0.468106", "0.4679912", "0.46797687", "0.46754944", "0.4674575", "0.467063", "0.46703795", "0.4667211", "0.46667552", "0.4664028", "0.46629152" ]
0.5269339
8
Dispatch all missing methods to lookup calls in rpm spec metadata
def method_missing(method, *args, &block) # proxy to metadata if @metadata.has_key?(method) @metadata[method] else super(method, *args, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method_sym, *arguments, &block)\n method = method_sym.to_s\n\n #puts \"%s %s %s\" % [\"---- \", method, \" ----\"]\n #\n if method =~ /^[A-Z]\\d{2}(_\\d{2})?/\n Array(parse(get_spec(method))).join(', ') rescue ''\n elsif respond_to?((/(\\w+)/.match(method))[0])\n instance_eval(method) rescue ''\n # for testing:\n elsif %w(E_STRING E_MULTI_STRING E_NUMBER E_DATETIME E_DATE E_TIME E_YES_NO E_SINGLE E_MULTIPLE E_ALLOW_NEGATIVE E_LOOKUP).include?(method)\n Array(parse(get_spec(method))).join(', ') rescue ''\n else\n super\n end\n end", "def method_missing(m, *args)\n\n if m.to_s.eql?('describe')\n self.client.describe\n elsif m.to_s.eql?('search')\n self.client.search(args[0])\n else\n #todo We need to add a list of available 'methods' here to gut check\n begin\n self.client.find(m.to_s, args[0])\n rescue\n super\n end\n end\n\n end", "def method_missing(symbol, *args)\n\t\t\t\tif(args == nil or args.length == 0)\n\t\t\t\t\tname = symbol.id2name\n\t\t\t\t\tif(name =~ /\\?$/)\n\t\t\t\t\t\treturn(installed?(name[/^(.*)\\?$/, 1]))\n\t\t\t\t\telse\n\t\t\t\t\t\treturn(packages()[name])\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tsuper.method(symbol).call(args)\n\t\t\tend", "def method_missing(method, *args, &block)\n if name?(method.to_sym)\n find(method.to_sym)\n else\n super\n end\n end", "def method_missing(name, *args)\n raise \"MethodMissing loop when searching for #{name} with #{args.inspect}\" if searching_for_method?\n @searching_for_method = true\n return create_resource(name, args[0], args[1]) if valid_type?(name)\n\n name = map_function(name)\n\n return call_function(name, args) if Puppet::Parser::Functions.function(name)\n\n super\n ensure\n @searching_for_method = false\n end", "def resolution(*args); end", "def method_missing(*rest) end", "def method_missing(method, *args, &blk); end", "def liquid_method_missing(method); end", "def method_missing(meth, *args, &block)\n __describe_and_send__(meth, *args, &block)\n end", "def method_missing(method_name)\n if METADATA.include? method_name.to_s\n content_of(method_name.to_s)\n end\n end", "def method_missing(sym, *a, &b) # :nodoc:\n if REMOVED_METHODS.include?(sym)\n removed_method_calls << sym\n return\n end\n\n if @specification_version > CURRENT_SPECIFICATION_VERSION and\n sym.to_s.end_with?(\"=\")\n warn \"ignoring #{sym} loading #{full_name}\" if $DEBUG\n else\n super\n end\n end", "def method_missing(method_name, *args); end", "def method_missing(method_name, *args); end", "def method_missing(wh,*therest)\n # xxx internal methods must be protected at some point\n end", "def method_missing(method, *arguments, &block); end", "def method_missing(meth, *args); end", "def method_missing(*args, &block); end", "def method_missing(method, *args, &block)\n calling_method = caller_locations(1, 2)[1]\n puts(\"#{self.class.name}##{__method__}() looking for: ##{method}, from #{calling_method.path}##{calling_method.label}\")\n\n if defined?(@_registry)\n block_given? ? @_registry.send(method, *args, block) :\n (args.size == 0 ? @_registry.send(method) : @_registry.send(method, *args))\n else\n super\n end\n\n end", "def method_missing(method, *args, &block); end", "def method_missing(method, *args, &block)\r\n @spec.send(method, *args, &block)\r\n end", "def method_missing(code, *args, &blk); end", "def method_missing(code, *args, &blk); end", "def method_missing(name, *args); end", "def method_missing(name, *args); end", "def method_missing name, *named, **ordered, &block\n #log \"method #{name} missing on #{@name}\"\n capability_name = name[0..-2].to_sym\n params = RBCM::Params.new named, ordered\n if not @@capabilities.include? capability_name\n super\n elsif name =~ /\\!$/\n return # never call cap! diectly\n elsif name =~ /\\?$/\n __search capability_name, params, &block\n end\n end", "def finder_methods=(_arg0); end", "def method_missing(sym, *args)\n lookup(sym.to_sym)\n end", "def probe(api_map); end", "def method_missing(method_name, *args)\n warn \"Method missing '#{method_name}'\"\n # if (method_name =~ /request_(.+)/)\n # property.key?($1) ? property.send($1) : (raise OmfRc::UnknownPropertyError, method_name.to_s)\n # elsif (method_name =~ /configure_(.+)/)\n # property.key?($1) ? property.send(\"[]=\", $1, *args) : (raise OmfRc::UnknownPropertyError, method_name.to_s)\n # else\n super\n # end\n end", "def method_missing(name, *args, &block); end", "def method_missing(name, *args, &block); end", "def method_missing(name, *args, &block); end", "def method_missing(name, *args, &block); end", "def method_missing(method, *args, &block)\n calling_method = caller_locations(1, 2)[1]\n Rails.logger.debug(\"#{self.class.name}##{__method__}() looking for: ##{method}, from #{calling_method.path}##{calling_method.label}\")\n\n block_given? ? registry.send(method, *args, block) :\n (args.size == 0 ? registry.send(method) : registry.send(method, *args))\n end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(meth, *args, &block); end", "def method_missing(mth, *args, &block); end", "def method_missing(method_name, *args)\n warn \"Method missing: '#{method_name}'\"\n if (method_name =~ /request_(.+)/)\n property.key?($1) ? property.send($1) : (raise OmfRc::UnknownPropertyError, method_name.to_s)\n elsif (method_name =~ /configure_(.+)/)\n property.key?($1) ? property.send(\"[]=\", $1, *args) : (raise OmfRc::UnknownPropertyError, method_name.to_s)\n else\n super\n end\n end", "def resolve\n\n @perms = Constants::NOTFOUND\n @package = Constants::NOTFOUND\n @version = Constants::NOTFOUND\n @pie = Constants::NOTFOUND\n @stack = Constants::NOTFOUND\n\n # Get the file permissions\n permline = `#{Constants::LSPATH} -l #@path 2>/dev/null`\n if permline != ''\n @perms = permline[0,10]\n end\n\n # dpk and apt\n if Constants::PACKAGE == \"apt\"\n # Default: not found\n @package = Constants::NOTFOUND\n @version = Constants::NOTFOUND\n\n packageline = `#{Constants::DPKGPATH} --search #@path 2>/dev/null`\n if packageline =~ /([a-zA-Z0-9\\-\\.]*):.*/\n @package = $1\n versionline = `#{Constants::DPKGPATH} -p #@package 2>/dev/null`\n versionline.each_line do |line|\n if line =~ /Version:\\ *([a-zA-Z0-9\\-\\.:]*)/\n @version = $1\n end\n end\n end\n\n # rpm\n elsif Constants::PACKAGE == \"rpm\"\n packageline = `#{Constants::RPM} -qf #@path 2>/dev/null`\n if packageline.size < 1\n @package = Constants::NOTFOUND\n @version = Constants::NOTFOUND\n else\n @package = packageline.chomp\n versionline = `#{Constants::RPM} -qi #@package 2>/dev/null`\n @version = Constants::NOTFOUND\n end\n end\n\n # Get PIE and stack info\n elfLine = `#{Constants::READELFPATH} -hl #@path 2>/dev/null`\n @pie = Constants::NOTFOUND\n @stack = Constants::NOTFOUND\n elfLine.each_line do |line|\n if line =~ /Type:\\ *EXEC.*/\n @pie = \"FALSE\"\n elsif line =~ /Type:.*/\n @pie = \"TRUE\"\n elsif line =~ /GNU_STACK\\ *0x[0-9a-f]*\\ *0x[0-9a-f]*\\ *0x[0-9a-f]*\\ *0x[0-9a-f]*\\ *0x[0-9a-f]*\\ *([A-Z]*).*/\n @stack = $1\n end\n end\n end", "def patch_names\n raise NotImplementedError\n end", "def method_missing(method_name, *arguments, &block)\n # Check to see if there is a control_dsl plugin activator hook with the method name\n registry = Inspec::Plugin::V2::Registry.instance\n hook = registry.find_activators(plugin_type: :control_dsl, activator_name: method_name).first\n if hook\n # OK, load the hook if it hasn't been already. We'll then know a module,\n # which we can then inject into the context\n hook.activate\n\n # Inject the module's methods into the context.\n # implementation_class is the field name, but this is actually a module.\n self.class.include(hook.implementation_class)\n # Now that the module is loaded, it defined one or more methods\n # (presumably the one we were looking for.)\n # We still haven't called it, so do so now.\n send(method_name, *arguments, &block)\n else\n # If we couldn't find a plugin to match, maybe something up above has it,\n # or maybe it is just a unknown method error.\n super\n end\n end", "def method_missing(:name, *args)\nend", "def method_missing(method, *args)\n if (service = method.to_s.match(/^(ip|vlm|dns)_(site|subnet6?|pool6?|address6?|alias6?|domain|range|vlan|server|view|zone|rr)_(add|update|info|list|delete|count)$/))\n r_module, r_object, r_action = service.captures\n\n if (@servicemapper.has_key?(service.to_s))\n r_mapped_service = @servicemapper[service.to_s][0]\n end\n\n # case r_action with add, update, list, delete, count to set r_method\n case r_action\n when 'add'\n r_method = 'post'\n when 'update'\n r_method = 'put'\n when 'delete'\n r_method = 'delete'\n else\n r_method = 'get'\n end\n\n self.call(r_method, r_mapped_service, args)\n else\n super\n end\n end", "def method_missing(m, *args, &block)\n\t\t# puts \"Called method missing with this function: #{m} and these args: #{args}\"\n\t\tbegin\n\t\t\t#Break out the method by snake case\n\t\t\tpieces = m.to_s.split(/\\_/)\n\t\t\t#Find the nodes_x_all, changesets_x_month, ways_x_year type of functions\n\t\t\tif pieces[1] == 'x'\n\n\t\t\t\tif args.empty?\n\t\t\t\t\tcons = {}\n\t\t\t\t\tstep = 1\n\t\t\t\telse\n\t\t\t\t\tcons = args[0][:constraints] || {} #Better pass a hash, otherwise it'll explode!\n\t\t\t\t\tstep = args[0][:step] || 1\n\t\t\t\tend\n\t\t\t\tinstance_eval \"#{pieces[0]}.run(unit: :#{pieces[2]}, step: #{step}, constraints: #{cons})\"\n\t\t\tend\n\n\t\trescue => e\n\t\t\tputs $!\n\t\t\tputs e.backtrace\n\t\t\tsuper(args)\n\t\tend\n\tend", "def method_missing(meth, *args, &block)\n # method in Ruby are all lowercase...\n if meth.to_s =~ /_[a-z0-9]+_order/\n STDERR.print(\"[!] method #{meth} not defined yet...\\n\")\n Kernel.exit 1\n else\n super\n end\n end", "def discover \n dispatch=\"discover_\"+options.action\n if respond_to?(dispatch)\n method(dispatch).call\n else\n raise \"AMEEM cannot resolve command \"+dispatch\n end\n end", "def method_missing(method_name, *args)\n req(method_name.to_s)\n end", "def method_missing(method_sym, *arguments)\n\n if method_sym.to_s =~ DECORATOR_METHOD_SIGNATURE\n # Strip off the decorator and see who can handle the real request\n actual_method_sym = method_sym.to_s[4..-1]\n if (asset_fleet_type.groups.include? actual_method_sym) || (asset_fleet_type.custom_groups.include? actual_method_sym) || (asset_fleet_type.label_groups.include? actual_method_sym)\n typed_asset = Asset.get_typed_asset(active_assets.first)\n typed_asset.try(actual_method_sym)\n end\n else\n puts \"Method #{method_sym.to_s} with #{arguments}\"\n # Pass the call on -- probably generates a method not found exception\n super\n end\n end", "def methods() end", "def method_missing(meth, *args, &block)\n\n end", "def methods_available_to_script\n [ 'program', 'version', 'updated, :maintainer',\n 'build_size', 'noarch', 'system_files',\n 'resource.categories', 'resource.dependencies', 'resource.conflicts',\n 'resource.compliment', 'resource.supplement' \n ].collect { |m| \"#{m}\" }\n end", "def method_missing(msg, *args, &block)\n puts \"#{self.class}#method_missing(#{msg})\" \n proc = self.singleton_class.resolve_dynamic_method(msg) || self.class.resolve_dynamic_method(msg)\n\n begin\n if !proc.nil?\n args.unshift self \n res = if block.nil?\n proc.call(*args)\n else\n proc.call(*args, &block)\n end\n return res\n elsif msg != :method_missing! && self.respond_to?(:method_missing!)\n puts \"\\tdelgating to method_missing!\"\n return method_missing!(msg, *args, &block)\n else\n return super(msg, *args, &block)\n # TODO - report RM bug for when block is empty\n end\n rescue NoMethodError => ex\n new_ex = NoMethodError.new(\"undefined method \\`#{msg}' for #{self.inspect}:#{self.class}\")\n new_ex.set_backtrace ex.backtrace\n raise new_ex\n end\n end", "def method_missing(method_sym, *args, &block)\n return nil\n end", "def method_missing(*)\n invertable nil\n end", "def prioritized_handlers\n @prioritized_handlers ||= super || begin\n result = providers.select { |handler| handler.provides?(node, resource) }.sort_by(:name)\n if !result.empty?\n Chef::Log.deprecation(\"#{resource.resource_name.to_sym} is marked as providing DSL #{method_symbol}, but provides #{resource.resource_name.to_sym.inspect} was never called!\")\n Chef::Log.deprecation(\"In Chef 13, this will break: you must call provides to mark the names you provide, even if you also override provides? yourself.\")\n end\n result\n end\n end", "def method_missing(symbol, *args)\n #$stdout.puts(\"method_missing: #{symbol}\")\n self.ext_aliases.aliases[symbol.to_s]\n end", "def method_missing(method)\n\t\t self[method]\n\t\tend", "def method_missing(method_name, *args)\n if responders.include?(method_name)\n response_method_for(method_name, *args)\n else\n super\n end\n end", "def standard_specs; end", "def method_missing(method_name, *_args, &_block)\n @collection.fetch(method_name.to_s) do\n raise \"Could not find `#{method_name}` in #{self.class.name}\"\n end\n end", "def resolve\n abstract\n end", "def lookup(method_name, args)\n # puts \"Looking up method #{method_name} with #{args} arguments\"\n if @methods[[method_name, args]]\n # puts \"Found #{method_name} (#{args} args)\"\n @methods[[method_name, args]]\n elsif @superclass\n @superclass.lookup(method_name, args)\n else\n raise \"Method not found: #{method_name}\"\n end\n end", "def internal_methods; end", "def method_missing(method, *args) #:nodoc:\n self[method]\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def method_missing(*args)\n\t\t\traise \"Method missing: #{args.inspect}\"\n\t\tend", "def method_missing(method_name, *args) self end", "def method_missing(method_name, *args) self end", "def report_method_stuff(requested_method_name, methods)\n entries = methods.find_all {|m| m.name == requested_method_name and (\n !@onlyLoadedClasses or \n Object.class_eval \"defined? #{m.nameSpace.full_name}\" ) }\n case entries.size\n when 1\n method = @ri_reader.get_method(entries.first)\n @display.display_method_info(method)\n when 0\n puts \"No loaded methods matched your request\"\n else\n @display.display_method_list(entries)\n end\n end", "def method_missing(method_name, *args)\n call_api_method(method_name, *args)\n end", "def respond_to_missing?(_method_name, _include_all)\n ::Kernel.raise ::NotImplementedError\n end", "def respond_to_missing?(_method_name, _include_all)\n ::Kernel.raise ::NotImplementedError\n end", "def method_missing namesym, *args\n results&.send namesym, *args\n end", "def method_missing(meth, *args, &block)\n dynamic_methods = self.class.instance_variable_get('@resource_map').keys\n dynamic_methods << :chain\n dynamic_methods << :table\n dynamic_methods << :action\n\n if dynamic_methods.include?(meth.to_sym) then\n if @property_hash[meth.to_sym] then\n return @property_hash[meth.to_sym]\n else\n return nil\n end\n elsif dynamic_methods.include?(meth.to_s.chomp(\"=\").to_sym) then\n debug(\"Args: #{args}\")\n @property_hash[:needs_change] = true\n return true\n end\n\n debug(\"Dynamic methods: #{dynamic_methods.join(' ')}\")\n debug(\"Method missing: #{meth}. Calling super.\")\n\n super\n end", "def method_missing(method, *args)\n \n # We could remove this check and return nil for any non-recognized tag.\n # The problem would be that it would make tricky to debug problems with\n # typos. For instance: <>.potr would return nil instead of raising an\n # exception\n unless supported_tags.include?(method)\n super\n return\n end\n\n # first we try the attributes: port, svc_name, protocol, severity,\n # plugin_id, plugin_name, plugin_family\n translations_table = {\n # @port = xml.attributes[\"port\"]\n # @svc_name = xml.attributes[\"svc_name\"]\n # @protocol = xml.attributes[\"protocol\"]\n # @severity = xml.attributes[\"severity\"]\n :plugin_id => 'pluginID',\n :plugin_name => 'pluginName',\n :plugin_family => 'pluginFamily'\n }\n method_name = translations_table.fetch(method, method.to_s)\n return @xml.attributes[method_name].value if @xml.attributes.key?(method_name)\n\n # then we try the children tags: solution, risk_factor, description,\n # plugin_publication_date, metasploit_name, cvss_vector,\n # cvss_temporal_vector, synopsis, exploit_available,\n # patch_publication_date, plugin_modification_date, cvss_temporal_score,\n # cvss_base_score, plugin_output, plugin_version, exploitability_ease,\n # vuln_publication_date, exploit_framework_canvas,\n # exploit_framework_metasploit, exploit_framework_core\n tag = @xml.xpath(\"./#{method_name}\").first\n if tag\n return tag.text\n end\n\n # then the custom XML tags (cm: namespace)\n if method_name.starts_with?('cm_')\n method_name = method_name.sub(/cm_/, 'cm:compliance-').gsub(/_/, '-')\n cm_value = @xml.at_xpath(\"./#{method_name}\", { 'cm' => 'http://www.nessus.org/cm' })\n if cm_value\n return cm_value.text\n else\n return nil\n end\n end\n\n\n # finally the enumerations: bid_entries, cve_entries, xref_entries\n translations_table = {\n :bid_entries => 'bid',\n :cve_entries => 'cve',\n :see_also_entries => 'see_also',\n :xref_entries => 'xref'\n }\n method_name = translations_table.fetch(method, nil)\n if method_name\n @xml.xpath(\"./#{method_name}\").collect(&:text)\n else\n # nothing found, the tag is valid but not present in this ReportItem\n return nil\n end\n end", "def method_missing(method_name, *args, &block)\n begin\n invoke_query_api_pattern_method(method_name, *args, &block)\n rescue PatternNotFoundError\n super\n end\n end", "def rpm_package_information\n super\n end", "def register_capabilities(methods); end", "def package_setup\n raise NotImplementedError\n end", "def method_missing(*)\n return nil\n end", "def method_missing(method, *args)\n\n # We could remove this check and return nil for any non-recognized tag.\n # The problem would be that it would make tricky to debug problems with\n # typos. For instance: <>.potr would return nil instead of raising an\n # exception\n unless supported_tags.include?(method)\n super\n return\n end\n\n # Any fields where a simple .camelcase() won't work we need to translate,\n # this includes acronyms (e.g. :cwe would become 'Cwe') and simple nested\n # tags.\n translations_table = {\n cwe: 'CWE',\n aop_source_file: 'AOPSourceFile',\n aop_source_line: 'AOPSourceLine',\n aop_additional: 'AOPAdditional',\n request: 'TechnicalDetails/Request',\n response: 'TechnicalDetails/Response',\n cvss_descriptor: 'CVSS/Descriptor',\n cvss_score: 'CVSS/Score'\n }\n method_name = translations_table.fetch(method, method.to_s.camelcase)\n # first we try the attributes:\n # return @xml.attributes[method_name].value if @xml.attributes.key?(method_name)\n\n\n # There is a ./References tag, but we want to short-circuit that one to\n # do custom processing.\n return references_list() if method == :references\n\n # then we try the children tags\n tag = xml.at_xpath(\"./#{method_name}\")\n if tag && !tag.text.blank?\n if tags_with_html_content.include?(method)\n return cleanup_html(tag.text)\n else\n return tag.text\n end\n else\n 'n/a'\n end\n\n return 'unimplemented' if method == :cve_list\n\n # nothing found\n return nil\n end", "def respond_to_missing?(method, include_private = false) #OK\n (method.to_s.start_with? \"find_by_\") || super\n end", "def method_missing(meth, *args, &block)\n @_resource.send(:method_missing, meth, *args, &block)\n end", "def get_available(*params); raise('Stub or mock required.') end", "def method_missing(method, *params)\n # if the method is one of known - just skip it ...\n return if [:comment, :attlistdecl, :notationdecl, :elementdecl, \n :entitydecl, :cdata, :xmldecl, :attlistdecl, :instruction, \n :doctype].include?(method)\n # ... else - call super to raise an exception\n super(method, params)\n end", "def method_missing( method, *args, &block )\n if method.to_s =~ /^setup_(.*)$/ && args.empty?\n add( $1.to_sym, caller.first, &block )\n else\n super\n end\n end", "def method_missing(sym, *args, &blk)\n # match: actor_entity | actor_id | actor\n match_data = sym.to_s.match(/(.+)_(entity|id)$/)\n entity_name = match_data ? match_data[1].to_sym : sym\n\n if Activr.registry.entities_names.include?(entity_name)\n # ok, don't worry...\n # define an instance method so that future calls on that method do not rely on method_missing\n self.instance_eval <<-RUBY\n def #{sym}(*args, &blk)\n nil\n end\n RUBY\n\n self.__send__(sym, *args, &blk)\n else\n # super Michel !\n super\n end\n end", "def methods\n super + property.keys.map { |v| [\"configure_#{v}\".to_sym, \"request_#{v}\".to_sym] }.flatten\n end", "def findAndDescribe(name)\n methods = MethodIndex.findMethods(name)\n \n if methods.size.zero?\n @op.error(\"Don't know anything about a method called `#{name}'.\")\n throw :exit, 4\n end\n \n if methods.size == 1\n methods[0] =~ /^(#{CN_PATTERN})(\\.|\\#|::)(.+)/\n describeMethod($1, $2, $3)\n else\n @op.putListOfMethodsMatchingName(name) do\n @op.putMethodList(methods)\n end\n end\n end", "def method_missing(method_sym, *arguments, &block)\n if self[\"#{method_sym.to_s}\"] != nil\n self[\"#{method_sym.to_s}\"]\n else\n super\n end\n end", "def provides_for(prefix)\n return [] unless @exposed\n @exposed.select do |meth|\n if instance_methods.include?(meth.to_s) or instance_methods.include?(meth.to_sym)\n true\n else\n RightLinkLog.warn(\"Exposing non-existing method #{meth} in actor #{name}\")\n false\n end\n end.map {|meth| \"/#{prefix}/#{meth}\".squeeze('/')}\n end", "def resolver; end", "def method_missing(meth_name, *args, &block)\n raise \"No method named: #{meth_name}\" unless recipe.respond_to? meth_name\n recipe.send(meth_name, *args, &block)\n end", "def method_missing(method, *args, &block) #:doc:\n super unless @wsdl.respond_to? method\n\n setup method, &block\n dispatch method\n end" ]
[ "0.60486746", "0.59565043", "0.59190047", "0.5854085", "0.58464044", "0.57831836", "0.57711804", "0.5768847", "0.5748913", "0.5738888", "0.57321435", "0.57310337", "0.57282126", "0.57282126", "0.5708268", "0.57005626", "0.5696965", "0.56742144", "0.5672293", "0.56656915", "0.56429493", "0.5642098", "0.5642098", "0.56361365", "0.56361365", "0.5632005", "0.56154203", "0.5610609", "0.55991465", "0.5598287", "0.55952126", "0.55952126", "0.55952126", "0.55952126", "0.55921704", "0.5579688", "0.5579688", "0.5579688", "0.5576334", "0.5572444", "0.55563164", "0.5534837", "0.5525644", "0.55226976", "0.5521619", "0.54863083", "0.5483152", "0.547649", "0.54676974", "0.5460514", "0.5455853", "0.5451049", "0.5443437", "0.54433495", "0.54338217", "0.5430019", "0.5429106", "0.54242057", "0.54235554", "0.5417267", "0.5416386", "0.5411241", "0.54100573", "0.5409257", "0.54071116", "0.53921354", "0.53877926", "0.53877926", "0.53877926", "0.53877926", "0.5386129", "0.53817147", "0.53817147", "0.5378815", "0.5375467", "0.53707373", "0.53707373", "0.53700036", "0.53638315", "0.53537965", "0.53509945", "0.53496796", "0.5349548", "0.5349023", "0.5347538", "0.533985", "0.533014", "0.53245944", "0.53125423", "0.5307559", "0.52933174", "0.52893656", "0.5286507", "0.52840877", "0.5283376", "0.52766985", "0.52713037", "0.5269798", "0.5268108" ]
0.54340214
55
Return gem corresponding to spec name/version
def upstream_gem @gem ||= Polisher::Gem.from_rubygems gem_name, version end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_gem(name, version)\n spec = source_index.find_name(name, version).last\n unless spec and (spec.installation_path rescue nil)\n alert_error \"Could not find gem #{name} (#{version})\"\n raise Gem::GemNotFoundException, \"Could not find gem #{name}, (#{version})\"\n end\n\n return spec\n end", "def spec(name)\n specs = if Gem::Specification.respond_to?(:each)\n Gem::Specification.find_all_by_name(name)\n else\n Gem.source_index.find_name(name)\n end\n\n spec = specs.sort_by{ |spec| Gem::Version.new(spec.version) }.first\n\n spec or raise CommandError, \"Gem `#{name}` not found\"\n end", "def gem_spec(name, version)\n if spec = spec(name, version)\n BareSpecification.new(self, name, spec[1]).gem_spec\n end\n end", "def spec(name, version)\n specs.select { |spec| spec[0] == name && (version.any? || spec[1] == version) }.last\n end", "def gem_name\n @specification.name\n end", "def get_version(gem)\n lockfile_specs.find { |s| s.name == gem }&.version\n end", "def gem_spec\n if @gem_spec.nil?\n unless @gem_spec = Micro::Source.gem_spec(@name, @version_requirements.version)\n raise Micro::GemSpecMissingError, \"Unable to locate Gem::Specification for Gem::Dependency `#{self}'\"\n end\n end\n \n @gem_spec\n end", "def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end", "def spec name, version, &block\n Gem::Specification.new name, v(version), &block\n end", "def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end", "def spec\n @spec ||= Gem::Specification.find do |spec|\n spec.name == @name and spec.version == @version\n end\n\n @spec ||= Gem::Specification.new do |s|\n s.name = @name\n s.version = @version\n s.platform = @platform\n\n s.dependencies.concat @dependencies\n end\n end", "def version\n @gemspec.version || @version_helper.to_s\n end", "def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end", "def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end", "def specification\n Gem::Specification.find_by_name(name, requirement)\n rescue Gem::LoadError\n nil\n end", "def gem(name, version)\n version = version.to_s\n\n begin\n json = open(\"https://rubygems.org/api/v1/versions/#{name}.json\") {|f| f.read}\n gems = JSON.parse(json)\n\n gem = gems.detect do |g|\n g[\"number\"] == version && g[\"platform\"] == \"ruby\"\n end\n\n if gem && gem[\"sha\"]\n # Rubygems.org was _supposed_ to provide base64 encoded SHA-256 hashes,\n # but as of now the hashes are base16 encoded...\n base16 = gem[\"sha\"]\n base32 = exec(\"nix-hash --type sha256 --to-base32 #{base16.shellescape}\")\n assert_length!(base32, 52)\n assert_format!(base32, /^[a-z0-9]+$/)\n\n base32\n end\n rescue Exception => ex\n #puts ex.message\n #puts ex.backtrace\n nil\n end\n end", "def gem(name, version = Gem::Requirement.default)\n @gems ||= {}\n @gems[name] = version\n end", "def version(gem)\n Dir.chdir(@path)\n lockfile = Bundler::LockfileParser.new(\n Bundler.read_file('Gemfile.lock')\n )\n\n lockfile.specs.each do |s|\n if s.name == gem\n return s.version\n end\n end\n raise \"Gem #{gem} not found in #{@path}\"\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n\n @source.fetch_spec tuple\n end\n end", "def gem(name, main_module)\n _, spec = Gem.loaded_specs.find { |spec_pair| spec_pair[0] == name }\n gems << spec\n modules << main_module\n spec.full_gem_path\n end", "def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end", "def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end", "def load_spec(name, version, platform, source) # :nodoc:\n dep = Gem::Dependency.new name, version\n\n found = @specs.find do |spec|\n dep.matches_spec? spec and spec.platform == platform\n end\n\n tuple = Gem::NameTuple.new found.name, found.version, found.platform\n\n found.source.fetch_spec tuple\n end", "def spec_name\n \"#{full_name}.gemspec\"\n end", "def find_gem_name(base)\n spec = Dir[File.join(base, '*.gemspec')].first\n File.basename(spec, '.gemspec') if spec\n end", "def full_spec\n Gem::Specification === @spec ? @spec : @spec.spec\n end", "def gem_name\n @gem_name ||= @source_path.sub_ext(\"\").basename.to_s\n end", "def fetch_specification(name, version)\n url = host + \"/quick/#{Configuration.marshal_identifier}\" \\\n \"/#{name}-#{version}.gemspec.rz\"\n\n http_get(url).body\n end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end", "def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end", "def gemspec\n @gemspec ||= begin\n raise Error.new(\"Unable to automatically determine gem name from specs in #{base}. Please set the gem name via #{self.class.name}.install_tasks(gem_name: 'name')\") unless gem_name\n g = Bundler.load_gemspec(File.join(base, gem_name+'.gemspec'))\n # This is returning the path it would be in if installed normally,\n # override so we get the local path. Also for reasons that are entirely\n # beyond me, #tap makes Gem::Specification flip out so do it old-school.\n g.full_gem_path = base\n g\n end\n end", "def full_name\n \"#{spec.name}-#{spec.version}\"\n end", "def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end", "def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end", "def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\n end", "def gem_spec\n require 'rubygems/specification'\n spec_fields = %w(\n name author email has_rdoc rubyforge_project summary\n version description required_ruby_version homepage\n )\n Gem::Specification.new do | spec |\n for field in spec_fields\n value = self.send( field )\n spec.send( \"#{field}=\", value )\n end\n \n spec.files = package.files.to_a + %w( Rakefile Manifest.txt )\n spec.test_files = unit_tests.to_a + functional_tests.to_a\n \n spec.executables.push( *executables )\n spec.requirements.push( *requirements )\n end\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n source.fetch_spec tuple\n rescue Gem::RemoteFetcher::FetchError\n raise if @original_platform == @platform\n\n tuple = Gem::NameTuple.new @name, @version, @original_platform\n source.fetch_spec tuple\n end\n end", "def required_rubygems_version\n spec.required_rubygems_version\n end", "def gem_version gem\n gem.gsub(/[^ ]* \\(([0-9.]*),?.*\\)/, \"\\\\1\")\n end", "def plugin_gem(name, options = {})\n lib, version = options.values_at(:lib, :version)\n begin\n Kernel.send :gem, name, version\n rescue Gem::LoadError\n dir = File.dirname(caller.first.split(':').first)\n $: << File.expand_path(\"#{dir}/../vendor/gems/#{name}-#{version.gsub(/[^\\d\\.]*/, '')}/lib\")\n end\n require(lib || name)\n end", "def platform_gemspec\n gemspecs.fetch(platform) { This.ruby_gemspec }\n end", "def get_gem gem_instance_id\n check_validity\n response = api_get gem_instance_id\n if response != nil and response.key?\"gem\"\n return gem_to_note response[\"gem\"]\n else\n return nil\n end\n end", "def required_rubygems_version\n spec.required_rubygems_version || Gem::Requirement.default\n end", "def find_name(gem_name, requirement = T.unsafe(nil)); end", "def load_spec(name, version, platform, source) # :nodoc:\n @specs.fetch name\n end", "def specification(full_name)\n @gems[full_name]\n end", "def gem_version\n Gem::Version.new VERSION\n end", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def version\n [ \"lib/#{ name }.rb\", \"lib/#{ name }/version.rb\" ].each do |v|\n path = project_path( v )\n line = path.read[/^\\s*VERSION\\s*=\\s*.*/]\n if line then\n return line.match(/.*VERSION\\s*=\\s*['\"](.*)['\"]/)[1]\n end\n end\n end", "def gem_spec\n Gem::Specification.new do |s|\n s.name = package_name\n s.version = version\n s.platform = Gem::Platform::RUBY\n s.summary = summary\n s.description = description || summary\n s.author = author_name\n s.email = author_email\n s.homepage = project_url\n s.require_path = lib_dir\n s.files = package_files\n s.test_files = tests\n s.bindir = bin_dir\n s.executables = programs.map{|p| File.basename(p)}\n s.extensions = FileList['ext/**/extconf.rb']\n s.has_rdoc = true\n s.extra_rdoc_files = rdoc_files\n s.rdoc_options.concat(rdoc_options)\n s.test_files = tests\n s.rubyforge_project = rubyforge_project\n dependencies.each { |args| s.add_dependency(*args) }\n @package_configurator.call(s) if @package_configurator\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 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 gemspec(platform = 'ruby')\n Gem::Specification.load(File.expand_path('../../redcloth.gemspec', __FILE__))\nend", "def to_spec\n @spec ||= if @data\n loaded = Gem.loaded_specs[name]\n loaded if loaded && loaded.version == version\n end\n\n @spec ||= Gem::Specification.load(loaded_from)\n end", "def version\n spec.version\n end", "def get_path(gemname, version_req)\n return gemname if gemname =~ /\\.gem$/i\n specs = SourceIndex.from_installed_gems.search(gemname, version_req)\n selected = specs.sort_by { |s| s.version }.last\n return nil if selected.nil?\n # We expect to find (basename).gem in the 'cache' directory.\n # Furthermore, the name match must be exact (ignoring case).\n if gemname =~ /^#{selected.name}$/i\n filename = selected.full_name + '.gem'\n return File.join(Gem.dir, 'cache', filename)\n else\n return nil\n end\n end", "def gem_name\n @gem_name ||= \"sprout-#{clean_name}-library\"\n end", "def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end", "def gem?\n #return true if Dir[File.join(location, '*.gemspec')].first\n pkgname = File.basename(location)\n gemsdir = File.dirname(location)\n specdir = File.join(File.dirname(gemsdir), 'specifications')\n Dir[File.join(specdir, \"#{pkgname}.gemspec\")].first\n end", "def arch_spec_path\n File.join(RAILS_ROOT, 'vendor/gems', canonical_arch, 'specifications')\n end", "def gem_name\n \"haversine_distance_c-#{version}.gem\"\n end", "def component_version(cmp)\n component_cmake_vars(cmp)['PACKAGE_VERSION']\nend", "def gemspec(path)\n installed_gemspec(path) || local_gemspec(path)\n end", "def gem_name\n \"#{@account}-#{@name}\"\n end", "def bower_resolve(modspec)\n mod, verspec = if modspec.kind_of?(Array)\n modspec\n else\n [modspec, '>=0.0.0']\n end\n raise DashboardException.new(\"Missing Asset Module #{mod} version #{verspec}\") if bower_packages[mod].nil?\n bower_packages[mod] # FIXME: must check for version match too!!!\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def gemspec_path\n Pathname.glob('*.gemspec').first\n end", "def gem_installed?(gem)\n begin\n old_stderr, $stderr = $stderr, StringIO.new\n if defined?(::Gem::Specification) && ::Gem::Specification.respond_to?(:find_by_name)\n gem_spec = ::Gem::Specification.find_by_name(gem)\n else\n gem_spec = ::Gem::GemPathSearcher.new.find(gem)\n end\n gem_spec.nil? ? nil : gem_spec.version.to_s\n rescue LoadError\n nil\n ensure\n $stderr = old_stderr\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 getGemSpec(iGemFileName)\n rGemSpec = nil\n\n change_dir(File.dirname(iGemFileName)) do\n require 'rubygems'\n # TODO: Bug (Ruby): Remove this test when Ruby will be able to deal .bat files correctly.\n require 'rUtilAnts/Platform'\n RUtilAnts::Platform::install_platform_on_object\n if (os == RUtilAnts::Platform::OS_WINDOWS)\n rGemSpec = eval(backquote_RBTest(\"gem.bat specification #{File.basename(iGemFileName)} --ruby\").gsub(/Gem::/,'::Gem::'))\n else\n rGemSpec = eval(backquote_RBTest(\"gem specification #{File.basename(iGemFileName)} --ruby\").gsub(/Gem::/,'::Gem::'))\n end\n end\n\n return rGemSpec\n end", "def pkg_path\n \"pkg/#{spec.full_name}\"\n end", "def required_ruby_version\n spec.required_ruby_version || Gem::Requirement.default\n end", "def local_or_remote_gem(name, options = Hash.new)\n local_path = File.expand_path(\"../vendor/#{name}\", __FILE__)\n if File.exist?(local_path)\n gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }\n else\n gem name, options\n end\nend", "def earliest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.min\n version.nil? ? nil : version.to_s\n end", "def gemfile_requirement(name)\n @original_gemfile ||= IO.read('Gemfile')\n req = @original_gemfile[/gem\\s+['\"]#{name}['\"]\\s*(,[><~= \\t\\d\\.\\w'\"]*)?.*$/, 1]\n req && req.tr(\"'\", %(\")).strip.sub(/^,\\s*\"/, ', \"')\nend", "def latest_version(module_name)\n versions(module_name).last\n end", "def gem(*args)\n options = args.extract_options!\n name, version = args\n\n # Set the message to be shown in logs. Uses the git repo if one is given,\n # otherwise use name (version).\n parts, message = [ name.inspect ], name\n if version ||= options.delete(:version)\n parts << version.inspect\n message << \" (#{version})\"\n end\n message = options[:git] if options[:git]\n\n log :gemfile, message\n\n parts_without_group = parts.clone\n options.each do |option, value|\n str = \"#{option}: #{value.inspect}\"\n parts << str\n parts_without_group << str unless option == :group\n end\n\n in_root do\n if options.key?(:group)\n # remove brackets if any and prepend colon if missing\n group = options[:group].inspect.scan(/[[^\\[\\]]]/).join.to_sym\n\n group_definition = \"group #{group} do\"\n str = \"gem #{parts_without_group.join(\", \")}\"\n return if append_to_gem_group(group_definition, str.gsub(/\\\"/, '\\''))\n end\n\n str = \"gem #{parts.join(\", \")}\"\n str = \" \" + str if @in_group\n str = \"\\n\" + str\n append_file \"Gemfile\", str.gsub(/\\\"/, '\\'')\n end\nend", "def puppet_gem_version\n Gem::Version.create(puppet_version.split(' ').first.strip.gsub('-', '.'))\n end", "def find_latest_gem(gem_name)\n the_gem = Dir.glob(\"#{Gem.dir}/gems/#{gem_name}-*\")\n\n the_gem.empty? ? nil : the_gem.sort.last\n end", "def version(engine)\n spec = bundler_specs_by_path[engine.root.realpath.to_s]\n\n case spec&.source\n when Bundler::Source::Git\n [\n spec.source.branch || spec.source.options[\"tag\"],\n spec.source.revision.presence[0, 8]\n ].compact.join(\"@\").presence\n when Bundler::Source::Path\n if engine.root.join(\".git\").exist?\n branch = sha = nil\n Dir.chdir(engine.root) do\n branch = `git rev-parse --abbrev-ref HEAD 2>/dev/null`.strip.presence\n branch = nil if branch == \"HEAD\"\n branch ||= `git describe --tags --exact-match HEAD 2>/dev/null`.strip.presence\n\n sha = `git rev-parse HEAD 2>/dev/null`.strip[0, 8].presence\n end\n\n [branch, sha].compact.join(\"@\").presence\n end\n when Bundler::Source::Rubygems\n spec.version\n end\n end", "def get_runtime(path = '.')\n File.open(path + \"/runtime/src/lib.rs\") do |f|\n f.find { |l| l =~ /spec_version:/ }.match(/[0-9]+/)[0]\n end\nend", "def gemspec?; end", "def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end", "def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end", "def version\n @spec.version\n end", "def custom_gem(name, options = Hash.new)\n local_path = File.expand_path \"../vendor/#{name}\", __FILE__\n\n if File.exist? local_path\n options = options.merge :path => local_path\n options.delete_if do |key, _|\n [:github, :branch].include? key\n end\n end\n\n gem name, options\nend", "def gemfile_requirement(name)\n @original_gemfile ||= IO.read('Gemfile')\n req = @original_gemfile[/gem\\s+['\"]#{name}['\"]\\s*(,[><~= \\t\\d\\.\\w'\"]*)?.*$/, 1]\n req && req.gsub(\"'\", %(\")).strip.sub(/^,\\s*\"/, ', \"')\nend", "def describe gem, source = { rubygems: true }\n if source[:rubygems]\n Gems.info(gem).fetch \"info\"\n else\n info = GemspecInfo.new gem, source\n info.summary\n end\n end", "def version\n @version ||= if token.nil? || Array(packages).empty?\n '0.1.0'\n else\n packages.map do |p|\n Gem::Version.new(p['version'])\n end.sort.last.bump.to_s << '.0'\n end\n end", "def gemspec\n @gemspec ||= (\n require 'rubygems'\n ::Gem::Specification.load(gemspec_file)\n )\n end", "def parse_gem_version(gem_version)\n return if gem_version.blank? || gem_version == 'stable'\n Versionomy.parse(gem_version)\nrescue Versionomy::Errors::ParseError\n return nil\nend", "def get_gem_name_from_gem_yardoc_file(gem_yardoc_file)\n if gem_yardoc_file == nil or gem_yardoc_file == \"\"\n return nil\n end\n if gem_yardoc_file == RUBY_STDLIB_YARDOC_DIR\n # TODO(sqs): now that we don't run YARD on the stdlib for each gem,\n # how do we determine when a ref points to the stdlib?\n return STDLIB_GEM_NAME_SENTINEL\n end\n\n name_ver = if gem_yardoc_file.end_with?(\"/.yardoc\")\n # handle paths of the form\n # \"/tmp/grapher-output-test308543943/github.com-ruth-my_ruby_gem/ruby/gems-./ruby/2.0.0/gems/sample_ruby_gem-0.0.1/.yardoc\"\n File.basename(File.dirname(gem_yardoc_file))\n elsif gem_yardoc_file.end_with?(\".yardoc\")\n File.basename(gem_yardoc_file.sub(/\\.yardoc$/, ''))\n else\n raise \"Unrecognized gem yardoc file #{gem_yardoc_file.inspect}\"\n end\n\n i = name_ver.rindex('-')\n if i == nil\n name_ver\n else\n name_ver[0..i-1]\n end\n end" ]
[ "0.76734984", "0.7653313", "0.7438747", "0.7420011", "0.7316799", "0.72767353", "0.721771", "0.7059389", "0.69686896", "0.695689", "0.6954675", "0.6928784", "0.6902401", "0.68513376", "0.682668", "0.6819575", "0.67788416", "0.6767745", "0.67621356", "0.67400044", "0.6722517", "0.6722517", "0.6707133", "0.6697373", "0.66583097", "0.66566765", "0.6654595", "0.6637734", "0.6628648", "0.6628648", "0.6628648", "0.6628648", "0.6628648", "0.6628648", "0.662863", "0.66190946", "0.6614028", "0.6572076", "0.6564671", "0.65633476", "0.6549485", "0.6544552", "0.64956987", "0.6480478", "0.6476798", "0.64727217", "0.6470892", "0.6435724", "0.64352417", "0.6417624", "0.6403131", "0.6383652", "0.6360284", "0.6330839", "0.6330839", "0.6330839", "0.6330839", "0.63231623", "0.6322089", "0.6310608", "0.6310608", "0.63076156", "0.63059837", "0.628374", "0.6277537", "0.6268761", "0.62655115", "0.6261122", "0.626008", "0.6248868", "0.6241111", "0.62259495", "0.6212728", "0.6212383", "0.61935616", "0.6193334", "0.6193131", "0.618554", "0.618504", "0.6177384", "0.61724865", "0.6160827", "0.6145407", "0.6139309", "0.61366445", "0.6135213", "0.6126089", "0.61224043", "0.6116142", "0.61147034", "0.6113147", "0.6112367", "0.6100224", "0.60998356", "0.6098977", "0.6097395", "0.609403", "0.6079867", "0.607256", "0.60721856", "0.6064983" ]
0.0
-1
Return boolean indicating if spec has a %check section
def has_check? @metadata.has_key?(:has_check) && @metadata[:has_check] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_specs?\n FileList[spec_pattern].any?\n end", "def ok?\n @specs.all? { |spec|\n\tspec.dependencies.all? { |dep|\n\t @specs.find { |s| s.satisfies_requirement?(dep) }\n\t}\n }\n end", "def section_classes_all_there?\n section_classes_to_check.all?(&:all_there?)\n end", "def require_check?\n\t\t[\"cheque\"].include?(tag_name.downcase)\n\tend", "def ok?\n @specs.all? do |spec|\n spec.runtime_dependencies.all? do |dep|\n @specs.find { |s| s.satisfies_requirement? dep }\n end\n end\n end", "def section?\n type == \"Section\"\n end", "def has_feedback?\n\t\treturn false if not self.check_results\n\t\tcheck_results = JSON(self.check_results)\n\t\t(check_results.keys & [\"check50v2\", \"check50\", \"checkpy\", \"check50v3\"]).any?\n\tend", "def complete?\n specs.find {|s| !s.complete?} ? false : true\n end", "def valid?\n return false if !raw.include?('Returns')\n return false if sections.size < 2\n true\n end", "def has_section?( section )\n @ini.has_key? section.to_s\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def has_section?(name)\n sections.has_key?(name)\n end", "def has_section?(name)\n sections.has_key?(name)\n end", "def sections_classes_all_there?\n sections_classes_to_check.flatten.all?(&:all_there?)\n end", "def spec_included?(spec)\n filter_is_matched? options[:filter_specs], spec\n end", "def is_it_for_sure?\n @comments.any? do |comment|\n comment['version'] == @spec.version and comment['works_for_me']\n end\n end", "def section?(section)\n @ini.key? section.to_s\n end", "def section?\n !@section.nil?\n end", "def matches_spec? spec\n name == spec.name and requirement.satisfied_by? spec.version\n end", "def gemspec?\n !gemspecs.empty?\n end", "def focused_spec_exists?\n `grep -r 'focus: true' spec/`.length > 1\nend", "def has_tests?\n FileList[test_pattern].any?\n end", "def dry_validation?\n @dry_validation ||= @gems.include?(:dry_validation)\n end", "def valid?\n\t return ( major.text.include?('Success') and minor.text.include?('OnAllDocuments') )\n\tend", "def matches_spec?(spec)\n return false unless name === spec.name\n return true if requirement.none?\n\n requirement.satisfied_by?(spec.version)\n end", "def sections?\n false\n end", "def gem_should_be_checked?(gem_name)\n gem_name.index('barkest_') == 0\n end", "def requirements_met?\n preconditions.all? &:met?\n end", "def suitable?\n @confines.all?(&:true?)\n end", "def required?\n spec['Required']\n end", "def current_spec_is?(spec)\n return false unless file_name_spec_set?\n spec = [spec] unless spec.is_a? Array\n spec = spec.flatten\n spec = spec.map do |spec|\n Noop::Utils.convert_to_spec spec\n end\n spec.any? do |spec|\n file_name_spec == spec\n end\n end", "def success?\n checks.all?(&:success?)\n end", "def has_specs?(options = {})\n _specs\n options = {\n type: nil,\n sub_type: nil,\n mode: current_mode.nil? ? nil : current_mode.name,\n spec: nil,\n symbol: false,\n creating_spec: false\n }.update(options)\n if @_specs.nil? || @_specs == {}\n false\n else\n !!show_specs(options)\n end\n end", "def has_section?( section_name )\n\n KeyError.not_new( section_name, self )\n\n raise ArgumentError.new \"No file found at [ #{@file_path} ]\" unless File.exists? @file_path\n the_text = File.read @file_path\n raise ArgumentError.new \"This file is empty => [ #{@file_path} ]\" if the_text.empty?\n\n the_data = IniFile.load @file_path\n return the_data.has_section?( section_name )\n\n end", "def requirement_satisfied?(time_blocks, course)\n lecture_satisfied = false\n lab_satisfied = !course.lab_required # if lab isn't required, it's satisfied immediately\n tutorial_satisfied = !course.tutorial_required\n time_blocks.each do |tb|\n if (tb.section.course == course)\n if (tb.section_type == 'LectureSection')\n lecture_satisfied = true\n elsif (tb.section_type == 'LabSection')\n lab_satisfied = true\n elsif (tb.section_type == 'TutorialSection')\n tutorial_satisfied = true\n end\n end\n end\n return lecture_satisfied && lab_satisfied && tutorial_satisfied\n end", "def cfgExists?\n\t\treturn true if File.exists?(@CfgSpec)\n\t\treturn false\n\tend", "def check_install?\n @default_options[ :check_install ]\n end", "def matches_spec?(spec)\n @dependency.matches_spec? spec\n end", "def contents_detected?\n true if find_first_match(:matching => /Gitlab/, :in_file => \"Rakefile\")\n end", "def has_correct_options?\n options.corrects.any?\n end", "def exists?\n @property_hash and [:running, :pending].include?(@property_hash[:ensure])\n end", "def isValid?\n \"[\" + checkSum + \"]\" == @checkSumProvided\n end", "def changed_to_manual_check?\n @participant_eligibility.manual_check_status? && ((@previous_status != \"manual_check\") || @new_eligibility_record)\n end", "def options_valid?\n loaded_config? &&\n output_base_valid? &&\n have_sample_ids? &&\n sample_ids_in_config?\nend", "def complete_property_checkups?\n nil\n end", "def looks_valid?\n # The application name is present\n tiddlywiki_title == 'TiddlyWiki' &&\n # Has one or other store divs but not both\n (store.present? ^ encrypted_store.present?) &&\n # We're able to extract a tiddlywiki version\n tiddlywiki_version.present?\n end", "def suitable?(short = true)\n return(short ? confine_collection.valid? : confine_collection.summary)\n end", "def configured_feature_requires_component?(component)\n list_configured_features_from_component(component).length > 0\n end", "def check ; true ; end", "def sections_exist?\n @top_level.items.present?\n end", "def check!\n true\n end", "def is_known?\n describe ? true : false\n end", "def valid?\n if Gem.loaded_specs.has_key?(\"json-schema\")\n return validation_errors.empty?\n else\n return true\n end\n end", "def has_file_satisfied_by?(spec_file)\n file_paths.any? { |gem_file| RPM::Spec.file_satisfies?(spec_file, gem_file) }\n end", "def satisfied_by?(spec)\n return false unless requirement\n spec = ArtifactNamespace.to_hash(spec)\n hash = to_spec_hash\n hash.delete(:version)\n version = spec.delete(:version)\n hash == spec && requirement.satisfied_by?(version)\n end", "def fully_documented?\n @fully_documented\n end", "def check(refreshing = false)\n self.class.checks.each do |check|\n next if refreshing and check == :refreshonly\n if @parameters.include?(check)\n val = @parameters[check].value\n val = [val] unless val.is_a? Array\n val.each do |value|\n return false unless @parameters[check].check(value)\n end\n end\n end\n\n true\n end", "def fixity_check?\n event_type == FIXITY_CHECK\n end", "def has_file_satisfied_by?(spec_file)\n file_paths.any? { |gem_file| RPM::Spec.file_satisfies?(spec_file, gem_file) }\n end", "def determinate_with?(new_spec)\n if !new_spec.complete? && new_spec.glob?\n specs.reverse.each do |spec|\n return true if spec.complete?\n return false if spec.glob?\n end\n end\n true\n end", "def check\n check!\n rescue MissingScannerError, ScannerOperationError\n false\n end", "def valid?\n gemfile? && gemfile_lock? && gem?(\"thin\") &&\n gem?(\"rake\") && config_ru?\n end", "def supports_check_constraints?\n false\n end", "def check\n prefix = File.basename(@file)\n if File.exist?(@file)\n @message = \"#{prefix} : Expected file exists\"\n true\n else\n @message = \"#{prefix} : Expected file not found.\"\n false\n end\n end", "def has_patches?\n !@patches.empty?\n end", "def one_nine?\n @comments.any? do |comment|\n comment['version'] == @spec.version and comment['works_for_me']\n end\n end", "def has_defects?\n defects = []\n self.car.parts.each do |part|\n if (part.defect == true)\n defects.push(part.part_type.name)\n end\n end\n defects.empty? ? false : defects \n end", "def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend", "def canary?\n @got.respond_to?('__stack_chk_fail') || @symbols.respond_to?('__stack_chk_fail')\n end", "def config_parsed?\r\n config_parsed\r\n end", "def looks_valid?\n check!(false).empty?\n end", "def specification_identified?\n self.specification_attached? || !self.document_link.blank?\n end", "def passed?\n config.threshold.nil? ||\n (config.threshold_must_match && percent == config.threshold) ||\n percent >= config.threshold\n end", "def error_check?\n !@error_rules.empty?\n end", "def mandatory_supporting_evidence?\n claim.documents.any? || claim.evidence_checklist_ids.any?\n end", "def student_team_requirements_met?\n # checks if the student has a team\n return false if @student.team.nil?\n # checks that the student's team has a topic\n return false if @student.team.topic.nil?\n\n # checks that the student has selected some topics\n @student.assignment.topics?\n end", "def has?(essential)\n essentials.keys.include?(essential.to_sym)\n end", "def has_validations?\n !contents.detect(&:has_validations?).blank?\n end", "def check?(fields)\n @check.call(fields)\n end", "def specification_attached?\n self.eco_documents.detect { |d| d.specification? } != nil\n end", "def has_checkbox_summary_array?\n ccf = checkbox_choice_fields\n ccf && ccf.length > 1\n end", "def check?\n raise NotImplementedError\n end", "def pdf_ver_ok?(file)\n reader = PDF::Reader.new(file)\n (reader.page(1).raw_content.lines.count != 1) ? true : false\n end", "def valid?\n ensure_file_open!\n\n ['Makefile', 'submission/', 'tests/'].all? { |entry| @file.find_entry(entry).present? }\n end", "def rspec?\n @rspec ||= @gems.include?(:rspec)\n end", "def specified?(name)\n !!@__specified__[name]\n end", "def gem_listed?(gem)\n lockfile_specs.map(&:name).include? gem\n end", "def conficts_when_loaded_with?(list_of_specs) # :nodoc:\n result = list_of_specs.any? do |spec|\n spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }\n end\n result\n end", "def has_yaml_props?\n file? && data[0][0..2] == \"---\"\n end", "def has_spec_tests?(cookbook_path)\n File.directory?(File.join(cookbook_path, 'spec'))\n end", "def check\n tagged_response(\"CHECK\")\n end", "def valid?(check)\n validate_check_result(check)\n true\n rescue Invalid\n false\n end", "def check?\n @last_time < @check_time - 100\n end", "def spec_stubs?\n @config.files.copy.any? { |f, _| f.start_with?(STUBS_FOLDER) } \\\n || @config.files.compile.any? { |f, _| f.start_with?(STUBS_FOLDER) }\n end", "def in_check?\n f = @kings[@mx]\n 8.times do |i|\n t = SQ120[SQ64[f] + STEPS[KNIGHT][i]]\n return true if @pieces[t] == KNIGHT && t != NULL && @colors[t] == @mn\n s = STEPS[KING][i]\n t = SQ120[SQ64[f] + s]\n t = SQ120[SQ64[t] + s] while (t != NULL && @colors[t] == EMPTY)\n next if t == NULL || @colors[t] != @mn\n case @pieces[t]\n when QUEEN then return true\n when BISHOP then return true if i < 4\n when ROOK then return true if i > 3\n when PAWN then return true if (s - UP[@mn]).abs == 1\n when KING then return true if SQ120[SQ64[f] + s] == t\n end\n end\n false\n end", "def installed?\n case @spec\n when Gem::Resolver::VendorSpecification then\n true\n else\n this_spec = full_spec\n\n Gem::Specification.any? do |s|\n s == this_spec\n end\n end\n end", "def for_spec?(spec)\n @dependency.name == spec.name\n end" ]
[ "0.61356276", "0.60764885", "0.60271496", "0.6018409", "0.6007447", "0.59538865", "0.5920807", "0.59132826", "0.59010524", "0.58751607", "0.5865623", "0.5865623", "0.5865623", "0.5855523", "0.5855523", "0.58552295", "0.5845337", "0.5809722", "0.5753064", "0.57481515", "0.56944925", "0.5687152", "0.5675559", "0.5665044", "0.56493187", "0.55739295", "0.5573702", "0.5570195", "0.5538301", "0.55136955", "0.5512934", "0.5510656", "0.5508057", "0.5497678", "0.54972434", "0.5484078", "0.54629225", "0.5459907", "0.5457568", "0.5420358", "0.54188603", "0.5409697", "0.53946173", "0.53510535", "0.53371584", "0.5319842", "0.5317335", "0.5304449", "0.52998084", "0.5292867", "0.52897495", "0.52853644", "0.5276824", "0.52736914", "0.5267061", "0.52651703", "0.5256578", "0.52536416", "0.5245362", "0.5244364", "0.52437675", "0.5239836", "0.5237877", "0.5235612", "0.52277774", "0.5224827", "0.52102256", "0.5207225", "0.5202888", "0.52004904", "0.51968396", "0.51965016", "0.51905346", "0.51864403", "0.518479", "0.5184537", "0.5180855", "0.51771224", "0.51752627", "0.5171299", "0.5170075", "0.5169213", "0.5166336", "0.5164807", "0.51465255", "0.5146384", "0.5145926", "0.514411", "0.5142623", "0.5136892", "0.51351357", "0.51339954", "0.51305246", "0.51156753", "0.51133406", "0.5112539", "0.5111386", "0.5106924", "0.5105793" ]
0.7375026
1
Return all the Requires for the specified gem
def requirements_for_gem(gem_name) @metadata[:requires].nil? ? [] : @metadata[:requires].select { |r| r.gem_name == gem_name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def requires\n require_items.collect(&:package)\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def all_requires\n []\n end", "def all_requires\n []\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def gem_requires(name, options) # :nodoc:\n if options.include? :require\n if requires = options.delete(:require)\n @requires[name].concat Array requires\n end\n else\n @requires[name] << name\n end\n raise ArgumentError, \"Unhandled gem options #{options.inspect}\" unless options.empty?\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def requires\n []\n end", "def require_gems; end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def requires\n self.class::Requirements[@version] || self.class::Requirements[:all] || {}\n end", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def requires(database)\n fail \"Extension #{name} not (yet) installed\" unless installed?(database)\n\n stmt = if version\n <<-SQL\n SELECT unnest(requires) as name FROM\n ( SELECT requires FROM pg_available_extension_versions where name='#{name}' AND version ='#{version}') t\n SQL\n else\n <<-SQL\n SELECT unnest(requires) as name FROM\n (SELECT requires FROM\n pg_available_extensions a\n JOIN pg_available_extension_versions v ON v.name = a.name AND a.default_version = v.version\n WHERE v.name = '#{name}')t\n SQL\n end\n\n result = database.execute(stmt).to_a\n\n requires = result.map{|r| r['name']}\n end", "def has_all_requirements_for?(gem_dep)\n reqs = self.requirements_for_gem gem_dep.name\n # create a spec requirement dependency for each expanded subrequirement,\n # verify we can find a match for that\n gem_dep.requirement.to_s.split(',').all? { |greq|\n Gem2Rpm::Helpers.expand_requirement([greq.split]).all? { |ereq|\n tereq = Requirement.new :name => \"#{requirement_prefix}(#{gem_dep.name})\",\n :condition => ereq.first,\n :version => ereq.last.to_s\n reqs.any? { |req| req.matches?(tereq)}\n }\n }\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def r(*gems)\n gems.map {|g| require g.to_s}\nend", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def gem_requirements_from_array(what, array)\n array.map do |dep|\n Gem::Dependency.new(what, *dep)\n end\n end", "def packages_from_require(rpmdep)\n refresh\n @rpmdb.whatprovides(rpmdep)\n end", "def collect_requires src\n src.scan(/^[\\t ]*require[ \\t]*['\"](.*?)['\"]/).collect { |x| x[0] }\n end", "def required(gem_name, gem_install_name = nil)\n Required::required gem_name, gem_install_name\nend", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def find_issues_by_gem(string = \"\")\n issues = []\n @security_checks.each do |check|\n if check.kind == Dawn::KnowledgeBase::DEPENDENCY_CHECK or check.kind == Dawn::KnowledgeBase::UNSAFE_DEPENDENCY_CHECK\n debug_me \"applying check #{check.name}\"\n name = string.split(':')[0]\n version = string.split(':')[1]\n check.please_ignore_dep_version = true if version.nil?\n check.dependencies = [{:name=>name, :version=>version}]\n issues << check if check.vuln?\n end\n end\n debug_me \"#{issues}\"\n return issues\n end", "def get_all_requires(code = @code)\n if code.is_a?(Array) then\n requires = (code.select { |sub| is_require?(sub) }).map! do |sub|\n get_require(sub)\n end\n code.each do |sub|\n requires += get_all_requires(sub)\n end\n return requires\n else\n return []\n end\n end", "def all_modules_in_gem_named(gem)\n self.all_modules.select { |mod| mod.belongs_to?(gem) }\n end", "def gems\n @gems ||=\n Bundler.load.current_dependencies.map do |dependency|\n GemsBond::Gem.new(dependency)\n end\n end", "def requirements\n unless @reqs\n @reqs = []\n @reqs << Requirement.new(:feature, {:feature => self['feature']}, plugin) if self['feature']\n end\n @reqs\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end", "def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end", "def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end", "def dependencies(gemfile)\n dependencies = { }\n\n File.open(gemfile) do |f|\n f.each do |line|\n if (line.match(/\\Agem\\s+['\"]bundler['\"]\\s*,\\s*['\"]([^'\"]+)['\"]/))\n dependencies[:bundler] = $1\n elsif (line.match(/\\A\\#\\s*rubygems\\s+(\\S+)/))\n dependencies[:rubygems] = $1\n end\n end\n end\n\n dependencies\nend", "def all_classes_and_modules_in_gem_named(gem)\n self.all_classes_and_modules.select { |klassmod| klassmod.belongs_to?(gem) }\n end", "def requires\n @require_ids.collect { |idx| BRequire.store[idx] }\n end", "def expand_requires(requires, builder)\n requires.map { |i| builder.expand_ext(i) }\n end", "def gem(name, *reqs)\n if dep = @dependency_names[name]\n dep.requirement.concat reqs\n else\n dep = Gem::Dependency.new name, *reqs\n @dependency_names[name] = dep\n @dependencies << dep\n end\n end", "def find_gems(match, options={})\n return [] unless defined?(::Gem)\n ::Gem.search(match)\n end", "def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end", "def require_gems\n Jekyll::External.require_with_graceful_fail(\n site.gems.select { |plugin| plugin_allowed?(plugin) }\n )\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def find_all req\n res = []\n\n return res unless @remote\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end", "def gemspecs; end", "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def default_requires\n PackageList.new\n end", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def runtime_specific_gems\n []\n end", "def dependencies\n spec.dependencies\n end", "def dependencies\n spec.dependencies\n end", "def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end", "def _requires\n @_requires ||= requires\n end", "def load(needs = {})\n needs = needs.merge({\"zergrush\" => INCLUDE})\n \n Gem::Specification.each { |gem|\n # don't load gems more than once\n next if @gems.has_key? gem.name \n check = needs.dup\n\n # rolls through the depends and inverts anything it finds\n gem.dependencies.each do |dep|\n # this will fail if a gem is depended more than once\n if check.has_key? dep.name\n check[dep.name] = !check[dep.name]\n end\n end\n \n # now since excluded gems start as true, inverting them\n # makes them false so we'll skip this gem if any excludes are found\n if (check.select {|name,test| !test}).length == 0\n # looks like no needs were set to false, so it's good\n if gem.metadata[\"zergrushplugin\"] != nil\n require File.join(gem.gem_dir, \"lib\", gem.name, \"init.rb\")\n @gems[gem.name] = gem.gem_dir\n end\n end\n }\n \n return nil\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end", "def gems; end", "def gems; end", "def gems; end", "def gems\n @gems ||= begin\n gems = locks.dup\n gems.each do |name, g|\n if gem_declarations.has_key?(name)\n g[:declared_groups] = gem_declarations[name][:groups]\n else\n g[:declared_groups] = []\n end\n g[:groups] = g[:declared_groups].dup\n end\n # Transitivize groups (since dependencies are already transitive, this is easy)\n gems.each do |name, g|\n g[:dependencies].each do |dep|\n gems[dep][:groups] |= gems[name][:declared_groups].dup\n end\n end\n gems\n end\n end", "def requirements\n @requirements ||= []\n end", "def find_gems\n @gems = RubygemsApi.call :all\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def requirements\n []\n end", "def make_gemset_recommendations( gemspec )\n\t\trecommendations = {}\n\t\tfetcher = Gem::SpecFetcher.fetcher\n\n\t\tgemspec.dependencies.each do |dep|\n\t\t\tnewer_dep = nil\n\n\t\t\tif (( mspec = dep.matching_specs.last ))\n\t\t\t\tnewer_dep = Gem::Dependency.new( dep.name, dep.requirement, \"> #{mspec.version}\" )\n\t\t\telse\n\t\t\t\tnewer_dep = Gem::Dependency.new( dep.name, dep.requirement )\n\t\t\tend\n\n\t\t\tremotes, _ = fetcher.search_for_dependency( newer_dep )\n\t\t\tremotes.map! {|gem, _| gem.version }\n\n\t\t\tif remotes.empty?\n\t\t\t\trecommendations[ dep ] = nil\n\t\t\telse\n\t\t\t\trecommendations[ dep ] = remotes.last\n\t\t\tend\n\t\tend\n\n\t\treturn recommendations\n\tend", "def parse_required(input)\n gemspecs = []\n input.split(\"\\n\").grep(/^no such file to load -- (.+)\\s*$/) do |line|\n gemspecs << {:name => $1.strip}\n end\n gemspecs\n end", "def elm_dependencies(package)\n ElmPackage.dependencies elm_package_path(package)\n rescue\n {}\n end", "def deps(pkg) # FIXME: \"*** PACKAGE MAY NOT BE DELETED *** \"\n if pkg.status != :available\n components = `#{@cmd} -n #{pkg.name}`.split(\"Requires:\\n\")\n if components.size > 1\n return components[1].strip\n else\n return \"[No depends]\"\n end\n else\n if File.exist?(File.expand_path(\"~/Library/Application Support/Guigna/pkgsrc/INDEX\"))\n # TODO: parse INDEX\n end\n \"[Not available]\"\n end\n end", "def gems=(gems)\n @gem_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def spec_set\n Bundler.locked_gems.specs\n end", "def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end", "def dependencies_for(specification)\n []\n end", "def installed_versions(name, requirement)\n if gem_installed?(name, requirement)\n Chef::Log.info \"Gem #{name} (#{requirement}) found in OpsWorks user space.\"\n # from rubygems/specification.rb#find_all_by_name\n Gem::Dependency.new(name, requirement).matching_specs\n else\n Chef::Log.debug \"Gem #{name} (#{requirement}) not found in OpsWorks user space.\"\n []\n end\n end", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def requires(*paths)\n @requires.concat(paths) unless paths.empty?\n @requires\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def dependencies\n @dependencies ||= ElmPackage.dependencies 'elm-package.json',\n silent: false\n end", "def dependencies_for(specification)\n specification.dependencies\n end", "def parse_deps(input)\n matches = input.scan(/\\s+-\\s+\\[ \\]\\s+(\\S+)\\s+(\\S+\\s+[0-9.]+)/) || []\n\n gemspecs = matches.map do |match|\n {:name => match[0], :version => match[1]}\n end\n\n # NOTE: These gemspecs are gems that are not yet loaded. We don't know if\n # they are installed or not, so we don't know for sure if the\n # dependency will be met at runtime. So, we'll execute a gem command\n # to check to see if these are installed and ignore the ones that\n # already are.\n gemspecs.delete_if do |gemspec|\n cmd = \"gem list #{gemspec[:name]} -i -l\"\n if gemspec[:version]\n cmd << \" -v '#{gemspec[:version]}'\"\n end\n `#{cmd}` =~ /true/\n end\n\n return gemspecs\n end" ]
[ "0.80040956", "0.7675247", "0.7675247", "0.76449025", "0.75560653", "0.75386906", "0.75038576", "0.7461104", "0.7340646", "0.73155725", "0.73155725", "0.7263488", "0.7241406", "0.7241406", "0.7186854", "0.7183271", "0.7172267", "0.69621104", "0.68408877", "0.68351054", "0.68235457", "0.67955166", "0.6672673", "0.66455567", "0.66434455", "0.66413414", "0.6587017", "0.658367", "0.65429145", "0.65345466", "0.6534359", "0.6510081", "0.64848846", "0.64741844", "0.6423277", "0.6387834", "0.63644975", "0.6361695", "0.63534343", "0.6346616", "0.6338699", "0.6309599", "0.6299207", "0.6298329", "0.62736875", "0.6265546", "0.62640435", "0.6263844", "0.625247", "0.6236775", "0.6236775", "0.621144", "0.62050843", "0.6198718", "0.6192739", "0.6191061", "0.6183238", "0.61733955", "0.6160877", "0.6156612", "0.61503", "0.61327624", "0.61235017", "0.61138", "0.61114436", "0.61075974", "0.6105149", "0.60925585", "0.6072438", "0.6069193", "0.6069193", "0.6066415", "0.60625875", "0.6050965", "0.6050013", "0.60049224", "0.60000896", "0.60000896", "0.60000896", "0.59958136", "0.5980795", "0.59711796", "0.5957261", "0.59519106", "0.5947001", "0.59337085", "0.591456", "0.5910588", "0.59055245", "0.5904484", "0.59027684", "0.59019965", "0.58958143", "0.58822554", "0.5879866", "0.5879763", "0.5876793", "0.5865259", "0.58485895", "0.58420837" ]
0.83392173
0
Return all the BuildRequires for the specified gem
def build_requirements_for_gem(gem_name) @metadata[:build_requires].nil? ? [] : @metadata[:build_requires].select { |r| r.gem_name == gem_name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def requires\n require_items.collect(&:package)\n end", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def dependencies(gemfile)\n dependencies = { }\n\n File.open(gemfile) do |f|\n f.each do |line|\n if (line.match(/\\Agem\\s+['\"]bundler['\"]\\s*,\\s*['\"]([^'\"]+)['\"]/))\n dependencies[:bundler] = $1\n elsif (line.match(/\\A\\#\\s*rubygems\\s+(\\S+)/))\n dependencies[:rubygems] = $1\n end\n end\n end\n\n dependencies\nend", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def has_all_requirements_for?(gem_dep)\n reqs = self.requirements_for_gem gem_dep.name\n # create a spec requirement dependency for each expanded subrequirement,\n # verify we can find a match for that\n gem_dep.requirement.to_s.split(',').all? { |greq|\n Gem2Rpm::Helpers.expand_requirement([greq.split]).all? { |ereq|\n tereq = Requirement.new :name => \"#{requirement_prefix}(#{gem_dep.name})\",\n :condition => ereq.first,\n :version => ereq.last.to_s\n reqs.any? { |req| req.matches?(tereq)}\n }\n }\n end", "def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end", "def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end", "def build_gems; end", "def gems\n @gems ||=\n Bundler.load.current_dependencies.map do |dependency|\n GemsBond::Gem.new(dependency)\n end\n end", "def all_requires\n []\n end", "def all_requires\n []\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def gems=(gems)\n @gem_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def gems\n @gems ||= begin\n gems = locks.dup\n gems.each do |name, g|\n if gem_declarations.has_key?(name)\n g[:declared_groups] = gem_declarations[name][:groups]\n else\n g[:declared_groups] = []\n end\n g[:groups] = g[:declared_groups].dup\n end\n # Transitivize groups (since dependencies are already transitive, this is easy)\n gems.each do |name, g|\n g[:dependencies].each do |dep|\n gems[dep][:groups] |= gems[name][:declared_groups].dup\n end\n end\n gems\n end\n end", "def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def gem_requires(name, options) # :nodoc:\n if options.include? :require\n if requires = options.delete(:require)\n @requires[name].concat Array requires\n end\n else\n @requires[name] << name\n end\n raise ArgumentError, \"Unhandled gem options #{options.inspect}\" unless options.empty?\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def gem(name, *reqs)\n if dep = @dependency_names[name]\n dep.requirement.concat reqs\n else\n dep = Gem::Dependency.new name, *reqs\n @dependency_names[name] = dep\n @dependencies << dep\n end\n end", "def all_modules_in_gem_named(gem)\n self.all_modules.select { |mod| mod.belongs_to?(gem) }\n end", "def require_gems; end", "def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end", "def gem_requirements_from_array(what, array)\n array.map do |dep|\n Gem::Dependency.new(what, *dep)\n end\n end", "def reverse_dependencies(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.dependencies.any? {|e| e.name == rubygem && e.type == :runtime}}.\n map {|e| \"#{e.name}-#{e.version}\" }\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def build_gem; end", "def runtime_specific_gems\n []\n end", "def all_classes_and_modules_in_gem_named(gem)\n self.all_classes_and_modules.select { |klassmod| klassmod.belongs_to?(gem) }\n end", "def get_locked_dep_versions(curr_deps, gem)\n all_deps = []\n curr_specs = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile)).specs rescue []\n curr_deps.each do |curr_dep|\n found_spec = curr_specs.detect {|spec| spec.name.to_s == curr_dep.name.to_s}\n dep_to_push = OpenStruct.new\n #scope = []\n if found_spec\n dep_to_push.name = found_spec.name\n dep_to_push.version = found_spec.version\n else\n dep_to_push.name = curr_dep.name\n dep_to_push.version = curr_dep.version\n end\n dep_to_push.path = curr_dep.path\n #scope = curr_dep.groups if curr_dep.groups\n #dep_to_push.scope = scope\n\n all_deps.push(dep_to_push)\n end\n #return all_deps.map {|dep| {:name => dep.name, :version => dep.version, :scope => dep.scope}}.sort{|a, b| a[:name] <=> b[:name]}\n return all_deps.map {|dep| {:name => dep.name, :version => dep.version, :path => dep.path}}.sort{|a, b| a[:name] <=> b[:name]}\n end", "def find_issues_by_gem(string = \"\")\n issues = []\n @security_checks.each do |check|\n if check.kind == Dawn::KnowledgeBase::DEPENDENCY_CHECK or check.kind == Dawn::KnowledgeBase::UNSAFE_DEPENDENCY_CHECK\n debug_me \"applying check #{check.name}\"\n name = string.split(':')[0]\n version = string.split(':')[1]\n check.please_ignore_dep_version = true if version.nil?\n check.dependencies = [{:name=>name, :version=>version}]\n issues << check if check.vuln?\n end\n end\n debug_me \"#{issues}\"\n return issues\n end", "def gem(name, requirement = nil)\n gems << Gem.new(name, requirement)\n end", "def requires\n self.class::Requirements[@version] || self.class::Requirements[:all] || {}\n end", "def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end", "def r(*gems)\n gems.map {|g| require g.to_s}\nend", "def build_gem\n Juwelier::Commands::BuildGem.build_for(self).run\n end", "def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end", "def gems(*args)\n gems.each{|g| gem(g) }\n end", "def gem(*args)\n @gems << args unless args.empty?\n @gems\n end", "def core_dependencies\n @_core_dependencies ||= begin\n if gem_dir\n Gem.clear_paths; Gem.path.unshift(gem_dir)\n end\n deps = []\n merb_core = Gem::Dependency.new('merb-core', '>= 0.9.8')\n if gemspec = Gem.source_index.search(merb_core).last\n deps << Gem::Dependency.new('merb-core', gemspec.version)\n deps += gemspec.dependencies\n end\n Gem.clear_paths\n deps\n end\n end", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def find_gems(match, options={})\n return [] unless defined?(::Gem)\n ::Gem.search(match)\n end", "def gems; end", "def gems; end", "def gems; end", "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def gems\n gem_data = (project['gems'] ||= Gems::List.new)\n return gem_data if gem_data.kind_of? Gems::List\n if gem_data.kind_of? Hash\n project['gems'] = Gems::List.new(gem_data)\n save_config\n return gems\n end\n new_gems = Gems::List.new\n gem_data.each do |gem_ary|\n new_gems[gem_ary[0]] = gem_ary[1]\n end\n project['gems'] = new_gems\n save_config\n return gems\n end", "def load(needs = {})\n needs = needs.merge({\"zergrush\" => INCLUDE})\n \n Gem::Specification.each { |gem|\n # don't load gems more than once\n next if @gems.has_key? gem.name \n check = needs.dup\n\n # rolls through the depends and inverts anything it finds\n gem.dependencies.each do |dep|\n # this will fail if a gem is depended more than once\n if check.has_key? dep.name\n check[dep.name] = !check[dep.name]\n end\n end\n \n # now since excluded gems start as true, inverting them\n # makes them false so we'll skip this gem if any excludes are found\n if (check.select {|name,test| !test}).length == 0\n # looks like no needs were set to false, so it's good\n if gem.metadata[\"zergrushplugin\"] != nil\n require File.join(gem.gem_dir, \"lib\", gem.name, \"init.rb\")\n @gems[gem.name] = gem.gem_dir\n end\n end\n }\n \n return nil\n end", "def depend_on( name, version = nil )\n spec = Gem::Specification.find_by_name(name)\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend", "def gem_spec\n require 'rubygems/specification'\n spec_fields = %w(\n name author email has_rdoc rubyforge_project summary\n version description required_ruby_version homepage\n )\n Gem::Specification.new do | spec |\n for field in spec_fields\n value = self.send( field )\n spec.send( \"#{field}=\", value )\n end\n \n spec.files = package.files.to_a + %w( Rakefile Manifest.txt )\n spec.test_files = unit_tests.to_a + functional_tests.to_a\n \n spec.executables.push( *executables )\n spec.requirements.push( *requirements )\n end\n end", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def find_gems\n @gems = RubygemsApi.call :all\n end", "def to_ruby\n%{Gem::Specification.new do |s|\n s.name = \"#{@gem_spec.name}\"\n s.version = \"#{@gem_spec.version}\"\n\n s.specification_version = #{ ivar_get(:specification_version) || 2 } if s.respond_to? :specification_version=\n s.required_rubygems_version = Gem::Requirement.new(\"#{ivar_get(:required_rubygems_version) || '>= 0'}\") if s.respond_to? :required_rubygems_version=\n\n#{gem_spec_variables.map { |k,v| \" s.#{k} = #{v.inspect}\" }.join(\"\\n\") }\n\n#{@gem_spec.dependencies.map { |dep| \" s.add_dependency(\\\"#{dep.name}\\\", [\\\"#{dep.version_requirements.to_s}\\\"])\" }.join(\"\\n\") }\nend}\n end", "def required(gem_name, gem_install_name = nil)\n Required::required gem_name, gem_install_name\nend", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def requires(database)\n fail \"Extension #{name} not (yet) installed\" unless installed?(database)\n\n stmt = if version\n <<-SQL\n SELECT unnest(requires) as name FROM\n ( SELECT requires FROM pg_available_extension_versions where name='#{name}' AND version ='#{version}') t\n SQL\n else\n <<-SQL\n SELECT unnest(requires) as name FROM\n (SELECT requires FROM\n pg_available_extensions a\n JOIN pg_available_extension_versions v ON v.name = a.name AND a.default_version = v.version\n WHERE v.name = '#{name}')t\n SQL\n end\n\n result = database.execute(stmt).to_a\n\n requires = result.map{|r| r['name']}\n end", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end", "def expand_requires(requires, builder)\n requires.map { |i| builder.expand_ext(i) }\n end", "def gemspecs; end", "def depend_on( name, version = nil )\n spec = Gem.source_index.find_name(name).last\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend", "def gem(name, main_module)\n _, spec = Gem.loaded_specs.find { |spec_pair| spec_pair[0] == name }\n gems << spec\n modules << main_module\n spec.full_gem_path\n end", "def load_gems(an_array_of_strings)\n\n print \"Installing gems as necessary ... \" if $debug\n gemfile do\n source 'https://rubygems.org'\n Array(an_array_of_strings).each do |gem_name|\n print gem_name + ' ' if $debug\n gem gem_name\n end\n end\n\n puts 'done' if $debug\n\nend", "def packages_from_require(rpmdep)\n refresh\n @rpmdb.whatprovides(rpmdep)\n end", "def require_gems\n Jekyll::External.require_with_graceful_fail(\n site.gems.select { |plugin| plugin_allowed?(plugin) }\n )\n end", "def get_all_requires(code = @code)\n if code.is_a?(Array) then\n requires = (code.select { |sub| is_require?(sub) }).map! do |sub|\n get_require(sub)\n end\n code.each do |sub|\n requires += get_all_requires(sub)\n end\n return requires\n else\n return []\n end\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def gem_info(gem, client)\n gem_data = {}\n uri = (\n Gems.info(gem)['source_code_uri'] || Gems.info(gem)['homepage_uri']).sub!(%r{http.*com/}, '')\n repo = repository(uri, client)\n contributors_count = contributors(uri).css('span.num.text-emphasized').children[2].text.to_i\n used_by_count = dependents(uri).css('.btn-link')[1].text.delete('^0-9').to_i\n gem_data[gem.to_sym] = gem_properties(repo, contributors_count, used_by_count)\n end", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def rubyinstaller_build_gem_files\n spec = Gem.loaded_specs[\"rubyinstaller-build\"]\n if spec\n # A loaded gemspec has empty #files -> fetch the files from its path.\n # This is preferred to gemspec loading to avoid a dependency to git.\n Dir[\"**/*\", base: spec.full_gem_path].select do |f|\n FileTest.file?(File.join(spec.full_gem_path, f))\n end\n else\n # Not yet loaded -> load the gemspec and return the files added to the gemspec.\n Gem::Specification.load(File.join(GEM_ROOT, \"rubyinstaller-build.gemspec\")).files\n end\n end", "def versions_for(gem)\n versions_hash[gem].map { |version| version[1] }\n end", "def gem_declarations\n @gem_declarations ||= begin\n Bundler.with_clean_env do\n # Set BUNDLE_GEMFILE to the new gemfile temporarily so all bundler's things work\n # This works around some issues in bundler 1.11.2.\n ENV[\"BUNDLE_GEMFILE\"] = gemfile_path\n\n parsed_gemfile = Bundler::Dsl.new\n parsed_gemfile.eval_gemfile(gemfile_path)\n parsed_gemfile.complete_overrides if parsed_gemfile.respond_to?(:complete_overrides)\n\n result = {}\n parsed_gemfile.dependencies.each do |dep|\n groups = dep.groups.empty? ? [:default] : dep.groups\n result[dep.name] = { groups: groups, platforms: dep.platforms }\n end\n result\n end\n end\n end", "def getDeps csproj\r\n deps = []\r\n csproj.search(\"reference\") do |ref|\r\n deps << ref.get_attribute(\"include\").match(/^([^,]+),*/)[1]\r\n end\r\n return deps\r\nend" ]
[ "0.7956537", "0.7649496", "0.7649496", "0.7571615", "0.73775095", "0.727578", "0.7154658", "0.71063125", "0.71063125", "0.70693284", "0.6963554", "0.69446707", "0.66307956", "0.6495567", "0.64904886", "0.6465807", "0.6449178", "0.6381928", "0.6377861", "0.62782127", "0.6257114", "0.6256608", "0.6253769", "0.6240784", "0.6197402", "0.6185386", "0.6158634", "0.615713", "0.6147678", "0.6146499", "0.6073691", "0.6073691", "0.6070212", "0.60672146", "0.6062228", "0.6062112", "0.60451406", "0.6013891", "0.60058326", "0.6002149", "0.6002149", "0.59997165", "0.59929454", "0.59862757", "0.59846944", "0.59720397", "0.5956941", "0.59154356", "0.5896424", "0.5890397", "0.5883392", "0.5872678", "0.58669907", "0.58638525", "0.583696", "0.58360595", "0.5835183", "0.5816789", "0.58014965", "0.57883346", "0.57768124", "0.5763109", "0.5756678", "0.5756098", "0.57472175", "0.5747215", "0.5747215", "0.5747215", "0.5743635", "0.5740757", "0.5728957", "0.57244307", "0.5704532", "0.5689963", "0.56890815", "0.56788814", "0.5656817", "0.5655823", "0.56461096", "0.56460035", "0.5644099", "0.56299305", "0.5625945", "0.56213075", "0.5592163", "0.5585435", "0.5563151", "0.55573916", "0.55337226", "0.55334306", "0.55316687", "0.5528275", "0.5524387", "0.5524387", "0.5521728", "0.5506329", "0.5501373", "0.54970324", "0.5495409", "0.54770076" ]
0.82276887
0
Return bool indicating if this spec specifies all the requirements in the specified gem dependency
def has_all_requirements_for?(gem_dep) reqs = self.requirements_for_gem gem_dep.name # create a spec requirement dependency for each expanded subrequirement, # verify we can find a match for that gem_dep.requirement.to_s.split(',').all? { |greq| Gem2Rpm::Helpers.expand_requirement([greq.split]).all? { |ereq| tereq = Requirement.new :name => "#{requirement_prefix}(#{gem_dep.name})", :condition => ereq.first, :version => ereq.last.to_s reqs.any? { |req| req.matches?(tereq)} } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ok?\n @specs.all? do |spec|\n spec.runtime_dependencies.all? do |dep|\n @specs.find { |s| s.satisfies_requirement? dep }\n end\n end\n end", "def ok?\n @specs.all? { |spec|\n\tspec.dependencies.all? { |dep|\n\t @specs.find { |s| s.satisfies_requirement?(dep) }\n\t}\n }\n end", "def requirements_met?\n preconditions.all? &:met?\n end", "def requirement_satisfied_by?(requirement, activated, spec)\n true\n end", "def deps_satisfied?(deps)\n deps.each do |dep|\n if dep.to_s =~ /^no_(.*)$/\n return false if @used_legos.include?( $1 )\n else\n return false unless @used_legos.include?( dep.to_s )\n end\n end\n\n true\nend", "def has_conflicts?\n return true unless Gem.env_requirement(name).satisfied_by?(version)\n self.dependencies.any? do |dep|\n if dep.runtime?\n spec = Gem.loaded_specs[dep.name]\n spec and not spec.satisfies_requirement? dep\n else\n false\n end\n end\n end", "def dependencies_satisfied?(deps)\n deps.all? do |dep|\n depprop = Proposal.where(barclamp: dep[\"barclamp\"], name: dep[\"inst\"]).first\n depprop_queued = depprop[\"deployment\"][dep[\"barclamp\"]][\"crowbar-queued\"] rescue false\n depprop_deployed = (depprop[\"deployment\"][dep[\"barclamp\"]][\"crowbar-status\"] == \"success\") rescue false\n\n depprop && !depprop_queued && depprop_deployed\n end\n end", "def dependencies_satisfied?\n missing_dependencies.empty?\n end", "def requirement_satisfied_by?(requirement, activated, spec)\n version = spec.version\n return false unless requirement.requirement.satisfied_by?(version)\n return false unless valid_possibility_version_for_root_name?(requirement, activated, spec)\n return false unless spec_is_platform_compatible?(activated, requirement, spec)\n true\n end", "def has_dependencies?\n update_for.length > 0 or requires.length > 0\n end", "def satisfied?\n dependencies.none? { |_, v| v.empty? }\n end", "def gemspec?\n !gemspecs.empty?\n end", "def meets_requirements?\n if dirname = Micro.installed_gem_dirnames(name).last\n Gem::Version.from_gem_dirname(dirname) >= @version_requirements.version\n end\n end", "def requirement_satisfied_by?(requirement, activated, spec)\n requirement.constraint.satisfies?(spec.version)\n end", "def satisfied_by?(spec)\n return false unless requirement\n spec = ArtifactNamespace.to_hash(spec)\n hash = to_spec_hash\n hash.delete(:version)\n version = spec.delete(:version)\n hash == spec && requirement.satisfied_by?(version)\n end", "def installed?\n case @spec\n when Gem::Resolver::VendorSpecification then\n true\n else\n this_spec = full_spec\n\n Gem::Specification.any? do |s|\n s == this_spec\n end\n end\n end", "def conficts_when_loaded_with?(list_of_specs) # :nodoc:\n result = list_of_specs.any? do |spec|\n spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }\n end\n result\n end", "def satisfies_requirement?(dependency)\n return @name == dependency.name &&\n dependency.requirement.satisfied_by?(@version)\n end", "def dependency_met?\n true\n end", "def complete?\n requirements.each do |r|\n next if self[r].present?\n\n return false\n end\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def requirement_satisfied_by?(requirement, _activated, spec)\n requirement.satisified_by?(spec)\n end", "def gem_dep_matches?(what, version, *deps)\n # always match if we have no chef_version at all\n return true unless deps.length > 0\n\n # match if we match any of the chef_version lines\n deps.any? { |dep| dep.match?(what, version) }\n end", "def matches_spec?(spec)\n @dependency.matches_spec? spec\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def installed?(name, req = Gem::Requirement.default)\n Gem::Specification.any? { |s| s.name =~ name and req =~ s.version }\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def matches_spec? spec\n name == spec.name and requirement.satisfied_by? spec.version\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def dependencies_resolved?\n !@resolved_dependencies.nil?\n end", "def dependencies_met?\n @dependencies_met ||= command_dependencies_met?(command_options)\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def dependencies_installed?(database)\n dependencies.all?{|_, d| d.installed?(database)}\n end", "def match?(spec, allow_prerelease = false)\n @dependency.match? spec, nil, allow_prerelease\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def for_spec?(spec)\n @dependency.name == spec.name\n end", "def for_spec?(spec)\n @dependency.name == spec.name\n end", "def requirements\n unless @reqs\n @reqs = []\n @reqs << Requirement.new(:feature, {:feature => self['feature']}, plugin) if self['feature']\n end\n @reqs\n end", "def gem_listed?(gem)\n lockfile_specs.map(&:name).include? gem\n end", "def matches_spec?(spec)\n return false unless name === spec.name\n return true if requirement.none?\n\n requirement.satisfied_by?(spec.version)\n end", "def dependencies_installed?(builder)\n warn_if_gif2webp_missing builder\n cwebp_installed? builder\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def needed?\n topology.packages.length > 1\n end", "def check_dependencies(desc, target_package = nil, active_criteria = false)\n # dependent_packages = Pkgd.where(\n # { 'pd.package_content' => { '$elemMatch' => { 'id.name' => desc['id'][:name],\n # 'id.vendor' => desc['id'][:vendor],\n # 'id.version' => desc['id'][:version] } } })\n # dependent_packages.each do |dp|\n # diffp_condition = true\n # if target_package != nil\n # diffp_condition = ( (dp['pd']['name'] != target_package['name']) or\n # (dp['pd']['vendor'] != target_package['vendor']) or\n # (dp['pd']['version'] != target_package['version']) )\n # end\n # if diffp_condition\n # if active_criteria\n # return true if dp['status'].casecmp('ACTIVE') == 0\n # else\n # return true\n # end\n # end\n # end\n false\n end", "def gem_should_be_checked?(gem_name)\n gem_name.index('barkest_') == 0\n end", "def has_dependency?\n return true unless @dependency.nil?\n end", "def check_options_requirements(runtime_options)\n required_options = options[:requires] || options[:require]\n return true unless required_options\n\n ([required_options].flatten - runtime_options.keys).size == 0\n end", "def configured_feature_requires_component?(component)\n list_configured_features_from_component(component).length > 0\n end", "def dependencies_satisfied?(klass)\n plugin_keys = klass.included_plugins.map { |plugin| Plugins.lookup_name(plugin) }\n (dependencies.keys - plugin_keys).none?\n end", "def has_file_satisfied_by?(spec_file)\n file_paths.any? { |gem_file| RPM::Spec.file_satisfies?(spec_file, gem_file) }\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def check_manifest(manifest, all_deps)\n related = all_deps.select{|d| d.name == manifest.name}\n if q = related.find{|d| !d.satisfied_by?(manifest)}\n debug_conflict manifest, q\n return false\n end\n true\n end", "def has_file_satisfied_by?(spec_file)\n file_paths.any? { |gem_file| RPM::Spec.file_satisfies?(spec_file, gem_file) }\n end", "def required?\n spec['Required']\n end", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def required?\n required.any?\n end", "def dep_defined?\n @dep_defined\n end", "def candidates_exist_for_all_forced_changes?\n forced_packages_missing_candidates.empty?\n end", "def depends_on?(node)\n dependency_list = []\n @dependencies.each do |d|\n dependency_list << d if node.run_list.include? d\n end\n [dependency_list.any?, dependency_list]\n end", "def should_do_requirements_install\n if has_python_requirements\n if not install_date('pythonenv')\n # We've never done an install from requirements.txt before\n return true\n else\n return (requirements_edit_date > install_date('pythonenv'))\n end\n else\n return false\n end\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def fulfilled?(deps)\n (deps - @seen).empty?\n end", "def prerelease?\n requirements.any? {|r| r.last.prerelease? }\n end", "def meets_requirements?(params)\n requirements.reject {|k| params.keys.map(&:to_s).include? k.to_s }.empty?\n end", "def warnings?\n !gem?(\"shelly-dependencies\")\n end", "def warnings?\n !gem?(\"shelly-dependencies\") || gem?(\"shelly\")\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def satisfied_by?(req_vers, new_vers)\n req = LibGems::Requirement.new(req_vers)\n req_vers.sub(/^= /,'') == new_vers.sub(/^= /,'') ||\n req.satisfied_by?(LibGems::Version.new(new_vers))\n end", "def dependencies_are_ready?\n return @dependencies_are_ready unless @dependencies_are_ready.nil?\n return false if @dependencies_have_failed\n ready = all? do |task|\n task.successful? or task.skipped?\n end\n debug 'All dependencies are ready' if ready\n @dependencies_are_ready = ready\n end", "def complete?\n specs.find {|s| !s.complete?} ? false : true\n end", "def spec_is_platform_compatible?(dependency_graph, dependency, spec)\n # This is safe since a pod will only be in locked dependencies if we're\n # using the same exact version\n return true if locked_dependencies.vertex_named(spec.name)\n\n vertex = dependency_graph.vertex_named(dependency.name)\n predecessors = vertex.recursive_predecessors.select(&:root?)\n predecessors << vertex if vertex.root?\n platforms_to_satisfy = predecessors.flat_map(&:explicit_requirements).flat_map { |r| @platforms_by_dependency[r] }.uniq\n\n available_platforms = spec.available_platforms\n\n platforms_to_satisfy.all? do |platform_to_satisfy|\n available_platforms.all? do |spec_platform|\n next true unless spec_platform.name == platform_to_satisfy.name\n # For non library specs all we care is to match by the platform name, not to satisfy the version.\n next true if spec.non_library_specification?\n platform_to_satisfy.supports?(spec_platform)\n end\n end\n end", "def satisfy?(y)\n unless y.is_a?(RPMDependency)\n raise ArgumentError, \"Expecting an RPMDependency object\"\n end\n\n x = self\n\n # Easy!\n if x.name != y.name\n return false\n end\n\n # Partial compare\n #\n # eg: x.version 2.3 == y.version 2.3-1\n sense = x.version.partial_compare(y.version)\n\n # Thanks to rpmdsCompare() rpmds.c\n if (sense < 0) && ((x.flag == :> || x.flag == :>=) || (y.flag == :<= || y.flag == :<))\n return true\n elsif (sense > 0) && ((x.flag == :< || x.flag == :<=) || (y.flag == :>= || y.flag == :>))\n return true\n elsif sense == 0 && (\n ((x.flag == :== || x.flag == :<= || x.flag == :>=) && (y.flag == :== || y.flag == :<= || y.flag == :>=)) ||\n (x.flag == :< && y.flag == :<) ||\n (x.flag == :> && y.flag == :>)\n )\n return true\n end\n\n false\n end", "def check_for_requirements; end", "def bundled?\n Gem.loaded_specs.key?(self.class.from_gem)\n end", "def requirements\n []\n end", "def gem?\n @gem\n end", "def candidates_exist_for_all_uninstalled?\n packages_missing_candidates.empty?\n end", "def valid?\n gemfile? && gemfile_lock? && gem?(\"thin\") &&\n gem?(\"rake\") && config_ru?\n end", "def dependent?\n @flags.include?(:dependent)\n end", "def has_build_satisfying?(name, version)\n dep = ::Gem::Dependency.new name, version\n versions_for(name).any? { |v| dep.match?(name, v) }\n end", "def gem_installed?(gem_name)\n !Gem::Specification.find_by_name(gem_name).nil?\n rescue Gem::LoadError\n false\n end", "def none?\n if @requirements.size == 1\n @requirements[0] == DefaultRequirement\n else\n false\n end\n end", "def requirements\n @requirements ||= []\n end", "def gem?\n #return true if Dir[File.join(location, '*.gemspec')].first\n pkgname = File.basename(location)\n gemsdir = File.dirname(location)\n specdir = File.join(File.dirname(gemsdir), 'specifications')\n Dir[File.join(specdir, \"#{pkgname}.gemspec\")].first\n end", "def dependency_backward_any?\n backward_dependencies.any?\n end", "def has_feature_constraint?(name = nil)\n if !name\n any?(&:has_feature_constraint?)\n else\n any? { |bit| bit.enabled_by_feature?(name) }\n end\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name full_name\n\n siblings = @specs.find_all { |s|\n s.name == gem_to_remove.name &&\n s.full_name != gem_to_remove.full_name\n }\n\n deps = []\n\n @specs.each do |spec|\n spec.dependencies.each do |dep|\n deps << dep if gem_to_remove.satisfies_requirement?(dep)\n end\n end\n\n deps.all? { |dep|\n siblings.any? { |s|\n s.satisfies_requirement? dep\n }\n }\n end", "def valid_gemspec?; end", "def requirements\n []\n end", "def pd_version_satisfies?(*constraints)\n pd_version = Gem::Version.new(@driver.version)\n Gem::Requirement.new(*constraints).satisfied_by?(pd_version)\n end", "def require_matched_dependency_version\n false\n end", "def validate_dependencies # :nodoc:\n warning_messages = []\n @specification.dependencies.each do |dep|\n prerelease_dep = dep.requirements_list.any? do |req|\n Gem::Requirement.new(req).prerelease?\n end\n\n warning_messages << \"prerelease dependency on #{dep} is not recommended\" if\n prerelease_dep && !@specification.version.prerelease?\n\n open_ended = dep.requirement.requirements.all? do |op, version|\n not version.prerelease? and (op == '>' or op == '>=')\n end\n\n if open_ended\n op, dep_version = dep.requirement.requirements.first\n\n segments = dep_version.segments\n\n base = segments.first 2\n\n recommendation = if (op == '>' || op == '>=') && segments == [0]\n \" use a bounded requirement, such as '~> x.y'\"\n else\n bugfix = if op == '>'\n \", '> #{dep_version}'\"\n elsif op == '>=' and base != segments\n \", '>= #{dep_version}'\"\n end\n\n \" if #{dep.name} is semantically versioned, use:\\n\" \\\n \" add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}\"\n end\n\n warning_messages << [\"open-ended dependency on #{dep} is not recommended\", recommendation].join(\"\\n\") + \"\\n\"\n end\n end\n if warning_messages.any?\n warning_messages.each {|warning_message| warning warning_message }\n end\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name(full_name)\n siblings = @specs.find_all { |s|\n\ts.name == gem_to_remove.name &&\n\t s.full_name != gem_to_remove.full_name\t\n }\n deps = []\n @specs.each do |spec|\n\tspec.dependencies.each do |dep|\n\t deps << dep if gem_to_remove.satisfies_requirement?(dep)\n\tend\n end\n deps.all? { |dep|\n\tsiblings.any? { |s| \n\t s.satisfies_requirement?(dep)\n\t}\n }\n end", "def is_dependency_installed?\n if self.dependable\n $db.services.each do |service|\n if service[:service_type] == self.type\n return true\n end\n end\n end\n false\n end", "def specific?\n @requirement.specific?\n end", "def specific?\n @requirement.specific?\n end" ]
[ "0.7509248", "0.7437589", "0.7234251", "0.71505815", "0.7129035", "0.71249455", "0.7114287", "0.70675755", "0.7060609", "0.7025498", "0.7008242", "0.70036715", "0.6982246", "0.69707406", "0.69687974", "0.68911797", "0.686583", "0.6853289", "0.6765665", "0.6764929", "0.6736777", "0.6723332", "0.67147285", "0.6705312", "0.6672069", "0.6655292", "0.664261", "0.65172654", "0.6501202", "0.64761436", "0.6471164", "0.6469696", "0.646921", "0.6446695", "0.64374554", "0.6402483", "0.64007413", "0.64007413", "0.64007413", "0.63766426", "0.63766426", "0.63715285", "0.637053", "0.6363927", "0.63301075", "0.6323706", "0.6285651", "0.6281626", "0.6266216", "0.62589353", "0.6249169", "0.62388587", "0.6236103", "0.62322825", "0.620898", "0.62063026", "0.61967874", "0.61815286", "0.6181337", "0.61736995", "0.6168446", "0.61353934", "0.6122786", "0.61144453", "0.6109189", "0.60903245", "0.6088419", "0.60800636", "0.6075487", "0.60687816", "0.60683006", "0.60536504", "0.6040362", "0.6039116", "0.60158336", "0.6012728", "0.6004609", "0.6003838", "0.5991582", "0.59733814", "0.59533083", "0.59413904", "0.5941169", "0.5921142", "0.59170294", "0.59069747", "0.5905464", "0.59039694", "0.5894158", "0.58900225", "0.5889996", "0.58885914", "0.5888148", "0.58825266", "0.58764523", "0.58749115", "0.58594805", "0.5857753", "0.5856212", "0.5856212" ]
0.8134189
0
Return list of gem dependencies for which we have no corresponding requirements
def missing_deps_for(gem) # Comparison by name here assuming if it is in existing spec, # spec author will have ensured versions are correct for their purposes gem.deps.select { |dep| requirements_for_gem(dep.name).empty? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def dependencies\n []\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def required_dependencies\n dependencies - optional_dependencies\n end", "def dependencies\n []\n end", "def dependencies_for(specification)\n []\n end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def dependencies\n []\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def dependencies\n EMPTY_SET\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def all_requires\n []\n end", "def all_requires\n []\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def remove_unused_dependencies\n # puts 'removing unused dependencies list.'\n dependencies = @target.dependencies\n dependencies.each do |dependency|\n dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name\n end\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def dependencies\n to_a.reject { |a| a.filename.eql?(self.filename) }\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def find_dependencies\n\t\tunless GEMDEPS_FILE.readable?\n\t\t\tself.prompt.warn \"Deps file (%s) is missing or unreadable, assuming no dependencies.\" %\n\t\t\t\t[ GEMDEPS_FILE ]\n\t\t\treturn []\n\t\tend\n\n\t\tfinder = Rake::DevEiate::GemDepFinder.new( GEMDEPS_FILE )\n\t\tfinder.load\n\t\treturn finder.dependencies\n\tend", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end", "def resolve_dependencies(dependencies)\n dependencies.inject([]) do |deps, dep|\n deps + dep.determine(:ubuntu, :precise).map do |pkg, version|\n !version.nil? ? \"#{pkg} (#{version})\" : pkg\n end\n end.join(', ')\n end", "def dependent_specs\n runtime_dependencies.map {|dep| dep.to_specs }.flatten\n end", "def dependent_modules\n out = [ ]\n @dependencies.each { |dependency| out << @module_set[dependency] }\n out\n end", "def locked_specs_as_deps\n deps = @dependencies & @locked_deps\n\n @dependencies.each do |dep|\n next if deps.include?(dep)\n deps << dep if @locked_specs.any? { |s| s.satisfies?(dep) }\n end\n\n meta_deps = @locked_specs.for(deps).map do |s|\n dep = Gem::Dependency.new(s.name, s.version)\n @locked_deps.each do |d|\n dep.source = d.source if d.name == dep.name\n end\n dep\n end\n end", "def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)\n [dependency, constraint, current, constraint.include?(current)]\n end\n end", "def os_dependencies\n []\n end", "def initial_dependencies\n []\n end", "def requires\n require_items.collect(&:package)\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def arduino_library_dependencies\n return [] unless library_properties?\n return [] if library_properties.depends.nil?\n\n library_properties.depends\n end", "def runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def dependencies\n @dependencies ||= ElmPackage.dependencies 'elm-package.json',\n silent: false\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def find_dependencies(deps=nil, verbose=false)\n \n deps ||= all_dependencies\n\n search_list = Array(deps)\n found = []\n ret = []\n \n # if we discover a new local package via indirect dependencies then\n # it's dependencies will be fetchable one time.\n fetchable = Set.new\n \n until search_list.empty?\n name, version = search_list.shift\n\n if dup = found.find{|p| p.name == name}\n # already found, check for conflicts\n next if satisfied_by?(version, dup.version)\n raise PackageConflictError.new(name, dup.version, version)\n end\n\n pkg = locate_package(name, version, verbose)\n if pkg.nil? && fetchable.include?(name)\n fetchable.reject! { |x| x == name }\n core_fetch_dependency(name, version, :runtime, true) \n pkg = locate_package name, version, verbose\n end\n \n raise PackageNotFoundError.new(name, version) unless pkg\n\n found << pkg\n\n # Look up dependencies of dependencies\n new_deps = Array(pkg.dependencies) + Array(pkg.dependencies_build)\n if has_local_package? pkg.name\n new_deps += Array(pkg.dependencies_development)\n new_deps.each { |dep| fetchable.add dep.first }\n end\n \n search_list += new_deps\n\n ret << pkg\n end\n\n ret\n end", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def partition_dependencies(dependencies, gem_dir)\n system_specs, local_specs, missing_deps = [], [], []\n if gem_dir && File.directory?(gem_dir)\n gem_dir = File.expand_path(gem_dir)\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n local = gemspecs.reverse.find { |s| s.loaded_from.index(gem_dir) == 0 }\n if local\n local_specs << local\n elsif gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n ::Gem.clear_paths\n else\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n if gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n end\n [system_specs, local_specs, missing_deps]\n end", "def dependencies_for(specification)\n specification.dependencies\n end", "def requirements\n []\n end", "def find_non_local_dependencies(deps, verbose)\n search_list = Array(deps)\n seen = []\n ret = {}\n\n until search_list.empty?\n name, version = search_list.shift\n next if seen.include?(name)\n seen << name\n\n package_root = locate_local_package(name)\n if package_root\n pkg = BPM::Package.new(package_root)\n pkg.load_json\n\n unless satisfied_by?(version, pkg.version)\n raise LocalPackageConflictError.new(pkg.name, version, pkg.version)\n end\n\n search_list += Array(pkg.dependencies)\n search_list += Array(pkg.dependencies_development)\n search_list += Array(pkg.dependencies_build)\n else\n ret[name] = version\n end\n end\n\n ret\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def conflicts\n conflicts = {}\n self.runtime_dependencies.each do |dep|\n spec = Gem.loaded_specs[dep.name]\n if spec and not spec.satisfies_requirement? dep\n (conflicts[spec] ||= []) << dep\n end\n end\n env_req = Gem.env_requirement(name)\n (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version\n conflicts\n end", "def dependencies\n if @options[:dependencies]\n deps = [] << @options[:dependencies]\n deps.flatten.collect { |item|\n item = File.join(item,'**/*') if File.directory?(item)\n Dir.glob item\n }.flatten.uniq.collect { |item|\n File.directory?(item) ? nil : item\n }.compact\n else\n false\n end\n end", "def dependencies\n @dependencies ||= Set.new\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def dependencies\n return @dependencies unless @dependencies.nil?\n @dependencies = [ ]\n lockfile.each_line do |line|\n if line =~ /^\\s{4}([-\\w_.0-9]+)\\s*\\((.*)\\)/\n @dependencies << [$1, $2]\n end\n end\n @dependencies\n end", "def requires\n []\n end", "def get_dependencies(_fidl, _interaction_types, _project_dependencies)\n # noop\n end", "def dependencies\n @dependencies ||= {}\n end", "def gem_requirements_from_array(what, array)\n array.map do |dep|\n Gem::Dependency.new(what, *dep)\n end\n end", "def dependencies\n @dependencies.values\n end", "def test_dependencies\n []\n end", "def test_dependencies\n []\n end", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def dependencies\n spec.dependencies\n end", "def dependencies\n spec.dependencies\n end", "def development_requirements\n requirements.select do |requirement|\n ! requirements.runtime?\n end\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def dependencies( names )\n names.each do |name|\n if calculation = fetch( name, nil )\n calculation.dependencies.each do |dependency|\n names << dependency unless names.include?( dependency )\n end\n end\n end\n end", "def dependencies\n self.config.depends || []\n end", "def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end", "def find_dependencies(env)\n args = [] if (env = env.dup).sub!(REGEXP_DEVPKG,'') # are we in compile mode?\n return [[], [], args] if args && env.empty?\n\n require 'rubygems/remote_fetcher'\n @@deps = YAML.load(fetch(env))['gems'] unless defined?(@@deps)\n @@deps.key?(spec.name) or return(args ? [[], [], args] : nil)\n\n # find dependencies\n case deps = @@deps[spec.name]\n when nil, \"*\" # for nil or '*', use the default extension name\n deps = [\"*\"]\n when String # string of space-delimited packages and extensions\n when Array # array of packages and extensions\n when Hash # hash of packages and extensions, indexed by version requirements\n reqs, deps = deps.find do |reqs, info| # deps is an array or space-delimited string\n Gem::Requirement.new(reqs.split(',')).satisfied_by?(spec.version)\n end\n reqs or return # can't find the right version\n deps ||= [\"*\"] # deps are nil, use the default extension name\n end\n deps = deps.strip.split(/\\s+/) if deps.is_a?(String)\n deps = deps.compact.uniq\n\n # helpful variables\n bcwd = Dir.pwd\n benv = File.dirname(env.split(/[?;#]/,2).first)\n name = \"#{spec.full_name}.tar.gz\"\n\n # grok dependencies\n pkgs, exts = [], []\n deps.each do |item|\n if item.include?(\"*\") || item =~ REGEXP_SCHEMA || item.include?(\".tar.gz\")\n exts << item unless args\n elsif item =~ REGEXP_DEVPKG\n pkgs << $' if args\n elsif item =~ REGEXP_DEVARG\n args << $' if args\n else\n pkgs << item unless args\n end\n end\n exts.map! do |item|\n case item\n when \"*\" then item = File.join(benv, name) # use complete default tarball name\n when /\\A\\*/ then item[0,1] = benv # path relative to env variable\n when /\\A[^\\/]/ then item[0,0] = bcwd + \"/\" # path relative to current directory\n end\n item.gsub(\"*\", name) # swap inline wildcards with default tarball name\n end\n [pkgs, exts, args]\n end", "def default_requires\n PackageList.new\n end" ]
[ "0.82321525", "0.79578096", "0.75243646", "0.7459049", "0.7419925", "0.738641", "0.7368803", "0.7304903", "0.7197358", "0.71410406", "0.7112839", "0.7101651", "0.7094307", "0.707949", "0.7051075", "0.70484984", "0.70274633", "0.6980552", "0.69775367", "0.6974392", "0.69534767", "0.68987197", "0.68961716", "0.6890766", "0.6888009", "0.6888009", "0.6876179", "0.67524797", "0.6738551", "0.6738551", "0.6725159", "0.6725159", "0.66935354", "0.66855425", "0.66855425", "0.66855425", "0.66855425", "0.6675236", "0.66605544", "0.66549164", "0.66549164", "0.66549164", "0.6639199", "0.6625573", "0.66253644", "0.6615284", "0.6575847", "0.6574669", "0.6557783", "0.6543456", "0.65434206", "0.6540218", "0.653661", "0.65248543", "0.65209466", "0.6520519", "0.64988273", "0.6471622", "0.6458794", "0.6451779", "0.6449743", "0.6419954", "0.64159197", "0.64120454", "0.6411365", "0.640191", "0.640191", "0.640191", "0.64011383", "0.6388807", "0.6388545", "0.6388373", "0.6384918", "0.63805866", "0.63665587", "0.63586587", "0.6324446", "0.6324326", "0.63227683", "0.63194966", "0.6314799", "0.63094735", "0.6308651", "0.6287619", "0.62636817", "0.6258703", "0.6255142", "0.6255142", "0.6252995", "0.6235387", "0.6235387", "0.6221336", "0.620555", "0.620555", "0.6203142", "0.6198662", "0.61950654", "0.6193285", "0.6161388", "0.6158312" ]
0.7832764
2
Return list of gem dev dependencies for which we have no corresponding requirements
def missing_dev_deps_for(gem) # Same note as in #missing_deps_for above gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def development_dependencies\n dependencies.select {|d| d.type == :development }\n end", "def development_requirements\n requirements.select do |requirement|\n ! requirements.runtime?\n end\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def dependencies\n []\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def required_dependencies\n dependencies - optional_dependencies\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def dependencies\n []\n end", "def excludes_dev_dep?(gem_name)\n excluded_dev_deps.any? { |d| d.name == gem_name }\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def dependent_specs\n runtime_dependencies.map {|dep| dep.to_specs }.flatten\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def dependencies\n []\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def dependencies_for(specification)\n []\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def dependencies\n EMPTY_SET\n end", "def remove_unused_dependencies\n # puts 'removing unused dependencies list.'\n dependencies = @target.dependencies\n dependencies.each do |dependency|\n dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name\n end\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def find_dependencies(env)\n args = [] if (env = env.dup).sub!(REGEXP_DEVPKG,'') # are we in compile mode?\n return [[], [], args] if args && env.empty?\n\n require 'rubygems/remote_fetcher'\n @@deps = YAML.load(fetch(env))['gems'] unless defined?(@@deps)\n @@deps.key?(spec.name) or return(args ? [[], [], args] : nil)\n\n # find dependencies\n case deps = @@deps[spec.name]\n when nil, \"*\" # for nil or '*', use the default extension name\n deps = [\"*\"]\n when String # string of space-delimited packages and extensions\n when Array # array of packages and extensions\n when Hash # hash of packages and extensions, indexed by version requirements\n reqs, deps = deps.find do |reqs, info| # deps is an array or space-delimited string\n Gem::Requirement.new(reqs.split(',')).satisfied_by?(spec.version)\n end\n reqs or return # can't find the right version\n deps ||= [\"*\"] # deps are nil, use the default extension name\n end\n deps = deps.strip.split(/\\s+/) if deps.is_a?(String)\n deps = deps.compact.uniq\n\n # helpful variables\n bcwd = Dir.pwd\n benv = File.dirname(env.split(/[?;#]/,2).first)\n name = \"#{spec.full_name}.tar.gz\"\n\n # grok dependencies\n pkgs, exts = [], []\n deps.each do |item|\n if item.include?(\"*\") || item =~ REGEXP_SCHEMA || item.include?(\".tar.gz\")\n exts << item unless args\n elsif item =~ REGEXP_DEVPKG\n pkgs << $' if args\n elsif item =~ REGEXP_DEVARG\n args << $' if args\n else\n pkgs << item unless args\n end\n end\n exts.map! do |item|\n case item\n when \"*\" then item = File.join(benv, name) # use complete default tarball name\n when /\\A\\*/ then item[0,1] = benv # path relative to env variable\n when /\\A[^\\/]/ then item[0,0] = bcwd + \"/\" # path relative to current directory\n end\n item.gsub(\"*\", name) # swap inline wildcards with default tarball name\n end\n [pkgs, exts, args]\n end", "def find_dependencies\n\t\tunless GEMDEPS_FILE.readable?\n\t\t\tself.prompt.warn \"Deps file (%s) is missing or unreadable, assuming no dependencies.\" %\n\t\t\t\t[ GEMDEPS_FILE ]\n\t\t\treturn []\n\t\tend\n\n\t\tfinder = Rake::DevEiate::GemDepFinder.new( GEMDEPS_FILE )\n\t\tfinder.load\n\t\treturn finder.dependencies\n\tend", "def runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)\n [dependency, constraint, current, constraint.include?(current)]\n end\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicts\n conflicts = {}\n self.runtime_dependencies.each do |dep|\n spec = Gem.loaded_specs[dep.name]\n if spec and not spec.satisfies_requirement? dep\n (conflicts[spec] ||= []) << dep\n end\n end\n env_req = Gem.env_requirement(name)\n (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version\n conflicts\n end", "def fetch_development_dependencies # :nodoc:\n end", "def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def dependent_modules\n out = [ ]\n @dependencies.each { |dependency| out << @module_set[dependency] }\n out\n end", "def find_non_local_dependencies(deps, verbose)\n search_list = Array(deps)\n seen = []\n ret = {}\n\n until search_list.empty?\n name, version = search_list.shift\n next if seen.include?(name)\n seen << name\n\n package_root = locate_local_package(name)\n if package_root\n pkg = BPM::Package.new(package_root)\n pkg.load_json\n\n unless satisfied_by?(version, pkg.version)\n raise LocalPackageConflictError.new(pkg.name, version, pkg.version)\n end\n\n search_list += Array(pkg.dependencies)\n search_list += Array(pkg.dependencies_development)\n search_list += Array(pkg.dependencies_build)\n else\n ret[name] = version\n end\n end\n\n ret\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def all_requires\n []\n end", "def all_requires\n []\n end", "def locked_specs_as_deps\n deps = @dependencies & @locked_deps\n\n @dependencies.each do |dep|\n next if deps.include?(dep)\n deps << dep if @locked_specs.any? { |s| s.satisfies?(dep) }\n end\n\n meta_deps = @locked_specs.for(deps).map do |s|\n dep = Gem::Dependency.new(s.name, s.version)\n @locked_deps.each do |d|\n dep.source = d.source if d.name == dep.name\n end\n dep\n end\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def dependencies\n to_a.reject { |a| a.filename.eql?(self.filename) }\n end", "def os_dependencies\n []\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def dependencies\n self.config.depends || []\n end", "def dependencies\n spec.dependencies\n end", "def dependencies\n spec.dependencies\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def legitimize! deps = entries\n specs = []\n\n deps.flatten.each do |dep|\n spec = case dep\n when Gem::Dependency then\n begin\n dep.to_spec\n rescue Gem::LoadError\n nil\n end\n when Isolate::Entry then\n dep.specification\n else\n raise \"unknown dep: #{dep.inspect}\"\n end\n\n if spec then\n specs.concat legitimize!(spec.runtime_dependencies)\n specs << spec\n end\n end\n\n specs.uniq\n end", "def requires\n require_items.collect(&:package)\n end", "def resolve_dependencies(dependencies)\n dependencies.inject([]) do |deps, dep|\n deps + dep.determine(:ubuntu, :precise).map do |pkg, version|\n !version.nil? ? \"#{pkg} (#{version})\" : pkg\n end\n end.join(', ')\n end", "def find_dependencies(deps=nil, verbose=false)\n \n deps ||= all_dependencies\n\n search_list = Array(deps)\n found = []\n ret = []\n \n # if we discover a new local package via indirect dependencies then\n # it's dependencies will be fetchable one time.\n fetchable = Set.new\n \n until search_list.empty?\n name, version = search_list.shift\n\n if dup = found.find{|p| p.name == name}\n # already found, check for conflicts\n next if satisfied_by?(version, dup.version)\n raise PackageConflictError.new(name, dup.version, version)\n end\n\n pkg = locate_package(name, version, verbose)\n if pkg.nil? && fetchable.include?(name)\n fetchable.reject! { |x| x == name }\n core_fetch_dependency(name, version, :runtime, true) \n pkg = locate_package name, version, verbose\n end\n \n raise PackageNotFoundError.new(name, version) unless pkg\n\n found << pkg\n\n # Look up dependencies of dependencies\n new_deps = Array(pkg.dependencies) + Array(pkg.dependencies_build)\n if has_local_package? pkg.name\n new_deps += Array(pkg.dependencies_development)\n new_deps.each { |dep| fetchable.add dep.first }\n end\n \n search_list += new_deps\n\n ret << pkg\n end\n\n ret\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def go_list_deps\n args = [\"-deps\"]\n args << \"-mod=vendor\" if config.dig(\"go\", \"mod\") == \"vendor\"\n\n # the CLI command returns packages in a pretty-printed JSON format but\n # not separated by commas. this gsub adds commas after all non-indented\n # \"}\" that close root level objects.\n # (?!\\z) uses negative lookahead to not match the final \"}\"\n deps = package_info_command(*args).gsub(/^}(?!\\z)$/m, \"},\")\n JSON.parse(\"[#{deps}]\")\n end", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def deps(pkg) # FIXME: \"*** PACKAGE MAY NOT BE DELETED *** \"\n if pkg.status != :available\n components = `#{@cmd} -n #{pkg.name}`.split(\"Requires:\\n\")\n if components.size > 1\n return components[1].strip\n else\n return \"[No depends]\"\n end\n else\n if File.exist?(File.expand_path(\"~/Library/Application Support/Guigna/pkgsrc/INDEX\"))\n # TODO: parse INDEX\n end\n \"[Not available]\"\n end\n end", "def dependencies\n @dependencies ||= ElmPackage.dependencies 'elm-package.json',\n silent: false\n end", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def initial_dependencies\n []\n end", "def dependencies_for(specification)\n specification.dependencies\n end", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def requirements\n []\n end", "def test_dependencies\n []\n end", "def test_dependencies\n []\n end", "def released_specs\n specs.select { |s| not s.prerelease? }\n end", "def sorted_deps\n dep_names = (dependencies.keys + dependencies_development.keys).uniq\n ret = []\n\n dep_names.each do |dep_name|\n dep = local_deps.find { |x| x.name == dep_name }\n add_sorted_dep(dep, local_deps, :both, ret)\n end\n ret\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def validate_dependencies # :nodoc:\n warning_messages = []\n @specification.dependencies.each do |dep|\n prerelease_dep = dep.requirements_list.any? do |req|\n Gem::Requirement.new(req).prerelease?\n end\n\n warning_messages << \"prerelease dependency on #{dep} is not recommended\" if\n prerelease_dep && !@specification.version.prerelease?\n\n open_ended = dep.requirement.requirements.all? do |op, version|\n not version.prerelease? and (op == '>' or op == '>=')\n end\n\n if open_ended\n op, dep_version = dep.requirement.requirements.first\n\n segments = dep_version.segments\n\n base = segments.first 2\n\n recommendation = if (op == '>' || op == '>=') && segments == [0]\n \" use a bounded requirement, such as '~> x.y'\"\n else\n bugfix = if op == '>'\n \", '> #{dep_version}'\"\n elsif op == '>=' and base != segments\n \", '>= #{dep_version}'\"\n end\n\n \" if #{dep.name} is semantically versioned, use:\\n\" \\\n \" add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}\"\n end\n\n warning_messages << [\"open-ended dependency on #{dep} is not recommended\", recommendation].join(\"\\n\") + \"\\n\"\n end\n end\n if warning_messages.any?\n warning_messages.each {|warning_message| warning warning_message }\n end\n end", "def partition_dependencies(dependencies, gem_dir)\n system_specs, local_specs, missing_deps = [], [], []\n if gem_dir && File.directory?(gem_dir)\n gem_dir = File.expand_path(gem_dir)\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n local = gemspecs.reverse.find { |s| s.loaded_from.index(gem_dir) == 0 }\n if local\n local_specs << local\n elsif gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n ::Gem.clear_paths\n else\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n if gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n end\n [system_specs, local_specs, missing_deps]\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def vendor(dependencies)\n return nil if dependencies.nil? || dependencies.empty?\n @dep_list = Resolver.resolve(dependencies, @cache, @cwd, @backend)\n end", "def dependency_list\n @target.dependencies.map(&:display_name)\n end", "def dependencies\n @dependencies.values\n end" ]
[ "0.79816246", "0.78688914", "0.78491455", "0.7745773", "0.7578879", "0.73604", "0.72868645", "0.72283745", "0.7206016", "0.7172765", "0.70921886", "0.7020585", "0.69456106", "0.69325477", "0.68998003", "0.68712646", "0.6856421", "0.6848235", "0.6844712", "0.67837274", "0.6782934", "0.6780018", "0.6772635", "0.6770956", "0.67684656", "0.6765088", "0.6744458", "0.6744458", "0.67393434", "0.67389786", "0.67389786", "0.67267007", "0.67230266", "0.66932535", "0.6681673", "0.6594984", "0.6584934", "0.6547515", "0.6536563", "0.65017444", "0.6479084", "0.6479084", "0.6479084", "0.6477941", "0.64669675", "0.64669675", "0.64669675", "0.64544106", "0.64445966", "0.6408611", "0.639406", "0.63730884", "0.6369519", "0.6369519", "0.6369519", "0.6369519", "0.63689256", "0.6366368", "0.63644797", "0.6349401", "0.6349401", "0.6347863", "0.63433397", "0.63432527", "0.6325242", "0.6320491", "0.6314503", "0.63093907", "0.6298663", "0.6281807", "0.6281807", "0.6269384", "0.6262543", "0.62490267", "0.62473565", "0.6237184", "0.6236816", "0.62262183", "0.6224601", "0.6217745", "0.6210235", "0.6209372", "0.62043715", "0.6203573", "0.6197944", "0.61976254", "0.6196736", "0.6181151", "0.61755705", "0.6173803", "0.6173803", "0.61734986", "0.61635405", "0.61596465", "0.61569095", "0.6138598", "0.61280173", "0.61279345", "0.6100513", "0.6090316" ]
0.8326318
0
Return list of dependencies of upstream gem which have not been included
def excluded_deps missing_deps_for(upstream_gem) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def dependencies\n []\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def remove_unused_dependencies\n # puts 'removing unused dependencies list.'\n dependencies = @target.dependencies\n dependencies.each do |dependency|\n dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name\n end\n end", "def dependencies\n []\n end", "def dependencies\n []\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def dependencies\n to_a.reject { |a| a.filename.eql?(self.filename) }\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def required_dependencies\n dependencies - optional_dependencies\n end", "def dependent_modules\n out = [ ]\n @dependencies.each { |dependency| out << @module_set[dependency] }\n out\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def excluded_files\n # TODO: also append files marked as %{exclude} (or handle elsewhere?)\n missing_files_for(upstream_gem)\n end", "def dependencies\n @dependencies ||= []\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def dependencies\n EMPTY_SET\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)\n [dependency, constraint, current, constraint.include?(current)]\n end\n end", "def dependencies_for(specification)\n []\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def reverse_dependencies(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.dependencies.any? {|e| e.name == rubygem && e.type == :runtime}}.\n map {|e| \"#{e.name}-#{e.version}\" }\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def test_dependencies\n []\n end", "def test_dependencies\n []\n end", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def dependencies\n self.config.depends || []\n end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def dependencies\n @dependencies ||= Set.new\n end", "def referenced_libraries\n # TODO: check content type before scanning\n content.scan(%r{\\s*needs\\s+[\\\"\\'](.+)/(.+)[\\\"\\']}).map { |a, b| a + '/' + b }.uniq\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def walk_down_dependencies(pkg_name, known_deps=Array.new)\n\talldeps = Array.new\n\t@total_deps[pkg_name].each { |m|\n\t\tunless alldeps.include?(m) || m.nil? || known_deps.include?(m) \n\t\t\talldeps = alldeps + walk_down_dependencies(m, alldeps)\n\t\tend\n\t\talldeps.push m\n\t}\n\talldeps.uniq!\n\talldeps.push pkg_name\n\t# puts alldeps.join(\", \") \n\treturn alldeps.compact \nend", "def initial_dependencies\n []\n end", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def dependencies(include_parent = false)\n include_parent ? [ parent ] : []\n end", "def dependency_list\n @target.dependencies.map(&:display_name)\n end", "def uppper_depends(task_name)\n task_list = []\n @tasks.each { |t|\n if not t.dependency.nil? then\n task_list.push(t) if t.dependency.include?(task_name)\n end\n }\n task_list\n end", "def resolve_dependencies(dependencies)\n dependencies.inject([]) do |deps, dep|\n deps + dep.determine(:ubuntu, :precise).map do |pkg, version|\n !version.nil? ? \"#{pkg} (#{version})\" : pkg\n end\n end.join(', ')\n end", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def local_deps\n @local_deps ||= build_local_dependency_list\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def dependencies(path)\r\n deps = []\r\n open(path) do |file|\r\n deps = file.read.scan(/ [^\\s|\\\\]+/).collect { |s| s.strip }\r\n end\r\n deps.reject!{|s| s.include?(\"/opt\") || s.include?(\"/usr\") || s.include?(\"include/boost\")}\r\n deps\r\nend", "def package_depends_on\n depends_on\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def os_dependencies\n []\n end", "def find_non_local_dependencies(deps, verbose)\n search_list = Array(deps)\n seen = []\n ret = {}\n\n until search_list.empty?\n name, version = search_list.shift\n next if seen.include?(name)\n seen << name\n\n package_root = locate_local_package(name)\n if package_root\n pkg = BPM::Package.new(package_root)\n pkg.load_json\n\n unless satisfied_by?(version, pkg.version)\n raise LocalPackageConflictError.new(pkg.name, version, pkg.version)\n end\n\n search_list += Array(pkg.dependencies)\n search_list += Array(pkg.dependencies_development)\n search_list += Array(pkg.dependencies_build)\n else\n ret[name] = version\n end\n end\n\n ret\n end", "def runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def dependencies\n spec.dependencies\n end", "def dependencies\n spec.dependencies\n end", "def extra_gem_files(gem = nil)\n gem ||= upstream_gem\n pkg_extra = {}\n pkg_files.each do |pkg, files|\n extra = files.select { |spec_file| !gem.has_file_satisfied_by?(spec_file) }\n pkg_extra[pkg] = extra unless extra.empty?\n end\n pkg_extra\n end", "def locked_specs_as_deps\n deps = @dependencies & @locked_deps\n\n @dependencies.each do |dep|\n next if deps.include?(dep)\n deps << dep if @locked_specs.any? { |s| s.satisfies?(dep) }\n end\n\n meta_deps = @locked_specs.for(deps).map do |s|\n dep = Gem::Dependency.new(s.name, s.version)\n @locked_deps.each do |d|\n dep.source = d.source if d.name == dep.name\n end\n dep\n end\n end", "def dependent_specs\n runtime_dependencies.map {|dep| dep.to_specs }.flatten\n end", "def dependencies\n @dependencies\n end", "def dependencies(pkg)\n pkg.resolve_optional_dependencies\n deps_rock_packages = pkg.dependencies.map do |pkg_name|\n debian_name(Autoproj.manifest.package(pkg_name).autobuild)\n end.sort\n\n pkg_osdeps = Autoproj.osdeps.resolve_os_dependencies(pkg.os_packages)\n # There are limitations regarding handling packages with native dependencies\n #\n # Currently gems need to converted into debs using gem2deb\n # These deps dependencies are updated here before uploading a package\n # \n # Generation of the debian packages from the gems can be done in postprocessing step\n # i.e. see convert_gems\n \n deps_osdeps_packages = []\n native_package_manager = Autoproj.osdeps.os_package_handler\n _, native_pkg_list = pkg_osdeps.find { |handler, _| handler == native_package_manager }\n\n deps_osdeps_packages += native_pkg_list if native_pkg_list\n\n # Update global list\n @osdeps += deps_osdeps_packages\n\n non_native_handlers = pkg_osdeps.collect do |handler, pkg_list|\n if handler != native_package_manager\n [handler, pkg_list]\n end\n end.compact\n\n non_native_handlers.each do |pkg_handler, pkg_list|\n # Convert native ruby gems package names to rock-xxx \n if pkg_handler.kind_of?(Autoproj::PackageManagers::GemManager)\n pkg_list.each do |name,version|\n @ruby_gems << [name,version]\n deps_osdeps_packages << debian_ruby_name(name)\n end\n else\n raise ArgumentError, \"cannot package #{pkg.name} as it has non-native dependencies (#{pkg_list}) -- #{pkg_handler.class} #{pkg_handler}\"\n end\n end\n\n # Remove duplicates\n @osdeps.uniq!\n @ruby_gems.uniq!\n\n # Return rock packages and osdeps\n [deps_rock_packages, deps_osdeps_packages]\n end", "def development_dependencies\n dependencies.select {|d| d.type == :development }\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def getDeps csproj\r\n deps = []\r\n csproj.search(\"reference\") do |ref|\r\n deps << ref.get_attribute(\"include\").match(/^([^,]+),*/)[1]\r\n end\r\n return deps\r\nend", "def dependencies\n @dependencies.values\n end", "def dependencies\n return @dependencies unless @dependencies.nil?\n @dependencies = [ ]\n lockfile.each_line do |line|\n if line =~ /^\\s{4}([-\\w_.0-9]+)\\s*\\((.*)\\)/\n @dependencies << [$1, $2]\n end\n end\n @dependencies\n end", "def unloaded_libraries\n (Boson::BareRunner.all_libraries - Boson.libraries.map {|e| e.name }).sort\n end", "def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end", "def find_reverse_dependencies(spec, srcindex)\n result = []\n srcindex.each do |name, sp|\n sp.dependencies.each do |dep|\n if spec.name == dep.name &&\n dep.version_requirements.satisfied_by?(spec.version)\n result << [sp.full_name, dep]\n end\n end\n end\n result\n end", "def getDependencies service\r\n deps = []\r\n Util.csprojs(service).each do |csproj|\r\n deps += getDeps(csproj) \r\n end\r\n return deps.uniq\r\nend", "def dependencies\n\t\t0\n\tend", "def dependencies\n @target_dependencies + (@parent ? @parent.dependencies : [])\n end", "def direct_dependencies; end", "def grow_dependencies nunjucks_file\n nunjucks = File.read nunjucks_file\n liquid_dependencies = nunjucks.scan(INCLUDE_TAG).flatten.map &method(:nunjucks_to_liquid)\n [TRANSPILER_MODULES_DIR, nunjucks_file].concat liquid_dependencies\n end", "def prune_dependencies\n class_names = @classes.map {|klass| klass.name}\n @classes.each do |klass|\n klass.dependencies = klass.dependencies.uniq.keep_if {|dep| class_names.include?(dep)}\n end\n end", "def dependencies\n @dependencies ||= {}\n end", "def dependencies(name)\n dependencies = []\n submodule = submodule(name)\n if submodule.has_key?(:dependencies)\n submodule[:dependencies].each do |dependency|\n dependencies << dependency\n dependencies << dependencies(dependency)\n end\n end\n\n dependencies.flatten.uniq.sort\n end", "def fetch_development_dependencies # :nodoc:\n end", "def no_nuget_dependencies\n @nuget_dependencies = false\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end" ]
[ "0.7707541", "0.7599393", "0.70768607", "0.70239794", "0.6968882", "0.69328785", "0.69328785", "0.69328785", "0.69294703", "0.68707", "0.6860442", "0.6828495", "0.681813", "0.6806439", "0.67656416", "0.67144835", "0.66742456", "0.66441727", "0.66212255", "0.6603637", "0.65846986", "0.65455544", "0.6529019", "0.6495975", "0.648951", "0.64552224", "0.64388496", "0.64214015", "0.6411827", "0.6406085", "0.6406085", "0.6406085", "0.6382277", "0.63768166", "0.63768166", "0.637449", "0.637449", "0.637449", "0.637449", "0.63559586", "0.6341751", "0.63361764", "0.63345164", "0.63134724", "0.6311164", "0.6311164", "0.62992877", "0.62714773", "0.62642145", "0.62639207", "0.6259526", "0.62430656", "0.62366015", "0.62366015", "0.622466", "0.6221171", "0.6214262", "0.62107825", "0.6209473", "0.62090653", "0.62076646", "0.61922246", "0.6167135", "0.6158291", "0.6154668", "0.6154668", "0.61422074", "0.6140452", "0.6120324", "0.61180454", "0.6107802", "0.61008346", "0.61005133", "0.6100414", "0.60942817", "0.60942817", "0.6092457", "0.60777193", "0.60726595", "0.6068902", "0.60665786", "0.6064468", "0.605745", "0.6051186", "0.60471696", "0.604575", "0.60299027", "0.602028", "0.6007527", "0.6007293", "0.60057336", "0.60009474", "0.6000028", "0.5998777", "0.59919006", "0.5990093", "0.5989079", "0.5980388", "0.5975173", "0.5948064" ]
0.8343008
0
Return boolean indicating if the specified gem is on excluded list
def excludes_dep?(gem_name) excluded_deps.any? { |d| d.name == gem_name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def excludes_dev_dep?(gem_name)\n excluded_dev_deps.any? { |d| d.name == gem_name }\n end", "def excluded?(site, name)\r\n @config['exclude'].include? name\r\n end", "def exclude?(production)\n !include?(production)\n end", "def excluded_in_manifest?(package_name)\n package_name = validate_package_name_argument(package_name)\n manifest_exclusions.any? do |matcher|\n if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)\n true\n else\n Regexp.new(matcher) === package_name\n end\n end\n end", "def excluded?(package_name)\n package_name = validate_package_name_argument(package_name)\n\n if !explicitely_selected_in_layout?(package_name) && excluded_in_manifest?(package_name)\n true\n elsif automatic_exclusions.any? { |pkg_name,| pkg_name == package_name }\n true\n else\n false\n end\n end", "def auto_exclude?\n @auto_exclude\n end", "def feature_excluded?(file)\n !file.start_with?(Padrino.root) || exclude.any?{ |excluded_path| file.start_with?(excluded_path) }\n end", "def exclude?\n self.exclude == true || self.class.excluded_accounts.include?(self.account_number)\n end", "def ignore?(pkg)\n ignores.include?(pkg)\n end", "def gem_listed?(gem)\n lockfile_specs.map(&:name).include? gem\n end", "def excluded?(project_name)\n @excluded_projects.has_key?(project_name)\n end", "def excluded?(path)\n\t\t\t@excludes.each do |exclusion|\n\t\t\t\tif path.match(exclusion)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn false\n\t\tend", "def disabled?\n super || !gemfile.exist?\n end", "def disabled?(*components)\n components.all? { |c| disabled_components.include?(c) }\n end", "def disabled?(*components)\n components.all? { |c| disabled_components.include?(c) }\n end", "def excludes_file?(file)\n excluded_files.include?(file)\n end", "def excludes\n @excludes ||= []\n end", "def excluded_file?(file_path)\n excluded_files.include? file_path\n end", "def exclude?(table)\n @excludes.each do |excl|\n return true if table.apprmatch(excl)\n end\n return false\n end", "def excluded?(path)\n strings = EXCLUDES.select { |item| item.class == String }\n regexps = EXCLUDES.select { |item| item.class == Regexp }\n excluded = strings.include? path\n regexps.each do |pattern|\n excluded = true if path =~ pattern\n end\n return excluded\nend", "def excluded\n return [] if directory.empty? || directory == '*'\n @excluded ||= process_exclusions(@raw_data['exclude'])\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def excluded?(url)\n url = safe_unescape(url)\n @skip_list.each do |entry|\n return entry.last if url.include? entry.first\n return entry.last if entry.first == NULL_MATCH\n end\n\n false\n end", "def disabled_plugins\n plugins.find_all do |pd|\n @disabled_plugins.include?(pd.name) &&\n derivative_plugins_for(pd).all? {|der| @disabled_plugins.include? der.name}\n end\n end", "def mailbox_excluded?(name)\n name = name.downcase\n \n Larch.exclude.each do |e|\n return true if (e.is_a?(Regexp) ? !!(name =~ e) : File.fnmatch?(e, name))\n end\n\n return false\n end", "def excludes?(path)\n excludes.any? {|f| path[-(f.size+1)..-1] == \"/#{f}\" }\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def exclude_groups\n @exclude_groups ||= begin\n exclude = Array(config.dig(\"bundler\", \"without\"))\n exclude = DEFAULT_WITHOUT_GROUPS if exclude.empty?\n exclude.uniq.map(&:to_sym)\n end\n end", "def should_be_excluded(potential_matches, exclude_paths)\n potential_matches.each do |potential_match|\n if exclude_paths.any? { |pattern| potential_match.match(/#{pattern}/i) }\n return true\n end\n end\n false\nend", "def plugin_disabled?(plugin)\n site.disabled_plugins.find do |p|\n p.gsub(/_/, '').downcase == plugin.class.name.gsub(/_/, '').downcase\n end\n end", "def excluded_files\n # TODO: also append files marked as %{exclude} (or handle elsewhere?)\n missing_files_for(upstream_gem)\n end", "def in_excluded_files(filename)\n unless @options[:exclude].nil? || @excluded_files.empty?\n @excluded_files.each do |excluded_file|\n return true if filename.eql? \"#{excluded_file}\"\n end\n false\n end\n false\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name(full_name)\n siblings = @specs.find_all { |s|\n\ts.name == gem_to_remove.name &&\n\t s.full_name != gem_to_remove.full_name\t\n }\n deps = []\n @specs.each do |spec|\n\tspec.dependencies.each do |dep|\n\t deps << dep if gem_to_remove.satisfies_requirement?(dep)\n\tend\n end\n deps.all? { |dep|\n\tsiblings.any? { |s| \n\t s.satisfies_requirement?(dep)\n\t}\n }\n end", "def is_excluded_path?( path )\n\t\trval = self.plugin_exclusions.find do |exclusion|\n\t\t\tcase exclusion\n\t\t\twhen Regexp\n\t\t\t\tpath =~ exclusion\n\t\t\twhen String\n\t\t\t\tflags = 0\n\t\t\t\tflags &= File::FNM_EXTGLOB if defined?( File::FNM_EXTGLOB )\n\t\t\t\tFile.fnmatch( exclusion, path, flags )\n\t\t\telse\n\t\t\t\tPluggability.log.warn \"Don't know how to apply exclusion: %p\" % [ exclusion ]\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\n\t\tif rval\n\t\t\tPluggability.log.debug \"load path %p is excluded by %p\" % [ path, rval ]\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def not_on(*architectures)\n architectures = architectures.map do |name|\n if name.respond_to?(:to_str)\n [name]\n else name\n end\n end\n\n os_names, os_versions = Autoproj.workspace.operating_system\n matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }\n if matching_archs.empty?\n return yield\n elsif matching_archs.all? { |arch| arch[1] && !os_versions.include?(arch[1].downcase) }\n return yield\n end\n\n # Simply get the current list of packages, yield the block, and exclude all\n # packages that have been added\n current_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set\n yield\n new_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set -\n current_packages\n\n new_packages.each do |pkg_name|\n Autoproj.workspace.manifest.add_exclusion(pkg_name, \"#{pkg_name} is disabled on this operating system\")\n end\nend", "def gem_should_be_checked?(gem_name)\n gem_name.index('barkest_') == 0\n end", "def check_if_work_dir_excluded\n File.open('.git/info/exclude').each_line.any? do |line|\n line ==\"#{work_dir(true)}\\n\"\n end\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name full_name\n\n siblings = @specs.find_all { |s|\n s.name == gem_to_remove.name &&\n s.full_name != gem_to_remove.full_name\n }\n\n deps = []\n\n @specs.each do |spec|\n spec.dependencies.each do |dep|\n deps << dep if gem_to_remove.satisfies_requirement?(dep)\n end\n end\n\n deps.all? { |dep|\n siblings.any? { |s|\n s.satisfies_requirement? dep\n }\n }\n end", "def exclude?(object)\n !include? object\n end", "def exclusion_reason(package_name)\n package_name = validate_package_name_argument(package_name)\n if (message = automatic_exclusions[package_name])\n return message\n end\n\n unless explicitely_selected_in_layout?(package_name)\n manifest_exclusions.each do |matcher|\n if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)\n return \"#{pkg_set.name} is a metapackage listed in the exclude_packages section of the manifest, and it includes #{package_name}\"\n elsif Regexp.new(matcher) === package_name\n return \"#{package_name} is listed in the exclude_packages section of the manifest\"\n end\n end\n end\n nil\n end", "def tags_condition_for_exclude(tags)\n used_alias = \"used_#{Tag.table_name}\"\n return \"\n #{table_name}.id NOT IN\n (SELECT #{Tagging.table_name}.taggable_id FROM #{Tagging.table_name}\n INNER JOIN #{Tag.table_name} AS #{used_alias}\n ON #{Tagging.table_name}.tag_id = #{used_alias}.id\n WHERE #{tags_condition(tags, used_alias)} AND #{Tagging.table_name}.taggable_type = #{quote_value(base_class.name)})\n \"\n end", "def not_include?(element)\n !include?(element)\n end", "def excluded_from_list?(fn)\n return true if @exclude_patterns.any? do |pat|\n case pat\n when Regexp\n fn =~ pat\n when GLOB_PATTERN\n flags = File::FNM_PATHNAME\n # Ruby <= 1.9.3 does not support File::FNM_EXTGLOB\n flags |= File::FNM_EXTGLOB if defined? File::FNM_EXTGLOB\n File.fnmatch?(pat, fn, flags)\n else\n fn == pat\n end\n end\n @exclude_procs.any? { |p| p.call(fn) }\n end", "def auto_exclude\n self.exclude ||= true if !!(address.to_s.match(/p\\.?\\s?o\\.?\\sbox/i)) || # PO Boxes\n !!(self.del_flag.to_s.match(/\\W/)) ||\n !!(self.del_block.to_s.match(/\\W/)) ||\n !!(self.order_block.to_s.match(/\\W/)) ||\n #account_number.split(/\\-/).first.to_i > 700000 || # distributors, internal accounts\n marked_for_deletion? || # those which have deleted-type words in the name\n self.class.excluded_accounts.include?(self.account_number) # those which are flagged in the yaml file\n end", "def excluded; end", "def not_include?(element)\n !self.include?(element)\n end", "def exclude_opts\n excludes.map { |exclude_pattern|\n \"--exclude='#{exclude_pattern}'\"\n }.join(' ')\n end", "def disabled?(thing)\n !enabled?(thing)\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def excluded?(type)\n return true if $local_only && !$local_types.include?(type.raw_type)\n $exclude.each do |prefix|\n return true if type.qualified_name.index(prefix) == 0\n end\n false\nend", "def exclude\n @_exclude ||= Set.new %w(test spec tmp features config public db).map{ |path| Padrino.root(path) }\n end", "def exclude_package(package_name, reason)\n package = validate_package_name_argument(\n package_name, require_existing: false\n )\n if (meta = find_metapackage(package))\n meta.each_package do |pkg|\n automatic_exclusions[pkg.name] =\n \"#{meta.name} is an excluded metapackage, \"\\\n \"and it includes #{pkg.name}: #{reason}\"\n end\n else\n automatic_exclusions[package] = reason\n end\n end", "def optimized_gems\n optimized_gems = @gems.reject { |gem| @redundant_gems.include? gem }\n optimized_gems.empty? ? false : optimized_gems.uniq.sort\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def supplies_excluding_tax\n self.supplies.select{|p| not p[:including_tax]}\n end", "def ignore?\n @should_ignore\n end", "def disable!\n\n @enabled = false\n \n @gems_or_gemsets.each do |this_gem_or_gemset, true_value|\n this_gem_or_gemset.disable!\n end\n \n return self\n \n end", "def is_excluded(date)\n return false if @schedule.days_exclude == 0\n\n days_bitmask_exclude = bitmask(@schedule.days_exclude)\n if @schedule.days_month == 'specific' || (@schedule.days_month != 'specific' && @schedule.days_month_day == nil)\n day_idx = (date.wday) % 7\n else\n day_idx = date.day\n end\n\n return days_bitmask_exclude[day_idx] == '1'\n end", "def ensure_exclude_option_array_exists\n @hash['exclude'] = Array(@hash['exclude'])\n end", "def disabled?\n Support.new(ENV, verbose: verbose).disabled?\n end", "def exclude?(fn)\n calculate_exclude_regexp unless @exclude_re\n fn =~ @exclude_re\n end", "def exclude?(fn)\n calculate_exclude_regexp unless @exclude_re\n fn =~ @exclude_re\n end", "def export_exclude_tags\n return Array.new unless @in_buffer_settings[\"EXPORT_EXCLUDE_TAGS\"]\n @in_buffer_settings[\"EXPORT_EXCLUDE_TAGS\"].split\n end", "def installed?(gem_name)\n !run('list', '|', 'grep', \"' #{gem_name} '\").empty?\n end", "def each_excluded_package\n return enum_for(__method__) unless block_given?\n\n each_autobuild_package do |pkg|\n yield(pkg) if excluded?(pkg.name)\n end\n end", "def excluded?(file)\n file = File.join(Dir.pwd, file) unless file.start_with?('/')\n Codeqa.configuration.excludes.any?{ |pattern| match_path?(pattern, file) }\n end", "def candidates_exist_for_all_uninstalled?\n packages_missing_candidates.empty?\n end", "def plugin_exclusions( *exclusions )\n\t\t@plugin_exclusions.replace( exclusions ) if !exclusions.empty?\n\t\treturn @plugin_exclusions\n\tend", "def excluded_files() = []", "def ignored?\n @ignored\n end", "def excluded_trackers\n Tracker.select(:id)\n .where(\n \"#{Tracker.table_name}.id IN (?) OR #{Tracker.table_name}.fields_bits & ?\",\n RedmineWbs.excluded_tracker_ids,\n RedmineWbs.required_core_field_bits\n )\n end", "def excluded_spec_files\r\n # NOTE, testing only for faster develping agent, remove a couple of test later\r\n [\"selected_scripts_spec.rb\", \"03_passenger_spec.rb\"]\r\nend", "def user_agent_excluded?\n request.user_agent.to_s.downcase =~ Regexp.union([self.mobylette_options[:skip_user_agents]].flatten.map(&:to_s))\n end", "def exclude_files(list, excluded)\n list.reject { |entry| excluded.any? { |f| File.identical?(f, entry) }}\n end", "def exclude_files(list, excluded)\n list.reject { |entry| excluded.any? { |f| File.identical?(f, entry) }}\n end", "def exclude(project_list)\n project_list.each { |p| @excluded_projects[p] = true }\n end", "def disabled_components\n Merb::Config[:disabled_components] ||= []\n end", "def disabled_components\n Merb::Config[:disabled_components] ||= []\n end", "def gem?\n @gem\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def exclude?(excludes, path)\n excludes.any? do |ex|\n if ex.is_a?(String)\n File.fnmatch?(ex, path)\n elsif ex.is_a?(Regexp)\n ex.match(path)\n end\n end\n end", "def excluded?(index) # :nodoc:\n all_excluded_words.include?(words[index])\n end", "def gemspec?\n !gemspecs.empty?\n end", "def vendor?\n !vendor.empty?\n end", "def excluded_spec_files\r\n # NOTE, testing only for faster develping agent, remove a couple of test later\r\n [\"selected_scripts_spec.rb\", \"passenger_spec.rb\"]\r\nend", "def excluded_elements(used_elements)\n excluded = used_elements\n if exclude_dependent?\n excluded += used_elements.inject([]) {|m, elem| m += elem.dependencies; m}.flatten\n end\n excluded\n end", "def in_all_gemsets_but_global?(gemsets)\n in_all_gemsets = false\n remaining = gemsets - @gemsets_containing\n (remaining.empty? or remaining == ['default']) and (not gemsets.include? 'global')\n end", "def exclude(f, ex)\n\treturn false if ex.empty?\n\tex.each { |d|\t\treturn true if File.fnmatch(d,File.basename(f) )}\n\tfalse\nend", "def ignored?\n !!ignored\n end", "def provision_group_exclusion\n @attributes[:provision_group_exclusion]\n end", "def exclude_js?\n options.include?( :exclude_js ) && ( options[:exclude_js] == 'true' || options[:exclude_js] == true )\n end", "def exclude_path?(path)\n !!((@exclude_paths || []).find do |excluded|\n !!excluded.match(path)\n end)\n end", "def excluded_file?(file)\n full_path = File.expand_path(file)\n options.fetch(:excluded_files) { [] }.any? do |file_to_exclude|\n File.fnmatch(file_to_exclude, full_path)\n end\n end", "def possibly_include_hidden?\n return @possibly_include_hidden if defined?(@possibly_include_hidden)\n\n @possibly_include_hidden = patterns_to_include.any? do |s|\n s.is_a?(Regexp) || s.start_with?('.') || s.include?('/.')\n end\n end", "def possibly_include_hidden?\n return @possibly_include_hidden if defined?(@possibly_include_hidden)\n\n @possibly_include_hidden = patterns_to_include.any? do |s|\n s.is_a?(Regexp) || s.start_with?('.') || s.include?('/.')\n end\n end", "def exclude_dir\n @exclude_dirs.map { |p| Pathname.new(path) + p }.select(&:exist?)\n end", "def excluded_spec_files\n # NOTE, testing only for faster develping agent, remove a couple of test later\n [\"selected_scripts_spec.rb\", \"passenger_spec.rb\"]\nend", "def is_unused?(dir)\n status = true\n\n path = Dir.glob(File.join(dir, \"*\"))\n path.each do |dirorfile|\n status = false if File.directory?(dirorfile)\n status = false if File.basename(dirorfile) =~ /\\.deb$/\n end\n\n status\n end", "def missing_extensions?\n return false if extensions.empty?\n return false if default_gem?\n return false if File.exist? gem_build_complete_path\n\n true\n end", "def find_specs_without_tasks\n spec_file_names.reject do |spec|\n manifest = Noop::Utils.convert_to_manifest spec\n task_file_names.include? manifest\n end\n end" ]
[ "0.7045999", "0.6904349", "0.6822704", "0.667933", "0.6662879", "0.6545669", "0.6529984", "0.64999", "0.64977205", "0.6469012", "0.642258", "0.64008135", "0.6369375", "0.6261711", "0.6261711", "0.6188836", "0.6170802", "0.61677164", "0.6158755", "0.6079697", "0.60613596", "0.6024651", "0.6005403", "0.60024405", "0.59789956", "0.59574115", "0.5942032", "0.5939448", "0.59335566", "0.5930745", "0.5914406", "0.5914213", "0.5911558", "0.5908211", "0.59023476", "0.5890944", "0.5877758", "0.5871724", "0.58711445", "0.58555657", "0.584731", "0.5843969", "0.581999", "0.5817465", "0.5812097", "0.58013886", "0.58013284", "0.5784708", "0.578286", "0.5776825", "0.5774888", "0.57677454", "0.57640815", "0.5762571", "0.57607895", "0.5755359", "0.5737473", "0.5733392", "0.57326615", "0.57305145", "0.5730043", "0.5726659", "0.5723828", "0.5703554", "0.57020473", "0.5689702", "0.5687758", "0.5685364", "0.568423", "0.56802183", "0.56767994", "0.5674832", "0.56668", "0.56646305", "0.56646305", "0.5657202", "0.56558585", "0.56547266", "0.5654556", "0.5642924", "0.5641757", "0.5640447", "0.56380486", "0.56242996", "0.5623987", "0.5618136", "0.5615206", "0.5614652", "0.56137544", "0.56077427", "0.56067723", "0.56031406", "0.56004673", "0.5597506", "0.5597506", "0.55958205", "0.55744386", "0.557352", "0.5555595", "0.5548996" ]
0.76878726
0
Return list of dev dependencies of upstream gem which have not been included
def excluded_dev_deps missing_dev_deps_for(upstream_gem) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def development_dependencies\n dependencies.select {|d| d.type == :development }\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def excludes_dev_dep?(gem_name)\n excluded_dev_deps.any? { |d| d.name == gem_name }\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def remove_unused_dependencies\n # puts 'removing unused dependencies list.'\n dependencies = @target.dependencies\n dependencies.each do |dependency|\n dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name\n end\n end", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def fetch_development_dependencies # :nodoc:\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies\n []\n end", "def dependencies\n []\n end", "def dependencies\n []\n end", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def development_requirements\n requirements.select do |requirement|\n ! requirements.runtime?\n end\n end", "def dependent_modules\n out = [ ]\n @dependencies.each { |dependency| out << @module_set[dependency] }\n out\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def dependencies\n to_a.reject { |a| a.filename.eql?(self.filename) }\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def dependencies\n self.config.depends || []\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def dependent_specs\n runtime_dependencies.map {|dep| dep.to_specs }.flatten\n end", "def excluded_files\n # TODO: also append files marked as %{exclude} (or handle elsewhere?)\n missing_files_for(upstream_gem)\n end", "def required_dependencies\n dependencies - optional_dependencies\n end", "def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)\n [dependency, constraint, current, constraint.include?(current)]\n end\n end", "def local_deps\n @local_deps ||= build_local_dependency_list\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def dev_gems\n\n # Dev mode has to explicitly include every needed gem dependency in the project in order to\n # be properly (i.e. recursively) loaded from source by Bundler\n gem 'task_runner', :path => 'gems/task_runner'\n gem 'tef-worker', :path => 'gems/tef-worker'\n gem 'tef-core', :path => 'gems/tef-core'\n gem 'res_man', git: 'https://github.com/grange-insurance/res_man.git', branch: 'master'\n gem 'tef-manager', :path => 'gems/tef-manager'\n gem 'tef-keeper', :path => 'gems/tef-keeper'\n gem 'tef', :path => '.'\n gem 'tef-development', :path => 'gems/tef-development'\nend", "def dependencies\n EMPTY_SET\n end", "def test_dependencies\n []\n end", "def test_dependencies\n []\n end", "def dependencies\n @dependencies ||= []\n end", "def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def filtered_dependencies(pkginfo, with_rock_release_prefix = true)\n target_platform = @packager.target_platform\n this_rock_release = TargetPlatform.new(@packager.rock_release_name, target_platform.architecture)\n\n deps_rock_pkginfos = pkginfo.dependencies[:rock_pkginfo].dup\n deps_osdeps_packages = pkginfo.dependencies[:osdeps].dup\n non_native_dependencies = pkginfo.dependencies[:nonnative].dup\n\n if target_platform.distribution_release_name\n # CASTXML vs. GCCXML in typelib\n if pkginfo.name =~ /typelib$/\n # add/remove the optional dependencies on the\n # rock-package depending on the target platform\n # there are typelib versions with and without the\n # optional depends. we know which platform requires\n # a particular dependency.\n deps_rock_pkginfos.delete_if do |pkginfo|\n pkginfo.name == \"castxml\" || pkginfo.name == \"gccxml\"\n end\n\n if target_platform.contains(\"castxml\")\n deps_osdeps_packages.push(\"castxml\")\n elsif target_platform.contains(\"gccxml\")\n #todo: these need to checked on the other platforms\n deps_osdeps_packages.push(\"gccxml\")\n else\n raise ArgumentError, \"TargetPlatform: #{target_platform} does neither support castxml nor gccml - cannot build typelib\"\n end\n end\n\n # Filter out optional packages, e.g. llvm and clang for all platforms where not explicitly available\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n result = true\n Packaging::Config.packages_optional.each do |pkg_name|\n regex = Regexp.new(pkg_name)\n if regex.match(name)\n result = target_platform.contains(name)\n end\n end\n result\n end\n\n # Filter out excluded packages, e.g. libqwt5-qt4-dev\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n result = true\n Packaging::Config.packages_excluded.each do |pkg_name|\n regex = Regexp.new(pkg_name)\n if regex.match(name)\n Packager.info \"#{pkginfo.name} excluding osdeps #{pkg_name} as dependency\"\n result = false\n end\n end\n result\n end\n\n # Filter ruby versions out -- we assume chroot has installed all\n # ruby versions\n #\n # This is a workaround, since the information about required packages\n # comes from the build server platform and might not correspond\n # with the target platform\n #\n # Right approach: bootstrap within chroot and generate source packages\n # in the chroot\n #deps_osdeps_packages = deps[:osdeps].select do |name|\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n name !~ /^ruby[0-9][0-9.]*/\n end\n\n # Prefer package of the OS for gems if they are available there\n #deps_nonnative_packages = deps[:nonnative].map do |name, version|\n non_native_dependencies = non_native_dependencies.map do |name, version|\n dep_name,is_osdep = native_dependency_name(name)\n # if with_rock_release_prefix is given all packages 'have to be'\n # os dependencies, otherwise it triggers further resolution of nonnative packages\n # which cannot exist (in resolve_all)\n if is_osdep || with_rock_release_prefix\n deps_osdeps_packages << dep_name\n nil\n else\n name\n end\n end.compact\n end\n\n deps_rock_packages = deps_rock_pkginfos.map do |pkginfo|\n debian_name = @packager.debian_name(pkginfo, with_rock_release_prefix)\n this_rock_release.packageReleaseName(debian_name)\n end.sort\n\n Packager.info \"'#{pkginfo.name}' with (available) rock package dependencies: '#{deps_rock_packages}'\"\n Packager.info \"'#{pkginfo.name}' with (available) osdeps dependencies: '#{deps_osdeps_packages}'\"\n\n # Return rock packages, osdeps and non native deps (here gems)\n {:rock => deps_rock_packages, :osdeps => deps_osdeps_packages, :nonnative => non_native_dependencies }\n end", "def package_depends_on\n depends_on\n end", "def dependency_list\n @target.dependencies.map(&:display_name)\n end", "def reverse_dependencies(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.dependencies.any? {|e| e.name == rubygem && e.type == :runtime}}.\n map {|e| \"#{e.name}-#{e.version}\" }\n end", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def sorted_deps\n dep_names = (dependencies.keys + dependencies_development.keys).uniq\n ret = []\n\n dep_names.each do |dep_name|\n dep = local_deps.find { |x| x.name == dep_name }\n add_sorted_dep(dep, local_deps, :both, ret)\n end\n ret\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n spec.dependencies\n end", "def dependencies\n spec.dependencies\n end", "def find_dependencies(env)\n args = [] if (env = env.dup).sub!(REGEXP_DEVPKG,'') # are we in compile mode?\n return [[], [], args] if args && env.empty?\n\n require 'rubygems/remote_fetcher'\n @@deps = YAML.load(fetch(env))['gems'] unless defined?(@@deps)\n @@deps.key?(spec.name) or return(args ? [[], [], args] : nil)\n\n # find dependencies\n case deps = @@deps[spec.name]\n when nil, \"*\" # for nil or '*', use the default extension name\n deps = [\"*\"]\n when String # string of space-delimited packages and extensions\n when Array # array of packages and extensions\n when Hash # hash of packages and extensions, indexed by version requirements\n reqs, deps = deps.find do |reqs, info| # deps is an array or space-delimited string\n Gem::Requirement.new(reqs.split(',')).satisfied_by?(spec.version)\n end\n reqs or return # can't find the right version\n deps ||= [\"*\"] # deps are nil, use the default extension name\n end\n deps = deps.strip.split(/\\s+/) if deps.is_a?(String)\n deps = deps.compact.uniq\n\n # helpful variables\n bcwd = Dir.pwd\n benv = File.dirname(env.split(/[?;#]/,2).first)\n name = \"#{spec.full_name}.tar.gz\"\n\n # grok dependencies\n pkgs, exts = [], []\n deps.each do |item|\n if item.include?(\"*\") || item =~ REGEXP_SCHEMA || item.include?(\".tar.gz\")\n exts << item unless args\n elsif item =~ REGEXP_DEVPKG\n pkgs << $' if args\n elsif item =~ REGEXP_DEVARG\n args << $' if args\n else\n pkgs << item unless args\n end\n end\n exts.map! do |item|\n case item\n when \"*\" then item = File.join(benv, name) # use complete default tarball name\n when /\\A\\*/ then item[0,1] = benv # path relative to env variable\n when /\\A[^\\/]/ then item[0,0] = bcwd + \"/\" # path relative to current directory\n end\n item.gsub(\"*\", name) # swap inline wildcards with default tarball name\n end\n [pkgs, exts, args]\n end", "def find_non_local_dependencies(deps, verbose)\n search_list = Array(deps)\n seen = []\n ret = {}\n\n until search_list.empty?\n name, version = search_list.shift\n next if seen.include?(name)\n seen << name\n\n package_root = locate_local_package(name)\n if package_root\n pkg = BPM::Package.new(package_root)\n pkg.load_json\n\n unless satisfied_by?(version, pkg.version)\n raise LocalPackageConflictError.new(pkg.name, version, pkg.version)\n end\n\n search_list += Array(pkg.dependencies)\n search_list += Array(pkg.dependencies_development)\n search_list += Array(pkg.dependencies_build)\n else\n ret[name] = version\n end\n end\n\n ret\n end", "def dependencies_for(specification)\n []\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def walk_down_dependencies(pkg_name, known_deps=Array.new)\n\talldeps = Array.new\n\t@total_deps[pkg_name].each { |m|\n\t\tunless alldeps.include?(m) || m.nil? || known_deps.include?(m) \n\t\t\talldeps = alldeps + walk_down_dependencies(m, alldeps)\n\t\tend\n\t\talldeps.push m\n\t}\n\talldeps.uniq!\n\talldeps.push pkg_name\n\t# puts alldeps.join(\", \") \n\treturn alldeps.compact \nend", "def extra_gem_files(gem = nil)\n gem ||= upstream_gem\n pkg_extra = {}\n pkg_files.each do |pkg, files|\n extra = files.select { |spec_file| !gem.has_file_satisfied_by?(spec_file) }\n pkg_extra[pkg] = extra unless extra.empty?\n end\n pkg_extra\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def released_specs\n specs.select { |s| not s.prerelease? }\n end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def initial_dependencies\n []\n end", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def dependencies\n @dependencies ||= Set.new\n end", "def find_reverse_dependencies(spec, srcindex)\n result = []\n srcindex.each do |name, sp|\n sp.dependencies.each do |dep|\n if spec.name == dep.name &&\n dep.version_requirements.satisfied_by?(spec.version)\n result << [sp.full_name, dep]\n end\n end\n end\n result\n end", "def os_dependencies\n []\n end", "def uppper_depends(task_name)\n task_list = []\n @tasks.each { |t|\n if not t.dependency.nil? then\n task_list.push(t) if t.dependency.include?(task_name)\n end\n }\n task_list\n end", "def direct_dependencies; end", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def vendor(dependencies)\n return nil if dependencies.nil? || dependencies.empty?\n @dep_list = Resolver.resolve(dependencies, @cache, @cwd, @backend)\n end", "def locked_specs_as_deps\n deps = @dependencies & @locked_deps\n\n @dependencies.each do |dep|\n next if deps.include?(dep)\n deps << dep if @locked_specs.any? { |s| s.satisfies?(dep) }\n end\n\n meta_deps = @locked_specs.for(deps).map do |s|\n dep = Gem::Dependency.new(s.name, s.version)\n @locked_deps.each do |d|\n dep.source = d.source if d.name == dep.name\n end\n dep\n end\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def referenced_libraries\n # TODO: check content type before scanning\n content.scan(%r{\\s*needs\\s+[\\\"\\'](.+)/(.+)[\\\"\\']}).map { |a, b| a + '/' + b }.uniq\n end", "def dependencies\n @dependencies\n end", "def dependencies(include_parent = false)\n include_parent ? [ parent ] : []\n end", "def deps(pkg) # FIXME: \"*** PACKAGE MAY NOT BE DELETED *** \"\n if pkg.status != :available\n components = `#{@cmd} -n #{pkg.name}`.split(\"Requires:\\n\")\n if components.size > 1\n return components[1].strip\n else\n return \"[No depends]\"\n end\n else\n if File.exist?(File.expand_path(\"~/Library/Application Support/Guigna/pkgsrc/INDEX\"))\n # TODO: parse INDEX\n end\n \"[Not available]\"\n end\n end", "def outdated\n remotes = Gem::SourceInfoCache.search(//)\n outdateds = []\n latest_specs.each do |_, local|\n name = local.name\n remote = remotes.select { |spec| spec.name == name }.\n sort_by { |spec| spec.version }.\n last\n outdateds << name if remote and local.version < remote.version\n end\n outdateds\n end", "def dependencies(pkg)\n pkg.resolve_optional_dependencies\n deps_rock_packages = pkg.dependencies.map do |pkg_name|\n debian_name(Autoproj.manifest.package(pkg_name).autobuild)\n end.sort\n\n pkg_osdeps = Autoproj.osdeps.resolve_os_dependencies(pkg.os_packages)\n # There are limitations regarding handling packages with native dependencies\n #\n # Currently gems need to converted into debs using gem2deb\n # These deps dependencies are updated here before uploading a package\n # \n # Generation of the debian packages from the gems can be done in postprocessing step\n # i.e. see convert_gems\n \n deps_osdeps_packages = []\n native_package_manager = Autoproj.osdeps.os_package_handler\n _, native_pkg_list = pkg_osdeps.find { |handler, _| handler == native_package_manager }\n\n deps_osdeps_packages += native_pkg_list if native_pkg_list\n\n # Update global list\n @osdeps += deps_osdeps_packages\n\n non_native_handlers = pkg_osdeps.collect do |handler, pkg_list|\n if handler != native_package_manager\n [handler, pkg_list]\n end\n end.compact\n\n non_native_handlers.each do |pkg_handler, pkg_list|\n # Convert native ruby gems package names to rock-xxx \n if pkg_handler.kind_of?(Autoproj::PackageManagers::GemManager)\n pkg_list.each do |name,version|\n @ruby_gems << [name,version]\n deps_osdeps_packages << debian_ruby_name(name)\n end\n else\n raise ArgumentError, \"cannot package #{pkg.name} as it has non-native dependencies (#{pkg_list}) -- #{pkg_handler.class} #{pkg_handler}\"\n end\n end\n\n # Remove duplicates\n @osdeps.uniq!\n @ruby_gems.uniq!\n\n # Return rock packages and osdeps\n [deps_rock_packages, deps_osdeps_packages]\n end", "def build_dependencies(pkginfo)\n dependencies = []\n pkgdeps = pkginfo.dependencies\n deps = pkgdeps[:rock_pkginfo].select do |pkginfo|\n pkg_name = debian_name(pkginfo, true)\n !rock_release_platform.ancestorContains(pkg_name)\n end .map { |p| p.name }\n\n gems = pkgdeps[:nonnative].select do |gem,version|\n pkg_ruby_name = debian_ruby_name(gem, false)\n pkg_prefixed_name = debian_ruby_name(gem, true)\n\n !( rock_release_platform.ancestorContains(gem) ||\n rock_release_platform.ancestorContains(pkg_ruby_name) ||\n rock_release_platform.ancestorContains(pkg_prefixed_name))\n end .map{ |p| p[0] }\n\n deps.concat(gems)\n deps\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def prefetch reqs\n names = reqs.map { |r| r.dependency.name }\n needed = names.find_all { |d| !@data.key?(d) }\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n end" ]
[ "0.802019", "0.7529109", "0.7401518", "0.7325643", "0.7075162", "0.70070356", "0.68912154", "0.6847869", "0.68293285", "0.6712348", "0.66706264", "0.66649264", "0.6619542", "0.6598121", "0.6588399", "0.6576242", "0.6576242", "0.6576242", "0.6548561", "0.64404315", "0.6420742", "0.6402958", "0.64005405", "0.63903916", "0.6370531", "0.6367423", "0.63207096", "0.6318845", "0.6299331", "0.6299331", "0.6287571", "0.6283793", "0.6283793", "0.6283793", "0.62814796", "0.62814796", "0.62707126", "0.62694585", "0.6227046", "0.6223441", "0.6222533", "0.62136376", "0.6207315", "0.6199193", "0.6152116", "0.61489856", "0.61444646", "0.6143586", "0.61349577", "0.612726", "0.6122088", "0.6122088", "0.60764664", "0.6074327", "0.6057641", "0.604275", "0.60420746", "0.6040844", "0.60253453", "0.6022161", "0.6021392", "0.6021109", "0.6019341", "0.6019341", "0.6019341", "0.6019341", "0.6013748", "0.6013748", "0.6011786", "0.59915036", "0.5976814", "0.59680307", "0.59645414", "0.59622055", "0.596119", "0.59574133", "0.59533715", "0.59431577", "0.5936742", "0.59248984", "0.59248984", "0.5920172", "0.59154475", "0.59123135", "0.59116", "0.5897873", "0.5884594", "0.58834565", "0.58822316", "0.5874613", "0.5872701", "0.5850964", "0.584369", "0.5839562", "0.5839085", "0.58373845", "0.58366627", "0.5825309", "0.5824714", "0.5823135" ]
0.84077597
0
Return boolean indicating if the specified gem is on excluded dev dep list
def excludes_dev_dep?(gem_name) excluded_dev_deps.any? { |d| d.name == gem_name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def exclude?(production)\n !include?(production)\n end", "def dep_is_valid(dep)\n is_dev_type = dep.type.to_s == \"development\"\n is_dev_group = false\n if dep.groups\n is_dev_group = (dep.groups.include?(:development) || dep.groups.include?(:test))\n end\n\n return (!is_dev_group && !is_dev_type)\n end", "def include_dev?\n config.dig(\"composer\", \"include_dev\") == true\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def development_pkg?(pkg)\n if (r = development_regex) && pkg =~ r\n return true\n end\n\n false\n end", "def dev?\n without_extension.end_with?(DEV_IDENTIFIER)\n end", "def gem_should_be_checked?(gem_name)\n gem_name.index('barkest_') == 0\n end", "def vendor?\n !vendor.empty?\n end", "def disabled?\n super || !gemfile.exist?\n end", "def gem_only_available?()\n return !determine_common_folder() && is_dtk_common_core_gem_installed?\nend", "def gem?\n @gem\n end", "def excluded?(package_name)\n package_name = validate_package_name_argument(package_name)\n\n if !explicitely_selected_in_layout?(package_name) && excluded_in_manifest?(package_name)\n true\n elsif automatic_exclusions.any? { |pkg_name,| pkg_name == package_name }\n true\n else\n false\n end\n end", "def gem_listed?(gem)\n lockfile_specs.map(&:name).include? gem\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def dep_defined?\n @dep_defined\n end", "def excluded_in_manifest?(package_name)\n package_name = validate_package_name_argument(package_name)\n manifest_exclusions.any? do |matcher|\n if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)\n true\n else\n Regexp.new(matcher) === package_name\n end\n end\n end", "def development?\n @dependency.type == :development\n end", "def gemspec?\n !gemspecs.empty?\n end", "def has_conflicts?\n return true unless Gem.env_requirement(name).satisfied_by?(version)\n self.dependencies.any? do |dep|\n if dep.runtime?\n spec = Gem.loaded_specs[dep.name]\n spec and not spec.satisfies_requirement? dep\n else\n false\n end\n end\n end", "def is_dev?\n @dev\n end", "def auto_exclude?\n @auto_exclude\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name full_name\n\n siblings = @specs.find_all { |s|\n s.name == gem_to_remove.name &&\n s.full_name != gem_to_remove.full_name\n }\n\n deps = []\n\n @specs.each do |spec|\n spec.dependencies.each do |dep|\n deps << dep if gem_to_remove.satisfies_requirement?(dep)\n end\n end\n\n deps.all? { |dep|\n siblings.any? { |s|\n s.satisfies_requirement? dep\n }\n }\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name(full_name)\n siblings = @specs.find_all { |s|\n\ts.name == gem_to_remove.name &&\n\t s.full_name != gem_to_remove.full_name\t\n }\n deps = []\n @specs.each do |spec|\n\tspec.dependencies.each do |dep|\n\t deps << dep if gem_to_remove.satisfies_requirement?(dep)\n\tend\n end\n deps.all? { |dep|\n\tsiblings.any? { |s| \n\t s.satisfies_requirement?(dep)\n\t}\n }\n end", "def installed?(gem_name)\n !run('list', '|', 'grep', \"' #{gem_name} '\").empty?\n end", "def excluded?(project_name)\n @excluded_projects.has_key?(project_name)\n end", "def ignore_production_checks?\n ignore_production_checks != 'false'\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def dependency?(software)\n name = software.is_a?(Software) ? software.name : software\n dependencies.include?(name)\n end", "def dependency?(software)\n name = software.is_a?(Software) ? software.name : software\n dependencies.include?(name)\n end", "def vendored_bundler?\n false\n end", "def excluded?(site, name)\r\n @config['exclude'].include? name\r\n end", "def installed?\n case @spec\n when Gem::Resolver::VendorSpecification then\n true\n else\n this_spec = full_spec\n\n Gem::Specification.any? do |s|\n s == this_spec\n end\n end\n end", "def dry_validation?\n @dry_validation ||= @gems.include?(:dry_validation)\n end", "def warnings?\n !gem?(\"shelly-dependencies\")\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def dependency_met?\n true\n end", "def dependent?\n @flags.include?(:dependent)\n end", "def dependencies_installed?(builder)\n warn_if_gif2webp_missing builder\n cwebp_installed? builder\n end", "def disabled?\n Support.new(ENV, verbose: verbose).disabled?\n end", "def deps_satisfied?(deps)\n deps.each do |dep|\n if dep.to_s =~ /^no_(.*)$/\n return false if @used_legos.include?( $1 )\n else\n return false unless @used_legos.include?( dep.to_s )\n end\n end\n\n true\nend", "def development_requirements\n requirements.select do |requirement|\n ! requirements.runtime?\n end\n end", "def allow_missing?(dependency)\n false\n end", "def dependency?(software)\n name = if software.respond_to?(:name)\n software.send(:name)\n else\n software\n end\n @dependencies.include?(name)\n end", "def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end", "def installed?\n false\n end", "def has_all_requirements_for?(gem_dep)\n reqs = self.requirements_for_gem gem_dep.name\n # create a spec requirement dependency for each expanded subrequirement,\n # verify we can find a match for that\n gem_dep.requirement.to_s.split(',').all? { |greq|\n Gem2Rpm::Helpers.expand_requirement([greq.split]).all? { |ereq|\n tereq = Requirement.new :name => \"#{requirement_prefix}(#{gem_dep.name})\",\n :condition => ereq.first,\n :version => ereq.last.to_s\n reqs.any? { |req| req.matches?(tereq)}\n }\n }\n end", "def missing_extensions?\n return false if extensions.empty?\n return false if default_gem?\n return false if File.exist? gem_build_complete_path\n\n true\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def warnings?\n !gem?(\"shelly-dependencies\") || gem?(\"shelly\")\n end", "def dev_gems\n\n # Dev mode has to explicitly include every needed gem dependency in the project in order to\n # be properly (i.e. recursively) loaded from source by Bundler\n gem 'task_runner', :path => 'gems/task_runner'\n gem 'tef-worker', :path => 'gems/tef-worker'\n gem 'tef-core', :path => 'gems/tef-core'\n gem 'res_man', git: 'https://github.com/grange-insurance/res_man.git', branch: 'master'\n gem 'tef-manager', :path => 'gems/tef-manager'\n gem 'tef-keeper', :path => 'gems/tef-keeper'\n gem 'tef', :path => '.'\n gem 'tef-development', :path => 'gems/tef-development'\nend", "def is_unused?(dir)\n status = true\n\n path = Dir.glob(File.join(dir, \"*\"))\n path.each do |dirorfile|\n status = false if File.directory?(dirorfile)\n status = false if File.basename(dirorfile) =~ /\\.deb$/\n end\n\n status\n end", "def ignore?(pkg)\n ignores.include?(pkg)\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def bundled?\n Gem.loaded_specs.key?(self.class.from_gem)\n end", "def gem_available_old_rubygems?(gemname)\n\tGem.available?(gemname)\nend", "def feature_excluded?(file)\n !file.start_with?(Padrino.root) || exclude.any?{ |excluded_path| file.start_with?(excluded_path) }\n end", "def optimized_gems\n optimized_gems = @gems.reject { |gem| @redundant_gems.include? gem }\n optimized_gems.empty? ? false : optimized_gems.uniq.sort\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def development_dependencies\n dependencies.select {|d| d.type == :development }\n end", "def include_hidden_subtools?\n @include_hidden_subtools\n end", "def vendorized?\n File.directory?(normalize(:lib)) && normalize(:lib)\n end", "def gem_installed?(gem_name)\n !Gem::Specification.find_by_name(gem_name).nil?\n rescue Gem::LoadError\n false\n end", "def ignored?(dependency)\n config.ignored?(dependency.metadata, require_version: self.class.require_matched_dependency_version)\n end", "def not_development?\n !Rails.env.eql?(\"development\")\n end", "def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend", "def gem_installed?(gem_name)\n list = `gem list #{gem_name}`\n list.split(\"\\n\").any? { |line| line.include?(gem_name) }\nend", "def include_non_production?\n config.dig(\"pnpm\", \"production_only\") == false\n end", "def has_dependencies?\n update_for.length > 0 or requires.length > 0\n end", "def gem?\n #return true if Dir[File.join(location, '*.gemspec')].first\n pkgname = File.basename(location)\n gemsdir = File.dirname(location)\n specdir = File.join(File.dirname(gemsdir), 'specifications')\n Dir[File.join(specdir, \"#{pkgname}.gemspec\")].first\n end", "def config_tool_needed?\n false\n end", "def integrated\n File.exist?(gemfile)\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def developer?\n config[\"developer\"] == true\n end", "def disabled?\n deprecated? || deleted?\n end", "def application?\n gem_dir\n end", "def application?\n gem_dir\n end", "def local_module_obsolete?(org_plus_name)\n module_name = org_plus_name.split('-').last\n possible_matches = Dir.glob(File.join(@simp_modules_git_repos_path, \"*-#{module_name}.git\"))\n return false if possible_matches.empty?\n\n obsolete = false\n possible_matches.map! { |repo_name| \"pupmod-#{File.basename(repo_name, '.git')}\" }\n possible_matches.each do |pkg_name|\n result = %x{rpm -q #{pkg_name} --obsoletes 2>&1}\n if result.match(/^pupmod-#{org_plus_name}(\\s)+/)\n obsolete = true\n break\n end\n end\n obsolete\n end", "def skip_bundler_option?\n RSpec::Mate::Options['--skip-bundler']\nend", "def qualified_for_supplimental_output_generation?\r\n !batch_bundle_for_supplemental_output.detect { |batch| !batch.eligible_for_supplimental_output? }\r\n end", "def exclude?\n self.exclude == true || self.class.excluded_accounts.include?(self.account_number)\n end", "def gem_available?(gemname)\n\t# gem_available_new_rubygems?(gemname) or gem_available_old_rubygems?(gemname)\n\tif defined?(Gem::Specification) and defined?(Gem::Specification.find_by_name)\n\t\tgem_available_new_rubygems?(gemname)\n\telse\n\t\tgem_available_old_rubygems?(gemname)\n\tend\nend", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def derivative_plugins_for(plugin)\n plugins.find_all do |pd|\n pd.dependencies.any? {|dep| dep.required_name == plugin.name}\n end\n end", "def gem_installed?(gem_name)\n found_gem = false\n begin\n found_gem = Gem::Specification.find_by_name(gem_name)\n rescue Gem::LoadError\n return false \n else\n return true \n end\nend", "def require_matched_dependency_version\n false\n end", "def dependency_unmet?(*args, &block); end", "def local?(dep_name) # :nodoc:\n spec, _ = @local[dep_name]\n\n spec\n end", "def incomplete_install?\n builtin_module_list = %w[aggregate canary puppetdb_fact secure_env_vars puppet_connect]\n (Dir.children(Bolt::Config::Modulepath::MODULES_PATH) - builtin_module_list).empty?\n end", "def dev_checks\n checks.select { |ctx| !ctx.functional? }\n end", "def disabled?\n self.disabled || self.account.blank? || Rails.env.development?\n end", "def quiet_deps_option\n !!jekyll_sass_configuration.fetch(\"quiet_deps\", false)\n end", "def missing_gem_file?(gem_file)\n files.none? { |spec_file| self.class.file_satisfies?(spec_file, gem_file) }\n end" ]
[ "0.8301603", "0.74998707", "0.7026222", "0.6679245", "0.66597533", "0.6637068", "0.6505546", "0.64745206", "0.6448305", "0.64128023", "0.63961947", "0.63957137", "0.639031", "0.63515246", "0.6348039", "0.6298262", "0.62937367", "0.62780184", "0.6241609", "0.6200809", "0.616311", "0.6108226", "0.6084783", "0.6077355", "0.60763144", "0.6060517", "0.6059211", "0.6052976", "0.6027356", "0.6026339", "0.6018786", "0.5981554", "0.5981554", "0.5967298", "0.5948132", "0.59360576", "0.59258914", "0.59228855", "0.5914511", "0.5910059", "0.59020996", "0.5853362", "0.5838632", "0.58325225", "0.58214366", "0.58094287", "0.5798211", "0.57868713", "0.5785299", "0.57700133", "0.57666975", "0.5756128", "0.57152253", "0.5713419", "0.5686559", "0.56834537", "0.5675897", "0.5672306", "0.5647859", "0.5647222", "0.56426847", "0.564172", "0.564172", "0.564172", "0.56056154", "0.5600102", "0.5595313", "0.5594632", "0.5592952", "0.5587727", "0.558657", "0.5580874", "0.5578715", "0.5574353", "0.5569179", "0.5562231", "0.55569744", "0.55563235", "0.5552808", "0.55477124", "0.55452734", "0.55452734", "0.55448663", "0.55388224", "0.55308014", "0.5513242", "0.5506203", "0.5501934", "0.5501934", "0.5501934", "0.5500546", "0.5499383", "0.5497001", "0.5495974", "0.5483018", "0.54755795", "0.5466776", "0.5456049", "0.5453137", "0.5452599" ]
0.8841211
0
Return all gem Requires
def gem_requirements @metadata[:requires].nil? ? [] : @metadata[:requires].select { |r| r.gem? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requires\n require_items.collect(&:package)\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def all_requires\n []\n end", "def all_requires\n []\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def requires\n []\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def require_gems; end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def requires\n self.class::Requirements[@version] || self.class::Requirements[:all] || {}\n end", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def default_requires\n PackageList.new\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def gem_requires(name, options) # :nodoc:\n if options.include? :require\n if requires = options.delete(:require)\n @requires[name].concat Array requires\n end\n else\n @requires[name] << name\n end\n raise ArgumentError, \"Unhandled gem options #{options.inspect}\" unless options.empty?\n end", "def requires(database)\n fail \"Extension #{name} not (yet) installed\" unless installed?(database)\n\n stmt = if version\n <<-SQL\n SELECT unnest(requires) as name FROM\n ( SELECT requires FROM pg_available_extension_versions where name='#{name}' AND version ='#{version}') t\n SQL\n else\n <<-SQL\n SELECT unnest(requires) as name FROM\n (SELECT requires FROM\n pg_available_extensions a\n JOIN pg_available_extension_versions v ON v.name = a.name AND a.default_version = v.version\n WHERE v.name = '#{name}')t\n SQL\n end\n\n result = database.execute(stmt).to_a\n\n requires = result.map{|r| r['name']}\n end", "def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def gems\n @gems ||=\n Bundler.load.current_dependencies.map do |dependency|\n GemsBond::Gem.new(dependency)\n end\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def runtime_specific_gems\n []\n end", "def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def r(*gems)\n gems.map {|g| require g.to_s}\nend", "def dependencies\n @dependencies ||= ElmPackage.dependencies 'elm-package.json',\n silent: false\n end", "def gemspecs; end", "def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def gems; end", "def gems; end", "def gems; end", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def collect_requires src\n src.scan(/^[\\t ]*require[ \\t]*['\"](.*?)['\"]/).collect { |x| x[0] }\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def gems(*args)\n gems.each{|g| gem(g) }\n end", "def dependencies\n []\n end", "def get_all_requires(code = @code)\n if code.is_a?(Array) then\n requires = (code.select { |sub| is_require?(sub) }).map! do |sub|\n get_require(sub)\n end\n code.each do |sub|\n requires += get_all_requires(sub)\n end\n return requires\n else\n return []\n end\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end", "def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end", "def requires\n @require_ids.collect { |idx| BRequire.store[idx] }\n end", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def manifest_dependencies()\n as_bundle = Bundle.fromProject(self)\n as_bundle.nil? ? [] : as_bundle.bundles.collect{|b| b.resolve}.compact + as_bundle.imports.collect {|i| i.resolve}.flatten\n end", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def dependencies\n spec.dependencies\n end", "def dependencies\n spec.dependencies\n end", "def require_gems\n Jekyll::External.require_with_graceful_fail(\n site.gems.select { |plugin| plugin_allowed?(plugin) }\n )\n end", "def dependencies\n []\n end", "def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end", "def packages_from_require(rpmdep)\n refresh\n @rpmdb.whatprovides(rpmdep)\n end", "def dependencies\n []\n end", "def gems\n @gems ||= begin\n gems = locks.dup\n gems.each do |name, g|\n if gem_declarations.has_key?(name)\n g[:declared_groups] = gem_declarations[name][:groups]\n else\n g[:declared_groups] = []\n end\n g[:groups] = g[:declared_groups].dup\n end\n # Transitivize groups (since dependencies are already transitive, this is easy)\n gems.each do |name, g|\n g[:dependencies].each do |dep|\n gems[dep][:groups] |= gems[name][:declared_groups].dup\n end\n end\n gems\n end\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def gem_declarations\n @gem_declarations ||= begin\n Bundler.with_clean_env do\n # Set BUNDLE_GEMFILE to the new gemfile temporarily so all bundler's things work\n # This works around some issues in bundler 1.11.2.\n ENV[\"BUNDLE_GEMFILE\"] = gemfile_path\n\n parsed_gemfile = Bundler::Dsl.new\n parsed_gemfile.eval_gemfile(gemfile_path)\n parsed_gemfile.complete_overrides if parsed_gemfile.respond_to?(:complete_overrides)\n\n result = {}\n parsed_gemfile.dependencies.each do |dep|\n groups = dep.groups.empty? ? [:default] : dep.groups\n result[dep.name] = { groups: groups, platforms: dep.platforms }\n end\n result\n end\n end\n end", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end", "def deps(pkg) # FIXME: \"*** PACKAGE MAY NOT BE DELETED *** \"\n if pkg.status != :available\n components = `#{@cmd} -n #{pkg.name}`.split(\"Requires:\\n\")\n if components.size > 1\n return components[1].strip\n else\n return \"[No depends]\"\n end\n else\n if File.exist?(File.expand_path(\"~/Library/Application Support/Guigna/pkgsrc/INDEX\"))\n # TODO: parse INDEX\n end\n \"[Not available]\"\n end\n end", "def needs(*libraries)\n if libraries.empty?\n @needs ||= [ ]\n else\n needs.push(*libraries.flatten)\n end\n end", "def core_dependencies\n @_core_dependencies ||= begin\n if gem_dir\n Gem.clear_paths; Gem.path.unshift(gem_dir)\n end\n deps = []\n merb_core = Gem::Dependency.new('merb-core', '>= 0.9.8')\n if gemspec = Gem.source_index.search(merb_core).last\n deps << Gem::Dependency.new('merb-core', gemspec.version)\n deps += gemspec.dependencies\n end\n Gem.clear_paths\n deps\n end\n end", "def find_dependencies\n\t\tunless GEMDEPS_FILE.readable?\n\t\t\tself.prompt.warn \"Deps file (%s) is missing or unreadable, assuming no dependencies.\" %\n\t\t\t\t[ GEMDEPS_FILE ]\n\t\t\treturn []\n\t\tend\n\n\t\tfinder = Rake::DevEiate::GemDepFinder.new( GEMDEPS_FILE )\n\t\tfinder.load\n\t\treturn finder.dependencies\n\tend", "def gems=(gems)\n @gem_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def gem_requirements_from_array(what, array)\n array.map do |dep|\n Gem::Dependency.new(what, *dep)\n end\n end", "def dependencies\n manager.dependencies\n end", "def dependencies(gemfile)\n dependencies = { }\n\n File.open(gemfile) do |f|\n f.each do |line|\n if (line.match(/\\Agem\\s+['\"]bundler['\"]\\s*,\\s*['\"]([^'\"]+)['\"]/))\n dependencies[:bundler] = $1\n elsif (line.match(/\\A\\#\\s*rubygems\\s+(\\S+)/))\n dependencies[:rubygems] = $1\n end\n end\n end\n\n dependencies\nend", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def package_depends_on\n depends_on\n end", "def requirements\n unless @reqs\n @reqs = []\n @reqs << Requirement.new(:feature, {:feature => self['feature']}, plugin) if self['feature']\n end\n @reqs\n end", "def requires(*paths)\n @requires.concat(paths) unless paths.empty?\n @requires\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def elm_dependencies(package)\n ElmPackage.dependencies elm_package_path(package)\n rescue\n {}\n end", "def find_gems(match, options={})\n return [] unless defined?(::Gem)\n ::Gem.search(match)\n end", "def _requires\n @_requires ||= requires\n end", "def expand_requires(requires, builder)\n requires.map { |i| builder.expand_ext(i) }\n end", "def find_gems\n @gems = RubygemsApi.call :all\n end", "def requirements\n @requirements ||= []\n end", "def installed_versions(name, requirement)\n if gem_installed?(name, requirement)\n Chef::Log.info \"Gem #{name} (#{requirement}) found in OpsWorks user space.\"\n # from rubygems/specification.rb#find_all_by_name\n Gem::Dependency.new(name, requirement).matching_specs\n else\n Chef::Log.debug \"Gem #{name} (#{requirement}) not found in OpsWorks user space.\"\n []\n end\n end", "def testing_gems\n gem 'rake'\n gem 'rspec', '~> 3.0.0'\n gem 'rspec-wait'\n gem 'cucumber'\n gem 'simplecov'\n gem 'bundler', '~> 1.6'\n gem 'bunny', '~> 1.4'\n gem 'database_cleaner'\n gem 'racatt'\n gem 'codacy-coverage', :require => false\nend", "def spec_set\n Bundler.locked_gems.specs\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def find_all(req)\n res = []\n\n dep = req.dependency\n\n return res if @ignore_dependencies and\n @always_install.none? {|spec| dep.match? spec }\n\n name = dep.name\n\n dep.matching_specs.each do |gemspec|\n next if @always_install.any? {|spec| spec.name == gemspec.name }\n\n res << Gem::Resolver::InstalledSpecification.new(self, gemspec)\n end unless @ignore_installed\n\n if consider_local?\n matching_local = @local.values.select do |spec, _|\n req.match? spec\n end.map do |spec, source|\n Gem::Resolver::LocalSpecification.new self, spec, source\n end\n\n res.concat matching_local\n\n begin\n if local_spec = @local_source.find_gem(name, dep.requirement)\n res << Gem::Resolver::IndexSpecification.new(\n self, local_spec.name, local_spec.version,\n @local_source, local_spec.platform)\n end\n rescue Gem::Package::FormatError\n # ignore\n end\n end\n\n res.delete_if do |spec|\n spec.version.prerelease? and not dep.prerelease?\n end\n\n res.concat @remote_set.find_all req if consider_remote?\n\n res\n end", "def find_all req\n res = []\n\n return res unless @remote\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def dependencies\n @dependencies ||= []\n end" ]
[ "0.81167537", "0.80577075", "0.7955232", "0.7891053", "0.7870169", "0.7870169", "0.7779613", "0.748002", "0.7350287", "0.7332056", "0.72157", "0.72157", "0.7191012", "0.7166352", "0.71560174", "0.7121761", "0.7060577", "0.7032609", "0.7013483", "0.69855285", "0.6954951", "0.69451624", "0.69451624", "0.69384676", "0.68631923", "0.68569225", "0.6853607", "0.6848474", "0.6845195", "0.68281597", "0.68256074", "0.682383", "0.68036354", "0.67991626", "0.67726856", "0.6771551", "0.6758061", "0.6753061", "0.6737793", "0.67301524", "0.6714523", "0.6711146", "0.6654019", "0.6654019", "0.6654019", "0.66241527", "0.66093624", "0.65919805", "0.65750974", "0.65750974", "0.65678453", "0.65645534", "0.65592885", "0.65553933", "0.65503734", "0.6507913", "0.6503301", "0.6494032", "0.64853936", "0.6469045", "0.6466888", "0.64586025", "0.64586025", "0.6441873", "0.643751", "0.6434036", "0.643252", "0.64313006", "0.6431134", "0.6394096", "0.637699", "0.6375144", "0.63641", "0.63641", "0.6362239", "0.63559985", "0.6346133", "0.6342988", "0.63386077", "0.63312566", "0.63260937", "0.63061565", "0.6304826", "0.63022125", "0.6299593", "0.62942106", "0.6283551", "0.62782127", "0.62742066", "0.62698776", "0.62596315", "0.6251959", "0.62442154", "0.62388813", "0.6229706", "0.62215495", "0.6221348", "0.62178904", "0.6208938", "0.6199089" ]
0.81617785
0
Return all gem BuildRequires
def gem_build_requirements @metadata[:build_requires].nil? ? [] : @metadata[:build_requires].select { |r| r.gem? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def requires\n require_items.collect(&:package)\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def all_requires\n []\n end", "def all_requires\n []\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def requires\n self.class::Requirements[@version] || self.class::Requirements[:all] || {}\n end", "def gems\n @gems ||=\n Bundler.load.current_dependencies.map do |dependency|\n GemsBond::Gem.new(dependency)\n end\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def core_dependencies\n @_core_dependencies ||= begin\n if gem_dir\n Gem.clear_paths; Gem.path.unshift(gem_dir)\n end\n deps = []\n merb_core = Gem::Dependency.new('merb-core', '>= 0.9.8')\n if gemspec = Gem.source_index.search(merb_core).last\n deps << Gem::Dependency.new('merb-core', gemspec.version)\n deps += gemspec.dependencies\n end\n Gem.clear_paths\n deps\n end\n end", "def runtime_specific_gems\n []\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def build_gems; end", "def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def package_depends_on\n depends_on\n end", "def require_gems; end", "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def gems\n @gems ||= begin\n gems = locks.dup\n gems.each do |name, g|\n if gem_declarations.has_key?(name)\n g[:declared_groups] = gem_declarations[name][:groups]\n else\n g[:declared_groups] = []\n end\n g[:groups] = g[:declared_groups].dup\n end\n # Transitivize groups (since dependencies are already transitive, this is easy)\n gems.each do |name, g|\n g[:dependencies].each do |dep|\n gems[dep][:groups] |= gems[name][:declared_groups].dup\n end\n end\n gems\n end\n end", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def manifest_dependencies()\n as_bundle = Bundle.fromProject(self)\n as_bundle.nil? ? [] : as_bundle.bundles.collect{|b| b.resolve}.compact + as_bundle.imports.collect {|i| i.resolve}.flatten\n end", "def gems(*args)\n gems.each{|g| gem(g) }\n end", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def dependencies(gemfile)\n dependencies = { }\n\n File.open(gemfile) do |f|\n f.each do |line|\n if (line.match(/\\Agem\\s+['\"]bundler['\"]\\s*,\\s*['\"]([^'\"]+)['\"]/))\n dependencies[:bundler] = $1\n elsif (line.match(/\\A\\#\\s*rubygems\\s+(\\S+)/))\n dependencies[:rubygems] = $1\n end\n end\n end\n\n dependencies\nend", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end", "def gems=(gems)\n @gem_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end", "def gems; end", "def gems; end", "def gems; end", "def gemspecs; end", "def dependencies\n @dependencies ||= ElmPackage.dependencies 'elm-package.json',\n silent: false\n end", "def gem_requires(name, options) # :nodoc:\n if options.include? :require\n if requires = options.delete(:require)\n @requires[name].concat Array requires\n end\n else\n @requires[name] << name\n end\n raise ArgumentError, \"Unhandled gem options #{options.inspect}\" unless options.empty?\n end", "def all_package_names\n each_autobuild_package.map(&:name)\n end", "def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end", "def default_requires\n PackageList.new\n end", "def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end", "def gem_declarations\n @gem_declarations ||= begin\n Bundler.with_clean_env do\n # Set BUNDLE_GEMFILE to the new gemfile temporarily so all bundler's things work\n # This works around some issues in bundler 1.11.2.\n ENV[\"BUNDLE_GEMFILE\"] = gemfile_path\n\n parsed_gemfile = Bundler::Dsl.new\n parsed_gemfile.eval_gemfile(gemfile_path)\n parsed_gemfile.complete_overrides if parsed_gemfile.respond_to?(:complete_overrides)\n\n result = {}\n parsed_gemfile.dependencies.each do |dep|\n groups = dep.groups.empty? ? [:default] : dep.groups\n result[dep.name] = { groups: groups, platforms: dep.platforms }\n end\n result\n end\n end\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def gem_requirements_from_array(what, array)\n array.map do |dep|\n Gem::Dependency.new(what, *dep)\n end\n end", "def requires\n []\n end", "def requires(database)\n fail \"Extension #{name} not (yet) installed\" unless installed?(database)\n\n stmt = if version\n <<-SQL\n SELECT unnest(requires) as name FROM\n ( SELECT requires FROM pg_available_extension_versions where name='#{name}' AND version ='#{version}') t\n SQL\n else\n <<-SQL\n SELECT unnest(requires) as name FROM\n (SELECT requires FROM\n pg_available_extensions a\n JOIN pg_available_extension_versions v ON v.name = a.name AND a.default_version = v.version\n WHERE v.name = '#{name}')t\n SQL\n end\n\n result = database.execute(stmt).to_a\n\n requires = result.map{|r| r['name']}\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def dependencies\n []\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def os_dependencies\n []\n end", "def arduino_library_dependencies\n return [] unless library_properties?\n return [] if library_properties.depends.nil?\n\n library_properties.depends\n end", "def dependencies\n return @dependencies unless @dependencies.nil?\n @dependencies = [ ]\n lockfile.each_line do |line|\n if line =~ /^\\s{4}([-\\w_.0-9]+)\\s*\\((.*)\\)/\n @dependencies << [$1, $2]\n end\n end\n @dependencies\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def dependencies\n self.config.depends || []\n end", "def r(*gems)\n gems.map {|g| require g.to_s}\nend", "def has_all_requirements_for?(gem_dep)\n reqs = self.requirements_for_gem gem_dep.name\n # create a spec requirement dependency for each expanded subrequirement,\n # verify we can find a match for that\n gem_dep.requirement.to_s.split(',').all? { |greq|\n Gem2Rpm::Helpers.expand_requirement([greq.split]).all? { |ereq|\n tereq = Requirement.new :name => \"#{requirement_prefix}(#{gem_dep.name})\",\n :condition => ereq.first,\n :version => ereq.last.to_s\n reqs.any? { |req| req.matches?(tereq)}\n }\n }\n end", "def getDeps csproj\r\n deps = []\r\n csproj.search(\"reference\") do |ref|\r\n deps << ref.get_attribute(\"include\").match(/^([^,]+),*/)[1]\r\n end\r\n return deps\r\nend", "def find_dependencies(env)\n args = [] if (env = env.dup).sub!(REGEXP_DEVPKG,'') # are we in compile mode?\n return [[], [], args] if args && env.empty?\n\n require 'rubygems/remote_fetcher'\n @@deps = YAML.load(fetch(env))['gems'] unless defined?(@@deps)\n @@deps.key?(spec.name) or return(args ? [[], [], args] : nil)\n\n # find dependencies\n case deps = @@deps[spec.name]\n when nil, \"*\" # for nil or '*', use the default extension name\n deps = [\"*\"]\n when String # string of space-delimited packages and extensions\n when Array # array of packages and extensions\n when Hash # hash of packages and extensions, indexed by version requirements\n reqs, deps = deps.find do |reqs, info| # deps is an array or space-delimited string\n Gem::Requirement.new(reqs.split(',')).satisfied_by?(spec.version)\n end\n reqs or return # can't find the right version\n deps ||= [\"*\"] # deps are nil, use the default extension name\n end\n deps = deps.strip.split(/\\s+/) if deps.is_a?(String)\n deps = deps.compact.uniq\n\n # helpful variables\n bcwd = Dir.pwd\n benv = File.dirname(env.split(/[?;#]/,2).first)\n name = \"#{spec.full_name}.tar.gz\"\n\n # grok dependencies\n pkgs, exts = [], []\n deps.each do |item|\n if item.include?(\"*\") || item =~ REGEXP_SCHEMA || item.include?(\".tar.gz\")\n exts << item unless args\n elsif item =~ REGEXP_DEVPKG\n pkgs << $' if args\n elsif item =~ REGEXP_DEVARG\n args << $' if args\n else\n pkgs << item unless args\n end\n end\n exts.map! do |item|\n case item\n when \"*\" then item = File.join(benv, name) # use complete default tarball name\n when /\\A\\*/ then item[0,1] = benv # path relative to env variable\n when /\\A[^\\/]/ then item[0,0] = bcwd + \"/\" # path relative to current directory\n end\n item.gsub(\"*\", name) # swap inline wildcards with default tarball name\n end\n [pkgs, exts, args]\n end", "def vendor_dependencies\n fetch_bundler\n bundle_install\n end", "def build_gem; end", "def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end", "def rubyinstaller_build_gem_files\n spec = Gem.loaded_specs[\"rubyinstaller-build\"]\n if spec\n # A loaded gemspec has empty #files -> fetch the files from its path.\n # This is preferred to gemspec loading to avoid a dependency to git.\n Dir[\"**/*\", base: spec.full_gem_path].select do |f|\n FileTest.file?(File.join(spec.full_gem_path, f))\n end\n else\n # Not yet loaded -> load the gemspec and return the files added to the gemspec.\n Gem::Specification.load(File.join(GEM_ROOT, \"rubyinstaller-build.gemspec\")).files\n end\n end", "def bundler_dependencies_for(bundler_runtime, *groups); end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def get_all_requires(code = @code)\n if code.is_a?(Array) then\n requires = (code.select { |sub| is_require?(sub) }).map! do |sub|\n get_require(sub)\n end\n code.each do |sub|\n requires += get_all_requires(sub)\n end\n return requires\n else\n return []\n end\n end", "def build_dependencies(pkginfo)\n dependencies = []\n pkgdeps = pkginfo.dependencies\n deps = pkgdeps[:rock_pkginfo].select do |pkginfo|\n pkg_name = debian_name(pkginfo, true)\n !rock_release_platform.ancestorContains(pkg_name)\n end .map { |p| p.name }\n\n gems = pkgdeps[:nonnative].select do |gem,version|\n pkg_ruby_name = debian_ruby_name(gem, false)\n pkg_prefixed_name = debian_ruby_name(gem, true)\n\n !( rock_release_platform.ancestorContains(gem) ||\n rock_release_platform.ancestorContains(pkg_ruby_name) ||\n rock_release_platform.ancestorContains(pkg_prefixed_name))\n end .map{ |p| p[0] }\n\n deps.concat(gems)\n deps\n end", "def testing_gems\n gem 'rake'\n gem 'rspec', '~> 3.0.0'\n gem 'rspec-wait'\n gem 'cucumber'\n gem 'simplecov'\n gem 'bundler', '~> 1.6'\n gem 'bunny', '~> 1.4'\n gem 'database_cleaner'\n gem 'racatt'\n gem 'codacy-coverage', :require => false\nend", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def dependencies\n []\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def dependencies\n manager.dependencies\n end", "def load_gems(an_array_of_strings)\n\n print \"Installing gems as necessary ... \" if $debug\n gemfile do\n source 'https://rubygems.org'\n Array(an_array_of_strings).each do |gem_name|\n print gem_name + ' ' if $debug\n gem gem_name\n end\n end\n\n puts 'done' if $debug\n\nend", "def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end", "def expand_requires(requires, builder)\n requires.map { |i| builder.expand_ext(i) }\n end", "def find_dependencies\n\t\tunless GEMDEPS_FILE.readable?\n\t\t\tself.prompt.warn \"Deps file (%s) is missing or unreadable, assuming no dependencies.\" %\n\t\t\t\t[ GEMDEPS_FILE ]\n\t\t\treturn []\n\t\tend\n\n\t\tfinder = Rake::DevEiate::GemDepFinder.new( GEMDEPS_FILE )\n\t\tfinder.load\n\t\treturn finder.dependencies\n\tend", "def pythons\n deps.map(&:to_formula)\n .select { |f| f.name.match?(/^python@\\d\\.\\d+$/) }\n .sort_by(&:version)\n .map { |f| f.opt_libexec/\"bin/python\" }\n end", "def dependencies\n []\n end" ]
[ "0.7813414", "0.7778188", "0.7700233", "0.7663836", "0.7616184", "0.7616184", "0.7580091", "0.727626", "0.7268273", "0.71795696", "0.71329087", "0.69731927", "0.69731927", "0.69633394", "0.69085085", "0.6857759", "0.6857759", "0.68087906", "0.6614653", "0.65820885", "0.65645623", "0.6562184", "0.65519005", "0.6520623", "0.65101534", "0.6500854", "0.6497724", "0.64646256", "0.64646256", "0.6462312", "0.64502096", "0.64489436", "0.64170283", "0.6409606", "0.63858116", "0.63838863", "0.63491774", "0.6315174", "0.6314967", "0.6306973", "0.628777", "0.6271154", "0.6262633", "0.6262342", "0.6261937", "0.6252682", "0.6242304", "0.62130237", "0.61858416", "0.61858416", "0.61858416", "0.6176595", "0.6157949", "0.61578447", "0.61567706", "0.6147742", "0.6134292", "0.6134129", "0.61200464", "0.6102853", "0.60983706", "0.6084598", "0.6084146", "0.60812587", "0.6079165", "0.6073585", "0.60729915", "0.60495555", "0.6039638", "0.6037057", "0.60367095", "0.60347927", "0.60347927", "0.60334307", "0.6023834", "0.601284", "0.59860593", "0.5977411", "0.5976027", "0.59693205", "0.5966965", "0.5952735", "0.5945288", "0.59421974", "0.5934095", "0.5931853", "0.5926639", "0.59258705", "0.5917319", "0.59172064", "0.59122866", "0.5911131", "0.59057444", "0.5904542", "0.59024894", "0.5892466", "0.588", "0.58786416", "0.5876242", "0.586538" ]
0.8434125
0
Return all non gem Requires
def non_gem_requirements @metadata[:requires].nil? ? [] : @metadata[:requires].select { |r| !r.gem? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_requires\n []\n end", "def all_requires\n []\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def requires\n require_items.collect(&:package)\n end", "def requires\n []\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def require_gems; end", "def default_requires\n PackageList.new\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def runtime_specific_gems\n []\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def requires\n self.class::Requirements[@version] || self.class::Requirements[:all] || {}\n end", "def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def requires\n @require_ids.collect { |idx| BRequire.store[idx] }\n end", "def _requires\n @_requires ||= requires\n end", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def required_if_used(*args)\n unless @required_gems\n [:included, :extended, :inherited].each do |method_name|\n define_method(method_name) do |klass|\n super if defined?(super)\n @required_gems.each { |gem| require gem.to_s }\n end\n end\n end\n @required_gems ||= []\n @required_gems |= args\n end", "def requirements\n []\n end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def collect_requires src\n src.scan(/^[\\t ]*require[ \\t]*['\"](.*?)['\"]/).collect { |x| x[0] }\n end", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def requires(database)\n fail \"Extension #{name} not (yet) installed\" unless installed?(database)\n\n stmt = if version\n <<-SQL\n SELECT unnest(requires) as name FROM\n ( SELECT requires FROM pg_available_extension_versions where name='#{name}' AND version ='#{version}') t\n SQL\n else\n <<-SQL\n SELECT unnest(requires) as name FROM\n (SELECT requires FROM\n pg_available_extensions a\n JOIN pg_available_extension_versions v ON v.name = a.name AND a.default_version = v.version\n WHERE v.name = '#{name}')t\n SQL\n end\n\n result = database.execute(stmt).to_a\n\n requires = result.map{|r| r['name']}\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def get_all_requires(code = @code)\n if code.is_a?(Array) then\n requires = (code.select { |sub| is_require?(sub) }).map! do |sub|\n get_require(sub)\n end\n code.each do |sub|\n requires += get_all_requires(sub)\n end\n return requires\n else\n return []\n end\n end", "def dependencies\n []\n end", "def gem_requires(name, options) # :nodoc:\n if options.include? :require\n if requires = options.delete(:require)\n @requires[name].concat Array requires\n end\n else\n @requires[name] << name\n end\n raise ArgumentError, \"Unhandled gem options #{options.inspect}\" unless options.empty?\n end", "def required_dependencies\n dependencies - optional_dependencies\n end", "def requirements\n []\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def check_all_packages\n packages_not_installed = []\n Constants::PACKAGES.each do |pkg|\n string = \"Looking for package #{pkg}...\"\n installed = check_package(pkg)\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append package name to packages_not_installed list\n packages_not_installed << pkg\n end #if\n end #do\n \n packages_not_installed\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def dependencies\n []\n end", "def require_gems\n Jekyll::External.require_with_graceful_fail(\n site.gems.select { |plugin| plugin_allowed?(plugin) }\n )\n end", "def dependencies\n @dependencies ||= ElmPackage.dependencies 'elm-package.json',\n silent: false\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def dependencies\n []\n end", "def require_without_bundler(*gems)\n unless defined?(::Bundler)\n gems.each { |g| require g }\n return\n end\n Dir.glob(\"#{Gem.path.first}/gems/*\").map { |gem_path| \n gem_name=File.basename(gem_path).gsub(/-(\\d\\.?)+$/,'')\n if gems.include?(gem_name)\n $LOAD_PATH << \"#{gem_path}/lib\"\n require gem_name\n end\n }\nend", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def deps(pkg) # FIXME: \"*** PACKAGE MAY NOT BE DELETED *** \"\n if pkg.status != :available\n components = `#{@cmd} -n #{pkg.name}`.split(\"Requires:\\n\")\n if components.size > 1\n return components[1].strip\n else\n return \"[No depends]\"\n end\n else\n if File.exist?(File.expand_path(\"~/Library/Application Support/Guigna/pkgsrc/INDEX\"))\n # TODO: parse INDEX\n end\n \"[Not available]\"\n end\n end", "def required(gem_name, gem_install_name = nil)\n Required::required gem_name, gem_install_name\nend", "def failing_modules\n modules.reject {|m| %w(passed softfailed running none).include? m['result']}.map {|m| m['name'] }\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def load(needs = {})\n needs = needs.merge({\"zergrush\" => INCLUDE})\n \n Gem::Specification.each { |gem|\n # don't load gems more than once\n next if @gems.has_key? gem.name \n check = needs.dup\n\n # rolls through the depends and inverts anything it finds\n gem.dependencies.each do |dep|\n # this will fail if a gem is depended more than once\n if check.has_key? dep.name\n check[dep.name] = !check[dep.name]\n end\n end\n \n # now since excluded gems start as true, inverting them\n # makes them false so we'll skip this gem if any excludes are found\n if (check.select {|name,test| !test}).length == 0\n # looks like no needs were set to false, so it's good\n if gem.metadata[\"zergrushplugin\"] != nil\n require File.join(gem.gem_dir, \"lib\", gem.name, \"init.rb\")\n @gems[gem.name] = gem.gem_dir\n end\n end\n }\n \n return nil\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def referenced_libraries\n # TODO: check content type before scanning\n content.scan(%r{\\s*needs\\s+[\\\"\\'](.+)/(.+)[\\\"\\']}).map { |a, b| a + '/' + b }.uniq\n end", "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def fr\n set = Set.new []\n @actions.each { |a| set.merge(a[:requires]) }\n set.subtract @actions.map { |a| a[:provide] }\n return set.to_a\n end", "def test_dependencies\n []\n end", "def test_dependencies\n []\n end", "def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end", "def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def requirements\n @requirements ||= []\n end", "def requirements\n unless @reqs\n @reqs = []\n @reqs << Requirement.new(:feature, {:feature => self['feature']}, plugin) if self['feature']\n end\n @reqs\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def dependencies_for(specification)\n []\n end", "def gemspecs; end", "def needs(*libraries)\n if libraries.empty?\n @needs ||= [ ]\n else\n needs.push(*libraries.flatten)\n end\n end", "def find_issues_by_gem(string = \"\")\n issues = []\n @security_checks.each do |check|\n if check.kind == Dawn::KnowledgeBase::DEPENDENCY_CHECK or check.kind == Dawn::KnowledgeBase::UNSAFE_DEPENDENCY_CHECK\n debug_me \"applying check #{check.name}\"\n name = string.split(':')[0]\n version = string.split(':')[1]\n check.please_ignore_dep_version = true if version.nil?\n check.dependencies = [{:name=>name, :version=>version}]\n issues << check if check.vuln?\n end\n end\n debug_me \"#{issues}\"\n return issues\n end", "def requires(*paths)\n @requires.concat(paths) unless paths.empty?\n @requires\n end", "def dependencies\n to_a.reject { |a| a.filename.eql?(self.filename) }\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def os_dependencies\n []\n end", "def conflicts\n conflicts = {}\n self.runtime_dependencies.each do |dep|\n spec = Gem.loaded_specs[dep.name]\n if spec and not spec.satisfies_requirement? dep\n (conflicts[spec] ||= []) << dep\n end\n end\n env_req = Gem.env_requirement(name)\n (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version\n conflicts\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def dependencies\n spec.dependencies\n end", "def dependencies\n spec.dependencies\n end", "def requires(*args)\n normalize_list(args).each do |dependency|\n @available.add_required(dependency)\n end\n end", "def extra_gem_files(gem = nil)\n gem ||= upstream_gem\n pkg_extra = {}\n pkg_files.each do |pkg, files|\n extra = files.select { |spec_file| !gem.has_file_satisfied_by?(spec_file) }\n pkg_extra[pkg] = extra unless extra.empty?\n end\n pkg_extra\n end", "def find_all req\n res = []\n\n return res unless @remote\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def requireds\n\t\tHash[ select {|i,f| f.required? } ]\n\tend", "def find_all(req)\n res = []\n\n dep = req.dependency\n\n return res if @ignore_dependencies and\n @always_install.none? {|spec| dep.match? spec }\n\n name = dep.name\n\n dep.matching_specs.each do |gemspec|\n next if @always_install.any? {|spec| spec.name == gemspec.name }\n\n res << Gem::Resolver::InstalledSpecification.new(self, gemspec)\n end unless @ignore_installed\n\n if consider_local?\n matching_local = @local.values.select do |spec, _|\n req.match? spec\n end.map do |spec, source|\n Gem::Resolver::LocalSpecification.new self, spec, source\n end\n\n res.concat matching_local\n\n begin\n if local_spec = @local_source.find_gem(name, dep.requirement)\n res << Gem::Resolver::IndexSpecification.new(\n self, local_spec.name, local_spec.version,\n @local_source, local_spec.platform)\n end\n rescue Gem::Package::FormatError\n # ignore\n end\n end\n\n res.delete_if do |spec|\n spec.version.prerelease? and not dep.prerelease?\n end\n\n res.concat @remote_set.find_all req if consider_remote?\n\n res\n end", "def development_requirements\n requirements.select do |requirement|\n ! requirements.runtime?\n end\n end", "def dependencies\n EMPTY_SET\n end", "def packages_from_require(rpmdep)\n refresh\n @rpmdb.whatprovides(rpmdep)\n end", "def r(*gems)\n gems.map {|g| require g.to_s}\nend" ]
[ "0.79319245", "0.79319245", "0.78823376", "0.7619221", "0.753511", "0.73787093", "0.7367521", "0.7321788", "0.7284858", "0.71854585", "0.7130878", "0.7130878", "0.71234214", "0.7118899", "0.70503414", "0.7048146", "0.6934306", "0.68147767", "0.68147767", "0.67969376", "0.67712116", "0.6759594", "0.6755326", "0.673945", "0.67106485", "0.6694702", "0.66484815", "0.6641562", "0.6572503", "0.65457", "0.652339", "0.6489395", "0.6476768", "0.6471269", "0.6461149", "0.6459016", "0.64582723", "0.64449525", "0.6432173", "0.6431836", "0.64303076", "0.6412349", "0.6393728", "0.6345858", "0.63361824", "0.6335765", "0.6314924", "0.6310085", "0.62956315", "0.6254128", "0.62529725", "0.62529725", "0.6252294", "0.62393665", "0.62357527", "0.62329644", "0.62313783", "0.62289095", "0.62249714", "0.62014544", "0.62003", "0.6194354", "0.6186908", "0.6172853", "0.61725426", "0.61644006", "0.61582935", "0.6151459", "0.6149115", "0.6144093", "0.6144093", "0.6142024", "0.61409694", "0.6139035", "0.6137705", "0.61153287", "0.61149305", "0.61118746", "0.6111119", "0.6088465", "0.60875124", "0.6080035", "0.6070706", "0.60437727", "0.6039569", "0.6035847", "0.6015133", "0.6014837", "0.60037345", "0.6000027", "0.6000027", "0.59936416", "0.5992925", "0.59831166", "0.5979212", "0.59791684", "0.5975869", "0.5968598", "0.5966473", "0.59629166" ]
0.85777974
0
Return all non gem BuildRequires
def non_gem_build_requirements @metadata[:build_requires].nil? ? [] : @metadata[:build_requires].select { |r| !r.gem? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def all_requires\n []\n end", "def all_requires\n []\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def requires\n require_items.collect(&:package)\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def runtime_specific_gems\n []\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def development_requirements\n requirements.select do |requirement|\n ! requirements.runtime?\n end\n end", "def requires\n self.class::Requirements[@version] || self.class::Requirements[:all] || {}\n end", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def os_dependencies\n []\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def requires\n []\n end", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def require_gems; end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end", "def default_requires\n PackageList.new\n end", "def build_gems; end", "def package_depends_on\n depends_on\n end", "def dependencies\n []\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def load(needs = {})\n needs = needs.merge({\"zergrush\" => INCLUDE})\n \n Gem::Specification.each { |gem|\n # don't load gems more than once\n next if @gems.has_key? gem.name \n check = needs.dup\n\n # rolls through the depends and inverts anything it finds\n gem.dependencies.each do |dep|\n # this will fail if a gem is depended more than once\n if check.has_key? dep.name\n check[dep.name] = !check[dep.name]\n end\n end\n \n # now since excluded gems start as true, inverting them\n # makes them false so we'll skip this gem if any excludes are found\n if (check.select {|name,test| !test}).length == 0\n # looks like no needs were set to false, so it's good\n if gem.metadata[\"zergrushplugin\"] != nil\n require File.join(gem.gem_dir, \"lib\", gem.name, \"init.rb\")\n @gems[gem.name] = gem.gem_dir\n end\n end\n }\n \n return nil\n end", "def all_package_names\n each_autobuild_package.map(&:name)\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def required_dependencies\n dependencies - optional_dependencies\n end", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def requirements\n []\n end", "def getDeps csproj\r\n deps = []\r\n csproj.search(\"reference\") do |ref|\r\n deps << ref.get_attribute(\"include\").match(/^([^,]+),*/)[1]\r\n end\r\n return deps\r\nend", "def dependencies\n self.config.depends || []\n end", "def buildable\n b = []\n bts_here = @buildings.map { |b| b.type }\n BuildingType.all.each do |bt|\n if not bts_here.include? bt and bts_here.include? bt.prerequisite \\\n and residents.length >= bt.min_colony\n b << bt\n end\n end\n return b\n end", "def has_all_requirements_for?(gem_dep)\n reqs = self.requirements_for_gem gem_dep.name\n # create a spec requirement dependency for each expanded subrequirement,\n # verify we can find a match for that\n gem_dep.requirement.to_s.split(',').all? { |greq|\n Gem2Rpm::Helpers.expand_requirement([greq.split]).all? { |ereq|\n tereq = Requirement.new :name => \"#{requirement_prefix}(#{gem_dep.name})\",\n :condition => ereq.first,\n :version => ereq.last.to_s\n reqs.any? { |req| req.matches?(tereq)}\n }\n }\n end", "def referenced_libraries\n # TODO: check content type before scanning\n content.scan(%r{\\s*needs\\s+[\\\"\\'](.+)/(.+)[\\\"\\']}).map { |a, b| a + '/' + b }.uniq\n end", "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def dependencies\n []\n end", "def get_all_requires(code = @code)\n if code.is_a?(Array) then\n requires = (code.select { |sub| is_require?(sub) }).map! do |sub|\n get_require(sub)\n end\n code.each do |sub|\n requires += get_all_requires(sub)\n end\n return requires\n else\n return []\n end\n end", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def filtered_dependencies(pkginfo, with_rock_release_prefix = true)\n target_platform = @packager.target_platform\n this_rock_release = TargetPlatform.new(@packager.rock_release_name, target_platform.architecture)\n\n deps_rock_pkginfos = pkginfo.dependencies[:rock_pkginfo].dup\n deps_osdeps_packages = pkginfo.dependencies[:osdeps].dup\n non_native_dependencies = pkginfo.dependencies[:nonnative].dup\n\n if target_platform.distribution_release_name\n # CASTXML vs. GCCXML in typelib\n if pkginfo.name =~ /typelib$/\n # add/remove the optional dependencies on the\n # rock-package depending on the target platform\n # there are typelib versions with and without the\n # optional depends. we know which platform requires\n # a particular dependency.\n deps_rock_pkginfos.delete_if do |pkginfo|\n pkginfo.name == \"castxml\" || pkginfo.name == \"gccxml\"\n end\n\n if target_platform.contains(\"castxml\")\n deps_osdeps_packages.push(\"castxml\")\n elsif target_platform.contains(\"gccxml\")\n #todo: these need to checked on the other platforms\n deps_osdeps_packages.push(\"gccxml\")\n else\n raise ArgumentError, \"TargetPlatform: #{target_platform} does neither support castxml nor gccml - cannot build typelib\"\n end\n end\n\n # Filter out optional packages, e.g. llvm and clang for all platforms where not explicitly available\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n result = true\n Packaging::Config.packages_optional.each do |pkg_name|\n regex = Regexp.new(pkg_name)\n if regex.match(name)\n result = target_platform.contains(name)\n end\n end\n result\n end\n\n # Filter out excluded packages, e.g. libqwt5-qt4-dev\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n result = true\n Packaging::Config.packages_excluded.each do |pkg_name|\n regex = Regexp.new(pkg_name)\n if regex.match(name)\n Packager.info \"#{pkginfo.name} excluding osdeps #{pkg_name} as dependency\"\n result = false\n end\n end\n result\n end\n\n # Filter ruby versions out -- we assume chroot has installed all\n # ruby versions\n #\n # This is a workaround, since the information about required packages\n # comes from the build server platform and might not correspond\n # with the target platform\n #\n # Right approach: bootstrap within chroot and generate source packages\n # in the chroot\n #deps_osdeps_packages = deps[:osdeps].select do |name|\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n name !~ /^ruby[0-9][0-9.]*/\n end\n\n # Prefer package of the OS for gems if they are available there\n #deps_nonnative_packages = deps[:nonnative].map do |name, version|\n non_native_dependencies = non_native_dependencies.map do |name, version|\n dep_name,is_osdep = native_dependency_name(name)\n # if with_rock_release_prefix is given all packages 'have to be'\n # os dependencies, otherwise it triggers further resolution of nonnative packages\n # which cannot exist (in resolve_all)\n if is_osdep || with_rock_release_prefix\n deps_osdeps_packages << dep_name\n nil\n else\n name\n end\n end.compact\n end\n\n deps_rock_packages = deps_rock_pkginfos.map do |pkginfo|\n debian_name = @packager.debian_name(pkginfo, with_rock_release_prefix)\n this_rock_release.packageReleaseName(debian_name)\n end.sort\n\n Packager.info \"'#{pkginfo.name}' with (available) rock package dependencies: '#{deps_rock_packages}'\"\n Packager.info \"'#{pkginfo.name}' with (available) osdeps dependencies: '#{deps_osdeps_packages}'\"\n\n # Return rock packages, osdeps and non native deps (here gems)\n {:rock => deps_rock_packages, :osdeps => deps_osdeps_packages, :nonnative => non_native_dependencies }\n end", "def required(gem_name, gem_install_name = nil)\n Required::required gem_name, gem_install_name\nend", "def deps(pkg) # FIXME: \"*** PACKAGE MAY NOT BE DELETED *** \"\n if pkg.status != :available\n components = `#{@cmd} -n #{pkg.name}`.split(\"Requires:\\n\")\n if components.size > 1\n return components[1].strip\n else\n return \"[No depends]\"\n end\n else\n if File.exist?(File.expand_path(\"~/Library/Application Support/Guigna/pkgsrc/INDEX\"))\n # TODO: parse INDEX\n end\n \"[Not available]\"\n end\n end", "def dependencies\n []\n end", "def optimized_gems\n optimized_gems = @gems.reject { |gem| @redundant_gems.include? gem }\n optimized_gems.empty? ? false : optimized_gems.uniq.sort\n end", "def manifest_dependencies()\n as_bundle = Bundle.fromProject(self)\n as_bundle.nil? ? [] : as_bundle.bundles.collect{|b| b.resolve}.compact + as_bundle.imports.collect {|i| i.resolve}.flatten\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def requirements\n @requirements ||= []\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def dependencies\n @dependencies ||= ElmPackage.dependencies 'elm-package.json',\n silent: false\n end", "def extra_gem_files(gem = nil)\n gem ||= upstream_gem\n pkg_extra = {}\n pkg_files.each do |pkg, files|\n extra = files.select { |spec_file| !gem.has_file_satisfied_by?(spec_file) }\n pkg_extra[pkg] = extra unless extra.empty?\n end\n pkg_extra\n end", "def test_dependencies\n []\n end", "def test_dependencies\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def excludes_dev_dep?(gem_name)\n excluded_dev_deps.any? { |d| d.name == gem_name }\n end", "def required_if_used(*args)\n unless @required_gems\n [:included, :extended, :inherited].each do |method_name|\n define_method(method_name) do |klass|\n super if defined?(super)\n @required_gems.each { |gem| require gem.to_s }\n end\n end\n end\n @required_gems ||= []\n @required_gems |= args\n end", "def conflicts\n conflicts = {}\n self.runtime_dependencies.each do |dep|\n spec = Gem.loaded_specs[dep.name]\n if spec and not spec.satisfies_requirement? dep\n (conflicts[spec] ||= []) << dep\n end\n end\n env_req = Gem.env_requirement(name)\n (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version\n conflicts\n end", "def common_gems(gemsets) \n common_gems = self.each_value.find_all do |gce| \n gce.in_all_gemsets_but_global? gemsets \n end\n end", "def build_dependencies(pkginfo)\n dependencies = []\n pkgdeps = pkginfo.dependencies\n deps = pkgdeps[:rock_pkginfo].select do |pkginfo|\n pkg_name = debian_name(pkginfo, true)\n !rock_release_platform.ancestorContains(pkg_name)\n end .map { |p| p.name }\n\n gems = pkgdeps[:nonnative].select do |gem,version|\n pkg_ruby_name = debian_ruby_name(gem, false)\n pkg_prefixed_name = debian_ruby_name(gem, true)\n\n !( rock_release_platform.ancestorContains(gem) ||\n rock_release_platform.ancestorContains(pkg_ruby_name) ||\n rock_release_platform.ancestorContains(pkg_prefixed_name))\n end .map{ |p| p[0] }\n\n deps.concat(gems)\n deps\n end", "def gemspecs; end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def development_dependencies\n dependencies.select {|d| d.type == :development }\n end", "def needs(*libraries)\n if libraries.empty?\n @needs ||= [ ]\n else\n needs.push(*libraries.flatten)\n end\n end", "def runtime_requirements\n requirements.select do |requirement|\n requirements.runtime?\n end\n end", "def gems\n @gems ||= begin\n gems = locks.dup\n gems.each do |name, g|\n if gem_declarations.has_key?(name)\n g[:declared_groups] = gem_declarations[name][:groups]\n else\n g[:declared_groups] = []\n end\n g[:groups] = g[:declared_groups].dup\n end\n # Transitivize groups (since dependencies are already transitive, this is easy)\n gems.each do |name, g|\n g[:dependencies].each do |dep|\n gems[dep][:groups] |= gems[name][:declared_groups].dup\n end\n end\n gems\n end\n end", "def check_all_packages\n packages_not_installed = []\n Constants::PACKAGES.each do |pkg|\n string = \"Looking for package #{pkg}...\"\n installed = check_package(pkg)\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append package name to packages_not_installed list\n packages_not_installed << pkg\n end #if\n end #do\n \n packages_not_installed\n end", "def requires(database)\n fail \"Extension #{name} not (yet) installed\" unless installed?(database)\n\n stmt = if version\n <<-SQL\n SELECT unnest(requires) as name FROM\n ( SELECT requires FROM pg_available_extension_versions where name='#{name}' AND version ='#{version}') t\n SQL\n else\n <<-SQL\n SELECT unnest(requires) as name FROM\n (SELECT requires FROM\n pg_available_extensions a\n JOIN pg_available_extension_versions v ON v.name = a.name AND a.default_version = v.version\n WHERE v.name = '#{name}')t\n SQL\n end\n\n result = database.execute(stmt).to_a\n\n requires = result.map{|r| r['name']}\n end", "def core_dependencies\n @_core_dependencies ||= begin\n if gem_dir\n Gem.clear_paths; Gem.path.unshift(gem_dir)\n end\n deps = []\n merb_core = Gem::Dependency.new('merb-core', '>= 0.9.8')\n if gemspec = Gem.source_index.search(merb_core).last\n deps << Gem::Dependency.new('merb-core', gemspec.version)\n deps += gemspec.dependencies\n end\n Gem.clear_paths\n deps\n end\n end" ]
[ "0.808794", "0.7988304", "0.7581043", "0.7581043", "0.7405697", "0.74054605", "0.72203654", "0.71572477", "0.7083293", "0.70512027", "0.70512027", "0.69212645", "0.6918513", "0.6918513", "0.68823165", "0.676585", "0.67218244", "0.6675017", "0.6646113", "0.6634509", "0.66246617", "0.6566428", "0.64889497", "0.6473311", "0.6450789", "0.6426678", "0.6350461", "0.63486546", "0.6337128", "0.6337128", "0.63351464", "0.63341963", "0.63150066", "0.6311192", "0.63069", "0.6283612", "0.62664896", "0.6261252", "0.6208938", "0.6202474", "0.6192178", "0.6184534", "0.6178148", "0.61716676", "0.6167521", "0.614091", "0.6130944", "0.6122587", "0.61205745", "0.6118038", "0.6042359", "0.60349816", "0.6033481", "0.6032519", "0.6025045", "0.60235316", "0.6012386", "0.6004256", "0.5999886", "0.59924006", "0.5987578", "0.5980075", "0.5978489", "0.59776163", "0.5972349", "0.59629136", "0.5959663", "0.59497535", "0.5946009", "0.59425306", "0.59386796", "0.5934711", "0.5923502", "0.59171534", "0.5915348", "0.5915012", "0.5914532", "0.5914063", "0.5908656", "0.58961684", "0.58930546", "0.5891199", "0.5891199", "0.5890921", "0.5890921", "0.5890921", "0.5889758", "0.5886239", "0.58796746", "0.5878242", "0.586749", "0.5866533", "0.58638203", "0.5858458", "0.58461255", "0.58434516", "0.5842642", "0.5841765", "0.5838419", "0.5822063" ]
0.86879677
0
Return all gem requirements _not_ in the specified gem
def extra_gem_requirements(gem) gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten gem_requirements - gem_reqs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def extra_gem_build_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_build_requirements - gem_reqs\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def extra_gem_files(gem = nil)\n gem ||= upstream_gem\n pkg_extra = {}\n pkg_files.each do |pkg, files|\n extra = files.select { |spec_file| !gem.has_file_satisfied_by?(spec_file) }\n pkg_extra[pkg] = extra unless extra.empty?\n end\n pkg_extra\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def excludes_dev_dep?(gem_name)\n excluded_dev_deps.any? { |d| d.name == gem_name }\n end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def missing_files_for(gem)\n # we check for files in the gem for which there are no spec files\n # corresponding to gem file or directory which it resides in\n gem.file_paths.select { |gem_file| missing_gem_file?(gem_file) }\n end", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def require_without_bundler(*gems)\n unless defined?(::Bundler)\n gems.each { |g| require g }\n return\n end\n Dir.glob(\"#{Gem.path.first}/gems/*\").map { |gem_path| \n gem_name=File.basename(gem_path).gsub(/-(\\d\\.?)+$/,'')\n if gems.include?(gem_name)\n $LOAD_PATH << \"#{gem_path}/lib\"\n require gem_name\n end\n }\nend", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def all_requires\n []\n end", "def all_requires\n []\n end", "def unfulfilled_requirements(framework=nil,reset=false)\n @unfulfilled_requirements ||= Hash.new\n framework ||= fund_source.framework\n @unfulfilled_requirements[framework] = nil if reset\n @unfulfilled_requirements[framework] ||= requestor_memberships(reset).requestor.\n inject({}) { |memo, membership|\n framework.requirements.unfulfilled_by(membership).each do |requirement|\n target = membership.send( requirement.fulfiller_type.underscore.to_sym )\n memo[ target ] ||= []\n memo[ target ] << requirement\n end\n memo\n }.each { |k,v| v.uniq! }\n end", "def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def ignore_conditions_for(options, dependency)\n # Find where the name matches then get an array of version requirements, e.g. [\"4.x\", \"5.x\"]\n found = options.find { |ig| dependency.name.match?(ig['name']) }\n found ? found['versions'] || [] : []\nend", "def gems_from_manifest(manifest='.gems')\n gems = File.read(manifest).split(\"\\n\")\n gems.reject { |name| name =~ /^\\s*(#|$)/ }\n end", "def get_bad_requirements(profile)\n bad_reqs = []\n @requirements.each do |rk, v|\n k = rk.to_sym\n expected = k != :vuln_test ? v : 'true'\n\n vprint_status(\"Comparing requirement: #{k}=#{expected} vs #{k}=#{profile[k]}\")\n\n if k == :activex\n bad_reqs << k if has_bad_activex?(profile[k])\n elsif k == :vuln_test\n bad_reqs << k unless profile[k].to_s == 'true'\n elsif v.is_a? Regexp\n bad_reqs << k if profile[k] !~ v\n elsif v.is_a? Proc\n bad_reqs << k unless v.call(profile[k])\n else\n bad_reqs << k if profile[k] != v\n end\n end\n\n bad_reqs\n end", "def requirements\n []\n end", "def requires\n require_items.collect(&:package)\n end", "def find_specs_without_tasks\n spec_file_names.reject do |spec|\n manifest = Noop::Utils.convert_to_manifest spec\n task_file_names.include? manifest\n end\n end", "def find_issues_by_gem(string = \"\")\n issues = []\n @security_checks.each do |check|\n if check.kind == Dawn::KnowledgeBase::DEPENDENCY_CHECK or check.kind == Dawn::KnowledgeBase::UNSAFE_DEPENDENCY_CHECK\n debug_me \"applying check #{check.name}\"\n name = string.split(':')[0]\n version = string.split(':')[1]\n check.please_ignore_dep_version = true if version.nil?\n check.dependencies = [{:name=>name, :version=>version}]\n issues << check if check.vuln?\n end\n end\n debug_me \"#{issues}\"\n return issues\n end", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def development_requirements\n requirements.select do |requirement|\n ! requirements.runtime?\n end\n end", "def has_all_requirements_for?(gem_dep)\n reqs = self.requirements_for_gem gem_dep.name\n # create a spec requirement dependency for each expanded subrequirement,\n # verify we can find a match for that\n gem_dep.requirement.to_s.split(',').all? { |greq|\n Gem2Rpm::Helpers.expand_requirement([greq.split]).all? { |ereq|\n tereq = Requirement.new :name => \"#{requirement_prefix}(#{gem_dep.name})\",\n :condition => ereq.first,\n :version => ereq.last.to_s\n reqs.any? { |req| req.matches?(tereq)}\n }\n }\n end", "def each_excluded_package\n return enum_for(__method__) unless block_given?\n\n each_autobuild_package do |pkg|\n yield(pkg) if excluded?(pkg.name)\n end\n end", "def gem_requirements_from_array(what, array)\n array.map do |dep|\n Gem::Dependency.new(what, *dep)\n end\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def conflicts\n conflicts = {}\n self.runtime_dependencies.each do |dep|\n spec = Gem.loaded_specs[dep.name]\n if spec and not spec.satisfies_requirement? dep\n (conflicts[spec] ||= []) << dep\n end\n end\n env_req = Gem.env_requirement(name)\n (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version\n conflicts\n end", "def runtime_specific_gems\n []\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def unverifiable_packages\n published_packages.keys.select {|p| !expected_cksums.any? {|m| m[\"relpath\"] == p } }\n end", "def requirements\n []\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name full_name\n\n siblings = @specs.find_all { |s|\n s.name == gem_to_remove.name &&\n s.full_name != gem_to_remove.full_name\n }\n\n deps = []\n\n @specs.each do |spec|\n spec.dependencies.each do |dep|\n deps << dep if gem_to_remove.satisfies_requirement?(dep)\n end\n end\n\n deps.all? { |dep|\n siblings.any? { |s|\n s.satisfies_requirement? dep\n }\n }\n end", "def supplies_excluding_tax\n self.supplies.select{|p| not p[:including_tax]}\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def released_specs\n specs.select { |s| not s.prerelease? }\n end", "def reverse_dependencies(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.dependencies.any? {|e| e.name == rubygem && e.type == :runtime}}.\n map {|e| \"#{e.name}-#{e.version}\" }\n end", "def dependents_exclude_self\n dependents.where.not(id: id)\n end", "def dependencies_for(specification)\n []\n end", "def excluded_files\n # TODO: also append files marked as %{exclude} (or handle elsewhere?)\n missing_files_for(upstream_gem)\n end", "def desired_gems(list_of_gems)\n specified_gems = []\n list_of_gems.each do |g| \n if self.has_key? g\n specified_gems << self[g]\n else\n specified_gems << \"'#{g}' not found in any gemset\"\n end\n end\n\n specified_gems\n end", "def excluded_elements(used_elements)\n excluded = used_elements\n if exclude_dependent?\n excluded += used_elements.inject([]) {|m, elem| m += elem.dependencies; m}.flatten\n end\n excluded\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def spec_set\n Bundler.locked_gems.specs\n end", "def find_all(req)\n res = []\n\n dep = req.dependency\n\n return res if @ignore_dependencies and\n @always_install.none? {|spec| dep.match? spec }\n\n name = dep.name\n\n dep.matching_specs.each do |gemspec|\n next if @always_install.any? {|spec| spec.name == gemspec.name }\n\n res << Gem::Resolver::InstalledSpecification.new(self, gemspec)\n end unless @ignore_installed\n\n if consider_local?\n matching_local = @local.values.select do |spec, _|\n req.match? spec\n end.map do |spec, source|\n Gem::Resolver::LocalSpecification.new self, spec, source\n end\n\n res.concat matching_local\n\n begin\n if local_spec = @local_source.find_gem(name, dep.requirement)\n res << Gem::Resolver::IndexSpecification.new(\n self, local_spec.name, local_spec.version,\n @local_source, local_spec.platform)\n end\n rescue Gem::Package::FormatError\n # ignore\n end\n end\n\n res.delete_if do |spec|\n spec.version.prerelease? and not dep.prerelease?\n end\n\n res.concat @remote_set.find_all req if consider_remote?\n\n res\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name(full_name)\n siblings = @specs.find_all { |s|\n\ts.name == gem_to_remove.name &&\n\t s.full_name != gem_to_remove.full_name\t\n }\n deps = []\n @specs.each do |spec|\n\tspec.dependencies.each do |dep|\n\t deps << dep if gem_to_remove.satisfies_requirement?(dep)\n\tend\n end\n deps.all? { |dep|\n\tsiblings.any? { |s| \n\t s.satisfies_requirement?(dep)\n\t}\n }\n end", "def unfulfilled_requirements_for(*fulfillers)\n options = fulfillers.extract_options!\n fulfillers.flatten.inject({}) do |memo, fulfiller|\n unless unfulfilled_requirements(options[:framework])[ fulfiller ].blank?\n memo[ fulfiller ] = unfulfilled_requirements(options[:framework])[ fulfiller ]\n end\n memo\n end\n end", "def gemspecs\n return [] if directory.empty? || directory == '*'\n @gemspecs ||= Dir[File.join(directory, '**/*.gemspec')].select do |gs|\n config.allow? gs\n end\n end", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def require_gems; end", "def parse_required(input)\n gemspecs = []\n input.split(\"\\n\").grep(/^no such file to load -- (.+)\\s*$/) do |line|\n gemspecs << {:name => $1.strip}\n end\n gemspecs\n end", "def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end", "def exclude_package(package_name, reason)\n package = validate_package_name_argument(\n package_name, require_existing: false\n )\n if (meta = find_metapackage(package))\n meta.each_package do |pkg|\n automatic_exclusions[pkg.name] =\n \"#{meta.name} is an excluded metapackage, \"\\\n \"and it includes #{pkg.name}: #{reason}\"\n end\n else\n automatic_exclusions[package] = reason\n end\n end", "def requires\n []\n end", "def requirements\n unless @reqs\n @reqs = []\n @reqs << Requirement.new(:feature, {:feature => self['feature']}, plugin) if self['feature']\n end\n @reqs\n end", "def dependencies\n to_a.reject { |a| a.filename.eql?(self.filename) }\n end", "def required(gem_name, gem_install_name = nil)\n Required::required gem_name, gem_install_name\nend", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def find_unmatched_specs\n spec_file_names.reject do |spec|\n next true if spec == Noop::Config.spec_name_globals\n task_list.any? do |task|\n task.file_name_spec == spec\n end\n end\n end", "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def search(gem_pattern, version_requirement=Version::Requirement.new(\">= 0\"))\n gem_pattern = /#{ gem_pattern }/i if String === gem_pattern\n version_requirement = Gem::Version::Requirement.create(version_requirement)\n result = []\n @gems.each do |full_spec_name, spec|\n next unless spec.name =~ gem_pattern\n result << spec if version_requirement.satisfied_by?(spec.version)\n end\n result = result.sort\n result\n end", "def legitimize! deps = entries\n specs = []\n\n deps.flatten.each do |dep|\n spec = case dep\n when Gem::Dependency then\n begin\n dep.to_spec\n rescue Gem::LoadError\n nil\n end\n when Isolate::Entry then\n dep.specification\n else\n raise \"unknown dep: #{dep.inspect}\"\n end\n\n if spec then\n specs.concat legitimize!(spec.runtime_dependencies)\n specs << spec\n end\n end\n\n specs.uniq\n end", "def requirements\n @requirements ||= []\n end", "def find_gems(match, options={})\n return [] unless defined?(::Gem)\n ::Gem.search(match)\n end", "def search(gem_pattern, version_requirement=Version::Requirement.new(\">= 0\"))\n #FIXME - remove duplication between this and RemoteInstaller.search\n gem_pattern = /#{ gem_pattern }/i if String === gem_pattern\n version_requirement = Gem::Version::Requirement.create(version_requirement)\n result = []\n @gems.each do |full_spec_name, spec|\n next unless spec.name =~ gem_pattern\n result << spec if version_requirement.satisfied_by?(spec.version)\n end\n result = result.sort\n result\n end", "def load(needs = {})\n needs = needs.merge({\"zergrush\" => INCLUDE})\n \n Gem::Specification.each { |gem|\n # don't load gems more than once\n next if @gems.has_key? gem.name \n check = needs.dup\n\n # rolls through the depends and inverts anything it finds\n gem.dependencies.each do |dep|\n # this will fail if a gem is depended more than once\n if check.has_key? dep.name\n check[dep.name] = !check[dep.name]\n end\n end\n \n # now since excluded gems start as true, inverting them\n # makes them false so we'll skip this gem if any excludes are found\n if (check.select {|name,test| !test}).length == 0\n # looks like no needs were set to false, so it's good\n if gem.metadata[\"zergrushplugin\"] != nil\n require File.join(gem.gem_dir, \"lib\", gem.name, \"init.rb\")\n @gems[gem.name] = gem.gem_dir\n end\n end\n }\n \n return nil\n end", "def find_all req\n res = []\n\n return res unless @remote\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def optimized_gems\n optimized_gems = @gems.reject { |gem| @redundant_gems.include? gem }\n optimized_gems.empty? ? false : optimized_gems.uniq.sort\n end", "def requires(database)\n fail \"Extension #{name} not (yet) installed\" unless installed?(database)\n\n stmt = if version\n <<-SQL\n SELECT unnest(requires) as name FROM\n ( SELECT requires FROM pg_available_extension_versions where name='#{name}' AND version ='#{version}') t\n SQL\n else\n <<-SQL\n SELECT unnest(requires) as name FROM\n (SELECT requires FROM\n pg_available_extensions a\n JOIN pg_available_extension_versions v ON v.name = a.name AND a.default_version = v.version\n WHERE v.name = '#{name}')t\n SQL\n end\n\n result = database.execute(stmt).to_a\n\n requires = result.map{|r| r['name']}\n end", "def required_if_used(*args)\n unless @required_gems\n [:included, :extended, :inherited].each do |method_name|\n define_method(method_name) do |klass|\n super if defined?(super)\n @required_gems.each { |gem| require gem.to_s }\n end\n end\n end\n @required_gems ||= []\n @required_gems |= args\n end", "def find_all(req)\n @specs.values.select do |spec|\n req.match? spec\n end.map do |spec|\n source = Gem::Source::Vendor.new @directories[spec]\n Gem::Resolver::VendorSpecification.new self, spec, source\n end\n end", "def select_gems(groups: nil, without_groups: nil)\n # First, select the gems that match\n result = {}\n gems.each do |name, g|\n dep_groups = g[:declared_groups] - [ :only_a_runtime_dependency_of_other_gems ]\n dep_groups &= groups if groups\n dep_groups -= without_groups if without_groups\n if dep_groups.any?\n result[name] ||= g\n g[:dependencies].each do |dep|\n result[dep] ||= gems[dep]\n end\n end\n end\n result\n end", "def extensions_missing(exts)\n Set.new(exts.flatten).difference extensions.to_set\n end" ]
[ "0.8257661", "0.7702284", "0.7477817", "0.72195125", "0.721228", "0.721228", "0.7163211", "0.6948373", "0.69211704", "0.683421", "0.675336", "0.6680801", "0.6593968", "0.6494068", "0.6431585", "0.64080715", "0.63658845", "0.63550377", "0.6280481", "0.6278009", "0.6274777", "0.6252597", "0.6248142", "0.62443846", "0.62373316", "0.62209827", "0.615859", "0.61585206", "0.6142126", "0.6093035", "0.6093035", "0.6087667", "0.6076627", "0.60752094", "0.6056408", "0.603727", "0.60198563", "0.5998523", "0.5979216", "0.59665227", "0.5941929", "0.59371173", "0.59252656", "0.590074", "0.58878887", "0.5883708", "0.587086", "0.58430886", "0.5842856", "0.5817351", "0.58002317", "0.5794434", "0.5767767", "0.57671857", "0.576233", "0.5760158", "0.5746204", "0.5727743", "0.5719849", "0.5693354", "0.56759864", "0.56740505", "0.5665694", "0.5659355", "0.56586325", "0.5655419", "0.5651674", "0.5644866", "0.5631933", "0.563105", "0.56287926", "0.5611413", "0.5588328", "0.5578124", "0.55726", "0.5558522", "0.5556407", "0.5556231", "0.5550494", "0.5547235", "0.5542455", "0.5541767", "0.553997", "0.5539773", "0.5539408", "0.55165225", "0.5508091", "0.55075586", "0.54855776", "0.54824805", "0.54823494", "0.54810846", "0.5477733", "0.5475522", "0.547058", "0.5436784", "0.5433178", "0.543215", "0.5430972" ]
0.76191086
3
Return all gem build requirements _not_ in the specified gem
def extra_gem_build_requirements(gem) gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten gem_build_requirements - gem_reqs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def missing_dev_deps_for(gem)\n # Same note as in #missing_deps_for above\n gem.dev_deps.select { |dep| build_requirements_for_gem(dep.name).empty? }\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def find_redundant_gems_with_gem(args = {})\n gems = args[:gems] || @gems\n gems_with_deps = {}\n gems.each do |gem|\n output, status = Open3.capture2e(\"gem dependency #{gem}\")\n next unless status.success?\n deps = output.split(\"\\n\").map(&:strip)\n deps = deps.reject { |g| g.include? ', development' or g.include? 'Gem ' }\n deps = deps.map { |x| x.gsub(/\\s\\(.+\\)/, '') }\n gems_with_deps[gem] = deps\n end\n redundant_gems = []\n gems_with_deps.keys.each do |gem|\n next if gems_with_deps[gem].empty?\n gems_with_deps[gem].each do |g|\n redundant_gems << g if gems_with_deps.keys.include?(g)\n end\n end\n redundant_gems.uniq.each { |gem| @redundant_gems << gem unless @redundant_gems.include?(gem) }\n @redundant_gems\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def extra_gem_files(gem = nil)\n gem ||= upstream_gem\n pkg_extra = {}\n pkg_files.each do |pkg, files|\n extra = files.select { |spec_file| !gem.has_file_satisfied_by?(spec_file) }\n pkg_extra[pkg] = extra unless extra.empty?\n end\n pkg_extra\n end", "def excludes_dev_dep?(gem_name)\n excluded_dev_deps.any? { |d| d.name == gem_name }\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def development_requirements\n requirements.select do |requirement|\n ! requirements.runtime?\n end\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def unfulfilled_requirements(framework=nil,reset=false)\n @unfulfilled_requirements ||= Hash.new\n framework ||= fund_source.framework\n @unfulfilled_requirements[framework] = nil if reset\n @unfulfilled_requirements[framework] ||= requestor_memberships(reset).requestor.\n inject({}) { |memo, membership|\n framework.requirements.unfulfilled_by(membership).each do |requirement|\n target = membership.send( requirement.fulfiller_type.underscore.to_sym )\n memo[ target ] ||= []\n memo[ target ] << requirement\n end\n memo\n }.each { |k,v| v.uniq! }\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def missing_files_for(gem)\n # we check for files in the gem for which there are no spec files\n # corresponding to gem file or directory which it resides in\n gem.file_paths.select { |gem_file| missing_gem_file?(gem_file) }\n end", "def skipDeps(deps) \n deps = deps.select { |ding| !ding.include?(\"/commons-cli\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-logging\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-lang-2.1\") }\n deps = deps.select { |ding| !ding.include?(\"/commons-pool\") }\n return deps\nend", "def has_all_requirements_for?(gem_dep)\n reqs = self.requirements_for_gem gem_dep.name\n # create a spec requirement dependency for each expanded subrequirement,\n # verify we can find a match for that\n gem_dep.requirement.to_s.split(',').all? { |greq|\n Gem2Rpm::Helpers.expand_requirement([greq.split]).all? { |ereq|\n tereq = Requirement.new :name => \"#{requirement_prefix}(#{gem_dep.name})\",\n :condition => ereq.first,\n :version => ereq.last.to_s\n reqs.any? { |req| req.matches?(tereq)}\n }\n }\n end", "def runtime_specific_gems\n []\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def ignore_conditions_for(options, dependency)\n # Find where the name matches then get an array of version requirements, e.g. [\"4.x\", \"5.x\"]\n found = options.find { |ig| dependency.name.match?(ig['name']) }\n found ? found['versions'] || [] : []\nend", "def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def require_without_bundler(*gems)\n unless defined?(::Bundler)\n gems.each { |g| require g }\n return\n end\n Dir.glob(\"#{Gem.path.first}/gems/*\").map { |gem_path| \n gem_name=File.basename(gem_path).gsub(/-(\\d\\.?)+$/,'')\n if gems.include?(gem_name)\n $LOAD_PATH << \"#{gem_path}/lib\"\n require gem_name\n end\n }\nend", "def all_requires\n []\n end", "def all_requires\n []\n end", "def conflicts\n conflicts = {}\n self.runtime_dependencies.each do |dep|\n spec = Gem.loaded_specs[dep.name]\n if spec and not spec.satisfies_requirement? dep\n (conflicts[spec] ||= []) << dep\n end\n end\n env_req = Gem.env_requirement(name)\n (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version\n conflicts\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def requirements\n []\n end", "def gem_requirements_from_array(what, array)\n array.map do |dep|\n Gem::Dependency.new(what, *dep)\n end\n end", "def gems_from_manifest(manifest='.gems')\n gems = File.read(manifest).split(\"\\n\")\n gems.reject { |name| name =~ /^\\s*(#|$)/ }\n end", "def released_specs\n specs.select { |s| not s.prerelease? }\n end", "def find_issues_by_gem(string = \"\")\n issues = []\n @security_checks.each do |check|\n if check.kind == Dawn::KnowledgeBase::DEPENDENCY_CHECK or check.kind == Dawn::KnowledgeBase::UNSAFE_DEPENDENCY_CHECK\n debug_me \"applying check #{check.name}\"\n name = string.split(':')[0]\n version = string.split(':')[1]\n check.please_ignore_dep_version = true if version.nil?\n check.dependencies = [{:name=>name, :version=>version}]\n issues << check if check.vuln?\n end\n end\n debug_me \"#{issues}\"\n return issues\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def requires\n require_items.collect(&:package)\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def reverse_dependencies(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.dependencies.any? {|e| e.name == rubygem && e.type == :runtime}}.\n map {|e| \"#{e.name}-#{e.version}\" }\n end", "def get_bad_requirements(profile)\n bad_reqs = []\n @requirements.each do |rk, v|\n k = rk.to_sym\n expected = k != :vuln_test ? v : 'true'\n\n vprint_status(\"Comparing requirement: #{k}=#{expected} vs #{k}=#{profile[k]}\")\n\n if k == :activex\n bad_reqs << k if has_bad_activex?(profile[k])\n elsif k == :vuln_test\n bad_reqs << k unless profile[k].to_s == 'true'\n elsif v.is_a? Regexp\n bad_reqs << k if profile[k] !~ v\n elsif v.is_a? Proc\n bad_reqs << k unless v.call(profile[k])\n else\n bad_reqs << k if profile[k] != v\n end\n end\n\n bad_reqs\n end", "def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end", "def each_excluded_package\n return enum_for(__method__) unless block_given?\n\n each_autobuild_package do |pkg|\n yield(pkg) if excluded?(pkg.name)\n end\n end", "def optimized_gems\n optimized_gems = @gems.reject { |gem| @redundant_gems.include? gem }\n optimized_gems.empty? ? false : optimized_gems.uniq.sort\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def requirements\n []\n end", "def load(needs = {})\n needs = needs.merge({\"zergrush\" => INCLUDE})\n \n Gem::Specification.each { |gem|\n # don't load gems more than once\n next if @gems.has_key? gem.name \n check = needs.dup\n\n # rolls through the depends and inverts anything it finds\n gem.dependencies.each do |dep|\n # this will fail if a gem is depended more than once\n if check.has_key? dep.name\n check[dep.name] = !check[dep.name]\n end\n end\n \n # now since excluded gems start as true, inverting them\n # makes them false so we'll skip this gem if any excludes are found\n if (check.select {|name,test| !test}).length == 0\n # looks like no needs were set to false, so it's good\n if gem.metadata[\"zergrushplugin\"] != nil\n require File.join(gem.gem_dir, \"lib\", gem.name, \"init.rb\")\n @gems[gem.name] = gem.gem_dir\n end\n end\n }\n \n return nil\n end", "def gemspecs\n return [] if directory.empty? || directory == '*'\n @gemspecs ||= Dir[File.join(directory, '**/*.gemspec')].select do |gs|\n config.allow? gs\n end\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def legitimize! deps = entries\n specs = []\n\n deps.flatten.each do |dep|\n spec = case dep\n when Gem::Dependency then\n begin\n dep.to_spec\n rescue Gem::LoadError\n nil\n end\n when Isolate::Entry then\n dep.specification\n else\n raise \"unknown dep: #{dep.inspect}\"\n end\n\n if spec then\n specs.concat legitimize!(spec.runtime_dependencies)\n specs << spec\n end\n end\n\n specs.uniq\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def required(gem_name, gem_install_name = nil)\n Required::required gem_name, gem_install_name\nend", "def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end", "def unverifiable_packages\n published_packages.keys.select {|p| !expected_cksums.any? {|m| m[\"relpath\"] == p } }\n end", "def find_specs_without_tasks\n spec_file_names.reject do |spec|\n manifest = Noop::Utils.convert_to_manifest spec\n task_file_names.include? manifest\n end\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name full_name\n\n siblings = @specs.find_all { |s|\n s.name == gem_to_remove.name &&\n s.full_name != gem_to_remove.full_name\n }\n\n deps = []\n\n @specs.each do |spec|\n spec.dependencies.each do |dep|\n deps << dep if gem_to_remove.satisfies_requirement?(dep)\n end\n end\n\n deps.all? { |dep|\n siblings.any? { |s|\n s.satisfies_requirement? dep\n }\n }\n end", "def require_gems; end", "def filtered_dependencies(pkginfo, with_rock_release_prefix = true)\n target_platform = @packager.target_platform\n this_rock_release = TargetPlatform.new(@packager.rock_release_name, target_platform.architecture)\n\n deps_rock_pkginfos = pkginfo.dependencies[:rock_pkginfo].dup\n deps_osdeps_packages = pkginfo.dependencies[:osdeps].dup\n non_native_dependencies = pkginfo.dependencies[:nonnative].dup\n\n if target_platform.distribution_release_name\n # CASTXML vs. GCCXML in typelib\n if pkginfo.name =~ /typelib$/\n # add/remove the optional dependencies on the\n # rock-package depending on the target platform\n # there are typelib versions with and without the\n # optional depends. we know which platform requires\n # a particular dependency.\n deps_rock_pkginfos.delete_if do |pkginfo|\n pkginfo.name == \"castxml\" || pkginfo.name == \"gccxml\"\n end\n\n if target_platform.contains(\"castxml\")\n deps_osdeps_packages.push(\"castxml\")\n elsif target_platform.contains(\"gccxml\")\n #todo: these need to checked on the other platforms\n deps_osdeps_packages.push(\"gccxml\")\n else\n raise ArgumentError, \"TargetPlatform: #{target_platform} does neither support castxml nor gccml - cannot build typelib\"\n end\n end\n\n # Filter out optional packages, e.g. llvm and clang for all platforms where not explicitly available\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n result = true\n Packaging::Config.packages_optional.each do |pkg_name|\n regex = Regexp.new(pkg_name)\n if regex.match(name)\n result = target_platform.contains(name)\n end\n end\n result\n end\n\n # Filter out excluded packages, e.g. libqwt5-qt4-dev\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n result = true\n Packaging::Config.packages_excluded.each do |pkg_name|\n regex = Regexp.new(pkg_name)\n if regex.match(name)\n Packager.info \"#{pkginfo.name} excluding osdeps #{pkg_name} as dependency\"\n result = false\n end\n end\n result\n end\n\n # Filter ruby versions out -- we assume chroot has installed all\n # ruby versions\n #\n # This is a workaround, since the information about required packages\n # comes from the build server platform and might not correspond\n # with the target platform\n #\n # Right approach: bootstrap within chroot and generate source packages\n # in the chroot\n #deps_osdeps_packages = deps[:osdeps].select do |name|\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n name !~ /^ruby[0-9][0-9.]*/\n end\n\n # Prefer package of the OS for gems if they are available there\n #deps_nonnative_packages = deps[:nonnative].map do |name, version|\n non_native_dependencies = non_native_dependencies.map do |name, version|\n dep_name,is_osdep = native_dependency_name(name)\n # if with_rock_release_prefix is given all packages 'have to be'\n # os dependencies, otherwise it triggers further resolution of nonnative packages\n # which cannot exist (in resolve_all)\n if is_osdep || with_rock_release_prefix\n deps_osdeps_packages << dep_name\n nil\n else\n name\n end\n end.compact\n end\n\n deps_rock_packages = deps_rock_pkginfos.map do |pkginfo|\n debian_name = @packager.debian_name(pkginfo, with_rock_release_prefix)\n this_rock_release.packageReleaseName(debian_name)\n end.sort\n\n Packager.info \"'#{pkginfo.name}' with (available) rock package dependencies: '#{deps_rock_packages}'\"\n Packager.info \"'#{pkginfo.name}' with (available) osdeps dependencies: '#{deps_osdeps_packages}'\"\n\n # Return rock packages, osdeps and non native deps (here gems)\n {:rock => deps_rock_packages, :osdeps => deps_osdeps_packages, :nonnative => non_native_dependencies }\n end", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def excluded_files\n # TODO: also append files marked as %{exclude} (or handle elsewhere?)\n missing_files_for(upstream_gem)\n end", "def requirements\n @requirements ||= []\n end", "def gemspecs; end", "def unfulfilled_requirements_for(*fulfillers)\n options = fulfillers.extract_options!\n fulfillers.flatten.inject({}) do |memo, fulfiller|\n unless unfulfilled_requirements(options[:framework])[ fulfiller ].blank?\n memo[ fulfiller ] = unfulfilled_requirements(options[:framework])[ fulfiller ]\n end\n memo\n end\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def dependencies_for(specification)\n []\n end", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def requirements\n unless @reqs\n @reqs = []\n @reqs << Requirement.new(:feature, {:feature => self['feature']}, plugin) if self['feature']\n end\n @reqs\n end", "def relevant_packages\n packages.select { |p| p['version'] == version }\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def remove_unused_dependencies\n # puts 'removing unused dependencies list.'\n dependencies = @target.dependencies\n dependencies.each do |dependency|\n dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name\n end\n end", "def desired_gems(list_of_gems)\n specified_gems = []\n list_of_gems.each do |g| \n if self.has_key? g\n specified_gems << self[g]\n else\n specified_gems << \"'#{g}' not found in any gemset\"\n end\n end\n\n specified_gems\n end", "def spec_set\n Bundler.locked_gems.specs\n end", "def find_all(req)\n res = []\n\n dep = req.dependency\n\n return res if @ignore_dependencies and\n @always_install.none? {|spec| dep.match? spec }\n\n name = dep.name\n\n dep.matching_specs.each do |gemspec|\n next if @always_install.any? {|spec| spec.name == gemspec.name }\n\n res << Gem::Resolver::InstalledSpecification.new(self, gemspec)\n end unless @ignore_installed\n\n if consider_local?\n matching_local = @local.values.select do |spec, _|\n req.match? spec\n end.map do |spec, source|\n Gem::Resolver::LocalSpecification.new self, spec, source\n end\n\n res.concat matching_local\n\n begin\n if local_spec = @local_source.find_gem(name, dep.requirement)\n res << Gem::Resolver::IndexSpecification.new(\n self, local_spec.name, local_spec.version,\n @local_source, local_spec.platform)\n end\n rescue Gem::Package::FormatError\n # ignore\n end\n end\n\n res.delete_if do |spec|\n spec.version.prerelease? and not dep.prerelease?\n end\n\n res.concat @remote_set.find_all req if consider_remote?\n\n res\n end", "def find_dependencies(env)\n args = [] if (env = env.dup).sub!(REGEXP_DEVPKG,'') # are we in compile mode?\n return [[], [], args] if args && env.empty?\n\n require 'rubygems/remote_fetcher'\n @@deps = YAML.load(fetch(env))['gems'] unless defined?(@@deps)\n @@deps.key?(spec.name) or return(args ? [[], [], args] : nil)\n\n # find dependencies\n case deps = @@deps[spec.name]\n when nil, \"*\" # for nil or '*', use the default extension name\n deps = [\"*\"]\n when String # string of space-delimited packages and extensions\n when Array # array of packages and extensions\n when Hash # hash of packages and extensions, indexed by version requirements\n reqs, deps = deps.find do |reqs, info| # deps is an array or space-delimited string\n Gem::Requirement.new(reqs.split(',')).satisfied_by?(spec.version)\n end\n reqs or return # can't find the right version\n deps ||= [\"*\"] # deps are nil, use the default extension name\n end\n deps = deps.strip.split(/\\s+/) if deps.is_a?(String)\n deps = deps.compact.uniq\n\n # helpful variables\n bcwd = Dir.pwd\n benv = File.dirname(env.split(/[?;#]/,2).first)\n name = \"#{spec.full_name}.tar.gz\"\n\n # grok dependencies\n pkgs, exts = [], []\n deps.each do |item|\n if item.include?(\"*\") || item =~ REGEXP_SCHEMA || item.include?(\".tar.gz\")\n exts << item unless args\n elsif item =~ REGEXP_DEVPKG\n pkgs << $' if args\n elsif item =~ REGEXP_DEVARG\n args << $' if args\n else\n pkgs << item unless args\n end\n end\n exts.map! do |item|\n case item\n when \"*\" then item = File.join(benv, name) # use complete default tarball name\n when /\\A\\*/ then item[0,1] = benv # path relative to env variable\n when /\\A[^\\/]/ then item[0,0] = bcwd + \"/\" # path relative to current directory\n end\n item.gsub(\"*\", name) # swap inline wildcards with default tarball name\n end\n [pkgs, exts, args]\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name(full_name)\n siblings = @specs.find_all { |s|\n\ts.name == gem_to_remove.name &&\n\t s.full_name != gem_to_remove.full_name\t\n }\n deps = []\n @specs.each do |spec|\n\tspec.dependencies.each do |dep|\n\t deps << dep if gem_to_remove.satisfies_requirement?(dep)\n\tend\n end\n deps.all? { |dep|\n\tsiblings.any? { |s| \n\t s.satisfies_requirement?(dep)\n\t}\n }\n end", "def parse_required(input)\n gemspecs = []\n input.split(\"\\n\").grep(/^no such file to load -- (.+)\\s*$/) do |line|\n gemspecs << {:name => $1.strip}\n end\n gemspecs\n end", "def ignored_versions_for(dep)\n if $options[:ignore_conditions].any?\n ignore_conditions = $options[:ignore_conditions].map do |ic|\n Dependabot::Config::IgnoreCondition.new(\n dependency_name: ic[\"dependency-name\"],\n versions: ic[\"versions\"],\n update_types: ic[\"update-types\"]\n )\n end\n # Dependabot::Config::UpdateConfig.new(ignore_conditions: ignore_conditions).\n # ignored_versions_for(dep, security_updates_only: $options[:security_updates_only])\n Dependabot::Config::UpdateConfig.new(ignore_conditions: ignore_conditions).ignored_versions_for(dep)\n else\n $update_config.ignored_versions_for(dep)\n end\nend", "def prerelease_specs\n specs.select { |s| s.prerelease? }\n end", "def gemspec( * )\n\t\traise \"Circular dependency: can't depend on the gemspec to build itself\"\n\tend", "def dependencies\n to_a.reject { |a| a.filename.eql?(self.filename) }\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def find_all req\n res = []\n\n return res unless @remote\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def requires(database)\n fail \"Extension #{name} not (yet) installed\" unless installed?(database)\n\n stmt = if version\n <<-SQL\n SELECT unnest(requires) as name FROM\n ( SELECT requires FROM pg_available_extension_versions where name='#{name}' AND version ='#{version}') t\n SQL\n else\n <<-SQL\n SELECT unnest(requires) as name FROM\n (SELECT requires FROM\n pg_available_extensions a\n JOIN pg_available_extension_versions v ON v.name = a.name AND a.default_version = v.version\n WHERE v.name = '#{name}')t\n SQL\n end\n\n result = database.execute(stmt).to_a\n\n requires = result.map{|r| r['name']}\n end", "def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end" ]
[ "0.84699225", "0.80746263", "0.76144695", "0.76144695", "0.75614834", "0.7425938", "0.74050725", "0.73347414", "0.71328056", "0.7018714", "0.68172044", "0.6742799", "0.6715131", "0.6695451", "0.65683407", "0.6537445", "0.65205663", "0.6455978", "0.6425074", "0.6421394", "0.64049876", "0.6401983", "0.6343942", "0.6138561", "0.61016965", "0.609821", "0.6081415", "0.60729444", "0.60556465", "0.60355836", "0.6016622", "0.6008619", "0.5998082", "0.59952486", "0.59659576", "0.594312", "0.59204906", "0.5907812", "0.5901956", "0.58776575", "0.587229", "0.587229", "0.5853821", "0.58519024", "0.58504575", "0.5832266", "0.58094394", "0.58023447", "0.578479", "0.5752832", "0.5740787", "0.5732047", "0.5709901", "0.56982887", "0.5671181", "0.56542844", "0.5641892", "0.56393415", "0.5628635", "0.56274766", "0.5607237", "0.5601032", "0.55999094", "0.55911756", "0.55828214", "0.55750895", "0.5567406", "0.5560683", "0.55598086", "0.5555955", "0.5555179", "0.55491525", "0.554492", "0.55269796", "0.55156296", "0.55076414", "0.5504645", "0.54988766", "0.54823697", "0.5478226", "0.5460665", "0.54545885", "0.5449429", "0.5449097", "0.5438597", "0.5436458", "0.54188454", "0.54077804", "0.5406269", "0.54026", "0.54015577", "0.53937596", "0.5391273", "0.5388173", "0.53851116", "0.53671753", "0.5363165", "0.5358038", "0.53571975" ]
0.7995794
3
Update RPM::Spec metadata to new gem
def update_to(new_source) update_deps_from(new_source) update_files_from(new_source) update_metadata_from(new_source) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_rpm_spec\n puts 'creating rpm.spec'\n File.unlink('rpm.spec') if File.exist?('rpm.spec')\n f = File.open('rpm.spec', 'w')\n f.puts <<EOF\n# DO NOT EDIT -- automatically generated by ./configure\nName: #{@project.id}\nSummary: #{@project.summary}\nVersion: #{@project.version}\nRelease: 1\nLicense: #{@project.license}\nVendor: #{@project.author}\nGroup: System Environment/Libraries\nSource0: %{name}-%version.tar.gz\n\n%description\n#{@project.description}\n\n%prep\n#%setup -q -n #{@project.id}-#{@project.version}\n%setup\n\n%build\n./configure --prefix=/usr --disable-static\nmake\n\n%install\nmake DESTDIR=%{buildroot} install\n\n%clean\n[ %{buildroot} != \"/\" ] && rm -rf %{buildroot}\n\n%post -p /sbin/ldconfig\n%postun -p /sbin/ldconfig\n\n%files\n%defattr(-,root,root)\n\n#{ @project.installer.package_manifest }\n\n%changelog\n* Thu Jan 01 2011 Some Person <nobody@nobody.invalid> - #{@project.version}-1\n- automatically generated spec file\nEOF\n f.close()\n end", "def update!\n puts \"Updating gems...\"\n Bundler::CLI.new.update\n @new_spec_set = Bundler.definition.specs\n compute_changes\n end", "def add_spec(gem_spec)\n @gems[gem_spec.full_name] = gem_spec\n end", "def update_metadata_from(new_source)\n # update to new version\n @metadata[:version] = new_source.version\n @metadata[:release] = \"1%{?dist}\"\n\n # add changelog entry\n changelog_entry = <<EOS\n* #{Time.now.strftime(\"%a %b %d %Y\")} #{RPM::Spec.current_author} - #{@metadata[:version]}-1\n- Update to version #{new_source.version}\nEOS\n @metadata[:changelog_entries] ||= []\n @metadata[:changelog_entries].unshift changelog_entry.rstrip\n end", "def update_specfiles(version)\n spec_files.each do |spec_file|\n spec = File.read(spec_file)\n spec.gsub!(/^(\\s*)Version:(\\s*).*$/, \"\\\\1Version:\\\\2#{version}\")\n File.write(spec_file, spec)\n end\nend", "def add_gem_facts\n unless @path.directory?\n @result.is_gem = false\n return\n end\n \n path = gemspec_path\n \n if path.nil?\n @result.is_gem = false\n return\n end\n \n @result.is_gem = true\n @result.package.types << 'gem'\n \n gem = @result.gem = Result.new\n \n gem.gemspec_path = gemspec_path.to_s\n \n spec = Gem::Specification::load(gemspec_path.to_s)\n gem.name = spec.name\n gem.version = QB::Package::Version.from_gem_version spec.version\n end", "def update_files_from(new_source)\n to_add = new_source.file_paths\n @metadata[:files] ||= {}\n @metadata[:files].each { |pkg,spec_files|\n (new_source.file_paths & to_add).each { |gem_file|\n # skip files already included in spec or in dir in spec\n has_file = spec_files.any? { |sf|\n gem_file.gsub(sf,'') != gem_file\n }\n\n to_add.delete(gem_file)\n to_add << gem_file.rpmize if !has_file &&\n !Gem.ignorable_file?(gem_file)\n }\n }\n\n @metadata[:new_files] = to_add.select { |f| !Gem.doc_file?(f) }\n @metadata[:new_docs] = to_add - @metadata[:new_files]\n end", "def gem2rpm(os, specfile, options = {})\n @logger.info('Gem->RPM: Start!')\n begin\n gem = packages.detect { |package| package.type == 'gem' }\n raise 'Library has no gem package!' if gem.nil?\n build_dir = Helpers.mkdir_anonymous\n \n begin\n gemspec = gem.lock { Gem::Format.from_file_by_path(gem.file).spec }\n gemfile = \"#{build_dir}/#{gemspec.file_name}\"\n gem.lock { FileUtils.cp(gem.file, gemfile) }\n \n specfile_path = \"#{build_dir}/rubygem-#{gemspec.name}.spec\"\n File.open(specfile_path, 'w') { |f| f.write(specfile.content) }\n \n @logger.info('Gem->RPM: Success! (needs to be built now)')\n async_build_and_rebuild(gem, os, build_dir, options)\n rescue => ex\n FileUtils.rm_rf(build_dir)\n raise ex\n end\n \n log(\"Build requested. (#{os}, source)\")\n rescue => ex\n @logger.error(\"Gem->RPM: Failure! #{ex.to_s}\")\n raise ex\n end\n end", "def add_spec(gem_spec, name = T.unsafe(nil)); end", "def rpm_package_information\n super\n end", "def update_gemspec(attribute, new_value, literal = false)\n\n unless literal\n new_value = case new_value\n when Array then \"%w(#{new_value.join(' ')})\"\n when Hash, String then new_value.inspect\n when Date then new_value.strftime('%Y-%m-%d').inspect\n else raise \"Cannot write value #{new_value.inspect} to gemspec file!\"\n end\n end\n\n spec = File.read(gemspec_file)\n regexp = Regexp.new('^(\\s+\\w+\\.' + Regexp.quote(attribute.to_s) + '\\s*=\\s*)[^\\s].*$')\n if spec.sub!(regexp) { $1 + new_value }\n File.open(gemspec_file, 'w') { |f| f << spec }\n modified_files << gemspec_file\n\n # Reload the gemspec so the changes are incorporated\n load_gemspec!\n \n # Also mark the Gemfile.lock file as changed because of the new version.\n modified_files << 'Gemfile.lock' if File.exist?(File.join(root_dir, 'Gemfile.lock'))\n end\n end", "def gem_spec\n require 'rubygems/specification'\n spec_fields = %w(\n name author email has_rdoc rubyforge_project summary\n version description required_ruby_version homepage\n )\n Gem::Specification.new do | spec |\n for field in spec_fields\n value = self.send( field )\n spec.send( \"#{field}=\", value )\n end\n \n spec.files = package.files.to_a + %w( Rakefile Manifest.txt )\n spec.test_files = unit_tests.to_a + functional_tests.to_a\n \n spec.executables.push( *executables )\n spec.requirements.push( *requirements )\n end\n end", "def write_gemspec\n Juwelier::Commands::WriteGemspec.build_for(self).run\n end", "def update\n # Install in pacman can be used for update, too\n self.install\n end", "def update\n # Install in pacman can be used for update, too\n self.install\n end", "def write_gemspec; end", "def to_string\n contents = @metadata[:contents]\n\n # replace version / release\n contents.gsub!(SPEC_VERSION_MATCHER, \"Version: #{@metadata[:version]}\")\n contents.gsub!(SPEC_RELEASE_MATCHER, \"Release: #{@metadata[:release]}\")\n\n # add changelog entry\n cp = contents.index SPEC_CHANGELOG_MATCHER\n cpn = contents.index \"\\n\", cp\n contents = contents[0...cpn+1] +\n @metadata[:changelog_entries].join(\"\\n\\n\")\n\n # update requires/build requires\n rp = contents.index SPEC_REQUIRES_MATCHER\n brp = contents.index SPEC_BUILD_REQUIRES_MATCHER\n tp = rp < brp ? rp : brp\n\n pp = contents.index SPEC_SUBPACKAGE_MATCHER\n pp = -1 if pp.nil?\n\n lrp = contents.rindex SPEC_REQUIRES_MATCHER, pp\n lbrp = contents.rindex SPEC_BUILD_REQUIRES_MATCHER, pp\n ltp = lrp > lbrp ? lrp : lbrp\n\n ltpn = contents.index \"\\n\", ltp\n\n contents.slice!(tp...ltpn)\n contents.insert tp,\n (@metadata[:requires].collect { |r| \"Requires: #{r.str}\" } +\n @metadata[:build_requires].collect { |r| \"BuildRequires: #{r.str}\" }).join(\"\\n\")\n\n # add new files\n fp = contents.index SPEC_FILES_MATCHER\n lfp = contents.index SPEC_SUBPKG_FILES_MATCHER, fp + 1\n lfp = contents.index SPEC_CHANGELOG_MATCHER if lfp.nil?\n\n contents.insert lfp - 1, @metadata[:new_files].join(\"\\n\") + \"\\n\"\n\n # add new doc files\n fp = contents.index SPEC_DOC_FILES_MATCHER\n fp = contents.index SPEC_FILES_MATCHER if fp.nil?\n lfp = contents.index SPEC_SUBPKG_FILES_MATCHER, fp + 1\n lfp = contents.index SPEC_CHANGELOG_MATCHER if lfp.nil?\n \n contents.insert lfp - 1, @metadata[:new_docs].join(\"\\n\") + \"\\n\"\n\n # return new contents\n contents\n end", "def update\n Puppet.debug \"Attempting to upgrade #{@resource[:name]}\"\n install unless mas_app\n mas('upgrade')\n end", "def update_metadata_rocks(metadata)\n end", "def sync_spec_puppet_module\n copy_skel_files\n install_fixtures\n install_spec_helper\n\n # ONLY install init_spec.rb if no spec files already exist in spec/classes.\n # These files are otherwise not managed from here.\n unless @config[@origin].has_key?('no_init_spec')\n if (Dir.entries('spec/classes') - %w{. .. .gitkeep readme_spec.rb}).empty?\n install_template(\n [\"#{@templates}/init_spec.rb\"], 'spec/classes/init_spec.rb')\n end\n end\n end", "def update\n @parent.gemset_update\n end", "def update\n self.install\n end", "def update\n self.install\n end", "def update\n self.install\n end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def write_gemspec\n Jeweler::Commands::WriteGemspec.build_for(self).run\n end", "def rpm_install\n @rpm_install\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 update\n install\n end", "def update_gem(gem)\n update_content(gem) and write and run_bundle_update(gem)\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n source.fetch_spec tuple\n rescue Gem::RemoteFetcher::FetchError\n raise if @original_platform == @platform\n\n tuple = Gem::NameTuple.new @name, @version, @original_platform\n source.fetch_spec tuple\n end\n end", "def update_deps_from(new_source)\n @metadata[:requires] =\n non_gem_requirements +\n extra_gem_requirements(new_source) +\n new_source.deps.select { |r| !excludes_dep?(r.name) }\n .collect { |r| RPM::Requirement.from_gem_dep(r) }.flatten\n\n @metadata[:build_requires] =\n non_gem_build_requirements +\n extra_gem_build_requirements(new_source) +\n new_source.dev_deps.select { |r| !excludes_dev_dep?(r.name) }\n .collect { |r| RPM::Requirement.from_gem_dep(r, true) }.flatten\n end", "def refresh_from_gems(*components)\n opts = components.last.is_a?(Hash) ? components.pop : {}\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install_gem(name, opts) }\n end", "def execute_ruby_release(type:)\n version_regex = %r{.version\\s*=\\s*'([\\d\\.]+)'}\n gemspec_path = Dir.glob(\"*.gemspec\").first\n gemspec_contents = File.read(gemspec_path)\n version = gemspec_contents.match(version_regex)[1]\n version = Semverse::Version.new(version)\n new_version = \"0.0.5\"\n gemspec_contents = gemspec_contents.sub(version_regex, \".version = '#{new_version}'\")\n\n gemspec_folder_obj = octokit.contents(@originating_repo,)\n gemspec_file_obj = gemspec_folder_obj.find { |file| file[:name] == gemspec_path }\n gemspec_file = octokit.blob(@originating_repo, gemspec_file_obj[:sha])\n gemspec_obj = octokit.contents(@originating_repo, path: gemspec_path)\n gemspec_sha = gemspec_file['sha']\n contents = Base64.encode64(gemspec_contents)\n json = {\n message: \"Updating to #{new_version}\",\n content: contents,\n sha: gemspec_sha\n }.to_json\n\n gemspec_file_obj = octokit.update_contents(@originating_repo, gemspec_path, \"Release #{new_version}\", gemspec_sha, gemspec_contents)\n octokit.add_comment(@originating_repo, @pr_number, \"Thanks! This is now out in #{new_version}\")\n end", "def write_gemspec\n build_command(Jeweler::Commands::WriteGemspec).run\n end", "def modify(rpm_repository_href, data, opts = {})\n data, _status_code, _headers = modify_with_http_info(rpm_repository_href, data, opts)\n data\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n\n @source.fetch_spec tuple\n end\n end", "def patch_gem(gem, from_version, to_version)\n from_version = from_version.is_a?(Array) ? from_version : [from_version]\n desc \"Update the version of the #{gem} gem from #{from_version.inspect} to #{to_version}\"\n command(:\"patch_#{gem}_gem\") do |app|\n patch_gemfile(\"Update the version of the #{gem} gem to #{to_version}.\") do |content|\n from_version.each do |v|\n content = content.gsub(\"gem '#{gem}', '= #{v}'\", \"gem '#{gem}', '= #{to_version}'\")\n end\n content\n end\n end\n end", "def gemspec?; end", "def fill_changes(old_gem, updated_gem)\n changes[old_gem.name] = {\n versions: {\n old: old_gem.version.to_s, new: updated_gem.version.to_s\n },\n source: updated_gem.source\n }\n end", "def install_gem; end", "def update_datapackage\n update_file_in_repo(\"datapackage.json\", create_json_datapackage)\n end", "def check_update(component_def, spec, gem_name_to_version)\n component_def.each_line do |line|\n # TODO: Some of the component files handle multiple versions with a case statement (for example net-ssh). \n # Add more logic to compare each of those versions. For now there are only a hand full. \n if line =~ /pkg.version/\n ver = Gem::Version.new(line.scan(/\\d\\.*/).join(''))\n if gem_name_to_version[spec.name] > ver\n warn \"Update needed for: #{spec.name} \\nUpgrade from #{ver} to #{gem_name_to_version[spec.name]}\\n\\n\"\n end\n end\n end\nend", "def rebuild_and_rpm2gem(srpm, options = {})\n rebuild(srpm, ARCH.first, options)\n os = srpm.lock {Rpm2Gem::Rpm.os(srpm.file)}\n log(\"RPM->Gem conversion requested. (#{os})\")\n rpm2gem(os, options)\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 create_rpm\n # unpack gem software\n unpack @rpm_unpack_dir\n # generate install\n generate_install\n # generate post install\n #generate_post\n # generate executable files\n generate_bin\n # create gemspec file\n File.open(@gemspec_filename, 'w') { |f|\n f.write(@spec.to_ruby)\n }\n # create rpm spec file\n write_rpm_spec_from_template\n # create rpm source file\n create_rpm_source(\"#{@rpm_top_dir}/tmp\")\n # create rpm\n rpmbuild\n # clean temp directory\n FileUtils.rm_rf \"#{@rpm_tmp_dir}\"\n end", "def to_gemspec(options={})\n require_rubygems\n\n if metadata.resources\n homepage = metadata.resources.homepage\n else\n homepage = nil\n end\n\n if homepage && md = /(\\w+).rubyforge.org/.match(homepage)\n rubyforge_project = md[1]\n else\n # b/c it has to be something according to Eric Hodel.\n rubyforge_project = metadata.name.to_s\n end\n\n #TODO: may be able to get this from project method\n if news = Dir[root + 'NEWS{,.txt}'].first\n install_message = File.read(news)\n end\n\n ::Gem::Specification.new do |spec|\n spec.name = self.name.to_s\n spec.version = self.version.to_s\n spec.require_paths = self.loadpath.to_a\n\n spec.summary = metadata.summary.to_s\n spec.description = metadata.description.to_s\n spec.authors = metadata.authors.to_a\n spec.email = metadata.email.to_s\n spec.licenses = metadata.licenses.to_a\n\n spec.homepage = metadata.homepage.to_s\n\n # -- platform --\n\n # TODO: how to handle multiple platforms?\n spec.platform = options[:platform] #|| verfile.platform #'ruby' ???\n #if metadata.platform != 'ruby'\n # spec.require_paths.concat(spec.require_paths.collect{ |d| File.join(d, platform) })\n #end\n\n # -- rubyforge project --\n\n spec.rubyforge_project = rubyforge_project\n\n # -- compiled extensions --\n\n spec.extensions = options[:extensions] || self.extensions\n\n # -- dependencies --\n\n case options[:gemfile]\n #when String\n # gemfile = root.glob(options[:gemfile]).first # TODO: Alternate gemfile\n when nil, true\n gemfile = root.glob('Gemfile').first\n else\n gemfile = nil\n end\n\n if gemfile\n require 'bundler'\n spec.add_bundler_dependencies\n else\n metadata.requirements.each do |dep|\n if dep.development?\n spec.add_development_dependency( *[dep.name, dep.constraint].compact )\n else\n next if dep.optional?\n spec.add_runtime_dependency( *[dep.name, dep.constraint].compact )\n end\n end\n end\n\n # TODO: considerations?\n #spec.requirements = options[:requirements] || package.consider\n\n # -- executables --\n\n # TODO: bin/ is a POM convention, is there are reason to do otherwise?\n spec.bindir = options[:bindir] || \"bin\"\n spec.executables = options[:executables] || self.executables\n\n # -- rdocs (argh!) --\n\n readme = root.glob_relative('README{,.*}', File::FNM_CASEFOLD).first\n extra = options[:extra_rdoc_files] || []\n\n rdocfiles = []\n rdocfiles << readme.to_s if readme\n rdocfiles.concat(extra)\n rdocfiles.uniq!\n\n rdoc_options = [] #['--inline-source']\n rdoc_options.concat [\"--title\", \"#{metadata.title} API\"] #if metadata.title\n rdoc_options.concat [\"--main\", readme.to_s] if readme\n\n spec.extra_rdoc_files = rdocfiles\n spec.rdoc_options = rdoc_options\n\n # -- distributed files --\n\n if manifest.exist?\n filelist = manifest.select{ |f| File.file?(f) }\n spec.files = filelist\n else\n spec.files = root.glob_relative(\"**/*\").map{ |f| f.to_s } # metadata.distribute ?\n end\n\n # DEPRECATED: -- test files --\n #spec.test_files = manifest.select do |f|\n # File.basename(f) =~ /test\\// && File.extname(f) == '.rb'\n #end\n\n if install_message\n spec.post_install_message = install_message\n end\n end\n\n end", "def add_specs(*gem_specs); end", "def gem_spec\n Gem::Specification.new do |s|\n s.name = package_name\n s.version = version\n s.platform = Gem::Platform::RUBY\n s.summary = summary\n s.description = description || summary\n s.author = author_name\n s.email = author_email\n s.homepage = project_url\n s.require_path = lib_dir\n s.files = package_files\n s.test_files = tests\n s.bindir = bin_dir\n s.executables = programs.map{|p| File.basename(p)}\n s.extensions = FileList['ext/**/extconf.rb']\n s.has_rdoc = true\n s.extra_rdoc_files = rdoc_files\n s.rdoc_options.concat(rdoc_options)\n s.test_files = tests\n s.rubyforge_project = rubyforge_project\n dependencies.each { |args| s.add_dependency(*args) }\n @package_configurator.call(s) if @package_configurator\n end\n end", "def install_chef_gem(nr)\n # let chef_gem install the gem for us\n at_compile_time do\n chef_gem nr.gem_name do\n %w(options version source).each do |attr|\n value = new_resource.send(attr.to_sym)\n send(attr.to_sym, value) unless value.nil?\n end\n end\n end\n end", "def update_package_definition(blocks, parts)\n blocks.uniq { |hash| hash.values_at(:prev, :key, :patch) }\n group_updates = blocks.group_by { |h| [h[:prev], h[:key]] }\n group_updates.each do |updates, versions|\n updates = updates.last\n vulnerable_package_info = get_package_info(updates)\n list_of_versions_available = vulnerable_package_info[\"data\"][\"versions\"]\n version_to_update_to = Salus::SemanticVersion.select_upgrade_version(\n versions.first[:patch], list_of_versions_available\n )\n package_name = updates.reverse.split('@', 2).collect(&:reverse).reverse.first\n if !version_to_update_to.nil?\n fixed_package_info = get_package_info(package_name, version_to_update_to)\n unless fixed_package_info.nil?\n updated_version = \"version \" + '\"' + version_to_update_to + '\"'\n updated_resolved = \"resolved \" + '\"' + fixed_package_info[\"data\"][\"dist\"][\"tarball\"] \\\n + \"#\" + fixed_package_info[\"data\"][\"dist\"][\"shasum\"] + '\"'\n updated_integrity = \"integrity \" + fixed_package_info['data']['dist']['integrity']\n updated_name = package_name + \"@^\" + version_to_update_to\n\n parts.each_with_index do |part, index|\n current_v = parts[index].match(/((\"|)version(\"|).*)/)\n version_string = current_v.to_s.tr('\"', \"\").tr(\"version \", \"\")\n if part.include?(updates) && !is_major_bump(\n version_string, version_to_update_to\n ) && part.start_with?(updates.split(\"@\")[0])\n current_source = parts[index].match(/((\"|)resolved(\"|).*)/)\n source = current_source.to_s.split(\" \")[1].tr('\"', '')\n current_hostname = URI.parse(source)\n resolved_source = updated_resolved.split(\" \")[1].tr('\"', '')\n resolved_hostname = URI.parse(resolved_source)\n updated_resolved.sub!(resolved_hostname.host, current_hostname.host)\n\n parts[index].sub!(updates, updated_name)\n parts[index].sub!(/((\"|)version(\"|).*)/, updated_version)\n parts[index].sub!(/((\"|)resolved(\"|).*)/, updated_resolved)\n parts[index].sub!(/((\"|)integrity(\"|).*)/, updated_integrity)\n end\n end\n end\n end\n end\n parts\n end", "def refresh_from_gems(*components)\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install(name) }\n end", "def writespec(spec)\n\tfile_name = spec.full_name.untaint + '.gemspec'\n\tFile.open(file_name, \"w\") do |file|\n\t\tfile.puts spec.to_ruby_for_cache\n\tend\n\tprint \"Wrote: %s\\n\" % file_name\nend", "def update(rpm_remote_href, data, opts = {})\n data, _status_code, _headers = update_with_http_info(rpm_remote_href, data, opts)\n data\n end", "def describe gem, source = { rubygems: true }\n if source[:rubygems]\n Gems.info(gem).fetch \"info\"\n else\n info = GemspecInfo.new gem, source\n info.summary\n end\n end", "def set_spec_template_metadata\n release_doc_metadata.each do |key, value|\n template[:spec][:template][:metadata][:labels][key] ||= value.to_s\n end\n end", "def load_spec name, ver, platform, source\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end", "def load_spec(name, ver, platform, source) # :nodoc:\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end", "def update\n self.uninstall if (@property_hash[:ensure] || info2hash()[:ensure]) != :absent\n self.install\n end", "def install_custom!\n package package_name do\n source new_resource.source.to_s\n checksum new_resource.checksum unless new_resource.checksum.nil?\n end\n end", "def rpm_family_and_version\n if Pkg::Config.vanagon_project\n Pkg::Config.rpm_targets.split(' ').map do |target|\n rpm_el_family, rpm_el_version, = target.split('-')\n \"#{rpm_el_family}-#{rpm_el_version}\"\n end\n else\n Pkg::Config.final_mocks.split.map { |mock| \"#{mock_el_family(mock)}-#{mock_el_ver(mock)}\" }\n end\nend", "def bump_patch_version; end", "def latest\n source = @resource[:source]\n unless source\n @resource.fail _(\"RPMs must specify a package source\")\n end\n\n cmd = [command(:rpm), \"-q\", \"--qf\", \"#{self.class::NEVRA_FORMAT}\", \"-p\", source]\n h = self.class.nevra_to_multiversion_hash(execute(cmd))\n h[:ensure]\n rescue Puppet::ExecutionFailure => e\n raise Puppet::Error, e.message, e.backtrace\n end", "def update!\n if path = vendorized?\n type = File.symlink?(path) ? :symlink : :copy\n FileUtils.rm_rf normalize(:lib)\n send \"vendorize_with_#{type}\"\n say \"updated #{type} #{path} -> #{program(:version)}\"\n else\n ['dom.html', 'rhino.js', 'node.js'].each do |path|\n path = normalize path\n next unless File.exists? path\n contents = File.read(path).gsub /jspec-(\\d+\\.\\d+\\.\\d+)/, \"jspec-#{program(:version)}\"\n if program(:version) == $1\n say \"skipping #{path}; already #{$1}\"\n next\n end\n File.open(path, 'r+'){ |file| file.write contents } \n say \"updated #{path}; #{$1} -> #{program(:version)}\"\n end\n end\n end", "def install\n should = @resource.should(:ensure)\n self.debug \"Ensuring => #{should}\"\n wanted = @resource[:name]\n\n # XXX: We don't actually deal with epochs here.\n case should\n when true, false, Symbol\n # pass\n else\n # Add the package version\n wanted += \"-#{should}\"\n end\n output = rug \"--quiet\", :install, \"-y\", wanted\n\n unless self.query\n raise Puppet::ExecutionFailure.new(\n \"Could not find package #{self.name}\"\n )\n end\n end", "def test_gem_should_not_change\n gemfile = bake_testing_gem\n\n patches = []\n patches << bake_incorrect_patch\n\n # Create a new patched gem in @gems_dir\n patcher = Gem::Patcher.new(gemfile, @gems_dir)\n patched_gem = patcher.patch_with(patches, @options)\n\n # Unpack\n package = Gem::Package.new patched_gem\n package.extract_files @gems_dir\n\n assert_equal original_file, file_contents('foo.rb')\n assert_equal original_gemspec, current_gemspec\n end", "def gemspecs; end", "def update_initial_metadata(metadata)\n end", "def update_rvm_gemset( deps )\n\t\ttmp = Tempfile.new( 'gemset' )\n\t\tdeps.keys.each {|dep| deps[dep.name] = deps.delete(dep) }\n\n\t\tRVM_GEMSET.each_line do |line|\n\t\t\tif line =~ /^\\s*(#|$)/\n\t\t\t\ttmp.print( line )\n\t\t\telse\n\t\t\t\tgem, version = line.split( /\\s+/, 2 )\n\n\t\t\t\tif (( newer = deps.delete(gem) ))\n\t\t\t\t\ttmp.puts( gem + ' -v' + newer.to_s )\n\t\t\t\telse\n\t\t\t\t\ttmp.print( line )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tdeps.each do |gem, newer|\n\t\t\tnext unless newer\n\t\t\ttmp.puts( gem + ' -v' + newer.to_s )\n\t\tend\n\n\t\ttmp.close\n\n\t\tFileUtils.cp( tmp.path, RVM_GEMSET, :verbose => true )\n\tend", "def gemspec(platform = 'ruby')\n Gem::Specification.load(File.expand_path('../../redcloth.gemspec', __FILE__))\nend", "def primary_file(origin_name, dist_name, component_name, packages)\n content = {\n :metadata => {\n :@xmlns => XMLNS_MAP[:common],\n \"@xmlns:rpm\" => XMLNS_MAP[:rpm],\n :@packages => packages.size,\n :package => packages.map { |package|\n {\n :@type => \"rpm\",\n :name => package[\"NAME\"],\n :arch => package[\"ARCH\"],\n :version => {\n :@epoch => package[\"EPOCHNUM\"],\n :@ver => package[\"VERSION\"],\n :@rel => package[\"RELEASE\"].split(\".\").first,\n },\n :checksum => [\n {\n :@type => \"sha\",\n :@pkgid => \"YES\",\n },\n package[:generated_sha],\n ],\n :summary => package[\"SUMMARY\"],\n :description => [package[\"DESCRIPTION\"]].flatten.compact.join(\" \"),\n :packager => package[\"PACKAGER\"],\n :url => package[\"URL\"],\n :time => {\n :@file => Time.now.to_i,\n :@build => package[\"BUILDTIME\"],\n },\n :size => {\n :@archive => package[\"ARCHIVESIZE\"],\n :@package => package[:generated_size],\n :@installed => package[\"LONGSIZE\"],\n },\n :location => package[:generated_path],\n :format => {\n \"rpm:license\" => package[\"LICENSE\"],\n \"rpm:vendor\" => package[\"VENDOR\"],\n \"rpm:group\" => package[\"GROUP\"],\n \"rpm:buildhost\" => package[\"BUILDHOST\"],\n \"rpm:header-range\" => {\n :@start => package[:generated_header][:start],\n :@end => package[:generated_header][:end],\n },\n \"rpm:provides\" => {\n \"rpm:entry\" => Array.new.tap { |entries|\n pro_ver = package[\"PROVIDEVERSION\"].dup\n package[\"PROVIDENAME\"].each_with_index do |p_name, p_idx|\n item = {:@name => p_name}\n if p_flag = VERSION_FLAGS[package[\"PROVIDEFLAGS\"][p_idx]]\n p_ver, p_rel = pro_ver.shift.split(\"-\", 2)\n item.merge!(:@flags => p_flag, :@ver => p_ver, :@rel => p_rel, :@epoch => package[\"EPOCHNUM\"])\n end\n entries.push(item)\n end\n },\n },\n \"rpm:requires\" => {\n \"rpm:entry\" => Array.new.tap { |entries|\n req_ver = package[\"REQUIREVERSION\"].dup\n package[\"REQUIRENAME\"].each_with_index do |r_name, r_idx|\n item = {:@name => r_name}\n if r_flag = VERSION_FLAGS[package[\"REQUIREFLAGS\"][r_idx]]\n r_ver, r_rel = req_ver.shift.split(\"-\", 2)\n item.merge!(:@flags => r_flag, :@ver => r_ver, :@rel => r_rel, :@epoch => package[\"EPOCHNUM\"])\n end\n entries.push(item)\n end\n },\n },\n },\n }\n },\n },\n }\n args = [origin_name, dist_name, component_name, \"repodata\", \"primary.xml\"]\n [\n create_file(*args) do |file|\n file.puts generate_xml(content)\n end,\n compress_file(*args),\n ]\n end", "def set_gem_version_and_file line, file, line_num\n if line =~ @gem_name_version\n @tracker.config.add_gem $1, $2, file, line_num\n end\n end", "def updated_gemfile_requirement(req)\n return req unless latest_resolvable_version\n return req if existing_version && no_change_in_version?\n return req if !existing_version && new_version_satisfies?(req)\n\n requirements =\n req[:requirement].split(\",\").map { |r| Gem::Requirement.new(r) }\n\n new_req =\n if requirements.any?(&:exact?)\n \"= #{latest_resolvable_version}\"\n elsif requirements.any? { |r| r.to_s.start_with?(\"~>\") }\n tw_req = requirements.find { |r| r.to_s.start_with?(\"~>\") }\n update_twiddle_version(tw_req, latest_resolvable_version).to_s\n else\n update_gemfile_range(requirements).map(&:to_s).join(\", \")\n end\n\n req.merge(requirement: new_req)\n end", "def update_version_file\n version_file = @spec.version_file\n updated_version = Olag::Version::update(version_file)\n abort(\"Updated gem version; re-run rake\") if @spec.version.to_s != updated_version\n end", "def add_git_spec(name, version, repository, reference, submodules) # :nodoc:\n add_git_gem name, repository, reference, submodules\n\n source = Gem::Source::Git.new name, repository, reference\n source.root_dir = @root_dir\n\n spec = Gem::Specification.new do |s|\n s.name = name\n s.version = version\n end\n\n git_spec = Gem::Resolver::GitSpecification.new self, spec, source\n\n @specs[spec.name] = git_spec\n\n git_spec\n end", "def mock_rpm(mock_config, srpm, mockfile)\n cmd_args = \" #{srpm}\"\n mock_artifact(mock_config, cmd_args, mockfile)\nend", "def update!(**args)\n @package_name = args[:package_name] if args.key?(:package_name)\n @upgrade_to_version = args[:upgrade_to_version] if args.key?(:upgrade_to_version)\n end", "def update_catalog_metadata\n source = metadata_builder.metadata_source.find_by(source_type: 'descriptive')\n raise 'Descriptive metadata source not available' unless source\n\n bibnumber = source.original_mappings['bibnumber']&.first\n raise 'Descriptive metadata does not contain bibnumber' if bibnumber.blank?\n\n source.set_metadata_mappings(clone_location)\n source.save!\n end", "def upgrade_repo!\n package 'apt-transport-https'\n include_recipe \"apt-chef::#{new_resource.channel}\"\n package('chefdk') { action :upgrade }\n end", "def package_metadata\n @package_metadata ||= ::ChefDk::Helpers.metadata_for(\n channel: channel,\n version: version,\n platform: node['platform'],\n platform_version: node['platform_version'],\n machine: node['kernel']['machine']\n )\n end", "def to_ruby\n%{Gem::Specification.new do |s|\n s.name = \"#{@gem_spec.name}\"\n s.version = \"#{@gem_spec.version}\"\n\n s.specification_version = #{ ivar_get(:specification_version) || 2 } if s.respond_to? :specification_version=\n s.required_rubygems_version = Gem::Requirement.new(\"#{ivar_get(:required_rubygems_version) || '>= 0'}\") if s.respond_to? :required_rubygems_version=\n\n#{gem_spec_variables.map { |k,v| \" s.#{k} = #{v.inspect}\" }.join(\"\\n\") }\n\n#{@gem_spec.dependencies.map { |dep| \" s.add_dependency(\\\"#{dep.name}\\\", [\\\"#{dep.version_requirements.to_s}\\\"])\" }.join(\"\\n\") }\nend}\n end", "def refresh!\n load_gems_in(self.class.installed_spec_directories)\n end", "def initial_rpm\n 700\n end", "def as_gemspec\n spec_values = SPEC_KEYS.inject({}) do |keys,spec_key|\n keys[spec_key] = metadata_hash[spec_key] || default_or_inferred_for(spec_key)\n keys\n end\n gemspec_from_values(spec_values)\n end", "def pkg_metadata_file\n @pkg_metadata_file ||= File.join(staging_dir, \"gen.manifestfile\")\n end", "def gemspec\n @gemspec ||= begin\n raise Error.new(\"Unable to automatically determine gem name from specs in #{base}. Please set the gem name via #{self.class.name}.install_tasks(gem_name: 'name')\") unless gem_name\n g = Bundler.load_gemspec(File.join(base, gem_name+'.gemspec'))\n # This is returning the path it would be in if installed normally,\n # override so we get the local path. Also for reasons that are entirely\n # beyond me, #tap makes Gem::Specification flip out so do it old-school.\n g.full_gem_path = base\n g\n end\n end", "def apply_spec(spec)\n spec = Artifact.to_hash(spec)\n ARTIFACT_ATTRIBUTES.each { |key| instance_variable_set(\"@#{key}\", spec[key]) }\n self\n end" ]
[ "0.6417202", "0.62516254", "0.61467826", "0.6140482", "0.6007314", "0.60041386", "0.5968705", "0.59681314", "0.5943131", "0.5902928", "0.58752054", "0.5868755", "0.58646154", "0.5838072", "0.5838072", "0.5820617", "0.5806395", "0.5795123", "0.5768061", "0.5758052", "0.5736488", "0.57239383", "0.57235813", "0.57235813", "0.56771195", "0.56771195", "0.56771195", "0.56771195", "0.56771195", "0.56771195", "0.56771195", "0.56771195", "0.56754553", "0.56754553", "0.56754553", "0.56754553", "0.56754553", "0.56754553", "0.56754553", "0.5673013", "0.5672144", "0.56647384", "0.56502545", "0.56453735", "0.5642851", "0.563875", "0.5627081", "0.5612312", "0.5581476", "0.55681366", "0.5564696", "0.55607486", "0.5538173", "0.5532178", "0.5529044", "0.5522591", "0.55197394", "0.55149704", "0.5508849", "0.5506307", "0.5506181", "0.55053675", "0.5500498", "0.5495091", "0.548882", "0.545898", "0.54585266", "0.5457968", "0.5449177", "0.5440889", "0.5419847", "0.53992885", "0.5397299", "0.53920895", "0.53915197", "0.5389917", "0.53816", "0.5365607", "0.5340369", "0.5338558", "0.5336937", "0.5318589", "0.5314219", "0.531324", "0.53066444", "0.53031045", "0.530092", "0.52972317", "0.5294648", "0.5292663", "0.5285106", "0.5281134", "0.52802193", "0.5280097", "0.5274452", "0.52722824", "0.5264119", "0.5255826", "0.52550673", "0.52500695", "0.52297115" ]
0.0
-1
Update spec dependencies from new source
def update_deps_from(new_source) @metadata[:requires] = non_gem_requirements + extra_gem_requirements(new_source) + new_source.deps.select { |r| !excludes_dep?(r.name) } .collect { |r| RPM::Requirement.from_gem_dep(r) }.flatten @metadata[:build_requires] = non_gem_build_requirements + extra_gem_build_requirements(new_source) + new_source.dev_deps.select { |r| !excludes_dev_dep?(r.name) } .collect { |r| RPM::Requirement.from_gem_dep(r, true) }.flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!\n puts \"Updating gems...\"\n Bundler::CLI.new.update\n @new_spec_set = Bundler.definition.specs\n compute_changes\n end", "def update_files_from(new_source)\n to_add = new_source.file_paths\n @metadata[:files] ||= {}\n @metadata[:files].each { |pkg,spec_files|\n (new_source.file_paths & to_add).each { |gem_file|\n # skip files already included in spec or in dir in spec\n has_file = spec_files.any? { |sf|\n gem_file.gsub(sf,'') != gem_file\n }\n\n to_add.delete(gem_file)\n to_add << gem_file.rpmize if !has_file &&\n !Gem.ignorable_file?(gem_file)\n }\n }\n\n @metadata[:new_files] = to_add.select { |f| !Gem.doc_file?(f) }\n @metadata[:new_docs] = to_add - @metadata[:new_files]\n end", "def update_specfiles(version)\n spec_files.each do |spec_file|\n spec = File.read(spec_file)\n spec.gsub!(/^(\\s*)Version:(\\s*).*$/, \"\\\\1Version:\\\\2#{version}\")\n File.write(spec_file, spec)\n end\nend", "def touch_dependency source, specfile\n expect( cover_source_by( source, specfile)).to be_true\nend", "def update!\n if path = vendorized?\n type = File.symlink?(path) ? :symlink : :copy\n FileUtils.rm_rf normalize(:lib)\n send \"vendorize_with_#{type}\"\n say \"updated #{type} #{path} -> #{program(:version)}\"\n else\n ['dom.html', 'rhino.js', 'node.js'].each do |path|\n path = normalize path\n next unless File.exists? path\n contents = File.read(path).gsub /jspec-(\\d+\\.\\d+\\.\\d+)/, \"jspec-#{program(:version)}\"\n if program(:version) == $1\n say \"skipping #{path}; already #{$1}\"\n next\n end\n File.open(path, 'r+'){ |file| file.write contents } \n say \"updated #{path}; #{$1} -> #{program(:version)}\"\n end\n end\n end", "def update_with_missing(source_uri, missing_names)\n progress = ui.progress_reporter(missing_names.size,\n \"Need to update #{missing_names.size} gems from #{source_uri}\")\n missing_names.each do |spec_name|\n begin\n spec_uri = source_uri + \"/quick/#{spec_name}.gemspec.rz\"\n zipped_yaml = fetcher.fetch_path spec_uri\n gemspec = YAML.load unzip(zipped_yaml)\n add_spec gemspec\n progress.updated spec_name\n rescue RuntimeError => ex\n ui.say \"Failed to download spec for #{spec_name} from #{source_uri}\"\n end\n end\n progress.done\n progress.count\n end", "def refresh!\n load_gems_in(self.class.installed_spec_directories)\n end", "def update_to(new_source)\n update_deps_from(new_source)\n update_files_from(new_source)\n update_metadata_from(new_source)\n end", "def patched\n vendored.collect do |dep|\n # TODO: right now just handling git based alternate sources,\n # should be able to handle other types bundler supports\n # (path and alternate rubygems src)\n next unless dep.source.is_a?(Bundler::Source::Git)\n src = dep.source\n\n # retrieve gem\n gem = if src.version\n Polisher::Gem.new(:name => dep.name, :version => src.version)\n else\n Polisher::Gem.retrieve(dep.name)\n end\n\n # retrieve dep\n git = Polisher::Git::Repo.new :url => src.uri\n git.clone unless git.cloned?\n git.checkout src.ref if src.ref\n\n # diff gem against git\n gem.diff(git.path)\n end.compact!\n end", "def refresh_from_source(*components)\n source = Source.new\n source.options = options\n components.each do |name|\n source.clone(name)\n source.install(name) if options[:install]\n end\n end", "def update_depends include_dirs, src\r\n if not @new_depends.has_key? src\r\n includes = find_includes include_dirs, src\r\n @new_depends[src] = includes\r\n\r\n # Add any new includes to list for scanning \r\n if includes\r\n includes.each { |inc|\r\n update_depends include_dirs, inc\r\n }\r\n end\r\n end\r\n end", "def refresh_from_source(*components)\n opts = components.last.is_a?(Hash) ? components.pop : {}\n source = Source.new\n source.options = options\n components.each do |name|\n source.clone(name)\n source.install_from_src(name, opts) if options[:install]\n end\n end", "def update!(**args)\n @pull_deps = args[:pull_deps] if args.key?(:pull_deps)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @pull_deps = args[:pull_deps] if args.key?(:pull_deps)\n @source = args[:source] if args.key?(:source)\n end", "def init_gemspecs\n Gem.source_index.map { |_, spec| spec }.sort { |a,b|\n\t(a.name <=> b.name).nonzero? || (b.version <=> a.version)\n }\n end", "def sync_spec_puppet_module\n copy_skel_files\n install_fixtures\n install_spec_helper\n\n # ONLY install init_spec.rb if no spec files already exist in spec/classes.\n # These files are otherwise not managed from here.\n unless @config[@origin].has_key?('no_init_spec')\n if (Dir.entries('spec/classes') - %w{. .. .gitkeep readme_spec.rb}).empty?\n install_template(\n [\"#{@templates}/init_spec.rb\"], 'spec/classes/init_spec.rb')\n end\n end\n end", "def update_libraries uri\n src = sources.find(uri)\n libraries.each do |lib|\n lib.merge src if lib.contain?(src.filename)\n end\n diagnoser.schedule uri\n end", "def update_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-d' : '-q')}\"\n end", "def compute_changes\n spec_sets_diff!\n\n old_spec_set.each do |old_gem|\n updated_gem = new_spec_set.find { |new_gem| new_gem.name == old_gem.name }\n next unless updated_gem && old_gem.version != updated_gem.version\n\n fill_changes(old_gem, updated_gem)\n end\n end", "def load_spec(name, version, platform, source) # :nodoc:\n dep = Gem::Dependency.new name, version\n\n found = @specs.find do |spec|\n dep.matches_spec? spec and spec.platform == platform\n end\n\n tuple = Gem::NameTuple.new found.name, found.version, found.platform\n\n found.source.fetch_spec tuple\n end", "def refresh_dependencies(options = {}); end", "def update_gems\n gemfile = File.read('Gemfile')\n included_gems = %w[cocina-models dor-services-client sdr-client].filter { |gem_name| gemfile.include?(gem_name)}\n ErrorEmittingExecutor.execute(\"bundle update #{included_gems.join(' ')}\") unless included_gems.empty?\nend", "def resolve_dependencies\n _pt_resolve_dependencies\n\n puts \"plugin hook after resolve_dependencies\"\n\n pt_internal = PT_internal.instance\n\n\n specifications = analysis_result.specifications\n specs_to_modify = specifications.select do |s|\n pt_internal.l_names_using_binary.index(s.name)\n end\n\n specs_to_modify.map do |s|\n # :exclude_files has no getter\n exclude_files = [s.attributes_hash[\"exclude_files\"]]\n\n s.exclude_files = [exclude_files, PT::EXCLUDE_SOURCE_PATTERN].flatten\n\n s.subspecs.each do |subs|\n exclude_files = [subs.attributes_hash[\"exclude_files\"]]\n subs.exclude_files = [exclude_files, PT::EXCLUDE_SOURCE_PATTERN].flatten\n end\n\n end\n end", "def dependency(code, artifacts, target_version, options = {})\n desc \"Update the #{code} dependencies in build.yaml\"\n command(:\"patch_#{code}_dep\") do |app|\n patch_versions(app, artifacts, target_version, options)\n end\n end", "def update include_dirs, source\r\n if not @source_files.include? source\r\n @source_files << source\r\n end\r\n update_depends include_dirs, source\r\n end", "def load_spec name, ver, platform, source\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end", "def refresh_dependents(options = {}); end", "def prefetch(reqs)\n return unless @specs.empty?\n\n @repositories.each do |name, (repository, reference)|\n source = Gem::Source::Git.new name, repository, reference\n source.root_dir = @root_dir\n source.remote = @remote\n\n source.specs.each do |spec|\n git_spec = Gem::Resolver::GitSpecification.new self, spec, source\n\n @specs[spec.name] = git_spec\n end\n end\n end", "def refresh_from_gems(*components)\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install(name) }\n end", "def load_spec(name, ver, platform, source) # :nodoc:\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end", "def refresh_from_gems(*components)\n opts = components.last.is_a?(Hash) ? components.pop : {}\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install_gem(name, opts) }\n end", "def after_source_download\n Dir.chdir cachedir/name do\n sh \"git checkout #{version}\"\n sh 'git submodule update --init'\n end\n end", "def install_dependencies(spec)\n spec.runtime_dependencies.each do |dependency|\n install_spec(dependency.to_spec)\n end\n end", "def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end", "def cover_source_by source, specfile\n _source = File.expand_path( \"../../../#{source}\", __FILE__ )\n _spec = File.expand_path(\"../../#{specfile}\", __FILE__)\n FileUtils.touch(_spec) if File.mtime(_source) > File.mtime(_spec)\n File.mtime(_source) <= File.mtime(_spec)\nend", "def load_spec(name, version, platform, source) # :nodoc:\n @specs.fetch name\n end", "def updated_gemfile_requirement(req)\n return req unless latest_resolvable_version\n return req if existing_version && no_change_in_version?\n return req if !existing_version && new_version_satisfies?(req)\n\n requirements =\n req[:requirement].split(\",\").map { |r| Gem::Requirement.new(r) }\n\n new_req =\n if requirements.any?(&:exact?)\n \"= #{latest_resolvable_version}\"\n elsif requirements.any? { |r| r.to_s.start_with?(\"~>\") }\n tw_req = requirements.find { |r| r.to_s.start_with?(\"~>\") }\n update_twiddle_version(tw_req, latest_resolvable_version).to_s\n else\n update_gemfile_range(requirements).map(&:to_s).join(\", \")\n end\n\n req.merge(requirement: new_req)\n end", "def gemspecs; end", "def standard_dependency(code, group, base_artifact, target_version, options = {})\n artifacts = []\n\n options = options.dup\n\n standard_suffixes = %w(\n shared:jar\n model:jar model-qa-support:jar\n replicant-shared:jar replicant-qa-support:jar\n gwt:jar gwt-qa-support:jar\n server:war\n server:jar server-qa-support:jar\n db:jar\n integration-qa-support:jar\n sync_model:jar\n soap-client:jar soap-qa-support:jar\n )\n\n %W(#{group} #{group}.pg).each do |g|\n ((options[:additional_artifacts] || []) + %W(domains-#{base_artifact}:json) + standard_suffixes).\n each do |artifact_suffix|\n artifacts << \"#{g}:#{base_artifact}-#{artifact_suffix}\"\n end\n end\n\n desc \"Update the #{code} dependencies in build.yaml\"\n command(:\"patch_#{code}_dep\") do |app|\n patch_versions(app, artifacts, target_version, options)\n end\n end", "def update(dependencies)\n reset_dependencies!\n\n dependencies.each { |dependency| append(dependency) }\n save\n end", "def update\n self.install\n end", "def update\n self.install\n end", "def update\n self.install\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 compute_changes\n @old_spec_set.each do |gem_specs|\n unless ( old_version = gem_specs.version ) == ( new_version = @new_spec_set[ gem_specs.name ].first.version )\n @changes[ gem_specs.name ] = { versions: { old: old_version.to_s, new: new_version.to_s } }\n end\n end\n end", "def setup_spec_in_sandbox(sandbox)\n if git_url?(@name)\n spec = spec_with_url(@name, @podspec_name)\n sandbox.store_pre_downloaded_pod(spec.name)\n else\n update_specs_repos\n spec = spec_with_name(@name)\n end\n spec\n end", "def update *reqs\n fire :updating, :updated do\n @environments |= @sandbox.environments\n @options.merge! reqs.pop if Hash === reqs.last\n @requirement = Gem::Requirement.new reqs unless reqs.empty?\n end\n\n self\n end", "def compare(upstream_source)\n same = {}\n diff = {}\n upstream_source.deps.each do |d|\n spec_reqs = self.requirements_for_gem(d.name)\n spec_reqs_specifier = spec_reqs.empty? ? nil :\n spec_reqs.collect { |req| req.specifier }\n\n if spec_reqs.nil?\n diff[d.name] = {:spec => nil,\n :upstream => d.requirement.to_s}\n\n elsif !spec_reqs.any? { |req| req.matches?(d) } ||\n !self.has_all_requirements_for?(d)\n diff[d.name] = {:spec => spec_reqs_specifier,\n :upstream => d.requirement.to_s}\n\n elsif !diff.has_key?(d.name)\n same[d.name] = {:spec => spec_reqs_specifier,\n :upstream => d.requirement.to_s }\n end\n end\n\n @metadata[:requires].each do |req|\n next unless req.gem?\n\n upstream_dep = upstream_source.deps.find { |d| d.name == req.gem_name }\n\n if upstream_dep.nil?\n diff[req.gem_name] = {:spec => req.specifier,\n :upstream => nil}\n\n elsif !req.matches?(upstream_dep)\n diff[req.gem_name] = {:spec => req.specifier,\n :upstream => upstream_dep.requirement.to_s }\n\n elsif !diff.has_key?(req.gem_name)\n same[req.gem_name] = {:spec => req.specifier,\n :upstream => upstream_dep.requirement.to_s }\n end\n end unless @metadata[:requires].nil?\n\n {:same => same, :diff => diff}\n end", "def released_specs; end", "def sync_rspec_only\n copy_skel_files\n end", "def depends_on(*sources, &update_func)\n @sources = sources\n @updater = update_func\n @value = nil\n return self\n end", "def update\n install\n end", "def dependencies\n spec.dependencies\n end", "def dependencies\n spec.dependencies\n end", "def reinitialize_spec_set!\n Bundler.remove_instance_variable(:@locked_gems)\n Bundler.remove_instance_variable(:@definition)\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n source.fetch_spec tuple\n rescue Gem::RemoteFetcher::FetchError\n raise if @original_platform == @platform\n\n tuple = Gem::NameTuple.new @name, @version, @original_platform\n source.fetch_spec tuple\n end\n end", "def test_gem_should_not_change\n gemfile = bake_testing_gem\n\n patches = []\n patches << bake_incorrect_patch\n\n # Create a new patched gem in @gems_dir\n patcher = Gem::Patcher.new(gemfile, @gems_dir)\n patched_gem = patcher.patch_with(patches, @options)\n\n # Unpack\n package = Gem::Package.new patched_gem\n package.extract_files @gems_dir\n\n assert_equal original_file, file_contents('foo.rb')\n assert_equal original_gemspec, current_gemspec\n end", "def check_update(component_def, spec, gem_name_to_version)\n component_def.each_line do |line|\n # TODO: Some of the component files handle multiple versions with a case statement (for example net-ssh). \n # Add more logic to compare each of those versions. For now there are only a hand full. \n if line =~ /pkg.version/\n ver = Gem::Version.new(line.scan(/\\d\\.*/).join(''))\n if gem_name_to_version[spec.name] > ver\n warn \"Update needed for: #{spec.name} \\nUpgrade from #{ver} to #{gem_name_to_version[spec.name]}\\n\\n\"\n end\n end\n end\nend", "def locked_specs_as_deps\n deps = @dependencies & @locked_deps\n\n @dependencies.each do |dep|\n next if deps.include?(dep)\n deps << dep if @locked_specs.any? { |s| s.satisfies?(dep) }\n end\n\n meta_deps = @locked_specs.for(deps).map do |s|\n dep = Gem::Dependency.new(s.name, s.version)\n @locked_deps.each do |d|\n dep.source = d.source if d.name == dep.name\n end\n dep\n end\n end", "def patch_artifact(name, dependencies, target_version, options = {})\n command(:\"patch_#{name}_version\") do |app|\n patch_versions(app, dependencies, target_version, options)\n end\n end", "def fill_changes(old_gem, updated_gem)\n changes[old_gem.name] = {\n versions: {\n old: old_gem.version.to_s, new: updated_gem.version.to_s\n },\n source: updated_gem.source\n }\n end", "def update!(**args)\n @dependencies = args[:dependencies] if args.key?(:dependencies)\n @has_dependencies = args[:has_dependencies] if args.key?(:has_dependencies)\n @version = args[:version] if args.key?(:version)\n end", "def source_vendor_path; \"#{spec_path}/vendor\"; end", "def update_package_json_resolutions(package_json_content:, new_req:,\n dependency:, old_req:)\n dep = dependency\n resolutions =\n JSON.parse(package_json_content).fetch(\"resolutions\", {}).\n reject { |_, v| v != old_req && v != dep.previous_version }.\n select { |k, _| k == dep.name || k.end_with?(\"/#{dep.name}\") }\n\n return package_json_content unless resolutions.any?\n\n content = package_json_content\n resolutions.each do |_, resolution|\n original_line = declaration_line(\n dependency_name: dep.name,\n dependency_req: { requirement: resolution },\n content: content\n )\n\n new_resolution = resolution == old_req ? new_req : dep.version\n\n replacement_line = replacement_declaration_line(\n original_line: original_line,\n old_req: { requirement: resolution },\n new_req: { requirement: new_resolution }\n )\n\n content = content.gsub(original_line, replacement_line)\n end\n content\n end", "def use(*specs)\n named = specs.flatten.inject({}) do |seen, spec|\n if Hash === spec && (spec.keys & ActsAsArtifact::ARTIFACT_ATTRIBUTES).empty?\n spec.each_pair do |name, spec|\n if ArtifactNamespace === spec # create as subnamespace\n raise ArgumentError.new(\"Circular reference\") if self == spec\n registry[name.to_sym] = spec\n elsif Numeric === spec || (String === spec && VersionRequirement.version?(spec))\n artifact = ArtifactRequirement.allocate\n artifact.name = name\n artifact.version = spec.to_s\n seen[artifact.name] ||= artifact\n elsif Symbol === spec\n self.alias name, spec\n elsif Array === spec # a group\n seen[name] ||= spec.map { |s| ArtifactRequirement.new(s) }\n else\n artifact = ArtifactRequirement.new(spec)\n artifact.name = name\n seen[artifact.name] ||= artifact\n end\n end\n else\n if Symbol === spec\n artifact = get(spec).dclone\n else\n artifact = ArtifactRequirement.new(spec)\n end\n seen[artifact.name] ||= artifact\n end\n seen\n end\n named.each_pair do |name, artifact|\n is_group = Array === artifact\n artifact = [artifact].flatten.map do |artifact|\n unvers = artifact.unversioned_spec\n previous = get(unvers, false) || get(name, false)\n if previous # have previous on current namespace\n if previous.requirement # we must satisfy the requirement\n if unvers\n satisfied = previous.satisfied_by?(artifact)\n else # we only have the version\n satisfied = previous.requirement.satisfied_by?(artifact.version)\n end\n raise \"Unsatisfied dependency #{previous} \" +\n \"not satisfied by #{artifact}\" unless satisfied\n previous.version = artifact.version # OK, set new version\n artifact = previous # use the same object for aliases\n else # not a requirement, set the new values\n unless artifact.id == previous.id && name != previous.name\n previous.copy_attrs(artifact)\n artifact = previous\n end\n end\n else\n if unvers.nil? && # we only have the version\n (previous = get(unvers, true, false, false))\n version = artifact.version\n artifact.copy_attrs(previous)\n artifact.version = version\n end\n artifact.requirement = nil\n end\n artifact.selected!\n end\n artifact = artifact.first unless is_group\n if is_group\n names = artifact.map do |art|\n unv = art.unversioned_spec\n registry[unv] = art\n unv\n end\n group(name, *(names + [{:namespace => self}]))\n elsif artifact.id\n unvers = artifact.unversioned_spec\n registry[name] = artifact\n registry.alias unvers, name\n else\n registry[name] = artifact\n end\n end\n self\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 install_dependencies(spec)\n di = Gem::DependencyInstaller.new\n\n spec.development_dependencies.each do |dep|\n unless source_index.search(dep).last\n if config[\"install_development_dependencies\"]\n say \"Installing test dependency #{dep.name} (#{dep.requirement})\"\n di.install(dep) \n else\n if ask_yes_no(\"Install development dependency #{dep.name} (#{dep.requirement})?\")\n say \"Installing test dependency #{dep.name} (#{dep.requirement})\"\n di.install(dep) \n else\n alert_error \"Failed to install dependencies required to run tests. Aborting.\"\n raise Gem::TestError\n end\n end\n end\n end\n end", "def test_change_file_patch\n gemfile = bake_testing_gem\n\n patches = []\n patches << bake_change_file_patch\n\n # Creates new patched gem in @gems_dir\n patcher = Gem::Patcher.new(gemfile, @gems_dir)\n patched_gem = patcher.patch_with(patches, @options)\n\n # Unpack\n package = Gem::Package.new patched_gem\n package.extract_files @gems_dir\n\n assert_equal patched_file, file_contents('foo.rb')\n end", "def specs_matching specs\n req = DeferredRequest.pull response_service.uuid, specs\n revised_specs = req && unpack_request(req)\n revised_specs\n end", "def add_specs(*gem_specs); end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n\n @source.fetch_spec tuple\n end\n end", "def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend", "def setup(&block)\n resolver = Resolver.new\n begin\n spec = Spec.new(&block)\n resolver.require(spec.dependencies, spec.sources)\n ensure\n resolver.terminate\n end\n end", "def update\n # Install in pacman can be used for update, too\n self.install\n end", "def update\n # Install in pacman can be used for update, too\n self.install\n end", "def install_source_of_pod(pod_name)\n pod_installer = create_pod_installer(pod_name)\n pod_installer.install!\n @installed_specs.concat(pod_installer.specs_by_platform.values.flatten.uniq)\n end", "def update!\n log(:info, \"Updating source: #{@host}\")\n Downloader.get(specs_url, work_archive_file)\n Unpacker.gzip(work_archive_file)\n FileUtils.mv(work_index_file, index_file)\n end", "def update\n `cd #{__dir__} && git pull origin master`\n install\nend", "def update_gemspec(attribute, new_value, literal = false)\n\n unless literal\n new_value = case new_value\n when Array then \"%w(#{new_value.join(' ')})\"\n when Hash, String then new_value.inspect\n when Date then new_value.strftime('%Y-%m-%d').inspect\n else raise \"Cannot write value #{new_value.inspect} to gemspec file!\"\n end\n end\n\n spec = File.read(gemspec_file)\n regexp = Regexp.new('^(\\s+\\w+\\.' + Regexp.quote(attribute.to_s) + '\\s*=\\s*)[^\\s].*$')\n if spec.sub!(regexp) { $1 + new_value }\n File.open(gemspec_file, 'w') { |f| f << spec }\n modified_files << gemspec_file\n\n # Reload the gemspec so the changes are incorporated\n load_gemspec!\n \n # Also mark the Gemfile.lock file as changed because of the new version.\n modified_files << 'Gemfile.lock' if File.exist?(File.join(root_dir, 'Gemfile.lock'))\n end\n end", "def version_task\n update_gemspec(:version, ENV['VERSION']) if ENV['VERSION']\n update_gemspec(:date, Date.today)\n\n update_version_file(gemspec.version)\n update_version_constant(gemspec.version)\n end", "def update_datapackage\n update_file_in_repo(\"datapackage.json\", create_json_datapackage)\n end", "def add_dependencies\n self.extra_deps = normalize_deps extra_deps\n self.extra_dev_deps = normalize_deps extra_dev_deps\n\n case name\n when \"hoe\" then\n # do nothing? these deps are already in the hoe spec in the Rakefile\n else\n version = VERSION.split(/\\./).first(2).join(\".\")\n dependency \"hoe\", \"~> #{version}\", :development\n end\n\n seen = {}\n\n extra_deps.each do |dep|\n next if seen[dep.first]\n seen[dep.first] = true\n\n spec.add_dependency(*dep)\n end\n\n extra_dev_deps.each do |dep|\n next if seen[dep.first]\n seen[dep.first] = true\n\n spec.add_development_dependency(*dep)\n end\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 dependencies_for(specification)\n root_name = Specification.root_name(specification.name)\n specification.all_dependencies.map do |dependency|\n if dependency.root_name == root_name\n dependency.dup.tap { |d| d.specific_version = specification.version }\n else\n dependency\n end\n end\n end", "def refresh!\n from_installed_gems\n end", "def specs\n @specs ||= begin\n specs = resolve.materialize(requested_dependencies)\n\n all_dependencies = requested_dependencies.concat(specs.flat_map(&:dependencies))\n if all_dependencies.any? { |d| d.name == \"bundler\" } && !specs[\"bundler\"].any?\n bundler = sources.metadata_source.specs.search(bundler_query).last\n specs[\"bundler\"] = bundler\n end\n\n specs\n end\n end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def update_libraries(uri); end", "def specs\n checkout\n\n return [] unless install_dir\n\n Dir.chdir install_dir do\n Dir['{,*,*/*}.gemspec'].map do |spec_file|\n directory = File.dirname spec_file\n file = File.basename spec_file\n\n Dir.chdir directory do\n spec = Gem::Specification.load file\n if spec\n spec.base_dir = base_dir\n\n spec.extension_dir =\n File.join base_dir, 'extensions', Gem::Platform.local.to_s,\n Gem.extension_api_version, \"#{name}-#{dir_shortref}\"\n\n spec.full_gem_path = File.dirname spec.loaded_from if spec\n end\n spec\n end\n end.compact\n end\n end", "def gemfile spec, source, destination = nil\n destination ||= File.expand_path \".\"\n\n require \"rubygems/builder\"\n\n Dir.chdir source do\n FileUtils.mv Gem::Builder.new(spec).build, destination\n end\n\n destination\n end", "def bump_patch_version; end", "def update_metadata_from(new_source)\n # update to new version\n @metadata[:version] = new_source.version\n @metadata[:release] = \"1%{?dist}\"\n\n # add changelog entry\n changelog_entry = <<EOS\n* #{Time.now.strftime(\"%a %b %d %Y\")} #{RPM::Spec.current_author} - #{@metadata[:version]}-1\n- Update to version #{new_source.version}\nEOS\n @metadata[:changelog_entries] ||= []\n @metadata[:changelog_entries].unshift changelog_entry.rstrip\n end", "def update\n @parent.gemset_update\n end" ]
[ "0.68556887", "0.67198884", "0.6539907", "0.646059", "0.6451124", "0.6295985", "0.6194238", "0.6152833", "0.6103472", "0.60737646", "0.6068849", "0.605756", "0.60083675", "0.60083675", "0.5986238", "0.5981282", "0.5963764", "0.592853", "0.59255964", "0.5885336", "0.5826517", "0.5823941", "0.5821424", "0.58111805", "0.581032", "0.5800689", "0.57713944", "0.57607526", "0.5759738", "0.57305276", "0.57089245", "0.56942695", "0.5686346", "0.5677804", "0.56695634", "0.5630366", "0.56095123", "0.559218", "0.5591249", "0.5571177", "0.5564632", "0.5564632", "0.5564602", "0.5560769", "0.5546088", "0.5534677", "0.5527721", "0.55242926", "0.5511645", "0.5510012", "0.5498139", "0.54950106", "0.5484257", "0.5484257", "0.5476545", "0.54729843", "0.5456177", "0.5455223", "0.54550254", "0.5449142", "0.54464686", "0.5443833", "0.5440116", "0.54332495", "0.54325056", "0.5423727", "0.5423124", "0.5413495", "0.5408163", "0.53918296", "0.5391074", "0.5381509", "0.53742623", "0.5367914", "0.5367914", "0.53649676", "0.53636545", "0.5361225", "0.5357124", "0.533863", "0.5336433", "0.53305864", "0.5330374", "0.5325494", "0.5324773", "0.5322132", "0.53185177", "0.53185177", "0.53185177", "0.53185177", "0.53185177", "0.53185177", "0.53185177", "0.53185177", "0.5312645", "0.53122705", "0.53101516", "0.5302174", "0.5300272", "0.5279782" ]
0.69750834
0
Internal helper to update spec files from new source
def update_files_from(new_source) to_add = new_source.file_paths @metadata[:files] ||= {} @metadata[:files].each { |pkg,spec_files| (new_source.file_paths & to_add).each { |gem_file| # skip files already included in spec or in dir in spec has_file = spec_files.any? { |sf| gem_file.gsub(sf,'') != gem_file } to_add.delete(gem_file) to_add << gem_file.rpmize if !has_file && !Gem.ignorable_file?(gem_file) } } @metadata[:new_files] = to_add.select { |f| !Gem.doc_file?(f) } @metadata[:new_docs] = to_add - @metadata[:new_files] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_specfiles(version)\n spec_files.each do |spec_file|\n spec = File.read(spec_file)\n spec.gsub!(/^(\\s*)Version:(\\s*).*$/, \"\\\\1Version:\\\\2#{version}\")\n File.write(spec_file, spec)\n end\nend", "def cover_source_by source, specfile\n _source = File.expand_path( \"../../../#{source}\", __FILE__ )\n _spec = File.expand_path(\"../../#{specfile}\", __FILE__)\n FileUtils.touch(_spec) if File.mtime(_source) > File.mtime(_spec)\n File.mtime(_source) <= File.mtime(_spec)\nend", "def updated_source_file; end", "def update!\n if path = vendorized?\n type = File.symlink?(path) ? :symlink : :copy\n FileUtils.rm_rf normalize(:lib)\n send \"vendorize_with_#{type}\"\n say \"updated #{type} #{path} -> #{program(:version)}\"\n else\n ['dom.html', 'rhino.js', 'node.js'].each do |path|\n path = normalize path\n next unless File.exists? path\n contents = File.read(path).gsub /jspec-(\\d+\\.\\d+\\.\\d+)/, \"jspec-#{program(:version)}\"\n if program(:version) == $1\n say \"skipping #{path}; already #{$1}\"\n next\n end\n File.open(path, 'r+'){ |file| file.write contents } \n say \"updated #{path}; #{$1} -> #{program(:version)}\"\n end\n end\n end", "def updated_source_file?; end", "def sync_rspec_only\n copy_skel_files\n end", "def update!\n log(:info, \"Updating source: #{@host}\")\n Downloader.get(specs_url, work_archive_file)\n Unpacker.gzip(work_archive_file)\n FileUtils.mv(work_index_file, index_file)\n end", "def touch_dependency source, specfile\n expect( cover_source_by( source, specfile)).to be_true\nend", "def update!\n puts \"Updating gems...\"\n Bundler::CLI.new.update\n @new_spec_set = Bundler.definition.specs\n compute_changes\n end", "def patch(patch)\n File.read(\"spec/fixtures/#{patch}.patch\")\nend", "def process_specs\n source_path = configuration['specs']['source_path']\n destin_path = configuration['specs']['destin_path']\n ignored_paths = configuration['specs']['ignored_paths']\n ignored_methods = configuration['specs']['ignored_methods']\n\n find_files_without(source_path, ignored_paths).each do |path|\n next unless path.include?('/models/') || path.include?('/controllers/') || path.include?('/helpers/')\n @spec_template = indent_template(spec_template, 0)\n @spec_describe_template = spec_describe_template.gsub(' ' * 8, ' ' * 2).strip.prepend(' ' * 2)\n\n spath = path.split(\"./#{source_path}/\")[1]\n dpath = \"./#{destin_path}/#{spath}\".gsub('.rb', '_spec.rb')\n\n unless File.exists?(dpath)\n methods_names_source = extract_methods_names_from_file(path)\n specs_methods_to_string = methods_names_source.map do |method_name|\n @spec_describe_template.gsub('%{method_name}', method_name)\n end.join(\"\\n\\n\")\n\n @spec_template = @spec_template.gsub('%{class}', extract_spec_name(path))\n @spec_template = @spec_template.gsub('%{methods}', specs_methods_to_string)\n @spec_template = @spec_template.gsub('%{file_path}', path)\n @spec_template = @spec_template.gsub('%{class_type}', extract_spec_type(path))\n @spec_template = @spec_template.gsub('%{author_name}', extract_author_name)\n\n FileUtils.mkdir_p(File.dirname(dpath))\n File.new(dpath, 'w+').puts(@spec_template)\n end\n end\n end", "def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end", "def sync_spec_puppet_module\n copy_skel_files\n install_fixtures\n install_spec_helper\n\n # ONLY install init_spec.rb if no spec files already exist in spec/classes.\n # These files are otherwise not managed from here.\n unless @config[@origin].has_key?('no_init_spec')\n if (Dir.entries('spec/classes') - %w{. .. .gitkeep readme_spec.rb}).empty?\n install_template(\n [\"#{@templates}/init_spec.rb\"], 'spec/classes/init_spec.rb')\n end\n end\n end", "def test_change_file_patch\n gemfile = bake_testing_gem\n\n patches = []\n patches << bake_change_file_patch\n\n # Creates new patched gem in @gems_dir\n patcher = Gem::Patcher.new(gemfile, @gems_dir)\n patched_gem = patcher.patch_with(patches, @options)\n\n # Unpack\n package = Gem::Package.new patched_gem\n package.extract_files @gems_dir\n\n assert_equal patched_file, file_contents('foo.rb')\n end", "def gemfile spec, source, destination = nil\n destination ||= File.expand_path \".\"\n\n require \"rubygems/builder\"\n\n Dir.chdir source do\n FileUtils.mv Gem::Builder.new(spec).build, destination\n end\n\n destination\n end", "def load_spec name, ver, platform, source\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end", "def load_spec(name, ver, platform, source) # :nodoc:\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end", "def spec= s \n if ENV['PLATFORM'] =~ /win32/\n s.files = s.files.reject! {|f| f =~ /extconf\\.rb/}\n else\n s.files = s.files.reject! {|f| f =~ /win\\//}\n end\n @spec = s\n end", "def update_expect\n # Expect File\n @ExpectDir = \"Expect\"\n dir_name = @ExpectDir\n Common.make_dir_with_delete(\"#{dir_name}\")\n @report.printf(\"\\n\")\n @report.printf(\"Search Expect Golden File...\\n\")\n \n # Copy from GoldenExpect\n printf(\"@I:Copy from Golden Expect dir \\\"%s\\\"\\n\",@GoldenExpectDir)\n @InstInfo.sort_by{|inst|\n inst.ModuleName\n }.each{|inst|\n file_list = Array.new\n # Search File by ModuleName\n file_list = Dir.glob(\"#{@GoldenExpectDir}/*\\(#{inst.ModuleName}\\).expect\")\n if file_list.size != 0\n @report.printf(\" Module:%-25s( Inst:%-15s):Copy expect file from CCGolden to Expect\\n\",inst.ModuleName,inst.InstanceName)\n else\n @report.printf(\" Module:%-25s( Inst:%-15s):Not found expect file in CCGolden\\n\",inst.ModuleName,inst.InstanceName)\n end\n }\n=begin\n Dir.glob(\"#{@GoldenExpectDir}/*.expect\").each{|file|\n FileUtils.cp(\"#{file}\",\"#{@ExpectDir}\")\n @report.printf(\" Copied from %s to %s\\n\",file,@ExpectDir)\n }\n @report.printf(\"Done\\n\\n\")\n\n # Copy from TmpExpect\n printf(\"@I:Copy from Tmp Expect dir \\\"%s\\\"\\n\",@TmpExpectDir)\n Dir.glob(\"#{@TmpExpectDir}/*.expect\").each{|file|\n if File.file?(@ExpectDir+\"/\"+File.basename(\"#{file}\"))\n @report.printf(\" %-40s: Already Exist in %s dir\\n\",File.basename(\"#{file}\"),@ExpectDir)\n else\n FileUtils.cp(\"#{file}\",\"#{@ExpectDir}\")\n @report.printf(\" %-40s: Copy to %s dir\\n\",File.basename(\"#{file}\"),@ExpectDir)\n end\n }\n @report.printf(\"Done\\n\\n\")\n \n file_name = \"product.expect\"\n product = open(\"#{file_name}\",\"w\")\n \n # make one Expect File ( cat )\n Dir.glob(\"#{@ExpectDir}/*.expect\").each{|file|\n File.open(\"#{file}\").each{|line|\n product.printf(\"%s\",line)\n }\n }\n\n product.close\n=end\n \n end", "def update include_dirs, source\r\n if not @source_files.include? source\r\n @source_files << source\r\n end\r\n update_depends include_dirs, source\r\n end", "def update!(**args)\n @extractive_content_spec = args[:extractive_content_spec] if args.key?(:extractive_content_spec)\n @snippet_spec = args[:snippet_spec] if args.key?(:snippet_spec)\n @summary_spec = args[:summary_spec] if args.key?(:summary_spec)\n end", "def set!(new_version)\n current_spec = IO.read(filename)\n\n new_spec = current_spec.gsub(REGEX) do\n m = Regexp.last_match\n next [m[1], m[3], new_version, m[4], m[6]].join\n end\n\n File.open(filename, 'w') { |f| f.write new_spec }\n end", "def refresh_from_source(*components)\n opts = components.last.is_a?(Hash) ? components.pop : {}\n source = Source.new\n source.options = options\n components.each do |name|\n source.clone(name)\n source.install_from_src(name, opts) if options[:install]\n end\n end", "def scan_new_or_changed_with_spec(&block) # :yields: file, spec\n yielded_files = {}\n yield_once_block = Proc.new do |file|\n spec_file = spec_for(file)\n next if yielded_files.has_key? spec_file\n next unless File.exist?(spec_file)\n block.call(file, spec_file)\n yielded_files[spec_file]=file\n end\n scan_new(&yield_once_block)\n scan_changed(&yield_once_block)\n end", "def add_spec_to_project\n mkdir_p('doc')\n cp(\"../#{@spec_filename}\", 'doc')\n end", "def source_change(change, filename)\n end", "def test_new_file_patch\n @options[:strip] = 0\n \n gemfile = bake_testing_gem\n\n patches = []\n patches << bake_new_file_patch\n\n # Create a new patched gem in @gems_dir\n patcher = Gem::Patcher.new(gemfile, @gems_dir)\n patched_gem = patcher.patch_with(patches, @options)\n\n # Unpack\n package = Gem::Package.new patched_gem\n package.extract_files @gems_dir\n\n assert_equal original_file, file_contents('bar.rb')\n end", "def load_spec(name, version, platform, source) # :nodoc:\n @specs.fetch name\n end", "def update_to(new_source)\n update_deps_from(new_source)\n update_files_from(new_source)\n update_metadata_from(new_source)\n end", "def source_vendor_path; \"#{spec_path}/vendor\"; end", "def update_gemspec(attribute, new_value, literal = false)\n\n unless literal\n new_value = case new_value\n when Array then \"%w(#{new_value.join(' ')})\"\n when Hash, String then new_value.inspect\n when Date then new_value.strftime('%Y-%m-%d').inspect\n else raise \"Cannot write value #{new_value.inspect} to gemspec file!\"\n end\n end\n\n spec = File.read(gemspec_file)\n regexp = Regexp.new('^(\\s+\\w+\\.' + Regexp.quote(attribute.to_s) + '\\s*=\\s*)[^\\s].*$')\n if spec.sub!(regexp) { $1 + new_value }\n File.open(gemspec_file, 'w') { |f| f << spec }\n modified_files << gemspec_file\n\n # Reload the gemspec so the changes are incorporated\n load_gemspec!\n \n # Also mark the Gemfile.lock file as changed because of the new version.\n modified_files << 'Gemfile.lock' if File.exist?(File.join(root_dir, 'Gemfile.lock'))\n end\n end", "def update_with_missing(source_uri, missing_names)\n progress = ui.progress_reporter(missing_names.size,\n \"Need to update #{missing_names.size} gems from #{source_uri}\")\n missing_names.each do |spec_name|\n begin\n spec_uri = source_uri + \"/quick/#{spec_name}.gemspec.rz\"\n zipped_yaml = fetcher.fetch_path spec_uri\n gemspec = YAML.load unzip(zipped_yaml)\n add_spec gemspec\n progress.updated spec_name\n rescue RuntimeError => ex\n ui.say \"Failed to download spec for #{spec_name} from #{source_uri}\"\n end\n end\n progress.done\n progress.count\n end", "def refresh_from_source(*components)\n source = Source.new\n source.options = options\n components.each do |name|\n source.clone(name)\n source.install(name) if options[:install]\n end\n end", "def update_filepath(_package_id:, _filepath:, _sha1:, _size:); end", "def spec_file\n @spec_file ||= File.join spec_dir, \"#{full_name}.gemspec\"\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n\n @source.fetch_spec tuple\n end\n end", "def spec\n YAML.load_file(\"#{tmp_folder}/#{repository_name}/#{spec_name}\")\n end", "def update_metadata!\n compilation_context.source_file_database.update_metadata(source_path)\n compilation_context.target_file_database.update_metadata(source_path)\n end", "def setup_spec_in_sandbox(sandbox)\n if git_url?(@name)\n spec = spec_with_url(@name, @podspec_name)\n sandbox.store_pre_downloaded_pod(spec.name)\n else\n update_specs_repos\n spec = spec_with_name(@name)\n end\n spec\n end", "def test_change_file_with_fuzz_patch\n @options[:fuzz] = 2\n \n gemfile = bake_testing_gem\n\n patches = []\n patches << bake_change_file_with_fuzz_patch\n\n # Creates new patched gem in @gems_dir\n patcher = Gem::Patcher.new(gemfile, @gems_dir)\n patched_gem = patcher.patch_with(patches, @options)\n\n # Unpack\n package = Gem::Package.new patched_gem\n package.extract_files @gems_dir\n\n assert_equal patched_file_with_fuzz, file_contents('foo.rb')\n end", "def update!(**args)\n @file_patterns = args[:file_patterns] if args.key?(:file_patterns)\n @sample_gcs_file_specs = args[:sample_gcs_file_specs] if args.key?(:sample_gcs_file_specs)\n end", "def update!(**args)\n @file_patterns = args[:file_patterns] if args.key?(:file_patterns)\n @sample_gcs_file_specs = args[:sample_gcs_file_specs] if args.key?(:sample_gcs_file_specs)\n end", "def add_specs_to_repo\n UI.puts \"\\nAdding the #{'spec'.pluralize(count)} to the `#{@repo}' repo\\n\".yellow\n podspec_files.each do |spec_file|\n spec = Pod::Specification.from_file(spec_file)\n output_path = @source.pod_path(spec.name) + spec.version.to_s\n message = if @message && !@message.empty?\n @message\n elsif output_path.exist?\n \"[Fix] #{spec}\"\n elsif output_path.dirname.directory?\n \"[Update] #{spec}\"\n else\n \"[Add] #{spec}\"\n end\n\n if output_path.exist? && !@allow_overwrite\n raise Informative, \"#{spec} already exists and overwriting has been disabled.\"\n end\n\n FileUtils.mkdir_p(output_path)\n\n if @use_json\n json_file_name = \"#{spec.name}.podspec.json\"\n json_file = File.join(output_path, json_file_name)\n File.open(json_file, 'w') { |file| file.write(spec.to_pretty_json) }\n else\n FileUtils.cp(spec_file, output_path)\n end\n\n # only commit if modified\n if repo_git('status', '--porcelain').include?(spec.name)\n UI.puts \" - #{message}\"\n repo_git('add', spec.name)\n repo_git('commit', '--no-verify', '-m', message)\n else\n UI.puts \" - [No change] #{spec}\"\n end\n end\n end", "def generate_specfile(builddir)\n File.open(specfile(builddir), \"w\") do |f|\n f.puts render_spec\n end\n end", "def prepare_sources\n SOURCES.each_pair do |suite, url|\n prepare_source_for(url, @freshen)\n end\n end", "def update_sources\n source_files_path = Dir['config/locales/**/*.en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: \"/#{File.basename(path).gsub('en-EU', 'en')}\",\n source: path }])\n end\n\n source_files_path = Dir['config/locales/main/en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: '/main.en.yml',\n source: path }])\n end\n end", "def spec_file\n return @spec_file if defined?(@spec_file)\n return @spec_file = nil unless loaded_from && File.file?(loaded_from)\n @spec_file = begin\n file = { name: File.basename(loaded_from), dir: File.dirname(loaded_from) }\n Licensee::ProjectFiles::PackageManagerFile.new(File.read(loaded_from), file)\n end\n end", "def refresh!\n load_gems_in(self.class.installed_spec_directories)\n end", "def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(version_file, 'w') { |file| file.write buildfile }\n end", "def update_sourced_attributes source_name=nil\n if source_name\n @sources[source_name].apply\n else\n @sources.values.each(&:apply)\n end\n end", "def test_gem_should_not_change\n gemfile = bake_testing_gem\n\n patches = []\n patches << bake_incorrect_patch\n\n # Create a new patched gem in @gems_dir\n patcher = Gem::Patcher.new(gemfile, @gems_dir)\n patched_gem = patcher.patch_with(patches, @options)\n\n # Unpack\n package = Gem::Package.new patched_gem\n package.extract_files @gems_dir\n\n assert_equal original_file, file_contents('foo.rb')\n assert_equal original_gemspec, current_gemspec\n end", "def update_departure_sample_timestamps\n old_file_path = rename_original_file\n\n build_new_file(old_file_path: old_file_path)\n ensure\n File.delete(old_file_path)\n end", "def build_sources\n sources = [File.join(source_dir, 'jasmine-webos-core.js'),\n File.join(source_dir, 'proxy-app-assistant.js')]\n\n sources += Dir.glob(\"#{source_dir}/**/*.js\").reject { |f| sources.include?(f) }.sort\n sources += Dir.glob(\"#{plugin_dir}/spec/helpers/*.js\")\n sources\nend", "def watch_src\n Dispatch::Queue.concurrent.async do\n raise \"$project_src_dir undefined.\" if ! $project_src_dirs\n\n dirs = $project_src_dirs.map { |dir| dir.stringByExpandingTildeInPath }\n options = FSEvent::CLI.parse(dirs.dup << '--file-events')\n format = options[:format]\n\n notifier = FSEvent::Notifier.new\n options[:urls].each do |url|\n puts \"watching #{url.path} with options #{options}\"\n notifier.watch(url.path, *options[:create_flags], options) do |event_list|\n event_list.events.each do |event|\n puts \"reload #{event.path}\"\n self.load_src File.basename(event.path.to_s)\n\n if block_given?\n puts \"yield to block\"\n yield\n end\n end\n end\n end\n notifier.run\n end\n end", "def specs\n checkout\n\n return [] unless install_dir\n\n Dir.chdir install_dir do\n Dir['{,*,*/*}.gemspec'].map do |spec_file|\n directory = File.dirname spec_file\n file = File.basename spec_file\n\n Dir.chdir directory do\n spec = Gem::Specification.load file\n if spec\n spec.base_dir = base_dir\n\n spec.extension_dir =\n File.join base_dir, 'extensions', Gem::Platform.local.to_s,\n Gem.extension_api_version, \"#{name}-#{dir_shortref}\"\n\n spec.full_gem_path = File.dirname spec.loaded_from if spec\n end\n spec\n end\n end.compact\n end\n end", "def create_source_files\n empty_directory(File.join(target_dir, \"lib/kitchen/driver\"))\n\n create_template(\n \"version.rb.erb\",\n \"lib/kitchen/driver/#{name}_version.rb\"\n )\n create_template(\n \"driver.rb.erb\",\n \"lib/kitchen/driver/#{name}.rb\"\n )\n end", "def after_source_download\n Dir.chdir cachedir/name do\n sh \"git checkout #{version}\"\n sh 'git submodule update --init'\n end\n end", "def source_index\n say \"Updating Gem source index for: #{@uri}\"\n begin\n require 'zlib'\n yaml_spec = fetch_path(\"/yaml.Z\")\n yaml_spec = Zlib::Inflate.inflate(yaml_spec)\n rescue\n yaml_spec = nil\n end\n begin\n\tyaml_spec = fetch_path(\"/yaml\") unless yaml_spec\n\tr = convert_spec(yaml_spec)\n rescue SocketError => e\n\traise RemoteSourceException.new(\"Error fetching remote gem cache: #{e.to_s}\")\n end\n end", "def setup_spec(t)\n t.spec_opts = ['--options', \"\\\"#{RIGHT_BOT_ROOT}/spec/spec.opts\\\"\"]\n t.spec_files = FileList[\"#{RIGHT_BOT_ROOT}/**/spec/**/*_spec.rb\"]\n t\nend", "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 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 replaced_files; end", "def check_update(component_def, spec, gem_name_to_version)\n component_def.each_line do |line|\n # TODO: Some of the component files handle multiple versions with a case statement (for example net-ssh). \n # Add more logic to compare each of those versions. For now there are only a hand full. \n if line =~ /pkg.version/\n ver = Gem::Version.new(line.scan(/\\d\\.*/).join(''))\n if gem_name_to_version[spec.name] > ver\n warn \"Update needed for: #{spec.name} \\nUpgrade from #{ver} to #{gem_name_to_version[spec.name]}\\n\\n\"\n end\n end\n end\nend", "def update_template_files(name, cookbook_path, description)\n files = Dir.glob(\"#{cookbook_path}/**/*\").select{ |e| File.file? e }\n user = get_username || \"Your Name\"\n email = get_useremail || \"Your Email\"\n company = \"Schuberg Philis\"\n year = Time.now.year\n date = Time.now\n files.each do |file|\n contents = \"\"\n File.foreach(file) do |line|\n line.gsub!(/DESCRIPTION/, description)\n line.gsub!(/COOKBOOK/, name)\n line.gsub!(/COMPANY/, company)\n line.gsub!(/NAME/, user)\n line.gsub!(/EMAIL/, email)\n line.gsub!(/YEAR/, year.to_s)\n line.gsub!(/DATE/, date.to_s)\n contents += line\n end\n File.open(file, 'w') {|f| f.write(contents) }\n end\n return nil\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n source.fetch_spec tuple\n rescue Gem::RemoteFetcher::FetchError\n raise if @original_platform == @platform\n\n tuple = Gem::NameTuple.new @name, @version, @original_platform\n source.fetch_spec tuple\n end\n end", "def map_to_spec(changed)\n paths = changed.map do |path|\n if path.match? '/spec/'\n path\n elsif path.match? '/app/'\n path.gsub('/app/', '/spec/').gsub('.rb', '_spec.rb')\n elsif path.match? '/lib/'\n path.gsub('/lib/', '/spec/').gsub('.rb', '_spec.rb')\n end\n end\n paths.compact.uniq.filter { |path| Pathname.new(path).exist? }\n end", "def spec\n File.join root, 'spec'\n end", "def update_source(name, file=nil, topic=nil)\n\t\t\tfile ||= @node[:source][:file] rescue nil\n\t\t\t@updated_source = {:name => name, :file => file, :topic => topic}\n\t\tend", "def update_version_file\n version_file = @spec.version_file\n updated_version = Olag::Version::update(version_file)\n abort(\"Updated gem version; re-run rake\") if @spec.version.to_s != updated_version\n end", "def adapt_source(source); end", "def update!(**args)\n @pull_deps = args[:pull_deps] if args.key?(:pull_deps)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @pull_deps = args[:pull_deps] if args.key?(:pull_deps)\n @source = args[:source] if args.key?(:source)\n end", "def update(_show_output)\n @check_existing_files_for_update = true\n begin\n preheat_existing_files\n ensure\n @check_existing_files_for_update = false\n end\n []\n end", "def gen_request_specs\n Dir.glob('spec/requests/*.rb').each do |filename|\n editor = RequestSpecEditor.new(filename)\n editor.add_directions\n end\n end", "def spec_dir\n @spec_dir ||= File.join base_dir, \"specifications\"\n end", "def specfile\n Dir[\"#{@path}/[Ss]pecfile\"].first\n end", "def add_specs_to_repo\n UI.puts \"Adding the #{'spec'.pluralize(podspec_files.count)} to repo `#{@repo}'\\n\"\n podspec_files.each do |spec_file|\n spec = Pod::Specification.from_file(spec_file)\n output_path = File.join(repo_specs_dir, spec.name, spec.version.to_s)\n UI.puts \" --> #{get_message(output_path, spec)}\"\n if @local_only\n create_json_in_path(output_path, spec)\n else\n # TODO push to local disabled until virtual repo support\n raise Informative, 'Pushing specs to Artifactory is currently disabled'\n=begin\n begin\n podspec_json_tmp_path = create_json_in_path(output_path, spec)\n rescue => e\n FileUtils.remove(output_path, :force => true)\n raise Informative, \"Error writing spec file in target path '#{output_path}': #{e.message}\"\n end\n\n begin\n push_to_remote(spec, podspec_json_tmp_path)\n rescue => e\n FileUtils.remove(output_path, :force => true)\n raise Informative, \"Error pushing to remote '#{@repo}': #{e.message}\"\n end\n FileUtils.remove(podspec_json_tmp_path, :force => true)\n=end\n end\n end\n end", "def source_files; end", "def copy_rspec_files\n directory('rspec', 'spec') if options[:test_engine] == 'rspec'\n end", "def insertline(testfile)\n original_file = Rails.root.to_s + \"/public/test/\" + testfile\n new_file = original_file[0..-3] + 'new.rb'\n coder_file = Rails.root.to_s + \"/public/code/\" + @coder.code\n\n File.open(new_file, 'w') do |f|\n # f.puts \"require_relative '../code/#{@coder.code}'\"\n\n # Stick full text of coder's file into your new.rb spec file\n File.open(coder_file, \"r\").each_line do |line|\n f.puts line\n end\n\n # Copy original RSpec file to new temp RSpec file, excluding all \"require_relative\" and \"spec_helper\" lines\n File.foreach(original_file) do |line|\n f.puts line if !line.include?(\"require_relative\") && !line.include?(\"spec_helper\")\n end \n end \n end", "def test_dry_run\n @options[:dry_run] = true\n\n gemfile = bake_testing_gem\n\n patches = []\n patches << bake_change_file_patch\n\n # Creates new patched gem in @gems_dir\n patcher = Gem::Patcher.new(gemfile, @gems_dir)\n patched_gem = patcher.patch_with(patches, @options)\n\n # Unpack\n package = Gem::Package.new patched_gem\n package.extract_files @gems_dir\n\n # Still the same\n assert_equal original_file, file_contents('foo.rb')\n end", "def package_file\n super || spec_file\n end", "def update\n `cd #{__dir__} && git pull origin master`\n install\nend", "def fetch_spec(name_tuple)\n fetcher = Gem::RemoteFetcher.fetcher\n\n spec_file_name = name_tuple.spec_name\n\n source_uri = enforce_trailing_slash(uri) + \"#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}\"\n\n cache_dir = cache_dir source_uri\n\n local_spec = File.join cache_dir, spec_file_name\n\n if File.exist? local_spec\n spec = Gem.read_binary local_spec\n spec = Marshal.load(spec) rescue nil\n return spec if spec\n end\n\n source_uri.path << '.rz'\n\n spec = fetcher.fetch_path source_uri\n spec = Gem::Util.inflate spec\n\n if update_cache?\n require \"fileutils\"\n FileUtils.mkdir_p cache_dir\n\n File.open local_spec, 'wb' do |io|\n io.write spec\n end\n end\n\n # TODO: Investigate setting Gem::Specification#loaded_from to a URI\n Marshal.load spec\n end", "def update( *events )\n ary = events.find_all {|evt| evt.type != :removed}\n return if ary.empty?\n\n ary.each do |evt|\n logger.debug \"changed #{evt.path}\"\n next unless test ?f, evt.path\n next if evt.path =~ ::Webby.exclude\n Resources.new evt.path\n end\n\n logger.info 'running the build'\n @builder.run :load_files => false, :verbose => false\n rescue => err\n logger.error err\n end", "def patch_pod_file(path, old_code, new_code)\n file = File.join($root, path)\n unless File.exist?(file)\n Pod::UI.warn \"#{file} does not exist so was not patched..\"\n return\n end\n code = File.read(file)\n if code.include?(old_code)\n Pod::UI.message \"Patching #{file}\", '- '\n FileUtils.chmod('+w', file)\n File.write(file, code.sub(old_code, new_code))\n end\nend", "def patch_pod_file(path, old_code, new_code)\n file = File.join($root, path)\n unless File.exist?(file)\n Pod::UI.warn \"#{file} does not exist so was not patched..\"\n return\n end\n code = File.read(file)\n if code.include?(old_code)\n Pod::UI.message \"Patching #{file}\", '- '\n FileUtils.chmod('+w', file)\n File.write(file, code.sub(old_code, new_code))\n end\nend", "def patch_pod_file(path, old_code, new_code)\n file = File.join($root, path)\n unless File.exist?(file)\n Pod::UI.warn \"#{file} does not exist so was not patched..\"\n return\n end\n code = File.read(file)\n if code.include?(old_code)\n Pod::UI.message \"Patching #{file}\", '- '\n FileUtils.chmod('+w', file)\n File.write(file, code.sub(old_code, new_code))\n end\nend", "def modified_files(options); end", "def modified_files(options); end", "def test_version_files_found\n Dir.glob( @setup_issue_show.issues_directory.join('*.show*') ).each do |file|\n version = /(\\d\\.)+/.match( file )[0][0...-1]\n @setup_issue_show.current_version = version\n\n assert_equal \"#{version}.show.html.erb\", @setup_issue_show.show_file.basename.to_s, 'Did not find the expected version file.'\n end\n end", "def update!(**args)\n @launch = args[:launch] if args.key?(:launch)\n @spec = args[:spec] if args.key?(:spec)\n end", "def unpack\n `rm -rf ./tmp/specs`\n `gunzip -f ./tmp/specs.tar.gz`\n `cd tmp; tar xvf specs.tar`\n `mv -f ./tmp/CocoaPods-Specs-* ./tmp/specs`\n end", "def setup_override\n spec = Gem::Specification.find_by_name 'yard'\n erb = File.join(spec.gem_dir,\"templates\",\"default\",\"fulldoc\",\"html\",ERB)\n # Create the subdirectory structure\n subdir = File.join(tmpdir,\"default\",\"fulldoc\",\"html\")\n FileUtils.mkdir_p subdir\n # Copy the erb\n target_file = File.join(subdir,ERB)\n FileUtils.cp(erb,target_file)\n # Open the file and add the anchors\n open(target_file,'a') do |file|\n file.write \"<% do_dash %>\\n\"\n end\n end", "def test_can_add_paths_to_source_path\n Crd::Spec.new 'Testing' do |s|\n s.source_path << 'test/fixtures'\n assert_equal( [ 'test/fixtures' ], s.source_path )\n end\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 patch\n fetch unless exist?\n return unless has_patches?\n dont_debug { patched_location.rmtree if patched_location.exist? } # Make sure that no previous patched copy exists\n dont_debug { @local_path.ditto patched_location }\n @local_path = patched_location\n # Download patches\n patched_location.dirname.cd do\n each_patch do |p|\n p.fetch\n end\n end\n # Apply patches\n patched_location.cd do\n each_patch do |p|\n p.apply\n end\n end\n end", "def update!\n entity_json = [{ name: @source_file.entity_name, entries: expanded_entries }]\n\n response = @api_client.update_entities_request(entity_json)\n\n handle_response(response, :entity)\n end", "def write_gemspec; end", "def inspect_source(*args)\n super(*args, 'foo_spec.rb')\n end" ]
[ "0.7405899", "0.712922", "0.68801665", "0.6859357", "0.6672085", "0.62861097", "0.61503696", "0.61348736", "0.6122977", "0.6105787", "0.60835826", "0.60281646", "0.6020156", "0.6018791", "0.59977007", "0.5971116", "0.5927346", "0.587188", "0.58634996", "0.5855605", "0.5823852", "0.5800882", "0.57995117", "0.5773918", "0.5773507", "0.57681865", "0.5764163", "0.5758808", "0.57433474", "0.5721404", "0.57207483", "0.5718232", "0.57015043", "0.5677653", "0.56735873", "0.56014705", "0.5599689", "0.55940825", "0.55811834", "0.5546898", "0.5516779", "0.5516779", "0.5510016", "0.5504159", "0.55023617", "0.5494392", "0.54908544", "0.5484611", "0.5481784", "0.548066", "0.54464304", "0.5443301", "0.5427783", "0.5426831", "0.54238975", "0.5416875", "0.54157734", "0.5413937", "0.5409408", "0.5407513", "0.5405168", "0.53930134", "0.53905344", "0.5381633", "0.53752756", "0.5371207", "0.5363685", "0.53566825", "0.53537023", "0.533601", "0.5332002", "0.5332002", "0.5321875", "0.5317454", "0.5316913", "0.53093463", "0.5303538", "0.52967", "0.528281", "0.52824986", "0.527653", "0.52731895", "0.5270521", "0.52679616", "0.5266382", "0.52593863", "0.52593863", "0.52593863", "0.5258155", "0.5258155", "0.52539724", "0.52473515", "0.5246188", "0.52376586", "0.5232553", "0.5231752", "0.5222745", "0.5208505", "0.5206664", "0.52039266" ]
0.7195628
1
Internal helper to update spec metadata from new source
def update_metadata_from(new_source) # update to new version @metadata[:version] = new_source.version @metadata[:release] = "1%{?dist}" # add changelog entry changelog_entry = <<EOS * #{Time.now.strftime("%a %b %d %Y")} #{RPM::Spec.current_author} - #{@metadata[:version]}-1 - Update to version #{new_source.version} EOS @metadata[:changelog_entries] ||= [] @metadata[:changelog_entries].unshift changelog_entry.rstrip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_files_from(new_source)\n to_add = new_source.file_paths\n @metadata[:files] ||= {}\n @metadata[:files].each { |pkg,spec_files|\n (new_source.file_paths & to_add).each { |gem_file|\n # skip files already included in spec or in dir in spec\n has_file = spec_files.any? { |sf|\n gem_file.gsub(sf,'') != gem_file\n }\n\n to_add.delete(gem_file)\n to_add << gem_file.rpmize if !has_file &&\n !Gem.ignorable_file?(gem_file)\n }\n }\n\n @metadata[:new_files] = to_add.select { |f| !Gem.doc_file?(f) }\n @metadata[:new_docs] = to_add - @metadata[:new_files]\n end", "def update!(**args)\n @source_type_metadata = args[:source_type_metadata] if args.key?(:source_type_metadata)\n end", "def update_metadata!\n compilation_context.source_file_database.update_metadata(source_path)\n compilation_context.target_file_database.update_metadata(source_path)\n end", "def load_spec name, ver, platform, source\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end", "def load_spec(name, ver, platform, source) # :nodoc:\n key = \"#{name}-#{ver}-#{platform}\"\n\n @specs.fetch key do\n tuple = Gem::NameTuple.new name, ver, platform\n\n @specs[key] = source.fetch_spec tuple\n end\n end", "def update_catalog_metadata\n source = metadata_builder.metadata_source.find_by(source_type: 'descriptive')\n raise 'Descriptive metadata source not available' unless source\n\n bibnumber = source.original_mappings['bibnumber']&.first\n raise 'Descriptive metadata does not contain bibnumber' if bibnumber.blank?\n\n source.set_metadata_mappings(clone_location)\n source.save!\n end", "def update!(**args)\n @extractive_content_spec = args[:extractive_content_spec] if args.key?(:extractive_content_spec)\n @snippet_spec = args[:snippet_spec] if args.key?(:snippet_spec)\n @summary_spec = args[:summary_spec] if args.key?(:summary_spec)\n end", "def update_initial_metadata(metadata)\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n source.fetch_spec tuple\n rescue Gem::RemoteFetcher::FetchError\n raise if @original_platform == @platform\n\n tuple = Gem::NameTuple.new @name, @version, @original_platform\n source.fetch_spec tuple\n end\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n\n @source.fetch_spec tuple\n end\n end", "def update_sourced_attributes source_name=nil\n if source_name\n @sources[source_name].apply\n else\n @sources.values.each(&:apply)\n end\n end", "def update_specfiles(version)\n spec_files.each do |spec_file|\n spec = File.read(spec_file)\n spec.gsub!(/^(\\s*)Version:(\\s*).*$/, \"\\\\1Version:\\\\2#{version}\")\n File.write(spec_file, spec)\n end\nend", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def set_spec_template_metadata\n release_doc_metadata.each do |key, value|\n template[:spec][:template][:metadata][:labels][key] ||= value.to_s\n end\n end", "def cover_source_by source, specfile\n _source = File.expand_path( \"../../../#{source}\", __FILE__ )\n _spec = File.expand_path(\"../../#{specfile}\", __FILE__)\n FileUtils.touch(_spec) if File.mtime(_source) > File.mtime(_spec)\n File.mtime(_source) <= File.mtime(_spec)\nend", "def update_deps_from(new_source)\n @metadata[:requires] =\n non_gem_requirements +\n extra_gem_requirements(new_source) +\n new_source.deps.select { |r| !excludes_dep?(r.name) }\n .collect { |r| RPM::Requirement.from_gem_dep(r) }.flatten\n\n @metadata[:build_requires] =\n non_gem_build_requirements +\n extra_gem_build_requirements(new_source) +\n new_source.dev_deps.select { |r| !excludes_dev_dep?(r.name) }\n .collect { |r| RPM::Requirement.from_gem_dep(r, true) }.flatten\n end", "def update_metadata_rocks(metadata)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @kind = args[:kind] if args.key?(:kind)\n @metadata = args[:metadata] if args.key?(:metadata)\n @spec = args[:spec] if args.key?(:spec)\n end", "def updater= value\n metadata_updater = value.send :new, @manifest, @mods\n @label = metadata_updater.get_label @directory_name # probably want to do all of this in ingestor block, or boilerplate.... we'll have the ingest PID at that point...\n @owner = metadata_updater.get_owner\n # metadata_updater.identifiers\n end", "def update_to(new_source)\n update_deps_from(new_source)\n update_files_from(new_source)\n update_metadata_from(new_source)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @source_label = args[:source_label] if args.key?(:source_label)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n @study = args[:study] if args.key?(:study)\n @trial = args[:trial] if args.key?(:trial)\n end", "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @metadata = args[:metadata] if args.key?(:metadata)\n @origination = args[:origination] if args.key?(:origination)\n @time_provided = args[:time_provided] if args.key?(:time_provided)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n @specialist_pool = args[:specialist_pool] if args.key?(:specialist_pool)\n end", "def update!(**args)\n @head_machine_spec = args[:head_machine_spec] if args.key?(:head_machine_spec)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n end", "def update!(**args)\n @table_source_type = args[:table_source_type] if args.key?(:table_source_type)\n @table_spec = args[:table_spec] if args.key?(:table_spec)\n @view_spec = args[:view_spec] if args.key?(:view_spec)\n end", "def update!(**args)\n @table_source_type = args[:table_source_type] if args.key?(:table_source_type)\n @table_spec = args[:table_spec] if args.key?(:table_spec)\n @view_spec = args[:view_spec] if args.key?(:view_spec)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n @output_info = args[:output_info] if args.key?(:output_info)\n end", "def refresh_from_source(*components)\n opts = components.last.is_a?(Hash) ? components.pop : {}\n source = Source.new\n source.options = options\n components.each do |name|\n source.clone(name)\n source.install_from_src(name, opts) if options[:install]\n end\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n @partial_results = args[:partial_results] if args.key?(:partial_results)\n end", "def load_spec(name, version, platform, source) # :nodoc:\n @specs.fetch name\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @predefined_source = args[:predefined_source] if args.key?(:predefined_source)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @predefined_source = args[:predefined_source] if args.key?(:predefined_source)\n end", "def update!(**args)\n @examples_override = args[:examples_override] if args.key?(:examples_override)\n @metadata = args[:metadata] if args.key?(:metadata)\n @parameters = args[:parameters] if args.key?(:parameters)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @is_auto = args[:is_auto] if args.key?(:is_auto)\n @source_summary = args[:source_summary] if args.key?(:source_summary)\n end", "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n end", "def source_index\n say \"Updating Gem source index for: #{@uri}\"\n begin\n require 'zlib'\n yaml_spec = fetch_path(\"/yaml.Z\")\n yaml_spec = Zlib::Inflate.inflate(yaml_spec)\n rescue\n yaml_spec = nil\n end\n begin\n\tyaml_spec = fetch_path(\"/yaml\") unless yaml_spec\n\tr = convert_spec(yaml_spec)\n rescue SocketError => e\n\traise RemoteSourceException.new(\"Error fetching remote gem cache: #{e.to_s}\")\n end\n end", "def update_metadata\n Socop::Ontology.parse(DATADIR.join \"ontologies.xml\").each do |ontology|\n if onto_ontology = Ontology.where(repository_id: repository.id, basepath: ontology['abbreviation']).first\n onto_ontology.update_attributes \\\n name: ontology['displayLabel'],\n description: ontology['description']\n end\n end\n end", "def update!(**args)\n @allow_list_source_data = args[:allow_list_source_data] if args.key?(:allow_list_source_data)\n @confidence = args[:confidence] if args.key?(:confidence)\n @install = args[:install] if args.key?(:install)\n @is_categorical = args[:is_categorical] if args.key?(:is_categorical)\n @media_provider_source_data = args[:media_provider_source_data] if args.key?(:media_provider_source_data)\n @source = args[:source] if args.key?(:source)\n @teleport_source_data = args[:teleport_source_data] if args.key?(:teleport_source_data)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def updated_source_file; end", "def refresh_from_source(*components)\n source = Source.new\n source.options = options\n components.each do |name|\n source.clone(name)\n source.install(name) if options[:install]\n end\n end", "def update!\n @source.headers.delete(:update)\n set_updated_time(Time.now)\n save\n end", "def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end", "def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end", "def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end", "def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def update!(**args)\n @artifact_uri = args[:artifact_uri] if args.key?(:artifact_uri)\n @container_spec = args[:container_spec] if args.key?(:container_spec)\n @create_time = args[:create_time] if args.key?(:create_time)\n @deployed_models = args[:deployed_models] if args.key?(:deployed_models)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @etag = args[:etag] if args.key?(:etag)\n @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @labels = args[:labels] if args.key?(:labels)\n @metadata = args[:metadata] if args.key?(:metadata)\n @metadata_artifact = args[:metadata_artifact] if args.key?(:metadata_artifact)\n @metadata_schema_uri = args[:metadata_schema_uri] if args.key?(:metadata_schema_uri)\n @model_source_info = args[:model_source_info] if args.key?(:model_source_info)\n @name = args[:name] if args.key?(:name)\n @original_model_info = args[:original_model_info] if args.key?(:original_model_info)\n @predict_schemata = args[:predict_schemata] if args.key?(:predict_schemata)\n @supported_deployment_resources_types = args[:supported_deployment_resources_types] if args.key?(:supported_deployment_resources_types)\n @supported_export_formats = args[:supported_export_formats] if args.key?(:supported_export_formats)\n @supported_input_storage_formats = args[:supported_input_storage_formats] if args.key?(:supported_input_storage_formats)\n @supported_output_storage_formats = args[:supported_output_storage_formats] if args.key?(:supported_output_storage_formats)\n @training_pipeline = args[:training_pipeline] if args.key?(:training_pipeline)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version_aliases = args[:version_aliases] if args.key?(:version_aliases)\n @version_create_time = args[:version_create_time] if args.key?(:version_create_time)\n @version_description = args[:version_description] if args.key?(:version_description)\n @version_id = args[:version_id] if args.key?(:version_id)\n @version_update_time = args[:version_update_time] if args.key?(:version_update_time)\n end", "def adapt_source(source); end", "def update!(**args)\n @formatted_type = args[:formatted_type] if args.key?(:formatted_type)\n @metadata = args[:metadata] if args.key?(:metadata)\n @source = args[:source] if args.key?(:source)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @artifact_uri = args[:artifact_uri] if args.key?(:artifact_uri)\n @container_spec = args[:container_spec] if args.key?(:container_spec)\n @predict_schemata = args[:predict_schemata] if args.key?(:predict_schemata)\n end", "def update_metadata(direction, metadata)\n end", "def update!(**args)\n @alternate = args[:alternate] if args.key?(:alternate)\n @name = args[:name] if args.key?(:name)\n @spec = args[:spec] if args.key?(:spec)\n end", "def update!(**args)\n @bigquery_date_sharded_spec = args[:bigquery_date_sharded_spec] if args.key?(:bigquery_date_sharded_spec)\n @bigquery_table_spec = args[:bigquery_table_spec] if args.key?(:bigquery_table_spec)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @gcs_fileset_spec = args[:gcs_fileset_spec] if args.key?(:gcs_fileset_spec)\n @integrated_system = args[:integrated_system] if args.key?(:integrated_system)\n @linked_resource = args[:linked_resource] if args.key?(:linked_resource)\n @name = args[:name] if args.key?(:name)\n @schema = args[:schema] if args.key?(:schema)\n @source_system_timestamps = args[:source_system_timestamps] if args.key?(:source_system_timestamps)\n @type = args[:type] if args.key?(:type)\n @usage_signal = args[:usage_signal] if args.key?(:usage_signal)\n @user_specified_system = args[:user_specified_system] if args.key?(:user_specified_system)\n @user_specified_type = args[:user_specified_type] if args.key?(:user_specified_type)\n end", "def update!(**args)\n @dataplex_spec = args[:dataplex_spec] if args.key?(:dataplex_spec)\n end", "def update!(**args)\n @annotation_source = args[:annotation_source] if args.key?(:annotation_source)\n @type = args[:type] if args.key?(:type)\n @version = args[:version] if args.key?(:version)\n end" ]
[ "0.6862861", "0.6513075", "0.6470899", "0.6407146", "0.6383383", "0.63161415", "0.62185985", "0.6171623", "0.6141208", "0.6129807", "0.61264807", "0.5971806", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59356827", "0.59119284", "0.58866626", "0.5878239", "0.5875826", "0.5844344", "0.5838926", "0.5801229", "0.5780631", "0.5768407", "0.5753578", "0.5724619", "0.57074153", "0.5691603", "0.5690664", "0.5689288", "0.5687145", "0.56803024", "0.5679971", "0.5675951", "0.5675951", "0.5653811", "0.5652092", "0.5652092", "0.56422", "0.56325537", "0.5628028", "0.5625645", "0.5605414", "0.5601797", "0.5601797", "0.5596519", "0.5589916", "0.55622286", "0.5555568", "0.5555568", "0.5555568", "0.5555568", "0.5532565", "0.55213", "0.55163085", "0.5502408", "0.5498121", "0.54941106", "0.5487619", "0.54825073", "0.5482192", "0.54790044" ]
0.67376864
1
Return properly formatted rpmspec as string
def to_string contents = @metadata[:contents] # replace version / release contents.gsub!(SPEC_VERSION_MATCHER, "Version: #{@metadata[:version]}") contents.gsub!(SPEC_RELEASE_MATCHER, "Release: #{@metadata[:release]}") # add changelog entry cp = contents.index SPEC_CHANGELOG_MATCHER cpn = contents.index "\n", cp contents = contents[0...cpn+1] + @metadata[:changelog_entries].join("\n\n") # update requires/build requires rp = contents.index SPEC_REQUIRES_MATCHER brp = contents.index SPEC_BUILD_REQUIRES_MATCHER tp = rp < brp ? rp : brp pp = contents.index SPEC_SUBPACKAGE_MATCHER pp = -1 if pp.nil? lrp = contents.rindex SPEC_REQUIRES_MATCHER, pp lbrp = contents.rindex SPEC_BUILD_REQUIRES_MATCHER, pp ltp = lrp > lbrp ? lrp : lbrp ltpn = contents.index "\n", ltp contents.slice!(tp...ltpn) contents.insert tp, (@metadata[:requires].collect { |r| "Requires: #{r.str}" } + @metadata[:build_requires].collect { |r| "BuildRequires: #{r.str}" }).join("\n") # add new files fp = contents.index SPEC_FILES_MATCHER lfp = contents.index SPEC_SUBPKG_FILES_MATCHER, fp + 1 lfp = contents.index SPEC_CHANGELOG_MATCHER if lfp.nil? contents.insert lfp - 1, @metadata[:new_files].join("\n") + "\n" # add new doc files fp = contents.index SPEC_DOC_FILES_MATCHER fp = contents.index SPEC_FILES_MATCHER if fp.nil? lfp = contents.index SPEC_SUBPKG_FILES_MATCHER, fp + 1 lfp = contents.index SPEC_CHANGELOG_MATCHER if lfp.nil? contents.insert lfp - 1, @metadata[:new_docs].join("\n") + "\n" # return new contents contents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n out = []\n\n groups = spec_groups\n\n add_PATH out, groups.delete(Gem::Resolver::VendorSpecification) { [] }\n\n add_GIT out, groups.delete(Gem::Resolver::GitSpecification) { [] }\n\n add_GEM out, groups\n\n add_PLATFORMS out\n\n add_DEPENDENCIES out\n\n out.join \"\\n\"\n end", "def asPPString\n s = StringIO.new\n s.print \"{\\n :solrField=> \"\n PP.singleline_pp(@solrField, s)\n s.print(\",\\n \")\n s.print \":firstOnly => true,\\n \" if @first\n if @defaultValue\n s.print(\":default => \")\n PP.singleline_pp(@defaultValue, s)\n s.print(\",\\n \")\n end\n if @map\n s.print(\":mapname => \")\n PP.singleline_pp(@map.mapname, s)\n s.print(\",\\n \")\n end\n if @noMapKeyDefault\n s.print(\":noMapKeyDefault => \")\n PP.singleline_pp(@noMapKeyDefault, s)\n s.print(\",\\n \")\n end\n s.print(\":specs => [\\n\")\n @marcfieldspecs.each do |ts|\n s.print ' '\n PP.singleline_pp(ts, s)\n s.print(\",\\n\")\n end\n s.print \" ]\\n}\"\n return s.string\n end", "def write_gemspec; end", "def to_ruby\n mark_version\n result = []\n result << \"# -*- encoding: utf-8 -*-\"\n result << \"#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{raw_require_paths.join(\"\\0\")}\"\n result << \"#{Gem::StubSpecification::PREFIX}#{extensions.join \"\\0\"}\" unless\n extensions.empty?\n result << nil\n result << \"Gem::Specification.new do |s|\"\n\n result << \" s.name = #{ruby_code name}\"\n result << \" s.version = #{ruby_code version}\"\n unless platform.nil? or platform == Gem::Platform::RUBY\n result << \" s.platform = #{ruby_code original_platform}\"\n end\n result << \"\"\n result << \" s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version=\"\n\n if metadata and !metadata.empty?\n result << \" s.metadata = #{ruby_code metadata} if s.respond_to? :metadata=\"\n end\n result << \" s.require_paths = #{ruby_code raw_require_paths}\"\n\n handled = [\n :dependencies,\n :name,\n :platform,\n :require_paths,\n :required_rubygems_version,\n :specification_version,\n :version,\n :has_rdoc,\n :default_executable,\n :metadata,\n :signing_key,\n ]\n\n @@attributes.each do |attr_name|\n next if handled.include? attr_name\n current_value = self.send(attr_name)\n if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)\n result << \" s.#{attr_name} = #{ruby_code current_value}\"\n end\n end\n\n if String === signing_key\n result << \" s.signing_key = #{signing_key.dump}.freeze\"\n end\n\n if @installed_by_version\n result << nil\n result << \" s.installed_by_version = \\\"#{Gem::VERSION}\\\" if s.respond_to? :installed_by_version\"\n end\n\n unless dependencies.empty?\n result << nil\n result << \" if s.respond_to? :specification_version then\"\n result << \" s.specification_version = #{specification_version}\"\n result << \" end\"\n result << nil\n\n result << \" if s.respond_to? :add_runtime_dependency then\"\n\n dependencies.each do |dep|\n req = dep.requirements_list.inspect\n dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK\n result << \" s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})\"\n end\n\n result << \" else\"\n dependencies.each do |dep|\n version_reqs_param = dep.requirements_list.inspect\n result << \" s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})\"\n end\n result << \" end\"\n end\n\n result << \"end\"\n result << nil\n\n result.join \"\\n\"\n end", "def spec_name\n \"#{full_name}.gemspec\"\n end", "def to_ruby\n%{Gem::Specification.new do |s|\n s.name = \"#{@gem_spec.name}\"\n s.version = \"#{@gem_spec.version}\"\n\n s.specification_version = #{ ivar_get(:specification_version) || 2 } if s.respond_to? :specification_version=\n s.required_rubygems_version = Gem::Requirement.new(\"#{ivar_get(:required_rubygems_version) || '>= 0'}\") if s.respond_to? :required_rubygems_version=\n\n#{gem_spec_variables.map { |k,v| \" s.#{k} = #{v.inspect}\" }.join(\"\\n\") }\n\n#{@gem_spec.dependencies.map { |dep| \" s.add_dependency(\\\"#{dep.name}\\\", [\\\"#{dep.version_requirements.to_s}\\\"])\" }.join(\"\\n\") }\nend}\n end", "def to_s\n s = []\n s << \"#{title} v#{version}\"\n s << \"\"\n s << \"#{summary}\"\n s << \"\"\n s << \"contact : #{contact}\"\n s << \"homepage : #{homepage}\"\n s << \"repository : #{repository}\"\n s << \"authors : #{authors.join(',')}\"\n s << \"package : #{name}-#{version}\"\n s << \"requires : #{requires.join(',')}\"\n s.join(\"\\n\")\n end", "def to_string(pre=\"\")\n opts = get_modified_options\n returning Array.new do |output|\n unless cancelled?\n output << @prestring || \"\"\n \n if resources && !resources.empty?\n @cp = classpackage_with_self(self)\n output << @cp.to_string\n output << \"include #{@cp.name.sanitize}\"\n end\n \n unless virtual_resource?\n output << \"#{pre}#{class_type_name.downcase} {\"\n output << \"#{pre}\\\"#{self.key}\\\":\"\n output << opts.flush_out(\"#{pre*2}\").join(\",\\n\")\n output << \"#{pre}}\" \n end\n \n output << @poststring || \"\"\n end\n end.join(\"\\n\")\n end", "def to_gemspec(options={})\n require_rubygems\n\n if metadata.resources\n homepage = metadata.resources.homepage\n else\n homepage = nil\n end\n\n if homepage && md = /(\\w+).rubyforge.org/.match(homepage)\n rubyforge_project = md[1]\n else\n # b/c it has to be something according to Eric Hodel.\n rubyforge_project = metadata.name.to_s\n end\n\n #TODO: may be able to get this from project method\n if news = Dir[root + 'NEWS{,.txt}'].first\n install_message = File.read(news)\n end\n\n ::Gem::Specification.new do |spec|\n spec.name = self.name.to_s\n spec.version = self.version.to_s\n spec.require_paths = self.loadpath.to_a\n\n spec.summary = metadata.summary.to_s\n spec.description = metadata.description.to_s\n spec.authors = metadata.authors.to_a\n spec.email = metadata.email.to_s\n spec.licenses = metadata.licenses.to_a\n\n spec.homepage = metadata.homepage.to_s\n\n # -- platform --\n\n # TODO: how to handle multiple platforms?\n spec.platform = options[:platform] #|| verfile.platform #'ruby' ???\n #if metadata.platform != 'ruby'\n # spec.require_paths.concat(spec.require_paths.collect{ |d| File.join(d, platform) })\n #end\n\n # -- rubyforge project --\n\n spec.rubyforge_project = rubyforge_project\n\n # -- compiled extensions --\n\n spec.extensions = options[:extensions] || self.extensions\n\n # -- dependencies --\n\n case options[:gemfile]\n #when String\n # gemfile = root.glob(options[:gemfile]).first # TODO: Alternate gemfile\n when nil, true\n gemfile = root.glob('Gemfile').first\n else\n gemfile = nil\n end\n\n if gemfile\n require 'bundler'\n spec.add_bundler_dependencies\n else\n metadata.requirements.each do |dep|\n if dep.development?\n spec.add_development_dependency( *[dep.name, dep.constraint].compact )\n else\n next if dep.optional?\n spec.add_runtime_dependency( *[dep.name, dep.constraint].compact )\n end\n end\n end\n\n # TODO: considerations?\n #spec.requirements = options[:requirements] || package.consider\n\n # -- executables --\n\n # TODO: bin/ is a POM convention, is there are reason to do otherwise?\n spec.bindir = options[:bindir] || \"bin\"\n spec.executables = options[:executables] || self.executables\n\n # -- rdocs (argh!) --\n\n readme = root.glob_relative('README{,.*}', File::FNM_CASEFOLD).first\n extra = options[:extra_rdoc_files] || []\n\n rdocfiles = []\n rdocfiles << readme.to_s if readme\n rdocfiles.concat(extra)\n rdocfiles.uniq!\n\n rdoc_options = [] #['--inline-source']\n rdoc_options.concat [\"--title\", \"#{metadata.title} API\"] #if metadata.title\n rdoc_options.concat [\"--main\", readme.to_s] if readme\n\n spec.extra_rdoc_files = rdocfiles\n spec.rdoc_options = rdoc_options\n\n # -- distributed files --\n\n if manifest.exist?\n filelist = manifest.select{ |f| File.file?(f) }\n spec.files = filelist\n else\n spec.files = root.glob_relative(\"**/*\").map{ |f| f.to_s } # metadata.distribute ?\n end\n\n # DEPRECATED: -- test files --\n #spec.test_files = manifest.select do |f|\n # File.basename(f) =~ /test\\// && File.extname(f) == '.rb'\n #end\n\n if install_message\n spec.post_install_message = install_message\n end\n end\n\n end", "def to_s\n psar_file_and_symbol\n end", "def to_s # :nocov:\n s = []\n s << \"CommandSpec:#{self.object_id}\"\n s << \" digest: #{self.digest}\"\n s << \" repo: #{self.repo}\"\n s << \" bundle: #{self.bundle}\"\n s << \" command: #{self.command}\"\n s << \" args: #{self.args}\"\n s << \" user: #{self.user}\"\n s << \" group: #{self.group}\"\n s << \" env: \" + (self.env.nil?() ? \"\" : MultiJson.dump(self.env))\n s << \" stdin: \" + Debug.pretty_str(stdin)\n s.join(\"\\n\")\n end", "def write_gemspec\n Juwelier::Commands::WriteGemspec.build_for(self).run\n end", "def write_gemspec\n Jeweler::Commands::WriteGemspec.build_for(self).run\n end", "def to_s\n str = [major, minor, patch].compact.join('.')\n str = \"#{str}.#{pre}\" if pre\n str\n end", "def to_s\n # Comphrensive list of equivs options.\n # Most of them are not mandatory. Leave\n # the option nil if you don't need it.\n options = {\n :source => nil, # probably we'll never implement it\n :section => @package.section,\n :priority => @package.priority,\n :homepage => @package.homepage,\n :standards_version => @package.standards_version, \n :package => @package.name,\n :version => @package.version,\n :maintainer => self.maintainer, \n :pre_depends => @package.pre_depends,\n :depends => @package.depends,\n :reccomends => @package.reccomends,\n :suggests => @package.suggests,\n :provides => @package.provides,\n :replaces => @package.replaces,\n :architecture => @package.architecture,\n :copyright => self.copyright_file,\n # :changelog => self.changelog_file,\n :readme => self.readme_file,\n :postinst => self.postinst,\n :preinst => self.preinst,\n :postrm => self.postrm,\n :prerm => self.prerm,\n :extra_files => nil, # probably we'll never implement it\n :files => self.files,\n :description => self.description \n }\n control = \"\"\n options.each do |k, v|\n if v != nil and v != \"\" #TODO: think if this test needs to be improved \n control << k.to_s.split('_').map(&:capitalize).join('-') << \": \" << v << \"\\n\"\n end\n end\n control\n end", "def make_rpm_spec\n puts 'creating rpm.spec'\n File.unlink('rpm.spec') if File.exist?('rpm.spec')\n f = File.open('rpm.spec', 'w')\n f.puts <<EOF\n# DO NOT EDIT -- automatically generated by ./configure\nName: #{@project.id}\nSummary: #{@project.summary}\nVersion: #{@project.version}\nRelease: 1\nLicense: #{@project.license}\nVendor: #{@project.author}\nGroup: System Environment/Libraries\nSource0: %{name}-%version.tar.gz\n\n%description\n#{@project.description}\n\n%prep\n#%setup -q -n #{@project.id}-#{@project.version}\n%setup\n\n%build\n./configure --prefix=/usr --disable-static\nmake\n\n%install\nmake DESTDIR=%{buildroot} install\n\n%clean\n[ %{buildroot} != \"/\" ] && rm -rf %{buildroot}\n\n%post -p /sbin/ldconfig\n%postun -p /sbin/ldconfig\n\n%files\n%defattr(-,root,root)\n\n#{ @project.installer.package_manifest }\n\n%changelog\n* Thu Jan 01 2011 Some Person <nobody@nobody.invalid> - #{@project.version}-1\n- automatically generated spec file\nEOF\n f.close()\n end", "def spec\n @spec ||=\n begin\n require 'rubygems/specification'\n data = File.read('sinbasp.gemspec')\n spec = nil\n Thread.new { spec = eval(\"$SAFE = 3\\n#{data}\") }.join\n spec\n end\nend", "def write_gemspec\n build_command(Jeweler::Commands::WriteGemspec).run\n end", "def to_s(symbols = {}, scope = \"\")\n if @lines.empty? && @metadata.empty?\n sprintf(\"/**\\n * %s\\n */\", @header)\n else\n header = sprintf(\" * %s\", @header) unless @header.nil?\n lines = @lines.map {|l| ' * ' + l }.join(\"\\n\") unless @lines.empty?\n metadata = @metadata.to_a.map {|name, value|\n sprintf(\" * @%s %s\", name.to_s, value.to_s)\n }.join(\"\\n\") unless @metadata.empty?\n \n sprintf(\"/**\\n%s\\n */\", [\n header || nil,\n lines || nil,\n metadata || nil\n ].compact.join(\"\\n *\\n\"))\n end\n end", "def to_s\n return \"#{namespace}:#{project}:#{component}:#{version}\"\n end", "def to_s\n \"#<procedure:#{ @name }>\"\n end", "def gemspec_file\n project_path( \"#{ name }.gemspec\" )\n end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"Examples:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless description_text.empty?\n text << \"\\n\" unless description_text.empty?\n text << \"\\n\" + parameters_output_string\n text << \"\\n\" + rows_output_string unless rows.empty?\n\n text\n end", "def gemspec(platform = 'ruby')\n Gem::Specification.load(File.expand_path('../../redcloth.gemspec', __FILE__))\nend", "def to_s\n return '' if @printed\n @printed = true\n struct = required_structs\n members = @values.map do |key, value|\n type = RustStruct.type_name(value[0])\n subtype = RustStruct.type_name(value[1])\n # TODO: add option for pub / private\n # Will this be a per field thing that is configurable from\n # within the JSON or will it be configured on the parse command?\n member = \" pub #{key}: #{type}\"\n member << \"<#{subtype}>\" unless value[1].nil?\n member\n end\n struct << \"pub struct #{@name} {\\n\" + members.join(\",\\n\") + \",\\n}\\n\\n\"\n struct = struct.gsub(\"\\n\\n\\n\", \"\\n\\n\")\n reset if @root\n struct\n end", "def asPPString\n s = StringIO.new\n s.print \"{\\n :maptype=>:kv,\\n :mapname=>\"\n PP.singleline_pp(@mapname, s)\n s.print \",\\n :map => \"\n PP.pp(@map, s)\n s.puts \"\\n}\"\n return s.string\n end", "def writespec(spec)\n\tfile_name = spec.full_name.untaint + '.gemspec'\n\tFile.open(file_name, \"w\") do |file|\n\t\tfile.puts spec.to_ruby_for_cache\n\tend\n\tprint \"Wrote: %s\\n\" % file_name\nend", "def to_s\n \"#{@name}: #{@gemset_versions.inspect}\"\n end", "def spec_short_name\n return self.spec.to_s.sub(\"#{ModMap.specs}::\", '')\n end", "def to_string(pre=\"\")\n opts = get_modified_options\n returning Array.new do |output|\n unless cancelled?\n output << @prestring || \"\"\n\n if resources && !resources.empty?\n output << resources_string_from_resources(resources, pre)\n end\n \n unless virtual_resource?\n output << \"#{pre}#{class_type_name.downcase} { #{pre}\\\"#{self.key}\\\":\"\n output << opts.flush_out(\"#{pre*2}\").join(\",\\n\")\n output << \"#{pre}}\"\n end\n \n output << @poststring || \"\"\n end\n end.join(\"\\n\")\n end", "def gem_spec\n Gem::Specification.new do |s|\n s.name = package_name\n s.version = version\n s.platform = Gem::Platform::RUBY\n s.summary = summary\n s.description = description || summary\n s.author = author_name\n s.email = author_email\n s.homepage = project_url\n s.require_path = lib_dir\n s.files = package_files\n s.test_files = tests\n s.bindir = bin_dir\n s.executables = programs.map{|p| File.basename(p)}\n s.extensions = FileList['ext/**/extconf.rb']\n s.has_rdoc = true\n s.extra_rdoc_files = rdoc_files\n s.rdoc_options.concat(rdoc_options)\n s.test_files = tests\n s.rubyforge_project = rubyforge_project\n dependencies.each { |args| s.add_dependency(*args) }\n @package_configurator.call(s) if @package_configurator\n end\n end", "def make_tostring(spec, size, eamode, eamode_ext, indent_level)\n to_string = \"\"\n to_string += \" \" * indent_level\n # save the program counter in order to reset it before leaving\n to_string += \" int oldpc = pc;\\n\"\n\n # special rule: in movem instructions, there is a 16 bit word directly\n # after the initial instruction word, which we need to read in before\n # we read the normal operands in order to have the correct PC value\n if spec.mnemonic.to_s.match(/movem_.*/) then\n # reads the register list mask\n to_string += \" int reglist = mem.readShort(pc); pc += 2;\\n\"\n end\n\n # generate the parameter definitions that become the format string\n # arguments\n if spec.out_spec.length > 0\n to_string += make_tostring_param(spec.mnemonic, size, spec.out_spec[0],\n eamode, eamode_ext,\n 'val1', indent_level)\n end\n if spec.out_spec.length > 1\n to_string += make_tostring_param(spec.mnemonic, size, spec.out_spec[1],\n eamode, eamode_ext, 'val2', indent_level)\n end\n\n # build the output string\n if spec.out_spec.length == 0 then\n to_string += \" String str = \\\"#{spec.mnemonic}\\\";\"\n else\n to_string += make_tostring_formatstring(size, spec, eamode, eamode_ext,\n indent_level)\n end\n # restore program counter and exit toString(). In a disassembler,\n # we might just keep the PC as it is\n to_string += \" \" * indent_level\n to_string += \" pc = oldpc;\\n\"\n to_string += \" \" * indent_level\n to_string += \" return str;\"\n to_string\nend", "def inspect\n ((@name.nil?) ? \"Unnamed package\" : \"\\\"#{@name}\\\"\" )+\" (#{@links.length} links, #{@passwords.length} passwords)\"+((@comment == \"\") ? \"\" : \"\\n# #{@comment}\")\n end", "def to_spec\n @spec ||= Gem::Specification.load(loaded_from)\n end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; 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 prettyify_array(gemspec_ruby, array_name); end", "def to_requirement_spec\n result = to_spec\n result = \"#{name} -> #{result}\" if name\n result = \"#{result} -> #{requirement}\" if requirement\n result\n end", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def gem_name\n @specification.name\n end", "def gemspecs; end", "def inspect\n s = self.to_s\n s = s[0,s.length-1]\n display_hooks = hooks.dup\n display_hooks.each do |k,v|\n display_hooks.delete(k) if v.empty?\n end\n unless display_hooks.empty?\n s << \" hooks=#{display_hooks.inspect}\"\n end\n unless requirements.empty?\n s << \" requirements=#{requirements.inspect}\"\n end\n s << \" targets=#{targets.map(&:to_sym).inspect}\" if targets\n s << \" origins=#{origins.map(&:to_sym).inspect}\" if origins\n s << \">\"\n s\n end", "def gemspec_from_values(spec_values)\n %Q[Gem::Specification.new do |gem|\n gem.author = #{spec_values['author'].inspect}\n gem.email = #{spec_values['email'].inspect}\n gem.name = #{spec_values['name'].inspect}\n gem.version = #{spec_values['version'].inspect}\n gem.summary = #{spec_values['summary'].inspect}\n gem.description = #{spec_values['description'].strip.inspect}\n gem.homepage = #{spec_values['homepage'].inspect}\n gem.files = [#{\"#{spec_values['name']}.rb\".inspect}]\n gem.require_paths = [\".\"]\n gem.bindir = \".\"\n #{\"gem.executables = [#{spec_values['name'].inspect}]\" if has_executable?}\n end].gsub(/^\\s{7}/, \"\")\n end", "def to_s\n s = \"------------\\nFile: #{@file}\"\n s += \"\\nFormat version: #{@format_version}\"\n s += \"\\nVisual studio version: #{@visual_studio_version}\"\n s += \"\\nMinimum visual studio version: #{@minimum_visual_studio_version}\"\n s += \"\\nProjects:\" unless @projects.empty?\n @projects.each { |p| s += \"\\n\\t#{p}\" }\n s += \"\\n------------\"\n s\n end", "def to_s\n puts @name\n puts @vcenter.to_yaml\n puts @components.to_yaml\n puts @nodenameconvention.to_yaml\n end", "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 gem_to_gemfile(gem)\n gem_str = <<~GEM\n #{gem.comment ? \"# #{gem.comment}\" : ''}\n #{(gem.commented_out ? '#' : '')}gem '#{gem.name}'#{gem_version_str(gem)}#{gem_options(gem)}\n GEM\n\n gem_str.strip\nend", "def spec_description(path)\n File.read(path).scan(/describe.+?['\"]([^'\"]+)/).flatten.first\n end", "def to_s\n\t\tmessage = \"[SuppliesPackage]-> ammoPower: #{@ammoPower}, \" \\\n\t\t\t\t+ \"fuelUnits: #{@fuelUnits}, shieldPower: #{@shieldPower}\"\n return message\n\tend", "def gemspec_path\n Pathname.glob('*.gemspec').first\n end", "def full_spec\n Gem::Specification === @spec ? @spec : @spec.spec\n end", "def gemspec?; end", "def rpm_family_and_version\n if Pkg::Config.vanagon_project\n Pkg::Config.rpm_targets.split(' ').map do |target|\n rpm_el_family, rpm_el_version, = target.split('-')\n \"#{rpm_el_family}-#{rpm_el_version}\"\n end\n else\n Pkg::Config.final_mocks.split.map { |mock| \"#{mock_el_family(mock)}-#{mock_el_ver(mock)}\" }\n end\nend", "def to_spec\n @spec ||= if @data\n loaded = Gem.loaded_specs[name]\n loaded if loaded && loaded.version == version\n end\n\n @spec ||= Gem::Specification.load(loaded_from)\n end", "def to_yaml\n fields = {\n 'spec' => self.spec_short_name,\n }\n self.fields.each do |k,f|\n fields[k.to_s] = f.get_out_val\n end\n return YAML.dump(fields)\n end", "def spec\r\n @spec ||=\r\n begin\r\n require 'rubygems/specification'\r\n data = File.read('ruby-batch.gemspec')\r\n spec = nil\r\n Thread.new { spec = eval(\"$SAFE = 3\\n#{data}\") }.join\r\n spec\r\n end\r\nend", "def XXget_rfilespec\n f = get_qfilespec.gsub(@options[:directory], '')\n [\"data\", f].join\n end", "def gem_spec\n require 'rubygems/specification'\n spec_fields = %w(\n name author email has_rdoc rubyforge_project summary\n version description required_ruby_version homepage\n )\n Gem::Specification.new do | spec |\n for field in spec_fields\n value = self.send( field )\n spec.send( \"#{field}=\", value )\n end\n \n spec.files = package.files.to_a + %w( Rakefile Manifest.txt )\n spec.test_files = unit_tests.to_a + functional_tests.to_a\n \n spec.executables.push( *executables )\n spec.requirements.push( *requirements )\n end\n end", "def specfile\n Dir[\"#{@path}/[Ss]pecfile\"].first\n end", "def computer_specification\n spec = ''\n spec += computer.platform + ' ' if computer.platform\n spec += platform_version + ' ' if platform_version\n if sdk_version\n spec += \"SDK #{sdk_version} \"\n spec += \"#{math_backend} \" if math_backend\n else\n spec += compiler + ' ' if compiler\n spec += compiler_version if compiler_version\n end\n spec = 'no specificaiton' if spec.empty?\n spec.strip\n end", "def spec_file\n @spec_file ||= File.join spec_dir, \"#{full_name}.gemspec\"\n end", "def prerelease_specs; end", "def to_s\n str = ''\n \n str << \"# A system is comprised of builds, each of which contain projects\\n\"\n str << \"system {\\n\"\n builds.each_value do |build|\n str << \" build #{build.name} {\\n\"\n build.projects.each { |proj| str << \" #{proj}\\n\"; }\n str << \" }\\n\"\n end\n str << \"}\\n\"\n \n return str\n end", "def make_tostring_formatstring(size, spec, eamode, eamode_ext,\n indent_level)\n result = \"\"\n result += \" \" * indent_level\n # cut off special format name extensions in instructions such as add etc.\n # we also do not print lengths that are specified as ':none'\n mnemonic = spec.mnemonic.to_s.gsub(/_.*/, '')\n if overrides_size_suffix?(spec.mnemonic)\n format = \"#{mnemonic}#{size_suffix_override(spec.mnemonic, size)}\"\n elsif spec.size == :none then\n format = \"#{mnemonic}\"\n else\n format = \"#{mnemonic}.#{size}\"\n end\n result += \" String str = String.format(\\\"#{format} \"\n result += format_str_for_arg(spec.mnemonic, spec.out_spec[0], eamode,\n eamode_ext)\n if spec.out_spec.length > 1\n result += \", \"\n result += format_str_for_arg(spec.mnemonic, spec.out_spec[1], eamode,\n eamode_ext)\n end\n # the argument list behind the format string\n result += \"\\\"\"\n result += make_tostring_add_val(spec.out_spec[0], eamode, eamode_ext, 1)\n if spec.out_spec.length > 1\n result += make_tostring_add_val(spec.out_spec[1], eamode, eamode_ext, 2)\n end\n result += \");\\n\"\n result\nend", "def to_s\n ( ( @part ? [ @part ] : [] ) +\n case @ftype\n when :b, :c\n [ @ftype.to_s, @install_class, @pathname, @major, @minor, '%04o' % @mode, @owner, @group ]\n when :d, :e, :f, :p, :v, :x\n [ @ftype.to_s, @install_class, @pathname, '%04o' % @mode, @owner, @group ]\n when :i\n [ @ftype.to_s, @pathname ]\n when :l, :s\n [ @ftype.to_s, @install_class, @pathname ]\n else\n raise RuntimeError, \"Unknown ftype #{@ftype.inspect}\"\n end ).join(' ')\n end", "def to_ps\n ret = \"#{self.class.name}:\\n\"\n c = 0\n @fields.each_pair do |p|\n field = p[1]\n next if field.nil?\n if field.is_a?(NumField) || field.is_a?(ApduList)|| field.is_a?(VarNumField)\n if field.optfield.nil? || field.optfield.value == 1\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, field.hexstr)\n else\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \"--\")\n end\n c = 0\n else #only for bitfield\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \" \" * c + field.bitstr)\n c += field.length\n end\n end\n return ret\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 to_s\n \"#{output}\\n[#{version}]\"\n end", "def pcbas_string\n first = 1\n pcbas = \"\"\n PartNum.get_bde_pcba_part_numbers(self.id).each { |pcba|\n pcbadescription = pcba.description ? pcba.description : \"(Description not set)\"\n string = pcba.name_string + \" \" + pcbadescription\n if first == 1\n pcbas << string \n first = 0\n else\n pcbas << \"<br>\" + string\n end\n }\n pcbas\n end", "def to_s\n \"AppSpec[#{title}], #{@conf.keys.length} keys]\"\n end", "def to_s\n s = '------------'\n s += \"\\nFile: #{@file}\"\n s += \"\\nVersion: #{build_version}\"\n s += \"\\nProjects:\" unless projects.empty?\n projects.each { |p| s += \"\\n\\t#{p}\" }\n s + \"\\n------------\"\n end", "def to_s\n\t\tparts = [ \"Schema:\" ]\n\t\tparts << self.ivar_descriptions.collect {|desc| ' ' + desc }\n\t\treturn parts.join( $/ )\n\tend", "def to_s\n resolve\n desc.to_s\n end", "def help_string()\n str = \"The follow options are to be given as environment variables or commandline arguments:\\n\"\n @required_env_vars.each do |v|\n str += \" #{v}=VALUE\\n\"\n end\n @optional_env_vars.each do |v|\n str += \" [OPTIONAL] #{v}=VALUE\\n\"\n end\n str += \"\\nThe YAML config files need to contain the following sections:\\n\"\n @required_config_sections.each do |v|\n str += \" #{v}\\n\"\n end\n str += \"YAML files are passed with an environment variable with the form,\"\n str += \"SWR_CONFIGFILE_* or passed as paths to the commandline arguments.\\n\"\n return str\n end", "def unversioned_spec\n hash = to_spec_hash\n return nil if hash.values.compact.length <= 1\n if hash[:classifier]\n \"#{hash[:group]}:#{hash[:id]}:#{hash[:type]}:#{hash[:classifier]}:\"\n else\n \"#{hash[:group]}:#{hash[:id]}:#{hash[:type]}\"\n end\n end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def pretty_print(pp)\n pp.text \"#<HalClient::RepresentationFuture\"\n\n if reified?\n pp.newline\n pp.text \"__getobj__=\"\n pp.pp(__getobj__)\n pp.breakable\n else\n pp.breakable\n pp.text \"#{location} (unreified)\"\n end\n\n pp.breakable(\" \")\n pp.text(\">\")\n end", "def to_s\n out = ''\n self.metadata.each{|k,v| out << \"#{k}: #{v}\\n\"}\n out << \"--------------------\\n\"\n self.steps.each{|s| out << s.to_s }\n out\n end", "def gemspec\n @gemspec ||= (\n require 'rubygems'\n ::Gem::Specification.load(gemspec_file)\n )\n end", "def to_s\n \"PMID: #{pmid}\" + \"\\n \" + \"AUTHORS: #{authors}\" + \"\\n \" + \"TITLE: #{title}\"\n end", "def to_spec\n classifier ? \"#{group}:#{id}:#{type}:#{classifier}:#{version}\" : \"#{group}:#{id}:#{type}:#{version}\"\n end", "def pp(indent=0)\n ret = \" \"*indent + \"#{quote(@name)}\"\n case @subsections.count\n when 0\n ret += \"\\n\"\n when 1\n ret += \" \"+@subsections.first[1].pp(indent).lstrip\n else\n ret += \" {\\n\"\n @subsections.each { |n,s|\n ret += s.pp(indent+2)\n }\n ret += \" \"*indent + \"}\\n\"\n end\n ret\n end", "def inspect\n\t\t\trval = super\n\t\t\treturn rval unless self.structure_version\n\t\t\tvstring = \"%d.%d\" % [ self.structure_version, self.data_version ]\n\t\t\treturn rval.sub( />$/, \"; version: #{vstring}>\" )\n\t\tend", "def inspect\n str = self.to_s\n str << \"\\n-------------------------------------------------------\\n\"\n str << \"Algorithms:\\n\"\n @algorithms.each do |a|\n str << a.inspect()\n end\n\n return str\n end", "def describe gem, source = { rubygems: true }\n if source[:rubygems]\n Gems.info(gem).fetch \"info\"\n else\n info = GemspecInfo.new gem, source\n info.summary\n end\n end" ]
[ "0.7081652", "0.6540041", "0.6072871", "0.60563105", "0.59601367", "0.59242296", "0.5898537", "0.5874785", "0.5853572", "0.5834908", "0.57602286", "0.5704995", "0.5698129", "0.56877786", "0.56440413", "0.56112725", "0.55656993", "0.55377674", "0.55309975", "0.55268234", "0.55146015", "0.54956216", "0.54363483", "0.5436298", "0.54301214", "0.5412502", "0.5411796", "0.54083705", "0.5406434", "0.53694314", "0.5367897", "0.5360733", "0.5347427", "0.5344677", "0.5343037", "0.5343037", "0.5343037", "0.5343037", "0.5343037", "0.5343037", "0.5343037", "0.5343037", "0.5322589", "0.5306201", "0.5298296", "0.52936286", "0.52936286", "0.52936286", "0.52936286", "0.5279728", "0.5278589", "0.5276012", "0.525908", "0.52531314", "0.5253042", "0.52491105", "0.5247459", "0.5244985", "0.5225303", "0.52072805", "0.52006483", "0.5188981", "0.51846653", "0.51791894", "0.5179049", "0.5176528", "0.5175096", "0.51704204", "0.5165491", "0.5159154", "0.515518", "0.515446", "0.514675", "0.514534", "0.5145166", "0.51377255", "0.5121809", "0.5121132", "0.5119905", "0.51194775", "0.51135474", "0.51095665", "0.51049775", "0.51048124", "0.51036084", "0.5100194", "0.5100194", "0.5100194", "0.5100194", "0.5100194", "0.5100194", "0.50997293", "0.5094525", "0.5089213", "0.50864583", "0.5079521", "0.5076998", "0.50728256", "0.50701857", "0.5064847" ]
0.5880006
7
Compare this spec to a sepecified upstream gem source and return result. upstream_source should be an instance of Polisher::Gem, Polisher::Gemfile, or other class defining a 'deps' accessor that returns an array of Gem::Requirement dependencies Result will be a hash containing the shared dependencies as well as those that differ and their respective differences
def compare(upstream_source) same = {} diff = {} upstream_source.deps.each do |d| spec_reqs = self.requirements_for_gem(d.name) spec_reqs_specifier = spec_reqs.empty? ? nil : spec_reqs.collect { |req| req.specifier } if spec_reqs.nil? diff[d.name] = {:spec => nil, :upstream => d.requirement.to_s} elsif !spec_reqs.any? { |req| req.matches?(d) } || !self.has_all_requirements_for?(d) diff[d.name] = {:spec => spec_reqs_specifier, :upstream => d.requirement.to_s} elsif !diff.has_key?(d.name) same[d.name] = {:spec => spec_reqs_specifier, :upstream => d.requirement.to_s } end end @metadata[:requires].each do |req| next unless req.gem? upstream_dep = upstream_source.deps.find { |d| d.name == req.gem_name } if upstream_dep.nil? diff[req.gem_name] = {:spec => req.specifier, :upstream => nil} elsif !req.matches?(upstream_dep) diff[req.gem_name] = {:spec => req.specifier, :upstream => upstream_dep.requirement.to_s } elsif !diff.has_key?(req.gem_name) same[req.gem_name] = {:spec => req.specifier, :upstream => upstream_dep.requirement.to_s } end end unless @metadata[:requires].nil? {:same => same, :diff => diff} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_is_upstream_source\n return if source&.upstream == target\n\n errors.add :source, I18n.t('openwebslides.validations.pull_request.target_is_upstream_source')\n end", "def patched\n vendored.collect do |dep|\n # TODO: right now just handling git based alternate sources,\n # should be able to handle other types bundler supports\n # (path and alternate rubygems src)\n next unless dep.source.is_a?(Bundler::Source::Git)\n src = dep.source\n\n # retrieve gem\n gem = if src.version\n Polisher::Gem.new(:name => dep.name, :version => src.version)\n else\n Polisher::Gem.retrieve(dep.name)\n end\n\n # retrieve dep\n git = Polisher::Git::Repo.new :url => src.uri\n git.clone unless git.cloned?\n git.checkout src.ref if src.ref\n\n # diff gem against git\n gem.diff(git.path)\n end.compact!\n end", "def upstream_gem\n @gem ||= Polisher::Gem.from_rubygems gem_name, version\n end", "def version_dependency\n source_options[:from_dependency]\n end", "def update_deps_from(new_source)\n @metadata[:requires] =\n non_gem_requirements +\n extra_gem_requirements(new_source) +\n new_source.deps.select { |r| !excludes_dep?(r.name) }\n .collect { |r| RPM::Requirement.from_gem_dep(r) }.flatten\n\n @metadata[:build_requires] =\n non_gem_build_requirements +\n extra_gem_build_requirements(new_source) +\n new_source.dev_deps.select { |r| !excludes_dev_dep?(r.name) }\n .collect { |r| RPM::Requirement.from_gem_dep(r, true) }.flatten\n end", "def touch_dependency source, specfile\n expect( cover_source_by( source, specfile)).to be_true\nend", "def outdated\n remotes = Gem::SourceInfoCache.search(//)\n outdateds = []\n latest_specs.each do |_, local|\n name = local.name\n remote = remotes.select { |spec| spec.name == name }.\n sort_by { |spec| spec.version }.\n last\n outdateds << name if remote and local.version < remote.version\n end\n outdateds\n end", "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def meets_pods_project_source_dependency(source_filename, dependent_source_filename)\n has_pods_project_source_file(source_filename) ? has_pods_project_source_file(dependent_source_filename) : true\nend", "def meets_pods_project_source_dependency(source_filename, dependent_source_filename)\n has_pods_project_source_file(source_filename) ? has_pods_project_source_file(dependent_source_filename) : true\nend", "def from_dependency?\n source_options && version_dependency\n end", "def legacy_repos\n Gem.sources.reject do |source_uri|\n source_uri = URI.parse source_uri\n spec_path = source_uri + \"specs.#{Gem.marshal_version}.gz\"\n\n begin\n @fetcher.fetch_size spec_path\n rescue Gem::RemoteFetcher::FetchError\n begin\n @fetcher.fetch_size(source_uri + 'yaml') # re-raise if non-repo\n rescue Gem::RemoteFetcher::FetchError\n alert_error \"#{source_uri} does not appear to be a repository\"\n raise\n end\n false\n end\n end\n end", "def check_sources\n case self.source\n when \"rubygems\"\n return false if self.gem_name.empty?\n require 'net/http'\n begin\n r = Net::HTTP.get_response(URI.parse(\"http://rubygems.org/gems/#{self.gem_name}\"))\n Net::HTTPSuccess === r ? (return true) : errors.add(:gem_name, \"#{self.gem_name} is not a valid rubygem\")\n rescue\n errors.add(:gem_name, \"#{self.gem_name} failed.\")\n end\n when \"git\"\n if self.source_url.empty?\n errors.add(:source_url, \"can't be blank\")\n return false\n end\n require 'command_check'\n if command?('git')\n git_ls = system(\"git\", \"ls-remote\", self.source_url)\n if git_ls != true\n errors.add(:source_url, \"#{self.source_url} is not a valid git repository\")\n end\n end\n when \"path\"\n if self.source_url.empty?\n errors.add(:source_url, \"can't be blank\")\n return false\n end\n # Use Dir to see if a gemfile exists in that directory, and protect\n # it with File.directory? to keep out wildcards (resource hog).\n # Make the two cases somewhat indistinguishable to avoid revealing\n # irrelevant system properties.\n if (!File.directory? self.source_url or\n Dir.glob(\"#{self.source_url}/*.gemspec\").empty?)\n errors.add(:source_url, \"Gemspec not found in #{self.source_url}\")\n end\n end\n end", "def spec_predecessors\n result = Hash.new { |h,k| h[k] = [] }\n\n specs = @specs.sort.reverse\n\n specs.each do |spec|\n specs.each do |other|\n next if spec == other\n\n other.dependencies.each do |dep|\n if spec.satisfies_requirement? dep then\n result[spec] << other\n end\n end\n end\n end\n\n result\n end", "def requires_for(source)\n requires.select { |r| r.first == source }.first.last\n end", "def fix_repos(downstream, upstream)\n # get the module name ie: nova\n pwd=get_dir_name(downstream, upstream)\n if File.exists?(pwd)\n raise \"Please manually clean up old directories: #{pwd}\"\n end\n Dir.mkdir(pwd)\n puts \"Working out of directory #{pwd}\"\n\n upstream_dir=File.join(pwd, 'upstream')\n downstream_dir=File.join(pwd, 'downstream')\n\n # clone the upstream and downstream repos\n clone(downstream_dir, \"git://github.com/#{downstream}\")\n clone(upstream_dir, \"git://github.com/#{upstream}\")\n\n # add write remotes for upstream and downstream to upstream\n # it needs the downstream remote b/c it needs access to it's\n # references to perform the cherry-picks\n # it needs access to the upstream repo to perform the push\n add_remote(upstream_dir, \"git@github.com:#{downstream}\", 'downstream')\n add_remote(upstream_dir, \"git@github.com:#{upstream}\", 'upstream')\n\n # start from origin/master\n # this used to be required b/c I was reusing the same directories for testing\n # it isn't required anymore, but it doesn't hurt to leave it here\n checkout(downstream_dir, 'origin/master')\n checkout(upstream_dir, 'origin/master')\n\n # get all revisions for upstream downstream\n rev_list_down=get_rev_list(downstream_dir)\n rev_list_up=get_rev_list(upstream_dir)\n puts \"UP revs count #{rev_list_up.size}\"\n\n # find the commit that upstream and downstream that has the same contents\n ref_results=find_common_commit(downstream_dir, upstream_dir, rev_list_down, rev_list_up)\n\n # rebase the downstream commits on upstream via cherry-pick\n rebase(upstream_dir, rev_list_down[0..(rev_list_down.index(ref_results[0])-1)].reverse, ref_results[1])\nend", "def lookup_dependencies(source_or_source_key)\n source = lookup(source_or_source_key)\n result = []\n looked_up = []\n if source\n dependencies = lookup_direct_dependencies(source)\n while !((dependencies - looked_up).empty?)\n dependencies.each { |d| result << d; looked_up << d }\n dependencies = dependencies.map {|d| lookup_direct_dependencies(d).to_a }.flatten.uniq\n end\n end\n result\n end", "def differ\n @differ ||= Differ.new(externals)\n end", "def update_files_from(new_source)\n to_add = new_source.file_paths\n @metadata[:files] ||= {}\n @metadata[:files].each { |pkg,spec_files|\n (new_source.file_paths & to_add).each { |gem_file|\n # skip files already included in spec or in dir in spec\n has_file = spec_files.any? { |sf|\n gem_file.gsub(sf,'') != gem_file\n }\n\n to_add.delete(gem_file)\n to_add << gem_file.rpmize if !has_file &&\n !Gem.ignorable_file?(gem_file)\n }\n }\n\n @metadata[:new_files] = to_add.select { |f| !Gem.doc_file?(f) }\n @metadata[:new_docs] = to_add - @metadata[:new_files]\n end", "def locked_specs_as_deps\n deps = @dependencies & @locked_deps\n\n @dependencies.each do |dep|\n next if deps.include?(dep)\n deps << dep if @locked_specs.any? { |s| s.satisfies?(dep) }\n end\n\n meta_deps = @locked_specs.for(deps).map do |s|\n dep = Gem::Dependency.new(s.name, s.version)\n @locked_deps.each do |d|\n dep.source = d.source if d.name == dep.name\n end\n dep\n end\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def conflicting_target_backend_usage_list\n # Compute array intersection\n target_backend_usage_list.select do |target_usage|\n source_backend_usage_list.find do |source_usage|\n target_usage.path == source_usage.path\n end\n end\n end", "def init_gemspecs\n Gem.source_index.map { |_, spec| spec }.sort { |a,b|\n\t(a.name <=> b.name).nonzero? || (b.version <=> a.version)\n }\n end", "def require_matched_dependency_version\n false\n end", "def sources_for(source)\n dependencies_for(source) << source\n end", "def unverifiable_packages\n published_packages.keys.select {|p| !expected_cksums.any? {|m| m[\"relpath\"] == p } }\n end", "def find_dependency_versions(dependency)\n versions = []\n specs = Dir[File.join(gem_dir, 'specifications', \"#{dependency.name}-*.gemspec\")]\n unless specs.empty?\n specs.inject(versions) do |versions, gemspec_path|\n versions << gemspec_path[/-([\\d\\.]+)\\.gemspec$/, 1]\n end\n end\n versions.sort.reverse\n end", "def resolved_source\n { compliance: chef_server_url }\n end", "def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)\n [dependency, constraint, current, constraint.include?(current)]\n end\n end", "def resolve_pull_request_dependencies(pull_requests)\n OverridesRetriever.new(client, pull_requests).resolve_dependencies\n end", "def parse_deps(input)\n matches = input.scan(/\\s+-\\s+\\[ \\]\\s+(\\S+)\\s+(\\S+\\s+[0-9.]+)/) || []\n\n gemspecs = matches.map do |match|\n {:name => match[0], :version => match[1]}\n end\n\n # NOTE: These gemspecs are gems that are not yet loaded. We don't know if\n # they are installed or not, so we don't know for sure if the\n # dependency will be met at runtime. So, we'll execute a gem command\n # to check to see if these are installed and ignore the ones that\n # already are.\n gemspecs.delete_if do |gemspec|\n cmd = \"gem list #{gemspec[:name]} -i -l\"\n if gemspec[:version]\n cmd << \" -v '#{gemspec[:version]}'\"\n end\n `#{cmd}` =~ /true/\n end\n\n return gemspecs\n end", "def find_cached_set(dependency)\n unless dependency.external_source\n\n name = dependency.root_name\n podspec_path = podspec_local_cache.local_podspecs[name]\n unless podspec_path.nil?\n # Specify the local pod as external source.\n dependency.external_source = {}\n dependency.external_source[:path] = podspec_path\n stored_to_sandbox_podspecs(name, dependency)\n end\n \n end\n \n origin_find_cached_set(dependency)\n end", "def update_with_missing(source_uri, missing_names)\n progress = ui.progress_reporter(missing_names.size,\n \"Need to update #{missing_names.size} gems from #{source_uri}\")\n missing_names.each do |spec_name|\n begin\n spec_uri = source_uri + \"/quick/#{spec_name}.gemspec.rz\"\n zipped_yaml = fetcher.fetch_path spec_uri\n gemspec = YAML.load unzip(zipped_yaml)\n add_spec gemspec\n progress.updated spec_name\n rescue RuntimeError => ex\n ui.say \"Failed to download spec for #{spec_name} from #{source_uri}\"\n end\n end\n progress.done\n progress.count\n end", "def versions_matching(dep)\n remote_versions_for(dep.name).select { |v|\n dep.match? dep.name, v\n }\n end", "def <=>(other)\n case other\n when Gem::Source::Installed,\n Gem::Source::Local,\n Gem::Source::Lock,\n Gem::Source::SpecificFile,\n Gem::Source::Git,\n Gem::Source::Vendor then\n -1\n when Gem::Source then\n if !@uri\n return 0 unless other.uri\n return 1\n end\n\n return -1 if !other.uri\n\n # Returning 1 here ensures that when sorting a list of sources, the\n # original ordering of sources supplied by the user is preserved.\n return 1 unless @uri.to_s == other.uri.to_s\n\n 0\n else\n nil\n end\n end", "def <=>(other)\n case other\n when Gem::Source::SpecificFile then\n return nil if @spec.name != other.spec.name\n\n @spec.version <=> other.spec.version\n else\n super\n end\n end", "def matching_source?(metadata)\n if metadata.has_key?('metadata_version') && metadata['metadata_version'] == '2.0'\n metadata['source_type'] == 'git' &&\n metadata['location'] == @location &&\n metadata['commitish_type'] == commitish_type.to_s &&\n (metadata['commitish_type'] == 'ref' ? true : metadata['commitish'] == commitish.to_s)\n else\n metadata['source_type'] == 'git' &&\n metadata['commitish_type'] == commitish_type.to_s &&\n (metadata['commitish_type'] == 'ref' ? true : metadata['commitish'] == commitish.to_s)\n end\n end", "def resolved_source_array\n @resolved_source_array ||=\n source_array.each_with_index.map do |source, i|\n package_name = package_name_array[i]\n # we require at least one '/' in the package_name to avoid [XXX_]package 'foo' breaking due to a random 'foo' file in cwd\n if use_package_name_for_source? && source.nil? && package_name.match(/#{::File::SEPARATOR}/) && ::File.exist?(package_name)\n logger.trace(\"No package source specified, but #{package_name} exists on filesystem, using #{package_name} as source.\")\n package_name\n else\n source\n end\n end\n end", "def dependency_versions(args = {}, &bl)\n versions = args[:versions] || {}\n check_deps = args[:dev] ? dev_deps : deps\n\n check_deps.each do |dep|\n unless versions.key?(dep.name)\n begin\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge! gem.versions(args, &bl)\n rescue\n unknown = Polisher::VersionChecker.unknown_version(:all, dep.name, &bl)\n versions.merge! dep.name => unknown\n end\n end\n\n args[:versions] = versions\n end\n\n versions\n end", "def check # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength\n # initial values for response object\n result = {\n summary: {\n valid: false,\n timestamp: Time.now.iso8601,\n location: @target,\n profile: nil,\n controls: 0,\n },\n errors: [],\n warnings: [],\n }\n\n entry = lambda { |file, line, column, control, msg|\n {\n file: file,\n line: line,\n column: column,\n control_id: control,\n msg: msg,\n }\n }\n\n warn = lambda { |file, line, column, control, msg|\n @logger.warn(msg)\n result[:warnings].push(entry.call(file, line, column, control, msg))\n }\n\n error = lambda { |file, line, column, control, msg|\n @logger.error(msg)\n result[:errors].push(entry.call(file, line, column, control, msg))\n }\n\n @logger.info \"Checking profile in #{@target}\"\n meta_path = @source_reader.target.abs_path(@source_reader.metadata.ref)\n\n # verify metadata\n m_errors, m_warnings = metadata.valid\n m_errors.each { |msg| error.call(meta_path, 0, 0, nil, msg) }\n m_warnings.each { |msg| warn.call(meta_path, 0, 0, nil, msg) }\n m_unsupported = metadata.unsupported\n m_unsupported.each { |u| warn.call(meta_path, 0, 0, nil, \"doesn't support: #{u}\") }\n @logger.info \"Metadata OK.\" if m_errors.empty? && m_unsupported.empty?\n\n # only run the vendor check if the legacy profile-path is not used as argument\n if @legacy_profile_path == false\n # verify that a lockfile is present if we have dependencies\n unless metadata.dependencies.empty?\n error.call(meta_path, 0, 0, nil, \"Your profile needs to be vendored with `inspec vendor`.\") unless lockfile_exists?\n end\n\n if lockfile_exists?\n # verify if metadata and lockfile are out of sync\n if lockfile.deps.size != metadata.dependencies.size\n error.call(meta_path, 0, 0, nil, \"inspec.yml and inspec.lock are out-of-sync. Please re-vendor with `inspec vendor`.\")\n end\n\n # verify if metadata and lockfile have the same dependency names\n metadata.dependencies.each do |dep|\n # Skip if the dependency does not specify a name\n next if dep[:name].nil?\n\n # TODO: should we also verify that the soure is the same?\n unless lockfile.deps.map { |x| x[:name] }.include? dep[:name]\n error.call(meta_path, 0, 0, nil, \"Cannot find #{dep[:name]} in lockfile. Please re-vendor with `inspec vendor`.\")\n end\n end\n end\n end\n\n # extract profile name\n result[:summary][:profile] = metadata.params[:name]\n\n count = controls_count\n result[:summary][:controls] = count\n if count == 0\n warn.call(nil, nil, nil, nil, \"No controls or tests were defined.\")\n else\n @logger.info(\"Found #{count} controls.\")\n end\n\n # iterate over hash of groups\n params[:controls].each do |id, control|\n sfile = control[:source_location][:ref]\n sline = control[:source_location][:line]\n error.call(sfile, sline, nil, id, \"Avoid controls with empty IDs\") if id.nil? || id.empty?\n next if id.start_with? \"(generated \"\n\n warn.call(sfile, sline, nil, id, \"Control #{id} has no title\") if control[:title].to_s.empty?\n warn.call(sfile, sline, nil, id, \"Control #{id} has no descriptions\") if control[:descriptions][:default].to_s.empty?\n warn.call(sfile, sline, nil, id, \"Control #{id} has impact > 1.0\") if control[:impact].to_f > 1.0\n warn.call(sfile, sline, nil, id, \"Control #{id} has impact < 0.0\") if control[:impact].to_f < 0.0\n warn.call(sfile, sline, nil, id, \"Control #{id} has no tests defined\") if control[:checks].nil? || control[:checks].empty?\n end\n\n # profile is valid if we could not find any error\n result[:summary][:valid] = result[:errors].empty?\n\n @logger.info \"Control definitions OK.\" if result[:warnings].empty?\n result\n end", "def dependency_versions(args = {}, &bl)\n versions = args[:versions] || {}\n check_deps = args[:dev] ? dev_deps : deps\n\n check_deps.each do |dep|\n unless versions.key?(dep.name)\n begin\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge! gem.versions(args, &bl)\n rescue\n unknown = Polisher::VersionChecker.unknown_version(:all, dep.name, &bl)\n versions.merge! dep.name => unknown\n end\n end\n\n args[:versions] = versions\n end\n\n versions\n end", "def lookup_direct_dependencies!(source)\n return [] unless source\n\n source.dependencies.map do |dependency|\n result = provides_tree.glob(\"/#{dependency}\")\n if (!result || (result.is_a?(Array) && result.empty?))\n Jsus.logger.warn \"#{source.filename} is missing #{dependency.is_a?(SourceFile) ? dependency.filename : dependency.to_s}\"\n end\n result\n end.flatten.map {|tag| lookup(tag) }\n end", "def resolve\n locking_dg = Molinillo::DependencyGraph.new\n Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }, locking_dg).tsort.map(&:payload).compact\n rescue Molinillo::VersionConflict => e\n conflict = e.conflicts.values.first\n raise Gem::DependencyResolutionError, Conflict.new(conflict.requirement_trees.first.first, conflict.existing, conflict.requirement)\n ensure\n @output.close if defined?(@output) and !debug?\n end", "def dependency_versions(args = {}, &bl)\n versions = {}\n args = {:recursive => true, :dev_deps => true, :versions => versions}.merge(args)\n deps.each do |dep|\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge!(gem.versions(args, &bl))\n end\n versions\n end", "def build_predecessors\n result = Hash.new { |h,k| h[k] = [] }\n @specs.each do |spec|\n\t@specs.each do |other|\n\t next if spec.full_name == other.full_name\n\t other.dependencies.each do |dep|\n\t if spec.satisfies_requirement?(dep)\n\t result[spec.full_name] << other\n\t end\n\t end\n\tend\n end\n result\n end", "def dependency_causes_outdatedness?(dependency)\n return true if dependency.from.nil?\n\n status = basic.outdatedness_status_for(dependency.from)\n\n active = status.props.active & dependency.props.active\n active.delete(:attributes) if attributes_unaffected?(status, dependency)\n active.delete(:raw_content) if raw_content_unaffected?(status, dependency)\n\n active.any?\n end", "def find_reverse_dependencies(spec, srcindex)\n result = []\n srcindex.each do |name, sp|\n sp.dependencies.each do |dep|\n if spec.name == dep.name &&\n dep.version_requirements.satisfied_by?(spec.version)\n result << [sp.full_name, dep]\n end\n end\n end\n result\n end", "def satisfy?(y)\n unless y.is_a?(RPMDependency)\n raise ArgumentError, \"Expecting an RPMDependency object\"\n end\n\n x = self\n\n # Easy!\n if x.name != y.name\n return false\n end\n\n # Partial compare\n #\n # eg: x.version 2.3 == y.version 2.3-1\n sense = x.version.partial_compare(y.version)\n\n # Thanks to rpmdsCompare() rpmds.c\n if (sense < 0) && ((x.flag == :> || x.flag == :>=) || (y.flag == :<= || y.flag == :<))\n return true\n elsif (sense > 0) && ((x.flag == :< || x.flag == :<=) || (y.flag == :>= || y.flag == :>))\n return true\n elsif sense == 0 && (\n ((x.flag == :== || x.flag == :<= || x.flag == :>=) && (y.flag == :== || y.flag == :<= || y.flag == :>=)) ||\n (x.flag == :< && y.flag == :<) ||\n (x.flag == :> && y.flag == :>)\n )\n return true\n end\n\n false\n end", "def specs\n @specs ||= begin\n specs = resolve.materialize(requested_dependencies)\n\n all_dependencies = requested_dependencies.concat(specs.flat_map(&:dependencies))\n if all_dependencies.any? { |d| d.name == \"bundler\" } && !specs[\"bundler\"].any?\n bundler = sources.metadata_source.specs.search(bundler_query).last\n specs[\"bundler\"] = bundler\n end\n\n specs\n end\n end", "def find_possible(dependency) # :nodoc:\n all = @set.find_all dependency\n\n if (skip_dep_gems = skip_gems[dependency.name]) && !skip_dep_gems.empty?\n matching = all.select do |api_spec|\n skip_dep_gems.any? {|s| api_spec.version == s.version }\n end\n\n all = matching unless matching.empty?\n end\n\n matching_platform = select_local_platforms all\n\n return matching_platform, all\n end", "def add_dependency(source, dependency)\n unless same_file? dependency, source\n dependencies << [dependency, source]\n end\n end", "def git_source?\n # Special case Composer, which uses git as a source but handles tags\n # internally\n return false if dependency.package_manager == \"composer\"\n\n requirements = dependency.requirements\n sources = requirements.map { |r| r.fetch(:source) }.uniq.compact\n return false if sources.empty?\n raise \"Multiple sources! #{sources.join(', ')}\" if sources.count > 1\n source_type = sources.first[:type] || sources.first.fetch(\"type\")\n source_type == \"git\"\n end", "def load_spec(name, version, platform, source) # :nodoc:\n dep = Gem::Dependency.new name, version\n\n found = @specs.find do |spec|\n dep.matches_spec? spec and spec.platform == platform\n end\n\n tuple = Gem::NameTuple.new found.name, found.version, found.platform\n\n found.source.fetch_spec tuple\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def external_dependency_checksum; end", "def find_matching(dependency, all = false, matching_platform = true)\n found = {}\n\n list(all).each do |source_uri, specs|\n found[source_uri] = specs.select do |spec_name, version, spec_platform|\n dependency =~ Gem::Dependency.new(spec_name, version) and\n (not matching_platform or Gem::Platform.match(spec_platform))\n end\n end\n\n specs_and_sources = []\n\n found.each do |source_uri, specs|\n uri_str = source_uri.to_s\n specs_and_sources.push(*specs.map { |spec| [spec, uri_str] })\n end\n\n specs_and_sources\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def updated_gemfile_requirement(req)\n return req unless latest_resolvable_version\n return req if existing_version && no_change_in_version?\n return req if !existing_version && new_version_satisfies?(req)\n\n requirements =\n req[:requirement].split(\",\").map { |r| Gem::Requirement.new(r) }\n\n new_req =\n if requirements.any?(&:exact?)\n \"= #{latest_resolvable_version}\"\n elsif requirements.any? { |r| r.to_s.start_with?(\"~>\") }\n tw_req = requirements.find { |r| r.to_s.start_with?(\"~>\") }\n update_twiddle_version(tw_req, latest_resolvable_version).to_s\n else\n update_gemfile_range(requirements).map(&:to_s).join(\", \")\n end\n\n req.merge(requirement: new_req)\n end", "def specs_matching specs\n req = DeferredRequest.pull response_service.uuid, specs\n revised_specs = req && unpack_request(req)\n revised_specs\n end", "def dedupe(source)\n all_identical = (@forward_edges_with_info.size ==\n source.forward_edges_with_info.size)\n # Use #keys.each instead of #each_key as we are modifying in-place\n @forward_edges_with_info.keys.each do |v| # rubocop:disable Style/HashEachMethods\n self_out_edges = @forward_edges_with_info[v]\n source_out_edges = source.forward_edges_with_info[v]\n if self_out_edges.empty?\n all_identical &&= source_out_edges.empty?\n @forward_edges_with_info[v] = @@identity_hash_singleton\n elsif self_out_edges == source_out_edges\n @forward_edges_with_info[v] = source_out_edges.freeze\n else\n all_identical = false\n end\n end\n\n if all_identical\n @forward_edges_with_info = source.forward_edges_with_info.freeze\n @backward_edges = source.backward_edges.freeze\n return\n end\n\n # Use #keys.each instead of #each_key as we are modifying in-place\n @backward_edges.keys.each do |v| # rubocop:disable Style/HashEachMethods\n self_in_edges = @backward_edges[v]\n source_in_edges = source.backward_edges[v]\n if self_in_edges.empty?\n @backward_edges[v] = @@identity_hash_singleton\n elsif self_in_edges == source_in_edges\n @backward_edges[v] = source_in_edges.freeze\n end\n end\n end", "def check_gems\n @gems ||= {}\n @gems.keys.select { |g| Gem.source_index.find_name(g, @gems[g]).size == 0 }\n end", "def find_matching_source_lines\n\t\tmatches = []\n\n\t\tsource_files = $hoespec.spec.files.grep( /\\.(h|c|rb)$/ )\n\t\tsource_files -= self.quality_check_whitelist\n\n\t\tsource_files.each do |filename|\n\t\t\tprevious_line = nil\n\n\t\t\tIO.foreach( filename ).with_index do |line, i|\n\t\t\t\tmatches << [filename, i + 1, line] if yield( line, previous_line )\n\t\t\t\tprevious_line = line\n\t\t\tend\n\t\tend\n\n\t\treturn matches\n\tend", "def parse_metadata_index_to_source_unit(metadata_file)\n metadata_content = nil\n File.open(metadata_file) do |f|\n meta = Zlib::GzipReader.new(f)\n metadata_content = meta.read\n meta.close\n end\n\n return nil if !metadata_content\n\n metadata_gemspec = Psych.load(metadata_content)\n gem = gemspec_to_source_unit(metadata_gemspec)\n\n deps = map_deps_to_source_unit_deps(gem[:dependencies] || [], 'gemspec')\n #Filter: dont add dev dependencies, or redundant deps (deps with names of gemspec files)\n\n valid_deps = deps.select{|dep| dep_is_valid(dep) && !@all_gemspec_names.include?(dep.name)}\n locked_deps = get_locked_dep_versions(valid_deps, gem)\n gem[:dependencies] = locked_deps\n\n files = find_scripts(File.dirname(metadata_file)).map do |script_path|\n Pathname.new(script_path).relative_path_from(@pre_wd)\n end\n files.push(\".\") # Hack: This is so this gets elected as top level over find_scripts\n\n src_unit = {\n 'Name' => gem[:name],\n 'Version' => gem[:version],\n 'Type' => 'rubygem',\n 'Dir' => '.',\n 'Files' => files,\n 'Dependencies' => locked_deps,\n 'Data' => gem,\n 'Ops' => {'depresolve' => nil, 'graph' => nil},\n }\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n source.fetch_spec tuple\n rescue Gem::RemoteFetcher::FetchError\n raise if @original_platform == @platform\n\n tuple = Gem::NameTuple.new @name, @version, @original_platform\n source.fetch_spec tuple\n end\n end", "def _validate_source(s)\n if git = s[:git]\n tag, commit = s.values_at(:tag, :commit)\n version = spec.version.to_s\n\n if git =~ %r{http://EXAMPLE}\n results.add_error('source', 'The Git source still contains the ' \\\n 'example URL.')\n end\n if commit && commit.downcase =~ /head/\n results.add_error('source', 'The commit of a Git source cannot be' \\\n ' `HEAD`.')\n end\n if tag && !tag.to_s.include?(version)\n results.add_warning('source', 'The version should be included in' \\\n ' the Git tag.')\n end\n if tag.nil?\n results.add_warning('source', 'Git sources should specify a tag.', true)\n end\n end\n\n perform_github_source_checks(s)\n check_git_ssh_source(s)\n end", "def compute_changes\n @old_spec_set.each do |gem_specs|\n unless ( old_version = gem_specs.version ) == ( new_version = @new_spec_set[ gem_specs.name ].first.version )\n @changes[ gem_specs.name ] = { versions: { old: old_version.to_s, new: new_version.to_s } }\n end\n end\n end", "def conflicts\n conflicts = {}\n self.runtime_dependencies.each do |dep|\n spec = Gem.loaded_specs[dep.name]\n if spec and not spec.satisfies_requirement? dep\n (conflicts[spec] ||= []) << dep\n end\n end\n env_req = Gem.env_requirement(name)\n (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version\n conflicts\n end", "def get_interim_versions\n interim_puppetfile = nil\n Dir.chdir(\"#{@options[:work_dir]}/simp-core\") do |dir|\n # Make sure we are not on a tag\n `git checkout -q master`\n src = File.join(dir, 'Puppetfile.pinned')\n interim_puppetfile = File.join(@options[:work_dir], 'Puppetfile.pinned')\n debug(\"Copying latest simp-core Puppetfile.pinned into #{interim_puppetfile}\")\n FileUtils.cp(src, interim_puppetfile)\n end\n\n debug(\"Retrieving latest simp-core pinned component versions from #{interim_puppetfile}\")\n @interim_versions = {}\n helper = PuppetfileHelper.new(interim_puppetfile, @options[:work_dir], false)\n helper.modules.each do |mod|\n if mod[:desired_ref].match(/master|main/)\n @interim_versions[mod[:name]] = 'latest'\n else\n @interim_versions[mod[:name]] = mod[:desired_ref]\n end\n end\n end", "def evaluate_dependency(app, source, dependency, report)\n filename = app.cache_path.join(source.class.type, \"#{dependency.name}.#{DependencyRecord::EXTENSION}\")\n report[\"filename\"] = filename\n\n cached_record = cached_record(filename)\n if cached_record.nil?\n report.errors << \"cached dependency record not found\"\n else\n report.errors << \"cached dependency record out of date\" if cached_record[\"version\"] != dependency.version\n report.errors << \"missing license text\" if cached_record.licenses.empty?\n report.errors << \"license needs review: #{cached_record[\"license\"]}\" unless allowed_or_reviewed?(app, cached_record)\n end\n\n report.errors.empty?\n end", "def upstream\n @config.get_value('GIT_UPSTREAM')\n end", "def relevant_packages\n packages.select { |p| p['version'] == version }\n end", "def dependencies\n spec.dependencies\n end", "def dependencies\n spec.dependencies\n end", "def fetch(dependency, all = false, matching_platform = true)\n specs_and_sources = find_matching dependency, all, matching_platform\n\n specs_and_sources.map do |spec_tuple, source_uri|\n [fetch_spec(spec_tuple, URI.parse(source_uri)), source_uri]\n end\n\n rescue Gem::RemoteFetcher::FetchError => e\n raise unless warn_legacy e do\n require 'rubygems/source_info_cache'\n\n return Gem::SourceInfoCache.search_with_source(dependency,\n matching_platform, all)\n end\n end", "def dependencies_for(source, acc = [])\n ds = dependencies.select { |d| d.last == source }.\n map { |d| d.first }\n return acc if ds.empty?\n acc = acc | ds\n ds.each { |d| acc = acc | dependencies_for(d, acc) }\n acc\n end", "def compare_versions(y, partial = false)\n x = self\n\n # compare epoch\n if (x.e.nil? == false && x.e > 0) && y.e.nil?\n return 1\n elsif x.e.nil? && (y.e.nil? == false && y.e > 0)\n return -1\n elsif x.e.nil? == false && y.e.nil? == false\n if x.e < y.e\n return -1\n elsif x.e > y.e\n return 1\n end\n end\n\n # compare version\n if partial && (x.v.nil? || y.v.nil?)\n return 0\n elsif x.v.nil? == false && y.v.nil?\n return 1\n elsif x.v.nil? && y.v.nil? == false\n return -1\n elsif x.v.nil? == false && y.v.nil? == false\n cmp = RPMUtils.rpmvercmp(x.v, y.v)\n return cmp if cmp != 0\n end\n\n # compare release\n if partial && (x.r.nil? || y.r.nil?)\n return 0\n elsif x.r.nil? == false && y.r.nil?\n return 1\n elsif x.r.nil? && y.r.nil? == false\n return -1\n elsif x.r.nil? == false && y.r.nil? == false\n cmp = RPMUtils.rpmvercmp(x.r, y.r)\n return cmp\n end\n\n 0\n end", "def resolve\n debug do\n <<~MSG\n Filtering out #{conflicts.size} conflicts from #{base_local_diffs.size + base_remote_diffs.size} diffs\n Remaining diffs #{unconflicted_diffs.size}\n MSG\n end\n\n conflicts.each_with_object(unconflicted_diffs) do |conflict, diffs|\n # TODO: this will result in diffs being out of order from their\n # original order. diffs should be flagged as conflicted and\n # this method should instead remove the conflicted flag.\n diffs.concat(@conflict_resolver.resolve(conflict))\n # TODO: if the conflict is resolved, it should be removed from the\n # @conflicts array.\n end\n end", "def test_resolve_dependencies\n Dir.mktmpdir('testbase') do |testbase|\n tpkg = Tpkg.new(:base => testbase, :sources => @pkgfiles)\n\n result = tpkg.resolve_dependencies([{:name => 'a', :type => :tpkg}], {:tpkg => {}, :native => {}}, ['a'])\n assert(result.has_key?(:solution))\n solution = result[:solution]\n\n # We should end up with a-1.0, b-1.0 (the specific one, not the generic\n # one), c-1.2 and d-1.2\n assert_equal(4, solution.length)\n good = ['a-1.0-1.tpkg', \"b-1.0-1-#{Metadata.clean_for_filename(tpkg.os.os)}.tpkg\", 'c-1.2-1.tpkg', 'd-1.2-1.tpkg']\n solution.each { |pkg| assert(good.any? { |g| pkg[:source].include?(g) }) }\n end\n end", "def check_conflict()\n check_results = []\n\n repo_name = github.pr_json[:base][:repo][:full_name]\n\n pull_requests = github.api.pull_requests(repo_name).select do |pr|\n pr[:id] != github.pr_json[:id] && pr[:base][:label] == github.pr_json[:base][:label]\n end\n\n return check_results if pull_requests.empty?\n\n g = Git.open(Dir.pwd)\n\n pull_requests.each do |pr|\n result = {\n pull_request: pr,\n mergeable: true,\n conflicts: []\n }\n\n uuid = SecureRandom.uuid\n\n r = g.add_remote(uuid, pr[:head][:repo][:ssh_url])\n r.fetch()\n\n branch1 = github.pr_json[:head][:ref]\n branch2 = \"#{uuid}/#{pr[:head][:ref]}\"\n\n base = `git merge-base #{branch1} #{branch2}`.chomp\n\n Tempfile.open('tmp') do |f|\n patch = `git format-patch #{base}..#{branch2} --stdout`.chomp\n f.sync = true\n f.puts patch\n out, s = Open3.capture2e(\"git apply --check #{f.path}\")\n\n out.each_line do |line|\n\n if 'patch failed' == line.split(':')[1].strip\n conflict = {\n file: line.split(':')[2].strip,\n line: line.split(':')[3].strip.to_i\n }\n result[:conflicts] << conflict\n end\n end\n\n result[:mergeable] = result[:conflicts].empty?\n end\n\n g.remove_remote(uuid)\n\n check_results << result\n end\n\n check_results\n end", "def test_rubygems_to_standard_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.3', :rubygems), :<, ::Versionomy.parse('1.2.4'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :>, ::Versionomy.parse('1.2b2'))\n assert_operator(::Versionomy.parse('1.2', :rubygems), :>, ::Versionomy.parse('1.2b1'))\n end", "def get_loaded_and_remote_diffs(remote_r, repo_name, module_branch, remote_u, remote_b)\n adapter_repo = get_adapter_repo(context(repo_name, module_branch))\n adapter_repo.local_remote_relationship(remote_r, remote_u, remote_b)\n end", "def find_common_commit(downstream_dir, upstream_dir, rev_list_down, rev_list_up)\n\n # start with first commit from downstream\n #rev_list_down.reverse.each do |ref|\n output_size={}\n # NOTE: always just check the last (oldest) commit from downstream.\n # you could iterate through them all, but it would change form O(n) to O(n2)\n # I was thinking it would be annoyingly slow, so I didn't even bother trying\n # rev_list_down.each do |ref|\n ref = rev_list_down.last\n # checkout the last commit from downstream\n checkout(downstream_dir, ref)\n # iterate throuug all upstream commits\n rev_list_up.each do |ref2|\n # checkout upstream code based on that commit\n checkout(upstream_dir, ref2)\n # run the recursive diff\n out = system_cmd(\"diff -r --exclude=.svn --exclude=.git #{upstream_dir} #{downstream_dir}\")\n #puts out\n # if return code is true (ie: they match!)\n if out[1]\n puts \"Upstream #{ref2} matches downstream #{ref}\"\n # return the references that match [downstream, upstream]\n return [ref, ref2]\n else\n output_size[out[0].size] ||= {}\n # if they don't match, save the references, and diff output\n output_size[out[0].size][\"#{ref}_#{ref2}\"] = out[0]\n end\n end\n #end\n smallest = output_size.keys.sort.first\n puts \"the least number of difference found is: #{smallest}\"\n puts \"we found #{output_size[smallest].size} one repos of this diff size\"\n puts \"The output from the first one of this size is:\\n#{output_size[smallest].values.first.join(\"\\n\")}\"\n refs=output_size[smallest].keys.first.split('_')\n puts \"For refs: #{refs}\"\n checkout(downstream_dir, refs[0])\n checkout(upstream_dir, refs[1])\n if output_size[smallest].size == 1\n # if there is only one smallest matching, show the user the diff and ask them if they want\n # to try to rebase anyways\n puts 'Do you want to proceed with rebasing this result?(Yes or No)'\n result = gets\n if result.chomp == 'Yes'\n return refs\n end\n end\n raise \"Could not find any common anscestor\"\nend", "def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n # we have to \"resolve\" partial versions like \"12\" through mixlib-install before comparing them here\n des_version =\n if new_resource.download_url_override\n # probably in an air-gapped environment.\n Mixlib::Versioning.parse(desired_version)\n else\n Mixlib::Versioning.parse(Array(mixlib_install.artifact_info).first.version)\n end\n Chef::Log.debug(\"The current chef-client version is #{cur_version} and the desired version is #{desired_version}\")\n new_resource.prevent_downgrade ? (des_version > cur_version) : (des_version != cur_version)\nend", "def describe gem, source = { rubygems: true }\n if source[:rubygems]\n Gems.info(gem).fetch \"info\"\n else\n info = GemspecInfo.new gem, source\n info.summary\n end\n end", "def source\n @source ||= Gem::Source::Installed.new\n end", "def external_incompatibilities\n if conflict?\n [\n cause.conflict,\n cause.other\n ].flat_map(&:external_incompatibilities)\n else\n [this]\n end\n end", "def source_for_source_input(source_input)\n sources.find { |source| source.source_input == source_input }\n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n\n @source.fetch_spec tuple\n end\n end", "def external_dependency_checksum\n nil\n end", "def compute_changes\n spec_sets_diff!\n\n old_spec_set.each do |old_gem|\n updated_gem = new_spec_set.find { |new_gem| new_gem.name == old_gem.name }\n next unless updated_gem && old_gem.version != updated_gem.version\n\n fill_changes(old_gem, updated_gem)\n end\n end", "def resolve(dependency)\n if from_dependency? && version_dependency == dependency.name\n construct_build_version(dependency)\n log.info(log_key) { \"Build Version is set to '#{build_version}'\" }\n end\n end", "def unit_compatibility(source_unit, desired_unit)\n return Unitwise(1, source_unit).compatible_with?Unitwise(1, desired_unit)\nend", "def <=>(other)\n case other\n when Gem::Source::Git,\n Gem::Source::Lock,\n Gem::Source::Vendor then\n -1\n when Gem::Source::Installed then\n 0\n when Gem::Source then\n 1\n else\n nil\n end\n end", "def evaluate_dependency(app, source, dependency, report)\n filename = app.cache_path.join(source.class.type, \"#{dependency.name}.#{DependencyRecord::EXTENSION}\")\n report[\"cached_record\"] = Licensed::DependencyRecord.read(filename)\n if !report[\"cached_record\"]\n report.warnings << \"expected cached record not found at #{filename}\"\n end\n\n true\n end", "def dependency_states\n states = {}\n deps.each do |dep|\n gem = Polisher::Gem.new :name => dep.name\n states.merge! dep.name => gem.state(:check => dep)\n end\n states\n end", "def source_rpm\n @header.source_rpm\n end", "def prefetch(reqs)\n return unless @specs.empty?\n\n @repositories.each do |name, (repository, reference)|\n source = Gem::Source::Git.new name, repository, reference\n source.root_dir = @root_dir\n source.remote = @remote\n\n source.specs.each do |spec|\n git_spec = Gem::Resolver::GitSpecification.new self, spec, source\n\n @specs[spec.name] = git_spec\n end\n end\n end" ]
[ "0.58725435", "0.58384055", "0.55911046", "0.55055064", "0.54918385", "0.52337176", "0.512998", "0.5120674", "0.511616", "0.511616", "0.5093228", "0.4934556", "0.49239683", "0.49144685", "0.4904337", "0.4900853", "0.4879244", "0.48754996", "0.4873863", "0.4869386", "0.48312807", "0.48182058", "0.48139867", "0.47985017", "0.47835684", "0.47663185", "0.47375476", "0.47346258", "0.4726763", "0.47236225", "0.4714565", "0.46715805", "0.46405548", "0.4635086", "0.46342814", "0.4629535", "0.46101952", "0.46050593", "0.4602317", "0.45802844", "0.45722783", "0.45629632", "0.45609656", "0.45586142", "0.45559648", "0.45509955", "0.45400518", "0.4533925", "0.45288715", "0.4524132", "0.4522774", "0.45185578", "0.45085305", "0.44793853", "0.44775882", "0.44775882", "0.44775882", "0.44774386", "0.447613", "0.44728076", "0.4466107", "0.44571736", "0.44527423", "0.44442952", "0.44429648", "0.4438532", "0.44341514", "0.44266072", "0.44195184", "0.44054157", "0.43989247", "0.43972003", "0.43886685", "0.4387184", "0.43842196", "0.43842196", "0.4379767", "0.43724522", "0.4361828", "0.43465298", "0.43426913", "0.43389785", "0.43372083", "0.43370825", "0.43363392", "0.433569", "0.4331822", "0.43310234", "0.43293858", "0.43288124", "0.43273476", "0.43252963", "0.43128058", "0.4301479", "0.42970327", "0.42968985", "0.4294544", "0.42930236", "0.4291623", "0.42906052" ]
0.85392034
0
Strips out all embedded information from the image
def strip manipulate! do |img| img.strip img = yield(img) if block_given? img end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip\n write_opts[:strip] = true\n get_image\n end", "def strip_exif_metadata\r\n manipulate! do |img|\r\n img.strip\r\n img = yield(img) if block_given?\r\n img\r\n end\r\n end", "def strip\n manipulate! do |image|\n @_strip = true\n image\n end\n end", "def strip_images(value)\n value.gsub(/<img .*?>/, '')\n end", "def strip\n return unless self.file.content_type.start_with? 'image'\n\n manipulate! do |img|\n img.strip\n img = yield(img) if block_given?\n img\n end\n end", "def strip\n manipulate! do |image|\n image.strip\n block_given? ? yield(image) : image\n end\n end", "def strip\n manipulate! do |img|\n img.auto_orient if img.respond_to?(:auto_orient)\n img.strip\n img = yield(img) if block_given?\n img\n end\n end", "def strip\n manipulate! do |img|\n img.strip!\n img = yield(img) if block_given?\n img\n end\n end", "def strip\n manipulate! do |img|\n img.strip!\n img = yield(img) if block_given?\n img\n end\n end", "def strip\n manipulate! do |img|\n img.strip\n img = yield(img) if block_given?\n img\n end\n end", "def strip\n manipulate! do |img|\n img.strip\n img = yield(img) if block_given?\n img\n end\n end", "def strip\n manipulate! do |img|\n img.strip\n img = yield(img) if block_given?\n img\n end\n end", "def html_body_without_tracking_image\n html_body.gsub(/\\<p class\\=['\"]ampimg['\"].*?\\<\\/p\\>/, '')\n end", "def strip\n \tmanipulate! do |img|\n img.strip\n img = yield(img) if block_given?\n img\n end\n end", "def strip_annotations(content); end", "def filter_without_image(response)\n resp = []\n response.each do |artist_info|\n resp << artist_info if artist_info.dig('image', -2, '#text').present?\n end\n resp\n end", "def strip_images(node)\n node.css('img').each do |img|\n match = ASSET_IMAGE_SRC_REGEX.match(img['src'])\n\n insert_tag(HANDLEBARS_TEMPLATE_ASSET_IMAGE % match[1].to_i) if match\n img.remove\n end\n\n node\n end", "def extract_rendering_attachments!\n rendered_url_index = find_index{|a| (a.kind_of?(Hash) && a['content-type'] == 'image/png' && a['filename'] =~ /websnappr/)}\n delete_at(rendered_url_index)\n end", "def strip_images(node)\n node.css('img').each do |img|\n process_image(img)\n img.remove\n end\n\n node\n end", "def strip_images(node)\n return nil if node.nil?\n\n node.css('img').each do |img|\n process_image(img)\n img.remove\n end\n\n node\n end", "def clean_img\n\t\t\tname = 'simple-ocr'\n\t\t\tg = Gem::Specification.find_by_name(name)\n\t\t\t`sh #{File.join(g.full_gem_path, 'lib/textcleaner')} -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20 '#{@image}' '#{@clean_image}'`\n\t\tend", "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 dump_show_img\n FileUtils.rm_rf(Dir.glob(\"#{project.image_for('', 'show_image_desk')}/*\"))\n FileUtils.rm_rf(Dir.glob(\"#{project.image_for('', 'show_image_mob')}/*\"))\n FileUtils.rm_rf(Dir.glob(\"#{project.image_for('', 'show')}/*\"))\n end", "def strip_gps!\n return nil if gps_stripped\n\n output, status = Open3.capture2e(\"script/strip_exif\", id.to_s,\n transferred ? \"1\" : \"0\")\n return output unless status.success?\n\n update_attribute(:gps_stripped, true)\n nil\n end", "def extract_jpeg(data)\n pos = 0\n while pos + 11 < data.length\n head = data[pos, 11]\n\n if head.to_s.match(Regexp.new('^\\xff\\xd8\\xff...(JFIF|Exif)\\x00', nil, \"n\"))\n return data[pos ... data.length]\n else\n pos += 1\n end\n end\n\n return \"\"\n end", "def remove_picture\n res = system(remove_picture_cmd(info.file))\n\n raise Aur::Exception::FailedOperation, \"strip #{info.file}\" unless res\n end", "def remove_typepad_links\n results = @content.scan(/<a href=.*?<\\/a>/)\n\n results.each do |result|\n # if result contains an image with an image-full class\n if result =~ /image-full/\n temp = result.sub(/<a href=.*?>/, \"\").sub(/<\\/a>/, \"\")\n @content.sub!(result, temp)\n end\n end\n end", "def delete_exif\n Jhead.call(\"-de\", @match, @pattern)\n end", "def cleanup_image_tags\n self.tags = self.tags.strip\n unless self.tags.empty?\n tags = self.tags.split(\",\")\n tags_new = []\n tags.each do |item|\n tags_new.push(item.strip)\n end\n self.tags = tags_new.join(\",\")\n end\n end", "def contents\n image.contents[image_offset, size]\n end", "def contents\n image.contents[image_offset, size]\n end", "def convert_standalone_image(el, indent); end", "def remove_unnecessary_data(info_hash) \n just_character_data = info_hash[\"results\"].flatten\nend", "def extract_exif_from_image(image)\n filename = File.basename(image)\n latitude = ''\n longitude = ''\n object = EXIFR::JPEG.new(image)\n\n unless object.gps.nil?\n latitude = object.gps.latitude\n longitude = object.gps.longitude\n end\n\n write_to_csv(filename, latitude, longitude)\nend", "def get_image_credit(page_doc)\n\timage_credit = page_doc.css('body center:nth-child(2)')\n\timage_credit.search('.//b')[0].remove\n\timage_credit.search('.//br').remove\n\timage_credit.search('center').remove\n\treturn image_credit.inner_html.strip!\nend", "def strip_extra_content(item, locale=I18n.locale)\n strip_tags(exclude_base64(raw_value(item, locale)))\n end", "def extract_metadata; end", "def strip_textile(x)\n x = x.gsub(/<.+?>/,'')\n x = x.gsub(/\\\"(.*?)\\\":http:\\/\\/([^ ]*)( )?/,'\\1 ') unless x.blank?\n x\n end", "def images\n manifestation_attachments.reject{|a| a.attachment_type_id != 3}\n end", "def removePageRelatedTags(contents)\n regex = '(?:<br\\/>\\n)?(?:<hr\\/>\\n)?<a name=\\d+><\\/a>(<img src=\"list-\\d+_\\d+.jpg\"\\/?><br\\/>\\n)*\\d*(?:\\s<br\\/>\\n\\s<br\\/>)?\\n*'\n scan = contents.scan(/#{regex}/m)\n\n if scan.length == 92\n contents = contents.gsub(/#{regex}/m, '')\n else\n fail 'Did not find 92 page tags'\n end\n checkNoImgTags(contents)\n\n contents\n end", "def broken_parts\n page_elements.select { |pe| pe.embeddable.nil? }\n end", "def transplant_exif(name)\n Jhead.call(\"-te\", name.shellescape, @match, @pattern)\n end", "def remove_print_from_archival_material(ctx)\n if ctx.output_hash.fetch('resource_type', [])\n .include?('Archival and manuscript material') &&\n ctx.output_hash.key?('physical_media')\n ctx.output_hash['physical_media'].delete('Print')\n ctx.output_hash.delete('physical_media') if ctx.output_hash['physical_media'].empty?\n end\n end", "def strip_textile(x)\r\n x = x.gsub(/<.+?>/,'')\r\n x = x.gsub(/\\\"(.*?)\\\":http:\\/\\/([^ ]*)( )?/,'\\1 ') unless x.blank?\r\n x\r\n end", "def cleanup image\n m_begin \"cleanup\"\n img = get_image(image)\n img = img.gaussian_blur(8)\n img = img.threshold((QuantumRange * 0.999).to_int)\n img = img.gaussian_blur(14)\n img = img.threshold(0)\n m_end \"cleanup\"\n set_variable(image, img)\n end", "def uncropped_dynamic_image_tag(record_or_array, options = {})\n dynamic_image_tag(record_or_array, { action: :uncropped }.merge(options))\n end", "def remove_extra_bars(contents)\n\t\t\tcontents = contents.gsub(/\\A\\|/, \"\")\n\t\t\tcontents = contents.gsub(/\\|\\Z/, \"\")\n\t\t\tcontents\n\t\tend", "def tineye_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s, :filepath => image.filename.path, :metadatum => self.specifications_hash.merge(image_options) }\n end.flatten\n end", "def diswimage(image_text)\n image_options = image_text.gsub(/#/, '').gsub(/diswimage:/, '').split(':')\n image_title = image_options[0]\n image_extension = image_options[1]\n option_count = image_options[2]\n image_width = image_options[3]\n return \"!{width: #{image_width}px}http://doitidiot.s3.amazonaws.com/#{image_title}-#{rand(option_count)+1}.#{image_extension}!\"\n end", "def disunity_extract(src: nil)\n end", "def remove_nonprintable!\n replace(remove_nonprintable)\n end", "def contained_attributes\n @images.map(&:attribute).uniq\n end", "def remove_images\n remove_images_from_object(Observation, params)\n end", "def to_s\n image = visible_asteroids\n str = StringIO.new\n image.each do |row|\n line = row.map do |pixel|\n if pixel.nil?\n ''\n else\n pixel.to_i\n end\n end\n str.write(line.join(',') + \"\\n\")\n end\n str.string\n end", "def remove_image #function for attr_writer\n @remove_image || false\n end", "def extract_exif_data\n #if !self.address.blank? && !self.latitude.blank? && !self.longitude.blank? \n if self.address.blank? && !image.blank? \n logger.debug(\"start extract_exif_data\")\n logger.debug(\"session id = #{id}\")\n logger.debug(\"image = #{image}\")\n logger.debug(\"image.url = #{image.url}\")\n logger.debug(\"image.current_path = #{image.current_path}\")\n logger.debug(\"image.identifier = #{image.identifier}\")\n #logger.debug(\"full path to image = #{Rails.root.join(\"public\", image)}\")\n \n logger.debug(\"extract_exif_data debug point a\")\n #img = Magick::Image.read(image)[0] rescue nil\n #img = Magick::Image.read(Rails.root.join(\"public\", image.url))[0]\n img = Magick::Image.read(image.current_path)[0]\n\n logger.debug(\"extract_exif_data debug point aa img = #{img}\")\n\n return unless img\n self.image_created_at = img.get_exif_by_entry('DateTime')[0][1] rescue nil\n\n logger.debug(\"extract_exif_data debug point b\")\n\n img_lat = img.get_exif_by_entry('GPSLatitude')[0][1].split(', ') rescue nil\n logger.debug(\"img_lat = #{img_lat}\")\n img_lng = img.get_exif_by_entry('GPSLongitude')[0][1].split(', ') rescue nil\n logger.debug(\"img_lng = #{img_lng}\")\n\n lat_ref = img.get_exif_by_entry('GPSLatitudeRef')[0][1] rescue nil\n logger.debug(\"lat_ref = #{lat_ref}\")\n lng_ref = img.get_exif_by_entry('GPSLongitudeRef')[0][1] rescue nil\n logger.debug(\"lng_ref = #{lng_ref}\")\n\n alt_ref = img.get_exif_by_entry('GPSAltitudeRef')[0][1] rescue nil\n logger.debug(\"alt_ref = #{alt_ref}\")\n\n logger.debug(\"extract_exif_data debug point c\")\n\n return unless img_lat && img_lng && lat_ref && lng_ref\n\n logger.debug(\"extract_exif_data debug point d\")\n\n latitude = to_frac(img_lat[0]) + (to_frac(img_lat[1])/60) + (to_frac(img_lat[2])/3600)\n longitude = to_frac(img_lng[0]) + (to_frac(img_lng[1])/60) + (to_frac(img_lng[2])/3600)\n\n latitude = latitude * -1 if lat_ref == 'S' # (N is +, S is -)\n longitude = longitude * -1 if lng_ref == 'W' # (W is -, E is +)\n\n self.latitude = latitude\n self.longitude = longitude\n self.altitude = alt_ref\n \n logger.debug(\"extract_exif_data debug point e\")\n\n if geo = Geocoder.search(\"#{latitude},#{longitude}\").first\n #self.city = geo.city\n #self.state = geo.state\n #self.zipcode = geo.postal_code\n logger.debug(\"extract_exif_data debug point f\")\n #self.address = geo.street + \" \" + geo.city\n self.address = geo.address(format = :full)\n logger.debug(\"geocoded address = #{self.address}\")\n end\n logger.debug(\"end extract_exif_data\")\n end # if \n end", "def find_embedded_images\n text = self.fields.values.join(' ')\n matches = text.scan(/ei=([^&]*)/)\n encoded_ids = matches.map(&:first)\n ids = encoded_ids.map { |eid| Base64.urlsafe_decode64(URI.unescape(eid)) }\n EmbeddedImage.includes(:embeddable).find(ids)\n end", "def imagga_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s.gsub('https','http').gsub('-dev',''), :id => image.filename.path, :filepath => image.filename.path, :metadata => self.specifications_hash.merge(image_options) }\n end.flatten\n end", "def crops(image)\n image = image.to_sym\n if images[image][:styles].blank?\n {}\n else\n images[image][:styles].delete_if{|k,v| k == :sample}\n end\n end", "def fixHtmlImageSrcAndKTs(pdf_tmp_html, pdftmp_dir, bkmkrkeeptogether_stylename, logkey='')\n filecontents = File.read(pdf_tmp_html).gsub(/src=\"images\\//,\"src=\\\"#{pdftmp_dir}/\")\n .gsub(/([a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?\\s\\. \\. \\.)/,\"<span class=\\\"#{bkmkrkeeptogether_stylename}\\\">\\\\0</span>\")\n .gsub(/(\\w{5}[.?!])(<\\/p>)/,\"<span class=\\\"#{bkmkrkeeptogether_stylename}\\\">\\\\1</span>\\\\2\")\n return filecontents\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def open_graph_image\n # logger.debug53 \"gift.open_graph_image: open_graph_image = #{read_attribute(:open_graph_image)} (#{read_attribute(:open_graph_image).class.name})\"\n return nil unless (extended_open_graph_image = read_attribute(:open_graph_image))\n encrypt_remove_pre_and_postfix(extended_open_graph_image, 'open_graph_image', 53)\n end", "def no_photo(width, height)\n no_photo_image = part_image.resize_to_fit(width, height)\n create_custom_part(no_photo_image)\n image.to_image\n end", "def image_styles\n nil\n end", "def strip(tags=TagLib::FLAC::File::AllTags)\n end", "def imgify(tweet)\n return tweet\nend", "def remove_image_link_tag\n @caption_node\n .children\n .first\n .content = @caption_node.content.sub(href_regexp, '').strip\n 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 remove_images # :norobots:\n remove_images_from_object(Observation, params)\n end", "def raw_biography\n if self.biography\n Helper.strip_html(self.biography).gsub(/\\s+/, \" \")\n end\n end", "def edit_remove_exif_data(image_file, opts = {})\n data, _status_code, _headers = edit_remove_exif_data_with_http_info(image_file, opts)\n data\n end", "def raw_biography\n if self.biography\n Helper.strip_html(self.biography).gsub(/\\s+/, \" \")\n else\n nil\n end\n end", "def strip() end", "def inspect\n img = []\n @images.each { |image| img << image.inspect }\n img = '[' + img.join(\",\\n\") + \"]\\nscene=#{@scene}\"\n end", "def clean_image_label(label)\n return if label.blank?\n label.gsub(/\\s+/, ' ').gsub(/[_\\-]+/, '_')\n end", "def picdata\n object.imgdata\n end", "def remove_nonprintable\n gsub(/[^[:print:]\\n\\t]/i, '')\n end", "def scanned_prof_image\n scanned_prof\n end", "def epub_html\n edited_html.gsub('img src=\"http://', 'img src=\"https://')\n end", "def rm_patch(c, blr=0, dlt=0)\n b = blr==0 ? '' : \" -blur #{blr*3}x#{blr}\"\n d = dlt==0 ? '' : \" -morphology Dilate Octagon:#{dlt}\"\n read_bytes \"-crop #{c.cropper}#{b}#{d}\"\n end", "def strip_readable_meta ( field = :description )\n self[field].scan(LEWTLedger::MATCH_MULTIPLE_META_REGEX).each do |m|\n self[field].slice!(m).strip!\n end\n end", "def replace_image_tags(xml_text)\n doc = Nokogiri::XML(xml_text)\n doc.xpath(\"//image\").each { |c| c.name = \"seed_image\" }\n return doc.to_xml\n end", "def to_textile\n @emoticons.each do |regexp, image|\n @string.gsub!(Regexp.new(\"(^|\\s)(#{regexp})(\\s|$)\"), \" !#{@options[:images_path]}#{@options[:theme]}/#{image}! \")\n end\n @options[:extras].each do |regexp, image|\n @string.gsub!(Regexp.new(\"(^|\\s)(#{regexp})(\\s|$)\"), \" !#{@options[:images_path]}extras/#{image}! \")\n end\n @string\n end", "def encoded_contents(image_path)\n Base64.encode64(File.read(image_path)).gsub(/\\n/, '')\n end", "def despeckle image\n m_begin \"despeckle\"\n set_variable(image, get_image(image).despeckle)\n m_end \"despeckle\"\n end", "def extract\n case type\n when /jpe?g/i\n extract_jpg\n when /png/i\n extract_png\n end\n metadata.except( *REJECTED_TAGS )\n rescue Errno::ENOENT, Exiftool::ExiftoolNotInstalled, Exiftool::NoSuchFile, Exiftool::NotAFile => e\n raise ExtractionError, \"#{e.class.name}: #{e.message}\"\n end", "def to_tex\n q_url = \"http://dream.misasa.okayama-u.ac.jp/?q=\"\n basename = File.basename(image.name,\".*\")\n lines = []\n lines << \"\\\\begin{overpic}[width=0.49\\\\textwidth]{#{basename}}\"\n lines << \"\\\\put(1,74){\\\\colorbox{white}{(\\\\sublabel{#{basename}}) \\\\href{#{q_url}#{image.global_id}}{#{basename}}}}\"\n lines << \"%%(\\\\subref{#{basename}}) \\\\nolinkurl{#{basename}}\"\n lines << \"\\\\color{red}\"\n\n surface.surface_images.each do |osurface_image|\n oimage = osurface_image.image\n #image_region\n opixels = oimage.spots.map{|spot| [spot.spot_x, spot.spot_y]}\n worlds = oimage.pixel_pairs_on_world(opixels)\n pixels = image.world_pairs_on_pixel(worlds)\n oimage.spots.each_with_index do |spot, idx|\n length = image.length\n height = image.height\n x = \"%.1f\" % (pixels[idx][0] / length * 100)\n y = \"%.1f\" % (height.to_f / length * 100 - pixels[idx][1] / length * 100)\n line = \"\\\\put(#{x},#{y})\"\n line += \"{\\\\footnotesize \\\\circle{0.7} \\\\href{#{q_url}#{spot.target_uid}}{#{spot.name}}}\"\n line += \" % #{spot.target_uid}\" if spot.target_uid\n line += \" % \\\\vs(#{(\"%.1f\" % worlds[idx][0])}, #{(\"%.1f\" % worlds[idx][1])})\"\n lines << line\n end\n end\n\n width_on_stage = image.transform_length(image.width / image.length * 100)\n scale_length_on_stage = 10 ** (Math::log10(width_on_stage).round - 1)\n scale_length_on_image = image.transform_length(scale_length_on_stage, :world2xy).round\n lines << \"%%scale #{(\"%.0f\" % scale_length_on_stage)}\\ micro meter\"\n lines << \"\\\\put(1,1){\\\\line(1,0){#{(\"%.1f\" % scale_length_on_image)}}}\"\n\n lines << \"\\\\end{overpic}\"\n\n lines.join(\"\\n\")\n end", "def extract\n nil\n end", "def strip_attributes\n self.title = self.title.try :strip\n self.url = self.url.try :strip\n self.author = self.author.try :strip\n self.content = self.content.try :strip\n self.summary = self.summary.try :strip\n self.guid = self.guid.try :strip\n end", "def clean_picture_params(params)\n if params[:crop] == true\n params[:crop] = 'crop'\n end\n if params[:image_size]\n params[:size] = params.delete(:image_size)\n end\n secure_attributes = PictureAttributes::SECURE_ATTRIBUTES.dup\n secure_attributes += %w(name format sh)\n params.delete_if { |k, v| !secure_attributes.include?(k.to_s) || v.blank? }\n end", "def alt\n output = self.name\n tags_str = self.photo_tags.collect(&:tag).join(', ')\n output += ' (' + tags_str.strip + ')' if tags_str != ''\n output += tags_str == '' ? self.caption : ': ' + self.caption if self.caption && self.caption != ''\n output += ' - ' + self.location if self.location && self.location != ''\n output\n end", "def image_markup(image)\n render_to_string(\n file: 'bootsy/images/_image',\n formats: [:html],\n locals: { image: image },\n layout: false\n )\n end", "def thumbnails\n manifestation_attachments.reject{|a| a.attachment_type_id != 4}\n end", "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 image_embed\n return unless image\n {\n kind: 'image',\n title: image['url'],\n image: image\n }\n end", "def strip_out_unsupported!(hash)\n hash.each do |key, value|\n delete_key = false\n # delete fhir_comments and primitive extensions\n if key == 'fhir_comments' || key.start_with?('_')\n delete_key = true\n elsif value.is_a?(Array)\n value.each do |thing|\n strip_out_unsupported!(thing) if thing.is_a?(Hash)\n end\n elsif value.is_a?(Hash)\n strip_out_unsupported!(value)\n delete_key = value.empty?\n end\n hash.delete(key) if delete_key\n end\n end", "def strip!() end", "def get_extras(hash, node, data)\n hash[\"body\"] = get_body(hash[\"url\"], data[\"body\"])\n hash[\"body\"] = hash[\"body\"].gsub(/[^a-zA-Z0-9\\- ]/,\"\") if (hash[\"body\"] != nil)\n hash[\"tags\"] = Array.new\n hash[\"tags\"] = fetch_tags(hash[\"url\"], data[\"tags\"]) if data[\"tags\"].last\n hash[\"url\"] = fetch_url(node.to_s) if data[\"special\"]\n aux = data[\"image\"]\n if aux != nil\n hash[\"image\"] = get_image(hash[\"url\"], aux) unless aux[0] == 0\n else\n hash[\"image\"] = \"\"\n end\n hash[\"image\"] = get_any_image(hash[\"url\"]) if hash[\"image\"] == \"\"\n hash\n end" ]
[ "0.69986516", "0.6768036", "0.67400396", "0.647024", "0.644995", "0.61613864", "0.61322", "0.6118278", "0.6118278", "0.6078184", "0.6046694", "0.6046694", "0.5960892", "0.5846377", "0.58142626", "0.57525516", "0.5724875", "0.56473404", "0.56445885", "0.5624613", "0.55714035", "0.55712736", "0.5516425", "0.5492868", "0.54878604", "0.5485231", "0.5473018", "0.54319537", "0.54023975", "0.5392798", "0.5392798", "0.5384539", "0.5375684", "0.533675", "0.5329174", "0.53218836", "0.52993953", "0.52579343", "0.5254357", "0.5253555", "0.5251201", "0.52491987", "0.5246744", "0.52441573", "0.5237467", "0.52199805", "0.5196241", "0.51921135", "0.51810354", "0.5159177", "0.51424474", "0.51376635", "0.513619", "0.5120011", "0.5107111", "0.5095884", "0.5086567", "0.5079721", "0.50783217", "0.5068947", "0.5065607", "0.5064452", "0.5057265", "0.50506467", "0.5039419", "0.50372934", "0.5036711", "0.5036711", "0.503006", "0.50285363", "0.50226885", "0.50174636", "0.50090826", "0.50071436", "0.4995028", "0.496646", "0.4962375", "0.49589214", "0.49558106", "0.4954092", "0.4942587", "0.49379775", "0.49321336", "0.49267146", "0.49203047", "0.49188426", "0.49118137", "0.4906833", "0.4903817", "0.4899088", "0.4897121", "0.48960093", "0.48924938", "0.48924696", "0.48924688", "0.4887133", "0.48860082", "0.48858523" ]
0.60906154
10
Rotates the image based on the EXIF Orientation
def fix_exif_rotation manipulate! do |img| img.auto_orient img = yield(img) if block_given? img end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_exif_rotation\n manipulate! do |img|\n img.tap(&:auto_orient)\n end\n end", "def fix_exif_rotation\n return unless self.file.content_type.start_with? 'image'\n \n manipulate! do |img|\n img.tap(&:auto_orient)\n img = yield(img) if block_given?\n img\n end\n end", "def fix_exif_rotation\n manipulate! do |img|\n img.auto_orient\n img = yield(img) if block_given?\n img\n end\n end", "def auto_orient\n manipulate! do |image|\n o = image.get('exif-Orientation').to_i rescue nil\n o ||= image.get('exif-ifd0-Orientation').to_i rescue 1\n case o\n when 1\n # Do nothing, everything is peachy\n when 6\n image.rot270\n when 8\n image.rot180\n when 3\n image.rot90\n else\n raise('Invalid value for Orientation: ' + o.to_s)\n end\n image.set('exif-Orientation', '')\n image.set('exif-ifd0-Orientation', '')\n end\n end", "def auto_orient\n manipulate! do |image|\n o = image.get('exif-Orientation').to_i rescue nil\n o ||= image.get('exif-ifd0-Orientation').to_i rescue 1\n case o\n when 1\n # Do nothing, everything is peachy\n when 6\n image.rot270\n when 8\n image.rot180\n when 3\n image.rot90\n else\n raise('Invalid value for Orientation: ' + o.to_s)\n end\n image.set_type GObject::GSTR_TYPE, 'exif-Orientation', ''\n image.set_type GObject::GSTR_TYPE, 'exif-ifd0-Orientation', ''\n end\n end", "def rotate_image(image)\n\nend", "def rotate\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.rotate(90)\n img.write('public' + @photo.attachment_url)\n end", "def orientation(img)\n (img.rows > img.columns) ? \"landscape\" : \"portrait\"\n end", "def rotate angle\n position = \"#{@placement[:s]}x#{@placement[:s]}+#{@placement[:x]}+#{@placement[:y]}\"\n @image.run_command(\"convert\", @image.path, \"-rotate #{360 - angle}\", @image.path)\n @image.run_command(\"convert\", @image.path, \"-gravity Center -crop #{position}\", @image.path)\n end", "def rotated\n RawImage.new(@image.getRotated())\n end", "def checkrotation(filepath)\n\t# rotate if needed - normally these are 300 wide by 419 high\n\timg = Magick::Image.read(filepath).first\n\n\tif(img.columns > img.rows) # too wide so rotate left\n\t\timg.rotate!(-90)\n\t\timg.write(filepath)\n\tend\t\nend", "def rotate(degrees)\n rsp = @flickr.send_request('flickr.photos.transform.rotate', {:photo_id => self.id, :degrees => degrees}, :post)\n true\n end", "def auto_orient\n manipulate! do |img|\n img.auto_orient\n img\n end\n end", "def rotate image, angle, outimage=nil\n m_begin \"rotate\"\n img = get_image(image)\n if false\n rotated = img.rotate(angle)\n else\n#\n# from newsgroup: The alternative way to rotate is to use -filter point +distort SRT {angle} +repage\n#\n rotated = img.resize(img.columns, img.rows, PointFilter)\n rotated = img.distort(ScaleRotateTranslateDistortion, [angle])\n end\n outimage = image if outimage.nil?\n put_image(outimage, rotated)\n m_end \"rotate\"\n end", "def rotate( deg )\n set_base_image( base_image.rotate( deg ) )\n end", "def normalize_rotation(driver, image, rotation)\n return if rotation && rotation.zero?\n\n num_quadrants = 0\n if !rotation.nil?\n if (rotation % RIGHT_ANGLE).nonzero?\n raise Applitools::EyesError.new('Currently only quadrant rotations are supported. Current rotation: '\\\n \"#{rotation}\")\n end\n num_quadrants = (rotation / RIGHT_ANGLE).to_i\n elsif rotation.nil? && driver.mobile_device? && driver.landscape_orientation? && image.height > image.width\n # For Android, we need to rotate images to the right, and for iOS to the left.\n num_quadrants = driver.android? ? 1 : -1\n end\n\n Applitools::Utils::ImageUtils.quadrant_rotate!(image, num_quadrants)\n end", "def auto_orient\n manipulate! do |image|\n image.tap(&:auto_orient)\n end\n end", "def auto_orient\n manipulate! do |image|\n image.tap(&:auto_orient)\n end\n end", "def auto_orient\n manipulate! do |image|\n image.tap(&:auto_orient)\n end\n end", "def rotateAndFlip(image)\n return image.transpose.flip\nend", "def auto_orient\n manipulate! do |image|\n image.auto_orient\n image\n end\n end", "def rotate_image_right!(albid, imgid)\n img = image(albid, imgid)\n IMagick.rotate_right(_(img[:path]))\n IMagick.rotate_right(_(img[:thumb]))\n true\n end", "def rotate_right!\n @picture.rotate_right!\n end", "def auto_orient\n \tmanipulate! do |img|\n img.auto_orient\n img = yield(img) if block_given?\n img\n end\n end", "def rotate_flip_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def test_rotate\n assert_equal :portrait, @driver.orientation\n\n @@core.wait do\n @driver.rotation = :landscape\n assert_equal :landscape, @driver.orientation\n end\n\n @@core.wait do\n @driver.rotation = :portrait\n assert_equal :portrait, @driver.orientation\n end\n end", "def transplant_exif(name)\n Jhead.call(\"-te\", name.shellescape, @match, @pattern)\n end", "def orient_patch\n rotmat = CVFFI::CvMat.new CVFFI::cvCreateMat( 2,3, :CV_32F )\n CVFFI::cv2DRotationMatrix( CVFFI::CvPoint2D32f.new( [ @patch.width/2.0, @patch.height/2.0 ]), -@angle*180.0/Math::PI, 1.0, rotmat )\n\n dstimg = @patch.twin\n CVFFI::cvWarpAffine( @patch, dstimg, rotmat )\n\n dstimg \n end", "def transform\n if rotate\n \"rotate(#{rotate},#{x},#{y})\"\n else\n nil\n end\n end", "def r90; self.rotation = 'fa-rotate-90'; self; end", "def rotate_image_left!(albid, imgid)\n img = image(albid, imgid)\n IMagick.rotate_left(_(img[:path]))\n IMagick.rotate_left(_(img[:thumb]))\n true\n end", "def auto_orient\n # debugger\n manipulate! do |img, index, options|\n # options[:write] = {\n # :quality => 100,\n # :depth => 8\n # }\n img = img.auto_orient\n end\n end", "def generic_rotate90(image)\n # Rotates a square image 90 degrees clockwise.\n d = image.length\n new_image = d.times.map { \"x\"*d }\n (0...d).each do |r|\n (0...d).each do |c|\n new_image[c][d-1-r] = image[r][c]\n end\n end\n new_image\nend", "def rotate_left!\n @picture.rotate_left!\n end", "def rotate(angle_or_direction)\n case angle_or_direction\n when :left\n radian = -90.degrees\n when :right\n radian = 90.degrees\n when :flip\n radian = 180.degrees\n when Numeric\n radian = angle_or_direction\n else\n raise \"Unknown angle/direction #{angle_or_direction.inspect}\"\n end\n\n w = (self.size.width * Math.cos(radian)).abs + (self.size.height * Math.sin(radian)).abs\n h = (self.size.height * Math.cos(radian)).abs + (self.size.width * Math.sin(radian)).abs\n new_size = CGSize.new(w, h)\n new_size = self.size\n\n # Create the bitmap context\n UIGraphicsBeginImageContext(new_size)\n bitmap = UIGraphicsGetCurrentContext()\n\n # Move the origin to the middle of the image so we will rotate and scale around the center.\n CGContextTranslateCTM(bitmap, new_size.width / 2, new_size.height / 2)\n\n # Rotate the image context\n CGContextRotateCTM(bitmap, radian)\n\n # otherwise it'll be upside down:\n CGContextScaleCTM(bitmap, 1.0, -1.0)\n # Now, draw the rotated/scaled image into the context\n CGContextDrawImage(bitmap, CGRectMake(-new_size.width / 2, -new_size.height / 2, new_size.width, new_size.height), self.CGImage)\n\n new_image = UIGraphicsGetImageFromCurrentImageContext()\n UIGraphicsEndImageContext()\n return new_image\n end", "def rotate(angle_or_direction)\n case angle_or_direction\n when :left\n radian = -90.degrees\n when :right\n radian = 90.degrees\n when :flip\n radian = 180.degrees\n when Numeric\n radian = angle_or_direction\n else\n raise \"Unknown angle/direction #{angle_or_direction.inspect}\"\n end\n\n w = (self.size.width * Math.cos(radian)).abs + (self.size.height * Math.sin(radian)).abs\n h = (self.size.height * Math.cos(radian)).abs + (self.size.width * Math.sin(radian)).abs\n new_size = CGSize.new(w, h)\n new_size = self.size\n\n # Create the bitmap context\n UIGraphicsBeginImageContextWithOptions(new_size, false, self.scale)\n bitmap = UIGraphicsGetCurrentContext()\n\n # Move the origin to the middle of the image so we will rotate and scale around the center.\n CGContextTranslateCTM(bitmap, new_size.width / 2, new_size.height / 2)\n\n # Rotate the image context\n CGContextRotateCTM(bitmap, radian)\n\n # otherwise it'll be upside down:\n CGContextScaleCTM(bitmap, 1.0, -1.0)\n # Now, draw the rotated/scaled image into the context\n CGContextDrawImage(bitmap, CGRectMake(-new_size.width / 2, -new_size.height / 2, new_size.width, new_size.height), self.CGImage)\n\n new_image = UIGraphicsGetImageFromCurrentImageContext()\n UIGraphicsEndImageContext()\n return new_image\n end", "def run_examination\n if stream.missing?\n @original_width, @original_height = 1, 1\n false\n else\n output = `identify -format \"%w %h %[exif:Orientation]\" #{stream.path} 2> /dev/null`\n if $?.success? && output.present?\n width, height, orientation = *output.scan(/(\\d+) (\\d+) (\\d?)/).first.map{|s| s.to_i}\n rotated = (5..8).include?(orientation)\n @original_width = rotated ? height : width\n @original_height = rotated ? width : height\n true\n else\n Bulldog.logger.warn \"command failed (#{$?.exitstatus})\"\n @original_width, @original_height = 1, 1\n false\n end\n end\n end", "def rotate direction\n @listing = Listing.has_permission(current_user).find(params[:listing_id])\n\n begin\n @listing_image = @listing.listing_images.find(params[:id])\n @listing_image.rotate direction\n flash[:notice] = t('alert.image_successfully_updated')\n flash.keep(:notice)\n rescue Mongoid::Errors::DocumentNotFound\n # a listing image must be found to be rotated\n end\n\n respond_to do |format|\n # pretty ugly, huh? For now it is the best way to just refresh\n # the page when the image is changed.\n format.js { render js: \"window.location.reload();\" }\n format.html { redirect_to(listing_images_url(@listing)) }\n end\n end", "def zrotation\n end", "def set_portrait\n @orientation = 1\n end", "def rotate_180!\n pixels.reverse!\n self\n end", "def setOrientation(orientation)\n unless /(?i)^(landscape|portrait)$/.match(orientation)\n raise Error.new(Pdfcrowd.create_invalid_value_message(orientation, \"setOrientation\", \"image-to-image\", \"Allowed values are landscape, portrait.\", \"set_orientation\"), 470);\n end\n \n @fields['orientation'] = orientation\n self\n end", "def rotate!(angle, axis_x = width / 2.0, axis_y = height / 2.0)\n ptr = self.class.create_image_ptr(width, height, alpha_blending?)\n ::GD2::GD2FFI.send(:gdImageCopyRotated, ptr, image_ptr, axis_x.to_f, axis_y.to_f, 0, 0, width.to_i, height.to_i, angle.to_degrees.round.to_i)\n init_with_image(ptr)\n end", "def get_rotation\n return @rotation\n end", "def required_rotation_for_upright_display\n required_rotation_orientation_in_degrees = (360 - self.orientation) % 360\n return required_rotation_orientation_in_degrees\n end", "def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\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", "def transform(operator)\n case operator\n when :rotate_left then operator = \"-90\"\n when :rotate_right then operator = \"+90\"\n when :mirror then operator = \"-h\"\n else\n raise(\"Invalid transform operator: #{operator.inspect}\")\n end\n system(\"script/rotate_image #{id} #{operator}&\") unless Rails.env.test?\n end", "def format_exif(exif)\n exif.reject! { |key,value| (key.eql? \"id\") || (value == 0.0) || (value.blank?) }\n\t \n exif.each_pair { |key,value| \n new_key = key.to_s.dup\n new_key.gsub!(\"_\", \" \")\n new_key.capitalize!\n\n if new_key.eql? \"Shot date time\"\n new_value = @asset.exif.shot_date_time.strftime(\"%d %b %Y %H:%M\")\n else\n new_value = value.to_s.dup\n end\n\n exif.delete(key)\n exif.store(new_key, new_value) }\n \n return exif\n end", "def create_rotation\n end", "def orientation\n if landscape?\n :landscape\n elsif portrait?\n :portrait\n else\n :square\n end\n end", "def rotated_90_cw\n dst = Image.new(width: height, height: width, bpp: bpp)\n each_pixel do |c,x,y|\n dst[y,width-x-1] = c\n end\n dst\n end", "def rot270\n rot :d270\n end", "def transform_image\n pass_query_params\n image = find_or_goto_index(Image, params[:id].to_s)\n return unless image\n\n if check_permission!(image)\n case params[:op]\n when \"rotate_left\"\n image.transform(:rotate_left)\n flash_notice(:image_show_transform_note.t)\n when \"rotate_right\"\n image.transform(:rotate_right)\n flash_notice(:image_show_transform_note.t)\n when \"mirror\"\n image.transform(:mirror)\n flash_notice(:image_show_transform_note.t)\n else\n flash_error(\"Invalid operation #{params[:op].inspect}\")\n end\n end\n if params[:size].blank? ||\n params[:size].to_sym == (@user ? @user.image_size : :medium)\n redirect_with_query(action: \"show_image\", id: image)\n else\n redirect_with_query(action: \"show_image\", id: image,\n size: params[:size])\n end\n end", "def landscape_format?\n return (self.image_width > self.image_height) ? true : false\n end", "def set_landscape\n @orientation = 0\n end", "def rotate(angle, around_x=0, around_y=0, &rendering_code); end", "def delete_exif\n Jhead.call(\"-de\", @match, @pattern)\n end", "def will_animate_rotate(orientation, duration)\n reapply_styles\n end", "def will_animate_rotate(orientation, duration)\n reapply_styles\n end", "def will_animate_rotate(orientation, duration)\n reapply_styles\n end", "def image_to_exif(image_path)\n if image_path.match(/\\.jp(e)?g/)\n return EXIFR::JPEG.new(image_path)\n else\n return EXIFR::TIFF.new(image_path)\n end\n end", "def auto_orient!(image)\n with_minimagick(image) do |img|\n img.combine_options do |cmd|\n yield cmd if block_given?\n cmd.auto_orient\n end\n end\n end", "def rotate(direction)\n #possible states\n orientations = [\"N\",\"E\",\"S\",\"W\"]\n currentOrientation = orientations.index(@name)\n case direction\n when \"l\"\n newOrientation = (currentOrientation - 1)%4\n set(orientations[newOrientation])\n when \"r\"\n newOrientation = (currentOrientation + 1)%4\n set(orientations[newOrientation])\n else\n # TODO: Exception\n end\n\n end", "def create_rotate_flipped_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end", "def rotate_picture(picture)\n (0...$PICTURE_SIZE).map do |i|\n ((0...$PICTURE_SIZE).map do |j|\n picture[j].chars[$PICTURE_SIZE - 1 - i]\n end).join\n end\nend", "def transform_image # :norobots:\n pass_query_params\n if image = find_or_goto_index(Image, params[:id].to_s)\n if check_permission!(image)\n if params[:op] == 'rotate_left'\n image.transform(:rotate_left)\n flash_notice(:image_show_transform_note.t)\n elsif params[:op] == 'rotate_right'\n image.transform(:rotate_right)\n flash_notice(:image_show_transform_note.t)\n elsif params[:op] == 'mirror'\n image.transform(:mirror)\n flash_notice(:image_show_transform_note.t)\n else\n flash_error(\"Invalid operation #{params[:op].inspect}\")\n end\n end\n if params[:size].blank? or\n params[:size].to_sym == (@user ? @user.image_size : :medium)\n redirect_to(:action => 'show_image', :id => image, :params => query_params)\n else\n redirect_to(:action => 'show_image', :id => image, :params => query_params,\n :size => params[:size])\n end\n end\n end", "def landscape?; end", "def rotate(n = 1)\n Orientation.new(ORIENTATIONS.index((@angle + n) % ORIENTATIONS.count))\n end", "def orientation_name\n return Orientation::PORTRAIT if size[0] < size[1]\n return Orientation::LANDSCAPE\n end", "def extract_exif_from_image(image)\n filename = File.basename(image)\n latitude = ''\n longitude = ''\n object = EXIFR::JPEG.new(image)\n\n unless object.gps.nil?\n latitude = object.gps.latitude\n longitude = object.gps.longitude\n end\n\n write_to_csv(filename, latitude, longitude)\nend", "def flip\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.flip!\n img.write('public' + @photo.attachment_url)\n end", "def deskew_angle(img)\n temp = Tempfile.new 'split-subjects-vertically'\n sample = img.clone\n # inset crop 10% from borders:\n sample_inset = 0.10\n sample.crop! img.columns * sample_inset, img.rows * sample_inset, img.columns - (img.columns * 2 * sample_inset), img.rows - (img.rows * 2 * sample_inset)\n sample.write temp.path\n sample.write \"temp.sample.jpg\"\n angle = `convert #{temp.path} -deskew 40 -format '%[deskew:angle]' info:`.to_f\n # If angle is greater than this, it's probably an error\n angle.abs >= 2 ? 0 : angle\nend", "def setOrientation(orientation)\n unless /(?i)^(landscape|portrait)$/.match(orientation)\n raise Error.new(Pdfcrowd.create_invalid_value_message(orientation, \"setOrientation\", \"image-to-pdf\", \"Allowed values are landscape, portrait.\", \"set_orientation\"), 470);\n end\n \n @fields['orientation'] = orientation\n self\n end", "def rot180\n rot :d180\n end", "def make_exif(thumbnail = false)\n option = thumbnail ? \"-mkexif -rgt\" : \"-mkexif\"\n Jhead.call(option, @match, @pattern)\n end", "def rot90\n rot :d90\n end", "def edit_rotate(degrees, image_file, opts = {})\n data, _status_code, _headers = edit_rotate_with_http_info(degrees, image_file, opts)\n data\n end", "def rotate_image(arr)\n last_index = arr.size - 1\n\n # i will essentially act as our layer\n i = 0\n while i < (arr.size / 2)\n \n # column index, j, which should always start at the same index as the layer\n # to avoid moving outer-layer elements\n j = i\n\n # this makes sure j never iterates over the last element in the layer, because\n # it will have already been rotated from the first rotation in that layer\n # NOTE: this mistake can best be shown in a 5x5 or larger, if we forgot this\n layer_offset = last_index - i\n\n while j < (layer_offset) # last_index = arr[i].size - 1 because the array is square\n # debugger\n\n # store the value in the top row\n stored = arr[i][j]\n\n # rotate left to top\n arr[i][j] = arr[last_index - j][i]\n\n # rotate bottom to left\n arr[last_index - j][i] = arr[layer_offset][last_index - j]\n\n # rotate right to bottom\n arr[layer_offset][last_index - j] = arr[j][layer_offset]\n\n # rotate top to right by replacing right with stored\n arr[j][layer_offset] = stored\n\n j += 1\n end\n \n i += 1\n end\n\n # The submission code shouldn't include this, this is just to visualize the result\n p \"#{arr.size}x#{arr.size} Rotated Matrix\"\n arr.each do |row|\n p row\n end\nend", "def orientation \n @position - @prev_position\n end", "def view_exif(id = 0, exifparam =\"\")\n init_rcimg if @recent_image_hash == nil or @recent_image_hash.length == 0\n\n begin\n @image_date_exif ||= @date.strftime(\"%Y%m%d\")\n @exifparser = ExifParser.new(%Q[#{@image_dir}/#{@recent_image_hash[@image_date_exif+\"_\"+id.to_s].file}].untaint)\n\n if exifparam == \"\" # return a formatted string.\n model = @exifparser['Model'].to_s\n focallength = @exifparser['FocalLength'].to_s\n fnumber = @exifparser['FNumber'].to_s\n exposuretime = @exifparser['ExposureTime'].to_s\n isospeedratings = @exifparser['ISOSpeedRatings'].to_s\n exposurebiasvalue = @exifparser['ExposureBiasValue'].to_s\n if @exifparser.tag?('LensParameters')\n lensname = \"(\"+ @exifparser['LensParameters'].to_s + \")\"\n else\n lensname = \"\"\n end\n return %Q[<div class=\"exifdatastr\"><p>#{model}, #{focallength}, #{fnumber}, #{exposuretime}, ISO#{isospeedratings}, #{exposurebiasvalue}EV #{lensname}</p></div>]\n else # return the requested value.\n return @exifparser[exifparam.untaint].to_s\n end\n\n rescue\n exp = ($!).to_s + \"<br>\"\n ($!).backtrace.each do |btinfo|\n exp += btinfo\n exp += \"<br>\"\n end\n return exp\n end\nend", "def will_animate_rotate(orientation, duration)\n find.all.reapply_styles\n end", "def will_animate_rotate(orientation, duration)\n find.all.reapply_styles\n end", "def will_animate_rotate(orientation, duration)\n find.all.reapply_styles\n end", "def will_animate_rotate(orientation, duration)\n find.all.reapply_styles\n end", "def will_animate_rotate(orientation, duration)\n find.all.reapply_styles\n end", "def will_animate_rotate(orientation, duration)\n find.all.reapply_styles\n end", "def exif_data\n Exiftool.new(@source, '-a -g1').to_hash\n end", "def portrait?; end", "def show\n @rotation = params[:id]\n if @rotation.blank? || @rotation.to_i.to_s != @rotation || Rotation.find_by_id(@rotation.to_i).nil?\n redirect_to medium_url(@medium)\n else\n respond_to do |format|\n format.html # show.html.erb\n format.jpg do\n image = Magick::Image.read(@medium.thumbnail_image.full_filename).first.rotate((360 - @medium.rotation.to_i + @rotation.to_i) % 360)\n send_data image.to_blob, :filename => \"#{@rotation}.jpg\", :disposition => 'inline', :type => 'image/jpeg'\n end\n end\n end\n end", "def rotation\n {\n axis: @r[0],\n angle: @r[1],\n matrix: @r[2]\n }\n end", "def setup_rotation\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 4\n @angle = @acts[1]\n change_angle(@acts[2], @acts[3])\n end", "def update\n authorize! :update, :avatar\n contact = Contact.find(params[:contact_id])\n \n case params[:update_action]\n when \"rotateCW\"\n contact.avatar.rotate(90)\n when \"rotateACW\"\n contact.avatar.rotate(-90)\n end\n\n if contact.save validate: false\n # recreate versions so the thumb matches the rotated image\n # this reuploads the image, but it is currently the only\n # way to assure that the thumbnail is updated \n contact.avatar.recreate_versions!\n render :json => \"OK\"\n else\n render :json => { \n :message => \"Sorry, avatar could not be updated\",\n :errors => contact.errors\n }.to_json, :status => 400\n end\n end", "def rotate_encryption!\n io = Lockbox::IO.new(read)\n io.original_filename = file.filename\n previous_value = enable_processing\n begin\n self.enable_processing = false\n store!(io)\n ensure\n self.enable_processing = previous_value\n end\n end", "def extract_exif_data\n #if !self.address.blank? && !self.latitude.blank? && !self.longitude.blank? \n if self.address.blank? && !image.blank? \n logger.debug(\"start extract_exif_data\")\n logger.debug(\"session id = #{id}\")\n logger.debug(\"image = #{image}\")\n logger.debug(\"image.url = #{image.url}\")\n logger.debug(\"image.current_path = #{image.current_path}\")\n logger.debug(\"image.identifier = #{image.identifier}\")\n #logger.debug(\"full path to image = #{Rails.root.join(\"public\", image)}\")\n \n logger.debug(\"extract_exif_data debug point a\")\n #img = Magick::Image.read(image)[0] rescue nil\n #img = Magick::Image.read(Rails.root.join(\"public\", image.url))[0]\n img = Magick::Image.read(image.current_path)[0]\n\n logger.debug(\"extract_exif_data debug point aa img = #{img}\")\n\n return unless img\n self.image_created_at = img.get_exif_by_entry('DateTime')[0][1] rescue nil\n\n logger.debug(\"extract_exif_data debug point b\")\n\n img_lat = img.get_exif_by_entry('GPSLatitude')[0][1].split(', ') rescue nil\n logger.debug(\"img_lat = #{img_lat}\")\n img_lng = img.get_exif_by_entry('GPSLongitude')[0][1].split(', ') rescue nil\n logger.debug(\"img_lng = #{img_lng}\")\n\n lat_ref = img.get_exif_by_entry('GPSLatitudeRef')[0][1] rescue nil\n logger.debug(\"lat_ref = #{lat_ref}\")\n lng_ref = img.get_exif_by_entry('GPSLongitudeRef')[0][1] rescue nil\n logger.debug(\"lng_ref = #{lng_ref}\")\n\n alt_ref = img.get_exif_by_entry('GPSAltitudeRef')[0][1] rescue nil\n logger.debug(\"alt_ref = #{alt_ref}\")\n\n logger.debug(\"extract_exif_data debug point c\")\n\n return unless img_lat && img_lng && lat_ref && lng_ref\n\n logger.debug(\"extract_exif_data debug point d\")\n\n latitude = to_frac(img_lat[0]) + (to_frac(img_lat[1])/60) + (to_frac(img_lat[2])/3600)\n longitude = to_frac(img_lng[0]) + (to_frac(img_lng[1])/60) + (to_frac(img_lng[2])/3600)\n\n latitude = latitude * -1 if lat_ref == 'S' # (N is +, S is -)\n longitude = longitude * -1 if lng_ref == 'W' # (W is -, E is +)\n\n self.latitude = latitude\n self.longitude = longitude\n self.altitude = alt_ref\n \n logger.debug(\"extract_exif_data debug point e\")\n\n if geo = Geocoder.search(\"#{latitude},#{longitude}\").first\n #self.city = geo.city\n #self.state = geo.state\n #self.zipcode = geo.postal_code\n logger.debug(\"extract_exif_data debug point f\")\n #self.address = geo.street + \" \" + geo.city\n self.address = geo.address(format = :full)\n logger.debug(\"geocoded address = #{self.address}\")\n end\n logger.debug(\"end extract_exif_data\")\n end # if \n end", "def getCurrentRotation\n rotx = @@componentInstance.transformation.rotx\n roty = @@componentInstance.transformation.roty\n rotz = @@componentInstance.transformation.rotz\n\n rotation = []\n rotation << rotx\n rotation << roty\n rotation << rotz\n rotation\n end", "def calculate_orientation\n x, y = @components.values\n if x.pos? and y.zero?\n 0.deg\n elsif x.zero? and y.pos?\n 90.deg\n elsif x.neg? and y.zero?\n 180.deg\n elsif x.zero? and y.neg?\n 270.deg\n elsif x.pos? and y.pos?\n Math.atan( y/x ).rad # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.pos?\n angle = Math.atan( y/x.abs ).rad\n (180 - angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.neg?\n angle = Math.atan( y.abs/x.abs ).rad\n (180 + angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.pos? and y.neg?\n angle = Math.atan( y.abs/x ).rad\n (360 - angle.deg).deg\n end\n end", "def extract_exif_from_images(images)\n images.each { |image| extract_exif_from_image image }\nend", "def logrotated?(file)\n end" ]
[ "0.7754857", "0.7740966", "0.76978165", "0.7362087", "0.72326785", "0.71300775", "0.698376", "0.66120464", "0.64729464", "0.6399693", "0.63220435", "0.6226592", "0.6119372", "0.6107671", "0.6032383", "0.6016191", "0.5884359", "0.5884359", "0.5884359", "0.5880022", "0.5870346", "0.5863589", "0.5765785", "0.57612175", "0.5718879", "0.5662128", "0.5610276", "0.5606619", "0.5598155", "0.55970204", "0.5595973", "0.55924875", "0.5592308", "0.5557262", "0.55372924", "0.55368674", "0.551109", "0.54996604", "0.5496292", "0.5475523", "0.54729277", "0.54539424", "0.54505825", "0.5428675", "0.5417825", "0.53819156", "0.5381733", "0.53723454", "0.53668237", "0.53592914", "0.5343487", "0.53150725", "0.530882", "0.5302796", "0.5295565", "0.5293974", "0.5289852", "0.5289801", "0.5271154", "0.5271154", "0.5271154", "0.52623284", "0.5253538", "0.5243887", "0.5231275", "0.521559", "0.5206896", "0.5193566", "0.51833546", "0.5162171", "0.5155555", "0.5144356", "0.51111156", "0.5103829", "0.510296", "0.5096235", "0.5094826", "0.50791746", "0.5068965", "0.50629723", "0.5059976", "0.50524133", "0.50524133", "0.50524133", "0.50524133", "0.50524133", "0.5050335", "0.5009905", "0.49944648", "0.49745917", "0.4957779", "0.4953481", "0.4947459", "0.494432", "0.49424577", "0.49403232", "0.49371472", "0.49341133", "0.4927422" ]
0.7767189
0
set the Interlace of the image plane/basic
def interlace(type) manipulate! do |img| img.interlace(type.to_s) img = yield(img) if block_given? img end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interlace\n manipulate! do |img|\n img.strip\n img.combine_options do |c|\n c.quality \"80\"\n c.depth \"8\"\n c.interlace \"plane\"\n end\n img\n end\n end", "def interlaced=(bool)\n ::GD2::GD2FFI.send(:gdImageInterlace, image_ptr, bool ? 1 : 0)\n end", "def initialize\n @x\n @y\n @facing\n @placed = false\n end", "def init_oripost\n @ori_x = original_x\n @ori_y = original_y\n end", "def project_to_plane\n end", "def set_plane_picture\n @plane_picture = PlanePicture.find(params[:id])\n end", "def initilize land_planes=[] #collection of planes\n\t\t@land_planes = land_planes\n\tend", "def setup_add_plane\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 3\n file = @acts[1]\n sox = @acts[2] # Scroll X\n soy = @acts[3] # Scroll Y \n z = (@acts[4] ? Graphics.height + 10 : 4)\n dur = @acts[5] || 2\n opac = @acts[6] || 255\n get_spriteset.battle_plane.set(file,sox,soy,z,dur,opac)\n end", "def interlace_option(x, y, extension = nil)\n return \"\" if extension == 'gif'\n x.to_i * y.to_i > 80 * 80 ? \"-interlace plane\" : \"\"\n end", "def setHorizonParallaxCoef _args\n \"setHorizonParallaxCoef _args;\" \n end", "def set_board_pin_mode\n\n @axis_x.set_pin_mode()\n @axis_y.set_pin_mode()\n @axis_z.set_pin_mode()\n\n end", "def update_position\n case @picture.info[:map_mode]\n when 1\n self.x = -$game_map.display_x * 32 + @picture.xo\n self.y = -$game_map.display_y * 32 + @picture.yo\n when 2\n self.x = -$game_map.display_x * 32\n self.y = -$game_map.display_y * 32\n else\n self.x = self.y = 0\n end\n self.z = @picture.info[:z] ? @picture.info[:z] : 100\n end", "def modify_image\n if @vertical\n @main_image = @main_image.zooming_v\n else\n @main_image = @main_image.zooming_h\n end\n end", "def update!(**args)\n @deinterlace_all_frames = args[:deinterlace_all_frames] if args.key?(:deinterlace_all_frames)\n @disable_spatial_interlacing = args[:disable_spatial_interlacing] if args.key?(:disable_spatial_interlacing)\n @mode = args[:mode] if args.key?(:mode)\n @parity = args[:parity] if args.key?(:parity)\n end", "def set_necklace\n @necklace = Necklace.find(params[:id])\n end", "def setup\n size 640, 360, P3D\n @img = load_image 'berlin-1.jpg'\n no_stroke\nend", "def initialize(imageName,dimension,precision)\n\t\t@origine = Image.read(imageName).first.resize_to_fill(dimension,dimension)\n\t\t@indicesLigne = []\n\t\t@indicesColonne = []\n\t\t@precision = precision\n\t\t@dimension = dimension\n\t\tcalcIndice\n\tend", "def plane\n end", "def update_zvect\n return unless GTBS::PROJECTILE_CAM\n zvect = Math::sin(@index/@div.to_f)\n $game_map.set_display_pos($game_map.display_x, @base_y - (zvect * @high/2))\n end", "def markOrigin(ox, oy, oz)\n t = df.map_tile_at(ox, oy, oz)\n if t then\n s = t.shape_basic\n #TODO: preseve designation:\n #$originTile = t.designation # a global to store the original origin state\n #puts \"origin: #{$originTile}\"\n t.dig(:Default) if s == :Wall\n end\nend", "def setup\n size 200, 200\n @a = load_image 'construct.jpg'\n @b = load_image 'wash.jpg'\n @offset = 0.0\nend", "def define_axes!\n\t\tsouth_neighbor, east_neighbor = northwest_corner.all_possible_neighbors\n\n\t\teast_edge = northwest_corner.matching_edge east_neighbor\n\t\tnorthwest_corner.orient! :east, east_edge\n\t\teast_neighbor.orient! :west, east_edge.reverse\n\t\t@tile_layout[0][1] = east_neighbor\n\n\t\tsouth_neighbor.orient! :north, northwest_corner.south_edge.reverse\n\t\t@tile_layout[1][0] = south_neighbor\n\tend", "def add_plane()\n planes << Plane.new(\n gen_location,\n 0,\n width,\n height,\n gen_speed(),\n true\n )\n end", "def set_orbit\n @orbit = Orbit.find(params[:id])\n end", "def add_parallax_layer options\n @parallax << {:image => options[:image],:damping => options[:damping],:zorder => options[:z],:color => options[:color]}\n @parallaxlayers << options\n end", "def active_section_plane=(sec_plane)\n end", "def set_planet\n end", "def update(camera)\n return if @rep == nil\n \n # Compute the new transformation from the camera\n eye = camera.eye\n xaxis = camera.direction\n yaxis = camera.xaxis.reverse\n zaxis = camera.yaxis\n \n # See if an eye offset is given\n eo = self.get_offset\n if( eo )\n offset = Geom::Vector3d.linear_combination eo.x, xaxis, eo.y, yaxis, eo.z, zaxis\n eye.offset!(offset.reverse)\n end\n \n t = Geom::Transformation.new( eye, xaxis, yaxis )\n @rep.move!(t)\n \n # Set the camera attributes\n self.set_attributes(camera)\nend", "def mirror!\n set(-@x, -@y, -@z)\n end", "def initialize(viewport, type, x, y, visible = true)\n super(viewport)\n self.visible = visible\n #self.bitmap = Bitmap.new(32,32)\n @wait = 6\n @pattern = [0,1,2,3]\n @p_index = 0 #pattern index\n @type = type\n @x = x; @y = y # Denotes map's tile x/y\n self.zoom_x = 0\n self.zoom_y = 0\n @anim = false\n self.z = 20000\n\n moveto(@x, @y)\n refresh \n end", "def set_airplane\n @airplane = Airplane.find(params[:id])\n end", "def set_airplane\n @airplane = Airplane.find(params[:id])\n end", "def initialize(focal,near,far,center)\n # Near, far and center are positions along the z ( here technically the y ) axis\n\n @focal = focal\n\n @near = near\n @near_fov_width = near * Math::tan( Trigo::deg_to_rad focal )\n \n @far = far\n @far_fov_width = far * Math::tan( Trigo::deg_to_rad focal ) \n \n @center = center\n end", "def mirror\n point3.mirror!\n end", "def update!(**args)\n @control_plane_only = args[:control_plane_only] if args.key?(:control_plane_only)\n end", "def set_display_pos(x, y)\n @display_x = (x + @map.width * 256) % (@map.width * 256)\n @display_y = (y + @map.height * 256) % (@map.height * 256)\n @parallax_x = x\n @parallax_y = y\n end", "def setup\n size 640, 300, P3D\n @lens_d = 160\n @lens_list = []\n @xx, @yy, @dx, @dy = 0, 0, 3, 3\n \n # Create buffered image for lens effect.\n @lens_effect = create_graphics(width, height, P2D)\n \n # Load background image.\n @lens_effect.begin_draw\n @lens_effect.image(load_image('red_smoke.jpg'), 0, 0, width, height)\n @lens_effect.end_draw\n image(@lens_effect, 0, 0, width, height)\n \n # Create buffered image for warping.\n @lens_image = create_graphics(@lens_d, @lens_d, P2D)\n @lens_image2 = create_graphics(@lens_d, @lens_d, P2D)\n \n compute_lens_transformation\nend", "def use_section_planes=(setting)\n end", "def set_orbit\n @orbit = Orbit.find(params[:id])\n end", "def interlaced?\n !image_ptr[:interlace].zero?\n end", "def setup_layers\n\tend", "def initialize(image, x, y, oy)\n @sprite = ::Sprite.new(Particles.viewport, true)\n @sprite.bitmap = ::RPG::Cache.autotile(image)\n @sprite.oy = @sprite.bitmap.height - oy - 16\n @x = (x + MapLinker.get_OffsetX) * 16\n @y = (y + MapLinker.get_OffsetY) * 16\n @real_y = (y + MapLinker.get_OffsetY) * 128\n @map_id = $game_map.map_id\n update\n end", "def update_placement\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end", "def layer=(layer)\n end", "def initialize(x,y,facing)\n if (x.to_i >= 0 && x.to_i <= @@grid_x && y.to_i >= 0 && y.to_i <= @@grid_y && facing =~ /NORTH|SOUTH|EAST|WEST/) then\n @x = x.to_i\n @y = y.to_i\n case facing\n when \"NORTH\"\n @facing = :north\n when \"SOUTH\"\n @facing = :south\n when \"EAST\"\n @facing = :east\n when \"WEST\"\n @facing = :west\n end\n else\n raise ArgumentError\n end\n end", "def set_animation_origin\n unless camera_reposition_case?\n super\n return\n end\n @anim_origin.x = @screen_point.x\n @anim_origin.y = @screen_point.y\n if @animation.position == 0\n @anim_origin.y -= height / 2\n elsif @animation.position == 2\n @anim_origin.y += height / 2\n end\n update_anim_origin_reference\n end", "def add_section_plane(plane)\n end", "def set_perspective\n # do nothing\n end", "def set_x_y_z(x,y,z)\r\n @x=x\r\n @y=y\r\n @z=z\r\n self\r\n end", "def camConstuctionSetParams _obj, _args\n \"_obj camConstuctionSetParams _args;\" \n end", "def all_planes\n self.planes.collect do |plane_obj|\n plane_obj.update_status_and_location\n end\n end", "def update!(**args)\n @deinterlace_all_frames = args[:deinterlace_all_frames] if args.key?(:deinterlace_all_frames)\n @mode = args[:mode] if args.key?(:mode)\n @parity = args[:parity] if args.key?(:parity)\n end", "def set_position\n self.position = institution.max_photo_position + 1\n end", "def initialize(x, y, window)\n\t\tsuper(\"images/alien.png\") \n\t\t@x = x\n \t @y = y\n \t\t@window = window\n\tend", "def rocker_set_all x,y,g\n\t\trocker_set_rx x\n\t\trocker_set_ry y\n\t\trocker_set_rg g\n\t\t@rocker_iface\n\tend", "def project_image image, leftup\n img = get_image(image)\n if leftup == :left\n img.change_geometry('1!') { |cols, rows, geo_image| geo_image.scale!(cols, rows) }\n elsif leftup == :up\n width = img.columns\n img.change_geometry(\"#{width}x1!\") { |cols, rows, geo_image| geo_image.scale!(cols, rows) }\n elsif\n raise \"project_image: invalid leftup parameter\"\n end\n end", "def update_background\n @background.x, @background.y, @background.z = 0,0,self.z - 1 #self.x, self.y, self.z - 1\n end", "def setup\n size 1024,768,P3D\n background 0\n\n @context = SimpleOpenNI.new(self)\n @zoomF =0.5\n @rotX = radians(180) # by default rotate the hole scene 180deg around the x-axis, \n # the data from openni comes upside down\n @rotY = radians(0)\n\n if !@context.isInit\n puts \"Can't init SimpleOpenNI, maybe the camera is not connected!\"\n exit\n end\n\n # disable mirror\n @context.setMirror(false)\n\n # enable depthMap generation \n @context.enableDepth()\n\n # enable skeleton generation for all joints\n @context.enableUser()\n\n stroke(255,255,255)\n smooth()\nend", "def placement x, y, face\n @pos_x = x\n @pos_y = y\n @face = face\n self\n end", "def update_anim_origin_reference\n @ani_ox = @anim_origin.screen_x\n @ani_oy = @anim_origin.screen_y\n end", "def update_anim_origin_reference\n @ani_ox = @anim_origin.screen_x\n @ani_oy = @anim_origin.screen_y\n end", "def goto_point(in_point, tRo_x ,tRo_y, tRo_z)\n tem_pln = APlane.new(in_point.x, in_point.y, in_point.z, tRo_x, tRo_y, tRo_z)\n result_ik = MotionPlan.IKsolverNew(tem_pln , @current_ik)\n update(result_ik) if result_ik[:success]\n end", "def initialize(ac,ve,lo,r) \n @acc = PVector.new(ac.x, ac.y, ac.z)\n @vel = PVector.new(ve.x, ve.y, ve.z)\n @loc = PVector.new(lo.x, lo.y, lo.z)\n @r = 10\n @timer = 100.0\n @maxspeed = 2\n end", "def update_anim_origin_reference\n @ani_ox = @anim_origin.screen_x\n @ani_oy = @anim_origin.screen_y\n end", "def update!(**args)\n @clamped_optimal_fov_bounds = args[:clamped_optimal_fov_bounds] if args.key?(:clamped_optimal_fov_bounds)\n @cubemap = args[:cubemap] if args.key?(:cubemap)\n @deprecated_cropped_area = args[:deprecated_cropped_area] if args.key?(:deprecated_cropped_area)\n @deprecated_initial_view = args[:deprecated_initial_view] if args.key?(:deprecated_initial_view)\n @equirect = args[:equirect] if args.key?(:equirect)\n @full_pano_height_pixels = args[:full_pano_height_pixels] if args.key?(:full_pano_height_pixels)\n @full_pano_width_pixels = args[:full_pano_width_pixels] if args.key?(:full_pano_width_pixels)\n @mesh = args[:mesh] if args.key?(:mesh)\n @metadata_source = args[:metadata_source] if args.key?(:metadata_source)\n @optimal_fov_bounds = args[:optimal_fov_bounds] if args.key?(:optimal_fov_bounds)\n @pose = args[:pose] if args.key?(:pose)\n @projection_type = args[:projection_type] if args.key?(:projection_type)\n @source_count = args[:source_count] if args.key?(:source_count)\n @spherical = args[:spherical] if args.key?(:spherical)\n @stereo_mode = args[:stereo_mode] if args.key?(:stereo_mode)\n @stitched = args[:stitched] if args.key?(:stitched)\n @stitching_software = args[:stitching_software] if args.key?(:stitching_software)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n end", "def set(x, y, x_origin, y_origin, width, height)\n\n\t\t@rotation\t= [0.0, 0.0, 0.0, 0.0]\n\n\t\tif width > height then\n\t\t\t@radius = width * 0.5\n\t\telse\n\t\t\t@radius = height * 0.5\n\t\tend\n\n\n\t\t# Figure the center of the view :\n\t\t@x_center = x_origin + width * 0.5\n\t\t@y_center = y_origin + height * 0.5\n\n \n\t\t# Compute the starting vector from the surface of the ball to its center :\n\t\t@start_point = []\n\t\t@start_point[0] = x - @x_center\n\t\t@start_point[1] = y - @y_center\n\n\t\tdistance = @start_point[0]*@start_point[0] + @start_point[1]*@start_point[1]\n\n\t\tif distance > @radius*@radius then\t# Outside the sphere :\n\t\t\t@start_point[2] = 0\n\t\telse\n\t\t\t@start_point[2] = Math.sqrt(@radius*@radius - distance)\n\t\tend\n\n\n\t\t# Initializing the end point array :\n\t\t@end_point = []\n\n\tend", "def save_image(filename)\n\t\t@image.save(filename, :interlace => true)\t\t\n\tend", "def origin=(point)\n end", "def set_fog_data(fog, fog_data)\n fog.bitmap = Cache.parallax(fog_data[0])\n fog.opacity = fog_data[1] || 255\n fog.blend_type = fog_data[2] || 0\n fog.zoom_x = fog_data[3] || 1\n fog.zoom_y = fog_data[3] || 1\n fog.x_speed = fog_data[4] || 0\n fog.y_speed = fog_data[5] || 0\n end", "def draw\r\n @image.bmp.draw(@x, @y, ZOrder::TOP)\r\n end", "def update!(**args)\n @basemap_z_order = args[:basemap_z_order] if args.key?(:basemap_z_order)\n @vertex_offsets = args[:vertex_offsets] if args.key?(:vertex_offsets)\n @z_order = args[:z_order] if args.key?(:z_order)\n end", "def place(x, y, facing)\n return false if falls_off?(x, y)\n self.x = x\n self.y = y\n self.facing = facing\n true\n end", "def compute_self\n rect.set(self.x, self.y, self.width, self.height)\n rect.compute_self\n self.true_ox = rect.true_x - rect.abs_x + self.ox\n self.true_oy = rect.true_y - rect.abs_y + self.oy\n compute_z\n end", "def draw_plank x, y, image\r\n image.draw(x,y,1) # 1 denotes the ZOrder \r\nend", "def update_origin_by_axis(in_axis)\n temp_ik = IKres.new( in_axis.a0, in_axis.a1 , in_axis.a2 , in_axis.a3 , in_axis.a4 , in_axis.a5 )\n result_ik = MotionPlan.ik_step([@current_ik.a0, @current_ik.a1, @current_ik.a2, @current_ik.a3, @current_ik.a4, @current_ik.a5],\n [temp_ik.res_plane.origin.x, temp_ik.res_plane.origin.y, temp_ik.res_plane.origin.z],\n [temp_ik.res_plane.x_axis.x, temp_ik.res_plane.x_axis.y, temp_ik.res_plane.x_axis.z],\n [temp_ik.res_plane.y_axis.x, temp_ik.res_plane.y_axis.y, temp_ik.res_plane.y_axis.z]\n )\n # update(result_ik) if result_ik[:success]\n update_front(result_ik, in_axis) if result_ik[:success]\n end", "def interlace_mode?\n @cr[0][7] == 1\n end", "def set_to_one(coords)\n if (0..@max_x).include?(coords[:x]) && (0..@max_y).include?(coords[:y])\n @image[coords[:y]][coords[:x]] = 1\n end\n end", "def ini( x, y )\n @x = Coord.set( x )\n @y = Coord.set( y )\n self\n end", "def active_section_plane\n end", "def active_section_plane\n end", "def update_memory!(mem)\n map = @game.map\n \n x_s = @x-@vision\n y_s = @y-@vision\n @fov = linecast(map.tiles.get_values(x_s,y_s,2*@vision,2*@vision))\n mem.ins_values(x_s, y_s, @fov, false)\n end", "def set_zonal\n @zonal = Zonal.find(params[:id])\n end", "def set_annot\n @annot = Annot.find(params[:id]) \n @run = @annot.run\n @project = @annot.project\n @version =@project.version\n @h_env = Basic.safe_parse_json(@version.env_json, {})\n @list_docker_image_names = @h_env['docker_images'].keys.map{|k| @h_env['docker_images'][k][\"name\"] + \":\" + @h_env['docker_images'][k][\"tag\"]}\n @docker_images = DockerImage.where(\"full_name in (#{@list_docker_image_names.map{|e| \"'#{e}'\"}.join(\",\")})\").all\n @asap_docker_image = @docker_images.select{|e| e.name == APP_CONFIG[:asap_docker_name]}.first\n end", "def parallax_ox(bitmap)\n offset_camera_width = (bitmap.width / 2) - (Graphics.width / 2)\n (@parallax_x - @parallax_y) * TILE_WIDTH_HALF + offset_camera_width\n end", "def interlaced?\n @interlaced\n end", "def center_origins\n return if !self.bitmap\n self.ox = self.bitmap.width / 2\n self.oy = self.bitmap.height / 2\n end", "def cardinal_azimuth; end", "def azimuth; end", "def set_prawn(prawn)\n\t\t@prawn = prawn\n\t\t@prawn.x = @x + SUB_TILE_WIDTH/2.0 - Prawn::TILE_WIDTH/2 \n\t\t@prawn.y = @y + SUB_TILE_HEIGHT/2.0 \n\t\t@prawn.angle = @angle\n\tend", "def initialize\r\n @map_id = 0\r\n @display_x = 0\r\n @display_y = 0\r\n end", "def set_fog(index, data)\n $game_map.set_fog(index, data)\n end", "def drawmap(map,z=0)\r\nend", "def setup\n size(640, 360)\n smooth 4\n @loc = Vec2D.new(100, 100)\n @velocity = Vec2D.new(1.5, 2.1)\n @gravity = Vec2D.new(0, 0.2)\n\nend", "def active_section_plane\n end", "def set!(x, y=self.x, z=self.y)\n end", "def ox=(ox)\n #\n unless @tilemap_drawn\n @ox = ox\n @ox_oy_set[0] = true\n return\n end\n \n return if @ox == ox\n # Shift all tiles left or right by the difference\n shift = @ox - ox\n \n @tile_sprites.each {|set| set.each{|tile| tile.x += shift }}\n @ox = ox\n # Determine if columns need to be shifted\n col_num = @corner_index\n #return unless @tile_sprites[col_num][0].x <= -49 || @tile_sprites[col_num][0].x >= -17\n while @tile_sprites[col_num][0].x <= -49 || @tile_sprites[col_num][0].x >= -17\n \n @corner_tile_loc[0] += (shift < 0 ? 1 : -1)\n modTileId = ((SCREEN[0]+64)*(SCREEN[1]+64))/1024 \n # If new ox is greater than old ox\n if shift < 0\n # Move all sprites in left column to the right side and change bitmaps\n # and z-values\n (0...(SCREEN[1]/32+2)).each{|n|\n j = ((SCREEN[0]/32+2) * n + col_num) % modTileId\n @tile_sprites[j].each_index{|i|\n tile = @tile_sprites[j][i]\n @animating_tiles.delete(tile.tile_sprite_id)\n tile.x += 64 + SCREEN[0]\n \n map_x, map_y = (tile.x+@ox)/32, (tile.y+@oy)/32\n tile_id = @map_data[map_x,map_y,i]\n \n if tile_id.nil?\n tile.z = [map_y * 32, 0].max\n tile.bitmap = RPG::Cache.picture('')\n tile.src_rect.set(0,0,0,0)\n next\n else\n if @priorities[tile_id] == 0\n tile.z = 0\n else\n tile.z = 32 + (tile.y/32) * 32 + @priorities[tile_id] * 32\n end\n end\n if tile_id == 0\n tile.bitmap = RPG::Cache.picture('')\n tile.src_rect.set(0,0,0,0)\n elsif tile_id >= 384\n tile.bitmap = @tileset\n tile.src_rect.set(((tile_id - 384) % 8) * 32,((tile_id - 384) / 8) *32, 32, 32)\n else\n auto_id = tile_id/48-1\n tile.bitmap = @autotiles[auto_id]\n tile.src_rect.set(((tile_id % 48) % 8)*32 + @current_frame[auto_id] * 256,((tile_id % 48) / 8)*32, 32, 32)\n @animating_tiles[tile.tile_sprite_id] = tile if @total_frames[auto_id] > 1\n end\n }\n }\n # New corner should be the tile immediately right of the previous tile\n col_num /= SCREEN[0]/32+2\n col_num *= SCREEN[0]/32+2\n @corner_index = (@corner_index + 1) % (SCREEN[0]/32+2) + col_num\n else\n # Shift right column to the left\n # Gets the right column\n row_index = col_num / (SCREEN[0]/32+2)\n row_index *= (SCREEN[0]/32+2)\n col_num = (@corner_index - 1) % (SCREEN[0]/32+2) + row_index\n \n (0...(SCREEN[1]/32+2)).each{|n|\n j = ((SCREEN[0]/32+2) * n + col_num) % modTileId\n @tile_sprites[j].each_index{|i|\n tile = @tile_sprites[j][i]\n @animating_tiles.delete(tile.tile_sprite_id)\n tile.x -= 64 + SCREEN[0]\n \n map_x, map_y = (tile.x+@ox)/32, (tile.y+@oy)/32\n tile_id = @map_data[map_x,map_y,i]\n if tile_id.nil?\n tile.z = [map_y * 32, 0].max\n tile.bitmap = @tileset\n tile.src_rect.set(0,0,0,0)\n next\n else\n if @priorities[tile_id] == 0\n tile.z = 0\n else\n tile.z = 32 + (tile.y/32) * 32 + @priorities[tile_id] * 32\n end\n end\n if tile_id == 0\n tile.bitmap = RPG::Cache.picture('')\n tile.src_rect.set(0,0,0,0)\n elsif tile_id >= 384\n tile.bitmap = @tileset\n tile.src_rect.set(((tile_id - 384) % 8)*32,((tile_id - 384) / 8)*32, 32, 32)\n else\n auto_id = tile_id/48-1\n tile.bitmap = @autotiles[auto_id]\n tile.src_rect.set(((tile_id % 48) % 8)*32 + @current_frame[auto_id] * 256,((tile_id % 48) / 8)*32, 32, 32)\n @animating_tiles[tile.tile_sprite_id] = tile if @total_frames[auto_id] > 1\n end\n }\n }\n col_num /= SCREEN[0]/32+2\n col_num *= SCREEN[0]/32+2\n @corner_index = (@corner_index - 1) % (SCREEN[0]/32+2) + col_num\n end\n col_num = @corner_index\n end #end of while\n end", "def set_placing\n @placing = Placing.find(params[:id])\n end", "def place_onto(x, y, image, target)\n target.import_pixels(x, y, image.columns, image.rows, 'RGB', image.export_pixels)\n end", "def add_plane(plane)\n @planes << plane\n end", "def resize\n @image.resize \"#{@placement[:a]}x#{OUTER}\\!\"\n end" ]
[ "0.6643877", "0.6283325", "0.5662474", "0.56427205", "0.5585171", "0.55764073", "0.5445031", "0.5386039", "0.52994514", "0.52922416", "0.5249821", "0.51744294", "0.51572925", "0.5083133", "0.4996964", "0.49648672", "0.4926651", "0.49249166", "0.49149182", "0.4905604", "0.48992735", "0.4894503", "0.48921573", "0.48908615", "0.48597848", "0.48280272", "0.4820703", "0.4813929", "0.4811613", "0.48090407", "0.48017353", "0.48017353", "0.48015308", "0.4797115", "0.47828385", "0.47705206", "0.47700906", "0.47656092", "0.47645703", "0.47643444", "0.4757725", "0.47483152", "0.47449484", "0.47326306", "0.4727524", "0.47088522", "0.4702217", "0.47002614", "0.4696055", "0.46725756", "0.4660237", "0.46549502", "0.46536386", "0.4647813", "0.46434805", "0.4640352", "0.46239105", "0.4616298", "0.46161994", "0.4603287", "0.4603287", "0.46031457", "0.45990735", "0.4595195", "0.45892447", "0.45875514", "0.45630196", "0.4559371", "0.45541742", "0.45533955", "0.4549747", "0.45484588", "0.454347", "0.45368958", "0.45325524", "0.45279726", "0.45246506", "0.45163208", "0.45129135", "0.45129135", "0.4510077", "0.4502366", "0.45023397", "0.44941843", "0.4493736", "0.4491184", "0.44877234", "0.44868603", "0.44825262", "0.4480967", "0.448005", "0.44771495", "0.44764334", "0.44639063", "0.4461969", "0.44584656", "0.44540972", "0.4452852", "0.44526362", "0.4444418" ]
0.48901814
24
Tiny gaussian blur to optimize the size
def gaussian_blur(radius) manipulate! do |img| img.gaussian_blur(radius.to_s) img = yield(img) if block_given? img end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_blur(*args)\n output = self.apply_filter(CIFilter.gaussian_blur(*args))\n return UIImage.imageWithCIImage(output, scale:self.scale, orientation:self.imageOrientation)\n end", "def gaussian_blur(params = {})\n params[:name] ||= @pictureName.gsub('.png', 'Gauss.png')\n params[:save] ||= @picturePath\n \n blurFilter = \n [\n [0.01248, 0.02642, 0.03392, 0.02642, 0.01248], \n [0.02642, 0.05592, 0.07180, 0.05592, 0.02642], \n [0.03392, 0.07180, 0.09220, 0.07180, 0.03392], \n [0.02642, 0.05592, 0.07180, 0.05592, 0.02642], \n [0.01248, 0.02642, 0.03392, 0.02642, 0.01248]\n ]\n\n height, width = @height-3, @width-3\n blur = dup\n \n (2..height).each do |j|\n (2..width).each do |i|\n pixel = calculate_pixel_value_with_filter5(blurFilter, @picture, i, j, false)\n blur[i, j] = ChunkyPNG::Color.rgb(pixel[0].to_i, pixel[1].to_i, pixel[2].to_i)\n end\n end\n\n blur.pictureName, blur.picturePath = params[:name], params[:save]\n blur\n end", "def gaussian_blur(radius)\n manipulate! do |img|\n img.gaussian_blur(radius.to_s)\n img = yield(img) if block_given?\n img\n end\n end", "def blur(radius, sigma)\n manipulate! do |img|\n img.blur \"#{radius}x#{sigma}\"\n img = yield(img) if block_given?\n img\n end\n end", "def blur(distance)\r\n distance.times do\r\n blurred\r\n end\r\n end", "def filter_gaussian_blur(radius, sigma, image_file, opts = {})\n data, _status_code, _headers = filter_gaussian_blur_with_http_info(radius, sigma, image_file, opts)\n data\n end", "def blur(image)\n convolve(to_narray(image), GAUSS).to_a\n end", "def blur(distance)\n find_ones.each do |one|\n spread(one, distance)\n end\n end", "def add_blur_to_image\n r = 0\n c = 0\n rc = 0\n n = 1\n z = []\n u = @y.size.to_i\n while n <= u\n @ary.each_index do |r|\n @ary[r].each_index do |c|\n if ((c.to_i - y[rc][1].to_i).abs + (r.to_i - y[rc][0].to_i).abs).between?(1, @distance.to_i);\n z << [r.to_i, c.to_i]\n end\n end\n end\n r = 0\n c = 0\n rc += 1\n n += 1\n end\n zz=[]\n r1 = 0\n c1 = 0\n z.each do |r|\n r1 = r[0].to_i\n c1 = r[1].to_i\n @ary[r1][c1] = 1\n end\n end", "def blur original, out, blur=100\n\n\t\tim = MiniMagick::Image.open(File.join(Rails.root,'public', original))\n\t\tim.combine_options do |c|\n\t\t\t c.blur blur\t\n\t\tend\n\t\tim.write(File.join(Rails.root,'public',out))\n\tend", "def blur! (radius)\n @transforms << \"BL#{radius}\"\n self\n end", "def blur(distance)\r\n # instantiate variables\r\n @b_array = Array.new(array.length) { Array.new(array[0].length,0) }\r\n min_y= 0\r\n max_y = b_array.length - 1\r\n min_x = 0 \r\n max_x = b_array[0].length - 1\r\n blurred_coordinates = []\r\n #iterate through each row of the array, passing down index and value\r\n array.each_with_index do |row,row_i|\r\n #iterate through each column (value) passing index and value\r\n row.each_with_index do |col,col_i| \r\n if row[col_i] == 1 \r\n blurred_coordinates << get_manhattan_set(row_i,col_i,distance)\r\n end\r\n end\r\n end\r\n\r\n blurred_coordinates.each do |set|\r\n set.each do |point|\r\n unless point[0]< min_x || point[1] < min_y || point[0]> max_y || point[1] > max_x\r\n @b_array[point[0]][point[1]] = 1\r\n end\r\n end \r\n end\r\n end", "def blur(distance)\n @distance = distance\n find_pixel_eq_1\n add_blur_to_image\n \n j = @ary.size\n q = @ary.flatten.size\n wa = q / j - 1\n l = q / j\n k = @ary.flatten\n m = 0\n n = l - 1\n while n <= q\n puts k[m..n].join\n m += l\n n += l\n end \n end", "def filter_gaussian_blur_with_http_info(radius, sigma, image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilterApi.filter_gaussian_blur ...'\n end\n # verify the required parameter 'radius' is set\n if @api_client.config.client_side_validation && radius.nil?\n fail ArgumentError, \"Missing the required parameter 'radius' when calling FilterApi.filter_gaussian_blur\"\n end\n # verify the required parameter 'sigma' is set\n if @api_client.config.client_side_validation && sigma.nil?\n fail ArgumentError, \"Missing the required parameter 'sigma' when calling FilterApi.filter_gaussian_blur\"\n end\n # verify the required parameter 'image_file' is set\n if @api_client.config.client_side_validation && image_file.nil?\n fail ArgumentError, \"Missing the required parameter 'image_file' when calling FilterApi.filter_gaussian_blur\"\n end\n # resource path\n local_var_path = '/image/filter/blur/guassian/{radius}/{sigma}'.sub('{' + 'radius' + '}', radius.to_s).sub('{' + 'sigma' + '}', sigma.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/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['imageFile'] = image_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilterApi#filter_gaussian_blur\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def blur(image, r, c, distance)\n\n # Set the column length and row length\n image_height = image.length\n image_width = image[0].length\n\n # start looking at the rows at index[0]\n start_row = r - distance # number \n if start_row < 0\n start_row = 0\n end\n\n # start column all the way to the left\n start_col = c - distance\n if start_col < 0\n start_col\n end\n\n end_row = r + distance\n if end_row > image_height - 1\n end_row = image_height - 1\n end\n\n end_col = c + distance\n if end_col > image_width - 1\n end_col = image_width - 1\n end\n\n for i in (start_row..end_row)\n for j in (start_col..end_col)\n if within_manhatten_distance?(i, j, r, c, distance)\n image[i][j] = 2\n end\n end\n end\nend", "def cleanup image\n m_begin \"cleanup\"\n img = get_image(image)\n img = img.gaussian_blur(8)\n img = img.threshold((QuantumRange * 0.999).to_int)\n img = img.gaussian_blur(14)\n img = img.threshold(0)\n m_end \"cleanup\"\n set_variable(image, img)\n end", "def blur(params = {})\n params[:name] ||= @pictureName.gsub('.png', 'Blurred.png')\n params[:save] ||= @picturePath\n \n blurFilter = [\n [1/16.0, 2/16.0, 1/16.0], \n [2/16.0, 4/16.0, 2/16.0], \n [1/16.0, 2/16.0, 1/16.0]\n ]\n \n height, width = @height-2, @width-2\n blur = dup\n \n (1..height).each do |j|\n (1..width).each do |i|\n pixel = calculate_pixel_value_with_filter3(blurFilter, @picture, i, j, false)\n blur[i, j] = ChunkyPNG::Color.rgb(pixel[0].to_i, pixel[1].to_i, pixel[2].to_i)\n end\n end\n \n blur.pictureName, blur.picturePath = params[:name], params[:save]\n blur\n end", "def blur_sprite(blur_val = 2, opacity = 35)\n bitmap = self.bitmap\n self.bitmap = Bitmap.new(bitmap.width,bitmap.height)\n self.bitmap.blt(0,0,bitmap,Rect.new(0,0,bitmap.width,bitmap.height))\n x = 0; y = 0\n for i in 1...(8 * blur_val)\n dir = i % 8\n x += (1 + (i / 8))*([0,6,7].include?(dir) ? -1 : 1)*([1,5].include?(dir) ? 0 : 1)\n y += (1 + (i / 8))*([1,4,5,6].include?(dir) ? -1 : 1)*([3,7].include?(dir) ? 0 : 1)\n self.bitmap.blt(x-blur_val,y+(blur_val*2),bitmap,Rect.new(0,0,bitmap.width,bitmap.height),opacity)\n end\n end", "def blur_sprite(blur_val = 2, opacity = 35)\n bitmap = self.bitmap\n self.bitmap = Bitmap.new(bitmap.width,bitmap.height)\n self.bitmap.blt(0,0,bitmap,Rect.new(0,0,bitmap.width,bitmap.height))\n x = 0; y = 0\n for i in 1...(8 * blur_val)\n dir = i % 8\n x += (1 + (i / 8))*([0,6,7].include?(dir) ? -1 : 1)*([1,5].include?(dir) ? 0 : 1)\n y += (1 + (i / 8))*([1,4,5,6].include?(dir) ? -1 : 1)*([3,7].include?(dir) ? 0 : 1)\n self.bitmap.blt(x-blur_val,y+(blur_val*2),bitmap,Rect.new(0,0,bitmap.width,bitmap.height),opacity)\n end\n end", "def blur!\r\n ones = get_ones\r\n ones.each do |found_row_number, found_col_number| \r\n @picture[found_row_number -1][found_col_number] = 1 unless found_row_number == 0 #up\r\n @picture[found_row_number +1][found_col_number] = 1 unless found_row_number == @picture.length-1 #down\r\n @picture[found_row_number][found_col_number -1] = 1 unless found_col_number == 0 #left\r\n @picture[found_row_number][found_col_number +1] = 1 unless found_col_number == @picture[found_row_number].length-1 #right\r\n end\r\n end", "def blur_path\n \"b_#{image_path}\"\n end", "def blur!(blur_distance)\r\n ones = get_ones\r\n\r\n @icon.each_with_index do |row, row_index|\r\n row.each_with_index do |item, col_index|\r\n ones.each do |found_row_index, found_col_index|\r\n if manhattan_distance(col_index, row_index, found_col_index, found_row_index) <= blur_distance\r\n @icon[row_index][col_index] = 1\r\n end\r\n end\r\n end\r\n end\r\n end", "def filter_motion_blur(radius, sigma, angle, image_file, opts = {})\n data, _status_code, _headers = filter_motion_blur_with_http_info(radius, sigma, angle, image_file, opts)\n data\n end", "def blur_image\r\n\r\n#define new image array with identical length to old array\r\n image1 = Array.new(@image.length){\r\n Array.new(@image[0].length){}}\r\n\r\n#start indexing through each cell and define values for rows and columns\r\n @image.each_with_index { |val, rowindex|\r\n val.each_with_index {|val1, colindex| \r\n\r\n#hardcoding 'nil' index values into zeroes \r\n if image1 [rowindex][colindex] != 1 \r\n then image1 [rowindex][colindex] = 0 \r\n end\r\n\r\n#if currently indexed cell has a value of 1 in original array, cell value in new array will be 1\r\n if val1 > 0 \r\n then image1 [rowindex][colindex] = 1\r\n\r\n#define value of cell directly below currently indexed cell as 1, unless it is the last cell in a column.\r\n if colindex != val.length-1\r\n then image1 [rowindex][colindex +1] = 1\r\n end\r\n\r\n#if the currently indexed cell is 1, then define value of cell directly above it as 1.\r\n if colindex != 0 then\r\n image1 [rowindex][colindex -1] = 1\r\n end\r\n\r\n#define value of the cell to the RIGHT of the currently indexed cell as 1, unless it is the last cell in a row.\r\n if rowindex != @image.length-1 then\r\n image1 [rowindex +1][colindex] = 1\r\n end\r\n\r\n#if the currently indexed cell is 1, then define the value of the cell to the LEFT of it as 1.\r\n if rowindex != 0 then\r\n image1 [rowindex -1][colindex] = 1\r\n end\r\n\r\n end\r\n\r\n }} \r\n\r\n#show blurred image array\r\n image1.each do |cell|\r\n puts cell.join\r\n end\r\n end", "def blur_pixel(ones_array)\n ones_array.each do |point_array|\n # => breaks the point_array inner arrays into its two parts --\n # => wouldn't work if there was stuff in the middle\n row = point_array.first\n col = point_array.last\n # => this is where the transformation happens\n @image_array[row - 1][col] = 1\n @image_array[row][col - 1] = 1 unless col == 0\n @image_array[row + 1][col] = 1 unless row >= @num_row - 1\n @image_array[row][col + 1] = 1 unless col >= @num_col - 1 \n end\n end", "def blur_pixel(ones_array)\n ones_array.each do |point_array|\n # => breaks the point_array inner arrays into its two parts --\n # => wouldn't work if there was stuff in the middle\n row = point_array.first\n col = point_array.last\n # => this is where the transformation happens\n @image_array[row - 1][col] = 1\n @image_array[row][col - 1] = 1 unless col == 0\n @image_array[row + 1][col] = 1 unless row >= @num_row - 1\n @image_array[row][col + 1] = 1 unless col >= @num_col - 1 \n\n end\n end", "def update!(**args)\n @max_blur_sigma = args[:max_blur_sigma] if args.key?(:max_blur_sigma)\n end", "def host_blur\n self.is_processed = true\n\n # Create blurred thumbnail\n #\n image = MiniMagick::Image.open(square_url)\n\n image.combine_options do |canvas|\n canvas.blur \"2.5x2.5\"\n end\n\n FileSystem.store(\n blur_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.save!\n end", "def blur(n)\n\t\tn.times do\n\t\t\ttransform(one_index)\n\t\tend\n#\t\tupdate_cell(row_index+1,col_index,1)\n#\t\tupdate_cell(row_index,col_index+1,1)\n#\t\tupdate_cell(row_index,col_index-1,1)\n#\t\tupdate_cell(row_index-1,col_index,1)\n\tend", "def blur\n things_to_blur = []\n # looking for 1s to blur going through each array\n @grid.each_with_index do |or_row, row_index|\n or_row.each_with_index do |cell, cell_index|\n #is this current cell a 1?\n if cell == 1\n #run function on code\n recursive_blur(Point.new(cell_index, row_index), things_to_blur)\n end\n end\n end\n things_to_blur.each do |point|\n @grid[point.y][point.x] = 1\n end\n output_image\n end", "def blur(distance)\n row_max = @image[0].length() - 1\n column_max = @image.length() - 1\n\n ones = self.get_ones\n\n while distance > 0\n ones.each do |one|\n vert = one[1]\n horiz = one[0]\n \n # down \n @image[vert + distance][horiz] = 1 unless vert + distance > column_max\n\n # up\n @image[vert - distance][horiz] = 1 unless vert - distance < 0\n\n # right\n @image[vert][horiz + distance] = 1 unless horiz + distance > row_max\n\n # left\n @image[vert][horiz - distance] = 1 unless horiz - distance < 0\n\n sub_distance = distance\n diag = 1\n while sub_distance > 1\n\n # bottom sides\n unless vert + sub_distance - 1 > column_max || horiz - diag < 0 || horiz + diag > row_max\n @image[vert + sub_distance - 1][horiz - diag] = 1\n @image[vert + sub_distance - 1][horiz + diag] = 1 \n end\n\n # top\n unless vert - sub_distance + 1 < 0 || horiz - diag < 0 || horiz + diag > row_max\n @image[vert - sub_distance + 1][horiz - diag] = 1\n @image[vert - sub_distance + 1][horiz + diag] = 1\n end\n\n # right sides\n unless vert - diag < 0 || vert + diag > column_max || horiz + sub_distance - 1 > column_max\n @image[vert - 1][horiz + sub_distance - diag] = 1\n @image[vert + 1][horiz + sub_distance - diag] = 1\n end\n\n # left sides\n unless vert - diag < 0 || vert + diag > column_max || horiz + sub_distance - 1 < 0\n @image[vert - 1][horiz - sub_distance + diag] = 1\n @image[vert + 1][horiz - sub_distance + diag] = 1\n end\n\n sub_distance -= 1\n diag += 1\n\n end\n end\n\n distance -= 1\n end\n\n end", "def blurred\n @grpc.blurred_likelihood\n end", "def blurred\r\n unos = []\r\n # nested loops for rows and columns\r\n @paint.each_with_index do |row, rownum| # iterating over elements in the main array for rows \r\n row.each_with_index do |element, colnum| # iterating over elements in each subarray for columns\r\n if element == 1\r\n unos << [rownum, colnum]\r\n end\r\n end\r\n end\r\n\r\n unos.each do |rownum, colnum| \r\n # assigning \"1\" above \"1\"s, except for first row\r\n @paint[rownum -1][colnum] = 1 unless rownum == 0\r\n # assigning \"1\" below \"1\"s, except for last row\r\n @paint[rownum +1][colnum] = 1 unless rownum >= @paint.length-1\r\n # assigning \"1\" to the left of \"1\"s, except for first column\r\n @paint[rownum][colnum -1] = 1 unless colnum == 0\r\n # assigning \"1\" to the right of \"1\"s, except for last column\r\n @paint[rownum][colnum +1] = 1 unless colnum >= @paint[rownum].length-1\r\n end\r\n end", "def blur(row_index,col_index)\n update_cell(row_index+1, col_index,1)\n update_cell(row_index,col_index+1, 1)\n update_cell(row_index,col_index-1, 1)\n update_cell(row_index-1, col_index,1)\n end", "def glow(strenght = 2)\n copy = self.clone\n strenght.times { copy.blur }\n copy.blt(0, 0, self, Rect.new(0, 0, copy.width, copy.height))\n copy\n end", "def smoothing; end", "def replace_attrs(svg, width, height)\n ratio = '<svg xmlns=\"http://www.w3.org/2000/svg\"' +\n %(viewBox=\"0 0 #{width} #{height}\">)\n blur = '<filter id=\"b\"><feGaussianBlur stdDeviation=\"12\" /></filter>'\n svg.sub(/(<svg)(.*?)(>)/, ratio + blur)\n .gsub(/(<g)/, '<g filter=\"url(#b)\"')\n end", "def blur_image(distance)\r\n @length = @image.length\r\n @width = 0\r\n @image.each do |x|\r\n x.each do |cell|\r\n @width += 1\r\n end\r\n end\r\n i = 0\r\n j = 0\r\n n = distance\r\n while n > 0\r\n i = 0\r\n j = 0 \r\n while i < @length\r\n j = 0\r\n while j < @width\r\n if @image[i][j] == 1\r\n\r\n # This looks down from the rows\r\n if i < @length - 1\r\n if @image[i+1][j] == 0\r\n @image[i+1][j] = 2\r\n end\r\n end\r\n\r\n # This looks up from the rows\r\n if i > 0 && @image[i-1][j] == 0\r\n @image[i-1][j] = 2 \r\n end\r\n\r\n # This looks to the right until it gets to the end.\r\n if @image[i][j+1] == 0\r\n @image[i][j+1] = 2\r\n end\r\n\r\n # This looks to te left. I tried to set this so it will never look over the side of the array.\r\n # I'm afraid of what might happen if my program does that too muc.\r\n if j > 0 && @image[i][j - 1] == 0\r\n @image[i][j - 1] = 2\r\n end\r\n end\r\n j += 1\r\n end\r\n i += 1\r\n end\r\n # This code goes back through the array and turns the temporary shade values into 1s for output.\r\n i = 0\r\n j = 0\r\n while i < @length\r\n j = 0\r\n while j < @width\r\n if @image[i][j] == 2\r\n @image[i][j] = 1\r\n end\r\n j += 1\r\n end\r\n i += 1\r\n end\r\n n -= 1\r\n puts n\r\n end\r\n \r\n puts \"Inside blur_image\\n\"\r\n puts \"\\n\"\r\n end", "def gaussian_elimination(ary)\n lead = 0\n rows = ary.size\n cols = ary[0].size\n rary = convert_to(ary, :to_r) # use rational arithmetic\n rows.times do |r|\n i = r\n # swap rows i and r \n rary[i], rary[r] = rary[r], rary[i]\n # normalize row r\n v = rary[r][lead]\n rary[r].collect! {|x| x / v}\n # reduce other rows\n rows.times do |i|\n next if i == r\n v = rary[i][lead]\n rary[i].each_index {|j| rary[i][j] -= v * rary[r][j]}\n end\n lead += 1\n end\n rary.each do |row|\n p row.last\n end\n end", "def blur!(distance = 1) #needs the !, is a bang, syntax is telling that is going to change the state of what we are operating on.\r\n distance.times do #looping for distance\r\n\r\n blur_pixels = coords # accessing array from previous method\r\n @array.each_with_index do |row, row_int|\r\n row.each_with_index do |int, col_index|\r\n blur_pixels.each do |row_int_coord, col_index_coord|\r\n\r\n if row_int == row_int_coord && col_index == col_index_coord\r\n # left of 1\r\n @array[row_int][col_index -1] = 1 unless col_index == 0\r\n # right of 1\r\n @array[row_int][col_index +1] = 1 unless col_index >= @col_length-1\r\n # above 1\r\n @array[row_int -1][col_index] = 1 unless row_int == 0\r\n # below 1\r\n @array[row_int +1][col_index] = 1 unless row_int >= @row_length-1\r\n end\r\n end\r\n end\r\n end\r\n end\r\n end", "def smoothing\n 0.9\n end", "def glow(dx=0.0, dy=0.0, a=2.0/3.0, blur=5)\n color = CGColorCreate(@colorspace, [1.0, 1.0, 0.0, a])\n CGContextSetShadowWithColor(@ctx, [dx, dy], blur, color)\n end", "def recursive_blur(start, things_to_blur)\n visited_array = [start]\n create_cross_array(start).each do |cross_point|\n recursive_blur_impl(start, cross_point, things_to_blur, visited_array)\n end\n end", "def saturation\n filter.cardinality / filter.size.to_f\n end", "def toaster_filter\n manipulate! do |img|\n img.modulate '150,80,100'\n img.gamma 1.1\n img.contrast\n img.contrast\n img.contrast\n img.contrast\n img = yield(img) if block_given?\n img\n end\n end", "def makeFilterKernel(radius, writeKernel=false)\n r = radius\n\n kernelDim = (r.ceil*2 + 1).ceil\n center = r.ceil\n #puts kernelDim\n weightSum = 0\n filterKernel = Array.new(kernelDim) {Array.new(kernelDim,0)}\n for i in (0 ... kernelDim)\n for j in (0 ... kernelDim)\n dist = Math.sqrt((i-(center))**2+(j-(center))**2)\n if dist <= r\n weight = 1.0\n elsif (dist-r < 1.0) && (dist-r > 0.0)\n weight = 1 - (dist - r)\n else\n weight = 0.0\n end\n weightSum += weight\n filterKernel[i][j] = weight\n end\n end\n #puts weightSum\n #Normalize weights to conserve energy\n for i in (0 ... kernelDim)\n for j in (0 ... kernelDim)\n filterKernel[i][j] /= weightSum\n end\n end\n if writeKernel\n png = ChunkyPNG::Image.new(kernelDim,kernelDim,ChunkyPNG::Color.rgba(0,0,0,255))\n for x in (0 ... kernelDim)\n for y in (0 ... kernelDim)\n gs = ((filterKernel[y][x])*255*weightSum).round\n #puts gs\n png.set_pixel(x,y,ChunkyPNG::Color.rgb(gs,gs,gs))\n\n end\n end\n png.save(\"Disc.png\", :fast_rgba)\n end\n return filterKernel\nend", "def recursive_blur_impl(start, current, things_to_blur,visited_array)\n if visited_array.include?(current)\n return\n else\n visited_array.push(current)\n end\n inbounds?(current)\n unless inbounds?(current)\n return\n end\n dist_between_start_to_current = (start.x - current.x).abs + (start.y - current.y).abs\n if dist_between_start_to_current > @manhan_dist\n return\n end\n things_to_blur.push(current)\n create_cross_array(current).each do |cross_point|\n recursive_blur_impl(start, cross_point, things_to_blur, visited_array)\n end\n end", "def blur\n `#@native.blur()`\n end", "def transform(manHatDist)\r\n\t\tpixel_on = []\r\n\t\tmanHatDist.times do\r\n\t\t@image.each.with_index do |row, row_index|\r\n\t\t\trow.each.with_index do |pixel, col_index|\r\n\t\t\t\tif pixel == 1\r\n\t\t\t\t\tpixel_on.push [row_index, col_index]\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\tpixel_on.each do |touple|\r\n\t\t\t#blur(*touple)\r\n\t\t\trow_index, col_index = touple\r\n\t\t\tblur(row_index, col_index)\r\n\t\tend\r\n\tend\r\n\tend", "def blur=(theBlur)\n @shadowHash[:blur] = theBlur\n end", "def filter_motion_blur_with_http_info(radius, sigma, angle, image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilterApi.filter_motion_blur ...'\n end\n # verify the required parameter 'radius' is set\n if @api_client.config.client_side_validation && radius.nil?\n fail ArgumentError, \"Missing the required parameter 'radius' when calling FilterApi.filter_motion_blur\"\n end\n # verify the required parameter 'sigma' is set\n if @api_client.config.client_side_validation && sigma.nil?\n fail ArgumentError, \"Missing the required parameter 'sigma' when calling FilterApi.filter_motion_blur\"\n end\n # verify the required parameter 'angle' is set\n if @api_client.config.client_side_validation && angle.nil?\n fail ArgumentError, \"Missing the required parameter 'angle' when calling FilterApi.filter_motion_blur\"\n end\n # verify the required parameter 'image_file' is set\n if @api_client.config.client_side_validation && image_file.nil?\n fail ArgumentError, \"Missing the required parameter 'image_file' when calling FilterApi.filter_motion_blur\"\n end\n # resource path\n local_var_path = '/image/filter/blur/motion/{radius}/{sigma}/{angle}'.sub('{' + 'radius' + '}', radius.to_s).sub('{' + 'sigma' + '}', sigma.to_s).sub('{' + 'angle' + '}', angle.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/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['imageFile'] = image_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilterApi#filter_motion_blur\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def optimized_image(image,x,y)\n return image.variant(resize_to_fill: [x,y]).processed\n end", "def gaussian(mean, stddev)\n theta = 2 * Math::PI * Kernel.rand\n rho = Math.sqrt(-2 * Math.log(1 - Kernel.rand))\n scale = stddev * rho\n x = mean + scale * Math.cos(theta)\n # y = mean + scale * Math.sin(theta)\n return x\n end", "def blur_url\n is_processed ?\n FileSystem.url(blur_path) : \n orig_image_url\n end", "def box_mueller( mean = 0.0, stddev = 1.0 )\n x1 = 0.0, x2 = 0.0, w = 0.0\n\n until w > 0.0 && w < 1.0\n x1 = 2.0 * rand - 1.0\n x2 = 2.0 * rand - 1.0\n w = ( x1 * x2 ) + ( x2 * x2 )\n end\n\n w = Math.sqrt( -2.0 * Math.log( w ) / w )\n r = x1 * w\n\n mean + r * stddev\nend", "def smoothing=(_arg0); end", "def smooth\n if @options.has_key?(:dot_values) && @options[:dot_values] != false\n dot_size = @options.has_key?(:dot_size) ? @options[:dot_size].to_f : 2\n else\n dot_size = 0\n end\n step = @options[:step].to_f\n height = @options[:height].to_f + (dot_size)\n width = ((@norm_data.size - 1) * step + (dot_size * 2) + 2).to_f\n\n background_color = @options[:background_color]\n create_canvas(width, height, background_color)\n\n min_color = @options[:min_color]\n max_color = @options[:max_color]\n last_color = @options[:last_color]\n has_min = @options[:has_min]\n has_max = @options[:has_max]\n has_last = @options[:has_last]\n line_color = @options[:line_color]\n has_std_dev = @options[:has_std_dev]\n std_dev_color = @options[:std_dev_color]\n\n target = @options.has_key?(:target) ? @options[:target].to_f : nil\n target_color = @options[:target_color] || 'white'\n\n\n\n drawstddevbox(width,height,std_dev_color) if has_std_dev == true\n\n # @draw.stroke_antialias(false)\n # @draw.stroke_width = 2\n @draw.stroke(line_color)\n coords = []\n i=0\n @norm_data.each do |r|\n if i == 0\n i += dot_size\n end\n\n coords.push [ i, (height - (dot_size / 2.0) - 3 - r/(101.0/(height-4-(dot_size)))) ]\n i += step\n end\n\n if @options[:underneath_color]\n closed_polygon(height, width, coords, dot_size)\n @draw.stroke(line_color)\n open_ended_polyline(coords)\n else\n open_ended_polyline(coords)\n end\n\n unless target.nil?\n normalized_target_value = ((target.to_f - @minimum_value)/(@maximum_value - @minimum_value)) * 100.0\n # adjusted_target_value = (height - 3 - normalized_target_value/(101.0/(height-4))).to_i\n adjusted_target_value = (height - (dot_size / 2.0) - 3 - normalized_target_value/(101.0/(height-4-(dot_size)))).to_i\n @draw.stroke(target_color)\n\n if @options[:dot_values] == false\n open_ended_polyline([[-5, adjusted_target_value], [width + 5, adjusted_target_value]])\n else\n open_ended_polyline([[coords.first.first, adjusted_target_value], [coords.last.first, adjusted_target_value]])\n end\n end\n\n if @options[:dot_values] != false\n @draw.fill('black')\n @draw.stroke('black')\n # Rails.logger.debug { \"coords.length = #{coords.length}\" }\n coords.each_with_index do |coord, i|\n # Rails.logger.debug { \"coord = #{coord.inspect}\" }\n @draw.ellipse(coord[0], coord[1], dot_size, dot_size, 0, 360) unless @data[i] > @maximum_value\n end\n @draw.stroke(line_color)\n end\n\n if @options[:dot_values] == false\n drawbox(coords[@norm_data.index(@norm_data.min)], 2, min_color) if has_min == true\n drawbox(coords[@norm_data.index(@norm_data.max)], 2, max_color) if has_max == true\n drawbox(coords[-1], 2, last_color) if has_last == true\n else\n draw_circle(coords[@norm_data.index(@norm_data.min)], dot_size, min_color) if has_min == true\n draw_circle(coords[@norm_data.index(@norm_data.max)], dot_size, max_color) if has_max == true\n draw_circle(coords[-1], dot_size, last_color) if has_last == true\n end\n\n @draw.draw(@canvas)\n @canvas\n end", "def enhance_image(image)\n colors = image.get_pixels.flatten\n colors.map! { |color| color**2 / 255 }\n blob = colors.pack('C*') # Recreate the original image, credit to stackoverflow.com/questions/53764046\n image = MiniMagick::Image.import_pixels(blob, image.width, image.height, 8, 'rgb')\n image.statistic('mean', '6x6')\n image.threshold(threshold_percent)\n image.statistic('median', '9x9') # Replace with object discard below set size\n end", "def sobel_filter(params = {})\n params[:name] ||= @pictureName.gsub('.png', 'SobelFilter.png')\n params[:save] ||= @picturePath\n \n sobelFilterX = [\n [1, 2, 1], \n [0, 0, 0], \n [-1, -2, -1]\n ]\n sobelFilterY = [\n [-1, 0, 1], \n [-2, 0, 2], \n [-1, 0, 1]\n ]\n \n height, width = @height-2, @width-2\n sobelPic = dup\n\n (1..height).each do |j|\n (1..width).each do |i|\n pixel1 = calculate_pixel_value_with_filter3(sobelFilterX, @picture, i, j, true)\n pixel2 = calculate_pixel_value_with_filter3(sobelFilterY, @picture, i, j, true)\n res = Math.sqrt(pixel1[0] * pixel1[0] + pixel2[0] * pixel2[0])\n sobelPic[i, j] = ChunkyPNG::Color.rgb(res.to_i, res.to_i, res.to_i)\n end\n end\n \n sobelPic.picturePath, sobelPic.pictureName = params[:save], params[:name]\n sobelPic\n end", "def clip_grads(grads, max_norm)\n total_norm = grads.reduce(0) do |total, grad|\n total + (grad**2).sum\n end\n\n total_norm = Numo::SFloat::Math.sqrt(total_norm)\n\n rate = max_norm / (total_norm + 1e-6)\n\n grads.each { |grad| grad.inplace * rate } if rate < 1\nend", "def vscale(factor)\n @height = @height * factor\n @top *= factor\n self\n end", "def glow(color, opacity = 35, keep = true)\n return false if !self.bitmap\n temp_bmp = self.bitmap.clone\n self.color = color\n self.blur_sprite(3,opacity)\n src = self.bitmap.clone\n self.bitmap.clear\n self.bitmap.stretch_blt(Rect.new(-0.005*src.width,-0.015*src.height,src.width*1.01,1.02*src.height),src,Rect.new(0,0,src.width,src.height))\n self.bitmap.blt(0,0,temp_bmp,Rect.new(0,0,temp_bmp.width,temp_bmp.height)) if keep\n end", "def glow(color, opacity = 35, keep = true)\n return false if !self.bitmap\n temp_bmp = self.bitmap.clone\n self.colorize(color)\n self.blur_sprite(3,opacity)\n src = self.bitmap.clone\n self.bitmap.clear\n self.bitmap.stretch_blt(Rect.new(-0.005*src.width,-0.015*src.height,src.width*1.01,1.02*src.height),src,Rect.new(0,0,src.width,src.height))\n self.bitmap.blt(0,0,temp_bmp,Rect.new(0,0,temp_bmp.width,temp_bmp.height)) if keep\n end", "def gaussian(mean, stddev)\n theta = 2 * Math::PI * rand\n rho = Math.sqrt(-2 * Math.log(1 - rand))\n scale = stddev * rho\n [mean + scale * Math.cos(theta), mean + scale * Math.sin(theta)]\nend", "def sigma(array)\n Math.sqrt(variance(array))\nend", "def scale(factor_x, factor_y, around_x, around_y, &rendering_code); end", "def filter_emboss(radius, sigma, image_file, opts = {})\n data, _status_code, _headers = filter_emboss_with_http_info(radius, sigma, image_file, opts)\n data\n end", "def processSamplesKoef(samples, koef)\r\n v_n_1, v_n_2 = kernel(samples, koef, 0, 0)\r\n dBm(koef, v_n_1, v_n_2, samples.length)\r\n end", "def shadow(dx=0.0, dy=0.0, a=2.0/3.0, blur=5)\n color = CGColorCreate(@colorspace, [0.0, 0.0, 0.0, a])\n CGContextSetShadowWithColor(@ctx, [dx, dy], blur, color)\n end", "def wiggle_max\n 0.5\n end", "def traitementMonochrome()\n return @image = @image.quantize(2, GRAYColorspace)\n end", "def scale(value)\r\n value * @height/2 + @height/4\r\n end", "def draw_bitmap_bg\n self.bitmap.gradient_fill_rect(padding, padding, base_width,\n base_height, color1, color2)\n self.bitmap.blur\n self.bitmap.blur\n end", "def draw_bitmap_bg\n self.bitmap.gradient_fill_rect(padding, padding, base_width,\n base_height, color1, color2)\n self.bitmap.blur\n self.bitmap.blur\n end", "def boost\n @shape.body.apply_force((@shape.body.a.radians_to_vec2 * (3000.0)), CP::Vec2.new(0.0, 0.0))\n end", "def bgsave; end", "def bgsave; end", "def monochrome! \n\t\treturn @image = @image.quantize(2, Magick::GRAYColorspace) \n\tend", "def binarize id\n m_begin \"binarize\"\n put_image(id, get_image(id).bilevel_channel(QuantumRange/2))\n# put_image(id, @var_table[id].quantize(2, GRAYColorspace, NoDitherMethod) )\n m_end \"binarize\"\n end", "def gaussian\n\n temp_matrix = @matrix\n temp_matrix = GaussJordan::calc(temp_matrix)\n Displayable::results_table(GaussJordan::get_results(temp_matrix))\n\n end", "def scale_bilinear(*args)\n @source = BilinearScaler.new(@source, *args)\n self\n end", "def send_blurbs \\\n parent,\n blurb,\n options: nil,\n &block\n request = {\n parent: parent,\n blurb: blurb\n }.delete_if { |_, v| v.nil? }\n request = Google::Gax.to_proto request, Google::Showcase::V1alpha3::CreateBlurbRequest\n @send_blurbs.call(request, options, &block)\n end", "def softmax x\n exps = x.map {|el| Math.exp(el)}\n normaliser = exps.inject(0,:+)\n return exps / normaliser\n end", "def normalize\n resize(1.0)\n end", "def fog\n ( words_per_sentence + percent_fog_complex_words ) * 0.4\n end", "def blend(color2, weight)\n end", "def search_blurbs \\\n query,\n parent,\n page_size,\n page_token,\n options: nil,\n &block\n request = {\n query: query,\n parent: parent,\n page_size: page_size,\n page_token: page_token\n }.delete_if { |_, v| v.nil? }\n request = Google::Gax.to_proto request, Google::Showcase::V1alpha3::SearchBlurbsRequest\n @search_blurbs.call(request, options, &block)\n end", "def blur(node)\n trigger(node, 'blur')\n\n Capybara.current_session.execute_script(\"document.body.click()\")\n end", "def coords\r\n blur_pixels = []\r\n # blur_pixels is the array, and then we need to fill it\r\n @array.each_with_index do |row, row_int| #nested loops\r\n row.each_with_index do |int, col_index| # iterating over integers in arrays \r\n if int == 1 #1 is the number we are using as the culprit in our blur\r\n blur_pixels << [row_int, col_index] # << is pushing into the blur_pixels array\r\n end\r\n end\r\n end\r\n blur_pixels\r\n end", "def scale(factor_x, factor_y=factor_x, &rendering_code); end", "def update!(**args)\n @noise_sigma = args[:noise_sigma] if args.key?(:noise_sigma)\n end", "def resize!(w, h, resample = true)\n ptr = self.class.create_image_ptr(w, h, false)\n ::GD2::GD2FFI.send(resample ? :gdImageCopyResampled : :gdImageCopyResized,\n ptr, image_ptr, 0, 0, 0, 0, w.to_i, h.to_i, width.to_i, height.to_i)\n alpha_blending = alpha_blending?\n init_with_image(ptr)\n self.alpha_blending = alpha_blending\n self\n end", "def do_redeye(eye,pixbuf)\n\n #\n # we remove redeye within a circular region called the \"effect\n #extent.\" the effect extent is inscribed within its \"bounding\n #rectangle.\" */\n\n # /* for each scanline in the top half-circle of the effect extent,\n # compute the number of pixels by which the effect extent is inset\n #from the edges of its bounding rectangle. note that we only have\n #to do this for the first quadrant because the second quadrant's\n #insets can be derived by symmetry */\n r = eye.radius\n x_insets_first_quadrant = Array.new(eye.radius + 1)\n\n i = 0\n r.step(0,-1) do |y|\n theta = Math.asin(y.to_f / r)\n x = (r.to_f * Math.cos(theta) + 0.5).to_i\n x_insets_first_quadrant[i] = eye.radius - x\n i = i + 1\n end\n\n x_bounds_min = eye.x - eye.radius\n x_bounds_max = eye.x + eye.radius\n ymin = eye.y - eye.radius\n ymin = (ymin < 0) ? 0 : ymin\n ymax = eye.y\n ymax = (ymax > (pixbuf.height - 1)) ? (pixbuf.height - 1) : ymax\n\n #/* iterate over all the pixels in the top half-circle of the effect\n #extent from top to bottom */\n inset_index = 0\n ymin.upto(ymax) do |y_it|\n xmin = x_bounds_min + x_insets_first_quadrant[inset_index]\n xmin = (xmin < 0) ? 0 : xmin\n xmax = x_bounds_max - x_insets_first_quadrant[inset_index]\n xmax = (xmax > (pixbuf.width - 1)) ? (pixbuf.width - 1) : xmax\n\n xmin.upto(xmax) { |x_it| red_reduce_pixel(pixbuf,x_it, y_it) }\n inset_index += 1\n end\n\n #/* iterate over all the pixels in the bottom half-circle of the effect\n #extent from top to bottom */\n ymin = eye.y\n ymax = eye.y + eye.radius\n inset_index = x_insets_first_quadrant.length - 1\n ymin.upto(ymax) do |y_it|\n xmin = x_bounds_min + x_insets_first_quadrant[inset_index]\n xmin = (xmin < 0) ? 0 : xmin\n xmax = x_bounds_max - x_insets_first_quadrant[inset_index]\n xmax = (xmax > (pixbuf.width - 1)) ? (pixbuf.width - 1) : xmax\n\n xmin.upto(xmax) { |x_it| red_reduce_pixel(pixbuf,x_it, y_it) }\n inset_index -= 1\n end\n end", "def blur!\n self.update_attribute :focus, 0\n end", "def gaussian_rand\n u1 = u2 = w = g1 = g2 = 0 # declare\n begin\n u1 = 2 * rand - 1\n u2 = 2 * rand - 1\n w = u1 * u1 + u2 * u2\n end while w >= 1\n\n w = Math::sqrt( ( -2 * Math::log(w)) / w )\n g2 = u1 * w;\n g1 = u2 * w;\n # g1 is returned\nend", "def bsa\n Math.sqrt( height.to_f * weight.to_f / 3131.0 )\n end", "def convolute(kernel)\n newimg = Pixmap.new(@width, @height)\n pb = ProgressBar.new(@width) if $DEBUG\n @width.times do |x|\n @height.times do |y|\n apply_kernel(x, y, kernel, newimg)\n end\n pb.update(x) if $DEBUG\n end\n pb.close if $DEBUG\n newimg\n end", "def strauss; end", "def output_image\n @image_blur_array.each do |row|\n puts row.join\n end\n end", "def setup\n size 640, 360\n color_mode HSB, 360\n no_stroke \n @bar_width = 20\n @saturation = Array.new( width/@bar_width, 0 ) \nend" ]
[ "0.751358", "0.7302044", "0.72393376", "0.6892252", "0.64835423", "0.6427895", "0.63179076", "0.63013244", "0.61639744", "0.6075544", "0.6041545", "0.59765434", "0.5965929", "0.5853831", "0.5837533", "0.5770856", "0.5758252", "0.5753721", "0.5753721", "0.5745598", "0.5712398", "0.5662743", "0.5652451", "0.56288224", "0.56051826", "0.55984664", "0.5574386", "0.5564051", "0.55629814", "0.55239475", "0.5483564", "0.5473308", "0.541921", "0.5378463", "0.5363095", "0.5320756", "0.52736604", "0.5261164", "0.51346695", "0.50886285", "0.50730985", "0.5062098", "0.5049553", "0.5001151", "0.4989138", "0.49661517", "0.49341005", "0.49122667", "0.48601425", "0.48225257", "0.47351545", "0.46835953", "0.4632802", "0.4627272", "0.45859838", "0.45834357", "0.45832658", "0.4574804", "0.45358488", "0.44887316", "0.44284946", "0.4422117", "0.4413154", "0.44125566", "0.44074142", "0.44072643", "0.43899792", "0.43548942", "0.4343115", "0.4314938", "0.43046436", "0.42924738", "0.42922652", "0.42922652", "0.4291389", "0.42889595", "0.42889595", "0.42856246", "0.42789084", "0.42740494", "0.42720354", "0.42520043", "0.42464572", "0.4243612", "0.42435485", "0.42360878", "0.4234718", "0.42330325", "0.42282632", "0.42181644", "0.42141956", "0.42072386", "0.42036366", "0.42019737", "0.41966382", "0.4188071", "0.41815102", "0.41673908", "0.4138077", "0.4135945" ]
0.7168541
3
Is just ownerreceiver comunication, so the receiver is who is not the caller (current_owner).
def receivers_for(wui) if wui.user == current_owner wui.users.map(&:id) else [wui.user_id] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opposite_member(user)\n user == sender ? receiver : sender\n end", "def owner\n class << receiver; self; end\n end", "def not_current_person(message)\n message.sender == current_person ? message.recipient : message.sender\n end", "def owned?\n @owner == caller\n end", "def recipient(current_user)\n \tself.sender_id == current_user.id ? self.receiver : self.sender\n \tend", "def not_current_user(message)\n\t\tmessage.sender == current_user ? message.recipient : message.sender\n\tend", "def from_admin?\n if self.sender == self.receiver\n true\n else\n false\n end\n end", "def sender? usr\n usr.id == user_id\n end", "def other_user(user)\n user == sender ? recipient : sender\n end", "def receiver\n users[0].id.eql?(sent_by) ? users[1] : users[0]\n end", "def originator\n @originator ||= original_message.sender\n end", "def routine_owner\n record.user == user\n end", "def self_receiver?\n receiver&.self_type?\n end", "def is_owner\n object == current_user\n end", "def receiver\n nil\n end", "def receiver\n self.kase.person if self.kase\n end", "def originator\n @originator = self.original_message.sender if @originator.nil?\n return @originator\n end", "def with(current_user)\n \tsender == current_user ? recipient : sender\n\tend", "def other_user(user)\n message = self.messages.first\n message.sender == user ? message.recipient : message.sender\n # I FEEL THIS METHOD COULD BE REWRITTEN IN A MORE EFFICIENT AND SUGAR WAY\n end", "def is_owner?\n Account.current ? Account.current.has_owner?(self) : false\n end", "def receive_sender sender\n true\n end", "def receive_sender sender\n true\n end", "def receive_sender sender\n true\n end", "def with(current_user)\n author == current_user ? receiver : author\n end", "def originator\n self.user ? self.user.name : NOT_SET\n end", "def current_owner\n # e.g. \"self.current_user\"\n send \"current_#{Tellimus.subscriptions_owned_by}\"\n end", "def sender?\n !!self.sender\n end", "def current_receiver\n @current_receiver ||= Receiver.find_by(id: session[:receiver_id])\n end", "def accepted_receiver\n self.receiver ||= if accepted_response = self.responses.accepted.first\n accepted_response.person\n end\n end", "def ignored?\n self.friendship_status == IGNORED\n end", "def receivers?(other_user)\n\t\treceivers.include?(other_user)\n\tend", "def sent_to_or_cc_me\n return @sent_to_or_cc_me\n end", "def is_owner_of?(thing)\n return false unless thing.user == self\n true\n end", "def self_contact\n credit? ? sender : recipient\n end", "def owned_by?(actor)\n # defaults to false. Override if resource has owner\n false\n end", "def sender\n @sender ||= User.find( @sender_id )\n end", "def receiver_by_author\n receiver = project.find_receiver(\n project.team_by_user(user_author.username), 'slack'\n )\n project.find_receiver(user_author.team, 'slack') unless receiver\n\n receiver\n end", "def owned_by?(peer_id)\n if peer_id == local_owner_id\n self_owned?\n else\n owners.include?(peer_id)\n end\n end", "def owner\n method_object && method_object.owner\n end", "def party_owner\n if !self.account_id.nil?\n self.account.name\n elsif !self.vendor_id.nil?\n self.vendor.name\n elsif !self.user_id.nil?\n \"Personal Contact\"\n else\n \"-\"\n end\n end", "def owned?\n !owner.nil?\n end", "def sender?\n !!self.sender\n end", "def other_party_name(current_user_id)\n return receiver.name if current_user_id == sender_id\n sender.name\n end", "def owner\n if object.owner && (current_user.lead? || object.owner.id == current_user.id)\n object.owner.id\n else\n nil\n end\n end", "def updated_by?(peer); self_owned? || (remote_siblings[peer] && peer.owns?(self)) end", "def owner?(current_user)\n user == current_user\n end", "def ignored?(other)\n\trelationship = get_relationship(other)\n\t\n\treturn relationship && relationship.friend_status == \"IGNORED\"\n end", "def owner\n if self.owner_id\n return Contact.find(self.owner_id)\n else\n return false\n end\n end", "def privacy_owner\r\n\t\t\tself.user\r\n\t\tend", "def last_is_from_buyer?\n not status.messages.where('messages.id != ?', id).order('created_at DESC').first.try(:from_owner?)\n end", "def receiver_cond(user = @current_user)\n \"receiver.run_id = #{user.run_id}\"\n end", "def owner?(user)\n\t\tuser.id == self.user.id\n\tend", "def subscription_owner\n # Return whatever we belong to.\n # If this object doesn't respond to 'name', please update owner_description.\n send Koudoku.subscriptions_owned_by\n end", "def subscription_owner\n # Return whatever we belong to.\n # If this object doesn't respond to 'name', please update owner_description.\n send Koudoku.subscriptions_owned_by\n end", "def is_owner?(user)\n !user.nil? && (self.user_id == user.id)\n end", "def is_owner?(user)\n user.id == self.user_id\n end", "def current_recipient_child\n (status == :accept_recip_child || status == :accepted_full ) ? requester : recipient\n end", "def bound?\n @receiver ? true : false\n end", "def authorized_by(user)\n user.id == self.sender_id\n end", "def owned_by?(u)\n self.user == u\n end", "def is_owner?(this_user)\n user == this_user\n end", "def own_shared_to?\r\n shared_to = self.shared_to_type.constantize.find(self.shared_to_id)\r\n shared_to.user_id == self.user_id ? true : false\r\n end", "def real_sender()\n\t\tself.received.last\n\tend", "def message_owner_side(message)\n if message.sender == current_user\n 'left'\n else\n 'right'\n end\n end", "def sender_user_id\n return @sender_user_id\n end", "def receiver_email\n nil\n end", "def is_peer_auditor?(user)\n (self.design.peer_id == user.id ||\n self.audit_teammates.detect { |t| t.user_id == user.id && !t.self? })\n end", "def owner? usr\n user_id == usr.id\n end", "def receiver\n receivers.first\n end", "def get_current_owner\n sd = get_security_descriptor\n\n sd&.owner\n end", "def user\n if scope.id == object.sender_user_id\n object.recipient_user\n else\n object.sender_user\n end\n end", "def owner\n @owner\n end", "def is_not_global_and_is_owned_by?(user)\n !self.is_global? && self.user_id == user.id\n end", "def receiver_email\n nil\n end", "def not_sent_to_me\n return @not_sent_to_me\n end", "def sent_only_to_me\n return @sent_only_to_me\n end", "def sent_by?(user)\n from_user_id == user&.id\n end", "def sender\n begin\n User.cached_find(self.sender_id)\n rescue\n nil\n end\n end", "def owner?(user)\n user == owner || owners.include?(user)\n end", "def copy_sender?(subscriber)\n false\n end", "def participates?(user)\n author == user || receiver == user\n end", "def other_user usr\n usr.id == user_id ? recipient : user\n end", "def current_request_child\n (status == :accept_recip_child || status == :accepted_full ) ? recipient : requester\n end", "def broadcast\n @monitor.__send__(:mon_check_owner)\n @cond.broadcast\n end", "def recurring_but_no_owner\n self.recurrence.present? && self.recurrence.owner != self\n end", "def receivable?\n at?(:active, :forget_initiated)\n end", "def send_confirmations_to_owner\n return @send_confirmations_to_owner\n end", "def owned_by?(current_user)\n current_user && user_id == current_user.id\n end", "def current_resource_owner\n return @current_resource_owner if defined?(@current_resource_owner)\n\n super\n end", "def recipent sender_id\n if user_1_id == sender_id\n recipent = user_2\n else\n recipent = user_1\n end\n end", "def owned?(user_to_check = current_user)\n user_to_check ? self.creator == user_to_check : false\n end", "def sender\n return @sender\n end", "def sender\n return @sender\n end", "def user_is_not_owner\n unless @likeable_obj.present? && @likeable_obj.user_id != current_user.id\n redirect_to @likeable_obj, notice: \"You cannot like your own dog... How sad...\"\n end\n end", "def exclude_sender_in_team_from_recognition_recipients\n sender_recipients = recognition_recipients.select {|rr| rr.user_id == sender&.id }\n if sender_recipients.any?{|rr| rr.team_id.present? } && sender_recipients.none?{|rr| rr.team_id.nil? }\n self.recognition_recipients = self.recognition_recipients.reject{|rr| rr.team_id.present? && rr.user_id == sender.id}\n end\n end", "def owner_of_recurrence\n self.recurrence.present? && self.recurrence.owner == self\n end", "def other_user_profile?\n !is_owner\n end", "def has_friend?(actor)\n return true if actor == self\n !self.contact_to!(actor).blocked && !actor.contact_to!(self).blocked\n end", "def receiver\n unless receivers.empty?\n receivers.first\n else\n nil\n end\n end", "def other_owner(other)\n @step.respond_to?(:real_owner) ? @step.real_owner(other) : other.owner\n end", "def owner? (user)\n user == owner\n end" ]
[ "0.70374143", "0.69292724", "0.6893946", "0.67730814", "0.6766993", "0.6723414", "0.66597974", "0.6653652", "0.6572377", "0.6539664", "0.64949304", "0.6439924", "0.64100397", "0.63993806", "0.6394945", "0.639408", "0.6339574", "0.6314801", "0.6305856", "0.6284311", "0.62839335", "0.62839335", "0.62839335", "0.6275255", "0.6260865", "0.623938", "0.62347496", "0.62170553", "0.6202076", "0.6197318", "0.61867374", "0.61732996", "0.6156963", "0.6126173", "0.61040795", "0.6103268", "0.61032224", "0.60930145", "0.6080651", "0.60766774", "0.607521", "0.607007", "0.6057483", "0.6054439", "0.60515386", "0.603813", "0.60374415", "0.6035276", "0.6031542", "0.602937", "0.6003943", "0.59904104", "0.5988094", "0.5988094", "0.5978923", "0.597444", "0.59717935", "0.59572506", "0.5941103", "0.59319407", "0.59281796", "0.5926536", "0.59220564", "0.59166765", "0.58978426", "0.58937824", "0.5891334", "0.58889514", "0.5885919", "0.5885778", "0.58849657", "0.58849555", "0.58827573", "0.58817255", "0.58814526", "0.58596915", "0.5853499", "0.5848296", "0.58438975", "0.5837449", "0.5830693", "0.5821218", "0.5820339", "0.58152765", "0.5812916", "0.581213", "0.5809198", "0.58065253", "0.58012253", "0.5798848", "0.57732356", "0.57649845", "0.57649845", "0.576288", "0.57550466", "0.5753744", "0.5752287", "0.5751291", "0.5750758", "0.57506055", "0.574564" ]
0.0
-1
Download the data from DEHEMS API
def index @message = "success" if Competition.has_started? time_now = Time.new #time_now = Time.parse("2011-02-14 00:01:00") #Download the weekly data and calculate points at the end of 7 day period. date_now = Date.parse(time_now.strftime('%Y/%m/%d')) competition_days = (date_now - Competition.get_start_date); week = competition_days/7 pointDataTest = MemberPoint.find(:first, :order => "week DESC") pointDataTestFlag = (pointDataTest == nil or (time_now.day != pointDataTest.created_at.day and time_now > pointDataTest.created_at)) if competition_days % 7 == 0 and pointDataTestFlag and week < 13 #Get all users. members = Member.find(:all) #Download data daily data for each user from yesterday if not yet downloaded. for member in members timestamp = Time.new.to_i #Download the stream id if not done yet. if member.stream_id == nil or member.stream_id == "" hashCode = generateHashCode(timestamp,member.mac) params = { :ap => DEHEMS::API_ID, :ts => timestamp, :householdId => member.mac, :dataStreamType => "AggregateElectricity", :hashCode => hashCode } res = Net::HTTP.post_form(URI.parse("#{DEHEMS::API_SERVER_ADDRESS}getDataStreamListJSON"),params) result = JSON.parse(res.body) member.stream_id = result["DataStreamList"][0]["StreamId"] member.save end #Download the data for the last 7 days. hashCode = generateHashCode(timestamp,member.stream_id) params = { :ap => DEHEMS::API_ID, :ts => timestamp, :streamId => member.stream_id, :resolution => "Day", :numberOfPoints => "7", :cum => "true", :endTime => time_now.to_i, :includeCurrentPeriod => "false", :hashCode => hashCode } res = Net::HTTP.post_form(URI.parse("#{DEHEMS::API_SERVER_ADDRESS}getDataStreamJSON"),params) result = JSON.parse(res.body) saving_day = 7 for kwhs in result["DataStream"] data = DailyData.new data.member_id = member.id data.total_kwh = kwhs.to_f data.sample_time = (time_now - saving_day.day) begin data.save end saving_day-=1 end end #Calculate and save points. teams = Team.find(:all) team_totals = {} for team in teams member_totals = {} members = Member.find(:all, :conditions => "team_id=#{team.id}") for member in members #Check that we have no zero readings the last 7 days. zeroReading = DailyData.find(:all, :conditions => "member_id=#{member.id} and total_kwh<0.1 and sample_time<='#{(date_now - 1.day)}' and sample_time>='#{(date_now - 7.day)}'", :order => "sample_time DESC") if zeroReading and zeroReading.size > 3 point = MemberPoint.new point.week = week point.member_id = member.id point.points = 0 begin point.save end else #Calculate total usage and save in the hash for week 1 and saving after that. if week == 1 weekly_average = DailyData.average("total_kwh", :conditions => "member_id=#{member.id} and total_kwh>0.1 and sample_time<='#{(date_now - 1.day)}' and sample_time>='#{(date_now - 7.day)}'") member_totals[member.id] = weekly_average.to_f else preZeroReading = DailyData.find(:all, :conditions => "member_id=#{member.id} and total_kwh<0.1 and sample_time<='#{(date_now - 8.day)}' and sample_time>='#{(date_now - 15.day)}'", :order => "sample_time DESC") if preZeroReading and preZeroReading.size > 3 point = MemberPoint.new point.week = week point.member_id = member.id point.points = 0 begin point.save end else weekly_average = DailyData.average("total_kwh", :conditions => "member_id=#{member.id} and total_kwh>0.1 and sample_time<='#{(date_now - 1.day)}' and sample_time>='#{(date_now - 7.day)}'") previous_weekly_average = DailyData.average("total_kwh", :conditions => "member_id=#{member.id} and total_kwh>0.1 and sample_time<='#{(date_now - 8.day)}' and sample_time>='#{(date_now - 15.day)}'") difference = previous_weekly_average.to_f-weekly_average.to_f if difference == 0 and previous_weekly_average.to_f-weekly_average.to_f == 0 member_totals[member.id] = 0 else member_totals[member.id] = difference/previous_weekly_average.to_f end end end end end member_totals_sorted = member_totals.sort {|a,b| a[1]<=>b[1]} if week > 1 member_totals_sorted = member_totals_sorted.reverse end member_count = 0 team_total = 0 points = CT::POINT_POOL_SIZE for value in member_totals_sorted #Write here the functionality to save the member points. point = MemberPoint.new point.week = week point.member_id = value[0] point.points = points begin point.save end points-=1 #Add to the team total. member_count+=1 team_total+=value[1] end #Calculate the team average and add into the hash. if member_count > 0 team_totals[team.id] = team_total/member_count else team_totals[team.id] = 100000 end end #Do not save team points from week 1 since there is not yet a comparison week data. if week > 1 team_totals_sorted = team_totals.sort {|a,b| a[1]<=>b[1]} team_totals_sorted = team_totals_sorted.reverse points = CT::TEAM_POINT_POOL_SIZE for value in team_totals_sorted point = TeamPoint.new point.week = week point.team_id = value[0] point.points = points begin point.save end points-=1 end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download\n @data = HeyDan::Helper.get_data_from_url(HeyDan.cdn + '/' + dataset_file_name)\n end", "def download\n api_url = build_url\n RestClient::Request.execute(method: 'GET', url: api_url, open_timeout: 20)\n end", "def download_data\n # Custom downloader functionality implementation, this is just a simplified example template\n $log.info 'Starting downloading data from the Dummy API.'\n entities = @metadata.list_entities\n results = []\n entities.each do |entity|\n entity_custom = entity.custom\n load_metadata entity, entity_custom['fields']\n start_date, end_date = get_date_interval(entity)\n results << [entity, download_data_range(entity, start_date, end_date)]\n end\n save_to_s3 results\n end", "def AxeDownload(download)\n uri = URI('https://axeweb.intel.com/axe/api/testlist/295/latest/combined')\n puts uri\n req = Net::HTTP::Get.new(uri)\n req.basic_auth 'autoclient', 'gr@ph1c$'\n \n if download\n print \"#{Time.now.strftime(\"%l:%M:%S %p\")} - Start download\\n\"\n res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|\n http.request(req)\n }\n #puts res.body\n \n unless res.kind_of? Net::HTTPSuccess\n puts \"Error downloading results from Axe\"\n exit(9)\n end\n open('result.json', 'wb') do |fileAXE|\n fileAXE << res.body\n end\n print \"#{Time.now.strftime(\"%l:%M:%S %p\")} - End download\\n\"\n end\nend", "def download_article_data\n print \"Getting list of articles...\\n\"\n ArticleGetter.new([ARTICLE_SOURCE]).result\n end", "def download(api_params)\n File.open(File.basename(api_params[:download_location]), 'wb') do |file|\n file.write(api_params[\"data\"])\n end\n end", "def download\n create_agent\n login\n fetch_feed\n create_catalog\n download_catalog\n end", "def download_ais(prog_id)\n return download_data(\"http://ais.channel4.com/asset/#{prog_id}\")\n end", "def download_people_data\n print \"Getting IDs of articles about people...\\n\"\n PeopleGetter.new([MEN_URL, WOMEN_URL]).result\n end", "def download_data\n puts 'Downloading data ...'\n\n cmd = \"wget --output-document=#{DATA_PATH} #{SFPD_DATA}\"\n system cmd\n end", "def download\n response = Clickmeetings.with_client(client_options) do\n Clickmeetings.client.connect.get remote_url(__method__, id: id) do |req|\n req.headers.merge! default_headers\n end\n end\n response.body\n end", "def download\n #require 'debugger'; debugger\n generator = Generator.where(id: params[:id], user_id: current_user.id).first\n send_file TerrainLib::Component.generate JSON.parse(generator.generator_hash)\n end", "def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end", "def download_from_device\n add_breadcrumb \"Waktu Kerja dan Lembur\", \"#absences\"\n add_breadcrumb \"Download Data Kehadiran Dari Alat Fingerprint\", \"#download_from_Device\"\n @fingerprint_device = FingerprintDevice.find_all_by_company_id(current_company_id)\n @download_process = DownloadDataLog.last(:conditions => {:company_id => current_company_id, :end_time => nil})\n render :layout => false\n end", "def download\n xml = load_eml.xpath('//eml:eml//dataset')\n unless xml.nil?\n bounding_coords = \"Geographic Boundary - Northern #{xml.xpath('coverage/geographicCoverage/boundingCoordinates/northBoundingCoordinate').text}, Eastern #{xml.xpath('coverage/geographicCoverage/boundingCoordinates/eastBoundingCoordinate').text}, Southern #{xml.xpath('coverage/geographicCoverage/boundingCoordinates/southBoundingCoordinate').text}, Western #{xml.xpath('coverage/geographicCoverage/boundingCoordinates/westBoundingCoordinate').text}\"\n contribs = []\n contribs << {\n identifiers: [xml.xpath('creator/electronicMailAddress').text],\n name: \"#{xml.xpath('creator/individualName/givenName').text} #{xml.xpath('creator/individualName/surName').text}\",\n email: xml.xpath('creator/electronicMailAddress').text,\n role: xml.xpath('creator/positionName').text,\n org: { name: xml.xpath('creator/organizationName').text }\n }\n contribs << {\n identifiers: [xml.xpath('metadataProvider/electronicMailAddress').text],\n name: \"#{xml.xpath('metadataProvider/individualName/givenName').text} #{xml.xpath('creator/individualName/surName').text}\",\n email: xml.xpath('metadataProvider/electronicMailAddress').text,\n role: xml.xpath('metadataProvider/positionName').text,\n org: { name: xml.xpath('metadataProvider/organizationName').text }\n }\n project_json = {\n source: 'biocode',\n identifiers: xml.xpath('alternateIdentifier').map{ |id| id.text },\n title: xml.xpath('title').text,\n license: xml.xpath('intellectualRights/para').text,\n description: \"#{xml.xpath('abstract/para').text}<br/>&nbsp;Coverage Area: #{xml.xpath('coverage/geographicCoverage/geographicDescription.text')}<br/>&nbsp;&nbsp;#{bounding_coords}\",\n publication_date: xml.xpath('pubDate').text,\n language: xml.xpath('language').text,\n contributors: contribs\n }\n end\n\n { projects: [project_json || nil] }\n end", "def download_asset(prog_id)\n return download_data(\"http://www.channel4.com/programmes/asset/#{prog_id}\")\n end", "def get_data_download(project_id, data_download_id)\n get \"projects/#{project_id}/datadownload/#{data_download_id}\"\n end", "def fetch_data(connection,path,definition)\n @definition=definition\n @headers = definition.data_headers\n @headers.delete_if {|x| x=='source'}\n @raw_headers=headers # headers are the full set here\n items = []\n page = 1\n while page <= AMEE::Data::Category.get(connection, \"/data#{path}\").pager.last_page do\n category = AMEE::Data::Category.get(connection, \"/data#{path}\", { 'page' => \"#{page}\" })\n category.items.each do |item|\n items << item\n end\n page += 1\n end\n parse_api_rows items\n end", "def get_surf_data\n url = \"http://magicseaweed.com/api/#{ENV['MAGIC_SEAWEED_API_KEY']}/forecast/?spot_id=6128&units=UK\"\n uri = URI(url)\n\n response = Net::HTTP.get(uri)\n ActiveSupport::JSON.decode(response) if response != ''\n end", "def download\n @doc = Nokogiri::HTML(open(@url))\n\tend", "def download(url)\n Net::HTTP.get_response(url)\n end", "def download\n storage.download(id)\n end", "def fetch_api_data\n addr = URI(API_URL)\n addr.query = URI.encode_www_form(form_params.transform_keys(&:to_s))\n\n data = JSON.parse(Net::HTTP.get(addr))\n\n @latest_report = {\n temp: data['main']['temp'].round.to_s + '&deg;',\n desc: data['weather'][0]['description'],\n icon: weather_icon(data['weather'][0]['icon'][0..-2].to_i),\n wind_speed: data['wind']['speed'].floor,\n wind_dir: compass_dir(data['wind']['deg'])\n }\n end", "def download(path)\n downloader.get do |req|\n req.url path\n end.body\n end", "def downloadEnsemble\n academic_year_id = AcademicYear.get_current_academic_year\n @academic_year = AcademicYear.find(academic_year_id)\n @ensembles = Ensemble.where(academic_year: academic_year_id)\n\n @ensembles = Ensemble.where(academic_year: academic_year_id).group_by(&:subject)\n set_document_rendering(true)\n end", "def download(url)\n filedl = url.split(\"/\").last\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n open(filedl, \"w\") do |file|\n file.write(response.body)\n end\n return filedl\nend", "def download!\n\t\traise_if_error C.glyr_opt_download(to_native, true)\n\tend", "def fetchInstallations(token)\n url = URI(\"https://api.acceptance.hertekconnect.nl/api/v1/installations\")\n\n http = Net::HTTP.new(url.host, url.port);\n http.use_ssl = true\n request = Net::HTTP::Get.new(url)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Authorization\"] = \"Bearer #{token}\"\n\n response = http.request(request)\n puts response.read_body\nend", "def call\n @response = connection.get(url)\n if status == 200\n context.file = save!\n else\n context.fail! message: \"Download failed\"\n end\n end", "def get_download\n\tend", "def download_link\n return_hash = {}\n if params.has_key?(\"web_ids\")\n web_ids_str = params[\"web_ids\"]\n web_ids = web_ids_str.split(\"~\")\n if !web_ids.respond_to?(:count) || web_ids.count < 1\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids after split\"\n render(json: return_hash.to_json, content_type: request.format, layout: false)\n end\n web_ids.each(&:strip!)\n parametrized_doi = @dataset.identifier.parameterize\n download_hash = DownloaderClient.datafiles_download_hash(@dataset, web_ids, \"DOI-#{parametrized_doi}\")\n if download_hash\n if download_hash[\"status\"] == \"ok\"\n web_ids.each do |web_id|\n datafile = Datafile.find_by(web_id: web_id)\n if datafile\n # Rails.logger.warn \"recording datafile download for web_id #{web_id}\"\n datafile.record_download(request.remote_ip)\n else\n # Rails.logger.warn \"did not find datafile for web_id #{web_id}\"\n end\n end\n return_hash[\"status\"] = \"ok\"\n return_hash[\"url\"] = download_hash[\"download_url\"]\n return_hash[\"total_size\"] = download_hash[\"total_size\"]\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = download_hash[\"error\"]\n end\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"nil zip link returned\"\n end\n render(json: return_hash.to_json, content_type: request.format, layout: false)\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids in request\"\n render(json: return_hash.to_json, content_type: request.format, layout: false)\n end\n end", "def download_response\n {\n url: external_download_url\n }.with_indifferent_access\n end", "def download_progguide(prog_guide_url)\n return download_data(\"http://www.channel4.com#{prog_guide_url}\")\n end", "def download\n URI.extract(json, ['http', 'https']).each do |url|\n get_asset(url)\n end\n\n json\n end", "def download(url)\n STDERR.print \"loading #{url}\"\n response = Faraday.get(url)\n STDERR.puts ' (done)'\n response.body\n end", "def download\n open(download_url, \"rb\")\n end", "def download\n # TODO: Find out why this is needed, should be handeled in ability.rb\n authorize! :read, params[:id]\n begin\n send_data @file.datastreams['content'].content, {:filename => @file.original_filename, :type => @file.mime_type}\n rescue ActiveFedora::ObjectNotFoundError => obj_not_found\n flash[:error] = 'The basic_files you requested could not be found in Fedora! Please contact your system administrator'\n logger.error obj_not_found.to_s\n render text: obj_not_found.to_s, status: 404\n rescue => standard_error\n flash[:error] = 'An error has occurred. Please contact your system administrator'\n logger.error standard_error.to_s\n render text: standard_error.to_s, status: 500\n end\n end", "def get_data_from_api\n # address1 = address.parameterize('+')\n # state1 = state.parameterize('+')\n # city1 = city.parameterize('+')\n# \trequest_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=#{address}%2C+#{city}%2C+#{state}%2C+#{zipcode}&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\" \n# \tcreates a url to access API data\n request_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=9+Melrose+Dr.%2C+Livingston%2C+NJ%2C+07039&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\"\n\tsample_response = HTTParty.get(request_string) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response.body, {:symbolize_names => true}) #makes data easy to read\n puts sample_parsedResponse[:officials][0][:name] \n puts sample_parsedResponse[:officials][0][:party] \n puts sample_parsedResponse[:officials][0][:phones] \n #returns first element in items array\n end", "def download_url(url)\n ethon = ethon_easy_requester\n ethon.url = uri_escape(url)\n ethon.perform\n check_and_raise_failure(ethon)\n {\n file_contents: ethon.response_body,\n link_url: last_location_header(ethon)\n }\n end", "def download_data\n subclass_must_define\n end", "def download_link\n return_hash = Hash.new\n if params.has_key?('web_ids')\n web_ids_str = params['web_ids']\n web_ids = web_ids_str.split('~')\n if !web_ids.respond_to?(:count) || web_ids.count < 1\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids after split\"\n render(json: return_hash.to_json, content_type: request.format, :layout => false)\n end\n web_ids.each(&:strip!)\n parametrized_doi = @dataset.identifier.parameterize\n download_hash = DownloaderClient.datafiles_download_hash(@dataset, web_ids, \"DOI-#{parametrized_doi}\")\n if download_hash\n if download_hash['status'] == 'ok'\n web_ids.each do |web_id|\n datafile = Datafile.find_by_web_id(web_id)\n if datafile\n #Rails.logger.warn \"recording datafile download for web_id #{web_id}\"\n datafile.record_download(request.remote_ip)\n else\n #Rails.logger.warn \"did not find datafile for web_id #{web_id}\"\n end\n end\n return_hash[\"status\"] = \"ok\"\n return_hash[\"url\"] = download_hash['download_url']\n return_hash[\"total_size\"] = download_hash['total_size']\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = download_hash[\"error\"]\n end\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"nil zip link returned\"\n end\n render(json: return_hash.to_json, content_type: request.format, :layout => false)\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids in request\"\n render(json: return_hash.to_json, content_type: request.format, :layout => false)\n end\n end", "def download_data\n file_content = nil\n begin\n file_content = FileContent.find(params[:id])\n rescue\n file_content = nil\n end\n\n # We need to figure out which groups are allowed to download this file content.\n # Unfortunately, this requires iterating through any referenced URLs and collecting\n # all applicable group_ids.\n group_ids = []\n if (!file_content.nil? &&\n !file_content.data.nil?)\n file_content.process_files.each do |process_file|\n if (!process_file.os_process.nil? &&\n !process_file.os_process.fingerprint.nil? &&\n !process_file.os_process.fingerprint.url.nil?)\n # Clear the cache, if need be.\n process_file.os_process.fingerprint.url.expire_caches\n group_ids << process_file.os_process.fingerprint.url.group_id\n end\n end\n group_ids.uniq!\n end\n\n if (!file_content.nil? &&\n !file_content.data.nil? &&\n (!group_ids.index(nil).nil? ||\n current_user.has_role?(:admin) ||\n ((current_user.groups.map{|g| g.is_a?(Group) ? g.id : g} & group_ids).size > 0)))\n send_file(RAILS_ROOT + '/' + file_content.data.to_s, :x_sendfile => true)\n else\n redirect_back_or_default('/')\n end\n end", "def download\n @queja = Queja.find(params[:id])\n send_file(@queja.evidencia.path)\n end", "def exchanges_ticker_data_download_with_http_info(request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CryptoApi.exchanges_ticker_data_download ...'\n end\n # verify the required parameter 'request' is set\n if @api_client.config.client_side_validation && request.nil?\n fail ArgumentError, \"Missing the required parameter 'request' when calling CryptoApi.exchanges_ticker_data_download\"\n end\n # resource path\n local_var_path = '/download_ticker'\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(request)\n auth_names = []\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 => 'InlineResponse201')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CryptoApi#exchanges_ticker_data_download\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def download\n # Retrieve \"file_id\" parameter.\n @file_id = params[:file_id]\n\n # Verify if the :file_id exists with the help of our StorageMock class.\n # This sample can only be executed if the provided file exists.\n unless exist?(@file_id)\n render text: 'Not Found', status: 404 && return\n end\n\n file_path = get_data_path(@file_id)\n\n # Check if doc already has a verification code registered on storage.\n verification_code = get_verification_code(@file_id)\n if verification_code.to_s.empty?\n # If not, generate a code and register it.\n verification_code = generate_verification_code\n set_verification_code(@file_id, verification_code)\n end\n\n # Generate the printer-friendly version.\n pfv_content = generate_printer_friendly_version(file_path, verification_code)\n # Return the generate file.\n send_data pfv_content, :filename => \"printer-friendly.pdf\"\n end", "def download\n if verb == :get\n body = get_http_content\n elsif verb == :post\n body = post_http_content\n end\n\n body\n end", "def meeting_recordings_download_file(download_url)\n raise \"You must use JWT client\" unless self.class == Zoom::Clients::JWT\n file=Tempfile.create\n file.binmode\n response = HTTParty.get(\"#{download_url}?access_token=#{access_token}\",\n stream_body: true,\n follow_redirects: true\n ) do |fragment|\n if fragment.code == 200\n file.write(fragment)\n elsif fragment.code != 302\n raise StandardError, \"Non-success status code while streaming #{fragment.code}\"\n end\n end\n file\n end", "def fetch()\n @result = open(@url,@headers)\n end", "def download_ce_attachment(server, submission_id, field_name)\n filepath = nil\n\n # Call the Kinetic Request CE API\n begin\n # Submission API Route including Values\n # /{spaceSlug}/app/api/v1/submissions/{submissionId}}?include=...\n submission_api_route = \"#{server}#{CE_API_ROUTE}/submissions/#{URI.escape(submission_id)}/?include=values\"\n puts(\"Core submission API Route: \\n#{submission_api_route}\") if @debug_logging_enabled\n \n # Retrieve the Submission Values\n submission_response = RestClient::Resource.new(\n submission_api_route,\n user: @info_values['ce_api_username'],\n password: @info_values['ce_api_password']\n ).get\n\n # If the submission exists\n unless submission_response.nil?\n puts(\"Core submission successfully retrieved\") if @debug_logging_enabled\n submission = JSON.parse(submission_response)['submission']\n field_value = submission['values'][field_name]\n # If the attachment field value exists\n unless field_value.nil?\n # Attachment field values are stored as arrays we assume only one attachment per field\n file_info = field_value[0]\n attachment_name = file_info[\"name\"]\n puts(\"Core attachment found: #{attachment_name}\") if @debug_logging_enabled\n attachment_download_api_route = server +\n CE_API_ROUTE +\n '/submissions/' + URI.escape(submission_id) +\n '/files/' + URI.escape(field_name) +\n '/' + '0' +\n '/' + URI.escape(attachment_name) +\n '/url'\n\n puts(\"Core attachment download URL: \\n#{attachment_download_api_route}\") if @debug_logging_enabled\n \n # Download file\n attachment_download_result = RestClient::Resource.new(\n attachment_download_api_route,\n user: @info_values['ce_api_username'],\n password: @info_values['ce_api_password']\n ).get()\n\n unless attachment_download_result.nil?\n # get the filehub url to download the file\n file_url = JSON.parse(attachment_download_result)['url']\n puts \"Core downloading attachment: #{file_info['name']} from #{file_url}\" if @debug_logging_enabled\n attachment_content = RestClient::Resource.new(\n file_url,\n user: @info_values['ce_api_username'],\n password: @info_values['ce_api_password']\n ).get()\n\n # escape the attachment name - may need to add more characters?\n escaped_attachment_name = attachment_name.gsub(/[&\"'%!@ ]/, \"\")\n # create a file in the temp directory with the downloaded content\n filepath = File.join(Dir::tmpdir, escaped_attachment_name)\n File.open(filepath, \"w\") { |f| f.write(attachment_content) }\n end\n end\n end\n # If the credentials are invalid\n rescue RestClient::Unauthorized\n raise StandardError, \"(Unauthorized): You are not authorized\"\n rescue RestClient::ResourceNotFound => error\n raise StandardError, error.response\n end\n \n if @debug_logging_enabled\n if filepath\n puts \"Core attachment #{attachment_name} retrieved\"\n puts \"Saved to: #{filepath}\"\n else\n puts \"No Core attachment returned\"\n end\n end\n\n return filepath\n end", "def download(limit=100, download_to=File.expand_path(\".\")+File::SEPARATOR+\"edgar_data\")\n items=@content[\"channel\"][0][\"item\"]\n items.each_with_index do |item, index|\n break if index==limit\n files=get_xbrl_files(item)\n download_to += File::SEPARATOR unless download_to.end_with?(File::SEPARATOR)\n data_dir=download_to\n data_dir=data_dir+File::SEPARATOR+item[\"xbrlFiling\"][0][\"cikNumber\"][0][\"content\"]\n data_dir=data_dir+File::SEPARATOR+item[\"xbrlFiling\"][0][\"accessionNumber\"][0][\"content\"]\n mkdir(data_dir)\n files.each do |file|\n file_content=open(file[\"edgar:url\"]).read\n dump_to_file(data_dir+File::SEPARATOR+file[\"edgar:file\"], file_content)\n end\n end\n end", "def get_data\n\t \thydra = Typhoeus::Hydra.hydra\n\n\t \tfirst_url = \"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22#{self.stock_ticker}%22)&format=json%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env\"\n\t \tsecond_url = \"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.keystats%20where%20symbol%20in%20(%22#{self.stock_ticker}%22)&format=json%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env\"\n\t \tthird_url = \"http://www.quandl.com/api/v1/datasets/DMDRN/#{self.stock_ticker}_ALLFINANCIALRATIOS.csv?auth_token=#{ENV['QUANDL_API_TOKEN']}\"\n\t \tfourth_url = \"http://www.quandl.com/api/v1/datasets/PSYCH/#{self.stock_ticker}_I.json?&auth_token=auth_token=#{ENV['QUANDL_API_TOKEN']}&trim_start=#{Chronic.parse(\"last week\").strftime(\"%F\")}&trim_end=#{Chronic.parse(\"today\").strftime(\"%F\")}&sort_order=desc\"\n\n\t \t(((first_url) =~ URI::DEFAULT_PARSER.regexp[:ABS_URI]) == 0) ? first_request = Typhoeus::Request.new(first_url) : (return false)\n\t \tsecond_request = Typhoeus::Request.new(second_url) \n\t \tthird_request = Typhoeus::Request.new(third_url) \n\t \tfourth_request = Typhoeus::Request.new(fourth_url) \n\n\t \thydra.queue first_request\n\t \thydra.queue second_request\n\t \thydra.queue third_request\n\t \thydra.queue fourth_request\n\t \t\n\t \thydra.run\n\n\t\t\tfirst_request.response.options[:response_code] == 200 ? first_response = first_request.response : (return false )\n\t \tsecond_response = second_request.response\n\t \tthird_response = third_request.response \n\t \tfourth_response = fourth_request.response\n\n\t \t@quotes = JSON.parse(first_response.body) if !first_response.body.nil?\n\n\t \t@key_stats = JSON.parse(second_response.body) \n\n\t \tthird_request.response.options[:response_code] == 200 ? @quandl_data = CSV.parse(third_response.body) : @quandl_data = nil\n\n\t \tfourth_request.response.options[:response_code] == 200 ? @psych_data = JSON.parse(fourth_response.body) : @psych_data = nil\n\n\t \t@tradier = $tradier_client.quote(self.stock_ticker)\n\n\t \tmethod(:assign_yahooQuotes).call\n\t \tmethod(:assign_yahooKeyStats).call\n\t \tmethod(:assign_quandlStockData).call\n\t \tmethod(:assign_quandlPsychData).call\n\t \tmethod(:assign_databaseValues).call\n\t \tmethod(:assign_stockProfile).call\n\t \tmethod(:assign_tradierQuote).call\n\n\t end", "def download_ror_file(url)\n return nil unless url.present?\n\n puts 'Downloading ROR data file...'\n\n headers = {\n host: 'zenodo.org',\n Accept: 'application/zip'\n }\n resp = HTTParty.get(url, headers: headers)\n unless resp.present? && resp.code == 200\n puts(\"Unable to fetch ROR file from Zenodo -- #{url} -- #{resp}\")\n return nil\n end\n resp.parsed_response\n end", "def download_image\n Net::HTTP.start(\"yuml.me\", 80) do |http|\n http.get(URI.escape(@diagram.get_uri))\n end\n end", "def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend", "def exec_api_download(json_req, download_path)\n begin\n req = sign_request(json_req)\n File.open(download_path, \"w\") do |io|\n return HttpChannel.new(api_uri).execute_download(req) { |d| io << d; d.length }\n end\n rescue Curl::Err::CurlError => ex\n return JsonResponse.new(\"fail\", ex.message)\n end\n end", "def download\n @extension = Extension.with_name(params[:extension]).first!\n @extension_version = @extension.get_version!(params[:version])\n\n ExtensionVersion.increment_counter(:api_download_count, @extension_version.id)\n Extension.increment_counter(:api_download_count, @extension.id)\n BonsaiAssetIndex::Metrics.increment('extension.downloads.api')\n\n redirect_to @extension_version.tarball.url\n end", "def download_iso\n IsoRepo.get(iso_url)\n end", "def download_sample_calib_file\t\n temp = [[\"Probes\", \"Intensity with 1ng\", \"Intensity with 5ng\", \"Intensity with 50ng\", \"Intensity with 100ng\"], [\"cell counts\",\"270\",\"1351\",\"6757\",\"27027\"], [\"EukS_1209_25_dT\",\"4102788.91290624\",\"1.68E+07\",\"2.62E+08\",\"5.41E+08\"], [\"Test15 (EukS_1209_25dT)\",\"3242670.65825\",\"1.99E+07\",\"3.92E+08\",\"3.73E+08\"],[\"EukS_328_25_dT\",\"4564828.4446875\",\"2.18E+07\",\"4.40E+08\",\"6.77E+08\"], [\"DinoB_25_dT\",\"7269595.08139062\",\"3.56E+07\",\"4.00E+08\",\"6.06E+08\"]]\n\n send_sample_file(\"sample_calibration_file\", temp) \n end", "def download\n @posts = PostService.getAllPosts\n respond_to do |format|\n format.html\n format.csv { send_data @posts.to_csv, :filename => \"Post List.csv\" }\n end\n end", "def start_download(blatt)\n\t File.open(\"/tmp/#{tractate_name}_#{blatt}.pdf\", \"wb\") do |f|\n f.write HTTParty.get(\"http://www.kolhalashon.com/imgs/Vilna/#{tractate_name}/#{tractate_name}_Amud_#{amud_conversion(blatt)}.pdf\").parsed_response\n end\n\tend", "def download(url)\n base.get(url, @file_path)\n end", "def fetch_data\n res = Net::HTTP.start(DATA_URI.host, DATA_URI.port) do |http|\n http.get(DATA_URI.path, 'USER_AGENT' => 'Nordea::Bank gem')\n end\n\n if res.code =~ /2\\d\\d/\n res.body\n else\n fail ServerError, 'The server did not respond in the manner in which we are accustomed to.'\n end\n end", "def download(key)\n service(key).download(key)\n end", "def download\r\n logger.info(\"UserController::download:---#{params}\")\r\n end", "def file_data\n @client.get_file @file_url\n end", "def access_api(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n file = File.open('bin/key.rb')\n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-host\"] = 'skyscanner-skyscanner-flight-search-v1.p.rapidapi.com'\n request[\"x-rapidapi-key\"] = file.read\n\n response = http.request(request).read_body\n response_hash = JSON.parse(response) \nend", "def download_data\n view = session[:view].dup if session[:view] # Copy session view, if it exists\n options = session[:paged_view_search_options].merge(:page => nil, :per_page => nil) # Get all pages\n view.table, _attrs = view.paged_view_search(options) # Get the records\n\n view.title = _(view.title.pluralize)\n view.headers.map! { |header| _(header) }\n\n case params[:download_type]\n when 'pdf' then download_pdf(view)\n when 'text' then download_txt(view, filename_timestamp(view.title))\n when 'csv' then download_csv(view, filename_timestamp(view.title))\n end\n end", "def downloadTBD\n\n #just do a collection!\n\n @players = Player.all\n @players.each do |player|\n @playerHash = downloadStat(player.yahoo_pid)\n end \n\n end", "def download\r\n redirect_to(explore_path) and return unless params[:id]\r\n # TODO: cipher this so that someone can't easily download all of the content\r\n @track = Track.downloadable.find_by_id(params[:id])\r\n if @track && @track.public? \r\n KarmaPoint.create_from_id(session[:karma_point_id], :content => @track, :action => :download)\r\n redirect_to @track.s3_url if @track.respond_to?(:s3_url)\r\n Activity.send_message(@track, @track.user, :content_download_initiated, :to_user => current_actor)\r\n else\r\n flash[:error] = 'Track not found or hidden'.t\r\n redirect_to(explore_path)\r\n end\r\n end", "def report_file1_download(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id, \"v1\" => \"true\" } \r\n\t\tfile=nessus_http_request('file/report/download', post)\r\n\t\treturn file\r\n\tend", "def request(url, api_key)\n rover = get_data(\"#{url}#{api_key}\")\n\n return rover\nend", "def download\n \n @tmpfile = fetch_remote(location)\n \n @fetched_at = Time.new\n \n return @tmpfile\n \n end", "def download_tide_data(type='predict', view='text', language='english')\n res = Net::HTTP.post_form(\n URI.parse(POST_URL),\n {\n 'station' => @station,\n 'year' => @date.year,\n 'month' => @date.month,\n 'day' => @date.day,\n 'TZ' => @timezone, # TODO use supplied date for timezone\n 'queryType' => type,\n 'view' => view,\n 'language' => language\n }\n )\n # TODO rescue request errors\n res.body\n end", "def fetch\n notify \"Downloading...\"\n @strategy.fetch\n extract\n end", "def swapi_fetch(url)\n JSON.parse(open(url).read)\nend", "def download(id, &block)\n get(\"/#{id}?download=true\") do |request, http|\n http.request(request) do |resp|\n case resp\n when Net::HTTPSuccess\n if block_given? then\n resp.read_body &block\n else\n resp.read_body do |chunk|\n $stdout.write chunk\n end\n end\n else\n showHttpError(request, response)\n raise resp\n end\n end\n nil\n end\n end", "def download\n @route.update_last_download_at\n file = @route.gpx\n\n send_file(file)\n end", "def data\n construct_url\n JSON.parse(response)\n end", "def download\n file = UserFile.exist_refresh_state(@context, params[:uid])\n\n if file.state != UserFile::STATE_CLOSED\n raise ApiError, \"Files can only be downloaded if they are in the 'closed' state\"\n end\n\n if file.license.present? && !file.licensed_by?(@context)\n raise ApiError, \"You must accept the license before you can download this\"\n end\n\n file_url = file.file_url(@context, params[:inline])\n\n respond_to do |format|\n format.html do\n redirect_to URI.parse(file_url).to_s\n end\n\n format.json do\n render json: {\n file_url: file_url,\n file_size: file.file_size,\n }, adapter: :json\n end\n end\n end", "def write_v3_champ_data(api_key, filename)\n\n url = \"https://na1.api.riotgames.com/lol/static-data/v3/champions\"\n url += \"/?api_key=\" + api_key\n response = HTTParty.get(url)\n case response.code\n when 200\n response_data = response[\"data\"]\n puts response_data.keys\n puts response_data[\"Annie\"]\n when 404\n puts \"error 404\"\n end\n data = []\n write_champ_data(filename, data)\nend", "def download_file(uristr)\n uri = URI.parse(uristr) # parse the url string\n http = Net::HTTP.new(uri.host, uri.port) # create a connection to the http server\n http.open_timeout = 5\n\n DocumentHelper.verify_ssl(uristr, http)\n\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # get the response\n\n status_code = res.code\n if status_code != '200' # checking status code\n raise \"Document editing service returned status: #{status_code}\"\n end\n data = res.body # and take its body\n\n if data == nil\n raise 'stream is null'\n end\n data\n end", "def show\n render json: {} and return unless esdl_file\n\n render json: EsdlFileSerializer.new(esdl_file, params[:download] == 'true').as_json\n end", "def get_overview_info\n start = Time.now\n\n # open the json file of all cars and models and years\n json = JSON.parse(File.read(@all_cars_file_with_years))\n\n if json.nil?\n puts \"ERROR - could not find json file\"\n exit\n end\n\n hydra = Typhoeus::Hydra.new(max_concurrency: @max_concurrency)\n request = nil\n total_to_download = json.values.map{|x| x['models'].values.map{|y| y['years'].length}}.flatten.inject(0, :+)\n total_left_to_download = json.values.map{|x| x['models'].values.map{|y| y['years'].length}}.flatten.inject(0, :+)\n\n # for each car, model, year - get overview\n json.each do |key_car, car|\n car['models'].each do |key_model, model|\n\n model['details'] = Hash.new\n\n model['years'].each do |year|\n model['details'][year] = Hash.new\n\n # request the url\n request = Typhoeus::Request.new(\n @overiew_url.gsub('{car}', car['seo']).gsub('{model}', model['seo']).gsub('{year}', year.to_s),\n :headers=>{\"User-Agent\" => @user_agent},\n followlocation: true, ssl_verifypeer: false, ssl_verifyhost: 0\n )\n\n request.on_complete do |response|\n # process the html\n model['details'][year]['overview'] = process_overview_page(response.response_body)\n\n total_left_to_download -= 1\n\n if total_left_to_download % 100 == 0\n puts \"\\n\\n- #{total_left_to_download} overview files left to downloaded (out of #{total_to_download}); time so far = #{((Time.now-start)/60).round(2)} minutes\\n\\n\"\n end\n end\n hydra.queue(request)\n end\n end\n end\n\n hydra.run\n\n puts \"FINISHED DOWNLOAD DATA!!\"\n\n # save to file\n File.open(@all_cars_file_with_years_overview, 'wb') { |file| file.write(JSON.generate(json)) }\n\n puts \"TOTAL TIME TO DOWNLOAD AND WRITE OVERVIEWS TO FILE = #{((Time.now-start)/60).round(2)} minutes\"\nend", "def report_file_download(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tfile=nessus_http_request('file/report/download', post)\r\n\t\treturn file\r\n\tend", "def call_api\n\t\tputs \"Getting info on elected officials for zipcode: #{zip_code}\"\n\t\t@api_data_on_electeds = JSON.load RestClient.get \"https://congress.api.sunlightfoundation.com/legislators/locate?zip=#{zip_code}&apikey=952d630dfb75498ab63de7a362a85335\"\n\tend", "def download_install_file(action, args={})\n company = @company\n username = @user\n password = @password\n url = \"https://#{company}.logicmonitor.com/santaba/do/#{action}?\"\n args.each_pair do |key, value|\n url << \"#{key}=#{value}&\"\n end\n url << \"c=#{company}&u=#{username}&p=#{password}\"\n uri = URI(url)\n begin\n http = Net::HTTP.new(uri.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(req)\n return response.body\n rescue SocketError => se\n puts \"There was an issue communicating with #{url}. Please make sure everything is correct and try again.\"\n puts se.message\n rescue Error => e\n puts \"There was an issue.\"\n puts e.message\n end\n return nil\nend", "def download(key)\n raise NotImplementedError\n end", "def download_contract\n @request = Request.find_by_n_request(params[:id])\n send_data(@request.contract, type: @request.contract_type, filename: @request.contract_name,\n disposition: 'attachment')\n end", "def call_api\n @client.build_url\n @client.get\n assign_data\n end", "def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend", "def play\n data = self.get_api_response(\"https://opentdb.com/api.php?amount=3&category=11\")[\"results\"][0]\n return data\n end", "def download_external_best_bets\n\tunless ENV['FUNNELBACK_PASSWORD']\n\t\tabort('The FUNNELBACK_PASSWORD enviornment variable is not set')\n\tend\n\tbegin\n\t\thttp = Net::HTTP.new(ENV['FUNNELBACK_DOMAIN'],ENV['FUNNELBACK_PORT'])\n\t\treq = Net::HTTP::Get.new(\"/search/admin/download-conf.cgi?collection=website&f=best_bets.cfg&dir=profile-folder-_default_preview\")\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\treq.basic_auth ENV['FUNNELBACK_USERNAME'], ENV['FUNNELBACK_PASSWORD']\n\t\tresponse = http.request(req)\n\trescue\n \terb :loaderror\n else\n\t \topen(\"data/best-bets-external.txt\", \"wb\") { |file|\n \tfile.write(response.body)\n \t}\n end\nend", "def download\n res = @stash_identifier.last_submitted_resource\n if res&.download_uri\n res = @stash_identifier.last_submitted_resource\n StashEngine::CounterLogger.version_download_hit(request: request, resource: res) if res\n redirect_to res.merritt_producer_download_uri # latest version, friendly download because that's what we do in UI for object\n else\n render text: 'download for this dataset is unavailable', status: 404\n end\n end", "def get_data\n if @url\n @page = fetch_url(@url)\n @parse_time = parse_dailydev_page\n @page = nil\n self.total_time\n end\n end", "def download!(source_url, destination_file); end", "def generate_download\n # TODO: to support scoping by other filters\n # we will have to scope all filter params throughout by their target base\n # e.g. collection_object[param]\n a = nil\n\n q = ::Queries::CollectionObject::Filter.new(params)\n q.project_id = nil\n\n if q.all(true)\n q.project_id = sessions_current_project_id\n a = DwcOccurrence.by_collection_object_filter(\n filter_scope: q.all,\n project_id: sessions_current_project_id)\n else\n a = DwcOccurrence.where(project_id: sessions_current_project_id)\n if params[:dwc_occurrence_start_date]\n a = a.where('dwc_occurrences.updated_at < ? and dwc_occurrences.updated_at > ?', params[:dwc_occurrence_start_date], params[:dwc_occurrence_end_date])\n end\n end\n\n @download = ::Export::Dwca.download_async(a, request.url, predicate_extension_params: predicate_extension_params )\n render '/downloads/show'\n end", "def downloads\n @downloads ||= ApiFactory.new 'Projects::Downloads'\n end", "def exec_api_download(uri, json_req, download_path)\n raise \"not yet implemented\"\n begin\n http_post_download(uri, json_req.to_json, download_path)\n return JsonResponse.new(\"success\")\n rescue Curl::Err::CurlError => ex\n return JsonResponse.new(\"fail\", ex.message, ex.backtrace)\n end\n end", "def data_retrieve(url_string)\n url = url_string # open url\n\n begin\n data_read =open(url).read # read the url\n rescue SocketError => e\n return {}\n end\n\n @data_result = JSON.parse(data_read) # parse JSON received from the api\n\n return @data_result #return parsed JSON data to an instance variable\n\n end", "def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend", "def create_data_download(project_id, opts = {})\n post \"projects/#{project_id}/datadownload\", opts\n end" ]
[ "0.71139914", "0.7076209", "0.68539864", "0.6693679", "0.6669677", "0.66208494", "0.64121443", "0.6406143", "0.6350602", "0.6311593", "0.6275959", "0.62386346", "0.61998117", "0.619286", "0.6176183", "0.61671025", "0.60972893", "0.609324", "0.60910213", "0.6090702", "0.6067864", "0.60632694", "0.6020769", "0.60118675", "0.59993327", "0.595875", "0.5951088", "0.5941939", "0.5941801", "0.59412533", "0.5930898", "0.59236467", "0.59219354", "0.5907178", "0.5899968", "0.5880585", "0.5869316", "0.58602124", "0.58552814", "0.5847103", "0.58436126", "0.5837237", "0.58348864", "0.5825942", "0.58202386", "0.5815586", "0.58124876", "0.58079743", "0.5795274", "0.5788858", "0.5785842", "0.5785796", "0.57707024", "0.5766386", "0.57532924", "0.571897", "0.5711416", "0.5704642", "0.5704566", "0.56921124", "0.56867146", "0.56828344", "0.568188", "0.56744", "0.56731063", "0.5663665", "0.56625116", "0.5659487", "0.5645486", "0.5645052", "0.5640867", "0.5639826", "0.5626545", "0.5625452", "0.5619984", "0.5613503", "0.5612061", "0.560691", "0.5604152", "0.56006026", "0.55998695", "0.559893", "0.559832", "0.5597206", "0.55907756", "0.55885524", "0.5582201", "0.55780923", "0.5577949", "0.5577707", "0.55496097", "0.55401653", "0.5540081", "0.5539772", "0.5539096", "0.5538514", "0.5535544", "0.55295795", "0.5527411", "0.55222714", "0.55186516" ]
0.0
-1
Time stamp for file task.
def timestamp if File.exist?(name) File.mtime(name.to_s) else Rake::EARLY end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_datetime\n @file_datetime\n end", "def timestamp\n @file_mtime ||\n if _exist?(name)\n @file_mtime = _mtime(name.to_s)\n else\n Rake::LATE\n end\n end", "def timestamp\n begin\n File.mtime(name)\n rescue Errno::ENOENT\n Rake::LATE\n end\n end", "def current_timestamp\n if @current_timestamp.nil? or (Time.now.to_i - @last_stat >= Puppet[:filetimeout])\n @last_stat = Time.now.to_i\n begin\n @current_timestamp = File.stat(@filename).ctime\n rescue Errno::ENOENT, Errno::ENOTDIR\n @current_timestamp = Time.now\n end\n end\n @current_timestamp\n end", "def write_timestamp\n filepath = \"#{Dir.tmpdir}/govpay_request_refund_service_last_run_time\"\n # FileUtils.touch seems unreliable in VM so need to write/read the actual time\n File.write(filepath, Time.zone.now)\n end", "def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end", "def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end", "def mod_time\n File.mtime(@filepath)\n end", "def t_stamp\n Time.now.strftime(\"%m-%d_%H-%M-%S\")\nend", "def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end", "def time_stamp(event)\n file_local_write(@logfile,\"\\nKeylog Recorder #{event} at #{Time.now.to_s}\\n\\n\")\n end", "def view_timestamp(file)\n\t#stamp = commandz(\"stat #{file}\")\n\t#if not stamp.empty?\n\t#\tputs \"#{FGRN}Current Time Stamp for #{HC}#{FWHT}: #{file.chomp}#{RS}\"\n\t#\tstamp.each { |x| puts \"#{FWHT}#{x.chomp}#{RS}\" }\n\t#end\n\n\t# Now we do it with just pure ruby :)\n\t#Stat our target file so we can enumerate all the info normal stat command might show.....\n\tfoo = File.stat(file)\n\tputs \"#{HC}#{FGRN}File#{FWHT}: #{file}\\t#{FGRN}Type#{FWHT}: #{foo.ftype}#{RS}\"\n\tputs \"#{HC}#{FGRN}Size#{FWHT}: #{foo.size}\\t#{FGRN}Blocks#{FWHT}: #{foo.blocks}\\t#{FGRN}IO Blocks#{FWHT}: #{foo.blksize}#{RS}\"\n\tputs \"#{HC}#{FGRN}Dev#{FWHT}: #{foo.dev}\\t#{FGRN}Inode#{FWHT}: #{foo.ino}\\t#{FGRN}Links#{FWHT}: #{foo.nlink}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access#{FWHT}: #{sprintf(\"%o\", foo.mode)}\\t#{FGRN}UID#{FWHT}: #{foo.uid}\\t#{FGRN}GID#{FWHT}: #{foo.gid}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access Time#{FWHT}: #{foo.atime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Modify Time#{FWHT}: #{foo.mtime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Change Time#{FWHT}: #{foo.ctime}#{RS}\"\n\tputs\nend", "def asctime() end", "def time\r\n @time ||= @last_build_file.modification_time\r\n end", "def mtime; end", "def mtime; end", "def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend", "def mtime() end", "def mtime() end", "def source_file_mtime; end", "def file_path\n \"#{Time.now.to_f}.#{filename}\"\n end", "def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end", "def asctime\n end", "def generate_timestamp_file(filename)\n now = Time.now.to_i\n output_path = \"#{@archive_root}/#{filename}\"\n File.write(output_path, now)\n end", "def modified_at(file, timestamp = nil)\n require 'date'\n time = timestamp ? DateTime.parse(\"#{timestamp}\") : DateTime.now\n timestamp = time.strftime('%Y%m%d%H%M')\n execute(\"/bin/touch -mt #{timestamp} #{file}\")\n end", "def last_modified_time\n mtime\n end", "def timestamp\n current_time = DateTime.now\n \"#{current_time.strftime(\"%d/%m/%y %H:%M:%S\")} -\"\n end", "def mtime\n File.mtime(file)\n end", "def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end", "def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def record_creation_timestamp(path, timestamp)\n # Hook method: Linux filesystems doesn't store creation datetime\n end", "def creation_date\n stat.ctime\n end", "def determine_file_time(path)\n date, hour = date_and_hour_from_path(path)\n # here we assume file timestamps are in UTC\n year, month, day = date[0..3].to_i, date[4..5].to_i, date[6..7].to_i\n Time.utc(year, month, day, hour)\n end", "def fs_fileMtime(p)\n raise \"File: #{p} does not exist\" unless (fi = getFileInfo(p))\n (fi[\"modification\"])\n end", "def mtime_for(file)\n File.mtime(file)\n end", "def create_timestamp_file\n timestamp = Time.now.utc\n timestamp_file = File.new(report_timing_file, 'w')\n timestamp_file.puts(timestamp)\n timestamp_file.close\n end", "def create_time\r\n begin\r\n # TODO: check which operating system we are on, and get this value accordingly....\r\n\r\n # File.ctime(file_path).to_i # NO NO NO, This is the 'change' time, not the 'create' time :-()\r\n\r\n # OSX stored the birth time of a file in special metadata that Ruby does not have easy access to,\r\n # so start the 'mdls' command in a separate process to extract this info.\r\n # WARNING: This is really slow! It's takes about 4,000 TIMES LONGER than File.mtime()\r\n return Time.parse(Open3.popen3(\r\n \"mdls\", \r\n \"-name\",\r\n \"kMDItemContentCreationDate\", \r\n \"-raw\", file_path)[1].read\r\n ).to_i\r\n rescue\r\n 0\r\n end\r\n end", "def now!\r\n @last_build_file.modification_time = @time = Time.now\r\n end", "def mtime\n Time.at(@mtime)\n end", "def mtime\n Time.at(@mtime)\n end", "def get_creation_timestamp(path)\n nil\n end", "def created_at\n @created_at ||= @path.pathname.ctime\n end", "def timestamp\n mask = class_trait[:timestamp]\n Time.now.strftime(mask || \"%Y-%m-%d %H:%M:%S\")\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def timestamp\n time.strftime formatter\n end", "def time_stamp()\n return get INIT_TIME_STAMP_NAME\n end", "def file_name\n ts = @entries.first.time_stamp\n File.join(@coord.options.output_dir,\n ts.strftime('%Y-%m-%d'),\n ts.strftime('%H-%M'),\n ts.strftime('%S.%3N-') + id)\n end", "def stamp\n files.map { |f| File.mtime(path(f)) }.max.to_i\n end", "def ctime() File.ctime(path) end", "def local_uploaded_time\n self.uploaded_at.strftime(\"%Y-%m-%d %H:%M\")\n end", "def mtime_t\n Time.at(mtime * 0.001)\n end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def latest_time(file_list)\n return Time.at(0) if file_list.empty?\n file_list.first.timestamp\n end", "def mtime() File.mtime(path) end", "def touch( fname, time = Time.now )\n stamp = time.strftime('%Y%m%d%H%M.%S')\n %x[ touch -m -t #{stamp} #{fname} ]\n end", "def source_file_mtime\n File.mtime(path)\n end", "def touch( fname, time = Time.now )\n stamp = time.strftime(\"%Y%m%d%H%M.%S\")\n %x[ touch -m -t #{stamp} #{fname} ]\n end", "def determine_file_time(path)\n begin\n date, start_hour, end_hour = date_and_hours_from_path(path)\n rescue ArgumentError\n if params[:debug]\n debug_print(\"Unable to determine file time from path: #{path}\")\n end\n # XXX this is a moderately evil hack to avoid removing files that\n # do not look like they are part of ETL process.\n # Return current time, assuming only files of some age are removed\n # this file should be kept alone\n return Time.now.utc\n end\n # here we assume file timestamps are in UTC\n year, month, day = date[0..3].to_i, date[4..5].to_i, date[6..7].to_i\n # end_hour may be 24, use arithmetic instead of passing end_hour to new\n Time.utc(year, month, day) + end_hour.hours\n end", "def store_activity_end_time\n File.open(MAIN_DIR + \"prev_end_time\", \"w\") do |timeFile|\n timeFile.syswrite(current_time)\n end\nend", "def last_modified\n @file_stat ? file_stat.mtime.to_s : 'Unknown'\n end", "def last_modified\n stat.mtime\n end", "def get_modification_timestamp(path)\n File.mtime(path)\n end", "def mtime() File.mtime( expand_tilde ) end", "def last_modified=(time)\n# File.utime(Time.now, time, file_path)\n end", "def file_name\n \"#{Time.current.to_i}-#{@file.original_filename}\"\n end", "def asset_timestamp(file_path)\n return nil if file_path =~ /\\?/ || (self.class.respond_to?(:asset_stamp) && !self.class.asset_stamp)\n public_path = self.class.public_folder if self.class.respond_to?(:public_folder)\n public_path ||= Padrino.root(\"public\") if Padrino.respond_to?(:root)\n public_file_path = File.join(public_path, file_path) if public_path\n stamp = File.mtime(public_file_path).to_i if public_file_path && File.exist?(public_file_path)\n stamp ||= Time.now.to_i\n \"?#{stamp}\"\n end", "def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end", "def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end", "def locktime\n File.mtime(pidpath)\n end", "def mtime\n File.mtime(path)\n end", "def locktime\n File.mtime(self.pidpath)\n end", "def ctime() File.ctime( expand_tilde ) end", "def create(filename)\n time = Time.now\n @files[filename] = time # Updates the \"files\" hash with the timestamp for when the file was created\n puts \"The file #{filename} was created at #{time}\"\n end", "def timestamp\n if @data.exist?\n mtime = @data.mtime.to_time\n raise \"Table #{name} exists but modified time is unavailable.\" if mtime.nil?\n mtime\n else\n Rake::EARLY\n end\n end", "def timestamp(time)\n date = @file[/(\\w+ \\d+, \\d+)/]\n ASF::Board::TIMEZONE.parse(\"#{date} #{time}\").to_i * 1000\n end", "def current_timestamp\n Time.now.strftime \"%Y%m%dT%H:%M:%S\"\n end", "def get_last_task_stime\n line = ''\n IO.popen(\"tail -n 1 #{TRACK_FILE}\") { |f| line = f.gets }\n if line == nil\n return false\n end\n\n line.split(\"\\t\").pop\n end", "def timestamp\n Time.now.to_s\n end", "def manual_file\n f = File.open(\"#{Time.new.strftime('%Y-%m-%dT%H:%M:%S')}.txt\", 'w')\n f.write('Hello')\n f.flush\n f.close\nend", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def run_date_time\n return @run_date_time\n end", "def createFile(file,time)\n\t\tFile.open(file, \"w+\") do |f|\n\t\t\tf.print time\n\t\tend\n\tend", "def last_modified\n @file_stat ? file_stat.mtime : nil\n end", "def last_timetable_datetime_with_zone\n TimetableFileInfo.last.last_modified\n end", "def time(stack)\n ::Time.from_evolver_timestamp(file(stack)[0...14])\n end", "def write_last_measurement(line, filename = '/tmp/currentcost')\n File.open(filename, \"w\") do |file|\n file.puts Time.now,(line)\n end\nend", "def log_input\n File.open('./log/ultimo_registro.txt', 'w+') do |f| \n f.puts Time.now.strftime(\"%Y%m%d-%H:%M\").to_s\n end \n end", "def timestamp\n _timestamp.as_time\n end", "def timestamp\n Time.now.to_i.to_s\n end", "def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end", "def get_next_action_time(file)\r\n\t\tstart_pos = file.pos\r\n\t\tnext_time = get_next_result_time(file)\r\n\t\tfile.seek(start_pos, IO::SEEK_SET)\r\n\t\tnext_time\r\n\tend" ]
[ "0.7291897", "0.72891366", "0.71487504", "0.6965426", "0.6796802", "0.6770877", "0.6770877", "0.67685777", "0.6755231", "0.67250377", "0.67080355", "0.6660463", "0.66385156", "0.6636782", "0.66118956", "0.66118956", "0.66098726", "0.6599067", "0.6599067", "0.65975577", "0.65819675", "0.65542084", "0.6536783", "0.6533014", "0.6480438", "0.6480096", "0.6466274", "0.6463632", "0.64532954", "0.64532954", "0.6452502", "0.6443069", "0.64263994", "0.63947225", "0.6360712", "0.63463503", "0.63460875", "0.6332527", "0.63179463", "0.63162273", "0.63162273", "0.6306398", "0.6302082", "0.6288139", "0.6274706", "0.625526", "0.62506676", "0.62500936", "0.6226726", "0.62247646", "0.6215883", "0.6200109", "0.6193312", "0.6193312", "0.6193312", "0.6193312", "0.6193312", "0.6193312", "0.61771894", "0.6166677", "0.615892", "0.6155986", "0.61495286", "0.61422366", "0.61335176", "0.6130753", "0.6127286", "0.6117641", "0.6105252", "0.608271", "0.60749507", "0.60698456", "0.6069133", "0.6064434", "0.60461485", "0.6039217", "0.60191965", "0.6018686", "0.60071695", "0.599533", "0.59952134", "0.5994807", "0.5970836", "0.5970757", "0.5953986", "0.59435254", "0.59435254", "0.59435254", "0.59435254", "0.5940848", "0.5931339", "0.5923263", "0.59222233", "0.59163105", "0.5908271", "0.59029037", "0.5894998", "0.5892221", "0.58914053", "0.5890886" ]
0.7024237
3
Are there any prerequisites with a later time than the given time stamp?
def out_of_date?(stamp) @prerequisites.any? { |n| application[n].timestamp > stamp} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_of_date?(stamp)\n @prerequisites.any? do |n| \n prereq_time = application[n, @scope].timestamp\n return false if prereq_time == Rake::EARLY\n\n prereq_time > stamp\n end\n end", "def out_of_date?(stamp)\n return true if stamp.is_a? Rake::EarlyTime\n @prerequisites.any? { |n| application[n].timestamp > stamp}\n end", "def out_of_date?(stamp)\n puts \"jsdb: checking_out_of_date\"\n @prerequisites.each do |pr|\n p pr\n end\n @prerequisites.any? { |n| application[n, @scope].timestamp > stamp }\n end", "def out_of_date?(stamp)\n all_prerequisite_tasks.any? { |prereq|\n prereq_task = application[prereq, @scope]\n if prereq_task.instance_of?(Rake::FileTask)\n prereq_task.timestamp > stamp || @application.options.build_all\n else\n prereq_task.timestamp > stamp\n end\n }\n end", "def later?(target_time, ref_time)\n target_time.to_f - ref_time.to_f > 0.01\n end", "def meets_temporal_constraints?(time, &block)\n !find_failed_temporal_constraint(time, &block) &&\n !find_failed_occurence_constraint(true, &block)\n end", "def check_dates\n # TODO the init_time must be less then the end_time\n true\n end", "def after?(time)\n start_time > time\n end", "def after?(time)\n start_time > time\n end", "def is_later?(time)\n time.to_date > Date.today + 1\n end", "def include?(timestamp)\n return false if earlier?(timestamp) || later?(timestamp)\n\n recurrence = finite? ? self : fast_forward(timestamp)\n\n recurrence.events.lazy.each do |event|\n return true if event == timestamp\n return false if event > timestamp\n end || false\n end", "def future?\n return if missing?\n\n reference_time < time\n end", "def modified_since?( time )\n mtime > time\n end", "def upcoming?\n begins.to_time > Time.now\n end", "def includes(time)\n return (@beginTime < time && time < @endTime) ;\n end", "def existed_at?(aTime)\n return @creation >= aTime\n end", "def includes?(time)\n next_occurrence = next_occurrence(time) || last_occurrence\n residue_for(time) == @residue \\\n && !next_occurrence.nil? \\\n && time_overlaps?(time, next_occurrence, next_occurrence + duration)\n end", "def hasTopStoryDeadlineEnded?\n Time.now.to_s.slice(11..12).to_i > 11 \n end", "def is_specification_in_effect?(time=Time.now)\n idx = 0\n test_results = @cron_values.collect do | cvalues |\n time_value = time.send(TimeMethods[idx])\n idx += 1\n !cvalues.detect { | cv | cv.is_effective?(time_value) }.nil?\n end.all?\n\n end", "def in_the_future(now=Time.now)\n trip_time > now\n end", "def has_passed?\n\t\tTime.zone.at(starttime) < Time.zone.now\n\tend", "def contains?(date_or_time)\n starts_on <= date_or_time && date_or_time < ends_on\n end", "def time_passed?(_event, time)\n Time.now > time\n end", "def is_on_time?(deadline, file)\n\t\n\tlog = `git log --until=#{deadline} #{file}`\n\t\n\tif log.empty? \n\t\treturn 1\n\telse\n\t\treturn 2\n\tend\n\nend", "def short_job?\n date = DateTime.new(params[:job][\"deadline(1i)\"].to_i, \n params[:job][\"deadline(2i)\"].to_i, \n params[:job][\"deadline(3i)\"].to_i, \n params[:job][\"deadline(4i)\"].to_i, \n params[:job][\"deadline(5i)\"].to_i) \n date < Time.now + 3.days\n end", "def in_the_future(now=Time.now)\n trip_datetime > now\n end", "def valid_since?(time)\n @types.each do |type, config|\n have = self.by_type[type].reject{|s| s[:created_at] < time} || []\n\n interval = (Time.now - Chronic.parse(config[\"Every\"] + \" ago\")).to_i\n\n expected_count = (Time.now - time).to_i/interval.to_i\n expected_count = config[\"Keep\"] if expected_count > config[\"Keep\"]\n\n next if expected_count == 0\n\n expected_oldest = Time.now - (expected_count-1 * interval)\n expected_newest = Time.now - (interval * 2)\n\n count_ok = (have.count >= expected_count)\n oldest_ok = have.count > 0 && (have.oldest[:created_at] <= expected_oldest)\n newest_ok = have.count > 0 && (have.newest[:created_at] >= expected_newest)\n\n if @verbose\n have_oldest = have.oldest ? have.oldest[:created_at] : \"N/A\"\n have_newest = have.newest ? have.newest[:created_at] : \"N/A\"\n puts \"Type: #{type}\"\n puts \"Have: #{have.count} Expected: #{expected_count}: (#{count_ok})\"\n puts \"Oldest: #{have_oldest} Expected: #{expected_oldest} or older: (#{oldest_ok})\"\n puts \"Newest: #{have_newest} Expected: #{expected_newest} or newer: (#{newest_ok})\"\n end\n\n return false unless count_ok && oldest_ok && newest_ok\n end\n\n return true\n rescue Fog::Compute::AWS::Error\n return nil\n end", "def more_than_a_day_passed?(start_time, end_time)\n end_time - start_time > 60 * 60 * 24\n end", "def past_time_threshold?\n return true if @past_time_threshold # no need to check again once past\n @past_time_threshold = (Time.now-@start_time) >= N_PLUS_ONE_TIME_THRESHOLD\n end", "def is_before?(e)\n (@periodicity.start_time.hour < e.periodicity.start_time.hour) or\n (@periodicity.start_time.hour == e.periodicity.start_time.hour and @periodicity.start_time.min < e.periodicity.start_time.min)\n end", "def attested_for?(date)\n last_attested_on && last_attested_on > date.to_time\n end", "def child_time_previously_collected?(question)\n answer_for(question, valid_response_exists?(\"PARTICIPANT_VERIF.CHILD_TIME\"))\n end", "def later?(timestamp)\n ends_at && timestamp > ends_at\n end", "def existed_at?(aTime)\n return @date >= aTime\n end", "def relevant_time?\n\t\tself.start < Time.now && self.end >Time.now \n\tend", "def starts_tomorrow?\n future? && starts_at < site(:course_check_interval).since\n end", "def outdated?\n (Time.now - self.time_of_last_ok) > threshold_for_oldest_ok\n end", "def check_prerequisites(plan, course)\n\t\terrors = Array.new\n\t\tcourse.prerequisite.each do |prereq|\n\t\t\tprerequisite = PlansCourse.where(plan_id: plan.id, course_id: prereq.id).first\n\t\t\tif(prerequisite)\n\t\t\t\tprerequisite_taken_on = @semesters.index(prerequisite.taken_planned)\n\t\t\t\tcourse_taken_on = @semesters.index(params[:date])\n\t\t\t\tif(prerequisite_taken_on >= course_taken_on)\n\t\t\t\t\terrors << \"Prerequisite error for #{course.subject} #{course.course_number}: #{prereq.subject} #{prereq.course_number} must be taken earlier\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\terrors << \"Prerequisite error for #{course.subject} #{course.course_number}: #{prereq.subject} #{prereq.course_number} not taken yet\"\n\t\t\tend\n\t\tend\n\t\treturn errors\n\tend", "def future?\n self.stages.first.starts_on > Date.today\n end", "def is_scheduled?(time)\n diff = (time-base_time)\n if (departure_time.minutes < diff && diff < departure_time.minutes + duration.minutes)\n return true\n else # it could be by a lot.\n #Say our base time ended up at midnight tomorrow becase it's after midnight\n # then our diff < -24 hourse\n diff = diff + 24.hours\n departure_time.minutes < diff && diff < departure_time.minutes + duration.minutes\n end\n end", "def past?\n begins.to_time < Time.now\n end", "def upcoming?\n starts_at > Time.now\n end", "def job_running_past_expected_end_time?\n Time.zone.now > job_expected_end_time\n end", "def remove_deadline_for(generator, time)\n found = false\n deadlines.delete_if do |deadline, _, gen|\n if found\n false\n else\n found = (deadline > time && generator == gen)\n end\n end\n found\n end", "def check_if_asqs_up_to_date\n asq = Asq.all.order(last_run: :desc).limit(1)[0]\n return true if !asq.nil? && asq.last_run > Time.now - 20.minutes\n false\n end", "def older_than?(time)\n time > timestamp\n end", "def check?\n @last_time < @check_time - 100\n end", "def earlier?(timestamp)\n starts_at && timestamp < starts_at\n end", "def puppet_checked_in_since?(timestamp)\n puppetdb.successful_report_after?(puppet_certname, timestamp, :verbose => true)\n rescue CommandException, StandardError, Timeout::Error\n logger.warn(\"Could not determine if Puppet Checked in since %s on %s: %s: %s\" % [timestamp, puppet_certname, $!.class, $!.to_s])\n false\n end", "def trial_over?\n unless self.trial_started_at.blank?\n return Time.now - APP_CONFIG['trial_length'].days > self.trial_started_at\n else\n return false\n end\n end", "def in_past?\n elapsed.positive?\n end", "def covers?(time)\n start_time <= time && time < end_time\n end", "def covers?(time)\n start_time <= time && time < end_time\n end", "def verify_start_time time\n\n # Check that there are currently\n # records on the day to iterate through\n dsym = self.class.date_symbol time\n return true if not self.class.days_index[dsym]\n\n self.class.days_index[dsym].each do |record|\n\n next if record.end_time == :running\n next if record == self\n if time < record.end_time\n raise ArgumentError, \"Time conflict with existing record\" if time_in_record? time, record\n end\n end\n true\n end", "def include?(time)\n if @days[time.wday]\n # If no times then days matching is good enough \n return true if @time_ranges.size == 0\n \n # Check time range(s)\n for time_range in @time_ranges\n time_n = time.hour * 100 + time.min\n return true if time_n >= time_range.start and\n time_n < time_range.end\n end\n end\n \n false\n end", "def cover?(timestamp)\n return false if start.nil? && finish.nil?\n return start < timestamp if finish.nil?\n return finish > timestamp if start.nil?\n\n return true if finish < timestamp\n return true if start > timestamp\n\n false\n end", "def retry?\n unless rt_at.nil?\n now = Time.now.utc\n if now >= rt_at\n true\n else\n false\n end\n else\n false\n end\n end", "def is_late\n Time.current > object.deadline if object.deadline.present?\n end", "def passed?\n (self.ends_at < Time.zone.now) && !((self.ends_at.to_date.eql?(Time.zone.now.to_date)) && self.ends_at.strftime('%H%M').eql?(\"0000\"))\n end", "def past?\n\n @next_time &&\n @next_time < Time.now - @scheduler.frequency\n end", "def time_before_now? time\n time_now_with_resetted_date = reset_date_for_time_now\n time_with_resetted_date = reset_date_for_time time\n (time_now_with_resetted_date <=> time_with_resetted_date) == Timeable::TIME_COMPARE_RESULTS[:right_side_later]\n end", "def has_appointment?(date, time)\n datetime = Temporal.generate_datetime(date, time)\n\n !is_available?(datetime, 20) #the time is broken up into 20 minute blocks\n end", "def stale?\n forecasts.empty? || (Time.now - data_file.mtime) > 14_400\n end", "def updated_since?(time)\n time < last_updated_at\n end", "def future?\r\n @at > DateTime.now\r\n end", "def includesTime(time_format)\r\n @times.empty? or @times.any? { |start,finish| start <= time_format && time_format < finish}\r\n end", "def compare_timestamp(subreddit_last, time_recent)\n subreddit_last <= time_recent\n end", "def deferred?\n\t\tstart && start > Time.now\n\tend", "def contains?(date_or_time)\n \t# TODO We need to make sure time zones are properly handled, probably!\n\n \tstarts_on <= date_or_time && date_or_time < ends_on\n end", "def after?(date_or_time)\n self > date_or_time\n end", "def scheduled?\r\n @time != :forever\r\n end", "def time_after_now? time\n time_now_with_resetted_date = reset_date_for_time_now\n time_with_resetted_date = reset_date_for_time time\n (time_now_with_resetted_date <=> time_with_resetted_date) == Timeable::TIME_COMPARE_RESULTS[:left_side_later]\n end", "def time?\n !times.empty?\n end", "def expired?\n pledging_ends_on.past?\n end", "def can_run_again(rule_key, now)\n ## converting it to seconds\n now = Time.parse(now).to_i\n latest = @timestamps.fetch(rule_key).fetch('latest_run')\n return true if latest == nil\n latest = Time.parse(latest).to_i\n\n # return true if the difference is at least 30 minutes\n if (now-latest) >= @difference\n return true\n end\n return @difference - (now - latest)\n end", "def fresh_at?(time)\n time >= updated_at\n end", "def time_is_up(end_time)\n DateTime.now >= end_time\nend", "def on_trial?\n trial_ends_at? && trial_ends_at > Time.current\n end", "def has_started?\n Time.now >= start_time\n end", "def rerun_time?(node, path)\n node['locking_resource']['failed_locks'].fetch(\n path, 'time' => nil\n )['time']\n end", "def has_future_participations?\n future_participations = []\n \n participations.each do |participation|\n\t current_micropost = participation.micropost\n\t\n if current_micropost.time && current_micropost.time.future?\n return true\n end\n end\n \n return false\n end", "def conflict?(times)\n\t\treturn false if @tba == true\n\n\t\ttimes.each do |time|\n\t\t\treturn false if time.tba == true\n\t\t\treturn true if \\\n\t\t\t\t\t((time.startTimeInMinutes <= @endTimeInMinutes && time.startTimeInMinutes >= @startTimeInMinutes) \\\n\t\t\t\t\tor (time.endTimeInMinutes >= @startTimeInMinutes && time.endTimeInMinutes <= @endTimeInMinutes) \\\n\t\t\t\t\tor (time.startTimeInMinutes > @startTimeInMinutes && time.endTimeInMinutes < @endTimeInMinutes) \\\n\t\t\t\t\tor (time.startTimeInMinutes < @startTimeInMinutes && time.endTimeInMinutes > @endTimeInMinutes)) \\\n\t\t\t\t\tand (@days & time.days).length > 0\n\t\tend\n\n\t\treturn false\n\tend", "def matching_start_time(finish_time)\n start_times.select { |t| t < finish_time }.sort.max\n end", "def after?(other)\n self.hsec > other.hsec\n end", "def futur?\n before > 0\n end", "def up_to_date_for?(timestamp)\n keys.sort.last >= timestamp\n end", "def has_time_to_solve?\n self.expires_at ? Time.now.utc + self.time_to_solve < self.expires_at : true\n end", "def has_time_to_solve?\n self.expires_at ? Time.now.utc + self.time_to_solve < self.expires_at : true\n end", "def future?\n Date.today <= finish\n end", "def waiting?\n @lock.synchronize { !defined?(@start_time) }\n end", "def completed_by(time)\n jobs_by_completed_at.select { |job| job.complete <= time }.map(&:node)\n end", "def has_started?\n Date.current >= start_date\n end", "def relevant_time?\n\t\tself.start <= DateTime.now && self.end >= DateTime.now\n\t\t# (self.start.hour <= DateTime.now.hour) (self.start.minute <= DateTime.now.minute) && (self.end.hour >\tDateTime.now.hour) \n\tend", "def close_enough_timestamps?(next_line)\n time_diff = (next_line.timestamp - @last_merged_timestamp) * 24 * 60 * 60\n time_diff >= 0 && time_diff <= max_seconds_between_posts\n end", "def check_future\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time \n\n # checks start time of appt is before end time #\n if current_start < current_end\n if current_start > Time.now && current_end > Time.now\n @valid = true\n else\n @valid = false\n end\n end\n @valid\n p @valid\n end", "def time_requires_roll?\n !@endTime.nil? && Time.now.to_i >= @endTime\n end", "def set_since?(time)\n created_at && created_at >= time\n end", "def in_progress?\n return true if current_time_info[:current_time].to_i.positive?\n return true if match_match_status == 3\n\n false\n end", "def passed_event?\n date_time < Time.now.utc\n end", "def monitored_now?\n tf = circuit.monitoring_setting.todays_monitoring_times\n return false unless tf \n \n from,to = tf.split('-').map { |e| (\"%02d%02d\" % _sh(e)).to_i }\n now = (\"%02d%02d\" % [Time.now.hour, Time.now.min]).to_i\n \n $stderr.puts \"#{from} #{to} - #{now}\"\n \n (from..to).include?(now)\n end" ]
[ "0.7551927", "0.72763467", "0.7262603", "0.7040142", "0.67206854", "0.66420317", "0.630077", "0.62771356", "0.62771356", "0.6129603", "0.612923", "0.6127672", "0.61170053", "0.6093891", "0.6086675", "0.6057503", "0.60325825", "0.6030525", "0.6021573", "0.6000135", "0.5984032", "0.5949649", "0.5927602", "0.592299", "0.5913296", "0.59079766", "0.5904034", "0.5898452", "0.5896226", "0.58916587", "0.5887911", "0.58857566", "0.5861349", "0.58387935", "0.5834923", "0.5822083", "0.5815128", "0.5805201", "0.5803779", "0.5791269", "0.57813966", "0.57644486", "0.57433355", "0.57379466", "0.57350326", "0.57282376", "0.5725621", "0.57215834", "0.5710519", "0.5687261", "0.5680136", "0.5676353", "0.5676353", "0.5676174", "0.56730103", "0.567261", "0.5655829", "0.5655538", "0.5654556", "0.565023", "0.5648237", "0.5636028", "0.5613642", "0.56124896", "0.5607554", "0.56067497", "0.560184", "0.5601796", "0.5600966", "0.5600809", "0.55917066", "0.5579094", "0.55711555", "0.5567062", "0.55556905", "0.5549721", "0.5544888", "0.55377704", "0.5532858", "0.5532841", "0.5518324", "0.5509476", "0.55074716", "0.5507316", "0.55028224", "0.5495494", "0.5491995", "0.5491995", "0.5489485", "0.5488518", "0.54866403", "0.54850554", "0.54817605", "0.54781437", "0.5476302", "0.5474503", "0.5470428", "0.5464192", "0.54578716", "0.54573864" ]
0.7517836
1
Time stamp for file creation task. This time stamp is earlier than any other time stamp.
def timestamp Rake::EARLY end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_creation_timestamp(path, timestamp)\n # Hook method: Linux filesystems doesn't store creation datetime\n end", "def creation_date\n stat.ctime\n end", "def timestamp\n @file_mtime ||\n if _exist?(name)\n @file_mtime = _mtime(name.to_s)\n else\n Rake::LATE\n end\n end", "def get_creation_timestamp(path)\n nil\n end", "def create_time\r\n begin\r\n # TODO: check which operating system we are on, and get this value accordingly....\r\n\r\n # File.ctime(file_path).to_i # NO NO NO, This is the 'change' time, not the 'create' time :-()\r\n\r\n # OSX stored the birth time of a file in special metadata that Ruby does not have easy access to,\r\n # so start the 'mdls' command in a separate process to extract this info.\r\n # WARNING: This is really slow! It's takes about 4,000 TIMES LONGER than File.mtime()\r\n return Time.parse(Open3.popen3(\r\n \"mdls\", \r\n \"-name\",\r\n \"kMDItemContentCreationDate\", \r\n \"-raw\", file_path)[1].read\r\n ).to_i\r\n rescue\r\n 0\r\n end\r\n end", "def creation_time # :nodoc:\n @creation_time.dup\n end", "def timestamp\n if File.exist?(name)\n File.mtime(name.to_s)\n else\n Rake::EARLY\n end\n end", "def create(filename)\n time = Time.now\n @files[filename] = time # Updates the \"files\" hash with the timestamp for when the file was created\n puts \"The file #{filename} was created at #{time}\"\n end", "def timestamp\n begin\n File.mtime(name)\n rescue Errno::ENOENT\n Rake::LATE\n end\n end", "def create_time(); @create_time; end", "def created_at\n @created_at ||= @path.pathname.ctime\n end", "def create(filename)\n time = Time.now\n @files[filename] = time\n puts \"#{filename} was created by #{@username} at #{time}.\"\n end", "def creation_time\n data[:creation_time]\n end", "def process_creation_date_time\n return @process_creation_date_time\n end", "def generate_timestamp_file(filename)\n now = Time.now.to_i\n output_path = \"#{@archive_root}/#{filename}\"\n File.write(output_path, now)\n end", "def create_timestamp\n self.created_at = Time.now\n end", "def create_timestamp\n self.created_at = Time.now\n end", "def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end", "def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end", "def current_timestamp\n if @current_timestamp.nil? or (Time.now.to_i - @last_stat >= Puppet[:filetimeout])\n @last_stat = Time.now.to_i\n begin\n @current_timestamp = File.stat(@filename).ctime\n rescue Errno::ENOENT, Errno::ENOTDIR\n @current_timestamp = Time.now\n end\n end\n @current_timestamp\n end", "def write_timestamp\n filepath = \"#{Dir.tmpdir}/govpay_request_refund_service_last_run_time\"\n # FileUtils.touch seems unreliable in VM so need to write/read the actual time\n File.write(filepath, Time.zone.now)\n end", "def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end", "def create_timestamp_file\n timestamp = Time.now.utc\n timestamp_file = File.new(report_timing_file, 'w')\n timestamp_file.puts(timestamp)\n timestamp_file.close\n end", "def file_datetime\n @file_datetime\n end", "def time\r\n @time ||= @last_build_file.modification_time\r\n end", "def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend", "def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend", "def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end", "def instance_create_time\n data[:instance_create_time]\n end", "def t_stamp\n Time.now.strftime(\"%m-%d_%H-%M-%S\")\nend", "def asctime() end", "def created_at\n ensure_full_data!\n Time.at(@gapi[\"creationTime\"] / 1000.0)\n end", "def created_time\n ctime\n end", "def touch!\n @created = Time.now.to_i\n end", "def created_date_time\n return @created_date_time\n end", "def time_stamp()\n return get INIT_TIME_STAMP_NAME\n end", "def report_create(file, how, atime)\n report \"%10s [%.4fs] %s\" % [how, (Time.now - atime), file]\n end", "def createFile(file,time)\n\t\tFile.open(file, \"w+\") do |f|\n\t\t\tf.print time\n\t\tend\n\tend", "def process_creation_date_time=(value)\n @process_creation_date_time = value\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def source_file_mtime; end", "def create(filename)\n @filename = filename\n time = Time.now\n @@files[@filename] = time \n puts \"A new file: #{@filename} has been created by #{@username} at #{time}.\"\n end", "def generate_timestamp\n Time.now.strftime(\"%Y-%m-%dT%T.%N%:z\")\n end", "def creationtime\r\n\t\t\t`#{BITS::BITSADMIN} /getcreationtime {#{@id}}`\r\n\t\tend", "def now!\r\n @last_build_file.modification_time = @time = Time.now\r\n end", "def creation_date\n# stat.ctime\n @bson['uploadDate'] || Date.new\n end", "def time_since_creation\n ((Time.now - created_at) / 3600).round\n end", "def getCreatedTimeLong\r\n\t\t\t\t\treturn @createdTimeLong\r\n\t\t\t\tend", "def getCreatedTimeLong\r\n\t\t\t\t\treturn @createdTimeLong\r\n\t\t\t\tend", "def asctime\n end", "def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end", "def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def created; BoxesConsoleHelpers.simple_time(created_at) rescue \"nil\"; end", "def modified_at(file, timestamp = nil)\n require 'date'\n time = timestamp ? DateTime.parse(\"#{timestamp}\") : DateTime.now\n timestamp = time.strftime('%Y%m%d%H%M')\n execute(\"/bin/touch -mt #{timestamp} #{file}\")\n end", "def system_created\n Time.parse self['system_create_dtsi']\n end", "def file_path\n \"#{Time.now.to_f}.#{filename}\"\n end", "def parent_process_creation_date_time\n return @parent_process_creation_date_time\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def creation_date=(_); end", "def time_since_creation\n ((Time.now - created_at) / 3600).round\n end", "def created_at\n Convert.millis_to_time @gapi.statistics.creation_time\n end", "def created_at_timestamp\n Time.now.gmtime.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n end", "def creation_date\n return @creation_date if defined? @creation_date\n return unless metadata['Creation-Date']\n\n @creation_date = Time.parse(metadata['Creation-Date'])\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end", "def created_date_time=(value)\n @created_date_time = value\n end" ]
[ "0.7410935", "0.7193143", "0.71311677", "0.712116", "0.70939165", "0.70426285", "0.7032256", "0.6988432", "0.6909367", "0.6891203", "0.68147093", "0.6778458", "0.676435", "0.6633516", "0.65573084", "0.655106", "0.6550536", "0.65398204", "0.65398204", "0.65373725", "0.65351015", "0.6524039", "0.64952993", "0.64900184", "0.64219517", "0.6402424", "0.6402424", "0.6371608", "0.6341994", "0.63377196", "0.63363135", "0.63320917", "0.6286241", "0.62857556", "0.62666196", "0.6262206", "0.62490803", "0.62441945", "0.6243088", "0.6241263", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.624125", "0.62403804", "0.6220596", "0.62096417", "0.62079096", "0.6207454", "0.6199864", "0.6197397", "0.61779004", "0.61779004", "0.61507696", "0.6149743", "0.6149743", "0.6142296", "0.6127473", "0.6110977", "0.61068827", "0.6103099", "0.60784763", "0.60780525", "0.6068221", "0.60659164", "0.606262", "0.6047844", "0.6044681", "0.60383636", "0.60383636", "0.60383636", "0.60383636", "0.60383636", "0.60383636", "0.60383636", "0.60383636", "0.60383636", "0.60383636", "0.60383636" ]
0.0
-1
module Rake Declare a file task. Example: file "config.cfg" => ["config.template"] do open("config.cfg", "w") do |outfile| open("config.template") do |infile| while line = infile.gets outfile.puts line end end end end
def file(*args, &block) Rake::FileTask.define_task(*args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file(*args, &block)\n Rake::FileTask.define_task(*args, &block)\n end", "def file!(*args, &block)\n task = Rake::FileTask.define_task(*args, &block)\n CLEAN.include(task.name)\n task\nend", "def generate_file(task, &block)\n GenerateFileTask.define_task(task, &block)\n end", "def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\nend", "def rakefile(filename, data=nil, &block)\n puts \"adding rakefile #{filename}\"\n in_root(\"lib/tasks\") do |folder|\n File.open(\"#{folder}/#{filename}\", \"w\") do |f|\n if block_given?\n f.write(code_for(block))\n else\n f.write(data)\n end\n end\n end\n end", "def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\n end", "def define\n desc default_description unless ::Rake.application.last_description\n\n task(name, [:files]) do |_task, task_args|\n run_cli(task_args)\n end\n end", "def make_tasks_in_file(tasknames = [], filepath = '.', task_body = \"\\n\", namespace: '')\n\n indent = \"\"\n filedir = File.dirname(filepath)\n FileUtils.mkdir_p(filedir) unless Dir.exist?(filedir)\n\n File.open(filepath, 'w') do |f|\n unless namespace.empty?\n indent = \" \"\n f.puts namespace_start(namespace)\n end\n\n tasknames.each do |taskname|\n f.puts simple_rake_task(taskname, indent: indent, task_body: task_body)\n end\n\n f.puts namespace_end unless namespace.empty?\n end\n filepath\n end", "def create(file, task, mode)\n\n file = File.open(file, mode)\n #file.write(task)\n file.puts(task)\n file.close\n\nend", "def create_from_task_template\n File.open(file_path, 'w') do |f|\n f.puts build_task_template\n end\n end", "def task(name, description=nil, &block)\n puts \"adding task :#{name}\"\n in_root(\"lib/tasks\") do |folder|\n File.open(\"#{folder}/application.rake\", \"a+\") do |f|\n if block_given?\n f.write(code_for(block))\n else\n f.write(data)\n end\n end\n end\n end", "def rakefile\n 'Rakefile'\n end", "def add_tool(file, clazz)\n name = File.basename(file).gsub(/.rb$/, '').gsub(/_task/, '')\n doc_file = File.expand_path(File.dirname(file) + \"/#{name}_documentation.rb\")\n content = clazz.new(name, Rake::application).to_rdoc\n\n File.open(doc_file, 'w') do |f|\n f.write content\n end\n\n CLEAN.add(doc_file)\n\n task :package => doc_file\n task :rdoc => doc_file\nend", "def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end", "def define\r\n\t\t\ttask :foo do\r\n\t\t\t\tputs 'foo!'\r\n\t\t\tend\r\n\t\tend", "def define \n desc @description\n task @name => Array(deps) do\n unless Dir.exist?(@outdir)\n Dir.mkdir(@outdir)\n end\n make_file_list\n @file_list.each do |target|\n js = target.execute\n target_file = File.join(@outdir,File.basename(target.file))\n File.open(target_file, 'w') { |f| f.write(js) }\n end\n end\n\n self\n end", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def define\n\t\ttask :foo do\n\t\t\tputs 'foo!'\n\t\tend\n\tend", "def declare_rakefile\n @flavor.class.do_declare_resources do\n # :nocov:\n lazy_vars = Chef::DelayedEvaluator.new do\n { tasks: rake_tasks }\n end\n # :nocov:\n add_templates(%w(Rakefile), :create, variables: lazy_vars)\n end\n end", "def util_custom_configure(target)\n <<~EO_MKRF\n File.open(\"Rakefile\", \"w\") do |f|\n f.puts <<~EOF\n require 'fileutils'\n task :default do\n lib_dir = ENV[\"RUBYARCHDIR\"] || ENV[\"RUBYLIBDIR\"]\n FileUtils.touch File.join(lib_dir, #{target.inspect})\n end\n EOF\n end\n EO_MKRF\n end", "def rakefile_created(file)\n puts green(\"Rakefile created: #{file}\")\n end", "def initialize(*args)\n super\n\n self.targets.each do |tgt|\n tgt_f = application.define_task(Rake::FileTask, File.join(self.to_s, tgt))\n tgt_f.comment = \"Build #{tgt} in #{self}\"\n tgt_f.enhance([self])\n end\n end", "def tar(file)\n TarTask.define_task(file)\nend", "def create_copy_file_tasks(source_files, source_root, dest_root, invoking_task)\n source_files.each do |source|\n target = source.pathmap(\"%{#{source_root},#{dest_root}}p\")\n directory File.dirname(target)\n file target => [File.dirname(target), source] do |t|\n cp source, target\n end\n task invoking_task => target\n end\nend", "def configure_rdoc_task(task)\n task.rdoc_files += @ruby_sources.reject { |file| file =~ /^test|Rakefile/ } + [ \"LICENSE\", \"README.rdoc\" ]\n task.main = \"README.rdoc\"\n task.rdoc_dir = \"rdoc\"\n task.options = @spec.rdoc_options\n end", "def make_msi_file_task\n return if Rake::FileTask.task_defined? \"wix/#{name}.msi\"\n wixobjs = Rake::FileTask.tasks.select { |t| t.name.end_with? '.wixobj' }\n wixobjs.map! { |t| t.name }\n msi = Rake::FileTask.define_task \"wix/#{name}.msi\" do |t|\n wix_run 'light', \"-nologo -sval #{wixobjs.join(' ')} -o #{t.name}\"\n end\n msi.comment = \"Create the #{name}.msi file\"\n msi.enhance wixobjs\n end", "def util_custom_configure(target)\n <<-EO_MKRF\n File.open(\"Rakefile\", \"w\") do |f|\n f.puts <<-EOF\n task :default do\n lib_dir = ENV[\"RUBYARCHDIR\"] || ENV[\"RUBYLIBDIR\"]\n touch File.join(lib_dir, #{target.inspect})\n end\n EOF\n end\n EO_MKRF\n end", "def describe_rake_task(task_name, filename, &block)\n require \"rake\"\n\n describe \"Rake task #{task_name}\" do\n attr_reader :task\n\n before(:all) do\n @rake = Rake::Application.new\n Rake.application = @rake\n load filename\n @task = Rake::Task[task_name]\n end\n\n after(:all) do\n Rake.application = nil\n end\n\n def invoke!\n for action in task.instance_eval { @actions }\n instance_eval(&action)\n end\n end\n\n def tmppath(*paths)\n parts = [File.dirname(__FILE__), \"tmp\"]\n parts << (@root_time ||= Time.now.to_i.to_s)\n parts += paths\n # parts << rand().to_s.split(\".\").last\n parts.collect! {|path| path.to_s}\n path = File.join(*parts)\n attempts = 10\n while File.exists?(path)\n path.succ!\n attempts -= 1\n raise \"Unable to find a good temp pathname: #{path.inspect}\" if attempts.zero?\n end\n\n File.expand_path(path)\n end\n\n def cleanup\n path = File.expand_path(File.join(File.dirname(__FILE__), \"tmp\"))\n FileUtils.rm_rf(path)\n end\n\n instance_eval(&block)\n end\nend", "def make_copy_file_tasks\n @files.each do |source, destination|\n next if source == destination\n next if Rake::FileTask.task_defined? destination\n type = File.directory?(source) ? 'folder' : 'file'\n task = Rake::FileTask.define_task destination do |t|\n folder = File.dirname(t.name)\n FileUtils.mkpath folder unless File.directory? folder\n FileUtils.copy source, t.name\n end\n task.comment = \"Create the #{destination} #{type}\"\n task.enhance ['wix']\n if Rake::FileTask.task_defined? source\n task.enhance [source]\n end\n end\n end", "def define\n desc \"Create Ruby on Rails plug-in package\"\n task :rails_plugin do\n @dest = \"#@package_dir/#{@name}_#{@version}\"\n makedirs(@dest,:verbose=>false)\n @plugin_files.each do |fn|\n cp(fn, @dest,:verbose=>false)\n add_file(File.basename(fn))\n end\n \n @package_files.each do |fn|\n puts \". #{fn}\" if verbose\n f = File.join(@dest, fn)\n fdir = File.dirname(f)\n unless File.exist?(fdir)\n mkdir_p(fdir,:verbose=>false)\n add_folder(\"#{fdir}/\")\n end\n if File.directory?(fn)\n mkdir_p(f,:verbose=>false)\n add_folder(\"#{fn}/\")\n else\n cp(fn, f, :verbose=>false)\n add_file(fn)\n end\n end\n \n generate_index_files()\n end\n end", "def define_manifest_task\n\n if File.exist?( 'Manifest.static' )\n file 'Manifest.txt' => [ 'Manifest.static' ]\n end\n\n gf = clean_list( spec.generated_files ).sort\n [ :gem, :test ].each { |t| task t => gf }\n\n unless gf.empty?\n task :gen_clean do\n rm_f gf\n end\n task :clean => :gen_clean\n end\n\n desc \"Force update of Manifest.txt\"\n task :manifest do\n spec.generate_manifest\n end\n\n mtask = file 'Manifest.txt' do\n spec.generate_manifest\n end\n\n mtask\n end", "def define\n desc rdoc_task_description\n task rdoc_task_name\n\n desc rerdoc_task_description\n task rerdoc_task_name => [clobber_task_name, rdoc_task_name]\n\n desc clobber_task_description\n task clobber_task_name do\n rm_r @rdoc_dir rescue nil\n end\n\n task :clobber => [clobber_task_name]\n\n directory @rdoc_dir\n\n rdoc_target_deps = [\n @rdoc_files,\n Rake.application.rakefile\n ].flatten.compact\n\n task rdoc_task_name => [rdoc_target]\n file rdoc_target => rdoc_target_deps do\n @before_running_rdoc.call if @before_running_rdoc\n args = option_list + @rdoc_files\n\n $stderr.puts \"rdoc #{args.join ' '}\" if Rake.application.options.trace\n RDoc::RDoc.new.document args\n end\n\n self\n end", "def create_file(file, name, requires_edit=false)\n FileUtils.cp(file + '.example', file)\n\n if requires_edit\n puts \"Update #{file} and run `bundle exec rake setup` to continue\".color(:red)\n system(ENV['EDITOR'], file) unless ENV['EDITOR'].blank?\n exit\n end\n end", "def build_rake_step\n @rake_task << self.global_config # Open the rake Stek and get General Configuration information\n @rake_task << (self.render self.get_config_template) # get Specific Configuration. Defined in the [tool].rb module file (erb)\n @opt_parser.check_error # stop here if errors found in the configuration\n @rake_task << self.test_validation # step is already done ? Defined in the tool_template.rb file\n @rake_task << (self.render self.tool_template) # get specific Task Code. Defined in the [tool].rb module file (erb)\n @rake_task << self.write_validation # write the check file Defined in the tool_template.rb file\n @rake_task << self.close_step # To close the rake Step Defined in the tool_template.rb file\n end", "def define\n desc @description\n task @name => Array(deps) do\n FileUtilsExt.verbose(@verbose) do\n puts \"Use TESTOPTS=\\\"--verbose\\\" to pass --verbose\" \\\n \", etc. to runners.\" if ARGV.include? \"--verbose\"\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{file_list_string} #{option_list}\"\n ruby args do |ok, status|\n if !ok && status.respond_to?(:signaled?) && status.signaled?\n raise SignalException.new(status.termsig)\n elsif !ok\n status = \"Command failed with status (#{status.exitstatus})\"\n details = \": [ruby #{args}]\"\n message =\n if Rake.application.options.trace or @verbose\n status + details\n else\n status\n end\n\n fail message\n end\n end\n end\n end\n self\n end", "def define(args, &task_block)\n desc \"Generate Swagger from AppMaps\" unless ::Rake.application.last_description\n\n task(name, *args) do |_, task_args|\n RakeFileUtils.__send__(:verbose, Rake.verbose == true) do\n task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block\n Command.new(:git_command).tap do |cmd|\n cmd.base = task_args[:base] || self.base\n cmd.swagger_file = task_args[:swagger_file] || self.swagger_file\n end.perform\n end\n end\n end", "def create_file(filepath, contents = '')\n filepath = \"#{@dir}/#{@module}/#{filepath}\"\n puts \"... Creating file '#{filepath}'\"\n File.open(filepath, 'w') do |f|\n f.write contents\n end\n end", "def create_rake_files(base_dir)\n\n one_task_fn = File.join(base_dir, 'one_task.rake')\n make_tasks_in_file(['one_task'], one_task_fn) if ok_to_create?(one_task_fn)\n\n another_task_fn = File.join(base_dir, 'another_task.rake')\n make_tasks_in_file(['another_task'], another_task_fn) if ok_to_create?(another_task_fn)\n\n my_tasks_mine_fn = File.join(base_dir, 'my_tasks_all_mine.rake')\n make_tasks_in_file(['task1', 'task2', 'task3', 'task4'], my_tasks_mine_fn, namespace: 'mine') if ok_to_create?(my_tasks_mine_fn)\n\n tasks_run_all_fn = File.join(base_dir, 'other_tasks_run_all.rake')\n make_tasks_in_file(['other_task1_run_me', 'other_task2_run_me', 'other_task3_run_me', 'other_task_not_run_yet'], tasks_run_all_fn) if ok_to_create?(tasks_run_all_fn)\n\n tasks_mixed_duplicates_fn = File.join(base_dir, 'other_tasks_mixed_duplicates.rake')\n make_tasks_in_file(['other_task2_run_me', 'other_task3_run_me'], tasks_mixed_duplicates_fn) if ok_to_create?(tasks_mixed_duplicates_fn)\n\n task2_duplicate_fn = File.join(base_dir, 'task2_duplicate.rake')\n make_tasks_in_file(['task2'], task2_duplicate_fn, namespace: 'mine') if ok_to_create?(task2_duplicate_fn)\n\n task4_duplicate_fn = File.join(base_dir, 'task4_duplicate.rake')\n make_tasks_in_file(['task4'], task4_duplicate_fn, namespace: 'mine') if ok_to_create?(task4_duplicate_fn)\n end", "def build filetask,system_config,platform\n cmd_file=command_file(filetask.name,system_config,platform)\n if File.exists?(cmd_file)\n config=system_config.platform_config(platform)\n if cmd_file.end_with?('.library')\n cmdline = librarian(cmd_file,config)\n else\n cmdline = linker(cmd_file,config)\n end\n sh(cmdline.join(' '))\n else\n raise GaudiError, \"Missing command file for #{filetask.name}\"\n end\n end", "def define_asciidoc_tasks\n if defined?(AsciiDocTasks) && File.exist?(\"#{doc_dir}/asciidoc.conf\") && asciidoc_available?\n man_pages = FileList[\"#{doc_dir}/*.[0-9].txt\"]\n articles = FileList[\"#{doc_dir}/*.txt\"] - man_pages\n desc \"Build AsciiDoc under #{doc_dir}\"\n AsciiDocTasks.new('doc:asciidoc') do |t|\n t.source_dir = doc_dir\n t.source_files = articles\n t.doc_type = :article\n t.config_file = \"#{doc_dir}/asciidoc.conf\"\n t.attributes = asciidoc_attributes\n end\n AsciiDocTasks.new('doc:asciidoc') do |t|\n t.source_dir = doc_dir\n t.source_files = man_pages\n t.doc_type = :manpage\n t.config_file = \"#{doc_dir}/asciidoc.conf\"\n t.attributes = asciidoc_attributes\n end\n else\n desc \"Build AsciiDoc (disabled)\"\n task 'asciidoc'\n task 'asciidoc:build'\n task 'asciidoc:clean'\n task 'asciidoc:rebuild'\n end\n task 'doc:build' => 'doc:asciidoc:build'\n task 'doc:clean' => 'doc:asciidoc:clean'\n task 'doc:rebuild' => 'doc:asciidoc:rebuild'\n end", "def define\n desc \"Create Rails plug-in package\"\n task :rails_plugin do\n @dest = \"#@package_dir/#{@name}_#{@version}\"\n makedirs(@dest,:verbose=>false)\n @plugin_files.each do |fn|\n cp(fn, @dest,:verbose=>false)\n add_file(File.basename(fn))\n end\n\n @package_files.each do |fn|\n puts \". #{fn}\" if verbose\n f = File.join(@dest, fn)\n fdir = File.dirname(f)\n unless File.exist?(fdir)\n mkdir_p(fdir,:verbose=>false)\n add_folder(\"#{fdir}/\")\n end\n if File.directory?(fn)\n mkdir_p(f,:verbose=>false)\n add_folder(\"#{fn}/\")\n else\n cp(fn, f, :verbose=>false)\n add_file(fn)\n end\n end\n\n generate_index_files()\n end\n end", "def file(name, *args, &block)\n task_once(name, block) do\n super(name, *args) do |ta|\n block&.call(ta).tap do\n raise \"file #{ta.name} is missing after task executed\" unless File.exist?(ta.name)\n end\n end\n end\n end", "def file_coffee(name)\n source = \"#{name}.coffee\"\n file \"#{name}.js\" => source do\n sh \"coffee -c #{source}\"\n end\nend", "def define\n @file_target = sprout(gem_name, version)\n @library_path = File.join(@file_target.installed_path, @file_target.archive_path)\n define_file_task(library_path, project_path)\n end", "def define_publish_tasks\n Rake::RDocTask.new(:docs) do |rd|\n rd.main = readme_file\n rd.options << '-d' if (`which dot` =~ /\\/dot/) unless\n ENV['NODOT'] || Hoe::WINDOZE\n rd.rdoc_dir = 'doc'\n\n rd.rdoc_files += spec.require_paths\n rd.rdoc_files += spec.extra_rdoc_files\n\n title = \"#{name}-#{version} Documentation\"\n title = \"#{rubyforge_name}'s \" + title if rubyforge_name != name\n\n rd.options << \"-t\" << title\n end\n\n desc 'Generate ri locally for testing.'\n task :ridocs => :clean do\n sh %q{ rdoc --ri -o ri . }\n end\n\n desc 'Publish RDoc to RubyForge.'\n task :publish_docs => [:clean, :docs] do\n config = YAML.load(File.read(File.expand_path(\"~/.rubyforge/user-config.yml\")))\n host = \"#{config[\"username\"]}@rubyforge.org\"\n\n remote_dir = \"/var/www/gforge-projects/#{rubyforge_name}/#{remote_rdoc_dir}\"\n local_dir = 'doc'\n\n sh %{rsync #{rsync_args} #{local_dir}/ #{host}:#{remote_dir}}\n end\n\n # no doco for this one\n task :publish_on_announce do\n with_config do |config, _|\n Rake::Task['publish_docs'].invoke if config[\"publish_on_announce\"]\n end\n end\n\n desc 'Generate email announcement file.'\n task :email do\n require 'rubyforge'\n subject, title, body, urls = announcement\n\n File.open(\"email.txt\", \"w\") do |mail|\n mail.puts \"Subject: [ANN] #{subject}\"\n mail.puts\n mail.puts title\n mail.puts\n mail.puts urls\n mail.puts\n mail.puts body\n mail.puts\n mail.puts urls\n end\n puts \"Created email.txt\"\n end\n\n desc 'Post announcement to blog.'\n task :post_blog do\n require 'xmlrpc/client'\n\n with_config do |config, path|\n break unless config['blogs']\n\n subject, title, body, urls = announcement\n body += \"\\n\\n#{urls}\"\n\n config['blogs'].each do |site|\n server = XMLRPC::Client.new2(site['url'])\n content = site['extra_headers'].merge(:title => title,\n :description => body,\n :categories => blog_categories)\n\n result = server.call('metaWeblog.newPost',\n site['blog_id'],\n site['user'],\n site['password'],\n content,\n true)\n end\n end\n end\n\n desc 'Post announcement to rubyforge.'\n task :post_news do\n require 'rubyforge'\n subject, title, body, urls = announcement\n\n rf = RubyForge.new.configure\n rf.login\n rf.post_news(rubyforge_name, subject, \"#{title}\\n\\n#{body}\")\n puts \"Posted to rubyforge\"\n end\n\n desc 'Create news email file and post to rubyforge.'\n task :announce => [:email, :post_news, :post_blog, :publish_on_announce ]\n end", "def remote_file(task)\n target_roles = task.delete(:roles)\n override = task.delete(:override)\n\n UploadTask.define_task(task) do |t|\n prerequisite_file = t.prerequisites.first\n file = shared_path.join(t.name).to_s.shellescape\n\n on roles(target_roles) do\n if override || !test(\"[ -f #{file} ]\")\n info \"Uploading #{prerequisite_file} to #{file}\"\n upload! File.open(prerequisite_file), file\n end\n end\n\n end\n end", "def make_product_wxs_file_task\n return if Rake::FileTask.task_defined? \"wix/#{name}.wxs\"\n wxs = Rake::FileTask.define_task \"wix/#{name}.wxs\" do |t|\n template_file = File.join(File.dirname(__FILE__), '..', 'templates', 'product.wxs.erb')\n template_data = File.read template_file\n template = ERB.new template_data\n template_results = template.result send(:binding)\n File.open(t.name, 'w') { |io| io << template_results }\n end\n wxs.comment = \"Create the #{name}.wxs file\"\n wxs.enhance ['wix']\n if Rake::FileTask.task_defined? 'wix/Sourcery.wxs'\n wxs.enhance ['wix/Sourcery.wxs']\n end\n end", "def md5file(file, task_ext, task_dep)\n task :this_task do\n if File.exists?(\"#{file}.tmp\")\n old_sum = File.read(\"#{file}.tmp\").chomp\n else\n old_sum = \"\"\n end\n new_sum = `md5sum #{file}`.chomp\n if old_sum != new_sum\n Rake::Task[task_dep].invoke\n File.open(\"#{file}.tmp\", \"w\") {|f| f.write(new_sum)}\n end\n end\n task task_ext => :this_task \nend", "def tasks_file(name)\n File.expand_path(File.join(@path, %w[ application tasks ], name))\n end", "def define_codnar_task\n @spec.files.each do |file|\n configurations = Rake.split_configurations(file)\n Codnar::Rake::SplitTask.new([ file ], configurations) unless configurations == []\n end\n Codnar::Rake::WeaveTask.new(\"doc/root.html\", @weave_configurations)\n end", "def define_task(task_class, *args, &block)\n @ProjectFileLoader.CurrentlyLoadedProjectFile().define_task(task_class, *args, &block)\n end", "def task(*args, &block)\n args, cond = Rake::Task.strip_conditions(args)\n task = Rake::Task.define_task(*args, &block)\n task.add_conditions cond\n task\n end", "def create_file_config\n # template \"config/express_translate.yml\", \"config/express_translate.yml\"\n end", "def create_file\n\tfile = File.new\"hello_from_ruby.txt\",\"w\"\n\tputs \"-------------------------------------------\"\n\tputs \"Successfully created 'hello_from_ruby.txt'!\"\n\tputs \"-------------------------------------------\"\nend", "def load_generator_tasks!(config)\n extend ::Rake::DSL\n namespace :db do\n namespace :generate do\n\n desc \"Generate and write a config/database.yml\"\n task :config do\n db_config_path = config.db_config_path\n if File.exists?(db_config_path)\n puts \"Database config already exists at #{db_config_path}; skipping...\"\n else\n FileUtils.mkdir_p(config.config_path)\n FileUtils.cp(File.join(TEMPLATES_PATH, 'database.yml'), db_config_path)\n end\n end\n\n desc \"Generate a database migration, eg: rake db:generate:migration NAME=CreatePosts\"\n task :migration do\n migrations_path = config.migrations_path\n timestamp = Time.now.strftime(\"%Y%m%d%H%M%S\")\n name = ENV.fetch('NAME') do\n fail \"Usage: rake db:generate:migration NAME=CreatePosts\"\n end\n\n # Normalise the name to a MigrationClass and a migration_filename\n migration_class = ActiveSupport::Inflector.camelize(name)\n migration_filename = \"#{timestamp}_#{ActiveSupport::Inflector.underscore(name)}.rb\"\n migration_path = File.join(migrations_path, migration_filename)\n\n template = File.read(File.join(TEMPLATES_PATH, 'migration.erb'))\n FileUtils.mkdir_p(migrations_path)\n File.write(migration_path, ERB.new(template).result(binding))\n\n puts \"Created migration: #{migration_path}\"\n end\n end\n end\n end", "def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end", "def define\r\n\t\ttask :baz do\r\n\t\t\tputs 'these are ' + @message\r\n\t\tend\r\n\tend", "def define\n logger.debug \"Defining tasks for #{name} #{version}\"\n\n namespace \"#{name}\" do\n define_download\n define_verify\n define_unpack\n define_patch\n define_build\n define_install\n\n task :done => \"#{name}:install\"\n task :default => \"#{name}:done\"\n end\n\n desc \"Build and Install #{name} #{version}\"\n task name => \"#{name}:default\"\n end", "def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end", "def define\n desc \"Generate rokko documentation\"\n task @name do\n # Find README file for `index.html` and delete it from `sources`\n if @options[:generate_index]\n readme_source = @sources.detect { |f| File.basename(f) =~ /README(\\.(md|text|markdown|mdown|mkd|mkdn)$)?/i }\n readme = readme_source ? File.read(@sources.delete(readme_source)) : ''\n end\n\n # Run each file through Rokko and write output\n @sources.each do |filename|\n rokko = Rokko.new(filename, @sources, @options)\n out_dest = File.join(@dest, filename.sub(Regexp.new(\"#{File.extname(filename)}$\"), \".html\"))\n puts \"rokko: #{filename} -> #{out_dest}\"\n FileUtils.mkdir_p File.dirname(out_dest)\n File.open(out_dest, 'wb') { |fd| fd.write(rokko.to_html) }\n end\n\n # Generate index.html if needed\n if @options[:generate_index]\n require 'rokko/index_layout'\n out_dest = File.join(@dest, 'index.html')\n puts \"rokko: #{out_dest}\"\n File.open(out_dest, 'wb') { |fd| fd.write(IndexLayout.new(@sources, readme, @options).render) }\n end\n\n # Run specified file through rokko and use it as index\n if @options[:index] && source_index = @sources.find{|s| s == @options[:index]}\n rokko = Rokko.new(source_index, @sources, @options.merge(preserve_urls: true))\n out_dest = File.join(@dest, 'index.html')\n puts \"rokko: #{source_index} -> index.html\"\n File.open(out_dest, 'wb') { |fd| fd.write(rokko.to_html) }\n end\n\n end\n end", "def make_product_wixobj_file_task\n return if Rake::FileTask.task_defined? \"wix/#{name}.wixobj\"\n wixobj = Rake::FileTask.define_task \"wix/#{name}.wixobj\" do |t|\n wix_run 'candle', \"-nologo wix/#{name}.wxs -o #{t.name}\"\n end\n wixobj.comment = \"Create the #{name}.wixobj file\"\n wixobj.enhance [\"wix/#{name}.wxs\"]\n end", "def rake_tasks(&block); end", "def rake_tasks(&block); end", "def file_task(re, runtime, signature, version, rb, rbc)\n rbc ||= rb.sub(re, \"runtime/#{version}\") + \"c\"\n\n file rbc => [rb, signature]\n runtime << rbc\nend", "def simple_rake_task(task_name = 'test_task', indent: '', task_body: \"\\n\")\n \"\\n\" + indent +\n \"desc 'task named #{task_name}'\\n\" +\n indent + \"task :#{task_name} do\\n\" +\n indent + \" \" + task_body +\n indent + \"end\\n\\n\"\n\n end", "def create_tasks\n Application.features[self].each{ |f|\n extend Rake::DSL\n taskname = \"#{f.to_s.split('::').last}\"\n desc \"Feature\"\n task taskname => [\"#{taskname}:install\"] do\n end\n namespace taskname do\n desc \"install #{taskname}\"\n task :install do\n puts \"----> installing #{taskname}\"\n puts \"#{self} | #{f}\"\n Application.install[f.name].each{ |c|\n puts \"#{c}\"\n }\n end\n end \n } if Application.features[self]\n end", "def create_iptables_conf_file(file)\n template \"#{file}\" do\n path \"#{file}\"\n source \"iptables.erb\"\n owner \"root\"\n group \"root\"\n mode 00600\n end\nend", "def file(path, simple_templating=true)\n if simple_templating\n caller_file = caller.first\n end\n add Config::Patterns::File do |p|\n p.path = path\n if block_given?\n if simple_templating\n yield FileTemplate.new(p, self, caller_file)\n else\n yield p\n end\n end\n end\n end", "def rake project_symbol, options = {}, &gem_config\n program_file = first_caller_file\n program_home = File.dirname(program_file)\n\n # load the project module\n program_name = File.basename(program_home)\n\n require File.join('lib', program_name)\n project_module = fetch_project_module(project_symbol)\n\n # supply default options\n options[:rubyforge_project] ||= program_name\n options[:rubyforge_section] ||= program_name\n options[:raa_project] ||= program_name\n options[:license_file] ||= 'LICENSE'\n options[:logins_file] ||= File.join(ENV['HOME'], '.config', 'inochi', 'logins.yaml')\n options[:upload_delete] ||= false\n options[:upload_options] ||= []\n \n authors = project_module.const_get(:AUTHORS) rescue nil\n unless authors\n # add AUTHORS constant to the project module\n license = File.read(options[:license_file])\n\n copyright_holders =\n license.scan(/Copyright.*?\\d+\\s+(.*)/).flatten.\n map {|s| (s =~ /\\s*<(.*?)>/) ? [$`, $1] : [s, ''] }\n\n project_module.const_set :AUTHORS, copyright_holders\n end\n\n require 'rake/clean'\n\n hide_rake_task = lambda do |name|\n Rake::Task[name].instance_variable_set :@comment, nil\n end\n\n # documentation\n desc 'Build all documentation.'\n task :doc => %w[ doc:api doc:man ]\n\n # user manual\n doc_man_src = 'doc/index.erb'\n doc_man_dst = 'doc/index.xhtml'\n doc_man_deps = FileList['doc/*.erb']\n\n doc_man_doc = nil\n task :doc_man_doc => doc_man_src do\n unless doc_man_doc\n unless project_symbol == :ERBook\n gem 'erbook', '~> 6'\n require 'erbook'\n end\n\n doc_man_txt = File.read(doc_man_src)\n doc_man_doc = ERBook::Document.new(:xhtml, doc_man_txt, doc_man_src, :unindent => true)\n end\n end\n\n desc 'Build the user manual.'\n task 'doc:man' => doc_man_dst\n\n file doc_man_dst => doc_man_deps do\n Rake::Task[:doc_man_doc].invoke\n File.write doc_man_dst, doc_man_doc\n end\n\n CLOBBER.include doc_man_dst\n\n # API reference\n doc_api_dst = 'doc/api'\n\n desc 'Build API reference.'\n task 'doc:api' => doc_api_dst\n\n require 'yard'\n YARD::Rake::YardocTask.new doc_api_dst do |t|\n t.options.push '--protected',\n '--output-dir', doc_api_dst,\n '--readme', options[:license_file]\n\n task doc_api_dst => options[:license_file]\n end\n\n hide_rake_task[doc_api_dst]\n\n CLEAN.include '.yardoc'\n CLOBBER.include doc_api_dst\n\n # announcements\n desc 'Build all release announcements.'\n task :ann => %w[ ann:feed ann:html ann:text ann:mail ]\n\n # it has long been a tradition to use an \"[ANN]\" prefix\n # when announcing things on the ruby-talk mailing list\n ann_prefix = '[ANN] '\n ann_subject = ann_prefix + project_module::DISPLAY\n ann_project = ann_prefix + project_module::PROJECT\n\n # fetch the project summary from user manual\n ann_nfo_doc = nil\n task :ann_nfo_doc => :doc_man_doc do\n ann_nfo_doc = $project_summary_node\n end\n\n # fetch release notes from user manual\n ann_rel_doc = nil\n task :ann_rel_doc => :doc_man_doc do\n unless ann_rel_doc\n if parent = $project_history_node\n if child = parent.children.first\n ann_rel_doc = child\n else\n raise 'The \"project_history\" node in the user manual lacks child nodes.'\n end\n else\n raise 'The user manual lacks a \"project_history\" node.'\n end\n end\n end\n\n # build release notes in HTML and plain text\n # converts the given HTML into plain text. we do this using\n # lynx because (1) it outputs a list of all hyperlinks used\n # in the HTML document and (2) it runs on all major platforms\n convert_html_to_text = lambda do |html|\n require 'tempfile'\n\n begin\n # lynx's -dump option requires a .html file\n tmp_file = Tempfile.new(Inochi::PROGRAM).path + '.html'\n\n File.write tmp_file, html\n text = `lynx -dump #{tmp_file} -width 70`\n ensure\n File.delete tmp_file\n end\n\n # improve readability of list items that span multiple\n # lines by adding a blank line between such items\n text.gsub! %r{^( *[^\\*\\s].*)(\\r?\\n)( *\\* \\S)}, '\\1\\2\\2\\3'\n\n text\n end\n\n # binds relative addresses in the given HTML to the project docsite\n resolve_html_links = lambda do |html|\n # resolve relative URLs into absolute URLs\n # see http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax\n require 'addressable/uri'\n uri = Addressable::URI.parse(project_module::DOCSITE)\n doc_url = uri.to_s\n dir_url = uri.path =~ %r{/$|^$} ? doc_url : File.dirname(doc_url)\n\n html.to_s.gsub %r{(href=|src=)(.)(.*?)(\\2)} do |match|\n a, b = $1 + $2, $3.to_s << $4\n\n case $3\n when %r{^[[:alpha:]][[:alnum:]\\+\\.\\-]*://} # already absolute\n match\n\n when /^#/\n a << File.join(doc_url, b)\n\n else\n a << File.join(dir_url, b)\n end\n end\n end\n\n ann_html = nil\n task :ann_html => [:doc_man_doc, :ann_nfo_doc, :ann_rel_doc] do\n unless ann_html\n ann_html = %{\n <center>\n <h1>#{project_module::DISPLAY}</h1>\n <p>#{project_module::TAGLINE}</p>\n <p>#{project_module::WEBSITE}</p>\n </center>\n #{ann_nfo_doc}\n #{ann_rel_doc}\n }\n\n # remove heading navigation menus\n ann_html.gsub! %r{<div class=\"nav\"[^>]*>(.*?)</div>}, ''\n\n ann_html = resolve_html_links[ann_html]\n end\n end\n\n ann_text = nil\n task :ann_text => :ann_html do\n unless ann_text\n ann_text = convert_html_to_text[ann_html]\n end\n end\n\n ann_nfo_text = nil\n task :ann_nfo_text => :ann_nfo_doc do\n unless ann_nfo_text\n ann_nfo_html = resolve_html_links[ann_nfo_doc]\n ann_nfo_text = convert_html_to_text[ann_nfo_html]\n end\n end\n\n # HTML\n ann_html_dst = 'ANN.html'\n\n desc \"Build HTML announcement: #{ann_html_dst}\"\n task 'ann:html' => ann_html_dst\n\n file ann_html_dst => doc_man_deps do\n Rake::Task[:ann_html].invoke\n File.write ann_html_dst, ann_html\n end\n\n CLEAN.include ann_html_dst\n\n # RSS feed\n ann_feed_dst = 'doc/ann.xml'\n\n desc \"Build RSS announcement: #{ann_feed_dst}\"\n task 'ann:feed' => ann_feed_dst\n\n file ann_feed_dst => doc_man_deps do\n require 'time'\n require 'rss/maker'\n\n feed = RSS::Maker.make('2.0') do |feed|\n feed.channel.title = ann_project\n feed.channel.link = project_module::WEBSITE\n feed.channel.description = project_module::TAGLINE\n\n Rake::Task[:ann_rel_doc].invoke\n Rake::Task[:ann_html].invoke\n\n item = feed.items.new_item\n item.title = ann_rel_doc.title\n item.link = project_module::DOCSITE + '#' + ann_rel_doc.here_frag\n item.date = Time.parse(item.title)\n item.description = ann_html\n end\n\n File.write ann_feed_dst, feed\n end\n\n CLOBBER.include ann_feed_dst\n\n # plain text\n ann_text_dst = 'ANN.txt'\n\n desc \"Build plain text announcement: #{ann_text_dst}\"\n task 'ann:text' => ann_text_dst\n\n file ann_text_dst => doc_man_deps do\n Rake::Task[:ann_text].invoke\n File.write ann_text_dst, ann_text\n end\n\n CLEAN.include ann_text_dst\n\n # e-mail\n ann_mail_dst = 'ANN.eml'\n\n desc \"Build e-mail announcement: #{ann_mail_dst}\"\n task 'ann:mail' => ann_mail_dst\n\n file ann_mail_dst => doc_man_deps do\n File.open ann_mail_dst, 'w' do |f|\n require 'time'\n f.puts \"Date: #{Time.now.rfc822}\"\n\n f.puts 'To: ruby-talk@ruby-lang.org'\n f.puts 'From: \"%s\" <%s>' % project_module::AUTHORS.first\n f.puts \"Subject: #{ann_subject}\"\n\n Rake::Task[:ann_text].invoke\n f.puts '', ann_text\n end\n end\n\n CLEAN.include ann_mail_dst\n\n # packaging\n desc 'Build a release.'\n task :pak => [:clobber, :doc] do\n sh $0, 'package'\n end\n CLEAN.include 'pkg'\n\n # ruby gem\n require 'rake/gempackagetask'\n\n gem = Gem::Specification.new do |gem|\n authors = project_module::AUTHORS\n\n if author = authors.first\n gem.author, gem.email = author\n end\n\n if authors.length > 1\n gem.authors = authors.map {|name, mail| name }\n end\n\n gem.rubyforge_project = options[:rubyforge_project]\n\n # XXX: In theory, `gem.name` should be assigned to\n # ::PROJECT instead of ::PROGRAM\n #\n # In practice, PROJECT may contain non-word\n # characters and may also contain a mixture\n # of lowercase and uppercase letters.\n #\n # This makes it difficult for people to\n # install the project gem because they must\n # remember the exact spelling used in\n # `gem.name` when running `gem install ____`.\n #\n # For example, consider the \"RedCloth\" gem.\n #\n gem.name = project_module::PROGRAM\n\n gem.version = project_module::VERSION\n gem.summary = project_module::TAGLINE\n gem.description = gem.summary\n gem.homepage = project_module::WEBSITE\n gem.files = FileList['**/*'].exclude('_darcs') - CLEAN\n gem.executables = project_module::PROGRAM\n gem.has_rdoc = true\n\n unless project_module == Inochi\n gem.add_dependency 'inochi', Inochi::VERSION.requirement\n end\n\n project_module::REQUIRE.each_pair do |gem_name, version_reqs|\n gem.add_dependency gem_name, *version_reqs\n end\n\n # additional configuration is done by user\n yield gem if gem_config\n end\n\n Rake::GemPackageTask.new(gem).define\n\n # XXX: hide the tasks defined by the above gem packaging library\n %w[gem package repackage clobber_package].each {|t| hide_rake_task[t] }\n\n # releasing\n desc 'Publish a release.'\n task 'pub' => %w[ pub:pak pub:doc pub:ann ]\n\n # connect to RubyForge services\n pub_forge = nil\n pub_forge_project = options[:rubyforge_project]\n pub_forge_section = options[:rubyforge_section]\n\n task :pub_forge do\n require 'rubyforge'\n pub_forge = RubyForge.new\n pub_forge.configure('release_date' => project_module::RELEASE)\n\n unless pub_forge.autoconfig['group_ids'].key? pub_forge_project\n raise \"The #{pub_forge_project.inspect} project was not recognized by the RubyForge client. Either specify a different RubyForge project by passing the :rubyforge_project option to Inochi.rake(), or ensure that the client is configured correctly (see `rubyforge --help` for help) and try again.\"\n end\n\n pub_forge.login\n end\n\n # documentation\n desc 'Publish documentation to project website.'\n task 'pub:doc' => [:doc, 'ann:feed'] do\n target = options[:upload_target]\n\n unless target\n require 'addressable/uri'\n docsite = Addressable::URI.parse(project_module::DOCSITE)\n\n # provide uploading capability to websites hosted on RubyForge\n if docsite.host.include? '.rubyforge.org'\n target = \"#{pub_forge.userconfig['username']}@rubyforge.org:#{File.join '/var/www/gforge-projects', options[:rubyforge_project], docsite.path}\"\n end\n end\n\n if target\n cmd = ['rsync', '-auvz', 'doc/', \"#{target}/\"]\n cmd.push '--delete' if options[:upload_delete]\n cmd.concat options[:upload_options]\n\n p cmd\n sh(*cmd)\n end\n end\n\n # announcement\n desc 'Publish all announcements.'\n task 'pub:ann' => %w[ pub:ann:forge pub:ann:raa pub:ann:talk ]\n\n # login information\n ann_logins_file = options[:logins_file]\n ann_logins = nil\n\n task :ann_logins do\n ann_logins = begin\n require 'yaml'\n YAML.load_file ann_logins_file\n rescue => e\n warn \"Could not read login information from #{ann_logins_file.inspect}:\"\n warn e\n warn \"** You will NOT be able to publish release announcements! **\"\n {}\n end\n end\n\n desc 'Announce to RubyForge news.'\n task 'pub:ann:forge' => :pub_forge do\n project = options[:rubyforge_project]\n\n if group_id = pub_forge.autoconfig['group_ids'][project]\n # check if this release was already announced\n require 'mechanize'\n www = WWW::Mechanize.new\n page = www.get \"http://rubyforge.org/news/?group_id=#{group_id}\"\n\n posts = (page/'//a[starts-with(./@href, \"/forum/forum.php?forum_id=\")]/text()').map {|e| e.to_s.gsub(\"\\302\\240\", '').strip }\n\n already_announced = posts.include? ann_subject\n\n if already_announced\n warn \"This release was already announced to RubyForge news, so I will NOT announce it there again.\"\n else\n # make the announcement\n Rake::Task[:ann_text].invoke\n pub_forge.post_news project, ann_subject, ann_text\n\n puts \"Successfully announced to RubyForge news:\"\n puts page.uri\n end\n else\n raise \"Could not determine the group_id of the #{project.inspect} RubyForge project. Run `rubyforge config` and try again.\"\n end\n end\n\n desc 'Announce to ruby-talk mailing list.'\n task 'pub:ann:talk' => :ann_logins do\n host = 'http://ruby-forum.com'\n ruby_talk = 4 # ruby-talk forum ID\n\n require 'mechanize'\n www = WWW::Mechanize.new\n\n # check if this release was already announced\n already_announced =\n begin\n page = www.get \"#{host}/forum/#{ruby_talk}\", :filter => %{\"#{ann_subject}\"}\n\n posts = (page/'//div[@class=\"forum\"]//a[starts-with(./@href, \"/topic/\")]/text()').map {|e| e.to_s.strip }\n posts.include? ann_subject\n rescue\n false\n end\n\n if already_announced\n warn \"This release was already announced to the ruby-talk mailing list, so I will NOT announce it there again.\"\n else\n # log in to RubyForum\n page = www.get \"#{host}/user/login\"\n form = page.forms.first\n\n if login = ann_logins['www.ruby-forum.com']\n form['name'] = login['user']\n form['password'] = login['pass']\n end\n\n page = form.click_button # use the first submit button\n\n if (page/'//a[@href=\"/user/logout\"]').empty?\n warn \"Could not log in to RubyForum using the login information in #{ann_logins_file.inspect}, so I can NOT announce this release to the ruby-talk mailing list.\"\n else\n # make the announcement\n page = www.get \"#{host}/topic/new?forum_id=#{ruby_talk}\"\n form = page.forms.first\n\n Rake::Task[:ann_text].invoke\n form['post[subject]'] = ann_subject\n form['post[text]'] = ann_text\n\n form.checkboxes.first.check # enable email notification\n page = form.submit\n\n errors = [page/'//div[@class=\"error\"]/text()'].flatten\n if errors.empty?\n puts \"Successfully announced to ruby-talk mailing list:\"\n puts page.uri\n else\n warn \"Could not announce to ruby-talk mailing list:\"\n warn errors.join(\"\\n\")\n end\n end\n end\n end\n\n desc 'Announce to RAA (Ruby Application Archive).'\n task 'pub:ann:raa' => :ann_logins do\n show_page_error = lambda do |page, message|\n warn \"#{message}, so I can NOT announce this release to RAA:\"\n warn \"#{(page/'h2').text} -- #{(page/'p').first.text.strip}\"\n end\n\n resource = \"#{options[:raa_project].inspect} project entry on RAA\"\n\n require 'mechanize'\n www = WWW::Mechanize.new\n page = www.get \"http://raa.ruby-lang.org/update.rhtml?name=#{options[:raa_project]}\"\n\n if form = page.forms[1]\n resource << \" (owned by #{form.owner.inspect})\"\n\n Rake::Task[:ann_nfo_text].invoke\n form['description'] = ann_nfo_text\n form['description_style'] = 'Pre-formatted'\n form['short_description'] = project_module::TAGLINE\n form['version'] = project_module::VERSION\n form['url'] = project_module::WEBSITE\n form['pass'] = ann_logins['raa.ruby-lang.org']['pass']\n\n page = form.submit\n\n if page.title =~ /error/i\n show_page_error[page, \"Could not update #{resource}\"]\n else\n puts \"Successfully announced to RAA (Ruby Application Archive).\"\n end\n else\n show_page_error[page, \"Could not access #{resource}\"]\n end\n end\n\n # release packages\n desc 'Publish release packages to RubyForge.'\n task 'pub:pak' => :pub_forge do\n # check if this release was already published\n version = project_module::VERSION\n packages = pub_forge.autoconfig['release_ids'][pub_forge_section]\n\n if packages and packages.key? version\n warn \"The release packages were already published, so I will NOT publish them again.\"\n else\n # create the FRS package section\n unless pub_forge.autoconfig['package_ids'].key? pub_forge_section\n pub_forge.create_package pub_forge_project, pub_forge_section\n end\n\n # publish the package to the section\n uploader = lambda do |command, *files|\n pub_forge.__send__ command, pub_forge_project, pub_forge_section, version, *files\n end\n\n Rake::Task[:pak].invoke\n packages = Dir['pkg/*.[a-z]*']\n\n unless packages.empty?\n # NOTE: use the 'add_release' command ONLY for the first\n # file because it creates a new sub-section on the\n # RubyForge download page; we do not want one package\n # per sub-section on the RubyForge download page!\n #\n uploader[:add_release, packages.shift]\n\n unless packages.empty?\n uploader[:add_file, *packages]\n end\n\n puts \"Successfully published release packages to RubyForge.\"\n end\n end\n end\n end", "def create_copy_task srcGlob, targetDir, taskSymbol\n mkdir_p(targetDir, :verbose => false)\n FileList[srcGlob].each do |f|\n target = File.join(targetDir, File.basename(f))\n file target => [f] do |t|\n cp f, target\n end\n task taskSymbol => target\n end\nend", "def rake(task,*args)\n run 'rake', rake_task(task,*args)\n end", "def file_name\n \"#{task_name}.rake\"\n end", "def define\n desc \"Create & migrate the DB for your named TIMESHEET\"\n task \"#{@name}:prepare\", [:timesheet] => [\"#{@name}:env\"] do |t, args|\n Enrar::Migrator.new.migrate!\n end\n\n desc \"Print the URL for the provided TIMESHEET\"\n task \"#{@name}:url\", [:timesheet] => [\"#{@name}:env\"] do |t, args|\n require 'socket'\n ip = Socket::getaddrinfo(Socket.gethostname,\"echo\",Socket::AF_INET)[0][3]\n puts \"http://#{ip}:#{@config[:port] || 8912}/\"\n end\n\n task \"#{@name}:env\", [:timesheet] do |t, args|\n @timesheet = File.expand_path('~/.secretary') unless args[:timesheet]\n @config = Vim::Secretary::Config.from_timesheet(@timesheet)\n end\n\n self\n end", "def define_tasks\n fail \"Version required (or :noversion)\" if @version.nil?\n @version = nil if :noversion == @version\n\n desc \"Build the disk image file\"\n task :dmg => \"#{package_dir}/#{dmg_file}\"\n\n file \"#{package_dir}/#{dmg_file}\" => dmg_dir_path do\n chdir package_dir do\n sh \"#{dmg_command} create #{dmg_options}\"\n end\n end\n\n directory package_dir\n\n file dmg_dir_path => source_files + extra_source_files.keys do\n prefix_to_strip = /^#{@strip}/ if @strip\n mkdir_p package_dir rescue nil\n source_files.each do |fn|\n fn_stripped = @strip == nil ? fn : fn.sub(prefix_to_strip, '')\n f = File.join(dmg_dir_path, fn_stripped)\n fdir = File.dirname(f)\n mkdir_p(fdir) if !File.exist?(fdir)\n if File.directory?(fn)\n mkdir_p(f)\n else\n rm_f f\n safe_ln(fn, f)\n end\n end\n extra_source_files.each do |k, v|\n f = File.join(dmg_dir_path, v)\n mkdir_p(File.dirname(f)) rescue nil\n rm_f f\n safe_ln k, f\n end\n end\n\n desc \"Remove the disk image files\"\n task :clobber_dmg do\n rm_r package_dir rescue nil\n end\n\n task :clobber => :clobber_dmg\n\n desc \"Force a rebuild of the disk image file\"\n task :rebuild_dmg => [:clobber_dmg, :dmg]\n\n self\n end", "def quick_make_file(local_file, tpl_file)\n current_file = local_file(local_file)\n template_file = @template.real_path(tpl_file)\n @template.make_file(\n template_file,\n current_file,\n @args.all.dup,\n make_data_files_array(current_file),\n method(:update_latest_options)\n )\n end", "def make_sourcery_wxs_file_task\n return if Rake::FileTask.task_defined? 'wix/Sourcery.wxs'\n sourcery = Rake::FileTask.define_task 'wix/Sourcery.wxs' do |t|\n if File.directory? 'wix/src'\n args = []\n args << '-nologo' # Skip printing of the WiX logo\n args << '-sfrag' # Suppress fragments\n args << '-srd' # Don't harvest the root directory e.g. wix\\src\n args << '-ag' # Auto generate GUIDs\n args << '-template fragment'\n args << '-dr INSTALLDIR'\n args << '-var var.Source'\n args = args.join(' ')\n wix_run 'heat', \"dir wix/src #{args} -out #{t.name}\"\n end\n end\n sourcery.comment = 'Create the Sourcery.wxs file'\n sourcery.enhance ['wix']\n sourcery.enhance @files.values\n end", "def file_task? path\r\n task = Rake.application.find_task path\r\n if not task\r\n if File.exists? path\r\n task = Rake.application.define_task(Rake::FastFileTask, path)\r\n end\r\n end\r\n if task\r\n # Generate file so it can be processed for includes\r\n # as well.\r\n task.invoke\r\n true\r\n else\r\n false\r\n end\r\n end", "def generate_rake_tasks\n @rake_tasks = outputs.map do |output, inputs|\n additional_paths = []\n inputs.each do |input|\n\n create_file_task(input.fullpath).dynamic do\n additional_paths += additional_dependencies(input)\n end\n end\n additional_paths.each { |path| create_file_task(path) }\n\n create_file_task(output.fullpath, inputs.map(&:fullpath)) do\n output.create { generate_output(inputs, output) }\n end\n end\n end", "def make_sourcery_wixobj_file_task\n return unless Rake::FileTask.task_defined? 'wix/Sourcery.wxs'\n wixobj = Rake::FileTask.define_task 'wix/Sourcery.wixobj' do |t|\n wix_run 'candle', \"-nologo wix/Sourcery.wxs -dSource=wix/src -o #{t.name}\"\n end\n wixobj.comment = 'Create the Sourcery.wixobj file'\n wixobj.enhance ['wix/Sourcery.wxs']\n end", "def run_task(broker, targets, task, files, input: {}, metadata: nil, **kwargs, &block)\n params = { task: task, input: input, files: files }\n params[:metadata] = metadata if metadata\n do_module_action(broker, agent_identities(targets), 'task', 'run', params, **kwargs, &block)\nend", "def configure_tasks\n end", "def write_erb(source, destination)\n begin\n @task.shell.mute do\n @task.create_file(destination) do\n @project.parse_erb(source)\n end\n end\n rescue Exception => e\n @task.say \"Error while building #{File.basename(source)}:\"\n @task.say e.message + \"\\n\", Thor::Shell::Color::RED\n exit\n end\n end", "def setup_tests\n Rake::TestTask.new do |t|\n t.libs << \"test\"\n t.test_files = FileList['test/test*.rb']\n t.verbose = true\n end\nend", "def define_tasks!\n\n define_test_tasks! if has_tests?\n define_rspec_tasks! if has_specs?\n\n namespace(@task_namespace) do\n desc \"Updates the filelist in the gemspec file\"\n task(:manifest) { manifest_task }\n\n desc \"Builds the .gem package\"\n task(:build => :manifest) { build_task }\n\n desc \"Sets the version of the gem in the gemspec\"\n task(:set_version => [:check_version, :check_current_branch]) { version_task }\n task(:check_version => :fetch_origin) { check_version_task }\n\n task(:fetch_origin) { fetch_origin_task }\n task(:check_current_branch) { check_current_branch_task }\n task(:check_clean_status) { check_clean_status_task }\n task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }\n\n checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]\n checks.unshift('spec:basic') if has_specs?\n checks.unshift('test:basic') if has_tests?\n # checks.push << [:check_rubyforge] if gemspec.rubyforge_project\n\n desc \"Perform all checks that would occur before a release\"\n task(:release_checks => checks)\n\n release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]\n # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project\n\n desc \"Release a new version of the gem using the VERSION environment variable\"\n task(:release => release_tasks) { release_task }\n \n namespace(:release) do\n desc \"Release the next version of the gem, by incrementing the last version segment by 1\"\n task(:next => [:next_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a patch increment (0.0.1)\"\n task(:patch => [:next_patch_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a minor increment (0.1.0)\"\n task(:minor => [:next_minor_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a major increment (1.0.0)\"\n task(:major => [:next_major_version] + release_tasks) { release_task }\n end\n\n # task(:check_rubyforge) { check_rubyforge_task }\n # task(:rubyforge_release) { rubyforge_release_task }\n task(:gemcutter_release) { gemcutter_release_task }\n task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }\n task(:tag_version) { tag_version_task }\n task(:commit_modified_files) { commit_modified_files_task }\n\n task(:next_version) { next_version_task }\n task(:next_patch_version) { next_version_task(:patch) }\n task(:next_minor_version) { next_version_task(:minor) }\n task(:next_major_version) { next_version_task(:major) }\n \n desc \"Updates the gem release tasks with the latest version on Github\"\n task(:update_tasks) { update_tasks_task }\n end\n end", "def declare_rake_tasks\n @flavor.class.do_declare_resources do\n if snippet?('cookbook_base')\n rake_tasks['foodcritic'] = <<'END'\nrequire 'foodcritic'\nrequire 'foodcritic/rake_task'\n\nFoodCritic::Rake::LintTask.new(:foodcritic)\ntask style: :foodcritic\nEND\n end\n end\n end", "def add_rakefile_and_tasks(rakefilename, task_names)\n\n # creates a new EvaluatedRakeFile entry if needed\n ev_rakefile = self.all_rakefiles[rakefilename]\n ev_rakefile.add_task_names(task_names)\n self.all_tasks.concat(ev_rakefile.all_tasks)\n\n ev_rakefile\n end", "def gem_build_task(gem,namespace_name=:gems)\n namespace(namespace_name) do\n gem_dir = CapyBrowser::Rake::RelativePath.new('tmp/gems').path\n directory gem_dir\n\n desc gem.build_description\n task :build => [:directories,gem.name.to_sym ] do |t|\n t.reenable\n end\n\n desc \"Build all gems\"\n task :rebuild do |t|\n rm_rf(gem_dir)\n Rake::Task[\"gems:build\"].reenable\n Rake::Task[\"gems:build\"].invoke\n end\n\n desc gem.build_gemfile_description\n task gem.name.to_sym => [gem.gemfile] do |t|\n t.reenable\n end\n\n file \"tmp/vendor/cache/#{gem.gemfile}\" => [gem.gemfile_path.relative_path]\n file gem.gemfile_path.relative_path => gem.gemfile\n file gem.gemfile => gem_dir do |t|\n puts gem.invoke!\n rm_rf(gem_dir)\n end\n end\nend", "def load_tasks(tasks)\n load File.join(File.dirname(__FILE__), 'tasks', \"#{tasks}.rb\")\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def initialize(name = nil)\n @tasks = []\n @spec_task = nil\n\n last_desc = ::Rake.application.last_description\n desc nil\n\n yield self if block_given?\n\n if cfndsl_opts\n desc last_desc if last_desc\n task(name || :generate) { |_t, _args| cfndsl_opts[:files].each { |opts| generate(opts) } }\n else\n define_base_tasks(name || :generate, last_desc)\n end\n end", "def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n archiver = @tcs[:ARCHIVER]\n\n res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do\n cmd = calc_command_line\n aname = calc_archive_name\n Dir.chdir(@project_dir) do\n FileUtils.rm(aname) if File.exists?(aname)\n# cmd.map! {|c| c.include?(' ') ? \"\\\"#{c}\\\"\" : c }\n rd, wr = IO.pipe\n cmd << {\n :err => wr,\n :out => wr\n }\n sp = spawn(*cmd)\n cmd.pop\n\n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n\n process_result(cmd, consoleOutput, @tcs[:ARCHIVER][:ERROR_PARSER], \"Creating #{aname}\")\n\n check_config_file()\n end\n end\n res.tags = tags\n enhance_with_additional_files(res)\n add_output_dir_dependency(get_task_name, res, true)\n\n add_grouping_tasks(get_task_name)\n\n setup_rake_dependencies(res, object_multitask)\n return res\n end", "def create_compile_ext_tasks(source_root, dest_root, invoking_task)\n compiled_ext = \"#{source_root}/#{SPECIAL_BUNDLE_NAMES[File.basename(source_root)] || File.basename(source_root)}.bundle\"\n create_copy_file_tasks(FileList[compiled_ext], source_root, dest_root, invoking_task)\n file compiled_ext => FileList[\"#{source_root}/*.c\"] do\n cd source_root do\n `ruby extconf.rb; make >/dev/null 2>&1`\n end\n end\nend", "def make_msi_task\n return if Rake::Task.task_defined? :msi\n msi = Rake::Task.define_task :msi\n msi.comment = \"Create the MSI\"\n msi.enhance [\"wix/#{name}.msi\"]\n end", "def apply_file(file, output_dir)\n # TODO: this should refer to the project_config_file variable from\n # Templar::Setup.\n return if File.basename(file) == 'templar.yaml'\n\n if file.match(/\\.erb$/)\n out = File.join(output_dir, File.basename(file, '.erb').gsub(@template, @project))\n erb = ERB.new(File.read(file))\n File.open(out, 'w') do |f|\n begin\n f.write erb.result(binding)\n rescue\n puts \"Unable to process file: #{file}\"\n exit\n end\n end\n else\n out = File.join(output_dir, File.basename(file).gsub(@template, @project))\n File.open(out, 'w') do |f|\n f.write File.read(file)\n end\n end\n end", "def define\n fail \"Version required (or :noversion)\" if @version.nil?\n @version = nil if :noversion == @version\n\n desc \"Build all the packages\"\n task :package\n\n desc \"Force a rebuild of the package files\"\n task repackage: [:clobber_package, :package]\n\n desc \"Remove package products\"\n task :clobber_package do\n rm_r package_dir rescue nil\n end\n\n task clobber: [:clobber_package]\n\n [\n [need_tar, tgz_file, \"z\"],\n [need_tar_gz, tar_gz_file, \"z\"],\n [need_tar_bz2, tar_bz2_file, \"j\"],\n [need_tar_xz, tar_xz_file, \"J\"]\n ].each do |need, file, flag|\n if need\n task package: [\"#{package_dir}/#{file}\"]\n file \"#{package_dir}/#{file}\" =>\n [package_dir_path] + package_files do\n chdir(working_dir) { sh @tar_command, \"#{flag}cvf\", file, target_dir }\n mv \"#{package_dir_path}/#{target_dir}\", package_dir if without_parent_dir\n end\n end\n end\n\n if need_zip\n task package: [\"#{package_dir}/#{zip_file}\"]\n file \"#{package_dir}/#{zip_file}\" =>\n [package_dir_path] + package_files do\n chdir(working_dir) { sh @zip_command, \"-r\", zip_file, target_dir }\n mv \"#{package_dir_path}/#{zip_file}\", package_dir if without_parent_dir\n end\n end\n\n directory package_dir_path => @package_files do\n @package_files.each do |fn|\n f = File.join(package_dir_path, fn)\n fdir = File.dirname(f)\n mkdir_p(fdir) unless File.exist?(fdir)\n if File.directory?(fn)\n mkdir_p(f)\n else\n rm_f f\n safe_ln(fn, f)\n end\n end\n end\n self\n end", "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "def ruby_rake_task(task)\n Rake::Task[task].invoke\nend" ]
[ "0.7712839", "0.7079847", "0.69677216", "0.69415593", "0.6836613", "0.6782593", "0.67193663", "0.6513875", "0.64049387", "0.636113", "0.6322388", "0.6308451", "0.6272988", "0.6239362", "0.6113482", "0.61101", "0.6076254", "0.6076254", "0.6057535", "0.60332125", "0.5974595", "0.5969414", "0.59693915", "0.5952454", "0.5950129", "0.5933351", "0.5906124", "0.590489", "0.5891963", "0.5868679", "0.576666", "0.57632893", "0.5762205", "0.5738645", "0.57262504", "0.5715878", "0.5697211", "0.568442", "0.5682394", "0.5677086", "0.56691915", "0.56670046", "0.5664727", "0.56439", "0.5643832", "0.56346947", "0.5629491", "0.56065434", "0.5601531", "0.5598971", "0.55812085", "0.557826", "0.5571555", "0.5570724", "0.5552516", "0.55520636", "0.55504495", "0.5523465", "0.5508874", "0.55010635", "0.5498201", "0.5492335", "0.5491734", "0.5491734", "0.5490079", "0.54871225", "0.54857045", "0.54780847", "0.54772854", "0.5457139", "0.54505193", "0.5441475", "0.5422566", "0.542238", "0.54184794", "0.54094255", "0.54047364", "0.5404313", "0.54042405", "0.53981245", "0.5395462", "0.53802985", "0.537951", "0.53778183", "0.53715533", "0.53608835", "0.53463745", "0.53436196", "0.5332785", "0.5314514", "0.5314514", "0.5314514", "0.53123313", "0.5311504", "0.5308119", "0.5304922", "0.5302145", "0.52995783", "0.52951235", "0.52948725" ]
0.7863632
0
Declare a file creation task. (Mainly used for the directory command).
def file_create(args, &block) Rake::FileCreationTask.define_task(args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\n end", "def generate_file(task, &block)\n GenerateFileTask.define_task(task, &block)\n end", "def create(file, task, mode)\n\n file = File.open(file, mode)\n #file.write(task)\n file.puts(task)\n file.close\n\nend", "def file(*args, &block)\n Rake::FileTask.define_task(*args, &block)\nend", "def file(*args, &block)\n Rake::FileTask.define_task(*args, &block)\n end", "def create_task_file(task_id, project_id, filename, blob)\n request(method: 'createTaskFile',\n params: {\n task_id: task_id,\n project_id: project_id,\n filename: filename,\n blob: blob\n })\n end", "def create_from_task_template\n File.open(file_path, 'w') do |f|\n f.puts build_task_template\n end\n end", "def define\n desc default_description unless ::Rake.application.last_description\n\n task(name, [:files]) do |_task, task_args|\n run_cli(task_args)\n end\n end", "def create_copy_task srcGlob, targetDir, taskSymbol\n mkdir_p(targetDir, :verbose => false)\n FileList[srcGlob].each do |f|\n target = File.join(targetDir, File.basename(f))\n file target => [f] do |t|\n cp f, target\n end\n task taskSymbol => target\n end\nend", "def make_tasks_in_file(tasknames = [], filepath = '.', task_body = \"\\n\", namespace: '')\n\n indent = \"\"\n filedir = File.dirname(filepath)\n FileUtils.mkdir_p(filedir) unless Dir.exist?(filedir)\n\n File.open(filepath, 'w') do |f|\n unless namespace.empty?\n indent = \" \"\n f.puts namespace_start(namespace)\n end\n\n tasknames.each do |taskname|\n f.puts simple_rake_task(taskname, indent: indent, task_body: task_body)\n end\n\n f.puts namespace_end unless namespace.empty?\n end\n filepath\n end", "def create_file (file_path)\n \"touch '#{file_path}'\"\n end", "def tar(file)\n TarTask.define_task(file)\nend", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def event_file_create_command(id, index, event_src)\n disk.file_create_command(event_filename(id, index), event_src)\n end", "def new_file\n raise \"Not a Valid Directory\" unless valid_directory?\n\n file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}_#{process}.txt\"\n \"#{output_directory_path}#{file_name}\"\n end", "def make_copy_file_tasks\n @files.each do |source, destination|\n next if source == destination\n next if Rake::FileTask.task_defined? destination\n type = File.directory?(source) ? 'folder' : 'file'\n task = Rake::FileTask.define_task destination do |t|\n folder = File.dirname(t.name)\n FileUtils.mkpath folder unless File.directory? folder\n FileUtils.copy source, t.name\n end\n task.comment = \"Create the #{destination} #{type}\"\n task.enhance ['wix']\n if Rake::FileTask.task_defined? source\n task.enhance [source]\n end\n end\n end", "def create_copy_file_tasks(source_files, source_root, dest_root, invoking_task)\n source_files.each do |source|\n target = source.pathmap(\"%{#{source_root},#{dest_root}}p\")\n directory File.dirname(target)\n file target => [File.dirname(target), source] do |t|\n cp source, target\n end\n task invoking_task => target\n end\nend", "def createSimpleTask _obj, _args\n \"_obj createSimpleTask _args;\" \n end", "def rakefile_created(file)\n puts green(\"Rakefile created: #{file}\")\n end", "def file!(*args, &block)\n task = Rake::FileTask.define_task(*args, &block)\n CLEAN.include(task.name)\n task\nend", "def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end", "def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend", "def create(filename, text); end", "def events_file_create_command(id, event0_src)\n disk.file_create_command(events_filename(id), event0_src)\n end", "def create_file\n\tfile = File.new\"hello_from_ruby.txt\",\"w\"\n\tputs \"-------------------------------------------\"\n\tputs \"Successfully created 'hello_from_ruby.txt'!\"\n\tputs \"-------------------------------------------\"\nend", "def initialize(file_name)\n create(file_name)\n end", "def createFile (pathFile,extension,nameFile, erb)\r\n FileUtils.mkdir_p(pathFile)\r\n fileName = pathFile+nameFile+extension\r\n newFile = File.open(fileName,\"w\")\r\n newFile.print erb\r\n newFile.close\r\n end", "def define \n desc @description\n task @name => Array(deps) do\n unless Dir.exist?(@outdir)\n Dir.mkdir(@outdir)\n end\n make_file_list\n @file_list.each do |target|\n js = target.execute\n target_file = File.join(@outdir,File.basename(target.file))\n File.open(target_file, 'w') { |f| f.write(js) }\n end\n end\n\n self\n end", "def create_file(filename)\r\n CreateFile.new(filename)\r\n end", "def create_from_file\n end", "def create_directory(file)\n end", "def create(filename)\n @filename = filename\n time = Time.now\n @@files[@filename] = time \n puts \"A new file: #{@filename} has been created by #{@username} at #{time}.\"\n end", "def create_rake_files(base_dir)\n\n one_task_fn = File.join(base_dir, 'one_task.rake')\n make_tasks_in_file(['one_task'], one_task_fn) if ok_to_create?(one_task_fn)\n\n another_task_fn = File.join(base_dir, 'another_task.rake')\n make_tasks_in_file(['another_task'], another_task_fn) if ok_to_create?(another_task_fn)\n\n my_tasks_mine_fn = File.join(base_dir, 'my_tasks_all_mine.rake')\n make_tasks_in_file(['task1', 'task2', 'task3', 'task4'], my_tasks_mine_fn, namespace: 'mine') if ok_to_create?(my_tasks_mine_fn)\n\n tasks_run_all_fn = File.join(base_dir, 'other_tasks_run_all.rake')\n make_tasks_in_file(['other_task1_run_me', 'other_task2_run_me', 'other_task3_run_me', 'other_task_not_run_yet'], tasks_run_all_fn) if ok_to_create?(tasks_run_all_fn)\n\n tasks_mixed_duplicates_fn = File.join(base_dir, 'other_tasks_mixed_duplicates.rake')\n make_tasks_in_file(['other_task2_run_me', 'other_task3_run_me'], tasks_mixed_duplicates_fn) if ok_to_create?(tasks_mixed_duplicates_fn)\n\n task2_duplicate_fn = File.join(base_dir, 'task2_duplicate.rake')\n make_tasks_in_file(['task2'], task2_duplicate_fn, namespace: 'mine') if ok_to_create?(task2_duplicate_fn)\n\n task4_duplicate_fn = File.join(base_dir, 'task4_duplicate.rake')\n make_tasks_in_file(['task4'], task4_duplicate_fn, namespace: 'mine') if ok_to_create?(task4_duplicate_fn)\n end", "def event_file_create_command(id, index, event_src)\n saver.file_create_command(event_filename(id, index), event_src)\n end", "def manifest_file_create_command(id, manifest_src)\n disk.file_create_command(manifest_filename(id), manifest_src)\n end", "def new_files; end", "def call(_obj, args, _ctx)\n Task.create!(\n name: args[:name],\n description: args[:description]\n )\n end", "def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end", "def create_file(uid, info = {})\n content_type = Tus::Info.new(info).metadata[\"content_type\"]\n\n create_grid_file(\n filename: uid,\n content_type: content_type,\n )\n end", "def run\n Execution.block 'Creating a custom file', @target, 'root' do |b|\n b.always_run true\n b.run \"mkdir -p #{::File.dirname(@target)}\"\n ::File.open(@target, 'w+') { |file| file.write @content }\n b.run \"chown #{@owner}:#{@owner} #{::File.dirname(@target)}\"\n b.run \"chown #{@owner}:#{@owner} #{@target}\"\n b.run \"chmod #{unix_mode} #{@target}\"\n end\n end", "def initialize(*args)\n super\n\n self.targets.each do |tgt|\n tgt_f = application.define_task(Rake::FileTask, File.join(self.to_s, tgt))\n tgt_f.comment = \"Build #{tgt} in #{self}\"\n tgt_f.enhance([self])\n end\n end", "def make_msi_file_task\n return if Rake::FileTask.task_defined? \"wix/#{name}.msi\"\n wixobjs = Rake::FileTask.tasks.select { |t| t.name.end_with? '.wixobj' }\n wixobjs.map! { |t| t.name }\n msi = Rake::FileTask.define_task \"wix/#{name}.msi\" do |t|\n wix_run 'light', \"-nologo -sval #{wixobjs.join(' ')} -o #{t.name}\"\n end\n msi.comment = \"Create the #{name}.msi file\"\n msi.enhance wixobjs\n end", "def create_file(filename)\n # See zipfile branch in repository for zip file creation code.\n Dir.mkdir filename\n # TODO: Handle case where directory can't be created.\n end", "def create(filename)\n time = Time.now\n @files[filename] = time # Updates the \"files\" hash with the timestamp for when the file was created\n puts \"The file #{filename} was created at #{time}\"\n end", "def create(filename)\n time = Time.now\n @files[filename] = time\n puts \"#{filename} was created by #{@username} at #{time}.\"\n end", "def create_file(filepath, contents = '')\n filepath = \"#{@dir}/#{@module}/#{filepath}\"\n puts \"... Creating file '#{filepath}'\"\n File.open(filepath, 'w') do |f|\n f.write contents\n end\n end", "def initialize(fileName, build, config = nil, fileIsGenerated = false, generatorTask = nil)\n @fileName = Makr.cleanPathName(fileName)\n # now we need a unique name for this task. As we're defining a FileTask as dependency to fileName\n # and a FileTask on the @objectFileName to ensure a build of the target if it was deleted or\n # otherwise modified (whatever you can think of here), we need a unique name not related to these\n super(CompileTask.makeName(@fileName), config)\n @build = build\n\n # the dep tasks, that are constructed below are not added yet to the dependencies Array as this is done\n # in buildDependencies(), called before update\n\n # first construct a dependency on the file itself, if it isnt generated\n # (we dont add dependencies yet, as they get added upon automatic dependency generation in\n # the function buildDependencies())\n @fileIsGenerated = fileIsGenerated\n @generatorTaskDep = generatorTask\n if not @fileIsGenerated then\n @compileFileDep = @build.getOrMakeNewTask(@fileName) {FileTask.new(@fileName)}\n end\n\n # construct a dependency task on the target object file\n @objectFileName = makeObjectFileName(fileName)\n @compileTargetDep = @build.getOrMakeNewTask(@objectFileName) {FileTask.new(@objectFileName, false)}\n @targets = [@objectFileName] # set targets produced by this task\n deleteTargets() # delete targets upon construction to guarantee a first update\n\n # construct a dependency task on the configuration\n @configTaskDep = @build.getOrMakeNewTask(ConfigTask.makeName(@name)) {ConfigTask.new(ConfigTask.makeName(@name))}\n\n # then add the dependencies constructed above\n File.delete(@objectFileName + \".d\") rescue nil # first delete an existing dep file\n\n # we call this here to safe code, although no dep file exists, still we need to add the\n # static dependencies (@compileFileDep,...)\n buildDependencies()\n\n Makr.log.debug(\"made CompileTask with @name=\\\"\" + @name + \"\\\"\") # debug feedback\n end", "def test_create_a_new_task\n results = Task.createNewTask(\"#{MyApp.settings.root}/tests/unit/tasks_test_add_new.txt\", \"Bob\", \"Sweep up Grandpa's ashes\", \"12373514\")\n assert_equal(nil, results)\n end", "def initialize(nod, c)\n\t\t\t\t\n\t\tsplitDirectory(nod)\n\t\t\n\t\tself.content = c\n\t\tself.description = \"-Creating a file: '#{name_of_subject}'\"\n\n\tend", "def events_file_create_command(id, event0_src)\n saver.file_create_command(events_filename(id), event0_src)\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 create_new_file(file_name)\n puts \"Creating %s...\" % [file_name]\n make_dir_for_path(file_name)\n new_file = File.new(file_name, File::WRONLY|File::TRUNC|File::CREAT)\n end", "def create_file(file, name, requires_edit=false)\n FileUtils.cp(file + '.example', file)\n\n if requires_edit\n puts \"Update #{file} and run `bundle exec rake setup` to continue\".color(:red)\n system(ENV['EDITOR'], file) unless ENV['EDITOR'].blank?\n exit\n end\n end", "def add_tool(file, clazz)\n name = File.basename(file).gsub(/.rb$/, '').gsub(/_task/, '')\n doc_file = File.expand_path(File.dirname(file) + \"/#{name}_documentation.rb\")\n content = clazz.new(name, Rake::application).to_rdoc\n\n File.open(doc_file, 'w') do |f|\n f.write content\n end\n\n CLEAN.add(doc_file)\n\n task :package => doc_file\n task :rdoc => doc_file\nend", "def manifest_file_create_command(id, manifest_src)\n saver.file_create_command(manifest_filename(id), manifest_src)\n end", "def CreateFile(filename)\n @tomerge = Builtins.add(@tomerge, filename)\n Builtins.y2milestone(\"Created default rules: %1\", @tomerge)\n nil\n end", "def generate()\n objects = []\n\n # generate object file tasks\n files.each do |fname|\n output_file = File.join(@build_dir, File.basename(fname).ext('o'))\n objects.push output_file\n file output_file => [ fname ] do\n get_toolchain().compile( fname, output_file )\n end\n end\n\n # Link object files\n file output_file() => objects do\n get_toolchain().link( objects, output_file() )\n end\n\n # Create top level task\n desc \"Build the #{@name} application\"\n task @name => [ output_file() ]\n end", "def define_manifest_task\n\n if File.exist?( 'Manifest.static' )\n file 'Manifest.txt' => [ 'Manifest.static' ]\n end\n\n gf = clean_list( spec.generated_files ).sort\n [ :gem, :test ].each { |t| task t => gf }\n\n unless gf.empty?\n task :gen_clean do\n rm_f gf\n end\n task :clean => :gen_clean\n end\n\n desc \"Force update of Manifest.txt\"\n task :manifest do\n spec.generate_manifest\n end\n\n mtask = file 'Manifest.txt' do\n spec.generate_manifest\n end\n\n mtask\n end", "def make_product_wixobj_file_task\n return if Rake::FileTask.task_defined? \"wix/#{name}.wixobj\"\n wixobj = Rake::FileTask.define_task \"wix/#{name}.wixobj\" do |t|\n wix_run 'candle', \"-nologo wix/#{name}.wxs -o #{t.name}\"\n end\n wixobj.comment = \"Create the #{name}.wixobj file\"\n wixobj.enhance [\"wix/#{name}.wxs\"]\n end", "def create\n FileUtils.mkdir_p path\n end", "def create(dest_file, filenames = [], options = {})\n\t\t\tWriter.new(filenames).write(dest_file, options)\n\t\tend", "def declare_rakefile\n @flavor.class.do_declare_resources do\n # :nocov:\n lazy_vars = Chef::DelayedEvaluator.new do\n { tasks: rake_tasks }\n end\n # :nocov:\n add_templates(%w(Rakefile), :create, variables: lazy_vars)\n end\n end", "def create_task\n task = Task.create!(\n description: 'Test Task'\n )\nend", "def create_model_file\n template 'job_model.rb', File.join('app/models', class_path, \"#{file_name}.rb\")\n end", "def file(name, *args, &block)\n task_once(name, block) do\n super(name, *args) do |ta|\n block&.call(ta).tap do\n raise \"file #{ta.name} is missing after task executed\" unless File.exist?(ta.name)\n end\n end\n end\n end", "def create_file(directory, filename, content, title, editor)\n FileUtils.mkdir(directory) unless File.exists?(directory)\n if File.exists?(\"#{directory}/#{filename}\")\n raise \"The file already exists.\"\n else\n write_file(content, title, directory, filename)\n if editor && !editor.nil?\n sleep 1\n execute(\"#{editor} #{directory}/#{filename}\")\n end\n end\nend", "def create\n\t type = @params[0].split('.')\n\n\t if type[1]\n\n\t if @params[1]\n\t FileUtils.touch(@params[1]+'/'+@params[0])\n\t else\n\t FileUtils.touch(@params[0])\n\t end\n\t else\n\t if @params[1]\n\t FileUtils::mkdir_p @params[1]+'/'+@params[0]\n\t else\n\t FileUtils::mkdir_p @params[0]\n\t end\n\t end\n\t end", "def task_creation(task)\n @task = task\n @project = @task.project\n mail to: task.user.email, subject: \"New task created: #{task.name}\"\n end", "def task_create(task, data=nil)\n if task_present? task\n task = task_get task\n elsif task.is_a? Deployment::Task\n task = task_add task\n else\n task = Deployment::Task.new task, node, data\n task = task_add task\n end\n task.data = data if data\n task\n end", "def make_wix_folder_task\n return if Rake::FileTask.task_defined? 'wix'\n wix = Rake::FileTask.define_task 'wix' do |t|\n FileUtils.mkpath t.name\n end\n wix.comment = 'Create the WiX folder'\n end", "def create(filename = nil)\n filename = @doing_file if filename.nil?\n return if File.exist?(filename) && File.stat(filename).size.positive?\n\n FileUtils.mkdir_p(File.dirname(filename)) unless File.directory?(File.dirname(filename))\n\n File.open(filename, 'w+') do |f|\n f.puts \"#{Doing.setting('current_section')}:\"\n end\n end", "def directory(dir)\n Rake.each_dir_parent(dir) do |d|\n file_create d do |t|\n mkdir_p t.name if ! File.exist?(t.name)\n end\n end\nend", "def initialize(name = nil)\n @tasks = []\n @spec_task = nil\n\n last_desc = ::Rake.application.last_description\n desc nil\n\n yield self if block_given?\n\n if cfndsl_opts\n desc last_desc if last_desc\n task(name || :generate) { |_t, _args| cfndsl_opts[:files].each { |opts| generate(opts) } }\n else\n define_base_tasks(name || :generate, last_desc)\n end\n end", "def create_io_tmp(*args)\n path = File.join(storage_directory, args.join('-'))\n FileUtils.mkdir_p(File.dirname(path))\n t_file = File.open(path, 'w+')\n t_file.sync\n t_file\n end", "def create\n # We'll see that in a moment.\n @task = task.new\n #@task = Task.create\n end", "def create_file(name, data = nil)\n @caldav_backend.create_scheduling_object(@principal_uri, name, data)\n end", "def create_task step, steps\n task = Rake::Task::define_task( step[ :task ] => steps.collect{ | s | s[ :task ] } ) do | task, arguments |\n tags = build_tags step, steps\n\n if cloud.exists? tags\n puts \"image \\'#{step[ :name ]}\\' already up to date and exists:\"\n tags.each{ | key, value | puts \"\\'#{key}\\' => \\'#{value}\\'\" } \n else\n puts \"starting instance for: \\'#{step[ :name ]}\\'\"\n instance = cloud.start_instance initial_image_id( step, steps )\n puts \"instance for: \\'#{step[ :name ]}\\' started.\"\n\n begin\n dns_name = cloud.dns_name instance\n expand_step = step.dup.merge( setup_name: expand_path( step[ :setup_name ] ) )\n expand_step[ :tags ] = tags \n \n puts \"excuting installation for: \\'#{step[ :name ]}\\'\"\n setup.execute expand_step, dns_name \n puts \"installation for: \\'#{step[ :name ]}\\' done.\"\n\n puts \"storing image for: \\'#{step[ :name ]}\\'\"\n cloud.store_image instance, tags\n puts \"image for: \\'#{step[ :name ]}\\' stored\"\n rescue\n cloud.stop_instance instance\n raise\n end \n end \n end\n\n task.add_description( step[ :description ] ) if step.key? :description\n task\n end", "def create_file(filename, content)\n expanded_filename = \"#{working_dir}/#{filename}\"\n FileUtils.mkdir_p File.dirname(expanded_filename)\n File.open(expanded_filename, 'wb') do |f|\n f.write content\n end\n expanded_filename\n end", "def rakefile(filename, data=nil, &block)\n puts \"adding rakefile #{filename}\"\n in_root(\"lib/tasks\") do |folder|\n File.open(\"#{folder}/#{filename}\", \"w\") do |f|\n if block_given?\n f.write(code_for(block))\n else\n f.write(data)\n end\n end\n end\n end", "def generate_files\n copy_file 'queued_task.rb', \"app/models/#{name}.rb\"\n end", "def create_task(options = {})\n task = Task.create({\n title: \"a\"*(Task::TITLE_MIN_LENGTH),\n difficult: Task::PERMITTED_FIBONACCI_VALUES.first,\n description: \"a\"*(Task::DESCRIPTION_MIN_LENGTH)\n }.merge(options))\n\n return task\n end", "def createTask(description) \n task = Task.new\n task.Description = description\n @Tasks.push task\n end", "def create_work\n @files.each do |file|\n executor.queue { file.copy_file(@output_dir) }\n end\n end", "def define_task(task_class, *args, &block)\n @ProjectFileLoader.CurrentlyLoadedProjectFile().define_task(task_class, *args, &block)\n end", "def create_file(directory, filename, content, title, editor)\r\n if File.exists?(\"#{directory}/#{filename}\")\r\n raise \"The file already exists.\"\r\n else\r\n write_file(content, title, directory, filename)\r\n if editor && !editor.nil?\r\n sleep 1\r\n execute(\"#{editor} #{directory}/#{filename}\")\r\n end\r\n end\r\nend", "def create_file\n project = UserFile.publication_project!(current_user, @scope)\n\n api = DIContainer.resolve(\"api.user\")\n file_dxid = api.file_new(params[:name], project)[\"id\"]\n\n file = UserFile.create!(\n dxid: file_dxid,\n project: project,\n name: params[:name],\n state: \"open\",\n description: params[:description],\n user: current_user,\n parent: current_user,\n scope: @scope,\n UserFile.scope_column_name(@scope) => @folder&.id,\n )\n\n render json: { id: file.uid }\n end", "def file_task(re, runtime, signature, version, rb, rbc)\n rbc ||= rb.sub(re, \"runtime/#{version}\") + \"c\"\n\n file rbc => [rb, signature]\n runtime << rbc\nend", "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 create_task(options = {})\n request(:post, \"tasks\", options)\n end", "def task(name, description=nil, &block)\n puts \"adding task :#{name}\"\n in_root(\"lib/tasks\") do |folder|\n File.open(\"#{folder}/application.rake\", \"a+\") do |f|\n if block_given?\n f.write(code_for(block))\n else\n f.write(data)\n end\n end\n end\n end", "def generate file_name, picasa_id, password\n file_name = underscore file_name\n class_name = camelize file_name\n auth_token = Picasa::Authentication.authenticate picasa_id, password\n create_file file_name, class_name, picasa_id, auth_token\n end", "def create(options={},&block)\n run_task(MP4CreatorTask.new(options,&block))\n end", "def create_compile_ext_tasks(source_root, dest_root, invoking_task)\n compiled_ext = \"#{source_root}/#{SPECIAL_BUNDLE_NAMES[File.basename(source_root)] || File.basename(source_root)}.bundle\"\n create_copy_file_tasks(FileList[compiled_ext], source_root, dest_root, invoking_task)\n file compiled_ext => FileList[\"#{source_root}/*.c\"] do\n cd source_root do\n `ruby extconf.rb; make >/dev/null 2>&1`\n end\n end\nend", "def execute\n Services::Slog.debug({:message => \"File write for #{@template[:identifier]}\", :module => \"FileTemplate\", :task => \"execute\", :extra => {:template => @template[:identifier], :payload => @template[:payload]}})\n case @template[:payload][:method]\n when 'create'\n begin\n\n @template.users.each do |user|\n File.open(\"data/users/#{user.id}/#{@template[:payload][:uri]}\", \"w+\") { |file| file.write(\"\\n\") }\n response = { :status => \"200\", :message => \"File created.\", :id => @template[:payload][:uri]}\n\n unless @template[:payload][:content].nil? then\n File.open(\"data/users/#{user.id}/#{@template[:payload][:uri]}\", \"w+\") { |file| file.write(@template[:payload][:content]) }\n end\n end\n rescue Exception => e\n Services::Slog.exception e\n response = { :status => \"400\", :message => \"Method not is unsupported, #{e}\" }\n end\n when 'append'\n begin\n @template.users.each do |user|\n unless @template[:payload][:content].nil? then\n File.open(Dir.pwd + \"/data/users/#{user.id}/#{@template[:payload][:uri]}\", \"a+\") { |file| file.write(@template[:payload][:content]) }\n end\n end\n response = { :status => \"200\", :message => \"Content appended to file\", :id => @template[:payload][:uri]}\n rescue Exception => e\n response = { :status => \"403\", :message => \"Error processing file, #{e}\" }\n Services::Slog.exception e\n end\n end\n\n response\n end", "def remote_file(task)\n target_roles = task.delete(:roles)\n override = task.delete(:override)\n\n UploadTask.define_task(task) do |t|\n prerequisite_file = t.prerequisites.first\n file = shared_path.join(t.name).to_s.shellescape\n\n on roles(target_roles) do\n if override || !test(\"[ -f #{file} ]\")\n info \"Uploading #{prerequisite_file} to #{file}\"\n upload! File.open(prerequisite_file), file\n end\n end\n\n end\n end", "def define\n desc @description\n task @name => Array(deps) do\n FileUtilsExt.verbose(@verbose) do\n puts \"Use TESTOPTS=\\\"--verbose\\\" to pass --verbose\" \\\n \", etc. to runners.\" if ARGV.include? \"--verbose\"\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{file_list_string} #{option_list}\"\n ruby args do |ok, status|\n if !ok && status.respond_to?(:signaled?) && status.signaled?\n raise SignalException.new(status.termsig)\n elsif !ok\n status = \"Command failed with status (#{status.exitstatus})\"\n details = \": [ruby #{args}]\"\n message =\n if Rake.application.options.trace or @verbose\n status + details\n else\n status\n end\n\n fail message\n end\n end\n end\n end\n self\n end", "def create_file(source:, filename:, content:, permission: nil)\n body = { dest_file: \"#{source}:#{filename}\",\n content: content,\n api_key: @api_key\n }\n if !permission.nil?\n body['force_permission'] = permission\n end\n\n response = HTTParty.post(\"#{@host}/create_file\", body: body)\n\n return response.success?\n end", "def execute\n\t\tif File.exist?(filePath)\n\t\t\tputs \"-#{name_of_subject} already exists in this directory\"\n\t\telse\n\t\t\tFile.open(filePath, \"w+\") do |n|\n\t\t\t\tn.write(content)\n\t\t\tend\n\t\t\tputs \"-File '#{name_of_subject}' has been created in directory '#{parent_directory}' \\n\"\n\t\tend\n\tend" ]
[ "0.83126724", "0.71743494", "0.71329445", "0.7125328", "0.7111279", "0.6687138", "0.66524696", "0.6561874", "0.65514976", "0.6524207", "0.6450879", "0.63945144", "0.6392764", "0.6392764", "0.6377696", "0.6372352", "0.63668007", "0.63172567", "0.62784296", "0.6257799", "0.6244057", "0.623373", "0.62304074", "0.61980563", "0.6197008", "0.61954737", "0.6144037", "0.6140759", "0.6096217", "0.609514", "0.60823876", "0.6080024", "0.60681015", "0.6053508", "0.60525256", "0.6050054", "0.60403013", "0.6037963", "0.6037922", "0.6033743", "0.6030412", "0.60038894", "0.5969427", "0.5966817", "0.59645313", "0.5961106", "0.5957351", "0.5946144", "0.59387887", "0.5936828", "0.59037995", "0.58907497", "0.58907497", "0.58868426", "0.5877588", "0.58769554", "0.5871816", "0.5870749", "0.58623856", "0.5854771", "0.5846402", "0.5840156", "0.5811927", "0.5810249", "0.5805713", "0.57872456", "0.57678276", "0.5762836", "0.5751127", "0.57363904", "0.5735879", "0.5708438", "0.5695373", "0.5694213", "0.5694001", "0.5691828", "0.56908494", "0.5688391", "0.56814677", "0.5669887", "0.5665816", "0.564911", "0.56488657", "0.56351817", "0.5630244", "0.5627271", "0.5606753", "0.5606391", "0.5605392", "0.56044203", "0.5598845", "0.55986774", "0.5595725", "0.5589349", "0.5575321", "0.5572891", "0.5568745", "0.55659354", "0.5557859", "0.5555591" ]
0.8202174
1
Declare a set of files tasks to create the given directories on demand. Example: directory "testdata/doc"
def directory(dir) Rake.each_dir_parent(dir) do |d| file_create d do |t| mkdir_p t.name if ! File.exist?(t.name) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rake_files(base_dir)\n\n one_task_fn = File.join(base_dir, 'one_task.rake')\n make_tasks_in_file(['one_task'], one_task_fn) if ok_to_create?(one_task_fn)\n\n another_task_fn = File.join(base_dir, 'another_task.rake')\n make_tasks_in_file(['another_task'], another_task_fn) if ok_to_create?(another_task_fn)\n\n my_tasks_mine_fn = File.join(base_dir, 'my_tasks_all_mine.rake')\n make_tasks_in_file(['task1', 'task2', 'task3', 'task4'], my_tasks_mine_fn, namespace: 'mine') if ok_to_create?(my_tasks_mine_fn)\n\n tasks_run_all_fn = File.join(base_dir, 'other_tasks_run_all.rake')\n make_tasks_in_file(['other_task1_run_me', 'other_task2_run_me', 'other_task3_run_me', 'other_task_not_run_yet'], tasks_run_all_fn) if ok_to_create?(tasks_run_all_fn)\n\n tasks_mixed_duplicates_fn = File.join(base_dir, 'other_tasks_mixed_duplicates.rake')\n make_tasks_in_file(['other_task2_run_me', 'other_task3_run_me'], tasks_mixed_duplicates_fn) if ok_to_create?(tasks_mixed_duplicates_fn)\n\n task2_duplicate_fn = File.join(base_dir, 'task2_duplicate.rake')\n make_tasks_in_file(['task2'], task2_duplicate_fn, namespace: 'mine') if ok_to_create?(task2_duplicate_fn)\n\n task4_duplicate_fn = File.join(base_dir, 'task4_duplicate.rake')\n make_tasks_in_file(['task4'], task4_duplicate_fn, namespace: 'mine') if ok_to_create?(task4_duplicate_fn)\n end", "def make_test_dirs_with_files(parent, count)\n unless count > NUMBER_OF_DIRECTORIES\n Dir.mkdir(parent + \"directory#{count}/\")\n # puts parent + \"/directory#{count}\"\n\n for i in 1..FILES_PER_DIRECTORY_X\n File.open(parent + \"directory#{count}/\" + \"filex#{i}.txt\", 'w+').chmod(0331)\n # puts parent + \"/directory#{count}/\" + \"filex#{i}.txt\"\n end\n\n for i in (FILES_PER_DIRECTORY_X + 1)..(FILES_PER_DIRECTORY + FILES_PER_DIRECTORY_X)\n File.open(parent + \"directory#{count}/\" + \"file#{i}.txt\", 'w+').chmod(0224)\n # puts parent + \"/directory#{count}/\" + \"file#{i}.txt\"\n end\n\n make_test_dirs_with_files(parent + \"directory#{count}/\", (count + 1))\n\n end\n\n end", "def create_copy_file_tasks(source_files, source_root, dest_root, invoking_task)\n source_files.each do |source|\n target = source.pathmap(\"%{#{source_root},#{dest_root}}p\")\n directory File.dirname(target)\n file target => [File.dirname(target), source] do |t|\n cp source, target\n end\n task invoking_task => target\n end\nend", "def create_directories\n directory '.', './'\n end", "def setup()\n create_directories\n end", "def make_copy_file_tasks\n @files.each do |source, destination|\n next if source == destination\n next if Rake::FileTask.task_defined? destination\n type = File.directory?(source) ? 'folder' : 'file'\n task = Rake::FileTask.define_task destination do |t|\n folder = File.dirname(t.name)\n FileUtils.mkpath folder unless File.directory? folder\n FileUtils.copy source, t.name\n end\n task.comment = \"Create the #{destination} #{type}\"\n task.enhance ['wix']\n if Rake::FileTask.task_defined? source\n task.enhance [source]\n end\n end\n end", "def mkdir_p_folders\n [systems_folder, images_systems_folder, data_systems_folder, pages_score_folder].each do |dossier|\n FileUtils.mkdir_p(dossier)\n end\nend", "def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n rescue\n $stderr.puts $!.message\n exit 1\n end", "def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n rescue\n $stderr.puts $!.message\n exit 1\n end", "def make_dirs(*args)\n FileUtils.mkdir_p(args)\nend", "def create_files\n tests.each do |test|\n FileUtils.mkdir(test.id.to_s) unless Dir.exist?(test.id.to_s) if test.option[:dir]\n files = []\n files << test.action.split('?').first\n files += test.option[:implicit]\n files << test.result_rdf if test.result_rdf\n files << test.result_json if test.result_json\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end", "def setup\n templates = ['default']\n templates << @opts[:testkitchen] if @opts[:testkitchen]\n\n templates.each { |type| create_file(type) }\n end", "def setup\n\n for i in 1..ROOT_FILES_X\n File.open(\"/rootfilex#{i}.txt\", 'w+').chmod(0777) #Just using random permissions aside from having world execute bit included or not\n # puts \"rootfilex#{i}.txt\"\n end\n\n for i in (ROOT_FILES_X + 1)..(ROOT_FILES + ROOT_FILES_X)\n File.open(\"/rootfile#{i}.txt\", 'w+').chmod(0660)\n # puts \"rootfile#{i}.txt\"\n end\n\n for i in 1..HIDDEN_FILES_X\n File.open(\"/.hiddenfilex#{i}\", 'w+').chmod(0555)\n # puts \".hiddenfile#{i}\"\n end\n\n for i in (HIDDEN_FILES_X + 1)..(HIDDEN_FILES + HIDDEN_FILES)\n File.open(\"/.hiddenfile#{i}\", 'w+').chmod(0442)\n # puts \".hiddenfile#{i}\"\n end\n\n make_test_dirs_with_files(\"/\", 1)\n\n end", "def create\n create_directories\n end", "def create_directories(*args)\n args.each do |argument|\n FileUtils.mkdir_p(argument) unless File.directory?(argument)\n end\n end", "def setup_run_artifacts\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_logs\")\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_report\")\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_results\")\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_screenshots\") unless File.exist?(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_screenshots\")\nend", "def gen_sub_directories\n @outputdir.mkpath\n end", "def create_docs\n directory 'templates/docs', 'docs'\nend", "def define_test_tasks\n default_tasks = []\n\n if File.directory? \"test\" then\n desc 'Run the test suite. Use FILTER or TESTOPTS to add flags/args.'\n task :test do\n ruby make_test_cmd\n end\n\n desc 'Run the test suite using multiruby.'\n task :multi do\n ruby make_test_cmd(:multi)\n end\n\n desc 'Show which test files fail when run alone.'\n task :test_deps do\n tests = Dir[\"test/**/test_*.rb\"] + Dir[\"test/**/*_test.rb\"]\n\n paths = ['bin', 'lib', 'test'].join(File::PATH_SEPARATOR)\n null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '&> /dev/null'\n\n tests.each do |test|\n if not system \"ruby -I#{paths} #{test} #{null_dev}\" then\n puts \"Dependency Issues: #{test}\"\n end\n end\n end\n\n default_tasks << :test\n end\n\n if File.directory? \"spec\" then\n begin\n require 'spec/rake/spectask'\n\n desc \"Run all specifications\"\n Spec::Rake::SpecTask.new(:spec) do |t|\n t.libs = self.rspec_dirs\n t.spec_opts = self.rspec_options\n end\n rescue LoadError\n # do nothing\n end\n default_tasks << :spec\n end\n\n desc 'Run the default task(s).'\n task :default => default_tasks\n\n desc 'Run ZenTest against the package.'\n task :audit do\n libs = %w(lib test ext).join(File::PATH_SEPARATOR)\n sh \"zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}\"\n end\n end", "def prepare_tmpdirs(data)\n data[:files].each do |file|\n targetdir = File.join(@workingdir, File.dirname(File.expand_path(file)).gsub(@package.target_path, \"\"))\n FileUtils.mkdir_p(targetdir) unless File.directory? targetdir\n FileUtils.cp_r(file, targetdir)\n end\n end", "def mktestfiles(testdir)\n @@tmpfiles << testdir\n assert_nothing_raised {\n files = %w{a b c d e}.collect { |l|\n name = File.join(testdir, \"file#{l}\")\n File.open(name, \"w\") { |f|\n f.puts rand(100)\n }\n\n name\n }\n\n return files\n }\n end", "def create_dirs\n run_dir = query_property('run_dir')\n raise 'Run directory not found' unless Dir.exist?(run_dir)\n\n create_dir(\"#{run_dir}/messaging/in_pending\", 'in_pending')\n create_dir(\"#{run_dir}/messaging/in_processed\", 'in_processed')\n create_dir(\"#{run_dir}/messaging/out_pending\", 'out_pending')\n create_dir(\"#{run_dir}/messaging/out_processed\", 'out_processed')\n FileUtils.chmod_R('u=wrx,go=r', run_dir)\n end", "def create_user_directories\n #Directories\n avatar = \"#{Rails.root}/data/avatars/#{resource.id}\"\n push = \"#{Rails.root}/data/push/#{resource.id}\"\n passes = \"#{Rails.root}/data/passes/#{resource.id}\"\n coredata = \"#{Rails.root}/data/coredata/#{resource.id}\"\n #Avatar Upload Pictures\n Dir.mkdir(avatar) unless File.exists?(avatar)\n #Push Notification Certificates\n Dir.mkdir(push) unless File.exists?(push)\n #Avatar Passbook\n Dir.mkdir(passes) unless File.exists?(passes)\n #Core Data\n Dir.mkdir(coredata) unless File.exists?(coredata)\n end", "def create_tests_folder_for(paths)\n Dir.mktmpdir('guard_phpunit') do |d|\n symlink_paths_to_tests_folder(paths, d)\n yield d\n end\n end", "def ensure_tasks_folder\n io.mkdir('.webbynode/tasks') unless io.directory?(\".webbynode/tasks\")\n %w[before_push after_push].each do |file|\n io.exec(\"touch .webbynode/tasks/#{file}\") unless io.file_exists?(\".webbynode/tasks/#{file}\")\n end\n end", "def create_dirs\n FileUtils.mkdir_p(@work_dir) unless File.exist?(@work_dir)\n end", "def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end", "def make_tasks_in_file(tasknames = [], filepath = '.', task_body = \"\\n\", namespace: '')\n\n indent = \"\"\n filedir = File.dirname(filepath)\n FileUtils.mkdir_p(filedir) unless Dir.exist?(filedir)\n\n File.open(filepath, 'w') do |f|\n unless namespace.empty?\n indent = \" \"\n f.puts namespace_start(namespace)\n end\n\n tasknames.each do |taskname|\n f.puts simple_rake_task(taskname, indent: indent, task_body: task_body)\n end\n\n f.puts namespace_end unless namespace.empty?\n end\n filepath\n end", "def create_ruby_test_files\n create_directories\n template \"poro.erb\", ruby_template\n template \"poro_test.erb\", test_template\n end", "def generate_rake_tasks\n @rake_tasks = outputs.map do |output, inputs|\n additional_paths = []\n inputs.each do |input|\n\n create_file_task(input.fullpath).dynamic do\n additional_paths += additional_dependencies(input)\n end\n end\n additional_paths.each { |path| create_file_task(path) }\n\n create_file_task(output.fullpath, inputs.map(&:fullpath)) do\n output.create { generate_output(inputs, output) }\n end\n end\n end", "def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\nend", "def directory(dir)\n last_remote = Rake.application.last_remote\n Rake.each_dir_parent(dir) do |d|\n Rake.application.last_remote = last_remote\n file_create d do |t|\n mkdir_p t.name if ! File.exist?(t.name)\n end\n end\n end", "def create_directory(file)\n end", "def nuget_directory()\r\n dirs = FileList.new([:lib, :content, :tools].collect{ |dir|\r\n File.join(Folders[:nuspec], \"#{dir}\")\r\n })\r\n task :nuget_dirs => dirs # NOTE: here a new dynamic task is defined\r\n\tdirs.to_a.each{ |d| directory d }\r\n end", "def create_copy_task srcGlob, targetDir, taskSymbol\n mkdir_p(targetDir, :verbose => false)\n FileList[srcGlob].each do |f|\n target = File.join(targetDir, File.basename(f))\n file target => [f] do |t|\n cp f, target\n end\n task taskSymbol => target\n end\nend", "def define_common_tasks(vcs, workdir, task_prefix, plines=[])\n vcs.map do |files, (lines, nvcs)|\n fn = \"#{task_prefix}#{Digest::SHA1.hexdigest(files.join)}\"\n File.write(File.join(workdir, fn), (plines + lines).join)\n task fn do\n docker_build(fn, workdir)\n end\n\n nfn = define_common_tasks(nvcs, workdir, task_prefix, plines + lines)\n nfn.each do |file|\n task file => fn\n end\n files.each do |file|\n task file => fn\n end\n fn\n end\n end", "def ensure_dir( *dirs )\n path = \"\"\n for current in dirs\n path = File.join path, current\n Dir::mkdir path if not File.directory? path\n end\nrescue Exception => e\n $logger.error \"Couldn't make directory. #{e}\"\nend", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def fixtures(number_of_directories = 1)\n current_pwd = Dir.pwd\n paths = 1.upto(number_of_directories).map { mk_fixture_tmp_dir }\n\n FileUtils.cd(paths.first) if number_of_directories == 1\n\n yield(*paths)\nensure\n FileUtils.cd current_pwd\n paths.map { |p| FileUtils.rm_rf(p) if File.exist?(p) }\nend", "def setup\n FileUtils.mkdir_p(data_path)\n end", "def setup\n FileUtils.mkdir_p(data_path)\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 make_files(targets)\n file_pairs = targets.map { |t| \n filename = sanitize_filename(t[:data][:name] + '.json')\n [filename, t]\n }\n unique_pairs = uniqufy(file_pairs)\n unique_pairs.each do |name, content| \n puts \"Write #{File.absolute_path(name)}\"\n File.open(name, 'w') { |file| file.write(JSON.pretty_generate(content)) }\n end\nend", "def define \n desc @description\n task @name => Array(deps) do\n unless Dir.exist?(@outdir)\n Dir.mkdir(@outdir)\n end\n make_file_list\n @file_list.each do |target|\n js = target.execute\n target_file = File.join(@outdir,File.basename(target.file))\n File.open(target_file, 'w') { |f| f.write(js) }\n end\n end\n\n self\n end", "def prepare_config_files\n #Create .config dir\n #Create tucotuco dir\n #Create short dir\n #Create info file\n end", "def mkdirs()\n if !File.exists?(\"data\")\n Dir.mkdir(\"data\")\n end \n if !File.exists?(CACHE_DIR)\n Dir.mkdir(CACHE_DIR)\n end\n if !File.exists?(RDF_DIR)\n Dir.mkdir(RDF_DIR)\n end\nend", "def create_from_disk(*filenames); end", "def setup\n @testnum += 1\n @tempdirname = \".ocratest-#{$$}-#{@testnum}\"\n Dir.mkdir @tempdirname\n Dir.chdir @tempdirname\n end", "def prepare_dirs\n require 'fileutils'\n recipe = File.join(@data_dir, '/test/integration/test_recipe.rb')\n\n FileUtils.chmod(755, exec_order)\n FileUtils.chown_R('vagrant', 'vagrant', '/home/oneops')\n FileUtils.mkdir_p(\"/home/oneops/#{@circuit}/components/cookbooks\")\n FileUtils.mkdir_p('/home/oneops/shared/cookbooks/test/recipes')\n FileUtils.cp_r(recipe, '/home/oneops/shared/cookbooks/test/recipes/')\n end", "def create_directory()\n Dir.mkdir(ARGV.join('_'))\n Dir.chdir(ARGV.join('_'))\n Dir.mkdir(\"lib\")\n create_rspec_env()\nend", "def copy_files(srcGlob, targetDir, taskSymbol)\n mkdir_p targetDir\n FileList[srcGlob].each do |f|\n target = File.join targetDir, File.basename(f)\n file target => [f] do |t|\n cp f, target\n end\n task taskSymbol => target\n end\nend", "def add_default_files_to_definition\n mkdir_p('files')\n default_files = File.join(File.dirname(__FILE__), '../../files')\n files = []\n chdir(default_files) do\n files += Dir.glob(\"**/*\")\n end\n files.each do |filespec|\n dest = File.join('files', filespec)\n unless File.exist?(dest)\n src = File.join(default_files, filespec)\n if File.file?(src)\n destdir = File.dirname(dest)\n mkdir_p(destdir) unless File.exist?(destdir)\n # puts \"cp(#{src}, #{dest}), destdir => #{destdir}\"\n cp(src, dest)\n end\n end\n end\n end", "def make_dirs\r\n FileUtils.rm_rf @dirs[:tmp]\r\n @dirs.each do |k, dir|\r\n FileUtils.mkdir_p dir\r\n end\r\n end", "def setup_test_files\n project.test_sources.each do |src|\n compile_task objectsify(src), src\n end\n end", "def setup(target)\n Dir.mkdir(target) unless File.directory?(target)\nend", "def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end", "def create_required_directories\n [\n Config.cache_dir,\n Config.source_dir,\n build_dir,\n project_dir,\n ].each do |directory|\n FileUtils.mkdir_p(directory) unless File.directory?(directory)\n end\n end", "def collection_dir(*files); end", "def create_work\n @files.each do |file|\n executor.queue { file.copy_file(@output_dir) }\n end\n end", "def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end", "def setup_tests\n Rake::TestTask.new do |t|\n t.libs << \"test\"\n t.test_files = FileList['test/test*.rb']\n t.verbose = true\n end\nend", "def prepare_examples(dir = nil, &block)\n Dir.mktmpdir do |tmpdir|\n FileUtils.cp_r(examples_path, tmpdir)\n bn = File.basename(examples_path)\n block.call(File.join(tmpdir, bn, dir.to_s))\n end\n end", "def prepare_examples(dir = nil, &block)\n Dir.mktmpdir do |tmpdir|\n FileUtils.cp_r(examples_path, tmpdir)\n bn = File.basename(examples_path)\n block.call(File.join(tmpdir, bn, dir.to_s))\n end\n end", "def prepare_examples(dir = nil, &block)\n Dir.mktmpdir do |tmpdir|\n FileUtils.cp_r(examples_path, tmpdir)\n bn = File.basename(examples_path)\n block.call(File.join(tmpdir, bn, dir.to_s))\n end\n end", "def create_dirs(dry = false)\n @needs_dir.each do |dir|\n report \"Creating: #{dir}\"\n\n begin\n Dir.mkdir(dir) unless dry\n rescue SystemCallError\n report_warning 'directory exists!'\n end\n end\n end", "def setup_files(config_generator)\n raise NotImplementedError\n end", "def create_students_timetable\n @students.each do |student|\n name = student[:name].split(' ').map(&:downcase).join('_')\n student_path = \"#{__dir__}/../#{ENV['STUDENTS_PATH']}/#{name}\"\n system(\"mkdir -p #{student_path}\")\n system \"cp #{__dir__}/../docs/#{student[:tt_path]} #{student_path}/emploi_du_temps.txt\"\n end\n end", "def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\n end", "def setupTestDir\r\n @start = Dir.getwd\r\n teardownTestDir\r\n begin\r\n\tDir.mkdir(\"_test\")\r\n rescue\r\n $stderr.puts \"Cannot run a file or directory test: \" + \r\n \"will destroy existing directory _test\"\r\n\t# VMS maps exit status 99 (octal 143) as a meaningless\r\n\t# message \"%SYSTEM-?-DRVERR, fatal drive error\".\r\n\texit\r\n# exit(99)\r\n end\r\n File.open(File.join(\"_test\", \"_file1\"), \"w\", 0644) {}\r\n File.open(File.join(\"_test\", \"_file2\"), \"w\", 0644) {}\r\n @files = %w(. .. _file1 _file2)\r\n end", "def create_dummy_test_files(*path)\n templates << TemplateExampleSpecBertha.new(project_name, module_name, test_directory: File.join(path))\n end", "def define_asciidoc_tasks\n if defined?(AsciiDocTasks) && File.exist?(\"#{doc_dir}/asciidoc.conf\") && asciidoc_available?\n man_pages = FileList[\"#{doc_dir}/*.[0-9].txt\"]\n articles = FileList[\"#{doc_dir}/*.txt\"] - man_pages\n desc \"Build AsciiDoc under #{doc_dir}\"\n AsciiDocTasks.new('doc:asciidoc') do |t|\n t.source_dir = doc_dir\n t.source_files = articles\n t.doc_type = :article\n t.config_file = \"#{doc_dir}/asciidoc.conf\"\n t.attributes = asciidoc_attributes\n end\n AsciiDocTasks.new('doc:asciidoc') do |t|\n t.source_dir = doc_dir\n t.source_files = man_pages\n t.doc_type = :manpage\n t.config_file = \"#{doc_dir}/asciidoc.conf\"\n t.attributes = asciidoc_attributes\n end\n else\n desc \"Build AsciiDoc (disabled)\"\n task 'asciidoc'\n task 'asciidoc:build'\n task 'asciidoc:clean'\n task 'asciidoc:rebuild'\n end\n task 'doc:build' => 'doc:asciidoc:build'\n task 'doc:clean' => 'doc:asciidoc:clean'\n task 'doc:rebuild' => 'doc:asciidoc:rebuild'\n end", "def create_files\n tests.each do |test|\n files = [test.action, test.urgna2012, test.urdna2015].compact\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end", "def define_clean_tasks\n task :clobber_docs # no-op, just in case\n task :clobber_package # no-op, just in case\n\n desc \"Clean up all the extras.\"\n task :clean => [ :clobber_docs, :clobber_package ] do\n clean_globs.each do |pattern|\n files = Dir[pattern]\n rm_rf files, :verbose => true unless files.empty?\n end\n end\n end", "def ensure_dir(path)\n directory path do\n action :create\n recursive true\n end\nend", "def create_uploads(dirs)\n u = UploadImage.new\n dirs.map do |dir|\n UploadInspection.new(\"./inspections/\"+dir, u)\n end\n end", "def create_site\n files = site_files\n\n # in update mode we only want to update the tasks directory\n if options[:update]\n FileUtils.mkdir_p site unless pretend?\n mkdir 'tasks'\n files['tasks'].sort.each {|file| cp file}\n else\n dirs = files.keys.concat %w[content layouts lib tasks templates]\n dirs.sort!\n dirs.uniq!\n\n # create the directories first\n dirs.each do |dir|\n next if dir =~ %r/^output\\/.*$/\n mkdir dir\n end\n\n # and the create the files under each directory\n dirs.each do |dir|\n next if dir =~ %r/^output(\\/.*)?$/\n files[dir].sort.each {|file| cp file}\n end\n end\n end", "def create_req_files\n Dir.mkdir DATA_DIR unless File.exists? DATA_DIR\n FileUtils.touch NODES_FILE unless File.exists? NODES_FILE\n FileUtils.touch ENC_ROLES_FILE unless File.exists? ENC_ROLES_FILE\n FileUtils.touch HIERA_DATA_FILE unless File.exists? HIERA_DATA_FILE\n end", "def register_directories(*dirs); end", "def prepare_dirs\n [@reports_dir, @cache_dir, @gems_dir].each do |dir|\n Dir.mkdir(dir) unless File.directory?(dir)\n end\n end", "def mkdir(*path)\n for dir in path\n\tDir.mkdir(expand_path(dir))\n end\n end", "def generate()\n objects = []\n\n # generate object file tasks\n files.each do |fname|\n output_file = File.join(@build_dir, File.basename(fname).ext('o'))\n objects.push output_file\n file output_file => [ fname ] do\n get_toolchain().compile( fname, output_file )\n end\n end\n\n # Link object files\n file output_file() => objects do\n get_toolchain().link( objects, output_file() )\n end\n\n # Create top level task\n desc \"Build the #{@name} application\"\n task @name => [ output_file() ]\n end", "def generate_file_list\n self.file_list = Concurrent::Array.new\n targets.each do |target|\n add_target(target)\n end\n end", "def mkdir(*args) Dir.mkdir(path, *args) end", "def generate_files(base_dir,script,mtime=nil)\n\n base_dir ||= Dir.pwd\n\n script.each_pair do |filename,value|\n path = File.join(base_dir,filename)\n if value.instance_of? Hash\n FileUtils.mkdir_p(path)\n if mtime\n File.utime(mtime,mtime,path)\n end\n generate_files(path,value,mtime)\n else\n FileUtils.write_text_file(path,value)\n if mtime\n File.utime(mtime,mtime,path)\n end\n end\n end\n end", "def create_dirs(klass)\n class << klass\n Array(yield).each do |dir|\n define_method(\"#{dir}_dir\") do\n File.join(lib_dir,dir)\n end\n module_eval(%Q(def #{dir}_require(&block); lib_require('#{dir}', &block); end))\n end\n end\n end", "def create_file_and_folder\n begin\n Dir::mkdir(@directory)\n rescue Errno::EEXIST\n end\n FileUtils.touch \"#{@directory}/#{@store}.yml\"\n end", "def createdirectories()\n\n\tputs \"\\n\" + '[ ' + yellow( 'RUNNING' ) + \" ] Setup\"\n\n\texecute \"mkdir -p #{fetch(:deploy_to)}releases\"\n\texecute \"mkdir -p #{shared_path}\"\n\n\tputs '[ ' + green( 'SUCCESS' ) + ' ]'\n\nend", "def create(framework_name)\n results = Hash[:framework => framework_name, :directories => [],\n :files => [], :rakefile => 'Rakefile']\n\n dir = File.join(File.dirname(File.expand_path(__FILE__)), 'generators', framework_name)\n Dir.chdir dir\n Dir[\"**/*\"].each do |f|\n results[:files].push f unless f == 'Rakefile' or File.directory? f \n results[:directories].push f if File.directory? f\n end\n\n results\n end", "def create_source_files\n empty_directory(File.join(target_dir, \"lib/kitchen/driver\"))\n\n create_template(\n \"version.rb.erb\",\n \"lib/kitchen/driver/#{name}_version.rb\"\n )\n create_template(\n \"driver.rb.erb\",\n \"lib/kitchen/driver/#{name}.rb\"\n )\n end", "def target_files_in_dir(base_dir = T.unsafe(nil)); end", "def generate_files\n ip = local_ip\n version = Farmstead::VERSION\n scaffold_path = \"#{File.dirname __FILE__}/scaffold\"\n scaffold = Dir.glob(\"#{scaffold_path}/**/*.erb\", File::FNM_DOTMATCH)\n scaffold.each do |file|\n basename = File.basename(file)\n folderstruct = file.match(\"#{scaffold_path}/(.*)\")[1]\n if basename != folderstruct\n foldername = File.dirname(folderstruct)\n create_recursive(\"#{@name}/#{foldername}\")\n end\n projectpath = \"#{@name}/#{folderstruct}\".chomp(\".erb\")\n template = File.read(file)\n results = ERB.new(template).result(binding)\n copy_to_directory(results, projectpath)\n end\n end", "def create_dir(dir)\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\nend", "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "def create_directories(path)\n FileUtils.mkdir_p(path) unless Dir.exists?(path)\nend", "def hook_add_directories\n @flavor.class.after_add_directories do |directories|\n directories.each do |dir|\n actions_taken << \"create directory #{dir}\"\n end\n end\n end", "def load_tasks(dir=@tasks_dir)\n @task_files = []\n Dir.entries(dir).each do |entry| \n #\n # Check for obvious directories\n #\n if !(entry =~ /^\\./)\n #\n # Make sure it's a file\n #\n if File.file? dir + \"/\" + entry \n #\n # Toss it in our array\n #\n @task_files << dir + \"/\" + entry \n end\n end\n end\n \n #\n # For each of our identified task files...\n #\n @task_files.each do |task_file|\n #\n # Create a new task and eval our task into it\n #\n TapirLogger.instance.log \"Evaluating task: #{task_file}\"\n t = Task.new\n t.instance_eval(File.open(task_file, \"r\").read)\n\n #\n # Add it to our task listing\n #\n @tasks << t\n end\n end", "def cat_files file_groups\n file_groups.each do |group|\n check_exists(group[:paths])\n # this is the Illumina recommended approach to combining these fastq files.\n # See the Casava 1.8 Users Guide for proof\n files_list = group[:paths].join(\" \")\n command = \"cat #{files_list} > #{group[:path]}\"\n execute command\n end\n end", "def mktestdir\n testdir = File.join(tmpdir, \"remotefilecopytesting\")\n @@tmpfiles << testdir\n\n # create a tmpfile\n pattern = \"tmpfile\"\n tmpfile = File.join(testdir, pattern)\n assert_nothing_raised {\n Dir.mkdir(testdir)\n File.open(tmpfile, \"w\") { |f|\n 3.times { f.puts rand(100) }\n }\n }\n\n [testdir, %r{#{pattern}}, tmpfile]\n end", "def create_collection\n Dir.mkdir @src_path\n end" ]
[ "0.69951504", "0.6594979", "0.6563617", "0.6465529", "0.6422045", "0.64202523", "0.63622504", "0.6352174", "0.6352174", "0.6309467", "0.6243856", "0.6242378", "0.621869", "0.6204845", "0.6178213", "0.61644566", "0.6148434", "0.61343867", "0.6124763", "0.6124167", "0.612095", "0.6102053", "0.605273", "0.60525596", "0.60463595", "0.60442877", "0.602043", "0.59887487", "0.59851253", "0.59849644", "0.59459645", "0.59431905", "0.5930852", "0.591549", "0.5914286", "0.5913862", "0.5910226", "0.5909027", "0.5909027", "0.5876374", "0.58617246", "0.58617246", "0.5861705", "0.5849258", "0.58334327", "0.5830845", "0.582041", "0.5803449", "0.57909435", "0.57785094", "0.57689583", "0.5767792", "0.5761116", "0.57591367", "0.5757586", "0.57561386", "0.57498604", "0.57447857", "0.57417434", "0.57402253", "0.5731613", "0.5730525", "0.5724741", "0.5724741", "0.5724741", "0.5724307", "0.5719681", "0.57188904", "0.57027256", "0.56779504", "0.5677584", "0.5676579", "0.5665433", "0.5646633", "0.5646571", "0.564501", "0.56391203", "0.563435", "0.5630302", "0.5613636", "0.5610553", "0.5584579", "0.5584395", "0.55754614", "0.55739725", "0.5567463", "0.55667233", "0.5566425", "0.5566352", "0.55608565", "0.5558702", "0.5555751", "0.5548431", "0.55464387", "0.55271804", "0.55182135", "0.55152345", "0.5508892", "0.55063456", "0.55028105" ]
0.71917117
0
method for user staus
def user_status(activated_date) if activated_date.blank? return "Inactive" else return "Active" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user; end", "def user; end", "def set_user; end", "def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end", "def user\n end", "def handle_activation(user)\n\t\t\n\tend", "def call \n user\n end", "def user\n\t\tfalse\n\tend", "def user_handle; end", "def instruct_user!\n end", "def handle(status, user)\n end", "def logged_in\r\n end", "def set_user\n\t\t@active = \"user\"\n\t\t@user = current_user\n\tend", "def who_we_are\r\n end", "def get_user_to_act_on\n @user = session[:user]\n end", "def get_user_to_act_on\n @user = session[:user]\n end", "def activate_user(user)\n user.status_id=0\n user.save\n end", "def users\n \n end", "def show\n set_user_activity\n end", "def welcome_user\n header\n puts \"\\n\\nWelcome #{self.active_user.name}, you are now logged in!\\n\"\n self.area_prompt\nend", "def status_getuser!()\n @status = TAC_PLUS_AUTHEN_STATUS_GETUSER\n end", "def show\n \t\t@active = User.find(session[:user_id]).try :touch\n end", "def check_user_background\n self.status = Status::PENDING_ADMIN_ACTION if offender && offender.new_user?\n end", "def activate\n @user.activate! if @user.pending?\n redirect_to root_url\n end", "def update_user\n end", "def user_init; end", "def on_users_account\n true\n end", "def activate\n @this_user.update_attributes(:active => true)\n redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]\n end", "def user_onoff_flag\n @requested_user = User.find_by_account_number(params[:id])\n if @requested_user.is_active?\n @requested_user.update_columns(:is_active => false)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully de-activated.\"}\n else\n @requested_user.update_columns(:is_active => true)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully activated.\"}\n end\n end", "def user_on\n session[:user_id] = '3980284084'\n end", "def student_user \n self.line_break\n puts \"Type in your full name to begin:\".colorize(:light_green)\n self.line_break\n student_user = gets.chomp.titleize\n if Student.find_by(name: student_user)\n self.line_break\n puts \"Welcome #{student_user.titleize}!\".colorize(:light_magenta)\n self.student_tasks(student_user)\n else \n puts \"Invalid response. You are not authorized to access the portal.\".colorize(:yellow), \"Please contact student services for additional support. Have a great day!\".colorize(:yellow)\n self.run\n end\n end", "def show\n \t\t\t\t@active = User.find(session[:user_id]).try :touch\n end", "def active; end", "def active; end", "def logging_in\n \t\t\n \tend", "def state\n self.user.state if self.user\n end", "def user_consenting; end", "def current_user_method=(null) ; end", "def settings\n\t\tcheck_if_myself\n\t\t@user = current_user\n\tend", "def check_in_client\n @user = User.find(params[:user_id])\n decrement_session(@gym, @user)\n flash[:notice] = \"#{@user.first_name} successfully checked in.\"\n redirect_to current_user\n end", "def show\n\t\t\t\t @active = User.find(session[:user_id]).try :touch\n end", "def active_user\n redirect_to(root_path) unless (current_user != nil && current_user.active == true)\n end", "def user_verified=(_arg0); end", "def is_user?\ncurrent_user.username == @userl.username\n end", "def user_verification; end", "def user_verification?; end", "def activate\n @user = User.find(params[:id])\n @user.activate\n redirect_to :back\n end", "def run\n @user = \"\"\n welcome\n login_or_signup\n say_hi_to_user\n initial_menu \n end", "def user_for_vestal_versions; end", "def show\n # set_user\n # set_routine\n end", "def active_user\n user = pending_user\n user.activate! if user.valid?\n user\n end", "def usermode; @user_mode; end", "def activate!(user)\n return false if self.active?\n\n @user = user\n\n create_hook!\n\n self.active = true\n self.save!\n end", "def user_verified; end", "def user_verified?; end", "def confirmed?; end", "def handle_new_user \n system \"clear\" \n CoffeeMan.stay_logo\n username = @prompt.ask(\"Create a username\", required: true) \n #check if new username already exists\n if User.all.map(&:username).include?(username)\n puts 'This username already exist'\n sleep 5 / 2\n system \"clear\"\n sleep 1\n #redirect to log in option method\n CoffeeMan.stay_logo\n self.log_in\n else\n #if new username doesn't exist, create a new password\n password = @prompt.mask(\"Create a password\", required: true) \n end \n #after everything, create a new user instance \n @userid = User.create(username: username, password: password) \n main_menu\nend", "def admin_required\n #just a patch until i can implement users and roles\n \n # \"Speak friend, and enter\" (Moria)\n session[:friend] ||= params[:friend]\n session[:friend] || redirect_to(home_path)\n end", "def active?; end", "def login_choice\n end", "def eventcodesignup_step2\n @user = current_user\nend", "def call\n user\n end", "def user_consenting=(_arg0); end", "def remember_me; end", "def checkin\n end", "def insist_on(type = nil, user = nil)\n case type\n when :logged_in\n if anon?\n flash[:danger] = \"please sign in first\"\n shunt_to_root\n end\n when :logged_out\n unless anon?\n flash[:danger] = \"cannot perform this action while logged in\"\n shunt_to_root\n end\n when :permission\n users = user.is_a?(ActiveRecord::Relation)? user : [user]\n users.each do |user|\n user ||= User.new(name: params[User.slug] || \"any other user\")\n unless can_modify? user\n flash[:danger] = \"you are #{anon?? \"not signed in\" : \"signed in as #{current_user.name}\"} and are not allowed to view or modify #{user.name}'s personal records\"\n shunt_to_root\n end\n end\n when :existence\n unless user\n flash[:danger] = \"no such user\"\n shunt_to_root\n end\n else\n unless Proc.new.call\n flash[:danger] = \"you do not have permission to do that\"\n shunt_to_root\n end\n end\n end", "def insist_on(type = nil, user = nil)\n case type\n when :logged_in\n if anon?\n flash[:danger] = \"please sign in first\"\n shunt_to_root\n end\n when :logged_out\n unless anon?\n flash[:danger] = \"cannot perform this action while logged in\"\n shunt_to_root\n end\n when :permission\n users = user.is_a?(ActiveRecord::Relation)? user : [user]\n users.each do |user|\n user ||= User.new(name: params[User.slug] || \"any other user\")\n unless can_modify? user\n flash[:danger] = \"you are #{anon?? \"not signed in\" : \"signed in as #{current_user.name}\"} and are not allowed to view or modify #{user.name}'s personal records\"\n shunt_to_root\n end\n end\n when :existence\n unless user\n flash[:danger] = \"no such user\"\n shunt_to_root\n end\n else\n unless Proc.new.call\n flash[:danger] = \"you do not have permission to do that\"\n shunt_to_root\n end\n end\n end", "def off_org_users\n \n end", "def update_user_state\n user.clocked_in? ? user.clock_out : user.clock_in\n end", "def require_user\n end", "def active_user\n redirect_to(root_url) unless current_user.active?\n end", "def check_user_status\n user = current_user\n if user && user.status != 2\n redirect_to signupcode_settings_path\n end\n end", "def user_consenting?; end", "def faft_robot(user)\n end", "def private_goal(user)\n create_goal(\"Learn to paint\", \"true\")\n create_goal(\"Play the piano\")\n click_link 'Sign Out'\n other_user(user)\n click_link 'Wilbur'\n end", "def show\n require_user()\n end", "def user_profile \n system 'clear'\n CoffeeMan.stay_logo\n choice = @prompt.select(\"~P R O F I L E~\") do |menu|\n puts \"HELLO #{@userid.username}\".colorize(:light_blue)\n menu.choice \"Update Username\", -> {change_username}\n menu.choice \"Update Password\", -> {change_password}\n menu.choice \"Delete Account\", -> {delete_profile}\n menu.choice \"Back\", -> {main_menu}\n end\n sleep 1\n end", "def super_check\n if self.user_name == 'profbill'\n self.admin = true\n self.suspended = false\n self.icon = \"hand-peace-o\"\n end\n end", "def username\n end", "def show\n verifica_user\n end", "def switch_user\n volunteer = Volunteer.find(params[:volunteer_id].to_i)\n volunteer_region_ids = volunteer.regions.pluck(:id)\n admin_region_ids =\n current_volunteer.assignments.collect do |assignment|\n assignment.admin ? assignment.region.id : nil\n end.compact\n\n unless current_volunteer.super_admin? || (volunteer_region_ids & admin_region_ids).length > 0\n flash[:error] = \"You're not authorized to switch to that user!\"\n return redirect_to(root_path)\n end\n\n sign_out(current_volunteer)\n sign_in(volunteer)\n flash[:notice] = \"Successfully switched to user #{current_volunteer.name}.\"\n home\n end", "def username; end", "def username; end", "def username; end", "def username; end", "def is_active(user)\n user.status_id != 0\n end", "def user_command(args)\n return \"-> usage: v user [name]\" if args.size > 1\n\n if args.empty?\n current = @user || '<none>'\n allowed = allowed_users.empty? ? '<none>' : allowed_users.join(', ')\n return \"-> current: #{current}\\n allowed: #{allowed}\"\n end\n\n user = args.first\n if allowed?(user)\n @user = user\n close\n \"-> switched user to #{@user}\"\n else\n log.warn(\"#{@jid} denied access to #{user}\")\n \"-> user switch not allowed\"\n end\n end", "def user_check\n #check if sighned in?\n if user_signed_in?\n #format.html { redirect_to @post, notice: 'Every Vote Counts.' }\n\n end\n\n end", "def toggle\n @user.toggle\n redirect_to :back\n end", "def check_user_account!\n if(current_user.present? && (current_user.service_type == 'pending' || !current_user.is_active?))\n service_type = current_user.service_type\n sign_out(current_user)\n redirect_to root_path, :flash => {:notice => \"Your account is in waiting list for approval by Aa Express Staff.You will be notified when your account is ready.\"} and return if service_type == 'pending'\n redirect_to root_path, :flash => {:notice => \"Your account is de-activated by Aa Express Staff, please contact to Aa Express Staff for account activation.\"}\n end\n end", "def user(*eras); end", "def user_verification=(_arg0); end", "def suivre; end", "def current_user\n if session[:type] == \"student\"\n current_student()\n elsif session[:type] == \"professor\"\n current_professor()\n else\n @current_user = \"ERROR: NO USER TYPE\"\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in to vote\"\n redirect_to login_url\n end\n end", "def remember_me() return true; end", "def after_remembered; end", "def teacher_user \n self.line_break\n puts \"Type in your full name to begin:\".colorize(:light_green)\n self.line_break\n teacher_user = gets.chomp.titleize\n self.line_break\n if Teacher.find_by(name: teacher_user)\n puts \"Welcome #{teacher_user.titleize}!\".colorize(:light_magenta)\n self.teacher_tasks(teacher_user)\n else \n puts \"You are not authorized to access the portal. Please contact your administrator for additional support. Have a great day!\".colorize(:yellow)\n self.run\n end\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #if current_user exist or equil to this user then keep going\n end", "def valid_user\n # unless (@user && @user.activated? && @user.authenticated?(:reset, params[:id])) \n unless(@user && @user.activated?)\n redirect_to root_url\n end\n end", "def sepa\n mandate = @user.mandates.last\n if mandate.present? && mandate.ready?\n redirect_to_for_user_or_admin and return\n end\n redirect_to mandate.slimpay_approval_url and return if mandate && mandate.waiting?\n mandate = Mandate.sign(@user)\n if mandate.present?\n redirect_to mandate.slimpay_approval_url\n else\n redirect_to_for_user_or_admin(true)\n end\n end" ]
[ "0.6703043", "0.6703043", "0.65389574", "0.64703035", "0.6433849", "0.6419475", "0.64149183", "0.6406766", "0.63905185", "0.63445514", "0.61950576", "0.6053031", "0.60096693", "0.59791124", "0.5974468", "0.5974468", "0.5971042", "0.59633005", "0.59569865", "0.59547067", "0.5951664", "0.5943026", "0.5929796", "0.5922022", "0.5919974", "0.5914021", "0.59103024", "0.58838934", "0.5880837", "0.5874286", "0.58687884", "0.585229", "0.5846905", "0.5846905", "0.58460444", "0.5822746", "0.58201915", "0.5813989", "0.5812453", "0.58115655", "0.5811504", "0.58053774", "0.5798152", "0.5780606", "0.57780737", "0.57757634", "0.5772447", "0.5759769", "0.57505727", "0.57490754", "0.57484293", "0.5743835", "0.5737622", "0.5732696", "0.5731479", "0.5728132", "0.5724758", "0.57243377", "0.5723242", "0.5718499", "0.5713093", "0.5704896", "0.5704353", "0.5704312", "0.5703424", "0.5702305", "0.5702305", "0.56954557", "0.56913435", "0.56873614", "0.5684293", "0.56821287", "0.56802213", "0.5678803", "0.5673625", "0.56689376", "0.56666726", "0.56643564", "0.56592906", "0.5657799", "0.56562734", "0.565455", "0.565455", "0.565455", "0.565455", "0.5651388", "0.56459314", "0.56454426", "0.5643759", "0.5643121", "0.563446", "0.5632008", "0.5622325", "0.5618157", "0.5616376", "0.5615013", "0.5611217", "0.56064254", "0.56044763", "0.56032664", "0.56018287" ]
0.0
-1
Payload format per rubocop:disable Metrics/MethodLength
def build_payload(issuer, push_notification_url, uuid) iat = Time.zone.now.to_i { iss: Rails.application.routes.url_helpers.root_url, iat: iat, exp: iat + 12.hours.to_i, jti: jti(iat), aud: push_notification_url, events: { EVENT_TYPE_URI => { subject: { subject_type: 'iss-sub', iss: issuer, sub: uuid, }, }, }, } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payload_data\n case @config.format\n when :json\n @payload.to_json\n when :yaml\n @payload.to_yaml\n else\n @payload.to_hash\n end\n end", "def payload; end", "def payload; end", "def payload_format\n @header.payload_format\n end", "def format_request(payload); end", "def format_request(payload); end", "def to_payload\n payload = [OAP_MARKER, VERSION]\n asset_quantity_count = Bitcoin::Protocol.pack_var_int(@asset_quantities.length).unpack(\"H*\")\n payload << sort_count(asset_quantity_count[0])\n @asset_quantities.map{|q|payload << encode_leb128(q)}\n @metadata ||= ''\n metadata_length = Bitcoin::Protocol.pack_var_int(@metadata.length).unpack(\"H*\")\n payload << sort_count(metadata_length[0])\n payload << @metadata.bytes.map{|b| sprintf(\"%02x\", b)}.join\n payload.join\n end", "def format_response(payload); end", "def format_response(payload); end", "def payload_params\n params.require(:payload).permit(:created_at, :is_sent, :is_received, :pal_id)\n end", "def to_payload\n to_array.map { |line| MultiJson.encode(line) }.join(\"\\n\") + \"\\n\"\n end", "def format(payload)\n if(payload.get(:data, :repository_generator, :generated))\n payload.set(:data, :repository_publisher, :repositories,\n payload.get(:data, :repository_generator, :generated)\n )\n end\n if(payload.get(:data, :repository_generator, :package_assets))\n payload.set(:data, :repository_publisher, :package_assets,\n payload.get(:data, :repository_generator, :package_assets)\n )\n end\n end", "def payload\n {:id => id, :body => body, :origin => origin, :original_id => original_id}\n end", "def payload\n @payload\n end", "def append_info_to_payload(payload); end", "def to_s\n @payload ? @payload.to_s : self\n end", "def generate_payload(attributes, _record)\n fields = self.encoder.schema_fields\n payload = attributes.stringify_keys\n payload.delete_if do |k, _|\n k.to_sym != :payload_key && !fields.map(&:name).include?(k)\n end\n end", "def payload\n self.update(:payload)\n @payload\n end", "def as_payload\n {\n product: product,\n amount: amount,\n options: {\n additional_info: additional_info\n }\n }\n end", "def to_payload\n payload = \"\"\n tx_in_wit.each{|w|payload << w.to_payload}\n payload\n end", "def payload; message[:payload]; end", "def generate_message(payload)\n if payload.is_a? Fixnum\n payload.to_json\n else\n if payload.nil?\n nil\n elsif payload.respond_to?(:empty?) && payload.empty?\n nil\n elsif payload.respond_to? :to_edible\n payload.to_edible\n elsif payload.is_a? String\n payload\n else\n # Not sure that this is the appropriate implementation, perhaps to_s is better\n payload.to_json\n end\n end\n end", "def payload_encoder\n opts['Payload'] ? opts['Payload']['Encoder'] : nil\n end", "def serialize_old_format\n buf = [version].pack('V')\n buf << Bitcoin.pack_var_int(inputs.length) << inputs.map(&:to_payload).join\n buf << Bitcoin.pack_var_int(outputs.length) << outputs.map(&:to_payload).join\n buf << [lock_time].pack('V')\n buf\n end", "def to_payload(payload = nil)\n return {} if payload.nil?\n return {} if payload.respond_to?(:empty?) && payload.empty?\n\n # TODO: refactor this, don't update a hash that's not ours\n payload.update params: MultiJson.dump(payload[:params])\n payload.update signature: signature(payload[:params])\n payload.delete :signature if payload[:signature].nil?\n payload\n end", "def convert_payload_to_message(payload)\n message_array = []\n SSE_FIELDS.each do |field|\n value = if payload[field]\n payload[field]\n elsif field == :id\n SecureRandom.hex\n end\n\n message_array << \"\\n#{field}: #{value}\" if value\n end\n\n message_array << \"\\n\\n\"\n message_array.join(\"\")\n end", "def encode_payload(payload)\n payload = payload.is_a?(Hash) ? payload : payload.as_json\n JSON.dump(payload)\n end", "def represent(payload)\n if representer = @config[:payload_representer]\n payload.extend(representer)\n payload.to_hash\n else\n payload\n end\n end", "def general_payload\n payload = Hash.new\n payload['PayloadVersion'] = 1 # do not modify\n payload['PayloadUUID'] = UUIDTools::UUID.random_create().to_s # should be unique\n\n # string that show up in UI, customisable\n payload['PayloadOrganization'] = \"ACME Inc.\"\n payload\nend", "def encode_payload(payload)\n payload = payload.is_a?(Hash) ? payload : payload.as_json\n JSON.dump(payload)\n end", "def payload=(_arg0); end", "def serialize_old_format\n buf = [self.version].pack('V')\n buf << Bitcoin.pack_var_int(self.inputs.length) << self.inputs.order(index: :asc).map(&:to_payload).join\n buf << Bitcoin.pack_var_int(self.outputs.length) << self.outputs.order(n: :asc).map(&:to_payload).join\n buf << [self.lock_time].pack('V')\n buf\n end", "def render\n payload.to_json\n end", "def as_payload\n {\n product: product,\n amount: -amount,\n options: {\n lot_code: lot_code\n }\n }\n end", "def encode_payload(opts)\n case opts[:enc_format]\n when 'octal'\n return Rex::Text.to_octal(@exe, @prefix)\n else\n return Rex::Text.to_hex(@exe, @prefix)\n end\n end", "def inspect\n\t\treturn \"#<%p:%#0x [%d] %s/%d %0.2fKB payload at %s>\" % [\n\t\t\tself.class,\n\t\t\tself.object_id * 2,\n\t\t\tself.index,\n\t\t\tself.previous_hash,\n\t\t\tself.proof,\n\t\t\tself.payload.bytesize / 1024,\n\t\t\tself.timestamp,\n\t\t]\n\tend", "def format_payload(payload, as: JSON_CONTENT_TYPE)\n # Non-Hash payloads are passed through as-is.\n return payload unless payload.is_a? Hash\n\n # Massage Hash-like payloads into a suitable format.\n case as\n when JSON_CONTENT_TYPE\n JSON.generate(payload.as_json)\n when FORM_CONTENT_TYPE\n payload.to_query\n else\n payload.to_s\n end\n end", "def json_payload\n self.as_json\n end", "def inbound_payload\n JSON.parse(data)['inbound']['payload']\n end", "def payload_append_encoder\n opts['Payload'] ? opts['Payload']['AppendEncoder'] : nil\n end", "def to_payload(ruby_elt)\n type = self.class.element_type\n converter = CONVERTER_CLASS[type] || type\n converter.payload_format(ruby_elt)\n end", "def get_payload_options; end", "def flat_payload\n self.payload.to_a.flatten\n end", "def payload\n @payload[0] if @payload\n end", "def append_info_to_payload(payload)\n super\n\n # Use the request ID generated by the aamzon ALB, if available\n payload[:request_id] = request.headers.fetch(\"X-Amzn-Trace-Id\", request.request_id)\n payload[:remote_ip] = request.remote_ip\n payload[:user_agent] = request.user_agent\n end", "def to_h\n @payload\n end", "def to_s\n [0, 32, @device_token, @payload.length, @payload ].pack(\"CnH*na*\")\n end", "def payload\n @payload ||= JSON.parse(fields[\"payload\"])\n end", "def payload\n return v4_payload if normalized_api_version.nil?\n\n v5_payload\n end", "def create_ingestion_workflow_payload(params={})\n params[:uuid] ||= Config::Constants::ASSET_UUID\n params[:path] ||= Config::Constants::ASSET_PATH\n params[:title] ||= Config::Constants::ASSET_TITLE\n params[:url] ||= Config::Constants::ASSET_URL + params[:uuid] + '/'\n\n\n {\n 'definitionId': Config::Constants::INGESTION_WORKFLOW_METADATA_ID,\n 'stringVariables': {\n 'assetMetadata': '{ \"clip-type\":\"http://api.ft.com/things/a0e8ca2e-03b4-4321-9b50-4a85b38298cd\",'\\\n'\"clip-description\": \"10 Seconds\", \"location\":\"http://sws.geonames.org/6619890/\",'\\\n'\"interviewee\": \"Jem Rayfield\",\"office\": \"http://api.ft.com/things/a29a5f4f-b4ff-46f7-b597-a30437783e1e\",'\\\n'\"producer\": \"http://api.ft.com/things/a4fda01e-dd90-490b-a7be-7c74eafd3884\",\"freelance-producer\": \"James Condron\",'\\\n'\"reporter-1\": \"Darren Bown\", \"reporter-2\":\"Dario Villanueva\",\"reporter-3\":\"Jon Best\", \"restrictions\": '\\\n'\"true\", \"restriction-description\":\"Sensitive Video....classified top secret\"}',\n 'project-thing-url': params[:url],\n 'projectUUID': params[:uuid],\n 'assetS3Path': params[:path],\n 'assetTitle': params[:title]\n }\n }\n end", "def webhook_payload\n {}\n end", "def payload\n msg = {\n data: {\n alert: alert,\n badge: badge || \"Increment\",\n },\n }\n msg[:data][:sound] = sound if sound.present?\n msg[:data][:title] = title if title.present?\n msg[:data].merge! @data if @data.is_a?(Hash)\n\n if @expiration_time.present?\n msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time\n end\n if @push_time.present?\n msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time\n end\n\n if @expiration_interval.is_a?(Numeric)\n msg[:expiration_interval] = @expiration_interval.to_i\n end\n\n if query.where.present?\n q = @query.dup\n if @channels.is_a?(Array) && @channels.empty? == false\n q.where :channels.in => @channels\n end\n msg[:where] = q.compile_where unless q.where.empty?\n elsif @channels.is_a?(Array) && @channels.empty? == false\n msg[:channels] = @channels\n end\n msg\n end", "def payload_encoder_options\n opts['Payload'] ? opts['Payload']['EncoderOptions'] : nil\n end", "def append_info_to_payload(payload)\n super\n payload[:request_id] = request.uuid\n payload[:user_id] = current_user.id if current_user\n payload[:account_id] = current_account.cname if current_account\n end", "def generate_payload(pinst = nil)\n # Set the encoded payload to the result of the encoding process\n self.payload = generate_single_payload(pinst)\n\n # Save the payload instance\n self.payload_instance = (pinst) ? pinst : self.payload_instance\n\n return self.payload\n end", "def payload\n @payload ||= JSON.parse(@message.value)\n end", "def payload_encoder_type\n opts['Payload'] ? opts['Payload']['EncoderType'] : nil\n end", "def payload\n @payload.fetch('payload')\n end", "def append_info_to_payload(payload)\n super\n payload[:remote_ip] = request.remote_ip\n payload[:request_id] = request.uuid\n end", "def new_payload(parsed_params, identifier)\n Payload.new(\n source_id: Source.find_by(identifier: @identifier).id,\n url_id: Url.find_or_create_by(url: parsed_params[:url], relative_path: URI(parsed_params[:url]).path).id,\n requested_at: parsed_params[:requested_at],\n responded_in: parsed_params[:responded_in],\n referred_by_id: Referrer.find_or_create_by(referred_by_url: parsed_params[:referred_by]).id,\n request_type_id: RequestType.find_or_create_by(request_type: parsed_params[:request_type]).id,\n parameters: parsed_params[:parameters],\n event_name_id: EventName.find_or_create_by(event_name: parsed_params[:event_name]).id,\n user_agent_id: TrafficSpy::UserAgent.find_or_create_by(web_browser: parsed_params[:user_agent]).id,\n screen_resolution_id: ScreenResolution.find_or_create_by(resolution_width: parsed_params[:resolution_width], resolution_height: parsed_params[:resolution_height]).id,\n ip: parsed_params[:ip]\n )\n end", "def format(payload)\n if(payload[:status].to_s != 'error' && payload.get(:data, :package_builder, :name))\n payload.set(:data, :github_kit, :release,\n Smash.new(\n :repository => [\n payload.get(:data, :code_fetcher, :info, :owner),\n payload.get(:data, :code_fetcher, :info, :name)\n ].join('/'),\n :reference => payload.get(:data, :code_fetcher, :info, :commit_sha),\n :tag_name => payload.get(:data, :package_builder, :version),\n :name => [\n payload.get(:data, :package_builder, :name),\n payload.get(:data, :package_builder, :version)\n ].join('-'),\n :prerelease => prerelease?(payload.get(:data, :package_builder, :version)),\n :body => \"Release - #{payload.get(:data, :package_builder, :name)} <#{payload.get(:data, :package_builder, :version)}>\",\n :assets => payload.get(:data, :package_builder, :keys)\n )\n )\n end\n end", "def prepare_payload(pld)\n pld\n end", "def payload\n return @payload if @payload\n \n payload_class = if (@flags & 0x40) == 0x40\n Dot11WEP\n elsif @type == 0\n [ Dot11AssoReq, Dot11AssoResp, Dot11ReassoReq, Dot11ReassoResp, Dot11ProbeReq, Dot11ProbeResp, nil, nil,\n Dot11Beacon, Dot11ATIM, Dot11Disas, Dot11Auth, Dot11Deauth, nil, nil, nil,\n nil, nil, nil, nil, nil, nil, nil, nil,\n nil, nil, nil, nil, nil, nil, nil ][@subtype]\n elsif @type == 2\n if @subtype == 0\n Dot11Data\n elsif @subtype == 4\n Dot11NullData\n end \n end\n \n return nil if payload_class.nil?\n \n @payload = payload_class.new(@rest) unless (payload_class == Dot11NullData || @rest.nil? || @rest.empty?)\n end", "def default_payload\n {\n app_name: app_name,\n app_url: app_url,\n deployment_remote: deployment_remote,\n tag_name: tag_name,\n match_tag: match_tag_name\n }\n end", "def make_payload(h)\n payload = {\n server_ts: Time.now.getutc.xmlschema,\n }\n\n if h.has_key?(:err)\n payload.merge!({success: false, error: h[:err]})\n else\n payload.merge!({success: true, quote: h[:pair], rate: h[:rate].round(8).to_s('8F')})\n end\n\n return payload.to_json\nend", "def to_body\n \"payload=\" + URI.encode(to_json_string)\n end", "def payload\n {\n command_name: upconverter.command_name,\n database_name: @database,\n command: upconverter.command,\n request_id: request_id\n }\n end", "def to_s\n pad_field :body\n recalc_block_len\n super\n end", "def to_payload\n version.htb << [depth].pack('C') << parent_fingerprint.htb <<\n [number].pack('N') << chain_code << [0x00].pack('C') << key.priv_key.htb\n end", "def append_info_to_payload(payload)\n super\n request_logging_context_data.each do |key, value|\n payload[key] = BlackSquareLoggingRails.format_value(value)\n end\n\n # Add request parameters to lograge output when the logger is in DEBUG mode\n if BlackSquareLoggingRails.enable_request_parameter_logging\n parameters = request.filtered_parameters.except(*ActionController::LogSubscriber::INTERNAL_PARAMS)\n payload[:request_params] = BlackSquareLoggingRails.format_value(parameters) if parameters.any?\n end\n end", "def to_token_payload\n payload = Hash.new\n\n payload[:sub] = self.email\n payload[:firstName] = self.first_name\n payload[:id] = self.id\n payload[:lastName] = self.last_name\n\n payload\n end", "def payload(endpoint, json_data)\n # { endpoint.type.to_s.singularize => JSON.parse(data) }.to_json\n { endpoint.type.to_s.singularize => json_data }.to_json\n end", "def to_payload\n pin = @in.map{|i|\n buf = [ i.prev_out, i.prev_out_index ].pack(\"a32I\")\n buf << Protocol.pack_var_int(i.script_sig_length)\n buf << i.script_sig if i.script_sig_length > 0\n buf << (i.sequence || \"\\xff\\xff\\xff\\xff\")\n }.join\n\n pout = @out.map{|o|\n buf = [ o.value ].pack(\"Q\")\n buf << Protocol.pack_var_int(o.pk_script_length)\n buf << o.pk_script if o.pk_script_length > 0\n buf\n }.join\n\n in_size, out_size = Protocol.pack_var_int(@in.size), Protocol.pack_var_int(@out.size)\n [[@ver].pack(\"I\"), in_size, pin, out_size, pout, [@lock_time].pack(\"I\")].join\n end", "def to_witness_payload\n pin = \"\"\n @in.each{|input| pin << input.to_payload }\n pout = \"\"\n @out.each{|output| pout << output.to_payload }\n payload = [@ver].pack(\"V\") << [0].pack(\"c\") << [1].pack(\"c\") << Bitcoin::Protocol.pack_var_int(@in.size) << pin <<\n Bitcoin::Protocol.pack_var_int(@out.size) << pout << @witness.to_payload << [@lock_time].pack(\"V\")\n payload\n end", "def to_s\n \"Event Type: #{event_type}, Payload: #{payload}, Settings: #{settings}\"\n end", "def request_payload\n {}\n end", "def payload\n deserialize_json(body)\n end", "def payload(prefix = nil)\n changes.each_with_object({}) do |(attribute_key, (_, value)), payload|\n key = if prefix\n \"#{prefix}.#{attribute_key}\"\n else\n attribute_key\n end\n\n bury(key, value, payload)\n end\n end", "def to_token_payload\n payload = {}\n # std jwt claims\n payload['sub'] = id.to_s\n payload['iat'] = Time.now.utc.to_i\n payload['iss'] = Rails.application.secrets.jwt_issuer\n # sombra claims\n payload['role'] = role\n payload['name'] = name\n payload\n end", "def payload\n @payload ||= (super || self.class.payload(@uuid))\n end", "def _to_payload\n { 'dir' => -1,\n 'results' => -1,\n 'sort' => 'assetIP',\n 'startIndex' => -1,\n 'table-id' => 'assetfilter',\n 'searchCriteria' => to_json }\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"applicationId\", @application_id)\n writer.write_string_value(\"changeType\", @change_type)\n writer.write_string_value(\"clientState\", @client_state)\n writer.write_string_value(\"creatorId\", @creator_id)\n writer.write_string_value(\"encryptionCertificate\", @encryption_certificate)\n writer.write_string_value(\"encryptionCertificateId\", @encryption_certificate_id)\n writer.write_date_time_value(\"expirationDateTime\", @expiration_date_time)\n writer.write_boolean_value(\"includeResourceData\", @include_resource_data)\n writer.write_string_value(\"latestSupportedTlsVersion\", @latest_supported_tls_version)\n writer.write_string_value(\"lifecycleNotificationUrl\", @lifecycle_notification_url)\n writer.write_string_value(\"notificationQueryOptions\", @notification_query_options)\n writer.write_string_value(\"notificationUrl\", @notification_url)\n writer.write_string_value(\"notificationUrlAppId\", @notification_url_app_id)\n writer.write_string_value(\"resource\", @resource)\n end", "def to_s\n pad_field :data\n recalc_block_len\n super\n end", "def create_payload(api_key_str:, msg:, extra_content:)\n \"#{api_key_str} #{extra_content} #{msg}\\n\"\n end", "def test_payload_roundtrip\n # Test with values\n header = EasyIP::Header.new(pack_packet(TWO_WORDS))\n payload1 = header.payload\n header.payload= payload1\n assert_equal payload1, header.payload\n \n # Test with string array\n header = EasyIP::Header.new(pack_packet(LONG_STRING))\n payload1 = header.payload\n header.payload = payload1\n assert_equal payload1, header.payload\n \n # Test with single string\n header.payload = \"test\"\n assert_equal [\"test\"], header.payload\n end", "def read_payload\n ascii_str = File.read(\"/dev/urandom\", @bytes_to_read)\n utf8_str = ascii_to_utf8(ascii_str)\n formatted_str = format_string(utf8_str)\n @payload = formatted_str\n end", "def validate_payload\n raise EmptyPayloadException.new unless payload\n raise PayloadEncodingException.new unless payload.encoding.to_s == \"UTF-8\"\n raise PayloadFormattingException.new if payload =~ / /\n end", "def event_body(event)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n LogStash::Json.dump(map_event(event))\n elsif @format == \"message\"\n event.sprintf(@message)\n elsif @format == \"json_batch\"\n LogStash::Json.dump(event.map {|e| map_event(e) })\n else\n encode(map_event(event))\n end\n end", "def create\n @payload = Payload.new(payload_params)\n\n respond_to do |format|\n if @payload.save\n format.html { redirect_to @payload, notice: 'Payload was successfully created.' }\n format.json { render :show, status: :created, location: @payload }\n else\n format.html { render :new }\n format.json { render json: @payload.errors, status: :unprocessable_entity }\n end\n end\n end", "def payload=(payload)\n @message[:payload] = payload\n end", "def desc\n\t\t\"JavaPayload\"\n\tend", "def via_payload\n\t\tself.via['Payload'] if (self.via)\n\tend", "def via_payload\n\t\tself.via['Payload'] if (self.via)\n\tend", "def hasMorePayloads; end", "def parse_body(buffer)\n super(buffer)\n @topic = shift_string(buffer)\n @id = shift_short(buffer) unless qos.zero?\n @payload = buffer\n end", "def to_binary(options = {})\n id_for_pack = options[:for_validation] ? 0 : id\n [1, id_for_pack, expiry, 0, 32, device_token, payload_size, payload].pack(\"cNNccH*na*\")\n end", "def payload\n {\n command_name: 'insert',\n database_name: @database,\n command: upconverter.command,\n request_id: request_id\n }\n end", "def encode_body\n body = ''\n if @topic.nil? || @topic.to_s.empty?\n raise 'Invalid topic name when serialising packet'\n end\n body += encode_string(@topic)\n body += encode_short(@id) unless qos.zero?\n body += payload.to_s.dup.force_encoding('ASCII-8BIT')\n body\n end", "def pretty\n s = \"\"\n self.fields.each do |f|\n unless (f.name == \"payload\")\n s += \"#{f.name}=#{self.send(f.name)} \"\n end\n end\n s.gsub(/ $/, '')\n end", "def data\n identifier = @identifier || 0\n expiry = @expiry || 0\n size = [payload].pack(\"a*\").size\n data_array = [1, identifier, expiry, 32, token, size, payload]\n data_array.pack(\"cNNnH*na*\")\n end" ]
[ "0.71444917", "0.7028675", "0.7028675", "0.6853001", "0.6826508", "0.6826508", "0.65368205", "0.6445601", "0.6445601", "0.6422024", "0.640341", "0.63744766", "0.6327484", "0.6321915", "0.63196987", "0.6318331", "0.63133407", "0.62974715", "0.62884766", "0.6277859", "0.62731063", "0.6262428", "0.6254965", "0.6241755", "0.62244457", "0.6215332", "0.6182172", "0.61727095", "0.616365", "0.6122809", "0.61199313", "0.6119752", "0.60923284", "0.60758674", "0.6069232", "0.6066676", "0.6054325", "0.6017144", "0.6009526", "0.5978096", "0.59527564", "0.59487164", "0.59081054", "0.5906856", "0.59027153", "0.58976114", "0.5883618", "0.58794767", "0.58732575", "0.5873213", "0.5853164", "0.5841453", "0.5835657", "0.5829267", "0.58273154", "0.5826742", "0.58162445", "0.5815925", "0.58083254", "0.58032024", "0.5795473", "0.57799375", "0.5755083", "0.5738575", "0.5712269", "0.5701382", "0.56956303", "0.5692964", "0.56926405", "0.5691187", "0.5688291", "0.56673944", "0.56512296", "0.56444335", "0.5643629", "0.5643118", "0.56398374", "0.5637769", "0.5636918", "0.5633706", "0.56233954", "0.55979025", "0.5590998", "0.55903494", "0.5585959", "0.5585877", "0.5584141", "0.5573717", "0.5570024", "0.5562952", "0.5561151", "0.5558612", "0.5557746", "0.5555753", "0.55548865", "0.5549182", "0.5546396", "0.5538351", "0.5537758", "0.5509798" ]
0.5537014
99
Optionally pass in a different :col_sep as an optional hash param. The default :col_sep is tab.
def initialize(filepath, col_sep: "\t") @filepath = filepath @col_sep = col_sep @file_handle = File.open(filepath) @headers = @file_handle.gets.chomp!.split(col_sep, -1).map(&:downcase).map(&:to_sym) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csvColSepChar()\n c = getConf(:csvColSep)\n case(c)\n when :comma, nil ; return \",\" ;\n when :tab ; return \"\\t\" ;\n when :space ; return \" \" ;\n else\n if(c.is_a?(String)) then\n return c ;\n else\n raise \"unknown CSV column separator: '#{c}'\" ;\n end\n end\n end", "def init_separators(col_sep, row_sep, quote_char, force_quotes)\n # store the selected separators\n @col_sep = col_sep.to_s.encode(@encoding)\n if @col_sep == \" \"\n @col_sep_split_separator = Regexp.new(/#{Regexp.escape(@col_sep)}/)\n else\n @col_sep_split_separator = @col_sep\n end\n @row_sep = row_sep # encode after resolving :auto\n @quote_char = quote_char.to_s.encode(@encoding)\n @double_quote_char = @quote_char * 2\n\n if @quote_char.length != 1\n raise ArgumentError, \":quote_char has to be a single character String\"\n end\n\n #\n # automatically discover row separator when requested\n # (not fully encoding safe)\n #\n if @row_sep == :auto\n if [ARGF, STDIN, STDOUT, STDERR].include?(@io) or\n (defined?(Zlib) and @io.class == Zlib::GzipWriter)\n @row_sep = $INPUT_RECORD_SEPARATOR\n else\n begin\n #\n # remember where we were (pos() will raise an exception if @io is pipe\n # or not opened for reading)\n #\n saved_pos = @io.pos\n while @row_sep == :auto\n #\n # if we run out of data, it's probably a single line\n # (ensure will set default value)\n #\n break unless sample = @io.gets(nil, 1024)\n\n cr = encode_str(\"\\r\")\n lf = encode_str(\"\\n\")\n # extend sample if we're unsure of the line ending\n if sample.end_with?(cr)\n sample << (@io.gets(nil, 1) || \"\")\n end\n\n # try to find a standard separator\n sample.each_char.each_cons(2) do |char, next_char|\n case char\n when cr\n if next_char == lf\n @row_sep = encode_str(\"\\r\\n\")\n else\n @row_sep = cr\n end\n break\n when lf\n @row_sep = lf\n break\n end\n end\n end\n\n # tricky seek() clone to work around GzipReader's lack of seek()\n @io.rewind\n # reset back to the remembered position\n while saved_pos > 1024 # avoid loading a lot of data into memory\n @io.read(1024)\n saved_pos -= 1024\n end\n @io.read(saved_pos) if saved_pos.nonzero?\n rescue IOError # not opened for reading\n # do nothing: ensure will set default\n rescue NoMethodError # Zlib::GzipWriter doesn't have some IO methods\n # do nothing: ensure will set default\n rescue SystemCallError # pipe\n # do nothing: ensure will set default\n ensure\n #\n # set default if we failed to detect\n # (stream not opened for reading, a pipe, or a single line of data)\n #\n @row_sep = $INPUT_RECORD_SEPARATOR if @row_sep == :auto\n end\n end\n end\n @row_sep = @row_sep.to_s.encode(@encoding)\n\n # establish quoting rules\n @force_quotes = force_quotes\n do_quote = lambda do |field|\n field = String(field)\n encoded_quote = @quote_char.encode(field.encoding)\n encoded_quote + field.gsub(encoded_quote, encoded_quote * 2) + encoded_quote\n end\n quotable_chars = encode_str(\"\\r\\n\", @col_sep, @quote_char)\n @quote = if @force_quotes\n do_quote\n else\n lambda do |field|\n if field.nil? # represent +nil+ fields as empty unquoted fields\n \"\"\n else\n field = String(field) # Stringify fields\n # represent empty fields as empty quoted fields\n if field.empty? or\n field.count(quotable_chars).nonzero?\n do_quote.call(field)\n else\n field # unquoted field\n end\n end\n end\n end\n end", "def default_separator=(separator); end", "def guess_column_separator(filehandle, options)\n skip_lines(filehandle, options)\n\n delimiters = [',', \"\\t\", ';', ':', '|']\n\n line = nil\n has_header = options[:headers_in_file]\n candidates = Hash.new(0)\n count = has_header ? 1 : 5\n count.times do\n line = readline_with_counts(filehandle, options)\n delimiters.each do |d|\n candidates[d] += line.scan(d).count\n end\n rescue EOFError # short files\n break\n end\n rewind(filehandle)\n\n if candidates.values.max == 0\n # if the header only contains\n return ',' if line.chomp(options[:row_sep]) =~ /^\\w+$/\n\n raise SmarterCSV::NoColSepDetected\n end\n\n candidates.key(candidates.values.max)\n end", "def column_seperator\n self.data.strip.each.first.gsub(/[;,]/).first\n end", "def separator\n \"-\" * (COLUMN_NUM * COLUMN_SIZE)\nend", "def default_separator; end", "def table_separation\n line = \"#{TABLE_COLUMN_LINE}|#{TABLE_COLUMN_LINE}\".dup\n line << \"|#{TABLE_COLUMN_LINE}\" if header_line_rate?\n line << \"|#{TABLE_COLUMN_LINE}\" if header_branch_rate?\n line << \"\\n\"\n end", "def add_csv_options(opt)\n opt.on(\"--headers\", \"-h\", \"Read/Write column names on first line\") do\n io_options[:csv][:headers] = true\n end\n opt.on(\"--separator=C\", \"Use C as column separator character\") do |value|\n io_options[:csv][:col_sep] = value\n end\n opt.on(\"--quote=C\", \"Use C as quoting character\") do |value|\n io_options[:csv][:quote_char] = value\n end\n opt.on(\"--force-quotes\", \"Force quoting?\") do \n io_options[:csv][:force_quotes] = true\n end \n opt.on(\"--skip-blanks\", \"Skip blank lines?\") do \n io_options[:csv][:skip_blanks] = true\n end \n end", "def set_separator_row rownum, char = '-'\n @separator_rows[rownum] = char\n end", "def sep; end", "def sep; end", "def set_delimiter delim\n @lt2_delimiter = case delim\n when Regexp\n delim\n else\n delim.to_s\n end\n end", "def csv_options\n {\n col_sep: dialect.delimiter,\n row_sep: dialect.lineTerminator,\n quote_char: dialect.quoteChar,\n encoding: dialect.encoding\n }\n end", "def csv_options(override_options={})\n options = CSV_DEFAULTS.clone\n options[:col_sep] = self.padma.try :separator\n options[:encoding] = self.padma.try :encoding\n\n return options.merge(override_options.to_hash.symbolize_keys!)\n end", "def path_sep=(val)\n Vitals::Utils.path_sep = val\n end", "def default_line_separator\n @def_line_sep ||= infer_line_separator\n end", "def separator\n columns_dashes = @widths.map { |w| '-' * (w + 2) }\n \"+#{columns_dashes.join('+')}+\"\n end", "def separator=(value)\n @separator = value\n end", "def print_row_col_headers(option = nil)\n if option.nil?\n @print_headers = 1\n else\n @print_headers = option\n end\n end", "def lsep\n \"==================================================================================\"\n end", "def csv_options\n memo = other_options.slice(*PASSTHROUGH_CSV_SETTINGS)\n memo[:skip_blanks] = !keep_blank_rows\n memo[:headers] ||= headers\n memo[:col_sep] ||= delimiter\n memo\n end", "def delimiter\n @view_column[:delimiter] || '-'\n end", "def delimiter(col)\n gmu(\"# \", col)\n end", "def format_row(data)\n data.join(col_sep * 2) + row_sep\n end", "def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end", "def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end", "def separator\n return @separ if @separ\n str = \"\"\n if @numbering\n str = \"-\"*(rows+1)+@x\n end\n each_column { | c, ix|\n v = c.width\n next if v == 0 ## hidden column\n str << \"-\" * (v+1) + @x \n }\n @separ = str.chop\n end", "def delimiter= new_delimiter\n frozen_check!\n @gapi.csv_options.field_delimiter = new_delimiter\n end", "def delimiter= new_delimiter\n frozen_check!\n @gapi.csv_options.field_delimiter = new_delimiter\n end", "def separator\n I + columns.collect_with_index do |col, i| \n X * (length_of_column(i) + 2) \n end.join(I) + I \n end", "def colnum; @options.fetch(:colnum, 0); end", "def option_separator(text = '')\n @cl_parser.separator(text)\n end", "def default_separator(value = T.unsafe(nil)); end", "def table_opts\n {\n converters: [YEAR_NORMALIZER, :float],\n headers: true,\n header_converters: [->(header) { normalize_key(header) }],\n # Needed to retrieve the headers in case of an otherwise empty csv file\n return_headers: true\n }\n end", "def separated_by(sep, sym, &block)\n option(separated_by1(sep, sym), [], &block)\n end", "def print_separator\n str = \"+\" + \"-\" * (title_width + 2)\n \n column_order.length.times do\n str += \"+\" + \"-\" * (column_width + 2)\n end\n \n puts str + '+'\n end", "def separator; end", "def appropriate_column_listing(columns = columns_joined)\n has_config_defined_cols? == true ? \", #{columns}\" : \"\"\n end", "def separator\n \":\"\n end", "def separator(str)\n # We store separators as simple strings in the options array to maintain\n # order. They are ignored by the parser.\n @@options << str\n end", "def separator\n ','\n end", "def quote(sep = nil)\n sep ||= \"'\"\n sep + self + sep\n end", "def insert_tab\n insert(cursor, \"\\t\")\n end", "def print(sep=\" \")\n\t\tprepare(@dim_i,@dim_j)\n\t\tlgMax = Array.new # ce tableau va connaitre la longueur max de chaque colonne\n\t\tfor j in 0..@dim_j - 1\n\t\t\tlgMax.push longer(get_col(j))\n\t\tend\n\t\tfor i in 0..@dim_i-1\n\t\t\ttmpRow=\"\"\n\t\t\tfor j in 0..@dim_j-1\n\t\t\t\ttmpRow += sep + \" \" * (lgMax[j] - @myTab[i][j].to_s.length) + @myTab[i][j].to_s\n\t\t\tend\n\t\t\ttmpRow += sep\n\t\t\tputs tmpRow\n\t\tend\n\tend", "def csv_params\n\n owner_id = owner_id\n owner_id = id if usertype == \"reseller\"\n sep = Confline.get_value(\"CSV_Separator\", owner_id).to_s\n dec = Confline.get_value(\"CSV_Decimal\", owner_id).to_s\n\n sep = Confline.get_value(\"CSV_Separator\", 0).to_s if sep.to_s.length == 0\n dec = Confline.get_value(\"CSV_Decimal\", 0).to_s if dec.to_s.length == 0\n\n sep = \",\" if sep.blank?\n dec = \".\" if dec.blank?\n\n return sep, dec\n end", "def on_words_sep(token)\n log \"WORDS_SEP: '#{token}'\"\n super(token)\n end", "def delimiter\n @gapi.csv_options.field_delimiter\n end", "def delimiter\n @gapi.csv_options.field_delimiter\n end", "def breakable(sep=' ', width=nil)\n @output << sep\n end", "def mark_csv_headers\n \"Username,Name,Tutorial,Task,ID,Student's Last Comment,Your Last Comment,Status,New Grade,New Comment\"\n end", "def fix_separators!(separator)\n return self if separator.nil? || separator.empty?\n\n r = Regexp.escape(separator)\n\n # No more than one of the separator in a row.\n substitute!(/#{r}{2,}/, separator)\n\n # Remove leading/trailing separator.\n substitute!(/^#{r}|#{r}$/i, '')\n end", "def separator\n nil\n end", "def to_csv( separateur = ':' )\n DBC.require( separateur.size == 1, \"#{self}.to_csv: separateur invalide: #{separateur}\" )\n [numero.to_s,\n vie,\n attaque,\n defense,\n tete,\n tetedefense,\n torse,\n torsedefense,\n mains,\n mainsdefense,\n pantalons,\n pantalonsdefense,\n bottes,\n bottesdefense,\n arme,\n armeattaque,\n type.to_s,\n nom,\n puissance\n ].join(separateur)\n end", "def init_separator(hash)\n end", "def line_separator(args = {})\n count = args[:count].nil? ? 20 : args[:count]\n separator = args[:separator].nil? ? '-' : args[:separator]\n\n # Concatenate and output.\n puts separator * count\n end", "def sep\n puts\n puts '=' * 70\n puts\nend", "def inferred_separator\n SUPPORTED_SEPARATORS.each do |sep|\n return sep if data.scan(sep).length > 0\n end\n\n raise UnknownFormat.new(@path)\n end", "def separator(type)\n case type\n when :year\n @options[:year_separator] || ''\n \n when :month\n @options[:month_separator] || ''\n \n when :day\n @options[:day_separator] || ''\n \n when :hour\n (@options[:discard_year] && @options[:discard_day]) ? \"\" : @options[:datetime_separator]\n \n when :minute\n @options[:time_separator]\n \n when :second\n @options[:include_seconds] ? @options[:time_separator] : \"\"\n \n end\n end", "def initialize(header, options = {})\n @header_cols = split_by_comma_regex(header || \"\")\n @insert_cols = (options[:insert] || \"\").split(/,|;/)\n @positions = options[:pos] || []\n @sort = options[:sort]\n end", "def sep(separator)\n ->(a, b){ a << separator.html_safe << b }\n end", "def print_separator( enable = $VERBOSE )\n puts \"-\" * $LINE_LENGTH if enable\nend", "def to_tsv(columns, delim = \"\\t\")\n str = \"\"\n columns.each do |col|\n str << col.name.to_s.titleize + delim\n end\n str << \"\\n\"\n self.each do |object|\n columns.each do |col|\n str << object.send(col.name.to_s).to_s + delim if\n object.respond_to?(col.name.to_s)\n end\n str << \"\\n\"\n end\n str\n end", "def initialize(filename,\n col_sep: \",\",\n comment_starts: false,\n comment_matches: false,\n ignore_empty_lines: true,\n surrounding_space_need_quotes: false,\n quote_char: \"\\\"\",\n default_filter: Jcsv.optional,\n strings_as_keys: false,\n format: :list,\n headers: true,\n custom_headers: nil,\n chunk_size: 0,\n deep_map: false,\n dimensions: nil,\n suppress_warnings: false)\n \n @filename = filename\n @col_sep = col_sep\n @comment_starts = comment_starts\n @comment_matches = comment_matches\n @default_filter = default_filter\n @filters = false\n @strings_as_keys = strings_as_keys\n @headers = headers\n @custom_headers = custom_headers\n @ignore_empty_lines = ignore_empty_lines\n @format = format\n @surrounding_space_need_quotes = surrounding_space_need_quotes\n @quote_char = quote_char\n @chunk_size = (chunk_size == :all)? 1.0/0.0 : chunk_size\n @deep_map = (@format == :list)? false : deep_map\n @dimensions_names = dimensions\n @column_mapping = Mapping.new\n @suppress_warnings = suppress_warnings\n \n prepare_dimensions if dimensions\n\n # set all preferences. To create a new reader we need to have the dimensions already\n # prepared as this information will be sent to supercsv for processing.\n new_reader(set_preferences)\n\n # Dynamic class change without writing subclasses. When headers, extend this class\n # with methods that assume there is a header, when no headers, then extend this class\n # with methods that know there is no header. Could have being done with subclasses,\n # but this would all subclasses to have two subclasses one inheriting from the header\n # class and one inheriting from the headerless classes. In this way we reduce the\n # subclasses need.\n @headers? prepare_headers : (@custom_headers? set_headers(@custom_headers) :\n headerless)\n\n # if there are dimensions, then we need to prepare the mappings accordingly. With\n # dimensions defined, users cannot defined mappings.\n dimensions_mappings if dimensions\n \n end", "def print_col_prefix(dev)\n if $verbose\n if $widths\n w_name, w_serial = $widths\n w_serial *= -1\n else\n w_name = w_serial = ''\n end\n fmt = \"[*] %#{w_name}s / %#{w_serial}s: \"\n $stdout.write fmt % [ dev[:name], dev[:serial] ] \n\n else\n fmt = \"[*] %#{$widths}s: \"\n $stdout.write fmt % [ dev[:name] ]\n\n end\n $stdout.flush\nend", "def columns(*args)\n @columns = @columns | args.map(&:to_sym)\n end", "def _sep\n\n _save = self.pos\n while true # sequence\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_end_hyphen_of_hyphen_line)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_comma)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save3 = self.pos\n while true # choice\n _tmp = apply(:_space)\n break if _tmp\n self.pos = _save3\n _tmp = apply(:_comment)\n break if _tmp\n self.pos = _save3\n _tmp = apply(:_end_hyphen_of_hyphen_line)\n break if _tmp\n self.pos = _save3\n _tmp = apply(:_comma)\n break if _tmp\n self.pos = _save3\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_sep unless _tmp\n return _tmp\n end", "def to_s(sep=\"\\t\")\n map do |row|\n row.join(sep)\n end.join(\"\\n\")\n end", "def export_column_headers(export_type = :addon_address)\n unless self.accepted.include? export_type\n raise ArgumentError, \"Invalid export_type. Try one of these: \\n \\t #{self.accepted.join ' '}\" \n end\n #todo make this private or add check for export_type\n headers = self.parsed_content[0]\n\n case export_type\n when :addon_address then headers += ['NORMALIZED']\n when :just_addresses then headers = ['Normalized Addresses']\n when :seperate_columns \n keys = self.tokenized_addresses.first.to_hash.keys\n headers = keys.map { |key| key.to_s}\n end\n end", "def set_SortColumnString(value)\n set_input(\"SortColumnString\", value)\n end", "def set_SortColumnString(value)\n set_input(\"SortColumnString\", value)\n end", "def rl_tab_insert(count, key)\r\n _rl_insert_char(count, \"\\t\")\r\n end", "def indent(times = 1)\n if ENV['TM_SOFT_TABS'] == 'NO' then \"\\t\" * times\n else ' ' * ENV['TM_TAB_SIZE'].to_i * times\n end\nend", "def separator(type); end", "def parse_csv content, sep\n CSV.parse(content, :col_sep => sep,\n :converters => [:numeric],\n :headers => true,\n :skip_blanks => true).\n map{ |row| row.to_hash }\n end", "def parameterize(sep='-')\n parameterized_string = self.downcase\n parameterized_string.gsub!(/[^a-z0-9\\-]+/, sep) # differs from rails version: don't allow underscores\n unless sep.nil? || sep.empty?\n re_sep = Regexp.escape(sep)\n # No more than one of the separator in a row.\n parameterized_string.gsub!(/#{re_sep}{2,}/, sep)\n # Remove leading/trailing separator.\n parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/, '')\n end\n parameterized_string\n end", "def table_csv_string(options = {})\n opt = {\n :klass => nil,\n :header_row => true\n }.merge!(options)\n str = ''\n \n return false if !opt[:klass]\n\n klass_name = opt[:klass].name\n tbl = ActiveSupport::Inflector.tableize(opt[:klass].name.to_s)\n\n cols = []\n sql = ''\n\n if klass_name == \"Person\" \n cols = %w(id last_name first_name middle_name login)\n else\n cols = opt[:klass].columns.map(&:name) \n end\n\n cols_str = cols.join(\", \")\n\n case opt[:klass].name\n when \"Person\"\n sql = \"SELECT #{cols_str} FROM people p INNER JOIN people_projs pp on p.id = pp.person_id WHERE pp.proj_id = #{self.id};\"\n when \"Ref\"\n cols_str = cols.collect{|c| \"r.#{c}\"}.join(\", \") # refs shared across projects, be more explicit for the join table\n sql = \"SELECT #{cols_str} FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id};\"\n when \"TaxonName\"\n sql = \"SELECT #{cols_str} FROM taxon_names WHERE #{self.sql_for_taxon_names}\"\n when \"Author\"\n sql = \"SELECT #{cols_str} FROM authors a WHERE a.ref_id IN (SELECT r.id FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id})\"\n when \"ChrState\"\n sql = \"SELECT #{cols_str} FROM chr_states cs WHERE cs.chr_id IN (SELECT chrs.id from chrs WHERE chrs.proj_id = #{self.id})\" \n # when \"Identifier\"\n # sql = \"SELECT #{cols_str} FROM identifiers si WHERE si.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n when \"SpecimenDetermination\"\n sql = \"SELECT #{cols_str} FROM specimen_determinations sd WHERE sd.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n\n else\n sql = \"SELECT #{cols_str} FROM #{tbl}\" \n end\n\n # add the project level restrictions if they exist\n sql << \" WHERE proj_id = #{self.id}\" if opt[:klass].columns.collect{|c| c.name}.include?(\"proj_id\")\n\n # build the str\n str << cols.join(\"\\t\") if opt[:header_row]# the header row\n str << \"\\n\"\n\n ActiveRecord::Base.connection.select_rows(sql).each do |row| \n # not filtering for tab characters here, likely should\n str << row.collect{|c| c == nil ? nil : c.gsub(/\\n|\\r\\n|\\r/, '\\n')}.join(\"\\t\") + \"\\n\"\n end\n str\n end", "def to_bmet_csv\n case @cmd_switch\n when 'add_forgroups'\n to_bmet_csv_add_forgroups\n when 'replace_type'\n to_bmet_csv_replace_type\n else\n STDERR.puts \"Invalid command line switch: #{@cmd_switch}\"\n exit 1\n end\n end", "def esc_col(str)\r\n self.conn_exec do |driver|\r\n return driver.esc_col(str)\r\n end\r\n end", "def opx_pp(items, col, start_col, fill_col)\n return print(\"\\n\") if (items.length == 0)\n item = items.shift\n print (item = item + (items.length == 0 ? \"\" : \", \"))\n col += item.length\n if ((items.length > 0) && (fill_col <= (col + items[0].length)))\n print \"\\n\"\n start_col.times { |x| print(\" \") }\n col = start_col\n end\n opx_pp(items, col, start_col, fill_col)\n rescue => e\n opx_err(\"Fatal failure while pretty-printing Tabulator data\", e)\n end", "def print_table(table, format = true, cols = nil)\n \n # Apply column filter\n unless cols.nil?\n \n headings = cols.split(\",\").to_set\n \n cols_to_delete = [ ]\n i = 0\n table[0].each do |col|\n cols_to_delete << i unless headings.include?(col)\n i = i + 1\n end\n \n table.each do |row|\n cols_to_delete.reverse_each { |j| row.delete_at(j) }\n end\n end\n \n if format\n \n # Calculate widths\n widths = []\n table.each do |line|\n c = 0\n line.each do |col|\n \n len = col.nil? ? 0 : col.length\n widths[c] = (widths[c] && widths[c] > len) ? widths[c] : len\n c += 1\n end\n end\n \n max_scr_cols = HighLine::SystemExtensions.terminal_size[0].nil? ? 9999 \n : HighLine::SystemExtensions.terminal_size[0] - (widths.length * 3) - 2\n \n max_tbl_cols = 0\n width_map = {}\n \n c = 0\n widths.each do |n| \n max_tbl_cols += n\n width_map[c] = n\n c += 1\n end\n c = nil\n \n # Shrink columns that have too much space to try and fit table into visible console\n if max_tbl_cols > max_scr_cols\n \n width_map = width_map.sort_by { |col,width| -width }\n \n last_col = widths.length - 1\n c = 0\n \n while max_tbl_cols > max_scr_cols && c < last_col\n \n while width_map[c][1] > width_map[c + 1][1]\n \n i = c\n while i >= 0\n width_map[i][1] -= 1\n widths[width_map[i][0]] -= 1\n max_tbl_cols -= 1\n i -= 1\n \n break if max_tbl_cols == max_scr_cols\n end\n break if max_tbl_cols == max_scr_cols\n end\n c += 1\n end\n end\n \n border1 = \"\"\n border2 = \"\"\n format = \"\"\n widths.each do |n|\n \n border1 += \"+#{'-' * (n + 2)}\"\n border2 += \"+#{'=' * (n + 2)}\"\n format += \"| %#{n}s \"\n end\n border1 += \"+\\n\"\n border2 += \"+\\n\"\n format += \"|\\n\"\n \n else\n c = nil\n border1 = nil\n border2 = nil\n \n format = Array.new(table[0].size, \"%s,\").join.chop! + \"\\n\"\n \n # Delete column headings for unformatted output\n table.delete_at(0)\n end\n \n # Print each line.\n write_header_border = !border2.nil?\n printf border1 if border1\n table.each do |line|\n \n if c\n # Check if cell needs to be truncated\n i = 0\n while i < c\n \n j = width_map[i][0]\n width = width_map[i][1]\n \n cell = line[j]\n len = cell.length\n if len > width\n line[j] = cell[0, width - 2] + \"..\"\n end\n i += 1\n end\n end\n \n printf format, *line\n if write_header_border\n printf border2\n write_header_border = false\n end\n end\n printf border1 if border1\n\n end", "def format(id, value, options = {})\n id.split(/,\\s/).each do |i|\n col = col_by_id i, true\n col.format = value\n col.format_options = options\n end\n end", "def csv_headers\n raise NotImplementedError\n end", "def separator(type)\n return \"\" if @options[:use_hidden]\n\n case type\n when :year, :month, :day\n @options[:\"discard_#{type}\"] ? \"\" : @options[:date_separator]\n when :hour\n (@options[:discard_year] && @options[:discard_day]) ? \"\" : @options[:datetime_separator]\n when :minute, :second\n @options[:\"discard_#{type}\"] ? \"\" : @options[:time_separator]\n end\n end", "def fmt(*spec)\n ::Col::Formatter.new(@strings, *spec).result\n end", "def open_csv(table)\n command = \"mdb-export -bstrip -D '%F %T' -d #{Shellwords.escape(delimiter)} #{file_name} #{table}\"\n Open3.popen3(command) do |stdin, stdout, stderr|\n yield CSV.new(stdout, col_sep: delimiter)\n end\n end", "def prepared_columns(cols)\n RUBY_VERSION >= '1.9' ? cols.sort : cols.sort_by(&:to_s)\n end", "def find_delim_filename(delim_type, other_char, suffix = '')\n if delim_type == 'comma'\n filename = params[:model] + params[:id] + suffix + '.csv'\n delimiter = ','\n elsif delim_type == 'space'\n filename = params[:model] + params[:id] + suffix + '.csv'\n delimiter = ' '\n elsif delim_type == 'tab'\n filename = params[:model] + params[:id] + suffix + '.csv'\n delimiter = \"\\t\"\n elsif delim_type == 'other'\n filename = params[:model] + params[:id] + suffix + '.csv'\n delimiter = other_char\n end\n [filename, delimiter]\n end", "def initialize(delimited, cleanse_header: true, **args)\n @tabular = IOStreams::Tabular.new(**args)\n @delimited = delimited\n @cleanse_header = cleanse_header\n end", "def delimiter(*deprecated, with_spacing: deprecated.first)\n if with_spacing\n hash_rocket? ? SPACED_HASH_ROCKET : SPACED_COLON\n else\n hash_rocket? ? HASH_ROCKET : COLON\n end\n end", "def quote_column_if_needed(column); end", "def init_separator(hash) end", "def column_print(things, color=:white)\n # return unless things.any?\n # sizes = things.map{|x|x.size}\n # col_width = sizes.max\n # cols = 80 / (col_width+3)\n # cols = 4 if cols > 4\n \n # if things.size % cols != 0\n # things += [''] * (cols - (things.size % cols))\n # end\n \n # things.map!{|thing| thing.ljust(col_width)}\n \n # things.each_slice(cols) do |slice|\n # puts slice.join(' | ').send(color)\n # end\n puts Term::Table.new(things).to_s.send(color)\n end", "def read_to_separator(sep)\n return if @ibuffer.exhausted?\n return read_all unless sep\n\n sep = StringValue sep if sep\n\n if sep.empty?\n sep = \"\\n\\n\"\n skip = ?\\n\n else\n skip = nil\n end\n\n line = nil\n until @ibuffer.exhausted?\n @ibuffer.fill_from self, skip\n\n if count = @ibuffer.find(sep)\n str = @ibuffer.shift(count)\n else\n str = @ibuffer.shift\n end\n\n if line\n line << str\n else\n line = str\n end\n\n break if count\n end\n\n @ibuffer.discard skip if skip\n\n line unless line.empty?\n end", "def tab\n write(9)\n end", "def separator\n @parts.push(separator: true)\n end", "def pp_table(headers, rows)\n if headers.empty? || rows.empty?\n return\n end\n puts headers.map { |h| \"%20s\" % h.upcase }.join\n rows.map { |cols| puts cols.map { |c| \"%20s\" % c }.join }\n #puts \"=\" * 80\nend", "def initialize\n @col_specs = []\n end", "def partial_table(ary, sep=',')\n indexes = []\n res = \"\"\n ary.each_with_index do |field, i|\n idx = @ocp_solution[:headers].find_index(field)\n if idx then\n indexes << idx\n else\n ary.delete_at i\n end\n end\n res << ary.join(sep) + \"\\n\"\n self.length.times do |i|\n res << indexes.inject([]) {|a,e| a << @ocp_solution[:data][e][i] }.join(sep) + \"\\n\"\n end\n return res\n end", "def to_csv\n str = ''\n str << ( columns.join(\",\") + \"\\n\" )\n rows.each { |row|\n next if is_hr(row) || !row_visible(row)\n str << ( row.map{|x|\n x = x.to_s\n x.gsub(/[\\r\\n]/, ' ').gsub(/\\s+/, ' ').gsub('\"', '\"\"')\n }.map{|x| \"\\\"#{x}\\\"\" }.join(\",\") + \"\\n\" )\n }\n str\n end" ]
[ "0.6970018", "0.6388686", "0.62479013", "0.6184085", "0.6139423", "0.5829134", "0.5769928", "0.5621162", "0.55923843", "0.55665153", "0.5524647", "0.5524647", "0.5511199", "0.54739165", "0.5443303", "0.5441824", "0.5419624", "0.5381819", "0.5347192", "0.5283784", "0.5271689", "0.52580154", "0.52471656", "0.52382934", "0.5211408", "0.5203762", "0.5203762", "0.5199577", "0.51987576", "0.51987576", "0.5193387", "0.5193058", "0.5176549", "0.5172034", "0.51682", "0.5083886", "0.5048671", "0.5042598", "0.49988964", "0.49928403", "0.49923456", "0.49877673", "0.49843252", "0.4949925", "0.4937252", "0.49148163", "0.4877429", "0.486982", "0.486982", "0.4807682", "0.48044667", "0.47916466", "0.47518018", "0.47419173", "0.47292513", "0.4722827", "0.47219676", "0.47141454", "0.47091192", "0.46994528", "0.46803424", "0.4677438", "0.46703833", "0.46588415", "0.46446928", "0.46435627", "0.4635105", "0.46157423", "0.46044487", "0.4591388", "0.4591388", "0.45904192", "0.45661226", "0.45611042", "0.45587292", "0.45550698", "0.4536387", "0.4533592", "0.45101744", "0.45074812", "0.4500077", "0.4495539", "0.44895357", "0.44875643", "0.44868073", "0.4475085", "0.44749033", "0.44693992", "0.4458535", "0.44541132", "0.4446988", "0.44467345", "0.44341052", "0.44058174", "0.44053012", "0.43994373", "0.4399227", "0.43866554", "0.43852028", "0.4384676" ]
0.52619666
21
Yield a row hash to the block with downcased, symbolized keys.
def each(&block) file_handle.each do |line| yield headers.zip(line.chomp!.split(col_sep, -1)).to_h end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symbolize_row_keys(row)\n out = {} # move to a real hash!\n row.each do |key, value|\n out[key.to_sym] = value.respond_to?(:wrapper) ? value.wrapper : value\n end\n out\n end", "def transform_keys(&block); end", "def transform_keys!(&block); end", "def original_key(row)\n end", "def each_hash\n if block_given?\n while row = next_hash\n yield row\n end\n else\n self.enum_for(:each_hash)\n end\n end", "def each\n return unless @result\n\n @result.each(as: :hash, symbolize_keys: true) do |row|\n next unless row # This sometimes happens when streaming results...\n row = Hash[row.map { |k, v| [k, v.to_s] }] if @type_translation == :string\n yield row\n end\n end", "def each_pair(&block)\n\t\t@name_table.each do |k|\n\t\t\tblock.call(k, self.v[k])\n\t\tend\n\tend", "def normalize_row(row)\n Hash[row.map{|column_name, row_value| [column_name.parameterize.underscore.to_sym, row_value.to_s]}]\n end", "def each_key\n return enum_for(__method__) unless block_given?\n @raw.each_key do |key|\n yield key\n end\n self\n end", "def each_record(table, &block)\n columns = nil\n read_each(table) do |line|\n if columns\n yield Hash[columns.zip(line)]\n else\n columns = line.map(&:to_sym)\n end\n end\n end", "def symbolize_keys!(hash)\n map_keys!(hash, Transproc(:to_symbol).fn)\n end", "def deep_transform_keys(&block); end", "def symbolize_hash_keys(hash); end", "def deep_symbolize(hsh, &block)\n hsh.inject({}) do |result, (key, value)|\n # Recursively deep-symbolize subhashes\n value = deep_symbolize(value, &block) if value.is_a? Hash\n # Recursively deep-symbolize subarrays\n value = deep_symbolize_array(value, &block) if value.is_a? Array\n\n # Pre-process the key with a block if it was given\n key = yield key if block_given?\n # Symbolize the key string if it responds to to_sym\n sym_key = key.to_sym rescue key\n\n # write it back into the result and return the updated hash\n result[sym_key] = value\n result\n end\n end", "def each_key_unsorted\n @records.each {|k,v| yield k}\n end", "def modify_keys\n each_with_object self.class.new do |hash_pair, hsh|\n hsh[ yield( hash_pair ) ] = self[ hash_pair[0] ]\n end\n end", "def lookup_keys(&blk)\n yield name\n yield name.upcase\n yield name.downcase\n yield methodized_name\n yield methodized_name.to_sym\n yield constantized_name\n yield constantized_name.to_sym\n end", "def symbolize_keys!(hash)\n transform_keys!(hash){ |key| key.to_sym rescue key }\n end", "def symbolize_keys; end", "def symbolize_keys!; self end", "def transform_keys!(hash)\n return enum_for(:transform_keys!, hash) unless block_given?\n hash.keys.each do |key|\n hash[yield(key)] = hash.delete(key)\n end\n hash\n end", "def row_to_hsh(row)\n h = Hash[@headers.zip(row)]\n h.symbolize_keys\n end", "def symbolize_keys!\r\n self.replace(self.symbolize_keys)\r\n end", "def symbolize_keys!\n replace(self.symbolize_keys)\n end", "def symbolize_keys!\n replace symbolize_keys\n end", "def each_key(&block); end", "def deep_transform_keys!(&block); end", "def generate_row_key link\n # rowkey is 'md5_hashed_link'\n d = Digest::MD5.new\n d.hexdigest link\nend", "def symbolize_keys hsh\n new_hsh = Hash.new\n\n hsh.each_pair do |k,v|\n v = symbolize_keys v if v.is_a?(Hash)\n new_hsh[k.downcase.to_sym] = v\n end\n\n new_hsh\n end", "def yield_hash_rows(res, cols)\n res.ntuples.times do |recnum|\n converted_rec = {}\n cols.each do |fieldnum, type_proc, fieldsym|\n value = res.getvalue(recnum, fieldnum)\n converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value\n end\n yield converted_rec\n end\n end", "def yield_hash_rows(res, cols)\n res.ntuples.times do |recnum|\n converted_rec = {}\n cols.each do |fieldnum, type_proc, fieldsym|\n value = res.getvalue(recnum, fieldnum)\n converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value\n end\n yield converted_rec\n end\n end", "def row_hash(row)\n Hash[raw_headers.zip(row)].with_indifferent_access\n end", "def each(&block)\n list = []\n self.keys.sort.each do |sidx|\n list << [sidx, self[sidx]]\n end\n list.each(&block)\n end", "def each(&block)\n list = []\n self.keys.sort.each do |sidx|\n list << [sidx, self[sidx]]\n end\n list.each(&block)\n end", "def each(&block)\n list = []\n self.keys.sort.each do |sidx|\n list << [sidx, self[sidx]]\n end\n list.each(&block)\n end", "def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end", "def sort_by!\n return to_enum unless block_given?\n @rownames = Hash[*@rownames.sort_by.with_index do |(rowname, i), rowid| [yield(Row.new(self, rowid, @rows[i])), rowid] end.flatten(1)]\n self\n end", "def symbolize_keys!\n self.replace(self.symbolize_keys)\n end", "def symbolize_keys!\n self.replace(self.symbolize_keys)\n end", "def symbolize_keys!\n self.replace(self.symbolize_keys)\n end", "def symbolize_keys!\n self.replace(self.symbolize_keys)\n end", "def symbolize_keys!\n self.replace(self.symbolize_keys)\n end", "def symbolize_keys!\n self.replace(self.symbolize_keys)\n end", "def downcase_keys\n end", "def symbolize_all_keys!\n self.keys.map do |key|\n if self[key].is_a? Hash\n self[key].symbolize_all_keys!\n elsif self[key].is_a? Array\n # Find hashes to sort in the array.\n self[key].each do |v|\n v.symbolize_all_keys! if v.is_a? Hash\n end\n end\n self[key.to_sym] = self.delete(key)\n end\n self\n end", "def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end", "def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end", "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "def symbolize_keys!\n self.class.symbolize_keys(self)\n end", "def deep_symbolize_keys!(hash)\n deep_transform_keys!(hash){ |key| key.to_sym rescue key }\n end", "def symbolize_keys\n dup.symbolize_keys!\n end", "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "def symbolize\n return nil if self.nil?\n self.keys.each do |key|\n self[(key.to_sym rescue key) || key] = self.delete(key)\n end\n end", "def symbolize_keys\n transform_keys { |key| key.to_sym rescue key }\n end", "def symbolize_keys\n transform_keys { |key| key.to_sym rescue key }\n end", "def deep_transform_keys(&block)\n _deep_transform_keys_in_object(self, &block)\n end", "def deep_transform_keys(&block)\n _deep_transform_keys_in_object(self, &block)\n end", "def transform_keys(&block)\n @key_transformer = block\n end", "def rubyize_keys\n transform_keys do |key|\n key\n .to_s\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .downcase\n .to_sym\n end\n end", "def _each\n Engine.new(local_copy.encoded_io, csv_options.merge(headers: headers)).each do |row|\n\n some_value_present = false\n\n if not headers\n\n # represent the row as an array\n array = row.map do |v|\n v = RemoteTable.normalize_whitespace v\n if not some_value_present and not keep_blank_rows and v.present?\n some_value_present = true\n end\n v\n end\n if some_value_present or keep_blank_rows\n yield array\n end\n\n else\n\n # represent the row as a hash\n hash = ::ActiveSupport::OrderedHash.new\n row.each do |k, v|\n v = RemoteTable.normalize_whitespace v\n if not some_value_present and not keep_blank_rows and v.present?\n some_value_present = true\n end\n hash[k] = v\n end\n if some_value_present or keep_blank_rows\n yield hash\n end\n\n end\n end\n ensure\n local_copy.cleanup\n end", "def symbolize_keys\n each_with_object({}) { |(k, v), hsh| hsh[k.to_sym] = v.is_a?(Hash) ? v.symbolize_keys : v }\n end", "def symbolize_keys!\n transform_keys! { |key| key.to_sym rescue key }\n end", "def symbolize_keys!\n transform_keys! { |key| key.to_sym rescue key }\n end", "def symbolize_keys!\n transform_keys! { |key| key.to_sym rescue key }\n end", "def remap\n # This is Ruby magic for turning a hash into an array into a hash again\n Hash[*self.map do |key, value|\n yield key, value\n end.compact.flatten]\n end", "def key_iterator\n HashTableIterator.new(@table, false)\n end", "def symbolize_keys(hash)\n hash.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo }\n end", "def hashes(with_table=false, &block)\n rows = []\n self.each_hash(with_table) do |row|\n rows << ((block) ? yield(row) : row)\n end\n rows\n end", "def symbolize_keys!(hash)\n new_hash = hash.inject({}){ |memo, (k, v)|\n memo[k.to_sym] = v\n if v.class.eql? ::Hash\n memo[k.to_sym] = symbolize_keys! v\n elsif v.class.eql? ::Array\n memo[k.to_sym] = symbolize_keys_of_hashs! v\n end\n memo\n }\n hash.replace new_hash\n end", "def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def symbolize_keys_of_hashs(array_of_hashs)\n array_of_hashs.collect{|hash| symbolize_keys(hash)}\n end", "def symbolize\n convert do|k, v|\n [k.to_sym, v]\n end\n end", "def hash\n swap\n scatter\n completed_string\n end", "def hash\n rows.hash\n end", "def symbolize_keys_of_hashs!(array_of_hashs)\n array_of_hashs.collect!{|hash| symbolize_keys(hash)}\n end", "def symbolize_keys_of(hash)\n hash2 = {}\n hash.each {|k,v| hash2[k.to_sym] = v}\n hash2\n end", "def kv_table(table)\n transform_table!(table).rows_hash\nend", "def deep_transform_keys!(hash, &block)\n _deep_transform_keys_in_object!(hash, &block)\n end", "def symbolize_keys(hash)\r\n target = hash.dup\r\n\r\n target.keys.each do |key|\r\n value = target.delete(key)\r\n if value.is_a? Hash\r\n value = symbolize_keys(value)\r\n end\r\n target[(key.to_sym rescue key) || key] = value\r\n end\r\n\r\n target\r\n end", "def symbolize(h)\n sym = {}\n h.each do |key, val|\n nk = key.respond_to?(:intern) ? key.intern : key\n sym[nk] = val\n end\n sym\n end", "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "def deep_transform_keys!(&block)\n _deep_transform_keys_in_object!(self, &block)\n end", "def with_keys\n keys.each_with_object self.class.new do |hash_key, hsh|\n hsh[ yield hash_key ] = self[ hash_key ]\n end\n end", "def downcase_keys\n dup.downcase_keys!\n end", "def each_row\n @rows_processed = 0\n @data.each do |h|\n h = h.clone\n transform_row!(h)\n yield h\n @rows_processed += 1\n end\n end", "def symbolize! hash\n hash.symbolize_keys!\n hash.values.select{|v| v.is_a? Hash}.each{|h| symbolize!(h)}\n end", "def flatten_keys(hash)\n hash.transform_keys(&:downcase).transform_keys(&:to_sym)\n end", "def symbolize_keys(hash)\n h = hash.dup\n h.keys.each do |key|\n h[(key.to_sym rescue key) || key] = h.delete(key)\n end\n h\n end", "def each\n\t\t @table.each do |pair, bigram|\n yield(bigram)\n\t\t end\n\t\t end", "def each &block\n db.iterinit\n loop do\n key = db.iternext or break\n val = db[key]\n yield key, val\n end\n end", "def deep_symbolize_keys\n deep_transform_keys{ |key| key.to_sym rescue key }\n end", "def symbolize_keys_recursively!(object); end", "def recursively_symbolize_keys\n recursively_transform_keys { |key| key.to_sym rescue key }\n end", "def _each\n delete_harmful!\n convert_eol_to_unix!\n transliterate_whole_file_to_utf8!\n skip_rows!\n\n Engine.new(local_copy.encoded_io, csv_options).each do |row|\n\n some_value_present = false\n\n if not headers\n\n # represent the row as an array\n array = row.map do |v|\n v = v.to_s\n if not some_value_present and not keep_blank_rows and v.present?\n some_value_present = true\n end\n v\n end\n if some_value_present or keep_blank_rows\n yield array\n end\n\n else\n\n # represent the row as a hash\n hash = ::ActiveSupport::OrderedHash.new\n row.each do |k, v|\n next unless k.present?\n v = v.to_s\n if not some_value_present and not keep_blank_rows and v.present?\n some_value_present = true\n end\n hash[k] = v\n end\n if some_value_present or keep_blank_rows\n yield hash\n end\n\n end\n end\n ensure\n local_copy.cleanup\n end", "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "def yale_row_as_hash i\n h = yale_nd_row(i, :hash)\n return h if i >= self.shape[1] || self[i,i].nil? || self[i,i] == 0\n h[i] = self[i,i]\n end", "def symbolize_hash_keys(object)\n symbolize_proc = proc(&:to_sym)\n apply_key_mutator(object, symbolize_proc)\n end" ]
[ "0.6754146", "0.6410834", "0.6283506", "0.59390783", "0.586868", "0.57941985", "0.5742961", "0.5698274", "0.5687866", "0.5680889", "0.5680785", "0.5652306", "0.56265527", "0.5626004", "0.5620631", "0.5613742", "0.5602242", "0.55947286", "0.5590994", "0.5589195", "0.5585393", "0.5574493", "0.55709344", "0.5567344", "0.55574185", "0.55221957", "0.55167824", "0.5500078", "0.54878837", "0.5478714", "0.5478714", "0.54584384", "0.5456096", "0.5456096", "0.5456096", "0.54430044", "0.54179585", "0.54102516", "0.54102516", "0.54102516", "0.54102516", "0.54102516", "0.54102516", "0.5392737", "0.53559864", "0.5334356", "0.5334356", "0.5326562", "0.5320918", "0.53115547", "0.5298294", "0.529501", "0.52946633", "0.5289678", "0.5289678", "0.5288992", "0.5288992", "0.5287051", "0.5285915", "0.52854776", "0.52799165", "0.52754116", "0.52754116", "0.52754116", "0.5271752", "0.52707225", "0.5268883", "0.52664274", "0.5266175", "0.52623695", "0.52602947", "0.52602947", "0.5253531", "0.52525043", "0.52493864", "0.52480876", "0.5233904", "0.52284354", "0.52263707", "0.52263206", "0.5219132", "0.5217957", "0.5210864", "0.5210864", "0.5210864", "0.5210864", "0.52035546", "0.519397", "0.51921904", "0.5176493", "0.51731837", "0.5165673", "0.5163873", "0.5163462", "0.51576215", "0.5147681", "0.5145918", "0.5145326", "0.51355046", "0.5133814", "0.51280415" ]
0.0
-1
Faster implementation of count. Instead of parsing the whole file with Ruby, shell out to `wc l` to get the line count less the header row.
def count `wc -l < #{filepath}`.to_i - 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_count(file_list)\n file_list.empty? ?\n nil :\n %x{wc -l #{file_list.join(' ')} | awk 'END {print $1}'}.to_i\n end", "def total_count(file)\n file_obj = File.new(file,'r')\n file_obj.readlines.size\n end", "def file_line_count(file_name)\n line_count = `wc -l < #{file_name}`.to_i\n LoggerHelper.print_to_log(\"Count of lines in '#{file_name}' is #{line_count}\")\n line_count\n end", "def linecount(fname)\n File.open(fname, \"r\") do |f|\n f.readlines.length\n end\nend", "def count_lines(file)\n n = 0\n while file.gets\n n += 1\n end\n n\n end", "def n_lines(filename)\n File.foreach(filename).reduce(0) { |acc, _elem| acc + 1 }\n end", "def count_lines()\n start_time = Time.now\n @file_lines = 0 \n last_block_position = 0\n prev_block_position = -1\n Rula.log(Logger::DEBUG,\"Reading file #{@filename} lines count\",self)\n file_handle = File.open(@filename,'rb')\n while data = file_handle.read(@@BLOCK_SIZE)\n original_size = data.length\n last_occurence = data.rindex(Rula.options[:line_separator])\n difference_in_size = original_size - last_occurence\n\n if data.length==1 then\n break\n end\n\n if !last_occurence.nil? then\n data = data[0..last_occurence]\n file_handle.pos -= difference_in_size\n end\n @file_lines += data.scan(/([^|#{Rula.options[:line_separator]}].*)#{Rula.options[:line_separator]}/).length\n \n (0...@@BUFFERS).each {|i| \n @buffers[i].add_hash(last_block_position, prev_block_position, file_handle.pos, @file_lines)\n }\n prev_block_position = last_block_position \n last_block_position = file_handle.pos\n end\n Rula.log(Logger::DEBUG,\"Counted #{@file_lines} lines for file #{@filename}\",self)\n ensure\n Rula.log(Logger::DEBUG,\"Counting lines ran #{(Time.now - start_time) * 1000} ms\",self)\n file_handle.close()\n load_buffer_data(0)\n end", "def line_count(file)\n\t\tf = File.new(file)\n\t\tnum_newlines = 0\n\t\twhile (c = f.getc) != nil\n\t\t\tnum_newlines += 1 if c == $/\n\t\tend\n\t\tnum_newlines\n\tend", "def count_lines(all_lines_from_file)\n all_lines_from_file.lines.count\nend", "def line_count\n entries.inject(0) do |count, entry|\n count + (entry.dir? ? 0 : entry.lines.size)\n end\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 lines_counter\n f = File.open('peliculas.txt', 'r')\n print f.readlines.length\n f.close\nend", "def n_lines(filename); end", "def line_count\n\t\tlines.size\n\tend", "def line_count\n\t\tlines.size\n\tend", "def word_count_a_file(file_path)\n word_count = 0\n f = File.open(file_path, \"r\")\n f.each_line {|line|\n word_count += line.to_s.split.size\n }\n word_count\nend", "def line_count\n `wc -l public/HelloWorld.txt`.to_i\n end", "def word_count(all_lines_from_file)\n all_lines_from_file.split.length\nend", "def count_total_lines files\n files.each do |f, k|\n lines_output = `wc -l #{f.to_s}`\n if $? != 0 then\n raise 'Error in counting total lines.'\n end\n lines_count = lines_output.strip.split(' ')[0].to_i\n k['total_lines'] = lines_count\n end\n return files\n end", "def word_count_a_file(file_path)\n\tfile = File.new(file_path,'r')\n\tfile.read.count(\" \")+1 \nend", "def word_count_a_file(file_path)\n total = 0\n file = File.new(file_path, \"r\")\n file.readlines.each do |x|\n total += x.split.size\n end\n total\nend", "def countlines\n file = File.open('peliculas.txt', 'r')\n data = file.readlines\n file.close\n puts data.length\nend", "def flay_count filename\n count = `flay #{filename}|grep #{filename}|wc -l`\n return count.chomp.to_i\n end", "def wc(filename)\n input = File.open(filename, 'r') {|f| f.read() }\n puts(\"%d lines\" % [input.each_line.count])\n puts(\"%d words\" % [input.split(' ').count])\n puts(\"%d chars\" % [input.split('').count])\nend", "def paragraph_count(all_lines_from_file)\n all_lines_from_file.split(/\\n\\n/).length\nend", "def get_file_lines_of_code!(f)\n count = 0;\n File.foreach(f) {count+=1}\n #print(\"#{count}\")\n count\n end", "def count_characters(all_lines_from_file)\n all_lines_from_file.gsub(/\\n+/,\"\").length\nend", "def count\n Jhead.call(\"-c\", @match, @pattern).split(\"\\n\").size\n end", "def word_count_a_file(file_path)\n IO.read(file_path).split.length\nend", "def file_statistics(filename)\n line_count = 0; loc_count = 0;\n \n File.new(filename, 'r').each_line do |line|\n line.strip!\n line_count += 1\n \n # don't count blank lines or comment lines in LOC\n loc_count += 1 if line.gsub(/[\\/\\*\\s]/i, \"\").length > 1 && line.match(/^\\/\\//).nil?\n end\n \n {:line_count => line_count, :loc_count => loc_count}\n end", "def find_number_of_rows\n row_array = []\n CSV.foreach('testdata.csv', {headers: true}) {|row| row_array << row[1]} \n row_array.uniq.size\nend", "def num_lines() @line_indices.length + 1 end", "def count_characters_no_spaces(all_lines_from_file)\n all_lines_from_file.gsub(/\\s+/, \"\").length\nend", "def word_count_a_file(file_path)\n File.read(file_path).split(' ').length\n # had to create the file, text taken from https://www.lipsum.com/feed/html\nend", "def trailing_count\n repository.files.map do |path|\n file = repository.read(path)\n\n if file\n file.lines.map do |line|\n line.scan(/[ \\t]+$/).size\n end.sum\n else\n 0\n end\n end.sum\n end", "def check_csv(db,tbl)\n csv = \"/opt/tucdocs/MDB/#{db}_#{tbl}.csv\"\n puts \"csv: #{csv}\"\n num_csv = %x! wc -l #{csv} !.chomp.to_s.to_i\nend", "def count_lines(dir, excludes)\n\n\tfiles = Dir[dir + '/**/*.{c,cpp,h}']\n\tlines = 0\n\tfor f in files \n\t\tnext if exclude?(excludes, f)\n\t\tn = 0\n\t\tFile.new(f, \"r\").each { n += 1 }\n\t\tputs \"#{f} #{n}\" if $print_files\n\t\tlines += n\n\tend\n\n\treturn lines\nend", "def file_count(path, ext = 'scss')\n file_list(path, ext).length\n end", "def count_paragraphs(some_file)\n file_content = open(some_file).read()\n count = 0\n file_content_split = file_content.split('')\n\n file_content_split.each_index do |index|\n count += 1 if file_content_split[index] == \"\\n\" && file_content_split[index + 1] == \"\\n\"\n end\n return count\nend", "def lines\n repository.files.map do |file|\n repository.read(file).to_s.lines.count\n end.sum\n end", "def total_lines(csv_file_name,rb='rb',options={})\n\t\tf = CSV.open(csv_file_name, rb, {}.merge(options))\n\t\ttotal_lines = f.readlines.size # includes header, but so does f.lineno\n\t\tf.close\n\t\ttotal_lines\n\tend", "def line_count\n\t\t\treturn @contents.nil? ? 0 : @contents.count\n\t\tend", "def lines_count(str)\n i = 0\n str.each_line { i += 1 }\n i\n end", "def size_in_lines(filepath)\n f = File.new(filepath)\n f.readlines[-1]\n count = f.lineno.to_s\n puts \"The link check report contains #{count} lines.\".blue\n puts \"To see the report, open the #{filepath} file.\".blue\n end", "def line_number\n lines_read.length\n end", "def count_chars(file)\n\tch_arr = Hash.new\n\tfile.each_line { |line|\n\t\tline.each_char { |c|\n\t\t\tif(ch_arr[c] == nil)\n\t\t\t\tch_arr[c] = 1\n\t\t\telse\n\t\t\t\tch_arr[c] += 1\n\t\t\tend\n\t\t}\n\t}\n\treturn ch_arr\nend", "def find_number_of_columns\n column_array = []\n CSV.foreach('testdata.csv', {headers: true}) {|row| column_array << row[0]}\n column_array.uniq.size\nend", "def num_open_cells(file)\n open_cells = 0\n\n while line = file.gets \n if line == nil then return end\n\n if line[0...4] != \"path\"\n x, y, ds, w = line.split(/\\s/,4)\n ds = ds.chars\n if(ds.length() == 4)\n open_cells+=1\n end\n end\n end\n return open_cells\nend", "def hard(input)\n input.map { |line| line.dump.length - line.length }.sum\nend", "def count_pbars(fn)\n\n blin = 0;\n nev = 0;\n\n for l in File.readlines(fn)\n w = l.split(' ')\n nw = w.length\n\n if (blin == 0) then \n if (w[0] == 'ProductPrint') and (w[1].index('mu2e::StepPointMCs_muonBeamFilter_Coll31OutRecord') != nil) then\n blin = 1\n end\n else\n if (nw == 11) and (w[10] == 'Transportation') then\n if (w[1] == '100001') then nev += 1 end\n blin = 0\n end\n end\n end\n\n puts \"nev = #{nev}\"\nend", "def find_number_lines(opened_file)\n start_time = Time.now.to_i\n total_file_lines = opened_file.each_line.inject(0) { |total, _amount| total + 1 }\n opened_file.rewind\n if Rails.env.development?\n end_time = Time.now.to_i\n puts(\"1. Lines ==> #{total_file_lines} in #{((end_time - start_time) / 60).round(2)}\")\n end\n total_file_lines\n end", "def headerRowCount\n self.fetch(:headerRowCount, self.header ? 1 : 0)\n end", "def count\n cnt = 0\n begin\n if block_given?\n scanner = htable.getScanner(filtered_scan)\n scanner.each do |result|\n cnt += 1 if yield(Result.send(:new, result))\n end\n else\n scanner = htable.getScanner(filtered_scan_minimum)\n scanner.each { cnt += 1 }\n end\n ensure\n scanner.close if scanner\n end\n cnt\n end", "def num_matches_in_file(fname, match_regexp)\n\n num_lines_per_batch = 5000\n\n num_matched = 0\n\n if File.exist? fname\n File.open(fname, \"r\") do |f|\n\n # use an enumerator to read just (num_lines_per_batch) lines at a time\n f.lazy.each_slice(num_lines_per_batch) do |lines|\n\n num_matched += lines.select { |line| line.match(match_regexp) }.count\n\n end\n\n end\n else\n num_matched = 0\n end\n\n num_matched\n end", "def word_count(file)\n wc = Hash.new(0)\n File.open(file, 'r') do |f|\n f.each_line do |line|\n line.split.each do |word|\n word = word.gsub(/[^a-zA-Z]/, '').downcase\n wc[word.to_sym] += 1\n end\n end\n end\n wc\nend", "def lines_count\n @lines_count ||= lines.count\nend", "def word_count_a_file(file_path)\nend", "def count\n\t\t@input_ary.each_with_index { |line,i|\n\t\t\tif line =~ /^COUNT=([0-9]*)\\s*/\n\t\t\t\t@fileinfo[:count] = $1.to_i \n\t\t\t\tat = i+1\n\t\t\tend\n\t\t}\n\t\traise DTA_ReaderErr, \"Cannot define number of elements!\" unless @fileinfo[:count]\n\t\traise DTA_ReaderErr, \"Error parsing elements count :: #{@input_file}:#{at} :: COUNT=\" + $1.inspect if @fileinfo[:count] == 0\n\tend", "def sentence_count(all_lines_from_file)\n all_lines_from_file.split(/\\.|\\?|\\!/).length\nend", "def num_lines\n load_data unless @num_lines\n @num_lines\n end", "def contar_lineas\n line = read_alumnos\n contador = line.count\n contador\nend", "def counts_one_line(array)\n array.each_with_object(hello = Hash.new(0)) {|x, counts| counts[x] += 1}\n hello\nend", "def size_fil_header\n 4 + 4 + 4 + 4 + 8 + 2 + 8 + 4\n end", "def getNumLines()\n contents.split(\"\\n\").length - 1\n end", "def total_count()\n @raw_data.size\n end", "def count(line)\n\t\tpos = 0\n\t\twhile (pos < line.length)\n\t\t\t# if marker, decompress and count length\n\t\t\t# else add 1 to length, for normal character\n\t\t\tif line[pos] == \"(\"\n\t\t\t\t# substring containing only the marker\n\t\t\t\tmarker = line[pos, line[pos, line.length - pos].index(\")\") + 1]\n\t\t\t\tlen = marker[/(?<=\\()\\d+/].to_i\n\t\t\t\trepeat = marker[/\\d+\\)$/].to_i\n\t\t\t\t@length += repeat * len\n\n\t\t\t\t# move pos onto next piece of data\n\t\t\t\tpos += marker.length + len\n\t\t\telse\n\t\t\t\t@length += 1\n\t\t\t\tpos += 1\n\t\t\tend\n\t\tend\n\tend", "def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end", "def file_count(dir_path)\n Dir.entries(dir_path).count - 2\n end", "def num_commits(lines)\n numCommits = 0\n lines.each{ |line| numCommits += 1 if line.start_with?(\"commit \") }\n return numCommits\nend", "def ruby_lines\n repository.files(:pattern => /.rb/).map do |file|\n repository.read(file).to_s.lines.count\n end.sum\n end", "def comma_count\n text = @file.content\n text.count(\",\")\n end", "def cpu_count\n File.read(\"/proc/cpuinfo\").split(\"\\n\").count { |s| s.start_with?(\"processor\\t:\") }\n end", "def number_of_lines_in_first_chunk\n end_method_line = last_method_source_location.last\n\n end_method_line - line\n end", "def num_commits(lines)\n num = 0 \n lines.each { |line|\n words = line.split\n if words[0] == \"commit\" then num+= 1 end\n }\n num\nend", "def count_rows(s)\n return nil if s.nil?\n\n col = 1\n row = 1\n\n s.each_char do |c|\n if c == \"\\n\" or col > TA_COLS then\n col = 1\n row += 1\n next\n end\n\n col += 1\n end\n\n row\n end", "def count(chr = nil, start = nil, stop = nil)\n num = 0\n self.each(chr, start, stop) { |entry| num += 1 }\n return num\n end", "def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end", "def cpu_count\n File.read(\"/proc/cpuinfo\").split(\"\\n\").select { |s| s.start_with?(\"processor\\t:\") }.size\n end", "def num_commits(lines)\n i = 0\n\tlines.each{|line| \n\t\tif line.include? \"commit\"\n\t\t\ti += 1\n\t\tend\n\t}\n\treturn i\nend", "def preview_output path\n puts `head #{path}`\n\n last_columns = []\n open(path) do |csv|\n csv.each_line do |line|\n last_columns.push(line.split(',').last.strip)\n end\n end\n p Hash[last_columns.sort.group_by {|x| x}.map {|k,v| [k,v.count]}]\nend", "def hash_number(line)\n\n count = 0\n\n line.each_char do |char|\n break if char != \"#\"\n count += 1\n end\n # cases when text starts with #haha instead of # haha\n if count != 0\n if line[count] == ' '\n count\n else\n 0\n end\n else\n count\n end\nend", "def count_with_file(filename)\n return if ::ServiceMock.disable_stubs\n yield self if block_given?\n content = File.open(filename, 'rb') { |file| file.read }\n count(content)\n end", "def count_sentences(some_file)\n file_content = open(some_file).read()\n count = 0\n\n file_content.each_char do |c|\n count += 1 if c == \",\" || c == \"?\" || c == \"!\"\n end\n return count\nend", "def process_file(filename)\n puts \"Processing: #{filename}\"\n total = 0\n matched = 0\n File.open(filename) do |file|\n Zlib::GzipReader.wrap(file) do |gzip|\n CSV.new(gzip).each do |row|\n time = Time.parse(row[3])\n matched += 1 if time > MINIMUM_TIME\n total += 1\n end\n end\n end\n\n {total: total, matched: matched}\nend", "def get_total_length(filenames)\n shell_formatted_filenames = Shellwords.join filenames\n res = `afinfo -b #{shell_formatted_filenames}` # total info\n length = 0\n res.lines{|l| length = length + l.split.first.to_f if l.split.first.to_f}\n length\n end", "def count(chr = nil, start = nil, stop = nil) \n num = 0\n self.each(chr, start, stop) { |entry| num += 1 }\n num\n end", "def header_cells_count\n header_cells.count\n end", "def get_count(reload=false)\n @total_count = nil if reload\n\n @total_count ||= begin\n subdir = Rails.env.test? ? 'spec' : 'tmp'\n path = File.join Rails.root, subdir, '_definitions_count.txt'\n if File.file? path\n IO.read(path).to_i\n else\n total_count = count\n File.open(path, 'w') {|stream| stream.puts total_count }\n total_count\n end\n end\n end", "def file_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.file?(file)\n end\n end", "def hcount\n @hcount += 1\n end", "def hcount\n @hcount += 1\n end", "def countLOC(extension)\n files = 0 # number of files\n locTotal = 0 # total number of lines of code\n commentTotal = 0 # total number of comment lines\n blankTotal = 0 # total number of blank lines\n\n Dir.glob('./**/*.' + extension).each do |item|\n next if item.index(' LOC.rb') # skip this file\n next if item.index('/spec/') # skip files in the specification directory\n # other items to skip\n\n files += 1\n loc, comment, blank = 0, 0, 0\n File.new(item).each_line do |line|\n loc += 1\n if line.strip == ''\n blank += 1\n next\n end\n if line.strip[0] == '#'\n comment += 1\n next\n end\n end\n print \"(#{files.to_s}) #{item}: #{(loc - comment - blank).to_s} lines of code out of\"\n puts \" #{loc.to_s} (#{comment.to_s} comments, #{blank.to_s} blank)\"\n locTotal += loc\n commentTotal += comment\n blankTotal += blank\n end\n\n puts\n print \"There were #{files.to_s} '.#{extension}' files containing \"\n puts \"#{(locTotal-commentTotal-blankTotal).to_s} lines of code, with an additional\"\n print \"#{commentTotal.to_s} comment and #{blankTotal.to_s} blank\"\n puts \" lines for a total of #{locTotal.to_s} lines of text.\"\nend", "def count_lines_in_class(klass)\n lines = klass.methods.map {|method| method.lines}.inject(:+)\n lines.nil? ? 0 : lines\n end", "def shard_count_based_on_position_of_shard_contents\n descriptors_size.div(File::Frozen::Descriptor.size)\n end", "def mb_count()\n each_char.map{|c| c.bytesize == 1 ? 1 : 2}.reduce(0, &:+)\n end", "def src_lines(pr)\n count_lines(src_files(pr))\n end", "def count_number_of_lines(change_to_dir)\n Dir.chdir(change_to_dir)\n puts Dir.pwd.blue \n content = Dir.glob(\"*\")\n cur_dirs = []\n content.each do |file|\n file = \"#{Dir.pwd}/#{file}\"\n\n if File.directory?(file)\n cur_dirs << file\n else\n n = File.readlines(file).size\n print \"#{file} \"\n print \" #{n} lines\\n\".green\n end\n end\n cur_dirs.each do |dir| \n count_number_of_lines(dir)\n end\n\nend", "def number_closed(file)\n numClosed = 0;\n line = file.gets\n if line == nil then return end\n # read additional lines\n while line = file.gets do\n # begins with \"path\", must be path specification\n if line[0...4] != \"path\" \n if (!(line.include? \"u\") && !(line.include? \"d\") &&\n !(line.include? \"l\") && !(line.include? \"r\"))\n numClosed += 1;\n end\n end\n end\n puts \"#{numClosed}\"\nend", "def ship_count\n count = []\n @rows.each do |row|\n count << row.count('s')\n end\n count.reduce(:+)\n end", "def mit_word_count\n read_file('LICENSE').split.map{|x| x.gsub(/[^a-z0-9]/i, '').downcase}\n .group_by{|x| x}.map{|k, v| [k, v.size]}.sort_by{|_, y| -y}\nend" ]
[ "0.7533258", "0.7422093", "0.7296095", "0.72538716", "0.72446257", "0.7200559", "0.715027", "0.70878357", "0.7029153", "0.702676", "0.7013147", "0.6944964", "0.689677", "0.6885198", "0.6885198", "0.68745446", "0.68666714", "0.68237793", "0.67826444", "0.67822605", "0.6730159", "0.6723154", "0.6668666", "0.66537285", "0.6614369", "0.65863085", "0.65635926", "0.6520407", "0.65052897", "0.6415859", "0.64157915", "0.64063656", "0.63278586", "0.6326652", "0.631773", "0.63006127", "0.62588173", "0.62554485", "0.62085575", "0.6193582", "0.61815965", "0.6181401", "0.6171847", "0.61674076", "0.61393046", "0.61122817", "0.6109403", "0.60895175", "0.60690534", "0.6063279", "0.6057628", "0.6052019", "0.6043652", "0.6039517", "0.60392666", "0.6014609", "0.5991067", "0.5933516", "0.5931152", "0.5928452", "0.592666", "0.5913443", "0.5907088", "0.58887297", "0.58735687", "0.586946", "0.58664185", "0.58529574", "0.58453256", "0.5826201", "0.58239913", "0.581509", "0.58104944", "0.58080316", "0.5798959", "0.579314", "0.577849", "0.57708985", "0.57576203", "0.5756277", "0.5737143", "0.57348406", "0.57157594", "0.5699911", "0.5699657", "0.568816", "0.5681948", "0.5679974", "0.5667294", "0.56584424", "0.56584424", "0.56574434", "0.5639317", "0.5638314", "0.5636744", "0.5630278", "0.5625756", "0.56162655", "0.5612399", "0.56115735" ]
0.7558668
0
Rewind the file handle to line 2 (skipping the header row).
def rewind file_handle.rewind file_handle.gets # skip past header nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def almost_rewind(f)\n f.seek(2)\nend", "def rewind_line(file, line)\n until file_at_starting_position?(file, line)\n line_rewind_one_char(file, line) do |rewound_line|\n return line if newline?(rewound_line)\n line = rewound_line\n end\n end\n\n line\n end", "def rewind(f)\n # sets the line counter to 0\n f.seek(0)\n # end of function block\nend", "def rewind_to(n)\n @data.rewind\n while @data.lineno != n\n @data.readline\n end\n end", "def rewind\n @dat.goto(@section_label)\n 1.upto(2) { @filehandle.readline }\n end", "def rewind(f)\n #seeks for f at line 0\n f.seek(0)\n end", "def rewind\n @sio_pos = 0\n @_st_lineNumber = 0\n end", "def rewind\n @headers = nil\n @lineno = 0\n\n @io.rewind\n end", "def rewind(f)\n f.seek(0) # .seek looks for an indexed part of the file, could use any number to place within a file.\nend", "def rewind(f)\n f.seek(8)\nend", "def rewind() end", "def rewind() end", "def rewind() end", "def rewind() end", "def rewind (f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\n end", "def rewind\n @file.rewind\n end", "def rewind(f)\r\n f.seek(0)\r\nend", "def rewind(f)\r\n f.seek(0)\r\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n f.seek(0)\nend", "def rewind(f)\n # '.seek()' command moves to the start of the file\n f.seek(0)\nend", "def rewind(f)\r\n\tf.seek(0)\r\nend", "def rewind(f)\n\t# I am not sure what .seek(0) does\n\tf.seek(0)\nend", "def rewind(f)\n # Replaces reading 'cursor' for read file to start of file/ Restarts\n # the progression through the file contents to beginning (0).\n f.seek(0)\n# Closes method.\nend", "def rewind(f)\n #\"rewind\" file back to beginning\n f.seek(0)\nend", "def rewind(f)\n\tf.seek(0)\nend", "def rewind(f)\n\tf.seek(0)\nend", "def rewind(f)\n\tf.seek(0)\nend", "def rewind(f)\n\tf.seek(0)\nend", "def reverse_readline\n raise BOFError.new(\"beginning of file reached\") if pos == 0\n\n seek_backwards_to(\"\\n\", 512, -2)\n new_pos = pos\n data = readline\n seek(new_pos)\n data\n end", "def rewind(hank)\n# this utilizes the seek method attached to our file to do somethingIll get back to you on that \n hank.seek(0 , IO::SEEK_SET)\n#Ends the function \nend", "def rewind(f)\n# takes you to first position in the argument\n f.seek(0)\nend", "def rewind(f)\n f.seek(0, IO::SEEK_SET) \nend", "def rewind(f)\n\t# it's magic - I think the 0 means find that spot, SEEK means find it??\n\tf.seek(0, IO::SEEK_SET)\n# ends the rewind function definition\t\nend", "def rewind(f)\n# Seek method is used to move the file pointer to particular location. Here it moves to beginning of the file\n f.seek(0)\nend", "def move_to_next_line()\r\n while @seek_ptr < @len && @fileBuf.at(@seek_ptr) != \"\\n\"\r\n @seek_ptr = @seek_ptr + 1\r\n end\r\n end", "def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend", "def rewind; end", "def rewind; end", "def rewind; end", "def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend", "def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend", "def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend", "def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend", "def rewind(f)\n f.seek(0, IO::SEEK_SET)\nend", "def rewind(f)\n # seeks position 0 in the file ( the beginning of the file)\n f.seek(0)\n# ends the function\nend", "def rewind\n @read_index = -1\n end", "def rewind(f)\n # will call the .seek method on 'f'\n f.seek(0)\nend", "def rewind(f)\n # every time you go f.seek(0) it brings you to the start of the file\n f.seek(0)\n# ends the function\nend", "def rewind(f)\n # the seek method tries to find a position (given as an integer)\n # if we send a file to our \"rewind\" method, it will \"seek\" position 0\n # position 0 is the beginning of the File\n f.seek(0)\nend", "def rewind(f)\n\tf.seek(0, IO::SEEK_SET)\nend", "def rewind(f)\n\tf.seek(0, IO::SEEK_SET)\nend", "def rewind(f)\n\tf.seek(0, IO::SEEK_SET)\nend", "def rewind(f)\n # Call the seek function on the f object, passing the location that you want to 'seek' to (as an integer). In this case, seek to location 0 or the start of the file\n f.seek(0)\n # end the function\nend", "def rewind\n raise ArgumentError, \"no stream to rewind\" unless __advance!\n @_st_stream.rewind\n @_st_lineno = 0\n end", "def rewind(f)\n # seeks position 0 of arguemnt f\n f.seek(0)\n# end definition of function\nend", "def rewind\n @offset = 0\n end", "def read_row\n return if end_of_file?\n\n @current_row = @next_row || _read_row\n @line_number = current_row.nil? ? nil : @line_number + 1\n @next_row = nil\n\n current_row\n end", "def rewind(f)\n\t# moves to 0 byte of the file (beginning)\n\tf.seek(0)\n\t# ends the function\nend", "def rewind\n end", "def rewind(f)\n # the seek(procurar) method of classIO, moves the file pointer(indicates urrent location in the file)\n # to a given integer distance (the first parameter), since the integer distance is 0,\n # this method moves the file pointer to the beginning of the file\n f.seek(0)\nend", "def rewind\n @pos = 0\n end", "def rewind\n @pos = 0\n end", "def rewind(f)\n# seek(amount, whence=IO::SEEK_SET) (http://www.ruby-doc.org/core-1.9.3/IO.html)\n# IO::SEEK_SET => Seeks to the absolute location given by _amount_ \n# amount = 0, also sprint er an den Anfang der Datei\n f.seek(0, IO::SEEK_SET)\n# Beendet die Funktion\nend", "def rewind\n end", "def rewind\n end" ]
[ "0.7122194", "0.6772347", "0.674095", "0.6737939", "0.6722515", "0.6718901", "0.648401", "0.64477986", "0.636384", "0.6309385", "0.62845004", "0.62845004", "0.62845004", "0.62845004", "0.6274965", "0.6274689", "0.6261443", "0.6228416", "0.6228416", "0.6186934", "0.6186934", "0.6186934", "0.6186934", "0.6186934", "0.6186934", "0.6186934", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.618143", "0.6163197", "0.61567724", "0.6147883", "0.61474466", "0.6123842", "0.6103721", "0.6103721", "0.6103721", "0.6103721", "0.608634", "0.6084909", "0.60608965", "0.6055046", "0.60441583", "0.6035271", "0.6032985", "0.599003", "0.5987996", "0.5987996", "0.5987996", "0.59771484", "0.59771484", "0.59771484", "0.59771484", "0.59771484", "0.59694594", "0.59451115", "0.5928529", "0.5920419", "0.59008336", "0.58902925", "0.58902925", "0.58902925", "0.5880206", "0.58748853", "0.5872645", "0.5866199", "0.57811826", "0.5779085", "0.57743996", "0.57741594", "0.5753309", "0.5753309", "0.574383", "0.5726879", "0.5726879" ]
0.67569107
2
prepends a new node of data: value
def prepend(value) new_node = Node.new(value) new_node.next = @node @node = new_node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value=(value)\n self.remove_children :value\n if value\n self << (v = XMPPNode.new(:value))\n v.namespace = self.namespace\n v << value\n end\n end", "def prepend(value)\n\t\t@head.next_node = Node.new(value, @head.next_node)\n\tend", "def push(value)\n # IMPLEMENT ME!\n @data = Node.new(value, @data)\n end", "def prepend(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, @head)\n\t\t# update head\n\t\t@head = new_node\n\tend", "def value=(value)\n self.remove_children :value\n return unless value\n Array(value).each do |val|\n self << (v = XMPPNode.new(:value))\n v.namespace = self.namespace\n v.content = val\n end\n end", "def append( value )\n last.next = Node.new value\n end", "def prepend(value)\n node = Node.new\n node.value = value\n node.next = head\n @head = node\n end", "def prepend(value)\n @head = Node.new(value, head)\n end", "def insert_values(values, subtree) \n values.each do |val|\n value = REXML::Element.new('value')\n subtree << value\n\n path = REXML::Element.new('path')\n path.add_text(val.path)\n value << path\n\n name = REXML::Element.new('name')\n name.add_text(val.name)\n value << name\n\n data = REXML::Element.new('data')\n\n begin\n cdata = REXML::CData.new(val.data) \n rescue\n p(val)\n end\n\n data << cdata\n value << data\n end\n end", "def push(value)\n @data = LLNode.new(value, @data)\n end", "def prepend(value)\n\t\t\telement = RubyStructures::Node.new(self, value)\n\t\t\telement.next = @head.next\n\t\t\t@head.next = element\n\t\tend", "def push(value)\r\n \t@data = LinkedListNode.new(value, @data)\r\n end", "def prepend( value )\n new_node = Node.new value\n new_node.next = @head\n @head = new_node\n end", "def value=(value); self.data.value = value; end", "def prepend(val)\n new_node = Node.new(val, @head)\n @head = new_node\n end", "def push(value)\n @data = LinkedListNode.new value, @data\n end", "def append(value)\n new_node = Node.new(value)\n node = @node\n\n while node.next\n node = node.next\n end\n\n node.next = new_node\n end", "def append(value)\n if head == nil\n prepend(value)\n else\n tmp = head\n while tmp.next_node != nil\n tmp = tmp.next_node\n end\n tmp.next_node = Node.new(value)\n end\n end", "def prepend(value = nil)\n node = @head\n @head = Node.new(value, node)\n end", "def append(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n current_node = current_node.next_node until current_node.next_node.nil?\n current_node.next_node = new_node\n end\n end", "def push(new_value)\n @data = LinkedListNode.new(new_value, @data)\n end", "def push(value)\r\n\t\tif @data.nil? \r\n\t\t\t@data = LinkedListNode.new(value) \r\n\t\telse\r\n\t\t\t@data = LinkedListNode.new(value, @data)\r\n\t\tend\r\n\tend", "def push(value)\r\n @data = LinkedListNode.new(value, @data)\r\n \r\n end", "def replace_data(node, data)\n node.data\n ensure\n node.data = data\n end", "def append(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n last_node = traverse_nodes(@head)\n # require 'pry'; binding.pry\n last_node.next_node = new_node\n end\n end", "def append(value = nil, next_node = nil)\n\n if (@head.nil?)\n prepend(value)\n else\n node = @head\n while (node.has_next)\n node = node.next_node\n end\n node.next_node = Node.new(value, next_node)\n end\n\n end", "def push(value)\n @data = LinkedListNode.new(value, @data) \n end", "def prepend(value)\n node = Node.new\n node.value = value\n \n if @head.nil?\n @head = node\n @tail = node\n else\n node.next_node = @head\n @head = node\n end\n @size += 1\n end", "def add_first(data)\n new_node = Node.new(value, @head)\n @head = new_node\n end", "def push(value)\n if @data == nil\n node1 = LinkedListNode.new(value)\n @data = node1\n else\n node1 = LinkedListNode.new(value, @data)\n @data = node1\n end\n\n end", "def addCustomAttrib(doc, name, value, datatype=\"string\")\r\n\tputs \"adding custom-attribute #{name}\"\r\n\tnode = Nokogiri::XML::Node.new \"custom-attribute\", doc\r\n\tnode[\"name\"] = name\t\r\n\tnode[\"dt:dt\"] = datatype\r\n\tif value.kind_of?(Array)\r\n\t\tvalue.each do |val|\r\n\t\t\tnode << \"<value>#{val}</value>\"\r\n\t\tend\r\n\telse\r\n\t\tnode.content = value\r\n\tend\r\n\treturn node\r\nend", "def push(value)\r\n if @data == nil\r\n @data = LinkedListNode.new(value)\r\n else\r\n @data = LinkedListNode.new(value, @data)\r\n end\r\n end", "def push(value)\r\n if @data != nil\r\n node = LinkedListNode.new(value, @data)\r\n else\r\n node = LinkedListNode.new(value)\r\n end\r\n @data = node\r\n end", "def push(value)\n # IMPLEMENT ME!\n if @data == nil\n @data = LinkedListNode.new(value)\n else\n @data = LinkedListNode.new(value, @data)\n end\n end", "def push(value)\r\n @data = LinkedListNode.new(value, @data)\r\n end", "def push(value)\r\n @data = LinkedListNode.new(value, @data)\r\n end", "def push(value)\r\n # IMPLEMENT ME!\r\n # data = NIL\r\n # push(10) => data = LinkedListNode.new(10, data)\r\n # push(5) => data = LinkedListNode.new(5, data)\r\n # push(1) => data = LinkedListNode.new(1, data)\r\n\r\n @data = LinkedListNode.new(value, @data)\r\n\r\n end", "def add_value(value)\n @children['value'][:value] << value\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def append(value)\n\t\tself.tail.next_node = Node.new(value, nil)\n\tend", "def set_data data\n @x_cell.each_attr do |a|\n a.remove! unless a.name == 'style-name' # TODO: ns equality check\n end\n @x_cell.each &:remove!\n @x_cell.ns_set_attr 'office:value-type', 'string'\n @x_cell << @x_cell.doc.ns_create_node('text:p', data)\n data\n end", "def push(value)\n @data = LinkedListNode.new(value, data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\r\n @data = LinkedListNode.new(value, self.data)\r\n end", "def node=(val)\n attributes['node'] = val\n end", "def node=(val)\n attributes['node'] = val\n end", "def prepend(value)\n @head = Node.new(value, @head)\n @size += 1\n end", "def __overwrite_value(val)\n @__node.content = __export_to_xml(val)\n self.__value = val\n end", "def insert_after value\n node = Node.new value, @nxt, self\n @nxt.prv = node if @nxt\n @nxt = node\n end", "def prepend(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n new_node.next_node = @head\n @head = new_node\n end\n end", "def add_element(parent, key, value)\n elem = Nokogiri::XML::Node.new(key, @xml.document)\n elem.content = value\n\n parent.add_child(elem)\n end", "def on_vasgn(node)\n name, value_node = *node\n\n if !value_node.nil?\n node.updated(nil, [\n name, process(value_node)\n ])\n else\n node\n end\n end", "def push(value)\n new_node = LinkedListNode.new(value, @data)\n @data = new_node\n end", "def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # ^ kind of like incrementing the loop counter\n end\n\n node.next = Node.new value\n end", "def node=(v)\n @node = v.to_s\n if USE_STRINGPREP\n @node = IDN::Stringprep.nodeprep(@node) if @node\n end\n end", "def append(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(self.tail, new_node)\n self.tail = new_node\n self.size += 1\n end\n self.as_string\n end", "def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n node.next_node = @head\n @head = node\n end\n end", "def append(value)\n node = Node.new(value)\n if last\n last.next = node\n else\n @head = node\n end\n end", "def add(value)\n\t\tif @head != nil \n\t\t\tcurrent = @head\n\t\t\twhile current.nnode != nil\n\t\t\t\tcurrent = current.nnode\n\t\t\tend\n\t\t\tcurrent.nnode = Node.new(value, nil)\n\t\telse\n\t\t\t@head = Node.new(value,nil)\n\t\tend\n\tend", "def add_node(value)\n if @head\n @head = Node.new value, @head\n else\n @head = Node.new value, nil\n end\n end", "def prepend(value)\n new_node = Node.new(value, @head)\n @tail = new_node unless @head\n @head = new_node\n @size += 1\n end", "def append(value)\n if @head.nil?\n prepend(value)\n else\n find_tail.next = Node.new(value)\n end\n end", "def insert_after(value)\n node = Node(value)\n @next = node\n node\n end", "def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n @head = new_node\n @head.next_node = current_node\n end\n end", "def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n\n end", "def append(value)\n node = Node.new\n node.value = value\n if head.nil?\n @head = node\n else\n curr = head\n curr = curr.next until curr.next.nil?\n curr.next = node\n end\n head\n end", "def prepend(data)\n new_node = Node.new(data: data)\n new_node.next_node = @head\n @head = Node.new(data: data, next_node: @head)\n end", "def add(node, value)\n tree_navigator.descendents(node).each do |descendent|\n values[descendent] += value\n end\n end", "def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end", "def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end", "def prepend(data)\n node = Node.new(data)\n node.next_node = @head\n @head = node\n end", "def prepend(node_value = nil)\n node = Node.new(node_value)\n if @head.nil?\n @tail = node\n else\n node.next_node = @head\n end\n @head = node\n end", "def prepend(data)\n\t\t@previous_head = @head\n\t\t@head = Node.new(data, @previous_head)\n\tend", "def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end", "def insert_data(data)\n self.root = insert(data)\n end", "def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n new_node = Node.new(value)\n new_node.next_node = @head\n @head = new_node\n end\n end", "def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end", "def prepend(value)\n new_node = create_node(value)\n new_node.next_node = head\n self.head = new_node\n self.size += 1\n end", "def child_add_string(name, value)\n elt = NaElement.new(name, value)\n child_add(elt)\n end", "def prepend(value)\n p = Node.new(value);\n p.prev = nil;\n p.next = self.head;\n self.head.prev = p;\n self.head = p;\n end", "def insert_head (value) # Insertar desde la cabeza\n\t nodo=Node.new(value,nil,nil)\n nodo.nest = @head\n @head = nodo # el head ahora apunta a este nodo\n if (@tail == nil)\n @tail = nodo\n end\n nodo.prev = nil\n if (nodo.nest != nil)\n nodo.nest.prev = nodo\n end\n end", "def insertar(value)\n insert(Node.new(value, nil, nil))\n end", "def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n old_point = @head\n @head = Node.new(value)\n @head.next = old_point\n # old_next = @head.next\n # p old_next\n # @head = Node.new(value)\n # @head.next = old_next\n # head is hi\n # replace head with new value\n # make head next the hi attribute\n end\n end", "def set_head(value)\n @head = new_node(value)\nend", "def prepend_child(value = nil)\n unshift value\n end", "def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # kind of like incrementing the loop counter\n end\n\n # puts \"End of loop:\"\n # p node\n\n node.next = Node.new value\n end", "def append(value)\n if @size == 0\n @head = Node.new(value)\n else\n node = @head\n node = node.link until node.link.nil?\n node.link = Node.new(value)\n end\n\n @size += 1\n end", "def add(value)\n @root = add_at_node(@root, value)\n end", "def append(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n @tail.next_node = Node.new(value)\n @tail = @tail.next_node\n end\n end", "def prepend(value)\n #Instantiate the object to be the new head\n new_node = Node.new value\n #Set its next value to the current head\n new_node.next = @head\n @head.before = new_node\n #Set the new one as the new head by repointing SinglyLinkedList head to it\n @head = new_node\n end", "def append(value)\n node = Node.new\n node.value = value\n\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = node\n end\n @size += 1\n end", "def append(value)\n\t\t\tif self.empty?\n\t\t\t\tself.prepend(value)\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\telement = self.head\n\t\t\t# loop through each element in the LinkedList, until element.next \n\t\t\t# equals @head, signifying we have reached the end of the list.\n\t\t\twhile(element != self.head)\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tnew_element = RubyStructures::Node.new(self, value)\n\t\t\t# insert the new element at the end of the LinkedList.\n\t\t\tnew_element.next = element.next\n\t\t\telement.next = new_element\n\t\tend", "def prepend(value) \n if @head == nil\n @head = value \n @tail = value \n else \n value.next_node = @head\n @head = value \n end \n end", "def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = @tail.next_node\n end\n end", "def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n old_head = @head\n @head = node\n @head.next_node = old_head\n end\n end", "def append(data)\n if @head.data.nil?\n @head = Node.new(data)\n else\n node = @head\n node = node.next_node until node.next_node.nil?\n node.next_node = Node.new(data)\n end\n end", "def push(value)\n if value == nil\n \tputs 'Nil value (Nothing else to push)'\n \treturn\n end\nnewData = @data ? LinkedListNode.new(value, @data) : LinkedListNode.new(value)\n@data = newData\n\nend" ]
[ "0.63338304", "0.6309103", "0.6272431", "0.62654305", "0.62636596", "0.6235239", "0.6182171", "0.6177406", "0.61503357", "0.61281246", "0.6119337", "0.607562", "0.60684526", "0.6062957", "0.60415804", "0.6036181", "0.60329086", "0.6027658", "0.6014026", "0.5995853", "0.59944546", "0.5991759", "0.5983528", "0.5968125", "0.5963443", "0.59634024", "0.59565896", "0.59562683", "0.5947573", "0.5934409", "0.5925547", "0.591916", "0.5914125", "0.5912742", "0.59103113", "0.59103113", "0.59037566", "0.5903676", "0.5903275", "0.5903275", "0.58953154", "0.5889926", "0.5882623", "0.5878474", "0.5867245", "0.5867245", "0.58670664", "0.58594286", "0.58594286", "0.5854829", "0.58490866", "0.5848929", "0.58399326", "0.5836754", "0.58336204", "0.5830824", "0.5826227", "0.5824062", "0.5817802", "0.58126855", "0.58122146", "0.580601", "0.58018696", "0.57849246", "0.5776024", "0.57702905", "0.57586044", "0.575083", "0.57480454", "0.57370377", "0.5736845", "0.57298064", "0.57298064", "0.57292485", "0.57155305", "0.57067335", "0.5706451", "0.5697506", "0.5687071", "0.56848836", "0.5683538", "0.5682375", "0.5681524", "0.5678707", "0.5675976", "0.5672733", "0.5671569", "0.56622666", "0.5656002", "0.56549454", "0.5648136", "0.56447667", "0.56391", "0.5637166", "0.56220317", "0.56217825", "0.5619014", "0.56095606", "0.56065416", "0.56030434" ]
0.61406547
9
appends a new node of data: value
def append(value) new_node = Node.new(value) node = @node while node.next node = node.next end node.next = new_node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append( value )\n last.next = Node.new value\n end", "def push(value)\n # IMPLEMENT ME!\n @data = Node.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new value, @data\n end", "def append(key, value)\n node_for(key).append(key, value)\n end", "def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # ^ kind of like incrementing the loop counter\n end\n\n node.next = Node.new value\n end", "def push(new_value)\n @data = LinkedListNode.new(new_value, @data)\n end", "def append(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n last_node = traverse_nodes(@head)\n # require 'pry'; binding.pry\n last_node.next_node = new_node\n end\n end", "def push(value)\n @data = LLNode.new(value, @data)\n end", "def push(value)\r\n \t@data = LinkedListNode.new(value, @data)\r\n end", "def append(value)\n\t\tself.tail.next_node = Node.new(value, nil)\n\tend", "def push(value)\r\n @data = LinkedListNode.new(value, @data)\r\n \r\n end", "def add(node, value)\n tree_navigator.descendents(node).each do |descendent|\n values[descendent] += value\n end\n end", "def append(value)\n node = Node.new(value)\n if last\n last.next = node\n else\n @head = node\n end\n end", "def push(value)\n @data = LinkedListNode.new(value, @data) \n end", "def add_value(value)\n @children['value'][:value] << value\n end", "def push(value)\r\n @data = LinkedListNode.new(value, @data)\r\n end", "def push(value)\r\n @data = LinkedListNode.new(value, @data)\r\n end", "def push(value)\n @data = LinkedListNode.new(value, data)\n end", "def push(value)\r\n\t\tif @data.nil? \r\n\t\t\t@data = LinkedListNode.new(value) \r\n\t\telse\r\n\t\t\t@data = LinkedListNode.new(value, @data)\r\n\t\tend\r\n\tend", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def push(value)\n @data = LinkedListNode.new(value, @data)\n end", "def append(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n current_node = current_node.next_node until current_node.next_node.nil?\n current_node.next_node = new_node\n end\n end", "def push(value)\r\n @data = LinkedListNode.new(value, self.data)\r\n end", "def push(value)\r\n if @data == nil\r\n @data = LinkedListNode.new(value)\r\n else\r\n @data = LinkedListNode.new(value, @data)\r\n end\r\n end", "def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # kind of like incrementing the loop counter\n end\n\n # puts \"End of loop:\"\n # p node\n\n node.next = Node.new value\n end", "def push(value)\n # IMPLEMENT ME!\n if @data == nil\n @data = LinkedListNode.new(value)\n else\n @data = LinkedListNode.new(value, @data)\n end\n end", "def append(val)\n node = Node.new\n node.value = val\n @array << node \n @array[-2].next_node = node unless @array.count == 1 \n end", "def push(value)\n new_node = LinkedListNode.new(value, @data)\n @data = new_node\n end", "def append(value)\n node = Node.new\n node.value = value\n\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = node\n end\n @size += 1\n end", "def add_node(key, val)\n @store.append(key, val)\n end", "def push(value)\r\n if @data != nil\r\n node = LinkedListNode.new(value, @data)\r\n else\r\n node = LinkedListNode.new(value)\r\n end\r\n @data = node\r\n end", "def append(value = nil, next_node = nil)\n\n if (@head.nil?)\n prepend(value)\n else\n node = @head\n while (node.has_next)\n node = node.next_node\n end\n node.next_node = Node.new(value, next_node)\n end\n\n end", "def add(value)\n @root = add_at_node(@root, value)\n end", "def push(value)\n if @data == nil\n node1 = LinkedListNode.new(value)\n @data = node1\n else\n node1 = LinkedListNode.new(value, @data)\n @data = node1\n end\n\n end", "def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end", "def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end", "def append(value)\n new_node = Node.new(value)\n @head ? @tail.next_node = new_node : @head = new_node\n @tail = new_node\n @size += 1\n end", "def append(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(self.tail, new_node)\n self.tail = new_node\n self.size += 1\n end\n self.as_string\n end", "def append(value)\n if head == nil\n prepend(value)\n else\n tmp = head\n while tmp.next_node != nil\n tmp = tmp.next_node\n end\n tmp.next_node = Node.new(value)\n end\n end", "def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = @tail.next_node\n end\n end", "def append(value)\n if @size == 0\n @head = Node.new(value)\n else\n node = @head\n node = node.link until node.link.nil?\n node.link = Node.new(value)\n end\n\n @size += 1\n end", "def add_node(node)\n nodes[node.value] = node\n end", "def append(value)\n node = Node.new\n node.value = value\n if head.nil?\n @head = node\n else\n curr = head\n curr = curr.next until curr.next.nil?\n curr.next = node\n end\n head\n end", "def append(value)\n if @head\n find_tail.next = Node.new(value)\n else\n @head = Node.new(value)\n end\n end", "def append(value)\n new_node = create_node(value) \n if head.nil?\n self.head = new_node\n else\n last_node = tail\n last_node.next_node = new_node\n end\n self.size += 1\n end", "def append(data)\n if @head.data.nil?\n @head = Node.new(data)\n else\n node = @head\n node = node.next_node until node.next_node.nil?\n node.next_node = Node.new(data)\n end\n end", "def append(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n @tail.next_node = Node.new(value)\n @tail = @tail.next_node\n end\n end", "def ll_append(data)\n new_node = Node.new(data)\n \n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n end_node = @tail\n end_node.set_Next(new_node)\n @tail = new_node\n end\n \n @num_nodes += 1\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def push(value)\r\n # IMPLEMENT ME!\r\n # data = NIL\r\n # push(10) => data = LinkedListNode.new(10, data)\r\n # push(5) => data = LinkedListNode.new(5, data)\r\n # push(1) => data = LinkedListNode.new(1, data)\r\n\r\n @data = LinkedListNode.new(value, @data)\r\n\r\n end", "def append(node_value = nil)\n node = Node.new(node_value)\n if @tail.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def append(data)\n\t\t@tail.next_node = Node.new(data, nil)\n\t\t@tail = @tail.next_node\n\tend", "def add_element(parent, key, value)\n elem = Nokogiri::XML::Node.new(key, @xml.document)\n elem.content = value\n\n parent.add_child(elem)\n end", "def append(value)\n if @head.nil?\n prepend(value)\n else\n find_tail.next = Node.new(value)\n end\n end", "def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n @last = newNode\n @length += 1\n self\n end", "def append_child(value = nil)\n push value\n end", "def add_node(data)\n if @head.nil?\n add_first_node(data)\n else\n new_node = Node.new(data, nil)\n @tail.next = new_node\n @tail = new_node\n end\n # puts \"Added node with value: #{data}\"\n end", "def add_node(data)\n\n\t\t# change tactics if we're adding the first node\n\t\tif @head.nil?\n\n\t\t\tadd_first_node(data)\n\n\t\telse\n\n\t\t\tnew_node = Node.new(data)\n\n\t\t\t# point the last node to our new one\n\t\t\t@last.next = new_node\n\n\t\t\t# set our new node as the official last node\n\t\t\t@last = new_node\n\n\t\tend\n\t\tputs \"Added node with the value: #{data}\"\n\tend", "def append(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, nil)\n\t\t# make old tail point to new node\n\t\t@tail.next_node = new_node\n\t\t# update tail\n\t\t@tail = new_node\n\tend", "def add_node(node); end", "def append(data)\n if head\n next_node = head\n next_node = next_node.next_node while next_node.next_node\n next_node.next_node = Node.new(data: data)\n else\n @head = Node.new(data: data)\n end\n end", "def append(val)\n current = @head\n while current.next?\n current = current.next_node\n end\n new_node = Node.new(val, nil)\n current.next_node = new_node\n end", "def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n\n @last = newNode\n @length += 1\n self\n end", "def add(value)\n\t\tif @head != nil \n\t\t\tcurrent = @head\n\t\t\twhile current.nnode != nil\n\t\t\t\tcurrent = current.nnode\n\t\t\tend\n\t\t\tcurrent.nnode = Node.new(value, nil)\n\t\telse\n\t\t\t@head = Node.new(value,nil)\n\t\tend\n\tend", "def append(value)\n\t\t\tif self.empty?\n\t\t\t\tself.prepend(value)\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\telement = self.head\n\t\t\t# loop through each element in the LinkedList, until element.next \n\t\t\t# equals @head, signifying we have reached the end of the list.\n\t\t\twhile(element != self.head)\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tnew_element = RubyStructures::Node.new(self, value)\n\t\t\t# insert the new element at the end of the LinkedList.\n\t\t\tnew_element.next = element.next\n\t\t\telement.next = new_element\n\t\tend", "def append(value)\n if @size == 0\n @head = @tail = LinkedListNode.new(:value => value)\n else\n old_tail = @tail\n @tail = LinkedListNode.new(:value => value)\n old_tail.successor = @tail\n end\n @size += 1\n end", "def append(value)\n end", "def push(value)\r\n @data << value\r\n end", "def append(val)\n\t\t# create a new node\n\t\tnewNode = Node.new(val, nil)\n\t\t# make old tail point to new node\n\t\t@tail.next_node = newNode\n\t\t# update tail\n\t\t@tail = newNode\n\tend", "def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end", "def append(value)\n # if the list is empty, you need to update head and tail. \n # you can do via push, because in the case append == push\n if isEmpty?\n push(value)\n return\n end\n\n # if the list is not empty, you need to create a new Node\n # after the tail\n @tail.next_node = Node.new(value)\n # since it's a tail-end insertion, the new node is also\n # the tail of the list\n @tail = @tail.next_node\n end", "def append(value)\n if @head == nil\n @head = value \n @tail = value \n else \n @tail.next_node = value\n @tail = value \n end \n end", "def append(value)\n a = Node.new(value);\n a.prev = last;\n a.next = nil;\n a.prev.next = a; #prev now 2nd last\n end", "def value=(value)\n self.remove_children :value\n return unless value\n Array(value).each do |val|\n self << (v = XMPPNode.new(:value))\n v.namespace = self.namespace\n v.content = val\n end\n end", "def append(new_data)\n end", "def add_node(value)\n if @head\n @head = Node.new value, @head\n else\n @head = Node.new value, nil\n end\n end", "def append(data)\n node = Node.new(data)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next = node\n @tail = node\n end\n end", "def append(data)\n\t\ttemp = Node.new(data)\n\t\tif (!@head)\n\t\t\t@head = temp\n\t\t\t@tail = temp\n\t\telse\n\t\t\ttemp.set_prev(@tail)\n\t\t\t@tail.set_next(temp)\n\t\t\t@tail = temp\n\t\tend\n\t\t@size +=1\n\tend", "def append_elem(data)\n\t\tnode = Node.new(data)\n\t\tnode.next_node = nil\n\t\t@head = node if @head == nil\n\t\t@last_elem.next_node = node if @last_elem != nil\n\t\t@last_elem = node\n\tend", "def add_node(value)\n add_node_support(value, :linked_list)\n end", "def add_node(value, node=nil)\n new_node = Node.new(value)\n if node\n new_node.parent = node\n node.children << new_node\n else\n @head = new_node\n end\n end", "def add_record(value)\n @children['record'][:value] << value\n end", "def add_record(value)\n @children['record'][:value] << value\n end", "def push(value)\n\t\tlast_node = find_last\n\t\tlast_node.next_node = Node.new(value)\n\tend", "def value=(value)\n self.remove_children :value\n if value\n self << (v = XMPPNode.new(:value))\n v.namespace = self.namespace\n v << value\n end\n end", "def add value\n if !@root\n @root = Node.new value, nil, @cmp\n @length = 1\n else\n @root.add value\n @length += 1\n end\n value\n end", "def append value\n add_idx = empty? ? 0 : last_key + 1\n self[add_idx] = value\n end", "def append(data)\n\t\ttmp = Node.new(data)\n\t\tif @head.nil?\n\t\t\t@head = tmp\n\t\t\t@tail = tmp\n\t\t\t\n\t\telse\n\t\t\t@tail.next = tmp\n\t\t\ttmp.previous = @tail\n\t\t\ttmp.next = nil\n\t\t\t@tail = tmp\n\t\tend\n\t\t@count += 1\n\tend", "def append(value)\n node = LinkedListNode.new(value, @tail, nil)\n if @size.zero?\n @head = node\n @tail = node\n @size += 1\n return\n end\n\n @tail.next = node\n @tail = node\n @size += 1\n end", "def push(value)\n if value == nil\n \tputs 'Nil value (Nothing else to push)'\n \treturn\n end\nnewData = @data ? LinkedListNode.new(value, @data) : LinkedListNode.new(value)\n@data = newData\n\nend", "def add(data)\n node = Node.new(data: data)\n if head\n tail.next_node = node\n else\n @head = node\n end\n\n @tail = node\n self\n end", "def add_node_attribute(key, value, options)\n @node_attributes << { key: key, value: value, options: options }\n end", "def << value\n add(value)\n end" ]
[ "0.72796077", "0.70016223", "0.69808525", "0.6980771", "0.6939678", "0.69363123", "0.6931024", "0.6929061", "0.692087", "0.6872095", "0.6865514", "0.686101", "0.68561614", "0.6847596", "0.6835342", "0.6832084", "0.6832084", "0.6831559", "0.68297756", "0.6828386", "0.6828386", "0.68180615", "0.6811081", "0.6811081", "0.6799683", "0.67799044", "0.67756873", "0.6769967", "0.6764777", "0.67390174", "0.6734514", "0.67303425", "0.67295074", "0.670982", "0.6697504", "0.66964537", "0.66919875", "0.66755116", "0.66724336", "0.66597146", "0.6651019", "0.66444737", "0.661839", "0.6603621", "0.6602645", "0.65997535", "0.6598418", "0.6597636", "0.65946496", "0.6575581", "0.65604836", "0.6550268", "0.6549114", "0.654323", "0.6537058", "0.6537058", "0.6537058", "0.6534557", "0.6532037", "0.6525365", "0.6524981", "0.652125", "0.6518394", "0.6508543", "0.6495672", "0.64928484", "0.6484802", "0.64751035", "0.6468052", "0.6467053", "0.6461247", "0.644802", "0.643916", "0.6414378", "0.64087623", "0.63917106", "0.6375563", "0.6366235", "0.6362049", "0.63588595", "0.635577", "0.634655", "0.633277", "0.6307955", "0.6284829", "0.62767774", "0.62498736", "0.6245987", "0.6223604", "0.6223604", "0.621327", "0.62074584", "0.6202805", "0.6199657", "0.61608404", "0.6159643", "0.6156665", "0.61555773", "0.6124384", "0.6117506" ]
0.70865726
1
these methods are basically for testing purpose
def size count = 1 node = @node while node.next count += 1 node = node.next end count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def spec; end", "def spec; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def testing\n # ...\n end", "def probers; end", "def weber; end", "def who_we_are\r\n end", "def schubert; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def tests; end", "def tests; end", "def checks; end", "def zuruecksetzen()\n end", "def __dummy_test__\n end", "def self_test; end", "def self_test; end", "def operations; end", "def operations; end", "def how_it_works\r\n end", "def graffiti_test\n end", "def test_method\n end", "def implementation; end", "def implementation; end", "def suivre; end", "def stest_method_1(test); end", "def test \n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def test\n\n end", "def identify; end", "def assertions; end", "def assertions; end", "def running_test_case; end", "def test_cases; end", "def test_source_get()\n One::EmailDirect::Facade.source_add(@credentials, @source_get[:name], @source_get[:description])\n\n\n # 1.\n result = One::EmailDirect::Facade.source_get(@credentials, @source_get[:name])\n assert result.has_key? :element_id\n assert result.has_key? :element_name\n assert result.has_key? :description\n result.delete(:element_id)\n expected = {\n :element_name => @source_get[:name],\n :description => @source_get[:description]\n }\n assert_equal expected, result\n\n\n # 2.\n assert_nil One::EmailDirect::Facade.source_get(@credentials, 'inexistent')\n end", "def common\n \n end", "def test_0_dummy\n\t\tend", "def strategy; end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\r\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def internship_passed; end", "def test\n end", "def test\n end", "def test\n end", "def driver; end", "def before() ; end", "def test_case; end", "def get_actual\n end", "def verify\n end", "def berlioz; end", "def setup\n\t\tend", "def setup\n\t\tend", "def before_test(test); end", "def before_test(test); end", "def test_setup\r\n \r\n end", "def helpers; end", "def helpers; end", "def helpers; end", "def setup\n\n end", "def setup\n\n end", "def refutal()\n end", "def setup; end", "def failures; end", "def failures; end", "def failures; end", "def private_method\n end" ]
[ "0.72640234", "0.68645316", "0.68645316", "0.6856354", "0.6856354", "0.6856354", "0.6856354", "0.6707263", "0.6458941", "0.63931346", "0.63524604", "0.63050556", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.6278484", "0.62487614", "0.62487614", "0.6225997", "0.6178567", "0.6166227", "0.61572254", "0.61572254", "0.61507076", "0.61507076", "0.61374307", "0.61287034", "0.6115677", "0.6104098", "0.6104098", "0.60902953", "0.6078426", "0.6071251", "0.6060443", "0.6060443", "0.6060443", "0.605297", "0.60476065", "0.6029196", "0.6029196", "0.59964836", "0.5989198", "0.5984809", "0.5981732", "0.5973504", "0.5971065", "0.5919352", "0.5919352", "0.5919352", "0.5919352", "0.5919352", "0.5919352", "0.5919352", "0.59061235", "0.59055436", "0.59055436", "0.59055436", "0.59055436", "0.59055436", "0.59055436", "0.5890177", "0.58900225", "0.58900225", "0.58900225", "0.5884177", "0.588326", "0.58720237", "0.58604497", "0.5850458", "0.5839817", "0.58338434", "0.58338434", "0.58148444", "0.58148444", "0.58140314", "0.5810282", "0.5810282", "0.5810282", "0.5797752", "0.5797752", "0.579041", "0.5787778", "0.5787216", "0.5787216", "0.5787216", "0.57860225" ]
0.0
-1
Execute access_denied unless current_user.admin == true
def admin_in! access_denied! unless current_user.admin? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def must_be_admin!\n access_denied! unless current_admin?\n end", "def admin_required\n current_user.is_admin? || access_denied\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end", "def admin_required\n self.current_user != :false && \n self.current_user.is_admin? ? true : access_denied\n end", "def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end", "def adminprotected!\n if authorized? == true and isuseradmin? == true\n return\n else redirect '/denied'\n end\n end", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end", "def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend", "def require_admin\n deny_wrong_user if !admin?\n end", "def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end", "def require_admin\n unless (@current_user && @current_user.is_admin?)\n set_notification_messages(I18n.t(\"authentication.permission_denied_heading\"), I18n.t(\"authentication.permission_denied_message\"), :error)\n redirect_to_sign_in_page\n return\n end\n end", "def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end", "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def require_admin\n if !logged_in? or !current_user.admin?\n redirect_to login_path, :alert => \"Access denied.\"\n end\n end", "def admin_only\n logged_in_as_admin? || admin_only_access_denied\n end", "def admin_authorize\n unless admin?\n unauthorized_access\n end\n end", "def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end", "def authorize_admin\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level == 2\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"access_denied\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end", "def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end", "def enforce_user_is_admin\n return if user_signed_in? && current_user.admin?\n raise CanCan::AccessDenied\n end", "def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end", "def authorize_as_admin\n raise(ExceptionHandler::AuthenticationError, Message.unauthorized) unless !current_user.nil? && current_user.is_admin?\n end", "def require_admin\n unless !current_user.nil? && current_user.admin?\n render file: 'public/401.html', status: :unauthorized\n end\n end", "def check_admin_user\n unless current_user && current_user.privilege_admin?\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end", "def check_if_admin\n unless current_user.is_admin?\n render json: {\"errors\" => [\"Inaccessible Resource\"]},\n status: :unauthorized\n return\n end\n end", "def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end", "def handle_admin_permissions()\n if !session[:debater].is_admin\n redirect_to(:controller => :debater, :action => :login_form, :message => \"must login as admin to make specified request\")\n return false\n end\n return true\n end", "def authorize_admin\n return unless current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def require_admin\n unless @current_user.is_admin?\n set_notification_messages(\"authentication.permission_denied\", :error)\n redirect_or_popup_to_default_sign_in_page\n return\n end\n end", "def require_admin\n redirect_to(access_denied_path) unless current_user.is_admin_of?(@department)\n end", "def authorize_admin\n redirect_to root_path, flash: {:error => \"User don't have admin privileges\"} unless isAdmin?\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def authenticate_admin!\n access_denied! unless current_user.admin?\n end", "def authorize_admin\n redirect_to root_path, notice: \"You don't have access to admin pages.\" if !current_user.admin?\n end", "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end", "def must_be_admin\n if current_user.is? \"EA\"\n return true\n else\n redirect_to root_path,:notice =>\"Access Denied...\"\n end\n end", "def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def authorize_only_for_admin\n unless authorized?(Admin)\n render :file => \"#{RAILS_ROOT}/public/404.html\", \n :status => 404\n end\n end", "def check_admin\n if !current_user.admin?\n return redirect_to '/messages/no_access'\n end\n end", "def restrict_access\n redirect_to root_path if is_superuser_or_admin? == false\n end", "def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend", "def verify_self_or_admin\n if !current_cas_user.admin? && (current_cas_user.id != @cas_user.id)\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end\n end", "def authorise_admin\n redirect_to root_path, alert: \"You are not authorised to access that page\" if current_user.try(:admin?) != true\n end", "def require_admin_or_correct_user\n @user = User.find(params[:id])\n flash[:error] = \"Access Denied\"\n redirect_to(root_url) unless (current_user.id == @user.id || is_admin?)\n end", "def _admin_or_self\n not_authorizaed unless current_user.admin? || current_user == @user\n end", "def require_admin\n #byebug\n redirect_to user_path(current_user) unless current_user.role === \"Admin\"\n end", "def is_admin\n render status: :unauthorized unless current_user.admin\n end", "def check_if_admin_access\n if request.path == \"/admin\" && current_user.permission_level <= 2\n redirect_to :back\n end\n end", "def authorize_admin\n redirect_to(:controller => 'main', :action => 'index') and return false unless @logged_in_user.is_admin?\n end", "def authorize_admin!\n redirect_to home_path unless current_user&.admin\n end", "def admin_only_view\n if !current_user.is_a? Admin and current_user.type != \"AdminAssistant\"\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end", "def check_access\n if current_user.nil? or !current_user.is_admin?\n flash[:error] = t('no_access')\n redirect_to :root\n return false\n end\n end", "def authorize\n if !current_user.has_role? :admin\n render plain:\"No access for you!\"\n end\n end", "def admin_only!\n\tif !current_user || !current_user.administrator\n\t\tredirect \"/\"\n\tend\nend", "def require_admin!\n return if user_signed_in? && current_user.admin?\n\n flash[:error] = t('flash.no_permission')\n redirect_to_root\n end", "def authorize_admin!\n unless admin?\n flash[:alert] = 'Unauthorized access'\n redirect_to home_path\n false\n end\n end", "def require_admin\n\t\tif !logged_in? || (logged_in? && !current_user.admin?)\n\t\t\tflash[:danger] = \"Only Admins can perform that action\"\n\t\t\tredirect_to root_path\n\t\tend\n\tend", "def require_admin_privileges\n\t\tredirect_to root_path unless is_global_admin?\n\tend", "def admin_only\n deny_access(\"You must be signed in as an admin to access this page.\") unless signed_in_as_admin?\n end", "def require_admin\n if logged_in? and !current_user\n flash[:danger] = \"Only admin users can perform that action.\"\n redirect_to root_path\n end\n end", "def check_admin_rights\n unless logged_in? and current_user.is_admin?\n flash[:error] = \"Permiso denegado\"\n redirect_to '/'\n end\n end", "def prevent_admin_role\n raise ActionController::RoutingError.new('Forbidden') if !current_user.is_admin? && params[:user][:role] == 'admin'\n end", "def authorize\n if !current_user.has_role? :admin\n render text:\"No Access For You!!!\"\n end\n end", "def check_admin\n if current_user && current_user.admin\n logger.info \"[auth] Allowed for #{current_user.email}\"\n true\n else\n logger.info (\"[auth] Access Denied\")\n redirect_to new_user_session\n end\n end", "def admin_permission\n if session[:position].to_s == \"Secretary\" or\n session[:position].to_s == \"Treasurer\" or\n session[:position].to_s == \"Chairman\"\n flash[:notice] = \"RESTRICTED: you do not have access\"\n redirect_to controller: :access, action: :admin_menu, :id => session[:user_id],\n position: session[:position]\n return false\n end\n\n end", "def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end", "def check_permission\n unless current_user.is_admin == 1\n redirect_to \"/\", warning: \"You don't have permission to access that page.\"\n end\n end", "def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\n end", "def enforce_is_admin_or_is_current_user\n bounce unless is_admin? or is_current_user?\n end", "def check_admin_of\n redirect_to root_path if current_user &&\n @user != current_user &&\n !current_user.admin_of?(@user, \"can_manage_users\")\n end", "def check_access_control\n @bot = Bot.find(params[:id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @bot.account.user_id\n rescue\n response_access_denied\n end", "def only_authorize_admin!\n authorize!(is?(:admin))\n end", "def check_admin\n\t\tif current_user && current_user.role == 2\n\t\telsif current_user && current_user.role != 2\n\t\t\tredirect_to buildings_url, notice: 'You are not authorized'\n\t\telse\n\t\t\tredirect_to buildings_url, notice: 'You are not logged in'\n\t\tend\n\tend", "def allow_access\n !@current_user.nil?\n end", "def redirect_unless_user_is_admin\n unless current_user_is_admin?\n flash[:alert] = \"You do not have permission to view that page.\"\n redirect_to root_url\n end\n end", "def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end", "def authorize_admin!\n redirect_to login_path unless current_user\n end", "def restrict_user_by_role\n unless current_user and current_user.admin?\n redirect_to root_path # change this to your 404 page if needed\n end\n end", "def enforce_permissions\n bounce unless is_admin?\n end", "def require_correct_admin\n if current_user.user?\n raise ExceptionTypes::UnauthorizedError.new(\"Admin access only\")\n end\n if current_user.admin?\n raise ExceptionTypes::UnauthorizedError.new(\"You do not have permission to modify the program with ID #{@program.id}\") unless @program.admins.exists? current_user.id\n end\n end", "def verify_admin\n unless current_cas_user.admin?\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end\n end", "def check_if_admin\n redirect_to(root_path) unless @current_user.is_admin?\n end", "def check_if_admin\n redirect_to(root_path) unless @current_user.is_admin?\n end", "def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end", "def check_admin_authentication\n if session[:user] and is_admin?\n return true\n end\n # call overwriteable reaction to unauthorized access\n access_denied\n return false \n # unless session[:user] and is_admin?\n # session[:intended_action] = action_name\n # session[:intended_controller] = '/admin/' + controller_name\n # session[:intended_id] = params[:id]\n # flash[:error] = 'You must be logged in as an administrator to access this resource.'\n # redirect_to :controller => '/account', :action => 'login'\n # end\n end", "def check_admin\n if not ensure_admin\n redirect_to root_url, alert: \"you are not authorized\"\n end # end if\n end", "def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end", "def verify_super_admin\n redirect_to admin_path unless current_user.user_level == \"super_admin_access\"\n\n end", "def require_admin\n if logged_in? and !current_user.admin?\n #flash[:danger] = 'Only admin users can perform that action'\n redirect_to root_path\n end\n end", "def authorize_access\n unless can? :access_staff_functions\n # raise the error from `access_granted` to be consistent.\n raise AccessGranted::AccessDenied.new(\"Only logged-in users can access admin screens\")\n end\n end" ]
[ "0.88222015", "0.88222015", "0.88222015", "0.866782", "0.8549728", "0.8394882", "0.83055407", "0.8254307", "0.82259953", "0.8211217", "0.81752133", "0.81743896", "0.81421274", "0.812611", "0.80598855", "0.8031546", "0.80249685", "0.8015841", "0.80073714", "0.797562", "0.79746264", "0.7941914", "0.7913175", "0.79114056", "0.79114056", "0.79109997", "0.7890447", "0.78755075", "0.7869442", "0.78692114", "0.7818149", "0.78127605", "0.7798222", "0.77947485", "0.7793914", "0.7793123", "0.7785559", "0.7780724", "0.7778896", "0.7778896", "0.77758235", "0.7772643", "0.77550477", "0.7743049", "0.77391994", "0.772734", "0.77233887", "0.77218616", "0.77195394", "0.771668", "0.7705091", "0.7695622", "0.76926756", "0.767928", "0.7667978", "0.76522225", "0.7648037", "0.7636633", "0.7631525", "0.76285416", "0.76285106", "0.7601579", "0.7599997", "0.7599573", "0.7599089", "0.759061", "0.75823534", "0.7581614", "0.75763565", "0.7574484", "0.7574457", "0.7572081", "0.7569021", "0.75638413", "0.75604403", "0.75593257", "0.75514555", "0.75510883", "0.7539087", "0.7532897", "0.7529993", "0.75297457", "0.7529603", "0.7527938", "0.7527813", "0.7520416", "0.7519143", "0.75088483", "0.7504765", "0.750418", "0.75026995", "0.7502697", "0.7502697", "0.75024956", "0.74930793", "0.7492253", "0.74882746", "0.74874276", "0.7478231", "0.74771744" ]
0.8367653
6
Create callback with class error messages
def write_errors(obj, scope: false) obj.errors.map { |e| "#{t_field(e.attribute, scope || obj.class.table_name.singularize)} #{e.message}" }.join(', ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(callback)\n\t\t@error_callback = callback\n\t\treturn self\n\tend", "def on_error(msg)\n end", "def on_error(&callback)\n @on_error = callback\n end", "def on_error(&callback)\n @err_cb, @err_cb_overridden = callback, true\n end", "def on_error(&callback)\n @err_cb, @err_cb_overridden = callback, true\n end", "def register_external_error(error_class, &block)\n self.external_errors[error_class] = block\n end", "def error(*args); end", "def on_failure(object, *args); end", "def on_error *a, &b\n @on_error = EM::Callback(*a, &b)\n end", "def error_message; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error_messages=(_arg0); end", "def error_class_constant(error_code); end", "def error(description, result)\n raise \"Implement this in a sub-class\"\n end", "def error(topic, message = T.unsafe(nil), &block); end", "def errmsg(message); end", "def bold_error(*args); end", "def error=(_arg0); end", "def error=(_arg0); end", "def error=(_arg0); end", "def error msg\n puts \"#{self.class} error: #{msg}\"\n end", "def error\n end", "def error_handler()\n @error_handler\n end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def validate_callback(params)\n raise 'To be implemented in child classes'\n end", "def error_with(data, clazz = Bolt::Error)\n data = Bolt::Util.walk_keys(data, &:to_s)\n if data['msg'] && data['kind'] && (data.keys - %w[msg kind details issue_code]).empty?\n @data[:default] = clazz.new(data['msg'], data['kind'], data['details'], data['issue_code'])\n else\n $stderr.puts \"In the future 'error_with()' might require msg and kind, and \" \\\n \"optionally accept only details and issue_code.\"\n @data[:default] = data\n end\n @data_set = true\n self\n end", "def meaningful_error_message callback, model, attributes\n rv = \"Unable to #{callback} a #{model.name}\"\n if attributes and !attributes.empty?\n rv << \" with #{attributes.inspect}\"\n end\n end", "def callback\n def_deferr = ::EventMachine::DefaultDeferrable.new\n proc_callback = Proc.new { |response| ::OnesnooperServer::Log.debug(\n \"[#{self.class.name}] Handled as: #{response}\"\n ) }\n\n def_deferr.callback &proc_callback\n def_deferr.errback &proc_callback\n\n def_deferr\n end", "def on_error error\n raise error\n end", "def create_on_error(error)\n OnErrorNotification.new error\n end", "def compile_error(msg)\n end", "def error! error\n # We shouldn't need to synchronize getting the callbacks.\n error_callbacks = @error_callbacks\n error_callbacks = default_error_callbacks if error_callbacks.empty?\n error_callbacks.each { |error_callback| error_callback.call error }\n end", "def sms_error_class(&block)#:nodoc\n if yield\n SmsOnRails::FatalSmsError\n else\n SmsOnRails::SmsError\n end\n end", "def error_msg\n ERROR_MSG[upcase_class_sym]\n end", "def exception_callback\n @exception_callback\n end", "def error msg\n @error = msg\n end", "def notify_error(error)\n end", "def initialize(error_source:, error_type:, error_code:, message:)\n @error_source = error_source\n @error_type = error_type\n @error_code = error_code\n @message = message\n end", "def on_error(error_token_id, error_value, value_stack); end", "def on_error(&blk)\n @error_handler = blk\n self\n end", "def on_success(_klass, _method); end", "def error(string); end", "def error(string); end", "def on_error &block\n synchronize do\n @error_callbacks << block\n end\n end", "def raise_error(symbol, callback=nil, *args)\n ex_info = args.pop if args.last.is_a?(String)\n err_args = cb_args = nil\n case args.length\n when 1\n err_args = args[0]\n when 2\n err_args, cb_args = args[0], args[1]\n end\n @error_queue << CRDE_Errno.new(symbol, callback, err_args, cb_args, ex_info || '', caller)\n start_raise\n end", "def on_error(onError) # block\n end", "def error(*args, &block)\n add_with_options(ERROR, *args, &block)\n end", "def on_error(err)\n raise err\n end", "def on_error(&a_proc)\n @@error_block = a_proc\n end", "def error(*args)\n `#{@native}.error.apply(#{@native}, args)`\n end", "def initError(msg)\n raise ArgumentError, msg\nend", "def post_fail_message; end", "def register_failure_callback(callback)\n @duty_failure_callback = callback\n end", "def error?; end", "def error?; end", "def error?; end", "def error(message, id: T.unsafe(nil), &block); end", "def push_error_message(msg)\n push_message(:error, msg)\n end", "def push_error_message(msg)\n push_message(:error, msg)\n end", "def errback &block\n super\n end", "def errback &block\n super\n end", "def on_error_occurred(event)\n type = event[:type]\n error = event[:error]\n details = (error.backtrace || []).join(\"\\n\")\n\n case type\n when 'consumer.consume.error'\n error \"Consumer consuming error: #{error}\"\n error details\n when 'consumer.revoked.error'\n error \"Consumer on revoked failed due to an error: #{error}\"\n error details\n when 'consumer.shutdown.error'\n error \"Consumer on shutdown failed due to an error: #{error}\"\n error details\n when 'worker.process.error'\n fatal \"Worker processing failed due to an error: #{error}\"\n fatal details\n when 'connection.listener.fetch_loop.error'\n error \"Listener fetch loop error: #{error}\"\n error details\n when 'licenser.expired'\n error error\n error details\n when 'runner.call.error'\n fatal \"Runner crashed due to an error: #{error}\"\n fatal details\n when 'app.stopping.error'\n error 'Forceful Karafka server stop'\n when 'librdkafka.error'\n error \"librdkafka internal error occurred: #{error}\"\n error details\n else\n # This should never happen. Please contact the maintainers\n raise Errors::UnsupportedCaseError, event\n end\n end", "def validates_type_error_message(m, klass)\n # SEQUEL6: Make this the default behavior in validation_helpers\n if OVERRIDE_PROC.equal?(m)\n TYPE_ERROR_STRINGS[klass]\n else\n super\n end\n end", "def errors_for(_object); end", "def error(ex) [:error, ex]; end", "def failure_message_continuation; end", "def error_notification(options = T.unsafe(nil)); end", "def original_error; end", "def original_error; end", "def error(msg); @logger.error(msg); end", "def initialize(error_type, error_code, error_message, display_message, request_id)\n @error_type = error_type\n @error_code = error_code\n @error_message = error_message\n @display_message = display_message\n @request_id = request_id\n\n super \"\\n\"\\\n \"Error Type : #{@error_type}\\n\"\\\n \"Error Code : #{@error_code}\\n\"\\\n \"Error Message : #{@error_message}\\n\"\\\n \"Display Message : #{@display_message}\\n\"\\\n \"Request ID : #{@request_id}\\n\"\n end", "def print_error_message text, aconfig={}, &block\n _print_message :error, text, aconfig, &block\nend", "def callback\n\n end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def load_error=(_arg0); end", "def reify\n klass = Bumbleworks::Support.constantize(error_class_name)\n err = klass.new(message)\n err.set_backtrace(backtrace)\n err\n end", "def initialize(callback)\n @callback = callback\n end", "def error(exception) nil ; end", "def handle_error(msg)\n @errors[msg] = true\nend", "def ensure_cb\n @ensure_cb ||= (@failure_cb || lambda { |error| raise \"#{error.code.name}: #{error.message}\" })\n end", "def error code=nil, message=nil\n if code\n error = Lux::Error.new code\n error.message = message if message\n raise error\n else\n Lux::Error::AutoRaise\n end\n end", "def add_error(msg)\n add_msg \"* Error: #{msg}\"\n end", "def failure_message; end", "def failure_message; end" ]
[ "0.6899007", "0.6537324", "0.6487436", "0.6447234", "0.64094627", "0.62947094", "0.6255419", "0.62044114", "0.61081165", "0.6088684", "0.6060702", "0.6060702", "0.6060702", "0.6060702", "0.6060702", "0.6060702", "0.6060702", "0.6060429", "0.6024313", "0.5989172", "0.59728223", "0.59722435", "0.59699196", "0.594554", "0.594554", "0.594554", "0.5908249", "0.5898829", "0.5887354", "0.5887026", "0.5887026", "0.5887026", "0.5887026", "0.58783543", "0.5857774", "0.5852214", "0.58063823", "0.5787456", "0.57781166", "0.57721335", "0.5769917", "0.5743987", "0.57274127", "0.57079434", "0.5707822", "0.57068926", "0.5685867", "0.56715316", "0.566888", "0.5662255", "0.5661874", "0.5661874", "0.5661271", "0.56501305", "0.564666", "0.5645053", "0.5639392", "0.56393224", "0.5631711", "0.56277156", "0.5609772", "0.55978405", "0.5580596", "0.5580596", "0.5580596", "0.5573004", "0.55670536", "0.55670536", "0.55666447", "0.55666447", "0.55633754", "0.5555968", "0.5554618", "0.55432546", "0.5540735", "0.5540415", "0.55353016", "0.55353016", "0.5534739", "0.5520816", "0.5510854", "0.5510521", "0.5497661", "0.5497661", "0.5497661", "0.5497661", "0.5497661", "0.5497661", "0.5497661", "0.5497661", "0.5497661", "0.54959", "0.54813844", "0.54704916", "0.54655236", "0.5460192", "0.5459881", "0.5458291", "0.5453655", "0.545184", "0.545184" ]
0.0
-1
Set locale from `params[:locale]`. If params[:locale] is unset or is not available, the method set the default locale
def set_locale I18n.locale = params[:locale] || I18n.default_locale end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_locale\n I18n.locale = params[:locale] unless params[:locale].blank?\n end", "def set_locale\n I18n.locale = params[:locale] unless params[:locale].blank?\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale]\n end", "def set_locale\n # if params[:locale] is nil then I18n.default_locale will be used\n I18n.locale = params[:locale]\n end", "def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end", "def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end", "def set_locale\n case params[:locale]\n when \"it\", \"en\"\n I18n.locale = params[:locale]\n else\n I18n.locale = I18n.default_locale\n end\n end", "def set_locale\n I18n.locale = params[:locale]\n end", "def set_locale\n I18n.locale = params[:locale]\n end", "def set_locale\n available = %w{en de}\n I18n.locale = params[:locale] || request.compatible_language_from(available)\n end", "def set_locale\n I18n.default_locale = :pt_BR\n I18n.locale = params[:locale] unless params[:locale].blank?\n I18n.locale = I18n.default_locale if params[:locale].blank?\n end", "def set_locale\n if params[:locale]\n I18n.locale = session[:locale] = params[:locale] || I18n.default_locale\n else\n I18n.locale = session[:locale] || I18n.default_locale\n end\n end", "def set_locale\n \tI18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n if params[:locale].nil?\n if current_user && I18n.available_locales.include?(current_user.locale.to_sym)\n I18n.locale = current_user.locale\n else\n I18n.locale = I18n.default_locale\n end\n elsif I18n.available_locales.include? params[:locale].to_sym\n I18n.locale = params[:locale]\n else\n flash_now(:notice, I18n.t('locale_not_available', locale: params[:locale]))\n end\n end", "def set_locale \n locale = params[:locale]\n locale ||= request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first if request.env['HTTP_ACCEPT_LANGUAGE']\n I18n.locale = (locale && I18n.available_locales.include?(locale.to_sym)) ? locale : I18n.default_locale\n end", "def set_locale\n \tI18n.locale = params[:locale] if params[:locale].present? \n end", "def set_locale\n # if params[:locale] is nil then I18n.default_locale will be used\n I18n.locale = 'en'\n\n # if params[:locale].present? || session[:locale].present?\n # session[:locale] = params[:locale] if params[:locale].present?\n # I18n.locale = session[:locale]\n # else\n # logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n # I18n.locale = extract_locale_from_accept_language_header\n # logger.debug \"* Locale set to '#{I18n.locale}'\"\n # end\n end", "def set_locale\n I18n.locale = params[:locale] \n end", "def set_locale\n # Either through a param, that has highest priority\n locale = if params[:locale]\n params[:locale].to_s\n # Then let's check the browser if there was no param\n elsif accept_language = request.env['HTTP_ACCEPT_LANGUAGE']\n # TODO: Facebook would like to have the country when using authentication there. We should save the browser country somewhere.\n accept_language.scan(/^[a-z]{2}/).first.to_s\n end\n I18n.locale = locale if locale.present? and I18n.available_locales.include?(locale.to_sym)\n end", "def set_locale\n if params[:locale].nil?\n if session[:locale].nil?\n I18n.locale = :ar\n else\n I18n.locale = session[:locale]\n end\n else\n I18n.locale = params[:locale]\n session[:locale] = params[:locale]\n end\n end", "def set_locale\n if params[:locale].nil?\n I18n.locale = session[:locale].nil? ? :ar : session[:locale]\n else\n I18n.locale = params[:locale]\n session[:locale] = params[:locale]\n end\n end", "def set_locale\n #I18n.locale = params[:lang] ? params[:lang] : I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] if params[:locale].present?\n # \"en\"\n # params[:locale] if params[:locale].present?\n # current_user.locale\n # request.subdomain\n # request.env[\"HTTP_ACCEPT_LANGUAGE\"]\n # request.remote_ip\n end", "def set_locale\n \n #raise \"params[:locale] = #{params[:locale].present?}\"\n #raise \"params[:locale] = #{params[:locale].blank?}\"\n # Se non ho assegnato il parametro :locale allora gli passo la lingua impostata sul browser \n # (per testare usa Google chrome Extension: Locale Switcher)\n params[:locale] = request.env.fetch('HTTP_ACCEPT_LANGUAGE', '').scan(/[a-z]{2}/).first if params[:locale].blank?\n #raise \"params[:locale] = #{params[:locale]}\"\n\n case params[:locale]\n when \"it\", \"en\"\n I18n.locale = params[:locale]\n else\n I18n.locale = I18n.default_locale\n end\n end", "def set_locale\n I18n.select_locale( params[:locale], session[:locale], I18n.from_http_header(request) )\n logger.info \"Using language: #{I18n.locale}\"\n session[:locale] = I18n.locale\n end", "def set_locale\n # force by params\n if params[:locale] && WEB_LOCALES_SUPPORT.include?(params[:locale])\n I18n.locale = params[:locale]\n session[:locale] = params[:locale]\n cookies[:locale] = params[:locale]\n elsif session[:locale] && WEB_LOCALES_SUPPORT.include?(session[:locale])\n # get from session\n I18n.locale = session[:locale]\n elsif cookies[:locale] && WEB_LOCALES_SUPPORT.include?(cookies[:locale])\n # get from session\n I18n.locale = cookies[:locale]\n else\n I18n.locale = DEFAULT_WEB_LOCALE\n end\n\n @current_locale = I18n.locale\n @current_locale_string = t('locale.' + I18n.locale.to_s, default: 'Not define language')\n end", "def set_locale\n I18n.locale = extract_locale_from_accept_language_header || I18n.default_locale\n # I18n.locale = params[:locale] if params[:locale].present?\n end", "def set_locale\n if params[:set_locale]\n if I18n.available_locales.include?(params[:set_locale].to_sym)\n I18n.locale = params[:set_locale]\n else\n flash.now[:notice] = \"#{params[:set_locale]} translations not available\"\n logger.error flash.now[:notice]\n end\n end\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\nend", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\nend", "def set_locale(locale = nil)\n current_user_language = current_user ? current_user.language : nil\n tlc = locale || current_user_language # || 'en'\n #logger.debug \"\\n===> #{tlc}\\n\"\n I18n.locale = tlc\n end", "def set_locale(locale)\n # Parse the HTTP GET header for languages and create an array\n # from them\n locales = ::R18n::I18n.parse_http(request.env['HTTP_ACCEPT_LANGUAGE'])\n\n # If we passed in a locale param, put it at the front of the\n # locales array\n if ((locale.is_a? String) && !(locale.empty?))\n locales.insert(0, locale)\n end\n\n # R18N locale setter\n ::R18n.thread_set do\n if Settings[:DEFAULT_LOCALE]\n ::R18n::I18n.default = Settings[:DEFAULT_LOCALE]\n end\n \n ::R18n::I18n.new(locales, ::R18n.default_places,\n :off_filters => :untranslated, :on_filters => :untranslated_html)\n end\n \n begin\n # We depend on lang-locale, not just lang code.\n # If we get a 2 letter lang code, dupe it so that\n # de becomes de-de\n # unless it's en, then we want en-us\n # or ja then we want ja-jp\n if (locales[0].length == 2)\n case locales[0].downcase\n when \"en\"\n return \"en-us\"\n when \"ja\"\n return \"ja-jp\"\n else\n return \"#{locales[0].downcase}-#{locales[0].downcase}\"\n end\n else\n return locales[0].downcase\n end\n rescue\n return Settings[:DEFAULT_LOCALE]\n end\n end", "def set_locale\n locale = params[:locale] || session[:locale] ||\n # (current_user.site_language if user_signed_in?) ||\n I18n.default_locale\n locale = AVAILABLE_LOCALES.keys.include?(locale) ? locale : I18n.default_locale\n session[:locale] = I18n.locale = locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n #Rails.application.routes.default_url_options[:locale]= I18n.locale \n end", "def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end", "def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end", "def set_locale\n session[:locale] = params[:locale]\n session[:locale] ||= extract_locale_from_header\n# return switch_locale_and_redirect_to_referer if params[:locale].present?\n @locale = Locale.new session[:locale]\n I18n.locale = @locale.current\n end", "def set_locale\n if params[:locale].present?\n # Allow changing the locale by passing a locale parameter when making\n # the request.\n locale = params.delete(:locale).to_s\n\n # A temporary workaround for Backbone including ?locale=... in its\n # routes; we should probably add /:locale/... instead, or a single\n # actions which changes the locale to avoid having to manually remove\n # the locale param in every Backbone action.\n locale.gsub! /\\.json/, ''\n\n locale = I18n.default_locale unless AVAILABLE_LOCALES.include?(locale)\n\n session[:locale] = locale\n\n elsif session[:locale].blank?\n # No locale set yet; first visit. Use the Accept-Language header to\n # infer what they want.\n session[:locale] =\n http_accept_language.compatible_language_from(AVAILABLE_LOCALES)\n end\n\n I18n.locale = session[:locale]\n end", "def set_locale\n logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n I18n.locale = params[:locale] || locale_from_header || I18n.default_locale\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n end", "def set_locale\n I18n.locale = cookies[:locale] || params[:locale] || http_accept_language.compatible_language_from(I18n.available_locales) || I18n.default_locale\n end", "def set_locale\n rxp = Regexp.new('[a-zA-Z]{2}')\n user_locale = cookies[:locale] || params[:locale]\n user_locale = user_locale.present? ? user_locale.scan(rxp) : 'en'\n # Check, is this locale available for using.\n # Please note: this needed for disable invalid locale warning.\n available = I18n.available_locales.include?(user_locale[0].to_sym)\n I18n.locale = available ? user_locale[0] : 'en'\n end", "def default_locale=(locale); end", "def set_locale\n if params[:locale]\n cookies[:locale] = params[:locale]\n redirect_to request.referer || root_url\n end\n I18n.locale = cookies[:locale] || I18n.default_locale\n end", "def set_locale\n locales = ['en', 'en-AU']\n begin\n # Try to auto-detect it\n if request.headers['Accept-Language']\n browser_language = request.headers['Accept-Language'].split(',')[0] \n browser_language = browser_language.split('-')[0] + '-' + browser_language.split('-')[1].upcase\n session[:locale] = browser_language\n end\n session[:locale] = params[:locale] if params[:locale]\n session[:locale] = 'en-AU' if session[:locale] == 'en-GB'\n I18n.locale = locales.include?(session[:locale]) ? session[:locale] : I18n.default_locale\n rescue\n I18n.locale = I18n.default_locale\n end\n end", "def set_locale\n if I18N_SUPPORTED_LOCALES.include?( params[:locale] )\n if logged_in?\n current_user.update_attribute(:locale, params[:locale])\n end\n session[:locale] = params[:locale]\n end\n redirect_back_or_default( root_url )\n end", "def set_locale\n# logger.debug \"* Locale currently is '#{I18n.locale}', params[:locale] = '#{params[:locale] }'\"\n# logger.debug \"* cookies[:locale] = '#{cookies[:locale] }', HTTP_ACCEPT_LANGUAGE: '#{request.env[\"HTTP_ACCEPT_LANGUAGE\"] }'\"\n accept_locales = LOCALES.keys # See config/application.rb for accepted LOCALES\n\n locale = params[:locale] if accept_locales.include?( params[:locale] )\n if locale.nil? # Use the cookie only when set or enabled\n locale = cookies[:locale] if accept_locales.include?( cookies[:locale] )\n else # Store the chosen locale when it changes\n cookies[:locale] = locale\n end\n\n current_locale = locale || I18n.default_locale # This covers also the default case when cookies are not enabled\n unless current_locale.nil?\n I18n.locale = to_safe_sym( current_locale, accept_locales )\n logger.debug \"* Locale is now set to '#{I18n.locale}'\"\n end\n end", "def set_locale\n# logger.debug \"* Locale currently is '#{I18n.locale}', params[:locale] = '#{params[:locale] }'\"\n# logger.debug \"* cookies[:locale] = '#{cookies[:locale] }', HTTP_ACCEPT_LANGUAGE: '#{request.env[\"HTTP_ACCEPT_LANGUAGE\"] }'\"\n accept_locales = LOCALES.keys # See config/application.rb for accepted LOCALES\n\n locale = params[:locale] if accept_locales.include?( params[:locale] )\n if locale.nil? # Use the cookie only when set or enabled\n locale = cookies[:locale] if accept_locales.include?( cookies[:locale] )\n else # Store the chosen locale when it changes\n cookies[:locale] = locale\n end\n\n current_locale = locale || I18n.default_locale # This covers also the default case when cookies are not enabled\n unless current_locale.nil?\n I18n.locale = to_safe_sym( current_locale, accept_locales )\n logger.debug \"* Locale is now set to '#{I18n.locale}'\"\n end\n end", "def set_locale\n\t # if params[:locale] is nil then I18n.default_locale will be used\n \t\tlocale = params[:locale] || 'pt'\n\t \tI18n.locale = locale\n \t\tI18n.load_path += Dir[ File.join(Rails.root.to_s, 'lib', 'locale', '*.{rb,yml}') ]\n\tend", "def set_i18n\n if params[:locale]\n if I18n.available_locales.include?(params[:locale].to_sym)\n I18n.locale = params[:locale]\n else\n flash.now[:notice] = \"#{params[:locale]} not available\"\n logger.error flash.now[:notice]\n end\n end\n end", "def set_i18n_locale_from_params\n if params[:locale]\n if I18n.available_locales.map(&:to_s).include?(params[:locale])\n I18n.locale = params[:locale]\n else\n flash.now[:notice] =\n \"#{params[:locale]} translation not available\"\n logger.error flash.now[:notice]\n end\n end\n end", "def set_locale\n accept_locales = LOCALES.keys # change this line as needed, must be an array of strings\n cookies[:locale] = params[:locale] if accept_locales.include?(params[:locale])\n Locale.set(cookies[:locale] || (request.env[\"HTTP_ACCEPT_LANGUAGE\"] || \"\").scan(/[^,;]+/).find{|l| accept_locales.include?(l)})\n end", "def set_locale\n DmCore::Language.locale = (params[:locale].presence || current_account.preferred_default_locale)\n rescue I18n::InvalidLocale\n # if it's an invalid locale, append the default locale and try again\n # this also fixes the case of using simple link names on a home page.\n # So if home page is \"http://example.com\" and the link is <a href=\"calendar\">\n # then the link is \"http://example.com/calendar\", instead of \"http://example.com/en/calendar\"\n # This will allow that to work.\n redirect_to \"/#{current_account.preferred_default_locale}#{request.path}\"\n end", "def set_i18n_locale_from_params\n if params[:locale]\n if I18n.available_locales.map(&:to_s).include?(params[:locale])\n I18n.locale = params[:locale]\n else\n flash.now[:notice] = \n \"#{params[:locale]} translation not available\"\n logger.error flash.now[:notice]\n end\n end\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n if logged_in?\n if !current_user.shainmaster.setting.nil?\n if !current_user.shainmaster.setting.local.nil? && current_user.shainmaster.setting.local != ''\n I18n.locale = current_user.shainmaster.setting.local\n end\n end\n end\n end", "def set_locale\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\">>>>\"}\n\t\t#puts \"set_locale:params[:locale]=#{params[:locale]}\"\n\t\tif params[:locale]\n\t\t\tI18n.locale = params[:locale]\n\t\t\tsession[:lng] = I18n.locale\n\t\telse\n\t\t\tunless @current_user.nil?\n\t\t\t\t#puts \"set_locale:@current_user=#{@current_user} lng=#{@current_user.language}\"\n\t\t\t\tI18n.locale = @current_user.language\n\t\t\telse\n\t\t\t\tif session[:lng]\n\t\t\t\t\tI18n.locale = session[:lng]\n\t\t\t\telse\n\t\t\t\t\tI18n.locale = PlmServices.get_property(:LOCAL_DEFAULT)\n\t\t\t\t\tsession[:lng] = I18n.locale\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tLOG.debug(fname) {\"<<<<session=#{session}\"}\n\tend", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n Rails.application.routes.default_url_options[:locale]= I18n.locale\n end", "def set_locale\n\t\t\tif current_user.present? && current_user.locales.present? && current_user.locales.count == 1\n\t\t\t\tI18n.locale = params[:locale] || current_user.locales.first || I18n.default_locale\n\t\t\telse\n\t\t\t\tI18n.locale = params[:locale] || I18n.default_locale\n\t\t\tend\n\t\tend", "def set_locale\n @locale = Locale.find(params[:id])\n end", "def set_translation\n if params[:locale].blank? && session[:current_locale].present?\n ::I18n.locale = session[:current_locale]\n elsif params[:locale].present? && ::I18n.available_locales.include?(params[:locale].to_sym)\n session[:current_locale] = ::I18n.locale = params[:locale]\n elsif current_alchemy_user && current_alchemy_user.respond_to?(:language) && current_alchemy_user.language.present?\n ::I18n.locale = current_alchemy_user.language\n else\n ::I18n.locale = request.env['HTTP_ACCEPT_LANGUAGE'].try(:scan, /^[a-z]{2}/).try(:first) || ::I18n.default_locale\n end\n end", "def locale=(value)\n @locale = value\n end", "def locale=(value)\n @locale = value\n end", "def set_locale\n I18n.locale = set_locale_from_params || I18n.default_locale\n Rails.application.routes.default_url_options[:locale]= I18n.locale\n end", "def set_locale\n @current_user = User.find_user(session)\n puts \"set_locale:params[:locale]=#{params[:locale]}\"\n if params[:locale]\n I18n.locale = params[:locale]\n session[:lng] = I18n.locale\n else\n unless @current_user.nil?\n puts \"set_locale:@current_user=#{@current_user} lng=#{@current_user.language}\"\n I18n.locale = @current_user.language\n else\n if session[:lng]\n I18n.locale = session[:lng]\n else\n I18n.locale = PlmServices.get_property(:LOCAL_DEFAULT)\n session[:lng] = I18n.locale\n end\n end\n end\n puts \"fin de set_locale\"\n end", "def set_locale\n accept_language = request.headers['Accept-Language']\n return if accept_language.blank?\n\n available = %w{en ja}\n accept_language.split(',').each do |locale_set|\n locale = locale_set.split(';').first\n if available.include?(locale)\n I18n.locale = locale\n break\n end\n end\n end", "def set_locale\n # session[:locale] = params[:locale] if params[:locale]\n # session[:locale] = \"zh\" if session[:locale].blank?\n # session[:locale] = \"zh\"\n # I18n.locale = session[:locale] || I18n.default_locale\n I18n.locale = 'zh'\n end", "def set_locale\n if current_user.blank?\n I18n.locale = valid_language\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n else\n # TODO: Let user decide which language - to high prio in keytech environment\n I18n.locale = 'de' # current_user.language_id\n end\n end", "def set_locale\n available = TRANSLATIONS.map(&:code)\n if cookies[:locale] && available.include?(cookies[:locale])\n selected = cookies[:locale]\n end\n I18n.locale = selected ||\n http_accept_language.preferred_language_from(available) ||\n I18n.default_locale\n end", "def locale=(locale)\n @@default_locale = locale\n end", "def set_locale\n end", "def set_language\n I18n.locale = params[:locale] || I18n.default_locale\n @lang = Wzs::Multilang::get_language(I18n.locale)\n end", "def set_locale\n I18n.locale = params[:locale] || session[:locale] || I18n.default_locale\n \n #update session\n session[:locale] = I18n.locale\n #I18n.locale = current_user.locale if user_signed_in?\n # current_user.locale\n # request.domain\n # request.env[\"HTTP_ACCEPT_LANGUAGE\"]\n # request.remote_ip\n end", "def set_locale\n session[:locale] = params[:locale] if params[:locale]\n I18n.locale = session[:locale] || I18n.default_locale\n locale_path = \"#{LOCALES_DIRECTORY}#{I18n.locale}.yml\"\n unless I18n.load_path.include? locale_path\n I18n.load_path << locale_path\n I18n.backend.send(:init_translations)\n end\n rescue Exception => err\n logger.error err\n flash.now[:notice] = \"#{I18n.locale} translation not available\"\n I18n.load_path -= [locale_path]\n I18n.locale = session[:locale] = I18n.default_locale\n end", "def set_locale\n # This requires a user model to work. I'm assuming there will be a \"current_user\" helper.\n # If we decide to use Devise, that will be default.\n # I18n.locale = current_user.language || I18n.default_locale\n end", "def set_locale\n if current_user.blank?\n I18n.locale = valid_language\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n else\n I18n.locale = current_user.language_id\n end\n end", "def set_locale\n I18n.locale = 'en'\n return\n\n # working, but disabled until translations are done\n logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n I18n.locale = extract_locale_from_accept_language_header\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n end", "def locale=(locale)\n Thread.current[:locale] = locale.to_s\n end", "def locale=(locale); end", "def set_locale\n I18n.locale = request.env[\"omniauth.params\"].try(:[], \"locale\") || I18n.default_locale\n end", "def set_locale\n new_locale = find_matching_locale(extract_locale_from_subdomain || extract_locale_from_url)\n unless new_locale.nil?\n I18n.locale = new_locale\n else\n I18n.locale = I18n.default_locale\n end\n end", "def set_locale\n session['locale'] = params[:locale]\n changed = session['locale'] != current_locale\n I18n.locale = session['locale']\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.js\n end\n end", "def set_locale\n I18n.locale = extract_locale || session[:locale] || I18n.default_locale\n session[:locale] = I18n.locale\n end", "def set_locale_old\n locales = ['en', 'en-AU']\n begin\n # Try to auto-detect it\n if request.headers['Accept-Language']\n browser_language = request.headers['Accept-Language'].split(',')[0]\n browser_language = browser_language.split('-')[0] + '-' + browser_language.split('-')[1].upcase\n session[:locale] = browser_language\n end\n session[:locale] = params[:locale] if params[:locale]\n session[:locale] = 'en-AU' if session[:locale] == 'en-GB'\n I18n.locale = locales.include?(session[:locale]) ? session[:locale] : I18n.default_locale\n rescue\n I18n.locale = I18n.default_locale\n end\n end", "def set_locale\n logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n I18n.locale = extract_locale_from_accept_language_header\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n end" ]
[ "0.90261346", "0.8853055", "0.88080835", "0.88080835", "0.88080835", "0.88080835", "0.8760363", "0.8751386", "0.87031233", "0.87031233", "0.8619787", "0.8600404", "0.8600404", "0.857675", "0.8511656", "0.84921473", "0.8465301", "0.84501964", "0.8448386", "0.84357655", "0.8408832", "0.83973104", "0.8374755", "0.83504564", "0.83354443", "0.83067435", "0.8250907", "0.8242155", "0.8230395", "0.8208944", "0.82016444", "0.8169588", "0.8136306", "0.8136306", "0.81300247", "0.8129601", "0.8095194", "0.8093831", "0.8092701", "0.80739176", "0.8055543", "0.80333394", "0.8029632", "0.8022059", "0.80100316", "0.79634225", "0.79601365", "0.79313064", "0.7912996", "0.7894069", "0.7894069", "0.7865986", "0.78492826", "0.7836639", "0.7826452", "0.78179187", "0.7806012", "0.77912015", "0.77861845", "0.7784087", "0.77825934", "0.77573526", "0.77539873", "0.7730831", "0.7730831", "0.770503", "0.7701707", "0.7682158", "0.7673467", "0.76660126", "0.76634836", "0.7661621", "0.7633884", "0.762829", "0.76251626", "0.7606846", "0.7593794", "0.75791967", "0.7555306", "0.7547346", "0.7532944", "0.74997854", "0.74981886", "0.7478753", "0.7477804", "0.7429601", "0.74228686" ]
0.86990297
22
Render 404 page and stop the work
def record_not_found! render partial: 'errors/404', status: 404 && return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_404\n render 'web/404', status: 404\n end", "def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end", "def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end", "def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end", "def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end", "def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end", "def render_404 \n render :file => \"/public/404.html\", :status => 404,:layout => false\n end", "def render_404\n render file:\"#{Rails.root}/public/404.html\", status:404, layout:false\n end", "def render_404\n render file: \"public/404.html\", layout: false\n end", "def not_found\n\trender :file => 'public/404.html', :status => :not_found, :layout => false\nend", "def render_404\n render :template => \"errors/404\", :status => :not_found, :layout => false\n end", "def render_404\n render_optional_error_file(404)\n end", "def render_not_found(exception)\n render :file => 'public/404', :format => :html, :status => :not_found, :layout => nil\n end", "def render_not_found(exception)\n render :file => 'public/404', :format => :html, :status => :not_found, :layout => nil\n end", "def record_not_found\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: :not_found\n end", "def not_found\n render file: 'public/404.html', status: :not_found, layout: false\n end", "def record_not_found\n render :file => Rails.root.join('public','404.html'), :status => \"404 Not Found\", layout: false\n end", "def record_not_found\n \t\trender :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n \tend", "def not_found\n #render :file => \"#{RAILS_ROOT}/public/404.html\"\n render_optional_error_file(404)\n return false\n end", "def render_404 \n render file: \"public/404.html\", status: 404\n end", "def render_404\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: 404\n end", "def record_not_found\n render file: 'public/404.zh-TW.html', stats: :not_found\n end", "def not_found\n \trender file: \"#{Rails.root}/public/404.html\", layout: true, status: 404\n end", "def render_404\n render(\"#{RAILS_ROOT}/public/404.html\", :status => 404)\n end", "def render_404\n render file: \"#{::Rails.root}/public/404.html\",\n status: '404 Not Found',\n layout: false\n end", "def page_not_found\n render file: Rails.root.join('public', '404.html'), status: :not_found, layout: false\n end", "def not_found\n render :template => \"shared/rescues/not_found\", :status => 404 \n end", "def error_404\n # The default router already logs things, so we don't need to do more.\n # You can do something like this to log more information, but be sure\n # to escape attacker data to counter log forging:\n # logger.info 'Page not found'\n render(\n template: 'static_pages/error_404',\n formats: [:html], layout: false,\n status: :not_found\n )\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def render_404\n render \"404\", :status => 404\n end", "def render_404\n render template: '/shared/record_not_found', layout: false, status: :not_found\n end", "def render_404\n render file: Rails.root.join('public/404.html'), status: 404, layout: false, content_type: 'text/html'\n end", "def handle_not_found(exception = nil)\n render \"shared/not_found\".freeze, status: 404\n end", "def render_404\n render file: \"#{Rails.root}/public/404.html\", status: 404, layout: false, content_type: 'text/html'\n end", "def render_404\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n \trender file: \"#{Rails.root}/public/404.html\", status: 404\n end", "def render_404!\n render :file => File.join(Rails.root, 'public', '404.html'), :status => 404, :layout => false\n return true\n end", "def render_404 \n render :file => \"/public/404.html\", :status => 404\n end", "def render_404\n redirect_to not_found_path\n end", "def render_missing\r\n RenderError.new('404')\r\n end", "def render_404\n render :file => \"#{Rails.root.to_s}/public/404\", :formats => [:html], :status => 404\n true\n end", "def record_not_found\n render :file => File.join(::Rails.root.to_s, 'public', '404.html'), :status => 404\n end", "def rescue404\n render 'public/404'\n end", "def render_404\n render :text => '404 Error: not found', :status => 404 \n end", "def not_found\n render nothing: true, status: 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def render_missing_page\n render :template => \"error/404\", :status => 404\n end", "def render_404\n render :file => \"#{Rails.root}/public/404.html\", :status => 404\n end", "def page_not_found\n render_404\n end", "def not_found\n render file: 'public/404', status: 404, formats: [:html]\n end", "def not_found\n render file: \"#{Rails.root}/public/404\", layout: true, status: :not_found\n end", "def not_found\n render :nothing => true, :status => 404\n end", "def routing\n\trender :file => \"#{Rails.root}/public/404.html\", :status => 404, :layout =>true\n end", "def page_not_found\n render 'shared/http_status', formats: [:html], locals: { code: '404', message: HttpStatusHelper::ERROR_CODE['message']['404'] }, status: 404, layout: false\n end", "def handle_not_found(request, response)\n response.flush\n response.status = 404\n\n response.layout = \"layouts/exception\" if Harbor::View.exists?(\"layouts/exception\")\n\n if Harbor::View.exists?(\"exceptions/404.html.erb\")\n response.render \"exceptions/404.html.erb\"\n else\n response.puts \"The page you requested could not be found\"\n end\n\n raise_event(:not_found, Events::NotFoundEvent.new(request, response))\n end", "def not_found\n logger.error \"404 from #{request.referer}\"\n render :template => 'errors/404', :status => 404\n end", "def passthru\n render :file => \"#{Rails.root}/public/404.html\", :status => 404, :layout => false\n end", "def render_404 message=nil\n if message\n render :text => message, :status => 404\n else\n render :file => \"public/404.html\", :status => 404\n end\n end", "def not_found\n render :file => (Rails.root + \"public/404.html\").to_s\n true\n end", "def render_404\n render_error(\"The remote resource was not found\")\n end", "def error_404\n # Note: If you want to separate your view logic from \n # your controller logic you will need to use render_file\n # - simply using a view does not work when the 404 is\n # generated by a path not mapped to this controller.\n #\n # Keep in mind that render_file takes a full path -\n # so you should use something like 'Ramaze.options.views[0]'\n # to get at your view directory\n event(:status_404)\n render_file(\"#{Ramaze.options.views[0]}/error_404.xhtml\")\n end", "def rescue_not_found\n render nothing: true, status: 404\n end", "def render_record_not_found\n render :template => \"error/404\", :status => 404\n end", "def render_not_found\n\n respond_to do |message|\n \n message.html{ render :template => \"errors/404\", :status => 404 }\n \n end\n\n end", "def render_404(exception=nil)\n if exception\n logger.error \"Rendering 404 with exception: #{exception.message}\"\n logger.error exception.backtrace.join(\"\\n\")\n end\n breadcrumbs.clear\n @error = [404, 'Not Found']\n render status: 404, template: 'errors/default.html'\n end", "def show\n if false\n else\n render :file => \"/public/404.html\",:status => \"404\" \n end\n end", "def error_404\n render 'error/error404'\n end", "def not_found\n render status: :not_found\n end", "def show_404\n show_error 'Page Not Found', :not_found\n end", "def render_404(exception = nil)\n if exception\n logger.info \"Rendering 404 with exception: #{exception.message}\"\n end\n\n respond_to do |format|\n format.html { render :file => \"#{Rails.root}/public/404.html\", :status => :not_found, :layout => false }\n format.xml { head :not_found }\n format.any { head :not_found }\n end\n end", "def not_found\n render :status => 404\n end", "def handle_resource_not_found(msg = 'Not found.')\r\n flash.now[:notice] = msg\r\n @web_analytics.page_stack = ['Admin', 'Resource Not Found']\r\n @web_analytics.error_page = true\r\n @left_rail_ad_pixels = -1 # make sure no ads are shown\r\n render :template => 'common/resource_not_found', :status => 404, :layout => 'application'\r\n false\r\n end", "def not_found\n render_error status: :not_found, body: 'page not found'\n end", "def rescue_not_found\n render \"#{Rails.root}/public/404.html\", status: 404\n end", "def rescue_not_found\n render \"#{Rails.root}/public/404.html\", status: 404\n end", "def render_404\n respond_to do |format|\n format.html { render :file => \"#{Rails.root}/public/404\", :layout => false, :status => :not_found }\n format.xml { head :not_found }\n format.any { head :not_found }\n end\n end", "def blank; render :plain => \"Not Found.\", :status => 404 end", "def render_404\n render 'errors/index_404'\n end", "def render_not_found(exception = nil)\n\trespond_to do |format|\n\t\tformat.html{\t\n\t\t\trender :file => \"/app/views/errors/404.html.erb\", :status => 404, :layout => \"application\"\t\n\t\t}\n\t\tformat.xml { head :not_found }\n\t\tformat.any { head :not_found }\t\n\tend\n end", "def render_404\n render json: {\n message: '404 Not Found',\n details: exception.error_codes\n }, status: 404\n end", "def render_404(exception = nil)\n if exception\n logger.info \"Rendering 404 with exception: #{exception.message}\"\n end\n\n respond_to do |format|\n format.html { render :file => \"#{Rails.root}/public/404.html\", :status => :not_found }\n format.xml { head :not_found }\n format.any { head :not_found }\n end\n end", "def handle_404(exception = env[\"action_dispatch.exception\"])\n @page_title = t('errors.page_not_found')\n respond_to do |f|\n f.html do\n if request.xhr?\n render :json => { :error => I18n.t('application.page_not_found') }.to_json, :status => 404\n else\n set_view_paths\n if (error_404_url_alias = Settler[:error_page_404]).present? && @node = Node.find_by_url_alias(error_404_url_alias)\n @page = @node.content\n render :template => 'pages/show', :status => :not_found\n else\n render :template => 'errors/404', :status => :not_found\n end\n end\n end\n f.any(:xml, :js, :atom, :rss) { head 404 }\n f.json { render :json => { :error => I18n.t('application.page_not_found') }.to_json, :status => 404 }\n f.all { render :nothing => true, :status => :not_found }\n end\n end", "def render_404(exception = nil)\n @not_found_path = exception.message if exception\n respond_to do |format|\n format.html { render template: 'errors/not_found', layout: 'application', status: 404 }\n format.all { render nothing: true, status: 404 }\n end\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n rescue\n render_404\n end", "def render_404\n respond_to do |wants|\n wants.html do\n render(:template => \"#{DynamicErrors.config[:view_path]}/404\",\n :layout => DynamicErrors.config[:layout], :status => 404)\n end\n # TODO should have a response for XML and JSON requests?\n wants.all do\n render :nothing => true, :status => 404\n end\n end\n return true\n end", "def redirect_to_error\n render 'posts/404', :status => 404, :layout => false and return\n end", "def error_render_method\n render :template => \"public/404\", :status => 404, :layout => false\n true\n end", "def render_not_found(thing = nil)\n content = Rails.root.join('public/404.html').read\n\n unless thing.nil?\n # Swap out the word \"page\" for something else, when appropriate.\n document = Nokogiri::HTML.parse(content)\n header = document.at_css('h1')\n header.content = header.content.sub(/\\bpage\\b/, thing)\n\n content = document.to_s\n end\n\n render(\n html: content.html_safe,\n status: :not_found,\n layout: false\n )\n\n true\n end", "def render_not_found(thing = nil)\n content = Rails.root.join('public/404.html').read\n\n unless thing.nil?\n # Swap out the word \"page\" for something else, when appropriate.\n document = Nokogiri::HTML.parse(content)\n header = document.at_css('h1')\n header.content = header.content.sub(/\\bpage\\b/, thing)\n\n content = document.to_s\n end\n\n render(\n html: content.html_safe,\n status: :not_found,\n layout: false\n )\n\n true\n end", "def error_404(exception=nil)\n @meta_title = \"The page you were looking for doesn't exist (404)\"\n render :template => '/errors/404', :formats => [:html], :status => 404\n return false\n end", "def response_not_found\n render status: 404,\n json: {\n source: {\n pointer: request.original_url\n },\n errors: [ { message: \"Not Found\" } ]\n }\n end", "def halt_not_found(exception)\n halt 404, json({ message: exception.reason })\n end" ]
[ "0.82812035", "0.8150975", "0.8150975", "0.8150975", "0.8150975", "0.8150975", "0.8150975", "0.81476694", "0.81383455", "0.8133152", "0.81013256", "0.80521107", "0.80484396", "0.80484396", "0.80455464", "0.8045193", "0.80438125", "0.80413413", "0.8030803", "0.80255365", "0.79942834", "0.7981028", "0.7976106", "0.7965375", "0.7955232", "0.7944056", "0.7937445", "0.7920633", "0.7916457", "0.7916457", "0.7916457", "0.79101795", "0.78994256", "0.7897322", "0.7893222", "0.7893152", "0.7883183", "0.7878254", "0.7878031", "0.78674465", "0.7852768", "0.78518003", "0.7848169", "0.7845874", "0.78449166", "0.78414005", "0.7809085", "0.7803077", "0.7803077", "0.7803077", "0.7803077", "0.7803077", "0.7803077", "0.7803077", "0.780117", "0.77989125", "0.77974576", "0.7777579", "0.77763075", "0.7771089", "0.77437437", "0.7743604", "0.77331215", "0.7732076", "0.77268445", "0.7722215", "0.7721501", "0.77138174", "0.7709719", "0.77013075", "0.76784086", "0.7664901", "0.76625466", "0.76618296", "0.7655971", "0.76441216", "0.76427615", "0.76396346", "0.7638036", "0.7627571", "0.76221806", "0.76213115", "0.76213115", "0.7608802", "0.76081085", "0.7607491", "0.7603172", "0.76027143", "0.7590036", "0.75899595", "0.7576999", "0.7565729", "0.7558374", "0.75569564", "0.7552602", "0.75446886", "0.75446886", "0.7543693", "0.75321585", "0.7529818" ]
0.7904308
32
Select the layout name based on request type: xhr request or other
def set_layout request.xhr? ? 'empty' : 'application' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_layout\n request.xhr? ? 'ajax' : 'application'\n end", "def determine_layout\n request.xhr? ? 'ajax' : common_layout\n end", "def choose_layout\n request.xhr? ? 'modal' : 'front'\n end", "def choose_layout\n request.xhr? ? 'modal' : 'front'\n end", "def default_layout_for_request\n layout =\n case\n when params[:_layout] || params[:layout]\n l = params[:_layout] || params[:layout]\n l == 'false' ? false : l\n when request.xhr? || params[:xhr]\n false\n else\n default_layout\n end\n end", "def getlayout\n \n \tif request.xhr?\n \t\tfalse\n \telse\n \t\t'application'\n \tend\n end", "def determine_layout\n case action_name\n when \"new\"\n \"hero\"\n when \"create\"\n \"hero\"\n when \"edit\"\n \"dashboard\"\n when \"update\"\n \"dashboard\"\n end\n end", "def choose_layout\n logger.info \"\\n HOST #{request.host}\\n\"\n if current_user.present?\n if current_user.role?(:admin)\n 'backend_admin'\n else\n 'backend'\n end\n else\n 'application'\n end\n end", "def layout\n if request.xhr?\n return false\n else\n return 'application'\n end\n end", "def layout\n if request.xhr?\n return false\n else\n return 'application'\n end\n end", "def choose_layout \n if [ 'index', 'new', 'create','zones' ].include? action_name\n 'application'\n else\n 'application'\n end\n end", "def determine_layout\n return @__layout if @__layout\n return false if params[:_no_layout] || request.xhr?\n\n @__layout ||= current_page.layout.try(:template) if current_page.present? \n @__layout ||= 'application/default'\n @__layout\n end", "def layout_type\n if params[:controller] == \"catalog\"\n if params[:action] == \"show\" || params[:action] == \"downloads\"\n \"item\"\n elsif params[:action] == \"index\"\n \"index\"\n end\n else\n \"default\"\n end\n end", "def default_layout_for_request\n return params[:__layout] if params[:__layout]\n return params[:layout] if params[:layout]\n 'application'\n end", "def resolve_layout\n case action_name\n when \"unsupported_client\"\n \"header_only\"\n when \"service_unavailable\"\n \"header_only\"\n else\n \"kit\"\n end\n end", "def choose_layout\r\n return nil if action_name=='show'\r\n return 'usercenter' if action_name=='index' || action_name=='new'\r\n return 'public'\r\n end", "def dynamic_layout\n # ALL THIS SUCKS, I KNOW..\n \n # No layout for AJAX calls\n @layout = if request.xhr? \n nil\n # dialog param = lightview popup\n elsif params[:dialog]\n 'dialog'\n # uses user 'role' name for layout ... bad\n elsif current_user && !current_user.role.nil?\n current_user.role.downcase\n # no user, check for 'about' action\n elsif controller_name == 'about'\n 'about'\n # none of the above, use Rails default\n else\n 'home'\n end\n return nil unless @layout\n \n Rails.logger.debug \"Dyamic layout = #{@layout}\"\n # Layouts further divided by site subdomain: www vs vault\n if current_subdomain == 'vault'\n # Then public vs logged in...ugh\n if current_user\n @layout = 'vault/private/' + @layout\n else\n @layout = 'vault/public/' + @layout\n end\n end\n @layout\n end", "def layout_name\n controller = @tracker.controllers[@current_class]\n\n return controller[:layout] if controller[:layout]\n return false if controller[:layout] == false\n\n app_controller = @tracker.controllers[:ApplicationController]\n\n return app_controller[:layout] if app_controller and app_controller[:layout]\n\n nil\n end", "def layout?\n if request.xhr?\n return false\n else\n return 'admin'\n end\n end", "def result_layout\n if request.xhr?\n false\n else\n nil # use default layout\n end\n end", "def choose_layout\n request.xhr? && uses_modal? ? false : super\n end", "def select_layout\n user_signed_in? ? 'application' : 'external'\n end", "def set_layout\n params[:action] == 'index' ? 'admin' : (params[:layout] || 'realestate')\n end", "def determine_layout\n ['show'].include?(action_name) ? 'application' : nil \n end", "def set_layout\n if request.xhr?\n self.class.layout false\n else\n self.class.layout \"application\"\n end\n end", "def determine_layout\n 'akinu'\n end", "def get_layout_from_params\n params[:layout] ? params[:layout] : 'application' \n end", "def layout_by_resource\n if request.original_url.include? \"/wechat_service/\" \n 'wechat_service_application'\n else\n if devise_controller?\n 'devise'\n else\n 'application'\n # case action_name \n # when 'index' then 'list'\n # when 'show', 'new', 'edit', 'update', 'create' then 'form'\n # else 'application' end if controller_name != 'home'\n end\n end \n\n end", "def _layout_for(name = nil)\n name ||= :layout\n view_flow.get(name).html_safe\n end", "def _layout_for_ajax(default) #:nodoc:\n ajax_layout = self.class.read_inheritable_attribute(:ajax_layout)\n ajax_layout = if ajax_layout.nil? && default.nil?\n nil\n elsif ajax_layout.nil? && !default.nil? # look for one with the default name in layouts/ajax\n if default =~ /^layouts\\/ajax\\//\n default\n elsif !(default =~ /^ajax\\//)\n \"ajax/#{default.sub(/layouts(\\/)?/, '')}\"\n else\n default\n end\n elsif ajax_layout.include?(?/) # path to specific layout\n ajax_layout\n else # layout name, look in ajax/\n \"ajax/#{ajax_layout}\"\n end\n ajax_layout = ajax_layout =~ /\\blayouts/ ? ajax_layout : \"layouts/#{ajax_layout}\" if ajax_layout\n ajax_layout\n end", "def resolve_layout\n case action_name\n when 'index'\n 'dashboard'\n else\n 'application'\n end\n end", "def ajax_layout(template_name)\n (self.is_a?(Class) ? self : self.class).write_inheritable_attribute(:ajax_layout, template_name)\n end", "def layout_file_name_or_fallback\n ActionController::Base.view_paths.each do |path|\n ActionView::Template::Handlers.extensions.each do |engine_suffix|\n format = params[:format].presence || \"html\"\n file_in_path = File.join(\n path.to_s, \"layouts\", \"#{layout_file_name}.#{format}.#{engine_suffix}\"\n )\n return layout_file_name if File.exist?(file_in_path)\n end\n end\n fallback = \"application\"\n if self.class.sinicum_layout_prefix.present?\n fallback = self.class.sinicum_layout_prefix + \"/\" + fallback\n end\n fallback\n end", "def custom_layout\n case action_name\n when \"industry_xls\"\n \"no_layout\"\n when \"supplier_profiles\"\n \"no_layout\"\n when \"total_xls\"\n \t \"no_layout\"\n when \"industry_level\"\n \"no_layout\"\n when \"supplier_level\"\n \"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\n when \"customer_record\"\n \t\"no_layout\"\n when \"most_company_xls\"\n \t\"no_layout\"\n when \"conversion_industry\"\n \t\"no_layout\"\n when \"conversion_company\"\n \t\"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\t\n when \"suppliers_profiles\"\n \t\"no_layout\"\n when \"registered_suppliers\"\n \t\"no_layout\"\n when \"unregistered_suppliers\"\n \t\"no_layout\"\n when \"all_customers\"\n \t\"no_layout\"\n when \"jagent\"\n \t\"no_layout\"\n when \"sagent\"\n \t\"no_layout\"\n when \"poll\"\n \"no_layout\"\t\n when \"industry_conversion\"\n \"no_layout\"\t\n when \"company_conversion\"\t\t\n \"no_layout\"\n when \"reviews_processed\"\n \"no_layout\"\n when \"agent_output\"\n \"no_layout\"\n when \"agent_performance\"\n \"no_layout\"\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n else\n \"admin\"\n end\n end", "def set_layout\n response_code == 200 ? :\"layouts/application.#{@response.output_format}\" : nil\n end", "def layout(layout_type)\n\t\t#most content. that is loaded into the artist content area (just content)\n\t\tif layout_type.nil? || layout_type.blank?\n\t\t\t@layout = false\n\t\t\t@hook = \"#content\"\n\t\t#when artist page has to be loaded (logo, nave and content)\n\t\telsif layout_type == \"artist\"\n\t\t\t@layout = \"layouts/artist_admin_and_artist_floating_content.html.erb\"\n\t\t\t@hook = \".dynamicContent\"\n\t\tend\n\tend", "def layout_name\n Conf.layouts.each do |k,v|\n if v[\"network_id\"] == id\n return k\n end\n end\n\n return nil\n end", "def resolve_layout\n\t case action_name\n\t when 'index'\n\t \t'blank'\n\t else\n\t 'application'\n\t end\n\t end", "def layout_by_resource\n if devise_controller? && resource_class == Pilot\n \"pilot_devise\"\n elsif devise_controller? && resource_class == Operator\n \"operator_devise\"\n else\n \"application\"\n end\nend", "def determined_by_request\n if request.xhr?\n return false\n else\n 'application'\n end\n end", "def resolve_layout\n case action_name\n when \"create\", \"new\", \"index\"\n \"useraccount_layout\"\n else\n \"application\"\n end\n end", "def resolve_layout\n case action_name\n when \"edit\"\n \"editlayout\"\n when \"show_image\"\n \"application_png\"\n else\n \"application\"\n end\n end", "def custom_layout\n case action_name\n when \"edit\"\n \"profile\"\n when \"dashboard\"\n \"profile\"\n when \"show\"\n \"profile\"\n when \"change_password\"\n \"profile\"\n when \"admin_user\"\n \"profile\"\n when \"adminuser_logs\"\n \"profile\"\n when \"add_adminuser\"\n \"profile\"\n when \"add\"\n \"profile\"\n when \"upload\"\n \"profile\"\n when \"product_manager_logs\"\n \"profile\"\n when \"show\"\n \"profile\"\n when \"suspend\"\n \"profile\" \n else\n \"application\"\n end\n end", "def layouts_by_resource\n if devise_controller? && resource_name == :user && action_name == \"edit\"\n \"dashboard\"\n elsif controller_name == \"posts\" && [\"edit\",\"new\",\"index\"].include?(action_name)\n \"dashboard\"\n else\n \"application\"\n end\n end", "def layout\n case @mode\n when :injector\n \"injector\"\n when :page\n \"application\"\n else\n false\n end\n end", "def controller_layout\n layout = self.send(:_layout)\n if layout.instance_of? String\n layout\n else\n File.basename(layout.identifier).split('.').first\n end\n end", "def layout_by_resource\n if controller_name == 'registrations' && action_name == 'new'\n 'login'\n elsif controller_name == 'registrations' && action_name == 'create'\n 'login'\n elsif controller_name == 'passwords' && action_name == 'new'\n 'login'\n elsif controller_name == 'sessions' && action_name == 'new'\n 'login'\n else\n 'application'\n end\n end", "def layout_by_resource\n if user_signed_in?\n # \"admin\"\n #else\n \"application\"\n end\n end", "def determined_by_request\n if request.xhr?\n return false\n else\n 'application'\n end\n end", "def determine_layout\r\n #\"earthlingtwo/earthlingtwo\"\r\n \"#{template_name}/#{template_name}\"\r\n end", "def site_layout\n if params[:action].to_s.in?(gift_actions)\n \"gift_application\"\n else\n \"application\"\n end\n end", "def set_layout\n if %w( print plain ).include? params[:layout]\n params[:layout]\n else\n 'default'\n end\n end", "def determine_request_type\n if request.request_method == 'GET'\n case params[:format] # explicit format parameter\n when 'html'\n return :html\n when 'json'\n return :json\n end\n end\n all_ok = request.accept.include?('*/*')\n json_ok = request.accept.find { |header| header =~ /json/ }\n html_ok = request.accept.find { |header| header =~ /html/ }\n\n if all_ok\n if request.xhr?\n :json\n else\n :html\n end\n elsif json_ok and not html_ok\n :json\n elsif html_ok and not json_ok\n :html\n else\n :html\n end\n end", "def page_layout\n if @page\n if params[:popup]\n \"modal\"\n elsif !@page.layout.blank?\n @page.layout\n else\n choose_layout\n end\n else\n params[:popup] ? 'modal' : choose_layout\n end\n end", "def _implied_layout_name; end", "def layout_by_resource\n \"admin_layout\"\n end", "def layout_for_page\n if params[:layout] == 'none' || params[:layout] == 'false'\n false\n else\n params[:layout] || 'application'\n end\n end", "def default_layout\n 'default' if html?\n end", "def layout_by_resource\n if devise_controller? && resource_name == :client\n 'public'\n else\n 'lims'\n end\n end", "def current_layout\n controller.send :_layout # private method\n end", "def layout_by_resource\n\t\tif devise_controller?\n\t\t\t\"dashboard\"\n\t\telse\n\t\t\t\"application\"\n\t\tend\n\tend", "def set_layout\n\t \treturn \"landing\" if action_name == \"unregistered\"\n\t \tsuper\n\t end", "def serialize_ajax_info\n layout_name =\n if Ajax.app.rails?(3)\n if @_rendered_layout.is_a?(String)\n @_rendered_layout =~ /.*\\/([^\\/]*)/ ? $1 : @_rendered_layout\n elsif @_rendered_layout\n @_rendered_layout.variable_name\n end\n else\n active_layout\n end\n Ajax.set_header(response, :layout, layout_name)\n Ajax.set_header(response, :controller, self.class.controller_name)\n end", "def _layout_for_name(name)\n unless [String, FalseClass, NilClass].include?(name.class)\n raise ArgumentError, \"String, false, or nil expected; you passed #{name.inspect}\"\n end\n\n name && view_paths.find_by_parts(name, {:formats => formats}, \"layouts\")\n end", "def set_stall_layout\n return false if request.xhr?\n return Stall.config.default_layout if Stall.config.default_layout\n\n parent_controller = self.class.ancestors.find do |ancestor|\n !ancestor.name.to_s.match(/^Stall::/) && Class === ancestor\n end\n\n parent_controller._layout ||= 'application'\n end", "def determine_layout\n mobile_request? ? mobile_layout : desktop_layout\n end", "def show\n render :layout => params['ic-request'].blank?\n end", "def layout_by_resource\n if user_signed_in?\n # \"admin\"\n #else\n \"application\"\n end\n end", "def layout_file_name\n layout = \"application\"\n fail unless Content::Aggregator.original_content\n prepare_layout(layout)\n end", "def determine_layout\n current_user ? 'logged_in' : 'not_logged_in'\n end", "def layout_by_resource\n if devise_controller?\n \"landing\"\n else\n \"application\"\n end\n end", "def show\n if request.headers['X-PJAX'] \n render :layout => false\n elsif request.xhr?\n render :layout => false\n else\n render :layout => \"folder\"\n end\n end", "def get_layout\n\tlogged_in? and :page_user or :page_visitor\nend", "def layout\n lookup_layout\n end", "def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end", "def set_layout\n #agent = request.env['HTTP_USER_AGENT']#request.user_agent #request.env['HTTP_USER_AGENT']\n #if agent.match(\"Android\")\n #if agent.match(\"Android\")\n # false\n #TOdo change the institution_id to 25607\n unless params[:format].eql?'json'\n if !current_user.institution_id.nil? and [25607, 51324].include? current_user.institution_id\n 'pearson_new'\n elsif !current_user.institution_id.nil? and [26717, 57296].include? current_user.institution_id\n 'schand'\n # elsif !current_user.institution_id.nil? and [44566].include? current_user.institution_id\n # 'abcd_top_menu'\n else\n 'new'#'abcd_top_menu'\n end\n else\n false\n end\n # unless params[:format].eql?'json'\n # if !current_user.institution_id.nil? and [25607, 51324].include? current_user.institution_id\n # 'pearson_new'\n # elsif !current_user.institution_id.nil? and [26717, 57296].include? current_user.institution_id\n # 'schand'\n # elsif !current_user.institution_id.nil? and [1020].include? current_user.institution_id\n # 'abcd_top_menu'\n # else\n # 'new'\n # end\n # else\n # false\n # end\n end", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def layout_container_class\n if params[:controller] == \"events\" && params[:action] == \"show\"\n \"event container\"\n else\n \"container\"\n end\n end", "def layout_by_resource\n if user_signed_in?\n \"application\"\n else\n \"unauthorized\"\n end\n end", "def layout_by_resource\n if devise_controller?\n \"login\"\n else\n \"application\"\n end\n end", "def layout_by_resource\n if devise_controller?\n \"login\"\n else\n 'application'\n end\n end", "def _template_location(action, type = nil, controller = controller_name)\n (controller == 'layout' ? \"layout.#{action}.#{type}\" : \"#{action}.#{type}\")\n end", "def get_layout(layout)\n logger.debug( [ 'layout', \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\" ] )\n \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\"\n end", "def layout_by_resource\n if devise_controller? # Devise helper that returns true if the Controller it's a Devise\n \"backoffice_devise\"\n else\n \"application\"\n end\n end", "def layout_by_resource\n if devise_controller?\n \"devise_layout\"\n else\n \"application\"\n end\n end", "def layout_by_resource\n if devise_controller?\n \"admin\"\n else\n \"application\"\n end\n end", "def choose_layout\n Rails.configuration.blog.layout\n end", "def default_layout?\n layout_type == \"default\"\n end", "def use_layout(layout)\n env['response_layout'] = layout\n end", "def _layout_for_option(name); end", "def layout_by_resource\n devise_controller? ? 'devise' : 'application'\n end", "def layout_by_resource\n devise_controller? ? 'devise' : 'application'\n end", "def books_layout\n if params[:action] == 'show'\n 'reading'\n elsif params[:action] == 'edit' || params[:action] == 'new'\n 'writing'\n else\n 'application'\n end\n end", "def layout_by_resource\n if devise_controller?\n 'admin'\n else\n 'application'\n end\n end", "def get_layout(tpl)\n layout = \"#{tpl}_layout\"\n return layout if File.exists?(self.get_tpl_file(layout))\n\n items = tpl.split(/\\//)\n items.pop\n items << 'layout'\n layout = File.join(*items)\n return layout if File.exists?(self.get_tpl_file(layout))\n\n return \"layout\" if File.exists?(self.get_tpl_file(\"layout\"))\n\n return nil\n end", "def get_environments_layout\n @environment.present? ? \"environment\" : \"application\"\n end", "def layout_name\n umlaut_config.search_layout\n end", "def request_type\n return @request_type\n end", "def layout_by_resource\n if devise_controller?\n 'devise'\n else\n 'application'\n end\n end", "def layout_by_resource\n if devise_controller?\n \"new_login\"\n else\n \"application\"\n end\n end" ]
[ "0.7827571", "0.78203046", "0.76132405", "0.76132405", "0.72335607", "0.7197372", "0.70573777", "0.701215", "0.6979882", "0.69146526", "0.6912901", "0.68894225", "0.6831117", "0.6817096", "0.6805872", "0.6720451", "0.6703917", "0.6666527", "0.66252035", "0.65542567", "0.65403736", "0.64799273", "0.64328355", "0.64271975", "0.64154834", "0.6401998", "0.6398425", "0.63981855", "0.6363405", "0.6305159", "0.63016397", "0.6221989", "0.6180151", "0.61749053", "0.6169418", "0.6168943", "0.61663187", "0.6157223", "0.6124701", "0.6117722", "0.6110991", "0.61056566", "0.60987586", "0.60975224", "0.6088346", "0.6048622", "0.60276186", "0.6008904", "0.60046023", "0.6003064", "0.5998727", "0.5996678", "0.59900016", "0.5989436", "0.59851396", "0.5974142", "0.5956339", "0.59502876", "0.59361917", "0.59341294", "0.5931312", "0.5920174", "0.5913766", "0.5912003", "0.59080553", "0.58997846", "0.58847153", "0.5884703", "0.58824277", "0.58802307", "0.587171", "0.5855883", "0.583999", "0.583741", "0.58323437", "0.58220047", "0.5810365", "0.57949215", "0.5784676", "0.5778991", "0.5774614", "0.5767866", "0.57543147", "0.5739297", "0.5733687", "0.5729743", "0.57275647", "0.5725404", "0.5682852", "0.5675782", "0.56754506", "0.56754506", "0.5664121", "0.56640357", "0.56572354", "0.5650567", "0.56399125", "0.56262976", "0.5624107", "0.56075025" ]
0.6972863
9
Render 401 page and stop the work
def access_denied! render partial: 'errors/401', status: 401 && return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_authorized\r\n render :file => 'public/401.html', :status => 401, :layout => false\r\n end", "def render_unauthorized(message)\n head :unauthorized\n end", "def unauthorized\n render \"errors/401\", :status => 401\n\tend", "def access_denied\n render status: 401, text: \"nice try\"\n end", "def render_unauthorized\n logger.debug \" *** UNAUTHORIZED REQUEST: '#{request.env['HTTP_AUTHORIZATION']}' ***\"\n self.headers['WWW-Authenticate'] = 'Token realm=\"Application\"'\n render json: {error: \"Bad credentials\"}, status: 401\n end", "def deny_access\n @status = 401\n respond_to do |format|\n format.html { render template: \"errors/401\", status: @status, layout: \"errors\" }\n format.all { render nothing: true, status: @status }\n end\n end", "def unauthorized\n\n render_error( :unauthorized )\n\n end", "def unauthorized\n respond_to do |format|\n format.html do\n if admin?\n flash.now[:error] = I18n.t(:authorization_failure)\n redirect_to login_path and return\n elsif current_user || admin?\n flash.now[:error] = I18n.t(:authorization_failure)\n render 'shared/unauthorized'\n else\n store_location\n redirect_to login_path and return\n end\n end\n format.xml do\n request_http_basic_authentication 'Web Password'\n end\n format.json do\n render :text => \"Not Authorized \\n\", :status => 401\n end\n end\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def access_denied\n case content_type\n when :html\n store_location\n redirect url(:login)\n when :xml\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n set_status(401)\n render :text => \"Couldn't authenticate you\"\n end\n end", "def handle_http_401(message, metric = nil, view = :unauthorized)\n logger.warn \"#{message}\\n\\t#{request.method} #{request.original_url}\"\n Metric.register(metric || Metric::METRIC_HTTP_401)\n render view, status: :unauthorized\n end", "def access_denied\n clear_session\n respond_to do |format|\n format.html { redirect_to login_path and return false }\n format.xml do\n headers['Status'] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n render :text =>'Unauthorized', :status=>401\n end\n end\n end", "def authorization_denied\n head :unauthorized\n end", "def render_401\n errors = JsonApiServer.errors(\n status: 401,\n title: I18n.t('json_api_server.render_401.title'),\n detail: I18n.t('json_api_server.render_401.detail')\n )\n render json: errors.to_json, status: 401\n end", "def access_denied\n respond_to do |format|\n format.html {\n flash[:error] = \"Sie sind nicht angemeldet oder nicht berechtigt, auf die angeforderte Seite zuzugreifen.\"\n render text: \"\", layout: true, status: :unauthorized\n }\n \n format.any {\n head status: :unauthorized\n }\n end\n end", "def access_denied\n respond_to do |accepts|\n accepts.html do\n store_location\n redirect_to login_url\n # redirect_to signup_path\n end\n accepts.xml do\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n render :text => \"Could't authenticate you\", :status => '401 Unauthorized'\n end\n accepts.js do\n render(:update) {|p| p.redirect_to(login_url) }\n # render(:update) {|p| p.redirect_to(signup_path) }\n end \n end\n false\n end", "def unauthorized\n head :unauthorized\n end", "def unauthorized\n render :text => \"You are not authorized to perform this action\", :status => 401\n end", "def render_access_denied_page\n # Render fail page\n @meta = {}\n @meta[:title] = \"Access Denied\"\n @meta[:description] = \"You do not have access to this application\"\n render :template => \"pages/app_access_unauthorized\", :layout => 'application', :status => :forbidden\n end", "def unauthorized\n respond_to do |format|\n format.html do\n if try_spree_current_user\n flash.now[:error] = t(:authorization_failure)\n render 'spree/shared/unauthorized', :layout => Spree::Config[:layout], :status => 401\n else\n store_location\n url = respond_to?(:spree_login_path) ? spree_login_path : root_path\n redirect_to url\n end\n end\n format.xml do\n request_http_basic_authentication 'Web Password'\n end\n format.json do\n render :text => \"Not Authorized \\n\", :status => 401\n end\n end\n end", "def access_denied\n store_location\n redirect_to root_path(:target => request.request_uri)\n #respond_to do |format|\n # format.json do\n # render :partial => \"json/response\",\n # :locals => {\n # :success => false,\n # :message => \"Authorization Required\",\n # :body => nil}\n # end\n # format.html do \n # redirect_to root_path#(:after_login => request.request_uri)\n # end\n #end\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n puts \"access denied\"\n respond_to do |accepts|\n accepts.html do\n store_location\n # render :text => \"Authentication failed: access denied\"\n redirect_to log_in_path\n end\n accepts.json do\n render :json => {:success => false, :message => \"Authentication failed\"}\n end\n accepts.xml do\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n render :text => \"Could't authenticate you\", :status => '401 Unauthorized'\n end\n end\n false\n end", "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid email and token must be present.\"})\n end", "def handle_unverified_request\n reset_session\n render :nothing => true, :status => 401\n end", "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid username and token must be present.\"})\n end", "def unauthorized\n render json: {error: 'Unauthorized'}, status: 401\n end", "def render_must_sign_in\n render status: :unauthorized\n end", "def access_denied\n\n\n respond_to do |accepts|\n accepts.html do\n\n store_return_to\n\n flash[:warning]=l(\"You'll need to login first\")\n\n\n redirect_to @login_url || \"/account/login\"\n\n\n end\n accepts.xml do\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n render :text => \"Could't authenticate you\", :status => '401 Unauthorized'\n end\n\n\n end\n\n false\n end", "def respond_with_unauthorized(message: \"Unauthorized\", error_code: \"unauthorized\")\n render partial: \"api/error\", locals: { message: message, error_code: error_code }, status: 401\n return false\n end", "def access_denied\n head 401\n end", "def access_denied\n respond_to do |accepts|\n accepts.html do\n store_location\n redirect_to :controller => '/accounts', :action => 'login'\n end\n accepts.js do\n render(:update) { |page| page.redirect_to(:controller => '/accounts', :action => 'login') }\n end\n accepts.xml do\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n render :text => \"Could't authenticate you\", :status => '401 Unauthorized'\n end\n end\n false\n end", "def unauthorized\n reset_session\n flash[:alert] = \"You are Not Authorized to View this Page. Your Session has expired !!!\"\n render :login\n end", "def access_denied\n render \"common/access_denied\"\n end", "def invalid_authentication\n render_error 'Authentication failure', 'unauthorized', 401\n end", "def render_unauthenticated_errors(exception)\n render json: {\n message: 'UnAuthenticated.',\n details: exception.error_codes\n }, status: 401\n end", "def authentication_error\n # User's token is either invalid or not in the right format\n render 'api/v1/shared/failure', locals: { errors: [{ user: ['is unauthorized'] }] }, status: :unauthorized # Authentication timeout\n end", "def invalid_authentication\n #render json: {errors: ['Invalid Request']}, status: :unauthorized\n error!('Invalid Request', :unauthorized)\n end", "def access_denied\n respond_to do |accepts|\n accepts.html do\n store_location\n redirect_to '/login'\n end\n accepts.xml do\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n render :text => \"Could't authenticate you\", :status => '401 Unauthorized'\n end\n end\n false\n end", "def require_authentication\n render_failed_auth_response unless authentication_successful? # render a 401 error\n end", "def render_failed_driver_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"User is not a driver.\"})\n end", "def require_authentication\n render_failed_auth_response unless authentication_successful? # render a 401 error\n end", "def access_denied\n if @current_user\n render_401\n else\n redirect_to \"#{FUSESOURCE_URL}/login?return_to=#{external_url_to(request.request_uri)}\"\n end\n end", "def unauthenticated\n render_json status: :unauthorized\n end", "def unauthorized\n render_json error: 'Access Not Authorized', status: :forbidden\n end", "def failure\n render :json => {:success => false, :errors => {:reason => \"Login failed. Try again\"}}, :status => 401\n end", "def render_error(msg, status)\n render_403\n end", "def render_unauthorized(message)\n\t\terrors = {errors: [{detail: message}]}\n\t\trender json: errors, status: :unauthorized\n\tend", "def render_unauthorized(payload = { errors: { unauthorized: [\"You are not authorized perform this action.\"] } })\n render json: payload, status: 401\n end", "def block_unauthenticated_user!\n unless current_user\n return render_unauthorized\n end\n end", "def unauthorized\n render :json => \"You are not authorized for access.\", :status => :unauthorized\n end", "def render_unauthorized_errors(exception)\n render json: {\n message: 'Unauthorized.',\n details: exception.error_codes\n }, status: 403\n end", "def render_403\n respond_to do |format|\n format.html { render :template => 'errors/error_403', status: 403 }\n format.any { head :forbidden }\n end\n end", "def handle_unverified_request\n super\n render :text => \"Forgery protection token was not present.\", :status => :unauthorized\n end", "def access_forbidden\n if !@authenticated.nil?\n send_response_document :forbidden\n else\n flash.keep\n authentication_needed!\n end\n end", "def render_unauthorized(message)\n errors = {errors: [detail: message]}\n render json: errors, status: :unauthorized\n end", "def render_unauthorized(message)\n errors = {errors: [detail: message]}\n render json: errors, status: :unauthorized\n end", "def destroy_restricted!\n flash.now[:error] = \"Non è possibile cancellare questo record poichè è collegato ad altre informazioni!\"\n respond_to do |format|\n format.html { render partial: 'errors/401', status: 401 && return }\n format.turbo_stream {\n render turbo_stream: [ turbo_stream.replace(:flashes, partial: \"flashes\") ]\n }\n end\n end", "def render_unauthorized(message)\n errors = { errors: [detail: message ] }\n render json: errors, status: :unauthorized\n end", "def permission_denied\n render :template => \"shared/permission_denied\",\n :status => :forbidden\n end", "def access_denied\n render :file => \"#{RAILS_ROOT}/public/422.html\", :status => 422 and return\n end", "def access_denied\n {\n :html => 'Sorry, we cannot verify that you are a user. Please reinstall this Raplet.',\n :status => 401\n }\n end", "def invalid_authentication\n render json: { error: 'Unauthorized' }, status: :unauthorized\n end", "def access_denied\n case content_type\n when :html\n store_location\n redirect url(:login)\n when :xml\n basic_authentication.request\n end\n end", "def permission_denied\n respond_to do |format|\n flash[:error] = 'Sorry, you are not allowed to view the requested page.'\n format.html { redirect_to(:back) rescue redirect_to('/') }\n format.xml { head :unauthorized }\n format.js { head :unauthorized }\n end\n end", "def access_denied\n if ( user_signed_in? )\n render :file => File.join( RAILS_ROOT, 'public', '404.html' ),\n :status => :not_found\n else\n authenticate_user!\n end\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def render_unauthorized(message)\n errors = { errors: [ { detail: message } ] }\n render json: errors, status: :unauthorized\n end", "def unauthorized_access_response_for_web(err, display_text)\n error_with_data(\n err,\n display_text,\n display_text,\n GlobalConstant::ErrorAction.default,\n {}\n )\n end", "def unsuccessful\n # renders the static page\n end", "def permission_denied\n flash[:error] = 'Sorry, you are not allowed to the requested page.'\n respond_to do |format|\n format.html { logged_in? ? redirect_back_or_default(root_path) : redirect_to(login_path) } \n format.xml { head :unauthorized }\n format.js { head :unauthorized }\n end\n end", "def render_forbidden\n render :file => File.join(Rails.root.to_s, 'public/403.html'), :status => :forbidden, :layout => false\n end", "def auth_failed\n message = params.dig(\"message\") || \"incorrect username and/or password\"\n message = \"Login failed: #{message}\"\n if request.xhr?\n render plain: message, status: :unauthorized\n else\n flash['error'] = message\n redirect_to return_url, allow_other_host: true\n end\n end", "def unauthorized\n error(t('messages.generics.errors.access'), 401)\n end", "def access_denied\n respond_to do |format|\n format.html do\n session[:original_uri] = request.fullpath\n flash[:notice] = 'Please log in'\n redirect_to new_session_url\n end\n format.any(:json, :xml) do\n request_http_basic_authentication 'Web Password'\n end\n end\n end", "def permission_denied\n respond_to do |format|\n format.html { render :template => \"shared/forbidden\", :status => :forbidden }\n format.any { head :forbidden }\n end\n end", "def invalid_authentication\n render json: { error: 'Invalid request' }, status: 403\n end", "def role_authorization_failure_response\n render nothing: true, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def not_authorized\n flash[:error] = I18n.t :forbidden\n response.headers['Status-Code'] = '403'\n redirect_to root_path\n end", "def access_denied_handler(exception)\n __debug_exception('RESCUE_FROM', exception)\n msg = exception.message\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, alert: msg) }\n format.json { render_json({ error: msg }, status: :unauthorized) }\n format.xml { render_xml({ error: msg }, status: :unauthorized) }\n end\n rescue => error\n error_handler_deep_fallback(__method__, error)\n end", "def unauthorized_request\n Rails.logger.debug \"------ 'Unauthorized' response from resource server ------\"\n\n authorize_path = @organization.authorization_server.authorize_path(callback_url)\n Rails.logger.debug \"------ Redirecting to: #{authorize_path} ------\"\n redirect_to authorize_path\n end", "def throw_unauthorized_page(exception = nil)\n dispatch_error_email(exception)\n if current_user\n flash[:error] = I18n.t('title.page_not_authorized')\n redirect_to NavigationHistory.new(request, session).back(1)\n else\n flash[:error] = I18n.t('title.page_not_authorized_login')\n NavigationHistory.new(request, session).store(:current, :force)\n redirect_to new_user_session_path\n end\n end", "def invalid_authentication\n render json: {errors: {code: 401, message: \"You need to sign in\"}}, status: :unauthorized\n end", "def indicate_unauthorised_request(message)\n respond_to do |format|\n format.html {\n flash[:error] = message\n redirect_back_or_default(home_url)\n }\n format.json {\n render json: {:errors => [\"#{message}\"]}, :status => :unauthorized\n }\n end\n end", "def render_invalid_user\n render json: { error: \"Invalid API token\" }, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid request'}, status: :unauthorized\n end", "def render_unathorized(message)\n errors = { errors: [ { detail: message } ] }\n render json: errors, status: :unauthorized\n end", "def unauthorized_error\n error!(\"401 Unauthorized\", 401)\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end" ]
[ "0.8083516", "0.77960855", "0.77643305", "0.76811355", "0.7547679", "0.7507944", "0.7496331", "0.74397546", "0.7425587", "0.7425587", "0.739917", "0.7357528", "0.735653", "0.7344297", "0.73370343", "0.7333744", "0.7332294", "0.7284989", "0.727261", "0.7265804", "0.7260171", "0.7253107", "0.7202229", "0.7202229", "0.7202229", "0.7202229", "0.7202229", "0.7202229", "0.7202229", "0.7197003", "0.7180905", "0.71610725", "0.71589315", "0.7099311", "0.709925", "0.7089149", "0.7081493", "0.7071277", "0.7050728", "0.7045661", "0.7039222", "0.70136994", "0.6993967", "0.69908166", "0.6988585", "0.69745314", "0.69684076", "0.6964", "0.69471705", "0.6927366", "0.6924171", "0.69081295", "0.6890658", "0.687412", "0.6865611", "0.68572193", "0.68459934", "0.68455744", "0.6840783", "0.68354875", "0.6835014", "0.68293434", "0.68271255", "0.68115085", "0.68092483", "0.6807956", "0.68038917", "0.6785402", "0.6779103", "0.67776966", "0.6777551", "0.6766133", "0.6765145", "0.67613935", "0.67537683", "0.6739321", "0.67391616", "0.6734697", "0.6721513", "0.67202187", "0.6696226", "0.66929907", "0.6684309", "0.66768485", "0.667235", "0.6670225", "0.66640425", "0.6659869", "0.66521126", "0.6647138", "0.663798", "0.6634621", "0.6629908", "0.66171837", "0.6604911", "0.6601551", "0.65992236", "0.65992236", "0.65992236", "0.65992236" ]
0.8073811
1
Render message and stop the work
def destroy_restricted! flash.now[:error] = "Non è possibile cancellare questo record poichè è collegato ad altre informazioni!" respond_to do |format| format.html { render partial: 'errors/401', status: 401 && return } format.turbo_stream { render turbo_stream: [ turbo_stream.replace(:flashes, partial: "flashes") ] } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terminate_message\n self.active = false\n self.pause = false\n @contents_showing = false\n $game_temp.message_proc&.call\n reset_game_temp_message_info\n dispose_sub_elements\n reset_overwrites\n @auto_skip = false\n end", "def hide_message\n # todo - mark the message as read\n render :update do |page|\n page.visual_effect :fade, \"marketing\"\n end\n end", "def message\n render_message unless message_rendered?\n @_message\n end", "def cancel_reply\n render :text => ''\n end", "def cancel\n # renders static page\n end", "def user_message_end(msg)\n user_message(msg, 0, \"<<<\")\n end", "def cancel!\n # Context is already cleared in action_for_message\n end", "def pbDisplayPausedMessage(msg)\r\n pbWaitMessage\r\n pbShowWindow(MESSAGE_BOX)\r\n cw = @sprites[\"messageWindow\"]\r\n cw.text = _INTL(\"{1}\\1\",msg)\r\n PBDebug.log(msg)\r\n yielded = false\r\n i = 0\r\n loop do\r\n pbUpdate(cw)\r\n if !cw.busy?\r\n if !yielded\r\n yield if block_given? # For playing SE as soon as the message is all shown\r\n yielded = true\r\n end\r\n if !@battleEnd\r\n if i>=MESSAGE_PAUSE_TIME*3 # Autoclose after 3 seconds\r\n cw.text = \"\"\r\n cw.visible = false\r\n break\r\n end\r\n i += 1\r\n end\r\n end\r\n if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) || @abortable\r\n if cw.busy?\r\n pbPlayDecisionSE if cw.pausing? && !@abortable\r\n cw.skipAhead\r\n elsif !@abortable\r\n cw.text = \"\"\r\n pbPlayDecisionSE\r\n break\r\n end\r\n end\r\n end\r\n end", "def close\n render :text => \"\"\n end", "def render; ''; end", "def step7\n render text: @message\n end", "def pbDisplayMessage(msg)\n self.visible = false\n @scene.pbDisplayMessage(msg)\n @scene.clearMessageWindow\n self.visible = true\n end", "def show_err_msg(message)\n responds_to_parent do\n render :update do |page|\n page.call 'change_basic_form'\n page.call \"flash_writter\", \"#{message}\"\n page << \"activate_click('#{params[:form_txt]}_onclick')\"\n #page.call \"load_completer\"\n end\n end\n end", "def stop(msg = \"Error: Nimbus finished.\")\n self.error_message msg\n exit(false)\n end", "def stop\n @continue_sending = false\n end", "def exclude_sent\n @message.sent? and return render :show\n end", "def notify\n # render :nothing => true\n end", "def message_render(message)\n render(partial: \"message\", locals: { message: message })\n end", "def stop_message\n \"Slack Pomodoro Timer stopped!\"\n end", "def inactive_message; end", "def inactive_message; end", "def pbWaitMessage\r\n return if !@briefMessage\r\n pbShowWindow(MESSAGE_BOX)\r\n cw = @sprites[\"messageWindow\"]\r\n MESSAGE_PAUSE_TIME.times do\r\n pbUpdate(cw)\r\n end\r\n cw.text = \"\"\r\n cw.visible = false\r\n @briefMessage = false\r\n end", "def message(message)\n @message = message\n erb :message\n end", "def ended msg\n end", "def render_finish\n raise NotImplementedError\n end", "def abort_send\n \n @bulletin = Bulletin.find(params[:id])\n \n if (@bulletin.is_status('P')) \n @bulletin.status = 'O' # open!\n @bulletin.clear_rendered\n @bulletin.save\n flash[:notice] = _('Send aborted!')\n else\n flash[:warning] = _('Unable to abort sending, as the bulletin is now being sent!')\n end\n\n redirect_to :action => 'index' \n end", "def message\n process_mess\n end", "def pbDisplayMessage(msg,brief=false)\r\n pbWaitMessage\r\n pbShowWindow(MESSAGE_BOX)\r\n cw = @sprites[\"messageWindow\"]\r\n cw.setText(msg)\r\n PBDebug.log(msg)\r\n yielded = false\r\n i = 0\r\n loop do\r\n pbUpdate(cw)\r\n if !cw.busy?\r\n if !yielded\r\n yield if block_given? # For playing SE as soon as the message is all shown\r\n yielded = true\r\n end\r\n if brief\r\n # NOTE: A brief message lingers on-screen while other things happen. A\r\n # regular message has to end before the game can continue.\r\n @briefMessage = true\r\n break\r\n end\r\n if i>=MESSAGE_PAUSE_TIME # Autoclose after 1 second\r\n cw.text = \"\"\r\n cw.visible = false\r\n break\r\n end\r\n i += 1\r\n end\r\n if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) || @abortable\r\n if cw.busy?\r\n pbPlayDecisionSE if cw.pausing? && !@abortable\r\n cw.skipAhead\r\n elsif !@abortable\r\n cw.text = \"\"\r\n cw.visible = false\r\n break\r\n end\r\n end\r\n end\r\n end", "def message\n if valid? and self.template.renderable?\n @message ||= MessageRenderer.new(\n data: data_hash, \n template: template, \n recipient: recipient, \n sender: sender\n ).render\n end\n end", "def stop(&block)\n yield(DONE)\n puts stop_message\n end", "def debug_message_end(msg)\n debug_message(msg, 0, \"<<<\")\n end", "def stop\n session[:request_game] = nil\n flash[:notice] = 'Thank you for helping us keep the site tidy!'\n redirect_to frontpage_url\n end", "def halt\n end", "def cancel ; @finished = true ; @buff = '' ; end", "def draw\n @player.draw\n Graphics.render_tail\n Graphics.draw_tiles(@font)\n Graphics.display_centered_title(@message.join(\"\"), @small_font)\n Graphics.display_lives(@small_font)\n Graphics.show_emoticon(Settings.mailbox, @font) if @message.join(\"\") == @completed \n if Position.collide?(@active_tile, @player)\n Graphics.erase_emoticon\n Graphics.show_emoticon(Settings.failbox, @font) \n end\n end", "def action_b\n play_cancel_se\n @running = false\n end", "def stop\n @run = false\n end", "def stop\n\t\tself.sender.stop\n\tend", "def destroy\r\n\t\tres_meta = {success: false}\r\n\t\ttime_start = Time.now\r\n\t\t\r\n\t\t\r\n\t\trender_result(data: nil, meta: res_meta)\r\n\tend", "def destroy\r\n\t\tres_meta = {success: false}\r\n\t\ttime_start = Time.now\r\n\t\t\r\n\t\t\r\n\t\trender_result(data: nil, meta: res_meta)\r\n\tend", "def render_global_message\n global_message_file = KatalogUbpb.config.global_message_file\n if global_message_file && File.exists?(global_message_file)\n render(inline: File.read(global_message_file))\n end\n end", "def display_message!(*lines)\n display_message(*lines)\n sleep 0.01 until message_drawn?\n end", "def render_onmessage(event)\n fail \"event/trigger is not found\" unless event[:trigger]\n fail \"event/action is not found\" unless event[:action]\n\n <<-EOS\ncase '#{event[:id]}':\n if (Object.keys(_msg['_db_errors']).length == 0) {\n#{indent(action_js(event[:action]), 2)}\n } else {\n }\n break;\n EOS\n end", "def exit_message \n\t\t\t\talert_menu \"Thanks for playing!\", false\n\t\t\tend", "def stop\n send Rainbow('Stopping cpgui...').aqua\n @run = false\n end", "def close_message_window\n return unless @message_window\n while $game_temp.message_window_showing\n Graphics.update\n yield if block_given?\n @message_window.update\n end\n end", "def display_exiting!(text)\n # create goodbye message\n # display welformatted conclusion message\n system \"clear\"\n msg = colorize(\" #{text.upcase} \", $font_colors[:cyan])\n puts \"\\n#{msg.center(77)}\\n\\n\"\n end", "def message_soft_lock_prevent\n if $game_temp.message_window_showing\n log_error('Message were still showing!')\n $game_temp.message_window_showing = false\n end\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def done!(msg=\"\")\n out \"#{msg} (#{self.end!}s)\\n\"\n end", "def dont_send\n current_div.button(:id=>\"send_message_cancel\").click\n wait_for_ajax\n end", "def error_message_and_leave(e)\n # consider a loading bar or spinner here\n\n sleep 1\n puts \"\\nOk so in technical terms, this is the issue :\\n\\n\"\n\n error_msg = e.to_s.chars\n\n error_msg.each do |i|\n print Rainbow(i).red\n sleep 0.05\n end\n\n puts \"\\n\\n\"\n\n final_message = 'So...... Anyways....... Please restart program and try creating a new profile '.chars\n final_message.each_with_index do |character, index|\n sleep 0.8 if (index == 8) || (index == 23) || (index == final_message.length - 1)\n sleep 0.04\n print Rainbow(character).yellow\n end\n\n exit #exit the program if issues with reading file \n\n end", "def success(msg)\n tell \"#{✔} {g{#{msg}}}\"\n end", "def stop\n\t\t# No-op\n\tend", "def update_message\n # Show the \"What?\" message\n if @counter == 0\n @message_window.auto_skip = true\n @message_window.stay_visible = true\n display_message(text_get(36, 37))\n elsif @counter == POKEMON_ALPHA_DOWN_END\n @message_window.auto_skip = false\n Audio.bgm_play(Evolve::EVOLVED_MUSIC)\n PFM::Text.set_pkname(@pokemon, 0)\n display_message(text_get(36, 38))\n elsif @counter > POKEMON_ALPHA_DOWN_END\n show_rename_choice\n Audio.bgm_stop\n $game_system.bgm_restore2\n $pokedex.mark_seen(@pokemon.id, @pokemon.form, forced: true)\n $pokedex.mark_captured(@pokemon.id)\n $pokedex.pokemon_fought_inc(@pokemon.id)\n $pokedex.pokemon_captured_inc(@pokemon.id)\n @running = false\n end\n end", "def flash_me_naked\n flash.clear\n render :text => \"wow!\"\n end", "def end_game_message(message)\nsystem \"clear\"\nputs \"GAME OVER: #{ message }\"\nlaat_bord_zien\nend", "def stop\n true\n end", "def stop\n true\n end", "def stop\n true\n end", "def stop\n true\n end", "def closeMessage()\r\n puts \"closeMessage\" if $DEBUG\r\n if (inMsg?)\r\n @curRuleSrc += \"</Message>\"\r\n end # if inMsg\r\n end", "def render_message(message)\n render json: { message: message }, status: :ok\n end", "def stop(message = nil)\r\n @assert = false\r\n end", "def ui_sub_action(message)\n puts message\n yield\n end", "def render_nothing(status=200)\n @_status = status\n return \" \"\n end", "def stop\n yield\n end", "def mail\n if @message.to.empty?\n flash.now[:no_server] = true\n return render :edit\n end\n\n MessageMailerSenderJob.perform_later(@message)\n @message.sent!\n render :show\n end", "def render(*)\n if (logger = WebConsole.logger) && logger.respond_to?(:silence)\n WebConsole.logger.silence { super }\n else\n super\n end\n end", "def stop\n throw @context.stop\n end", "def stop\n\t\tself.request( :stop )\n\tend", "def ajax_wait_msg text_to_display='Processing...'\n return \"<img src=\\\"/images/waiting.gif\\\" alt=\\\"waiting\\\"> #{text_to_display}\"\n end", "def stop_spinner\n @spinner_running = false\n print \"\\b\"\n end", "def ui_action(message)\n puts message\n yield\n end", "def refresh_part\n\n if params[:restream].nil?\n @msg = current_user.check_message\n render layout: false\n else\n @msg = current_user.check_message\n\n respond_to do |format|\n format.js\n end\n end\n\n end", "def clear_message\n @m.synchronize do\n @message=\"\"\n end\n end", "def render_message(options = {}, &block)\n @_message_rendered = true\n render_email(@_message.email, options, &block) if @_message.email\n render_message_types(options)\n @_message.assign_message_type_values(options)\n @_message\n end", "def quit_message\n \"\\nRemaining pomodoros will not be posted.\" +\n \"\\nQuitting slack_pomodoro_timer...\"\n end", "def display\n wrap_in_border do\n print_space(:before)\n puts formatted_message\n print_space(:after)\n end\n sleep @display_seconds if !@display_seconds.nil?\n clear if @clear_after_display\n @message\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def window_message_close(smooth)\n if smooth\n while $game_temp.message_window_showing\n Graphics.update\n @message_window.update\n end\n else\n $game_temp.message_window_showing = false\n @message_window.visible = false\n @message_window.opacity = 255\n end\n end", "def feed_warning\r\n render\r\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end" ]
[ "0.68938565", "0.66594577", "0.61872447", "0.61101776", "0.6047031", "0.59801894", "0.59251016", "0.58857423", "0.5863943", "0.5844966", "0.5827079", "0.5778582", "0.5774425", "0.5768372", "0.5759928", "0.57547563", "0.5747987", "0.5745459", "0.57321507", "0.5707474", "0.5707474", "0.5702441", "0.5679074", "0.5664282", "0.5658711", "0.5650944", "0.56477123", "0.56161016", "0.56151235", "0.56120324", "0.560348", "0.55936456", "0.55792403", "0.55768496", "0.55608046", "0.55582976", "0.55550253", "0.55526495", "0.5549539", "0.5549539", "0.55409104", "0.5534515", "0.5511013", "0.54983443", "0.5487919", "0.5471016", "0.54542106", "0.5451019", "0.54489386", "0.54489386", "0.54489386", "0.5445371", "0.5445371", "0.5445371", "0.5445371", "0.5445371", "0.5445371", "0.5445371", "0.54447836", "0.5444087", "0.54303366", "0.5427574", "0.5422058", "0.54198164", "0.5416962", "0.54159176", "0.5414035", "0.5414035", "0.5414035", "0.5414035", "0.54011387", "0.5395231", "0.5385873", "0.5382592", "0.5375344", "0.5372695", "0.53723", "0.53721106", "0.5369506", "0.5362661", "0.5361985", "0.53613055", "0.5360828", "0.5357418", "0.5354793", "0.535376", "0.53522915", "0.5348182", "0.53450036", "0.53450036", "0.53450036", "0.53450036", "0.53401315", "0.5338142", "0.5335838", "0.5335838", "0.5335838", "0.5335838", "0.5335838", "0.5335838", "0.5335838" ]
0.0
-1
Localize a fieldName if obj is present
def t_field(field_label = nil, obj = '') return '' if field_label.blank? case obj when Class I18n.t(field_label, scope: "activerecord.attributes.#{obj.class}", default: field_label).try(:capitalize) when String I18n.t(field_label, scope: "activerecord.attributes.#{obj}", default: field_label).try(:capitalize) else I18n.t(field_label, default: field_label).try(:capitalize) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localize(field)\n if klass.fields[field.to_s].try(:localized?)\n field = \"#{field}.#{::I18n.locale}\".to_sym\n end\n field\n end", "def translation_for(field)\n object.class.human_attribute_name(field)\n end", "def localize(object, **options); end", "def localize(object, **options); end", "def forme_input(form, field, opts)\n i18n_key = \"models.#{self.class.table_name}.#{field}\"\n\n if opts[:label].nil? && I18n.exists?(i18n_key)\n opts[:label] = I18n.t(i18n_key)\n end\n\n super\n end", "def normalized_key(name, serializer)\n # serializer && serializer.localized? ? \"#{name}.#{::I18n.locale}\" : name\n serializer&.localized? ? \"#{name}.#{::Mongoid::Fields::I18n.locale}\" : name\n end", "def translate(field)\n super(\"#{@_i18n_scope}.#{field}\")\n end", "def update_field(field_name, *obj)\n # Should be an Array of RDF::Term objects\n return unless obj\n\n if fields[field_name] && fields[field_name].localized?\n trans = {}\n\n obj.each do |item|\n lang = item.is_a?(RDF::Literal) && item.has_language? ? item.language.to_s : I18n.locale.to_s\n value = item.is_a?(RDF::URI) ? item.to_s : item.object # TODO: tidy this up\n trans[lang] = trans[lang] ? [*trans[lang]] << value : value\n end\n\n send(\"#{field_name}_translations=\", trans) unless trans.empty?\n else\n objects = obj.map { |item| item.is_a?(RDF::URI) ? item.to_s : item.object } # TODO: tidy this up\n send(\"#{field_name}=\", objects.size > 1 ? objects : objects.first)\n end\n end", "def field_label *i18n_keys\n first, *rest = i18n_keys.compact\n\n t(first, default: rest)\n end", "def index_field_label(document, field)\n lookup_display_name(document, field) || super\n end", "def method_missing(*args, &block)\n if current_version?\n object.send(*args, &block)\n else\n if localized?(args.first)\n _field_translations = eval_localized_string(args.first)\n if args.first !~ /_translations\\Z/\n _field_translations[I18n.locale.to_s]\n end\n else\n version.send(*args, &block)\n end\n end\n end", "def document_show_field_label(document, field)\n lookup_display_name(document, field) || super\n end", "def translate(klass, key, value)\n if defined?(I18n)\n super\n else\n value ? value.to_s.humanize.downcase : 'nil'\n end\n end", "def field_human_name(field)\n I18n.translate(\"#{model_name}.attributes.#{field}\", :count => 1, :default => Inflections.humanize(field), :scope => :models)\n end", "def localize(object, **options)\n I18n.localize(object, **options)\n end", "def local_field name\n (LOCAL_DICT[\"common\"] || {})[name]\n end", "def contact_field_name(contact_field)\n contact_field_translations[contact_field]\n end", "def localize(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end", "def get_field_translation(field, options = {})\n join_name = options[:join_alias] || self.translation_join_alias\n lang = options[:language] || self[\"#{join_name}__lang\"] || self.class.get_current_language\n \n if (self.loaded_with_translation?(lang, options))\n if (options[:when_missing_use_default] && self[\"#{join_name}_#{self.language_column}\"].nil?)\n self[field]\n else\n self[\"#{join_name}_#{field}\"]\n end\n else\n trans = self.get_translation(lang)\n if (options[:when_missing_use_default] && trans.nil?)\n self[field]\n else\n trans[field]\n end\n end \n end", "def full_name\n case I18n.locale\n when :ja then \"#{object.last_name} #{object.first_name}\"\n else \"#{object.first_name} #{object.last_name}\"\n end\n end", "def localized_info(obj, name, lang = I18n.locale)\n text = obj.localized_info(name, lang).text\n format_multiline_input(text) if text.full?\n end", "def normalized_key(name, serializer)\n serializer && serializer.localized? ? \"#{name}.#{::I18n.locale}\" : name\n end", "def localized(scope, attribute, default)\n self.class.localized scope, attribute, default, object.class.name.downcase\n end", "def method_missing(method, *args)\n arguments = { value: object_field[language] }.merge(*args)\n form_field.send(method, language, arguments)\n end", "def translate_fields(names)\n names.each do |name|\n translate_field(name)\n end\n end", "def get_text_if_exists(field)\n return unless field.in? LOCALE_ACCESSORS\n\n Criteria.get_levels(name).reverse_each do |l|\n next if l.to_i > level.to_i\n\n t_key = \"criteria.#{l}.#{name}.#{field}\"\n # Disable HTML output safety. I18n translations are internal data\n # and are considered a trusted source.\n # rubocop:disable Rails/OutputSafety\n return I18n.t(t_key).html_safe if I18n.exists?(t_key)\n # rubocop:enable Rails/OutputSafety\n end\n nil\n end", "def tlookup_value lookup_object =nil, translation_type = nil, model_name=nil\n return \"\" if lookup_object.nil?\n return \"\" if lookup_object.id.nil?\n model_name = lookup_object.class.table_name.singularize if model_name.nil?\n model_name = model_name.downcase\n\n if translation_type.nil? || translation_type[\"name\"] then\n return I18n.t($LU + model_name + \".\" + lookup_object.translation_code)\n elsif translation_type[\"description\"] then\n return I18n.t($LU +model_name + '.description.'+lookup_object.translation_code)\n else\n return $TM + \" for \" + lookup_object.to_s + \" \" + (translation_type.nil? ? \"\" : translation_type)\n end\n end", "def text(attr = nil, model = nil)\n keys = i18n_keys(attr, model) << self.underscore.humanize\n ::I18n.translate(keys.shift, default: keys)\n end", "def process_field(field_name)\n if ['id', 'name', 'first_name', 'node_id'].include?(field_name)\n \"#{table}.#{field_name}\"\n else\n super # raises\n end\n end", "def get_string_field(field_name)\n\t\tend", "def localize_present?\n false\n end", "def localized?\n field = self.content_type.label_field\n !!field.try(:localized)\n end", "def []( name )\n if form and r18n\n value = opts[ name ]\n if value.is_a?( String ) or ( value.nil? and not UNLOCALIZED_OPTIONS.include?( name ) )\n text = pt( name )\n return text.to_s if text.translated?\n end\n end\n super\n end", "def missing_translation_placeholder field\n evaluate_localization_option!(:placeholder, field)\n end", "def ad_field_to_local field_name\n @ad_to_local_map ||= ::Devise.ad_attr_mapping[devise_model_name.to_sym].invert\n return (@ad_to_local_map.has_key? field_name) ? @ad_to_local_map[field_name] : field_name\n end", "def read_attribute(name, options = {})\r\n options = {:translated => true, :locale => nil}.merge(options)\r\n if translated?(name) and options[:translated]\r\n globalize.fetch(options[:locale] || Mongoid::Globalize.locale, name)\r\n else\r\n super(name)\r\n end\r\n end", "def update_from_field(field_name)\n if fields[field_name].localized?\n read_attribute(field_name).to_a.map { |lang, value| cast_value(value, language: lang) }.flatten\n else\n cast_value send(field_name)\n end\n end", "def translatable\n self._translatable[base_name]\n end", "def field(name, *params)\r\n @model.translated_attribute_names = (@model.translated_attribute_names + [name.to_sym])\r\n @model.translated_attr_accessor(name)\r\n @model.translation_class.field name, *params\r\n end", "def translation_for(locale, **)\n translation = model.send(association_name).find { |t| t.__send__(key_column) == attribute && t.locale == locale.to_s }\n translation ||= class_name.new(locale: locale, key_column => attribute)\n translation\n end", "def field_label(field)\n @__field_label_cache ||= {}\n @__field_label_cache[field] ||= field.to_s.sub(/_facet$|_display$|_[a-z]$/,'').gsub(/_/,' ')\n @__field_label_cache[field]\n end", "def show_field(model, field, label = nil)\n label ||= field.to_s.titlecase\n show_value(model.send(field), label)\n end", "def generic_render_document_field_label(config_field, document, field: field_name)\n send(:\"render_document_#{config_field}_label\", document, field: field)\n end", "def generic_render_document_field_label(config_field, document, field: field_name)\n send(:\"render_document_#{config_field}_label\", document, field: field)\n end", "def find_name_by_reflection(field, id)\n return nil if id.blank?\n @detail_value_name_by_reflection ||= Hash.new do |hash, key|\n association = Issue.reflect_on_association(key.first.to_sym)\n name = nil\n if association\n record = association.klass.find_by_id(key.last)\n if record\n name = record.name.force_encoding('UTF-8')\n end\n end\n hash[key] = name\n end\n @detail_value_name_by_reflection[[field, id]]\n end", "def get_field(field_name)\n\t\tend", "def get_object_name attr_name\n return attr_name.capitalize if @@object_attribute.include?(attr_name)\n # return attr_name.capitalize if @object_attribute.include?(attr_name)\n attr_name = attr_name.to_s\n if attr_name.include? '_'\n if attr_name[-2, 2] == 'es' and attr_name != 'tour_dates'\n attr_name.split('_')[0].capitalize + attr_name.split('_')[1][0...-2].capitalize\n else\n attr_name.split('_')[0].capitalize + attr_name.split('_')[1][0...-1].capitalize\n end\n elsif attr_name == 'addresses'\n attr_name[0...-2].capitalize\n else\n attr_name[0...-1].capitalize\n end\n end", "def transform_field_name(key, name)\n hash = ::CUSTOM_FIELD_NAMES\n class_name = self.class.name.demodulize.underscore.to_sym\n return name if hash.nil? || hash[class_name].nil? || hash[class_name][key.to_sym].nil?\n hash[class_name][key.to_sym]\n end", "def display_name(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end", "def i18n_label\n \"email.#{name}_label\"\n end", "def rename_field dirty_key, opts={}\n do_token = opts[:auto_tokenize]\n do_token = self.auto_tokenize? if do_token.nil?\n to_field = opts[:field_renames] || self.field_renames\n clean_key = format_field(dirty_key)\n field_key = to_field[clean_key]\n field_key = do_token if field_key.nil? and (not do_token.nil?)\n case field_key\n when Symbol then field_key\n when true then clean_key.to_sym\n when false then clean_key\n else\n raise ArgumentError, \"Unknown Auto Rename Field Value: #{clean_key}\"\n end\n end", "def text_method_for(obj)\n if obj.respond_to?(:name)\n :name\n else\n :to_s\n end\n end", "def label_translation; end", "def localize\n helpers.localize\n end", "def fill_names_if_nil\n if en_name.blank? && jp_name.blank?\n self.en_name = author.en_name\n self.jp_name = author.jp_name\n end\n end", "def field_detect(label)\n @field = fields.detect { |item| item.text.include? label }\n\n raise \"Field '#{label}' was not found on form.\" unless @field\n end", "def translated?(name)\n self.class.translated?(name)\n# self.class.instance_variable_get(translated_attribute_names).include?(name.to_sym)\n end", "def help_text(field)\n\t\t\ttranslation = self.human_attribute_name(\"help_#{field}\", :default => 0)\n\t\t\tif translation != 0\n\t\t\t\ttranslation\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\tend", "def get_field(field, collection)\n if field.is_a?(Hash) # rubocop:disable Style/ConditionalAssignment\n field = \"#{field[:table]}.#{field[:field]}\"\n else\n field = \"#{collection.table_name}.#{field}\"\n end\n field_base.gsub(Placeholder::FIELD, field)\n end", "def get_field_name\n\t\tend", "def render_value(value, field:, **opt)\n if present? && object.field_names.include?(field)\n object[field] || EMPTY_VALUE\n end || super\n end", "def local_field_to_ad field_name\n @local_to_ad_map ||= ::Devise.ad_attr_mapping[devise_model_name.to_sym]\n return (@local_to_ad_map.has_key? field_name) ? @local_to_ad_map[field_name] : field_name\n end", "def label_field\n self.find_field(self.label_field_name) || self.fields.first\n end", "def record_name(record)\n spokesfield ? record.send(spokesfield) : \"#{human_resource} #{record.id}\"\n end", "def localized_info_field(f, name, lang = current_person.locale) # :nodoc:\n render({:partial => '/partials/localized_info_form_content',\n :locals => {:f => f, :name => name, :lang => lang}})\n end", "def name_seo_display\n (self.name_seo[I18n.locale].present?) ? self.name_seo[I18n.locale].parameterize : \"-\"\n end", "def localize_x(object, options = {})\n if options.has_key?(:locale) && !options[:locale].is_a?(Array)\n localize(object, options)\n else\n begin\n handling = options.delete(:throw) && :throw || options.delete(:raise) && :raise # TODO deprecate :raise\n if object.is_a?(Array)\n if handling\n options[handling] = true\n end\n object.map { |k| localize_x(k, options) }\n else\n backend = config.backend\n locales = if options.has_key?(:locale) && options[:locale].is_a?(Array)\n options.delete(:locale)\n else\n config.locale_array\n end\n format = options.delete(:format) || :default\n\n # we need to drop :default from the options, or we won't find a translation if a later\n # locale has one and the first does not\n\n default = options.delete(:default)\n options[:raise] = true\n\n seen = {}\n\n locales.each do |lloc|\n aloc = lloc.to_s.split('-')\n while aloc.length > 0\n l = aloc.join('-')\n unless seen.has_key?(l)\n seen[l] = true\n begin\n return backend.localize(l, object, format, options)\n rescue\n end\n end\n aloc.pop\n end\n end\n\n # if we made it here, there is no translation\n\n if default\n default\n else\n raise I18n::MissingTranslationData.new(locales, object, options)\n end\n end\n rescue I18n::ArgumentError => exception\n handle_exception(handling, exception, locale, object, options)\n end\n end\n end", "def translation_attribute(attribute, _translation_options = nil)\n return attribute unless attribute == :company_name\n\n return :OTHER_company_name unless company_number?\n\n :COMPANY_company_name\n end", "def present_field_as_label(field)\n field.to_s.sub(/_id$/, '').split('_').map(&:capitalize).join(' ')\n end", "def header_show(object, attribute)\n # show the header which is the translated fake attribute\n attribute\nend", "def localized(key, value = nil)\n self[key] = value if value\n\n case self[key]\n when NilClass then nil\n when Proc then instance_eval(&self[key])\n else _(self[key])\n end\n end", "def attach_to_obj(obj)\n\t\tobj.instance_variable_set(\"@ext_\" + encode_string(@name[1..-2]).uncapitalize.gsub(\" \",\"_\").gsub(\".\",\"_\").gsub(\"-\",\"_\").gsub(\"/\",\"_\"), encode_string(@nominalValue) )\n\tend", "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 get_field_name(options)\r\n field_name = options[:field_name]\r\n\r\n field_name\r\n end", "def update_field_name\n self.field = field_name\n end", "def add_i18n(predicate, object, lang, type=nil)\n object = object.blank? ? nil : TaliaCore::PropertyString.new(object, lang, type)\n add(predicate, object)\n end", "def obj_property(obj, var_name, opts = {})\n val = obj.send(var_name)\n return \"\" if val.blank? && opts[:default].nil?\n\n label = opts[:label] || var_name.to_s.titlecase\n val = yield(val) if block_given?\n\n # handle special data types\n case val.class.name\n when \"Time\"\n val = systime(val)\n when \"Date\"\n val = sysdate(val)\n when \"DateTime\"\n val = systime(val)\n when \"BigDecimal\"\n val = number_to_currency(val)\n when \"ActsAsTaggableOn::TagList\"\n val = tag_list(obj)\n end\n\n # auto link email, web and phone values\n if var_name == :email\n val = mail_to(val)\n elsif var_name == :phone\n val = link_to(\"tel:#{val}\") { \"<i class='fa fa-phone'></i> #{val}\".html_safe }\n elsif var_name == :website\n val = \"http://#{val}\" if !val.start_with?('http')\n val = link_to(val, val)\n end\n\n str = <<-EOF\n <tr>\n\t\t\t<td class=\"key\">#{label}</td>\n\t\t\t<td>#{val || opts[:default]}</td>\n\t\t</tr> \n EOF\n\n str.html_safe\n end", "def show_field_label label\n t(:'blacklight.search.show.label', label: label)\n end", "def localize(key, error_msg='__localization_missing__', args={}, locale=nil)\n return if reserved_keys.include? key\n\n # Set a temporary Locale to support the localized_in method\n #\n unless locale.nil?\n @original_locale = Locale.code\n Locale.set_code(locale)\n end\n localized = localizations[key] || error_msg\n # Get translations from another country but in the same language if Globalite can't find a translation for my locale\n #\n if localized == error_msg\n locales.each do |t_locale|\n if t_locale.to_s.include?(\"#{current_language.to_s}-\") && t_locale != Locale.code\n localized = @@locales[t_locale][key] || error_msg\n end\n end\n end\n localized = interpolate_string(localized.dup, args.dup) if localized.class == String && localized != error_msg\n\n # let's handle pluralization if needed\n # the translation must include pluralize{count, singular string} to be translated\n # the translator can also pass the plural form if needed:\n # pluralize{3, goose, geese}\n localized = localized.gsub( /pluralize\\{(.*)\\}/){ |erb| pluralize(Regexp.last_match(1)) } if localized.is_a?(String) && (localized=~ /pluralize\\{(.*)\\}/)\n\n # Set the locale back to normal\n #\n unless locale.nil?\n Locale.code = @original_locale\n end\n\n return localized\n end", "def upcase_save\n self.name = name.upcase rescue nil\n self.term_condition = term_condition.upcase rescue nil\n end", "def translatable_string_init_arg(arg_name)\n if XRC2Ruby.use_gettext\n init_arg(arg_name) { | val | \"_(\" + val.inspect + \")\" }\n else\n init_arg(arg_name) { | val | val.inspect }\n end\n end", "def to_field_name(name)\n # camelize strips leading underscores, which is undesirable.\n if name.to_s.starts_with?('_')\n \"_#{to_field_name(name.to_s[1..-1])}\"\n elsif Rails.config.camel_case\n name.to_s.camelize(:lower)\n else\n name.to_s\n end\n end", "def label\n @given_label || I18n.t(\"bureaucrat.#{form_name}.#{name}.label\", default: name.to_s.humanize)\n end", "def method_missing(field) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing\n front_matter[field.to_s]\n end", "def name_display\n self.name[I18n.locale]\n end", "def full_title(field = nil)\n field && find_record_value(field) || super()\n end", "def localize(*args)\n I18n.localize *args\n end", "def localize(*args)\n I18n.localize *args\n end", "def localize(*args)\n I18n.localize(*args)\n end", "def localize(*args)\n I18n.localize(*args)\n end", "def localize(*args)\n I18n.localize(*args)\n end", "def display_value(obj)\n case\n when obj && observed_name\n \"#{obj.name} (#{observed_name})\"\n when obj\n \"#{obj.name}\"\n when observed_name\n \"#{observed_name}\"\n else\n \"\"\n end\n end", "def dl_field(object, what)\n if object.is_a?(Symbol)\n content_tag(:dt, I18n.t(object).capitalize) + \n content_tag(:dd, what)\n else\n content_tag(:dt, I18n.t(\"activerecord.attributes.#{object.class.to_s.downcase}.#{what}\").capitalize) + \n content_tag(:dd, object.send(what)) # what is a symbol\n end\n end", "def fetch_attribute(locale, name)\r\n translation = record.translation_for(locale)\r\n return translation && translation.send(name)\r\n end", "def translate_value(args)\n code = get_field_val(args)\n translate_lang_code(code)\n end", "def to_responsys_field(s)\n if @@system_fields.include?(s)\n s.to_s.upcase + \"_\"\n else\n s.to_s.upcase\n end\n end", "def define_translatable_getters(attr)\n define_method(\"#{attr}_data\") do\n res = self[attr] || {}\n res = new_record? ? { I18n.locale => '' } : {} unless res.present?\n res = JSON.parse(res) if res.is_a?(String)\n res.symbolize_keys\n end\n\n define_method(attr) do |**_args|\n send(\"#{attr}_data_for\", I18n.locale)\n end\n end", "def english_name?\n read_attribute(:name).present?\n end", "def evaluate_field_name(field_name_or_proc)\n return field_name_or_proc if field_name_or_proc.nil?\n\n field_name = field_name_or_proc.respond_to?(:call) ? field_name_or_proc.call(controller.const) : field_name_or_proc\n field_name.to_sym\n end", "def name\n object.translated_name(scope[:locale] || I18n.default_locale)\n end" ]
[ "0.64157623", "0.6244754", "0.6101673", "0.6101673", "0.5886811", "0.58794194", "0.58645064", "0.5823621", "0.57293004", "0.5687891", "0.56806165", "0.5643081", "0.5531259", "0.55112916", "0.54588056", "0.5441425", "0.54325783", "0.54284745", "0.54141426", "0.5383049", "0.53502154", "0.5285235", "0.52833545", "0.52704024", "0.5245517", "0.5218111", "0.5217539", "0.52019083", "0.51966184", "0.5193832", "0.5193178", "0.5193098", "0.5192814", "0.51880366", "0.51859105", "0.51588017", "0.51009125", "0.50996685", "0.5098341", "0.50917387", "0.5078788", "0.50543535", "0.50491565", "0.50491565", "0.5041496", "0.5014878", "0.5014087", "0.5006821", "0.5005606", "0.50006217", "0.49956438", "0.49877927", "0.4983644", "0.49817798", "0.497527", "0.49747163", "0.4967675", "0.4967605", "0.49529424", "0.49384916", "0.49347237", "0.49308038", "0.4925666", "0.4919267", "0.4912242", "0.4904318", "0.49022767", "0.48987627", "0.48915473", "0.48863396", "0.4885256", "0.4878775", "0.48762774", "0.4874084", "0.48688498", "0.48644003", "0.4861495", "0.48597604", "0.48534968", "0.4851709", "0.485148", "0.48508564", "0.4844225", "0.48411778", "0.48270842", "0.48179358", "0.4809096", "0.4809096", "0.48071036", "0.48071036", "0.48071036", "0.48047683", "0.4799153", "0.4793784", "0.4788057", "0.47879395", "0.47865695", "0.4783849", "0.47753334", "0.476871" ]
0.6632558
0
GET /staff_workers GET /staff_workers.json
def index @q = StaffWorker.eager_load(:subdivision => :company).ransack(params[:q]) @staff_workers = @q.result(distinct: true) # @staff_workers = StaffWorker.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @worker = Worker.find(params[:id])\n\n render json: @worker\n end", "def index\n @workers = Worker.all\n end", "def index\n @workers = Worker.all\n end", "def index\n @workers = Worker.all\n end", "def index\n @workers = Worker.all\n end", "def workers_all\n @work_order_workers = WorkOrderWorker.by_id\n render json: serialized_work_order_workers(@work_order_workers)\n end", "def show\n @worker = Worker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worker }\n end\n end", "def show\n\tLogger.log current_user\n @worker = Worker.find(params[:id])\n render json: @worker\nend", "def index\n @workers_roles = WorkersRole.all\n end", "def index\n @workers = Worker.all.order(id: :desc).paginate :page => params[:page], :per_page => 20\n end", "def show\r\n\r\n\r\n @account = Account.find(params[:id])\r\n @workers = @account.workers\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @account }\r\n end\r\n end", "def find_work_order_workers\n if !params.has_key?(:work_order_id) || !is_numeric?(params[:work_order_id]) || params[:work_order_id] == '0'\n render json: :bad_request, status: :bad_request\n else\n @work_order_workers = WorkOrderWorker.belongs_to_work_order(params[:work_order_id])\n render json: :not_found, status: :not_found unless @work_order_workers.present?\n end\n end", "def index\n @workers = Worker.find(:all, :order =>\"id\").paginate(:page =>params[:page], :per_page => 10)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @workers }\n end\n end", "def create\n @staff_worker = StaffWorker.new(staff_worker_params)\n\n respond_to do |format|\n if @staff_worker.save\n format.html { redirect_to @staff_worker, notice: 'Данные сохранены' }\n format.json { render :show, status: :created, location: @staff_worker }\n else\n format.html { render :new }\n format.json { render json: @staff_worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @my_ministries = MyMinistry.all\n @ministries = Ministry.find(:all, order: \"id\")\n @coworkers = Coworker.all\n person_count = 0\n @coworkers.each do |coworker|\n if coworker.ministries.any?\n person_count += 1\n end\n end\n @joined_ministry_person_count = person_count\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_ministries }\n end\n end", "def set_staff_worker\n @staff_worker = StaffWorker.find(params[:id])\n end", "def index\n @worker_jobs = WorkerJob.all.page(params[:page])\n end", "def workers\n @worker_supervisor.actors\n end", "def show\n #@my_ministry = MyMinistry.find(params[:id])\n @coworker = Coworker.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_ministry }\n end\n end", "def show\n @community_health_worker = CommunityHealthWorker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @community_health_worker }\n end\n end", "def get_staff_details\n\t\t@result = CompanyStaff.find(params[:id])\n\t\tif @result != nil\n\t\t\trender :json => { :success => false, :user => @result }\n\t\telse\n\t\t\trender :json => { :success => false, :user => 'No results found' }\n\t\tend\n\tend", "def show\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @staff }\n end\n end", "def get_registered_workers\n @registered_workers\n end", "def show\n @admin_staff = Admin::Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_staff }\n end\n end", "def index\n delegates_for_current_profile\n @delegate = Delegate.new\n @staff_list = current_staff_profile.staff_list_json\n end", "def index\n @waitstaffs = Waitstaff.all\n end", "def list_workers\n Shuttle::Redis.smembers worker_set_key\n end", "def workers\n if known?\n @workers\n else\n know heroku_get_workers\n end\n end", "def index\n @staffs = Staff.all\n end", "def index\n @staffs = Staff.all\n end", "def index\n @staffs = Staff.all\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def update\n respond_to do |format|\n if @staff_worker.update(staff_worker_params)\n format.html { redirect_to @staff_worker, notice: 'Данные сохранены' }\n format.json { render :show, status: :ok, location: @staff_worker }\n else\n format.html { render :edit }\n format.json { render json: @staff_worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def index \t\t\n\t\t@attributes = Request.new.attributes.keys - Request.protected_attributes.to_a\n\t\t@staff = Staff.find(params[:staff_id])\n\t\t@all_requests = Request.find_all_by_staff_id(params[:staff_id])\n\t\trespond_to do |format|\n\t \tformat.html\n\t \tformat.json{ render json: @staff}\n\t end \n\tend", "def workers\n worker_group.accounts\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to tenant_workers_path, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_work\n client.make_request('/get-work', 'post', params: {})\n end", "def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end", "def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def worker\n\n @services['s_worker']\n end", "def find_worker id\n self.workers.find{ |worker| worker[:id] == id } \n end", "def set_worker\n @worker = current_admin.workers.find(params[:id])\n end", "def workers\r\n @workers ||= []\r\n end", "def index\n @staffs = Staff.search(params[:searchText]).order(\"created_at desc\").paginate(page: params[:pageNumber], per_page: params[:pageSize])\n\n respond_to do |f|\n f.html { render 'staffs/index' }\n f.json { \n render json: {\n total: @staffs.total_entries,\n rows: @staffs.as_json({ index: true })\n } \n }\n end\n end", "def index\n workouts = @ws.workouts\n render json: workouts\n end", "def index\n @daw_staffs = DawStaff.all\n end", "def show\n @worker = Worker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @worker }\n end\n end", "def index\n @search = Staff.search(params[:q])\n @staffs = @search.result\n end", "def index\n @worker_salaries = WorkerSalary.paginate(:page => params[:page], :per_page => per_page).order('year desc')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @worker_salaries }\n end\n end", "def index\n @worker_types = WorkerType.all\n end", "def index\n \n @meeting_threads = @current_user.available_jobs\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_threads }\n end\n end", "def update_workers\n mongo_driver = Kymera::MongoDriver.new(address, port, database, 'workers')\n @registered_workers = mongo_driver.get_collection('workers')\n end", "def index\n @workdetails = Workdetail.where(\"task_id = ?\", params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workdetails }\n end\n end", "def index\n @admin_staffs = Admin::Staff.all\n end", "def worker(worker_id, api_key = @api_key)\n raise(\"worker_id must be a non-empty string\") if (!worker_id.is_a? String) || worker_id.to_s.empty?\n raise(\"Bad api_key parameter\") if api_key.empty?\n timetout ||= @timeout\n\n auth = {:username => \"#{company_id}\", :password => \"#{api_key}\"}\n response = self.class.get(\"/v#{API_VERSION}/workers/#{worker_id}\",\n :basic_auth => auth)\n\n Response.new(response.body, response.code, response.response)\n end", "def work_schedules\n @work_schedules = WorkSchedule.all\n\n render json: @work_schedules.to_json\n end", "def index\n\n if params['filter'] === nil\n @works = Work.all\n else\n @works = Work.where(params['filter'])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @works.to_json(:include => {\n :student => {only: [ :last_name, :name, :middle_name ]},\n :teacher => {only: [ :id ]}\n })}\n end\n end", "def index\n @worklists = Worklist.all\n end", "def man_staffs\n prepareBaseContext\n @members = ShelterStaff.where('staff_type = ?', 'MEMBER')\n @volunteers = ShelterStaff.where('staff_type = ?', 'VOLUNTEER')\n render 'petshelter/management/staffs'\n end", "def index\n @workouts = Workout.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workouts }\n end\n end", "def new\n @worker = Worker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @worker }\n end\n end", "def index\n @workstations = Workstation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workstations }\n end\n end", "def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to admin_path, notice: 'Worker was successfully created.' }\n format.json { render action: 'show', status: :created, location: @worker }\n else\n format.html { render action: 'new', :layout => \"dodawanie\"}\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def staff_worker_params\n params.require(:staff_worker).permit(:name, :surname, :patronymic, :number_id, :subdivision_id, :birthday, :position, :duration_work, :labor_activity_type, :labor_activity_category, :duration_one_shift, :workplace_id, :work_in_workplace, :description_operation,:additional_workplace_id, :additional_work_in_workplace, :additional_description_operation)\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def index\n @workouts = Workout.all \n render 'index.json.jbuilder', status: :created\n end", "def worker\n Worker.find_by_code worker_code\n end", "def show\n @breadcrumb = 'read'\n @work_order_labor = WorkOrderLabor.find(params[:id])\n @worker_orders = @work_order_labor.work_orders.paginate(:page => params[:page], :per_page => per_page).order('order_no')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_order_labor }\n end\n end", "def show\n @course_staff = CourseStaff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_staff }\n end\n end", "def index\n @jobs = current_user.works\n end", "def show\n @worker = Worker.find(params[:id])\n @title = Title.find_by_id(@worker.title_id)\n @worker_type = WorkerType.find_by_id(@worker.worker_type_id)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @worker }\n end\n end", "def index\n @lec_staffs = LecStaff.all\n end", "def set_coworker\n @coworker = Coworker.find(params[:id])\n end", "def create\n @worker = Worker.new(params[:worker])\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render json: @worker, status: :created, location: @worker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @work_results = WorkResult.all\n end", "def index\n @works = Work.all\n end", "def index\n @works = Work.all\n end", "def create\n @worker = Worker.new(tl_params)\n\n if @worker.save\n render json: @worker, status: :created\n else\n render json: @worker.errors, status: :unprocessable_entity\n end\n end", "def show\n @workobject = Workobject.find(params[:id])\n @wo_tasks = Task.where(workobject_id: params[:id])\n @wo_staff = Staffobjectjournal.where(workobject_id: params[:id])\n @wo_post = Post.where(workobject_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workobject }\n end\n end", "def index\n employees = manager.employees.active\n render json: employees.all, each_serializer: EmployeeSerializer, status: 200\n end", "def index\n @workout_days = WorkoutDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workout_days }\n end\n end", "def index\n @wrestlers = Wrestler.all\n end", "def destroy\n @staff_worker.destroy\n respond_to do |format|\n format.html { redirect_to staff_workers_url, notice: 'Staff worker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @workshops = Workshop.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workshops }\n end\n end", "def build_house() \n gather_team()\n @workers.each do |worker|\n worker.get_to_work()\n end\n end", "def show\n @locations=@work.locations\n map\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end", "def index\n @task_doers = TaskDoer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_doers }\n end\n end", "def workers\n @@workers ||= []\n end", "def index\n @people_tasks = TasksPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people_tasks }\n end\n end", "def getwork(data)\n request :getwork, data\n end", "def worker_params\n params.require(:worker).permit(:title, :content, :user_id, { service_ids:[] })\n end", "def index\n @watch_sites = WatchSite.includes(:team, :venue).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_sites }\n end\n end", "def index\n @worker_messages = WorkerMessage.all\n end", "def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end" ]
[ "0.6781652", "0.6774574", "0.6774574", "0.6774574", "0.6774574", "0.6637402", "0.6595079", "0.6564263", "0.63247156", "0.6271591", "0.6258578", "0.62555206", "0.61848223", "0.61721224", "0.61568123", "0.6123516", "0.6018543", "0.60161734", "0.6005567", "0.59264517", "0.5908983", "0.58968383", "0.5887862", "0.5884667", "0.5874445", "0.58489686", "0.5846218", "0.5842533", "0.58206373", "0.58206373", "0.58206373", "0.58169734", "0.58169734", "0.58120185", "0.58078134", "0.5787659", "0.57697576", "0.5758338", "0.57466364", "0.5738239", "0.5686607", "0.5675955", "0.5670525", "0.56703526", "0.5663598", "0.5660408", "0.56550294", "0.56473935", "0.56459814", "0.563665", "0.56354123", "0.5634775", "0.5633514", "0.5622884", "0.5612629", "0.55848753", "0.55803186", "0.55705756", "0.5570188", "0.5566162", "0.5561506", "0.5557469", "0.555689", "0.555081", "0.5547464", "0.5547067", "0.5547067", "0.5547067", "0.55425584", "0.554071", "0.55328864", "0.552299", "0.5518662", "0.55137986", "0.5507914", "0.54838514", "0.5482551", "0.54771644", "0.5477002", "0.5475014", "0.5469835", "0.5469835", "0.546841", "0.546517", "0.54586285", "0.545551", "0.5448959", "0.5444727", "0.54378325", "0.5423066", "0.5420963", "0.5412796", "0.54093415", "0.5404583", "0.5404173", "0.5402083", "0.5399542", "0.53942776", "0.5388654", "0.53751415" ]
0.60945374
16
GET /staff_workers/1 GET /staff_workers/1.json
def show @noise_indicators = NoiseIndicator.where(staff_worker_id: @staff_worker.id) @total_vibration_indicators = TotalVibrationIndicator.where(staff_worker_id: @staff_worker.id) @local_vib_f_indicators = LocalVibFIndicator.where(staff_worker_id: @staff_worker.id) @local_vib_s_indicators = LocalVibSIndicator.where(staff_worker_id: @staff_worker.id) @working_operations = WorkingOperation.where(staff_worker_id: @staff_worker.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @worker = Worker.find(params[:id])\n\n render json: @worker\n end", "def show\n @worker = Worker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worker }\n end\n end", "def show\n\tLogger.log current_user\n @worker = Worker.find(params[:id])\n render json: @worker\nend", "def index\n @workers = Worker.all\n end", "def index\n @workers = Worker.all\n end", "def index\n @workers = Worker.all\n end", "def index\n @workers = Worker.all\n end", "def set_staff_worker\n @staff_worker = StaffWorker.find(params[:id])\n end", "def show\r\n\r\n\r\n @account = Account.find(params[:id])\r\n @workers = @account.workers\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @account }\r\n end\r\n end", "def show\n @community_health_worker = CommunityHealthWorker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @community_health_worker }\n end\n end", "def show\n #@my_ministry = MyMinistry.find(params[:id])\n @coworker = Coworker.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_ministry }\n end\n end", "def workers_all\n @work_order_workers = WorkOrderWorker.by_id\n render json: serialized_work_order_workers(@work_order_workers)\n end", "def find_worker id\n self.workers.find{ |worker| worker[:id] == id } \n end", "def create\n @staff_worker = StaffWorker.new(staff_worker_params)\n\n respond_to do |format|\n if @staff_worker.save\n format.html { redirect_to @staff_worker, notice: 'Данные сохранены' }\n format.json { render :show, status: :created, location: @staff_worker }\n else\n format.html { render :new }\n format.json { render json: @staff_worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @staff }\n end\n end", "def set_worker\n @worker = current_admin.workers.find(params[:id])\n end", "def show\n @admin_staff = Admin::Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_staff }\n end\n end", "def find_work_order_workers\n if !params.has_key?(:work_order_id) || !is_numeric?(params[:work_order_id]) || params[:work_order_id] == '0'\n render json: :bad_request, status: :bad_request\n else\n @work_order_workers = WorkOrderWorker.belongs_to_work_order(params[:work_order_id])\n render json: :not_found, status: :not_found unless @work_order_workers.present?\n end\n end", "def index\n @workers = Worker.all.order(id: :desc).paginate :page => params[:page], :per_page => 20\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def get_staff_details\n\t\t@result = CompanyStaff.find(params[:id])\n\t\tif @result != nil\n\t\t\trender :json => { :success => false, :user => @result }\n\t\telse\n\t\t\trender :json => { :success => false, :user => 'No results found' }\n\t\tend\n\tend", "def index\n @workers = Worker.find(:all, :order =>\"id\").paginate(:page =>params[:page], :per_page => 10)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @workers }\n end\n end", "def show\n @worker = Worker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @worker }\n end\n end", "def worker(worker_id, api_key = @api_key)\n raise(\"worker_id must be a non-empty string\") if (!worker_id.is_a? String) || worker_id.to_s.empty?\n raise(\"Bad api_key parameter\") if api_key.empty?\n timetout ||= @timeout\n\n auth = {:username => \"#{company_id}\", :password => \"#{api_key}\"}\n response = self.class.get(\"/v#{API_VERSION}/workers/#{worker_id}\",\n :basic_auth => auth)\n\n Response.new(response.body, response.code, response.response)\n end", "def index\n @workers_roles = WorkersRole.all\n end", "def index\n @workdetails = Workdetail.where(\"task_id = ?\", params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workdetails }\n end\n end", "def index\n @my_ministries = MyMinistry.all\n @ministries = Ministry.find(:all, order: \"id\")\n @coworkers = Coworker.all\n person_count = 0\n @coworkers.each do |coworker|\n if coworker.ministries.any?\n person_count += 1\n end\n end\n @joined_ministry_person_count = person_count\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_ministries }\n end\n end", "def update\n respond_to do |format|\n if @staff_worker.update(staff_worker_params)\n format.html { redirect_to @staff_worker, notice: 'Данные сохранены' }\n format.json { render :show, status: :ok, location: @staff_worker }\n else\n format.html { render :edit }\n format.json { render json: @staff_worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def worker\n Worker.find_by_code worker_code\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def new\n @worker = Worker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @worker }\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to tenant_workers_path, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @worker_jobs = WorkerJob.all.page(params[:page])\n end", "def show\n @worker = Worker.find(params[:id])\n @title = Title.find_by_id(@worker.title_id)\n @worker_type = WorkerType.find_by_id(@worker.worker_type_id)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @worker }\n end\n end", "def index\n @q = StaffWorker.eager_load(:subdivision => :company).ransack(params[:q])\n @staff_workers = @q.result(distinct: true)\n # @staff_workers = StaffWorker.all\n end", "def set_coworker\n @coworker = Coworker.find(params[:id])\n end", "def get_work\n client.make_request('/get-work', 'post', params: {})\n end", "def worker\n\n @services['s_worker']\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n delegates_for_current_profile\n @delegate = Delegate.new\n @staff_list = current_staff_profile.staff_list_json\n end", "def index \t\t\n\t\t@attributes = Request.new.attributes.keys - Request.protected_attributes.to_a\n\t\t@staff = Staff.find(params[:staff_id])\n\t\t@all_requests = Request.find_all_by_staff_id(params[:staff_id])\n\t\trespond_to do |format|\n\t \tformat.html\n\t \tformat.json{ render json: @staff}\n\t end \n\tend", "def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @breadcrumb = 'read'\n @work_order_labor = WorkOrderLabor.find(params[:id])\n @worker_orders = @work_order_labor.work_orders.paginate(:page => params[:page], :per_page => per_page).order('order_no')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_order_labor }\n end\n end", "def show\n @course_staff = CourseStaff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_staff }\n end\n end", "def create\n @worker = Worker.new(params[:worker])\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render json: @worker, status: :created, location: @worker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @event = Event.find(params[:id])\n if !params[:name].nil?\n @worker = Worker.find(params[:name])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to admin_path, notice: 'Worker was successfully created.' }\n format.json { render action: 'show', status: :created, location: @worker }\n else\n format.html { render action: 'new', :layout => \"dodawanie\"}\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end", "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end", "def index\n @waitstaffs = Waitstaff.all\n end", "def index\n @staffs = Staff.all\n end", "def index\n @staffs = Staff.all\n end", "def index\n @staffs = Staff.all\n end", "def show\n if !params[:item].nil?\n @worker_item = WorkerItem.find(params[:item])\n end\n @breadcrumb = 'read'\n @worker_salary = WorkerSalary.find(params[:id])\n @worker_salary_items = @worker_salary.worker_salary_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worker_salary }\n end\n end", "def workers\n @worker_supervisor.actors\n end", "def show\n @staff = Staff.find(params[:id])\n end", "def show\n @workobject = Workobject.find(params[:id])\n @wo_tasks = Task.where(workobject_id: params[:id])\n @wo_staff = Staffobjectjournal.where(workobject_id: params[:id])\n @wo_post = Post.where(workobject_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workobject }\n end\n end", "def show\r\n @second_work = SecondWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @second_work }\r\n end\r\n end", "def show\n @work_id = params[:id]\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @work }\n end\n end", "def show \n staff = Staff.find(params[:id])\n end", "def show\n @client_workout = ClientWorkout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_workout }\n end\n end", "def index\n \n @meeting_threads = @current_user.available_jobs\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_threads }\n end\n end", "def list_workers\n Shuttle::Redis.smembers worker_set_key\n end", "def get_registered_workers\n @registered_workers\n end", "def getwork(data)\n request :getwork, data\n end", "def show\n\t\t@work = Work.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @work }\n\t\tend\n\tend", "def create\n @worker = Worker.new(tl_params)\n\n if @worker.save\n render json: @worker, status: :created\n else\n render json: @worker.errors, status: :unprocessable_entity\n end\n end", "def show\n @breadcrumb = 'read'\n @work_order_status = WorkOrderStatus.find(params[:id])\n @worker_orders = @work_order_status.work_orders.paginate(:page => params[:page], :per_page => per_page).order('order_no')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_order_status }\n end\n end", "def show\n @work_process = WorkProcess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_process }\n end\n end", "def new\n @staff = Staff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @staff }\n end\n end", "def update_workers\n mongo_driver = Kymera::MongoDriver.new(address, port, database, 'workers')\n @registered_workers = mongo_driver.get_collection('workers')\n end", "def update\n respond_to do |format|\n if @worker.update(worker_params)\n format.html { redirect_to tenant_workers_path(@tenant), notice: 'Worker was successfully updated.' }\n format.json { render :show, status: :ok, location: @worker }\n else\n format.html { render :edit }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def staff_worker_params\n params.require(:staff_worker).permit(:name, :surname, :patronymic, :number_id, :subdivision_id, :birthday, :position, :duration_work, :labor_activity_type, :labor_activity_category, :duration_one_shift, :workplace_id, :work_in_workplace, :description_operation,:additional_workplace_id, :additional_work_in_workplace, :additional_description_operation)\n end", "def show\n @staff = Staff.find(params[:id])\n end", "def destroy\n @staff_worker.destroy\n respond_to do |format|\n format.html { redirect_to staff_workers_url, notice: 'Staff worker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n # raise params.to_s\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Работник создан.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @people_tasks = TasksPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people_tasks }\n end\n end", "def index\n @staffs = Staff.search(params[:searchText]).order(\"created_at desc\").paginate(page: params[:pageNumber], per_page: params[:pageSize])\n\n respond_to do |f|\n f.html { render 'staffs/index' }\n f.json { \n render json: {\n total: @staffs.total_entries,\n rows: @staffs.as_json({ index: true })\n } \n }\n end\n end", "def index\n workouts = @ws.workouts\n render json: workouts\n end", "def show\n @waiter = Waiter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @waiter }\n end\n end", "def show\n @sfjob = Sfjob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sfjob }\n end\n end", "def index\n @worker_types = WorkerType.all\n end", "def index\n @work_results = WorkResult.all\n end", "def get_work(data=nil)\n request('getwork', data)\n end", "def index\n @worker_salaries = WorkerSalary.paginate(:page => params[:page], :per_page => per_page).order('year desc')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @worker_salaries }\n end\n end", "def show\n #@workout = Workout.find_by_user_id(current_user)\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout }\n end\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"No workouts entered for this day\"\n redirect_to :back\n end", "def new\n @staff = Staff.new(:user_id => params[:user_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @staff }\n end\n end", "def new\n @admin_staff = Admin::Staff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_staff }\n end\n end" ]
[ "0.7242521", "0.70501035", "0.7044874", "0.6651676", "0.6651676", "0.6651676", "0.6651676", "0.6484898", "0.6458341", "0.63316524", "0.6321517", "0.6203339", "0.61982495", "0.6193231", "0.6171642", "0.616136", "0.61609364", "0.6154037", "0.61500394", "0.6123838", "0.6112934", "0.605657", "0.60549086", "0.602727", "0.6010535", "0.59808016", "0.5961745", "0.5953473", "0.5946204", "0.5932386", "0.5932386", "0.5932386", "0.5932386", "0.5932386", "0.5932386", "0.5932386", "0.5932386", "0.5932386", "0.59271437", "0.5908252", "0.5886754", "0.58748376", "0.5866387", "0.58621013", "0.58230245", "0.5802078", "0.5762527", "0.5762527", "0.5755547", "0.57453966", "0.5741211", "0.5729695", "0.5729695", "0.5729695", "0.5728661", "0.57254994", "0.5712459", "0.57109225", "0.5697773", "0.56956524", "0.56696594", "0.56696594", "0.56475705", "0.56411415", "0.56411415", "0.56411415", "0.56320137", "0.5628425", "0.56245077", "0.5620093", "0.5612925", "0.56100446", "0.5603756", "0.5578779", "0.55661416", "0.55649775", "0.5559329", "0.55545646", "0.5552316", "0.55516964", "0.5542134", "0.5519555", "0.5512779", "0.55075365", "0.550135", "0.5501104", "0.5494115", "0.5491902", "0.5488462", "0.5462406", "0.5460539", "0.5452199", "0.5448093", "0.54480666", "0.5446877", "0.54464483", "0.5443891", "0.5439181", "0.54387426", "0.54386055", "0.543522" ]
0.0
-1
POST /staff_workers POST /staff_workers.json
def create @staff_worker = StaffWorker.new(staff_worker_params) respond_to do |format| if @staff_worker.save format.html { redirect_to @staff_worker, notice: 'Данные сохранены' } format.json { render :show, status: :created, location: @staff_worker } else format.html { render :new } format.json { render json: @staff_worker.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to tenant_workers_path, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(tl_params)\n\n if @worker.save\n render json: @worker, status: :created\n else\n render json: @worker.errors, status: :unprocessable_entity\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(params[:worker])\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Worker was successfully created.' }\n format.json { render json: @worker, status: :created, location: @worker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # raise params.to_s\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to @worker, notice: 'Работник создан.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html { render :new }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to admin_path, notice: 'Worker was successfully created.' }\n format.json { render action: 'show', status: :created, location: @worker }\n else\n format.html { render action: 'new', :layout => \"dodawanie\"}\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def staff_worker_params\n params.require(:staff_worker).permit(:name, :surname, :patronymic, :number_id, :subdivision_id, :birthday, :position, :duration_work, :labor_activity_type, :labor_activity_category, :duration_one_shift, :workplace_id, :work_in_workplace, :description_operation,:additional_workplace_id, :additional_work_in_workplace, :additional_description_operation)\n end", "def create\n @workers_role = WorkersRole.new(workers_role_params)\n\n respond_to do |format|\n if @workers_role.save\n format.html { redirect_to @workers_role, notice: 'Workers role was successfully created.' }\n format.json { render :show, status: :created, location: @workers_role }\n else\n format.html { render :new }\n format.json { render json: @workers_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def worker_params\n params.require(:worker).permit(:title, :content, :user_id, { service_ids:[] })\n end", "def create_worker\n if @work_order_worker.present?\n render json: :conflict, status: :conflict\n else\n @work_order_worker = WorkOrderWorker.new\n @work_order_worker.assign_attributes(@json['data'])\n if !@json['data']['created_by']\n @work_order_worker.created_by = current_user.id if !current_user.nil?\n end\n if @work_order_worker.save\n render json: serialized_work_order_worker(@work_order_worker), status: :created\n else\n render json: format_errors(@work_order_worker), status: :unprocessable_entity\n end\n end\n end", "def create\n @staff = Staff.new(params[:staff])\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff, notice: 'Staff was successfully created.' }\n format.json { render json: @staff, status: :created, location: @staff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @staff = Staff.new(params[:staff])\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff.user, notice: 'Staff was successfully created.' }\n format.json { render json: @staff, status: :created, location: @staff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_staff = Admin::Staff.new(params[:admin_staff])\n\n respond_to do |format|\n if @admin_staff.save\n format.html { redirect_to @admin_staff, notice: 'Staff was successfully created.' }\n format.json { render json: @admin_staff, status: :created, location: @admin_staff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @staff = Staff.new(staff_params)\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff, notice: 'Staff was successfully created.' }\n format.json { render :show, status: :created, location: @staff }\n else\n format.html { render :new }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @staff = Staff.new(staff_params)\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff, notice: 'Staff was successfully created.' }\n format.json { render :show, status: :created, location: @staff }\n else\n format.html { render :new }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @staff = Staff.new(staff_params)\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff, notice: 'Staff was successfully created.' }\n format.json { render :show, status: :created, location: @staff }\n else\n format.html { render :new }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @staff = Staff.new(staff_params)\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff, notice: 'Staff was successfully created.' }\n format.json { render :show, status: :created, location: @staff }\n else\n format.html { render :new }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @staff = Staff.new(staff_params)\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff, notice: 'Staff was successfully created.' }\n format.json { render :show, status: :created, location: @staff }\n else\n format.html { render :new }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_staff = Admin::Staff.new(admin_staff_params)\n\n respond_to do |format|\n if @admin_staff.save\n format.html { redirect_to @admin_staff, notice: 'Staff was successfully created.' }\n format.json { render :show, status: :created, location: @admin_staff }\n else\n format.html { render :new }\n format.json { render json: @admin_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker = Worker.new(params[:worker])\n\n respond_to do |format|\n if @worker.save\n flash[:notice] = 'Worker was successfully created.'\n format.html { redirect_to(@worker) }\n format.xml { render :xml => @worker, :status => :created, :location => @worker }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @worker.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @waitstaff = Waitstaff.new(waitstaff_params)\n\n respond_to do |format|\n if @waitstaff.save\n format.html { redirect_to @waitstaff, notice: 'Waitstaff was successfully created.' }\n format.json { render :show, status: :created, location: @waitstaff }\n else\n format.html { render :new }\n format.json { render json: @waitstaff.errors, status: :unprocessable_entity }\n end\n end\n end", "def worker_params\n params.require(:worker).permit(:fn, :ln, :sn, :passport_num,\n :passport_ser, :birthday, :post, :departament_id,\n :departament_attributes => [:name, :id],\n project_worker_relations_attributes: [:_destroy, :project_id, :id,\n project_attributes: Project.attributes_names.map(&:to_sym).push(:_destroy)])\n end", "def update\n respond_to do |format|\n if @staff_worker.update(staff_worker_params)\n format.html { redirect_to @staff_worker, notice: 'Данные сохранены' }\n format.json { render :show, status: :ok, location: @staff_worker }\n else\n format.html { render :edit }\n format.json { render json: @staff_worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_staff_worker\n @staff_worker = StaffWorker.find(params[:id])\n end", "def create\n @staff_code = \"s%03d\" % (Staff.last.id.to_i+1)\n\n @staff = Staff.new(staff_params)\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to staffs_path, notice: 'Staff was successfully created.' }\n format.json { render :show, status: :created, location: @staff }\n else\n format.html { render :new }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @staff = Staff.new(staff_params)\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff, notice: (t 'staffs.title')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @staff }\n else\n format.html { render action: 'new' }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def worker_params\n params.require(:worker).permit(:name,:work_for,:workgroup,:mobile, :tenant_id,:phone,:area,:working_experience,:photo,:birthday,:insurance,:status,:kind)\n end", "def create\n @working_operation = WorkingOperation.new(working_operation_params)\n respond_to do |format|\n if @working_operation.save\n format.html { redirect_to staff_worker_path(@working_operation.staff_worker_id), notice: 'Данные сохранены' }\n format.json { render :show, status: :created, location: @working_operation }\n else\n format.html { render :new }\n format.json { render json: @working_operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n sub_cluster = params[\"dtcstaff\"][\"sub_cluster\"]\n @dtc_staff = DtcStaff.new(params[:dtc_staff])\n @dtc_staff.subcluster(sub_cluster)\n respond_to do |format|\n if @dtc_staff.save\n\n format.html { redirect_to dtc_staffs_url, notice: 'Route Associated' }\n format.json { render action: 'show', status: :created, location: @dtc_staff }\n else\n format.html { render action: 'new' }\n format.json { render json: @dtc_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @staff = Staff.create(staff[:)\n @staff = Staff.create(staff_params)\n redirect_to staff_path(staff)\n end", "def create\n @worker = Worker.new(params[:worker])\n @worker_types = WorkerType.find(:all)\n\n respond_to do |format|\n if @worker.save\n flash[:notice] = 'Worker was successfully created.'\n format.html { redirect_to(@worker) }\n format.xml { render :xml => @worker, :status => :created, :location => @worker }\n else\n @titles = Title.find(:all)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @worker.errors, :status => :unprocessable_entity }\n end\n end\n end", "def worker_params\n params.require(:worker).permit(:name, :skill_set, :admin_id)\n end", "def create\n @waiter = Waiter.new(waiter_params)\n\n respond_to do |format|\n if @waiter.save\n format.html { redirect_to waiters_manager_path(current_user), notice: i18n_notice('created',@waiter) }\n format.json { render action: 'show', status: :created, location: @waiter }\n else\n @workstations = current_user.workstations.select(:id, :name).map {|w| [w.name, w.id] }\n format.html { render action: 'new' }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end", "def worker_params\n params.require(:worker).permit(:name, :password, :email)\n end", "def create\n @staff_detail = StaffDetail.new(staff_detail_params)\n @staff_detail.staff_id = current_staff.id\n\n \n # respond_to do |format|\n if @staff_detail.save\n puts \"SAVED\"\n render json: @staff_detail\n else\n puts \"DID NOT SAVE\"\n p @staff_detail.errors\n end\n # end\n end", "def create\n @worker_job = WorkerJob.new(worker_job_params)\n\n respond_to do |format|\n if @worker_job.save\n format.html { redirect_to @worker_job, notice: 'Worker job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @worker_job }\n else\n format.html { render action: 'new' }\n format.json { render json: @worker_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def createWithStaff\n created_location = Company.create(params[\"company\"])\n if params[\"id\"]\n updated_person = Person.setCompany(params[\"id\"], created_location)\n end\n render json: created_location\n end", "def create\n @daw_staff = DawStaff.new(daw_staff_params)\n\n respond_to do |format|\n if @daw_staff.save\n format.html { redirect_to @daw_staff, notice: 'Daw staff was successfully created.' }\n format.json { render :show, status: :created, location: @daw_staff }\n else\n format.html { render :new }\n format.json { render json: @daw_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work.user_id = current_user.id\n\n respond_to do |format|\n if @work.save\n \n if current_user.roles[0].name != \"Administrador\"\n WorkMailer.new_work_alert(@work).deliver\n end\n \n format.html { redirect_to @work, :notice => 'Obra criada com sucesso!' }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n 1.times { @work.work_documents.build }\n load_cities_validate()\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @workshop = Workshop.new(workshop_params)\n puts \"====================================\"\n puts params['trainers']\n puts \"====================================\"\n trainers = params['trainers'].map do |id|\n Trainer.find(id)\n end\n @workshop.trainers << trainers\n\n\n respond_to do |format|\n if @workshop.save\n format.html { redirect_to @workshop, notice: 'Workshop was successfully created.' }\n format.json { render :show, status: :created, location: @workshop }\n else\n format.html { render :new }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @community_health_worker = CommunityHealthWorker.new(params[:community_health_worker])\n\n respond_to do |format|\n if @community_health_worker.save\n format.html { redirect_to @community_health_worker, notice: 'Community health worker was successfully created.' }\n format.json { render json: @community_health_worker, status: :created, location: @community_health_worker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @community_health_worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def worker_params\n params.require(:worker).permit(:imie, :nazwisko, :stanowisko, :pokoj, :email, :wydzial, :staz_pracy, :zdjecie, :title, :route)\n end", "def create\n @worker_type = WorkerType.new(worker_type_params)\n\n respond_to do |format|\n if @worker_type.save\n format.html { redirect_to @worker_type, notice: \"Worker type was successfully created.\" }\n format.json { render :show, status: :created, location: @worker_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @worker_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_workers(app_name, qty)\n deprecate # 07/31/2012\n put(\"/apps/#{app_name}/workers\", :workers => qty).to_s\n end", "def create\n @creator.works << Work.where(id: work_ids)\n if @creator.save\n render json: @creator, status: :created, location: @creator\n else\n render json: @creator.errors, status: :unprocessable_entity\n end\n end", "def create\n @lec_staff = LecStaff.new(lec_staff_params)\n\n respond_to do |format|\n if @lec_staff.save\n format.html { redirect_to @lec_staff, notice: 'Staff adicionada com sucesso.' }\n format.json { render :show, status: :created, location: @lec_staff }\n else\n format.html { render :new }\n format.json { render json: @lec_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_worker(id, worker_klasses)\n worker = Service::Worker.new(id: id, supervisor: self, klasses: worker_klasses)\n @workers[id] = worker\n worker\n end", "def create\r\n authorize(:staff)\r\n @staff = Staff.new(staff_params)\r\n\r\n if @staff.save\r\n redirect_to(staffs_path, notice: 'Staff registration successful')\r\n else\r\n # Will take care of the format\r\n respond_with(@staff)\r\n end\r\n end", "def create\n @course_staff = CourseStaff.new(params[:course_staff])\n\n respond_to do |format|\n if @course_staff.save\n format.html { redirect_to @course_staff, notice: 'Course staff was successfully created.' }\n format.json { render json: @course_staff, status: :created, location: @course_staff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @user = current_user\n # @team = Team.new(team_params)\n # @user.teams << @team\n @user = current_user\n @team = Team.new(team_params)\n @user.teams << @team\n @users = User.where(id: params[:team][:user_ids])\n # @users.each do |u|\n # @team.users << u if u.id != current_user.id\n # end\n respond_to do |format|\n if @team.save\n @team.update_attributes(created_by_id: current_user.id)\n @admin = User.find(@team.created_by_id)\n @users.each do |u|\n if u.id != current_user.id\n @team.users << u if u.id != current_user.id\n if current_user.is_turn_on == true\n\n # HardWorker.perform_async(u,@admin,@team)\n # ProjectMailer.delay.add_user_in_project(u,@admin,@team)\n\n # HardWorker.perform_async('bob', 5)\n # ProjectMailer.add_user_in_project(u,@admin,@team).deliver_now\n TeamMailer.add_user(@admin,u,@team).deliver_now\n \n end\n end\n end\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 @staff = Staff.new(staff_params)\n\n respond_to do |format|\n if @staff.save\n if @staff.admin == true\n format.html { redirect_to admins_path, notice: 'Admin was successfully created.' }\n format.json { render :show, status: :created, location: @staff }\n elsif @staff.super_admin == true\n format.html { redirect_to super_admins_path, notice: 'Super Admin was successfully created.' }\n format.json { render :show, status: :created, location: @staff }\n else\n format.html { redirect_to staffs_path, notice: 'Staff was successfully created.' }\n format.json { render :show, status: :created, location: @staff }\n end\n else\n format.html { render :new }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @worker = Worker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @worker }\n end\n end", "def create\n @staff = Staff.new(params[:staff])\n\n respond_to do |format|\n if @staff.save\n flash[:notice] = 'Staff was successfully created.'\n format.html { redirect_to(@staff) }\n format.xml { render :xml => @staff, :status => :created, :location => @staff }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @staff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def workers=(workers_config)\n @workers = if workers_config.nil?\n DEFAULT_WORKERS\n else\n workers_config.slice(1, workers_config.length).to_i\n end\n end", "def index\n @workers = Worker.all\n end", "def index\n @workers = Worker.all\n end", "def index\n @workers = Worker.all\n end", "def index\n @workers = Worker.all\n end", "def add_worker(worker)\n workers << worker\n end", "def workers_role_params\n params.require(:workers_role).permit(:worker_id, :role_id)\n end", "def task_worker_params\n params.require(:task_worker).permit(:status, :receive_date, :finish_date, :answer, :comment, :worker_id, :task_id)\n end", "def worker_params\n params.require(:worker).permit(:rut,:position,:local,:w_qf_apron, :m_qf_apron, :w_vmf_apron, :m_vmf_apron, :w_shirt, :m_shirt, :m_blue_trouser, :w_blue_trouser, :m_black_trouser, :w_black_trouser, :nativa_trouser, :beauty_trouser, :m_blue_polar, :w_blue_polar, :nativa_polar, :m_black_polar, :w_black_polar, :m_red_t_shirt, :w_red_t_shirt, :beauty_jacket, :beauty_polar, :yellow_t_shirt, :blue_tie, :red_tie, :m_cargo_trouser, :m_gray_t_shirt, :w_cargo_trouser, :w_gray_t_shirt, :m_black_t_shirt, :w_black_t_shirt, :observation)\n end", "def create\n @medical_staff = MedicalStaff.new(params[:medical_staff])\n\n respond_to do |format|\n if @medical_staff.save\n format.html { redirect_to @medical_staff, :notice => 'Medical staff was successfully created.' }\n format.json { render :json => @medical_staff, :status => :created, :location => @medical_staff }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @medical_staff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_workers\n mongo_driver = Kymera::MongoDriver.new(address, port, database, 'workers')\n @registered_workers = mongo_driver.get_collection('workers')\n end", "def create\r\n\r\n redirect_to(:action => :index) and return unless request.post?\r\n redirect_to(:action => :index) and return if params[:bg_worker].blank? || !params[:bg_worker].is_a?(Hash)\r\n @bg_worker_attributes = params[:bg_worker] ? params[:bg_worker]['0'].clone : {}\r\n\r\n @bg_worker = BgWorker.load_from_params(@bg_worker_attributes)\r\n if @bg_worker.errors.empty? && @bg_worker.save\r\n flash[:notice] = _(\"%{page} was successfully created.\") % {:page => _(\"Bg Worker\")}\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => {:id => @bg_worker.id}.merge(@bg_worker.attributes).to_json)\r\n return\r\n end\r\n else\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => ({:errors => @bg_worker.errors.full_messages}.merge(@bg_worker.attributes)).to_json)\r\n else\r\n render(:action => :new)\r\n end\r\n return\r\n end\r\n if params[:go_to].blank?\r\n redirect_to :action => (params[:commit_and_new] ? :new : :index)\r\n else\r\n redirect_to(params[:go_to])\r\n end\r\n end", "def create\n @group = Group.new(group_params)\n @group.current = true;\n @group.workers = workers_params[:list]\n\n#=begin\n respond_to do |format|\n if @group.save\n change_current\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n#=end\n end", "def set_worker\n @worker = Worker.find(params[:id])\n end", "def coworker_params\n params.require(:coworker).permit(:name, :arrived, :sha)\n end", "def set_worker\n @worker = current_admin.workers.find(params[:id])\n end", "def create\n if not (@current_user.worker? || @current_user.admin? || @current_user.produce? )\n redirect_to @current_user\n else\n @work = Work.new(params[:work])\n @users = User.find(:all)\n @projects = Project.find(:all)\n @job_types = JobType.find(:all)\n @places = Place.find(:all)\n respond_to do |format|\n if @work.save\n flash[:notice] = 'Work was successfully created.'\n format.html { redirect_to(@work) }\n format.xml { render :xml => @work, :status => :created, :location => @work }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create\n if request.xhr?\n @work = current_user.works.build(work_params)\n #@work = Work.new(work_params)\n if @work.save\n puts @work.status\n render :json => {:id => @work.id}\n else\n render :json => {:id => 0}\n end\n else\n render :json => {:id => 0}\n end\n end", "def destroy\n @staff_worker.destroy\n respond_to do |format|\n format.html { redirect_to staff_workers_url, notice: 'Staff worker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def worker_params\n params.require(:worker).permit(:rut,:position,:local,:w_qf_apron, :m_qf_apron, :w_vmf_apron, :m_vmf_apron, :w_dermo_apron, :w_shirt, :m_shirt, :m_blue_trouser, :w_blue_trouser, :m_black_trouser, :w_black_trouser, :w_purple_trouser, :w_white_trouser, :m_blue_polar, :w_blue_polar, :w_purple_polar, :m_black_polar, :w_black_polar, :cargo_trouser, :red_t_shirt, :black_t_shirt, :yellow_t_shirt, :gray_t_shirt, :blue_tie, :red_tie, :observation)\n end", "def create\n\n @work = Work.new(work_params)\n @user = User.find(session[:user_id]) \n \n respond_to do |format|\n if @work.save\n @user.works << @work\n format.html { redirect_to @work, notice: 'La actividad se registro con exito.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @work = Work.new(work_params)\n process_work_contributors\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render text: \"success\"}\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def workers_all\n @work_order_workers = WorkOrderWorker.by_id\n render json: serialized_work_order_workers(@work_order_workers)\n end", "def create\n @job = Job.new(job_params)\n\n if params[:job][:staff].present?\n params[:job][:staff].each do |s|\n @job.staff << Staff.where(id: s)\n end\n end\n if params[:job][:contractor].present?\n @job.contractor = Contractor.find(params[:job][:contractor])\n end\n if params[:job][:date_completed].present? and params[:job][:date_payment_recv].present? and params[:job][:date_completed] <= Time.now and params[:job][:date_payment_recv] <= Time.now\n @job.status = 0\n end\n puts @job.inspect\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @reduction = Reduction.new(reduction_params)\r\n @workers_create = Worker.where(workshop_id: params[:reduction][:workshop_id])\r\n\r\n respond_to do |format|\r\n if @reduction.save\r\n format.html { redirect_to reductions_path, notice: 'تم خصم المبلغ' }\r\n format.json { render :show, status: :created, location: @reduction }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reduction.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def worker_params\n params.require(:worker).permit(:salary, :exp_month)\n end", "def create\n @church_staff = ChurchStaff.new(church_staff_params)\n\n respond_to do |format|\n if @church_staff.save\n format.html { redirect_to @church_staff, notice: 'Church staff was successfully created.' }\n format.json { render :show, status: :created, location: @church_staff }\n else\n format.html { render :new }\n format.json { render json: @church_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @church_staff = ChurchStaff.new(params[:church_staff])\n \n\n respond_to do |format|\n if @church_staff.save\n format.html { redirect_to church_staff_path(@church_staff), notice: 'Church staff was successfully created.' }\n format.json { render json: @church_staff, status: :created, location: @church_staff }\n else\n flash.now.alert = \"Please fill all required fields.\"\n format.html { render action: \"new\" }\n format.json { render json: @church_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@my_ministry = MyMinistry.new(params[:my_ministry])\n flash[:success] = \"我到这了!\"\n @coworker = current_coworker\n ministry = Ministry.find(params[:ministry_id])\n @my_ministry = @coworker.my_ministries.build(ministry: ministry)\n respond_to do |format|\n if @my_ministry.save\n flash[:success] = \"祝贺你,加入事工了!\"\n format.html { redirect_to ministries_url }\n format.json { render json: @my_ministry, status: :created, location: @my_ministry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dock_worker = DockWorker.new(dock_worker_params)\n\n respond_to do |format|\n if @dock_worker.save\n format.html { redirect_to @dock_worker, notice: 'Dock worker was successfully created.' }\n format.json { render :show, status: :created, location: @dock_worker }\n else\n format.html { render :new }\n format.json { render json: @dock_worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worklist = Worklist.new(worklist_params)\n\n respond_to do |format|\n if @worklist.save\n format.html { redirect_to @worklist, notice: 'Worklist was successfully created.' }\n format.json { render :show, status: :created, location: @worklist }\n else\n format.html { render :new }\n format.json { render json: @worklist.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_workers_role\n @workers_role = WorkersRole.find(params[:id])\n end", "def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end", "def create\n @work = Work.new(params[:work].except(:extra_keys, :extra_values))\n @work.extra = process_extra if params[:extra_keys]\n \n current_dataset.works << @work\n \n Work.create_locations(@work) if @work.places\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @stages_work = StagesWork.new(params[:stages_work])\r\n\r\n respond_to do |format|\r\n if @stages_work.save\r\n format.html { redirect_to @stages_work, notice: 'Stages work was successfully created.' }\r\n format.json { render json: @stages_work, status: :created, location: @stages_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @stages_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n JobsWorker.perform_async(@job.id, @job.server.id)\n flash[:success] = 'Job was successfully created.'\n format.html { redirect_to jobs_path }\n format.json { render :show, status: :created, location: @job }\n else\n flash[:error] = 'Please fill all fields correctly !!'\n format.html { redirect_to root_url }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_workers\n @workers.times do |id|\n pid = fork { Worker.new(@options.merge(id: id)).start }\n @forks << { id: id, pid: pid }\n end\n end", "def create\n @staff_member = User.new(admin_staff_member_params)\n @staff_member.role = User.roles[:staff]\n temp_password = SecureRandom.hex(8)\n @staff_member.password = temp_password\n @staff_member.temp_password = temp_password\n\n if @staff_member.save\n SendWelcomeStaffMailJob.perform_later(@staff_member.id)\n redirect_to admin_staffs_path\n else\n render :new\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.work'))\n if @patron\n @patron.works << @work\n end\n format.html { redirect_to @work }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n prepare_options\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def staff_params\n params.require(:staff).permit(:first_name, :middle_name, :last_name, :email, :address_line_1, \n :address_line_2, :city, :county, :post_code, :ni, :dob, :start_date, :end_date, \n :staff_no, :job_title, :location, :profile_photo, :tel_number, :mobile_number, \n :next_of_kin, :next_of_kin_tel, :sort_code, :account_number, :bank)\n end", "def create\n @sim_staff = SimStaff.new(params[:sim_staff])\n\n respond_to do |format|\n if @sim_staff.save\n flash[:notice] = 'SimStaff was successfully created.'\n format.html { redirect_to(@sim_staff) }\n format.xml { render :xml => @sim_staff, :status => :created, :location => @sim_staff }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sim_staff.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6947815", "0.67183036", "0.6668612", "0.6668612", "0.6668612", "0.6618786", "0.6567185", "0.6517283", "0.63768846", "0.62740093", "0.62140656", "0.6193138", "0.6146582", "0.6123193", "0.6116307", "0.60847956", "0.60847956", "0.60847956", "0.60847956", "0.60847956", "0.60827184", "0.6054628", "0.6049602", "0.6033825", "0.6022321", "0.5936067", "0.5913086", "0.58972514", "0.58895016", "0.58846164", "0.5874693", "0.58577406", "0.5809594", "0.5777423", "0.5775948", "0.5741977", "0.5741385", "0.57370794", "0.57317257", "0.569873", "0.5698721", "0.5653759", "0.56357855", "0.56348413", "0.5597111", "0.55842847", "0.558103", "0.5569633", "0.5559891", "0.5508665", "0.55022067", "0.5488252", "0.5476431", "0.5452423", "0.54483956", "0.5439001", "0.5438227", "0.5438227", "0.5438227", "0.5438227", "0.54307467", "0.54275346", "0.54266053", "0.5421986", "0.54212207", "0.54208875", "0.541973", "0.54173154", "0.5416498", "0.5410395", "0.54102683", "0.5410006", "0.54052", "0.5402088", "0.5398197", "0.5382928", "0.5380963", "0.53804934", "0.53723776", "0.53600913", "0.53547215", "0.53547215", "0.5351617", "0.5351617", "0.5347769", "0.53456074", "0.53450173", "0.5341376", "0.53214866", "0.53214103", "0.5317597", "0.5314989", "0.52891296", "0.52812684", "0.5279963", "0.52756464", "0.527403", "0.52732104", "0.5272535", "0.5268958" ]
0.73074555
0
PATCH/PUT /staff_workers/1 PATCH/PUT /staff_workers/1.json
def update respond_to do |format| if @staff_worker.update(staff_worker_params) format.html { redirect_to @staff_worker, notice: 'Данные сохранены' } format.json { render :show, status: :ok, location: @staff_worker } else format.html { render :edit } format.json { render json: @staff_worker.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @worker = Worker.find(params[:id])\n\n respond_to do |format|\n if @worker.update_attributes(params[:worker])\n format.html { redirect_to @worker, notice: 'Worker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @worker.update(worker_params)\n format.html { redirect_to tenant_workers_path(@tenant), notice: 'Worker was successfully updated.' }\n format.json { render :show, status: :ok, location: @worker }\n else\n format.html { render :edit }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n if @staff.update_attributes(params[:staff])\n format.html { redirect_to @staff, notice: 'Staff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_staff = Admin::Staff.find(params[:id])\n\n respond_to do |format|\n if @admin_staff.update_attributes(params[:admin_staff])\n format.html { redirect_to @admin_staff, notice: 'Staff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n staff = Staff.find(params[:id])\n #assign new attributes\n staff.assign_attributes(staff_params)\n ## check for any validations \n if staff.valid?\n staff.save \n render json: staff\n else \n reder json: staff.errors.full_messages\n end \n\n end", "def update\n respond_to do |format|\n if @worker.update(worker_params)\n format.html { redirect_to workers_path, notice: 'Worker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @staff = Staff.find(params[:id])\n respond_to do |format|\n if @staff.update(staff_params)\n format.html { redirect_to @staff, notice: 'Staff was successfully updated.' }\n format.json { render :show, status: :ok, location: @staff }\n else\n format.html { render :edit }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @staff.update(staff_params)\n format.html { redirect_to @staff, notice: 'Staff was successfully updated.' }\n format.json { render :show, status: :ok, location: @staff }\n else\n format.html { render :edit }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @staff.update(staff_params)\n format.html { redirect_to @staff, notice: 'Staff was successfully updated.' }\n format.json { render :show, status: :ok, location: @staff }\n else\n format.html { render :edit }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @staff.update(staff_params)\n format.html { redirect_to @staff, notice: 'Staff was successfully updated.' }\n format.json { render :show, status: :ok, location: @staff }\n else\n format.html { render :edit }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @staff.update(staff_params)\n format.html { redirect_to @staff, notice: 'Staff was successfully updated.' }\n format.json { render :show, status: :ok, location: @staff }\n else\n format.html { render :edit }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @staff.update(staff_params)\n format.html { redirect_to @staff, notice: (t 'staffs.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @staff_detail.update(staff_detail_params)\n render json: {success: true}\n end\n end", "def update\n @worker = Worker.find(params[:id])\n\n if @worker.update(tl_params)\n head :no_content\n else\n render json: @worker.errors, status: :unprocessable_entity\n end\n end", "def update\n # raise params.to_s\n respond_to do |format|\n if @worker.update(worker_params)\n format.html { redirect_to @worker, notice: 'Работник обновлен.' }\n format.json { render :show, status: :ok, location: @worker }\n else\n format.html { render :edit }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:job][:staff].present?\n @job.staff.clear\n params[:job][:staff].each do |s|\n @job.staff << Staff.where(id: s)\n end\n end\n if params[:job][:contractor].present?\n @job.contractor = Contractor.find(params[:job][:contractor])\n end\n if params[:job][:date_completed].present? and params[:job][:date_payment_recv].present? and params[:job][:date_completed] <= Time.now and params[:job][:date_payment_recv] <= Time.now\n @job.status = 0\n end\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_staff.update(admin_staff_params)\n format.html { redirect_to @admin_staff, notice: 'Staff was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_staff }\n else\n format.html { render :edit }\n format.json { render json: @admin_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @worker.update(worker_params)\n format.html { redirect_to admin_path, notice: 'Worker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit', :layout => \"dodawanie\" }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_staff_worker\n @staff_worker = StaffWorker.find(params[:id])\n end", "def update\n sub_cluster = params[\"dtcstaff\"][\"sub_cluster\"]\n @dtc_staff.subcluster(sub_cluster) \n respond_to do |format|\n if @dtc_staff.update(params[:dtc_staff])\n format.html { redirect_to dtc_staffs_url, notice: 'Route Updated' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dtc_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @staff = Staff.find(params[:id])\n @notice = 'Staff was successfully updated.';\n\n respond_to do |format|\n if @staff.update_attributes(params[:staff])\n format.html { redirect_to @staff.user, notice: @notice }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @staff_code = \"s%03d\" % (Staff.find(params[:id]).id.to_i)\n \n respond_to do |format|\n if @staff.update(staff_params)\n format.html { redirect_to staffs_path, notice: 'Staff was successfully updated.' }\n format.json { render :show, status: :ok, location: @staff }\n else\n format.html { render :edit }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @staff.update(staff_params)\n if @staff.admin == true\n format.html { redirect_to admins_path, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :created, location: @staff }\n elsif @staff.super_admin == true\n format.html { redirect_to super_admins_path, notice: 'Super Admin was successfully updated.' }\n format.json { render :show, status: :created, location: @staff }\n else\n format.html { redirect_to staffs_path, notice: 'Staff was successfully updated.' }\n format.json { render :show, status: :created, location: @staff }\n end\n else\n format.html { render :edit }\n format.json { render json: @staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @waitstaff.update(waitstaff_params)\n format.html { redirect_to @waitstaff, notice: 'Waitstaff was successfully updated.' }\n format.json { render :show, status: :ok, location: @waitstaff }\n else\n format.html { render :edit }\n format.json { render json: @waitstaff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @worker_job.update(worker_job_params)\n format.html { redirect_to @worker_job, notice: 'Worker job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @worker_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @course_staff = CourseStaff.find(params[:id])\n\n respond_to do |format|\n if @course_staff.update_attributes(params[:course_staff])\n format.html { redirect_to @course_staff, notice: 'Course staff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lec_staff.update(lec_staff_params)\n format.html { redirect_to @lec_staff, notice: 'Staff actualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @lec_staff }\n else\n format.html { render :edit }\n format.json { render json: @lec_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @worker.answered = true\n if @worker.update(worker_params)\n format.html { redirect_to @worker, notice: 'La encuesta fue recibida con éxito' }\n format.json { render :show, status: :ok, location: @worker }\n else\n format.html { redirect_to root_path, alert: 'Hubo un problema y no pudimos guardar sus respuestas.' }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @worker.answered = true\n if @worker.update(worker_params)\n format.html { redirect_to @worker, notice: 'La encuesta fue recibida con éxito' }\n format.json { render :show, status: :ok, location: @worker }\n else\n format.html { redirect_to root_path, alert: 'Hubo un problema y no pudimos guardar sus respuestas.' }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n errors = Work.update(current_user, params[:id], work_params)\n if !errors\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: { error: errors }, status: :unprocessable_entity }\n end\n end\n end", "def update\n @staff = Staff.find(params[:id])\n current_staff.update(params[:id])\n redirect_to staffs_path\n end", "def update\n @staff_pick = StaffPick.find(params[:id])\n\n respond_to do |format|\n if @staff_pick.update_attributes(params[:staff_pick])\n flash[:notice] = 'StaffPick was successfully updated.'\n format.html { redirect_to(admin_staff_pick_path(@staff_pick)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @staff_pick.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @workers_role.update(workers_role_params)\n format.html { redirect_to @workers_role, notice: 'Workers role was successfully updated.' }\n format.json { render :show, status: :ok, location: @workers_role }\n else\n format.html { render :edit }\n format.json { render json: @workers_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @worker = Worker.find(params[:id])\n\n respond_to do |format|\n if @worker.update_attributes(params[:worker])\n flash[:notice] = 'Worker was successfully updated.'\n format.html { redirect_to(@worker) }\n format.xml { head :ok }\n else\n @titles = Title.find(:all)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @worker.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n authorize @staff_request\n respond_to do |format|\n if @staff_request.update(staff_request_params)\n format.html do\n redirect_to @staff_request,\n notice: \"Staff request for #{@staff_request.description} was successfully updated.\"\n end\n format.json { render :show, status: :ok, location: @staff_request }\n else\n format.html do\n assign_selectable_departments_and_units(@staff_request)\n render :new\n end\n format.json { render json: @staff_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @daw_staff.update(daw_staff_params)\n format.html { redirect_to @daw_staff, notice: 'Daw staff was successfully updated.' }\n format.json { render :show, status: :ok, location: @daw_staff }\n else\n format.html { render :edit }\n format.json { render json: @daw_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n respond_to do |format|\n if @worker.update(worker_params)\n format.html { redirect_to @worker, notice: 'Worker was successfully updated.' }\n format.json { render :show, status: :ok, location: @worker }\n else\n format.html { render :edit }\n format.json { render json: @worker.errors, status: :unprocessable_entity }\n end\n end\n rescue ActiveRecord::StatementInvalid => e\n flash[:error] = e.message\n render :edit\n #redirect_to worker_error_path\n end\n end", "def update\n update = {:user_id => @user['id']}\n staff = Staff.find(params[:id])\n render :status => 404, :text => \"404\" unless staff\n\n if params[:phone]\n val = params[:phone]\n update[:phone] = val\n end\n if params[:room]\n val = params[:room]\n update[:room] = val\n end\n if params[:email]\n val = params[:email]\n update[:email] = val\n end\n if params[:reception]\n val = params[:reception]\n update[:reception] = val\n end\n staff.update_attributes update\n if params[:editable]\n return render :text => val\n end\n redirect_to \"/staff/\" + params[:id]\n end", "def update\n @medical_staff = MedicalStaff.find(params[:id])\n\n respond_to do |format|\n if @medical_staff.update_attributes(params[:medical_staff])\n format.html { redirect_to @medical_staff, :notice => 'Medical staff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @medical_staff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sfjob = Sfjob.find(params[:id])\n\n respond_to do |format|\n if @sfjob.update_attributes(params[:sfjob])\n format.html { redirect_to @sfjob, notice: 'Sfjob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sfjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @workers = Worker.where(workshop_id: params[:reduction][:workshop_id])\r\n respond_to do |format|\r\n if @reduction.update(reduction_params)\r\n format.html { redirect_to reductions_path, notice: 'تم تعديل الخصم' }\r\n format.json { render :show, status: :ok, location: @reduction }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @reduction.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n if @staff.update_attributes(params[:staff])\n flash[:notice] = '更新しました(指導員)'\n format.html { redirect_to(@staff) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @staff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sim_staff = SimStaff.find(params[:id])\n\n respond_to do |format|\n if @sim_staff.update_attributes(params[:sim_staff])\n flash[:notice] = 'SimStaff was successfully updated.'\n format.html { redirect_to(@sim_staff) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sim_staff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @staffer = Staffer.find(params[:id])\n\n respond_to do |format|\n if @staffer.update_attributes(params[:staffer])\n format.html { redirect_to @staffer, notice: 'Staffer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @staffer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:plan][:worker_ids] ||= []\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n flash[:notice] = 'Plan was successfully updated.'\n format.html { redirect_to(@plan) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job_folio = JobFolio.find(params[:id])\n\n respond_to do |format|\n if @job_folio.update_attributes(params[:job_folio])\n format.html { redirect_to @job_folio, notice: 'Job folio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_folio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @trip = Trip.find(current_trip(current_user))\n\n #出车人员改动\n if params[:workers_ids_] and params[:workers_ids_].size > 0\n #修改出车人员\n origin_workers_ids = @trip.workers_ids.split(',')\n param_workers_ids = params[:workers_ids_].clone\n @trip.workers_ids = param_workers_ids.join(',')\n #删除被删除的工作人员\n origin_workers_ids.each { |owi|\n if param_workers_ids.index(owi).nil?\n worker = Worker.find(owi)\n trip_user_delete(worker)\n @trip.workers.delete(worker)\n else\n param_workers_ids.delete(owi)\n end\n }\n #增加被添加的工作人员\n param_workers_ids.each { |wi|\n worker = Worker.find(wi)\n @trip.workers << worker\n #冲突\n if @trip.ing\n if in_trip?(worker)\n @trip.workers.delete(worker)\n @trip.errors.add(:workers, \"就在刚才,你选的工作人员被别人选了,概率很小哦~ 囧~~~ 选其它人吧。\")\n else\n trip_user_add(@trip, worker)\n end\n end\n }\n end\n\n #其它改动\n @trip.destination_id = params[:destination_id]\n @trip.departure_time = params[:departure_time]\n @trip.back_time = params[:back_time]\n @trip.note_id = params[:note_id]\n @trip.workers_names = @trip.generate_workers_names\n\n\n respond_to do |format|\n format.html do\n if params[:workers_ids_] and params[:workers_ids_].size > 0 and @trip.errors.empty? and @trip.save\n #submit为保存修改\n flash[:success] = \"修改已保存!\"\n sign_in(current_user)\n redirect_to '/workers/tour'\n else\n @cars = Car.where(\"current_trip = ? OR current_trip = ?\", @trip.id, 0).order(\"model\").all\n @drivers = Driver.where(\"current_trip = ? OR current_trip = ?\", @trip.id, 0).order(\"group_id\").all\n @drivership = @trip.drivership\n @selected_key = @trip.workers_ids.split(\",\")\n @in_trip_users_ids = in_trip_users(@trip)\n @trip.errors.add(:workers, \"工作人员不能为空\") unless params[:workers_ids_] and params[:workers_ids_].size > 0\n\n sign_in(current_user)\n render '/workers/status/tour'\n end\n end\n format.js\n end\n end", "def update\n if @staff.update(staff_params)\n flash[:success] = \"信息修改成功。\"\n redirect_to @staff\n else\n flash[:warning] = \"信息修改失败。\"\n render :edit\n end\n end", "def update\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n if @tasks_person.update_attributes(params[:tasks_person])\n format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tasks_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pending_work.update(pending_work_params)\n format.html { redirect_to @pending_work, notice: 'Pending work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pending_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @community_health_worker = CommunityHealthWorker.find(params[:id])\n\n respond_to do |format|\n if @community_health_worker.update_attributes(params[:community_health_worker])\n format.html { redirect_to @community_health_worker, notice: 'Community health worker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @community_health_worker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @staff_measurement.update(staff_measurement_params)\n format.html { redirect_to @staff_measurement, notice: (t 'staff_measurements.title')+(t 'actions.updated')}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @staff_measurement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @workdetail = Workdetail.find(params[:id])\n @taskid = @workdetail.task_id\n respond_to do |format|\n if @workdetail.update_attributes(params[:workdetail])\n format.html { redirect_to :action => \"show\", :id => @taskid, notice: 'Workdetail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work = Work.find(params[:id])\n work_params = params[:work]\n work_params.delete('progress')\n respond_to do |format|\n if @work.update_attributes(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @worker_type.update(worker_type_params)\n format.html { redirect_to @worker_type, notice: \"Worker type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @worker_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @worker_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n @job_request = job_requests.find( params[ :id ] )\n rescue ActiveRecord::RecordNotFound\n @job_request = nil\n end\n\n respond_to do |format|\n if @job_request && @job_request.update_attributes( params[ :job_request ] )\n format.html { redirect_to root_path, notice: \"Job Requests Updated Successfully\"}\n format.json { head :no_content }\n else\n format.html { redirect_to root_path, notice: \"Update Failed\" }\n format.json { render json: @job_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @church_staff.update(church_staff_params)\n format.html { redirect_to @church_staff, notice: 'Church staff was successfully updated.' }\n format.json { render :show, status: :ok, location: @church_staff }\n else\n format.html { render :edit }\n format.json { render json: @church_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: '修改成功!' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @staff_code.update(staff_code_params)\n format.html { redirect_to @staff_code, notice: 'Staff code was successfully updated.' }\n format.json { render :show, status: :ok, location: @staff_code }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @staff_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @waiter.update(waiter_params.slice(:name, :email, :mobile))\n format.html { redirect_to waiters_manager_path(current_user), notice: i18n_notice('updated',@waiter) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @stages_work = StagesWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @stages_work.update_attributes(params[:stages_work])\r\n format.html { redirect_to @stages_work, notice: 'Stages work was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @stages_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @waiter = Waiter.find(params[:id])\n\n respond_to do |format|\n if @waiter.update_attributes(params[:waiter])\n format.html { redirect_to @waiter, notice: 'Waiter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def update\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n if @employer.update_attributes(params[:employer])\n format.html { redirect_to @employer, :flash => {notice: 'Employer was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to user_work_path(@user.id, @work.id), notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end \n end\n end", "def update\r\n authorize(:staff)\r\n\r\n # Remove the password from params so it does not updated if it is blank\r\n params[:staff].delete(:password) if params[:staff][:password].blank?\r\n params[:staff].delete(:password_confirmation) if params[:staff][:password_confirmation].blank?\r\n\r\n if @staff.update(staff_params)\r\n redirect_to(staffs_path, notice: 'Staff update successful')\r\n else\r\n # Will take care of the format\r\n respond_with(@staff)\r\n end\r\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n process_work_contributors\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @worker_salary = WorkerSalary.find(params[:id])\n @worker_salary.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @worker_salary.update_attributes(params[:worker_salary])\n format.html { redirect_to worker_salary_path(@worker_salary, item: @worker_salary.worker_item),\n notice: (crud_notice('updated', @worker_salary) + \"#{undo_link(@worker_salary)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @worker_salary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @scientific_work.update(scientific_work_params)\n format.html { redirect_to @scientific_work, notice: 'Scientific work was successfully updated.' }\n format.json { render :show, status: :ok, location: @scientific_work }\n else\n format.html { render :edit }\n format.json { render json: @scientific_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update_attributes(params[:work])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.work'))\n format.html { redirect_to work_url(@work) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render :action => \"edit\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @second_work = SecondWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @second_work.update_attributes(params[:second_work])\r\n format.html { redirect_to @second_work, notice: 'Second work was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @second_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def staff_worker_params\n params.require(:staff_worker).permit(:name, :surname, :patronymic, :number_id, :subdivision_id, :birthday, :position, :duration_work, :labor_activity_type, :labor_activity_category, :duration_one_shift, :workplace_id, :work_in_workplace, :description_operation,:additional_workplace_id, :additional_work_in_workplace, :additional_description_operation)\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @room = Room.find(params[:id])\n respond_to do |format|\n if @room.update_attributes(params[:room])\n format.html { redirect_to staff_path(@room.id), notice: 'Room was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: staff_path(@room.id).errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @witness = Witness.find(params[:id])\n\n respond_to do |format|\n if @witness.update_attributes(params[:witness])\n # commented so hosts font receive emails off season\n # if(params[:witness][:host_id].present?)\n # HostMailer.witness_assigned(\n # params[:witness][:host_id],\n # @witness.id,\n # I18n.locale\n # ).deliver\n\n #@host = Host.find(params[:witness][:host_id])\n #@host.update_attributes(assignment_time: Time.now.utc.localtime)\n #end\n\n\n \n format.json { render json: @witness, status: :created, location: @witness }\n else\n format.json { render json: @witness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_staffnote\n @document = Document.find(params[:id])\n @document.staff_note = params[:document][:staff_note]\n respond_to do |format|\n if current_user.role < 4\n if @document.save\n format.js {render \"shared/save_success\"}\n else\n format.js {render \"shared/save_failed\"}\n end\n else\n format.js {render \"shared/save_failed\"}\n end\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to @work, :notice => 'Obra atualizada com sucesso!' }\n format.json { head :no_content }\n else\n 1.times { @work.work_documents.build }\n load_cities_validate()\n format.html { render :action => \"edit\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def 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 @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @foo77.update(foo77_params)\n format.html { redirect_to @foo77, notice: \"Foo77 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @foo77 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @foo77.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end", "def update\n @scheduler = Scheduler.find(params[:id])\n\n respond_to do |format|\n if @scheduler.update_attributes(params[:scheduler])\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @scientific_work = ScientificWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @scientific_work.update_attributes(params[:scientific_work])\r\n format.html { redirect_to @scientific_work, notice: 'Scientific work was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @scientific_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @firework_detail.update(firework_detail_params)\n format.html { redirect_to @firework_detail, notice: 'Firework detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @firework_detail }\n else\n format.html { render :edit }\n format.json { render json: @firework_detail.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.68921345", "0.6831025", "0.682848", "0.6788736", "0.67613775", "0.67549795", "0.66988367", "0.6628822", "0.6628822", "0.6628822", "0.6628822", "0.6616776", "0.65908563", "0.65558666", "0.65186435", "0.65142864", "0.65039796", "0.645864", "0.6324981", "0.6320896", "0.627036", "0.62676704", "0.6257212", "0.62500834", "0.624047", "0.62357104", "0.62303793", "0.6229772", "0.6229772", "0.619865", "0.61893415", "0.6175447", "0.6130183", "0.6128113", "0.6117568", "0.60883504", "0.6076756", "0.60453314", "0.60165364", "0.6005237", "0.59735304", "0.5962169", "0.59611535", "0.59590346", "0.5946208", "0.5943663", "0.5912172", "0.5908673", "0.58824396", "0.58799917", "0.5870429", "0.5866381", "0.5865369", "0.5865059", "0.5863841", "0.5860509", "0.585915", "0.5854821", "0.5854821", "0.5854821", "0.5854821", "0.58456206", "0.5838042", "0.5833119", "0.5821786", "0.58155435", "0.5805615", "0.58021927", "0.5796859", "0.5792765", "0.57888454", "0.5778085", "0.5771511", "0.57708323", "0.5768758", "0.57673866", "0.5767382", "0.5763092", "0.57518953", "0.5751686", "0.5751686", "0.5749635", "0.5743031", "0.5741011", "0.57359105", "0.5733903", "0.5731305", "0.5729783", "0.57254666", "0.57050765", "0.56981635", "0.5696429", "0.56873393", "0.568396", "0.5682369", "0.5681991", "0.5679426", "0.5676807", "0.5675806", "0.56743944" ]
0.7254535
0
DELETE /staff_workers/1 DELETE /staff_workers/1.json
def destroy @staff_worker.destroy respond_to do |format| format.html { redirect_to staff_workers_url, notice: 'Staff worker was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @worker.destroy\n respond_to do |format|\n format.html { redirect_to workers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @worker.destroy\n respond_to do |format|\n format.html { redirect_to workers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @worker = Worker.find(params[:id])\n @worker.destroy\n\n respond_to do |format|\n format.html { redirect_to workers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_staff = Admin::Staff.find(params[:id])\n @admin_staff.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_staffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff = Staff.find(params[:id])\n @staff.destroy\n\n respond_to do |format|\n format.html { redirect_to staffs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @worker = Worker.find(params[:id])\n @worker.destroy\n\n respond_to do |format|\n format.html { redirect_to(workers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @worker = Worker.find(params[:id])\n @worker.destroy\n\n respond_to do |format|\n format.html { redirect_to(workers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @worker.destroy\n respond_to do |format|\n format.html { redirect_to tenant_workers_path, notice: 'Worker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff = Staff.find(params[:id])\n @staff.destroy\n respond_to do |format|\n format.html { redirect_to staffs_url, notice: 'Staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @worker_job.destroy\n respond_to do |format|\n format.html { redirect_to worker_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @worker.destroy\n respond_to do |format|\n format.html { redirect_to workers_url, notice: 'Worker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @worker.destroy\n respond_to do |format|\n format.html { redirect_to workers_url, notice: 'Worker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @worker.destroy\n respond_to do |format|\n format.html { redirect_to workers_url, notice: 'Worker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staffer = Staffer.find(params[:id])\n @staffer.destroy\n\n respond_to do |format|\n format.html { redirect_to staffers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_staff.destroy\n respond_to do |format|\n format.html { redirect_to admin_staffs_url, notice: 'Staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff.destroy\n respond_to do |format|\n format.html { redirect_to staffs_url, notice: 'Staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff.destroy\n respond_to do |format|\n format.html { redirect_to staffs_url, notice: 'Staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff.destroy\n respond_to do |format|\n format.html { redirect_to staffs_url, notice: 'Staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff.destroy\n respond_to do |format|\n format.html { redirect_to staffs_url, notice: 'Staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff.destroy\n respond_to do |format|\n format.html { redirect_to staffs_url, notice: 'Staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff.destroy\n respond_to do |format|\n format.html { redirect_to staffs_url, notice: 'Staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @community_health_worker = CommunityHealthWorker.find(params[:id])\n @community_health_worker.destroy\n\n respond_to do |format|\n format.html { redirect_to community_health_workers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dtc_staff.destroy\n respond_to do |format|\n format.html { redirect_to dtc_staffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @waitstaff.destroy\n respond_to do |format|\n format.html { redirect_to waitstaffs_url, notice: 'Waitstaff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff.destroy\n respond_to do |format|\n format.html { redirect_to staffs_url, notice: (t 'staffs.title')+(t 'actions.removed') }\n format.json { head :no_content }\n end\n end", "def destroy\n @daw_staff.destroy\n respond_to do |format|\n format.html { redirect_to daw_staffs_url, notice: 'Daw staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff_detail.destroy\n respond_to do |format|\n format.html { redirect_to staff_details_url, notice: 'Staff detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n staff = Staff.find(params[:id])\n staff.destroy\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @worker.destroy\n respond_to do |format|\n format.js\n format.html { redirect_to workers_url, notice: 'Работник удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff = Staff.find(params[:id])\n @staff.destroy\n\n respond_to do |format|\n format.html { redirect_to(staffs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @worker = Worker.find(params[:id])\n @worker.destroy\n\n head :no_content\n end", "def destroy\n @course_staff = CourseStaff.find(params[:id])\n @course_staff.destroy\n\n respond_to do |format|\n format.html { redirect_to course_staffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medical_staff = MedicalStaff.find(params[:id])\n @medical_staff.destroy\n\n respond_to do |format|\n format.html { redirect_to medical_staffs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sim_staff = SimStaff.find(params[:id])\n @sim_staff.destroy\n\n respond_to do |format|\n format.html { redirect_to(sim_staffs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @staffer.destroy\n respond_to do |format|\n format.html { redirect_to staffers_url, notice: 'Staffer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staffhour = Staffhour.find(params[:id])\n \n @staffhour.destroy\n respond_to do |format|\n format.html { redirect_to staffhours_url, notice: 'Staffhour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff_measurement.destroy\n respond_to do |format|\n format.html { redirect_to staff_measurements_url, notice: (t 'staff_measurements.title')+(t 'actions.removed') }\n format.json { head :no_content }\n end\n end", "def destroy\n @church_staff.destroy\n respond_to do |format|\n format.html { redirect_to church_staffs_url, notice: 'Church staff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @sfjob = Sfjob.find(params[:id])\n @sfjob.destroy\n\n respond_to do |format|\n format.html { redirect_to sfjobs_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @staffd = Staffd.find(params[:id])\n @staffd.destroy\n\n respond_to do |format|\n format.html { redirect_to(staffds_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end", "def destroy\n @staff_rec = StaffRec.find(params[:id])\n @staff_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to(staff_recs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n authorize @staff_request\n @staff_request.destroy\n respond_to do |format|\n format.html do\n redirect_to staff_requests_url,\n notice: \"Staff request for #{@staff_request.description} was successfully destroyed.\"\n end\n format.json { head :no_content }\n end\n end", "def destroy\n lect = Lecture.find(@lec_staff.lecture_id)\n @lec_staff.destroy\n respond_to do |format|\n format.html { redirect_to lecture_path(lect), notice: 'Staff removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n staff = Staff.find(params[:id])\n redirect_to staffs_path\n end", "def destroy\n @worker_type.destroy\n respond_to do |format|\n format.html { redirect_to worker_types_url, notice: \"Worker type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\r\n\r\n if params[:id].is_a?(Array)\r\n @success = BgWorker.destroy(params[:id])\r\n else\r\n @bg_worker = BgWorker.find_by_id(params[:id])\r\n @bg_worker.destroy unless @bg_worker.nil?\r\n @success = @bg_worker && @bg_worker.destroyed?\r\n end\r\n if @success\r\n flash[:notice] = _(\"%{model} %{name} successfully deleted.\") % {:model => _(\"Bg Worker\"), :name => @bg_worker.disp_name}\r\n else\r\n flash[:warning] = _(\"%{model} %{name} could not be deleted.\") % {:model => _(\"Bg Worker\"), :name => params[:name]}\r\n end\r\n if params[:format] != \"json\"\r\n if request.xhr?\r\n render :action => 'ajax_update', :layout => false\r\n else\r\n if params[:go_to].blank?\r\n redirect_to :action => :index\r\n else\r\n redirect_to(params[:go_to])\r\n end\r\n end\r\n else\r\n resp = {}\r\n if @success\r\n resp[:success] = true\r\n else\r\n resp[:success] = false\r\n resp[:error] = flash[:warning]\r\n end\r\n render :json => resp.to_json, :layout => false\r\n end\r\n end", "def destroy\n @workers_role.destroy\n respond_to do |format|\n format.html { redirect_to workers_roles_url, notice: 'Workers role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @current_staff = Certifier.where(:IsAvailable => true)\r\n @all_staff = Certifier.all\r\n @student_visit.destroy\r\n respond_to do |format|\r\n format.html { redirect_to student_visits_url, notice: 'Student visit was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def destroy\n @dock_worker.destroy\n respond_to do |format|\n format.html { redirect_to dock_workers_url, notice: 'Dock worker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @bill_quorum = BillQuorum.find(params[:id])\n @bill_quorum.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_quorums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with Job.find(params[:id]).delete\n end", "def destroy\n @work.destroy\n respond_to do |format|\n format.html { redirect_to works_url, notice: '删除成功!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @waiter = Waiter.find(params[:id])\n @waiter.destroy\n\n respond_to do |format|\n format.html { redirect_to waiters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @firework_detail.destroy\n respond_to do |format|\n format.html { redirect_to firework_details_url, notice: 'Firework detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_staff(employee)\n employee = Employee.find(employee.id)\n employee.delete!\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to mentor_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kickoff = Kickoff.find(params[:id])\n @kickoff.destroy\n\n respond_to do |format|\n format.html { redirect_to kickoffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.studysite.destroy_all\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #controllare che le location che lascia non siano vuote\n Work.check_n_destroy_locations(@work)\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to url_for current_dataset }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_work = UserWork.find(params[:id])\n @user_work.destroy\n tflash('delete', :success, {:model=>@@model, :count=>1})\n respond_to do |format|\n format.html { redirect_to(redis_databases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @staffnews.destroy\n respond_to do |format|\n format.html { redirect_to staffnews_index_url, notice: 'Staffnews was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @scientific_work.destroy\n respond_to do |format|\n format.html { redirect_to scientific_works_url, notice: 'Scientific work was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def destroy\n @work_log = WorkLog.find(params[:id])\n @work_log.destroy\n\n respond_to do |format|\n format.html { redirect_to work_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @father = Father.find(params[:id])\n @father.destroy\n\n respond_to do |format|\n format.html { redirect_to fathers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serv = Serv.find(params[:id])\n if @serv.mngbl\n #Remueve el MR a través de una llamada al webservice del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port}\n request = Net::HTTP::Delete.new(\"/mbs/#{@serv.domain}/#{@serv.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n @serv.destroy\n\n respond_to do |format|\n format.html { redirect_to servs_url, notice: t('servs.delete.notice') }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find_by(path: params[:id])\n\n destroy_directory(@contest.path)\n destroy_problems(@contest)#with submits\n destroy_participants(@contest)\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n #format.json { head :no_content }\n end\n end", "def destroy\n @pending_work.destroy\n respond_to do |format|\n format.html { redirect_to pending_works_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def destroy\n @job_runner.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_runners_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def destroy\n @stationeryrequest = Stationeryrequest.find(params[:id])\n @stationeryrequest.destroy\n\n respond_to do |format|\n format.html { redirect_to stationeryrequests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # Logic to delete a record\n @maintenance = Maintenance.find(params[:id])\n @maintenance.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work.destroy\n respond_to do |format|\n format.html { redirect_to user_works_url, notice: 'Work was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fax_job.destroy\n respond_to do |format|\n format.html { redirect_to fax_jobs_url, notice: 'Fax job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jobsite.destroy\n respond_to do |format|\n format.html { redirect_to jobsites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n format.html { redirect_to hackers_url }\n format.json { head :ok }\n end\n end", "def destroy\n #@job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end", "def destroy\n @step_seven.destroy\n respond_to do |format|\n format.html { redirect_to step_sevens_url, notice: 'Step seven was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pstaff.destroy\n respond_to do |format|\n format.html { redirect_to pstaffs_url, notice: 'Pstaff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @coordinator = Coordinator.find(params[:id])\n @coordinator.destroy\n\n respond_to do |format|\n format.html { redirect_to(coordinator_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tasks_person = TasksPerson.find(params[:id])\n @tasks_person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_tasks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @second_work = SecondWork.find(params[:id])\r\n @second_work.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to second_works_url }\r\n format.json { head :no_content }\r\n end\r\n end" ]
[ "0.7149248", "0.7149248", "0.71377444", "0.70102173", "0.6905355", "0.68210465", "0.68210465", "0.6817284", "0.6784668", "0.67674124", "0.6751715", "0.6751715", "0.6751715", "0.6738858", "0.66608405", "0.66542506", "0.66542506", "0.66542506", "0.66542506", "0.66542506", "0.66542506", "0.66438335", "0.6633856", "0.6631392", "0.6614472", "0.6591736", "0.6586383", "0.6567349", "0.6557378", "0.65304124", "0.6520658", "0.6517523", "0.65075386", "0.64946955", "0.6479271", "0.6451428", "0.64182216", "0.6388121", "0.6382639", "0.63667995", "0.63455707", "0.63340557", "0.6314251", "0.63093406", "0.6292402", "0.62660295", "0.62453043", "0.62385213", "0.6234798", "0.6233999", "0.62248254", "0.62207216", "0.621239", "0.61688066", "0.6164565", "0.6164103", "0.61520314", "0.61446625", "0.6137304", "0.6136039", "0.6130888", "0.6129173", "0.6128897", "0.6123186", "0.6122922", "0.61199594", "0.6103806", "0.6103806", "0.6103806", "0.6103806", "0.61025983", "0.61021763", "0.61015266", "0.6093904", "0.6083072", "0.60804665", "0.6078971", "0.607888", "0.6077983", "0.6077411", "0.60769963", "0.60733783", "0.6072794", "0.6069346", "0.6067862", "0.6065708", "0.6056716", "0.6052508", "0.6048134", "0.60466814", "0.6046124", "0.60400796", "0.60393137", "0.6038152", "0.6037884", "0.6037433", "0.60359895", "0.60355306", "0.60343647", "0.60317385" ]
0.73188215
0
Use callbacks to share common setup or constraints between actions.
def set_staff_worker @staff_worker = StaffWorker.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 staff_worker_params params.require(:staff_worker).permit(:name, :surname, :patronymic, :number_id, :subdivision_id, :birthday, :position, :duration_work, :labor_activity_type, :labor_activity_category, :duration_one_shift, :workplace_id, :work_in_workplace, :description_operation,:additional_workplace_id, :additional_work_in_workplace, :additional_description_operation) 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 valid_params_request?; 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 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 social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\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 model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\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 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 filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62909746", "0.62904227", "0.62837297", "0.6240993", "0.6239739", "0.6217764", "0.6214983", "0.62112504", "0.6194765", "0.6178", "0.61755055", "0.61729854", "0.61636627", "0.6153461", "0.6151674", "0.61478525", "0.6122671", "0.61188513", "0.61075556", "0.6105721", "0.6092412", "0.6081011", "0.6071054", "0.6064436", "0.6022111", "0.6018135", "0.60151577", "0.60108894", "0.60070235", "0.60070235", "0.6000806", "0.6000464", "0.5998811", "0.59926987", "0.5992257", "0.5991173", "0.5980311", "0.59660876", "0.59596545", "0.5959415", "0.59589994", "0.5957478", "0.5953214", "0.5952233", "0.5944033", "0.59396756", "0.59396756", "0.59386414", "0.59345603", "0.5931261", "0.5926345", "0.5925795", "0.59174526", "0.59108645", "0.5909469", "0.5908263", "0.59053195", "0.58980685", "0.5897738", "0.589657", "0.5895971", "0.58942044", "0.5892847", "0.588742", "0.58834344", "0.5880024", "0.58739793", "0.5868253", "0.5867907", "0.58670515", "0.58668053", "0.5865756", "0.5863549", "0.5863236", "0.5862728", "0.5861283", "0.58591247", "0.5855159", "0.5854291", "0.58512247", "0.58498096" ]
0.0
-1
=begin For the self manymany referential =end
def base_item if self.is_base_item == true return self elsif self.is_base_item == false return Item.find_by_id self.base_item_id end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_relation; end", "def each_ancestor # :nodoc:\n end", "def _parent; end", "def referenced; end", "def parentage\n get_parents unless @already_fetched_parents\n @already_fetched_parents = true\n super\n end", "def references; end", "def references; end", "def parents; end", "def associations; end", "def parents\n references\n end", "def model_relationships; end", "def transitive_closure\n end", "def begin_of_association_chain\n nil\n end", "def root_relation?; !parent end", "def references_to\n # REVISIT: If some other object has a Mapping to us, that should be in this list\n @mapping.all_member.select do |m|\n m.is_a?(MM::Absorption) and\n f = m.forward_mapping and # This Absorption has a forward counterpart, so must be reverse\n f.parent_role.is_unique\n end\n end", "def macro\n :belongs_to_related\n end", "def associated\n end", "def referenced?; end", "def children_table; end", "def each(&block)\n @relation.each(&block)\n end", "def parent; end", "def parent; end", "def parent; end", "def parent; end", "def parent; end", "def parent; end", "def parent; end", "def parent; end", "def parent; end", "def parent; end", "def parent; end", "def parent; end", "def refs_at; end", "def parent_ids\n []\n end", "def each_relation\n\t for rel in relations\n\t\tyield(rel)\n\t end\n\tend", "def sibling; end", "def associates\n self.doc_refs\n end", "def collection_node; end", "def collection_node; end", "def one_instance_ancestors_cache; end", "def begin_of_association_chain\n current_account\n end", "def each_child\n \n end", "def second_reference_id\n nil\n end", "def link_self; end", "def self_and_descendants_from_active_record\n [self]\n end", "def no_circular_reference\n\n end", "def def_one_through_many(opts)\n def_many_through_many(opts)\n end", "def references\n @parents.keys\n end", "def parent=(obj); end", "def self_and_siblings\n nested_set_scope.children_of parent_id\n end", "def ancestors; end", "def ancestors; end", "def ancestors; end", "def ancestors; end", "def objects_with_references\n end", "def parent\n end", "def parent\n end", "def parent\n end", "def parent\n end", "def each_root_relation\n\t for rel in relations\n\t\tyield(rel) unless rel.parent\n\t end\n\tend", "def ancestors() end", "def self_and_siblings\n if self[acts_as_nested_set_options[:parent_column]].nil? || self[acts_as_nested_set_options[:parent_column]].zero?\n [self]\n else\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} and #{acts_as_nested_set_options[:parent_column]} = #{self[acts_as_nested_set_options[:parent_column]]}\", :order => acts_as_nested_set_options[:left_column])\n end\n end", "def parent_association\n @parent_object=parent_object # ResourceController normally sets this\n if params[:id].nil?\n return parent_object.all_parent_relations \n end\n # Gotta find it seperately, will get a recursive stack error elsewise\n o = FeatureRelation.find(params[:id])\n parent_object.id == o.parent_node.id ? parent_object.all_child_relations : parent_object.all_parent_relations\n end", "def self_and_descendants_from_active_record\n [self]\n end", "def self_and_descendents_from_active_record\n [self]\n end", "def end_of_association_chain\n parent? ? parent_association : model\n end", "def self_and_siblings\n base_class.all scoped(parent_column_name => _parent_id)\n end", "def relationship_related_link(attribute_name); end", "def ppl_many_siblings\n raise NotImplementedError\n end", "def containing_relation_members \n return [] \n end", "def self_and_siblings\n if self[parent_col_name].nil? || self[parent_col_name].zero?\n [self]\n else\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND #{parent_col_name} = #{self[parent_col_name]}\", :order => left_col_name)\n end\n end", "def one_to_many(name, opts=OPTS, &block)\n associate(:one_to_many, name, opts, &block)\n end", "def save_related\n if self.links.present?\n self.links.each do | link |\n link.parent_type = :action_item\n link.parent_key = self.key\n link.save!\n end\n end\n end", "def rel; end", "def parent_association\n # needed for the show view\n @parent_object = parent_object\n parent_object.names\n end", "def children\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND #{parent_col_name} = #{self.id}\", :order => left_col_name)\n end", "def check_parent_ids\n # This should not be necesary as parent_ids should be included on reflections.\n #parent_resources.each { |res| parent_ids << \"#{res.singular}_id\" }\n\n # Model foreign keys \n resource.model.reflections.each do |key, refl|\n if refl.macro == :belongs_to || refl.macro == :has_and_belongs_to_many\n parent_ids << refl.primary_key_name\n foreing_models[refl.primary_key_name.to_s]= refl.class_name.constantize\n end\n end\n self.parent_ids= Set.new(self.parent_ids)\n end", "def find_relations\n puts '2nd pass: find relations'\n find :relations\n self\n end", "def add_relationship(rel_attr); end", "def one_through_one(name, opts=OPTS, &block)\n associate(:one_through_one, name, opts, &block)\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def self_and_siblings\n dataset.nested.filter(self.class.qualified_parent_column => self.parent_id)\n end", "def many_to_many_associated_tables\n @many_to_many_associated_tables\n end", "def belongs_blocked\n end", "def children=(_arg0); end", "def children=(_arg0); end", "def macro\n :references_one\n end", "def relation_method\n :join\n end", "def references_from\n @mapping.all_member.select do |m|\n !m.is_a?(MM::Absorption) or\n !m.forward_mapping && m.parent_role.is_unique # A forward absorption has no forward absorption\n end\n end", "def each\n nodo = @principio\n while (nodo != nil)\n yield nodo.referencia\n nodo = nodo.siguiente\n end\n end" ]
[ "0.6533092", "0.61359286", "0.61267114", "0.6065107", "0.604436", "0.60283834", "0.60283834", "0.5982057", "0.5966937", "0.5935516", "0.5900984", "0.58974105", "0.5852385", "0.5823984", "0.5809252", "0.57752043", "0.5755206", "0.57387555", "0.5735133", "0.5729505", "0.5719465", "0.5719465", "0.5719465", "0.5719465", "0.5719465", "0.5719465", "0.5719465", "0.5719465", "0.5719465", "0.5719465", "0.5719465", "0.5719465", "0.56910104", "0.5682814", "0.5672898", "0.5655284", "0.5636275", "0.56124395", "0.56124395", "0.5604496", "0.5579822", "0.55771583", "0.55678535", "0.55600345", "0.5552549", "0.5548028", "0.5534976", "0.55285656", "0.5525759", "0.55076325", "0.54872155", "0.54872155", "0.54872155", "0.54872155", "0.5482944", "0.54827166", "0.54827166", "0.54827166", "0.54827166", "0.54783994", "0.5477971", "0.5469461", "0.5464773", "0.5458755", "0.54579455", "0.54572165", "0.54498154", "0.5447158", "0.5446742", "0.54431725", "0.54405016", "0.5434442", "0.542864", "0.54190624", "0.54178643", "0.54080766", "0.53945637", "0.5378424", "0.5376046", "0.5375969", "0.5375451", "0.5375451", "0.5375451", "0.5375451", "0.5375451", "0.5375451", "0.5375451", "0.5375451", "0.5375451", "0.5375451", "0.5375451", "0.5375451", "0.5375218", "0.53583336", "0.53537804", "0.5351471", "0.5351471", "0.5349534", "0.53470504", "0.53405416", "0.53350896" ]
0.0
-1
=begin Create item on behalf of supplier =end
def embed_property_value_list( property_value_list ) count = 1 property_value_list.each do |property_value_pair| PropertyValue.create(:item_id => self.id, :property_id => property_value_pair[:property_id], :value_id => property_value_pair[:value_id], :position => count) count += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def giveItem\n toLocation = Company.where(name: params[:recepCompany]).first.locations.where(address: params[:recepLocation]).first\n location = current_company.locations.where(id: params[:locationId]).first\n if(location.is_supplier === true)\n updatedItem = location.items.where(name: params[:name]).first\n toUpdatedItem = toLocation.items.where(name: params[:name]).first\n if(toUpdatedItem.present? && updatedItem.amount > params[:amount].to_i)\n updatedItem.increment!(:amount, -params[:amount].to_i)\n toUpdatedItem.increment!(:amount, params[:amount].to_i)\n elsif(updatedItem.amount > params[:amount].to_i)\n updatedItem.increment!(:amount, -params[:amount].to_i)\n item = Item.create(name: params[:name], amount:params[:amount].to_i, price: updatedItem.price, autoRestock: false, lastSupplier:location.id)\n toLocation.items << item\n end\n if(updatedItem.amount <= updatedItem.restockPoint)\n changeItemSupplier(updatedItem.id)\n end\n end\n end", "def prorate_create_item(t, tariff, invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n if t == 'P'\n create_pre_invoice_item(tariff, invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n else\n create_invoice_item(tariff, invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n end\n end", "def create_supplier( employee, supplier_params) \n supplier = Supplier.new(supplier_params)\n if not employee.has_role?(:admin)\n supplier.errors.add( :authentication , \"Wrong Role: No admin role\")\n return supplier\n end\n \n \n \n supplier.office_id = self.id \n supplier.creator_id = employee.id \n supplier.save\n \n \n return supplier\n end", "def create\n @supplier_item = SupplierItem.new(supplier_item_params)\n\n respond_to do |format|\n if @supplier_item.save\n format.html { redirect_to @supplier_item, notice: 'Supplier item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @supplier_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @supplier_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_invoice_item(invoice, i)\n invoice_item = SupplierInvoiceItem.new\n if i.class.name == 'ReceiptNoteItem'\n invoice_item.receipt_note_id = i.receipt_note_id\n invoice_item.receipt_note_item_id = i.id\n else\n invoice_item.purchase_order_id = i.purchase_order_id\n invoice_item.purchase_order_item_id = i.id\n end\n invoice_item.supplier_invoice_id = invoice.id\n invoice_item.product_id = i.product_id\n invoice_item.code = i.code\n invoice_item.description = i.description\n invoice_item.quantity = i.balance\n invoice_item.price = i.price\n invoice_item.discount_pct = i.discount_pct\n invoice_item.discount = i.discount\n invoice_item.tax_type_id = i.tax_type_id\n invoice_item.work_order_id = i.work_order_id\n invoice_item.project_id = i.project_id\n if !i.charge_account_id.blank?\n invoice_item.charge_account_id = i.charge_account_id\n else\n invoice_item.charge_account_id = ChargeAccount.expenditures(i.project_id).first.id\n end\n invoice_item.created_by = current_user.id if !current_user.nil?\n return invoice_item\n end", "def create_new_item( depositor, payload )\n\n ok = true\n work = GenericWork.create!( title: [ payload[ :title ] ] ) do |w|\n\n # generic work attributes\n w.apply_depositor_metadata( depositor )\n w.creator = depositor.email\n w.author_email = TaskHelpers.default_email( payload[ :author_computing_id ] ) if payload[ :author_computing_id ]\n w.author_first_name = payload[ :author_first_name ] if payload[ :author_first_name ]\n w.author_last_name = payload[ :author_last_name ] if payload[ :author_last_name ]\n w.author_institution = payload[ :institution ] if payload[ :institution ]\n w.contributor = payload[ :advisors ]\n w.description = payload[ :abstract ]\n w.keyword = payload[ :keywords ] if payload[ :keywords ]\n\n # date attributes\n w.date_created = payload[ :create_date ] if payload[ :create_date ]\n w.date_modified = DateTime.parse( payload[ :modified_date ] ) if payload[ :modified_date ]\n w.date_published = payload[ :issued ] if payload[ :issued ]\n\n # embargo attributes\n w.visibility = payload[:embargo_type ]\n w.embargo_state = payload[:embargo_type ]\n w.visibility_during_embargo = payload[:embargo_type ]\n w.embargo_end_date = payload[ :embargo_release_date ] if payload[ :embargo_release_date ]\n w.embargo_period = payload[ :embargo_period ] if payload[ :embargo_period ]\n\n # assume standard and published work type\n w.work_type = GenericWork::WORK_TYPE_THESIS\n w.draft = 'false'\n\n w.publisher = payload[ :publisher ] if payload[ :publisher ]\n w.department = payload[ :department ] if payload[ :department ]\n w.degree = payload[ :degree ] if payload[ :degree ]\n w.language = payload[ :language ] if payload[ :language ]\n\n w.notes = payload[ :notes ] if payload[ :notes ]\n w.rights = [ payload[ :rights ] ] if payload[ :rights ]\n w.license = GenericWork::DEFAULT_LICENSE\n\n w.admin_notes = payload[ :admin_notes ] if payload[ :admin_notes ]\n w.work_source = payload[ :source ] if payload[ :source ]\n\n end\n\n return ok, work\n end", "def create_private_contract\n @item_request = current_user.item_requests.new(supplier_id: params[:supplier_id], status: ItemRequest.status.find_value(:submitted).value, creator: current_user.id)\n return redirect_to private_contract_progress_buyers_item_request_path(@item_request), flash: { success: I18n.t('create.success') } if @item_request.save\n\n redirect_to search_provider_buyers_path, flash: { alert: I18n.t('create.failed') }\n end", "def create\n @pagetitle = \"New supplier\"\n \n @company = Company.find(params[:supplier][:company_id])\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to(@supplier, :notice => 'Supplier was successfully created.') }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_supplier_item\n @supplier_item = SupplierItem.find(params[:id])\n end", "def create_item(name, price)\r\n new_item = Models::Item.created( name, price, self )\r\n self.item_list.push(new_item)\r\n new_item.save\r\n return new_item\r\n end", "def add_to_allocation(supplier, demander, bid)\n @allocation[supplier.get_id][demander.get_id] = { :demander => demander, :bid => bid }\n @in_allocation[demander.get_id] = true\n end", "def item_create\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @brief_vendor.items << Item.new(params[:item]){|r|r.kind = params[:kind]}\n redirect_to vendor_show_brief_path(@brief)\n end", "def create\n @pagetitle = \"New supplier\"\n \n @company = Company.find(params[:supplier][:company_id])\n @supplier = Supplier.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to(@supplier, :notice => 'Supplier was successfully created.') }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new_item(\r\n\tname, price, types, special_condition_id, locations)\r\n\r\n #New ActiveRecord object\r\n #Creates the new item in the Items table\r\n\titem = Item.new do |u|\r\n\t\tu.name = name\r\n\t\tu.price = price\r\n\t\tu.item_type_id = types\r\n\t\tu.special_condition_id = special_condition_id\r\n\tend\r\n\titem.save\r\n\r\n #Assigns the locations of the item\r\n\tlocations.each do |locals|\r\n\t\titem_locations = ItemLocation.new do |u|\r\n\t\t\tu.item_id = item.id\r\n\t\t\tu.location_id = locals\r\n\t\tend\r\n\t\titem_locations.save\r\n\tend\r\nend", "def create_item(item_code)\n \t\txero = XeroConnection.new.connect\n\n \t\tif xero.Item.all(where: 'code == \"%s\"' % item_code).empty?\n \t\t\tnew_item = xero.Item.build(code: item_code)\n \t\t\tnew_item.save\n \t\tend\n \tend", "def quick_new\n @bill = Bill.new\n @bill.items.build\n end", "def create_item(name, price)\r\n new_item = Trading::Item.created( name, price, self )\r\n self.item_list.push(new_item) # AK You can also do `item_list << new_item`\r\n return new_item\r\n end", "def create\n # The item is either \"Local\" or \"Remote\" depending on the source selected\n @item = Item.factory(params[:source], params[@hash_key.to_sym])\n \n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(item_url(@item)) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend", "def create\n if current_user && current_user.seller\n create_item\n else\n redirect_to root_path\n end\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template)\n ]\n end", "def create\n @supplier = Supplier.new(params[:supplier])\n \n respond_to do |format|\n if @supplier.save\n flash.now[:notice] = 'Supplier was successfully created.'\n format.html { redirect_to(suppliers_path) }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_item(list_id, content, responsible_party=nil, notify=true)\n record \"/todos/create_item/#{list_id}\",\n :content => content, :responsible_party => responsible_party,\n :notify => notify\n end", "def generate_warehouse\n return true if type!=\"Supplier\"\n Warehouse.create(:company_id=>self.id,\n :name=>self.name,\n :managed=>false,\n :address=>self.address,\n :address2=>self.address2,\n :city=>self.city,\n :us_state=>self.state,\n :zipcode=>self.zipcode)\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n \n [l1, l2]\n end", "def create\n @supplier = current_merchant.suppliers.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n @supplier.ordering_method_ids = params[:supplier][:ordering_method_ids]\n @supplier.delivery_location_ids = params[:supplier][:delivery_location_ids]\n @supplier.online_retail_service_type_ids = params[:supplier][:online_retail_service_type_ids]\n @supplier.product_category_ids = params[:supplier][:product_category_ids]\n end", "def create_item(name, price, quantity, description=\"No description available\", image=\"\")\n new_item = Item.created( name, price, self.working_for, quantity, description, image)\n if !(identical = self.working_for.list_items_inactive.detect{|i| i == new_item }).nil?\n identical.quantity += new_item.quantity\n else\n self.working_for.offers.push(new_item)\n new_item.save\n end\n Activity.log(self, \"add_item\", new_item, self.working_for)\n return new_item\n end", "def create\n get_supplier\n @supplier_phone = @supplier.phones.create(params[:supplier_phone])\n end", "def create\n @ingredient = Ingredient.find(params[:id])\n \n @supplier.ingredients << @ingredient\n redirect_to supplier_path(@supplier)\n end", "def add_units(qty)\n qty.to_i.times do\n #create item\n item = supply_items.new\n item.status = SupplyItem::STATUS_AVAILABLE\n item.save\n end\n end", "def generate_sales_entry_add_product_form\n @item= Item.find_by_id params[:selected_item_id]\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @new_object = SalesEntry.new \n end", "def create_item\n @item = Fox_Item.new(self, @content.join(\"\\t\"), @icon, @icon)\n end", "def generate_item(item)\n item\n end", "def create_line_item_for_per_person_charge qty, vendor_id, include_price_in_expense, include_price_in_revenue, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n line_items.push(create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\"))\n end", "def new\n # build a 'temporary' post which is written to DB later (create-method)\n @supplier = Supplier.new\n end", "def createItem(title, description, date)\n new_item = List.new\n new_item.title = title\n new_item.description = description\n new_item.save\n new_item.date = date\n end", "def create_organisation_items\n create_organisation\n end", "def create_new_item(name, price)\n client = create_db_client\n client.query(\"insert into items (name, price) values ('#{name}', '#{price}')\")\nend", "def create\n @item = Item.new(item_params)\n @user = User.find_by_id(session[:user_id]) if session[:user_id]\n\n @item.rating = 0\n @item.rating_count = 0\n @item.current_amount = item_params[:max_amount]\n @item.user = @user #This is the owner of the item\n respond_to do |format|\n if @item.save\n format.html { redirect_to user_supplier_path_url(@user)}\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n vendor = Vendor.find(item_params[:vendor_id])\n @item.build_vendor(:id => vendor.id)\n @item.save!\n @current_item = @item\n @items = Item.all\n end", "def create\n\t\t@part = Part.new(params[:part])\n# \t\t@product = Product.find(@part.product_id)\n\t\t@supplier = Supplier.find(params[:supplier_id])\n\t\t\n\t\trespond_to do |format|\n\t\tif @part.save\n\t\t\tformat.html { redirect_to @supplier, notice: t('actions.part.notice.created') }\n\t\t\tformat.json { render json: @part, status: :created, location: @supplier }\n\t\telse\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @part.errors, status: :unprocessable_entity }\n\t\tend\n\t\tend\n\tend", "def created(item)\n end", "def create\n @supplier = Supplier.new(supplier_params)\n\n # Wenn neu erstellter Lieferant ein Kabellieferant ist, dann Einträge in wire_suppliers für alle Kabel erstellen\n suppliertypeid = Suppliertype.where(name: 'Kabel').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n Wire.all.each do |wire|\n wire_supplier = WireSupplier.create\n wire_supplier.supplier = @supplier\n wire_supplier.wire = wire\n wire_supplier.save!\n end\n end\n\n # Wenn neu erstellter Lieferant ein Kabelbeschriftungslieferant ist, dann einen neuen Eintrag in wirecaptionprices erstellen\n suppliertypeid = Suppliertype.where(name: 'Kabelbeschriftung').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n wirecaptionprice = Wirecaptionprice.create\n wirecaptionprice.supplier = @supplier\n wirecaptionprice.save!\n end\n\n # Wenn neu erstellter Lieferant ein Elektroinstallationslieferant ist, dann Einträge in electrical_installation_suppliers für alle Elektroinstallationen erstellen\n suppliertypeid = Suppliertype.where(name: 'Elektroinstallation').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n ElectricalInstallation.all.each do |electrical_installation|\n electricalInstallationSupplier = ElectricalInstallationSupplier.create\n electricalInstallationSupplier.supplier = @supplier\n electricalInstallationSupplier.electrical_installation = electrical_installation\n electricalInstallationSupplier.save!\n end\n end\n\n # Wenn neu erstellter Lieferant ein FU Lieferant ist, dann Einträge in drive_suppliers für alle Drives erstellen\n suppliertypeid = Suppliertype.where(name: 'FU').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n Drive.all.each do |drive|\n driveSupplier = DriveSupplier.create\n driveSupplier.supplier = @supplier\n driveSupplier.drive = drive\n driveSupplier.save!\n end\n end\n\n # Wenn neu erstellter Lieferant ein Schaltanlagenbau Lieferant ist, dann Einträge in switchgear_suppliers für alle Switchgears erstellen\n suppliertypeid = Suppliertype.where(name: 'Schaltanlagenbau').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n Switchgear.all.each do |switchgear|\n switchgearSupplier = SwitchgearSupplier.create\n switchgearSupplier.supplier = @supplier\n switchgearSupplier.switchgear = switchgear\n switchgearSupplier.save!\n end\n end\n\n # write supplier to database\n if @supplier.save\n redirect_to suppliers_path, :notice => 'Lieferant erfolgreich erstellt.'\n else\n render 'new'\n end\n end", "def create_item(data_bag, item_name, data = {}, metadata = {})\n item = ::SecureDataBag::Item.new(metadata)\n item.raw_data = { 'id' => item_name }.merge(data)\n item.data_bag data_bag\n item\n end", "def create_line_item_for_per_person_charge qty, vendor_id, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n new_line_items = create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\")\n line_items.push(new_line_items)\n new_line_items\n end", "def pickup_item\n if status == :confirmed \n transaction do\n update(:status => :in_progress)\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'pickup_item',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.picked_up_item)\n end \n end\n self\n end", "def create_item_from(order_item, lot_code = nil, expires_at = nil, amount = nil)\n transfer_items.create!(\n order_item: order_item,\n product: order_item.product,\n lot_code: lot_code || order_item.lot_code,\n expires_at: expires_at,\n amount: amount || order_item.waiting\n )\n end", "def create\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render json: @supplier, status: :created, location: @supplier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_item(which = 0,opts={})\n defaults = {:number => @holdings[which].items.count}\n @holdings[which].new_item(defaults.merge(opts))\n end", "def create_item\n object = @spawn_object.call\n\n object.pool_create if object.respond_to? :pool_create\n\n item = PoolItem.new(object)\n\n @item_stack.push(item)\n\n item\n end", "def create_item( *args )\n raise NotImplementedError.new(\"Subclasses must implement #create_item\")\n end", "def create_stock_item\n\n added_new_stock_item = false\n # Get stock location for appropriate location\n @product_row[:location].split(',').each do |sub_location|\n sub_location.chomp!\n stock_location = case sub_location.to_s.downcase\n when /george/\n @@loc_attic\n # NFS no matter what - JC10 OR buffalo display case OR back shop\n when /jc\\d{1,2}|buffalo|back\\sshop|attic/\n @@loc_home_nfs\n # NFS if listed as not for sale (don't count in quantity)\n when /w\\d{1,2}/\n (@product_row[:available] && @product_row[:available].downcase == \"n\") ? @@loc_home_nfs : @@loc_home\n when /[[:alpha:]]\\d{2,3}|D\\d{3}\\.\\d|h\\d|file\\scabinet|suite\\s2/\n (@product_row[:available] && @product_row[:available].downcase == \"n\") ? @@loc_suite2_nfs : @@loc_suite2\n # NWC08\n when /nw[[:alpha:]]\\d{1,2}|ste3/\n @@loc_suite3\n # Warehouse\n when /warehouse/\n @@loc_warehouse\n # West trailer OR east racks\n when /east\\sracks|west\\strailer/\n @@loc_east_racks\n else # if unidentifiable location\n @errors << { :part_number => @product_row[:name], :condition => @product_row[:condition], :message => \"Cannot identify location \" + sub_location }\n next # skip to next location\n end\n\n # if no exisiting sub location, add one\n if(@new_product_condition.add_sub_location(sub_location, stock_location))\n added_new_stock_item = true\n end\n\n end # end location loop\n\n added_new_stock_item # return true if at least one new stock item added\n\n end", "def propose_item(name, price, selling_mode, increment, end_time, description = \"\", log = true)\n if selling_mode == \"fixed\"\n item = Item.named_priced_with_owner_fixed(name, price, self, description)\n else\n item = Item.named_priced_with_owner_auction(name, price, self, increment.to_i, end_time, description)\n end\n item.save\n\n self.attach_item(item)\n Analytics::ItemAddActivity.with_creator_item(self, item).log if log\n\n item\n end", "def create\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, :notice => 'Dobavljac je uspjesno kreiran.' }\n format.json { render :json => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { \n redirect_to(medicines_url)\n }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.build(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @supplier, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_item_with_location\n inventory_item = FactoryBot.create :inventory_item\n warehouse_location = FactoryBot.create :warehouse_location\n ItemLocation.create(inventory_item_id: inventory_item.id, warehouse_location_id: warehouse_location.id, quantity: inventory_item.quantity)\n\n inventory_item\n end", "def make_item\n Forge_Core.forge(@items_window.item, @confirm_window.quantity)\n Sound.play_forge_start\n @materials_window.refresh\n @gold_window.refresh\n @items_window.refresh\n end", "def create\n\n @item = Item.new(params[:item])\n\n if(!@item.borrower.nil? && @item.borrower != \"\")\n UserMailer.loaned_notification_email(current_user, @item).deliver\n end\n\n current_user.items.push @item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(root_path, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_pre_invoice_item(tariff, pre_invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n PreInvoiceItem.create(\n pre_invoice_id: pre_invoice_id,\n code: tariff.try(:billable_item).try(:billable_concept).try(:code),\n description: d + tariff.try(:billable_item).try(:billable_concept).try(:name),\n tariff_id: tariff.id,\n price: price,\n quantity: quantity,\n tax_type_id: tax_type_id,\n discount_pct: discount_pct,\n discount: 0.0,\n product_id: nil,\n subcode: subcode,\n measure_id: measure,\n created_by: user_id)\n end", "def execute\n guest.cart.order_items.create product: product\n end", "def new_special_delivery_entry\n new \n end", "def generate_new_item_object\n @new_item = Flight.new\n insert_required_params_into_new_item_object\n insert_default_params_into_new_item_object\n insert_optional_params_into_new_item_object(self)\n return @new_item\n end", "def create\n @supplier = current_user.suppliers.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n @supplier.update(uid: \"s_\" + @supplier.id.to_s)\n @dis = @supplier.supplier_name.to_s + '$' + @supplier.supplier_address.to_s + '$' + @supplier.supplier_contact.to_s + '$' + @supplier.supplier_email.to_s\n \n Log.create!(description: @dis, username: current_user.name, uid: \"s_\" + @supplier.id.to_s, user_id: current_user.user_id)\n\n params[:paymentterm_description].each do | payment |\n @pt = PaymentTerm.find(payment)\n @pay = SupplierPaymentTerm.find_by(payment_term_id: payment, supplier_id: @supplier.id)\n if !@pay\n SupplierPaymentTerm.create(payment_term_description: @pt.paymentterm_description, supplier_id: @supplier.id, payment_term_id: payment)\n end\n end\n format.html { redirect_to suppliers_url, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_full_product\n generate_product_name\n generate_product_code\n generate_product_manufacturer\n generate_product_description\n generate_product_price\n end", "def create\n @item_storage = ItemStorage.new(item_storage_params)\n @purchase = Purchase.find(params[:item_storage][:purchase_id])\n @item_storage.purchase_id = @purchase.id\n @item_storage.item_id = @purchase.item_id\n @item_storage.item_type = @purchase.item_type\n @item_storage.supplier_id = @purchase.supplier_id\n respond_to do |format|\n if @item_storage.save\n format.html { redirect_to item_storages_url, notice: '入库记录创建成功!' }\n format.json { render :show, status: :created, location: @item_storage }\n else\n format.html { render :new }\n format.json { render json: @item_storage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_starting_items\n items.create name: \"Starter item\", attack: 5, defense: 5, life: 10, experience_bonus: 0\n end", "def create\n @supplier = Supplier.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_price \n Price.create_from_item(self)\n end", "def propose_item(name, price, selling_mode, increment, end_time, quantity = 1, description = \"\", log = true)\r\n if selling_mode == :fixed\r\n item = Item.fixed(name, price, self, description)\r\n elsif selling_mode == :auction\r\n item = Item.auction(name, price, self, increment.to_i, end_time, description)\r\n end\r\n item.quantity = quantity\r\n item.save\r\n\r\n self.attach_item(item)\r\n ItemAddActivity.create(self, item).log if log\r\n\r\n item\r\n end", "def make_item(object_type_name)\n\n ot = ObjectType.find_by(name: object_type_name)\n raise \"Could not find object type #{name}\" unless ot\n\n Item.make({ quantity: 1, inuse: 0 }, sample: self, object_type: ot)\n\n end", "def create_with_item(params_item, params_fuman)\n ActiveRecord::Base.transaction do\n\n #TODO 条件にservice_codeもいれる\n #TODO 二重で登録されているところあり\n item = Item.find_by_product_id(params_item[:product_id])\n\n # create\n if item.nil?\n\n name = ApiBucket::Service.name(params_item[:service_code].to_i)\n\n if Rails.env.test?\n item = @service.lookup(params_item[:product_id])\n else\n service = ApiBucket::Service.instance(:\"#{name}\")\n res = service.lookup(params_item[:product_id])\n item = res.items.first\n end\n\n params_item.merge!({\n url: item.detail_url,\n preview_url: item.preview_url,\n title: item.title,\n description: item.description,\n release_date: item.release_date,\n image_s: item.image[:l][:url],\n image_m: item.image[:l][:url],\n image_l: item.image[:l][:url],\n price: item.price\n })\n\n item = Item.new(params_item)\n raise ActiveRecord::Rollback unless item.save\n end\n\n @fuman = Fuman.where(user_id: @user.id).where(item_id: item.id).first\n return true if @fuman.present?\n\n # create\n params_fuman.merge!({\n user_id: @user.id,\n item_id: item.id\n })\n\n @fuman = Fuman.new(params_fuman)\n raise ActiveRecord::Rollback unless @fuman.save\n end\n\n true\n end", "def create_offer\n end", "def create_product_for(line_item)\n default_tax_category = TaxCategory.find_by_name(\"default\")\n product = Product.create(:name => line_item.title, \n :master_price => line_item.price, \n :description => line_item.title,\n :tax_category_id => default_tax_category ? default_tax_category.id : nil)\n product.save!\n product.variants.create(:product_id => product.id, :sku => line_item.sku, :price => line_item.price)\n product\n end", "def create\n @admin_supplier = Admin::Supplier.new(params[:admin_supplier])\n\n respond_to do |format|\n if @admin_supplier.save\n format.html { redirect_to admin_suppliers_url }\n format.json { render json: @admin_supplier, status: :created, location: @admin_supplier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_supplier\n @object.supplier = spree_current_user.supplier\n end", "def create\n @catalog_supplier = Catalog::Supplier.new(catalog_supplier_params)\n\n respond_to do |format|\n if @catalog_supplier.save\n format.html { redirect_to @catalog_supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @catalog_supplier }\n else\n format.html { render :new }\n format.json { render json: @catalog_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_line_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\texisting_line_item = Item.where('product_id = ? AND sale_id = ?', params[:product_id], @sale.id).first\n\n\t\tif existing_line_item.blank?\n\t\t\tline_item = Item.new(product_id: params[:product_id], sale_id: params[:sale_id], quantity: params[:quantity])\n\t\t\tline_item.price = line_item.product.price\n\t\t\tline_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(line_item)\n\t\telse\n\t\t\texisting_line_item.quantity += 1\n\t\t\texisting_line_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(existing_line_item)\n\t\tend\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend", "def place(direct, preposition, target, detail = 'default')\n ItemRelationship.create!(\n source: direct,\n target: target,\n detail: detail,\n preposition: preposition\n )\nend", "def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end", "def create_new_resource(resource_descr, type_to_create, authorizer)\n debug \"create_new_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end", "def create_shippment(items)\n fill_boxes(items)\n shippment_object\n make_json_object\n end", "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end", "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end", "def create_item_receipt_window\n @item_receipt_window = Window_ItemReceipt.new\n end", "def create\n @item = Item.new(item_params)\n @item.seller_id = current_seller.id\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create!(name, params = {})\n item = build(name, params)\n item.save!\n item\nend", "def create\n @needed_item = NeededItem.new(needed_item_params)\n\n respond_to do |format|\n if @needed_item.save\n format.html { redirect_to @needed_item.apartment, notice: 'Needed item was successfully created.' }\n format.json { render :show, status: :created, location: @needed_item }\n else\n format.html { render :new }\n format.json { render json: @needed_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @supplier_request = SupplierRequest.new(supplier_request_params)\n @supplier_request.supplier = @supplier if @supplier\n @supplier_request.created_by = current_user if current_user\n @supplier_request.user = User.find_by(document_number: params[:supplier_request][:document_number],\n document_type: params[:supplier_request][:document_type])\n\n respond_to do |format|\n if @supplier_request.save\n format.html { redirect_to [@supplier, @supplier_request], notice: 'La solicitud ha sido creada correctamente.' }\n format.json { render :show, status: :created, location: @supplier_request }\n else\n format.html { render :new }\n format.json { render json: @supplier_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n \n shopItem = UCShopItem.new(self, item, rect,\n SHOP_CONFIG::ITEM_NUMBER_PATTERN)\n \n shopItem.cItemPrice.align = 2\n shopItem.cItemPossess.align = 2 \n shopItem.cItemPossess.font = Font.shop_possess_font\n shopItem.ucItemNumber.cLabelNumber.align = 2\n shopItem.ucItemNumber.min = 0\n shopItem.ucItemNumber.max = shopItem.inventory_quantity\n return shopItem\n end", "def create\n @integration_store = IntegrationStore.new(integration_store_params.merge(supplier: current_user))\n\n respond_to do |format|\n if @integration_store.save\n format.html { redirect_to @integration_store, notice: 'Integration store was successfully created.' }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end", "def create_complete_order(user, product, options={})\n returning(user.orders.create) do |order|\n order.line_items.push create_line_item(product.variants.first)\n order.save\n order.checkout.bill_address = Address.new({\n :firstname => \"First\",\n :lastname => \"Last\",\n :address1 => \"Address1\",\n :city => \"City\",\n :state_name => \"A State\",\n :zipcode => \"00000\",\n :country => Country.new,\n :phone => \"00000000\"\n })\n order.complete\n order.save!\n end\nend", "def create_items\n @items.each do |item|\n create_item(item) unless Item.where(name: item['name']).first\n end\n end", "def test_create_order\n setup_new_order()\n @o.order_line_items << OrderLineItem.for_product(items(:small_stuff))\n assert @o.save\n end", "def create_product(id)\n item = DirectedEdge::Item.new(@database, \"product#{id}\")\n item.add_tag('product')\n item.save\n end", "def of_generate_offer\n supplier = params[:supplier]\n request = params[:request]\n offer_no = params[:offer_no]\n offer_date = params[:offer_date] # YYYYMMDD\n offer = nil\n offer_item = nil\n code = ''\n\n if request != '0'\n offer_request = OfferRequest.find(request) rescue nil\n offer_request_items = offer_request.offer_request_items rescue nil\n if !offer_request.nil? && !offer_request_items.nil?\n # Format offer_date\n offer_date = (offer_date[0..3] + '-' + offer_date[4..5] + '-' + offer_date[6..7]).to_date\n # Try to save new offer\n offer = Offer.new\n offer.offer_no = offer_no\n offer.offer_date = offer_date\n offer.offer_request_id = offer_request.id\n offer.supplier_id = supplier\n offer.payment_method_id = offer_request.payment_method_id\n offer.created_by = current_user.id if !current_user.nil?\n offer.discount_pct = offer_request.discount_pct\n offer.discount = offer_request.discount\n offer.project_id = offer_request.project_id\n offer.store_id = offer_request.store_id\n offer.work_order_id = offer_request.work_order_id\n offer.charge_account_id = offer_request.charge_account_id\n offer.organization_id = offer_request.organization_id\n if offer.save\n # Try to save new offer items\n offer_request_items.each do |i|\n offer_item = OfferItem.new\n offer_item.offer_id = offer.id\n offer_item.product_id = i.product_id\n offer_item.description = i.description\n offer_item.quantity = i.quantity\n offer_item.price = i.price\n offer_item.tax_type_id = i.tax_type_id\n offer_item.created_by = current_user.id if !current_user.nil?\n offer_item.project_id = i.project_id\n offer_item.store_id = i.store_id\n offer_item.work_order_id = i.work_order_id\n offer_item.charge_account_id = i.charge_account_id\n if !offer_item.save\n # Can't save offer item (exit)\n code = '$write'\n break\n end # !offer_item.save?\n end # do |i|\n # Update totals\n offer.update_column(:totals, Offer.find(offer.id).total)\n else\n # Can't save offer\n code = '$write'\n end # offer.save?\n else\n # Offer request or items not found\n code = '$err'\n end # !offer_request.nil? && !offer_request_items.nil?\n else\n # Offer request 0\n code = '$err'\n end # request != '0'\n if code == ''\n code = I18n.t(\"ag2_purchase.offers.generate_offer_ok\", var: offer.id.to_s)\n end\n @json_data = { \"code\" => code }\n render json: @json_data\n end", "def create\n @purchase_requisition = PurchaseRequisition.new(params[:purchase_requisition])\n #if check_validation\n if @purchase_requisition.save\n #@purchase_requisition.add_item(params[:item])\n redirect_to(edit_purchase_requisition_path(@purchase_requisition), :notice => 'Purchase Requisition was successfully created.')\n else\n render :action => \"new\" \n end\n #else\n # initial_data\n # flash[:error] = \"Please fill in the item information\"\n # render :action => \"new\"\n #end\n \n end", "def new\n @object = Spree::Product.new()\n @status = true\n @suppliers = Supplier.all\n end", "def supplier_item_params\n params.require(:supplier_item).permit(:supplier_id, :item_id, :price, :note)\n end", "def create_product(prod)\n\n purchase_price = BigDecimal.new(\"0.0\")\n purchase_price = BigDecimal.new(prod['purchase_price'].to_s) unless prod['purchase_price'].nil?\n sales_price = nil\n sales_price = BigDecimal.new(prod['sales_price']) unless prod['sales_price'].nil?\n weight = 0\n weight = prod['weight'].to_f unless prod['weight'].nil?\n manufacturer_product_code = prod['manufacturer_product_code']\n stock = prod['stock'].to_i unless prod['stock'].nil?\n\n tax_percentage = prod['tax_percentage'] || 8.0\n tax_class = TaxClass.where(:percentage => tax_percentage).first unless tax_percentage.nil?\n if tax_class.nil?\n tax_class = TaxClass.create(:percentage => 8.0, :name => \"8.0\")\n end\n\n prod['description'].blank? ? description = \"No description\" : description = prod['description']\n \n is_featured = false\n is_featured = true if [\"yes\", \"true\", \"1\"].include?(prod['featured'])\n is_visible = true\n is_visible = false if [\"no\", \"false\", \"0\"].include?(prod['visible'])\n is_build_to_order = false\n is_build_to_order = true if [\"yes\", \"true\", \"1\"].include?(prod['build_to_order'])\n \n supplier = Supplier.find_by_name(prod['supplier'])\n\n product = Product.where(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier_id => supplier,\n :tax_class_id => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock).first\n if product.nil?\n product = Product.create(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier => supplier,\n :tax_class => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock)\n end\n if prod['category']\n category = Category.where(:name => prod['category']).first\n category = Category.create(:name => prod['category']) if category.nil?\n product.categories << category\n product.save\n end\n\n\n # Ugly, but at least it makes test authors know what went wrong\n if product.errors.empty?\n return product\n else\n puts \"Errors creating product: #{product.errors.full_messages}\"\n return false\n end\nend", "def create_booking(params)\n credentials = Concierge::Credentials.for(supplier_name)\n RentalsUnited::Client.new(credentials).book(params)\n end" ]
[ "0.66638094", "0.66368604", "0.66206837", "0.66116977", "0.66075104", "0.65427965", "0.6456529", "0.64012474", "0.63829136", "0.6358813", "0.6341278", "0.63310146", "0.6327429", "0.6304913", "0.62924355", "0.6240238", "0.6231806", "0.62075824", "0.61774576", "0.6152931", "0.61465585", "0.61440265", "0.61433405", "0.6130087", "0.61219895", "0.6089555", "0.6082657", "0.60700315", "0.6068432", "0.60483843", "0.6041453", "0.60379905", "0.602392", "0.602335", "0.60090387", "0.60043263", "0.6001319", "0.5995579", "0.5989928", "0.59882843", "0.5985505", "0.59854496", "0.59839916", "0.59832865", "0.59781903", "0.59681547", "0.5965052", "0.5962252", "0.5946197", "0.59434867", "0.59417546", "0.59393066", "0.59392065", "0.593721", "0.5931395", "0.59205073", "0.591602", "0.59136575", "0.5910132", "0.5909707", "0.5903751", "0.590077", "0.5894308", "0.5890765", "0.5890542", "0.5889557", "0.5883847", "0.5878669", "0.58746314", "0.5868102", "0.5862646", "0.5851735", "0.5849199", "0.58435875", "0.58434814", "0.5835977", "0.5835945", "0.5831885", "0.5828657", "0.5825526", "0.5820515", "0.58177745", "0.5813087", "0.5813087", "0.58094245", "0.58092636", "0.5801921", "0.5797402", "0.57956177", "0.5793363", "0.5790019", "0.5789189", "0.57886183", "0.5781575", "0.57784754", "0.5776483", "0.5769917", "0.57641214", "0.5758861", "0.5756994", "0.57526535" ]
0.0
-1
=begin Create VariantItem on behalf of supplier =end
def has_similar_property_value_list?( property_value_list ) property_value_list.each do |property_value_pair| if self.property_values.where(:property_id => property_value_pair[:property_id], :value_id => property_value_pair[:value_id]).count == 0 next else return true end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_product_for(line_item)\n default_tax_category = TaxCategory.find_by_name(\"default\")\n product = Product.create(:name => line_item.title, \n :master_price => line_item.price, \n :description => line_item.title,\n :tax_category_id => default_tax_category ? default_tax_category.id : nil)\n product.save!\n product.variants.create(:product_id => product.id, :sku => line_item.sku, :price => line_item.price)\n product\n end", "def propagate_variant(variant)\n if supplier_id.blank? || variant.suppliers.pluck(:id).include?(supplier_id)\n stock_items.create!(variant: variant, backorderable: backorderable_default)\n end\n end", "def create\n load_object\n variant = Variant.find(params[:purchase_line_item][:variant_id])\n\n before :create\n\n @purchase_order.add_variant(variant, params[:purchase_line_item][:qty].to_i)\n\n if @purchase_order.save\n after :create\n set_flash :create\n response_for :create\n else\n after :create_fails\n set_flash :create_fails\n response_for :create_fails\n end\n\n end", "def create_variant(attr_hash, headers, exception_hash)\n product_to_reference = Product.find_by_name(attr_hash[headers[1]])\n if product_to_reference.nil?\n product_to_reference = Product.find_by_id(attr_hash[headers[1]])\n end\n if not product_to_reference.nil?\n attr_hash[headers[1]] = product_to_reference[:id]\n else\n @failed_queries = @failed_queries +1\n return\n end\n handle_exceptions(exception_hash, attr_hash)\n new_variant = Variant.find_by_sku(attr_hash['sku'])\n if new_variant.nil?\n new_variant = Variant.new(attr_hash)\n @failed_queries += 1 if not new_variant.save\n end\n end", "def create_variant(product_obj, row, columns)\n \n if variant = Variant.first(:conditions => [\"product_id = ? AND sku = ? AND price = ?\", product_obj.id, row[columns['SKU']], row[columns['Master Price']]])\n log(\"Variant found: #{variant.sku}\")\n else\n variant = Variant.create :product => product_obj, :sku => row[columns['SKU']], :price => row[columns['Master Price']]\n\n [\n [\"Color\", \"Couleur\"],\n [\"Size\", \"Taille\"],\n [\"Age\", \"Age\"],\n ]. each do |name, presentation|\n\n log(\"Import - Variant option: #{name} - value: #{row[columns[name]]}\")\n\n if value = row[columns[name]]\n unless option_type = OptionType.first(:conditions => [\"name LIKE ? AND presentation LIKE ?\", name, presentation])\n option_type = OptionType.create! :name => name, :presentation => presentation\n end\n unless option_value = OptionValue.first(:conditions => [\"name LIKE ? AND presentation LIKE ? AND option_type_id = ?\", value, value, option_type.id])\n option_value = OptionValue.create! :name => value, :presentation => value, :option_type => option_type\n end\n variant.option_values << option_value\n end\n end\n end\n \n variant.save!\n product_obj.save!\n \n log(\"Variant saved for #{variant.sku}\")\n end", "def create\n load_object\n variant = Variant.find(params[:line_item][:variant_id])\n\n before :create\n\n @order.add_variant(variant, params[:line_item][:quantity].to_i)\n\n if @order.save\n after :create\n set_flash :create\n response_for :create\n else\n after :create_fails\n set_flash :create_fails\n response_for :create_fails\n end\n\n end", "def create\n @master_variant = Variant.find(params[:product_id])\n params[:variant][:is_master] = false\n params[:variant][:master_id] = @master_variant.id\n params[:variant][:product] = @master_variant.product\n @variant = Variant.new(params[:variant])\n\n respond_to do |format|\n if @variant.save\n format.html { redirect_to admin_product_variants_path(@variant.master_id), notice: 'Variant was successfully created.' }\n format.json { render json: admin_product_variant_path(@variant.master_id, @variant),\n status: :created, location: admin_product_variant_path(@variant.master_id, @variant) }\n else\n @path = admin_product_variants_path(@master_variant)\n format.html { render action: \"new\" }\n format.json { render json: @variant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @variant = Variant.new(variant_params)\n @variant.good = @good\n\n respond_to do |format|\n if @variant.save\n format.html { redirect_to edit_admin_good_url(@variant.good, anchor: \"variants\"), notice: 'Variant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @variant }\n else\n format.html { render action: 'new' }\n format.json { render json: @variant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fabric_variant_supplier = FabricVariantSupplier.new(fabric_variant_supplier_params)\n\n respond_to do |format|\n if @fabric_variant_supplier.save\n format.html { redirect_to @fabric_variant_supplier, notice: 'Fabric variant supplier was successfully created.' }\n format.json { render :show, status: :created, location: @fabric_variant_supplier }\n else\n format.html { render :new }\n format.json { render json: @fabric_variant_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_variant_with_gift_package(variant, quantity = 1, gift_package_id = nil)\n current_item = contains?(variant)\n if current_item\n current_item.quantity += quantity\n current_item.gift_package_id = gift_package_id\n current_item.save\n else\n current_item = Spree::LineItem.new(:quantity => quantity)\n current_item.variant = variant\n current_item.price = variant.price\n current_item.gift_package_id = gift_package_id\n self.line_items << current_item\n end\n\n # populate line_items attributes for additional_fields entries\n # that have populate => [:line_item]\n Spree::Variant.additional_fields.select { |f| !f[:populate].nil? && f[:populate].include?(:line_item) }.each do |field|\n value = ''\n\n if field[:only].nil? || field[:only].include?(:variant)\n value = variant.send(field[:name].gsub(' ', '_').downcase)\n elsif field[:only].include?(:product)\n value = variant.product.send(field[:name].gsub(' ', '_').downcase)\n end\n current_item.update_attribute(field[:name].gsub(' ', '_').downcase, value)\n end\n\n current_item\n end", "def add_variant\n order = current_order(create_order_if_necessary: true)\n variant = Spree::Variant.find(params[:variant_id])\n quantity = params[:quantity].to_i\n\n if quantity.between?(1, 2_147_483_647)\n begin\n order.contents.add(variant, quantity)\n order.ensure_updated_shipments\n @order = order.reload\n render_order\n rescue ActiveRecord::RecordInvalid => e\n invalid_resource!(e.record)\n end\n else\n invalid_resource!(order)\n end\n end", "def set_item\n @item = @variant.item\n end", "def new_invoice_item(invoice, i)\n invoice_item = SupplierInvoiceItem.new\n if i.class.name == 'ReceiptNoteItem'\n invoice_item.receipt_note_id = i.receipt_note_id\n invoice_item.receipt_note_item_id = i.id\n else\n invoice_item.purchase_order_id = i.purchase_order_id\n invoice_item.purchase_order_item_id = i.id\n end\n invoice_item.supplier_invoice_id = invoice.id\n invoice_item.product_id = i.product_id\n invoice_item.code = i.code\n invoice_item.description = i.description\n invoice_item.quantity = i.balance\n invoice_item.price = i.price\n invoice_item.discount_pct = i.discount_pct\n invoice_item.discount = i.discount\n invoice_item.tax_type_id = i.tax_type_id\n invoice_item.work_order_id = i.work_order_id\n invoice_item.project_id = i.project_id\n if !i.charge_account_id.blank?\n invoice_item.charge_account_id = i.charge_account_id\n else\n invoice_item.charge_account_id = ChargeAccount.expenditures(i.project_id).first.id\n end\n invoice_item.created_by = current_user.id if !current_user.nil?\n return invoice_item\n end", "def create_product(id)\n item = DirectedEdge::Item.new(@database, \"product#{id}\")\n item.add_tag('product')\n item.save\n end", "def create\n \n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ PARAMS: #{params}\"\n @variant = Variant.new(params[:variant])\n\n respond_to do |format|\n if @variant.save\n format.html { redirect_to event_path(Product.find(params[:variant][\"product_id\"])), notice: 'Ticket type was successfully created.' }\n format.json { render json: @variant, status: :created, location: @variant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @variant.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_create\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @brief_vendor.items << Item.new(params[:item]){|r|r.kind = params[:kind]}\n redirect_to vendor_show_brief_path(@brief)\n end", "def initialize_line_item_with_variant( variant_id, options = {} )\n init_quantity = options[ :quantity ].to_i\n init_quantity = 1 if init_quantity == 0\n \n duplicate_line_item = line_items.where( variant_id: variant_id ).first\n duplicate_line_item.quantity += init_quantity and return duplicate_line_item if duplicate_line_item\n\n line_items.build variant_id: variant_id, quantity: init_quantity\n end", "def create_variant_for(product, options = {:with => {}})\r\n return if options[:with].nil?\r\n\r\n # Just update variant if exists\r\n variant = Variant.find_by_sku(options[:with][:sku])\r\n raise SkuError, \"SKU #{variant.sku} should belongs to #{product.inspect} but was #{variant.product.inspect}\" if variant && variant.product != product\r\n if !variant\r\n variant = product.variants.new\r\n variant.id = options[:with][:id]\r\n else\r\n options[:with].delete(:id)\r\n end\r\n\r\n field = ProductImport.settings[:variant_comparator_field]\r\n log(\"VARIANT:: #{variant.inspect} /// #{options.inspect } /// #{options[:with][field]} /// #{field}\",:debug)\r\n\r\n options[:with].each do |field, value|\r\n variant.send(\"#{field}=\", value) if variant.respond_to?(\"#{field}=\")\r\n #We only applu OptionTypes if value is not null.\r\n if (value)\r\n applicable_option_type = OptionType.where(\r\n \"presentation = ? OR name = ?\",\r\n field.to_s, field.to_s).first\r\n if applicable_option_type.is_a?(OptionType)\r\n product.option_types << applicable_option_type unless product.option_types.include?(applicable_option_type)\r\n opt_value = applicable_option_type.option_values.where([\"presentation = ? OR name = ?\", value, value]).first\r\n opt_value = applicable_option_type.option_values.create(:presentation => value, :name => value) unless opt_value\r\n variant.option_values << opt_value unless variant.option_values.include?(opt_value)\r\n end\r\n end\r\n end\r\n\r\n log(\"VARIANT PRICE #{variant.inspect} /// #{variant.price}\",:debug)\r\n\r\n if variant.valid?\r\n variant.save\r\n\r\n #Finally, attach any images that have been specified\r\n ProductImport.settings[:image_fields_variants].each do |field|\r\n find_and_attach_image_to(variant, options[:with][field.to_sym], options[:with][ProductImport.settings[:image_text_variants].to_sym])\r\n end\r\n\r\n #Log a success message\r\n log(\"Variant of SKU #{variant.sku} successfully imported.\\n\")\r\n else\r\n log(\"A variant could not be imported - here is the information we have:\\n\" +\r\n \"#{pp options[:with]}, #{variant.errors.full_messages.join(', ')}\")\r\n return false\r\n end\r\n\r\n #Stock item\r\n source_location = Spree::StockLocation.find_by(default: true)\r\n log(\"SourceLocation: #{source_location.inspect}\",:debug)\r\n if source_location\r\n stock_item = variant.stock_items.where(stock_location_id: source_location.id).first_or_initialize\r\n log(\"StockItem: #{stock_item.inspect}\",:debug)\r\n log(\"OnHand: #{options[:with][:on_hand]}\",:debug)\r\n #We only update the stock if stock is not blank.\r\n if (options[:with][:on_hand])\r\n stock_item.set_count_on_hand(options[:with][:on_hand])\r\n end\r\n end\r\n\r\n variant\r\n end", "def create\n @supplier_item = SupplierItem.new(supplier_item_params)\n\n respond_to do |format|\n if @supplier_item.save\n format.html { redirect_to @supplier_item, notice: 'Supplier item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @supplier_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @supplier_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n vendor = Vendor.find(item_params[:vendor_id])\n @item.build_vendor(:id => vendor.id)\n @item.save!\n @current_item = @item\n @items = Item.all\n end", "def handle_addFreeItem_effect(profileId, sku, label)\n @order.line_items.create!(variant: Spree::Variant.find_by_sku(sku),\n quantity: 1,\n price: 0)\n end", "def add(variant, quantity = 1, currency = nil, shipment = nil)\n line_item = order.find_line_item_by_variant(variant)\n \n # 29/12/13 DH: Only allow 1 variant sample per order\n #unless variant.option_value(\"silk\") == \"Sample\" and line_item\n # line_item = add_to_line_item(line_item, variant, quantity, currency, shipment)\n #end\n \n # 3/3/14 DH: Previously only allowing 1 sample variant per order but since the BSC spec is per variant\n # line_item then can only allow 1 variant per order \n # (diff variants, eg pencil pleat and deep pencil pleat, of same silk still allowed)\n if line_item\n return line_item\n else\n line_item = add_to_line_item(line_item, variant, quantity, currency, shipment)\n end\n \n line_item\n \n end", "def add_variant(variant, quantity = 1, currency = nil)\n prices_amount = get_prices_amount(variant, currency || self.currency)\n\n current_item = Spree::LineItem.new(:quantity => quantity)\n current_item.variant = variant\n\n if currency\n current_item.currency = currency\n end\n\n if prices_amount[:sale_amount].present?\n current_item.price = prices_amount[:sale_amount]\n # current_item.old_price = prices_amount[:original_amount] disabled because it doesnt include customisations\n else\n current_item.price = prices_amount[:original_amount]\n end\n\n self.line_items << current_item\n self.reload\n current_item\n end", "def make_item(object_type_name)\n\n ot = ObjectType.find_by(name: object_type_name)\n raise \"Could not find object type #{name}\" unless ot\n\n Item.make({ quantity: 1, inuse: 0 }, sample: self, object_type: ot)\n\n end", "def create\n @variant = @product.variants.new(params.require(:variant).permit!)\n @variant.price = params[:variant][:price]\n respond_to do |format|\n if @variant.save\n format.html { redirect_to admin_product_variants_url(@product), notice: 'Variant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @variant }\n else\n format.html { render action: 'new' }\n format.json { render json: @variant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # The item is either \"Local\" or \"Remote\" depending on the source selected\n @item = Item.factory(params[:source], params[@hash_key.to_sym])\n \n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(item_url(@item)) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_default_variant\n unless self.variant?\n variant = self.variants.new\n variant.name = self.color_name\n product_name = self.name.squish.gsub(\" \", \"-\")\n # variant.permalink = \"#{product_permalink}-default\"\n variant.permalink = [product_name, \"-\", SecureRandom.hex(3)].join\n variant.sku = \"sku\"\n variant.color = self.color\n variant.sizes = self.sizes\n variant.price = self.price\n variant.old_price = self.old_price\n variant.default = true\n variant.save\n\n self.attachments.each do |attachment|\n attachment.update_column(:parent_id, variant.id)\n end\n end\n end", "def create_variant(type, value)\n value_type = Spree::OptionType.find_or_initialize_by name: type\n value_type.update! presentation: type.capitalize unless value_type.id\n\n # ensure we have propper variant\n option_value = Spree::OptionValue.find_or_create_by! name: value, presentation: value, option_type_id: value_type.id\n\n # this will link variant to size\n Spree::OptionValuesVariant.find_or_create_by! variant_id: @variant.id, option_value_id: option_value.id\n end", "def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n \n shopItem = UCShopItem.new(self, item, rect,\n SHOP_CONFIG::ITEM_NUMBER_PATTERN)\n \n shopItem.cItemPrice.align = 2\n shopItem.cItemPossess.align = 2 \n shopItem.cItemPossess.font = Font.shop_possess_font\n shopItem.ucItemNumber.cLabelNumber.align = 2\n shopItem.ucItemNumber.min = 0\n shopItem.ucItemNumber.max = shopItem.inventory_quantity\n return shopItem\n end", "def add_line_item_to_order( variant )\n duplicate_line_item = line_item_exists?( variant )\n duplicate_line_item.quantity += 1 and return duplicate_line_item if duplicate_line_item\n\n line_items.build :name => variant.good.name, \n :price => variant.price, \n :options => variant.option_values_to_s,\n :sku => variant.sku\n end", "def build_product\n bundle = Bundle.default\n Product.new(name: 'Product 1', measure_ids: ['BE65090C-EB1F-11E7-8C3F-9A214CF093AE'], bundle_id: bundle._id)\nend", "def prorate_create_item(t, tariff, invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n if t == 'P'\n create_pre_invoice_item(tariff, invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n else\n create_invoice_item(tariff, invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n end\n end", "def create_stock_item\n\n added_new_stock_item = false\n # Get stock location for appropriate location\n @product_row[:location].split(',').each do |sub_location|\n sub_location.chomp!\n stock_location = case sub_location.to_s.downcase\n when /george/\n @@loc_attic\n # NFS no matter what - JC10 OR buffalo display case OR back shop\n when /jc\\d{1,2}|buffalo|back\\sshop|attic/\n @@loc_home_nfs\n # NFS if listed as not for sale (don't count in quantity)\n when /w\\d{1,2}/\n (@product_row[:available] && @product_row[:available].downcase == \"n\") ? @@loc_home_nfs : @@loc_home\n when /[[:alpha:]]\\d{2,3}|D\\d{3}\\.\\d|h\\d|file\\scabinet|suite\\s2/\n (@product_row[:available] && @product_row[:available].downcase == \"n\") ? @@loc_suite2_nfs : @@loc_suite2\n # NWC08\n when /nw[[:alpha:]]\\d{1,2}|ste3/\n @@loc_suite3\n # Warehouse\n when /warehouse/\n @@loc_warehouse\n # West trailer OR east racks\n when /east\\sracks|west\\strailer/\n @@loc_east_racks\n else # if unidentifiable location\n @errors << { :part_number => @product_row[:name], :condition => @product_row[:condition], :message => \"Cannot identify location \" + sub_location }\n next # skip to next location\n end\n\n # if no exisiting sub location, add one\n if(@new_product_condition.add_sub_location(sub_location, stock_location))\n added_new_stock_item = true\n end\n\n end # end location loop\n\n added_new_stock_item # return true if at least one new stock item added\n\n end", "def ensure_variant_and_color_code\n flush_variants\n if product_code\n variant_ids = ProductProduct.search([['default_code', 'ilike', \"FN-#{product_code.split(\"-\")[0]}\"]])\n variant_codes = ProductProduct.find(variant_ids).collect(&:default_code)\n\n variant_codes.each_with_index do |code, index|\n product_variants.create(openerpid: variant_ids[index], \n default_code: code,\n color_code_id: ensure_color_code(code)) \n end\n end\n end", "def create_full_product\n generate_product_name\n generate_product_code\n generate_product_manufacturer\n generate_product_description\n generate_product_price\n end", "def create_item_with_location\n inventory_item = FactoryBot.create :inventory_item\n warehouse_location = FactoryBot.create :warehouse_location\n ItemLocation.create(inventory_item_id: inventory_item.id, warehouse_location_id: warehouse_location.id, quantity: inventory_item.quantity)\n\n inventory_item\n end", "def set_supplier_item\n @supplier_item = SupplierItem.find(params[:id])\n end", "def generate_item(item)\n item\n end", "def create_condition_variant(option_value)\n active = (@product_row[:active] == 1) ? true : false\n # Create condition variants\n @new_product_condition = Spree::Variant.create :sku => @product_row[:name],\n :is_master => false,\n :product_id => @new_product.id,\n :track_inventory => true,\n :tax_category_id => @@auto_tax_category_id,\n :stock_items_count => 0,\n :active => active,\n :notes => \"\"\n\n # Set price and core price\n @new_product_condition_price = Spree::Price.where(\"variant_id = ?\", @new_product_condition.id)\n @new_product_condition_price.first.update_attribute(\"amount\", @product_row[:price])\n @new_product_condition_price.first.update_attribute(\"core\", @product_row[:core]) if @product_row[:core].present?\n\n # Add option value\n @new_product_condition.option_values << option_value\n\n @new_product_condition\n end", "def create\n @item_storage = ItemStorage.new(item_storage_params)\n @purchase = Purchase.find(params[:item_storage][:purchase_id])\n @item_storage.purchase_id = @purchase.id\n @item_storage.item_id = @purchase.item_id\n @item_storage.item_type = @purchase.item_type\n @item_storage.supplier_id = @purchase.supplier_id\n respond_to do |format|\n if @item_storage.save\n format.html { redirect_to item_storages_url, notice: '入库记录创建成功!' }\n format.json { render :show, status: :created, location: @item_storage }\n else\n format.html { render :new }\n format.json { render json: @item_storage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_line_item_for_per_person_charge qty, vendor_id, include_price_in_expense, include_price_in_revenue, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n line_items.push(create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\"))\n end", "def create_complete_order(user, product, options={})\n returning(user.orders.create) do |order|\n order.line_items.push create_line_item(product.variants.first)\n order.save\n order.checkout.bill_address = Address.new({\n :firstname => \"First\",\n :lastname => \"Last\",\n :address1 => \"Address1\",\n :city => \"City\",\n :state_name => \"A State\",\n :zipcode => \"00000\",\n :country => Country.new,\n :phone => \"00000000\"\n })\n order.complete\n order.save!\n end\nend", "def create_line_item_for_per_person_charge qty, vendor_id, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n new_line_items = create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\")\n line_items.push(new_line_items)\n new_line_items\n end", "def make_item\n Forge_Core.forge(@items_window.item, @confirm_window.quantity)\n Sound.play_forge_start\n @materials_window.refresh\n @gold_window.refresh\n @items_window.refresh\n end", "def create\n @sub_variant = SubVariant.new(params[:sub_variant])\n\n respond_to do |format|\n if @sub_variant.save\n format.html { redirect_to @sub_variant, notice: 'Sub variant was successfully created.' }\n format.json { render json: @sub_variant, status: :created, location: @sub_variant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sub_variant.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @object = Spree::Product.new()\n @status = true\n @suppliers = Supplier.all\n end", "def create_item(name, price)\r\n new_item = Trading::Item.created( name, price, self )\r\n self.item_list.push(new_item) # AK You can also do `item_list << new_item`\r\n return new_item\r\n end", "def create\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.build(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @supplier, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template)\n ]\n end", "def add_product\n # unique by name. don't create if product exists\n # strangley spree is not povideing any uid in products table.\n # I am using name for now, if that will not work I modify schema and add uid to spree_products\n @product = Spree::Product.find_or_initialize_by(name: @row[:name])\n\n # master sku has M prefix\n @product.sku = \"m-#{@row[:id]}\"\n @product.price = @row[:price]\n @product.description = @row[:description]\n @product.available_on = Time.now\n @product.shipping_category_id = 1\n @product.tax_category_id = 1\n @product.promotionable = 1\n @product.save! # this will create master variant as well\n\n # now add variant\n # is_master: false, product_id: @product.id\n @variant = Spree::Variant.find_or_initialize_by sku: @row[:id]\n @variant.product_id = @product.id\n @variant.cost_price = @row[:price]\n @variant.track_inventory = false\n @variant.save!\n\n add_image\n add_variants\n\n # @product.option_type_ids = option_type_ids\n # @product.save!\n\n assign_category\n end", "def create_item(data_bag, item_name, data = {}, metadata = {})\n item = ::SecureDataBag::Item.new(metadata)\n item.raw_data = { 'id' => item_name }.merge(data)\n item.data_bag data_bag\n item\n end", "def supplier_variant(supplier)\n self.supplier_variants.where(supplier_id: supplier).first\n end", "def create(*args)\n item = build_virtual_item(*args)\n @conglomerate.items.push(item)\n [item]\n end", "def create\n @ingredient = Ingredient.find(params[:id])\n \n @supplier.ingredients << @ingredient\n redirect_to supplier_path(@supplier)\n end", "def create\n properties = [ resource[:name],\n resource[:user],\n resource[:group],\n resource[:config],\n resource[:mode],\n ]\n\n qmgmt(['volume', 'create'] + properties)\n end", "def execute\n guest.cart.order_items.create product: product\n end", "def set_variant\n @product = Product.find(params[:product_id])\n @variant = @product.variants.new\n end", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "def generate_warehouse\n return true if type!=\"Supplier\"\n Warehouse.create(:company_id=>self.id,\n :name=>self.name,\n :managed=>false,\n :address=>self.address,\n :address2=>self.address2,\n :city=>self.city,\n :us_state=>self.state,\n :zipcode=>self.zipcode)\n end", "def create\n @supplier_sku = SupplierSku.new(params[:supplier_sku])\n\n respond_to do |format|\n if @supplier_sku.save\n format.html { redirect_to @supplier_sku, notice: 'Supplier sku was successfully created.' }\n format.json { render json: @supplier_sku, status: :created, location: @supplier_sku }\n else\n format.html { render action: \"new\" }\n format.json { render json: @supplier_sku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n get_supplier\n @supplier_phone = @supplier.phones.create(params[:supplier_phone])\n end", "def inventory_unit1\n Spree::InventoryUnit.new(variant: variant1)\n end", "def manufacture\n if required_param_types_present?\n generate_new_item_object\n else\n raise RuntimeError.new(\"One or more required objects is missing.\")\n end\n end", "def create\n @order = current_order(create_order_if_necessary: true)\n authorize! :update, @order, cookies.signed[:guest_token]\n product = ::Spree::Product.find(params[:product_id])\n option_values_ids = params[:options].present? ? params[:options].values : []\n option_values = ::Spree::OptionValue.where(id: option_values_ids)\n variant = product.try_variant option_values\n quantity = params[:quantity].present? ? params[:quantity].to_i : 1\n\n # 2,147,483,647 is crazy. See issue https://github.com/spree/spree/issues/2695.\n if !quantity.between?(1, 2_147_483_647)\n @order.errors.add(:base, t('spree.please_enter_reasonable_quantity'))\n else\n begin\n @line_item = @order.contents.add(variant, quantity)\n rescue ActiveRecord::RecordInvalid => error\n @order.errors.add(:base, error.record.errors.full_messages.join(\", \"))\n end\n end\n\n respond_with(@order) do |format|\n format.html do\n if @order.errors.any?\n flash[:error] = @order.errors.full_messages.join(\", \")\n redirect_back_or_default(root_path)\n return\n else\n redirect_to edit_cart_path\n end\n end\n end\n end", "def create_product()\n # check for existing slug\n slug = @product_row[:name]\n if(Spree::Product.where(\"slug=?\", slug).length > 0)\n @errors << { :part_number => @product_row[:name], :condition => @product_row[:condition], :message => \"Found duplicate slug (url) for \" + slug }\n end\n\n # Get description\n description = @product_row[:description]\n # Get with from w/\n if @product_row[:description].downcase.include? \"w/o\"\n description = @product_row[:description].gsub(/w\\/o/i,\"without \")\n description.strip!\n elsif @product_row[:description].downcase.include? \"w/\"\n description = @product_row[:description].gsub(/w\\//i,\"with \")\n description.strip!\n end\n new_product = Spree::Product.create :name => @product_row[:name],\n :description => description,\n :meta_keywords => @product_row[:meta_keywords],\n :available_on => DateTime.new(2015,1,1),\n :slug => slug,\n :tax_category_id => @@auto_tax_category_id,\n :shipping_category_id => @@shipping_category_id,\n :promotionable => true,\n :price => @product_row[:price], # Defines master price\n :notes => @product_row[:notes]\n end", "def create_avalon_item(json_read_metadata)\n\n end", "def create_item\n @item = Fox_Item.new(self, @content.join(\"\\t\"), @icon, @icon)\n end", "def create\n upload_item params[params[:item_type]], session['username'], params[:alternative_name], params[:tag_name], params[:item_type], params[:details]\n end", "def create_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend", "def create\n @supplier = current_merchant.suppliers.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n @supplier.ordering_method_ids = params[:supplier][:ordering_method_ids]\n @supplier.delivery_location_ids = params[:supplier][:delivery_location_ids]\n @supplier.online_retail_service_type_ids = params[:supplier][:online_retail_service_type_ids]\n @supplier.product_category_ids = params[:supplier][:product_category_ids]\n end", "def create_item( *args )\n raise NotImplementedError.new(\"Subclasses must implement #create_item\")\n end", "def create\n @integration_store = IntegrationStore.new(integration_store_params.merge(supplier: current_user))\n\n respond_to do |format|\n if @integration_store.save\n format.html { redirect_to @integration_store, notice: 'Integration store was successfully created.' }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end", "def create\n trim_name = product_params[:name].strip\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n @product.update_attributes(:name => trim_name)\n ProductVariant.create(:product_id => @product.id, :price => 0)\n format.html { redirect_back_or(admin_merchandise_products_url, notice: 'Product was successfully created.') }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @product = Product.new\n @shop = current_user.shops.find_by_uuid(params[:shop_id])\n @product.product_variants.build\n\n respond_to do |format|\n format.html\n format.json { render json: @product}\n end\n end", "def add_product_skus\n @order = Spree::Order.find_by_id(params[:order_id])\n @variant = Spree::Variant.find_by_id(params[:variant_id])\n @product = @variant.product\n requested_qty = params[:quantity]\n is_customer_pickup = @order.market_place_details.present? ? (@order.market_place_details[\"OrderType\"] == \"Pickup\" ? true : false) : false\n # code to find the order_total\n if @order.market_place.present?\n case @order.market_place.code\n when \"qoo10\"\n order_total = @order.market_place_details.present? ? @order.market_place_details[\"total\"] : @order.total\n when \"lazada\",'zalora'\n order_total = @order.total\n end\n end\n # code to create line item\n price = @variant.price.present? ? @variant.price : 0.0 \n @line_item = Spree::LineItem.create!(:variant_id=>@variant.id, :order_id=>@order.id, :quantity=>requested_qty, :price=>price, :currency=>@order.currency, :is_pick_at_store => is_customer_pickup)\n if @line_item.present?\n @sellers_market_places_product = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=? AND product_id=?\", @order.seller_id, @order.market_place_id, @product.id).try(:first)\n if @sellers_market_places_product.present?\n @stock_product = Spree::StockProduct.where(\"sellers_market_places_product_id=? AND variant_id=?\", @sellers_market_places_product.id, @variant.id).try(:first)\n if @stock_product.present?\n @stock_product.update_attributes(:count_on_hand=>(@stock_product.count_on_hand - requested_qty.to_i) >= 0 ? (@stock_product.count_on_hand - requested_qty.to_i) : 0)\n @variant.update_attributes(:fba_quantity=>(@variant.fba_quantity - requested_qty.to_i) >= 0 ? (@variant.fba_quantity - requested_qty.to_i) : 0) if !@variant.quantity_inflations.present?\n msg = 'Admin/Orders Controller add_product_skus Line 182'\n @variant.add_log_on_update(msg) rescue QTY_LOG.error \"#{Time.zone.now} Error -- #{msg}\"\n else\n @stock_product = Spree::StockProduct.create!(:sellers_market_places_product_id=>@sellers_market_places_product.id, :variant_id=>@variant.id, :count_on_hand=>requested_qty.to_i, :virtual_out_of_stock=>false)\n @variant.update_attributes(:fba_quantity=>(@variant.fba_quantity - requested_qty.to_i) >= 0 ? (@variant.fba_quantity - requested_qty.to_i) : 0) if !@variant.quantity_inflations.present?\n msg = 'Admin/Orders Controller add_product_skus Line 187'\n @variant.add_log_on_update(msg) rescue QTY_LOG.error \"#{Time.zone.now} Error -- #{msg}\"\n end\n end\n end\n # code to update order total after creating line item for order\n @order.update_column(:total, order_total)\n @order.reload\n line_items = @order.line_items\n ActiveSupport::Notifications.instrument('spree.order.contents_changed', {:user => nil, :order => @order})\n respond_to do |format|\n format.html { render :partial=>\"modify_shipping\", :locals => { :line_items => line_items }}\n end\n end", "def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n\n case index\n when 0\n if @actor.two_swords_style\n kindDesc = Vocab::weapon1\n else\n kindDesc = Vocab::weapon\n end\n when 1\n if @actor.two_swords_style\n kindDesc = Vocab::weapon2\n else\n kindDesc = Vocab::armor1\n end\n when 2\n kindDesc = Vocab::armor2\n when 3\n kindDesc = Vocab::armor3\n when 4\n kindDesc = Vocab::armor4\n end\n \n rect.y += WLH*index \n equipItem = UCEquipItem.new(self, item, rect, kindDesc)\n \n f = Font.new()\n f.color = system_color\n equipItem.cEquipKind.font = f\n return equipItem\n end", "def create\n\t\t@part = Part.new(params[:part])\n# \t\t@product = Product.find(@part.product_id)\n\t\t@supplier = Supplier.find(params[:supplier_id])\n\t\t\n\t\trespond_to do |format|\n\t\tif @part.save\n\t\t\tformat.html { redirect_to @supplier, notice: t('actions.part.notice.created') }\n\t\t\tformat.json { render json: @part, status: :created, location: @supplier }\n\t\telse\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @part.errors, status: :unprocessable_entity }\n\t\tend\n\t\tend\n\tend", "def populate\n order = current_order(create_order_if_necessary: true)\n variant = Spree::Variant.find(params[:variant_id])\n quantity = params[:quantity].to_i\n options = params[:options] || {}\n direccion = params[:direccion]\n aux = variant.product_id\n if aux == 1\n sku = 19\n elsif aux == 2\n sku = 27\n elsif aux == 3\n sku = 40\n elsif aux == 4\n sku = 45\n elsif aux == 5\n sku = 47\n end\n # 2,147,483,647 is crazy. See issue #2695.\n if quantity.between?(1, 2_147_483_647)\n if quantity <= (StockItem.find_by id: aux).count_on_hand\n begin\n order.contents.add(variant, quantity, options)\n rescue ActiveRecord::RecordInvalid => e\n error = e.record.errors.full_messages.join(\", \")\n end\n else\n error = Spree.t(:please_enter_reasonable_quantity)\n end\n else\n error = Spree.t(:please_enter_reasonable_quantity)\n end\n\n if error\n flash[:error] = error\n redirect_back_or_default(spree.root_path)\n else\n total = NuestroProducto.find(aux).precio * quantity\n factura = RestClient.put 'http://moto.ing.puc.cl/facturas/boleta', {:proveedor => '572aac69bdb6d403005fb042', :cliente => 'b2c', :total => total}\n facturaParseada = JSON.parse factura\n boleta = facturaParseada[\"_id\"]\n $idBoleta = boleta\n $iva = facturaParseada[\"iva\"]\n iva = $iva\n $montoBruto = facturaParseada[\"bruto\"]\n bruto = $montoBruto\n $total = facturaParseada[\"total\"]\n total = $total\n urlOk = 'http://integra1.ing.puc.cl/spree/orders/confirmarCompra/' + boleta\n urlFail = 'http://integra1.ing.puc.cl/cancelacion'\n url = 'http://integracion-2016-prod.herokuapp.com/web/pagoenlinea?callbackUrl='+urlOk+'&cancelUrl='+urlFail+'&boletaId=' + boleta\n redirect_to url\n #precio = NuestroProducto.find(aux).precio\n #moverA_Despacho boleta, direccion, quantity, sku, precio\n Ticket.create(idBoleta:boleta, direccion:direccion, sku:sku, cantidad:quantity, iva:iva, bruto:bruto, total:total)\n end\n end", "def provision_shop_with_items(item_statistics)\n @shop << Item.new(item_statistics)\n end", "def provision_shop_with_items(item_statistics)\n @shop << Item.new(item_statistics)\n end", "def set_fabric_variant_supplier\n @fabric_variant_supplier = FabricVariantSupplier.find(params[:id])\n end", "def add_to_line_item(variant, quantity, options = {})\n line_item = grab_line_item_by_variant(variant, false, options)\n\n line_item ||= order.line_items.new(\n quantity: 0,\n variant: variant,\n currency: order.currency\n )\n line_item.quantity += quantity.to_i\n line_item.options = ActionController::Parameters.new(options).permit(Spree::PermittedAttributes.line_item_attributes).to_h\n\n unless options.empty?\n product_customizations_values = options[:product_customizations] || []\n line_item.product_customizations = product_customizations_values\n product_customizations_values.each { |product_customization| product_customization.line_item = line_item }\n product_customizations_values.map(&:save) # it is now safe to save the customizations we built\n\n # find, and add the configurations, if any. these have not been fetched from the db yet. line_items.first.variant_id\n # we postponed it (performance reasons) until we actually know we needed them\n ad_hoc_option_value_ids = ( options[:ad_hoc_option_values].any? ? options[:ad_hoc_option_values] : [] )\n product_option_values = ad_hoc_option_value_ids.map do |cid|\n Spree::AdHocOptionValue.find(cid) if cid.present?\n end.compact\n line_item.ad_hoc_option_values = product_option_values\n\n offset_price = product_option_values.map(&:price_modifier).compact.sum + product_customizations_values.map {|product_customization| product_customization.price(variant)}.compact.sum\n\n line_item.price = variant.price_in(order.currency).amount + offset_price\n end\n\n if line_item.new_record?\n create_order_stock_locations(line_item, options[:stock_location_quantities])\n end\n\n line_item.target_shipment = options[:shipment]\n line_item.save!\n line_item\n end", "def sku_combination_creation\n end", "def giveItem\n toLocation = Company.where(name: params[:recepCompany]).first.locations.where(address: params[:recepLocation]).first\n location = current_company.locations.where(id: params[:locationId]).first\n if(location.is_supplier === true)\n updatedItem = location.items.where(name: params[:name]).first\n toUpdatedItem = toLocation.items.where(name: params[:name]).first\n if(toUpdatedItem.present? && updatedItem.amount > params[:amount].to_i)\n updatedItem.increment!(:amount, -params[:amount].to_i)\n toUpdatedItem.increment!(:amount, params[:amount].to_i)\n elsif(updatedItem.amount > params[:amount].to_i)\n updatedItem.increment!(:amount, -params[:amount].to_i)\n item = Item.create(name: params[:name], amount:params[:amount].to_i, price: updatedItem.price, autoRestock: false, lastSupplier:location.id)\n toLocation.items << item\n end\n if(updatedItem.amount <= updatedItem.restockPoint)\n changeItemSupplier(updatedItem.id)\n end\n end\n end", "def create_product(prod)\n\n purchase_price = BigDecimal.new(\"0.0\")\n purchase_price = BigDecimal.new(prod['purchase_price'].to_s) unless prod['purchase_price'].nil?\n sales_price = nil\n sales_price = BigDecimal.new(prod['sales_price']) unless prod['sales_price'].nil?\n weight = 0\n weight = prod['weight'].to_f unless prod['weight'].nil?\n manufacturer_product_code = prod['manufacturer_product_code']\n stock = prod['stock'].to_i unless prod['stock'].nil?\n\n tax_percentage = prod['tax_percentage'] || 8.0\n tax_class = TaxClass.where(:percentage => tax_percentage).first unless tax_percentage.nil?\n if tax_class.nil?\n tax_class = TaxClass.create(:percentage => 8.0, :name => \"8.0\")\n end\n\n prod['description'].blank? ? description = \"No description\" : description = prod['description']\n \n is_featured = false\n is_featured = true if [\"yes\", \"true\", \"1\"].include?(prod['featured'])\n is_visible = true\n is_visible = false if [\"no\", \"false\", \"0\"].include?(prod['visible'])\n is_build_to_order = false\n is_build_to_order = true if [\"yes\", \"true\", \"1\"].include?(prod['build_to_order'])\n \n supplier = Supplier.find_by_name(prod['supplier'])\n\n product = Product.where(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier_id => supplier,\n :tax_class_id => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock).first\n if product.nil?\n product = Product.create(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier => supplier,\n :tax_class => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock)\n end\n if prod['category']\n category = Category.where(:name => prod['category']).first\n category = Category.create(:name => prod['category']) if category.nil?\n product.categories << category\n product.save\n end\n\n\n # Ugly, but at least it makes test authors know what went wrong\n if product.errors.empty?\n return product\n else\n puts \"Errors creating product: #{product.errors.full_messages}\"\n return false\n end\nend", "def create_product(store:, name:, id_from_provider:, category:, url:)\n product = Product.find_by store: store, name: name\n\n return product if product\n\n Product.create store: store, name: name, id_from_provider: id_from_provider, category: category, url: url\nend", "def create_item(item_code)\n \t\txero = XeroConnection.new.connect\n\n \t\tif xero.Item.all(where: 'code == \"%s\"' % item_code).empty?\n \t\t\tnew_item = xero.Item.build(code: item_code)\n \t\t\tnew_item.save\n \t\tend\n \tend", "def add_to_allocation(supplier, demander, bid)\n @allocation[supplier.get_id][demander.get_id] = { :demander => demander, :bid => bid }\n @in_allocation[demander.get_id] = true\n end", "def activate\n # admin.tabs.add \"Variant Images\", \"/admin/variant_images\", :after => \"Layouts\", :visibility => [:all]\n \n Variant.class_eval do\n has_many :images, :as => :viewable, :order => :position, :dependent => :destroy\n end\n \n Spree::BaseHelper.class_eval do\n def product_cart_description(product)\n truncate(product.description, :length => 90, :omission => \"...\")\n end\n end\n \n Admin::VariantsController.class_eval do\n after_filter :set_image, :only => [:create, :update]\n \n private\n def set_image\n return unless params[:image]\n return if params[:image][:attachment].blank? \n image = Image.create params[:image] if params[:image]\n object.images << image\n end\n end\n end", "def create_supplier( employee, supplier_params) \n supplier = Supplier.new(supplier_params)\n if not employee.has_role?(:admin)\n supplier.errors.add( :authentication , \"Wrong Role: No admin role\")\n return supplier\n end\n \n \n \n supplier.office_id = self.id \n supplier.creator_id = employee.id \n supplier.save\n \n \n return supplier\n end", "def populate\n order = current_order\n variant = Spree::Variant.find(params[:index])\n options = params[:options] || {}\n\n # 2,147,483,647 is crazy. See issue #2695.\n if quantity.to_f.between?(0.00001, 2_147_483_647)\n begin\n order.contents.add(variant, quantity, options)\n rescue ActiveRecord::RecordInvalid => e\n error = e.record.errors.full_messages.join(\", \")\n end\n else\n error = Spree.t(:please_enter_reasonable_quantity)\n end\n\n respond_with(order) do |format|\n if error\n format.js { flash[:error] = error }\n else\n format.js { flash.now[:success] = \"#{variant.product.name} has been added to your order\"}\n end\n end\n end", "def populate\n @order = current_order(session)\n variant_id = params[:variant_id]\n \n new_line_item = Breeze::Commerce::LineItem.new(:variant_id => variant_id, :quantity => params[:quantity] || 1)\n existing_line_item = @order.line_items.unarchived.where(:variant_id => variant_id).first \n if existing_line_item\n existing_line_item.quantity += new_line_item.quantity\n existing_line_item.save\n else\n @order.line_items << new_line_item\n end\n\n @order.save\n end", "def create\n params[:variant_image][:image2] = params[:variant_image][:image] # For image replication across two s3 accounts\n @variant_image = VariantImage.new(params[:variant_image])\n\t\t@variant = @variant_image.variant\n @product = @variant.product \n\n respond_to do |format|\n if @variant_image.save\n format.html { redirect_to @variant, notice: 'Image added successfully.' }\n format.js { redirect_to @variant_image, notice: 'Image added successfully.' }\n format.json { render json: @variant_image, status: :created, location: @variant_image }\n else\n format.html { render action: \"new\" }\n format.js { render action: \"new\" }\n format.json { render json: @variant_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @catalog_supplier = Catalog::Supplier.new(catalog_supplier_params)\n\n respond_to do |format|\n if @catalog_supplier.save\n format.html { redirect_to @catalog_supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @catalog_supplier }\n else\n format.html { render :new }\n format.json { render json: @catalog_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_variant(variant, quantity = 1, currency = nil)\n current_item = super\n if update_prices_per_user\n current_item.reload\n else\n current_item\n end\n end", "def apply_variant_template(variant)\n result = true\n variant.options.each do |variant|\n variants.new(:name => variant).save! rescue (result = false)\n end\n result\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n \n [l1, l2]\n end", "def create_item\n object = @spawn_object.call\n\n object.pool_create if object.respond_to? :pool_create\n\n item = PoolItem.new(object)\n\n @item_stack.push(item)\n\n item\n end", "def create_item(name, price)\r\n new_item = Models::Item.created( name, price, self )\r\n self.item_list.push(new_item)\r\n new_item.save\r\n return new_item\r\n end", "def create\n store_location()\n \n @product_variant = ProductVariant.new(product_variant_params)\n \n respond_to do |format|\n if @product_variant.save\n if params[:product_id].present?\n @product_variant.update_columns(product_id: params[:product_id])\n puts \"updated #{@product_variant.product_id}\"\n end\n format.html { redirect_back_or(@product_variant, notice: 'Product variant was successfully created.') }\n format.json { render action: 'show', status: :created, location: @product_variant }\n else\n format.html { render action: 'new' }\n format.json { render json: @product_variant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_pre_invoice_item(tariff, pre_invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n PreInvoiceItem.create(\n pre_invoice_id: pre_invoice_id,\n code: tariff.try(:billable_item).try(:billable_concept).try(:code),\n description: d + tariff.try(:billable_item).try(:billable_concept).try(:name),\n tariff_id: tariff.id,\n price: price,\n quantity: quantity,\n tax_type_id: tax_type_id,\n discount_pct: discount_pct,\n discount: 0.0,\n product_id: nil,\n subcode: subcode,\n measure_id: measure,\n created_by: user_id)\n end" ]
[ "0.6767069", "0.6526714", "0.62981725", "0.62915397", "0.621764", "0.6182462", "0.6056527", "0.60560554", "0.60164213", "0.6016307", "0.59834594", "0.59641135", "0.59497684", "0.5941127", "0.5935022", "0.5932891", "0.59122676", "0.59089243", "0.5899165", "0.5873545", "0.58707947", "0.58576894", "0.5857352", "0.58572906", "0.5855999", "0.5850506", "0.5843943", "0.5840932", "0.58145654", "0.580506", "0.5791984", "0.5781547", "0.5751568", "0.5751498", "0.57513607", "0.5709961", "0.56947386", "0.5688288", "0.56861013", "0.5680204", "0.5666079", "0.5662753", "0.5651545", "0.56439507", "0.5631872", "0.56276786", "0.5625364", "0.5618176", "0.5614672", "0.56016135", "0.55870086", "0.5586103", "0.5585511", "0.5580309", "0.5577681", "0.5572714", "0.5569014", "0.5559385", "0.5540253", "0.5533031", "0.55255044", "0.5525168", "0.5511085", "0.55104375", "0.5507365", "0.5501188", "0.5500792", "0.54926157", "0.548395", "0.548313", "0.54822004", "0.54670733", "0.5461223", "0.5460172", "0.54532045", "0.54516566", "0.5450256", "0.5446719", "0.5446072", "0.5446072", "0.544589", "0.54399216", "0.5434428", "0.5433517", "0.5422749", "0.542172", "0.54213303", "0.54176027", "0.54098916", "0.5407738", "0.540682", "0.5396721", "0.5390381", "0.53848284", "0.53789264", "0.5378911", "0.53768253", "0.53744143", "0.5372876", "0.5369742", "0.53662336" ]
0.0
-1
GET /positives GET /positives.json
def index @positives = Positive.all @positives_json= Positive.all.map(&:lonlat).as_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end", "def index\n @goals = current_user.goals.where(archived: false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @points_spents = PointsSpent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_spents }\n end\n end", "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "def index\n @goals = @todo.goals.all\n render json: @goals\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @proposals = Proposal.all\n\n render json: @proposals\n end", "def index\n @goal_rewards = user.goal_rewards\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goal_rewards }\n end\n end", "def index\n @goals = @user.goals.non_project\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @possess = Possess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @possess }\n end\n end", "def index\n @investigations = Investigation.where(:visible => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @investigations }\n end\n end", "def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end", "def index\n @approvals = Approval.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @approvals }\n end\n end", "def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end", "def pending\n @reviews = current_user.written_reviews.pending\n render json: @reviews\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def index\n @votes = @proposal.votes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def index\n @parishes = Parish.all\n\n render json: @parishes\n end", "def index\n @travel_requests = TravelRequest.where user_id: current_user.id\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @travel_requests }\n end\n end", "def index\n render json: Loan.all\n end", "def index\n @investments = Investment.all\n\n render json: {investments: @investments}, root: false\n end", "def index\n @resources = Resource.where(\"is_approved = true\")\n render json: @resources, status: 200\n end", "def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end", "def index\n authorize Donate\n @donates = Donate.order('id DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @donates }\n end\n end", "def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render json: @cages }\n end\n end", "def index\n @proposals = current_user.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end", "def accessories\n render json: { collections: Collection.published_accessories }\n end", "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end", "def index\n @goals = Goal.where(client_id: $current_client.id)\n end", "def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @trades = Trade\n .only(:created_at, :is_fair, :ash_pokemons, :brock_pokemons)\n respond_to do |format|\n format.json { render json: @trades }\n end\n end", "def index\n @incomes = Income.all\n\n respond_to do |format|\n format.json { render json: @incomes }\n end\n end", "def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def index\n @investments = Investment.all\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index_approvable\n @asset_info_adjustments = AssetInfoAdjustment.accessible_by(current_ability, :approve).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html { render \"index\" }\n format.json { render json: @asset_info_adjustments }\n format.xml { render xml: @asset_info_adjustments }\n end\n end", "def show\n render json: @petty_cash_expense\n end", "def show\n @points_spent = PointsSpent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @points_spent }\n end\n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def index\n @applicants = Applicant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicants }\n end\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def index\n @coin_attributes = @coin.coin_attributes\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @coin_attributes }\n end\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def index\n @peds = Ped.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peds }\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def index\n @approved_scripts = ApprovedScript.all\n\n respond_to do |format|\n format.html # index.html.html.haml\n format.json { render json: @approved_scripts }\n end\n end", "def index\n unless (logged_in? && authorized?)\n redirect_back_or_default('/')\n return\n end\n @ratings = Rating.find(:all, :conditions => {:pending => true})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ratings }\n end\n end", "def index\n @purchases = Purchase.where(user_id: get_current_user.id.to_i)\n\n render json: @purchases\n end", "def index\n @contributions = Contribution.where(text:\"\").order(points: :desc)\n respond_to do |format|\n format.json { render json: @contributions}\n end\n end", "def index\n @points_histories = PointsHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_histories }\n end\n end", "def index\n @incidents = @quote.incidents.all\n respond_to do |format|\n format.json { render :json => @incidents }\n end\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def index\n @goals = current_user.goals\n end", "def index\n @experiences = Experience.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiences }\n end\n end", "def index\n @disciplines = Discipline.paginate(:page => params[:page], per_page: 30)\n @number = Discipline.count\n respond_to do |format|\n format.html\n format.json { render :json => Discipline.all.to_json(include: :department) }\n end\n end", "def index\n @proposals = listing.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end", "def get_coins\n get(\"/getcoins\")\n end", "def index\n @vacancies = Vacancy.all_vacancies# current_user.vacancies #\n render json: @vacancies\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def show\n render json: @investment, root: false\n end", "def index\n\n @goals = Goal.by_person_as_student(current_user.person)\n @goals = @goals.by_plan(params[:plan_id]) if params[:plan_id].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n p 'show?'\n @acceptances = []\n if(current_user)\n if(params[:id])\n @acceptance = Acceptance.find(params[:id])\n else\n @acceptances = Acceptance.where(\"user_id=? and (status=? or status = ?) and end_time> ?\", current_user.id, \"successfully paid\", \"payment pending\", Time.now())\n end\n end\n p \"acceptances are \"\n \n presenter = Api::V3::AcceptancesPresenter.new\n acceptances_json = @acceptances.map{|x| presenter.as_json(x)}\n p acceptances_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: acceptances_json }\n end\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end", "def show\n @internship = Internship.find(params[:id])\n @diaries = Diary.where(:internship_id => @internship.id).paginate(:page => params[:page]).order('id DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @internship }\n end\n end", "def index\n @goals = Goal.where(user_id:current_user)\n end", "def index\n @pt_accounts = current_user.pt_accounts.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pt_accounts }\n end\n end", "def index\n @expenses = current_user.expenses.date_between(params[:from],params[:to]).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end", "def index\n @incomes = current_company.incomes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @incomes }\n end\n end", "def index\n\n @goals = current_user.goals\n\n end", "def index\n @purchases = purchases.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def index\n render :json => UserInterest.all\n end", "def index\n # TODO: ideally instead of eager loading sells, we could just include\n # quantity_sold in the eager_lod for lots.\n @portfolios = Portfolio.eager_graph(lots: :sells).eager_graph(allocations: {:asset_class => :funds}).all\n\n render json: @portfolios\n end", "def index\n @memberships = Membership.where(user_id: current_user_id).includes(:project)\n project_array = []\n @memberships.each do |membership|\n project_array.push membership.project\n end\n json_response(project_array)\n end", "def show\n @corpus_positive = CorpusPositive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corpus_positive }\n end\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n @preservatives = Preservative.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preservatives }\n end\n end", "def progress\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # progress.html.erb\n format.json { render json: @goal }\n end\n\n private\n\n # Use this method to whitelist the permissible parameters. Example:\n # params.require(:person).permit(:name, :age)\n # Also, you can specialize this method with per-user checking of permissible attributes.\n def permitted_params\n params.require(:goal).permit(:date, :description, :name, :priority, :status)\n end\n \n def allowed_params\n [:date, :description, :name, :priority, :status]\n end\nend", "def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end", "def index\n @purchases = Purchase.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end", "def index\n @approval_processes = ApprovalProcess.find(:all, :conditions => {:client_id => session[:client_id]})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @approval_processes }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end" ]
[ "0.61698145", "0.60967976", "0.6082163", "0.6053662", "0.60219127", "0.60008067", "0.5986967", "0.59649324", "0.5929165", "0.5915321", "0.58977175", "0.58969665", "0.5872008", "0.5845244", "0.58355683", "0.5829753", "0.5821015", "0.5807743", "0.5800085", "0.57996845", "0.57850266", "0.5780116", "0.577781", "0.57694346", "0.5767755", "0.5758007", "0.5755759", "0.5747359", "0.57390684", "0.572028", "0.56915486", "0.5671228", "0.56698537", "0.56566125", "0.5656525", "0.56512713", "0.5644426", "0.5642746", "0.5639573", "0.5630266", "0.56287116", "0.5624079", "0.56223613", "0.56211746", "0.5610857", "0.56095314", "0.55997324", "0.55911624", "0.5577741", "0.55669063", "0.55647695", "0.55607355", "0.5556792", "0.5538572", "0.55359954", "0.5534771", "0.5530979", "0.5525728", "0.5524012", "0.5520118", "0.5513369", "0.55080414", "0.5504193", "0.5501782", "0.54997647", "0.54994255", "0.548504", "0.54806405", "0.547936", "0.5474448", "0.54676336", "0.54664826", "0.54650927", "0.54581374", "0.54552275", "0.54519916", "0.54509574", "0.5450003", "0.54483676", "0.54471713", "0.5445768", "0.5445461", "0.5444362", "0.54407793", "0.5439489", "0.5439302", "0.5436067", "0.5434747", "0.54326993", "0.54318", "0.5429721", "0.5429721", "0.54297155", "0.54255825", "0.5421084", "0.54207766", "0.5420476", "0.54172796", "0.54130024", "0.54130024" ]
0.58157367
17
GET /positives/1 GET /positives/1.json
def show positive = Positive.find(params[:id]) @longlat = positive.lonlat @latlong= positive.lonlat end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "def show\n @possess = Possess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @possess }\n end\n end", "def index\n @points_spents = PointsSpent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_spents }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @points_spent = PointsSpent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @points_spent }\n end\n end", "def show\n goal = Goal.find(params[:id])\n render json: goal,status: :ok\n end", "def index\n @proposals = Proposal.all\n\n render json: @proposals\n end", "def index\n @goals = @user.goals.non_project\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @corpus_positive = CorpusPositive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corpus_positive }\n end\n end", "def index\n @goals = @todo.goals.all\n render json: @goals\n end", "def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end", "def index\n @goals = current_user.goals.where(archived: false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def index\n @votes = @proposal.votes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end", "def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end", "def index\n @coin_attributes = @coin.coin_attributes\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @coin_attributes }\n end\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index\n @positives = Positive.all\n @positives_json= Positive.all.map(&:lonlat).as_json\n\n\n\n\n\n end", "def index\n @parishes = Parish.all\n\n render json: @parishes\n end", "def index\n @approvals = Approval.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @approvals }\n end\n end", "def index\n @goal_rewards = user.goal_rewards\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goal_rewards }\n end\n end", "def show\n @preceed = Preceed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preceed }\n end\n end", "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def show\n @mint_coin = @coin.mint_coins.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mint_coin }\n end\n end", "def show\n @level_goal = LevelGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_goal }\n end\n end", "def show\n @love = Love.find(params[:id])\n render json: @love\n end", "def index\n render json: Loan.all\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def show\n render json: @petty_cash_expense\n end", "def index\n @incomes = Income.all\n\n respond_to do |format|\n format.json { render json: @incomes }\n end\n end", "def progress\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # progress.html.erb\n format.json { render json: @goal }\n end\n\n private\n\n # Use this method to whitelist the permissible parameters. Example:\n # params.require(:person).permit(:name, :age)\n # Also, you can specialize this method with per-user checking of permissible attributes.\n def permitted_params\n params.require(:goal).permit(:date, :description, :name, :priority, :status)\n end\n \n def allowed_params\n [:date, :description, :name, :priority, :status]\n end\nend", "def index\n @travel_requests = TravelRequest.where user_id: current_user.id\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @travel_requests }\n end\n end", "def show\n @todo = Todo.find(params[:id])\n #@todos = Todo.where(:id>=0).order(\"id asc\").page(params[:page]).per(3)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end", "def pending\n @reviews = current_user.written_reviews.pending\n render json: @reviews\n end", "def index\n authorize Donate\n @donates = Donate.order('id DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @donates }\n end\n end", "def show\n @withdrawal = Withdrawal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @withdrawal }\n end\n end", "def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end", "def show\n @v_goal = VGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_goal }\n end\n end", "def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end", "def index\n @goals = Goal.where(client_id: $current_client.id)\n end", "def index\n\n @goals = Goal.by_person_as_student(current_user.person)\n @goals = @goals.by_plan(params[:plan_id]) if params[:plan_id].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @pirate = Pirate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pirate }\n end\n end", "def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def show\n @goal_reward = GoalReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_reward }\n end\n end", "def index\n @investments = Investment.all\n\n render json: {investments: @investments}, root: false\n end", "def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end", "def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end", "def show\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @propose }\n end\n end", "def index\n @contributions = Contribution.where(text:\"\").order(points: :desc)\n respond_to do |format|\n format.json { render json: @contributions}\n end\n end", "def show\n @status_ativ = StatusAtiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ativ }\n end\n end", "def show\n @money = Money.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @money }\n end\n end", "def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end", "def index\n @purchases = purchases.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end", "def index\n @proposals = current_user.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def index\n @investigations = Investigation.where(:visible => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @investigations }\n end\n end", "def index\n @coins = Coin.all\n render \"index.json.jbuilder\"\n end", "def show\n @inspiration = Inspiration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inspiration }\n end\n end", "def show\n @prospective = Prospective.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @prospective }\n end\n end", "def show\n @initiative = Initiative.find(params[:id])\n\n respond_to do |format|\n format.html # _show.html.erb\n format.json { render json: @initiative }\n end\n end", "def index_single_gift\n render json: @gift, include: :ages, status: :ok\n end", "def show\n render json: @investment, root: false\n end", "def index\n @points_histories = PointsHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_histories }\n end\n end", "def show\n @addimition = Addimition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @addimition }\n end\n end", "def index\n @circle = current_user.circle\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @circle }\n end\n end", "def show\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opinion }\n end\n end", "def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def index\n @trades = Trade\n .only(:created_at, :is_fair, :ash_pokemons, :brock_pokemons)\n respond_to do |format|\n format.json { render json: @trades }\n end\n end", "def index\n @applicants = Applicant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicants }\n end\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def show\n travels = Travel.find(params[:id])\n render json: travels, status: :ok\n end", "def show\n @goal = @user.goals.find(params[:id])\n\n @tracked_activities = @goal.tracked_activities\n @untracked_activities = @goal.untracked_activities\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pledge }\n end\n end", "def show\n @income = Income.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @income }\n end\n end", "def index\n @proposals = listing.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end", "def get_coins\n get(\"/getcoins\")\n end", "def new\n @possess = Possess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @possess }\n end\n end", "def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def index\n @peds = Ped.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peds }\n end\n end", "def index\n @purchases = Purchase.where(user_id: get_current_user.id.to_i)\n\n render json: @purchases\n end", "def show\n @internship = Internship.find(params[:id])\n @diaries = Diary.where(:internship_id => @internship.id).paginate(:page => params[:page]).order('id DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @internship }\n end\n end", "def index\n @resources = Resource.where(\"is_approved = true\")\n render json: @resources, status: 200\n end", "def show\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end", "def show\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end" ]
[ "0.60460806", "0.6027194", "0.59960485", "0.5854903", "0.5793259", "0.5793259", "0.5793259", "0.5793259", "0.57712674", "0.57702506", "0.5767592", "0.5766159", "0.57611954", "0.575028", "0.5738527", "0.57329327", "0.57209355", "0.5709881", "0.569061", "0.56850094", "0.5677817", "0.5669175", "0.5664998", "0.565182", "0.5634862", "0.5622778", "0.56193006", "0.5617517", "0.5615862", "0.5611795", "0.560574", "0.5605045", "0.55952424", "0.5574663", "0.55717254", "0.55590636", "0.5551988", "0.55518216", "0.55487823", "0.5536335", "0.5516883", "0.5512496", "0.5504375", "0.54950756", "0.54934466", "0.5492047", "0.5491156", "0.5490858", "0.54894453", "0.54883444", "0.5487513", "0.5485233", "0.54809165", "0.5477158", "0.5476068", "0.54729843", "0.546787", "0.54575187", "0.5452939", "0.5450103", "0.5443884", "0.5442685", "0.5441081", "0.5439209", "0.5430847", "0.54296446", "0.5427301", "0.54271823", "0.5425305", "0.5422918", "0.54191864", "0.5413975", "0.541157", "0.54106945", "0.54074496", "0.54072315", "0.5393413", "0.53928417", "0.5392566", "0.5392034", "0.538827", "0.53879756", "0.53831244", "0.53830624", "0.5381659", "0.53797567", "0.53790873", "0.537861", "0.5376716", "0.53724074", "0.53722835", "0.5367628", "0.5367456", "0.5366783", "0.53653497", "0.53627384", "0.5361161", "0.5357887", "0.5353898", "0.5353247", "0.5353247" ]
0.0
-1
POST /positives POST /positives.json
def create @positive = Positive.new(positive_params) respond_to do |format| if @positive.save format.html { redirect_to @positive, notice: 'Positive was successfully created.' } format.json { render :show, status: :created, location: @positive } else format.html { render :new } format.json { render json: @positive.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n points = params[:solution][:points_earned]\n unless current_user.posse.current_solution?\n solution = current_user.posse.solutions.create(solution_params)\n current_user.posse.add_points(points.to_i)\n end\n render json: solution\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end", "def create\n @possess = Possess.new(params[:possess])\n\n respond_to do |format|\n if @possess.save\n format.html { redirect_to @possess, notice: 'Possess was successfully created.' }\n format.json { render json: @possess, status: :created, location: @possess }\n else\n format.html { render action: \"new\" }\n format.json { render json: @possess.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trip = Trip.new(trip_params)\n authorize @trip\n @trip.submitter = current_account.accountable\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to home_index_path, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deposit = Deposit.new(deposit_params)\n @deposit.user_id = current_user.id\n @account = Account.find(@deposit.account_id)\n\n respond_to do |format|\n if @deposit.deposit\n format.html { redirect_to account_path(@deposit.account_id), notice: 'Deposit was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @deposit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @fixed_deposit_investment = FixedDepositInvestment.new(fixed_deposit_investment_params)\r\n\r\n respond_to do |format|\r\n if @fixed_deposit_investment.save\r\n format.html { redirect_to @fixed_deposit_investment, notice: 'Fixed deposit investment was successfully created.' }\r\n format.json { render :show, status: :created, location: @fixed_deposit_investment }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @fixed_deposit_investment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @goal = Goal.new :name => params[:name], :user => current_user, :position => params[:position], :archived => params[:archived]\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @points_transaction = PointsTransaction.new(points_transaction_params)\n\n respond_to do |format|\n if @points_transaction.save\n format.html { redirect_to @points_transaction, notice: 'Points transaction was successfully created.' }\n format.json { render :show, status: :created, location: @points_transaction }\n else\n format.html { render :new }\n format.json { render json: @points_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense, status: :created, location: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def create\r\n @deposit = Deposit.new(deposit_params) \r\n if @deposit.nil? || @deposit.amount < 0\r\n flash[:danger] = \"No Deposit request passed to controller\"\r\n\t redirect_to :back\r\n\t return\r\n else\r\n Deposit.request(@user, User.find(1))\r\n end\r\n \r\n if @deposit.amount.nil?\r\n flash[:danger] = \"Invalid Deposit: No Amount\"\r\n redirect_to \"/deposits/new\"\r\n return\r\n end\r\n \r\n respond_to do |format|\r\n if @deposit.save\r\n format.html { redirect_to @deposit, notice: 'Your request has been sent. Pending Approval from the admin.' }\r\n format.json { render :show, status: :created, location: @deposit }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @deposit.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n #When creating a new mission, current point should default to zero\n @mission = Mission.new()\n # @mission = Mission.new({\"name\" => params[:name], \"goal_points\" => params[:goal_points].to_i, \"current_points\" => 0, \"image\" => params[:image]})\n @mission.name = params[:name]\n @mission.goal_points = params[:goal_points].to_i\n @mission.current_points = 0\n @mission.image = params[:image]\n \n \n if @mission.valid? \n @mission.save!\n respond_to do |format|\n format.json { render json: @mission }\n format.xml { render xml: @mission }\n end\n else\n respond_to do |format|\n #format.json { render action: 'index' }\n format.json { render json: @mission.errors,status: :unprocessable_entity }\n \n end\n end\n end", "def create\n @pedagogy_innovation = @_current_user.pedagogy_innovations.new(pedagogy_innovation_params)\n\n respond_to do |format|\n if not @pedagogy_innovation.save\n format.html { redirect_to @pedagogy_innovation, notice: 'Pedagogy innovation was successfully created.' }\n format.json { render :show, status: :created, location: @pedagogy_innovation }\n else\n format.html { render :new }\n format.json { render json: @pedagogy_innovation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts \"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\"\n @investment = Investment.new(amount:params[:amount])\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n @post.user_id = current_user.id\n \n respond_to do |format|\n if @post.save\n current_user.update(point: current_user.point + 1)\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n \n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end", "def create\n @investment = Investment.new(investment_params)\n\n if @investment.save\n render json: @investment, status: :created\n else\n render json: @investment.errors, status: :unprocessable_entity\n end\n end", "def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end", "def create\n @preceed = Preceed.new(params[:preceed])\n\n respond_to do |format|\n if @preceed.save\n format.html { redirect_to @preceed, notice: 'Preceed was successfully created.' }\n format.json { render json: @preceed, status: :created, location: @preceed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preceed.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @point = Point.new(point_params)\n @point.goal_id = @goal.id\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to :goals, notice: 'Your progress has been updated!' }\n @goal.current_quantity += @point.quantity\n @goal.save!\n format.json { render action: 'show', status: :created, location: @point }\n else\n format.html { redirect_to goals_path, alert: 'Your progress could not be updated because your quantity was not a valid number. \n Please try again.' }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sentiment = Sentiment.new(sentiment_params)\n\n respond_to do |format|\n if @sentiment.save\n format.html { redirect_to @sentiment, notice: 'Sentiment was successfully created.' }\n format.json { render :show, status: :created, location: @sentiment }\n else\n format.html { render :new }\n format.json { render json: @sentiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_solo\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'new' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def create\n @petty_cash_expense = PettyCashExpense.new(petty_cash_expense_params)\n\n respond_to do |format|\n if @petty_cash_expense.save\n format.json { render :show, status: :created, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @puntuation = Puntuation.new(puntuation_params)\n\n respond_to do |format|\n if @puntuation.save\n @voted_contribution = Contribution.find(@puntuation.contribution_id)\n @voted_contribution.increment!(:puntuation, 1)\n format.html { redirect_to :back }\n format.json { render :show, status: :created, location: @puntuation }\n else\n format.html { render :new }\n format.json { render json: @puntuation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @investigated = Investigated.new(investigated_params)\n\n respond_to do |format|\n if @investigated.save\n format.html { redirect_to @investigated, notice: 'Investigated was successfully created.' }\n format.json { render :show, status: :created, location: @investigated }\n else\n format.html { render :new }\n format.json { render json: @investigated.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_mentorship_interest = Api::V1::MentorshipInterest.new(api_v1_mentorship_interest_params)\n\n respond_to do |format|\n if @api_v1_mentorship_interest.save\n format.html { redirect_to @api_v1_mentorship_interest, notice: 'Mentorship interest was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_mentorship_interest }\n else\n format.html { render :new }\n format.json { render json: @api_v1_mentorship_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p = Prospectus.where(company_id: params[:company_id]).first\n do_mission = DoMission.create(prospectus_id: p.id, operator_id: current_user.id, status: 1, expired_at: Time.now + 10.days)\n render json: retval_wrapper({id: do_mission.id.to_s}) and return\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @goals = goals_for_current_user\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to({action: 'index'}, notice: 'Goal was successfully created.') }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'index' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plannedtransaction = Plannedtransaction.new(plannedtransaction_params)\n\n respond_to do |format|\n if @plannedtransaction.save\n format.html { redirect_to plannedtransactions_url, notice: 'Planned Transaction was successfully created.' }\n format.json { redirect_to plannedtransactions_url, status: :created, location: @plannedtransaction }\n else\n format.html { render :new }\n format.json { render json: @plannedtransaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n ActiveRecord::Base.transaction do\n @investigacion = Investigacion.new(investigacion_params)\n\n respond_to do |format|\n if @investigacion.save\n format.html { redirect_to @investigacion, notice: 'La Investigacion se cre&oacute; exitosamente.' }\n format.json { render :show, status: :created, location: @investigacion }\n else\n format.html { render :new }\n format.json { render json: @investigacion.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n authorize! :create, :repost\n @fun.repost_by current_user\n Stat.recount @fun.user, :reposts\n render json: { success: true }\n end", "def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.client_id = params[:client_id]\n @goal.status = 'active'\n\n if @goal.save\n flash[:message] = \"Goal saved\"\n render json: @goal.to_json\n else\n end\n end", "def create\n @atividade = Atividade.new(atividade_params)\n\n respond_to do |format|\n if @atividade.save\n format.html { redirect_to @atividade, notice: 'Atividade was successfully created.' }\n format.json { render :show, status: :created, location: @atividade }\n else\n format.html { render :new }\n format.json { render json: @atividade.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = current_user.goals.build(goal_params)\n\n # iterate throught dates\n puts goal_params[:start_date]\n puts goal_params[:duration]\n\n if goal_params[:start_date] != \"\" && goal_params[:duration] != \"\"\n start_date = Date.parse(goal_params[:start_date])\n end_date = start_date + goal_params[:duration].to_i - 1\n\n start_date.upto(end_date) do |date|\n @goal.activities.build({done: false, due_date: date})\n end\n end\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_path, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def deposit_params\n params.require(:deposit).permit(:duration_months, :interest, :amount)\n end", "def create\n @expense = Expense.create(expense_params)\n @expense.user_id = current_user.id\n @expense.save!\n respond_with @expense, status: 201\n end", "def goal_params\n params.require(:goal).permit(:user_id, :name, :description, :amount, :posted, :public, :deleted)\n end", "def create\n @project_interest_point = ProjectInterestPoint.new(project_interest_point_params)\n\n respond_to do |format|\n if @project_interest_point.save\n format.html { redirect_to @project_interest_point, notice: 'Project interest point was successfully created.' }\n format.json { render :show, status: :created, location: @project_interest_point }\n else\n format.html { render :new }\n format.json { render json: @project_interest_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deposit = Deposit.new(params[:deposit])\n @deposit.user = current_user\n\n respond_to do |format|\n if @deposit.save\n flash[:notice] = 'Deposit was successfully created.'\n format.html { redirect_to(@deposit) }\n format.xml { render :xml => @deposit, :status => :created, :location => @deposit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deposit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def deposit_params\r\n params.require(:deposit).permit(:user_id, :date, :amount)\r\n end", "def create\n @spent = Spent.new(spent_params)\n\n respond_to do |format|\n if @spent.save\n format.html { redirect_to @spent, notice: 'Spent was successfully created.' }\n format.json { render :show, status: :created, location: @spent }\n else\n format.html { render :new }\n format.json { render json: @spent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n monthly_slip(params)\n # secure valid input\n return render json: { msg: \"input valid number\" } unless @annual_salary > 0\n @timestamp = DateTime.now\n slip = Slip.new({\n \"time_stamp\" => @timestamp,\n \"annual_salary\" => @annual_salary,\n \"employee_name\" => @employee_name,\n \"monthly_income_tax\" => @monthly_income_tax,\n })\n if slip.save\n render json: { status: \"SUCCESS\", message: \"Saved Infotmation\", data: slip }, status: :ok\n else\n render json: { status: \"ERROR\", message: \"Information not saved\", data: slip.errors }, status: :unprocessable_entity\n end\n end", "def create\n @ponto = Ponto.new(ponto_params)\n @ponto.user = current_user\n\n respond_to do |format|\n if @ponto.save\n format.html { redirect_to @ponto, notice: 'Ponto was successfully created.' }\n format.json { render :show, status: :created, location: @ponto }\n else\n format.html { render :new }\n format.json { render json: @ponto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user_id = current_user.id\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @travel_amount = TravelAmount.new(travel_amount_params)\n\n respond_to do |format|\n if @travel_amount.save\n format.html { redirect_to @travel_amount, notice: 'Travel amount was successfully created.' }\n format.json { render :show, status: :created, location: @travel_amount }\n else\n format.html { render :new }\n format.json { render json: @travel_amount.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user = current_user\n @goals = current_user.goals\n respond_to do |format|\n if @goal.save\n format.html { redirect_to home_index_path, notice: 'Goal was successfully created.' }\n # format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new, notice: \"There was an error updating your goal.\" }\n # format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user_id=current_user.id\n \n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def goals_add\n @goal = Goal.create(goal_params)\n goal = GoalsUser.create({user_id:@user.id,goal_id:@goal.id})\n respond_to do |f|\n f.html {redirect_to goals_path(@user)}\n f.json {render json: {new_goal:goal,success: true}}\n end\n end", "def create\n @pago = Pago.new(params[:pago])\n\n respond_to do |format|\n if @pago.save\n format.html { render :text => @pago.attributes.merge( :saldo => @pago.saldo ).to_json }\n format.xml { render :xml => @pago, :status => :created, :location => @pago }\n else\n format.html { render :action => \"new\", :status => :unprocessable_entity }\n format.xml { render :xml => @pago.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n rental = sporting_goods.rentals.new(rental_params)\n rental.user_id = current_user.id\n if rental.save\n render json: rental, status: 200\n else\n render json: rental, status: 400\n end\n end", "def create\n @paid = Paid.new(paid_params)\n\n respond_to do |format|\n if @paid.save\n format.html { redirect_to @paid, notice: 'Paid was successfully created.' }\n format.json { render :show, status: :created, location: @paid }\n else\n format.html { render :new }\n format.json { render json: @paid.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tuser = User.find_by(id: expense_params['user_id'])\n\t\tdebt = Debt.find_by(id: expense_params['debt_id'])\n\t\texpense = user.expenses.build(expense_params)\n\t\tif expense.save \n\t\t\tif debt\n\t\t\t\tdebt.expenses << expense\n\t\t\tend\n\t\t\trender json: user\n\t\telse\n\t\t\trender json: expense.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def create\n @deposito = Deposito.new(deposito_params)\n\n respond_to do |format|\n if @deposito.save\n format.html { redirect_to @deposito, notice: 'Deposito guardado correctamente.' }\n format.json { render :show, status: :created, location: @deposito }\n else\n format.html { render :new }\n format.json { render json: @deposito.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end", "def create\n\n \t\t\t@penalty = Penalty.new penalty_params\n\n \t\t\tif @penalty.save\n\n \t\t\t\trender json: @penalty,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @penalty.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend", "def create\n @debate = Debate.new\n @debate.title = params[:title]\n @debate.image = params[:image]\n @debate.content = params[:content]\n @debate.user_id = current_user.id\n\n respond_to do |format|\n if @debate.save\n if params[:points]\n params[:points].each do |p|\n Point.create(user_id: current_user.id, debate_id: @debate.id, title: p)\n end\n end\n format.html { redirect_to @debate, notice: 'Debate was successfully created.' }\n format.json { render :show, status: :created, location: @debate }\n else\n format.html { render :new }\n format.json { render json: @debate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pr_committee = PrCommittee.new(pr_committee_params)\n respond_to do |format|\n if @pr_committee.save\n format.html { redirect_to @pr_committee.petition, notice: 'Petition Review committee was successfully created.' }\n format.json { render :show, status: :created, location: @pr_committee }\n else\n format.html { render :new }\n format.json { render json: @pr_committee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @itinerary = Itinerary.find(params[:itinerary_id])\n @transaction = @itinerary.transactions.build\n authorize! :create, @transaction\n\n @unpaid_line_items = @itinerary.line_items.where(paid: false)\n @transaction.line_items = @unpaid_line_items\n @transaction.tax = @transaction.pre_tax_total * selected_conference.tax_rate\n @transaction.payment_method = params[:payment_method]\n\n if @transaction.save\n redirect_to itinerary_transaction_path(@itinerary, @transaction)\n else\n #TODO there isn't any user input that could cause this action to fail, so probably apologize and send the developer an email..\n end\n end", "def create\n @pointless = Pointless.new(pointless_params)\n @pointless.user_id = current_user.id\n @pointless.user_name = current_user.name\n @pointless.hit = 0\n @pointless.like = 0\n @pointless.dislike = 0\n respond_to do |format|\n if @pointless.save\n format.html { redirect_to @pointless, notice: 'Pointless was successfully created.' }\n format.json { render :show, status: :created, location: @pointless }\n else\n format.html { render :new }\n format.json { render json: @pointless.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @investigation = Investigation.new(params[:investigation])\n @investigation.visible = true\n if Investigation.last.blank?\n @investigation.id=1\n else\n @investigation.id = Investigation.last.id+1\n end\n\n respond_to do |format|\n if @investigation.save\n format.html { redirect_to @investigation, notice: 'Investigation was successfully created.' }\n format.json { render json: @investigation, status: :created, location: @investigation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investigation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @investable = Investable.new(investable_params)\n\n respond_to do |format|\n if @investable.save\n format.html { redirect_to @investable, notice: 'Investable was successfully created.' }\n format.json { render action: 'show', status: :created, location: @investable }\n else\n format.html { render action: 'new' }\n format.json { render json: @investable.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.goal_data(goal_params, current_user.id)\n\t@goal.update(goal_params)\n redirect_to @goal, notice: 'Goal was successfully updated.'\n end", "def create\n @pain_amount = PainAmount.new(pain_amount_params)\n\n respond_to do |format|\n if @pain_amount.save\n format.html { redirect_to @pain_amount, notice: 'Pain amount was successfully created.' }\n format.json { render :show, status: :created, location: @pain_amount }\n else\n format.html { render :new }\n format.json { render json: @pain_amount.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @possess = Possess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @possess }\n end\n end", "def create\n \n @investigation = Investigation.new(investigation_params)\n\n respond_to do |format|\n if @investigation.save\n format.html { redirect_to @investigation, notice: 'Investigation was successfully created.' }\n format.json { render :show, status: :created, location: @investigation }\n else\n format.html { render :new }\n format.json { render json: @investigation.errors, status: :unprocessable_entity }\n end\n end\n end", "def vacancy_params\n params.require(:vacancy).permit(:title, :description, :wage, :position, skill_ids: [])\n end", "def progress\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # progress.html.erb\n format.json { render json: @goal }\n end\n\n private\n\n # Use this method to whitelist the permissible parameters. Example:\n # params.require(:person).permit(:name, :age)\n # Also, you can specialize this method with per-user checking of permissible attributes.\n def permitted_params\n params.require(:goal).permit(:date, :description, :name, :priority, :status)\n end\n \n def allowed_params\n [:date, :description, :name, :priority, :status]\n end\nend", "def create\n @post = Post.new(post_params)\n @post.approved = false # double check this\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to root_url, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\treview = Review.create(:user_id=>params[:review][:user_id], :note_id=>params[:review][:note_id], :status=>params[:review][:status])\n\t\treview.save!\n\n render json: []\n\tend", "def create\n amended_deposit_params = deposit_params\n amended_deposit_params['user_id'] = current_user.id \n puts \"amen dep param is \"\n puts amended_deposit_params\n @deposit = Deposit.new(amended_deposit_params)\n #current_user.balance = deposit_params[\"amount\"].to_d + current_user.balance\n #current_user.save\n respond_to do |format|\n if @deposit.save\n format.html { redirect_to @deposit, notice: \"Deposit was successfully created.\" }\n format.json { render :show, status: :created, location: @deposit }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @deposit.errors, status: :unprocessable_entity }\n end\n end\n end", "def pending\n @reviews = current_user.written_reviews.pending\n render json: @reviews\n end", "def create\n @trip = Trip.new(user_id: current_user.id)\n @trip.start_point = Station.find_by(uid: params[:station_id])\n #Defined current user and updated credits. This change may cause issues.\n @current_user = current_user\n @current_user.credits = (@current_user.credits - 1)\n\n if @trip.save\n @current_user.save\n #This is where the change ends\n render json: @trip.attributes.merge(station: @trip.start_point.attributes), status: :created, location: @trip\n else\n render json: @trip.errors, status: :unprocessable_entity\n end\n end", "def create\n @teleport_incense = TeleportIncense.new(teleport_incense_params)\n\n respond_to do |format|\n if @teleport_incense.save\n format.html { redirect_to @teleport_incense, notice: 'Teleport incense was successfully created.' }\n format.json { render :show, status: :created, location: @teleport_incense }\n else\n format.html { render :new }\n format.json { render json: @teleport_incense.errors, status: :unprocessable_entity }\n end\n end\n end", "def deposit_params\n params.require(:deposit).permit(:amount, :user_id)\n end", "def create\n @payout = Payout.new(price: current_user.credit, user_id: current_user.id)\n ti_ids = TaskInstance.where('status = ? AND user_id = ?', :finished, current_user.id).select(:id)\n ti_ids.each do |ti|\n ti.update(status: :paid)\n end\n @payout.task_instances = ti_ids\n\n respond_to do |format|\n if @payout.save\n current_user.update(credit: 0)\n format.html { redirect_to @payout, notice: 'Payout was successfully created.' }\n format.json { render action: 'show', status: :created, location: @payout }\n else\n format.html { render action: 'new' }\n format.json { render json: @payout.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pirate = Pirate.new(params[:pirate])\n\n respond_to do |format|\n if @pirate.save\n format.html { redirect_to @pirate, notice: 'Pirate was successfully created.' }\n format.json { render json: @pirate, status: :created, location: @pirate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pirate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @movimentacao = Movimentacao.new(movimentacao_params)\n\n respond_to do |format|\n if @movimentacao.save\n format.html { redirect_to @movimentacao, notice: 'Movimentacao was successfully created.' }\n format.json { render :show, status: :created, location: @movimentacao }\n else\n format.html { render :new }\n format.json { render json: @movimentacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Copy this method for creating other, user specific things.\n @goal = current_user.goals.new(goal_params)\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n\n if Pricing.varient_split_add params\n #audit(@pricing, current_user)\n render json: @pricing, status: :created\n else\n render json: @pricing.errors, status: :unprocessable_entity\n end\n end", "def create\n @goal = current_user.goals.new(goal_params)\n\n if @goal.save\n flash[\"notice\"] = 'Goal was successfully created.'\n end\n\n respond_with @goal, location: [current_user, :goals]\n end", "def create\n @actividad = Actividad.new(params[:actividad])\n respond_to do |format|\n if @actividad.save \n @actividad.visitadors.each do |v|\n pu = PuntuacionesActividad.new(:actividad_id => @actividad.id, :visitador_id => v.id, :puntuacion => @actividad.puntuacion)\n pu.save\n end\n format.html { redirect_to @actividad, notice: 'Actividad was successfully created.' }\n format.json { render json: @actividad, status: :created, location: @actividad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @actividad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @investigador = Investigador.new(investigador_params)\n\n respond_to do |format|\n if @investigador.save\n format.html { redirect_to investigadore_path(@investigador), notice: \"Investigador was successfully created.\" }\n format.json { render :show, status: :created, location: @investigador }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @investigador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params.has_key?(:unbound_contributions)\n user = User.find_by(id: params[:user_id])\n ride = Ride.find_by(id: params[:ride_id])\n price = ride[:price]\n distance = user.rides.find_by(id: params[:ride_id])[:realtime_km]\n project_id = ride.project[:id]\n\n contribution_amount = price*distance\n user.update_attribute(:unbound_contributions, contribution_amount)\n user.contributions.update_attributes(amount: contribution_amount, project_id: project_id)\n user.rides.find_by(id: ride.id).update_attribute(:is_paid, true)\n render json: {:status => 200}\n else\n ride = Ride.find_by(id: params[:ride_id])\n new_ride = ride.requests.create!(passenger_id: params[:user_id], requested_from: params[:requested_from],\n request_to: params[:requested_to])\n unless new_ride.nil?\n respond_with ride: new_ride, anfrage: true, status: :created\n else\n respond_with ride: new_ride, anfrage: false, status: :bad_request\n end\n end\n end", "def create\n @solideo_depense = SolideoDepense.new(solideo_depense_params)\n\n respond_to do |format|\n if @solideo_depense.save\n format.html { redirect_to solideo_depenses_path, notice: 'Solideo depense was successfully created.' }\n format.json { render :show, status: :created, location: @solideo_depense }\n else\n format.html { render :new }\n format.json { render json: @solideo_depense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @poset = Poset.new(poset_params)\n\n respond_to do |format|\n if @poset.save\n format.html { redirect_to @poset, notice: 'Poset was successfully created.' }\n format.json { render :show, status: :created, location: @poset }\n else\n format.html { render :new }\n format.json { render json: @poset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page_trail = PageTrail.new(page_trail_params)\n\n respond_to do |format|\n if @page_trail.save\n format.html { redirect_to @page_trail, notice: 'Page trail was successfully created.' }\n format.json { render :show, status: :created, location: @page_trail }\n else\n format.html { render :new }\n format.json { render json: @page_trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_url, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @status_ativ = StatusAtiv.new(params[:status_ativ])\n\n respond_to do |format|\n if @status_ativ.save\n format.html { redirect_to @status_ativ, notice: 'Status ativ was successfully created.' }\n format.json { render json: @status_ativ, status: :created, location: @status_ativ }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_ativ.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @additive = Additive.new(additive_params)\n\n respond_to do |format|\n if @additive.save\n format.html { redirect_to @additive, success: 'Additive was successfully created.' }\n format.json { render :show, status: :created, location: @additive }\n else\n format.html { render :new }\n format.json { render json: @additive.errors, status: :unprocessable_entity }\n end\n end\n end", "def transaction_params\n params.require(:transaction).permit(:description, :total, :points_awarded)\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def create\n @inspiration = Inspiration.new(params[:inspiration])\n @project = Project.find(@inspiration.project_id)\n respond_to do |format|\n if @inspiration.save\n format.html { redirect_to @project, notice: 'Inspiration was successfully created.' }\n format.json { render json: @inspiration, status: :created, inspiration: @inspiration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @corpus_positive = CorpusPositive.new(params[:corpus_positive])\n\n respond_to do |format|\n if @corpus_positive.save\n format.html { redirect_to @corpus_positive, notice: 'Corpus positive was successfully created.' }\n format.json { render json: @corpus_positive, status: :created, location: @corpus_positive }\n else\n format.html { render action: \"new\" }\n format.json { render json: @corpus_positive.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end", "def create\n @proposal = Proposal.new(proposal_params)\n authorize! :create, @proposal\n\n respond_to do |format|\n if @proposal.save\n format.html { redirect_to creer_propositions_entity_path(@proposal.entity), notice: 'La proposition a été créée avec succès.' }\n format.json { render action: 'show', status: :created, location: @proposal }\n else\n format.html { render action: 'new' }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.61339045", "0.5962907", "0.5962644", "0.5764218", "0.5667303", "0.5657126", "0.5639613", "0.5634564", "0.56339425", "0.5619743", "0.5619299", "0.56070226", "0.5596418", "0.5580475", "0.55664915", "0.5560917", "0.55590403", "0.55496585", "0.55360365", "0.5525691", "0.55252606", "0.5525164", "0.5515761", "0.55136293", "0.55130553", "0.5497646", "0.54927737", "0.5484269", "0.54772884", "0.5473256", "0.54699737", "0.54692435", "0.5466473", "0.5464297", "0.54625815", "0.54533905", "0.54527974", "0.5439859", "0.5423928", "0.54177445", "0.5416309", "0.5414422", "0.5401093", "0.54005915", "0.53986096", "0.53974307", "0.53870684", "0.5382398", "0.53760725", "0.53562915", "0.5354259", "0.5352483", "0.53507036", "0.5350457", "0.53462183", "0.5329868", "0.5328873", "0.532473", "0.5318376", "0.5317886", "0.5315681", "0.5313265", "0.5313246", "0.53104424", "0.53069687", "0.5303109", "0.52962655", "0.52952194", "0.529315", "0.5289584", "0.52893674", "0.52893007", "0.52893007", "0.52887064", "0.52867466", "0.5286108", "0.5283162", "0.52804905", "0.5278165", "0.5277186", "0.5273115", "0.5261123", "0.5258428", "0.52520293", "0.52474725", "0.52370805", "0.5237028", "0.52364767", "0.52355516", "0.5233528", "0.5230906", "0.52306443", "0.52245617", "0.5222336", "0.52179945", "0.5214835", "0.52147835", "0.52144045", "0.5212651", "0.52099216" ]
0.62360406
0
PATCH/PUT /positives/1 PATCH/PUT /positives/1.json
def update respond_to do |format| if @positive.update(positive_params) format.html { redirect_to @positive, notice: 'Positive was successfully updated.' } format.json { render :show, status: :ok, location: @positive } else format.html { render :edit } format.json { render json: @positive.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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!(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 patch!\n request! :patch\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @preceed = Preceed.find(params[:id])\n\n respond_to do |format|\n if @preceed.update_attributes(params[:preceed])\n format.html { redirect_to @preceed, notice: 'Preceed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preceed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end", "def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(update_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_pet.update(line_pet_params)\n format.html { redirect_to @line_pet, notice: 'Line pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @my_prayer_request.update_attributes(params[:my_prayer_request])\n format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pet_true.update(pet_true_params)\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Orçamento instantâneo atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n respond_to do |format|\n if @pointless.update(pointless_params)\n format.html { redirect_to @pointless, notice: 'Pointless was successfully updated.' }\n format.json { render :show, status: :ok, location: @pointless }\n else\n format.html { render :edit }\n format.json { render json: @pointless.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(path)\n output { patch(path, params) }\n end", "def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end", "def update\n @points_spent = PointsSpent.find(params[:id])\n\n respond_to do |format|\n if @points_spent.update_attributes(params[:points_spent])\n format.html { redirect_to @points_spent, notice: 'Points spent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @points_spent.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(Interest, params[:id], interest_params)\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def update\n @api_v1_post_vote = PostVote.find(params[:id])\n\n respond_to do |format|\n if @api_v1_post_vote.update_attributes(params[:api_v1_post_vote])\n format.html { redirect_to @api_v1_post_vote, notice: 'Post vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n @possess = Possess.find(params[:id])\n\n respond_to do |format|\n if @possess.update_attributes(params[:possess])\n format.html { redirect_to @possess, notice: 'Possess was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @possess.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proposal.update(proposal_params)\n format.html { redirect_to :back, notice: 'La proposition a été modifiée.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n if @goody.update_attributes(params[:goody])\n format.html { redirect_to @goody, notice: 'Goody was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def update\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n if @propose.update_attributes(params[:propose])\n format.html { redirect_to @propose, notice: 'Propuesta actualizada' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @propose.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @prayer_request.update_attributes(params[:prayer_request])\n format.html { redirect_to @prayer_request, notice: 'Prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t\t@interested = Interested.find(params[:id])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.update_attributes(params[:interested])\n \t\t\tformat.html { redirect_to @interested, notice: 'Interested was sucessfully updated.' }\n \t\t\tformat.json {head :no_content }\n \t\t\telse\n \t\t\t\tformat.html { render action: \"edit\" }\n \t\t\t\tformat.json { render json: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @proposal = listing.proposals.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @po = Po.find(params[:id])\n\n respond_to do |format|\n if @po.update_attributes(params[:po])\n format.html { redirect_to @po, notice: 'Po was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @po.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @anything.update(anything_params)\n format.html { redirect_to @anything, notice: 'Anything was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @anything.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pax.update(pax_params)\n format.html { redirect_to @pax, notice: 'Pax was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pax.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end", "def update\n # if @bonus.update(bonus_params)\n # render :show, status: :ok, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end", "def update\n @request = @skill.requests.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to myrequests_path, notice: 'request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pizzatopping.update(pizzatopping_params)\n format.html { redirect_to @pizzatopping, notice: 'Pizzatopping was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pizzatopping.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pick.update_attributes(picks_params)\n format.html { redirect_to games_path, notice: 'Pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pick.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n respond_to do |format|\n if @additive.update(additive_params)\n format.html { redirect_to @additive, success: 'Additive was successfully updated.' }\n format.json { render :show, status: :ok, location: @additive }\n else\n format.html { render :edit }\n format.json { render json: @additive.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo.update(todo_params)\n respond_with(@user, @todo)\n end", "def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to root_path, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end" ]
[ "0.6472094", "0.6395662", "0.63436735", "0.6304185", "0.6289524", "0.6208121", "0.61920184", "0.6176594", "0.6126691", "0.6112557", "0.6079626", "0.6057717", "0.6056401", "0.6056401", "0.6046886", "0.6027701", "0.6007427", "0.60069764", "0.59972394", "0.598905", "0.59439665", "0.59438163", "0.59381586", "0.5931284", "0.59276754", "0.5927256", "0.5924693", "0.5914121", "0.5913005", "0.59095067", "0.5909158", "0.58984995", "0.5891451", "0.5891451", "0.5891094", "0.5887292", "0.5886359", "0.58861095", "0.58850604", "0.58832586", "0.58832586", "0.58803797", "0.58720267", "0.58691", "0.5866079", "0.58647376", "0.5861412", "0.58547187", "0.5854199", "0.5849369", "0.5843282", "0.58402544", "0.58294487", "0.5829267", "0.5826116", "0.58248764", "0.5821079", "0.58147776", "0.5811144", "0.5809904", "0.58086663", "0.5804473", "0.5802539", "0.5802432", "0.5802138", "0.5799145", "0.57991236", "0.5798608", "0.57982886", "0.579537", "0.5785298", "0.5783115", "0.5777244", "0.5776627", "0.5776076", "0.57728434", "0.5772256", "0.5772098", "0.57629055", "0.5761805", "0.57611674", "0.5750186", "0.5741511", "0.57394123", "0.57321185", "0.57215136", "0.57169384", "0.5712205", "0.57103544", "0.57083267", "0.570824", "0.5703368", "0.5697257", "0.5694177", "0.56933", "0.5691647", "0.56901544", "0.5688519", "0.56878173", "0.5684093" ]
0.6262073
5
DELETE /positives/1 DELETE /positives/1.json
def destroy @positive.destroy respond_to do |format| format.html { redirect_to positives_url, notice: 'Positive was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete(*rest) end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete\n request(:delete)\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete!\n request! :delete\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete\n \n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def delete\n \n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n @addimition = Addimition.find(params[:id])\n @addimition.destroy\n\n respond_to do |format|\n format.html { redirect_to addimitions_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\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(*args)\n request(:delete, *args)\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def delete\n\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def delete(path)\n request(:delete, path)\n end", "def delete\n api(\"Delete\")\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete\n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @corpus_positive = CorpusPositive.find(params[:id])\n @corpus_positive.destroy\n\n respond_to do |format|\n format.html { redirect_to corpus_positives_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete(path, params)\n request(:delete, path, {})\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: \"Deposit was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_pet.destroy\n respond_to do |format|\n format.html { redirect_to line_pets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: 'Deposit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!(*rest) end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :ok }\n end\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def destroy\n @withdrawal = Withdrawal.find(params[:id])\n @withdrawal.destroy\n\n respond_to do |format|\n format.html { redirect_to withdrawals_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @deposit.destroy\r\n respond_to do |format|\r\n format.html { redirect_to deposits_url, notice: 'Deposit was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def delete\n @delete ||= Verb.new do |verb|\n verb.entity :trip, :air, :lodging, :car, :profile, :rail, \\\n :transport, :cruise, :restaurant, :activity, :note, :map, \\\n :directions \\\n do |entity, id|\n do_request('delete', entity, {:id=>id}, nil)\n end\n end\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @v_goal = VGoal.find(params[:id])\n @v_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to v_goals_url }\n format.json { head :no_content }\n end\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def delete(path, opts = {})\n request(:delete, path, opts).body\n end", "def destroy\n @deposito.destroy\n respond_to do |format|\n format.html { redirect_to depositos_url, notice: 'Deposito eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def delete_and_give_me_a_json(additional_path, params = nil)\n if self.service_base_path != nil\n if params == nil\n params = Hash.new\n end\n params[:api_key] = self.access_token\n message = self.http_client.delete \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json\", params\n trata_erro(message.content)\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end", "def delete(path, payload = nil)\n req = Net::HTTP::Delete.new(path)\n action(req, payload)\n end", "def destroy\n @expense = Expense.find params.fetch(:id)\n @expense.destroy\n head :no_content\n end", "def delete\n api_client.delete(url)\n end" ]
[ "0.6958753", "0.6827413", "0.6826436", "0.6816422", "0.68047947", "0.68044895", "0.6790449", "0.67768383", "0.67351115", "0.6724736", "0.6724736", "0.6724736", "0.6724736", "0.6708416", "0.669331", "0.66727996", "0.6644749", "0.66371465", "0.66164446", "0.66142935", "0.6610138", "0.659704", "0.6587461", "0.65715694", "0.65699476", "0.6553741", "0.6539686", "0.6524758", "0.6513698", "0.6510074", "0.6497195", "0.6495505", "0.6493751", "0.6493245", "0.6492524", "0.6491269", "0.6480396", "0.6480252", "0.6479261", "0.64723265", "0.64723265", "0.64723265", "0.64723265", "0.64723265", "0.64723265", "0.64723265", "0.64635634", "0.64635634", "0.64635634", "0.64635634", "0.64635634", "0.64635634", "0.64635634", "0.6460026", "0.6458421", "0.64554965", "0.6450666", "0.645024", "0.645024", "0.6443361", "0.6443361", "0.6443361", "0.6441745", "0.6440779", "0.64314824", "0.6430537", "0.64262766", "0.64239913", "0.64207834", "0.6417988", "0.641762", "0.6416024", "0.6413786", "0.6413786", "0.64121646", "0.6405896", "0.6405896", "0.64042467", "0.6393521", "0.6392803", "0.6391558", "0.63874924", "0.638406", "0.6380813", "0.6376686", "0.63741535", "0.6372135", "0.63709944", "0.63697714", "0.6364635", "0.63622075", "0.6353958", "0.635042", "0.63467646", "0.6344843", "0.63443905", "0.6343852", "0.6341328", "0.6333345", "0.6327223" ]
0.6855466
1
Use callbacks to share common setup or constraints between actions.
def set_positive @positive = Positive.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
Only allow a list of trusted parameters through.
def positive_params params.require(:positive).permit(:name, :lat, :long, :lonlat) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\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 strong_params\n params.require(:user).permit(param_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 allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "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 param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\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 allowed?(*_)\n true\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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\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 permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; 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 url_allowlist=(_arg0); 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 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 list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\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 shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
Given a number, find the level that includes it Ex: Number 7 returns level 1 Level 1: Min Value: 2 Max Value: 9
def find_level level = 0 max_value = max_number_of_a_level(level) while max_value < input level += 1 max_value = max_number_of_a_level(level) end level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_number_of_a_level(level)\n max_number_of_a_level(level - 1) + 1\n end", "def by_level(range, max_at:)\n level >= max_at ? range.last :\n range.first + (((range.size - 1)/max_at.to_f)*level).to_i\n end", "def get_level(key)\n case key\n when \"L\", \"l\" then 0 # Level L\n when \"M\", \"m\" then 1 # Level M\n when \"Q\", \"q\" then 2 # Level Q\n when \"H\", \"h\" then 3 # Level H\n end\n end", "def level(xp)\n xp / 10\n end", "def max_number_of_a_level(level)\n 4 * level * level + 4 * level + 1\n end", "def level= level\n if (0..6).include? level then @level = level\n elsif LEVEL.include? level.to_s then @level = LEVEL.index level\n else @level = UNKNOWN\n end\n end", "def level\n level = 0\n while get_points >= rounded_maximum_points_for_level(level)\n level += 1\n end\n level\n end", "def suggestedLevel\r\n minLevel = 1\r\n maxLevel = GameData::GrowthRate.max_level\r\n num = self.suggestedNumber\r\n for rule in @pokemonRules\r\n if rule.is_a?(MinimumLevelRestriction)\r\n minLevel = rule.level\r\n elsif rule.is_a?(MaximumLevelRestriction)\r\n maxLevel = rule.level\r\n end\r\n end\r\n totalLevel = maxLevel * num\r\n for rule in @subsetRules\r\n totalLevel = rule.level if rule.is_a?(TotalLevelRestriction)\r\n end\r\n return [maxLevel, minLevel].max if totalLevel >= maxLevel * num\r\n return [totalLevel / self.suggestedNumber, minLevel].max\r\n end", "def get_difficulty\n print \"Choose a difficulty level from 1 (easiest) to 10 (hardest): \"\n level = gets.chomp.to_i\n if (1..10).include? level\n return level\n else\n puts \"Not a valid difficulty level! Choose again.\\n\\n\"\n self.get_difficulty\n end\n end", "def level\r\n\tif $lvl == 1\r\n\t\tlevel2\r\n\telse \r\n\t\tif $lvl == 2\r\n\t\t\tlevel3\r\n\t\telse\r\n\t\t\tif $lvl == 3\r\n\t\t\t\tlevel4\r\n\t\t\tend\r\n\t\tend\t\r\n\tend\t\r\nend", "def level(value = nil)\n if value.nil?\n @level\n else\n @level = value\n end\n end", "def salience_to_level(levels, minmax, salience)\n salience -= minmax[MIN]\n step = (minmax[MAX] - minmax[MIN]) / levels\n return (salience/step).to_i\nend", "def value\n return 3*level\n end", "def yourLvl(hash={})\n\t\tStats.level = hash['value'].slice(/\\d+/o)\n\tend", "def value\n return 15*level\n end", "def levels(level_counter = 0)\n level_counter += 1\n #puts \"value: #{value}, level_counter: #{level_counter}\"\n\n if left.nil? && right.nil?\n return level_counter\n end\n\n left_levels = left ? left.levels(level_counter) : 0\n right_levels = right ? right.levels(level_counter) : 0\n\n if left_levels > right_levels\n return left_levels\n else\n return right_levels\n end\n end", "def level\n @level\n end", "def levels\n # divide total points available in to X tiers\n # set up a hash\n # Beginner - 1\n # Good start - 2\n # Moving Up - 3\n # good - 4\n # Solid - 5\n # Nice - 6\n # Great - 7\n # Amazing - 8\n # Genius - 9\n # Queen Bee - 10\n end", "def compute_level(experience_points)\n i = numbered_levels.rindex do |l|\n l.experience_points_threshold <= experience_points\n end\n i ? numbered_levels[i] : nil\n end", "def get_node_level(node, key)\n get_level_of_node(node, key, 1)\nend", "def level(num)\n result = []\n\n for node in @nodes\n if node.level == num\n result.push(node)\n end\n end\n\n return result\n end", "def level\n @level\n end", "def level\n @level\n end", "def max_level\n infinity = Float::INFINITY\n return [@max_level || infinity, $pokemon_party.level_max_limit || infinity, PSDK_CONFIG.pokemon_max_level].min\n end", "def level_id\r\n @level_id ||= SEVERITY_LIST.index(level.to_s.upcase) || 5\r\n end", "def check_level(max, current)\n if max == \"u\"\n return current == \"u\"\n end\n if max == \"s\"\n return %w{u s}.include?(current)\n end\n # OK\n return TRUE\nend", "def compute_level(dd)\r\n lev = 0\r\n if dd > @very_small\r\n while dd < @zoom_level_breaks[lev]\r\n lev += 1\r\n end\r\n return lev\r\n end\r\n end", "def grade(level)\n roster.detect do |x, y|\n if x == level\n return y\n end\n end\n end", "def grade(level)\n roster.detect do |x, y| \n if x == level\n return y \n end \n end \n end", "def check_level_param\n if (!params[:level].blank? && params[:level].to_i.to_s == params[:level] && User.valid_level?(params[:level].to_i))\n @level = params[:level].to_i\n end\n\n return @level\n end", "def level_bonus\n (MAX_LEVEL - level) / MAX_LEVEL\n end", "def get_xp\n return 3 * level\n end", "def level_index\n @level_index || 0\n end", "def level_index\n @level_index || 0\n end", "def calculate_level\n # Increase level for every 10 lines cleared\n @level = @start_level + (@lines_cleared / 10).floor\n end", "def getLevels\n @level\n end", "def power_level(x, y)\n ((((x + 10) * y ) + $serial_num) * (x + 10)).digits[2] - 5\nend", "def power_level(x, y)\n ((((x + 10) * y ) + $serial_num) * (x + 10)).digits[2] - 5\nend", "def desired_xp\n return (200 * level * (level + 1)).to_i\n end", "def level_lookup\n LOG_LEVELS.invert\n end", "def getMinesByDiffLevel(square, diffLevel)\n numMines = 1\n diffLevel = diffLevel.downcase\t\n if diffLevel.to_s.eql? \"easy\"\n numMines = (square * (1 - DIFF_EASY / 100.0)).to_i\t\t\n end\n if diffLevel.to_s.eql? \"medium\"\n numMines = (square * (1 - DIFF_MEDIUM / 100.0)).to_i\t\t\n end\n if diffLevel.to_s.eql? \"hard\"\n numMines = (square * (1 - DIFF_HARD / 100.0)).to_i\t\t\n end\n puts numMines\t\n numMines\n end", "def compute_level_number(experience_points)\n level = compute_level(experience_points)\n level ? level.level_number : 0\n end", "def level\n return @level\n end", "def level\n return @level\n end", "def to_level(l)\n def self.get_next(m, l)\n if l < 20\n m + (m*l*0.1).round\n elsif l < 100\n m + 2*m + (m*(l-20)*0.05).round\n else\n m + 6*m + (m*(l-100)*0.15).round\n end\n end\n new_atr = self.class.new\n Stat.symbols.each{|a|\n tmp_next = get_next(self[a], l)\n new_atr[a] = ( tmp_next > self[a] ? tmp_next : self[a] )\n }\n new_atr\n end", "def current_level\n @cur_level\n end", "def get_level\n case @level\n when 0, 1, 2, 3, 4, 5\n return @level\n else\n return WatirmarkLog::Level::DEBUG\n end\n end", "def height_helper(current_node, level = 0)\n return level if !current_node\n level = [height_helper(current_node.left, level + 1), height_helper(current_node.right, level + 1)].max\n return level\n end", "def level; end", "def level; end", "def level; end", "def level; end", "def level; end", "def level; end", "def levels\n levels = [\n \"1.1.1\",\n \"1.2.2\",\n \"1.3.1\",\n \"1.3.2\",\n \"2.1.1\",\n \"2.1.2\",\n \"2.2.1\",\n \"2.3.1\",\n \"2.4.1\",\n \"2.4.2\",\n \"2.4.3\",\n \"2.4.4\",\n \"3.1.1\",\n \"3.2.1\",\n \"3.3.2\",\n \"4.1.1\",\n \"4.1.2\",\n \"1.4.3\",\n \"1.4.4\",\n \"1.4.5\",\n \"2.4.6\",\n \"3.1.2\",\n \"3.2.4\",\n \"1.4.6\",\n \"1.4.8\",\n \"2.1.3\",\n \"2.2.4\",\n \"2.3.2\",\n \"2.4.10\",\n \"2.4.9\",\n \"2.5.5\",\n \"3.1.4\",\n \"3.1.5\",\n \"3.2.5\"\n ]\n return levels\n end", "def exp_lvl\n data = GameData::EXP_TABLE[exp_type]\n v = data[@level + 1]\n return data[@level] if !v || ($pokemon_party&.level_max_limit).to_i <= @level\n\n return v\n end", "def stock_level()\n\n if @quantity >= 10\n return \"high\"\n elsif @quantity >= 5 && @quantity <= 9\n return \"medium\"\n elsif @quantity <= 4\n return \"low\"\n end\n end", "def level\n is_root? ? nil : option_set.try(:level, depth)\n end", "def level\n init unless @initialized\n level = level_to_sym(@level)\n end", "def effective_level\n level + level_bonus\n end", "def level_name\n name = (Membership::LEVELS.respond_to?(:key) ? Membership::LEVELS.key(level) : Membership::LEVELS.index(level)).to_s\n end", "def last_level_exp\n return 0 if @level <= 0\n return exp_for_level(@level - 1)\n end", "def calculate_level_from_exp(exp_pts)\n level = (25 + (Math.sqrt(625 + 100 * exp_pts))) / 50\n return level.floor\n end", "def decide_level(levels_input_data)\n course_ds = levels_input_data.course_ds\n course_failures = levels_input_data.course_failures\n recent_absence_rate = levels_input_data.recent_absence_rate\n recent_discipline_actions = levels_input_data.recent_discipline_actions\n\n # Level 4: At least 4 F's\n # OR less than 80% attendance over last 45 school days\n # OR 7 or more discipline actions over the last 45 school days\n level_four_triggers = [\n (:academic if course_failures >= 4),\n (:absence if recent_absence_rate < 0.80),\n (:discipline if recent_discipline_actions >= 7)\n ].compact\n return Level.new(4, level_four_triggers, levels_input_data) if level_four_triggers.size > 0\n\n # Level 3: 3 F's\n # OR less than 85% attendance over last 45\n # OR 5-6 discipline actions over the last 45 school days\n level_three_triggers = [\n (:academic if course_failures >= 3),\n (:absence if recent_absence_rate < 0.85),\n (:discipline if recent_discipline_actions >= 5)\n ].compact\n return Level.new(3, level_three_triggers, levels_input_data) if level_three_triggers.size > 0\n\n # Level 2: 2 F's\n # OR less than 90% attendance over last 45\n # (no discipline involved in calculation)\n level_two_triggers = [\n (:academic if course_failures >= 2),\n (:absence if recent_absence_rate < 0.90)\n ].compact\n return Level.new(2, level_two_triggers, levels_input_data) if level_two_triggers.size > 0\n\n # Level 1: 1 F and 2 Ds\n # OR less than 95% attendance over last 45 days\n # (no discipline involved)\n level_one_triggers = [\n (:academic if course_failures == 1 && course_ds >= 2),\n (:absence if recent_absence_rate < 0.95)\n ].compact\n return Level.new(1, level_one_triggers, levels_input_data) if level_one_triggers.size > 0\n\n # Level 0: Not any of the other levels\n return Level.new(0, [], levels_input_data)\n end", "def check_level(level)\n\tif level == nil || level.to_i < 2\n\t\treturn \"Enter the number for your difficulty level (Minimum 2)\"\n\tend\n\treturn \"Difficulty level is #{level}\"\nend", "def equivalent_level\n parsed_hd = parse_dice(self.class::HIT_DICE)\n \n if parsed_hd[-2] == '-'\n return 1\n else\n return parsed_hd.first + 1 + (parsed_hd.size > 3 ? 1 : 0)\n end\n end", "def level_text2\n \"#{text_get(27, 29)}#@level\"\n end", "def badge_level(name)\n these_badges = self.badges.find_all { |b| b.name == name }\n if these_badges.any?\n these_badges.sort_by { |b| b.level }.last.level\n else\n 0\n end\n end", "def level\n parent_id.nil? ? 0 : compute_level\n end", "def get_grade(num)\n case\n when num >= 90\n return \"A\"\n when num >= 80\n return \"B\"\n when num >= 70\n return \"C\"\n when num >= 60\n return \"D\"\n when num < 60\n return \"F\"\n end\nend", "def group_level(value)\n group.update_query(:group_level => value.to_i)\n end", "def get_level(src)\n\t\tlog_levels[src]\n\tend", "def complexity_level_number\n ComplexityLevelHelper::COMPLEXITIES.fetch(complexity_level)\n end", "def level\n if parent.nil?\n 0\n else\n parent.level + 1;\n end\n end", "def max_level\r\r\n @note =~ /<max[-_ ]?level:\\s*(.*)\\s*>/i ? @max_level = $1.to_i : @max_level = TH_Instance::Equip::Default_Max_Level if @max_level.nil?\r\r\n @max_level\r\r\n end", "def max_level_depth\n MAXIMUM_LEVEL_DEPTH\n end", "def pick_best_level(metadata)\n best_level = metadata.max_level\n metadata_levels = metadata.all_levels\n metadata_levels.keys.sort.reverse.each do |k|\n if metadata_levels[k].height.to_i > query.scale.to_i and\n metadata_levels[k].width.to_i > query.scale.to_i\n best_level = k\n end\n end\n # Here we try to compensate for when the dwtLevels does not match the\n # djatoka levels.\n# if metadata.dwt_levels.to_i > metadata.levels.to_i\n# best_level.to_i - 2\n# elsif metadata.dwt_levels.to_i == metadata.levels.to_i\n best_level.to_i\n# end\n end", "def push_level(x=1) \n x >= 1 ? @level = x : @level = 1\n end", "def level(circle = self)\n return 0 unless circle.super_circle\n\n 1 + level(circle.super_circle)\n end", "def get_grade(n)\n case\n when n >= 90\n \"A\"\n when n >= 80\n \"B\"\n when n >= 70\n \"C\"\n when n >= 60\n \"D\"\n else\n \"F\"\n end\nend", "def max_level=(level)\n @max_level = level.is_a?(Integer) ? level : nil\n end", "def get_grade(num)\n if num >= 90\n return 'A'\n elsif num >= 80 and num <= 89\n return 'B'\n elsif num >= 70 and num <= 79\n return 'C'\n elsif num >= 60 and num <= 69\n return 'D'\n else num < 60\n return 'F'\n end\nend", "def max_level(width, height)\n return (Math.log([width, height].max) / Math.log(2)).ceil\n end", "def level_group\n @level_group\n end", "def school_level(grade)\n if grade >= 1 && grade <= 5\n return \"to the elementary\"\n elsif grade > 5 && grade <=8\n return \"to the middle school\"\n elsif grade >8 && grade <=12\n return \"to the high school\"\n else\n return \"to the college\"\n end\nend", "def level\n @location.level\n end", "def get_grade (num)\n if num >= 90\n return \"A\"\n elsif 90 > num && num >= 80\n return \"B\"\n elsif 80 > num && num >= 70\n return \"C\"\n elsif 70 > num && num >= 60\n return \"D\"\n else \n return \"F\"\n end\nend", "def level\n @level || Helpers.char_level(@entity)\n end", "def stock_level()\n if @quantity >= 10\n return \"high\"\n elsif @quantity >= 5 && @quantity <= 9\n return \"medium\"\n elsif @quantity <= 4\n return \"low\"\n end\nend", "def CP(level)\r\n cpNeeded = 0\r\n if level > 0 && level <= 5\r\n cpNeeded + 4\r\n elsif level > 5 && level <= 20\r\n cpNeeded + 8\r\n else\r\n cpNeeded + 0\r\n end\r\nend", "def calculate_level_raking(rank)\n value = 0\n if rank.include?(\"-\")\n value = rank.split(\"-\")[0].to_f + 0.5\n # if value = rank.split(\"-\")[0].to_i == 0\n # value = 0.5\n # elsif rank.split(\"-\")[0].to_i == 1\n # value = 1.5\n # else\n # value = rank.split(\"-\")[1].to_i / rank.split(\"-\")[0].to_i\n # end \n elsif rank.include?(\"++\")\n value = (rank.gsub(\"++\",\"\").to_i - 1) + 0.8\n else\n value = rank.to_i\n end\n \n return value\n end", "def difficulty_level_limit(level)\n @depth == level ? true : false\n end", "def get_grade(n)\n if n >= 90\n p 'A'\n elsif n >= 80\n p 'B'\n elsif n >= 70\n p 'C'\n elsif n >= 60\n p 'D'\n else n < 60\n p 'F'\n end\nend", "def get_level\n level = 1\n p = parent\n while !p.nil?\n level += 1\n p = p.parent\n end\n \n return level\n end", "def max_level(width, height)\n return (Math.log([width, height].max) / Math.log(2)).ceil\n end", "def levels\n @levels ||= {}\n end", "def get_grade(x)\nif x <= 59\nreturn \"F\"\nelsif x <= 69\nreturn \"D\"\nelsif x <= 79\nreturn \"C\"\nelsif x <= 89\nreturn \"B\"\nelsif x <= 99\nreturn \"A\"\nelse\nreturn \"Not a number\"\nend\nend", "def elems_in_level(index)\n\treturn (Math.sqrt(2*(index+1)-1)-0.5).to_i + 1\nend", "def grade_as_level\n User::GRADES[grade][:level]\n end", "def level\n return 0 if self[parent_col_name].nil?\n base_set_class.count(:conditions => \"#{scope_condition} AND (#{self[left_col_name]} BETWEEN #{left_col_name} AND #{right_col_name})\") - 1\n end" ]
[ "0.7395198", "0.71062714", "0.6725487", "0.6684878", "0.66810113", "0.6663994", "0.66560423", "0.6545247", "0.6436386", "0.6398142", "0.63862497", "0.6305735", "0.63021517", "0.62912244", "0.6275081", "0.62496877", "0.62187016", "0.6150314", "0.6143422", "0.61397547", "0.6106207", "0.60962814", "0.60962814", "0.6077673", "0.6058514", "0.605301", "0.60157925", "0.6006127", "0.6002489", "0.59972954", "0.59933984", "0.59890985", "0.5966888", "0.5966888", "0.5921466", "0.5919765", "0.59083974", "0.59083974", "0.5901632", "0.586093", "0.58395606", "0.5834968", "0.582885", "0.582885", "0.5812294", "0.58056307", "0.58053005", "0.58050346", "0.5803121", "0.5803121", "0.5803121", "0.5803121", "0.5803121", "0.5803121", "0.576428", "0.5749562", "0.57403195", "0.57299113", "0.5724552", "0.57139146", "0.5712964", "0.57054085", "0.570176", "0.56670064", "0.5658638", "0.5650873", "0.5643453", "0.56310827", "0.56093824", "0.5609053", "0.5594778", "0.5594649", "0.55736417", "0.55671674", "0.5564622", "0.5563922", "0.556348", "0.556199", "0.5561769", "0.55555296", "0.5552291", "0.55515826", "0.55469453", "0.55466926", "0.5539277", "0.5536781", "0.5535903", "0.5534399", "0.5533498", "0.5528835", "0.5526234", "0.55242676", "0.55240583", "0.55181307", "0.5516475", "0.5507303", "0.55021274", "0.5500101", "0.5497862", "0.54966134" ]
0.78657734
0
For level 2 returns 25
def max_number_of_a_level(level) 4 * level * level + 4 * level + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value\n return 15*level\n end", "def value\n return 3*level\n end", "def desired_xp\n return (200 * level * (level + 1)).to_i\n end", "def get_xp\n return 3 * level\n end", "def total_exp_level\n lvl = self.lvl\n return (100 * (1 - @@exp_mul ** (lvl - 1)) / (1 - @@exp_mul))\n end", "def elems_in_level(index)\n\treturn (Math.sqrt(2*(index+1)-1)-0.5).to_i + 1\nend", "def level(xp)\n xp / 10\n end", "def next_exp\n lvl * 100\n end", "def calculate_level_from_exp(exp_pts)\n level = (25 + (Math.sqrt(625 + 100 * exp_pts))) / 50\n return level.floor\n end", "def levels\n # divide total points available in to X tiers\n # set up a hash\n # Beginner - 1\n # Good start - 2\n # Moving Up - 3\n # good - 4\n # Solid - 5\n # Nice - 6\n # Great - 7\n # Amazing - 8\n # Genius - 9\n # Queen Bee - 10\n end", "def last_level_exp\n return 0 if @level <= 0\n return exp_for_level(@level - 1)\n end", "def level\n level = 0\n while get_points >= rounded_maximum_points_for_level(level)\n level += 1\n end\n level\n end", "def level_bonus\n (MAX_LEVEL - level) / MAX_LEVEL\n end", "def height_helper(current_node, level = 0)\n return level if !current_node\n level = [height_helper(current_node.left, level + 1), height_helper(current_node.right, level + 1)].max\n return level\n end", "def equivalent_level\n parsed_hd = parse_dice(self.class::HIT_DICE)\n \n if parsed_hd[-2] == '-'\n return 1\n else\n return parsed_hd.first + 1 + (parsed_hd.size > 3 ? 1 : 0)\n end\n end", "def min_number_of_a_level(level)\n max_number_of_a_level(level - 1) + 1\n end", "def returnTrainerLevel\r\n if !$Trainer\r\n @trainerLevel=0\r\n elsif $Trainer.party.length<1\r\n @trainerLevel=0\r\n else\r\n level=0; eggs=0\r\n for i in $Trainer.party\r\n if i.isEgg?\r\n eggs+=1\r\n else\r\n level+=i.level\r\n end\r\n end\r\n level=(level/($Trainer.party.length-eggs)).round\r\n if @trainerLevel\r\n if level>@trainerLevel\r\n @trainerLevel=level\r\n end\r\n else\r\n @trainerLevel=1\r\n end\r\n end\r\n return @trainerLevel\r\nend", "def level; end", "def level; end", "def level; end", "def level; end", "def level; end", "def level; end", "def effective_level\n level + level_bonus\n end", "def calculate_level\n # Increase level for every 10 lines cleared\n @level = @start_level + (@lines_cleared / 10).floor\n end", "def exp_for_level(level)\n return (DND::EXP_FOR_LEVEL[level] * 1000).to_i\n end", "def proficiency_bonus\n\t\t(level()+3)/4 + 1\n\tend", "def level\n # attended = Commitment.where(\"user_id = ? AND fulfilled = ?\", id, true)\n # ((attended.map { |commitment| Post.where(id: commitment.post_id).first }.map { |post| post.pace }.inject { |memo, n| memo + n })/attended.length).round\n 5\n end", "def tile_size level\n\t\t\t2 ** level\n\t\tend", "def level\n @level\n end", "def my_depth\n 1\n end", "def find_level\n level = 0\n max_value = max_number_of_a_level(level)\n while max_value < input\n level += 1\n max_value = max_number_of_a_level(level)\n end\n level\n end", "def level_text2\n \"#{text_get(27, 29)}#@level\"\n end", "def level1_eg\r\n\r\n end", "def yourLvl(hash={})\n\t\tStats.level = hash['value'].slice(/\\d+/o)\n\tend", "def depth\n @cur_level - @base_level + 1\n end", "def exp_lvl\n data = GameData::EXP_TABLE[exp_type]\n v = data[@level + 1]\n return data[@level] if !v || ($pokemon_party&.level_max_limit).to_i <= @level\n\n return v\n end", "def level\n\t\tlevel = 0\n\t\t@classes.each do |_class|\n\t\t\tlevel += _class.level\n\t\tend\n\t\tlevel\n\tend", "def max_health(level)\n (self.health + self.health*0.1*(level-1)).to_i\n end", "def max_level_depth\n MAXIMUM_LEVEL_DEPTH\n end", "def level_index\n @level_index || 0\n end", "def level_index\n @level_index || 0\n end", "def by_level(range, max_at:)\n level >= max_at ? range.last :\n range.first + (((range.size - 1)/max_at.to_f)*level).to_i\n end", "def max_nesting()\n #This is a stub, used for indexing\n end", "def exp_for_level(l)\n def self.point_cost(pt, l)\n if l < 20\n pt*l*3\n elsif l < 100\n 60*pt + ((pt*(l-20))*4.0**(1.0 + l/100.0)).round\n else\n 1340*pt + (pt*(l-100)*5.0**(1.0 + l/100.0)).round\n end\n end\n cost = 0\n Stat.symbols.each{|a|\n cost += point_cost(Stat.mod_cost(self[a]), l)\n }\n cost += point_cost(Stat.mod_cost(self.owner[:freepts].to_i), l)\n cost\n end", "def xp_required\n 750 * ((@level + 1) ** 2)\n end", "def post_level(count)\n case count\n when (0..30)\n return 'Apprentice'\n when (31..75)\n return 'Junior Cook'\n when (76..125)\n return 'Chef'\n when (126..250)\n return 'Sous Chef'\n when count > 251\n return 'Executive Chef'\n end\n end", "def depth; end", "def level\r\n\tif $lvl == 1\r\n\t\tlevel2\r\n\telse \r\n\t\tif $lvl == 2\r\n\t\t\tlevel3\r\n\t\telse\r\n\t\t\tif $lvl == 3\r\n\t\t\t\tlevel4\r\n\t\t\tend\r\n\t\tend\t\r\n\tend\t\r\nend", "def level_cost(skill, level)\n return Integer((level*10) + (level*16))\n end", "def depth_max; depths.max end", "def level_up experience\n if experience > somenumber\n self.level += 1\n end\n end", "def depth()\n #This is a stub, used for indexing\n end", "def level\n @level\n end", "def level\n @level\n end", "def get_tree_height(d,cnt = 0 )\n \n if ( d['l'] == {} && d['r'] == {} )\n @depth = cnt if @depth < cnt\n else\n cnt = cnt + 1\n get_tree_height(d['l'],cnt) if d.key?('l')\n get_tree_height(d['r'],cnt) if d.key?('r')\n end\n \n return @depth\n \nend", "def bottoms_up_method\n\t\t# 1. take the nodes that went the farthest (i.e.: max tree level)\n\t\tmax_level = @tree.tree_bottom.collect(&:level).max\n\t\t# 2. Of those, use the one with the minimum sum value\n\t\twinner = @tree.tree_bottom.select{|t|t.level==max_level}.min_by(&:sum)\n\t\t# binding.pry \n\t\tbottoms_up_dir(winner).dir\n\tend", "def compute_level(dd)\r\n lev = 0\r\n if dd > @very_small\r\n while dd < @zoom_level_breaks[lev]\r\n lev += 1\r\n end\r\n return lev\r\n end\r\n end", "def height\n height_recursive(@root)\n end", "def getLevels\n @level\n end", "def level_to_xp\n NWN::TwoDA.get('exptable').by_col(\"XP\", self - 1).to_i\n end", "def level_pokemon_number\n @level.to_s.to_pokemon_number\n end", "def pbBalancedLevel(party)\n return 1 if party.length==0\n # Calculate the mean of all levels\n sum = 0\n party.each{|p| sum += p.level }\n return 1 if sum==0\n average = sum.to_f/party.length.to_f\n # Calculate the standard deviation\n varianceTimesN = 0\n for i in 0...party.length\n deviation = party[i].level-average\n varianceTimesN += deviation*deviation\n end\n # Note: This is the \"population\" standard deviation calculation, since no\n # sample is being taken\n stdev = Math.sqrt(varianceTimesN/party.length)\n mean = 0\n weights = []\n # Skew weights according to standard deviation\n for i in 0...party.length\n weight = party[i].level.to_f/sum.to_f\n if weight<0.5\n weight -= (stdev/PBExperience::MAXLEVEL.to_f)\n weight = 0.001 if weight<=0.001\n else\n weight += (stdev/PBExperience::MAXLEVEL.to_f)\n weight = 0.999 if weight>=0.999\n end\n weights.push(weight)\n end\n weightSum = 0\n weights.each{|weight| weightSum += weight }\n # Calculate the weighted mean, assigning each weight to each level's\n # contribution to the sum\n for i in 0...party.length\n mean += party[i].level*weights[i]\n end\n mean /= weightSum\n # Round to nearest number\n mean = mean.round\n # Adjust level to minimum\n mean = 1 if mean<1\n # Add 2 to the mean to challenge the player\n mean += 2\n # Adjust level to maximum\n mean = PBExperience::MAXLEVEL if mean>PBExperience::MAXLEVEL\n return mean\nend", "def equivalent_level\n 0\n end", "def get_depth\n raise \"Not implemented\"\n end", "def level(circle = self)\n return 0 unless circle.super_circle\n\n 1 + level(circle.super_circle)\n end", "def level_size level\n\t\t\t@unit_size * tile_size(level)\n\t\tend", "def api_regen_multiplier(level)\n if level >= User::Levels::GOLD\n 4\n else\n 1\n end\n end", "def level\n if parent.nil?\n 0\n else\n parent.level + 1;\n end\n end", "def total_exp_for_level(l)\n attr = self.dup\n cost = attr.exp_for_level(l)\n cost += attr.c_class.spell_xp(l)\n cost\n end", "def depth=(_arg0); end", "def getMinesByDiffLevel(square, diffLevel)\n numMines = 1\n diffLevel = diffLevel.downcase\t\n if diffLevel.to_s.eql? \"easy\"\n numMines = (square * (1 - DIFF_EASY / 100.0)).to_i\t\t\n end\n if diffLevel.to_s.eql? \"medium\"\n numMines = (square * (1 - DIFF_MEDIUM / 100.0)).to_i\t\t\n end\n if diffLevel.to_s.eql? \"hard\"\n numMines = (square * (1 - DIFF_HARD / 100.0)).to_i\t\t\n end\n puts numMines\t\n numMines\n end", "def compute_level_number(experience_points)\n level = compute_level(experience_points)\n level ? level.level_number : 0\n end", "def to_level(l)\n def self.get_next(m, l)\n if l < 20\n m + (m*l*0.1).round\n elsif l < 100\n m + 2*m + (m*(l-20)*0.05).round\n else\n m + 6*m + (m*(l-100)*0.15).round\n end\n end\n new_atr = self.class.new\n Stat.symbols.each{|a|\n tmp_next = get_next(self[a], l)\n new_atr[a] = ( tmp_next > self[a] ? tmp_next : self[a] )\n }\n new_atr\n end", "def levels(level_counter = 0)\n level_counter += 1\n #puts \"value: #{value}, level_counter: #{level_counter}\"\n\n if left.nil? && right.nil?\n return level_counter\n end\n\n left_levels = left ? left.levels(level_counter) : 0\n right_levels = right ? right.levels(level_counter) : 0\n\n if left_levels > right_levels\n return left_levels\n else\n return right_levels\n end\n end", "def get_node_level(node, key)\n get_level_of_node(node, key, 1)\nend", "def level\n return @level\n end", "def level\n return @level\n end", "def num_tankoubon; end", "def skill_exp_max(skill)\n result = skill.skl_exp_list[skill.skl_maxlevel] + 10\n return result\n end", "def leaf_count\n @leaf_count\n end", "def max_level(width, height)\n return (Math.log([width, height].max) / Math.log(2)).ceil\n end", "def depth_min; depths.min end", "def pyramid_sum(base)\n\nend", "def get_exp\n exp = 0\n exp = (((@hero.max_health - @hero.cur_health) * 0.85) * @monster.level).round if @winner\n return exp\n end", "def full_next_exp\n return (@exp_list[@level+1] > 0 ? @exp_list[@level+1] : 0)\n end", "def author_level(author_x)\n author_trip_stats = author_x.trip_stats\n agg_author_usefuls = 0\n unless author_trip_stats.blank?\n author_trip_stats.each { |trip|\n agg_author_usefuls = agg_author_usefuls + trip.useful \n }\n end\n # case agg_author_usefuls\n if ( agg_author_usefuls <= 25 )\n author_level = \"Rookie\"\n author_level_class = \"level_1_badge\"\n min_useful = 0\n next_level = 26 - agg_author_usefuls\n tooltip_msg = \"#{author_level} becomes an Explorer after getting #{next_level} more useful votes on their trips. Click useful to help this #{author_level} get there.\"\n elsif ( (agg_author_usefuls >= 26) and (agg_author_usefuls <= 100) )\n author_level = \"Explorer\"\n author_level_class = \"level_2_badge\"\n min_useful = 26\n next_level = 101 - agg_author_usefuls\n tooltip_msg = \"#{author_level} will become a Captain after getting #{next_level} more useful votes on their trips. Click useful to help this #{author_level} get there.\"\n elsif ( (agg_author_usefuls >= 101) and (agg_author_usefuls <= 500) )\n author_level = \"Captain\"\n min_useful = 101\n next_level = 501 - agg_author_usefuls\n author_level_class = \"level_3_badge\"\n tooltip_msg = \"#{author_level} becomes a Superstar after getting #{next_level} more useful votes on their trips. Click useful to help this #{author_level} get there.\"\n elsif ( (agg_author_usefuls >= 501) and (agg_author_usefuls <= 1000) )\n author_level = \"Superstar\"\n author_level_class = \"level_4_badge\"\n min_useful = 501\n next_level = 1001 - agg_author_usefuls\n tooltip_msg = \"#{author_level} has #{agg_author_usefuls} useful votes.\"\n # elsif ( agg_author_usefuls > 1001 )\n # author_level = \"Secret Status\"\n # author_level_class = \"level_5_badge\"\n # min_useful = 1001\n # next_level = \"a lot more\"\n # tooltip_msg = \"#{author_level} has #{agg_author_usefuls} useful votes.\"\n else\n author_level = \"Rookie\"\n author_level_class = \"level_1_badge\"\n min_useful = 0\n next_level = 26 - agg_author_usefuls\n tooltip_msg = \"#{author_level} becomes an Explorer after getting #{next_level} more useful votes on their trips. Click useful to help this #{author_level} get there.\"\n end\n return author_level, author_level_class, min_useful, next_level, tooltip_msg\n end", "def next_exp\n return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0\n end", "def next_exp\n return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0\n end", "def next_exp\n return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0\n end", "def next_exp\n return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0\n end", "def power_level(x, y)\n ((((x + 10) * y ) + $serial_num) * (x + 10)).digits[2] - 5\nend", "def power_level(x, y)\n ((((x + 10) * y ) + $serial_num) * (x + 10)).digits[2] - 5\nend", "def randomizer\n self.level * (rand(10))\n end", "def current_level\n @cur_level\n end", "def badge_level(name)\n these_badges = self.badges.find_all { |b| b.name == name }\n if these_badges.any?\n these_badges.sort_by { |b| b.level }.last.level\n else\n 0\n end\n end", "def next_level_threshold\n self.next ? self.next.experience_points_threshold : experience_points_threshold\n end", "def salience_to_level(levels, minmax, salience)\n salience -= minmax[MIN]\n step = (minmax[MAX] - minmax[MIN]) / levels\n return (salience/step).to_i\nend", "def max_level(width, height)\n return (Math.log([width, height].max) / Math.log(2)).ceil\n end", "def max_level\r\n # パーティ人数が 0 人の場合\r\n if @actors.size == 0\r\n return 0\r\n end\r\n # ローカル変数 level を初期化\r\n level = 0\r\n # パーティメンバーの最大レベルを求める\r\n for actor in @actors\r\n if level < actor.level\r\n level = actor.level\r\n end\r\n end\r\n return level\r\n end" ]
[ "0.7379375", "0.7275367", "0.7140974", "0.69484395", "0.6873776", "0.6851417", "0.6796145", "0.6791162", "0.6757891", "0.67053723", "0.6662311", "0.6504203", "0.637975", "0.63385004", "0.63343567", "0.63098335", "0.62953097", "0.6253162", "0.6253162", "0.6253162", "0.6253162", "0.6253162", "0.6253162", "0.6234962", "0.61619496", "0.616011", "0.61562765", "0.6144666", "0.6132116", "0.61299896", "0.612501", "0.6123049", "0.60927254", "0.6086493", "0.60671407", "0.60325634", "0.60280997", "0.5983003", "0.5982368", "0.59591526", "0.5951797", "0.5951797", "0.59430027", "0.5929437", "0.59230566", "0.59037775", "0.5864241", "0.58617955", "0.58604443", "0.58455503", "0.5837283", "0.5830672", "0.58230925", "0.58177555", "0.58177555", "0.5813581", "0.58078414", "0.5800745", "0.5797463", "0.5795424", "0.57951397", "0.5776953", "0.576275", "0.57589835", "0.5748791", "0.5743621", "0.5742777", "0.57386035", "0.57316875", "0.57245404", "0.5715103", "0.5691489", "0.56911266", "0.567762", "0.56775784", "0.5675049", "0.5663591", "0.5663591", "0.5657559", "0.5653695", "0.5650431", "0.5645669", "0.5638935", "0.5633386", "0.5633048", "0.5625705", "0.56079143", "0.56040186", "0.56040186", "0.56040186", "0.56040186", "0.5598809", "0.5598809", "0.5595208", "0.5591222", "0.55896366", "0.55879146", "0.5582835", "0.5581016", "0.5569754" ]
0.6952524
3
For level 2 returns 10
def min_number_of_a_level(level) max_number_of_a_level(level - 1) + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value\n return 3*level\n end", "def level(xp)\n xp / 10\n end", "def value\n return 15*level\n end", "def desired_xp\n return (200 * level * (level + 1)).to_i\n end", "def get_xp\n return 3 * level\n end", "def return_10\n\t\treturn 10\n\tend", "def max_number_of_a_level(level)\n 4 * level * level + 4 * level + 1\n end", "def levels\n # divide total points available in to X tiers\n # set up a hash\n # Beginner - 1\n # Good start - 2\n # Moving Up - 3\n # good - 4\n # Solid - 5\n # Nice - 6\n # Great - 7\n # Amazing - 8\n # Genius - 9\n # Queen Bee - 10\n end", "def calculate_level\n # Increase level for every 10 lines cleared\n @level = @start_level + (@lines_cleared / 10).floor\n end", "def levels(level_counter = 0)\n level_counter += 1\n #puts \"value: #{value}, level_counter: #{level_counter}\"\n\n if left.nil? && right.nil?\n return level_counter\n end\n\n left_levels = left ? left.levels(level_counter) : 0\n right_levels = right ? right.levels(level_counter) : 0\n\n if left_levels > right_levels\n return left_levels\n else\n return right_levels\n end\n end", "def my_depth\n 1\n end", "def level\r\n\tif $lvl == 1\r\n\t\tlevel2\r\n\telse \r\n\t\tif $lvl == 2\r\n\t\t\tlevel3\r\n\t\telse\r\n\t\t\tif $lvl == 3\r\n\t\t\t\tlevel4\r\n\t\t\tend\r\n\t\tend\t\r\n\tend\t\r\nend", "def level\n level = 0\n while get_points >= rounded_maximum_points_for_level(level)\n level += 1\n end\n level\n end", "def depth\n @cur_level - @base_level + 1\n end", "def depth=(_arg0); end", "def level; end", "def level; end", "def level; end", "def level; end", "def level; end", "def level; end", "def find_level\n level = 0\n max_value = max_number_of_a_level(level)\n while max_value < input\n level += 1\n max_value = max_number_of_a_level(level)\n end\n level\n end", "def next_exp\n lvl * 100\n end", "def level\n @level\n end", "def CP(level)\r\n cpNeeded = 0\r\n if level > 0 && level <= 5\r\n cpNeeded + 4\r\n elsif level > 5 && level <= 20\r\n cpNeeded + 8\r\n else\r\n cpNeeded + 0\r\n end\r\nend", "def elems_in_level(index)\n\treturn (Math.sqrt(2*(index+1)-1)-0.5).to_i + 1\nend", "def last_level_exp\n return 0 if @level <= 0\n return exp_for_level(@level - 1)\n end", "def level \n if (self.parent_category_id == nil)\n @level = 1\n elsif (@level == nil) \n @level = computeLevelBySQL\n end \n @level\nend", "def test_depth=\n @br.depth = 100\n end", "def digital_root_best(n)\r\n n < 10 ? n : digital_root_best(n/10 + n%10)\r\nend", "def level(circle = self)\n return 0 unless circle.super_circle\n\n 1 + level(circle.super_circle)\n end", "def depth_min; depths.min end", "def depth; end", "def level_index\n @level_index || 0\n end", "def level_index\n @level_index || 0\n end", "def most_specific_subdivision; end", "def depth()\n #This is a stub, used for indexing\n end", "def level\n if parent.nil?\n 0\n else\n parent.level + 1;\n end\n end", "def digital_root(num)\n return num if num < 10\n\n num = digital_root_step(num)\n\n (num > 10) ? digital_root(num) : num\nend", "def super_digit(n)\n\n return n if n < 10\n super_digit(n.digits.sum)\n\nend", "def lvlres\n @level = 0\n lvlup\n end", "def fourth_child\n child 3\n end", "def get_node_level(node, key)\n get_level_of_node(node, key, 1)\nend", "def log10\n math :log10\n end", "def level_bonus\n (MAX_LEVEL - level) / MAX_LEVEL\n end", "def nesting(n)\n $nest[n] ||= \"(2 + 1/#{nesting(n-1)})\"\nend", "def subScore(n)\n subTotal=0\n case \n when n==0 #first place\n subTotal = subTotal + 15\n when n==1 #second place \n subTotal = subTotal + 10\n when n==2 #3rd place \n subTotal = subTotal + 5 \n when n==3 #4th place\n subTotal = subTotal + 3\n when n==4 #5th place\n subTotal = subTotal + 1 \n else \n end #case\n end", "def super_digit(n)\n return n if n < 10\n count = add_digits(n)\n return super_digit(count)\n\nend", "def get_depth\n raise \"Not implemented\"\n end", "def level\n\t\tlevel = 0\n\t\t@classes.each do |_class|\n\t\t\tlevel += _class.level\n\t\tend\n\t\tlevel\n\tend", "def base_popularity\n 10\n end", "def get_tree_height(d,cnt = 0 )\n \n if ( d['l'] == {} && d['r'] == {} )\n @depth = cnt if @depth < cnt\n else\n cnt = cnt + 1\n get_tree_height(d['l'],cnt) if d.key?('l')\n get_tree_height(d['r'],cnt) if d.key?('r')\n end\n \n return @depth\n \nend", "def level\n @level\n end", "def level\n @level\n end", "def effective_level\n level + level_bonus\n end", "def leaf_count\n @leaf_count\n end", "def level\n parent_id.nil? ? 0 : compute_level\n end", "def max_nesting()\n #This is a stub, used for indexing\n end", "def get_cr_or_level(num_of_pcs, cr_or_level)\n if num_of_pcs <= 4\n @cr = cr_or_level\n elsif num_of_pcs == 5\n @cr = cr_or_level + (cr_or_level * 0.25)\n elsif num_of_pcs == 6\n @cr = cr_or_level + (cr_or_level * 0.5)\n elsif num_of_pcs == 7\n @cr = cr_or_level + (cr_or_level * 0.75)\n elsif num_of_pcs == 8\n @cr = cr_or_level + cr_or_level\n end\n end", "def super_digit(n)\n return n if n < 10\n\n return super_digit(n.digits.sum)\nend", "def calculate_level_raking(rank)\n value = 0\n if rank.include?(\"-\")\n value = rank.split(\"-\")[0].to_f + 0.5\n # if value = rank.split(\"-\")[0].to_i == 0\n # value = 0.5\n # elsif rank.split(\"-\")[0].to_i == 1\n # value = 1.5\n # else\n # value = rank.split(\"-\")[1].to_i / rank.split(\"-\")[0].to_i\n # end \n elsif rank.include?(\"++\")\n value = (rank.gsub(\"++\",\"\").to_i - 1) + 0.8\n else\n value = rank.to_i\n end\n \n return value\n end", "def depth\n breadcrumbs.size\n end", "def depth\n Sequel::SQL::NumericExpression.new(:NOOP, function(:depth, self))\n end", "def super_digit(n)\n #has to be a single digit \n if n < 10 \n return n\n else \n return super_digit(n.digits.sum)\n end \n \n \nend", "def by_level(range, max_at:)\n level >= max_at ? range.last :\n range.first + (((range.size - 1)/max_at.to_f)*level).to_i\n end", "def digital_root(num)\n if num < 10\n return num\n end\n recursion = num.to_s.split(\"\").map { |n| n.to_i }.reduce(:+)\n digital_root(recursion)\nend", "def randLevelOne\n a = rand(3)\n a = -1 if a == 2\n return a\n end", "def total_exp_level\n lvl = self.lvl\n return (100 * (1 - @@exp_mul ** (lvl - 1)) / (1 - @@exp_mul))\n end", "def depth_of(score)\n if include?(score) #This is calling the method on line 44\n 1 + @root_node.depth_of(score) \n else \n nil\n end \nend", "def dfs_levels(node, result, depth = 0)\n return if node.nil?\n\n result[depth] ||= [node.val.to_i, 1]\n\n result[depth] = [(result[depth].first + node.val.to_i), result[depth].last + 1]\n\n dfs_levels(node.left, result, depth + 1)\n dfs_levels(node.right, result, depth + 1)\nend", "def digital_root(num)\n\n total = digital_root_step(num)\n until total < 10\n total = digital_root_step(total)\n end\n total\nend", "def max_level_depth\n MAXIMUM_LEVEL_DEPTH\n end", "def getLevels\n @level\n end", "def digital_root(n)\n n < 10 ? n : digital_root(n / 10 + n % 10)\nend", "def depth_of(score, current = @head, count = 0)\n if current.score == nil\n nil\n elsif current.score > score\n count += 1 \n depth_of(score, current.left, count)\n elsif\n current.score < score \n count += 1\n depth_of(score, current.right, count)\n else\n count\n end\n end", "def level\n return 0 if self[nested_set_parent].nil?\n sql = %Q( SELECT COUNT(t2.id) - 1 AS level\n FROM #{nested_set_class.table_name} AS t1, #{nested_set_class.table_name} AS t2\n WHERE t1.lft BETWEEN t2.lft AND t2.rgt AND t1.id = #{id} AND #{nested_set_scope} )\n nested_set_class.count_by_sql sql\n end", "def test_depth_of_method\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(45, \"movie b\")\n tree.insert(40, \"movie c\")\n tree.insert(35, \"movie d\")\n assert_equal 3, tree.depth_of(35)\n end", "def num_tree_levels\n level = 0\n num_nodes= all_node_values_with_nil.length # considers tree as 'complete\n num_nodes_in_full_tree = 2**level\n until num_nodes_in_full_tree >= num_nodes\n level += 1\n num_nodes_in_full_tree += 2**level\n end\n num_tree_levels = level + 1 # (started count at 0)\n num_tree_levels = 0 if @root.nil?\n return num_tree_levels\n end", "def level\n is_root? ? nil : option_set.try(:level, depth)\n end", "def yourLvl(hash={})\n\t\tStats.level = hash['value'].slice(/\\d+/o)\n\tend", "def parent(i); (i-1)/2; end", "def total_node_number_cps(tree)\n callcc{|cc|\n helper_2(tree.root, cc, 0)\n }\nend", "def current_level\n @cur_level\n end", "def depth\n self[:depth]\n end", "def depth_max; depths.max end", "def level_up experience\n if experience > somenumber\n self.level += 1\n end\n end", "def left_child(indx)\n 2*indx + 1\n end", "def current_depth\n 0\n end", "def super_digit(n)\n super_digit_helper({}, n)\n \nend", "def equivalent_level\n parsed_hd = parse_dice(self.class::HIT_DICE)\n \n if parsed_hd[-2] == '-'\n return 1\n else\n return parsed_hd.first + 1 + (parsed_hd.size > 3 ? 1 : 0)\n end\n end", "def level\n length = 0\n cursor = self\n while cursor.parent_document\n length += 1\n cursor = cursor.parent_document\n end\n length\n end", "def super_digit(n)\n return n if n < 10\n return super_digit(n.digits.sum)\nend", "def potter2(books, level=5, debug=false)\n\n # end of recursion\n if level == 1 or books.length <= 1\n price = books.length * PRICE\n return [price, [books.counts]]\n end\n\n n = books.biggest_set_of( level )\n\n # we have to compare different alternatibes\n # will collet the prices + structures into these arrays:\n prices = Array.new(n, 0)\n structure = Array.new(n, [])\n\n # when removing no books, descend one level\n prices[0], structure[0] = potter2( books, level - 1, debug )\n\n # when removing 1 to n books, no need to descend by level\n (1..n).each do |i|\n books_left_over = books.remove_i_layers_of_n_tupels( i, level ) \n price_r, structure_r = potter2( books_left_over, level, debug )\n # total price = price for the removed books at current disount, plus price computed through recursion\n prices[i] = level * i * PRICE * DISCOUNTS[level-1] + price_r\n # total structure = i times the tupel of current level, plus structure computed through recursion\n structure[i] = [ Array.new( level, i ) ] + structure_r\n end\n\n if debug and n > 0 \n puts \n puts \"-- there are #{n+1} alternatives i found through recursion for the #{books.length} books on level #{level}:\"\n (0..n).each do | i |\n puts \"%5.2f for %s\" % [ prices[i], structure[i] ]\n end\n puts \"--\"\n end\n\n best_price = prices.min()\n i = prices.rindex( best_price )\n return best_price, structure[i]\nend", "def level\n return 0 if self[acts_as_nested_set_options[:parent_column]].nil?\n self.class.count(\"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:left_column]} < #{self[acts_as_nested_set_options[:left_column]]} and #{acts_as_nested_set_options[:right_column]} > #{self[acts_as_nested_set_options[:right_column]]})\")\n end", "def super_digit(n)\n return n if n < 10\n sum = super_digit_helper(n, 0)\n super_digit(sum)\nend", "def calc_numbers(n, indexes) #:nodoc:\n my_lft = n\n # performance improvements (3X or more for tables with lots of columns) by using :select to load just id, lft and rgt\n ## i don't use the scope condition here, because it shouldn't be needed\n my_children = self.class.find_in_nested_set(:all, :conditions => \"#{prefixed_parent_col_name} = #{self.id}\",\n :order => \"#{prefixed_left_col_name}\", :select => \"#{self.class.primary_key}, #{prefixed_left_col_name}, #{prefixed_right_col_name}\")\n if my_children.empty?\n my_rgt = (n += 1)\n else\n for c in (my_children)\n n = c.calc_numbers(n + 1, indexes)\n end\n my_rgt = (n += 1)\n end\n indexes << {:id => self.id, :lft => my_lft, :rgt => my_rgt} unless self[left_col_name] == my_lft && self[right_col_name] == my_rgt\n return n\n end", "def super_digit(n)\n return n if n < 10\n super_digit(n.digits.sum)\nend", "def super_digit(n)\n return n if n < 10\n super_digit(n.digits.sum)\nend", "def level\n return 0 if root?\n\n @parent.level + 1\n end", "def num_digits_10\n Math.log10(self).to_i + 1\n end" ]
[ "0.696101", "0.6956378", "0.67394006", "0.66480833", "0.65388536", "0.63859224", "0.63619447", "0.6301407", "0.62684315", "0.6243405", "0.6233843", "0.6192817", "0.6155028", "0.61303926", "0.6093857", "0.60903376", "0.60903376", "0.60903376", "0.60903376", "0.60903376", "0.60903376", "0.60871637", "0.6069788", "0.60448486", "0.6026618", "0.6009671", "0.6000392", "0.59776044", "0.5954601", "0.5951821", "0.59468496", "0.59468454", "0.5942258", "0.59394324", "0.59394324", "0.59282756", "0.5915968", "0.5904425", "0.5895816", "0.5880677", "0.58380854", "0.5826247", "0.5810411", "0.58089876", "0.58063567", "0.58029497", "0.58029264", "0.5795763", "0.5790192", "0.57797545", "0.5777744", "0.57773477", "0.57679695", "0.57679695", "0.5765412", "0.57524675", "0.57512903", "0.57456845", "0.57378745", "0.5736114", "0.57271737", "0.5723976", "0.5717769", "0.5713666", "0.5710503", "0.5709653", "0.5705805", "0.5704926", "0.5703426", "0.569646", "0.5695783", "0.56867504", "0.5677491", "0.56756324", "0.5655896", "0.5654441", "0.56445044", "0.5639454", "0.5638964", "0.5635863", "0.5625361", "0.56174594", "0.56160474", "0.56110096", "0.56102777", "0.5610267", "0.5608124", "0.5600768", "0.5594648", "0.5586613", "0.5585946", "0.5584926", "0.5577829", "0.5575019", "0.5573587", "0.5570261", "0.55685365", "0.55685365", "0.55541533", "0.555132" ]
0.6357107
7
Every side of the matrix has the same pattern of manhattan distances This method returns the starting manhattan distance
def initial_manhattan_distance(level) 2 * (level - 1) + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manhattan_distance(start_row, start_col, end_row, end_col)\n (end_row - start_row).abs + (end_col - start_col).abs\n end", "def manhattan_distance\n @position.map(&:abs).sum\n end", "def manhattan_distance(x1, y1, row_index, column_index)\n\t\t(x1 - row_index).abs + (y1 - column_index).abs\n\tend", "def manhattan_distance(tiles_order)\n manhattan_distance = 0\n tiles_order.each_with_index do |x, i|\n next if x == 9 # this skips the blank square.\n array_steps = ((i + 1) - x).abs\n puzzle_steps = (array_steps / 3) + (array_steps % 3)\n manhattan_distance += puzzle_steps\n end\n return manhattan_distance\n end", "def manhattan_distance(x1, y1, x2, y2)\n (x1 - x2).abs + (y1 - y2).abs\nend", "def manhattan_distance(n)\n x = 0\n y = 0\n (0..n).each do |i|\n # this bit was stolen from a SO answer and slightly modified. This kind of math\n # is terribly hard for me! See: https://stackoverflow.com/a/3715915\n j = Math.sqrt(i).round\n k = (j ** 2 - i).abs - j\n p = [k, -k].map {|l| (l + j ** 2 - i - (j % 2)) * 0.5 * (-1) ** j}.map(&:to_i)\n x = p[0].abs\n y = p[1].abs\n end\n x + y - 1\nend", "def manhattan_distance(other_grid)\n man_distance = 0\n self.each do |block|\n x, y = @block_to_loc[block] \n other_x, other_y = other_grid.block_to_loc(block)\n man_distance += (x - other_x).abs + (y - other_y).abs\n end\n man_distance\n end", "def manhattan_distance(target)\n sum = 0\n target.flatten.each do |number|\n sum += distance(number, target)\n end\n\n sum\n end", "def calculate_distancematrix\n n = @bondmatrix.get_number_of_columns\n @distance_matrix = Matrix2D.new(n,n)\n\n # replace all nil by inf 1.0/0\n 1.upto(n) do |i|\n 1.upto(n) do |j|\n value = @bondmatrix.get_value(i,j)\n if value\n @distance_matrix.set_value(i,j,value)\n else\n @distance_matrix.set_value(i,j,1.0/0)\n end\n end\n end\n\n 1.upto(n) do |k|\n 1.upto(n) do |i|\n 1.upto(n) do |j|\n # don't calculate distance from atom to self\n if i == j\n next\n end\n value = [@distance_matrix.get_value(i,j), \\\n @distance_matrix.get_value(i,k) \\\n + @distance_matrix.get_value(k,j)].min\n @distance_matrix.set_value(i,j,value)\n end\n end\n end\n\n end", "def manhattan_tourist(n, m, down, right)\n <<-DOC\n We now have the outline of a dynamic programming algorithm for finding the length of a longest path in the Manhattan Tourist Problem, \n called MANHATTANTOURIST. In the following pseudocode, downi, j and righti, j are the respective weights of the vertical and \n horizontal edges entering node (i, j). We denote the matrices holding (downi, j) and (righti, j) as Down and Right, respectively.\n\n Input: Integers n and m, followed by an n × (m + 1) matrix Down and an (n + 1) × m matrix Right.\n The two matrices are separated by the - symbol.\n Output: The length of a longest path from source (0, 0) to sink (n, m) in the n × m rectangular grid\n whose edges are defined by the matrices Down and Right.\n\n MANHATTANTOURIST(n, m, Down, Right)\n s0, 0 ← 0\n for i ← 1 to n\n s(i, 0) ← s(i-1, 0) + down(i, 0)\n for j ← 1 to m\n s(0, j) ← s(0, j−1) + right(0, j)\n for i ← 1 to n\n for j ← 1 to m\n s(i, j) ← max{s(i - 1, j) + down(i, j), s(i, j - 1) + right(i, j)}\n return s(n, m)\n DOC\n\n s = []\n (0..(n)).each {|i| s[i] = []}\n s[0][0] = 0 \n (1..(n)).each {|i| s[i][0] = s[i-1][0] + down[i-1][0] }\n (1..(m)).each {|j| s[0][j] = s[0][j-1] + right[0][j-1] }\n # puts s.join(\" \")\n (1..n).each do |i|\n (1..m).each do |j|\n s[i][j] = [s[i-1][j] + down[i-1][j] , s[i][j-1] + right[i][j-1] ].max\n end\n end\n return s[n][m]\n end", "def adjacent_mines(row, col)\n 0\n end", "def adjacent_mines(row, col)\n 0\n end", "def adjacent_mines(row, col)\n 0\n end", "def distance_members(matrix, i, j)\n distances = []\n distances[0] = matrix[i][j] / 2.to_f + (get_sum(matrix, i) - get_sum(matrix, j)) / (2.to_f * ($r - 2))\n distances[1] = matrix[i][j] - distances[0]\n distances\nend", "def blur_coordinate(row_number, column_number, distance)\n @array.each_with_index do |row, other_row_number|\n row.each_with_index do |cell, other_column_number|\n manhattan_distance = calculate_manhattan_distance(\n row_number,\n column_number,\n other_row_number,\n other_column_number\n )\n\n should_we_blur_it = manhattan_distance <= distance\n\n if should_we_blur_it == true\n @array[other_row_number][other_column_number] = 1\n end\n end\n end\n\n # (1..distance).each do |delta_row|\n # (1..distance).each do |delta_col|\n # #right\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number + delta_row, column_number + delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number + delta_row][column_number + delta_col] = 1\n # end\n #\n # #up\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number - delta_row, column_number + delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number - delta_row][column_number + delta_col] = 1\n # end\n #\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number - delta_row, column_number - delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number - delta_row][column_number - delta_col] = 1\n # end\n #\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number + delta_row, column_number - delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number + delta_row][column_number - delta_col] = 1\n # end\n # end\n # end\n end", "def min_distance(word1, word2)\n dp = Array.new(word1.size + 1) { Array.new(word2.size + 1) }\n\n # increment values in 1st row and col\n (0...dp.size).each do |i|\n dp[i][0] = i\n end\n (0...dp[0].size).each do |j|\n dp[0][j] = j\n end\n\n (1...dp.size).each do |i|\n (1...dp[0].size).each do |j|\n dp[i][j] = if word1[i - 1] == word2[j - 1]\n # if chars are same, value will be from diagonal upward\n dp[i - 1][j - 1]\n else\n [\n dp[i - 1][j - 1],\n dp[i][j - 1],\n dp[i - 1][j]\n ].min + 1\n end\n end\n end\n dp[-1][-1]\nend", "def distance(m1, m2)\n n = m1.size\n sum = 0.0\n n.times do |i|\n n.times do |j|\n dif = m2[i][j] - m1[i][j]\n sum += dif * dif\n end\n end\n sum\nend", "def distance_others(distance_matrix, i, j)\n distances = []\n for k in 1...distance_matrix.length\n next if k == i || k == j\n distances.push((distance_matrix[i][k] + distance_matrix[j][k] - distance_matrix[i][j]) / 2.to_f)\n end\n distances\nend", "def build_distance_matrix\n result = []\n\n Game.size.times do |i|\n result << []\n\n Game.size.times do |j|\n xi = i % Game.width\n yi = i / Game.width\n xj = j % Game.width\n yj = j / Game.width\n\n result[i][j] = (xi - xj).abs + (yi - yj).abs\n end\n end\n\n result\n end", "def identify_neighbours\n @x.times{ |r|\n @y.times{|c| \n #+1,+1 0,+1 +1,0\n @mat[r][c].add_neighbour @mat[r+1][c+1] unless @mat[r+1].nil? || @mat[r+1][c+1].nil?\n @mat[r][c].add_neighbour @mat[r][c+1] unless @mat[r].nil? || @mat[r][c+1].nil?\n @mat[r][c].add_neighbour @mat[r+1][c] unless @mat[r+1].nil? || @mat[r+1][c].nil?\n \n #-1,-1 0,-1 -1,0\n @mat[r][c].add_neighbour @mat[r-1][c-1] unless @mat[r-1].nil? || @mat[r-1][c-1].nil?\n @mat[r][c].add_neighbour @mat[r-1][c] unless @mat[r-1].nil? || @mat[r-1][c].nil?\n @mat[r][c].add_neighbour @mat[r][c-1] unless @mat[r].nil? || @mat[r][c-1].nil?\n \n #+1,-1 -1,+1\n @mat[r][c].add_neighbour @mat[r-1][c+1] unless @mat[r-1].nil? || @mat[r-1][c+1].nil?\n @mat[r][c].add_neighbour @mat[r+1][c-1] unless @mat[r+1].nil? || @mat[r+1][c-1].nil?\n \n }\n \n } \n end", "def diag_abs(mat)\n\tdiag1 = 0\n\tdiag2 = 0\n\t(0..mat.size-1).each do |i|\n \tdiag1 += mat[i][i].to_i\n \tdiag2 += mat[i][mat.size-i-1].to_i\n\tend\n\t(diag1-diag2).abs\nend", "def manhattan(people, target_index, ratio_index, ratio)\n (0...people.length).each do |index|\n next unless unless_true(people, index, target_index)\n\n next unless manhattan_formula(people, index, target_index) < ratio\n\n ratio = manhattan_formula(people, index, target_index)\n ratio_index = index\n end\n puts \"manhattan-Atitikmuo: #{ratio_index} asmuo, ugis:#{people[ratio_index].height}\"\nend", "def dist_matrix feature\n n = feature.length\n dmatrix = Array.new(n) { Array.new(n, 0) }\n for i in (0..n-1)\n for j in (i..n-1)\n dmatrix[i][j] = dist(feature[i], feature[j])\n dmatrix[j][i] = dmatrix[i][j]\n end\n end\n return dmatrix\nend", "def sortManhattan(point)\n return point[0].abs + point[1].abs\nend", "def edit_distance_dp(str1, str2, m, n)\n\n mtrx = Array.new(m+1){Array.new(n+1)}\n\n mtrx[0][0] = 0\n\n for i in 1...m+1\n mtrx[i][0] = i\n end\n\n for i in 1...n+1\n mtrx[0][i] = i\n end\n\n for i in 1...m+1\n for j in 1...n+1\n\n if(str1[i-1] == str2[j-1])\n mtrx[i][j] = mtrx[i-1][j-1]\n else\n mtrx[i][j] = [mtrx[i-1][j-1], mtrx[i-1][j], mtrx[i][j-1]].min + 1\n end\n\n end\n end\n\n puts mtrx[m][n]\n\nend", "def adjacent_mines(row, col)\n count = 0\n if col < @column_count-1\n count+=1 unless @grid[row][col+1].fill.nil?\n end\n if col > 0\n count +=1 unless @grid[row][col-1].fill.nil?\n end\n if row < @row_count-1\n count+=1 unless @grid[row+1][col].fill.nil?\n end\n if row > 0\n count+=1 unless @grid[row-1][col].fill.nil?\n end\n if row < @row_count-1 && col < @column_count-1\n count+=1 unless @grid[row+1][col+1].fill.nil?\n end\n if row > 0 && col > 0\n count+=1 unless @grid[row-1][col-1].fill.nil?\n end\n if row > 0 && col < @column_count-1\n count +=1 unless @grid[row-1][col+1].fill.nil?\n end\n if row < @row_count-1 && col > 0\n count +=1 unless @grid[row+1][col-1].fill.nil?\n end\n count\n end", "def adjacent_mines(row, col)\n @total = 0\n if @mine_field[:bombs][col-1][row] == true\n @total+=1\n end\n if @mine_field[:bombs][col-1][row-1] == true\n @total+=1\n end\n if @mine_field[:bombs][col-1][row+1] == true\n @total+=1\n end\n if @mine_field[:bombs][col+1][row] == true\n @total+=1\n end\n if @mine_field[:bombs][col+1][row-1] == true\n @total+=1\n end\n if @mine_field[:bombs][col+1][row+1] == true\n @total+=1\n end\n if @mine_field[:bombs][col][row-1] == true\n @total+=1\n end\n if @mine_field[:bombs][col][row+1] == true\n @total+=1\n end\n @total\n end", "def manhattan_heuristic(open_squares)\n smallest_f = nil\n smallest_f_point = nil\n open_squares.each do |neighbor|\n g_score = calculate_g(neighbor)\n h_score = calculate_h(neighbor)\n f_score = h_score + g_score\n if smallest_f.nil? || f_score < smallest_f\n smallest_f = f_score\n smallest_f_point = neighbor\n end\n end\n smallest_f_point\n end", "def adjacent_mines(row, col)\n count = 0\n (-1..1).each do |i|\n (-1..1).each do |j|\n unless (i == 0 && j == 0) || (row + i) < 0 || (col + j) < 0\n if contains_mine?(row + i, col + j)\n count += 1\n end\n end\n end\n end\n count\n end", "def hamming_distance(arr)\n count = 0\n arr.first.each_char.with_index do |char, idx|\n count += 1 if char != arr.last[idx]\n end\n count\nend", "def adjacent_mines(row, col)\n count = 0\n (-1..1).each do |i|\n (-1..1).each do |j|\n unless (i == 0 && j == 0) || (row + i) < 0 || (col + j) < 0\n count += 1 if contains_mine?(row + i, col + j)\n end\n end\n end\n\n count\n end", "def mine_total(i, j)\n return is_mined(@data[i-1][j-1]) +\n is_mined(@data[i-1][j]) +\n is_mined(@data[i-1][j+1]) +\n is_mined(@data[i][j-1]) +\n is_mined(@data[i][j+1]) +\n is_mined(@data[i+1][j-1]) +\n is_mined(@data[i+1][j]) +\n is_mined(@data[i+1][j+1]);\n end", "def within_manhatten_distance?(r1, c1, r2, c2, distance)\n (r1 - r2).abs + (c1 - c2).abs <= distance\nend", "def HammingDistance(strArr)\n hamming = 0\n\n (0...strArr[0].length).each do |i|\n if strArr[0][i] != strArr[1][i]\n hamming += 1\n end\n end\n\n hamming\nend", "def calculate_group_distance\n sum = 0.0\n @patterns.each { |pattern|\n sum += calculate_distance(pattern.features, @center.features)\n }\n sum\n end", "def adjacent_mines(row, col)\n count = 0\n if @field[row + 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row + 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil?\n count = 0\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n elsif @field[row + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n elsif @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n else\n count = 0\n adjacent_cells(row, col).each do |cell|\n if cell.contains_mine?\n count += 1\n end\n end\n end\n count\n end", "def adjacent_mines(row, col)\n number_of_mines = 0\n spaces_to_scan = find_spaces_to_scan(row, col)\n spaces_to_scan.each do |space|\n number_of_mines += 1 if contains_mine?(space[0], space[1])\n end\n number_of_mines\n end", "def create_distance_matrix(type=\"Num_Mums\",folder=\"level_0\",filename=\"new_mums.csv\")\n\tarr = read_csv(\"pairwise_mums/\"+folder+\"/\"+filename)\n\tarr_i = make_m_ints(arr[1...arr.size])\n\tindex = arr[0].index(type)\n\tfirsts = arr_i.map{|x| x[0]}\n\tseconds = arr_i.map{|x| x[1]}\n\tids = firsts+seconds\n\tids.uniq!\n\tm = []\n\t(0...ids.size).each do |i|\n\t\tm[i] = []\n\t\tm[i][i] = 0\n\tend\n\tmax = arr_i[0][index]\n\tarr_i.each do |x|\n\t\tif (max < x[index])\n\t\t\tmax = x[index]\n\t\tend\n\t\tm[ids.index(x[1])][ids.index(x[0])] = -x[index]\n\t\tm[ids.index(x[0])][ids.index(x[1])] = -x[index]\n\tend\n\tm.map!{|x| x.map{|y| if (y != 0) then y+max+1 else y end}}\n\n\tsave_matrix(ids,m,\"pairwise_mums/\"+folder+\"/\"+type+\"_distance.csv\")\nend", "def mapee i=0\n dist[i][0]\n end", "def get_diagonal_difference(\n matrix:\n )\n primary_dia, secondary_dia = 0, 0\n array_length = matrix[0].length - 1\n # Calculate diagonal sum\n (0...matrix[0].length).each do |index|\n \tprimary_dia += matrix[index][index]\n \tsecondary_dia += matrix[index][array_length]\n \tarray_length -= 1\n end\n # Return absolute value of the difference between to diagonals\n (primary_dia - secondary_dia).abs\nend", "def distance_matrix(nodes = nil)\n nodes ||= self.leaves\n matrix = []\n nodes.each_index do |i|\n row = []\n nodes.each_index do |j|\n if i == j then\n distance = 0\n elsif r = matrix[j] and val = r[i] then\n distance = val\n else\n distance = (self.distance(nodes[i], nodes[j]) rescue nil)\n end\n row << distance\n end\n matrix << row\n end\n Matrix.rows(matrix, false)\n end", "def edit_distance(str1, str2)\n m = str1.length\n n = str2.length\n\n i = 0\n dp = []\n while i < m do\n j = 0\n while j < n do\n if i == 0\n dp[i][j] = j\n elsif j == 0\n dp[i][j] = i\n elsif str1[i-1] == str2[j-1]\n dp[i][j] = dp[i-1][j-1]\n else\n dp[i][j] = [dp[i-1][j-1], dp[i-1][j], dp[i][j-1] ].min + 1\n end\n j += 1\n end\n i += 1\n end\n puts dp[m][n]\nend", "def diagonal_difference(matrix)\n # find first diagonal\n first = []\n i = 0\n j = matrix[i].length-1\n while i < matrix.length\n first << matrix[i][j]\n i += 1 #1\n j -= 1 #1 \n end\n \n sum1 = first.reduce(:+)\n # loop through array of array adjusting for subindex\n second = []\n k = 0\n while k < matrix.length\n second << matrix[k][k]\n k += 1\n end\n \n sum2 = second.reduce(:+)\n \n (sum1-sum2).abs\n \n \n # find second diagonal\n # get abs diff\nend", "def min_distance_pattern_dna(pattern, dna)\n pattern.upcase!\n # d(Pattern,Dna) = ∑ d(Pattern,Dna[i]).\n min_dist = 0\n dna.each do |text|\n text.upcase!\n min_dist += min_distance_pattern_text(pattern, text)\n end\n return min_dist\n end", "def adjacent_mines(row, col)\n count = 0\n if within_field?(row, col)\n if within_field?(row - 1, col) && contains_mine?(row - 1, col)\n count += 1\n end\n if within_field?(row - 1, col - 1) && contains_mine?(row - 1, col - 1)\n count += 1\n end\n if within_field?(row - 1, col + 1) && contains_mine?(row -1, col + 1)\n count += 1\n end\n if within_field?(row, col - 1) && contains_mine?(row, col - 1)\n count += 1\n end\n if within_field?(row, col + 1) && contains_mine?(row, col + 1)\n count += 1\n end\n if within_field?(row + 1, col) && contains_mine?(row + 1, col)\n count += 1\n end\n if within_field?(row + 1, col - 1) && contains_mine?(row + 1, col - 1)\n count += 1\n end\n if within_field?(row + 1, col + 1) && contains_mine?(row + 1, col + 1)\n count += 1\n end\n end\n count\n end", "def adjacent_mines(row, col)\n mines_nearby = 0\n range = [-1, 0, 1]\n range.each do |range_x|\n range.each do |range_y|\n x_adj = row + range_x\n y_adj = col + range_y\n if cell_exists?(x_adj,y_adj)\n mines_nearby += 1 if contains_mine?(x_adj, y_adj)\n end\n end\n end\n mines_nearby\n end", "def neighbor_friends dist\n\t\tmake_friends\n\n\t\tneighbors = []\n\t\t@friends.each do |a|\n\t\t\tbreak if a[1] > dist\n\n\t\t\tneighbors << a[0]\n\t\tend\n\n\t\tneighbors\n\tend", "def attack_cells(from, _chessboard)\n (DiagonalMoves.directions + AxisAlignedMoves.directions)\n .map { |direction| from + direction }\n .reject(&:nil?)\n end", "def dynamicEditDistance(str1, str2)\n matrix = Array.new(str1.length + 1) { Array.new(str2.length + 1) }\n\n # Set up first row of matrix\n (0...matrix[0].length).each do |i|\n matrix[0][i] = i\n end\n\n # Set up first column of matrix\n (0...matrix.length).each do |i|\n matrix[i][0] = i\n end\n\n # Build the matrix\n (1..str1.length).each do |i|\n (1..str2.length).each do |j|\n # If the current letters are the same, we take the old value\n # since there is no edit distance. Otherwise, we take the minimum\n # of the three values of substituion, deletion, or insertion\n if str1[i-1] == str2[j-1]\n matrix[i][j] = matrix[i-1][j-1]\n else\n matrix[i][j] = 1 + min(matrix[i-1][j-1], matrix[i-1][j], matrix[i][j-1])\n end\n end\n end\n\n return matrix[str1.length][str2.length]\nend", "def neighbor()\n m1 = random_match\n m2 = random_match\n find_best_permutation([:permutation_one, :permutation_two,\n :permutation_three, :permutation_four],\n m1, m2)\n self\n end", "def calculate_neighbor_mines\n @board.each_with_index do |row, row_index|\n row.each_with_index do |element, index|\n neighbor_bomb_count = 0\n if element != \"*\" && index == 0 && row_index == 0\n neighbor_bomb_count += 1 if @board[row_index][index + 1] && @board[row_index][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index] && @board[row_index + 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index + 1] && @board[row_index + 1][index + 1] == \"*\"\n neighbor_bomb_count == 0 ? @board[row_index][index] = \" \" : @board[row_index][index] = neighbor_bomb_count\n elsif element != \"*\" && row_index == 0\n neighbor_bomb_count += 1 if @board[row_index][index - 1] && @board[row_index][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index][index + 1] && @board[row_index][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index - 1] && @board[row_index + 1][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index] && @board[row_index + 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index + 1] && @board[row_index + 1][index + 1] == \"*\"\n neighbor_bomb_count == 0 ? @board[row_index][index] = \" \" : @board[row_index][index] = neighbor_bomb_count\n elsif element != \"*\" && index == 0\n neighbor_bomb_count += 1 if @board[row_index - 1][index] && @board[row_index - 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index - 1][index + 1] && @board[row_index - 1][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index][index + 1] && @board[row_index][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index] && @board[row_index + 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index + 1] && @board[row_index + 1][index + 1] == \"*\"\n neighbor_bomb_count == 0 ? @board[row_index][index] = \" \" : @board[row_index][index] = neighbor_bomb_count\n elsif element != \"*\"\n neighbor_bomb_count += 1 if @board[row_index - 1][index - 1] && @board[row_index - 1][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index - 1][index] && @board[row_index - 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index - 1][index + 1] && @board[row_index - 1][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index][index - 1] && @board[row_index][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index][index + 1] && @board[row_index][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index - 1] && @board[row_index + 1][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index] && @board[row_index + 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index + 1] && @board[row_index + 1][index + 1] == \"*\"\n neighbor_bomb_count == 0 ? @board[row_index][index] = \" \" : @board[row_index][index] = neighbor_bomb_count\n end\n end\n end\n end", "def steps(maze)\n width = maze[0].length\n height = maze.length\n\n dup = Array.new(height) { Array.new(width) {0} }\n\n i = 0\n # across the top\n while i < width\n if maze[0][i] == 1\n dup[0][i] = 1\n else\n break\n end\n i += 1\n end\n\n j = 0\n # across the left side\n while j < height\n if maze[j][0] == 1\n dup[j][0] = 1\n else\n break\n end\n j += 1\n end\n\n i = 1\n j = 1\n # center\n while j < height\n while i < width\n if maze[j][i] == 1\n counter = 0\n # above\n if maze[j - 1][i] == 1\n counter += dup[j - 1][i]\n end\n # left\n if maze[j][i - 1] == 1\n counter += dup[j][i - 1]\n end\n dup[j][i] = counter\n end\n i += 1\n end\n i = 1\n j += 1\n end\n\n dup[height - 1][width - 1]\nend", "def direct_friends_of(i)\n friends_of_current = []\n for j in 0..MATRIX.length-1\n if MATRIX[j][i-1] == 1 || MATRIX[i-1][j] == 1\n friends_of_current << j+1\n end \n end\n return friends_of_current \nend", "def step_one\n matrix.map_rows! do |row|\n min = row.min\n row.map { |cell| cell - min }\n end\n end", "def get_destination\n dest_pos = nil\n (0..(@matrix.length - 1)).each { |x| (0..(@m - 1)).each { |y| dest_pos = Point.new(x, y) if @matrix[x][y] == '*' } }\n dest_pos\n end", "def distance_to(cell)\n (@x - cell.x).abs + (@y - cell.y).abs\n end", "def manhattan_heuristic(queue)\n queue.inject do |chosen_point, point|\n old_f = find_manhattan_estimate(chosen_point)\n new_f = find_manhattan_estimate(point)\n old_f > new_f ? point : chosen_point\n end\n end", "def full_row_distance\n @full_row_distance ||= compute_distance\n end", "def distance(array)\n orientation = 'N'\n position = [0, 0]\n\n array.each do |e|\n turn = e[0]\n distance = calc_distance(e)\n orientation = new_dir(orientation, turn)\n position = jump_to_new_position(orientation, position, distance)\n end\n\n print 'Distance to last position: '\n p dis_comb(position)\nend", "def point_cluster_distance dmatrix, cluster\n n = dmatrix.length\n nc = cluster.length\n pcdmatrix = Array.new(n) { Array.new(nc, 0) }\n for i in (0..n-1) \n for j in (0..nc-1)\n # pcdmatrix[i] records the distances from point i to all clusters\n pcdmatrix[i][j] = cluster[j].reduce(0) {|sum, ci| sum + dmatrix[i][ci]}\n end\n end\n return pcdmatrix \nend", "def minesweeper(matrix)\n height = matrix.count - 1\n width = matrix[0].count - 1\n\n finalArray = Array.new\n \n for i in 0..height\n temp = Array.new\n for j in 0..width\n temp << check33(matrix, j, i)\n end\n finalArray << temp\n end\n finalArray\nend", "def adjacent_mines(row, col)\n\n count = 0\n\n count += 1 if (row + 1) < row_count && grid[row+1][col].fill == 1\n count += 1 if (row - 1) >= 0 && grid[row-1][col].fill == 1\n count += 1 if (col + 1) < column_count && grid[row][col+1].fill == 1\n count += 1 if (col -1) >= 0 && grid[row][col-1].fill == 1\n count += 1 if (row + 1) < row_count && (col + 1) < column_count && grid[row+1][col+1].fill == 1\n count += 1 if (row + 1) < row_count && (col -1) >= 0 && grid[row+1][col-1].fill == 1\n count += 1 if (row - 1) >= 0 && (col + 1) < column_count && grid[row-1][col+1].fill == 1\n count += 1 if (row - 1) >= 0 && (col -1) >= 0 && grid[row-1][col-1].fill == 1\n\n return count\n end", "def HammingDistance(arr)\n first_str = arr[0].chars\n sec_str = arr[1].chars\n hamm_dis_count = []\n (0..first_str.size).each do |index|\n if first_str[index] != sec_str[index]\n hamm_dis_count << first_str[index]\n end\n end\n hamm_dis_count.size\nend", "def hamming_distance(other)\n self_array = self.to_a\n other_array = other.to_a\n self_array.zip(other_array).reduce(0) do |hamming, symbols|\n hamming += symbols[0] == symbols[1] ? 0 : 1\n end\n end", "def adjacent_mines(row, col)\n left = @field[row][col - 1] unless col - 1 < 0\n top_left = @field[row -1][col -1] unless row -1 < 0 || col -1 < 0\n bot_left = @field[row +1][col -1] unless row + 1 > @row_count - 1 || col -1 < 0\n right = @field[row][col + 1] unless col + 1 > @column_count - 1\n top_right = @field[row -1][col +1] unless row -1 < 0 || col + 1 > @column_count - 1\n bot_right = @field[row +1][col +1] unless row + 1 > @row_count - 1 || col + 1 > @column_count -1\n top = @field[row -1][col] unless row - 1 < 0\n bottom = @field[row +1][col] unless row + 1 > @row_count - 1\n\n mines_nearby = 0\n mines_nearby += 1 if !left.clear? if !left.nil?\n mines_nearby += 1 if !top_left.clear? if !top_left.nil?\n mines_nearby += 1 if !bot_left.clear? if !bot_left.nil?\n mines_nearby += 1 if !right.clear? if !right.nil?\n mines_nearby += 1 if !top_right.clear? if !top_right.nil?\n mines_nearby += 1 if !bot_right.clear? if !bot_right.nil?\n mines_nearby += 1 if !top.clear? if !top.nil?\n mines_nearby += 1 if !bottom.clear? if !bottom.nil?\n mines_nearby\n end", "def damerau_levenshtein(other)\n n, m = self.length, other.length\n return m if n == 0\n return n if m == 0\n matrix = Array.new(n+1) do |i|\n Array.new(m+1) do |j|\n if i == 0 then j\n elsif j == 0 then i\n else 0 end\n end\n end\n (1..n).each do |i|\n (1..m).each do |j|\n cost = (self[i] == other[j]) ? 0 : 1\n delete = matrix[i-1][j] + 1\n insert = matrix[i][j-1] + 1\n substitution = matrix[i-1][j-1] + cost\n matrix[i][j] = [delete, insert, substitution].min\n if (i > 1) && (j > 1) && (self[i] == other[j-1]) && (self[i-1] == other[j])\n matrix[i][j] = [matrix[i][j], matrix[i-2][j-2] + cost].min\n end\n end\n end\n return matrix.last.last\n end", "def adjacent_mines(row, col)\n mine_count = 0\n #check the 3 squares above if we're not in the top row\n if row > 0\n if col > 0\n if @mines[row-1][col-1] == true\n mine_count += 1\n end\n end\n if @mines[row-1][col] == true\n mine_count += 1\n end\n if col < column_count-1\n if @mines[row-1][col+1] == true\n mine_count += 1\n end\n end\n end\n\n #check the 3 squares below if we're not in the bottom row\n if row < row_count - 1\n if col > 0\n if @mines[row+1][col-1] == true\n mine_count += 1\n end\n end\n if @mines[row+1][col] == true\n mine_count += 1\n end\n if col < column_count-1\n if @mines[row+1][col+1] == true\n mine_count += 1\n end\n end\n end\n\n #check the square to the left\n if col > 0\n if @mines[row][col-1] == true\n mine_count += 1\n end\n end\n\n #check the square to the right\n if col < column_count-1\n if @mines[row][col+1] == true\n mine_count += 1\n end\n end\n mine_count\n end", "def md_array(target)\n md_array = [[],[],[]]\n\n target.each_index do |row_index|\n target[row_index].each_index do |col_index|\n md_array[row_index][col_index] =\n distance(target[row_index][col_index], target)\n end\n end\n\n md_array\n end", "def generate_adjacencies(board)\n b2 = duplicate(board)\n b2.each_with_index do |row, y_idx|\n row.each_with_index do |cell, x_idx|\n next unless cell == MINE\n increment_neighbors(b2, [x_idx, y_idx])\n end\n end\nend", "def neighborhood(cell)\n Set.new((cell[0]-1..cell[0]+1).map{|x| (cell[1]-1..cell[1]+1).map{|y| [x,y]}}.\n flatten(1)) - Set.new([cell])\nend", "def adjacent_mines(row, col)\n count = 0\n adjacent_cells(row,col).each do |cell|\n if @mine_field[cell]\n count += 1\n end\n end\n\n count\n end", "def calculate(route)\n dist = 0\n route.each_cons(2) { |points| dist = dist + points[0].distance(points[1])}\n dist\nend", "def levenshtein_distance(first, second)\n matrix = [(0..first.length).to_a]\n (1..second.length).each do |j|\n matrix << [j] + [0] * first.length\n end\n\n (1..second.length).each do |i|\n (1..first.length).each do |j|\n matrix[i][j] = if first[j - 1] == second[i - 1]\n matrix[i - 1][j - 1]\n else\n [\n matrix[i - 1][j],\n matrix[i][j - 1],\n matrix[i - 1][j - 1]\n ].min + 1\n end\n end\n end\n matrix.last.last\n end", "def distance\n return nil unless @locations.size > 1\n locations.each_cons(2).reduce(0) do |acc, (loc1, loc2)|\n acc + loc1.distance_to(loc2)\n end\n end", "def min_cost_connect_points(points)\n total = 0\n visited = [true] + [false] * (points.length - 1)\n min_costs = {}\n current_id = 0\n\n (points.length - 1).times do\n min = nil\n next_id = nil\n points.each_with_index do |point, index|\n next if visited[index]\n\n new_min = manhattan_distance(points[current_id], points[index])\n\n if !min_costs[index] || min_costs[index] > new_min\n min_costs[index] = new_min\n else\n new_min = min_costs[index]\n end\n\n if !min || new_min < min\n min = min_costs[index] < new_min ? min_costs[index] : new_min\n next_id = index\n end\n end\n\n total += min\n visited[next_id] = true\n current_id = next_id\n end\n\n total\nend", "def find_closest_distance\n closest_distance = 1\n closest_clusters = [nil, nil]\n\n @clusters.combination(2) do |c|\n dist = c[0].distance_to(c[1])\n if dist < closest_distance\n closest_distance = dist\n closest_clusters = [c[0], c[1]]\n end\n end\n\n return closest_distance, closest_clusters[0], closest_clusters[1]\n end", "def distance\n distance = 0\n @solution.each { |route| distance += route.distance }\n return distance\n end", "def any_mines_detonated?\n @board.each do |row|\n row.each do |cell|\n if cell.detonated?\n return true\n end\n end\n end\n false\n end", "def diagonalDifference(arr)\n # Write your code here\n d1 = 0\n d2 = 0\n\n (0..arr.length - 1).each do |i|\n d1 = d1 + arr[i][i]\n d2 = d2 + arr[-i-1][i]\n end\n (d1 - d2).abs\nend", "def diagonal_search \n diagonal = []\n diagonal_words = []\n search = @@boards_templates[1].to_s.scan(/./).each_slice(5).to_a\n for ca in 2..7 \n down = ca \n for row in 0..ca\n if row <= 4 \n diagonal << search[down][row]\n down -= 1 \n end \n end \n end\n diagonal = diagonal.join \n @@boards_templates[0].each { |x| diagonal.include?(x) ? diagonal_words << x : diagonal_words.reverse.include?(x) ? diagonal_words << x : \"No hay palabras en dirección diagonal\" }\n #diagonal_words \n end", "def dist(start,target)\n return @matriks_data[start,target]\n end", "def min_distance(word1, word2)\n dp = Array.new(word1.size + 1) { Array.new(word2.size + 1) }\n \n for i in 0...dp.size\n dp[i][0] = i \n end\n for j in 0...dp[0].size\n dp[0][j] = j\n end\n \n for i in 1...dp.size\n for j in 1...dp[0].size\n if word1[i - 1] == word2[j - 1]\n dp[i][j] = dp[i-1][j-1]\n else\n dp[i][j] = [\n dp[i - 1][j],\n dp[i][j - 1],\n dp[i - 1][j - 1],\n ].min + 1\n end\n end\n end\n \n dp[-1][-1]\nend", "def diagonalDifference(arr)\n n = arr.length\n primary = (0..n - 1).reduce(0) do |sum, i|\n sum + arr[i][i]\n end\n secondary = (0..n - 1).reduce(0) do |sum, i|\n sum + arr[i][n - 1 - i]\n end\n (primary - secondary).abs\nend", "def gen_diagonal_up(row,col)\n array_diagonals =[]\n 0.upto(5).each do |num|\n if ( row - num < 0 || col + num > 6)\n break\n end\n\n array_diagonals << [row-num, col+num] \n end\n array_diagonals.map{|coordinates| @grid[coordinates[1]][coordinates[0]]}\n end", "def check_diag1(board)\n (0..2).to_a.each_with_object(Hash.new(0)) do |i, m|\n m[board[i][i]] += 1 if board[i][i]\n end\nend", "def distance\n distance = 0\n distance_2d = 0\n elev_change = 0\n num_waypoints = 0\n if @waypoints.nil? then self.load_processed_waypoints end\n ext_waypoints = self.extrapolated_waypoints()\n for waypoint in ext_waypoints do\n if waypoint.length < 3\n waypoint[2] = get_elevation(waypoint[0],waypoint[1])\n end\n end\n for i in 1..ext_waypoints.length-1\n waypointA = ext_waypoints[i-1]\n waypointB = ext_waypoints[i]\n #num_waypoints += 1 + sub_waypoints(waypointA, waypointB)\n elevation_diff = (waypointB[2]-waypointA[2])\n distance_flat = waypoint_distance(waypointA, waypointB)\n distance_3d = Math.sqrt(distance_flat**2 + elevation_diff**2)\n #pp [distance_3d, elevation_diff, distance_flat]\n distance += distance_3d\n distance_2d += distance_flat\n elev_change += elevation_diff.abs\n end\n return [distance, elev_change, distance_2d]\n \n end", "def check_diagonal1\n cell = @last_cell_played\n count = 1\n while cell.ld && cell.ld.color == cell.color\n cell = cell.ld\n end\n while cell.ru && cell.ru.color == cell.color\n cell = cell.ru\n count += 1\n end\n return true if count >= 4\n false\n end", "def distances_native(mode=:standard, diagonal=false)\n matrix = adjacencymatrix(mode, diagonal)\n # compute pathes (Floyd)\n matrix.each_index do |k|\n matrix.each_index do |i|\n matrix.each_index do |j|\n d = matrix[i][k]+matrix[k][j]\n matrix[i][j] = d if d<matrix[i][j]\n end\n end\n end\n end", "def gmaps_distance(row, index)\n row[:elements][index] ? row[:elements][index][:distance][:value] : 0\n end", "def neighbor_mines_count\n neighbor_cells.count(&:mine?)\n end", "def diag_in_delta?(m1, m0, eps = 1.0e-10)\n n = m1.row_size\n return false if n != m0.row_size or m1.column_size != m0.column_size\n n.times{|i|\n return false if (m1[i,i]-m0[i,i]).abs > eps\n }\n true\n end", "def distance(arrListe)\n km = 0\n arrListe.each_with_index do |val, index|\n km += dist @poi[val], @poi[arrListe[index.next]] unless arrListe[index.next] == nil\n end\n return km.round(3)\n end", "def allocate_distance(total)\n\t\t# TODO - should be a range from .5 - .2 incr of .05 - 6 possibilites\n\t\tincr = rand(0..5)\n\t\t@up.target_distance = total * (0.2 + (0.05 * incr))\n\n\t\ttotal -= @up.target_distance\n\n\t\t@down.target_distance = 200\n\t\ttotal -= @down.target_distance\n\n\t\t@main.target_distance = total\n\tend", "def antidiagonal_starts\n result = []\n # Insert the antidiagonal starts along the bottom edge first, beginning on\n # the right side\n (1..size).each do |n|\n result.push MatrixPosition.new(size-1, size-n)\n end\n\n # Start at 2 since the last iterator covered (size-1, 0)\n (2..size).each do |n|\n result.push MatrixPosition.new(size-n, 0)\n end\n\n result\n end", "def cost_of_transformation(magic_square, non_magic_square)\n cost = 0\n (0..2).each do |row|\n (0..2).each do |column|\n magic = magic_square[row][column]\n non_magic = non_magic_square[row][column]\n cost += (non_magic - magic).abs\n end\n end\n return cost\nend", "def find_closest!\n 1000.times { @particles.values.map(&:tick) }\n closest = @particles.values.min { |p1, p2| p1.manhattan_distance <=> p2.manhattan_distance }\n end", "def diagonals\n down_diag = []\n up_diag = []\n \n # push sets of coordinates that make up both diagonals\n 0.upto(@size - 1) do |idx|\n down_diag << [idx, idx]\n up_diag << [idx, @size - 1 - idx]\n end\n\n [down_diag, up_diag].map do |diag|\n diag.map { |pos| self[pos] }\n end\n end", "def distance_list\n [['5 miles', '5'], ['10 miles', '10'], ['15 miles', '15'], \n ['25 miles', '25'], ['35 miles', '35'], ['50 miles', '50'],\n ['75 miles', '75'], ['100 miles', '100']]\n end", "def d_neighbors_of_k_mer(pattern, k, d)\n # The d-neighborhood of the k-mer Pattern is the collection of all k-mers \n # that are at most Hamming distance d from Pattern.\n # How many 4-mers are in the 3-neighborhood of Pattern = TAGC? \n # Note that the d-neighborhood of Pattern includes Pattern.\n\n genome_alphabet = [\"A\",\"G\",\"C\",\"T\"]\n\n count = 0\n genome_alphabet.repeated_permutation(k).to_a.each do |kmer|\n count += 1 if hamming_distance(kmer.join(\"\"), pattern) <= d\n end\n return count\n end", "def cover_starred_zeroes!()\n num = 0 \n @matrix_size.times{|c|\n if col_has_star?(c)\n cover_col!(c)\n num += 1\n end\n }\n if num >= @matrix_size\n return :done\n else\n return 4\n end\n end" ]
[ "0.779156", "0.7598629", "0.7412143", "0.7281424", "0.71843666", "0.7012088", "0.6862326", "0.6808818", "0.63497883", "0.61440355", "0.611938", "0.611938", "0.611938", "0.59789044", "0.5950214", "0.5782146", "0.5776471", "0.5775573", "0.5755672", "0.5618482", "0.56021917", "0.55951923", "0.55656004", "0.55474293", "0.5514954", "0.54830486", "0.5444858", "0.5441168", "0.5438728", "0.5437927", "0.54278636", "0.54253817", "0.539211", "0.53836584", "0.53829825", "0.53774184", "0.53733337", "0.53641075", "0.53550977", "0.53416914", "0.53355825", "0.5334091", "0.5317213", "0.53044754", "0.529439", "0.52787155", "0.525303", "0.5252899", "0.5252014", "0.52513325", "0.52398443", "0.52261174", "0.5225506", "0.5219065", "0.5206444", "0.51970845", "0.51949435", "0.5186989", "0.51804763", "0.5160755", "0.5149257", "0.5148773", "0.51485133", "0.51447046", "0.51239866", "0.5106026", "0.5091621", "0.5087698", "0.5082175", "0.50782436", "0.5048532", "0.50430995", "0.503804", "0.5027876", "0.5018569", "0.5013944", "0.5012329", "0.50068736", "0.50063074", "0.50027806", "0.50004077", "0.49894854", "0.49878743", "0.49844998", "0.498271", "0.49770913", "0.4976728", "0.49753827", "0.49651998", "0.49632844", "0.49622568", "0.4962138", "0.49595654", "0.4956031", "0.4948646", "0.49465004", "0.49387434", "0.493365", "0.49312535", "0.4929386" ]
0.71164644
5
update product cache stock
def update_product_cache_stock self.product.update_cache_stock if self.product.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_product_cache_stock\n\t\t\tself.state_check_details.each do |scd|\n scd.update_product_cache_stock\n end\n\t\tend", "def update_stock\n \tproduct = FileOperations.search_by_name(self)\n \tproduct = product[0].split(';')\n \tself.id = product[0]\n \tself.name = product[1]\n \tself.price = product[2]\n \tself.company = product[3]\n \tself.stock = product[4].to_i - 1\n \tFileOperations.update(self)\n end", "def update_stock\n\t\tincrease_stock unless new_record?\n\t\tyield\n\t\tdecrease_stock\n\tend", "def perform\n update_null = \" or (stock is null and last_stock_reported_centry is not null)\"\n query = \"stock <> last_stock_reported_centry or ((stock is not null and last_stock_reported_centry is null)#{update_null if ENV[\"UPDATE_NULL_STOCK\"] == \"false\"})\"\n\n ::Product.where(query).each do |local_product|\n resp = centry.put('/conexion/v1/variants/sku.json', {}, {\"sku\": local_product[:sku], \"quantity\": local_product[:stock]})\n if (resp.code == \"200\")\n centry_variant_info = JSON.parse(resp.body)\n local_product[:last_stock_reported_centry] = centry_variant_info[\"quantity\"]\n local_product[:id_product_centry] = centry_variant_info[\"product_id\"]\n local_product.save!\n end\n end\n end", "def return_item_to_stock(product_id)\n\t\tproduct = Product.find(product_id)\n\t\tproduct.stock += 1\n\t\tproduct.save\n\tend", "def update_product\n if inbound_order? || quantity_adjustment?\n product.update(stock: product.stock + quantity)\n else outbound_order?\n product.update(stock: product.stock - quantity)\n end\n end", "def it_update_from_product_store\n product = params[:product]\n store = params[:store]\n tbl = params[:tbl]\n initial_stock = 0\n current_stock = 0\n # company = nil\n # product_company_price = nil\n average_price = 0\n if product != '0' && store != '0'\n stock = Stock.find_by_product_and_store(product, store)\n # Stocks\n initial_stock = stock.initial rescue 0\n current_stock = stock.current rescue 0\n # WAP\n average_price = product_average_price(product, store)\n end\n # Format numbers\n initial_stock = number_with_precision(initial_stock.round(4), precision: 4)\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n average_price = number_with_precision(average_price.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"initial\" => initial_stock.to_s, \"stock\" => current_stock.to_s,\n \"tbl\" => tbl.to_s, \"average_price\" => average_price.to_s }\n render json: @json_data\n end", "def quick_update_stock(filename)\n ThinkingSphinx::Deltas.suspend :supply_item do\n @updates.each do |upd|\n si = @supplier.supply_items.where(:supplier_product_code => upd[0]).first\n unless si.nil?\n if si.update_attributes(:stock => upd[1]) == true\n supplier_logger.info(\"[#{DateTime.now.to_s}] Quick stock update: #{si.to_s} now #{si.stock}\")\n else\n supplier_logger.error(\"[#{DateTime.now.to_s}] Quick stock update failed: #{si.to_s}, errors: #{si.errors.full_messages}\")\n end\n end\n end\n end\n Product.update_price_and_stock # Sync available products to the now changed supply items\n end", "def update_stock\n for charge in self.charges\n charge.item.update_attribute(:stock, (charge.item.stock.to_i-1)) \n end\n end", "def reset_values\n if ([\"stock_quantity\", \"available_quantity\"] & changed).present?\n Rails.cache.delete([:stock_cost, product_id, id ])\n\n\n end\n end", "def set_stock\n if params[:id]\n @stock = Stock.find(params[:id])\n elsif params[:ticker_symbol]\n @stock = Stock.find_by_ticker_symbol(params[:ticker_symbol])\n end\n @stock.update_price if @stock and Time.now - @stock.updated_at > 1.minute \n end", "def push\n API::SOAP::CatalogInventory::StockItem.update(self.product);\n end", "def set_stock\n @product_stock = ProductStock.find(params[:id])\n end", "def inc_stock\n\t\t@stock += 1\n\tend", "def update_stock(_product, _store, _quantity, _is_new)\n if _product.product_type.id != 2\n _stock = Stock.find_by_product_and_store(_product, _store)\n if !_stock.nil?\n _stock.current = _is_new ? _stock.current - _quantity : _stock.current + _quantity\n if !_stock.save\n return false\n end\n end\n end\n true\n end", "def update\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n ProductStock.transaction do\n if @product_stock.update_stock_history(params[:product_stock], params[:description]) &&\n @product_stock.triggered_update_attributes(params[:product_stock])\n format.html { redirect_to product_product_stocks_path(@product_stock.product), :notice => 'Product stock was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end\n end", "def update_stock\n operador = self.notas_creditos_debito.tipo == 'DevolucionCompra' ? -1 : 1\n if deleted?\n MercaderiaExtracto.eliminar_movimiento(self, self.notas_creditos_debito.fecha, cantidad * operador*-1)\n else\n MercaderiaExtracto.crear_o_actualizar_extracto(self, self.notas_creditos_debito.fecha, cantidad_was.to_f * operador, cantidad * operador)\n end\n end", "def change_inventory\n order_item_obj = OrderItem.last\n product_id = order_item_obj.product_id\n inventory_of_ordered_product = InventoryStock.where(product_id:product_id)\n quantity_in_inventory = inventory_of_ordered_product[0].quantity\n quantity_in_ordered_item = order_item_obj.quantity\n updated_quantity_in_inventory = quantity_in_inventory.to_i-quantity_in_ordered_item.to_i\n InventoryStock.where(product_id:product_id).update(quantity: updated_quantity_in_inventory)\n end", "def update_stock_market_places(product_stocks)\n messages = []\n lazada_stock_hash = {}\n zalora_stock_hash = {}\n product_stocks.each do |key, value|\n variant = Spree::Variant.find(key)\n begin\n value.each do |sp_key, stock_count|\n stock_product = Spree::StockProduct.find(sp_key)\n smpp = stock_product.sellers_market_places_product\n market_place = smpp.market_place\n user_market_place = Spree::SellerMarketPlace.where(\"seller_id=? AND market_place_id=?\", smpp.seller_id, market_place.id)\n case market_place.code\n when \"qoo10\"\n res = Spree::StockMovement.stock_update_qoo10(variant.product, market_place.id, stock_count, stock_product, user_market_place.first, smpp, stock_count)\n when \"lazada\"\n if lazada_stock_hash[user_market_place.first.id.to_s].present?\n lazada_stock_hash[user_market_place.first.id.to_s].first.merge!(variant.sku.to_s=>stock_count)\n else\n lazada_stock_hash.merge!(user_market_place.first.id.to_s=>[{variant.sku.to_s=>stock_count}])\n end\n when \"zalora\"\n if zalora_stock_hash[user_market_place.first.id.to_s].present?\n zalora_stock_hash[user_market_place.first.id.to_s].first.merge!(variant.sku.to_s=>stock_count)\n else\n zalora_stock_hash.merge!(user_market_place.first.id.to_s=>[{variant.sku.to_s=>stock_count}])\n end\n end\n messages << (market_place.name+\": \"+ res) if res.present? && res != true\n end\n rescue Exception => e\n messages << e.message\n end\n end # end of stock product loop\n # Update stock for lazada in bulk\n Spree::StockMovement.stock_update_lazada_bulk(lazada_stock_hash) if lazada_stock_hash.present?\n Spree::StockMovement.stock_update_lazada_bulk(zalora_stock_hash) if zalora_stock_hash.present?\n return messages.present? ? \"fail\" : \"success\"\n end", "def set_stock_product\n @stock_product = StockProduct.find(params[:id])\n end", "def update_stock_for_seller(seller, fetch_fba_qty)\n stock_values = {}\n inf_variant_ids = Spree::QuantityInflation.pluck(:variant_id)\n var_ids = Spree::Variant.where(:id=>inf_variant_ids).pluck(:product_id)\n # products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true AND kit_id IS NULL\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true AND kit_id IS NULL\"))\n products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true\"))\n products.each do |product|\n variants = []\n variants << (product.variants.present? ? product.variants : product.master)\n variants = variants.flatten\n type = STOCKCONFIG[product.stock_config_type] == \"default\" ? STOCKCONFIG[seller.stock_config_type] : STOCKCONFIG[product.stock_config_type]\n smps = seller.seller_market_places.where(:is_active=>true)\n mps = seller.market_places.where(\"spree_market_places.id IN (?)\", smps.map(&:market_place_id))\n variants.each do |variant|\n begin\n Spree::Variant.fetch_qty_from_fba(smps.first,variant) if fetch_fba_qty\n variant = variant.reload\n stock_products = variant.stock_products.where(\"sellers_market_places_product_id IN (?)\", product.sellers_market_places_products.where(\"market_place_id IN (?)\",smps.map(&:market_place_id)).map(&:id))\n if stock_products.present?\n case type\n when \"fixed_quantity\"\n stock_values.merge!(variant.id=>Spree::StockProduct.fixed_quantity_setting(stock_products, variant, mps)) if !fetch_fba_qty\n when \"percentage_quantity\"\n stock_values.merge!(variant.id=>Spree::StockProduct.fixed_quantity_setting(stock_products, variant, mps))\n #stock_values.merge!(variant.id=>Spree::StockProduct.percentage_quantity_setting(stock_products, variant, mps))\n when \"flat_quantity\"\n stock_values.merge!(variant.id=>Spree::StockProduct.flat_quantity_setting(stock_products, variant, mps))\n end # end of case\n end\n rescue Exception => e\n end\n end # end of variant loop\n end # end of product loop\n return update_stock_market_places(stock_values)\n end", "def return\n \t@stock += 1\n end", "def update_stock_on_create\n # Update current Stock\n if !update_stock(product, store, quantity, true)\n return false\n end\n true\n end", "def update_quant(item, quant)\n\t$grocery_list.store(item, quant)\n\tp \"You updated #{item} number to #{quant}.\"\nend", "def update_purchase_receival_stock_entry(purchase_receival_entry)\n self.quantity = stock_migration.quantity \n self.save \n \n stock_mutation = StockMutation.where(\n :stock_entry_id => self.id , \n :source_document_entry_id => stock_migration.id,\n :source_document_entry => stock_migration.class.to_s \n ).first \n stock_mutation.quantity = self.quantity \n stock_mutation.save \n end", "def update\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n if @product_stock.update_attributes(params[:product_stock])\n format.html { redirect_to @product_stock, notice: 'Estoque atualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_cart\n product = Product.find_by_cs_sku(params[:sku])\n item = ReservedItem.where('user_id = ? and product_id = ? and session_id = ?', current_user.id,\n product.id,\n session.id).first\n qty = BigDecimal.new(get_qty)\n\n if available?(product, item, qty)\n product.update_attribute(:qty, (product.qty + item.qty) - qty)\n item.update_attribute(:qty, qty)\n respond_with_format { @cart.update_item(params[:sku], get_qty) }\n else\n flash[:error] = 'Not enough item in inventory'\n respond_with_format\n end\n end", "def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end", "def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end", "def update_stock_on_update\n # What has changed?\n product_has_changed = product_changed? rescue false\n store_has_changed = store_changed? rescue false\n quantity_has_changed = quantity_changed? rescue false\n # Previous values\n product_prev = product_was rescue product\n store_prev = store_was rescue store\n quantity_prev = quantity_was rescue quantity\n # Stock\n if product_has_changed || store_has_changed\n # Current Stock\n if !update_stock(product, store, quantity, true)\n return false\n end\n # Roll back Previous Stock\n if !update_stock(product_prev, store_prev, quantity_prev, false)\n return false\n end\n elsif quantity_has_changed\n # Current Stock\n if !update_stock(product, store, quantity - quantity_prev, true)\n return false\n end\n end\n true\n end", "def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n PostLogger.info(\"Change position - Now: #{@stock.quantity} shares of #{@stock.symbol} in #{@stock.portfolio.user.name}'s - #{@stock.portfolio.name} Portfolio\")\n\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_product_qty\n @order = Spree::Order.find_by_id(params[:order_id])\n @line_item = Spree::LineItem.find_by_id(params[:line_item_id])\n request_to_update_qty = params[:quantity].to_i\n # code to find the order_total\n if @order.market_place.present?\n case @order.market_place.code\n when \"qoo10\"\n order_total = @order.market_place_details.present? ? @order.market_place_details[\"total\"] : @order.total\n when \"lazada\", 'zalora'\n order_total = @order.total\n end\n end\n if @line_item.present?\n prev_qty = @line_item.quantity.to_i\n final_qty = prev_qty - request_to_update_qty\n @variant = @line_item.variant\n @product = @variant.product if @variant.present?\n # code to update line item\n @line_item.update_column(:quantity, request_to_update_qty)\n @sellers_market_places_product = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=? AND product_id=?\", @order.seller_id, @order.market_place_id, @product.id).try(:first)\n if @sellers_market_places_product.present?\n @stock_product = Spree::StockProduct.where(\"sellers_market_places_product_id=? AND variant_id=?\", @sellers_market_places_product.id, @variant.id).try(:first)\n if @stock_product.present?\n @stock_product.update_attributes(:count_on_hand=>(@stock_product.count_on_hand + final_qty.to_i) >= 0 ? (@stock_product.count_on_hand + final_qty.to_i) : 0)\n @variant.update_attributes(:fba_quantity=>(@variant.fba_quantity + final_qty.to_i) >= 0 ? (@variant.fba_quantity + final_qty.to_i) : 0) if !@variant.quantity_inflations.present?\n msg = 'Admin/Orders Controller update_product_qty '\n @variant.add_log_on_update(msg) rescue QTY_LOG.error \"#{Time.zone.now} Error -- #{msg}\"\n end\n end\n end\n # code to update order total after creating line item for order\n @order.update_column(:total, order_total)\n @order.reload\n line_items = @order.line_items\n respond_to do |format|\n format.html { render :partial=>\"modify_shipping\", :locals => { :line_items => line_items }}\n end\n end", "def update\n # Find product by its id\n @product = Product.find(params[:product_id])\n # Find product stock by its id\n @products_stock = ProductsStock.find(params[:id])\n # authorize @products_stock\n if @products_stock.update(products_stock_params)\n # If update successful go to manager home page\n redirect_to partner_side_path\n else\n # If something goes wrong re-render products stock edit page\n render :edit\n end\n end", "def update\n updated_count = 0\n\n products.each do |product|\n woo_product = get_sku(product.tuoteno)\n\n unless woo_product\n logger.info \"Tuotetta #{product.tuoteno} ei ole verkkokaupassa, joten saldoa ei päivitetty\"\n\n next\n end\n\n updated_count += update_stock(woo_product['id'], product)\n end\n\n logger.info \"Päivitettiin #{updated_count} tuotteen saldot\"\n end", "def update_quant (olist, item, quant)\n olist[item] = quant\n olist\nend", "def after_update(product)\n expire_cache_for(product)\n print \"product sweeper!\"\n end", "def change_stock_of(commodity, change)\n @stock[commodity_id(commodity)] += change\n end", "def update\n megam_rest.update_quotas(to_hash)\n end", "def update_stock_on_destroy\n # Update current Stock\n if !update_stock(product, store, quantity, false)\n return false\n end\n true\n end", "def purchase\n \t@stock -= 1\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def manage_stock_settings\n smp = Spree::SellerMarketPlace.find(params[:seller_market_place_stock_config_details].keys.first)\n seller = smp.seller\n seller.update_attributes(:stock_config_type => STOCKCONFIG.key(params[:seller][:stock_config_type]).to_i)\n if !params[\"apply_to_all\"].nil? && params[\"apply_to_all\"] == \"true\"\n inf_variant_ids = Spree::QuantityInflation.pluck(:variant_id)\n var_ids = Spree::Variant.where(:id=>inf_variant_ids).pluck(:product_id)\n # products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true AND kit_id IS NULL\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true AND kit_id IS NULL\"))\n products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true\"))\n products.each do |product|\n product.update_column(:stock_config_type, 0)\n end \n end\n \n if params[:seller][:stock_config_type] == \"percentage_quantity\"\n params[:seller_market_place_stock_config_details].each do |key, value|\n smp = Spree::SellerMarketPlace.find(key)\n smp.update_attributes(:stock_config_details=>value)\n if !params[\"apply_to_all\"].nil? && params[\"apply_to_all\"] == \"true\"\n smpps = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=?\", smp.seller_id, smp.market_place_id)\n smpps.update_all(:stock_config_details=>value)\n end\n end\n end\n res = view_context.update_stock_for_seller(seller, false)\n if res == \"fail\"\n redirect_to admin_seller_seller_market_places_path(seller.id), :error => \"Stock can not be updated properly\"\n else\n redirect_to admin_seller_seller_market_places_path(seller.id), :notice => \"Stock setting updated seccessfully\"\n end\n end", "def update_from(row)\n product = store.products.where(code: row[:product_code]).first\n return nil if product.nil?\n\n begin\n if row[:trade_price].present?\n product.update!(trade_price: row[:trade_price].to_money)\n end\n if row[:retail_price].present?\n product.update!(retail_price: row[:retail_price].to_money)\n end\n if row[:inventory_amount].present?\n product.inventory_items.destroy_all\n amount = row[:inventory_amount].to_i\n amount = 0 if amount < 0\n product.restock!(@inventory, @lot_code, nil, amount)\n end\n rescue StandardError => e\n log_error(product)\n end\n end", "def update_inventory\n response = LcboApiHelper.get_all \"inventories\", [\"product_id=#{number}\", \"where_not=is_dead\"]\n\n response.each do |inventory|\n lcbo_updated_on = inventory[\"updated_on\"].to_date\n next if Inventory.exists?(lcbo_updated_on: lcbo_updated_on, store_id: inventory['store_id'], product: self)\n Inventory.create(\n product: self,\n store_id: inventory['store_id'],\n quantity: inventory[\"quantity\"],\n lcbo_updated_on: lcbo_updated_on,\n lcbo_updated_at: Time.parse(inventory[\"updated_at\"]).getutc\n )\n end\n end", "def of_update_description_prices_from_product_store\n product = params[:product]\n store = params[:store]\n supplier = params[:supplier]\n tbl = params[:tbl]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n current_stock = 0\n if product != '0'\n @product = Product.find(product)\n @prices = @product.purchase_prices\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n # Use purchase price, if any. Otherwise, the reference price\n price, discount_p, code = product_price_to_apply(@product, supplier)\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n if store != 0\n current_stock = Stock.find_by_product_and_store(product, store).current rescue 0\n end\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id, \"stock\" => current_stock.to_s,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "def si_update_description_prices_from_product_store\n product = params[:product]\n store = params[:store]\n supplier = params[:supplier]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n current_stock = 0\n if product != '0'\n @product = Product.find(product)\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n # Use purchase price, if any. Otherwise, the reference price\n price, discount_p, code = product_price_to_apply(@product, supplier)\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n if store != 0\n current_stock = Stock.find_by_product_and_store(product, store).current rescue 0\n end\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id, \"stock\" => current_stock.to_s,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code }\n render json: @json_data\n end", "def stock_minus(product, amount)\n product = Product.find(product)\n quantity = product.quantity\n quantity -= amount.to_i\n product.update(quantity: quantity)\n end", "def put_vendor_contract(q)\n$LOG.info('put_vendor_contract');\n\n@VENDOR=q[\"VENDOR\"];\n@PRODUCT=q[\"PRODUCT\"];\n@VID=@VENDOR[\"VID\"];\n@PRODUCT[\"VID\"]=@VID;\n\n# CHECK IN CACHE VENDOR\n@vendor=$CACHE.get(\"VENDOR\",@VID)\n# IF NOT IN CACHE CHECK IN STORE \nif (@vendor == nil) \n# IF IN STORAGE RENEW IN CACHE\n@vendor=$STORAGE.get(\"VENDOR\",@VID)\nif (@vendor == nil) \n# IF NOT IN STORAGE - ADD NEW VENDOR AND PRODUCT OF ONE \n$STORAGE.put(\"VENDOR\",@VID,@VENDOR)\n@vendor=$STORAGE.get(\"VENDOR\",@VID)\nend\n\n\n# AND IF OK - PUT TO THE CACHE\nif (@vendor != nil) \n$CACHE.put(\"VENDOR\",@VID,@vendor)\nend\n\nend\n\n\nif (@vendor != nil) # IF VENDOR OK PUT NEW PRODUCT !!!!\n put_product(@PRODUCT)\nend\n\n\nend", "def update\n @order.earliest_pickup_date = calculate_earliest_pickup_date(:update)\n # Save off original quantity for order_products\n original_quantities = {}\n @order.order_products.each { |order_product| original_quantities[order_product.id] = order_product.quantity }\n respond_to do |format|\n if @order.update(order_params)\n okay = true\n @order.order_products.each do |order_product|\n new_quantity = order_product.quantity\n original_quantity = original_quantities[order_product.id]\n unless (new_quantity == original_quantity)\n product = order_product.product\n new_quantity_in_stock = (product.quantity_in_stock + original_quantity - new_quantity)\n if new_quantity_in_stock < 0 # Desired quantity no longer available\n okay = false if okay\n # Update the order the best we can and notify user of discrepancy\n new_quantity_in_stock = 0\n # The original quantity was already subtracted from the stock; quantity should never have to decrease below what was previously ordered\n new_quantity = original_quantity + product.quantity_in_stock\n order_product.update_attributes(quantity: new_quantity)\n end\n product.update_attributes(quantity_in_stock: new_quantity_in_stock)\n end\n end\n redirect_to(edit_order_path(@order), notice: t('orders.not_available')) and return if (!okay) # \"One or more of the products you selected is not available in the desired quantity. Please review the updated order.\"\n if session[:showing_user]\n format.html { redirect_to @order.user, notice: t('orders.create') } # \"Order was successfully updated.\"\n format.json { head :no_content }\n else\n format.html { redirect_to orders_path, notice: t('orders.create') } # \"Order was successfully updated.\"\n format.json { head :no_content }\n end\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_quant(current_list, item, quantity)\n current_list[item] = quantity\n current_list\nend", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def revert_stock (products, actual_model_name, actual_model_id)\n\n products.each do |product|\n #Find which stock objects were updated by the current model so we can revert them\n @spr = StockProductReduction.where(:actual_model_name => actual_model_name, :actual_model_id => actual_model_id)\n\n @spr.each do |spr|\n @stock_product = StockProduct.find_by_id(spr.stock_product_id)\n @new_package_size = @stock_product.packages_size + spr.packages_size\n @stock_product.update(:packages_size => @new_package_size, :gone => false)\n end\n end\n\n #Remove the reductions\n @spr.destroy_all\n end", "def update_price(product_model, product_html)\n price = product_html.css('.price').text\n .gsub('R$', '').gsub(',', '.')\n .strip.to_f\n\n if product_model.price != price && !price.zero?\n # if it changed, create a new price history and add it to the product\n new_price = PriceHistory.create(old_price: product_model.price,\n current_price: price,\n product: product_model)\n\n product_model.update(price: price)\n puts \"PREÇO ATUALIZADO. #{product_model.name}: #{product_model.price_histories.order(:created_at).last.old_price} -> #{product_model.price_histories.order(:created_at).last.current_price}\"\n end\n end", "def update\n @producto_stock = ProductoStock.find(params[:id])\n\n respond_to do |format|\n if @producto_stock.update_attributes(params[:producto_stock])\n format.html { redirect_to(@producto_stock, :notice => 'ProductoStock was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @producto_stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save_products\n self.products = @products_cache if @products_cache\n end", "def set_stock\n @stock = Stock.find(params[:id])\n end", "def index\n @stocks = Stock.all \n \n @stocks.each do |x|\n x.price = StockQuote::Stock.quote(x.ticker).last_trade_price_only\n x.save\n end \n end", "def get_from_product_stock(product_id, quantity_to_add)\n product = Product.find_by(id: product_id)\n if (product.stock >= quantity_to_add)\n product.stock -= quantity_to_add\n self.quantity += quantity_to_add\n\n if self.valid? && product.valid?\n self.save\n product.save\n return self\n end\n end\n end", "def sync_local_to_magento\n response = API::SOAP::CatalogInventory::StockItem.update(self)\n\n if response.success?\n self.sync_needed = false\n return true\n else\n errors.add(:base, response.body[:faultstring])\n return false\n end\n end", "def update_product_details\n\t\t\ttransferorderpricing = TransferOrderPricing.new\n\t\t\tcorporate = Corporate.find(self.corporate_id)\n\t\t\ttransferorderpricing = wholesale_price(self.product_list_id, corporate.state, corporate.commission_percent)\n\t\t\tself.update(stock_value: transferorderpricing.final_total)\n distributor_stock_ledger = DistributorStockLedger.find(self.id)\n\t\t\t #10001\tAdd Stock to Distributor\n\t\t\t #10002\tRemove Stock from Distributor\n\t if distributor_stock_ledger.product_list_id.present?\n\t #product list details from product master id\n\t product_list = ProductList.find(distributor_stock_ledger.product_list_id) #.joins(:product_variant).where(\"product_variants.activeid = 10000\")\n\t if product_list.present?\n\t #product list details from product master id\n\t #distributor_stock_ledger = DistributorStockLedger.find(self.id)\n\t distributor_stock_ledger.update(product_master_id: product_list.product_master_id,\n\t product_variant_id: product_list.product_variant_id,\n\t prod: product_list.extproductcode)\n\n\t\t\t\t\t\t\t message = update_product_stock_summary(distributor_stock_ledger.id)\n\n\t\t\t\t\t\t\tself.flash_notice = \"Ledger details updated with stock nos #{message}\"\n\t end\n\n\t elsif distributor_stock_ledger.type_id == 10000 #mis additions\n\t message = add_corporate_mis_balance(distributor_stock_ledger.corporate_id, distributor_stock_ledger.stock_value.to_f)\n\t\t\t\t\t\t\tself.flash_notice = \"Ledger #{message}\"\n\t # flash[:error] = \"Ledger details #{distributor_stock_ledger.type_id}\"\n\t\t\t \telsif distributor_stock_ledger.type_id == 10020 #mis removal\n\t\t\t\t message = \" \"\n\t message += remove_corporate_mis_balance(distributor_stock_ledger.corporate_id, distributor_stock_ledger.stock_value.to_f)\n\t\t\t\t\t\t\tself.flash_notice = \"Ledger #{message}\"\n\t end\n \t #end\n end", "def set_product_sample_stock\n @product_sample_stock = ProductSampleStock.find(params[:id])\n end", "def set_stocking_product\n @stocking_product = StockingProduct.find(params[:id])\n end", "def update_item(list, key, new_quant)\n list[key] = new_quant\n return list\nend", "def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n flash[:notice] = 'Movimentação atualizada.'\n format.html { redirect_to(@stock) }\n format.xml { head :ok }\n else\n default_data\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def reduce_stock(amount)\n self.stock = self.stock - amount\n end", "def set_stock_item\n @stock_item = StockItem.find(params[:id])\n end", "def set_stock_item\n @stock_item = StockItem.find(params[:id])\n end", "def update_quantity token, cart_id, product_code, qty = 1\n\tend", "def update_price\n self.update(daily_price: new_daily_price)\n end", "def normalize_stock\n self.stock = 0 if self.stock.nil?\n end", "def update\n self.class.update_product_by_id(self.id, self)\n end", "def update\n respond_to do |format|\n if @product_cach.update(product_cach_params)\n format.html { redirect_to @product_cach, notice: 'Product cache was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_cach }\n else\n format.html { render :edit }\n format.json { render json: @product_cach.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_stock_of(commodity, stock)\n @stock[commodity_id(commodity)] = stock\n end", "def stock_updates\n my_logger ||= Logger.new(\"#{Rails.root}/log/cron.log\")\n errors = []\n notification_array = []\n if params[\"products\"].present?\n ApiJob.fba_stock_received(params)\n else\n notification_array << ['',\"No Products found\",'',true]\n errors << \"No Products found\" \n end\n Spree::DataImportMailer::stock_update_notification(notification_array).deliver if notification_array.present?\n #view_context.update_stock_market_places(stock_values) if stock_values.present? \n if errors.empty?\n respond_to do |format|\n format.json { render :status => 200, :json => {:success => \"true\", :message => \"Stock updated successfully!\" }}\n end\n else\n respond_to do |format|\n format.json { render :status => 200, :json => {:success => \"false\", :message => errors.join(\"; \") }}\n end\n end\n end", "def update_quantities!\n @products = products.reduce([]) do |products, product|\n # If product is not published\n if !product.variant.published\n set_error(:item_not_for_sale, item: product.variant.name)\n # If product is not in stock\n elsif !product.variant.in_stock?\n set_error(:item_out_of_stock, item: product.variant.name)\n # If product's available stock is less than required quantity\n elsif !product.variant.available_for(product.quantity)\n set_error(\n :not_enough_stock_for_item,\n item: product.variant.name, stock: product.variant.in_stock\n )\n product.quantity = product.variant.in_stock\n products << product if product.quantity > 0\n # Else, keep product as is in cart\n else product.variant.unlimited_stock || product.variant.in_stock >= product.quantity\n products << product\n end\n\n products\n end\n\n # TODO: Doesn't work, think in something else ...\n if discount_code == false\n set_error(:invalid_discount_code)\n end\n\n reset! if @products.length == 0\n end", "def set_stock_price\n @stock_price = StockPrice.find(params[:id])\n end", "def update\n respond_to do |format|\n if @stock_product.update_attributes(stock_product_params)\n format.html { redirect_to @stock_product, notice: 'Stock product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stock = Stock.find(params[:symbol])\n binding.pry\n respond_to do |format|\n if @stock.update_attributes(params[:currentPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:openingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:closingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end", "def update!(**args)\n @catalog_id = args[:catalog_id] if args.key?(:catalog_id)\n @max_price = args[:max_price] if args.key?(:max_price)\n @media_product = args[:media_product] if args.key?(:media_product)\n @mid = args[:mid] if args.key?(:mid)\n @min_price = args[:min_price] if args.key?(:min_price)\n @title = args[:title] if args.key?(:title)\n end", "def decrease_stock\n\t\t@stock -= 1\n\tend" ]
[ "0.83098114", "0.764758", "0.72880715", "0.71947026", "0.71198666", "0.7048175", "0.6981914", "0.69696885", "0.69134766", "0.69046766", "0.6853029", "0.684212", "0.6833739", "0.68245345", "0.6713819", "0.6664722", "0.66323066", "0.6593814", "0.6556672", "0.65207905", "0.65190774", "0.65131223", "0.649784", "0.649253", "0.6492039", "0.6470743", "0.6468085", "0.64382845", "0.64382845", "0.6400806", "0.6396124", "0.63918597", "0.6383762", "0.63784707", "0.637771", "0.6374967", "0.6346756", "0.6326071", "0.6311837", "0.6301783", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.6253971", "0.62379694", "0.6234183", "0.62328154", "0.62192506", "0.6214238", "0.6214118", "0.62116194", "0.62074894", "0.619786", "0.6193313", "0.61827976", "0.61654735", "0.6163262", "0.6155529", "0.61515564", "0.61488193", "0.61463356", "0.614029", "0.6108525", "0.6107307", "0.61017114", "0.6087885", "0.608309", "0.6068981", "0.60682714", "0.60682714", "0.60606736", "0.6058214", "0.60470355", "0.60428584", "0.6037254", "0.60223895", "0.6013404", "0.60085654", "0.6001569", "0.59999406", "0.5976499", "0.5974133", "0.59657025" ]
0.8790568
0
def remove_all_children self.to_be_removed = true self.save self.tags.each do |i| i.to_be_removed = true i.save end end
def retrieve_all_children self.to_be_removed = false self.save self.tags.each do |i| i.to_be_removed = false i.save end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_children_when_delete\n if self.to_be_removed == true\n self.tag_types.each do |m|\n if m.to_be_removed == false\n m.to_be_removed = true\n m.save\n end\n end\n end\n end", "def remove\n each { |x| x.parent.children.delete(x) }\n end", "def remove_children\n\t\tinterests.destroy_all\n\tend", "def clean_all_tags\n self.tags.destroy_all\n self.countries.destroy_all\n self.requirements.destroy_all\n self.places.destroy_all\n end", "def clean_up_tags\n self.tags.each do |tag|\n if tag.todos.count == 1\n tag.destroy\n end\n end\n end", "def orphan_child_categories\n self.children.each do |child|\n child.parent_id = nil\n child.save\n end\n end", "def destroy_taggings\n Tagging.where(:tag_id => self.id).each do |tagging|\n tagging.not_orphans = true\n tagging.destroy\n end\n end", "def clean_children\n\n return unless @children\n\n @children.each do |child_fei|\n #next unless child.is_a?(FlowExpressionId)\n get_expression_pool.remove(child_fei)\n end\n end", "def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end", "def delete_all_tags\n delete_tags(self.tags)\n nil\n end", "def remove_from_descendants\n # TODO\n end", "def destroy\n super\n\n @children.each do |_child_name, child_group|\n child_group.each(&:destroy)\n end\n\n @children = {}\n end", "def destroy_cascade\n self.save\n self.children.each do |child|\n child.destroy_cascade\n end\n self.asset_ws_files.destroy\n self.permissions.destroy\n self.changes.destroy\n self.destroy\n end", "def tags_to_remove=(value)\n @tags_to_remove = value\n end", "def demolish\n @children.each_value(&:demolish)\n end", "def destroy\n tag_ids.clone.each { |tag_id| destroy_tag(tag_id) }\n super\n end", "def mark_children_for_removal\n work_graphics.each do |work_graphic|\n work_graphic.destroy\n end\n end", "def clear_children!\n @children.clear\n end", "def break_relations\n # delete the relations between projects and tags\n # ( category is also be a kind of tags )\n dtp = TagcloudsProject.find :all, :conditions => { :tagcloud_id => self.id }\n dtp.each { | dp | dp.destroy } unless dtp.empty?\n\n # remove the categories of projects\n if self.tag_type == Tagcloud::TYPE[ :CATEGORY ]\n projs = Project.find :all, :conditions => { :category => self.id }\n projs.each { | p | p.category = nil; p.save }\n end\n end", "def destroy_tags\n self.meme_tags.each{|mt| mt.destroy}\n end", "def children=(children)\n (self.children - children).each do |child_to_remove|\n remove_child(child_to_remove)\n end\n super\n end", "def recursively_destroy!\n children.each { |c| c.recursively_destroy! }\n destroy\n end", "def tag_clean_up\n all_tags = Tag.all\n all_modules = UniModule.all\n\n all_tags.each do |tag|\n is_used_somewhere = false\n all_modules.each do |uni_module|\n if uni_module.tags.include?(tag)\n is_used_somewhere = true\n end\n end\n if !is_used_somewhere\n logs = TagLog.all.where(:tag_id => tag.id)\n if logs.size >0\n logs.each do |log|\n log.destroy\n end\n end\n tag.destroy\n end\n end\n end", "def remove_children_recursively\n groups.each do |g|\n g.remove_children_recursively\n g.remove_from_project\n end\n files.each { |f| f.remove_from_project }\n end", "def remove_children_recursively\n groups.each do |g|\n g.remove_children_recursively\n g.remove_from_project\n end\n files.each { |f| f.remove_from_project }\n end", "def clear_all_tags()\n puts \"Deleting Tags...\"\n Tag.delete_all()\n puts \"Finished deleting all tags.\"\nend", "def remove_finished_children\n # We call #to_a to get a copy of children, since we will remove\n # children in the block. Note that we can't use #delete_if here\n # since #children is a relation enumerator (not the relation list\n # itself)\n children = each_child.to_a\n for child in children\n child, info = child\n if info[:success].evaluate(child)\n remove_child(child)\n end\n end\n end", "def delete_tags\n tags = self.tags\n tags.each do |tag|\n tag.destroy if tag.posts.count == 1\n end\n end", "def unset_children(e, children_elements)\n return if !e || !children_elements\n\n id_field = @db_fields[:id]\n id = e.send(id_field)\n if children_elements[id].is_a? Array\n children_elements[id].each do |child|\n unset_children(child, children_elements)\n end\n end\n children_elements.delete(id)\n end", "def mark_children_for_purging(children)\n children.each do |name, child|\n next if child[:source]\n child[:ensure] = :absent\n end\n end", "def tags_to_remove\n return @tags_to_remove\n end", "def remove_orphaned\n\t\tTaskTag.where([\n\t\t\t\"task_id NOT IN (?) OR task_id NOT IN (?)\",\n\t\t\tTask.pluck(\"id\"),\n\t\t\tTag.pluck(\"id\")\n\t\t]).destroy_all\n\tend", "def mark_as_removed!\n self.removed = true\n self.save\n end", "def delete_unwanted_children\n @children.keys.each do |key|\n if(@children[key][:value].class.name === \"Array\")\n if(@children[key][:value].empty?)\n @children.tap { |hs| hs.delete(key) }\n end\n else\n if(@children[key][:value].nil?)\n @children.tap { |hs| hs.delete(key) }\n end\n end\n end\n end", "def delete_all_behaviors!\n @behaviors.each { |beh| beh.parent = nil }\n @behaviors = []\n end", "def destroy_with_children\n destroyed_comment_ids = []\n self.descendants.each do |comment|\n comment.destroy\n destroyed_comment_ids << comment.id\n end\n\n self.destroy ? destroyed_comment_ids << self.id : false\n end", "def orphan_children\n self.class.transaction do\n children(true).each{|child| child.orphan}\n end\n end", "def update_children\n self.children.each do |child|\n child.update_children\n unless child.new_record?\n child.save\n child.move_to_child_of(self) if child.parent_id != self.id\n end\n end if self.changed?\n end", "def flush_children_methods\n self.children.each do |child|\n child.instance_methods(false).each do |meth|\n child.send :remove_method, meth\n end\n end\n end", "def remove_act\n # outdent children in case remove_act doesn't delete\n self.children.each do |child|\n child.outdent\n child.remove_act\n end\n \n # check if parent should update completeness\n old_parent = self.parent\n\n self.permissions.destroy_all\n self.destroy\n \n # refresh parent completeness\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end", "def unset_all_tags\n @deployment.servers_no_reload.each do |s|\n # can't unset ALL tags, so we must set a bogus one\n s.tags = [{\"name\"=>\"removeme:now=1\"}]\n s.save\n end\n end", "def remove_illegitimate_children\n puts \"Destroying illegitimate children of response #{id}: #{text}\" if illegitimate_children.length > 1\n illegitimate_children.select {|q| q != child_question }.each do |q|\n puts \" Destroying illegitimate child question #{q.id}: #{q.text}\"\n q.destroy\n end\n end", "def destroy_children()\n # self.children.each do |c|\n # class_const = Service.class_map[c.service_id]\n # raise NoClassError.new(\"Pas de classe rattachée au service=#{c.service_id}\") if class_const.nil?\n # child = class_const[c.id]\n # child.destroy()\n # end\n end", "def _UNDO_setSubTags(iNewSubTags)\n rChangedParents = {}\n\n # First, delete all our current sub-Tags not part of iNewSubTags\n @Children.delete_if do |iChildTag|\n if (!iNewSubTags.include?(iChildTag))\n iChildTag._UNDO_setParent(nil)\n true\n else\n false\n end\n end\n # Then add all sub-Tags that are not part yet of @Children\n iNewSubTags.each do |iNewSubTag|\n # First check if this sub-Tag is already part of the children\n if (!@Children.include?(iNewSubTag))\n # Remove it from its current parent\n lOldParentTag = iNewSubTag.Parent\n if (rChangedParents[lOldParentTag] == nil)\n rChangedParents[lOldParentTag] = lOldParentTag.Children.clone\n end\n lOldParentTag._UNDO_deleteChild(iNewSubTag)\n # Add it to our children list\n _UNDO_addChild(iNewSubTag)\n end\n end\n\n return rChangedParents\n end", "def purge\n self.branches.each do |b|\n b.purge\n b.destroy\n end\n end", "def purge\n self.branches.each do |b|\n b.purge\n b.destroy\n end\n end", "def remove_tagging_by_each(model_type, model_id, tag_name)\n tag = Tag.get(tag_name)\n tagging = Tagging.where(:model_type => model_type, :model_id => model_id, :tag_id => tag.id).first\n tagging.destroy if !tagging.blank?\n end", "def children=(node_or_tags); end", "def children=(node_or_tags); end", "def destroy_or_remove_from_descendants\n if !!self.tree_destroy_descendants\n destroy_descendants\n else\n remove_from_descendants\n end\n end", "def _UNDO_deleteChild(iChildTagToDelete)\n @Children.delete_if do |iChildTag|\n if (iChildTag == iChildTagToDelete)\n iChildTag._UNDO_setParent(nil)\n true\n else\n false\n end\n end\n end", "def remove_tags(tags)\n\t\t\t@metadata.attributes.update do |u|\n\t\t\t\tu.delete(:tags => tags)\n\t\t\t\tu.add(:idenity => 1)\n\t\t\tend\n\t\t\treturn nil\n\t\tend", "def destroy_tree_from_leaves\n self.subdirectories.each do |subdirectory|\n subdirectory.destroy_tree_from_leaves\n end\n self.subdirectories.reload\n self.cfs_files.each do |cfs_file|\n cfs_file.destroy!\n end\n self.cfs_files.reload\n self.destroy!\n end", "def update_bobchildren(bobchildren_ids)\n bobchildren_ids.reject! {|x| x.empty? }\n \n remove_bobchild_relationships(bobchildren_ids)\n # add the newly checked children\n add_bobchild_reationships(bobchildren_ids)\n end", "def unset_all_tags\n @servers.each do |s|\n # can't unset ALL tags, so we must set a bogus one\n s.tags = [{\"name\"=>\"removeme:now=1\"}]\n obj_behavior(s, :save)\n end\n end", "def collect_children_to_delete(nodes_to_delete)\n children('id').each do |c|\n nodes_to_delete << c.id\n c.collect_children_to_delete(nodes_to_delete)\n end\n end", "def remove_from_parents\n ordered_by.each do |parent|\n parent.ordered_members.delete(self) # Delete the list node\n parent.members.delete(self) # Delete the indirect container Proxy\n parent.save! # record the changes to the ordered members\n end\n end", "def destroy_descendants\n return if right.nil? || left.nil? || skip_before_destroy\n \n if acts_as_nested_set_options[:dependent] == :destroy\n descendants.each do |model|\n model.skip_before_destroy = true\n model.destroy\n end\n else\n base_class.delete_all scoped(left_column_name => { '$gt' => left }, right_column_name => { '$lt' => right })\n end\n \n # update lefts and rights for remaining nodes\n diff = right - left + 1\n base_class.all(scoped(left_column_name => { '$gt' => right })).each do |node|\n node.update_attributes left_column_name => node.left - diff\n end\n base_class.all(scoped(right_column_name => { '$gt' => right })).each do |node|\n node.update_attributes right_column_name => node.right - diff\n end\n \n # Don't allow multiple calls to destroy to corrupt the set\n self.skip_before_destroy = true\n end", "def remove_children(relation = nil)\n if !relation\n for rel in sorted_relations\n remove_children(rel)\n end\n return\n end\n\n children = child_objects(relation).to_a\n for child in children\n remove_child_object(child, relation)\n end\n\tend", "def delete_branch\n #we'll get all descendants by level descending order. That way we'll make sure deletion will come from children to parents\n children_to_be_deleted = self.class.find(:all, :conditions => \"id_path like '#{self.id_path},%'\", :order => \"level desc\")\n children_to_be_deleted.each {|d| d.destroy}\n #now delete my self :)\n self.destroy\n end", "def cascade_destroy\n ltree_scope.where(\"#{self.class.table_name}.#{ltree_path_column} <@ ?\", ltree_path_in_database).destroy_all\n end", "def tags_to_remove\n linked_tags - current_tags\n end", "def update_or_delete_all(removed)\n if _association.destructive?\n removed.delete_all\n else\n removed.update_all(foreign_key => nil)\n end\n end", "def delete_tags(name); end", "def delete\n extract.children.to_a.each(&:extract)\n end", "def children() []; end", "def remove_all\n @owner.transaction do\n self.each { |obj| @owner.send(@remove_proc, obj) }\n end\n @members.clear\n @loaded = false # gmosx: IS this needed?\n end", "def update_children_moderation_flag\n if self.changed.include?('moderation_flag') and self.content.has_children?\n self.content.children.each do |child|\n similiar_submissions = Submission.where(:content_id => child.id, :feed_id => self.feed_id, :moderation_flag => self.moderation_flag_was)\n similiar_submissions.each do |child_submission|\n child_submission.update_attributes({:moderation_flag => self.moderation_flag, :moderator_id => self.moderator_id})\n end\n end\n end\n end", "def _remove_all_method\n :\"_remove_all_#{self[:name]}\"\n end", "def rebuild_taggings\n if @tags_updated\n tag_class = self.class.tag_class\n input = @tag_summary.split(',').map(&:strip).reject(&:blank?)\n existing = tags.all.map(&:name)\n deleted = existing - input\n added = input - existing\n\n # Remove taggings and check for orphaned tags\n unless deleted.empty?\n delete_query = [\"EXISTS (SELECT 1 FROM #{tag_class.table_name} WHERE name IN (?))\", deleted]\n taggings.where(delete_query).delete_all\n end\n\n # Create new taggings and tags (if nescessary)\n unless added.empty?\n added.each do |name|\n tag = tag_class.find_or_create_by(name: name)\n taggings.create(:tag => tag)\n end\n end\n\n # Delete orphaned tags\n self.class.tag_class.orphans.delete_all\n end\n end", "def preserve_children?\n false\n end", "def sell_pets \n self.dogs.each do |dog|\n dog.owner = nil\n dog.mood = \"nervous\"\n self.dogs.delete(dog)\n end \n self.cats.each do |cat|\n cat.owner = nil\n cat.mood = \"nervous\"\n self.cats.delete(cat)\n end\n end", "def child_tags=(value)\n @child_tags = value\n end", "def prune\n @parent.gemset_prune\n end", "def destroy_all\n all.each do |n|\n n.destroy\n end\n end", "def remove_bobchild_relationships(bobchildren_ids)\n existing_bobchildren_ids = bobchildren.collect {|x| x.id}\n delete_child_relaitonships = existing_bobchildren_ids - bobchildren_ids\n Rails.logger.info(\"existing_bobchildren::#{existing_bobchildren_ids}\")\n delete_child_relaitonships.each do |uid|\n u = User.find(uid)\n u.bobfather_rel.destroy\n end\n end", "def remove_preexisting_tagging\n user.taggings.find(:all, \n :conditions => { :tag_id => tag.id, :feed_item_id => feed_item.id, :classifier_tagging => classifier_tagging? }\n ).each(&:destroy)\n end", "def apply_children\n \n end", "def set_children\n all_mentees = self.mentees\n new_mentees = all_mentees\n\n while new_mentees.length > 0\n to_add = []\n new_mentees.each do |new_mentee|\n to_add << new_mentee.mentees.to_a\n end\n new_mentees = to_add.flatten!\n all_mentees << to_add\n end\n\n all_mentees.each do |mentee|\n mentee.lineage_id = self.lineage_id\n mentee.save\n end\n end", "def remove_marked\n @objects.remove_marked\n end", "def destroy_descendants\n return if self.descendants.empty?\n tree_search_class.destroy(self.descendants.map(&:_id))\n end", "def delete_all\n target.clear\n end", "def complete_children\n if self.category.eql?('todo') and self.completed\n if self.children\n children = self.get_all_children\n children.each do |child|\n if child.completed.blank? or !child.completed\n child.update_attributes(:completed => true, :completed_at => self.completed_at, :zimbra_task_status => true)\n # MatterTask.update_all({:completed => true, :completed_at => self.completed_at}, {:id => child.id})\n end\n end\n end\n end\n end", "def destroy_related\n \tdestroyable_ages = []\n\t \tage_bracket_ids = self.age_brackets.pluck(:id)\n \t\t\tage_bracket_ids.each do |id|\n \t\t\t\tagesets = AgeSet.where(age_bracket_id: id)\n if agesets.any? && agesets.count == 1\n destroyable_ages << agesets\n end\n\t\t\tend\n\t \tdestroyable_ages.each { |age| age.first.age_bracket.destroy }\n\t \tself.destroy \n end", "def remove_child(*names)\n names.each do |name|\n children.delete_if { |child| child.name == name.to_s }\n end \n end", "def update_tags\n @updated = Tag.refresh_counts\n @deleted = []\n Tag.unused.order(:title).all.each do |tag|\n @deleted << tag.destroy\n end\n end", "def destroy\n current_user.tasks.all.each do |c|\n c.update({tag_ids: []})\n c.destroy\n end\n current_user.tags.all.each do |g|\n g.destroy\n end\n current_user.categories.all.each do |t|\n t.destroy\n end\n super\n end", "def tag_all_children(options = {})\n opt = {\n :has_many_class => nil, # an existing has_many relationship\n # :proj_id => nil, # shouldn't need this, it's explicit children the project\n :keyword_id => nil,\n :notes => nil,\n :pg_start => nil,\n :pg_end => nil,\n :pages => nil\n }.merge!(options)\n\n return false if opt[:keyword_id].blank? || opt[:has_many_class].blank?\n\n klass = opt[:has_many_class].to_s.capitalize.singularize\n if Keyword.find(opt[:keyword_id])\n ActiveRecord::Base.transaction do\n i = 0\n self.send(opt[:has_many_class]).each do |o| # .from_proj(opt['proj_id'])\n # don't create for already created\n if Tag.by_class(klass).by_keyword(kw).with_addressable_id(o).count == 0\n # ugly passing of params\n tag = Tag.new(:addressable_id => o.id,\n :addressable_type => klass,\n :keyword_id => opt[:keyword_id],\n :notes => opt[:notes],\n :pages => opt[:pages],\n :pg_start => opt[:pg_start],\n :pg_end => opt[:pg_end]\n )\n tag.save!\n i += 1\n end\n end # next part\n end\n i\n end\n end", "def delete_invalid_empty_tags!(node)\n\t\t\tnode.children.reject! do |child|\n\t\t\t\tif child.is_a?(TagNode)\n\t\t\t\t\tif child.children.empty? and !@schema.tag_may_be_empty?(child.tag_name)\n\t\t\t\t\t\ttrue\n\t\t\t\t\telse\n\t\t\t\t\t\tdelete_invalid_empty_tags!(child)\n\t\t\t\t\t\tfalse\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tnode\n\t\tend", "def _remove_all_method\n :\"_remove_all_#{self[:name]}\"\n end", "def replace_taggings_from_atom(atom)\n Tagging.transaction do\n self.delete_classifier_taggings!\n taggings_from_atom(atom) \n end\n end", "def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end", "def my_set_tag_ids(new_tag_ids)\n old_tag_ids = self.tag_ids\n\n to_destroy = old_tag_ids - new_tag_ids\n to_create = new_tag_ids - old_tag_ids\n\n #whenever doing multiple updates, use this ActiveRecord call set-up to make sure that you have an all-or-nothing method call, which won't half-execute the action\n ActiveRecord::Base.transaction do\n Tagging.where(cat_id: self.id, tag_id: to_destroy).destroy_all\n to_create.each do |tag_id|\n Tagging.create!(cat_id: self.id, tag_id: tag_id)\n end\n end\n\n end", "def save_tags\n tagging_contexts.each do |context|\n tag_list = tag_list_on(context)\n\n ActsAsTaggableSimple::Tag.find_or_create_all_tags(tag_list)\n\n existing_tags = taggings_on(context).collect do |tagging|\n tagging.tag.name\n end\n new_tags = tag_list - existing_tags\n old_tags = existing_tags - tag_list\n\n destroyed_taggings = []\n taggings_on(context).each do |tagging|\n if old_tags.include? tagging.tag.name\n tagging.destroy\n destroyed_taggings << tagging\n end\n end\n\n self.taggings -= destroyed_taggings\n\n new_tags = ActsAsTaggableSimple::Tag.find_by_names(new_tags)\n new_tags.each do |tag|\n taggings.create! tag: tag, context: context\n end\n end\n end", "def clean_up\n if self.deleted?\n # clean room type mapping\n RoomTypeChannelMapping.find_all_by_room_type_id(self.id).each do |rtcm|\n rtcm.update_attribute(:deleted, true)\n end\n # clean master rate mapping\n RoomTypeMasterRateMapping.find_all_by_room_type_id(self.id).each do |rtmr|\n RoomTypeMasterRateChannelMapping.find_all_by_room_type_master_rate_mapping_id(rtmr.id).each do |rtc|\n rtc.update_attribute(:deleted, true)\n end\n rtmr.update_attribute(:deleted, true)\n end\n # clean availability link from\n RoomTypeInventoryLink.find_all_by_room_type_from_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n # clean availability link to\n RoomTypeInventoryLink.find_all_by_room_type_to_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n end\n end", "def delete_tree\n @root = nil # In ruby it will be taken care by garbage collector\n end", "def remove_all\n @sequence.remove_all\n end", "def delete_unused_tags\n ActiveRecord::Base.connection.execute(\n \"delete from tags where id in(\n select t.id from tags as t left join posts_tags as pt on pt.tag_id = t.id where pt.tag_id is null\n )\"\n )\n end", "def children; []; end", "def children\n Product.unscoped.deleted.where(:parent_id=>self.id)\n end" ]
[ "0.82328236", "0.7009207", "0.70056564", "0.6906464", "0.67890275", "0.6683836", "0.6651831", "0.659164", "0.6552822", "0.6549208", "0.64957726", "0.6489836", "0.6428154", "0.64065266", "0.6389913", "0.63605005", "0.63448095", "0.6317193", "0.63033366", "0.6294256", "0.62841403", "0.6267267", "0.6265719", "0.624378", "0.624378", "0.6232527", "0.6230286", "0.6221049", "0.6219248", "0.6204463", "0.6185758", "0.6174745", "0.6173673", "0.61512053", "0.6103723", "0.60889554", "0.6082422", "0.6080683", "0.6057038", "0.6056933", "0.6056032", "0.6045517", "0.60156083", "0.6013409", "0.6006757", "0.6006757", "0.60010415", "0.5995033", "0.5995033", "0.59902114", "0.5988175", "0.5985447", "0.5984017", "0.5972348", "0.5963553", "0.5960423", "0.59572417", "0.5935494", "0.59349644", "0.59280956", "0.5926249", "0.592538", "0.59123844", "0.589086", "0.58825344", "0.5877564", "0.58733714", "0.58598757", "0.5858398", "0.5858238", "0.58569527", "0.58482", "0.58478975", "0.58251673", "0.58237475", "0.5810566", "0.5806306", "0.5805603", "0.58051234", "0.57972676", "0.5792396", "0.57884985", "0.57788336", "0.5774012", "0.5751597", "0.57388914", "0.57373637", "0.57115316", "0.5704955", "0.57041055", "0.57028514", "0.56952375", "0.56866163", "0.56833214", "0.5679605", "0.56789917", "0.565523", "0.5655065", "0.5650245", "0.56450194" ]
0.91514367
0
Default method, subclasses must override this
def run super lookup_string = _get_entity_name.upcase begin search_doc = Nokogiri::XML(http_get_body("http://whois.arin.net/rest/orgs;name=#{URI.escape(lookup_string)}*"));nil orgs = search_doc.xpath("//xmlns:orgRef") # For each netblock, create an entity orgs.children.each do |org| _log_good "Working on #{org.text}" net_list_doc = Nokogiri::XML(http_get_body("#{org.text}/nets")) begin nets = net_list_doc.xpath("//xmlns:netRef") nets.children.each do |net_uri| _log_good "[!] Net: #{net_uri}" if net_uri #page = "https://whois.arin.net/rest/net/NET-64-41-230-0-1.xml" page = "#{net_uri}.xml" net_doc = Nokogiri::XML(http_get_body(page));nil net_blocks = net_doc.xpath("//xmlns:netBlocks");nil net_blocks.children.each do |n| start_address = n.css("startAddress").text end_address = n.css("endAddress").text description = n.css("description").text cidr_length = n.css("cidrLength").text type = n.css("type").text # Do a lookup - important that we get this so we can verify # if the block actually belongs to the expected party (via whois_full_text) # see discovery strategy for more info begin whois = ::Whois::Client.new(:timeout => 20) answer = whois.lookup(start_address) parser = answer.parser whois_full_text = answer.content if answer rescue ::Whois::ResponseIsThrottled => e _log "Unable to query whois: #{e}" end #=================================== _log_good "Creating net block: #{start_address}/#{cidr_length}" entity = _create_entity "NetBlock", { "name" => "#{start_address}/#{cidr_length}", "start_address" => "#{start_address}", "end_address" => "#{end_address}", "cidr" => "#{cidr_length}", "description" => "#{description}", "block_type" => "#{type}", "whois_full_text" => "#{whois_full_text}" } end # end netblocks.children end # end nets.children rescue Nokogiri::XML::XPath::SyntaxError => e _log_error " [x] No nets for #{org.text}" end end # end orgs.children rescue Nokogiri::XML::XPath::SyntaxError => e _log_error " [x] No orgs!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def custom; end", "def custom; end", "def default; end", "def default; end", "def private; end", "def special\n override\n end", "def defaults\n super\n end", "def implementation; end", "def implementation; end", "def default\n end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def method_missing(*args)\n default\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def tag; raise 'Override this method'; end", "def extended(*) end", "def set_default\n end", "def default_proc() end", "def initialize(*)\n super\n apply_defaults\n end", "def standard\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def overrides=(_arg0); end", "def defaults!; end", "def defaults!; end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def internal; end", "def set_defaults\n super\n end", "def set_defaults\n super\n end", "def main\n super\n return self\n end", "def call\n # implement in subclasses\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize()\n # override parent\n end", "def original; end", "def wrapper; end", "def initialize\n super \n end", "def ignores; end", "def type; super; end", "def overload; end", "def invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end", "def initialize\n super(true)\n end", "def choose\n raise NotImplementedError.new('Must override')\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def normal\n end", "def normal\n end", "def default_content; end", "def virtual; end", "def extra; end", "def specialty; end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end" ]
[ "0.7415348", "0.73554313", "0.73554313", "0.6991004", "0.6991004", "0.69613177", "0.69572926", "0.6824949", "0.6801543", "0.6801543", "0.67361915", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.65642005", "0.65501094", "0.65501094", "0.65501094", "0.65501094", "0.6528684", "0.6490566", "0.64695704", "0.64676064", "0.64597005", "0.6455708", "0.64551467", "0.64551467", "0.64329106", "0.64307904", "0.64307904", "0.6429658", "0.6429658", "0.6429658", "0.63993496", "0.6390495", "0.6390495", "0.6376105", "0.63759387", "0.6340433", "0.6340433", "0.6340433", "0.63253945", "0.6310201", "0.62980604", "0.62755877", "0.62675124", "0.6240711", "0.6220586", "0.6218145", "0.62124836", "0.6204448", "0.62003416", "0.62003416", "0.62003416", "0.62003416", "0.62003416", "0.62003416", "0.62003416", "0.6188848", "0.6188848", "0.6188653", "0.6170095", "0.6169804", "0.61623544", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336", "0.61536336" ]
0.0
-1
Otherwise responsive? will whine about our thread being dead after forking
def boot_with_clear_server_thread boot_without_clear_server_thread.tap do @server_thread = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fork # :nodoc\n @cant_fork = true\n nil # important due #work\n end", "def handle_fork\n LOCK.synchronize do\n if @me != Process.pid\n trace \"process forked; recovering\"\n # Update the current process ID\n @me = Process.pid\n\n # Deal w/ the inherited socket\n @sock.close rescue nil if @sock\n @sock = nil\n\n @writer = build_queue\n @writer.spawn\n end\n end\n end", "def on_worker_fork(&block); end", "def fork\n nil\n end", "def running?; !!@thread end", "def fork_worker(after_requests = T.unsafe(nil)); end", "def resume_after_fork_in_parent\n logger.debug { \"##{__method__}\" }\n\n @mutex.synchronize do\n @_shutting_down = nil\n start_event_thread\n end\n end", "def fork\n return if @cant_fork\n\n begin\n Kernel.fork\n rescue NotImplementedError\n @cant_fork = true\n nil\n end\n end", "def safefork\n tryagain = true\n\n while tryagain\n tryagain = false\n begin\n if pid = fork\n return pid\n end\n rescue Errno::EWOULDBLOCK\n sleep 5\n tryagain = true\n end\n end\n end", "def join\n return if not running?\n @thread.join\n end", "def fork\n raise \"httperf fork currently running\" if @fork_thr && @fork_thr.alive?\n @fork_out, @fork_err = ''\n @fork_thr = Open4::bg command, :stdin => nil, :stdout => @fork_out, :stderr => @fork_err\n @fork_thr\n end", "def pause_before_fork_in_parent\n logger.debug { \"##{__method__}\" }\n @mutex.synchronize { stop_event_thread }\n end", "def reopen_after_fork!\n logger.debug { \"#{self.class}##{__method__} fork detected!\" } if forked?\n\n @mutex = Monitor.new\n @dispatch_shutdown_cond = @mutex.new_cond\n @event_queue = QueueWithPipe.new\n\n @dispatcher = nil if @dispatcher and not @dispatcher.alive?\n\n update_pid! # from Forked\n end", "def alive?; @locker.synchronize { !! @threads }; end", "def after_worker_fork(&block); end", "def start_reaper_thread\n # Lame workaround for the fact that wait*() will immediately return\n # if there are no children \n if Process.fork.nil?\n s1, s2 = Socket.pair(:UNIX, :DGRAM, 0)\n s2.recv(1) # Will block forever\n end\n\n Thread.new do\n loop do\n puts 'reaping'\n wait\n puts 'reaped'\n pp $?\n end\n end\n end", "def flush\n handle_fork\n _flush\n end", "def spawn_thread\n Thread.new do\n while true\n x = @queue.shift\n if x == Directive::SUICIDE_PILL\n \t@worker_threads_count.decrement\n \tThread.current.terminate\n end\n Thread.pass\n begin\n x.job.call(x)\n rescue StandardError => e\n $stderr.puts \"Threadz: Error in thread, but restarting with next job: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n @worker_threads_count.increment\n end", "def after_fork\n nil\n end", "def _spawn\n t = Thread.new do\n catch(:die) do\n loop do\n begin\n io = IO.popen(\"#{@ruby} #{@tmp.path}\", 'r')\n cid = Integer(line = io.gets)\n\n @cids.sync {@cids << cid} if cid > 0\n Process.wait cid\n rescue SystemCallError # if the child has already died\n rescue Exception => err\n child_err = Marshal.load(line) rescue nil\n err = child_err unless child_err.nil?\n\n STDERR.puts err.inspect\n STDERR.puts err.backtrace.join(\"\\n\")\n throw :die\n ensure\n line = io.read\n child_err = Marshal.load(line) rescue nil\n\n io.close rescue nil\n @cids.sync {\n @cids.delete cid\n throw :die unless @cids.length < @spawn or child_err\n }\n raise child_err unless child_err.nil?\n end\n\n throw :die if @stop\n sleep @pause\n\n end # loop\n end # catch(:die)\n end # Thread.new\n\n @group.add t\n t\n end", "def resume_after_fork_in_parent\n super\n end", "def fork_off(&block)\n puts \"forking... (#{pool})\"\n @pool -= 1\n fork(&block)\n end", "def pause_before_fork_in_parent\n super\n end", "def at_exit_to_every_child_fork\n at_exit do\n Thread.new do\n sleep 1\n Kernel.exit!\n end\n BEANPICKER_FORK[:job].bury rescue nil if BEANPICKER_FORK[:job]\n end\n end", "def thread; end", "def thread; end", "def thread; end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def with_own_thread()\n true\n end", "def after_fork\n end", "def fork\n forking\n yield\n forked\n end", "def join\n attached? ? sleep : (running! and ::Process.waitpid2 pid rescue nil)\n end", "def run\n start\n queue.subscribe do |msg|\n if fork\n Process.wait\n else\n self.handle(msg)\n exit!\n end\n end\n end", "def fork_master_child_and_monitor\n @fork_master_pid = Kernel.fork do\n at_exit_to_master_child_fork\n Process.die_with_parent\n BEANPICKER_FORK[:child_master] = true\n $0 = \"Beanpicker master child #{@job_name}##{@number}\"\n work_loop(self)\n end\n @loop = Thread.new(self) do |child|\n Process.waitpid @fork_master_pid\n child.fork_master_child_and_monitor if child.running?\n end\n end", "def running?; @alive end", "def forked?\n @process[:pid] != Process.pid\n end", "def before_fork(&block); end", "def spawn_child\n fork do\n begin\n CrapServer::Application.send(:per_process_block).call if not CrapServer::Application.send(:per_process_block).nil?\n pool = CrapServer::ThreadPool.new @sockets\n pool.run &@block_proc\n rescue Interrupt\n end\n end\n end", "def join\n @cond.wait if not finished?\n end", "def join\n @running_processes.each { |x| x.wait }\n end", "def in_new_thread; end", "def start\n self.join if @running\n @running=true\n @thread = Thread.new do\n while @running\n block=self.pop\n @processing=true\n block.call\n @processing=false\n end\n end\n end", "def start\n while @running\n @fork_worker ? fork_and_work : work\n end\n end", "def fork(&block)\n Kernel.fork(&block)\n end", "def before_fork; end", "def fork_and_work\n cpid = fork {setup_child; work}\n log(:at => :fork, :pid => cpid)\n Process.wait(cpid)\n end", "def after_fork\n end", "def running?; end", "def running?; started? && !finished? end", "def waiting; end", "def waiting; end", "def forked?\n Process.pid != @fork_pid\n end", "def join\n @worker.join(10)\n end", "def join\n thread && thread.join\n end", "def after_fork(options = {})\n return unless needs_after_fork_work?\n\n ::NewRelic::Agent.logger.debug(\"Starting the worker thread in #{Process.pid} (parent #{Process.ppid}) after forking.\")\n\n channel_id = options[:report_to_channel]\n install_pipe_service(channel_id) if channel_id\n\n # Clear out locks and stats left over from parent process\n reset_objects_with_locks\n drop_buffered_data\n\n setup_and_start_agent(options)\n end", "def running?; @fiber.alive?; end", "def allowing_other_threads; end", "def cheap_wait; end", "def blocking_thread\n worker_thread\n end", "def forked\n call_hooks :after, :fork\n end", "def forked\n call_hooks :after, :fork\n end", "def wait; end", "def wait; end", "def wait; end", "def join\n @thread.join\n end", "def interrupt_forked_worker_and_exit\n Process.kill('USR1', @forked_worker_pid) if @forked_worker_pid\n Process.waitall\n exit\n end", "def interrupt_forked_worker_and_exit\n Process.kill('USR1', @forked_worker_pid) if @forked_worker_pid\n Process.waitall\n exit\n end", "def join_thread\n @thread&.join\n end", "def invoke_job\r\n\r\n # BgWorker.log(\"Worker: invoke job\")\r\n\r\n fork {\r\n\r\n # BgWorker.log(\"Worker: fork: system 'cd #{Rails.root}; rake #{self.name}'\")\r\n\r\n `cd #{Rails.root}; rake #{self.name}`\r\n\r\n # BgWorker.log(\"Worker: fork: closing job #{res ? 'OK' : 'KO'}, return code: #{$?}\")\r\n\r\n self.close_job($?)\r\n }\r\nend", "def start_loop\n return false if @loop and @loop.alive?\n if @fork_master\n fork_master_child_and_monitor\n else\n @loop = Thread.new(self) do |child|\n work_loop(child)\n end\n end\n end", "def run!\n @thread && @thread.alive? ? @thread : start!\n end", "def wait!\n Thread.pass until @pool.njobs == 0\n end", "def fork_task(&blk)\n task_pid = super\n Thread.abort_on_exception = true\n # Dispatch the killer thread which kicks in after KILL_AFTER_SECONDS.\n # Note that we do not manage the @pids table here because once the process\n # gets terminated it will bounce back to the standard wait() above.\n Thread.new do\n sleep @kill_after_seconds\n begin\n TERMINATION_SIGNALS.each do | sig |\n Process.kill(sig, task_pid)\n sleep 1 # Give it some time to react\n end\n rescue Errno::ESRCH\n # It has already quit, nothing to do\n end\n end\n \n return task_pid\n end", "def shutdown_child\n return unless @child\n begin\n log_with_severity :debug, \"multi_jobs_per_fork: Sending QUIT signal to #{@child}\"\n Process.kill('QUIT', @child)\n rescue Errno::ESRCH\n nil\n end\n end", "def\tblock_fork()\n\t\tposition = 1\n\t\treturn position\n\tend", "def\tblock_fork()\n\t\tposition = 1\n\t\treturn position\n\tend", "def after_fork(&block)\n end", "def reap_workers\n loop do \n begin\n worker_pid, status = Process.waitpid2(-1, Process::WNOHANG) \n rescue Exception => e \n return\n end\n return unless worker_pid\n reap_worker(worker_pid) \n end\n end", "def __run__()\n begin\n begin\n @lock.send nil\n @result = @block.call(*@args)\n ensure\n @lock.receive\n unlock_locks\n @joins.each { |join| join.send self }\n end\n rescue Die\n @exception = nil\n rescue Exception => e\n # I don't really get this, but this is MRI's behavior. If we're dying\n # by request, ignore any raised exception.\n @exception = e # unless @dying\n ensure\n @alive = false\n @lock.send nil\n end\n\n if @exception\n if abort_on_exception or Thread.abort_on_exception\n Thread.main.raise @exception\n elsif $DEBUG\n STDERR.puts \"Exception in thread: #{@exception.message} (#{@exception.class})\"\n end\n end\n end", "def wait_for_shutdown\n @rufus.join\n end", "def run\n return if @files.empty?\n $stderr.write @files.inspect+\"\\n\"; $stderr.flush\n @cores.times do |c|\n @pipes << PipeDream.new\n @children << SafeFork.fork do\n Signal.trap(\"TERM\") { exit }\n Signal.trap(\"HUP\") { exit }\n pipe = @pipes.last\n pipe.identify_as_child\n pipe.write(\"[Worker #{c}] Booted\\n\")\n @result = Test::Unit::TestResult.new\n @result.add_listener(Test::Unit::TestResult::FAULT) do |value|\n $stderr.write value\n $stderr.write \"\\n\\n\"\n $stderr.flush\n end\n while !pipe.eof?\n file = pipe.gets.chomp\n begin\n pipe.write \"[Worker #{c} Starting: #{file}\\n\"\n start = Time.now\n\n klasses = Multitest.find_classes_in_file(file)\n klasses.each{|k| k.suite.run(@result){|status, name| ;}}\n \n finish = Time.now\n pipe.write \"[Worker #{c}] Completed: #{file} (#{finish-start})\\n\"\n rescue => ex\n pipe.write \"[Worker #{c}] Failed: #{file} - #{ex.to_s}\\n\"\n end\n end\n $stderr.write @result.to_s\n $stderr.write \"\\n\"\n $stderr.flush\n pipe.close\n end\n end\n\n total_files = @files.size\n @threads = []\n @pipes.each do |_p|\n @threads << Thread.new(_p) do |p|\n Signal.trap(\"TERM\") { exit }\n p.identify_as_parent\n # boot message\n p.gets\n while !@files.empty? \n # puts \"#{total_files - @files.size}/#{total_files}\"\n # send a file\n p.write(\"#{@files.pop}\\n\")\n # print the start message\n msg = p.gets\n # $stdout.write msg; $stdout.flush\n # wait for the complete message\n msg = p.gets\n # print complete message\n if msg =~ /Completed/\n # $stdout.write msg; $stdout.flush\n else\n $stderr.write msg; $stderr.flush\n end\n end\n p.close\n end\n end\n\n Signal.trap(\"TERM\") do\n puts \"Exiting\"\n @children.each{|c| Process.kill(\"TERM\",c)}\n @threads.each{|t| Thread.kill(t)}\n end\n\n @threads.each{|t| t.join}\n @children.each{|c| Process.wait(c)}\n end", "def running; end", "def running; end", "def protect_against_zombies\n Thread.new do\n while true\n exit if Process.ppid == 1\n sleep 1\n end\n end\n end", "def join\n respawn = true\n last_check = Time.now\n\n proc_name 'master'\n logger.info \"master process ready\" # test_exec.rb relies on this message\n if @ready_pipe\n @ready_pipe.syswrite($$.to_s)\n @ready_pipe = @ready_pipe.close rescue nil\n end\n begin\n reap_all_workers\n case SIG_QUEUE.shift\n when nil\n # avoid murdering workers after our master process (or the\n # machine) comes out of suspend/hibernation\n if (last_check + @timeout) >= (last_check = Time.now)\n sleep_time = murder_lazy_workers\n else\n sleep_time = @timeout/2.0 + 1\n @logger.debug(\"waiting #{sleep_time}s after suspend/hibernation\")\n end\n maintain_worker_count if respawn\n master_sleep(sleep_time)\n when :QUIT # graceful shutdown\n break\n when :TERM, :INT # immediate shutdown\n stop(false)\n break\n when :USR1 # rotate logs\n logger.info \"master reopening logs...\"\n Unicorn::Util.reopen_logs\n logger.info \"master done reopening logs\"\n soft_kill_each_worker(:USR1)\n when :USR2 # exec binary, stay alive in case something went wrong\n reexec\n when :WINCH\n if Unicorn::Configurator::RACKUP[:daemonized]\n respawn = false\n logger.info \"gracefully stopping all workers\"\n soft_kill_each_worker(:QUIT)\n self.worker_processes = 0\n else\n logger.info \"SIGWINCH ignored because we're not daemonized\"\n end\n when :TTIN\n respawn = true\n self.worker_processes += 1\n when :TTOU\n self.worker_processes -= 1 if self.worker_processes > 0\n when :HUP\n respawn = true\n if config.config_file\n load_config!\n else # exec binary and exit if there's no config file\n logger.info \"config_file not present, reexecuting binary\"\n reexec\n end\n end\n rescue => e\n Unicorn.log_error(@logger, \"master loop error\", e)\n end while true\n stop # gracefully shutdown all workers on our way out\n logger.info \"master complete\"\n unlink_pid_safe(pid) if pid\n end", "def sleepy_run; end", "def before_fork\n \n end", "def join\n @mutex.synchronize do\n logger.debug { \"spawned process #{@pid}\" }\n @exit_cond.wait_until { @status }\n end\n @status.success?\n end", "def do_not_thread\n true\n end", "def do_not_thread\n true\n end", "def spawn\n Thread.new {\n c = Thread.current\n c[:run] = true\n\n while c[:run]\n job = @jobs.pop\n begin\n job.call\n rescue Exception => e\n @logger.error(\"Exception occured during build: #{e.message}\")\n end\n @njobs.dec\n end\n }\n end", "def busy?; end", "def join\n @thread.join\n unset_thread_task\n end", "def wakeup() end", "def forking\n call_hooks :before, :fork\n end", "def forking\n call_hooks :before, :fork\n end", "def thread?\n false\n end", "def do_not_thread\n true\n end", "def signal_next\n begin\n next_waiting_thread = @waiting_threads.shift\n next_waiting_thread.run if next_waiting_thread\n rescue ThreadError\n # Thread must be dead\n redo\n end\n nil\n end" ]
[ "0.74092436", "0.6957325", "0.6929032", "0.6923432", "0.69168776", "0.67488897", "0.6735366", "0.671311", "0.6659065", "0.6566278", "0.65374434", "0.6480036", "0.64702904", "0.6450535", "0.6447646", "0.6419505", "0.6346915", "0.6344478", "0.6329496", "0.6317789", "0.63148737", "0.6309942", "0.6276697", "0.62637436", "0.6238542", "0.6238542", "0.6238542", "0.61789924", "0.61789924", "0.61789924", "0.61459905", "0.6130114", "0.6117772", "0.61161506", "0.611359", "0.6109999", "0.6104836", "0.6096855", "0.60894054", "0.6086612", "0.6083968", "0.60697377", "0.6066537", "0.605553", "0.60529757", "0.6051505", "0.6043033", "0.60248435", "0.6022475", "0.6014847", "0.6010248", "0.6006889", "0.6006889", "0.600395", "0.59794724", "0.597087", "0.59641117", "0.5961096", "0.5957161", "0.5953868", "0.5947322", "0.59284866", "0.59284866", "0.59164727", "0.59164727", "0.59164727", "0.5905363", "0.5892902", "0.5892156", "0.5887844", "0.58812505", "0.5869725", "0.5850812", "0.5844908", "0.584472", "0.58428013", "0.583008", "0.583008", "0.58161974", "0.58063775", "0.5795398", "0.578426", "0.57814753", "0.57711524", "0.57711524", "0.57663614", "0.5758002", "0.5745476", "0.5744333", "0.57408386", "0.5740625", "0.5740625", "0.5738423", "0.5733647", "0.5729927", "0.5728335", "0.57270324", "0.57270324", "0.5724639", "0.5722465", "0.5718996" ]
0.0
-1
GET /moresmalltrials/1 GET /moresmalltrials/1.json
def show @moresmalltrial = Moresmalltrial.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @moresmalltrial } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @moresmalltrial = Moresmalltrial.new\n max_id = Moresmalltrial.maximum(:id)\n max_id = 1 if max_id.nil?\n next_id = max_id + 1\n @moresmallmaps = Moresmallmap.where('start_trial_id <= ?', next_id).where('end_trial_id >= ?', next_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def show\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trial }\n end\n end", "def show\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @my_time_trial }\n end\n end", "def create\n @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])\n\n respond_to do |format|\n if @moresmalltrial.save\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' }\n format.json { render json: @moresmalltrial, status: :created, location: @moresmalltrial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end", "def show\n @medium_trial = MediumTrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_trial }\n end\n end", "def new\n @my_time_trial = MyTimeTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @my_time_trial }\n end\n end", "def new\n @medium_trial = MediumTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_trial }\n end\n end", "def show\n @mosttinytrial = Mosttinytrial.find(params[:id], :include => [:def_user, :atk_user, :def_strategy, :atk_strategy, :map])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinytrial }\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def new\n @mosttinytrial = Mosttinytrial.new\n\n @gurad_mobs_size = Mosttinymob.find_all_by_mosttinyuser_id(2).size\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mosttinytrial }\n end\n end", "def index\n @survey_results = HTTParty.get('https://shielded-wave-66393.herokuapp.com',\n :headers =>{'Content-Type' => 'application/json'} )\n @survey_results = SurveyResults.all_(current_customer)\n end", "def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def index\n @trial_models = TrialModel.all\n end", "def show\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end", "def index\n @assertions = Assertion.all.sample(10)\n\n respond_to do |format|\n format.html\n format.json { render json: @assertions }\n end\n end", "def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end", "def index\n @gt_metrix_tests = apply_scopes(GtMetrixTest).all\n\n render json: @gt_metrix_tests\n end", "def show\n @mosttinymobsetup = Mosttinymobsetup.find(params[:id], :include => [:mosttinytrial, {:mosttinymob => :mosttinymobinfo}])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinymobsetup }\n end\n end", "def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end", "def show\n @moretinymobtrail = Moretinymobtrail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moretinymobtrail }\n end\n end", "def get_one\n test_data = @test.get_one\n return render json: test_data\n end", "def index\n @monthly_interests = MonthlyInterest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @monthly_interests }\n end\n end", "def index\n @timers = Timer.all\n\n render json: @timers\n end", "def index\n trips = Trip.all\n render json: trips\n end", "def msau\n render json: get_msau(@visits)\n end", "def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end", "def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end", "def show\n render json: @testmonial\n end", "def index\n @mohrs = Mohr.all\n end", "def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall }\n end\n end", "def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end", "def index\n\n @goals = Goal.by_person_as_student(current_user.person)\n @goals = @goals.by_plan(params[:plan_id]) if params[:plan_id].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @mosttinymobtrail = Mosttinymobtrail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinymobtrail }\n end\n end", "def set_trial\n @trial = Trial.find(params[:id])\n end", "def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end", "def index\n @plans = Plan.all\n\n render json: @plans\n end", "def index\n @skills = Skill.all\n\n render json: @skills\n end", "def show\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallmission }\n end\n end", "def show\n @timer = Timer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timer }\n end\n end", "def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end", "def show\n @monthly_interest = MonthlyInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_interest }\n end\n end", "def update\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n if @moresmalltrial.update_attributes(params[:moresmalltrial])\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @mrj = Mrj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mrj }\n end\n end", "def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end", "def index\n @patient_samples = PatientSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_samples }\n end\n end", "def show\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trial }\n end\n end", "def show\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trial }\n end\n end", "def getmill\n\tformid = Windmill.where(windformid: params[:id])\n\tif formid.present?\n render json: formid.as_json(only:[:no])\n\telse\n\t\trender json: {massage: 'Windform not found'}\n\tend\nend", "def new\n @moresmallmobsquad = Moresmallmobsquad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end", "def index\n trips = Trip.all\n respond_with trips\n end", "def index\n @captures = Capture.all\n\n render json: @captures\n end", "def index\n @time_trials = TimeTrial.order(:time).limit(5)\n end", "def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_plan }\n end\n end", "def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end", "def index\n @goals = @todo.goals.all\n render json: @goals\n end", "def create\n @my_time_trial = MyTimeTrial.new(params[:my_time_trial])\n\n respond_to do |format|\n if @my_time_trial.save\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully created.' }\n format.json { render :json => @my_time_trial, :status => :created, :location => @my_time_trial }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def set_trial\n @trial = Trial.find(params[:id])\n end", "def index \n render json: Tuning.all\n end", "def index\n @cloth_measures = ClothMeasure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cloth_measures }\n end\n end", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def show\n @missionmaker = Missionmaker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missionmaker }\n end\n end", "def show\n render json: @measure\n end", "def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end", "def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end", "def show\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mill }\n end\n end", "def index\n @shots = Shot.all\n\n render json: @shots\n end", "def index\n @plan_milestones = PlanMilestone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_milestones }\n end\n end", "def show\n @trial_params = TrialParam.where trial_id: @trial.trial_id\n @trial_values = TrialValue.where trial_id: @trial.trial_id\n @trial_system_attributes = TrialSystemAttribute.where trial_id: @trial.trial_id\n @trial_user_attributes = TrialUserAttribute.where trial_id: @trial.trial_id\n end", "def show\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backend_tutorial_stat }\n end\n end", "def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end", "def index\n @admin_skills = Admin::Skill.all\n\n render json: @admin_skills\n end", "def show\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monit }\n end\n end", "def show\n @lunchplan = Lunchplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lunchplan }\n end\n end", "def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @lesson_plans = current_user.lesson_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_plans }\n end\n end", "def index\n @flights = Flight.all\n render json: @flights\n end", "def show\n @samples = current_power.project_samples(@project)\n # all exisiting project are null, we ensure private projects are explicitly set to 0\n respond_to do |format|\n format.html\n format.json do\n render json: {\n id: @project.id,\n name: @project.name,\n public_access: @project.public_access.to_i,\n created_at: @project.created_at,\n total_sample_count: @samples.count\n }\n end\n end\n end", "def index\n @mlp_queries = MlpQuery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mlp_queries }\n end\n end", "def show\n render json: @timer\n end", "def create\n @trial = Trial.new(trial_params)\n\n respond_to do |format|\n if @trial.save\n format.html { redirect_to @trial, notice: 'Trial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trial }\n else\n format.html { render action: 'new' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def index # Essentially the main page of the application proper. This is the discover page.\n #@outlets = Outlet.where(inactive: false).order(:name).paginate(page: params[:page], per_page: 20)\n offset = params[:offset].to_i\n if offset == nil\n offset = 0\n end\n if current_user.trial == true\n puts \"current_user is trial user\"\n fetch_trial_outlets\n else\n fetch_outlets(offset)\n end\n render json: @outlets\n end", "def index\n from_time = Time.now\n render json: Invoice.where(invoice_status_id: 12).order(id: :desc).limit(10).map { |x|\n {\n username: x.user.username,\n plan: \"#{x.plan.name} - $#{x.plan.price} USD\",\n created_at: x.created_at\n }\n }\n end", "def show\n @mattress = Mattress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mattress }\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end", "def index\n @requisitions = Requisition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requisitions }\n end\n end", "def index\n @medical_camps = MedicalCamp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medical_camps }\n end\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def show\n @mugshot = Mugshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mugshot }\n end\n end", "def index\n @title = t('view.surveys.index_title')\n @surveys = Survey.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @surveys }\n end\n end", "def create\n @medium_trial = MediumTrial.new(params[:medium_trial])\n\n respond_to do |format|\n if @medium_trial.save\n format.html { redirect_to @medium_trial, notice: 'Medium trial was successfully created.' }\n format.json { render json: @medium_trial, status: :created, location: @medium_trial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @mostsmallskill = Mostsmallskill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallskill }\n end\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end" ]
[ "0.716695", "0.68076646", "0.66779023", "0.6663466", "0.6631849", "0.65963566", "0.65652233", "0.6442629", "0.63992923", "0.63868815", "0.61134785", "0.6101197", "0.605216", "0.6040546", "0.6021467", "0.6004728", "0.5950679", "0.5935729", "0.593069", "0.5921621", "0.5916741", "0.5893732", "0.5878543", "0.58752763", "0.5851846", "0.583229", "0.5799258", "0.57787406", "0.57738495", "0.57688665", "0.57636786", "0.57621074", "0.5760909", "0.57560706", "0.5751971", "0.5749528", "0.57250315", "0.57228714", "0.57223195", "0.57090724", "0.5701982", "0.56891114", "0.56862324", "0.5681089", "0.5680425", "0.5677955", "0.566106", "0.56585765", "0.56530756", "0.5646453", "0.5642909", "0.5642022", "0.5642022", "0.5633356", "0.5613787", "0.56055236", "0.5601294", "0.5596806", "0.5594859", "0.55924195", "0.5590243", "0.55888313", "0.5588607", "0.55840063", "0.5579582", "0.55737525", "0.5572407", "0.5569949", "0.55687", "0.5568052", "0.5567014", "0.5555001", "0.5547583", "0.55451363", "0.55447835", "0.55441105", "0.554119", "0.55406785", "0.55396074", "0.55394465", "0.55377305", "0.55336946", "0.55312693", "0.55222744", "0.5521828", "0.5515479", "0.5514996", "0.5513259", "0.5503169", "0.55028236", "0.54952264", "0.54910743", "0.5489978", "0.54888797", "0.54841965", "0.5482491", "0.54811335", "0.548051", "0.54740965", "0.5472822" ]
0.7763802
0