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
failsafe check incase there are no users that are admin
def has_no_admin? if e = Employee.find_by_employee_type("Administrator") if User.find_by_employee_id(e) return false else return true end else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 verify_admin\n admin_is_logged_in? || not_found\n end", "def admin_restrictions\n unless AdminUser.find(:all).empty?\n redirect_to login_path, :notice => \"Admin user already exists\"\n end\n end", "def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end", "def valid_admin_user\n admin_workspace = ScAdmin.find_by_workspace_id(current_workspace_member.workspace.id)\n admin_user = admin_workspace.user_sc_admins.find(:first, :conditions => {:user_id => current_user.id})\n if !admin_user\n redirect_to scratch_user_path(current_user)\n end\n end", "def check_admin\n @user = find_current_user\n\n unless @user.present? and @user.is_admin?\n redirect_to root_path\n end\n end", "def ensure_if_admin_remains\n raise \"Can't delete last admin user.\" if User.count.zero?\n end", "def ensure_if_admin_remains\n raise \"Can't delete last admin user.\" if User.count.zero?\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 verify_admin\r\n if User.admins.blank?\r\n raise ApplicationSetupError, \"\\n\\n**Error: No admin user exists! Please run 'rake setup RAILS_ENV=#{$tmp_env}' to create an initial admin user.**\\n\\n\\n\"\r\n end \r\n end", "def check_admin\n # using the function above by grabbing the id\n @current_user = find_current_user\n # cross checking to see if user is also an admin\n unless @current_user.present? and @current_user.is_admin?\n #they're find so no additional code needed\n #if they're not admin\n redirect_to root_path\n end\n end", "def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end", "def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\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 admin?\n if !ALLOWED_USERS.include? current_user.email\n redirect_to root_path\n end\n end", "def check_if_should_be_admin\n end", "def is_admin?(user)\n user.admin > 0\n end", "def check_if_admin\n if admin?\n errors.add(:admin, \"You can't delete admin users\")\n throw :abort # New in ActiveRecord 5\n return false\n end\n end", "def checkAdmin\n current_user.present? && current_user.isAdmin\n end", "def check_if_admin\n unless current_user.admin\n redirect_to \"/login\"\n end\n end", "def ensure_admin!\n # D: Send admin status to log\n logger.debug \"current_user.admin? => #{current_user.admin?}\"\n unless current_user.admin?\n flash[:notice] = 'You do not have sufficient privileges.'\n redirect_to root_path\n return false\n end \n end", "def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end", "def user_admin?\n unless current_user.present? && current_user.admin?\n redirect_to home_welcome_path and return\n end \n end", "def admin_required\n current_user.is_admin? || access_denied\n end", "def user_is_admin?\n ALLOWED_USERS.include? current_user.email\n end", "def admin_user?\n unless (current_user && current_user.admin?)\n flash[:danger] = \"You are not an admin. You can not do that\"\n redirect_to :action => 'index'\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 check_if_admin\n if !current_user.admin?\n flash[:alert] = 'Sorry, only admins allowed!'\n redirect_to root_path\n end\n end", "def list_users?\n user.present? && user.admin?\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 verify_admin\n unless current_user.admin? or params[:id].to_i == current_user.id\n redirect_to users_path, :alert => 'You are unauthorized to do that.'\n end\n end", "def check_if_admin\n redirect_to root_path unless @current_user.present? && @current_user.admin?\n end", "def admin?\n return false\n # return (session[:user_id] && User.find(session[:user_id])[:login] == '') ? true : false\n end", "def admin_required\n session[:user_id] && (user = User.find(session[:user_id])) && user.is_admin\n end", "def is_admin?\n usertype == \"admin\" and id == 0\n end", "def ensure_an_admin_remains\n if User.count.zero?\n raise \"Can't delete last user\"\n end\n end", "def ensure_an_admin_remains\n if User.count.zero?\n raise \"Can't delete last user\"\n end\n end", "def user_is_admin?\n\tbegin\n\t `gpresult /r /scope user`.split.include? \"Admin\"\n\trescue\n\t false\n\tend\n end", "def admin_required\n self.current_user != :false && \n self.current_user.is_admin? ? true : access_denied\n end", "def user_is_admin\n unless logged_in? and is_admin?\n respond_with_error(\n \"You must have admin permissions to perform this action.\", \n root_path)\n end\n end", "def require_admin_or_self\n unless current_user.admin? || current_user == User.find(params[:id])\n flash[:notice] = \"You must be an admin to access this page\"\n redirect_to users_path\n return false\n end\n end", "def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end", "def admin?\n #warning: ADMIN must have id 0, rake db:seed to get admin and sample user\n logged_in? && current_user.admin\n end", "def is_admin?\n current_user && current_user.try(:admin?)\n end", "def check_is_admin\n unless is_admin?\n bounce_chumps \"You're not an admin.\"\n end\n end", "def verify_admin?\n return if current_user.admin?\n\n flash[:alert] = \"Sorry, only admins allowed to view the dashboard.\"\n redirect_to :root\n end", "def check_admin\n if !current_user.admin?\n flash[:error] = \"You dont have access to this Page!!!!!\"\n redirect_to root_path\n end\n end", "def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end", "def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end", "def verify_is_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def is_admin\n return Admin.find_by(email: session[:email]) != nil\n end", "def items_to_check\n User.not_admins\n end", "def admin? ; user.instance_of? User and user.role >= 2 ; end", "def admin_in!\n access_denied! unless current_user.admin?\n end", "def user_admin?\n if current_user.nil? or !current_user.is_admin\n redirect_to \"/\"\n end \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 admin_access_required\n access_denied unless admin?\n end", "def is_admin\n render status: :unauthorized unless current_user.admin\n end", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def normal_user?\n self.admin ==false\n end", "def check_admin\n return redirect_to user_dashboard_path unless current_user.is_admin?\n end", "def admin_authorized?\n\t\tif @user\n\t\t\t@user.level >= ADMIN_USER_LEVEL \n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "def checkIsAdmin?\n # Get the current user.\n user = User.get(:current)\n \n # An admin user is defined by their username being 'admin'.\n return user['login'] == 'admin'\n rescue ActiveResource::UnauthorizedAccess => e\n @error = e.message\n return false\n rescue ActiveResource::ConnectionError => e\n @error = e.message\n return false\n rescue Errno::ECONNREFUSED => e\n @error = \"Unable to connect to #{@site}\"\n return false\n end", "def check_admin\n if !current_user.admin?\n return redirect_to '/messages/no_access'\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 admin?\n user.admin?\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 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 require_admin\n deny_wrong_user if !admin?\n end", "def user_is_admin\n redirect_to root_path unless current_user && current_user.is_admin?\n end", "def only_for_admins\n raise ActiveRecord::RecordNotFound unless current_user.has_role? :admin\n end", "def verify_is_admin\n (current_user.nil?) ? redirect_to(new_user_session_path) : (redirect_to(new_user_session_path) unless current_user.admin?)\n end", "def authenticate_admin_user!\n raise SecurityError unless current_user.is_admin \n end", "def is_admin\n \tif current_user != nil\n\t \t \tif !current_user.admin\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t \tend\n\t\t else\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t\t end\n \t\t\n\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 is_admin?\n current_user ? current_user.login == 'admin' : false\n end", "def user_admin?\n \t@admin_user = Usuario.find(session[:user_id]).admin\n end", "def user_is_admin\n unless current_user.admin?\n flash[:notice] = \"You may only view existing scenarios.\"\n redirect_to root_path\n end\n end", "def verify_admin\n render_401 unless current_user.is_admin?\n end", "def admin_user\n (current_user.present? && current_user.admin?)\n end", "def unscrape?\n @user.is_admin?\n end", "def is_admin?\n if login == \"ankit\"\n return true\n else\n return false\n end\n end", "def isuseradmin?\n if $credentials != nil\n isadminornot = User.where(:username => $credentials[0]).to_a.first\n @adminuser = \"#{isadminornot.username}\"\n if @adminuser == \"Admin\"\n return true\n else \n return false\n end\n end\n end", "def is_admin_user\n if current_user.present? && current_user.admin? == false\n redirect_to '/'\n return\n end\n end", "def is_admin?\n @user = User.find(params[:id])\n if !current_user.admin?\n flash[:danger] = \"Only admins can do that\"\n redirect_to home_path\n end\n end", "def admin_user\n\t\tunless admin? \n\t\t\tflash[:danger] = \"Only administrators have access to this page\"\n\t\t\tredirect_back_or(root_url) \n\t\tend\n\tend", "def admin\n check_admin_without_render(current_user)\n @users = User.find(:all, :order => \"updated_at\", :conditions => [\"junk is NOT NULL\", ])\n end", "def isAdmin?\n redirect_to new_session_path, flash: {:error => \"Warning! Only Admin privileges\"} unless logged_in? \n !!@current_user.admin\n end", "def eventunscrape?\n @user.is_admin?\n end", "def isAdmin?\n return current_usuario != nil && current_usuario.admin\n end", "def admin?\n return !new_record? && login == 'admin'\n end", "def must_be_admin!\n access_denied! unless current_admin?\n end", "def ensure_admin_user\n redirect_to dashboard_index_path unless is_admin?\n end", "def require_admin_roles\r\n if logged_in? and not current_user.has_admin_roles?\r\n not_authorized\r\n end\r\n end", "def admin?\n if self.login == \"admin\"\n return true\n else\n return false\n end\n end", "def ensure_user_is_admin\n bounce_user unless current_user and current_user.admin?\n end", "def admin?\n return false unless authenticated?\n User.exists?(cas_username: session['cas']['user'])\n end" ]
[ "0.7964057", "0.7964057", "0.7953502", "0.7910416", "0.7910005", "0.7908496", "0.7761762", "0.7755899", "0.7755899", "0.77503484", "0.7716926", "0.7698057", "0.7679258", "0.7679258", "0.7663989", "0.7630013", "0.76122206", "0.7603283", "0.7599724", "0.7594981", "0.75853705", "0.75789267", "0.7568278", "0.75630206", "0.75614613", "0.75335354", "0.7523856", "0.7507062", "0.75066185", "0.74905175", "0.7489241", "0.74881184", "0.7479659", "0.7476003", "0.74710214", "0.74643713", "0.74636066", "0.7462589", "0.7460452", "0.7459532", "0.74536276", "0.74530095", "0.74418414", "0.7437638", "0.7435764", "0.7429432", "0.74248844", "0.7420656", "0.7420004", "0.7420004", "0.7419971", "0.74129015", "0.7403232", "0.7402351", "0.7396398", "0.73860425", "0.738563", "0.738563", "0.738563", "0.7382621", "0.73805016", "0.7379145", "0.7376564", "0.7370676", "0.7368839", "0.73672926", "0.7365498", "0.7364944", "0.73631984", "0.73571223", "0.73571223", "0.7349452", "0.73488736", "0.7340186", "0.73381615", "0.7335715", "0.7335604", "0.73351157", "0.7332724", "0.7311661", "0.7310049", "0.7308321", "0.7300123", "0.7294433", "0.72935534", "0.72935224", "0.7290963", "0.72885907", "0.7284739", "0.7283827", "0.7280874", "0.7279571", "0.7278999", "0.7278748", "0.72754735", "0.72729075", "0.7259465", "0.72586745", "0.7257665", "0.7254098" ]
0.76701146
14
Use callbacks to share common setup or constraints between actions.
def set_quiz @quiz = Quiz.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 trusted parameter "white list" through.
def quiz_params params.require(:quiz).permit(:status, :course_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "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 filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n 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 additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_board_and_task_group @board = Board.find(params[:board_id]) @task_group = TaskGroup.find(params[:task_group_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 task_params params.require(:task).permit(:board_id, :task_group_id, :id, :title) 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
This method will call `user_logged_out` and may supply an URL that should be presented to the user. As per specification, the URL specified by "url" SHOULD be on the logout page with descriptive text. For example, "The application you just logged out of has provided a link it would like you to follow. Please click here to access
def process(params = nil, cookies = nil, user_agent = nil) params ||= {} cookies ||= {} remove_ticket_granting_ticket(cookies[:tgt], user_agent) if params[:service] && CASino::ServiceRule.allowed?(params[:service]) @listener.user_logged_out(params[:service], true) else @listener.user_logged_out(params[:url]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout\n logout_redirect = Settings.logout_redirect\n if logout_redirect == 'NONE'\n page_not_found\n return\n end\n MarkusLogger.instance.log(\"User '#{real_user.user_name}' logged out.\")\n clear_session\n if logout_redirect == 'DEFAULT'\n redirect_to action: 'login'\n else\n redirect_to logout_redirect\n end\n end", "def logged_out_user\n unless !logged_in?\n flash[:danger] = \"Please log out.\"\n redirect_to root_url\n end\n end", "def logged_out_user\n unless !logged_in?\n flash[:danger] = \"Please log out.\"\n redirect_to root_url\n end\n end", "def logout\n user_name.click\n logout_link.click\n end", "def logout\n logout_redirect = Settings.logout_redirect\n if logout_redirect == 'NONE'\n page_not_found\n return\n end\n m_logger = MarkusLogger.instance\n\n # The real_uid field of session keeps track of the uid of the original\n # user that is logged in if there is a role switch\n if !session[:real_uid].nil? && !session[:uid].nil?\n #An admin was logged in as a student or grader\n m_logger.log(\"Admin '#{User.find_by_id(session[:real_uid]).user_name}' logged out from '#{User.find_by_id(session[:uid]).user_name}'.\")\n else\n #The user was not assuming another role\n m_logger.log(\"User '#{current_user.user_name}' logged out.\")\n end\n clear_session\n cookies.delete :auth_token\n reset_session\n if logout_redirect == 'DEFAULT'\n redirect_to action: 'login'\n else\n redirect_to logout_redirect\n end\n end", "def logged_out\n end", "def logged_out\n end", "def logged_out\n end", "def logout\n call :get, '/user/logout'\n end", "def logout\n session[:user_id] = nil\n\n flash[:notice] = 'You have logged off'\n return_to = params[:return_to] || root_url\n redirect_to \"#{CUSTOM_PROVIDER_URL}/users/sign_out?redirect_uri=#{CGI.escape return_to}\"\n end", "def logout_url(params={})\n auth_pds_url \"logout\",\n user_session_redirect_url(redirect_logout_url), params\n end", "def logout_url=(value)\n @logout_url = value\n end", "def logout\n raise AssertionError.new(\"You aren't logged in.\") if browser.link(href: '/login').present?\n browser.link(href: '/logout').click\n Watir::Wait.until(timeout: 5) { browser.link(href: '/login').present? }\n logged_out = browser.link(href: '/login').present?\n update_action_log(:logout, logged_out)\n logged_out\n end", "def logout\n # clear all scopes\n sign_out_all_scopes\n\n # set redirect_url => sign in page\n redirect_url = new_user_session_url\n # when url-querys has logout_redirect_uri & client_id parameters\n if params[:logout_redirect_uri] && params[:client_id]\n # load oauth application\n application = Doorkeeper::Application.find_by(uid: params[:client_id])\n # check logout_redirect_uri\n # 1. application of client_id exist\n # 2. application.logout_redirect_uri present\n # 3. application.logout_redirect_uri includes params[:logout_redirect_uri]\n # set redirect_url = params[:logout_redirect_uri]\n if application && application.logout_redirect_uri.present?\n if Doorkeeper::OAuth::Helpers::URIChecker.valid_for_authorization?(params[:logout_redirect_uri], application.logout_redirect_uri)\n redirect_url = params[:logout_redirect_uri]\n end\n elsif application && application.redirect_uri.blank?\n redirect_url = params[:logout_redirect_uri]\n end\n end\n redirect_to redirect_url\n end", "def logout \n sign_out\n# render :text => \"single sign off\" and return unless params[\"from_sso\"].nil?\n redirect_to \"#{my_addr}/#{app.name}/home\"\n end", "def logout_url(redirect_url)\n \"#{self.class.base_uri}/auth/logout?redirectUri=#{redirect_url}\"\n end", "def sign_out_user(user)\n visit root_path\n\n click_link 'Sign out'\n end", "def sign_out\n click_link t(\"sessions.signout\")\nend", "def logout\n self.logoutlink.click\n end", "def logout_url\n return @logout_url\n end", "def logout\n HttpWrapper.post(\n url: \"#{::Coyodlee.base_url}/user/logout\"\n )\n end", "def show_sign_out(user_id)\n if user_id\n content_tag :li do\n link_to 'Sign out', :session, method: :delete\n end\n end\n end", "def sign_out\n click_link 'Sign out'\n end", "def logout\n call('User.logout')\n end", "def logout\r\n journal(\"log_out\",session[:user_id])\r\n cookies.delete :autologin\r\n Token.delete_all([\"user_id = ? AND action = ?\", logged_in_user.id, \"autologin\"]) if logged_in_user\r\n self.logged_in_user = nil\r\n redirect_to :controller => 'welcome'\r\n # redirect_to :action => 'login'\r\n end", "def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\t\t# Setting @current_user to nil would only matter if @current_user were created before the destroy action (which it isn’t) and if we didn’t issue an immediate redirect (which we do). This is an unlikely combination of events, and with the application as presently constructed it isn’t necessary, but because it’s security-related I include it for completeness\n\tend", "def\r\n sign_out_logged_in_user\r\n puts\"sign_out_logged_in_user\"\r\nend", "def logout_link(text=nil)\n text ||= browserid_config.logout.text\n target = browserid_config.logout.path || '#'\n link_to text, target, class: :browserid_logout\n end", "def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def logout\n cookies.delete SL_CONFIG[:USER_EMAIL_COOKIE]\n cookies.delete SL_CONFIG[:USER_HASH_COOKIE]\n redirect_to Site.full_url\n end", "def logout \n if @agent.get(\"#{@uri.to_s}/logout\").uri == URI.parse(\"#{@uri.to_s}/login\")\n @logged_in = false\n end\n end", "def logged_out?\n if session[:user_id]\n redirect_to user_path(current_user)\n else\n true\n end\n end", "def logout\n if User.current.anonymous?\n redirect_to home_url\n elsif request.post?\n logout_user\n # redirect_to home_url\nredirect_to login_url \nend\n # display the logout form\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n flash[:success] = \"You have successfully logged out.\"\n end", "def post_sign_out_url=(url)\n @post_sign_out_url = url\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n flash[:danger] = 'Logoff realizado!'\n end", "def destroy\n session[:user_id] = nil\n\n flash[:notice] = t(:successfully_logged_out)\n redirect_to \"#{CUSTOM_PROVIDER_URL}/users/sign_out\"\n end", "def destroy\n session[:user_id] = nil\n\n redirect_to \"#{SSOClient.provider_url}/users/sign_out?back=#{URI::encode(main_app.root_url)}\",\n notice: t(\"sso_client.messages.logged_out\")\n end", "def logout\n page = OLE_QA::Framework::Page.new(@ole, @ole.url)\n page.logout if page.login_confirmation.present?\n end", "def logout\n \"/users/logout\"\nend", "def logout\n unauthenticate_user\n flash[:notice] = 'Logged out'\n redirect_to(user_login_path)\n end", "def logout\n session[:user_id] = nil\n flash[:notice] = \"Logged out.\"\n redirect_to(access_login_path)\n end", "def logout\n @browser.input(:class => \"go\", :value => \"Logout\").click\n # Return false if still impersonating user, true if not.\n @browser.div(:id => \"login-info\").strong(:text => /Impersonating User\\:/).present? ? false : true\n end", "def logout\n payload = delete_session(params[:user_id], params[:session_token], params[:csrf_token])\n if payload == :SESSION_DELETED\n notify_session(\"SESSION_END_NOTICE\", {reason: \"LOGOUT\"}, params[:session_token])\n render status: 200, json: {error: false}\n elsif payload == :SESSION_NO_AUTH\n render status: 403, json: {error: true}\n else\n render status: 404, json: {error: true}\n end\n end", "def logout_url(destination_url = nil, follow_url = nil)\n url = @logout_url || (cas_base_url + \"/logout\")\n \n if destination_url\n # if present, remove the 'ticket' parameter from the destination_url\n duri = URI.parse(destination_url)\n h = duri.query ? query_to_hash(duri.query) : {}\n h.delete('ticket')\n duri.query = hash_to_query(h)\n destination_url = duri.to_s.gsub(/\\?$/, '')\n end\n \n if destination_url || follow_url\n uri = URI.parse(url)\n h = uri.query ? query_to_hash(uri.query) : {}\n h['destination'] = destination_url if destination_url\n h['url'] = follow_url if follow_url\n uri.query = hash_to_query(h)\n uri.to_s\n else\n url\n end\n end", "def log_out\n @@pusher.trigger('presence-miniTwitter', 'user_logged_out', {\n message: \"#{current_user.name}\"\n })\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def logout\n if @user != nil and @user.admin?(@routes)\n show :logout, views: File.join(Classiccms::ROOT, 'views/cms')\n end\n end", "def logout\n forget(current_user)\n session.delete(:user_id)\n name = @current_user.name\n @current_user = nil\n flash[:success] = \"See you soon #{name}!\"\n end", "def logout\n if @logged_in\n cmd(\"exit\", true, true, @logout_token)\n handle_logout\n end\n end", "def get_logout_url(redirect_url)\n logout_url = \"https://login.microsoftonline.com/common/oauth2/logout?\"\n logout_url << { post_logout_redirect_uri: redirect_url }.to_param\n end", "def sign_out\n\n # mark them as signed out.\n # (this is a helper method of devise, the rails ruby gem we're using for\n # authentication in the sample app.)\n # \n # \n #session_sign_out <---- NEED TO CHANGE TO CUSTOM USER SIGN OUT\n\n # send them back to the homepage.\n redirect_to root_path\n\n end", "def logout\n \t\t# If already logged out, displays message\n \t\tif !logged_in?\n \t\t\tflash[:error] = \"You are already logged out\"\n \t\t\tredirect_to(:action => :login)\n \t\telse\n\t \t\treset_session\n\t \t\tflash[:success] = \"You have been logged out\"\n\t \t\tredirect_to(:action => :login)\n\t \tend\n \tend", "def destroy\n user_id = app_session.current_user_id\n current_user_session.register_logout\n\n app_session.logged_out\n DeterLab.logout(user_id)\n SslKeyStorage.delete(user_id)\n\n ActivityLog.for_user(user_id).add(:logout, user_id)\n rescue DeterLab::NotLoggedIn\n # That's ok. We are logging out anyway\n ensure\n redirect_to :login, notice: t(\".success\")\n end", "def logout\n user_logout\n session.clear\n flash[:success] = 'You have been logged out'\n redirect(Users.r(:login))\n end", "def log_out\nforget(current_user)\nsession.delete(:user_id)\n@current_user = nil\n\nend", "def logout\n current_user.forget_me!\n cookies.delete(:remember_me_token)\n set_current_user nil\n redirect_to self.instance_eval( &self.class.lwt_authentication_system_options[:redirect_after_logout] )\n end", "def destroy\n @title = 'Logout'\n log_out if logged_in?\n flash[:success] = 'You have been successfully logged out.'\n redirect_to root_path\n end", "def mints_user_logout\r\n # Logout from mints\r\n # @mints_user.logout\r\n # Delete local cookie\r\n cookies.delete(:mints_user_session_token)\r\n end", "def logout\n \tsession[:user_id] = nil\n \tsession[:home_url] = nil\n \tflash[:notice] = \"You have successfully logged out.\"\n \tredirect_to :action => 'index'\n end", "def logout\n if request.headers[\"external\"] == 'true' && !request.xhr?\n CASClient::Frameworks::Rails::Filter.logout(self)\n else\n if User.current.anonymous?\n redirect_to home_url\n elsif request.post?\n logout_user\n redirect_to home_url\n end\n # display the logout form\n end\n end", "def logout\n validate_arguments!\n\n Turbot::Auth.logout\n display \"Local credentials cleared.\"\n end", "def require_logout\n if session && !session[:user_id].blank?\n flash[:error] = \"The page you're trying to access is only available to logged out users.\"\n redirect_to dashboard_path and return\n end\n end", "def sign_out_link\n $tracer.trace(__method__)\n return ToolTag.new(a.href(\"/LogOff/\"), __method__)\n end", "def logout\n end", "def logout\n end", "def logout\n session[:user_id] = nil\n redirect_to :index, notice: \"Signed out successfully\"\n end", "def do_logout( server_url, user_token )\n a = Mechanize.new\n begin\n page = a.get(\"http://#{server_url}/api/v1/sessions/destroy?user_token=#{ CGI::escape(user_token) }\")\n JSON.parse(page.body)\n rescue\n puts $!\n end\n end", "def user_logout\n res = http_delete(:uri=>\"/session\", :fields=>x_cookie)\n return res.code\n end", "def logoutUser\n\t\t# Clearing all data from Shared Preferences\n\t\t@editor.clear()\n\t\t@editor.commit()\n\t\t\n\t\t# After logout redirect user to Loing Activity\n\t\ti = android.content.Intent.new\n\t\ti.setClassName($package_name, 'org.ruboto.session.authentication_app.AuthenticationAppActivity')\n\t\t@activity.startActivity(i);\n\t\t@activity.finish()\n\tend", "def destroy\n ## The user is logged in; log them out and send them to the homepage.\n if logged_in?\n log_out \n flash[:info] = \"You are now logged out.\"\n redirect_to :root\n \n ## The user isn't logged in; display a message on the current page.\n else\n flash[:warning] = \"No user is currently logged in.\"\n if request.referrer and not request.referrer.empty?\n redirect_to request.referrer\n else\n redirect_to :root\n end\n end\n end", "def mints_user_logout\r\n # Logout from mints\r\n # @mints_user.logout\r\n # Delete local cookie\r\n cookies.delete(:mints_user_session_token)\r\n end", "def sign_out\n logout\n end", "def koala_logout_button(button_text = \"Logout\", logout_url = \"/\", options = {})\n options = { :unobtrusive => true, :onclick => \"FB.getLoginStatus(function(status){if(status.session){FB.logout(function(response){document.location.href='#{logout_url}'});}else{document.location.href='#{logout_url}'}})\" }.merge(options)\n link_to button_text, \"#\", options\n end", "def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def members_logout\r\n\t@title = \"Members Logout\"\r\n end", "def signout\n #Made changes to show feedback form at certain intervals as per discussion & also signout auditors gracefully\n #Author: Ashish Wadekar\n #Date: 16th February 2017\n if @current_user.auditor?\n logout_user\n elsif @current_user.login_count < 6 || @current_user.login_count % 50 == 0\n redirect_to login_logout_feedback_path\n else\n logout_user\n end\n end", "def log_out\n if !current_user.nil?\n forget(current_user)\n\n session.delete(:user_id)\n session.delete(:user_type)\n @current_user = nil\n end\n end", "def log_out\n\tforget(current_user)\n\tsession.delete(:user_id)\n\t@current_user = nil\nend", "def comp_signout_link\n # click_link 'Sign out'\n find('a[href*=\"mylogout=\"]').click\n end", "def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def logout\n #render :nothing => true\n \n # Check if exists user data in session\n if session[:logged_user].present?\n # Delete user data from session\n session.delete(:logged_user)\n end\n \n # Set flash message\n flash[:notice] = 'Sessao encerrada com sucesso'\n # Redirect to home \n redirect_to '/home'\n end", "def logged_out_account\n redirect_to_current_account if logged_in?\n end", "def logout\r\n if session[:user_id]\r\n AuditLog.create(:user_id => session[:user_id], :action => \"Logged out\")\r\n session[:user_id] = nil\r\n end\r\n flash[:notice] = 'You are now logged out'\r\n \r\n redirect_to(:action => 'login')\r\n return\r\n end", "def log_out\n session.delete(:email)\n @current_user = nil\n end", "def logout\n end_session(current_user)\n redirect_to root_path \n end", "def sign_out\n \t session[:user_id]=nil\n \t flash[:notice]=\"You have been successfully logged out\"\n \t redirect_to root_url\n end", "def logout\n log_out\n redirect_to login_path\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n session.delete(:user_type_string)\n @current_user = nil\n end", "def logout\n reset_session\n @logged_in_user = nil\n redirect_to :action => :login\n end", "def exec_logout\n core_destroySession\n redirect_to lato_core.login_path\n end", "def log_out\n forget(current_user)\n session.delete(:username)\n @current_user = nil\n end", "def log_out_behavior\n session[:user_id] = nil\n redirect_to \"/\"\n end", "def signout\n\t\tself.current_user = false \n\t\tflash[:notice] = \"You have been logged out.\"\n\t\tredirect_to root_url\n\tend", "def destroy\n log_out\n redirect_to login_url, notice: t('controllers.sessions.destroy.logged_out')\n end", "def log_out\n\t\tforget(current_user) #call user.forget\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def logout\n #TODO: add extra logic if required\n delete_cookie(GlobalConstant::Cookie.user_cookie_name)\n render_api_response(Result::Base.success({}))\n end", "def log_out\n forget current_user\n session.delete :user_id\n @current_user = nil\n end", "def sign_out\n if @current_user\n session.delete(:user_id)\n redirect_to action: \"index\"\n end\n end", "def logout\n \t\tsession[:user]=nil\n \t\tredirect_to users_url\n \tend", "def logout\n @logout_message = \"You have successfully logged out. Thanks for contributing!\"\n render \"/admin/login\", layout: \"public\"\n end" ]
[ "0.6793703", "0.6770693", "0.6770693", "0.6757364", "0.66374665", "0.6601186", "0.6601186", "0.6601186", "0.6519576", "0.64567596", "0.64556545", "0.64495003", "0.6442229", "0.6434947", "0.64084774", "0.640385", "0.63797617", "0.6361612", "0.6339115", "0.6319637", "0.63118523", "0.6309778", "0.629836", "0.6283333", "0.6271113", "0.6269445", "0.62668204", "0.6238263", "0.62349415", "0.62328583", "0.6226569", "0.61952215", "0.6194775", "0.6193318", "0.61919856", "0.6188959", "0.6181259", "0.6162313", "0.61499125", "0.61478525", "0.6126209", "0.61182934", "0.6106872", "0.61063015", "0.61016315", "0.60827327", "0.6076991", "0.6074614", "0.60742575", "0.60632825", "0.6059344", "0.60378784", "0.60375106", "0.6033621", "0.6022917", "0.60194165", "0.6016502", "0.60114735", "0.6006185", "0.6005447", "0.6005102", "0.60029185", "0.59955996", "0.59930295", "0.59930295", "0.5992582", "0.59891987", "0.59848577", "0.59812164", "0.59799874", "0.59759915", "0.5973451", "0.5967542", "0.59630156", "0.5961779", "0.5956897", "0.59538937", "0.5953434", "0.59527427", "0.5944307", "0.5939264", "0.593761", "0.59364605", "0.59354365", "0.5932456", "0.59214056", "0.5919731", "0.59190816", "0.59174556", "0.59151334", "0.5914914", "0.5909828", "0.59089833", "0.5905743", "0.5905356", "0.5902217", "0.5894316", "0.5893198", "0.58908814", "0.58880925", "0.5883045" ]
0.0
-1
short title for lists and callback for ...ables
def list_title(n=40) st = name[0..n].to_s st += "..." unless name.length <= n st end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title_for_list(object)\n return \"List of \" + MyAdmin.prepare_title(object)\n end", "def title=(_arg0); end", "def title=(_arg0); end", "def title=(_arg0); end", "def title_name; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def name() title; end", "def name() title; end", "def list(*) end", "def list_header(title)\n 2.times do\n puts (\"\")\n end\n puts (\"Details of your todo list #{title}\")\n puts (\"\")\n end", "def onBriefingGroup _args\n \"onBriefingGroup _args;\" \n end", "def title_comp=(_arg0); end", "def name; title end", "def description=(_arg0); end", "def description=(_arg0); end", "def description=(_arg0); end", "def title_comp; end", "def title?; end", "def display_all_titles\n # Interface method\n end", "def frbr_list_title\n event_title\n end", "def onBriefingNotes _args\n \"onBriefingNotes _args;\" \n end", "def twitter_list_name\n end", "def print_list; end", "def print_list(list_name)\n p list_name\nend", "def list_title_for(text)\n I18n.t(\"backend.general.list\", :model => text.is_a?(String) ? text : text.send(:human_name))\n end", "def handle_title(name, attrs) \n \n end", "def list\n end", "def list\n end", "def list\n end", "def list\n\n end", "def titles(library)\nend", "def onBriefingPlan _args\n \"onBriefingPlan _args;\" \n end", "def desc=(_); end", "def frbr_list_title\n frbr_ui_desc\n end", "def list_to_print(title,list)\n line = \"\" \n 1.upto(title.size){line << \"-\"}\n title = title + \"\\n\" + line + \"\\n\"\n return title + (list.collect {|x| \" => #{x}\" }).join(\"\\n\")\n end", "def show_list\n process_show_list\n end", "def help\n [['some command', 'description of some command'],\n ['some other command', 'description of some other command']]\n end", "def list; end", "def list; end", "def list; end", "def list; end", "def list; end", "def display_title(element)\n # Interface method\n end", "def list_items_preview\n end", "def list_item_title resource, title=nil, url=nil\n if title.nil?\n title = get_object_title(resource)\n end\n name = resource.class.name.split(\"::\")[0]\n\n html = \"<div class=\\\"list_item_title\\\">\"\n case name\n when \"DataFile\",\"Model\",\"Sop\"\n image = image_tag(((name == \"Model\") ? icon_filename_for_key(\"model_avatar\"): (file_type_icon_url(resource))), :style => \"width: 24px; height: 24px; vertical-align: middle\")\n icon = link_to_draggable(image, show_resource_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n html << \"<p style=\\\"float:left;width:95%;\\\">#{icon} #{link_to title, (url.nil? ? show_resource_path(resource) : url)}</p>\"\n html << list_item_visibility(resource.asset.policy)\n html << \"<br style=\\\"clear:both\\\"/>\"\n when \"Assay\"\n image = image_tag((resource.is_modelling? ? icon_filename_for_key(\"assay_modelling_avatar\") : icon_filename_for_key(\"assay_experimental_avatar\")), :style => \"height: 24px; vertical-align: middle\")\n icon = link_to_draggable(image, show_resource_path(resource), :id=>model_to_drag_id(resource), :class=> \"asset\", :title=>tooltip_title_attrib(get_object_title(resource)))\n html << \"#{icon} #{link_to title, (url.nil? ? show_resource_path(resource) : url)}\"\n when \"Person\"\n html << \"#{link_to title, (url.nil? ? show_resource_path(resource) : url)} #{admin_icon(resource) + \" \" + pal_icon(resource)}\"\n else\n html << \"#{link_to title, (url.nil? ? show_resource_path(resource) : url)}\"\n end\n html << \"</div>\"\n return html\n end", "def desc; end", "def label\n raise 'answer the list label'\n end", "def help\n [['help', \"this message\"]]\n end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def title\n name\n end", "def title\n name\n end", "def print_list(type='all')\n\n\t\tputs \"{#name} List - #{type} items\"\n\t\tprint '-' * 30 + \"\\n\"\n\n\n\n\t\ttodo_items.each do |item|\n\t\t\tcase type\n\t\t\twhen 'all'\n\t\t\tputs item\n\t\twhen 'complete'\n\t\t\tputs item if item.complete?\n\t\twhen 'incomplete'\n\t\t\tputs item unless item.complete?\n\t\tend\n\t\tend\n\tend", "def short_title\n title\n end", "def printList( name, list )\n title( \"#{name} available on #{$params[ :host ]}:#{$params[ :port ]}\", \"=\" )\n list.each {|item| print item.class == DictArrayItem ? \"#{item.name} - #{item.description}\\n\" : item }\n print \"\\n\"\n end", "def html_list_name list_type, open_tag\n ''\n end", "def summary_list(name, subcmds)\n section \"List of #{name} commands (with minimum abbreviation in parenthesis):\"\n subcmds.list.each do |subcmd_name|\n # Some commands have lots of output.\n # they are excluded here because 'in_list' is false.\n msg summary_help(subcmds.subcmds[subcmd_name])\n end\n end", "def print_list(title,list)\n# steps:\n # print title of list (will ask user for this input)\n puts \"**********************\"\n puts \" #{title.upcase}:\"\n puts \"**********************\"\n # print headers of item and quantity\n puts \" # ITEM\"\n puts \"----------------------\"\n # print each item and it's quantity, bulleted if possible\n list.each {|item,quantity| puts \" #{quantity} #{item}\"}\n puts \"**********************\"\n # print today's date\n date = Time.new\n puts \" Made on: #{date.month}/#{date.day}/#{date.year}\"\nend", "def title\n end", "def display_list(list)\n\tlist.each do |list_item|\n\t\tputs \"* #{list_item}\"\n\tend\n\nend", "def display_method_list\n end", "def start_special_list_item\n end", "def heading\n\t\t\"Items\"\n\tend", "def full_title\n name\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def list _args\n \"list _args;\" \n end", "def list_item_simple_list items, attribute\n html = \"<p class=\\\"list_item_attribute\\\"><b>#{(items.size > 1 ? attribute.pluralize : attribute)}:</b> \"\n if items.empty?\n html << \"<span class='none_text'>Not specified</span>\"\n else\n items.each do |i|\n if block_given?\n value = yield(i)\n else\n value = (link_to get_object_title(i), show_resource_path(i))\n end\n html << value + (i == items.last ? \"\" : \", \")\n end\n end\n return html + \"</p>\"\n end", "def title(*args, &block)\n options = Hash === args.last ? args.last : {}\n before_filter(options) {|c| c.title(*args, &block) }\n end", "def provide_navigation_to_all_long_descriptions\n # Interface method\n end", "def title\n [id, name].join(' ')\n end", "def show_list\n\t\tclear\n\t\tputs \"= LISTE DES INSTANCES #{name} =\".bleu\n\t\tputs \"\\n\\n\"\n\t\tlen_delim = defined?(LIST_ENTETE) ? LIST_ENTETE.length + 2 : 80\n\t\tdelim = (\"-\"*len_delim).bleu\n\t\tif defined?(LIST_ENTETE)\n\t\t\tputs delim\n\t\t\tputs LIST_ENTETE \n\t\tend\n\t\tputs delim\n\t\tall.each do |inst|\n\t\t\tputs \" #{inst.to_console}\"\n\t\tend\n\t\tputs delim\n\t\tputs \"\\n\\n\"\n\tend", "def caption; end", "def getDescription _args\n \"getDescription _args;\" \n end", "def main_menu\n puts <<~Doc\n Welocome to the New York Times Bestsellers List!\n Please choose one of the following options to get started:\n Doc\n NytBestsellersList::Lists.print_list_names\n end", "def help\n [\n [\"what are (people|is everyone) saying about <subject>\", \"search twitter for tweets on <subject>\"],\n [\"what's the word on <subject>\", \"search twitter for tweets on <subject>\"],\n ]\n end" ]
[ "0.68663794", "0.6500497", "0.6500497", "0.6500497", "0.64935803", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.64066535", "0.64066535", "0.63601506", "0.6316636", "0.6308353", "0.62799156", "0.6268065", "0.61992383", "0.61992383", "0.61992383", "0.6196987", "0.6162593", "0.61322623", "0.61112297", "0.60846233", "0.60828257", "0.6077421", "0.6072963", "0.6060271", "0.6028248", "0.60175455", "0.60175455", "0.60175455", "0.60093963", "0.599165", "0.5978303", "0.5969751", "0.5959554", "0.59595", "0.5958887", "0.5956648", "0.5941584", "0.5941584", "0.5941584", "0.5941584", "0.5941584", "0.5923087", "0.5909321", "0.58742446", "0.5866992", "0.5858204", "0.58152646", "0.5813035", "0.5813035", "0.5813035", "0.5813035", "0.5813035", "0.5813035", "0.5813035", "0.5813035", "0.5813035", "0.5813035", "0.5807351", "0.5807351", "0.58060867", "0.580213", "0.5778566", "0.5776431", "0.5767213", "0.57638997", "0.5740259", "0.5739719", "0.5735011", "0.5734918", "0.573419", "0.5734059", "0.5734059", "0.5734059", "0.5729435", "0.5724135", "0.57217854", "0.5710311", "0.5694769", "0.56940097", "0.56774503", "0.56763005", "0.5668682", "0.56612384" ]
0.0
-1
TODO: Check if user allowed to read this posting This callback is used by tagables and therefor it is defined as this simple placeholder yet
def read_allowed?(user) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_post; end", "def process_post(post)\n # No-op.\n end", "def post_reader; end", "def process_post\n true\n end", "def fetch_create_post\n end", "def view_post\n content \n end", "def force_post\n @type = \"post\"\n @post = \"\"\n end", "def post; end", "def post #:doc:\n end", "def tagged?; end", "def post_data; end", "def post\n raise NotImplementedError\n end", "def process_post\n\t\traise \"Ehh, What's up Doc?\"\n\tend", "def read_post(title)\n @read = \"This is from the post, #{title}\"\n end", "def initialized_post_name; end", "def send_post(post)\n title = CGI.unescapeHTML(post['title'])\n author = post['author']\n url = post['url']\n time = post['created']\n link = 'https://reddit.com' + post['permalink']\n preview = post['thumbnail']\n # Create an Embed\n Bot.channel(Config['channel']).send_embed do |emb|\n emb.color = '3498db'\n emb.author = { name: title, url: link}\n emb.image = { url: preview }\n emb.url = link\n emb.add_field name: 'Link:', value: url, inline: false\n emb.footer = { text: \"Posted by /u/#{author} @ #{Time.at(time).strftime('%a, %d %b %H:%M')}\", icon_url: Bot.profile.avatar_url }\n end\nend", "def post_params\n params.require(:post).permit(:content, :grass_tags, :only_followers, :user_id)\n end", "def post\r\n end", "def post_data=(_arg0); end", "def sub_post\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n end", "def post_as(user, text = nil, &block)\n post = DslWrapper::Post.new(user)\n post.text(text) if text\n post.instance_eval(&block) if block_given?\n post.post_on_facebook\nend", "def posted?\n post.present?\n end", "def post_ad\n # the post_ad method is defined in lib/post_o_matic.rb. the method creates a new listing on kingsnake.com\n # and returns true or false, depending on whether or not it was posted.\n is_posted = super\n if is_posted\n update_posted_ad!\n end\n is_posted\n end", "def ready_to_post?\n self.state == 'ready_to_post'\n end", "def non_subscriber_post(email)\n end", "def after_add_callback(unused_submission)\n end", "def post?\n false\n end", "def post_params\n params.require(:post).permit(:content, :anonymous_flag, :user_id, :edited_at)\n end", "def set_poster post, sentFlg\n sentFlg ? post.recipient : post.user\n end", "def tag_params\n params.permit(:body, :post_id)\n .merge(post_id: params[:post_id])\n end", "def all_post\n end", "def post\n end", "def get_default_request\n {\n 'post[source]' => '',\n 'post[body]' => '',\n 'post[body]WidgEditor' => 'true',\n 'post[id]' => '',\n 'post[parent_id]' => '',\n 'post[original_id]' => '',\n 'post[edited_after_repost]' => '',\n 'redirect' => '',\n 'commit' => 'Save'\n }\n end", "def posts; end", "def post(*args, &block); end", "def ask_post\n page(MorePage).select_more_actions(\"Ask HN\")\n page(MorePage).page_handler(\"Ask HN\")\n page(FeedDetailsPage).touch_row\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n page(SubmissionPage).await\n page(MorePage).backpage\n page(MorePage).page_handler(\"Ask HN\")\n page(MorePage).backpage\n end", "def skips_post #:nodoc:\n @skips_post\n end", "def post_params\n params.require(:post).permit(:body, :visibility)\n end", "def ready_to_post\n self.update_attribute('state', 'ready_to_post')\n end", "def set_PostContent(value)\n set_input(\"PostContent\", value)\n end", "def set_PostContent(value)\n set_input(\"PostContent\", value)\n end", "def event_type\n :ask_posted\n end", "def post_reader\n @post_reader ||= PostReader.new(site)\n end", "def post_params\n params[:post].permit(:text) if params[:post]\n end", "def after_numbered(post)\n return unless post.is_a?(Post)\n return unless post.topic\n return unless post.topic.status == 'publish'\n return unless post.floor and post.floor > 0\n send_mention(post)\n end", "def post_content(post, options = {})\n circle = list_circles['items'].detect { |item| item['displayName'] == 'Private' }\n insert_activity(nil, {\n 'object' => {'content' => post.message },\n 'access' => {'items' => [{\n 'type' => 'circle',\n 'id' => circle['id']\n }]}\n })\n end", "def inactive_post(email)\n end", "def post\n textmenu = @browser.find_element class: \"icon_post_text\"\n textmenu.click\n titlebox = @browser.find_element class: \"editor-plaintext\"\n titlebox.send_keys \"This is a test\"\n textbox = @browser.find_element class: \"editor-richtext\"\n textbox.send_keys \"This is a test\"\n post = @browser.find_element class: \"create_post_button\"\n post.click\n end", "def getPostedPerson\r\n\t\t\t\t\treturn @postedPerson\r\n\t\t\t\tend", "def getPostedPerson\r\n\t\t\t\t\treturn @postedPerson\r\n\t\t\t\tend", "def post_block\n end", "def post_block\n end", "def post_params\n params.require(:post).permit(:title, :picture, :approved, :vibe_type, :body, :url, :uid)\n\n end", "def post_params\n params.require(:post).permit(:ID, :UserID, :Type, :Caption, :Content, :Counter)\n end", "def post_content(post, options = {})\n provider_class.post_content(post)\n end", "def is_post?\n is_entry? && params[:_entry_type_] == 'post'\n end", "def buildUserPostContent\n threadForUserPosts do |account,post|\n begin\n # Get HTML content\n tag = getTag(post.attributes['tag']) \n content = createUserContent post.attributes['href'],\n tag,\n DeliciousConnector::displayContent(post.attributes['href'])\n account.addContent(content)\n #writeUserContentToFile user,post.attributes['href'],post.get_attribute('tag'),content \n rescue => e\n puts \"[Warning]: Failed to retrieve content at #{post.attributes['href']} for '#{account.user}' : [#{e}]\"\n end\n end \n end", "def skips_post \n @skips_post\n end", "def create\nif(check_real_spam_id(params[:_user_auth_key]))\n@topic = Topic.find(params[:topic_id])\n@post = Post.new(:body => params[:body],\n:topic_id => @topic.id,\n:user_id => logged_in_user.id)\nrespond_to do |format|\nif @post.save\nflash[:notice] = 'Post was successfully created.'\nformat.html { redirect_to posts_path(:forum_id => @topic.forum_id,\n:topic_id => @topic) }\nformat.xml { head :created, :location => post_path(@post) }\nelse\nformat.html { render :action => \"new\" }\nformat.xml { render :xml => @post.errors.to_xml }\nend\nend\nelse\n render(:text => \"Could not submit post, Please try again later!\")\nend\nend", "def create\n #initialize a new post object with the parameters submitted, validated by post_params\n @post = Post.new(post_params)\n \n isComment = false\n #check whether this is actually a comment, meaning it should have kind=2 and will need an originating post id\n if params[:kind].present?\n @post.kind = params[:kind].to_i\n @post.originatingPost_id = params[:originatingPost_id].to_i\n isComment = true\n \n #otherwise, it is a post, which optionally has tags\n else\n @post.kind = 0\n @tagsToAdd = params[:tagsToAdd].split(\" \")\n @tagsToAdd.each do |t|\n @post.tags << createTag(t)\n end\n end\n \n #either way, the currently logged in user should be logged as the creator of this post/comment\n @post.user = User.find(session[:user_id])\n \n if @post.save!\n if isComment\n redirect_to action: \"show\", :id => params[:originatingPost_id] #stay on the post's show page\n else\n redirect_to action: \"show\", :id => @post.id #go to this new post's show page\n end\n else\n redirect_to action: 'new' #upon failure, try again\n end\n end", "def post_params\n params.require(:post).permit(:title, :body, :tag_string)\n end", "def tag; end", "def tag; end", "def new\n @post = Post.new\n #if new is being called because the user clicked the add tag button\n if params[:tag].present?\n @post.text = params[:currentPostText]\n addTag()\n #if new is being called because the user clicked an x to remove one of the tags\n elsif params[:tagToRemove].present?\n @post.text = params[:currentPostText]\n removeTag()\n #if new is being called because the user has just navigated to this page\n else\n @tagsToAdd = []\n end\n end", "def POST; end", "def _eval_post\n _eval_action('post')\n end", "def post_params\n params.require(:post).permit(:user_id, :title, :content, :time, :status_id, :tag_id, :picture)\n end", "def create\n @post = Post.new(post_params)\n @post.sub_id = @post.default_sub_id\n respond_to do |format|\n if @post.save\n # @post.tag(post_params[:tags], current_user) if post_params[:tags]\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: nil }\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 post_success(post)\n page(FeedDetailsPage).await\n page(FooterTabBarPage).select_tab(\"Profile\")\n page(LoginPage).await\n page(LoginPage).login(\"valid\")\n page(FeedDetailsPage).await\n page(FeedDetailsPage).touch_share\n case post\n when \"an URL\" then\n page(FeedDetailsPage).touch_choice(\"Submit URL\")\n page(SubmissionPage).create_post(\"URL title\")\n page(FeedDetailsPage).touch_choice(\"Contents\")\n page(SubmissionPage).create_post(\"URL post\")\n page(SubmissionPage).touch_discard\n when \"a Text\" then\n page(FeedDetailsPage).touch_choice(\"Submit Text\")\n page(SubmissionPage).create_post(\"text title\")\n page(FeedDetailsPage).touch_choice(\"Contents\")\n page(SubmissionPage).create_post(\"text post\")\n page(SubmissionPage).touch_discard\n end\nend", "def post_params\n params.require(:post).permit(:title, :content, :published, :tag_list, :user_id)\n end", "def post_params\n params.require(:post).permit(:url, :content, :user_id, :tag_list, \n :image, :video, :audio, :type, :post_id)\n end", "def create\n \n unless current_user.can_post\n redirect_to welcome_page_path\n end\n \n @post = Post.new\n @post.user = current_user\n @post.privly_application = params[:post][:privly_application]\n\n # Posts default to Private\n if params[:post][:public]\n @post.public = params[:post][:public]\n else\n @post.public = false\n end\n\n set_burn_date\n \n # The random token will be required for users other than the owner\n # to access the content. The model will generate a token before saving\n # if it is not assigned here.\n @post.random_token = params[:post][:random_token]\n \n @post.update_attributes(params[:post])\n \n respond_to do |format|\n if @post.save\n response.headers[\"X-Privly-Url\"] = @post.privly_URL\n format.any { render :json => get_json, \n :status => :created, :location => @post }\n else\n format.any { render :json => @post.errors, \n :status => :unprocessable_entity }\n end\n end\n end", "def published?; end", "def published?; end", "def post_params\n params.require(:post).permit(:user_id, :title, :description, :is_private, :options, :all_tags)\n end", "def export_post(post) end", "def published_post\n if self.published && self.published_at.nil?\n self.published_at = Time.now\n end\n end", "def tagging_raw_handle\n name\n end", "def tagging_raw_handle\n name\n end", "def create\n\n\t\t@post = Post.new(post_params)\n\t\tif @post.tag == \"\"\n\t\t\tredirect_to :back\n\t\telsif @post.body == \"\"\n\t\t\tredirect_to :back\n\t\telse\n\t\t\t@post.save\n\t\t\tredirect_to \"#\"\n\t\t\tflash[:info] = \"Post submited!\"\n\t\tend\n\tend", "def preview\n assign_attributes\n @post\n end", "def fb_post\n self.fb_action_id ? FbGraph::OpenGraph::Action.new(self.fb_action_id) : nil\n end", "def post_constructor\n redirect_url = self.link_url\n if redirect_url.blank?\n redirect_url = \"#{BASEURL}/posts/#{self.post.id}\"\n end\n\n redirect = Redirect.get_or_create(\n :target_uri => \"#{redirect_url}\"\n )\n\n uri = URI.parse \"https://graph.facebook.com/#{self.api_account.api_id}/feed\"\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port == 443\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n access_token = self.api_account.oauth_secret\n link_to_post = redirect.get_short_url\n name = self.name\n message = self.message\n description = self.description\n caption = self.caption\n\n param_string = \"access_token=#{access_token}&link=#{link_to_post}&name=#{name}&message=#{message}&description=#{description}&caption=#{caption}\"\n if self.post.has_photo?\n param_string << \"&picture=#{BASEURL}#{post.photo.url(:medium)}\"\n end\n return http.post(uri.path, URI.escape(param_string))\n end", "def track\n post\n end", "def create\n @post = Post.new(post_params)\n @post.body = @post.body.html_safe\n @post.short_body = @post.body.split('</p>')[0] + '</p>'\n set_tags\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, 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 auto_post?\n return jiak.auto_post\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.post\"\n end", "def on_post(resource_uri, opts) # resource_uri = Nodes\n debug \"on_post: #{resource_uri}\"\n resource = update_resource(resource_uri, false, opts)\n show_resource(resource, opts)\n end", "def post\n doc = Nokogiri::XML(request.body)\n id= (doc/'id').text\n # p = Post.exists?(id) ? Post.find(id) : Post.new\n p= Post.find_or_create_by_intranet_id id\n p.update_attributes :subject => (doc/'subject').text,\n :body => (doc/'body').text, :post_type => (doc/'post-type').text,\n :pic => (doc/'pic') .text, :begin_on=>(doc/'begin-on').text,\n :pic_postimg => (doc/'pic-postimg').text,\n :video => (doc/'video').text, \n :end_on => (doc/'end-on').text, :stick => (doc/'stick').text \n render :text => \"ok\"\n end", "def post_params\n params.permit(:body, :is_public)\n end", "def post_params\n params.require(:post).permit(:title, :subtitle, :tag_list, :body, :published)\n end", "def post_params\n params.require(:post).permit(:post_type, :user, :text, :ts)\n end", "def create\n\n current_user_or_redirect ? nil : return\n\n @post = Post.new(params[:post])\n @post.user_id = @current_user.id\n\n if @post.link?\n @post.status = 'live'\n @post.link = \"http://#{@post.link}\" unless @post.link[/^https?/]\n end\n\n respond_to do |format|\n if @post.save\n @post.delay.update_slug\n @post.delay.add_interactions\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def post_params\n params.require(:post).permit(:body, :username)\n end", "def skips_post\n @@skips_post = true\n end", "def post_params\n params.require(:post).permit(:description, :image, :image_remote_url, :title, :country, :tag_list, :link, :domain, :top, :hide, :category, :event)\n end", "def allowed_tags=(_arg0); end", "def allowed_tags=(_arg0); end", "def new_post_notification(post)\n #author\n reciever = User.find_by_id post.user_id\n setup_email(reciever)\n @subject +=\"Новый пост в вашем сообществе\"\n body[:url] = RAILS_URL + \"posts/show/#{post.id}\"\n body[:post] = post\n end", "def posts # proxy the posts struct\n @post_cb = lambda{|post,fobj| yield post,fobj }\n self\n end", "def post_params\n params.require(:post).permit(:title, :summary, :body, :tags)\n end" ]
[ "0.6901791", "0.65994835", "0.63145477", "0.61551404", "0.6060221", "0.59365666", "0.5908595", "0.59006", "0.58948976", "0.5867928", "0.5842847", "0.57946175", "0.5772395", "0.5694198", "0.5686122", "0.5663522", "0.5640944", "0.5637536", "0.5626762", "0.55764174", "0.5574192", "0.5562347", "0.55468607", "0.5522192", "0.55022514", "0.5493753", "0.5492164", "0.54921544", "0.5481553", "0.54687244", "0.54611367", "0.54508114", "0.5446578", "0.5446209", "0.54456466", "0.5425612", "0.5417212", "0.540677", "0.54045796", "0.5402232", "0.5402232", "0.539993", "0.53907084", "0.53904986", "0.53847224", "0.5364435", "0.5360335", "0.5352452", "0.53480136", "0.53480136", "0.53475255", "0.53475255", "0.5343473", "0.532073", "0.5319345", "0.53039986", "0.530302", "0.5295804", "0.52871585", "0.52752477", "0.5275071", "0.52685094", "0.52685094", "0.52683985", "0.5257623", "0.5255777", "0.52472067", "0.52469146", "0.52460384", "0.5227269", "0.5221281", "0.5220062", "0.5216678", "0.5216678", "0.52166647", "0.5216661", "0.5209972", "0.5208331", "0.5208331", "0.52079123", "0.520485", "0.52023035", "0.5202019", "0.5198026", "0.5193442", "0.51868105", "0.51845443", "0.5182678", "0.51824856", "0.5177763", "0.5174051", "0.517309", "0.5171455", "0.5162453", "0.5162286", "0.51612955", "0.51590025", "0.51590025", "0.51566887", "0.5153243", "0.5149494" ]
0.0
-1
If attachment deleted destroy meta data
def save if (not @queued_for_delete.empty?) and @queued_for_write.empty? instance_write(:meta, ActiveSupport::Base64.encode64(Marshal.dump({}))) if instance.respond_to?(:"#{name}_meta=") end original_save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @attachment.detach\n head :no_content\n end", "def destroy_attachment\n a = Attachment.find(1) rescue nil\n if !a.nil?\n a.destroy\n end\n end", "def delete\n model.delete_attachment(@path)\n end", "def destroy\n @attachment.file.purge\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: 'Attachment was successfully destroyed.' }\n end\n end", "def destroy\n current_attachment && CurveHandler::DetachService.call(current_attachment)\n head :no_content\n end", "def remove_attachment\n @user.assegnazione.purge if @user.assegnazione.attached?\n render :show\n end", "def photo__after_destroy_trigger\r\n\r\nDir[File.join(FILES_DEST_PHOTO, \"#{self.id}_*\")].each{|f| File.delete(f)}\r\nDir[File.join(FILES_DEST_PHOTO__THUMBS, \"#{self.id}_*\")].each{|f| File.delete(f)}\r\nend", "def destroy\n @post_attachment.destroy\n respond_to do |format|\n format.html { redirect_to post_attachments_url, notice: 'Post attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def attachment_removed(obj)\n if @current_journal && !obj.new_record?\n @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :old_value => obj.filename)\n @current_journal.save\n end\n end", "def destroy\n @product_attachment.destroy\n @primary_photo = false\n if @product_attachment.primary_photo \n product = @product_attachment.product\n @primary_photo = product.photo\n end\n respond_to do |format|\n format.html { redirect_to(admin_product_attachments_url) }\n format.xml { head :ok }\n format.js\n end\n website.add_log(user: current_user, action: \"Deleted a product attachment from #{@product_attachment.product.name}\")\n end", "def destroy\n @travel_post_attachment.destroy\n respond_to do |format|\n format.html { redirect_to travel_post_attachments_url, notice: 'Travel post attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def before_destroy\n\t\tsuper\n\t\tchrome_pdf_tasks.each { |t| t.destroy }\n\t\tdiff_stream.each { |c| c.destroy }\n\n\t\t# save photo list, so we can traverse it\n\t\tp = photos.collect { |x| x }\n\t\t# destroys the association\n\t\tremove_all_photos\n\t\t# remove orphan photos\n\t\tp.each do |photo|\n\t\t\t# destroy photos if we are the only book\n\t\t\tsuccess = true\n\t\t\tsuccess = photo.destroy if photo.books.count == 0\n\t\t\tPB.logger.error \"Could not destroy photo #{photo.id}\" unless success\n\t\tend\n\tend", "def destroy_attached\n destroy if destroy?\n end", "def delete_image_attachment\n @image = ActiveStorage::Attachment.find(params[:id])\n @image.purge\n redirect_back(fallback_location: items_path)\n end", "def destroy\n @submission_detail.attachment = nil\n @submission_detail.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Document was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.images.purge if @article.images.attached?\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: '記事を削除しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n attachable_id = attachable.try(:id) || attachable\n response = api.delete(\n \"user/#{api.user_name}/\" \\\n \"realestate/#{attachable_id}/\" \\\n \"attachment/#{id}\"\n )\n handle_response(response)\n self\n end", "def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n puts \"------------------------\"\n document_item = ActiveStorage::Attachment.find(@document.doc.id)\n p document_item.purge\n puts \"------------------------\"\n\n @document.destroy\n respond_to do |format|\n\n\n\n\n format.html { redirect_to property_property_unit_documents_path(@property, @property_unit), notice: 'Dokumentet ble slettet.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @attachment_datum = AttachmentDatum.find(params[:id])\n @attachment_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to attachment_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reflection.destroy\n head :no_content\n end", "def purge\n if attached?\n attachment.purge\n write_attachment nil\n end\n end", "def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @attachment = Attachment.find(params[:attachment_id])\n @attachment.destroy\n Keys.where(attachment_id: @attachment.id).destroy_all\n GetModel(params[:type]).where(file_id: @attachment.id).destroy_all\n \n respond_to do |format| \n format.html { redirect_to '/imports/'+params[:profile_id].to_s+'/csv/'+params[:type].to_s,notice: 'File has been deleted!' }\n end\n \n end", "def destroy\n @documentary.remove_thumbnail = true\n @documentary.save!\n head :no_content\n end", "def destroy\n @cms_attachment.destroy\n respond_to do |format|\n format.html { redirect_to cms_attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cms_attachment.destroy\n respond_to do |format|\n format.html { redirect_to cms_attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n flash[:notice] = 'attachment was successfully destroyed.'.t\n respond_to do |format|\n format.html { redirect_to page_attachments_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @file_upload_attachment.destroy\n respond_to do |format|\n format.html { redirect_to file_upload_attachments_url }\n format.json { head :no_content }\n end\n end", "def purge\n if attached?\n attachments.each(&:purge)\n @attachments = nil\n end\n end", "def destroy\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_path, notice: 'Destroyed successfully.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n\n head :no_content\n end", "def destroy\n Attachment.find(@equip_person.id_attachment).destroy\n @equip_person.destroy\n respond_to do |format|\n format.html { redirect_to equip_people_url, notice: 'Le membre de l\\'équipe a bien été retiré.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link_attachment.destroy\n respond_to do |format|\n format.html { redirect_to link_attachments_url }\n format.json { head :no_content }\n end\n end", "def destroy_attached_files\n Paperclip.log(\"Deleting attachments.\")\n each_attachment do |name, attachment|\n attachment.send(:flush_deletes)\n end\nend", "def destroy\n @image_attrib.destroy\n end", "def destroy\n @extra.destroy\n\n head :no_content\n end", "def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(attachments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(attachments_url) }\n format.xml { head :ok }\n end\n end", "def detach\n if attached?\n attachment.destroy\n write_attachment nil\n end\n end", "def destroy\n @attached_asset = AttachedAsset.find(params[:id])\n @attached_asset.destroy\n\n respond_to do |format|\n format.html { redirect_to attached_assets_url }\n format.json { head :no_content }\n end\n end", "def delete\n begin \n # file_assets\n file_assets.each do |file_asset|\n file_asset.delete\n end\n # We now reload the self to update that the child assets have been removed...\n reload()\n # Call ActiveFedora Deleted via super \n super()\n rescue Exception => e\n raise \"There was an error deleting the resource: \" + e.message\n end\n end", "def destroy\n if @item.photo and Rails.env.production?\n client = kaltura_setup\n delete_entry(@item.photo, client)\n end\n\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pub_attachment.destroy\n respond_to do |format|\n format.js { head :ok, notice: 'Anexo excluído com sucesso.' }\n end\n end", "def destroy_cleanup\n\tadd_to_deleted(@micropost)\n end", "def destroy\n object_data.each {|o| ObjectDatum.find_by_guid(o.guid).destroy if o && ObjectDatum.find_by_guid(o.guid)}\n super\n end", "def destroy\n @attachment.destroy\n respond_to do |format|\n format.js {}\n end\n\n end", "def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :no_content }\n end\n end", "def purge_blobs\n photos_attachments.each do |photo_attachment|\n if photo_attachment.marked_for_destruction?\n photo_attachment.blob.purge_later\n end\n end\n end", "def destroy\n @uploaded_document.destroy\n end", "def destroy\n @article.remove_thumbnail = true\n @article.save!\n head :no_content\n end", "def destroy\n\t\t# Desttroy the particular case media with all the attachment files\n\t\t@case_medium.destroy\n\t\t# Redirect to the case media index page after destroy case medium\n\t\tredirect_to case_case_media_path(@surgery_case)\n\tend", "def destroy\n @attachinaryfile.destroy\n respond_to do |format|\n format.html { redirect_to attachinaryfiles_url, notice: 'Attachinaryfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Rails.logger.debug {\"destroying gridfs file #{@id}\"}\n if persisted?\n Photo.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end\n end", "def delete_file(uid, info = {})\n if info[\"multipart_id\"]\n multipart_upload = object(uid).multipart_upload(info[\"multipart_id\"])\n abort_multipart_upload(multipart_upload)\n\n delete [object(\"#{uid}.info\")]\n else\n delete [object(uid), object(\"#{uid}.info\")]\n end\n end", "def destroy\n @order_attachment.destroy\n respond_to do |format|\n format.html { redirect_to order_attachments_url, notice: 'Order attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n persister.delete(resource: delete_change_set)\n respond_to do |format|\n format.html { redirect_to data_dictionary_fields_url, notice: 'Metadata field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cleanup\n begin\n File.delete(full_filename, full_filename + \".meta\")\n rescue\n logger.warn \"Unable to delete recordings files: #{full_filename}*\"\n end\n end", "def destroy\n @friends_attachment.destroy\n respond_to do |format|\n format.html { redirect_to friends_attachments_url, notice: \"Friends attachment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @attachments = Attachment.find_by_id(params[:id])\n if @attachments.present?\n @attachments.destroy\n render :json=>{:response=>\"success\"}\n\t\tend\n end", "def destroy\n check_user\n @rent_post.destroy\n @post_attachment = PostAttachment.where(rent_post: @rent_post.id)\n @post_attachment.destroy_all\n respond_to do |format|\n format.html { redirect_to rent_posts_url, notice: 'Rent post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @design_image_attachment.destroy\n respond_to do |format|\n format.html { redirect_to design_image_attachments_url, notice: 'Design image attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property_attachment.destroy\n respond_to do |format|\n format.html { redirect_to property_attachments_url, notice: \"Property attachment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @gallery_attachment.destroy\n respond_to do |format|\n format.html { redirect_to gallery_attachments_url, notice: 'Gallery attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thumb.destroy\n\n head :no_content\n end", "def destroy\n @attachment = Attachment.find_by_name(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :ok }\n end\n end", "def destroy_unsaved_attachments\n @client_side_timestamp = params[:client_side_timestamp]\n @filename = params[:filename]\n @cas_user = session[:cas_user]\n\n RecordAttachment.where(:client_side_timestamp => @client_side_timestamp, \n :filename => @filename, :cas_user_name => @cas_user).destroy_all\n render :nothing => true\n end", "def destroy\n @asset = Asset.find(params[:id])\n @asset.photo.destroy\n @asset.save\n redirect_to :back\n end", "def destroy\n @teacher_attachment.destroy\n respond_to do |format|\n format.html { redirect_to teacher_attachments_url, notice: 'Teacher attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_pic\n self.posts.each do |post|\n post.pic.destroy\n end\n end", "def destroy\n file&.delete\n end", "def before_destroy\n\t\tresult, message = self.delete_image\n\n\t\tif result != true\n\t\t\traise message\n\t\tend\n\n\t\treturn result\n\tend", "def destroy\n @event_attachment.destroy\n respond_to do |format|\n format.html { redirect_to event_attachments_url, notice: 'Event attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def detach attachment\n if self.attachments\n detached = self.attachments.delete attachment\n detached.detached if detached # callback\n end\n end", "def remove!\n MiGA.DEBUG \"Metadata.remove! #{path}\"\n File.unlink(path)\n nil\n end", "def destroy\n\t\t@post_metum.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to post_meta_url, notice: 'Post metum was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @boat_attachment.destroy\n respond_to do |format|\n format.html { redirect_to boat_attachments_url, notice: 'Boat attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @attached = Attached.find(params[:id])\n @event = Event.find(@attached.event_id)\n @attached.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/manage_attached/\" + @event.id.to_s }\n format.json { head :no_content }\n end\n end", "def delete\n Attachment.destroy(params[:id]) unless params[:id].blank? if request.delete?\n @attachment_count = params[:attachment_number] || 0\n end", "def _delete(uploaded_file, context)\n if (versions = uploaded_file).is_a?(Hash)\n _delete(versions.values, context)\n else\n super\n end\n end", "def destroy\n #remove main photo if necessary\n post = Post.where(main_photo: @photo.id).first\n if (post.present?)\n first_photo = Photo.sort_photos_asc.from_post(post.id).first\n if (first_photo.present?)\n post.main_photo = firstPhoto.id\n post.save\n end\n end\n\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_attachment.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'Your image was successfully deleted.'\n redirect_to :back\n }\n format.json { head :no_content }\n end\n end", "def destroy\n @structure_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def after_save\n if self.data_file_name.nil?\n self.destroy\n else\n\n end\n end", "def _delete(uploaded_file, context)\n remove(uploaded_file, context)\n end", "def destroy\n @metum.destroy\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(pad_attachments_path(@pad)) }\n format.xml { head :ok }\n end\n end", "def destroy_avatar\n self.avatar.purge if self.avatar.attached?\n end", "def delete_from_store\n Attachment.delete_from_store(url)\n end", "def email_on_delete(attachment)\n @attachment = attachment\n attachments.inline[\"alaraby_logo.png\"] = File.read(\"#{Rails.root}/app/assets/images/alaraby_logo.png\")\n \n mail to: array_of_emails(AttachmentEmail), subject: \"Attachment Deleted\"\n end", "def destroy\n @message_attachment = MessageAttachment.find(params[:id])\n @message_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to message_attachments_url }\n format.json { head :no_content }\n end\n end", "def purge_later\n if attached?\n attachments.each(&:purge_later)\n @attachments = nil\n end\n end", "def destroy\n @article = Article.get(params[:id])\n \n # 업로드된 이미지 파일 삭제 =========================================================================\n file_name = @article.image_filename\n if File.exist?(IMAGE_PATH + file_name)\n \tFile.delete(IMAGE_PATH + file_name) #original image file\n \tFile.delete(IMAGE_PATH + \"t_\" + file_name) #thumbnail file\n end\n # 업로드된 이미지 파일 삭제 =========================================================================\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pdf_attachment.destroy\n respond_to do |format|\n format.html { redirect_to pdf_attachments_url, notice: 'File was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def make_deleted(data_file:)\n case data_file.file_state\n when 'created' # delete from db since it's new in this version\n my_hate = { _links: StashApi::File.new(file_id: data_file.id).links.except(:self) }\n data_file.destroy\n return my_hate\n when 'copied' # make 'deleted' which will remove in this version on next submission\n data_file.update!(file_state: 'deleted')\n end\n StashApi::File.new(file_id: data_file.id).metadata\n end", "def clear_photo\n self.photo = nil if delete_photo? && !photo.dirty?\n end", "def clear_photo\n self.photo = nil if delete_photo? && !photo.dirty?\n end", "def destroy\n @meta_content = MetaContent.find(params[:id])\n @meta_content.destroy\n \n respond_to do |format|\n format.html { redirect_to meta_contents_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7505327", "0.72655946", "0.72537184", "0.722451", "0.7019613", "0.6984565", "0.6864259", "0.68231374", "0.68230915", "0.68118167", "0.67784214", "0.6778171", "0.6775958", "0.67725444", "0.6767854", "0.67676735", "0.67615664", "0.6760627", "0.675868", "0.6757567", "0.67178845", "0.66948926", "0.6687397", "0.6687397", "0.6687397", "0.66850215", "0.6665316", "0.66540724", "0.66540724", "0.66251856", "0.6624055", "0.66227454", "0.6605349", "0.65911853", "0.65909845", "0.6590478", "0.65751165", "0.6568555", "0.6561838", "0.65610677", "0.6558134", "0.6558134", "0.6554453", "0.6549769", "0.6548152", "0.65388006", "0.65332615", "0.6510763", "0.6506524", "0.65002215", "0.6486949", "0.64836246", "0.6473296", "0.64627665", "0.64618874", "0.6457896", "0.64463204", "0.6442779", "0.6441196", "0.6440207", "0.6439778", "0.6435154", "0.64256066", "0.6419546", "0.6417671", "0.6416944", "0.6415335", "0.6413446", "0.64108676", "0.64073634", "0.6404756", "0.63999885", "0.6387551", "0.6383536", "0.6383144", "0.6382395", "0.63771373", "0.6368946", "0.6365418", "0.6364346", "0.63602215", "0.6355537", "0.6355453", "0.63521445", "0.6348079", "0.63381255", "0.6335911", "0.6333171", "0.63317", "0.63235426", "0.63116384", "0.6309973", "0.63084215", "0.6304169", "0.63006306", "0.6292979", "0.62913734", "0.628877", "0.628083", "0.628083", "0.6279135" ]
0.0
-1
get styles sorted by size from largest to smallest :original if it exists is always first
def weighted_styles(input) Hash[input.sort_by do |meta_style_name,meta_style| r = if meta_style_name == :original -9999999999999 else 0 - (meta_style[:width].to_i + meta_style[:height].to_i) end end] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def styles\n return if @styles.empty?\n @styles.uniq.sort\n end", "def closest_size(object, size)\n sizes = object.options[:styles].values.collect{ |x| { x => parse_size(x) } }.sort_by{ |x| x.values }\n closest_size_hash = sizes.min_by { |x| ( x.values.first.to_f - Column.sizes[size] ).abs }\n style = object.options[:styles].key(closest_size_hash.keys.first)\n end", "def styles\n if position == 1 || position == 2\n { :medium => \"175x150>\" }\n elsif position == 3\n { :medium => \"350x150>\" } \n elsif position == 4\n { :medium => \"350x300>\" } \n else\n { :medium => \"175x150>\" }\n end\n end", "def rated_styles\n beers.map{|b| b.style}.uniq\n end", "def font_sizes\n @font_sizes ||= begin\n sizes = []\n doc.css(\"[style]\").each do |element|\n sizes.push element.font_size.round(-1) unless element.font_size.nil?\n end\n sizes.uniq.sort\n end\n end", "def ==(other)\n @styles.sort == other.styles.sort\n end", "def theme_assets_by_priority\n self.mounting_point.theme_assets.sort { |a, b| a.priority <=> b.priority }\n end", "def get_files(sort_style = SortStyle::Size)\n\t\tif sort_style.eql?(SortStyle::Name)\n\t\t\treturn @files.sort\n\telse\n\t\t\treturn @files.sort {|a,b| a[1]<=>b[1]}\n\t\tend\n\tend", "def media_styles_croppable_list\n list = Ubiquo::Config.context(:ubiquo_media).get(:media_styles_list)\n # The main styles are not croppable as they belong to the core\n Ubiquo::Config.context(:ubiquo_media).get(:media_core_styles).each do |s|\n list.delete(s)\n end\n # Filter the formats that are not strings like \"300x200#\"\n list.delete_if{|k,v| !v.respond_to?( :match )}\n list\n end", "def sort_variants(css_class_with_variants, variants_order:)\n *variants, css_class = css_class_with_variants.split(\":\")\n return css_class_with_variants if variants.length <= 1\n\n variants.sort_by! { |variant| variants_order.index(variant) }\n \"#{variants.join(':')}:#{css_class}\"\nend", "def stylesheets\n sort(css.clone.concat(sass_without_partials), config['order_css'] || [])\n end", "def thumbnail_options\n asset_sizes = thumbnail_sizes.collect{|k,v| \n size_id = k\n size_description = \"#{k}: \"\n size_description << (v.is_a?(Array) ? v.join(' as ') : v)\n [size_description, size_id] \n }.sort_by{|pair| pair.last.to_s}\n asset_sizes.unshift ['Original (as uploaded)', 'original']\n asset_sizes\n end", "def model_styles(args)\n options = set_model_styles_defaults(args)\n set_common_options(options)\n set_model_styles_order_by_clause(options)\n \n if options[:b_return_list]\n \n # get list of all styles\n obj_list = Style.all.reorder(options[:reorder_clause])\n end\n \n return model_make_results(options, obj_list, nil) \n end", "def pack_size_names\n return @pack_size_names if @pack_size_names\n names = @lines.inject([]) { |arr, l| arr << l[:pack_size] }.uniq.sort!\n @pack_size_names = place_blank_to_last(names)\n end", "def boxes_with_consistent_order\n boxes.sort { |b1, b2| b1.schema_id <=> b2.schema_id }\n end", "def geometry(style_name='original')\n # These calculations are all memoised.\n @geometry ||= {}\n begin\n @geometry[style_name] ||= if style_name.to_s == 'original'\n # If no style name is given, or it is 'original', we return the original discovered dimensions.\n original_geometry\n else\n # Otherwise, we apply a mock transformation to see what dimensions would result.\n style = self.file.styles[style_name.to_sym]\n original_geometry.transformed_by(style.geometry)\n end\n rescue Paperclip::TransformationError => e\n # In case of explosion, we always return the original dimensions so that action can continue.\n original_geometry\n end\n end", "def style_names\n styles.keys\n end", "def detected_styles; end", "def first_used\n [ index_of_first(self), index_of_first(@formats) ].compact.min\n end", "def styles\n @styles ||= Hash.new{ |h, k| h[k] = {} }\n end", "def sort_by_size(x,y)\n sizes = [\"Small\",\"Medium\",\"Large\",\"X-Large\",\"2X-Large\",\"3X-Large\"]\n cmp = sizes.index(x.tshirt) <=> sizes.index(y.tshirt)\n if cmp == 0\n x.name <=> y.name\n else\n cmp\n end\n end", "def collect_styles(*styles)\n @options = {}\n styles.each do |style|\n @options.update(styles.delete(style)) if style.is_a?(Hash)\n end\n \n # If no styles provided, we adapt all styles.\n styles = styles.empty? ? @style_list.clone : styles\n \n # except = styles.delete(:except)\n except = @options[:except]\n except = [except] if (except && !except.is_a?(Enumerable))\n except.collect! do |item| item.is_a?(String) ? item.to_sym : item end if !except.nil?\n # only = styles.delete(:only)\n only = @options[:only]\n only = [only] if (!only.nil? && !only.is_a?(Enumerable))\n only.collect! do |item| item.is_a?(String) ? item.to_sym : item end if !only.nil?\n\n # Only defaults to all styles if not defined.\n if !only.nil? then\n # Remove styles to display if not in only group\n styles.delete_if do |item| !only.include?(item) end\n end\n # Remove excepted styles\n if !except.nil? then\n styles.delete_if do |item| except.include?(item) end\n end\n\n styles\n end", "def predefined_styles\r\n @predefined_styles ||=\r\n begin\r\n tmp = {}\r\n styles do |s|\r\n tmp = {\r\n bold: s.add_style(b: true, alignment: { vertical: :top }),\r\n date: s.add_style(format_code: 'mm/dd/yyyy', alignment: { vertical: :top }),\r\n float: s.add_style(format_code: '#,##0.00', alignment: { vertical: :top }),\r\n integer: s.add_style(format_code: '#,##0', alignment: { vertical: :top }),\r\n percent: s.add_style(num_fmt: 9, alignment: { vertical: :top }),\r\n currency: s.add_style(num_fmt: 7, alignment: { vertical: :top }),\r\n text: s.add_style(format_code: '@', alignment: { vertical: :top }),\r\n wrapped: s.add_style(alignment: { wrap_text: true, vertical: :top }),\r\n normal: s.add_style(alignment: { vertical: :top })\r\n }\r\n end\r\n tmp\r\n end\r\n end", "def sort_cards\n return @cards.sort_by(&:color)\n self\n end", "def worst_to_best_image_names\n @worst_to_best_images ||= unmatched_images_tally.sort_by { |_image_name, num_unmatched| num_unmatched }.reverse.to_h.keys\n end", "def resize_dimensions(original_dimensions, style)\n if style.filled?\n style.dimensions\n else\n original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1]\n target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1]\n if original_aspect_ratio > target_aspect_ratio\n width = style.dimensions[0]\n height = (width / original_aspect_ratio).round\n else\n height = style.dimensions[1]\n width = (height * original_aspect_ratio).round\n end\n [width, height]\n end\n end", "def read_original_css\n File.open(@input_file) do |file|\n @original_css = file.read\n end\n @original_size = File.size(@input_file)\n end", "def check_priority\n images = []\n if self.building_id\n Image.reorder_by_building(building_id)\n elsif self.unit_id\n Image.reorder_by_unit(unit_id)\n end\n end", "def get_planet_names_sorted_by_size_decreasing()\n planets_sorted_by_size = @planets.sort_by { |planet| planet.diameter }\n planets_sorted_by_size_decreasing = planets_sorted_by_size.reverse\n planets_sorted_by_size_decreasing.map { |planet| planet.name }\n\nend", "def column_styles\n # [\n # {:name => 'general', :column => 0},\n # {:name => 'general', :column => 1},\n # {:name => 'general', :column => 2}\n #]\n []\n end", "def sort_sprites\n @viewport&.sort_z\n end", "def extract_css_dimension(style_str, target_dimension)\n # We are only interested in the style components that have the target dimension in their names\n # and have numeric pixel values.\n dimension_styles = style_str\n .split(';')\n .map { |s| s.gsub(/\\s+/, '') }\n .grep(/#{target_dimension}/i)\n .grep(/\\d+px$/i)\n\n # Sort by style string length to prefer a style like +width:30px+ to one with a +min-+ or +max-+ prefix.\n # And if you have to choose between a +min-+ or a +max-+, choose the max by preferring the one that's first\n # in alphabetical order.\n best_style = dimension_styles.min_by do |s|\n style_name = s.split(':').first\n [style_name.size, style_name]\n end\n\n numeric_match = best_style.to_s.split(':').last.to_s.match(/\\d+/)\n numeric_match && numeric_match[0]\n end", "def sorted_sage_elements\n sage_elements.sort_by { |h| h[:title] }\n end", "def sizes\n images.collect(&:classifier).sort\n end", "def list_styles(**opt)\n # Overridden by the subclass if configured for search analysis.\n end", "def get_row_style(row)\n if @row_styles[(row+1).to_s].nil?\n @row_styles[(row+1).to_s] = {}\n @row_styles[(row+1).to_s][:style] = '0'\n @workbook.fonts['0'][:count] += 1\n end\n return @row_styles[(row+1).to_s][:style]\n end", "def sorted_contents\r\n @contents.keys.sort\r\n end", "def detected_styles=(_arg0); end", "def frontcover_resource\n fc=@supporting_resources.select { |sr| sr.type.human==\"FrontCover\" }\n if fc.length > 0\n if fc.length > 1\n best_found=fc.select{|c| c.versions.last and c.versions.last.image_width}.sort { |c1, c2| c2.versions.last.image_width <=> c1.versions.last.image_width }.first\n if best_found\n # we take larger one\n best_found.versions.last\n else\n # we try first that is not gif\n fc.select{|sr| not sr.versions.last.file_format==\"Gif\"}.first.versions.last\n end\n else\n fc.first.versions.last\n end\n end\n end", "def all_styles(include_hidden = false)\n doc = Scraping.noko_doc(URI.join(BASE_URL, '/beerstyles/'))\n root = doc.at_css('div.container-fluid')\n\n categories = root.css('h3').map(&:text)\n style_node = root.css('.styleGroup')\n\n styles = style_node.flat_map.with_index do |list, i|\n list.css('a').map do |x|\n category = categories[i]\n Style.new(x['href'].split('/').last.to_i, name: x.text).tap do |s|\n s.category = category\n end\n end\n end\n if include_hidden\n styles + hidden_styles\n else\n styles\n end\n end", "def sort_by_size(file, size)\n if @file_hash[:\"#{size}\"] == nil\n @file_hash[:\"#{size}\"] = []\n @file_hash[:\"#{size}\"] << file\n else\n @file_hash[:\"#{size}\"] << file\n end\n end", "def sorted_sage_all_elements\n sage_all_elements.sort_by { |h| h[:title] }\n end", "def skittle_combos(skittles)\n array = []\n skittles.each do |color1|\n skittles.each do |color2|\n if color1 == color2 \n next \n end \n result = [color1,color2].sort()\n array.append(result)\n end\n end\n return array \nend", "def icon_set_styles\n {\n \"3_arrows\" => \"3Arrows\", # 1\n \"3_flags\" => \"3Flags\", # 2\n \"3_traffic_lights_rimmed\" => \"3TrafficLights2\", # 3\n \"3_symbols_circled\" => \"3Symbols\", # 4\n \"4_arrows\" => \"4Arrows\", # 5\n \"4_red_to_black\" => \"4RedToBlack\", # 6\n \"4_traffic_lights\" => \"4TrafficLights\", # 7\n \"5_arrows_gray\" => \"5ArrowsGray\", # 8\n \"5_quarters\" => \"5Quarters\", # 9\n \"3_arrows_gray\" => \"3ArrowsGray\", # 10\n \"3_traffic_lights\" => \"3TrafficLights\", # 11\n \"3_signs\" => \"3Signs\", # 12\n \"3_symbols\" => \"3Symbols2\", # 13\n \"4_arrows_gray\" => \"4ArrowsGray\", # 14\n \"4_ratings\" => \"4Rating\", # 15\n \"5_arrows\" => \"5Arrows\", # 16\n \"5_ratings\" => \"5Rating\" # 17\n }\n end", "def sorted_properties\n properties.sort {|a,b| \n case\n when a == master\n -1\n when b == master\n 1\n else\n a.locale <=> b.locale\n end\n }\n \n end", "def populate_page_sizes_by_order\n self.parent_size = self.order.parent_size\n self.press_size = self.order.press_size\n end", "def sorted_materials\n @sorted_materials ||= materials.to_a.sort do |a, b|\n case\n when a.material_hero && (a.material_hero.name == name)\n -1\n when b.material_hero && (b.material_hero.name == name)\n 1\n when a.material_hero && !b.material_hero\n -1\n when !a.material_hero && b.material_hero\n 1\n else\n b.stars <=> a.stars\n end\n end\n end", "def clever_octopus(fishes)\n largest = fishes.first\n\n fishes.each { |fish| largest = fish if largest.length < fish.length }\n\n largest\nend", "def frontcover_resource\n fc=@supporting_resources.front_cover\n if fc.length > 0\n if fc.length > 1\n best_found=fc.select{|c| c.versions.last and c.versions.last.image_width}.sort { |c1, c2| c2.versions.last.image_width <=> c1.versions.last.image_width }.first\n if best_found\n # we take larger one\n best_found.versions.last\n else\n # we try first that is not gif\n fc.select{|sr| not sr.versions.last.file_format==\"Gif\"}.first.versions.last\n end\n else\n fc.first.versions.last\n end\n end\n end", "def lower_priority_elements\n []\n end", "def sort_by_color(array)\n colors = [:red, :blue, :yellow]\n i = 0\n j = 1\n 0.upto(array.size - 1) do\n break if j > array.size - 1\n if array[i][1] != :red && array[j][1] == :red \n array[i], array[j] = array[j], array[i]\n i += 1\n end\n j += 1\n end\n \n # i is now at the position right after the last red\n j = array.size - 1\n p array\n while i < j\n if array[i][1] == :yellow && array[j][1] == :blue\n array[i], array[j] = array[j], array[i]\n i += 1\n elsif array[i][1] == :blue && array[j][1] == :blue && array[i][0] > array[j][0]\n array[i], array[j] = array[j], array[i]\n i += 1\n else\n j -= 1\n end\n end\n array\nend", "def styles\n mentos(:get_all_styles)\n end", "def best_color_settings\n if black_and_white?\n [ChunkyPNG::COLOR_GRAYSCALE, 1]\n elsif grayscale?\n if opaque?\n [ChunkyPNG::COLOR_GRAYSCALE, 8]\n else\n [ChunkyPNG::COLOR_GRAYSCALE_ALPHA, 8]\n end\n elsif indexable?\n [ChunkyPNG::COLOR_INDEXED, determine_bit_depth]\n elsif opaque?\n [ChunkyPNG::COLOR_TRUECOLOR, 8]\n else\n [ChunkyPNG::COLOR_TRUECOLOR_ALPHA, 8]\n end\n end", "def implicit_headings\n @implicit_headings ||= begin\n headings = []\n doc.css(\"[style]\").each do |element|\n headings.push element unless element.font_size.nil? || element.font_size < MIN_HEADING_SIZE\n end\n headings\n end\n end", "def styles\n return @metadata[:styles]\n end", "def sortBorderPoints\n border_points.sort { |a,b| a.local_index <=> b.local_index }\n end", "def sort_plates2(plates)\n plates each do |pl|\n p pl\n bnds = pl.bounds.diagonal.to_f.round(4)\n\n #(idea) create a hash of objects and thier diagonal and compact it.\n #check definition instances against each other for diagonal\n\n #make differences unique and update the definition\n\n #check that the now true thickness matches the material thickness\n\n #give warnings when some of these occur.\n end\n\n end", "def sort_if_needed\n @rules.sort! unless @sorted\n @sorted = true\n end", "def report_styles(size = 12)\n @org_name_style ||= style.add_style b: true,\n sz: size,\n alignment: { horizontal: :left, wrap_text: true }\n end", "def rec_dict_sort unsorted, sorted\r\n\tif unsorted.length <= 0\r\n\t\treturn sorted\r\n\tend\r\n\t# if here then there is still work to do\r\n\r\n\tsmallest = unsorted.pop\r\n\tstill_unsorted = []\r\n\r\n\tunsorted.each do |tested_object|\r\n\t\tif tested_object.downcase < smallest.downcase\r\n\t\t\t# when tested_object < smallest\r\n\t\t\tstill_unsorted.push smallest\r\n\t\t\tsmallest = tested_object\r\n\t\telse\r\n\t\t\tstill_unsorted.push tested_object\r\n\t\tend\r\n\tend\r\n\t# now 'smallest' really does point to the smallest\r\n\t# element that 'unsorted' contained, and all the\r\n\t# rest of it is in 'still_unsorted'\r\n\tsorted.push smallest\r\n\r\n\trec_dict_sort still_unsorted, sorted\r\nend", "def regularise_styles(content_raw)\n doc = REXML::Document.new(content_raw)\n\n # Get the default column types from all the sheets (tables) in\n # the workbook\n num_tables = doc.root.elements.to_a('//office:body/*/table:table').length\n (1 .. num_tables).to_a.each do |tnum|\n col_types = []\n cols = doc.root.elements.to_a(\"//table:table[#{tnum}]/table:table-column\")\n cols.each do |col|\n (0 ... (col.attributes['table:number-columns-repeated'] ||\n 1).to_i).to_a.each do\n col_types << col.attributes['table:default-cell-style-name']\n end\n end # each column\n\n # Get the number of rows for each table\n num_rows = doc.root.elements.to_a(\"//table:table[#{tnum}]/table:table-row\").length\n\n # Go through each row and process its cells\n (1 .. num_rows).to_a.each do |rnum|\n # The cells are both <table:table-cell> and\n # <table:covered-table-cell>\n cells = doc.root.elements.to_a(<<-END\n//table:table[#{tnum}]/table:table-row[#{rnum}]/(table:table-cell | table:covered-table-cell)\nEND\n )\n # Keep track of the column number, for formatting purposes\n # (c.f. col_types)\n col_num = 0\n cells.each do |cell|\n # Only need to explicitly format the <table:table-cell>s\n if cell.name == 'table-cell'\n cell.attributes['table:style-name'] ||= col_types[col_num]\n end\n # Advance the column number, based on the columns spanned\n # by the cell\n col_num += (cell.attributes['table:number-columns-repeated'] ||\n 1).to_i\n end\n\n end # each row\n end # each table\n\n return doc.to_s\n end", "def file_urls\n return { :original => file.url(:original) } unless image?\n file.styles.keys.inject({}){ |hash, style| hash.merge!(style => file.url(style)) }\n end", "def minimize\n return unless @parse_results[:command][2]\n tab = [{color: @parse_results[:command][1][:color], text: \"\"}]\n @parse_results[:command][1..-1].each do |part|\n tab << {color: part[:color], text: \"\"} if tab.last[:color] != part[:color]\n tab.last[:text] << part[:text] << \" \"\n end\n @parse_results[:command][1..-1] = tab\n end", "def size_key(size)\n case size.to_sym\n when :square : 's'\n when :thumb, :thumbnail : 't'\n when :small : 'm'\n when :medium : '-'\n when :large : 'b'\n when :original : 'o'\n else ''\n end\n end", "def post_process_styles_with_blank\n @styles.each do |name, args|\n return if args[:processors].blank?\n end\n post_process_styles_without_blank\n end", "def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end", "def build_tag_cloud(tags)\n max, min = 30, 10 # font size of tags\n popularity = []\n tags.each{|t| (popularity << t.popularity)}\n x = ((max - min) / popularity.uniq.length)\n for i in 0...(tags.length)\n if i != 0 && tags[i - 1].popularity.to_i > tags[i].popularity.to_i\n max=max - x # Setting font size\n end\n yield tags[i].name, max.to_s+'px'\n end\n end", "def sluggish_octopus_2(fishes) \n prc = Proc.new { |a, b| a <=> b }\n\n bubble_sort(&prc).first\nend", "def print_file_sizes(format = Format::Normal, sortStyle = SortStyle::Size, minimumSize = 0)\n\t\tsorted_list = @folder_walker.get_files(sortStyle)\n\t\tprint_sorted_list(sorted_list, format, minimumSize)\n\tend", "def getStyle(filename)\n DEFAULT_FILE_TYPES.invert[File.extname(filename)]\n end", "def best type = :rmse\r\n\t\tsafeSort(type).first\r\n\tend", "def _InStyleTags\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_StyleOpen)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_StyleClose)\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_StyleClose)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_InStyleTags unless _tmp\n return _tmp\n end", "def _each_optional_before_sorted\n @optionals_before.each do |_, optionals|\n tmp = []\n optionals.each do |optional_index, before|\n tmp.push(\n count: before.size,\n index: optional_index,\n )\n end\n\n tmp.sort! { |a, b| b[:count] - a[:count] }.each do |item|\n yield optionals[item[:index]]\n end\n end\n\n self\n end", "def combos_in_tricking_style(tricker, style)\n # get all the combos using this trick\n combos = self.combos.uniq\n\n # remove my combos from this list\n combos.reject! { |c| c.tricker == tricker }\n \n # get the ids of the tricks I can do\n included_tricks = style.tricks.map(&:id)\n\n # (style-combo).count == style.count - combo.count\n # this hits the database twice. is there a better way?\n combos.reject! { |c| ((included_tricks-c.tricks.map(&:id)).count != (included_tricks.count - c.tricks.uniq.map(&:id).count)) }\n\n combos or []\n end", "def styles=(_arg0); end", "def sort_jobs(job_list)\n sorted_and_filtered = []\n [\"red\", \"yellow\", \"grey\"].each do |color|\n job_list.select {|j| j.color == color}.each { |j| sorted_and_filtered << j }\n end\n sorted_and_filtered\nend", "def extractStyleAttributes(parsed_doc)\n style_attributes = {}\n styled_tags = parsed_doc.css(\"svg[style],mjx-container[style]\")\n for styled_tag in styled_tags do\n style_attribute = styled_tag[\"style\"]\n digest = Digest::MD5.hexdigest(style_attribute)[0..15]\n style_attributes[digest] = style_attribute\n\n digest_class = \"mathjax-inline-#{digest}\"\n styled_tag[\"class\"] = \"#{styled_tag[\"class\"] || \"\"} #{digest_class}\"\n styled_tag.remove_attribute(\"style\")\n end\n return style_attributes\n end", "def best_effort\n @raw.find_all { |l| l['confidence'] > 0.1 && l['language'] != \"xxx\" }.sort { |a, b| b['confidence'] <=> a['confidence'] }.map { |l| l['language'] }\n end", "def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end", "def find_largest filename, json\n index = -1\n maxsize = 0\n json[\"images\"].each_with_index do |image, i|\n unless image[\"filename\"].nil?\n size = width_of \"#{dir filename}/#{image['filename']}\"\n if size > maxsize\n maxsize = size\n index = i\n end\n end\n end\n # Warn users if upscaling assets\n unless json['images'][index] == json['images'][-1]\n image = lastdir filename, '.*'\n puts \"warning: Upscaling from #{maxsize}px occured in asset '#{image}'\"\n end\n return json['images'][index]\nend", "def best_selling_style\n style = nil\n if self.group_size <= 4\n style = \"knowledgeable\"\n elsif self.group_size >4 && self.group_size <= 8\n style = \"attention to detail\"\n elsif self.group_size > 8\n style =\"pushy\"\n end\n style\n end", "def larger_than(size)\n list = @file_table.to_hash.select do |file, data|\n c = SizeConversion.new(size.to_s)\n data[:size].to_f > c.to_size(:b).to_f\n end\n return list\n end", "def word_sizes(string)\n size = []\n string.split(' ').each{|word| size << word.size}\n biggest = size.max \n if biggest == nil\n biggest = 0\n end \n output = {}\n i = 1\n loop do \n output[i] = size.count(i)\n i+=1\n if i>biggest\n break\n end \n end \n output.delete_if {|k, v| v<= 0}\n output\nend", "def geometry(style_name='original')\n if style_name == 'original'\n Paperclip::Geometry.parse(\"#{original_width}x#{original_height}\")\n else\n Paperclip::Geometry.parse(style_dimensions(style_name))\n end\n end", "def correct_style_detected; end", "def correct_style_detected; end", "def correct_style_detected; end", "def build_tag_cloud(tag_cloud, style_list)\nmax, min = 0, 0\ntag_cloud.each do |tag|\nmax = tag.popularity.to_i if tag.popularity.to_i > max\nmin = tag.popularity.to_i if tag.popularity.to_i < min\nend\n\ndivisor = ((max - min) / style_list.size) + 1\n\ntag_cloud.each do |tag|\nyield tag.name, style_list[(tag.popularity.to_i - min) / divisor]\nend\nend", "def get_style_rules\n computed_style_rules = Hash.new\n if self.style_layer and self.type == Layer::LAYER_NORMAL\n # this means its a style layer and it has image to be set as background \n computed_style_rules[:background] = \"url('../../#{self.image_path}') no-repeat\"\n computed_style_rules[:'background-size'] = \"100% 100%\"\n computed_style_rules[:'background-repeat'] = \"no-repeat\"\n end\n\n style_rules = Array.new\n\n # Get the computed styles for background image for NORMAL layer\n style_rules += Compassify::styles_hash_to_array computed_style_rules\n\n # Get all the other css3 styles for the layer\n style_rules += StylesGenerator.get_styles self\n\n return style_rules\n end", "def [](type)\n (@styles_by_type ||= {})[type.to_sym] ||= []\n end", "def sluggish_octopus(fishes)\r\n biggest_fish = \"\"\r\n\r\n fishes.each_with_index do |fish1, idx1|\r\n fishes.each_with_index do |fish2, idx2|\r\n if idx2 > idx1\r\n if fish2.length > biggest_fish.length\r\n biggest_fish << fish2\r\n end\r\n end\r\n end\r\n end\r\n return biggest_fish\r\nend", "def horizontal?(style_name='original')\n geometry(style_name).horizontal?\n end", "def best_of(*media_types)\n media_types.min_by { |m| rank(m) }\n end", "def default_sorter\n lambda { |files|\n files.sort do |a, b|\n if b.container?\n a.container? ? a.name.downcase <=> b.name.downcase : 1\n else\n a.container? ? -1 : a.name.downcase <=> b.name.downcase\n end\n end\n }\n end", "def container_sort(things)\n things = things.sort do |a,b|\n if a.children.length > 0\n if b.children.length > 0\n a.name < b.name ? -1 : 1\n else\n -1\n end\n else\n if b.children.length > 0\n 1\n else\n a.name < b.name ? -1 : 1\n end\n end\n end\n things\n end", "def small_dogs\n small_dogs =[]\n @dogs.each do |dog|\n if dog[:size] == :small\n small_dogs << dog\n end\n end\n small_dogs\n end", "def last_sizer\n @stack.reverse.find { | obj | obj.kind_of? Sizer }\n end", "def dependency_order\n sorted = strongly_connected_components.flatten\n\n result = []\n seen = {}\n\n sorted.each do |spec|\n if index = seen[spec.name] then\n if result[index].version < spec.version then\n result[index] = spec\n end\n else\n seen[spec.name] = result.length\n result << spec\n end\n end\n\n result.reverse\n end", "def sort_by_extension_and_size(file, extension, size)\n if @file_hash[:\"#{extension}\"] == nil\n new_hash = {}\n new_hash[:\"#{size}\"] = []\n new_hash[:\"#{size}\"] << file\n @file_hash[:\"#{extension}\"] = new_hash\n else\n my_hash = @file_hash[:\"#{extension}\"]\n if my_hash[:\"#{size}\"] == nil\n my_hash[:\"#{size}\"] = []\n my_hash[:\"#{size}\"] << file\n else\n my_hash[:\"#{size}\"] << file\n end\n @file_hash[:\"#{extension}\"] = my_hash\n end\n end", "def images_with_default_or_relevant_first(color_set_ids, pattern)\n images = self.images.dup\n\n if color_set_ids.present? || pattern.present?\n new_first = self.image_from_color_set_or_pattern(color_set_ids, pattern)\n else\n new_first = self.default_image\n #sometimes the default image of a product is not an image. this makes sure we are\n #displaying an image and not an attachment which would cause an error\n new_first = images.first unless self.images.include?(self.default_image)\n end\n images.rotate(images.index(new_first)) if new_first.present?\n end" ]
[ "0.69042706", "0.60257554", "0.57862645", "0.5618286", "0.5600652", "0.5464023", "0.54195535", "0.53988194", "0.5328606", "0.5220255", "0.51080793", "0.5108019", "0.5072314", "0.5069812", "0.5060404", "0.49429885", "0.48961172", "0.48839307", "0.48715746", "0.48672637", "0.48451996", "0.48374456", "0.4828072", "0.48236144", "0.48150274", "0.4782026", "0.47796753", "0.47739068", "0.47248897", "0.47116143", "0.46893713", "0.4685575", "0.4675856", "0.46680355", "0.4662537", "0.46584743", "0.46535414", "0.46479893", "0.4647018", "0.46435717", "0.46365905", "0.46174398", "0.46131587", "0.4612624", "0.4610242", "0.46046385", "0.46045288", "0.46023566", "0.4601604", "0.45863825", "0.4578182", "0.45650873", "0.45574954", "0.45504513", "0.4549269", "0.45452964", "0.45307294", "0.45303154", "0.45294058", "0.45245302", "0.4517466", "0.45155793", "0.45062914", "0.45005295", "0.44990605", "0.44922954", "0.44709235", "0.4468904", "0.4468306", "0.44653487", "0.4464659", "0.4451349", "0.4445332", "0.44445574", "0.44401333", "0.44398046", "0.4439259", "0.4433398", "0.44326878", "0.44298252", "0.44287047", "0.44286966", "0.44244495", "0.4421921", "0.44218874", "0.44218874", "0.44218874", "0.4420863", "0.44179565", "0.44173762", "0.44155362", "0.4413885", "0.4413336", "0.44131336", "0.4412733", "0.44116712", "0.44060296", "0.44051167", "0.43944743", "0.43902913" ]
0.67744756
1
if this attachment is a remote url (i.e. not local filesystem)
def remote_url?(style_name = default_style) return (meta and meta.has_key?(style_name) and meta[style_name][:url]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_file_source_a_remote_url?\n !self.remote_url.blank?\n end", "def remote?\n uri = URI.parse url\n %w( http https ).include?(uri.scheme)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n if @type == \"image\"\n @ignored = true\n return true if url.match(/^data:image/)\n end\n\n false\n end", "def remote?\n !(url =~ /^https?/).nil?\n end", "def remote_file?\n file? && @remote_file\n end", "def ok_to_extract?(remote_url)\n true\n end", "def imageurl?\n !!self.imageurl\n end", "def local?\n @uri.scheme == 'file'\n end", "def external_asset_url?\n !same_source_host? && url_from_asset_tag?\n end", "def make_url_available_to_remote(local_url)\n end", "def get_attachment_url\n return self.attachment.url unless self.attachment.blank?\n end", "def remote?\n %w[http https].include? scheme\n end", "def mirror?\n source_type == 'url'\n end", "def remote_image_exists?(url)\n if url.end_with? 'gif'\n return true\n else\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = (url.scheme == \"https\")\n http.start do |http|\n return http.head(url.request_uri)['Content-Type'].start_with? 'image'\n end\n end\n end", "def migrate_linked_file?(uri)\n host = uri.host.to_s\n path = uri.path.to_s\n if(host == 'www.ctcc.uio.no')\n if(path != '/' and path != '')\n return true\n else\n return false\n end\n elsif(host != '')\n return false\n end\n return super(uri)\n end", "def file_url\n file.attached? ? url_for(file) : ''\n end", "def main_image_url?\n main_image_source == ImageSource::URL\n end", "def valid_download?\n @download_url != \"\"\n end", "def attachment_url(attachment)\r\n unless attachment.url == \"/geo_infos/original/missing.png\"\r\n \"#{root_url}#{attachment.url.gsub(/^\\//, '')}\"\r\n else\r\n \"\"\r\n end\r\n end", "def file_exists? url\n if url.match(/^http/)\n localfile = remote_url_to_local url\n else\n localfile = url\n end\n remotefile = local_to_remote localfile\n begin\n localfile_size = File.size localfile\n remotefile_size = ftp.size remotefile\n # puts \"#{localfile}: #{localfile_size}\"\n # puts \"#{remotefile}: #{remotefile_size}\"\n if remotefile_size == localfile_size\n url\n else\n nil\n end\n rescue Exception=>ex\n # puts ex.message\n nil\n end\n end", "def url?\n !url.nil?\n end", "def url?\n !urn?\n end", "def file_url(remote_path)\n get_adapter.file_url(remote_path)\n end", "def is_url_secured(url)\n url = url.downcase\n if !url.include?(\"https\") && !url.include?(\"http\")\n Logger.warning(\"Using 'is_url_secured' on a url that doesn't have a http(s):// attachment.\")\n end\n return url.include? \"https\"\nend", "def remote?\n false\n end", "def providers_download_url?\n true\n end", "def is_a_real_url?\n begin\n URI.parse(long_url)\n rescue URI::InvalidURIError\n errors.add(:message, \"must be a valid URL\")\n end \n end", "def providers_download_url?\n false\n end", "def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end", "def file_url\n end", "def image_url_provided?\n !self.image_url.blank?\n end", "def remote?\n !@remote.nil?\n end", "def image_url?\n image_node.nil?\n end", "def data_uri?\n @url[0..4] == 'data:'\n end", "def original_url\n if Rails.application.cloudfront_enabled?\n CloudFrontLocation.new(attachment.key, signed: signed?).url\n elsif Rails.application.remote_storage?\n s3_url\n else\n attachment.url\n end\n end", "def fetch?\n remote?\n end", "def pending_file_url(item = nil)\n get_file_data(item)[:url].presence\n end", "def external_download_url\n @file.external_bytestream_uri.to_s\n end", "def is_url?(path)\n path.to_s =~ %r{\\Ahttps?://}\n end", "def attachment_from_url(url)\n self.attachment = open(url)\n end", "def host\n local_file? ? \"file://\" : split_url[1]\n end", "def remote?\n true\n end", "def remote_file_exists?(url)\n url = URI.parse(url)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.request_uri).code == \"200\"\n end\n end", "def local\n uri.local?\n end", "def local\n uri.local?\n end", "def attachment?\n attachment.present? && attachment.readable?\n end", "def photo_url\n defined?(object.photo) ? object.photo.url : ''\n end", "def modify_media_file_url_if_from_video_site\n if media_file_url.present? && !ImageSrcUrl.new(media_file_url).is_image?\n video_src_url = VideoSrcUrl.new(media_file_url)\n self.media_file_url = video_src_url.value if video_src_url.is_video?\n end\n end", "def source_low_quality?\n source == :url\n end", "def url_content\n\t file.url\n\tend", "def file_uri?(uri)\n uri =~ %r{\\Afile://}\n end", "def direct_link_to_image?(url)\n regexp = Regexp.new('^https?://(?:[a-z\\-]+\\.)+[a-z]{2,6}(?:/[^/#?]+)+\\.(?:jpg|gif|png|jpeg|JPEG|JPG|PNG|GIF)$')\n (url =~ regexp).present?\n end", "def isitLink?(message)\n uri = URI.parse(message)\n %w( http https ).include?(uri.scheme)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end", "def file_url?(url)\n name = File.basename(url)\n name.include?('.zip') || name.include?('.tar.gz')\n end", "def image_remote_url=(url_value)\n self.image = URI.parse(url_value) unless url_value.blank?\n super\n end", "def providers_download_url?\n raise 'To be implemented in child classes'\n end", "def remote?\n @remote\n end", "def remote? # :nodoc:\n @remote\n end", "def download_remote_image3(remote_image_3_url)\n io = open(URI.parse(remote_image_3_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end", "def local?\n @attributes[:local_path_to_file] && File.exist?(@attributes[:local_path_to_file])\n end", "def remote_file_exists?(url)\n url = URI.parse(url)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.request_uri).code == \"200\"\n end\nend", "def is_local?\n !is_remote?\n end", "def valid_uri?\n !self.contentable.blank? || !self.uri_path.blank?\n end", "def url_has_a_dot_in?\n (external_resource_url =~ /\\./ )\n end", "def url?\n result = url\n result && \"#{result}?#{File.mtime(path).to_i}\"\n rescue Errno::ENOENT\n result\n end", "def consider_remote? # :nodoc:\n @domain == :both or @domain == :remote\n end", "def real_url?\n url && url.present? && url != \"#\"\n end", "def local?(link)\n uri = Addressable::URI.parse(link)\n return true if uri.host == @domain\n return false\n end", "def avatar_remote_url=(url_value)\n self.avatar = URI.parse(url_value)\n # Assuming url_value is http://example.com/photos/face.png\n # avatar_file_name == \"face.png\"\n # avatar_content_type == \"image/png\"\n @avatar_remote_url = url_value\n end", "def remote_file_exists?(full_path)\n remote_filetest_passes?('-e', full_path)\n end", "def url?\n children[0] && children[0].is_a?(Url)\n end", "def trackable?(uri)\n uri && uri.absolute? && %w(http https).include?(uri.scheme)\n end", "def attachment?\n !!find_attachment\n end", "def absolute_url?\n (self.include?('://') || self.start_with?('/')) ? true : false\n end", "def valid_url?\n\t\t# http:// or not http://\n\t\tx = self.long_url.start_with?(\"http://\", \"https://\")\n\t\tif x == false\n\t\t\treturn \"http://\" + self.long_url\n\t\telse\n\t\t\treturn self.long_url\n\t\tend\n\tend", "def is_url?\n path =~ URL_PATHS\n end", "def file_url\n if paperclip_attachment_attached?\n object.send(attribute_name).url(image_style)\n elsif activestorage_attachment_attached?\n attachment = object.send(attribute_name)\n\n if attachment.representable?\n attachment.representation(resize: \"400x150>\")\n else\n attachment.service_url\n end\n end\n end", "def mini_url\n attachment.url(:mini, false)\n end", "def imagekit_should_handle_remote?\n true\n end", "def imgurl\n picref.imgurl if picref\n end", "def proper_url? \n\t\tif !(self.long_url.start_with?('http://') || self.long_url.start_with?('https://'))\n\t\t\terrors.add(:long_url, \"is in invalid format.\")\n\t\tend \n\tend", "def has_photo?\n send('file_uploader_url').present?\n end", "def mini_url\n object.attachment.url('mini')\n end", "def same_source_host?\n parse(@url).host == parse(@source_url).host\n end", "def avatar_url\n self.avatar.attachment.nil? ? '' :\n \"#{Rails.configuration.api_url}#{Rails.application.routes.url_helpers.rails_blob_path(self.avatar, only_path: true)}\"\n end", "def absolute_url?(string); end", "def internal_source?(uri)\n uri = URI.parse(uri.to_s)\n\n internal_host?(uri.host) if uri.host\n end", "def image?\n @image ||= !!(attachment_content_type =~ /^image\\/.+/)\n end", "def external\n @external ||= http.select { |link| URL.new(link).host != host }\n end", "def download_remote_image1(remote_image_1_url)\n io = open(URI.parse(remote_image_1_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end", "def check_file(local_file)\n # Immateriel.info binding, @url\n uniq_str = Digest::MD5.hexdigest(\"#{@url}:#{local_file}\")\n uri = URI.parse(@url)\n fn = \"/tmp/#{uniq_str}_\" + Digest::MD5.hexdigest(File.basename(uri.path)) + File.extname(uri.path)\n self.class.download(@url, fn)\n if File.exist?(fn)\n check_result = self.class.check_image(fn, local_file, uniq_str)\n FileUtils.rm_f(fn)\n if check_result\n true\n else\n false\n end\n else\n false\n end\n end", "def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end", "def image?\n attachment_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end", "def open?(uri); end", "def avatar_url\n self.avatar.attachment.nil? ? '' :\n \"#{Rails.configuration.api_url}#{Rails.application.routes.url_helpers.rails_blob_path(self.avatar, only_path: true)}\"\n end", "def remote_file_differs?(full_path, content)\n !remote_file_exists?(full_path) || remote_file_exists?(full_path) && !remote_file_content_same_as?(full_path, content)\n end", "def image_url\n return object.image.service_url if object.image.attached?\n nil\n end", "def download_location\n self.remote_location.blank? ? File.join(self.id, self.upload_file_name) : self.remote_location\n end", "def isLocal (source)\n objectPath = source\n req = Net::HTTP::Get.new(@basePath+objectPath[6..-1]+'?metadata')\n setHeaders req\n response, data = @store.request(req)\n jsonResponse = JSON.parse(data)\n url =\"\"\n jsonResponse['metadatas']['metadatas'].each{ |o|\n url = o[1] if (o[0] == '{file}url')\n }\n store = url[4 ... url.index(\"://\")]\n (store == @localNamespace)\n end", "def remote_url_to_local url\n url.match /(#{config[:root_path]})(.+)$/\n file = $2\n basename = File.basename file\n basename.match(/(\\.\\w+)$/)\n mimetype = GET_MIME[$1].match(/(audio|video)/)[1]\n File.join(Rails.root,'public', mimetype.pluralize, file)\n end", "def file_url(attachment_name, style=nil); file_path(attachment_name, style); end" ]
[ "0.77162385", "0.7581699", "0.74921334", "0.74285215", "0.6818109", "0.67042357", "0.6699845", "0.66079175", "0.66022384", "0.6597251", "0.6596749", "0.65823776", "0.6537149", "0.6506146", "0.64927673", "0.6371597", "0.6349688", "0.63333774", "0.63324314", "0.6287656", "0.62555575", "0.6248846", "0.6241695", "0.62414116", "0.62371016", "0.6236569", "0.6229968", "0.6201635", "0.6185388", "0.6182126", "0.6172448", "0.61711586", "0.6154058", "0.6133188", "0.6123416", "0.6112908", "0.61107546", "0.6100355", "0.6090312", "0.6079701", "0.604897", "0.60362005", "0.6030901", "0.6030901", "0.60241383", "0.6020512", "0.6012441", "0.5999121", "0.5980918", "0.5980848", "0.59752655", "0.59747857", "0.59613687", "0.59599257", "0.59553576", "0.59306926", "0.59265643", "0.5918838", "0.590936", "0.59089804", "0.589956", "0.58795", "0.58621097", "0.58577937", "0.5851367", "0.58504415", "0.5846342", "0.58456415", "0.58430576", "0.5842435", "0.58241373", "0.58230615", "0.5822151", "0.5812105", "0.5788897", "0.5788644", "0.57815695", "0.5779882", "0.57711864", "0.57706934", "0.57680374", "0.5762712", "0.57601225", "0.5758989", "0.57573354", "0.57483643", "0.5746447", "0.5738215", "0.57319605", "0.572898", "0.572804", "0.5726501", "0.5718029", "0.57161057", "0.5715428", "0.5693529", "0.56876594", "0.5683227", "0.56754565", "0.5673915" ]
0.63316256
19
overwrite paperclips URL so we check meta for a url and use that if it's set otherwise fallback to paperclip standard behavior
def url(style_name = default_style, use_timestamp = @use_timestamp) if remote_url?(style_name) meta[style_name][:url] else default_url = @default_url.is_a?(Proc) ? @default_url.call(self) : @default_url url = original_filename.nil? ? interpolate(default_url, style_name) : interpolate(@url, style_name) use_timestamp && updated_at ? [url, updated_at].compact.join(url.include?("?") ? "&" : "?") : url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_photo_url\n \"#{URL}#{self.photo.url}/\".gsub('/original/','/large/')\n end", "def photo_src\n self.photo.present? ? self.photo.picture_url : Prize::DEFAULT_IMG\n end", "def imgurl\n picref.imgurl if picref\n end", "def photo_url\n defined?(object.photo) ? object.photo.url : ''\n end", "def url() processed_image.try(:url) || fallback_url end", "def picurl\n picurl = object.imgurl\n (picurl.present? && sample_page) ? valid_url(picurl, sample_page) : picurl\n end", "def thumbnail_value_from_document\n url = super\n return if url.blank?\n return unless url.match? URI::DEFAULT_PARSER.make_regexp # do not try to resolve invalid URLs\n\n return view_context.image_proxy_path(url: url) if url.to_s.start_with?('http://')\n\n url\n end", "def default_url\n \"photo/#{version_name}.jpg\"\n end", "def url() read_attribute_w_fallbacks( :url, :auto_url ); end", "def url\n if audio?\n \"ediofy/media-file-audio-thumb-default.png\"\n elsif video? && model.processing?\n \"ediofy/media-file-video-thumb-default.png\"\n elsif image? && model.processing?\n \"ediofy/media-file-image-thumb-default.png\"\n elsif model.processing?\n \"ediofy/media-file-image-thumb-default.png\"\n else\n super\n end\n end", "def file_url\n if paperclip_attachment_attached?\n object.send(attribute_name).url(image_style)\n elsif activestorage_attachment_attached?\n attachment = object.send(attribute_name)\n\n if attachment.representable?\n attachment.representation(resize: \"400x150>\")\n else\n attachment.service_url\n end\n end\n end", "def original_url; end", "def imgdata fallback_to_url=true\n if picref && (href = picref.imgdata || (fallback_to_url && picref.url)).present?\n href\n end\n end", "def image_remote_url=(url_value)\n self.image = URI.parse(url_value) unless url_value.blank?\n super\n end", "def sanitize_image_url\n if self.image_url \n if self.image_url.first != \"h\"\n self.image_url = \"http://#{self.image_url}\"\n end\n end\n end", "def default_url\n \"http://placehold.it/330&text=pic\"\n end", "def image_url\n# Somehow the picture field returns false for 'nil?' regardless of wether it's set or not\n# So we'll have to check if the size of the url is 0 to see if it exists\n# There should be a better way to do this, probably?\nif self.picture.size == 0\n\tself.profile_picture.nil? ? 'image-unknown.jpg' : self.profile_picture\nelse \n\tself.picture.ava\nend\nend", "def picurl= pu\n self.picture = ImageReferenceServices.find_or_initialize site_service&.resolve(pu)\n end", "def photo_url\n url = read_attribute(\"photo_url\")\n if ! url.blank?\n url.gsub(/\\/images\\//,\"http:\\/\\/s3.amazonaws.com\\/reoagentphoto\\/\")\n else\n \"\"\n end\n end", "def image_url\n model.image_url.presence || h.asset_path('face.jpg')\n end", "def url(*args)\n if present?\n style = args.first.is_a?(Symbol) ? args.first : default_style\n options = args.last.is_a?(Hash) ? args.last : {}\n if style == :custom_thumb && is_valid_for_custom_thumb?\n custom_width = options[:width] || 220\n file_name = filename_from(default_style)\n public_url_custom_thumbnail_from(file_name, custom_width)\n else\n file_name = filename_from(style)\n public_url_for(file_name)\n end\n else\n default_image\n end\n end", "def get_attachment_url\n return self.attachment.url unless self.attachment.blank?\n end", "def image_url(style='original')\n ENV[\"domain\"] + self.picture.image.url(:original) if self.picture.present?\n end", "def url(attachment, style_name)\n if Thread.current.thread_variable_get(:kt_paperclip_no_recursion)\n raise Errors::InfiniteInterpolationError\n end\n Thread.current.thread_variable_set(:kt_paperclip_no_recursion, true)\n attachment.url(style_name, timestamp: false, escape: false)\n ensure\n Thread.current.thread_variable_set(:kt_paperclip_no_recursion, false)\n end", "def mini_url\n object.attachment.url('mini')\n end", "def set_photo_urls\n unless self.photo_id.blank?\n photo = Photo.find(self.photo_id)\n self.photo_thumb_url = photo.photo.thumb\n self.photo_medium_url = photo.photo.medium\n self.photo_large_url = photo.photo.large\n end\n end", "def original_url\n self.source.url\n end", "def thumbnail_url\n (ipaper_document && ipaper_document.thumbnail_url) || public_filename(:thumb)\n end", "def image_url\n self.filename.url \n end", "def choosephoto\n if self.photo.url\n photo.url(:standard)\n else\n gphoto\n end\n end", "def collection_thumb_url(document)\n if document.image == '/dlg_default_image.png'\n document.thumbnail\n else\n cache_server_image_link document.image\n end\n end", "def url(*args)\n return nil if file.nil?\n if file.exists?\n super.try do |original_url|\n updated_at = model.updated_at || Time.zone.now\n \"#{original_url.split('?v=').first}?v=#{updated_at.to_i}\"\n end\n else\n on_the_fly_recreate_version!('webp', lazy: true).url\n end\n end", "def public_url_for(title)\n metadata_or_default_img_from(title) do |metadata|\n # effective_url_from(metadata.web_content_link)\n if content_type =~ /image/\n custom_thumbnail_image_for(metadata.thumbnail_link, 1000)\n else\n metadata.web_view_link\n end\n end\n end", "def square_url\n thumb_url\n end", "def photo_from_url(url)\n\t self.photo = URI.parse(url)\n\tend", "def url\n if model.processable?\n model.absolute_url\n else\n super\n end\n end", "def thumb_url\n self.source.thumb.url\n end", "def thumbnail_url\n # Just show defaults for now\n ActionController::Base.helpers.image_url 'default.png', host: public_site_url\n\n # Actual thumbnails are ready to go below.\n #if self.thumbnail.present?\n # Rails.application.routes.url_helpers.download_url(self.thumbnail.id, file: 'thumbnail')\n #else\n # ActionController::Base.helpers.image_url 'default.png'\n #end\n end", "def thumbnail_url\n # Just show defaults for now\n ActionController::Base.helpers.image_url 'default.png', host: public_site_url\n\n # Actual thumbnails are ready to go below.\n #if self.thumbnail.present?\n # Rails.application.routes.url_helpers.download_url(self.thumbnail.id, file: 'thumbnail')\n #else\n # ActionController::Base.helpers.image_url 'default.png'\n #end\n end", "def pic_url\n {\n picture: self.object.pic.service_url\n }\n end", "def url\n source_url || reporter.photo_urlformat(uniqueid, 's')\n end", "def thumbnail_url\n scribd_document ? scribd_document.thumbnail_url : nil\n end", "def pic_one_url\n \tpic_one.url(:medium)\n end", "def paperclip_path\n \"dev/assets/products/:id/:style/:basename.:extension\"\n end", "def default_url\n \"http://placehold.it/450x300&text=BandPhoto\"\n end", "def original_url\n if Rails.application.cloudfront_enabled?\n CloudFrontLocation.new(attachment.key, signed: signed?).url\n elsif Rails.application.remote_storage?\n s3_url\n else\n attachment.url\n end\n end", "def modify_media_file_url_if_from_video_site\n if media_file_url.present? && !ImageSrcUrl.new(media_file_url).is_image?\n video_src_url = VideoSrcUrl.new(media_file_url)\n self.media_file_url = video_src_url.value if video_src_url.is_video?\n end\n end", "def absolute_url\n\t\treturn \"#{$domain}/#{self.photo.url}\"\n\tend", "def original_url\n url\n end", "def default_url\n \"/images/fallback/\" + [thumb, \"images.jpeg\"].compact.join('_')\n end", "def photo_url\n self.photo.url(:tile) # but now, self is the recipe\n end", "def get_thumbnail_url\n nil\n end", "def convert _obj\n if _obj.figures.length == 1 && _obj.figures.first.link.present?\n _obj.figures.first.link = _obj.figures.first.link.gsub(\"http://\", \"https://\")\n _obj.save!\n end\nend", "def file_url\n file.attached? ? url_for(file) : ''\n end", "def copy_url_from_page\n return true unless page? && page.present?\n self.url = self.page.absolute_path\n end", "def original_dynamic_image_url(record_or_array, options = {})\n dynamic_image_url(record_or_array, { action: :original }.merge(options))\n end", "def oriented_photo_url\n photo_style = if self.orientation == 'horizontal'\n self.featured ? 'wide' : 'horizontal'\n else\n 'vertical'\n end\n self.photo.url(photo_style.to_sym)\n end", "def image_url_provided?\n !self.image_url.blank?\n end", "def img_src_to_full_url(permalink, node)\n return unless valid_img?(node) && !node.attributes['src'].value.urlish?\n node.attributes['src'].value = URI.join(permalink, node.attributes['src'].value).to_s\n end", "def url(style=nil, use_timestamp=false)\n if self.class.s3_storage?\n super.gsub('//s3', '//fairleads.s3').gsub('/fairleads/', '/')\n else\n super\n end\n end", "def cl_photo\n if photo?\n photo\n else\n 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSb0kZ2CA6D46RXZVJ3dvJPusC66fBq1uENE8jN3q8golJ73Ayd'\n end\n end", "def image_url\n image.present? ? image.url : ''\n end", "def default_url\n file_path = [\n 'fallbacks',\n ([model.class.to_s.underscore, mounted_as, version_name].compact.join('_') + '.png')\n ].join '/'\n\n 'http://' + ENV['HOST'] + ActionController::Base.helpers.image_path(file_path)\n end", "def set_from_url(model_image_attr, carrier_wave_url)\n model_image_attr.store!(carrier_wave_url)\n send(\"write_#{model_image_attr.mounted_as}_identifier\")\n model_image_attr\n end", "def mini_url\n attachment.url(:mini, false)\n end", "def attachment_url(resource, version = :thumb_64)\n uploader = if resource.respond_to?(:mount_on)\n resource\n else\n extract_uploader(resource)\n end\n\n uploader.present? ? uploader.url(version) : 'no-img-fallback.png'\n end", "def image_url\n url_for(object.profile_pic)\n end", "def cover_concept_image_direct_upload_url=(escaped_url)\n write_attribute(:cover_concept_image_direct_upload_url, self.unescape_url(escaped_url))\n end", "def temp_document_thumb_url(document)\n if document.cloud_content_thumbnail.attached?\n document.cloud_content_thumbnail.service_url\n else\n 'application/processing.png'\n end\n end", "def prepend_urls \n unless check_url(self.homepage_url)\n self.homepage_url = \"http://#{self.homepage_url}\"\n end\n unless check_url(self.source_url)\n self.source_url = \"http://#{self.source_url}\"\n end\n unless check_url(self.author_contact)\n self.author_contact = \"http://#{self.author_contact}\"\n end\n end", "def add_image_link?(options)\n !options.key?(:link) || options[:link]\n end", "def canonical_url\n return source_url if file_upload?\n\n # If the image URL is convertible to a page URL, or the page URL couldn't\n # be found, then use the image URL as the source of the post. Otherwise,\n # use the page URL.\n if Source::URL.page_url(source_url).present? || page_url.blank?\n source_url\n else\n page_url\n end\n end", "def photo_url\n src = details.at('#img_primary img')['src'] rescue nil\n\n if src =~ /^(http:.+@@)/ || src =~ /^(http:.+?)\\.[^\\/]+$/\n $1 + '.jpg'\n end\n end", "def url_with_default *args\n unless file_name.nil?\n url_without_default *args\n else\n nil\n end\n end", "def fallback_url\n case retv = read_attribute(:fallback_url)\n\n # if in the format association#method it will try to call it, this is useful\n # for situations like a blog_post wanting the default url to be the user's\n # avatar\n when /^(spec|owner)#(.*)/\n if association = send($1)\n association.respond_to?($2) && association.send($2)\n end\n\n # when blank it'll try to get the url from the spec\n when /^\\s*$/, nil\n spec != self && spec.try(:fallback_url) || CATCHALL_FALLBACK_URL\n\n # otherwise the assumption is that fallback_url is a hardcoded path\n else\n retv\n end.presence\n end", "def default_url\n Settings.image.default_avatar\n end", "def default_url\n Settings.image.default_avatar\n end", "def default_url\n Settings.image.default_avatar\n end", "def default_url\n \"https://s3.amazonaws.com/whisprdev/uploads/default_avatar.png\"\n end", "def canonical_url\n page_url || image_url\n end", "def url(version_name = \"\")\n @url ||= super({})\n version_name = version_name.to_s\n return @url if version_name.blank?\n # if not version_name.in?(IMAGE_UPLOADER_ALLOW_IMAGE_VERSION_NAMES)\n # # To protected version name using, when it not defined, this will be give an error message in development environment\n # raise \"ImageUploader version_name:#{version_name} not allow.\"\n # end\n [@url,version_name].join(\"!\") # thumb split with \"!\"\n end", "def avatar_url\n self.avatar.attachment.nil? ? '' :\n \"#{Rails.configuration.api_url}#{Rails.application.routes.url_helpers.rails_blob_path(self.avatar, only_path: true)}\"\n end", "def url(version_name = \"\")\n @url ||= super({})\n version_name = version_name.to_s\n return @url if version_name.blank?\n if not version_name.in?(IMAGE_UPLOADER_ALLOW_IMAGE_VERSION_NAMES)\n # To protected version name using, when it not defined, this will be give an error message in development environment\n raise \"ImageUploader version_name:#{version_name} not allow.\"\n end\n [@url,version_name].join(\"!\") # thumb split with \"!\"\n end", "def photo_from_url(url)\n end", "def automatic_url\n\t\t\t\t\treturn !self.nature.blank? && !config(:natures, self.nature.to_sym, :url).blank?\n\t\t\t\tend", "def thumbnail_url\n image_url(\"200x200-fix\") || image_url(\"224x148-fix\") || strip_url\n end", "def default_photo_url\n self.dig_for_string(\"agentSummary\", \"defaultPhotoURL\")\n end", "def medium_photo\n main_photo.url(:medium)\n end", "def fix_src_url!\n fix_isgd_url!\n end", "def media_url\n if self.is_logo?\n self.structure.logo.url(:thumbnail_email_cropped)\n else\n media = Media.where(id: self.media_id).first\n return if media.nil?\n if media.type == 'Media::Video'\n media.thumbnail_url\n else\n media.image.url(:thumbnail_email_cropped)\n end\n end\n end", "def image_from_url\n io = open(URI.parse(image_url))\n def io.original_filename; base_uri.path.split('/').last; end\n self.image = io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...) \n end", "def set_url\n @url = DEFAULT_URL\n end", "def avatar_url\n self.avatar.attachment.nil? ? '' :\n \"#{Rails.configuration.api_url}#{Rails.application.routes.url_helpers.rails_blob_path(self.avatar, only_path: true)}\"\n end", "def default_url\n ActionController::Base.helpers.asset_path(\"fallback/#{model.class.to_s.underscore}_#{mounted_as}/\" + [version_name, \"default.jpg\"].compact.join('_'))\n end", "def set_thumb_path\n self.thumb_path = send(\"#{provider}_thumb\")\n end", "def document_thumb_url(document)\n if document.cloud_content_thumbnail.attached?\n document.cloud_content_thumbnail.service_url\n else\n 'application/processing.png'\n end\n end", "def thumbnail_url document\n document.derivative_paths[:thumbnail].relative_path.to_s\n end", "def thumb_url\n if object.photo_url(:thumb)\n BASE_URL + object.photo_url(:thumb)\n else\n MISSING_THUMB\n end\n end", "def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end", "def full_picture\n if self.photo.file != nil\n self.photo_url\n elsif self.picture\n self.picture\n else\n \"http://res.cloudinary.com/geertkeularts/image/upload/v1467110899/defaultpicture_jj0nwa.jpg\"\n end\n end", "def image_url\n product.images.first.try(:attachment).try(:url)\n end" ]
[ "0.6498706", "0.6480759", "0.6438075", "0.64338565", "0.63937163", "0.63923943", "0.6307063", "0.62669975", "0.62540394", "0.62483495", "0.6216716", "0.6198377", "0.61982334", "0.6194582", "0.61869264", "0.6185021", "0.6149988", "0.6143334", "0.61148214", "0.60870934", "0.608402", "0.6070425", "0.6069038", "0.60610247", "0.6060393", "0.60508525", "0.6031123", "0.5976277", "0.59675044", "0.593553", "0.5924875", "0.5923391", "0.59011513", "0.58826697", "0.58693695", "0.5868409", "0.5865868", "0.5860372", "0.5860372", "0.58391935", "0.58330935", "0.5826335", "0.5820141", "0.5795681", "0.5794986", "0.57923776", "0.5774264", "0.5768062", "0.5749565", "0.57448906", "0.5741906", "0.5739378", "0.57294995", "0.57238734", "0.57222235", "0.57202387", "0.57180876", "0.5713761", "0.57016414", "0.5697457", "0.5697166", "0.56888044", "0.56857395", "0.5680172", "0.56755763", "0.5672264", "0.56718004", "0.5670087", "0.5666191", "0.5664822", "0.5662538", "0.5660788", "0.56582254", "0.5651554", "0.56443244", "0.56422424", "0.56422424", "0.56422424", "0.5637569", "0.5636935", "0.5634056", "0.56325585", "0.56265235", "0.56154203", "0.56139743", "0.56092554", "0.5608606", "0.5606435", "0.5605771", "0.5602669", "0.55942124", "0.5594127", "0.55923706", "0.55896676", "0.55869555", "0.5585759", "0.55763155", "0.5576002", "0.55756634", "0.5575527", "0.5566685" ]
0.0
-1
Baseline implementation for the abandon_instances REST call
def abandon_instances request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_abandon_instances_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unmonitor_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"UnmonitorInstances\", :params => params)\n end", "def abandon!\n authentication.abandon!\n end", "def cancelled_requests; end", "def abandon\n response = self.class.post('/', :body => self.class.build_XML_request('Session.Abandon', self))\n self.class.response_valid? response\n end", "def delete_instances(count)\n instances_to_delete = current_instances.last(count) \n parent.terminate_instances(Group.instance_ids(instances_to_delete))\n # remaining_instances under alive\n Output.new(current_instances.first(current_instances.size - count), instances_to_delete)\n end", "def cancel(id); end", "def cancel(params={})\n self.request(__method__, params)\n end", "def stop_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n raise ArgumentError, \":force must be 'true' or 'false'\" unless options[:force].nil? || [true, false].include?(options[:force])\n params = {}\n params.merge!(pathlist(\"InstanceId\", options[:instance_id]))\n params[\"Force\"] = options[:force].to_s unless options[:force].nil?\n return response_generator(:action => \"StopInstances\", :params => params)\n end", "def terminate_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"TerminateInstances\", :params => params)\n end", "def destroy\n @instance = @provider.instances.find(params[:id])\n InstanceOperations.terminate_instances(@provider.connect!, @instance)\n @instance.destroy\n redirect_to cloud_provider_path(@provider) \n end", "def perform_destroy\n api.balancer_destroy(self)\n end", "def clean_instances(allowed_age, whitelist=nil)\n deleted = []\n undeleted = []\n @gate.instances.each do |instance|\n if is_opsworks_instance instance\n undeleted << instance.inspect\n else\n if expired(instance.launch_time,allowed_age) and instance.status != :terminated\n begin\n if whitelisted(instance.instance_id, whitelist)\n undeleted << instance.inspect\n else\n instance.api_termination_disabled=false\n instance.delete\n deleted << instance.inspect\n end\n rescue AWS::Errors::Base => e\n undeleted << instance.inspect\n end\n end\n end\n end\n return deleted, undeleted\n end", "def revoke\n raise \"Implement me!\"\n end", "def deactivate; end", "def terminateinstances\n if not checkRequirements([\"thezone\",\"theserver\"])\n return false\n end\n checkToken(@thezone)\n submit = queryGCE(:path => '/compute/v1beta15/projects/#{@thezone.name}/zones/#{@theserver.azone.name}/instances/#{@theserver.serial}', :method => 'delete', :options => '', :access_token => @thezone.token )\n checkQuery(:type => 'zone', :token => @thezone.token, :projectname => @thezone.name, :zonename => @theserver.azone.name, :operationname => submit[\"name\"] )\n end", "def destroy_instances_if_ami_changed\n self.instances.each { |i| i.destroy } if self.ami_id_changed?\n end", "def cancel; end", "def cancel; end", "def abort_instance(instance, interfaces, wait, unlock=false)\n @mgr.unlock() if unlock\n if interfaces.size > 0\n interfaces.each() do |iface|\n iface.delete()\n end\n end\n return unless instance\n yield \"#{@mgr.timestamp()} Aborting instance #{instance.id()}\"\n instance.block_device_mappings().each() do |b|\n v = @resource.volume(b.ebs.volume_id)\n # Volumes without a Name should be deleted. Note that if an\n # instance is aborted after tagging, the volume will get left\n # behind. This should be extremely rare, since the most likely\n # collision is two people creating an instance with the same\n # name at the same time.\n unless get_tag(v, \"Name\")\n yield \"#{@mgr.timestamp()} Marking new unnamed volume #{b.ebs.volume_id} (#{b.device_name}) for automatic deletion\"\n instance.modify_attribute({\n attribute: \"blockDeviceMapping\",\n block_device_mappings: [\n {\n device_name: b.device_name,\n ebs: {\n volume_id: b.ebs.volume_id,\n delete_on_termination: true,\n },\n },\n ],\n })\n end\n end\n yield \"#{@mgr.timestamp()} Sending termination command\"\n instance.terminate()\n return unless wait\n yield \"#{@mgr.timestamp()} Waiting for instance to terminate...\"\n instance.wait_until_terminated()\n yield \"#{@mgr.timestamp()} Terminated\"\n end", "def reset_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_reset_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def reset_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_reset_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def shutdown()\n \n #shutdown all the instances we have.\n ids = id()\n \n @ec2.terminate_instances(ids)\n \n # wait for them to shut down for a couple of minutes\n attempts = 0\n stats = state_code()\n while (stats.any? {|s| s<=16 }) do\n if attempts > 6 \n raise CaTPAWS::EC2::Error::InstanceShutdown, \"Instances still running after a long wait. Check your EC2 account manually?\"\n end\n puts \"Terminating instances, please wait...\"\n sleep(10)\n attempts+=1\n get_instances(true)\n stats = state_code()\n end\n \n #and delete the associated security group\n @ec2.delete_security_group(@group_name)\n \n end", "def delete_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_delete_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def stop_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_stop_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def stop_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_stop_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def terminate_instance!(instance_id)\n instances.select {|a| a[:instance_id] == instance_id}[0][:status] = \"terminating\"\n end", "def stop\n service.pool_action uuid, :destroy\n end", "def erase_app_instance_info\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_list = uac.get_all_apps()\n my_public = my_node.public_ip\n\n Djinn.log_info(\"All apps are [#{app_list.join(', ')}]\")\n app_list.each { |app|\n if uac.does_app_exist?(app)\n Djinn.log_debug(\"App #{app} is enabled, so stopping it.\")\n hosts = uac.get_hosts_for_app(app)\n Djinn.log_debug(\"[Stop appengine] hosts for #{app} is [#{hosts.join(', ')}]\")\n hosts.each { |host|\n Djinn.log_debug(\"[Stop appengine] deleting instance for app #{app} at #{host}\")\n ip, port = host.split(\":\")\n uac.delete_instance(app, ip, port)\n }\n\n Djinn.log_info(\"Finished deleting instances for app #{app}\")\n else\n Djinn.log_debug(\"App #{app} wasnt enabled, skipping it\")\n end\n }\n end", "def terminate_instances(parameters, secret)\n if @secret != secret\n return BAD_SECRET_RESPONSE\n end\n\n TERMINATE_INSTANCES_REQUIRED_PARAMS.each { |required_param|\n if parameters[required_param].nil? or parameters[required_param].empty?\n return {\"success\" => false, \"reason\" => \"no #{required_param}\"}\n end\n }\n\n Thread.new {\n HelperFunctions.set_creds_in_env(parameters['credentials'], \"1\")\n HelperFunctions.terminate_vms(parameters['instance_ids'], \n parameters['infrastructure'])\n }\n\n return SUCCESSFUL_TERMINATE_RESPONSE\n end", "def rollback_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_rollback_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def reboot_instances(*instances)\n instances = instances.flatten\n link = generate_request(\"RebootInstances\", amazonize_list('InstanceId', instances))\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def deactivate()\n end", "def deregister_instances_from_load_balancer(instance_ids, lb_name)\n params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])\n request({\n 'Action' => 'DeregisterInstancesFromLoadBalancer',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::DeregisterInstancesFromLoadBalancer.new\n }.merge!(params))\n end", "def cancel!; end", "def deregister_instances_from_lb(lb_name, instance_ids)\n instances = instance_ids.map { |instance_id| { :instance_id => instance_id } }\n link = generate_request(\"DeregisterInstancesFromLoadBalancer\",\n :load_balancer_name => lb_name, :instances => instances\n )\n request_info(link, QElbInstancesParser.new)\n rescue Exception\n on_exception\n end", "def running_delete\n base_delete(params, \"Running\")\n end", "def reset_remoter_base!\n @describe_instances = nil\n end", "def abandon_results!()\n #This is a stub, used for indexing\n end", "def cancel\n @client.call('unrecur', @jid)\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def delete_blocked\n end", "def call_unbind_objects\n print \"do nuttin\"\n end", "def terminate_instances(*instance_ids)\n action = 'TerminateInstances'\n params = {\n 'Action' => action\n }\n params.merge!(array_to_params(instance_ids, 'InstanceId'))\n\n response = send_query_request(params)\n response.is_a?(Net::HTTPSuccess)\n end", "def cancel\n end", "def cancel\n end", "def shutdown(group)\n cfmshutdown = AWS::CloudFormation.new\n ec2shutdown = AWS::EC2.new\n puts \"XXXXXXXXXX DAILY CHECKING HERE SHUT DOWN XXXXXXXXXXXX\"\n puts group.name\n puts \"Shut down Job is working now\"\n puts group.users.length\n puts \"-------------\"\n if group.users.length > 0\n allinstanceids = []\n group.users.each do |user|\n if user.stacks.length > 0\n user.stacks.each do |stack|\n if stack.ec2instance_ids.length > 0 \n allinstanceids.concat stack.ec2instance_ids\n end\n end\n end\n end\n puts \"BUBBBUBUBBBB\"\n puts allinstanceids.class\n allinstanceids = allinstanceids.uniq\n puts allinstanceids.class\n puts \"BUBBBUBUBBBB\"\n if allinstanceids.length > 0\n $ec2_resource.instances({instance_ids: allinstanceids}).batch_stop # To job stop\n end\n end \n puts \"YYYYYYYYYYYYYYYYYYYYYYYY\"\n end", "def discard; end", "def discard; end", "def cancel\n super\n end", "def uninvite_no_progress(*params)\n\t\tself.each{|x| safe{x.uninvite(*params)} if x.respond_to?('uninvite')}\n\tend", "def stop_instances\n @task.unsafe(\"Stopping #{@name} processes\") do\n save_to_s3(@task.bucket)\n autoscaling_group.suspend_all_processes\n end\n autoscaling_instances.each do |instance|\n @task.unsafe(\"Stopping instance #{instance.instance_id}\") do\n load_balancers.each do |elb|\n elb.instances.deregister(instance.instance_id)\n end\n instance.ec2_instance.stop\n end\n end\n end", "def cancel\n super\n end", "def cancel_batch\n @batch = nil\n end", "def abort\n queued_requests.clear\n end", "def destroy\n fail('Destroying fip pool is not supported using contrail api')\n end", "def cancel\n super\nend", "def stop_instances\n @task.unsafe(\"Stopping #{@name} processes\") do\n autoscaling_group.suspend_all_processes\n end\n autoscaling_instances.each do |instance|\n @task.unsafe(\"Stopping instance #{instance.instance_id}\") do\n load_balancers.each do |elb|\n elb.instances.deregister(instance.instance_id)\n end\n instance.ec2_instance.stop\n end\n end\n end", "def deactivate\n \n end", "def destroy!\n response = @connection.dbreq(\"DELETE\", @lbmgmthost, \"#{@lbmgmtpath}/instances/#{CloudDB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^202$/)\n true\n end", "def __cancel__(what, &blk)\n req = Request.new\n req.verb = Request::Verb::CANCEL\n req.id = what.tag\n\n # Hold on to the tag as unavaiable for reuse until the cancel succeeds.\n @cbx[what.tag] = nil\n\n send(req) do |res|\n # Do not send any more responses from the server to this request.\n @cbx.delete(what.tag)\n blk.call(res) if blk\n end\n end", "def start_terminating! options={}\n return true if away?\n return :wait if terminating? || busy?\n Log.info \"Terminating #{self}\"\n response = Wucluster.ec2.terminate_instances options.merge(:instance_id => [self.id])\n new_state = response.instancesSet.item.first.currentState.name rescue nil\n Log.warn \"Request returned funky status: #{new_state}\" unless (['shutting-down', 'terminated'].include? new_state)\n self.status = new_state.gsub(/-/,'_').to_sym\n dirty!\n response\n end", "def cancel\n self.solved(:abort)\n end", "def destroy\n @app_instance.destroy\n respond_to do |format|\n format.html { redirect_to app_instances_url }\n format.json { head :no_content }\n end\n end", "def remove_instance(instance)\n unless instance\n raise ArgumentError, \"A argument of type Instance was expected. Got #{instance.inspect}\"\n end\n\n # Check to make sure that we have a valid instance role here first.\n unless %w[app util].include?(instance.role)\n raise InvalidInstanceRole, \"Removing instances is only supported for app, util instances\"\n end\n\n # Check to be sure that instance is actually provisioned\n # TODO: Rip out the amazon_id stuff when we have IaaS agnosticism nailed down\n unless instance.amazon_id && instance.provisioned?\n raise InstanceNotProvisioned, \"Instance is not provisioned or is in unusual state.\"\n end\n\n response = api.post(\"/environments/#{id}/remove_instances\", :request => {\n :provisioned_id => instance.amazon_id,\n :role => instance.role,\n :name => instance.name\n })\n\n # Reset instances so they are fresh if they are requested again.\n @instances = nil\n\n # Return the response.\n return response\n end", "def cleanup(vpc_id, client, asg, elbv1, elbv2, region)\n begin\n response = client.describe_vpcs(vpc_ids: [vpc_id])\n rescue Aws::EC2::Errors::InvalidVpcIDNotFound => e\n puts \"Error: vpc_id [#{vpc_id}] does not exist... exiting.\"\n puts \"Make sure you passed the correct region on the command-line if it's not in the default us-west-2\"\n exit 0\n end\n\n # 1) Delete Auto Scaling group\n begin\n asg.delete_auto_scaling_group(auto_scaling_group_name: 'asg-nginx_auto', force_delete: true)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n sleep 2\n # TODO: properly wait here until ASG is fully deleted before proceeding...\n begin\n asg.delete_launch_configuration(launch_configuration_name: 'lc-nginx_auto')\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n sleep 2\n\n # 2) instance handling\n term_error = 0\n instances_to_term = []\n terminate_states = %w[pending running shutting-down stopping stopped]\n puts 'Checking for nginx and nat instances, of all states...'\n begin\n response = client.describe_instances(filters: [{name: 'tag:Name', values: ['autoASG nginx server',\n 'nat instance']}])\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n response.reservations.each do |reservation|\n reservation.instances.each do |instance|\n puts \"Check #1: instance-id=[#{instance.instance_id}] AMI=[#{instance.image_id}] state=[#{instance.state.name}]\"\n instances_to_term.push(instance.instance_id) if terminate_states.include? instance.state.name\n end\n end\n\n if instances_to_term.any? # If array has content, proceed.\n term_error = 0\n instance_cnt = instances_to_term.length # TODO: Check before/after termination attempts and ensure = 0\n before_terminate = Time.now\n begin\n client.wait_until(:instance_terminated,instance_ids: instances_to_term) do |wait|\n wait.interval = 8 # Seconds between polling attempts. Same as wait.delay\n wait.max_attempts = 15 # Polling attempts before giving up. Wait time is 15*8=120 seconds.\n puts \"Attempting to terminate [#{instance_cnt}] instance(s), please wait up to 120 seconds...\"\n begin\n client.terminate_instances(instance_ids: instances_to_term)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n end\n rescue Aws::Waiters::Errors::WaiterFailed => error\n term_error = 1 # TODO: Do something more reliable if this ever occurs.\n puts \"Exception: failed waiting for instance running: #{error.message}\"\n end\n puts \"#{Time.now - before_terminate.to_time} seconds elapsed while terminating.\" if term_error.zero?\n end\n\n if term_error.zero?\n # Debug with final instance check... this shouldn't print anything aside from terminated instances.\n begin\n response = client.describe_instances(filters: [{name: 'tag:Name', values: ['autoASG nginx server',\n 'nat instance']}])\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n response.reservations.each do |reservation|\n reservation.instances.each do |instance|\n puts \"Check #2: instance-id=[#{instance.instance_id}] AMI=[#{instance.image_id}] state=[#{instance.state.name}]\"\n end\n end\n end\n\n puts 'Sleeping for 5 seconds...'\n sleep 5\n\n # 3) Delete listeners\n printf 'Deleting ALB listeners... '\n begin\n response = elbv2.describe_load_balancers(names: ['AutoALB'])\n alb_arn = response.load_balancers[0].load_balancer_arn\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n sleep 2\n begin\n response = elbv2.describe_listeners(load_balancer_arn: alb_arn)\n listener_arn = response.listeners[0].listener_arn\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n begin\n elbv2.delete_listener(listener_arn: listener_arn)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n sleep 2\n puts 'done.'\n\n # 4) Delete target groups\n printf 'Deleting ALB target groups... '\n begin\n response = elbv2.describe_target_groups(names: ['AutoALBTargetGroup'])\n target_group_arn = response.target_groups[0].target_group_arn\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n begin\n elbv2.delete_target_group(target_group_arn: target_group_arn)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n sleep 5\n puts 'done.'\n\n # 5) Delete load balancers\n printf 'Deleting application and classic load balancers... '\n begin\n elbv1.delete_load_balancer(load_balancer_name: 'AutoCLB')\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n begin\n elbv2.delete_load_balancer(load_balancer_arn: alb_arn)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n puts 'done.'\n\n puts 'Sleeping for 120 seconds, enough time for the ASG to fully disappear before deleting subnets.'\n sleep 120\n\n # 6) subnets\n begin\n response = client.describe_subnets(filters: [{name: 'vpc-id', values: [vpc_id]}])\n response.subnets.each do |sn|\n printf \"Removing subnet: #{sn.subnet_id}, #{sn.vpc_id}, #{sn.cidr_block}, #{sn.availability_zone}; \"\n client.delete_subnet(subnet_id: sn.subnet_id)\n puts 'Done.'\n end\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n # 7) security groups\n begin\n response = client.describe_security_groups(filters: [{name: 'vpc-id', values: [vpc_id]}])\n response.security_groups.each do |sg|\n next if sg.group_name == 'default' # This name is reserved by aws and cannot be removed.\n printf \"Removing security group: #{sg.group_id}, #{sg.vpc_id}, #{sg.group_name}, Desc='#{sg.description}'; \"\n client.delete_security_group(group_id: sg.group_id)\n puts 'Done.'\n end\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n # 8) Internet gateway\n begin\n response = client.describe_internet_gateways(filters: [{name: 'attachment.vpc-id', values: [vpc_id]}])\n response.internet_gateways.each do |igw|\n printf \"Detaching Internet gateway: #{igw.internet_gateway_id} <-> #{igw.attachments[0].vpc_id}; \"\n client.detach_internet_gateway(internet_gateway_id: igw.internet_gateway_id, vpc_id: igw.attachments[0].vpc_id)\n printf \"Removing Internet gateway: #{igw.internet_gateway_id} <-> #{igw.attachments[0].vpc_id}; \"\n client.delete_internet_gateway(internet_gateway_id: igw.internet_gateway_id)\n puts 'Done.'\n end\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n # 9) Route tables\n begin\n response = client.describe_route_tables(filters: [{name: 'vpc-id', values: [vpc_id]}])\n response.route_tables.each do |rtl|\n if rtl.associations[0] != nil\n if rtl.associations[0].route_table_association_id != nil\n puts \"Skipping #{rtl.associations[0].route_table_association_id}, causes exception.\"\n end\n next\n end\n printf \"Removing route table: #{rtl.route_table_id}, #{rtl.vpc_id}; \"\n client.delete_route_table(route_table_id: rtl.route_table_id)\n puts 'Done.'\n end\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n # 10) Delete VPC\n begin\n puts \"Attempting to delete VPC [#{vpc_id}]\"\n client.delete_vpc(vpc_id: vpc_id)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n begin\n response = client.describe_vpcs(vpc_ids: [vpc_id])\n rescue Aws::EC2::Errors::InvalidVpcIDNotFound => e\n puts \"Deletion of vpc_id=[#{vpc_id}] was a success.\"\n exit 0\n end\n\n # Shouldn't get here, but sometimes does due to the ASG taking too long to\n # release subnet dependencies, or if running a cleanup before a launch has\n # fully completed, etc.\n puts 'Oops. Termination sometimes fails for various reasons.'\n puts 'Note: running this twice usually clears up any lingering dependencies.'\n puts ' With that said, there is still work to be done. Execute again.'\n exit 0\nend", "def reset()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def cancel_multi ()\n raise Exception, 'not implemented'\n end", "def reset()\n super\n=begin\n url = \"#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.3/threads/reset.json\"\n res = BlackStack::Netting::api_call(url, {\n 'api_key' => self.api_key,\n 'filename' => self.filename,\n 'id_client' => self.id_client,\n })\n=end\n end", "def delete_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def terminate_instance!(id=nil)\n raise RemoteException.new(:method_not_defined, \"terminate_instance!\")\n end", "def stop_instances_by_group_id(group_id)\n instances = @os_aws.describe_running_instances(group_id)\n ids = instances.map { |k, _| k[:instance_id] }\n\n puts \"Stoping the following instances #{ids}\"\n resp = []\n resp = @os_aws.stop_instances(ids).to_hash unless ids.empty?\n resp\n end", "def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end", "def remove_instance(instance)\n deregister_response = client.deregister_instances_from_load_balancer(load_balancer_name: name,\n instances: [{instance_id: instance.ec2_instance_id}])\n remaining_instance_count = deregister_response.instances.size\n puts \"Removed #{instance.hostname} from ELB #{name}. Remaining instances: #{remaining_instance_count}\".light_blue\n _wait_for_connection_draining\n end", "def discard_snapshot_action(id, type=:vapp)\n params = {\n \"method\" => :post,\n \"command\" => \"/vApp/#{type}-#{id}/action/removeAllSnapshots\"\n }\n response, headers = send_request(params)\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end", "def cancel\n # Define this later\n end", "def terminate_instances\n @task.unsafe(\"Stopping #{@name} Launch process\") do\n autoscaling_group.suspend_processes('Launch')\n end\n autoscaling_instances.each do |instance|\n @task.unsafe(\"Terminating instance #{instance.instance_id}\") do\n load_balancers.each do |elb|\n elb.instances.deregister(instance.instance_id)\n end\n instance.ec2_instance.terminate\n end\n end\n end", "def terminate_instances\n @task.unsafe(\"Stopping #{@name} Launch process\") do\n autoscaling_group.suspend_processes('Launch')\n end\n autoscaling_instances.each do |instance|\n @task.unsafe(\"Terminating instance #{instance.instance_id}\") do\n load_balancers.each do |elb|\n elb.instances.deregister(instance.instance_id)\n end\n instance.ec2_instance.terminate\n end\n end\n end", "def list_instances\n puts \"OK, Listing instances..\"\n\n response = RestClient.post( \n $uri,\n 'Version' => '2010-12-30',\n 'ACSAccessKeyId' => $ACSAccessKeyId,\n 'Format' => 'json',\n 'Timestamp' => $current_time,\n 'Rndguid' => $rndguid,\n 'Signature' => calculate_signature($api_private_key, $rndguid, $current_time),\n 'Action' => \"list-instances\")\n\n puts response\n puts response.code\nend", "def discard!\n # This should be overridden by concrete adapters.\n end", "def shutdown(options)\n # TODO Nothing implemented yet for Provision call\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Shutdown NOT YET IMPLEMENTED\"\n end", "def remove_jobs(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/erase\"\n\n begin\n response = RestClient::Request.new(\n :method => :post,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job #{id} => success\"\n else\n puts \"delete job #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n\n end\n\nend" ]
[ "0.60044473", "0.59776807", "0.5977602", "0.5635921", "0.5525691", "0.55182695", "0.55030507", "0.54494196", "0.5436976", "0.541044", "0.5407295", "0.5401262", "0.539516", "0.5370092", "0.5358628", "0.53511506", "0.5342512", "0.5342512", "0.5320943", "0.5306046", "0.5306046", "0.5304545", "0.5298174", "0.52954787", "0.52954787", "0.5288411", "0.52833617", "0.5281811", "0.52588356", "0.5243327", "0.5243303", "0.5228964", "0.5228964", "0.5228964", "0.52127755", "0.5202236", "0.51988184", "0.51800543", "0.51777977", "0.5159245", "0.51468736", "0.5144452", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.51366013", "0.513568", "0.51321083", "0.5131281", "0.51244426", "0.51244426", "0.5121506", "0.5112676", "0.5112676", "0.5104472", "0.5093725", "0.50934994", "0.50921273", "0.5090929", "0.5084979", "0.50843173", "0.5083102", "0.5077366", "0.5075789", "0.5071941", "0.50629336", "0.50625044", "0.505291", "0.5049664", "0.50375104", "0.50344586", "0.503423", "0.50335926", "0.5031372", "0.5025324", "0.5016263", "0.50134444", "0.50055504", "0.49948806", "0.49846676", "0.49795747", "0.49782437", "0.49782437", "0.49678913", "0.49655005", "0.4963805", "0.49608842" ]
0.7635395
0
Baseline implementation for the aggregated_list REST call
def aggregated_list request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_aggregated_list_request request_pb response = @client_stub.make_get_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::InstanceGroupManagerAggregatedList.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregated_list request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_aggregated_list_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Compute::V1::InstanceAggregatedList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def aggregate\n data_hash = MediaSourceSerializer.new(\n available_sources, is_collection: true\n ).aggregated_hash\n\n unless params_valid?\n data_hash[:errors] = 'One or more specified MediaSources do not exist'\n end\n\n render json: data_hash.to_json\n end", "def aggregate(request)\n end", "def aggregated_list request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/aggregated/routers\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n query_string_params[\"includeAllScopes\"] = request_pb.include_all_scopes.to_s if request_pb.include_all_scopes && request_pb.include_all_scopes != false\n query_string_params[\"maxResults\"] = request_pb.max_results.to_s if request_pb.max_results && request_pb.max_results != 0\n query_string_params[\"orderBy\"] = request_pb.order_by.to_s if request_pb.order_by && request_pb.order_by != \"\"\n query_string_params[\"pageToken\"] = request_pb.page_token.to_s if request_pb.page_token && request_pb.page_token != \"\"\n query_string_params[\"returnPartialSuccess\"] = request_pb.return_partial_success.to_s if request_pb.return_partial_success && request_pb.return_partial_success != false\n\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::RouterAggregatedList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def aggregate\n\n @page_title = _('Aggregate')\n @help_link = 'http://wiki.kolmisoft.com/index.php/Last_Calls#Call_information_representation'\n change_date\n\n #if we have some options preset in session we can retreave them if not new options hash is created.\n session[:aggregate_list_options] ? @options = session[:aggregate_list_options] : @options = {}\n\n params[:page] ? @options[:page] = params[:page].to_i : (@options[:page] = 1 if !@options[:page])\n params[:order_desc] ? @options[:order_desc] = params[:order_desc].to_i : (@options[:order_desc] = 1 if !@options[:order_desc])\n params[:destination_grouping] ? @options[:destination_grouping] = params[:destination_grouping].to_i : (@options[:destination_grouping] = 1 if !@options[:destination_grouping])\n\n # default values for first collumn (selects and fields)\n if !session[:aggregate_list_options] or params[:search].to_i == 1\n (params[:originator] and params[:originator].to_s != \"\") ? @options[:originator] = params[:originator] : @options[:originator] = \"any\"\n (params[:terminator] and params[:terminator].to_s != \"\") ? @options[:terminator] = params[:terminator] : @options[:terminator] = \"any\"\n (params[:prefix] and params[:prefix].to_s != \"\") ? @options[:prefix] = params[:prefix].gsub(/[^0-9]/, \"\") : @options[:prefix] = \"\"\n\n #default values for show/do not show checkboxes and collumns\n (params[:unique_id_show] and params[:unique_id_show].to_s != \"\") ? @options[:unique_id_show] = params[:unique_id_show].to_i : @options[:unique_id_show] = 1\n (params[:destination_show] and params[:destination_show].to_s != \"\") ? @options[:destination_show] = params[:destination_show].to_i : @options[:destination_show] = 1\n (params[:customer_orig_show] and params[:customer_orig_show].to_s != \"\") ? @options[:customer_orig_show] = params[:customer_orig_show].to_i : @options[:customer_orig_show] = 1\n (params[:customer_term_show] and params[:customer_term_show].to_s != \"\") ? @options[:customer_term_show] = params[:customer_term_show].to_i : @options[:customer_term_show] = 1\n (params[:ip_address_orig_show] and params[:ip_address_orig_show].to_s != \"\") ? @options[:ip_address_orig_show] = params[:ip_address_orig_show].to_i : @options[:ip_address_orig_show] = 1\n (params[:ip_address_term_show] and params[:ip_address_term_show].to_s != \"\") ? @options[:ip_address_term_show] = params[:ip_address_term_show].to_i : @options[:ip_address_term_show] = 1\n if can_see_finances?\n (params[:price_orig_show] and params[:price_orig_show].to_s != \"\") ? @options[:price_orig_show] = params[:price_orig_show].to_i : @options[:price_orig_show] = 1\n (params[:price_term_show] and params[:price_term_show].to_s != \"\") ? @options[:price_term_show] = params[:price_term_show].to_i : @options[:price_term_show] = 1\n end\n (params[:billed_time_orig_show] and params[:billed_time_orig_show].to_s != \"\") ? @options[:billed_time_orig_show] = params[:billed_time_orig_show].to_i : @options[:billed_time_orig_show] = 1\n (params[:billed_time_term_show] and params[:billed_time_term_show].to_s != \"\") ? @options[:billed_time_term_show] = params[:billed_time_term_show].to_i : @options[:billed_time_term_show] = 1\n end\n\n @options[:order_by], order_by = agregate_order_by(params, @options)\n\n if (@options[:destination_grouping].to_i == 1 and @options[:order_by] == \"directions.name\") or (@options[:destination_grouping].to_i == 2 and @options[:order_by] == \"destinations.name\")\n order_by = \"\"\n @options[:order_by] = \"\"\n end\n @options[:terminator] != \"any\" ? terminator_cond = @options[:terminator] : terminator_cond = \"\"\n\n # groups by those params that are not in search conditions\n group_by = []\n @options[:destination_grouping].to_i == 1 ? group_by << \"ds.direction_code, ds.prefix\" : group_by << \"ds.direction_code, ds.subcode\"\n cond = []\n\n if @options[:customer_orig_show].to_i == 1 or @options[:customer_term_show].to_i == 1\n group_by << \"dv.user_id\" if @options[:originator] == \"any\"\n group_by << \"p.terminator_id\" if @options[:terminator] == \"any\"\n end\n\n # form condition array for sql\n cond2 = [\"calldate BETWEEN '\" + session_from_datetime + \"' AND '\" + session_till_datetime + \"'\"]\n cond << \"u.owner_id = #{current_user.id}\" if reseller?\n\n cond << \"(u.id = #{q(@options[:originator].to_i)} OR u.owner_id = #{q(@options[:originator].to_i)})\" if @options[:originator] != \"any\"\n cond2 << \"c.prefix LIKE '#{@options[:prefix].gsub(/[^0-9]/, \"\")}%'\" if @options[:prefix].to_s != \"\"\n if terminator_cond.to_s != ''\n cond << \"p.terminator_id = #{terminator_cond.to_s}\"\n else\n cond << \"p.terminator_id > 0\"\n end\n #limit terminators to allowed ones.\n term_ids = current_user.load_terminators_ids\n if term_ids.size == 0\n cond << \"p.terminator_id = 0\"\n else\n cond << \"p.terminator_id IN (#{term_ids.join(\", \")})\"\n end\n\n cond2 << \"NOT (billsec = 0 AND disposition = 'ANSWERED')\"\n # terminator requires other conditions\n\n if reseller?\n originating_billed = SqlExport.replace_price(\"SUM(IF(c.disposition = 'ANSWERED', if(c.user_price is NULL, 0, #{SqlExport.user_price_sql.gsub(\"calls.\", \"c.\")}), 0))\", {:reference => 'originating_billed'})\n originating_billsec = \"SUM(IF(c.disposition = 'ANSWERED', IF(c.user_billsec IS NULL, 0, c.user_billsec), 0)) AS 'originating_billsec'\"\n\n terminator_billed = SqlExport.replace_price(\"SUM(IF(c.disposition = 'ANSWERED', #{SqlExport.reseller_provider_price_sql.gsub(\"calls.\", \"c.\").gsub(\"providers.\", \"p.\")}, 0))\", {:reference => 'terminating_billed'})\n terminator_billsec = \"SUM(IF(c.disposition = 'ANSWERED', c.reseller_billsec, 0)) AS 'terminating_billsec'\"\n else\n # Check if call belongs to resellers user if yes then admins income is reseller perice\n originating_billed = SqlExport.replace_price(\"SUM(IF(u.owner_id = 0 AND c.disposition = 'ANSWERED', if(c.user_price is NULL, 0, #{SqlExport.user_price_sql.gsub(\"calls.\", \"c.\")}), IF(c.reseller_price IS NULL, 0, (c.reseller_price + c.did_inc_price))))\", {:reference => 'originating_billed'})\n originating_billsec = \"SUM(IF(u.owner_id = 0 AND c.disposition = 'ANSWERED', IF(c.user_billsec IS NULL, 0, c.user_billsec), IF(c.reseller_billsec IS NULL, 0, c.reseller_billsec))) AS 'originating_billsec'\"\n\n terminator_billed = SqlExport.replace_price(\"SUM(IF(c.disposition = 'ANSWERED', #{SqlExport.admin_provider_price_sql.gsub(\"calls.\", \"c.\").gsub(\"providers.\", \"p.\")}, 0)) - c.did_prov_price\", {:reference => 'terminating_billed'})\n terminator_billsec = \"SUM(IF(c.disposition = 'ANSWERED', c.provider_billsec, 0)) AS 'terminating_billsec'\"\n end\n\n sql = \"\n SELECT\n #{SqlExport.nice_user_sql(\"u\")},\n c.prefix,\n ds.direction_code AS 'code',\n ds.subcode AS 'subcode',\n ds.name AS 'dest_name',\n u.username AS 'username',\n u.first_name AS 'first_name',\n u.last_name AS 'last_name',\n p.terminator_id AS 'terminator_id',\n\n #{[originating_billed, terminator_billed, originating_billsec, terminator_billsec].join(\",\\n\")},\n\n SUM(IF(c.disposition = 'ANSWERED', c.billsec, 0)) AS 'duration',\n COUNT(*) AS 'total_calls',\n SUM(IF(c.disposition = 'ANSWERED', 1,0)) AS 'answered_calls',\n SUM(IF(c.disposition = 'ANSWERED', 1,0))/COUNT(*)*100 AS 'asr',\n SUM(IF(c.disposition = 'ANSWERED', c.billsec, 0))/SUM(IF(c.disposition = 'ANSWERED', 1,0)) AS 'acd'\n\n FROM (\n SELECT c.*\n FROM calls c FORCE INDEX (calldate)\n WHERE \" + cond2.join(\" AND \")+ \"\n ) c\n\n JOIN providers p ON p.id = c.provider_id\n LEFT JOIN devices dv ON c.src_device_id = dv.id\n LEFT JOIN users u ON u.id = dv.user_id\n LEFT JOIN destinations ds ON ds.prefix = c.prefix\n #{\"LEFT JOIN terminators t ON t.id = p.terminator_id\" if @options[:order_by] == \"terminators.name\"}\n\n WHERE (\" + cond.join(\" AND \")+ \")\n #{group_by.size > 0 ? 'GROUP BY ' +group_by.join(\", \") : ''}\n #{order_by.size > 0 ? 'ORDER BY ' +order_by : ''}\"\n\n # my_debug sql\n\n @result_full = Call.find_by_sql(sql)\n @result = []\n @total_calls = @result_full.size\n # calculate total values of dataset.\n @total = {:billed_orig => 0, :billed_term => 0, :billsec_orig => 0, :billsec_term => 0, :duration => 0, :total_calls => 0, :asr => 0, :acd => 0, :answered_calls => 0}\n @result_full.each { |row|\n @total[:billed_orig] += row.originating_billed.to_d\n @total[:billed_term] += row.terminating_billed.to_d\n @total[:billsec_orig] +=row.originating_billsec.to_d\n @total[:billsec_term] += row.terminating_billsec.to_d\n @total[:duration] += row.duration.to_d\n @total[:total_calls] += row.total_calls.to_i\n @total[:answered_calls] += row.answered_calls.to_i\n }\n @total[:total_calls] == 0 ? @total[:asr] = 0 : @total[:asr] = @total[:answered_calls].to_d/@total[:total_calls].to_d*100\n @total[:answered_calls] == 0 ? @total[:acd] = 0 : @total[:acd] = @total[:duration].to_d / @total[:answered_calls].to_d\n\n # fetch required number of items.\n @result = []\n @total_pages = (@total_calls.to_d / session[:items_per_page].to_d).ceil\n @options[:page] = @total_pages if @options[:page] > @total_pages\n start = session[:items_per_page]*(@options[:page]-1)\n (start..(start+session[:items_per_page])-1).each { |i|\n @result << @result_full[i] if @result_full[i]\n }\n\n session[:aggregate_list_options] = {:page => @options[:page], :order_desc => @options[:order_desc], :destination_grouping => @options[:destination_grouping], :originator => @options[:originator], :terminator => @options[:terminator], :prefix => @options[:prefix], :unique_id_show => @options[:unique_id_show], :destination_show => @options[:destination_show], :customer_orig_show => @options[:customer_orig_show], :customer_term_show => @options[:customer_term_show], :ip_address_orig_show => @options[:ip_address_orig_show], :ip_address_term_show => @options[:ip_address_term_show], :price_orig_show => @options[:price_orig_show], :price_term_show => @options[:price_term_show], :billed_time_orig_show => @options[:billed_time_orig_show], :billed_time_term_show => @options[:billed_time_term_show], :order_by => @options[:order_by]}\n\n #session[:aggregate_list_options] = @options\n # no need to store these 2 in session as they are not options but values from database.\n @options = load_parties(@options)\n\n if @options[:terminator] == \"any\"\n @terminator_providers_count = any_terminator_providers_count(@options[:terminators])\n else\n @terminator_providers_count = terminator_providers_count(@options[:terminators], @options[:terminator])\n end\n\n end", "def aggregated_list request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/aggregated/disks\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n query_string_params[\"includeAllScopes\"] = request_pb.include_all_scopes.to_s if request_pb.include_all_scopes && request_pb.include_all_scopes != false\n query_string_params[\"maxResults\"] = request_pb.max_results.to_s if request_pb.max_results && request_pb.max_results != 0\n query_string_params[\"orderBy\"] = request_pb.order_by.to_s if request_pb.order_by && request_pb.order_by != \"\"\n query_string_params[\"pageToken\"] = request_pb.page_token.to_s if request_pb.page_token && request_pb.page_token != \"\"\n query_string_params[\"returnPartialSuccess\"] = request_pb.return_partial_success.to_s if request_pb.return_partial_success && request_pb.return_partial_success != false\n\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::DiskAggregatedList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def aggregated_over_time_query\n # TODO Remember to implement permitted parameters here\n query = @grouping_class.new(sanitized_attributes, params)\n @aggregated_over_time_data = Rails.cache.fetch(['aggregated_over_time_data', params], expires_in: 1.week) do\n query.aggregated_over_time_data\n end\n\n render json: @aggregated_over_time_data\n end", "def index\n authorize Item, policy_class: GroupBuyingPolicy\n page = params.fetch(:page, 1).to_i\n return bad_response(message: 'Invalid Request') unless page.positive?\n\n @items = Item.includes(:group_buyings).where(\n \"bidding_end_time > '#{Time.current}' AND group_buying = 1\",\n ).limit(10).offset((page - 1) * 10).order(:bidding_end_time)\n\n count = Item.includes(:group_buyings).where(\n \"bidding_end_time > '#{Time.current}' AND group_buying = 1\",\n ).count\n render json: @items, 'meta': { 'total_count': count }\n end", "def aggregates\n @aggregates\n end", "def get_aggregation_account_all_using_get_with_http_info(aggregation_account_id_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AggregationApi.get_aggregation_account_all_using_get ...'\n end\n # verify the required parameter 'aggregation_account_id_list' is set\n if @api_client.config.client_side_validation && aggregation_account_id_list.nil?\n fail ArgumentError, \"Missing the required parameter 'aggregation_account_id_list' when calling AggregationApi.get_aggregation_account_all_using_get\"\n end\n # resource path\n local_var_path = '/aggregation/account?aggregation_account_id_list=' + aggregation_account_id_list.join(\",\")\n\n # query parameters\n query_params = {}\n # query_params[:'aggregation_account_id_list'] = @api_client.build_collection_param(aggregation_account_id_list, :multi)\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api( :GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<AggregationAccountResponseVO>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AggregationApi#get_aggregation_account_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def aggregate\n []\n end", "def aggregations\n response['aggregations'] ? Hashie::Mash.new(response['aggregations']) : nil\n end", "def get_items_content(start=nil,limit=nil)\n # TODO: Stubbed to return all items.\n get_values('aggregates')\n end", "def get_items_content(start=nil,limit=nil)\n # TODO: Stubbed to return all items.\n get_values('aggregates')\n end", "def get_aggregation_account_balance_all_using_get_with_http_info(aggregation_account_id_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AggregationApi.get_aggregation_account_balance_all_using_get ...'\n end\n # verify the required parameter 'aggregation_account_id_list' is set\n if @api_client.config.client_side_validation && aggregation_account_id_list.nil?\n fail ArgumentError, \"Missing the required parameter 'aggregation_account_id_list' when calling AggregationApi.get_aggregation_account_balance_all_using_get\"\n end\n # resource path\n local_var_path = '/aggregation/balance?aggregation_account_id_list=' + aggregation_account_id_list.join(\",\")\n\n # query parameters\n query_params = {}\n # query_params[:'aggregation_account_id_list'] = @api_client.build_collection_param(aggregation_account_id_list, :multi)\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<AggregationAccountBalanceResponseVO>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AggregationApi#get_aggregation_account_balance_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_aggregation_account_holding_all_using_get_with_http_info(aggregation_account_id_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AggregationApi.get_aggregation_account_holding_all_using_get ...'\n end\n # verify the required parameter 'aggregation_account_id_list' is set\n if @api_client.config.client_side_validation && aggregation_account_id_list.nil?\n fail ArgumentError, \"Missing the required parameter 'aggregation_account_id_list' when calling AggregationApi.get_aggregation_account_holding_all_using_get\"\n end\n # resource path\n local_var_path = '/aggregation/holding?aggregation_account_id_list=' + aggregation_account_id_list.join(\",\")\n\n # query parameters\n query_params = {}\n # query_params[:'aggregation_account_id_list'] = @api_client.build_collection_param(aggregation_account_id_list, :multi)\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<AggregationAccountHoldingResponseVO>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AggregationApi#get_aggregation_account_holding_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_array_counts_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/arrays/summary/#{args[:tenantId]}\", args)\nend", "def index\n # @cd = DisRoutedGeneric.all\n c = DisRoutedGeneric.paginate(:page => params[:page], :per_page => 10)\n e = c.count\n c = c.as_json\n d = [{\"Count\" => e}]\n m = {\"a\" => c ,\"b\" => d}\n # n = c.to_a << @m\n respond_with m\n end", "def groupby_baselist\n { 'base_list' => { '$sum' => '$tms_sales_allocated_bookings_base_list' } } \n end", "def get_hist_stats_aggregated_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_hist_stats_aggregated ...'\n end\n # unbox the parameters from the hash\n allowable_values = [\"hour\", \"minute\", \"day\"]\n if @api_client.config.client_side_validation && opts[:'by'] && !allowable_values.include?(opts[:'by'])\n fail ArgumentError, \"invalid value for \\\"by\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"usa\", \"europe\", \"asia\", \"asia_india\", \"asia_southkorea\", \"africa_std\", \"southamerica_std\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/stats/aggregate'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'by'] = opts[:'by'] if !opts[:'by'].nil?\n query_params[:'region'] = opts[:'region'] if !opts[:'region'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HistoricalAggregateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"HistoricalApi.get_hist_stats_aggregated\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: HistoricalApi#get_hist_stats_aggregated\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "def http_statistics\n super\n end", "def aggregate\n #response = Result.collection.map_reduce(self.map_fn(), _reduce(), :raw => true, :out => {:inline => true}, :query => {:execution_id => id})\n response = Result.where(execution_id: id).map_reduce(self.map_fn(), self.query.reduce).out(inline: true).raw()\n results = response['results']\n if results\n self.aggregate_result = {}\n results.each do |result|\n result = prettify_generated_result(result) if self.query.generated? && result['value']['rereduced']\n self.aggregate_result[result['_id']] = result['value']\n end\n save!\n end\n end", "def get_capability_port_group_aggregation_def_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CapabilityApi.get_capability_port_group_aggregation_def_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/capability/PortGroupAggregationDefs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CapabilityPortGroupAggregationDefResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CapabilityApi.get_capability_port_group_aggregation_def_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CapabilityApi#get_capability_port_group_aggregation_def_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list(params={})\n super params\n end", "def list(params={})\n super params\n end", "def get_aggregation_account_transaction_all_using_get_with_http_info(aggregation_account_id_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AggregationApi.get_aggregation_account_transaction_all_using_get ...'\n end\n # verify the required parameter 'aggregation_account_id_list' is set\n if @api_client.config.client_side_validation && aggregation_account_id_list.nil?\n fail ArgumentError, \"Missing the required parameter 'aggregation_account_id_list' when calling AggregationApi.get_aggregation_account_transaction_all_using_get\"\n end\n # resource path\n local_var_path = '/aggregation/transaction?aggregation_account_id_list=' + aggregation_account_id_list.join(\",\")\n\n # query parameters\n query_params = {}\n # query_params[:'aggregation_account_id_list'] = @api_client.build_collection_param(aggregation_account_id_list, :multi)\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<AggregationAccountTransactionResponseVO>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AggregationApi#get_aggregation_account_transaction_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n # @cd = DisGenericMonograph.all\n c = DisGenericMonograph.paginate(:page => params[:page], :per_page => 10)\n e = c.count\n c = c.as_json\n d = [{\"Count\" => e}]\n m = {\"a\" => c ,\"b\" => d}\n # n = c.to_a << @m\n respond_with m\n end", "def aggregate\n public_send aggregate_name\n end", "def index\n authorize RosterList\n params[:page] ||= 1\n meta = {}\n # RosterList.all.each { |r| r.fill_in_data }\n all_result = search_query\n meta['total_count'] = all_result.count\n result = all_result.page( params[:page].to_i).per(20)\n\n # meta['total_count'] = result.total_count\n meta['total_page'] = result.total_pages\n meta['current_page'] = result.current_page\n # result.each { |r| r.fill_in_data }\n\n final_result = format_result(result.as_json(include: [], methods: []))\n\n response_json final_result, meta: meta\n end", "def link_aggregations\r\n LinkAggregationsController.instance\r\n end", "def products_aggregate\n quantities = GroupBoxContent.sum(:quantity,group: :product_id)\n quantities.delete_if {|key, value| value == 0 } \n\n products = Product.find(quantities.keys)\n @products_quantities = {}\n products.each do |product|\n @products_quantities[product] = quantities[product.id]\n end\n\n respond_to do |format|\n format.html # products_aggregate.html.erb\n format.json { render json: @groups }\n end\n end", "def links\n @sales_aggregates = SalesAggregate\n\n if params.length == 0\n @sales_aggregates = @sales_aggregates.all\n end\n \n if params.has_key?(:tag)\n @sales_aggregates = @sales_aggregates.where(tag: params[:tag])\n elsif params.has_key?(:tags)\n tags = params[:tags].split(/,\\s*/)\n @sales_aggregates = @sales_aggregates.in(tag: tags)\n end\n \n @locale = nil\n if params.has_key?(:locale)\n @locale = Locale.find_by(name: params[:locale])\n \n @sales_aggregates = @sales_aggregates.\n or({ made_in: @locale}, { sold_in: @locale })\n end\n \n @locales = nil\n @totals = nil\n if (params.has_key?(:tag) or params.has_key?(:tags) or not @locale.nil?)\n map = %Q{ function() { \n emit(this.made_in_id, { qty_bought: 0, qty_sold: this.qty, value_bought: 0.0, value_sold: this.value }); \n emit(this.sold_in_id, { qty_bought: this.qty, qty_sold: 0, value_bought: this.value, value_sold: 0 }); \n }}\n \n reduce = %Q{\n function(key, values) {\n var result = {\n qty_bought: 0,\n qty_sold: 0,\n value_bought: 0,\n value_sold: 0.0\n };\n \n values.forEach(function(value) {\n result.qty_bought += value.qty_bought;\n result.qty_sold += value.qty_sold;\n result.value_bought += value.value_bought;\n result.value_sold += value.value_sold;\n });\n \n return result;\n }\n }\n \n @locales = @sales_aggregates.\n map_reduce(map, reduce).\n out(inline: true)\n \n qty_bought = 0\n qty_sold = 0\n value_bought = 0.0\n value_sold = 0.0\n\n local_qty_bought = 0\n local_value_bought = 0.0\n local_qty_sold = 0\n local_value_sold = 0.0\n\n @locales.each do |loc|\n db_loc = Locale.find(loc[\"_id\"])\n \n qty_bought += loc[\"value\"][\"qty_bought\"]\n qty_sold += loc[\"value\"][\"qty_sold\"]\n value_bought += loc[\"value\"][\"value_bought\"]\n value_sold += loc[\"value\"][\"value_sold\"]\n \n if not @locale.nil? and db_loc == @locale\n local_qty_bought = loc[\"value\"][\"qty_bought\"]\n local_qty_sold = loc[\"value\"][\"qty_sold\"]\n local_value_bought = loc[\"value\"][\"value_bought\"]\n local_value_sold = loc[\"value\"][\"value_sold\"]\n end\n \n loc[\"value\"][\"lat\"] = db_loc.lat\n loc[\"value\"][\"long\"] = db_loc.long\n end\n \n @totals = Hash[\n \"global\" => Hash[\n \"qty_bought\" => qty_bought,\n \"qty_sold\" => qty_sold,\n \"value_bought\" => value_bought,\n \"value_sold\" => value_sold\n ],\n \"local\" => Hash[\n \"qty_bought\" => local_qty_bought,\n \"qty_sold\" => local_qty_sold,\n \"value_bought\" => local_value_bought,\n \"value_sold\" => local_value_sold\n ]\n ]\n end\n\n if params.has_key?(:sort_by)\n if params[:sort_by] == \"qty\"\n sort_by = :qty\n elsif params[:sort_by] == \"value\"\n sort_by = :value\n end\n\n sort_dir = :desc\n if params.has_key?(:sort_dir) and params[:sort_dir] == \"asc\"\n sort_dir = :asc\n end\n \n if sort_dir == :asc\n @sales_aggregates = @sales_aggregates.asc(sort_by);\n else\n @sales_aggregates = @sales_aggregates.desc(sort_by);\n end\n end\n\n respond_to do |format|\n format.json # links.json.jbuilder\n end\n end", "def aggregates\n self.class.instance_variable_get(:@aggregates) || {}\n end", "def listgroup \n @groups = Group.where(:company_id => params[:id])\n #@lst= []\n # @groups.each do |group| \n # @lst << JSON.parse(group.to_json).merge(member_nbr: group.users.count)\n # end\n # format.json { render :json => @lst } \n render 'list'\n end", "def list_all\n arr = []\n thr = []\n\n subscriptions.each do |sub|\n sub_id = sub['subscriptionId']\n resource_groups(sub_id).each do |group|\n @api_version = '2014-06-01'\n url = build_url(sub_id, group['name'])\n\n thr << Thread.new{\n res = JSON.parse(rest_get(url))['value'].first\n arr << res if res\n }\n end\n end\n\n thr.each{ |t| t.join }\n\n arr\n end", "def index\n result = []\n db_data = get_thermostats_reading_aggregation\n redis_data = get_redis_data\n render status: 400, :json=>{:error => I18n.t('no_data_household')} and return if db_data.blank? && redis_data.blank?\n if redis_data.empty?\n result = db_data\n elsif db_data.empty?\n result = redis_data\n else\n result = get_aggregated_data(db_data,redis_data,result)\n end\n render status: 200, :json=>{:thermostat_data => result} and return\n end", "def aggregations\n @aggregations ||= AggregationSet.new\n end", "def get_aggregation_account_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AggregationAccountApi.get_aggregation_account_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/aggregation_account'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageAggregationAccount')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AggregationAccountApi#get_aggregation_account_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_endpoint(clazz, select_options = nil, base_record_set: nil)\n if base_record_set\n records = base_record_set\n else\n records = clazz.all\n end\n\n records = apply_pagination(records)\n\n if select_options\n records.as_json(select_options)\n else\n records\n end\n end", "def index\n @local_cpu_summaries = LocalCpuSummary.orderByParms('id desc',params).paginate(:page=>params[:page], :per_page => config.itemsPerPageHTML)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @local_cpu_summaries }\n end\n end", "def custom_groups\n\n groups_list = prep_format(PolcoGroup.where(name: /#{params[:q]}/i, type: :custom))\n\n respond_to do |format|\n format.json {render :json => groups_list}\n end\n end", "def totals\n\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t@totals = Solr.get_totals(is_test)\n#\t\tresults = [ { :name => 'NINES', :total_docs => 400, :total_archives => 12}, { :name => '18thConnect', :total_docs => 800, :total_archives => 24 } ]\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @totals }\n\t\t\tformat.xml # index.xml.builder\n\t\tend\n\tend", "def index\n # @cd = DisDatasource.all\n a = DisDatasource.paginate(:page => params[:page], :per_page => 10).order(:id)\n rowcount = a.count\n a = a.as_json\n rows = [{\"rows\" => rowcount}]\n result = {\"raw\" => a ,\"count\" => rows}\n # n = c.to_a << @m\n respond_with result\n end", "def index\n # @cd = DisManufacturer.all\n c = DisManufacturer.paginate(:page => params[:page], :per_page => 10)\n e = c.count\n c = c.as_json\n d = [{\"Count\" => e}]\n m = {\"a\" => c ,\"b\" => d}\n # n = c.to_a << @m\n respond_with m\n end", "def index\n c = CombinationDose.paginate(:page => params[:page], :per_page => 3)\n e = c.count\n c = c.as_json\n d = [{\"Count\" => e}]\n m = {\"a\" => c ,\"b\" => d}\n # n = c.to_a << @m\n respond_with m\n end", "def invoices_group \n render json: {\n paid_invoices: Invoice.where(created_at: params[:start_date]..(params[:end_date]), invoice_status_id: 12).count,\n pending_invoices: Invoice.where(created_at: params[:start_date]..(params[:end_date]), invoice_status_id: 11).count,\n billed_amount: Invoice.where(created_at: params[:start_date]..(params[:end_date]), invoice_status_id: 12).map { |x| x.price + x.plan.fees }.reduce(0,:+),\n pending_amount: Invoice.where(created_at: params[:start_date]..(params[:end_date]), invoice_status_id: 11).map { |x| x.price + x.plan.fees }.reduce(0,:+)\n }\n end", "def index\n #Limit and offset is set in application_controller\n tags = Tag.limit(@limit).offset(@offset)\n \n count_tags = Tag.distinct.count(:id)\n @response = {tags: tags, nrOfTags: count_tags}\n respond_with @response, include: [:restaurants], status: :ok\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = ListCollectionsResultSet.new(resp)\n return results\n end", "def paginated_collected(options = {})\n paginated(options)\n end", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_alarms.to_ext_json(:class => Alarm, :count => Alarm.count(options_from_search(Alarm)), :include => [:alarm_order, :alarm_period_warning, :contract]) }\n end\n end", "def index\n @event_aggs = EventAgg.all\n end", "def assemble_request(tweets_of_interest)\n\n\t request = {}\n\n\t request['tweet_ids'] = tweets_of_interest\n\n\t if @endpoint == 'historical'\n\t\t request['start'] = @utils.get_ISO_date_string(@utils.get_date_object(@start_date)) unless @start_date.nil?\n\t\t request['end'] = @utils.get_ISO_date_string(@utils.get_date_object(@end_date)) unless @end_date.nil? #Let API default to now.\n\t end\n\n\t request['engagement_types'] = []\n\n\t if @endpoint == 'totals'\n\t\t @engagement_types.each do |engagement_type|\n\t\t\tif TOTALS_ENGAGEMENT_TYPES.include?(engagement_type[0])\n\t\t\t if engagement_type[1] then\n\t\t\t\t request['engagement_types'] << engagement_type[0]\n\t\t\t end\n\t\t\tend\n\t\t end\n\t else\n\t\t @engagement_types.each do |engagement_type|\n\t\t\tif engagement_type[1] then\n\t\t\t request['engagement_types'] << engagement_type[0]\n\t\t\tend\n\t\t end\n\t end\n\n\t #Assemble groupings section.\n \t request['groupings'] = {}\n\t @groupings.each do |key, items|\n\t\t \n\t\t \n\t\t if @endpoint == 'totals'\n\n\t\t if !items.include? 'engagement.hour' and !items.include? 'engagement.day'\n\t\t\t request['groupings'][key] = {}\n\t\t\t request['groupings'][key]['group_by'] = []\n\t\t\t items.each do |item|\n\t\t\t \t\trequest['groupings'][key]['group_by'] << item\n \t\t\t end\n\t\t\telse\n\t\t\t AppLogger.log_info \"Not adding time-series grouping to /totals request\"\n\t\t\t @groupings = @groupings.tap { |h| h.delete(key)}\n\t\t end\n\t\t else\n\t\t\trequest['groupings'][key] = {}\n\t\t\trequest['groupings'][key]['group_by'] = []\n\t\t\titems.each do |item|\n\t\t\t request['groupings'][key]['group_by'] << item\n\t\t\tend\n\t end\n\t end\n\n\t request.to_json\n\n end", "def fetch\n sort = 'created_at DESC'\n\n case params[:sort_by]\n when 'recent'\n sort = 'created_at DESC'\n else\n\n end\n\n q = '%' + params[:query].downcase + '%'\n\n groups = Group.where(\"LOWER(name) LIKE ? OR LOWER(identifier) LIKE ? OR lower(tags) LIKE ?\", q, q, q)\n .order(sort)\n\n paginate json: groups\n end", "def index\n # @cd = DisGeneric.all\n if params[:filter]\n c = DisGeneric.where(\"name LIKE ? \", \"%#{params[:filter]}%\").paginate(:page => params[:page], :per_page => 10)\n else\n c = DisGeneric.paginate(:page => params[:page], :per_page => 10)\n end\n e = c.count\n c = c.as_json\n d = [{\"Count\" => e}]\n m = {\"a\" => c ,\"b\" => d}\n # if params[:filter]\n # m = {\"a\" => params[:filter] ,\"b\" => params[:g]}\n # respond_with m\n # else\n # n = c.to_a << @m\n respond_with m\n # end\n\n end", "def index\n @item_groups = ItemGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_groups }\n end\n end", "def get_all\n raise UnsupportedOperation\n end", "def index\n __log_activity\n __debug_route\n prm = paginator.initial_parameters\n @extended = prm.key?(:expand) ? true?(prm.delete(:expand)) : EXPAND_JSON\n search = prm.delete(:like) # TODO: :like param\n search = search ? build_query_options(search) : {}\n results =\n if @extended\n SearchCall.extended_table(search)\n else\n get_search_calls(search)\n end\n results.limit!(prm[:limit]) if prm[:limit] # TODO: temporary\n results.offset!(prm[:offset]) if prm[:offset] # TODO: temporary\n found = { list: results.to_a }\n @list = paginator.finalize(found, **search)\n respond_to do |format|\n format.html\n format.json { render_json index_values }\n format.xml { render_xml index_values }\n end\n end", "def batch_of_items\n @catalog=Catalog.find(params[:id])\n \n # set a reasonable default for the current page\n @page=params[:page]\n @page=1 if @page.nil?\n \n # set a reasonable default for the current size\n @size=params[:size]\n @size=12 if @size.nil?\n \n # grab the batch of items corresponding to the page and size\n @items = @catalog.get_batch_of_items(@page, @size)\n \n respond_to do |format|\n # wouldn't make sense to call this API method as html, but for debugging purposes\n # just return json anyway\n format.html { render json: {:items => @items, :page => @page, :size => @size }}\n format.json { render json: {:items => @items, :page => @page, :size => @size }}\n end\n end", "def agg_trades(options)\n request :public, :get, :aggTrades, options\n end", "def index\n # @cd = DisGenericHepaticImp.all\n c = DisGenericHepaticImp.paginate(:page => params[:page], :per_page => 10)\n e = c.count\n c = c.as_json\n d = [{\"Count\" => e}]\n m = {\"a\" => c ,\"b\" => d}\n # n = c.to_a << @m\n respond_with m\n end", "def process_aggregates\n aggregates = new_collection\n\n unless assessment_group.scoring_type == 2 # do except for scoring type 'grades'\n aggregates.push new_aggregate('score','Total Score',@total_score)\n percentage = @total_score.zero? ? nil : ((@total_score / @total_max) * 100).round(2)\n aggregates.push new_aggregate('percentage','Total Percentage', percentage)\n aggregates.push new_aggregate('grade','Overall Grade',overall_grade_set.grade_string_for(percentage)) if overall_grade_set.present?\n end\n\n aggregates\n end", "def index\n\n\t\t@groups = Group.find_paginate({:user=> current_user, :page => params[:page], :query => params[:query], :sort => params[:sort], :nb_items => get_nb_items(params[:nb_items]) })\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @groups }\n\t\t\tformat.json { render :json => @groups }\n\t\tend\n\tend", "def collect_alarms_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.collect_alarms ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling NsxComponentAdministrationApi.collect_alarms, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling NsxComponentAdministrationApi.collect_alarms, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = \"/hpm/alarms\"\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AlarmListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#collect_alarms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_roll_pools.to_ext_json(:class => RollPool, :count => RollPool.count(options_from_search(RollPool))) }\n end\n end", "def sum_lists()\nend", "def index\n @resource_allocations = ResourceAllocation.scoped\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resource_allocations }\n end\n end", "def get_all\n\t\tif !params.has_key?(\"count\") or params[:count].empty?\n\t\t\tparams[:count]= 50\n\t\tend\n\t\tif !params.has_key?(\"start\") or params[:start].empty? \n\t\t\tparams[:start] = 0 \n\t\tend\n\t\tusers = []\n\t\tUser.all.limit(params[:count]).offset(params[:start]).each do |u|\n\t\t\thash = u.attributes \n\t\t\thash[:client] = u.client ? u.client.name : nil\n\t\t\tusers.push(hash)\n\t\tend\n\t\trespond({ status: 0, users: users, start: params[:start] })\n\tend", "def index\n add_breadcrumb I18n.t('listing', entity: Sale.model_name.human(count: 10))\n @q = policy_scope(Sale).ransack(params[:q])\n @sales = @q.result.includes(:buyer).includes(:seller).includes(:attorney).includes(:bond_attorney).page(params[:page]).per(session[:default_per])\n end", "def index\n result = []\n db_data = get_db_aggregation\n redis_cache = get_cache_aggregation\n\n if redis_cache.empty?\n result = db_data\n elsif db_data.empty?\n result = redis_cache\n else\n db_data.each_with_index do |val,i|\n val.each do |k,value|\n avg_val = (value[\"avg\"].to_f + redis_cache[i][k][\"avg\"].to_f) / 2\n min_val = [value[\"min\"].to_f, redis_cache[i][k][\"min\"].to_f].min\n max_val = [value[\"max\"].to_f, redis_cache[i][k][\"max\"].to_f].max\n result << {k => {\"avg\" => avg_val, \"min\" => min_val, \"max\" => max_val} }\n end \n end\n end\n\n render json: {thermostat_data: result}\n end", "def aggregated_ratings\n PropertyRatingService::RatingData.new(self).data\n end", "def aggregated_ratings\n PropertyRatingService::RatingData.new(self).data\n end", "def index\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n if prm.present?\n # Perform search here.\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n else\n # Otherwise redirect to the appropriate list action.\n prm[:action] = current_org ? :list_org : :list_all\n respond_to do |format|\n format.html { redirect_to prm }\n format.json { redirect_to prm.merge!(format: :json) }\n format.xml { redirect_to prm.merge!(format: :xml) }\n end\n end\n end", "def index\n conditions = { :client_id => @client.id }\n if params[\"tags\"]\n conditions.merge!({:tags => params[\"tags\"]})\n end\n\n @collections = Collection.where(conditions).order('updated_at DESC')\n @collections.reject! { |item| ! item.read?(@user, @client) }\n\n entries = Array.new\n if @collections\n @collections.each do |item|\n entries << item.info_hash(@user, @client)\n end\n end\n render_json :entry => entries and return\n end", "def store_aggregates\n raise NotImplementedError\n end", "def index\n respond_with(@collection) do |format|\n format.json { render :json => @collection.to_json(collection_serialization_options) }\n end\n end", "def _ls\n @response[:list] = []\n end", "def index\n @group_stats = GroupStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_stats }\n end\n end", "def index\n lists = if params[:filter]\n filter_type = params[:filter]\n case filter_type\n when \"promoted\"\n lists = List.where(promoted: true).recent.page params[:page]\n end\n elsif params[:query]\n List.search(params)\n end\n\n render :json => lists\n end", "def stats\n result = UserReservation.stats params[:id_list]\n render json: {revenue:result[:totalRevenue]}\n end", "def index\n render json: RequestItem.all\n end", "def retrieve_aggregates\n fail ArgumentError, \"Invalid range type '#{range_type}'\" unless %w(year month week day hour).include? range_type\n scope = LineAggregate.\n where(:function => function).\n where(:range_type => 'normal').\n where(:account => account.try(:to_s)).\n where(:partner_account => partner_account.try(:to_s)).\n where(:code => code.try(:to_s)).\n where(:filter => filter.inspect).\n where(LineAggregate.arel_table[range_type].not_eq(nil))\n @aggregates = scope.each_with_object({}) do |result, hash|\n hash[result.key] = formatted_amount(result.amount)\n end\n end", "def index\n index! do |format|\n format.html\n format.json do\n object = if params[:id]\n resource.increment_hits!\n resource\n else\n collection\n end\n\n render :json => object \n end\n end\n end", "def query_list_metric(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'QueryListMetric'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :dimensions\n\t\t\targs[:query]['Dimensions'] = optional[:dimensions]\n\t\tend\n\t\tif optional.key? :end_time\n\t\t\targs[:query]['EndTime'] = optional[:end_time]\n\t\tend\n\t\tif optional.key? :extend\n\t\t\targs[:query]['Extend'] = optional[:extend]\n\t\tend\n\t\tif optional.key? :filter\n\t\t\targs[:query]['Filter'] = optional[:filter]\n\t\tend\n\t\tif optional.key? :length\n\t\t\targs[:query]['Length'] = optional[:length]\n\t\tend\n\t\tif optional.key? :metric\n\t\t\targs[:query]['Metric'] = optional[:metric]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :period\n\t\t\targs[:query]['Period'] = optional[:period]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:query]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :start_time\n\t\t\targs[:query]['StartTime'] = optional[:start_time]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n f = find_budgets\n format.ext_json { render :json => f.to_ext_json(:class => :budget, \n :count => f.length,\n :methods=>[:total_budget_costs,:total_budget_invoices,:total_budget_pricings],\n :include=>{:user=>{:only=>\"login\"}}) }\n \n end\n end", "def index\n # Main List\n @params = params\n\n if !params[:sort].nil?\n sort = params[:sort]\n else\n sort = 'created_at'\n end\n\n if !params[:order].nil?\n order = params[:order]\n else\n order = 'DESC'\n end\n\n if !params[:per_page].nil?\n pagesize = params[:per_page]\n else\n pagesize = 48\n end\n\n @visualizations = Visualization.search(params[:search]).paginate(page: params[:page], per_page: pagesize)\n\n @visualizations = @visualizations.order(\"#{sort} #{order}\")\n\n respond_to do |format|\n format.html\n format.json { render json: @visualizations.map { |v| v.to_hash(false) } }\n end\n end", "def get_all()\n raise \"Must be overridden\"\n end", "def show\n @generic_table_aggregation = GenericTable::Aggregation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generic_table_aggregation }\n end\n end", "def list\n get()\n end", "def stats\n return self.endpoint.stats(self.id)\n end", "def index\n @security_groups_data = []\n aws = Fog::Compute.new :provider => 'AWS', :aws_access_key_id => \"AKIAIIKBNVJEP4F2KT6Q\", :aws_secret_access_key => \"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\"\n regions = aws.describe_regions.body[\"regionInfo\"].map {|region| region[\"regionName\"]}\n regions.each do |region|\n compute = Fog::Compute.new :provider => 'AWS', :region => 'us-west-2', :aws_access_key_id => \"AKIAIIKBNVJEP4F2KT6Q\", :aws_secret_access_key => \"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\"\n security_groups = SecurityGroup.fetch_all_sgs(compute)\n @security_groups_data << SecurityGroup.fetch_all_inbound_rule(security_groups, region)\n end\n #puts \"@security_groups_data #{@security_groups_data}\"\n end", "def index\n @mlog = MlogEntry.all\n @mlog_entries = @mlog.order(updated_at: :desc).page params[:page]\n @type_data = get_type_data(@mlog)\n @total_size = get_total_size(@type_data)\n @collections = getMinCollections\n @min_accessions = getMinAccessions\n end", "def index\n @meta_data_groups = MetaDataGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meta_data_groups }\n end\n end", "def index\n @email_price_lists = EmailPriceList.where(category: nil).order(\"updated_at DESC\")\n\n render json: @email_price_lists , each_serializer: Web::V1::EmailPriceSerializer\n end", "def index\n @grouped_offerings = @course_offerings.group_by(&:term)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course_offerings }\n end\n end", "def get_routing_queues_divisionviews_all_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_queues_divisionviews_all ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'sort_by'] && !['name', 'id', 'divisionId'].include?(opts[:'sort_by'])\n fail ArgumentError, 'invalid value for \"sort_by\", must be one of name, id, divisionId'\n end\n \n \n \n \n \n \n \n if opts[:'sort_order'] && !['asc', 'desc', 'score'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of asc, desc, score'\n end\n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/queues/divisionviews/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']\n query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueueEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_queues_divisionviews_all\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_expired\n if params[:count] && params[:count].to_i\n render status: 200,\n json: Event.where('end_date < ? AND archived = ?', Time.now, false).order('start_date desc').limit(params[:count].to_i).as_json(include: { event_type: {}, briefing:{ include: { starting_system: {}, ending_system: {}, operational_leader: { methods: [:full_name] }, escort_leader: { methods: [:full_name] }, communications_designee: { methods: [:full_name] }, reporting_designee: { methods: [:full_name] } }}, debriefing: {}, awards: { methods: [:image_url]}, attendences: { include: { character: { methods: [:full_name] }, attendence_type: { } }} }, methods: [:start_date_ms, :end_date_ms, :is_expired])\n else\n render status: 200,\n json: Event.where('end_date < ? AND archived = ?', Time.now, false).order('start_date desc').as_json(include: { event_type: {}, briefing:{ include: { starting_system: {}, ending_system: {}, operational_leader: { methods: [:full_name] }, escort_leader: { methods: [:full_name] }, communications_designee: { methods: [:full_name] }, reporting_designee: { methods: [:full_name] } }}, debriefing: {}, awards: { methods: [:image_url]}, attendences: { include: { character: { methods: [:full_name] }, attendence_type: { } }} }, methods: [:start_date_ms, :end_date_ms, :is_expired])\n end\n end", "def index\n # @cd = DisAlcoholInteraction.all\n a = DisAlcoholInteraction.paginate(:page => params[:page], :per_page => 3).order(:id)\n @m = array = []\n a.each do |m|\n # user = User.where(id: m.user_two).last\n h = {}\n h[\"id\"] = m.id\n h[\"name\"] = m.name\n h[\"description\"] = m.description\n h[\"datasource_id\"] = m.datasource_id\n\n # Start - Logic to lookup for data source name\n if m.datasource_id\n @DisDatasource = DisDatasource.where(id:m.datasource_id).last\n # Above m.status_id has value 1 and @DisStatus is an object\n h[\"datasource_name\"] = @DisDatasource.name\n else\n h[\"datasource_name\"] =\"No Data\"\n end\n # End - Logic to lookup for data source name\n array << h\n end\n rowcount = a.count\n a = a.as_json\n rows = [{\"rows\" => rowcount}]\n result = {\"raw\" => a ,\"count\" => rows , \"final\" => @m}\n # n = c.to_a << @m\n respond_with result\n end", "def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = GetGalleryListResultSet.new(resp)\n return results\n end" ]
[ "0.677039", "0.6543518", "0.64048564", "0.6356955", "0.6265128", "0.60694504", "0.5953424", "0.5902644", "0.5884521", "0.5846486", "0.5786312", "0.5777131", "0.57170635", "0.5693815", "0.56825435", "0.5665302", "0.5664142", "0.56616646", "0.5660386", "0.56501734", "0.5619399", "0.5572725", "0.5565308", "0.55319846", "0.55219406", "0.55219406", "0.5521552", "0.5514266", "0.5513812", "0.5512377", "0.55002", "0.5469097", "0.54672176", "0.5461685", "0.54612964", "0.5452799", "0.5445651", "0.54252446", "0.5407751", "0.5400178", "0.53946304", "0.5382462", "0.5375828", "0.5370269", "0.5364718", "0.53512055", "0.53494453", "0.53493184", "0.5348912", "0.5347786", "0.5344667", "0.53437054", "0.53421074", "0.5341417", "0.53224885", "0.53181916", "0.5313927", "0.53105325", "0.53067744", "0.53057706", "0.53057456", "0.53055507", "0.5304277", "0.5296785", "0.52959615", "0.52934444", "0.5293408", "0.5289128", "0.5284489", "0.52758723", "0.52732843", "0.52732843", "0.52697897", "0.5263641", "0.52622354", "0.52601653", "0.5254938", "0.52473056", "0.524482", "0.5240815", "0.5237167", "0.5230258", "0.52237064", "0.52210665", "0.52210134", "0.5220359", "0.5217559", "0.5217183", "0.521295", "0.5204783", "0.5204666", "0.52041304", "0.52013904", "0.52012336", "0.51972693", "0.5185213", "0.5181847", "0.51795304", "0.5177079", "0.5176859" ]
0.66661304
1
Baseline implementation for the apply_updates_to_instances REST call
def apply_updates_to_instances request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, _query_string_params = transcode_apply_updates_to_instances_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @parameters = args[:parameters] if args.key?(:parameters)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @labels = args[:labels] if args.key?(:labels)\n @location = args[:location] if args.key?(:location)\n @network = args[:network] if args.key?(:network)\n @placement = args[:placement] if args.key?(:placement)\n @service_account = args[:service_account] if args.key?(:service_account)\n end", "def update!(**args)\n @app_engine_version = args[:app_engine_version] if args.key?(:app_engine_version)\n @cloud_function = args[:cloud_function] if args.key?(:cloud_function)\n @cloud_run_revision = args[:cloud_run_revision] if args.key?(:cloud_run_revision)\n @cloud_sql_instance = args[:cloud_sql_instance] if args.key?(:cloud_sql_instance)\n @forwarding_rule = args[:forwarding_rule] if args.key?(:forwarding_rule)\n @forwarding_rule_target = args[:forwarding_rule_target] if args.key?(:forwarding_rule_target)\n @gke_master_cluster = args[:gke_master_cluster] if args.key?(:gke_master_cluster)\n @instance = args[:instance] if args.key?(:instance)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @load_balancer_id = args[:load_balancer_id] if args.key?(:load_balancer_id)\n @load_balancer_type = args[:load_balancer_type] if args.key?(:load_balancer_type)\n @network = args[:network] if args.key?(:network)\n @network_type = args[:network_type] if args.key?(:network_type)\n @port = args[:port] if args.key?(:port)\n @project_id = args[:project_id] if args.key?(:project_id)\n end", "def update!(**args)\n @acked_instance_count = args[:acked_instance_count] if args.key?(:acked_instance_count)\n @applying_patches_instance_count = args[:applying_patches_instance_count] if args.key?(:applying_patches_instance_count)\n @downloading_patches_instance_count = args[:downloading_patches_instance_count] if args.key?(:downloading_patches_instance_count)\n @failed_instance_count = args[:failed_instance_count] if args.key?(:failed_instance_count)\n @inactive_instance_count = args[:inactive_instance_count] if args.key?(:inactive_instance_count)\n @no_agent_detected_instance_count = args[:no_agent_detected_instance_count] if args.key?(:no_agent_detected_instance_count)\n @notified_instance_count = args[:notified_instance_count] if args.key?(:notified_instance_count)\n @pending_instance_count = args[:pending_instance_count] if args.key?(:pending_instance_count)\n @post_patch_step_instance_count = args[:post_patch_step_instance_count] if args.key?(:post_patch_step_instance_count)\n @pre_patch_step_instance_count = args[:pre_patch_step_instance_count] if args.key?(:pre_patch_step_instance_count)\n @rebooting_instance_count = args[:rebooting_instance_count] if args.key?(:rebooting_instance_count)\n @started_instance_count = args[:started_instance_count] if args.key?(:started_instance_count)\n @succeeded_instance_count = args[:succeeded_instance_count] if args.key?(:succeeded_instance_count)\n @succeeded_reboot_required_instance_count = args[:succeeded_reboot_required_instance_count] if args.key?(:succeeded_reboot_required_instance_count)\n @timed_out_instance_count = args[:timed_out_instance_count] if args.key?(:timed_out_instance_count)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\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 @instances = args[:instances] if args.key?(:instances)\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 @failed_locations = args[:failed_locations] if args.key?(:failed_locations)\n @instances = args[:instances] if args.key?(:instances)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update_instances\n Instance.update_all( ['public_ip=NULL, dns_name=NULL'], ['provider_account_id=? and public_ip=? and instance_id != ?', provider_account_id, public_ip, instance_id ] )\n \tInstance.update_all( ['public_ip=?, dns_name=?', public_ip, name], ['provider_account_id=? and instance_id=?', provider_account_id, instance_id ] )\n end", "def update!(**args)\n @all = args[:all] if args.key?(:all)\n @group_labels = args[:group_labels] if args.key?(:group_labels)\n @instance_name_prefixes = args[:instance_name_prefixes] if args.key?(:instance_name_prefixes)\n @instances = args[:instances] if args.key?(:instances)\n @zones = args[:zones] if args.key?(:zones)\n end", "def update_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_update_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\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(...)\n end", "def update!(**args)\n @accelerators = args[:accelerators] if args.key?(:accelerators)\n @boot_disk_size_gb = args[:boot_disk_size_gb] if args.key?(:boot_disk_size_gb)\n @confidential_instance_config = args[:confidential_instance_config] if args.key?(:confidential_instance_config)\n @disable_public_ip_addresses = args[:disable_public_ip_addresses] if args.key?(:disable_public_ip_addresses)\n @enable_nested_virtualization = args[:enable_nested_virtualization] if args.key?(:enable_nested_virtualization)\n @machine_type = args[:machine_type] if args.key?(:machine_type)\n @pool_size = args[:pool_size] if args.key?(:pool_size)\n @pooled_instances = args[:pooled_instances] if args.key?(:pooled_instances)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shielded_instance_config = args[:shielded_instance_config] if args.key?(:shielded_instance_config)\n @tags = args[:tags] if args.key?(:tags)\n end", "def update!(**args)\n @counts = args[:counts] if args.key?(:counts)\n @instances = args[:instances] if args.key?(:instances)\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 @api_method_name = args[:api_method_name] if args.key?(:api_method_name)\n @counter = args[:counter] if args.key?(:counter)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n end", "def batch_update(request = nil, manifest: nil, items: nil, **opt)\n self.request = request ||= pre_flight(manifest, items, **opt)\n self.start_time = request[:start_time] ||= timestamp\n opt[:manifest_id] = request[:manifest_id] ||= manifest\n result_data = submit_batch(**opt)\n self.end_time = timestamp\n self.result = post_flight(result_data, **opt)\n end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update!(**args)\n @completion_stats = args[:completion_stats] if args.key?(:completion_stats)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_container_logging = args[:disable_container_logging] if args.key?(:disable_container_logging)\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 @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @generate_explanation = args[:generate_explanation] if args.key?(:generate_explanation)\n @input_config = args[:input_config] if args.key?(:input_config)\n @instance_config = args[:instance_config] if args.key?(:instance_config)\n @labels = args[:labels] if args.key?(:labels)\n @manual_batch_tuning_parameters = args[:manual_batch_tuning_parameters] if args.key?(:manual_batch_tuning_parameters)\n @model = args[:model] if args.key?(:model)\n @model_monitoring_config = args[:model_monitoring_config] if args.key?(:model_monitoring_config)\n @model_monitoring_stats_anomalies = args[:model_monitoring_stats_anomalies] if args.key?(:model_monitoring_stats_anomalies)\n @model_monitoring_status = args[:model_monitoring_status] if args.key?(:model_monitoring_status)\n @model_parameters = args[:model_parameters] if args.key?(:model_parameters)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @name = args[:name] if args.key?(:name)\n @output_config = args[:output_config] if args.key?(:output_config)\n @output_info = args[:output_info] if args.key?(:output_info)\n @partial_failures = args[:partial_failures] if args.key?(:partial_failures)\n @resources_consumed = args[:resources_consumed] if args.key?(:resources_consumed)\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 @unmanaged_container_model = args[:unmanaged_container_model] if args.key?(:unmanaged_container_model)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @deployed_index_auth_config = args[:deployed_index_auth_config] if args.key?(:deployed_index_auth_config)\n @deployment_group = args[:deployment_group] if args.key?(:deployment_group)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_access_logging = args[:enable_access_logging] if args.key?(:enable_access_logging)\n @id = args[:id] if args.key?(:id)\n @index = args[:index] if args.key?(:index)\n @index_sync_time = args[:index_sync_time] if args.key?(:index_sync_time)\n @private_endpoints = args[:private_endpoints] if args.key?(:private_endpoints)\n @reserved_ip_ranges = args[:reserved_ip_ranges] if args.key?(:reserved_ip_ranges)\n end", "def update!(**args)\n @consumer_id = args[:consumer_id] if args.key?(:consumer_id)\n @end_time = args[:end_time] if args.key?(:end_time)\n @importance = args[:importance] if args.key?(:importance)\n @labels = args[:labels] if args.key?(:labels)\n @log_entries = args[:log_entries] if args.key?(:log_entries)\n @metric_value_sets = args[:metric_value_sets] if args.key?(:metric_value_sets)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @operation_name = args[:operation_name] if args.key?(:operation_name)\n @quota_properties = args[:quota_properties] if args.key?(:quota_properties)\n @resources = args[:resources] if args.key?(:resources)\n @start_time = args[:start_time] if args.key?(:start_time)\n @trace_spans = args[:trace_spans] if args.key?(:trace_spans)\n @user_labels = args[:user_labels] if args.key?(:user_labels)\n end", "def update!(**args)\n @api_signature = args[:api_signature] if args.key?(:api_signature)\n @example_stack_traces = args[:example_stack_traces] if args.key?(:example_stack_traces)\n @insights = args[:insights] if args.key?(:insights)\n @invocation_count = args[:invocation_count] if args.key?(:invocation_count)\n @list = args[:list] if args.key?(:list)\n end", "def update!(**args)\n @deployed_model_id = args[:deployed_model_id] if args.key?(:deployed_model_id)\n @explanation_spec_override = args[:explanation_spec_override] if args.key?(:explanation_spec_override)\n @instances = args[:instances] if args.key?(:instances)\n @parameters = args[:parameters] if args.key?(:parameters)\n end", "def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @module_id = args[:module_id] if args.key?(:module_id)\n @version_id = args[:version_id] if args.key?(:version_id)\n @request_id = args[:request_id] if args.key?(:request_id)\n @ip = args[:ip] if args.key?(:ip)\n @start_time = args[:start_time] if args.key?(:start_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @latency = args[:latency] if args.key?(:latency)\n @mega_cycles = args[:mega_cycles] if args.key?(:mega_cycles)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @resource = args[:resource] if args.key?(:resource)\n @http_version = args[:http_version] if args.key?(:http_version)\n @status = args[:status] if args.key?(:status)\n @response_size = args[:response_size] if args.key?(:response_size)\n @referrer = args[:referrer] if args.key?(:referrer)\n @user_agent = args[:user_agent] if args.key?(:user_agent)\n @nickname = args[:nickname] if args.key?(:nickname)\n @url_map_entry = args[:url_map_entry] if args.key?(:url_map_entry)\n @host = args[:host] if args.key?(:host)\n @cost = args[:cost] if args.key?(:cost)\n @task_queue_name = args[:task_queue_name] if args.key?(:task_queue_name)\n @task_name = args[:task_name] if args.key?(:task_name)\n @was_loading_request = args[:was_loading_request] if args.key?(:was_loading_request)\n @pending_time = args[:pending_time] if args.key?(:pending_time)\n @instance_index = args[:instance_index] if args.key?(:instance_index)\n @finished = args[:finished] if args.key?(:finished)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @line = args[:line] if args.key?(:line)\n @app_engine_release = args[:app_engine_release] if args.key?(:app_engine_release)\n @trace_id = args[:trace_id] if args.key?(:trace_id)\n @source_reference = args[:source_reference] if args.key?(:source_reference)\n end", "def update ; end", "def update!(**args)\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 @enable_private_service_connect = args[:enable_private_service_connect] if args.key?(:enable_private_service_connect)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @model_deployment_monitoring_job = args[:model_deployment_monitoring_job] if args.key?(:model_deployment_monitoring_job)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @predict_request_response_logging_config = args[:predict_request_response_logging_config] if args.key?(:predict_request_response_logging_config)\n @traffic_split = args[:traffic_split] if args.key?(:traffic_split)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @app_engine_http_target = args[:app_engine_http_target] if args.key?(:app_engine_http_target)\n @attempt_deadline = args[:attempt_deadline] if args.key?(:attempt_deadline)\n @description = args[:description] if args.key?(:description)\n @http_target = args[:http_target] if args.key?(:http_target)\n @last_attempt_time = args[:last_attempt_time] if args.key?(:last_attempt_time)\n @name = args[:name] if args.key?(:name)\n @pubsub_target = args[:pubsub_target] if args.key?(:pubsub_target)\n @retry_config = args[:retry_config] if args.key?(:retry_config)\n @schedule = args[:schedule] if args.key?(:schedule)\n @schedule_time = args[:schedule_time] if args.key?(:schedule_time)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @time_zone = args[:time_zone] if args.key?(:time_zone)\n @user_update_time = args[:user_update_time] if args.key?(:user_update_time)\n end", "def update\n \n end", "def update\n requires :identity, :settings_version, :tier\n\n data = service.update_instance(identity, settings_version, tier, settings)\n operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)\n operation.wait_for { ready? }\n reload\n end", "def update\n \n end", "def update!(**args)\n @clusters = args[:clusters] if args.key?(:clusters)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @parent = args[:parent] if args.key?(:parent)\n end", "def update!(**args)\n @clusters = args[:clusters] if args.key?(:clusters)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @parent = args[:parent] if args.key?(:parent)\n end", "def update() end", "def patch_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_patch_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def mte_prepare_updating; send_request_to_mite(\"update\"); end", "def internal_object_update(params)\n end", "def internal_object_update(params)\n end", "def update!(**args)\n @instance = args[:instance] if args.key?(:instance)\n @last_run_id = args[:last_run_id] if args.key?(:last_run_id)\n @name = args[:name] if args.key?(:name)\n @os_policy_assignment = args[:os_policy_assignment] if args.key?(:os_policy_assignment)\n @os_policy_compliances = args[:os_policy_compliances] if args.key?(:os_policy_compliances)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end", "def update!(**args)\n @autoscaling_metric_specs = args[:autoscaling_metric_specs] if args.key?(:autoscaling_metric_specs)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\n end", "def update!(**args)\n @info = args[:info] if args.key?(:info)\n @instance = args[:instance] if args.key?(:instance)\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 @dry_run = args[:dry_run] if args.key?(:dry_run)\n @duration = args[:duration] if args.key?(:duration)\n @error_message = args[:error_message] if args.key?(:error_message)\n @instance_details_summary = args[:instance_details_summary] if args.key?(:instance_details_summary)\n @instance_filter = args[:instance_filter] if args.key?(:instance_filter)\n @name = args[:name] if args.key?(:name)\n @patch_config = args[:patch_config] if args.key?(:patch_config)\n @patch_deployment = args[:patch_deployment] if args.key?(:patch_deployment)\n @percent_complete = args[:percent_complete] if args.key?(:percent_complete)\n @rollout = args[:rollout] if args.key?(:rollout)\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 @descriptiveness_output_key = args[:descriptiveness_output_key] if args.key?(:descriptiveness_output_key)\n @ensemble_model_names = args[:ensemble_model_names] if args.key?(:ensemble_model_names)\n @inference_batch_size = args[:inference_batch_size] if args.key?(:inference_batch_size)\n @inference_method = args[:inference_method] if args.key?(:inference_method)\n @max_rpc_retries = args[:max_rpc_retries] if args.key?(:max_rpc_retries)\n @model_name = args[:model_name] if args.key?(:model_name)\n @model_path = args[:model_path] if args.key?(:model_path)\n @output_key = args[:output_key] if args.key?(:output_key)\n @rpc_deadline_seconds = args[:rpc_deadline_seconds] if args.key?(:rpc_deadline_seconds)\n @service_bns = args[:service_bns] if args.key?(:service_bns)\n @usefulness_output_key = args[:usefulness_output_key] if args.key?(:usefulness_output_key)\n end", "def update\n update_all\n end", "def update!(**args)\n @error = args[:error] if args.key?(:error)\n @instance = args[:instance] if args.key?(:instance)\n @key = args[:key] if args.key?(:key)\n @prediction = args[:prediction] if args.key?(:prediction)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update!(**args)\n @abort = args[:abort] if args.key?(:abort)\n @app_engine_version = args[:app_engine_version] if args.key?(:app_engine_version)\n @causes_drop = args[:causes_drop] if args.key?(:causes_drop)\n @cloud_function = args[:cloud_function] if args.key?(:cloud_function)\n @cloud_run_revision = args[:cloud_run_revision] if args.key?(:cloud_run_revision)\n @cloud_sql_instance = args[:cloud_sql_instance] if args.key?(:cloud_sql_instance)\n @deliver = args[:deliver] if args.key?(:deliver)\n @description = args[:description] if args.key?(:description)\n @drop = args[:drop] if args.key?(:drop)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @firewall = args[:firewall] if args.key?(:firewall)\n @forward = args[:forward] if args.key?(:forward)\n @forwarding_rule = args[:forwarding_rule] if args.key?(:forwarding_rule)\n @gke_master = args[:gke_master] if args.key?(:gke_master)\n @google_service = args[:google_service] if args.key?(:google_service)\n @instance = args[:instance] if args.key?(:instance)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @network = args[:network] if args.key?(:network)\n @project_id = args[:project_id] if args.key?(:project_id)\n @route = args[:route] if args.key?(:route)\n @state = args[:state] if args.key?(:state)\n @vpc_connector = args[:vpc_connector] if args.key?(:vpc_connector)\n @vpn_gateway = args[:vpn_gateway] if args.key?(:vpn_gateway)\n @vpn_tunnel = args[:vpn_tunnel] if args.key?(:vpn_tunnel)\n end", "def update(params)\n self.class.new reinit_endpoint(params).do_put\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @anthos_cluster = args[:anthos_cluster] if args.key?(:anthos_cluster)\n @create_time = args[:create_time] if args.key?(:create_time)\n @deploy_parameters = args[:deploy_parameters] if args.key?(:deploy_parameters)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @execution_configs = args[:execution_configs] if args.key?(:execution_configs)\n @gke = args[:gke] if args.key?(:gke)\n @labels = args[:labels] if args.key?(:labels)\n @multi_target = args[:multi_target] if args.key?(:multi_target)\n @name = args[:name] if args.key?(:name)\n @require_approval = args[:require_approval] if args.key?(:require_approval)\n @run = args[:run] if args.key?(:run)\n @target_id = args[:target_id] if args.key?(:target_id)\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 @host = args[:host] if args.key?(:host)\n @instance = args[:instance] if args.key?(:instance)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @instance = args[:instance] if args.key?(:instance)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end", "def update(*args)\n each{|r| r.update(*args)}\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @config = args[:config] if args.key?(:config)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @etag = args[:etag] if args.key?(:etag)\n @name = args[:name] if args.key?(:name)\n @node_pool_autoscaling = args[:node_pool_autoscaling] if args.key?(:node_pool_autoscaling)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\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 @create_time = args[:create_time] if args.key?(:create_time)\n @deployed_indexes = args[:deployed_indexes] if args.key?(:deployed_indexes)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_private_service_connect = args[:enable_private_service_connect] if args.key?(:enable_private_service_connect)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @private_service_connect_config = args[:private_service_connect_config] if args.key?(:private_service_connect_config)\n @public_endpoint_domain_name = args[:public_endpoint_domain_name] if args.key?(:public_endpoint_domain_name)\n @public_endpoint_enabled = args[:public_endpoint_enabled] if args.key?(:public_endpoint_enabled)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @bad_ssl_certificate = args[:bad_ssl_certificate] if args.key?(:bad_ssl_certificate)\n @client_service_info = args[:client_service_info] if args.key?(:client_service_info)\n @compressed_body = args[:compressed_body] if args.key?(:compressed_body)\n @crawl_times = args[:crawl_times] if args.key?(:crawl_times)\n @dns_host = args[:dns_host] if args.key?(:dns_host)\n @download_time = args[:download_time] if args.key?(:download_time)\n @egress_region = args[:egress_region] if args.key?(:egress_region)\n @eligible_geo_crawl_egress_region = args[:eligible_geo_crawl_egress_region] if args.key?(:eligible_geo_crawl_egress_region)\n @endpoints = args[:endpoints] if args.key?(:endpoints)\n @events = args[:events] if args.key?(:events)\n @fetch_pattern_fp = args[:fetch_pattern_fp] if args.key?(:fetch_pattern_fp)\n @floo_egress_region = args[:floo_egress_region] if args.key?(:floo_egress_region)\n @geo_crawl_egress_region = args[:geo_crawl_egress_region] if args.key?(:geo_crawl_egress_region)\n @geo_crawl_fallback = args[:geo_crawl_fallback] if args.key?(:geo_crawl_fallback)\n @geo_crawl_location_attempted = args[:geo_crawl_location_attempted] if args.key?(:geo_crawl_location_attempted)\n @hsts_info = args[:hsts_info] if args.key?(:hsts_info)\n @http_trailers = args[:http_trailers] if args.key?(:http_trailers)\n @hop_cache_key_for_lookup = args[:hop_cache_key_for_lookup] if args.key?(:hop_cache_key_for_lookup)\n @hop_cache_key_for_update = args[:hop_cache_key_for_update] if args.key?(:hop_cache_key_for_update)\n @hop_reuse_info = args[:hop_reuse_info] if args.key?(:hop_reuse_info)\n @hop_robots_info = args[:hop_robots_info] if args.key?(:hop_robots_info)\n @host_bucket_data = args[:host_bucket_data] if args.key?(:host_bucket_data)\n @host_id = args[:host_id] if args.key?(:host_id)\n @http_protocol = args[:http_protocol] if args.key?(:http_protocol)\n @http_request_headers = args[:http_request_headers] if args.key?(:http_request_headers)\n @http_response_headers = args[:http_response_headers] if args.key?(:http_response_headers)\n @http_version = args[:http_version] if args.key?(:http_version)\n @id = args[:id] if args.key?(:id)\n @last_url_status = args[:last_url_status] if args.key?(:last_url_status)\n @policy_data = args[:policy_data] if args.key?(:policy_data)\n @post_data = args[:post_data] if args.key?(:post_data)\n @predicted_download_time_ms = args[:predicted_download_time_ms] if args.key?(:predicted_download_time_ms)\n @protocol_version_fallback = args[:protocol_version_fallback] if args.key?(:protocol_version_fallback)\n @redirect_source_fetch_id = args[:redirect_source_fetch_id] if args.key?(:redirect_source_fetch_id)\n @requestor_id = args[:requestor_id] if args.key?(:requestor_id)\n @requestor_ip_address_packed = args[:requestor_ip_address_packed] if args.key?(:requestor_ip_address_packed)\n @reuse_info = args[:reuse_info] if args.key?(:reuse_info)\n @robots_info = args[:robots_info] if args.key?(:robots_info)\n @robots_status = args[:robots_status] if args.key?(:robots_status)\n @robots_txt = args[:robots_txt] if args.key?(:robots_txt)\n @status = args[:status] if args.key?(:status)\n @throttle_client = args[:throttle_client] if args.key?(:throttle_client)\n @thrown_away_bytes = args[:thrown_away_bytes] if args.key?(:thrown_away_bytes)\n @timestamp_in_ms = args[:timestamp_in_ms] if args.key?(:timestamp_in_ms)\n @total_fetched_size = args[:total_fetched_size] if args.key?(:total_fetched_size)\n @transparent_rewrites = args[:transparent_rewrites] if args.key?(:transparent_rewrites)\n @trawler_private = args[:trawler_private] if args.key?(:trawler_private)\n @url = args[:url] if args.key?(:url)\n @url_encoding = args[:url_encoding] if args.key?(:url_encoding)\n @use_html_compress_dictionary = args[:use_html_compress_dictionary] if args.key?(:use_html_compress_dictionary)\n @crawldates = args[:crawldates] if args.key?(:crawldates)\n @delivery_report = args[:delivery_report] if args.key?(:delivery_report)\n @fetchstats = args[:fetchstats] if args.key?(:fetchstats)\n @original_protocol_url = args[:original_protocol_url] if args.key?(:original_protocol_url)\n @partialresponse = args[:partialresponse] if args.key?(:partialresponse)\n @protocolresponse = args[:protocolresponse] if args.key?(:protocolresponse)\n @redirects = args[:redirects] if args.key?(:redirects)\n @traffic_type = args[:traffic_type] if args.key?(:traffic_type)\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!(**args)\n @cloud_sql_instances = args[:cloud_sql_instances] if args.key?(:cloud_sql_instances)\n @gcs_buckets = args[:gcs_buckets] if args.key?(:gcs_buckets)\n @iam_policy_bindings = args[:iam_policy_bindings] if args.key?(:iam_policy_bindings)\n @infra_spanner_configs = args[:infra_spanner_configs] if args.key?(:infra_spanner_configs)\n @tag = args[:tag] if args.key?(:tag)\n @tenant_project_config = args[:tenant_project_config] if args.key?(:tenant_project_config)\n @tenant_project_id = args[:tenant_project_id] if args.key?(:tenant_project_id)\n @tenant_project_number = args[:tenant_project_number] if args.key?(:tenant_project_number)\n @tenant_service_accounts = args[:tenant_service_accounts] if args.key?(:tenant_service_accounts)\n end", "def update!(**args)\n @list_update_responses = args[:list_update_responses] if args.key?(:list_update_responses)\n @minimum_wait_duration = args[:minimum_wait_duration] if args.key?(:minimum_wait_duration)\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_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def update!(**args)\n @affected_services = args[:affected_services] if args.key?(:affected_services)\n @affected_users_count = args[:affected_users_count] if args.key?(:affected_users_count)\n @count = args[:count] if args.key?(:count)\n @first_seen_time = args[:first_seen_time] if args.key?(:first_seen_time)\n @group = args[:group] if args.key?(:group)\n @last_seen_time = args[:last_seen_time] if args.key?(:last_seen_time)\n @num_affected_services = args[:num_affected_services] if args.key?(:num_affected_services)\n @representative = args[:representative] if args.key?(:representative)\n @timed_counts = args[:timed_counts] if args.key?(:timed_counts)\n end", "def update!(**args)\n @deployed_model_refs = args[:deployed_model_refs] if args.key?(:deployed_model_refs)\n @deployed_models = args[:deployed_models] if args.key?(:deployed_models)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_deployed_model_count = args[:total_deployed_model_count] if args.key?(:total_deployed_model_count)\n @total_endpoint_count = args[:total_endpoint_count] if args.key?(:total_endpoint_count)\n end", "def post_updates\n reload if new_resource.updated_by_last_action? && new_resource.reload\n post_up(new_resource.post_up) unless new_resource.post_up.nil? || !new_resource.updated_by_last_action?\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @creation_time = args[:creation_time] if args.key?(:creation_time)\n @creator = args[:creator] if args.key?(:creator)\n @image_version = args[:image_version] if args.key?(:image_version)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @instance_preemption_notice_received = args[:instance_preemption_notice_received] if args.key?(:instance_preemption_notice_received)\n @os_release = args[:os_release] if args.key?(:os_release)\n @version = args[:version] if args.key?(:version)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update!(**args)\n @http_request = args[:http_request] if args.key?(:http_request)\n @insert_id = args[:insert_id] if args.key?(:insert_id)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @operation = args[:operation] if args.key?(:operation)\n @proto_payload = args[:proto_payload] if args.key?(:proto_payload)\n @severity = args[:severity] if args.key?(:severity)\n @source_location = args[:source_location] if args.key?(:source_location)\n @struct_payload = args[:struct_payload] if args.key?(:struct_payload)\n @text_payload = args[:text_payload] if args.key?(:text_payload)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @trace = args[:trace] if args.key?(:trace)\n end", "def update!(**args)\n @analysis_instance_schema_uri = args[:analysis_instance_schema_uri] if args.key?(:analysis_instance_schema_uri)\n @bigquery_tables = args[:bigquery_tables] if args.key?(:bigquery_tables)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_monitoring_pipeline_logs = args[:enable_monitoring_pipeline_logs] if args.key?(:enable_monitoring_pipeline_logs)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @error = args[:error] if args.key?(:error)\n @labels = args[:labels] if args.key?(:labels)\n @latest_monitoring_pipeline_metadata = args[:latest_monitoring_pipeline_metadata] if args.key?(:latest_monitoring_pipeline_metadata)\n @log_ttl = args[:log_ttl] if args.key?(:log_ttl)\n @logging_sampling_strategy = args[:logging_sampling_strategy] if args.key?(:logging_sampling_strategy)\n @model_deployment_monitoring_objective_configs = args[:model_deployment_monitoring_objective_configs] if args.key?(:model_deployment_monitoring_objective_configs)\n @model_deployment_monitoring_schedule_config = args[:model_deployment_monitoring_schedule_config] if args.key?(:model_deployment_monitoring_schedule_config)\n @model_monitoring_alert_config = args[:model_monitoring_alert_config] if args.key?(:model_monitoring_alert_config)\n @name = args[:name] if args.key?(:name)\n @next_schedule_time = args[:next_schedule_time] if args.key?(:next_schedule_time)\n @predict_instance_schema_uri = args[:predict_instance_schema_uri] if args.key?(:predict_instance_schema_uri)\n @sample_predict_instance = args[:sample_predict_instance] if args.key?(:sample_predict_instance)\n @schedule_state = args[:schedule_state] if args.key?(:schedule_state)\n @state = args[:state] if args.key?(:state)\n @stats_anomalies_base_directory = args[:stats_anomalies_base_directory] if args.key?(:stats_anomalies_base_directory)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @addon_node = args[:addon_node] if args.key?(:addon_node)\n @annotations = args[:annotations] if args.key?(:annotations)\n @anti_affinity_groups = args[:anti_affinity_groups] if args.key?(:anti_affinity_groups)\n @auto_repair_config = args[:auto_repair_config] if args.key?(:auto_repair_config)\n @bootstrap_cluster_membership = args[:bootstrap_cluster_membership] if args.key?(:bootstrap_cluster_membership)\n @control_plane_node = args[:control_plane_node] if args.key?(:control_plane_node)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @image_type = args[:image_type] if args.key?(:image_type)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @platform_config = args[:platform_config] if args.key?(:platform_config)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @vcenter = args[:vcenter] if args.key?(:vcenter)\n end", "def resource_update_applied(resource, action, update)\n @updates_by_resource[resource.name] << update\n end", "def update!(**args)\n @example_trace_messages = args[:example_trace_messages] if args.key?(:example_trace_messages)\n @matcher_id = args[:matcher_id] if args.key?(:matcher_id)\n @pending_google_update_insight = args[:pending_google_update_insight] if args.key?(:pending_google_update_insight)\n @upgrade_insight = args[:upgrade_insight] if args.key?(:upgrade_insight)\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @etag = args[:etag] if args.key?(:etag)\n @name = args[:name] if args.key?(:name)\n @node_pool_config = args[:node_pool_config] if args.key?(:node_pool_config)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @upgrade_policy = args[:upgrade_policy] if args.key?(:upgrade_policy)\n end", "def update\n metric.update_attributes(update_params)\n\n respond_with(metric)\n end", "def update!(**args)\n @baseline = args[:baseline] if args.key?(:baseline)\n @deleted = args[:deleted] if args.key?(:deleted)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @instance_filter = args[:instance_filter] if args.key?(:instance_filter)\n @name = args[:name] if args.key?(:name)\n @os_policies = args[:os_policies] if args.key?(:os_policies)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @revision_create_time = args[:revision_create_time] if args.key?(:revision_create_time)\n @revision_id = args[:revision_id] if args.key?(:revision_id)\n @rollout = args[:rollout] if args.key?(:rollout)\n @rollout_state = args[:rollout_state] if args.key?(:rollout_state)\n @uid = args[:uid] if args.key?(:uid)\n end", "def update!(**args)\n @backoff_retry_count = args[:backoff_retry_count] if args.key?(:backoff_retry_count)\n @id = args[:id] if args.key?(:id)\n @latest_err = args[:latest_err] if args.key?(:latest_err)\n @latest_retry_time = args[:latest_retry_time] if args.key?(:latest_retry_time)\n @total_retry_count = args[:total_retry_count] if args.key?(:total_retry_count)\n end", "def update \n items = changed_since(last_run)\n resources = []\n items.each do |item|\n resource = construct_resource(item)\n resource.populate\n resources << resource\n end\n return resources\n end", "def update!(**args)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_explanations = args[:disable_explanations] if args.key?(:disable_explanations)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_access_logging = args[:enable_access_logging] if args.key?(:enable_access_logging)\n @enable_container_logging = args[:enable_container_logging] if args.key?(:enable_container_logging)\n @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @id = args[:id] if args.key?(:id)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @private_endpoints = args[:private_endpoints] if args.key?(:private_endpoints)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shared_resources = args[:shared_resources] if args.key?(:shared_resources)\n end", "def update!(**args)\n @backup = args[:backup] if args.key?(:backup)\n @cluster = args[:cluster] if args.key?(:cluster)\n @complete_time = args[:complete_time] if args.key?(:complete_time)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @resources_excluded_count = args[:resources_excluded_count] if args.key?(:resources_excluded_count)\n @resources_failed_count = args[:resources_failed_count] if args.key?(:resources_failed_count)\n @resources_restored_count = args[:resources_restored_count] if args.key?(:resources_restored_count)\n @restore_config = args[:restore_config] if args.key?(:restore_config)\n @state = args[:state] if args.key?(:state)\n @state_reason = args[:state_reason] if args.key?(:state_reason)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @volumes_restored_count = args[:volumes_restored_count] if args.key?(:volumes_restored_count)\n end", "def update\n # Not generally used\n end", "def update\n # Not generally used\n end", "def update\r\n\r\n end", "def update!(**args)\n @duration_ms = args[:duration_ms] if args.key?(:duration_ms)\n @instances = args[:instances] if args.key?(:instances)\n @uploader_name = args[:uploader_name] if args.key?(:uploader_name)\n end", "def apply_updates(other)\n apply_updates_title(other.title)\n apply_updates_desc(other.descriptions[:default])\n apply_updates_impact(other.impact)\n apply_updates_tags(other)\n @control_string\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @conditions = args[:conditions] if args.key?(:conditions)\n @control_plane_ip = args[:control_plane_ip] if args.key?(:control_plane_ip)\n @create_time = args[:create_time] if args.key?(:create_time)\n @degraded = args[:degraded] if args.key?(:degraded)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @private_cluster_config = args[:private_cluster_config] if args.key?(:private_cluster_config)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update()\n end", "def update\r\n end", "def update!(**args)\n @client_operation_id = args[:client_operation_id] if args.key?(:client_operation_id)\n @creation_timestamp = args[:creation_timestamp] if args.key?(:creation_timestamp)\n @description = args[:description] if args.key?(:description)\n @end_time = args[:end_time] if args.key?(:end_time)\n @error = args[:error] if args.key?(:error)\n @http_error_message = args[:http_error_message] if args.key?(:http_error_message)\n @http_error_status_code = args[:http_error_status_code] if args.key?(:http_error_status_code)\n @id = args[:id] if args.key?(:id)\n @insert_time = args[:insert_time] if args.key?(:insert_time)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @operation_type = args[:operation_type] if args.key?(:operation_type)\n @progress = args[:progress] if args.key?(:progress)\n @region = args[:region] if args.key?(:region)\n @self_link = args[:self_link] if args.key?(:self_link)\n @start_time = args[:start_time] if args.key?(:start_time)\n @status = args[:status] if args.key?(:status)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target_id = args[:target_id] if args.key?(:target_id)\n @target_link = args[:target_link] if args.key?(:target_link)\n @user = args[:user] if args.key?(:user)\n @warnings = args[:warnings] if args.key?(:warnings)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update!(**args)\n @client_operation_id = args[:client_operation_id] if args.key?(:client_operation_id)\n @creation_timestamp = args[:creation_timestamp] if args.key?(:creation_timestamp)\n @description = args[:description] if args.key?(:description)\n @end_time = args[:end_time] if args.key?(:end_time)\n @error = args[:error] if args.key?(:error)\n @http_error_message = args[:http_error_message] if args.key?(:http_error_message)\n @http_error_status_code = args[:http_error_status_code] if args.key?(:http_error_status_code)\n @id = args[:id] if args.key?(:id)\n @insert_time = args[:insert_time] if args.key?(:insert_time)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @operation_type = args[:operation_type] if args.key?(:operation_type)\n @progress = args[:progress] if args.key?(:progress)\n @region = args[:region] if args.key?(:region)\n @self_link = args[:self_link] if args.key?(:self_link)\n @start_time = args[:start_time] if args.key?(:start_time)\n @status = args[:status] if args.key?(:status)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target_id = args[:target_id] if args.key?(:target_id)\n @target_link = args[:target_link] if args.key?(:target_link)\n @user = args[:user] if args.key?(:user)\n @warnings = args[:warnings] if args.key?(:warnings)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update!(**args)\n @api_method = args[:api_method] if args.key?(:api_method)\n @os_policy_assignment = args[:os_policy_assignment] if args.key?(:os_policy_assignment)\n @rollout_start_time = args[:rollout_start_time] if args.key?(:rollout_start_time)\n @rollout_state = args[:rollout_state] if args.key?(:rollout_state)\n @rollout_update_time = args[:rollout_update_time] if args.key?(:rollout_update_time)\n end", "def update!(**args)\n @api_method = args[:api_method] if args.key?(:api_method)\n @os_policy_assignment = args[:os_policy_assignment] if args.key?(:os_policy_assignment)\n @rollout_start_time = args[:rollout_start_time] if args.key?(:rollout_start_time)\n @rollout_state = args[:rollout_state] if args.key?(:rollout_state)\n @rollout_update_time = args[:rollout_update_time] if args.key?(:rollout_update_time)\n end" ]
[ "0.6883882", "0.68352866", "0.6265813", "0.62466383", "0.6238221", "0.6211436", "0.6211436", "0.6191201", "0.61702627", "0.6146737", "0.61356735", "0.6107843", "0.61044765", "0.60995483", "0.60612357", "0.5985783", "0.5940671", "0.5932814", "0.59143525", "0.59143525", "0.59143525", "0.59143525", "0.59143525", "0.59143525", "0.59143525", "0.59143525", "0.5912643", "0.5903732", "0.58810145", "0.5878936", "0.5878929", "0.58720773", "0.58541423", "0.585271", "0.58467364", "0.5822184", "0.5817666", "0.5801775", "0.5797685", "0.5797685", "0.57927465", "0.5785793", "0.57843715", "0.57794213", "0.57794213", "0.5778188", "0.57653916", "0.5762434", "0.5756851", "0.57532394", "0.5750007", "0.573833", "0.57306087", "0.57302666", "0.57275796", "0.5725523", "0.57147044", "0.5712184", "0.5712184", "0.5704396", "0.57006997", "0.5696729", "0.56845313", "0.5667229", "0.56665295", "0.5664104", "0.56515735", "0.5649318", "0.56405294", "0.5635255", "0.5628511", "0.5627174", "0.5627174", "0.5627174", "0.5627174", "0.5623229", "0.5623056", "0.5617389", "0.5616394", "0.5613064", "0.5601958", "0.55926913", "0.55918896", "0.5584199", "0.5582852", "0.5582686", "0.55776304", "0.55742484", "0.55722314", "0.55722314", "0.5568258", "0.5556012", "0.55466586", "0.55458385", "0.55438155", "0.55426604", "0.5540488", "0.5540488", "0.55400854", "0.55400854" ]
0.774701
0
Baseline implementation for the create_instances REST call
def create_instances request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_create_instances_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_instances(count)\n fail DTK::Error::Usage, \"Attribute 'admin_state' cannot be set to powered_off if node not created\" if admin_state_powered_off?\n aws_api_operation(:create).create_instances(count)\n end", "def list_instances\n puts \"OK, Listing instances..\"\n\n response = RestClient.post( \n $uri,\n 'Version' => '2010-12-30',\n 'ACSAccessKeyId' => $ACSAccessKeyId,\n 'Format' => 'json',\n 'Timestamp' => $current_time,\n 'Rndguid' => $rndguid,\n 'Signature' => calculate_signature($api_private_key, $rndguid, $current_time),\n 'Action' => \"list-instances\")\n\n puts response\n puts response.code\nend", "def create_instances(count)\n result = client.run_instances(AwsForm.map(params.merge(count: count)))\n instance_ids = result.instances.map(&:instance_id)\n ret = wait_for_create(instance_ids)\n # need to make sure add_tags is done after after wait_until or can have error that instance ids dont exist\n add_tags?(instance_ids, with_dtk_tag: true)\n IamInstanceProfile.set_iam_instance_profiles(self, instance_ids, params.iam_instance_profile) unless params.iam_instance_profile.nil?\n ret\n end", "def create\n @instance = @provider.instances.new(params[:instance])\n @instance.state = \"Building\"\n respond_to do |format|\n if @instance.save\n @instance.create_instance(@provider.connect!)\n format.html { redirect_to cloud_provider_instance_path(@provider,@instance), notice: 'Instance was successfully created.' }\n format.json { render json: @instance, status: :created, location: @instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def run\n super\n\n # Get the AWS Credentials\n aws_keys = get_aws_keys_from_entity_type(_get_entity_type_string)\n return unless aws_keys.access_key && aws_keys.secret_key\n\n return unless aws_keys_valid?(aws_keys.access_key, aws_keys.secret_key, aws_keys.session_token)\n\n regions = retrieve_region_list\n instance_collection = regions.map do |r|\n retrieve_instances(r, aws_keys.access_key, aws_keys.secret_key, aws_keys.session_token)\n end\n\n instance_collection.compact!\n return if instance_collection.size.zero?\n\n create_ec2_instances(instance_collection)\n end", "def recreate_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_recreate_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n run_result = JSON.parse(make_call(request, uri))\n Djinn.log_debug(\"[IM] Run instances info says [#{run_result}]\")\n operation_id = run_result['operation_id']\n\n vm_info = {}\n loop {\n begin\n describe_result = describe_operation(operation_id)\n rescue Djinn::FailedNodeException => error\n Djinn.log_warn(\n \"[IM] Error describing run instances operation #{operation_id}. \" \\\n \"Error: #{error.message}\")\n next\n end\n Djinn.log_debug(\"[IM] Describe run operation has vm_info \" \\\n \"#{describe_result['vm_info'].inspect}.\")\n\n if describe_result['state'] == 'success'\n vm_info = describe_result['vm_info']\n break\n elsif describe_result['state'] == 'failed'\n raise AppScaleException.new(describe_result['reason'])\n end\n Kernel.sleep(SMALL_WAIT)\n }\n\n # ip:role:instance-id\n instances_created = []\n vm_info['public_ips'].each_index { |index|\n tmp_roles = roles[index]\n tmp_roles = 'open' if roles[index].nil?\n instances_created << {\n 'public_ip' => vm_info['public_ips'][index],\n 'private_ip' => vm_info['private_ips'][index],\n 'roles' => tmp_roles,\n 'instance_id' => vm_info['instance_ids'][index],\n 'disk' => disks[index],\n 'instance_type' => options['instance_type']\n }\n }\n\n instances_created\n end", "def create_instance(credentials, image_id, opts)\n new_vapp = nil\n vapp_opts = {} #assemble options to pass to Fog::Terremark::Real.instantiate_vapp_template\n terremark_hwp = hardware_profiles(credentials, {:name => 'default'}).first #sanity check values against default\n name = opts[:name]\n if not name\n name = \"inst#{Time.now.to_i}\"\n end\n if name.length > USER_NAME_MAX\n raise \"Parameter name must be #{USER_NAME_MAX} characters or less\"\n end\n unless ( (terremark_hwp.include?(:cpu, opts[:hwp_cpu].to_i)) &&\n (terremark_hwp.include?(:memory, opts[:hwp_memory].to_i)) ) then\n raise Deltacloud::Exceptions::ValidationFailure.new(\n StandardError.new(\"Error with cpu and/or memory values. you said cpu->#{opts[:hwp_cpu]} and mem->#{opts[:hwp_memory]}\")\n )\n end\n vapp_opts['cpus'] = opts[:hwp_cpu]\n vapp_opts['memory'] = opts[:hwp_memory]\n safely do\n terremark_client = new_client(credentials)\n#######\n#FIXME# what happens if there is an issue getting the new vapp id? (eg even though created succesfully)\n#######\n vapp_id = terremark_client.instantiate_vapp_template(name, image_id, vapp_opts).body['href'].split('/').last\n new_vapp = terremark_client.get_vapp(vapp_id)\n return convert_instance(new_vapp, terremark_client, credentials.user) #return an Instance object\n end\n end", "def create(resources)\n created = 0\n resources.each do |resource|\n model = resource.model\n serial = model.serial\n class_name = class_name(model)\n @log.debug(\"About to create #{model} backed by #{class_name} using #{resource.attributes}\")\n\n begin\n create_url = build_create_url(class_name)\n page = @agent.get(create_url) \n form_id = build_form_id(class_name.to_sym, :create_form_id)\n the_form = page.form_with(:id => form_id)\n the_properties = resource.attributes(key_on=:field).reject{|p,v| v.nil? }\n create_form = fill_form(the_form, the_properties, class_name)\n @log.debug(\"Create form is #{create_form.inspect}\")\n response = @agent.submit(create_form)\n @log.debug(\"Result of actual create call is #{response.code}\")\n if response.code.to_i == 302\n redirect_location = response.header['location']\n @log.debug(\"Redirect location is #{redirect_location}\")\n id = redirect_location.split('/').last.to_i #TODO: proper cast\n @log.debug(\"Newly created instance id is #{id}\")\n unless id.nil?\n serial.set(resource,id)\n created += 1\n end\n end\n rescue => e\n trace = e.backtrace.join(\"\\n\")\n @log.error(\"Failed to create resource: #{e.message}\") \n @log.error(trace) \n end\n end\n created\n end", "def create_servers\n # use \"rsc\" tool to get detailed deployment + server view from api 1.6, not supported by right_api_client\n old_deployment = JSON.parse(`rsc -a #{@options[:src]} cm16 show /api/deployments/#{@options[:deployment]} view=full`)\n\n old_deployment['servers'].each do |server|\n @api.account_id = @options[:src]\n name = server['next_instance']['name']\n\n puts \"Creating server: #{name} ...\\n\"\n\n cloud = find_cloud(server['next_instance']['links']['cloud']['href'], name)\n @api.account_id = @options[:src]\n\n ssh_key = choose_ssh_key(cloud)\n @api.account_id = @options[:src]\n\n instance_type = choose_instance_type(cloud)\n old_st_url = server['next_instance']['server_template']['href']\n new_st_url = @server_templates[old_st_url]['new_st_url']\n \n mci = choose_mci(new_st_url)\n @api.account_id = @options[:src]\n\n subnets = choose_subnets(cloud)\n @api.account_id = @options[:src]\n\n security_groups = choose_security_groups(cloud)\n @api.account_id = @options[:src]\n\n inputs_hash = format_inputs(@api.resource(server['next_instance']['href']).show.inputs)\n\n # Create server\n params = {}\n params[:server] = {}\n params[:server][:name] = name\n params[:server][:deployment_href] = @new_deployment\n params[:server][:instance] = {}\n params[:server][:instance][:cloud_href] = cloud\n params[:server][:instance][:server_template_href] = new_st_url\n params[:server][:instance][:ssh_key_href] = ssh_key if ssh_key\n params[:server][:instance][:instance_type_href] = instance_type\n params[:server][:instance][:multi_cloud_image_href] = mci\n params[:server][:instance][:subnet_hrefs] = subnets if subnets\n params[:server][:instance][:security_group_hrefs] = security_groups\n params[:server][:instance][:inputs] = inputs_hash\n @api.account_id = @options[:dst]\n @api.servers.create(params)\n end\nend", "def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end", "def create\n @instance = Instance.new(params[:instance])\n\n respond_to do |format|\n if @instance.save\n\n system(\"ssh root@#{CloudGui::Application.config.hypervisor_ip} \\\"exec /data/cloud/scripts/provision.sh #{params[:instance][:cpus]} #{params[:instance][:memory]} #{params[:instance][:baseimage]} 2>&1 | tee /data/cloud/logs/cloud_gui.log\\\"\")\n\n format.html { redirect_to @instance, notice: 'Instance was successfully created.' }\n format.json { render json: @instance, status: :created, location: @instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def create_resource\n # response = ec2.run_instances(\n # node_config(max_count: 1, self.to_h)\n # ).instances.first\n\n instance_attr_accessor response\n # id = @response[:instance_id]\n begin\n ec2.wait_until(:instance_running, instance_ids: [id]) do\n logger.info \"waiting for #{ids.count} Neurons to start...\"\n end\n rescue Aws::Waiters::Errors::WaiterFailed => e\n # TODO: retry stuff\n # redo unless (count += 1 <=3 )\n end\n\n yield self if block_given?\n self\n end", "def save(*args, &block)\n super\n # begin\n # require 'restclient'\n # server[\"/instances/#{instance_id}\"].put(to_json)\n # rescue Exception => e\n # Metavirt::Log.error \"cloudkit fail:\\n\\t#{e.inspect}\"\n # end\n self\n end", "def create\n \n end", "def create(resources)\n raise NotImplementedError, \"#{self.class}#create not implemented\"\n end", "def create_instances\n min_count = max_count = @bs.number_of_nodes\n puts \"\\nCreating #{max_count} on-demand instance(s)\"\n options = {\n 'ClientToken' => generate_token,\n 'KeyName' => Chef::Config[:knife][:aws_ssh_key_id],\n 'InstanceType' => @bs.flavor,\n 'SubnetId' => @bs[:novpc] ? nil : @bs.subnet_id,\n 'Placement.AvailabilityZone' => @bs.mixins.az.data,\n 'SecurityGroupId' => @bs.mixins.sg.data\n }\n options['EbsOptimized'] = !! @bs[:ebs_optimized]\n\n ## REVIEW\n if ami.root_device_type == \"ebs\"\n ami_map = ami.block_device_mapping.first\n block_device_mapping = {\n 'DeviceName' => ami_map['deviceName'],\n 'Ebs.VolumeSize' => ami_map['volumeSize'].to_s,\n 'Ebs.DeleteOnTermination' => ami_map['deleteOnTermination']\n }\n options['BlockDeviceMapping'] = [block_device_mapping]\n end\n\n ## Optionally only include mapped devices\n ## This way we get all of the ephemeral drives, some unmapped however\n if @bs.mixins.volume.data[:ephemeral_available]\n ephmap = @bs.mixins.volume.data.ephemeral_available.each_with_index.map do |d,i|\n {\n 'VirtualName' => \"ephemeral#{i}\",\n 'DeviceName' => d\n }\n end\n options['BlockDeviceMapping'].concat( ephmap )\n end\n\n if (max_count == 1) and @bs[:private_ip_address]\n options['PrivateIpAddress'] = @bs.private_ip_address\n puts \"Assigning IP ADDRESS : #{options['PrivateIpAddress']}\"\n end\n\n if Chef::Config[:knife][:aws_user_data]\n begin\n options['UserData']= File.read(Chef::Config[:knife][:aws_user_data])\n rescue\n ui.warn(\"Cannot read #{Chef::Config[:knife][:aws_user_data]}:\"\\\n \" #{$!.inspect}. Ignoring option.\")\n end\n end\n\n # -----------------------------------------------------------------\n tries = 5\n print_table(options, 'Launch Config')\n begin\n puts \"\\nSending request...\"\n response = connection.run_instances(@bs.image, min_count,\n max_count, options)\n ui.msg(response.inspect)\n rescue Exception => e\n ui.warn(\"#{e.message}\\nException creating instances\")\n if (tries -= 1) <= 0\n ui.warn(\"\\n\\nMax tries reached. Exiting.\\n\\n\")\n exit 1\n else\n ui.msg(\"Trying again.\\n\")\n retry\n end\n end\n # now we have our servers\n instances = response.body['instancesSet']\n # select only instances that have instanceId key and collect those ids\n # into an array\n @bs[:instance_ids] =\n instances.select {|i| i.has_key?('instanceId')}.collect do |i|\n i['instanceId']\n end\n\n puts \"\\nNumber of instances started: #{@bs.instance_ids.size}\\n\"\n sleep 10\n puts \"Getting servers..\"\n # collect an array of servers retrieved based on the instance ids we\n # obtained above\n @bs[:servers] = @bs.instance_ids.collect do |id|\n begin\n server = connection.servers.get(id)\n rescue Exception => e\n sleep 7\n retry\n end\n raise Ec2Error.new(\"server #{id} was nil\") if server.nil?\n server\n end\n end", "def create; end", "def create; end", "def create; end", "def create; end", "def post_compute(request)\n # --- Create the new Instance ---\n vm = VirtualMachineOCCI.new(\n VirtualMachine.build_xml,\n @client,\n request.body.read,\n @config[:instance_types],\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = vm.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = vm.allocate(template)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n vm.info\n return to_occi_xml(vm, :code=>201)\n end", "def create(_instance)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end", "def create\r\n\r\n\r\n end", "def create\n event = Connection::Events::Create.from_jsonapi(params, self)\n result = event.handle\n render_resource_created_event result[:validation], result[:result]\n end", "def create\n @instance = Instance.new(instance_params)\n\n respond_to do |format|\n if @instance.save\n format.html { redirect_to @instance, notice: 'Instance was successfully created.' }\n format.json { render :show, status: :created, location: @instance }\n else\n format.html { render :new }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_instance_request(instance, opts = {})\n uris = {}\n uris[\"uris\"] = \"973694b07429d91edf8203559a234ae8.192.168.12.34.xip.io\"\n # uuid = \n # arr = Array.new\n json = {\"uris\" => [\"973694b07429d91edf8203559a234ae8.192.168.12.34.xip.io\"]}\n { \"dea\" => \"bootstrap.uuid\",\n \"app\" => \"instance.application_id\",\n \"uris\" => json[\"uris\"],\n \"host\" => \"192.168.12.34\",\n \"port\" => 61015,\n \"tags\" => { \"component\" => \"dea-{bootstrap.config}\" },\n \"private_instance_id\" => \"84ef1bb842d65eff893fbb1a59723ffa5ebe87b5e0db6de830299d05c4b5d664\",\n }\n end", "def create_instance(security_groups, key, user_data, size, region)\n @instances = nil\n Instance.new(@@ec2.run_instances(id, 1, 1, security_groups, key, user_data, nil, size, nil, nil, region).first)\n end", "def aws_instance_create(opts)\n AWS::EC2::InstanceCollection.new.create(\n image_id: Rails.configuration.x.aws[Rails.configuration.x.aws['region']][\"ami_#{self.os}\"], \n private_ip_address: self.ip_address,\n key_name: Rails.configuration.x.aws['ec2_key_pair_name'],\n user_data: self.generate_init,\n instance_type: \"t2.small\",\n subnet: self.subnet.driver_id\n )\n end", "def make_fake_instances\n return unless Fog.mock?\n\n asg_instances = []\n all_instances = []\n min_size.times do |n|\n instance_id = Fog::AWS::Mock.instance_id\n asg_instances << {\n 'AvailabilityZone' => availability_zones,\n 'HealthStatus' => 'Good',\n 'InstanceId' => instance_id,\n 'LifecycleState' => 'Pending',\n 'LaunchConfigurationName' => launch_configuration.aws_identifier\n }\n\n all_instances << {\n 'amiLaunchIndex' => n,\n 'architecture' => 'i386',\n 'blockDeviceMapping' => [],\n 'clientToken' => 'FAKE_CLIENT_TOKEN',\n 'dnsName' => 'not-a-real-hostname',\n 'ebsOptimized' => false,\n 'hypervisor' => 'xen',\n 'imageId' => launch_configuration.ami,\n 'instanceId' => instance_id,\n 'instanceState' => { 'code' => 0, 'name' => 'not pending?' },\n 'instanceType' => launch_configuration.instance_type,\n 'kernelId' => launch_configuration.kernel_id || Fog::AWS::Mock.kernel_id,\n 'keyName' => launch_configuration.key_name,\n 'launchTime' => Time.now,\n 'monitoring' => { 'state' => false },\n 'placement' => { 'availabilityZone' => availability_zones,\n 'groupName' => self.aws_identifier,\n 'tenancy' => 'default' },\n 'privateDnsName' => nil,\n 'productCodes' => [],\n 'reason' => nil,\n 'rootDeviceType' => 'instance-store',\n 'virtualizationType' => 'paravirtual',\n 'groupIds' => [],\n 'groupSet' => launch_configuration.security_groups,\n 'iamInstanceProfile' => launch_configuration.iam_role,\n 'networkInterfaces' => [],\n 'ownerId' => nil,\n 'privateIpAddress' => nil,\n 'reservationId' => Fog::AWS::Mock.reservation_id,\n 'stateReason' => {},\n 'ipAddress' => Fog::AWS::Mock.ip_address,\n 'privateIpAddress' => Fog::AWS::Mock.private_ip_address\n }\n end\n Aerosol::AWS.auto_scaling.data[:auto_scaling_groups][aws_identifier]\n .merge!('Instances' => asg_instances)\n all_instances.each do |instance|\n Aerosol::AWS.compute.data[:instances][instance['instanceId']] = instance\n end\n end", "def create(*args)\n raise NotImplementedError, 'Implement a method to create the resource.'\n end", "def create_instance\n create_instances(1).first\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def create\n make_create_request\n end", "def create\n \n end", "def put_instance(opts)\n opts = check_params(opts,[:instances])\n super(opts)\n end", "def instances(arg)\n case arg\n when Range\n minimum_instances arg.first\n maximum_instances arg.last\n when Fixnum\n minimum_instances arg\n maximum_instances arg\n when Hash\n nodes(arg)\n else\n raise SpecException.new(\"Don't know how to handle instances cloud input #{arg}\")\n end\n end", "def create(params={})\n raise '`create` method is not supported for this resource.'\n end", "def create(params={})\n raise '`create` method is not supported for this resource.'\n end", "def create(params={})\n raise '`create` method is not supported for this resource.'\n end", "def create(params={})\n raise '`create` method is not supported for this resource.'\n end", "def request_launch_new_instances(num=1)\n out = []\n num.times {out << launch_new_instance!}\n out\n end", "def create\n @instance_eni = InstanceEni.new(instance_eni_params)\n\n respond_to do |format|\n if @instance_eni.save\n format.html { redirect_to @instance_eni, notice: 'Instance eni was successfully created.' }\n format.json { render :show, status: :created, location: @instance_eni }\n else\n format.html { render :new }\n format.json { render json: @instance_eni.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n end", "def create\n # TODO: implement create\n end", "def start_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = {}\n params.merge!(pathlist(\"InstanceId\", options[:instance_id]))\n return response_generator(:action => \"StartInstances\", :params => params)\n end", "def create\n \t\n end", "def post\n \"\n desc 'create #{resource.singularize}' do\n tags %w[#{resource.singularize}]\n end\n params do\n # TODO: specify the parameters\n end\n post do\n # your code goes here\n end\"\n end", "def createEc2Instance\n\n instance_descriptor = {\n :image_id => @config[\"image_id\"],\n :key_name => @deploy.ssh_key_name,\n :instance_type => @config[\"size\"],\n :disable_api_termination => true,\n :min_count => 1,\n :max_count => 1\n }\n\n instance_descriptor[:iam_instance_profile] = getIAMProfile\n\n security_groups = myFirewallRules.map { |fw| fw.cloud_id }\n if security_groups.size > 0\n instance_descriptor[:security_group_ids] = security_groups\n else\n raise MuError, \"Didn't get any security groups assigned to be in #{@mu_name}, that shouldn't happen\"\n end\n\n if @config['private_ip']\n instance_descriptor[:private_ip_address] = @config['private_ip']\n end\n\n if !@vpc.nil? and @config.has_key?(\"vpc\")\n subnet = mySubnets.sample\n if subnet.nil?\n raise MuError, \"Got null subnet id out of #{@config['vpc']}\"\n end\n MU.log \"Deploying #{@mu_name} into VPC #{@vpc.cloud_id} Subnet #{subnet.cloud_id}\"\n allowBastionAccess\n instance_descriptor[:subnet_id] = subnet.cloud_id\n end\n\n if !@userdata.nil? and !@userdata.empty?\n instance_descriptor[:user_data] = Base64.encode64(@userdata)\n end\n\n MU::Cloud::AWS::Server.waitForAMI(@config[\"image_id\"], region: @region, credentials: @credentials)\n\n instance_descriptor[:block_device_mappings] = MU::Cloud::AWS::Server.configureBlockDevices(image_id: @config[\"image_id\"], storage: @config['storage'], region: @region, credentials: @credentials)\n\n instance_descriptor[:monitoring] = {enabled: @config['monitoring']}\n\n if @tags and @tags.size > 0\n instance_descriptor[:tag_specifications] = [{\n :resource_type => \"instance\",\n :tags => @tags.keys.map { |k|\n { :key => k, :value => @tags[k] }\n }\n }]\n end\n\n MU.log \"Creating EC2 instance #{@mu_name}\", details: instance_descriptor\n\n instance = resp = nil\n loop_if = Proc.new {\n instance = resp.instances.first if resp and resp.instances\n resp.nil? or resp.instances.nil? or instance.nil?\n }\n\n bad_subnets = []\n mysubnet_ids = if mySubnets\n mySubnets.map { |s| s.cloud_id }\n end\n begin\n MU.retrier([Aws::EC2::Errors::InvalidGroupNotFound, Aws::EC2::Errors::InvalidSubnetIDNotFound, Aws::EC2::Errors::InvalidParameterValue], loop_if: loop_if, loop_msg: \"Waiting for run_instances to return #{@mu_name}\") {\n resp = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).run_instances(instance_descriptor)\n }\n rescue Aws::EC2::Errors::Unsupported => e\n bad_subnets << instance_descriptor[:subnet_id]\n better_subnet = (mysubnet_ids - bad_subnets).sample\n if e.message !~ /is not supported in your requested Availability Zone/ and\n (mysubnet_ids.nil? or mysubnet_ids.empty? or\n mysubnet_ids.size == bad_subnets.size or\n better_subnet.nil? or better_subnet == \"\")\n raise MuError.new e.message, details: mysubnet_ids\n end\n instance_descriptor[:subnet_id] = (mysubnet_ids - bad_subnets).sample\n if instance_descriptor[:subnet_id].nil?\n raise MuError.new \"Specified subnet#{bad_subnets.size > 1 ? \"s do\" : \" does\"} not support instance type #{instance_descriptor[:instance_type]}\", details: bad_subnets\n end\n MU.log \"One or more subnets does not support instance type #{instance_descriptor[:instance_type]}, attempting with #{instance_descriptor[:subnet_id]} instead\", MU::WARN, details: bad_subnets\n retry\n rescue Aws::EC2::Errors::InvalidRequest => e\n MU.log e.message, MU::ERR, details: instance_descriptor\n raise e\n end\n\n MU.log \"#{@mu_name} (#{instance.instance_id}) coming online\"\n\n instance\n end", "def create\n @instance = Instance.new(params[:instance])\n\n respond_to do |format|\n if @instance.save\n format.html { redirect_to(@instance, :notice => 'Instance was successfully created.') }\n format.xml { render :xml => @instance, :status => :created, :location => @instance }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @instance.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_network(request)\n # --- Create the new Instance ---\n network = VirtualNetworkOCCI.new(\n VirtualNetwork.build_xml,\n @client,\n request.body,\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = network.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = network.allocate(template, @config[:cluster_id]||ClusterPool::NONE_CLUSTER_ID)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n network.info\n return to_occi_xml(network, :code=>201)\n end", "def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "def index\n\n credentials = Aws::Credentials.new('AKIAJ2JD2EKKFVDSR37A', 'cnZUnzuyYPqUevEPb045VJUnW55VR+rUCQrplzd/')\n ec2 = Aws::EC2::Client.new(\n region: \"us-east-1\",\n credentials: credentials\n )\n #i = ec2.instances.create(:image_id => \"ami-e3106686\")\n resp = ec2.run_instances({\n dry_run: true,\n image_id: \"ami-e3106686\", # required\n min_count: 1, # required\n max_count: 1, # required\n instance_type: \"t1.micro\", # accepts t1.micro, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, t2.micro, t2.small, t2.medium, t2.large, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, cg1.4xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge\n placement: {\n tenancy: \"default\", # accepts default, dedicated\n },\n\n block_device_mappings: [\n {\n virtual_name: \"String\",\n device_name: \"String\",\n ebs: {\n snapshot_id: \"String\",\n volume_size: 1,\n delete_on_termination: true,\n volume_type: \"standard\", # accepts standard, io1, gp2\n iops: 1,\n encrypted: true,\n },\n\n },\n ],\n monitoring: {\n enabled: true, # required\n },\n disable_api_termination: true,\n instance_initiated_shutdown_behavior: \"stop\", # accepts stop, terminate\n network_interfaces: [\n {\n delete_on_termination: true,\n private_ip_addresses: [\n {\n private_ip_address: \"172.31.2.177\", # required\n primary: true,\n },\n ],\n secondary_private_ip_address_count: 1,\n associate_public_ip_address: true,\n },\n ],\n ebs_optimized: true,\n })\n @ec2_instances = Ec2Instance.all\n end", "def create # rubocop:disable Metrics/AbcSize\n inst_details = AttrFinder.new(@instanceparameters)\n inst_details.options = @options\n inst_details.validate = @validate\n inst_details.function = 'server'\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::Models::LaunchInstanceDetails.new\n ssh_public_key = @instanceparameters['server']['ssh-key']\n request.availability_domain = inst_details.ad\n request.compartment_id = inst_details.compartment\n request.display_name = @instanceparameters['server']['display_name']\n request.image_id = inst_details.image\n request.shape = @instanceparameters['server']['shape']\n request.subnet_id = inst_details.subnet\n request.metadata = { 'ssh_authorized_keys' => ssh_public_key }\n api = OracleBMC::Core::ComputeClient.new\n response = api.launch_instance(request)\n @instance_id = response.data.id\n compartment(inst_details.compartment)\n running_instance = api.get_instance(@instance_id).wait_until(:lifecycle_state,\n OracleBMC::Core::Models::Instance::LIFECYCLE_STATE_RUNNING,\n max_interval_seconds: 5, max_wait_seconds: 300)\n if @instanceparameters['server']['attachments']\n @instanceparameters['server']['attachments'].each do |vol|\n attach(@instance_id, vol['volume'])\n end\n end\n running_instance\n end", "def create_d_b_instance(client_token, d_b_instance_class, d_b_instance_net_type, d_b_instance_storage, engine, engine_version, pay_type, security_i_p_list, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateDBInstance'\n\t\targs[:query]['ClientToken'] = client_token\n\t\targs[:query]['DBInstanceClass'] = d_b_instance_class\n\t\targs[:query]['DBInstanceNetType'] = d_b_instance_net_type\n\t\targs[:query]['DBInstanceStorage'] = d_b_instance_storage\n\t\targs[:query]['Engine'] = engine\n\t\targs[:query]['EngineVersion'] = engine_version\n\t\targs[:query]['PayType'] = pay_type\n\t\targs[:query]['SecurityIPList'] = security_i_p_list\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :connection_mode\n\t\t\targs[:query]['ConnectionMode'] = optional[:connection_mode]\n\t\tend\n\t\tif optional.key? :d_b_instance_description\n\t\t\targs[:query]['DBInstanceDescription'] = optional[:d_b_instance_description]\n\t\tend\n\t\tif optional.key? :instance_network_type\n\t\t\targs[:query]['InstanceNetworkType'] = optional[:instance_network_type]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :private_ip_address\n\t\t\targs[:query]['PrivateIpAddress'] = optional[:private_ip_address]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :system_d_b_charset\n\t\t\targs[:query]['SystemDBCharset'] = optional[:system_d_b_charset]\n\t\tend\n\t\tif optional.key? :v_p_c_id\n\t\t\targs[:query]['VPCId'] = optional[:v_p_c_id]\n\t\tend\n\t\tif optional.key? :v_switch_id\n\t\t\targs[:query]['VSwitchId'] = optional[:v_switch_id]\n\t\tend\n\t\tif optional.key? :zone_id\n\t\t\targs[:query]['ZoneId'] = optional[:zone_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def create_resources(operator)\n iterate(operator.state) do |model, attrs|\n obj = model.new(name: attrs[:tags][:Name], # , instance_id: attrs[:id],\n # ami: attrs[:ami], public_ip: attrs[:public_ip], arn: attrs[:arn],\n config: attrs,\n provider: Provider.first, runtime: Runtime.first,\n provider_name: Provider.first.name, runtime_name: Runtime.first.name,\n )\n if obj.valid?\n obj.save\n else\n Cnfs.logger.warn(obj.errors)\n end\n # binding.pry\n end\n end", "def create\n raise NotImplementedError\n end", "def create\n raise NotImplementedError\n end", "def add_new_instances(count)\n Output.new(current_instances + parent.create_instances(count), []) \n end", "def create\n resource = model_class.new(permitted_resource_params)\n ensure_current_store(resource)\n\n if resource.save\n render_serialized_payload(201) { serialize_resource(resource) }\n else\n render_error_payload(resource.errors)\n end\n end", "def create\n @instance = Instance.new(instance_params)\n\n #respond_to do |format|\n if @instance.save\n #format.html { redirect_to @instance, notice: 'Instance was successfully created.' }\n #format.json { render :show, status: :created, location: @instance }\n\t@response = { :message => \"Instance successfully created.\"}\n\trender :json => @response \n else\n #format.html { render :new }\n render :json => @instance.errors\n end\n #end\n end", "def safe_create_instances!(nodes)\n nodes = nodes.select { |k, v| k if v[:fqdn].empty? }\n begin\n case @provider\n when 'aws'\n nodes = create_aws_instances(nodes, @credentials, @thread_pool_size)\n when 'rackspace'\n nodes = create_rackspace_instances(nodes, @credentials, @thread_pool_size)\n when 'openstack'\n nodes = create_openstack_instances(nodes, @credentials, @thread_pool_size)\n else\n # Not yet implemented\n end\n rescue RuntimeError => ex\n @log.error \"Something went wrong provisioning vms on cloud, reason: #{ex}\"\n @log.error 'Rolling back instance(s)'\n delete_instances(nodes, true)\n exit 1\n end\n nodes\n end", "def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end", "def create\n #@instance = Instance.new(params[:instance])\n\n respond_to do |format|\n if @instance.save\n format.html { redirect_to @instance, notice: '创建成功' }\n format.json { render json: @instance, status: :created, location: @instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_pvm_instance(instance_hash)\n post(\"cloud-instances/#{guid}/pvm-instances\", instance_hash.to_json)\n end", "def create\n end", "def create\n end", "def create\n end", "def create\n end", "def start_and_create_instances(num=1, user_data=nil)\n logger.info \"ENTERING DELAYED JOB\"\n begin\n new_instances = run_spot_instances(num, user_data)\n new_instances.each do |i|\n temp = Instance.create_from_aws_hash(i)\n temp.user_data = user_data\n temp.state = 'launched'\n temp.save\n end\n logger.info \"Started and saved #{num} #{ami_id} instances.\"\n EventLog.info \"Started and saved #{num} #{ami_id} instances.\"\n rescue Exception => e\n logger.error \"Caught exception when trying to start #{num} #{ami_id} instances!: #{e.message} #{e.backtrace}\"\n EventLog.error \"Caught exception when trying to start #{num} #{ami_id} instances!: #{e.message} #{e.backtrace}\"\n end\n end", "def create\n raise NotImplementedError\n end", "def create\n ec2 = self.class.new_ec2(@resource.value(:user), @resource.value(:password))\n group = @resource.value(:name)\n begin\n ec2.describe_security_groups({:group_name => group})\n rescue Exception => e\n ec2.create_security_group({ \n :group_name => group,\n :group_description => @resource.value(:desc)\n })\n end\n # if instance in that security group exists, start it\n # otherwise just create a new instance \n ec2.run_instances(\n { :image_id => @resource.value(:image),\n # security groups\n :security_group => group,\n :instance_type => @resource.value(:type)\n })\n end", "def create_instance project_id:, instance_id:\n # [START spanner_create_instance]\n # project_id = \"Your Google Cloud project ID\"\n # instance_id = \"Your Spanner instance ID\"\n\n require \"google/cloud/spanner\"\n require \"google/cloud/spanner/admin/instance\"\n\n instance_admin_client = Google::Cloud::Spanner::Admin::Instance.instance_admin\n\n project_path = instance_admin_client.project_path project: project_id\n instance_path = instance_admin_client.instance_path project: project_id, instance: instance_id\n instance_config_path = instance_admin_client.instance_config_path project: project_id, instance_config: \"regional-us-central1\"\n\n job = instance_admin_client.create_instance parent: project_path,\n instance_id: instance_id,\n instance: { name: instance_path,\n config: instance_config_path,\n display_name: instance_id,\n node_count: 2,\n labels: { cloud_spanner_samples: \"true\" } }\n\n puts \"Waiting for create instance operation to complete\"\n\n job.wait_until_done!\n\n if job.error?\n puts job.error\n else\n puts \"Created instance #{instance_id}\"\n end\n # [END spanner_create_instance]\nend", "def create(context)\n context.request.body.rewind # in case someone already read it\n begin\n data = JSON.parse(context.request.body.read)\n rescue JSON::ParserError\n context.halt(406, { status: 'error', message: 'Not acceptable JSON payload' }.to_json)\n end\n\n permitted_params = resource_fields.map { |k| k[:name] }\n permitted_params = data.select { |k, _| permitted_params.include?(k) }\n\n begin\n instance_variable_set(:\"@#{resource_name}\", resource_name.classify.constantize.new(permitted_params))\n\n if instance_variable_get(:\"@#{resource_name}\").save\n instance_variable_get(:\"@#{resource_name}\").to_json\n else\n errors = instance_variable_get(:\"@#{resource_name}\").errors.map { |k, v| \"#{k}: #{v}\" }.join('; ')\n context.halt(406, { status: 'error', message: errors }.to_json)\n end\n rescue StandardError => e\n context.halt(500, { status: 'error', message: e.message }.to_json)\n end\n end", "def semantic_create\n creation_params = {}\n params.each_pair{|k,v| creation_params[k]=v unless(k.to_sym==:_method || k.to_sym==:callback || k.to_sym==:controller || k.to_sym==:action || k.to_sym==:format || v.nil?)}\n self.class.semantic_resource.create(creation_params)\n end", "def create(data)\n @create_resource_mixin.create(data)\n end", "def create\n raise 'Not implemented'\n # signature_type, success = jsonapi_create.to_a\n\n # if success\n # render_jsonapi(signature_type, scope: false)\n # else\n # render_errors_for(signature_type)\n # end\n end", "def create!\n raise NotImplementedError\n end", "def create_created\n controller.create_created(resource: resource)\n end", "def create\n raise \"Not supported\"\n end", "def create options = {}\n resp = case\n when options[:instance_id]\n client.create_image(options)\n when options[:image_location] || options[:root_device_name]\n if kernel = options.delete(:kernel)\n options[:kernel_id] = kernel.id\n end\n if ramdisk = options.delete(:ramdisk)\n options[:ramdisk_id] = ramdisk.id\n end\n options[:block_device_mappings] =\n translate_block_device_mappings(options[:block_device_mappings]) if\n options[:block_device_mappings]\n client.register_image(options)\n else\n raise(ArgumentError,\n \"expected instance_id, image_location, \" +\n \"or root_device_name\")\n end\n Image.new(resp.image_id, :config => config)\n end", "def create(*uris); end", "def create\n payload = {\n name: name,\n validator: validator,\n # this field is ignored in API V1, but left for backwards-compat,\n # can remove after OSC 11 support is finished?\n admin: admin,\n }\n begin\n # try API V1\n raise Chef::Exceptions::InvalidClientAttribute, \"You cannot set both public_key and create_key for create.\" if !create_key.nil? && !public_key.nil?\n\n payload[:public_key] = public_key unless public_key.nil?\n payload[:create_key] = create_key unless create_key.nil?\n\n new_client = if Chef::Config[:migrate_key_to_keystore] == true\n chef_rest_v1_with_validator.post(\"clients\", payload)\n else\n chef_rest_v1.post(\"clients\", payload)\n end\n\n # get the private_key out of the chef_key hash if it exists\n if new_client[\"chef_key\"]\n if new_client[\"chef_key\"][\"private_key\"]\n new_client[\"private_key\"] = new_client[\"chef_key\"][\"private_key\"]\n end\n new_client[\"public_key\"] = new_client[\"chef_key\"][\"public_key\"]\n new_client.delete(\"chef_key\")\n end\n\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n # under API V0, a key pair will always be created unless public_key is\n # passed on initial POST\n payload[:public_key] = public_key unless public_key.nil?\n\n new_client = chef_rest_v0.post(\"clients\", payload)\n end\n Chef::ApiClientV1.from_hash(to_h.merge(new_client))\n end", "def create(&block)\n with_scim_resource() do |resource|\n render(json: yield(resource, :create), status: :created)\n end\n end", "def base_create(resource, options, format = nil, additional_header = {})\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n headers = {content_type: \"#{format}\"}\n headers[:prefer] = @return_preference if @use_return_preference\n headers.merge!(additional_header)\n options = {} if options.nil?\n options[:resource] = resource.class\n options[:format] = format || @default_format\n reply = post resource_url(options), resource, fhir_headers(headers)\n if [200, 201].include? reply.code\n type = reply.response[:headers].detect{|x, _y| x.downcase=='content-type'}.try(:last)\n if !type.nil?\n reply.resource = if type.include?('xml') && !reply.body.empty?\n klass = self.versioned_resource_class(:Xml)\n klass.from_xml(reply.body)\n elsif type.include?('json') && !reply.body.empty?\n klass = self.versioned_resource_class(:Json)\n klass.from_json(reply.body)\n else\n resource # just send back the submitted resource\n end\n resource.id = FHIR::ResourceAddress.pull_out_id(resource.class.name.demodulize, reply.self_link)\n else\n resource.id = FHIR::ResourceAddress.pull_out_id(resource.class.name.demodulize, reply.self_link)\n reply.resource = resource # don't know the content type, so return the resource provided\n end\n else\n resource.id = FHIR::ResourceAddress.pull_out_id(resource.class.name.demodulize, reply.self_link)\n reply.resource = resource # just send back the submitted resource\n end\n set_client_on_resource(reply.resource)\n reply.resource_class = resource.class\n reply\n end", "def create_vm\n if new_resource.clone\n clone_vm\n else\n data = {\n vmid: vmid,\n bootdisk: 'virtio0',\n cores: INSTANCE_SIZE[new_resource.size]['cpu'],\n memory: INSTANCE_SIZE[new_resource.size]['memory'],\n ide2: \"#{new_resource.cdrom},media=cdrom\",\n numa: (new_resource.numa ? 1 : 0),\n ostype: get_type(new_resource.ostype),\n sockets: 1,\n virtio0: \"#{new_resource.storage}:/vm-#{vmid}-disk-1.qcow2,size=#{new_resource.disk}\"\n }.merge(new_resource.net)\n data.merge(hugepages: new_resource.hugepages) if new_resource.hugepages\n api.post(\"/nodes/#{new_resource.host}/qemu\", data)\n end\nend", "def create(resources)\n adapter.create(resources)\n end", "def create(resources)\n adapter.create(resources)\n end", "def create\n \n end", "def create\n \n end", "def create\n \n end", "def create\n \n end", "def create\n \n end", "def create\n \n end", "def create\n \n end", "def create\n \n end", "def create\n end", "def set_instance_template request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_set_instance_template_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def create\n @instance_type = InstanceType.new(params[:instance_type])\n\n respond_to do |format|\n if @instance_type.save\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully created.' }\n format.json { render json: @instance_type, status: :created, location: @instance_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6584818", "0.6575652", "0.6542225", "0.6496084", "0.6481429", "0.6430838", "0.6359172", "0.6347453", "0.631569", "0.6275118", "0.6216435", "0.6196346", "0.6187581", "0.6183696", "0.6154394", "0.6144067", "0.6094609", "0.60598737", "0.6059305", "0.6059305", "0.6059305", "0.6059305", "0.5978803", "0.5962791", "0.5949783", "0.5942706", "0.59386975", "0.5928821", "0.592026", "0.5908097", "0.5905012", "0.5901576", "0.5893426", "0.58917785", "0.58828926", "0.58730555", "0.5866964", "0.586067", "0.58579123", "0.58579123", "0.58579123", "0.58579123", "0.5855556", "0.58399767", "0.58076155", "0.58003557", "0.579323", "0.5773879", "0.5768215", "0.57643247", "0.5753168", "0.57490885", "0.57412225", "0.57331675", "0.5728221", "0.5721882", "0.571724", "0.5709689", "0.5709689", "0.57016474", "0.56935567", "0.5690662", "0.56825584", "0.56818855", "0.5678579", "0.56782365", "0.5675955", "0.5675955", "0.5675955", "0.5674485", "0.5669736", "0.5665785", "0.5659286", "0.5654941", "0.5654305", "0.5651465", "0.56501627", "0.56360847", "0.563477", "0.5630951", "0.5630191", "0.56291157", "0.5615177", "0.56131226", "0.5612955", "0.56007737", "0.5599134", "0.559732", "0.559732", "0.5593098", "0.5593098", "0.5593098", "0.5593098", "0.5593098", "0.5593098", "0.5593098", "0.5593098", "0.5589122", "0.558896", "0.5587495" ]
0.6957502
0
Baseline implementation for the delete REST call
def delete request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_delete_request request_pb response = @client_stub.make_delete_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteRequest\n\n end", "def delete(*rest) end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete\n \n end", "def delete\n request(:delete)\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!\n request! :delete\n end", "def delete\n\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete\n api(\"Delete\")\n end", "def delete\n Iterable.request(conf, base_path).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 delete\n end", "def delete\n end", "def delete\n raise NotImplementedError\n end", "def delete\n raise NotImplementedError\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n \n end", "def delete\n raise NotImplementedError\n end", "def delete\n raise NotImplementedError\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def delete(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('delete')\n end\n end", "def delete(path)\n RestClient.delete request_base+path\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\n # TODO: implement delete\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def delete\n end", "def delete!(*rest) end", "def delete\n client.delete(\"/#{id}\")\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\n request('delete').auth_required!\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def delete\n\n\tend", "def destroy; delete end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\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 delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def delete(*args)\n request(:delete, *args)\n end", "def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def delete\n @resource.delete\n end", "def api_delete(action, data)\n api_request(action, data, 'DELETE')\n end", "def delete(object); end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end", "def delete(_url)\n raise NotImplementedError, 'Implement this method in your strategy'\n end", "def delete(resource)\n headers = base_headers.merge('Content-Type' => 'application/json')\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"DELETE request Url: #{url}\")\n @logger.debug(\"-- Headers: #{headers}\")\n\n x = HTTParty.delete(url, headers: headers)\n puts x.inspect\n x\n end", "def deleted_request\n r = {}\n render json: r,\n root: :data,\n status: :no_content\n end", "def delete options={}, &block\n handle_exceptions do\n Chimps.log.info(\"DELETE #{url}\")\n Response.new(super(options, &block))\n end\n end", "def delete_operations; end", "def delete\n api_client.delete(url)\n end", "def delete options\n rest_request({ method: :delete }.merge(options))\n end", "def delete options\n rest_request({ method: :delete }.merge(options))\n end", "def delete\n ensure_client && ensure_uri\n response = @client.rest_delete(@data['uri'], { 'Accept-Language' => 'en_US' }, @api_version)\n @client.response_handler(response)\n true\n end", "def delete(resource,identifier)\n raise 'Not Yet Implemented'\n end", "def do_delete(uri = '')\n build_request(:delete, uri)\n end", "def destroy\n RubyLokaliseApi::Generics::DeletedResource.new(\n reinit_endpoint.do_delete.content\n )\n end", "def delete(*args)\n Request.delete(*args)\n end", "def rest_delete(path, options={}, &blk)\n delete path do |*args|\n @object = yield(*args) or pass\n @object.destroy\n rest_respond :result => :success\n end\n end", "def rest_delete(path, options={}, &blk)\n delete path do |*args|\n @object = yield(*args) or pass\n @object.destroy\n rest_respond :result => :success\n end\n end", "def delete(action, **args); end", "def delete path\n make_request(path, \"delete\", {})\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete\n NotImplemented\n end", "def delete\n NotImplemented\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def test_delete_post\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Delete.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def delete(_identifier)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end", "def delete!\n @resource.delete!\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 http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthdefault\n\tret=http_delete_low(opts)\n\treturn ret\n else\n\treturn ret\n end\n end", "def delete(uri, request_headers)\n raise NotImplementedError\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def delete(_spec)\n raise NotImplementedError, not_implemented_msg(:delete)\n end", "def remove\n\t\t\tself.make_request!({uri: self.to_uri, method: :delete})\n\t\tend", "def delete(payload)\n post_like payload, Net::HTTP::Delete.new(@uri.path)\n end", "def delete(obj) ; end", "def delete(params, options={})\n request(\"#{base_uri(params)}/delete\", options.merge(method: :delete))\n .if_403_raise(Neutrino::Gateway::Exceptions::InvalidTenantOperation)\n .if_404_raise(Neutrino::Gateway::Exceptions::PatientNotFoundError)\n .with_general_exception_check('409', /has documents/, Neutrino::Gateway::Exceptions::PatientIdentityHasDocumentsError)\n .with_general_exception_check('409', /is not in Error/, Neutrino::Gateway::Exceptions::PatientIdentityNotInError)\n .to_hash['data_status']\n end", "def delete(path, headers: {}, query: {})\n (headers, query) = preprocess(headers, query)\n respond_with super(path, headers: headers, query: query)\n end", "def delete(path_part, additional_headers = {}, &block)\n api_request { @rest.delete('/REST/' + path_part, \"\", additional_headers, &block) }\n end", "def destroy\n # no op\n end", "def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end" ]
[ "0.7802069", "0.77865505", "0.77285236", "0.76946294", "0.76316744", "0.7574076", "0.7574076", "0.7574076", "0.7574076", "0.75177145", "0.7461495", "0.74103874", "0.7405241", "0.7404677", "0.73817897", "0.73817897", "0.73817897", "0.73817897", "0.73817897", "0.73817897", "0.73817897", "0.7369473", "0.7347724", "0.7347724", "0.73349345", "0.7325502", "0.730294", "0.729182", "0.7274709", "0.7274244", "0.7257156", "0.72393316", "0.72361994", "0.72361994", "0.72336173", "0.723041", "0.72066516", "0.7203803", "0.7179595", "0.7172282", "0.7158836", "0.71535635", "0.71535635", "0.7150993", "0.7126018", "0.7126018", "0.712191", "0.7084399", "0.7083833", "0.7078469", "0.70700556", "0.70416594", "0.7040593", "0.70332086", "0.702646", "0.70154035", "0.69999576", "0.6997422", "0.6993209", "0.69800097", "0.69800097", "0.6969492", "0.6968968", "0.6967338", "0.69596", "0.6959166", "0.69553876", "0.69529885", "0.6945991", "0.6945991", "0.6943521", "0.6923923", "0.6923581", "0.6898176", "0.6893419", "0.68893045", "0.6888932", "0.6888211", "0.6883166", "0.687739", "0.6876502", "0.686406", "0.686406", "0.6849683", "0.68428844", "0.68407047", "0.68289757", "0.6822606", "0.6820359", "0.6817866", "0.681199", "0.6811039", "0.6806317", "0.6794199", "0.6789645", "0.6783333", "0.6781004", "0.6776309", "0.67705953", "0.6769485", "0.6761032" ]
0.0
-1
Baseline implementation for the delete_instances REST call
def delete_instances request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_delete_instances_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @instance = @provider.instances.find(params[:id])\n InstanceOperations.terminate_instances(@provider.connect!, @instance)\n @instance.destroy\n redirect_to cloud_provider_path(@provider) \n end", "def delete_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def delete\n stop\n [ @resource['instances_dir'] + \"/\" + @resource[:name],\n @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name]\n ].each do |dir|\n FileUtils.rm_rf(dir) if File.directory?(dir)\n end\n end", "def destroy\n #@instance = Instance.find(params[:id])\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to instances_url }\n format.json { head :no_content }\n end\n end", "def delete_instances(count)\n instances_to_delete = current_instances.last(count) \n parent.terminate_instances(Group.instance_ids(instances_to_delete))\n # remaining_instances under alive\n Output.new(current_instances.first(current_instances.size - count), instances_to_delete)\n end", "def delete_instance instance_id\n instances.delete_instance name: instance_path(instance_id)\n end", "def destroy\n @instance = Instance.find(params[:id])\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to instances_url }\n format.json { head :no_content }\n end\n end", "def delete\n ensure_service!\n service.delete_instance path\n true\n end", "def destroy\n @app_instance.destroy\n respond_to do |format|\n format.html { redirect_to app_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance = Instance.find(params[:id])\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to(instances_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @instance.destroy\n respond_to do |format|\n format.html { redirect_to instances_url, notice: 'Instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance.destroy\n respond_to do |format|\n format.html { redirect_to instances_url, notice: 'Instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(instance) # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + instance\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Delete.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end", "def delete\n \n end", "def delete\n results = submit_cmd('delete app instance',:db, \" -env #{self.belongs_to.env} -app_instance #{self.name}\")\n\n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \t raise \"update attribute failed\" \n\t else\n\t \t self.belongs_to.appTemplates.delete(self)\n\t end\n\n end", "def delete_instance instance_id\n execute do\n instances.delete_instance(\n instance_path(instance_id)\n )\n end\n end", "def destroy\n @test_instance.destroy\n respond_to do |format|\n format.html { redirect_to test_instances_url, notice: 'Test instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @instance_name = InstanceName.find(params[:id])\n @instance_name.destroy\n\n respond_to do |format|\n format.html { redirect_to(instance_names_url) }\n format.xml { head :ok }\n end\n end", "def running_delete\n base_delete(params, \"Running\")\n end", "def destroy; delete end", "def delete\n if params[:id]\n result = backend_instance.compute_delete(params[:id])\n else\n result = backend_instance.compute_delete_all\n end\n\n if result\n respond_with(Occi::Collection.new)\n else\n respond_with(Occi::Collection.new, status: 304)\n end\n end", "def destroy\n get_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def exec__delete(opts = {})\n task = Task.create_top_level(model_handle(:task), self, task_action: 'delete and destroy')\n ret = {\n assembly_instance_id: self.id,\n assembly_instance_name: self.display_name_print_form\n }\n opts.merge!(skip_running_check: true)\n \n if !opts[:recursive] && is_target_service_instance?\n staged_instances = get_children_instances(self)\n service_instances = []\n staged_instances.each do |v|\n service_instances << v[:display_name]\n end\n fail ErrorUsage, \"The context service cannot be deleted because there are service instances dependent on it (#{service_instances.join(', ')}). Please use flag '-r' to remove all.\" unless staged_instances.empty?\n end\n \n if opts[:recursive]\n fail ErrorUsage, \"You can use recursive delete with target service instances only!\" unless is_target_service_instance?\n delete_recursive(self, task, opts)\n end\n\n return nil unless self_subtask = delete_instance_task?(self, opts)\n\n if is_target_service_instance?\n task.add_subtask(self_subtask)\n else\n task = self_subtask\n end\n\n task = task.save_and_add_ids\n\n task.subtasks.each do |st|\n if st[:display_name].include?(\"ec2\")\n ret.merge!(has_ec2: true)\n end\n end\n \n Workflow.create(task).defer_execution\n \n ret.merge(task_id: task.id)\n end", "def delete_operations; end", "def destroy\n @instance_eni.destroy\n respond_to do |format|\n format.html { redirect_to instance_enis_url, notice: 'Instance eni was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n super(VIRTUAL_CLUSTER_METHODS[:delete])\n end", "def destroy\n @instance_action = InstanceAction.find(params[:id])\n @instance_action.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_actions_url }\n format.json { head :no_content }\n end\n end", "def delete_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_delete_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\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 destroy\n @server_instance = ServerInstance.find(params[:id])\n @server_instance.destroy\n\n respond_to do |format|\n format.html { redirect_to server_instances_url }\n format.json { head :no_content }\n end\n end", "def terminateinstances\n if not checkRequirements([\"thezone\",\"theserver\"])\n return false\n end\n checkToken(@thezone)\n submit = queryGCE(:path => '/compute/v1beta15/projects/#{@thezone.name}/zones/#{@theserver.azone.name}/instances/#{@theserver.serial}', :method => 'delete', :options => '', :access_token => @thezone.token )\n checkQuery(:type => 'zone', :token => @thezone.token, :projectname => @thezone.name, :zonename => @theserver.azone.name, :operationname => submit[\"name\"] )\n end", "def destroy_instance_docs!\n doc_list = instance_design_doc.view(:all)\n destroy_count = doc_list['total_rows']\n return destroy_count if destroy_count < 1\n \n docs = instance_database.get_bulk(doc_list['rows'].map {|rh| rh['id']})\n docs['rows'].each {|rh| instance_database.delete_doc(rh['doc'], false)}\n instance_database.bulk_delete\n\n destroy_count\n end", "def destroy_instance_docs!\n doc_list = instance_design_doc.view(:all)\n destroy_count = doc_list['total_rows']\n return destroy_count if destroy_count < 1\n \n docs = instance_database.get_bulk(doc_list['rows'].map {|rh| rh['id']})\n docs['rows'].each {|rh| instance_database.delete_doc(rh['doc'], false)}\n instance_database.bulk_delete\n\n destroy_count\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n RubyLokaliseApi::Generics::DeletedResource.new(\n reinit_endpoint.do_delete.content\n )\n end", "def delete\n api(\"Delete\")\n end", "def delete\n request(:delete)\n end", "def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end", "def delete(client, region = 'AWS_REGION')\r\n super\r\n api_id = get_id_for_api(@api_name)\r\n if api_id\r\n options = {\r\n rest_api_id: api_id\r\n }\r\n @client.delete_rest_api(options)\r\n puts \"Deleted API: #{@api_name} ID:#{api_id}\"\r\n else\r\n puts \"API Gateway Object #{@api_name} not found. Nothing to delete.\"\r\n end\r\n true\r\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n \n end", "def destroy\n \n end", "def deleteRequest\n\n end", "def destroy\n @ec2_instance.destroy\n respond_to do |format|\n format.html { redirect_to ec2_instances_url, notice: 'Ec2 instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def delete\n\n end", "def delete\n ensure_service!\n service.delete_table instance_id, name\n true\n end", "def terminate_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"TerminateInstances\", :params => params)\n end", "def delete_instance(opts)\n opts = check_params(opts,[:class_instance_keys])\n super(opts)\n end", "def delete\n end", "def destroy\n @instance_eni_tag.destroy\n respond_to do |format|\n format.html { redirect_to instance_eni_tags_url, notice: 'Instance eni tag was successfully destroyed.' }\n format.json { head :no_content }\n end\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 destroy \n ec2 = self.class.new_ec2(@resource.value(:user), @resource.value(:password))\n ec2.terminate_instances({:instance_id => @property_hash[:instance_id]})\n ec2.delete_security_group({:group_name => @resource.value(:name)})\n end", "def destroy\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/deployed_containers/\"+params[:id].to_s+\"/destroy_deployed.json\"), (sesh :current_token))\n json_respond response.body\n\n end", "def destroy\n @robot_instance.destroy\n respond_to do |format|\n format.html { redirect_to robot_instances_url, notice: 'Robot instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def delete_pvm_instance(instance_id)\n delete(\"cloud-instances/#{guid}/pvm-instances/#{instance_id}\")\n end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy\n @instance_fault = InstanceFault.find(params[:id])\n @instance_fault.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_faults_url }\n format.json { head :no_content }\n end\n end", "def destroy!\n response = @connection.dbreq(\"DELETE\", @lbmgmthost, \"#{@lbmgmtpath}/instances/#{CloudDB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^202$/)\n true\n end", "def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n # TODO: implement delete\n end", "def destroy\n Instance.find(params[:id]).destroy\n #respond_to do |format|\n #format.html { redirect_to instances_url, notice: 'Instance was successfully destroyed.' }\n #format.json { head :no_content }\n @response = { :message =>\"Instance successfully destroyed.\"}\n render :json => @response\n #end\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def delete\n @resource.delete\n end", "def destroy\n # no op\n end", "def destroy\n @instance_type.destroy\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance_type = InstanceType.find(params[:id])\n @instance_type.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @normal_example = NormalExample.find(params[:id])\n @normal_example.destroy\n\n respond_to do |format|\n format.html { redirect_to(normal_examples_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def delete!\n request! :delete\n end", "def delete_instance_from_dashboard(appid, location)\n begin\n host, port = location.split(\":\")\n instance_info = [{\n 'appid' => appid,\n 'host' => host,\n 'port' => Integer(port)\n }]\n\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/apps/stats/instances\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Delete.new(url.path)\n request.body = JSON.dump(instance_info)\n response = http.request(request)\n Djinn.log_debug(\"Done sending instance info to AppDashboard!\")\n Djinn.log_debug(\"Instance info is: #{instance_info.inspect}\")\n Djinn.log_debug(\"Response is #{response.body}\")\n rescue Exception => exception\n # Don't crash the AppController because we weren't able to send over\n # the instance info - just continue on.\n Djinn.log_warn(\"Couldn't delete instance info to AppDashboard because\" +\n \" of a #{exception.class} exception.\")\n end\n end", "def perform_destroy(batch_client)\n check_instance_method_existance!(:destroy)\n self.class.make_request(client, batch_client, :destroy, scope_parameters.merge({ self.class.primary_key_name => primary_key }))\n end", "def delete\n end", "def delete\n self.class.delete_service_instance(@service_name, @name)\n end", "def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end", "def destroy\n @example.update_attributes(:deleted => 1)\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n\r\n end", "def delete!\n @resource.delete!\n end" ]
[ "0.7173356", "0.69271666", "0.6916623", "0.6858635", "0.68051195", "0.67992944", "0.6747067", "0.6720948", "0.66915864", "0.6668431", "0.661892", "0.6613864", "0.66122", "0.65790457", "0.65720403", "0.6541037", "0.6516814", "0.65114725", "0.65038973", "0.6482585", "0.64782053", "0.64678365", "0.64658386", "0.646469", "0.6462527", "0.6434771", "0.6429632", "0.6427008", "0.6421379", "0.64186126", "0.641792", "0.641792", "0.641792", "0.641792", "0.6414944", "0.6397319", "0.6385445", "0.6385445", "0.6379", "0.6349571", "0.6348398", "0.6345172", "0.6333223", "0.6329254", "0.63285005", "0.6323769", "0.6323769", "0.6322994", "0.6309864", "0.63064295", "0.63043207", "0.62892073", "0.6286803", "0.6286065", "0.6275425", "0.6272717", "0.62583584", "0.62583584", "0.62583584", "0.62583584", "0.62583584", "0.62583584", "0.62583584", "0.6243652", "0.62412935", "0.6239166", "0.6232054", "0.6226262", "0.6205936", "0.6205936", "0.6205936", "0.6205936", "0.6205936", "0.6205936", "0.6205936", "0.6205936", "0.6205936", "0.6205936", "0.6190572", "0.6188635", "0.6186192", "0.6172657", "0.6170912", "0.61676055", "0.6155855", "0.6151838", "0.61405635", "0.6132736", "0.6127197", "0.61197716", "0.6118303", "0.61098313", "0.6101516", "0.6097734", "0.6091388", "0.60906017", "0.60862637", "0.60810006", "0.60752225", "0.60743046" ]
0.75676584
0
Baseline implementation for the delete_per_instance_configs REST call
def delete_per_instance_configs request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, _query_string_params = transcode_delete_per_instance_configs_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n results = submit_cmd('delete app instance',:db, \" -env #{self.belongs_to.env} -app_instance #{self.name}\")\n\n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \t raise \"update attribute failed\" \n\t else\n\t \t self.belongs_to.appTemplates.delete(self)\n\t end\n\n end", "def delete\n stop\n [ @resource['instances_dir'] + \"/\" + @resource[:name],\n @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name]\n ].each do |dir|\n FileUtils.rm_rf(dir) if File.directory?(dir)\n end\n end", "def exec__delete(opts = {})\n task = Task.create_top_level(model_handle(:task), self, task_action: 'delete and destroy')\n ret = {\n assembly_instance_id: self.id,\n assembly_instance_name: self.display_name_print_form\n }\n opts.merge!(skip_running_check: true)\n \n if !opts[:recursive] && is_target_service_instance?\n staged_instances = get_children_instances(self)\n service_instances = []\n staged_instances.each do |v|\n service_instances << v[:display_name]\n end\n fail ErrorUsage, \"The context service cannot be deleted because there are service instances dependent on it (#{service_instances.join(', ')}). Please use flag '-r' to remove all.\" unless staged_instances.empty?\n end\n \n if opts[:recursive]\n fail ErrorUsage, \"You can use recursive delete with target service instances only!\" unless is_target_service_instance?\n delete_recursive(self, task, opts)\n end\n\n return nil unless self_subtask = delete_instance_task?(self, opts)\n\n if is_target_service_instance?\n task.add_subtask(self_subtask)\n else\n task = self_subtask\n end\n\n task = task.save_and_add_ids\n\n task.subtasks.each do |st|\n if st[:display_name].include?(\"ec2\")\n ret.merge!(has_ec2: true)\n end\n end\n \n Workflow.create(task).defer_execution\n \n ret.merge(task_id: task.id)\n end", "def destroy\n @app_config.destroy\n respond_to do |format|\n format.html { redirect_to app_configs_url, notice: 'App config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to app_configs_url }\n format.json { head :no_content }\n end\n end", "def delete_old_asg config, launch_config_name\n auto_scaling = new_auto_scaling\n auto_scaling.groups.each do |group|\n server = tag_value(group.tags, \"server\")\n if server != config[\"server\"]\n next \n end\n\n env = tag_value(group.tags, \"env\")\n if env != config[\"env\"]\n next \n end\n\n if group.name != launch_config_name.name\n puts \"deleting instance group, #{group.name} => #{launch_config_name.name}\"\n delete_asg group.name\n end\n end\nend", "def running_delete\n base_delete(params, \"Running\")\n end", "def delete_monit_config\n _parent = service_resource.parent\n monit_config new_resource.service_name do\n action :delete\n parent _parent\n end\n end", "def destroy\n @app_instance.destroy\n respond_to do |format|\n format.html { redirect_to app_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n conf.delete 'api'\n end", "def destroy\n @ddconfig.destroy\n end", "def destroy\n\t\t@list_config = ListConfig.find(params[:id])\n\t\t@list_config.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(list_configs_url) }\n\t\t\tformat.xml { head :ok }\n\t\t\tformat.json { head :ok }\n\t\t\tformat.yaml { render :text => \"\", :content_type => 'text/yaml' }\n\t\tend\n\tend", "def delete_configuration\n super\n end", "def delete_configuration\n super\n end", "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(app_configs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @global_config = AppConfig.find(params[:id])\n @global_config.destroy\n\n respond_to do |format|\n format.html { redirect_to global_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_config.destroy\n respond_to do |format|\n format.html { redirect_to api_configs_url, notice: 'Api config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @docker_cfg.destroy\n respond_to do |format|\n format.html { redirect_to docker_cfgs_url, notice: 'Docker cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: \"Config was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_cluster\n lb_authenticate = authenticate()\n lb_url = \"\"\n headers = {\"x-auth-token\" => lb_authenticate['auth_token'], \"content-type\" => \"application/json\"}\n lb_authenticate['lb_urls'].each {|lb|\n if config[:lb_region].to_s.downcase == lb['region'].to_s.downcase\n lb_url = lb['publicURL']\n break\n end\n lb_url = lb['publicURL']\n }\n @name_args.each {|arg|\n server_uuids = []\n lb_url = lb_url + \"/loadbalancers/#{arg}\"\n get_uuids = make_web_call(\"get\", lb_url, headers )\n if get_uuids.code == '404'\n ui.msg \"Make sure you specify the -r flag to specify what region the LB is located\"\n exit(1)\n end\n lb_data = JSON.parse(get_uuids.body)\n lb_data['loadBalancer']['metadata'].each{|meta|\n server_uuids << {'uuid' => meta['value'], 'server_name' => meta['key'] }\n }\n server_uuids.each { |uuid|\n rs_delete = RackspaceServerDelete.new\n rs_delete.config[:yes] = 'yes'\n rs_delete.name_args = [ uuid['uuid'] ]\n rs_delete.config[:purge] = true\n rs_delete.config[:chef_node_name] = uuid['server_name']\n rs_delete.run\n }\n delete_lb_call = make_web_call(\"delete\", lb_url, headers)\n puts \"Deleted loadbalancer id #{arg}\"\n \n \n }\n end", "def destroy\n @kernel_config.destroy\n respond_to do |format|\n format.html { redirect_to kernel_configs_url, notice: \"Kernel config was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_launch_configs\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n auto_scaling.launch_configurations.each do |config|\n if groups[config.name].nil?\n puts \"deleting asg launch configuration, #{config.name}\"\n config.delete()\n end\n end\nend", "def delete_instance_from_dashboard(appid, location)\n begin\n host, port = location.split(\":\")\n instance_info = [{\n 'appid' => appid,\n 'host' => host,\n 'port' => Integer(port)\n }]\n\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/apps/stats/instances\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Delete.new(url.path)\n request.body = JSON.dump(instance_info)\n response = http.request(request)\n Djinn.log_debug(\"Done sending instance info to AppDashboard!\")\n Djinn.log_debug(\"Instance info is: #{instance_info.inspect}\")\n Djinn.log_debug(\"Response is #{response.body}\")\n rescue Exception => exception\n # Don't crash the AppController because we weren't able to send over\n # the instance info - just continue on.\n Djinn.log_warn(\"Couldn't delete instance info to AppDashboard because\" +\n \" of a #{exception.class} exception.\")\n end\n end", "def destroy\n @wp_dyna_config = WpDynaConfig.find(params[:id])\n @wp_dyna_config.destroy\n\n respond_to do |format|\n format.html { redirect_to wp_dyna_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @version = Version.find(params[:id])\n @versionconfig = @version.version_configurations.destroy_all\n @version.destroy\n\n respond_to do |format|\n format.html { redirect_to [@application, @version] }\n format.json { head :no_content }\n end\n end", "def action_remove\n notifying_block do\n delete_config\n end\n end", "def destroy\n @my_configuration = MyConfiguration.find(params[:id])\n @my_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to my_configurations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kf_global_config = Kf::GlobalConfig.find(params[:id])\n @kf_global_config.destroy\n\n respond_to do |format|\n format.html { redirect_to kf_global_configs_url({:page => params[:page]}) }\n format.json { head :no_content }\n end\n end", "def destroy\n @machine_config.destroy\n respond_to do |format|\n format.html { redirect_to machine_configs_url }\n format.json { head :no_content }\n end\n end", "def delete_all_configurations\n super\n end", "def delete_all_configurations\n super\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @jenkins_app_config.destroy\n respond_to do |format|\n format.html { redirect_to jenkins_app_configs_url, notice: 'Jenkins app config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @configuration = current_host.configuration_parameters.find(params[:id])\n @configuration.destroy\n\n respond_to do |format|\n flash[:notice] = 'hostConfiguration was successfully deleted.'\n format.html { redirect_to host_url(current_host) }\n format.xml { head :ok }\n end\n end", "def delete_instance instance_id\n instances.delete_instance name: instance_path(instance_id)\n end", "def destroy\n @system_config.destroy\n respond_to do |format|\n format.html { redirect_to system_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_config.destroy\n respond_to do |format|\n format.html { flash[:danger] = I18n.t('task_config.destroy.notice.success'); redirect_to task_configs_url }\n format.json { head :no_content }\n end\n end", "def run_destroy\n run(\n result:\n ::Kitchen::Terraform::Client::Command\n .destroy(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .enable_lock\n .lock_timeout(duration: config_lock_timeout)\n .disable_input\n .maybe_no_color(toggle: !config_color)\n .parallelism(concurrent_operations: config_parallelism)\n .enable_refresh\n .state(path: config_state)\n .state_out(path: config_state)\n .vars(keys_and_values: config_variables)\n .var_files(paths: config_variable_files)\n .force,\n working_directory: instance_directory\n )\n )\n end", "def destroy\n @scrape_config.destroy\n respond_to do |format|\n format.html { redirect_to scrape_configs_url, notice: 'Scrape config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gpu_conf.destroy\n respond_to do |format|\n format.html { redirect_to gpu_confs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n conf.delete 'dashboard'\n end", "def destroy\n @launch_configuration = LaunchConfiguration.find(params[:id])\n\t\t@provider_account = @launch_configuration.provider_account\n\n redirect_url = provider_account_url(@provider_account, :anchor => 'auto_scaling')\n\t\treturn redirect_to(redirect_url) if @launch_configuration.active?\n\n\t\t@error_messages = []\n @launch_configuration.destroy\n\t\t@error_messages += @launch_configuration.errors.collect{ |attr,msg| \"#{attr.humanize} - #{msg}\" }\n\n respond_to do |format|\n\t\t\tif @error_messages.empty?\n\t\t\t\tp = @provider_account\n\t\t\t\to = @launch_configuration\n\t\t\t\tAuditLog.create_for_parent(\n\t\t\t\t\t:parent => p,\n\t\t\t\t\t:auditable_id => nil,\n\t\t\t\t\t:auditable_type => o.class.to_s,\n\t\t\t\t\t:auditable_name => o.name,\n\t\t\t\t\t:author_login => current_user.login,\n\t\t\t\t\t:author_id => current_user.id,\n\t\t\t\t\t:summary => \"deleted '#{o.name}'\",\n\t\t\t\t\t:changes => o.tracked_changes,\n\t\t\t\t\t:force => true\n\t\t\t\t)\n\t\t\telse\n\t\t\t\tflash[:error] = @error_messages.join('<br/>')\n\t\t\tend\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n format.js\n end\n end", "def destroy\n @sysconfig = Sysconfig.find(params[:id])\n @sysconfig.destroy\n\n respond_to do |format|\n format.html { redirect_to sysconfigs_url }\n format.json { head :no_content }\n end\n end", "def destroy_instance_docs!\n doc_list = instance_design_doc.view(:all)\n destroy_count = doc_list['total_rows']\n return destroy_count if destroy_count < 1\n \n docs = instance_database.get_bulk(doc_list['rows'].map {|rh| rh['id']})\n docs['rows'].each {|rh| instance_database.delete_doc(rh['doc'], false)}\n instance_database.bulk_delete\n\n destroy_count\n end", "def destroy_instance_docs!\n doc_list = instance_design_doc.view(:all)\n destroy_count = doc_list['total_rows']\n return destroy_count if destroy_count < 1\n \n docs = instance_database.get_bulk(doc_list['rows'].map {|rh| rh['id']})\n docs['rows'].each {|rh| instance_database.delete_doc(rh['doc'], false)}\n instance_database.bulk_delete\n\n destroy_count\n end", "def delete_instance(opts)\n opts = check_params(opts,[:class_instance_keys])\n super(opts)\n end", "def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end", "def destroy\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/deployed_containers/\"+params[:id].to_s+\"/destroy_deployed.json\"), (sesh :current_token))\n json_respond response.body\n\n end", "def destroy\n @configuration_key.destroy\n respond_to do |format|\n format.html { redirect_to configuration_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_configurations.destroy\n head :no_content\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def destroy\n @configuration.destroy\n respond_to do |format|\n format.html { redirect_to configurations_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_configuration_identifier.destroy\n respond_to do |format|\n format.html { redirect_to admin_configuration_identifiers_url, notice: 'Configuration identifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @car_config.destroy\n respond_to do |format|\n format.html { redirect_to car_configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def _delete_without_checking\n if @instance_filters && !@instance_filters.empty?\n _delete_dataset.delete \n else\n super\n end\n end", "def destroy\n @configuration.destroy\n\n respond_to do |format|\n flash[:notice] = 'Configuration deleted.'\n format.html { redirect_to(configurations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site_config = SiteConfig.find(params[:id])\n @site_config.destroy\n\n respond_to do |format|\n format.html { redirect_to site_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy_backend\n Rails.logger.info \"Removing tenant #{self.name} with tenant id #{self.uuid}.\"\n\n Rails.logger.info \"Undeploying all instances for tenant #{self.name}...\"\n # Delete all instances\n if self.instances.count > 0\n success = self.instances.each {|i| i.undeploy }\n if success\n Rails.logger.info \"Removed all instances for tenant #{self.name}.\"\n else\n Rails.logger.error \"Could not remove instance during project deletion:\"\n Rails.logger.error \"Instance: #{i.name} #{i.id} #{i.uuid}\"\n return false\n end\n end\n\n compute_c = get_connection(\"compute\")\n network_c = get_connection(\"network\")\n identity_c = get_connection(\"identity\")\n\n # Unallocate floating ips\n floating_ips = compute_c.get_floating_ips\n floating_ips.each do |ip|\n Rails.logger.info \"Deleting floating ip #{ip.ip} with id #{ip.id}\"\n compute_c.delete_floating_ip(ip.id)\n end\n\n routers = network_c.list_routers.select {|router| router.tenant_id == self.uuid}\n subnets = network_c.list_subnets.select {|subnet| subnet.tenant_id == self.uuid}\n networks = network_c.list_networks.select {|network| network.tenant_id == self.uuid}\n\n # Clear all router gateways\n routers.each do |router|\n Rails.logger.info \"Clearing router gateway for #{router.name} with id #{router.id}.\"\n # Remove gateway from the router\n network_c.update_router(router.id, {\"external_gateway_info\" => {}})\n end\n\n # loop through each network\n # For each router, remove any subnet interfaces\n networks.each do |network|\n subnets.select {|subnet| subnet.network_id == network.id}.each do |subnet|\n routers.each do |router|\n begin\n Rails.logger.info \"Attempting to remove router interface for subnet #{subnet.name} with id #{subnet.id} from router #{router.name} with id #{router.id}.\"\n network_c.remove_router_interface(router.id, subnet.id)\n Rails.logger.info \"Successfully removed router interface for subnet #{subnet.name}.\"\n rescue => e\n Rails.logger.error \"Tried to remove router interface for subnet #{subnet.name} with id #{subnet.id} from router #{router.name} with id #{router.id}.\"\n end\n end\n end\n end\n\n # Delete all subnets\n subnets.each do |subnet|\n Rails.logger.info \"Deleting subnet #{subnet.name} with id #{subnet.id}\"\n network_c.delete_subnet(subnet.id)\n end\n\n # Delete all routers\n routers.each do |router|\n Rails.logger.info \"Deleting router #{router.name} with id #{router.id}\"\n network_c.delete_router(router.id)\n end\n\n # Delete all networks\n networks.each do |network|\n Rails.logger.info \"Deleting network #{network.name} with id #{network.id}\"\n network_c.delete_network(network.id)\n end\n\n # Finally, delete the tenant\n Rails.logger.info \"Deleting tenant #{self.name} with id #{self.uuid}\"\n identity_c.delete_tenant(self.uuid)\n\n Rails.logger.info \"Removal of tenant #{self.name} on the OpenStack backend succeeded.\"\n end", "def destroy\n @instance = @provider.instances.find(params[:id])\n InstanceOperations.terminate_instances(@provider.connect!, @instance)\n @instance.destroy\n redirect_to cloud_provider_path(@provider) \n end", "def destroy\n @config_value = ConfigValue.find(params[:id])\n @config_value.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_config_values_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @mainconfig = Mainconfig.find(params[:id])\r\n @mainconfig.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(mainconfigs_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete_operations; end", "def destroy\n @devis_configuration.destroy\n respond_to do |format|\n format.html { redirect_to devis_configurations_url, notice: 'Devis configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @system_config = SystemConfig.find(params[:id])\n @system_config.destroy\n\n respond_to do |format|\n format.html { redirect_to system_configs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @configuration_set = ConfigurationSet.find(params[:id])\n @configuration_set.destroy\n\n respond_to do |format|\n format.html { redirect_to configuration_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @configtable = Configtable.find(params[:id])\n @configtable.destroy\n\n respond_to do |format|\n format.html { redirect_to configtables_url }\n format.json { head :no_content }\n end\n end", "def delete_at index\n @config.delete_at index\n end", "def delete\n client.delete_launch_configuration(resource_options)\n nil\n end", "def destroy\n @config_log.destroy\n respond_to do |format|\n format.html { redirect_to config_logs_url, notice: 'Config log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_cluster instance_id, cluster_id\n instances.delete_cluster name: cluster_path(instance_id, cluster_id)\n end", "def delete_instance instance_id\n execute do\n instances.delete_instance(\n instance_path(instance_id)\n )\n end\n end", "def destroy\n @cdg_configuration.destroy\n respond_to do |format|\n format.html { redirect_to cdg_configurations_url, notice: 'Cdg configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cdn_config = CdnConfig.find(params[:id])\n @cdn_config.destroy\n\n respond_to do |format|\n format.html { redirect_to cdn_configs_url }\n format.json { head :ok }\n end\n end", "def delete_instances(count)\n instances_to_delete = current_instances.last(count) \n parent.terminate_instances(Group.instance_ids(instances_to_delete))\n # remaining_instances under alive\n Output.new(current_instances.first(current_instances.size - count), instances_to_delete)\n end", "def destroy\n @scf_configuration.destroy\n respond_to do |format|\n format.html { redirect_to scf_configurations_url, notice: 'Scf configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @a_serverconfiguration.destroy\n respond_to do |format|\n format.html { redirect_to a_serverconfigurations_url, notice: 'A serverconfiguration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sm_backend_config = SmBackendConfig.find(params[:id])\n @sm_backend_config.destroy\n\n respond_to do |format|\n format.html { redirect_to sm_backend_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_set_value.destroy\n respond_to do |format|\n format.html { redirect_to config_set_values_url, notice: 'Config set value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_delete_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def delete\n ensure_service!\n service.delete_instance path\n true\n end", "def destroy\n @system_configuration = SystemConfiguration.find(params[:id])\n @system_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to system_configurations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end", "def erase_app_instance_info\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_list = uac.get_all_apps()\n my_public = my_node.public_ip\n\n Djinn.log_info(\"All apps are [#{app_list.join(', ')}]\")\n app_list.each { |app|\n if uac.does_app_exist?(app)\n Djinn.log_debug(\"App #{app} is enabled, so stopping it.\")\n hosts = uac.get_hosts_for_app(app)\n Djinn.log_debug(\"[Stop appengine] hosts for #{app} is [#{hosts.join(', ')}]\")\n hosts.each { |host|\n Djinn.log_debug(\"[Stop appengine] deleting instance for app #{app} at #{host}\")\n ip, port = host.split(\":\")\n uac.delete_instance(app, ip, port)\n }\n\n Djinn.log_info(\"Finished deleting instances for app #{app}\")\n else\n Djinn.log_debug(\"App #{app} wasnt enabled, skipping it\")\n end\n }\n end", "def destroy\n @tournament_config.destroy\n respond_to do |format|\n format.html { redirect_to tournament_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@instance = Instance.find(params[:id])\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to instances_url }\n format.json { head :no_content }\n end\n end", "def delete()\n super(VIRTUAL_CLUSTER_METHODS[:delete])\n end", "def destroy\n @portal_config.destroy\n respond_to do |format|\n format.html { redirect_to portal_configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sys_config = SysConfig.find(params[:id])\n @sys_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_system_sys_configs_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @graphium_configuration.destroy\n respond_to do |format|\n format.html { redirect_to graphium_configurations_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def batch_destroy\n params[:device_ids].each do |device_id|\n device = Device.find(device_id)\n device.destroy\n end\n\n respond_with(params[:device_ids], location: devices_path, notice: 'Devices were successfully destroyed.')\n end", "def destroy\n @configure = Configure.find(params[:id])\n @configure.destroy\n\n respond_to do |format|\n format.html { redirect_to configures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sysconfig.destroy\n respond_to do |format|\n format.html { redirect_to sysconfigs_url, notice: 'Sysconfig was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wx_config.destroy\n respond_to do |format|\n format.html { redirect_to wx_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @configuration_detail.destroy\n respond_to do |format|\n format.html { redirect_to configuration_details_url, notice: 'Configuration detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cfg_delete(cfg)\n obj_delete cfg, ZoneConfiguration\n end", "def destroy\n @amanda_config = AmandaConfig.find(params[:id])\n @amanda_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(amanda_configs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @car_configuration = CarConfiguration.find(params[:id])\n @car_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to car_configurations_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.666113", "0.6406594", "0.63268644", "0.63054687", "0.6301974", "0.6280173", "0.622278", "0.6214791", "0.61849886", "0.6165851", "0.6144899", "0.6134959", "0.61263174", "0.61263174", "0.60994625", "0.6043661", "0.6042849", "0.602909", "0.602001", "0.6015857", "0.6013635", "0.599222", "0.59877396", "0.5987677", "0.5965578", "0.5956077", "0.5955707", "0.5949396", "0.5933054", "0.5931919", "0.5929674", "0.5929674", "0.59156126", "0.59047073", "0.5900211", "0.5892322", "0.58791536", "0.5876329", "0.5854583", "0.5842863", "0.5840341", "0.58283895", "0.5817028", "0.57697946", "0.57634115", "0.57634115", "0.5762651", "0.57620454", "0.5761614", "0.5745686", "0.5743156", "0.57418686", "0.57407933", "0.5736477", "0.57297695", "0.57285947", "0.5726837", "0.5725664", "0.5720285", "0.57135427", "0.5710039", "0.57074165", "0.5704424", "0.5700285", "0.56872004", "0.5682461", "0.56799835", "0.56751394", "0.5674619", "0.5657878", "0.5648449", "0.5644521", "0.5643119", "0.56359076", "0.5633371", "0.5633159", "0.5623595", "0.5615383", "0.5613768", "0.5613768", "0.560887", "0.5605055", "0.56030464", "0.5600359", "0.55984825", "0.559407", "0.5592059", "0.5589357", "0.5586114", "0.55740696", "0.55582184", "0.555708", "0.5542666", "0.5538028", "0.552812", "0.5525088", "0.5523826", "0.5522918", "0.55213296", "0.5508008" ]
0.7935633
0
Baseline implementation for the get REST call
def get request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, _query_string_params = transcode_get_request request_pb response = @client_stub.make_get_request( uri: uri, options: options ) result = ::Google::Cloud::Compute::V1::InstanceGroupManager.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get; end", "def _get\n http_method(:get)\n end", "def rest_endpoint; end", "def rest_get(base_uri,params)\n begin\n @response = RestClient.get(base_uri,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def http_method\n :get\n end", "def get\n\t\t\tself.make_request!({uri: self.to_uri, method: :get})\n\t\tend", "def get endpoint\n do_request :get, endpoint\n end", "def GET; 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\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def get\n check_response( @httpcli.get(@endpoint) )\n end", "def get\n end", "def get(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('get')\n end\n end", "def get\n end", "def perform_get(rest_url, request)\n query_params = request.api_params.blank? ? '' : to_query_params(request.api_params)\n url = \"#{rest_url}&#{query_params}\"\n\n response = RestClient::Request.execute(\n method: request.http_method,\n url: url,\n headers: request.header_params,\n read_timeout: 30,\n open_timeout: 15\n )\n JSON.parse(response)\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(request, response)\n NotImplemented\n end", "def get(request, response)\n NotImplemented\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 rest_end_point; end", "def get()\n \n end", "def get(resource, other_query = nil)\n raise NotImplementedError, \"#{self.class}#get not implemented\"\n end", "def get_response\n raise NotImplementedError.new(\"method not overriden\")\n end", "def get(url); end", "def do_get(path, params={})\n login if need_login?\n\n # Resource id is a special param as it needs to be added to the path\n path = add_id_and_params_to_path(path, params)\n\n req, res, resource_type, body = nil\n\n begin\n retry_request(true) do\n # Return content type so the resulting resource object knows what kind of resource it is.\n resource_type, body = @rest_client[path].get(headers) do |response, request, result, &block|\n req, res = request, response\n update_cookies(response)\n update_last_request(request, response)\n\n case response.code\n when 200\n # Get the resource_type from the content_type, the resource_type\n # will be used later to add relevant methods to relevant resources\n type = if result.content_type.index('rightscale')\n get_resource_type(result.content_type)\n elsif result.content_type.index('text/plain')\n 'text'\n else\n ''\n end\n\n # work around getting ASCII-8BIT from some resources like audit entry detail\n charset = get_charset(response.headers)\n if charset && response.body.encoding != charset\n response.body.force_encoding(charset)\n end\n\n # raise an error if the API is misbehaving and returning an empty response when it shouldn't\n if type != 'text' && response.body.empty?\n raise EmptyBodyError.new(request, response)\n end\n\n [type, response.body]\n when 301, 302\n update_api_url(response)\n response.follow_redirection(request, result, &block)\n when 404\n raise UnknownRouteError.new(request, response)\n else\n raise ApiError.new(request, response)\n end\n end\n end\n rescue => e\n raise wrap(e, :get, path, params, req, res)\n end\n\n data = if resource_type == 'text'\n { 'text' => body }\n else\n JSON.parse(body, :allow_nan => true)\n end\n\n [resource_type, path, data]\n end", "def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil)\n end\n\n verb.entity :profile do |*args|\n entity = args[0]\n do_request('get', entity, nil, nil)\n end\n\n verb.entity :trip do |*args|\n entity, id, filter = args\n if filter.nil?\n filter = {}\n end\n filter[:id] = id\n do_request('get', entity, filter, nil)\n end\n end\n end", "def get\n start { |connection| connection.request http :Get }\n end", "def rest_endpoint=(_arg0); end", "def get\n end", "def get_rest_api(endpoint, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP GET request against the specified REST API endpoint.\n request = Net::HTTP::Get.new(rest_api_endpoint)\n # Submit the request\n response = http.request(request)\n # Return the response body (JSON containing the results of the query).\n response.body\nend", "def get!\n self.https.request self.http_request # Net::HTTPResponse object\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 execute(:get)\n end", "def get\n execute(:get)\n end", "def get(request, response)\n @resource.get(request, response)\n end", "def get(params={})\n rpc_call :get, params\n end", "def http( *args )\n p http_get( *args )\n end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def api_request(&block)\n response = block.call\n if response.status == 307 and response.body =~ /^\\/REST\\//\n response.body.sub!('/REST/','') \n response = get(response.body)\n end\n parse_response(JSON.parse(response.body || '{}'))\n end", "def http; 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(*params); raise('Stub or mock required.') end", "def call\n resource = base_resource\n\n response = (\n case request_method\n when :get\n resource.get fill do |req|\n (req.body = source) if source\n end\n when :head\n resource.head fill\n when :delete\n resource.delete(fill) do |req|\n req.body = source if source\n end\n when :post\n resource.post(fill, source)\n when :put\n resource.put(fill, source)\n end\n )\n \n response\n end", "def get(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :get,\n :url => \"#{self.uri}#{path}\",\n :headers => {\n :params => params\n },\n :verify_ssl=> @ssl_verify )\n end", "def get(*args)\n prepare_request(:get, args)\n @@client.add(:get, @path, *args)\n end", "def get options={}, &block\n handle_exceptions do\n Chimps.log.info(\"GET #{url}\")\n Response.new(super(options, &block))\n end\n end", "def get\n request_object.get_query\n end", "def call_api\n @client.build_url\n @client.get\n assign_data\n end", "def api_get(action, data)\n api_request(action, data, 'GET')\n end", "def api_get(action, data)\n api_request(action, data, 'GET')\n end", "def get\n url = prefix + \"get\" + id_param\n return response(url)\n end", "def get!\n request! :get\n end", "def retrieve!\n response = @client.rest_get(self.class::BASE_URI)\n body = @client.response_handler(response)\n set_all(body)\n true\n end", "def rest_get(url)\n JSON.parse(RestClient.get(url))\n end", "def api_fetch(url)\n JSON.parse(RestClient.get url)\nend", "def get(url, headers={})\n RestClient.get url, headers\n end", "def _http_get resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Get.new(path)\n _build_request resource, request\nend", "def _http_get resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Get.new(path)\n _build_request resource, request\nend", "def get\n JSON.parse(self.class.get(url).response.body)\n end", "def get\n subclass(:Response).new connection.get do |req|\n req.url uri\n end\n end", "def http_get(end_point)\n uri= URI.parse \"#{@main_url}#{end_point}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend", "def get(path, params={})\n RestClient.get request_base+path, {params: params}\n end", "def get\n if(resource.exist?)\n #print_range(request)\n res = resource.get(request, response)\n if(res == OK && !resource.collection?)\n response['Etag'] = resource.etag\n response['Content-Type'] = resource.content_type\n response['Content-Length'] = resource.content_length.to_s\n response['Last-Modified'] = resource.last_modified.httpdate\n end\n res\n else\n NotFound\n end\n end", "def http_get(endpoint)\n uri= URI.parse \"#{@main_url}#{endpoint}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend", "def get()\n return @http.request(@req)\n end", "def get(uri, request_headers)\n raise NotImplementedError\n end", "def index()\n method_url = @resource\n return self.get(method_url)\n end", "def get(path)\n # build full URL\n url = API_URL % [path]\n\n # log full URL\n @ctx.log.debug('BaseObject#get') { '%s' % [url] }\n\n # get URL from cache\n @ctx.cache.get(url)\n end", "def get\n raise NoMethodError unless is_full_route? @cur_route\n @retrieved_url = @cur_url\n response = HTTParty.get(\"https://api.uwaterloo.ca/v2#{@cur_url}.json\", { query: { key: @api_key, format: 'json' } })\n case response.code\n when 400...600\n raise \"UWaterloo API Server returned a #{response.code} error\"\n end\n @response = RecursiveOpenStruct.new response, recurse_over_arrays: true\n @meta = response['meta']\n @response.data\n end", "def rest_request(verb, url, data)\n if Rails.env.production?\n rest_production(verb, url, JSON.generate(data))\n else\n log_info(\"[#{Rails.env}]: #{verb} #{url}\", 200)\n end\n rescue RestClient::Exception => e\n log_error \"Failed with #{e.http_code}: #{e}\\n#{e.response}\", e.http_code\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 raise NotImplementedError\n end", "def get_wrapper(url, headers)\n [parse_response(RestClient.get(resource + url, headers)), true]\n rescue RestClient::Exception => e\n [parse_error(e.response), false]\n end", "def get(path_part, additional_headers = {}, &block)\n api_request { @rest.get('/REST/' + path_part, nil, additional_headers, &block) }\n end", "def get(data = {})\n call data, method: :get\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_request\n# Use our @http_object object's request method to call the\n# Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def get!(*args)\n @response = get(*args)\n end", "def rest\n @@rest\n end", "def fetch\n raise NotImplementedError\n end", "def auth_get_call(location,params,auth)\n puts \"#Wrapper Service GET req:- \\n#Host: #{@host} \\n#Location: #{location} \\n#Params: #{params.to_json} \"\n response = @conn.get do |req|\n req.url location\n req.headers['Content-Type'] = 'application/json'\n req.headers['Authorization'] = auth.to_s\n req.body = params.to_json\n end\n puts \"#Response Code: #{response.status}\"\n return response\n end", "def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end", "def fetch; end", "def fetch; end", "def get(params)\n request.method = :get\n execute(params)\n end", "def fetch\n raise \"not implemented\"\n end", "def api_keys; rest_query(:api_key); end", "def api_keys; rest_query(:api_key); end", "def http_get(opts={})\n raw_content = opts[:raw_content] || false\n ret=http_get_low(opts)\n if !raw_content then\n\tif ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n authdefault\n ret=http_get_low(opts)\n return ret\n else\n return ret\n\tend\n else\n\treturn ret\n end\n end", "def get(path, id)\n path = \"#{API_PATH}#{path}\"\n return super(path, id, headers: admin_headers(path, '', 'GET', resource_id: id))\n end", "def get path = \"\", payload = {}\n make_request(path, \"get\", payload)\n end", "def rest_get(api_url)\n RestClient::Request.execute(method: :get,\n url: api_url,\n verify_ssl: @verify_ssl).body\n end", "def fetch(*args)\n raise NotImplementedError, 'Implement a method to fetch the resource.'\n end", "def get(url)\n raise \"Needs to be implemented\"\n end", "def get url\n RestClient::Request.execute(:method => :get, :url => url, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def consume_url; end", "def run\n super\n\n # start with negative\n api_endpoint = nil\n api_reason = nil\n\n require_enrichment\n\n # get our url\n url = _get_entity_name\n\n ###\n # First just check our fingerprint, lots of stuff will already have been\n # fingerprinted during our ident run\n ###\n (_get_entity_detail(\"fingerprint\") || []).each do |fp|\n api_endpoint = true if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n api_reason = \"fingerprint\"\n end\n\n # first get a standard response\n standard_response = http_request :get, url\n return unless standard_response\n\n ####\n # next just check keywords in the url, but of course, sanity check this.\n ###\n if ( url.match(/api\\./) ||\n url.match(/apis\\./) ||\n url.match(/\\/api/) ||\n url.match(/\\/json/) ||\n url.match(/\\.json/) ||\n url.match(/\\.xml/) ||\n url.match(/skiptoken/) ||\n url.match(/\\/restapis/) )\n\n unless (\n url.match(/googleapis/) ||\n url.match(/\\.amazonaws\\.com/) ||\n standard_response.body_utf8.match(/^<HTML>/i) ||\n standard_response.body_utf8.match(/HTTP Status 404/i) ||\n standard_response.body_utf8.match(/NoSuchBucket/i) ) \n api_endpoint = true\n api_reason = \"url\"\n end\n\n end\n\n ###\n ### If we made it this far, and our base url matches, just return that\n if api_endpoint\n _create_api_endpoint(url, url, api_reason)\n return # return if our base URL was an endpoint\n end\n\n ####\n # otherwise check patterns in / around the original\n ####\n\n # always start empty\n api_endpoint = nil\n\n [\n \"#{url}\",\n \"#{url}/api\",\n \"#{url}/api/v1\",\n \"#{url}/api/v2\",\n \"#{url}/api/v3\",\n \"#{url}/docs\",\n \"#{url}/graphql\",\n \"#{url}/api-docs\",\n \"#{url}/api-docs/swagger.json\",\n \"#{url}/api/swagger\",\n \"#{url}/api/swagger-ui.html\",\n \"#{url}/api/swagger.yml\",\n \"#{url}/api/v2/swagger.json\",\n \"#{url}/apidocs\",\n \"#{url}/apidocs/swagger.json\",\n \"#{url}/rest\",\n \"#{url}/swagger\",\n \"#{url}/swagger/\",\n \"#{url}/swagger-resources\",\n \"#{url}/swagger-ui\",\n \"#{url}/swagger-ui.html\",\n \"#{url}/swagger.json\",\n \"#{url}/swagger/index.html\",\n \"#{url}/swagger/swagger-ui.html\",\n \"#{url}/swagger/ui/index\",\n \"#{url}/swagger/v1/swagger.json\",\n \"#{url}/v1/swagger.json\"\n ].each do |u|\n\n _log \"Checking... #{u}\"\n\n # Go ahead and get the response for this paritcular endpoint\n\n response = http_request :get, u\n\n next unless response\n # skip if we're not the original url, but we're getting the same response\n\n next if u != url && response.body_utf8 == standard_response.body_utf8\n\n ###\n ### Check for known strings\n ###\n if (response.body_utf8.match(/swagger-section/) ||\n response.body_utf8.match(/swaggerhub.com/) ||\n response.body_utf8.match(/soapenv:Envelope/) )\n # break and create it\n api_reason = \"response_body\"\n api_endpoint = u\n break\n end\n\n # check for content type of application.. note that this will flag\n # application/javascript, which is probably not wanted\n headers = standard_response.headers\n if headers\n ct = headers.find{|x, y| x if x =~ /^content-type/i }\n if ct\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/xml/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/ld+json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/x-protobuf/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/octet-stream/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^text\\/csv/i)\n\n # break and create it\n if api_endpoint\n api_reason = \"content_type\"\n break\n end\n\n end\n end\n\n ###\n # try to parse it (JSON)\n ###\n begin\n # get request body\n body = standard_response.body_utf8\n if body\n json = JSON.parse(body)\n\n if json\n # now check for common error scenarios, and proceed if we pass\n break if json.kind_of?(Hash) && \n ((standard_response.code == \"404\" && json[\"error\"] == \"Not Found\") ||\n (standard_response.code == \"404\" && json[\"response\"] == \"Content was not found.\"))\n \n # create it as an api endpoint\n api_endpoint = u\n api_reason = \"json_body\"\n break\n end\n\n end\n rescue JSON::ParserError\n _log \"No body!\"\n end\n\n # check known fingeprints\n _log \"Attempting to fingerprint (without the browser)!\"\n ident_matches = generate_http_requests_and_check(u,{:enable_browser => false, :'only-check-base-url' => true}) || {}\n ident_fingerprints = ident_matches[\"fingerprint\"] || []\n ident_fingerprints.each do |fp|\n api_endpoint = u if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n # break if it's been set so we dont genereate a bunch of FP's\n if api_endpoint\n api_reason = \"fingerprint\"\n break\n end\n end\n end\n\n ###\n ### Okay now that we're at the end, do we have an endpoint?!?\n ###\n\n # set the details and create a new entity if we made it this far!\n if api_endpoint\n _create_api_endpoint(url, api_endpoint, api_reason)\n else\n _set_entity_detail \"api_endpoint\", false\n end\n\n end", "def fetch\n raise NotImplementedError\n end" ]
[ "0.73324287", "0.7292981", "0.70138574", "0.693026", "0.6865241", "0.6816611", "0.6803572", "0.6795961", "0.6773166", "0.6773166", "0.6769716", "0.67421967", "0.6724426", "0.664156", "0.6633361", "0.66158813", "0.6603196", "0.65990484", "0.65990484", "0.65959835", "0.65769184", "0.65752673", "0.65514386", "0.6501347", "0.64738977", "0.6467637", "0.64499986", "0.6448686", "0.6432968", "0.64135736", "0.63871425", "0.636521", "0.6334899", "0.6334899", "0.63291854", "0.63291854", "0.6328541", "0.63204324", "0.63138103", "0.63049775", "0.6303206", "0.6289398", "0.6268877", "0.6268877", "0.6267518", "0.6267327", "0.6250351", "0.62501556", "0.624835", "0.62342066", "0.62159723", "0.62114966", "0.62114966", "0.62048465", "0.6182773", "0.61703616", "0.61606944", "0.61552453", "0.61489344", "0.6145329", "0.6145329", "0.6141569", "0.6141472", "0.6138623", "0.6137982", "0.6136574", "0.6131754", "0.6126944", "0.6117962", "0.6114535", "0.6105252", "0.6091298", "0.60832053", "0.6076587", "0.6075163", "0.60737413", "0.6070054", "0.6069903", "0.6065379", "0.6061536", "0.60556006", "0.60382813", "0.60365766", "0.6034071", "0.60290843", "0.60275555", "0.60275555", "0.60202533", "0.60127044", "0.60069984", "0.60069984", "0.6004713", "0.60025156", "0.60018563", "0.60014194", "0.5997072", "0.5995303", "0.5991738", "0.59909433", "0.5978456", "0.5977528" ]
0.0
-1
Baseline implementation for the insert REST call
def insert request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_insert_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert()\n\n end", "def _insert(*)\n fail NotImplementedError\n end", "def handle_insert action, result; end", "def insert(*args)\n json_op(:insert, self, *path_value_args(args))\n end", "def do_insert options = {}\n\t\t\t\tif !options[:local]\n\t\t\t\t\tattr_hash = build_attr_hash\n\t\t\t\t\tid = SecureRandom.hex\n\t\t\t\t\t@@client.call(\"/#{self.class.to_s.downcase}/insert\", self.method(:handle_update), [{_id: id}.merge(attr_hash)])\n\t\t\t\tend\n\n\t\t\t\tsuper\n\t\t\tend", "def insert(index,object)\n\nend", "def insert(item)\n\n\n\n\n end", "def crud_post(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n post '/'+resource_name do\n service = settings.send(service_name)\n\n # Get The data\n begin\n data = JSON.parse(request.body.read)\n rescue Exception => e\n return 422\n end\n\n # Valid POST?\n return 422 unless service.valid_insert?(data)\n\n # Already Exists?\n return 409 if service.exists_by_primary_key?(data[primary_key_name])\n\n # Do Insert\n record = service.insert(data)\n\n # Other Error\n return 500 if record.nil?\n\n # Output new record\n JSON.fast_generate record\n end\n end", "def insert(offset, *resources)\n relate_resources(resources)\n super\n end", "def insert(table, id, attributes) # abstract\n end", "def insert(short, url)\n raise NotImplementedError\n end", "def post(data)\n jss = self.get_structure() # For referencing purposes\n\n input = self.query_to_hash(data)\n bad_request = false\n resp = nil\n jss.each do |key, value|\n # Check if we have it on the query too\n unless input.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Not enough data for a new resource\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n input.each do |key, value|\n # Check if we have it on the structure too\n unless jss.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Wrong argument #{key}\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n \n\n # Insert the values if we have a good request\n unless bad_request\n fields = Hash.new\n inserts = Hash.new\n main_table = self.get_structure.values[0].split('/')[0]\n input.each do |key, value|\n struct = jss[key]\n table = struct.split(\"/\")[0]\n inserts[table] ||= []\n fields[table] ||= []\n inserts[table].push \"\\\"\" + value + \"\\\"\"\n fields[table].push struct.split(\"/\")[1]\n if struct.split(\"/\").length > 2\n match = struct.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n fields[table].push matching_field\n if @engine.config[\"dbengine\"] == :mysql\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID()))\"\n else\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(last_insert_rowid()))\"\n end\n end\n end\n queries = [] \n inserts.each do |table, values|\n queries.push \"INSERT INTO #{table}(#{fields[table].join(',')}) VALUES (#{inserts[table].join(',')});\"\n end\n # Connect to the database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n results = []\n rid = nil\n # Find the ID to return in the response (only for the first query)\n queries.each do |q|\n results.push dbe.query(dblink, q)\n if @engine.config[\"dbengine\"] == :mysql\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID());\"), \"id\")\n else\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(last_insert_rowid());\"), \"id\")\n end\n end\n @engine.http_status = \"201 Created\"\n resp = {status: \"201 created\", id: rid}\n end\n return resp\n end", "def insert_in_database\n Fetch.new(insertion_query).array\n end", "def insert(resource)\n record = @mappings.inject({}) do |r, (k, mapping)|\n r.merge!(k => mapping[:get].call(resource))\n end\n\n unless id = record.delete(:id)\n raise ArgumentError, \"Attempted to insert a record without an ID\"\n end\n\n raw.insert(id, record)\n end", "def createRecord(sObject,records_to_insert)\n puts \"in @helper::createRecord\"\n puts records_to_insert\n record = @restForce.createRecord(sObject,records_to_insert)\n puts record\n return record\nend", "def insert(value)\n # YOUR WORK HERE\n end", "def insert(value)\n #YOUR WORK HERE\n end", "def insert_node (insert_mode)\n reference_node = Node.find(params[:id])\n if !reference_node\n render_reference_node_error\n return\n end\n\n node_to_insert = Node.find(params[:node][:id])\n if !node_to_insert\n render_node_to_insert_error\n return\n end\n\n reference_node.send(insert_mode, node_to_insert)\n\n respond_to do |format|\n format.json { render json: node_to_insert, status: :created, location: node_to_insert }\n end\n end", "def insert(**opts)\n add(**opts)\n save!\n end", "def _insert_dataset\n use_server(model.instance_insert_dataset)\n end", "def insert(*values)\n if @opts[:sql] || @opts[:returning]\n super\n else\n returning(insert_pk).insert(*values){|r| return r.values.first}\n end\n end", "def insert\n array = [[@name, @tagline, @github, @twitter, @blog_url, @image_url, @biography]]\n ins = DB[:conn].prepare(\"INSERT INTO students (name, tagline, github, twitter, blog_url, image_url, biography) VALUES (?, ?, ?, ?, ?, ?, ?);\")\n array.each { |s| ins.execute(s)}\n self.id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students;\")[0][0]\n #ask steven re. index figures\n #inserting data into an instance\n end", "def _insert\n return super if model.cti_tables.length == 1\n model.cti_models.each do |m|\n v = {}\n m.cti_table_columns.each{|c| v[c] = @values[c] if @values.include?(c)}\n ds = use_server(m.cti_instance_dataset)\n if ds.supports_insert_select? && (h = ds.insert_select(v))\n @values.merge!(h)\n else\n nid = ds.insert(v)\n @values[primary_key] ||= nid\n end\n end\n db.dataset.supports_insert_select? ? nil : @values[primary_key]\n end", "def insert(*args)\n get_repository_object.insert(*args)\n end", "def insert(cartridge)\n end", "def insert(sql, name = nil, pk = nil, id_value = nil) end", "def create(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def insert(ind, *rest) end", "def insert_resource(opts={})\n node, index = self.contentMetadata.insert_resource(opts)\n return node, index\n end", "def insert(key)\n end", "def create; end", "def create; end", "def create; end", "def create; end", "def insert(mirror=@mirror)\n subscription = mirror.subscriptions.insert.request_schema.new(to_json)\n result = client.execute(\n :api_method => mirror.subscriptions.insert,\n :body_object => subscription)\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = InsertResultSet.new(resp)\n return results\n end", "def create\n @insert = Insert.new(insert_params)\n\n respond_to do |format|\n if @insert.save\n format.html { redirect_to @insert, notice: 'Insert was successfully created.' }\n format.json { render :show, status: :created, location: @insert }\n else\n format.html { render :new }\n format.json { render json: @insert.errors, status: :unprocessable_entity }\n end\n end\n end", "def _insert\n ds = _insert_dataset\n if _use_insert_select?(ds) && (h = _insert_select_raw(ds))\n _save_set_values(h)\n nil\n else\n iid = _insert_raw(ds)\n # if we have a regular primary key and it's not set in @values,\n # we assume it's the last inserted id\n if (pk = autoincrementing_primary_key) && pk.is_a?(Symbol) && !(vals = @values)[pk]\n vals[pk] = iid\n end\n pk\n end\n end", "def _insert\n ds = _insert_dataset\n if _use_insert_select?(ds) && (h = _insert_select_raw(ds))\n _save_set_values(h)\n nil\n else\n iid = _insert_raw(ds)\n # if we have a regular primary key and it's not set in @values,\n # we assume it's the last inserted id\n if (pk = autoincrementing_primary_key) && pk.is_a?(Symbol) && !(vals = @values)[pk]\n vals[pk] = iid\n end\n pk\n end\n end", "def on_upsert\n #\n end", "def set_insert\n @insert = Insert.find(params[:id])\n end", "def insert_data(test)\n is_singular = test['insert'].length == 1\n entity_or_entities = nil\n if is_singular\n entity_or_entities = 'entity'\n else\n entity_or_entities = 'entities'\n end\n puts \" Inserting #{test['insert'].length} #{entity_or_entities}\"\n\n insert_data = translate_column_names(test['insert'])\n if @verbose\n puts insert_data\n end\n\n @client.insert(insert_data)\n\n # Wait a few seconds so the data can be inserted by SlicingDice\n sleep @sleep_time\n end", "def commit; end", "def commit; end", "def commit; end", "def insert(params)\n params[:real_at] ||= AtStructure.new(params[:at])\n\n if ['_space_', '_return_'].include?(params[:content])\n params.merge!(is_balise: true)\n end\n\n params.merge!(operation: 'insert') unless params.key?(:operation)\n # On ajoute si nécessaire le text-item de référence, qui permettra,\n # notamment, de renseigner les messages, de récupérer le file_id si c'est\n # un projet Scrivener, pour l'affecter aux nouveaux text-items et\n # d'enregistrer les messages d'opération.\n params.merge!(titem_ref: params[:real_at].first_titem) unless params.key?(:titem_ref)\n # Sauf si c'est une balise (*), on crée la simulation pour voir si on va vraiment faire\n # cete opération.\n # (*) Car on ne peut pas occasionner de proximités quand c'est une balise.\n unless params[:is_balise]\n new_titems = simulation(params.merge(debug: debug_insert?)) || return\n end\n\n if params[:operation] == 'insert'\n msg = \"Insertion de “#{params[:content]}” à l’index #{params[:real_at].abs(:at)} (avant “#{extrait_titems[params[:real_at].at].content}”)\"\n log(msg, true)\n end\n\n # :is_balise est true quand on donne '_space_' ou '_return_' comme texte\n unless params[:is_balise]\n # Si c'est une pure insertion, il faut ajouter une espace soit avant\n # soit après les nouveaux items. On l'ajoute après si le titem d'après\n # est un mot (.mot?) et on l'ajoute avant si le titem avant est un mot.\n if params[:operation] == 'insert'\n next_titem = extrait_titems[params[:real_at].at]\n prev_titem = extrait_titems[params[:real_at].first - 1]\n if next_titem && next_titem.mot? && new_titems.last.mot?\n # Dans le cas où l'item suivant existe, que c'est un mot, et que\n # le dernier titem à insérer est aussi un mot, il faut ajouter\n # une espace à la fin des nouveaux items.\n new_titems << NonMot.new(SPACE, type: 'space')\n elsif prev_titem && prev_titem.mot? && new_titems.first.mot?\n # Sinon, dans le cas où l'item précédent existe, que c'est un mot\n # et que le premier item à insérer est aussi un mot, il faut ajouter\n # une espace au début des nouveaux items\n new_titems.unshift(NonMot.new(SPACE, type:'space'))\n end\n end\n else\n new_item = case params[:content]\n when '_space_' then NonMot.new(SPACE, type:'space')\n when '_return_' then NonMot.new(RC, type:'paragraphe')\n end\n new_titems = [new_item]\n end\n # log(\"Nouveaux items ajoutés (#{new_titems.count}) : \")\n # log(new_titems.inspect)\n\n # Si c'est un projet Scrivener, il faut ajouter le file_id de l'item\n # de référence aux nouveaux items\n if itexte.projet_scrivener?\n new_titems.each {|titem| titem.file_id = params[:titem_ref].file_id}\n end\n\n # Insertion des nouveaux titems dans l'extrait\n extrait_titems.insert(params[:real_at].at, *new_titems)\n # Insertion des nouveaux titems dans la base de données\n start_abs_index = params[:real_at].abs(:at)\n new_titems.each_with_index { |i, idx| i.index = idx + start_abs_index }\n itexte.db.insert_text_items(new_titems)\n\n # Pour l'annulation (sauf si c'est justement une annulation)\n if params.key?(:cancellor)\n idx = params[:real_at].abs(:at)\n new_titems.each do |titem|\n content = titem.space? ? '_space_' : titem.content\n params[:cancellor] << {operation: :remove, index:idx, content:content}\n # Note : le content, ci-dessus, ne servira que pour la vérification\n end\n end\n\n # Si c'est vraiment une opération d'insertion, on l'enregistre\n # en tant qu'opération.\n # Noter qu'il faut le faire avant l'update suivant, sinon tous les\n # index et indices seront recalculés et donc faux.\n if params[:operation] == 'insert'\n itexte.operator.add_text_operation(params)\n end\n\n unless params[:noupdate]\n update\n end\nend", "def run_insert\n raise DataFactory::NoInsertStatement unless @insert_statement\n\n stmt = db_interface.execute_sql(@insert_statement, *@binds)\n stmt.close\n end", "def _insert_dataset\n use_server(model.instance_dataset)\n end", "def _insert_dataset\n use_server(model.instance_dataset)\n end", "def insert task\n now = Time.now.to_i\n tasks = @db[:tasks]\n tasks.insert :title => task.title,\n :status => task.getStatus,\n :created => now,\n :wake => now,\n :changed => 0,\n :path => task.getPath,\n :data => Marshal::dump(task)\n end", "def insert(*args)\n dataset.insert(*args)\n self\n end", "def insert (args)\n #p @name\n #p '.......'\n p args\n p self.rarray\n if self.rarray.get(args[:id]).nil?\n model={:mod_name=>@name}\n p self\n #self.rarray << args.merge(model)\n self.rarray << args \n self.store\n else\n raise ArgumentError, 'Cannot insert - id already exists', caller\n end\n end", "def insert_entry(params)\n Entry.create(params)\n end", "def insert_author_affiliation(affi_object, cd_affi_ids)\n # insert the object\n # get the id of the inserted object\n # update all cr_affiliations with the author_affiliation_id\n sql_statement = \\\n \"SELECT id, name FROM cr_affiliations WHERE article_author_id = \" + affi_object.article_author_id.to_s + \";\"\n db = get_db()\n #stm = db.prepare sql_statement\n #rs = stm.execute\n\n db.execute(\"INSERT INTO Author_Affiliations VALUES (?,?,?,?,?,?,?,?,?,?,?,?)\", 1, affi_object.article_author_id, affi_object.name, affi_object.short_name,\n affi_object.add_01, affi_object.add_02, affi_object.add_03,affi_object.add_04, affi_object.add_05, affi_object.country,'2020-09-27','2020-09-27')\nend", "def insert_table dataset_id, new_table_gapi\n execute { service.insert_table @project, dataset_id, new_table_gapi }\n end", "def create\n if params[:database_version]\n last_edit = LogEdit.find(:first, :order => \"id DESC\")\n if (last_edit and last_edit.id.to_i != params[:database_version].to_i)\n render_json({:error => 'Database Version Mismatch', :server_version => last_edit.id}.to_json)\n return\n end\n end\n # json = {type:ModelName, attr:{hash of attributes}}\n if request.post?\n data = ActiveSupport::JSON.decode(params[:json])\n klass = Object.const_get(data['type'].camelcase)\n if CLIENT_TABLES.include? klass\n res = klass.merge_create(data['attr'])\n render_json res.to_json\n return\n end\n end\n render_json \"error\".to_json # TODO add error for bad table name \n end", "def insert\n # Preparing for the query...\n cols = self.class.columns\n col_names = cols.map(&:to_s).join(\", \")\n question_marks = ([\"?\"] * cols.count).join(\", \")\n \n # The actual query\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{ self.class.table_name } (#{ col_names })\n VALUES\n (#{ question_marks })\n SQL\n \n # Add an id number for the record\n self.id = DBConnection.last_insert_row_id\n end", "def insert(data)\n query = \"INSERT INTO `#{@table_name}` \"+build_insert(data)\n\n begin\n queryresult = @mysql.query(query)\n rescue Exception => e\n @log.error(\"#{e}\")\n return nil\n end\n\n expire_table_cache(get_all_related_tables)\n\n if @auto_primary_key\n get_one({@primary_key => get_last_id})\n else\n get_one({@primary_key => data[@primary_key]})\n end\n end", "def _insert_raw(ds)\n if use_prepared_statements_for?(:insert)\n _set_prepared_statement_server(model.send(:prepared_insert, @values.keys)).call(@values)\n else\n super\n end\n end", "def insert\n # the array of ::columns of the class joined with commas, drop id\n col_names = self.class.columns[1..-1].join(\", \") \n # an array of question marks\n question_marks = ([\"?\"] * col_names.split.size).join(\", \")\n\n DBConnection.execute(<<-SQL, *attribute_values[1..-1])\n INSERT INTO\n #{self.class.table_name} (#{col_names})\n VALUES\n (#{question_marks})\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end", "def insert\n col_names = self.class.columns.join(\", \")\n question_marks = ([\"?\"] * self.class.columns.length).join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{self.class.table_name} (#{col_names})\n VALUES\n (#{question_marks})\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end", "def insert\n\n DBConnection.execute2(<<-SQL, attribute_values)\n INSERT INTO\n #{class_obj.table_name} #{sql_columns}\n VALUES\n #{sql_question_marks}\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end", "def create_sql_insert(mysql, json, source)\n fields = []\n values = []\n sql = nil\n\n fields << 'source'\n values << source\n\n fields << 'created_at'\n values << Time.now.strftime('%Y-%m-%d %H:%M:%S')\n\n if !json[\"posting_id\"].nil?\n fields << 'posting_id'\n values << json[\"posting_id\"]\n end\n\n if !json[\"common\"][\"position_title\"].nil?\n fields << 'position_title'\n values << json[\"common\"][\"position_title\"]\n end\n if !json[\"common\"][\"title\"].nil?\n fields << 'title'\n values << json[\"common\"][\"title\"]\n end\n if !json[\"common\"][\"competition_type\"].nil?\n fields << 'competition_type'\n values << json[\"common\"][\"competition_type\"]\n end\n if !json[\"common\"][\"employer\"].nil?\n fields << 'employer'\n values << json[\"common\"][\"employer\"]\n end\n if !json[\"common\"][\"employer_about\"].nil?\n fields << 'employer_about'\n values << json[\"common\"][\"employer_about\"]\n end\n if !json[\"common\"][\"category\"].nil?\n fields << 'category'\n values << json[\"common\"][\"category\"]\n end\n if !json[\"common\"][\"deadline\"].nil?\n fields << 'deadline'\n values << json[\"common\"][\"deadline\"]\n end\n if !json[\"common\"][\"salary\"].nil?\n fields << 'salary'\n values << json[\"common\"][\"salary\"]\n end\n if !json[\"common\"][\"salary_currency\"].nil?\n fields << 'salary_currency'\n values << json[\"common\"][\"salary_currency\"]\n end\n if !json[\"common\"][\"number_openings\"].nil?\n fields << 'number_openings'\n values << json[\"common\"][\"number_openings\"]\n end\n if !json[\"common\"][\"duty\"].nil?\n fields << 'duty'\n values << json[\"common\"][\"duty\"]\n end\n if !json[\"common\"][\"job_type\"].nil?\n fields << 'job_type'\n values << json[\"common\"][\"job_type\"]\n end\n if !json[\"common\"][\"probation_period\"].nil?\n fields << 'probation_period'\n values << json[\"common\"][\"probation_period\"]\n end\n\n if !json[\"common\"][\"functions\"].nil?\n fields << 'functions'\n values << json[\"common\"][\"functions\"]\n end\n\n if !json[\"common\"][\"minimum_education\"].nil?\n fields << 'minimum_education'\n values << json[\"common\"][\"minimum_education\"]\n end\n if !json[\"common\"][\"years_work_experience\"].nil?\n fields << 'years_work_experience'\n values << json[\"common\"][\"years_work_experience\"]\n end\n if !json[\"common\"][\"profession\"].nil?\n fields << 'profession'\n values << json[\"common\"][\"profession\"]\n end\n if !json[\"common\"][\"minimum_age\"].nil?\n fields << 'minimum_age'\n values << json[\"common\"][\"minimum_age\"]\n end\n\n if !json[\"common\"][\"competition_topic\"].nil?\n fields << 'competition_topic'\n values << json[\"common\"][\"competition_topic\"]\n end\n\n if !json[\"common\"][\"contact_address\"].nil?\n fields << 'contact_address'\n values << json[\"common\"][\"contact_address\"]\n end\n if !json[\"common\"][\"contact_phone\"].nil?\n fields << 'contact_phone'\n values << json[\"common\"][\"contact_phone\"]\n end\n if !json[\"common\"][\"contact_person\"].nil?\n fields << 'contact_person'\n values << json[\"common\"][\"contact_person\"]\n end\n\n if !json[\"common\"][\"additional_requirements\"].nil?\n fields << 'additional_requirements'\n values << json[\"common\"][\"additional_requirements\"]\n end\n if !json[\"common\"][\"for_more_information\"].nil?\n fields << 'for_more_information'\n values << json[\"common\"][\"for_more_information\"]\n end\n\n if !json[\"common\"][\"form_and_terms_of_decision\"].nil?\n fields << 'form_and_terms_of_decision'\n values << json[\"common\"][\"form_and_terms_of_decision\"]\n end\n\n if !json[\"common\"][\"closed_vacancy_job_number\"].nil?\n fields << 'closed_vacancy_job_number'\n values << json[\"common\"][\"closed_vacancy_job_number\"]\n end\n\n if !json[\"special_cases\"][\"computer_software\"].nil?\n fields << 'computer_software'\n value = \"total:#{json[\"special_cases\"][\"computer_software\"].length}\\n\"\n value += json[\"special_cases\"][\"computer_software\"].map{|x| \"type:#{x['name']} | level:#{x['level']}\"}.join(\"\\n\")\n values << value\n end\n\n if !json[\"special_cases\"][\"languages\"].nil?\n fields << 'languages'\n value = \"total:#{json[\"special_cases\"][\"languages\"].length}\\n\"\n value += json[\"special_cases\"][\"languages\"].map{|x| \"language:#{x['language']} | writing:#{x['writing']} | speaking:#{x['speaking']}\"}.join(\"\\n\")\n values << value\n end\n\n if !json[\"special_cases\"][\"competition_stages\"].nil?\n fields << 'competition_stages'\n values << json[\"special_cases\"][\"competition_stages\"].join(\"\\n\")\n end\n\n if !json[\"special_cases\"][\"mandatory_blocks\"].nil?\n fields << 'mandatory_blocks'\n values << json[\"special_cases\"][\"mandatory_blocks\"].join(\"\\n\")\n end\n\n\n if !fields.empty? && !values.empty?\n sql= \"insert into postings(\"\n sql << fields.join(', ')\n sql << \") values(\"\n sql << values.map{|x| \"\\\"#{mysql.escape(x.to_s)}\\\"\"}.join(', ')\n sql << \")\"\n end\n\n return sql\nend", "def create\n # Consider request as illegal if performing POST on identifiable resource\n if params[entities_key] && params[entities_key][:id]\n render json: { errors: process_errors([\"Creation of resource with id\"], 404) }, status: :conflict\n return\n end\n \n # Upsert the entity\n entity = ConnecEntity.new(group_id: @group_id, entity_name: entities_key)\n entity.document = (entity.document || {}).merge(params[entities_key])\n entity.save\n \n if entity && entity.errors.empty?\n logger.info(\"INSPECT: #{entities_key} => #{process_entity(entity).to_json}\")\n render json: { entities_key => process_entity(entity.reload) }, status: :created, location: resource_url(entity)\n else\n render json: { errors: process_errors(entity.errors.full_messages, 400, entity) }, status: :bad_request\n end\n \n end", "def insert(entity)\n @service.insert_entity(self, entity)\n end", "def array_insert(*args)\n json_op(:array_insert, self, *path_value_args(args))\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = InsertItemResultSet.new(resp)\n return results\n end", "def insert_resource(doc)\n self.collection.insert(doc)\n end", "def transaction; end", "def transaction; end", "def transaction; end", "def batch_insert(docs)\n execute_batch_push(docs)\n end", "def insert_id\n rID = @ID\n\n @CallsList << [ 'insert_id', @ID ]\n @ID += 1\n\n return rID\n end", "def insert_webservice_access_log(seedTrialID)\n @seed_json_data = read_json_from_dir(@converted_json_dir, @dt4_formula_json)\n @seed_data = @seed_json_data.find {|x| x['seedTrialID'] == \"#{seedTrialID}\"}\n puts @seed_data\nsql_insert_webservice_access_log =\n \"\n INSERT INTO webservice_access_log (identifier,datetime,client_ip,client_username,uri,method,headers,payload,response,response_code,processing_time,processing_errors) VALUES ('1618194','2018-02-21 08:34:32.99','172.18.0.1','ctrpsubstractor','/services/trials/complete/','POST','host=localhost:18080\\nconnection=keep-alive\\ncontent-length=4516\\naccept=application/xml\\npostman-token=8fe8effb-61da-a534-e4c5-a34613f33fec\\ncache-control=no-cache\\norigin=chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop\\nuser-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36\\nauthorization=*********\\ncontent-type=application/xml\\naccept-encoding=gzip, deflate, br\\naccept-language=en-US,en;q=0.9\\ncookie=JSESSIONID=syajca7WdyZiqoJN+WrkNoFO\\n','<tns:CompleteTrialRegistration xmlns:tns=\\\"gov.nih.nci.pa.webservices.types\\\"\\n xmlns:tns1=\\\"gov.nih.nci.po.webservices.types.trimmed\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\"\\n xsi:schemaLocation=\\\"gov.nih.nci.pa.webservices.types ../../src/resources/ws.xsd \\\">\\n\\n <tns:clinicalTrialsDotGovXmlRequired>true</tns:clinicalTrialsDotGovXmlRequired>\\n <tns:leadOrgTrialID>UPCC 348-02 II - sa1</tns:leadOrgTrialID>\\n <tns:clinicalTrialsDotGovTrialID>NCT91914266</tns:clinicalTrialsDotGovTrialID>\\n <tns:otherTrialID>818280234</tns:otherTrialID>\\n <tns:title>A Phase I/II Study Of Brentuximab Vedotin In Combination With Multi-Agent Chemotherapy II</tns:title>\\n <tns:phase>I</tns:phase>\\n <tns:pilot>false</tns:pilot>\\n <tns:accrualDiseaseTerminology>ICD10</tns:accrualDiseaseTerminology>\\n <tns:primaryPurpose>Other</tns:primaryPurpose>\\n <tns:primaryPurposeOtherDescription>Determine maximum tolerated dose (MTD) of brentuximab vedotin</tns:primaryPurposeOtherDescription>\\n <tns:interventionalDesign>\\n <tns:secondaryPurpose>Other</tns:secondaryPurpose>\\n <tns:secondaryPurposeOtherDescription>Secondary Other Description</tns:secondaryPurposeOtherDescription>\\n </tns:interventionalDesign>\\n <tns:leadOrganization>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:leadOrganization>\\n <tns:pi>\\n <tns:existingPerson>\\n <tns:poID>5000</tns:poID>\\n </tns:existingPerson>\\n </tns:pi>\\n <tns:sponsor>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:sponsor>\\n <tns:responsibleParty>\\n <tns:type>Sponsor-Investigator</tns:type>\\n <tns:investigator>\\n <tns:existingPerson>\\n <tns:poID>5000</tns:poID>\\n </tns:existingPerson>\\n </tns:investigator>\\n <tns:investigatorTitle>CEO &amp; Chairman</tns:investigatorTitle>\\n </tns:responsibleParty>\\n <tns:summary4FundingSponsor>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:summary4FundingSponsor>\\n <tns:programCode>PG00001</tns:programCode>\\n <tns:fundedByNciGrant>false</tns:fundedByNciGrant>\\n <tns:grant>\\n <tns:fundingMechanism>B09</tns:fundingMechanism>\\n <tns:nihInstitutionCode>AA</tns:nihInstitutionCode>\\n <tns:serialNumber>111111</tns:serialNumber>\\n <tns:nciDivisionProgramCode>CCR</tns:nciDivisionProgramCode>\\n <tns:fundingPercentage>100.0</tns:fundingPercentage>\\n </tns:grant>\\n <tns:trialStatus>In Review</tns:trialStatus>\\n <tns:whyStopped></tns:whyStopped>\\n <tns:trialStatusDate>2014-07-15</tns:trialStatusDate>\\n <tns:trialStartDate type=\\\"Actual\\\">2014-07-15</tns:trialStartDate>\\n <tns:primaryCompletionDate type=\\\"Anticipated\\\">2019-07-15</tns:primaryCompletionDate>\\n <tns:completionDate type=\\\"Anticipated\\\">2019-07-15</tns:completionDate>\\n <tns:ind>\\n <tns:number>111111</tns:number>\\n <tns:grantor>CDER</tns:grantor>\\n <tns:holderType>NIH</tns:holderType>\\n <tns:nihInstitution>NEI</tns:nihInstitution>\\n <tns:expandedAccess>true</tns:expandedAccess>\\n <tns:expandedAccessType>Available</tns:expandedAccessType>\\n <tns:exempt>true</tns:exempt>\\n </tns:ind>\\n <tns:ide>\\n <tns:number>222222</tns:number>\\n <tns:grantor>CDRH</tns:grantor>\\n <tns:holderType>NCI</tns:holderType>\\n <tns:nciDivisionProgramCode>CCR</tns:nciDivisionProgramCode>\\n <tns:expandedAccess>true</tns:expandedAccess>\\n <tns:expandedAccessType>Available</tns:expandedAccessType>\\n <tns:exempt>true</tns:exempt>\\n </tns:ide>\\n <tns:regulatoryInformation>\\n <tns:country>USA</tns:country>\\n <tns:authorityName>Federal Government</tns:authorityName>\\n <tns:fdaRegulated>true</tns:fdaRegulated>\\n <tns:section801>true</tns:section801>\\n <tns:delayedPosting>true</tns:delayedPosting>\\n <tns:dataMonitoringCommitteeAppointed>true</tns:dataMonitoringCommitteeAppointed>\\n </tns:regulatoryInformation>\\n <tns:protocolDocument filename=\\\"protocol.pdf\\\">dGVzdA==</tns:protocolDocument>\\n <tns:irbApprovalDocument filename=\\\"irb.pdf\\\">dGVzdA==</tns:irbApprovalDocument>\\n <tns:participatingSitesDocument\\n filename=\\\"sites.pdf\\\">dGVzdA==</tns:participatingSitesDocument>\\n <tns:informedConsentDocument filename=\\\"consent.pdf\\\">dGVzdA==</tns:informedConsentDocument>\\n <tns:otherDocument filename=\\\"other.pdf\\\">dGVzdA==</tns:otherDocument>\\n <tns:category>Externally Peer-Reviewed</tns:category>\\n <tns:trialOwner>qatest@nih.gov</tns:trialOwner>\\n</tns:CompleteTrialRegistration>\\n','JBAS014580: Unexpected Error','500','1012','');\n INSERT INTO webservice_access_log (identifier,datetime,client_ip,client_username,uri,method,headers,payload,response,response_code,processing_time,processing_errors) VALUES ('1618428','2018-02-21 08:34:55.261','172.18.0.1','ctrpsubstractor','/services/trials/complete/','POST','host=localhost:18080\\nconnection=keep-alive\\ncontent-length=4516\\naccept=application/xml\\npostman-token=67d3475f-2ca6-739b-c640-9757b881060b\\ncache-control=no-cache\\norigin=chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop\\nuser-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36\\nauthorization=*********\\ncontent-type=application/xml\\naccept-encoding=gzip, deflate, br\\naccept-language=en-US,en;q=0.9\\ncookie=JSESSIONID=syajca7WdyZiqoJN+WrkNoFO\\n','<tns:CompleteTrialRegistration xmlns:tns=\\\"gov.nih.nci.pa.webservices.types\\\"\\n xmlns:tns1=\\\"gov.nih.nci.po.webservices.types.trimmed\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\"\\n xsi:schemaLocation=\\\"gov.nih.nci.pa.webservices.types ../../src/resources/ws.xsd \\\">\\n\\n <tns:clinicalTrialsDotGovXmlRequired>true</tns:clinicalTrialsDotGovXmlRequired>\\n <tns:leadOrgTrialID>UPCC 348-02 II - sa2</tns:leadOrgTrialID>\\n <tns:clinicalTrialsDotGovTrialID>NCT91914277</tns:clinicalTrialsDotGovTrialID>\\n <tns:otherTrialID>818280244</tns:otherTrialID>\\n <tns:title>A Phase I/II Study Of Brentuximab Vedotin In Combination With Multi-Agent Chemotherapy II</tns:title>\\n <tns:phase>I</tns:phase>\\n <tns:pilot>false</tns:pilot>\\n <tns:accrualDiseaseTerminology>ICD10</tns:accrualDiseaseTerminology>\\n <tns:primaryPurpose>Other</tns:primaryPurpose>\\n <tns:primaryPurposeOtherDescription>Determine maximum tolerated dose (MTD) of brentuximab vedotin</tns:primaryPurposeOtherDescription>\\n <tns:interventionalDesign>\\n <tns:secondaryPurpose>Other</tns:secondaryPurpose>\\n <tns:secondaryPurposeOtherDescription>Secondary Other Description</tns:secondaryPurposeOtherDescription>\\n </tns:interventionalDesign>\\n <tns:leadOrganization>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:leadOrganization>\\n <tns:pi>\\n <tns:existingPerson>\\n <tns:poID>5000</tns:poID>\\n </tns:existingPerson>\\n </tns:pi>\\n <tns:sponsor>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:sponsor>\\n <tns:responsibleParty>\\n <tns:type>Sponsor-Investigator</tns:type>\\n <tns:investigator>\\n <tns:existingPerson>\\n <tns:poID>5000</tns:poID>\\n </tns:existingPerson>\\n </tns:investigator>\\n <tns:investigatorTitle>CEO &amp; Chairman</tns:investigatorTitle>\\n </tns:responsibleParty>\\n <tns:summary4FundingSponsor>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:summary4FundingSponsor>\\n <tns:programCode>PG00001</tns:programCode>\\n <tns:fundedByNciGrant>false</tns:fundedByNciGrant>\\n <tns:grant>\\n <tns:fundingMechanism>B09</tns:fundingMechanism>\\n <tns:nihInstitutionCode>AA</tns:nihInstitutionCode>\\n <tns:serialNumber>111111</tns:serialNumber>\\n <tns:nciDivisionProgramCode>CCR</tns:nciDivisionProgramCode>\\n <tns:fundingPercentage>100.0</tns:fundingPercentage>\\n </tns:grant>\\n <tns:trialStatus>In Review</tns:trialStatus>\\n <tns:whyStopped></tns:whyStopped>\\n <tns:trialStatusDate>2014-07-15</tns:trialStatusDate>\\n <tns:trialStartDate type=\\\"Actual\\\">2014-07-15</tns:trialStartDate>\\n <tns:primaryCompletionDate type=\\\"Anticipated\\\">2019-07-15</tns:primaryCompletionDate>\\n <tns:completionDate type=\\\"Anticipated\\\">2019-07-15</tns:completionDate>\\n <tns:ind>\\n <tns:number>111111</tns:number>\\n <tns:grantor>CDER</tns:grantor>\\n <tns:holderType>NIH</tns:holderType>\\n <tns:nihInstitution>NEI</tns:nihInstitution>\\n <tns:expandedAccess>true</tns:expandedAccess>\\n <tns:expandedAccessType>Available</tns:expandedAccessType>\\n <tns:exempt>true</tns:exempt>\\n </tns:ind>\\n <tns:ide>\\n <tns:number>222222</tns:number>\\n <tns:grantor>CDRH</tns:grantor>\\n <tns:holderType>NCI</tns:holderType>\\n <tns:nciDivisionProgramCode>CCR</tns:nciDivisionProgramCode>\\n <tns:expandedAccess>true</tns:expandedAccess>\\n <tns:expandedAccessType>Available</tns:expandedAccessType>\\n <tns:exempt>true</tns:exempt>\\n </tns:ide>\\n <tns:regulatoryInformation>\\n <tns:country>USA</tns:country>\\n <tns:authorityName>Federal Government</tns:authorityName>\\n <tns:fdaRegulated>true</tns:fdaRegulated>\\n <tns:section801>true</tns:section801>\\n <tns:delayedPosting>true</tns:delayedPosting>\\n <tns:dataMonitoringCommitteeAppointed>true</tns:dataMonitoringCommitteeAppointed>\\n </tns:regulatoryInformation>\\n <tns:protocolDocument filename=\\\"protocol.pdf\\\">dGVzdA==</tns:protocolDocument>\\n <tns:irbApprovalDocument filename=\\\"irb.pdf\\\">dGVzdA==</tns:irbApprovalDocument>\\n <tns:participatingSitesDocument\\n filename=\\\"sites.pdf\\\">dGVzdA==</tns:participatingSitesDocument>\\n <tns:informedConsentDocument filename=\\\"consent.pdf\\\">dGVzdA==</tns:informedConsentDocument>\\n <tns:otherDocument filename=\\\"other.pdf\\\">dGVzdA==</tns:otherDocument>\\n <tns:category>Externally Peer-Reviewed</tns:category>\\n <tns:trialOwner>qatest@nih.gov</tns:trialOwner>\\n</tns:CompleteTrialRegistration>\\n','<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\\n<TrialRegistrationConfirmation xmlns=\\\"gov.nih.nci.pa.webservices.types\\\" xmlns:ns2=\\\"gov.nih.nci.po.webservices.types.trimmed\\\">\\n <paTrialID>1618195</paTrialID>\\n <nciTrialID>NCI-2018-03030</nciTrialID>\\n</TrialRegistrationConfirmation>\\n','200','6255','');\n \"\n puts sql_insert_webservice_access_log\nend", "def test_insert\n\n # Try inserting from a non-Admin account.\n post(:insert, { :id => subsections(:subsection_01_1_1).id }, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try inserting from an Admin account\n post(:insert, { :id => subsections(:subsection_01_1_1).id }, cathy_admin_session)\n assert_response 200\n assert_equal(subsections(:subsection_01_1_1).checklist.id,\n assigns(:new_subsection).checklist.id)\n assert_equal(subsections(:subsection_01_1_1).section_id,\n assigns(:new_subsection).section_id)\n\n\n end", "def insert\n \n attributes = []\n instance_variables.each do |i|\n attributes << i.to_s.delete(\"@\") if (i != :@id && i != :@table)\n end\n \n values = []\n attributes.each do |a|\n value = self.send(a)\n \n if value.is_a?(Integer)\n values << \"#{value}\"\n else values << \"'#{value}'\"\n end\n end\n \n DATABASE.execute(\"INSERT INTO students (#{attributes.join(\", \")}) \n VALUES (#{values.join(\", \")})\")\n @id = DATABASE.last_insert_row_id\n\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = InsertRecordsResultSet.new(resp)\n return results\n end", "def create_method\n :put_json\n end", "def insert\n Thread.current[:\"[mongoid]:insert-consumer\"]\n end", "def insert\n Thread.current[:\"[mongoid]:insert-consumer\"]\n end", "def insert\n Thread.current[:\"[mongoid]:insert-consumer\"]\n end", "def insert(documents, flags=nil)\n documents = [documents] unless documents.is_a?(Array)\n documents.each do |doc|\n promiscuous_create_operation(:document => doc).execute { super(doc, flags) }\n end\n end", "def insert\n DATABASE.execute(\"INSERT INTO terms (term, definition, phonetic) VALUES \n ('#{@term}', '#{@definition}', '#{@phonetic}')\")\n @id = DATABASE.last_insert_row_id\n end", "def insert_routine dataset_id, new_routine_gapi\n execute { service.insert_routine @project, dataset_id, new_routine_gapi }\n end", "def insert\n DATABASE.execute(\"INSERT INTO students (name, age, github) VALUES (?, ?, ?)\", @name, @age, @github)\n @id = DATABASE.last_insert_row_id\n end", "def insert key, value\n begin\n db.putnr(key, value)\n rescue StandardError => e ; handle_error(\"Insert #{[key, value].inspect}\", e); end\n end", "def save\n if self.id.nil?\n self.insert\n else\n self.update\n end\n end", "def insert_id!(arr, insertable)\n arr << insertable\n insertable\nend", "def create_method\n :http_put\n end", "def create_method\n :http_put\n end", "def create input\n table = DB.from(@table) #DB[@table]\n \n result = table.insert input\n\n input[:id] = result\n \n # invalidate a cached range\n @@_cached_range = nil\n \n # return an instance of the model class with the data attributes\n get :id => input[:id]\n end", "def fast_insert(rows, base_cmd, end_cmd = '')\n RawDB.fast_insert(db, rows, base_cmd, end_cmd)\n end", "def insert(db, volume_id, page_number, access_date, ip_token)\n command = \"insert into results values (?, ?, datetime(?), ?);\"\n db.execute(command, volume_id, page_number, access_date, ip_token)\n end", "def create\n ActiveRecord::Base.transaction do\n begin\n @api_v1_product = Product.create!(api_v1_product_params)\n\n json_response @api_v1_product, :created\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n raise ActiveRecord::Rollback\n end\n end\n end", "def insert_dataset new_dataset_gapi\n execute { service.insert_dataset @project, new_dataset_gapi }\n end", "def insert(index, *args, **_arg2, &block); end", "def insert_into_article(title, content, price, user_id, adress, phone_number, date_created, tag_id) \n return get_db().execute(\"INSERT INTO article (title, content, price, user_id, adress, phone_number, date_created, tag_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)\", title, content, price, user_id, adress, phone_number, date_created, tag_id)\n end", "def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end", "def insertReading()\n\n #@reading_id = SecureRandom.uuid\n\n DataReading.insertReading(@client_id, @sensor_type, @value, @location, @timestamp)\n\n end" ]
[ "0.68304694", "0.67885107", "0.65469646", "0.6455043", "0.6447416", "0.62639767", "0.62388176", "0.62276345", "0.6207762", "0.61992866", "0.6194636", "0.61918", "0.6161281", "0.6146445", "0.6061359", "0.6021233", "0.60108995", "0.5947294", "0.5913008", "0.58946455", "0.5869347", "0.5824956", "0.58154213", "0.5804954", "0.5799322", "0.578927", "0.577325", "0.5726648", "0.5719533", "0.57066405", "0.5678316", "0.5678316", "0.5678316", "0.5678316", "0.5652964", "0.56495124", "0.5625753", "0.5612964", "0.5612964", "0.5608177", "0.5578834", "0.5575419", "0.55599207", "0.55599207", "0.55599207", "0.5546149", "0.55117935", "0.5511168", "0.5511168", "0.5509913", "0.5507022", "0.5501556", "0.5489685", "0.54883695", "0.5466804", "0.5466132", "0.5462412", "0.5458222", "0.54493064", "0.54474866", "0.54460776", "0.5442129", "0.54415536", "0.54269636", "0.54227734", "0.54221374", "0.54094034", "0.54086554", "0.54029626", "0.54029626", "0.54029626", "0.5392803", "0.5390646", "0.5387721", "0.5386829", "0.5384828", "0.53823394", "0.5381207", "0.53723717", "0.53723717", "0.53723717", "0.53643477", "0.5359635", "0.53576875", "0.53512156", "0.5350929", "0.53487116", "0.5348406", "0.5345307", "0.5345307", "0.53449565", "0.5341601", "0.534006", "0.53354543", "0.5333573", "0.5327483", "0.5319309", "0.5319082", "0.53098685" ]
0.54105353
67
Baseline implementation for the list REST call
def list request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_list_request request_pb response = @client_stub.make_get_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::InstanceGroupManagerList.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(params={})\n super params\n end", "def list(params={})\n super params\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def list(params)\n raise NotImplementedError\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def list\n get()\n end", "def _ls\n @response[:list] = []\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def list\n call(:get, path)\n end", "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end", "def list\n\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end", "def list(*args)\n fail \"Unacceptable HTTP Method #{request.env['REQUEST_METHOD']} for list\" unless request.get?\n {:action => 'list',\n :args => args}\n end", "def list\n raise NotImplementedError\n end", "def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end", "def list\n call! :list\n end", "def list\n end", "def list\n end", "def list\n end", "def list\n get('/')\n end", "def list_requests\n # stub\n end", "def index\n @list = List.find(params[:list_id])\n @items = @list.items\n\n respond_with @items\n end", "def list(*) end", "def list(resource,limit=0,params={})\n uri = '/api/' + resource.to_s\n params.merge!({limit: limit.to_s})\n http_get(uri,params)\n end", "def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end", "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def index\n @lists = List.inactive.paginate(page: params[:page], per_page: PER_PAGE)\n\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, items: @lists } }\n end\n end", "def list(_filter = Set.new)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def rest__list\n diff = ret_request_params(:diff)\n project = get_default_project()\n datatype = :module\n remote_repo_base = ret_remote_repo_base()\n\n opts = Opts.new(project_idh: project.id_handle())\n if detail = ret_request_params(:detail_to_include)\n opts.merge!(detail_to_include: detail.map(&:to_sym))\n end\n\n opts.merge!(remote_repo_base: remote_repo_base, diff: diff)\n datatype = :module_diff if diff\n\n rest_ok_response filter_by_namespace(TestModule.list(opts)), datatype: datatype\n end", "def list(pagination_options = {})\n page = pagination_options[:page]\n per_page = pagination_options[:per_page]\n validate_list_pagination!(page, per_page)\n qs = pagination_query_string(page: page, per_page: per_page)\n url = qs.length > 0 ? \"#{endpoint}?#{qs}\" : endpoint\n fix_list_response(@http.get(url))\n end", "def list(options = {})\n page = options[:page]\n per_page = options[:per_page]\n filters = options[:filters]\n validate_list_pagination!(page, per_page)\n qs = pagination_query_string(page: page, per_page: per_page)\n if !filters.nil? && filters.any?\n filter_qs = filter_query_string(filters)\n qs = qs.length > 0 ? \"#{qs}&#{filter_qs}\" : filter_qs\n end\n url = qs.length > 0 ? \"#{endpoint}?#{qs}\" : endpoint\n fix_list_response(@http.get(url))\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::ResourceListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"Resources.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.resources.each do |plumbing_item|\n g.yield Plumbing::convert_resource_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def lists(uid, params={})\n response = @client.get \"#{@path}/#{uid}/lists\", params\n PaginateResource.new \"#{@path}\", @client, response, Textmagic::REST::List\n end", "def list(type, parameters)\n @type = type # Keep this around to structure the output\n @response = self.request(Net::HTTP::Get.new(\n \"/#{type}.#{Format}?#{parameters}\"\n ))\n self.to_s\n end", "def list(*_filters)\n raise NotImplementedError\n end", "def initialize\n\n response = list\n end", "def index\n @list_items = @list.list_items\n end", "def index\n lists = if params[:filter]\n filter_type = params[:filter]\n case filter_type\n when \"promoted\"\n lists = List.where(promoted: true).recent.page params[:page]\n end\n elsif params[:query]\n List.search(params)\n end\n\n render :json => lists\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def list\n add_breadcrumb :list\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: PersonsDatatable.new(view_context) }\n end\n end", "def get_list\n \t@items\n end", "def index\n build_resource({})\n respond_with self.resource\n end", "def list(user_id, opts = {})\n super(user_id, ListRequest.new(opts))\n end", "def list; end", "def list; end", "def list; end", "def list; end", "def list; end", "def list\n pgnum = params[:pgnum].blank? ? 1 : params[:pgnum].to_i\n pgsize = params[:pgsize].blank? ? 0 : params[:pgsize].to_i\n sortcolumn = params[:sortcolumn].blank? ? UserHelper::DEFAULT_SORT_COLUMN : params[:sortcolumn]\n sortdir = params[:sortdir].blank? ? UserHelper::DEFAULT_SORT_DIR : params[:sortdir]\n \n sort = ApplicationHelper::Sort.new(sortcolumn, sortdir)\n \n @data = UserHelper.get_all(pgnum, pgsize, sort)\n \n respond_to do |fmt|\n fmt.html { render partial: 'list' }\n fmt.json { render json: @data }\n end\n end", "def api_list_resource(collection: nil, search_fields: nil, paginate: true,\n filtering_params: nil)\n ApiListResource.new(\n collection: collection,\n params: params,\n search_fields: search_fields,\n filtering_params: filtering_params,\n paginate: paginate\n )\n end", "def list # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + container\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json' if action == 'details'\n request.add_field 'accept', 'application/oracle-compute-v3+directory+json' if action == 'list'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end", "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "def rest__list\n Log.info(MessageQueue.object_id)\n diff = ret_request_params(:diff)\n project = get_default_project()\n namespace = ret_request_params(:module_namespace)\n datatype = :module\n remote_repo_base = ret_remote_repo_base()\n\n opts = Opts.new(project_idh: project.id_handle())\n if detail = ret_request_params(:detail_to_include)\n opts.merge!(detail_to_include: detail.map(&:to_sym))\n end\n\n opts.merge!(remote_repo_base: remote_repo_base, diff: diff, namespace: namespace)\n datatype = :module_diff if diff\n\n # rest_ok_response filter_by_namespace(ComponentModule.list(opts)), :datatype => datatype\n rest_ok_response ComponentModule.list(opts), datatype: datatype\n end", "def list(project_id, opts = {})\n super(project_id, ListRequest.new(opts))\n end", "def list(project_id, opts = {})\n super(project_id, ListRequest.new(opts))\n end", "def list(project_id, opts = {})\n super(project_id, ListRequest.new(opts))\n end", "def list(limit = nil, cursor = nil)\n qs = {}\n qs[:limit] = limit if limit\n qs[:cursor] = cursor if cursor\n\n api.get('', qs)\n end", "def render_json_api_list_resource(collection: nil, search_fields: nil,\n paginate: true, filtering_params: nil,\n response_args: {})\n resource = ApiListResource.new(\n collection: collection,\n params: params,\n search_fields: search_fields,\n filtering_params: filtering_params,\n paginate: paginate\n )\n render response_args.merge(\n json: resource.collection, meta: resource.meta_pagination\n )\n end", "def get_list(id)\n record \"/todos/list/#{id}\"\n end" ]
[ "0.7385454", "0.7385454", "0.7107155", "0.70807445", "0.70114005", "0.6957106", "0.69419384", "0.6810357", "0.6810357", "0.6801985", "0.6793892", "0.6779634", "0.67378944", "0.669565", "0.66605836", "0.66365844", "0.6626355", "0.66235787", "0.66235787", "0.66235787", "0.661495", "0.66140443", "0.66096133", "0.65972424", "0.65921235", "0.65660685", "0.65289134", "0.65289134", "0.6508061", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.6489704", "0.64785326", "0.6472439", "0.64084786", "0.6401187", "0.6384907", "0.63816524", "0.63571936", "0.6327071", "0.63090146", "0.6286856", "0.6272784", "0.6249635", "0.62410116", "0.62352777", "0.6230284", "0.6230141", "0.62287176", "0.6226914", "0.62233037", "0.62233037", "0.62233037", "0.62233037", "0.62233037", "0.62061214", "0.61979806", "0.6183144", "0.6175551", "0.6175551", "0.6175551", "0.6175551", "0.6172361", "0.61452854", "0.61452854", "0.61452854", "0.61440057", "0.6141644", "0.61380917" ]
0.0
-1
Baseline implementation for the list_managed_instances REST call
def list_managed_instances request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_list_managed_instances_request request_pb response = @client_stub.make_post_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListManagedInstancesResponse.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def list_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_instances_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::BareMetalSolution::V2::ListInstancesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def list_instances token: nil\n instances.list_instances parent: project_path, page_token: token\n end", "def list_instances token: nil\n execute do\n instances.list_instances(\n project_path,\n page_token: token\n )\n end\n end", "def describe_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"DescribeInstances\", :params => params)\n end", "def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def list\n attrcheck = { 'compartment' => @options[:compartment] }\n @validate.validate(@options, attrcheck)\n opts = {}\n opts[:availability_domain] = @options[:availability_domain] if @options[:availability_domain]\n opts[:display_name] = @options[:display_name] if @options[:display_name]\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::ComputeClient.new\n request = request.list_instances(@options[:compartment], opts)\n request.data\n end", "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def list_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_instances_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Notebooks::V1::ListInstancesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end", "def instance_list(next_token=nil)\n self.ec2_client.describe_instances(\n {\n filters: [\n {\n name: \"tag:Branch\",\n values: [\"*\"],\n },\n {\n name: \"instance-state-name\",\n values: [\"running\"],\n }\n ],\n next_token: next_token\n })\n end", "def monitor_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"MonitorInstances\", :params => params)\n end", "def managed_list(inst_id)\n uri = URI.parse(@url + \"/#{inst_id}/servers\") unless @server_name\n uri = URI.parse(@url + \"/#{inst_id}/servers/\" + @server_name) if @server_name\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end", "def index\n page = params[:page]\n per_page = (params[:per_page] || 10).to_i\n if page\n entities = _all_instances_query.page(page).per(per_page)\n render json: entities, entity: _get_class,\n meta: { total_pages: entities.total_pages, total_count: entities.total_count }\n else\n entities = _all_instances_query\n respond_with entities, entity: '_get_class'\n end\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def fetch_instances(allow_states = nil, reject_states = nil)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving instances: \" \\\n \"allow_states=#{allow_states.inspect} & \" \\\n \"reject_states=#{reject_states.inspect}\"\n return if allow_states && allow_states.empty?\n reject_states ||= []\n\n @vm_pool_ary ||= fetch_instances_batch_pool(@vm_pool)\n @vm_pool_ary.collect { |vm| fetch_instances_vm(vm, allow_states, reject_states) }.compact\n end", "def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n run_result = JSON.parse(make_call(request, uri))\n Djinn.log_debug(\"[IM] Run instances info says [#{run_result}]\")\n operation_id = run_result['operation_id']\n\n vm_info = {}\n loop {\n begin\n describe_result = describe_operation(operation_id)\n rescue Djinn::FailedNodeException => error\n Djinn.log_warn(\n \"[IM] Error describing run instances operation #{operation_id}. \" \\\n \"Error: #{error.message}\")\n next\n end\n Djinn.log_debug(\"[IM] Describe run operation has vm_info \" \\\n \"#{describe_result['vm_info'].inspect}.\")\n\n if describe_result['state'] == 'success'\n vm_info = describe_result['vm_info']\n break\n elsif describe_result['state'] == 'failed'\n raise AppScaleException.new(describe_result['reason'])\n end\n Kernel.sleep(SMALL_WAIT)\n }\n\n # ip:role:instance-id\n instances_created = []\n vm_info['public_ips'].each_index { |index|\n tmp_roles = roles[index]\n tmp_roles = 'open' if roles[index].nil?\n instances_created << {\n 'public_ip' => vm_info['public_ips'][index],\n 'private_ip' => vm_info['private_ips'][index],\n 'roles' => tmp_roles,\n 'instance_id' => vm_info['instance_ids'][index],\n 'disk' => disks[index],\n 'instance_type' => options['instance_type']\n }\n }\n\n instances_created\n end", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def vm_instances\n @conn.vminstances\n end", "def get_pvm_instances\n pvm_instances = get(\"cloud-instances/#{guid}/pvm-instances\")[\"pvmInstances\"] || []\n\n pvm_instances.map do |pvm_instance|\n get_pvm_instance(pvm_instance[\"pvmInstanceID\"])\n end\n end", "def describe_all_instances\n @os_aws.describe_all_instances\n end", "def active_instances; end", "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end", "def get_instances_description\n instances\n end", "def describe_instances\n raise RemoteException.new(:method_not_defined, \"describe_instances\")\n end", "def index\n @instances = Instance.all\n end", "def index\n @instances = Instance.all\n end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def get_instances\n instances = [ ]\n get_clouds.each do |cloud|\n instances += cloud.instances.index(:filter => [], :view => 'tiny')\n end\n instances\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Fetch the current status of the portgroup\n cmd = <<-EOF\n $portgroup_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n # We silently continue on errors otherwise PowerCLI creates an error if the\n # portgroup does not exist on the host which pollutes our $portgroup_hash return object\n $pg = Get-VirtualSwitch -Host $h -Standard -Name #{resource[:vswitch_name]} | Get-VirtualPortGroup -Name #{resource[:portgroup]} -ErrorAction SilentlyContinue\n if ($pg) {\n $obj_hash = @{}\n $obj_hash.Add('portgroup', $pg.Name)\n $obj_hash.Add('vlan', $pg.VLanId)\n $obj_hash.Add('vswitch_name', $pg.VirtualSwitchName)\n $portgroup_hash[$h.Name] = @($obj_hash)\n } else {\n # create empty hashtable\n $obj_hash = @{}\n $portgroup_hash[$h.Name] = @($obj_hash)\n }\n }\n $portgroup_hash | ConvertTo-Json\n EOF\n\n portgroups_stdout = powercli_connect_exec(cmd)[:stdout]\n\n unless portgroups_stdout.empty?\n portgroups_hash = JSON.parse(portgroups_stdout)\n cached_instances_set({})\n portgroups_hash.each do |esx_host, pg_array|\n # Extracting hash from array object\n pg_hash = pg_array[0]\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n vswitch_name: pg_hash['vswitch_name'],\n vlan: pg_hash['vlan'],\n portgroup: pg_hash['portgroup'],\n }\n end\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def list_instances(request_id)\n instances = []\n JSON.parse(resource[\"/requests/#{request_id}\"].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n end", "def index\n @instances = Instance.all\n render :json => @instances\n end", "def list_instances\n puts \"OK, Listing instances..\"\n\n response = RestClient.post( \n $uri,\n 'Version' => '2010-12-30',\n 'ACSAccessKeyId' => $ACSAccessKeyId,\n 'Format' => 'json',\n 'Timestamp' => $current_time,\n 'Rndguid' => $rndguid,\n 'Signature' => calculate_signature($api_private_key, $rndguid, $current_time),\n 'Action' => \"list-instances\")\n\n puts response\n puts response.code\nend", "def instances\n @instances ||= begin\n instances_channel = channel(\n Admin::V2::BigtableInstanceAdminClient::SERVICE_ADDRESS\n )\n Admin::V2::BigtableInstanceAdminClient.new(\n credentials: instances_channel,\n timeout: timeout,\n client_config: client_config,\n lib_name: \"gccl\",\n lib_version: Google::Cloud::Bigtable::VERSION\n )\n end\n end", "def index\n @instances = Instance.all\n render json: @instances\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def list request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Compute::V1::InstanceList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def instances\n @instances ||= aws_client.instances(filters: instance_filters).map do |instance|\n OpenStruct.new(\n with_tags(instance, private_ip: instance.private_ip_address,\n public_ip: instance.public_ip_address,\n instance: instance.instance_id)\n )\n end\n end", "def reboot_instances(list)\n link = generate_request(\"RebootInstances\", hash_params('InstanceId', list.to_a))\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def describe_instances\n return { reservations: [] } unless configured?\n\n @client.describe_instances.to_h\n end", "def instances(arg)\n case arg\n when Range\n minimum_instances arg.first\n maximum_instances arg.last\n when Fixnum\n minimum_instances arg\n maximum_instances arg\n when Hash\n nodes(arg)\n else\n raise SpecException.new(\"Don't know how to handle instances cloud input #{arg}\")\n end\n end", "def describe_abnormal_d_b_instances(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeAbnormalDBInstances'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :d_b_instance_id\n\t\t\targs[:query]['DBInstanceId'] = optional[:d_b_instance_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :page_number\n\t\t\traise ArgumentError, 'page_number must be equal or greater than 1' unless optional[:page_number] < 1\n\t\t\targs[:query]['PageNumber'] = optional[:page_number]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\traise ArgumentError, 'page_size must be equal or greater than 1' unless optional[:page_size] < 1\n\t\t\traise ArgumentError, 'page_size must be equal or less than 1000' unless optional[:page_size] > 1000\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :proxy_id\n\t\t\targs[:query]['proxyId'] = optional[:proxy_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def call_describe_instances\n\t`ec2-describe-instances >> #{EC2_DESCRIBE_INSTANCES_OUTPUT}`\nend", "def list_instances(an_array)\n SystemRepository.__list_instances(an_array)\n end", "def list_public_virtual_machine_images\n request_path = '/services/images'\n request = ManagementHttpRequest.new(:get, request_path, nil)\n response = request.call\n Serialization.virtual_machine_images_from_xml(response)\n end", "def get_virtualization_vmware_vcenter_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_vmware_vcenter_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/VmwareVcenters'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VirtualizationVmwareVcenterResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_vmware_vcenter_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VirtualizationApi#get_virtualization_vmware_vcenter_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_kubernetes_virtual_machine_instance_type_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_virtual_machine_instance_type_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInstanceTypes'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInstanceTypeResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_virtual_machine_instance_type_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#get_kubernetes_virtual_machine_instance_type_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_of_instances\n super\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def index\n @instances = Instance.page params[:page]\n authorize! :read, @instances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instances }\n end\n end", "def instances\n end", "def get_cloud_aws_virtual_machine_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudApi.get_cloud_aws_virtual_machine_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/cloud/AwsVirtualMachines'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CloudAwsVirtualMachineResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CloudApi.get_cloud_aws_virtual_machine_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudApi#get_cloud_aws_virtual_machine_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_list_request request_pb\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::InstanceGroupManagerList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def list klass, names, options, check_remote = false, &block\n ResourceInfo.list klass, self, names, options, check_remote, &block\n end", "def listNodes\n nodes = []\n me = MU::Cloud::AWS::ServerPool.find(cloud_id: cloud_id).values.first\n if me and me.instances\n me.instances.each { |instance|\n found = MU::MommaCat.findStray(\"AWS\", \"server\", cloud_id: instance.instance_id, region: @region, dummy_ok: true)\n nodes.concat(found)\n }\n end\n nodes\n end", "def instances\n @instances ||= []\n end", "def fetch_instances_batch_pool(vm_pool)\n fail 'Pool object not provided!' unless vm_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Iterating over the VM \" \\\n \"pool without batch processing\"\n\n check_retval vm_pool.info(\n OpenNebula::VirtualMachinePool::INFO_ALL,\n -1, -1,\n OpenNebula::VirtualMachinePool::INFO_NOT_DONE\n )\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Got #{vm_pool.count.inspect} VMs from pool\"\n\n vm_pool.to_a\n end", "def get_cloud_instances(cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}/instances\") \n end", "def list_ids(mixins = nil)\n id_list = []\n\n Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do\n instance_statuses = @ec2_client.describe_instance_status(include_all_instances: true).instance_statuses\n instance_statuses.each { |istatus| id_list << istatus[:instance_id] } if instance_statuses\n end\n\n id_list\n end", "def start_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = {}\n params.merge!(pathlist(\"InstanceId\", options[:instance_id]))\n return response_generator(:action => \"StartInstances\", :params => params)\n end", "def managed_models\n @managed_models\n end", "def index\n @app_instances = AppInstance.all\n end", "def unmonitor_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"UnmonitorInstances\", :params => params)\n end", "def get_instances(incl_stopped=false)\n \n instances = @ec2.describe_instances\n instances = instances.select { |x| x[:aws_groups].include? @group_name }\n \n if(instances.length == 0)\n raise CaTPAWS::EC2::Error::InstanceRetrieval, \"No instances found in this group\"\n end \n \n unless (incl_stopped)\n instances = instances.select {|x| x[:aws_state_code].to_i <= 16}\n end\n @instances = instances\n end", "def get_images\n images = get(\"cloud-instances/#{guid}/images\")[\"images\"] || []\n\n images.map do |image|\n get_image(image[\"imageID\"])\n end.compact\n end", "def get_instance_data\n JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def fetch_instance(shortname = :all, options = {})\n return instances if instances && !options[:force]\n\n fetch_stack\n unless instance_list\n self.instance_list = self.instances =\n aws_client.describe_instances(stack_id: stack[:stack_id])[:instances]\n end\n\n if shortname != :all\n fetch_layer(shortname, force: true)\n self.instances = []\n\n layers.each do |layer|\n instance = aws_client.describe_instances(\n layer_id: layer[:layer_id])\n self.instances << instance[:instances]\n end\n\n self.instances.flatten!\n end\n end", "def index\n @instances = Instance.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @instances }\n end\n end", "def list_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_list_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListPerInstanceConfigsResp.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def index\n\n credentials = Aws::Credentials.new('AKIAJ2JD2EKKFVDSR37A', 'cnZUnzuyYPqUevEPb045VJUnW55VR+rUCQrplzd/')\n ec2 = Aws::EC2::Client.new(\n region: \"us-east-1\",\n credentials: credentials\n )\n #i = ec2.instances.create(:image_id => \"ami-e3106686\")\n resp = ec2.run_instances({\n dry_run: true,\n image_id: \"ami-e3106686\", # required\n min_count: 1, # required\n max_count: 1, # required\n instance_type: \"t1.micro\", # accepts t1.micro, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, t2.micro, t2.small, t2.medium, t2.large, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, cg1.4xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge\n placement: {\n tenancy: \"default\", # accepts default, dedicated\n },\n\n block_device_mappings: [\n {\n virtual_name: \"String\",\n device_name: \"String\",\n ebs: {\n snapshot_id: \"String\",\n volume_size: 1,\n delete_on_termination: true,\n volume_type: \"standard\", # accepts standard, io1, gp2\n iops: 1,\n encrypted: true,\n },\n\n },\n ],\n monitoring: {\n enabled: true, # required\n },\n disable_api_termination: true,\n instance_initiated_shutdown_behavior: \"stop\", # accepts stop, terminate\n network_interfaces: [\n {\n delete_on_termination: true,\n private_ip_addresses: [\n {\n private_ip_address: \"172.31.2.177\", # required\n primary: true,\n },\n ],\n secondary_private_ip_address_count: 1,\n associate_public_ip_address: true,\n },\n ],\n ebs_optimized: true,\n })\n @ec2_instances = Ec2Instance.all\n end", "def terminate_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"TerminateInstances\", :params => params)\n end", "def run\n super\n\n # Get the AWS Credentials\n aws_keys = get_aws_keys_from_entity_type(_get_entity_type_string)\n return unless aws_keys.access_key && aws_keys.secret_key\n\n return unless aws_keys_valid?(aws_keys.access_key, aws_keys.secret_key, aws_keys.session_token)\n\n regions = retrieve_region_list\n instance_collection = regions.map do |r|\n retrieve_instances(r, aws_keys.access_key, aws_keys.secret_key, aws_keys.session_token)\n end\n\n instance_collection.compact!\n return if instance_collection.size.zero?\n\n create_ec2_instances(instance_collection)\n end", "def instances_names_list\n return [] unless configured?\n\n aws_instances_ids = instances_list || []\n aws_instances_ids.map { |instance| instance[:node_name] }\n end", "def instances()\n return @instances\n end", "def list(mixins = nil)\n computes = ::Occi::Core::Resources.new\n\n Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do\n rsrvts = @ec2_client.describe_instances.reservations\n rsrvts.each do |reservation|\n next unless reservation && reservation.instances\n reservation.instances.each { |instance| computes << parse_backend_obj(instance, reservation[:reservation_id]) }\n end if rsrvts\n end\n\n computes\n end", "def instances; end", "def instances; end", "def get_virtualization_vmware_datacenter_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_vmware_datacenter_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/VmwareDatacenters'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VirtualizationVmwareDatacenterResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_vmware_datacenter_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VirtualizationApi#get_virtualization_vmware_datacenter_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_private_virtual_machine_images\n request_path = '/services/vmimages'\n request = ManagementHttpRequest.new(:get, request_path, nil)\n response = request.call\n Serialization.virtual_machine_vmimages_from_xml(response)\n end", "def create_instances\n min_count = max_count = @bs.number_of_nodes\n puts \"\\nCreating #{max_count} on-demand instance(s)\"\n options = {\n 'ClientToken' => generate_token,\n 'KeyName' => Chef::Config[:knife][:aws_ssh_key_id],\n 'InstanceType' => @bs.flavor,\n 'SubnetId' => @bs[:novpc] ? nil : @bs.subnet_id,\n 'Placement.AvailabilityZone' => @bs.mixins.az.data,\n 'SecurityGroupId' => @bs.mixins.sg.data\n }\n options['EbsOptimized'] = !! @bs[:ebs_optimized]\n\n ## REVIEW\n if ami.root_device_type == \"ebs\"\n ami_map = ami.block_device_mapping.first\n block_device_mapping = {\n 'DeviceName' => ami_map['deviceName'],\n 'Ebs.VolumeSize' => ami_map['volumeSize'].to_s,\n 'Ebs.DeleteOnTermination' => ami_map['deleteOnTermination']\n }\n options['BlockDeviceMapping'] = [block_device_mapping]\n end\n\n ## Optionally only include mapped devices\n ## This way we get all of the ephemeral drives, some unmapped however\n if @bs.mixins.volume.data[:ephemeral_available]\n ephmap = @bs.mixins.volume.data.ephemeral_available.each_with_index.map do |d,i|\n {\n 'VirtualName' => \"ephemeral#{i}\",\n 'DeviceName' => d\n }\n end\n options['BlockDeviceMapping'].concat( ephmap )\n end\n\n if (max_count == 1) and @bs[:private_ip_address]\n options['PrivateIpAddress'] = @bs.private_ip_address\n puts \"Assigning IP ADDRESS : #{options['PrivateIpAddress']}\"\n end\n\n if Chef::Config[:knife][:aws_user_data]\n begin\n options['UserData']= File.read(Chef::Config[:knife][:aws_user_data])\n rescue\n ui.warn(\"Cannot read #{Chef::Config[:knife][:aws_user_data]}:\"\\\n \" #{$!.inspect}. Ignoring option.\")\n end\n end\n\n # -----------------------------------------------------------------\n tries = 5\n print_table(options, 'Launch Config')\n begin\n puts \"\\nSending request...\"\n response = connection.run_instances(@bs.image, min_count,\n max_count, options)\n ui.msg(response.inspect)\n rescue Exception => e\n ui.warn(\"#{e.message}\\nException creating instances\")\n if (tries -= 1) <= 0\n ui.warn(\"\\n\\nMax tries reached. Exiting.\\n\\n\")\n exit 1\n else\n ui.msg(\"Trying again.\\n\")\n retry\n end\n end\n # now we have our servers\n instances = response.body['instancesSet']\n # select only instances that have instanceId key and collect those ids\n # into an array\n @bs[:instance_ids] =\n instances.select {|i| i.has_key?('instanceId')}.collect do |i|\n i['instanceId']\n end\n\n puts \"\\nNumber of instances started: #{@bs.instance_ids.size}\\n\"\n sleep 10\n puts \"Getting servers..\"\n # collect an array of servers retrieved based on the instance ids we\n # obtained above\n @bs[:servers] = @bs.instance_ids.collect do |id|\n begin\n server = connection.servers.get(id)\n rescue Exception => e\n sleep 7\n retry\n end\n raise Ec2Error.new(\"server #{id} was nil\") if server.nil?\n server\n end\n end", "def list_image\n attrcheck = { 'compartment' => @options[:compartment] }\n @validate.validate(@options, attrcheck)\n opts = {}\n opts[:availability_domain] = @options[:availability_domain] if @options[:availability_domain]\n opts[:display_name] = @options[:display_name] if @options[:display_name]\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::ComputeClient.new\n request = request.list_images(@options[:compartment], opts)\n request.data\n end", "def getPAYGInstances\n self.class.get('/v1/payAsYouGo/bareMetals/instances', @options)\n end", "def available_instances\n @available_instances ||= {}\n end", "def in_service_instances\n instances([{name: :lifecycle_state, value: \"InService\"}])\n end", "def init_vms\n @vms = []\n\n response = @conn.get do |req|\n req.url \"/api/v1/vms\"\n req.headers = rest_headers\n end\n\n @vms = json(response.body)[:vms]\n end", "def list_clusters instance_id, token: nil\n execute do\n instances.list_clusters(\n instance_path(instance_id),\n page_token: token\n )\n end\n end", "def get_virtualization_vmware_virtual_machine_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_vmware_virtual_machine_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/VmwareVirtualMachines'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VirtualizationVmwareVirtualMachineResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_vmware_virtual_machine_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VirtualizationApi#get_virtualization_vmware_virtual_machine_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def reboot_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No instance IDs provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"RebootInstances\", :params => params)\n end", "def get_virtualization_vmware_cluster_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_vmware_cluster_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/VmwareClusters'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VirtualizationVmwareClusterResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_vmware_cluster_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VirtualizationApi#get_virtualization_vmware_cluster_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def objects(params = {})\n Proxy.new(lambda { list_bucket(params) }, :owner => self, :extend => ObjectsExtension)\n end", "def clean_instances(allowed_age, whitelist=nil)\n deleted = []\n undeleted = []\n @gate.instances.each do |instance|\n if is_opsworks_instance instance\n undeleted << instance.inspect\n else\n if expired(instance.launch_time,allowed_age) and instance.status != :terminated\n begin\n if whitelisted(instance.instance_id, whitelist)\n undeleted << instance.inspect\n else\n instance.api_termination_disabled=false\n instance.delete\n deleted << instance.inspect\n end\n rescue AWS::Errors::Base => e\n undeleted << instance.inspect\n end\n end\n end\n end\n return deleted, undeleted\n end", "def index\n @test_instances = TestInstance.all\n end", "def list_clusters instance_id, token: nil\n instances.list_clusters parent: instance_path(instance_id), page_token: token\n end", "def db_instances(region)\n logger.info(\"fetching db instances of region #{region}\")\n rds_client = get_rds_client(region)\n next_token = nil\n rds_instances = []\n\n loop do\n options = { marker: next_token }\n resp = rds_client.describe_db_instances(options)\n rds_instances += resp.db_instances\n next_token = resp.marker\n break unless next_token\n end\n rds_instances\n end", "def list(options, args)\n if !options[:host]\n # This case is to list available hosts, instead other object\n list_hosts(options)\n else\n vi_client = VCenterDriver::VIClient.new_from_host(\n options[:host]\n )\n importer = VCenterDriver::VcImporter.new_child(\n @client,\n vi_client,\n options[:object]\n )\n\n list_object(options, importer.retrieve_resources(args))\n end\n end", "def get_instances_description\n @cached_descriptions ||= EC2ResponseObject.get_descriptions(ec2.describe_instances).sort_by {|a| a[:launching_time]}\n end", "def instances\n @instances ||= init_instances.reject(&:terminated?)\n end" ]
[ "0.6785314", "0.6707827", "0.67024165", "0.66163045", "0.6592045", "0.6518914", "0.6486547", "0.6375934", "0.6336464", "0.62879074", "0.6271091", "0.62462926", "0.6223105", "0.61295605", "0.6087064", "0.6024314", "0.5995872", "0.5994039", "0.5987333", "0.594529", "0.59224355", "0.59216124", "0.5916905", "0.5845345", "0.5842729", "0.58153605", "0.581175", "0.58052367", "0.58052367", "0.57611024", "0.5757575", "0.5751564", "0.57461816", "0.5713002", "0.56682485", "0.56494313", "0.56334186", "0.5632022", "0.5632003", "0.5595609", "0.555984", "0.55556077", "0.5520962", "0.54963386", "0.54942787", "0.5493955", "0.5472735", "0.543513", "0.5430901", "0.5425358", "0.5424359", "0.5412754", "0.54056215", "0.5389605", "0.5379575", "0.5379132", "0.537658", "0.5373852", "0.5368122", "0.53498244", "0.53375584", "0.5324861", "0.5323898", "0.5319686", "0.5316259", "0.53115416", "0.5308611", "0.5306955", "0.5301375", "0.52969354", "0.52955157", "0.5292171", "0.5290097", "0.5281086", "0.5257264", "0.52537054", "0.5252494", "0.5240137", "0.5240056", "0.5240056", "0.5228077", "0.5220256", "0.52116716", "0.5210676", "0.5196522", "0.5195557", "0.516903", "0.5167513", "0.5166484", "0.5157388", "0.5155968", "0.5148828", "0.5142126", "0.513655", "0.51266307", "0.5113085", "0.51110744", "0.51025784", "0.50966215", "0.50685096" ]
0.72735983
0
Baseline implementation for the list_per_instance_configs REST call
def list_per_instance_configs request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_list_per_instance_configs_request request_pb response = @client_stub.make_post_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListPerInstanceConfigsResp.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_instances\n return { reservations: [] } unless configured?\n\n @client.describe_instances.to_h\n end", "def enum_configs\n host = session.session_host\n port = session.session_port\n exec_commands = [\n {\n 'cmd' => '/export verbose',\n 'fn' => 'get_config',\n 'desc' => 'Get Device Config on Mikrotik Device'\n },\n ]\n exec_commands.each do |ec|\n command = ec['cmd']\n cmd_out = session.shell_command(command).gsub(/#{command}/, '')\n print_status(\"Gathering info from #{command}\")\n # detect if we're in pagination and get as much data as possible\n if ec['fn'] == 'get_config'\n mikrotik_routeros_config_eater(host, port, cmd_out.strip)\n else\n cmd_loc = store_loot(\"mikrotik.#{ec['fn']}\",\n 'text/plain',\n session,\n cmd_out.strip,\n \"#{ec['fn']}.txt\",\n ec['desc'])\n vprint_good(\"Saving to #{cmd_loc}\")\n end\n end\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def update_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_update_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Fetch the current status of the portgroup\n cmd = <<-EOF\n $portgroup_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n # We silently continue on errors otherwise PowerCLI creates an error if the\n # portgroup does not exist on the host which pollutes our $portgroup_hash return object\n $pg = Get-VirtualSwitch -Host $h -Standard -Name #{resource[:vswitch_name]} | Get-VirtualPortGroup -Name #{resource[:portgroup]} -ErrorAction SilentlyContinue\n if ($pg) {\n $obj_hash = @{}\n $obj_hash.Add('portgroup', $pg.Name)\n $obj_hash.Add('vlan', $pg.VLanId)\n $obj_hash.Add('vswitch_name', $pg.VirtualSwitchName)\n $portgroup_hash[$h.Name] = @($obj_hash)\n } else {\n # create empty hashtable\n $obj_hash = @{}\n $portgroup_hash[$h.Name] = @($obj_hash)\n }\n }\n $portgroup_hash | ConvertTo-Json\n EOF\n\n portgroups_stdout = powercli_connect_exec(cmd)[:stdout]\n\n unless portgroups_stdout.empty?\n portgroups_hash = JSON.parse(portgroups_stdout)\n cached_instances_set({})\n portgroups_hash.each do |esx_host, pg_array|\n # Extracting hash from array object\n pg_hash = pg_array[0]\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n vswitch_name: pg_hash['vswitch_name'],\n vlan: pg_hash['vlan'],\n portgroup: pg_hash['portgroup'],\n }\n end\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def instance_list(next_token=nil)\n self.ec2_client.describe_instances(\n {\n filters: [\n {\n name: \"tag:Branch\",\n values: [\"*\"],\n },\n {\n name: \"instance-state-name\",\n values: [\"running\"],\n }\n ],\n next_token: next_token\n })\n end", "def index\n\t\t@list_configs = current_user.list_configs.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @list_configs }\n\t\t\tformat.json { render :json => @list_configs }\n\t\t\tformat.yaml { render :text => @list_configs.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend", "def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n run_result = JSON.parse(make_call(request, uri))\n Djinn.log_debug(\"[IM] Run instances info says [#{run_result}]\")\n operation_id = run_result['operation_id']\n\n vm_info = {}\n loop {\n begin\n describe_result = describe_operation(operation_id)\n rescue Djinn::FailedNodeException => error\n Djinn.log_warn(\n \"[IM] Error describing run instances operation #{operation_id}. \" \\\n \"Error: #{error.message}\")\n next\n end\n Djinn.log_debug(\"[IM] Describe run operation has vm_info \" \\\n \"#{describe_result['vm_info'].inspect}.\")\n\n if describe_result['state'] == 'success'\n vm_info = describe_result['vm_info']\n break\n elsif describe_result['state'] == 'failed'\n raise AppScaleException.new(describe_result['reason'])\n end\n Kernel.sleep(SMALL_WAIT)\n }\n\n # ip:role:instance-id\n instances_created = []\n vm_info['public_ips'].each_index { |index|\n tmp_roles = roles[index]\n tmp_roles = 'open' if roles[index].nil?\n instances_created << {\n 'public_ip' => vm_info['public_ips'][index],\n 'private_ip' => vm_info['private_ips'][index],\n 'roles' => tmp_roles,\n 'instance_id' => vm_info['instance_ids'][index],\n 'disk' => disks[index],\n 'instance_type' => options['instance_type']\n }\n }\n\n instances_created\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def delete_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_delete_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def index\n @api_configs = ApiConfig.all\n end", "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end", "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def get_kubernetes_config_result_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_config_result_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/ConfigResults'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesConfigResultResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_config_result_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#get_kubernetes_config_result_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def generate_config_for(mode)\n config_items = []\n @cluster_members.each do |mem|\n # The config item should match the structure NodeInfo\n # in node/cluster/membership.go in order for that one\n # to unmarshal successfully.\n config_item = {node_id: mem.id}\n if :docker.eql? mode\n config_item[:rpc_url] = \"#{mem.id}:#{mem.rpc_port}\"\n config_item[:api_url] = \"#{mem.id}:#{mem.api_port}\"\n else\n config_item[:rpc_url] = \"localhost:#{mem.rpc_port}\"\n config_item[:api_url] = \"localhost:#{mem.api_port}\"\n end\n config_items << config_item\n end\n config_items\n end", "def active_instances; end", "def index\n @app_configs = AppConfig.all\n end", "def instance_config project_id:, instance_config_id:\n # [START spanner_get_instance_config]\n # project_id = \"Your Google Cloud project ID\"\n # instance_config_id = \"Spanner instance config ID\"\n\n require \"google/cloud/spanner\"\n require \"google/cloud/spanner/admin/instance\"\n\n instance_admin_client = Google::Cloud::Spanner::Admin::Instance.instance_admin\n\n instance_config_path = instance_admin_client.instance_config_path \\\n project: project_id, instance_config: instance_config_id\n config = instance_admin_client.get_instance_config name: instance_config_path\n\n puts \"Available leader options for instance config #{config.name} : #{config.leader_options}\"\n # [END spanner_get_instance_config]\nend", "def patch_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_patch_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def describe_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"DescribeInstances\", :params => params)\n end", "def index\n @machine_configs = MachineConfig.all\n end", "def describe_all_instances\n @os_aws.describe_all_instances\n end", "def ec2_instance_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n i = {\n :placement => {\n :availability_zone => config[:availability_zone]\n },\n :instance_type => config[:instance_type],\n :ebs_optimized => config[:ebs_optimized],\n :image_id => config[:image_id],\n :key_name => config[:aws_ssh_key_id],\n :subnet_id => config[:subnet_id],\n :private_ip_address => config[:private_ip_address]\n }\n i[:block_device_mappings] = block_device_mappings unless block_device_mappings.empty?\n i[:security_group_ids] = config[:security_group_ids] if config[:security_group_ids]\n i[:user_data] = prepared_user_data if prepared_user_data\n if config[:iam_profile_name]\n i[:iam_instance_profile] = { :name => config[:iam_profile_name] }\n end\n if !config.fetch(:associate_public_ip, nil).nil?\n i[:network_interfaces] =\n [{\n :device_index => 0,\n :associate_public_ip_address => config[:associate_public_ip],\n :delete_on_termination => true\n }]\n # If specifying `:network_interfaces` in the request, you must specify\n # network specific configs in the network_interfaces block and not at\n # the top level\n if config[:subnet_id]\n i[:network_interfaces][0][:subnet_id] = i.delete(:subnet_id)\n end\n if config[:private_ip_address]\n i[:network_interfaces][0][:private_ip_address] = i.delete(:private_ip_address)\n end\n if config[:security_group_ids]\n i[:network_interfaces][0][:groups] = i.delete(:security_group_ids)\n end\n end\n i\n end", "def index\n @app_configs = AppConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_configs }\n end\n end", "def index\n @docker_cfgs = DockerCfg.all\n end", "def list_respond_to_atom\n @configurations = Configuration.find(:all, :order => 'configurations.id DESC', :limit => Configuration.find_retry(:name => \"atom.max_entries\", :namespace => \"Configuration\").to_i)\n\n respond_to do |format|\n format.atom\n end\n end", "def index\n @app_instances = AppInstance.all\n end", "def list_apps\n render :text => app_configs.keys\n end", "def configs\n @configuration.ids\n end", "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end", "def get_instances_description\n instances\n end", "def index\n @config_values = ConfigValue\n .page(params[:page])\n .per(10)\n end", "def index\n @configs = Config.all\n end", "def instances\n end", "def list_uptime_check_configs project_id\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n project_name = client.project_path project: project_id\n configs = client.list_uptime_check_configs parent: project_name\n\n configs.each { |config| puts config.name }\nend", "def all(options={})\n application_filter = []\n if options.key?('ApplicationName')\n application_filter << options['ApplicationName']\n end\n\n # Initialize with empty array\n data = []\n\n applications = service.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications']\n applications.each { |application|\n application['ConfigurationTemplates'].each { |template_name|\n begin\n options = {\n 'ApplicationName' => application['ApplicationName'],\n 'TemplateName' => template_name\n }\n settings = service.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']\n if settings.length == 1\n # Add to data\n data << settings.first\n end\n rescue Fog::AWS::ElasticBeanstalk::InvalidParameterError\n # Ignore\n end\n\n }\n }\n\n load(data) # data is an array of attribute hashes\n end", "def all\n JSON.parse(@client.call('config.get'))\n end", "def list_instances token: nil\n instances.list_instances parent: project_path, page_token: token\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def get_kubernetes_config_result_entry_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_config_result_entry_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/ConfigResultEntries'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesConfigResultEntryResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_config_result_entry_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#get_kubernetes_config_result_entry_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n page = params[:page]\n per_page = (params[:per_page] || 10).to_i\n if page\n entities = _all_instances_query.page(page).per(per_page)\n render json: entities, entity: _get_class,\n meta: { total_pages: entities.total_pages, total_count: entities.total_count }\n else\n entities = _all_instances_query\n respond_with entities, entity: '_get_class'\n end\n end", "def list(resource_group = configuration.resource_group, skip_accessors_definition = false)\n super.each { |model| model.configuration = configuration }\n end", "def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend", "def subconfigs!\n @schema.subconfigs!\n end", "def index\n @kernel_configs = KernelConfig.all\n end", "def vm_instances\n @conn.vminstances\n end", "def index\n @jenkins_app_configs = JenkinsAppConfig.all\n end", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def instance_config(opts = {})\n {\n dry_run: env(:testing) || false,\n image_id: image('crawlbotprod').image_id, # image(:neuron).image_id\n instance_type: 't2.nano',\n min_count: opts[:max_count],\n max_count: 0,\n key_name: 'crawlBot',\n security_groups: ['webCrawler'],\n security_group_ids: ['sg-940edcf2'],\n placement: { availability_zone: 'us-west-2c' },\n disable_api_termination: 'false',\n instance_initiated_shutdown_behavior: 'terminate'\n }.merge(opts)\n end", "def create_instances\n min_count = max_count = @bs.number_of_nodes\n puts \"\\nCreating #{max_count} on-demand instance(s)\"\n options = {\n 'ClientToken' => generate_token,\n 'KeyName' => Chef::Config[:knife][:aws_ssh_key_id],\n 'InstanceType' => @bs.flavor,\n 'SubnetId' => @bs[:novpc] ? nil : @bs.subnet_id,\n 'Placement.AvailabilityZone' => @bs.mixins.az.data,\n 'SecurityGroupId' => @bs.mixins.sg.data\n }\n options['EbsOptimized'] = !! @bs[:ebs_optimized]\n\n ## REVIEW\n if ami.root_device_type == \"ebs\"\n ami_map = ami.block_device_mapping.first\n block_device_mapping = {\n 'DeviceName' => ami_map['deviceName'],\n 'Ebs.VolumeSize' => ami_map['volumeSize'].to_s,\n 'Ebs.DeleteOnTermination' => ami_map['deleteOnTermination']\n }\n options['BlockDeviceMapping'] = [block_device_mapping]\n end\n\n ## Optionally only include mapped devices\n ## This way we get all of the ephemeral drives, some unmapped however\n if @bs.mixins.volume.data[:ephemeral_available]\n ephmap = @bs.mixins.volume.data.ephemeral_available.each_with_index.map do |d,i|\n {\n 'VirtualName' => \"ephemeral#{i}\",\n 'DeviceName' => d\n }\n end\n options['BlockDeviceMapping'].concat( ephmap )\n end\n\n if (max_count == 1) and @bs[:private_ip_address]\n options['PrivateIpAddress'] = @bs.private_ip_address\n puts \"Assigning IP ADDRESS : #{options['PrivateIpAddress']}\"\n end\n\n if Chef::Config[:knife][:aws_user_data]\n begin\n options['UserData']= File.read(Chef::Config[:knife][:aws_user_data])\n rescue\n ui.warn(\"Cannot read #{Chef::Config[:knife][:aws_user_data]}:\"\\\n \" #{$!.inspect}. Ignoring option.\")\n end\n end\n\n # -----------------------------------------------------------------\n tries = 5\n print_table(options, 'Launch Config')\n begin\n puts \"\\nSending request...\"\n response = connection.run_instances(@bs.image, min_count,\n max_count, options)\n ui.msg(response.inspect)\n rescue Exception => e\n ui.warn(\"#{e.message}\\nException creating instances\")\n if (tries -= 1) <= 0\n ui.warn(\"\\n\\nMax tries reached. Exiting.\\n\\n\")\n exit 1\n else\n ui.msg(\"Trying again.\\n\")\n retry\n end\n end\n # now we have our servers\n instances = response.body['instancesSet']\n # select only instances that have instanceId key and collect those ids\n # into an array\n @bs[:instance_ids] =\n instances.select {|i| i.has_key?('instanceId')}.collect do |i|\n i['instanceId']\n end\n\n puts \"\\nNumber of instances started: #{@bs.instance_ids.size}\\n\"\n sleep 10\n puts \"Getting servers..\"\n # collect an array of servers retrieved based on the instance ids we\n # obtained above\n @bs[:servers] = @bs.instance_ids.collect do |id|\n begin\n server = connection.servers.get(id)\n rescue Exception => e\n sleep 7\n retry\n end\n raise Ec2Error.new(\"server #{id} was nil\") if server.nil?\n server\n end\n end", "def index\n @configurations = ::Configuration.all\n end", "def monitor_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"MonitorInstances\", :params => params)\n end", "def matched_configs\n [@full_config['environments'][environment], @full_config['nodes'][fqdn]]\n end", "def index\n @sysconfigs = Sysconfig.order(created_at: :desc).page(params[:page])\n end", "def list\n attrcheck = { 'compartment' => @options[:compartment] }\n @validate.validate(@options, attrcheck)\n opts = {}\n opts[:availability_domain] = @options[:availability_domain] if @options[:availability_domain]\n opts[:display_name] = @options[:display_name] if @options[:display_name]\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::ComputeClient.new\n request = request.list_instances(@options[:compartment], opts)\n request.data\n end", "def cluster_list\n super\n end", "def show\n @global_config = AppConfig.where(:section => params[:sect])\n @global_config.each do |conf|\n puts conf.confkey\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @global_config }\n end\n end", "def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def list_resource\n find_resource!(:template, \"#{new_resource.conf_dir}/list.conf\")\n end", "def instances\n @instances ||= aws_client.instances(filters: instance_filters).map do |instance|\n OpenStruct.new(\n with_tags(instance, private_ip: instance.private_ip_address,\n public_ip: instance.public_ip_address,\n instance: instance.instance_id)\n )\n end\n end", "def list_configs(lb_id, headers = {})\n get!(\"loadbalancers/#{lb_id}/configs\", {}, headers)\n end", "def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end", "def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end", "def to_configure_vapp_hash\n {\n :name => name,\n :cpus => cpus,\n :memory => memory,\n :disks => disks.map {|d| { :number => d.address.to_s, :size => d.vcloud_size, :resource => d.vcloud_size.to_s } }\n }\n end", "def to_configure_vapp_hash\n {\n :name => name,\n :cpus => cpus,\n :memory => memory,\n :disks => disks.map {|d| { :number => d.address.to_s, :size => d.vcloud_size, :resource => d.vcloud_size.to_s } }\n }\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end", "def list(mixins = nil)\n computes = ::Occi::Core::Resources.new\n\n Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do\n rsrvts = @ec2_client.describe_instances.reservations\n rsrvts.each do |reservation|\n next unless reservation && reservation.instances\n reservation.instances.each { |instance| computes << parse_backend_obj(instance, reservation[:reservation_id]) }\n end if rsrvts\n end\n\n computes\n end", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def configuration_deployment_summary_per_app\n return @configuration_deployment_summary_per_app\n end", "def config\n config = {}\n config['recipes'] = []\n config['recipes'] |= hash_path(@default_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(@default_config, 'recipes', @platform) || []\n @group_configs.each do |group_name, group_config|\n config['recipes'] |= hash_path(group_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(group_config, 'recipes', @platform) || []\n end\n people_recipes = @people_config['recipes'] || {}\n config['recipes'] |= people_recipes['global'] || []\n config['recipes'] |= people_recipes[@platform] || []\n config['attributes'] = {}\n config['attributes'].deep_merge!(@default_config['attributes'] || {}) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n @group_configs.each do |group_name, group_config|\n config['attributes'].deep_merge!(group_config['attributes']) { |key, old, new| Array.wrap(old) + Array.wrap(new) } unless group_config['attributes'].nil?\n end\n people_attributes = @people_config['attributes'] || {}\n config['attributes'].deep_merge!(people_attributes) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n config\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def load_instances_and_volumes\n cluster_instances = cluster_config[:instances] or return\n cluster_instances.each do |role, instances_for_role|\n role = role.to_s\n instances_for_role.each_with_index do |instance_cfg, instance_idx|\n load_instance role, instance_idx, instance_cfg\n end\n end\n end", "def index\n\n credentials = Aws::Credentials.new('AKIAJ2JD2EKKFVDSR37A', 'cnZUnzuyYPqUevEPb045VJUnW55VR+rUCQrplzd/')\n ec2 = Aws::EC2::Client.new(\n region: \"us-east-1\",\n credentials: credentials\n )\n #i = ec2.instances.create(:image_id => \"ami-e3106686\")\n resp = ec2.run_instances({\n dry_run: true,\n image_id: \"ami-e3106686\", # required\n min_count: 1, # required\n max_count: 1, # required\n instance_type: \"t1.micro\", # accepts t1.micro, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, t2.micro, t2.small, t2.medium, t2.large, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, cg1.4xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge\n placement: {\n tenancy: \"default\", # accepts default, dedicated\n },\n\n block_device_mappings: [\n {\n virtual_name: \"String\",\n device_name: \"String\",\n ebs: {\n snapshot_id: \"String\",\n volume_size: 1,\n delete_on_termination: true,\n volume_type: \"standard\", # accepts standard, io1, gp2\n iops: 1,\n encrypted: true,\n },\n\n },\n ],\n monitoring: {\n enabled: true, # required\n },\n disable_api_termination: true,\n instance_initiated_shutdown_behavior: \"stop\", # accepts stop, terminate\n network_interfaces: [\n {\n delete_on_termination: true,\n private_ip_addresses: [\n {\n private_ip_address: \"172.31.2.177\", # required\n primary: true,\n },\n ],\n secondary_private_ip_address_count: 1,\n associate_public_ip_address: true,\n },\n ],\n ebs_optimized: true,\n })\n @ec2_instances = Ec2Instance.all\n end", "def instances\n @instances ||= begin\n instances_channel = channel(\n Admin::V2::BigtableInstanceAdminClient::SERVICE_ADDRESS\n )\n Admin::V2::BigtableInstanceAdminClient.new(\n credentials: instances_channel,\n timeout: timeout,\n client_config: client_config,\n lib_name: \"gccl\",\n lib_version: Google::Cloud::Bigtable::VERSION\n )\n end\n end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.desc)}\n return(cfg)\n end", "def configurations\n @configurations ||= []\n end", "def get_list\n\n @context.storage.get_configuration('participant_list') ||\n { 'type' => 'configurations',\n '_id' => 'participant_list',\n 'list' => [] }\n end", "def db_instance_automated_backups_replications\n data[:db_instance_automated_backups_replications]\n end", "def list()\n puts \"Listing all endpoints\"\n load_manifest\n\n pp manifest.keys\n\n end", "def server_configurations\n response = get \"server_size\"\n response[\"server_sizes\"][\"server_size\"]\n end", "def index\n @instances = Instance.all\n render :json => @instances\n end", "def instances_names_list\n return [] unless configured?\n\n aws_instances_ids = instances_list || []\n aws_instances_ids.map { |instance| instance[:node_name] }\n end", "def index\n @system_configs = SystemConfig.all\n end", "def list_app_profiles instance_id\n instances.list_app_profiles parent: instance_path(instance_id)\n end", "def components_list host_instance\n values = []\n host_instance.roles.each do |role|\n # This addresses an error in older config files\n role_value = role == :dbserver ? 'datastore' : role.to_s\n values << role_value\n end\n if host_instance.is_load_balancer?\n values << 'load_balancer'\n end\n \"[\" + values.map{ |r| \"'#{r}'\" }.join(',') + \"]\"\nend", "def index\n\n if request.format == Mime::XML\n limit=params[:limit].nil? ? 1000: params[:limit]\n else\n limit=params[:limit].nil? ? 50 : params[:limit]\n end\n\n config_template_id=params[:config_template_id]\n @config_template=ConfigTemplate.find(config_template_id)\n\n @node_configs = NodeConfig.find(:all, :conditions => [\"config_template_id = ?\", config_template_id], :order => \"hostname DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @node_configs }\n format.json { render :json => @node_configs }\n end\n end", "def status\n begin\n output = adm \"-z\", @resource[:name], :list, \"-p\"\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n main = self.class.line2hash(output.chomp)\n\n # Now add in the configuration information\n config_status.each do |name, value|\n main[name] = value\n end\n\n main\n end", "def list_instances token: nil\n execute do\n instances.list_instances(\n project_path,\n page_token: token\n )\n end\n end", "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def config\n @config ||= yaml_content || {\n 'apiVersion' => 'v1',\n 'clusters' => [],\n 'contexts' => [],\n 'current-context' => nil,\n 'kind' => 'Config',\n 'preferences' => {},\n 'users' => []\n }\n end", "def gen_node_configs(cluster_yml)\n master_n = cluster_yml['master_n']\n master_mem = cluster_yml['master_mem']\n master_cpus = cluster_yml['master_cpus']\n slave_n = cluster_yml['slave_n']\n slave_mem = cluster_yml['slave_mem']\n slave_cpus = cluster_yml['slave_cpus']\n master_ipbase = cluster_yml['master_ipbase']\n slave_ipbase = cluster_yml['slave_ipbase']\n master_instance_type = cluster_yml['master_instance_type']\n slave_instance_type = cluster_yml['slave_instance_type']\n master_droplet_size = cluster_yml['master_droplet_size']\n slave_droplet_size = cluster_yml['slave_droplet_size']\n\n master_infos = (1..master_n).map do |i|\n { :hostname => \"master#{i}\",\n :ip => master_ipbase + \"#{10+i}\",\n :mem => master_mem,\n :cpus => master_cpus,\n :instance_type => master_instance_type,\n :size => master_droplet_size\n }\n end\n slave_infos = (1..slave_n).map do |i|\n { :hostname => \"slave#{i}\",\n :ip => slave_ipbase + \"#{10+i}\",\n :mem => slave_mem,\n :cpus => slave_cpus,\n :instance_type => slave_instance_type,\n :size => slave_droplet_size\n }\n end\n\n return { :master => master_infos, :slave=>slave_infos }\nend", "def run_list\n json[:run_list]\n end", "def list\n Dir.glob(\"#{App.config.resource_directory}/*.yaml\").each do |res|\n puts File.basename(res, '.yaml')\n end\n end", "def all\n data = []\n if @ec2_main.settings.openstack \n conn = @ec2_main.environment.connection\n if conn != nil\n begin \n x = conn.flavors.all\n x.each do |y|\n vcpu = nil\n begin \n vcpu = y.vcpus\n rescue\n vcpu = nil \n end\n if vcpu != nil \n data.push(\"#{y.id} (#{y.name} Mem: #{y.ram}MB Disk: #{y.disk}GB VCPU: #{y.vcpus}VCPUs)\")\n else\n data.push(\"#{y.id} (#{y.name} Mem: #{y.ram}MB Disk: #{y.disk}GB)\") \n end\n end\n rescue\n puts \"ERROR: getting all flavors #{$!}\"\n end\n else \n raise \"Connection Error\" \n end \n elsif @ec2_main.settings.google \n conn = @ec2_main.environment.connection\n if conn != nil\n begin \n response = conn.list_machine_types($google_zone)\n\t\t\t if response.status == 200\n\t x = response.body['items']\n\t x.each do |r|\n\t\t\t\t data.push(\"#{r['name']} ( Mem: #{r['memoryMb']}MB Disks: #{r['maximumPersistentDisks']} Disk Size: #{r['maximumPersistentDisksSizeGb']}GB CPUs: #{r['guestCpus']})\")\n \t end\n\t else\n\t \t data = []\n end\n rescue\n puts \"ERROR: getting all flavors #{$!}\"\n end\n else \n raise \"Connection Error\" \n end \t\t\n\t else \n data.push('t1.micro (EBS only Micro 32 or 64-bit, 613 MB, up to 2 compute unit)') \n data.push('m1.small (Small 32 or 64-bit, 1.7 GB, 1 compute unit)')\n data.push('m1.medium (Medium 32 or 64-bit, 3.75 GB, 2 compute unit)')\n data.push('m1.large (Large 64-bit, 7.5 GB, 4 compute unit)')\n data.push('m1.xlarge (Extra Large 64-bit, 15 GB, 8 compute unit)')\n data.push('m3.xlarge (EBS Only Extra Large 64-bit, 15 GB, 13 compute unit)')\n data.push('m3.2xlarge (EBS Only Extra Double Large 64-bit, 30 GB, 26 compute unit)')\n data.push('m2.xlarge (High Memory Extra Large 64-bit, 17.1 GB, 6.5 compute unit)')\n data.push('m2.2xlarge (High Memory Double Extra Large 64-bit, 34.2 GB, 13 compute unit)')\n data.push('m2.4xlarge (High Memory Quadruple Large 64-bit, 68.4 GB, 26 compute unit)')\n data.push('c1.medium (Compute optimized CPU Medium 32 or 64-bit, 1.7 GB, 5 compute unit)')\n data.push('c1.xlarge (Compute optimized CPU Extra Large 64-bit, 7 GB, 20 compute unit)')\n data.push('c3.xlarge (Compute optimized Extra Large 64-bit, 3.75 GB, 7 compute unit)')\n data.push('c3.2xlarge (Compute optimized Double Extra Large 64-bit, 7 GB, 14 compute unit)')\n data.push('c3.4xlarge (Compute optimized Quadruple Large 64-bit, 15 GB, 28 compute unit)')\t\n data.push('c3.8xlarge (Compute optimized Eight Large 64-bit, 30 GB, 55 compute unit)')\n data.push('i2.xlarge\t\t (High I/O 1x800 GB SSD, 30.5 GB, 14 compute unit)')\n data.push('i2.2xlarge\t\t (High I/O 2x800 GB SSD, 61 GB, 27 compute unit)')\n data.push('i2.4xlarge\t\t (High I/O 4x800 GB SSD, 122 GB, 53 compute unit)')\n data.push('i2.8xlarge\t \t (High I/O 8x800 GB SSD, 244 GB, 104 compute unit)')\t\t \n data.push('cc1.4xlarge (Cluster Compute Quadruple Extra Large 64-bit, 23 GB, 33.5 compute unit. 10GBit network)')\n data.push('cc2.8xlarge (Cluster Compute Eight Extra Large 64-bit, 60.5 GB, 88 compute unit. 10GBit network)')\n\t\t data.push('g2.2xlarge (Cluster GPU Quadruple Extra Large 64-bit, 15 GB, 26compute unit.)') \n data.push('cg1.4xlarge (Cluster GPU Quadruple Extra Large 64-bit, 22 GB, 33.5 compute unit. 10GBit network)') \n data.push('hi1.4xlarge (High I/O Quadruple Extra Large 64-bit, 60.5 GB, 2x1024GB SSD, 35 compute unit. 10GBit network)')\n\t\t data.push('hs1.8xlarge (High I/O Quadruple Extra Large 64-bit, 117 GB, 24x2048GB SSD, 35 compute unit. 10GBit network)')\n \t\t\n end \n return data\n end", "def get_kubernetes_virtual_machine_instance_type_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_virtual_machine_instance_type_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInstanceTypes'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInstanceTypeResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_virtual_machine_instance_type_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#get_kubernetes_virtual_machine_instance_type_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def status\n begin\n output = adm '-z', @resource[:name], :list, '-p'\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n main = self.class.line2hash(output.chomp)\n\n # Now add in the configuration information\n config_status.each do |name, value|\n main[name] = value\n end\n\n main\n end", "def subconfigs!\n @validators.keys.find_all { |key| @validators[key] == SUBCONFIG }\n end" ]
[ "0.5900954", "0.5900258", "0.5876186", "0.57415944", "0.5683448", "0.56613314", "0.5642259", "0.55652124", "0.5553273", "0.55482", "0.55456716", "0.5534673", "0.5513303", "0.5498094", "0.54680383", "0.5464475", "0.5461902", "0.5444085", "0.54376256", "0.5437029", "0.53954875", "0.537039", "0.5369204", "0.5368763", "0.53597397", "0.5356992", "0.5352501", "0.5329797", "0.53160864", "0.5311892", "0.5309423", "0.52910966", "0.52889925", "0.52714586", "0.5270684", "0.52649087", "0.5263144", "0.5254956", "0.5254028", "0.525182", "0.5250304", "0.5244395", "0.52439356", "0.5237453", "0.5225978", "0.52196175", "0.5215687", "0.5212882", "0.52074724", "0.5202115", "0.5181918", "0.51795137", "0.5173635", "0.516789", "0.51677406", "0.51606894", "0.5151524", "0.5150969", "0.5125381", "0.5119016", "0.51189977", "0.5117241", "0.5117241", "0.51157135", "0.51157135", "0.5107493", "0.5107493", "0.5107493", "0.5102782", "0.5096756", "0.5095602", "0.5094173", "0.5076621", "0.5073719", "0.5071048", "0.5067851", "0.5065948", "0.50643027", "0.50536585", "0.5051184", "0.50486296", "0.5047745", "0.5034398", "0.50247604", "0.5023737", "0.5016259", "0.501119", "0.50058883", "0.50046957", "0.5000013", "0.50000006", "0.49983615", "0.49940437", "0.49913386", "0.49892238", "0.49887267", "0.49870828", "0.49820262", "0.4981702", "0.49814585" ]
0.72597617
0
Baseline implementation for the patch REST call
def patch request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_patch_request request_pb response = @client_stub.make_patch_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch; end", "def patch; end", "def patch\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 patch(*args, &block); end", "def patch!\n request! :patch\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 patch\n Rentlinx.client.patch(self)\n end", "def patch\n patch! unless patched?\n end", "def patch(action, **args); end", "def patch=(_arg0); end", "def patch(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def patch(*args, &block)\n map_method(:patch, args, &block)\n end", "def patch(path, **args); end", "def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch(uri, options = T.unsafe(nil)); end", "def patch\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.patch do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def from_merge_patch_json\n if request.patch?\n from_json\n else\n 415\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def patch(path, headers: {}, query: {}, payload: {})\n (headers, query, payload) = preprocess(headers, query, payload)\n respond_with super(path, headers: headers, query: query, payload: payload)\n end", "def patch\n req.patch?\n end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end", "def patch(request)\n request.method = :patch\n request.call\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 partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def patch(data = nil, options = nil)\n options ||= {}\n options[:method] = :patch\n call data, options\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def patch\n do_once(:http) do\n begin\n require 'uri'\n require 'ddtrace/pin'\n require 'ddtrace/ext/app_types'\n require 'ddtrace/ext/http'\n require 'ddtrace/ext/net'\n require 'ddtrace/ext/distributed'\n\n patch_http\n rescue StandardError => e\n Datadog::Tracer.log.error(\"Unable to apply net/http integration: #{e}\")\n end\n end\n end", "def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end", "def patch!(src, patchset)\n patch(src, patchset, :patch)\n end", "def patch(header = {})\n url = \"#{ApiClient.config.path}#{self.class.resource_path}\"\n response = ApiClient::Dispatcher.patch(url, self.to_hash, header)\n attributes = ApiClient::Parser.response(response, url)\n update_attributes(attributes)\n end", "def patch_version; end", "def patch?\r\nHTTP_METHOD_LOOKUP[request_method] == :patch\r\nend", "def patch_me(patchset)\n if respond_to? :replace\n replace(patch!(patchset))\n else\n patch!(patchset)\n end\n end", "def patch_rule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_patch_rule_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def patch(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"PATCH #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Patch.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n patch_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def test_update\n #Again the delete feature from ActiveResource does not work out of the box.\n #Using custom delete function\n puts \"--create a new account--\"\n new_acct = Salesforce::Rest::Account.new(:Name => \"test numero uno\", :BillingStreet=> \"Fairway Meadows\",\n :BillingState => \"NY\", :ShippingCity => \"New York\")\n resp = new_acct.save()\n\n assert (resp.code == 201)\n j = ActiveSupport::JSON\n @sf_oid = j.decode(resp.body)[\"id\"]\n puts \"New Object created: id -> \" + @sf_oid\n\n puts \"--update that new account--\"\n serialized_json = '{\"BillingState\":\"WA\"}'\n #http = Net::HTTP.new(@rest_svr_url, 443)\n http = Net::HTTP.new('na7.salesforce.com', 443)\n http.use_ssl = true\n \n class_name = \"Account\"\n path = \"/services/data/v21.0/sobjects/#{class_name}/#{@sf_oid}\"\n headers = {\n 'Authorization' => \"OAuth \"+ @oauth_token,\n \"content-Type\" => 'application/json',\n }\n code = serialized_json\n\n \n req = Net::HTTPGenericRequest.new(\"PATCH\", true, true, path, headers)\n\n resp = http.request(req, code) { |response| }\n assert !resp.nil?\n\n puts resp.to_s\n end", "def patch!(patchset)\n Diff::LCS.patch!(self, patchset)\n end", "def patch(url, data={}, headers={}, http_options=@options)\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # parse the URL\n uri = URI.parse(url)\n\n @logger.debug(\"PATCH #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Patch.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n if redirect_limit == -1\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n patch(response['location'], data, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n KineticHttpResponse.new(response)\n elsif gateway_retries == 0\n @logger.info(\"HTTP response: #{response.code} #{response.message}\") unless @logger.debug?\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n @logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n patch(url, data, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n @logger.info(\"HTTP response code: 0\") unless @logger.debug?\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n KineticHttpResponse.new(e)\n else\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n @logger.info(\"HTTP bad response: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n rescue StandardError => e\n @logger.info(\"HTTP error: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n end\n end", "def patch(endpoint)\n respond_with(\n connection(endpoint).patch(prepare(endpoint.uri),\n endpoint.req_params.nil? ? nil : custom_dump(endpoint.req_params)),\n endpoint\n )\n end", "def patch_request(request_data = {}, errback = DEFAULT_ERROR, &blk)\n req = create_test_request(request_data).patch(request_data)\n hookup_request_callbacks(req, errback, &blk)\n end", "def rest_end_point; end", "def http_prop_patch(request, response)\n path = request.path\n\n begin\n prop_patch = @server.xml.expect('{DAV:}propertyupdate', request.body)\n rescue Tilia::Xml::ParseException => e\n raise Exception::BadRequest, e.message, nil, e\n end\n\n new_properties = prop_patch.properties\n\n result = @server.update_properties(path, new_properties)\n\n prefer = @server.http_prefer\n response.update_header('Vary', 'Brief,Prefer')\n\n if prefer['return'] == 'minimal'\n # If return-minimal is specified, we only have to check if the\n # request was succesful, and don't need to return the\n # multi-status.\n ok = true\n result.each do |_prop, code|\n ok = false if code.to_i > 299\n end\n\n if ok\n response.status = 204\n return false\n end\n end\n\n response.status = 207\n response.update_header('Content-Type', 'application/xml; charset=utf-8')\n\n # Reorganizing the result for generateMultiStatus\n multi_status = {}\n result.each do |property_name, code|\n if multi_status.key?(code)\n multi_status[code][property_name] = nil\n else\n multi_status[code] = { property_name => nil }\n end\n end\n multi_status['href'] = path\n\n response.body = @server.generate_multi_status([multi_status])\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\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 patch(_status, headers, env)\n check_precondition!(env)\n method = patch_types[env['CONTENT_TYPE']]\n\n raise UnsupportedMediaType unless method\n\n send(method, env['rack.input'], graph)\n set_last_modified\n [200, update_headers(headers), self]\n end", "def patch(url, options = {}, &block)\n request HttpPatch, url, options, &block\n end", "def patch(patchset)\n Diff::LCS.patch(self, patchset)\n end", "def fire_patch(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON_PATCH}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.run(url, headers: headers, timeout: timeout, body: body, method: :patch)\n handle_response(response, method: :patch, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "def patch(attrs = nil)\n attrs ||= attributes.changed_attributes\n\n execute_request('PATCH') do |uri, headers|\n HTTP.http_client.patch(\n uri,\n body: adapter.serialize(attrs),\n header: headers.merge(CONTENT_TYPE_HEADERS)\n )\n end\n end", "def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end", "def run\n super\n\n # start with negative\n api_endpoint = nil\n api_reason = nil\n\n require_enrichment\n\n # get our url\n url = _get_entity_name\n\n ###\n # First just check our fingerprint, lots of stuff will already have been\n # fingerprinted during our ident run\n ###\n (_get_entity_detail(\"fingerprint\") || []).each do |fp|\n api_endpoint = true if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n api_reason = \"fingerprint\"\n end\n\n # first get a standard response\n standard_response = http_request :get, url\n return unless standard_response\n\n ####\n # next just check keywords in the url, but of course, sanity check this.\n ###\n if ( url.match(/api\\./) ||\n url.match(/apis\\./) ||\n url.match(/\\/api/) ||\n url.match(/\\/json/) ||\n url.match(/\\.json/) ||\n url.match(/\\.xml/) ||\n url.match(/skiptoken/) ||\n url.match(/\\/restapis/) )\n\n unless (\n url.match(/googleapis/) ||\n url.match(/\\.amazonaws\\.com/) ||\n standard_response.body_utf8.match(/^<HTML>/i) ||\n standard_response.body_utf8.match(/HTTP Status 404/i) ||\n standard_response.body_utf8.match(/NoSuchBucket/i) ) \n api_endpoint = true\n api_reason = \"url\"\n end\n\n end\n\n ###\n ### If we made it this far, and our base url matches, just return that\n if api_endpoint\n _create_api_endpoint(url, url, api_reason)\n return # return if our base URL was an endpoint\n end\n\n ####\n # otherwise check patterns in / around the original\n ####\n\n # always start empty\n api_endpoint = nil\n\n [\n \"#{url}\",\n \"#{url}/api\",\n \"#{url}/api/v1\",\n \"#{url}/api/v2\",\n \"#{url}/api/v3\",\n \"#{url}/docs\",\n \"#{url}/graphql\",\n \"#{url}/api-docs\",\n \"#{url}/api-docs/swagger.json\",\n \"#{url}/api/swagger\",\n \"#{url}/api/swagger-ui.html\",\n \"#{url}/api/swagger.yml\",\n \"#{url}/api/v2/swagger.json\",\n \"#{url}/apidocs\",\n \"#{url}/apidocs/swagger.json\",\n \"#{url}/rest\",\n \"#{url}/swagger\",\n \"#{url}/swagger/\",\n \"#{url}/swagger-resources\",\n \"#{url}/swagger-ui\",\n \"#{url}/swagger-ui.html\",\n \"#{url}/swagger.json\",\n \"#{url}/swagger/index.html\",\n \"#{url}/swagger/swagger-ui.html\",\n \"#{url}/swagger/ui/index\",\n \"#{url}/swagger/v1/swagger.json\",\n \"#{url}/v1/swagger.json\"\n ].each do |u|\n\n _log \"Checking... #{u}\"\n\n # Go ahead and get the response for this paritcular endpoint\n\n response = http_request :get, u\n\n next unless response\n # skip if we're not the original url, but we're getting the same response\n\n next if u != url && response.body_utf8 == standard_response.body_utf8\n\n ###\n ### Check for known strings\n ###\n if (response.body_utf8.match(/swagger-section/) ||\n response.body_utf8.match(/swaggerhub.com/) ||\n response.body_utf8.match(/soapenv:Envelope/) )\n # break and create it\n api_reason = \"response_body\"\n api_endpoint = u\n break\n end\n\n # check for content type of application.. note that this will flag\n # application/javascript, which is probably not wanted\n headers = standard_response.headers\n if headers\n ct = headers.find{|x, y| x if x =~ /^content-type/i }\n if ct\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/xml/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/ld+json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/x-protobuf/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/octet-stream/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^text\\/csv/i)\n\n # break and create it\n if api_endpoint\n api_reason = \"content_type\"\n break\n end\n\n end\n end\n\n ###\n # try to parse it (JSON)\n ###\n begin\n # get request body\n body = standard_response.body_utf8\n if body\n json = JSON.parse(body)\n\n if json\n # now check for common error scenarios, and proceed if we pass\n break if json.kind_of?(Hash) && \n ((standard_response.code == \"404\" && json[\"error\"] == \"Not Found\") ||\n (standard_response.code == \"404\" && json[\"response\"] == \"Content was not found.\"))\n \n # create it as an api endpoint\n api_endpoint = u\n api_reason = \"json_body\"\n break\n end\n\n end\n rescue JSON::ParserError\n _log \"No body!\"\n end\n\n # check known fingeprints\n _log \"Attempting to fingerprint (without the browser)!\"\n ident_matches = generate_http_requests_and_check(u,{:enable_browser => false, :'only-check-base-url' => true}) || {}\n ident_fingerprints = ident_matches[\"fingerprint\"] || []\n ident_fingerprints.each do |fp|\n api_endpoint = u if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n # break if it's been set so we dont genereate a bunch of FP's\n if api_endpoint\n api_reason = \"fingerprint\"\n break\n end\n end\n end\n\n ###\n ### Okay now that we're at the end, do we have an endpoint?!?\n ###\n\n # set the details and create a new entity if we made it this far!\n if api_endpoint\n _create_api_endpoint(url, api_endpoint, api_reason)\n else\n _set_entity_detail \"api_endpoint\", false\n end\n\n end", "def patch(resource, data)\n proxy(method: :patch, url: url_for(resource), data: data)\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def patch(resource, id, params)\n Api.new.patch(resource, id, params)\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 patch_resource(payload)\n execute(resource_path, method: :patch, payload: payload.to_json)\n end", "def patch(attrs = nil)\n attrs ||= attributes.changed_attributes\n execute_request do\n faraday_connection.patch { |req| req.body = adapter.serialize(attrs) }\n end\n end", "def rest_endpoint; end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = [{ 'op' => operation, 'path' => path, 'value' => value }]\n patch_options = { 'If-Match' => @data['eTag'] }\n response = @client.rest_patch(@data['uri'], patch_options.merge('body' => body), @api_version)\n @client.response_handler(response)\n end", "def preflight; end", "def patch(url, data, headers = {})\n request(:patch, url, headers, :data => data)\n end", "def rest_call(call,base_uri,json_payload,access_token)\n params =\n {\"Authorization\" => \"Bearer #{access_token}\",\n :content_type => 'application/json',\n :accept => 'application/json',\n :verify => false}\n case call\n when \"get\"\n response = rest_get(base_uri,params)\n when \"post\"\n response = rest_post(base_uri,json_payload,params)\n when \"patch\"\n response = rest_patch(base_uri,json_payload,params)\n end\n return response\n end", "def patch(body = '', headers = {}, parameters = {}, &block)\n build_patch(body, headers, parameters, &block).invoke\n end", "def old_rest path, query={}, opts={}, &cb\n uri = url(\"method/#{path}\", {:format => 'json'}.merge(query),\n old_server, opts)\n if opts[:post]\n request(\n opts.merge(:uri => uri),\n [:post,\n url(\"method/#{path}\", {:format => 'json'}, old_server, opts),\n query],\n &cb)\n else\n request(opts, [:get, uri], &cb)\n end\n end", "def patch_via_redirect(path, parameters = nil, headers = nil)\n request_via_redirect(:patch, path, parameters, headers)\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def rest_endpoint=(_arg0); end", "def patch(url, payload, headers: {}, options: {})\n request_with_payload(:patch, url, payload, headers, options)\n end", "def rpc(method, arguments)\n\t\t\t# This update might not be sent right away. Therefore, mutable arguments may be serialized to JSON at a later time (or never). This could be a race condition:\n\t\t\t@page.updates.enqueue([method, arguments])\n\t\tend", "def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end", "def payment_methods_id_patch_with_http_info(id, patch_payment_method_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.payment_methods_id_patch ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentMethodsApi.payment_methods_id_patch\"\n end\n # verify the required parameter 'patch_payment_method_request' is set\n if @api_client.config.client_side_validation && patch_payment_method_request.nil?\n fail ArgumentError, \"Missing the required parameter 'patch_payment_method_request' when calling PaymentMethodsApi.payment_methods_id_patch\"\n end\n # resource path\n local_var_path = '/payment-methods/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Trace-Id'] = opts[:'trace_id'] if !opts[:'trace_id'].nil?\n header_params[:'User-Agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?\n header_params[:'End-User-Device-Id'] = opts[:'end_user_device_id'] if !opts[:'end_user_device_id'].nil?\n header_params[:'End-User-Ip'] = opts[:'end_user_ip'] if !opts[:'end_user_ip'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(patch_payment_method_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'PaymentMethod'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['BearerAuth']\n\n new_options = opts.merge(\n :operation => :\"PaymentMethodsApi.payment_methods_id_patch\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentMethodsApi#payment_methods_id_patch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def patch(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = self.to_patch_request_information(\n body, request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::AccessReviewInstance.create_from_discriminator_value(pn) }, error_mapping)\n end", "def update\n raise 'Not implemented'\n # signature_type, success = jsonapi_update.to_a\n\n # if success\n # render_jsonapi(signature_type, scope: false)\n # else\n # render_errors_for(signature_type)\n # end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\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 patch\n # do not require these by default, but only when actually patching\n require 'redis'\n require_relative 'tags'\n require_relative 'quantize'\n require_relative 'instrumentation'\n\n # InstancePatch and ClientPatch allows the client object to access pin on redis instance\n ::Redis.include(InstancePatch)\n ::Redis::Client.include(ClientPatch)\n\n # TODO: To support redis-rb 5.x, Redis::Client -> RedisClient\n ::Redis::Client.include(Instrumentation)\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\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 modify( attributes )\n\t\tattributes = stringify_keys( attributes )\n\n\t\tsuper\n\n\t\tself.uri( attributes['uri'] )\n\t\tself.http_method( attributes['http_method'] )\n\t\tself.http_version( attributes['http_version'] )\n\t\tself.expected_status( attributes['expected_status'] )\n\t\tself.body( attributes['body'] )\n\t\tself.body_mimetype( attributes['body_mimetype'] )\n\tend", "def patch(pattern, &hndlr)\n @j_del.patch(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end", "def test_patch\n checkout_dir =File.expand_path(File.join('..','..','..','sequence', 'repository', 'Unidata@thredds'),File.dirname(__FILE__))\n repos = Rugged::Repository.new(checkout_dir)\n from = repos.lookup('49429686c3be8c3cb0aea17fca3e6684706d5fa1')\n to = repos.lookup('f63544cc69b49664a0487bf064ce0c7f64b40641')\n puts \"from #{from}\"\n puts \"to #{to}\"\n diff = to.patch(from)\n puts diff.content\n puts \"patch\"\n diff.patch.lines do |line|\n puts line\n end\n \n #.lines.each do |line|\nend", "def patch request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/routers/#{request_pb.router}\"\n body = request_pb.router_resource.to_json\n\n response = @client_stub.make_patch_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def update_from_api(remote_obj)\n raise NotImplementedError\n end", "def patch_model dataset_id, model_id, patched_model_gapi, etag = nil\n patch_with_backoff = false\n options = { skip_deserialization: true }\n if etag\n options[:header] = { \"If-Match\" => etag }\n # The patch with etag operation is considered idempotent\n patch_with_backoff = true\n end\n execute backoff: patch_with_backoff do\n json_txt = service.patch_model @project, dataset_id, model_id, patched_model_gapi, options: options\n JSON.parse json_txt, symbolize_names: true\n end\n end", "def bump_patch_version; end", "def patch(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Patch.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "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 patch_kubernetes_version_with_http_info(moid, kubernetes_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_version ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # verify the required parameter 'kubernetes_version' is set\n if @api_client.config.client_side_validation && kubernetes_version.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_version' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Versions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_version)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVersion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_version\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_version\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def base_update(resource, id, options, format = nil, headers = nil)\n headers ||= {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n headers[:content_type] = \"#{format}\"\n headers[:prefer] = @return_preference if @use_return_preference\n options = {} if options.nil?\n options[:resource] = resource.class\n options[:format] = format\n options[:id] = id\n reply = put resource_url(options), resource, fhir_headers(headers)\n reply.resource = parse_reply(resource.class, format, reply) if reply.body.present?\n reply.resource_class = resource.class\n reply\n end", "def patch_with_app(url, payload = '')\n github_api_conn.patch do |request|\n request.url url\n\n request.headers['Authorization'] = \"Token #{access_token}\"\n request.headers['Accept'] = accept_header\n request.body = payload\n end\n end", "def update!(**args)\n @canceled = args[:canceled] if args.key?(:canceled)\n @content_type = args[:content_type] if args.key?(:content_type)\n @dom_tree_node_index = args[:dom_tree_node_index] if args.key?(:dom_tree_node_index)\n @failed_http_access_control_check = args[:failed_http_access_control_check] if args.key?(:failed_http_access_control_check)\n @fetch_source_info = args[:fetch_source_info] if args.key?(:fetch_source_info)\n @fetch_status = args[:fetch_status] if args.key?(:fetch_status)\n @http_header = args[:http_header] if args.key?(:http_header)\n @http_response_code = args[:http_response_code] if args.key?(:http_response_code)\n @metadata = args[:metadata] if args.key?(:metadata)\n @post_data = args[:post_data] if args.key?(:post_data)\n @redirect_target = args[:redirect_target] if args.key?(:redirect_target)\n @referenced_resource_content_index = args[:referenced_resource_content_index] if args.key?(:referenced_resource_content_index)\n @request_header = args[:request_header] if args.key?(:request_header)\n @request_method = args[:request_method] if args.key?(:request_method)\n @style_index = args[:style_index] if args.key?(:style_index)\n @synchronously_fetched = args[:synchronously_fetched] if args.key?(:synchronously_fetched)\n @timing = args[:timing] if args.key?(:timing)\n @url = args[:url] if args.key?(:url)\n @webkit_metadata = args[:webkit_metadata] if args.key?(:webkit_metadata)\n end", "def update\n super\n response.status = :unprocessable_entity if resource&.errors&.any?\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 render status: 501, json: { errors: ['Action not implemented yet!'] }\n end" ]
[ "0.76958907", "0.76958907", "0.7610176", "0.7416563", "0.71885127", "0.7109683", "0.6967185", "0.6799357", "0.6794835", "0.669967", "0.666242", "0.665489", "0.6611944", "0.6583517", "0.6557374", "0.65187", "0.6514116", "0.6513869", "0.6441081", "0.6395429", "0.6363385", "0.6343388", "0.6316744", "0.6264933", "0.6257538", "0.6222635", "0.6222635", "0.62215716", "0.6216047", "0.6201381", "0.61270255", "0.6100893", "0.6086304", "0.6040841", "0.60343474", "0.60291517", "0.60241294", "0.6007055", "0.5992645", "0.5991244", "0.5986712", "0.59637004", "0.5960854", "0.5950579", "0.5939962", "0.59362555", "0.5930772", "0.59194493", "0.5909144", "0.5904784", "0.5883194", "0.587248", "0.58659196", "0.5860404", "0.5826786", "0.58214307", "0.57917607", "0.57876843", "0.576545", "0.5759653", "0.5742009", "0.57398015", "0.57288647", "0.5680033", "0.5678811", "0.56723046", "0.5666887", "0.56645083", "0.56458586", "0.56433654", "0.56424385", "0.56326395", "0.5611123", "0.5599963", "0.55773187", "0.55628353", "0.5546136", "0.55421567", "0.5533397", "0.55289173", "0.55275595", "0.552068", "0.55205476", "0.55089784", "0.549786", "0.5495788", "0.549171", "0.5487157", "0.5484486", "0.5475104", "0.5471037", "0.5468142", "0.5466561", "0.5452476", "0.54495186", "0.54486436", "0.5444557", "0.5444557", "0.5443788" ]
0.61150473
32
Baseline implementation for the patch_per_instance_configs REST call
def patch_per_instance_configs request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_patch_per_instance_configs_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_update_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def update_instance_config request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_instance_config_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def patch; end", "def patch; end", "def update!(**args)\n @instance_config = args[:instance_config] if args.key?(:instance_config)\n end", "def patch\n end", "def patch\n patch! unless patched?\n end", "def update_shielded_instance_config request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_shielded_instance_config_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def patch(*args, &block); end", "def update_shielded_instance_config request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_shielded_instance_config_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def put_config(opts)\n opts = check_params(opts,[:instance_format,:data])\n super(opts)\n end", "def delete_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_delete_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def patch_class(klass)\n @patches.each do |patch|\n patch.patch_class(klass)\n end\n end", "def patch(*args, &block)\n map_method(:patch, args, &block)\n end", "def apply_updates_to_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_apply_updates_to_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def patch\n Rentlinx.client.patch(self)\n end", "def update!(**args)\n @configs = args[:configs] if args.key?(:configs)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @parameters = args[:parameters] if args.key?(:parameters)\n end", "def sync_configuration\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 patch_config(new_config)\n exclusively do\n tmp = dump_config\n tmp.update(new_config)\n load_config_hash(tmp)\n save_config\n end\n end", "def remove_instance_properties\n properties = []\n properties << :DisableApiTermination\n properties << :KernelId\n properties << :Monitoring\n properties << :PlacementGroupName\n properties << :PrivateIpAddress\n properties << :RamDiskId\n properties << :SourceDestCheck\n properties << :Tenancy\n add_patch Patches::RemoveProperty.new 'AWS::EC2::Instance', properties\n end", "def action_reread\n added, _changed, removed = new_resource.rpc.reloadConfig()[0]\n added.each {|name| new_resource.rpc.addProcessGroup(name) }\n removed.each {|name| new_resource.rpc.removeProcessGroup(name) }\n end", "def config_options\n {\n 'datacenter' => new_resource.datacenter,\n 'template_path' => new_resource.template_path,\n 'power_on' => true,\n 'datastore' => new_resource.datastore,\n 'wait' => true,\n 'hostname' => new_resource.hostname,\n 'name' => new_resource.name,\n 'customization_spec' => {\n 'domain' => new_resource.domain,\n 'ipsettings' => {\n 'ip' => new_resource.ip || node['vcac_vm']['ip'],\n 'gateway' => new_resource.gateway,\n 'subnetMask' => new_resource.subnet_mask,\n },\n }\n }\nend", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n end", "def partial_update_instance instance, update_mask\n instances.partial_update_instance instance: instance, update_mask: update_mask\n end", "def update_all_config\n @admin.updateConfiguration\n end", "def generate_methods\n resp = MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).get_resources(\n rest_api_id: @cloud_id,\n )\n root_resource = resp.items.first.id\n\n # TODO guard this crap so we don't touch it if there are no changes\n @config['methods'].each { |m|\n m[\"auth\"] ||= m[\"iam_role\"] ? \"AWS_IAM\" : \"NONE\"\n\n method_arn = \"arn:#{MU::Cloud::AWS.isGovCloud?(@config[\"region\"]) ? \"aws-us-gov\" : \"aws\"}:execute-api:#{@config[\"region\"]}:#{MU::Cloud::AWS.credToAcct(@config['credentials'])}:#{@cloud_id}/*/#{m['type']}/#{m['path']}\"\n\n resp = MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).get_resources(\n rest_api_id: @cloud_id\n )\n ext_resource = nil\n resp.items.each { |resource|\n if resource.path_part == m['path']\n ext_resource = resource.id\n end\n }\n\n resp = if ext_resource\nMU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).get_resource(\n rest_api_id: @cloud_id,\n resource_id: ext_resource,\n)\n# MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).update_resource(\n# rest_api_id: @cloud_id,\n# resource_id: ext_resource,\n# patch_operations: [\n# {\n# op: \"replace\",\n# path: \"XXX ??\",\n# value: m[\"path\"]\n# }\n# ]\n# )\n else\n MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).create_resource(\n rest_api_id: @cloud_id,\n parent_id: root_resource,\n path_part: m['path']\n )\n end\n parent_id = resp.id\n\n resp = begin\n MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).get_method(\n rest_api_id: @cloud_id,\n resource_id: parent_id,\n http_method: m['type']\n )\n rescue Aws::APIGateway::Errors::NotFoundException\n resp = MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).put_method(\n rest_api_id: @cloud_id,\n resource_id: parent_id,\n authorization_type: m['auth'],\n http_method: m['type']\n )\n end\n\n # XXX effectively a placeholder default\n begin\n m['responses'].each { |r|\n params = {\n :rest_api_id => @cloud_id,\n :resource_id => parent_id,\n :http_method => m['type'],\n :status_code => r['code'].to_s\n }\n if r['headers']\n params[:response_parameters] = r['headers'].map { |h|\n [\"method.response.header.\"+h['header'], h['required']]\n }.to_h\n end\n\n if r['body']\n# XXX I'm guessing we can also have arbirary user-defined models somehow, so is_error is probably inadequate to the demand of the times\n params[:response_models] = r['body'].map { |b| [b['content_type'], b['is_error'] ? \"Error\" : \"Empty\"] }.to_h\n end\n\n MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).put_method_response(params)\n }\n rescue Aws::APIGateway::Errors::ConflictException\n # fine to ignore\n end\n\n if m['integrate_with']\n# role_arn = if m['iam_role']\n# if m['iam_role'].match(/^arn:/)\n# m['iam_role']\n# else\n# sib_role = @deploy.findLitterMate(name: m['iam_role'], type: \"roles\")\n# sib_role.cloudobj.arn\n# XXX make this more like get_role_arn in Function, or just use Role.find?\n# end\n# end\n\n function_obj = nil\n\n uri, type = if m['integrate_with']['type'] == \"aws_generic\"\n svc, action = m['integrate_with']['aws_generic_action'].split(/:/)\n [\"arn:aws:apigateway:\"+@config['region']+\":#{svc}:action/#{action}\", \"AWS\"]\n elsif m['integrate_with']['type'] == \"function\"\n function_obj = @deploy.findLitterMate(name: m['integrate_with']['name'], type: \"functions\").cloudobj\n [\"arn:aws:apigateway:\"+@config['region']+\":lambda:path/2015-03-31/functions/\"+function_obj.arn+\"/invocations\", \"AWS\"]\n elsif m['integrate_with']['type'] == \"mock\"\n [nil, \"MOCK\"]\n end\n\n params = {\n :rest_api_id => @cloud_id,\n :resource_id => parent_id,\n :type => type, # XXX Lambda and Firehose can do AWS_PROXY\n :content_handling => \"CONVERT_TO_TEXT\", # XXX expose in BoK\n :http_method => m['type']\n# credentials: role_arn\n }\n params[:uri] = uri if uri\n\n if m['integrate_with']['type'] != \"mock\"\n params[:integration_http_method] = m['integrate_with']['backend_http_method']\n else\n params[:integration_http_method] = nil\n end\n\n if m['integrate_with']['passthrough_behavior']\n params[:passthrough_behavior] = m['integrate_with']['passthrough_behavior']\n end\n if m['integrate_with']['request_templates']\n params[:request_templates] = {}\n m['integrate_with']['request_templates'].each { |rt|\n params[:request_templates][rt['content_type']] = rt['template']\n }\n end\n\n resp = MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).put_integration(params)\n\n if m['integrate_with']['type'] == \"function\"\n function_obj.addTrigger(method_arn, \"apigateway\", @config['name'])\n end\n\n m['responses'].each { |r|\n params = {\n :rest_api_id => @cloud_id,\n :resource_id => parent_id,\n :http_method => m['type'],\n :status_code => r['code'].to_s,\n :selection_pattern => \"\"\n }\n if r['headers']\n params[:response_parameters] = r['headers'].map { |h|\n [\"method.response.header.\"+h['header'], \"'\"+h['value']+\"'\"]\n }.to_h\n end\n\n MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).put_integration_response(params)\n\n }\n\n end\n\n }\n end", "def update!(**args)\n @deployed_model_id = args[:deployed_model_id] if args.key?(:deployed_model_id)\n @explanation_spec_override = args[:explanation_spec_override] if args.key?(:explanation_spec_override)\n @instances = args[:instances] if args.key?(:instances)\n @parameters = args[:parameters] if args.key?(:parameters)\n end", "def update\n\t\t@launch_configuration = LaunchConfiguration.find(params[:id])\n\t\t@provider_account = @launch_configuration.provider_account\n\n redirect_url = provider_account_url(@provider_account, :anchor => 'auto_scaling')\n\t\treturn redirect_to(redirect_url) if @launch_configuration.active?\n\n\t\tattrs = lc_params = params[:launch_configuration]\n\t\tif params[:lc_based_on] == 'existing'\n\t\t\tattrs = get_server_attributes(lc_params[:server_id], lc_params[:server_profile_revision_id]).merge!(lc_params)\n\t\tend\n\n\t\t@launch_configuration.attributes = attrs\n\n\t respond_to do |format|\n\t\t\tif @launch_configuration.try(:save)\n\t\t\t\tflash[:notice] = 'Launch Configuration was successfully updated.'\n\t p = @provider_account\n\t\t\t\to = @launch_configuration\n\t\t\t\tAuditLog.create_for_parent(\n\t\t\t\t\t:parent => p,\n\t\t\t\t\t:auditable_id => o.id,\n\t\t\t\t\t:auditable_type => o.class.to_s,\n\t\t\t\t\t:auditable_name => o.name,\n\t\t\t\t\t:author_login => current_user.login,\n\t\t\t\t\t:author_id => current_user.id,\n\t\t\t\t\t:summary => \"updated '#{o.name}'\",\n\t\t\t\t\t:changes => o.tracked_changes,\n\t\t\t\t\t:force => false\n\t\t\t\t)\n\t\t\t\tformat.html { redirect_to redirect_url }\n\t\t\t\tformat.xml { render :xml => @launch_configuration, :status => :updated, :location => @launch_configuration }\n\t\t\telse\n\t\t\t\tflash[:error] = 'Failed to update a Launch Configuration: ' + (@launch_configuration.try(:cloud_message) || 'unknown problem')\n\t\t format.html { render :action => :edit }\n\t\t format.xml { render :xml => @launch_configuration.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\tend", "def patch_kubernetes_virtual_machine_instance_type_with_http_info(moid, kubernetes_virtual_machine_instance_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_virtual_machine_instance_type ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_virtual_machine_instance_type\"\n end\n # verify the required parameter 'kubernetes_virtual_machine_instance_type' is set\n if @api_client.config.client_side_validation && kubernetes_virtual_machine_instance_type.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_virtual_machine_instance_type' when calling KubernetesApi.patch_kubernetes_virtual_machine_instance_type\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInstanceTypes/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_virtual_machine_instance_type)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInstanceType'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_virtual_machine_instance_type\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_virtual_machine_instance_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_list_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListPerInstanceConfigsResp.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def _PATCHESDIR; Config._PATCHES; end", "def create_servers\n # use \"rsc\" tool to get detailed deployment + server view from api 1.6, not supported by right_api_client\n old_deployment = JSON.parse(`rsc -a #{@options[:src]} cm16 show /api/deployments/#{@options[:deployment]} view=full`)\n\n old_deployment['servers'].each do |server|\n @api.account_id = @options[:src]\n name = server['next_instance']['name']\n\n puts \"Creating server: #{name} ...\\n\"\n\n cloud = find_cloud(server['next_instance']['links']['cloud']['href'], name)\n @api.account_id = @options[:src]\n\n ssh_key = choose_ssh_key(cloud)\n @api.account_id = @options[:src]\n\n instance_type = choose_instance_type(cloud)\n old_st_url = server['next_instance']['server_template']['href']\n new_st_url = @server_templates[old_st_url]['new_st_url']\n \n mci = choose_mci(new_st_url)\n @api.account_id = @options[:src]\n\n subnets = choose_subnets(cloud)\n @api.account_id = @options[:src]\n\n security_groups = choose_security_groups(cloud)\n @api.account_id = @options[:src]\n\n inputs_hash = format_inputs(@api.resource(server['next_instance']['href']).show.inputs)\n\n # Create server\n params = {}\n params[:server] = {}\n params[:server][:name] = name\n params[:server][:deployment_href] = @new_deployment\n params[:server][:instance] = {}\n params[:server][:instance][:cloud_href] = cloud\n params[:server][:instance][:server_template_href] = new_st_url\n params[:server][:instance][:ssh_key_href] = ssh_key if ssh_key\n params[:server][:instance][:instance_type_href] = instance_type\n params[:server][:instance][:multi_cloud_image_href] = mci\n params[:server][:instance][:subnet_hrefs] = subnets if subnets\n params[:server][:instance][:security_group_hrefs] = security_groups\n params[:server][:instance][:inputs] = inputs_hash\n @api.account_id = @options[:dst]\n @api.servers.create(params)\n end\nend", "def update!(**args)\n @accelerators = args[:accelerators] if args.key?(:accelerators)\n @boot_disk_size_gb = args[:boot_disk_size_gb] if args.key?(:boot_disk_size_gb)\n @confidential_instance_config = args[:confidential_instance_config] if args.key?(:confidential_instance_config)\n @disable_public_ip_addresses = args[:disable_public_ip_addresses] if args.key?(:disable_public_ip_addresses)\n @enable_nested_virtualization = args[:enable_nested_virtualization] if args.key?(:enable_nested_virtualization)\n @machine_type = args[:machine_type] if args.key?(:machine_type)\n @pool_size = args[:pool_size] if args.key?(:pool_size)\n @pooled_instances = args[:pooled_instances] if args.key?(:pooled_instances)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shielded_instance_config = args[:shielded_instance_config] if args.key?(:shielded_instance_config)\n @tags = args[:tags] if args.key?(:tags)\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 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 patch!\n request! :patch\n end", "def update_partial_patch_config_with_http_info(partial_patch_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySystemConfigurationNSXPartialPatchApi.update_partial_patch_config ...'\n end\n # verify the required parameter 'partial_patch_config' is set\n if @api_client.config.client_side_validation && partial_patch_config.nil?\n fail ArgumentError, \"Missing the required parameter 'partial_patch_config' when calling PolicySystemConfigurationNSXPartialPatchApi.update_partial_patch_config\"\n end\n # resource path\n local_var_path = '/system-config/nsx-partial-patch-config'\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(partial_patch_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySystemConfigurationNSXPartialPatchApi#update_partial_patch_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def send_patch_command(patch_instances, command)\n @ssm.send_command(\n instance_ids: patch_instances, # required\n document_name: 'AWS-RunShellScript', # required\n timeout_seconds: 600,\n comment: 'Patch It!',\n parameters: {\n 'commands' => [command]\n }\n )\n end", "def modify\n debug(\"#{self.class}::modify\")\n\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n end\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n\n\n\n @payload = {}\n if !($description.to_s.empty?)\n @payload[:description] = $description\n end\n if !($peak_latency.to_s.empty?)\n @payload[:peak_latency] = $peak_latency\n end\n if !($peak_iops_per_tb.to_s.empty?)\n @payload[:peak_iops_per_tb] = $peak_iops_per_tb\n end\n if !($expected_iops_per_tb.to_s.empty?)\n @payload[:expected_iops_per_tb] = $expected_iops_per_tb\n end\n resourceType = \"storageservicelevel\"\n\n if(transport.http_put_request(apiUri , @payload.to_json , resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully modified\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully modified\"\n end\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully modified\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully modified\"\n end\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} modification failed\"\n\t\t else\n\t\t puts \" #{resourceType} modification failed\"\n end\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} modification failed\"\n\t\t else\n\t\t puts \" #{resourceType} modification failed\"\n end\n end\n\n end", "def update_instances\n Instance.update_all( ['public_ip=NULL, dns_name=NULL'], ['provider_account_id=? and public_ip=? and instance_id != ?', provider_account_id, public_ip, instance_id ] )\n \tInstance.update_all( ['public_ip=?, dns_name=?', public_ip, name], ['provider_account_id=? and instance_id=?', provider_account_id, instance_id ] )\n end", "def chef_refresh_tenants\n foundation_bag = chef_api_connect.data_bags.fetch('foundation')\n current_tenants = fetch_databag_tenants\n tenant_array = fetch_fconfig_tenants\n\n # Acqure .feature data bag to whitelist/track features we care about\n feature_bag = Hash.new\n chef_api_connect.search.query('foundation', 'id:.features', start: 0).rows.each do |item|\n feature_bag = item['raw_data']\n end\n\n tenant_array.each do |t_config|\n tenant = t_config[0]\n fconfigdb = t_config[1]\n envname = t_config[2]\n tenant_bag = Hash.new\n mysql_connect = mysql_api_connect(envname)\n client = mysql_connect[0] # mysql connection\n\n # Acquire contextmode value for tenant attribute\n chef_api_connect.search.query('environment', \"name:#{envname}\").rows.each do |envitem|\n @contextmode = envitem['default_attributes']['database']['contextmode']\n end\n\n results = client.query(\"select * from #{fconfigdb}.tenant_config where tenant_name='#{tenant}'\")\n results.each do |row_schema|\n # Set initial tenant attributes from corresponding .tenant_config\n row_schema.each do |col_name, col_val|\n case col_name\n when \"tenant_name\" \n tenant_bag['id'] = col_val\n tenant_bag['url'] = col_val\n tenant_bag['url_alias'] = col_val\n tenant_bag['tenant_name'] = col_val\n tenant_bag['tenant_header'] = col_val\n tenant_bag['tenant_status'] = 'active'\n tenant_bag['is_provisioned'] = 'false'\n when 'datasource_id' then\n tenant_bag['datasource.id'] = col_val # for queries\n when 'id' then\n tenant_bag['tenant_config.id'] = col_val # for queries\n end\n end\n end\n\n # Fetch and set additional tenant attributes outside of .tenant_config\n tenant_bag['env'] = envname\n tenant_bag['context'] = @contextmode\n\n # Queries are combined into multi-statements to reduce query load\n @sql_tenant_config = client.query(\"\n select * from #{fconfigdb}.tenant_config where tenant_name='#{tenant_bag['id']}';\n select * from #{fconfigdb}.datasource where id='#{tenant_bag['datasource.id']}';\n select ref_feature_code_id from #{fconfigdb}.tenant_feature where tenant_config_id='#{tenant_bag['tenant_config.id']}'\n \")\n while client.next_result\n @sql_tenant_datasource = client.store_result\n while client.next_result\n @sql_tenant_features = client.store_result\n end\n end\n\n # Construct .tenant_config attributes\n @sql_tenant_config.each do |tenant_config_row|\n tenant_config_row.each do |tenant_key, tenant_val|\n tenantconfigkey = \"tenant_config.#{tenant_key}\"\n tenant_bag[tenantconfigkey] = tenant_val\n end\n end\n\n # Fetch and construct .datasource attributes\n @sql_tenant_datasource.each do |ds_row|\n ds_row.each do |ds_key, ds_val|\n datasourcekey = \"datasource.#{ds_key}\"\n tenant_bag[datasourcekey] = ds_val\n end\n end\n\n # Fetch and construct .feature attributes\n @sql_tenant_features.each do |feature_row|\n feature_row.each do|_feature_key, feature_val|\n # Compare against useful features listed in .features data bag.\n feature_bag.each do |key,value|\n case feature_val\n when value\n tenant_bag[key] = value\n end\n end\n end\n end\n \n # Determine whether the tenant should be updated or created\n update_bag = Hash.new\n if current_tenants.include?(tenant)\n puts \"(chef_tenant_update): Updating data bag for #{tenant}.\"\n # Values to retain from existing tenant before updating\n chef_api_connect.search.query('foundation', \"id:#{tenant_bag['id']}\", start: 0).rows.each do |item|\n tenant_bag['is_provisioned'] = item['raw_data']['is_provisioned']\n tenant_bag['url_alias'] = item['raw_data']['url_alias']\n tenant_bag['tenant_status'] = item['raw_data']['tenant_status']\n end\n update_bag = foundation_bag.items.update(tenant)\n update_bag.data = tenant_bag\n else\n puts \"(chef_tenant_update): Creating data bag for #{tenant}.\"\n update_bag = foundation_bag.items.create(tenant_bag)\n end\n update_bag.save!\n end\nend", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_job_instance_details = args[:patch_job_instance_details] if args.key?(:patch_job_instance_details)\n end", "def update!(**args)\n @failed_locations = args[:failed_locations] if args.key?(:failed_locations)\n @instances = args[:instances] if args.key?(:instances)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @all = args[:all] if args.key?(:all)\n @group_labels = args[:group_labels] if args.key?(:group_labels)\n @instance_name_prefixes = args[:instance_name_prefixes] if args.key?(:instance_name_prefixes)\n @instances = args[:instances] if args.key?(:instances)\n @zones = args[:zones] if args.key?(:zones)\n end", "def patch_me(patchset)\n if respond_to? :replace\n replace(patch!(patchset))\n else\n patch!(patchset)\n end\n end", "def patch(action, **args); end", "def put_instance(opts)\n opts = check_params(opts,[:instances])\n super(opts)\n end", "def rpc_configs\n @rpc_enabled = true\n @rpc_configs = OpenStruct.new(\n :address => rpc_default_path,\n :verbose => false,\n :server => OpenStruct.new(\n :preload => nil,\n :num_workers => 5\n ),\n :client => OpenStruct.new(\n :preload => nil,\n :retries => 3,\n :timeout => 50 #ms\n )\n )\n yield @rpc_configs\n @rpc_configs.freeze\n end", "def doUpdate(startState)\n if (new_resource.rackID.nil? || new_resource.rackID.empty?)\n return\n end\n \n json = \"{\\\"rackId\\\" : \\\"#{new_resource.rackID}\\\"}\"\n \n response = putRequest(\"/hosts/#{new_resource.hostname}\", json)\n \n unless response.code.to_i.between?(200,299)\n raise Exception.new(\"Host update of #{new_resource.hostname} failed with #{response.code} code. Body: #{response.body}\")\n end\n \n unless response.body == startState\n new_resource.updated_by_last_action true\n end\nend", "def configure(update); end", "def patch=(_arg0); end", "def munge_config_xml\n get_config_changes\n xml_base.xpath(\"//Component[contains(@FQDD, 'NIC.') or contains(@FQDD, 'FC.')]\").remove unless @changes['whole'].find_all{|k,v| k =~ /^(NIC|FC)\\./}.empty?\n xml_base['ServiceTag'] = @resource[:servicetag]\n\n handle_missing_devices(xml_base, @changes)\n @nonraid_to_raid = false\n\n if embedded_sata_change\n Puppet.debug(\"Embedded Mode Change detected running with RAID teardown only\")\n @changes.deep_merge!(get_raid_config_changes(xml_base, raid_reset=true))\n else\n @changes.deep_merge!(get_raid_config_changes(xml_base)) if attempt == 0\n end\n\n %w(BiosBootSeq HddSeq).each do |attr|\n existing_attr_val = find_current_boot_attribute(attr.downcase.to_sym)\n requested_val = @changes['partial']['BIOS.Setup.1-1'][attr]\n message = \"Attribute: %s, Existing value: %s, Requested value: %s\" % [attr, existing_attr_val, requested_val]\n Puppet.debug(message)\n if existing_attr_val && requested_val\n seq_diff = requested_val.delete(' ').split(',').zip(existing_attr_val.delete(' ').split(',')).select{|new_val, exist_val| new_val != exist_val}\n #If tearing down, the HDD will already be removed from the boot sequence\n if seq_diff.size ==0 || @resource[:ensure] == :teardown\n @changes['partial']['BIOS.Setup.1-1'].delete(attr)\n end\n end\n end\n\n # If we are tearing down and there are nonraid volumes, we need to make them raid volumes to\n # be able to boot from this controller again\n nonraid_disks = raid_configuration.select{|_,v| !v[:nonraid].empty?}\n if (@resource[:ensure] == :teardown && !nonraid_disks.empty?)\n # Move the nonraids to raid\n nonraid_map = {}\n raid_configuration.each{|k,v| nonraid_map[k] = v[:nonraid] if v[:nonraid]}\n nonraid_map.each do |controller, disks|\n @raid_configuration[controller][:virtual_disks] = [{:disks => disks, :level => \"raid0\", :type => :hdd}]\n @raid_configuration[controller][:nonraid] = []\n end\n # run #get_raid_config_changes again with overwritten raid_configuration\n @nonraid_to_raid = true\n @changes.deep_merge!(get_raid_config_changes(xml_base))\n end\n #Handle whole nodes (node should be replaced if exists, or should be created if not)\n @changes[\"whole\"].keys.each do |name|\n path = \"/SystemConfiguration/Component[@FQDD='#{name}']\"\n existing = xml_base.xpath(path).first\n #if node exists there, just go ahead and remove it\n if !existing.nil?\n existing.remove\n end\n create_full_node(name, @changes[\"whole\"][name], xml_base, xml_base.xpath(\"/SystemConfiguration\").first)\n end\n #Handle partial node changes (node should exist already, but needs data edited/added within)\n @changes['partial'].keys.each do |parent|\n process_partials(parent, @changes['partial'][parent], xml_base)\n end\n #Handle node removal (ensure nodes listed here don't exist)\n @changes[\"remove\"][\"attributes\"].keys.each do |parent|\n process_remove_nodes(parent, @changes[\"remove\"][\"attributes\"][parent], xml_base, \"Attribute\")\n end\n @changes[\"remove\"][\"components\"].keys.each do |parent|\n process_remove_nodes(parent, @changes[\"remove\"][\"components\"][parent], xml_base, \"Component\")\n end\n\n ##Clean up the config file of all the commented text\n xml_base.xpath('//comment()').remove\n remove_invalid_settings(xml_base)\n # Disable SD card and RAID controller for boot from SAN\n\n # Include NVDIMM setting that will only be included after NVDIMM enabled\n unless nvdimm_attrs_in_sync?\n @changes[\"partial\"][\"BIOS.Setup.1-1\"][\"PersistentMemoryScrubbing\"] = \"Auto\"\n end\n\n # Rotate the old xml files\n unless attempt == 0\n rotate_config_xml_file\n end\n File.open(@config_xml_path, 'w+') do |file|\n if embsata_in_sync?\n file.write(xml_base.to_xml(:indent => 2))\n else\n # If Embedded Sata mode is out of sync we need to change the FQDD's to what they will be\n # after the EmbSat mode is changed to RAIDmode\n file.write(xml_base.to_xml(:indent => 2).gsub(\"AHCI.Embedded\", \"RAID.Embedded\").gsub(\"ATA.Embedded\",\"RAID.Embedded\"))\n end\n end\n xml_base\n end", "def notify\n ### TO DO: Flatten the replication group deployment metadata structure. It is probably waaaaaaay too nested.\n if @config[\"create_replication_group\"]\n repl_group = MU::Cloud::AWS::CacheCluster.getCacheReplicationGroupById(@config['identifier'], region: @region, credentials: @credentials)\n # DNS records for the \"real\" zone should always be registered as late as possible so override_existing only overwrites the records after the resource is ready to use.\n if @config['dns_records']\n @config['dns_records'].each { |dnsrec|\n dnsrec['name'] = repl_group.node_groups.first.primary_endpoint.address.downcase if !dnsrec.has_key?('name')\n dnsrec['name'] = \"#{dnsrec['name']}.#{MU.environment.downcase}\" if dnsrec[\"append_environment_name\"] && !dnsrec['name'].match(/\\.#{MU.environment.downcase}$/)\n }\n end\n # XXX this should be a call to @deploy.nameKitten\n MU::Cloud.resourceClass(\"AWS\", \"DNSZone\").createRecordsFromConfig(@config['dns_records'], target: repl_group.node_groups.first.primary_endpoint.address)\n\n deploy_struct = {\n \"identifier\" => repl_group.replication_group_id,\n \"create_style\" => @config[\"create_style\"],\n \"region\" => @region,\n \"members\" => repl_group.member_clusters,\n \"automatic_failover\" => repl_group.automatic_failover,\n \"snapshotting_cluster_id\" => repl_group.snapshotting_cluster_id,\n \"primary_endpoint\" => repl_group.node_groups.first.primary_endpoint.address,\n \"primary_port\" => repl_group.node_groups.first.primary_endpoint.port\n }\n\n repl_group.member_clusters.each { |id|\n cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(id, region: @region)\n\n vpc_sg_ids = []\n cluster.security_groups.each { |vpc_sg|\n vpc_sg_ids << vpc_sg.security_group_id\n }\n\n cache_sg_ids = []\n unless cluster.cache_security_groups.empty?\n cluster.cache_security_groups.each { |cache_sg|\n cache_sg_ids << cache_sg.security_group_id\n }\n end\n\n deploy_struct[id] = {\n \"configuration_endpoint\" => cluster.configuration_endpoint,\n \"cache_node_type\" => cluster.cache_node_type,\n \"engine\" => cluster.engine,\n \"engine_version\" => cluster.engine_version,\n \"num_cache_nodes\" => cluster.num_cache_nodes,\n \"preferred_maintenance_window\" => cluster.preferred_maintenance_window,\n \"notification_configuration\" => cluster.notification_configuration,\n \"cache_security_groups\" => cache_sg_ids,\n \"cache_parameter_group\" => cluster.cache_parameter_group.cache_parameter_group_name,\n \"cache_subnet_group_name\" => cluster.cache_subnet_group_name,\n \"cache_nodes\" => cluster.cache_nodes,\n \"auto_minor_version_upgrade\" => cluster.auto_minor_version_upgrade,\n \"vpc_security_groups\" => vpc_sg_ids,\n \"replication_group_id\" => cluster.replication_group_id,\n \"snapshot_retention_limit\" => cluster.snapshot_retention_limit,\n \"snapshot_window\" => cluster.snapshot_window \n }\n }\n\n repl_group.node_groups.first.node_group_members.each{ |member| \n deploy_struct[member.cache_cluster_id][\"cache_node_id\"] = member.cache_node_id\n deploy_struct[member.cache_cluster_id][\"read_endpoint_address\"] = member.read_endpoint.address\n deploy_struct[member.cache_cluster_id][\"read_endpoint_port\"] = member.read_endpoint.port\n deploy_struct[member.cache_cluster_id][\"current_role\"] = member.current_role\n }\n else\n cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(@config['identifier'], region: @region, credentials: @credentials)\n\n vpc_sg_ids = []\n cluster.security_groups.each { |vpc_sg|\n vpc_sg_ids << vpc_sg.security_group_id\n }\n\n cache_sg_ids = []\n unless cluster.cache_security_groups.empty?\n cluster.cache_security_groups.each { |cache_sg|\n cache_sg_ids << cache_sg.security_group_id\n }\n end\n\n deploy_struct = {\n \"cache_node_type\" => cluster.cache_node_type,\n \"engine\" => cluster.engine,\n \"engine_version\" => cluster.engine_version,\n \"num_cache_nodes\" => cluster.num_cache_nodes,\n \"preferred_maintenance_window\" => cluster.preferred_maintenance_window,\n \"notification_configuration\" => cluster.notification_configuration,\n \"cache_security_groups\" => cache_sg_ids,\n \"cache_parameter_group\" => cluster.cache_parameter_group.cache_parameter_group_name,\n \"cache_subnet_group_name\" => cluster.cache_subnet_group_name,\n \"cache_nodes\" => cluster.cache_nodes,\n \"auto_minor_version_upgrade\" => cluster.auto_minor_version_upgrade,\n \"vpc_security_groups\" => vpc_sg_ids,\n \"replication_group_id\" => cluster.replication_group_id,\n \"snapshot_retention_limit\" => cluster.snapshot_retention_limit,\n \"snapshot_window\" => cluster.snapshot_window \n }\n if !cluster.configuration_endpoint.nil?\n deploy_struct[\"configuration_endpoint_address\"] = cluster.configuration_endpoint.address\n deploy_struct[\"configuration_endpoint_port\"] = cluster.configuration_endpoint.port\n end\n end\n\n return deploy_struct\n end", "def update\n @version = @application.versions.find(params[:id])\n count = params['param_count'].to_i\n i=1\n saved=false\n error =\"\"\n @version.version_configurations.destroy_all\n begin\n while(i<=count)\n @configuration = VersionConfiguration.new({key: params[:version]['key'+i.to_s], value: params[:version]['value'+i.to_s], version_id: params[:id]})\n saved = @configuration.save!\n i=i+1\n end\n rescue => ex\n saved = false\n error=ex.backtrace.join('\\n')\n end\n\n\n respond_to do |format|\n if saved\n format.html { redirect_to [@application, @version], notice: 'Version was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #@version.errors[]=error;\n format.json { render json: @version.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end", "def run\n if !config[:run_list] and !config[:chef_env]\n ui.fatal \"Please specify either --run-list or --chef-env to change on your cluster\"\n exit(1)\n end\n if @name_args.empty?\n ui.fatal \"Please specify a load balancer ID to update\"\n exit(1)\n end\n lb_auth = authenticate()\n headers = {\"x-auth-token\" => lb_auth['auth_token'], \"content-type\" => \"application/json\"}\n lb_url = \"\"\n lb_auth['lb_urls'].each {|lb|\n if config[:lb_region].to_s.downcase == lb['region'].to_s.downcase\n lb_url = lb['publicURL']\n break\n end\n lb_url = lb['publicURL']\n }\n @name_args.each {|arg|\n lb_url = lb_url + \"/loadbalancers/#{arg}\"\n lb_data = make_web_call(\"get\", lb_url, headers)\n lb_data = JSON.parse(lb_data.body) \n instances = []\n lb_data['loadBalancer']['metadata'].each{|md|\n instances << {\"server_name\" => md['key'], \"uuid\" => md['uuid']}\n }\n \n if config[:run_list]\n config[:run_list] = config[:run_list].split(\",\")\n change_chef_vars(instances) { |node_item|\n ui.msg \"Changing #{node_item.name} run list to #{config[:run_list]}\"\n node_item.run_list(config[:run_list])\n node_item.save\n }\n end\n if config[:chef_env]\n change_chef_vars(instances){|node_item|\n ui.msg \"Changing #{node_item.name} chef environment to #{config[:chef_env]}\"\n node_item.chef_environment(config[:chef_env])\n node_item.save\n \n }\n end\n \n }\n \n end", "def flush\n return if @property_hash.empty?\n\n if @resource.should(:primitive)\n target = @resource.should(:primitive)\n elsif @resource.should(:group)\n target = @resource.should(:group)\n else\n raise Puppet::Error, 'No primitive or group'\n end\n updated = 'clone '\n updated << \"#{@resource.value(:name)} \"\n updated << \"#{target} \"\n meta = []\n {\n clone_max: 'clone-max',\n clone_node_max: 'clone-node-max',\n notify_clones: 'notify',\n globally_unique: 'globally-unique',\n ordered: 'ordered',\n interleave: 'interleave'\n }.each do |property, clone_property|\n meta << \"#{clone_property}=#{@resource.should(property)}\" unless @resource.should(property) == :absent\n end\n updated << 'meta ' << meta.join(' ') unless meta.empty?\n debug \"Update: #{updated}\"\n Tempfile.open('puppet_crm_update') do |tmpfile|\n tmpfile.write(updated)\n tmpfile.flush\n cmd = [command(:crm), 'configure', 'load', 'update', tmpfile.path.to_s]\n self.class.run_command_in_cib(cmd, @resource.value(:cib))\n end\n end", "def patch_adapter_config_policy_with_http_info(moid, adapter_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.patch_adapter_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling AdapterApi.patch_adapter_config_policy\"\n end\n # verify the required parameter 'adapter_config_policy' is set\n if @api_client.config.client_side_validation && adapter_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'adapter_config_policy' when calling AdapterApi.patch_adapter_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/adapter/ConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(adapter_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AdapterConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AdapterApi.patch_adapter_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AdapterApi#patch_adapter_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @resources = args[:resources] if args.key?(:resources)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def munge_config\n @data = @config.send(:data).instance_variable_get(:@data)\n @data[:driver][:instance_name] = @image.id\n suite = @data[:suites].find{ |n| n[:name] == @image.name }\n if suite && suite[:inherit]\n inherited = Linecook::Image.new(suite[:inherit][:name], suite[:inherit][:group], suite[:inherit][:tag])\n inherit(inherited)\n @data[:driver][:image] = \"#{inherited.group}:#{inherited.tag}\"\n @data[:driver][:provision_command] ||= []\n @data[:driver][:provision_command] << 'sed -i \\'s/\\(PasswordAuthentication no\\)/#\\1/g\\' /etc/ssh/sshd_config'\n end\n end", "def modify_file\n\n file_name = \"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @current_resource.pool_name }.conf\"\n\n #Start Base Configuration\n find_replace(file_name, \"user = \", @current_resource.pool_user, @new_resource.pool_user)\n find_replace(file_name, \"group = \", @current_resource.pool_group, @new_resource.pool_group)\n\n #Replace IP Address and Port\n if @current_resource.listen_address != @new_resource.listen_address || @current_resource.listen_port != @new_resource.listen_port && (!@current_resource.use_sockets)\n find_replace(file_name, \"listen = \", \"#{ @current_resource.listen_address }:#{ @current_resource.listen_port }\", \"#{ @new_resource.listen_address }:#{ @new_resource.listen_port }\")\n else\n find_replace(file_name, \"listen = \",\"#{ @current_resource.listen_socket }\", \"#{ @new_resource.listen_socket }\")\n end\n\n @new_resource.listen_allowed_clients != nil ? find_replace(file_name, \"listen.allowed_clients = \",@current_resource.listen_allowed_clients, @new_resource.listen_allowed_clients) : nil\n @new_resource.listen_owner != nil ? find_replace(file_name, \"listen.owner = \",@current_resource.listen_owner, @new_resource.listen_owner) : nil\n @new_resource.listen_group != nil ? find_replace(file_name, \"listen.group = \",@current_resource.listen_group, @new_resource.listen_group) : nil\n @new_resource.listen_mode != nil ? find_replace(file_name, \"listen.mode = \",@current_resource.listen_mode, @new_resource.listen_mode) : nil\n @new_resource.listen_backlog != nil ? find_replace(file_name, \"listen.backlog = \",@current_resource.listen_backlog, @new_resource.listen_backlog) : nil\n\n #Start PM configuration\n @new_resource.pm != nil ? find_replace(file_name, \"pm = \",@current_resource.pm,@new_resource.pm) : nil\n @new_resource.pm_max_children != nil ? find_replace(file_name, \"pm.max_children = \",@current_resource.pm_max_children, @new_resource.pm_max_children) : nil\n @new_resource.pm_start_servers != nil ? find_replace(file_name, \"pm.start_servers = \",@current_resource.pm_start_servers, @new_resource.pm_start_servers) : nil\n @new_resource.pm_min_spare_servers != nil ? find_replace(file_name, \"pm.min_spare_servers = \",@current_resource.pm_min_spare_servers, @new_resource.pm_min_spare_servers) : nil\n @new_resource.pm_max_spare_servers != nil ? find_replace(file_name, \"pm.max_spare_servers = \",@current_resource.pm_max_spare_servers, @new_resource.pm_max_spare_servers) : nil\n @new_resource.pm_process_idle_timeout != nil ? find_replace(file_name, \"pm.process_idle_timeout = \",@current_resource.pm_process_idle_timeout, @new_resource.pm_process_idle_timeout) : nil\n @new_resource.pm_max_requests != nil ? find_replace(file_name, \"pm.max_requests = \",@current_resource.pm_max_requests, @new_resource.pm_max_requests) : nil\n @new_resource.pm_status_path != nil ? find_replace(file_name, \"pm.status_path = \",@current_resource.pm_status_path, @new_resource.pm_status_path) : nil\n\n #Start Ping\n @new_resource.ping_path != nil ? find_replace(file_name, \"ping.path = \",@current_resource.ping_path, @new_resource.ping_path) : nil\n @new_resource.ping_response != nil ? find_replace(file_name, \"ping.response = \",@current_resource.ping_response, @new_resource.ping_response) : nil\n\n #Start Logging\n @new_resource.access_format != nil ? find_replace(file_name, \"access.format = \",@current_resource.access_format, @new_resource.access_format.gsub(\"\\\\\",\"\")) : nil\n @new_resource.request_slowlog_timeout != nil ? find_replace(file_name, \"request_slowlog_timeout = \",@current_resource.request_slowlog_timeout, @new_resource.request_slowlog_timeout) : nil\n @new_resource.request_terminate_timeout != nil ? find_replace(file_name, \"request_terminate_timeout = \",@current_resource.request_terminate_timeout, @new_resource.request_terminate_timeout) : nil\n @new_resource.access_log != nil ? find_replace(file_name, \"access.log = \",@current_resource.access_log, @new_resource.access_log) : nil\n @new_resource.slow_log != nil ? find_replace(file_name, \"slowlog = \",@current_resource.slow_log, @new_resource.slow_log) : nil\n\n #Start Misc\n @new_resource.chdir != nil ? find_replace(file_name, \"chdir = \",@current_resource.chdir, @new_resource.chdir) : nil\n @new_resource.chroot != nil ? find_replace(file_name, \"chroot = \",@current_resource.chroot, @new_resource.chroot) : nil\n @new_resource.catch_workers_output != nil ? find_replace(file_name, \"catch_workers_output = \",@current_resource.catch_workers_output, @new_resource.catch_workers_output) : nil\n @new_resource.security_limit_extensions != nil ? find_replace(file_name, \"security.limit_extensions = \",@current_resource.security_limit_extensions, @new_resource.security_limit_extensions) : nil\n @new_resource.rlimit_files != nil ? find_replace(file_name, \"rlimit_files = \",@current_resource.rlimit_files, @new_resource.rlimit_files) : nil\n @new_resource.rlimit_core != nil ? find_replace(file_name, \"rlimit_core = \",@current_resource.rlimit_core, @new_resource.rlimit_core) : nil\n\n #Start PHP INI Values\n if !@current_resource.php_ini_values.nil?\n @current_resource.php_ini_values.each do | k, v |\n find_replace(file_name, \"php_value[#{ k }] = \", v, @new_resource.php_ini_values[\"#{ k }\"])\n end\n end\n\n #Start PHP INI Flags\n if !@current_resource.php_ini_flags.nil?\n @current_resource.php_ini_flags.each do | k, v |\n find_replace(file_name, \"php_flag[#{ k }] = \", v, @new_resource.php_ini_flags[\"#{ k }\"])\n end\n end\n\n #Start PHP INI Admin Values\n if !@current_resource.php_ini_admin_values.nil?\n @current_resource.php_ini_admin_values.each do | k, v |\n find_replace(file_name, \"php_admin_value[#{ k }] = \", v, @new_resource.php_ini_admin_values[\"#{ k }\"])\n end\n end\n\n #Start PHP INI Admin Flags\n if !@current_resource.php_ini_admin_flags.nil?\n @current_resource.php_ini_admin_flags.each do | k, v |\n find_replace(file_name, \"php_admin_flag[#{ k }] = \", v, @new_resource.php_ini_admin_flags[\"#{ k }\"])\n end\n end\n\n #Start ENV Variables\n if !@current_resource.env_variables.nil?\n @current_resource.env_variables.each do | k, v |\n find_replace(file_name, \"env[#{ k }] = \",v,@new_resource.env_variables[\"#{ k }\"])\n end\n end\n\nend", "def update!(**args)\n @image_config = args[:image_config] if args.key?(:image_config)\n @instance_config = args[:instance_config] if args.key?(:instance_config)\n @notification_config = args[:notification_config] if args.key?(:notification_config)\n @sequence_number = args[:sequence_number] if args.key?(:sequence_number)\n end", "def update!(**args)\n @deployment_config = args[:deployment_config] if args.key?(:deployment_config)\n end", "def patch_kubernetes_sys_config_policy_with_http_info(moid, kubernetes_sys_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_sys_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_sys_config_policy\"\n end\n # verify the required parameter 'kubernetes_sys_config_policy' is set\n if @api_client.config.client_side_validation && kubernetes_sys_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_sys_config_policy' when calling KubernetesApi.patch_kubernetes_sys_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/SysConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_sys_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesSysConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_sys_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_sys_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @completion_stats = args[:completion_stats] if args.key?(:completion_stats)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_container_logging = args[:disable_container_logging] if args.key?(:disable_container_logging)\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 @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @generate_explanation = args[:generate_explanation] if args.key?(:generate_explanation)\n @input_config = args[:input_config] if args.key?(:input_config)\n @instance_config = args[:instance_config] if args.key?(:instance_config)\n @labels = args[:labels] if args.key?(:labels)\n @manual_batch_tuning_parameters = args[:manual_batch_tuning_parameters] if args.key?(:manual_batch_tuning_parameters)\n @model = args[:model] if args.key?(:model)\n @model_monitoring_config = args[:model_monitoring_config] if args.key?(:model_monitoring_config)\n @model_monitoring_stats_anomalies = args[:model_monitoring_stats_anomalies] if args.key?(:model_monitoring_stats_anomalies)\n @model_monitoring_status = args[:model_monitoring_status] if args.key?(:model_monitoring_status)\n @model_parameters = args[:model_parameters] if args.key?(:model_parameters)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @name = args[:name] if args.key?(:name)\n @output_config = args[:output_config] if args.key?(:output_config)\n @output_info = args[:output_info] if args.key?(:output_info)\n @partial_failures = args[:partial_failures] if args.key?(:partial_failures)\n @resources_consumed = args[:resources_consumed] if args.key?(:resources_consumed)\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 @unmanaged_container_model = args[:unmanaged_container_model] if args.key?(:unmanaged_container_model)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def generate_methods(integrations = true)\n resp = MU::Cloud::AWS.apig(region: @region, credentials: @credentials).get_resources(\n rest_api_id: @cloud_id,\n )\n root_resource = resp.items.first.id\n\n # TODO guard this crap so we don't touch it if there are no changes\n @config['methods'].each { |m|\n m[\"auth\"] ||= m[\"iam_role\"] ? \"AWS_IAM\" : \"NONE\"\n\n method_arn = \"arn:#{MU::Cloud::AWS.isGovCloud?(@region) ? \"aws-us-gov\" : \"aws\"}:execute-api:#{@region}:#{MU::Cloud::AWS.credToAcct(@credentials)}:#{@cloud_id}/*/#{m['type']}/#{m['path']}\"\n path_part = [\"\", \"/\"].include?(m['path']) ? nil : m['path']\n method_arn.sub!(/\\/\\/$/, '/')\n\n resp = MU::Cloud::AWS.apig(region: @region, credentials: @credentials).get_resources(\n rest_api_id: @cloud_id\n )\n ext_resource = nil\n resp.items.each { |resource|\n if resource.path_part == path_part\n ext_resource = resource.id\n end\n }\n\n resp = if ext_resource\nMU::Cloud::AWS.apig(region: @region, credentials: @credentials).get_resource(\n rest_api_id: @cloud_id,\n resource_id: ext_resource,\n)\n# MU::Cloud::AWS.apig(region: @region, credentials: @credentials).update_resource(\n# rest_api_id: @cloud_id,\n# resource_id: ext_resource,\n# patch_operations: [\n# {\n# op: \"replace\",\n# path: \"XXX ??\",\n# value: m[\"path\"]\n# }\n# ]\n# )\n else\n MU::Cloud::AWS.apig(region: @region, credentials: @credentials).create_resource(\n rest_api_id: @cloud_id,\n parent_id: root_resource,\n path_part: path_part\n )\n end\n parent_id = resp.id\n\n resp = begin\n MU::Cloud::AWS.apig(region: @region, credentials: @credentials).get_method(\n rest_api_id: @cloud_id,\n resource_id: parent_id,\n http_method: m['type']\n )\n rescue Aws::APIGateway::Errors::NotFoundException\n resp = MU::Cloud::AWS.apig(region: @region, credentials: @credentials).put_method(\n rest_api_id: @cloud_id,\n resource_id: parent_id,\n authorization_type: m['auth'],\n http_method: m['type']\n )\n end\n\n # XXX effectively a placeholder default\n begin\n m['responses'].each { |r|\n params = {\n :rest_api_id => @cloud_id,\n :resource_id => parent_id,\n :http_method => m['type'],\n :status_code => r['code'].to_s\n }\n if r['headers']\n params[:response_parameters] = r['headers'].map { |h|\n h['required'] ||= false\n [\"method.response.header.\"+h['header'], h['required']]\n }.to_h\n end\n\n if r['body']\n# XXX I'm guessing we can also have arbirary user-defined models somehow, so is_error is probably inadequate to the demand of the times\n params[:response_models] = r['body'].map { |b| [b['content_type'], b['is_error'] ? \"Error\" : \"Empty\"] }.to_h\n end\n\n MU::Cloud::AWS.apig(region: @region, credentials: @credentials).put_method_response(params)\n }\n rescue Aws::APIGateway::Errors::ConflictException\n # fine to ignore\n end\n\n if integrations and m['integrate_with']\n# role_arn = if m['iam_role']\n# if m['iam_role'].match(/^arn:/)\n# m['iam_role']\n# else\n# sib_role = @deploy.findLitterMate(name: m['iam_role'], type: \"roles\")\n# sib_role.cloudobj.arn\n# XXX make this more like get_role_arn in Function, or just use Role.find?\n# end\n# end\n\n function_obj = nil\n aws_int_type = m['integrate_with']['proxy'] ? \"AWS_PROXY\" : \"AWS\"\n\n uri, type = if m['integrate_with']['type'] == \"aws_generic\"\n svc, action = m['integrate_with']['aws_generic_action'].split(/:/)\n [\"arn:aws:apigateway:\"+@region+\":#{svc}:action/#{action}\", aws_int_type]\n elsif m['integrate_with']['type'] == \"functions\"\n function_obj = nil\n MU.retrier([], max: 5, wait: 9, loop_if: Proc.new { function_obj.nil? }) {\n function_obj = @deploy.findLitterMate(name: m['integrate_with']['name'], type: \"functions\")\n }\n [\"arn:aws:apigateway:\"+@region+\":lambda:path/2015-03-31/functions/\"+function_obj.cloudobj.arn+\"/invocations\", aws_int_type]\n elsif m['integrate_with']['type'] == \"mock\"\n [nil, \"MOCK\"]\n end\n\n params = {\n :rest_api_id => @cloud_id,\n :resource_id => parent_id,\n :type => type, # XXX Lambda and Firehose can do AWS_PROXY\n :content_handling => \"CONVERT_TO_TEXT\", # XXX expose in BoK\n :http_method => m['type'],\n :timeout_in_millis => m['timeout_in_millis']\n# credentials: role_arn\n }\n params[:uri] = uri if uri\n\n if m['integrate_with']['type'] != \"mock\"\n params[:integration_http_method] = m['integrate_with']['backend_http_method']\n else\n params[:integration_http_method] = nil\n end\n\n if m['integrate_with']['passthrough_behavior']\n params[:passthrough_behavior] = m['integrate_with']['passthrough_behavior']\n end\n if m['integrate_with']['request_templates']\n params[:request_templates] = {}\n m['integrate_with']['request_templates'].each { |rt|\n params[:request_templates][rt['content_type']] = rt['template']\n }\n end\n if m['integrate_with']['parameters']\n params[:request_parameters] = Hash[m['integrate_with']['parameters'].map { |p|\n [\"integration.request.#{p['type']}.#{p['name']}\", p['value']]\n }]\n end\n\n resp = MU::Cloud::AWS.apig(region: @region, credentials: @credentials).put_integration(params)\n\n if m['integrate_with']['type'] =~ /^functions?$/\n function_obj.addTrigger(method_arn, \"apigateway\", @config['name'])\n end\n\n m['responses'].each { |r|\n params = {\n :rest_api_id => @cloud_id,\n :resource_id => parent_id,\n :http_method => m['type'],\n :status_code => r['code'].to_s,\n :selection_pattern => \".*\"\n }\n if r['headers']\n params[:response_parameters] = r['headers'].map { |h|\n [\"method.response.header.\"+h['header'], \"'\"+h['value']+\"'\"]\n }.to_h\n end\n\n MU::Cloud::AWS.apig(region: @region, credentials: @credentials).put_integration_response(params)\n\n }\n\n end\n\n }\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\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 flush\n if @hosttemplate_json\n @updated_json = @hosttemplate_json.dup\n else\n @updated_json = default_hosttemplate\n end\n \n # Update the hosttemplate's JSON values based on any new params. Sadly due to the\n # structure of the JSON vs the flat nature of the puppet properties, this\n # is a bit of a manual task.\n @updated_json[\"name\"] = @resource[:name]\n @updated_json[\"description\"] = @property_hash[:description]\n @updated_json[\"servicechecks\"] = []\n if not @property_hash[:servicechecks].empty?\n @property_hash[:servicechecks].each do |sc_hash|\n @updated_json[\"servicechecks\"] << {:name => sc_hash[\"name\"], :event_handler => sc_hash[\"event_handler\"],\n\t\t\t\t\t\t:exception => sc_hash[\"exception\"]\n }\n end\n end\n\n # If managementurls are set in the manifest update the JSON content for the\n # managementurls object with a list of hashes where each hash has a \"name\"\n # and an \"url\" key.\n @updated_json[\"managementurls\"] = []\n if not @property_hash[:managementurls].empty?\n @property_hash[:managementurls].each do |mu|\n @updated_json[\"managementurls\"] << { \"name\" => mu[\"name\"], \"url\" => mu[\"url\"] }\n end\n end\n \n # Flush changes:\n put @updated_json.to_json\n\n if defined? @resource[:reload_opsview]\n if @resource[:reload_opsview].to_s == \"true\"\n Puppet.notice \"Configured to reload opsview\"\n do_reload_opsview\n else\n Puppet.notice \"Configured NOT to reload opsview\"\n end\n end\n\n @property_hash.clear\n @hosttemplate_properties.clear\n\n false\n end", "def update!(**args)\n @cloud_bigtable_instance_spec = args[:cloud_bigtable_instance_spec] if args.key?(:cloud_bigtable_instance_spec)\n end", "def apply_update_patch(patch_filename)\n updater = ClientUpdaterCtrl.new\n updater.gui_progress = @cup_gui\n updater.net_controller = self\n begin \n #updater.install_package_patch(patch_filename)\n updater.begin_install_patch(@model_net_data, patch_filename)\n rescue\n @cup_gui.log_sometext(\"ERRORE: Update non riuscito\\n\")\n end\n \n end", "def update!(**args)\n @clusters = args[:clusters] if args.key?(:clusters)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @parent = args[:parent] if args.key?(:parent)\n end", "def update!(**args)\n @clusters = args[:clusters] if args.key?(:clusters)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @parent = args[:parent] if args.key?(:parent)\n end", "def update\n @test_run.scenarios.map! do |s|\n s.test_run = @test_run\n s.config_template = @test_run.config\n s\n end\n if @test_run.update(test_run_params)\n redirect_to @test_run, notice: 'Test run was successfully updated.'\n else\n render action: 'edit'\n end\n end", "def attributes=(should)\n connect unless @connection\n case @resource[:entry_management]\n when :inclusive\n Puppet.debug(\"Replacing entire #{@resource[:name]} entry\")\n data = should\n data['objectclass'] = @resource[:objectclass]\n @connection.delete(:dn => @resource[:name])\n @connection.add(:dn => @resource[:name], :attributes => data)\n when :minimal\n attributes_to_update.each do |k, v|\n Puppet.debug(\"Updating #{k} with #{v} for entry #{@resource[:name]}\")\n @connection.modify(:dn => @resource[:name], :operations => [[ :replace, k.to_sym, v ]])\n end\n end\n end", "def retry_change_requests=(retry_change_requests); end", "def swap_rspec_configuration(key, value); end", "def http_prop_patch(request, response)\n path = request.path\n\n begin\n prop_patch = @server.xml.expect('{DAV:}propertyupdate', request.body)\n rescue Tilia::Xml::ParseException => e\n raise Exception::BadRequest, e.message, nil, e\n end\n\n new_properties = prop_patch.properties\n\n result = @server.update_properties(path, new_properties)\n\n prefer = @server.http_prefer\n response.update_header('Vary', 'Brief,Prefer')\n\n if prefer['return'] == 'minimal'\n # If return-minimal is specified, we only have to check if the\n # request was succesful, and don't need to return the\n # multi-status.\n ok = true\n result.each do |_prop, code|\n ok = false if code.to_i > 299\n end\n\n if ok\n response.status = 204\n return false\n end\n end\n\n response.status = 207\n response.update_header('Content-Type', 'application/xml; charset=utf-8')\n\n # Reorganizing the result for generateMultiStatus\n multi_status = {}\n result.each do |property_name, code|\n if multi_status.key?(code)\n multi_status[code][property_name] = nil\n else\n multi_status[code] = { property_name => nil }\n end\n end\n multi_status['href'] = path\n\n response.body = @server.generate_multi_status([multi_status])\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def sync!(desired)\n # Ensure that the telegraf.conf item is always mounted\n items = [\n {\n key: 'telegraf.conf',\n path: 'telegraf.conf'\n },\n desired\n ].sort_by { |item| item[:path] }\n\n cm_volume = {\n name: @volume,\n configMap: {\n name: @configmap,\n defaultMode: 420,\n items: items\n }\n }\n\n patch = {\n spec: {\n template: {\n spec: {\n volumes: [cm_volume]\n }\n }\n }\n }\n\n @api\n .api('apps/v1')\n .resource('deployments', namespace: @ns)\n .merge_patch(@deployment, patch)\n\n # Refresh the current state\n fetch!\n end", "def update_deployment_monitors(deployments)\n \n deployments.each do |dep|\n monitor = UrlMonitor.first(:conditions => [\"parent_id= ? AND parent_type= ?\", dep.id, dep.class.to_s ])\n if monitor.nil?\n mon = UrlMonitor.new(:parent_id => dep.id, \n :parent_type => dep.class.to_s, \n :property => \"endpoint\")\n if !@options[:test]\n if mon.save\n puts \"Created new monitor for deployment id : #{dep.id}\"\n end\n else\n puts \"found endpoint that needs monitoring : #{dep.endpoint}\"\n end\n end\n end\nend", "def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n # jankety solution to set version properly\n @test_instance.update_version(true)\n\n format.html do\n redirect_to test_case_test_instances_url(@test_case),\n notice: 'Test instance was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json do\n render json: @test_instance.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def partial_update_instance instance, update_mask\n execute do\n instances.partial_update_instance(instance, update_mask)\n end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def redeploy(opts)\n client = opts.k8s.to_api\n patch = {\n spec: {\n template: {\n metadata: {\n annotations: {\n \"kubectl.kubernetes.io/restartedAt\" => Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z')\n }\n }\n }\n }\n }\n\n client\n .api('apps/v1')\n .resource('deployments', namespace: opts[:k8s][:k8s_namespace])\n .merge_patch(opts[:k8s][:k8s_deployment], patch)\nend", "def prop_patch(prop_patch)\n @carddav_backend.update_address_book(@address_book_info['id'], prop_patch)\n end", "def update_partial_patch_config(partial_patch_config, opts = {})\n update_partial_patch_config_with_http_info(partial_patch_config, opts)\n nil\n end", "def update!(**args)\n @acked_instance_count = args[:acked_instance_count] if args.key?(:acked_instance_count)\n @applying_patches_instance_count = args[:applying_patches_instance_count] if args.key?(:applying_patches_instance_count)\n @downloading_patches_instance_count = args[:downloading_patches_instance_count] if args.key?(:downloading_patches_instance_count)\n @failed_instance_count = args[:failed_instance_count] if args.key?(:failed_instance_count)\n @inactive_instance_count = args[:inactive_instance_count] if args.key?(:inactive_instance_count)\n @no_agent_detected_instance_count = args[:no_agent_detected_instance_count] if args.key?(:no_agent_detected_instance_count)\n @notified_instance_count = args[:notified_instance_count] if args.key?(:notified_instance_count)\n @pending_instance_count = args[:pending_instance_count] if args.key?(:pending_instance_count)\n @post_patch_step_instance_count = args[:post_patch_step_instance_count] if args.key?(:post_patch_step_instance_count)\n @pre_patch_step_instance_count = args[:pre_patch_step_instance_count] if args.key?(:pre_patch_step_instance_count)\n @rebooting_instance_count = args[:rebooting_instance_count] if args.key?(:rebooting_instance_count)\n @started_instance_count = args[:started_instance_count] if args.key?(:started_instance_count)\n @succeeded_instance_count = args[:succeeded_instance_count] if args.key?(:succeeded_instance_count)\n @succeeded_reboot_required_instance_count = args[:succeeded_reboot_required_instance_count] if args.key?(:succeeded_reboot_required_instance_count)\n @timed_out_instance_count = args[:timed_out_instance_count] if args.key?(:timed_out_instance_count)\n end", "def patch(patchset)\n Diff::LCS.patch(self, patchset)\n end", "def patch!(patchset)\n Diff::LCS.patch!(self, patchset)\n end", "def run\n super\n\n # start with negative\n api_endpoint = nil\n api_reason = nil\n\n require_enrichment\n\n # get our url\n url = _get_entity_name\n\n ###\n # First just check our fingerprint, lots of stuff will already have been\n # fingerprinted during our ident run\n ###\n (_get_entity_detail(\"fingerprint\") || []).each do |fp|\n api_endpoint = true if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n api_reason = \"fingerprint\"\n end\n\n # first get a standard response\n standard_response = http_request :get, url\n return unless standard_response\n\n ####\n # next just check keywords in the url, but of course, sanity check this.\n ###\n if ( url.match(/api\\./) ||\n url.match(/apis\\./) ||\n url.match(/\\/api/) ||\n url.match(/\\/json/) ||\n url.match(/\\.json/) ||\n url.match(/\\.xml/) ||\n url.match(/skiptoken/) ||\n url.match(/\\/restapis/) )\n\n unless (\n url.match(/googleapis/) ||\n url.match(/\\.amazonaws\\.com/) ||\n standard_response.body_utf8.match(/^<HTML>/i) ||\n standard_response.body_utf8.match(/HTTP Status 404/i) ||\n standard_response.body_utf8.match(/NoSuchBucket/i) ) \n api_endpoint = true\n api_reason = \"url\"\n end\n\n end\n\n ###\n ### If we made it this far, and our base url matches, just return that\n if api_endpoint\n _create_api_endpoint(url, url, api_reason)\n return # return if our base URL was an endpoint\n end\n\n ####\n # otherwise check patterns in / around the original\n ####\n\n # always start empty\n api_endpoint = nil\n\n [\n \"#{url}\",\n \"#{url}/api\",\n \"#{url}/api/v1\",\n \"#{url}/api/v2\",\n \"#{url}/api/v3\",\n \"#{url}/docs\",\n \"#{url}/graphql\",\n \"#{url}/api-docs\",\n \"#{url}/api-docs/swagger.json\",\n \"#{url}/api/swagger\",\n \"#{url}/api/swagger-ui.html\",\n \"#{url}/api/swagger.yml\",\n \"#{url}/api/v2/swagger.json\",\n \"#{url}/apidocs\",\n \"#{url}/apidocs/swagger.json\",\n \"#{url}/rest\",\n \"#{url}/swagger\",\n \"#{url}/swagger/\",\n \"#{url}/swagger-resources\",\n \"#{url}/swagger-ui\",\n \"#{url}/swagger-ui.html\",\n \"#{url}/swagger.json\",\n \"#{url}/swagger/index.html\",\n \"#{url}/swagger/swagger-ui.html\",\n \"#{url}/swagger/ui/index\",\n \"#{url}/swagger/v1/swagger.json\",\n \"#{url}/v1/swagger.json\"\n ].each do |u|\n\n _log \"Checking... #{u}\"\n\n # Go ahead and get the response for this paritcular endpoint\n\n response = http_request :get, u\n\n next unless response\n # skip if we're not the original url, but we're getting the same response\n\n next if u != url && response.body_utf8 == standard_response.body_utf8\n\n ###\n ### Check for known strings\n ###\n if (response.body_utf8.match(/swagger-section/) ||\n response.body_utf8.match(/swaggerhub.com/) ||\n response.body_utf8.match(/soapenv:Envelope/) )\n # break and create it\n api_reason = \"response_body\"\n api_endpoint = u\n break\n end\n\n # check for content type of application.. note that this will flag\n # application/javascript, which is probably not wanted\n headers = standard_response.headers\n if headers\n ct = headers.find{|x, y| x if x =~ /^content-type/i }\n if ct\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/xml/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/ld+json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/x-protobuf/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/octet-stream/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^text\\/csv/i)\n\n # break and create it\n if api_endpoint\n api_reason = \"content_type\"\n break\n end\n\n end\n end\n\n ###\n # try to parse it (JSON)\n ###\n begin\n # get request body\n body = standard_response.body_utf8\n if body\n json = JSON.parse(body)\n\n if json\n # now check for common error scenarios, and proceed if we pass\n break if json.kind_of?(Hash) && \n ((standard_response.code == \"404\" && json[\"error\"] == \"Not Found\") ||\n (standard_response.code == \"404\" && json[\"response\"] == \"Content was not found.\"))\n \n # create it as an api endpoint\n api_endpoint = u\n api_reason = \"json_body\"\n break\n end\n\n end\n rescue JSON::ParserError\n _log \"No body!\"\n end\n\n # check known fingeprints\n _log \"Attempting to fingerprint (without the browser)!\"\n ident_matches = generate_http_requests_and_check(u,{:enable_browser => false, :'only-check-base-url' => true}) || {}\n ident_fingerprints = ident_matches[\"fingerprint\"] || []\n ident_fingerprints.each do |fp|\n api_endpoint = u if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n # break if it's been set so we dont genereate a bunch of FP's\n if api_endpoint\n api_reason = \"fingerprint\"\n break\n end\n end\n end\n\n ###\n ### Okay now that we're at the end, do we have an endpoint?!?\n ###\n\n # set the details and create a new entity if we made it this far!\n if api_endpoint\n _create_api_endpoint(url, api_endpoint, api_reason)\n else\n _set_entity_detail \"api_endpoint\", false\n end\n\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_deployments = args[:patch_deployments] if args.key?(:patch_deployments)\n end", "def patch(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = self.to_patch_request_information(\n body, request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::IdentityGovernanceWorkflow.create_from_discriminator_value(pn) }, error_mapping)\n end", "def patch_kubernetes_virtual_machine_infra_config_policy_with_http_info(moid, kubernetes_virtual_machine_infra_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_virtual_machine_infra_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_virtual_machine_infra_config_policy\"\n end\n # verify the required parameter 'kubernetes_virtual_machine_infra_config_policy' is set\n if @api_client.config.client_side_validation && kubernetes_virtual_machine_infra_config_policy.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_virtual_machine_infra_config_policy' when calling KubernetesApi.patch_kubernetes_virtual_machine_infra_config_policy\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInfraConfigPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_virtual_machine_infra_config_policy)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInfraConfigPolicy'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_virtual_machine_infra_config_policy\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_virtual_machine_infra_config_policy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_config(options = {})\n @logger.debug(\"config changed: #{options.inspect}\")\n @urlmapping = options[:urlmapping] || []\n @filters = options[:filters] || []\n end", "def update!(**args)\n @app_engine_version = args[:app_engine_version] if args.key?(:app_engine_version)\n @cloud_function = args[:cloud_function] if args.key?(:cloud_function)\n @cloud_run_revision = args[:cloud_run_revision] if args.key?(:cloud_run_revision)\n @cloud_sql_instance = args[:cloud_sql_instance] if args.key?(:cloud_sql_instance)\n @forwarding_rule = args[:forwarding_rule] if args.key?(:forwarding_rule)\n @forwarding_rule_target = args[:forwarding_rule_target] if args.key?(:forwarding_rule_target)\n @gke_master_cluster = args[:gke_master_cluster] if args.key?(:gke_master_cluster)\n @instance = args[:instance] if args.key?(:instance)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @load_balancer_id = args[:load_balancer_id] if args.key?(:load_balancer_id)\n @load_balancer_type = args[:load_balancer_type] if args.key?(:load_balancer_type)\n @network = args[:network] if args.key?(:network)\n @network_type = args[:network_type] if args.key?(:network_type)\n @port = args[:port] if args.key?(:port)\n @project_id = args[:project_id] if args.key?(:project_id)\n end" ]
[ "0.68494856", "0.5918646", "0.5859882", "0.5859882", "0.5806079", "0.57658654", "0.57304156", "0.56215", "0.560534", "0.5602159", "0.55409354", "0.5531964", "0.5418074", "0.54102844", "0.54032946", "0.53555703", "0.53555167", "0.5332237", "0.5299539", "0.5297913", "0.5275466", "0.52550143", "0.52332234", "0.5230068", "0.52286875", "0.5226697", "0.521201", "0.52088445", "0.51933545", "0.5185117", "0.5178532", "0.51776934", "0.5166423", "0.5165776", "0.5155477", "0.5146694", "0.5132773", "0.5121841", "0.50914407", "0.509134", "0.5087071", "0.5086623", "0.5063283", "0.50501513", "0.50428903", "0.5031365", "0.50311494", "0.5017197", "0.4999381", "0.49958548", "0.497953", "0.49763715", "0.49659476", "0.496298", "0.4955022", "0.4948434", "0.49483958", "0.49441096", "0.49424854", "0.4942057", "0.49407396", "0.49406174", "0.49366492", "0.4930749", "0.49251387", "0.49202448", "0.49165514", "0.4912431", "0.49053276", "0.49052235", "0.49044997", "0.49044997", "0.48989618", "0.489626", "0.4895143", "0.48932973", "0.48883095", "0.48883095", "0.4886447", "0.48780066", "0.4875621", "0.48668388", "0.48643857", "0.48642805", "0.4864233", "0.48613226", "0.4856505", "0.48557228", "0.4832098", "0.48224702", "0.48188025", "0.4813704", "0.4810775", "0.4810457", "0.4809713", "0.4807483", "0.4805688", "0.48010796", "0.47951975", "0.47949526" ]
0.7523682
0
Baseline implementation for the recreate_instances REST call
def recreate_instances request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_recreate_instances_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n run_result = JSON.parse(make_call(request, uri))\n Djinn.log_debug(\"[IM] Run instances info says [#{run_result}]\")\n operation_id = run_result['operation_id']\n\n vm_info = {}\n loop {\n begin\n describe_result = describe_operation(operation_id)\n rescue Djinn::FailedNodeException => error\n Djinn.log_warn(\n \"[IM] Error describing run instances operation #{operation_id}. \" \\\n \"Error: #{error.message}\")\n next\n end\n Djinn.log_debug(\"[IM] Describe run operation has vm_info \" \\\n \"#{describe_result['vm_info'].inspect}.\")\n\n if describe_result['state'] == 'success'\n vm_info = describe_result['vm_info']\n break\n elsif describe_result['state'] == 'failed'\n raise AppScaleException.new(describe_result['reason'])\n end\n Kernel.sleep(SMALL_WAIT)\n }\n\n # ip:role:instance-id\n instances_created = []\n vm_info['public_ips'].each_index { |index|\n tmp_roles = roles[index]\n tmp_roles = 'open' if roles[index].nil?\n instances_created << {\n 'public_ip' => vm_info['public_ips'][index],\n 'private_ip' => vm_info['private_ips'][index],\n 'roles' => tmp_roles,\n 'instance_id' => vm_info['instance_ids'][index],\n 'disk' => disks[index],\n 'instance_type' => options['instance_type']\n }\n }\n\n instances_created\n end", "def reboot_instances(*instances)\n instances = instances.flatten\n link = generate_request(\"RebootInstances\", amazonize_list('InstanceId', instances))\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def recreate!\n delete! rescue nil\n create!\n end", "def list_instances\n puts \"OK, Listing instances..\"\n\n response = RestClient.post( \n $uri,\n 'Version' => '2010-12-30',\n 'ACSAccessKeyId' => $ACSAccessKeyId,\n 'Format' => 'json',\n 'Timestamp' => $current_time,\n 'Rndguid' => $rndguid,\n 'Signature' => calculate_signature($api_private_key, $rndguid, $current_time),\n 'Action' => \"list-instances\")\n\n puts response\n puts response.code\nend", "def create_servers\n # use \"rsc\" tool to get detailed deployment + server view from api 1.6, not supported by right_api_client\n old_deployment = JSON.parse(`rsc -a #{@options[:src]} cm16 show /api/deployments/#{@options[:deployment]} view=full`)\n\n old_deployment['servers'].each do |server|\n @api.account_id = @options[:src]\n name = server['next_instance']['name']\n\n puts \"Creating server: #{name} ...\\n\"\n\n cloud = find_cloud(server['next_instance']['links']['cloud']['href'], name)\n @api.account_id = @options[:src]\n\n ssh_key = choose_ssh_key(cloud)\n @api.account_id = @options[:src]\n\n instance_type = choose_instance_type(cloud)\n old_st_url = server['next_instance']['server_template']['href']\n new_st_url = @server_templates[old_st_url]['new_st_url']\n \n mci = choose_mci(new_st_url)\n @api.account_id = @options[:src]\n\n subnets = choose_subnets(cloud)\n @api.account_id = @options[:src]\n\n security_groups = choose_security_groups(cloud)\n @api.account_id = @options[:src]\n\n inputs_hash = format_inputs(@api.resource(server['next_instance']['href']).show.inputs)\n\n # Create server\n params = {}\n params[:server] = {}\n params[:server][:name] = name\n params[:server][:deployment_href] = @new_deployment\n params[:server][:instance] = {}\n params[:server][:instance][:cloud_href] = cloud\n params[:server][:instance][:server_template_href] = new_st_url\n params[:server][:instance][:ssh_key_href] = ssh_key if ssh_key\n params[:server][:instance][:instance_type_href] = instance_type\n params[:server][:instance][:multi_cloud_image_href] = mci\n params[:server][:instance][:subnet_hrefs] = subnets if subnets\n params[:server][:instance][:security_group_hrefs] = security_groups\n params[:server][:instance][:inputs] = inputs_hash\n @api.account_id = @options[:dst]\n @api.servers.create(params)\n end\nend", "def create_instance(credentials, image_id, opts)\n new_vapp = nil\n vapp_opts = {} #assemble options to pass to Fog::Terremark::Real.instantiate_vapp_template\n terremark_hwp = hardware_profiles(credentials, {:name => 'default'}).first #sanity check values against default\n name = opts[:name]\n if not name\n name = \"inst#{Time.now.to_i}\"\n end\n if name.length > USER_NAME_MAX\n raise \"Parameter name must be #{USER_NAME_MAX} characters or less\"\n end\n unless ( (terremark_hwp.include?(:cpu, opts[:hwp_cpu].to_i)) &&\n (terremark_hwp.include?(:memory, opts[:hwp_memory].to_i)) ) then\n raise Deltacloud::Exceptions::ValidationFailure.new(\n StandardError.new(\"Error with cpu and/or memory values. you said cpu->#{opts[:hwp_cpu]} and mem->#{opts[:hwp_memory]}\")\n )\n end\n vapp_opts['cpus'] = opts[:hwp_cpu]\n vapp_opts['memory'] = opts[:hwp_memory]\n safely do\n terremark_client = new_client(credentials)\n#######\n#FIXME# what happens if there is an issue getting the new vapp id? (eg even though created succesfully)\n#######\n vapp_id = terremark_client.instantiate_vapp_template(name, image_id, vapp_opts).body['href'].split('/').last\n new_vapp = terremark_client.get_vapp(vapp_id)\n return convert_instance(new_vapp, terremark_client, credentials.user) #return an Instance object\n end\n end", "def reboot_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No instance IDs provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"RebootInstances\", :params => params)\n end", "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end", "def restart!\n IbmCloudRest.post \"#{@uri}/_restart\"\n end", "def create_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_create_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def reboot_instances(list)\n link = generate_request(\"RebootInstances\", hash_params('InstanceId', list.to_a))\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def create_instances(count)\n fail DTK::Error::Usage, \"Attribute 'admin_state' cannot be set to powered_off if node not created\" if admin_state_powered_off?\n aws_api_operation(:create).create_instances(count)\n end", "def Recreate(params, trace = [\"Recreate method called:#{__LINE__}\"])\n params.to_sym!\n LOG \"Recreating VM#{params[:vm]}\", 'Recreate'\n\n trace << \"Getting VM:#{__LINE__}\"\n vm = onblock(:vm, params[:vm])\n vm.info!\n trace << \"Checking access rights:#{__LINE__}\"\n onblock(:u, -1, @client) do | u |\n u.info!\n if u.id != vm.uid && !u.groups.include?(0) then\n raise StandardError.new(\"Not enough access to perform Recreate\")\n end\n end\n trace << \"Getting VM host:#{__LINE__}\"\n host, _ = vm.host\n trace << \"Recovering VM:#{__LINE__}\"\n vm.recover(4)\n\n if params[:passwd] then\n trace << \"Changing VM password#{__LINE__}\"\n vm.passwd params[:passwd]\n end\n\n if params[:deploy] then\n trace << \"Waiting for state PENDING to deploy VM:#{__LINE__}\"\n vm.wait_state(\"PENDING\", 120)\n trace << \"Deploying VM:#{__LINE__}\"\n vm.deploy(host.to_i)\n end\n\n return true, host.to_i\n rescue => e\n LOG_ERROR \"Error ocurred while Reinstall: #{e.message}\"\n raise e\n end", "def make_fake_instances\n return unless Fog.mock?\n\n asg_instances = []\n all_instances = []\n min_size.times do |n|\n instance_id = Fog::AWS::Mock.instance_id\n asg_instances << {\n 'AvailabilityZone' => availability_zones,\n 'HealthStatus' => 'Good',\n 'InstanceId' => instance_id,\n 'LifecycleState' => 'Pending',\n 'LaunchConfigurationName' => launch_configuration.aws_identifier\n }\n\n all_instances << {\n 'amiLaunchIndex' => n,\n 'architecture' => 'i386',\n 'blockDeviceMapping' => [],\n 'clientToken' => 'FAKE_CLIENT_TOKEN',\n 'dnsName' => 'not-a-real-hostname',\n 'ebsOptimized' => false,\n 'hypervisor' => 'xen',\n 'imageId' => launch_configuration.ami,\n 'instanceId' => instance_id,\n 'instanceState' => { 'code' => 0, 'name' => 'not pending?' },\n 'instanceType' => launch_configuration.instance_type,\n 'kernelId' => launch_configuration.kernel_id || Fog::AWS::Mock.kernel_id,\n 'keyName' => launch_configuration.key_name,\n 'launchTime' => Time.now,\n 'monitoring' => { 'state' => false },\n 'placement' => { 'availabilityZone' => availability_zones,\n 'groupName' => self.aws_identifier,\n 'tenancy' => 'default' },\n 'privateDnsName' => nil,\n 'productCodes' => [],\n 'reason' => nil,\n 'rootDeviceType' => 'instance-store',\n 'virtualizationType' => 'paravirtual',\n 'groupIds' => [],\n 'groupSet' => launch_configuration.security_groups,\n 'iamInstanceProfile' => launch_configuration.iam_role,\n 'networkInterfaces' => [],\n 'ownerId' => nil,\n 'privateIpAddress' => nil,\n 'reservationId' => Fog::AWS::Mock.reservation_id,\n 'stateReason' => {},\n 'ipAddress' => Fog::AWS::Mock.ip_address,\n 'privateIpAddress' => Fog::AWS::Mock.private_ip_address\n }\n end\n Aerosol::AWS.auto_scaling.data[:auto_scaling_groups][aws_identifier]\n .merge!('Instances' => asg_instances)\n all_instances.each do |instance|\n Aerosol::AWS.compute.data[:instances][instance['instanceId']] = instance\n end\n end", "def restart(async: true)\n requires :identity\n\n data = service.restart_instance(identity)\n operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)\n operation.tap { |o| o.wait_for { ready? } unless async }\n end", "def recreate\n self.class.create(queue, payload_class, *args)\n end", "def safe_create_instances!(nodes)\n nodes = nodes.select { |k, v| k if v[:fqdn].empty? }\n begin\n case @provider\n when 'aws'\n nodes = create_aws_instances(nodes, @credentials, @thread_pool_size)\n when 'rackspace'\n nodes = create_rackspace_instances(nodes, @credentials, @thread_pool_size)\n when 'openstack'\n nodes = create_openstack_instances(nodes, @credentials, @thread_pool_size)\n else\n # Not yet implemented\n end\n rescue RuntimeError => ex\n @log.error \"Something went wrong provisioning vms on cloud, reason: #{ex}\"\n @log.error 'Rolling back instance(s)'\n delete_instances(nodes, true)\n exit 1\n end\n nodes\n end", "def run\n super\n\n # Get the AWS Credentials\n aws_keys = get_aws_keys_from_entity_type(_get_entity_type_string)\n return unless aws_keys.access_key && aws_keys.secret_key\n\n return unless aws_keys_valid?(aws_keys.access_key, aws_keys.secret_key, aws_keys.session_token)\n\n regions = retrieve_region_list\n instance_collection = regions.map do |r|\n retrieve_instances(r, aws_keys.access_key, aws_keys.secret_key, aws_keys.session_token)\n end\n\n instance_collection.compact!\n return if instance_collection.size.zero?\n\n create_ec2_instances(instance_collection)\n end", "def create_instances\n min_count = max_count = @bs.number_of_nodes\n puts \"\\nCreating #{max_count} on-demand instance(s)\"\n options = {\n 'ClientToken' => generate_token,\n 'KeyName' => Chef::Config[:knife][:aws_ssh_key_id],\n 'InstanceType' => @bs.flavor,\n 'SubnetId' => @bs[:novpc] ? nil : @bs.subnet_id,\n 'Placement.AvailabilityZone' => @bs.mixins.az.data,\n 'SecurityGroupId' => @bs.mixins.sg.data\n }\n options['EbsOptimized'] = !! @bs[:ebs_optimized]\n\n ## REVIEW\n if ami.root_device_type == \"ebs\"\n ami_map = ami.block_device_mapping.first\n block_device_mapping = {\n 'DeviceName' => ami_map['deviceName'],\n 'Ebs.VolumeSize' => ami_map['volumeSize'].to_s,\n 'Ebs.DeleteOnTermination' => ami_map['deleteOnTermination']\n }\n options['BlockDeviceMapping'] = [block_device_mapping]\n end\n\n ## Optionally only include mapped devices\n ## This way we get all of the ephemeral drives, some unmapped however\n if @bs.mixins.volume.data[:ephemeral_available]\n ephmap = @bs.mixins.volume.data.ephemeral_available.each_with_index.map do |d,i|\n {\n 'VirtualName' => \"ephemeral#{i}\",\n 'DeviceName' => d\n }\n end\n options['BlockDeviceMapping'].concat( ephmap )\n end\n\n if (max_count == 1) and @bs[:private_ip_address]\n options['PrivateIpAddress'] = @bs.private_ip_address\n puts \"Assigning IP ADDRESS : #{options['PrivateIpAddress']}\"\n end\n\n if Chef::Config[:knife][:aws_user_data]\n begin\n options['UserData']= File.read(Chef::Config[:knife][:aws_user_data])\n rescue\n ui.warn(\"Cannot read #{Chef::Config[:knife][:aws_user_data]}:\"\\\n \" #{$!.inspect}. Ignoring option.\")\n end\n end\n\n # -----------------------------------------------------------------\n tries = 5\n print_table(options, 'Launch Config')\n begin\n puts \"\\nSending request...\"\n response = connection.run_instances(@bs.image, min_count,\n max_count, options)\n ui.msg(response.inspect)\n rescue Exception => e\n ui.warn(\"#{e.message}\\nException creating instances\")\n if (tries -= 1) <= 0\n ui.warn(\"\\n\\nMax tries reached. Exiting.\\n\\n\")\n exit 1\n else\n ui.msg(\"Trying again.\\n\")\n retry\n end\n end\n # now we have our servers\n instances = response.body['instancesSet']\n # select only instances that have instanceId key and collect those ids\n # into an array\n @bs[:instance_ids] =\n instances.select {|i| i.has_key?('instanceId')}.collect do |i|\n i['instanceId']\n end\n\n puts \"\\nNumber of instances started: #{@bs.instance_ids.size}\\n\"\n sleep 10\n puts \"Getting servers..\"\n # collect an array of servers retrieved based on the instance ids we\n # obtained above\n @bs[:servers] = @bs.instance_ids.collect do |id|\n begin\n server = connection.servers.get(id)\n rescue Exception => e\n sleep 7\n retry\n end\n raise Ec2Error.new(\"server #{id} was nil\") if server.nil?\n server\n end\n end", "def replace_instances\n log_options\n\n unless stack_exists?(name)\n raise StackDoesNotExistError, \"Stack #{name} does not exist.\"\n end\n\n stack = cfn.stacks[name]\n unless stack_was_just_updated?(stack)\n logger.info \"stack was not updated recently, not replacing instances.\"\n return\n end\n\n ex = WaitTimedOutError.new \"Timed out waiting to replace instances.\"\n wait_until(ex) do\n ok_to_replace_instances?(stack.status, stack.last_updated_time)\n end\n\n logger.info \"replacing all auto-scaling instances in #{name}\"\n\n if stack_asg.nil?\n raise MissingAutoScalingGroupError, \"No ASG found for stack #{name}\"\n end\n\n stack_asg.ec2_instances.each do |i|\n if i.status == :running\n logger.info \"terminating instance #{i.id}\"\n i.terminate\n else\n logger.info \"Not terminating #{i.id} due to status: #{i.status}\"\n end\n end\n end", "def recreateVM(vm)\n # Call the service controller to delete the VM and update the master\n paramfile = $WORKDIR + \"/envconfig.\" + @name\n execString = $SVCBIN + \" -c \" + paramfile + \" -v \" + vm.vmid + \" -x \" + @envid \n childpid=Kernel.fork\n if childpid == nil\n $stdout.reopen($ENVLOGFILE + \".#{@envid}\" ,'a+')\n $stderr.reopen($ENVLOGFILE + \".#{@envid}\",'a+')\n exec(execString)\n end\n jid = $jobManager.register(childpid, @envid, \"RECREATE\", @name, \"RUNNING\", 0)\n return jid \n end", "def post_compute(request)\n # --- Create the new Instance ---\n vm = VirtualMachineOCCI.new(\n VirtualMachine.build_xml,\n @client,\n request.body.read,\n @config[:instance_types],\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = vm.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = vm.allocate(template)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n vm.info\n return to_occi_xml(vm, :code=>201)\n end", "def delete_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_delete_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def reconcile\n \n #First sync instances \n Instance.sync_with_ec2\n \n #then make sure this farm is operating withing limits... start and stop based on limits\n #now lets go through our configs and sync what is running with what is configured to run\n\n num_stop = 0\n num_start = 0\n\n logger.info \"Reconciling farm #{ami_id}...\"\n EventLog.info \"Reconciling farm #{ami_id}...\"\n \n ia = instances.select{ |i| i.running?} \n if ia.size < min\n num_start = min.to_i - ia.size\n # need to start some of them\n logger.info \"Attempting to start #{num_start} #{ami_id} instances... may take a few moments.\"\n EventLog.info \"Attempting to start #{num_start} #{ami_id} instances... may take a few moments.\"\n start_and_create_instances(num_start)\n\n elsif ia.size > max\n # need to stop some of the instances, if they are either 'IDLE' or 'LAUNCHED' state or \"ERROR\"\n num_stop = ia.size - max.to_i\n count = 0\n ia.each do |ri|\n break if count >= num_stop\n if ri.available? || ri.error?\n #shut it down!\n logger.info \"Shutting down instance #{ami_id} -- #{ri.instance_id}...\"\n EventLog.info \"Shutting down instance #{ami_id} -- #{ri.instance_id}...\"\n ri.terminate\n count += 1\n end \n end\n end\n \n # shutdown what we can from idle\n \n num_stop += scale_down\n \n #########################\n #\n # now that we scaled down, lets recycle those compute nodes that have not checked in for a while (15 mins)\n # we're looking for those that are available or busy and are compute nodes\n #\n \n ia = instances.select{ |i| i.running?} \n \n ia.each do |ri|\n if (ri.available? || ri.state.eql?('busy')) && ri.farm.farm_type.eql?('compute') && ri.silent_since?(NODE_TIMEOUT)\n #shut down silent nodes\n logger.info \"Shutting down instance #{ri.farm.ami_id} -- #{ri.instance_id} because it was unresponsive.\"\n EventLog.info \"Shutting down instance #{ri.farm.ami_id} -- #{ri.instance_id} because it was unresponsive.\"\n ri.terminate\n \n #recycle if not heard from in a while\n # if ri.cycle_count < NODE_CYCLE_MAX\n # logger.info \"Recycling instance #{ri.farm.ami_id} -- #{ri.instance_id}...\"\n # EventLog.info \"Recycling instance #{ri.farm.ami_id} -- #{ri.instance_id}...\"\n # ri.recycle\n # else\n # logger.info \"Shutting down instance #{ri.farm.ami_id} -- #{ri.instance_id} because it was unresponsive and exceeded max recycle tries.\"\n # EventLog.info \"Shutting down instance #{ri.farm.ami_id} -- #{ri.instance_id} because it was unresponsive and exceeded max recycle tries.\"\n # ri.terminate \n # end\n end \n end\n \n \n return {:farm_name => name, :message => 'Finished reconciling', :num_shutdown => num_stop, :num_started => num_start}\n \n end", "def recreate\n drop if exists?\n create\n end", "def abandon_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_abandon_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def recreate()\n merge(recreate: 'true')\n end", "def redeploy(opts)\n client = opts.k8s.to_api\n patch = {\n spec: {\n template: {\n metadata: {\n annotations: {\n \"kubectl.kubernetes.io/restartedAt\" => Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z')\n }\n }\n }\n }\n }\n\n client\n .api('apps/v1')\n .resource('deployments', namespace: opts[:k8s][:k8s_namespace])\n .merge_patch(opts[:k8s][:k8s_deployment], patch)\nend", "def launch_nat_instances(client,\n pub_net1_id,\n pub_net2_id,\n sg_in_tcp_22_pub,\n sg_in_tcp_80_nat,\n priv_route_table_id,\n instance_type,\n ami)\n # launching public subnet nat instances #1 and #2 in 10.0.100.0/24 and 10.0.200.0/24, respectively.\n puts 'Launching public subnet nat instances #1 and #2 in 10.0.100.0/24 and 10.0.200.0/24, respectively...'\n [1, 2].each do |subnet_num|\n pub_subnet_id = case subnet_num\n when 1 then pub_net1_id\n when 2 then pub_net2_id\n else puts 'debug: should not get here'\n end\n response = client.run_instances(image_id: ami,\n # key_name: 'UbuntuKeyPair',\n min_count: 1,\n max_count: 1,\n security_group_ids: [sg_in_tcp_80_nat], # sg_in_tcp_22_pub\n instance_type: instance_type,\n placement: {},\n # block_device_mappings: [{ebs: {delete_on_termination: true, volume_type: 'gp2'}}],\n monitoring: { enabled: false },\n subnet_id: pub_subnet_id,\n disable_api_termination: false,\n instance_initiated_shutdown_behavior: 'terminate',\n ebs_optimized: false,\n tag_specifications: [resource_type: 'instance',\n tags: [key: 'Name', value: 'nat instance']],\n user_data: Base64.encode64(\"#!/bin/bash -ex\\n\"\\\n \"export DEBIAN_FRONTEND=noninteractive\\n\"\\\n \"apt-get -q=2 update && apt-get -q=2 upgrade\\n\"\\\n \"sysctl -w net.ipv4.ip_forward=1\\n\"\\\n \"sysctl -w net.ipv4.conf.eth0.send_redirects=0\\n\"\\\n 'iptables -t nat -A POSTROUTING -s 10.0.0.0/16 -o eth0 -j MASQUERADE'))\n nat_instance_id = response.instances[0].instance_id\n puts \"nat_instance_id ##{subnet_num} = [#{nat_instance_id}];\"\n\n before_wait = Time.now\n term_error = 0\n begin\n puts \"Waiting for nat instance ##{subnet_num} [#{nat_instance_id}] to enter running state.\"\n client.wait_until(:instance_running,instance_ids: [nat_instance_id]) do |wait|\n wait.interval = 5 # Seconds between polling attempts. Same as wait.delay\n wait.max_attempts = 15 # Polling attempts before giving up. Wait time is 15*5=75 seconds.\n end\n rescue Aws::Waiters::Errors::WaiterFailed => error\n term_error = 1 # TODO: Do something more reliable if this ever occurs.\n puts \"Exception: failed waiting for instance running: #{error.message}\"\n end\n puts \"#{Time.now - before_wait.to_time} seconds elapsed while waiting.\" if term_error.zero?\n\n # Create route for 0.0.0.0/0 -> nat instance (for private instances to bootstrap/update)\n if subnet_num == 1 # Only insert this route one time. Will receive 'RouteAlreadyExists' otherwise.\"\n puts 'Creating route for 0.0.0.0/0 -> nat instances in private route table...'\n response = client.create_route(destination_cidr_block: '0.0.0.0/0',\n route_table_id: priv_route_table_id,\n instance_id: nat_instance_id)\n puts 'Route for 0.0.0.0/0 -> nat instances in private route table added.'\n end\n # Disable source/destination checking for network address translation to work.\n # The API doesn't allow setting this during the run_instances call... but does right afterward.\n printf \"Disabling source/destination checking on nat instance ##{subnet_num}... \"\n client.modify_instance_attribute(instance_id: nat_instance_id, source_dest_check: {value: false})\n puts 'done.'\n end\n puts 'public 10.0.100.0/24 and 10.0.200.0/24 nat instance #1 and #2 launch complete.'\nend", "def restart!\n CouchRest.post \"#{@uri}/_restart\"\n end", "def scale(force_instances=nil)\n if self.cluster.nil?\n Onering::Logger.error(\"Task #{self.id} is missing the cluster attribute\")\n return false\n end\n\n self.instances = self.instance_count(force_instances)\n\n\n # persist the target instances count\n # --------------------------------------------------------------------------\n if self.save()\n Onering::Logger.debug(\"Task #{self.id} target instances set to #{self.instances}\")\n\n marathon_node = nil\n cluster_node_apps = nil\n\n # verify connectivity to the compute cluster\n # ------------------------------------------------------------------------\n Asset.urlquery(\"mesos.masters.options.cluster/#{self.cluster}\").each do |node|\n url = \"http://#{node.get(:fqdn)}:8080/v1/apps\"\n response = HTTParty.get(url)\n\n if response.code == 200\n cluster_node_apps = MultiJson.load(response.body)\n marathon_node = node\n break\n else\n Onering::Logger.warn(\"Unable to communicate with Marathon on node #{node.id} via #{url}\")\n next\n end\n end\n\n if marathon_node.nil?\n Onering::Logger.error(\"Cannot contact any Marathon nodes\")\n return false\n end\n\n # build the request\n # ------------------------------------------------------------------------\n marathon_task_name = \"harbormaster-#{self.id}\"\n cluster_app = cluster_node_apps.select{|i| i.get(:id) == marathon_task_name }.first\n\n body = {\n :id => marathon_task_name,\n :instances => self.instances,\n :mem => self.resources.get(:memory),\n :cpus => self.resources.get(:cpu),\n :cmd => self.task.get(:name),\n :env => self.resources.get(:environment,{})\n }\n\n # send request (with retries!)\n # ------------------------------------------------------------------------\n scale_success = false\n\n 3.times.each do\n break if scale_success === true\n\n catch(:retry) do\n response = nil\n url = nil\n\n # task not found in cluster, start it\n if cluster_app.nil?\n if self.enabled === true\n url = \"http://#{marathon_node.get(:fqdn)}:8080/v1/apps/start\"\n response = HTTParty.post(url, {\n :headers => {\n 'Content-type' => 'application/json'\n },\n :body => MultiJson.dump(body)\n })\n else\n Onering::Logger.debug(\"Task #{self.id} is disabled and absent from Marathon, skipping...\")\n return true\n end\n\n # task IS found in cluster\n else\n payload = MultiJson.dump(Hash[body.select{|k,v|\n [:id, :instances].include?(k.to_sym)\n }])\n\n # if these properties are changing, stop the existing service first\n if cluster_app['cmd'] != body[:cmd] or\n cluster_app['mem'].to_f != body[:mem].to_f or\n cluster_app['cpus'].to_f != body[:cpus].to_f\n then\n Onering::Logger.info(\"Launch parameters have changed for task #{self.id} (Marathon task #{marathon_task_name}), relaunching...\")\n\n response = HTTParty.post(\"http://#{marathon_node.get(:fqdn)}:8080/v1/apps/stop\", {\n :headers => {\n 'Content-type' => 'application/json'\n },\n :body => payload\n })\n\n if response.code >= 300\n Onering::Logger.warn(\"Received HTTP #{response.code} while stopping task #{self.id} (Marathon task #{marathon_task_name})\")\n end\n\n cluster_app = nil\n throw :retry\n end\n\n # stop it if we're not enabled\n if self.enabled == false\n Onering::Logger.debug(\"Sending stop command to #{marathon_node.get(:fqdn)} for task #{marathon_task_name}\")\n\n url = \"http://#{marathon_node.get(:fqdn)}:8080/v1/apps/stop\"\n response = HTTParty.post(url, {\n :headers => {\n 'Content-type' => 'application/json'\n },\n :body => payload\n })\n\n # scale it to n instances otherwise\n else\n Onering::Logger.debug(\"Sending scale command to #{marathon_node.get(:fqdn)} for task #{marathon_task_name}\")\n\n url = \"http://#{marathon_node.get(:fqdn)}:8080/v1/apps/scale\"\n response = HTTParty.post(url, {\n :headers => {\n 'Content-type' => 'application/json'\n },\n :body => payload\n })\n end\n end\n\n if response.code < 300\n scale_success = true\n next\n end\n\n Onering::Logger.warn(\"Received response HTTP #{response.code} from #{url}\")\n end\n end\n\n if scale_success === true\n # save the last scaled time\n # ----------------------------------------------------------------------\n self.last_scaled_at = Time.now\n self.save()\n\n return self\n else\n Onering::Logger.error(\"Attempt to scale task #{self.id} (Marathon task #{marathon_task_name}) failed\")\n return false\n end\n\n else\n return false\n end\n end", "def recreate_template\n Chef::Log.info \"Monitor recreation for #{new_resource} will fail if monitor is currently associated\"\n delete_template\n create_template\n end", "def retire\n\n end", "def request_launch_new_instances(num=1)\n out = []\n num.times {out << launch_new_instance!}\n out\n end", "def restore\n p \"Doing a restore ...\"\n params = {:instance_href => \"/api/clouds/907/instances/#{@instance2_id}\"}\n id = @test_client.backups.index(:lineage => \"ns_backup_test_lineage\").first.show.href.split(\"/\")[-1] # => to get the id\n task = @test_client.backups(:id => id).show.restore(params)\n return task\nend", "def rocket_job_restart_new_instance\n return if expired?\n attrs = attributes.dup\n rocket_job_restart_excludes.each { |attr| attrs.delete(attr) }\n\n # Copy across run_at for future dated jobs\n attrs['run_at'] = run_at if run_at && (run_at > Time.now)\n\n rocket_job_restart_create(attrs)\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Fetch the current status of the portgroup\n cmd = <<-EOF\n $portgroup_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n # We silently continue on errors otherwise PowerCLI creates an error if the\n # portgroup does not exist on the host which pollutes our $portgroup_hash return object\n $pg = Get-VirtualSwitch -Host $h -Standard -Name #{resource[:vswitch_name]} | Get-VirtualPortGroup -Name #{resource[:portgroup]} -ErrorAction SilentlyContinue\n if ($pg) {\n $obj_hash = @{}\n $obj_hash.Add('portgroup', $pg.Name)\n $obj_hash.Add('vlan', $pg.VLanId)\n $obj_hash.Add('vswitch_name', $pg.VirtualSwitchName)\n $portgroup_hash[$h.Name] = @($obj_hash)\n } else {\n # create empty hashtable\n $obj_hash = @{}\n $portgroup_hash[$h.Name] = @($obj_hash)\n }\n }\n $portgroup_hash | ConvertTo-Json\n EOF\n\n portgroups_stdout = powercli_connect_exec(cmd)[:stdout]\n\n unless portgroups_stdout.empty?\n portgroups_hash = JSON.parse(portgroups_stdout)\n cached_instances_set({})\n portgroups_hash.each do |esx_host, pg_array|\n # Extracting hash from array object\n pg_hash = pg_array[0]\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n vswitch_name: pg_hash['vswitch_name'],\n vlan: pg_hash['vlan'],\n portgroup: pg_hash['portgroup'],\n }\n end\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def create_snapshot(rds_resource, db_instance_name)\n id = \"snapshot-#{rand(10**6)}\"\n db_instance = rds_resource.db_instance(db_instance_name)\n db_instance.create_snapshot({\n db_snapshot_identifier: id\n })\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't create DB instance snapshot #{id}:\\n #{e.message}\"\nend", "def create_resource\n # response = ec2.run_instances(\n # node_config(max_count: 1, self.to_h)\n # ).instances.first\n\n instance_attr_accessor response\n # id = @response[:instance_id]\n begin\n ec2.wait_until(:instance_running, instance_ids: [id]) do\n logger.info \"waiting for #{ids.count} Neurons to start...\"\n end\n rescue Aws::Waiters::Errors::WaiterFailed => e\n # TODO: retry stuff\n # redo unless (count += 1 <=3 )\n end\n\n yield self if block_given?\n self\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def put_instance(opts)\n opts = check_params(opts,[:instances])\n super(opts)\n end", "def relaunch!\n requires :id\n body = [ \"FORCE\", {}]\n body[1][:sshKeyIds] = key_pairs.map {|kp| kp.id} unless key_pairs.empty?\n type = bare_metal? ? :hardware_server : :virtual_guest\n status = service.request(type, \"#{id}/reloadOperatingSystem\", :body => body, :http_method => :post).status\n wait_for { not ready? } # block until the relaunch has begun\n [200, 201].include?(status)\n end", "def kill_and_recreate\n Souffle::Log.info \"#{@node.log_prefix} Recreating node...\"\n provider.kill_and_recreate([@node])\n end", "def create_images(isCopy)\n ec2 = AWS::EC2.new.client\n instances = ec2.describe_instances(:filters => [:name => 'tag-key', :values => ['backup']])\n images = []\n if instances\n if instances.data[:reservation_set].count > 0\n instances.data[:reservation_set].each do |rs|\n rs[:instances_set].each do |i|\n #get name of instance\n name = get_tagvalue(i, \"Name\") + \" backup at \" + Time.now.to_s.gsub(\":\", \"-\")\n image = ec2.create_image(:instance_id => i[:instance_id], \n :name => name,\n :description => \"Created - \" + Time.now.to_s + \" - created by SDK\", :no_reboot => true)\n images << image if image\n if (isCopy)\n copy_image(i[:image_id], AWSCONFIG[:default_region], AWSCONFIG[:backup_region], \n name, \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n end\n end\n end\n end\n end\n\n return images\n end", "def retract(*instances)\n Array(instances).each do |i|\n i.retract\n end\n self\n end", "def set_instance_template request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_set_instance_template_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def destroy_instances_if_ami_changed\n self.instances.each { |i| i.destroy } if self.ami_id_changed?\n end", "def recreate!\n client = EsClient.new(@url, @index_name)\n client.create_index(@index)\n client.bulk_index(@data)\n end", "def create\n @instance = @provider.instances.new(params[:instance])\n @instance.state = \"Building\"\n respond_to do |format|\n if @instance.save\n @instance.create_instance(@provider.connect!)\n format.html { redirect_to cloud_provider_instance_path(@provider,@instance), notice: 'Instance was successfully created.' }\n format.json { render json: @instance, status: :created, location: @instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n\n credentials = Aws::Credentials.new('AKIAJ2JD2EKKFVDSR37A', 'cnZUnzuyYPqUevEPb045VJUnW55VR+rUCQrplzd/')\n ec2 = Aws::EC2::Client.new(\n region: \"us-east-1\",\n credentials: credentials\n )\n #i = ec2.instances.create(:image_id => \"ami-e3106686\")\n resp = ec2.run_instances({\n dry_run: true,\n image_id: \"ami-e3106686\", # required\n min_count: 1, # required\n max_count: 1, # required\n instance_type: \"t1.micro\", # accepts t1.micro, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, t2.micro, t2.small, t2.medium, t2.large, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, cg1.4xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge\n placement: {\n tenancy: \"default\", # accepts default, dedicated\n },\n\n block_device_mappings: [\n {\n virtual_name: \"String\",\n device_name: \"String\",\n ebs: {\n snapshot_id: \"String\",\n volume_size: 1,\n delete_on_termination: true,\n volume_type: \"standard\", # accepts standard, io1, gp2\n iops: 1,\n encrypted: true,\n },\n\n },\n ],\n monitoring: {\n enabled: true, # required\n },\n disable_api_termination: true,\n instance_initiated_shutdown_behavior: \"stop\", # accepts stop, terminate\n network_interfaces: [\n {\n delete_on_termination: true,\n private_ip_addresses: [\n {\n private_ip_address: \"172.31.2.177\", # required\n primary: true,\n },\n ],\n secondary_private_ip_address_count: 1,\n associate_public_ip_address: true,\n },\n ],\n ebs_optimized: true,\n })\n @ec2_instances = Ec2Instance.all\n end", "def reboot\n # There is no trackable status change for the instance being\n # rebooted, so it's up to CPI client to keep track of agent\n # being ready after reboot.\n # Due to this, we can't deregister the instance from any load\n # balancers it might be attached to, and reattach once the\n # reboot is complete, so we just have to let the load balancers\n # take the instance out of rotation, and put it back in once it\n # is back up again.\n @aws_instance.reboot\n end", "def reset_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_reset_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def reset_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_reset_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def save(*args, &block)\n super\n # begin\n # require 'restclient'\n # server[\"/instances/#{instance_id}\"].put(to_json)\n # rescue Exception => e\n # Metavirt::Log.error \"cloudkit fail:\\n\\t#{e.inspect}\"\n # end\n self\n end", "def reset_remoter_base!\n @describe_instances = nil\n end", "def createEc2Instance\n\t\t name = @server[\"name\"]\n\t\t node = @server['mu_name']\n\t\t\tbegin\n\t\t\t\t@server['iam_role'] = MU::Server.createIAMProfile(\"Server-\"+name, base_profile: @server['iam_role'], extra_policies: @server['iam_policies'])\n\t\t\trescue Aws::EC2::Errors::RequestLimitExceeded => e\n\t\t\t\tsleep 10\n\t\t\t\tretry\n\t\t\tend\n\t\t\t@server['iam_role'] = @server['iam_role']\n\n\t\t\tbegin\n\t\t\t\t@deploy.createEc2SSHKey\n\t\t\trescue Aws::EC2::Errors::RequestLimitExceeded => e\n\t\t\t\tsleep 10\n\t\t\t\tretry\n\t\t\tend\n\n\t\t instance_descriptor = {\n\t\t :image_id => @server[\"ami_id\"],\n\t\t :key_name => @deploy.keypairname,\n\t\t :instance_type => @server[\"size\"],\n\t\t :disable_api_termination => true,\n\t\t :min_count => 1,\n\t\t :max_count => 1,\n\t\t\t\t:network_interfaces => [\n\t\t\t\t\t{\n\t\t\t\t\t\t:associate_public_ip_address => name[\"associate_public_ip\"]\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t }\n\t\t\t\n\t\t\tif !@server['private_ip'].nil?\n\t\t\t\tinstance_descriptor[:private_ip_address] = @server['private_ip']\n\t\t\tend\n\n\t\t\tvpc_id=subnet_id=nat_host_name=nat_ssh_user = nil\n\t\t\tsubnet_retries = 0\n\t\t\tif !@server[\"vpc\"].nil?\n\t\t\t\tbegin\n\t\t\t\t\tvpc_id, subnet_ids, nat_host_name, nat_ssh_user = MU::VPC.parseVPC(@server['vpc'])\n\t\t\t\trescue Aws::EC2::Errors::ServiceError => e\n\t\t\t\t\tMU.log e.message, MU::ERR, details: @server\n\t\t\t\t\tif subnet_retries < 5\n\t\t\t\t\t subnet_retries = subnet_retries + 1\n\t\t\t\t\t sleep 15\n\t\t\t\t\t retry\n\t\t\t\t\tend\n\t\t\t\t\traise e\n\t\t\t\tend\n\t\t\t\tsubnet_id = subnet_ids.first\n\t\t\t\tif subnet_id.nil? or subnet_id.empty?\n\t\t\t\t\tMU.log \"Got null Subnet id out of #{@server['vpc']}\", MU::ERR\n\t\t\t\t\traise \"deploy failure\"\n\t\t\t\tend\n\n\t\t\t\tMU.log \"Deploying #{node} into VPC #{vpc_id} Subnet #{subnet_id}\"\n\n\t\t\t\tif !@server[\"vpc\"][\"nat_host_name\"].nil? or !@server[\"vpc\"][\"nat_host_id\"].nil?\n\t\t\t\t\tadmin_sg = MU::Server.punchAdminNAT(@server, node)\n\t\t\t\telse\n\t\t\t\t\tadmin_sg = MU::FirewallRule.setAdminSG(vpc_id: vpc_id, region: @server['region'])\n\t\t\t\tend\n\n\t\t\t\tinstance_descriptor[:subnet_id] = subnet_id\n\t\t\t\tnode_sg = MU::FirewallRule.createEc2SG(\n\t\t\t\t\t\t@server[\"name\"].upcase,\n\t\t\t\t\t\t@server[\"ingress_rules\"],\n\t\t\t\t\t\tdescription: \"SG holes for #{node}\",\n\t\t\t\t\t\tvpc_id: vpc_id,\n\t\t\t\t\t\tregion: @server['region']\n\t\t\t\t)\n\t\t\telse\n\t\t\t\tadmin_sg = MU::FirewallRule.setAdminSG(region: @server['region'])\n\t\t\t\tnode_sg = MU::FirewallRule.createEc2SG(\n\t\t\t\t\t\t@server[\"name\"].upcase,\n\t\t\t\t\t\t@server[\"ingress_rules\"],\n\t\t\t\t\t\tdescription: \"SG holes for #{node}\",\n\t\t\t\t\t\tregion: @server['region']\n\t\t\t\t)\n\t\t\tend\n\t\t\tsecurity_groups = Array.new\n\t\t\tsecurity_groups << admin_sg\n\t\t\tsecurity_groups << node_sg\n\t\t\tif !@server[\"add_firewall_rules\"].nil?\n\t\t\t\t@server[\"add_firewall_rules\"].each { |acl|\n\t\t\t\t\tsg = MU::FirewallRule.find(sg_id: acl[\"rule_id\"], name: acl[\"rule_name\"], region: @server['region'])\n\t\t\t\t\tif sg.nil?\n\t\t\t\t\t\tMU.log \"Couldn't find dependent security group #{acl} for server #{node}\", MU::ERR\n\t\t\t\t\t\traise \"deploy failure\"\n\t\t\t\t\tend\n\t\t\t\t\tsecurity_groups << sg.group_id\n\t\t\t\t}\n\t\t\tend\n\n\t\t\tinstance_descriptor[:security_group_ids] = security_groups\n\n\t\t if !@userdata.nil? and !@userdata.empty?\n\t\t instance_descriptor[:user_data] = Base64.encode64(@userdata)\n\t\t end\n\n\t\t if !@server[\"iam_role\"].nil?\n\t\t instance_descriptor[:iam_instance_profile] = { name: @server[\"iam_role\"]}\n\t\t end\n\n\t\t\tconfigured_storage = Array.new\n\t\t\tif @server[\"storage\"]\n\t\t\t\t@server[\"storage\"].each { |vol|\n\t\t\t\t\tconfigured_storage << MU::Server.convertBlockDeviceMapping(vol)\n\t\t\t\t}\n\t\t\tend\n\t\t\n\t\t\tMU::Server.waitForAMI(@server[\"ami_id\"], region: @server['region'])\n\n\t\t\tinstance_descriptor[:block_device_mappings] = configured_storage\n\t\t\tinstance_descriptor[:block_device_mappings].concat(@ephemeral_mappings)\n\n\t\t\tinstance_descriptor[:monitoring] = { enabled: @server['monitoring'] }\n\n\t\t\tMU.log \"Creating EC2 instance #{node}\"\n\t\t\tMU.log \"Instance details for #{node}: #{instance_descriptor}\", MU::DEBUG\n#\t\t\t\tif instance_descriptor[:block_device_mappings].empty?\n#\t\t\t\t\tinstance_descriptor.delete(:block_device_mappings)\n#\t\t\t\tend\n#pp instance_descriptor[:block_device_mappings]\n\t\t\tretries = 0\n\t\t\tbegin\n\t\t\t\tresponse = MU.ec2(@server['region']).run_instances(instance_descriptor)\n\t\t\trescue Aws::EC2::Errors::InvalidGroupNotFound, Aws::EC2::Errors::InvalidSubnetIDNotFound, Aws::EC2::Errors::InvalidParameterValue, Aws::EC2::Errors::RequestLimitExceeded => e\n\t\t\t\tif retries < 10\n\t\t\t\t\tif retries > 7\n\t\t\t\t\t\tMU.log \"Seeing #{e.inspect} while trying to launch #{node}, retrying a few more times...\", MU::WARN, details: instance_descriptor\n\t\t\t\t\tend\n\t\t\t\t\tsleep 10\n\t\t\t\t\tretries = retries + 1\n\t\t\t\t\tretry\n\t\t\t\telse\n\t\t\t\t\traise e\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tinstance = response.instances.first\n\t\t\tMU.log \"#{node} (#{instance.instance_id}) coming online\"\n\n\n\t\t\treturn instance\n\n\t\tend", "def spin_up_instance ami_name, vpc_id, key_name, security_group_id, subnet_id, instance_type = \"t2.micro\"\n resp = client.run_instances({\n dry_run: false,\n image_id: ami_name, # required\n min_count: 1, # required\n max_count: 1, # required\n key_name: key_name,\n instance_type: instance_type, # accepts t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m4.16xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, cg1.4xlarge, p2.xlarge, p2.8xlarge, p2.16xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge\n monitoring: {\n enabled: true, # required\n },\n network_interfaces: [\n {\n subnet_id: subnet_id,\n groups: [security_group_id],\n device_index: 0,\n associate_public_ip_address: true\n }\n ],\n\n instance_initiated_shutdown_behavior: \"stop\", # accepts stop, terminate\n })\n\n error \"Error starting EC2 instance #{resp.inspect}\" if resp.instances.nil? || resp.instances.size == 0\n\n return resp.instances[0]\n end", "def elasticache_repl_group_init(app_name, cache_node_type: 'cache.t2.small',\n num_cache_clusters: 2, seed: nil, **properties)\n if %w(t1).map { |t| cache_node_type.include?(t) }.include?(true)\n fail \"T1 instance types are not supported, got '#{cache_node_type}'\"\n end\n\n cluster_properties =\n !properties.nil? && properties.key?(:cluster_properties) ? properties[:cluster_properties] : {}\n\n cluster_resources = init_cluster_resources(app_name,\n cache_node_type,\n param_group_seed: seed,\n parameter_group_properties: cluster_properties)\n\n resource_name = \"#{app_name}RedisReplicationGroup\"\n resource resource_name,\n Type: 'AWS::ElastiCache::ReplicationGroup',\n Properties: {\n Engine: 'redis',\n ReplicationGroupDescription: \"Redis Replication group for #{app_name}\",\n AutomaticFailoverEnabled: num_cache_clusters > 1 ? 'true' : 'false',\n NumCacheClusters: num_cache_clusters,\n CacheNodeType: cache_node_type,\n CacheSubnetGroupName: ref(\"#{app_name}ElasticacheSubnetGroup\"),\n CacheParameterGroupName: ref(cluster_resources[:parameter_group]),\n SecurityGroupIds: [\n get_att(\"#{app_name}RedisSecurityGroup\", 'GroupId'),\n ref_private_security_group\n ]\n }.merge(properties.reject { |k, _v| k == :cluster_properties })\n\n output \"#{app_name}RedisReplicationGroup\",\n Description: \"Redis ReplicationGroup #{app_name}\",\n Value: ref(\"#{app_name}RedisReplicationGroup\")\n\n output \"#{app_name}RedisPrimaryEndpointAddress\",\n Description: \"Redis Primary Endpoint Address #{app_name}\",\n Value: get_att(resource_name, 'PrimaryEndPoint.Address')\n\n output \"#{app_name}RedisPrimaryEndpointPort\",\n Description: \"Redis Primary Endpoint Port #{app_name}\",\n Value: get_att(resource_name, 'PrimaryEndPoint.Port')\n\n output \"#{app_name}RedisReadOnlyEndpointAddresses\",\n Description: \"Redis ReadOnly Endpoint Addresses #{app_name}\",\n Value: get_att(resource_name, 'ReadEndPoint.Addresses')\n\n output \"#{app_name}RedisReadOnlyEndpointPorts\",\n Description: \"Redis ReadOnly Endpoint Ports #{app_name}\",\n Value: get_att(resource_name, 'ReadEndPoint.Ports')\n\n resource_name\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def create_instances(count)\n result = client.run_instances(AwsForm.map(params.merge(count: count)))\n instance_ids = result.instances.map(&:instance_id)\n ret = wait_for_create(instance_ids)\n # need to make sure add_tags is done after after wait_until or can have error that instance ids dont exist\n add_tags?(instance_ids, with_dtk_tag: true)\n IamInstanceProfile.set_iam_instance_profiles(self, instance_ids, params.iam_instance_profile) unless params.iam_instance_profile.nil?\n ret\n end", "def reboot_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: Class1InstanceApi.reboot ...'\n end\n # resource path\n local_var_path = '/reboot'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse2004'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['instanceId', 'token']\n\n new_options = opts.merge(\n :operation => :\"Class1InstanceApi.reboot\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: Class1InstanceApi#reboot\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rollback_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_rollback_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def restart\n client.restart\n end", "def update_instances\n Instance.update_all( ['public_ip=NULL, dns_name=NULL'], ['provider_account_id=? and public_ip=? and instance_id != ?', provider_account_id, public_ip, instance_id ] )\n \tInstance.update_all( ['public_ip=?, dns_name=?', public_ip, name], ['provider_account_id=? and instance_id=?', provider_account_id, instance_id ] )\n end", "def run\n ngen_auth\n @validate = Validator.new\n stack = EcoSystem.new\n @instanceparameters = stack.yaml_reader(config[:yaml])\n stack.validate = @validate\n config[:action] = 'create'\n stack.options = config\n stack.supress_output ='1'\n stack.instanceparameters = @instanceparameters\n inst_result = stack.opt_parse\n ho_hum\n \n inst_result.each do |server|\n config[:inst] = server['server']['display_name']\n instance = {}\n # puts chef_attrs = server['server']['userdata'].at(0)['chef']\n chef_attrs = server['server']['userdata'].at(0)['chef'] if !server['server']['userdata'].at(0)['chef'].nil?\n chef_attrs.each do |attr, value|\n instance[attr] = value\n end\n chef_node_configuration(instance)\n config[:chef_node_name] = config[:inst]\n inst_details = AttrFinder.new(server)\n inst_details.options = config\n inst_details.validate = @validate\n inst_details.function = 'server' \n inst = InstanceClient.new\n inst.validate = @validate\n inst.options = config\n inst.supress_output ='1'\n inst.instanceparameters = @instanceparameters\n ssh_host = inst.list_instance_ip(inst_details.compartment, inst_details.instance).at(1)\n bootstrap_for_linux_node(ssh_host).run\n node_attributes(ssh_host, 'IaaS')\n end\n end", "def update\n @updated_container = params([:container])\n @container = DeployedContainer.find(params[:container][:id])\n\n nova_ip = nil\n quantum_ip = nil\n if request.headers[\"X-Auth-Token\"] != \"\"\n token = request.headers[\"X-Auth-Token\"]\n begin\n services = Donabe::KEYSTONE.get_endpoints(token)\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n rescue\n token = Storage.find(cookies[:current_token]).data\n nova_ip = Storage.find(cookies[:nova_ip]).data\n quantum_ip = Storage.find(cookies[:quantum_ip]).data\n end\n end\n\n novaIP = URI.parse(nova_ip)\n nova = Ropenstack::Nova.new(novaIP, token)\n\n quantumIP = URI.parse(quantum_ip)\n quantum = Ropenstack::Quantum.new(quantumIP, token)\n\n # Make a note of how many networks this container already has\n networks_count = @container.deployed_networks.count\n # Define an array to keep track of how many existing networks have been sent back\n existing_networks = Array.new()\n @updated_container[\"deployed_networks\"].each do |network|\n if network[\"deployStatus\"] == false\n # This is a new network. Create it and store its data\n\n else\n # This is an existing network\n existing_networks << network[\"temp_id\"]\n end\n end\n \n if existing_networks.count < networks_count\n # Some existing networks were not sent back. Delete these networks\n end \n\n # Make a note of how many VMs this container already has\n vms_count = @container.deployed_vms.count\n # Define an array to keep track of how many existing VMs have been sent back\n existing_vms = Array.new()\n @updated_container[\"deployed_vms\"].each do |vm|\n if vm[\"deployStatus\"] == false\n # This is a new VM. Create it and store its data\n v = @container.deployed_vms.build()\n ports = Array.new()\n port_list = Array.new()\n vm[\"deployed_connected_networks\"].each do |network|\n port = quantum.create_port(network[\"openstack_id\"],'',\"compute:nova\")\n ports << port[\"port\"][\"id\"]\n data = {'uuid'=>network[\"openstack_id\"]}\n port_list << data\n connected_network = v.deployed_connected_networks.build()\n connected_network.openstack_id = network[\"openstack_id\"]\n connected_network.save \n end\n else\n # This is an existing VM\n existing_vms << vm[\"temp_id\"]\n end\n end\n \n if existing_vms.count < vms_count\n # Some existing vms were not sent back. Delete these vms\n end \n \n # Make a note of how many routers this container already has\n routers_count = @container.deployed_routers.count\n # Define an array to keep track of how many existing routers have been sent back\n existing_routers = Array.new()\n @updated_container[\"deployed_routers\"].each do |router|\n if router[\"deployStatus\"] == false\n # This is a new router. Create it and store its data\n else\n # This is an existing router\n existing_routers << router[\"temp_id\"] \n end\n end\n\n if existing_routers.count < routers_count\n # Some existing routers were not sent back. Delete these routers\n end \n\n @updated_container[\"deployed_conatiners\"].each do |container|\n # Do some magic. Possibly recursive magic.\n end\n\n end", "def process(_type = :daily) # Accepts :daily, :weekly, :monthly\n client = Aws::EC2::Client.new\n \n delete_snapshots!(client)\n create_snapshots!(client, _type)\nend", "def flush_instance\n # if we are adding our changing our servers, just add them here\n if resource[:ensure] == :present\n cmd = <<-EOF\n # Create the portgroup we want on the vswitch we want it on\n Get-VirtualSwitch -VMHost '#{resource[:esx_host]}' -Name '#{resource[:vswitch_name]}' -Standard | New-VirtualPortgroup -Name '#{resource[:portgroup]}' -VLanID #{resource[:vlan]}\n EOF\n end\n\n output = powercli_connect_exec(cmd)\n raise \"Error when executing command #{cmd}\\n stdout = #{output[:stdout]} \\n stderr = #{output[:stderr]}\" unless output[:exitcode].zero?\n end", "def generate_methods\n resp = MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).get_resources(\n rest_api_id: @cloud_id,\n )\n root_resource = resp.items.first.id\n\n # TODO guard this crap so we don't touch it if there are no changes\n @config['methods'].each { |m|\n m[\"auth\"] ||= m[\"iam_role\"] ? \"AWS_IAM\" : \"NONE\"\n\n method_arn = \"arn:#{MU::Cloud::AWS.isGovCloud?(@config[\"region\"]) ? \"aws-us-gov\" : \"aws\"}:execute-api:#{@config[\"region\"]}:#{MU::Cloud::AWS.credToAcct(@config['credentials'])}:#{@cloud_id}/*/#{m['type']}/#{m['path']}\"\n\n resp = MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).get_resources(\n rest_api_id: @cloud_id\n )\n ext_resource = nil\n resp.items.each { |resource|\n if resource.path_part == m['path']\n ext_resource = resource.id\n end\n }\n\n resp = if ext_resource\nMU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).get_resource(\n rest_api_id: @cloud_id,\n resource_id: ext_resource,\n)\n# MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).update_resource(\n# rest_api_id: @cloud_id,\n# resource_id: ext_resource,\n# patch_operations: [\n# {\n# op: \"replace\",\n# path: \"XXX ??\",\n# value: m[\"path\"]\n# }\n# ]\n# )\n else\n MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).create_resource(\n rest_api_id: @cloud_id,\n parent_id: root_resource,\n path_part: m['path']\n )\n end\n parent_id = resp.id\n\n resp = begin\n MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).get_method(\n rest_api_id: @cloud_id,\n resource_id: parent_id,\n http_method: m['type']\n )\n rescue Aws::APIGateway::Errors::NotFoundException\n resp = MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).put_method(\n rest_api_id: @cloud_id,\n resource_id: parent_id,\n authorization_type: m['auth'],\n http_method: m['type']\n )\n end\n\n # XXX effectively a placeholder default\n begin\n m['responses'].each { |r|\n params = {\n :rest_api_id => @cloud_id,\n :resource_id => parent_id,\n :http_method => m['type'],\n :status_code => r['code'].to_s\n }\n if r['headers']\n params[:response_parameters] = r['headers'].map { |h|\n [\"method.response.header.\"+h['header'], h['required']]\n }.to_h\n end\n\n if r['body']\n# XXX I'm guessing we can also have arbirary user-defined models somehow, so is_error is probably inadequate to the demand of the times\n params[:response_models] = r['body'].map { |b| [b['content_type'], b['is_error'] ? \"Error\" : \"Empty\"] }.to_h\n end\n\n MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).put_method_response(params)\n }\n rescue Aws::APIGateway::Errors::ConflictException\n # fine to ignore\n end\n\n if m['integrate_with']\n# role_arn = if m['iam_role']\n# if m['iam_role'].match(/^arn:/)\n# m['iam_role']\n# else\n# sib_role = @deploy.findLitterMate(name: m['iam_role'], type: \"roles\")\n# sib_role.cloudobj.arn\n# XXX make this more like get_role_arn in Function, or just use Role.find?\n# end\n# end\n\n function_obj = nil\n\n uri, type = if m['integrate_with']['type'] == \"aws_generic\"\n svc, action = m['integrate_with']['aws_generic_action'].split(/:/)\n [\"arn:aws:apigateway:\"+@config['region']+\":#{svc}:action/#{action}\", \"AWS\"]\n elsif m['integrate_with']['type'] == \"function\"\n function_obj = @deploy.findLitterMate(name: m['integrate_with']['name'], type: \"functions\").cloudobj\n [\"arn:aws:apigateway:\"+@config['region']+\":lambda:path/2015-03-31/functions/\"+function_obj.arn+\"/invocations\", \"AWS\"]\n elsif m['integrate_with']['type'] == \"mock\"\n [nil, \"MOCK\"]\n end\n\n params = {\n :rest_api_id => @cloud_id,\n :resource_id => parent_id,\n :type => type, # XXX Lambda and Firehose can do AWS_PROXY\n :content_handling => \"CONVERT_TO_TEXT\", # XXX expose in BoK\n :http_method => m['type']\n# credentials: role_arn\n }\n params[:uri] = uri if uri\n\n if m['integrate_with']['type'] != \"mock\"\n params[:integration_http_method] = m['integrate_with']['backend_http_method']\n else\n params[:integration_http_method] = nil\n end\n\n if m['integrate_with']['passthrough_behavior']\n params[:passthrough_behavior] = m['integrate_with']['passthrough_behavior']\n end\n if m['integrate_with']['request_templates']\n params[:request_templates] = {}\n m['integrate_with']['request_templates'].each { |rt|\n params[:request_templates][rt['content_type']] = rt['template']\n }\n end\n\n resp = MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).put_integration(params)\n\n if m['integrate_with']['type'] == \"function\"\n function_obj.addTrigger(method_arn, \"apigateway\", @config['name'])\n end\n\n m['responses'].each { |r|\n params = {\n :rest_api_id => @cloud_id,\n :resource_id => parent_id,\n :http_method => m['type'],\n :status_code => r['code'].to_s,\n :selection_pattern => \"\"\n }\n if r['headers']\n params[:response_parameters] = r['headers'].map { |h|\n [\"method.response.header.\"+h['header'], \"'\"+h['value']+\"'\"]\n }.to_h\n end\n\n MU::Cloud::AWS.apig(region: @config['region'], credentials: @config['credentials']).put_integration_response(params)\n\n }\n\n end\n\n }\n end", "def run_instances(parameters, secret)\n Kernel.puts(\"Received a request to run instances\")\n\n if @secret != secret\n Kernel.puts(\"Incoming secret #{secret} does not match current secret \" +\n \"#{@secret}, rejecting request.\")\n return BAD_SECRET_RESPONSE\n end\n\n Kernel.puts(\"Request parameters are #{parameters.inspect}\")\n RUN_INSTANCES_REQUIRED_PARAMS.each { |required_param|\n if parameters[required_param].nil? or parameters[required_param].empty?\n Kernel.puts(\"Incoming parameters was missing required parameter \" +\n \"#{required_param}, rejecting request.\")\n return {\"success\" => false, \"reason\" => \"no #{required_param}\"}\n end\n }\n\n reservation_id = HelperFunctions.get_random_alphanumeric()\n @reservations[reservation_id] = {\n \"success\" => true,\n \"reason\" => \"received run request\",\n \"state\" => \"pending\",\n \"vm_info\" => nil\n }\n Kernel.puts(\"Generated reservation id #{reservation_id} for this request.\")\n\n Thread.new {\n HelperFunctions.set_creds_in_env(parameters['credentials'], \"1\")\n public_ips, private_ips, ids = HelperFunctions.spawn_vms(parameters)\n @reservations[reservation_id][\"state\"] = \"running\"\n @reservations[reservation_id][\"vm_info\"] = {\n \"public_ips\" => public_ips,\n \"private_ips\" => private_ips,\n \"instance_ids\" => ids\n }\n Kernel.puts(\"Successfully finished request #{reservation_id}.\")\n }\n\n Kernel.puts(\"Successfully started request #{reservation_id}.\")\n return {\"success\" => true, \"reservation_id\" => reservation_id, \n \"reason\" => \"none\"}\n end", "def describe_instances\n raise RemoteException.new(:method_not_defined, \"describe_instances\")\n end", "def add_new_instances(count)\n Output.new(current_instances + parent.create_instances(count), []) \n end", "def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend", "def create_vm\n if new_resource.clone\n clone_vm\n else\n data = {\n vmid: vmid,\n bootdisk: 'virtio0',\n cores: INSTANCE_SIZE[new_resource.size]['cpu'],\n memory: INSTANCE_SIZE[new_resource.size]['memory'],\n ide2: \"#{new_resource.cdrom},media=cdrom\",\n numa: (new_resource.numa ? 1 : 0),\n ostype: get_type(new_resource.ostype),\n sockets: 1,\n virtio0: \"#{new_resource.storage}:/vm-#{vmid}-disk-1.qcow2,size=#{new_resource.disk}\"\n }.merge(new_resource.net)\n data.merge(hugepages: new_resource.hugepages) if new_resource.hugepages\n api.post(\"/nodes/#{new_resource.host}/qemu\", data)\n end\nend", "def post_network(request)\n # --- Create the new Instance ---\n network = VirtualNetworkOCCI.new(\n VirtualNetwork.build_xml,\n @client,\n request.body,\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = network.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = network.allocate(template, @config[:cluster_id]||ClusterPool::NONE_CLUSTER_ID)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n network.info\n return to_occi_xml(network, :code=>201)\n end", "def hard_reboot_pvm_instance(instance_id)\n post(\n \"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action\",\n {\"action\" => \"hard-reboot\"}.to_json\n )\n end", "def delete_instances(count)\n instances_to_delete = current_instances.last(count) \n parent.terminate_instances(Group.instance_ids(instances_to_delete))\n # remaining_instances under alive\n Output.new(current_instances.first(current_instances.size - count), instances_to_delete)\n end", "def restart_cluster\n #stop balancing hbase tables in order to restart nodes\n run_balancer(false)\n\n region_servers.each { |region_server|\n unless move_regions(region_server) then\n raise \"unable to move regions #{region_server}\"\n end\n\n unless restart_region_server(region_server) then\n raise \"unable to restart RS #{region_server}\"\n end\n }\n\n run_balancer(true)\n end", "def create(resources)\n created = 0\n resources.each do |resource|\n model = resource.model\n serial = model.serial\n class_name = class_name(model)\n @log.debug(\"About to create #{model} backed by #{class_name} using #{resource.attributes}\")\n\n begin\n create_url = build_create_url(class_name)\n page = @agent.get(create_url) \n form_id = build_form_id(class_name.to_sym, :create_form_id)\n the_form = page.form_with(:id => form_id)\n the_properties = resource.attributes(key_on=:field).reject{|p,v| v.nil? }\n create_form = fill_form(the_form, the_properties, class_name)\n @log.debug(\"Create form is #{create_form.inspect}\")\n response = @agent.submit(create_form)\n @log.debug(\"Result of actual create call is #{response.code}\")\n if response.code.to_i == 302\n redirect_location = response.header['location']\n @log.debug(\"Redirect location is #{redirect_location}\")\n id = redirect_location.split('/').last.to_i #TODO: proper cast\n @log.debug(\"Newly created instance id is #{id}\")\n unless id.nil?\n serial.set(resource,id)\n created += 1\n end\n end\n rescue => e\n trace = e.backtrace.join(\"\\n\")\n @log.error(\"Failed to create resource: #{e.message}\") \n @log.error(trace) \n end\n end\n created\n end", "def restart_running_instances_services\n nodes.each do |node|\n node.restart_with_monit\n end\n end", "def recreate_versions!\n with_callbacks(:recreate_versions, file) do\n versions.each { |name, v| v.store!(file) }\n end\n end", "def reredisize_instance\n attrs = Redisable.as_json_for(self)\n key = Redisable.key_name_for(self.model_name.name, attrs, \"instance\")\n\n # binding.pry\n Rails.cache.write(key, self, expires_in: 1000.years)\n Redisable.enqueue(:reredisize_instance_metas, key)\n end", "def apply_updates_to_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_apply_updates_to_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def reboot\n requires :id\n begin\n response = service.post_reboot_vapp(id)\n rescue Fog::VcloudDirector::Compute::BadRequest => ex\n Fog::Logger.debug(ex.message)\n return false\n end\n service.process_task(response.body)\n end", "def instances(arg)\n case arg\n when Range\n minimum_instances arg.first\n maximum_instances arg.last\n when Fixnum\n minimum_instances arg\n maximum_instances arg\n when Hash\n nodes(arg)\n else\n raise SpecException.new(\"Don't know how to handle instances cloud input #{arg}\")\n end\n end", "def reboot_pvm_instance(instance_id)\n post(\n \"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action\",\n {\"action\" => \"reboot\"}.to_json\n )\n end", "def instances; end", "def instances; end", "def recreate_all_subscriptions\n\n datasift_calls = DatasiftCalls.new\n puts \"It is getting to before the delete\"\n\n subscriptions_deleted = delete_all_subscriptions_on_datasift\n puts \"It is getting to before the delete\"\n if subscriptions_deleted == true\n puts \"It is getting to before the create \"\n datasift_subscriptions = DatasiftSubscription.all\n puts \"Total subscriptions to be created = #{datasift_subscriptions.count}\"\n count = 1\n datasift_subscriptions.each do |subscription|\n begin\n puts \"Sleeping....\"\n sleep(2.minutes)\n new_subscription = datasift_calls.create_push_subscription(subscription[:stream_hash], subscription[:subscription_name] )\n rescue\n puts \"It is before the create retry. Sleeping for 5 minutes...\"\n sleep(60.minutes)\n retry\n end\n\n subscription_attributes = subscription.attributes\n subscription_attributes.delete('id')\n\n new_datasift_subscription = DatasiftSubscription.new(subscription_attributes)\n\n if new_datasift_subscription.save\n subscription.destroy\n end\n\n #subscription[:datasift_subscription_id] = new_subscription[:data][:id]\n #subscription.save\n\n puts \"Total subscriptions created: #{count}\"\n count = count + 1\n end\n\n end\n\n end", "def run(name, tags, attributes, match_all)\n resources = api_client.tags.by_tag(resource_type: 'instances', tags: [tags], match_all: match_all)\n raise \"No Instances found for tag #{tags}\" if resources.empty?\n\n resources.first.links.each do |link|\n resource = api_client.resource(link['href'])\n # find the server_template of the instance\n st = resource.show.server_template\n # find the exact runnable bindings by name and which are operational on the instance\n runnable_bindings = st.show.runnable_bindings.index.select do |r|\n r.right_script.show.name == name && r.sequence == 'operational'\n end\n raise \"RightScript #{name} not found\" if runnable_bindings.empty?\n right_script = runnable_bindings.first.right_script\n if resource.show.state == 'operational'\n # run the found rightscript on the instance and pass the attributes as inputs.\n status = resource.run_executable(right_script_href: right_script.href, inputs: attributes)\n Chef::Log.info status\n end\n end\n end", "def create\n @instance = Instance.new(params[:instance])\n\n respond_to do |format|\n if @instance.save\n\n system(\"ssh root@#{CloudGui::Application.config.hypervisor_ip} \\\"exec /data/cloud/scripts/provision.sh #{params[:instance][:cpus]} #{params[:instance][:memory]} #{params[:instance][:baseimage]} 2>&1 | tee /data/cloud/logs/cloud_gui.log\\\"\")\n\n format.html { redirect_to @instance, notice: 'Instance was successfully created.' }\n format.json { render json: @instance, status: :created, location: @instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def describe_instances\n return { reservations: [] } unless configured?\n\n @client.describe_instances.to_h\n end", "def externalRecipeSeed\n 20.times do\n api_recipe = get_random_recipe()\n createRecipeFromAPI(api_recipe)\n end\nend", "def execute_restore_stripe(options={})\n new_vol_name = \"#{options[:lineage]}-#{ENV['EC2_INSTANCE_ID']}\"\n json_result = self.find_latest_ebs_backup(options[:lineage], options[:from_master], options[:timestamp])\n\n if json_result.nil? \n STDERR.puts \"No existing snapshot found for the specified nickname lineage. Aborting...\"\n exit(-1)\n end\n STDERR.puts \"Restoring.. #{json_result.inspect}\"\n options[:new_size_gb] = (options[:new_volume_size_in_gb] / json_result.size.to_f).ceil if options[:new_volume_size_in_gb]\n\n @disk.sync\n @disk.umount\n @disk.disable_volume\n\n self.execute_terminate_volumes if options[:force]\n\n json_result.each do |snapshot|\n \n# create volume from snap\n create_result = ( options[:new_size_gb] ? create_volume_from_snap_size_gb(snapshot[\"aws_id\"],new_vol_name,options[:new_size_gb] ) : create_volume_from_snap(snapshot[\"aws_id\"], new_vol_name ) )\n raise \"FATAL: error occured in create_volume_from_snap(#{snapshot['aws_id']}, #{new_vol_name})\" if create_result.nil?\n\n# attach volume to instance\n retry_seconds = 0\n while retry_seconds < 200\n begin \n attach_result = attach_volume(create_result['aws_id'], snapshot['device'])\n raise \"FATAL: error occured in attach_volume(#{create_result['aws_id']}, #{snapshot['device']}\" if attach_result.nil?\n break if attach_result\n rescue => e\n puts \"CAUGHT EXCEPTION in execute_restore_stripe. Device attachment. #{e}, Retrying #{retry_seconds} of 200 seconds\"\n retry_seconds += 30\n sleep 30 \n end\n end\n raise \"FATAL: error occured in attach_volume(#{create_result['aws_id']}, #{snapshot['device']}\" if attach_result.nil?\n end\n\n# wait for devices to attach, after completing ALL the api calls\n json_result.each { |s| wait_for_attachment(s['device']) }\n @disk.enable_volume\n raise \"FATAL: mount failed!\" unless @disk.mount\n @disk.write_fstab\n# TODO - grow the filesystem if a new size was given\n end", "def reset_instance_dataset\n ret = super\n return unless ds = @instance_dataset\n\n if columns = insert_returning_columns(ds)\n ds = ds.returning(*columns)\n end\n @instance_insert_dataset = ds\n\n ret\n end", "def reboot!\n reboot_instance(_id) && reload!\n end", "def destroy\n requires :name, :type, :ttl, :rrdatas\n\n service.create_change(self.zone.id, [], [resource_record_set_format])\n true\n end", "def resource_way\n # TODO: make json default format?\n\n # try resource style\n #resources = RestClient::Resource.new(\"#{BASE_URL}/#{RESOURCE_NAME}\", \n #'user@test.com', 'please') #, :accept => :json)\n resources = RestClient::Resource.new(\"#{BASE_URL}/#{RESOURCE_NAME}\", 'b4j5qBqzYx5EukCM3Vri') #token\n # \n response = resources.get(:accept => :json)\n all_hosts = JSON.parse(response)\n puts \"EXISTING HOSTS: \" + all_hosts.inspect\n\n new_opts = {\n \"host_name\" => \"damian.np.dc1.eharmony.com\",\n \"alias\" => \"damian.np.dc1.eharmony.com\",\n \"address\" => \"damian.np.dc1.eharmony.com\",\n \"max_check_attempts\" => 3,\n \"notification_interval\" => 5,\n # 24x7\n \"notification_period\" => \"24x7\",\n #\"notification_period_id\" => \"5050cb9ebfa68e0903000001\",\n # 24x7\n \"check_period\" => \"24x7\",\n #\"check_period_id\" => \"5050cb9ebfa68e0903000001\",\n # just using first contact\n #\"contacts\" => [\"pat-obrien\"],\n \"contacts\" => [\"damian\"],\n #\"contact_ids\" => [\"5051283ebfa68e5757000002\"],\n }\n\n\n #puts resources['new'].post(NEW_OPTS.to_json, :content_type => :json, :accept \n #=> :json )\n # NOTE: even though this works and creates a new Host in DB - i still get 406 \n # Not Acceptable response\n #puts resources['new'].post({ RESOURCE_NAME.to_s => new_opts}, :accept => \n #:json )\n begin\n puts resources['new'].post({ RESOURCE_NAME.to_s => new_opts})\n rescue Exception => e\n puts \"ERROR: #{e} = #{e.inspect}\"\n end\n\n \n\n # now edit the resource ...\nend", "def createEc2Instance\n\n instance_descriptor = {\n :image_id => @config[\"image_id\"],\n :key_name => @deploy.ssh_key_name,\n :instance_type => @config[\"size\"],\n :disable_api_termination => true,\n :min_count => 1,\n :max_count => 1\n }\n\n instance_descriptor[:iam_instance_profile] = getIAMProfile\n\n security_groups = myFirewallRules.map { |fw| fw.cloud_id }\n if security_groups.size > 0\n instance_descriptor[:security_group_ids] = security_groups\n else\n raise MuError, \"Didn't get any security groups assigned to be in #{@mu_name}, that shouldn't happen\"\n end\n\n if @config['private_ip']\n instance_descriptor[:private_ip_address] = @config['private_ip']\n end\n\n if !@vpc.nil? and @config.has_key?(\"vpc\")\n subnet = mySubnets.sample\n if subnet.nil?\n raise MuError, \"Got null subnet id out of #{@config['vpc']}\"\n end\n MU.log \"Deploying #{@mu_name} into VPC #{@vpc.cloud_id} Subnet #{subnet.cloud_id}\"\n allowBastionAccess\n instance_descriptor[:subnet_id] = subnet.cloud_id\n end\n\n if !@userdata.nil? and !@userdata.empty?\n instance_descriptor[:user_data] = Base64.encode64(@userdata)\n end\n\n MU::Cloud::AWS::Server.waitForAMI(@config[\"image_id\"], region: @region, credentials: @credentials)\n\n instance_descriptor[:block_device_mappings] = MU::Cloud::AWS::Server.configureBlockDevices(image_id: @config[\"image_id\"], storage: @config['storage'], region: @region, credentials: @credentials)\n\n instance_descriptor[:monitoring] = {enabled: @config['monitoring']}\n\n if @tags and @tags.size > 0\n instance_descriptor[:tag_specifications] = [{\n :resource_type => \"instance\",\n :tags => @tags.keys.map { |k|\n { :key => k, :value => @tags[k] }\n }\n }]\n end\n\n MU.log \"Creating EC2 instance #{@mu_name}\", details: instance_descriptor\n\n instance = resp = nil\n loop_if = Proc.new {\n instance = resp.instances.first if resp and resp.instances\n resp.nil? or resp.instances.nil? or instance.nil?\n }\n\n bad_subnets = []\n mysubnet_ids = if mySubnets\n mySubnets.map { |s| s.cloud_id }\n end\n begin\n MU.retrier([Aws::EC2::Errors::InvalidGroupNotFound, Aws::EC2::Errors::InvalidSubnetIDNotFound, Aws::EC2::Errors::InvalidParameterValue], loop_if: loop_if, loop_msg: \"Waiting for run_instances to return #{@mu_name}\") {\n resp = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).run_instances(instance_descriptor)\n }\n rescue Aws::EC2::Errors::Unsupported => e\n bad_subnets << instance_descriptor[:subnet_id]\n better_subnet = (mysubnet_ids - bad_subnets).sample\n if e.message !~ /is not supported in your requested Availability Zone/ and\n (mysubnet_ids.nil? or mysubnet_ids.empty? or\n mysubnet_ids.size == bad_subnets.size or\n better_subnet.nil? or better_subnet == \"\")\n raise MuError.new e.message, details: mysubnet_ids\n end\n instance_descriptor[:subnet_id] = (mysubnet_ids - bad_subnets).sample\n if instance_descriptor[:subnet_id].nil?\n raise MuError.new \"Specified subnet#{bad_subnets.size > 1 ? \"s do\" : \" does\"} not support instance type #{instance_descriptor[:instance_type]}\", details: bad_subnets\n end\n MU.log \"One or more subnets does not support instance type #{instance_descriptor[:instance_type]}, attempting with #{instance_descriptor[:subnet_id]} instead\", MU::WARN, details: bad_subnets\n retry\n rescue Aws::EC2::Errors::InvalidRequest => e\n MU.log e.message, MU::ERR, details: instance_descriptor\n raise e\n end\n\n MU.log \"#{@mu_name} (#{instance.instance_id}) coming online\"\n\n instance\n end", "def create\n deploy\n end" ]
[ "0.6358541", "0.60766006", "0.5926458", "0.59236604", "0.58288854", "0.5812304", "0.58088934", "0.5766058", "0.575676", "0.5708074", "0.5683103", "0.5616821", "0.56145215", "0.5608361", "0.55885017", "0.5580009", "0.55400705", "0.55069363", "0.54900926", "0.5471066", "0.5449941", "0.54412025", "0.54284006", "0.5408824", "0.5404514", "0.5362124", "0.53610927", "0.53479004", "0.53449744", "0.53241825", "0.53103834", "0.529442", "0.52907676", "0.52590966", "0.5256174", "0.525283", "0.5252352", "0.5245141", "0.5242553", "0.524194", "0.5229769", "0.5225839", "0.522034", "0.5217449", "0.5211248", "0.52098584", "0.5208649", "0.52072483", "0.5203461", "0.52027816", "0.5189838", "0.5189802", "0.5189802", "0.5181128", "0.5174595", "0.51696277", "0.5159459", "0.51583534", "0.5158147", "0.5150748", "0.51430106", "0.51330817", "0.5108667", "0.51013124", "0.50951886", "0.5092867", "0.50859135", "0.5082579", "0.50785553", "0.507205", "0.507197", "0.5059425", "0.5057713", "0.50571257", "0.50503623", "0.5049557", "0.50384104", "0.50345635", "0.5031374", "0.50305116", "0.5025449", "0.502483", "0.5018186", "0.50117755", "0.5002926", "0.50013083", "0.49953723", "0.49953723", "0.49892884", "0.4985249", "0.49839368", "0.49818566", "0.49778858", "0.49755868", "0.49749395", "0.49657574", "0.49649593", "0.49629518", "0.4944481", "0.49408352" ]
0.75045586
0
Baseline implementation for the resize REST call
def resize request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_resize_request request_pb response = @client_stub.make_post_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize!\n end", "def resize\n image = ManagedImage.from_path(params[:image])\n width = params[:width].to_i\n height = params[:height].to_i\n render json: image.resize(width, height)\n end", "def resize(width, height); end", "def check_for_resize; end", "def resize(width, height)\n end", "def resize_to(width, height); end", "def resize_to_fit\n image = ManagedImage.from_path(params[:image])\n width = params[:width].to_i\n height = params[:height].to_i\n render json: image.resize_to_fit(width, height)\n end", "def resize(width, height, use_hints = false)\n old_size = self.size\n return_value = resize_async width, height, use_hints\n 100.times do\n break unless self.size == old_size\n sleep 0.01\n end\n return_value\n end", "def resize\n @event.endtime = make_time_from_minute_and_day_delta(@event.endtime)\n if @event.save\n render nothing: true\n else\n render json: { message: 'This service could not be resized' }\n end\n end", "def resize\n trigger(:_clear_)\n\n trigger(:_refresh_)\n\n true\n end", "def resize _obj, _args\n \"_obj resize _args;\" \n end", "def resize_to_fill\n image = ManagedImage.from_path(params[:image])\n width = params[:width].to_i\n height = params[:height].to_i\n render json: image.resize_to_fill(width, height)\n end", "def resize_resize_simple_with_http_info(width, height, image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResizeApi.resize_resize_simple ...'\n end\n # verify the required parameter 'width' is set\n if @api_client.config.client_side_validation && width.nil?\n fail ArgumentError, \"Missing the required parameter 'width' when calling ResizeApi.resize_resize_simple\"\n end\n # verify the required parameter 'height' is set\n if @api_client.config.client_side_validation && height.nil?\n fail ArgumentError, \"Missing the required parameter 'height' when calling ResizeApi.resize_resize_simple\"\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 ResizeApi.resize_resize_simple\"\n end\n # resource path\n local_var_path = '/image/resize/target/{width}/{height}'.sub('{' + 'width' + '}', width.to_s).sub('{' + 'height' + '}', height.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: ResizeApi#resize_resize_simple\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def resize(new_size, options={})\n param = {\n :uniq_id => @uniq_id,\n :new_size => new_size\n }.merge options\n options[:skip_fs_resize] = options[:skip_fs_resize] ? 1 : 0\n data = Storm::Base::SODServer.remote_call '/Server/resize', param\n self.from_hash data\n end", "def my_resize(width, height)\n manipulate! do |img|\n img.resize \"#{width}x#{height}!\"\n img\n end\n end", "def resize_to_fill_at\n image = ManagedImage.from_path(params[:image])\n width = params[:width].to_i\n height = params[:height].to_i\n x = params[:x].to_f / 100\n y = params[:y].to_f / 100\n render json: image.resize_to_fill_at(width, height, x, y)\n end", "def resize_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def small(input) # Method that returns the image\n self.images[input].variant(resize: \"300x300\").processed # Resizing the image and return it\n end", "def resize(*args)\n argv = to_pointer([\"resize\"] + args)\n rrd_resize(args.size+1, argv) == 0\n ensure\n free_pointers\n end", "def old_resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n size = [size, size] if size.is_a?(Fixnum)\n img.thumbnail!(*size)\n elsif size.is_a?(String) && size =~ /^c.*$/ # Image cropping - example geometry string: c75x75\n dimensions = size[1..size.size].split(\"x\")\n img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)\n else\n img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows) }\n end\n self.width = img.columns if respond_to?(:width)\n self.height = img.rows if respond_to?(:height)\n img.strip! unless attachment_options[:keep_profile]\n quality = img.format.to_s[/JPEG/] && get_jpeg_quality\n out_file = write_to_temp_file(img.to_blob { self.quality = quality if quality })\n temp_paths.unshift out_file\n self.size = File.size(self.temp_path)\n end", "def resize(width,height)\n\t\t@buffer=@buffer.scale(width, height, :bilinear)\n\tend", "def resize\n @image.resize \"#{@placement[:a]}x#{OUTER}\\!\"\n end", "def dynamic_resize_to_fit(size)\n resize_to_fit *(model.class::IMAGE_CONFIG[size])\n end", "def thumbnail(size); end", "def perform(secret, endpoint, args = {})\n super\n vm = virtual_machine(args.fetch(:identifier), TARGET_STATE)\n template = size_template(args.fetch(:size))\n\n logger.debug { \"Resizing virtual machine with ID #{vm['ID']} to #{template.split.join(' & ')}\" }\n handle { vm.resize(template, true) }\n handle { vm.resume }\n end", "def resize!(*args)\n width, height = Geometry.new(*args).dimensions\n resize(\"#{width}x#{height}^\").crop(width, height).repage\n end", "def revert_resize!\n # If the resize bug gets figured out, should put a check here to make sure that it's in the proper state for this.\n data = JSON.generate(:revertResize => nil)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n self.populate\n true\n end", "def resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n size = [size, size] if size.is_a?(Fixnum)\n img.thumbnail!(*size)\n elsif size.is_a?(String) && size =~ /^c.*$/ # Image cropping - example geometry string: c75x75\n dimensions = size[1..size.size].split(\"x\")\n img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)\n elsif size.is_a?(String) && size =~ /^b.*$/ # Resize w/border - example geometry string: b75x75\n dimensions = size[1..size.size].split(\"x\")\n img.change_geometry(dimensions.join(\"x\")) do |cols, rows, image| \n image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows ) \n end\n img.background_color = \"black\"\n x_offset = (img.columns - dimensions[0].to_i) / 2\n y_offset = (img.rows - dimensions[1].to_i) / 2\n img = img.extent(dimensions[0].to_i, dimensions[1].to_i, x_offset, y_offset)\n else\n img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows) }\n end\n img.strip! unless attachment_options[:keep_profile]\n temp_paths.unshift write_to_temp_file(img.to_blob)\n end", "def large_process\n case [model.attachable_type, model.image_type]\n when ['User', 'avatar'] then\n resize_to_fill 1024, 683 # 3x2\n when ['User', 'inspiration'] then\n resize_to_fit 1024, 9999 # fixed width\n when ['Message', 'avatar'] then\n resize_to_fit 1024, 9999 # fixed width\n when ['Message', 'alternate'] then\n resize_to_fit 1024, 9999 # fixed width\n when ['Alternative', 'avatar'] then\n resize_to_fill 1024, 683 # 3x2\n else\n resize_to_fit 1024, 9999 # fixed width\n end\n # TODO: Test and implement this.\n # fix_exif_rotation\n quality 70\n end", "def resize_and_save_space(resizing)\n { resize: resizing, quality: \"85%\", strip: true, interlace: \"Plane\" }\n end", "def do_resize(height = THUMBNAIL_HEIGHT, width = THUMBNAIL_WIDTH)\n #MES- Only do thumbnailing if the Image Magick library can be loaded.\n # This is to make setup easier for other developers- they are not\n # required to have Image Magick.\n # More information on Image Magick is available at \n # http://studio.imagemagick.org/RMagick/doc/usage.html\n if RMAGICK_SUPPORTED\n #MES- Turn the blob into an ImageMagick object\n img = Magick::Image.from_blob(data).first\n if img.nil?\n logger.info \"Failed to resize image #{self.name}- unable to create RMagick wrapper for image\"\n return nil\n end\n \n #MES- Shrink the image\n return img.crop_resized(width, height)\n else\n return nil\n end\n end", "def resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n size = [size, size] if size.is_a?(Fixnum)\n img.thumbnail!(*size)\n elsif size.is_a?(String) && size =~ /^c.*$/ # Image cropping - example geometry string: c75x75\n dimensions = size[1..size.size].split(\"x\")\n img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)\n elsif size.is_a?(String) && size =~ /^b.*$/ # Resize w/border - example geometry string: b75x75\n dimensions = size[1..size.size].split(\"x\")\n img.change_geometry(dimensions.join(\"x\")) do |cols, rows, image|\n image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows )\n end\n img.background_color = \"black\"\n x_offset = (img.columns - dimensions[0].to_i) / 2\n y_offset = (img.rows - dimensions[1].to_i) / 2\n img = img.extent(dimensions[0].to_i, dimensions[1].to_i, x_offset, y_offset)\n else\n img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows) }\n end\n img.strip! unless attachment_options[:keep_profile]\n temp_paths.unshift write_to_temp_file(img.to_blob)\n end", "def resize_to_fit width, height\n process :resize_to_fit => [width, height]\n end", "def resize_image uri, options = { }\n\n\t# parse id, mime type from image uri\n\tformat = uri.split('/').last.match(/\\.(.+)$/)[1]\n\tid = uri.split('/').last.sub(/\\..+$/, '').slugify\n\n\t# resize image and save to /tmp\n\timage = Image.read(uri)[0]\n\t\n\t# calculate width/height based on percentage of \n\t# difference of width from absolute value of 150\n\tif options[:width]\n\t\twidth = options[:width]\n\t\tscale = (image.page.width - width) / image.page.width.to_f\n\t\theight = image.page.height - (image.page.height * scale)\n\n\t\timage = image.thumbnail(width, height)\n\t\timage.write(\n\t\t\tpath = \"/tmp/#{id}-constrainedw.#{format}\"\n\t\t)\t\t\n\n\telsif options[:height]\n\t\theight = options[:height]\n\t\tscale = (image.page.height - height) / image.page.height.to_f\n\t\twidth = image.page.width - (image.page.width * scale)\n\n\t\timage = image.thumbnail(width, height)\n\t\timage.write(\n\t\t\tpath = \"/tmp/#{id}-thumbh.#{format}\"\n\t\t)\n\n\telse\n\t\twidth = 150\n\t\tscale = (image.page.width - width) / image.page.width.to_f\n\t\theight = image.page.height - (image.page.height * scale)\n\n\t\timage = image.thumbnail(width, height)\n\t\timage.write(\n\t\t\tpath = \"/tmp/#{id}-thumb.#{format}\"\n\t\t)\n\n\tend\n\n path\nend", "def resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n if size.is_a?(Fixnum)\n # Borrowed from image science's #thumbnail method and adapted \n # for this.\n scale = size.to_f / (img.width > img.height ? img.width.to_f : img.height.to_f)\n img.resize!((img.width * scale).round(1), (img.height * scale).round(1), false)\n else\n img.resize!(size.first, size.last, false) \n end\n else\n w, h = [img.width, img.height] / size.to_s\n img.resize!(w, h, false)\n end\n temp_paths.unshift random_tempfile_filename\n self.size = img.export(self.temp_path)\n end", "def create_resized_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end", "def resize_image(img, size) \n # resize_image take size in a number of formats, we just want \n # Strings in the form of \"crop: WxH\" \n if (size.is_a?(String) && size =~ /^crop: (\\d*)x(\\d*)/i) || \n (size.is_a?(Array) && size.first.is_a?(String) && \n size.first =~ /^crop: (\\d*)x(\\d*)/i) \n img.crop_resized!($1.to_i, $2.to_i) \n # We need to save the resized image in the same way the \n # orignal does. \n self.temp_path = write_to_temp_file(img.to_blob) \n else \n super # Otherwise let attachment_fu handle it \n end \n end", "def sized(width, height)\n\t\t\t@sized_thumb = @template\n\t\t\t@sized_thumb.sub! \"{width}\", width.to_s\n\t\t\t@sized_thumb.sub! \"{height}\", height.to_s\n\t\tend", "def resized!\n self[:resized] = true\n node[:volumes][name][:resized] = true\n end", "def setSize _obj, _args\n \"_obj setSize _args;\" \n end", "def resize\n # TODO\n # if aray is 75% full, double the array and copy all items over\n end", "def resize_to_fit width, height\n manipulate! do |image|\n cols = image.width\n rows = image.height\n\n if width != cols or height != rows\n scale = [width/cols.to_f, height/rows.to_f].min\n cols = (scale * (cols + 0.5)).round\n rows = (scale * (rows + 0.5)).round\n image.resize cols, rows do |img|\n yield(img) if block_given?\n img.save current_path\n end\n end\n end\n end", "def resize(size='512x512')\n if self.url.present?\n image = MiniMagick::Image.open(self.url)\n image.resize(size)\n image\n end\n end", "def size=(size)\n @size = size\n resize\n end", "def resize\n return self if self.count < (self.length * 0.811105)\n # garbage collecting\n self.gc if self.respond_to? :gc\n\n sz = self.size * 2\n super(sz)\n @bitmap.resize(sz)\n self\n end", "def resize_image(params)\n # The path of the image\n path = \"public/images/#{params[1]}/#{@tempo.id}_#{params[1]}.#{params[0]}\"\n # Read the image\n img = Magick::Image.read(\"public/images/original/#{@original_image_name}\").first\n # Resize and Crop the image\n target = Magick::Image.new(params[2], params[3])\n thumb = img.resize_to_fill!(params[2], params[3])\n target.composite(thumb, Magick::CenterGravity, Magick::CopyCompositeOp).write(path)\n # Insert the width and height into an object\n @tempo.width, @tempo.height = \"#{params[2]}\", \"#{params[3]}\"\n # Add the link and tags to its DB\n add_linkID_tagsID(path,params[1])\n # Delete the image after uploading it to the storage\n File.delete(path)\n end", "def resize_to_limit(width, height)\n manipulate! do |img|\n img.resize \"#{width}x#{height}>\"\n img = yield(img) if block_given?\n img\n end\n end", "def resize_to_limit(width, height)\n manipulate! do |img|\n img.manipulate!(:resize => \"#{width}x#{height}>\")\n img = yield(img) if block_given?\n img\n end\n end", "def resize request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/disks/#{request_pb.disk}/resize\"\n body = request_pb.disks_resize_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def resize(url, w: 300,\n h: 300,\n resize: 'fill',\n gravity: 'ce',\n enlarge: false,\n ext: 'original')\n\n return url unless Rails.env.production?\n\n key = [ENV['IMGPROXY_KEY']].pack('H*')\n salt = [ENV['IMGPROXY_SALT']].pack('H*')\n\n encoded_url = Base64.urlsafe_encode64(\"#{request.base_url}#{url}\")\n .tr('=', '').scan(/.{1,16}/).join('/')\n\n enlarge = (enlarge ? 1 : 0)\n ext = url.split('.').last.downcase if ext == 'original'\n\n path = \"/#{resize}/#{w}/#{h}/#{gravity}/#{enlarge}/#{encoded_url}.#{ext}\"\n\n digest = OpenSSL::Digest.new('sha256')\n hmac = Base64.urlsafe_encode64(OpenSSL::HMAC.digest(digest, key, \"#{salt}#{path}\")).tr('=', '')\n\n \"/imgproxy/#{hmac}#{path}\"\n end", "def update_size(x,y)\n @width = x if x > @width\n @height = y if y > @height\n end", "def resize_post_with_http_info(max_width, max_height, image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResizeApi.resize_post ...'\n end\n # verify the required parameter 'max_width' is set\n if @api_client.config.client_side_validation && max_width.nil?\n fail ArgumentError, \"Missing the required parameter 'max_width' when calling ResizeApi.resize_post\"\n end\n # verify the required parameter 'max_height' is set\n if @api_client.config.client_side_validation && max_height.nil?\n fail ArgumentError, \"Missing the required parameter 'max_height' when calling ResizeApi.resize_post\"\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 ResizeApi.resize_post\"\n end\n # resource path\n local_var_path = '/image/resize/preserveAspectRatio/{maxWidth}/{maxHeight}'.sub('{' + 'maxWidth' + '}', max_width.to_s).sub('{' + 'maxHeight' + '}', max_height.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: ResizeApi#resize_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def resize_to_fit(new_width, new_height)\n width, height = FastImage.size(self.current_path)\n width_ratio = new_width.to_f / width.to_f\n height_when_width_used = height * width_ratio\n if height_when_width_used <= new_height\n new_height = height_when_width_used\n else\n height_ratio = new_height.to_f / height.to_f\n new_width = width * height_ratio\n end\n FastImage.resize(self.current_path, self.current_path, new_width, new_height)\n end", "def resizeImage(width,height)\n if @image != nil\n @image.resize(width,height)\n @image.applyOn(@imageBox)\n end\n end", "def resize_to_limit(width, height)\n width = dimension_from width\n height = dimension_from height\n manipulate! do |img|\n geometry = Magick::Geometry.new(width, height, 0, 0, Magick::GreaterGeometry)\n new_img = img.change_geometry(geometry) do |new_width, new_height|\n img.resize(new_width, new_height)\n end\n destroy_image(img)\n new_img = yield(new_img) if block_given?\n new_img\n end\n end", "def resize_to_fill_and_save_dimensions(new_width, new_height)\n img = ::MiniMagick::Image.from_file(current_path)\n width, height = img['width'], img['height']\n \n resize_to_fill(new_width, new_height)\n \n w_ratio = width.to_f / new_width.to_f\n h_ratio = height.to_f / new_height.to_f\n \n ratio = [w_ratio, h_ratio].min\n \n model.send(\"#{mounted_as}_w=\", ratio * new_width)\n model.send(\"#{mounted_as}_h=\", ratio * new_height)\n model.send(\"#{mounted_as}_x=\", (width - model.send(\"#{mounted_as}_w\")) / 2)\n model.send(\"#{mounted_as}_y=\", (height - model.send(\"#{mounted_as}_h\")) / 2)\n end", "def resize\n check_page_element(params) do |page_element|\n page_element.\n update_attributes({ :x => params[:x], :y => params[:y], \n :width => params[:width], :height => params[:height],\n :z_index => params[:z_index]})\n end\n end", "def resize_to_fit(width, height)\n manipulate! do |img|\n img.resize \"#{width}x#{height}\"\n img = yield(img) if block_given?\n img\n end\n end", "def calc_resize(geometry) \n EasyImgUtils.calc_resize(info()[:geometry], geometry)\n end", "def after_resize(&block)\n write_inheritable_array(:after_resize, [block])\n end", "def resize_to_limit(new_width, new_height)\n width, height = FastImage.size(self.current_path)\n if width > new_width || height > new_height\n resize_to_fit(new_width, new_height)\n end\n end", "def resize_to_fit(width, height)\n manipulate! do |img|\n img.manipulate!(:resize => \"#{width}x#{height}\")\n img = yield(img) if block_given?\n img\n end\n end", "def resize(width, height, resize_method)\n cropping = (resize_method != :resize_scale)\n\n # Calculate aspect ratios\n source_ratio = size.width / size.height\n target_ratio = width / height\n\n # Determine what side of the source image to use for proportional scaling\n scale_width = (source_ratio <= target_ratio)\n\n # Proportionally scale source image\n scaled_width, scaled_height = nil, nil\n if cropping && scale_width\n scaling_factor = 1.0 / source_ratio\n scaled_width = width\n scaled_height = (width * scaling_factor).round\n else\n scaling_factor = source_ratio\n scaled_width = (height * scaling_factor).round\n scaled_height = height\n end\n scale_factor = scaled_height / size.height\n\n # Calculate compositing rectangles\n source_rect = nil\n if cropping\n dest_x, dest_y = nil, nil\n case resize_method\n when :resize_crop\n # Crop center\n dest_x = ((scaled_width - width) / 2.0).round\n dest_y = ((scaled_height - height) / 2.0).round\n when :resize_crop_start\n # Crop top or left (prefer top)\n if scale_width\n # Crop top\n dest_x = ((scaled_width - width) / 2.0).round\n dest_y = (scaled_height - height).round\n else\n # Crop left\n dest_x = 0.0\n dest_y = ((scaled_height - height) / 2.0).round\n end\n when :resize_crop_end\n # Crop bottom or right\n if scale_width\n # Crop bottom\n dest_x = 0.0\n dest_y = 0.0\n else\n # Crop right\n dest_x = (scaled_width - width).round\n dest_y = ((scaled_height - height) / 2.0).round\n end\n end\n source_rect = [dest_x / scale_factor, dest_y / scale_factor, width / scale_factor, height / scale_factor]\n else\n width = scaled_width\n height = scaled_height\n source_rect = [0, 0, size.width, size.height]\n end\n\n result = OSX::NSImage.alloc.initWithSize([width, height])\n result.lockFocus\n OSX::NSGraphicsContext.currentContext.setImageInterpolation(OSX::NSImageInterpolationHigh)\n drawInRect_fromRect_operation_fraction([0, 0, width, height], source_rect, OSX::NSCompositeSourceOver, 1.0)\n result.unlockFocus\n result\n end", "def set_size(params = {})\n @width = params[:width] if params[:width]\n @height = params[:height] if params[:height]\n @x_scale = params[:x_scale] if params[:x_scale]\n @y_scale = params[:y_scale] if params[:y_scale]\n @x_offset = params[:x_offset] if params[:x_offset]\n @y_offset = params[:y_offset] if params[:y_offset]\n end", "def setSize(szX,szY,scale,centerp=FALSE)\n @device.setSize(szX,szY,scale,centerp) ;\n end", "def show\n respond_to do |format|\n format.jpeg { send_data @recipe_image.resize }\n end\n end", "def video_resize_video_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VideoApi.video_resize_video ...'\n end\n # resource path\n local_var_path = '/video/resize/preserveAspectRatio'\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 header_params[:'fileUrl'] = opts[:'file_url'] if !opts[:'file_url'].nil?\n header_params[:'maxWidth'] = opts[:'max_width'] if !opts[:'max_width'].nil?\n header_params[:'maxHeight'] = opts[:'max_height'] if !opts[:'max_height'].nil?\n header_params[:'frameRate'] = opts[:'frame_rate'] if !opts[:'frame_rate'].nil?\n header_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?\n header_params[:'extension'] = opts[:'extension'] if !opts[:'extension'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?\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: VideoApi#video_resize_video\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def resize_image(download_path, resize_path, height, width, crop)\n `convert #{download_path.inspect} -resize \"#{height}x#{width}\" #{resize_path.inspect}`\n end", "def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n\n case @flag\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n when :aspect\n new_width = @width unless @width.nil?\n new_height = @height unless @height.nil?\n end\n\n [new_width, new_height].collect! { |v| v.round }\n end", "def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n\n case @flag\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n when :aspect\n new_width = @width unless @width.nil?\n new_height = @height unless @height.nil?\n end\n\n [new_width, new_height].collect! { |v| v.round }\n end", "def resize\n\t\t@image = Qt::Image.new @parent.width/2, @parent.width/2, 7\n\t\t@image.fill Qt::Color.new \"#ffffff\"\n\tend", "def update_size(width, height) \n if @vertical\n @height += height\n @width = width if width > @width\n else\n @width += width\n @height = height if height > @height\n end\n end", "def resize_resize_simple(width, height, image_file, opts = {})\n data, _status_code, _headers = resize_resize_simple_with_http_info(width, height, image_file, opts)\n data\n end", "def resize_image(img_path)\n img = MiniMagick::Image.open(img_path)\n print_status(\"Original #{img_path} dimension = #{img.height}x#{img.width}\")\n new_width = img.width - (img.width * REIZEPERT).to_i\n new_height = img.height - (img.height * REIZEPERT).to_i\n img = img.resize(\"#{new_width}x#{new_height}\")\n print_status(\"Resized #{img_path} dimension = #{img.height}x#{img.width}\")\n img.write(img_path)\nend", "def create_resized_image\n create_image do |xfrm|\n if size\n MiniMagick::Tool::Convert.new do |cmd|\n cmd << xfrm.path # input\n cmd.flatten\n cmd.resize(size)\n cmd << xfrm.path # output\n end\n end\n end\n end", "def on_resize(&bl)\n @on_resize = bl\n end", "def confirm_resize!\n # If the resize bug gets figured out, should put a check here to make sure that it's in the proper state for this.\n data = JSON.generate(:confirmResize => nil)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n self.populate\n true\n end", "def resize_and_optimize(width, height)\n manipulate! do |img|\n img.format(\"jpg\") do |c|\n c.quality \"70\"\n c.resize \"#{width}x#{height}\"\n end\n\n img\n end\n end", "def interpret_size(size); end", "def resize_volume request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_resize_volume_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def resize!(flavorRef)\n data = JSON.generate(:resize => {:flavorRef => flavorRef})\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n self.populate\n true\n end", "def resize_to_fit(new_width, new_height)\n manipulate! do |image|\n resize_image(image,new_width,new_height)\n end\n end", "def resize_to_fit(new_width, new_height)\n manipulate! do |image|\n resize_image(image,new_width,new_height)\n end\n end", "def resize_to_limit(new_width, new_height)\n manipulate! do |image|\n image = resize_image(image,new_width,new_height) if new_width < image.width || new_height < image.height\n image\n end\n end", "def resize!\n @arr.size *=2\n end", "def resize(path, image, size)\n Rails.logger.warn \"resize method\"\n return false if size.split('x').count!=2\n Rails.logger.warn \"before File.exists? check: #{size.split('x').count}\"\n return false if !File.exists?(File.join(path))\n\n Rails.logger.warn \"before mkdir: #{path}/#{id}\"\n FileUtils.mkdir_p \"#{path}/thumbnails/#{id}\" if !File.exists?(File.join(path, 'thumbnails', id.to_s))\n\n image_original_path = \"#{path}/#{image}\"\n image_resized_path = \"#{path}/thumbnails/#{id}/#{size}_#{image}\"\n\n width = size.split('x')[0]\n height = size.split('x')[1]\n\n Rails.logger.warn \"Magick::Image.read(#{image_original_path})\"\n begin\n i = Magick::Image.read(image_original_path).first\n Rails.logger.warn \"before i.resize_to_fit\"\n i.resize_to_fit(width.to_i,height.to_i).write(image_resized_path)\n rescue Exception => e\n Rails.logger.error e\n end\n\n true\n end", "def create_resized_image\n create_image do |xfrm|\n if size\n xfrm.flatten\n xfrm.resize(size)\n end\n end\n end", "def set_dimensions\n\t\timg = Magick::Image::read(\"#{Rails.root}/public\"+image_url(:image).to_s).first\n\t\tself.width = img.columns\n\t\tself.height = img.rows\n\t\tself.size \t= img.filesize\n\t\tif self.v.nil? then self.v = 0 end\n\t\tself.url \t= img.filename\n\tend", "def strict_resize image, w, h\n image.resize \"#{ w }x#{ h }!\"\n image\n end", "def resize_type(type, to_size)\n resize(type => to_size)\n end", "def test_method_size\n width, height = (1..100).to_a.sample( 2 )\n base_image = Magick::Image.new( width, height )\n image_adapter = Image::AdapterMagickImage.new( base_image )\n \n # maps width/height to size( :x ) / size ( :y )\n assert_equal width, image_adapter.size( :x )\n assert_equal height, image_adapter.size( :y )\n end", "def processed_image\n if params[:upsample] == 'true'\n resize_string = @size.to_s\n else\n resize_string = \"#{@size}>\"\n end\n image_file = @picture.image_file\n if image_file.nil?\n raise MissingImageFileError, \"Missing image file for #{@picture.inspect}\"\n end\n if params[:crop_size].present? && params[:crop_from].present?\n crop_from = params[:crop_from].split('x')\n image_file = image_file.process(:thumb, \"#{params[:crop_size]}+#{crop_from[0]}+#{crop_from[1]}\")\n image_file.process(:resize, resize_string)\n elsif params[:crop] == 'crop' && @size.present?\n width, height = @size.split('x').collect(&:to_i)\n # prevent upscaling unless :upsample param is true\n # unfurtunally dragonfly does not handle this correctly while cropping\n unless params[:upsample] == 'true'\n if width > image_file.width\n width = image_file.width\n end\n if height > image_file.height\n height = image_file.height\n end\n end\n image_file.process(:resize_and_crop, :width => width, :height => height, :gravity => 'c')\n elsif @size.present?\n image_file.process(:resize, resize_string)\n else\n image_file\n end\n end", "def resize(count)\n @client.call('queue.resize', @name, count)\n end", "def resize(min, max = T.unsafe(nil)); end", "def set_dimensions!\n if RMAGICK_SUPPORTED\n #MES- Turn the blob into an ImageMagick object\n img = Magick::Image.from_blob(data).first\n if img.nil?\n raise \"Error: could not get imagemagick image from picture #{self.id}'s data\"\n end\n \n #KS- grab width & height and save them\n self.height = img.rows\n self.width = img.columns\n end\n end", "def calcImgSizes(res, file, maxheight, maxwidth, grid)\n myres = res.to_f\n myheight = `identify -format \"%h\" \"#{file}\"`\n myheight = myheight.to_f\n myheightininches = (myheight / myres)\n mywidth = `identify -format \"%w\" \"#{file}\"`\n mywidth = mywidth.to_f\n mywidthininches = (mywidth / myres)\n # if current height or width exceeds max, resize to max, proportionately\n if mywidthininches > maxwidth or myheightininches > maxheight then\n targetheight = maxheight * myres\n targetwidth = maxwidth * myres\n `convert \"#{file}\" -density #{myres} -resize \"#{targetwidth}x#{targetheight}>\" -quality 100 \"#{file}\"`\n end\n myheight = `identify -format \"%h\" \"#{file}\"`\n myheight = myheight.to_f\n myheightininches = (myheight / myres)\n mymultiple = ((myheight / myres) * 72.0) / grid\n if mymultiple <= 1\n resizecmd = \"\"\n else\n newheight = ((mymultiple.floor * grid) / 72.0) * myres\n resizecmd = \"-resize \\\"x#{newheight}\\\" \"\n end\n return resizecmd\nrescue => e\n return \"error method calcImgSize: #{e}\"\nend", "def resize new_width, new_height\n win.resize new_width, new_height\n end", "def resize_to_limit!(image, width, height)\n with_minimagick(image) do |img|\n img.combine_options do |cmd|\n yield cmd if block_given?\n cmd.resize \"#{width}x#{height}>\"\n end\n end\n end", "def resize_image(content, content_type, size)\n filename = \"/tmp/\" + (1 + rand(10000000)).to_s + \".\" + content_type\n filename_resized = \"/tmp/\" + (1 + rand(10000000)).to_s + \"_resized.\" + content_type\n File.open(filename, 'w') do |f|\n f.write( content)\n end\n result = %x[sips --resampleWidth #{size} #{filename} --out #{filename_resized}]\n content_resized = IO.readlines(filename_resized,'r').to_s\n return content_resized\nend", "def resize(*args)\n with_command %(-resize \"#{Geometry.new(*args)}\")\n end" ]
[ "0.7590879", "0.7240322", "0.7187216", "0.71148086", "0.7111367", "0.69803596", "0.69200355", "0.6864851", "0.68391937", "0.67687315", "0.676854", "0.6744202", "0.6657108", "0.6625247", "0.6620215", "0.65799457", "0.6576061", "0.65647846", "0.648442", "0.64669526", "0.6464831", "0.6462727", "0.64542514", "0.63855326", "0.636079", "0.62912667", "0.62542605", "0.62335205", "0.6210721", "0.6208779", "0.61887", "0.61804324", "0.61698955", "0.6165919", "0.6149919", "0.6128915", "0.6116192", "0.6102645", "0.6097359", "0.6060334", "0.60601825", "0.60549724", "0.60530156", "0.60430664", "0.6027048", "0.6026172", "0.6022225", "0.59806126", "0.59693384", "0.59629524", "0.59534085", "0.59440887", "0.59418875", "0.5939725", "0.5919645", "0.5915936", "0.5897375", "0.5897285", "0.5889239", "0.5883774", "0.58735996", "0.5872596", "0.5862812", "0.58593243", "0.58591944", "0.5856555", "0.58428425", "0.5834782", "0.5834283", "0.5834283", "0.5833692", "0.58256763", "0.58214563", "0.5821364", "0.58182776", "0.58079714", "0.5802731", "0.57927054", "0.5789373", "0.57892466", "0.57778376", "0.5770692", "0.5770692", "0.57666194", "0.576079", "0.57563007", "0.5752676", "0.5750682", "0.57498896", "0.5749189", "0.57420975", "0.57374525", "0.5728191", "0.5723517", "0.57225996", "0.57208425", "0.57147855", "0.5713065", "0.5706457", "0.5704116" ]
0.6321908
25
Baseline implementation for the set_instance_template REST call
def set_instance_template request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_instance_template_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_template\n end", "def set_instance_template_properties# {{{\n\t # if we got here, it means some of parameters changed\n\t # it does not matter which one - we just need to create another template\n\t # and generate refresh event (automatically)\n\t #\n\t #\tXXX may be we should have ensure property and skip this step when\n\t #\tit is set to :absent\n#\tbyebug\n\t create\n\treturn\n end", "def create_template\n self.template = \"template 14231\"\n end", "def set_template\n @template = ::Template.find(params[:id])\n end", "def set_template\n @template = Spree::Template.find(params[:id])\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # put\n end", "def set_script_template\n @script_template = ScriptTemplate.find(params[:id])\n end", "def template(set_template)\n @template = set_template\n end", "def initialize(instance, tpl, opts = {})\n @template = tpl\n @resource = instance\n @options = opts\n self\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_request_template\n @request_template = RequestTemplate.find(params[:id])\n end", "def set_template\n Settings.reload!\n @template = Template.find(params[:id])\n end", "def template\n @template ||= Ec2.template({:name =>@name, :key_name => @key_name, :image_id => @image_id, :instance_type => @instance_type, :security_groups => @security_groups})\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = PrintTemplate.find(params[:id])\n end", "def set_image_template\n @image_template = ImageTemplate.find(params[:id])\n end", "def set_template\n tid = Integer(params[:id]) rescue nil\n if tid\n @template = Template.find_by_id(tid)\n else\n @template = Template.find_by_name(params[:id])\n end\n respond_err \"template\", @templates, \"i18> Template #{params[:id]} not found\" unless @template\n end", "def set_my_template\n @my_template = MyTemplate.find(params[:id])\n end", "def set_etemplate\n @template = Etemplate.find(params[:id])\n end", "def template(value)\n @template = value\n end", "def set_template\n @template = Template.find(params[:id])\n\n rescue ActiveRecord::RecordNotFound\n head 404\n end", "def initialize (template); @template = template; end", "def set_service_template\n @service_template = policy_scope(ServiceTemplate).find(params[:id])\n end", "def set_attr_template\n @attr_template = AttrTemplate.find(params[:id])\n end", "def with_template(template)\n @template = template\n self\n end", "def set_template\n @template = EmailTemplate.find(params[:id])\n end", "def virtual_guest_template\n template = {\n \"startCpus\" => @cores.to_i,\n \"maxMemory\" => @memory.to_i * 1024, # we let the user specify memory in GB, but the API expects maxMemory in MB.\n \"hostname\" => @hostname,\n \"domain\" => @domain,\n\n # Note : for the values below, we want to use the constants \"true\" and \"false\" not nil\n # the nil value (while false to Ruby) will not translate to XML properly\n \"localDiskFlag\" => !!@use_local_disk,\n \"hourlyBillingFlag\" => !!@hourly\n }\n\n template['dedicatedAccountHostOnlyFlag'] = true if @dedicated_host_only\n template['privateNetworkOnlyFlag'] = true if @private_network_only\n\n template['datacenter'] = {\"name\" => @datacenter.name} if @datacenter\n template['userData'] = [{'value' => @user_metadata}] if @user_metadata\n template['networkComponents'] = [{'maxSpeed'=> @max_port_speed}] if @max_port_speed\n template['postInstallScriptUri'] = @provision_script_URI.to_s if @provision_script_URI\n template['postInstallScriptUri'] = @provision_script_uri.to_s if @provision_script_uri\n template['primaryNetworkComponent'] = { \"networkVlan\" => { \"id\" => @public_vlan_id.to_i } } if @public_vlan_id\n template['primaryBackendNetworkComponent'] = { \"networkVlan\" => {\"id\" => @private_vlan_id.to_i } } if @private_vlan_id\n template['sshKeys'] = @ssh_key_ids.collect { |ssh_key_id| {'id'=> ssh_key_id.to_i } } if @ssh_key_ids\n template['supplementalCreateObjectOptions'] = @supplementalCreateObjectOptions if @supplementalCreateObjectOptions\n\n if @image_template\n template['blockDeviceTemplateGroup'] = {\"globalIdentifier\" => @image_template.global_id}\n elsif @os_reference_code\n template['operatingSystemReferenceCode'] = @os_reference_code\n end\n\n if @disks && !@disks.empty?\n template['blockDevices'] = []\n\n # According to the documentation for +createObject+,\n # device number 1 is reserved for the SWAP disk of the computing instance.\n # So we assign device 0 and then assign the rest starting at index 2.\n @disks.each_with_index do |disk, index|\n device_id = (index >= 1) ? index + 1 : index\n template['blockDevices'].push({\"device\" => \"#{device_id}\", \"diskImage\" => {\"capacity\" => disk}})\n end\n end\n\n template\n end", "def save_template(instance_id, tmpl_name)\n resp = create_image(instance_id, tmpl_name)\n if resp.status == 200\n resp.body['image']['id']\n else\n # TODO raise specific exc\n raise \"Failed to save vm #{instance_id} as template\"\n end\n end", "def use_template(template)\n @template = template\n end", "def use_template(template)\n @template = template\n end", "def template=( tmpl )\n\t\t\t@signature[:templates][@action_name] = tmpl\n\t\tend", "def set_form_template\n @form_template = FormTemplate.find(params[:id])\n end", "def set_template_parameter\n @template_parameter = TemplateParameter.find(params[:id])\n end", "def set_page_template\n @page_template = ::PageTemplate.find(params[:id])\n end", "def template=(v)\n Axlsx.validate_string v\n @template = v\n end", "def set_timetable_template\n @timetable_template = TimetableTemplate.find(params[:id])\n end", "def initialize_template(record)\n\n end", "def set_call_template\n @call_template = CallTemplate.find(params[:id])\n end", "def _template\n @template\n end", "def assign_virtual_machine_template\n if params[:virtual_machine_template_id]\n vmt = Atmosphere::VirtualMachineTemplate.find params[:virtual_machine_template_id]\n @appliance_type.virtual_machine_templates << vmt if vmt\n redirect_to [:admin, @appliance_type], notice: 'Appliance Type was successfully updated.'\n else\n render action: 'edit'\n end\n end", "def set_post_template\n @post_template = PostTemplate.find(params[:id])\n end", "def set_item_template\n @item_template = ItemTemplate.find(params[:id])\n end", "def get_template(template); end", "def set_template_field\n @template_field = TemplateField.find(params[:id])\n end", "def set_item_template\n @item_template = ItemTemplate.find(params[:id])\n end", "def set_product_template\n @product_template = ProductTemplate.find(params[:id])\n end", "def store_resource_template\n add_pod_disruption_budget\n counter = Hash.new(-1)\n self.resource_template = raw_template.map do |resource|\n index = (counter[resource.fetch(:kind)] += 1)\n TemplateFiller.new(self, resource, index: index).to_hash\n end\n end", "def set_template_datum\n @template_datum = TemplateDatum.find(params[:id])\n end", "def set_doc_template\n @doc_template = DocTemplate.find(params[:id])\n end", "def templateId=(value)\n\t\t\t@templateId = value\n\t\tend", "def server_create(server_name, template)\n # calculate instance id\n Puppet.debug \"template keys => \" + JSON.pretty_generate(template)\n\n server_id, server_host = ::Pinas::Common.extract_instance_id_from(server_name)\n\n # 1. setup the default options\n options = {\n :name => server_name,\n :flavor_ref => get_flavor(template[:flavor_name]), # For Openstack provider\n :image_ref => get_image(template[:image_name]), # For Openstack provider\n :flavor_id => get_flavor(template[:flavor_name]), # For HPCloud provider\n :image_id => get_image(template[:image_name]), # For HPCloud provider\n :key_name => template[:key_name],\n :security_groups => template[:security_groups],\n }\n Puppet.debug \"setup default options = >\" + JSON.pretty_generate(options)\n # 2. setup the meta data/user data for the server, for boot hooks\n begin\n options[:metadata] = meta_to_hash(ERB.new(template[:meta_data]).result(binding)) if template.has_key?(:meta_data)\n rescue Exception => e\n Puppet.crit \"servers.create in running erb for :metadata, Error: #{e}\"\n raise Puppet::Error, \"Error : #{e}\"\n end\n begin\n options[:user_data] = ERB.new(File.read(template[:user_data])).result(binding) if template.has_key?(:user_data)\n rescue Exception => e\n Puppet.crit \"servers.create in running erb for :user_data, Error: #{e}\"\n raise Puppet::Error, \"Error : #{e}\"\n end\n Puppet.debug \"added metadata and user_data\"\n Puppet.debug \"has network_name key ? #{template.has_key?(:network_name)}\"\n Puppet.debug \"network class => #{network.class}\"\n Puppet.debug \"template[:network_name] => #{template[:network_name]}\"\n Puppet.debug \"template[:network_name] => #{template['network_name']}\"\n # 3. get the network uuid and name\n if @network != nil and template.has_key?(:network_name) and template[:network_name] != ''\n Puppet.debug \"adding network #{template[:network_name]}\"\n networks = Array.new\n nics = Array.new\n nics << get_networkid(template[:network_name])\n # nics << template[:network_name]\n Puppet.debug \"working on nics => #{nics}.\"\n begin\n nics.each do |net|\n Puppet.debug \"working on net => #{net}\"\n network = find_match(@network.networks, net)\n networks.push('net_id' => network.id) if network\n end\n options[:nics] = networks\n rescue Exception => e\n raise Puppet::Error, \"Problem assigning nics, #{e}\"\n end\n Puppet.debug \"after options, got = >\" + JSON.pretty_generate(options)\n end\n # 4. create new server and wait for it to be ready.\n # TODO: implement retryable and wait for code. need to confirm we have a timeout in fog.\n # server = @compute.servers.create(options)\n # retryable(on: Timeout::Error, tries: 200) do\n # begin\n # server.wait_for(30) { ready? }\n # rescue RuntimeError, Fog::Errors::TimeoutError => e\n # end\n # end\n Puppet.debug \"attempting to create server #{server_name}\"\n new_server = nil\n begin\n new_server = @compute.servers.create(options)\n new_server.wait_for { ready?}\n new_server.wait_for { !addresses.nil? }\n rescue Exception => e\n Puppet.crit \"servers.create Error: #{e}\"\n raise Puppet::Error, \"Error : #{e}\"\n end\n\n Puppet.notice \"server created #{server_name} on net #{template[:network_name]} \"\n begin\n newserver_ip_assign(new_server)\n rescue Exception => e\n Puppet.crit \"server_ip_assign Error: #{e}\"\n raise Puppet::Error, \"Error : #{e}\"\n end\n\n end", "def initialize(template)\n @template = template\n end", "def set_induction_template\n @induction_template = InductionTemplate.find(params[:id])\n end", "def template\n @template ||= self.class.template\n end", "def initialize template, client, all: false\n super template, client\n @all = all\n end", "def initialize template, client, all: false\n super template, client\n @all = all\n end", "def set_configuration_template\n @configuration_template = ConfigurationTemplate.find(params[:id])\n end", "def initialize(type,template,version)\n self.type = type\n self.template = template\n self.version = version\n end", "def put_instance(opts)\n opts = check_params(opts,[:instances])\n super(opts)\n end", "def template(value = nil)\n if value\n @template = value\n options[:template] = @template\n end\n @template ||= nil\n end", "def template_parameters=(value)\n @template_parameters = value\n end", "def set_cf_template\n @cf_template = CfTemplate.find(params.require(:id))\n end", "def set_content_template\n @content_template = ContentTemplate.find(params[:id])\n end", "def template_id=(value)\n @template_id = value\n end", "def template_id=(value)\n @template_id = value\n end", "def set_inspection_template\n @inspection_template = InspectionTemplate.find(params[:id])\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 set_template\n begin\n @template = Template.find(params[:id])\n rescue Exception => e\n Services::Slog.exception e\n flash[:notice] = \"Sorry, <i class=\\\"icon-shuffle\\\"></i> couldn't find the template identified by <em>#{params[:id]}</em>.\"\n redirect_to :controller => \"templates\", :action => \"index\"\n end\n end", "def set_review_template\n @review_template = ReviewTemplate.find(params[:id])\n end", "def template\n @template ||= Template.new name: script_name, out_file: root_ruby_file, type: type\n end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def set_user_template(opts)\n opts = check_params(opts,[:templates])\n super(opts)\n end", "def set_event_template\n @event_template = EventTemplate.find(params[:id])\n end", "def load\n template_data = response_data['template']\n\n @data = response_data['data']\n @template = Template.new(\n template_data['src'], template_data['type'], template_data['key']\n )\n\n super\n end", "def template\n\t\t\t@signature[:templates][@action_name]\n\t\tend", "def template=(v) Axlsx.validate_string v; @template = v; end", "def initialize(testing_template = TestingTemplate.new)\n @testing_template = testing_template\n end", "def template\n @template\n end", "def set_survey_template\n @survey_template = SurveyTemplate.find(params[:survey_template_id])\n end", "def initialize(client, params = {}, api_ver = nil)\n super\n # Default values:\n @data['provisioning'] ||= {}\n @data['type'] ||= 'StorageVolumeTemplateV3'\n end", "def set_template_photo\n @template_photo = TemplatePhoto.find(params[:id])\n end", "def template(template_name)\n @attributes.store(template_name)\n end", "def set_instance\n @instance = @workflow.instances.find(params[:instance_id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end" ]
[ "0.7187446", "0.66969496", "0.6479128", "0.6347294", "0.6330435", "0.6271301", "0.62692606", "0.6266801", "0.6229911", "0.6229911", "0.6229911", "0.6229911", "0.6229911", "0.6229911", "0.6229911", "0.6229911", "0.622791", "0.6210036", "0.61730504", "0.61678326", "0.6100469", "0.6097766", "0.60884476", "0.60776514", "0.6071769", "0.6005869", "0.6002524", "0.5997863", "0.5966914", "0.59486526", "0.5937811", "0.5934325", "0.5924565", "0.5898625", "0.5873879", "0.5871128", "0.58478075", "0.581943", "0.57999766", "0.5798547", "0.57938236", "0.57806355", "0.57726794", "0.5767207", "0.5765339", "0.57429624", "0.57421565", "0.5741193", "0.57200634", "0.5696516", "0.56702983", "0.56666815", "0.5665621", "0.5661438", "0.5648931", "0.5639283", "0.56199586", "0.5618876", "0.56107384", "0.5607442", "0.55940706", "0.55940706", "0.5566369", "0.55553967", "0.5553134", "0.555176", "0.5529282", "0.55257154", "0.551935", "0.55124056", "0.55124056", "0.5507141", "0.5504322", "0.5494823", "0.548584", "0.54851604", "0.54850054", "0.54850054", "0.54850054", "0.54850054", "0.54850054", "0.54850054", "0.54850054", "0.5467083", "0.54559404", "0.54481214", "0.54448104", "0.5442912", "0.5434562", "0.54303795", "0.54287744", "0.5425288", "0.54227304", "0.5415731", "0.5414116", "0.5408114", "0.5408114", "0.5408114", "0.5408114", "0.5408114" ]
0.77391225
0
Baseline implementation for the set_target_pools REST call
def set_target_pools request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_target_pools_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pools\n @pools ||= {}\n end", "def pools\n @pools ||= {}\n end", "def get_pool_names\n JSON.parse(get(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/pools\"))['tenantpools']['pools']\n end", "def list_pools\n handle_action_exceptions(__method__) do\n cmd_line = ['listpools']\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def set_pools(pool_types = PoolType.only_for_meetings)\n @pool_types = pool_types\n end", "def list_server_pools_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PoolApi.list_server_pools ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PoolApi.list_server_pools\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling PoolApi.list_server_pools\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/pool'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<PoolResponse>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"PoolApi.list_server_pools\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PoolApi#list_server_pools\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize_pools(secret, opts = {}, options = {})\n client = OpenNebula::Client.new(secret, opts[:endpoint], options)\n\n @vm_pool = OpenNebula::VirtualMachinePool.new(client)\n @vm_pool_ary = nil\n\n @image_pool = OpenNebula::ImagePool.new(client)\n @canonical_image_pool = nil\n\n @user_pool = OpenNebula::UserPool.new(client)\n @canonical_user_pool = nil\n end", "def pool=(pool)\n @vserver_hash.properties.basic.pool=pool\n end", "def set_pool\n @pool = Pool.find(params[:id])\n end", "def set_pool\n @pool = Pool.find(params[:id])\n end", "def set_pool\n @pool = Pool.find(params[:id])\n end", "def patch_resourcepool_pool_with_http_info(moid, resourcepool_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcepoolApi.patch_resourcepool_pool ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ResourcepoolApi.patch_resourcepool_pool\"\n end\n # verify the required parameter 'resourcepool_pool' is set\n if @api_client.config.client_side_validation && resourcepool_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'resourcepool_pool' when calling ResourcepoolApi.patch_resourcepool_pool\"\n end\n # resource path\n local_var_path = '/api/v1/resourcepool/Pools/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(resourcepool_pool)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourcepoolPool'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourcepoolApi.patch_resourcepool_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcepoolApi#patch_resourcepool_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_list_pools\n get '/pools'\n assert last_response.ok?\n end", "def create_resourcepool_pool_with_http_info(resourcepool_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcepoolApi.create_resourcepool_pool ...'\n end\n # verify the required parameter 'resourcepool_pool' is set\n if @api_client.config.client_side_validation && resourcepool_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'resourcepool_pool' when calling ResourcepoolApi.create_resourcepool_pool\"\n end\n # resource path\n local_var_path = '/api/v1/resourcepool/Pools'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(resourcepool_pool)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourcepoolPool'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourcepoolApi.create_resourcepool_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcepoolApi#create_resourcepool_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_pool\n @pool = Pool.find(params[:id])\n authorize @pool\n end", "def pool_options(options); end", "def index_pools_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PoolsApi.index_pools ...'\n end\n # resource path\n local_var_path = '/pools'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'content'] = opts[:'content'] if !opts[:'content'].nil?\n query_params[:'primary_id'] = opts[:'primary_id'] if !opts[:'primary_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'PoolCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PoolsApi#index_pools\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_resourcepool_pool_with_http_info(moid, resourcepool_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcepoolApi.update_resourcepool_pool ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ResourcepoolApi.update_resourcepool_pool\"\n end\n # verify the required parameter 'resourcepool_pool' is set\n if @api_client.config.client_side_validation && resourcepool_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'resourcepool_pool' when calling ResourcepoolApi.update_resourcepool_pool\"\n end\n # resource path\n local_var_path = '/api/v1/resourcepool/Pools/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(resourcepool_pool)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourcepoolPool'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourcepoolApi.update_resourcepool_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcepoolApi#update_resourcepool_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_last_hop_pool(opts)\n opts = check_params(opts,[:last_hop_pools])\n super(opts)\n end", "def pool\n @pool\n end", "def pool\n @pool=@vserver_hash.properties.basic.pool\n end", "def pool \n @pool\n end", "def pool; end", "def pool; end", "def create_pools\n @old_store = store.dup\n pools.map do |key, value|\n # convert the requests to vm names\n pools[key]['requests'] = value['requests'].find_all do |req|\n puts \"Checking request: #{req}\"\n r = req_obj(req)\n if r.completed?\n puts \"The request #{req} has completed, getting hostname\"\n hostnames = resolve_vm_name(r)\n # remove request from pool file by not returning anything\n # if hostname does not exist but request completed don't update pool\n if ! hostnames\n puts \"Provisioning seemed to have failed for #{req}\"\n puts \"Removing request #{req} from pool #{key}\"\n false\n else\n pools[key]['pool_instances'] = value['pool_instances'] + hostnames\n false\n end\n else \n # has not completed\n # keep the request, since it is not finished\n puts \"The request #{req} is still running\"\n req\n end\n end\n\n # return the alive instances and save to the pool\n pools[key]['pool_instances'] = pools[key]['pool_instances'].find_all {|h| is_alive?(h) }\n\n # delete any old instances from used pool\n pools[key]['used_instances'] = pools[key]['used_instances'].find_all {|h| is_alive?(h) }\n\n # create the pool, and save the request in the requests\n # do not create if the number of systems and requests are more than the requested amount\n current_total = value['pool_instances'].count + pools[key]['requests'].count\n unless current_total >= value['size']\n reqs = create_pool(value)\n pools[key]['requests'] = reqs\n end\n end\n # prevents updates from occuring when they are not required\n store.save if store_changed?(@old_store, store)\nend", "def list_ip_address_pools_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pools ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pools, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pools, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/ip-pools'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IpAddressPoolListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#list_ip_address_pools\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_resourcepool_pool_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcepoolApi.get_resourcepool_pool_by_moid ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ResourcepoolApi.get_resourcepool_pool_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/resourcepool/Pools/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourcepoolPool'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourcepoolApi.get_resourcepool_pool_by_moid\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcepoolApi#get_resourcepool_pool_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def provided_pools\n @config[:pools].select { |pool| pool['dns_config'] == name }.map { |pool| pool['name'] }\n end", "def execute_pool\n raise NotImplementedError\n end", "def list_pools(params = {})\n path = \"/pools?\"\n path << \"consumer=#{params[:consumer]}&\" if params[:consumer]\n path << \"owner=#{params[:owner]}&\" if params[:owner]\n path << \"product=#{params[:product]}&\" if params[:product]\n path << \"listall=#{params[:listall]}&\" if params[:listall]\n path << \"activeon=#{params[:activeon]}&\" if params[:activeon]\n results = get(path)\n\n return results\n end", "def create_server_pool_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PoolApi.create_server_pool ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PoolApi.create_server_pool\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling PoolApi.create_server_pool\"\n end\n allowable_values = [0, 1]\n if @api_client.config.client_side_validation && opts[:'use_tls'] && !allowable_values.include?(opts[:'use_tls'])\n fail ArgumentError, \"invalid value for \\\"use_tls\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"random\", \"hash\", \"client\"]\n if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'quorum'].nil? && opts[:'quorum'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"quorum\"]\" when calling PoolApi.create_server_pool, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'quorum'].nil? && opts[:'quorum'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"quorum\"]\" when calling PoolApi.create_server_pool, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/pool'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_cert_hostname'] = opts[:'tls_cert_hostname'] if !opts[:'tls_cert_hostname'].nil?\n form_params['use_tls'] = opts[:'use_tls'] if !opts[:'use_tls'].nil?\n form_params['created_at'] = opts[:'created_at'] if !opts[:'created_at'].nil?\n form_params['deleted_at'] = opts[:'deleted_at'] if !opts[:'deleted_at'].nil?\n form_params['updated_at'] = opts[:'updated_at'] if !opts[:'updated_at'].nil?\n form_params['service_id'] = opts[:'service_id'] if !opts[:'service_id'].nil?\n form_params['version'] = opts[:'version'] if !opts[:'version'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['shield'] = opts[:'shield'] if !opts[:'shield'].nil?\n form_params['request_condition'] = opts[:'request_condition'] if !opts[:'request_condition'].nil?\n form_params['tls_ciphers'] = opts[:'tls_ciphers'] if !opts[:'tls_ciphers'].nil?\n form_params['tls_sni_hostname'] = opts[:'tls_sni_hostname'] if !opts[:'tls_sni_hostname'].nil?\n form_params['min_tls_version'] = opts[:'min_tls_version'] if !opts[:'min_tls_version'].nil?\n form_params['max_tls_version'] = opts[:'max_tls_version'] if !opts[:'max_tls_version'].nil?\n form_params['healthcheck'] = opts[:'healthcheck'] if !opts[:'healthcheck'].nil?\n form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['type'] = opts[:'type'] if !opts[:'type'].nil?\n form_params['override_host'] = opts[:'override_host'] if !opts[:'override_host'].nil?\n form_params['between_bytes_timeout'] = opts[:'between_bytes_timeout'] if !opts[:'between_bytes_timeout'].nil?\n form_params['connect_timeout'] = opts[:'connect_timeout'] if !opts[:'connect_timeout'].nil?\n form_params['first_byte_timeout'] = opts[:'first_byte_timeout'] if !opts[:'first_byte_timeout'].nil?\n form_params['max_conn_default'] = opts[:'max_conn_default'] if !opts[:'max_conn_default'].nil?\n form_params['quorum'] = opts[:'quorum'] if !opts[:'quorum'].nil?\n form_params['tls_check_cert'] = opts[:'tls_check_cert'] if !opts[:'tls_check_cert'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'PoolResponsePost'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"PoolApi.create_server_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PoolApi#create_server_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def scale_to(pool_name, target_num_servers)\n current_server_count = current_pool_size(pool_name)\n if target_num_servers > current_server_count\n remove_servers(pool(pool_name)[target_num_servers..-1])\n else\n add_additional_servers(pool_name, target_num_servers - current_server_count)\n end\n end", "def create_macpool_pool_with_http_info(macpool_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MacpoolApi.create_macpool_pool ...'\n end\n # verify the required parameter 'macpool_pool' is set\n if @api_client.config.client_side_validation && macpool_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'macpool_pool' when calling MacpoolApi.create_macpool_pool\"\n end\n # resource path\n local_var_path = '/api/v1/macpool/Pools'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(macpool_pool)\n\n # return_type\n return_type = opts[:debug_return_type] || 'MacpoolPool'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"MacpoolApi.create_macpool_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MacpoolApi#create_macpool_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_snat_pool(opts)\n opts = check_params(opts,[:snatpools])\n super(opts)\n end", "def add_pool_members pool_names, member_lists\n response = post(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/pools\",\n {\n :pool =>\n (pool_names.zip member_lists).map do |pool_name, members| {\n :services => members.map do |address,port| {\n :ip => address,\n :enabled => 'true',\n :name => address + ':' + port.to_s,\n :weight => \"10\",\n :port => port\n } end,\n :name => pool_name\n } end\n }.to_json)\n raise LBModelException.new \"Expected HTTP 202 but got #{response.code} instead\" unless response.code == 202\n\n parse_jobids response\n end", "def create_pool_with_http_info(pool_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PoolsApi.create_pool ...'\n end\n # verify the required parameter 'pool_body' is set\n if @api_client.config.client_side_validation && pool_body.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_body' when calling PoolsApi.create_pool\"\n end\n # resource path\n local_var_path = '/pools'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(pool_body) \n\n # return_type\n return_type = opts[:return_type] || 'Pool' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PoolsApi#create_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ceph_chef_pool_set(pool)\n if !node['ceph']['pools'][pool]['federated_names'].empty? && node['ceph']['pools'][pool]['federated_enable']\n node_loop = node['ceph']['pools'][pool]['federated_names']\n node_loop.each do |name|\n # if node['ceph']['pools'][pool]['settings']['type'] == 'replicated'\n next unless name['type'] == 'replicated'\n val = if node['ceph']['pools'][pool]['settings']['size']\n node['ceph']['pools'][pool]['settings']['size']\n else\n node['ceph']['osd']['size']['max']\n end\n\n ceph_chef_pool name do\n action :set\n key 'size'\n value val\n only_if \"ceph osd pool #{name} size | grep #{val}\"\n end\n end\n else\n node_loop = node['ceph']['pools'][pool]['pools']\n node_loop.each do |pool_val|\n # if node['ceph']['pools'][pool]['settings']['type'] == 'replicated'\n next unless pool_val['type'] == 'replicated'\n val = if node['ceph']['pools'][pool]['settings']['size']\n node['ceph']['pools'][pool]['settings']['size']\n else\n node['ceph']['osd']['size']['max']\n end\n\n ceph_chef_pool pool_val['name'] do\n action :set\n key 'size'\n value val\n only_if \"ceph osd pool #{pool_val['name']} size | grep #{val}\"\n end\n end\n end\nend", "def patch_macpool_pool_with_http_info(moid, macpool_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MacpoolApi.patch_macpool_pool ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling MacpoolApi.patch_macpool_pool\"\n end\n # verify the required parameter 'macpool_pool' is set\n if @api_client.config.client_side_validation && macpool_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'macpool_pool' when calling MacpoolApi.patch_macpool_pool\"\n end\n # resource path\n local_var_path = '/api/v1/macpool/Pools/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(macpool_pool)\n\n # return_type\n return_type = opts[:debug_return_type] || 'MacpoolPool'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"MacpoolApi.patch_macpool_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MacpoolApi#patch_macpool_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def pool(session)\n read_task('rvpe.host.pool', session) do\n call_one_xmlrpc('one.hostpool.info', session)\n end\n end", "def set_default_pool_name(opts)\n opts = check_params(opts,[:default_pools])\n super(opts)\n end", "def list_agent_pools request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_agent_pools_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::StorageTransfer::V1::ListAgentPoolsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def list_ip_address_pools_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pools_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pools_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pools_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/ip-pools'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IpAddressPoolListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#list_ip_address_pools_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_pool(pool)\n handle_action_exceptions(__method__) do\n cmd_line = [\"createpool '#{pool}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def work_pool; end", "def set_storage_pool(storage_pool)\n assure_uri(storage_pool)\n self['provisioningParameters'] ||= {}\n self['provisioningParameters']['storagePoolUri'] = storage_pool['uri']\n end", "def list_load_balancer_pools_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.list_load_balancer_pools ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiServicesLoadbalancerApi.list_load_balancer_pools, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiServicesLoadbalancerApi.list_load_balancer_pools, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/loadbalancer/pools'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPoolListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#list_load_balancer_pools\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_server_pool_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PoolApi.get_server_pool ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n pool_name = opts[:'pool_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PoolApi.get_server_pool\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling PoolApi.get_server_pool\"\n end\n # verify the required parameter 'pool_name' is set\n if @api_client.config.client_side_validation && pool_name.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_name' when calling PoolApi.get_server_pool\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/pool/{pool_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'pool_name' + '}', CGI.escape(pool_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'PoolResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"PoolApi.get_server_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PoolApi#get_server_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_entries\n @pool = Pool.find(params[:pool_id])\n end", "def delete_resourcepool_pool_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcepoolApi.delete_resourcepool_pool ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ResourcepoolApi.delete_resourcepool_pool\"\n end\n # resource path\n local_var_path = '/api/v1/resourcepool/Pools/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourcepoolApi.delete_resourcepool_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcepoolApi#delete_resourcepool_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_macpool_pool_with_http_info(moid, macpool_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MacpoolApi.update_macpool_pool ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling MacpoolApi.update_macpool_pool\"\n end\n # verify the required parameter 'macpool_pool' is set\n if @api_client.config.client_side_validation && macpool_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'macpool_pool' when calling MacpoolApi.update_macpool_pool\"\n end\n # resource path\n local_var_path = '/api/v1/macpool/Pools/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(macpool_pool)\n\n # return_type\n return_type = opts[:debug_return_type] || 'MacpoolPool'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"MacpoolApi.update_macpool_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MacpoolApi#update_macpool_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_resourcepool_pool_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcepoolApi.get_resourcepool_pool_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/resourcepool/Pools'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourcepoolPoolResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourcepoolApi.get_resourcepool_pool_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcepoolApi#get_resourcepool_pool_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_storage_pool(storage_pool)\n assure_uri(storage_pool)\n @data['properties'] ||= {}\n @data['properties']['storagePool'] = storage_pool['uri']\n end", "def create_load_balancer_pool_with_http_info(lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool ...'\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools'\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(lb_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#create_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def execute(target: Target, config: Config.new)\n [].tap { |res| config.run_pool { process target, res, config } }\n end", "def load_pools_to_redis\n @redis.with_metrics do |redis|\n previously_configured_pools = redis.smembers('vmpooler__pools')\n currently_configured_pools = []\n config[:pools].each do |pool|\n currently_configured_pools << pool['name']\n redis.sadd('vmpooler__pools', pool['name'].to_s)\n pool_keys = pool.keys\n pool_keys.delete('alias')\n to_set = {}\n pool_keys.each do |k|\n to_set[k] = pool[k]\n end\n to_set['alias'] = pool['alias'].join(',') if to_set.key?('alias')\n to_set['domain'] = Vmpooler::Dns.get_domain_for_pool(config, pool['name'])\n\n redis.hmset(\"vmpooler__pool__#{pool['name']}\", *to_set.to_a.flatten) unless to_set.empty?\n end\n previously_configured_pools.each do |pool|\n unless currently_configured_pools.include? pool\n redis.srem('vmpooler__pools', pool.to_s)\n redis.del(\"vmpooler__pool__#{pool}\")\n end\n end\n end\n nil\n end", "def snat_pool\n super\n end", "def pool( pool, message )\n post('/pool', :body => { :pool => pool, :message => message } )\n end", "def provided_pools\n list = []\n @config[:pools].each do |pool|\n list << pool['name'] if pool['provider'] == name\n end\n list\n end", "def create_or_replace_ip_address_pool_0_with_http_info(ip_pool_id, ip_address_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_replace_ip_address_pool_0 ...'\n end\n # verify the required parameter 'ip_pool_id' is set\n if @api_client.config.client_side_validation && ip_pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_pool_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_replace_ip_address_pool_0\"\n end\n # verify the required parameter 'ip_address_pool' is set\n if @api_client.config.client_side_validation && ip_address_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_address_pool' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_replace_ip_address_pool_0\"\n end\n # resource path\n local_var_path = '/infra/ip-pools/{ip-pool-id}'.sub('{' + 'ip-pool-id' + '}', ip_pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ip_address_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IpAddressPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#create_or_replace_ip_address_pool_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def process_uri_options #:nodoc\n @server_pool = []\n uri = options[:uris] || options[:servers] || options[:uri]\n uri = uri.kind_of?(Array) ? uri : [uri]\n uri.each { |u| server_pool << { :uri => u.is_a?(URI) ? u.dup : URI.parse(u) } }\n bind_primary\n end", "def update\n @transparent_pools = []\n @anonymous_pools = []\n\n res = HTTP.get 'https://raw.githubusercontent.com/fate0/proxylist/master/proxy.list'\n raise HTTPError, \"invalid http code #{res.code}\" if res.code != 200\n\n res.body.to_s.split(\"\\n\").each {|line| _pool_parse(line)}\n end", "def create_or_patch_ip_address_pool_0_with_http_info(ip_pool_id, ip_address_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_patch_ip_address_pool_0 ...'\n end\n # verify the required parameter 'ip_pool_id' is set\n if @api_client.config.client_side_validation && ip_pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_pool_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_patch_ip_address_pool_0\"\n end\n # verify the required parameter 'ip_address_pool' is set\n if @api_client.config.client_side_validation && ip_address_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_address_pool' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_patch_ip_address_pool_0\"\n end\n # resource path\n local_var_path = '/infra/ip-pools/{ip-pool-id}'.sub('{' + 'ip-pool-id' + '}', ip_pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ip_address_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#create_or_patch_ip_address_pool_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_pool pool_name, monitor_name=nil\n monitor_name ||= 'http'\n\n response = put(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/pools/#{pool_name}\",\n {\n :pool => {\n :name => pool_name,\n :method => 'RoundRobin',\n :port => '80',\n :enabled => 'true',\n :monitors => [monitor_name]\n }\n }.to_json)\n raise LBModelException.new \"Expected HTTP 202 but got #{response.code} instead\" unless response.code == 202\n\n parse_jobids response\n end", "def last_hop_pool\n super\n end", "def create_or_replace_ip_address_pool_with_http_info(ip_pool_id, ip_address_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_replace_ip_address_pool ...'\n end\n # verify the required parameter 'ip_pool_id' is set\n if @api_client.config.client_side_validation && ip_pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_pool_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_replace_ip_address_pool\"\n end\n # verify the required parameter 'ip_address_pool' is set\n if @api_client.config.client_side_validation && ip_address_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_address_pool' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_replace_ip_address_pool\"\n end\n # resource path\n local_var_path = '/global-infra/ip-pools/{ip-pool-id}'.sub('{' + 'ip-pool-id' + '}', ip_pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ip_address_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IpAddressPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#create_or_replace_ip_address_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def clone_pool\n super\n end", "def worker_pool; end", "def worker_pool; end", "def pool_size=(pool_size)\n @pool.pool_size = pool_size\n end", "def add_clone_pool(opts)\n opts = check_params(opts,[:clone_pools])\n super(opts)\n end", "def list_worker_pools request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_worker_pools_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Build::V1::ListWorkerPoolsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def iis_pool(pool_name)\n command = \"Import-Module WebAdministration; Get-Item \\\"IIS:\\\\AppPools\\\\#{pool_name}\\\" | Select-Object name, queueLength, autoStart, enable32BitAppOnWin64, managedRuntimeVersion, managedRuntimeLoader, enableConfigurationOverride, managedPipelineMode, passAnonymousToken, startMode, state, ItemXPath | ConvertTo-Json\"\n cmd = @inspec.command(command)\n command_process_model = \"(Get-Item \\\"IIS:\\\\AppPools\\\\#{pool_name}\\\").processModel | Select-Object identityType, userName, password, loadUserProfile, setProfileEnvironment, logonType, manualGroupMembership, idleTimeout, idleTimeoutAction, maxProcesses, shutdownTimeLimit, startupTimeLimit, pingingEnabled, pingInterval, pingResponseTime, logEventOnProcessModel | ConvertTo-Json\"\n cmd_process_model = @inspec.command(command_process_model)\n command_recycling = \"(Get-Item \\\"IIS:\\\\AppPools\\\\#{pool_name}\\\").recycling | Select-Object disallowOverlappingRotation, disallowRotationOnConfigChange, logEventOnRecycle | ConvertTo-Json\"\n cmd_recycling = @inspec.command(command_recycling)\n command_recycling_periodic_restart = \"(Get-Item \\\"IIS:\\\\AppPools\\\\#{pool_name}\\\").recycling.periodicRestart | Select-Object memory, privateMemory, requests, time | ConvertTo-Json\"\n cmd_recycling_periodic_restart = @inspec.command(command_recycling_periodic_restart)\n command_recycling_period_restart_schedule = \"(Get-Item \\\"IIS:\\\\AppPools\\\\#{pool_name}\\\").recycling.periodicRestart.schedule | Select-Object Collection | ConvertTo-Json\"\n cmd_recycling_period_restart_schedule = @inspec.command(command_recycling_period_restart_schedule)\n command_failing = \"(Get-Item \\\"IIS:\\\\AppPools\\\\#{pool_name}\\\").failure | Select-Object loadBalancerCapabilities, orphanWorkerProcess, orphanActionExe, orphanActionParams, rapidFailProtection, rapidFailProtectionInterval, rapidFailProtectionMaxCrashes, autoShudownExe, autoShutdownParams | ConvertTo-Json\"\n cmd_failing = @inspec.command(command_failing)\n command_cpu = \"(Get-Item \\\"IIS:\\\\AppPools\\\\#{pool_name}\\\").cpu | Select-Object limit, action, resetInterval, smpAffinitized, smpProcessorAffinityMask, smpProcessorAffinityMask2, processorGroup, numaNodeAssignment, numaNodeAffinityMode | ConvertTo-Json\"\n cmd_cpu = @inspec.command(command_cpu)\n command_worker_processes = \"(Get-Item \\\"IIS:\\\\AppPools\\\\#{pool_name}\\\").workerProcesses | Select-Object Collection | ConvertTo-Json\"\n cmd_worker_processes = @inspec.command(command_worker_processes)\n\n begin\n pool = JSON.parse(cmd.stdout)\n pool_process_model = JSON.parse(cmd_process_model.stdout)\n pool_recyling = JSON.parse(cmd_recycling.stdout)\n pool_recycling_periodic_restart = JSON.parse(cmd_recycling_periodic_restart.stdout)\n pool_recycling_period_restart_schedule = JSON.parse(cmd_recycling_period_restart_schedule.stdout)\n pool_failing = JSON.parse(cmd_failing.stdout)\n pool_cpu = JSON.parse(cmd_cpu.stdout)\n pool_worker_processes = JSON.parse(cmd_worker_processes.stdout)\n rescue JSON::ParserError => _e\n return {}\n end\n\n restart_schedules = []\n pool_recycling_period_restart_schedule['Collection'].each { |schedule| restart_schedules.push(schedule['value']) }\n\n worker_processes = []\n pool_worker_processes['Collection'].each { |process| worker_processes.push(process_id: process['processId'], handles: process['Handles'], state: process['state'], start_time: process['StartTime']) }\n\n # map our values to a hash table\n {\n name: pool['name'],\n queue_length: pool['queueLength'],\n auto_start: pool['autoStart'],\n enable_32bit_app_on_win64: pool['enable32BitAppOnWin64'],\n managed_runtime_version: pool['managedRuntimeVersion'],\n managed_runtime_loader: pool['managedRuntimeLoader'],\n enable_configuration_override: pool['enableConfigurationOverride'],\n managed_pipeline_mode: pool['managedPipelineMode'],\n pass_anonymous_token: pool['passAnonymousToken'],\n start_mode: pool['startMode'],\n state: pool['state'],\n item_x_path: pool['ItemXPath'],\n process_model: {\n identity_type: pool_process_model['identityType'],\n username: pool_process_model['userName'],\n password: pool_process_model['password'],\n load_user_profile: pool_process_model['loadUserProfile'],\n set_profile_environment: pool_process_model['setProfileEnvironment'],\n logon_type: pool_process_model['logonType'],\n manual_group_membership: pool_process_model['manualGroupMembership'],\n idle_timeout: \"#{pool_process_model['idleTimeout']['Days']}.#{pool_process_model['idleTimeout']['Hours']}:#{pool_process_model['idleTimeout']['Minutes']}:#{pool_process_model['idleTimeout']['Seconds']}\",\n idle_timeout_action: pool_process_model['idleTimeoutAction'],\n max_processes: pool_process_model['maxProcesses'],\n shutdown_time_limit: \"#{pool_process_model['shutdownTimeLimit']['Days']}.#{pool_process_model['shutdownTimeLimit']['Hours']}:#{pool_process_model['shutdownTimeLimit']['Minutes']}:#{pool_process_model['shutdownTimeLimit']['Second']}\",\n startup_time_limit: \"#{pool_process_model['startupTimeLimit']['Days']}.#{pool_process_model['startupTimeLimit']['Hours']}:#{pool_process_model['startupTimeLimit']['Minutes']}:#{pool_process_model['startupTimeLimit']['Seconds']}\",\n pinging_enabled: pool_process_model['pingingEnabled'],\n ping_interval: \"#{pool_process_model['pingInterval']['Days']}.#{pool_process_model['pingInterval']['Hours']}:#{pool_process_model['pingInterval']['Minutes']}:#{pool_process_model['pingInterval']['Seconds']}\",\n ping_response_time: \"#{pool_process_model['pingResponseTime']['Days']}.#{pool_process_model['pingResponseTime']['Hours']}:#{pool_process_model['pingResponseTime']['Minutes']}:#{pool_process_model['pingResponseTime']['Second']}\",\n log_event_on_process_model: pool_process_model['logEventOnProcessModel'],\n },\n recycling: {\n disallow_overlapping_rotation: pool_recyling['disallowOverlappingRotation'],\n disallow_rotation_on_config_change: pool_recyling['disallowRotationOnConfigChange'],\n log_event_on_recycle: pool_recyling['logEventOnRecycle'],\n periodic_restart: {\n memory: pool_recycling_periodic_restart['memory'],\n privateMemory: pool_recycling_periodic_restart['privateMemory'],\n requests: pool_recycling_periodic_restart['requests'],\n time: \"#{pool_recycling_periodic_restart['time']['Days']}.#{pool_recycling_periodic_restart['time']['Hours']}:#{pool_recycling_periodic_restart['time']['Minutes']}:#{pool_recycling_periodic_restart['time']['Seconds']}\",\n schedule: restart_schedules,\n },\n },\n failing: {\n loadBalancerCapabilities: pool_failing['loadBalancerCapabilities'],\n orphanWorkerProcess: pool_failing['orphanWorkerProcess'],\n orphanActionExe: pool_failing['orphanActionExe'],\n orphanActionParams: pool_failing['orphanActionParams'],\n rapidFailProtection: pool_failing['rapidFailProtection'],\n rapidFailProtectionInterval: \"#{pool_failing['rapidFailProtectionInterval']['Days']}.#{pool_failing['rapidFailProtectionInterval']['Hours']}:#{pool_failing['rapidFailProtectionInterval']['Minutes']}:#{pool_failing['rapidFailProtectionInterval']['Seconds']}\",\n rapidFailProtectionMaxCrashes: pool_failing['rapidFailProtectionMaxCrashes'],\n autoShudownExe: pool_failing['autoShudownExe'],\n autoShutdownParam: pool_failing['autoShutdownParam'],\n },\n cpu: {\n limit: pool_cpu['limit'],\n action: pool_cpu['action'],\n resetInterval: \"#{pool_cpu['resetInterval']['Days']}.#{pool_cpu['resetInterval']['Hours']}:#{pool_cpu['resetInterval']['Minutes']}:#{pool_cpu['resetInterval']['Seconds']}\",\n smpAffinitized: pool_cpu['smpAffinitized'],\n smpProcessorAffinityMask: pool_cpu['smpProcessorAffinityMask'],\n smpProcessorAffinityMask2: pool_cpu['smpProcessorAffinityMask2'],\n processorGroup: pool_cpu['processorGroup'],\n numaNodeAssignment: pool_cpu['numaNodeAssignment'],\n numaNodeAffinityMode: pool_cpu['numaNodeAffinityMode'],\n },\n worker_processes: worker_processes,\n }\n end", "def remove_all_clone_pools\n super\n end", "def update_server_pool_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PoolApi.update_server_pool ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n pool_name = opts[:'pool_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PoolApi.update_server_pool\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling PoolApi.update_server_pool\"\n end\n # verify the required parameter 'pool_name' is set\n if @api_client.config.client_side_validation && pool_name.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_name' when calling PoolApi.update_server_pool\"\n end\n allowable_values = [0, 1]\n if @api_client.config.client_side_validation && opts[:'use_tls'] && !allowable_values.include?(opts[:'use_tls'])\n fail ArgumentError, \"invalid value for \\\"use_tls\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"random\", \"hash\", \"client\"]\n if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'quorum'].nil? && opts[:'quorum'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"quorum\"]\" when calling PoolApi.update_server_pool, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'quorum'].nil? && opts[:'quorum'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"quorum\"]\" when calling PoolApi.update_server_pool, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/pool/{pool_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'pool_name' + '}', CGI.escape(pool_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['tls_ca_cert'] = opts[:'tls_ca_cert'] if !opts[:'tls_ca_cert'].nil?\n form_params['tls_client_cert'] = opts[:'tls_client_cert'] if !opts[:'tls_client_cert'].nil?\n form_params['tls_client_key'] = opts[:'tls_client_key'] if !opts[:'tls_client_key'].nil?\n form_params['tls_cert_hostname'] = opts[:'tls_cert_hostname'] if !opts[:'tls_cert_hostname'].nil?\n form_params['use_tls'] = opts[:'use_tls'] if !opts[:'use_tls'].nil?\n form_params['created_at'] = opts[:'created_at'] if !opts[:'created_at'].nil?\n form_params['deleted_at'] = opts[:'deleted_at'] if !opts[:'deleted_at'].nil?\n form_params['updated_at'] = opts[:'updated_at'] if !opts[:'updated_at'].nil?\n form_params['service_id'] = opts[:'service_id'] if !opts[:'service_id'].nil?\n form_params['version'] = opts[:'version'] if !opts[:'version'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['shield'] = opts[:'shield'] if !opts[:'shield'].nil?\n form_params['request_condition'] = opts[:'request_condition'] if !opts[:'request_condition'].nil?\n form_params['tls_ciphers'] = opts[:'tls_ciphers'] if !opts[:'tls_ciphers'].nil?\n form_params['tls_sni_hostname'] = opts[:'tls_sni_hostname'] if !opts[:'tls_sni_hostname'].nil?\n form_params['min_tls_version'] = opts[:'min_tls_version'] if !opts[:'min_tls_version'].nil?\n form_params['max_tls_version'] = opts[:'max_tls_version'] if !opts[:'max_tls_version'].nil?\n form_params['healthcheck'] = opts[:'healthcheck'] if !opts[:'healthcheck'].nil?\n form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['type'] = opts[:'type'] if !opts[:'type'].nil?\n form_params['override_host'] = opts[:'override_host'] if !opts[:'override_host'].nil?\n form_params['between_bytes_timeout'] = opts[:'between_bytes_timeout'] if !opts[:'between_bytes_timeout'].nil?\n form_params['connect_timeout'] = opts[:'connect_timeout'] if !opts[:'connect_timeout'].nil?\n form_params['first_byte_timeout'] = opts[:'first_byte_timeout'] if !opts[:'first_byte_timeout'].nil?\n form_params['max_conn_default'] = opts[:'max_conn_default'] if !opts[:'max_conn_default'].nil?\n form_params['quorum'] = opts[:'quorum'] if !opts[:'quorum'].nil?\n form_params['tls_check_cert'] = opts[:'tls_check_cert'] if !opts[:'tls_check_cert'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'PoolResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"PoolApi.update_server_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PoolApi#update_server_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_or_patch_ip_address_pool_with_http_info(ip_pool_id, ip_address_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_patch_ip_address_pool ...'\n end\n # verify the required parameter 'ip_pool_id' is set\n if @api_client.config.client_side_validation && ip_pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_pool_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_patch_ip_address_pool\"\n end\n # verify the required parameter 'ip_address_pool' is set\n if @api_client.config.client_side_validation && ip_address_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_address_pool' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.create_or_patch_ip_address_pool\"\n end\n # resource path\n local_var_path = '/global-infra/ip-pools/{ip-pool-id}'.sub('{' + 'ip-pool-id' + '}', ip_pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ip_address_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#create_or_patch_ip_address_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def default_pool_name\n super\n end", "def across_pool_state\n super\n end", "def set_snapshot_pool(storage_pool)\n storage_pool.retrieve! unless storage_pool['uri']\n @data['snapshotPoolUri'] = storage_pool['uri']\n end", "def worker_pool_size=(_arg0); end", "def remove_clone_pool(opts)\n opts = check_params(opts,[:clone_pools])\n super(opts)\n end", "def initialize_pools(members)\n members.each do |member|\n @hosts << member.host_string\n\n if member.primary?\n @primary = member.host_port\n @primary_pool = Pool.new(self.connection, member.host, member.port,\n :size => self.connection.pool_size,\n :timeout => self.connection.connect_timeout,\n :node => member)\n elsif member.secondary? && !@secondaries.include?(member.host_port)\n @secondaries << member.host_port\n @secondary_pools << Pool.new(self.connection, member.host, member.port,\n :size => self.connection.pool_size,\n :timeout => self.connection.connect_timeout,\n :node => member)\n end\n end\n\n @max_bson_size = members.first.config['maxBsonObjectSize'] ||\n Mongo::DEFAULT_MAX_BSON_SIZE\n @arbiters = members.first.arbiters\n choose_read_pool\n end", "def update!(**args)\n @address_pools = args[:address_pools] if args.key?(:address_pools)\n end", "def pool=(new_value)\n @pool = new_value\n @pool << self if @pool\n end", "def update!(**args)\n @address_pools = args[:address_pools] if args.key?(:address_pools)\n @load_balancer_node_pool_config = args[:load_balancer_node_pool_config] if args.key?(:load_balancer_node_pool_config)\n end", "def update_pool_with_http_info(pool_id, pool_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PoolsApi.update_pool ...'\n end\n # verify the required parameter 'pool_id' is set\n if @api_client.config.client_side_validation && pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_id' when calling PoolsApi.update_pool\"\n end\n # verify the required parameter 'pool_body' is set\n if @api_client.config.client_side_validation && pool_body.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_body' when calling PoolsApi.update_pool\"\n end\n # resource path\n local_var_path = '/pools/{pool_id}'.sub('{' + 'pool_id' + '}', CGI.escape(pool_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(pool_body) \n\n # return_type\n return_type = opts[:return_type] || 'Pool' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PoolsApi#update_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_application_pools\n\t\ts = get_admin_section \"system.applicationHost/applicationPools\"\n\t\tIisObjectCollection.new s.Collection, :add, ApplicationPool\n end", "def set_pool \n @pool = Pool.find(params[:id])\n unless @logged_in.update_site?\n @pool.readonly!\n end\n end", "def get_pools(details = true)\n path = details ? \"/scheduler-stats/get_pools?detail=true\" : \"/scheduler-stats/get_pools\"\n response = @connection.req('GET', path)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n JSON.parse(response.body)['pools']\n end", "def index_pools(opts = {})\n data, _status_code, _headers = index_pools_with_http_info(opts)\n data\n end", "def set_pooling\n @pooling = Pooling.find(params[:id])\n end", "def ceph_chef_build_federated_pool(pool)\n node['ceph']['pools'][pool]['federated_regions'].each do |region|\n node['ceph']['pools'][pool]['federated_zone_instances'].each do |zone_instance|\n node['ceph']['pools'][pool]['pools'].each do |pool_val|\n federated_name = \".#{region}-#{zone_instance['name']}#{pool_val['name']}\"\n unless node['ceph']['pools'][pool]['federated_names'].include? federated_name\n node.default['ceph']['pools'][pool]['federated_names'] << federated_name\n node.default['ceph']['pools'][pool]['federated']['pools'] << pool_val\n end\n end\n end\n end\nend", "def list_ip_address_pool_allocations_with_http_info(ip_pool_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pool_allocations ...'\n end\n # verify the required parameter 'ip_pool_id' is set\n if @api_client.config.client_side_validation && ip_pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_pool_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pool_allocations\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pool_allocations, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pool_allocations, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/ip-pools/{ip-pool-id}/ip-allocations'.sub('{' + 'ip-pool-id' + '}', ip_pool_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IpAddressAllocationListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#list_ip_address_pool_allocations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def redis_pool=(_arg0); end", "def set_connection_pool_maximum_size(opts)\n opts = check_params(opts,[:sizes])\n super(opts)\n end", "def fetch_instances_batch_pool(vm_pool)\n fail 'Pool object not provided!' unless vm_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Iterating over the VM \" \\\n \"pool without batch processing\"\n\n check_retval vm_pool.info(\n OpenNebula::VirtualMachinePool::INFO_ALL,\n -1, -1,\n OpenNebula::VirtualMachinePool::INFO_NOT_DONE\n )\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Got #{vm_pool.count.inspect} VMs from pool\"\n\n vm_pool.to_a\n end", "def get_macpool_pool_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MacpoolApi.get_macpool_pool_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/macpool/Pools'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'MacpoolPoolResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"MacpoolApi.get_macpool_pool_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MacpoolApi#get_macpool_pool_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_ip_address_pool_allocations_0_with_http_info(ip_pool_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pool_allocations_0 ...'\n end\n # verify the required parameter 'ip_pool_id' is set\n if @api_client.config.client_side_validation && ip_pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_pool_id' when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pool_allocations_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pool_allocations_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi.list_ip_address_pool_allocations_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/ip-pools/{ip-pool-id}/ip-allocations'.sub('{' + 'ip-pool-id' + '}', ip_pool_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IpAddressAllocationListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementIPAddressPoolsIPPoolsApi#list_ip_address_pool_allocations_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_load_balancer_pool_with_http_info(pool_id, lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool ...'\n end\n # verify the required parameter 'pool_id' is set\n if @api_client.config.client_side_validation && pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_id' when calling ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool\"\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools/{pool-id}'.sub('{' + 'pool-id' + '}', pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#update_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_server_pool_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PoolApi.delete_server_pool ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n pool_name = opts[:'pool_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PoolApi.delete_server_pool\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling PoolApi.delete_server_pool\"\n end\n # verify the required parameter 'pool_name' is set\n if @api_client.config.client_side_validation && pool_name.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_name' when calling PoolApi.delete_server_pool\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/pool/{pool_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'pool_name' + '}', CGI.escape(pool_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"PoolApi.delete_server_pool\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PoolApi#delete_server_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def pool\n unless @pool\n self.pool_size ||=2\n threads = [self.pool_size, 2, Concurrent.processor_count].max\n @pool = Concurrent::ThreadPoolExecutor.new(\n min_threads: 2,\n max_threads: threads,\n max_queue: 10*threads,\n fallback_policy: :caller_runs\n )\n end\n @pool\n end" ]
[ "0.64109004", "0.64109004", "0.6296743", "0.6281177", "0.62099504", "0.6116906", "0.60760635", "0.5974923", "0.5969901", "0.5969901", "0.5969901", "0.59464973", "0.5939732", "0.5929891", "0.5927853", "0.59101754", "0.59054935", "0.58772707", "0.58763534", "0.58741593", "0.5873631", "0.5833348", "0.579959", "0.579959", "0.573157", "0.5731207", "0.57213414", "0.57195354", "0.5707007", "0.5701184", "0.5698456", "0.56957144", "0.56894916", "0.5682438", "0.56711555", "0.5660232", "0.5659088", "0.5638846", "0.5637324", "0.5629373", "0.5621009", "0.5605263", "0.5587745", "0.5549705", "0.55466837", "0.5541743", "0.55270535", "0.55245125", "0.5519475", "0.5519255", "0.5509709", "0.55021816", "0.54982424", "0.54962724", "0.5476743", "0.5474484", "0.5474362", "0.54708153", "0.5458576", "0.54547733", "0.5440249", "0.54325205", "0.5431715", "0.5428049", "0.54259056", "0.54218256", "0.541296", "0.541296", "0.5406997", "0.540687", "0.5394235", "0.5392782", "0.538671", "0.5386417", "0.5369301", "0.5367307", "0.5360703", "0.5355136", "0.535495", "0.5350847", "0.5348468", "0.53438413", "0.5341013", "0.53330684", "0.5326524", "0.5315051", "0.53101856", "0.5290644", "0.5289682", "0.528298", "0.5281309", "0.52799475", "0.52757376", "0.5271169", "0.52677155", "0.5267511", "0.5266131", "0.5263184", "0.52600604", "0.5259928" ]
0.80211663
0
Baseline implementation for the update_per_instance_configs REST call
def update_per_instance_configs request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_update_per_instance_configs_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_patch_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def update!(**args)\n @instance_config = args[:instance_config] if args.key?(:instance_config)\n end", "def update_instance_config request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_instance_config_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def update!(**args)\n @configs = args[:configs] if args.key?(:configs)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @parameters = args[:parameters] if args.key?(:parameters)\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 update!(**args)\n @accelerators = args[:accelerators] if args.key?(:accelerators)\n @boot_disk_size_gb = args[:boot_disk_size_gb] if args.key?(:boot_disk_size_gb)\n @confidential_instance_config = args[:confidential_instance_config] if args.key?(:confidential_instance_config)\n @disable_public_ip_addresses = args[:disable_public_ip_addresses] if args.key?(:disable_public_ip_addresses)\n @enable_nested_virtualization = args[:enable_nested_virtualization] if args.key?(:enable_nested_virtualization)\n @machine_type = args[:machine_type] if args.key?(:machine_type)\n @pool_size = args[:pool_size] if args.key?(:pool_size)\n @pooled_instances = args[:pooled_instances] if args.key?(:pooled_instances)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shielded_instance_config = args[:shielded_instance_config] if args.key?(:shielded_instance_config)\n @tags = args[:tags] if args.key?(:tags)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n end", "def update_all_config\n @admin.updateConfiguration\n end", "def update_shielded_instance_config request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_shielded_instance_config_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def update_shielded_instance_config request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_shielded_instance_config_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def update!(**args)\n @failed_locations = args[:failed_locations] if args.key?(:failed_locations)\n @instances = args[:instances] if args.key?(:instances)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update_instances\n Instance.update_all( ['public_ip=NULL, dns_name=NULL'], ['provider_account_id=? and public_ip=? and instance_id != ?', provider_account_id, public_ip, instance_id ] )\n \tInstance.update_all( ['public_ip=?, dns_name=?', public_ip, name], ['provider_account_id=? and instance_id=?', provider_account_id, instance_id ] )\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\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 @instances = args[:instances] if args.key?(:instances)\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 put_config(opts)\n opts = check_params(opts,[:instance_format,:data])\n super(opts)\n end", "def update!(**args)\n @image_config = args[:image_config] if args.key?(:image_config)\n @instance_config = args[:instance_config] if args.key?(:instance_config)\n @notification_config = args[:notification_config] if args.key?(:notification_config)\n @sequence_number = args[:sequence_number] if args.key?(:sequence_number)\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @completion_stats = args[:completion_stats] if args.key?(:completion_stats)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_container_logging = args[:disable_container_logging] if args.key?(:disable_container_logging)\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 @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @generate_explanation = args[:generate_explanation] if args.key?(:generate_explanation)\n @input_config = args[:input_config] if args.key?(:input_config)\n @instance_config = args[:instance_config] if args.key?(:instance_config)\n @labels = args[:labels] if args.key?(:labels)\n @manual_batch_tuning_parameters = args[:manual_batch_tuning_parameters] if args.key?(:manual_batch_tuning_parameters)\n @model = args[:model] if args.key?(:model)\n @model_monitoring_config = args[:model_monitoring_config] if args.key?(:model_monitoring_config)\n @model_monitoring_stats_anomalies = args[:model_monitoring_stats_anomalies] if args.key?(:model_monitoring_stats_anomalies)\n @model_monitoring_status = args[:model_monitoring_status] if args.key?(:model_monitoring_status)\n @model_parameters = args[:model_parameters] if args.key?(:model_parameters)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @name = args[:name] if args.key?(:name)\n @output_config = args[:output_config] if args.key?(:output_config)\n @output_info = args[:output_info] if args.key?(:output_info)\n @partial_failures = args[:partial_failures] if args.key?(:partial_failures)\n @resources_consumed = args[:resources_consumed] if args.key?(:resources_consumed)\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 @unmanaged_container_model = args[:unmanaged_container_model] if args.key?(:unmanaged_container_model)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @all = args[:all] if args.key?(:all)\n @group_labels = args[:group_labels] if args.key?(:group_labels)\n @instance_name_prefixes = args[:instance_name_prefixes] if args.key?(:instance_name_prefixes)\n @instances = args[:instances] if args.key?(:instances)\n @zones = args[:zones] if args.key?(:zones)\n end", "def update!(**args)\n @clusters = args[:clusters] if args.key?(:clusters)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @parent = args[:parent] if args.key?(:parent)\n end", "def update!(**args)\n @clusters = args[:clusters] if args.key?(:clusters)\n @instance = args[:instance] if args.key?(:instance)\n @instance_id = args[:instance_id] if args.key?(:instance_id)\n @parent = args[:parent] if args.key?(:parent)\n end", "def update!(**args)\n @autoscaling_metric_specs = args[:autoscaling_metric_specs] if args.key?(:autoscaling_metric_specs)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\n end", "def update!(**args)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @deployed_index_auth_config = args[:deployed_index_auth_config] if args.key?(:deployed_index_auth_config)\n @deployment_group = args[:deployment_group] if args.key?(:deployment_group)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_access_logging = args[:enable_access_logging] if args.key?(:enable_access_logging)\n @id = args[:id] if args.key?(:id)\n @index = args[:index] if args.key?(:index)\n @index_sync_time = args[:index_sync_time] if args.key?(:index_sync_time)\n @private_endpoints = args[:private_endpoints] if args.key?(:private_endpoints)\n @reserved_ip_ranges = args[:reserved_ip_ranges] if args.key?(:reserved_ip_ranges)\n end", "def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @labels = args[:labels] if args.key?(:labels)\n @location = args[:location] if args.key?(:location)\n @network = args[:network] if args.key?(:network)\n @placement = args[:placement] if args.key?(:placement)\n @service_account = args[:service_account] if args.key?(:service_account)\n end", "def update!(**args)\n @instance_size = args[:instance_size] if args.key?(:instance_size)\n end", "def update_configs!(config_params)\n config_params.each do |config|\n value = config[1].to_s\n #find the config\n configuration = UniversalAr::Configuration.find(config[0])\n if !configuration.nil?\n configuration.create_or_update_config(self, config[1])\n end\n end\n end", "def update!(**args)\n @acked_instance_count = args[:acked_instance_count] if args.key?(:acked_instance_count)\n @applying_patches_instance_count = args[:applying_patches_instance_count] if args.key?(:applying_patches_instance_count)\n @downloading_patches_instance_count = args[:downloading_patches_instance_count] if args.key?(:downloading_patches_instance_count)\n @failed_instance_count = args[:failed_instance_count] if args.key?(:failed_instance_count)\n @inactive_instance_count = args[:inactive_instance_count] if args.key?(:inactive_instance_count)\n @no_agent_detected_instance_count = args[:no_agent_detected_instance_count] if args.key?(:no_agent_detected_instance_count)\n @notified_instance_count = args[:notified_instance_count] if args.key?(:notified_instance_count)\n @pending_instance_count = args[:pending_instance_count] if args.key?(:pending_instance_count)\n @post_patch_step_instance_count = args[:post_patch_step_instance_count] if args.key?(:post_patch_step_instance_count)\n @pre_patch_step_instance_count = args[:pre_patch_step_instance_count] if args.key?(:pre_patch_step_instance_count)\n @rebooting_instance_count = args[:rebooting_instance_count] if args.key?(:rebooting_instance_count)\n @started_instance_count = args[:started_instance_count] if args.key?(:started_instance_count)\n @succeeded_instance_count = args[:succeeded_instance_count] if args.key?(:succeeded_instance_count)\n @succeeded_reboot_required_instance_count = args[:succeeded_reboot_required_instance_count] if args.key?(:succeeded_reboot_required_instance_count)\n @timed_out_instance_count = args[:timed_out_instance_count] if args.key?(:timed_out_instance_count)\n end", "def update\n @version = @application.versions.find(params[:id])\n count = params['param_count'].to_i\n i=1\n saved=false\n error =\"\"\n @version.version_configurations.destroy_all\n begin\n while(i<=count)\n @configuration = VersionConfiguration.new({key: params[:version]['key'+i.to_s], value: params[:version]['value'+i.to_s], version_id: params[:id]})\n saved = @configuration.save!\n i=i+1\n end\n rescue => ex\n saved = false\n error=ex.backtrace.join('\\n')\n end\n\n\n respond_to do |format|\n if saved\n format.html { redirect_to [@application, @version], notice: 'Version was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #@version.errors[]=error;\n format.json { render json: @version.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @deployed_model_id = args[:deployed_model_id] if args.key?(:deployed_model_id)\n @explanation_spec_override = args[:explanation_spec_override] if args.key?(:explanation_spec_override)\n @instances = args[:instances] if args.key?(:instances)\n @parameters = args[:parameters] if args.key?(:parameters)\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\n requires :identity, :settings_version, :tier\n\n data = service.update_instance(identity, settings_version, tier, settings)\n operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name)\n operation.wait_for { ready? }\n reload\n end", "def update!(**args)\n @deployment_config = args[:deployment_config] if args.key?(:deployment_config)\n end", "def update!(**args)\n @app_engine_version = args[:app_engine_version] if args.key?(:app_engine_version)\n @cloud_function = args[:cloud_function] if args.key?(:cloud_function)\n @cloud_run_revision = args[:cloud_run_revision] if args.key?(:cloud_run_revision)\n @cloud_sql_instance = args[:cloud_sql_instance] if args.key?(:cloud_sql_instance)\n @forwarding_rule = args[:forwarding_rule] if args.key?(:forwarding_rule)\n @forwarding_rule_target = args[:forwarding_rule_target] if args.key?(:forwarding_rule_target)\n @gke_master_cluster = args[:gke_master_cluster] if args.key?(:gke_master_cluster)\n @instance = args[:instance] if args.key?(:instance)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @load_balancer_id = args[:load_balancer_id] if args.key?(:load_balancer_id)\n @load_balancer_type = args[:load_balancer_type] if args.key?(:load_balancer_type)\n @network = args[:network] if args.key?(:network)\n @network_type = args[:network_type] if args.key?(:network_type)\n @port = args[:port] if args.key?(:port)\n @project_id = args[:project_id] if args.key?(:project_id)\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 @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 @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 doUpdate(startState)\n if (new_resource.rackID.nil? || new_resource.rackID.empty?)\n return\n end\n \n json = \"{\\\"rackId\\\" : \\\"#{new_resource.rackID}\\\"}\"\n \n response = putRequest(\"/hosts/#{new_resource.hostname}\", json)\n \n unless response.code.to_i.between?(200,299)\n raise Exception.new(\"Host update of #{new_resource.hostname} failed with #{response.code} code. Body: #{response.body}\")\n end\n \n unless response.body == startState\n new_resource.updated_by_last_action true\n end\nend", "def delete_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_delete_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def bulk_vhost_update(dbcheck, tenant_array)\n #tenant_status['vhost_updated'] = false\n command = \"chef-client -o prom-classfront::classflow-conf\"\n\n # list of environments that require vhost updates\n tenvs = [] \n tenant_array.each do |tenant|\n tenant_config = tenant[0]\n tenant_status = tenant[1]\n tenvs << tenant_config['env']\n end\n tenant_envlist = tenvs.uniq\n tenant_envlist.each do |tenant_env|\n front_end = dbcheck.lookup_frontend_servers(tenant_env)\n front_end.each do |instance|\n logger.info \"Updating vhost through chef-client run on #{instance}.\"\n begin\n run_ssh_command(instance, command)\n \n # Provides error details on connection failure\n rescue SocketError => e\n logger.error \"Unable to update vhost on instance #{instance}\"\n logger.error \"#{e}\"\n end\n end\n end\n \n # Mark each tenant as updated\n tenant_array.each do |tenant|\n tenant_status = tenant[1]\n tenant_status['vhost_updated'] = true\n end\n end", "def update!(**args)\n @manual_lb_config = args[:manual_lb_config] if args.key?(:manual_lb_config)\n @port_config = args[:port_config] if args.key?(:port_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def sync_configuration\n end", "def update\n respond_to do |format|\n if @app_instance.update(app_instance_params)\n format.html { redirect_to @app_instance, notice: 'App instance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @app_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @resources = args[:resources] if args.key?(:resources)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def update!(**args)\n @autoscaling_spec = args[:autoscaling_spec] if args.key?(:autoscaling_spec)\n @disk_spec = args[:disk_spec] if args.key?(:disk_spec)\n @id = args[:id] if args.key?(:id)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @replica_count = args[:replica_count] if args.key?(:replica_count)\n @used_replica_count = args[:used_replica_count] if args.key?(:used_replica_count)\n end", "def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end", "def apply_updates_to_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_apply_updates_to_instances_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def put_instance(opts)\n opts = check_params(opts,[:instances])\n super(opts)\n end", "def update\n\t\t@launch_configuration = LaunchConfiguration.find(params[:id])\n\t\t@provider_account = @launch_configuration.provider_account\n\n redirect_url = provider_account_url(@provider_account, :anchor => 'auto_scaling')\n\t\treturn redirect_to(redirect_url) if @launch_configuration.active?\n\n\t\tattrs = lc_params = params[:launch_configuration]\n\t\tif params[:lc_based_on] == 'existing'\n\t\t\tattrs = get_server_attributes(lc_params[:server_id], lc_params[:server_profile_revision_id]).merge!(lc_params)\n\t\tend\n\n\t\t@launch_configuration.attributes = attrs\n\n\t respond_to do |format|\n\t\t\tif @launch_configuration.try(:save)\n\t\t\t\tflash[:notice] = 'Launch Configuration was successfully updated.'\n\t p = @provider_account\n\t\t\t\to = @launch_configuration\n\t\t\t\tAuditLog.create_for_parent(\n\t\t\t\t\t:parent => p,\n\t\t\t\t\t:auditable_id => o.id,\n\t\t\t\t\t:auditable_type => o.class.to_s,\n\t\t\t\t\t:auditable_name => o.name,\n\t\t\t\t\t:author_login => current_user.login,\n\t\t\t\t\t:author_id => current_user.id,\n\t\t\t\t\t:summary => \"updated '#{o.name}'\",\n\t\t\t\t\t:changes => o.tracked_changes,\n\t\t\t\t\t:force => false\n\t\t\t\t)\n\t\t\t\tformat.html { redirect_to redirect_url }\n\t\t\t\tformat.xml { render :xml => @launch_configuration, :status => :updated, :location => @launch_configuration }\n\t\t\telse\n\t\t\t\tflash[:error] = 'Failed to update a Launch Configuration: ' + (@launch_configuration.try(:cloud_message) || 'unknown problem')\n\t\t format.html { render :action => :edit }\n\t\t format.xml { render :xml => @launch_configuration.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\tend", "def configure(update); end", "def update!(**args)\n @deployment_resource_pools = args[:deployment_resource_pools] if args.key?(:deployment_resource_pools)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @config = args[:config] if args.key?(:config)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @etag = args[:etag] if args.key?(:etag)\n @name = args[:name] if args.key?(:name)\n @node_pool_autoscaling = args[:node_pool_autoscaling] if args.key?(:node_pool_autoscaling)\n @on_prem_version = args[:on_prem_version] if args.key?(:on_prem_version)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\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 @deployment_config = args[:deployment_config] if args.key?(:deployment_config)\n @deployment_id = args[:deployment_id] if args.key?(:deployment_id)\n @entry_points = args[:entry_points] if args.key?(:entry_points)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def chef_vhost_update(dbcheck, tenant_config, tenant_status)\n tenant_status['vhost_updated'] = false\n tenant_env = tenant_config['env']\n front_end = dbcheck.lookup_frontend_servers(tenant_env)\n command = \"chef-client -o prom-classfront::classflow-conf\"\n front_end.each do |instance|\n logger.info \"Updating vhost through chef-client run on #{instance}.\"\n begin\n run_ssh_command(instance, command)\n #response = run_ssh_command(instance, command)\n #chefresp = response[0]\n #exitcode = response[2]\n # Generates a runtime error if chef-client run fails\n #if exitcode = '1'\n # raise RuntimeError.new(chefresp)\n #end\n # Provides error details on connection failure\n rescue SocketError => e\n logger.error \"Unable to update vhost on instance #{instance}\"\n logger.error \"#{e}\"\n # Returns chef-client output to log on failure\n #rescue RuntimeError => e\n # logger.error \"Chef runtime error on instance #{instance}\"\n # logger.error \"######## CHEF-CLIENT RUN OUTPUT ###########\"\n # logger.error \"#{e}\"\n # logger.error \"####### END CHEF-CLIENT RUN OUTPUT ########\"\n end\n end\n tenant_status['vhost_updated'] = true\n end", "def update!(**args)\n @api_server_args = args[:api_server_args] if args.key?(:api_server_args)\n @control_plane_node_pool_config = args[:control_plane_node_pool_config] if args.key?(:control_plane_node_pool_config)\n end", "def update!(**args)\n @api_server_args = args[:api_server_args] if args.key?(:api_server_args)\n @control_plane_node_pool_config = args[:control_plane_node_pool_config] if args.key?(:control_plane_node_pool_config)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @operations = args[:operations] if args.key?(:operations)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def instance_update(path, hash)\n result = $evm.instance_update(path, hash)\n if result\n $evm.log('info',\"Instance: <#{path}> updated. Result:<#{result.inspect}>\") if @debug\n else\n $evm.log('info',\"Instance: <#{path}> not updated. Result:<#{result.inspect}>\") if @debug\n end\n return result\n end", "def update!(**args)\n @control_plane_v2_config = args[:control_plane_v2_config] if args.key?(:control_plane_v2_config)\n @dhcp_ip_config = args[:dhcp_ip_config] if args.key?(:dhcp_ip_config)\n @host_config = args[:host_config] if args.key?(:host_config)\n @pod_address_cidr_blocks = args[:pod_address_cidr_blocks] if args.key?(:pod_address_cidr_blocks)\n @service_address_cidr_blocks = args[:service_address_cidr_blocks] if args.key?(:service_address_cidr_blocks)\n @static_ip_config = args[:static_ip_config] if args.key?(:static_ip_config)\n @vcenter_network = args[:vcenter_network] if args.key?(:vcenter_network)\n end", "def update!(**args)\n @cloud_bigtable_instance_spec = args[:cloud_bigtable_instance_spec] if args.key?(:cloud_bigtable_instance_spec)\n end", "def update_config\n @config_id = (@config_id + 1) % 2**24\n stop_ssdp_server\n notify :alive\n end" ]
[ "0.6811642", "0.6776814", "0.6315448", "0.62597513", "0.62576294", "0.6195071", "0.61715454", "0.6149493", "0.6065071", "0.60359526", "0.6019862", "0.6013464", "0.6013131", "0.5985889", "0.5985889", "0.5879221", "0.5803371", "0.57976645", "0.57976645", "0.579598", "0.5788356", "0.57597655", "0.57597655", "0.5742719", "0.57350343", "0.5699334", "0.56970906", "0.5679733", "0.5673929", "0.5663373", "0.56607425", "0.56573164", "0.5645121", "0.5608955", "0.5602924", "0.5598994", "0.5597808", "0.5597354", "0.55954057", "0.55905175", "0.5578143", "0.55746216", "0.5571575", "0.556952", "0.55466056", "0.554452", "0.5536775", "0.55269396", "0.55256957", "0.5524952", "0.5518654", "0.55101305", "0.55054194", "0.54979384", "0.54949504", "0.5491843", "0.5491843", "0.5486977", "0.5486881", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.54867935", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5486055", "0.5485883", "0.5474821", "0.5474023", "0.54735965", "0.5462037", "0.54538137" ]
0.7395426
0
This filter is used to set the selected tab for the New and Create actions.
def register_layout_setup @tab = :register end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_selected_tab\n end", "def create_tabs\n end", "def prepare_project_tabs(selected)\n nav_bar(:tabs) do |nb|\n nb.nav_item :overview, project_path(@project)\n nb.nav_item :budget, budget_project_path(@project)\n nb.nav_item :history, history_project_path(@project)\n nb.nav_item :edit, edit_project_path(@project)\n nb.current = selected\n end\n end", "def tab_selected(controller, action = nil)\n \"selected\" if controller_name == controller and (action.nil? or action_name == action)\n end", "def select_tab\n select find_by_id(handles.selected.tab_id)\n end", "def change_tab\n assert_privileges('my_settings_admin')\n @tabform = \"ui_\" + params['uib-tab'] if params['uib-tab'] != \"5\"\n edit\n render :action => \"show\"\n end", "def selected_create_employee_tab?(params)\n if params[:controller] == \"users\" && params[:action] == \"new_employee\"\n return true\n end\n\n return false\n end", "def set_tab\n @tab = :dashboard\n end", "def configure_tabs\n cname = params[:controller]\n aname = params[:action]\n\n add_tab(\n TabConstants::HOME, root_url,\n cname == 'sessions' && aname == 'new'\n )\n\n add_tab(\n TabConstants::ABOUT, 'dummy',\n cname == 'users' && aname == 'show'\n )\n\n compute_active_tab\n end", "def selected_tab=(tab_id)\n @selected_tab = tab_id.to_s\n end", "def tab_options(action, scope = nil)\n {\n 'id' => \"#{action}-tab\",\n 'class' => @tab == action && 'active',\n 'data-title' => translate_in_controller_scope(\"#{scope || action}.title\"),\n }\n end", "def set_tab\n @tab=\"images\"\n end", "def set_tab\n @tab = Tab.find(params[:id])\n end", "def selected_tab\n # This list would be more robust if it were built from the streams,\n # but then it doesn't work if, say, there is no search term and we haven't\n # made a request to Rummager\n tabs = %w{ departments-policy-results services-information-results }\n tabs.include?(params[:tab]) ? params[:tab] : nil\n end", "def tab=(name)\n @params.merge!(\"tab\" => name)\n end", "def filter_options(action, scope = nil)\n {\n id: \"#{action}-tab\",\n class: @tab == action ? \"radio_button filter active\" : \"radio_button filter inactive\",\n \"data-title\" => translate_in_controller_scope(\"#{scope || action}.title\"),\n }\n end", "def get_new_listing_tab_class(listing_type)\n \"new_listing_form_tab_#{@listing.listing_type.eql?(listing_type) ? 'selected' : 'unselected'}\"\n end", "def createNewInstance(controller, editable)\n AuditTab.new(@callbacks, editable)\n end", "def set_cur_tab\n end", "def on_tab_select(sender, selector, e)\n select_tab(@tabs.current)\n end", "def set_current_tab(tab)\n controller.session[:current_tab] = tab\nend", "def tabs_filter(val)\n params[:option] ||= 'all'\n if val == params[:option]\n \"active\"\n end\n end", "def <<\n super\n update_tabs\n end", "def set_tab\n @tab=\"food_intake_logs\"\n end", "def add_tab\n if params[:tab]\n @tab = Tab.new(params[:tab])\n @tab.share_type = 1\n flash[:notice]= @tab.save ? \"Tab created successfully.\" : \"Tab not created.\"\n redirect_to \"/users/profile/#{@login_user.id}\"\n end\n end", "def form_tabs_for(form:)\n if form.model.persisted? && current_user.admin? && !form.model.file_sets.blank?\n super << 'ocr'\n else\n super\n end\n end", "def set_company\n @company = Company.friendly.find(params[:id])\n @company_tab = 'active'\n end", "def tabs=(value)\n @tabs = value\n end", "def tab_tag( tab_id, tab_label, selected_id )\n tab_name = tab_id.to_s\n selected = tab_id == selected_id ? \"class='selected'\" : \"\"\n \"<li id='#{tab_name}-tab-button' #{selected}><a href='##{tab_name}-tab'><span>#{tab_label}</span></a></li>\".html_safe\n\tend", "def set_current_tab\n \"please override this method in your sub class\"\n # @current_tab = \"home\"\n end", "def update_tabs\n return unless @handles\n handles.items = tabs.map { |item| { id: item[:tab_id], title: item[:tab_title] } }.uniq\n return if handles.selected || handles.children.empty?\n handles.select_first\n select_tab\n end", "def tabs(tab_id, &block)\n Tab.new(tab_id, self, block)\n end", "def select(tab)\n return unless tab\n return if active_tab == tab\n active_tab.remove_class(:active) if active_tab\n handles.select handles.find(\"[tab_id='#{tab[:tab_id]}']\")\n tab.add_class(:active)\n end", "def insert_before\n super\n update_tabs\n end", "def get_listing_tab_class(tab_name)\n current_tab_name = params[:type] || \"list_view\"\n \"inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selected' : 'unselected'}\"\n end", "def get_listing_tab_class(tab_name)\n current_tab_name = params[:type] || \"list_view\"\n \"inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selected' : 'unselected'}\"\n end", "def get_listing_tab_class(tab_name)\n current_tab_name = params[:type] || \"list_view\"\n \"inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selected' : 'unselected'}\"\n end", "def new\n if (params[:tab] == 'who')\n @tab = params[:tab]\n @who_visibility = \"display:block\"\n @instruction_visibility = \"display:none\"\n @create_visibility = \"display:none\"\n elsif (params[:tab] == 'instructions')\n @tab = params[:tab]\n @who_visibility = \"display:none\"\n @instruction_visibility = \"display:block\"\n @create_visibility = \"display:none\"\n else\n @tab = 'create_channel_form'\n @who_visibility = \"display:none\"\n @instruction_visibility = \"display:none\"\n @create_visibility = \"display:block\"\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @channel }\n format.js\n end\n end", "def view_selected\n assert_privileges('my_settings_default_views')\n # ui1 form\n return unless load_edit(\"config_edit__ui1\", \"configuration\")\n\n @edit[:new][:views][VIEW_RESOURCES[params[:resource]]] = params[:view] # Capture the new view setting\n session[:changed] = (@edit[:new] != @edit[:current])\n @changed = session[:changed]\n render :update do |page|\n page << javascript_prologue\n page << javascript_for_miq_button_visibility(@changed)\n page.replace('tab_div', :partial => \"ui_1\")\n end\n end", "def create\n @tab = Tab.new(params[:tab])\n @tab.user_id = current_user.id\n\n respond_to do |format|\n if @tab.save\n flash[:notice] = t'flash.tab_created'\n format.html { redirect_to(@tab) }\n format.xml { render :xml => @tab, :status => :created, :location => @tab }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tabs\n if params[:tab_name] != 'links' && params[:tab_name] != 'gallery'\n @current_objects = params[:tab_name].classify.constantize.matching_user_with_permission_in_containers(@current_user, 'show', [current_container.id], current_container_type)\n end\n if params[:tab_name] == 'gallery'\n @current_objects = Image.matching_user_with_permission_in_containers(@current_user, 'show', [current_container.id], current_container_type)\n end\n render :partial => \"/admin/ck_specifics/ck_#{params[:tab_name]}\", :locals => {:current_objects => @current_objects}\n end", "def new_creatable_selection_list\n Seek::Util.user_creatable_types.collect { |c| [c.name.underscore.humanize, url_for(controller: c.name.underscore.pluralize, action: 'new')] }\n end", "def new_creatable_selection_list\n Seek::Util.user_creatable_types.collect { |c| [c.name.underscore.humanize, url_for(controller: c.name.underscore.pluralize, action: 'new')] }\n end", "def new\n if current_user\n @tab = Tab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tab }\n end\n else\n flash[:warning] = (t'flash.premission_denied') + (t'flash.cant_add_tab')\n redirect_to root_url\n end\n end", "def tabs\n content = String.new\n content << '<ul class=\"nav nav-tabs\">'\n Model::DEFAULT_SUPPORTED_ACTIONS.each do |action_type|\n if model.supported_action?(action_type, request)\n content << \"<li class=\\\"nav-item #{'active' if type == action_type}\\\"><a class=\\\"nav-link\\\" href=\\\"#{url_for(action_type)}\\\">#{tab_name(action_type)}</a></li>\"\n end\n end\n content << '</ul>'\n end", "def asset_selected( main_model )\n workTabPane_state_changed( main_model )\n end", "def asset_selected( main_model )\n workTabPane_state_changed( main_model )\n end", "def create\n @tab = Tab.new(tab_params.merge({user: current_user}))\n\n respond_to do |format|\n if @tab.save\n format.html { redirect_to @tab, notice: 'Tab was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tab }\n else\n format.html { render action: 'new' }\n format.json { render json: @tab.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_tab(name, klass = RoomPane)\n # Don't do anything if we already have this tab\n @channels.each { |cname,_| return nil if cname == name }\n\n # Add the visual indication of this tab\n @tab_names << FXTabItem.new(@tabs, name, nil)\n empty = FXPacker.new(@tabs)\n empty.padBottom = empty.padTop = empty.padLeft = empty.padRight = 0\n @empties << empty\n\n # Create the content of this channel - probably a RoomPane\n new_channel = klass.new(@switcher, @skin)\n @channels << [ name, new_channel ]\n new_channel.create\n new_channel.on_line(&@on_line_block) # register our callback function\n\n # Show the tabs (if so desired) now that we know we have more than one.\n (@tabs.create ; @tabs.show) if @skin[:show_tabs]\n end", "def tab(all, name, selected = nil) \n selected = all.first.first if selected.nil? || !all.map{|element, name| element}.include?(selected)\n\n menu_name = 'kind-of' + \"-\" + name.to_s\n show_name = 'show' + \"-\" + name.to_s\n \n render :partial => 'shared/tab', :locals => {:all => all, :menu_name => menu_name, :selected => selected, :show_name => show_name}\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def use_tab(tab_name)\n simple_matcher(\"controller use the tab name '#{tab_name}'\") do |controller_class|\n controller.class.options[:tab] == tab_name\n end\n end", "def m_tabs(controller)\n\t\tcontroller.classify.constantize::TABS\n\tend", "def selected_tab_index\n @tabs.index(@current_tab)\n end", "def sub_view\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).sub_handler\n page(SubmissionPage).verify_page_elements\n page(SubmissionPage).select_action(\"Submissions\")\n page(SubmissionPage).select_action(\"Comments\")\n page(MorePage).backpage\n end", "def tabclass(cname)\n #change cname to the correct selected tab name in exceptional cases:\n case controller.controller_name\n when 'inventory_items'\n rcname = 'reports'\n when 'comments',\n 'line_items',\n 'subcontractors',\n 'subcontracts'\n rcname = 'contracts'\n when 'audits',\n 'dropdowns',\n 'import',\n 'roles',\n 'users'\n rcname = 'admin'\n when 'appgen_orders',\n 'io_slots',\n 'ioscans',\n 'servers',\n 'swlist_blacklists',\n 'swlist_whitelists',\n 'swlists',\n 'swproducts',\n 'upfront_orders'\n rcname = 'tools'\n when 'hw_support_prices',\n 'manufacturers',\n 'manufacturer_lines',\n 'sw_support_prices'\n rcname = 'prices'\n else\n rcname = controller.controller_name\n end\n #general case\n if cname == rcname\n return(\"menuSelected\")\n else\n return(\"menuUnselected\")\n end\n\n end", "def set_user_tab\n @user_tab = UserTab.find(params[:id])\n end", "def active_tab(tab)\n if request.path.include?(tab)\n 'active'\n else\n ''\n end\n end", "def admin_tab(*actions)\n self.admin_actions = actions\n end", "def tabs\n @tabs ||= collect_tabs(brand.side_tabs)\n end", "def tab_to(*args)\n name = args[0]\n url_options = args[1] || {}\n html_options = args[2]\n url = url_for(url_options)\n\n link = link_to(name, url, html_options)\n\n if request.path == url\n raw \"<li class ='selected'>\" + link + \"</li>\"\n else\n raw \"<li>\" + link + \"</li>\"\n end\n end", "def switch_to_tab_for_type \n\t\t\ttab = 0 if @search_type == :recent\n\t\t\ttab = 1 if @search_type == :nearby\n\t\t\ttab = 2 if @search_type == :location\n\t\t\t# This is in the documentation, but I could not find it in the framework?\n\t\t\t# Rho::NativeTabbar.switch_tab(tab)\n\t\tend", "def tab_to(name, all_options = nil)\n url = all_options.is_a?(Array) ? all_options[0].merge({:only_path => false}) : \"#\"\n \n current_url = url_for(:action => @current_action, :only_path => false)\n link_current = \"\"\n \n if all_options.is_a?(Array)\n all_options.each do |o|\n if url_for(o.merge({:only_path => false})) == current_url\n link_current = \"select\"\n break\n end\n end\n end\n \n raw \"<li class='#{link_current}' >\" + link_to(raw(\"<span>\" + name + \"</span>\"), url, {}) + \"</li>\"\n end", "def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end", "def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end", "def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end", "def set_biz_tab\n @biz_tab = BizTab.find(params[:id])\n end", "def activate\n # admin.tabs.add \"Typed Pages\", \"/admin/typed_pages\", :after => \"Layouts\", :visibility => [:all]\n end", "def set_tab(name, namespace = nil)\n tab_stack[namespace || :default] = name\n end", "def tab(*args)\n\n options = {:label => args.first.to_s}\n if args.last.is_a?(Hash)\n options = options.merge(args.pop)\n end\n options[:route] ||= \"admin_#{args.first}\"\n\n destination_url = options[:url]\n\n #titleized_label = t(options[:label], :default => options[:label]).titleize\n titleized_label = options[:label].titleize\n\n if options[:icon]\n link = link_to(\"\n <span class='icon'>\n <i class='icon-#{options[:icon]}'></i>\n </span>\n <span class='text'> #{titleized_label}</span>\".html_safe,\n destination_url)\n else\n link = link_to(titleized_label, destination_url) unless options[:icon]\n end\n\n css_classes = []\n\n #logger.info (\"request.fullpath= \" + request.fullpath)\n #logger.info (\"match_path......= \" + (options[:match_path] ? options[:match_path] : \"\"))\n\n selected = if options[:match_path]\n ## TODO: `request.fullpath` for engines mounted at '/' returns '//'\n ## which seems an issue with Rails routing.- revisit issue #910\n #request.fullpath.gsub('//', '/').starts_with?(\"#{root_path}admin#{options[:match_path]}\")\n request.fullpath.gsub('//', '/').match(options[:match_path]).to_s == request.fullpath\n else\n args.include?(controller.controller_name.to_sym)\n end\n css_classes << 'active' if selected\n\n if options[:css_class]\n css_classes << options[:css_class]\n end\n content_tag('li', link, :class => css_classes.join(' '))\n end", "def index\n @companies = current_user.companies\n @company_tab = 'active'\n end", "def switch_tab(tab, title)\n append_to_script \"switch_tab \\\"#{tab}\\\" , \\\"#{title}\\\"\"\n end", "def quick_dialogtab(how, what)\n QuickDialogTab.new(self, how, what, parent_widget, window_id, :dialogtab)\n end", "def SwitchTab\n page.driver.browser.switch_to.window (page.driver.browser.window_handles.last)\n end", "def index\n @listed_companies = ListedCompany.all\n session[:active_tab] =\"MeetingPlan\"\n session[:active_tab1] =\"Master\"\n end", "def create\n @tab = Tab.new(params[:tab])\n\n respond_to do |format|\n if @tab.save\n format.html { redirect_to(@tab, :notice => 'Tab was successfully created.') }\n format.xml { render :xml => @tab, :status => :created, :location => @tab }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tab a_tab\n content_for :tab, a_tab\n end", "def index\n session[:active_tab] =\"TimeManagement\"\n session[:active_tab1] =\"WeekoffSetup\"\n end", "def open_tab(name, &block)\n create_tab(name, 'Default Session', &block)\n end", "def tab(title, options={}, &block)\n options[:id] = \"tab-#{rand.to_s.split('.').last}\" if options[:id].nil?\n options[:title] = title\n options[:content] = block_given? ? capture(&block) : nil\n @tabinfo[tab_depth][:tabs] << options\n nil\n end", "def create\n @question_tab = @test_tab.question_tabs.new(params[:question_tab])\n\n respond_to do |format|\n if @question_tab.save\n flash[:notice] = 'Questão elaborada com sucesso.'\n format.html { redirect_to([@test_tab,@question_tab]) }\n format.xml { render :xml => @question_tab, :status => :created, :location => @question_tab }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_tab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tab_params\n params.require(:tab).permit(:name, :user)\n end", "def initialize_product_admin_tabs\n @product_admin_tabs = []\n end", "def create_workspace_and_options_tabs()\n new_notebook = Wx::Notebook.new(self)\n\n @ws_tab = Wx::Panel.new(new_notebook) # Add workspace tab\n @ws_mvsizer = Wx::BoxSizer.new(Wx::VERTICAL)\n @ws_tab.set_sizer(@ws_mvsizer)\n\n @options_tab = Wx::Panel.new(new_notebook) # Add options tab\n @options_mvsizer = Wx::BoxSizer.new(Wx::VERTICAL)\n @options_tab.set_sizer(@options_mvsizer)\n\n\n new_notebook.add_page(@ws_tab , \"Workspace\")\n new_notebook.add_page(@options_tab , \"Options\")\n evt_notebook_page_changing(new_notebook.get_id()) {|event| on_changing_page(event) }\n end", "def new_wizard_selection\n init_variables_from_sessions\n end", "def select_company_to_create_admin\n \n \n @companies = Company.all\n \n add_breadcrumb \"Select company\", 'select_company_to_create_admin_path'\n end", "def delete_tabs\n end", "def tab\n ActiveSupport::StringInquirer.new(@params[:tab]) unless @params[:tab].nil?\n end", "def tab(id, options = {}, &block)\n if request.xhr?\n yield\n else\n @tab = id\n layout = options[:of] ? \"#{options[:of].to_s.pluralize}/\" : ''\n layout << 'tabs'\n\n render :layout => layout, &block\n end\n end", "def set_current_action\n @visitor.current_action = @_action_name\nend", "def default_tab\n if logged_in?\n self.all_tabs[TabConstants::HOME]\n else\n self.all_tabs[TabConstants::ABOUT]\n end\n end", "def new\n @user = User.find(params[:user_id])\n @allow_test = @user.allow_tests.new\n get_all_test_tabs\n end", "def change_history_tab\n @tab = params[:tab]\n cookies[\"history-tab-ssr-#{@sub_service_request.id}\"] = @tab\n end", "def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end", "def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end", "def feed_tabs_panel\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/tabs/\"), __method__)\n end", "def activate\n # admin.tabs.add \"Ray\", \"/admin/ray\", :after => \"Layouts\", :visibility => [:admin]\n end" ]
[ "0.68872184", "0.6220431", "0.6060745", "0.60167944", "0.5969301", "0.5876113", "0.5799229", "0.57912546", "0.5746225", "0.5733679", "0.56440645", "0.55861306", "0.55856234", "0.5566003", "0.5561013", "0.5534241", "0.5528404", "0.5491456", "0.5487351", "0.5459731", "0.54028714", "0.5393896", "0.53792393", "0.53507435", "0.53434104", "0.53360856", "0.5305273", "0.52797514", "0.52698666", "0.5267808", "0.52340466", "0.5221531", "0.5202783", "0.5177559", "0.51752657", "0.51752657", "0.51752657", "0.5160555", "0.515311", "0.51186556", "0.51068085", "0.5105962", "0.5105962", "0.5105941", "0.5076677", "0.5053175", "0.5053175", "0.5042184", "0.5032228", "0.49779636", "0.49547645", "0.49547645", "0.49547645", "0.49547645", "0.49547645", "0.49539274", "0.49518445", "0.49494153", "0.49437016", "0.49102172", "0.49084187", "0.49032533", "0.4902251", "0.48983204", "0.48938903", "0.48738787", "0.48678523", "0.4865369", "0.4865369", "0.4865369", "0.48537502", "0.48537326", "0.48525438", "0.48521277", "0.4850891", "0.48500857", "0.48495734", "0.48451427", "0.48441863", "0.48225284", "0.48179278", "0.48175415", "0.4815553", "0.48148543", "0.47909325", "0.47899932", "0.47863048", "0.47753385", "0.47717842", "0.47684726", "0.4767645", "0.4756587", "0.474799", "0.47447258", "0.47404572", "0.4738537", "0.4735121", "0.47332665", "0.47332665", "0.47129178", "0.47094283" ]
0.0
-1
This filter is used to set the selected tab for the Edit and Update actions.
def user_layout_setup @tab = :user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_selected_tab\n end", "def change_tab\n assert_privileges('my_settings_admin')\n @tabform = \"ui_\" + params['uib-tab'] if params['uib-tab'] != \"5\"\n edit\n render :action => \"show\"\n end", "def select_tab\n select find_by_id(handles.selected.tab_id)\n end", "def selected_tab=(tab_id)\n @selected_tab = tab_id.to_s\n end", "def tab_selected(controller, action = nil)\n \"selected\" if controller_name == controller and (action.nil? or action_name == action)\n end", "def set_tab\n @tab = Tab.find(params[:id])\n end", "def set_tab\n @tab = :dashboard\n end", "def tabs_filter(val)\n params[:option] ||= 'all'\n if val == params[:option]\n \"active\"\n end\n end", "def tab=(name)\n @params.merge!(\"tab\" => name)\n end", "def set_tab\n @tab=\"images\"\n end", "def set_company\n @company = Company.friendly.find(params[:id])\n @company_tab = 'active'\n end", "def edit_tab\n @tab = Tab.find(params[:tab][:id])\n @tab.update_attributes(params[:tab])\n flash[:notice]=\"Tab updated successfully.\"\n redirect_to \"/users/profile/#{@login_user.id}\"\n end", "def selected_tab\n # This list would be more robust if it were built from the streams,\n # but then it doesn't work if, say, there is no search term and we haven't\n # made a request to Rummager\n tabs = %w{ departments-policy-results services-information-results }\n tabs.include?(params[:tab]) ? params[:tab] : nil\n end", "def asset_selected( main_model )\n workTabPane_state_changed( main_model )\n end", "def asset_selected( main_model )\n workTabPane_state_changed( main_model )\n end", "def set_cur_tab\n end", "def view_selected\n assert_privileges('my_settings_default_views')\n # ui1 form\n return unless load_edit(\"config_edit__ui1\", \"configuration\")\n\n @edit[:new][:views][VIEW_RESOURCES[params[:resource]]] = params[:view] # Capture the new view setting\n session[:changed] = (@edit[:new] != @edit[:current])\n @changed = session[:changed]\n render :update do |page|\n page << javascript_prologue\n page << javascript_for_miq_button_visibility(@changed)\n page.replace('tab_div', :partial => \"ui_1\")\n end\n end", "def on_tab_select(sender, selector, e)\n select_tab(@tabs.current)\n end", "def tab_options(action, scope = nil)\n {\n 'id' => \"#{action}-tab\",\n 'class' => @tab == action && 'active',\n 'data-title' => translate_in_controller_scope(\"#{scope || action}.title\"),\n }\n end", "def admin_tab(*actions)\n self.admin_actions = actions\n end", "def set_current_tab(tab)\n controller.session[:current_tab] = tab\nend", "def set_user_tab\n @user_tab = UserTab.find(params[:id])\n end", "def visit_edit_page(model, **opt, &block)\n action = opt[:id] ? :edit : :edit_select\n visit_action_page(model, action, **opt, &block)\n end", "def filter_options(action, scope = nil)\n {\n id: \"#{action}-tab\",\n class: @tab == action ? \"radio_button filter active\" : \"radio_button filter inactive\",\n \"data-title\" => translate_in_controller_scope(\"#{scope || action}.title\"),\n }\n end", "def prepare_project_tabs(selected)\n nav_bar(:tabs) do |nb|\n nb.nav_item :overview, project_path(@project)\n nb.nav_item :budget, budget_project_path(@project)\n nb.nav_item :history, history_project_path(@project)\n nb.nav_item :edit, edit_project_path(@project)\n nb.current = selected\n end\n end", "def update_tabs\n return unless @handles\n handles.items = tabs.map { |item| { id: item[:tab_id], title: item[:tab_title] } }.uniq\n return if handles.selected || handles.children.empty?\n handles.select_first\n select_tab\n end", "def edit\n #SET_CHEF method will be called form BEFORE_ACTION\n end", "def set_tab\n @tab=\"food_intake_logs\"\n end", "def select(tab)\n return unless tab\n return if active_tab == tab\n active_tab.remove_class(:active) if active_tab\n handles.select handles.find(\"[tab_id='#{tab[:tab_id]}']\")\n tab.add_class(:active)\n end", "def tabs=(value)\n @tabs = value\n end", "def set_current_tab\n \"please override this method in your sub class\"\n # @current_tab = \"home\"\n end", "def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end", "def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end", "def mapping_edit_tabs(mapping, options = {})\n if mapping.versions.any?\n tag.div class: \"add-bottom-margin\" do\n bootstrap_flavour_tabs(\n {\n \"Edit\" => edit_site_mapping_path(mapping.site, mapping),\n \"History\" => site_mapping_versions_path(mapping.site, mapping),\n },\n options,\n )\n end\n end\n end", "def set_biz_tab\n @biz_tab = BizTab.find(params[:id])\n end", "def <<\n super\n update_tabs\n end", "def tabs\n if params[:tab_name] != 'links' && params[:tab_name] != 'gallery'\n @current_objects = params[:tab_name].classify.constantize.matching_user_with_permission_in_containers(@current_user, 'show', [current_container.id], current_container_type)\n end\n if params[:tab_name] == 'gallery'\n @current_objects = Image.matching_user_with_permission_in_containers(@current_user, 'show', [current_container.id], current_container_type)\n end\n render :partial => \"/admin/ck_specifics/ck_#{params[:tab_name]}\", :locals => {:current_objects => @current_objects}\n end", "def active_tab(tab)\n if request.path.include?(tab)\n 'active'\n else\n ''\n end\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def show\r\n @tabs = TABS\r\n @current_tab = params[:tab]\r\n @current_tab ||= TABS.first.to_s\r\n @current_tab = @current_tab.to_sym\r\n end", "def dialog_edit_editor\n assert_privileges(\"dialog_edit_editor\")\n @record = find_records_with_rbac(Dialog, checked_or_params)\n javascript_redirect(:controller => 'miq_ae_customization',\n :action => 'editor',\n :id => Array.wrap(@record).first.id)\n end", "def edit_button_clicked\n\n\t\t\t# Set flag for edit mode, store \n\t\t\t@edited_item = @form.folderList.currentItem\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form(@edited_item.text)\n\t\tend", "def set_store_tab\n @store_tab = StoreTab.find(params[:id])\n end", "def edit_select\n __log_activity\n __debug_route\n end", "def index\n @listed_companies = ListedCompany.all\n session[:active_tab] =\"MeetingPlan\"\n session[:active_tab1] =\"Master\"\n end", "def set_content_filter\n @content_filter = ContentFilter.find(params[:id])\n end", "def switch_to_tab_for_type \n\t\t\ttab = 0 if @search_type == :recent\n\t\t\ttab = 1 if @search_type == :nearby\n\t\t\ttab = 2 if @search_type == :location\n\t\t\t# This is in the documentation, but I could not find it in the framework?\n\t\t\t# Rho::NativeTabbar.switch_tab(tab)\n\t\tend", "def edit_list\n # TODO Change to active: false when draft/active and permissions are implemented\n @docs = Document.where(active: true).order(:title)\n @action = 'edit'\n @title = 'Contribution'\n render 'list'\n end", "def set_tab_private\n @tab = Tab.find(params[:id])\n @tab.update_attribute('share_type', 1)\n SharedTab.delete_all(:shareable_id=>@tab.id)\n flash[:notice]=\"#{@tab.name} tab is set to private.\"\n redirect_to :back\n end", "def form_tabs_for(form:)\n if form.model.persisted? && current_user.admin? && !form.model.file_sets.blank?\n super << 'ocr'\n else\n super\n end\n end", "def selected_tab_index\n @tabs.index(@current_tab)\n end", "def configure_tabs\n cname = params[:controller]\n aname = params[:action]\n\n add_tab(\n TabConstants::HOME, root_url,\n cname == 'sessions' && aname == 'new'\n )\n\n add_tab(\n TabConstants::ABOUT, 'dummy',\n cname == 'users' && aname == 'show'\n )\n\n compute_active_tab\n end", "def edit\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end", "def mapping_edit_tabs(options = {})\n if @mapping.versions.any?\n content_tag :div, class: 'add-bottom-margin' do\n bootstrap_flavour_tabs(\n {\n 'Edit' => edit_site_mapping_path(@mapping.site, @mapping),\n 'History' => site_mapping_versions_path(@mapping.site, @mapping)\n },\n options)\n end\n end\n end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def workTabPane_state_changed( main_model )\n update_model(view_state.model, :mapping_source)\n\n transfer[:working_tab_index] = main_model.working_tab_index # Set details from Main controller\n transfer[:working_tab_name] = main_model.working_tab_name\n transfer[:asset] = main_model.asset \n signal :workTabPane_state_changed\n end", "def set_edit\n @edit = Edit.find(params[:id])\n end", "def set_edit\n @edit = Edit.find(params[:id])\n end", "def index\n @companies = current_user.companies\n @company_tab = 'active'\n end", "def edit\r\n end", "def edit_selected(selected)\n case selected\n when ToyInScene\n #p \"toy in scene\"\n #@main_view.remove_toy(selected)\n #p \"toy edit = #{selected}\"\n close_popover\n moveToToyBar(selected.template)\n end\n end", "def index\n session[:active_tab] =\"TimeManagement\"\n session[:active_tab1] =\"WeekoffSetup\"\n end", "def show\n @current_selection = params[:current_selection] or \"activities\"\n end", "def edit\n @theme = Theme.find(params[:id])\n end", "def edit\r\n \r\n end", "def set_edit_page\n # Definimos el nombre de la página\n @page = \"Editar cuenta\"\n @edit = params[:edit]\n end", "def set_edit\n @edit = Edit.find_by_id(params[:id])\n end", "def use_tab(tab_name)\n simple_matcher(\"controller use the tab name '#{tab_name}'\") do |controller_class|\n controller.class.options[:tab] == tab_name\n end\n end", "def set_edit\n\t @edit = Edit.find(params[:id])\n\t end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end" ]
[ "0.6978443", "0.6668546", "0.6193674", "0.6178964", "0.6078628", "0.6039708", "0.5849016", "0.58365387", "0.5812621", "0.57447326", "0.5705294", "0.5659168", "0.5634589", "0.562936", "0.562936", "0.55709714", "0.5528786", "0.5498414", "0.54894584", "0.54866666", "0.5477907", "0.5467923", "0.5465737", "0.5465321", "0.54568475", "0.5415761", "0.53988147", "0.5365461", "0.5358343", "0.5352906", "0.53496", "0.5336934", "0.5336934", "0.531288", "0.53112996", "0.52680844", "0.523042", "0.51553977", "0.5151031", "0.5151031", "0.5151031", "0.5151031", "0.5151031", "0.51508266", "0.5127251", "0.5125905", "0.5121152", "0.5116691", "0.5101912", "0.5083377", "0.50726336", "0.5072501", "0.5061267", "0.505943", "0.5050292", "0.50492513", "0.50413954", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.503793", "0.50345814", "0.5023361", "0.5023361", "0.5007442", "0.4993322", "0.49839905", "0.49790528", "0.49773356", "0.4975323", "0.49706045", "0.49640438", "0.49612007", "0.4944761", "0.49410087", "0.49393743", "0.49393743", "0.49393743", "0.49393743", "0.49393743", "0.49393743", "0.49393743", "0.49393743", "0.49393743" ]
0.0
-1
GET /users Action method to display a list of all the users. The presentation of this remains to be decided.
def index @users = User.all @user = retrieve_authenticated_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_users\n self.class.get('/users')\n end", "def users\n get('get_users')\n end", "def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def users_list(options = {})\n if block_given?\n Pagination::Cursor.new(self, :users_list, options).each do |page|\n yield page\n end\n else\n get(\"users\", options)\n end\n end", "def index\n @all_users = User.all\n\trender \"list_users\"\n end", "def index\n\t\t@users = User.all\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml\t{ render :xml => @users }\n\t\tend\n\tend", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend", "def list\n get('users')['users']\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def list\n\t\t\t# Author\n\t\t\tauthorize! :manage, User\n\n\t\t\t# Get params\n\t\t\tpage \t\t\t= \t(params[:page] || 1).to_i\n\t\t\tper \t\t\t=\t(params[:per] || 24).to_i\n\t\t\tsearch_params \t=\tparams[:search] || {}\n\t\t\torder_params \t= \tparams[:order] || {}\n\n\t\t\t# Get users\n\t\t\tusers = User.list_search_with_params search_params, order_params\n\n\t\t\t# Render result\n\t\t\trespond_to do |f|\n\t\t\t\tf.html {\n\t\t\t\t\trender 'list',\n\t\t\t\t\t\tlayout: 'layout_back',\n\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\tusers: \tusers,\n\t\t\t\t\t\t\tpage: \tpage,\n\t\t\t\t\t\t\tper: \tper\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tf.json {\n\t\t\t\t\tusers_in_page = users.page page, per\n\n\t\t\t\t\t# Check if empty\n\t\t\t\t\tif users_in_page.count == 0\n\t\t\t\t\t\trender json: {\n\t\t\t\t\t\t\tstatus: 1\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\trender json: {\n\t\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tlist: render_to_string(\n\t\t\t\t\t\t\t\t\tpartial: 'list',\n\t\t\t\t\t\t\t\t\tformats: :html,\n\t\t\t\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\t\t\t\tusers: users_in_page\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tpaginator: render_to_string(\n\t\t\t\t\t\t\t\t\tpartial: '/shared/pagination',\n\t\t\t\t\t\t\t\t\tformats: :html,\n\t\t\t\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\t\t\t\ttotal: \tusers.count,\n\t\t\t\t\t\t\t\t\t\tper: \tper,\n\t\t\t\t\t\t\t\t\t\tpage: \tpage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\tend", "def index\n\t\t@users = User.all\n\n\t\trender :layout => \"application\"\n\tend", "def list_users\n @users = User.find(:all)\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def index\n\t @users = User.all\t\n\t render :index_user\n\tend", "def index\n\t\t@users = User.all\n\t\thide_view_action\n\t\tsetup_remove_confirm_message 'users.confirm_delete'\n\t\tsetup_index_title 'users.index.title'\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @users }\n\t\tend\n\tend", "def index\n if current_user && current_user.admin? \n @users = User.all\n respond_with users_path\n else\n flash[:notice] = 'You do not have rights to see the list of users.'\n redirect_to home_index_path\n end\n end", "def index\n @users = UserService.all_users\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def show_users\n @users = User.all\n end", "def index\n\t\t@users = User.page(params[:page]).per(10)\n\tend", "def index\n users = get_collection(visible_users) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: :users, skip_types: true) }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def show\n @users = User.all\n end", "def show\n @users = User.all\n end", "def show\n @users = User.all\n end", "def show\n @users = User.all\n end", "def list\n @all_users = User.find(:all)\n end", "def index\n\t\t# will automatically go into views/users and look for 'index' file to render\n\t\t@all_users = User.all\n\t\t# p @all_users, \"all users\"\n\tend", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def index\n @title = \"User List\"\n @users = User.all\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n\t@users = User.all\nend", "def index\n users = get_collection(User) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: 'users', skip_types: 'true') }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end", "def index\r\n @users = User.all\r\n end", "def index\r\n @users = User.all\r\n end", "def index\r\n @users = User.all\r\n end", "def index\n @users = @user.users\n render layout: false\n end", "def index\n @users = User.all\n\n respond_with @users\n end", "def index\n\t\tputs \"IN INDEX ACTION OF USERS\"\n\t\tputs params\n\t\t@users = User.paginate(page: params[:page])\n\tend", "def index\n users = User.all\n json_response(users)\n end", "def index\n\t\t@users = User.paginate :per_page=>10, :page=>params[:page],\n\t\t\t:order=>'users.nickname'\n\t\t@page_title = 'User List'\n\tend", "def list\n log \"retrieving users list from #{users_path}\"\n response = identity_client.get(users_path)\n records = JSON.load(response.body)[\"users\"]\n records.map { |record|\n record[\"username\"]\n }.map { |username|\n Raca::User.new(@account, username)\n }\n end", "def index\n if params[:page].present?\n response.headers['X-Total-Count'] = @users.count.to_s\n @users = @users.page(params[:page])\n @users = @users.per(params[:per]) if params[:per].present?\n end\n\n _render collection: @users\n end", "def index\n @users = User.paginate(page: params[:page])\n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all.paginate(page: params[:page])\n end", "def index\n @users = UserService.getAllUserList\n end", "def all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end", "def users_index\n\t\t@view.users_list($users)\n\t\t@view.second_view(@current_user, @current_user.actions)\n\tend", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def all\n result = Client.request(:get, 'users')\n\n if result.is_a?(Result::Success)\n result.body[:users].map { |data| User.new(data) }\n else\n []\n end\n end", "def index # Used for list of favorites or followers/followings list\n @users = User.all\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def index\n authorize! :read, User\n @users = User.find(:all)\n @users ||= []\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def index\n @users = User.desc.paginate(params.merge(:per_page => 20))\n display @users\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def index\n\t\t@user = User.all\n\t\tCUSTOM_LOGGER.info(\"Start to return users #{@user.to_yaml}\")\n\tend", "def show\n @users = User.find(params[:id])\n end", "def show\n @users = User.find(params[:id])\n end", "def show\n @users = User.find(params[:id])\n end", "def index\n \t@users = User.all\n \tend", "def index\n @users = User.all\n\tend", "def index\n @users = User.all\n respond_with @users\n end", "def index\n @users = User.all\n respond_with @users\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end" ]
[ "0.84645474", "0.8256386", "0.8199175", "0.8184251", "0.8104956", "0.80996245", "0.8073911", "0.8057535", "0.80385315", "0.8036241", "0.8028134", "0.8020411", "0.80035895", "0.7985874", "0.7971822", "0.7950718", "0.79107404", "0.790762", "0.790762", "0.790762", "0.7894006", "0.78862077", "0.78862077", "0.78862077", "0.78862077", "0.78862077", "0.78862077", "0.7883094", "0.7866455", "0.78508556", "0.783263", "0.783263", "0.783263", "0.783263", "0.78114176", "0.7794285", "0.7790989", "0.7787555", "0.7785923", "0.7770281", "0.7761747", "0.7761747", "0.7761747", "0.7761747", "0.7761747", "0.7761747", "0.7761747", "0.7760172", "0.7752583", "0.7751185", "0.77489275", "0.77489275", "0.77489275", "0.773919", "0.7728952", "0.77223307", "0.77218914", "0.7719409", "0.7717342", "0.7712043", "0.7702347", "0.7700959", "0.76953197", "0.7694584", "0.7691734", "0.7688143", "0.7682378", "0.7674903", "0.76719016", "0.76618254", "0.7658091", "0.764822", "0.76480687", "0.76418674", "0.76396114", "0.76372045", "0.76372045", "0.76372045", "0.76333106", "0.7619332", "0.7617505", "0.7617044", "0.7610643", "0.7608169", "0.7608169", "0.76065797", "0.75992566", "0.7598908", "0.7598908", "0.7598908", "0.7598908", "0.7598908", "0.7598908", "0.7598908", "0.7598908", "0.7598908", "0.7598908", "0.7598908", "0.7598908", "0.7598908" ]
0.788455
27
GET /users/:id Action method to display detailed information about a specific user.
def show @user = User.find(params[:id]) @user_me = retrieve_authenticated_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def show\n\t\t@user = User.find(params[:id]) rescue nil\n\t\tif @user\n\t\t\tapi_response(@user, 'User Details', :ok)\n\t\telse\n\t\t\tapi_response(nil, 'User id not present in the database', :bad_request)\n\t\tend\n\tend", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def show\n @user = UserService.getUserById(params[:id])\n end", "def show\n user = User.find_by_id(params[:id])\n if user.nil?\n # No user with that id\n render 'shared/http_status', locals: {code: '404', message:\n 'No user exists with that id'}, status: 404\n else\n respond_to do |format|\n format.xml { render xml: user.to_xml(only: DEFAULT_FIELDS, root: 'user', skip_types: 'true') }\n format.json { render json: user.to_json(only: DEFAULT_FIELDS) }\n end\n end\n end", "def info\n\t@user = User.find(params[:id])\n end", "def show\n\t\t# Find all users with id passed by params.\n\t\t@user = User.find(params[:id])\n\t\tCUSTOM_LOGGER.info(\"Start to find users #{@user.to_yaml}\")\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html { render :action => \"show\" }\n\t\t\tformat.json { render :json => @user }\n\t\tend\n\tend", "def show\n\t\t@user = User.find(params(:id))\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render json: @user }\n\t\tend\n\tend", "def show\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by :id => the_user_id\n\tend", "def show\n @user = User.find( params[:id] )\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def show \n\t\t@user = User.find_by_id(params[:id])\n\tend", "def show\n user_id = params.require(:id).to_i\n\n if user_id != current_user.id\n bad_request\n else\n @user = User.find(user_id)\n if @user\n success(body: @user)\n else\n not_found\n end\n end\n end", "def show\n user = visible_users.find_by(id: params[:id])\n if user.nil?\n # No user with that id\n render 'shared/http_status', locals: { code: '404', message:\n 'No user exists with that id' }, status: :not_found\n else\n respond_to do |format|\n format.xml { render xml: user.to_xml(only: DEFAULT_FIELDS, root: :user, skip_types: true) }\n format.json { render json: user.to_json(only: DEFAULT_FIELDS) }\n end\n end\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find_by(:id => params[:id])\n end", "def show\n @user = User.get(params[:id]) \n end", "def show\n \t@user = User.find(params[:id])\n end", "def show\n \t@user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:user_id])\n end", "def show\n @user = User.find(params[:id]) \n end", "def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end", "def show\n @user = User.find(params[:id])\n @users = User.all\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def show \n @user = User.find(params[:id])\n end", "def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end", "def show\n # loads one user in the database\n @user = User.find(params[:id])\n end", "def show \n\t\t@user = User.find(params[:id])\n\t\trender :index\n\tend", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def show\n # finds user with id of params[:id]\n @user = User.find params[:id]\n end", "def show\n @user = User.find(params[:id])\n\n end", "def show\n\t\t@the_user = User.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @the_user }\n\t\tend\n\tend", "def show \n @user = User.find(params[:id])\n end", "def show\n @user = User.find_by(params[:id])\n end", "def show\n\t\t@user = User.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @user }\n\t\tend\n\tend", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def show\n @users = User.find(params[:id])\n end", "def show\n @users = User.find(params[:id])\n end", "def show\n @users = User.find(params[:id])\n end", "def show\n @users = User.find (params[:id])\n end", "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end", "def show\n @user = User.find(params[:id])\n render\n end", "def show\n id = params[:id]\n if current_user.id == params[:id].to_i \n @user = current_user\n else\n @user = current_user.find(id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n if !params[:id]\n @user = current_user\n else\n @user = User.find_by_username(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n\t\t@user = User.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @user }\n\t\tend\n\tend", "def show\n \t@user = User.find params[:id]\n end", "def show\n @user = User.find(params[:id]) \n end", "def user(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}\", params)\n end", "def show\n logger.debug(\"user show\")\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = Users.find(params[:id])\n end", "def show\n\t\t@user = User.find(params[:id]) #find user with that id and save as instance of user\n\t\trender :show\n\tend", "def show\n @user = User.find(params[:id]) if params[:id]\n \n respond_to do |format|\n format.html { render action: :show }\n format.json { render json: { status: \"OK\", data: { user: @user }, message: nil } }\n end\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def show\n begin\n @user = User.find(params[:id])\n rescue\n render 'shared/not_found'\n end\n end" ]
[ "0.8396419", "0.82655483", "0.8114963", "0.80285114", "0.79702365", "0.79603076", "0.79362625", "0.7909691", "0.79018164", "0.78963256", "0.78963256", "0.78963256", "0.78963256", "0.78963256", "0.7865521", "0.78457457", "0.7791582", "0.778364", "0.7773355", "0.7770669", "0.7770669", "0.77580744", "0.7747178", "0.7739346", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.7730828", "0.77288437", "0.77278614", "0.77222943", "0.77222943", "0.7719198", "0.7700908", "0.7698946", "0.7683105", "0.76798874", "0.7669336", "0.7668316", "0.76459575", "0.76308614", "0.7630733", "0.76281273", "0.7623934", "0.7622941", "0.7618666", "0.76122975", "0.76060045", "0.7602895", "0.7602235", "0.7591613", "0.7591613", "0.7591613", "0.7590723", "0.7577472", "0.75699526", "0.7559613", "0.7559514", "0.7543887", "0.7534073", "0.7528419", "0.7520759", "0.7497891", "0.74962646", "0.74769384", "0.7471307", "0.7471243", "0.74693036", "0.74550915", "0.74523026" ]
0.0
-1
GET /users/:id/edit Action method to edit a specific user. TODO: Manage authorizations to filter who can access this page.
def edit @user = User.find(params[:id]) @countries = Country.all.map { |country| [country.name, country.id] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n @userToEdit = User.find(params[:id])\n end", "def edit\n \n @user = User.find(params[:id])\n \n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n # find the user we want to edit by id\n # this will send the @user to the edit page with a form\n @user = User.find(params[:id])\n end", "def edit\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:user_id])\n end", "def edit\n @user = User.find(params[:user_id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by(:id => the_user_id)\n\tend", "def edit\n # return an HTML form for editing a specific user\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n\t@user = User.find(params[:id])\nend", "def edit\n\t\t@user = User.find(params(:id))\n\tend", "def edit\n # finds user with id of params[:id]\n @user = User.find params[:id]\n end", "def edit\n @user = User.find params[:id]\n end", "def edit\n\t@user = User.find(params[:id])\n\t@title = \"Edit user\"\n end", "def edit\n @page_title = 'Edit user'\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n # loads user from the database\n @user = User.find(params[:id])\n end", "def edit\n # this finds the current user\n @user = User.find params[:id]\n end", "def edit\n # When a http GET request to '/users/1/edit' is received, have it render:\n # a view file with a form with user 1's information in the appropriate input field.\n @id = params[:id]\n @user = User.find(@id)\n end", "def edit\n \t@user = User.find params[:id]\n end", "def edit\n\t\t# admin is able to edit any user's page\n if current_user.is_admin?\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n end", "def edit\n @user = User.find(params[:id])\n\n deny_wrong_user if !current_user?(@user)\n end", "def edit\n @user=User.find(params[:id])\n end", "def edit\n # @user = User.find(params[:id]) -- not needed bc of correct_user\n end", "def edit\n @title = \"Edit user\"\n @user = User.find(params[:id])\n\n end", "def edit\n\t @user = User.find(params[:id])\n\t redirect_to root_path unless current_user.is_admin? or @user == current_user\n\tend", "def edit(id)\n @user = flash[:form_data] || User[id]\n\n if @user.nil?\n flash[:error] = 'The specified user is invalid'\n redirect_referrer\n end\n\n @title = \"Edit #{@user.username}\"\n\n render_view(:form)\n end", "def edit(id, options={})\n request(:put, \"/users/#{id}.json\", default_params(options))\n end", "def edit\n if params[:id].present?\n @user = User.find(params[:id])\n else\n super\n end\n end", "def edit\n @user = User.find(params[:id])\n # @user は編集対象のユーザー\n # current_user はログインしているユーザー \n\n end", "def edit\n @user= User.find_by_id(current_user.id)\n end", "def edit\n @user = User.find(params[:id])\n @user.update(user_params)\n end", "def edit\n @user = User.find(session[:user_id])\n end", "def edit\n @user = User.find(params[:id])\n authorize! :update, @user \n end", "def edit\n @user = User.shod(params[:id])\n authorize! :update, @user\n end", "def edit\n # @user = User.find(params[:id])\n # already in correct_user\n end", "def edit\n\t\tif !current_user || !is_this_user\n\t\t\tredirect_to user_path(params[:id])\n\t\tend\n\tend", "def edit\n @user = User.find(params[:id])\n # just show me the form\nend", "def edit\n @user = User.all.deep.find(current_user.id)\n authorize! :edit, @user\n\n render 'users/settings'\n end", "def edit\n id = params[:id]\n @user = User.find(id)\n if current_user\n # have to do this, or wil get nil:nil class\n if current_user.is_admin || current_user.id == @user.id\n render :edit\n end\n else\n redirect_to \"/\"\n end\n end", "def edit\n #similar to the NEW action, but instead of create a empty user, we will find a user by its id and than\n # send its params to the partial form, so the params can be edited. Please note the partial form\n # for details, as the column admin can be edited only buy logged users with admin privileges.\n #@user variable will be used in the partial form, when submitted goes to UPDATE action.\n @user = User.find(params[:id])\n #only admin can edit other users information, so we first check if the user is admin.\n unless current_user.admin?\n #if the user is not admin it can edit only its own information, so we redirect to edit its own information\n unless @user.id == current_user.id\n redirect_to edit_user_path (current_user)\n end\n end\n end", "def edit\n \"\"\"\n @user = User.find(params[:id])\n \"\"\"\n end", "def edit\n @user = current_user\n render 'edit'\n end", "def edit\n user = User.find_by username: params[:username]\n if !user || user.id != session[:user_id]\n flash[:error] = \"You are not authorized to edit this user's profile.\"\n redirect_to user_path params[:username]\n else\n @user = User.find_by username: params[:username]\n end\n end", "def edit\n if (session[:user_id] != nil)\n @user = User.find_by(id: session[:user_id])\n else\n redirect_to login_path\n end\n end", "def edit\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.profile\n\tend", "def edit\n @user = User.find(params[:id])\n\n #this works, but we can do better.\n authorize! :edit, @user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = User.find(params[:id])\n\t case params[:form]\n\t when \"email\"\n\t render 'email'\n\t when \"password\"\n\t render 'password'\n\t else\n\t render :action => :edit\n\t end\n\tend", "def edit_profile\n @user = User.find params[:id]\n end", "def edit\n\t\tRails.logger.warn(\"Rendering account settings page.\")\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n user_store_url\n @user = current_user\n if params[:id] && params[:id] != \"current\" && @user.admin?\n @user = User.find(params[:id])\n end\n end", "def edit\n @user = User.find_by(user_name: params[:user_name])\n end", "def edit\n if params[:id].present?\n @user = User.find_by_uuid(params[:id])\n else\n @user = current_user\n end\n end", "def edit\n @user = User.find (params[:user_id])\n @profile = @user.profile\n end", "def edit_user\n if (@user = find_user(params[:id]))\n @all_roles = Role.find_all.select { |r| r.name != UserEngine.config(:guest_role_name) }\n case request.method\n when :get\n when :post\n @user.attributes = params[:user].delete_if { |k,v| not LoginEngine.config(:changeable_fields).include?(k) }\n if @user.save\n flash.now[:notice] = \"Details for user '#{@user.login}' have been updated\"\n else\n flash.now[:warning] = \"Details could not be updated!\"\n end\n end\n else\n redirect_back_or_default :action => 'list'\n end\n end", "def edit\n #@user = User.find(params[:id]) \n #replced by the before_action at the top\n end", "def edit\n @profile = User.find(params[:id])\n end" ]
[ "0.8620834", "0.857214", "0.8517691", "0.8517691", "0.84981936", "0.84946084", "0.8467813", "0.8467813", "0.8467304", "0.8460322", "0.8460322", "0.8460322", "0.8460322", "0.84502554", "0.8447095", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.84469664", "0.8432647", "0.8429937", "0.8401092", "0.8381311", "0.83706975", "0.8342707", "0.83207303", "0.83055663", "0.8275032", "0.82648504", "0.8248215", "0.8239263", "0.8168302", "0.8153163", "0.81523204", "0.81027794", "0.8023365", "0.80010194", "0.7939599", "0.7923721", "0.7914222", "0.78747284", "0.7848929", "0.78307617", "0.7812446", "0.7795541", "0.77804655", "0.777814", "0.7777263", "0.77515423", "0.7736827", "0.772669", "0.7719284", "0.7712313", "0.7701943", "0.77015907", "0.77000195", "0.7667917", "0.7661696", "0.7655059", "0.76369107", "0.7632087", "0.76075506", "0.7606844", "0.75852764", "0.75822526", "0.7573969", "0.7571357", "0.75335306" ]
0.0
-1
GET /users/new Action method to register.
def new @user = User.new @countries = Country.all.map { |country| [country.name, country.id] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end", "def new_user\n\t\t@resource = User.new\n\t\t@resource_name = 'user'\n\tend", "def new_user\n \trender action: 'new_user'\n end", "def newUser\n end", "def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n\t\tmissing unless WAYGROUND['ALLOW_SIGNUP']\n\t\t@user = User.new(params[:user])\n\t\t@user.time_zone = Time.zone.name unless params[:user]\n\t\t@user.valid? if params[:user]\n\t\t@page_title = 'New User Registration'\n\tend", "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def user_new(opts = {})\n call(\"user\", \"new\", opts)\n end", "def new\n @new_user = User.new\n end", "def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end", "def new\n logger.debug(\"Create a new user\")\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n # Diese Seite ist User-unabhängig\n @independent = true\n @action = \"Registrieren\"\n @header = {\"back\" => root_path, \"ajax\" => true, \"title\" => \"Registrieren\"}\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n @btn_text = t('users.new.btn_signup')\n @title = t('app_name') + ' | ' + t('users.new.title')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @title = \"sign up\"\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n name = params[:name]\n email = params[:email]\n password = params[:password]\n new_user = User.create!(\n name: name,\n email: email,\n password: password,\n )\n\n response = \"Hey #{name}, You are registered successfully!\"\n render plain: response\n end", "def new\n case request.method\n when :get\n @user = User.new\n render\n return true\n when :post\n @user = User.new(params[:user])\n begin\n User.transaction(@user) do\n @user.new_password = true\n @user.verified = 1 # skip verification, because we are ADMIN!\n if @user.save\n flash[:notice] = 'User creation successful.'\n redirect_to :action => 'list'\n end\n end\n rescue Exception => e\n flash.now[:notice] = nil\n flash.now[:warning] = 'Error creating account: confirmation email not sent'\n logger.error e\n end\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @user }\n end\n end", "def create\n @newuser = Newuser.new(params[:newuser])\n\n respond_to do |format|\n if @newuser.save\n format.html { redirect_to @newuser, notice: 'Newuser was successfully created.' }\n format.json { render json: @newuser, status: :created, location: @newuser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = User.new()\n end", "def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n\t\t@user = User.new\n\t\t@addresses = Address.all\n\t\t@address = Address.new\n\t\t\n\t\twidok = 'new'\n\t\twidok = 'user_new' if !(admin_logged_in?)\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html { render widok } # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @user }\n\t\tend\n\tend", "def new\n @title = \"Signup\"\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end", "def create\n if user.save\n redirect_to users_path\n else\n render 'new'\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n @title = \"Sign up\"\n #@action = \"New Action\"\n end", "def create\n @new_user = NewUser.new(new_user_params)\n\n respond_to do |format|\n if @new_user.save\n format.html { redirect_to @new_user, notice: 'New user was successfully created.' }\n format.json { render :show, status: :created, location: @new_user }\n else\n format.html { render :new }\n format.json { render json: @new_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\t\t@user = User.new\n\t\trender :new\n\tend", "def new\n @title = \"Sign Up\"\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n puts \"******* new *******\"\n @user = User.new\n end", "def new\n @user = User.new()\n end", "def new\n @user = User.new()\n end", "def new\n @user = User.new\n end", "def new\n\t@user = User.new\n\t@title = \"Sign up\"\n end", "def new\n @myuser = User.new # Create a new user in memory, whose params will be filled by the form\n end", "def new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n\t@title = \"Sign Up\"\n\t@user = User.new\n end", "def create\n\t\t@user = User.new(user_params)\n\t\t\n\t\tif @user.save\n\t\t\tredirect_to users_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def new\n render \"users/new\"\n end", "def new\n if params[:create_user] == '1' or session[:id]\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n else\n flash[:error] = \"You will need to Sign In to view this page.\"\n redirect_to :controller => 'system', :action => 'index'\n end\n end", "def new\n @user = User.new()\n\n end", "def new\n @user = ::User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path, notice: t('users.update.updated')\n else\n @page_title = t(\"actions.new_user\")\n render action: 'new'\n end\n end", "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "def new\n\tputs \"\\n\\t\\t in new\\n\"\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n\t\t@user = User.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @user }\n\t\tend\n\tend", "def new\n\t\t@user = User.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @user }\n\t\tend\n\tend", "def new_user\n\t @user = User.new\t \n\tend", "def new\n @user = User.new\n end", "def new\n @user = User.new\n end", "def index\n @action = \"New\"\n @users = User.all\n @user = User.new\n end", "def new\n\t @user = User.new\n end", "def new\n @user = User.new\n # respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @user }\n # end\n render :users => \"signup\"\n end", "def create\n # When a http POST request to '/users' is received from the form rendered in\n # '/users/new', have it create a user with the information from the input field.\n # After creating the user, redirect to the '/users' route.\n @user = User.create(params[:user])\n redirect_to action: \"index\"\n end", "def new_user\n @user = User.new\n end", "def new\r\n @user = User.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @user }\r\n end\r\n end", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n\t\t@user = User.new\n\tend", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end" ]
[ "0.8076337", "0.7715464", "0.7386647", "0.7380369", "0.7378444", "0.7368971", "0.7364209", "0.7349267", "0.7338118", "0.7318484", "0.7299228", "0.72966444", "0.72891223", "0.7279196", "0.7219849", "0.7209128", "0.718016", "0.7176632", "0.71715134", "0.71701187", "0.7169588", "0.7151947", "0.7151793", "0.7150515", "0.7143563", "0.71403307", "0.7139884", "0.7131288", "0.7131288", "0.7128019", "0.7119667", "0.71133125", "0.7110684", "0.7105876", "0.7100521", "0.7100521", "0.70834047", "0.7080267", "0.70688456", "0.7066952", "0.7065993", "0.7061804", "0.7056498", "0.70519316", "0.70516884", "0.7043125", "0.70427537", "0.7040382", "0.7039261", "0.7037526", "0.7037526", "0.7036302", "0.7034765", "0.7034765", "0.7025639", "0.70196515", "0.70173323", "0.7015442", "0.70133543", "0.7007991", "0.6995591", "0.6995591", "0.6995591", "0.6995591", "0.6995591", "0.6995591", "0.6995591", "0.6995591", "0.6995591", "0.6995591", "0.6995591", "0.6995591", "0.6992443", "0.6992443", "0.6992443", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265", "0.6982265" ]
0.0
-1
POST /users Action method to send the registration form.
def create @user = User.new(params[:user]) if @user.save redirect_to root_url, :notice => { :title => "Success!", :message => "Your are now a Purerasmus member." } else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration\n \tif request.post?\n user = User.new(user_params)\n if user.valid?\n user.save\n flash[:notice] = \"Registration Successful. Please Sign In!\"\n redirect_to root_url\n else\n flash[:alert] = user.errors.first[1]\n redirect_to users_registration_url\n end\n \tend\t\n end", "def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n flash[:notice] = 'Registration successfull.' \n redirect_to root_url\n else\n render :action => \"new\"\n end\n end", "def userRegisterPost(email, name, password, password_confirmation)\n post register_path, params: {user: {email: email, name: name,\n password: password, password_confirmation: password_confirmation}}\n end", "def register\n\t\t@user = User.new(user_params)\n\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\t\t\t\t# Send user welcome email\n\t\t\t\tUserNotification.welcome_email(@user).deliver\n\n\t\t\t\tformat.js { @errors = [] }\n\t\t\telse\n\t\t\t\tformat.js { @errors = @user.errors }\n\t\t\tend\n\t\tend\n\tend", "def create_user_action\r\n user = User.new\r\n response = user.register_user(params[:username], params[:password], params[:password2])\r\n redirect_to controller: 'user', action: 'user_register', message: response\r\n end", "def create\n @user = User.new(params[:user])\n respond_to do |format|\n\tif @user.save\n\t\tRegistrationMailer.registration_email(@user).deliver\n\t\t{:action=> \"/logout\"}\n\t\tformat.html { redirect_to @user, notice: 'User was successfully created.' }\n\t\tformat.json { render json: @user, status: :created, location: @user }\n\t else\n\t\tformat.html { render action: \"new\" }\n\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\tend\n end\n end", "def register\n\t\t@user = User.new(user_params)\n\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\n\t\t\t\tformat.html { redirect_to login_path, notice: \"Account created successfully!\" }\n\t\t\telse\n\t\t\t\tformat.html { render action: :create_account }\n\t\t\tend\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n if @user.save\n UserMailer.registration_confirmation(@user).deliver\n redirect_to root_url, notice: \"Thank-you for enrolling!\"\n else\n render \"new\"\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(:users, :notice => 'Registration successfull. Check your email for activation instructions.') }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(register_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to admin_users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n UserMailer.registration_confirmation(@user).deliver_now\n respond_to do |format|\n if @user.save\n format.json { render :show, status: :created, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if !current_user || is_admin?\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(:root, :notice => 'Registration successfull.') }\n #format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to :root\n end\n end", "def create\n \t@user = User.new(user_params)\n if @user.save\n redirect_to login_path, notice: \"The registration success, you can login now.\"\n else\n render 'new'\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end", "def create\r\n @registerd_user = RegisterdUser.new(params[:registerd_user])\r\n\r\n respond_to do |format|\r\n if @registerd_user.save\r\n format.html { redirect_to @registerd_user, notice: 'Registerd user was successfully created.' }\r\n format.json { render json: @registerd_user, status: :created, location: @registerd_user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @registerd_user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def register\n if request.get? then\n @user = User.new\n end\n # Запрос на создание нового пользователя\n if request.post? then\n @user = User.new(params[:user])\n # Если включена регистрация по инвайтам - проверяем правильность введённого кода\n if SiteGlobal.invite_reg && !Invite.valid?(params[:invite]) then\n @user.errors[:base] << \"Invalid invation code\"\n render :register and return\n end\n # Пользователь может создать только аккаунт студента или преподавателя\n render_403 and return unless User.in_user_group?(@user)\n # Если запись успешно создана\n if @user.save then\n # Создание записи в дополнительной таблице\n if @user.student? then\n Student.create(user_id: @user.id)\n elsif @user.lecturer? then\n Lecturer.create(user_id: @user.id, confirm_level: Lecturer::CONFIRM_LEVELS[:unconfirmed])\n end\n if SiteGlobal.invite_reg\n Invite.use(params[:invite])\n end\n login, password = params[:user][:login], params[:user][:password]\n session[:user_id] = User.authenticate(login, password).id\n if @user.lecturer? then\n redirect_to settings_lecturer_path(reg: 1)\n elsif @user.student? then\n redirect_to settings_student_path(reg: 1)\n else\n redirect_to :root\n end\n else\n render :register\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n Notifier.signup_email(@user).deliver\n\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n #Sends email to user when user is created.\n UserNotifier.send_signup_email(@user).deliver_now\n format.html { redirect_to @user }\n flash[:success] = 'Usuário criado com sucesso, os dados foram enviados para o email informado.'\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if user.save\n redirect_to users_path\n else\n render 'new'\n end\n end", "def create\n @user = User.new(user_params)\n\n # save was requested by either current_user or else must be a new registration\n if @user.save(current_user)\n redirect_to users_path\n else\n render('new', status: :unprocessable_entity)\n end\n end", "def create\n # When a http POST request to '/users' is received from the form rendered in\n # '/users/new', have it create a user with the information from the input field.\n # After creating the user, redirect to the '/users' route.\n @user = User.create(params[:user])\n redirect_to action: \"index\"\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n redirect_to users_path, notice: \"ユーザが保存されました\"\n else\n render :new\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tflash[:notice] = \"Thanks for signing up\"\n\t\t\tredirect_to root_url\n\t\telse \n\t\t\trender 'new'\n\t\tend \n\tend", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n Mailer.deliver_registration_confirmation(@user)\n format.html { redirect_to( admin_users_path, :notice => 'User was successfully created.') }\n format.xml { render :xml => @user, :status => :created, :location => admin_users_path }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => admin_users_path.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@user = User.new user_params\n\t\tif @user.save\n\t\t# \tflash[:success] = \"Registration successful!\" \n sign_in @user\n\t\t\trender :json => { :user => @user } , :status => 201\n # redirect_to \"/\"\n\t\telse\n render :json => { :error => @user.errors.full_messages } , :status => 401\n\t\t\t# render 'new'\n\t\tend\n\tend", "def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend", "def create\n @user = User.new(params[:user])\n #o usuário está sendo criado no devise registration.\n\t\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = \"Registration was successful!\"\n sign_in @user\n redirect_to root_path\n else\n render 'new'\n end\n end", "def create\n @user = User.new params[:user]\n\n if @user.save\n flash[:notice] = t :registered, :scope => :flash\n redirect_to root_url\n else\n render :action => \"new\"\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t\tflash[:success] = \"Successful Registration\"\n\t\t\tredirect_to problems_url\n\t else\n\t render 'new'\n\t end\n\tend", "def create\n\t\t@user = User.new(params[:user]) # przekazujemy parametry zebrane z formularza. tamten obiekt tymczasowy od teraz jest nieprzydatny.\n\t\tif @user.save\t\t\t\t# params od obiektu zawiera hasha hashy gdzie obiekt jest mapowany na parametry a kazdy z parametrow to tez hash np Password: dupa itd.\n\n\t\t\tsign_in @user\n\t\t\tflash[:success] = \"Registered succesfully\" # dodajemy pare key value do hasha, tego hasha potem wyswietlimy uzytkownikowi\n\t\t\tredirect_to @user # przekierowuje do users/id usera @user. \n\n\n\t\t\t# Jeśli się udało zasejfować to nie musimy generować strony z wyjaśnieniem dlaczego sie nie udało(tu kiedyś będzie komunikat o sukcesie zapewne\n\t\telse\n\t\t\trender 'new' #wyrenderuj widok users/new\n\t\tend\n\tend", "def create\n respond_to do |format|\n if @user.save\n @user.sendmail_register_notify_user!\n @user.sendmail_register_notify_admins!\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def register\n @user = User.new(user_params)\n\n if @user.valid?\n @user.save\n session[:email] = @user.email\n flash[:notice] = 'Welcome.'\n redirect_to :root\n else\n render :action => \"new_user\"\n end\n end", "def register\n @user = User.create(user_params)\n if @user.save\n response = { message: 'User created successfully'}\n render json: response, status: :created \n else\n render json: @user.errors, status: :bad\n end \n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(@user, :notice => 'Account registered!') }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n logger.debug params\n @registration = User.new(:user_id => User.last.id + 1, :user_name => params[:registration][:user_name])\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to user_albums_path(@registration), notice: 'Registration was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registration }\n else\n format.html { render action: 'new' }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n name = params[:name]\n email = params[:email]\n password = params[:password]\n new_user = User.create!(\n name: name,\n email: email,\n password: password,\n )\n\n response = \"Hey #{name}, You are registered successfully!\"\n render plain: response\n end", "def register\r\n @user = User.new\r\n @visit_register = \"true\"\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @user }\r\n end\r\n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n @user.new_user_registration_email\n format.html { redirect_to login_path, notice: 'User was successfully created. Please see email for Instructions.'\n }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new, notice: 'Fix the errors.'}\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to login_url, notice: '注册成功,可以登录了!' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\t\n\t\tif @user.save\n\t\t\tredirect_to users_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { flash.now[:info] = t('users.create.success'); redirect_to root_path }\n format.json { render json: @user, status: :created, location: @user }\n else\n @btn_text = t('users.new.btn_signup')\n @user.password = ''\n @user.password_confirmation = ''\n format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:index_register].present?\n @user = User.new(:email => params[:email], :password => params[:password], :password_confirmation => params[:password])\n else\n @user = User.new(params[:user])\n end\n\n respond_to do |format|\n if @user.save\n session[:user_id] = @user.id\n UserMailer.verification_email(@user).deliver\n format.html { redirect_back_or_default links_path} #notice: 'User was successfully created.' \n format.json { render json: @user, status: :created, location: @user }\n else\n #MC -- this is a mess..\n format.html { redirect_to root_path, :notice => [:email, :password].collect{|i| @user.errors[i]}.flatten}\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def register\n if request.post?\n @user.update_attributes params['user']\n if @user.valid?\n after_register\n redirect_to welcome_path and return\n else\n if @user.errors[:email].include?(\"Already Taken\")\n # Look up the already-existing user, set the current tracker to that user, and send them along\n right_user = User.where(:email => @user.email).first\n @tracker.user_id = right_user.id\n cookies[:user_id] = right_user.id\n session[:email_pwd] = params['user']['email_password']\n @user = right_user\n @tracker.log(:existing_user_returned, \"Existing user #{@user.email} got into the landing path again.\")\n increment_page\n redirect_to welcome_path and return\n else\n @tracker.log(:failed_register, \"User creation failed with message: #{@user.errors.full_messages.join(\", \")}\")\n end\n end\n end\n render_path_page\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:notice] = \"Confirm Your account with the link in your mail...!\"\n render signup_user_page_users_path\n else\n redirect_to signup_user_page_users_path\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = \"正常に保存されました。\"\n redirect_to users_url\n else\n render 'new'\n end\n end", "def new\n @user = User.new\n # respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @user }\n # end\n render :users => \"signup\"\n end", "def create\n if params[:submit]\n @user = User.new(params[:user])\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to '/', notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n # UserMailer.registration_confirmation(@user).deliver\n # flash[:success] = \"Please confirm your email address to continue\"\n redirect_to root_url\n else\n flash[:error] = \"Ooooppss, something went wrong!\"\n render 'new'\n end\n \n end", "def registration(user)\n @user = user\n\n mail to: @user.email_id, subject: \"Successful Registration\"\n end", "def create\n\t\t@user = User.new(user_params)\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\t\t\t\t@user.send_activation_email\t\n\t\t\t\tformat.html {redirect_to root_url, notice: \"Thank you for signing up! You will have received a confirmation link in your email shortly which you must click before posting.\"}\n\t\t\t\t#Create User Profile on Successful User Save\n\t\t\t\t@user.create_profile(location: \"Add your location here.\", occupation: \"Add your occupation here.\", about_me: \"Write a little bit about yourself here!\", image_url: \"Add a link to a profile image here\")\n\t\t\telse\n\t\t\t\tformat.html { redirect_to signup_path, notice: \"Please enter a valid e-mail address and a matching password and password confirmation. Your password must contain 8 or more characters, a digit (0-9), at least one lower case character, at least one upper case character, and a symbol.\"}\n\t\t\tend\n\t\tend\n\tend", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { \n redirect_to root_path, :notice => \"An email has been sent to confirm your account.\" \n }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n @title = \"Register\"\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'El Usuario fue Creado Exitosamente.'}\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def register\n @title=\"Register\"\n if param_posted?(:user)\n \n #output goes to log file (log/development.log in development mode)\n #logger.info params[:user].inspect\n \n #output goes to browser\n #raise params[:user].inspect\n \n @user=User.new(params[:user])\n if @user.save\n @user.login!(session)\n flash[:notice] = \"User #{@user.screen_name} created!\"\n redirect_to_forwarding_url\n else\n @user.clear_password!\n end\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path, notice: t('users.update.updated')\n else\n @page_title = t(\"actions.new_user\")\n render action: 'new'\n end\n end", "def create\n @user = User.new(safe_params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to \"/\", notice: \"Account registered!\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p \"-------user signup------\"\n user = User.new(user_params)\n user.skip_confirmation!\n if user.save\n data = { success: true, message: \"Your account registered.\" }\n else\n key, val = user.errors.messages.first\n data = { success: false, message: user.errors.full_messages.first }\n end\n render json: data\n end", "def signup\n @user = User.new(params[:user])\n return unless request.post?\n if @user.save\n flash[:notice] = \"New user added!\"\n redirect_to :action=>'show', :id=>@user\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to root_url, :notice => \"Signed up!\"\n else\n render \"new\"\n end\n end", "def create\n\t\tuser = User.new()\n \n user.username = params[:username]\n user.password = params[:password]\n user.password_confirmation = params[:password_confirmation]\n user.email_address = params[:email_address]\n user.first_name = params[:first_name]\n user.last_name = params[:last_name]\n user.activation = SecureRandom.hex 16\n \n\t\tif user.save()\n UserMailer.activation_email(user).deliver_later!(wait: 15.seconds)\n\t\t\tpayload = {\n\t\t\t\terror: false,\n\t\t\t\tid: user.id\n\t\t\t}\n\t\t\trender status: 200, json: payload\n\t\telse\n\t\t\terrors = []\n\t\t\tuser.errors.keys.each do |key|\n\t\t\t\terrors << {field: key, message: user.errors.full_messages_for(key).first}\n\t\t\tend\n\t\t\tpayload = {\n\t\t\t\terror: true,\n\t\t\t\terrors: errors\n\t\t\t}\n\t\t\trender status: 200, json: payload\n\t\tend\n\tend", "def create\n\n if request.xhr? && params[:user]\n \t@user = User.new(params[:user])\n \tif params[:user][:hashed_password] == params[:user][:hashed_password_confirmation]\n\t \t@user.hashed_password = Auth.hash_password(@user.hashed_password)\n \t\tif @user.save\n\t\t\t\tUserMailer.registration_confirmation(@user).deliver\n\t\t\t\tsession[:user] = @user\n\t\t\t\trender :json => @user\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\n\t\trender :json => @user\n\t\treturn\n \t\n\telse if params[:user][:hashed_password].to_s != params[:user][:hashed_password_confirmation]\n \t\tredirect_to register_path, :flash => {:error => 'Podane hasła nie są identyczne'}\n \telse\n\t\t\t@user = User.new(params[:user])\n\t\t\t@user.hashed_password = Auth.hash_password(@user.hashed_password)\n\t\t\trespond_to do |format| \n\t\t\t\tif @user.save\n\t\t\t\t # confirmation email sending\n\t\t\t\t UserMailer.registration_confirmation(@user).deliver\n\t\t\t\t \n\t\t\t\t format.html { redirect_to(public_path, :flash => {:notice => 'Konto utworzone. Powiadomienie zostało wysłane na maila.'}) }\n\t\t\t\t #format.xml { render :xml => @user, :status => :created, :location => @user } \n\t\t\t\telse\n\t\t\t\t format.html { render :controller => \"public\", :action => \"register\" }\n\t\t\t\t format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n\t\t\t\tend \n\t\t\tend\n\t\tend\n end\n end", "def create\n\t\t\n\t\treg_params = params.require(:user).permit(\n\t\t\t:name, :email, :password, :password_confirmation\n\t\t)\n\n\t\tname = reg_params[:name]\n\t\temail = reg_params[:email]\n\t\tpassword = reg_params[:password]\n\t\tpassword_confirmation = reg_params[:password_confirmation]\n\n\t\tnew_user = User.new(\n\t\t\tname: name,\n\t\t\temail: email,\n\t\t\tpassword: password,\n\t\t\tpassword_confirmation: password_confirmation\n\t\t)\n\n\t\tif new_user.valid?\n\t\t\tnew_user.save(validate: false)\n\t\t\tflash[:success] = \"Account successfully created.\"\n\t\telse\n\t\t\tflash[:error] = new_user.errors.full_messages\n\t\tend\n\t\tredirect_to root_path\n\tend", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n Vlibmailer.deliver_registration_confirmation(@user)\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to( :action => :index) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def register\n # User inicialized with entry params.\n @user = User.new(params[:user])\n\n # if the user is succesfully saved, authenticate it, and redirect back to /Account.\n respond_to do |format|\n if @user.save\n user = User.authenticate(@user.email, @user.password)\n if user\n format.html { redirect_to account_page_path, notice: 'Account successfully created' }\n session[:user_id] = user.id\n end\n format.html { redirect_to root_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def new\n\t\tmissing unless WAYGROUND['ALLOW_SIGNUP']\n\t\t@user = User.new(params[:user])\n\t\t@user.time_zone = Time.zone.name unless params[:user]\n\t\t@user.valid? if params[:user]\n\t\t@page_title = 'New User Registration'\n\tend", "def create\n # Create a new user from the registrant\n # Keep the email the same\n @user = User.new(user_params)\n @user.email = @registrant.email\n \n # If the user is valid and saves, then destroy the\n # registrant, log the user in, and redirect to the home page\n if @user.save\n @registrant.destroy\n session[:user_id] = @user.id\n redirect_to root_url, notice: \"Welcome to Track Yo' Gas!\"\n else\n # Else, rerender the form\n render :new\n end\n end", "def create\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html {\n @user.generate_activation_token\n UserMailer.activation_token(@user).deliver\n flash[:success] = \"Benvingut a Rettiwet! ... T'hem enviat un mail per activar el teu account ... consulta'l en breu!\"\n redirect_to signin_path\n }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { \n @title = \"Sign Up\"\n render action: \"new\" \n }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # Diese Seite ist User-unabhängig\n @independent = true\n @action = \"Registrieren\"\n @header = {\"back\" => root_path, \"ajax\" => true, \"title\" => \"Registrieren\"}\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n\t\tif @user.save\n\t\t\tflash[:notice] = \"Your account has been successfully created!\"\n\t\t\tUserMailer.welcome_email(@user).deliver!\n\t\t\tredirect_to root_url\n\t\telse\n\t\t\tflash[:error] = get_all_errors\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n SignupMailer.signup_mail(@user).deliver_later\n format.html { redirect_to root_path, notice: 'User was successfully created.' }\n format.json { render root_path, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t if @user.save\n\t \tsession[:user_id] = @user.id\n\t \tredirect_to user_url(@user)\n\t else\n\t \tflash.notice = \"User Registration failed. Try again.\"\n\t \trender 'new'\n\t end\n\tend", "def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @user = User.new(user_params)\n\n recaptcha_token = params[:'g-recaptcha-response']\n\n\n if recaptcha_token.blank?\n logger.error('encountered user signup without recaptcha token -- failing request')\n return render file: 'public/400.html', layout: false, status: :bad_request\n end\n\n if !RecaptchaVerifier.new(recaptcha_token).success?\n logger.error('got a failed recaptcha response')\n return render file: 'public/400.html', layout: false, status: :bad_request\n end\n\n respond_to do |format|\n if @user.save\n SignupConfirmationMailer.confirmation_email(@user).deliver_now\n format.html { render :confirmation_pending }\n format.json do\n render :json => {\n :success => true,\n :msg => t(\"welcome.index.accounts.signup_success_msg\")\n }\n end\n else\n format.html { render :new }\n\n format.json do\n render :json => {\n :success => false,\n :msg => t(\"welcome.index.accounts.signup_failure_msg\"),\n :errors => @user.errors\n }\n end\n end\n end\n end", "def create\n @registration = Registration.new(registration_params)\n if @registration.save\n flash[:success] = \"Your registration was successful\"\n redirect_to success_reg_path\n else\n render 'new'\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n log_in @user\n flash.now[:notice] = 'Welcome!'\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n flash.now[:alert] = 'Something went wrong during registration process'\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_restaurant.users.new(params[:user])\n\n respond_to do |format|\n if @user.signup!(params)\n @user.deliver_invited_activation_instructions!(current_restaurant)\n current_restaurant.users << @user\n current_restaurant.save\n flash[:notice] = t('users.create.success')\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @form = Users::SignUpForm.from_params(params)\n\n Users::SignUp.call(@form) do\n on(:ok) { redirect_to dashboard_index_path }\n on(:invalid) { render :new}\n on(:race_non_unique_email) do\n flash.now[:alert] = t(:email_taken)\n render :new\n end\n end\n end", "def create\n #@user = User.new(params[:user])\n @user = User.new\n @user.city = params[:user][:city]\n @user.dob = params[:user][:dob]\n @user.email = params[:user][:email]\n @user.first_name = params[:user][:first_name]\n @user.gender = params[:user][:gender]\n @user.last_name = params[:user][:last_name]\n @user.state = params[:user][:state]\n @user.password = params[:user][:password]\n\n respond_to do |format|\n if @user.save\n # Send the welcome email message\n BvMailer.user_welcome_email(@user).deliver\n \n format.html { redirect_to '/userhome', :notice => 'Your account was successfully created. You should see an email from us soon.' }\n #format.json { render :json => @user, :status => :created, :location => @user }\n else\n @button_text = 'Sign up!'\n @show_tos = true\n format.html { render :action => \"new\" }\n #format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def signup\n case request.method\n when :post\n @user = User.new(params['user'])\n \n if @user.save \n session['user'] = User.authenticate(@user.login, params['user']['password'])\n flash['notice'] = _(\"Signup successful\")\n redirect_back_or_default :action => \"welcome\" \n end\n end \n end", "def create\n @user = User.create(user_params)\n unless @user.errors\n redirect_to :signup_success\n else\n render :new\n end\n\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n flash[:notice] = t('users.create.notice')\n redirect_to users_path\n else\n render :action => \"new\"\n end\n end", "def registration\n @saas = SETTINGS['saas_registration_mode']\n @user = User.new\n initialize_registration_form\n @errors = {\n :general => [],\n :subjects => [],\n :policies => [],\n :purchase => []\n }\n end", "def create\n @user = User.new(params[:user])\n if @user.save \n sign_in @user\n Notifier.welcome(@user.name, @user.email).deliver\n flash[:success] = \"welcome to sample app\"\n redirect_to cookies[:come_from] || user_path(@user)\n else\n @title = \"Signup\" \n render action: \"new\" \n #format.json { render json: @user }\n end\n end", "def create\n if params[:user][:password].blank?\n password = SecureRandom.base64(10)\n params[:user][:password] = password\n params[:user][:password_confirmation] = password\n end\n\n # Copied from devise-4.6.1/app/controllers/devise/registrations_controller.rb\n build_resource(sign_up_params)\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n # sign_up(resource_name, resource)\n # respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n # respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n\n resource.send_account_created_instructions\n else\n clean_up_passwords resource\n set_minimum_password_length\n # respond_with resource\n end\n @users = User.order(:last_name, :first_name)\n @user = current_user\n\n if @user.nil?\n redirect_to :root, notice: \"You have been signed up. Please check your email to set a password and complete your registration.\"\n else\n render :index\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n session[:user_id] = @user.id\n ::NotifierMailer.sign_up_mail(@user).deliver\n status = :ok\n else\n status = :unprocessable_entity\n end\n respond_with(@user, :status => status, :content_type => \"text/plain\")\n end", "def register\n @user=User.new(user_params)\n if @user.save\n render json: {status: true, message: 'User registered !', user: Api::UserSerializer.new(@user)}, status: 201\n else\n render json: {status: false, message: 'Failed to register !'}, status: 402\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n redirect_to @user, notice: 'Se creo un usuario exitosamente.'\n else\n render :new\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n flash[:notice] = \"You signed up successfully\"\n session[:user_id] = @user.id\n render \"welcome/index\"\n else\n flash[:notice] = \"Form is invalid\"\n render \"new\"\n end\n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html {redirect_to users_path, notice: 'User was successfully created.'}\n format.json {render :show, status: :created, location: @user}\n else\n format.html {render :new}\n format.json {render json: @user.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @title = 'Users Management'\n @breadcrumb = 'Users > New'\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html {\n if @user.user_type.name == 'customer'\n redirect_to login_url, notice: 'Registration is completed. Please login'\n else\n redirect_to @user, notice: 'User was successfully created.'\n end\n }\n format.json { render :show, status: :created, location: @user }\n else\n format.html {\n if @user.user_type.name == 'customer'\n redirect_to registrations_path, alert: @user.errors.full_messages.to_sentence\n else\n redirect_to new_user_path, alert: @user.errors.full_messages.to_sentence\n end\n }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @myuser = User.new(params[:user]) # 'user' is a dictionary created by the signup form and containing the new user's filled-in parameters\n if @myuser.save\n flash[:success] = \"Welcome to the Sample App!\"\n redirect_to @myuser\n else\n render 'new'\n end\n end", "def register\n email = request.headers['email'].to_s\n username = request.headers['username'].to_s\n password = request.headers['password'].to_s\n password_confirmation = request.headers['passconf'].to_s\n\n @user = User.new(email: email, username: username, password: password, password_confirmation: password_confirmation)\n if @user.save\n remember_token = RememberToken.create(token: User.encrypt(User.new_remember_token), user_id: @user.id, accessed_at: Time.now)\n respond_to do |format|\n format.json { render :json => remember_token }\n end\n else\n respond_to do |format|\n format.all{head :bad_request, :content_type => 'text/html'}\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to root_path, notice: 'Bienvenido a Red Social' }\n format.json { render :show, status: :created, location: root_path }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n case request.method\n when :get\n @user = User.new\n render\n return true\n when :post\n @user = User.new(params[:user])\n begin\n User.transaction(@user) do\n @user.new_password = true\n @user.verified = 1 # skip verification, because we are ADMIN!\n if @user.save\n flash[:notice] = 'User creation successful.'\n redirect_to :action => 'list'\n end\n end\n rescue Exception => e\n flash.now[:notice] = nil\n flash.now[:warning] = 'Error creating account: confirmation email not sent'\n logger.error e\n end\n end\n end", "def create\n @user = User.new\n @user.email=params[:name]\n @user.password=params[:password]\n\n respond_to do |format|\n if @user.save\n Regconfirm.regist_confirm(@user).deliver\n format.js { render :js=> \"regsuccess('\"+@user.email+\"');\"}\n else\n format.js { render :js=> \"regfail();\"}\n end\n end\n end" ]
[ "0.76302934", "0.7442694", "0.72688663", "0.7257634", "0.7227401", "0.71505135", "0.7111431", "0.7016545", "0.7011914", "0.70106393", "0.69532365", "0.6944105", "0.69163346", "0.6853445", "0.6845185", "0.67922807", "0.6788142", "0.67836565", "0.67671555", "0.6760115", "0.6756471", "0.6754819", "0.6747194", "0.6743051", "0.6726501", "0.6726251", "0.67213696", "0.6717935", "0.67168987", "0.6709053", "0.6703446", "0.67015696", "0.66948617", "0.6692966", "0.6690584", "0.6683573", "0.6671964", "0.66648436", "0.6653645", "0.66470045", "0.66391474", "0.66372484", "0.66360426", "0.66348594", "0.6632654", "0.6612893", "0.66128016", "0.66072917", "0.6596033", "0.6591193", "0.6585069", "0.65696186", "0.65624505", "0.65596235", "0.6524624", "0.6524421", "0.6520249", "0.65172106", "0.65138215", "0.6512645", "0.6508705", "0.6508495", "0.6503781", "0.6501759", "0.65006554", "0.6497692", "0.64883065", "0.6486884", "0.64846945", "0.6482388", "0.64822423", "0.6480872", "0.6477594", "0.64774966", "0.6476466", "0.64728117", "0.6469706", "0.64681584", "0.6462959", "0.64589024", "0.6456137", "0.6454599", "0.6450642", "0.6447316", "0.6446143", "0.6439161", "0.64351654", "0.64344305", "0.64341974", "0.6430674", "0.6428774", "0.641534", "0.6411933", "0.64116395", "0.64028686", "0.6401512", "0.6399162", "0.6387668", "0.63852537", "0.6381373", "0.6379824" ]
0.0
-1
PUT /users/:id Action method to send the "edit user" form.
def update @user = User.find(params[:id]) if @user.update_attributes(params[:user]) redirect_to @user, :notice => { :message => "Your profile was updated." } else render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(id, options={})\n request(:put, \"/users/#{id}.json\", default_params(options))\n end", "def edit\n # return an HTML form for editing a specific user\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n @user.update(user_params)\n end", "def edit\n # find the user we want to edit by id\n # this will send the @user to the edit page with a form\n @user = User.find(params[:id])\n end", "def edit\n \n @user = User.find(params[:id])\n \n end", "def edit\n # finds user with id of params[:id]\n @user = User.find params[:id]\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by(:id => the_user_id)\n\tend", "def edit(id)\n @user = flash[:form_data] || User[id]\n\n if @user.nil?\n flash[:error] = 'The specified user is invalid'\n redirect_referrer\n end\n\n @title = \"Edit #{@user.username}\"\n\n render_view(:form)\n end", "def edit\n\t\t@user = User.find(params(:id))\n\tend", "def edit\n\t@user = User.find(params[:id])\n\t@title = \"Edit user\"\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:user_id])\n end", "def edit\n @user = User.find(params[:user_id])\n end", "def edit\n # When a http GET request to '/users/1/edit' is received, have it render:\n # a view file with a form with user 1's information in the appropriate input field.\n @id = params[:id]\n @user = User.find(@id)\n end", "def edit\n @user = User.find params[:id]\n end", "def edit\n\t@user = User.find(params[:id])\nend", "def edit\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @userToEdit = User.find(params[:id])\n end", "def edit\n \t@user = User.find params[:id]\n end", "def edit\n # loads user from the database\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n @form_id = 'edit-form'\n \n respond_to do |fmt|\n fmt.html { render partial: 'form' }\n fmt.json { render json: @user }\n end\n end", "def edit\n # this finds the current user\n @user = User.find params[:id]\n end", "def update\n \t@user = User.find params[:id]\n\n \tif @user.update_attributes(user_params)\n \t\tredirect_to users_path, status: 303\n \telse\n \t\trender :edit\n \tend\n end", "def edit\n @user=User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n # @user は編集対象のユーザー\n # current_user はログインしているユーザー \n\n end", "def edit\n @user = User.find(params[:id])\n # just show me the form\nend", "def update\n @user = User.shod(params[:id])\n if @user.update(user_params)\n flash[:notice] = t('user_update')\n redirect_to user_path(@user)\n else\n render 'edit'\n end\n end", "def edit\n if params[:id].present?\n @user = User.find(params[:id])\n else\n super\n end\n end", "def edit\n @title = \"Edit user\"\n @user = User.find(params[:id])\n\n end", "def edit\n @page_title = 'Edit user'\n @user = User.find(params[:id])\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # find and update a specific user\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User updated'\n redirect_to users_path\n else\n flash[:error] = 'Update error'\n render :action => \"edit\", :id => @user\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n respond_to do |format|\n if @user.update(edit_user_params)\n format.html { render :show, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def edit\n @user = User.find(params[:id])\n\t case params[:form]\n\t when \"email\"\n\t render 'email'\n\t when \"password\"\n\t render 'password'\n\t else\n\t render :action => :edit\n\t end\n\tend", "def update\n\t\t@user = User.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @user.update_attributes(params[:user])\n\t\t\t\tformat.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @user_id = UserId.find(params[:id])\n\n respond_to do |format|\n if @user_id.update_attributes(params[:user_id])\n format.html { redirect_to @user_id, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_id.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n\tsession[:edit] = nil\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @user = User.find(params[:id])\n\n deny_wrong_user if !current_user?(@user)\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n # @user = User.find(params[:id]) -- not needed bc of correct_user\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:success] = \"Updated user\"\n redirect_to user_url(@user)\n else\n flash.now[:errors] = @user.errors.full_messages\n render :edit\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to edit_user_path(@user), :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @title = t('admin.users.edit.title')\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n js_notify message: t('admin.users.update.success'), type: 'alert-success', time: 2500\n render partial: 'user', content_type: 'text/html', locals: { user: @user }\n else\n render partial: 'edit', status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n flash[:success] = \"更新されました。\"\n redirect_to users_path\n else\n render 'edit'\n end\n end", "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n \n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to @user\n else\n # something went wrong, go back to the edit form with existing user info\n render 'edit'\n end # if\n end", "def update\n\t\t@user = User.find(params[:id])\n\n\t\tif @user.update(user_params)\n\t\t\tredirect_to @user\n\t\telse\n\t\t\trender 'edit'\n\t\tend\n\tend", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to \"/users/#{session[:user_id]}\", notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.88036335", "0.81233704", "0.8091911", "0.807804", "0.7990107", "0.79332477", "0.7912022", "0.7912022", "0.7894047", "0.7890822", "0.7890822", "0.7890822", "0.7890822", "0.78784555", "0.78749394", "0.7865389", "0.7857433", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.784533", "0.7825764", "0.7825764", "0.7819262", "0.78145343", "0.77815515", "0.77703804", "0.7725978", "0.771563", "0.7679099", "0.7637158", "0.76358336", "0.7613925", "0.7596101", "0.75899184", "0.7587108", "0.75695926", "0.75568277", "0.7533138", "0.75267994", "0.7507882", "0.74938697", "0.74629235", "0.7455533", "0.7454975", "0.7441716", "0.7415515", "0.74119943", "0.7408819", "0.7403861", "0.7397362", "0.7392105", "0.73875695", "0.7384288", "0.7382509", "0.7381291", "0.73595816", "0.7358508", "0.7350224", "0.7349734", "0.73440695", "0.7337453", "0.7336252", "0.7334066", "0.7332374", "0.7328507", "0.73278344", "0.73271877" ]
0.0
-1
DELETE /users/:id Action method to delete a specific user.
def destroy User.find(params[:id]).destroy redirect_to users_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(user_id)\n self.class.delete(\"/#{@api_ver}/users/#{user_id}\", default_options_to_merge_with)\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end", "def delete_user(id)\n get_user_byid(id).destroy\n end", "def delete_user(id)\n @user = User.destroy(id)\n end", "def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:success] = \"User has been deleted!\"\n redirect_to users_url\n end\n end", "def delete(id)\n begin\n User.filter(:id => id).destroy\n flash[:success] = 'The specified user has been removed'\n rescue => e\n Ramaze::Log.error(e)\n flash[:error] = 'The specified user could not be removed'\n end\n\n redirect_referrer\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path, :notice => \"User deleted.\"\n end", "def destroy\n @user = User.find(params[:id]).destroy\n flash[:success] = \"User deleted!\"\n redirect_to users_url\n end", "def delete_user(user_id:, params:)\n connection.delete(\"users/#{user_id}\", params).body\n end", "def destroy\n\t\tUser.find(params[:id]).destroy\n\t\tflash[:success] = \"User deleted\"\n\t\tredirect_to users_url\n\tend", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def delete_user(id)\n # accept an id input parameter\n # use the User Model class to remove the User associated with the `id` primary key from the database\n # (no return is required)\n (User.find_by(id: id)).destroy\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_path\n end", "def destroy\n\t\tUser.find(params[:id]).delete\n\t\tflash[:success] = \"Deleted current user\"\n\t\tredirect_to users_path\n\tend", "def destroy\n @user = get_user(params[:id])\n begin\n @user.destroy\n flash[:notice] = \"User #{@user.login_name} deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n user = User.find(params[:id])\n\tuser.destroy\n\tflash[:success] = \"User #{user.name} was deleted\"\n\tredirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n redirect_to users_path, :notice => 'User was successfully deleted.'\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n head :no_content\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path\n end", "def destroy\n\t\t@user = User.find(params[:id])\n\t\t@user.destroy\n\n\t\tredirect_to users_path\n\tend", "def destroy\n\tif User.find(params[:id]).destroy\n\t\tflash[:success] = \"User deleted.\"\n\telse\n\t\tflash[:error] = \"There was a problem deleting this user.\"\n\tend\n redirect_to users_url\n end", "def destroy\n @user = User.find(params[:id])\n\n if @user.destroy\n flash[:notice] = \"User was deleted\"\n else\n flash[:alert] = \"User could not be deleted\"\n end\n\n redirect_to users_path\n end", "def destroy\n @user = User.find(params[:id]) rescue nil\n\n if !@user.nil?\n @user.destroy\n redirect_to users_path\n else\n redirect_to users_path, alert: 'Erro ao deletar usuário'\n end\n end", "def destroy\n User.find(params[:id]).destroy\n respond_to do |format|\n flash[:success] = \"User was successfully deleted.\"\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n begin\n @user.delete\n flash[:notice] = \"User #{@user.fullname} deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted successfully.\"\n redirect_to users_url\n end", "def delete_user(user_id)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n path = \"#{users_path}/#{user_id}\"\n delete(path)\n end", "def destroy\n\t\t@user = User.find params[:id]\n\t\t@user.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to users_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @user = User.find(params[:id])\n begin\n @user.destroy\n flash[:notice] = \"User #{@user.name} deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \tUser.find(params[:id]).destroy\n \tflash[:success] = \"User deleted\"\n \tredirect_to users_url\n end", "def destroy\n @user = User.find(params[:id])\n begin\n @user.destroy\n flash[:notice] = \"User was deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @user = User.find(params[:id])\n end", "def delete\n @user = User.find(params[:id])\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n redirect_to(users_url)\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to root_path\n end", "def destroy\n @user = User.find(params[:id]).destroy\n redirect_to users_path\n end", "def destroy\n \tuser = User.find params[:id]\n \tuser.destroy\n\n \tredirect_to users_path, status: 303\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User was successfully deleted\"\n redirect_to users_url\n end", "def destroy\n\t\t@user = User.find(params[:id])\n\t\t@user.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(users_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def destroy\n\t\t@user = User.find(params[:id])\n\t\t@user.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(users_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def destroy\n\t\t@user = User.find(params[:id])\n\t\t@user.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(users_path) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def delete_user\n if (@user = find_user(params[:id]))\n do_delete_user(@user)\n flash[:notice] = \"User '#{@user.login}' has been deleted.\"\n end\n redirect_to :action => 'list'\n end", "def destroy\n userToBeRemoved = User.find(params[:id])\n userToBeRemoved.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to root_url\n end", "def destroy\n User.find(params[:id]).destroy\n\n flash[:success] = \"User destroyed.\"\n redirect_to users_url\n end", "def destroy\n\t @user = User.find(params[:id])\n\t @user.destroy\n\t redirect_to '/users'\n\tend", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted :(\"\n redirect_to users_url\n end", "def destroy\n logger.debug(\"user destroy\")\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\tUser.find(params[:id]).destroy\n\tflash[:success] = \"User destroyed.\"\n\tredirect_to users_path\n end", "def destroy\n @user = User.find params[:id]\n @user.destroy\n redirect_to users_path\n end", "def destroy\n User.find_by(id: params[:id]).destroy\n flash.now[:succes] = \"User was succesfully deleted\"\n redirect_to users_url\n end", "def delete\n @user = User.find(params[:id])\n @user.delete\n redirect_to root_path\n end", "def destroy\n User.find(params[:id]).destroy\n redirect_to users_url, notice: 'User was successfully destroyed.'\n end", "def destroy\n @user = User.find(params[:id])\n\n begin\n @user.destroy\n flash[:alert] = \"User #{@user.name} deleted\"\n rescue Exception => e\n flash[:alert] = e.message\n end\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User destroyed.\"\n redirect_to users_path\n end", "def destroy\n User.find(params[:id]).destroy\n\n flash[:success] = 'User destroyed.'\n redirect_to users_path\n end", "def destroy\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.destroy\n format.html { flash[:success] = I18n.t('human.text.success.delete_user'); redirect_to users_url}\n format.json { head :no_content }\n else\n format.html { flash[:error] = I18n.t('human.text.errors.delete_user'); redirect_to users_url}\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @user = User.find_by_id(params[:id])\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_path, :notice => \"User was successfully delete.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n user = User.get(params[:id])\n user.destroy if user\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def destroy\n user = User.find_by_id(params[:id])\n if user != nil\n @user = user\n user.destroy\n end\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.shod(params[:id])\n authorize! :delete, @user\n @user.destroy\n flash[:user_delete] = t('user_delete')\n redirect_to users_path\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n redirect_to users_path\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n redirect_to users_path\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n flash[:error] = \"Delete User #{user.userName}\"\n redirect_to '/users'\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User destroyed.\"\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n record_activity(\"deleted user: \" + @user.email)\n redirect_to users_path, :notice => \"User deleted\"\n end", "def delete_account_user(id)\n post(\"accountuser/#{id}?_method=DELETE\")\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully deleted.' }\n format.json { render json: { status: 'success', data: @user } }\n end\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def destroy\n User.find(params[:id]).destroy\n redirect_to users_path\n end", "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n flash[:notice] = 'User was successfully deleted.'\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n User.destroy params[:id]\n\n redirect_to users_path\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"Пользователь удален\"\n redirect_to users_path\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :ok }\n end\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def user_delete(user_id)\n res = http_delete(:uri=>\"/users/#{user_id}\", :fields=>x_cookie)\n return res.code\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.delete\n flash[:notice] = t('users.destroyed')\n redirect_to admin_users_url\n end", "def destroy\n # finds user with id of params[:id]\n @user = User.find params[:id]\n\n # destroys the user\n @user.destroy\n\n # redirects to index action\n redirect_to users_path\n end", "def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:notice] = \"User was destroyed.\"\n else\n flash[:notice] = \"There was a problem destroying the user.\"\n end\n redirect_to user_index_path\n end", "def delete_user\n client.delete(user)\n end", "def destroy\n User.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n end\n end" ]
[ "0.8521025", "0.8508597", "0.8504509", "0.8502862", "0.8423555", "0.8379913", "0.83688205", "0.83614385", "0.83509684", "0.83306587", "0.8323528", "0.8323184", "0.8271494", "0.8265458", "0.8265458", "0.8243315", "0.8242431", "0.824241", "0.82377124", "0.8235619", "0.82222617", "0.82222617", "0.82222617", "0.82222617", "0.82180256", "0.8210573", "0.82055175", "0.81882596", "0.81856465", "0.8175286", "0.8166381", "0.81659967", "0.81639445", "0.8157643", "0.81557244", "0.81538254", "0.81528395", "0.81412053", "0.81258684", "0.8123713", "0.8123713", "0.8107063", "0.8094836", "0.8089948", "0.8088478", "0.80864596", "0.80854577", "0.80854577", "0.80836666", "0.80761844", "0.8060414", "0.8054628", "0.8046416", "0.8042571", "0.8041165", "0.8037834", "0.803098", "0.8016762", "0.80167603", "0.80153835", "0.8010444", "0.8007241", "0.80042136", "0.80006516", "0.79997736", "0.79939276", "0.79923105", "0.798637", "0.7984715", "0.7976162", "0.7974991", "0.79749817", "0.79749817", "0.7973292", "0.7961683", "0.7959663", "0.7959454", "0.7959283", "0.7959283", "0.79501796", "0.79495335", "0.79488105", "0.7947119", "0.79429805", "0.7936484", "0.79362404", "0.79338294", "0.7933442", "0.7933442", "0.7933442", "0.7933442", "0.79281366", "0.7926253", "0.7924861", "0.79215115", "0.7918589", "0.79164153", "0.7908895", "0.79077655", "0.7907046" ]
0.8089882
44
convert Kata in input to Hira in output
def convertFile(inputName, outputName) # output file outputFile = File.open(outputName, "w") # input file File.open(inputName, "r") do |inputFile| pattern = /^(\S+?,){#{READ_FORM_INDEX}}/ while line = inputFile.gets startIndex = line[pattern].size endIndex = line.index(',', startIndex) x = startIndex while x < endIndex do kata = line[x,2] if $kataHira[kata] line[x,2] = $kataHira[kata] else puts "line: #{inputFile.lineno}, unkown katakana: #{kata}" end x += 2 end outputFile.puts line end end outputFile.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(input); end", "def kesha_maker(array)\n array.map {|item| item[2]=\"$\"}\n array\nend", "def hk(str)\n \"(?:#{Moji.kata_to_hira(str)}|#{Moji.hira_to_kata(str)})\"\n end", "def kesha_maker(array)\n kesha_array = []\n\n array.each do |name|\n name_array = name.split(\"\")\n name_array[2] = \"$\"\n result = name_array.join\n kesha_array << result\n end\n\n kesha_array\nend", "def kesha_maker(array)\n kesha_array = []\n array.each do |name|\n name[2] = \"$\"\n kesha_array << name\n end\n kesha_array\nend", "def hiv_protease(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[23] = ['L',['I']]\n sdrm[24] = ['L',['I']]\n sdrm[30] = ['D',['N']]\n sdrm[32] = ['V',['I']]\n sdrm[46] = ['M',['I','L','V']]\n sdrm[47] = ['I',['V','A']]\n sdrm[48] = ['G',['V','M']]\n sdrm[50] = ['I',['V','L']]\n sdrm[53] = ['F',['L']]\n sdrm[54] = ['I',['V','L','M','T','A','S']]\n sdrm[73] = ['G',['S','T','C','A']]\n sdrm[76] = ['L',['V']]\n sdrm[82] = ['V',['A','T','S','F','L','C','M']]\n sdrm[83] = ['N',['D']]\n sdrm[84] = ['I',['V','A','C']]\n sdrm[85] = ['I',['V']]\n sdrm[88] = ['N',['D','S']]\n sdrm[90] = ['L',['M']]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n end\n end\n return out_hash\nend", "def preprocess(input)\n\n tmp = String.new(input)\n output = Hash.new\n\n #print \"tmp is '#{tmp}' and its gsub is '#{tmp.gsub(/[^a-zA-Z ]/, ' ')}'\"\n\n tmp.gsub(/[^a-zA-Z ]/, ' ').split.each do |word|\n stem = word.downcase.stem\n next if stem.length < 3\n output[stem] ||= 0\n output[stem] += 1\n end\n\n return output\n end", "def kesha_maker(array)\n array.map do |elem|\n word_splice = elem.split(\"\")\n word_splice[2] = \"$\"\n word_splice.join\n end\nend", "def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend", "def kesha_maker(array)\n array.collect do |element|\n split_element_to_array = element.split(\"\")\n split_element_to_array[2] = \"$\"\n joined_array = split_element_to_array.join\n joined_array\n end\nend", "def get_roman_equiv input\n\tval = \"\"\n\tcredithash, codehash = read_input \n\tinput.split(\" \").each { |r| \n\t\tif codehash.has_key?(r)\n\t\t\tval = val + codehash[r]\n\t\tend\n\t}\n\treturn val\nend", "def kesha_maker(a)\n a.each {|b| b[2] = \"$\"}\nend", "def preprocess_input(input)\nend", "def pig_latin_sentence(sentence)\n y = sentence\n x = sentence.split\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n t = \"t\"\n h = \"h\"\n qu = \"qu\"\n\n x.map do |word|\n first_letter = word[0]\n if vowels.include?(first_letter)\n word << \"way\"\n elsif word.include?(t && h)\n word << t\n word << h\n word.slice!(0..1)\n word << \"ay\"\n elsif word.include?(qu)\n word << qu\n word.slice!(0..1)\n word << \"ay\"\n else\n word << first_letter\n word.slice!(0)\n word << \"ay\"\n end\n x[0].capitalize!\n end\n\n x.join(\" \")\nend", "def to_num(input)\n result = 0\n #iterate on roman number hash\n MAPPING.each do |k,v|\n while input.index(k) == 0 #if \"CL\".index(\"C\") == 0\n result += v #assign value of current hash key\n input.slice!(0) #remove string \"C\" from input and so on\n end\n end\n result\n end", "def kesha_maker(array)\n kesha_array = []\n i = 0\n array.each do |name|\n kesha_array.push(name[2] = \"$\")\n end\nend", "def convert\n match('term', 'name')\n\n # API-specific parameters.\n equal('key', 'open_duka_api_key')\n\n output\n end", "def kesha_maker(array)\n kesha = []\n array.each do |i|\n i[2] = \"$\"\n kesha << i\n end\n kesha\nend", "def kesha_maker(any_array)\n any_array.each do |str|\n str[2] = \"$\"\n end\n \n end", "def kesha_maker(array)\n array.each { |word| word[2] = \"$\" }\nend", "def kesha_maker(array)\n\tnew_array = []\n\tarray.each do|name|\n\t\tname[2] = \"$\"\n\t\tnew_array << name\n\tend\n\tnew_array\nend", "def kesha_maker(array)\n array.map do |string|\n string[2] = \"$\"\n end\n array\nend", "def aetiology_processor(line)\n\t\tline.strip.scan(/^(Aetiology and immunopathogenesis|Aetiology)$/) do |match|\n\t\t\treturn [\"on\",line.strip]\n\t\tend\n\t\treturn [\"off\",line.strip]\n\tend", "def preprocess_input(input)\n input\nend", "def kesha_maker(array)\n array.map do |element|\n element[2] = \"$\" #change 3rd character of each element to a dollar sign\n element #and return the changed element\n end\nend", "def kesha_maker(array)\n array.each do |name|\n name[2] = '$'\n end\nend", "def solution4(input)\n end", "def kesha_maker(array)\n new_array = []\n array.each do |key|\n new_array = key[2] = \"$\"\n end\nend", "def knot_codes(input, row)\n seed = [ 17, 31, 73, 47, 23 ]\n \"#{input}-#{row}\".each_char.map(&:ord).concat seed\nend", "def process_data(data)\n print_headline\n tmp = data.dup\n\n # TELNETコマンドを抽出しダンプする.\n tmp.gsub!(/#{IAC}(\n [#{DONT}#{DO}#{WONT}#{WILL}].|\n #{SB}.(#{IAC}#{IAC}|[^#{IAC}])*#{IAC}#{SE}|\n [#{NOP}-#{GA}#{0.chr}-#{239.chr}]\n )/xon){\n case $1[0].chr\n when DONT; print \"> IAC DONT #{$1[1]}\\n\"\n when DO ; print \"> IAC DO #{$1[1]}\\n\"\n when WONT; print \"> IAC WONT #{$1[1]}\\n\"\n when WILL; print \"> IAC WILL #{$1[1]}\\n\"\n when SB ; print \"> IAC SB #{$1[1]} #{$1[2..-3].dump} IAC SE\\n\"\n else ; print \"> IAC #{$1[1]}\\n\"\n end\n }\n\n # 残りの部分を出力.\n tmp.each { |line| print line.dump, \"\\n\" } if tmp.size > 0\n end", "def kesha_maker(array)\n array.each do |word|\n word[2] = \"$\"\n end\nend", "def convert_hiragana\n dup = self.hiragana.dup\n self.reading = Japanese::HiraganaConverter.convert_hiragana(dup)\n end", "def tosjis(str)\n ::NKF::nkf('-sm', str)\n end", "def translate(arr)\n vowels = %w{a e i o u y}\n consonants = %w{b c d f g h j k l m n p q r s t v w x y z}\n\n a = arr.split.map do |word| \n if vowels.include?(word[0])\n word + \"ay\"\n elsif word[0..1] == \"qu\"\n word[2..-1] + \"quay\"\n elsif word[0..2] == \"sch\"\n word[3..-1] + \"schay\"\n elsif word[0..2] == \"squ\"\n word[3..-1] + \"squay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1]) && consonants.include?(word[2])\n word[3..-1] + word[0..2] + \"ay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + \"ay\"\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + \"ay\"\n end\n end\n\n a.join(\" \")\nend", "def kesha_maker(array)\n array.each do |item|\n item[2] = \"$\" # (note: assign value)\n end\n return array\nend", "def pig_latin(string)\n # Your code goes here\n arr = string.split(\" \")\n\n pig_latin = []\n arr.map do |x|\n if arr.length == 1\n return x[0] + \"ay\"\n else\n \n word = x[1..-1] + x[0] + \"ay\"\n pig_latin.push(word)\n end\n \n end\n return pig_latin.join(\" \")\nend", "def kesha_maker(array)\n array.each do |kesha|\n kesha[2] = \"$\"\nend\nend", "def use_eliza_rules(input)\n\n \t\t# process the input into an array of words\n \t\t# want to avoid matching on fragments, like \"no\" of \"if\"\n \t\ttokens = input.downcase.chomp.split(/ /)\n\t\t\n # default response\n \t\tresponse = \"Go on.\"\n\t\t\n \t\t# try all the rules\n \t\t@eliza_rules.keys.each do |curr_key|\n\n \t\t\tcurrent_rule = curr_key.to_s\n\t\t\t\n \t\tif check_match(tokens, current_rule)\n \t\t \n \t\t\t\t# get the list of responses for this rule\n \t\t\t\tresponses = @eliza_rules[current_rule]\n \t\t\n \t\t\t\t# choose a response from the list of responses for the rule \n \t\t\t\tresponse = responses[rand(responses.length)]\n\t\t\t\n \t\t\t\t# pull out the interesting bit of the input - after the word we key in on.\t\n \t\t\t\tstarting_point = input.downcase.index(current_rule)\n\t\n \t\t\t\ttmp_sliced = input.slice(starting_point + current_rule.length + 1, input.length)\n\t\t\t\t\n \t\t\t\tif not(tmp_sliced.eql?(nil))\n \t\t\t\t\t# change the viewpoint of the result\n \t\t\t\t\ttmp_sliced = switch_viewpoint(tmp_sliced)\n\t\t\t\n \t\t\t\t\t# apply the transformation, from ?y to the rest of the text\n \t\t\t\t\tresponse = response.sub(/REPLACEME/, tmp_sliced)\t\n \t\t\t\tend\n \t\t end\n \t\tend\n\t\t\n \t response\n \tend", "def kesha_maker(array)\n array.collect { |x| x[2] = \"$\" }\n array\nend", "def typoglycemiaSentence(input)\n words = input.split(' ')\n words.map! { |x| typoglycemiaWord(x) }\n words.join(\" \")\nend", "def kaprekar(input)\n\t\tdef aux (input, count)\n\t\t\tif input == 6174\n\t\t\t\tcount\n\t\t\telse\n\t\t\t\tcount += 1\n\t\t\t\tarray = input.to_s.split(\"\").sort\n\t\t\t\tasc_number = array.join.to_i\n\t\t\t\tdesc_number = array.reverse.join.to_i\n\t\t\t\taux(desc_number - asc_number, count)\n\t\t\tend\n\t\tend\n\t\taux(input, 0)\n\tend", "def kesha_maker(array)\n new_arr= []\n array.each do |word|\n word.split(\" \")\n word[2] = \"$\"\n new_arr << word\n end\nend", "def kesha_maker(array)\n array.each do |string|\n string[2] = \"$\"\n end\n array\nend", "def piglatinize(input)\n\t\t#splits the input to capture multiple words\n\t\tif input.split(\" \").length == 1\n\t\t\tpiglatinize_single_word(input)\n\t\telse piglatinize_sentence(input)\n end\n\tend", "def huffman_codes(text)\n w = Hash.new(0)\n text.each_char { |c| w[c] += 1 }\n tree = w.each_pair.map { |letter, weight| [weight, letter] }\n tree = get_tree(tree)\n print_code(tree)\nend", "def pigatize\n # Declare the output string\n piglatin = ''\n # Split the input text into words and loop with .each,\n # and 'word' as the iterator variable.\n split(' ').each do |word|\n # Check to see if the first letter is a vowel, else it's a consonant.\n if starts_with_vowel(word[0])\n # Add onto the output string with += and add an extra space.\n piglatin += word + 'way'\n else\n piglatin += word[1..-1] + word[0] + 'ay' + ' '\n end\n end\n # Added a .chomp here to get rid of any trailing space.\n piglatin.chomp\n end", "def hcv_ns5a(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[28] = ['M',['T']]\n sdrm[30] = ['L',['H','K','R','Q','A','S','D']]\n sdrm[31] = ['L',['M','V','F']]\n sdrm[32] = ['P',['L']]\n sdrm[44] = ['K',['R']]\n sdrm[58] = ['H',['D','P','S']]\n sdrm[64] = ['T',['A','S']]\n sdrm[77] = ['P',['A','S']]\n sdrm[78] = ['R',['K']]\n sdrm[79] = ['T',['A']]\n sdrm[83] = ['T',['M']]\n sdrm[85] = ['S',['N','H','Y']]\n sdrm[92] = ['A',['P','T','K','E']]\n sdrm[93] = ['Y',['C','F','H','N']]\n sdrm[107] = ['K',['T','S']]\n sdrm[121] = ['I',['V']]\n sdrm[135] = ['T',['A']]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n end\n end\n return out_hash\nend", "def kata_params\n params.require(:kata).permit(:title, :meaning, :interpretation)\n end", "def stamina(hash={})\n\t\t$_TAGHASH_['stamina'], $_TAGHASH_['Mstamina'] = hash['text'].scan(/\\d+/o)\n\tend", "def convert (str)\r\n# REFERENCE : Using logic from this source https://stackoverflow.com/questions/13498688/pig-latin-method-translation\r\n alpha = ('a'..'z').to_a\r\n vowels = %w[a e i o u]\r\n consonants = alpha - vowels\r\n lstr = str.downcase\r\n if vowels.include?(lstr[0])\r\n str + 'way'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1]) && consonants.include?(lstr[2])\r\n str[3..-1] + str[0..2] + 'ay'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1])\r\n str[2..-1] + str[0..1] + 'ay'\r\n elsif consonants.include?(lstr[0])\r\n str[1..-1] + str[0] + 'ay'\r\n else\r\n str # return unchanged\r\n end\r\nend", "def tuc(arg)\n h = Hash.[](\".\"=>\"&#x0F0B;\", \"/\"=>\"&#x0F0D;\", \";\"=>\"&#x0F14;\", \"\"=>\"\",\n \"ka\"=>\"&#x0F40;\", \"kha\"=>\"&#x0F41;\", \"ga\"=>\"&#x0F42;\", \"nga\"=>\"&#x0F44;\",\n \"ca\"=>\"&#x0F45;\", \"cha\"=>\"&#x0F46;\", \"ja\"=>\"&#x0F47;\", \"nya\"=>\"&#x0F49;\",\n \"ta\"=>\"&#x0F4F;\", \"tha\"=>\"&#x0F50;\", \"da\"=>\"&#x0F51;\", \"na\"=>\"&#x0F53;\",\n \"pa\"=>\"&#x0F54;\", \"pha\"=>\"&#x0F55;\", \"ba\"=>\"&#x0F56;\", \"ma\"=>\"&#x0F58;\",\n \"tsa\"=>\"&#x0F59;\", \"tsha\"=>\"&#x0F5A;\", \"dza\"=>\"&#x0F5B;\", \"wa\"=>\"&#x0F5D;\",\n \"zha\"=>\"&#x0F5E;\", \"za\"=>\"&#x0F5F;\", \"'a\"=>\"&#x0F60;\", \"ya\"=>\"&#x0F61;\",\n \"ra\"=>\"&#x0F62;\", \"la\"=>\"&#x0F63;\", \"sha\"=>\"&#x0F64;\", \"sa\"=>\"&#x0F66;\",\n \"ha\"=>\"&#x0F67;\", \"a\"=>\"&#x0F68;\",\n # numbers !!! better include number_generator\n \"0\"=>\"&#x0F20;\", \"1\"=>\"&#x0F21;\", \"2\"=>\"&#x0F22;\", \"3\"=>\"&#x0F23;\",\n \"4\"=>\"&#x0F24;\", \"5\"=>\"&#x0F25;\", \"6\"=>\"&#x0F26;\", \"7\"=>\"&#x0F27;\",\n \"8\"=>\"&#x0F28;\", \"9\"=>\"&#x0F29;\",\n # vowel signs\n \".e\"=>\"&#x0F7A;\", \".i\"=>\"&#x0F72;\", \".o\"=>\"&#x0F7C;\", \".u\"=>\"&#x0F74;\",\n # double vowel signs\n \"E\" => \"&#x0F7B;\", \"O\" => \"&#x0F7D;\",\n # subscribed characters\n \"x_ka\"=>\"&#x0F90;\", \"x_kha\"=>\"&#x0F91;\", \"x_ga\"=>\"&#x0F92;\", \"x_nga\"=>\"&#x0F94;\",\n \"x_ca\"=>\"&#x0F95;\", \"x_cha\"=>\"&#x0F96;\", \"x_ja\"=>\"&#x0F97;\", \"x_nya\"=>\"&#x0F99;\",\n \"x_ta\"=>\"&#x0F9F;\", \"x_tha\"=>\"&#x0F90;\", \"x_da\"=>\"&#x0FA1;\", \"x_na\"=>\"&#x0FA3;\",\n \"x_pa\"=>\"&#x0FA4;\", \"x_pha\"=>\"&#x0FA5;\", \"x_ba\"=>\"&#x0FA6;\", \"x_ma\"=>\"&#x0FA8;\",\n \"x_tsa\"=>\"&#x0FA9;\", \"x_tsha\"=>\"&#x0FAA;\", \"x_dza\"=>\"&#x0FAB;\", \"x_wa\"=>\"&#x0FAD;\",\n \"x_zha\"=>\"&#x0FAE;\", \"x_za\"=>\"&#x0FAF;\", \"x_'a\"=>\"&#x0F71;\", \"x_ya\"=>\"&#x0FB1;\",\n \"x_ra\"=>\"&#x0FB2;\", \"x_la\"=>\"&#x0FB3;\", \"x_sha\"=>\"&#x0FB4;\", \"x_sa\"=>\"&#x0FB6;\",\n \"x_ha\"=>\"&#x0FB7;\", \"x_a\"=>\"&#x0FB8;\",\n # superscribed character\n \"ra_x\"=>\"&#x0F62;\",\n # revered letters\n \"Ta\"=>\"&#x0F4A;\", \"Tha\" => \"&#x0F4B;\", \"Da\" => \"&#x0F4C;\", \"Na\" => \"&#x0F4E;\",\n \"Sha\" => \"&#x0F65;\")\n\n result = h[arg]\n if result != nil\n erg = result\n else\n erg = \"\"\n end\n return erg\n end", "def pig_latin(word)\n if word.slice(0..1) == \"qu\"\n word = word.slice(1..word.length) + word.slice(0) + \"ay\" \n elsif word.slice(0) == \"a\" ||\n word.slice(0) == \"e\" ||\n word.slice(0) == \"i\" ||\n word.slice(0) == \"o\" ||\n word.slice(0) == \"u\"\n word += \"way\"\n elsif word.slice(1) == \"a\" ||\n word.slice(1) == \"e\" ||\n word.slice(1) == \"i\" ||\n word.slice(1) == \"o\" ||\n word.slice(1) == \"u\"\n word = word.slice(1..word.length) + word.slice(0) + \"ay\"\n elsif word.slice(2) == \"a\" ||\n word.slice(2) == \"e\" ||\n word.slice(2) == \"i\" ||\n word.slice(2) == \"o\" ||\n word.slice(2) == \"u\"\n word = word.slice(2..word.length) + word.slice(0..1) + \"ay\"\n else word.slice(3) == \"a\" ||\n word.slice(3) == \"e\" ||\n word.slice(3) == \"i\" ||\n word.slice(3) == \"o\" ||\n word.slice(3) == \"u\"\n word = word.slice(3..word.length) + word.slice(0..2) + \"ay\"\n end\n return word\nend", "def romanize(input)\n\n raise ArgumentError, 'can not encode negative number' if input < 0\n raise ArgumentError, 'can not encode zero' if input == 0\n\n #Creating a Hash that pointing different numbers to different characters.\n romkeys = {1000 => 'M', 900 => 'CM', 500 => 'D', 400 => 'CD', 100 => 'C', 90 => 'XC', 50 => 'L', 40 => 'XL', 10 => 'X', 9 => 'IX', 5 => 'V', 4 => 'IV' ,1 => 'I'}\n\n #Creating a variable that have the format string, for storing the different characters.\n output = ' '\n\n #Looping until the input is zero.\n until input == 0\n\n #Looping thro the different keys and values of the hash.\n romkeys.each do |key, value|\n if input >= key\n\n #If the input was 5 this will result as 'V' after that the output will save the V and loop thro until it's nothing left.\n output += value\n\n #This subtract the key value to make the loop end.\n input -= key\n\n #This just ending the loop.\n break\n end\n end\n end\n\n #Returning the output string.\n return output\nend", "def to_nato(words)\nn = words.downcase\nn = n.split(\"\")\nhash = { \"a\"=>\"Alfa\",\"b\"=>\"Bravo\",\"c\"=>\"Charlie\",\"d\"=>\"Delta\",\"e\"=>\"Echo\", \"f\"=>\"Foxtrot\", \"g\"=>\"Golf\", \"h\"=>\"Hotel\", \"i\"=>\"India\", \"j\"=>\"Juliett\", \"k\"=>\"Kilo\",\"l\"=>\"Lima\", \"m\"=>\"Mike\", \"n\"=>\"November\", \"o\"=>\"Oscar\", \"p\"=>\"Papa\", \"q\"=>\"Quebec\", \"r\"=>\"Romeo\", \"s\"=>\"Sierra\", \"t\"=>\"Tango\", \"u\"=>\"Uniform\", \"v\"=>\"Victor\", \"w\" =>\"Whiskey\", \"x\"=>\"Xray\", \"y\"=>\"Yankee\", \"z\"=>\"Zulu\", \"!\" => \"!\", \"?\" => \"?\", \".\" => \".\"}\nn = n -[\" \", nil]\nn = n.map {|x| p hash[x] }\nn.join(\" \")\n#hash[n]\nend", "def energetic_encoding(str, hsh)\n new_str = str.split(\"\").map do |char| \n if hsh.key?(char)\n hsh[char] \n elsif char != \" \"\n \"?\"\n else\n char\n end\n end\n\n new_str.join(\"\")\nend", "def galactic_words_to_roman # returns roman representaion \n\t\t@pattern.split.map{ |e| @@galactic_words_roman_symbol_assignments[e] }.join\n\tend", "def galactic_words_to_roman # returns roman representaion \n\t\t@pattern.split.map{ |e| @@galactic_words_roman_symbol_assignments[e] }.join\n\tend", "def pig_latin_sentence(sentence)\r\n\tnew_sentence = \"\"\r\n\tsentence.split.each do |word|\r\n\t\tif word[0].downcase =~ /[aeiou]/\r\n\t\t\tword << \"way\" \r\n\t\telse\r\n\t\t\tn = /[aeiou]/.match word.downcase\r\n\t\t\tword = n.to_s + n.post_match + n.pre_match + \"ay\"\r\n\t\tend\r\n\t\tnew_sentence << word\r\n\tend\r\n\tnew_sentence\r\nend", "def piglatin(data)\n if data\n # + means space\n words = data.split(\"+\")\n piglatin_words = []\n\n words.each do |word|\n # vowel?\n if word[0].match(/[a,e,i,o,u]/)\n word = word + \"way\"\n # 'qu' at front?\n elsif word[0,2] == \"qu\"\n word = word[2..-1] + \"quay\"\n # consonant?\n elsif word[0].match(/[^a,e,i,o,u,0-9]/)\n word = word[1..-1] + word[0] + \"ay\"\n end\n\n piglatin_words.push(word)\n end\n\n piglatin_words.join(\" \")\n else\n \"Error: need input\"\n end\n end", "def hilite(s)\n MATCHERS.each do |k, v|\n s = s.gsub(v) do |m|\n roast(taggify(m, k))\n end\n end\n return unroast(s)\nend", "def pig_it(str)\n \twords_from_sentence = str.split\n \twords_from_sentence.map! do |word|\n \t\tif word.length == 1\n \t\t\tif word.match? (/[^\\w]/)\n \t\t\t\tword\n \t\t\telse\n \t\t\t\tword << 'ay'\n \t\t\tend\n \t\telsif word[-1].match? (/[^\\w]/)\n \t\t\tlast_letter = word.slice!(-1)\n \t\t\tword << word.slice!(0) << 'ay' << last_letter\n \t\telse\n \t\t\tword << word.slice!(0) << 'ay'\n \t\tend\n \tend\n \twords_from_sentence.join(' ')\nend", "def tidy(data); end", "def kana2kana(str1)\n result = []\n str2 = Kana2rom::hira_to_kata(str1)\n str3 = Kana2rom::kata_to_hira(str1)\n result << str1\n result << str2 if str2.length > 0 and str1 !=str2\n result << str3 if str3.length > 0 and str2 !=str3 and str3 != str1\n return result\n end", "def q_and_a(token_size = TOKEN_SIZE, char_clean = CHAR_CLEAN, test = \"n\")\n prepend_char = \"\"\n if test == \"y\"\n prepend_char = \"test-\"\n end\n token_index = create_index(token_size,char_clean)\n unique_index = token_index.delete_if{|key, value| value.size > 1}\n output_dir = Pathname.new(OUTPUT_DIR)\n output_dir.mkpath if !output_dir.exist?\n token_file = File.open(File.join(OUTPUT_DIR, prepend_char + TOKEN_FILENAME), \"w\")\n word_file = File.open(File.join(OUTPUT_DIR, prepend_char + WORD_FILENAME), \"w\")\n unique_index.each do |key, value|\n token_file.puts key\n word_file.puts value\n end \n token_file.close\n word_file.close\n end", "def pig_latin(word)\n\nif word[0..0] =~ /[A-Z]/\n is_cap = true\nelse\n is_cap = false\nend\n\n if word.slice(0) == \"a\" ||\n word.slice(0) == \"e\" ||\n word.slice(0) == \"i\" ||\n word.slice(0) == \"o\" ||\n word.slice(0) == \"u\"\n word += \"way\"\n\n elsif word.slice(0..1) == \"qu\"\n word = word.slice(2..word.length) + word.slice(0..1) + \"ay\"\n\n elsif word.slice(1) == \"a\" ||\n word.slice(1) == \"e\" ||\n word.slice(1) == \"i\" ||\n word.slice(1) == \"o\" ||\n word.slice(1) == \"u\"\n word = word.slice(1..word.length) + word.slice(0) + \"ay\"\n\n elsif word.slice(2) == \"a\" ||\n word.slice(2) == \"e\" ||\n word.slice(2) == \"i\" ||\n word.slice(2) == \"o\" ||\n word.slice(2) == \"u\"\n word = word.slice(2..word.length) + word.slice(0..1) + \"ay\"\n\n elsif word.slice(3) == \"a\" ||\n word.slice(3) == \"e\" ||\n word.slice(3) == \"i\" ||\n word.slice(3) == \"o\" ||\n word.slice(3) == \"u\"\n word = word.slice(3..word.length) + word.slice(0..2) + \"ay\"\n\n end\n if is_cap == true\n return word.capitalize\n else\n return word\n end\nend", "def kesha_maker(array)\n array.each do |a|\n a[2] = \"$\"\n end\nend", "def kesha_maker(arr)\n arr.each { |str| str[2] = \"$\" }\nend", "def decode_metal_value\n\tromanhash = {}\n\tcredithash, codehash = read_input\n\tcredithash.each_pair { |k,v|\n\t\troman_str = get_roman_equiv(k)\n\t\tvalidate_roman(roman_str)\n\t\tromanhash[ roman_str + \" \" + k.split(\" \").last ] = v\n\t\t}\n\treturn romanhash\nend", "def preprocess(input)\n\t\tperform_substitutions(input)\n\tend", "def preprocess_2(data) \n data[1] = {A: 1, B: 0, C: 0 }\n data[2] = {A: 0, B: 1, C: 0 }\n data\nend", "def k_asignacion!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n\n\n\n type = K_ASIGNACION\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 381:3: ( 'add' | 'div' | 'mul' | 'sub' | 'pot' | 'sqrt' | 'copy' | 'del' | 'porcent' )\n # at line 381:3: ( 'add' | 'div' | 'mul' | 'sub' | 'pot' | 'sqrt' | 'copy' | 'del' | 'porcent' )\n alt_7 = 9\n case look_7 = @input.peek( 1 )\n when 0x61 then alt_7 = 1\n when 0x64 then look_7_2 = @input.peek( 2 )\n\n if ( look_7_2 == 0x69 )\n alt_7 = 2\n elsif ( look_7_2 == 0x65 )\n alt_7 = 8\n else\n raise NoViableAlternative( \"\", 7, 2 )\n\n end\n when 0x6d then alt_7 = 3\n when 0x73 then look_7_4 = @input.peek( 2 )\n\n if ( look_7_4 == 0x75 )\n alt_7 = 4\n elsif ( look_7_4 == 0x71 )\n alt_7 = 6\n else\n raise NoViableAlternative( \"\", 7, 4 )\n\n end\n when 0x70 then look_7_5 = @input.peek( 2 )\n\n if ( look_7_5 == 0x6f )\n look_7_11 = @input.peek( 3 )\n\n if ( look_7_11 == 0x74 )\n alt_7 = 5\n elsif ( look_7_11 == 0x72 )\n alt_7 = 9\n else\n raise NoViableAlternative( \"\", 7, 11 )\n\n end\n else\n raise NoViableAlternative( \"\", 7, 5 )\n\n end\n when 0x63 then alt_7 = 7\n else\n raise NoViableAlternative( \"\", 7, 0 )\n\n end\n case alt_7\n when 1\n # at line 381:4: 'add'\n match( \"add\" )\n\n\n when 2\n # at line 381:10: 'div'\n match( \"div\" )\n\n\n when 3\n # at line 381:16: 'mul'\n match( \"mul\" )\n\n\n when 4\n # at line 381:22: 'sub'\n match( \"sub\" )\n\n\n when 5\n # at line 381:28: 'pot'\n match( \"pot\" )\n\n\n when 6\n # at line 381:34: 'sqrt'\n match( \"sqrt\" )\n\n\n when 7\n # at line 381:41: 'copy'\n match( \"copy\" )\n\n\n when 8\n # at line 381:48: 'del'\n match( \"del\" )\n\n\n when 9\n # at line 381:54: 'porcent'\n match( \"porcent\" )\n\n\n end\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n\n end", "def to_hib\n n = 0\n s = to_f\n while s >= Kb do s /= Kb ; n += 1 end\n format = n.zero? ? \"%4d \" : \"%6.1f\"\n (format % s) + (PREFIXES[ n]||\"?\") + \"iB\"\n end", "def unify_voiced_katakana!(src)\n halfwidth =\n Characters::HALFWIDTH_VOICED_KATAKANA +\n Characters::HALFWIDTH_SEMI_VOICED_KATAKANA\n fullwidth =\n Characters::VOICED_KATAKANA +\n Characters::SEMI_VOICED_KATAKANA\n halfwidth.zip(fullwidth).inject(src) do |str, (h, f)|\n str.gsub!(h, f) || str\n end\n end", "def nyc_pigeon_organizer_two(data)\n# MAP will return a changed value, EACH will return original\n\n # coerce each name as the key in the hash\n #access all names\n #names - ['']\n # unique list of names\n names = data.values[0].values.flatten.uniq\n\n # use name as key in hash - fill in with scaffold hash\n initial_structure = names.each_with_object ({}) do |name, hash|\n hash[name] = {color: [], gender: [], lives:[]}\n end\n\n names.each_with_object(initial_structure) do |pigeon, my_initial_structure|\n attributes = data.keys\n attributes.each do |attribute|\n data[attribute].each do |value, names|\n if names.include?(pigeon)\n my_initial_structure[pigeon][attribute] << value.to_s\n end\n end\n end\n end\n\n\nend", "def convert(str)\n\t\t@result=convert_han(convert_words(str))\n\t\t# @result=convert_words(str)\n\t\t@result.gsub!(\" #%\",\"\")\n\t\t@result.gsub!(\"%# \",\"\")\n\t\t@result\n\tend", "def token!\n # at line 1:8: ( T__48 | T__49 | T__50 | T__51 | T__52 | CATEGORY_KEY | LINK_KEY | X_OCCI_ATTRIBUTE_KEY | X_OCCI_LOCATION_KEY | ACTION | ACTIONS | AMPERSAND | AT | ATTRIBUTES | BACKSLASH | CATEGORY | CLASS | COLON | DASH | DOT | EQUALS | GT | HASH | KIND | LINK | LOCATION | LT | MIXIN | PERCENT | PLUS | QUESTION | QUOTE | REL | SCHEME | SELF | SEMICOLON | SLASH | SQUOTE | TERM | TILDE | TITLE | UNDERSCORE | LBRACKET | RBRACKET | LOALPHA | UPALPHA | DIGIT | WS | ESC )\n alt_5 = 49\n alt_5 = @dfa5.predict( @input )\n case alt_5\n when 1\n # at line 1:10: T__48\n t__48!\n\n when 2\n # at line 1:16: T__49\n t__49!\n\n when 3\n # at line 1:22: T__50\n t__50!\n\n when 4\n # at line 1:28: T__51\n t__51!\n\n when 5\n # at line 1:34: T__52\n t__52!\n\n when 6\n # at line 1:40: CATEGORY_KEY\n category_key!\n\n when 7\n # at line 1:53: LINK_KEY\n link_key!\n\n when 8\n # at line 1:62: X_OCCI_ATTRIBUTE_KEY\n x_occi_attribute_key!\n\n when 9\n # at line 1:83: X_OCCI_LOCATION_KEY\n x_occi_location_key!\n\n when 10\n # at line 1:103: ACTION\n action!\n\n when 11\n # at line 1:110: ACTIONS\n actions!\n\n when 12\n # at line 1:118: AMPERSAND\n ampersand!\n\n when 13\n # at line 1:128: AT\n at!\n\n when 14\n # at line 1:131: ATTRIBUTES\n attributes!\n\n when 15\n # at line 1:142: BACKSLASH\n backslash!\n\n when 16\n # at line 1:152: CATEGORY\n category!\n\n when 17\n # at line 1:161: CLASS\n class!\n\n when 18\n # at line 1:167: COLON\n colon!\n\n when 19\n # at line 1:173: DASH\n dash!\n\n when 20\n # at line 1:178: DOT\n dot!\n\n when 21\n # at line 1:182: EQUALS\n equals!\n\n when 22\n # at line 1:189: GT\n gt!\n\n when 23\n # at line 1:192: HASH\n hash!\n\n when 24\n # at line 1:197: KIND\n kind!\n\n when 25\n # at line 1:202: LINK\n link!\n\n when 26\n # at line 1:207: LOCATION\n location!\n\n when 27\n # at line 1:216: LT\n lt!\n\n when 28\n # at line 1:219: MIXIN\n mixin!\n\n when 29\n # at line 1:225: PERCENT\n percent!\n\n when 30\n # at line 1:233: PLUS\n plus!\n\n when 31\n # at line 1:238: QUESTION\n question!\n\n when 32\n # at line 1:247: QUOTE\n quote!\n\n when 33\n # at line 1:253: REL\n rel!\n\n when 34\n # at line 1:257: SCHEME\n scheme!\n\n when 35\n # at line 1:264: SELF\n self!\n\n when 36\n # at line 1:269: SEMICOLON\n semicolon!\n\n when 37\n # at line 1:279: SLASH\n slash!\n\n when 38\n # at line 1:285: SQUOTE\n squote!\n\n when 39\n # at line 1:292: TERM\n term!\n\n when 40\n # at line 1:297: TILDE\n tilde!\n\n when 41\n # at line 1:303: TITLE\n title!\n\n when 42\n # at line 1:309: UNDERSCORE\n underscore!\n\n when 43\n # at line 1:320: LBRACKET\n lbracket!\n\n when 44\n # at line 1:329: RBRACKET\n rbracket!\n\n when 45\n # at line 1:338: LOALPHA\n loalpha!\n\n when 46\n # at line 1:346: UPALPHA\n upalpha!\n\n when 47\n # at line 1:354: DIGIT\n digit!\n\n when 48\n # at line 1:360: WS\n ws!\n\n when 49\n # at line 1:363: ESC\n esc!\n\n end\n end", "def kesha_maker(array)\n array.each do |item|\n item[2] = \"$\"\n end\nend", "def kesha_maker(array)\n array.each do |item|\n item[2] = \"$\"\n end\nend", "def pig_latin(string)\n words_array = string.split(\" \")\n modified_words_array = \"\"\n words_array.map do |word|\n \n if word =~ /\\A[aeiou]/\n word += \"ay\"\n modified_words_array << word + \" \"\n \n # regex to grab three consonants took from http://stackoverflow.com/questions/18406509/using-regexp-to-check-whether-a-string-starts-with-a-consonant\n # word starts with three consonants or \"[const.]qu\" ie. \"square\", \"squat\"\n elsif ( word =~ /\\A(?i:(?![aeiou])[a-z]){3}/ ) || ( word =~ (/\\b[^aeiou]+qu/) ) # word =~ /\\A[^aeiou]+qu{3}/ )\n without_first_three = word[3..-1]\n without_first_three += word[0..2] + \"ay\"\n if word[0] == word[0].upcase\n without_first_three.capitalize!\n end\n modified_words_array << without_first_three + \" \"\n \n # word starts with two consonants or \"qu\" ie. \"quake\", \"quart\" \n elsif ( word =~ /\\A(?i:(?![aeiou])[a-z]){2}/ ) || ( word =~ /\\A[qu]{2}/ )\n without_first_two = word[2..-1]\n without_first_two += word[0..1] + \"ay\"\n if word[0] == word[0].upcase\n without_first_two.capitalize!\n end\n modified_words_array << without_first_two + \" \"\n \n # word starts with consonant \n elsif word =~ /\\A[^aeiou]/\n without_first = word[1..-1]\n without_first += word[0] + \"ay\"\n if word[0] == word[0].upcase\n without_first.capitalize!\n end\n modified_words_array << without_first + \" \"\n end\n \n end\n modified_words_array.chomp(\" \")\nend", "def translate s\n \n words = s.split.map{|word|\n if %w(a e i o u).include?(word[0])\n word << \"ay\"\n elsif %w(thr sch squ).include?(word[0..2])\n word[3..-1] << (word[0..2] << \"ay\")\n elsif %w(ch qu br th).include?(word[0..1])\n word[2..-1] << word[0..1] << \"ay\" \n else\n word[1..-1] << (word[0] << \"ay\") \n end\n }\n words.join(\" \")\n\nend", "def kesha_maker(array)\n array.collect do |character|\n character[2] = \"$\"\n character\n end\nend", "def text2hash (stanza_name,query_names, tax_id)\n result = {}\n #load each query result file\n query_names.each do |query_name|\n input_file = \"#{PREPARE_DIR}/text/#{query_name}/#{tax_id}.txt\"\n File.open(\"#{input_file}\") do |f|\n while line = f.gets\n # convert a line to hash object\n columns_info = get_query_columns(stanza_name, query_name)\n gene_text_data = gene_obj_mapping(line, query_name, columns_info)\n\n gene_id = gene_text_data[\"gene_id\"]\n if result[gene_id] == nil\n result[gene_id] = gene_text_data\n else\n result[gene_id].merge!(gene_text_data) do |key, oldval, newval|\n if key.to_s == 'gene_id' || key.to_s == '@id' # no repeat of tax id\n oldval\n else # concat text data\n oldval.concat(newval).uniq\n end\n end\n end\n end\n end\n end\n result\nend", "def converter( array)\n #define hash to convert binary to pixel \n pixels = { \"1\" => \"*\", \"0\" => \" \" }\n output = Array.new\n #iterate to input array \n for i in array\n #populate output array with converted hex to binary values\n #use string hex function to convert input array of hex characters to binary\n output.push(array.to_s[i].hex.to_s(2)) \n end\n #iterate to output array\n for i in output\n # use puts to ouput each element of the output array on a new line\n #use gsub function to replaces binary representation of hex input to pixel hash representation \n puts output.to_s[i].gsub(/[01]/, '1' => '*', '0' => ' ')\n end\nend", "def pig_it text\n text.split(' ').map do |word|\n if word == \"?\" || word == \"!\" || word == \".\" || word == \",\"\n word\n else\n (word[1..(word.length-1)] + word[0] + \"ay\")\n end\n end.join(' ')\nend", "def translate(input)\n #outStr = input.downcase\n outStr = input\n\n # replace words\n # still need to add punctuation and missing words\n outStr = single_words(outStr)\n\n # prepend and append\n outStr = prepend_and_append(outStr)\n\n # punctuation\n #outStr = punctuation(outStr)\n\n # change tags like &god or &bodypart, etc\n outStr = change_tags(outStr)\n\n\n puts outStr\n end", "def translate(str)\n\n\n\n # Vowels to consider\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # Special cases to consider\n two_letter_consonants = [\"ch\", \"sh\", \"qu\", \"th\", \"br\"]\n three_letter_consonants = [\"thr\", \"sch\", \"squ\"]\n\n words = str.split(\" \")\n result = []\n\n words.each do |word|\n if vowels.include?(word[0])\n result.push word << \"ay\"\n else \n if three_letter_consonants.include? (word[0] + word[1] + word[2])\n first_three_letters = word.slice!(0,3)\n \n # Add letters to end of word with 'ay'\n result.push word << first_three_letters << 'ay'\n elsif two_letter_consonants.include?(word[0] + word[1])\n first_two_letters = word.slice!(0,2)\n result.push word << first_two_letters << \"ay\"\n else \n first_letter = word.slice!(0)\n \n # Add first letter to end of word with 'ay'\n result.push word << first_letter << 'ay'\n end #End of special consonant check\n end \n end \n return result.join(\" \")\nend", "def transform; end", "def tojis; Kconv.tojis(self) end", "def a_string_to_hash\n self.remove_characters\n self.correct_formatting\n self.answer_split\n self.answer_join\n self.sort_answers\n self.arr_to_hash\n return self.data\n end", "def pig_latin_name(word)\n# and returns a new string (pig latinified)\n# need to define vowels (can be an array?)\n vowels_list = vowels\n# break word into letters\n letters = word.split(\"\")\n# iterate through each letter of the word\n# until we hit a vowel\n letters.each do |letter|\n\n # check if first letter is vowel or consonant\n if is_consonant?(letter)\n # move it to the end\n removed_consonant = letters.shift\n letters = letters + removed_consonant.split\n #\n else\n letters.push(\"ay\")\n return letters.join\n end\n\n # then add \"ay\" at the end and return\n end\n\nend", "def main\n\tatts = Hash.new\n\tdata_hash = Hash.new\n\tanswer = nil\n\treading_data = false\n\n\t# Reading the input\n\tloop do\n\t\tline = $stdin.readline.chomp\n\t\tsplitted = line.split ' '\n\n\t\tif splitted[0] != '%' and !splitted[0].nil?\t\t# If it's not a comment\n\n\t\t\tif splitted[0].casecmp(\"@attribute\") == 0\n\t\t\t\tprev = answer\n\t\t\t\tvalues = splitted[2..-1].join.gsub(/[{}]/, '').split(',')\n\t\t\t\tanswer = {splitted[1] => values}\n\t\t\t\tatts.merge!(prev) if !prev.nil?\n\n\t\t\telsif splitted[0].casecmp(\"@data\") == 0\n\t\t\t\treading_data = true\n\n\t\t\telsif reading_data\n\t\t\t\tdata = splitted[0].split ','\n\t\t\t\tdata_hash.merge!({data[0..-2] => data[-1]})\n\n\t\t\tend\n\t\t\t\t\t\t\t\t\t\n\t\tend\n\t\tbreak if $stdin.eof?\n\tend\n\n\t# print atts.inspect\n\t# puts \"\"\n\t# print answer\n\t# puts \"\"\n\t# print data_hash\n\t# puts \"\"\n\n\ttotal_entropy = entropy(answer, data_hash)\n\n\tsplit(atts, data_hash, total_entropy, answer, [], 0)\t\n\nend", "def toonify |accent, sentence|\n\n\nend", "def k_tipobusqueda!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n\n\n\n type = K_TIPOBUSQUEDA\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 461:3: ( 'like' | 'equals' | 'dif' )\n # at line 461:3: ( 'like' | 'equals' | 'dif' )\n alt_16 = 3\n case look_16 = @input.peek( 1 )\n when 0x6c then alt_16 = 1\n when 0x65 then alt_16 = 2\n when 0x64 then alt_16 = 3\n else\n raise NoViableAlternative( \"\", 16, 0 )\n\n end\n case alt_16\n when 1\n # at line 461:4: 'like'\n match( \"like\" )\n\n\n when 2\n # at line 461:11: 'equals'\n match( \"equals\" )\n\n\n when 3\n # at line 461:20: 'dif'\n match( \"dif\" )\n\n\n end\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 52 )\n\n\n end", "def nato(word)\n original = []\n value = ''\n letters = {\n \"A\"=> \"Alpha\", \"B\"=> \"Bravo\", \"C\"=> \"Charlie\",\n \"D\"=> \"Delta\", \"E\"=> \"Echo\", \"F\"=> \"Foxtrot\",\n \"G\"=> \"Golf\", \"H\"=> \"Hotel\", \"I\"=> \"India\",\n \"J\"=> \"Juliett\",\"K\"=> \"Kilo\", \"L\"=> \"Lima\",\n \"M\"=> \"Mike\", \"N\"=> \"November\",\"O\"=> \"Oscar\",\n \"P\"=> \"Papa\", \"Q\"=> \"Quebec\", \"R\"=> \"Romeo\",\n \"S\"=> \"Sierra\", \"T\"=> \"Tango\", \"U\"=> \"Uniform\",\n \"V\"=> \"Victor\", \"W\"=> \"Whiskey\", \"X\"=> \"X-ray\",\n \"Y\"=> \"Yankee\", \"Z\"=> \"Zulu\"\n }\n arr = word.split('')\n arr.each do |letter|\n value = letters.values_at(letter.upcase)\n original.concat(value)\n end\n original.join(' ')\nend", "def stuff(input)\n\twords = input.split(\" \")\n\n\twords.each do |x| \n\t\tif x == 'the' || x == 'of' || x == 'and' || x == 'is' || x == 'a'\n\t\t\telse\n\t\t\t\t@acronym << x.to_s.chars.first.upcase + \".\"\n\t\tend\n\tend\nend", "def energetic_encoding(sentence, hash)\n chars = sentence.split(\"\")\n new_sent = chars. map do |char|\n if hash.has_key?(char)\n hash[char]\n elsif char == \" \"\n \" \"\n else\n \"?\"\n end\n end \n new_sent.join(\"\")\nend", "def mta\n {\n\t:line_N => [ \"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\" ],\n\t:line_L => [ \"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\" ],\n\t:line_6 => [ \"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\" ]\n }\nend", "def keys (input)\n\tinput.each do |cohort, num|\n\tputs \"#{cohort} : #{num}\" \n\tend\n\t\nend", "def do_kamada_kawai\n kamada_kawai\n normalize_graph\n end", "def transform_root_header_data(ret)\n if ret['header']['手番']\n ret['initial']['data']['color'] = '下先'.include?(ret['header']['手番']) ? 0 : 1\n ret['header'].delete('手番')\n else\n ret['initial']['data']['color'] = 0\n end\n ret['initial']['data']['hands'] = [\n make_hand(ret['header']['先手の持駒'] || ret['header']['下手の持駒']),\n make_hand(ret['header']['後手の持駒'] || ret['header']['上手の持駒'])\n ]\n %w(先手の持駒 下手の持駒 後手の持駒 上手の持駒).each do |key|\n ret['header'].delete(key)\n end\n end" ]
[ "0.5797281", "0.55033416", "0.54750913", "0.5437725", "0.54106593", "0.5397252", "0.5396641", "0.53965914", "0.5274228", "0.52720547", "0.5245476", "0.5235038", "0.52141094", "0.5209762", "0.5170602", "0.51662713", "0.5155222", "0.51332945", "0.51222545", "0.5111949", "0.5105272", "0.5085549", "0.508544", "0.50771326", "0.50710535", "0.5060485", "0.5059232", "0.5053901", "0.50520307", "0.50385827", "0.50306344", "0.5006719", "0.49982733", "0.49963433", "0.49827832", "0.4963051", "0.49612758", "0.49585086", "0.49482414", "0.49472386", "0.49471185", "0.49419892", "0.49419641", "0.49370766", "0.49354118", "0.49192208", "0.49165708", "0.49089685", "0.49065083", "0.49021998", "0.48973912", "0.48931432", "0.48927528", "0.48927107", "0.48754716", "0.4869056", "0.4869056", "0.48677108", "0.48664716", "0.48574635", "0.4856956", "0.48513058", "0.48450842", "0.48348004", "0.48328722", "0.48323268", "0.48277795", "0.48270968", "0.48245132", "0.48143458", "0.48133004", "0.48107967", "0.48080632", "0.48065355", "0.48048547", "0.48038983", "0.47999904", "0.47999904", "0.47996745", "0.4795484", "0.4793687", "0.47905722", "0.4789102", "0.4788369", "0.47880745", "0.47846088", "0.47841293", "0.4784119", "0.47766906", "0.47663578", "0.47659174", "0.4762766", "0.47568643", "0.47567314", "0.4756049", "0.47552946", "0.47548357", "0.4753584", "0.4751239", "0.4751079" ]
0.5815053
0
Use callbacks to share common setup or constraints between actions.
def set_subtask @subtask = Subtask.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 trusted parameter "white list" through.
def subtask_params params.require(:subtask).permit(:description, :cost_time, :task_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "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 filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n 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 additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Devise methods Authentication key(:username) and password field will be added automatically by devise.
def configure_permitted_parameters added_attrs = [:email, :first_name, :last_name] devise_parameter_sanitizer.permit :sign_up, keys: added_attrs devise_parameter_sanitizer.permit :account_update, keys: added_attrs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_key\n send(Devise.authentication_keys.first)\n end", "def user_key\n send(Devise.authentication_keys.first)\n end", "def fetch_details_from_devise\n self.username = 'devise_user'\n self.save\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username])\n end", "def authentication\n {:username => @username, :password => @password}\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :password])\n end", "def auth\n { \"username\" => @username }\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username]) \n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\nend", "def authentication_method\n super\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username])\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username])\n end", "def configure_sign_up_params\n # devise_parameter_sanitizer.permit(:sign_up, :keys => [:username])\n devise_parameter_sanitizer.for(:sign_up) << :username\n end", "def authenticate_name\n super\n end", "def configure_sign_in_params\n # devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])\n devise_parameter_sanitizer.permit(:sign_in) do |params|\n params.permit(:username, :password, :password_confirmation)\n end\n end", "def login_attribute\n super\n end", "def sinkitoroku\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username])\n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :name])\n end", "def user_authentication\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_in, keys: %i[login username password])\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[username email password password_confirmation])\n devise_parameter_sanitizer.permit(:account_update, keys: %i[username email password password_confirmation])\n end", "def password_field; end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :username])\n end", "def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in, keys: [:email, :password])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :profile_photo, :job_type, :username, :email])\n devise_parameter_sanitizer.permit(:sign_in, keys: [:login, :password,:password_confirmation])\n # devise_parameter_sanitizer.permit(:account_update, keys: [:username, :email, :profile_photo, :password, :password_confirmation, :current_password, :mobile_number])\n end", "def configure_sign_in_params\n devise_parameter_sanitizer.for(:sign_in) << :username\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [\n :username,\n :name,\n :middle_name,\n :last_name\n ])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :username\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:firstname, :lastname, :username ])\n devise_parameter_sanitizer.permit(:account_update, keys: [:firstname, :lastname, :username])\n end", "def configure_permitted_parameters\n \tdevise_parameter_sanitizer.permit(:sign_up, keys: %i[first_name last_name username technology_id secondary_technology])\n end", "def ensure_password\n self.password ||= Devise.friendly_token[0,20]\n end", "def create\n super do\n resource.authentication_token = Devise.friendly_token\n resource.save\n end\n end", "def with_authentication_hash(hash)\n self.authentication_hash = {:email => hash[:username]}\n self.password = hash[:password]\n end", "def keys\n [:name, :username, :email, ]\n end", "def create\n data = authencation_params\n user = User.find_for_database_authentication(username: data[:username]) \n if user.blank? || !user.valid_password?(data[:password])\n return show_error_message('#error-description', t('devise.failure.invalid'), '.auth-btn')\n end\n super\n end", "def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:username)\n end\n end", "def extend_fields\n if username.blank?\n # Synthesize a unique username from the email address or fullname\n n = 0\n startname = handle if (startname = email.sub(/@.*/, '')).blank?\n self.username = startname\n until (User.where(username: username).empty?) do\n n += 1\n self.username = startname+n.to_s\n end\n end\n # Provide a random password if none exists already\n self.password = email if password.blank? # (0...8).map { (65 + rand(26)).chr }.join\n self.fullname = \"#{first_name} #{last_name}\" if fullname.blank? && !(first_name.blank? || last_name.blank?)\n end", "def configure_sign_up\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :avatar])\n end", "def password\n Devise.friendly_token[0, 20]\n end", "def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:username, :email)\n end\n end", "def authentication_keys\n @authentication_keys ||= User.authentication_keys\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:firstname,:middlename,:lastname,:contact,:birthday,:gender, :bio, :username])\n end", "def configure_devise_params\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:username, :email, :password, :password_confirmation)\n end\n end", "def configure_sign_in_params\n # devise_parameter_sanitizer.for(:sign_in) << :attribute\n devise_parameter_sanitizer.permit(:sign_in, keys: [:user, :password])\n end", "def configure_permitted_parameters\n \tdevise_parameter_sanitizer.permit( :sign_up, keys: [:name, :password, :password_confirmation, :remember_me] )\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :password, :remember_me) }\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:realname, :username, :email, :phone, :password, :password_confirmation, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:realname, :email, :phone, :password, :password_confirmation, :current_password) }\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :first_name, :last_name])\n devise_parameter_sanitizer.permit(:account_update, keys: [:username, :first_name, :last_name])\n end", "def configure_devise_permitted_parameters\n\t\tdevise_parameter_sanitizer.permit(:sign_up, keys: %i[name username email password password_confirmation])\n\t\tdevise_parameter_sanitizer.permit(:sign_in, keys: %i[login password remember_me])\n\t\tdevise_parameter_sanitizer.permit(:account_update, keys: %i[name username email current_password password password_confirmation])\n\tend", "def configure_sign_in_params\n devise_parameter_sanitizer.for(:sign_in) << [:login, :username]\n end", "def auth_hash\n OmniAuth::Utils.deep_merge(super(), {\n 'uid' => @uid,\n 'user_info' => {\n 'name' => @username\n }\n })\n end", "def password_field\n self.password\n end", "def user_params\n params.permit(:password, :email, :username)\n end", "def password\n super\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:name, :username, :email, :password)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:name, :email, :password, :password_confirmation, :current_password)\n end\n end", "def authenticate(username, password)\n @username = username\n @password = password\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up) do |u|\n u.permit(:username, :email, :password, :password_confirmation,\n :remember_me)\n end\n devise_parameter_sanitizer.permit(:sign_in) do |u|\n u.permit(:login, :username, :email, :password, :remember_me)\n end\n devise_parameter_sanitizer.permit(:account_update) do |u|\n u.permit(:username, :email, :password, :password_confirmation,\n :current_password)\n end\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation, :current_password)\n end\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[pseudo email password password_confirmation])\n end", "def username\n username = self.name + \" \" + self.email\n\t end", "def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in, keys: [:email, :password])\n end", "def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in, keys: [:email, :password])\n end", "def configure_perimitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys:[:fname, :lname, :username, :seller])\n devise_parameter_sanitizer.permit(:account_update, keys:[:fname, :lname, :username, :seller])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) }\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me, :user_level) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) }\n end", "def authentication_information\n password.nil? ?\n { :method => :anonymous } :\n { :method => :simple, :username => username, :password => password }\n end", "def authentication_profile\n super\n end", "def auth(username, password)\n @username, @password = username, password\n end", "def configure_permitted_parameters\n # For additional fields in app/views/devise/registrations/new.html.erb\n devise_parameter_sanitizer.permit(:sign_up, keys: [:nickname])\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :fname, :lname, :avatar, :bio, :street, :city, :state, :country, :lat, :lng])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for :account_update do |user|\n user.permit :email, :password, :password_confirmation, :current_password, :username\n end\n\n devise_parameter_sanitizer.for :sign_in do |user|\n user.permit :login, :password, :remember_me\n end\n\n devise_parameter_sanitizer.for :sign_up do |user|\n user.permit :email, :password, :password_confirmation, :remember_me, :username\n end\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:username, :firstname, :lastname, :email, :password) }\n devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:username, :firstname, :lastname, :bio, :email, :password, :current_password, :password_confirmation) }\n end", "def auth_options\n # Use Devise's first authentication method (e.g. email or username) to\n # get the sign in parameter\n authn_method = serialize_options(resource)[:methods].first\n authn_value = sign_in_params[authn_method]\n\n # Look for a user matching that email/username\n user = resource_class.find_for_authentication(authn_method => authn_value)\n\n super.merge(\n sign_in_params: sign_in_params.except(\"password\"),\n user: user\n )\n end", "def generate_password\n self.password = Devise.friendly_token.first(8)\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up) { |user| user.permit(:username, :email, :password, :password_confirmation) }\n devise_parameter_sanitizer.permit(:sign_in) { |user| user.permit(:username, :email, :password, :password_confirmation) }\n devise_parameter_sanitizer.permit(:account_update) { |user| user.permit(:email, :password, :password_confirmation) }\n end", "def configure_account_update_params\n # devise_parameter_sanitizer.permit(:account_update, :keys => [:username])\n devise_parameter_sanitizer.for(:account_update) << :username\n end", "def form_credentials\n {\n username: @username,\n password: @password,\n }\n end", "def authenticate(username, password)\n end", "def getkey\n user = User.try_to_login(params[:username], params[:password])\n if user.nil?\n render :text => \"Not Authorized\", :status => 403\n return\n elsif user.new_record?\n render :text => \"Not Authorized\", :status => 403\n return\n else \n render :text => user.api_key\n end\n end", "def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end", "def auth\n {:basic_auth => {:username => id, :password => password}}\n end", "def configure_sign_in_params\n devise_parameter_sanitizer.for(:sign_in).push(:username, :login, :domain)\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:username, :address, :first_name, :last_name, :email, :password)}\n\n devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:username, :address, :email, :password, :current_password)}\n end", "def authenticating_with\n @authenticating_with ||= :password\n end", "def auth\n Hash['type' => @auth_type,\n 'username' => @user,\n 'password' => @password]\n end", "def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :username, :first_name, :last_name, :birthday, :password, :password_confirmation, :remember_me) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :first_name, :last_name, :age, :country_code, :language_first, :language_second, :sex, :address, :birthday, :password, :password_confirmation, :current_password) }\n end", "def configure_permitted_parameters\n \t\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :role, :year, :password])\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :email, :role, :year, :password, :current_password])\n end", "def configure_permitted_parameters\n \t\tdevise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n \tend", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:workshop_key])\n end", "def configure_permitted_params\n devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation)}\n devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) }\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:api_key, :home_zip_code, :full_name, :found_option])\n end", "def principal_authentication_context(username, password)\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:first_name, :middle_initial, :last_name, :username, :type, :email, :password, :password_confirmation) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:logon, :username, :email, :password, :remember_me) }\n end", "def password\n return self[:password]\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\n end", "def Authentication\n call('', '')\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name])\n end", "def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in, keys: [:email,:password,:remember_me])\n end", "def configure_permitted_parameters\n added_attrs = [ :username, :email, :password, :password_confirmation ]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n devise_parameter_sanitizer.permit :sign_in, keys: added_attrs\n end", "def signin_params\n puts \"\\n******* signin_params *******\"\n params.permit(:username, :password)\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :username\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(\n :email, :password,\n :password_confirmation, :current_password,\n :address, :phone, :latitude, :longitude) }\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first, :last, :email, :password])\n end" ]
[ "0.7034508", "0.7034508", "0.6708608", "0.6698475", "0.66124535", "0.66058046", "0.6540802", "0.64991665", "0.64823794", "0.648107", "0.648107", "0.6417993", "0.6414918", "0.6413039", "0.63835347", "0.6364552", "0.635979", "0.63527083", "0.6326488", "0.62807804", "0.62553966", "0.6228358", "0.620923", "0.6207308", "0.61987615", "0.61942303", "0.6163822", "0.61502755", "0.61385095", "0.61371166", "0.61245835", "0.61105555", "0.60960555", "0.6094193", "0.60869294", "0.6071593", "0.6070165", "0.6058346", "0.6046744", "0.60466075", "0.60455626", "0.6042865", "0.6015885", "0.6012086", "0.6007686", "0.60000265", "0.5990359", "0.59890884", "0.5976742", "0.59755796", "0.59680694", "0.5959948", "0.5958448", "0.5953928", "0.59537774", "0.5951197", "0.59494334", "0.5948015", "0.5948015", "0.5945433", "0.59366393", "0.59331053", "0.5916347", "0.59066683", "0.5906136", "0.5905742", "0.58958", "0.589529", "0.5892244", "0.5886688", "0.5883858", "0.5878036", "0.5873846", "0.58678627", "0.5865056", "0.58644074", "0.5856773", "0.5855181", "0.58503413", "0.5849484", "0.5843987", "0.5842773", "0.58415824", "0.58410937", "0.58405495", "0.5820951", "0.5819271", "0.5815763", "0.58146226", "0.58140874", "0.5810965", "0.58103865", "0.58048123", "0.58048123", "0.5800791", "0.5796745", "0.57948625", "0.5790106", "0.5779103", "0.57750267", "0.57677644" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def note_params params.require(:note).permit(:description,:instance_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 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
MSSID MSSName LastUpdated PREFIXTREESELECTOR DIGITPATTERN TRANSLATIONGROUP EXPECTEDDIGITCOUNT DIGITFENCEINDEX DESCRIPTION SELECTOR_TYPE
def load_entries_from_edw STDERR.puts "Loading PrefixFence data from EDW for #{mss_name}." data = [] SqlServer.create(EDW::SOURCE, EDW::DM_ALCATEL::DATABASE) do |db| db.query sql # puts db.fields data = db.data end data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mssql_parse_info(data, info)\n\t\tlen = data.slice!(0,2).unpack('v')[0]\n\t\tbuff = data.slice!(0,len)\n\n\t\terrno,state,sev,elen = buff.slice!(0,8).unpack('VCCv')\n\t\temsg = buff.slice!(0,elen * 2)\n\t\temsg.gsub!(\"\\x00\", '')\n\n\t\tinfo[:infos]||= []\n\t\tinfo[:infos] << \"SQL Server Info ##{errno} (State:#{state} Severity:#{sev}): #{emsg}\"\n\t\tinfo\n\tend", "def mssql_parse_login( data )\n status = data.slice!(0,1).unpack('C')[0]\n len = data.slice!(0,2).unpack('n')[0]\n\n if len > data.length + 4\n return\n end\n\n # slice of:\n # * channel, packetno, window\n # * login header\n # * client name lengt & offset\n login_hdr = data.slice!(0,4 + 36 + 4)\n\n username_offset = data.slice!(0,2).unpack('v')[0]\n username_length = data.slice!(0,2).unpack('v')[0]\n\n pw_offset = data.slice!(0,2).unpack('v')[0]\n pw_length = data.slice!(0,2).unpack('v')[0]\n\n appname_offset = data.slice!(0,2).unpack('v')[0]\n appname_length = data.slice!(0,2).unpack('v')[0]\n\n srvname_offset = data.slice!(0,2).unpack('v')[0]\n srvname_length = data.slice!(0,2).unpack('v')[0]\n\n if username_offset > 0 and pw_offset > 0\n offset = username_offset - 56\n\n user = data[offset..(offset + username_length * 2)].unpack('v*').pack('C*')\n\n offset = pw_offset - 56\n if pw_length == 0\n pass = \"<empty>\"\n else\n pass = mssql_tds_decrypt(data[offset..(offset + pw_length * 2)].unpack(\"A*\")[0])\n end\n\n offset = srvname_offset - 56\n srvname = data[offset..(offset + srvname_length * 2)].unpack('v*').pack('C*')\n BetterCap::Logger.info \"[#{'MSSQL DOWNGRADE'.green}] [#{'Username'.yellow}] #{user.yellow} | [#{'Password'.yellow}] #{pass.yellow} | [#{'Server Name'.yellow}] #{srvname.yellow}\"\n else\n BetterCap::Logger.info \"[#{'MSSQL DOWNGRADE'.yellow}] Could not parse login request for authentication credentials\"\n end\n end", "def name\n @token\n #match(/^Information\\son\\s([^\\s]+)/)\n end", "def handle_sd_sm_sy(tokens, options); end", "def handle_sd_sm_sy(tokens, options); end", "def tlv_select\n info 'os10_lldp_interface::tlv select'\n begin\n lldp_interface_data = @tlv_ret[:stdout].split(\"\\n\")\n temp_data = {}\n\n lldp_interface_data.each do |data|\n if data.include? 'lldp tlv-select'\n tlv_data = data.split(' ')\n if tlv_data.length == 4\n temp_data[tlv_data[3]] = [' ']\n elsif temp_data[tlv_data[3]].nil? && tlv_data.length >= 4\n temp_data[tlv_data[3]] = [tlv_data[4]]\n elsif tlv_data[4]\n temp_data[tlv_data[3]] = temp_data[tlv_data[3]] << tlv_data[4]\n temp_data[tlv_data[3]] = temp_data[tlv_data[3]].sort\n end\n end\n end\n return temp_data\n rescue Exception => e\n err 'Exception in tlv select'\n err e.message\n err e.backtrace[0]\n raise\n end\n end", "def type_name(member)\n \t_IDENTIFIER16 = nil\n\n\n\n\n # 336:7: ( IDENTIFIER ) ( package_descriptors[member] )* ( type_argument[member] )?\n # 336:8: IDENTIFIER\n _IDENTIFIER16 = @input.look_ahead(1)\n match(:IDENTIFIER)\n member.type = _IDENTIFIER16.text \n # 337:7: ( package_descriptors[member] )*\n while true\n alt45 = 2\n # ()* loopback of 337:7: ( package_descriptors[member] )*\n look_ahead45_0 = look_ahead(1)\n if look_ahead45_0 == :DOT \n alt45 = 1\n end\n case alt45\n when 1\n # 337:9: package_descriptors[member]\n package_descriptors(member)\n\n else\n break\n end\n end\n # 338:7: ( type_argument[member] )?\n alt46 = 2\n # 338:7: ( type_argument[member] )?\n look_ahead46_0 = look_ahead(1)\n\n if look_ahead46_0 == :LEFT_ANGULAR_BRACKET \n alt46 = 1\n end\n case alt46\n when 1\n # 338:9: type_argument[member]\n type_argument(member)\n\n end\n\n\n\n end", "def update_from_msats!(options = {})\n # Update local cache\n @msats_detail = raw_msats_nmi_detail(options)\n parse_msats_detail\n self\n end", "def handle_sm_sd_sy(tokens, options); end", "def handle_sm_sd_sy(tokens, options); end", "def scan_for_day_names(token, options = T.unsafe(nil)); end", "def pty_ltd_registration_number; end", "def parse_group filter\n /^\\(cn=(.*)\\)$/.match(filter)[1]\n end", "def get_event_type_for_csi_entry\n event_type ? get_event_type_separated.gsub('MI', 'MX') : '?'\n end", "def ndp_reserved=(i); typecast i; end", "def channel_unit(num)\n\t\tregexp = /^DIM#{num}=\"(.*)\"\\s*/\n\t\t@input_ary.each { |e| \n\t\t\treturn \"(\" + $1.to_s.gsub(/\\s+/,\"_\").strip + \")\" if e =~ regexp\n\t\t}\n\t\tputs \"WARNING: Cannot find channel #{num} name. Assigning a default value\"\n\t\treturn \"(unknown)\"\n\tend", "def find_all_by_MSSName db, mss\n db.query <<-SQL\n SELECT MSISDN_BEGIN, MSISDN_END, HLR_NUM, LastUpdated\n FROM #{@table}\n WHERE MSSName = '#{mss}'\n ORDER BY MSISDN_BEGIN\n SQL\n db.data.each do |row|\n row[0] = row[0].delete('{f}')\n row[1] = row[1].delete('{f}')\n end\n end", "def mssql_parse_login_ack(data, info)\n\t\tlen = data.slice!(0,2).unpack('v')[0]\n\t\tbuff = data.slice!(0,len)\n\t\tinfo[:login_ack] = true\n\tend", "def field_name\n case @cmd_switch\n when 'add_forgroups'\n 'dc.subject.forgroup'\n\n when 'replace_type'\n 'dc.type'\n\n else\n STDERR.puts \"Invalid command line switch: #{@cmd_switch}\"\n exit 1\n end\n end", "def tokenizer_relay_header_category_group\n TokenExtractor.new(\n :category_group,\n /(\\s+|M)\\d\\d0(\\-\\d\\d\\d)*/i,\n 7 # (max size)\n # Alt. vers. (instead of '7'): /\\s*tempo base\\s*/ui\n )\n end", "def name\n @token\n #match(/^Information\\son\\s([&#+][^:]+):$/)\n end", "def dd_imei_field\n\t $tracer.trace(__method__)\n\t return ToolTag.new(input.className(create_ats_regex_string(\"ats-rcmddimeifld\")), __method__, self)\n\tend", "def handle_rdn_rmn_sd_sy(tokens, options); end", "def handle_rdn_rmn_sd_sy(tokens, options); end", "def general_prefix\n parts = []\n parts << label\n parts << ttl if ttl\n parts << 'IN'\n parts << type\n parts\n end", "def tokenizer_result_row_swimmer_name\n TokenExtractor.new(\n :swimmer_name,\n /\n (\n (?<=[\\s\\?a-z0-9-]{10}\\s\\d{4})\n )\\s([a-z]\\D{4,28}\\s)\n /uix,\n 29 # (max size)\n )\n end", "def gen_match_code(context, vname)\n \"#{XSD::PREFIX_PARSE_CH}#{internal_class_name}(#{vname}, offset)\"\nend", "def update_pocket_name\n @pocket_name.text = @pocket_names[@socket_index]\n end", "def formatFlowcellNameForLIMS(fcName)\n puts \"FOUND FC NAME = \" + fcName.to_s\n limsFCName = fcName.slice(/([a-zA-Z0-9]+)$/)\n\n if limsFCName.match(/^FC/)\n limsFCName.gsub!(/^FC/, \"\")\n end\n\n # For HiSeqs, a flowcell is prefixed with letter \"A\" or \"B\".\n # We remove this prefix from the reduced flowcell name, since\n # a flowcell name is entered without the prefix letter in LIMS.\n # For GA2, there is no change.\n limsFCName.slice!(/^[a-zA-Z]/)\n return limsFCName.to_s\n end", "def interface_name(class_def)\n \t_IDENTIFIER5 = nil\n\n\n\n\n # 55:7: IDENTIFIER\n _IDENTIFIER5 = @input.look_ahead(1)\n match(:IDENTIFIER)\n class_def.add_interface(_IDENTIFIER5.text) \n\n\n\n end", "def find_type(name)\n mdata = /aaa group server ([^\\s]+) #{name}/.match(config)\n return mdata[1] if mdata\n end", "def package_descriptors(member)\n \t_IDENTIFIER17 = nil\n\n\n\n\n # 342:7: '.' IDENTIFIER\n match(:DOT)\n _IDENTIFIER17 = @input.look_ahead(1)\n match(:IDENTIFIER)\n member.type += \".#{_IDENTIFIER17.text}\" \n\n\n\n end", "def mls_select; select(:account, :mls_id, options_with_ids(mlses)); end", "def wsu_id\n \"UsernameToken-#{count}\"\n end", "def member_special_identifier(member)\n \t_IDENTIFIER18 = nil\n \t_EXTENDS19 = nil\n\n\n\n\n # 378:5: ( IDENTIFIER | ',' | '&' | '<' | '>' | EXTENDS | '?' )\n alt50 = 7\n # 377:1: member_special_identifier[member] : ( IDENTIFIER | ',' | '&' | '<' | '>' | EXTENDS | '?' );\n case look_ahead(1)\n when :IDENTIFIER\n alt50 = 1\n when :COMMA\n alt50 = 2\n when :ECOMMERCIAL\n alt50 = 3\n when :LEFT_ANGULAR_BRACKET\n alt50 = 4\n when :RIGHT_ANGULAR_BRACKET\n alt50 = 5\n when :EXTENDS\n alt50 = 6\n when :QUESTION_MARK\n alt50 = 7\n else\n raise \"Expected: 377:1: member_special_identifier[member] : ( IDENTIFIER | ',' | '&' | '<' | '>' | EXTENDS | '?' );\"\n\n end\n case alt50\n when 1\n # 378:7: IDENTIFIER\n _IDENTIFIER18 = @input.look_ahead(1)\n match(:IDENTIFIER)\n member.type += _IDENTIFIER18.text\n when 2\n # 379:7: ','\n match(:COMMA)\n member.type += \", \"\n when 3\n # 380:7: '&'\n match(:ECOMMERCIAL)\n member.type += \" & \"\n when 4\n # 381:7: '<'\n match(:LEFT_ANGULAR_BRACKET)\n member.type += '<'\n when 5\n # 382:7: '>'\n match(:RIGHT_ANGULAR_BRACKET)\n member.type += '>'\n when 6\n # 383:7: EXTENDS\n _EXTENDS19 = @input.look_ahead(1)\n match(:EXTENDS)\n member.type += \" #{_EXTENDS19.text} \"\n when 7\n # 384:7: '?'\n match(:QUESTION_MARK)\n member.type += '?' \n end\n\n\n\n end", "def scan_for_month_names(token, options = T.unsafe(nil)); end", "def parseSampleName(output)\n if output.match(/Sample=\\S+/)\n temp = output.gsub(/Sample=/,\"\")\n temp.strip!\n if !temp.match(/^[Nn]one/)\n @sample = temp.to_s\n else\n @sample = nil\n end\n end\n end", "def name_record_short(type, ext_ref, hidden = nil) #:nodoc:\n record = 0x0018 # Record identifier\n length = 0x001b # Number of bytes to follow\n\n grbit = 0x0020 # Option flags\n chkey = 0x00 # Keyboard shortcut\n cch = 0x01 # Length of text name\n cce = 0x000b # Length of text definition\n unknown01 = 0x0000 #\n ixals = @worksheet.index + 1 # Sheet index\n unknown02 = 0x00 #\n cch_cust_menu = 0x00 # Length of cust menu text\n cch_description = 0x00 # Length of description text\n cch_helptopic = 0x00 # Length of help topic text\n cch_statustext = 0x00 # Length of status bar text\n rgch = type # Built-in name type\n unknown03 = 0x3b #\n\n grbit = 0x0021 if hidden\n\n rowmin = row_min\n rowmax = row_max\n rowmin, rowmax = 0x0000, 0xffff unless row_min\n\n colmin = col_min\n colmax = col_max\n colmin, colmax = 0x00, 0xff unless col_min\n\n header = [record, length].pack(\"vv\")\n data = [grbit].pack(\"v\")\n data += [chkey].pack(\"C\")\n data += [cch].pack(\"C\")\n data += [cce].pack(\"v\")\n data += [unknown01].pack(\"v\")\n data += [ixals].pack(\"v\")\n data += [unknown02].pack(\"C\")\n data += [cch_cust_menu].pack(\"C\")\n data += [cch_description].pack(\"C\")\n data += [cch_helptopic].pack(\"C\")\n data += [cch_statustext].pack(\"C\")\n data += [rgch].pack(\"C\")\n data += [unknown03].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n\n data += [rowmin].pack(\"v\")\n data += [rowmax].pack(\"v\")\n data += [colmin].pack(\"v\")\n data += [colmax].pack(\"v\")\n\n [header, data]\n end", "def scan_for_season_names(token, options = T.unsafe(nil)); end", "def ndp_code=(i); typecast i; end", "def msg_TMODE(source, args)\n # :UID/SID TMODE 1234567890 #channel +b root!*@* ...\n c = Channel.find_by_name(args[1])\n return nil if c == nil\n if args[0].to_i() > c.ts\n return nil\n end\n\n parse_modestr(c, args[2..-1])\n\n return nil\n end", "def process_ntlm_type1(type1_msg)\n type2_msg = Net::NTLM::Message::Type2.new.tap do |msg|\n msg.target_name = 'LOCALHOST'.encode('UTF-16LE').b\n msg.flag = 0\n %i{ KEY56 KEY128 KEY_EXCHANGE UNICODE TARGET_INFO VERSION_INFO }.each do |flag|\n msg.flag |= NTLM::NEGOTIATE_FLAGS.fetch(flag)\n end\n\n if type1_msg.flag & NTLM::NEGOTIATE_FLAGS[:EXTENDED_SECURITY] == NTLM::NEGOTIATE_FLAGS[:EXTENDED_SECURITY]\n msg.flag |= NTLM::NEGOTIATE_FLAGS[:EXTENDED_SECURITY]\n end\n\n @server_challenge = @provider.generate_server_challenge\n msg.challenge = @server_challenge.unpack1('Q<') # 64-bit unsigned, little endian (uint64_t)\n target_info = Net::NTLM::TargetInfo.new('')\n target_info.av_pairs.merge!({\n Net::NTLM::TargetInfo::MSV_AV_NB_DOMAIN_NAME => @provider.netbios_domain.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_NB_COMPUTER_NAME => @provider.netbios_hostname.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_DNS_DOMAIN_NAME => @provider.dns_domain.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_DNS_COMPUTER_NAME => @provider.dns_hostname.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_TIMESTAMP => [(Time.now.to_i + Net::NTLM::TIME_OFFSET) * Field::FileTime::NS_MULTIPLIER].pack('Q')\n })\n msg.target_info = target_info.to_s\n msg.enable(:target_info)\n msg.context = 0\n msg.enable(:context)\n msg.os_version = NTLM::OSVersion.new(major: 6, minor: 3).to_binary_s\n msg.enable(:os_version)\n end\n\n type2_msg\n end", "def neutovr_wrn; catdet.form(:name, 'rpcControlApsSettingForm').text_field(:name, 'ecNeutralThrshldOverWarn'); end", "def mssql_login(user='sa', pass='', db='')\n\n\t\tdisconnect if self.sock\n\t\tconnect\n\n\t\tpkt = \"\"\n\t\tidx = 0\n\n\t\tpkt << [\n\t\t\t0x00000000, # Dummy size\n\t\t\t0x71000001, # TDS Version\n\t\t\t0x00000000, # Size\n\t\t\t0x00000007, # Version\n\t\t\trand(1024+1), # PID\n\t\t\t0x00000000, # ConnectionID\n\t\t\t0xe0, # Option Flags 1\n\t\t\t0x03, # Option Flags 2\n\t\t\t0x00, # SQL Type Flags\n\t\t\t0x00, # Reserved Flags\n\t\t\t0x00000000, # Time Zone\n\t\t\t0x00000000 # Collation\n\t\t].pack('VVVVVVCCCCVV')\n\n\n\t\tcname = Rex::Text.to_unicode( Rex::Text.rand_text_alpha(rand(8)+1) )\n\t\tuname = Rex::Text.to_unicode( user )\n\t\tpname = mssql_tds_encrypt( pass )\n\t\taname = Rex::Text.to_unicode( Rex::Text.rand_text_alpha(rand(8)+1) )\n\t\tsname = Rex::Text.to_unicode( rhost )\n\t\tdname = Rex::Text.to_unicode( db )\n\n\t\tidx = pkt.size + 50 # lengths below\n\n\t\tpkt << [idx, cname.length / 2].pack('vv')\n\t\tidx += cname.length\n\n\t\tpkt << [idx, uname.length / 2].pack('vv')\n\t\tidx += uname.length\n\n\t\tpkt << [idx, pname.length / 2].pack('vv')\n\t\tidx += pname.length\n\n\t\tpkt << [idx, aname.length / 2].pack('vv')\n\t\tidx += aname.length\n\n\t\tpkt << [idx, sname.length / 2].pack('vv')\n\t\tidx += sname.length\n\n\t\tpkt << [0, 0].pack('vv')\n\n\t\tpkt << [idx, aname.length / 2].pack('vv')\n\t\tidx += aname.length\n\n\t\tpkt << [idx, 0].pack('vv')\n\n\t\tpkt << [idx, dname.length / 2].pack('vv')\n\t\tidx += dname.length\n\n\t\t# The total length has to be embedded twice more here\n\t\tpkt << [\n\t\t\t0,\n\t\t\t0,\n\t\t\t0x12345678,\n\t\t\t0x12345678\n\t\t].pack('vVVV')\n\n\t\tpkt << cname\n\t\tpkt << uname\n\t\tpkt << pname\n\t\tpkt << aname\n\t\tpkt << sname\n\t\tpkt << aname\n\t\tpkt << dname\n\n\t\t# Total packet length\n\t\tpkt[0,4] = [pkt.length].pack('V')\n\n\t\t# Embedded packet lengths\n\t\tpkt[pkt.index([0x12345678].pack('V')), 8] = [pkt.length].pack('V') * 2\n\n\t\t# Packet header and total length including header\n\t\tpkt = \"\\x10\\x01\" + [pkt.length + 8].pack('n') + [0].pack('n') + [1].pack('C') + \"\\x00\" + pkt\n\n\t\tresp = mssql_send_recv(pkt)\n\n\t\tinfo = {:errors => []}\n\t\tinfo = mssql_parse_reply(resp,info)\n\n\t\treturn false if not info\n\t\tinfo[:login_ack] ? true : false\n\tend", "def handle_rmn_sd_on(tokens, options); end", "def handle_rmn_sd_on(tokens, options); end", "def cd\n pname_field=self.de\n entries=pname_field.split(\";\")\n entries.each do |entry|\n m=entry.match(/\\s*(.*?):\\s*(.*?)=(.*)/)\n if ( m!=nil)\n if ( (m[1]==\"AltName\") && (m[2]==\"CD_antigen\") )\n return m[3]\n end\n end\n end\n \n return \"\"\n end", "def set_pknick(value, index = 0)\n value = value.given_name if value.is_a?(PFM::Pokemon)\n set_variable(PKNICK[index].to_s, value.to_s)\n end", "def channel_name(num)\n\t\tregexp = /^CHANNEL#{num}=\"(.*)\"\\s*/\n\t\t@input_ary.each { |e| \n\t\t\treturn $1.to_s.gsub(/\\s+/,\"_\").strip if e =~ regexp\n\t\t}\n\t\traise DTA_ReaderErr, \"Cannot find channel #{num} name\"\n\tend", "def mssqlchar\n foo=[]\n self.asciime.split(',').each {|chr| foo << \"CHAR(#{chr})\" }\n foo.join('+')\n end", "def south_african_pty_ltd_registration_number; end", "def do_login(opts={})\n\n\t\t@connected = false\n\t\tdisconnect if self.sock\n\t\tconnect\n\t\t@connected = true\n\n\t\tpkt = \"\"\n\t\tidx = 0\n\t\tdb = \"\"\n\n\t\tpkt << [\n\t\t\t0x00000000, # Dummy size\n\t\t\topts[:tds_version] || 0x71000001, # TDS Version\n\t\t\topts[:size] || 0x00000000, # Size\n\t\t\topts[:version] || 0x00000007, # Version\n\t\t\topts[:pid] || rand(1024+1), # PID\n\t\t\topts[:connection_id] || 0x00000000, # ConnectionID\n\t\t\topts[:flags_opt1] || 0xe0, # Option Flags 1\n\t\t\topts[:flags_opt2] || 0x03, # Option Flags 2\n\t\t\topts[:flags_sql_type] || 0x00, # SQL Type Flags\n\t\t\topts[:flags_reserved] || 0x00, # Reserved Flags\n\t\t\topts[:timezone] || 0x00000000, # Time Zone\n\t\t\topts[:collation] || 0x00000000 # Collation\n\t\t].pack('VVVVVVCCCCVV')\n\n\n\t\tcname = Rex::Text.to_unicode( opts[:cname] || Rex::Text.rand_text_alpha(rand(8)+1) )\n\t\tuname = Rex::Text.to_unicode( opts[:uname] || \"sa\" )\n\t\tpname = opts[:pname_raw] || mssql_tds_encrypt( opts[:pname] || \"\" )\n\t\taname = Rex::Text.to_unicode(opts[:aname] || Rex::Text.rand_text_alpha(rand(8)+1) )\n\t\tsname = Rex::Text.to_unicode( opts[:sname] || rhost )\n\t\tdname = Rex::Text.to_unicode( opts[:dname] || db )\n\n\t\tidx = pkt.size + 50 # lengths below\n\n\t\tpkt << [idx, cname.length / 2].pack('vv')\n\t\tidx += cname.length\n\n\t\tpkt << [idx, uname.length / 2].pack('vv')\n\t\tidx += uname.length\n\n\t\tpkt << [idx, pname.length / 2].pack('vv')\n\t\tidx += pname.length\n\n\t\tpkt << [idx, aname.length / 2].pack('vv')\n\t\tidx += aname.length\n\n\t\tpkt << [idx, sname.length / 2].pack('vv')\n\t\tidx += sname.length\n\n\t\tpkt << [0, 0].pack('vv')\n\n\t\tpkt << [idx, aname.length / 2].pack('vv')\n\t\tidx += aname.length\n\n\t\tpkt << [idx, 0].pack('vv')\n\n\t\tpkt << [idx, dname.length / 2].pack('vv')\n\t\tidx += dname.length\n\n\t\t# The total length has to be embedded twice more here\n\t\tpkt << [\n\t\t\t0,\n\t\t\t0,\n\t\t\t0x12345678,\n\t\t\t0x12345678\n\t\t].pack('vVVV')\n\n\t\tpkt << cname\n\t\tpkt << uname\n\t\tpkt << pname\n\t\tpkt << aname\n\t\tpkt << sname\n\t\tpkt << aname\n\t\tpkt << dname\n\n\t\t# Total packet length\n\t\tpkt[0,4] = [pkt.length].pack('V')\n\n\t\t# Embedded packet lengths\n\t\tpkt[pkt.index([0x12345678].pack('V')), 8] = [pkt.length].pack('V') * 2\n\n\t\t# Packet header and total length including header\n\t\tpkt = \"\\x10\\x01\" + [pkt.length + 8].pack('n') + [0].pack('n') + [1].pack('C') + \"\\x00\" + pkt\n\n\t\tresp = mssql_send_recv(pkt,opts[:timeout])\n\n\t\tinfo = {:errors => []}\n\t\tinfo = mssql_parse_reply(resp,info)\n\t\tinfo\n\tend", "def middle_name_prompt_label\n # unit_test_no_generate: middle_name_prompt_label, span.className(create_ats_regex_string(\"ats-mnamelbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-mnamelbl\")), __method__)\n end", "def gen_match_code(context, vname)\n \"#{XSD::PREFIX_PARSE_SE}#{internal_name}(#{vname}, offset)\"\n end", "def ovr_wrn; catdet.form(:name, 'rpcControlApsSettingForm').text_field(:name, 'ecThresholdHiWrnLN'); end", "def get_group(string); end", "def tokenizer_relay_category_header_group\n TokenExtractor.new(\n :category_group,\n / *master\\s+([1234][02468]0})/i,\n / *(maschi|femmi|mist)/i\n )\n end", "def tokenizer_result_row_swimmer_name\n TokenExtractor.new(\n :swimmer_name,\n 5,\n /(?<naz>[23456789][05][MF])\\s+(?<year>(19|20)\\d{2})\\s+/i\n )\n end", "def format_market_uid\n @formated_market_uid = market_uid.to_s\n if specifier.present?\n @formated_market_uid += \"^#{specifier.to_s}\" \n self.specifier_name = specifier.to_s\n end\n end", "def apt_suite_form_column(record, input_name)\n @apt_suites = USPS_CODES \n select :record, :apt_suite, @apt_suites, :prompt => \"Select Suite\"\n end", "def notename\n self.class.notename_s(notename_i)\n end", "def ListView_GetGroupInfoByIndex(hwnd, iIndex, pgrp)\n send_listview_message(hwnd, :GETGROUPINFOBYINDEX, wparam: iIndex, lparam: pgrp)\n end", "def regex_name(sql)\n # We rely on the ActiveSupport inflections code here. Bail early if we can't use it.\n return UNKNOWN_LABEL unless UNKNOWN_LABEL.respond_to?(:classify)\n\n if match = SELECT_REGEX.match(sql)\n operation =\n if match[2]\n COUNT_LABEL\n else\n SELECT_LABEL\n end\n \"#{match[3].gsub(/\\W/,'').classify}/#{operation}\"\n elsif match = UPDATE_REGEX.match(sql)\n \"#{match[2].classify}/#{UPDATE_LABEL}\"\n elsif match = INSERT_REGEX.match(sql)\n \"#{match[2].classify}/#{INSERT_LABEL}\"\n elsif match = DELETE_REGEX.match(sql)\n \"#{match[2].classify}/#{DELETE_LABEL}\"\n elsif sql == BEGIN_STATEMENT\n \"SQL/#{BEGIN_STATEMENT.downcase}\"\n elsif sql == COMMIT\n \"SQL/#{COMMIT.downcase}\"\n else\n UNKNOWN_LABEL\n end\n rescue\n UNKNOWN_LABEL\n end", "def instruments_group_params\n params.require(:instruments_group).permit(:name_ch, :name_fr, :abbrev_ch, :abbrev_fr, :description, :country, :law, :appeal_proc, :descr_appeal_proc, :kind, :orientation, :prescriptive, :validity_period)\n end", "def ndp_type=(i); typecast i; end", "def cti_key; sti_key; end", "def mssql_parse_ret(data, info)\n\t\tret = data.slice!(0,4).unpack('N')[0]\n\t\tinfo[:ret] = ret\n\t\tinfo\n\tend", "def parse_ddm(ddm);end", "def k_modificador!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n\n\n\n type = K_MODIFICADOR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 489:4: ( 'static' | 'abstract' | 'constant' | 'final' | 'virtual' )\n # at line 489:4: ( 'static' | 'abstract' | 'constant' | 'final' | 'virtual' )\n alt_18 = 5\n case look_18 = @input.peek( 1 )\n when 0x73 then alt_18 = 1\n when 0x61 then alt_18 = 2\n when 0x63 then alt_18 = 3\n when 0x66 then alt_18 = 4\n when 0x76 then alt_18 = 5\n else\n raise NoViableAlternative( \"\", 18, 0 )\n\n end\n case alt_18\n when 1\n # at line 489:5: 'static'\n match( \"static\" )\n\n\n when 2\n # at line 489:14: 'abstract'\n match( \"abstract\" )\n\n\n when 3\n # at line 489:25: 'constant'\n match( \"constant\" )\n\n\n when 4\n # at line 489:36: 'final'\n match( \"final\" )\n\n\n when 5\n # at line 489:44: 'virtual'\n match( \"virtual\" )\n\n\n end\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 59 )\n\n\n end", "def parse_sqft\n end", "def parse_sqft\n end", "def a2s_info\n encode_message('T', \"Source Engine Query\\x00\")\n end", "def beginning_meridian=(string)\n frm.select(:id=>\"release_ampm\").select(string)\n end", "def local_nick(body)\n name1 = _pop_token(body)\n name2 = _pop_token(body)\n raise \"Usage: /nick <old_name> <new_name>\" if name1.to_s.empty?\n if name2.to_s.empty?\n name2 = name1\n name1 = @var[:our_name]\n end\n raise \"Name '#{name2}' is already in use\" if @var[:user_keys][name2]\n\n # Perform the renaming\n kh = @connection.comm.sender_keyhash(name1)\n key = @connection.comm.rsa_keys[name1]\n raise \"Invalid user name: '#{name1}'\" unless kh and key\n @connection.comm.rsa_keys[name2] = key\n @connection.comm.rsa_keys.delete(name1)\n @connection.comm.names[kh] = name2\n @var[:user_keys][name2] = key\n @var[:user_keys].delete name1\n @var[:granted].collect! { |x| x = name2 if x == name1 ; x }\n @var[:granted_by].collect! { |x| x = name2 if x == name1 ; x }\n @var[:revoked].collect! { |x| x = name2 if x == name1 ; x }\n \n # And lastly, if this is us, update our special name attribute\n @var[:our_name] = name2 if @var[:our_name] == name1\n _notice(\"#{name1} is now known as #{name2}\")\n _save_env\nend", "def type_argument(member)\n\n\n\n # 346:7: '<' ( member_special_identifier[member] )* '>'\n match(:LEFT_ANGULAR_BRACKET)\n member.type += '<' \n # 347:7: ( member_special_identifier[member] )*\n while true\n alt47 = 2\n alt47 = DFA47.predict(self, @input)\n case alt47\n when 1\n # 347:9: member_special_identifier[member]\n member_special_identifier(member)\n\n else\n break\n end\n end\n match(:RIGHT_ANGULAR_BRACKET)\n member.type += '>' \n\n\n\n end", "def ndp_opt_type=(i); typecast i; end", "def parse_name\n self.name.downcase.chomp! ':'\n\n if self.name.include? ':'\n parts = self.name.split(':')\n\n if %w(copyright character artist circle).include? parts[0]\n self.category = parts[0].to_sym\n end\n\n self.name = parts[1]\n end\n end", "def saprfc_vl02_params\n params.require(:saprfc_vl02).permit(:VBELN, :POSNR, :MATNR, :CHARG, :MENGE, :MEINS, :WERKS, :LGORT, :MSG_TYPE, :MSG_ID, :MSG_NUMBER, :MSG_TEXT, :RFC_DATE, :STATUS, :MJAHR, :MBLNR, :ZEILE, :CREATOR, :UPDATER, :CREATED_AT, :UPDATED_AT, :BARCODE_ID)\n end", "def nchar_character_set_name\n data[:nchar_character_set_name]\n end", "def xpath4saf_field\n case @cmd_switch\n when 'add_forgroups'\n \"/dublin_core/dcvalue[@element='subject' and @qualifier='forgroup']\"\n\n when 'replace_type'\n \"/dublin_core/dcvalue[@element='type' and not(@qualifier)]\"\n\n else\n STDERR.puts \"Invalid command line switch: #{@cmd_switch}\"\n exit 1\n end\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.to_s.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << eob.rendering_provider_suffix\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def MTX02=(arg)", "def name_record_long(type, ext_ref) #:nodoc:\n record = 0x0018 # Record identifier\n length = 0x002a # Number of bytes to follow\n\n grbit = 0x0020 # Option flags\n chkey = 0x00 # Keyboard shortcut\n cch = 0x01 # Length of text name\n cce = 0x001a # Length of text definition\n unknown01 = 0x0000 #\n ixals = @worksheet.index + 1 # Sheet index\n unknown02 = 0x00 #\n cch_cust_menu = 0x00 # Length of cust menu text\n cch_description = 0x00 # Length of description text\n cch_helptopic = 0x00 # Length of help topic text\n cch_statustext = 0x00 # Length of status bar text\n rgch = type # Built-in name type\n\n unknown03 = 0x29\n unknown04 = 0x0017\n unknown05 = 0x3b\n\n header = [record, length].pack(\"vv\")\n data = [grbit].pack(\"v\")\n data += [chkey].pack(\"C\")\n data += [cch].pack(\"C\")\n data += [cce].pack(\"v\")\n data += [unknown01].pack(\"v\")\n data += [ixals].pack(\"v\")\n data += [unknown02].pack(\"C\")\n data += [cch_cust_menu].pack(\"C\")\n data += [cch_description].pack(\"C\")\n data += [cch_helptopic].pack(\"C\")\n data += [cch_statustext].pack(\"C\")\n data += [rgch].pack(\"C\")\n\n # Column definition\n data += [unknown03].pack(\"C\")\n data += [unknown04].pack(\"v\")\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [0x0000].pack(\"v\")\n data += [0xffff].pack(\"v\")\n data += [@col_min].pack(\"v\")\n data += [@col_max].pack(\"v\")\n\n # Row definition\n data += [unknown05].pack(\"C\")\n data += [ext_ref].pack(\"v\")\n data += [@row_min].pack(\"v\")\n data += [@row_max].pack(\"v\")\n data += [0x00].pack(\"v\")\n data += [0xff].pack(\"v\")\n # End of data\n data += [0x10].pack(\"C\")\n\n [header, data]\n end", "def update_marking_group(name, active_category)\n marking_group_name.set name\n active_marking_group_value.select active_category\n click_link('Update')\n sleep 2\n end", "def class_name_parameters(class_def)\n\n\n\n # 32:7: '<' ( class_special_identifier[class_def] )* '>'\n match(:LEFT_ANGULAR_BRACKET)\n class_def.name += '<'\n # 33:7: ( class_special_identifier[class_def] )*\n while true\n alt5 = 2\n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_0 = look_ahead(1)\n if look_ahead5_0 == :RIGHT_ANGULAR_BRACKET \n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_1 = look_ahead(2)\n if look_ahead5_1 == :EXTENDS \n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_3 = look_ahead(3)\n if look_ahead5_3 == :IDENTIFIER \n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_5 = look_ahead(4)\n if (TOKENS[look_ahead5_5] >= 5 && TOKENS[look_ahead5_5] <= 6) || (TOKENS[look_ahead5_5] >= 25 && TOKENS[look_ahead5_5] <= 28) \n alt5 = 1\n end\n elsif look_ahead5_3 == :EXTENDS || (TOKENS[look_ahead5_3] >= 25 && TOKENS[look_ahead5_3] <= 28) \n alt5 = 1\n end\n elsif look_ahead5_1 == :IDENTIFIER || (TOKENS[look_ahead5_1] >= 25 && TOKENS[look_ahead5_1] <= 28) \n alt5 = 1\n end\n elsif (TOKENS[look_ahead5_0] >= 5 && TOKENS[look_ahead5_0] <= 6) || look_ahead5_0 == :LEFT_ANGULAR_BRACKET || (TOKENS[look_ahead5_0] >= 27 && TOKENS[look_ahead5_0] <= 28) \n alt5 = 1\n end\n case alt5\n when 1\n # 33:9: class_special_identifier[class_def]\n class_special_identifier(class_def)\n\n else\n break\n end\n end\n match(:RIGHT_ANGULAR_BRACKET)\n class_def.name += '>'\n\n\n\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << ''\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def ITD12=(arg)", "def pick_name(n,w)\n return USERNAMES[ (n % USERNAMES.size) ] + n.to_s + \"_w#{w.to_s}\"\n end", "def pick_name(n,w)\n return USERNAMES[ (n % USERNAMES.size) ] + n.to_s + \"_w#{w.to_s}\"\n end", "def xinfo(subcommand, key, group = T.unsafe(nil)); end", "def parse_msid(issn:, msid:)\n logger.debug(\"Parsing msid #{msid} for journal #{issn}\")\n regex = @se_id.journal&.manuscript_number_regex\n return msid if regex.blank?\n\n logger.debug(\"- found regex /#{regex}/\")\n return msid if msid.match(regex).blank?\n\n logger.debug(\"- after regex applied: #{msid.match(regex)[1]}\")\n result = msid.match(regex)[1]\n if result.present?\n result\n else\n msid\n end\n end", "def generate_cmd_mof(cmd)\n mof = \"#pragma namespace(\\\"\\\\\\\\\\\\\\\\.\\\\\\\\root\\\\\\\\subscription\\\")\ninstance of __EventFilter as $EventFilter\n{\nEventNamespace = \\\"Root\\\\\\\\Cimv2\\\";\nName = \\\"filtP2\\\";\nQuery = \\\"Select * From __InstanceModificationEvent \\\"\n \\\"Where TargetInstance Isa \\\\\\\"Win32_LocalTime\\\\\\\" \\\"\n \\\"And TargetInstance.Second = 5\\\";\nQueryLanguage = \\\"WQL\\\";\n};\ninstance of ActiveScriptEventConsumer as $Consumer\n{\nName = \\\"consPCSV2\\\";\nScriptingEngine = \\\"JScript\\\";\nScriptText =\n\\\"var WSH = new ActiveXObject(\\\\\\\"WScript.Shell\\\\\\\")\\\\nWSH.run(\\\\\\\"#{cmd}\\\\\\\")\\\";\n};\ninstance of __FilterToConsumerBinding\n{\nConsumer = $Consumer;\nFilter = $EventFilter;\n};\";\n return mof\nend", "def insured_name\n id, qual = eob.member_id_and_qualifier\n sub_name_ele = []\n sub_name_ele << 'NM1'\n sub_name_ele << 'IL'\n sub_name_ele << '1'\n sub_name_ele << eob.subscriber_last_name\n sub_name_ele << eob.subscriber_first_name\n sub_name_ele << eob.subscriber_middle_initial\n sub_name_ele << ''\n sub_name_ele << eob.subscriber_suffix\n sub_name_ele << qual\n sub_name_ele << id\n sub_name_ele = Output835.trim_segment(sub_name_ele)\n sub_name_ele.join(@element_seperator)\n end", "def next_token\n\n token = nil\n\n until ss.eos? or token do\n token =\n case state\n when nil then\n case\n when text = ss.scan(/select/i) then\n action { [:kw_select, text] }\n when text = ss.scan(/from/i) then\n action { [:kw_from, text] }\n when text = ss.scan(/where/i) then\n action { [:kw_where, text] }\n when text = ss.scan(/null/i) then\n action { [:kw_null, text] }\n when text = ss.scan(/not/i) then\n action { [:kw_not, text] }\n when text = ss.scan(/limit/i) then\n action { [:kw_limit, text] }\n when text = ss.scan(/offset/i) then\n action { [:kw_offset, text] }\n when text = ss.scan(/insert/i) then\n action { [:kw_insert, text] }\n when text = ss.scan(/into/i) then\n action { [:kw_into, text] }\n when text = ss.scan(/values/i) then\n action { [:kw_values, text] }\n when text = ss.scan(/create/i) then\n action { [:kw_create, text] }\n when text = ss.scan(/table/i) then\n action { [:kw_table, text] }\n when text = ss.scan(/constraint/i) then\n action { [:kw_constraint, text] }\n when text = ss.scan(/key/i) then\n action { [:kw_key, text] }\n when text = ss.scan(/primary/i) then\n action { [:kw_primary, text] }\n when text = ss.scan(/\\*/) then\n action { [:star, text] }\n when text = ss.scan(/\\(/) then\n action { [:lparen, text] }\n when text = ss.scan(/\\)/) then\n action { [:rparen, text] }\n when ss.skip(/\\s+/) then\n # do nothing\n when text = ss.scan(/or/i) then\n action { [:op_or, text] }\n when text = ss.scan(/and/i) then\n action { [:op_and, text] }\n when text = ss.scan(/[a-zA-Z]\\w*/) then\n action { [:identifier, text] }\n when text = ss.scan(/=/) then\n action { [:op_equal, text] }\n when text = ss.scan(/<=/) then\n action { [:op_lte, text] }\n when text = ss.scan(/>=/) then\n action { [:op_gte, text] }\n when text = ss.scan(/</) then\n action { [:op_lt, text] }\n when text = ss.scan(/>/) then\n action { [:op_gt, text] }\n when text = ss.scan(/;/) then\n action { [:semicolon, text] }\n when text = ss.scan(/,/) then\n action { [:comma, text] }\n when text = ss.scan(/\\./) then\n action { [:period, text] }\n when text = ss.scan(/\\d+/) then\n action { [:integer, text.to_i] }\n when ss.skip(/'/) then\n [:state, :QUOTE]\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n when :QUOTE then\n case\n when ss.skip(/'/) then\n [:state, nil]\n when text = ss.scan(/[^']+/) then\n action { [:string, text] }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n else\n raise ScanError, \"undefined state at #{location}: '#{state}'\"\n end # token = case state\n\n next unless token # allow functions to trigger redo w/ nil\n end # while\n\n raise LexerError, \"bad lexical result at #{location}: #{token.inspect}\" unless\n token.nil? || (Array === token && token.size >= 2)\n\n # auto-switch state\n self.state = token.last if token && token.first == :state\n\n token\n end", "def select\n select_passive_target NFC::Device::IM_ISO14443A_106\n end", "def ndp_opt_len=(i); typecast i; end", "def tokenizer_relay_row_result_time\n TokenExtractor.new(\n :result_time,\n /(?<=:)\\s*(Ritir.*|Squal.*|(\\d{1,2}')?\\d{2}\"\\d{2})\\s*(?=:)/ix,\n 8\n )\n end", "def identifier_code\n 'ICN'\n end", "def tokenizer_relay_header_pool_type\n TokenExtractor.new(\n :pool_type,\n /\\s*(?<=vasca)\\s(25|50)(?=m)/ix,\n 2\n )\n end", "def ITD06=(arg)", "def parse_factor\r\n case @cur_token.kind\r\n when :SEARCHSTRING\r\n accept_it\r\n when :LPAREN\r\n accept_it\r\n parse_expression\r\n accept(:RPAREN)\r\n else\r\n error(\"\")\r\n end\r\n end" ]
[ "0.45805863", "0.4469986", "0.44453862", "0.44422075", "0.44422075", "0.44394162", "0.44261467", "0.43739456", "0.43332532", "0.43332532", "0.43279734", "0.42882293", "0.426376", "0.4237518", "0.42119703", "0.42118752", "0.41906482", "0.41897145", "0.41853672", "0.4184058", "0.4182895", "0.4179038", "0.4165871", "0.4165871", "0.4163138", "0.4155805", "0.41479802", "0.41295683", "0.4118241", "0.40985957", "0.40917867", "0.40908805", "0.4090014", "0.40860888", "0.408366", "0.4076427", "0.40739033", "0.40679908", "0.4066747", "0.40501368", "0.40485305", "0.40483835", "0.4044195", "0.40410876", "0.40387475", "0.40387475", "0.39910474", "0.39840025", "0.39780095", "0.3967772", "0.3953119", "0.39425582", "0.39406282", "0.3938194", "0.3935989", "0.39356974", "0.3928483", "0.39243537", "0.39207935", "0.39190513", "0.3918996", "0.39150885", "0.3913463", "0.39110848", "0.3910837", "0.3907747", "0.39029375", "0.39006084", "0.38990927", "0.38981724", "0.38981724", "0.3892034", "0.38913643", "0.38907373", "0.38866535", "0.3877772", "0.38775083", "0.38765877", "0.38751823", "0.3870465", "0.38675055", "0.38606507", "0.38590688", "0.38588086", "0.38547707", "0.3853001", "0.38493833", "0.38486975", "0.38486975", "0.38347825", "0.3826256", "0.38152152", "0.38147536", "0.3812067", "0.38084298", "0.3807258", "0.38040745", "0.38039073", "0.38026574", "0.38003203", "0.379399" ]
0.0
-1
Add a IIFE around our javascript
def call(input) path = input[:environment].context_class.new(input).pathname.to_s data = input[:data] # Only discourse or admin paths return data unless (path =~ /\/javascripts\/nilavu/ || path =~ /\/javascripts\/admin/ || path =~ /\/test\/javascripts/) # Ignore the js helpers return data if (path =~ /test\_helper\.js/) return data if (path =~ /javascripts\/helpers\//) # Ignore ES6 files return data if (path =~ /\.es6/) # Ignore translations return data if (path =~ /\/translations/) # We don't add IIFEs to handlebars return data if path =~ /\.handlebars/ return data if path =~ /\.shbrs/ return data if path =~ /\.hbrs/ return data if path =~ /\.hbs/ "(function () {\n\nvar $ = window.jQuery;\n// IIFE Wrapped Content Begins:\n\n#{data}\n\n// IIFE Wrapped Content Ends\n\n })(this);" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inject_js=(_arg0); end", "def initializer_function\n %{<script type=\"text/javascript\">\n var map_options = #{options_to_json};\n onload_before_#{name} = typeof window.onload == 'function' ? window.onload : function(){};\n window.onload = function(){\n onload_before_#{name};\n phoenix_cartographer.init_map('#{name}', map_options);\n map_options = null;\n }\n </script>\n }.minified!\n end", "def inject_js; end", "def initialize javascript_functions\n require File.join(File.dirname(__FILE__), %w{.. ext inline_java_script_v8_wrapper inline_java_script_v8_wrapper})\n\n @wrapper = InlineJavaScript::V8Wrapper.new\n @wrapper.execute(javascript_functions)\n end", "def render_deferred_javascript_tags\n # First write the onload inline javascripts\n js_code = ''\n js_code << render_deferred_javascript_files\n js_code << render_inline_javascripts\n js_code << render_inline_on_load_javascripts\n js_code\n end", "def call_js_init(something_js)\n content_for :javascript do\n \"<script type='text/javascript'>\n $(document).ready(function(){\n #{something_js}\n });\n </script>\".html_safe\n end\n end", "def compile_callback(meth, args = {})\n code( js_repl meth, js_json_parms(args) )\n\n self._compiled = <<\"JAVASCRIPT\"\n(function(repl) {\n try {\n #{code.join(' ')}\n } catch(e) {\n repl.rc_fail(e.name, e.message ? e.message : e);\n };\n})(#{replid});\nJAVASCRIPT\n\n self._code = []\n end", "def closure! \n end", "def js(*code)\n JS.new(*code)\nend", "def j(javascript); end", "def wrapper\n -> fn { -> { fn } }\n end", "def javascript!\n @coffeescript = false\n end", "def extend_js(mod)\n extend mod\n mod.public_instance_methods.each do |method_name|\n add_function(sym_to_css(method_name)) { |tree, cxt|\n send method_name.to_sym, unquote(cxt.toCSS())\n }\n end\n end", "def initialize(custom_js = '', opts = {})\n load_js(custom_js, opts)\n end", "def initialize(javascript, scope = {})\n @javascript = javascript\n @scope = scope\n end", "def when_document_ready\n self << \"jQuery(document).ready(function() {\"\n yield self\n self << \"})\"\n end", "def inline_code; end", "def with_script_compiler(&block)\n in_environment do |env|\n env.with_script_compiler(&block)\n end\n end", "def use_marker_code(funcname, options = {})\n \n code_string = @js_funcs[funcname].join()\n @marker_code[funcname] = code_string\n @marker_code_funcname_lookup[funcname] = code_string.scan(/function\\s+(\\w+)\\s*\\(/)[0]\n @marker_code_args[funcname] = options[:with_args]\n\n end", "def build_js_funcs()\n\n js_out = \"\"\n @include_funcs.each do |fname|\n js_out << \"// #{fname}\\n\"\n raise NonExistantMJSError, \"_#{fname}.mjs does not exist in #{@mjs_path}.\" if @js_funcs[fname].nil? \n js_out << @js_funcs[fname].join()\n js_out << \"//\\n\"\n \n end\n return js_out\n end", "def anonymous?; end", "def js_func(*jsstmts) js_value %Q|function(rc) { #{jsstmts.join(COLON)}; }| end", "def create_script(wrap=false)\n script = CompiledMethod::Script.new(self)\n\n # Setup the scoping.\n ss = StaticScope.new(Object)\n ss.script = script\n\n if wrap\n @scope = StaticScope.new(Module.new, ss)\n else\n @scope = ss\n end\n\n sc = Rubinius::Type.object_singleton_class(MAIN)\n sc.method_table.store :__script__, self, :public\n VM.reset_method_cache :__script__\n\n script\n end", "def initialize(runtime=nil)\n runtime ||= ExecJS.runtime\n @context = runtime.compile(self.class.source)\n end", "def wrap(content, filename)\n code = \"(function($rb, self, __FILE__) { #{content} });\"\n # puts code\n @ctx.eval code, filename\n end", "def provide_jesture_tag(*args)\n <<-TAG\n <script type=\"text/javascript\">\n #{provide_jesture(*args)}\n </script>\n TAG\n end", "def render_inline_on_load_javascripts\n return '' if @content_for_jquery_onload.blank? && @content_for_javascript_files_onload.blank?\n js_code = \"\\n<!-- DEFFERRED On page load Javascripts -->\\n\"\n on_load_scripts = [ ]\n #write the onload inline javascripts\n on_load_scripts << @content_for_jquery_onload if @content_for_jquery_onload\n #write the javascript files which are jammed into the document head\n on_load_scripts << @content_for_javascript_files_onload if @content_for_javascript_files_onload\n js_code << javascript_tag(j_query_on_load_tag(on_load_scripts)) unless on_load_scripts.blank?\n js_code\n end", "def <<(javascript)\n self.script << javascript\n \n javascript\n end", "def defn(sexp, level)\n mid, args, stmts = sexp\n js_def nil, mid, args, stmts\n end", "def eClosure(ss)\n end", "def initial_dynamic_javascript\n res = []\n # res << %(Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token}'}; // Rails' forgery protection)\n res << %{Ext.ns('Netzke');}\n res << %{Ext.ns('Netzke.core');}\n res << %{Netzke.RelativeUrlRoot = '#{ActionController::Base.config.relative_url_root}';}\n res << %{Netzke.RelativeExtUrl = '#{ActionController::Base.config.relative_url_root}/extjs';}\n\n res << %{Netzke.core.directMaxRetries = '#{Netzke::Core.js_direct_max_retries}';}\n\n res.join(\"\\n\")\n end", "def js!\n js(reset: true)\n end", "def jrs_javascript(opts = {})\n opts[:wrap_id] ||= 'slideshow'\n opts[:active] ||= 'active'\n opts[:last_active] ||= 'last-active'\n opts[:cycle_time] ||= 4000\n opts[:selector] ||= 'img'\n opts[:transition_time] ||= 1000\n jq = (opts[:prototype] == true) ? 'jQuery' : '$'\n javascript_tag do\n str = <<STR\n #{\"jQuery.noConflict();\" if opts[:prototype]}\n function slideSwitch() {\n var $active = (#{jq}('##{opts[:wrap_id]} #{opts[:selector]}.#{opts[:active]}').length == 0) ? #{jq}('##{opts[:wrap_id]} #{opts[:selector]}:last') : #{jq}('##{opts[:wrap_id]} #{opts[:selector]}.#{opts[:active]}');\n var $next = $active.next().length ? $active.next('#{opts[:selector]}') : #{jq}('##{opts[:wrap_id]} #{opts[:selector]}:first');\n\n $active.addClass('#{opts[:last_active]}');\n\n $next.css({opacity: 0.0}).addClass('#{opts[:active]}').animate({opacity: 1.0}, #{opts[:transition_time]}, function() {\n $active.removeClass('#{opts[:active]} #{opts[:last_active]}');\n });\n }\n\n jQuery(function() { \n setInterval( \"slideSwitch()\", #{opts[:cycle_time]} );\n });\nSTR\n end\n end", "def compile()\n self._compiled = <<\"JAVASCRIPT\"\n(function(repl) {\n try {\n var rc;\n #{code.join(' ')}\n repl.rc_ok(rc);\n } catch(e) {\n repl.rc_fail(e.name, e.message ? e.message : e);\n };\n})(#{replid});\nJAVASCRIPT\n self._code = []\n end", "def add_function(name, &block)\n functions[name] = anonymous_function(block)\n end", "def js_tag(script) #:nodoc:\r\n \"<script type=\\\"text/javascript\\\">#{script}</script>\"\r\nend", "def js_tag(script) #:nodoc:\r\n \"<script type=\\\"text/javascript\\\">#{script}</script>\"\r\nend", "def script(&block)\n\t\t\t@script = block\n\t\tend", "def create_js_file(directory)\n js = %{// Javascript widget file\\n\n define(\\n\n // Dependencies\\n\n ['jquery', 'knockout'],\\n\n // Module Implementation\\n\n function($, ko) {\\n\n // We recommend enabling strict checking mode\\n\n 'use strict';\\n\n // Private variables and functions can be defined here...\\n\n var SOME_CONSTANT = 1024;\\n\n var privateMethod = function () {\\n\n // ...\\n\n };\\n\n return {\\n\n // Widget JS\\n\n onLoad: function(widget) {},\\n\n // Some member variables...\\n\n // Some public methods...\\n\n }\\n\n });}\n\n File.open(directory, \"w\") do |f|\n f.write(js)\n end\n end", "def javascript_tag(content_or_options_with_block = T.unsafe(nil), html_options = T.unsafe(nil), &block); end", "def execute_javascript(iJS)\n if RailsAjax.config.Enabled\n logger.debug \"[RailsAjax] Add javascript to be executed: #{iJS[0..255]}\"\n if (defined?(@JSToExecute) == nil)\n @JSToExecute = []\n end\n @JSToExecute << iJS\n end\n end", "def inject_javascript_at_end(*args)\n @javascript_codes ||= []\n @javascript_codes += args\n end", "def add_javascripts(*args, &block)\n add_or_print_scripts(:regulars, *args, &block)\n end", "def render_inline_javascripts\n #write out any inline javascript\n return '' if @content_for_inline_javascripts.blank?\n js_code = \"\\n<!-- Inline Javascripts -->\\n#{@content_for_inline_javascripts}\"\n end", "def jmaki_generate_script(script)\n \"<script type='text/javascript'>\" + script + \"</script>\\n\"\n end", "def tinymce_javascript(config=:default, options={})\n <<-JAVASCRIPT.strip_heredoc.html_safe\n (function() {\n if (typeof tinyMCE != 'undefined') {\n tinyMCE.init(#{tinymce_configuration(config, options).to_javascript.gsub(/^/, ' ' * 10).sub(/\\A\\s+/, \"\")});\n } else {\n setTimeout(arguments.callee, 50);\n }\n })();\n JAVASCRIPT\n end", "def javascript_doc_ready(&block)\n content = capture(&block)\n javascript_tag(\"$(document).ready(function(){#{content}});\")\n end", "def content_as_js_var(varname,value=nil,&block)\r\n return \"<script>#{varname}='#{escape_javascript(value)}';</script>\" unless block_given?\r\n concat(\"<script>#{varname}='#{escape_javascript(capture(&block))}';</script>\",block.binding)\r\n end", "def code\n str = Indentation.get\n str << \"var #{name} = function(#{@parameters.join(', ')}) {\\n\"\n Indentation.indent { str << \"#{block}\\n\" }\n str << \"#{Indentation.get}};\\n\"\n str\n end", "def initialize(*params)\n super(*params)\n @script = Script.new(nil, init_parameters, logger)\n @script.js_eval @init if @init\n @js_filter = nil\n end", "def scripts\n #Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline\n script(:src => '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js')\n script do\n rawtext(%{window.jQuery || document.write('<script src=\"#{js_urls(:lib).first}\"><\\\\/script>')})\n end\n #TODO should just be \"defer\" without attribute, but erector doesn't really do that\n js_urls(:app).each do |url|\n script(:defer => 'defer', :src => url) \n end\n \n #removed google analytics tag\n \n #Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6. \n # chromium.org/developers/how-tos/chrome-frame-getting-started\n comment('[if IE 7 ]') do\n script(:src => '//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js')\n script do\n rawtext(%{window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})})\n end\n end\n \n yield if block_given?\n end", "def nonced_javascript_tag(content_or_options = {}, &block)\n nonced_tag(:script, content_or_options, block)\n end", "def javascript(*files)\n add_files(*files)\n end", "def render_deferred_javascript_files\n #write any deffered javascript files\n return '' if @content_for_javascript_files.blank?\n js_code = \"\\n<!-- DEFFERRED Javascripts -->\\n#{@content_for_javascript_files}\"\n end", "def initialize(name=:js_build)\n @name = name\n @description = \"Building/Concatenating the JS files\"\n @pattern = '*.js'\n @deps = []\n @outdir = \".\"\n @inputdirs = []\n\n # don't look here!\n @file_list = []\n\n yield self if block_given?\n define\n end", "def netzke_js\n js=\"Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token}'}; // Rails' forgery protection\\n\"\n\n\n js << <<-END_OF_JAVASCRIPT if(!ActionController::Base.relative_url_root.blank?)\n // apply relative URL root, if set\n Ext.widgetMixIn.buildApiUrl= function(apip){\n return \"#{ActionController::Base.relative_url_root}/netzke/\" + this.id + \"__\" + apip;\n };\n Ext.BLANK_IMAGE_URL = \"#{ActionController::Base.relative_url_root}/extjs/resources/images/default/s.gif\";\n END_OF_JAVASCRIPT\n\n js << <<-END_OF_JAVASCRIPT\n #{@content_for_netzke_js_classes}\n Ext.onReady(function(){\n #{@content_for_netzke_on_ready}\n });\n END_OF_JAVASCRIPT\n\n javascript_tag js\n \n end", "def anonymous_function(block)\n lambda do |*args|\n # args: (this, node) v8 >= 0.10, otherwise (node)\n raise ArgumentError, \"missing node\" if args.empty?\n @tree[:Anonymous].new block.call(@tree, args.last)\n end\n end", "def coffeescript!\n @coffeescript = true\n end", "def lambdasaurus(some_code)\n\tputs \"I am a header\"\n\tsome_code.call\n\tputs \"I am a footer\"\nend", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def test_if\n code = <<CODE\na = 1\nif a\n b = 2\nend\nCODE\n \n js = <<JS\nvar a, b;\na = 1;\nif (a) {\nb = 2;\n};\nJS\n \n assert_equal js, @compiler.compile(code)\n end", "def define &block\n new block\n end", "def javascript path = nil, attrs = {}, &block\n contents = yield if block\n Tagz.tag :script, contents, { :type => 'text/javascript', :src => path }.merge(attrs)\n end", "def call_js(pattern, &block)\n return CallJS.new(pattern, self, &block)\n end", "def load_js(custom_js, opts = {})\n\n # Grab the complete javascript\n File.open(JavascriptFile) do |f|\n @js = f.read\n end\n\n # Decode the text\n @js = Rex::Text.decode_base64(@js)\n\n # Append the real code\n @js += \"\\n\" + custom_js\n\n if opts[:newobfu]\n # Obfuscate the javascript using the new lexer method\n js_obfu = JSObfu.new(@js)\n js_obfu.obfuscate\n @js = js_obfu.to_s\n return @js\n elsif opts[:noobfu]\n # Do not obfuscate, let the exploit do the work (useful to avoid double obfuscation)\n return @js\n end\n\n # Default to the old method\n # Obfuscate the javascript using the old method\n @js = ObfuscateJS.obfuscate(@js, 'Symbols' => SymbolNames)\n end", "def inline_javascript(name)\n content_tag :script do\n sprockets[\"#{name}.js\"].to_s\n end\n end", "def inline_javascript(name)\n content_tag :script do\n sprockets[\"#{name}.js\"].to_s\n end\n end", "def build_load_func\n return_string = \"\"\n return_string << @onload_func[:head]\n return_string << to_javascript\n return_string << map_onload_func_body\n return_string << @onload_func[:tail]\n end", "def to_html(options = {})\r\n no_load = options[:no_load]\r\n no_script_tag = options[:no_script_tag]\r\n no_declare = options[:no_declare]\r\n no_global = options[:no_global]\r\n fullscreen = options[:full]\r\n load_pr = options[:proto_load] #to prevent some problems when the onload event callback from Prototype is used\r\n \r\n html = \"\"\r\n html << \"<script type=\\\"text/javascript\\\">\\n\" if !no_script_tag\r\n #put the functions in a separate javascript file to be included in the page\r\n html << @global_init * \"\\n\"\r\n html << \"var #{@variable};\\n\" if !no_declare and !no_global\r\n if !no_load\r\n if load_pr\r\n html << \"Event.observe(window,'load',\"\r\n else\r\n html << \"window.onload = addCodeToFunction(window.onload,\"\r\n end\r\n html << \"function() {\\n\"\r\n end\r\n\r\n html << \"if (GBrowserIsCompatible()) {\\n\" \r\n \r\n if fullscreen\r\n #Adding the initial resizing and setting up the event handler for\r\n #future resizes\r\n html << \"setWindowDims(document.getElementById('#{@container}'));\\n\"\r\n html << \"if (window.attachEvent) { window.attachEvent(\\\"onresize\\\", function() {setWindowDims(document.getElementById('#{@container}'));})} else {window.addEventListener(\\\"resize\\\", function() {setWindowDims(document.getElementById('#{@container}')); } , false);}\\n\"\r\n end\r\n \r\n if !no_declare and no_global \r\n html << \"#{declare(@variable)}\\n\"\r\n else\r\n html << \"#{assign_to(@variable)}\\n\"\r\n end\r\n html << @init_begin * \"\\n\"\r\n html << @init * \"\\n\"\r\n html << @init_end * \"\\n\"\r\n html << \"\\n}\\n\"\r\n html << \"});\\n\" if !no_load\r\n html << \"</script>\" if !no_script_tag\r\n \r\n if fullscreen\r\n #setting up the style in case of full screen\r\n html << \"<style>html, body {width: 100%; height: 100%} body {margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0px} ##{@container} {margin: 0px;} </style>\"\r\n end\r\n \r\n html\r\n end", "def js_includes\n end", "def eval_into(module_scope, &block)\n $RUBYJS__MODULE_SCOPE = module_scope\n $RUBYJS__LOADED ||= [] # avoids recursive loads\n\n $RUBYJS__EVAL = proc {|str|\n $RUBYJS__MODULE_SCOPE.module_eval(str)\n }\n\n # install \"require\" handler\n alias old_require require\n def require(file)\n ($RUBYJS__LOAD_PATH||['.']).each do |path|\n name = File.expand_path(File.join(path, file + \".rb\"))\n if File.exists?(name)\n if $RUBYJS__LOADED.include?(name)\n return false\n else\n $RUBYJS__LOADED << name\n STDERR.puts \"loading file: #{name}\" if $DEBUG\n $RUBYJS__EVAL.call(File.read(name)) \n \n #\n # load also platform specific file\n # load first matching platform\n #\n\n ($RUBYJS__PLATFORM||[]).each do |plat|\n plat_name = File.expand_path(File.join(path, file + \".\" + plat + \".rb\"))\n next unless File.exists?(plat_name)\n unless $RUBYJS__LOADED.include?(plat_name)\n $RUBYJS__LOADED << plat_name\n STDERR.puts \"loading platform specific file: #{plat_name}\" if $DEBUG\n $RUBYJS__EVAL.call(File.read(plat_name))\n break\n end\n end\n \n return true\n end\n else\n\tnext\n end\n end\n raise ::RuntimeError, \"require: #{file} not found\"\n end\n\n\n block.call($RUBYJS__EVAL)\n\n # change \"require\" handler back to original\n alias require old_require\nend", "def code_point; end", "def to_js_full_script(element_id=SecureRandom.uuid)\n js = ''\n js << '\\n<script type=\\'text/javascript\\'>'\n js << load_js(element_id)\n js << draw_js(element_id)\n js << '\\n</script>'\n js\n end", "def initialize\n\n # call super to make @base_engine available\n super\n \n @engine = Proc.new do |options|\n\n # check if require should be relative or not\n req = (options[['relative']].is__null | options[['relative']].isTRUE) >> 0\n \n # load the content of the file in options.code\n options.code = GalaazUtil.inline_file(options.label >> 0, req)\n\n @base_engine.call(options)\n end\n \n # Add the include engine function for processing the rb block\n add(include: @engine)\n \n end", "def transpile\n code = String.new(\" \")\n code << \"$#{body['name']} = \" if body['name']\n code << function_call(function, format_args(body))\n code << \"\\n\"\n end", "def add_js(code_string, options = {})\n @js_code[options[:as]] = code_string\n end", "def code\n call_once\n @code\n end", "def javascript_library=(jslib)\n require \"scaffolding_extensions/#{jslib.downcase}_helper\"\n ScaffoldingExtensions::Helper.send(:include, const_get(\"#{jslib}Helper\"))\n end", "def eval script\n # native function. this stub is for documenting only\n end", "def experiment_decorator(name)\n wrap = lambda do |f|\n wrapped_f = lambda do |args|\n params = PlanOut::Assignment.new(name)\n return f.call(params, args)\n end\n return wrapped_f\n end\n return wrap\n end", "def scriptlink(scr = '/js/ajaxhelper.js')\n \"<script type='text/javascript' src='#{scr}'></script>\"\n end", "def js name, version='', options={}\n component name, version, options.merge(js: true)\n end", "def jmaki_setup\n\n # Configure global variables as needed\n # FIXME - next three lines are a real hack\n railsURI = request.request_uri # Usually just /controller/action\n requestURI = request.env['REQUEST_URI'] # Entire absolute URI\n webRoot = requestURI[0, (requestURI.length - railsURI.length)]\n result = \"<script type='text/javascript'>\\n\" +\n \" jmaki.webRoot = '\" + webRoot + \"';\\n\" +\n \" jmaki.resourcesRoot = '/resources';\\n\" +\n \" jmaki.xhp = '\" + webRoot + \"/xhp';\\n\" +\n \"</script>\\n\"\n\n # Load global configuration\n global = jmaki_load_global()\n\n # Render glue includes as necessary\n config = global['config']\n if config\n glue = config['glue']\n if glue\n includes = glue['includes']\n if includes\n for i in 0...includes.length\n include = includes[i]\n if include.instance_of?(String)\n result += jmaki_generate_js(include)\n elsif include.instance_of?(Hash)\n lib = include['lib']\n url = include['url']\n if lib && url && jmaki_match_url(url)\n result += jmaki_generate_js(lib)\n end\n end\n end\n end\n end\n if config['globalTheme']\n @jmakiGlobalTheme = config['globalTheme']\n end \n end\n\n # Return the accumulated result\n result\n\n end", "def function_define(name=\"\",&block)\n \"function #{name}() { #{block.call} }\" \n end", "def ajax_form_preparer(opts = {})\n form_id = opts[:form_id] || id\n <<-EOF\n <script type=\"text/javascript\">\n \t$(document).ready(function() {\n \t $(\"form##{form_id}\").submit(function() {\n \t #{id}($(\"form##{form_id}\").serialize(), \"form##{form_id}\");\n \t return false;\n \t });\n });\n </script>\n EOF\n end", "def add_to_js_queue(type, *args) # This shouldn't worry about blocks. #add_or_print_scripts feeds a capture(&block)\n append_javascripts(type, args.flatten) # this method already returns nil.\n end", "def code_point=(_); end", "def define_helpers; end", "def instance_eval\n end", "def javascript(*args)\n args = *args.map { |arg| arg == :defaults ? arg : arg.to_s }\n content_for(:javascripts) { javascript_include_tag()}\n end", "def ajax_action_code\n js = Waw::ActionController::JSGeneration.new\n code = js.generate_js_for_action(Waw::kernel, self, \"\")\n <<-EOF\n <script type=\"text/javascript\">\n #{code}\n </script>\n EOF\n end", "def js(name, *args)\n js_or_css :js, name, *args\n end", "def wrapper; end", "def coffee2js(code)\n\trnd= ('a'..'z').to_a.shuffle[0,8].join\n\t#`rm /tmp/coffee_#{rnd}`\n\t`touch /tmp/coffee_#{rnd}`\n\tf=File.open \"/tmp/coffee_#{rnd}\",\"w\"\n\tf.write code\n\tf.close\n\t`cat /tmp/coffee_#{rnd}|coffee -sc` # \"Compiled\" coffee to js will be the output.\nend", "def define; end" ]
[ "0.63017625", "0.6093915", "0.6088926", "0.6069681", "0.5878559", "0.58464724", "0.5798484", "0.5696495", "0.5678798", "0.56658477", "0.56475675", "0.56444037", "0.55942184", "0.5500175", "0.5484742", "0.5475648", "0.545346", "0.5435584", "0.54086", "0.5400418", "0.5390058", "0.53764623", "0.536853", "0.5352983", "0.5343721", "0.5314937", "0.53094876", "0.5307512", "0.52967876", "0.529011", "0.5288032", "0.52698755", "0.52435476", "0.5231696", "0.5228681", "0.52273554", "0.52273554", "0.5210281", "0.5191283", "0.5189747", "0.51720256", "0.5169747", "0.5167209", "0.51609945", "0.5153044", "0.51523054", "0.51376957", "0.51366574", "0.5124249", "0.51228255", "0.511428", "0.50870407", "0.5079886", "0.507718", "0.506985", "0.5039845", "0.50164115", "0.5015645", "0.50151783", "0.50064844", "0.50064844", "0.50064844", "0.50064844", "0.50064844", "0.50064844", "0.50064844", "0.4997093", "0.49789903", "0.49760178", "0.4971253", "0.4970395", "0.49696073", "0.49696073", "0.49623594", "0.494494", "0.49384275", "0.49298835", "0.49240634", "0.49211892", "0.49100792", "0.49034366", "0.48947862", "0.48905918", "0.48747712", "0.4870407", "0.48529077", "0.484329", "0.48412073", "0.48394516", "0.48393443", "0.48347333", "0.48344955", "0.4833963", "0.48337403", "0.48334256", "0.4829558", "0.4824434", "0.48219275", "0.4820932", "0.48209152", "0.48202857" ]
0.0
-1
GET /locations/1 GET /locations/1.json
def show_location end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locations\n get('locations')\n end", "def get_location\n as_json(get_results('/locations.json'))\n end", "def index\n locations = Location.all\n render json: locations\n end", "def index\n locations = @project.locations.all\n render json: { locations: locations }\n end", "def show\n render json: Location.find(params[\"id\"])\n end", "def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end", "def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end", "def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end", "def show\n render :json => Location.find(params[:id])\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end", "def locations(place)\n get :loc => place\n end", "def show\n respond_to do |format|\n format.html { @api_v1_location }\n format.json { render json: {results: @api_v1_location, message: 'Locations have loaded successfully.'} }\n end\n end", "def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end", "def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end", "def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end", "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "def show\n @loc = Loc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loc }\n end\n end", "def show\n @campus_food = CampusFood.find(params[:id])\n\t@loc = params[:loc]\n\t\n\t@locations = Location.all(:conditions =>[ \"loc like ? \", \"%#{params[:loc]}%\"])\n\tif !@locations.empty?\n @lat = @locations[0].lat\n @lng = @locations[0].lng\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locations }\n end\n end", "def get(params = {})\n client.get(\"/v1/reference-data/locations/#{@location_id}\", params)\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n render json: @locationProut\n end", "def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @location }\n end\n end", "def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end", "def show\r\n @location = Location.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @location }\r\n end\r\n end", "def index\n @locations = Location.all\n\n respond_with(@locations)\n end", "def show\n render json: @service_location\n end", "def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end", "def show\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_url_map }\n end\n end", "def show\n @corp_location = CorpLocation.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_location }\n end\n end", "def show\n\t\t@all_locations = Location.where(:faculty => params[:id])\n\t\trender :json => @all_locations\n\tend", "def event_get_location_details\n @loc = Apis::HereApi.new(\"\").get_location_details(params[:locationid])\n render json: @loc\n end", "def index\n @locations = current_user.locations\n respond_with @locations\n end", "def show\n @location = Location.find(params[:id])\n @jobs = @location.jobs\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def query\n { :locations => [] }\n end", "def index\n @items_locations = ItemsLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items_locations }\n end\n end", "def location(id, options = {})\n get \"locations/#{id}\", options\n end", "def location_primer\n render(json: location_list)\n end", "def show\n @location_have_location = LocationHaveLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_have_location }\n end\n end", "def show\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def list_locations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1LocationsApi.list_locations ...\"\n end\n # resource path\n local_var_path = \"/v1/me/locations\".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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<V1Merchant>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1LocationsApi#list_locations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end", "def index\n @processed_locations = ProcessedLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @processed_locations }\n end\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def index\n @event_locations = EventLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_locations }\n end\n end", "def show\n @items_location = ItemsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @items_location }\n end\n end", "def locations(query = {})\n get('location', query)\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username2,\n :password => $password2,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def show\n @processed_location = ProcessedLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processed_location }\n end\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username1,\n :password => $password1,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def index\n @locations = Location.order(:country).order(:region).order(:city).page(params[:page])\n respond_with(@locations)\n end", "def index\n @user_locations = ::Users::UserLocation.where(user_id: auth_user.id).order('is_primary desc')\n @page_title = 'Your Addresses'\n\n respond_to do|format|\n format.html\n format.json { render json: @user_locations }\n end\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def index\n @locations = Location.all\n end", "def show\n @itemname = Itemname.find(params[:id])\n @locations = Location.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemname }\n end\n end", "def show\n @records_location = RecordsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @records_location }\n end\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 locations\n farm = Farm.find(params[:id])\n\n @locations = []\n # Find which locations this user is authorized to access\n if (current_user.is_hog_owner? || current_user.is_farm_owner? || current_user.is_admin?)\n @locations = farm.locations\n elsif current_user.is_barn_manager?\n @locations << current_user.owner.barn.location\n elsif current_user.is_site_manager?\n @locations << current_user.owner.location\n end\n\n @page_title = \"Sites\"\n @header_icon_class = \"icon-road\"\n @page_subtitle = \"\"\n \n respond_to do |format|\n format.html { render '/locations/index' }\n format.json { render json: @locations }\n end\n end", "def show\n @event = Event.find_by_url(params[:id])\n @json = Location.where(id: @event.location_id).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :timeout => -1,\n :headers => { :accept => :json,\n :content_type => :json ,\n :params => { \"page\" => 1, \"per_page\" => 25000 }}\n ).execute\n results = JSON.parse(response.to_str)\n end", "def location\n @client.get(\"#{path}/location\")\n end", "def index\n @location_points = LocationPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @location_points }\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 index\n @specific_locations = SpecificLocation.all\n end", "def index\n @region = Region.find_by_id params[:region_id]\n @locations = @region.locations.select(\"id,name,region_id\")\n\n respond_with @locations #Location.select(\"id,name\")\n end", "def index\n code = :ok\n currentUser = {\n id: current_user.utilisateur.id,\n fullName: current_user.utilisateur.prenom_nom,\n }\n result = {\n signedIn: user_signed_in?,\n currentUser: currentUser,\n locations: Lieu.all\n }\n render json: result, status: code \n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def lookup\n respond_to do |format|\n @grid = Grid.find_by_location(params[:location])\n format.json {render json: @grid.colors, status: :ok, location: @grid }\n end\n end", "def show\n @event_location = EventLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_location }\n end\n end", "def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end", "def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end", "def locations\n @client.get('/BikePoint')\n end", "def index\n @locations = salor_user.get_locations(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end", "def getlocation\n \tlocafid = Windmill.where(no: params[:no])\nif locafid.present?\n \t\tlocafid = Windmill.find_by(no: params[:no])\n \t\trender json: [locafid.as_json(only: [:no, :latitude, :londitude,:location])]\nelse\n \t\trender json: {massage: 'windmill not found'}\n end\nend", "def index\n @drop_locations = DropLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drop_locations }\n end\n end", "def show\n @subcellular_location = SubcellularLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subcellular_location }\n end\n end", "def show\n Project.hit 4\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location, callback: params[:callback] }\n format.xml { render xml: @location }\n end\n end", "def get_locations\n response = execute_get(\"/reference/location\")\n Location.from_array(decode(response))\n end", "def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @locations }\n end\n end" ]
[ "0.77431786", "0.7690497", "0.7402892", "0.7278375", "0.72128636", "0.7179753", "0.71755373", "0.7158328", "0.71116275", "0.70961183", "0.70597774", "0.7054361", "0.7042809", "0.7010643", "0.6969208", "0.6925418", "0.69004", "0.68884706", "0.6884856", "0.6876957", "0.68584985", "0.68428624", "0.68428624", "0.68428624", "0.68428624", "0.68428624", "0.68428624", "0.68428624", "0.68428624", "0.68428624", "0.68313414", "0.6824635", "0.68022317", "0.6773676", "0.6752572", "0.6745603", "0.673513", "0.6733442", "0.67232", "0.6696737", "0.66932213", "0.6681895", "0.667839", "0.66774815", "0.6677341", "0.66534835", "0.6639943", "0.6632918", "0.6602802", "0.6596983", "0.6587194", "0.6563976", "0.65462655", "0.6526792", "0.6503008", "0.6503008", "0.65020674", "0.64907634", "0.6485564", "0.6485113", "0.6481792", "0.6480577", "0.6479772", "0.64720654", "0.6432456", "0.6432456", "0.6432456", "0.6432456", "0.6432456", "0.6432456", "0.6432456", "0.6432456", "0.6432456", "0.6432456", "0.6432456", "0.6427563", "0.6425922", "0.6413847", "0.6408572", "0.6393243", "0.63905317", "0.6380524", "0.6377171", "0.6370189", "0.636259", "0.63612527", "0.6333572", "0.63298523", "0.632484", "0.63139945", "0.6278583", "0.6267227", "0.6267227", "0.6257647", "0.62488735", "0.6226125", "0.62191814", "0.6217638", "0.6210839", "0.6203867", "0.6203039" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_location @location = Location.find_by(slug: params[:slug]) 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_handler\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 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 setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\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 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 before_action \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 setup_signals; end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n 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 after_set_callback; end", "def initialize(*args)\n super\n @action = :set\nend", "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 around_hooks; 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 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 setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def call\n setup_context\n super\n end", "def duas1(action)\n action.call\n action.call\nend", "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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0.53307265", "0.5312121", "0.5298173", "0.5296388", "0.52952695", "0.5258086", "0.52430934", "0.5237911", "0.5237911", "0.5237911", "0.5237911", "0.5237911", "0.52335346", "0.5232943", "0.5226392", "0.52221715", "0.5217978", "0.52136153", "0.52076435", "0.52067244", "0.5175402", "0.5174649", "0.5173085", "0.5165201", "0.5162052", "0.5157932", "0.5152905", "0.5152353", "0.5150909", "0.514719", "0.5138596", "0.51333916", "0.51139015", "0.5113431", "0.5113431", "0.5109581", "0.51066816", "0.5091428", "0.5089407", "0.5082971", "0.50822043", "0.50668514", "0.5055155", "0.50525695", "0.50499475", "0.50499475", "0.5034445", "0.50249445", "0.5022226", "0.50167644", "0.5014211", "0.4999924", "0.49996212", "0.49978727", "0.4989682", "0.4989682", "0.49851838", "0.49817684", "0.4979687", "0.49787104", "0.49688423", "0.49664098", "0.49564412", "0.49561828", "0.49547398", "0.4953481", "0.4952925", "0.4946049", "0.494379", "0.49319315", "0.49313048", "0.49269778", "0.49263066", "0.49257493", "0.4924526", "0.49212465", "0.49173486", "0.4915802", "0.49151486", "0.49150333", "0.49147308" ]
0.0
-1
TODO: Divide File storage and JSON storage
def load_penalties JSON.parse(File.read(@filename)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_filedata(uid)\n json = {}\n id = uid.to_i\n dir = id%100\n dir = \"#{fs_root}/#{dir.to_s}/#{id}_lastread\"\n FileUtils.makedirs(dir)\n fname = \"#{dir}/jsondata\" \n #p \"query_filedata:filename #{fname}\"\n\n begin\n if FileTest::exists?(fname) \n data= nil \n open(fname, \"r\") {|f|\n data = f.read\n # f.seek(0)\n # f.write(\"\") \n # f.truncate(0)\n }\n # p \"data=#{data.inspect}\"\n json = JSON.parse(data) if data\n end\n rescue Exception=>e\n # logger.error e\n p e.inspect\n pe(e)\n \n end\n\n return json\n\n end", "def storage; end", "def load_json(filename); end", "def getFileContent(file_path)\n file = File.read(file_path)\n data_hash = JSON.parse(file)\n return data_hash\nend", "def run\n super\n\n f = _get_entity_name\n\n # Read and split the file up\n begin\n json = JSON.parse (File.open(f,\"r\").read)\n rescue JSON::ParserError => e\n _log_error \"Unable to parse, failing...\"\n return\n end\n\n\n\n\n\n end", "def call(filename, storage_info, public_flag)\n primary_store = storage_info.keys.first\n asset = create filename,\n repository(primary_store),\n storage_info[primary_store],\n copies(storage_info),\n public_flag\n json_from asset\n end", "def tjson(str)\n path = tmp_file(str)\n \n if File.exists?(path)\n fjson(path)\n else\n fjson(tmp_file(\"#{str}.json\"))\n end\nend", "def storage() @storage; end", "def get_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Aquire raw JSON\n\t\traw = aquire_raw(id)\n\n\t\t# Escape if object not found\n\t\treturn nil if raw.nil?\n\n\t\t# Create object\n\t\tobj = JSON::parse(raw)\n\n\t\t# Grab needed objects, args => self\n\t\tobj.cache_collect\n\n\t\t# return\n\t\treturn obj\n\tend", "def save_to_storage(obj)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Build a white list for classes if doesn't exist\n\t\t@checked_classes = [] if @checked_classes.nil?\n\n\t\t# Check the object has a sane to_json defined\n\t\tif !@checked_classes.include?(obj.class.name)\n\t\t\tbegin\n\t\t\t\tJSON::parse(obj.to_json)\n\t\t\t\t@checked_classes << obj.class.name\n\t\t\trescue\n\t\t\t\traise \"[FATAL] Object cannot be stored, to_json method not defined\"\n\t\t\tend\n\t\tend\n\t\t\t\n\n\t\twrite_raw(obj)\n\tend", "def get_data()\n if File.exists?(FILENAME)\n results = JSON.parse(File.read(FILENAME))\n return results\n else\n # JSON only parses strings, so it makes things much faster to simply write the key as in a format that JS can use.\n {\"users\" => []}\n end\nend", "def fjson(str)\n pjson(File.open(str))\nend", "def storage_attributes\n JSON.parse self.storage.to_json\n end", "def json(*files, **options, &block) = read(*files, parse: :json, ext: '.json', **options, &block)", "def store_json(json, compressed, album_type)\n if match_type(album_type)\n self.json = json\n self.compressed = compressed\n end\n end", "def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $stderr.puts \"#{@file_path} does not exist\"\n end\n end", "def uploaded_file(object, &block)\n if (hash = object).is_a?(Hash) && !hash.key?(\"storage\")\n hash.inject({}) do |result, (name, data)|\n result.update(name.to_sym => uploaded_file(data, &block))\n end\n else\n super\n end\n end", "def write_user(users)\nbegin\n File.open(\"./files/user_info.json\", \"w\") do |f|\n f.write(users.to_json)\n end \nrescue Errno::ENOENT\n puts \"This file does not exist, Please re-check source files\"\nend\n\nend", "def getHashFromJson(filename)\n File.open( filename, \"r\" ) do |f|\n JSON.load(f)\n end\nend", "def getjson(filename)\n #checks if file exists and goes to failed page if it doesn't\n if File.file?(\"/home/vagrant/register-stub/data/\"+filename)\n json = File.read(\"/home/vagrant/register-stub/data/\"+filename)\n obj = JSON.parse(json.force_encoding(\"iso-8859-1\"))\n return obj.to_json\n else\n redirect \"../failed\"\n end\nend", "def content\n fields = self.get_fields\n fields.empty? ? self.data.merge(self.file_data).to_json : fields.to_json\n end", "def storage_hash\n JSON.parse(@bot.storage.reload.content || '{}')\n end", "def read_jason(file_path)\r\n json_file = File.read(file_path)\r\n data_hash = JSON.parse(json_file)\r\n return data_hash\r\nend", "def storage\n uploader.storage\n end", "def get_data(class_name)\n return JSON.parse(File.read(@database_file))[class_name]\n \n # error handling\n rescue Errno::ENOENT\n File.open(@database_file, 'w+')\n File.write(@database_file, [])\n retry\n end", "def read_articles\n JSON.parse(File.read(\"articles.json\"))\nend", "def filename\n files = Hash.new\n filenames = Dir.glob('/home/vagrant/register-stub/data/*.json')\n filenames.foreach(\".\") do |file|\n puts file\n files[file].add file\n end\n return files.to_json\nend", "def read_from_json\n JSON.parse File.new(@filepath).read\n end", "def parse json; return JSON.parse File.read json end", "def parse json; return JSON.parse File.read json end", "def openJsonFile(filepath)\n $file = File.open filepath\n $jsonObjectMain = JSON.load $file\n return $jsonObjectMain\nend", "def process_file(filename)\n structure = nil\n begin\n structure = JSON.parse( IO.read(filename, encoding:'utf-8') )\n rescue\n print \"Error loading/parsing File: #{$!}\"\n return nil\n end\n begin\n if( structure[\"restaurants\"].count > 0 )\n structure[\"restaurants\"].each do |r_data|\n if( r_data[\"name\"] && r_data[\"rating\"] && r_data[\"meals_qty\"] )\n restaurant = Restaurant.new(r_data[\"name\"],r_data[\"rating\"],r_data[\"meals_qty\"])\n if( r_data[\"specials\"] )\n specials = r_data[\"specials\"]\n specials.each do |special|\n special.keys.each do |key|\n restaurant.addMeal(Meal.new( key, special[key] ))\n end\n end\n end\n addRestaurant(restaurant)\n else\n print \"Restaurant #{r_data} doesn't have minimum data\"\n return\n end\n end\n if( structure[\"order\"] )\n if( structure[\"order\"][\"quantity\"] )\n order_meal = OrderMeal.new(structure[\"order\"][\"quantity\"])\n specials = structure[\"order\"][\"specials\"]\n if( specials )\n specials.each do |special|\n special.keys.each do |key|\n order_meal.addMeal(Meal.new( key, special[key]))\n end\n end\n end\n return finder(order_meal)\n else\n print \"No quantity defined for order.\"\n end\n end\n else\n print \"No restaurantsi defined\";\n return\n end\n rescue\n print \"Error trying to load structure on #{$!}\"\n end\n return\n end", "def load_json(filename)\n File.open(File.expand_path(\"../support/#{filename}\", __FILE__), \"r\") do |json_file|\n JSON.load(json_file)\n end\nend", "def readJson(dataFilePath)\n dataFile = File.new(dataFilePath, \"r\");\n data = JSON.load(dataFile);\n dataFile.close();\n data;\nend", "def files_json_seed(json, entry)\n Pageflow.config.file_types.each do |file_type|\n json.set!(file_type.collection_name) do\n json.array!(entry.find_files(file_type.model)) do |file|\n json.partial!('pageflow/files/file', file: file, file_type: file_type)\n end\n end\n end\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def read_as_json(filename)\n @log.info(\"Converting file #{filename} to JSON\")\n @payload = File.read(filename)\nend", "def json_to_file(object, file_path_and_name)\n open(\"#{file_path_and_name}.json\", \"wb\") do |file| \n file.write(object.to_json)\n true\n end\n end", "def read_json_file(path)\n JSON.parse(File.open(path){ |f| f.read })\nend", "def read\n return nil unless File.file?(\"./#{filename}\")\n JSON.parse(IO.read(filename))\n end", "def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"../report.txt\", \"w+\")\nend", "def save\n #we create a hash to save the values into:\n new_json = {name: @name, email: @email, permissions: @permissions}.to_json\n #we open a new file and append (a) the new values to it.\n open('users.json', 'a') do |file|\n file.puts new_json\n end\n\n end", "def file_uploads; end", "def save_data(data)\n raw = JSON.dump(data)\n File.open(FILENAME, 'w') do |file|\n file.write(raw)\n end\nend", "def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"report.txt\", \"w+\")\nend", "def readJsonIntoString(hashed_data2, path, dataFolder)\r\n user2 = File.read(path+\"\\\\#{dataFolder}\\\\users.json\")\r\n hashed_data2 = JSON.parse(user2)\r\n return hashed_data2\r\n end", "def save\n @id ||= '%064d' % CloudKit.storage_adapter.generate_unique_id\n @etag = UUID.generate unless @deleted\n @last_modified = Time.now.httpdate\n\n CloudKit.storage_adapter[@id] = {\n 'uri' => @uri.cannonical_uri_string,\n 'etag' => escape(@etag),\n 'last_modified' => @last_modified,\n 'json' => @json,\n 'deleted' => escape(@deleted),\n 'archived' => escape(@archived),\n 'remote_user' => escape(@remote_user),\n 'collection_reference' => @collection_reference ||= @uri.collection_uri_fragment,\n 'resource_reference' => @resource_reference ||= @uri.cannonical_uri_string\n }.merge(escape_values(parsed_json))\n reload\n end", "def json_struct(filename)\n JSON.parse json_string(filename)\n end", "def save\n Chef::FileCache.store(\"remote_file/#{sanitized_cache_file_basename}\", json_data)\n end", "def storage\n require 'yaml/store'\n Storage[object_id] ||= YAML::Store.new(STORAGE_FILE)\n end", "def write_json_file(json, filepath)\n File.open(filepath,\"w\") do |f|\n f.write(json.to_json)\n end\nend", "def evolution_data\n## reads evolution json (1-120 digimons) and parses\nevo_file = File.read(\"#{__dir__}/../dh-data/json/tree-0002-0120.json\")\nevo_data = JSON.parse(evo_file)\nend", "def importFromFile(type, json_hash)\n idx = 0\n len = json_hash.length\n json_hash.each do |arr|\n # this is for jason, remove for prod\n if idx > 500\n break\n end\n begin\n type.create(arr)\n idx += 1\n puts \"Added #{idx}/#{len}\"\n rescue => exception\n puts \"Error #{exception}\"\n end\n end\nend", "def parsed\n JSON.parse(File.read(\"#{Rails.root}/public/#{@file}\"))\n end", "def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend", "def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend", "def file_upload_data(item = nil)\n fd = get_file_data(item)\n fd = fd[:uploader] if fd[:uploader].is_a?(Hash)\n fd.deep_symbolize_keys if fd[:storage].present?\n end", "def save\n cache_json = JSON.generate @_cache\n File.open(@file_path, 'w') { |file| file.write(cache_json) }\n end", "def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end", "def storage\n @storage ||= in_memory\n end", "def storage\n @storage ||= in_memory\n end", "def read\n file = File.read(@filename)\n JSON.parse(file)\n end", "def guarda nombre, data\n fname = \"#{$outDir}/#{nombre}.json\"\n puts \"Creando #{fname}\"\n FileUtils.mkdir_p File.dirname(fname)\n File.open(fname, 'w+') do |f|\n f << data.to_json\n end\nend", "def load_data(file_path)\n json_data = JSON.parse(File.read(file_path))\n @processed_favs = json_data.map do |fav|\n fav.transform_keys(&:to_sym) \n end\n\n i = 0\n while i < @processed_favs.length\n\n items = @processed_favs[i][:name]\n @fav_list << items\n\n i += 1\n end\n rescue Errno::ENOENT\n File.open(file_path, 'w+')\n File.write(file_path, [])\n retry\n end", "def save_json_quiz(params)\n unless params[:filequiz] && (tmpfileQuiz = params[:filequiz][:tempfile]) && (nameQuiz = params[:filequiz][:filename])\n return haml(:upload)\n end\n #while blk = tmpfile.read(65536)\n File.open(File.join(Dir.pwd, \"uploads\", nameQuiz), \"wb\") { |f| f.write(tmpfileQuiz.read) }\n #end\n File.join(Dir.pwd, \"uploads\", nameQuiz)\n end", "def initialize\n @json_file = JSON.parse(HTTParty.get('http://data.fixer.io/api/latest?access_key=8673ff340f8c9309e05687dc6d5454f9').body)\n end", "def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"report.txt\", \"w+\")\nend", "def save\n # Convert hash to JSON\n self_json = {email: @email, name: @name, permissions: @permissions}.to_json\n #Open the file and append the JSON to the file\n open('users.json', 'a') do |file|\n file.puts self_json\n end\n end", "def write_json(user_hash)\n File.exist?('public/user.json') ? json = JSON.parse(File.read('public/user.json')) : json = []\n File.open(\"public/user.json\",\"w\") { |f| f.puts JSON.pretty_generate(json << user_hash) }\nend", "def add_json(file)\n new_json = parse_json_file(file)\n store_all_cities(new_json)\n store_all_routes(new_json)\n end", "def write_file(post_data)\n File.open(\"public/post_data.txt\",\"w\") do |f| # open the user.json file in the /public directory (create if not present)\n f.write(post_data) # add the hash to the JSON file and save it\n end\nend", "def initialize(path)\n\t\t\n\t\t# if data directory or json file don't exist, create them\n\t\tunless Dir.exist?(\"./data\")\n\t\t\tDir.mkdir(\"./data\")\n\t\tend\n\n\t\tunless File.exist?(path)\n\t\t\tFile.open(path, \"w\") { |f|\n\t\t\t\tf.write(\"[]\")\n\t\t\t\tf.close\n\t\t\t}\n\t\tend\n\n\t\t# read json file to memory and parse to Array\n\t\t@json_file = File.read(path)\n\t\t@json_data = JSON.parse(@json_file)\n\tend", "def _store(io, context)\n _enforce_io(io)\n context[:location] ||= get_location(io, context)\n context[:metadata] ||= get_metadata(io, context)\n\n put(io, context)\n\n self.class::UploadedFile.new(\n \"id\" => context[:location],\n \"storage\" => storage_key.to_s,\n \"metadata\" => context[:metadata],\n )\n end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def load_bitbucket()\n JSON.parse(IO.read('db-1.0.json'))\nend", "def file_target(options)\n # The file must exist and be readable.\n state = nil\n\n if not File.exist?(options[:file]) then\n state = 'does not exist'\n elsif not File.readable?(options[:file]) then\n state = 'is not readable'\n end\n\n if state then\n msg = '%s %s.' % [options[:file], state]\n Nagios.do_exit(2, msg)\n end\n\n begin\n # Make a JSON object from the contents of the file.\n json = JSON.parse(File.read(options[:file]))\n rescue Exception => e\n say(options[:v], 'Could not parse JSON from input file: %s.' % [e])\n msg = 'Parsing JSON failed.'\n Nagios.do_exit(3, msg)\n end\n\n return json\nend", "def parse_json_file(file_path_as_string)\n\n begin\n\n @parsed_data = JSON.load_file(file_path_as_string, symbolize_names: true)\n\n rescue Errno::ENOENT => e\n puts Rainbow(\"\\n\\nWell now.... file appears to be missing..... I wonder where it went ?\").yellow\n sleep 1\n error_message_and_leave(e)\n\n rescue Errno::EACCES => e\n puts Rainbow(\"\\n\\nSo you haven't got permission for this file.... Dunno why.... Guess you're not at Level 8 Clearance..\").yellow\n sleep 1\n error_message_and_leave(e)\n\n rescue StandardError => e\n puts Rainbow(\"\\n\\nAwkies.... the file is not loading.... probably a user error :) \").yellow\n sleep 1\n error_message_and_leave(e)\n\n end\n\n end", "def saveJSON\n File.open(\"./db/larves.json\", 'w') do |file|\n file.write(@url)\n end\n puts \"Ecriture effectuer avec success!\"\n end", "def read_JSON_file # called a helper method (is helping you to use less code and dealing with something so that your other methods don't have to)\n @json_data = File.read('./lib/contacts.json')\n @contacts = JSON.parse(@json_data, {:symbolize_names => true})\n end", "def storage\n @_storage ||= in_memory\n end", "def create\n file = params[:file_store][:file]\n file_store = FileStore.new\n file_store.sha1_hash = Digest::SHA1.file(file.path).hexdigest\n file_store.file = file\n file_store.user_id, file_store.user_uname = user['id'], user['uname']\n\n if file_store.save\n File.delete file.path\n render json: { sha1_hash: file_store.sha1_hash }, status: :created\n else\n render json: file_store.errors, status: :unprocessable_entity\n end\n end", "def initialize(file_name)\n @file = File.read(file_name)\n @json_hash = JSON.parse(@file)\n end", "def create\n @file_path = params[:file]\n if params[:stored_file].blank?\n @stored_file = StoredFile.new(name: @file_path.original_filename, path: @file_path.original_filename)\n else\n @stored_file = StoredFile.new(stored_file_params)\n end\n upload_ftp_file\n\n respond_to do |format|\n if @stored_file.save\n format.html { redirect_to @stored_file, notice: 'Stored file was successfully created.' }\n content = {}\n content[\"storage\"] = @stored_file\n content[\"replace\"] = @ftp_data\n render json: content\n else\n format.html { render :new }\n format.json { render json: @stored_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def from_json(json)\r\n json = json.transform_keys(&:to_sym)\r\n @files = Hash[json[:files].map { |file, file_info| [file, file_info.transform_keys(&:to_sym)] }]\r\n @files.default_proc = proc { |h, k| h[k] = {} }\r\n @dirs = Hash[json[:dirs].map { |dir, dir_info| [dir, dir_info.transform_keys(&:to_sym)] }]\r\n @dirs.default_proc = proc { |h, k| h[k] = {} }\r\n end", "def read(path)\n @file_data = ::JSON.parse(open(path).read)\n @json = @file_data\n self\n end", "def save(link_hash)\n setup_file\n \n link_database = File.open('link_db.txt').read\n existing_links = JSON.parse(link_database)\n # link_database.close\n \n existing_links << link_hash\n link_json = JSON.generate(existing_links)\n \n\n\n File.open('link_db.txt', 'w+') do |link_database|\n link_database.write(link_json)\n end\nend", "def json_file_fixture(path)\n return JSON.parse(File.read(file_fixture(path)), symbolize_names: true)\nend", "def stored_data; end", "def read(uid)\n object = bucket.objects[uid]\n data = object.read\n meta = Serializer.json_decode(object.metadata[:json])\n [\n data, # can be a String, File, Pathname, Tempfile\n meta # the same meta Hash that was stored with write\n ]\n end", "def json_files\n file_list '**/*.json'\n end", "def storage\n @storage ||= in_memory\n end", "def storage\n @storage ||= in_memory\n end", "def storage\n @storage ||= in_memory\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end" ]
[ "0.6610833", "0.6363594", "0.6320678", "0.62873787", "0.61746603", "0.6161367", "0.6160252", "0.6144845", "0.60812116", "0.60648906", "0.6064373", "0.6022529", "0.60019684", "0.5991042", "0.592704", "0.5915643", "0.5892252", "0.5880232", "0.58681875", "0.586502", "0.58333635", "0.581085", "0.58032054", "0.57850903", "0.57630306", "0.5755557", "0.5753613", "0.5751297", "0.57502955", "0.57502955", "0.57321244", "0.5717094", "0.5712813", "0.5700665", "0.57000035", "0.56952393", "0.5692987", "0.5686828", "0.56858385", "0.56852037", "0.56673026", "0.5661413", "0.565442", "0.56524336", "0.5648447", "0.56435966", "0.56424886", "0.56418276", "0.56398726", "0.56390536", "0.56361973", "0.56340015", "0.5633699", "0.56219894", "0.56114215", "0.56114215", "0.56108934", "0.56020695", "0.5569077", "0.55659896", "0.55659896", "0.5561818", "0.55586195", "0.55477524", "0.5546962", "0.55459785", "0.5541084", "0.55407125", "0.5540378", "0.5532648", "0.552916", "0.55253065", "0.5523872", "0.5523245", "0.5523245", "0.5523245", "0.5523245", "0.5523245", "0.5523245", "0.552055", "0.55171835", "0.5516636", "0.55159795", "0.550603", "0.5501225", "0.54901296", "0.548753", "0.5484563", "0.5483433", "0.5472075", "0.54704344", "0.54669595", "0.5464909", "0.54536974", "0.54534", "0.5452665", "0.5452665", "0.5452665", "0.54454565", "0.54454565", "0.54454565" ]
0.0
-1
Return an error message if the name is invalid. Return nil if name is valid.
def error_for_todo(name) if !(1..100).cover? name.size "Todo must be between 1 and 100 characters." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_invalid\n errors.add(:name, :unknown)\n end", "def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end", "def valid_name!\n return unless @name.blank?\n\n @success = false\n @error = 'Error: site name must be present'\n end", "def name_present\n if name.blank?\n errors.add(:name, \"Can't be empty\")\n end\n end", "def name_is_valid\n errors.add(:name,'Invalid empty string for name.') unless name_is_valid?\n end", "def _validate_name(name)\n if name =~ %r{/}\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'a slash.')\n end\n\n if name =~ /\\s/\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'whitespace.')\n end\n\n if name[0, 1] == '.'\n results.add_error('name', 'The name of a spec should not begin' \\\n ' with a period.')\n end\n end", "def validate_name\n\t\t\tunless Nacreon::NameRX.match(name)\n\t\t\t\terrors.add(:name,\n\t\t\t\t\t'must contain only letters, numbers, and \"-\".')\n\t\t\tend\n\t\tend", "def name_not_blank\n if self.name.blank?\n self.errors.add(:name, I18n.t('stage.errors.blank_name'))\n end\n end", "def empty_name_error(type, what)\n validation_error(type, what, 'name is empty')\n end", "def valid_name!(name)\n not_empty!(name)\n unless [String, Symbol].include?(name.class)\n coercion_error!\n end\n name\n end", "def get_name_error\n if !self.errors[:first_name].empty?\n return self.errors.full_messages_for(:first_name)[0]\n end\n\n if !self.errors[:last_name].empty?\n return self.errors.full_messages_for(:last_name)[0]\n end\n\n false\n end", "def error_msg\n name\n end", "def validate_name(name)\n return if name =~ /\\A[a-z0-9]+[-\\/][a-z][a-z0-9_]*\\Z/i\n\n namespace, modname = name.split(/[-\\/]/, 2)\n modname = :namespace_missing if namespace == ''\n\n err = case modname\n when nil, '', :namespace_missing\n \"the field must be a namespaced module name\"\n when /[^a-z0-9_]/i\n \"the module name contains non-alphanumeric (or underscore) characters\"\n when /^[^a-z]/i\n \"the module name must begin with a letter\"\n else\n \"the namespace contains non-alphanumeric characters\"\n end\n\n raise ArgumentError, \"Invalid 'name' field in metadata.json: #{err}\"\n end", "def validate_name\n if third_party && name.blank?\n errors.add(\n :name,\n :blank,\n )\n end\n end", "def validate_name\n unless name.length > 0\n add_error :name, 'name of the price item shall be provided'\n end\n\n unless price.to_i > 0\n add_error :price, 'price should be a number'\n end\n end", "def name_valid_format\n if name.present? and not name.match(/[\\w]+([\\s]+[\\w]+){1}+/)\n errors.add :name , \"must be seperated by space and should not contain any special characters.\"\n end\n end", "def name\n fail\n end", "def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end", "def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end", "def validate_name(arg = nil)\n set_or_return(:name, arg, :kind_of => String, :callbacks => {\n \"user must be string of word characters and Engine ID should be either empty string or 5 to 32 octets separated by colons\" => lambda {\n |name| !@@title_pattern.match(name).nil?\n }\n })\n end", "def name_legal?\n if @params\n if self.name.include?(\"\\\\\") or self.name.include?(\"/\")\n errors.add(\"Invalid name:\", \"Slashes not allowed in names.\")\n elsif self.name == \"\"\n errors.add(\"Invalid name:\", \"No name provided.\")\n end\n end\n end", "def validate_name(arg=nil)\n set_or_return(:name, arg, kind_of: String, callbacks: {\n 'user must be string of word characters and ' \\\n 'Engine ID should be either empty string or ' \\\n '5 to 32 octets separated by colons' => lambda do |name|\n !@@title_pattern.match(name).nil?\n end,\n })\n end", "def validateName(name)\n if (name == nil)\n return false\n end\n \n return true # TODO This is wrong. Finish this function.\nend", "def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end", "def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end", "def name_can_not_be_greg\n if self && self.name.downcase == \"greg\"\n self.errors.add(:name, \"Can not be Greg\")\n end \n end", "def name_valid?(name)\n name.nil? || /^[A-Za-z]{2,}$/.match?(name)\n end", "def valid_name (name)\r\n /^\\w+$/.match (name)\r\n end", "def validate_name\n errors.add(:abstract, \"person_name or company_name must be present\") unless (person_name || company_name)\n end", "def validate_name(value)\n return false if(value.to_s.length >= MAX_NAME_LENGTH)\n return true\n end", "def get_valid_name\r\n while true \r\n name = gets.chomp\r\n break if valid_name(name)\r\n puts \"Please only use letters, numbers or '_' in your name\"\r\n end\r\n name\r\n end", "def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n end\n end", "def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n else\n return false\n end\n end", "def validate_name(value)\n return false if(value.to_s.length >= MAX_NAME_LENGTH)\n return true\n end", "def is_valid_name(name)\n return false if name.split.length < 2\n name == format_name(name)\nend", "def name?\n if name.nil?\n errors.add(:name, \"can't be blank\")\n return false\n end\n return true\n end", "def error(name)\n array name, required: false do |s|\n s.string\n end\n end", "def your_name_is_not_dumb\n if name.include?(\"dumb\")\n errors.add(:name, \"is dumb\")\n end\n end", "def error_for_name(name, current_month)\n if !(1..100).cover? name.size\n \"Must be between 1 and 100 characters.\"\n end\nend", "def check_name_length\n unless self.name.length >= 4\n errors[:name] << \"Name is too short, must be 4+ characters\"\n end\n end", "def is_valid_name?(name)\n return name.class == String && name.match(/[a-zA-Z]+?/)\n end", "def valid_name?(nm)\n\t\treturn false unless (nm =~ VALID_NAME)\n\t\ttrue\n\tend", "def names_valid?\n return nil unless AccountType.individual?(account_type)\n\n errors.add(:forename, :cant_be_blank) if forename.to_s.empty?\n errors.add(:surname, :cant_be_blank) if surname.to_s.empty?\n names_length_valid?\n end", "def error?(name = nil, type = nil)\n return @validate.error?(name, type)\n end", "def format_name\n if name.match?(/\\s/) || name.include?(\"+\") || name.include?(\"-\")\n errors.add(:name, \"please enter tags in correct format, without -, + or whitespaces\")\n end\n end", "def validate\n if @name.empty?\n @message = \"Please input a username.\"\n elsif @password.empty?\n @message = \"Please input a password.\"\n elsif @names.include?(@name) == false\n @message = \"That username does not exist. Please make sure to check your spelling.\"\n elsif @names.include?(@password) == false\n @message = \"Wrong password. Please check your spelling and try again.\"\n elsif @names.include?(@name) && @names.include?(@password)\n @message = \"Welcome {@name}\"\n end\n end", "def name(arg = nil)\n if !arg.nil?\n validate(\n { name: arg },\n { name: { kind_of: String,\n cannot_be: :blank,\n regex: /^[\\-[:alnum:]_:.]+$/ },\n }\n )\n @name = arg\n else\n @name\n end\n end", "def validate_display_name\nif ! validate_a_display_name( self.display_name )\nerrors.add( :display_name , \"Invalid display name (see RFC 3261).\" )\nend\nend", "def get_name validator\n name = validator[1]\n\n if sexp? name\n name.value\n else\n name\n end\n end", "def validate_name(name)\n !name.scan(/\\D/).empty?\n end", "def valid_name?(name)\n !!(name =~ NAME_REGEX)\n end", "def error_message(obj, name = \"\")\n if name.present? && obj.get_operation_result.code.zero?\n \"Could not find user '#{name}'\"\n else\n \"#{obj.get_operation_result.message} (code #{obj.get_operation_result.code})\"\n end\n end", "def check_create_user_name_is_valid\n return self.name != \"\" ? true : false\n end", "def validate_name\n if name.match(/\\|/)\n errors.add(:name, \"cannot have a '|' character\")\n end\n end", "def check_name\n parts = name.split '_'\n fail NotImplementedError, \\\n 'Result fetcher naming convention not being followed' \\\n unless parts.length == 2 || parts.length == 3\n end", "def full_name_format\n valid_full_name = true\n\n if !self.name.nil?\n # Must contains white space\n valid_full_name = false if (/^(.*\\s+.*)+$/i =~ self.name).nil?\n # Must be alpha\n valid_full_name = false if(/^[A-Z]+$/i =~ self.name.remove(' ')).nil?\n else\n valid_full_name = false\n end\n\n if !valid_full_name\n self.errors.add(:name, 'deve ser Completo')\n raise ActiveRecord::Rollback\n end\n end", "def name=(name)\n if name == \"\"\n raise \"Name cannot be blank!\"\n else\n @name = name\n end\n end", "def valid?\n !name.nil?\n end", "def valid?\n !name.nil?\n end", "def valid?\n !name.nil?\n end", "def error_for_list_name(name)\n if !(1..100).cover? name.size\n 'The list name must be between 1 and 100 characters.'\n elsif @storage.list_name_exists?(name)\n 'List name must be unique'\n end\nend", "def get_name\n (name.empty? || name.nil?) ? '' : name\n end", "def badge_name_is_valid\n if badge_name.present?\n unless self.badge.kind_of?(Badge)\n badge_names = self.authoritative_company.company_badges.map(&:short_name).to_sentence(two_words_connector: ' or ', last_word_connector: ' or ')\n errors.add(:badge, I18n.t('activerecord.errors.models.recognition.attributes.badge_id.invalid_name', badge_names: badge_names))\n end\n end\n end", "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n if name.to_s.length > 200\n fail ArgumentError, 'invalid value for \"name\", the character length must be smaller than or equal to 200.'\n end\n @name = name\n end", "def error\n valid? ? nil : @error_message\n end", "def with_error_message(name)\n return if APP_CONFIG.disabled?(\"ldap\")\n return unless exists?(name)\n\n \"The username '#{name}' already exists on the LDAP server. Use \" \\\n \"another name to avoid name collision\"\n end", "def name=(value)\n if value == \"\"\n raise \"Name cannot be blank!\"\n elsif value.is_a? Integer\n raise \"Name cannot contain numbers!\"\n else\n if value.is_a? String\n @name = value\n end\n end\n end", "def missing_name?(name)\n if name.is_a? Symbol\n last_name = (missing_name || '').split('::').last\n last_name == name.to_s\n else\n missing_name == name.to_s\n end\n end", "def missing_name?(name)\n if name.is_a? Symbol\n last_name = (missing_name || '').split('::').last\n last_name == name.to_s\n else\n missing_name == name.to_s\n end\n end", "def name_valid?\n\t\tif self.name == nil\n\t\t\treturn false\n\t\telsif VALID_NAME_REGEX !~ self.name || self.name.empty? || self.name.length > MAX_CREDENTIAL_LENGTH\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend", "def account_name_cannot_be_in_use\n if Account.find_by_name(account_name)\n errors.add(:account_name, \"Sorry, this name is already in use\")\n end\n end", "def name?(name)\n name = name&.strip\n !(name.blank? || name.match?(%r{(N[/\\\\]+A|UNKNOWN)}i))\n end", "def file_name_exist?(name)\n return true if !name.blank?\n errors.add(:name, \"Nazwa nie moze byc pusta!\")\n false\n end", "def error_for_list_name(name)\n if !(1..100).cover? name.size\n \"The list name must be between 1 and 100 characters.\"\n elsif session[:lists].any? { |list| list[:name] == name }\n \"The list name already exists. list name must be unique.\"\n end\nend", "def is_valid_name(str)\n return str.include?(\" \") && format_name(str) == str\nend", "def _validate_module_name(m)\n unless m.nil? || m =~ /^[a-z_][0-9a-z_]*$/i\n results.add_error('module_name', 'The module name of a spec' \\\n ' should be a valid C99 identifier.')\n end\n end", "def err_for_list_name(name)\n # if session[:lists].any? { |list| list[:name] == name }\n if @storage.all_lists.any? { |list| list[:name] == name }\n 'The list name must be unique'\n elsif !(1..50).cover?(name.size)\n 'The list name must have between 1 and 50 characters'\n # else\n # nil # don't explicitly need this, but it's good to show intent\n end\nend", "def fullname(name, lastname)\n name + ' ' + lastname\nrescue => e\n \"El error es: #{e.message}\"\nensure\n return lastname\nend", "def validate_name?\n # if you create user from admin interface(or as a team member), then \"name\" param is provided, it is present or blank - not nil\n !name.nil?\n end", "def name=(name)\n if name.nil?\n fail ArgumentError, 'name cannot be nil'\n end\n\n if name.to_s.length < 1\n fail ArgumentError, 'invalid value for \"name\", the character length must be great than or equal to 1.'\n end\n\n @name = name\n end", "def name=(name)\n if name.nil?\n fail ArgumentError, 'name cannot be nil'\n end\n\n if name.to_s.length < 1\n fail ArgumentError, 'invalid value for \"name\", the character length must be great than or equal to 1.'\n end\n\n @name = name\n end", "def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 30\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 30.\"\n end\n\n @name = name\n end", "def error_for_list_name(name)\n if session[:lists].any? { |list| list[:name] == name }\n \"The list names must be unique\"\n elsif !(1..100).cover? name.size\n \"The list name must be between 1 and 100 characters\"\n end\nend", "def last_name_is_valid\n errors.add(:last_name,'Invalid empty string for last name.') unless last_name_is_valid?\n end", "def error_for_list_name(name)\n if !(1..100).cover? name.size\n \"The list name must be between 1 and 100 characters.\"\n elsif session[:lists].any? { |list| list[:name] == name }\n \"The list name must be unique.\"\n end\nend", "def get_name\n puts \"Please enter player #{id_number}'s name: \"\n while true\n begin\n @name = gets.chomp\n raise EmptyNameError if @name.empty?\n break\n rescue EmptyNameError\n puts \"You input was blank. Please try again.\"\n end\n end\n\n end", "def name=(name)\n if !name.nil? && name.to_s.length > 31\n fail ArgumentError, 'invalid value for \"name\", the character length must be smaller than or equal to 31.'\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n if !name.nil? && name !~ pattern\n fail ArgumentError, \"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\"\n end\n\n @name = name\n end", "def error_for_todo_name(name, list_id)\n if !(1..100).cover? name.size\n 'To do name must be between 1 and 100 characters'\n elsif @storage.todo_name_exists?(name, list_id)\n \"You already have '#{name}' in this list.\"\n end\nend", "def name=(entry)\n raise ValidationError, \"invalid name -- #{n}\" unless /^[\\w-]+$/ =~ entry\n self['name'] = entry\n end", "def error_for_item_name(name, current_month)\n if !(1..100).cover? name.size\n \"Must be between 1 and 100 characters.\"\n end\nend", "def valid_name?(name)\n name.is_a?(String) and MACRO_NAME_RE.match(name)\n end", "def error_for_list_name(name)\n if !(1..100).cover? name.size\n 'The list name must be between 1 and 100 characters.'\n elsif @storage.all_lists.any? { |list| list[:name] == name }\n 'The list name must be unique.'\n end\nend", "def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 100\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 100.\"\n end\n\n @name = name\n end", "def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 100\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 100.\"\n end\n\n @name = name\n end", "def error_for_list_name(name)\n if @storage.all_lists.any? { |list| list[:name] == name }\n 'List name must be unique.'\n elsif !(1..100).cover?(name.size)\n 'List name must be between 1 and 100 characters.'\n end\nend", "def error_for_list_name(name)\n if !(1..100).cover? name.length\n \"List name must be between 1 and 100 characters.\"\n elsif session[:lists].any? { |list| list[:name] == name }\n \"List name must be unique.\"\n end\nend", "def error_for_list_name(name)\n if !(1..100).cover? name.size\n \"The list name must be between 1 and 100 characters.\"\n elsif session[:lists].any? {|list| list[:name] == name}\n \"The list name must be unique.\"\n end\nend", "def name_or_none\n name || \"\"\n end", "def error_for_todo_name(name)\n if !(1..100).cover?(name.size)\n \"Todo name must be between 1 and 100 characters.\"\n end\nend", "def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 50\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 50.\"\n end\n\n @name = name\n end", "def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 50\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 50.\"\n end\n\n @name = name\n end" ]
[ "0.79099447", "0.76210326", "0.7459701", "0.7411183", "0.7291553", "0.7206568", "0.71990484", "0.71447146", "0.70809114", "0.7019362", "0.7010315", "0.6998964", "0.6928259", "0.6885302", "0.68643504", "0.6819798", "0.67752254", "0.6697896", "0.6697896", "0.66621554", "0.6654539", "0.6651297", "0.66442263", "0.65884155", "0.65884155", "0.65877575", "0.6561919", "0.6508689", "0.6501817", "0.64523125", "0.6428123", "0.64196974", "0.6402153", "0.6394671", "0.63756204", "0.6373472", "0.6356619", "0.6347463", "0.6343885", "0.63281196", "0.6324082", "0.6321728", "0.6297548", "0.62758875", "0.6247313", "0.6244183", "0.6222934", "0.6163325", "0.6159851", "0.611189", "0.611065", "0.61083275", "0.6096921", "0.6085572", "0.6080171", "0.6057171", "0.6032244", "0.60263354", "0.60263354", "0.60263354", "0.6022614", "0.60023797", "0.60003424", "0.5992132", "0.5981911", "0.5974085", "0.597381", "0.59565884", "0.59565884", "0.5949786", "0.5946355", "0.594255", "0.5939134", "0.5933033", "0.5927549", "0.59211516", "0.59197783", "0.5905865", "0.5896405", "0.5878917", "0.5878917", "0.58776236", "0.58690643", "0.5867218", "0.5866262", "0.5864758", "0.5864686", "0.5863614", "0.58502555", "0.5849768", "0.5849311", "0.5847903", "0.5846633", "0.5846633", "0.583113", "0.58260053", "0.5822916", "0.5821685", "0.58105683", "0.58092535", "0.58092535" ]
0.0
-1
Creating New method to access the array of questions It takes one parameter
def run_test(questions) answer = "" # create a variable called answer empty string score = 0 # keeping track of the questions they get right # looping through the questions for question in questions puts question.prompt # get answer from the user answer = gets.chomp() if answer == question.answer score += 1 end end puts ("You got " + score.to_s + " / " + questions.length().to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def questions\n \n end", "def questions\r\n return @questions \r\nend", "def question(q, a)\n qu = Question.new(q,a)\n questions << qu\n @counter = 0 #Se inicializa el contador\n end", "def check_questions\n response = Request.get_request(URL_QUESTION)\n questions = []\n if response.success?\n data = Request.manage_response(response)\n end\n data.each do |question|\n questions << Question.new(question)\n end\n questions\nend", "def initialize\n question_array = Wordwise::CLI.question_array\n @word = question_array[0][0]\n @def = question_array[1][0]\n @defs = question_array[1].shuffle\n @origin = question_array[2]\n @@all << self\n end", "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def quiz_questions\n @questions = set_quiz.questions\n end", "def questions\n extracted_questions = []\n\n unless self.qp_questions.nil?\n self.qp_questions.each do |question| \n extracted_questions.push(Question.new(question))\n end \n end\n\n return extracted_questions\t\t\t\n\t\tend", "def question(*args)\n distract = Array.new\n args[1].keys.each { |x| distract << args[1][x] if x.class.equal? Array }\n exam << Pregunta.new(:text => args[0], :right => args[1][:right], :distractors => distract)\n exam\n end", "def create_question_from_object\n q = sample_question\n more_choices = [q.answer]\n (2..@num_choices).each do |x|\n more_choices << sample_question.answer\n end\n Question.new(question: q.question, answer:q.answer, choices: more_choices, message: q.message )\n end", "def initialize(questions)\n @playing_questions = questions.sample(NUMBER_OF_QUESTIONS)\n @points = 0\n @correct_answers = 0\n end", "def formulate_question\n @category = @user.available_questions.sample.keys\n @category_instance = Category.all.select {|cat| cat.name == @category[0]}\n category_hash = @user.available_questions.select {|h| h.keys == @category}\n @country = category_hash[0].values[0].sample\n @country_instance = Country.all.select {|cou| cou.name == @country}\n pose_question\n end", "def foreach_question\n CollectionWrapper.new(@questions, QuestionWrapper, view_context)\n end", "def new\n @quiz = Quiz.new\n @quiz.q1=Array.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quiz }\n end\n end", "def questions\n return @questions\n end", "def questions\n result = []\n 1.upto(@@max_questions) { |i| result << question(i) }\n result.select { |q| !q.empty? }\n end", "def initialize(name:)\n @name = name\n @questions = []\n @responses = []\n end", "def questions=(value)\n @questions = value\n end", "def new\n\t\tall_questions = Question.select('short_name,text').all\n\t\t@question_names = \"[#{all_questions.collect { |q| \"\\\"#{q.short_name}\\\"\" }.compact.join(',')}]\"\n\t\t@question_texts = \"[#{all_questions.collect { |q| \"\\\"#{q.text}\\\"\" }.compact.join(',')}]\"\n\t\t\n\t\t@all_choices = \"[#{Choice.select('value').order('value ASC').all.collect { |c| \"\\\"#{c.value}\\\"\" }.compact.join(',')}]\" # construct list for typeahead\n\t\t@new_question = Question.new\n\tend", "def show\n @questions = @exam.questions\n @question = Question.new\n end", "def create_questions(qcat_array)\ncounter = 0\n10.times do\nQuestion.create(\n question_text: qcat_array[counter][0],\n category: qcat_array[counter][1]\n)\ncounter = counter + 1\nend\nend", "def questions\n @_questions ||= fetch_questions\n end", "def similar_questions\n\n end", "def questions\n qs = []\n qs |= self.class.questions if self.class.respond_to? :questions\n qs |= (@_questions||=[])\n qs.map{|q| q.for_instance(self) }\n end", "def create_question\n question_hash = Adapter.quiz_api(difficulty) #use adapter method, with difficulty passes into the url as a variable, to gnerate a new list of questions.\n new_question = Question.new #make a new question instance\n new_question.save #save now so we can store the question's id in the answer by calling self.id\n new_question.content = question_hash['question'] #adding all necessary column data to this question object/row\n new_question.create_answers(question_hash)\n new_question.quiz_id = self.id\n new_question.save #send the newly created question to the database\n end", "def question\n @question = params[:question]\n @answer = %w[yes no].sample\n end", "def new\n #@option = Option.new\n x=0\n\n @question=Question.find(params[:qid])\n\n if(@question.type_id==1)\n x=4-@question.options.count\n elsif(@question.type_id==2)\n x=2-@question.options.count\n else\n x=0\n end\n @options = Array.new(x){Option.new }\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @option }\n end\n end", "def new\n @question = Question.new \n end", "def get_quest\n\t\tget_data\n\n\t\t$finish = false\n\t\tunless $finish == true\n\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\twhile $quiz_arr.include?(@data[$randId]['id'])\n\t\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\tend\n\t\t\t$quiz_arr.push(@data[$randId]['id'])\n\t\t\t$i += 1\n\n\t\t\tif $i == 7\n\t\t\t\t$finish = true\n\t\t\tend\n\n\t\t\t@quest = @data[$randId]['question_name']\n\t\t\t@c_answer = @data[$randId]['c_answer']\n\t\t\t@alt1 = @data[$randId]['alt1']\n\t\t\t@alt2 = @data[$randId]['alt2']\n\t\t\t@alt3 = @data[$randId]['alt3']\n\t\t\t@imgurl = @data[$randId]['imgurl']\n\t\t\t@url = @data[$randId]['news_url']\n\t\t\t@cat = @data[$randId]['category_id']\n\t\t\t@hex = @data[$randId]['category_hex_code']\n\t\t\tget_descriptions(@url)\n\t\t\t@image = @desc_data['image']\n\n\t\t\t$answer_array = Array.new()\n\t \tend\n\tend", "def initialize n\n #Number of questions for this quiz\n @number=n\n #Questions that are going to be used\n @questions=[]\n #Connection to the database from where the questions are going to be taken\n @DB=Sequel.connect(\"sqlite://./models/questions.db\")\n end", "def generate_questions difficulty, number_of_questions\n @questions.clear\n random_range = case difficulty\n when 1, 3 then 9\n else 99\n end\n if number_of_questions > 3\n number_of_questions = 3\n elsif number_of_questions < 1\n number_of_questions = 3\n end\n number_of_questions.times do\n @questions.push(Question.new((@number_generator.rand(random_range) + 1), generate_operator(difficulty), (@number_generator.rand(random_range) + 1)))\n end\n end", "def questions\n qs = []\n qs |= superclass.questions if superclass.respond_to? :questions\n qs |= (@_questions||=[])\n qs\n end", "def get_questions\n result = QuizQuestion.includes(:quiz_answers).where(quiz_id: params[:id])\n\n @questions = result.map { |question| QuestionPresenter.new(question) }\n end", "def index\n @questions = @questionable.questions\n end", "def ask\n \"@all Question '#{@question}'\"\n end", "def quiz\n end", "def index\n @question = Question.new\n super\n end", "def new\n @question = Question.new\n @category = Category.new\n @sample = Question.all.pop\n @samples = @sample.kludgy_related_similar()\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def index\n @questions = Question.all\n @question = Question.new\n end", "def index\n find_questions\n end", "def question\n answer.question\n end", "def new\n @questionnaire = Questionnaire.new\n @quest = Quest.new\n 5.times do\n question = @questionnaire.quests.build\n 4.times { question.choices.build }\n end\n end", "def new\n @question = Question.new\n end", "def new\n @question = Question.new\n end", "def new\n @question = Question.new\n end", "def new\n @question = Question.new\n end", "def question(name, text, attrs={}, &instance_block)\n q = Question.new(name, text, self, attrs, &instance_block)\n (@_questions||=[]) << q\n \n postprocess_question(q)\n return q\n end", "def questions\n results = CONNECTION.execute(\"SELECT * FROM questions WHERE student_id = #{@id};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << Question.new(result_hash[\"id\"], result_hash[\"student_id\"], result_hash[\"content\"])\n end\n \n return results_as_objects\n end", "def new\n @question = Question.new\n 3.times { @question.answers.build }\n end", "def genQuestionaire\n #Table \"questions\" from the database through instance variable \"roster\"\n roster=@DB[:questions]\n #Limit for the iterator that will generate the list of questions\n lim=@number-1\n #Space available\n available=[]\n #This iterator stores the whole database in the \"available\" variable\n #in the form of several \"Question\" objects\n (1..40).each do |index|\n #Paramters for the \"Question\" class are set\n #Question text\n q=roster.first(id: index)[:question].to_s\n #Answer a\n a=roster.first(id: index)[:answerA].to_s\n #Answer b\n b=roster.first(id: index)[:answerB].to_s\n #Answer c\n c=roster.first(id: index)[:answerC].to_s\n #Correct answer\n corr=roster.first(id: index)[:correct].to_s\n #Questions are built\n available.push Question.new q, a, b, c, corr\n end\n \n #The \"available\" variable is randomized and stored in the \"scrambled\" variable\n scrambled=available.shuffle\n \n #This iterator takes the number of questions specified by the users and stores \n #them in the final questionaire\n (0..lim).each do |question|\n @questions.push scrambled[question]\n end\n puts \n end", "def initialize(question: nil)\n @question = question\n end", "def answers\n []\n end", "def questions\n object.questions.map do |question|\n QuestionSerializer.new(question)\n end\n end", "def new\n @test = @subject.tests.new\n 3.times do\n question = @test.questions.build\n 4.times { question.answers.build }\n end\n end", "def initialize\n @knowledge = [] # When we make a new student, that instance of a student will create an array tied to that specific student\n end", "def my_questions\n self.questions.map(&:id)\n end", "def create_assessment\n @unique_questions = []\n\n questions = QuizQuestion.for_language_course(self, [\"multiple_choice\", \"short_answer\"])\n questions_grouped_by_lesson = questions.group_by(&:lesson_id).values.shuffle\n\n setup_multiple_choice_questions(questions_grouped_by_lesson)\n setup_short_answer_questions(questions_grouped_by_lesson)\n\n @unique_questions\n end", "def get_questions(number)\n @questions_array = get_from_url(@questions_conn, QUESTIONS_OBTAINTION_KEY, {size: number})\n end", "def initialize(questions_hash)\n @question = questions_hash[:question]\n @link = questions_hash[:link]\n @description_short = questions_hash[:description_short]\n @question_type = questions_hash[:type]\n @@all << self\n end", "def new\n @question_id = (@exam_session.exam.questions.find :first,\n :offset => (@exam_session.current_question - 1)).id\n \n @exam_session.update_attribute(:updated_at, Time.now)\n \n @question = Question.find_by_id_and_return_xml_table(@question_id)\n \n @choices = { 'choiceA' => @question.choice_a,\n 'choiceB' => @question.choice_b,\n 'choiceC' => @question.choice_c,\n 'choiceD' => @question.choice_d,\n 'choiceE' => @question.choice_e,\n }\n end", "def index\n @questions = Question.all # Model.all is a method built into active record used to return all records of that model\n end", "def get_questions int_id\r\n @all_questions = Questionare.find_by_interview_id int_id\r\n end", "def initialize(answerarray)\n answerarray = answerarray\n puts \"MAGIC 8 BALL\\nplease enter a question\"\n question = gets.chomp\n case question\n when \"add_answers\"\n Add_answers.new(answerarray)\n when \"reset_answers\"\n Reset_answers.new\n when \"print_answers\"\n Print_answers.new(answerarray)\n when \"quit\"\n puts \"Goodbye\"\n else \n basic(answerarray)\n end\n end", "def setup_multiple_choice_questions(questions)\n questions[0..34].each do |questions_in_a_lesson|\n @unique_questions << questions_in_a_lesson.find_all{|question| question.question_type == 'multiple_choice'}[rand(6)]\n end\n end", "def question\n Question.find_by_id(questions_id)\n end", "def question\n self.question\n end", "def get_next_set\n hash,url = perform_next_page_request\n Questions.new hash,url\n end", "def create_a_question\n q = ShortQuestion.create({\n :text => params[:text],\n :belongs_to_topic => params[:topic],\n :by => params[:by] || \"admin\",\n :by_id => params[:by_id]\n })\n params[:answers].each do |ans|\n a = q.short_answers.create({\n :text => ans.text,\n :choice_num => ans.choice \n })\n end\n $r.hset(\"question:#{q.id}:answers\", :num_choices, params[:answers].length)\n # Not setting the value of the answers to 0, as any increment will take care of initializing those keys\n end", "def info() quiz_question.info end", "def get_questions(how_many)\n questions = [\n GeoQuestion.new(\"In which country does edelweiss not grow natively?\",\n [\"a) Switzerland\", \"b) Mongolia\", \"c) Swaziland\", \"d) Austria\"], \"c\"),\n\n GeoQuestion.new(\"What countries does the equator and Tropic of Capricorn run through?\",\n [\"a) Sudan\", \"b) Saudi Arabia\", \"c) Chile\", \"d) Brazil\"], \"d\"),\n\n GeoQuestion.new(\"If you can fit through the nose hole of Great Buddha of Kamakura in Japan? Do you:\",\n [\"a) have great success\", \"b) enlightenment\", \"c) great wealth\", \"d) great health\"], \"b\"),\n \n GeoQuestion.new(\"On which continent did upright-walking ancestors originate?\",\n [\"a) Russia\", \"b) Asia\",\"c) Russia\", \"d) Africa\"],\"d\"),\n \n GeoQuestion.new(\"How many alternating red and white stripes does the flag of the United States have?\",\n [\"a) 13\", \"b) 11\", \"c) 16 \", \"d) 9\"], \"a\"),\n \n GeoQuestion.new(\"Who sewed the Famous Eureka Flag?\",\n [\"a) Anastasia Withers, Anne Duke, Anastasia Hayes\", \"b) Anne Witherton, Elizabeth Dune, Emily Palsey\", \"c) Beth Kennedy, Grace King, Annabel Cooke\", \"d) Anne Holyoake, Mary Basson-Humffray, Anne Ross\"], \"a\"),\n \n GeoQuestion.new(\"How many rivers are in Russia?\",\n [\"a) 200\", \"b) 40 000\", \"c) 100 000\", \"d) 12 000\"],\"c\"),\n \n GeoQuestion.new(\"Where is Hulun Lake situated?\",\n [\"a) Hong Kong SAR\", \"b) People's Republic of China\", \"c) Republic of China (Taiwan)\", \"d) Mongolia\"], \"b\"),\n \n GeoQuestion.new(\"What is this meaning of the word Canada?\",\n [\"a) Brown Bears\", \"b) Good People\", \"c) Wild\", \"d) Indian Village\"], \"d\"),\n \n GeoQuestion.new(\"How many cities does the Trans-Siberian Railway pass through?\",\n [\"a) 87\", \"b) 96\", \"c) 82\", \"d) 78\"], \"a\"),\n \n GeoQuestion.new(\"Which continent has the world's largest river system\",\n [\"a) Australia\", \"b) Asia \", \"c) South America\", \"d) Russia\"], \"c\"),\n \n GeoQuestion.new(\"Which Continent is the Great Bear Lake located in?\",\n [\"a) Russia\", \"b) North America \", \"c) Asia\", \"d) South America\"], \"b\"),\n \n GeoQuestion.new(\"Which US city has the largest Polish population?\",\n [\"a) Chicago\", \"b) New York City \", \"c) San Fran Cisco\", \"d) Utah\"], \"a\"),\n \n GeoQuestion.new(\"The river Liffey flows through the centre of which European city\",\n [\"a) Lisburn\", \"b) Dublin\", \"c) Lillerod \", \"d) Copenhagen\"], \"b\"),\n \n GeoQuestion.new(\"What is the world's largest continent?\",\n [\"a) Antarctica\", \"b) Asia\",\"c) Europe\", \"d) Africa\"], \"b\"),\n \n GeoQuestion.new(\"What razor-thin country accounts for more than half of the western coastline of South America?\",\n [\"a) Peru\", \"b) Ecuador\",\"c) Chile \", \"d) Bolivia\"], \"c\"),\n \n GeoQuestion.new(\"What country has the most natural lakes?\", \n [\"a) Australia\", \"b) India\", \"c) United States\", \"d) Canada\"], \"d\"),\n \n GeoQuestion.new(\"What is the only sea with coasts?\",\n [\"a) Celebes Sea\", \"b) Sargasso Sea\", \"c) Adriatic Sea\", \"d) Mediterranean Sea\"], \"b\"),\n \n GeoQuestion.new(\"What is the driest place on Earth?\",\n [\"a) Sahara Desert\", \"b) Kufra, Libya\", \"c) Atacama Desert\", \"d) Mc Murdo, Antica\"], \"d\"), \n \n GeoQuestion.new(\"In what country can you visit Machu Picchu?\",\n [\"a) Peru \", \"b) Bolivia\", \"c) Chile\", \"d) Columbia\"], \"a\"),\n \n GeoQuestion.new(\"Which African nation has the most pyramids?\",\n [\"a) Egypt\", \"b) Sudan\", \"c) Libya\", \"d) Algeria\"], \"b\"),\n \n GeoQuestion.new(\"What is the oldest city in the world?\",\n [\"a) Jericho\", \"b) Athens \", \"c) Jerusalem \", \"d) Damascus \"], \"d\"),\n \n GeoQuestion.new(\"Which U.S. State has the most active volcanoes?\",\n [\"a) Hawaii\", \"b) California\", \"c) Alaska \", \"d) Washington \"], \"c\"), \n \n GeoQuestion.new(\"What is the flattest continent?\",\n [\"a) Antarctica\", \"b) Australia \", \"c) South America\", \"d) Africa\"], \"b\"),\n \n GeoQuestion.new(\"What is the largest country in the Arabian Peninsula?\",\n [\"a) Jordan\", \"b) United Arab Emirates\", \"c) Yemen \", \"d) Saudi Arabia\"], \"d\"),\n \n GeoQuestion.new(\"What country has the most coastline?\",\n [\"a) Canada\", \"b) United States\", \"c) China\", \"d) Russia\"], \"a\"),\n \n GeoQuestion.new(\"Which of the following volcanoes is NOT located in Antarctica?\",\n [\"a) Mount Melbourne\", \"b) Mount Berlin\", \"c) Mount Napier\", \"d) Mount Hampton\"], \"c\"),\n \n GeoQuestion.new(\"What country is the home of Kangaroo Island?\",\n [\"a) Australia\", \"b) France\", \"c) Japan\", \"d) Great Britain\"], \"a\"),\n \n GeoQuestion.new(\"What continent is located at latitude 90 degrees south longitude 0.00 degrees east?\",\n [\"a) Asia\", \"b) Australia\", \"c) Antarctica\", \"d) South America\"], \"c\"),\n \n GeoQuestion.new(\"What is the largest country in South America?\",\n [\"a) Columbia\", \"b) Brazil\", \"c) Peru\", \"d) Argentina\"], \"b\"),\n \n GeoQuestion.new(\"What is the tallest mountain in the world?\",\n [\"a) Qogir\", \"b) Aconcagua\", \"c) Mount Kilimanjaro\", \"d) Mount Everest\"], \"d\"), \n \n GeoQuestion.new(\"What is the capital city of Australia?\",\n [\"a) Canberra\", \"b) Sydney\", \"c) Melbourne\", \"d) Perth\"], \"a\"),\n \n GeoQuestion.new(\"What is the smallest independent country on Earth?\",\n [\"a) Monaco\", \"b) Vatican City \", \"c) Grenada\", \"d) Nauru\"], \"b\"), \n \n GeoQuestion.new(\"What mountain is nicknamed the 'Savage Mountain'?\",\n [\"a) Annapurna\", \"b) Matterhorn\", \"c) Mount Everest\", \"d) K2\"], \"d\"),\n \n GeoQuestion.new(\"Along with Spain and France, what other country has both Atlantic and Mediterranean coastlines?\",\n [\"a) Egypt\", \"b) Morocco\", \"c) Syria\", \"d) Lebanon\"], \"b\"),\n \n GeoQuestion.new(\"What country occupies the southern end of the Arabian Peninsula?\",\n [\"a) Yemen\", \"b) Jordan\", \"c) Kuwait\", \"d) Qatar\"], \"a\"),\n\n GeoQuestion.new(\"What is the tallest mountain in North America?\",\n [\"a) Mount Rushmore\", \"b) Denali\", \"c) King Peak\", \"d) Mount Steele\"], \"b\"),\n \n GeoQuestion.new(\"What mountain is closest to the moon?\",\n [\"a) Mount Pandim\", \"b) Mount Everest\", \"c) Mount Chimborazo\", \"d) Nanga Parbat\"], \"c\"),\n \n GeoQuestion.new(\"What are the western and eastern most states in the United States?\",\n [\"a) Washington & New York\", \"b) Hawaii & Maine\", \"c) California & Florida\", \"d) Alaska & Alaska\"], \"d\"),\n \n GeoQuestion.new(\"What continent contains the most fresh water?\",\n [\"a) Asia\", \"b) Antarctica\", \"c) North America\", \"d) Africa\"], \"b\"),\n \n GeoQuestion.new(\"What ocean is home to 75% of the Earth's volcanoes?\",\n [\"a) Indian\", \"b) Pacific\", \"c) Arctic\", \"d) Atlantic\"], \"b\"),\n \n GeoQuestion.new(\"What is the largest city in the world based on surface area?\",\n [\"a) Hulunbuir\", \"b) Dhaka\", \"c) Mumbai\", \"d) Shanghai\"], \"a\"),\n \n GeoQuestion.new(\"What is the only major city located on two continents?\",\n [\"a) Rome\", \"b) London\", \"c) Istanbul\", \"d) New Delhi\"], \"c\"),\n \n GeoQuestion.new(\"What is the coldest sea on Earth?\",\n [\"a) White Sea\", \"b) Persian Gulf\", \"c) Caspian Sea\", \"d) Baltic Sea\"], \"a\"),\n \n GeoQuestion.new(\"Which of the following lakes is located in an ancient meteorite impact crater?\",\n [\"a) Lake Titicaca\", \"b) Lake Mweru\", \"c) Lake Poopo\", \"d) Lake Bosumtwi\"], \"d\"),\n \n GeoQuestion.new(\"How many tributaries does the Amazon River have?\",\n [\"a) 9\", \"b) 1,100\", \"c) 3,500\", \"d) 560\"], \"b\"),\n \n GeoQuestion.new(\"What is the oldest active volcano on Earth?\",\n [\"a) Mount Olympus\", \"b) Mount Yasur\", \"c) Mount Etna\", \"d) Mount Fuji\"], \"c\"),\n \n GeoQuestion.new(\"Of the eight major islands in the Hawaiian Archipelago, what is the only one that is uninhabited?\",\n [\"a) Molokai\", \"b) Niihau\", \"c) Coconut Island\", \"d) Kaho'Olawe\"], \"d\"),\n \n GeoQuestion.new(\"What river runs through Paris?\",\n [ \"a) Elbe\", \"b) Thames\", \"c) Seine\", \"d) Danube\"], \"c\"),\n \n GeoQuestion.new(\"What Hawaiian island is known as 'Bird Island'?\",\n [\"a) Nihoa\", \"b) Pulemoku\", \"c) Hulu\", \"d) Kauhuula\"], \"a\"),\n \n GeoQuestion.new(\"What mountains form part of the conventional boundary between the continents of Europe and Asia?\",\n [\"a) Ural Mountains\", \"b) Andes\", \"c) Appalachian Mountains\", \"d) Himalayas\"], \"a\"),\n \n GeoQuestion.new(\"What is the fastest flowing river in the world?\",\n [\"a) Yangtze\", \"b) Congo\", \"c) Amazon\", \"d) Mississippi\"], \"c\"),\n \n GeoQuestion.new(\"How many countries are there in Africa?\",\n [\"a) 39\", \"b) 42\", \"c) 63\", \"d) 54\"], \"d\"),\n \n GeoQuestion.new(\"What is the most densely populated country on Earth?\",\n [\"a) Shanghai\", \"b) Tokyo\", \"c) Monaco\", \"d) New York\"], \"c\"),\n \n GeoQuestion.new(\"What is the capital of Pakistan?\",\n [\"a) Bahawalpur\", \"b) Islamabad\", \"c) Karachi \", \"d) Lahore\"], \"b\"),\n \n GeoQuestion.new(\"What is the most populated nation in South America?\",\n [\"a) Venezuela\", \"b) Columbia\", \"c) Argentina\", \"d) Brazil\"], \"d\"),\n \n GeoQuestion.new(\"What is the most populated country of Africa?\",\n [\"a) South Africa\", \"b) Nigeria\", \"c) Ghana\", \"d) Ethiopia\"], \"b\"),\n \n GeoQuestion.new(\"What Asian country has Kuala Lumpur as its capital?\",\n [\"a) Thailand\", \"b) Bangladesh\", \"c) Malaysia\", \"d) Cambodia\"], \"c\"),\n \n GeoQuestion.new(\"What are the only landlocked countries in South America?\",\n [\"a) Paraguay & Bolivia\", \"b) Peru & Columbia\", \"c) Brazil & Argentina\", \"d) Uruguay & Suriname\"], \"a\"),\n \n GeoQuestion.new(\"What body of water separates Africa and Europe?\",\n [\"a) Strait of Magellan\", \"b) Strait of Malacca\", \"c) Strait of Hormuz\", \"d) Strait of Gibraltar\"], \"d\"),\n \n GeoQuestion.new(\"Which of the following continents in intersected by the Equator?\",\n [\"a) Europe\", \"b) Australia\", \"c) South America\", \"d) North America\"], \"c\"),\n \n GeoQuestion.new(\"What is the smallest country in South America?\",\n [\"a) Aruba\", \"b) Bolivia\", \"c) Guyana\", \"d) Suriname\"], \"d\"),\n \n GeoQuestion.new(\"What is the capital of Nigeria?\",\n [\"a) Abuja\", \"b) Lagos\", \"c) Ibadan\", \"d) Kano\"], \"a\"),\n \n GeoQuestion.new(\"What is the capital of Turkey?\",\n [\"a) Istanbul\", \"b) Izmir\", \"c) Ankara\", \"d) Bursa\"], \"c\"),\n \n GeoQuestion.new(\"Lake Titicaca sits on the border between what two nations?\",\n [\"a) Ecuador & Columbia\", \"b) Argentina & Chile\", \"c) Brazil & Paraguay\", \"d) Bolivia & Peru\"], \"d\"),\n \n GeoQuestion.new(\"What is the largest country in the world in terms of land area?\",\n [\"a) China\", \"b) United States\", \"c) Russia\", \"d) Canada\"], \"c\"),\n \n GeoQuestion.new(\"What U.S. state contains the world's largest flat-top mountain?\",\n [\"a) Colorado\", \"b) Wyoming\", \"c) Utah\", \"d) Arizona\"], \"a\"),\n \n GeoQuestion.new(\"What is the state capital of Oklahoma?\",\n [\"a) Tulsa\", \"b) Edmond\", \"c) Guthrie\", \"d) Oklahoma City\"], \"d\"),\n ]\n return questions.sample(how_many)\nend", "def question_params\n params.require(:question).permit(:title, :body)\n #require returns question array\n #of everything being posted, work with the questions part, and allow these two things to be submitted\n end", "def new\n @question = @quiz.questions.new\n\n 4.times { @question.answers.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end", "def new\n @template = @question.template\n end", "def initialize(options = {})\n @question = options[:question] #-> these are strings\n @answer = options[:answer]\n end", "def initialize(elements, answer_sheet)\n @elements = elements\n @answer_sheet = answer_sheet\n @questions = elements.select { |e| e.question? }\n end", "def question(n)\n send \"question_#{n}\"\n end", "def question\n @posts = Post.all\n end", "def index\n @questions = Question.all \n @message = get_data[:message]\n @specialist_id = get_data[:specialist_id]\n @patient_id = get_data[:patient_id]\n end", "def create_question(name, ideas = [])\n ideas = ideas.join(\"\\n\") if ideas.is_a? Array\n q = Pairwise::Question.create({\n :name => name,\n :visitor_identifier => @local_identifier.to_s,\n :local_identifier => @local_identifier.to_s,\n :ideas => ideas\n })\n q.it_should_autoactivate_ideas = true\n q.active = true\n q.save\n q\n end", "def new\n @time_series_question = @time_series.questions.build\n @datasets = @time_series.datasets.sorted\n # build the dataset questions\n @datasets.each do |dataset|\n @time_series_question.dataset_questions.build(dataset_id: dataset.dataset_id)\n end\n\n # get the list of questions for each dataset in the time series that are not already in the time series\n @questions = {}\n @datasets.each do |ts_dataset|\n @questions[ts_dataset.dataset_id.to_s] = ts_dataset.dataset.questions.for_analysis_not_in_codes(@time_series.questions.codes_for_dataset(ts_dataset.dataset_id))\n end\n\n add_common_options\n\n @is_new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_series_question }\n end\n end", "def answer_question(i, answer)\n @answers[i] = answer\n end", "def questions\n @root.questions\n end", "def answers\n [answer_1, answer_2]\n end", "def add_question(question)\n @questions << question\n end", "def show\n @practice = Practice.find(params[:id])\n\n #Desordena todas las opciones para mostrar en la vista\n @options_array = []\n @practice.questions.each do |question|\n @temp_array = []\n @temp_array << question.correct\n @temp_array << question.incorrect1\n @temp_array << question.incorrect2\n @temp_array << question.incorrect3\n @temp_array = @temp_array.shuffle\n @options_array << @temp_array\n end\n #para iterar sobre las opciones en la vista\n @cont = 0\n puts @options_array[0]\n end", "def index\n @questions = Question.search(params).page(params[:page]).per(10)\n @question = Question.new\n end", "def populate(questions)\n\tindex = 0\n\tintercom_id = []\n\n\tputs \"Paste in your Personal Access Token:\"\n\tpat = gets.chomp\n\tintercom = Intercom::Client.new(token: pat)\n\tputs \"How many questions do you want to add? The max is: #{questions.length}\"\n\tstop_point = gets.to_i\n\n\tintercom.users.all.each do |user| \n\t\tintercom_id << user.id\n\t\tintercom.messages.create(\n\t\t :from => {\n\t\t :type => \"user\",\n\t\t :id => user.id\n\t\t },\n\t\t :body => questions[index]\n\t\t)\n \n\t#I'm sure there's a better way to do this in Ruby\t\n index = index + 1\n break if index >= stop_point\n\n\tend\nend", "def questions\n @pages.collect { |p| p.questions }.flatten\n end", "def index\n @survey_results = SurveyResult.all\n @course = Course.find(params[:course_id])\n\n @questions = [\n [\"classtime\",\"Class time is used productively.\"],\n [\"homework\",\"Homework assignments are conducive to relevant learning.\"],\n [\"midterm\",\"The midterm focused on relevant class material.\"],\n [\"workload\",\"The weekly workload is acceptable\"],\n [\"material\",\"The class material (lectures, books, etc.) is useful and easily available.\"],\n [\"pace\",\"The course pace is too fast\"],\n [\"passion\",\"The instructor is passionate about teaching the course.\"]\n ]\n end", "def get_answers\n @answers\n end", "def get_questions\n @questions = Question.active.chronological.to_a\n end", "def show\n @questions = @line_case.questions\n end", "def index\n @questions = Question.all\n end", "def index\n @questions = Question.all\n end", "def index\n @questions = Question.all\n end", "def index\n @questions = Question.all\n end", "def index\n @questions = Question.all\n end", "def index\n @questions = Question.all\n end", "def index\n @questions = Question.all\n end", "def index\n @questions = Question.all\n end", "def index\n @questions = Question.all\n end" ]
[ "0.7177782", "0.6959165", "0.68871486", "0.67830104", "0.67192394", "0.66747355", "0.6670768", "0.6659711", "0.6505509", "0.64900553", "0.6470867", "0.6448659", "0.64248973", "0.6381592", "0.63748884", "0.63702905", "0.63639313", "0.6353912", "0.63293844", "0.63016564", "0.62981534", "0.6293326", "0.628616", "0.6259654", "0.6255888", "0.6201117", "0.61755955", "0.616596", "0.61622345", "0.6141776", "0.61324304", "0.61243343", "0.61232394", "0.61174804", "0.61132944", "0.6110947", "0.6110312", "0.6108717", "0.6103244", "0.6097445", "0.60892487", "0.60718685", "0.6067144", "0.6067144", "0.6067144", "0.6067144", "0.6064118", "0.6032715", "0.60314375", "0.60171485", "0.601221", "0.60105324", "0.6008543", "0.60048646", "0.600295", "0.60023993", "0.5999044", "0.5990766", "0.59850925", "0.5975813", "0.59729385", "0.59698963", "0.5969688", "0.59515977", "0.5948831", "0.5936503", "0.5934325", "0.5927282", "0.59259844", "0.5912152", "0.590514", "0.5893301", "0.58879316", "0.5881985", "0.5876803", "0.58723664", "0.5871668", "0.586418", "0.58595544", "0.5850143", "0.5843998", "0.5830416", "0.5822568", "0.5818666", "0.5802704", "0.57904905", "0.57898957", "0.5777183", "0.5773737", "0.5772445", "0.57714593", "0.576988", "0.576527", "0.576527", "0.576527", "0.576527", "0.576527", "0.576527", "0.576527", "0.576527", "0.576527" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_roster @roster = Roster.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_handler\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 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 setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\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 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 before_action \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 setup_signals; end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n 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 after_set_callback; end", "def initialize(*args)\n super\n @action = :set\nend", "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 around_hooks; 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 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 setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def call\n setup_context\n super\n end", "def duas1(action)\n action.call\n action.call\nend", "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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0.53307265", "0.5312121", "0.5298173", "0.5296388", "0.52952695", "0.5258086", "0.52430934", "0.5237911", "0.5237911", "0.5237911", "0.5237911", "0.5237911", "0.52335346", "0.5232943", "0.5226392", "0.52221715", "0.5217978", "0.52136153", "0.52076435", "0.52067244", "0.5175402", "0.5174649", "0.5173085", "0.5165201", "0.5162052", "0.5157932", "0.5152905", "0.5152353", "0.5150909", "0.514719", "0.5138596", "0.51333916", "0.51139015", "0.5113431", "0.5113431", "0.5109581", "0.51066816", "0.5091428", "0.5089407", "0.5082971", "0.50822043", "0.50668514", "0.5055155", "0.50525695", "0.50499475", "0.50499475", "0.5034445", "0.50249445", "0.5022226", "0.50167644", "0.5014211", "0.4999924", "0.49996212", "0.49978727", "0.4989682", "0.4989682", "0.49851838", "0.49817684", "0.4979687", "0.49787104", "0.49688423", "0.49664098", "0.49564412", "0.49561828", "0.49547398", "0.4953481", "0.4952925", "0.4946049", "0.494379", "0.49319315", "0.49313048", "0.49269778", "0.49263066", "0.49257493", "0.4924526", "0.49212465", "0.49173486", "0.4915802", "0.49151486", "0.49150333", "0.49147308" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def roster_params params.require(:roster).permit(:ranking, :name, :position) 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 filtering_params\n params.permit(:email)\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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def 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 permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 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.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289145", "0.62875307", "0.6280997", "0.62420976", "0.62388235", "0.6216686", "0.62122375", "0.6208949", "0.619173", "0.6176307", "0.6173907", "0.6170346", "0.616111", "0.6150513", "0.6150023", "0.61446756", "0.6120429", "0.6112975", "0.6104845", "0.6102966", "0.6087884", "0.6079323", "0.60699135", "0.60602236", "0.60191786", "0.60170597", "0.60100305", "0.6009527", "0.60052776", "0.60052776", "0.600042", "0.5999317", "0.59933805", "0.5991528", "0.5991221", "0.5990094", "0.5979497", "0.5966058", "0.5958738", "0.59579456", "0.5957759", "0.5956938", "0.5951788", "0.59511644", "0.59423065", "0.59373474", "0.59361076", "0.59361076", "0.59331447", "0.5928005", "0.5924882", "0.5924011", "0.59169155", "0.5908037", "0.5907541", "0.59061426", "0.59056246", "0.5897408", "0.58960444", "0.58951247", "0.5893136", "0.5892312", "0.5890385", "0.58853275", "0.58801144", "0.58784765", "0.5872648", "0.58682626", "0.5867028", "0.58661693", "0.586578", "0.58643955", "0.5863193", "0.58609086", "0.5859997", "0.5858935", "0.5858632", "0.5853379", "0.5852741", "0.584806", "0.5847703" ]
0.0
-1
Retrieve the file from its store path
def retrieve!(identifier) HesCloudStorage::HesCloudStorageEngine::File.new(uploader, self, ::File.basename(uploader.store_path(identifier), uploader.root)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stored_file_path\n File.join(path, stored_name)\n end", "def retrieve!(identifier)\n self.class.configure_qcloud_sdk(uploader)\n\n if uploader.file # file is present after store!\n uploader.file\n else\n file_path = uploader.store_path(identifier)\n File.new(nil).tap do |file|\n file.path = file_path\n end\n end\n end", "def get\n File.read(path)\n end", "def get_file_path\n @path\n end", "def _get_file(name)\n File.read(\"%s/%s\" % [uri, name])\n end", "def path\n @file\n end", "def store_path\n store_path ||= build_store_path\n end", "def path\n @file\n end", "def get\n file\n end", "def path\n file.url\n end", "def find_file_named name\n @store.find_file_named name\n end", "def get_file(path)\n if not @files[path]\n file_not_found(path)\n end\n \n return Chance.get_file(@files[path])\n end", "def path\n @file.path\n end", "def get_file(path)\n raise FileNotFoundError.new(path) unless @files[path]\n \n return Chance.get_file(@files[path])\n end", "def fs(path)\n OodAppkit.files.url(path: path).to_s\n end", "def retrieve!(identifier)\n File.new(uploader, self, uploader.store_path(identifier))\n end", "def get_file_from_store(file)\n Cloudsync::File.from_s3_obj( get_obj_from_store(file), self.to_s )\n end", "def get_file(path)\n uri = URI.join('https://stellar.mit.edu', path)\n @mech.get_file uri\n end", "def file\n @pathname.to_s\n end", "def file_path\n storage.file_path(self.class, @id)\n end", "def path\n @file.path\n end", "def store_path(path = '/')\n File.expand_path(File.join(settings['store_path'], path))\n end", "def get_file(key, use_cache = true)\n if use_cache\n db = (@current_site.get_meta(cache_key) || {})[File.dirname(key)] || {}\n else\n db = objects(File.dirname(key)) unless use_cache\n end\n (db[:files][File.basename(key)] || db[:folders][File.basename(key)]) rescue nil\n end", "def path\n @filename\n end", "def get_file(path)\n raise NotImplemented\n end", "def content\n file = Store::File.find_by(id: store_file_id)\n if !file\n raise \"No such file #{store_file_id}!\"\n end\n\n file.content\n end", "def file\n return @file\n end", "def file\n return @file\n end", "def filepath\n base = storage_root_path\n if base\n File.join(base, storage_key)\n else\n raise StandardError.new(\"no filesystem path found for datafile: #{self.web_id}\")\n end\n end", "def path\n http_url @store.rdoc.generator.file_dir\n end", "def path\n self.file.to_s\n end", "def file\r\n LocalFile\r\n end", "def filepath\n @filepath\n end", "def filepath\n @filepath\n end", "def filepath\n @filepath\n end", "def path\n @reader.path\n end", "def path\n return self.saved? ? @realfile.path : nil\n end", "def archive_path\n @archive_path ||= stored_file.retrieval_path\n end", "def filepath\n @epub.manifest.path_from_id(@id)\n end", "def file(path)\n File.read(path)\n end", "def get_file(path)\n return File.new(path)\n end", "def retrieve!(identifier)\n CarrierWave::Storage::Couch::File.new(uploader, uploader.store_path(identifier))\n end", "def get_file(id)\n id = self.to_id(id)\n self.grid.get(id).read\n end", "def fetch_file(file_path)\n client.get_file(file_path)\n end", "def get_local_file(fname)\n if File.exist?(@dir+'/'+fname) then\n fname = @dir+'/'+fname\n end\n return File.open(fname)\n end", "def file_path\n @file_path ||= lookup_file_path\n end", "def fetch_path(path=\"\")\n read_data(@uri + path)\n end", "def get_file(path, options={})\n remove_file path\n resource = File.join(prefs[:remote_host], prefs[:remote_branch], 'files', path)\n replace_file path, download_resource(resource, options)\nend", "def get_file(file_path)\n ensure_file_open!\n @file.read(file_path)\n end", "def retrieve!(identifier)\n CarrierWave::Storage::GridFS::File.new(uploader, uploader.store_path(identifier))\n end", "def retrieve!(identifier)\n CarrierWave::Storage::GridFS::File.new(uploader, uploader.store_path(identifier))\n end", "def retrieve(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\n body = file.body\n\n extname = File.extname(path)\n basename = File.basename(path, extname)\n\n file = Tempfile.new([basename, extname])\n file.binmode\n file.write(body)\n file.rewind\n\n file\n end", "def find_file path, options = {}\n ensure_connection!\n resp = connection.get_file name, path, options\n if resp.success?\n File.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "def getFile(file)\n return fileByName.fetch(file, nil)\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file(path)\n full_path = @repository_path + path\n return nil unless full_path.exist?\n FileStreamer.new(full_path)\n end", "def relative_store_dir\n parse_dir_options(:store_dir)\n end", "def file\n @file ||= find_file\n end", "def file\n @file\n end", "def file(path)\n file = opened_crate.dereference(path)\n if file\n file.source\n else\n opened_crate.find_entry(path)\n end\n end", "def get_file_path(v1_url)\n store.get(table_key + '_path', v1_url)\n end", "def file(filename) File.read(File.absolute_path(filename, File.dirname($PROGRAM_NAME))) end", "def file_path\n dir\n end", "def path_to_file(path)\n File.new(self.absolute_path(path))\n end", "def file\n files.first\n end", "def file\n files.first\n end", "def path\n native.path\n end", "def new_store_path(for_file=filename)\n File.join([generate_new_store_dir, full_filename(for_file)].compact)\n end", "def file\n @file\n end", "def file_on_disk\n ActiveStorage::Blob.service.send(:path_for, file.key)\n end", "def file_path\n end", "def file\n @zip_fs_file\n end", "def read\n IO.read(full_path)\n end", "def file_by_url(url)\n return file_by_id(url_to_id(url))\n end", "def current_path\n file.try(:path)\n end", "def store_dir\n \"attachment/#{model.id}\"\n end", "def store_dir\n \"attachment/#{model.id}\"\n end", "def get_file(url)\n get(url).body\n end", "def store_dir\n \"files/#{model.album.path}\"\n end", "def file_path; end", "def path\n '/c/document_library/get_file?folderId=%i&name=%s' % [self.folderid, self.name]\n end", "def file_get(id)\n response = get('FileService.getFile', id)\n end", "def get_cache_file(key)\n _find_file_key(key)\n end", "def file_path\n self.class.file_path\n end", "def file_path\n self.class.file_path\n end", "def file_path\n self.class.file_path\n end", "def save_to_file(path = nil)\n content\n file = Store::File.find_by(id: store_file_id)\n if !file\n raise \"No such file #{store_file_id}!\"\n end\n\n if !path\n path = Rails.root.join('tmp', filename)\n end\n ::File.open(path, 'wb') do |handle|\n handle.write file.content\n end\n path\n end", "def model_file_path\n model.file_path\n end", "def server_get_file(server, path)\n request(\n :path => \"containers/#{server.id}/files\",\n :params => {\n :path => path\n },\n :disable_body_extraction => true\n ).get(:body)\n end", "def store_dir\n \"city-of-meridian/files/\"\n end", "def data_store_path\n Rails.root.join('data', self.data_dir)\n end", "def file\n File.file?(@path) ? @path : zip_file\n end", "def file\n @file ||= File.basename(link)\n end", "def file\n FILE\n end", "def file_path\n\t\tself.class.file_path\n\tend", "def retrieve!(identifier)\n CarrierWave::Storage::UpYun::File.new(uploader, self, uploader.store_path(identifier))\n end", "def retrieval_path\n file_path = nil\n current_user_role_names.each do |role_name|\n file_path = path_for role_name: role_name\n break if file_path\n end\n\n file_path\n end" ]
[ "0.7184737", "0.6933105", "0.6897425", "0.68497217", "0.68366075", "0.6806873", "0.6781202", "0.67683166", "0.674818", "0.6735283", "0.66854334", "0.6645019", "0.66161555", "0.661403", "0.6595408", "0.6567676", "0.65410316", "0.65409553", "0.65246934", "0.65191454", "0.65073687", "0.64983785", "0.6446668", "0.6444222", "0.64349556", "0.6432394", "0.6429202", "0.6429202", "0.641899", "0.6417116", "0.6404411", "0.6401848", "0.6400972", "0.6400972", "0.6400972", "0.63873816", "0.6372719", "0.6372292", "0.63622683", "0.6360989", "0.63488585", "0.6345559", "0.6342382", "0.6278507", "0.62529945", "0.623944", "0.62357306", "0.6235648", "0.6208066", "0.62028354", "0.62028354", "0.62000656", "0.6196737", "0.6187385", "0.61662775", "0.61662775", "0.61662775", "0.61662775", "0.615227", "0.6148469", "0.6142827", "0.61001396", "0.60935503", "0.60885996", "0.6082056", "0.6073072", "0.6057553", "0.6050157", "0.6050157", "0.60501045", "0.6049023", "0.6046548", "0.60362566", "0.60321444", "0.60274124", "0.6022735", "0.60216707", "0.6014111", "0.60108495", "0.60108495", "0.60093594", "0.600417", "0.59893125", "0.5979899", "0.59796864", "0.5978758", "0.5971651", "0.5971651", "0.5971651", "0.5963306", "0.59550345", "0.59464264", "0.5941997", "0.5938306", "0.59343165", "0.5927384", "0.59250176", "0.59213793", "0.5918073", "0.5916968" ]
0.63679856
38
Return extension of file
def extension path.split('.').last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_extension\n filename.split(\".\").last\n end", "def extension\n split_extension(filename)[1] if filename\n end", "def ext\n b,e = split_extension(filename)\n e\n end", "def extname\n File.extname(filename)\n end", "def file_ext(filename)\n File.extname( filename ).gsub(\".\", \"\") rescue nil\n end", "def extension\n filename =~ /\\./ ? filename.split('.').last : nil\n end", "def ext\n File.extname(path)\n end", "def ext_of(filename)\n filename =~ extension_regex ? $2 : ''\n end", "def ext\n File.extname( fullpath )\n end", "def extname() File.extname(path) end", "def ext_of(filename)\n filename =~ /((\\.[a-z]+)*)$/ ? $1 : ''\n end", "def ext\n File.extname(@path)\n end", "def extname() File.extname(@path) end", "def extension\n begin\n @file_data.original_filename.split(\".\").last\n rescue\n @file_data.path.split(\".\").last\n end\n end", "def get_ext (file)\n\n\t\tif file.is_a? String\n\t\t\treturn File.extname(file)\n\t\telsif file.is_a? File\n\t\t\treturn File.extname(file.path)\n\t\tend\n\n\tend", "def ext\n file.extension.downcase\n end", "def extension\n @ext ||= ( ( e = File.extname( path ) ).empty? ? nil : e )\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def get_extension(fileName)\n file_extension = File.extname(fileName)\n file_extension = file_extension.split('.')\n file_extension.last\n end", "def file_extension\n FILE_EXTENSION\n end", "def ext\n @ext ||= File.extname(path)\n end", "def file_ext\n File.extname(@file_name).downcase\n end", "def extension(file)\n target_extension || File.extname(file)\n end", "def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end", "def file_extension\n self.class.file_extension\n end", "def file_extension; end", "def file_extension; end", "def file_extension; end", "def file_extension\n self::FILE_EXTENSION\n end", "def get_extension filename\n unless filename.nil?\n filename.to_s.scan(/\\.([\\w+-]+)$/).flatten\n else\n false\n end\n end", "def extname(path)\n File.extname(path)\n end", "def extension\n File.extname(@io.original_filename)\n end", "def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end", "def get_file_extension(mime_type)\n '.' + MimeMagic.new(mime_type).extensions.first || ''\n end", "def getFileExt(file_name)\n \text = file_name.split('.')\n \tif(ext.length > 1)\n \t\tf_ext = ext[ext.length - 1]\n\t\t\n \t\tif(f_ext)\n \t\t\treturn f_ext\n \t\tend\n \tend\n end", "def original_extension\n File.extname(original_filename)\n end", "def extension_with_delimiter\n File.extname @filename\n end", "def extname( fn )\n ::File.extname(fn).tr('.', '')\n end", "def file_extension(extension = T.unsafe(nil)); end", "def extension\n File.extname(id)[1..-1] || File.extname(original_filename.to_s)[1..-1]\n end", "def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end", "def extension\n File.basename(root_path)\n end", "def file_type( file_name )\n File.extname( file_name ).gsub( /^./, '' ).downcase\n end", "def extname\n\t\treturn nil unless src\n\n\t\tFile.extname url.path\n\tend", "def get_extension(path)\n return path[/^.+(\\.[a-z0-9]+)$/i, 1]\n end", "def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend", "def file_type file_name\n File.extname(file_name).gsub(/^\\./, '').downcase\n end", "def extname\n File.extname(url)\n end", "def get_internal_extension(file_type)\n\n case file_type\n when 'word' # .docx for word type\n ext = '.docx'\n when 'cell' # .xlsx for cell type\n ext = '.xlsx'\n when 'slide' # .pptx for slide type\n ext = '.pptx'\n else\n ext = '.docx' # the default value is .docx\n end\n\n ext\n end", "def infer_extension\n return if name.nil?\n\n self.extension ||= File.extname(name)\n end", "def file_ext\n Asset.file_ext(self.file_name) if self.file?\n end", "def file_type(file_name)\n @file_class.extname(file_name).gsub( /^\\./, '' ).downcase \n end", "def file_extension_content_type filename\n types = MIME::Types.type_for(filename)\n types.empty? ? nil : types.first.content_type\n end", "def extension\n extensions.last || \"\"\n end", "def ext\n @ext ||= path.split('.').size > 1 ? path.split('.')[-1] : 'html'\n end", "def file_type(file_name)\n return file_name[file_name.rindex(\".\") + 1, file_name.size]\n end", "def extname; end", "def extname; end", "def extname; end", "def extname; end", "def extension\n name.downcase\n end", "def real_extension(filename)\n ext = File.extname(filename)\n return ext if ext.empty?\n ext = ext[1, ext.length - 1].sub('.', '_').downcase\n e_s = ext.to_sym\n return ext unless ALT_EXTENSIONS.key?(e_s)\n ALT_EXTENSIONS[e_s].dup\n end", "def file_ext extension\n response_object.mime extension\n end", "def get_file_extension(arr)\n\nend", "def picture_extension filename\n extension = filename.split('.').last.downcase\n extension = 'jpg' if extension == 'jpeg' || extension == 'jpg'\n extension\n end", "def extensionize(fname, ext, opts={})\n extname = File.extname(fname)\n return fname if (extname =~ /\\.?#{ext}$/i) == 0\n fname = fname.gsub(/#{extname}$/, '') if opts[:chomp] == true\n return fname.strip + '.' + ext.to_s.gsub(/^\\./, '')\n end", "def extension\n return _meta_data['extension'] if _meta_data.has_key? 'extension'\n ext\n end", "def sample_file_ext(ext)\n if ext.is_a?(Array)\n ext[0]\n elsif ext\n ext\n else\n 'bin'\n end\n end", "def file_suffix\n file_name.split('.').last \n end", "def extension\n extension_from_disk.blank? ? extension_from_feed : extension_from_disk\n end", "def base file, ext; return File.basename file, ext end", "def base file, ext; return File.basename file, ext end", "def filetype(path)\n path = File.extname(path)\n if Audio::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'audio'\n elsif Video::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'video'\n elsif Image::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'image'\n else\n return nil\n end\n end", "def file_type(file_name)\n File.exname( file_name ).gsub( /^\\./, '').downcase\n end", "def file_base_type(path)\r\n \t\tfile_name = File.basename(path)\r\n \t\textension = File.extname(file_name)\r\n \t\tfile_name = file_name[0, file_name.length - extension.length]\r\n \t\t(File.extname(file_name)[1..-1]).to_sym\r\n end", "def file_name\n \"#{@file_name}.#{extension}\"\n end", "def ext_for_file(key, filename = nil, content_type = nil)\n if filename.blank?\n options = key.respond_to?(:attributes) ? key.attributes : {}\n filename = ActiveStorage::Filename.new(options[:filename]) if options.has_key?(:filename)\n end\n ext = filename.respond_to?(:extension_without_delimiter) ? filename.extension_without_delimiter : nil\n\n return ext unless ext.blank?\n\n # Raw files are not convertible, no extension guessing for them\n return nil if content_type_to_resource_type(content_type).eql?('raw')\n\n # Fallback when there is no extension.\n @formats ||= Hash.new do |h, key|\n ext = Rack::Mime::MIME_TYPES.invert[key]\n h[key] = ext.slice(1..-1) unless ext.nil?\n end\n @formats[content_type]\n end", "def extname\n File.extname(image_src).delete('.') unless image_src.nil?\n end", "def mime_type(file)\n type = nil\n\n if (file =~ /\\.(.+?)$/)\n type = ExtensionMimeTypes[$1.downcase]\n end\n\n type || \"text/plain\"\n end", "def extensions\n @extensions ||= @pathname.basename.to_s.scan(/\\.[^.]+/)\n end", "def file_extension\n return \"oemodel\"\n end", "def chop_extension filename\n filename.sub %r{\\.\\w+$}, \"\"\n end", "def extension(glob)\n \"*.#{glob}\"\n end", "def with_file_extension(name, entry_type)\n return name unless File.extname(name.to_s).empty?\n\n extension = extension_for_type(entry_type)\n extension ? \"#{ name }.#{ extension }\" : name\n end", "def file_extensions\n safe_const_get(:FILE_EXTENSIONS) || []\n end", "def filename_without_extension\n filename.include?('.') ? filename.split('.')[0..-2].join('.') : filename\n end", "def changeFileExtensionTo(filename, extension)\n return \"#{File.basename(filename, File.extname(filename))}.#{extension}\"\nend", "def extension_without_delimiter\n extension_with_delimiter.from(1).to_s\n end", "def understands_ext?(path)\n extensions.find{|ext| ext == File.extname(path)}\n end", "def process\n self.ext = File.extname(name)\n end", "def st_extension\n return \"jpg\" unless self.class.st_config[:extension].present?\n if self.class.st_config[:extension].is_a?(String)\n self.class.st_config[:extension]\n else\n self.send(self.class.st_config[:extension])\n end\n end", "def extension\n (options[:convert_to] || 'jpg').to_s.downcase.gsub(\"jpeg\", \"jpg\")\n end", "def tempfile_extension\n # complexity here is due to supporting mangling non-UTF8 strings (e.g. latin-1 filenames with characters that are illegal in UTF-8)\n b = File.basename(@new_resource.path)\n i = b.index(\".\")\n i.nil? ? \"\" : b[i..].scrub\n end", "def file_ext\n case variant\n when :preview, :\"180x180\", :\"360x360\"\n \"jpg\"\n when :\"720x720\"\n \"webp\"\n when :sample\n media_asset.is_ugoira? ? \"webm\" : \"jpg\"\n when :original\n media_asset.file_ext\n end\n end", "def format_extension\n extensions.reverse.detect { |ext|\n @environment.mime_types(ext) && !@environment.engines(ext)\n }\n end", "def filename_without_extension\n (@filename_without_extension || original_filename_without_extension).to_s\n end", "def check_file_ext(file)\n status = nil\n ext = file.extname\n name = file.basename\n if ext == '.atp'\n status = 'atp'\n elsif ext == '.avc'\n status = 'avc'\n elsif ext == '.gz'\n # Ensure we have a .atp.gz or .avc.gz\n sub_ext = name.to_s.split('.')[-2]\n if sub_ext == 'atp'\n status = 'atp'\n end\n elsif ext == '.list'\n status = 'list'\n end\n status\n end", "def ext(ext)\n self.map do |f|\n Neutron.file_to_ext(f, ext)\n end\n end" ]
[ "0.9140418", "0.9051006", "0.90327877", "0.8933805", "0.8828073", "0.8802823", "0.8769988", "0.87578386", "0.87093997", "0.8706713", "0.8705118", "0.8700549", "0.8668049", "0.8666507", "0.8664546", "0.86570174", "0.8589137", "0.8586352", "0.8586352", "0.8586352", "0.857835", "0.85642874", "0.8522771", "0.8504903", "0.8442702", "0.8436881", "0.8421947", "0.8405967", "0.8405967", "0.8405967", "0.8384019", "0.8356957", "0.8339915", "0.8331697", "0.83233726", "0.8274312", "0.82584876", "0.8243479", "0.82434165", "0.82091236", "0.81929255", "0.81564", "0.80554336", "0.80206513", "0.79561096", "0.7916196", "0.7903411", "0.7890296", "0.78889614", "0.7798305", "0.7776922", "0.77493745", "0.77126807", "0.7663898", "0.76567674", "0.7650719", "0.76318246", "0.75908786", "0.75847405", "0.75847405", "0.75847405", "0.75847405", "0.7566943", "0.75596124", "0.7550694", "0.74451935", "0.74353814", "0.7393596", "0.72595984", "0.72373384", "0.7208386", "0.719192", "0.7186197", "0.7186197", "0.71834993", "0.7183464", "0.7179159", "0.71691585", "0.71659565", "0.71614724", "0.71556246", "0.7131144", "0.7125302", "0.71204007", "0.71195203", "0.7119067", "0.71099067", "0.7088171", "0.70717573", "0.7037247", "0.70136434", "0.7011187", "0.6983587", "0.69562143", "0.69276553", "0.6925354", "0.692163", "0.6920495", "0.6870861", "0.6868644" ]
0.85181767
23
Read content of file from service
def read file.read end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read file\n File.open file\n end", "def get_file_contents(file_path)\n input_file = File.open(file_path, 'r')\n input_file_contents = input_file.read\n input_file.close\n input_file_contents\n end", "def read\n file\n end", "def read_file(path)\n response = with_remote do |http|\n http.get(path)\n end\n response.body\n end", "def read_file(path)\n api.read_file container_name, path\n end", "def get\n File.read(path)\n end", "def read_file(file, context); end", "def content\n @content = File.read(path)\n end", "def raw_contents\n File.read(path)\n end", "def read(path); end", "def load_file_contents(file)\n File.open(file, 'r').read\n end", "def contents\n File.read(path) if exists?\n end", "def read_file(resource)\n File.read(resource)\n end", "def content\n return IO.read(@file)\n end", "def contents\n read\n end", "def _get_file_contents(file)\n raise InvalidPath, \"connection file doesn't exist\" unless File.file?(file)\n _parse File.read(file)\n end", "def readFile(fileName)\n begin\n fContent = File.open(fileName).read\n rescue DefaultException => e\n puts \"Reading repository file failed :#{fileName}\"\n end\n end", "def get_file_contents(file_path)\n input_file = File.open(file_path, 'r')\n input_file_contents = input_file.read\n input_file.close\n input_file_contents.split(\"\\n\")\n end", "def read_file(file, context)\n File.read(file)\n end", "def read_contents\n\t\treturn File.open(self.file_name).read.lines.map(&:chomp) if self.file_name\n\tend", "def read\n\t\t@file_content = File.open(\"/home/calin/football/football.dat\",\"r\")\n\tend", "def file_content(path)\n cont = \"\"\n File.open(path) do |fil|\n cont = fil.read\n end\n cont\nend", "def read_file(path)\n File.read(path)\n end", "def read_data_file(path); end", "def read\n IO.read(full_path)\n end", "def get\n file\n end", "def read_request(client, filename)\n aFile = File.open(filename, 'r')\n if aFile\n contents = File.read(filename)\n client.puts \"\\n\\nCONTENTS OF #{filename}\\n*****************\\n\\n#{contents}\\n\\n*****************\\nEND OF #{filename}\"\n else\n client.puts \"ERROR: Unable to open file #{filename}\\nEND OF\"\n end\n aFile.close\n return\n end", "def read_task_file\n File.read(file_path)\n end", "def file_data\n @client.get_file @file_url\n end", "def contents\n\t\tconnection.file_contents(full_path)\n\tend", "def contents\n\t\tconnection.file_contents(full_path)\n\tend", "def read_content(name, resource)\n read(name, resource) do |file|\n if file.header.typeflag == \"2\"\n return read_content(name, File.absolute_path(file.header.linkname,File.dirname(resource)))\n end\n if file.header.typeflag != \"0\"\n raise NotAFile.new(\"not a file\", {'path' => resource})\n end\n return file.read\n end\n end", "def read\n @read ||= File.read(path)\n end", "def read_file(path)\n file_contents = []\n File.open(path).each { |line| file_contents << line }\n\n file_contents\n end", "def file(path)\n File.read(path)\n end", "def parse_file\n @filecontent ||= File.read(@filepath)\n end", "def file_contents_on(host, file_path)\n file_contents = nil\n\n split_path = win_ads_path(file_path)\n if file_exists_on(host, split_path[:path])\n if host[:platform].include?('windows')\n file_path.tr!('/', '\\\\')\n\n command = %{Get-Content -Raw -Path #{file_path}}\n command += %{ -Stream #{split_path[:ads]}} if split_path[:ads]\n\n file_contents = on(host, powershell(command))&.stdout&.strip\n else\n file_contents = on(host, %(cat \"#{file_path}\"))&.stdout&.strip\n end\n else\n logger.warn(\"File '#{file_path}' on '#{host} does not exist\")\n end\n\n return file_contents\n end", "def read_file(file)\n travs = \"\"\n travs << \"../\" * datastore['DEPTH']\n travs << file\n\n print_status(\"#{@peer} - Retrieving file contents...\")\n\n connect\n req = \"GET #{normalize_uri(target_uri.path, \"gefebt.exe\")}?substitute.bcl+FILE=#{travs} HTTP/1.0\\r\\n\\r\\n\"\n sock.put(req)\n res = sock.get_once\n disconnect\n\n if res and res =~ /HTTP\\/1\\.0 200 OK/\n return res\n else\n return nil\n end\n\n end", "def contents\n # give the string contents of the file\n @file.seek 0\n @file.read @filesize\n end", "def data\n File.read(path)\n end", "def getFileContents(file)\n fileContent = \"\";\n File.open(file).each do |line|\n fileContent += line;\n end\n fileContent;\nend", "def load_file_contents(filename)\n File.open(filename).readlines\n end", "def read_content(repo, ref, file)\n Base64.decode64(connection.contents(\"#{organization}/#{repo}\", path: file, ref: ref).content)\n end", "def read\n @contents ||= File.read @src_path if readable?\n end", "def read_file(file_name)\n begin\n content = File.open(file_name).read\n return content\n rescue\n raise\n end\n end", "def getContentsFromFile filetoread\n return File.read(Dir.pwd + '/' + filetoread)\nend", "def getContentsFromFile filetoread\n return File.read(Dir.pwd + '/' + filetoread)\nend", "def recieve_and_read_file\n read_file(@message)\n end", "def get_file_contents(fname)\n f_h = File.open(fname,'r')\n readbuf = f_h.read()\n# puts \"Read #{readbuf.length()} bytes from #{fname}.\"\n f_h.close()\n return readbuf\nend", "def content\n @content ||= IO.read(path)\n rescue Errno::ENOENT\n raise NoPackageFile.new(path)\n end", "def read_file(absolute_path); end", "def read_file(template)\r\n File.read(template)\r\nend", "def read_file(file)\n File.read(file)\n end", "def read_file(file)\n File.read(file)\n end", "def file_contents(full_path)\n\t\t::File.read(full_path)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, full_path\n\tend", "def file_contents(full_path)\n\t\t::File.read(full_path)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, full_path\n\tend", "def get_data(file)\n f = File.open(file, 'rb')\n buffer = f.read\n f.close\n\n buffer\n end", "def read\n status = 200\n\n # File path\n fpath = filepathById params[:id]\n\n if nil == fpath\n # File description does not exists\n result = {status: 'error', message: 'Bad request'}\n status = 400\n elsif File.exists? fpath\n result = {content: File.read(fpath)}\n else\n result = {content: ''}\n end\n render json: result.to_json, status: status\n end", "def read_file(file)\n File.read(file)\nend", "def get_file(file_path)\n ensure_file_open!\n @file.read(file_path)\n end", "def contents\n file_upload.read\n end", "def read_resource(resource, content, extension=\"\")\n path = get_path(resource, extension)\n return File.open(path, 'r')\n end", "def read_file(template)\n File.read(template)\nend", "def read_file(filename); end", "def getFileContent(file_path)\n file = File.read(file_path)\n data_hash = JSON.parse(file)\n return data_hash\nend", "def read_from_file\n begin\n File.open(@file) do |file|\n file.each_line {|line| @data_for_output << line}\n end\n rescue Errno::ENOENT => e\n puts e\n exit\n end\n end", "def my_file_reader(fname)\n fstream = File.open(fname, 'r')\n data = fstream.read\n fstream.close\n \n return data\nend", "def test_read\n LOGGER.log \"\\n ###################### \\n Test: ProxyFile.read \\n ######################\"\n\n ProxyFile.login 'Joe', 'puppies'\n file = ProxyFile.open 'lorem.html'\n content = file.read\n file.close\n assert_equal content, File.open('../File Server/Thor/1').read\n end", "def read(file_tmp_id)\n content = nil\n if !file_tmp_id.nil? && file_tmp_id != \"\" && file_tmp_id.to_i >= 0\n path = create_file_path(file_tmp_id)\n if File.exists? path\n content = IO.read(path)\n end\n end\n \n yield(self,content)\n return content \n end", "def get_content(file_path)\n puts \"getting markdown for: #{file_path}.md\\n\\n\"\n file = File.open(\"data/pages/#{file_path}.md\", \"r\")\n return file.read\nend", "def get_file_content(dest)\n File.open(dest, \"r\").read\nend", "def read\n @epub.file.read(abs_filepath)\n end", "def read\n object.content\n end", "def read_text(filename); end", "def read_content_from_file(file_path)\n names = file_path.split('/')\n file_name = names.pop\n directory = self.mkdir(names.join('/'))\n directory.children[file_name].content\n end", "def file_get(id)\n response = get('FileService.getFile', id)\n end", "def readContents(filename)\r\n file = File.open(filename)\r\n contents = \"\"\r\n file.each { |line|\r\n contents << line\r\n }\r\n contents\r\nend", "def get_file(url)\n get(url).body\n end", "def read_file(file, context)\n File.read(file, file_read_opts(context))\n end", "def get_program_file_data(program_file)\n File.open(program_file,'rb'){|f| f.read}\nend", "def read_file(file_path)\n return nil unless File.exist?(file_path)\n\n buf = ''\n\n File.open(file_path, 'rb') do |f|\n buf = f.read\n end\n\n buf\n end", "def read_content(dir, magic_dir, matcher); end", "def read (filename, length, client)\n afile = File.new(filename.to_s, \"r\")\n if afile\n content = afile.sysread(length)\n puts content\n client.puts content\n else\n client.puts \"Unable to read file!\"\n end\nend", "def getFileContent(dir, file):Array\n arr = Array.new\n File.open(\"#{dir}/#{file}\", \"r\").each do |line|\n arr.push line\n end\n arr\n end", "def read_todos(filename)\n File.readlines(filename)\nend", "def read\n return unless ::File.exist?(@file)\n\n @data = Bencode.decode(::File.read(@file))\n end", "def read(name)\n File.open(path(name)) do |f|\n f.read\n end\n end", "def read_content(resource)\n case resource\n when '-'\n method(:read_stdin)\n when /\\A#{URI::DEFAULT_PARSER.make_regexp}\\z/\n method(:read_url)\n else\n method(:read_file)\n end.call(resource)\n end", "def read(filename)\n buffer = File.read filename if File.exist? filename\n end", "def read(filename)\n buffer = File.read filename if File.exist? filename\n end", "def read\n data = File.open(@filename, mode(\"r\")) do |f|\n f.flock File::LOCK_SH\n f.read\n end\n import(data)\n end", "def read(_file)\n fail \"Fetcher #{self} does not implement `read(...)`. This is required.\"\n end", "def read(nombre_archivo)\n\tif File.file?(nombre_archivo)\n\t\tf = File.open(\"#{nombre_archivo}\").each_line do |line|\n \tp line\n \tend\t\n\tend\nend", "def get_file_content(path:, environment:, &block)\n validate_path(path)\n\n headers = add_puppet_headers('Accept' => 'application/octet-stream')\n response = @client.get(\n with_base_url(\"/file_content#{path}\"),\n headers: headers,\n params: {\n environment: environment\n }\n ) do |res|\n if res.success?\n res.read_body(&block)\n end\n end\n\n process_response(response)\n\n response\n end", "def file(name)\n begin\n @name=name\n @content=get_rest(\"extra/#{@name}\")\n rescue Stingray::NotFoundError \n nil\n end\n end", "def file_content\n self.lines.join\n end", "def read_file(file_name)\n file = File.open(file_name, \"r\")\n data = file.read\n file.close\n return data\nend", "def contents\n\t\tfin = File.new(@filename,'r')\n\t\tc = fin.read\n\t\tfin.close\n\t\treturn c\n\tend", "def read\n if @draft_content\n @draft_content\n else\n file = @options['path']\n abort \"File #{file} not found.\" if !File.exist? file\n @draft_content = File.open(file).read\n end\n end", "def read_file\n @read_file ||= File.open(self.file)\n end" ]
[ "0.6942226", "0.6918413", "0.68825406", "0.6756848", "0.6721985", "0.66687095", "0.66477853", "0.66344404", "0.6601488", "0.6588402", "0.6564696", "0.6547748", "0.6547513", "0.65394527", "0.65264535", "0.6518738", "0.64775133", "0.64700466", "0.64466804", "0.6442191", "0.6431628", "0.6383982", "0.6376827", "0.6372867", "0.63704604", "0.6359668", "0.63440615", "0.63423485", "0.6341545", "0.6328283", "0.6328283", "0.63022417", "0.6286987", "0.627352", "0.62602603", "0.62539893", "0.6253856", "0.6237331", "0.623689", "0.6230886", "0.6213404", "0.6204931", "0.6195481", "0.61871755", "0.6187014", "0.61780614", "0.61780614", "0.6173703", "0.61363596", "0.6123069", "0.611711", "0.61096543", "0.6104714", "0.6104714", "0.6089434", "0.6089434", "0.6083033", "0.60602057", "0.6052547", "0.6045904", "0.60303116", "0.60182226", "0.6018143", "0.599636", "0.59929407", "0.5981962", "0.597647", "0.5974594", "0.59673035", "0.5963254", "0.59590626", "0.59580654", "0.5948172", "0.5947574", "0.59400344", "0.59281695", "0.5902263", "0.5900188", "0.58987635", "0.5896704", "0.5888936", "0.5873678", "0.58690476", "0.5852732", "0.58462495", "0.58336455", "0.5822563", "0.58203715", "0.5812907", "0.5812907", "0.5811789", "0.58049643", "0.5804729", "0.57999283", "0.57886696", "0.57856756", "0.57816005", "0.5768311", "0.5768051", "0.57678884" ]
0.6678593
5
Return size of file body
def size file.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def body_size\n request = $postgres.exec_prepared('wsfile_body_size', [self.id])\n request[0].map{|k,v| v.to_i || 0}.inject(:+)\n end", "def size\n file.content_length\n end", "def file_size\n stream.size\n end", "def size\n file.try(:size) || 0\n end", "def size\n @size ||= File.size(file)\n end", "def size\n return self.body_data.size\n end", "def size\n headers[\"content-length\"].to_i\n end", "def content_length\n stat.size\n end", "def file_size\n self.file_file_size\n end", "def size\n contents.size\n end", "def size\n headers[:content_length].to_i\n end", "def size\n content.size\n end", "def get_file_size\n file = Storage.get_file(ENV['AWS_S3_DIR_PAGES'], self.issue_id, self.filename )\n return file.content_length\n end", "def file_size; @io_size[@rio] end", "def size\n # return @file.size if @file.respond_to?(:size)\n File.size(self.path) rescue 0\n end", "def file_size\n @file_size ||= 0\n end", "def size\n read.bytesize\n end", "def getFileSize\r\n\t\t\t\t\treturn @fileSize\r\n\t\t\t\tend", "def size\n instance_read(:file_size) || (@queued_for_write[:original] && @queued_for_write[:original].size)\n end", "def size\n File.size(@filename)\n end", "def data_size\n File.size(file_path)\n end", "def data_size\n File.size(file_path)\n end", "def filesize; end", "def size_page_body\n size - size_fil_trailer - size_fil_header\n end", "def size\n @content.bytesize\n end", "def size\n @io.size\n end", "def size\n @contents.bytes.size\n end", "def size_in_bytes\n ( file_length * 16 ) / 8\n end", "def size\n File.size(self)\n end", "def size\n File.size(self)\n end", "def size\n File.size(self)\n end", "def size\n File.size(self)\n end", "def filesize\n @descriptive_detail.filesize\n end", "def size\n chunk_size = nil\n File.open(@file_name) do |file|\n file.seek(@offset + 4, IO::SEEK_CUR)\n case @size_length\n when 4\n chunk_size = file.read(@size_length).unpack('L').first\n when 2\n chunk_size = file.read(@size_length).unpack('S').first\n else\n raise \"Can't decode size field of length #{@size_length}\"\n end\n end\n chunk_size + @data_size_correction\n end", "def file_size\n # pretty value\n attachments.order(position: 'asc').first.file_size\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 0\n end", "def content_length\n if raw? && raw.respond_to?(:length)\n raw.length\n else\n read.try(&:length).to_i\n end\n end", "def size\n @files.size\n end", "def extract_size(io)\n io.size\n end", "def getFileSize()\n getRealFileSize(file) / MEGABYTE\n end", "def size; @_io.size; end", "def size\n @size = File.size(self.path) unless @size\n @size\n end", "def size\n File.new(self.server_path).size\n end", "def size\n File.size( fullpath )\n end", "def file_size\n if @filename\n File.size(filename)\n elsif file.respond_to?(:size)\n file.size\n # :nocov:\n else\n file.seek(0, IO::SEEK_END) && file.pos\n # :nocov:\n end\n end", "def edf_size\n File.size(@filename)\n end", "def content_length; end", "def content_length; end", "def content_length; end", "def filesize\r\n file_exists? ? File.size(full_path) : nil\r\n end", "def size\n ::File.size(@path)\n end", "def filesize\n File.size?(path)\n end", "def size\n @size ||= @request[FSIZE].to_i\n end", "def size\n File.size(path)\n end", "def size\n @content.size\n end", "def size\n @heads['content-length'] || @size.to_s\n end", "def get_file_size!(f)\n size = File.size?(f)\n #print(\"#{size},\")\n end", "def bytesize\n @fd.stat.size\n end", "def length\n return unless headers['Content-Length']\n\n headers['Content-Length'].to_i\n end", "def size\n @file_list.size\n end", "def content_length\n# stat.size\n @bson['length'] || 0\n end", "def size\n raise MissingFileMapping.new if mapping.blank?\n raise NodesMissing.new if mapping.nodes.blank?\n\n retrieve_meta!\n\n return self.meta['file_size'].to_i\n end", "def size\n if is_path?\n exists? ? File.size(path) : 0\n elsif @file.respond_to?(:size)\n @file.size\n elsif path\n exists? ? File.size(path) : 0\n else\n 0\n end\n end", "def length\n\t\treturn 0 if (!@fp)\n\t\tres=0\n\t\twhile (!@fp.eof)\n\t\t\tMarshal.load(@fp)\n\t\t\tres +=1\n\t\tend\n\t\treturn res\n\tend", "def original_file_size\n return @original_file_size\n end", "def uncompressed_size\n @header.size\n end", "def size\n if !@tmpfile.closed?\n @tmpfile.size # File#size calls rb_io_flush_raw()\n else\n File.size(@tmpfile.path)\n end\n end", "def file_size(file_name)\n size = File.size?(file_name)\n size = 0 if size.nil?\n LoggerHelper.print_to_log(\"Size of file '#{file_name}' is #{size}\")\n size\n end", "def get_content_length\n\t\treturn 0 if self.bodiless?\n\n\t\tif self.body.pos.nonzero? && !self.body.eof?\n\t\t\tself.log.info \"Calculating content length based on an offset of %d\" % [ self.body.pos ]\n\t\t\treturn self.body.size - self.body.pos\n\t\telse\n\t\t\tself.log.debug \"Calculating body size via %p\" % [ self.body.method(:size) ]\n\t\t\treturn self.body.size\n\t\tend\n\tend", "def size\r\n @contents.size\r\n end", "def size; file_log.size(file_rev); end", "def getcontentlength\n 0\n end", "def size(path)\n response = with_remote do |http|\n http.head(path)\n end\n response['Content-Length'].to_i\n end", "def read_size(uri)\n return File.size(get_file_uri_path(uri)) if is_file_uri(uri)\n \n require 'net/http'\n require 'uri'\n u = URI.parse(uri)\n http = connect_to(u.host, u.port)\n path = (u.path == \"\") ? \"/\" : u.path\n resp = http.head(path)\n fail RemoteSourceException, \"HTTP Response #{resp.code}\" if resp.code !~ /^2/\n resp['content-length'].to_i\n end", "def size\n data\n image.filesize\n end", "def get_size(path)\n read_size(@uri + path)\n end", "def size\n @size ||= @buffer.size\n end", "def length\n @content.length\n end", "def content_size; @message_impl.getContentSize; end", "def height\n file.height\n end", "def size\n (contents || '').length\n end", "def size_fil_header\n 4 + 4 + 4 + 4 + 8 + 2 + 8 + 4\n end", "def size_in_bytes\n files.inject(0) do |sum, f|\n path = File.join self.path, f\n sum + File.size(path)\n end\n end", "def size\n @data ? @data.size : header.sh_size\n end", "def size\n blob.size\n end", "def size\n reader.doccount\n end", "def body_count\n body.length\n end", "def size()\n @contents.size\n end", "def size\n raise NotImplementedError.new(\"size() must be implemented by subclasses of AbstractVersionedFile.\")\n end", "def length\n (headers[\"content-length\"] || -1).to_i\n end", "def length\n contents.length\n end", "def size\n @buffer.size\n end", "def size\n @buffer.size\n end", "def size\n @buffer.size\n end", "def size\n @data.bytesize\n end", "def test_size\r\n assert_respond_to(File, :size)\r\n assert_equal(17, File.size(@file))\r\n end", "def body_info\n if is_io?\n \"#{body.class.name}, size: #{body.respond_to?(:lstat) ? body.lstat.size : body.size}, pos: #{body.pos}\"\n else\n \"size: #{body.to_s.bytesize}, first #{BODY_BYTES_TO_LOG} bytes:\\n#{body.to_s[0...BODY_BYTES_TO_LOG]}\"\n end\n end", "def file_size\n number_to_human_size(super)\n end", "def get_size\n\t\tend", "def bytesize\n stream_size\n end", "def size\n @size ||= get_size(\"/yaml\")\n end" ]
[ "0.8270475", "0.81801385", "0.8065057", "0.7790245", "0.76991624", "0.7686959", "0.7622092", "0.7609221", "0.7600904", "0.7563286", "0.7554654", "0.75229394", "0.75200886", "0.7513806", "0.7499982", "0.7495545", "0.74775636", "0.7416581", "0.74047905", "0.7396711", "0.73924536", "0.73924536", "0.73910266", "0.7386775", "0.73844737", "0.7341932", "0.73243165", "0.72975755", "0.72946453", "0.72946453", "0.72946453", "0.72946453", "0.72870684", "0.72707915", "0.72707003", "0.72589046", "0.7238348", "0.7231031", "0.72294897", "0.72237206", "0.7211279", "0.7183976", "0.7180832", "0.71693933", "0.7112324", "0.71083736", "0.71083736", "0.71083736", "0.7107161", "0.7104057", "0.7103199", "0.7102433", "0.71000403", "0.708903", "0.7082485", "0.7007367", "0.7005587", "0.6994534", "0.69886625", "0.6984917", "0.69748026", "0.697312", "0.69661194", "0.69598955", "0.69459724", "0.69256604", "0.6925093", "0.6923928", "0.692016", "0.69128966", "0.69075924", "0.6895986", "0.6888937", "0.6888373", "0.6879292", "0.68686754", "0.6866507", "0.68531305", "0.6841163", "0.6832191", "0.682959", "0.6807949", "0.6795371", "0.6792561", "0.6770415", "0.6767277", "0.6762963", "0.6759864", "0.6732009", "0.67256624", "0.67135596", "0.67135596", "0.67135596", "0.67019814", "0.66936487", "0.66880035", "0.6687941", "0.6677063", "0.6652953", "0.6650289" ]
0.784759
3
Returns the url of the HES Cloud file
def url(options = {}) file.path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url\n expiration = Time.now + 60.seconds\n fog_file.url(expiration)\n end", "def url\n host = @uploader.ucloud_cdn_host || @uploader.ucloud_bucket_host\n return nil unless host\n [host, @path].join(\"/\")\n end", "def url\n File.join(\"https://#{service}.#{region}.amazonaws.com\", path)\n end", "def ext_url\n \"https://storage.googleapis.com#{ext_path}\"\n end", "def file_url\n end", "def url\n Djatoka.resolver.region(filename).scale(1800).url\n end", "def file_url\n resource.send(mount_point).url\n end", "def gs_url(filename)\n\t\tif self.has_file?(filename)\n\t\t\t\"gs://#{self.study.bucket_id}/#{filename}\"\n\t\tend\n\tend", "def url\n ::File.join \"/\", path.to_s\n end", "def gs_url(filename)\n if self.has_file?(filename)\n \"gs://#{self.study.bucket_id}/#{filename}\"\n end\n end", "def url_content\n\t file.url\n\tend", "def url\n # HACK: Revisit and make configurable separate from the connection options.\n \"http://#{@uploader.sftp_host}/#{path}\"\n end", "def external_download_url\n @file.external_bytestream_uri.to_s\n end", "def url\n return nil unless @uploader.upyun_bucket_host\n\n [@uploader.upyun_bucket_host, @path].join(\"/\")\n end", "def url\n File.join(server.url, path)\n end", "def file_url\n file.attached? ? url_for(file) : ''\n end", "def host()\n \"https://#{self.bucket}.commondatastorage.googleapis.com/\"\n end", "def url\n UploadUtils.get_url(\n FilestackConfig::CDN_URL, handle: handle, security: security\n )\n end", "def path\n file.url\n end", "def get_cloud_url\n @last_used_cloud_url\n end", "def url\n config.source_host_url\n end", "def url\n if @uploader.upyun_bucket_domain\n \"http://\" + @uploader.upyun_bucket_domain + '/' + @path\n else\n nil\n end\n end", "def host\n local_file? ? \"file://\" : split_url[1]\n end", "def url\n @url || File.join(host, \"v1\")\n end", "def url\n Blobs::URI.blob(container.name, name)\n end", "def web_url(filename, version=nil)\n fail NotImplementedError\n end", "def url\n @client.get_download_link(@path)\n end", "def download_url\n ActiveStorage::Current.host = Rails.application.routes.default_url_options[:host] if ActiveStorage::Current.host.blank?\n file.attached? ? file.blob.url : ''\n end", "def get_cloud_href\n @api_client.get_instance.links.detect { |link| link['rel'] == 'cloud' }['href']\n end", "def eshelf_url\n get_institution_or_default(:eshelf_url)\n end", "def url\n uri.to_s\n end", "def gs_url filename\n \"gs://#{storage_bucket_name}/#{filename}\"\nend", "def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end", "def url\n filepath.sub( %r{\\A#{Regexp.escape (Rails.root + \"public\").to_s}}, '').to_s\n end", "def url\n [\"http://\" + @uploader.couch_host + \":\" + @uploader.couch_port, model.database.name , model.id, @path].join(\"/\")\n end", "def url\n uri.to_s\n end", "def get_internal_file(url)\n return nil if url.match?(/^https?:/)\n\n url = url.sub(/\\?.*/, \"\")\n url = Addressable::URI.unencode(url)\n file = \"#{@site.path}#{url}\"\n file = File.join(file, \"index.html\") if Fs.directory?(file)\n Fs.file?(file) ? file : nil\n end", "def get_file(url); end", "def url\n if @attributes[:filename] =~ /^http:\\/\\//\n @attributes[:filename]\n elsif $cloudfront && $cloudfront[s3_bucket]\n \"#{$cloudfront[s3_bucket]}/#{s3_key}\"\n else\n \"http://#{s3_bucket}.s3.amazonaws.com/#{s3_key}\"\n end\n end", "def server_image_url(filename)\n uri = \"#{@api_url}/#{@project_id}/images/get_upload_url?filename=#{filename}&access_token=#{@access_token}\"\n get uri\n end", "def file_to_uri(file); end", "def file_to_uri(file); end", "def url\n easy = EasyFactory.new(self).get\n url = easy.url\n Typhoeus::Pool.release(easy)\n url\n end", "def get_internal_file(url)\n return nil if url.match?(/^https?:/)\n\n url = url.sub(/\\?.*/, \"\")\n url = URI.decode(url)\n file = \"#{@site.path}#{url}\"\n file = File.join(file, \"index.html\") if Fs.directory?(file)\n Fs.file?(file) ? file : nil\n end", "def url\n @url ||= s3_bucket.object(key_path).presigned_url(:get,\n expires_in: 7.days.to_i,\n response_content_disposition: ApplicationHelper.encoding_safe_content_disposition(\n ImageServiceHelper.download_name(@model.work_presenter, suffix: @suffix)\n )\n )\n end", "def url\n URI.parse(endpoint).join(path.to_s).to_s\n end", "def url; \"file:#{@root}\"; end", "def url\n ''\n end", "def url\n @url.to_s\n end", "def url\n @doc.url\n end", "def url\n uri\n end", "def url\n uri\n end", "def get_url(filename)\n return YAML.load_file(filename)['original-url']\nend", "def storage_file_host\n ENV[\"AZURE_STORAGE_FILE_HOST\"]\n end", "def source_uri\n URI.parse(url_for(@software))\n end", "def url\n ::URI.join(\"#{service.service_url}/\", ::URI.escape(url_chunk)).to_s\n end", "def raw_url(file_name)\n fail('Requires implementation')\n end", "def url\n URI.join(host, sitemaps_path.to_s, filename.to_s).to_s\n end", "def web_endpoint\n File.join(@web_endpoint, \"\")\n end", "def web_endpoint\n File.join(@web_endpoint, \"\")\n end", "def web_endpoint\n File.join(@web_endpoint, \"\")\n end", "def server_url\n url\n end", "def url\n raise\n end", "def url\n @url ||= GeoIQ.base_uri + \"#{path}.json\"\n end", "def url_of_file(filename)\n raw_file_url = 'https://raw.githubusercontent.com/david942j/one_gadget/@tag/@file'\n raw_file_url.sub('@tag', latest_tag).sub('@file', filename)\n end", "def auth_url\n CloudFiles.const_get(\"AUTH_#{self.auth_location.upcase}\")\n end", "def public_url(style = default_style)\n @fog.public_url(style)\n end", "def url\n @url\n end", "def url\n @url\n end", "def file_url(filename)\n raw_url = git_repository_url[0..-5]\n \"#{raw_url}/blob/#{git_commit_sha}/#{filename}\"\n end", "def url(**options)\n file&.url(**options)\n end", "def server_url\n @uri\n end", "def storage_url\n self.auth_response[:storage_url]\n end", "def url(options = {})\n if file.respond_to?(:url)\n tmp_url = file.method(:url).arity.zero? ? file.url : file.url(options)\n return tmp_url if tmp_url.present?\n end\n\n if file.respond_to?(:path)\n path = encode_path(file.path.sub(File.expand_path(root), ''))\n\n if (host = asset_host)\n if host.respond_to? :call\n \"#{host.call(file)}#{path}\"\n else\n \"#{host}#{path}\"\n end\n else\n (base_path || \"\") + path\n end\n end\n end", "def filename_to_url(filename)\n # Remove the cache path\n f = strip_prefix(filename, path)\n # Remove the leading . from the base filename\n f = strip_filename_prefix(f, '.')\n # Remove the leading / from the path\n f.slice!(0) if f.start_with?('/')\n # Return the full Aspire linked data URL\n ld_api.api_url(f)\n end", "def url\n [ Configuration.url, @path ].join\n end", "def url\n doomsday = Time.mktime(2038, 1, 18).to_i\n\n unless self.filename.nil?\n AWS::S3::S3Object.url_for(image_file_name, 'xposers_interieurs', :expires => doomsday)\n else\n names = image_file_name.split(\".\")\n extension = names.pop\n file = \"#{self.id}_#{names.join(\".\")}_normal.#{extension}\"\n AWS::S3::S3Object.url_for(file, 'xposers_interieurs', :expires => doomsday)\n end\n end", "def storage_path\n File.join(organization.storage_path, url_part)\n end", "def ext_url\n \"#{GOOGLEAPIS_URL}#{ext_path}\"\n end", "def upload_url\n _get(\"/files/upload_url\") { |json| json }\n end", "def path\n host.path\n end", "def get_upload_url\n # raise 'Login first!' unless @customer_login_id\n\n response = @savon.call :get_upload_url, \n message: { 'wsdl:sessionID' => @session_id }\n \n @upload_url = response.body[:get_upload_url_response][:get_upload_url_result] \n end", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def url(opts = {})\n if bucket.mode == :private\n bucket.private_get_url(@path, opts)\n else\n bucket.path_to_url(@path, opts)\n end\n end", "def url\n end", "def public_url(options = {})\n url = URI.parse(bucket.url(options))\n url.path += '/' unless url.path[-1] == '/'\n url.path += key.gsub(/[^\\/]+/) { |s| Seahorse::Util.uri_escape(s) }\n url.to_s\n end", "def image_url(ver)\n url_for_file_column(self, \"image\", ver)\n end", "def get_file_url(safebox_guid, document_guid, user_email)\n handle_error { sendsecure_connection.get(\"api/v2/safeboxes/#{safebox_guid}/documents/#{document_guid}/url.json\", user_email: user_email) }\n end", "def url\n base = [FilestackConfig::CDN_URL]\n if @transform_tasks.include? 'debug'\n @transform_tasks.delete('debug')\n base.push('debug')\n end\n base.push(@apikey) if @apikey && @external_url\n if @security\n policy = @security.policy\n signature = @security.signature\n security_string = \"security=policy:#{policy},signature:#{signature}\"\n base.push(security_string)\n end\n base += @transform_tasks\n base.push(@handle || @external_url)\n base.join('/')\n end", "def file_url(remote_path)\n get_adapter.file_url(remote_path)\n end", "def public_url(style = default_style)\n @alt_storage.public_url(style)\n end", "def url\n return @url unless @url.nil?\n @url = destination.sub(::Webby.site.output_dir, '')\n end", "def uri_host; end", "def asset_url(file)\n Assets.compute_path(file)\n end", "def url\n URI.parse(\"#{protocol}://#{host}:#{port}#{store_uri}\")\n end", "def gs_url\n \"gs://#{self.study.bucket_id}/#{self.bucket_location}\"\n end" ]
[ "0.712241", "0.70841485", "0.70060563", "0.687602", "0.6849365", "0.6796431", "0.67554015", "0.67363876", "0.67178905", "0.67024964", "0.6693854", "0.6636098", "0.6634491", "0.66317755", "0.6624361", "0.6621251", "0.65612906", "0.65604335", "0.65560824", "0.65089506", "0.64840496", "0.6458373", "0.643962", "0.639035", "0.6381093", "0.6361868", "0.63615465", "0.6361391", "0.63091314", "0.6286553", "0.62661827", "0.6264103", "0.6258379", "0.6256579", "0.6249041", "0.6246145", "0.6240923", "0.6239598", "0.6228357", "0.62215656", "0.6215745", "0.6215745", "0.6198778", "0.6197718", "0.61927", "0.61749893", "0.61734176", "0.6157577", "0.61562115", "0.61553836", "0.61528605", "0.61528605", "0.6150843", "0.61463743", "0.6141927", "0.6131664", "0.6118036", "0.61153626", "0.610517", "0.610517", "0.610517", "0.6094981", "0.6080527", "0.60791653", "0.60781896", "0.6072104", "0.6071356", "0.60711527", "0.60711527", "0.6068485", "0.60664177", "0.6055008", "0.6036327", "0.60321355", "0.6029116", "0.60120887", "0.60097283", "0.6002985", "0.59997606", "0.59986204", "0.59959334", "0.59704137", "0.59648126", "0.59648126", "0.59648126", "0.59648126", "0.59648126", "0.5958043", "0.595372", "0.59532523", "0.5948277", "0.5939791", "0.5939716", "0.59370154", "0.59332716", "0.5909471", "0.5909133", "0.5905938", "0.5905418", "0.5903861" ]
0.68323445
5
Returns the filename of the HES Cloud file
def filename(options = {}) if file_url = url(options) file_url.gsub(/.*\/(.*?$)/, '\1') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filename\n @file.basename.to_s\n end", "def filename\n @file\n end", "def filename\n unless @filename\n @filename = @path.basename.to_s\n end\n\n @filename\n end", "def filename\n @filename\n end", "def filename\n @filename\n end", "def filename\n @filename\n end", "def filename\n @metadata[:filename] || uri.path.split('/')[-1]\n end", "def file_name\n File.basename @path\n end", "def filename()\n #This is a stub, used for indexing\n end", "def filename\n return @file_object.io.path if @file_object.io.respond_to?(:path) && File.exist?(@file_object.io.path)\n end", "def filename\n unless @filename\n load_file_params\n end\n @filename\n end", "def file_name\n return @file_name\n end", "def file_name\n return @file_name\n end", "def file_name\n return unless @file\n\n @file.absolute_name\n end", "def file_name\n File.basename(file_path)\n end", "def filename\n return @filename if @filename\n name.downcase.gsub(/\\W/, '_').squeeze('_')\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 filename\n @data[:name]\n end", "def filename\n @filename ||= \"#{ @component.name }-#{(t=Time.now).to_i}-#{t.usec}.yaml\"\n end", "def filename\n return @filename unless @filename.nil?\n generate_file_name()\n @filename\n end", "def name\n filename\n end", "def name\n filename\n end", "def get_filename(file)\n File.basename(file)\n end", "def filename\n @filename = \"#{secure_token}_#{split_extension(original_filename)}.#{file.extension}\" if original_filename.present?\n end", "def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end", "def filename\n @filename ||= metadata.fetch('PA_MD_CUST_FILENAME', '').to_s\n end", "def get_filename (file)\n\t\tif file.is_a? File\n\t\t\tfile = file.path\n\t\tend\n\t\treturn file\n\tend", "def name() @filename end", "def full_filename(for_file)\n #[remote_process!, for_file].join(\".\")\n for_file\n end", "def file_name\n \"#{@file_name}.#{extension}\"\n end", "def full_filename\n File.join(path, self.disk_filename)\n end", "def filename\n return Pathname.new(@file_object.io.path) if @file_object.io.respond_to?(:path) && File.exist?(@file_object.io.path)\n end", "def filename\n return Pathname.new(@file_object.io.path) if @file_object.io.respond_to?(:path) && File.exist?(@file_object.io.path)\n end", "def filename\n File.basename(path)\n end", "def getFilename\r\n\t\t\t\t\treturn @filename\r\n\t\t\t\tend", "def filename\n if original_filename\n \"#{model.name.parameterize}-#{secure_token(8)}.#{file.extension}\"\n end\n end", "def filename\n if original_filename.present?\n \"#{model.story.slug}-#{secure_token}.#{file.extension}\"\n end\n end", "def filename\n get \"filename\"\n end", "def filename\n if original_filename\n uuid = UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, original_filename)\n extname = File.extname(original_filename)\n return \"#{uuid}#{extname}\"\n end\n end", "def filename\n \"#{secure_token(10)}.#{file.extension}\" if original_filename.present?\n end", "def filename\n @properties[:filename]\n end", "def filename\n File.join(%w{public finished-jobs},Digest::SHA1.hexdigest(url)+\".txt\")\n end", "def filename\n # byebug\n \"#{secure_token}.jpg\" if original_filename.present?\n end", "def file_name\n @file_name\n end", "def filename\n self._filename\n end", "def filename\n File.basename( fullpath )\n end", "def filename\n return Pathname.new(file_object.io.path) if file_object.io.respond_to?(:path) && File.exist?(file_object.io.path)\n end", "def filename\n return Pathname.new(file_object.io.path) if file_object.io.respond_to?(:path) && File.exist?(file_object.io.path)\n end", "def filename\n return Pathname.new(file_object.io.path) if file_object.io.respond_to?(:path) && File.exist?(file_object.io.path)\n end", "def file_name\n \"#{Time.current.to_i}-#{@file.original_filename}\"\n end", "def filename\n original_filename\n end", "def filename\n \"#{secure_token}.#{file.extension}\" if original_filename\n end", "def ext_path\n \"/#{@file.bucket}/#{@file.name}\"\n end", "def full_filename (for_file = model.document.file)\n for_file\n end", "def file_name\n name.underscore\n end", "def file_name\n @file_name ||= stream.file_name\n end", "def filename\n return @filename if @filename\n\n # Pre-conditions\n raise ArgumentError.new(\"No document root set\") if @path_is_absolute && @document_root.nil?\n raise ArgumentError.new(\"No hosts served from document root\") if @path_has_host && @hosts.empty?\n\n path = strip_host(@path)\n raise ArgumentError.new(\"No matching host found for #{@path}\") if path =~ @@scheme_pattern\n\n dir = @path_is_absolute ? document_root : base\n @filename = File.expand_path(File.join(dir, path))\n end", "def file name\n \n end", "def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end", "def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end", "def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end", "def filename\n @data[10..-1]\n end", "def filename\n \"#{original_filename}+#{secure_token}.#{file.extension}\" if original_filename.present?\n end", "def access_file_name\n end", "def original_filename\n File.basename(@file_path)\n end", "def filename\n @parts[-1]\n end", "def filename\n return unless url\n\n ::File.basename(url.split(\"?\").first)\n end", "def filename\n return _meta_data['filename'] if _meta_data.has_key? 'filename'\n name\n end", "def public_filename(record, file)\n filename = [application_for_offering.id.to_s] \n filename << application_for_offering.person.fullname\n filename << title\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n filename.join(' ').gsub(/[^a-z0-9 \\(\\)]+/i,'') + \".#{ext}\"\n end", "def filename\n [Digest::SHA1.hexdigest(file.read),file.extension].join('.') if original_filename\n end", "def filename\n return unless original_filename\n\n extension = File.extname(original_filename)\n name = File.basename(original_filename, extension)\n\n \"#{Time.current.to_i.to_s}-#{name.parameterize}#{extension}\"\n end", "def filename\n @original_filename\n end", "def filename\n @name ||= \"#{md5}.#{file.extension}\" if original_filename.present?\n end", "def file_name\n # file = full_name\n # file = file.gsub('::', '/')\n # file = file.gsub('#' , '/')\n # file = file.gsub('.' , '-')\n # #file = File.join(output, file + '.html')\n # file\n WebRI.entry_to_path(full_name)\n end", "def filename(record, file)\n original = \"#{file.basename}.#{file.extension}\"\n write_attribute(:original_filename, original)\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n \"#{application_for_offering.id.to_s}-#{title.gsub(/[\\s,\\.\\\\\\/\\*\\?\\%\\:\\|\\\"\\'\\<\\>]?/,'')}.#{ext}\"\n end", "def filename\n path && File.basename(path)\n end", "def filename\n \"#{secure_token(10)+File.extname(original_filename)}\" if original_filename.present?\n end", "def original_filename\n metadata[\"filename\"]\n end", "def filename\n __advance!\n @_st_fileName\n end", "def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present? \n end", "def filename\n self.class.path(hash)\n end", "def filename\n return @filename if @filename\n\n if self.uri\n @filename = File.basename(self.uri.path)\n else\n regexps = PRECOMPILED_FILE_TYPES.map { |ext| \"\\.#{ext}\" }.join('|')\n\n @filename = File.basename(self.filepath).gsub(/#{regexps}/, '')\n end\n end", "def filename\n raise\n end", "def filename\n path.split(File::Separator).join(\"_\")\n end", "def filename\n return @filename if @filename\n is_directory = url.match /\\/\\z/\n if is_directory\n @filename = filename_for_directory\n else\n @filename = filename_for_file\n end\n @filename\n end", "def file_name\n @file_name ||= File.basename tree\n end", "def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end", "def storage_filename\n File.join(storage_path, @placeholder, @export_filename + @extension)\n end", "def filename\n @basename + PAGE_FILE_EXT\n end", "def filename\n @io.original_filename\n end", "def file\n @pathname.to_s\n end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end" ]
[ "0.7311467", "0.70024866", "0.6926199", "0.6891018", "0.6891018", "0.68831396", "0.68720573", "0.68610597", "0.68587834", "0.6847574", "0.6847548", "0.68457556", "0.68457556", "0.6841847", "0.6816037", "0.681349", "0.6808939", "0.6804824", "0.6804453", "0.6798572", "0.6797761", "0.6797761", "0.67890894", "0.6772174", "0.6769127", "0.6767927", "0.6741391", "0.67315876", "0.6718853", "0.6713404", "0.6707698", "0.6699105", "0.6699105", "0.6688415", "0.66851574", "0.6682337", "0.6676296", "0.666859", "0.66441816", "0.6642745", "0.6631938", "0.6626185", "0.66231346", "0.66224754", "0.6621157", "0.6618418", "0.66098714", "0.66098714", "0.66098714", "0.66080344", "0.6606542", "0.6602644", "0.6597991", "0.65945506", "0.65839237", "0.65711415", "0.6568894", "0.6555836", "0.65502405", "0.65502405", "0.65502405", "0.65465486", "0.65364945", "0.6531552", "0.65286785", "0.6520209", "0.64795023", "0.64760995", "0.64741313", "0.64720833", "0.6466903", "0.64536786", "0.6448488", "0.64423513", "0.64411736", "0.6438102", "0.64363545", "0.64342415", "0.64299697", "0.6424058", "0.6421719", "0.6406673", "0.6397576", "0.6382479", "0.63712955", "0.6369563", "0.6369015", "0.6367569", "0.6367062", "0.63642067", "0.6362255", "0.63601565", "0.63601565", "0.63601565", "0.63601565", "0.63601565", "0.63601565", "0.63601565", "0.63601565", "0.63601565", "0.63601565" ]
0.0
-1
Check if the file exists on the remote service
def exists? file.exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_file_exists?(aPath)\n\t\tremote_ruby(\"puts File.exists?('#{aPath}').to_s\")==\"true\\n\"\n\tend", "def remote_file_exists?(full_path)\n remote_filetest_passes?('-e', full_path)\n end", "def remote_file_exists?(url)\n url = URI.parse(url)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.request_uri).code == \"200\"\n end\n end", "def remote_file_exists?(url)\n url = URI.parse(url)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.request_uri).code == \"200\"\n end\nend", "def is_exist(remote_path)\n begin\n @sftp_session.stat!(remote_path) { |response|\n #returns whether exists or not\n next response.ok?\n }\n rescue => e\n return false\n end\n end", "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end", "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end", "def remote_file_exists?(full_path)\n capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip == 'true'\nend", "def file_exists?(path)\n parse_boolean(transport.execute(\"Test-Path #{escape(path)}\", :read_only => true).stdout)\n end", "def remote_file_exists? remote_path\n 'true' == capture(\"if [ -e #{remote_path} ]; then echo 'true'; fi\").strip\nend", "def remote_file_exists?(remote_file_name = nil,backup_options = nil,backup_name = nil)\n backup_options ||= @backup_options\n backup_name ||= @backup_name\n if remote_file_name\n remote_directory_name = File.dirname(remote_file_name)\n else \n backup_file_name = get_backup_file_name(backup_options)\n remote_directory_name = File.join(backup_options[:base_backup_directory],backup_name)\n remote_file_name = File.join(remote_directory_name,backup_file_name)\n end\n remote_bin_dir = backup_options[:bin_dir] ? \"#{backup_options[:bin_dir]}/\" : ''\n remote_cmd = \"#{remote_bin_dir}ubsafe_file_exists #{remote_file_name}\"\n cmd_status, cmd_output = ssh_cmd(remote_cmd)\n if cmd_status == :failure or cmd_output[0].chomp.strip == '1'\n return false\n end\n \n # remote_cmd = \"ls #{remote_directory_name}\"\n # #puts \"remote_file_exists? Looking for #{remote_directory_name}\"\n # cmd_status, cmd_output = ssh_cmd(remote_cmd)\n # if cmd_status == :failure or cmd_output.join(\"\\n\") =~ /no\\ssuch/i\n # #puts \"remote_file_exists? #{remote_directory_name} does not exist\"\n # return false\n # else\n # remote_cmd = \"ls #{remote_file_name}\"\n # #puts \"remote_file_exists? Looking for #{remote_file_name}\"\n # cmd_status, cmd_output = ssh_cmd(remote_cmd)\n # #puts \"remote_file_exists? cmd_status #{cmd_status}\"\n # if cmd_status == :failure or cmd_output.join(\"\\n\") =~ /no\\ssuch/i\n # #puts \"remote_file_exists? #{remote_file_name} does not exist\"\n # return false\n # end\n # end\n \n return true\n end", "def file_exist?\n return FileTest.exist?(@fileurl)\n end", "def file_exist?(filename)\n if __transport_connection\n __transport_connection.file(filename).exist?\n else\n File.exist?(filename)\n end\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 file_exists?(path)\n result = transport.execute(\"ls -d #{path}\", :read_only => true)\n result.exitstatus == 0 && result.stdout != ''\n end", "def file_exists?(path)\n result = transport.execute(\"ls -d #{path}\")\n result.exitstatus == 0 && result.stdout != ''\n end", "def test_file_exists?(host, file_rel_path)\n host.execute(\"test -f \\\"#{get_test_file_path(host, file_rel_path)}\\\"\",\n :acceptable_exit_codes => [0, 1]) do |result|\n return result.exit_code == 0\n end\nend", "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end", "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end", "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end", "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "def file_exists\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 file_exists?(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"test -f #{file}\", 'root', 500)\n code.zero?\nend", "def file_exists?(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"test -f #{file}\", 'root', 500)\n code.zero?\nend", "def file_exists? url\n if url.match(/^http/)\n localfile = remote_url_to_local url\n else\n localfile = url\n end\n remotefile = local_to_remote localfile\n begin\n localfile_size = File.size localfile\n remotefile_size = ftp.size remotefile\n # puts \"#{localfile}: #{localfile_size}\"\n # puts \"#{remotefile}: #{remotefile_size}\"\n if remotefile_size == localfile_size\n url\n else\n nil\n end\n rescue Exception=>ex\n # puts ex.message\n nil\n end\n end", "def check_exists\n raise GlusterFS::Error, \"File does not exist: #{@path}\" unless exists?\n end", "def file_exists?(key)\n result = http.head([200,404], luwak, escape(key))\n result[:code] == 200\n end", "def file_exists?(file)\n false\n end", "def check\n # PS: Api#checkfiles throws exception when file cannot be found\n response = @api.checkfiles(@url).first rescue {}\n\n if response[:file_status] == :ok\n @fileid = response[:file_id]\n @filename ||= response[:file_name]\n @filesize = response[:file_size].to_i\n @server_id = response[:server_id]\n @short_host = response[:short_host]\n\n @remote_filename = @filename\n @filename = @local_filename || @remote_filename\n true\n else\n # TODO report errors according to actual file status\n @error = 'File not found'\n false\n end\n end", "def remote_file?\n file? && @remote_file\n end", "def verify_remote_file(remotes:, file_location:)\n remotes.any? ? remotes.detect {|remote| remote.name == file_location} : ApplicationController.firecloud_client.execute_gcloud_method(:get_workspace_file, 0, self.bucket_id, file_location)\n end", "def has_file\n if id == nil \n false\n else\n FileTest.exists?( local_file_path )\n end\n end", "def check_file(file)\n begin\n file_read = File.open(file, 'r')\n rescue SystemCallError\n puts \"#{file} does not exist\"\n return false\n end\n file_read\n end", "def smb_file_exist?(file)\n begin\n fd = @smb.open(file, 'ro')\n rescue XCEPT::ErrorCode => e\n # If attempting to open the file results in a \"*_NOT_FOUND\" error,\n # then we can be sure the file is not there.\n #\n # Copy-pasted from smb/exceptions.rb to avoid the gymnastics\n # required to pull them out of a giant inverted hash\n #\n # 0xC0000034 => \"STATUS_OBJECT_NAME_NOT_FOUND\",\n # 0xC000003A => \"STATUS_OBJECT_PATH_NOT_FOUND\",\n # 0xC0000225 => \"STATUS_NOT_FOUND\",\n error_is_not_found = [ 0xC0000034, 0xC000003A, 0xC0000225 ].include?(e.error_code)\n # If the server returns some other error, then there was a\n # permissions problem or some other difficulty that we can't\n # really account for and hope the caller can deal with it.\n raise e unless error_is_not_found\n found = !error_is_not_found\n else\n # There was no exception, so we know the file is openable\n fd.close\n found = true\n end\n found\nend", "def sshd_service_exists?\n # FIXME: We should probably check exit status rather than AIX-specific error codes.\n output=ssh_command(\"#{config[:sudo]} #{config[:clogin]} #{config[:wpar_name]} #{config[:lssrc]} -s sshd\", :stderr)\n if output.include?('0513-085') # 0513-085 The sshd Subsystem is not on file.\n return false\n end\n true\n end", "def remote_symlink_exists?(full_path)\n remote_filetest_passes?('-L', full_path)\n end", "def local_file_exists?(full_path)\n File.exists?(full_path)\nend", "def file_exists?(path)\n end", "def exist?\n ::File.exist?(file_path)\n end", "def file_exists( sftp, file)\n files = get_dir_listing( sftp, File.dirname(file))\n files.include?( File.basename(file))\n end", "def exist; File.exist?(@fname); end", "def file_exists?(file)\n File.exists?(file)\n end", "def test_file_exists?(host, file_rel_path)\n file_exists?(host, get_test_file_path(host, file_rel_path))\nend", "def file_exists(file)\n File.exists?(file)\n end", "def exists?\n File.exists?(@resource[:name])\n end", "def exists?\n File.exist? file_path\n end", "def file_exist?(file_path)\n File.exist?(file_path)\n end", "def file_exists?\r\n File.file?(full_path)\r\n end", "def exists?\n File.exists? vmx_path\n end", "def file_exists?(name)\n\n #if file exists return true\n Chef::Log.debug \"DEBUG: Checking to see if the curent file: '#{ name }.conf' exists in pool directory #{ node[\"php_fpm\"][\"pools_path\"] }\"\n ::File.file?(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ name }.conf\")\n\nend", "def file_exists?(filename)\n shell_exec(\"test -f #{filename}\")\n rescue\n false\n else\n true\n end", "def file_location_exists\n if self.file_location.nil? || !File.exists?(self.file_location)\n errors.add(:file_location, \"doesn't exist on the server\")\n end\n end", "def copy_and_check(file, service)\n puts \"Checking #{file}\"\n\n temp_file = Tempfile.new(\"#{file}-temp\")\n\n scp(\"/etc/one/#{file}\", temp_file.path)\n\n if !FileUtils.compare_file(temp_file, \"/etc/one/#{file}\")\n FileUtils.cp(temp_file.path, \"/etc/one/#{file}\")\n\n puts \"#{file} has been replaced by #{@remote_server}:#{file}\"\n\n @opennebula_services[service] = true\n end\n ensure\n temp_file.unlink\n end", "def storage_exists?\n File.exists?(file_path)\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 file_exists?\n !!file_path\n end", "def file_exists?\n !!file_path\n end", "def exist?\n File.exist?(output)\n end", "def check_exists\n filename = params[\"file\"]\n if !valid_filename(filename, nil)\n Rails.logger.warn(\"check_exists: Invalid filename received (#{filename})\")\n render :json => {error: \"Invalid filename\"}, status: 400\n return\n end\n\n full_filename = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/\" + filename\n exist = File.exist?(full_filename)\n render :json => {exist: exist}\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 file_exists?(file)\n File.file? file\n end", "def remote_file_differs?(full_path, content)\n !remote_file_exists?(full_path) || remote_file_exists?(full_path) && !remote_file_content_same_as?(full_path, content)\n end", "def exist?(path)\n found = true\n run_via \"head -1 #{path} >/dev/null 2>&1 || echo $?\" do |channel, stream, data|\n if data =~ /^(\\d+)/\n if $1.to_i > 0\n logger.trace \"Not found\"\n found = false \n end\n end\n end\n found\n end", "def mmkv_file_exists(file)\n is_exist = false\n if File.methods.include?(:exists?)\n is_exist = File.exists? file\n else\n is_exist = File.exist? file\n end\n return is_exist\nend", "def remote_exists?\n system \"which cmus-remote &> /dev/null\"\nend", "def opx_file_exist?(file)\n File.exist?(file)\n rescue => e\n opx_err(\"Fatal failure of File.exist? for file: #{file}\", e)\n end", "def exists_file?(key)\n # sanitize the name\n key = safe_file_name(key)\n key = add_namespace(key)\n\n boolify(redis.exists?(key))\n end", "def path_exists?(path)\n ::File.exist?(::File.join(path, 'ts3server_startscript.sh'))\nend", "def fileExists?(filename)\n shell_exec(\"test -f #{filename}\") rescue return false\n true\n end", "def file_exists?\n File.exists?(@filename)\n end", "def exists?(remote_file, local_file = nil)\n if (file = find_by_path(remote_file)) == nil\n if local_file != nil\n if (file = find_by_md5(Digest::MD5.file(local_file).to_s)) != nil\n path = build_node_path(file)\n return {\n :success => true,\n :data => {\n \"message\" => \"File with same MD5 exists at #{path}: #{file.to_json}\",\n \"path_match\" => false,\n \"md5_match\" => true\n }\n }\n end\n end\n return {\n :success => false,\n :data => {\n \"message\" => \"File #{remote_file} does not exist\"\n }\n }\n end\n\n retval = {\n :success => true,\n :data => {\n \"message\" => \"File #{remote_file} exists\",\n \"path_match\" => true,\n \"md5_match\" => false,\n \"node\" => file\n }\n }\n\n if local_file != nil\n if file[\"contentProperties\"] != nil && file[\"contentProperties\"][\"md5\"] != nil\n if Digest::MD5.file(local_file).to_s != file[\"contentProperties\"][\"md5\"]\n retval[:data][\"message\"] = \"File #{remote_file} exists but checksum doesn't match\"\n else\n retval[:data][\"message\"] = \"File #{remote_file} exists and is identical\"\n retval[:data][\"md5_match\"] = true\n end\n else\n retval[:data][\"message\"] = \"File #{remote_file} exists, but no checksum is available\"\n end\n end\n\n retval\n end", "def vip_installed?\n ssh.directory_exists?(vip_path)\n end", "def file_exists?(path)\n run(\"test -f #{path}\").success?\n end", "def exists?\n FileTest.exists?(@file)\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 exists?(id)\n Net::SFTP.start(@host, @user, @password) do |sftp|\n sftp.stat!(url(id))\n end\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 user_file_exist?(file)\n File.exist? user_file_path(file)\n end", "def check_file_exist(path)\n raise \"Cannot find: #{path}\" unless File.exist?(path)\n end", "def document_exists?(file_path, site_path=nil)\n file = split_path(file_path)\n sanitized_filename = sanitize_filename(file[:name])\n server_relative_url = \"#{site_path}#{file[:path]}/#{sanitized_filename}\"\n url = computed_web_api_url(site_path)\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape \"#{url}GetFileByServerRelativeUrl('#{odata_escape_single_quote server_relative_url}')\"\n ethon.perform\n exists = false\n if ethon.response_code.eql? 200\n json_response = JSON.parse(ethon.response_body)\n if json_response['d'] &&\n json_response['d']['ServerRelativeUrl'].eql?(server_relative_url)\n exists = true\n end\n end\n return exists\n end", "def file_exist?(path)\n exist?(path) && is_file?(path)\n end", "def exists?\n Puppet.debug \"check if installed: #{@resource[:path]}\"\n return false if self.to_bool(@resource[:replace]) && @resource[:ensure] != :absent\n if File.exists?(@resource[:path])\n return true if @resource[:md5] == nil\n Puppet.debug \"checking against md5 #{@resource[:md5]}\"\n path_md5 = self.getfile_md5(@resource[:path])\n Puppet.debug \"md5 for installed file is #{path_md5}\"\n return true if @resource[:md5] == path_md5\n end \n Puppet.debug \"file not installed #{@resource[:path]}\"\n return false\n end", "def resource_exists?(relative_path)\n rest.get(relative_path)\n true\n rescue Net::HTTPClientException => e\n raise unless e.response.code == \"404\"\n\n false\n end", "def exists?\n File.exists? path\n end", "def exist?\n filepath.file? and filepath.readable?\n end", "def exist?\n File.exist?(@path)\n end", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def link_exists_on(host, link_path)\n # Links are weird on windows, fall back to seeing if the file exists\n return file_exists_on(host, link_path) if host[:platform].include?('windows')\n\n return on(host, Command.new(%(test -L \"#{link_path}\"), accept_all_exit_codes: true)).exit_code.zero?\n end", "def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end", "def exists?\n File.exists?(path)\n end", "def exists?\n File.exists?(path)\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 check_file(local_file)\n # Immateriel.info binding, @url\n uniq_str = Digest::MD5.hexdigest(\"#{@url}:#{local_file}\")\n uri = URI.parse(@url)\n fn = \"/tmp/#{uniq_str}_\" + Digest::MD5.hexdigest(File.basename(uri.path)) + File.extname(uri.path)\n self.class.download(@url, fn)\n if File.exist?(fn)\n check_result = self.class.check_image(fn, local_file, uniq_str)\n FileUtils.rm_f(fn)\n if check_result\n true\n else\n false\n end\n else\n false\n end\n end" ]
[ "0.82512003", "0.81856614", "0.7972522", "0.7827835", "0.76086557", "0.7567244", "0.7542273", "0.75172436", "0.7482934", "0.7464115", "0.7442973", "0.7374424", "0.73136747", "0.72920734", "0.7268947", "0.72373176", "0.722994", "0.71856153", "0.71856153", "0.71856153", "0.7162315", "0.712011", "0.712011", "0.712011", "0.712011", "0.7114171", "0.7107864", "0.70892763", "0.70892763", "0.70611525", "0.70569927", "0.7024895", "0.7017061", "0.700676", "0.69433284", "0.6925024", "0.68869114", "0.6856692", "0.68289155", "0.6827483", "0.68220323", "0.6810179", "0.6808661", "0.6805249", "0.67643666", "0.6758608", "0.6751168", "0.67259854", "0.6719404", "0.6701568", "0.66954863", "0.6683818", "0.6638484", "0.6631421", "0.6612837", "0.659529", "0.6588105", "0.65879446", "0.65871304", "0.6583111", "0.6566914", "0.65657926", "0.6559462", "0.65564924", "0.6555584", "0.6545164", "0.65423405", "0.653965", "0.652833", "0.65160066", "0.65152997", "0.6513012", "0.6504574", "0.6500338", "0.64973736", "0.6494372", "0.64919895", "0.64896524", "0.6488424", "0.6479189", "0.6449523", "0.6437075", "0.6437075", "0.64351606", "0.6430991", "0.64183867", "0.6400168", "0.6384114", "0.6383397", "0.6364636", "0.6364557", "0.63551104", "0.6350817", "0.6350817", "0.6345649", "0.6340553", "0.63347006", "0.6327744", "0.6326204", "0.63133985" ]
0.67577136
46
Write file to HES Cloud service
def store(new_file) @file = HesCloudStorage::HesCloudFile.new(new_file.to_file, :folder_path => @uploader.store_dir == "uploads" ? nil : @uploader.store_dir, :parent_model => @uploader.model.class) @file.save @path = @file.path true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_host_file\n puts \"Writing Apocalypse host file...\"\n host_config = {\n :hostname => @hostname,\n :server_address => @address, \n :port => @port, \n :username => @username, \n :password => @password\n }\n file = File.open(::Apocalypse::Client.host_file, \"w\") do |f|\n f.write host_config.to_yaml\n end \n end", "def write_file filename,content\n mkdir_p(File.dirname(filename),:verbose=>false)\n File.open(filename, 'wb') {|f| f.write(content) }\n end", "def write_file(file_name)\n File.open(file_name, 'w') { |f| f.write header_build }\n File.write(file_name, @content, mode: 'a')\nend", "def write_file!\n file = File.new( path, \"w\")\n \n file.write(@source)\n file.close\n end", "def write_file filename, content\n path = @output_directory + filename\n File.open(path, 'w') {|f| f.write content }\n end", "def write_file(path)\n File.open(path, 'w') {|f| write_io(f)}\n end", "def write_file(path, contents)\n file = @sftp.file\n file.open(path.to_s, 'w') do |file|\n file.puts contents.force_encoding('binary')\n end\n end", "def write_file(filename, content)\n FileUtils.mkdir_p File.dirname(filename)\n IO.binwrite(filename, content)\n end", "def write_file_at(file, content)\n\t\tFileUtils.mkdir_p(File.dirname(file))\n\t\tFile.open(file, 'w') do |file|\n\t\t\tfile.write(content)\n\t\tend\n\tend", "def write_to_external_datastore file, file_name\n external_file_path = File.join external_file_dirname, file_name\n\n if file.respond_to? :read\n File.open(external_file_path, \"wb\") do |f|\n f.write(file.read(CHUNK)) until file.eof?\n file.rewind\n end\n elsif File.exists? file # raises TypeError\n FileUtils.mv file, external_file_path\n else\n raise ArgumentError, \"File not found: #{file.inspect}\"\n end\n\n external_file_uri external_file_path\n end", "def write(path, file)\n bucket.objects[path].write(:file => file, :acl => :public_read)\n end", "def write(s)\n @file.write(s)\n end", "def write_file\n if @upload_file\n File.makedirs(\"#{full_path}\")\n File.open(file_path, 'wb') do |f|\n f.write(@upload_file.read) \n end\n end\n end", "def write_file(file, data)\n File.open(file, 'w') { |fd| fd.write(data) }\n end", "def write_content_to_file(file_name, content)\n File.open(file_name, 'w') { |file| file.write(content); file.flush }\nend", "def write(data=nil,headers={})\n #raise SyntaxException, \"No data was provided for object '#{@name}'\" if (data.nil?)\n # Try to get the content type\n raise SyntaxException, \"No data or header updates supplied\" if (data.nil? and headers.empty?)\n if headers['Content-Type'].nil?\n type = MIME::Types.type_for(self.name).first.to_s\n if type.empty?\n headers['Content-Type'] = \"application/octet-stream\"\n else\n headers['Content-Type'] = type\n end\n end\n response = self.container.connection.cfreq(\"PUT\",@storagehost,\"#{@storagepath}\",headers,data)\n raise InvalidResponseException, \"Invalid content-length header sent\" if (response.code == \"412\")\n raise MisMatchedChecksumException, \"Mismatched etag\" if (response.code == \"422\")\n raise InvalidResponseException, \"Invalid response code #{response.code}\" unless (response.code == \"201\")\n make_path(File.dirname(self.name)) if @make_path == true\n self.populate\n true\n end", "def write(file,content,timestamp=nil)\n\n f = File.join(path(:destination),file)\n log(\"writing '#{f}'\")\n\n # write the file \n File.open(f, 'w') {|f| f.write(content) }\n\n # Time-stamp the file if required\n File.utime(Time.now,timestamp,f) unless timestamp.nil?\n\n end", "def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end", "def write(filename, message, client)\n afile = File.new(filename, \"r+\")\n if afile\n afile.syswrite(message)\n client.puts(\"Changes made to \"+ filename)\n else\n client.puts \"Unable to write to file!\"\n end\nend", "def save_file\n File.open(full_file_path, 'wb') { |file| file.write @file.read } unless @file.nil?\n rescue\n uploading_error\n end", "def write_file(filename, data)\n f = File.open(filename, 'w')\n f.write(data)\n f.close\nend", "def write_to_file(payload, stack)\n raise NotImplementedError\n if config[:path]\n full_path = File.join(\n config[:path],\n export_file_name(stack)\n )\n _, bucket, path = full_path.split(\"/\", 3)\n directory = provider.service_for(:storage,\n :provider => :local,\n :local_root => \"/\").directories.get(bucket)\n file_store(payload, path, directory)\n end\n end", "def file_write(file, content)\n \n instructions = \"echo #{content.inspect} >> #{file}\"\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n \n @results[:file_write] = r\n\n end", "def store!(file_path)\n\n filename = File.basename(file_path)\n file = File.open(file_path, 'r')\n\n object_name = \"#{Date.today.strftime('%Y-%m-%d')}_#{filename}\"\n object = container.create_object(object_name)\n object.write(file)\n\n file.close\n\n puts \" -> Stored #{file_path} as #{object_name}\"\n\n end", "def write_file(filename)\n File.open(filename, \"w\") do |f|\n self.write(f)\n end\n end", "def write_file(data, name)\n raise WebthumbException.new('No data given') if data == nil || data.size == 0\n File.open(name, 'wb+') do |file|\n file.write(data)\n file.close\n file\n end\n end", "def write_file(content, path)\n File.delete path if File.exists? path\n\n file = File.new path, 'w+'\n file.write content\n\n file.close\n end", "def write\n File.open(path, 'w') { |file|\n file.write(FILE_HEADER + \"\\n\")\n file.write(encoded_body)\n }\n end", "def write\n File.open(@file, 'a') do |w| \n w.write(\"\\n\"+ @name + \" \" + @path)\n end\n end", "def create_hl7_file_at(filepath, type)\n File.write(filepath, transmission.payload)\n log_file_sent(filepath, type)\n end", "def write( filename, contents )\n if File.exists? filename\n puts \"#{filename} already exists\"\n else\n puts \"Creating #{filename}\"\n ::File.open( filename, \"w\" ){ |f| f.write contents }\n end\nend", "def write_to_file(file_name, data)\n key_path = ::File.dirname(file_name)\n ::FileUtils.mkdir_p(key_path) unless ::File.directory?(key_path)\n ::File.rename(file_name, \"#{file_name}.#{Time.now.to_i}\") if ::File.exist?(file_name)\n ::File.open(file_name, \"wb\", 0o600) { |file| file.write(data) }\n end", "def write_file(path, content)\r\n f = File.new(path, \"w+\")\r\n f.puts content\r\n f.close\r\n end", "def write(data)\n File.open(@filename, mode(\"w\")) do |f|\n f.flock File::LOCK_EX\n f << export(data)\n end\n end", "def create_secrete_file()\n\n payload = {\n \"admin_user\" => {\n \"username\" => @solr_admin_user,\n \"password\" => @solr_admin_password,\n },\n #TODO should the key be \"app_user\"\n @solr_app_user => {\n \"username\" => @solr_app_user,\n \"password\" => @solr_password\n }\n }\n\n # open and write to a file with ruby\n\n FileUtils.mkdir_p(@@secrete_dir, :mode => 0700)\n FileUtils.chown('app', 'app', @@secrete_dir)\n\n file_name = \"#{@@secrete_dir}/#{@@secrete_file_name}\"\n\n puts \"Creating the Solr secrete file: #{file_name}\"\n\n open(\"#{file_name}\", 'w') { |f|\n f.puts(payload.to_json)\n }\n\n FileUtils.chown('app', 'app', \"#{file_name}\")\n\n end", "def store(file)\n sharefile_file = file.to_file\n @content_type ||= file.content_type\n root_folder = @config[:sharefile_root]\n @file = @client.store_document(root_folder, @path, sharefile_file)\n end", "def put(local_file, to_location, overwrite = true, close_file = true)\n local_file = File.open(File.expand_path(local_file), \"rb\") unless local_file.respond_to?(:read) # check if it's a File object\n result = @client.put_file(to_location, local_file, overwrite)\n local_file.close if close_file\n result\n rescue\n puts $! if @@verbose\n nil\n end", "def write_file(filename,data_write)\n begin\n data = data_write\n aFile = File.new(filename, \"w+\") \n if aFile\n aFile.syswrite(data)\n else\n raise \"Unable to open file!\"\n end \n rescue Exception => e\n puts e.message\n end \n end", "def writenc(path, file)\n bucket\n @@mutex.synchronize do\n path = find_available_name(path)\n bucket.objects[path].write(:file => file, :acl => :public_read)\n end\n path\n end", "def create_file\n\n conditionCode = 0\n\n # Verify if we have a metadata\n if haspdumetadata? && haspdueof?\n\n # Write file\n writeLog(\"Checking to write file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Checking to write file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n\n begin\n\n Utils_visiona.writeFile(@pdus[\"METADATA\"].pduPayload.destinationFileName, @pdus[\"FILEDATA\"].dup)\n\n if File.size(@pdus[\"METADATA\"].pduPayload.destinationFileName) != @pdus[\"EOF\"].pduPayload.fileSize\n\n conditionCode = 6\n File.delete(@pdus[\"METADATA\"].pduPayload.destinationFileName) unless SAVE_FILE_UPON_ERROR\n elsif Utils_visiona.calculateFileChecksum(@pdus[\"METADATA\"].pduPayload.destinationFileName) != @pdus[\"EOF\"].pduPayload.fileChecksum\n\n conditionCode = 5\n File.delete(@pdus[\"METADATA\"].pduPayload.destinationFileName) unless SAVE_FILE_UPON_ERROR\n end\n rescue Exception => err\n\n conditionCode = 4\n CFDP::CFDP_Indication(\"Error while creating file. Error is #{err}.\\n Backtrace: #{err.backtrace}\")\n end\n\n if (conditionCode==0)\n\n CFDP::HKPacket.instance.eng_totalfilesrcvd+=1\n writeLog(\"Done writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Done writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n elsif SAVE_FILE_UPON_ERROR\n\n CFDP::HKPacket.instance.eng_totalfilesrcvd+=1\n writeLog(\"Done writing file with error #{CFDP.conditionCodeToStr(conditionCode)} \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Done writing file with error #{CFDP.conditionCodeToStr(conditionCode)} \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n else\n\n CFDP::HKPacket.instance.updateVar(conditionCode)\n writeLog(\"Error #{CFDP.conditionCodeToStr(conditionCode)} in writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Error #{CFDP.conditionCodeToStr(conditionCode)} in writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n end\n\n return conditionCode\n end\n end", "def add_entry\n new_content = file_content MY_HOSTS_FILE\n open(HOSTS_FILE, 'a') do |f|\n f << \"\\n#{new_content}\\n\"\n end\nend", "def save_image(file)\n client = Appwrite::Client.new()\n\n client\n .set_endpoint(ENV['APPWRITE_ENDPOINT']) # Your API Endpoint\n .set_project(ENV['APPWRITE_FUNCTION_PROJECT_ID']) # Your project ID available by default\n .set_key(ENV['APPWRITE_API_KEY']) # Your secret API key\n\n storage = Appwrite::Storage.new(client)\n\n response = storage.create_file(file: Appwrite::File.new(file));\n\n puts response\nend", "def file_put_contents( filename, buffer, mode = 'w+' )\n return if downloaded?( filename, buffer )\n\n File.open( filename, mode ) do |f|\n f.write( buffer )\n f.close\n end\n end", "def save\n entries = []\n entries << '#'\n entries << '# This file is managed by Chef, using the hostsfile cookbook.'\n entries << '# Editing this file by hand is highly discouraged!'\n entries << '#'\n entries << '# Comments containing an @ sign should not be modified or else'\n entries << '# hostsfile will be unable to guarantee relative priority in'\n entries << '# future Chef runs!'\n entries << '#'\n entries << ''\n entries += unique_entries.map(&:to_line)\n entries << ''\n\n contents = entries.join(\"\\n\")\n contents_sha = Digest::SHA512.hexdigest(contents)\n\n # Only write out the file if the contents have changed...\n if contents_sha != current_sha\n ::File.open(hostsfile_path, 'w') do |f|\n f.write(contents)\n end\n end\n end", "def write_to_file(f)\n return f.write(self.buffer)\n end", "def write_content_to_file(file_path, content)\n File.open(file_path, 'w') do |f|\n f.write content\n end\n end", "def write_file(path, content)\n file_exists = File.exists?(path)\n if file_exists and not @force\n fail \"File #{path} already exists. Not overwritten. Use --force to overwrite\"\n end\n save_file(path,content)\n message = file_exists ? \"File #{path} overwriten with new content\" : \"File #{path} created\"\n Puppet.notice message\n end", "def write_feature_file(feature_file, feature_content)\n begin\n file = File.open(feature_file, 'w')\n file.write(feature_content)\n rescue IOError => e\n # some error occur, dir not writable etc.\n pp e\n ensure\n file.close unless file == nil\n end\n end", "def write_file(filename)\n data = convert_to_string\n file = File.open(filename, \"w\")\n file.write(data)\n file.close\n end", "def store_file(*args)\n data, content_type, filename = args.reverse\n if filename\n http.put(204, luwak, escape(filename), data, {\"Content-Type\" => content_type})\n filename\n else\n response = http.post(201, luwak, data, {\"Content-Type\" => content_type})\n response[:headers][\"location\"].first.split(\"/\").last\n end\n end", "def write_file(file_name_out, content_array)\n\n\toutput = File.new(file_name_out, 'w')\n\tcontent_array.each { |line| output.write line }\n\toutput.close\nend", "def store!(file)\n self.class.configure_qcloud_sdk(uploader)\n\n qcloud_file = File.new(file)\n qcloud_file.path = uploader.store_path(identifier)\n qcloud_file.store\n qcloud_file\n end", "def log_to_file(filepath, object)\n #puts \"log_to_file #{filepath}\"\n final_path = File.join($boxes_logs_dir, filepath)\n pn = Pathname.new(final_path).cleanpath\n FileUtils.mkdir_p(pn.dirname)\n File.write(File.join(final_path), object)\nend", "def write_file(file_name, data)\n if session.type == \"meterpreter\"\n fd = session.fs.file.new(file_name, \"wb\")\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(\"echo #{data} > \\\"#{file_name}\\\"\")\n else\n _write_file_unix_shell(file_name, data)\n end\n end\n true\n end", "def write(key, content)\n bucket.objects[key].write(content)\n end", "def save\n save_to_file(@output_file, @contents)\n end", "def write\n path = \"#{site.root}/_site/#{output_file}\"\n File.open(path, 'w') do |f|\n f.write(@output)\n end\n end", "def write_file(resp, path)\n FileUtils.mkdir_p File.dirname(path)\n File.open(path, 'wb') do |output|\n resp.read_body { |chunk| output << chunk }\n end\n true\n ensure\n # cleanup incomplete files, rescue perm errors etc, they're being\n # raised already.\n File.delete(path) rescue nil if $!\n end", "def write(new_contents)\n\t\tconnection.write_file(full_path, new_contents)\n\tend", "def write(new_contents)\n\t\tconnection.write_file(full_path, new_contents)\n\tend", "def to_file(file)\n Utils::write_file(file, to_s)\n end", "def _put(path, contents)\n forbidden unless is_allowed? path\n existed = File.file? path\n # ensure path exists, and write to file\n FileUtils.mkdir_p File.dirname(path)\n IO.write path, contents, :mode => 'wb+'\n existed ? ok : created\n rescue SystemCallError => e\n logger.error e.message\n conflict\n end", "def write file, text\n File.open file, \"w\" do |file|\n file.write text\n end\n end", "def write_to_blobs_file(raw, address)\n begin\n File.write(@blobs_file_name, raw, address)\n rescue IOError => e\n PEROBS.log.fatal \"Cannot write blobs file #{@blobs_file_name}: \" +\n e.message\n end\n end", "def write_content(file)\n (content = property(:content)) && content.write(file)\n end", "def to_file(file)\n Utils.write_file(file, to_s)\n end", "def write(filename, content)\n abort 'File name not found.' if filename.nil?\n path = filename\n\n unless output_path.nil?\n abort \"Invalid output directory: #{output_path}\" unless File.directory?(output_path)\n path = File.join(output_path, filename)\n end\n\n File.write(path, content)\n end", "def write(file)\n @file_written = file\n file = Pathname.new(file)\n file.dirname.mkpath\n file.open \"w+\" do |output|\n output << self.build!\n end\n self\n end", "def write_file(content, dir, file)\n filename = File.basename(file).gsub(/(\\.s?[ac]ss)+/, options[:extension])\n path = File.join(dir, filename)\n\n unless options[:noop]\n FileUtils.mkdir_p(dir)\n File.open(path, 'w') {|f| f.write(content) }\n end\n\n path\n end", "def write_to(filename)\n FileUtils.mkdir_p File.dirname(filename)\n\n PathUtils.atomic_write(filename) do |f|\n f.write source\n end\n\n nil\n end", "def write_file(file_name, content_array)\n\n\toutput = File.new(file_name, 'w')\n\tcontent_array.each { |line| output.write line }\n\toutput.close\nend", "def s_to_file file_path_str, new_content_str='' \n File.open(file_path_str, \"w+\") { |f| f.write(new_content_str) }\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 write_file(post_data)\n File.open(\"public/post_data.txt\",\"w\") do |f| # open the user.json file in the /public directory (create if not present)\n f.write(post_data) # add the hash to the JSON file and save it\n end\nend", "def save\n return if File.exists?(file)\n\n # Create parent directories\n FileUtils.mkdir_p(File.dirname(file))\n\n File.open(file, \"w\") do |f|\n f.write(compressed_contents)\n end\n\n puts \"Wrote blob #{file}\"\n end", "def write_file(full_path, contents)\n\t\t::File.open(full_path, 'w') do |f|\n\t\t\tf.write contents\n\t\tend\n\t\ttrue\n\tend", "def write_hosts_to_file\n File.open(SMOKE_HOSTS_FILE, 'w') do |f|\n f.write(self.hosts.join(','))\n end\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 write_file(content, destination, opts = {})\n require 'tmpdir'\n inventory_hash = inventory_hash_from_inventory_file\n target_node_name = ENV.fetch('TARGET_HOST', nil)\n target_option = opts['targets'] || opts[:targets]\n target_node_name = search_for_target(target_option, inventory_hash) unless target_option.nil?\n\n Tempfile.create('litmus') do |tmp_file|\n tmp_file.write(content)\n tmp_file.flush\n if target_node_name.nil? || target_node_name == 'localhost'\n require 'fileutils'\n # no need to transfer\n FileUtils.cp(tmp_file.path, destination)\n else\n # transfer to TARGET_HOST\n bolt_result = upload_file(tmp_file.path, destination, target_node_name, options: {}, config: nil, inventory: inventory_hash)\n raise bolt_result.first['value'].to_s unless bolt_result.first['status'] == 'success'\n end\n end\n\n true\n end", "def opx_file_open_write(file)\n File.open(file, \"w\")\n rescue => e\n opx_err(\"Fatal failure of File.open for writing: #{file}\", e)\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 write\n # File path\n fpath = filepathById params[:id]\n\n if nil == fpath\n # File description does not exists\n result = {status: 'error', message: 'Bad request'}\n status = 400\n else\n begin\n File.open(fpath, \"w\") do |f|\n f.write(params[:content])\n end\n result = {status: 'ok', file:fpath}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n end\n\n render json: result.to_json, status: status\n end", "def send_logs_to_s3\n File.open(log_file) do |file|\n s3.put_object(\n bucket: log_bucket,\n key: instance_id,\n body: file\n )\n end\n end", "def write_to_file(path)\n File.open(path, \"w\") do |f|\n f.print serialize\n end\n end", "def add_to_file entry, content\n path = repo_path.join entry\n File.write path, content, :mode => \"a\"\n end", "def file(file, contents)\n if File.exists?(file)\n log file, \"(already exists)\"\n else\n log file, \"(creating file)\"\n touch file\n File.open(file, \"w\"){ |f| f.write contents } if contents\n end\n end", "def write_exe(path, service_name=nil)\n vprint_status(\"[#{service_name}] Writing service executable to #{path}\")\n exe = generate_payload_exe_service({servicename: service_name, arch: get_payload_arch})\n write_file(path, exe)\n register_files_for_cleanup(path)\n end", "def save_as(file)\n File.open(file, \"wb\") { |f| f.write to_s }\n end", "def save_as(file)\n File.open(file, \"wb\") { |f| f.write to_s }\n end", "def store_file(uuid)\n Uploadcare::File.store(uuid)\n end", "def save_file_to_disk(new_content, filepath) \n File.open(filepath, 'w') { |f| f.write(new_content)}\n end", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def save!; File.write @path, @data end", "def save(content, path)\n if content !~ /<H2>Error 404<\\/H2>/\n File::open(path, 'w') {|f| f.write(fix_wsdl!(content))}\n end\nend", "def put_file(path, file, create_path = false)\n path = File.join('/', path)\n response = self.class.put(path, request_options.merge!(\n body_stream: file,\n headers: {\n 'Content-Length' => file.size.to_s\n }\n ))\n\n if response.code != 201 && response.code != 204\n notify_of_error(response, \"creating(putting) file. File path: #{path}\")\n end\n\n response.code\n end", "def write_file(*args)\n end", "def save\n pathname.open('w') { |file| file.write(data) }\n end", "def save\n ole = File.open(@file_name, 'w')\n ole << header\n ole << fat\n @storages.each { |s| ole << s.to_s }\n ole << Array.new((512-(ole.pos % 512)), 0).pack('c*')\n ole << mini_fat\n ole << mini_fat_stream\n ole << fat_stream\n ole.close\n end", "def write()\n f = File.open(\"#{@directory}/#{@filename}\", \"w\")\n f.write(@raw)\n f.close()\n end", "def writeFile( fileName, textToWrite)\r\nopen(fileName,'w').write(textToWrite)\r\nend", "def commit\n File.open(file_path, \"w\") do |f|\n f.write(to_json)\n end\n end" ]
[ "0.637532", "0.6284256", "0.62711525", "0.6216451", "0.6167251", "0.6134082", "0.6102896", "0.60947955", "0.60822815", "0.6080689", "0.6062848", "0.60550624", "0.6017146", "0.59939396", "0.59484094", "0.5936753", "0.592109", "0.59206164", "0.5919976", "0.591165", "0.59104013", "0.5897601", "0.58909076", "0.5888538", "0.58747846", "0.5867011", "0.5827543", "0.5816561", "0.58050543", "0.5804785", "0.5793651", "0.57839257", "0.5780611", "0.57788134", "0.5778086", "0.57742435", "0.57702", "0.57688636", "0.57640386", "0.5758865", "0.5746045", "0.5734416", "0.5725304", "0.5722438", "0.571967", "0.57159024", "0.57152075", "0.5712911", "0.57111186", "0.57086444", "0.57060397", "0.56968254", "0.56925505", "0.5682783", "0.56825393", "0.5665563", "0.5663869", "0.56632954", "0.5660423", "0.5660423", "0.56561226", "0.5656043", "0.5655785", "0.56544966", "0.5641211", "0.5637949", "0.5634495", "0.5629998", "0.5629805", "0.56280977", "0.56083214", "0.5605255", "0.5603008", "0.5602456", "0.5599713", "0.5595166", "0.55935585", "0.55865556", "0.5582988", "0.55703497", "0.55697036", "0.5569025", "0.5562683", "0.55615264", "0.55544376", "0.55533427", "0.5551465", "0.55480975", "0.55480975", "0.55398315", "0.553564", "0.55353886", "0.5526831", "0.5525698", "0.55244994", "0.5524005", "0.5521933", "0.55214304", "0.5521076", "0.55184484", "0.5516828" ]
0.0
-1
Remove the file from HES Cloud return [Boolean] true for success or raises error
def delete @file = nil # file.delete end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rm!( path )\r\n got = @ndev.rpc.file_delete( :path => path )\r\n return true if got.nil? # got no error\r\n # otherwise, there was an error, check output\r\n raise IOError, got.text\r\n end", "def delete\n begin\n uy_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end", "def delete_file\n return false if !@file\n FileUtils.rm @file if File.file? @file\n return true\n end", "def delete_file(f)\n #return false if !f.kind_of?(Fog::Storage::AWS::File) || !storage_provider.eql?(:aws)\n log \"Deleting: #{f.key}\"\n return f.destroy\n end", "def remove_file(file)\n begin\n @ftp.delete(file)\n return true\n rescue Exception => e\n error_message(e)\n return false\n end\n end", "def delete\n begin\n object = bucket.objects.find(@path)\n object.destroy\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end", "def remove_file\n return unless file_exists?\n\n s3_object(false).delete\n rescue => e\n Rails.logger.error \"Unable to delete file #{self.filename}: #{e.message}\"\n end", "def delete_file(filename)\n http.delete([204,404], luwak, escape(filename))\n true\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 b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend", "def remove_content\n File.unlink(filename) if File.exist?(filename)\n end", "def delete\n begin\n conn.delete(escaped_path)\n true\n rescue => e\n puts \"carrierwave-ucloud delete failed: #{e.inspect}\"\n nil\n end\n end", "def delete\n conn.delete(escaped_path)\n true\n rescue StandardError => e\n puts \"carrierwave-upyun delete failed: #{e.inspect}\"\n nil\n end", "def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end", "def remove(filename); end", "def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end", "def remove_from_disk\n File.delete @flv if @flv && (File.exist? @flv)\n File.delete @mp4 if @mp4 && (File.exist? @mp4)\n true\n rescue\n p 'Error while deleting files from disk!'\n false\n end", "def destroy_file\n FileUtils.rm(full_filename) if File.exists?(full_filename)\n end", "def destroy_file\n File.delete full_file_path\n rescue\n end", "def delete!\n return true unless File.exist?(path)\n FileUtils.rm(path)\n end", "def destroy\n file&.delete\n end", "def del\n File.delete(@file)\n end", "def remove_storage_file\n FileUtils.rm(file_path)\n end", "def delete\n ensure_connection!\n resp = connection.delete_file bucket, name\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end", "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def delete_remote\n policy = get_policy(\"remove\")\n signature = get_signature(policy)\n remote = url+\"?signature=\"+signature+\"&policy=\"+policy\n try = self.class.delete(remote)\n\n # If file not found in filepicker, destroy anyway, else only if success\n if try.not_found?\n true\n else\n try.success?\n end\n end", "def remove_if_present(filename)\n begin\n File.unlink(filename)\n rescue Errno::ENOENT\n return false\n end\n return true\n end", "def remove_file(file)\n File.delete(file) if File.exist?(file)\nend", "def destroy\n @file_version.destroy\n head :no_content\n end", "def delete!\n exist!\n File.unlink @path\n @path = nil\n end", "def delete(filename); end", "def delete_pem(path)\n Puppet::FileSystem.unlink(path)\n true\n rescue Errno::ENOENT\n false\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\n File.delete(file_name)\n rescue\n # ignore\n end", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def remove_challenge(challenge)\n check_connection!\n @logger.debug(\"Removing challenge file at #{challenge} on server=#{self.name}\")\n retval = @ssh.exec!(\"test -f '#{challenge}' && rm -f '#{challenge}' && echo -n success\").chomp\n if retval != \"success\"\n return false\n end\n return true\n end", "def remove_file(file_id)\n\t\t@client ||= api_client()\n\n\t\tif file_id.nil?\n\t\t\tRails.logger.info(\"File id is nil. WTF man?\")\n\t\t\treturn false\n\t\tend\n\n\t \tresult = @client.execute(\n\t \t:api_method => @drive.files.delete,\n\t \t:parameters => { 'fileId' => file_id }\n \t)\n\n\t \tif result.status != 200 or result.status != 204\n\t \tRails.logger.info(\"An error occurred: #{result.inspect}\")\n\t \treturn false\n\t \tend\n\n\t \treturn true\n\tend", "def remove_file!\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n self.file = nil\n self.send(:write_attribute, :file, nil)\n end\n end", "def remove!\n MiGA.DEBUG \"Metadata.remove! #{path}\"\n File.unlink(path)\n nil\n end", "def destroy\n raise MissingFileMapping.new if mapping.blank?\n raise NodesMissing.new if mapping.nodes.blank?\n\n begin\n Uv::Storage::FileMapping.delete(self.mapping.id)\n self.connection.delete(mapping.nodes, mapping.file_path)\n\n return true\n rescue => e\n fatal \"There was an error deleting the file.\"\n fatal \"#{e}\"\n\n return false\n end\n end", "def deleteEssence\n \n begin\n \n # Gets @filename and @path\n getPathAndFilename \n name = @filename \n filepath = @path\n puts \"filepath: \" + filepath \n puts \"filename: \" + name\n \n # Find the device \n device = User.find_by_username(params[:username]).devices.find_by_dev_name(params[:devicename])\n \n # Essence can't be deleted from a virtual container\n if device.dev_type == \"virtual_container\"\n render :text => \"Error: Essence can't be deleted from a virtual container'\", :status => 409\n return \n end\n \n file = nil\n if device != nil\n file = device.devfiles.find(:first, :conditions => [\"name = ? and path = ?\", name, filepath])\n if file == nil\n puts \"FILE NOT FOUND: \" + name\n render :text => \"Error. File's metadata can not be found.\", :status => 404\n return\n end\n \n if params[:blob_hash]\n blob = file.blobs.find(:first, :conditions => [\"blob_hash = ?\", params[:blob_hash]])\n else\n blob = file.blobs.find_by_follower_id(nil)\n end\n end\n \n # Checks that the file's and it's version's metadata can be found in database.\n if file == nil or blob == nil\n puts \"Blob not found for file: \" + name\n render :text => \"Error. File's metadata can not be found.\", :status => 404\n return\n end\n \n if blob.uploaded == false\n render :text => \"Error: Essence of the file was not on the server.\", :status => 409\n return\n end\n \n # Remove the fileupload entry\n fup = Fileupload.find_by_blob_id(blob.id)\n if fup != nil\n fup.destroy\n end\n \n # Update blob not to be uploaded and upload_requested to nil\n blob.update_attribute(:uploaded, false)\n blob.update_attribute(:upload_requested, nil)\n \n \n # Remove the actual essence\n deletepath = \"public/devfiles/\" + file.device_id.to_s + \"/\" + blob.blob_hash + \"_\" + file.name\n \n if File.exists?(deletepath)\n FileUtils.rm_f(deletepath)\n puts \"deleted the essence...\"\n else\n puts \"Essence not found and could not be deleted...\"\n end\n \n rescue => exp\n putsE(exp)\n render :text => \"There was an error when trying to delete the essence from the server\", :status => 409\n return\n end\n \n render :text => \"Essence of the file deleted from the server\", :status => 200\n return\n end", "def file_exists(file_name)\r\n if File.exists?(file_name) \r\n File.delete(file_name)\r\n end\r\nend", "def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end", "def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end", "def deleteFile(file_path)\n puts \"Delete file: \" + file_path.to_s\n File.delete(file_path) if File.exist?(file_path)\nend", "def smb_file_rm(file)\n fd = smb_open(file, 'ro')\n fd.delete\nend", "def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end", "def remove file\n file.delete\n @files -= [file]\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def removed?\n !File.exist?(path)\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 remove_file_if_exists(file)\n File.delete file if File.exists? file\n end", "def delete\n unless FileDescriptor.exists?(filename: params[:fname])\n fpath = filePath params[:fname]\n begin\n File.delete fpath\n result = {status: 'ok'}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n else\n result = {status: 'error', message: 'File is open'}\n status = 403 # Forbidden\n end\n render json: result.to_json, status: status\n end", "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "def remove filename\n return false unless source_hash.key?(filename)\n source_hash.delete filename\n true\n end", "def remove_created_file(file_path)\n if file_path && File.exists?(file_path)\n File.delete(file_path)\n end\nend", "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 remove_created_file(file_path)\n File.delete(file_path) if file_path && File.exist?(file_path)\nend", "def delete(http_connection)\n success = true\n tries ||= 3\n display = []\n display.push file_path\n if File.exists?(self.file_path)\n begin\n request = Net::HTTP::Delete.new(api_url_for_delete)\n WebTranslateIt::Util.add_fields(request)\n display.push Util.handle_response(http_connection.request(request))\n puts ArrayUtil.to_columns(display)\n rescue Timeout::Error\n puts StringUtil.failure(\"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 rescue\n display.push StringUtil.failure(\"An error occured: #{$!}\")\n success = false\n end\n else\n puts StringUtil.failure(\"\\nMaster file #{self.file_path} doesn't exist locally!\")\n end\n return success\n end", "def drop\r\n\t\t\tif !@filename.nil?\r\n\t\t\t\tfilename=@filename\r\n\t\t\t\tself.close if !@fh.nil?\r\n\t\t\t\tif !FileUtils.rm(filename)\r\n\t\t\t\t\traise \"Error unlinking file #{filename}: $!\\n\"\r\n\t\t\t\t\treturn\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn true\r\n\t\tend", "def destroy\n @unuse_file.destroy\n respond_to do |format|\n format.html { redirect_to unuse_files_url, notice: 'Unuse file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_file\n begin\n File.delete(stored_file_path)\n rescue => e\n logger.error(\"Could not delete #{stored_file_path}. Ignored.\")\n logger.error(e)\n end\n end", "def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end", "def delete_file \n #pp \"deleting file_asset: path is\" + full_filepath\n File.delete(full_filepath) if File.exists?(full_filepath)\n end", "def destroy_file\n start_ssh do |ssh|\n ssh.exec!(\"rm #{e full_filename}\")\n dir = File.dirname(full_filename)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n dir = File.dirname(dir)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n end\n end", "def remove(filename)\n send_request(FXP_REMOVE, :string, filename)\n end", "def cmd_rm(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\"Usage: rm file\")\n\t\t\treturn true\n\t\tend\n\n\t\tclient.fs.file.rm(args[0])\n\n\t\treturn true\n\tend", "def delete\n ::File.unlink(@path)\n end", "def delete!\n safe_close\n File.delete(@file_path)\n end", "def delete_uploaded_file\r\n return unless file_exists?\r\n File.delete(full_path)\r\n remove_empty_directory\r\n @saved_full_path = nil\r\n end", "def deleteFile(path)\n File.delete(path) if File.exist?(path)\nend", "def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "def http_delete(_request, h_r, temp_location)\n return nil unless ::File.exist?(temp_location)\n\n ::File.unlink(temp_location)\n h_r.update_header('X-Sabre-Temp', 'true')\n h_r.status = 204\n false\n end", "def remove( *files, **options )\n\t\tself.server.run( :remove, *files, **options )\n\t\treturn true\n\tend", "def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend", "def remove(path)\n cleanup(path)\n new_client.remove(path)\n rescue\n false\n else\n true\n end", "def destroy_file\n FileUtils.rm full_filename\n # remove directory also if it is now empty\n Dir.rmdir(File.dirname(full_filename)) if (Dir.entries(File.dirname(full_filename))-['.','..']).empty?\n rescue\n logger.info \"Exception destroying #{full_filename.inspect}: [#{$!.class.name}] #{$1.to_s}\"\n logger.warn $!.backtrace.collect { |b| \" > #{b}\" }.join(\"\\n\")\n end", "def delete\n @lock.synchronize do\n ::File.unlink(@tmpfile) if ::File.exist?(@tmpfile)\n end\n end", "def delete_file(file_path)\n if Rails.env.production? && file_exists?(file_path)\n bucket.object(file_path).delete\n end\n end", "def destroy\n @upload_file_to_server.destroy\n respond_to do |format|\n format.html { redirect_to upload_file_to_servers_url, notice: 'Upload file to server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @user_file = UserFile.find(params[:id])\n authorize! :destroy, @user_file\n name=@user_file.uploaded_file_file_name\n @user_file.destroy\n\n respond_to do |format|\n format.html { redirect_to :back,:notice=>\"Deleted file: \"+name }\n format.json { head :ok }\n end\n end", "def destroy\n @grid_fs_file.destroy\n respond_to do |format|\n format.html { redirect_to grid_fs_files_url, notice: 'Grid fs file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove!\n messages = []\n transferred_files do |local_file, remote_file|\n messages << \"#{storage_name} started removing '#{ local_file }'.\"\n end\n Logger.message messages.join(\"\\n\")\n\n FileUtils.rm_r(remote_path)\n end", "def destroy\n @userfile.destroy\n\n fileName = Rails.root.join('public','uploads', @userfile.file_name_slug)\n File.delete(fileName) if File.exist?(fileName)\n\n respond_to do |format|\n format.html { redirect_to user_mycontact_meeting_userfiles_path }\n format.json { head :no_content }\n end\n end", "def rm\n FileUtils.rm path if File.exist?(path)\n end", "def destroy\n Rails.logger.debug {\"destroying gridfs file #{@id}\"}\n if persisted?\n Photo.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end\n end", "def destroy\n File.delete(get_file_path(@stocked_file))\n @stocked_file.destroy\n respond_to do |format|\n format.html { redirect_to stocked_files_url, notice: 'Stocked file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy!\r\n self.class.service_instance.delete_blob(path)\r\n end", "def delete_uploaded_file(new_file)\n if version_name.blank? && Refinery::PhotoGallery.delete_uploaded_file\n filename_to_delete = File.join(Rails.root.to_s,Refinery::PhotoGallery.photo_gallery_dir_relative_to_root, store_dir, filename )\n File.delete(filename_to_delete)\n end\n end", "def cleanup_tmp_file(file)\n\n image_path = \"./public/tmp/#{file}\"\n\n if File.exist?(image_path)\n File.delete(image_path)\n puts \"cleanup_tmp_file() - temp file deleted!\"\n else\n puts \"cleanup_tmp_file() - file does not exist!\"\n end\n\nend", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def delete_file(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n if self.class.curr_host == host\n begin\n File.delete(dst_path)\n rescue Errno::EISDIR\n FileUtils.rm_r(dst_path)\n rescue Errno::ENOENT\n end\n else\n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"rm -rf #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n \n cmd = \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"ls -la #{dst_path.shellescape}\\\"\"\n r = `#{cmd} 2>/dev/null`\n raise \"Path #{dst_path} not deleted\" unless r.empty?\n end\n end", "def destroy\n @file = UserUpload.find(params[:id])\n if @file\n \t@file.destroy\n end\n # Render nothing to denote success\n render :text => \"\" and return\n end", "def destroy\n run_callbacks :destroy do\n if directory?\n logger.info \"Delete directory at #{absolute_path}\"\n FileUtils.rmdir absolute_path\n else\n logger.info \"Delete file at #{absolute_path}\"\n # TODO if the file has added state (not committed), reset it to HEAD\n if status_file.untracked\n FileUtils.rm absolute_path\n else\n remove\n end\n end\n true\n end\n end", "def delete\n FileUtils.rm(self.path) if exists?\n end", "def remove(filename)\n not_implemented('remove')\n end", "def destroy\n @upload = @upload = Upload.find_by(id: params[:id], user_id: current_or_guest_user.id)\n @file = ActiveStorage::Attachment.find(params[:file])\n @file&.purge\n @upload.destroy unless @upload.files.present?\n flash[:success] = 'File Deleted Successful!'\n redirect_to root_path\n rescue StandardError => error\n flash[:danger] = 'File Does Not Exist!'\n flash[:error] = error.message\n redirect_to root_path\n end" ]
[ "0.7716231", "0.7504146", "0.74812394", "0.7218528", "0.71563137", "0.7110333", "0.7027781", "0.70242804", "0.70097935", "0.6966738", "0.69342357", "0.69336563", "0.69042295", "0.6900661", "0.68955016", "0.687362", "0.6871935", "0.68573064", "0.6854268", "0.68464446", "0.68426317", "0.6833909", "0.68254656", "0.68157095", "0.6795499", "0.6771716", "0.6764598", "0.67509156", "0.67250913", "0.6707824", "0.6704162", "0.6683986", "0.66812706", "0.66722846", "0.6667645", "0.6667645", "0.6658799", "0.6657294", "0.66454536", "0.66444993", "0.6617175", "0.6615914", "0.660561", "0.6601982", "0.6601982", "0.66004807", "0.65930796", "0.6585607", "0.65719134", "0.6551475", "0.6551475", "0.6547115", "0.6525947", "0.6517316", "0.6513587", "0.65133137", "0.65016204", "0.6490367", "0.64648944", "0.64580697", "0.64576375", "0.64576054", "0.645335", "0.6453219", "0.6451784", "0.64513206", "0.6441404", "0.64288443", "0.6424491", "0.6423945", "0.64187825", "0.64032364", "0.6402524", "0.6394635", "0.6393341", "0.6361509", "0.63545203", "0.6354136", "0.6353551", "0.6341434", "0.6339814", "0.63396364", "0.63320845", "0.63248545", "0.63148826", "0.63142645", "0.6313314", "0.6310864", "0.63063765", "0.6294644", "0.62836903", "0.6283267", "0.62772745", "0.6273936", "0.6273936", "0.62694305", "0.6249092", "0.62188655", "0.62182397", "0.6214292" ]
0.64833033
58
node itself isn't thread safe
def moved_node current_tree.find(node_2.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock; end", "def lock; end", "def lock; end", "def thread; end", "def thread; end", "def thread; end", "def executor; end", "def executor; end", "def executor; end", "def thread()\n #This is a stub, used for indexing\n end", "def lock!; end", "def refork; end", "def process_node(node)\n debug \"Process node: #{node}\"\n node.poll\n return unless node.online?\n ready_task = node.ready_task\n return unless ready_task\n ready_task.run\n end", "def mutex; end", "def mutex; end", "def mutex; end", "def mutex; end", "def io_lock; end", "def allow_concurrency; end", "def allow_concurrency; end", "def synchronized?; end", "def for_node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def in_parallel?; end", "def run(node)\n process(node)\n end", "def block_node; end", "def block_node; end", "def start host, port, port_to_contact, first_node\n folder = ARGV[0]\n # puts \"starting\", host, port, port_to_contact, first_node\n Thread.new {\n unless first_node\n puts \"not the first so joining using socket to connect\"\n s = TCPSocket.open(host, port)\n $node.join port_to_contact\n end\n while true\n sleep(2)\n $node.stabalize\n $node.fixRandomFinger\n $node.testing\n end\n }\n\n Thread.new {\n node_server = TCPServer.open(host, port)\n loop {\n Thread.start(node_server.accept) do |node_client|\n data = node_client.gets\n msg = {\"type\" => nil}\n msg = JSON.parse(data) if data\n\n if msg[\"type\"] == \"ping\"\n node_client.puts ({\"type\"=>\"pong\"}).to_json\n end\n if msg[\"type\"] == \"getNode\"\n node_client.puts ($node.node).to_json\n end\n if msg[\"type\"] == \"getPredecessor\"\n node_client.puts ($node.predecessor).to_json\n end\n if msg[\"type\"] == \"getSuccessorsTable\"\n node_client.puts ($node.successors).to_json\n end\n if msg[\"type\"] == \"findPredecessor\"\n pred_node = $node.findPredecessor msg[\"id\"]\n node_client.puts pred_node.to_json\n end\n if msg[\"type\"] == \"getSuccessor\"\n succ_node = $node.getSuccessor\n node_client.puts succ_node.to_json\n end\n if msg[\"type\"] == \"findSuccessor\"\n succ_node = $node.findSuccessor msg[\"id\"]\n node_client.puts succ_node.to_json\n end\n if msg[\"type\"] == \"notify\"\n $node.notify msg[\"node\"]\n reply = { \"type\"=> \"done\" }.to_json\n node_client.puts reply\n end\n if msg[\"type\"] == \"getPredecessor\"\n node_client.puts ($node.predecessor).to_json\n end\n if msg[\"type\"] == \"requestFile?\"\n file_name = msg[\"file_name\"]\n port = msg[\"port\"]\n reply = {\"file_exists\"=>nil}\n reply[\"file_exists\"] = ($node.requestFile? file_name, port) ? true : false\n node_client.puts reply.to_json\n end\n if msg[\"type\"] == \"sendingFile\"\n file = msg[\"file\"] \n f_name = \"files/\" + folder + \"/\" + (file.match (/([^\\/]+)$/)).to_s\n temp_file = f_name+\".temp\"\n unless File.exist? f_name or File.exist? temp_file\n File.open(temp_file, 'wb') do |file|\n # begin\n while chunk = node_client.read(1024)\n break if chunk.empty?\n file.write chunk\n end\n # rescue\n # f = (file.match (/([^\\/]+)$/)).to_s\n # end\n end\n # puts \"now changin name\"\n $mutex.synchronize do\n File.rename temp_file, f_name\n end\n end\n end\n node_client.close\n end\n }\n }\nend", "def run() end", "def call(node); end", "def node=(_arg0); end", "def in_new_thread; end", "def sync() end", "def sync() end", "def sync() end", "def main\r\n # Generate RSA Keys\r\n primes = generate_primes(12)\r\n keys = generate_rsa_keys(primes[0], primes[1])\r\n key_public = [keys[0], keys[2]]\r\n key_private = [keys[1], keys[2]]\r\n\r\n # Establish Node Server\r\n node_details = set_node_details\r\n port = node_details[0]\r\n name = node_details[1]\r\n node_type = node_details[2]\r\n if (node_details.length == 3) # Node Details Returns Required Values\r\n initialize_server(port)\r\n set_routes(port, name, node_type, keys)\r\n else # Node Details Returns An Error\r\n puts \"Error: #{node_details}\"\r\n $status = \"Error: #{node_details}\"\r\n end\r\n\r\n # Discover Peers Parallely To Other Crypto Fucntions (Hence New Thread)\r\n Thread.new {\r\n discover_peers(port, key_private)\r\n new_block(GENESIS_REWARD, 1801, port, key_private) if (port == 1801)\r\n begin\r\n Faraday.post(\"#{URL}:1801/genesis\") if (port != 1801) # Get First Block in Blockchain From Genesis Node\r\n rescue\r\n # Node Responts With No Data\r\n end\r\n }\r\n\r\n Thread.new { Interface.new(port, key_public, key_private).show }\r\nend", "def node=(_); end", "def node=(_); end", "def block_node=(_); end", "def run(&block); end", "def node(name, ref, *args, &block); end", "def allow_concurrency=(_arg0); end", "def allow_concurrency=(_arg0); end", "def sync; end", "def multithreaded\n get_value :multithreaded\n end", "def run(_); end", "def run(_); end", "def parallelize_me!; end", "def future; end", "def in_parallel(manager = T.unsafe(nil)); end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def node\n @node ||= Socket.gethostname\n end", "def request!\n PoolNode.create_or_get(@id, node)\n end", "def update(node); end", "def io_lock=(_arg0); end", "def run_server_thread; end", "def thread=(_arg0); end", "def running; end", "def running; end", "def tor_exit_node?; end", "def tor_exit_node?; end", "def process_node(node)\n method(:process).super_method.call(node)\n end", "def init_node\n end", "def init_node\n end", "def lock\n end", "def locked; end", "def robin; end" ]
[ "0.6581202", "0.6581202", "0.6581202", "0.649587", "0.649587", "0.649587", "0.64387697", "0.64387697", "0.64387697", "0.6392424", "0.6216859", "0.61738676", "0.611367", "0.6079616", "0.6079616", "0.6079616", "0.6079616", "0.6046087", "0.6027823", "0.6027823", "0.6010629", "0.6004149", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.59971666", "0.5993882", "0.59817284", "0.5956993", "0.5956993", "0.5873398", "0.58611834", "0.58574665", "0.5815729", "0.5812271", "0.5810203", "0.5810203", "0.5810203", "0.58088696", "0.5768611", "0.5768611", "0.5765515", "0.5765482", "0.5755218", "0.5752851", "0.5752851", "0.57260954", "0.5714033", "0.5688878", "0.5688878", "0.56876415", "0.5684409", "0.567579", "0.5669421", "0.5669421", "0.5669421", "0.5669421", "0.5669421", "0.5669421", "0.5669421", "0.5669421", "0.5669421", "0.5657753", "0.56139314", "0.56082064", "0.56021184", "0.55789053", "0.5575994", "0.5571378", "0.5571378", "0.55644333", "0.55644333", "0.5559255", "0.5554875", "0.5554875", "0.5550166", "0.55458856", "0.5528713" ]
0.0
-1
Handle the middle buttons on the add/edit forms pass in member list symbols (i.e. :policies)
def handle_selection_buttons(members, members_chosen = :members_chosen, choices = :choices, choices_chosen = :choices_chosen) if params[:button].ends_with?("_left") handle_selection_buttons_left(members, members_chosen, choices, choices_chosen) elsif params[:button].ends_with?("_right") handle_selection_buttons_right(members, members_chosen, choices, choices_chosen) elsif params[:button].ends_with?("_allleft") handle_selection_buttons_allleft(members, members_chosen, choices, choices_chosen) elsif params[:button].ends_with?("_up") handle_selection_buttons_up_down(members, members_chosen, choices, choices_chosen, true) elsif params[:button].ends_with?("_down") handle_selection_buttons_up_down(members, members_chosen, choices, choices_chosen, false) elsif params[:button].ends_with?("_sync") handle_selection_buttons_sync_async(members, members_chosen, choices, choices_chosen, true) elsif params[:button].ends_with?("_async") handle_selection_buttons_sync_async(members, members_chosen, choices, choices_chosen, false) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_item_controls\n @control_help_window.add_control(Vocab::CONFIRM, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::CHANGE_CATEGORY, Input::Keys::L, Input::Keys::R)\n @control_help_window.add_control(Vocab::DESCRIPTION, Input::Keys::START)\n end", "def set_item_controls\n @control_help_window.add_control(Vocab::CONFIRM, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n end", "def add_actions; end", "def manage_items\n end", "def item_edit\n end", "def edit_button\n if object.owner?(h.current_user.id)\n \"<span class=\\\"glyphicon glyphicon-pencil pull-right\\\"></span>\".html_safe\n end\n end", "def start_special_list_item\n end", "def make_command_list\n add_command(Vocab.reg_username_cmd, :name)\n add_command(Vocab.reg_avatar_cmd, :avatar)\n add_command(Vocab.change_title, :title)\n add_command(Vocab.reg_submit_cmd, :register, @registration_ok)\n end", "def buttons; end", "def default_context_menu\n [\n :row_counter.action,\n \"-\", # Adds a separator\n :show_details.action, # The custom action defined below via JS\n \"-\", # Adds a separator\n :del.action,\n \"-\", # Adds a separator\n :add_in_form.action,\n :edit_in_form.action\n ]\n end", "def edit_modifier\n\n\tend", "def set_status_controls\n @control_help_window.add_control(Vocab::CAPACITIES, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::REMOVE_ALL, Input::Keys::X)\n @control_help_window.add_control(Vocab::CHANGE_ACTOR, Input::Keys::L, Input::Keys::R)\n end", "def set_slots_controls\n @control_help_window.add_control(Vocab::CONFIRM, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::REMOVE, Input::Keys::X)\n @control_help_window.add_control(Vocab::CHANGE_ACTOR, Input::Keys::L, Input::Keys::R)\n end", "def default_bbar\n [\n :add.action, :edit.action, :apply.action, :del.action,\n \"-\", # Adds a separator\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\", # Adds a separator\n :row_counter.action\n ]\n end", "def default_context_menu\n [\n :row_counter.action,\n \"-\",\n :ctrl_manage.action,\n :show_details.action, # The custom action defined below via JS\n \"-\", # Adds a separator\n *super # Inherit all other commands\n ]\n end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def set_category_controls\n @control_help_window.add_control(Vocab::ITEM, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::CHANGE_CATEGORY, Input::Keys::L, Input::Keys::R)\n end", "def set_status_controls\n @control_help_window.add_control(Vocab::MODIFY, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::CHANGE_ACTOR, Input::Keys::L, Input::Keys::R)\n end", "def user_profile_edit\n\n\n end", "def edit_button_clicked\n\n\t\t\t# Set flag for edit mode, store \n\t\t\t@edited_item = @form.folderList.currentItem\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form(@edited_item.text)\n\t\tend", "def edit_profile\n end", "def default_bbar\n [\n :add.action, :edit.action, :apply.action, :del.action,\n \"-\", # Adds a separator\n :search.action,\n \"-\", # Adds a separator\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\", # Adds a separator\n :row_counter.action\n ]\n end", "def assigned_menu\n\n end", "def button\n @edit = session[:edit] # Restore @edit for adv search box\n params[:display] = @display if %w[all_vms vms resource_pools].include?(@display) # Were we displaying sub-items\n\n @refresh_div = 'main_div' unless @display # Default div for button.rjs to refresh\n case params[:pressed]\n when 'resource_pool_delete'\n deleteresourcepools\n if @refresh_div == 'main_div' && @lastaction == 'show_list'\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n when 'resource_pool_protect'\n assign_policies(ResourcePool)\n else\n super\n end\n end", "def default_bbar\n [\n :show_details.action,\n :ctrl_manage.action,\n :search.action,\n \"-\", # Adds a separator\n :add.action, :edit.action, :del.action,\n :apply.action,\n \"-\",\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\",\n :row_counter.action\n ]\n end", "def show\n accion = params[:accion]\n render 'add' and return if accion == 'add'\n render 'remove' and return if accion == 'remove'\n end", "def set_capacities_controls\n @control_help_window.add_control(Vocab::TOGGLE, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::CHANGE_CATEGORY, Input::Keys::L, Input::Keys::R)\n end", "def default_bbar\n [\n :show_details.action, # The custom action defined below via JS\n :search.action,\n \"-\", # Adds a separator\n :del.action,\n \"-\",\n {\n :menu => [:add_in_form.action, :edit_in_form.action],\n :text => I18n.t(:edit_in_form),\n :icon => \"/images/icons/application_form.png\"\n },\n \"-\",\n :row_counter.action\n ]\n end", "def admin_tab(*actions)\n self.admin_actions = actions\n end", "def create_account_management(html_dsl)\r\n html_dsl.div() do\r\n create_edit_boxes_for(html_dsl, @full_field_list)\r\n html_dsl.line_break()\r\n html_dsl.post_button('Add')\r\n html_dsl.line_break()\r\n html_dsl.post_button('Update Selected')\r\n html_dsl.line_break()\r\n html_dsl.post_button('Delete Selected')\r\n end\r\n\r\n nil\r\n end", "def remove_membership_button(name)\n self.button(:title=>\"Remove membership from #{name}\")\n end", "def manage_trains\n @ui.manage_trains_selected_msg\n @ui.input_1_change\n @ui.user_input1.downcase\n\n case @ui.user_input1\n when \"add\" \n manage_trains_add_train\n when \"add route\"\n manage_trains_add_route\n when \"move\"\n manage_trains_move\n when \"cars\"\n manage_trains_cars\n else\n @ui.wrong_input_msg\n end\n end", "def set_titles_controls\n @control_help_window.add_control(Vocab::CONFIRM, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::DESCRIPTION, Input::Keys::START)\n end", "def admin_edit_control_numbers_list\n %w( tt_edit_control_numbers_list@booktrope.com )\n end", "def curatorEditingArea _args\n \"curatorEditingArea _args;\" \n end", "def edit_patron(selected)\n\tedit_patron_name(selected)\n\tedit_patron_email_address(selected)\nend", "def show_edit_menu\n puts \" You are now in edit mode\"\n puts \" edit name - edit the name of this contact\"\n puts \" edit email - edit the email of this contact\"\n puts \" add phone - add a phone number to this contact\"\n puts \" edit importance - edit the importance of this contact\"\n print \"> \"\n end", "def new_or_edit\nend", "def addCuratorEditingArea _obj, _args\n \"_obj addCuratorEditingArea _args;\" \n end", "def manage\n\n end", "def edit_staff_member(selected)\n\tedit_staff_member_name(selected)\n\tedit_staff_member_email_address(selected)\nend", "def initialize form, config={}, &block\n @surround_chars = ['[', ']'] # 2008-12-23 23:16 added space in Button so overriding\n super\n end", "def button\n @edit = session[:edit] # Restore @edit for adv search box\n\n params[:display] = @display if [\"vms\", \"hosts\", \"storages\", \"instances\", \"images\", \"orchestration_stacks\"].include?(@display) # Were we displaying vms/hosts/storages\n params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh\n\n # Handle buttons from sub-items screen\n if params[:pressed].starts_with?(\"availability_zone_\",\n \"cloud_network_\",\n \"cloud_object_store_container_\",\n \"cloud_subnet_\",\n \"cloud_tenant_\",\n \"cloud_volume_\",\n \"ems_cluster_\",\n \"flavor_\",\n \"floating_ip_\",\n \"guest_\",\n \"host_\",\n \"image_\",\n \"instance_\",\n \"load_balancer_\",\n \"miq_template_\",\n \"network_port_\",\n \"network_router_\",\n \"orchestration_stack_\",\n \"security_group_\",\n \"storage_\",\n \"vm_\")\n\n case params[:pressed]\n # Clusters\n when \"ems_cluster_compare\" then comparemiq\n when \"ems_cluster_delete\" then deleteclusters\n when \"ems_cluster_protect\" then assign_policies(EmsCluster)\n when \"ems_cluster_scan\" then scanclusters\n when \"ems_cluster_tag\" then tag(EmsCluster)\n # Hosts\n when \"host_analyze_check_compliance\" then analyze_check_compliance_hosts\n when \"host_check_compliance\" then check_compliance_hosts\n when \"host_compare\" then comparemiq\n when \"host_delete\" then deletehosts\n when \"host_edit\" then edit_record\n when \"host_protect\" then assign_policies(Host)\n when \"host_refresh\" then refreshhosts\n when \"host_scan\" then scanhosts\n when \"host_tag\" then tag(Host)\n when \"host_manageable\" then sethoststomanageable\n when \"host_introspect\" then introspecthosts\n when \"host_provide\" then providehosts\n # Storages\n when \"storage_delete\" then deletestorages\n when \"storage_refresh\" then refreshstorage\n when \"storage_scan\" then scanstorage\n when \"storage_tag\" then tag(Storage)\n # Edit Tags for Network Manager Relationship pages\n when \"availability_zone_tag\" then tag(AvailabilityZone)\n when \"cloud_network_tag\" then tag(CloudNetwork)\n when \"cloud_object_store_container_tag\" then tag(CloudObjectStoreContainer)\n when \"cloud_subnet_tag\" then tag(CloudSubnet)\n when \"cloud_tenant_tag\" then tag(CloudTenant)\n when \"cloud_volume_tag\" then tag(CloudVolume)\n when \"flavor_tag\" then tag(Flavor)\n when \"floating_ip_tag\" then tag(FloatingIp)\n when \"load_balancer_tag\" then tag(LoadBalancer)\n when \"network_port_tag\" then tag(NetworkPort)\n when \"network_router_tag\" then tag(NetworkRouter)\n when \"orchestration_stack_tag\" then tag(OrchestrationStack)\n when \"security_group_tag\" then tag(SecurityGroup)\n end\n\n pfx = pfx_for_vm_button_pressed(params[:pressed])\n # Handle Host power buttons\n if [\"host_shutdown\", \"host_reboot\", \"host_standby\", \"host_enter_maint_mode\", \"host_exit_maint_mode\",\n \"host_start\", \"host_stop\", \"host_reset\"].include?(params[:pressed])\n powerbutton_hosts(params[:pressed].split(\"_\")[1..-1].join(\"_\")) # Handle specific power button\n else\n process_vm_buttons(pfx)\n # Control transferred to another screen, so return\n return if [\"host_tag\", \"#{pfx}_policy_sim\", \"host_scan\", \"host_refresh\", \"host_protect\",\n \"host_compare\", \"#{pfx}_compare\", \"#{pfx}_tag\", \"#{pfx}_retire\",\n \"#{pfx}_protect\", \"#{pfx}_ownership\", \"#{pfx}_refresh\", \"#{pfx}_right_size\",\n \"#{pfx}_reconfigure\", \"storage_tag\", \"ems_cluster_compare\",\n \"ems_cluster_protect\", \"ems_cluster_tag\", \"#{pfx}_resize\", \"#{pfx}_live_migrate\",\n \"#{pfx}_evacuate\"].include?(params[:pressed]) &&\n @flash_array.nil?\n\n unless [\"host_edit\", \"#{pfx}_edit\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n @refresh_div = \"main_div\"\n @refresh_partial = \"layouts/gtl\"\n show # Handle EMS buttons\n end\n end\n else\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n redirect_to :action => \"new\" if params[:pressed] == \"new\"\n deleteemss if params[:pressed] == \"#{@table_name}_delete\"\n arbitration_profile_edit if params[:pressed] == \"arbitration_profile_new\"\n arbitration_profile_edit if params[:pressed] == \"arbitration_profile_edit\"\n arbitration_profile_delete if params[:pressed] == \"arbitration_profile_delete\"\n refreshemss if params[:pressed] == \"#{@table_name}_refresh\"\n # scanemss if params[:pressed] == \"scan\"\n tag(model) if params[:pressed] == \"#{@table_name}_tag\"\n\n # Edit Tags for Middleware Manager Relationship pages\n tag(@display.camelize.singularize) if @display && @display != 'main' &&\n params[:pressed] == \"#{@display.singularize}_tag\"\n assign_policies(model) if params[:pressed] == \"#{@table_name}_protect\"\n check_compliance(model) if params[:pressed] == \"#{@table_name}_check_compliance\"\n edit_record if params[:pressed] == \"#{@table_name}_edit\"\n if params[:pressed] == \"#{@table_name}_timeline\"\n @showtype = \"timeline\"\n @record = find_by_id_filtered(model, params[:id])\n @timeline = @timeline_filter = true\n @lastaction = \"show_timeline\"\n tl_build_timeline # Create the timeline report\n drop_breadcrumb(:name => _(\"Timelines\"), :url => show_link(@record, :refresh => \"n\", :display => \"timeline\"))\n session[:tl_record_id] = @record.id\n javascript_redirect polymorphic_path(@record, :display => 'timeline')\n return\n end\n if params[:pressed] == \"#{@table_name}_perf\"\n @showtype = \"performance\"\n @record = find_by_id_filtered(model, params[:id])\n drop_breadcrumb(:name => _(\"%{name} Capacity & Utilization\") % {:name => @record.name},\n :url => show_link(@record, :refresh => \"n\", :display => \"performance\"))\n perf_gen_init_options # Intialize options, charts are generated async\n javascript_redirect polymorphic_path(@record, :display => \"performance\")\n return\n end\n if params[:pressed] == \"#{@table_name}_ad_hoc_metrics\"\n @showtype = \"ad_hoc_metrics\"\n @record = find_by_id_filtered(model, params[:id])\n drop_breadcrumb(:name => @record.name + _(\" (Ad hoc Metrics)\"), :url => show_link(@record))\n javascript_redirect polymorphic_path(@record, :display => \"ad_hoc_metrics\")\n return\n end\n if params[:pressed] == \"refresh_server_summary\"\n javascript_redirect :back\n return\n end\n if params[:pressed] == \"ems_cloud_recheck_auth_status\" ||\n params[:pressed] == \"ems_infra_recheck_auth_status\" ||\n params[:pressed] == \"ems_middleware_recheck_auth_status\" ||\n params[:pressed] == \"ems_container_recheck_auth_status\"\n if params[:id]\n table_key = :table\n _result, details = recheck_authentication\n add_flash(_(\"Re-checking Authentication status for this %{controller_name} was not successful: %{details}\") %\n {:controller_name => ui_lookup(:table => controller_name), :details => details}, :error) if details\n else\n table_key = :tables\n ems_ids = find_checked_items\n ems_ids.each do |ems_id|\n _result, details = recheck_authentication(ems_id)\n add_flash(_(\"Re-checking Authentication status for the selected %{controller_name} %{name} was not successful: %{details}\") %\n {:controller_name => ui_lookup(:table => controller_name),\n :name => @record.name,\n :details => details}, :error) if details\n end\n end\n add_flash(_(\"Authentication status will be saved and workers will be restarted for the selected %{controller_name}\") %\n {:controller_name => ui_lookup(table_key => controller_name)})\n render_flash\n return\n end\n\n custom_buttons if params[:pressed] == \"custom_button\"\n\n return if [\"custom_button\"].include?(params[:pressed]) # custom button screen, so return, let custom_buttons method handle everything\n return if [\"#{@table_name}_tag\", \"#{@table_name}_protect\", \"#{@table_name}_timeline\"].include?(params[:pressed]) &&\n @flash_array.nil? # Tag screen showing, so return\n check_if_button_is_implemented\n end\n\n if !@flash_array.nil? && params[:pressed] == \"#{@table_name}_delete\" && @single_delete\n javascript_redirect :action => 'show_list', :flash_msg => @flash_array[0][:message] # redirect to build the retire screen\n elsif params[:pressed] == \"host_aggregate_edit\"\n javascript_redirect :controller => \"host_aggregate\", :action => \"edit\", :id => find_checked_items[0]\n elsif params[:pressed] == \"cloud_tenant_edit\"\n javascript_redirect :controller => \"cloud_tenant\", :action => \"edit\", :id => find_checked_items[0]\n elsif params[:pressed] == \"cloud_volume_edit\"\n javascript_redirect :controller => \"cloud_volume\", :action => \"edit\", :id => find_checked_items[0]\n elsif params[:pressed].ends_with?(\"_edit\") || [\"arbitration_profile_new\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n render_or_redirect_partial(pfx)\n else\n if @refresh_div == \"main_div\" && @lastaction == \"show_list\"\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n end\n end", "def edit\n\t\t@page_name = \" - Edit Show\"\n\tend", "def members_login\r\n\t@title = \"Members Login\"\r\n end", "def set_status_controls\n @control_help_window.add_control(Vocab::EQUIP, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::OPTIMIZE, Input::Keys::X)\n @control_help_window.add_control(Vocab::CHANGE_ACTOR, Input::Keys::L, Input::Keys::R)\n end", "def form_buttons(**opt)\n opt.reverse_merge!('data-manifest': object.id)\n buttons = super\n buttons << submission_button(**opt)\n buttons << export_button(**opt)\n buttons << import_button(**opt)\n buttons << comm_status(**opt)\n block_given? ? yield(buttons) : buttons\n end", "def edit_form\n\t\tnewform = \"\"\n\t\titem_text = question_items.first.text #\n\t\tanswer_item = (self.answer_item.nil? or (self.answer_item =~ /\\d+([a-z]+)/).nil?) ? \"\" : \"\\t\" + $1 + \". \"\n\t\tself.question_items.each do |item|\n\t\t\tnewform = if item.position==1\n\t\t\t\tdiv_item( answer_item + item.text, \"itemquestiontext span-9\")\n\t\t\telse\n\t\t\t\tdiv_item( item_text, \"itemquestiontext span-9\")\n\t\t\tend\n\t\tend\n\t\tnewform\n\tend", "def colon_nonce; 'DONT_EDIT_WITH_GUI_:'; end", "def getMenu(menu)\n menu.add_item(\"Done\") {self.done}\n menu.add_item(\"Edit Camera...\") {self.edit}\n menu.add_item(\"Reset Tilt\") {self.reset_tilt}\nend", "def content_action_list(&block)\n concat tag(:ul, :class => \"contentActionNavi\"), block.binding \n concat capture(&block), block.binding\n concat \"</ul>\", block.binding\n concat probono_clear_class, block.binding\n end", "def additional_action_buttons\n nil\n end", "def mtm_edit_remove(assoc, mc, obj, assoc_obj)\n t = String.new\n t << \"<li>\"\n t << association_link(mc, assoc_obj)\n form_attr = form_attributes(:action=>url_for(\"mtm_update/#{model.primary_key_value(obj)}?association=#{assoc}&remove%5b%5d=#{model.primary_key_value(assoc_obj)}&redir=edit\"), :method=>'post', :class => 'mtm_remove_associations', 'data-add'=>\"#add_#{assoc}\")\n t << Forme.form(form_attr, form_opts(form_attr[:action])) do |f|\n f.button(:value=>'Remove', :class=>'btn btn-xs btn-danger')\n end\n t << \"</li>\"\n end", "def form_tabs_for(form:)\n if form.model.persisted? && current_user.admin? && !form.model.file_sets.blank?\n super << 'ocr'\n else\n super\n end\n end", "def languageChange()\n setCaption(trUtf8(\"Form1\"))\n @pushButton1.setText( trUtf8(\"push&Button1\") )\n @pushButton1.setAccel( Qt::KeySequence.new(trUtf8(\"Alt+B\")) )\n @listBox1.clear()\n @listBox1.insertItem(trUtf8(\"Nuevo elemento\"))\n end", "def add list\n list_action list, \"add\"\n end", "def display_controls\n control_window = border_windows[:controls]\n # Loop through each action/key pair in the controls hash given by the controls function\n controls.each_with_index do |(action, key), i|\n # Set the position of the pair and add them to the window\n control_window.setpos(2 + i * 2, 2)\n control_window.addstr(\"#{action}: #{key}\")\n end\n control_window.noutrefresh\nend", "def edit\r\n end", "def edit\n #Nothing necessary\n end", "def edit\n\t\t#super\n\tend", "def record_edit_display\n \"1. Name: #{name}\\n\"\\\n \"2. Email: #{email}\\n\"\\\n \"3. Library: #{libraries_edit_display}\"\n end", "def edit \n end", "def edit \n end", "def case_menu(selection)\n case selection\n when 'Add'\n add\n when 'Remove'\n remove\n else\n second_case_menu(selection)\n end\n end", "def edit\n p \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n p \"-----------------------\"\n super\n end", "def process_ok\r\n super\r\n $game_party.menu_actor = $game_party.members[index]\r\n end", "def set_edit_form_information\n @information[:subtitle] = t('view.permissions.edit_title')\n @information[:form_url] = [@parent, 'permission', no_firm: @no_firm]\n end", "def set_input_controls\n @control_help_window.add_control(Vocab::CONFIRM, Input::Keys::A) \n @control_help_window.add_control(Vocab::ERASE, Input::Keys::B)\n @control_help_window.add_control(Vocab::DONE, Input::Keys::START)\n end", "def form_field_order\n %w{\n keurig_elite_button\n }\n\n end", "def edit\n\t\t\n\tend", "def api_form_actions(object_name, options = {})\n \" <li><div class=\\\"form_actions\\\">\\n \" +\n submit_button(object_name, options[:submit_text]) + \"\\n \" + cancel_link +\n \"\\n </div></li>\"\n end", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend" ]
[ "0.5779444", "0.57479364", "0.56166595", "0.5536536", "0.54597074", "0.5421022", "0.53814834", "0.5361289", "0.53436184", "0.5329671", "0.53201103", "0.52537054", "0.522222", "0.5217496", "0.52133673", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.51971143", "0.5184591", "0.517282", "0.5149414", "0.5126049", "0.51051146", "0.5102708", "0.5100908", "0.50865304", "0.5075434", "0.5070177", "0.50551844", "0.5044785", "0.50423217", "0.5018923", "0.50151974", "0.5012949", "0.50082034", "0.5006845", "0.5001654", "0.50006354", "0.49918118", "0.49875343", "0.49794066", "0.4977205", "0.49702665", "0.49415466", "0.49142203", "0.49090615", "0.48854446", "0.48789817", "0.4875405", "0.4865438", "0.48632824", "0.48605585", "0.4851548", "0.4848729", "0.48406726", "0.48383185", "0.48382908", "0.48381057", "0.48298168", "0.48128173", "0.4805966", "0.4805924", "0.48018545", "0.47973526", "0.47973526", "0.47970533", "0.47928682", "0.47890264", "0.4787863", "0.47836104", "0.4780966", "0.47770458", "0.47768652", "0.47669956", "0.47669956", "0.47669956", "0.47669956", "0.47669956", "0.47669956", "0.47669956", "0.47669956", "0.47669956", "0.47669956" ]
0.0
-1
Get list of folder contents
def folder_get_info(folder_node) nodetype, nodeid = folder_node.split("_") @sb[:mode] = nil @sb[:nodeid] = nil @sb[:folder] = nodeid.nil? ? nodetype.split("-").last : nodeid if x_active_tree == :policy_tree if nodeid.nil? && %w[compliance control].include?(nodetype.split('-').last) # level 1 - compliance & control _, mode = nodetype.split('-') @folders = UI_FOLDERS.collect do |model| "#{model.name.titleize} #{mode.titleize}" end @right_cell_text = case mode when 'compliance' then _('Compliance Policies') when 'control' then _('Control Policies') else _("%{typ} Policies") % {:typ => mode.titleize} end else # level 2 - host, vm, etc. under compliance/control - OR deeper levels @sb[:mode] = nodeid.split("-")[1] @sb[:nodeid] = nodeid.split("-").last @sb[:folder] = "#{nodeid.split("-")[1]}-#{nodeid.split("-")[2]}" set_search_text policy_get_all if folder_node.split("_").length <= 2 @right_cell_text = _("All %{typ} Policies") % {:typ => ui_lookup(:model => @sb[:nodeid].try(:camelize))} @right_cell_div = "policy_list" end elsif x_active_tree == :alert_profile_tree @alert_profiles = MiqAlertSet.where(:mode => @sb[:folder]).sort_by { |as| as.description.downcase } set_search_text @alert_profiles = apply_search_filter(@search_text, @alert_profiles) if @search_text.present? @right_cell_text = _("All %{typ} Alert Profiles") % {:typ => ui_lookup(:model => @sb[:folder].try(:camelize))} @right_cell_div = "alert_profile_list" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dir_contents(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tcontents_paths = []\n\tfor i in contents\n\t\tcontents_paths << i['path']\n\tend\n\tcontents_paths\nend", "def get_contents \n @contents = []\n\n sub_directory_names = Dir[CONTENT_ROOT_DIRECTORY + \"/*\"]\n\n sub_directory_names.each do |sub_directory_name|\n sub_directory_basename = File.basename(sub_directory_name)\n @contents.push(Content.new(sub_directory_basename))\n end\n end", "def list(folder)\n\t\tc = 0\n\t\tfolder = '/' + folder\t\t\t\n\t\tresp = @client.metadata(folder)\n\t\tputs \"\\n List of contents in \" + folder + \"\\n\"\n\t\tfor item in resp['contents']\t\t\n\t\t\tputs item['path']\n\n\t\t\tc=c+1\n\t\tend\t\n\t\t\n\tend", "def listDirectories\n return contentHost.listDirectories(baseDir)\n end", "def list(path='root')\n puts \"#list('#{path}')\"\n listed_files =[]\n @drive.folder = path\n children = @drive.children\n list_files_metadata(children)\n raise 'There are no files in directory' if children.count < 1\n children.each do |item|\n listed_files << \"#{item.path.gsub('/drive/', 'drive/')}/#{item.name}\" unless item.folder?\n end\n @logger.info 'Children list acquired.'\n pp listed_files\n end", "def get_entries(dir, subfolder); end", "def directory_contents(path)\n\tputs ''\n\tfor i in get_dir_contents(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend", "def list_folders\n http_get(:uri=>\"/folders\", :fields=>x_cookie)\n end", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def directory_contents(directory)\n return Dir.glob(File.join(directory, '*'))\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def contents(id = '')\n folder = id.empty? ? box_client.root_folder : box_client.folder_by_id(id)\n values = []\n\n folder.items(ITEM_LIMIT, 0, %w[name size created_at]).collect do |f|\n values << directory_entry(f)\n end\n @entries = values.compact\n\n @sorter.call(@entries)\n end", "def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end", "def folders\n html = http_request(@uri + '/wato.py', {\n folder: '',\n mode: 'folder',\n }, false)\n html.split(/\\n/).each do |line|\n next unless line =~ /class=\"folderpath\"/\n end\n res = []\n html.split(/\\n/).grep(/mode=editfolder/).each do |line|\n line =~ /folder=(.*?)'/\n res.push $1 unless $1.nil?\n end\n res\n end", "def get_content(folder = nil, sort = nil)\n abs_path = folder ? ROOT + folder : ROOT\n \n # build array if pairs: [filename, :type, is_textfile]\n sorter = case sort\n when 'name' then '| sort -f'\n when 'ctime' then '-c'\n when 'mtime' then '--sort=time'\n when 'size' then '--sort=size'\n else ''\n end\n\n list_files(abs_path, sorter).map do |obj|\n file_path = abs_path + obj\n [obj,\n if file_path.file?; :file\n elsif file_path.directory?; :dir\n elsif file_path.symlink?; :link\n end,\n \n !!`file \"#{file_path.to_s.shellescape}\"`.force_encoding(Encoding::UTF_8).sub(file_path.to_s, '').index(/text/i)\n ]\n end\n end", "def get_file_listing\n execute!(drive.files.list).data\n end", "def folder_list(opts = {})\n optional_inputs = {\n include_deleted: false,\n include_media_info: false,\n }.merge(opts)\n input_json = {\n id: optional_inputs[:id],\n path: optional_inputs[:path],\n include_deleted: optional_inputs[:include_deleted],\n include_media_info: optional_inputs[:include_media_info],\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/folder_list\", input_json)\n Dropbox::API::FolderAndContents.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def list_files(path)\n base_directory_content = Dir.glob(File.join(path, \"*\"))\n nested_directory_content = Dir.glob(File.join(path, \"*/**/*\"))\n [base_directory_content, nested_directory_content].flatten\n end", "def list(current_folder)\n # Ensure API availability\n api.call(\"system\", \"greet\")\n\n api.call(files_project, \"listFolder\", { folder: current_folder, only: 'folders' })\n end", "def contents(path)\n puts \"#contents(#{path})\" if DEBUG\n results = []\n root_path = zk_path(path)\n zk.find(root_path) do |z_path|\n if (z_path != root_path)\n z_basename = z_path.split('/').last\n stats = zk.stat(z_path)\n results << \"#{z_basename}\" if stats.numChildren > 0\n results << \"#{z_basename}.contents\" if zk.stat(z_path).dataLength > 0\n ZK::Find.prune\n end\n end\n results\n end", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end", "def ls\n Dir.entries(@working_dir)\n end", "def get_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def index\n client = DropboxApi::Client.new(\"C8Eg7_xlTzAAAAAAAAAAMduh226EdjZy_X_pVqXkbOUenDBMOVpQwo0zhF9sr8bC\")\n @result = client.list_folder \"/Yann Doré\"\n pp @result.entries\n @result.has_more? \n end", "def get_ls(path)\n #repo = @repo\n #head = repo.commits.first\n #tree = head.tree @branch\n\n tree = @repo.tree @branch\n\n #strip trailing /\n path.sub! /[\\/]*$/, ''\n\n # find dir\n while !path.empty?\n tdir = tree / path\n break if tdir.is_a?(Grit::Tree)\n # strip last conponent to /\n path.sub! /(^|\\/)[^\\/]*$/, ''\n end\n\n if path.empty?\n tdir = tree\n else\n path += '/'\n end\n print \"path:\", path, \"\\n\"\n print \"tdir:\", tdir, \"\\n\"\n\n files = tdir.blobs.map do |b|\n { path: \"#{path}#{b.name}\", name: b.name, siz: b.size }\n end\n dirs = tdir.trees.map do |t|\n { path: \"#{path}#{t.name}\", name: t.name}\n end\n if !path.empty?\n dirs.push( { path: path.sub(/(^|\\/)[^\\/]*\\/$/, ''),\n name: '..'} )\n end\n\n [files, dirs, path]\n end", "def files\n return get_result('files')\n end", "def list(path=nil)\n remote_path = list_path(path)\n begin\n folder = @client.folder(remote_path)\n raise Error if folder.nil?\n folder.items.map do |elem|\n {\n name: elem.name,\n path: \"#{remote_path}/#{elem.name}\",\n type: elem.type\n }\n end\n rescue RubyBox::AuthError\n box_error\n end\n end", "def list(path, recursive=true, dirs=false)\n # TODO : this might need to be changed as it returns dir and contents\n # if there are contents\n nodes = []\n prune = recursive ? nil : 2\n @content_tree.with_subtree(path, nil, prune, dirs) do |node|\n nodes << node.path\n end\n nodes.sort.uniq\n end", "def index\n @file_folders = FileFolder.all\n end", "def list(path, show_all)\n begin\n unless (@cmd.model[:public] + path).directory?\n return false\n end\n\n (@cmd.model[:public] + path).entries.each_with_object([]) do |entry, list|\n if show_all or not(entry.basename.start_with?(\".\"))\n list << {\n \"name\" => entry.basename,\n \"type\" => entry.directory? ? \"dir\" : \"file\",\n \"mtime\" => entry.mtime.iso8601,\n \"size\" => entry.size\n }\n end\n end\n rescue => e\n return nil\n end\n end", "def get_sub_folder_contents\n # Convert the object received in parameters to a FolderNode object.\n folder_node = (params[:reactParams2][:nodeType]).constantize.new\n params[:reactParams2][:child_nodes].each do |key, value|\n folder_node[key] = value\n end\n\n # Get all of the children in the sub-folder.\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_sub_folder_to_json(node))\n end\n respond_to do |format|\n format.html { render json: contents }\n end\n end", "def list\n Lib.list @path, @no_follow\n end", "def index\n @folders = Folder.all\n end", "def dir_contents(path, &b)\n path = Pathname.new(path).cleanpath\n if fs.directory?(path)\n entries = fs.entries(path).map do |entry|\n entry_path = path + entry\n if fs.directory?(entry_path)\n dir_item(entry)\n else\n file_item(entry, fs.get_size(entry_path))\n end\n end\n yield entries\n else\n yield Set.new\n end\n end", "def index\n @folders = @user.folders.all\n end", "def get_specific_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def get_list(dir = nil)\n @ftp.ls(dir)[3..-1]\n end", "def directories\n directory.directoires\n end", "def list\n @file_list.to_a\n end", "def get_files(site, folder)\n files = []\n Dir.chdir(File.join(site.source, folder)) { files = filter_entries(Dir.glob('**/*.*')) }\n files\n end", "def list\n call(:get, path)\n end", "def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend", "def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend", "def ls(path) \n ary = Array.new\n Dir.chdir(path) {\n Dir.glob(\"*\").each {|dir|\n ary.push(dir)\n }\n }\n return ary\nend", "def sub_listing switch\n path = ::File.join(@source.base_dir,switch)\n folders = folders_listing path\n folders = folders_filtering folders\n files = []\n folders.each do |folder|\n files += files_listing folder\n end\n files\n end", "def get_list_of_files\n\t\t@list_of_files = Dir.entries(@wallpaper_dir) \n\tend", "def files\n return unless session\n session.files.find_all_by_parent_folder_id(id)\n end", "def _folders\r\n Dir.glob(File.join(\"templates\", \"**/\"))\r\n end", "def get_list_folders()\n\t\trefresh_access_token()\n\t\trequest_url = \"https://www.googleapis.com/drive/v2/files?q=mimeType='application/vnd.google-apps.folder'&access_token=#{@access_token}\"\n\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\t\tfolders = Hash.new\n\n\t\tresponse_body['items'].each do |item|\n\t\t\tfolders[item['title']] = item['id']\n\t\tend\n\n\t\treturn folders\n\tend", "def folder\n query = Builder::XmlMarkup.new.Query do |xml|\n xml.Where do |xml|\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FileRef\")\n xml.Value(::File.dirname(url).sub(/\\A\\//, \"\"), :Type => \"Text\")\n end\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FSObjType\")\n xml.Value(1, :Type => \"Text\")\n end\n end\n end\n @list.items(:folder => :all, :query => query).first\n end", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= '/'\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n\n begin\n api_result = @client.metadata(result[:folder_id], 1000, true)\n rescue\n return nil\n end\n \n if api_result.present? && api_result['contents'].present?\n api_result['contents'].each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n end\n \n result\n end", "def get_folders\n doc = Nokogiri::HTML(open(url))\n doc.xpath(\"//@href\").map do |url|\n url.value\n end\n end", "def ls(path = '/')\n dirlist = []\n @sftp.dir.foreach(path) do |element|\n dirlist << element\n end\n return dirlist\n end", "def get_list_files_folder(*folder_name)\n\n\t\tfiles = Array.new\n\t\tif (folder_name.length==0)\n\t\t\tfolders = get_list_folders()\n\t\t\t#Give the folder you want to use otherwise we'll have to loop through\n\t\t\tfolder_id = folders['Adwords']\n\t\t\trefresh_access_token()\n\n\t\t\trequest_url = \"https://www.googleapis.com/drive/v2/files/#{folder_id}/children?access_token=#{@access_token}\"\n\t\t\tresponse = RestClient.get request_url\n\t\t\tresponse_body = JSON.parse(response.body)\n\t\t\t#puts pp(response_body)\n\n\t\t\tresponse_body['items'].each do |item|\n\t\t\t\tfiles.push(item['id'])\n\t\t\tend\n\n\t\t\treturn files\n\t\tend\n\tend", "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "def all\n @files\n end", "def files(folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def test_files\n get_folder_files(TESTS_PATH)\n end", "def list\r\n # Get the folder\r\n @folder = Folder.find_by_id(folder_id)\r\n\r\n # Set if the user is allowed to update or delete in this folder;\r\n # these instance variables are used in the view.\r\n @can_update = @logged_in_user.can_update(@folder.id)\r\n @can_delete = @logged_in_user.can_delete(@folder.id)\r\n\r\n # determine the order in which files are shown\r\n file_order = 'filename '\r\n file_order = params[:order_by].sub('name', 'filename') + ' ' if params[:order_by]\r\n file_order += params[:order] if params[:order]\r\n\r\n # determine the order in which folders are shown\r\n folder_order = 'name '\r\n if params[:order_by] and params[:order_by] != 'filesize' \r\n folder_order = params[:order_by] + ' '\r\n folder_order += params[:order] if params[:order]\r\n end\r\n\r\n # List of subfolders\r\n @folders = @folder.list_subfolders(@logged_in_user, folder_order.rstrip)\r\n\r\n # List of files in the folder\r\n @myfiles = @folder.list_files(@logged_in_user, file_order.rstrip)\r\n\r\n #get the correct URL\r\n url = url_for(:controller => 'folder', :action => 'list', :id => nil)\r\n\r\n # it's nice to have the possibility to go up one level\r\n @folder_up = '<a href=\"' + url + '/' + @folder.parent.id.to_s + '\">..</a>' if @folder.parent\r\n end", "def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end", "def ls(path)\n files = []\n Dir.glob(\"#{path}/*\") {|f| files << f.split('/').last}\n\n return files\n end", "def read_files(file_path)\n\tlist=Dir.entries(file_path)\n\treturn list\nend", "def list_files_from path,opts = {}\n unless Dir.exists? path\n Logger.<<(__FILE__,\"ERROR\",\"Local fetcher: path does not exists for listing... #{path} \")\n raise \"Error LocalFileFetcher !\"\n end\n if opts[:directories]\n cmd = \"ls -td #{path}/*/\"\n else\n cmd = \"ls #{path}\"\n cmd += \"/#{opts[:regexp]}\" if opts[:regexp]\n end\n out = `#{cmd}`\n return out.split(\"\\n\")\n end", "def folder\n connection.directories.get(folder_name)\n end", "def folders\n @conn.list('', '%').map do |f|\n Folder.new(@conn, f.name, f.delim)\n end\n end", "def list\n require_public = ( params[:user].nil? ? false : true )\n user = ( params[:user].nil? ? session[:user] : User.first(id: params[:user]) )\n raise RequestError.new(:bad_params, \"User does not exist\") unless user\n raise RequestError.new(:bad_params, \"Depth not valid\") if params[:depth].to_i < 0\n depth = (params[:depth] ? params[:depth].to_i : -1)\n xfile = ( params[:id].nil? ? user.root_folder : WFolder.get(params[:id]) )\n raise RequestError.new(:internal_error, \"No root directory. Please contact your administrator\") if xfile.nil? && params[:id].nil?\n raise RequestError.new(:folder_not_found, \"File or folder not found\") if xfile.nil?\n if (require_public && params[:id] && session[:user].admin == false) then\n raise RequestError.new(:folder_not_public, \"Folder is not public\") if xfile.folder == true && xfile.public == false\n raise RequestError.new(:folder_not_public, \"File is not public\") if xfile.folder == false && xfile.public == false\n end\n if xfile.folder then\n @result = { folder: crawl_folder(xfile, require_public, depth), success: true }\n else \n @result = { file: xfile.description(session[:user]) , success: true }\n end\n end", "def list(client, current_path)\n\n\tfiles = Dir.glob(\"#{current_path}/files/*\")\n\tclient.puts \"\\nList of Files:\"\n\tfiles.each{ |file|\n\tfile.slice! \"#{current_path}/files/\"}\n\tclient.puts files\n\nend", "def children\n # Check to see whether dir exists.\n Slimdown::Folder.new(@absolute_path.chomp('.md')).pages\n end", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= self.get_root_folder_id\n return nil if params[:folder_id].blank?\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n parameters = {}\n parameters['q'] = \"'#{params[:folder_id]}' in parents\"\n parameters['maxResults'] = result[:per_page]\n \n # Make api request\n begin\n drive = @client.discovered_api('drive', 'v2')\n api_result = @client.execute(:api_method => drive.files.list, :parameters => parameters)\n rescue\n return nil\n end\n \n \n if api_result.status == 200\n files = api_result.data\n files.items.each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n else\n result[:error] = {:code => api_result.status, :message => api_result.data['error']['message']} \n end\n result\n end", "def folders\n ContextIO::Folder.all(@account_id, @label)\n end", "def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend", "def files\n FileList.new(`#@native.files`)\n end", "def index\n @folders = current_user.folders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @folders }\n end\n end", "def index\n @directories = Directory.all\n end", "def ls(path)\n # FIXME: remove 'path' from listing?\n list(path, false, true)\n end", "def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n current_dir = current_dir + \"/\" + name\n when :file\n file_list.push(current_dir + \"/\" + name)\n else\n throw \"BAD VISIT TYREE TYPE. #{type}\"\n end\n end\n file_list\n end", "def all_entries\n entries = []\n Dir.chdir(@input_dir) do\n entries = Dir.glob(File.join('**', '**')) - %w[mimetype]\n end\n\n entries\n end", "def get_folder_files(folder_path)\n ensure_file_open!\n @file.glob(\"#{folder_path}/**/*\").to_h do |entry|\n entry_file_name = Pathname.new(entry.name)\n file_name = entry_file_name.relative_path_from(folder_path)\n [file_name, entry.get_input_stream(&:read)]\n end\n end", "def ls(path)\n dir = scope.get(path)\n InvalidPath.raise! {!dir.try(:is_dir)}\n dir.files.map(&:path)\n end", "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "def list(path)\n output { get(path) }\n end", "def list_all_in_current_directory\n Dir.glob('**/*').sort\nend", "def list\n client = get_dropbox_client\n unless client\n redirect_to(:action => 'auth_start') and return\n end\n @dropbox_docs = []\n path = \"/\"\n\n metadata = client.metadata(path, file_limit=25000, list=true, hash=nil, rev=nil, include_deleted=false)\n for dfile in metadata['contents']\n \tname = dfile['path']\n \t@dropbox_docs << name[1..-1]\n \tend\n \tgoogle_session = GoogleDrive.login_with_oauth(session[:google_token])\n \t@google_docs = []\n \tfor file in google_session.files\n \t\t@google_docs << file.title \n \tend\n #drivelist = get_dr.slice!(-)\n #render :inline => \"#{metadata['contents']} \\n\\n\\n\"\n #render json: metadata\n\n end", "def ls( *args )\r\n \r\n directory = nil\r\n opts = {}\r\n \r\n case args.count\r\n when 1\r\n if args[0].kind_of? Hash\r\n opts = args[0]\r\n else\r\n directory = args[0]\r\n end\r\n when 2\r\n directory = args[0]\r\n opts = args[1] \r\n end\r\n \r\n # args are the RPC arguments ...\r\n args = {}\r\n args[:path] = directory if directory\r\n args[:recursive] = true if opts[:recurse]\r\n args[:detail] = true if opts[:detail] \r\n args.delete(:detail) if( args[:detail] and args[:recursive])\r\n \r\n # RPC output format, default is XML\r\n outf = { :format => 'text' } if opts[:format] == :text\r\n \r\n got = @ndev.rpc.file_list( args, outf )\r\n return nil unless got\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n # if we're here, then we need to conver the output \r\n # to a Hash. Joy!\r\n \r\n collect_detail = args[:detail] || args[:recursive]\r\n \r\n ls_hash = {}\r\n got.xpath('directory').each do |dir|\r\n \r\n dir_name = dir.xpath('directory-name').text.strip\r\n dir_hash = {}\r\n \r\n dir_hash[:fileblocks] = dir.xpath('total-file-blocks').text.to_i\r\n files_info = dir.xpath('file-information')\r\n \r\n dir_hash[:files] = {} \r\n dir_hash[:dirs] = {} # sub-directories\r\n \r\n files_info.each do |file|\r\n f_name = file.xpath('file-name').text.strip\r\n f_h = {} \r\n \r\n if file.xpath('file-directory')[0]\r\n dir_hash[:dirs][f_name] = f_h\r\n else\r\n dir_hash[:files][f_name] = f_h \r\n end\r\n \r\n next unless collect_detail\r\n \r\n f_h[:owner] = file.xpath('file-owner').text.strip\r\n f_h[:group] = file.xpath('file-group').text.strip\r\n f_h[:links] = file.xpath('file-links').text.to_i\r\n f_h[:size] = file.xpath('file-size').text.to_i\r\n \r\n xml_when_item(file.xpath('file-symlink-target')) { |i|\r\n f_h[:symlink] = i.text.strip\r\n }\r\n \r\n fp = file.xpath('file-permissions')[0]\r\n f_h[:permissions_text] = fp.attribute('format').value\r\n f_h[:permissions] = fp.text.to_i\r\n \r\n fd = file.xpath('file-date')[0]\r\n f_h[:date] = fd.attribute('format').value\r\n f_h[:date_epoc] = fd.text.to_i\r\n \r\n end # each directory file\r\n ls_hash[ dir_name ] = dir_hash \r\n end # each directory\r\n \r\n return nil if ls_hash.empty?\r\n ls_hash\r\n end", "def directories; end", "def directories; end", "def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end", "def team_folder_list(trace: false, &block)\n r = dropbox_query(query: '2/team/team_folder/list', trace: trace)\n r['team_folders'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team/team_folder/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['team_folders'].each(&block)\n end\n end", "def list_files(dir)\n # Getting all the files names in the directory\n file_names = Dir[dir + \"*\"]\n\n return file_names\n\nend", "def find_files folder\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n if @subfolders\n files = sub_listing folder\n else\n path = ::File.join(@source.base_dir,folder)\n files = files_listing path\n end\n files = files_filtering files\n files = files.take(@take) if @take\n to_file(files)\n end", "def folders_listing path\n cmd = \"find #{path} -type d \"\n if @folder_regexp\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@folder_regexp}\\\"\"\n end\n folders = exec_cmd(cmd)\n folders\n end", "def file_list\n @file_list\n end", "def folders\n @conn.list(\"#{@full_name}#{@delim}\", '%').map do |f|\n Folder.new(@conn, f.name, f.delim)\n end\n end", "def dirs; end", "def dirs; end", "def folders\n xpath './folder'\n end", "def list_files(dir)\n# Getting all the files names in the directory\n file_names = Dir[dir + \"*\"]\n return file_names\nend", "def sub_content \n sub_contents = []\n\n if @is_post == false\n root_regexp = Regexp.new(@root, Regexp::IGNORECASE)\n sub_directories = Dir.glob(@absolute_path + '*');\n\n sub_directories.each do |sub_directory|\n begin\n # Remove the root from the path we pass to the new Content instance.\n # REVIEW: Should we be flexible and allow for the root dir to be present?\n content = Content.new(sub_directory.sub(root_regexp, ''))\n sub_contents.push(content)\n rescue ArgumentError\n next\n end\n end\n end\n\n sub_contents.reverse\n end", "def generate_listing(path)\n client\n listing = client.list_objects(bucket: config[:bucket], delimiter: '/', prefix: full_path(path))\n add_directories(listing)\n add_files(listing, path)\n end", "def list_boxes\r\n command = 'List-Folder'\r\n execute_outlook_script(command)\r\n end" ]
[ "0.7714473", "0.7663608", "0.7606409", "0.7468133", "0.74349385", "0.74313146", "0.7398123", "0.73818266", "0.7310131", "0.7293059", "0.72461253", "0.72320044", "0.7229761", "0.7177502", "0.706697", "0.703115", "0.6997947", "0.6979118", "0.69628465", "0.6955327", "0.6911305", "0.6864034", "0.6863755", "0.68622625", "0.68512547", "0.68359417", "0.68034345", "0.6783428", "0.6750919", "0.6718913", "0.67154884", "0.6709311", "0.6688982", "0.66331935", "0.6587951", "0.6574349", "0.65615624", "0.65396494", "0.65380514", "0.65312076", "0.65309083", "0.65279055", "0.65189886", "0.6516217", "0.65133786", "0.65079963", "0.65023327", "0.6500677", "0.64978826", "0.6497616", "0.6468418", "0.64616984", "0.6460581", "0.64595604", "0.64464134", "0.64437985", "0.6418629", "0.6417787", "0.6414743", "0.64122796", "0.6400428", "0.6399085", "0.6398006", "0.63911796", "0.6377518", "0.6373336", "0.63684696", "0.63638717", "0.63604724", "0.63601846", "0.6348608", "0.63224417", "0.6316342", "0.6307696", "0.63061", "0.6302923", "0.6287983", "0.6281351", "0.6268158", "0.62657195", "0.6257203", "0.62524325", "0.62512976", "0.62509793", "0.6249909", "0.62441796", "0.62441796", "0.6237407", "0.6232193", "0.6229142", "0.622854", "0.6225829", "0.62232715", "0.6214818", "0.6201576", "0.6201576", "0.6200902", "0.6189687", "0.618107", "0.6176719", "0.617648" ]
0.0
-1
"Now we have 1 students", whereas it should be "Now we have 1 student". How can you fix it so that it used singular form when appropriate and plural form otherwise?
def input_students puts "Please enter the names of the students" puts "To finish, just hit return twice" # create an empty array students = [] # get the first name name = gets.chomp # while the name is not empty, repeat this code while !name.empty? do # add the student hash to the array students << {name: name, cohort: :november} if students.count == 1 puts "Now we have #{students.count} student" else puts "Now we have #{students.count} students" end # get another name from the user name = gets.chomp end # return the array of students students end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_plural() name_singular + 's' end", "def singularize\n @name.pluralize.singularize\n end", "def pluralize amount, singular\n \"#{amount} #{singular}#{amount == 1 ? '' : 's'}\"\n end", "def pluralize(singularStr, num)\n if num == 1\n return singularStr\n else\n if singularStr[-1] == \"s\" # singularStr[-1] returns last character of string\n return \"#{singularStr}es\"\n else\n return \"#{singularStr}s\"\n end\n end\n end", "def print_current_students(students)\n\tstr = \"Currently we have #{students.length} student#{'s' if is_plural?(students.length)}\\n\"\n\tprint str\nend", "def pluralize(count, singular, plural = nil)\n \"#{count} \" + if count == 1\n singular\n elsif plural\n plural\n elsif Object.const_defined?(\"Inflector\")\n Inflector.pluralize(singular)\n else\n singular + \"s\"\n end\n end", "def declension(singular, plural, count)\n count == 1 ? singular : plural\n end", "def default_pluralizer(count)\n count == 1 ? :one : :other\n end", "def pluralize\n self[-1] == 's' ? \"#{self}es\" : \"#{self}s\"\n end", "def pluralize\n @name.pluralize\n end", "def inflect(word,count)\n if count>1\n word.pluralize\n else\n word\n end\n end", "def pluralizer num, noun\n if num == 1\n \"#{num} #{noun}\"\n else\n \"#{num} #{noun}s\"\n end\nend", "def plural_object_name\n singular_object_name.pluralize\n end", "def declension(singular, plural, count)\n if count == 1\n singular\n else\n plural\n end\n end", "def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end", "def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end", "def plural(input)\n input>1 ? 's' : ''\n end", "def simple_pluralize count, singular, plural=nil\n ((count == 1 || count =~ /^1(\\.0+)?$/) ? singular : (plural || singular.pluralize))\n end", "def pluralizer num,name\n \n if num >= 2\n p \"#{num} #{name}s.\"\n else\n p \"1 #{name}.\"\n end\nend", "def pluralize_word(singular)\n singular.respond_to?(:pluralize) ? singular.pluralize : singular + 's'\n end", "def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + (count == 1 ? singular : (plural || singular.pluralize))\n end", "def pluralize(count = nil)\n if count == 1\n self\n else\n MotionSupport::Inflector.pluralize(self)\n end\n end", "def pluralize(count, singular, plural)\n word = count == 1 ? singular : plural\n \"#{count || 0} #{word}\"\n end", "def singularize(str)\n Gorillib::Inflector.pluralizations.invert.fetch(str){ str.gsub(/s$/, '') }\n end", "def plural_name\n return ext_text(9001, @id) if Item.id_valid?(@id)\n\n return ext_text(9001, 0)\n end", "def pluralizer string, number\n if n == 1 \n puts \"#{number} #{string}\"\n elsif string == \"person\"\n puts \"#{number} people\"\n elsif string == \"child\"\n puts \"#{number} children\"\n elsif string == \"goose\"\n puts \"#{number} geese\"\n elsif n > 1 \n puts \"#{number} #{string}s\"\n end\nend", "def pluralizer num, noun\n if num != 1\n \"#{num} #{noun}s\"\n else \"#{num} #{noun}\"\n end\nend", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n \"#{number} #{noun}s\"\n end\nend", "def pluralize_collection collection, noun \n if collection.size == 1 \n \"1 #{noun}\"\n else \n \"#{collection.size} #{noun.pluralize}\"\n end\n end", "def pluralize_with_count( count=2 )\n count > 1 ? pluralize_without_count : singularize\n end", "def pluralize( name )\n warn_nyi( \"support for pluralization guides in pluralize()\" )\n return name.pluralize\n end", "def pluralizer string, n\n if n == 1 \n puts \"#{n} #{string}\"\n elsif n > 1 || n==0\n puts \"#{n} #{string}s\"\n end\nend", "def singularize\n ActiveSupport::Inflector.singularize(self)\n end", "def singularize\n MotionSupport::Inflector.singularize(self)\n end", "def flexi_label(singular = false)\n if singular\n self._flexi_collection.singular_label\n else\n self._flexi_collection.plural_label\n end\n end", "def pluralizer num, noun\n if num != 1\n \"#{num} #{noun}s\"\n elsif num == 1 \n \"#{num} #{noun}\"\n elsif num != 1 && noun == goose\n \"#{num}, geese\"\n end\nend", "def plural_instance_name\n info.plural_name\n end", "def to_s\n string = (id.nil? ? \"unsaved survey\" : \"survey #{id}\")\n string += \" [#{self.questions_count} \" +\n 'question'.pluralize(self.questions_count) + \"]: '#{title}'\"\n end", "def pluralize(count, singular, plural)\n word = count == 1 ? singular : plural\n \"#{count || 0} #{word}\"\nend", "def pluralize(n, singular, plural=nil)\n if n == 1 \n \"1 #{singular}\"\n elsif plural\n \"#{n} #{plural}\"\n else\n \"#{n} #{singular}s\"\n end\n end", "def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n if noun.downcase == 'geese'\n noun = 'goose'\n elsif noun.downcase == 'child'\n noun = 'children'\n elsif noun.downcase == 'person'\n noun = 'people'\n else\n noun = noun.concat('s')\n end\n \"#{number} #{noun}\"\n end\nend", "def short_title_with_lecture\n lecture.short_title + ', S.' + number.to_s\n end", "def pluralizer(num, obj)\n obj.downcase!\n if num > 1\n if obj == \"sheep\"\n return \"#{num} #{obj}\"\n elsif obj == \"goose\"\n return \"#{num} geese\"\n elsif obj == \"child\"\n return \"#{num} children\"\n elsif obj == \"person\"\n return \"#{num} people\"\n elsif obj == \"species\"\n return \"#{num} #{obj}\"\n else\n return \"#{num} #{obj}s\"\n end\n else\n return \"#{num} #{obj}\"\n end\nend", "def pluralize\n p = self[ :plural ]\n p = ! scalar? if p.nil?\n p = 's' if p == false\n p = 'p' if p == true\n p.to_s\n end", "def test_plural_ruby\n\t\tp = Print.new\n\t\tassert_equal('rubies',p.singular_or_plural(0,'rubies'))\n\tend", "def plural(int, str)\r\n return \"#{int} #{str}s\" unless int == 1\r\n \"#{int} #{str}\"\r\n end", "def pluralize(count, word)\n \"#{word}#{'s' unless count.to_i == 1}\"\n end", "def singulars\n @singulars\n end", "def pluralize_word(count, singular, plural = nil)\n ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end", "def plural(num,str)\n\n num_str = number_format(num)\n if num == 1\n return num_str + ' ' + str\n else\n return num_str + ' ' + str.pluralize\n end \n \n end", "def pluralizer (num, noun)\n return \"#{num} #{noun}\" if num == 1\n return \"#{num} geese\" if noun == \"goose\"\n return \"#{num} sheep\" if noun == \"sheep\"\n return \"#{num} #{noun}s\"\nend", "def pluralizer(noun, num)\n if num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend", "def pluralizer(noun, num)\n if num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend", "def pluralizer (num, noun)\n return \"#{num} #{noun}\"\n return \"#{num} geese\" if noun == \"goose\"\n return \"#{num} sheep\" if noun == \"sheep\"\n return \"#{num} #{noun}s\"\nend", "def book_plural books\n\t\tif books.is_a? Numeric\n\t\t\tif books == 1\n\t\t\t\t\"book\"\n\t\t\telsif (books > 1 || books == 0)\n\t\t\t\t\"books\"\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\telse\n\t\t\traise \"You messed up the books\"\n\t\tend\n\tend", "def singularize(locale = :en)\n ActiveSupport::Inflector.singularize(self, locale)\n end", "def pluralize(l_string) #count, singular, plural = nil)\n # map the arguments like in the original pluralize method\n count, singular, plural = l_string.split(',').map{ |arg| arg.strip}\n\n \"#{count} \" + if count == 1 || count == '1'\n singular\n elsif plural\n plural\n elsif Object.const_defined?(\"Inflector\")\n Inflector.pluralize(singular)\n else\n singular + \"s\"\n end\n end", "def student_name\n student = Student.find_by_admission_no(admission_no)\\\n if type == 'Student'\n student.first_name + ' ' + student.last_name\n end", "def pluralize_model(klass, options = {})\n t(\"activerecord.models.#{klass.model_name.i18n_key}\", :count => options[:count] || 2)\n end", "def pluralize\n self.class.new Inflector.pluralize(self)\n end", "def pluralize\n self.class.new Inflector.pluralize(self)\n end", "def pluralize(count, word)\n \"#{word}#{'s' unless count.to_f == 1}\"\n end", "def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale)\n word = if count == 1 || count.to_s.match?(/^1(\\.0+)?$/)\n singular\n else\n plural || singular.pluralize(locale)\n end\n\n \"#{count || 0} #{word}\"\n end", "def pluralize(string)\n if string[-1] == 'y'\n \"#{string[0..(string.length - 2)]}ies\"\n else\n \"#{string}s\"\n end\n end", "def pluralizer(num,noun)\n p noun == \"sheep\" ? \"#{num} #{noun}\" : noun == \"geese\" ? \"#{num} #{noun}\" :\n num == 1 && noun == \"child\" ? \"#{num} #{noun}\" : noun == \"child\" ? \"#{num} #{noun}ren\" :\n noun == \"children\" ? \"#{num} child\" : num == 1 && noun == \"people\" ? \"#{num} person\" :\n num > 1 ? \"#{num} #{noun}s\" : nil\nend", "def test_plural_fake_ruby\n\t\tp = Print.new\n\t\tassert_equal('fake rubies',p.singular_or_plural(0,'fake'))\n\tend", "def pluralize(n, str)\n \"#{n} #{str + (n == 1 ? \"\" : \"s\")}\"\nend", "def plural(input)\n input.dup.en.plural\n end", "def singularize(name)\n name[0, name.length - 1]\n end", "def pluralize(num, item)\n if item == :warning && num != 1\n \"#{num} Warnings\"\n else\n \"#{num} #{item.capitalize}\"\n end\n end", "def display_name_pluralize\n I18n.t(self.name, :scope => \"umlaut.service_type_names\", :default => :default, :count => 10)\n end", "def pluralize(word, nb)\n if (nb > 1)\n return \"#{word}s\"\n else\n return \"#{word}\"\n end\nend", "def subject(options)\n case [options[:person], options[:plurality]]\n when %i[first singular]\n 'I'\n when %i[first plural]\n 'we'\n when %i[second singular], %i[second plural]\n 'you'\n when %i[third singular]\n 'he'\n when %i[third plural]\n 'they'\n end\n end", "def pluralizer(num,noun)\n p num > 1 ? \"#{num} #{noun}s\" : nil\nend", "def plural_every(int, str)\r\n return \"#{int} #{str}s\" unless int == 1\r\n \"#{str}\"\r\n end", "def pluralizer (noun, num)\n if num > 1 && noun.include?('goose')\n puts \"#{num}, geese\"\n elsif num > 1\n puts \"#{num}, #{noun}s\"\n else\n puts \"#{num}, #{noun}\"\n end\nend", "def test_pluralize_one\n assert_equal \"book\", @d.pluralize(\"book\", 1)\n end", "def inflection(text, count = nil, inflect: nil)\n if (count == 1) || INFLECT_SINGULAR.include?(inflect)\n text.to_s.singularize\n elsif count.is_a?(Integer) || INFLECT_PLURAL.include?(inflect)\n text.to_s.pluralize\n else\n text.to_s.dup\n end\n end", "def singular?(plural)\n if plural =~ /s$/\n if plural =~ /ies$/\n plural.gsub(/ies$/, 'y')\n else\n plural.gsub(/s$/, '')\n end\n else\n plural #input not plural\n end\n end", "def singularize\n self.class.new Inflector.singularize(self)\n end", "def singularize\n self.class.new Inflector.singularize(self)\n end", "def pluralize(word)\n return word + \"s\" if pluralize?\n word\nend", "def singular_siegler; end", "def plural_without_count(count, word)\n count == 1 ? word : word.pluralize\n end", "def senpai_title\n \"Senpai\" if grade.senpai?\n end", "def pluralize(word); end", "def nos(number, subject)\r\n case number\r\n when 0 then \"no #{subject}s\"\r\n when 1 then \"one #{subject}\"\r\n when 2 then \"two #{subject}s\"\r\n else \"#{number} #{subject}s\"\r\n end\r\n end", "def title_plural\n self.title.pluralize\n end", "def plural(n)\n n == 1 ? \"#{n} bottle\" : \"#{n} bottles\"\nend", "def to_s # to_s is a default method for a class. it returns a string when you call the class later.\n \treturn \"I'm a student.\"\n end", "def pluralize(count)\n if custom?\n # todo: make a search from the custom inflector, if doesn't match, simply fallback to @name\n # something like OurInflector.pluralize(@name) || @name\n return @custom_name\n else\n (count == 1 || count =~ /^1([\\.,]0+)?$/) ? \n I18n.t(\"units.#{@yaml}\", :count => 1) : I18n.t(\"units.#{@yaml}\", :count => count)\n end\n end", "def test_singular_ruby\n\t\tp = Print.new\n\t\tassert_equal('ruby',p.singular_or_plural(1,'rubies'))\n\tend", "def pluralizer (noun, number)\n if number == 0 || number == 1\n puts \"#{number} #{noun}\"\n elsif number > 1\n puts \"#{number} #{noun}s\"\n else \n puts \"Please enter a valid positive number\"\n end\nend", "def to_s\r\n \"#{@name}, #{@age}, #{@@num_of_students}\"\r\n end", "def plural(n, item)\n n == 1 ? \"#{n} #{item}\" : \"#{n} #{item}s\"\nend", "def format\n self.songs.size > 1 ? s = \"songs\" : s = \"song\"\n \"#{self.name.capitalize}\"\n end", "def test_singular_fake_ruby\n\t\tp = Print.new\n\t\tassert_equal('fake ruby',p.singular_or_plural(1,'fake'))\n\tend" ]
[ "0.7358244", "0.7048985", "0.6884443", "0.6814316", "0.6781599", "0.6774531", "0.66924506", "0.6687421", "0.6637264", "0.66333646", "0.6627698", "0.66138667", "0.66124827", "0.6603577", "0.65987253", "0.65987253", "0.6568178", "0.65628666", "0.65573555", "0.65541774", "0.65026206", "0.6492005", "0.64871126", "0.6471357", "0.64566684", "0.644791", "0.64469624", "0.64372635", "0.64367497", "0.64367497", "0.64367497", "0.64358157", "0.64237773", "0.6368576", "0.63569015", "0.63524103", "0.63482344", "0.63355064", "0.63281965", "0.6321411", "0.63190484", "0.62981886", "0.6295803", "0.6294943", "0.6286839", "0.62839955", "0.62740767", "0.62715805", "0.6271504", "0.6256337", "0.6239472", "0.6236722", "0.6229062", "0.62218124", "0.6208362", "0.6204296", "0.6204296", "0.62021095", "0.61663413", "0.6147096", "0.61456245", "0.61427325", "0.6125307", "0.61242217", "0.61242217", "0.61084753", "0.6092407", "0.6085916", "0.608544", "0.60667115", "0.60639864", "0.60616195", "0.60574085", "0.6056262", "0.6044682", "0.60365206", "0.6034278", "0.6030373", "0.6021548", "0.60195446", "0.6009641", "0.5997103", "0.59748065", "0.59670717", "0.59670717", "0.59612966", "0.595356", "0.59525806", "0.59495044", "0.5948165", "0.59370834", "0.5937069", "0.5931705", "0.5912673", "0.59077775", "0.59037507", "0.5897426", "0.5892427", "0.5890222", "0.5884072", "0.58583885" ]
0.0
-1
inits a new FormVersion with same form_id increments sequence sets self.is_current = false
def upgrade! upgraded = self.class.new(form_id: form_id, is_current: true) self.is_current = false save upgraded.save! upgraded end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_new_revision\n new_revision = Form.new(version_independent_id: version_independent_id,\n description: description, parent_id: parent_id, status: status,\n version: version + 1, name: name, oid: oid,\n created_by: created_by, control_number: control_number)\n\n new_revision\n end", "def upgrade_version!\n raise \"standard forms should not be versioned\" if is_standard?\n\n if current_version\n self.current_version = current_version.upgrade\n else\n self.build_current_version(:form_id => id)\n end\n\n # since we've upgraded, we can lower the upgrade flag\n self.upgrade_needed = false\n\n # reset downloads since we are only interested in downloads of present version\n self.downloads = 0\n\n save(:validate => false)\n end", "def upgrade_version!\n if current_version\n self.current_version = current_version.upgrade\n else\n self.build_current_version(:form_id => id)\n end\n \n # since we've upgraded, we can lower the upgrade flag\n self.upgrade_needed = false\n \n save(:validate => false)\n end", "def create_new_version!\n if self.new?\n raise DataCatalog::Error, \"document must be saved before versioning\"\n end\n unless self.id\n raise DataCatalog::Error, \"expected document to have an id\"\n end\n copy = self.dup\n copy.id = BSON::ObjectID.new.to_s\n copy.next_id = self.id\n copy.save!\n self.previous_id = copy.id\n copy\n end", "def set_new_version\n @saving_version = new_record? || save_version?\n self.send(\"#{self.class.version_column}=\", next_version) if new_record? || (!locking_enabled? && save_version?)\n end", "def set_v1_form\n @v1_form = V1::Form.find(params[:id])\n end", "def upgrade\n upgraded = self.class.new(:form_id => form_id, :sequence => sequence + 1)\n self.is_current = false\n save\n return upgraded\n end", "def create_initial_version_if_necessary\n if self.class.vestal_versions_options[:initial_version]\n # the Rails 3 version will implement create_initial_version? if so\n # then we let it do it's thing.\n unless self.private_methods.include?(:create_initial_version?.to_s)\n versions.create({:changes => version_changes, :number => 1, :user => User.current})\n reset_version_changes\n reset_version \n end\n end\n end", "def _new_form(id, atrb = Hashx.new)\n self[id] = context_module('Form').new(@cfg, atrb.update(id: id))\n end", "def create_version(attributes = nil)\n add_version(Version.create(attributes || version_attributes))\n reset_version\n end", "def build_version(new_attrs = {})\n new_version = self.class.new(new_version_attrs(new_attrs)).tap do |built|\n built.deprecate_old_versions_after_create!\n preserve_has_one_associations_to(built) \n end\n end", "def spawn_version(mode = :update)\n mode = :create if historical_creation\n\n version = self.class.historical_version_class.new\n version.tap do |v|\n v._record_id = id\n v._record_type = self.class.name\n\n attribute_names.each do |attr_name|\n attr = attr_name.to_sym\n next if Historical::IGNORED_ATTRIBUTES.include? attr\n v.send(\"#{attr}=\", self[attr])\n end\n\n v.meta = self.class.historical_meta_class.new.tap do |m|\n m.creation = (mode == :create)\n m.created_at = Time.now.utc\n end\n\n previous = v.previous\n\n if !v.creation? and previous\n v.diff = self.class.historical_diff_class.from_versions(previous, v)\n end\n\n (self.class.historical_callbacks || []).each do |callback|\n callback.call(v)\n end\n\n v.save!\n\n self.spawned_version = v\n end\n end", "def current_version\n self._version ||= 0\n end", "def new_version\n @version = Time.now.to_i\n end", "def form_code\n @form.current_version.code\n end", "def new_version\n @title = \"Create New Agreement Version\"\n @agreement = Agreement.find(params[:id])\n @version = AgreementVersion.new\n end", "def initialize(form, current_user)\n @form = form\n @current_user = current_user\n @attached_to = nil\n end", "def set_version\n @version = Version.find(params[:id])\n end", "def initialize(version = Version.create('0'))\n @version = version\n end", "def create_new_version?\n !previously_new_record? || (previously_new_record? && !delay_first_version)\n end", "def set_form\n @form = Form.find(params[:form_id])\n end", "def set_form\n @form = Form.find(params[:form_id])\n end", "def set_form\n @form = Form.find(params[:form_id])\n end", "def set_form\n @form = Form.find(params[:form_id])\n end", "def set_version\n self.version ||= latest_version + 1\n end", "def new\r\n \t@sprint = @project.versions.build(params[:version])\r\n sprints = Version.find(:all, :conditions => [\"project_id = ?\",@project.id], :order => 'effective_date DESC')\r\n if sprints.size > 0\r\n @sprint.name = \"Sprint \" + (sprints.size + 1).to_s\r\n @sprint.effective_date = sprints.first.effective_date.advance(:days => 14)\r\n else\r\n @sprint.name = \"Sprint 1\"\r\n tmp_date = Time.now.advance(:days => 14)\r\n @sprint.effective_date = Date.new(tmp_date.year, tmp_date.month, tmp_date.day)\r\n end\r\n# @sprint = Sprint.new\r\n# sprint = Sprint.find_by_project_id(@project, :order => 'name DESC')\r\n# if sprint\r\n# @sprint.sprint_no = sprint.sprint_no + 1\r\n# @sprint.start_date = sprint.start_date.advance(:days => sprint.duration)\r\n# @sprint.duration = sprint.duration\r\n# else\r\n# @sprint.sprint_no = 1\r\n# @sprint.start_date = Time.now\r\n# @sprint.duration = 14\r\n# end\r\n render :partial => \"sprints/new\"\r\n end", "def bt_new_version(attributes={})\n self.class.new(bt_value_attributes) do |rec|\n rec.bt_attributes = attributes\n rec.vtstart_at ||= vtstart_at\n rec.vtend_at ||= vtend_at\n end\n end", "def create_first_version?\n delay_first_version && !previously_new_record? && first_version.nil?\n end", "def current_version\n self.historical? ? self.class.find(self.id) : self\n end", "def current_version\n self.historical? ? self.class.find(self.id) : self\n end", "def new\n @parent = get_parent_from_params\n @document = @parent.documents.build\n @document.versions.build\n end", "def initialize(versioned_module)\n @latest_version = versioned_module\n end", "def set_form\n @form = Form.find(params[:id])\n end", "def set_form\n @form = Form.find(params[:id])\n end", "def revert_to(version)\n if version.is_a?(self.class.versioned_class)\n return false unless version.send(self.class.versioned_foreign_key) == id and !version.new_record?\n else\n return false unless version = versions.where(self.class.version_column => version).first\n end\n self.clone_versioned_model(version, self)\n send(\"#{self.class.version_column}=\", version.send(self.class.version_column))\n true\n end", "def set_form\n #@form = Form.find(params[:id])\n end", "def create\n @project_version = ProjectVersion.new(params[:project_version])\n @project_version.user_id = current_user.id\n if @project_version.save\n redirect_to project_path(@project_version.project_id), :notice => \"Nova Versao cadastrada com sucesso.\"\n else\n render :action => 'new'\n end\n end", "def initialize(form)\n @form = form\n end", "def new?\n # not sure..\n self.db4o_id == 0\n # or maby it should be\n # self.uuid.nil?\n end", "def save_version_on_create\n\t\t\t\t\t$TRACE.debug 9, \"save_version_on_create, changed_attributes = #{changed_attributes_aado.inspect}\"\n\t\t\t\t\tif self.database_object then\n\t\t\t\t\t\tself.database_object.save_version_on_create(self.id)\n\t\t\t\t\t\t\n\t\t\t\t\t\tsave_version if save_version?\n\t\t\t\t\tend\n\t\t\t\tend", "def new\r\n \t@sprint = @project.versions.build(params[:version])\r\n sprints = Version.find(:all, :conditions => [\"project_id = ?\",@project.id], :order => 'effective_date DESC')\r\n if sprints.size > 0\r\n @sprint.name = \"Sprint \" + (sprints.size + 1).to_s\r\n @sprint.effective_date = sprints.first.effective_date.advance(:days => 14)\r\n else\r\n @sprint.name = \"Sprint 1\"\r\n tmp_date = Time.now.advance(:days => 14)\r\n @sprint.effective_date = Date.new(tmp_date.year, tmp_date.month, tmp_date.day)\r\n end\r\n render :partial => \"sprints/new\"\r\n end", "def set_form\n @form = Form.find(params[:id])\n end", "def set_form\n @form = Form.find(params[:id])\n end", "def create_version!(new_attrs = {})\n create_operation do\n self.class.create!(new_version_attrs(new_attrs))\n end\n end", "def next_version\n (new_record? ? 0 : versions.calculate(:maximum, version_column).to_i) + 1\n end", "def flag_for_upgrade!\n raise \"standard forms should not be versioned\" if is_standard?\n\n self.upgrade_needed = true\n save(:validate => false)\n end", "def current\n self.versioned? ? self.versions.current.instance : self\n end", "def current\n document.new? ? document.clone.extend(VersionedDocument) : self[document.version]\n end", "def nextVersion\n newRevision(@year, @month, @revCount.nil? ? 1 : @revCount + 1)\n end", "def new(form_class, form)\n return false unless set_up_form(form_class, form, params[:token], true)\n\n fetch_presenters\n\n # Return 'true' by default so the `return unless super(...)` bits in\n # subclassed controllers don't fail.\n true\n end", "def spoofForm(val)\n @deltaflag = false\n @form = val\n end", "def save_version\n if @saving_version\n @saving_version = nil\n rev = self.class.versioned_class.new\n clone_versioned_model(self, rev)\n rev.send(\"#{self.class.version_column}=\", send(self.class.version_column))\n rev.send(\"#{self.class.versioned_foreign_key}=\", id)\n rev.save\n end\n end", "def set_model_version\n @model_version = ModelVersion.find(params[:id])\n end", "def new?\n !rev\n end", "def find_or_initialize_multipart_in_progress_form(form_name, form_subject)\n # find or create the in progress form\n # not sure why the polymorphic relationship isn't working here\n in_progress_form = MultipartForm::InProgressForm.where(\n :form_subject_id => form_subject.id, \n :form_subject_type => form_subject.class.to_s, \n :form_name => form_name.to_s).first\n\n # if the form subject is a new_record, in_progress_form should be nil\n # trying to stop weird edge cases from killing me (JH 5-15-2012)\n if form_subject.new_record? || !in_progress_form\n in_progress_form = MultipartForm::InProgressForm.new(\n :form_subject_id => form_subject.id, \n :form_subject_type => form_subject.class.to_s, \n :form_name => form_name.to_s, \n :last_completed_step => \"none\", \n :completed => false)\n end\n return in_progress_form\n end", "def editable_version\n parent_version.nil? ? self : parent_version\n end", "def new\n restrict('allow only doctor users') or begin\n return redirect_to(doctor_dashboard_url) if params[:form_type] == 'chooser'\n @patient = Patient.find_by_id(params[:patient_id]) || Patient.create(:doctor => current_doctor)\n return redirect_to doctor_dashboard_path() unless @patient.doctor_id == current_user.doctor_id\n @form_instance = FormInstance.new(\n :user => current_user,\n :doctor => current_doctor,\n :patient => @patient,\n :form_type => current_form_model, #Automatically creates the connected form data via the appropriate (given) model\n :status => 'draft'\n )\n\n if @form_instance.form_data.update_attributes(@patient.attributes)\n # @form.instance = FormInstance.new(\n # :user_id => current_user.id,\n # :doctor_id => current_doctor.id,\n # :patient_id => @patient.id,\n # :form_type => FormType.find_by_form_type(params[:form_type]),\n # :form_type_id => FormType.find_by_form_type(params[:form_type]).id,\n # :status => 'draft')\n if @form_instance.save\n redirect_to doctor_forms_url(:form_status => 'draft', :form_type => @form_instance.form_data_type, :action => 'draft', :form_id => @form_instance.form_data_id)\n else\n render :action => 'draft'\n end\n else\n render :action => 'draft'\n end\n end\n end", "def new\n \n @form =Forms.new \n end", "def initialize(p_form, p_parent)\n\t\t\n\t\t\t# Assign usual instance vars, reference to form and parent\n\t\t\t@form = p_form\n\t\t\t@parent = p_parent\n\t\t\tsuper(p_parent)\n\t\t\t\n\t\t\t# Initialize attributes\n\t\t\t@dir_browse_form = nil\n\t\t\t\t\t\n\t\t\t# Flag, used once for proper form initialization\n\t\t\t@initialized = false\n\t\tend", "def duplicate\n # get the base name\n base = name.match(/^(.+?)( v(\\d+))?$/)[1]\n version = (self.class.max_version(base) || 1) + 1\n # create the new form and set the basic attribs\n cloned = self.class.new(:mission_id => mission_id, :name => \"#{base} v#{version}\", :published => false, :form_type_id => form_type_id)\n # clone all the questionings\n cloned.questionings = Questioning.duplicate(questionings)\n # done!\n cloned.save\n end", "def new\n @mobile_app = MobileApp.new\n @mobile_app.language = \"English\"\n if current_user.agency\n @mobile_app.primary_agency_id = current_user.agency.id\n end\n @mobile_app.primary_contact_id = current_user.id\n @mobile_app.mobile_app_versions.build\n end", "def set_form\n @form = FormKit::Form.find(params[:id])\n end", "def new?\n !@id\n end", "def new\n @app_version = @app.app_versions.build\n # @app_version = AppVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app_version }\n end\n end", "def set_validform\n @validform = Validform.find(params[:id])\n end", "def current_live\n self.versioned? ? self.versions.current_live.instance : self\n end", "def init_forms\n super\n\n ### UPDATE NOW ###\n fo = @fw.add_form(\"update_now\")\n fo.required_notice = false\n fo.per_field_action = true\n fi = fo.add_field(\"update_file\", \"file\", { \"action\" => \"update\", \"size\" => 30 })\n end", "def version_id=(value)\n @version_id = value\n end", "def initialize(form_object)\n @form_object = form_object\n end", "def reset_initial_version\n @initial_version = last_committed_sequence_number\n end", "def new\n \tif params[:id]\n \t\t@old_doc = Doc.find(params[:id])\n \t\t@doc = Doc.new({:component => @old_doc.component, :maj_version => (params[:version] == \"major\" ? @old_doc.maj_version + 1 : @old_doc.maj_version ), :min_version => (params[:version] == \"minor\" ? @old_doc.min_version + 1 : @old_doc.min_version), :dev_stage => @old_doc.dev_stage, :url => @old_doc.new_version_url(params[:version]), :contents => @old_doc.contents})\n \telse\n\t @doc = Doc.new\n\t\tend\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doc }\n end\n end", "def new?\n id.nil?\n end", "def new?\n id.nil?\n end", "def new?\n id == nil\n end", "def new?\n !rev\n end", "def new?\n !rev\n end", "def form_data_initialize(form)\n form = form_generation(form)\n form = 0 unless GameData::Pokemon.all[id][form]\n @form = form\n exp_initialize\n end", "def version\n @version ||= create_version\n end", "def new?\n @id.nil?\n end", "def new?\n id.nil? || id == 0\n end", "def initialize(version = :niv)\n raise InvalidBibleVersion unless BIBLE_VERSIONS.has_key?(version)\n\n @version = version.to_s.upcase\n @version_number = BIBLE_VERSIONS[version][:id]\n @version_name = BIBLE_VERSIONS[version][:name]\n super()\n end", "def new?\r\n id.nil?\r\n end", "def set_approved_version_id_callback\n lambda do |live_obj, draft_obj|\n draft_obj.approved_version_id = live_obj.id if draft_obj.respond_to?(:approved_version_id)\n draft_obj.temporary_approved_object = live_obj\n true\n end\n end", "def create_version(new_attrs = {})\n create_operation do\n self.class.create(new_version_attrs(new_attrs))\n end\n end", "def update_form!\n form_attributes = attributes.except 'form_id', 'user_id', 'id'\n form = self.form || Form.new\n form.update form_attributes\n # Don't need to retain the fields, since the draft will be deleted.\n # Just switch them over to belonging to the form.\n form.fields.delete_all\n fields.update_all form_draft_id: nil, form_id: form.id\n delete\n end", "def new?\n id.nil?\n end", "def new?\n id.nil?\n end", "def new?\n id.nil?\n end", "def new?\n #(self.part_number_id > 0 && self.part_number) ? self.part_number.new? : true\n self.pcb_number.blank? ? true : false\n end", "def new\n @api_version = ApiVersion.new\n\n # create the translation object for however many locales there are\n # so the form will properly create all of the nested form fields\n I18n.available_locales.each do |locale|\n @api_version.api_version_translations.build(:locale => locale.to_s)\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_version }\n end\n end", "def insert_in_form_at(form, position=1)\n form_field = FormField.find(:first, :conditions => ['form_id = ? and field_number = ?', form.id, position])\n if form_field\n # desired position already taken. Push everyone at and after my position down\n form_fields = FormField.find(:all, :conditions => ['form_id = ? and field_number >= ?', form.id, position]).collect{|ff| ff}\n form_fields.each{|form_field|\n form_field.field_number += 1\n form_field.save\n }\n end\n # assign position to self in this form\n new_form_field = FormField.new(:form_id => form.id, :field_id => self.id, \n :field_number => position, \n :creator => User.current_user.id,\n :date_created => Time.now)\n new_form_field.save\n end", "def versioned_definition\n return @versioned_definition unless @versioned_definition.nil? ||\n @versioned_definition.def_version.nil? && id\n\n return @versioned_definition = current_definition if current_definition.use_current_version\n\n return @versioned_definition = current_definition if respond_to?(:use_current_version) && use_current_version\n\n unless respond_to?(:use_def_version_time) || respond_to?(:created_at)\n return @versioned_definition = current_definition\n end\n\n version_at = use_def_version_time if respond_to?(:use_def_version_time)\n version_at ||= created_at if respond_to?(:created_at)\n @versioned_definition = self.class.definition.versioned(version_at) || current_definition\n end", "def set_version_control\n @version_control = VersionControl.find(params[:id])\n end", "def create\n params[:instance][:sequence] = 999999999 if @setup_controller[:sequence_exists]\n params[:instance][:parent_id] = 0 if @setup_controller[:parent_exists] && params[:instance][:parent_id].blank?\n params[:instance].merge! @setup_controller[:fixed_attributes] if @setup_controller[:fixed_attributes]\n\n transform_list(params[:instance])\n @instance = @setup_controller[:model].new(params[:instance])\n if @instance.save\n\n initial_sequence_for(@setup_controller[:parent_exists] ? @instance.parent_id : '') if @setup_controller[:sequence_exists]\n\n flash[:notice] = \"'%{element_dynamique}' créé avec succès.\".trn(:element_dynamique => @setup_controller[:instance_name])\n\n if @setup_controller[:parent_exists]\n redirect_to :action => \"list\", :parent_id => params[:instance][:parent_id]\n else\n redirect_to :action => \"list\"\n end\n else\n params[:action]=\"new\"\n @parent = @setup_controller[:parent_exists] && params[:instance][:parent_id] && params[:instance][:parent_id].to_i > 0 ? @setup_controller[:model].find_by_id(params[:instance][:parent_id]) : nil \n @back_to_parent = (@parent.blank? || @parent.ancestors.count == 0 ? \"\" : (@parent.children.count == 0 ? @parent.ancestors[0].id : @parent.id))\n\n respond_to do |format|\n format.html {render \"shared/dynamic/new\"} \n format.js do \n @element_id, @partial = 'list_main_div', 'shared/dynamic/new_main'\n render 'shared/replace_content' \n end\n end\n end\n end", "def before_create \n self.ver = 0\n end", "def initialize( parent_path )\n @id = -1\n @name = 'undefined'\n @valid = false\n @path = \"#{parent_path}:screen[-1]\"\n @changes = []\n @new_changes = false\n end", "def initialize(p_form, p_parent)\n\n # Call base class constructor\n super(p_parent)\n\n # Initialize form and parent\n @form = p_form\n @parent = p_parent\n\n # Initialize attributes\n @tools = []\n end", "def next_version\r\n vals = []\r\n vals.push( *@values)\r\n BindingData.new vals, @version+1\r\n end", "def set_appversion\n @appversion = Appversion.find(params[:id])\n end", "def new(form_class, form)\n set_up_form(form_class, form, params[:token], get_request: true)\n end" ]
[ "0.6447004", "0.6347048", "0.61970085", "0.6055881", "0.588652", "0.58547413", "0.58372754", "0.5676159", "0.56503123", "0.5439611", "0.5434107", "0.54320484", "0.54302776", "0.54217315", "0.5354525", "0.53467596", "0.5339406", "0.53387105", "0.53312725", "0.53083193", "0.5295291", "0.5295291", "0.5295291", "0.5295291", "0.5290024", "0.525305", "0.5233802", "0.5217292", "0.5191238", "0.5191238", "0.51803124", "0.51640064", "0.5162766", "0.5160508", "0.51536965", "0.5149797", "0.5135386", "0.51245415", "0.511032", "0.51066756", "0.5103237", "0.5101532", "0.5101532", "0.5093327", "0.50899017", "0.50862366", "0.5083041", "0.50654894", "0.50512916", "0.5046055", "0.50282896", "0.50262976", "0.5001429", "0.49964112", "0.49897838", "0.49849954", "0.49802807", "0.49776143", "0.49764368", "0.49548432", "0.4953431", "0.49507192", "0.49449888", "0.49425155", "0.49419755", "0.49360391", "0.49357378", "0.49327448", "0.49314892", "0.4921053", "0.4910353", "0.49067202", "0.49067202", "0.49011186", "0.48976198", "0.48976198", "0.48957437", "0.48927757", "0.48894793", "0.4887993", "0.4883321", "0.4875757", "0.48727778", "0.48680586", "0.4865554", "0.48620927", "0.48620927", "0.48620927", "0.48576885", "0.4855095", "0.48528805", "0.48495418", "0.48485562", "0.48126584", "0.4811011", "0.48053327", "0.48030797", "0.48009297", "0.4796227", "0.47884938" ]
0.6391297
1
generates the unique random code
def generate_code # only need to do this if code not set return if code ensure_unique_code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateCode()\n require 'securerandom'\n return SecureRandom.hex\n end", "def generate_code\n self.code = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{user_id}--#{rand(256)}\")[0,32]\n end", "def generate_code\n self.code = SecureRandom.uuid if code.blank?\n end", "def build_hash_code\n\t\tSecureRandom.hex(8) + (Time.now.to_f * 1000).to_i.to_s\n\tend", "def generate_code(code_length=6)\n chars = (\"a\"..\"z\").to_a + (\"1\"..\"9\").to_a \n new_code = Array.new(code_length, '').collect{chars[rand(chars.size)]}.join\n Digest::MD5.hexdigest(new_code)[0..(code_length-1)].upcase\n end", "def generate_hash_code\n\t\tself.hash_code = rand(999999)\n\tend", "def generate_code\n loop do\n self.code = SecureRandom.urlsafe_base64(40)\n break if valid?\n end\n end", "def generate_unique_code\n begin\n new_code = generate_code(self.code_length)\n end until !active_code?(new_code)\n new_code\n end", "def autogenerate_code\n self.code = String.random_alphanumeric if self.code.length == 0\n end", "def generate_unique_mac\n sprintf('b88d12%s', (1..3).map{\"%0.2X\" % rand(256)}.join('').downcase)\n end", "def gen_id\n SecureRandom.hex(32)\n end", "def get_next_uuid\n rand(8**32).to_s(36)\n end", "def generate_token\n UUIDTools::UUID.random_create.to_s\n end", "def gen_uuid\n arr = [('a'..'f'), (0..9)].map{|i| i.to_a}.flatten\n uuid = \"\"\n 8.times {uuid << arr[rand(16)].to_s} ; uuid << \"-\"\n 3.times {4.times {uuid << arr[rand(16)].to_s} ; uuid << \"-\"}\n 12.times {uuid << arr[rand(16)].to_s}\n uuid\nend", "def generate_accessCode\n return ((0..9).to_a + (\"a\"..\"z\").to_a).shuffle[0..5].join(\"\")\n end", "def random_id\n \"#{('a'..'z').to_a.sample}-#{SecureRandom.alphanumeric(6)}\"\n end", "def make_activation_code\n self.activation_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )\n end", "def generateGuid\n def s4() ((1 + rand) * 0x10000).round.to_s(16)[1..-1] end\n \"#{s4}#{s4}#{s4}#{s4}\"\n end", "def generate_confirm_code\n\t\tcode = ('A'..'Z').to_a.shuffle[0,4].join\n\tend", "def randstr\n\trand(36 ** 8).to_s(36)\nend", "def generate_random_id\n len = 8\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n newpass = \"\"\n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }\n return newpass\n end", "def random_code\n code = ''\n arr = []\n 4.times { arr.push(rand(1..7)) }\n arr.each do |x|\n code += replace_array_value_to_char(x)\n end\n code\n end", "def generate_id\n SecureRandom.hex(8)\n end", "def get_random_identifier\n SecureRandom.hex\n end", "def make_activation_code\n self.activation_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )\n end", "def identifier\n SecureRandom.hex(16)\n end", "def generate_id\n SecureRandom.urlsafe_base64 21\n end", "def generate_backup_code\n ROTP::Base32.random_base32(16).scan(/.{1,4}/).join('-')\n end", "def uniqid\n SecureRandom.hex(32)\n end", "def uniqid\n SecureRandom.hex(32)\n end", "def ran_str_maker\r\n length = 10\r\n ran_str = rand(36**length).to_s(36)\r\n return ran_str\r\nend", "def generateRandomString ()\n return SecureRandom.hex(4)\nend", "def rand_uuid\n [8,4,4,4,12].map {|n| rand_hex_3(n)}.join('-').to_s\nend", "def rand_uuid\n [8,4,4,4,12].map {|n| rand_hex_3(n)}.join('-').to_s\nend", "def random_code\n require 'securerandom'\n # Generate a secure random code\n randomize = SecureRandom.hex(16)\n # Store code generated on barcode_128 in string format\n @barcode_128 = randomize.to_s.downcase\n return @barcode_128\n end", "def generate_code(attempts = 0)\n if attempts > 4\n raise \"Could not generate unique code\"\n else\n self[:code] = \"#{prefix}#{SecureRandom.hex(3)}#{suffix}\".upcase\n generate_code(attempts + 1) if self.class.exists?(:code => code)\n end\n end", "def createGuid\n chars = (0...2).map{ ('a'..'z').to_a[rand(26)] }.join\n prefix = \"#{Time.new.year}#{chars}-\"\n\n return prefix + SecureRandom.uuid\nend", "def random_token\n 32.times.map{ rand(36).to_s(36) }.join # 32 alphanumeric characters\n end", "def generate_unique_name\n SecureRandom.uuid\n end", "def generate_code\n # only need to do this if code not set\n return if code\n\n ensure_unique_code\n end", "def rand_uuid\n [8,4,4,4,12].map {|n| rand_hex_3(n)}.join('-').to_s\n end", "def unique_id\n # Consider using SecureRandom.hex here, and benchmark which one is better\n (Time.now.to_f * 1000).to_i.to_s(36) + rand(1_000_000).to_s(36)\n end", "def generate_random_key\n (0...8).map { 65.+(rand(25)).chr }.join\n end", "def generate_string\n (0...6).map{(65+rand(26)).chr}.join\n end", "def uuid_generator\n character_set = %w(a b c d e f 0 1 2 3 4 5 6 7 8 9)\n\n uuid = ''\n\n [8, 4, 4, 4, 12].each do |num|\n num.times { uuid << character_set.sample }\n uuid << '-' if num != 12\n end\n\n uuid\nend", "def generate_uuid\n\t\t\t\tSecureRandom.hex(5)\n\t\t\tend", "def generate_activation_code(size = 4)\n charset = %w{ 1 2 3 4 5 6 7 8 9}\n self.code = (0...size).map{ charset.to_a[rand(charset.size)] }.join\n end", "def generate_sid\n \"%0#{@default_options[:sidbits] / 4}x\" %\n rand(2**@default_options[:sidbits] - 1)\n end", "def generate_secret_code\n code = Array.new(4)\n code.map! do |code| \n code = generate_random_color\n end\n end", "def generate_uuid\n UUIDTools::UUID.random_create.to_s\n end", "def generate_uuid\n hexadecimals = ('0'..'9').to_a.concat(('a'..'f').to_a)\n uuid = ''\n\n 32.times do\n uuid += hexadecimals.sample\n end\n uuid.insert(8, '-').insert(13, '-').insert(18, '-').insert(23, '-')\nend", "def random_referral_code\n code = Rufus::Mnemo::from_integer rand(100**5)\n while referral_code_existed?(code)\n code = Rufus::Mnemo::from_integer rand(100**5)\n end\n \"#{code}\"\n end", "def uuid()\n 8.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 4.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 4.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 4.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 12.times.map { [*'0'..'9', *'a'..'f'].sample }.join\nend", "def generate_uuid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n self.uuid = (0..UUID_LEN-1).collect { chars[Kernel.rand(chars.length)] }.join\n end", "def random_code\n existing_codes = Url.select(:shortened_url).map(&:shortened_url)\n new_code = [*('A'..'Z'),*('0'..'9')].shuffle[0,4].join\n\n while existing_codes.include?(new_code)\n new_code = [*('A'..'Z'), *('0'..'9')].shuffle[0,4].join\n end\n\n new_code\n end", "def generate_id\n now = Time.now\n parts = [now.to_i, now.usec, $$, rand(16**8)]\n parts.map {|i| i.to_s(16)}.join('-')\n end", "def gen_uid\n \"#{rand(100000)}-#{Time.now.to_i}-#{rand(100000)}\"\n end", "def generate_unique_key\n\n # @TODO:need to update the algo. Right now it's very simple algo\n length = self.url.length\n rand(36**length).to_s(36)\n end", "def make_password_reset_code\n self.password_reset_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )\n end", "def uuid\n hex = ((0..15).to_a).zip((('0'..'9').to_a).concat(('a'..'f').to_a)).to_h\n result = \"\"\n 32.times do\n result << hex[rand(0..15)]\n end\n result.insert(8, '-')\n result.insert(13, '-')\n result.insert(18, '-')\n result.insert(23, '-')\n result\nend", "def uuid\n time = Time.now.to_i.to_s(16)\n second = rand(10000..99999).to_s(16)\n third = rand(10000..99999).to_s(16)\n fourth = rand(10000..99999).to_s(16)\n fifth = rand(10000000000000..99999999999999).to_s(16)\n\n \"#{time}-#{second}-#{third}-#{fourth}-#{fifth}\"\nend", "def make_uuid()\n uuid = \"\"\n 8.times { uuid << rand(16).to_s(16) }\n uuid << \"-\"\n 3.times do\n 4.times { uuid << rand(16).to_s(16) }\n uuid << \"-\"\n end\n 12.times { uuid << rand(16).to_s(16) }\n \n uuid\nend", "def generate_password\r\n return rand(36 ** 20).to_s(36)\r\n end", "def get_random\n File.read(\"/dev/urandom\", 8).unpack(\"H*\")[0].hex\n rescue\n rand(9117854927)\n end", "def generate_uuid\n hex = []\n (0..9).each { |i| hex << i.to_s }\n ('a'..'f').each { |l| hex << l }\n\n result = []\n sections = [8, 4, 4, 4, 12]\n\n sections.each do |num|\n num.times do \n result << hex[rand(16)]\n end\n result << '-'\n end\n\n result.join.chop\nend", "def generate_name\n @seed ||= 0\n @seed += 1\n \"_anon_#{@seed}\"\n end", "def generate_uid\n [Time.now.strftime('%Y%m%d%H%M%S'), \"%05d\" % rand(10000)].join\n end", "def random_name\n SecureRandom.hex(20)\n end", "def uuid_generator\n uuid = []\n \n segments = [8, 4, 4, 4, 12]\n segments.each do |num|\n uuid << CHARS.sample(num).join\n end \n \n p uuid.join('-')\nend", "def generate_new_id\n UUIDTools::UUID.random_create.to_s\n end", "def rand_id\n rand(10**7...10**8).to_s\n end", "def generate_cnonce\n\n Digest::MD5.hexdigest(\"%x\" % (Time.now.to_i + rand(65535)))\n end", "def generate_phone_verification_code\n verification_code = SecureRandom.hex(3)\n verification_code\n end", "def generate_unique_key(now = Time.now)\n u1 = ((now.to_i*1000*1000+now.usec) << 12 | rand(0xfff))\n uid = [u1 >> 32, u1 & 0xffffffff, rand(0xffffffff), rand(0xffffffff)].pack('NNNN')\n uid.unpack('C*').map { |x| \"%02x\" % x }.join\n end", "def generate_UUID_1\n uuid = ''\n hex_index = (0..15)\n hex_values = ('0'..'9').to_a + ('a'..'f').to_a\n\n (0..8).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid << '-'\n (0..4).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid << '-'\n (0..4).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid << '-'\n (0..12).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid\nend", "def short_uuid\n rand(36**8).to_s(36)\n end", "def generate_free_insurance_id\n return 'AiShanXing' + DateTime.current.in_time_zone('Beijing').to_s(:number) + ('0'..'9').to_a.shuffle[0..3].join\n end", "def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end", "def uuid\n chars = ('a'..'z').to_a + (1..9).to_a\n p \"#{chars.sample(8).join}-#{chars.sample(4).join}-#{chars.sample(4).join}-#{chars.sample(4).join}-#{chars.sample(12).join}\" \n \nend", "def unique_transaction_number\n chars = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten\n string = (0...10).map{ chars[rand(chars.length)] }.join + Time.now.to_i.to_s\n end", "def new_random_url_code\n codes = MassEmail.all.map{|m|m.url_code}.map{|u|u.to_i}\n new_code = Random.rand(9999999)\n while codes.include?(new_code)\n new_code = Random.rand(9999999)\n end\n new_code.to_s.rjust(7, '0')\nend", "def new_random_url_code\n codes = MassEmail.all.map{|m|m.url_code}.map{|u|u.to_i}\n new_code = Random.rand(9999999)\n while codes.include?(new_code)\n new_code = Random.rand(9999999)\n end\n new_code.to_s.rjust(7, '0')\nend", "def rand_uuid\n values = [\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x1000000),\n rand(0x1000000),\n ]\n \"%04x%04x%04x%04x%04x%06x%06x\" % values\n end", "def rand_uuid\n values = [\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x1000000),\n rand(0x1000000),\n ]\n \"%04x%04x%04x%04x%04x%06x%06x\" % values\n end", "def rand_uuid\n values = [\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x1000000),\n rand(0x1000000),\n ]\n \"%04x%04x%04x%04x%04x%06x%06x\" % values\n end", "def generate_code\n charset = Array('A'..'Z') + Array('a'..'z')\n Array.new(8) { charset.sample }.join\nend", "def get_random_number()\n rand(0x7fffffff).to_s\nend", "def random_code(len)\n #generat a random password consisting of strings and digits\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n newcode = \"\"\n 1.upto(len) { |i| newcode << chars[rand(chars.size-1)] }\n return newcode\n end", "def generate_random_token\n SecureRandom.hex(15)\n end", "def generate_confirm_code\n chars = (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n code = \"\"\n 20.times { |i| code << chars[rand(chars.size-1)] }\n # add the ID to ensure always unique!\n code << self.recipient_id.to_s + self.project_id.to_s\n\n self.confirm_code = code\n end", "def generate_code\n code_generated = SecureRandom.hex[1..8]\n if ParkTime.where(code: code_generated).present?\n generate_code\n else\n self.code = code_generated\n end\n end", "def generate_uuid\n characters = []\n ('a'..'z').each { |letter| characters << letter}\n (0..9).each { |integer| characters << integer}\n sections = [8, 4, 4, 4, 12]\n uuid = []\n sections.each do |digit_quantity|\n uuid << characters.flatten.sample(digit_quantity).join\n end\n uuid.join('-')\nend", "def unique_id\n generator = Sass::Script::Functions.random_number_generator\n Thread.current[:sass_last_unique_id] ||= generator.rand(36**8)\n # avoid the temptation of trying to guess the next unique value.\n value = (Thread.current[:sass_last_unique_id] += (generator.rand(10) + 1))\n # the u makes this a legal identifier if it would otherwise start with a number.\n identifier(\"u\" + value.to_s(36).rjust(8, '0'))\n end", "def generate_order_code\n\t\t\tsize = 5\n\t\t\tcharset = %w{0 1 2 3 4 6 7 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}\n\t\t\tself.code = \"DH\" + Time.now.strftime(\"%Y\").last(2) + (0...size).map{ charset.to_a[rand(charset.size)] }.join\n\t\tend", "def make_id\n Time.now.to_f.to_s.ljust(16, '0') + rand(10).to_s\n end", "def generate_UUID\n characters = []\n (0..9).each{ | digit | characters << digit.to_s}\n ('a'..'f').each{ | digit | characters << digit}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times{ uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n return uuid\n end", "def get_rand\n rand = \"\";\n File.open(\"/dev/urandom\").read(20).each_byte{|x| rand << sprintf(\"%02x\",x)}\n rand\nend", "def generate_uuid\n return Digest::MD5.hexdigest \"#{SecureRandom.hex(10)}-#{DateTime.now.to_s}\"\nend", "def random_string\n (0...8).map { (65 + rand(26)).chr }.join\n end", "def random_id(length=1)\n\t\tchars = ('A'..'Z').to_a + ('a'..'z').to_a + ('1'..'9').to_a - %w[I i l L O o 0 U u V v B 8]\n\t\tresult = ''\n\t\tlength.times { result << chars.sample }\n\t\tresult \n\tend" ]
[ "0.8666963", "0.8338893", "0.82497144", "0.80795825", "0.8049352", "0.8024638", "0.79506874", "0.7906737", "0.7785307", "0.77364963", "0.76968473", "0.7676983", "0.76174927", "0.7614243", "0.76129884", "0.75998694", "0.7580592", "0.7567691", "0.75506324", "0.7545974", "0.7536939", "0.753575", "0.75289524", "0.7522215", "0.75041544", "0.75015336", "0.7470205", "0.74590474", "0.7458176", "0.7458176", "0.7438755", "0.74369484", "0.74312264", "0.74312264", "0.742915", "0.7422894", "0.7404789", "0.74023014", "0.7397226", "0.7396561", "0.73893946", "0.73843104", "0.73681885", "0.7362914", "0.7357327", "0.7324188", "0.73228693", "0.73121756", "0.7302573", "0.7291703", "0.72766834", "0.7269362", "0.7265621", "0.7251491", "0.7250591", "0.72501", "0.7238168", "0.7236652", "0.7234909", "0.7232458", "0.72322893", "0.72319317", "0.7230109", "0.72218436", "0.72191876", "0.72168624", "0.7209923", "0.7199957", "0.7198894", "0.71946967", "0.7190317", "0.71789205", "0.71726257", "0.7168475", "0.716738", "0.71561253", "0.7155149", "0.7152363", "0.71435016", "0.7129325", "0.7128341", "0.71278554", "0.7116514", "0.7116514", "0.7116514", "0.7109704", "0.71080065", "0.7093706", "0.70926905", "0.7089558", "0.70884806", "0.70845586", "0.7081814", "0.70815927", "0.70670074", "0.70440954", "0.7043278", "0.7028376", "0.70099735", "0.7006392" ]
0.73581445
44
double checks that code is still unique
def ensure_unique_code # keep trying new random codes until no match while self.class.find_by_code(self.code = Random.letters(CODE_LENGTH)); end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_unique_code\n # keep trying new random codes until no match\n while self.class.find_by_code(self.code = Random.letters(CODE_LENGTH)); end\n return true\n end", "def generate_code\n # only need to do this if code not set\n return if code\n ensure_unique_code\n end", "def validate\n self.code = generate_unique_code\n end", "def generate_unique_code\n begin\n new_code = generate_code(self.code_length)\n end until !active_code?(new_code)\n new_code\n end", "def generate_code\n # only need to do this if code not set\n return if code\n\n ensure_unique_code\n end", "def valid_code?(in_code)\n @codesTable = DB[:codes]\n match = false\n (@codesTable).each do |code|\n if ((in_code == code[:code]) && (code[:used] == 0))\n id = code[:id]\n @code = Code[id]\n @code.used = 1\n @code.save_changes\n match = true\n break\n end\n end\n return match\n end", "def update_unique_code(offence)\n code = generator(offence).code\n modifier = 0\n code = generator.code(modifier += 1) until offence.update(unique_code: code)\n end", "def hookup_code\n #break out of this function if we already have a code set\n return true if self.code\n\n #if there is not already a code set then go ahead and set it\n this_code = Code.where(:name => self.name, :coding_type => self.coding_type).first\n if this_code\n self.code = this_code\n else\n return false\n end\n end", "def allows_unique?\n true\n end", "def is_unique?(str)\n\nend", "def test_legacy_codes_unique\n spods = Person.find(:all, :limit => 2)\n person1 = spods[0]\n person2 = spods[1]\n \n new_leg_code = \"AAAA\"\n assert person1.legacy4d_identity_code !=person2.legacy4d_identity_code\n person1.legacy4d_identity_code = new_leg_code\n person2.legacy4d_identity_code = new_leg_code\n assert !person1.save\n assert !person2.save\n \n end", "def before_create\n super\n self.check_unique_code\n end", "def autogenerate_code\n self.code = String.random_alphanumeric if self.code.length == 0\n end", "def has_code?\n code != nil\n end", "def get_unique_accessCode\n code = generate_accessCode\n while Room.exists?(accessCode: code) do\n code = generate_accessCode\n end\n return code\n end", "def validate_code\n true\n end", "def unique?\n false\n end", "def test_unique\n assert_equal \".archetype-uid-RANDOM_UID\", evaluate(\"unique(class)\")\n assert_equal \"\\#archetype-uid-RANDOM_UID\", evaluate(\"unique(id)\")\n assert_equal \"my-prefix-archetype-uid-RANDOM_UID\", evaluate(\"unique(my-prefix-)\")\n assert_equal \".testing-archetype-uid-RANDOM_UID\", evaluate(\"unique('.testing-')\")\n end", "def test_get_unique_codes_for_without_id\n reason_code_ids = []\n reason_code_records = [reason_codes(:reason_code100)]\n assert_equal(\"\", ReasonCode.get_unique_codes_for(reason_code_records, reason_code_ids))\n end", "def is_unique str\n uniqueness = true\n str.each_char do |char| \n if str.downcase.count(char.downcase) > 1\n uniqueness = false\n break\n end \n end\n uniqueness \nend", "def generate_code\n self.code = SecureRandom.uuid if code.blank?\n end", "def check_validity(line)\n return check_duplicate(line) && check_anagram(line)\nend", "def str_chars_unique? str\n checker = {}\n str.codepoints.each do |c|\n if checker[c] == nil\n checker[c] = true\n else\n return false\n end\n end\n return true\nend", "def code_cracked?\n @num_guess == @code\n end", "def download_code_is_valid\n rd = RegisteredDownload.find(self.registered_download_id)\n if rd.valid_code.present?\n code = code_you_received.to_s.gsub(/\\-/, \"\").downcase.strip\n valid_code = rd.valid_code.to_s.gsub(/\\-/, \"\").downcase.strip\n unless code == valid_code\n errors.add(:code_you_received, \"does not appear to be valid.\")\n end\n end\n end", "def isUnique(string) \n if (string.length > 128) \n return false\n end\n i = 0\n while i < string.length\n j = i + 1\n while j < string.length\n if(string[i] === string[j])\n return false\n else\n j+=1\n end\n i +=1\n end\n return true\n end\nend", "def assert_code_and_desc_ok(object)\n cloned = object.clone\n assert_presence_required(object,:code)\n assert_presence_required(object,:description)\n assert object.save,\"Failed to save object first time in uniqueness test; pass unique record first\"\n assert !cloned.save,\"Saved object twice while testing for uniqueness of :code and :description\"\n assert(cloned.errors[:code].to_s =~ /taken/, \"Missing or wrong error message for duplicate code\" )\n assert(cloned.errors[:description].to_s =~ /taken/, \"Missing or wrong error message for duplicate description\") \n end", "def verify(code)\n return true unless self.verification_code\n return false unless self.verification_code == code\n self.verification_code = nil\n self.save\n end", "def check_for_correct_value_wrong_position\n correct_value_wrong_position = 0\n @proposed_process_code.each do |value|\n if @secret_process_code.include?(value)\n @secret_process_code.delete_at(@secret_process_code.index(value) || @secret_process_code.length)\n correct_value_wrong_position += 1\n end\n end\n correct_value_wrong_position\n end", "def isUnique(string) \n if (string.length > 128) \n return false \n end\n hash = {}\n i = 0\n while (i < string.length)\n if(hash[string[i]] === true) \n return false\n else \n hash[string[i]] = true\n end\n i+=1\n end\n return true\nend", "def check_proposed_code(secret_code_input)\n @secret_process_code = secret_code_input.dup\n @proposed_process_code = @proposed_code.dup\n correct_value_and_position = check_for_correct_value_and_position(secret_code_input)\n correct_value_wrong_position = check_for_correct_value_wrong_position\n [correct_value_and_position, correct_value_wrong_position]\n end", "def will_save_change_to_code?\n salted_code_fingerprint_changed?\n end", "def is_valid?\n ((@original.reverse.chars.first.to_i == check_digit) && (gs1_prefix == '979') && @code.count == 13) || @code.count == 12\n end", "def random_code\n existing_codes = Url.select(:shortened_url).map(&:shortened_url)\n new_code = [*('A'..'Z'),*('0'..'9')].shuffle[0,4].join\n\n while existing_codes.include?(new_code)\n new_code = [*('A'..'Z'), *('0'..'9')].shuffle[0,4].join\n end\n\n new_code\n end", "def test_get_unique_codes_for_id\n reason_code_ids = [100]\n reason_code_records = []\n reason_code_records << reason_codes(:reason_code100)\n reason_code_records << reason_codes(:reason_code101)\n reason_code_records << reason_codes(:reason_code102)\n assert_equal(\"5D\", ReasonCode.get_unique_codes_for(reason_code_records, reason_code_ids))\n end", "def unique_check_key\n @unique_check_key ||= SecureRandom.hex\n end", "def Unique(string)\n\n # assumes alphabet of size 128\n return false if string.length > 128\n \n hash={}\n \n for i in 0..string.length-1\n return false if hash[string[i]] \n hash[string[i]]=true\n end\n \n \nreturn true\n\nend", "def valid_code? code\n valid_codes.include? code\n end", "def generate_code\n loop do\n self.code = SecureRandom.urlsafe_base64(40)\n break if valid?\n end\n end", "def uniq!() end", "def code\n code = []\n while code.size != 4\n rand_number = 1 + rand(6)\n\n if !code.include?(rand_number) || code.empty?\n code << rand_number\n end\n end\n code\n end", "def test_course_code_unique_within_term_11\n Course.create(course_code: \"ABC 123\", term_id: 1, name: \"Poops\")\n c = Course.new(course_code: \"ABC 123\", term_id: 2, name: \"Don't poops\")\n assert c.save\n Course.create(course_code: \"DEF 780\", term_id: 3, name: \"Everybody poops\")\n d = Course.new(course_code: \"DEF 780\", term_id: 3, name: \"Speak for yourself, buddy\")\n refute d.save\n end", "def found_unique?\n @flags.size == 1\n end", "def value_uniqueness_with_scheme\n if new_record? && Identifier.where(identifier_scheme: identifier_scheme,\n identifiable: identifiable).any?\n errors.add(:identifier_scheme, _('already assigned a value'))\n end\n end", "def unique?\n @unique\n end", "def generate_small_code(field)\n loop do\n code = (0..MAX_NUMBER_OF_CHARS).map { CHARSET[rand(CHARSET.size)] }.join\n\n return code unless self.class.exists?(field => code)\n end\n end", "def checkNewAssoc(scheme, campusID, oapID, campusCache)\n if campusCache.empty?\n db_execute(\"SELECT campus_id FROM ids WHERE oap_id = ?\", [oapID]) { |row|\n foundScheme, foundID = row[0].split('::')\n campusCache[foundScheme] << foundID\n }\n end\n if campusCache[scheme].length > 0 && !campusCache[scheme].include?(campusID)\n puts \"Warning: possible dupe: campus ID #{scheme}::#{campusID} being added to oapID #{oapID} which already had #{campusCache[scheme].to_a.inspect}.\"\n end\nend", "def is_codeword_solved?\n\t\t!@codeword_hash.include?(\"_\") ? true : false\n end", "def is_unique(string)\n return false if string.length > 128\n characters = Hash.new\n \n string.each_char do | char | \n return false if characters.has_key? char\n characters[char] = true\n end\n \n return true \nend", "def test_get_unique_codes_for_ids\n reason_code_ids = [100,101,102]\n reason_code_records = []\n reason_code_records << reason_codes(:reason_code100)\n reason_code_records << reason_codes(:reason_code101)\n reason_code_records << reason_codes(:reason_code102)\n assert_equal(\"5D;I8;C6\", ReasonCode.get_unique_codes_for(reason_code_records, reason_code_ids))\n end", "def upgrade_user_code\n # duplicate user_code is disallowed but it's\n # impossible to get a duplicate new code here\n new_code = SecureRandom.hex(32)\n self.user_code = new_code\n save\n new_code\n end", "def non_unique_letters(string)\nend", "def find_exact_match\n exact = 0\n index = 0\n 4.times.map do\n if @temp_code[index] == @temp_guess[index]\n exact += 1\n @temp_code.delete_at(index)\n @temp_guess.delete_at(index)\n else\n index += 1\n end\n end\n exact\n end", "def remove_invalid_codes(guess)\n @valid_codes.filter! { |code| code.check_code(guess) == [@black_pegs, @white_pegs] }\n puts \"#{@valid_codes.count} possible codes left\"\n end", "def compare_codes(guess)\n #make a reference that won't destroy the original secret code\n secret = secret_code.clone\n\n exact = check_exact(guess, secret)\n if exact == 4\n #tell the caller we have a winner\n return true\n else\n partial = check_partial(guess, secret)\n puts \"Correct value and position: #{exact}\\nCorrect value, wrong position: #{partial}\\n\\n\"\n return false\n end\n end", "def invalidate_otp_backup_code!(code)\n codes = otp_backup_codes || []\n\n found = codes.find { |backup_code| Devise::Encryptor.compare(self.class, backup_code, code) }\n\n if found\n codes.delete(found)\n update(otp_backup_codes: codes)\n else\n false\n end\n end", "def value_uniqueness_without_scheme\n # if scheme is nil, then just unique for identifiable\n return unless Identifier.where(identifiable: identifiable, value: value).any?\n\n errors.add(:value, _('must be unique'))\n end", "def unique?\n !! @unique\n end", "def is_unique(string)\n chars = Hash.new(0)\n\n string.each_char do |ch|\n chars[ch] += 1\n \n if chars[ch] > 1\n return false\n end\n end\n\n true\nend", "def is_unique_with_hash?(str)\n hash = {}\n str.each_char do |ch|\n if hash[ch]\n return false\n else \n hash[ch] = true\n end \n end \n true\nend", "def validateCode(userInput)\n\tuntil (checkCode(userInput) == true)\n\t\tgetCode()\n\tend\n\treturn userInput\nend", "def is_isogram(string)\n #your code here\n string.downcase.chars.uniq == string.downcase.chars\nend", "def unique_char_string(string)\n char_hash = Hash.new\n\n string.each_char do |c|\n if char_hash[c.ord]\n return false\n else\n char_hash[c.ord] = true\n end\n end\n true\nend", "def hex_address_unique?(hex_address)\n return false if hex_address == '0000'\n return false if hex_address == 'ffff'\n if Chef::Config[:solo]\n Chef::Log.warn('Running solo, cannot check address uniqueness')\n return true\n else\n return search(:node, \"tinc_hex_address:#{ha}\").empty?\n end\nend", "def can_be_used_jointly?\n ids = order.order_promo_codes.collect(&:promo_code_id).uniq\n singular_promo_codes = PromoCode.where(id: ids).where(combined: false)\n # cant use count since that data isnt saved yet and count would fire an query\n if order.order_promo_codes.size > 1 and singular_promo_codes.count > 0\n self.errors.add(:promo_code_id, 'Cant be used with conjuction with other codes') unless self.promo_code.combined\n end\n end", "def check_for_correct_value_and_position(secret_code_input)\n index_correction = 0\n correct_value_and_position = 0\n @proposed_code.each_with_index do |value, index|\n if value == secret_code_input[index]\n @proposed_process_code.delete_at(index - index_correction)\n @secret_process_code.delete_at(index)\n correct_value_and_position += 1\n index_correction += 2\n end\n end\n correct_value_and_position\n end", "def uniqueMainKey?(k)\n\t\t\t@mainKeyUnique.call(k)\n\t\tend", "def isvalid?(code:)\n @channel.each { |k,v| return true if code == v[:code] }\n return false\n end", "def allUniqueHighSchoolStyle?(string)\n\tputs \"Highschool!\"\n\tputs \"Does #{string} has all unique chars?\"\n\tarray = string.split(\"\")\n\t(0..array.length-1).each do |x|\n\t\t(0..array.length-1).each do |y|\n\t\t\tif x!=y && array[x]==array[y]\n\t\t\t\tputs \"At index #{x} and #{y} there is the same character #{array[x]}\"\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend\n\treturn true\nend", "def unique_pain(string)\n i = 0\n while i < string.length\n j = i + 1\n while j < string.length - 1\n if string[i] == string[j]\n return false\n end\n j += 1\n end\n i += 1\n end\n true\nend", "def unique_with_hash?(str)\n chars_hash = Hash.new(0)\n chars = str.split(\"\")\n chars.each do |char|\n chars_hash[char] += 1\n end\n chars_hash.values.each do |value|\n if value > 1\n return false\n end\n return true\n end\nend", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def exact_match\n code.each_index do |index|\n next unless code[index] == guess[index]\n\n key.push(\"X\")\n code[index] = 0\n guess[index] = 99\n end\n end", "def uniqable_uid(field)\n loop do\n uniq_code = Nanoid.generate(size: 16)\n if uniq_code =~ /\\D+/\n send(\"#{field}=\", uniq_code)\n break unless self.class.where(field => uniq_code).exists?\n end\n end\n end", "def verify_uniquness!(tuple)\n stream = tuple[:stream]\n attrs = %i[position event_id]\n attrs.delete(:position) if Stream.new(stream).global?\n\n attrs.each do |key|\n next if key == :position && tuple[key].nil?\n next if restrict(:stream => stream, key => tuple.fetch(key)).none?\n\n raise TupleUniquenessError.public_send(:\"for_stream_and_#{key}\", stream, tuple.fetch(key))\n end\n end", "def code\n call_once\n @code\n end", "def unique_disabled?\n !unique_enabled?\n end", "def validateCode(code)\n \n code = code.split(\"\\n\")\n code.delete_if {|w| w.include? \"puts\"}\n code.delete_if {|w| w.include? \"print\" }\n code.join(\"\\n\")\n end", "def what_is_unique?\n cache_options[:unique].to_s =~ /true|false/\n end", "def code_initialize\n shiny_attempts.clamp(1, Float::INFINITY).times do\n @code = rand(0xFFFF_FFFF)\n break if shiny\n end\n end", "def is_unique?(str)\n str = str.chars.sort\n str.each_with_index do |letter, idx|\n next if idx == str.length\n return false if str[idx] == str[idx++1]\n end \n true\nend", "def test_course_codes_are_unique_in_given_term\n term = Term.create(name: \"Spring 2016 Cohort\", starts_on: \"2016-02-01\", ends_on: \"2016-05-22\", school_id: 3)\n term_two = Term.create(name: \"Fall 2016 Cohort\", starts_on: \"2016-09-01\", ends_on: \"2016-011-22\", school_id: 5)\n\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ABC123\", color: \"Violet\")\n course_one = Course.create(name: \"Front End\", course_code: \"DEF456\", color: \"Mustard\")\n course_two = Course.create(name: \"Javascript\", course_code: \"DEF456\", color: \"Mustard\")\n\n assert term.courses << course\n assert term.courses << course_one\n refute term.courses << course_two\n assert term_two.courses << course_two\n end", "def unique?(str)\n seen = \"\"\n\n str.each_char do |chr|\n if seen.include?(chr)\n return false\n else\n seen << chr\n end\n end\n\n true\nend", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def check_unique\n bar = Bar.where(:name => self.name, :user_id => self.user_id)\n if bar != nil\n \treturn false\n end\n end", "def is_unique2(str)\n (0...str.length).each do |i|\n (i + 1...str.length).each do |j|\n return false if str[i] == str[j]\n end\n end\n\n true\nend", "def isUnique? string\n \n # Variables used to determine uniqueness. \n firstChar, secondChar = \"\"\n\n # Sort and return the string provided. \n sortedString = string.chars.sort.join\n\n # If two consecutive characters are the same, string is not unique. \n sortedString.each_char do |char| \n\n firstChar = char\n\n if firstChar == secondChar\n return false\n end\n\n secondChar = firstChar\n end\n\n return true\t \nend", "def unique_hearstring\n HeartString.all.each do |heart_string|\n # byebug\n if (heart_string.user_id == self.user_id && heart_string.tomodachi_id == self.tomodachi_id) || (heart_string.tomodachi_id == self.user_id && heart_string.user_id == self.tomodachi_id)\n errors.add(:heartstring, \"already exists\")\n end\n end\n end", "def validate_code!\n valid_code? ? confirm! : unconfirm!\n end", "def code_has_prefix\n errors.add( :code, I18n.t( \"s_code_modules.msg.bad_code_format\", prefix: @code_prefix )) \\\n unless self.class.has_code_prefix( code )\n end", "def check_code (code)\n self.code_verified = self.verification_code == code\n save\n end", "def unique_chars_with_extra_space?(str)\n hash = {}\n for i in 0..str.size-1\n if hash.key?(str[i])\n puts \"dup => #{str[i]}\"\n return false\n end\n hash[str[i]] = true\n end\n true\nend", "def test_rack_doesnt_contain_enough_duplicate_letters\n [:A,:B,:A,:C].each{|x| @newTileRack.append(x)}\n assert_equal(false,@newTileRack.has_tiles_for?('AAAA'))\n end", "def slug_unique_in_clinic\n errors.add(:slug, \"Slug: #{slug} already in use\") unless\n slug_unique_in_clinic?\n end", "def icn_id_unique\n return if icn_id.nil?\n return if (conflicting_name = other_names_with_same_icn_id.first).blank?\n\n errors.add(:base, :name_error_icn_id_in_use.t(\n number: icn_id, name: conflicting_name.real_search_name\n ))\n end", "def cleancode(arg, file, level, type)\n ['errors', 'warnings', 'compiled_code'].each do |x|\n str = JSCompiler.compile(arg, file, x, level, type)\n return str unless str.eql?(\"No \" + x)\n end\n end", "def generate_code(attempts = 0)\n if attempts > 4\n raise \"Could not generate unique code\"\n else\n self[:code] = \"#{prefix}#{SecureRandom.hex(3)}#{suffix}\".upcase\n generate_code(attempts + 1) if self.class.exists?(:code => code)\n end\n end" ]
[ "0.8103135", "0.7022466", "0.68688595", "0.68060386", "0.66699076", "0.6409783", "0.64094245", "0.63625747", "0.62836593", "0.60936177", "0.60100603", "0.6002641", "0.6001788", "0.59650755", "0.5952886", "0.5931408", "0.59253776", "0.5901258", "0.5879698", "0.5866913", "0.5846018", "0.58149725", "0.5809954", "0.5775649", "0.57475907", "0.57468915", "0.57379454", "0.57249296", "0.5721705", "0.5708878", "0.57060623", "0.570046", "0.5700117", "0.5690633", "0.5686046", "0.56842995", "0.5683204", "0.56713444", "0.5670521", "0.565842", "0.5631991", "0.5631714", "0.5618463", "0.56165683", "0.5613108", "0.56084025", "0.5600932", "0.55956835", "0.5595108", "0.5593889", "0.55934876", "0.5592698", "0.55862707", "0.5577367", "0.55676425", "0.5566515", "0.55660594", "0.5562091", "0.5552191", "0.5545776", "0.55407953", "0.5538522", "0.55338025", "0.5533671", "0.5528565", "0.5511686", "0.55115664", "0.55113876", "0.5505687", "0.5504892", "0.5502511", "0.549995", "0.549995", "0.549995", "0.54954886", "0.5488466", "0.548309", "0.5476117", "0.54721737", "0.5466239", "0.5466195", "0.5458977", "0.54535764", "0.5453139", "0.54526365", "0.5451536", "0.5451536", "0.5445511", "0.5443895", "0.54401124", "0.54379123", "0.54350877", "0.542937", "0.54245734", "0.5422197", "0.54199284", "0.5416596", "0.5415044", "0.54143476", "0.5410148" ]
0.8073653
1
Updates the portlets hash from the routes and configuration options. Changes the path variables to a format supported by the Railsportlet.
def portlets(routes=@routes) raise 'No configuration' unless @config portlets = [] @config.instances.flatten.each do |portlet| ### route to path if portlet[:path] # take user-given path & do not parse routes path = portlet[:path] # # parse the requirements - controller & action # ( this is too difficult -- no navigation for user-given paths ) # # begin # #recognized_request_for(path) # #builder = ActionController::Routing::RouteBuilder.new # #r = ActionController::Routing::Routes.recognize_path(path, { :method => :get }) # #puts r.inspect # #req_path = builder.segments_for_route_path(r) # #STDERR.puts req_path.inspect # rescue # STDERR.puts $!.message # end portlet.update( :reqs => {} ) portlet.update( :vars => [] ) else # parse path from routes begin _r = routes.select{ |route| route[:name]==portlet[:name].to_sym } path = _r.first[:path] # take only the first segments raise if path.nil? rescue $stderr.puts ' !! no route for %s' % portlet[:name] next end # getting de default values from wildcards (:controller, :action, :other) portlet.update(:defaults => _r.first[:defaults]) ### requirements - controller & action portlet.update( :reqs => _r.first[:reqs] ) ### variables # take just the ones that are required in the path! vars = [] _r.first[:vars].each do |var| # variables that are not defined in reqs are required to be inserted by the rails-portlet vars << var unless _r.first[:reqs][var] end portlet.update( :vars => vars ) # delete the route from routes if routes _r.each do |r| routes.delete(r) end end end portlet.update( :path => path ) ### javascripts # append portlet's javascripts to global javascripts javascripts = (portlet[:javascripts].nil? ? @config.javascripts : @config.javascripts + portlet[:javascripts].to_a) portlet.update( :javascripts => javascripts.flatten ) portlets << portlet end # leftover named routes if @config.include_all_named_routes==true portlets << routes end # sanity check portlets.flatten! portlets.compact! portlets.each do |portlet| ### hostname portlet[:host] ||= @config.host ### servlet portlet[:servlet] ||= @config.servlet ### category portlet[:category] ||= @config.category ### title _title = portlet[:title] || portlet[:name].to_s.gsub('_',' ').capitalize # strip illegal characters title = _title.gsub(/ä/,'a').gsub(/ö/,'o').gsub(/Ä/,'A').gsub(/Ö/,'O') portlet.update( :title => title ) portlet[:edit_mode] ||= nil portlet[:instanceable] ||= false ### unless defined, use default javascripts portlet[:javascripts] ||= @config.javascripts # fix path variables to be replaced by rails-portlet at runtime path = portlet[:path] path.gsub!(/:uid/,'%UID%') path.gsub!(/:gid/,'%GID%') # TODO: notify user of unsupported variables portlet.update( :path => path ) end return portlets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_routes\n insert_into_file 'config/routes.rb', %(\n root :to => 'portal#page'\n DrgCms.routes\n\n put '/portal/process_login'\n post '/reports/diary'\n\n resources :init # remove after initial run\n\n get '*path' => 'portal#page'\n\n),\n after: 'Rails.application.routes.draw do'\nend", "def portlet_config(params)\n params\n end", "def set_route_information\n @routes = {\n :root_url => root_url,\n :root_path => root_path,\n :customers_delete_path => customers_delete_path, \n :customers_all_path => customers_all_path,\n :customers_all_url => customers_all_url,\n :customers_creation_form_url => customers_creationform_url,\n :customers_creation_form_path => customers_creationform_path,\n :customers_edit_form_path => customers_editform_path,\n :customers_edit_form_url => customers_editform_url,\n :contacts_customer_contacts_path => contacts_customer_contacts_path,\n :contacts_customer_contacts_url => contacts_customer_contacts_url,\n :contacts_delete_path => contacts_delete_path,\n :contacts_delete_url => contacts_delete_url,\n :contacts_createForm_path => contacts_createForm_path,\n :contacts_createForm_url => contacts_createForm_url,\n :contacts_update_path => contacts_update_path,\n :contacts_update_url => contacts_update_url,\n :contacts_editform_path => contacts_editform_path,\n :contacts_editform_url => contacts_editform_url\n }\n end", "def reload_routes!; end", "def reload_routes!; end", "def update\n Rails.logger.info('👻 Disraptor: Updating route.')\n\n route_id = params.require(:route_id)\n payload = params.require('disraptor/route')\n source_path = normalize_path(payload['sourcePath'])\n target_url = normalize_uri(payload['targetUrl'])\n request_method = normalize_request_method(payload['requestMethod'])\n\n if !@@allowed_methods.include?(request_method)\n error_message = \"Route request method was #{request_method} but expected one of these: #{@@allowed_methods.join(', ')}.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n if source_path != '/' and source_path.end_with?('/')\n error_message = \"Route source path was #{source_path} but it must not end in a slash.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n route = Disraptor::Route.edit(route_id, source_path, target_url, request_method)\n\n Rails.application.reload_routes!\n\n render json: { 'disraptor/route': route }\n end", "def update!(**args)\n @supported_routes = args[:supported_routes] if args.key?(:supported_routes)\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n @port = args[:port] if args.key?(:port)\n end", "def port_configuration(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Port Configuration\" page.\n begin\n @ff.link(:text, 'Port Configuration').click\n self.msg(rule_name, :info, 'Port Configuration', 'Reached page \\'Port Configuration\\'.')\n rescue\n self.msg(rule_name, :error, 'Port Configuration', 'Did not reach \\'Port Configuration\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'local_administration','Some key NOT found.')\n return\n end \n \n # parse the json file.\n \n # Add by Hugo 07/31/2009; missing WAN Port\n # \"WAN Port\"\n if info.has_key?('WAN Port')\n \n case info['WAN Port']\n \n when 'Auto'\n \n # Set \"Auto\"\n @ff.select_list(:name,'port_eth1_0').select_value(\"0\")\n self.msg(rule_name,:info,'WAN Port',info['WAN Port'])\n \n when '10 Half Duplex'\n \n # Set \"10 Half Duplex\"\n @ff.select_list(:name,'port_eth1_0').select_value(\"1\")\n self.msg(rule_name,:info,'WAN Port',info['WAN Port'])\n \n when '10 Full Duplex'\n \n # Set \"10 Full Duplex\"\n @ff.select_list(:name,'port_eth1_0').select_value(\"2\")\n self.msg(rule_name,:info,'WAN Port',info['WAN Port'])\n \n when '100 Half Duplex'\n \n # Set \"100 Half Duplex\"\n @ff.select_list(:name,'port_eth1_0').select_value(\"3\")\n self.msg(rule_name,:info,'WAN Port',info['WAN Port'])\n \n when '100 Full Deplex'\n \n # Set \"100 Full Duplex\"\n @ff.select_list(:name,'port_eth1_0').select_value(\"4\")\n self.msg(rule_name,:info,'WAN Port',info['WAN Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'port_configuration','Did NOT find the value in \\'WAN Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n\n # \"Port1\"\n if info.has_key?('Port1')\n \n case info['Port1']\n \n when 'Auto'\n \n # Set \"Auto\"\n @ff.select_list(:name,'port_eth0_0').select_value(\"0\")\n self.msg(rule_name,:info,'Port1',info['Port1'])\n \n when '10 Half Duplex'\n \n # Set \"10 Half Duplex\"\n @ff.select_list(:name,'port_eth0_0').select_value(\"1\")\n self.msg(rule_name,:info,'Port1',info['Port1'])\n \n when '10 Full Duplex'\n \n # Set \"10 Full Duplex\"\n @ff.select_list(:name,'port_eth0_0').select_value(\"2\")\n self.msg(rule_name,:info,'Port1',info['Port1'])\n \n when '100 Half Duplex'\n \n # Set \"100 Half Duplex\"\n @ff.select_list(:name,'port_eth0_0').select_value(\"3\")\n self.msg(rule_name,:info,'Port1',info['Port1'])\n \n when '100 Full Deplex'\n \n # Set \"100 Full Duplex\"\n @ff.select_list(:name,'port_eth0_0').select_value(\"4\")\n self.msg(rule_name,:info,'Port1',info['Port1'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'port_configuration','Did NOT find the value in \\'Port1\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Port2\"\n if info.has_key?('Port2')\n \n case info['Port2']\n \n when 'Auto'\n \n # Set \"Auto\"\n @ff.select_list(:name,'port_eth0_1').select_value(\"0\")\n self.msg(rule_name,:info,'Port2',info['Port2'])\n \n when '10 Half Duplex'\n \n # Set \"10 Half Duplex\"\n @ff.select_list(:name,'port_eth0_1').select_value(\"1\")\n self.msg(rule_name,:info,'Port2',info['Port2'])\n \n when '10 Full Duplex'\n \n # Set \"10 Full Duplex\"\n @ff.select_list(:name,'port_eth0_1').select_value(\"2\")\n self.msg(rule_name,:info,'Port2',info['Port2'])\n \n when '100 Half Duplex'\n \n # Set \"100 Half Duplex\"\n @ff.select_list(:name,'port_eth0_1').select_value(\"3\")\n self.msg(rule_name,:info,'Port2',info['Port2'])\n \n when '100 Full Deplex'\n \n # Set \"100 Full Duplex\"\n @ff.select_list(:name,'port_eth0_1').select_value(\"4\")\n self.msg(rule_name,:info,'Port2',info['Port2'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'port_configuration','Did NOT find the value in \\'Port2\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"Port3\"\n if info.has_key?('Port3')\n \n case info['Port3']\n \n when 'Auto'\n \n # Set \"Auto\"\n @ff.select_list(:name,'port_eth0_2').select_value(\"0\")\n self.msg(rule_name,:info,'Port3',info['Port3'])\n \n when '10 Half Duplex'\n \n # Set \"10 Half Duplex\"\n @ff.select_list(:name,'port_eth0_2').select_value(\"1\")\n self.msg(rule_name,:info,'Port3',info['Port3'])\n \n when '10 Full Duplex'\n \n # Set \"10 Full Duplex\"\n @ff.select_list(:name,'port_eth0_2').select_value(\"2\")\n self.msg(rule_name,:info,'Port3',info['Port3'])\n \n when '100 Half Duplex'\n \n # Set \"100 Half Duplex\"\n @ff.select_list(:name,'port_eth0_2').select_value(\"3\")\n self.msg(rule_name,:info,'Port3',info['Port3'])\n \n when '100 Full Deplex'\n \n # Set \"100 Full Duplex\"\n @ff.select_list(:name,'port_eth0_2').select_value(\"4\")\n self.msg(rule_name,:info,'Port3',info['Port3'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'port_configuration','Did NOT find the value in \\'Port3\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Port4\"\n if info.has_key?('Port4')\n \n case info['Port4']\n \n when 'Auto'\n \n # Set \"Auto\"\n @ff.select_list(:name,'port_eth0_3').select_value(\"0\")\n self.msg(rule_name,:info,'Port4',info['Port4'])\n \n when '10 Half Duplex'\n \n # Set \"10 Half Duplex\"\n @ff.select_list(:name,'port_eth0_3').select_value(\"1\")\n self.msg(rule_name,:info,'Port4',info['Port4'])\n \n when '10 Full Duplex'\n \n # Set \"10 Full Duplex\"\n @ff.select_list(:name,'port_eth0_3').select_value(\"2\")\n self.msg(rule_name,:info,'Port4',info['Port4'])\n \n when '100 Half Duplex'\n \n # Set \"100 Half Duplex\"\n @ff.select_list(:name,'port_eth0_3').select_value(\"3\")\n self.msg(rule_name,:info,'Port4',info['Port4'])\n \n when '100 Full Deplex'\n \n # Set \"100 Full Duplex\"\n @ff.select_list(:name,'port_eth0_3').select_value(\"4\")\n self.msg(rule_name,:info,'Port4',info['Port4'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'port_configuration','Did NOT find the value in \\'Port4\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # Apply for the change\n @ff.link(:text,'Apply').click\n \n # Making change will cause the \"Attention\" page.\n if @ff.text.include?'Attention'\n @ff.link(:text,'Apply').click\n \n # Wait for 30 seconds\n sleep 30\n end\n\n # Output the result\n self.msg(rule_name,:info,'Port Configuration','SUCCESS')\n \n end", "def update_config(options = {})\n @logger.debug(\"config changed: #{options.inspect}\")\n @urlmapping = options[:urlmapping] || []\n @filters = options[:filters] || []\n end", "def update_route_hash( route, current, status, parsed, parse_pass_count, source_step_name, source_step_type, target_step_name, target_step_type )\n \n # We check if this method has been passed a value for an attribute.\n # Where the method has been passed nil as an attribute value, we use the attribute value as it exists in the hash.\n current = current || @routes[route][:current]\n status = status || @routes[route][:status]\n parsed = parsed || @routes[route][:parsed]\n parse_pass_count = parse_pass_count || @routes[route][:parse_pass_count]\n source_step_name = source_step_name || @routes[route][:source_step_name]\n source_step_type = source_step_type || @routes[route][:source_step_type]\n target_step_name = target_step_name || @routes[route][:target_step_name]\n target_step_type = target_step_type || @routes[route][:target_step_type]\n \n # We create a hash of attributes for the route with any revised values.\n route_hash = {\n :current => current,\n :status => status,\n :parsed => parsed,\n :parse_pass_count => parse_pass_count,\n :source_step_name => source_step_name,\n :source_step_type => source_step_type,\n :target_step_name => target_step_name,\n :target_step_type => target_step_type\n }\n \n # We push this back into the hash of routes, keyed off the route.\n @routes[route] = route_hash\n end", "def update(options = {})\n root_path = options[:root_path].to_s.strip\n new_root = root_path.empty? ? false : set_root_path(root_path)\n\n DEFAULTS.each do |name, ending|\n set_path_variable(name, options[name], ending, new_root)\n end\n end", "def install_routes_yaml(logger)\n routes_yaml = File.join(@tempdir, 'routes.yaml')\n routes_hash = {\n 'master' => {\n 'facts' => {\n 'terminus' => @facts_terminus,\n 'cache' => 'yaml'\n },\n 'catalog' => {\n 'cache' => 'json'\n }\n }\n }\n File.open(routes_yaml, 'w') { |f| f.write(routes_hash.to_yaml) }\n logger.debug(\"Installed routes.yaml file at #{routes_yaml}\")\n end", "def set_routes(my_port, name, node_type, keys)\r\n # Give Access To This Node's Name\r\n get \"/peer_name\" do\r\n return name\r\n end\r\n # Give Access To This Node's Type (Client/Miner)\r\n get \"/peer_type\" do\r\n return node_type.to_s\r\n end\r\n # Give Access To This Node's Public Key For Validation & Handshake\r\n get \"/peer_key_public\" do\r\n return \"#{keys[0]},#{keys[2]}\"\r\n end\r\n # Give Access To This Node's Discovered Peers\r\n get \"/peer_peers\" do\r\n peer_ports = \"\"\r\n $peers.length.times do |i|\r\n peer_ports += \",\" if (i != 0)\r\n peer_ports += $peers[i].port.to_s\r\n end\r\n return peer_ports\r\n end\r\n # Another Peer Requests Handshake\r\n post \"/peer_handshake\" do\r\n port = params[\"port\"].chomp.to_i\r\n signature = params[\"signature\"].chomp.to_i\r\n timestamp = params[\"timestamp\"].chomp.to_i\r\n # Handshake Only With Undiscovered Peers\r\n if (search_peers_by_port(port) == -1)\r\n key_public = Faraday.get(\"#{URL}:#{port}/peer_key_public\").body\r\n key_public = key_public.split(\",\") # Convert String To Array\r\n # Validate Node's Authenticity Using RSA Decryption\r\n if (validate_signature(key_public, signature, timestamp))\r\n add_peer(port)\r\n handshake_peer(my_port, port, [keys[1], keys[2]])\r\n end\r\n end\r\n end\r\n # Request To Mine A Block\r\n post \"/mine_block\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = my_port.to_s\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n mine(amount, payer, payee, miner, timestamp, signature, prev_hash)\r\n else\r\n puts \"Denied mining request from rogue node\".red\r\n $status = \"Denied mining request from rogue node\"\r\n end\r\n end\r\n # Recieve A Mined Block\r\n post \"/block_mined\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = params[\"miner\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n # Add Block If Not Already Mined\r\n block_exists = check_if_block_exists(miner.to_i, timestamp.chomp.to_i)\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, true) if (!block_exists)\r\n end\r\n # Peer Sent A Mined Block\r\n post \"/broadcast_block\" do\r\n amount = params[\"amount\"].to_f\r\n signature = params[\"signature\"].to_s\r\n timestamp = params[\"timestamp\"].to_i\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n hash = params[\"hash\"].to_s\r\n payer = params[\"payer\"].to_i\r\n payee = params[\"payee\"].to_i\r\n miner = params[\"miner\"].to_i\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (prev_hash == \"0000000000000000000000000000000000000000000000000000000000000000\" && $blockchain.length > 0)\r\n # Genesis Node is being shared with everyone, this node does not require as it already has a chain. Ignore.\r\n else\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n is_valid = validate_block(amount, signature, timestamp, prev_hash, nonce, hash, payer, payee, miner)\r\n if (is_valid)\r\n puts \"VALIDATED OK\".green\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, false)\r\n end\r\n else\r\n puts \"Denied block broadcast from rogue node\".red\r\n $status = \"Denied block broadcast from rogue node\"\r\n end\r\n end\r\n end\r\n # Broadcast First Block (Genesis Block) To Peers\r\n post \"/genesis\" do\r\n broadcast_block($blockchain[0])\r\n end\r\nend", "def update_path!\n update_path(:force => true)\n end", "def update\n respond_to do |format|\n if @portal_config.update(portal_config_params)\n format.html { redirect_to @portal_config, notice: 'Config was successfully updated.' }\n format.json { render :show, status: :ok, location: @portal_config }\n else\n format.html { render :edit }\n format.json { render json: @portal_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def path\n return @path unless @path.nil?\n\n substitute_keys_with(@route_params)\n substitute_keys_with(known_params)\n @path = @route\n end", "def route_config\n raise StandardError, \"You must set a route_id in Scratch before calling route_config\"\n @route = Nextbus::Route.find @agency_id, @route_id\n sensor_update \"route_title\", @route.title\n set_screen_factors @route.lat_min, @route.lat_max, @route.lon_min, @route.lon_max\n set_stops\n get_vehicle_locations\n end", "def update_config_options\n options = Util::OptsParser.options(ARGV)\n Util::Configuration.tag_time_to_live_in_seconds = options[:ttl]\n Util::Configuration.case_sensitive_matching = options[:case]\n Util::Configuration.hashtag_storage_class = options[:storage]\n Util::Configuration.log_capture_device = options[:log_device]\n Util::Configuration.automatic_restart = options[:automatic_restart]\n current_config = Util::Configuration.to_a\n current_config << \"Port: #{options[:port]}\"\n logger.info(current_config.join(', '))\n options\n end", "def routes(context={})\n \n routes = [{:path => '/admin/cms',\n :parent_path => '/admin',\n :regular_expression => /^\\/admin\\/cms/,\n :title => 'Gestor contenidos',\n :description => 'Gestiona los contenidos',\n :fit => 2,\n :module => :cms},\n {:path => '/admin/cms/content-types',\n :parent_path => '/admin/cms',\n \t :regular_expression => /^\\/admin\\/cms\\/content-types/, \n :title => 'Tipos de contenido' , \n :description => 'Manages the content types: creation and update of content types.',\n :fit => 3,\n :module => :cms},\n {:path => '/mctype/:type/:aspect',\n :parent_path => \"/mctypes\",\n :regular_expression => /^\\/mctype\\/.+\\/.+/, \n :title => 'Content type aspect configuration', \n :description => 'Edit the content type/aspect configuration',\n :fit => 1,\n :module => :cms}, \n {:path => '/admin/cms/contents',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/content/, \n :title => 'Contenidos', \n :description => 'Manages the contents',\n :fit => 2,\n :module => :cms},\n {:path => '/admin/cms/content/new/',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/content\\/new/, \n :title => 'Crear contenido', \n :description => 'Create a new content: Choose the content type.',\n :fit => 2,\n :module => :cms},\n {:path => '/admin/cms/content/new/:content_type',\n :parent_path => \"/admin/cms/content/new/\",\n :regular_expression => /^\\/admin\\/cms\\/content\\/new\\/.+/, \n :title => 'Nuevo', \n :description => 'Create a new content: Complete data.',\n :fit => 3,\n :module => :cms}, \n {:path => '/admin/cms/content/edit/:content_id',\n :parent_path => '/admin/cms/contents',\n :regular_expression => /^\\/admin\\/cms\\/content\\/edit\\/.+/, \n :title => 'Editar contenido', \n :description => 'Editar contenido',\n :fit => 1,\n :module => :cms}, \n {:path => '/admin/cms/taxonomy',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/taxonomy/, \n :title => 'Taxonomías', \n :description => 'Manages the taxonomies: creation and update of taxonomies',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/terms/:taxonomy_id',\n :parent_path => \"/admin/cms/taxonomy\",\n :regular_expression => /^\\/admin\\/cms\\/terms\\/.+/, \n :title => 'Term',\n :description => 'Manage the terms of a taxonomy.',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/templates',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/templates/, \n :title => 'Plantillas', \n :description => 'Manages templates: creation and update of templates',\n :fit => 1,\n :module => :cms }, \n {:path => '/admin/cms/comments',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/comments/, \n :title => 'Comentarios', \n :description => 'Manages comments: creation and update of templates',\n :fit => 1,\n :module => :cms }, \n {:path => '/admin/cms/blocks',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/blocks/, \n :title => 'Bloques', \n :description => 'Manage the blocks. It allows to discover and configure modules blocks',\n :fit => 1,\n :module => :cms},\n {:path => '/admin/cms/views',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/views/, \n :title => 'Vistas', \n :fit => 1,\n :description => 'Manage the views: creation and update of views',\n :module => :cms},\n {:path => '/content/:page',\n :regular_expression => /^\\/content\\/.+/,\n :title => 'Content',\n :description => 'Shows a content',\n :fit => 1,\n :module => :cms},\n {:path => '/contents/category/:term_id',\n :regular_expression => /^\\/contents\\/category\\/.+/,\n :title => 'Contents by category',\n :description => 'Shows all the contents tagged with the category',\n :fit => 1,\n :module => :cms},\n {:path => '/admin/cms/menu-management',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/menu-management/, \n :title => 'Menu', \n :description => 'Manages the menus: creation and update of menus',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/menu-item-management/:menu_name',\n :parent_path => '/admin/cms/menu-management',\n :regular_expression => /^\\/admin\\/cms\\/menu-item-management\\/.+/, \n :title => 'Elemento de menú',\n :description => 'Manage the items of a menu.',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/translate/content/:content_id',\n :parent_path => '/admin/cms/contents',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/content\\/.+/, \n :title => 'Traducir contenido', \n :description => 'Translate a content',\n :fit => 1,\n :module => :translation },\n {:path => '/admin/cms/translate/menuitem/:menuitem_id',\n :parent_path => '/admin/cms/menu-management',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/menuitem\\/.+/, \n :title => 'Traducir elemento de menu', \n :description => 'Translate a menu item',\n :fit => 1,\n :module => :translation }, \n {:path => '/admin/cms/translate/term/:term_id',\n :parent_path => '/admin/cms/taxonomy',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/term\\/.+/, \n :title => 'Traducir término',\n :description => 'Translate a term.',\n :fit => 1,\n :module => :translation },\n {:path => '/admin/cms/translate/template/:template_id',\n :parent_path => '/admin/cms/templates',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/template\\/.+/, \n :title => 'Traducir plantilla',\n :description => 'Translate a term.',\n :fit => 1,\n :module => :translation } \n ]\n \n end", "def update\n begin\n @check_route.update(check_route_params)\n #TODO dedup\n @check_route.assets<< Asset.find(params[:asset_id]) if (!params[:asset_id].nil?)\n render template: 'check_routes/show', status: :ok\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, status: :internal_server_error\n end\n end", "def variables_for_edit\n @path = administration.article_type_path\n @method = :patch\n end", "def update(app_name, domain)\n opts = { app_name: app_name, domain: domain }\n Hermes::Route.update(opts.merge(Hash[options.map{|(k,v)| [k.to_sym,v]}])).inject\n puts \"Route for #{app_name} updated\"\n end", "def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @http_route = args[:http_route] if args.key?(:http_route)\n @route_update_wait_time = args[:route_update_wait_time] if args.key?(:route_update_wait_time)\n @service = args[:service] if args.key?(:service)\n end", "def map(path, options = {})\n @@routes[path] = options\n end", "def url_for_options_paramdef_hash\n {\n :anchor => nil,\n :escape => nil,\n :host => nil,\n :only_path => nil,\n :password => nil,\n :port => nil,\n :protocol => nil,\n :skip_relative_url_root => nil,\n :trailing_slash => nil,\n :user => nil,\n\n :enable_optional_keys => true\n }.merge(routes_generate_options)\n end", "def data_set_routes\n @trains[0].set_route(routes[0])\n @trains[2].set_route(routes[2])\n end", "def setup_routes\n # route \"end\"\n route \" end\"\n route \" namespace :v1 do resources :notes, :only => [:index] end\"\n route \" namespace :api do\"\n route \"post '/api/v1/notes' => 'api/v1/notes#create', as: 'api_v1_notes'\" \n route \"get '/api/v1/notes/my' => 'api/v1/notes#my'\"\n route \"\\# api\"\n route \"root :to => 'jinda#index'\" \n route \"resources :jinda, :only => [:index, :new]\"\n route \"resources :password_resets\"\n route \"resources :sessions\"\n route \"resources :identities\"\n route \"resources :users\"\n route \"resources :docs\"\n route \"resources :notes\"\n route \"resources :comments\"\n route \"resources :articles do resources :comments end\"\n route \"get '/jinda/document/:id' => 'jinda#document'\"\n route \"get '/notes/destroy/:id' => 'notes#destroy'\"\n route \"get '/notes/my/destroy/:id' => 'notes#destroy'\"\n route \"get '/docs/my/destroy' => 'docs#destroy'\"\n route \"get '/notes/my' => 'notes/my'\"\n route \"get '/docs/my' => 'docs/my'\"\n route \"get '/articles/edit' => 'articles/edit'\"\n route \"get '/articles/show' => 'articles/show'\"\n route \"get '/logout' => 'sessions#destroy', :as => 'logout'\"\n route \"get '/auth/failure' => 'sessions#destroy'\"\n route \"get '/auth/:provider/callback' => 'sessions#create'\"\n route \"post '/auth/:provider/callback' => 'sessions#create'\" \n route \"mount Jinda::Engine => '/jinda'\"\n#\t\t route \"\\# end jinda method routes\"\n# route \"post '/jinda/end_output' => 'jinda#end_output'\"\n# route \"post '/jinda/end_form' => 'jinda#end_form'\"\n# route \"post '/jinda/pending' => 'jinda#index'\"\n# route \"post '/jinda/init' => 'jinda#init'\"\n# route \"jinda_methods.each do \\|aktion\\| get \\\"/jinda/\\#\\{aktion\\}\\\" => \\\"jinda#\\#\\{aktion\\}\\\" end\"\n# route \"jinda_methods += ['error_logs', 'notice_logs', 'cancel', 'run_output', 'end_output']\"\n# route \"jinda_methods += ['run_redirect', 'run_direct_to','run_if']\"\n# route \"jinda_methods += ['init', 'run', 'run_mail', 'document', 'run_do', 'run_form', 'end_form']\"\n# route \"jinda_methods = ['pending', 'status', 'search', 'doc', 'doc_print', 'logs', 'ajax_notice']\" \n# route \"\\# start jiinda method routes\"\n\t end", "def update!(**args)\n @mount_point = args[:mount_point] if args.key?(:mount_point)\n @path = args[:path] if args.key?(:path)\n @server = args[:server] if args.key?(:server)\n end", "def variables_for_edit\r\n @path = administration.article_cluster_category_path\r\n @method = :patch\r\n end", "def update!(**args)\n @app_gateway = args[:app_gateway] if args.key?(:app_gateway)\n @ingress_port = args[:ingress_port] if args.key?(:ingress_port)\n @l7psc = args[:l7psc] if args.key?(:l7psc)\n @type = args[:type] if args.key?(:type)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @new_path = args[:new_path] if args.key?(:new_path)\n @path = args[:path] if args.key?(:path)\n end", "def update!(**args)\n @new_path = args[:new_path] if args.key?(:new_path)\n @path = args[:path] if args.key?(:path)\n end", "def local_administration(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Local Administration\" page.\n begin\n @ff.link(:text, 'Local Administration').click\n self.msg(rule_name, :info, 'Local Administration', 'Reached page \\'Local Administration\\'.')\n rescue\n self.msg(rule_name, :error, 'Local Administration', 'Did not reach \\'Local Administration\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'local_administration','Some key NOT found.')\n return\n end \n \n # Parse the json file.\n \n # \"Using Primary Telnet Port\"\n if info.has_key?('Using Primary Telnet Port')\n \n case info['Using Primary Telnet Port']\n \n when 'on'\n \n # Set \"Using Primary Telnet Port (23)\".\n @ff.checkbox(:name,'sec_incom_telnet_pri').set\n self.msg(rule_name,:info,'Using Primary Telnet Port',info['Using Primary Telnet Port'])\n \n when 'off'\n \n # Clear \"Using Primary Telnet Port (23)\".\n @ff.checkbox(:name,'sec_incom_telnet_pri').clear\n self.msg(rule_name,:info,'Using Primary Telnet Port',info['Using Primary Telnet Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Using Primary Telnet Port\\'.')\n return\n \n end # end of case\n \n end # end of if\n \n # \"Using Secondary Telnet Port\"\n if info.has_key?('Using Secondary Telnet Port')\n \n case info['Using Secondary Telnet Port']\n \n when 'on'\n \n # Set \"Using Primary Telnet Port (23)\".\n @ff.checkbox(:name,'sec_incom_telnet_sec').set\n self.msg(rule_name,:info,'Using Secondary Telnet Port',info['Using Secondary Telnet Port'])\n \n when 'off'\n \n # Clear \"Using Primary Telnet Port (23)\".\n @ff.checkbox(:name,'sec_incom_telnet_sec').clear\n self.msg(rule_name,:info,'Using Secondary Telnet Port',info['Using Secondary Telnet Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Using Secondary Telnet Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Using Secure Telnet over SSL Port\"\n if info.has_key?('Using Secure Telnet over SSL Port')\n \n case info['Using Secure Telnet over SSL Port']\n \n when 'on'\n \n # Set \"Using Primary Telnet Port (23)\".\n @ff.checkbox(:name,'sec_incom_telnets').set\n self.msg(rule_name,:info,'Using Secure Telnet over SSL Port',info['Using Secure Telnet over SSL Port'])\n \n when 'off'\n \n # Clear \"Using Primary Telnet Port (23)\".\n @ff.checkbox(:name,'sec_incom_telnets').clear\n self.msg(rule_name,:info,'Using Secure Telnet over SSL Port',info['Using Secure Telnet over SSL Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Using Secure Telnet over SSL Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # Apply for the change\n @ff.link(:text,'Apply').click\n \n # Output the result.\n self.msg(rule_name,:info,'Set Local Administration','SUCCESS')\n \n end", "def update!(**args)\n @path_count = args[:path_count] if args.key?(:path_count)\n end", "def port_set(port)\n rebuild_uri :port => port\n end", "def update!(**args)\n @lvp_config = args[:lvp_config] if args.key?(:lvp_config)\n @shared_path_pv_count = args[:shared_path_pv_count] if args.key?(:shared_path_pv_count)\n end", "def update_path(path, choice)\n if( choice.start_with?(\"a\") ) #category was chosen\n if(path != \"\")\n path += \"|\"\n end\n\n path += choice + \"|p\"\n\n for product in Category.find(choice[1..choice.length]).products\n path += \":#{product.id}\"\n end\n\n return path\n end\n\n path = path.split(\"|\")\n\n for part in path\n if(part[0] == choice[0] && part.match(\"#{choice[0]}(:|$)\") != nil) #find the part in the path that will be replaced\n if(choice.start_with?(\"p\"))\n comp = Product.find(choice[1..choice.length])\n elsif(choice.start_with?(\"c\"))\n comp = Component.find(choice[1..choice.length])\n else #valuefield\n index = path.index(part)\n path[index] = \"#{choice}\"#insert component + valuefields + choices here\n return path.join(\"|\") #no children so return\n end\n\n #first sort the valuefields for the entry and create a sub path to be inserted\n valuefield_hash = sort_valuefield_children(comp.valuefields)\n\n val_entry = generate_entry(valuefield_hash,\"v\")\n\n #then sort the children for the entry and create a sub path to be inserted\n child_hash = sort_component_children(comp.components)\n\n comp_entry = generate_entry(child_hash,\"c\")\n\n index = path.index(part)\n\n path[index] = comp_entry\n path.insert(index, val_entry)\n path.insert(index, \"#{choice}\") # insert ...entry | val_entry | comp_entry... in proper place\n\n path.delete(\"\")\n return path.join(\"|\")\n end\n end\n logger.info(\"\\n\\n\\n\\n\\n no match found \\n\\n\\n\\n\\n\\n\")\n end", "def reload_routes\n\t\t\tconfig_path = File.expand_path(File.dirname(__FILE__) + \"/../../config\")\n\t\t\tload(config_path + \"/public_routes.rb\")\n\t\tend", "def update!(**args)\n @addons_node_port = args[:addons_node_port] if args.key?(:addons_node_port)\n @control_plane_node_port = args[:control_plane_node_port] if args.key?(:control_plane_node_port)\n @ingress_http_node_port = args[:ingress_http_node_port] if args.key?(:ingress_http_node_port)\n @ingress_https_node_port = args[:ingress_https_node_port] if args.key?(:ingress_https_node_port)\n @konnectivity_server_node_port = args[:konnectivity_server_node_port] if args.key?(:konnectivity_server_node_port)\n end", "def update_port(portName, attributes)\n @data['ports'].each do |port|\n next unless port['name'] == portName\n attributes.each { |key, value| port[key.to_s] = value }\n response = @client.rest_put(@data['uri'] + '/ports', 'body' => port)\n @client.response_handler(response)\n end\n end", "def conf_acl_port\n conf = $ts.dut.call(\"mesa_acl_port_conf_get\", 0)\n action = conf[\"action\"]\n action[\"port_action\"] = \"MESA_ACL_PORT_ACTION_REDIR\"\n action[\"port_list\"] = \"#{$port_list[1]}\"\n $ts.dut.call(\"mesa_acl_port_conf_set\", 0, conf)\nend", "def put_switches(fd)\n @switches.each do |n, s|\n s.ports.each do |k,p|\n if p.remote_switch_name != nil && @switches[p.remote_switch_name] != nil && @switches[p.remote_switch_name].ports[p.port_number] == nil\n #puts \"#{p.remote_switch_name} #{p.port_number} #{p.remote_port_name}\"\n @switches[p.remote_switch_name].ports[p.port_number] = Port.new(p.port_number)\n @switches[p.remote_switch_name].ports[p.port_number].port_name = \"#{p.port_number}/#{p.remote_port_name}\"\n @switches[p.remote_switch_name].ports[p.port_number].remote_switch_name = s.name\n @switches[p.remote_switch_name].ports[p.port_number].remote_port_name = p.port_name\n @switches[p.remote_switch_name].ports[p.port_number].remote_port_number = p.port_number\n @switches[p.remote_switch_name].ports[p.port_number].remote_mac = s.mac\n end\n end\n end\n @switches.each do |n, s|\n fd.puts \"\\\"#{s.name}\\\" [\"\n fd.print \"label = \\\"\"\n out = []\n out << \"<h0> #{s.name}\"\n s.ports.each do |k,p|\n if p.remote_switch_name != nil && @switches[p.remote_switch_name] != nil && p.remote_port_name !~ /MGT[AB]/ && p.port_name !~ /MGT[AB]/\n out << \"<p#{p.port_number}> #{p.port_name}\"\n @links[\"#{s.name}:p#{p.port_number}\"] = \"\\\"#{s.name}\\\":p#{p.port_number} -> \\\"#{p.remote_switch_name}\\\":p#{p.remote_port_number}\" #if @links[\"#{p.remote_switch_name}:p#{p.remote_port_number}\"] == nil\n end\n end\n fd.puts \"#{out.join(' | ')}\\\"\"\n fd.puts \"shape = \\\"record\\\"\\n];\"\n end\n end", "def setNodeConfiguration\n if !session[:user_id]\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n roomname = params[:setnodeconfiguration][\"roomname\"]\n collectionname = params[:setnodeconfiguration][\"collectionname\"]\n nodename = params[:setnodeconfiguration][\"nodename\"]\n\n #hash map key is CASE SENSITIVE\n configuration = Hash.new(\"configuration\")\n configuration[\"persistItems\"] = ((params[:setnodeconfiguration][\"persistitems\"]) == \"true\")? true:false\n configuration[\"userDependentItems\"] = ((params[:setnodeconfiguration][\"userdependentitems\"]) == \"true\")? true:false\n configuration[\"publishModel\"] = (params[:setnodeconfiguration][\"publishmodel\"]).to_i\n configuration[\"lazySubscription\"] = ((params[:setnodeconfiguration][\"lazysubscription\"]) == \"true\")? true:false\n configuration[\"allowPrivateMessages\"] = ((params[:setnodeconfiguration][\"allowprivatemessages\"]) == \"true\")? true:false\n configuration[\"modifyAnyItem\"] =( (params[:setnodeconfiguration][\"modifyanyitem\"]) == \"true\")? true:false\n configuration[\"accessModel\"] = (params[:setnodeconfiguration][\"accessmodel\"]).to_i\n configuration[\"itemStorageScheme\"] = (params[:setnodeconfiguration][\"itemstoragescheme\"]).to_i\n configuration[\"sessionDependentItems\"] = ((params[:setnodeconfiguration][\"sessiondependentitems\"]) == \"true\")? true:false\n configuration[\"p2pDataMessaging\"] =((params[:setnodeconfiguration][\"p2pdatamessaging\"]) == \"true\")? true:false\n\n begin\n am = session[:am]\n acc = Account.find_by_username(session[:user_id])\n if(acc.nil?)\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n return\n end\n am.keepalive(acc.username, acc.password)\n\n myroominfo = am.getRoomInfo(roomname)\n if(!myroominfo.nil? and myroominfo.isConnected == true)\n result = am.setNodeConfiguration(roomname, collectionname, nodename, configuration)\n flash[:result] = \"setNodeConfiguration result success: \" + result + \" \" + acc.roomURL + \" \" + collectionname + \" \" + nodename\n else\n result = \"Room is shutdown, this feature only available when room is started.\"\n flash[:notice] = result\n end\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n\n end", "def update!(**args)\n @ingress_port = args[:ingress_port] if args.key?(:ingress_port)\n @psc_uri = args[:psc_uri] if args.key?(:psc_uri)\n end", "def after_resource_to_hash_hook(res_hash, res)\n res_hash[:resources] = absolute_path(\"/slices/#{res.uuid}/resources\")\n res_hash\n end", "def save_original_path_envs\n circuit_originals[\"PATH_INFO\"] = @env[\"PATH_INFO\"]\n circuit_originals[\"SCRIPT_NAME\"] = @env[\"SCRIPT_NAME\"]\n end", "def update\n respond_to do |format|\n if @ht_route.update(ht_route_params)\n format.html { redirect_to @ht_route, notice: 'Ht route was successfully updated.' }\n format.json { render :show, status: :ok, location: @ht_route }\n else\n format.html { render :edit }\n format.json { render json: @ht_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def planner_output\n if current_user != nil\n @trip = Trip.find(params[:id])\n else\n redirect_to new_user_session_path\n end\n\n @trip.routes.each { |r| r.destroy }\n\n traveller_matching = TravellerMatching.new(@trip.to_object_container_no_routes)\n @trip.create_routes_from_trip_object(traveller_matching.trip)\n\n trip_json = traveller_matching.trip.to_json\n\n\n @trip.trip_json = trip_json\n @trip.save\n end", "def path(args={})\n unless self.name\n logger.warn '%s has no name' % self.class\n return ''\n end\n unless self.layout\n logger.warn 'No layout given'\n return ''\n end\n\n logger.debug 'Generating path for portlet %s' % self.name\n method = self.name+'_path'\n if self.respond_to?(method)\n return self.send(method, args)\n else\n # unknown path\n logger.warn 'Unknown path requested for portlet %s' % self.name\n return ''\n end\n end", "def update!(**args)\n @lvp_node_mounts_config = args[:lvp_node_mounts_config] if args.key?(:lvp_node_mounts_config)\n @lvp_share_config = args[:lvp_share_config] if args.key?(:lvp_share_config)\n end", "def update!(**args)\n @lvp_node_mounts_config = args[:lvp_node_mounts_config] if args.key?(:lvp_node_mounts_config)\n @lvp_share_config = args[:lvp_share_config] if args.key?(:lvp_share_config)\n end", "def entry_path_to_sw p\n puts \"P = #{p}\"\n p.each do | map |\n sw = map[:dpid]\n out_port = map[:out_port].to_i\n @outPorts[sw] = [] unless @outPorts.key?(sw)\n @outPorts[sw] << out_port unless @outPorts[sw].include?(out_port)\n end\n end", "def path(v)\n endpoint_info[:path] = v\n end", "def assign_paths\n self.path = generate_path(self)\n end", "def view_paths=(paths); end", "def update number, routes\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def send (hash)\n @routes.merge! hash\n end", "def update\n respond_to do |format|\n \n # change format of names\n names = graphium_configuration_params[:swarm_agent_names]\n names_to_save = []\n names = names.split(',')\n names.each do |name|\n names_to_save << name\n end\n graphium_configuration_params[:swarm_agent_names] = names_to_save\n \n # change format of colors\n colors = graphium_configuration_params[:swarm_agent_colors]\n colors_to_save = []\n colors = colors.split(',')\n colors.each do |color|\n colors_to_save << color\n end\n graphium_configuration_params[:swarm_agent_colors] = colors_to_save\n logger.info 'PARAMS'\n logger.info graphium_configuration_params\n \n # updating manually\n @graphium_configuration.swarm_agent_number = graphium_configuration_params[:swarm_agent_number]\n @graphium_configuration.swarm_agent_names_API = graphium_configuration_params[:swarm_agent_names_API]\n @graphium_configuration.swarm_agent_names = names_to_save\n @graphium_configuration.mongo_db = graphium_configuration_params[:mongo_db]\n @graphium_configuration.mongo_host = graphium_configuration_params[:mongo_host]\n @graphium_configuration.mongo_port = graphium_configuration_params[:mongo_port]\n @graphium_configuration.swarm_agent_colors = colors_to_save\n @graphium_configuration.inf_positive = graphium_configuration_params[:inf_positive]\n @graphium_configuration.inf_negative = graphium_configuration_params[:inf_negative]\n @graphium_configuration.osmapi_user = graphium_configuration_params[:osmapi_user]\n @graphium_configuration.osmapi_password = graphium_configuration_params[:osmapi_password]\n @graphium_configuration.swarm_seconds_to_check_agents = graphium_configuration_params[:swarm_seconds_to_check_agents]\n \n if @graphium_configuration.save\n \n format.html { redirect_to \"/graphium/configurations/1/edit\", notice: 'Configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @graphium_configuration }\n else\n format.html { render :edit }\n format.json { render json: @graphium_configuration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @manual_lb_config = args[:manual_lb_config] if args.key?(:manual_lb_config)\n @port_config = args[:port_config] if args.key?(:port_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @routes = args[:routes] if args.key?(:routes)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def load(cfg)\n @cfg = cfg\n @routes = {}\n #get a logger..\n # log to specified dir\n @logger = TileLumber.new(cfg[\"log\"])\n @logger.logstatus(\"Starting.\")\n \n #mount up the /benchmark area..\n reg( cfg[\"http\"][\"base\"] + \"/benchmark\", BenchmarkHandler.new(@logger))\n \n path = cfg[\"http\"][\"base\"] + cfg[\"controller\"][\"base_url\"]\n @logger.msginfo(\"Main:Setting up the controller at '#{path}''\")\n reg( path , ControllerHandler.new(@logger,cfg, self ))\n \n #loop though the tile engines in the config file, and fire up and mount each..\n configs(cfg) do |tcfg|\n path = cfg[\"http\"][\"base\"] + \"/\" + tcfg[\"title\"] + \"/tile/\"\n @logger.msginfo(\"Main:Setting up '#{path}''\")\n reg(path, TileHandler.new(tcfg, @logger, cfg[\"http\"]))\n path = cfg[\"http\"][\"base\"] + \"/\" + tcfg[\"title\"] + \"/bbox/\"\n @logger.msginfo(\"Main:Setting up '#{path}''\")\n reg(path, BBoxTileHandler.new(tcfg, @logger, cfg[\"http\"]))\n path = cfg[\"http\"][\"base\"] + \"/ArcGIS/rest/services/\" + tcfg[\"title\"] + \"/MapServer/\"\n @logger.msginfo(\"Main:Setting up '#{path}''\")\n reg(path, ESRIRestTileHandler.new(tcfg, @logger, cfg[\"http\"]))\n if ( tcfg[\"kml\"])\n\t path = cfg[\"http\"][\"base\"] + \"/\" + tcfg[\"title\"] + \"/kml/\"\n\t reg(path,KMLHandler.new(@logger, cfg[\"http\"], tcfg[\"title\"]))\n end\n end\n \n ##\n # ESRI TOC serving gadget..\n reg(cfg[\"http\"][\"base\"] + \"/ArcGIS/rest/services\", ESRI_Service_Fooler.new(@logger, cfg[\"esri\"]))\n reg(cfg[\"http\"][\"base\"] + \"/ArcGIS/rest/info\", ESRI_Service_Fooler_Info.new(@logger, cfg[\"esri\"]))\n @logger.logstatus(\"Up.\")\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "def inject_routes\n gsub_file 'config/routes.rb', /root (:to =>|to:) \"catalog#index\"/, ''\n gsub_file 'config/routes.rb', /'welcome#index'/, \"'sufia/homepage#index'\" # Replace the root path injected by CurationConcerns\n\n routing_code = \"\\n Hydra::BatchEdit.add_routes(self)\\n\" \\\n \" # This must be the very last route in the file because it has a catch-all route for 404 errors.\\n\" \\\n \" # This behavior seems to show up only in production mode.\\n\" \\\n \" mount Sufia::Engine => '/'\\n\"\n\n sentinel = /devise_for :users/\n inject_into_file 'config/routes.rb', routing_code, after: sentinel, verbose: false\n end", "def patches\n {:p0 =>\n \"https://trac.macports.org/export/82481/trunk/dports/net/cclive/files/patch-configure.diff\"\n }\n end", "def number4(json_file)\n #puts json_file\n puts \"name = #{json_file['name']}\".green\n puts \"description = #{json_file['description']}\".green\n puts \"url = #{json_file['routes']['/']['_links']['self']}\".green\n puts\n\n\n\n all_routes = get_all_routes(json_file)\n all_routes.each do |key, value|\n puts \"Route : #{key}\".blue\n found = false\n\n # check if there is a link \n if value[\"_links\"] != nil\n link = value['_links']['self']\n found = true\n else\n link = \"There is no link. You should check by hand.\"\n end\n\n # check the methods available \n methods = value[\"methods\"]\n methods.each do |k, v|\n if found\n code = 0\n case k\n when \"GET\"\n response = HTTParty.get(link, follow_redirects: false) \n code = response.code\n when \"POST\"\n response = HTTParty.post(link, body: {foo: 'bar'}, follow_redirects: false)\n code = response.code\n when \"HEAD\"\n response = HTTParty.head(link, follow_redirects: false)\n code = response.code\n when \"PUT\"\n response = HTTParty.put(link, follow_redirects: false)\n code = response.code\n when \"DELETE\"\n response = HTTParty.delete(link, follow_redirects: false)\n code = response.code\n when \"OPTIONS\"\n response = HTTParty.options(link, follow_redirects: false)\n code = response.code\n when \"PATCH\"\n response = HTTParty.patch(link, follow_redirects: false)\n code = response.code\n end\n if code == 401 or code == 403 or code == 404 or code == 301 or code == 302\n puts \"Method : #{k} ---> response code = #{code}\".red\n elsif code == 200\n puts \"Method : #{k} ---> response code = #{code}\".green\n else \n puts \"Method : #{k} ---> response code = #{code}\".yellow\n end\n else\n puts \"Method : #{k}\"\n end\n end\n\n # put the link \n if link == \"There is no link. You should check by hand.\"\n puts \"---> [ #{link} ]\".yellow\n else\n puts \"---> [ #{link} ]\"\n end\n\n # create space\n puts \"\\n\\n\\n\"\n end\n exit\nend", "def update\n respond_to do |format|\n if @rec_run_route.update(rec_run_route_params)\n flash[:success] = \"Recreational Run Route Updated.\"\n format.html { redirect_to admin_rec_run_routes_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rec_run_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parcel_route.update(parcel_route_params)\n format.html { redirect_to @parcel_route, notice: 'Parcel route was successfully updated.' }\n format.json { render :show, status: :ok, location: @parcel_route }\n else\n format.html { render :edit }\n format.json { render json: @parcel_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @control_plane_node_port = args[:control_plane_node_port] if args.key?(:control_plane_node_port)\n @ingress_http_node_port = args[:ingress_http_node_port] if args.key?(:ingress_http_node_port)\n @ingress_https_node_port = args[:ingress_https_node_port] if args.key?(:ingress_https_node_port)\n @konnectivity_server_node_port = args[:konnectivity_server_node_port] if args.key?(:konnectivity_server_node_port)\n end", "def update\n @route.set_processed\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to new_routes_path, notice: 'Die Route wurde aktualisiert und aktiv gesetzt' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def reset\n @lookup_paths = {} # (Hash.new)\n @tree = Rack::App::Router::Tree.new\n compile_registered_endpoints!\n end", "def init_routes\n puts \"Adding the caboose store routes...\"\n \n filename = File.join(@app_path,'config','routes.rb')\n return if !File.exists?(filename)\n return if !@force\n \n str = \"\" \n str << \"\\t# Catch everything with caboose\\n\" \n str << \"\\tmount CabooseStore::Engine => '/'\\n\"\n \n file = File.open(filename, 'rb')\n contents = file.read\n file.close \n if (contents.index(str).nil?)\n arr = contents.split('end', -1)\n str2 = arr[0] + \"\\n\" + str + \"\\nend\" + arr[1]\n File.open(filename, 'w') {|file| file.write(str2) }\n end \n end", "def routes_generate_options\n {\n :action => action_ref(:class => :controller),\n #TODO named root params\n :controller => controller_ref,\n :generate_all => nil,\n :method => link_to_methods,\n :use_route => nil,\n\n }\n end", "def add_plugin_routes(map)\n # these are in use\n map.connect 'users/:id/password', :controller => 'users', :action => 'password'\n map.connect 'users/:id/social', :controller => 'users', :action => 'social'\n map.user_contact '/contact', :controller => 'users', :action => 'contact', :conditions => { :method => :get }\n map.conference_account '/conferences/:id/account', :controller => 'conferences', :action => 'account', :conditions => { :method => :get }\n map.conference_dashboard '/conferences/:id/dashboard', :controller => 'conferences', :action => 'dashboard', :conditions => { :method => :get }\n map.conference_workspace '/conferences/:id/workspace', :controller => 'conferences', :action => 'workspace', :conditions => { :method => :get }\n map.conference_invitation '/invitation/:id', :controller => 'conferences', :action => 'invitation', :conditions => { :method => :get }\n\n # pretty sure these are depreciated\n map.numbers '/numbers', :controller => 'conferences', :action => 'numbers', :conditions => { :method => :get }\n map.reference '/reference', :controller => 'conferences', :action => 'reference', :conditions => { :method => :get }\n map.resources :conferences, :has_many => :callees\n map.account_rates '/rates', :controller => 'accounts', :action => 'rates', :conditions => { :method => :get }\n map.email_remove '/emails/:id/remove', :controller => 'emails', :action => 'remove'\n\n # no idea about these ...\n map.modify_conference '/conferences/:id/modify', :controller => 'conferences', :action => 'modify', :conditions => { :method => :get }\n map.user_search '/users_search', :controller => 'users', :action => 'search', :conditions => { :method => :get }\n map.start '/start', :controller => 'conferences', :action => 'start', :conditions => { :method => :get }\n map.guest '/guest', :controller => 'conferences', :action => 'guest', :conditions => { :method => :get }\n\n map.upload '/upload.:format', :controller => 'media_files', :action => 'upload', :conditions => { :method => :post }\n map.upload '/upload.:format', :controller => 'media_files', :action => 'options', :conditions => { :method => :options }\n\n Hobo.add_routes(map)\n end", "def update!(**args)\n @port_name = args[:port_name] if args.key?(:port_name)\n @server_name = args[:server_name] if args.key?(:server_name)\n end", "def inject_routes\n routing_code = \"Hydra::BatchEdit.add_routes(self)\"\n sentinel = /HydraHead.add_routes\\(self\\)/\n inject_into_file 'config/routes.rb', \"\\n #{routing_code}\\n\", { :after => sentinel, :verbose => false }\n\n routing_code = \"\\n # This must be the very last route in the file because it has a catch all route for 404 errors.\n # This behavior seems to show up only in production mode.\n mount Sufia::Engine => '/'\\n\"\n sentinel = /devise_for :users/\n inject_into_file 'config/routes.rb', routing_code, { :after => sentinel, :verbose => false }\n \n end", "def update\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n categories = [:general, :menu, :topic, :note, :smtp, :feed, :user, :log]\n\n yaml = ApplicationHelper.get_config_yaml\n\n categories.each do |cat|\n next if params[cat].nil? or params[cat].empty?\n\n yaml[cat] = Hash.new if yaml[cat].nil?\n\n params[cat].each do |key, val|\n if cat == :general\n case key\n when 'symbol_image'\n ConfigHelper.save_img('symbol.png', val) if val.size > 0\n else\n yaml[cat][key] = val\n end\n elsif cat == :topic\n case key\n when 'src'\n ConfigHelper.save_html('topics.html', val) if val.size > 0\n else\n yaml[cat][key] = val\n end\n elsif cat == :note\n case key\n when 'src'\n ConfigHelper.save_html('note.html', val) if val.size > 0\n else\n yaml[cat][key] = val\n end\n else\n if params[:smtp]['auth_enabled'] == '0'\n val = nil if ['auth', 'user_name', 'password'].include?(key)\n end\n yaml[cat][key] = val\n end\n end\n end\n\n ApplicationHelper.save_config_yaml(yaml)\n\n flash[:notice] = t('msg.update_success')\n redirect_to(:controller => 'config', :action => 'edit')\n end", "def routes_map; end", "def update!(**args)\n @bgp_lb_config = args[:bgp_lb_config] if args.key?(:bgp_lb_config)\n @manual_lb_config = args[:manual_lb_config] if args.key?(:manual_lb_config)\n @metal_lb_config = args[:metal_lb_config] if args.key?(:metal_lb_config)\n @port_config = args[:port_config] if args.key?(:port_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def update\n @route = Route.find(params[:id])\n if user_signed_in?\n routeInfo = JSON.parse(params[:route_map_points].gsub(\"jb\",\"latitude\").gsub(\"kb\",\"longitude\"))\n \n \n @route.route_points = routeInfo['overview_path']\n @route.starting_point = routeInfo['overview_path'].first\n @route.end_point = routeInfo['overview_path'].last\n\n\n respond_to do |format|\n if @route.save(params[:route])\n if @route.schedule.update_attributes(\n departure: params[:route_schedule_departure], \n arrival: params[:route_schedule_arrival]) \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end\nend\n # DELETE /routes/1\n # DELETE /routes/1.json\n def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end\nend", "def update\n respond_to do |format|\n if @route_builder.update(route_builder_params)\n format.html { redirect_to @route_builder, notice: 'Route builder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route_builder.errors, status: :internal_server_error }\n end\n end\n\n end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def update\n respond_to do |format|\n if @port.update(port_params)\n format.html { redirect_to @port, notice: \"Port was successfully updated.\" }\n format.json { render :show, status: :ok, location: @port }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @port.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize\n @routes = {}\n end", "def remote_administration(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Remote Administration\" page.\n begin\n @ff.link(:text, 'Remote Administration').click\n self.msg(rule_name, :info, 'Remote Administration', 'Reached page \\'Remote Administration\\'.')\n rescue\n self.msg(rule_name, :error, 'Remote Administration', 'Did not reach \\'Remote Administration\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'local_administration','Some key NOT found.')\n return\n end \n \n # Parse the json file.\n \n # \"Using Primary Telnet Port\"\n if info.has_key?('Using Primary Telnet Port')\n \n case info['Using Primary Telnet Port']\n \n when 'on'\n \n # Set \"Using Primary Telnet Port\"\n @ff.checkbox(:name,'is_telnet_primary').set\n self.msg(rule_name,:info,'Using Primary Telnet Port',info['Using Primary Telnet Port'])\n \n when 'off'\n \n # Clear \"Using Primary Telnet Port\"\n @ff.checkbox(:name,'is_telnet_primary').clear\n self.msg(rule_name,:info,'Using Primary Telnet Port',info['Using Primary Telnet Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'remote_administration','Did NOT find the value in \\'Using Primary Telnet Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Using Secondary Telnet Port\"\n if info.has_key?('Using Secondary Telnet Port')\n \n case info['Using Secondary Telnet Port']\n \n when 'on'\n \n # Set \"Using Secondary Telnet Port\"\n @ff.checkbox(:name,'is_telnet_secondary').set\n self.msg(rule_name,:info,'Using Secondary Telnet Port',info['Using Secondary Telnet Port'])\n \n when 'off'\n \n # Clear \"Using Secondary Telnet Port\"\n @ff.checkbox(:name,'is_telnet_secondary').clear\n self.msg(rule_name,:info,'Using Secondary Telnet Port',info['Using Secondary Telnet Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'remote_administration','Did NOT find the value in \\'Using Secondary Telnet Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Using Secure Telnet over SSL Port\"\n if info.has_key?('Using Secure Telnet over SSL Port')\n \n case info['Using Secure Telnet over SSL Port']\n \n when 'on'\n \n # Set \"Using Secure Telnet over SSL Port\"\n @ff.checkbox(:name,'is_telnet_ssl').set\n self.msg(rule_name,:info,'Using Secure Telnet over SSL Port',info['Using Secure Telnet over SSL Port'])\n \n when 'off'\n \n # Clear \"Using Secure Telnet over SSL Port\"\n @ff.checkbox(:name,'is_telnet_ssl').clear\n self.msg(rule_name,:info,'Using Secure Telnet over SSL Port',info['Using Secure Telnet over SSL Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'remote_administration','Did NOT find the value in \\'Using Secure Telnet over SSL Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Using Primary HTTP Port\"\n if info.has_key?('Using Primary HTTP Port')\n \n case info['Using Primary HTTP Port']\n \n when 'on'\n \n # Set \"Using Primary HTTP Port\"\n @ff.checkbox(:name,'is_http_primary').set\n self.msg(rule_name,:info,'Using Primary HTTP Port',info['Using Primary HTTP Port'])\n \n when 'off'\n \n # Clear \"Using Primary HTTP Port\"\n @ff.checkbox(:name,'is_http_primary').clear\n self.msg(rule_name,:info,'Using Primary HTTP Port',info['Using Primary HTTP Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'remote_administration','Did NOT find the value in \\'Using Primary HTTP Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Using Secondary HTTP Port\"\n if info.has_key?('Using Secondary HTTP Port')\n \n case info['Using Secondary HTTP Port']\n \n when 'on'\n \n # Set \"Using Secondary HTTP Port\"\n @ff.checkbox(:name,'is_http_secondary').set\n self.msg(rule_name,:info,'Using Secondary HTTP Port',info['Using Secondary HTTP Port'])\n \n when 'off'\n \n # Clear \"Using Secondary HTTP Port\"\n @ff.checkbox(:name,'is_http_secondary').clear\n self.msg(rule_name,:info,'Using Secondary HTTP Port',info['Using Secondary HTTP Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'remote_administration','Did NOT find the value in \\'Using Secondary HTTP Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Using Primary HTTPS Port\"\n if info.has_key?('Using Primary HTTPS Port')\n \n case info['Using Primary HTTPS Port']\n \n when 'on'\n \n # Set \"Using Primary HTTPS Port\"\n @ff.checkbox(:name,'is_https_primary').set\n self.msg(rule_name,:info,'Using Primary HTTPS Port',info['Using Primary HTTPS Port'])\n \n when 'off'\n \n # Clear \"Using Primary HTTPS Port\"\n @ff.checkbox(:name,'is_https_primary').clear\n self.msg(rule_name,:info,'Using Primary HTTPS Port',info['Using Primary HTTPS Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'remote_administration','Did NOT find the value in \\'Using Primary HTTPS Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Using Secondary HTTPS Port\"\n if info.has_key?('Using Secondary HTTPS Port')\n \n case info['Using Secondary HTTPS Port']\n \n when 'on'\n \n # Set \"Using Secondary HTTPS Port\"\n @ff.checkbox(:name,'is_https_secondary').set\n self.msg(rule_name,:info,'Using Secondary HTTPS Port',info['Using Secondary HTTPS Port'])\n \n when 'off'\n \n # Clear \"Using Secondary HTTPS Port\"\n @ff.checkbox(:name,'is_https_secondary').clear\n self.msg(rule_name,:info,'Using Secondary HTTPS Port',info['Using Secondary HTTPS Port'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'remote_administration','Did NOT find the value in \\'Using Secondary HTTPS Port\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Allow Incoming WAN ICMP Echo Requests\"\n if info.has_key?('Allow Incoming WAN ICMP Echo Requests')\n \n case info['Allow Incoming WAN ICMP Echo Requests']\n \n when 'on'\n \n # Set \"Allow Incoming WAN ICMP Echo Requests\"\n @ff.checkbox(:name,'is_diagnostics_icmp').set\n self.msg(rule_name,:info,'Allow Incoming WAN ICMP Echo Requests',info['Allow Incoming WAN ICMP Echo Requests'])\n \n when 'off'\n \n # Clear \"Allow Incoming WAN ICMP Echo Requests\"\n @ff.checkbox(:name,'is_diagnostics_icmp').clear\n self.msg(rule_name,:info,'Allow Incoming WAN ICMP Echo Requests',info['Allow Incoming WAN ICMP Echo Requests'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'remote_administration','Did NOT find the value in \\'Allow Incoming WAN ICMP Echo Requests\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Allow Incoming WAN UDP Traceroute Queries\"\n if info.has_key?('Allow Incoming WAN UDP Traceroute Queries')\n \n case info['Allow Incoming WAN UDP Traceroute Queries']\n \n when 'on'\n \n # Set \"Allow Incoming WAN UDP Traceroute Queries\"\n @ff.checkbox(:name,'is_diagnostics_traceroute').set\n self.msg(rule_name,:info,'Allow Incoming WAN UDP Traceroute Queries',info['Allow Incoming WAN UDP Traceroute Queries'])\n \n when 'off'\n \n # Clear \"Allow Incoming WAN UDP Traceroute Queries\"\n @ff.checkbox(:name,'is_diagnostics_traceroute').clear\n self.msg(rule_name,:info,'Allow Incoming WAN UDP Traceroute Queries',info['Allow Incoming WAN UDP Traceroute Queries'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'remote_administration','Did NOT find the value in \\'Allow Incoming WAN UDP Traceroute Queries\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # Apply for the change\n @ff.link(:text,'Apply').click\n \n # Output the result.\n self.msg(rule_name,:info,\"Set remote administration\",'SUCCESS')\n \n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @matched_port_range = args[:matched_port_range] if args.key?(:matched_port_range)\n @matched_protocol = args[:matched_protocol] if args.key?(:matched_protocol)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @target = args[:target] if args.key?(:target)\n @uri = args[:uri] if args.key?(:uri)\n @vip = args[:vip] if args.key?(:vip)\n end", "def config_sim(paths)\r\n @paths = paths\r\n @passengers = initialize_passengers\r\n\r\n # Plan each passenger's trip\r\n passengers.each_with_index { |x, index|\r\n s1 = paths[x.passenger].first\r\n s2 = paths[x.passenger].last\r\n p = plan(s1, s2)\r\n c = color(plan(s1,s2))\r\n x.set_plan(Hash[p.zip(c.map {|i| i.include?(',') ? (i.split /, /) : i})])\r\n # when passenger has more than 2 stops?\r\n }\r\n \r\n i = 0\r\n @paths.each {|name, path|\r\n #find the station in the first index of path array\r\n @stations.each {|x| \r\n if x.to_s.include? path.first\r\n #add Passenger in passenger attribute of that station\r\n x.add_passenger(@passengers.at(i))\r\n i += 1\r\n end\r\n }\r\n }\r\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @display_preference = args[:display_preference] if args.key?(:display_preference)\n @metadata = args[:metadata] if args.key?(:metadata)\n @route = args[:route] if args.key?(:route)\n @route_direction = args[:route_direction] if args.key?(:route_direction)\n end", "def after_update_path_for(resource)\n puts :protocol\n me_url(:protocol => 'http')\n end", "def update!(**args)\n @autonomous_system_number = args[:autonomous_system_number] if args.key?(:autonomous_system_number)\n @juniper_alias = args[:juniper_alias] if args.key?(:juniper_alias)\n @name = args[:name] if args.key?(:name)\n @route_target = args[:route_target] if args.key?(:route_target)\n @state = args[:state] if args.key?(:state)\n end", "def reset\n VALID_CONFIG_KEYS.each do |k, v|\n send(\"#{k}=\", v)\n end\n self.rpc_spec_path = ::ENV.fetch('RPC_SPEC_PATH', DEFAULT_RSPEC_PATH).to_s\n options\n end", "def named_routes=(_arg0); end", "def apply_options\n state = build_edit_state\n changes = RokuBuilder.options_parse(options: @options[:edit_params])\n changes.each {|key,value|\n if [:ip, :user, :password].include?(key)\n @config[:devices][state[:device]][key] = value\n elsif [:directory, :app_name].include?(key) #:folders, :files\n @config[:projects][state[:project]][key] = value\n elsif [:branch].include?(key)\n @config[:projects][state[:project]][:stages][state[:stage]][key] = value\n end\n }\n end", "def update!(**args)\n @ad_tracking_id = args[:ad_tracking_id] if args.key?(:ad_tracking_id)\n @path1 = args[:path1] if args.key?(:path1)\n @path2 = args[:path2] if args.key?(:path2)\n end" ]
[ "0.54691124", "0.54313755", "0.5422103", "0.52584773", "0.52584773", "0.5255144", "0.52341664", "0.5232783", "0.5198125", "0.51792955", "0.51554805", "0.5000673", "0.49684203", "0.49314374", "0.48687118", "0.48135903", "0.4780192", "0.47723714", "0.47446775", "0.4742579", "0.4742377", "0.47306684", "0.4721116", "0.46916062", "0.4676999", "0.46766087", "0.46713892", "0.46533492", "0.46526614", "0.4646225", "0.46393025", "0.4624964", "0.4624964", "0.46193215", "0.46073967", "0.46032044", "0.46011934", "0.45976678", "0.4592202", "0.45860413", "0.45830542", "0.45819658", "0.4581135", "0.45720872", "0.45668727", "0.45640266", "0.45589983", "0.45573184", "0.4556529", "0.45557916", "0.45435035", "0.45435035", "0.45430538", "0.45354167", "0.45171404", "0.4514988", "0.45105672", "0.45104358", "0.45018083", "0.44998375", "0.44957957", "0.44830176", "0.44771641", "0.44771641", "0.44771641", "0.44771641", "0.44739854", "0.4468795", "0.4467737", "0.44664603", "0.44625506", "0.44536948", "0.44522807", "0.44378135", "0.44368508", "0.44341567", "0.44328493", "0.44282797", "0.44247332", "0.44195125", "0.44177064", "0.4414016", "0.44120857", "0.44111478", "0.44089136", "0.44089136", "0.44089136", "0.44064853", "0.43955353", "0.43920237", "0.43902805", "0.43868378", "0.43864372", "0.43812665", "0.43737116", "0.43700367", "0.4369647", "0.43678987", "0.4367223", "0.43657225" ]
0.64452714
0
Moves the :max, :min, :before, and :after options to data attributes, formats the value, and merges this with any other options.
def input_html_options data = {} data[:min] = options[:min] if options[:min].present? data[:max] = options[:max] if options[:max].present? data[:before] = options[:before] if options[:before].present? data[:after] = options[:after] if options[:after].present? super.deep_merge( value: format_value(@builder.object.send(attribute_name)), type: 'text', data: data ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_data # :nodoc:\n if @y_axis_increment && !@hide_line_markers\n self.maximum_value = [@y_axis_increment, maximum_value, (maximum_value.to_f / @y_axis_increment).round * @y_axis_increment].max\n self.minimum_value = [minimum_value, (minimum_value.to_f / @y_axis_increment).round * @y_axis_increment].min\n end\n end", "def format_attributes\n self.start_on = self.end_on - self.duration if duration? && end_on? && !start_on?\n self.duration = (self.end_on - self.start_on).to_i if start_on? && end_on? && !duration?\n self.end_on = self.start_on + self.duration if start_on? && duration? && !end_on?\n end", "def parse(aeries_data, aeries_attributes_list, setters_list)\n super\n self.show_min_date = DateTime.parse(show_min_date) unless show_min_date.nil?\n self.show_max_date = DateTime.parse(show_max_date) unless show_max_date.nil?\n self.count_min_date = DateTime.parse(count_min_date) unless count_min_date.nil?\n self.count_max_date = DateTime.parse(count_max_date) unless count_max_date.nil?\n end", "def value_for(**options)\n\t\t\t\t\tif value = raw_value_for(**options)\n\t\t\t\t\t\tself.format(value, **options)\n\t\t\t\t\tend\n\t\t\t\tend", "def normalize_options\n copy_options_to_attributes(ATTRIBUTE_OPTIONS)\n copy_boolean_options_to_attributes(ATTRIBUTE_BOOLEAN_OPTIONS)\n handle_key_option\n handle_errors_option\n\n Forme.attr_classes(@attr, @opts[:class]) if @opts.has_key?(:class)\n\n if @opts[:error]\n Forme.attr_classes(@attr, 'error')\n @attr[\"aria-invalid\"] = \"true\"\n if @opts.fetch(:error_handler, true)\n if @opts[:error_id]\n @attr['aria-describedby'] ||= @opts[:error_id]\n else\n if id = @attr[:id] || @attr['id']\n error_id = @attr['aria-describedby'] ||= \"#{id}_error_message\"\n @opts[:error_id] = error_id\n end\n end\n end\n end\n\n if data = opts[:data]\n data.each do |k, v|\n k = k.to_s.tr(\"_\", \"-\") if k.is_a?(Symbol) && input.opts[:dasherize_data]\n sym = :\"data-#{k}\"\n @attr[sym] = v unless @attr.has_key?(sym)\n end\n end\n end", "def format\n if !self[:value].nil?\n formats = self[:value].delete(:format)\n options = self[:value].delete(:option)\n df_value = self[:value].delete(:default_value)\n\n self[:value] = {}\n self[:value][:format] = formats\n self[:value][:option] = {}\n if !options.nil?\n options.keys.each {|k| self[:value][:option][k.to_sym] = options[k] if self[:value][:option][k.to_sym].nil?}\n end\n self[:value][:default_value] = df_value\n end\n self[:value] ||= {}\n self[:value][:format] ||= :number\n self[:value][:format].to_sym\n end", "def inspect\n attributes = [ :min, :max, :value ].map do |attribute|\n \"#{ attribute }=#{ '%f' % public_send(attribute) }\"\n end\n\n \"#<#{ self.class.name } #{ attributes.join(' ' ) }>\"\n end", "def slide_range_tag_helper(form, attr, val, attrs = {})\n attrs = {min: 0, max: 100, step: 1, class: ''}.merge(attrs)\n val = val.presence || \"#{attrs[:min]},#{attrs[:max]}\"\n \"<div class='row hook_caller' data-callback='build_slide_range_field_helper'>\n <div class='col-sm-2'><span></span> Years</div>\n <div class='col-sm-8'>#{form.text_field attr, class: \"slider_field #{attrs[:class]}\", 'data-slider-min' => attrs[:min], 'data-slider-step' => attrs[:step], \"data-slider-max\" => attrs[:max], \"data-slider-value\" => \"[#{val}]\"}</div>\n <div class='col-sm-2'><span></span> Years</div>\n </div>\".html_safe\n end", "def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end", "def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end", "def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n @original_mean = args[:original_mean] if args.key?(:original_mean)\n @original_stddev = args[:original_stddev] if args.key?(:original_stddev)\n end", "def normalize(options = {})\n return unless valid? # Only normalize valid value\n\n @value = case datatype\n when XSD.boolean then %(1 true).include?(@value.to_s.downcase) ? \"true\" : \"false\"\n when XSD.integer then @value.to_i.to_s\n when XSD.decimal then normalize_decimal(@value, options)\n when XSD.double then normalize_double(@value, options)\n when XSD.time then @value.is_a?(Time) ? @value.strftime(\"%H:%M:%S%Z\").sub(/\\+00:00|UTC/, \"Z\") : @value.to_s\n when XSD.dateTime then @value.is_a?(DateTime) ? @value.strftime(\"%Y-%m-%dT%H:%M:%S%Z\").sub(/\\+00:00|UTC/, \"Z\") : @value.to_s\n when XSD.date then @value.is_a?(Date) ? @value.strftime(\"%Y-%m-%d%Z\").sub(/\\+00:00|UTC/, \"Z\") : @value.to_s\n when RDF.XMLLiteral then normalize_xmlliteral(@value, options)\n else @value.to_s\n end\n end", "def standardizeValue()\n minMax = []\n minMax = getMinMax(@skater_data,\"0\")\n zero(@skater_data,\"0\",minMax)\n minMax = getMinMax(@skater_data,\"1\")\n zero(@skater_data,\"1\",minMax)\n minMax = getMinMax(@goalie_data,\"G\")\n zero(@goalie_data,\"G\",minMax)\nend", "def create_datetime_options(attrs, method = nil)\n values = if (time = attrs[:value])\n case time\n when Time, DateTime\n { :day => time.day,\n :month => time.month,\n :year => time.year,\n :hour => time.hour,\n :minute => time.min }\n when Date\n { :day => time.day,\n :month => time.month,\n :year => time.year }\n end\n end\n\n datetime_options.inject({}) do |h, (suffix, defaults)|\n h[suffix] = defaults.merge(attrs).merge(\n :id => '%s_%s' % [attrs[:id] || attrs[:name], suffix],\n :name => '%s[%s]' % [attrs[:name] || attrs[:id], suffix],\n :value => values && values[suffix]\n ) ; h\n end\n end", "def build_field_options(value, _index)\n return super if defined?(super)\n\n dom_id = input_dom_id if respond_to?(:input_dom_id)\n dom_id ||= \"#{object_name}_#{attribute_name}\"\n\n input_html_options.dup.tap do |options|\n options[:value] = value\n\n options[:id] ||= dom_id\n options[:class] ||= []\n options[:class] += [\"#{dom_id} form-control\"]\n options[:'aria-labelledby'] ||= \"#{dom_id}_label\"\n end\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @date_format = args[:date_format] if args.key?(:date_format)\n @date_format_type = args[:date_format_type] if args.key?(:date_format_type)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end", "def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n @strict_max_enabled = args[:strict_max_enabled] if args.key?(:strict_max_enabled)\n @strict_min_enabled = args[:strict_min_enabled] if args.key?(:strict_min_enabled)\n end", "def formatted_value=(obj)\n @formatted_value = obj\n end", "def set_options\n if minimum.present? && maximum.present? && step.present? && step.to_f.nonzero?\n if default_value.present?\n decimal_minimum = BigDecimal(minimum.to_s)\n decimal_maximum = BigDecimal(maximum.to_s)\n decimal_step = BigDecimal(step.to_s)\n decimal_default = BigDecimal(default_value.to_s)\n\n # The default value is lower than the minimum value.\n if decimal_default < decimal_minimum\n errors.add(:default_value, _('must be a valid option'))\n end\n\n # The default value less than a step away from the maximum value.\n if ((decimal_maximum - decimal_default) / decimal_step).floor.zero?\n errors.add(:default_value, _('must be a step away from the maximum'))\n end\n\n # The default value less than a step away from the minimum value.\n steps = ((decimal_default - decimal_minimum) / decimal_step).floor\n if steps.zero?\n errors.add(:default_value, _('must be a step away from the minimum'))\n end\n\n self.options = ((decimal_default - decimal_step * steps)...decimal_default).step(decimal_step).map(&:to_f) + (decimal_default..decimal_maximum).step(decimal_step).map(&:to_f)\n unless options.first == minimum.to_f\n self.options.unshift(minimum.to_f)\n end\n unless options.last == maximum.to_f\n self.options << maximum.to_f\n end\n else\n errors.add(:default_value, :blank)\n end\n else\n self.options = []\n end\n end", "def update_attributes(params)\n params.select do |key, _value|\n attribute_parameter?(key)\n end.each do |key, value|\n orig_param = original_parameter(key).to_sym\n self[orig_param].min = value if key.end_with?('_min') && !value.to_s.empty?\n self[orig_param].max = value if key.end_with?('_max') && !value.to_s.empty?\n\n if key.end_with?('_exclude')\n exclude_list = value.split(',').to_a\n self[orig_param].exclude_select_choices = exclude_list unless exclude_list.empty?\n end\n end\n end", "def set_phony_normalized_numbers(current_instance, attributes, options = {})\n options = options.dup\n assign_values_for_phony_symbol_options(options)\n if respond_to?(:country_code)\n set_country_as = options[:enforce_record_country] ? :country_code : :default_country_code\n options[set_country_as] ||= country_code\n end\n attributes.each do |attribute|\n attribute_name = options[:as] || attribute\n raise(\"No attribute #{attribute_name} found on #{self.class.name} (PhonyRails)\") unless self.class.attribute_method?(attribute_name)\n\n cache_original_attribute(current_instance, attribute) if options[:normalize_when_valid]\n new_value = PhonyRails.normalize_number(send(attribute), options, current_instance)\n current_instance.public_send(\"#{attribute_name}=\", new_value) if new_value || attribute_name != attribute\n end\n end", "def prepare_attributes(data_set, meta_data, options)\n # create meta data and data set for the scaled output\n sc = DatasetScaling.new(meta_data, data_set)\n @meta_data = sc.scaled_meta\n @scaled_dataset = sc.scaled_data_set\n set_attributes(@scaled_dataset, options[:extreme_values])\n end", "def date_time_attribute_set(instance, name, attributes)\n return unless attributes.key?(name) || attributes.key?(\"formatted_#{name}\")\n\n value = attributes[name] || attributes[\"formatted_#{name}\"]\n\n instance.send(:\"formatted_#{name}=\", value)\n end", "def parse_normal_range\n if self.normal_range.include?(\"-\")\n @value_min, @value_max = self.normal_range.split(\"-\")\n @value_min = @value_min.to_f\n @value_max = @value_max.to_f\n elsif index = self.normal_range.index(\"<\")\n @value_min = 0\n index ||= self.normal_range.index(\"=\")\n index += 1\n @value_max = self.normal_range[index..-1].to_f\n elsif index = self.normal_range.index(\">\")\n index ||= self.normal_range.index(\"=\")\n index += 1\n @value_min = self.normal_range[index..-1].to_f\n @value_max = Float::INFINITY\n end\n end", "def reformatted!\n self.class.format_fields.each do |field_name, format_method, options|\n formatted_value = send(format_method, get_field(field_name), options)\n set_field(field_name, formatted_value)\n end\n self\n end", "def get_field_deserializers()\n return super.merge({\n \"borders\" => lambda {|n| @borders = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::WorkbookRangeBorder.create_from_discriminator_value(pn) }) },\n \"columnWidth\" => lambda {|n| @column_width = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"fill\" => lambda {|n| @fill = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookRangeFill.create_from_discriminator_value(pn) }) },\n \"font\" => lambda {|n| @font = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookRangeFont.create_from_discriminator_value(pn) }) },\n \"horizontalAlignment\" => lambda {|n| @horizontal_alignment = n.get_string_value() },\n \"protection\" => lambda {|n| @protection = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookFormatProtection.create_from_discriminator_value(pn) }) },\n \"rowHeight\" => lambda {|n| @row_height = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"verticalAlignment\" => lambda {|n| @vertical_alignment = n.get_string_value() },\n \"wrapText\" => lambda {|n| @wrap_text = n.get_boolean_value() },\n })\n end", "def up()\n if @value < self.max\n @value = [@value + self.step, self.max].min\n end\n #@cLabelNumber.text = sprintf(@pattern, @value.to_s)\n end", "def normalise_options\n @options[:interval] = @options[:interval].to_i\n @options[:limit] = @options[:limit].to_i if @options[:limit]\n end", "def render_options\n hsh = {}\n if minval = @minimalize\n @units = ABBREVIATED_DECIMAL_UNITS\n @format = \"%n%u\"\n @precision = minval\n @strip_insignificant_zeros = true\n @delimiter = ''\n @significant = true\n end\n\n\n hsh[:number_to_human] = HUMAN_ACCESSORS.inject({}) do |h, att|\n if val = self.instance_variable_get(\"@#{att}\")\n h[att] = val\n end\n\n h\n end\n\n return hsh\n end", "def formatted_value\n return @value if @value.blank?\n\n set_type\n end", "def full_data_range(ds)\n return if max_value == false\n\n ds.each_with_index do |mds, mds_index|\n mds[:min_value] ||= min_value\n mds[:max_value] ||= max_value\n \n if mds_index == 0 && type.to_s == 'bar'\n # TODO: unless you specify a zero line (using chp or chds),\n # the min_value of a bar chart is always 0.\n #mds[:min_value] ||= mds[:data].first.to_a.compact.min\n mds[:min_value] ||= 0\n end\n if (mds_index == 0 && type.to_s == 'bar' && \n !grouped && mds[:data].first.is_a?(Array))\n totals = []\n mds[:data].each do |l|\n l.each_with_index do |v, index|\n next if v.nil?\n totals[index] ||= 0\n totals[index] += v\n end\n end\n mds[:max_value] ||= totals.compact.max\n else\n all = mds[:data].flatten.compact\n # default min value should be 0 unless set to auto\n if mds[:min_value] == 'auto'\n mds[:min_value] = all.min\n else\n min = all.min\n mds[:min_value] ||= (min && min < 0 ? min : 0)\n end\n mds[:max_value] ||= all.max\n end\n end\n\n unless axis_range\n @calculated_axis_range = true\n @axis_range = ds.map{|mds| [mds[:min_value], mds[:max_value]]}\n if dimensions == 1 && (type.to_s != 'bar' || horizontal)\n tmp = axis_range.fetch(0, [])\n @axis_range[0] = axis_range.fetch(1, [])\n @axis_range[1] = tmp\n end\n end\n # return [min, max] unless (min.nil? || max.nil?)\n # @max = (max_value.nil? || max_value == 'auto') ? ds.compact.map{|mds| mds.compact.max}.max : max_value\n # \n # if min_value.nil? \n # min_ds_value = ds.compact.map{|mds| mds.compact.min}.min || 0\n # @min = (min_ds_value < 0) ? min_ds_value : 0\n # else\n # @min = min_value == 'auto' ? ds.compact.map{|mds| mds.compact.min}.min || 0 : min_value \n # end\n # @axis_range = [[min,max]]\n end", "def define_min_and_max\n @min = acceptable_min\n @max = acceptable_max\n\n # If necessary, adjust a value depending on the other\n @min ||= floor\n @max ||= @min + ceiling || ceiling # rubocop:disable Naming/MemoizedInstanceVariableName\n end", "def __evolve_range__(serializer: nil)\n __evolve_range_naive__.transform_values! do |value|\n if serializer\n serializer.evolve(value)\n else\n case value\n when Time, DateTime then value.__evolve_time__\n when Date then value.__evolve_date__\n else value\n end\n end\n end\n end", "def valid_parameter_for_conditional_formatting\n [\n :type,\n :format,\n :criteria,\n :value,\n :minimum,\n :maximum,\n :min_type,\n :mid_type,\n :max_type,\n :min_value,\n :mid_value,\n :max_value,\n :min_color,\n :mid_color,\n :max_color,\n :bar_color\n ]\n end", "def format(meth=nil, &block)\n @value_format ||= (meth ? meth : block)\n end", "def get_options\n if options.present?\n @minimum = options.first.to_f\n @maximum = options.last.to_f\n @step = (options[1] - options[0]).round(3)\n end\n end", "def formats=(values); end", "def edit_value(val)\n if data_type == \"string\"\n self.text_raw_value = val\n elsif data_type == \"number\"\n self.number_raw_value = val\n end\n # Note: *_validated_value field is set in the set_validated_values\n # validator.\n end", "def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n @statistic = args[:statistic] if args.key?(:statistic)\n @strict_max_enabled = args[:strict_max_enabled] if args.key?(:strict_max_enabled)\n @strict_min_enabled = args[:strict_min_enabled] if args.key?(:strict_min_enabled)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @mean = args[:mean] if args.key?(:mean)\n @min = args[:min] if args.key?(:min)\n end", "def format_range_display_value(value)\n if view_context.method(:format_range_display_value).owner == RangeLimitHelper\n value\n else\n Deprecation.warn(BlacklightRangeLimit, 'Helper method #format_range_display_value has been overridden; implement a custom FacetItemPresenter instead')\n view_context.format_range_display_value(value, key)\n end\n end", "def datetime_local_field(name, *args)\n options = args.extract_options!.symbolize_keys!\n prepare_options(name, options)\n options[:input_group][:data].merge!({'date-extra-formats' => [BootstrapForm::DATE_FORMAT_JS+\"THH:mm\"+(options[:include_seconds] ? ':ss' : '')]}.merge(options[:data] || {}))\n append_min_max(BootstrapForm::DATE_FORMAT_RUBY+\"T%T\", options)\n args << options\n super\n end", "def initialize(min_value_range, max_value_range, min_output, max_output, round)\n @min_value_range = min_value_range\n @max_value_range = max_value_range\n @min_output = min_output\n @max_output = max_output\n @round = round\n end", "def get_field_deserializers()\n return super.merge({\n \"unit\" => lambda {|n| @unit = n.get_string_value() },\n \"value\" => lambda {|n| @value = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def extra_input_attributes\n { :value => binding.html_value }\n end", "def map_time_limit=(new_value)\n super new_value && new_value.to_f\n end", "def validation min, max\n\n end", "def get_feature_edit_html()\n super() << \"<div class=\\\"field\\\">\n min=<input name=\\\"min_rating\\\" type='text' value=\\\"#{min_rating}\\\" size=\\\"2\\\" />\n max=<input name=\\\"max_rating\\\" type='text' value=\\\"#{max_rating}\\\" size=\\\"2\\\" />\n </div>\"\n end", "def validate_range(attribute_name, options = {})\n value = send(attribute_name)\n\n return unless value\n\n min = options.fetch(:min, nil)\n max = options.fetch(:max, nil)\n append_error(attribute_name, options.fetch(:min_message, nil) || :less_than_min) if min && value < min\n append_error(attribute_name, options.fetch(:max_message, nil) || :greater_than_max) if max && value > max\n end", "def get_field_deserializers()\n return super.merge({\n \"format\" => lambda {|n| @format = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartDataLabelFormat.create_from_discriminator_value(pn) }) },\n \"position\" => lambda {|n| @position = n.get_string_value() },\n \"separator\" => lambda {|n| @separator = n.get_string_value() },\n \"showBubbleSize\" => lambda {|n| @show_bubble_size = n.get_boolean_value() },\n \"showCategoryName\" => lambda {|n| @show_category_name = n.get_boolean_value() },\n \"showLegendKey\" => lambda {|n| @show_legend_key = n.get_boolean_value() },\n \"showPercentage\" => lambda {|n| @show_percentage = n.get_boolean_value() },\n \"showSeriesName\" => lambda {|n| @show_series_name = n.get_boolean_value() },\n \"showValue\" => lambda {|n| @show_value = n.get_boolean_value() },\n })\n end", "def update!(**args)\n @default_value = args[:default_value] if args.key?(:default_value)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end", "def update!(**args)\n @default_value = args[:default_value] if args.key?(:default_value)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end", "def correct_format_for_values\n self.value.to_i\n end", "def parse_values_from_ui\n\t\tunless self.period_value.blank? and self.period_units.blank?\n\t\t\tp = self.period_value.to_i\n\t\t\tself.period = p.send(self.period_units).to_i\n\t\tend\n\t\tunless self.breach_duration_value.blank? and self.breach_duration_units.blank?\n\t\t\tp = self.breach_duration_value.to_i\n\t\t\tself.breach_duration = p.send(self.breach_duration_units).to_i\n\t\tend\n\t\tunless self.lower_breach_scale_increment_action.blank? and self.lower_breach_scale_increment_value.blank? and self.lower_breach_scale_increment_units.blank?\n\t\t\tself.lower_breach_scale_increment = ''\n\t\t\tself.lower_breach_scale_increment = '-' if self.lower_breach_scale_increment_action == 'decrease'\n\t\t\tself.lower_breach_scale_increment += self.lower_breach_scale_increment_value.to_s\n\t\t\tself.lower_breach_scale_increment += '%' if self.lower_breach_scale_increment_units == '%'\n\t\tend\n\t\tunless self.upper_breach_scale_increment_action.blank? and self.upper_breach_scale_increment_value.blank? and self.upper_breach_scale_increment_units.blank?\n\t\t\tself.upper_breach_scale_increment = ''\n\t\t\tself.upper_breach_scale_increment = '-' if self.upper_breach_scale_increment_action == 'decrease'\n\t\t\tself.upper_breach_scale_increment += self.upper_breach_scale_increment_value.to_s\n\t\t\tself.upper_breach_scale_increment += '%' if self.upper_breach_scale_increment_units == '%'\n\t\tend\n\tend", "def normalized\n @normalized ||= valid_range? ? range : normalized_range(range)\n rescue Exception => e \n # puts e.message\n value\n end", "def hook_custom_field_value_tag(name, custom_value)\n custom_field = custom_value.custom_field\n field_name = \"#{name}[custom_field_values][#{custom_field.id}]\"\n field_name << '[]' if custom_field.multiple?\n field_id = \"#{name}_custom_field_values_#{custom_field.id}\"\n\n tag_options = { id: field_id, class: \"#{custom_field.field_format}_cf\" }\n\n field_format = custom_field.field_format\n case field_format.try(:edit_as)\n when 'date'\n text_field_tag(field_name, custom_value.value, tag_options.merge(size: 10)) +\n calendar_for(field_id)\n when 'text'\n text_area_tag(field_name, custom_value.value, tag_options.merge(rows: 3))\n when 'bool'\n hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, tag_options)\n when 'list'\n blank_option = ''.html_safe\n unless custom_field.multiple?\n blank_option = content_tag('option')\n end\n s = select_tag(field_name,\n blank_option + options_for_select(\n custom_field.possible_values_options(custom_value.customized),\n custom_value.value),\n tag_options.merge(multiple: custom_field.multiple?))\n if custom_field.multiple?\n s << hidden_field_tag(field_name, '')\n end\n s\n else\n text_field_tag(field_name, custom_value.value, tag_options)\n end\n end", "def value=(formatted_value)\n range_arguments = formatted_value.to_s.split(SEPARATOR, 2)\n\n begin\n @value = Range.new(*range_arguments)\n rescue ArgumentError\n @value = formatted_value\n end\n\n @value\n end", "def scale_graph_value(data_value, data_max, max)\n ((data_value.to_f / data_max.to_f) * max).round\n end", "def to_s\r\n \"#{wrap}{#{range.min}..#{range.max}}\"\r\n end", "def initialize(raw_range)\n super()\n @rmin=round_min(raw_range.rmin) if not raw_range.rmin.nil?\n @rmax=round_max(raw_range.rmax) if not raw_range.rmax.nil?\n @lmax=label_step if not raw_range.rmax.nil?\n end", "def formatted_value\n @formatted_value\n end", "def params\n '(' + (self.min.nil? ? '~' : '%g' % self.min) + ',' + (self.max.nil? ? '~' : '%g' % self.max) + ')'\n end", "def params\n '(' + (self.min.nil? ? '~' : '%g' % self.min) + ',' + (self.max.nil? ? '~' : '%g' % self.max) + ')'\n end", "def input_html_options\n {\n :maxlength => options[:input_html].try(:[], :maxlength) || limit,\n :size => builder.default_text_field_size,\n :placeholder => placeholder_text\n }.merge(super)\n end", "def geckometer(value, min, max)\n self.push(:item => value, :min => {:value => min}, :max => {:value => max})\n end", "def value=(new_value)\n new_value = new_value.to_s\n return if new_value.blank?\n new_value = '-' + new_value unless new_value =~ /^(\\+|-)/\n write_attribute :value, new_value.to_f.round\n end", "def format _label, _value\n raise NotImplementedError, self\n end", "def format=(value)\n super(value.to_s.underscore.gsub(/[\\s_]+/,'-'))\n end", "def range_field_tag(name, value = nil, options = {})\n number_field_tag(name, value, options.stringify_keys.update(\"type\" => \"range\"))\n end", "def parse(aeries_data, aeries_attributes_list, setters_list)\n super\n self.start_date = DateTime.parse(start_date) unless start_date.nil?\n self.end_date = DateTime.parse(end_date) unless end_date.nil?\n end", "def change(values_={}, unparse_params_={})\n unparse_params_ = @_unparse_params.merge(unparse_params_) if @_unparse_params\n values_ = _canonicalize_values_hash(values_)\n Value.new(@_values.merge(values_), @_format, unparse_params_)\n end", "def change_format(data, from_format, to_format)\n FormatChanger.send(\"from_#{from_format}_to_#{to_format}\", data)\n end", "def to_s\r\n l = label ? \" '#{label.to_s}'\" : ''\r\n s = source.to_s\r\n t = target.to_s\r\n \"(#{[s,t].min}=#{[s,t].max}#{l})\"\r\n end", "def formatted_value_other(value, type)\n if type == :boolean || (type == :automatic && looks_like_boolean?(value))\n formatted_value_boolean(value)\n elsif type == :date || (type == :automatic && looks_like_date?(value))\n I18n.l(value)\n else # Number or String\n formatted_value_string(value)\n end\n end", "def adapt_single_attribute_value(value, attribute_name)\n AttributeValueAdapter.call(value, attribute_name) || super\n rescue ArgumentError\n \"#{value} is not a valid date\"\n end", "def adapt_single_attribute_value(value, attribute_name)\n AttributeValueAdapter.call(value, attribute_name) || super\n rescue ArgumentError\n \"#{value} is not a valid date\"\n end", "def values_to_preset; end", "def formats(*args, &block)\n unless respond_to?(:model_formatting_attributes)\n # use all these attributes instead of a single ModelFormatting::Config because\n # it's easier to support subclassing.\n class_attribute :model_formatting_attributes, \n :model_formatting_white_list, :model_formatting_context, \n :model_formatting_before_callback, :model_formatting_after_callback\n send :include, ModelFormatting::InstanceMethods\n self.model_formatting_context = []\n self.model_formatting_attributes = {} \n self.model_formatting_white_list = HTML::WhiteListSanitizer.new\n before_save :format_content_with_model_formatting\n end\n\n model_formatting_attributes.update args.extract_options!\n args.each do |field|\n model_formatting_attributes[field] = \"formatted_#{field}\"\n end\n\n if block\n config = ModelFormatting::Config.new(model_formatting_white_list, model_formatting_attributes, model_formatting_context)\n config.instance_eval &block\n self.model_formatting_before_callback = config.before_callback if config.before_callback\n self.model_formatting_after_callback = config.after_callback if config.after_callback\n end\n end", "def render_attribute(resource, attribute, options = {})\n attribute_value = resource.send(attribute[:name])\n if attribute[:relation]\n record = resource.send(attribute[:relation][:name])\n value = record.present? ? record.send(attribute[:relation][:attr_method]) : Alchemy.t(:not_found)\n elsif attribute_value && attribute[:type].to_s =~ /(date|time)/\n localization_format = if attribute[:type] == :datetime\n options[:datetime_format] || :\"alchemy.default\"\n elsif attribute[:type] == :date\n options[:date_format] || :\"alchemy.default\"\n else\n options[:time_format] || :\"alchemy.time\"\n end\n value = l(attribute_value, format: localization_format)\n else\n value = attribute_value\n end\n\n options.reverse_merge!(truncate: 50)\n if options[:truncate]\n value.to_s.truncate(options.fetch(:truncate, 50))\n else\n value\n end\n end", "def datavalue(value)\n merge(datavalue: value.to_s)\n end", "def set_values(value, difference)\n @ucStat.cValue.text = value\n\n if difference > 0\n @ucCompareStat.cValue.font.color = Color.power_up_color\n elsif difference < 0\n @ucCompareStat.cValue.font.color = Color.power_down_color\n else\n @ucCompareStat.cValue.font.color = Color.normal_color\n end\n value += difference\n @ucCompareStat.cValue.text = value.abs.to_s\n \n if @format != nil\n @ucStat.cValue.text = sprintf(@format, @ucStat.cValue.text)\n @ucCompareStat.cValue.text = sprintf(@format, @ucCompareStat.cValue.text)\n end\n \n end", "def normalize\n begin\n if data_id?(@data_identifier) == false\n @data_identifier = @@fdm.text_to_id(@data_identifier)\n else #data_identifier is already a data id do nothing...\n end\n @data_label = @@fdm.id_to_text(@data_identifier)\n @scale = @@fdm.scale(@data_identifier)\n @resolution = @@fdm.resolution(@data_identifier)\n\n if is_numeric?(@value_from_protocol)\n if is_integer?(@value_from_protocol)\n @value = @value_from_protocol.to_i * @scale.to_f * 10**@resolution.to_f\n else\n @value = @value_from_protocol.to_f * @scale.to_f * 10**@resolution.to_f\n end\n else\n @value = @value_from_protocol\n end\n\n @units = @@fdm.unit_text_to_unit_id(@units_from_protocol)\n if @protocol == 'v4'\n @units = 'units would go here'\n end\n\n if @resolution.to_f > 0\n puts self.to_s\n end\n\n rescue Exception => e\n puts\" \\n\\n **********\\n\\n #{$@ } \\n\\n #{e} \\n\\n **********\"\n end\n end", "def attribute_value( value )\n case value\n when Date, DateTime\n value.to_date.iso8601\n when Time, ActiveSupport::TimeWithZone\n value.iso8601\n else value\n end\n end", "def valid_options\n super + [:denormalize]\n end", "def value=(val)\n data_type = @data_type = data_type_for_value(val)\n if data_type == TYPE_STRING\n # percentage detection\n percentage_search = PERCENTAGE_RE.match(val)\n if percentage_search && val.strip != '%'\n val = val.gsub('%', '').to_f / 100.0\n set_value_explicit(val, TYPE_NUMERIC)\n style.number_format.format_code = Xl::NumberFormat::FORMAT_PERCENTAGE\n return true\n end\n\n # time detection\n # time_search = TIME_RE.match(val)\n # if time_search\n # sep_count = val.count(':')\n # if sep_count == 1\n # h, m = val.split(':').map(&:to_i)\n # s = 0\n # elsif sep_count == 2\n # h, m, s = val.split(':').map(&:to_i)\n # end\n # days = (h / 24.0) + (m / 1440.0) + (s / 86400.0)\n # set_value_explicit(days, TYPE_NUMERIC)\n # style.number_format.format_code = Xl::NumberFormat::FORMAT_DATE_TIME3\n # return true\n # end\n elsif data_type == TYPE_NUMERIC\n # date detection\n if (Xl::DateHelper.datelike?(val))\n val = Xl::DateHelper.ruby_to_excel(val)\n set_value_explicit(val, TYPE_NUMERIC)\n style.number_format.format_code = Xl::NumberFormat::FORMAT_DATE_YYYYMMDD2\n return true\n end\n end\n set_value_explicit(val, data_type)\n end", "def change_ranges(params)\n @min = params.fetch(:min, 0).to_f\n @max = params.fetch(:max, 100).to_f\n end", "def to_s\n l = label ? \" '#{label.to_s}'\" : ''\n s = source.to_s\n t = target.to_s\n \"(#{[s,t].min}=#{[s,t].max}#{l})\"\n end", "def custom_data\n super.attributes\n end", "def to_s\n pad_field :data, :options\n recalc_block_len\n super\n end", "def set_min_max_price_values\n price_facet_rows = @products.facet(:price).rows.sort_by{|row| row.value}\n @min_price = price_facet_rows.first.try(:value) || 0\n @max_price = price_facet_rows.last.try(:value) || 1000\n end", "def setValue(low, high, value)\n # We should error check the information we have.\n @low = if low <= high then low else 0 end\n @high = if low <= high then high else 0 end\n @value = if low <= value && value <= high then value else 0 end\n # Determine the percentage of the given value.\n @percent = if @high == 0 then 0 else 1.0 * @value / @high end\n\n # Determine the size of the histogram bar.\n if @orient == CDK::VERTICAL\n @bar_size = @percent * @field_height\n else\n @bar_size = @percent * @field_width\n end\n\n # We have a number of variables which determine the personality of the\n # histogram. We have to go through each one methodically, and set them\n # correctly. This section does this.\n if @view_type != :NONE\n if @orient == CDK::VERTICAL\n if @stats_pos == CDK::LEFT || @stats_pos == CDK::BOTTOM\n # Set the low label attributes.\n @low_string = @low.to_s\n @lowx = 1\n @lowy = @box_height - @low_string.size - 1\n\n # Set the high label attributes\n @high_string = @high.to_s\n @highx = 1\n @highy = @title_lines + 1\n\n string = ''\n # Set the current value attributes.\n string = if @view_type == :PERCENT\n then \"%3.1f%%\" % [1.0 * @percent * 100]\n elsif @view_type == :FRACTION\n string = \"%d/%d\" % [@value, @high]\n else string = @value.to_s\n end\n @cur_string = string\n @curx = 1\n @cury = (@field_height - string.size) / 2 + @title_lines + 1\n elsif @stats_pos == CDK::CENTER\n # Set the lower label attributes\n @low_string = @low.to_s\n @lowx = @field_width / 2 + 1\n @lowy = @box_height - @low_string.size - 1\n\n # Set the high label attributes\n @high_string = @high.to_s\n @highx = @field_width / 2 + 1\n @highy = @title_lines + 1\n\n # Set the stats label attributes\n string = if @view_type == :PERCENT\n then \"%3.2f%%\" % [1.0 * @percent * 100]\n elsif @view_type == :FRACTIOn\n \"%d/%d\" % [@value, @high]\n else @value.to_s\n end\n\n @cur_string = string\n @curx = @field_width / 2 + 1\n @cury = (@field_height - string.size) / 2 + @title_lines + 1\n elsif @stats_pos == CDK::RIGHT || @stats_pos == CDK::TOP\n # Set the low label attributes.\n @low_string = @low.to_s\n @lowx = @field_width\n @lowy = @box_height - @low_string.size - 1\n\n # Set the high label attributes.\n @high_string = @high.to_s\n @highx = @field_width\n @highy = @title_lines + 1\n\n # Set the stats label attributes.\n string = if @view_type == :PERCENT\n then \"%3.2f%%\" % [1.0 * @percent * 100]\n elsif @view_type == :FRACTION\n \"%d/%d\" % [@value, @high]\n else @value.to_s\n end\n @cur_string = string\n @curx = @field_width\n @cury = (@field_height - string.size) / 2 + @title_lines + 1\n end\n else\n # Alignment is HORIZONTAL\n if @stats_pos == CDK::TOP || @stats_pos == CDK::RIGHT\n # Set the low label attributes.\n @low_string = @low.to_s\n @lowx = 1\n @lowy = @title_lines + 1\n\n # Set the high label attributes.\n @high_string = @high.to_s\n @highx = @box_width - @high_string.size - 1\n @highy = @title_lines + 1\n\n # Set the stats label attributes.\n string = if @view_type == :PERCENT\n then \"%3.1f%%\" % [1.0 * @percent * 100]\n elsif @view_type == :FRACTION\n \"%d/%d\" % [@value, @high]\n else @value.to_s\n end\n @cur_string = string\n @curx = (@field_width - @cur_string.size) / 2 + 1\n @cury = @title_lines + 1\n elsif @stats_pos == CDK::CENTER\n # Set the low label attributes.\n @low_string = @low.to_s\n @lowx = 1\n @lowy = (@field_height / 2) + @title_lines + 1\n\n # Set the high label attributes.\n @high_string = @high.to_s\n @highx = @box_width - @high_string.size - 1\n @highy = @field_height / 2 + @title_lines + 1\n\n # Set the stats label attributes.\n string = if @view_type == :PERCENT\n then \"%3.1f%%\" % [1.0 * @percent * 100]\n elsif @view_type == :FRACTION\n \"%d/%d\" % [@value, @high]\n else @value.to_s\n end\n @cur_string = string\n @curx = (@field_width - @cur_string.size) / 2 + 1\n @cury = @field_height / 2 + @title_lines + 1\n elsif @stats_pos == CDK::BOTTOM || @stats_pos == CDK::LEFT\n # Set the low label attributes.\n @low_string = @low.to_s\n @lowx = 1\n @lowy = @box_height -2 * @border_size\n\n # Set the high label attributes.\n @high_string = @high.to_s\n @highx = @box_width - @high_string.size - 1\n @highy = @box_height - 2 * @border_size\n\n # Set the stats label attributes.\n string = if @view_type == :PERCENT\n then \"%3.1f%%\" % [1.0 * @percent * 100]\n elsif @view_type == :FRACTION\n \"%d/%d\" % [@value, @high]\n else @value.to_s\n end\n @cur_string = string\n @curx = (@field_width - @cur_string.size) / 2 + 1\n @cury = @box_height - 2 * @border_size\n end\n end\n end\n end" ]
[ "0.59231603", "0.5723215", "0.56251204", "0.5608272", "0.55394286", "0.5490469", "0.54865164", "0.5455183", "0.5399323", "0.53972495", "0.5333362", "0.5323261", "0.52647763", "0.512813", "0.51078725", "0.51040256", "0.51040256", "0.51040256", "0.51040256", "0.51040256", "0.51040256", "0.51040256", "0.5104008", "0.5104008", "0.5100856", "0.5085671", "0.50852203", "0.50793755", "0.50689775", "0.50629663", "0.50619775", "0.5061177", "0.50569624", "0.5050032", "0.5039404", "0.50385773", "0.50003046", "0.49905252", "0.49810496", "0.4976412", "0.49463603", "0.49447194", "0.49171257", "0.48876578", "0.48857498", "0.48748064", "0.4864164", "0.48564067", "0.48500836", "0.48446575", "0.48349795", "0.4796058", "0.478794", "0.477423", "0.4773268", "0.47601292", "0.47561306", "0.47513857", "0.47475278", "0.47429413", "0.47429413", "0.47089702", "0.4708241", "0.47072634", "0.4699302", "0.46961054", "0.46956995", "0.4693043", "0.46920615", "0.46754605", "0.46681362", "0.46681362", "0.46644977", "0.46614954", "0.46560046", "0.46555403", "0.46464813", "0.46446958", "0.46175322", "0.45994395", "0.45993802", "0.45985305", "0.4584178", "0.4582663", "0.4582663", "0.45823485", "0.45761418", "0.45756298", "0.45747337", "0.45737654", "0.45692894", "0.45677835", "0.45654905", "0.4565248", "0.45519164", "0.4548172", "0.45320162", "0.4531188", "0.4530813", "0.4530648" ]
0.7302364
0
Add conflicts to the ConflictList. Duplicate or blank conflicts will be ignored. Use the :parse option to add an unparsed conflict string. Example: conflict_list.add("Fun", "Happy") conflict_list.add("Fun, Happy", :parse => true)
def add(*names) extract_and_apply_options!(names) concat(names) clean! self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_conflict(name, specifics)\n @conflicts << Requirement.parse(name, specifics)\n end", "def conflict(val)\n conflicts << val\n conflicts.dup\n end", "def conflict(val)\n conflicts << val\n conflicts.dup\n end", "def add_conflict(entity, id, attr, o, c, p)\n logger.warn { \"Detected conflict on #{entity} #{attr}: [o, c, p] = #{[o, c, p].inspect}\" }\n\n conflicts.add(entity, id, attr, o, c, p)\n end", "def conflicts\n @conflicts ||= []\n end", "def conflicts\n @conflicts ||= []\n end", "def conflicts *syms\n syms.each { |sym| raise ArgumentError, \"unknown option '#{sym}'\" unless @specs[sym] }\n @constraints << [:conflicts, syms]\n end", "def message\n \"#{base} already defines #{conflicts}, also defined on #{owner}\"\n end", "def conflicts=(conflicts)\n unless conflicts.kind_of?(Hash)\n raise(InvalidMetadata, \"conflicts must be a Hash\")\n end\n\n @conflicts.clear\n\n conflicts.each do |name, specifics|\n add_conflict(name, specifics)\n end\n end", "def conflicts=(conflicts)\n @conflicts = replace_self_version_dependencies(conflicts, 'conflicts')\n alias_of.conflicts = conflicts\n end", "def add_from_strings(*strings)\n strings.each { |s| merge Set.new(s.split('')) }\n self\n end", "def merge_conflict?; end", "def add(item)\n @items << item unless include?(item)\n end", "def raise_if_conflicts # :nodoc:\n if has_conflicts?\n raise Gem::ConflictError.new self, conflicts\n end\n end", "def add_tags list\n unless @tags.empty?\n @tags += ','\n end\n @tags += list.join(',')\n end", "def add(*args)\n args.flatten! # allow [] as a param\n args.each do |arg|\n arg = arg.to_sym if arg.is_a? String\n @set << arg unless @set.include? arg # avoid duplicates\n end\n end", "def add(*names)\r\n extract_and_apply_options!(names)\r\n concat(names)\r\n clean!\r\n self\r\n end", "def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end", "def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end", "def add_tags(tag_list, reload_tags = true)\n new_tags = Tag.parse_to_tags(tag_list)\n\n tags_to_add = new_tags - self.tags\n if tags_to_add.any?\n TxactionTagging.transaction do\n tags_to_add.each {|t| create_tagging(t) }\n update_attribute(:tagged, true)\n end\n end\n\n self.taggings(reload_tags)\n return self.tags(reload_tags) # need to reload or AR doesn't see the changes\n end", "def add(*names); end", "def append(list, val, separator = identifier(\"auto\"))\n assert_type separator, :String, :separator\n unless %w(auto space comma).include?(separator.value)\n raise ArgumentError.new(\"Separator name must be space, comma, or auto\")\n end\n list.with_contents(list.to_a + [val],\n separator:\n if separator.value == 'auto'\n list.separator || :space\n else\n separator.value.to_sym\n end)\n end", "def add(item)\n\t\t@items.push(item.to_sym.nil? ? item : item.to_sym)\n\tend", "def add_commit\n if (@is_commit)\n raise RuntimeError.new('Only one commit per request list allowed!')\n end\n @requests << {'commit' => ''}\n @is_commit = true\n self\n end", "def on_conflict(column = nil)\n ::MultiInsert::Query::OnConflict.new(self, column)\n end", "def cannot_have_conflicts\n \terrors.add(:base, \"Conflicts with another reservation\") if self.has_conflicts?\n end", "def create\n @conflict = Conflict.new(conflict_params)\n\n respond_to do |format|\n if @conflict.save\n format.html { redirect_to @conflict, notice: 'Conflict was successfully created.' }\n format.json { render :show, status: :created, location: @conflict }\n else\n format.html { render :new }\n format.json { render json: @conflict.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_completion(completion_params)\n if validate_completion completion_params\n completion = compute_completion_hash_from_params completion_params\n self.completions << completion\n completion\n else\n nil\n end\n end", "def add_valid_option(option)\n @@valid_options.push(option) unless @@valid_options.include?(option)\n @@valid_options\n end", "def add_to_list\n\n # Keep a copy of position to set after the change detail is saved, \n # because the entry will be put at the end of the list.\n position = self.position\n self.save\n\n if self.errors.empty?\n change_details = self.change_item.change_details.find(:all)\n position = 1 if !position\n change_details.last.insert_at(position)\n end\n end", "def add_terms(*terms)\n terms.flatten.each do |term|\n raise ArgumentError unless term.is_a? String\n if term.size > 2 && term !~ /\\s/\n @completions << term\n # WARNING: thar be recursion\n self.add_terms(term.split(\".\")) if term =~ /\\./\n end\n end\n end", "def add_list_definition(style); end", "def add(*args)\n @list << args\n @list.flatten!\n end", "def add_ignore(*rules)\n data['Ignore'] ||= []\n rules.each { |rule| data['Ignore'] << rule.title }\n data['Ignore'].sort!.uniq!\n end", "def warning(str)\n @parts.push(warning: str)\n end", "def resolve(conflict)\n return [] unless @config.interactive\n base_local_diffs = conflict.base_local_diffs\n base_remote_diffs = conflict.base_remote_diffs\n choice = @hl.choose do |menu|\n menu.prompt = conflict\n menu.choice(:local, text: base_local_diffs.map(&:to_s).join(\"\\n\\t\\t\"))\n menu.choice(:remote, text: base_remote_diffs.map(&:to_s).join(\"\\n\\t\\t\"))\n # menu.choice(:neither, help: \"Don't choose either set of diffs\")\n # menu.choice(:edit, help: \"Edit the diffs (coming soon)\")\n # menu.choice(:quit, help: \"I'm in over my head. Just stop!\")\n menu.select_by = :index_or_name\n end\n case choice\n when :local\n base_local_diffs\n when :remote\n base_remote_diffs\n else\n error \"Unexpected choice #{choice.inspect}.\"\n end\n end", "def insert_ignore\n insert_conflict\n end", "def add_syntax_error(syntax_error)\n syntax_errors << syntax_error\n end", "def add_item(grcy_list, string, i=1)\n grcy_list[string] = i\nend", "def add(_, working_set = nil)\n return unless working_set\n entries.insert(position + 1, working_set)\n go_forward_history(nil)\n end", "def add(*words)\n words.flatten.each do |word|\n add_word(word)\n end\n nil\n end", "def each_conflict(&block) # :yields: file, your_version, their_version\n self.lib.conflicts(&block)\n end", "def add(message)\n @errors << message\n end", "def add_tags\n \tunless tags_field.blank?\n\t\t\ttags = tags_field.split(\",\")\n\t\t\ttags.each do |tag|\n self.tags << Tag.find_or_initialize_by_name(tag.strip)\n\t\t\tend\n\t\tend\t\n end", "def add(groceries_list, add_list)\n\tadd_hash = create_list(add_list) # {:carrot => 2, :beans => 3, :milk => 2, :apples => 3}\n\tgroceries_list.merge!(add_hash)\nend", "def gitAddCommit\n @gop.add(:all => true)\n\n begin\n @gop.commit(\"Automatic version bump\")\n rescue Git::GitExecuteError => giterror\n # continue\n end\n end", "def add_lint(node_or_line, message = nil)\n line = node_or_line.respond_to?(:line) ? node_or_line.line : node_or_line\n\n @lints << Lint.new(engine.filename,\n line,\n message || description)\n end", "def add_lint(node_or_line_or_location, message)\n @lints << Lint.new(self,\n engine.filename,\n extract_location(node_or_line_or_location),\n message,\n @config.fetch('severity', :warning).to_sym)\n end", "def add(klass_or_str)\n @ignored_exceptions << normalize_as_klass(klass_or_str)\n end", "def add_tags\n self.tag_list = 'bug, feature, improvement, feedback, discussion, help'\n end", "def add_item(list, string)\n\titem_to_add = string.split(\" \")\n\tlist[item_to_add[0].to_sym] = item_to_add[1].to_i\n\tlist\nend", "def add_gems(gems = [])\n gems.uniq.each { |gem| @gems << gem } \n true\n end", "def add_tags(*list)\n tags.push(*list).uniq!\n tags\n end", "def add_strings(strings)\n strings.each { |string| @strings << string }\n self\n end", "def addOption(option)\n\t\t@list.last.merge!(option)\n\tend", "def add new_job\n # at the beginning we can add new_job at the last position of array\n at = @jobs.length\n # we are looking for first job that is dependent on new_job\n @jobs.each_with_index do |job, index|\n at = index if job.dependency == new_job.name\n end\n @jobs.insert at, new_job\n # once the new_job is added to jobs array,\n # we should check if new_job dependency job is located before or after new_job's position\n # if dependency is located after new_job it means we have Circular Dependency\n @jobs.each_with_index do |job, index|\n raise JobsCantHaveCircularDependenciesError if new_job.dependency == job.name and index > at\n end\n end", "def add (id, items)\n params = {\n :id => id,\n :items => items\n }\n requires params\n DataSift.request(:POST, 'list/replace/add', @config, params)\n end", "def parse(list)\n return list if list.is_a?(Array)\n list.include?(',') ? parse_with_commas(list) : parse_with_spaces(list)\n end", "def append(item)\n items << item unless items.include?(item)\n end", "def to_s\n conflicts = frozen? ? self.dup : self\n conflicts.send(:clean!)\n\n conflicts.map do |name|\n name.include?(delimiter) ? \"\\\"#{name}\\\"\" : name\n end.join(delimiter.ends_with?(\" \") ? delimiter : \"#{delimiter} \")\n end", "def add(data)\n @parser << data\n end", "def append next_parslet\n raise ArgumentError if next_parslet.nil?\n @alternatives << next_parslet.to_parseable\n update_hash\n self\n end", "def add( *args )\n args.each do |arg|\n case( arg )\n when Symbol\n @contents << arg unless @contents.include?( arg )\n when Component\n @contents << arg\n else\n raise \"Invalid host #{name} addition: #{arg.inspect}\"\n end\n end\n end", "def options_add opts, colors\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" add, a\".colorize(colors[:yellow]) + \n\t\t\t\t\" adds the task to the current list\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:add].colorize(colors[:red])\n\t\t\t\topts.on('-p PRIORITY', [\"high\", \"medium\", \"low\"], 'set the priority of the task to one of the', 'following. Default is medium') do |p|\n\t\t\t\t\tpriorities = {\n\t\t\t\t\t\t\"high\" => 0,\n\t\t\t\t\t\t\"medium\" => 1,\n\t\t\t\t\t\t\"low\" => 2\n\t\t\t\t\t}\n\t\t\t\t\tOPTIONS[:change_priority] = true\n\t\t\t\t\tOPTIONS[:priority] = priorities[p]\n\t\t\t\tend\n\t\t\tend", "def parse_line(str)\n _, color, rest = str.match(/^([\\w\\s]+) bags contain (.+)\\.$/).to_a\n containments = str.scan(/(\\d+) ([\\w\\s]+) bags?/).map { |count, color| Containment.new(color, count.to_i) }\n add(color, containments)\n end", "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 set_conflict\n @conflict = Conflict.find(params[:id])\n end", "def add_add_del_on_list(key, to_add, to_remove)\n if (@is_commit)\n raise RuntimeError.new('No further request supported after a commit!')\n end\n @requests << {'add_del_on_list' => {'key' => key, 'add' => to_add, 'del'=> to_remove}}\n self\n end", "def add(req)\n if req.requirement.exact?\n @exact.push req\n else\n @list.push req\n end\n req\n end", "def append_to_list(lst, field)\n if (field != nil) and (field.strip != '')\n lst << field\n end\n end", "def add_multiple(projects_data)\n parsed_projects_data = projects_data.inject({}) do |final, key_and_value|\n begin\n final.update(key_and_value[0] => {\n 'git_url' => key_and_value[1].is_a?(String) ? key_and_value[1] : key_and_value[1][\"git_url\"],\n 'branch' => key_and_value[1].is_a?(String) ? 'master' : key_and_value[1][\"branch\"]\n })\n rescue => e\n logger.error \"event: 'union_add_multiple_git_url_branch_extraction_failure', error_message: #{e.message}, project_name: #{key_and_value[0]}\"\n end\n end\n\n parsed_projects_data.each do |project_name, project_url_and_branch|\n # Skip this project if it already exists.\n next unless Project.where(project_name: project_name).first.nil?\n\n new(\n project_name: project_name,\n git_url: project_url_and_branch['git_url'],\n branch: project_url_and_branch['branch']\n ).save\n end\n\n logger.info 'event: union_add_multiple_complete'\n end", "def parse(str)\n parts = str.split(',')\n parts.each do |part|\n range = self.class.parse_part(part)\n merge!(range)\n end\n end", "def add_anniversary_item(item)\n @anniversary_list.push(item)\n end", "def merge_conflict?\n prefix == 'U'\n end", "def test_todo_already_on_list_message\n goal = \"\\\"#{@todo1}\\\" is already on this list.\"\n assert_equal(goal, @list.add(@todo1))\n end", "def add(rule); end", "def add_names(*names)\n @names.push(*names)\n end", "def add_suggestions(name, items)\n # unless alternatives = compute_alternatives(name, items)\n # return\n # end\n # append_message(sprintf(' Did you mean \"%s\"?', implode('\", \"', alternatives)))\n end", "def add_tag(tag)\n if not tag.kind_of?(String)\n raise \"tag '#{tag.inspect}' is not a String\"\n end\n\n if not @tags.include?(tag)\n @tags.push(tag)\n end\n \n end", "def add_all(words)\n end", "def add(groceries_list, add_list)\n add_hash = create_list(add_list) # {:carrot => 2, :beans => 3, :milk => 2, :apples => 3}\n groceries_list.merge!(add_hash)\nend", "def add_or_update_item(list,new_items)\n list.merge!(new_items)\nend", "def mark_conflicted(filename)\n merge_state.mark_conflicted filename\n end", "def append(*args)\n update(*args)\n @list.push(args[0])\n end", "def add_merge(options={})\n if message = options[:message]\n message = \"-m '#{message}'\"\n end\n branch = options[:branch] || \"foobar\"\n base = options[:base] || \"master\"\n sh(\"git checkout -b #{branch} 2>&1 && echo asd >> xxx && git commit -am 'xxx' && git checkout #{base} 2>&1 && git merge #{branch} --no-ff #{message}\")\n commits = last_commits\n return commits[0], commits[1]\n end", "def check_conflict_and_comment()\n results = check_conflict()\n\n results.each do |result|\n next if result[:mergeable]\n message = \"<p>This PR conflicts with <a href=\\\"#{result[:pull_request][:html_url]}\\\">##{result[:pull_request][:number]}</a>.</p>\"\n table = '<table><thead><tr><th width=\"100%\">File</th><th>Line</th></tr></thead><tbody>' + result[:conflicts].map do |conflict|\n file = conflict[:file]\n line = conflict[:line]\n line_link = \"#{result[:pull_request][:head][:repo][:html_url]}/blob/#{result[:pull_request][:head][:ref]}/#{file}#L#{line}\"\n \"<tr><td>#{file}</td><td><a href=\\\"#{line_link}\\\">#L#{line}</a></td></tr>\"\n end.join('') + '</tbody></table>'\n puts (message + table)\n warn(\"<div>\" + message + table + \"</div>\")\n end\n\n results\n end", "def add(gemspec)\n @specs << gemspec\n end", "def add(repos)\n @list.push(repos).flatten!\n self\n end", "def add_item_from_string(item_name)\n found_list_definition = nil\n origins.each do |origin|\n if origin.items.any?{|item, int_value| item.name == item_name }\n if found_list_definition.nil?\n found_list_definition = origin\n else\n raise Error(\"Could not add the item '#{item_name}' to this list because it could come from either '#{origin.name}' or '#{found_list_definition.name}'\")\n end\n end\n end\n\n if found_list_definition.nil?\n raise Error(\"Could not add the item '#{item_name}' to this list because it isn't known to any list definitions previously associated with this list.\")\n end\n\n item = InkListItem.new(origin_name: found_list_definition.name, item_name: item_name)\n item_value = found_list_definition.value_for_item(item)\n self.items[item] = item_value\n end", "def add(*gemspecs)\n @specs.push(*gemspecs)\n end", "def addHints(vals); vals.each { |h| addHint h }; self end", "def force_add(list_id:, recipient_id:, email:, attribute_names:, attribute_values:)\n @recipient_id = recipient_id\n @email = email\n add(list_id: list_id,\n recipient_id: recipient_id,\n email: email,\n attribute_names: attribute_names,\n attribute_values: attribute_values)\n rescue OptivoApi::RecipientIsAlreadyOnThisList\n remove(list_id: list_id, recipient_id: recipient_id)\n safe_add(list_id: list_id,\n recipient_id: recipient_id,\n email: email,\n attribute_names: attribute_names,\n attribute_values: attribute_values)\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 add_to_list(list)\n\n end", "def add_to_list(list)\n\n end", "def add_to_list(list)\n\n end", "def add_jobs(jobs)\n @mutex.synchronize do\n _add_jobs jobs\n end\n end", "def add list\n list_action list, \"add\"\n end", "def add_gem(gem)\n @gems << gem\n @gems = @gems.uniq\n true\n end" ]
[ "0.6009051", "0.57616585", "0.57616585", "0.5406556", "0.5394252", "0.5394252", "0.52639306", "0.49110156", "0.48640347", "0.48111224", "0.47594014", "0.46849656", "0.46749014", "0.46438017", "0.46429068", "0.46175203", "0.45756584", "0.4426399", "0.4426399", "0.44198412", "0.44030222", "0.4398389", "0.43685228", "0.43632734", "0.43628004", "0.4341069", "0.4327543", "0.43137786", "0.43077394", "0.43008253", "0.4292551", "0.42834705", "0.42758316", "0.42682514", "0.42682174", "0.42646623", "0.42640045", "0.42607015", "0.42600504", "0.42579994", "0.4253427", "0.42449072", "0.42293882", "0.42284265", "0.42235464", "0.42128244", "0.4204611", "0.4191993", "0.41883978", "0.41864932", "0.4182608", "0.41767132", "0.41604233", "0.41524667", "0.4135445", "0.41317695", "0.4130108", "0.4120779", "0.41113296", "0.41017792", "0.4098146", "0.40793264", "0.407634", "0.40649158", "0.4054493", "0.40489984", "0.4044925", "0.40394515", "0.40323842", "0.40302902", "0.4029401", "0.402392", "0.4023486", "0.40233272", "0.40217832", "0.40201843", "0.40155703", "0.40117088", "0.40106234", "0.40103894", "0.4009297", "0.40084812", "0.40067962", "0.40046147", "0.3992178", "0.3990831", "0.39876327", "0.39813945", "0.3979482", "0.39751402", "0.39727867", "0.3971057", "0.3970047", "0.39649028", "0.39649028", "0.39649028", "0.39638743", "0.3961699", "0.39602676" ]
0.46183246
16
Add conflicts to the conflict_list. Duplicate or blank conflicts will be ignored. Use the :parse option to add an unparsed conflict string. Example: conflict_list.add("Fun", "Happy") conflict_list.add("Fun, Happy", :parse => true)
def add(*names) extract_and_apply_options!(names) concat(names) clean! self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_conflict(name, specifics)\n @conflicts << Requirement.parse(name, specifics)\n end", "def conflict(val)\n conflicts << val\n conflicts.dup\n end", "def conflict(val)\n conflicts << val\n conflicts.dup\n end", "def conflicts\n @conflicts ||= []\n end", "def conflicts\n @conflicts ||= []\n end", "def add_conflict(entity, id, attr, o, c, p)\n logger.warn { \"Detected conflict on #{entity} #{attr}: [o, c, p] = #{[o, c, p].inspect}\" }\n\n conflicts.add(entity, id, attr, o, c, p)\n end", "def conflicts *syms\n syms.each { |sym| raise ArgumentError, \"unknown option '#{sym}'\" unless @specs[sym] }\n @constraints << [:conflicts, syms]\n end", "def message\n \"#{base} already defines #{conflicts}, also defined on #{owner}\"\n end", "def conflicts=(conflicts)\n unless conflicts.kind_of?(Hash)\n raise(InvalidMetadata, \"conflicts must be a Hash\")\n end\n\n @conflicts.clear\n\n conflicts.each do |name, specifics|\n add_conflict(name, specifics)\n end\n end", "def conflicts=(conflicts)\n @conflicts = replace_self_version_dependencies(conflicts, 'conflicts')\n alias_of.conflicts = conflicts\n end", "def merge_conflict?; end", "def add_tags list\n unless @tags.empty?\n @tags += ','\n end\n @tags += list.join(',')\n end", "def add_from_strings(*strings)\n strings.each { |s| merge Set.new(s.split('')) }\n self\n end", "def raise_if_conflicts # :nodoc:\n if has_conflicts?\n raise Gem::ConflictError.new self, conflicts\n end\n end", "def add(*args)\n args.flatten! # allow [] as a param\n args.each do |arg|\n arg = arg.to_sym if arg.is_a? String\n @set << arg unless @set.include? arg # avoid duplicates\n end\n end", "def add(item)\n @items << item unless include?(item)\n end", "def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end", "def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end", "def add_tags(tag_list, reload_tags = true)\n new_tags = Tag.parse_to_tags(tag_list)\n\n tags_to_add = new_tags - self.tags\n if tags_to_add.any?\n TxactionTagging.transaction do\n tags_to_add.each {|t| create_tagging(t) }\n update_attribute(:tagged, true)\n end\n end\n\n self.taggings(reload_tags)\n return self.tags(reload_tags) # need to reload or AR doesn't see the changes\n end", "def add(*names)\r\n extract_and_apply_options!(names)\r\n concat(names)\r\n clean!\r\n self\r\n end", "def resolve(conflict)\n return [] unless @config.interactive\n base_local_diffs = conflict.base_local_diffs\n base_remote_diffs = conflict.base_remote_diffs\n choice = @hl.choose do |menu|\n menu.prompt = conflict\n menu.choice(:local, text: base_local_diffs.map(&:to_s).join(\"\\n\\t\\t\"))\n menu.choice(:remote, text: base_remote_diffs.map(&:to_s).join(\"\\n\\t\\t\"))\n # menu.choice(:neither, help: \"Don't choose either set of diffs\")\n # menu.choice(:edit, help: \"Edit the diffs (coming soon)\")\n # menu.choice(:quit, help: \"I'm in over my head. Just stop!\")\n menu.select_by = :index_or_name\n end\n case choice\n when :local\n base_local_diffs\n when :remote\n base_remote_diffs\n else\n error \"Unexpected choice #{choice.inspect}.\"\n end\n end", "def cannot_have_conflicts\n \terrors.add(:base, \"Conflicts with another reservation\") if self.has_conflicts?\n end", "def append(list, val, separator = identifier(\"auto\"))\n assert_type separator, :String, :separator\n unless %w(auto space comma).include?(separator.value)\n raise ArgumentError.new(\"Separator name must be space, comma, or auto\")\n end\n list.with_contents(list.to_a + [val],\n separator:\n if separator.value == 'auto'\n list.separator || :space\n else\n separator.value.to_sym\n end)\n end", "def on_conflict(column = nil)\n ::MultiInsert::Query::OnConflict.new(self, column)\n end", "def each_conflict(&block) # :yields: file, your_version, their_version\n self.lib.conflicts(&block)\n end", "def add(*names); end", "def add(item)\n\t\t@items.push(item.to_sym.nil? ? item : item.to_sym)\n\tend", "def add_terms(*terms)\n terms.flatten.each do |term|\n raise ArgumentError unless term.is_a? String\n if term.size > 2 && term !~ /\\s/\n @completions << term\n # WARNING: thar be recursion\n self.add_terms(term.split(\".\")) if term =~ /\\./\n end\n end\n end", "def add_commit\n if (@is_commit)\n raise RuntimeError.new('Only one commit per request list allowed!')\n end\n @requests << {'commit' => ''}\n @is_commit = true\n self\n end", "def add_completion(completion_params)\n if validate_completion completion_params\n completion = compute_completion_hash_from_params completion_params\n self.completions << completion\n completion\n else\n nil\n end\n end", "def add_to_list\n\n # Keep a copy of position to set after the change detail is saved, \n # because the entry will be put at the end of the list.\n position = self.position\n self.save\n\n if self.errors.empty?\n change_details = self.change_item.change_details.find(:all)\n position = 1 if !position\n change_details.last.insert_at(position)\n end\n end", "def insert_ignore\n insert_conflict\n end", "def add_valid_option(option)\n @@valid_options.push(option) unless @@valid_options.include?(option)\n @@valid_options\n end", "def create\n @conflict = Conflict.new(conflict_params)\n\n respond_to do |format|\n if @conflict.save\n format.html { redirect_to @conflict, notice: 'Conflict was successfully created.' }\n format.json { render :show, status: :created, location: @conflict }\n else\n format.html { render :new }\n format.json { render json: @conflict.errors, status: :unprocessable_entity }\n end\n end\n end", "def add(groceries_list, add_list)\n\tadd_hash = create_list(add_list) # {:carrot => 2, :beans => 3, :milk => 2, :apples => 3}\n\tgroceries_list.merge!(add_hash)\nend", "def add_tags(*list)\n tags.push(*list).uniq!\n tags\n end", "def add_ignore(*rules)\n data['Ignore'] ||= []\n rules.each { |rule| data['Ignore'] << rule.title }\n data['Ignore'].sort!.uniq!\n end", "def add_item(grcy_list, string, i=1)\n grcy_list[string] = i\nend", "def add_list_definition(style); end", "def parse(list)\n return list if list.is_a?(Array)\n list.include?(',') ? parse_with_commas(list) : parse_with_spaces(list)\n end", "def warning(str)\n @parts.push(warning: str)\n end", "def add_gems(gems = [])\n gems.uniq.each { |gem| @gems << gem } \n true\n end", "def to_s\n conflicts = frozen? ? self.dup : self\n conflicts.send(:clean!)\n\n conflicts.map do |name|\n name.include?(delimiter) ? \"\\\"#{name}\\\"\" : name\n end.join(delimiter.ends_with?(\" \") ? delimiter : \"#{delimiter} \")\n end", "def add_item(list, string)\n\titem_to_add = string.split(\" \")\n\tlist[item_to_add[0].to_sym] = item_to_add[1].to_i\n\tlist\nend", "def add_tags\n self.tag_list = 'bug, feature, improvement, feedback, discussion, help'\n end", "def add(*words)\n words.flatten.each do |word|\n add_word(word)\n end\n nil\n end", "def add_tags\n \tunless tags_field.blank?\n\t\t\ttags = tags_field.split(\",\")\n\t\t\ttags.each do |tag|\n self.tags << Tag.find_or_initialize_by_name(tag.strip)\n\t\t\tend\n\t\tend\t\n end", "def mark_conflicted(filename)\n merge_state.mark_conflicted filename\n end", "def add(*args)\n @list << args\n @list.flatten!\n end", "def add_syntax_error(syntax_error)\n syntax_errors << syntax_error\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 add(_, working_set = nil)\n return unless working_set\n entries.insert(position + 1, working_set)\n go_forward_history(nil)\n end", "def merge_conflict?\n prefix == 'U'\n end", "def check_conflict_and_comment()\n results = check_conflict()\n\n results.each do |result|\n next if result[:mergeable]\n message = \"<p>This PR conflicts with <a href=\\\"#{result[:pull_request][:html_url]}\\\">##{result[:pull_request][:number]}</a>.</p>\"\n table = '<table><thead><tr><th width=\"100%\">File</th><th>Line</th></tr></thead><tbody>' + result[:conflicts].map do |conflict|\n file = conflict[:file]\n line = conflict[:line]\n line_link = \"#{result[:pull_request][:head][:repo][:html_url]}/blob/#{result[:pull_request][:head][:ref]}/#{file}#L#{line}\"\n \"<tr><td>#{file}</td><td><a href=\\\"#{line_link}\\\">#L#{line}</a></td></tr>\"\n end.join('') + '</tbody></table>'\n puts (message + table)\n warn(\"<div>\" + message + table + \"</div>\")\n end\n\n results\n end", "def add new_job\n # at the beginning we can add new_job at the last position of array\n at = @jobs.length\n # we are looking for first job that is dependent on new_job\n @jobs.each_with_index do |job, index|\n at = index if job.dependency == new_job.name\n end\n @jobs.insert at, new_job\n # once the new_job is added to jobs array,\n # we should check if new_job dependency job is located before or after new_job's position\n # if dependency is located after new_job it means we have Circular Dependency\n @jobs.each_with_index do |job, index|\n raise JobsCantHaveCircularDependenciesError if new_job.dependency == job.name and index > at\n end\n end", "def add_multiple(projects_data)\n parsed_projects_data = projects_data.inject({}) do |final, key_and_value|\n begin\n final.update(key_and_value[0] => {\n 'git_url' => key_and_value[1].is_a?(String) ? key_and_value[1] : key_and_value[1][\"git_url\"],\n 'branch' => key_and_value[1].is_a?(String) ? 'master' : key_and_value[1][\"branch\"]\n })\n rescue => e\n logger.error \"event: 'union_add_multiple_git_url_branch_extraction_failure', error_message: #{e.message}, project_name: #{key_and_value[0]}\"\n end\n end\n\n parsed_projects_data.each do |project_name, project_url_and_branch|\n # Skip this project if it already exists.\n next unless Project.where(project_name: project_name).first.nil?\n\n new(\n project_name: project_name,\n git_url: project_url_and_branch['git_url'],\n branch: project_url_and_branch['branch']\n ).save\n end\n\n logger.info 'event: union_add_multiple_complete'\n end", "def gitAddCommit\n @gop.add(:all => true)\n\n begin\n @gop.commit(\"Automatic version bump\")\n rescue Git::GitExecuteError => giterror\n # continue\n end\n end", "def append(item)\n items << item unless items.include?(item)\n end", "def resolve_aliases added\n # resolve any pending unmatched aliases\n key = added.pretty_name\n unmatched_alias_list = @unmatched_alias_lists[key]\n return unless unmatched_alias_list\n unmatched_alias_list.each do |unmatched_alias|\n added.add_alias unmatched_alias, self\n @external_aliases.delete unmatched_alias\n end\n @unmatched_alias_lists.delete key\n end", "def add(message)\n @errors << message\n end", "def addOption(option)\n\t\t@list.last.merge!(option)\n\tend", "def add(groceries_list, add_list)\n add_hash = create_list(add_list) # {:carrot => 2, :beans => 3, :milk => 2, :apples => 3}\n groceries_list.merge!(add_hash)\nend", "def add_lint(node_or_line_or_location, message)\n @lints << Lint.new(self,\n engine.filename,\n extract_location(node_or_line_or_location),\n message,\n @config.fetch('severity', :warning).to_sym)\n end", "def add_suggestions(name, items)\n # unless alternatives = compute_alternatives(name, items)\n # return\n # end\n # append_message(sprintf(' Did you mean \"%s\"?', implode('\", \"', alternatives)))\n end", "def set_conflict\n @conflict = Conflict.find(params[:id])\n end", "def append next_parslet\n raise ArgumentError if next_parslet.nil?\n @alternatives << next_parslet.to_parseable\n update_hash\n self\n end", "def add_lint(node_or_line, message = nil)\n line = node_or_line.respond_to?(:line) ? node_or_line.line : node_or_line\n\n @lints << Lint.new(engine.filename,\n line,\n message || description)\n end", "def check_conflicts(list)\n #return if force?\n list.each do |action, loc, tname, fname, opts|\n tpath = loc + tname\n fpath = output + fname\n if File.exist?(fpath)\n if tpath.directory?\n if !fpath.directory?\n raise \"Directory to be created clashes with a pre-existent file -- #{fname}\"\n end\n else\n if fpath.directory?\n raise \"File to be created clashes with a pre-existent directory -- #{fname}\"\n end\n end\n end\n end\n end", "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_strings(strings)\n strings.each { |string| @strings << string }\n self\n end", "def on_conflict_sql(sql)\n @sql_on_conflict = sql\n self\n end", "def add(klass_or_str)\n @ignored_exceptions << normalize_as_klass(klass_or_str)\n end", "def add_or_update_item(list,new_items)\n list.merge!(new_items)\nend", "def test_todo_already_on_list_message\n goal = \"\\\"#{@todo1}\\\" is already on this list.\"\n assert_equal(goal, @list.add(@todo1))\n end", "def add_all(words)\n end", "def append_to_list(lst, field)\n if (field != nil) and (field.strip != '')\n lst << field\n end\n end", "def add (id, items)\n params = {\n :id => id,\n :items => items\n }\n requires params\n DataSift.request(:POST, 'list/replace/add', @config, params)\n end", "def parse_line(str)\n _, color, rest = str.match(/^([\\w\\s]+) bags contain (.+)\\.$/).to_a\n containments = str.scan(/(\\d+) ([\\w\\s]+) bags?/).map { |count, color| Containment.new(color, count.to_i) }\n add(color, containments)\n end", "def add_jobs(jobs)\n @mutex.synchronize do\n _add_jobs jobs\n end\n end", "def add_hardcoded_duplicates(task)\n task.add_duplicate('t1 duplicate 1')\n task.add_duplicate('t1 duplicate 2')\n end", "def add_gem_names\n add_gem_names_mutex = get_mutex 'add_gem_names'\n\n add_gem_names_mutex.synchronize do\n break unless @gem_name_queue.empty?\n\n get_gem_names.each do |name|\n @gem_name_queue.enq name\n end\n end\n end", "def conflict_params\n params.require(:conflicts).permit(:date, :member_id)\n end", "def options_add opts, colors\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" add, a\".colorize(colors[:yellow]) + \n\t\t\t\t\" adds the task to the current list\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:add].colorize(colors[:red])\n\t\t\t\topts.on('-p PRIORITY', [\"high\", \"medium\", \"low\"], 'set the priority of the task to one of the', 'following. Default is medium') do |p|\n\t\t\t\t\tpriorities = {\n\t\t\t\t\t\t\"high\" => 0,\n\t\t\t\t\t\t\"medium\" => 1,\n\t\t\t\t\t\t\"low\" => 2\n\t\t\t\t\t}\n\t\t\t\t\tOPTIONS[:change_priority] = true\n\t\t\t\t\tOPTIONS[:priority] = priorities[p]\n\t\t\t\tend\n\t\t\tend", "def add_commits_in_branch branch_name\n array_output_of(\"git log #{branch_name} --format='%h|%s|%an <%ae>' --topo-order --reverse\").each do |commit|\n sha, message, author = commit.split('|')\n next if message == 'Initial commit'\n @commit_list.add sha: sha, message: message, branch_name: branch_name, author: author\n end\n @commit_list\n end", "def add_to_list(list)\n\n end", "def add_to_list(list)\n\n end", "def add_to_list(list)\n\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 add(rule); end", "def parse(str)\n parts = str.split(',')\n parts.each do |part|\n range = self.class.parse_part(part)\n merge!(range)\n end\n end", "def add_depend_list\n list = ''\n if @depedencies.nil? or @depedencies.size == 0\n list = ''\n elsif @depedencies.class == String\n list = \"=> [:#{@depedencies}] \"\n elsif @depedencies.class == Array\n list = '=> [ '\n need_comma = false\n for element in @depedencies\n list = list + ', ' if need_comma\n list = list + \":#{element}\"\n @log.info \" - dependent from : #{element}\"\n need_comma = true\n end\n list = list + ' ] '\n else\n @log.fatal { \"Cannot parse dependencies [#{@depedencies}]\" }; exit\n end\n return list\n end", "def add_add_del_on_list(key, to_add, to_remove)\n if (@is_commit)\n raise RuntimeError.new('No further request supported after a commit!')\n end\n @requests << {'add_del_on_list' => {'key' => key, 'add' => to_add, 'del'=> to_remove}}\n self\n end", "def validate_inclusion(attribute_name, list, message = nil)\n value = attributes[attribute_name]\n if value && !list.include?(value)\n append_error(attribute_name, message || :isnt_listed)\n end\n end", "def add_merge(options={})\n if message = options[:message]\n message = \"-m '#{message}'\"\n end\n branch = options[:branch] || \"foobar\"\n base = options[:base] || \"master\"\n sh(\"git checkout -b #{branch} 2>&1 && echo asd >> xxx && git commit -am 'xxx' && git checkout #{base} 2>&1 && git merge #{branch} --no-ff #{message}\")\n commits = last_commits\n return commits[0], commits[1]\n end", "def insert_conflict_sql(sql)\n if opts = @opts[:insert_conflict]\n sql << \" ON CONFLICT\"\n\n if target = opts[:constraint] \n sql << \" ON CONSTRAINT \"\n identifier_append(sql, target)\n elsif target = opts[:target]\n sql << ' '\n identifier_append(sql, Array(target))\n if conflict_where = opts[:conflict_where]\n sql << \" WHERE \"\n literal_append(sql, conflict_where)\n end\n end\n\n if values = opts[:update]\n sql << \" DO UPDATE SET \"\n update_sql_values_hash(sql, values)\n if update_where = opts[:update_where]\n sql << \" WHERE \"\n literal_append(sql, update_where)\n end\n else\n sql << \" DO NOTHING\"\n end\n end\n end", "def resolve_conflict(closed = nil)\n closed = [] if not closed\n conflicts = users_events.select{|e| e.start_time < self.end_bound && e.end_time > self.start_bound}.sort{|a,b| a.start_time <=> b.start_time}\n conflicts -= [self]\n # Sort the list of conflicts to pick the events which are more likely to be able to move without conflict\n sorted_conflicts = conflicts.sort{|a,b| (to_min(b.end_bound) - to_min(b.start_bound) - to_min(b.duration)) <=> (to_min(a.end_bound) - to_min(a.start_bound) - to_min(a.duration))}\n\n if conflicts.size == 1\n c = conflicts.first\n if c.static?\n return false\n end\n \n # With only one conflict, you don't have to check if moving allows you to place the event\n # Check to see if c can be moved. If it can, set new_time to the time that c can be moved to.\n if new_time = c.move?(self)\n self.move(self.start_bound)\n c.move(new_time)\n self.save\n c.save\n return true\n else\n if !closed.include?(c) && c.resolve_conflict(closed)\n self.move(self.start_bound)\n self.save\n return true\n else\n closed << c\n end\n end\n return false\n end\n \n sorted_conflicts.each do |c|\n \n # If the conflict is static, no point in even check if moving helps\n if c.static?\n next\n end\n\n index = conflicts.index(c)\n prev_c = conflicts[index - 1]\n\n # In case this conflict is the earliest conflict possible\n if index == 0\n if to_min(c.end_time) - to_min(self.start_bound) >= to_min(self.duration)\n if new_time = c.move?(self)\n self.move(self.start_bound)\n c.move(new_time)\n self.save\n c.save\n return true\n else\n if !closed.includes?(c) && c.resolve_conflict\n self.move(self.start_bound)\n self.save\n return true\n else\n closed << c\n end\n end\n end\n elsif index == conflicts.size - 1\n if to_min(self.end_bound) - to_min(prev_c.end_time) >= to_min(self.duration)\n if new_time = c.move?(self)\n self.move(prev_c.end_time)\n c.move(new_time)\n self.save\n c.save\n return true\n else\n if !closed.includes?(c) && c.resolve_conflict\n self.move(self.start_bound)\n self.save\n return true\n else\n closed << c\n end\n end\n end\n # Check to see if moving c would allow us to place the event\n elsif to_min(c.end_time) - to_min(prev_c.end_time) >= to_min(self.duration)\n # This means we can put the event here\n # Check to see if c can be moved. If it can, set new_time to the time that c can be moved to.\n if new_time = c.move?(self)\n self.move(prev_c.end_time)\n c.move(new_time)\n self.save\n c.save\n return true\n else\n if !closed.includes?(c) && c.resolve_conflict\n self.move(prev_c.end_time)\n self.save\n return true\n else\n closed << c\n end\n end\n end\n end\n\n # If we reach here, it is impossible to move the event to a location without conflict\n return false\n end", "def add_gem(gem)\n @gems << gem\n @gems = @gems.uniq\n true\n end", "def add_names(*names)\n @names.push(*names)\n end", "def add_item_from_string(item_name)\n found_list_definition = nil\n origins.each do |origin|\n if origin.items.any?{|item, int_value| item.name == item_name }\n if found_list_definition.nil?\n found_list_definition = origin\n else\n raise Error(\"Could not add the item '#{item_name}' to this list because it could come from either '#{origin.name}' or '#{found_list_definition.name}'\")\n end\n end\n end\n\n if found_list_definition.nil?\n raise Error(\"Could not add the item '#{item_name}' to this list because it isn't known to any list definitions previously associated with this list.\")\n end\n\n item = InkListItem.new(origin_name: found_list_definition.name, item_name: item_name)\n item_value = found_list_definition.value_for_item(item)\n self.items[item] = item_value\n end" ]
[ "0.59939474", "0.5860045", "0.5860045", "0.55704325", "0.55704325", "0.5373239", "0.53591925", "0.49797013", "0.49109834", "0.48764688", "0.47883013", "0.47106072", "0.46698946", "0.4666219", "0.45752895", "0.45750764", "0.44634843", "0.44634843", "0.44492346", "0.4431701", "0.4418663", "0.43769655", "0.43677396", "0.4364391", "0.43516672", "0.43398282", "0.4308826", "0.42977777", "0.42965606", "0.4288225", "0.42882106", "0.4277001", "0.42730796", "0.4272079", "0.42685705", "0.42531314", "0.4252403", "0.4241169", "0.42287627", "0.42095312", "0.42038843", "0.42025703", "0.4192946", "0.4191568", "0.41825816", "0.41823158", "0.41761026", "0.41682893", "0.41629076", "0.41564378", "0.41556096", "0.41440076", "0.41339228", "0.41259655", "0.41252536", "0.41101736", "0.40864024", "0.40809655", "0.4075027", "0.40710175", "0.40681297", "0.40571615", "0.40566576", "0.40541187", "0.40471452", "0.40440995", "0.40391934", "0.40322396", "0.4026562", "0.40223223", "0.40185443", "0.40183163", "0.4013178", "0.40121806", "0.40096524", "0.40022242", "0.39991206", "0.3996947", "0.3992878", "0.3991627", "0.39851522", "0.3979201", "0.39745724", "0.39702404", "0.39689428", "0.39689428", "0.39689428", "0.39689028", "0.39673752", "0.396651", "0.39662403", "0.39656627", "0.396384", "0.3954292", "0.39467895", "0.3945317", "0.39418116", "0.39388162", "0.39352655" ]
0.44807523
16
Remove specific conflicts from the conflict_list. Use the :parse option to add an unparsed conflict string. Example: conflict_list.remove("Sad", "Lonely") conflict_list.remove("Sad, Lonely", :parse => true)
def remove(*names) extract_and_apply_options!(names) delete_if { |name| names.include?(name) } self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(*names)\r\n extract_and_apply_options!(names)\r\n delete_if { |name| names.include?(name) }\r\n self\r\n end", "def remove_item(grcy_list, string)\n grcy_list.delete(string)\nend", "def remove_item(list, string)\n\tlist.delete(string.to_sym)\n\tlist\nend", "def remove(*names); end", "def remove_item(grocery_list, item)\n\tif grocery_list.include?(item.to_sym)\n\t\tgrocery_list.delete(item.to_sym)\n\telse\n\t\tputs \"item name invalid\"\n\tend\nend", "def remove_item(list, string)\n\tlist.delete(string)\n\treturn list\nend", "def remove_item(list, string)\n\tlist.delete(string)\n\treturn list\nend", "def list_remover(list_input_remover, item_name_remove)\n list_input_remover.delete(item_name_remove)\nend", "def remove_item(list, name)\n list.delete(normalize_string(name))\n return list\nend", "def remove_from_list(list_name, lead_or_idnum, options={})\n list_operation(list_name, \"REMOVEFROMLIST\", lead_or_idnum, options)\n end", "def remove list\n list_action list, \"remove\"\n end", "def remove(final_list, item)\r\n final_list.delete(item)\r\n end", "def remove_item(list, item_name)\n list.delete(item_name.to_sym)\n list\nend", "def remove(*names)\n names = names.map(&:downcase)\n @parts.delete_if { |p| names.include? p.name.downcase }\n end", "def remove_item(item, list)\n\t# steps: delete the item if it exists\n\tlist.delete_if {|list_item| list_item == item.to_sym}\n\t# output: updated list\n\tlist\nend", "def remove_tags!(*list)\n removed = []\n tags.reject! { |tag| list.include?(tag) ? removed.push(tag) : false }\n removed\n end", "def options_remove opts, colors\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" remove, rm\".colorize(colors[:yellow]) + \n\t\t\t\t\" removes the list completely.\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:remove].colorize(colors[:red])\n\t\t\tend", "def remove( *ruleses )\n self.dup.remove!( *ruleses )\n end", "def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end", "def remove_item(list, item_name)\n\t{|list| list.delete(\"mangoes\")}\nend", "def remove(input_list, item)\n input_list.delete(item)\nend", "def chimp_remove(options, delete_user=true, send_goodbye=false, send_notify=false)\n begin\n raise MailChimpAPI::DeleteError, \"Email and Mailing List Id can't be nil\" if (options[:email].nil? || options[:mailing_list_id].nil?)\n @client.call(\"listUnsubscribe\", @api_key, options[:mailing_list_id], options[:email], delete_user, send_goodbye, send_notify) \n rescue XMLRPC::FaultException => e\n raise MailChimpAPI::DeleteError, e.faultString\n end \n end", "def remove(*args)\n commit('remove', *args)\n end", "def remove_item(list_name,item_to_remove)\n #find all array elements in given list with the given item name and delete them\n list_name.delete_if { |x| x[:item_name] == item_to_remove}\n end", "def remove_item(list, remove_item)\n if list.include?(remove_item)\n list.delete_if { |item| item == remove_item }\n list\n else\n puts \"There is not #{remove_item} in the list\"\n end\nend", "def remove_tags(tag_list, reload_tags = true)\n tags_to_delete = Tag.parse_to_tags(tag_list)\n TxactionTagging.transaction do\n destroy_taggings(tags_to_delete)\n end if tags_to_delete.any?\n self.taggings(reload_tags)\n current_tags = self.tags(reload_tags)\n update_attribute(:tagged, false) if current_tags.empty?\n end", "def remove(*args)\n @list = (@list - args)\n end", "def remove(*args)\n matcher = Matchers::NotMatcher.new(Matchers::Extract.new(*args))\n add_matcher(matcher)\n end", "def remove_notes(remove_list)\n \n remove_list.each do |upload_id|\n upload = Upload.find(upload_id)\n if ( @document.uploads.include?(upload) )\n @document.uploads.delete(upload)\n end\n end\n end", "def list_remover(list,item) #takes 2 arguments, 1 list and name of an item\n\tlist.delete(item)\t\n\t\nend", "def remove(groceries_list, delete_item)\n groceries_list.delete(delete_item.to_sym) {|item| puts \"#{item} not found!\"}\nend", "def remove_to_list(list, remove_list_key)\r\n list.delete(remove_list_key)\r\n list\r\nend", "def remove_notes_collection(remove_list)\n \n remove_list.each do |upload_id|\n upload = Upload.find(upload_id)\n if ( @collection.uploads.include?(upload) )\n @collection.uploads.delete(upload)\n end\n end\n end", "def remove(groceries_list, delete_item)\n\tgroceries_list.delete(delete_item.to_sym) {|item| puts \"#{item} not found!\"}\nend", "def remove_item(list, item_remove)\n list.delete(item_remove)\nend", "def list_remove_at(column, *positions)\n statements.concat(positions.map { |position| \"#{column}[#{position}]\" })\n end", "def remove_by_name(list, item_to_remove)\n list.each do |current_item|\n if current_item[\"productName\"] == item_to_remove[\"productName\"]\n list.delete current_item\n end\n end\n end", "def remove(list, item_name)\n\tlist.delete(item_name)\nend", "def remove_item(list, item_name)\n # steps:\n # check IF item is included in list\n # delete the item\n # ELSE, print a message to the user\n list.include?(item_name) ? list.delete(item_name) : puts(\"No #{item_name} on the list.\")\n \n # output: return updated hash or the original hash\n list\nend", "def remove(grocery_list, food)\n\tgrocery_list.delete(food)\nend", "def remove_sport\n 'basketball|baseball|softball|football|womens basketball'\n end", "def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend", "def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend", "def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend", "def remove_all(*args)\n set_option_value(:remove_all, true, *args)\n end", "def remove(*a)\n # event is namespaced to not accidently trigger closing the dialog box\n select(*a).trigger('clockwork.remove')\n select(*a).remove()\n end", "def remove(list, item)\n\tlist.delete(item)\n\tlist\nend", "def remove_item(list, item_name)\n if list.has_key?(item_name)\n list.delete(item_name)\n end\n list\nend", "def remove(list, food_item)\n\tlist.delete(food_item)\n\tlist\nend", "def remove(input, string); end", "def answer_remove_list(answer, user = nil)\n id_list = []\n return id_list unless answer.question.option_based?\n\n answer.question.conditions.each do |cond|\n opts = cond.option_list.map(&:to_i).sort\n action = cond.action_type\n chosen = answer.question_option_ids.sort\n if chosen == opts\n if action == 'remove'\n rems = cond.remove_data.map(&:to_i)\n id_list += rems\n elsif !user.nil?\n UserMailer.question_answered(JSON.parse(cond.webhook_data), user, answer,\n chosen.join(' and ')).deliver_now\n end\n end\n end\n # uniq because could get same remove id from diff conds\n id_list.uniq\n end", "def remove_item(new_list, item)\n \n new_list.delete(item)\n \n new_list\nend", "def remove_item(list, item_removed)\n list.delete(item_removed)\nend", "def remove(*paths)\n json_op(:remove, self, *paths)\n end", "def remove_item(item, list)\n\tlist.delete_if do |i|\n\t\ti == item \n\tend\nend", "def remove_item(list, item_name)\n\tlist.delete_if { |item, quantity| item === item_name }\nend", "def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend", "def remove_item(new_list, item_name)\r\n new_list.delete(item_name)\r\nend", "def rm(list, options = {})\r\n fu_check_options options, :force, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message \"rm#{options[:force] ? ' -f' : ''} #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n list.each do |fname|\r\n remove_file fname, options[:force]\r\n end\r\n end", "def remove (list, item)\n\tlist.delete(item)\nend", "def remove(list, item)\n\tlist.delete(item)\nend", "def remove_item_list\n if @listing.job? \n ['Filled Position', 'Removed Job']\n elsif @listing.event? \n ['Event Cancelled', 'Event Ended']\n else\n ['Changed Mind', 'Donated Item', 'Gave Away Item', 'Sold Item']\n end\n end", "def remove_item(list, item_name)\n list.delete(item_name)\nend", "def remove(files, opts = {})\n args = []\n args << '-f' if opts[:force]\n args << [*files]\n command(:rm, args)\n end", "def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend", "def list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend", "def remove_item(list, item_name)\n list.delete(item_name)\n list\nend", "def remove_from_mailchimp(list_name)\n apikey ||= chimpLogin(monkeybrains[:username], monkeybrains[:password])\n list_id ||= find_mailing_list(apikey, list_name)\n chimpUnsubscribe(apikey, list_id[\"id\"], self[email_column])\n rescue XMLRPC::FaultException\n end", "def remove(arpeggiator)\n arpeggiators = [arpeggiator].flatten\n @arpeggiators.delete_if { |arpeggiator| arpeggiators.include?(arpeggiator) }\n @arpeggiators\n end", "def remove\n __flag__ :remove\n end", "def remove(*values)\n values.inject(self) { |res, val| res._remove(val) or fail ArgumentError, \"Unknown value for remove: #{val}\" }\n end", "def remove_item(list, item_name)\r\n\tif list.has_key?(item_name)\r\n\t\tlist.delete(item_name)\r\n\tend\r\n\tlist\r\nend", "def remove_item(list, item)\n\tlist.delete(item)\nend", "def remove_from_list(list, item)\n\tlist.delete(item)\nend", "def removeTags(document,tagList)\n tagList.each do |tag|\n document.search(tag).remove\n end \n end", "def delete_item(rmstr,list)\n list.delete(rmstr)\n list\nend", "def remove_item(groceries_list, item_to_remove)\n\t# remove item from list\n\tgroceries_list.delete(item_to_remove)\n\t# return updated list\n\tgroceries_list\nend", "def remove(grocery_list, item)\n grocery_list.delete(item)\nend", "def remove_item(list, item_to_remove)\n list.reject! { |item, quantity| item == item_to_remove }\n return list\nend", "def remove_item(list, item_to_be_removed)\n # if list.has_key? item_to_be_removed\n # list.delete(item_to_be_removed)\n # end\n list.delete(item_to_be_removed) if list.has_key? item_to_be_removed\n list\nend", "def remove_item(list, key_name)\r\n\tlist.delete(key_name)\r\n\treturn list\r\nend", "def remove_list_entry(serial)\n return nil if @crl_list_file.nil?\n\n data = read_data(@crl_list_file)\n\n updated_list = []\n\n data.each_line do |line|\n line.chomp!\n revoke_info = line.split(',', 3)\n if revoke_info[0].to_i != serial\n updated_list.push(line)\n end\n end\n write_data(@crl_list_file, updated_list.join(\"\\n\") + \"\\n\")\n nil\n end", "def remove_item(item, list)\n list.delete(item)\nend", "def remove_from_pokemon_shop(symbol_of_shop, remove_list_mon, param_form = [], list_quantity_to_remove = [])\n return unless mon_shop_param_legit?(symbol_of_shop,\n list_id: remove_list_mon,\n list_param: param_form,\n list_quantity: list_quantity_to_remove)\n return unless @pokemon_shop_list.key?(symbol_of_shop)\n\n pkm_list = @pokemon_shop_list[symbol_of_shop]\n remove_list_mon.each_with_index do |id, index|\n form = param_form[index].is_a?(Hash) ? param_form[index][:form].to_i : 0\n result = pkm_list.find_index { |hash| hash[:id] == id && hash[:form].to_i == form }\n next unless result\n\n pkm_list[result][:quantity] -= (list_quantity_to_remove[index].nil? ? 999 : list_quantity_to_remove[index])\n pkm_list.delete_at(result) if pkm_list[result][:quantity] <= 0\n end\n @pokemon_shop_list[symbol_of_shop] = pkm_list\n sort_pokemon_shop(symbol_of_shop)\n end", "def remove_from_list(item,list)\n list.delete(item)\nend", "def remove_item(list,item)\r\n list.delete_if {|key,value| key == item}\r\n list\r\nend", "def remove_item(complete_list, removed_item )\n #complete_list.delete(remove_item)\n complete_list.delete_if {|k| k == removed_item }\n# if remove_answer == \"yes\"\n# while remove_answer == \"yes\"\n# puts \"what would you like to remove?\"\n# remove_item = gets.chomp\n# p complete_list[remove_item] #complete_list.delete(remove_item)\n# puts \"do you want to remove anything else? yes or no?\"\n# remove_answer = gets.chomp\n# end\n# else\n p complete_list\n end", "def remove_groceries(list, item)\n\tlist.delete (item)\n\tp list\nend", "def maybe_remove_by_name(names, node)\n name = node.css('> name').first.text\n unless names.include?(name)\n puts \"Removing #{name}\" if @options.verbose\n node.remove\n end\n end", "def remove_item(item)\n # raises WrongListException if item.list != self\n # TODO\n end", "def remove_item(list_items, item_name)\n list_items.delete(item_name)\nend", "def remove_from_list(item_to_rmv)\n item_to_rmv.to_str\n updated_list = Hash.new\n updated_list = $old_list.to_h\n #updated_list.delete_if {|key, value| key == item_to_rmv}\n if updated_list.include?(item_to_rmv) == true \n #p \"test\"\n #p item_to_rmv\n #p $old_list\n p updated_list.delete(item_to_rmv)\n p updated_list.each {|key, val| p key, val}\n #p updated_list\n else \n p \"that item isn't on the list\"\n end\n #if $old_list.to_h.include?(item_to_rmv) == true\n # updated_list.delete(item_to_rmv)\n # updated_list = $old_list.to_h\n #else\n # p \"that item isn't on the list\"\n #end\n \n \nend", "def find_remove(preposistion)\n\t\tremove(find(preposition))\n\tend", "def remove(address_or_id)\n delete(\"#{domain}/complaints/#{address_or_id}\")\n end", "def remove_item (list, item)\n list.delete(item)\nend", "def remove_item(list,item)\n\tlist.delete(item)\nend", "def remove_server(name, server, opts = {})\n type = find_type(name)\n return false unless type\n server = \"no server #{server} \"\n server << \"vrf #{opts[:vrf]}\" if opts[:vrf]\n configure [\"aaa group server #{type} #{name}\", server, 'exit']\n end", "def remove_item(list, item)\n list.delete(item)\nend", "def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend", "def remove_item(list, item)\r\n\tlist.delete(item)\r\n\treturn list\r\nend" ]
[ "0.6092978", "0.57151985", "0.57040054", "0.54154533", "0.5376303", "0.5375382", "0.5375382", "0.5310719", "0.52998656", "0.5270083", "0.5243265", "0.5234724", "0.5183906", "0.51521015", "0.5139484", "0.51394594", "0.5112362", "0.5074133", "0.5056825", "0.5041495", "0.50297517", "0.50069934", "0.50015897", "0.49891132", "0.49773288", "0.49557716", "0.4954522", "0.49470535", "0.49388507", "0.49332646", "0.4930551", "0.49244988", "0.49166697", "0.4912173", "0.49046585", "0.48726636", "0.48718998", "0.4865137", "0.48331088", "0.4817494", "0.48162928", "0.48103243", "0.48103243", "0.48103243", "0.4803171", "0.47879493", "0.4770086", "0.4755896", "0.47535762", "0.47492614", "0.474638", "0.47458264", "0.47439608", "0.4743578", "0.4734447", "0.4729529", "0.47251764", "0.47152063", "0.4706398", "0.47048518", "0.46970224", "0.4696984", "0.46952197", "0.46950972", "0.46860796", "0.46800372", "0.46714512", "0.46710512", "0.46641874", "0.46635792", "0.4661032", "0.46588925", "0.46551123", "0.46539536", "0.46475476", "0.4643295", "0.46376806", "0.4635517", "0.4629182", "0.46278194", "0.46228245", "0.46227428", "0.46218926", "0.46184725", "0.46175727", "0.461732", "0.4614509", "0.46116552", "0.4610278", "0.46100914", "0.4608745", "0.4608288", "0.46075568", "0.4606415", "0.46051916", "0.46024996", "0.4600442", "0.45949167", "0.4594128", "0.45925435" ]
0.61348784
0
Transform the conflict_list into a conflict string suitable for edting in a form. The conflicts are joined with conflictList.delimiter and quoted if necessary. Example: conflict_list = conflictList.new("Round", "Square,Cube") conflict_list.to_s 'Round, "Square,Cube"'
def to_s conflicts = frozen? ? self.dup : self conflicts.send(:clean!) conflicts.map do |name| name.include?(delimiter) ? "\"#{name}\"" : name end.join(delimiter.ends_with?(" ") ? delimiter : "#{delimiter} ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_to_delimited_string(list, delimiter = '|')\n str = \"\"\n list.each do |e|\n str << e\n str << delimiter unless e == list.last\n end\n str\n end", "def to_s\r\n clean!\r\n \r\n map do |name|\r\n name.include?(delimiter) ? \"\\\"#{name}\\\"\" : name\r\n end.join(delimiter.ends_with?(\" \") ? delimiter : \"#{delimiter} \")\r\n end", "def to_s\n s = @list.join(command_join_string!)\n s\n end", "def to_s\r\n @list.map{|el| el.to_s}.join ' | '\r\n end", "def condense_to_string(sequence_list)\n sequence_list.select { |item| item.is_a?(String) }.inject(:+) || ''\n end", "def to_s\n\t\t\t\t'[' << map(&:to_s).join(', ') << ']'\n\t\t\tend", "def to_s\r\n @list.map{|el| el.to_s}.join ' '\r\n end", "def format_list(items)\n items.join('` or `')\n end", "def to_s\n result = ''\n namelists.each do |namelist|\n result += \"\\n&#{namelist}\\n\"\n result += @to_write[namelist].join('')\n result += \"\\n/ ! end of #{namelist} namelist\\n\"\n end\n result.sub(\"\\n\\n\\n\", \"\\n\\n\")\n end", "def to_string\n list.to_string\n end", "def to_s\n\t\t\t# out = \"\"\n\t\t\t\n\t\t\t# self.each do |i|\n\t\t\t# \tout << i.to_s\n\t\t\t# \tout << ','\n\t\t\t# end\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# self.each do |i|\n\t\t\t# \tout << \"#{i},\"\n\t\t\t# end\n\t\t\t\n\t\t\t# return out\n\t\t\t\n\t\t\treturn self.inject(\"\"){|out, i| out << \"#{i},\"}\n\t\tend", "def to_s\n \"{#{@rep.map { |c| \"\\\"#{c}\\\"\" }.join ', '}}\"\n end", "def to_s\n resolve\n self.join(\" \")\n end", "def to_s\n return_string = ''\n @string_order.each do |string_name|\n unless send(string_name.to_sym).blank?\n return_string += ',' unless return_string.empty?\n return_string += send(\"#{string_name}_string\".to_sym)\n end\n end\n\n return_string\n end", "def to_s\n r = []\n each do |e|\n r << e\n end\n '[' + r.join(', ') + ']'\n end", "def selector_to_str(value)\n return value.value if value.is_a?(Sass::Script::String)\n return unless value.is_a?(Sass::Script::List)\n\n if value.separator == :comma\n return value.to_a.map do |complex|\n next complex.value if complex.is_a?(Sass::Script::String)\n return unless complex.is_a?(Sass::Script::List) && complex.separator == :space\n return unless (str = selector_to_str(complex))\n str\n end.join(', ')\n end\n\n value.to_a.map do |compound|\n return unless compound.is_a?(Sass::Script::String)\n compound.value\n end.join(' ')\n end", "def to_s\n @matcher_list.map(&:to_s).join(\"#{@combiner} \")\n end", "def to_s\n spoonerize.join(\" \")\n end", "def map_join(list, *opts, &block)\n options = opts.extract_options!\n if options[:nowrap]\n options[:surround] = [raw('<span style=\"white-space: nowrap;\">'), raw(''), raw('</span> ')]\n end\n separator = options[:separator] || opts[0] || raw(options[:surround] ? ',' : ', ')\n last_separator = options[:last_separator] || opts[1] || separator\n\n results = list.map &block\n case results.length\n when 0 then ''\n when 1 then results[0]\n else\n # Array#join doesn't support html_safe => concatenate with inject\n if options[:surround]\n s1,s2,s3 = options[:surround]\n s1 + results[0..-2].inject { |a,b| a.to_s + s2 + separator + s3 + s1 + b.to_s } +\n s2 + last_separator + s3 + results.last\n else\n results[0..-2].inject {|a,b| a.to_s + separator + b.to_s } + last_separator + results.last\n end\n end\n end", "def to_s\n to_a.join(',')\n end", "def to_s\n \"[ \" + collect { |e| e.to_s }.join(\", \") + \" ]\"\n end", "def array_to_string(arr)\n arr.map { |e| \"'#{sanitize(e)}'\" }.join(\",\")\n end", "def to_s\n \"(#{@values.map(&:to_s).join(', ')})\"\n end", "def to_s\n statements.collect { |s| s.to_s }.join(\";\\n\")\n end", "def to_s\n \"(#{[' ', '+'][value]})\"\n end", "def to_s\n to_a.join(SEPARATOR)\n end", "def to_s\n \"{#{map(&method(:format_value_or_null)).join(\",\")}}\"\n end", "def to_s(options = {})\n map { |o| o.to_s(options) }.join\n end", "def to_s\n\t\tstring = @nombre + \" ,Ingredientes: \"\n\t\t@lista.zip(@listagr).each do |normal, gr|\n string += normal.nombre + \" \" \n\t\t\tstring += gr.to_s + \" gr \"\n end\n\t\tstring\n\tend", "def to_s\n # \"%s <- %s (%0.01f%s, %0.01f)\" % [ consequent, \n # antecedent.join(\" \"), \n # support, \n # num_antecedent_transactions ? \"/#{num_antecedent_transactions}\" : \"\", confidence ]\n \"%s -> %s (%0.01f%s, %0.01f)\" % [ antecedent.join(\" \"),\n consequent, \n support, \n num_antecedent_transactions ? \"/#{num_antecedent_transactions}\" : \"\", confidence ]\n end", "def to_s\n @items.join( _separator )\n end", "def to_s\n \"#{@name}(#{@x.map(&:to_s).join(\", \")})\"\n end", "def frankenstring(strings)\n result = \"\"\n strings.each do |string|\n result += \"#{string},\"\n end\n result.chop\nend", "def to_s\n \"(#{@x.map(&:to_s).join(\" + \")})\"\n end", "def make_list(array)\n string = \"\"\n array.each_with_index do |item, index|\n index < array.length-1? c = \", \": c = \"\"\n formatted_item = \"#{index +1}. #{item}#{c}\"\n string = string.concat(formatted_item)\n end\n string\nend", "def type_list_str(glue = \"\\n\")\n str = glue\n @MapTypes.each { |el| str += el.to_s.sub(/#{@PREFIX}/, '') + glue }\n return str.sub(/#{glue}$/, '')\n end", "def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend", "def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend", "def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend", "def to_s\n self.join('')\n end", "def to_s\n self.join('')\n end", "def to_s\n self.to_a.map {|x| x.to_s}.join\n end", "def to_s\n self.to_a.map {|x| x.to_s}.join\n end", "def to_s\n 'RDF::List[' + join(', ') + ']'\n end", "def to_s\n printed_list = \"\"\n @list.each do |item, quantity|\n printed_list += \"#{quantity} #{item}\\n\"\n end\n return printed_list\n end", "def to_s\n\t\tself.to_a.map {|x| x.to_s}.join\n\tend", "def to_joined_str (item)\n if (item.class == Array) then\n item.join(\", \")\n else\n item.to_s\n end\nend", "def to_s\n element_string = '['\n @options.each { |option| element_string.concat(\"#{option.join(',')}|\") }\n element_string.chop.concat(']')\n end", "def to_s(symbols = {})\n self.inject(\"\") do |a, o|\n a << (a.empty? ? \"\" : self.class.format) << o.to_s(symbols)\n end\n end", "def to_s\n @string ||= STR_LEFT_BRACKET + self.to_a.compact.map {|prop| prop.to_s}.join(STR_SEPARATOR) + STR_RIGHT_BRACKET\n end", "def to_s\n multiple ? value.map(&:to_s).join(', ') : value.to_s\n end", "def grocery_list(list)\n string=\"\"\n list.each {|item, quantity| \n string=string + item.to_s + \":\" + quantity.to_s + \" \"\n }\n return string \nend", "def to_s\n str = \"<#{self.class}: [\"\n\n each_with_index do |v, i|\n str += v.to_s\n str += ', ' unless i == (count - 1)\n end\n\n str + ']>'\n end", "def comstr\n\t\tjoin(', ')\n\tend", "def simplify_tag_list(tag_list)\n tag_list&.delete_if { |t| t.empty? }&.join(\",\")\n end", "def odb_format_str(*args)\n \"format('#{to_s}', #{args.map{|x| quote(x)}.join(', ')})\"\n end", "def join_list(delim, list) { :'Fn::Join' => [ delim, list ] } end", "def to_s\n \"(\" + x.to_s + \",\" + y.to_s + \",\" + z.to_s + \")\"\n end", "def to_s\n\t\tstring = \"(\"\n\t\taux = @head\n\t\twhile(aux != nil) do\n\t\t\tstring += \"#{aux.to_s}\"\n\t\t\t@aux = @aux.next\n\t\tend\t\n\t\tstring += \")\"\n\t\treturn string\n\tend", "def to_s\n\t\t\"#{@label}:#{@items.map { |x| x.to_s }.join(' ')}\"\n\tend", "def display_coding_list(list)\n\t\tif list.empty?\n\t\t\tresult = \"None\"\n\t\telse\n\t\t\tresult = []\n\t\t\tlist.map(&:coding).each do |coding|\n\t\t\t\tresult << coding.map(&:display)\n\t\t\tend\n\n\t\t\tresult = result.join(', ')\n\t\tend\n\n\t\treturn sanitize(result)\n\tend", "def to_s\n join\n end", "def to_s\n components = {}\n for element in elements.select\n if components.key?(representative(element))\n if representative(element) != element\n components[representative(element)] << element\n end\n else\n if representative(element) != element\n components[representative(element)] = [element]\n else\n components[representative(element)] = []\n end\n end\n end\n result = \"\"\n for rep in components.keys\n result << components[rep].reduce(prepare_for_save(rep)){ |total, element| total + ',' + prepare_for_save(element) } + \";\"\n end\n return result.chomp(\";\")\n end", "def to_s\n \"#{tag} #{[@from.quoteize, @to.quoteize, @options].compact.flatten * \" \"}\"\n end", "def to_s\n buf = []\n each { |part| buf << part }\n buf.join\n end", "def human_list(list)\n case list.length\n when 0\n \"\"\n when 1\n list[0]\n when 2\n \"#{list[0]} and #{list[1]}\"\n else\n \"#{list[0...-1].join(', ')}, and #{list[-1]}\"\n end\nend", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{#{pairs.join(\", \")}}\"\n end", "def list_formatter(list)\n\tlist.each do |item, quanity|\n\t\tputs \"we need #{quanity} of #{item}\"\n\tend\nend", "def to_s\n output = ['Rule Warnings:']\n\n if @warnings.empty?\n output << ' * None'\n else\n output << %{ * #{@warnings.join(\"\\n *\")}}\n end\n\n output << ['']\n output << ['Rule Errors:']\n\n if @errors.empty?\n output << ' * None'\n else\n output << %{ * #{@errors.join(\"\\n *\")}}\n end\n\n output.join(\"\\n\")\n end", "def quote(value) # :doc:\n if value.respond_to? :each_pair\n return value.map do |k, v|\n \"#{k}: #{quote(v)}\"\n end.join(\", \")\n end\n return value.inspect unless value.is_a? String\n\n if value.include?(\"'\")\n value.inspect\n else\n \"'#{value}'\"\n end\n end", "def to_s\n\n # Compile a string for the cleric's orisons\n orisons = \"Orisons: \\n\"\n if @orisons.empty?\n orisons += \"None \\n\"\n else\n @orisons.each do |orison|\n orisons += \"#{orison.capitalize} \\n\"\n end\n end\n\n # Compile a string for the cleric's spells\n spells = \"Level 1 Spells: \\n\"\n if @spells.empty?\n spells += \"None \\n\"\n else\n @spells.each do |spell|\n spells += \"#{spell.capitalize} \\n\"\n end\n end\n\n partialString = super\n\n fullString = \"#{partialString}#{orisons}\\n#{spells}\"\n\n return fullString\n\n end", "def display_delimited_string(object_list, method_name = 'name', delimiter = ',')\n delimited_string = ''\n object_list.each do |oa|\n if object_list.last.send(method_name) == oa.send(method_name)\n delimited_string += \"#{oa.send(method_name).titleize}\"\n else\n delimited_string += \"#{oa.send(method_name).titleize}#{delimiter} \"\n end\n end \n return delimited_string\n end", "def to_s\n return super unless elements\n elements.map(&:to_s).join(\" \")\n end", "def to_s\n '{ ' + @values.map {|(n, v)| \"#{n}: #{v.inspect}\"}.join(', ') + ' }'\n end", "def format(arr, opts={})\n # if seperator is an array, it is using different seperators for inner arrays\n seperator = opts[:seperator] || ' '\n #indicates if it should return nil if one of arr's elements is nil\n ignore = opts.has_key?(:ignore) ? opts[:ignore] : false\n format = opts[:format] || '%s'\n\n # determine if there empty elements in the array\n def has_empty?(a)\n if a.instance_of? Array\n ret = false\n a.each { |x| ret = true if has_empty?(x) }\n ret\n else\n not a or a.empty?\n end\n end\n includes_empty = has_empty? arr\n\n # arrays to string using the seperators\n seperator = [seperator] if not seperator.kind_of? Array\n def visit(ar, lvl, seperator)\n sep = seperator[lvl]\n sep = seperator.first if not sep\n s = ar.map do |element|\n if element.kind_of? Array\n visit(element, lvl + 1, seperator)\n else\n element\n end\n end\n s.reject! { |x| not x or x.empty? } # remove empty/nil elements\n s.join(sep) \n end\n str = visit(arr, 0, seperator)\n\n if includes_empty and ignore\n nil\n else\n format % [str]\n end\n end", "def run_list(list, componentrole, component)\n list.join(',') + (componentrole ? ',' + componentrole.gsub('#', component) : '')\n end", "def code_list(list)\n\t\tlist.map{ |element| element.code }.join(', ')\n\tend", "def code_list(list)\n\t\tlist.map{ |element| element.code }.join(', ')\n\tend", "def to_s\n require \"shellwords\"\n\n escaped_args = @args.map do |arg|\n escaped = Shellwords.escape(arg)\n next escaped if escaped == arg\n next escaped if arg.include?(\"'\")\n \"'#{arg}'\"\n end\n escaped_args.join(\" \")\n end", "def ids_to_s(many_ids, id_sep = CompositePrimaryKeys::ID_SEP, list_sep = ',', left_bracket = '(', right_bracket = ')')\r\n many_ids.map {|ids| \"#{left_bracket}#{ids}#{right_bracket}\"}.join(list_sep)\r\n end", "def to_s\n [line1, line2, \"#{city}, #{state} #{zip}\"].compact.join(\", \")\n end", "def human_string(array)\n length = array.length\n \n new_string = array[0...-1].join(\", \")\n new_string << \" and #{array[-1]}\"\n \n return new_string\nend", "def to_s\n \"(#{ x }, #{ y })\"\n end", "def ids_to_s(many_ids, id_sep = CompositePrimaryKeys::ID_SEP, list_sep = ',', left_bracket = '(', right_bracket = ')')\n many_ids.map {|ids| \"#{left_bracket}#{CompositePrimaryKeys::CompositeKeys.new(ids)}#{right_bracket}\"}.join(list_sep)\n end", "def comment_list(list, base_indent='')\n commented_list = \"\"\n ids = list.split(/,/)\n ids.each do |id|\n id.gsub!(/\\s*$/, '')\n id.gsub!(/^\\s*/, '')\n list_id = \"#{id}\"\n list_id += ',' if id != ids.last\n id.gsub!(/\\=.*$/, '') \n id.gsub!(/\\[.*\\]/, '') \n id.gsub!(/\\s*$/, '')\n id.gsub!(/^\\s*/, '') \n id.gsub!(/;/, '') \n id.gsub!(/\\s*\\:\\s*\\d+/,'') \n doc_id = id.split(/\\s/).last\n doc_id.gsub!(/\\*/, '') \n commented_list += \"#{base_indent}\" if id != ids.first \n commented_list += \"#{@indent}\\t#{list_id} /**< <##{doc_id} description#> */\"\n commented_list += \"\\n\" if id != ids.last \n end\n commented_list \n end", "def to_s type = nil\n @items.join( get_separator( type ) )\n end", "def format_value_to_list(value, is_const)\n result = value.map do |element|\n format_value(element, is_const)\n end.join(', ')\n\n \"[#{result}]\"\n end", "def to_s\n @out.join\n end", "def to_s\n self.map{|x| \"[\" + x.sort{|x, y| x.ord <=> y.ord}.join(', ') + \"]\"}.join(', ')\n end", "def to_s\n \"(#{@x.map(&:to_s).join(\" * \")})\"\n end", "def to_s\n \"(#{@op.to_s} #{@first.to_s} #{@second.to_s})\"\n end", "def to_s\n join(\" \")\n end", "def to_s\n self.join\n end", "def to_s\n [left, right].uniq.join(\" #{messages[:or]} \")\n end", "def to_s\n\t\tif @toys.empty? == false\n\t\t\"#{@name} is a #{@age} year old #{@gender} #{@species} that loves #{@toys.join(\", \")}\".rstrip\n\t\telse\n\t\t\"#{@name} is a #{@age} year old #{@gender} #{@species}\"\n\t\tend\n\tend", "def to_phrase(items)\n *items, last_item = items\n return last_item if items.empty?\n\n items.join(', ') + ', and ' + last_item\n end", "def to_s\n @out.join\n end", "def to_s\n return if empty?\n result = []\n each do |item|\n result << item\n end\n result.join(\"\\n\")\n end", "def to_s\n return \"#{self.names.join('|')}\"\n end", "def to_s\n \"#{@name} has the following hobbies: #{@hobbies * \", \"}\" # yep, ruby is pretty cool: interpolate the array and then join via *\n end" ]
[ "0.62634116", "0.59690505", "0.59026366", "0.5868843", "0.58570594", "0.56341285", "0.5612332", "0.5567862", "0.55377406", "0.553639", "0.5528089", "0.55161923", "0.5475692", "0.5423438", "0.5410157", "0.5407309", "0.53934014", "0.53701013", "0.5269722", "0.5250278", "0.5232559", "0.52275884", "0.52170324", "0.52158886", "0.5131676", "0.512406", "0.5116582", "0.5112202", "0.5101815", "0.5097755", "0.50919545", "0.5082987", "0.5071696", "0.50568277", "0.5045885", "0.50429416", "0.50414157", "0.50414157", "0.50414157", "0.5031514", "0.5031514", "0.5026848", "0.5026848", "0.5026506", "0.5020007", "0.5009626", "0.5009208", "0.5006638", "0.4997367", "0.49972978", "0.49750552", "0.49734548", "0.49705607", "0.49677932", "0.49641007", "0.49527186", "0.4922586", "0.49179348", "0.49153003", "0.49000457", "0.48996338", "0.48876163", "0.48757425", "0.48716286", "0.48714644", "0.4869155", "0.48612258", "0.48598117", "0.48532683", "0.48527437", "0.48509172", "0.48472345", "0.4836184", "0.48360628", "0.4832135", "0.4828962", "0.48268223", "0.48268223", "0.48177427", "0.481479", "0.48144862", "0.48090246", "0.47977272", "0.47948867", "0.4794368", "0.47942156", "0.4793481", "0.4792597", "0.47912896", "0.4783899", "0.4781988", "0.4781409", "0.4776625", "0.47729182", "0.4768806", "0.47681138", "0.47661132", "0.476207", "0.4760118", "0.47487053" ]
0.7489193
0
Remove whitespace, duplicates, and blanks.
def clean! reject!(&:blank?) map!(&:strip) uniq! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean!\r\n reject!(&:blank?)\r\n map!(&:strip)\r\n uniq!\r\n end", "def strip\n lambda do |rec, acc|\n acc.collect! do |v|\n # unicode whitespace class aware\n v.sub(/\\A[[:space:]]+/,'').sub(/[[:space:]]+\\Z/, '')\n end\n end\n end", "def trim_whitespace; end", "def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend", "def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend", "def dewhitespace\n gsub(/\\s+/,' ').strip\n end", "def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend", "def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend", "def tighten\n gsub(/[\\t ]+/,' ').strip\n end", "def strip_naked\n return self if blank?\n self.downcase.strip.gsub(/([\\s]{2,})/, ' ')\n end", "def space_out\n gsub(/(.)/, ' \\1')\n end", "def trim\n self.gsub(/^\\s+/,'').gsub(/\\s+$/,'')\n end", "def trim_all_whitespace(text)\n text.to_a.map do |line|\n left_spacing(line) + line.squeeze(\" \").squeeze(\" \").lstrip #the 2. is a tab\n end.join\n end", "def compact_whitespace s\n s.gsub(/\\s+/, ' ').gsub(/>\\s</, '><').strip\n end", "def evaporate\n self.gsub(/\\s/, '')\n end", "def clean( input )\n input.gsub( %r/\\s+/, '' )\n end", "def kill_leading_whitespace!(s)\n if s.is_a?(Array)\n s.map{|i| kill_leading_whitespace!(i)}\n else\n s.gsub!(/^ */,\"\").chomp\n s.gsub!(/\\A\\n/,\"\")\n s.gsub!(/\\n\\z/,\"\")\n s\n end\n end", "def kill_leading_whitespace!(s)\n if s.is_a?(Array)\n s.map{|i| kill_leading_whitespace!(i)}\n else\n s.gsub!(/^ */,\"\").chomp\n s.gsub!(/\\A\\n/,\"\")\n s.gsub!(/\\n\\z/,\"\")\n s\n end\n end", "def normalize_whitespace(input); end", "def pre_proccess(text)\n text.to_s.strip.gsub(/[[:space:]]+/, ' ').gsub(/\\s{2,}/, ' ')\n end", "def trimmed_whitespace(text)\n text.gsub(/[\\t\\n\\f\\r ]+/ium, ' ')\n end", "def cleanup(str)\n output = [] \n no_go = false\n str = str.gsub(/[^A-Za-z0-9 ]/, ' ').split(\"\")\n str.each_index do |i|\n if str[i]==\" \"\n output.push(str[i]) unless no_go == true\n no_go = true\n else\n output.push(str[i]) \n no_go = false\n end\n end\n output.join\nend", "def normalize_whitespace(text)\n text.to_s.gsub(/[[:space:]]+/, ' ').strip\n end", "def normalize_whitespace(input)\n input.to_s.gsub(%r!\\s+!, \" \").tap(&:strip!)\n end", "def clean_white_space\n @content.gsub!(/\\n{2,}/, \"\\n\")\n write_content_to_file\n end", "def strip_whitespace!\n replace(self.strip_whitespace)\n end", "def squish!\n gsub!(/\\A[[:space:]]+/, '')\n gsub!(/[[:space:]]+\\z/, '')\n gsub!(/[[:space:]]+/, ' ')\n self\n end", "def squish!\n gsub!(/\\A[[:space:]]+/, '')\n gsub!(/[[:space:]]+\\z/, '')\n gsub!(/[[:space:]]+/, ' ')\n self\n end", "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "def clean t\n # line feed should be removed also\n !t ? '' : t.gsub(\"\\n\",' ').gsub(\"\\t\",' ').strip.gsub(/\\s\\s+/,' ')\nend", "def remove_whitespace\n # NOTE: According to the docs, \\s only matches [ \\t\\r\\n\\f], i.e. it does not\n # match e.g. non-breaking space (&nbsp). The POSIX character class\n # [[:space:]] does match non-breaking space. This is relevant because\n # in Heroku, space in ENV variables might be translated as &nbsp.\n # DOC: http://ruby-doc.org/core-2.5.1/Regexp.html#class-Regexp-label-Character+Classes\n # SOURCE: http://stackoverflow.com/a/13288542\n gsub(/[[:space:]]/, '')\n end", "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "def strip(s)\n s.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end", "def strip_space!\n replace self.gsub(/:\\s*/, \":\").gsub(/\\n/, \"\").gsub(/\\s+/, \" \").gsub(/(\\/\\*).*?(\\*\\/)/, \"\")\n end", "def remove_whitespace(dirty_name)\n \n return dirty_name.split(' ').join(\" \") \n \n end", "def squish\n self.gsub(/[\\n\\t]/, '').squeeze(' ').strip\n end", "def without_garbage\n reg = Regexp.new /[#{String.characters.join}]+/\n self.scan(reg).join(\"\").gsub(\"\\n\", \" \").gsub(\"|\", \" \").gsub(\"-\", \" \")\n end", "def normalize_whitespace!\n @raw.gsub!(/\\s+/, ' ')\n end", "def strip_blanks\n self.title = self.title.strip\n self.code = self.code.strip\n self.complement_title = self.complement_title.strip\n end", "def clean_up_spaces(string)\n string.gsub(\"\\n\", ' ').gsub(/[[:space:]]+/, ' ').strip if string.is_a? String\n end", "def compress\n unicode_nbsp = ' '\n result = gsub(unicode_nbsp, ' ')\n stripped_result = result.split(\"\\n\").map(&:strip).join(\"\\n\")\n stripped_result.gsub(\"\\n\", ' ').gsub(/[ \\t]{2,}/, ' ')\n end", "def whitespace\n @input = @input.gsub(/\\ +/, ' ').strip\n end", "def no_space(x)\n x.gsub(\" \", \"\")\nend", "def strip_all_spaces(text)\n text&&text.gsub(/&nbsp;|\\xC2\\xA0|\\xA0/, ' ').strip\n end", "def clean_up()\n @lines.each { |line| line.delete!(' ') }\n @lines.delete_if { |line| line.start_with?(\"//\") }\n @lines.each { | line| line.chomp! }\n @lines.delete_if { |line| line.empty? }\n @lines = @lines.map { |line| line.split(\"//\")[0] }\n end", "def cleanup(input)\n input.gsub(/[^a-zA-Z]/, ' ').squeeze(' ')\nend", "def strip_text_unique(passage)\n strip_text(passage).uniq#unique\nend", "def squish!\n gsub!(/[[:space:]]+/, \" \")\n strip!\n self\n end", "def sans_whitespace_and_commas\n @str.gsub(' ', '').gsub(',', '')\n end", "def cleanup str\n str2 = str.gsub(/[^A-Za-z]/, ' ')\n str3 = str2.gsub(/[ ]{2,}/, ' ')\nend", "def cleanup(results)\n results.map { |r| r.value.strip }.reject(&:empty?).uniq\n end", "def cleanup(results)\n results.map { |r| r.value.strip }.reject(&:empty?).uniq\n end", "def remove_leading_and_trailing_whitespace(text)\n pre_blocks = text.split(DO_NOT_TOUCH_WHITESPACE)\n\n output = []\n pre_blocks.each.with_index do |block, index|\n if index % 2 == 0\n output << block.gsub(/[ \\t]*\\n[ \\t]*/im, \"\\n\").gsub(/ *\\t */im, \"\\t\")\n else\n output << block\n end\n end\n\n output.join\n end", "def strip_blanks\n self.title = self.title.strip\n self.code = self.code.strip\n end", "def squash(text)\n return text.scrub.gsub(/[[:space:]]+/, ' ').strip\nend", "def removeWhitespace(a)\n\toutString = \"\"\n\ta.split(\"\").each do |i|\n\t\toutString += i unless i == \" \"\n\tend\n\treturn outString\nend", "def remove_duplicate_words(s)\n s.split(' ').uniq.join(' ')\nend", "def cleanup(txt)\n txt.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend", "def cleanup(str)\n str.gsub!(/[^0-9a-z ]/i, ' ')\n str.gsub!(/\\s+/, ' ')\nend", "def unique_spaces!\n self.gsub!(ANY_SPACE_PATTERN, UNIQUE_SPACE)\n end", "def remove_whitespace\n self.first_name = self.first_name.strip\n self.last_name = self.last_name.strip\n self.biography = self.biography.strip\n end", "def normalize_whitespace(line)\n line.gsub(/\\s+/, ' ')\n end", "def no_auto_trim!; end", "def auto_trim!; end", "def strip_side_space!\n replace self.gsub(/^\\s+/, \"\").gsub(/\\s+$/, $/)\n end", "def strip_whitespace\n self.tags = tags.gsub(/\\s+/, '')\n # self.tags = tags.strip\n self.title = title.strip\n self.description = description.strip\n # self.keywords = keywords.strip\n self.body = body.strip\n end", "def keep_whitespace\n @keep_whitespace = true\n end", "def cleanup_noreg(string)\n blocks = string.split\n result = blocks.map do |word|\n word = word.chars.map! do |char|\n if char.downcase == char.downcase.upcase\n ' '\n else \n char\n end\n end\n word = word.join\n # p word\n #p word.squeeze(\" \")\n #word.squeeze(\" \")\n # take note that here +*& is a block or word, and gets replaced by a space without\n # any contiguous letter chars\n # so after join on line 48, there are 3 spaces between my and line, without the squeeze call\n word\n end\n result = result.join(' ').squeeze(' ')#.squeeze\nend", "def no_space(x)\n # code go here\n x.gsub(' ', '')\nend", "def drop_blanks!\n\t\tdelete_if{|a|a.blank?}\n\tend", "def remove_whitespace\n self.name = self.name.strip\n self.phone = self.phone.strip\n end", "def rstrip!\n erase! @result.length - 1 - (@result.rindex(/[^\\s]/) || -1)\n end", "def cleanup_nokogiri_values(results)\n results.map { |a| a.value.strip }.reject { |s| s.empty? }.uniq\n end", "def cleanup_nokogiri_values(results)\n results.map { |a| a.value.strip }.reject { |s| s.empty? }.uniq\n end", "def trimming_for_diff_text(code)\n # gsub(/^\\s*$/, '') means remove empty lines\n code.strip.gsub(/^\\s*$/, '')\n end", "def remove_trailing_spaces(source)\n for_outstrings_of(source) do |str|\n str.gsub! /\\s+/im, ' '\n str.gsub! /\\s*(=|\\+|\\-|<|>|\\?|\\|\\||&&|\\!|\\{|\\}|,|\\)|\\(|;|\\]|\\[|:|\\*|\\/)\\s*/im, '\\1'\n str.gsub! /;(\\]|\\)|\\}|\\.|\\?|:)/, '\\1' # removing wrong added semicolons\n str.gsub /([^\\d\\w_\\$]typeof)\\s+([\\w\\d\\$_]+)/, '\\1(\\2)'\n end\n end", "def condense_spaces(str)\n str.gsub(/\\s+/, \" \")\n end", "def remove_whitespace\n self.title = self.title.strip\n self.description = self.description.strip\n end", "def remove_adjacent_whitespace!(chunks)\n (chunks.size - 1).downto(1).each do |i|\n chunk = chunks[i]\n previous_chunk = chunks[i-1]\n chunks.delete_at(i) if chunk == ' ' && previous_chunk.end_with?(' ')\n end\n end", "def strip_leading_whitespace(text)\n return text if text.empty?\n leading_spaces = text.lines.first[/^(\\s+)/, 1]\n text.gsub(/^#{leading_spaces}/, '')\n end", "def remove_empty_lines(source)\n for_outstrings_of(source) do |str|\n str.gsub /\\n\\s*\\n/m, \"\\n\"\n end\n end", "def cleanup(string)\n string = string.gsub(/[^a-z]/i, ' ')\n until !string.include?(' ')\n string.gsub!(' ', ' ')\n end\n string\nend", "def clean(str)\n return nil unless str\n str.gsub(/\\p{Space}/, ' ').strip.squeeze(' ')\n end", "def remove_blank_lines(text)\n text.split(\"\\n\").reject { |l| l.strip == '' }.join(\"\\n\") + \"\\n\"\n end", "def reduce_no_whitespace(_production, _range, _tokens, _children)\n char_shorthand('S')\n end", "def compact_blank; end", "def clean text\n text.gsub(/(\\n|\\t|\\r)/, ' ').gsub(/>\\s*</, '><').squeeze(' ')\n end", "def trim_whitespace=(_arg0); end", "def strip() end", "def cleanup_noregexp str\n str2 = ''\n str.chars.each do |chr|\n case chr.downcase\n when ('a'..'z')\n str2 << chr\n else\n str2 << ' '\n end\n end\n str2.squeeze(' ')\nend", "def rstrip() end", "def cleanup(str)\r\n str.gsub!(/[^a-z]/, ' ').squeeze(' ')\r\nend", "def clean_array(ary)\n ary.compact.map(&:strip).reject(&:blank?).uniq\n end", "def strip_blanks!\n @content.reject! { |item| item[:type] == :blank }\n end", "def squish!\n strip!\n gsub!(/\\s+/, ' ')\n self\n end", "def normalize_source(source)\n source.chop.gsub(/\\s*\\n\\s*/, ' ')\n end", "def cleanup(string)\n string.gsub(/[^a-z0-9]/, \" \").gsub(/\\s+/, \" \")\n # string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend", "def unorphan(input)\n input.sub(/\\s+(\\S+)\\s*$/, '&nbsp;\\1')\n end", "def clean_whitespace(app)\n git_clean_filesystem\n\n # normalize_whitespace has already cleaned up whitespace if buildr_plus present\n unless File.exist?('vendor/tools/buildr_plus')\n extensions = %w(jsp sass scss xsl sql haml less rake xml html gemspec properties yml yaml css rb java xhtml rdoc txt erb gitattributes gitignore xsd textile md wsdl)\n full_filenames = %w(rakefile Rakefile buildfile Buildfile Gemfile LICENSE)\n\n files_to_dedupe_nl = Dir['etc/checkstyle/*.xml'].flatten + Dir['tasks/*.rake'].flatten + Dir['doc/*.md'].flatten + Dir['*.md'].flatten + Dir['config/*.sh'].flatten + %w(buildfile Gemfile README.md)\n\n files = full_filenames.collect {|file| Dir[\"**/#{file}\"]}.flatten + extensions.collect {|extension| Dir[\"**/*.#{extension}\"] + Dir[\"**/.#{extension}\"]}.flatten\n\n files.each do |f|\n next if /^vendor\\/.*/ =~ f\n next if /^node_modules\\/.*/ =~ f\n\n content = File.read(f)\n original_content = content.dup\n begin\n puts \"Fixing DOS EOL: #{f}\" if content.gsub!(/\\r\\n/, \"\\n\")\n puts \"Fixing Trailing whitespace: #{f}\" if content.gsub!(/[ \\t]+\\n/, \"\\n\")\n puts \"Fixing Double lines: #{f}\" if content.gsub!(/\\n\\n\\n/, \"\\n\\n\") if files_to_dedupe_nl.include?(f)\n content.gsub!(/[ \\r\\t\\n]+\\Z/, '')\n content += \"\\n\"\n rescue\n puts \"Skipping whitespace cleanup: #{f}\"\n end\n if content != original_content\n puts \"Fixing: #{f}\"\n File.open(f, 'wb') do |out|\n out.write content\n end\n end\n end\n end\n\n git_reset_index\n git_add_all_files\n if git_commit('Cleanup whitespace at EOL and EOF.', false)\n puts \"Whitespace cleaned up in #{app}\"\n end\n end", "def cleanup(str)\n str.gsub(/([^a-z])/, ' ').squeeze(' ')\nend" ]
[ "0.7524463", "0.7369265", "0.72860473", "0.7224176", "0.7224176", "0.71872914", "0.71574855", "0.71574855", "0.71334136", "0.71145606", "0.7099433", "0.7046403", "0.7019657", "0.69951665", "0.69925207", "0.6948776", "0.6926586", "0.6926586", "0.69107604", "0.689238", "0.68513733", "0.6848693", "0.6839098", "0.6784984", "0.6722477", "0.6706643", "0.6704275", "0.6704275", "0.67027026", "0.67010254", "0.6685272", "0.66719335", "0.6654629", "0.6643075", "0.66398466", "0.6632715", "0.6628002", "0.6619609", "0.66190994", "0.6600448", "0.6599716", "0.658285", "0.65717435", "0.65701777", "0.65659124", "0.65650046", "0.656073", "0.6545503", "0.65303", "0.65230894", "0.6520158", "0.6520158", "0.65191805", "0.6512866", "0.6502348", "0.64940476", "0.64892256", "0.64785224", "0.646806", "0.6459301", "0.6444169", "0.64399993", "0.6435353", "0.6429404", "0.64241225", "0.6421634", "0.64205", "0.64091766", "0.64013237", "0.6387529", "0.63854957", "0.6385452", "0.6373525", "0.6373525", "0.63659835", "0.6362915", "0.63491315", "0.6347587", "0.63466936", "0.6329302", "0.63256305", "0.63098824", "0.6308639", "0.62958777", "0.6294571", "0.62883943", "0.62849027", "0.6272984", "0.6270605", "0.62484854", "0.62462896", "0.62438655", "0.6241491", "0.6238238", "0.62362975", "0.6228548", "0.6227233", "0.6221754", "0.6219563", "0.62162375" ]
0.7433913
1
Configure how to run remote SSH commmands on server.
def config_ssh(username, host, options = nil) @ssh = SSH.new(username, host, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_serverspec(node)\n set :backend, :ssh\n host = node.ssh_info[:host].to_s\n options = Net::SSH::Config.for(host)\n options[:user] = node.ssh_info[:username].to_s\n options[:keys] = node.ssh_info[:private_key_path][0].to_s\n options[:port] = node.ssh_info[:port].to_s\n\n set :host, host\n set :ssh_options, options\n end", "def configuration_for(host, use_ssh_config); end", "def exec(opts={})\n # Get the SSH information and cache it here\n ssh_info = info\n\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],\n :port => ssh_info[:port],\n :username => ssh_info[:username],\n :key_path => ssh_info[:private_key_path]\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n # If plain mode is enabled then we don't do any authentication (we don't\n # set a user or an identity file)\n plain_mode = opts[:plain_mode]\n\n options = {}\n options[:host] = ssh_info[:host]\n options[:port] = ssh_info[:port]\n options[:username] = ssh_info[:username]\n options[:private_key_path] = ssh_info[:private_key_path]\n\n # Command line options\n command_options = [\"-p\", options[:port].to_s, \"-o\", \"UserKnownHostsFile=/dev/null\",\n \"-o\", \"StrictHostKeyChecking=no\", \"-o\", \"LogLevel=FATAL\", \"-p\", options[:password].to_s]\n\n # Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option\n # (Also don't use it in plain mode, it'll skip user agents.)\n command_options += [\"-o\", \"IdentitiesOnly=yes\"] if !(Util::Platform.solaris? || plain_mode)\n\n command_options += [\"-i\", options[:private_key_path]] if !plain_mode\n command_options += [\"-o\", \"ForwardAgent=yes\"] if ssh_info[:forward_agent]\n\n # If there are extra options, then we append those\n command_options.concat(opts[:extra_args]) if opts[:extra_args]\n\n if ssh_info[:forward_x11]\n # Both are required so that no warnings are shown regarding X11\n command_options += [\"-o\", \"ForwardX11=yes\"]\n command_options += [\"-o\", \"ForwardX11Trusted=yes\"]\n end\n\n host_string = options[:host]\n host_string = \"#{options[:username]}@#{host_string}\" if !plain_mode\n command_options << host_string\n @logger.info(\"Invoking SSH: #{command_options.inspect}\")\n safe_exec(\"ssh\", *command_options)\n end", "def ssh_command\n args = domain!\n args = \"#{user}@#{args}\" if user?\n args << \" -i #{identity_file}\" if identity_file?\n args << \" -p #{ssh_port}\" if ssh_port?\n args << \" -t\"\n \"ssh #{args}\"\n end", "def configure_ssh(vm)\n vm.provision \"shell\", inline: <<-SHELL\n mkdir -p /home/vagrant/.ssh\n rm -rf /home/vagrant/.ssh/id_rsa*\n chown vagrant:vagrant /home/vagrant/.ssh\n SHELL\n vm.provision \"file\", source: '~/.ssh/id_rsa', destination: '~/.ssh/id_rsa'\n vm.provision \"file\", source: '~/.ssh/id_rsa.pub', destination: '~/.ssh/id_rsa.pub'\n vm.provision \"file\", source: '~/.ssh/id_rsa.pub', destination: '~/.ssh/authorized_keys'\n vm.provision \"file\", source: '~/.screenrc', destination: '~/' if File.exists? \"~/.screnrc\"\nend", "def initialize_ssh; end", "def run!\n ssh commands(:default)\n end", "def ssh\n platform_service(:ssh)\n end", "def ssh!(hostspec, script)\n CommandRunner.instance.ssh! hostspec, script\n end", "def ssh_common_opts\n [\"-i #{@machine.ssh_info[:private_key_path]}\",\n \"-p #{@machine.ssh_info[:port]}\",\n \"-o StrictHostKeyChecking=no\",\n \"-o UserKnownHostsFile=/dev/null\",\n \"-o IdentitiesOnly=yes\",\n \"-o LogLevel=ERROR\"]\n end", "def ssh\n @ssh ||= Net::SSH.start(self, self['user'] || \"root\" , self['ssh'])\n end", "def runner_options_for_ssh(config_data)\n kitchen = instance.transport.send(:connection_options, config_data).dup\n\n opts = {\n 'backend' => 'ssh',\n 'logger' => logger,\n # pass-in sudo config from kitchen verifier\n 'sudo' => config[:sudo],\n 'host' => kitchen[:hostname],\n 'port' => kitchen[:port],\n 'user' => kitchen[:username],\n 'keepalive' => kitchen[:keepalive],\n 'keepalive_interval' => kitchen[:keepalive_interval],\n 'connection_timeout' => kitchen[:timeout],\n 'connection_retries' => kitchen[:connection_retries],\n 'connection_retry_sleep' => kitchen[:connection_retry_sleep],\n 'max_wait_until_ready' => kitchen[:max_wait_until_ready],\n 'compression' => kitchen[:compression],\n 'compression_level' => kitchen[:compression_level],\n }\n opts['key_files'] = kitchen[:keys] unless kitchen[:keys].nil?\n opts['password'] = kitchen[:password] unless kitchen[:password].nil?\n\n opts\n end", "def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end", "def update_ssh(nodes, version)\n fqdns = nodes.map { |node| node.fqdn }.join(' ')\n\n ssh = Chef::Knife::Ssh.new\n ssh.ui = ui\n ssh.name_args = [ fqdns, ssh_command(version) ]\n ssh.config[:manual] = true\n ssh.config[:on_error] = :skip\n ssh.config[:ssh_user] = Chef::Config[:knife][:ssh_user] || config[:ssh_user]\n ssh.config[:ssh_password] = config[:ssh_password]\n ssh.config[:ssh_port] = Chef::Config[:knife][:ssh_port] || config[:ssh_port]\n ssh.config[:ssh_gateway] = Chef::Config[:knife][:ssh_gateway] || config[:ssh_gateway]\n ssh.config[:identity_file] = Chef::Config[:knife][:identity_file] || config[:identity_file]\n ssh.config[:host_key_verify] = Chef::Config[:knife][:host_key_verify] || config[:host_key_verify]\n ssh\n end", "def ssh\n @ssh ||= @remote.connect\n @remote\n end", "def configure_server_ssh_key(machine)\n exit_code = SUCCESS_RESULT\n options = Net::SSH.configuration_for(machine['network'], true)\n options[:auth_methods] = %w[publickey none]\n options[:verify_host_key] = false\n options[:keys] = [machine['keyfile']]\n begin\n Net::SSH.start(machine['network'], machine['whoami'], options) do |ssh|\n add_key(ssh)\n end\n rescue StandardError\n @ui.error(\"Could not initiate connection to the node '#{machine['name']}'\")\n exit_code = ERROR_RESULT\n end\n exit_code\n end", "def ssh_into(instance=nil)\n Kernel.system \"#{ssh_command(instance)}\" if instance\n end", "def ssh_command(ssh_info)\n command_options = %W[\n -o Compression=yes\n -o DSAAuthentication=yes\n -o LogLevel=#{ssh_info[:log_level] || 'FATAL'}\n -o StrictHostKeyChecking=no\n -o UserKnownHostsFile=/dev/null\n ]\n\n if ssh_info[:forward_x11]\n command_options += %w[\n -o ForwardX11=yes\n -o ForwardX11Trusted=yes\n ]\n end\n\n if ssh_info[:forward_agent]\n command_options += %w[-o ForwardAgent=yes]\n end\n\n ssh_info[:private_key_path].each do |path|\n command_options += ['-i', path]\n end\n\n if ssh_info[:port]\n command_options += ['-p', ssh_info[:port]]\n end\n\n \"ssh #{command_options.join(' ')}\"\n end", "def ssh( commands=[], extra_ssh_ops={})\n commands = commands.compact.join(' && ') if commands.is_a?(Array)\n cmd_string = \"ssh #{user}@#{host} #{ssh_options(extra_ssh_ops)} \"\n if commands.empty?\n #TODO: replace this with a IO.popen call with read_nonblocking to show progress, and accept input\n Kernel.system(cmd_string)\n else\n system_run(cmd_string+\"'#{commands}'\")\n end\n end", "def ssh_cmd(destination_host, cmd)\n\n if strict_host_checking\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n else\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n '-o', 'UserKnownHostsFile=/dev/null',\n '-o', 'StrictHostKeyChecking=no',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n end\n end", "def options\n override_options = {\n :auth_methods => auth_methods,\n :logger => @logger,\n :port => @port,\n }\n override_options[:keys] = [@key_file] if @key_file\n override_options[:user_known_hosts_file] = '/dev/null' if @ignore_known_hosts\n override_options[:password] = @password if @password\n Net::SSH.configuration_for(@host).merge(override_options)\n end", "def configure_ssh(vm)\n vm.provision \"shell\", inline: <<-SHELL\n mkdir -p /home/vagrant/.ssh\n rm -rf /home/vagrant/.ssh/id_rsa*\n chown vagrant:vagrant /home/vagrant/.ssh\n SHELL\n vm.provision \"file\", source: '~/.ssh/id_rsa', destination: '~/.ssh/id_rsa'\n vm.provision \"file\", source: '~/.ssh/id_rsa.pub', destination: '~/.ssh/id_rsa.pub'\nend", "def start_ssh(&session)\n config = self.class.ssh_config\n Net::SSH.start( config[:host],\n config[:user],\n config.fetch(:options, { }),\n &session )\n end", "def remote\n log_and_exit read_template('help') if options.empty?\n \n # Attempts to run the specified command\n run_remote_command(options[0])\n end", "def connect(opts={})\n if Mario::Platform.windows?\n raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,\n :ssh_port => port(opts)\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n options = {}\n options[:port] = port(opts)\n [:host, :username, :private_key_path].each do |param|\n options[param] = opts[param] || env.config.ssh.send(param)\n end\n\n check_key_permissions(options[:private_key_path])\n\n # Command line options\n command_options = [\"-p #{options[:port]}\", \"-o UserKnownHostsFile=/dev/null\",\n \"-o StrictHostKeyChecking=no\", \"-o IdentitiesOnly=yes\",\n \"-i #{options[:private_key_path]}\"]\n command_options << \"-o ForwardAgent=yes\" if env.config.ssh.forward_agent\n\n if env.config.ssh.forward_x11\n # Both are required so that no warnings are shown regarding X11\n command_options << \"-o ForwardX11=yes\"\n command_options << \"-o ForwardX11Trusted=yes\"\n end\n\n # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails\n # (GH-51). As a workaround, we fork and wait. On all other platforms,\n # we simply exec.\n pid = nil\n pid = fork if Util::Platform.leopard? || Util::Platform.tiger?\n Kernel.exec \"ssh #{command_options.join(\" \")} #{options[:username]}@#{options[:host]}\".strip if pid.nil?\n Process.wait(pid) if pid\n end", "def ssh_command(port = 22)\n ssh = find_program_on_path('ssh')\n args = ENV['VANAGON_SSH_KEY'] ? \" -i #{ENV['VANAGON_SSH_KEY']}\" : \"\"\n args << \" -p #{port} \"\n args << \" -o UserKnownHostsFile=/dev/null\"\n args << \" -o StrictHostKeyChecking=no\"\n args << \" -o ForwardAgent=yes\" if ENV['VANAGON_SSH_AGENT']\n return ssh + args\n end", "def open_ssh(id=@connection.servers.first)\n command = ssh_cli_string(id)\n exec(command)\n end", "def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end", "def ssh(*ssh_args)\n args = ['ssh',\n '-o', 'BatchMode=yes',\n '-o', 'ConnectionAttempts=5',\n '-o', 'ConnectTimeout=30',\n '-o', 'ServerAliveInterval=60',\n '-o', 'TCPKeepAlive=yes',\n '-x', '-a',\n '-i', @ssh_key,\n '-l', @destination_user,\n @destination_host\n ] +\n ssh_args.map { |a| a ? a : '' }\n\n puts args.join(\" \" ) if @verbose\n system(*args)\nend", "def run_ssh(options, command)\n return false, '' if options[:user].nil?\n return false, '' if options[:server].nil?\n return false, '' if options[:user].empty?\n return false, '' if options[:server].empty?\n return false, '' if options[:user].match(/^deny/)\n return false, '' if options[:server].match(/^deny/)\n\n if options[:user].match(/^allow/) and options[:server].match(/^allow/)\n success, output = run_external(command, options, SETTINGS[:project])\n return success, output\n end\n\n raise ArgumentError.new(\"Invalid settings or code - this shouldn't happen.\")\n end", "def setup_remote(args)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n formatter = Printer.new(@config).build_formatter\n formatter.print_header\n\n # Get $HOME/.watsonrc to check for remotes\n _home_conf = Watson::Config.home_conf\n\n print BOLD + \"Existing Remotes:\\n\" + RESET\n\n # Check the config for any remote entries (GitHub or Bitbucket) and print\n # We *should* always have a repo + API together, but API should be enough\n if _home_conf.github_api.empty? && @config.bitbucket_api.empty? && @config.asana_api.empty?\n formatter.print_status \"!\", YELLOW\n print BOLD + \"No remotes currently exist\\n\\n\" + RESET\n end\n\n unless _home_conf.github_api.empty?\n print BOLD + \"- GitHub APIs -\\n\" + RESET\n _home_conf.github_api.each_with_index do |_api, _i|\n print BOLD + \"#{_i+1}. #{_api[0]}\" + RESET + \" : #{_api[1]}\\n\"\n end\n print \"\\n\\n\"\n end\n\n unless @config.github_repo.empty?\n print BOLD + \"GitHub Repo : \" + RESET + \"#{ @config.github_repo }\\n\\n\"\n end\n\n\n if !@config.bitbucket_api.empty?\n print BOLD + \"Bitbucket User : \" + RESET + \"#{ @config.bitbucket_api }\\n\" + RESET\n print BOLD + \"Bitbucket Repo : \" + RESET + \"#{ @config.bitbucket_repo }\\n\\n\" + RESET\n end\n\n if !@config.gitlab_api.empty?\n print BOLD + \"GitLab User : \" + RESET + \"#{ @config.gitlab_api }\\n\" + RESET\n print BOLD + \"GitLab Repo : \" + RESET + \"#{ @config.gitlab_repo }\\n\\n\" + RESET\n end\n\n if !@config.asana_api.empty?\n print BOLD + \"Asana API Key : \" + RESET + \"#{ @config.asana_api }\\n\" + RESET\n print BOLD + \"Asana Workspace : \" + RESET + \"#{ @config.asana_workspace }\\n\" + RESET\n print BOLD + \"Asana Project : \" + RESET + \"#{ @config.asana_project }\\n\\n\" + RESET\n end\n\n # If github or bitbucket passed, setup\n # If just -r (0 args) do nothing and only have above printed\n # If more than 1 arg is passed, unrecognized, warn user\n if args.length == 1\n case args[0].downcase\n when \"github\"\n debug_print \"GitHub setup called from CL\\n\"\n Watson::Remote::GitHub.setup(@config)\n\n when \"bitbucket\"\n debug_print \"Bitbucket setup called from CL\\n\"\n Watson::Remote::Bitbucket.setup(@config)\n\n when \"gitlab\"\n debug_print \"GitLab setup called from CL\\n\"\n Watson::Remote::GitLab.setup(@config)\n\n when \"asana\"\n debug_print \"Asana setup called from CL\\n\"\n Watson::Remote::Asana.setup(@config)\n\n end\n elsif args.length > 1\n formatter.print_status \"x\", RED\n puts <<-SUMMERY.gsub(/^ {,8}/, '')\n #{BOLD}Incorrect arguments passed#{RESET}\n Please specify either Github or Bitbucket to setup remote\n Or pass without argument to see current remotes\n See help (-h/--help) for more details\n SUMMERY\n\n return false\n end\n end", "def tunnel\n system @opts[:ssh][:bin],\n @opts[:ssh][:opts],\n '-p', @opts[:remote][:ssh_port].to_s,\n '-i', @opts[:ssh][:identity],\n '-R', [\n @opts[:remote][:fwd_port],\n @opts[:local][:host],\n @opts[:local][:port]\n ].join(':'),\n \"#{@opts[:remote][:user]}@#{@opts[:remote][:host]}\"\n end", "def run\n Shef::Extensions.extend_context_object(self)\n ssh_config = []\n\n ssh_config << \"\\n\\n### BEGIN KNIFE BLOCK ###\"\n ssh_config << \"## This was generated by `knife setup ssh`:\"\n\n STDOUT.sync = true\n\n nodes.all do |n|\n next if /vagrant/.match(n.name)\n name = n.name\n name << '.lisausa.net' unless /\\.lisausa.net\\Z/.match(n.name)\n\n begin\n hostname = n.ipaddress\n rescue => ex\n ui.warn(\"Error (#{ex.inspect}) while getting #ipaddress for #{n.name}\")\n next\n end\n\n ssh_config << [\n \"Host #{name}\",\n \" HostName #{hostname}\",\n \" HostKeyAlias #{[name,hostname,n.macaddress].join('-')}\"\n ]\n end\n\n if (c = Chef::Config.knife).keys.grep(/identity_file|ssh_user/).any?\n ssh_config.push [\n \"Host *.lisausa.net\",\n \" IdentitiesOnly yes\",\n \" PasswordAuthentication no\",\n \" ForwardAgent yes\"\n ]\n ssh_config.push \" IdentityFile #{c[:identity_file]}\" if c[:identity_file]\n ssh_config.push \" User #{c[:ssh_user]}\" if c[:ssh_user]\n end\n\n ssh_config << \"### END KNIFE BLOCK ###\"\n ssh_config = ssh_config.flatten.join(\"\\n\")\n\n file_path = File.join(ENV['HOME'], '.ssh', 'config')\n if config[:write] or ui.ask_question(\"Write config to #{file_path} (Y/N)?\", default: 'N').downcase == 'y'\n FileUtils.copy_file(file_path, \"#{file_path}~\")\n File.open(file_path, File::RDWR|File::CREAT) do |f|\n f.flock(File::LOCK_EX)\n\n contents = f.read.gsub(/\\n*### BEGIN KNIFE BLOCK ###.+?(### END KNIFE BLOCK ###|\\Z)/m, ssh_config)\n unless contents.include?('### BEGIN KNIFE BLOCK ###')\n contents << ssh_config\n end\n f.rewind\n f.truncate(0)\n f.write contents\n end\n ui.msg \"Wrote to #{file_path}. Previous contents were backed up to #{file_path}~\"\n else\n ui.msg \"Copy and paste the following into your #{file_path} file:\"\n ui.msg ssh_config\n end\n end", "def ssh(*arguments)\n options = []\n\n # Add the -p option if an alternate destination port is given\n if @uri.port\n options += ['-p', @uri.port.to_s]\n end\n\n # append the SSH URI\n options << ssh_uri\n\n # append the additional arguments\n arguments.each { |arg| options << arg.to_s }\n\n return system('ssh',*options)\n end", "def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend", "def _ssh(path_of_servers, sshpass_command, user_exec_command)\n if path_of_servers.size == 0\n return \"#{sshpass_command} #{user_exec_command}\"\n end\n\n server = path_of_servers.shift\n #shell command needs double quote's escape\n sshpass_command += \"\\\"#{one_ssh_str(server)}\"\n _ssh(path_of_servers, sshpass_command, user_exec_command)\n end", "def desc\n \"SSH command shell\"\n end", "def do_ssh\n validate_parameters\n\n auth_types = []\n auth_types << 'PASSWORD' if @password && !@password.empty?\n auth_types << \"KEY (#{@key_type})\"\n\n connection = @host\n connection += \" port #{@port}\" if @port != 0\n\n write_output(\"\\nConnecting to #{connection} as #{@user} using auth [#{auth_types.join(', ')}]\")\n\n options = {\n :host_key => @key_type,\n :password => @password,\n :port => @port == 0 ? DEFAULT_PORT : @port,\n :timeout => @timeout,\n }\n options[:keys] = [@key_path] unless @key_path.empty?\n\n session = start(@host, @user, options, @retries, @wait)\n yield(session)\n rescue PluginError\n # Re-raise\n raise\n rescue Exception => e\n raise PluginError, \"Error in SSH connection: #{e.class} #{e}\\n\" + e.backtrace.join(\"\\n\")\n ensure\n close\n end", "def setup_ssh_config(config)\n dst = File.expand_path \"#{__dir__}/../ssh_config\"\n\n if config[\"machines\"] != nil\n entries = []\n config[\"machines\"].each do |m|\n entries << {\"Host\" => m[\"hostname\"],\n \"HostName\" => m[\"private_ips\"][0],\n \"User\" => \"stack\"}\n end\n\n str = \"\"\n entries.each do |ent|\n ent.each do |k, v|\n if k == \"Host\"\n str += \"#{k} #{v}\\n\"\n else\n str += \" #{k} #{v}\\n\"\n end\n end\n end\n str.chomp\n\n str += \"Host *\\n\" +\n \" StrictHostKeyChecking no\\n\" +\n \" UserKnownHostsFile=/dev/null\\n\"\n\n open(dst, \"w+\") {|f|\n f.write(str)\n }\n end\n end", "def tunnel_cmd remote_port, local_port\n \"ssh -NT -R #{remote_port}:localhost:#{local_port} #{user_at_host} -p #{@port}\"\n end", "def deploy\n system %Q[ssh -lroot \"#{server}\" <<'EOF'\n \tcat >\"#{remote_script_name}\" <<'EOS'\n#{generate}EOS\nchmod +x \"#{remote_script_name}\"\nsource \"#{remote_script_name}\"\nEOF\n ]\n end", "def finish_linux_configuration\n\n configure do\n\n user = add_parameter 'username', {type: 'string'}\n pwd = add_parameter 'ssh_key', {type: 'string'}\n\n end\n\n end", "def run(*args)\n case args.size\n when 3\n ssh_host, ssh_user, ssh_command = args \n when 2\n ssh_host, ssh_command = args\n ssh_user = self.user\n when 1\n ssh_host, ssh_user = self.host, self.user\n ssh_command = args.first\n else\n raise ArgumentError\n end\n return ssh_host.map{|host| run(host, ssh_user, ssh_command)} if ssh_host.is_a? Array\n \n key = \"#{ssh_user}@#{ssh_host}\"\n puts \" #{key}$ #{ssh_command}\"\n @ssh_sessions[key] ||= Net::SSH.start(ssh_host, ssh_user)\n output = @ssh_sessions[key].exec!(ssh_command)\n puts output.split(\"\\n\").map{|l| \" #{key}> #{l}\"}.join(\"\\n\") if output\n output\n end", "def set_remote\n return if @remote_type == :none\n\n url = \"git@github.com:pixelastic/#{@name}.git\" if @remote_type == :github\n if @remote_type == :bitbucket\n url = \"git@bitbucket.org:pixelastic/#{@name}.git\"\n end\n\n if create_remote('origin', url)\n puts '✔ Configuring remote'\n else\n puts '✘ Failed to configure remote'\n exit 1\n end\n end", "def ssh_options\n process_keys\n options = base_options\n\n config.port.nil? or options.merge!(:port => config.port)\n config.password.nil? or options.merge!(:password => config.password)\n config.keys.nil? or options.merge!(:keys => config.keys)\n\n config.ui.logger.debug { \"ssh_options(#{options.inspect})\" }\n options\n end", "def build_remote_cmd cmd, options={}\n cmd = sh_cmd cmd\n cmd = env_cmd cmd\n cmd = sudo_cmd cmd, options\n cmd = ssh_cmd cmd, options\n end", "def ssh_type; end", "def ssh_type; end", "def ssh_type; end", "def ssh_type; end", "def start\n conf = RecursiveOpenStruct.new(Net::SSH::Config.load(SSH_CONFIG, @server.host))\n chost = @server.host.colorize((@server.color || 'default').to_sym)\n\n Net::SSH.start(conf.host, conf.user, keys: conf.identityfile) do |ssh|\n ssh.open_channel do |channel|\n channel.on_data do |ch, data|\n data.lines.each do |line|\n @queue.push(\"[#{chost}] #{line}\")\n end\n end\n\n channel.exec(\"tail -f #{@path}\")\n end\n end\n end", "def run_remote_command(command)\n # Finds the remote ip and stores it in \"remote_ip\"\n parse_remote_ip\n \n # Finds the remote ip and stores it in \"remote_app_name\"\n parse_remote_app_name\n \n begin\n remote_command(command)\n rescue Net::SSH::AuthenticationFailed\n HighLine.track_eof = false\n password = ask(\"Enter your password: \") { |q| q.echo = '' }\n remote_command(command, password)\n end\n end", "def ssh?\n true\n end", "def container_ssh_command\n # Get the container's SSH info\n info = @machine.ssh_info\n return nil if !info\n info[:port] ||= 22\n\n # Make sure our private keys are synced over to the host VM\n ssh_args = sync_private_keys(info).map do |path|\n \"-i #{path}\"\n end\n\n # Use ad-hoc SSH options for the hop on the docker proxy \n if info[:forward_agent]\n ssh_args << \"-o ForwardAgent=yes\"\n end\n ssh_args.concat([\"-o Compression=yes\",\n \"-o ConnectTimeout=5\",\n \"-o StrictHostKeyChecking=no\",\n \"-o UserKnownHostsFile=/dev/null\"])\n\n # Build the SSH command\n \"ssh #{info[:username]}@#{info[:host]} -p#{info[:port]} #{ssh_args.join(\" \")}\"\n end", "def sshAndScp\n return contentHost.sshAndScp\n end", "def ssh(*args)\n options = []\n\n # Add the -p option if an alternate destination port is given\n if @uri.port\n options += ['-p', @uri.port.to_s]\n end\n\n options << ssh_uri\n options += args\n\n return system('ssh',*options)\n end", "def provision_on(config)\n check_compatibility!(config)\n\n return if config.commands.nil?\n\n # this will initialize the SSH tunnel based on the connection settings\n @tunnel = Tunnel.new($connection.settings.to_h)\n @errors = []\n\n @results = nil\n\n stdout = []\n @sftp = nil\n @tunnel.on_shh do |session|\n while config.commands.count > 0\n cmd = config.commands.shift\n \n if cmd.type.eql? Command::DOWNLOAD_FILE\n catch_sftp_exception do\n @sftp = init_sftp\n DevOn::print({:title => \"Preparing SFTP Download\", :value => cmd.value})\n @sftp.download!(cmd.value[:source], cmd.value[:destination], {:verbose => @tunnel.verbose})\n DevOn::print({:title => \"File Download Complete\", :value => cmd.value[:destination]})\n end\n end\n\n if cmd.type.eql? Command::UPLOAD_FILE\n catch_sftp_exception do\n @sftp = init_sftp\n DevOn::print({:title => \"Preparing SFTP Upload\", :value => cmd.value})\n @sftp.upload!(cmd.value[:source], cmd.value[:destination], {:verbose => @tunnel.verbose})\n DevOn::print({:title => \"File Uploaded\", :value => cmd.value[:destination]})\n end\n end\n\n if cmd.type.eql? Command::SHELL\n catch_ssh_exception do \n command = cmd.value\n command = command.gsub(\"$output\", $output) if(command.include?\"$output\") \n \n DevOn::print({:title => \"Preparing SSH command\", :value => command})\n session.exec!(command) do |channel, stream, data|\n if stream == :stdout\n arr = data.split(\"\\n\")\n stdout = arr.empty? ? data : arr\n @results = stdout\n end\n end\n $output = stdout.flatten.join(' ')\n DevOn::print({:title => \"[SHELL OUTPUT]\", :output => stdout})\n end\n end\n end\n end\n \n if !@errors.empty?\n ap \"Please correct the following ERRORS:\"\n ap @errors\n else\n ap \"NO ERRORS ENCOUNTERED!\"\n end\n\n @results\n end", "def ssh_hostfile(file)\n CommandRunner.instance.ssh_hostfile file\n end", "def create_ssh_setup\n command = \"echo 'y\\\\\\n' \\| ssh-keygen -f /tmp/#{@name_args[0]}.key -N \\\"\\\" -P \\\"\\\"\"\n result = run_remote_command(command)\n\n if config[:username].eql? \"root\"\n auth_keys_file = '/root/.ssh/authorized_keys'\n else\n auth_keys_file = \"/home/#{config[:username]}/.ssh/authorized_keys\"\n end\n\n # we don't want to overwrite anything that may already exist here\n command = \"echo \\\"\\##{@name_args[0]}\\\" >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key.pub >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"chmod 0600 #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key\"\n ssh_key = run_remote_command(command)\n end", "def ssh_cmd_base(host_or_ip)\n return [\"sudo\", \"-i\", \"-u\", \"root\", \"--\", \"ssh\", \"-o\", \"TCPKeepAlive=no\", \"-o\", \"ServerAliveInterval=15\", \"root@#{host_or_ip}\"]\n end", "def execute(opts={})\n # Check the key permissions to avoid SSH hangs\n check_key_permissions(env.config.ssh.private_key_path)\n\n # Merge in any additional options\n opts = opts.dup\n opts[:forward_agent] = true if env.config.ssh.forward_agent\n opts[:port] ||= port\n\n retryable(:tries => 5, :on => Errno::ECONNREFUSED) do\n Net::SSH.start(env.config.ssh.host,\n env.config.ssh.username,\n opts.merge( :keys => [env.config.ssh.private_key_path],\n :keys_only => true,\n :user_known_hosts_file => [],\n :paranoid => false,\n :config => false)) do |ssh|\n yield SSH::Session.new(ssh, env)\n end\n end\n rescue Errno::ECONNREFUSED\n raise Errors::SSHConnectionRefused\n end", "def ssh(args, options)\n perform_action(args[0], options, 'SSH') do |vm|\n rc = vm.info\n\n if OpenNebula.is_error?(rc)\n STDERR.puts rc.message\n exit(-1)\n end\n\n if vm.lcm_state_str != 'RUNNING'\n STDERR.puts 'VM is not RUNNING, cannot SSH to it'\n exit(-1)\n end\n\n # Get user to login\n username = vm.retrieve_xmlelements('//TEMPLATE/CONTEXT/USERNAME')[0]\n\n if !username.nil?\n login = username.text\n elsif !args[1].nil?\n login = args[1]\n else\n login = 'root'\n end\n\n # Get CMD to run\n options[:cmd].nil? ? cmd = '' : cmd = options[:cmd]\n\n # Get NIC to connect\n if options[:nic_id]\n nic = vm.retrieve_xmlelements(\n \"//TEMPLATE/NIC[NIC_ID=\\\"#{options[:nic_id]}\\\"]\"\n )[0]\n else\n nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH=\"YES\"]')[0]\n end\n\n nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0] if nic.nil?\n\n if nic.nil?\n STDERR.puts 'No NIC found'\n exit(-1)\n end\n\n # If there is node port\n if nic['EXTERNAL_PORT_RANGE']\n ip = vm.to_hash['VM']['HISTORY_RECORDS']['HISTORY']\n ip = [ip].flatten[-1]['HOSTNAME']\n port = Integer(nic['EXTERNAL_PORT_RANGE'].split(':')[0]) + 21\n else\n ip = nic['IP']\n port = 22\n end\n\n options[:ssh_opts].nil? ? opts = '' : opts = options[:ssh_opts]\n\n if opts.empty?\n exec('ssh', \"#{login}@#{ip}\", '-p', port.to_s, cmd.to_s)\n else\n exec('ssh', *opts.split, \"#{login}@#{ip}\", '-p', port.to_s, cmd.to_s)\n end\n end\n\n # rubocop:disable Style/SpecialGlobalVars\n $?.exitstatus\n # rubocop:enable Style/SpecialGlobalVars\n end", "def set_ssh_user(username, password)\n # Sets the credentials for a the remote SSH user\n @username = username\n @password = password\n end", "def exec(command, options={})\n ssh.exec(command, options)\n end", "def remote_command(command)\n return %x(ssh #{self.sar_host} \"#{command}\")\n end", "def exec(cmd, server_name = \"*\")\n user = 'deploy'\n output = {}\n threads = []\n\n servers.each_pair do |name, server|\n if server_name == \"*\" || (server_name != '*' && server_name == name)\n threads << Thread.new do\n Net::SSH.start(server, user) do |ssh|\n output[name] = ssh.exec!(cmd)\n end\n end\n end\n end\n \n threads.each(&:join)\n output\n end", "def ssh_cmd cmd, options=nil\n options ||= {}\n\n flags = [*options[:flags]].concat @ssh_flags\n\n [\"ssh\", flags, @host, cmd].flatten.compact\n end", "def rsync_port\n \"-e 'ssh -p #{port}'\"\n end", "def command_for_rsync\n args = []\n args << \"-l #{@options[:user]}\" if @options[:user]\n args << \"-p #{@options[:port]}\" if @options[:port]\n if @options[:keys]\n @options[:keys].each { |key| args << \"-i #{key}\" }\n end\n \"ssh #{args.join(' ')}\"\n end", "def run(cmd, host_ip)\n user = 'root'\n ip = host_ip\n port = 22\n\n @cmd = system \"ssh -p #{port} #{user}@#{ip} '#{cmd}'\" \n logger.info @cmd\n end", "def configure_command(cmd)\n end", "def setup(credentials = {})\n requires :public_key, :ssh_ip_address, :username\n\n credentials[:proxy]= ssh_proxy unless ssh_proxy.nil?\n credentials[:password] = password unless self.password.nil?\n credentials[:key_data] = [private_key] if self.private_key\n\n commands = [\n %{mkdir .ssh},\n # %{passwd -l #{username}}, #Not sure if we need this here\n # %{echo \"#{Fog::JSON.encode(attributes)}\" >> ~/attributes.json}\n ]\n if public_key\n commands << %{echo \"#{public_key}\" >> ~/.ssh/authorized_keys}\n end\n\n # wait for domain to be ready\n Timeout::timeout(360) do\n begin\n Timeout::timeout(8) do\n Fog::SSH.new(ssh_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')\n end\n rescue Errno::ECONNREFUSED\n sleep(2)\n retry\n rescue Net::SSH::AuthenticationFailed, Timeout::Error\n retry\n end\n end\n Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)\n end", "def provision_execute(s, commands)\n errors = []\n return errors if (commands.nil? or commands.empty?)\n \n if (!get_field(\"cloud_ips\").nil? and !get_field(\"cloud_ips\").empty?)\n host = get_field(\"cloud_ips\")[0]\n elsif (!get_field(\"cloud_private_ips\").nil? and !get_field(\"cloud_private_ips\").empty?)\n host = get_field(\"cloud_private_ips\")[0]\n else\n msg = \"No IP address associated to the machine #{host} - cannot run SSH command\"\n errors << msg\n log_output(msg, :info)\n return errors\n end\n \n ssh_password = get_field('ssh_password')\n ssh_options = {}\n msg = \"Running SSH Commands On New Machine #{s.username}@#{host}\"\n msg_options = {}\n if (ssh_password and !ssh_password.empty?)\n ssh_options[:password] = ssh_password\n msg_options[:password] = \"*\" * ssh_password.size\n end\n msg_options[:private_key_path] = s.private_key_path if s.private_key_path\n msg_options[:private_key] = mask_private_key(s.private_key.strip) if s.private_key # show only last 5 chars\n log_output(\"#{msg} using #{msg_options}: #{commands.join(\", \")}\", :info)\n\n for i in 1..10\n begin\n log_output(\"[#{host}] Running Commands:\\n #{commands.join(\"\\n \")}\\n\")\n responses = s.ssh(commands, ssh_options) do |data, extended_data|\n write_output(data, :buffer => true) unless data.empty? #stdout\n write_output(extended_data, :buffer => true) unless extended_data.empty? #stderr\n end\n\n responses.each do |result|\n if result.status != 0\n msg = \"[#{host}] Command '#{result.command}' failed with status #{result.status}\"\n errors << msg\n log_output(msg, :info)\n end\n end unless responses.nil?\n break\n rescue Errno::EHOSTUNREACH, Timeout::Error, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Net::SSH::Disconnect => e\n log_output(\"[#{host}] Try #{i} - failed to connect: #{e}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"[#{host}] Try #{i} - failed to connect: authentication failed for user #{e.message}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts, authentication failed for user #{e.message}\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n end\n end\n return errors\n end", "def interactive_ssh(run=true)\n debug \"interactive_ssh with keys: #{@rye_opts[:keys].inspect}\"\n run = false unless STDIN.tty?\n args = []\n @rye_opts[:keys].each { |key| args.push *[:i, key] }\n args << \"#{@rye_user}@#{@rye_host}\"\n cmd = Rye.prepare_command(\"ssh\", args)\n return cmd unless run\n system(cmd)\n end", "def ssh_config_options(host)\n return Net::SSH::Config.for(host)\n end", "def ssh_configs\n configs = []\n configs << project_git_config if project_git_config.host\n configs << database_git_config if database_git_config.host\n configs.concat @standalone_ssh_configs\n configs.compact\n end", "def exec(argv, options = {}, &block)\n sshcmd = %W( ssh #{@remote} -tS #{controlsocket} )\n\n sshcmd += %W( cd #{options[:chdir]} && ) if options.has_key?(:chdir)\n\n @local.exec(sshcmd + argv, &block)\n end", "def setup(credentials = {})\n requires :public_key, :public_ip_address, :username\n\n credentials[:password] = password unless self.password.nil?\n credentails[:key_data] = [private_key] if self.private_key\n\n commands = [\n %{mkdir .ssh},\n ]\n if public_key\n commands << %{echo \"#{public_key}\" >> ~/.ssh/authorized_keys}\n end\n\n # wait for domain to be ready\n Timeout::timeout(360) do\n begin\n Timeout::timeout(8) do\n Fog::SSH.new(public_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')\n end\n rescue Errno::ECONNREFUSED\n sleep(2)\n retry\n rescue Net::SSH::AuthenticationFailed, Timeout::Error\n retry\n end\n end\n Fog::SSH.new(public_ip_address, username, credentials).run(commands)\n end", "def ssh(commandString, dryRun = false)\n contentHost.sshAndScp.ssh(commandString, dryRun)\n end", "def exec_ssh(command, args, setting)\n puts \"#{Time.now} call #{self.class}##{__method__}\"\n ssh_options = ssh_option_init(setting)\n\n user = setting[\"ssh\"][\"user\"]\n host = setting[\"ssh\"][\"host\"]\n remote_dir = setting[\"dir\"][\"remote\"]\n\n Net::SSH.start(host, user, ssh_options) do |session|\n case command\n when :scp\n puts \"#{Time.now} scp: from #{args} to #{user}@#{host}:#{remote_dir}\"\n return Net::SCP.new(session).upload!(args, remote_dir, {:verbose => 'useful'})\n when :ssh\n return session.exec!(\"bash -c '#{args}'\").chomp!\n end\n end\n rescue Net::SSH::AuthenticationFailed => ex\n puts \"1\"\n puts \"class:#{ex.class} #{ex.message}\"\n return ex.class\n rescue Errno::ECONNREFUSED => ex\n puts \"2\"\n puts \"class:#{ex.class} #{ex.message}\"\n rescue => ex\n puts \"3\"\n puts \"class:#{ex.class} #{ex.message}\"\n end", "def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end", "def ssh(*command, port: 22)\n runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))\n runner.run(host: ip, ssh_options: { port: port })\n runner.output\n end", "def within_ssh_session(machine)\n options = Net::SSH.configuration_for(machine['network'], true)\n options[:auth_methods] = %w[publickey none]\n options[:verify_host_key] = :never\n options[:keys] = [machine['keyfile']]\n options[:non_interactive] = true\n options[:timeout] = 5\n Net::SSH.start(machine['network'], machine['whoami'], options) do |ssh|\n yield ssh\n end\n end", "def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend", "def build_ssh_command(host)\n user_opt = ''\n key_opt = ''\n port_opt = ''\n ssh_options = config.rsync_options\n\n if user = host.user || ssh_options[:user]\n user_opt = \" -l #{user}\"\n end\n\n if keys = (host.keys.empty? ? ssh_options[:keys] : host.keys)\n keys = keys.is_a?(Array) ? keys : [keys]\n key_opt = keys.map { |key| \" -i #{key}\" }.join('')\n end\n\n if port = host.port || ssh_options[:port]\n port_opt = \" -p #{port}\"\n end\n\n \"ssh#{user_opt}#{key_opt}#{port_opt}\"\n end", "def connect!\n @ssh = Net::SSH.start(@host, @user, :password => @pass)\n end", "def over_ssh(opts = {})\n raise 'MissingSSHHost' unless opts[:host]\n raise 'MissingSSHUser' unless opts[:user]\n opts[:timeout] ||= 300 # default to a 5 minute timeout\n\n remote = Rye::Box.new(\n opts[:host],\n user: opts[:user],\n auth_methods: ['publickey'],\n password_prompt: false,\n error: STDOUT # send STDERR to STDOUT for things that actually print\n )\n\n exception = nil\n\n # Getting serious about not crashing Lita...\n output = begin\n # pass our host back to the user to work with\n Timeout.timeout(opts[:timeout]) { yield remote }\n rescue Rye::Err, Timeout::Error => e\n exception = e\n ensure\n remote.disconnect\n end\n\n calculate_result(output, exception)\n end", "def ssh_connection\n @ssh_connection ||= Net::SSH.start(@host, config[:user], config[:ssh_options] || {})\n end", "def kind\n :ssh\n end", "def ssh_login\n deploy_test_on_hosts_as self.host_admin, self.hosts, \"/home/#{self.host_admin}\\n\", \"should be able to connect via ssh\" do\n 'pwd'\n end\n end", "def make_ssh_config(workspace_path)\n ssh_path = File.join(workspace_path, '.ssh')\n return if Dir.exist? ssh_path\n\n FileUtils.mkdir_p ssh_path, mode: 0o700\n touch File.join(ssh_path, 'config'), 0o600\n\n # .git_ssh.sh\n git_ssh_path = File.join(workspace_path, '.git_ssh.sh')\n File.write git_ssh_path, <<~SHELL\n #!/bin/sh\n ssh-wrapper \"$@\"\n SHELL\n FileUtils.chmod 0o755, git_ssh_path\n end", "def enable_root_ssh(ip, initial_ssh_user)\n # Capistrano uses the :password variable for sudo commands. Since this setting is generally used for the deploy user,\n # but we need it this one time for the initial SSH user, we need to swap out and restore the password.\n #\n # We special-case the 'ubuntu' user since the Canonical AMIs on EC2 don't set the password for\n # this account, making any password prompt potentially confusing.\n orig_password = fetch(:password)\n initial_ssh_password = fetch(:initial_ssh_password, nil)\n\n if initial_ssh_user == 'ubuntu' || ENV.has_key?('RUN_FROM_VAGRANT')\n set(:password, nil)\n elsif initial_ssh_password\n set(:password, initial_ssh_password)\n else\n set(:password, Capistrano::CLI.password_prompt(\"Password for #{initial_ssh_user} @ #{ip}: \"))\n end\n\n task :_ensure_key_file_present, :hosts => \"#{initial_ssh_user}@#{ip}\" do\n public_key_filename = \"#{cloud.env.key_file}.pub\"\n\n if File.exist?(public_key_filename)\n public_key = File.read(public_key_filename).chomp\n\n rubber.sudo_script 'ensure_key_file_present', <<-ENDSCRIPT\n mkdir -p ~/.ssh\n touch ~/.ssh/authorized_keys\n chmod 600 ~/.ssh/authorized_keys\n\n if ! grep -q '#{public_key}' .ssh/authorized_keys; then\n echo '#{public_key}' >> .ssh/authorized_keys\n fi\n ENDSCRIPT\n end\n end\n\n task :_allow_root_ssh, :hosts => \"#{initial_ssh_user}@#{ip}\" do\n rsudo \"mkdir -p /root/.ssh && cp /home/#{initial_ssh_user}/.ssh/authorized_keys /root/.ssh/\"\n end\n\n task :_disable_password_based_ssh_login, :hosts => \"#{initial_ssh_user}@#{ip}\" do\n rubber.sudo_script 'disable_password_based_ssh_login', <<-ENDSCRIPT\n if ! grep -q 'PasswordAuthentication no' /etc/ssh/sshd_config; then\n echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config\n service ssh restart\n fi\n ENDSCRIPT\n end\n\n begin\n _ensure_key_file_present\n _allow_root_ssh\n _disable_password_based_ssh_login if cloud.should_disable_password_based_ssh_login?\n\n # If the initial_ssh_user is different than the deploy user, we can terminate the SSH connection\n # because from here on out we'll be connecting as the deploy user.\n if initial_ssh_user != fetch(:user, nil)\n teardown_connections_to(sessions.keys)\n end\n rescue ConnectionError, IOError => e\n if e.message =~ /Net::SSH::AuthenticationFailed/\n logger.info \"Can't connect as user #{initial_ssh_user} to #{ip}, assuming root allowed\"\n else\n sleep 2\n logger.info \"Failed to connect to #{ip}, retrying\"\n teardown_connections_to(sessions.keys) if e.message =~ /closed stream/\n retry\n end\n end\n\n # Restore the original deploy password.\n set(:password, orig_password)\n end", "def provision_ssh(args)\n env = config.env.map { |k,v| \"#{k}=#{quote_and_escape(v.to_s)}\" }\n env = env.join(\" \")\n\n command = \"chmod +x '#{config.upload_path}'\"\n command << \" &&\"\n command << \" #{env}\" if !env.empty?\n command << \" #{config.upload_path}#{args}\"\n\n with_script_file do |path|\n # Upload the script to the machine\n @machine.communicate.tap do |comm|\n # Reset upload path permissions for the current ssh user\n info = nil\n retryable(on: Vagrant::Errors::SSHNotReady, tries: 3, sleep: 2) do\n info = @machine.ssh_info\n raise Vagrant::Errors::SSHNotReady if info.nil?\n end\n\n user = info[:username]\n comm.sudo(\"chown -R #{user} #{config.upload_path}\",\n error_check: false)\n\n comm.upload(path.to_s, config.upload_path)\n\n if config.name\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"script: #{config.name}\"))\n elsif config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: path.to_s))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline script\"))\n end\n\n # Execute it with sudo\n comm.execute(\n command,\n sudo: config.privileged,\n error_key: :ssh_bad_exit_status_muted\n ) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end", "def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend", "def configure\n send_command \"--configure\"\n end", "def ssh_config_for(node, ssh_config: nil, nodes: nil, ssh_exec: nil, known_hosts_file: nil)\n if ssh_config.nil?\n params = {}\n params[:nodes] = nodes unless nodes.nil?\n params[:ssh_exec] = ssh_exec unless ssh_exec.nil?\n params[:known_hosts_file] = known_hosts_file unless known_hosts_file.nil?\n ssh_config = test_connector.ssh_config(**params)\n end\n ssh_config_lines = ssh_config.split(\"\\n\")\n begin_marker = node.nil? ? /^Host \\*$/ : /^# #{Regexp.escape(node)} - .+$/\n start_idx = ssh_config_lines.index { |line| line =~ begin_marker }\n return nil if start_idx.nil?\n\n end_markers = [\n /^\\# \\w+ - .+$/,\n /^\\#+$/\n ]\n end_idx = ssh_config_lines[start_idx + 1..].index { |line| end_markers.any? { |end_marker| line =~ end_marker } }\n end_idx = end_idx.nil? ? -1 : start_idx + end_idx\n \"#{\n ssh_config_lines[start_idx..end_idx].select do |line|\n stripped_line = line.strip\n !stripped_line.empty? && stripped_line[0] != '#'\n end.join(\"\\n\")\n }\\n\"\n end", "def ssh_cli_string(id)\n server = @connection.servers.get(id)\n \"ssh -i #{self.key_path} #{self.login_user}@#{server.public_ip_address}\"\n end", "def create_ssh_transport(host, options)\n require 'chef/provisioning/transport/ssh'\n ssh_user = options[:user]\n options = options.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }\n Chef::Provisioning::Transport::SSH.new(\n host,\n ssh_user,\n options.to_hash,\n @config[:machine_options][:sudo] ? { prefix: 'sudo ' } : {},\n config\n )\n end", "def remotes_action(command, id, host, action, remote_dir, std_in=nil)\n super(command,id,host,ACTION[action],remote_dir,std_in)\n end", "def sshkit_wrapper(options, ssh_options)\n Remote.new(options, ssh_options).tap do\n Remote.output_verbosity = logger(options.debug_level || :info)\n end\n end" ]
[ "0.6837605", "0.6781286", "0.6702748", "0.6665643", "0.6654404", "0.6588082", "0.6540874", "0.6530356", "0.65055656", "0.6496589", "0.6444951", "0.64258236", "0.63801986", "0.6363892", "0.635593", "0.63513607", "0.6343348", "0.6331936", "0.63174146", "0.6316927", "0.62806", "0.6238779", "0.62339085", "0.6232999", "0.6208694", "0.6201243", "0.6190686", "0.6186643", "0.6161662", "0.6148901", "0.6140402", "0.6122066", "0.61170053", "0.61052084", "0.61011446", "0.6100752", "0.6097961", "0.60963684", "0.6089406", "0.60847443", "0.60820913", "0.60806775", "0.60658383", "0.60074544", "0.6000807", "0.60001105", "0.5984579", "0.5984579", "0.5984579", "0.5984579", "0.59825927", "0.59804523", "0.5972369", "0.5950038", "0.5940015", "0.59393483", "0.59380615", "0.59327495", "0.59062004", "0.5905159", "0.5901644", "0.58777666", "0.5874324", "0.58734393", "0.5869538", "0.5860735", "0.5857061", "0.5856655", "0.5850593", "0.58480567", "0.584045", "0.5836895", "0.58332974", "0.5823607", "0.58223754", "0.58095425", "0.58017254", "0.5800667", "0.58000964", "0.5799154", "0.5790056", "0.5790056", "0.57830036", "0.57824844", "0.57761365", "0.5771928", "0.57588035", "0.5753413", "0.57513875", "0.5747795", "0.5739117", "0.573782", "0.57364935", "0.5733394", "0.5729941", "0.57254803", "0.57231617", "0.57113385", "0.5710481", "0.5706828" ]
0.7224722
0
Configure how to communicate with GitHub
def config_github(api_key) @github = GitHub.new(api_key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_github_access\n settings = ::GitReview::Settings.instance\n if settings.oauth_token && settings.username\n @github = Octokit::Client.new(\n :login => settings.username,\n :access_token => settings.oauth_token,\n :auto_traversal => true\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def github\n\n @github = Github.new({ client_id: CONFIG[:GITHUB_CLIENT_ID], client_secret: CONFIG[:GITHUB_CLIENT_SECRET] })\n end", "def github\n Log.fatal('You did not configure GitHub yet.') unless @github\n @github\n end", "def configure_github_access\n if Settings.instance.oauth_token\n @github = Octokit::Client.new(\n :login => Settings.instance.username,\n :oauth_token => Settings.instance.oauth_token\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def _github\n Lexhub.configuration.github\n end", "def git_setup gitconfig, password \n\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.create'), \"\")\n terminal_add gitconfig, terminal_info(I18n.t('git.message.init'))\n\n cmd_res = false\n #Github client\n github = Github.new basic_auth: \"#{gitconfig.user}:#{password}\"\n #SSH key setup\n keys = github.users.keys.list.body\n #pp keys\n has_key = keys.select{|key| key.title == gitconfig.repo}.length > 0\n unless has_key\n option = OS.mac? ? \"-K\" : \"\"\n key_path = File.absolute_path \"#{Dir.home}/.ssh/#{gitconfig.repo}\"\n key_exists = File.exist? key_path\n \n unless key_exists\n \n terminal_add gitconfig, terminal_info(I18n.t('git.message.ssh'))\n cmds = [\n [\"ssh-keygen -t rsa -b 4096 -f ~/.ssh/#{gitconfig.repo} -C \\\"#{gitconfig.email}\\\" -q -N \\\"\\\"\", nil, true],\n [\"eval \\\"$(ssh-agent -s)\\\"\", /Agent pid (\\d*)/, true],\n [\"ssh-add #{option} ~/.ssh/#{gitconfig.repo}\", /Identity added: (.*)/, true]\n ]\n cmd_res = run_commands cmds, gitconfig\n end\n has_key = cmd_res && File.exist?(key_path)\n if has_key\n # Get the ssh key\n out, status = Open3.capture2e(\"cat ~/.ssh/#{gitconfig.repo}.pub\")\n if status.success?\n # Create add ssh key to github\n res = github.users.keys.create \"title\": gitconfig.repo, \"key\": out\n cmds = [\n [\"ssh -T -q git@github.com\", /Hi (.*)! You've successfully authenticated, but GitHub does not provide shell access./, true]\n ]\n cmd_res = run_commands cmds, gitconfig\n end\n end\n end\n\n # Change dir to preview path\n preview_dir = Rails.configuration.scribae['preview']['target']\n repo_path = Rails.root.join(preview_dir, gitconfig.repo)\n unless Dir.exist? repo_path\n FileUtils.mkdir_p repo_path\n end\n Dir.chdir repo_path\n\n # Get repo on github\n repos = github.repos.list.body\n .select{|repo| repo.name == gitconfig.repo}\n unless repos.length == 1\n # Create the repo\n terminal_add gitconfig, terminal_info(I18n.t('git.message.create'))\n github_res = github.repos.create name: gitconfig.repo\n repo = github_res.body\n\n else\n repo = repos[0]\n end\n\n # Configure the git repository \n terminal_add gitconfig, terminal_info(I18n.t('git.message.configure'))\n cmds = [\n [\"echo \\\"# Scribae project\\\" >> README.md\"],\n [\"git init\", nil, true],\n [\"git add README.md\", nil, true],\n [\"git commit -m \\\"first commit\\\"\", nil, true],\n [\"git config user.name \\\"#{gitconfig.user}\\\"\", nil, true],\n [\"git config user.email \\\"#{gitconfig.email}\\\"\", nil, true],\n [\"git remote add origin #{repo.ssh_url}\", nil, false],\n [\"git push -u origin master\", nil, true],\n [\"git branch gh-pages\", nil, true],\n [\"git checkout gh-pages\", nil, true]\n ]\n cmd_res = run_commands cmds, gitconfig\n puts \"CMD_RES => #{cmd_res}\"\n # Save the config\n \n if cmd_res\n gitconfig.initialized = true\n gitconfig.repo_link = repo.html_url\n gitconfig.website_link = \"https://#{gitconfig.user}.github.io/#{gitconfig.repo}\"\n gitconfig.save!\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.created'), \"\")\n end\n end", "def configure(options = {})\n api = Github.new\n config = GithubCLI.config\n\n ssl = config.fetch('core.ssl')\n adapter = config.fetch('core.adapter')\n token = config.fetch('user.token')\n site = config.fetch('core.site')\n endpoint = config.fetch('core.endpoint')\n\n api.basic_auth = set_basic_auth(config, options)\n api.ssl = ssl if ssl && ssl != ''\n api.adapter = adapter.to_sym if adapter && adapter != ''\n api.oauth_token = token if token && token != ''\n api.site = site if site && site != ''\n api.endpoint = endpoint if endpoint && endpoint != ''\n api.auto_pagination = options['auto_pagination'] || config.fetch('core.auto_pagination')\n\n if (test_env = ENV['TEST_HOST'])\n api.endpoint = 'http://' + test_env\n end\n api\n end", "def configure_git\n run_simple 'git config user.name Cucumber'\n run_simple 'git config user.email cucumber@`hostname --fqdn`'\nend", "def github\n process_oauth_callback\n end", "def provider\n :github\n end", "def setup\n Github::Configuration.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Github::Default.options[key])\n end\n self\n end", "def send_to_github\n ExceptionHub.current_octokit.create_issue(\"#{ExceptionHub.repo_owner}/#{ExceptionHub.repo_name}\", self.title, self.description, :open_timeout => 5)\n end", "def setup_remote(args)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n formatter = Printer.new(@config).build_formatter\n formatter.print_header\n\n # Get $HOME/.watsonrc to check for remotes\n _home_conf = Watson::Config.home_conf\n\n print BOLD + \"Existing Remotes:\\n\" + RESET\n\n # Check the config for any remote entries (GitHub or Bitbucket) and print\n # We *should* always have a repo + API together, but API should be enough\n if _home_conf.github_api.empty? && @config.bitbucket_api.empty? && @config.asana_api.empty?\n formatter.print_status \"!\", YELLOW\n print BOLD + \"No remotes currently exist\\n\\n\" + RESET\n end\n\n unless _home_conf.github_api.empty?\n print BOLD + \"- GitHub APIs -\\n\" + RESET\n _home_conf.github_api.each_with_index do |_api, _i|\n print BOLD + \"#{_i+1}. #{_api[0]}\" + RESET + \" : #{_api[1]}\\n\"\n end\n print \"\\n\\n\"\n end\n\n unless @config.github_repo.empty?\n print BOLD + \"GitHub Repo : \" + RESET + \"#{ @config.github_repo }\\n\\n\"\n end\n\n\n if !@config.bitbucket_api.empty?\n print BOLD + \"Bitbucket User : \" + RESET + \"#{ @config.bitbucket_api }\\n\" + RESET\n print BOLD + \"Bitbucket Repo : \" + RESET + \"#{ @config.bitbucket_repo }\\n\\n\" + RESET\n end\n\n if !@config.gitlab_api.empty?\n print BOLD + \"GitLab User : \" + RESET + \"#{ @config.gitlab_api }\\n\" + RESET\n print BOLD + \"GitLab Repo : \" + RESET + \"#{ @config.gitlab_repo }\\n\\n\" + RESET\n end\n\n if !@config.asana_api.empty?\n print BOLD + \"Asana API Key : \" + RESET + \"#{ @config.asana_api }\\n\" + RESET\n print BOLD + \"Asana Workspace : \" + RESET + \"#{ @config.asana_workspace }\\n\" + RESET\n print BOLD + \"Asana Project : \" + RESET + \"#{ @config.asana_project }\\n\\n\" + RESET\n end\n\n # If github or bitbucket passed, setup\n # If just -r (0 args) do nothing and only have above printed\n # If more than 1 arg is passed, unrecognized, warn user\n if args.length == 1\n case args[0].downcase\n when \"github\"\n debug_print \"GitHub setup called from CL\\n\"\n Watson::Remote::GitHub.setup(@config)\n\n when \"bitbucket\"\n debug_print \"Bitbucket setup called from CL\\n\"\n Watson::Remote::Bitbucket.setup(@config)\n\n when \"gitlab\"\n debug_print \"GitLab setup called from CL\\n\"\n Watson::Remote::GitLab.setup(@config)\n\n when \"asana\"\n debug_print \"Asana setup called from CL\\n\"\n Watson::Remote::Asana.setup(@config)\n\n end\n elsif args.length > 1\n formatter.print_status \"x\", RED\n puts <<-SUMMERY.gsub(/^ {,8}/, '')\n #{BOLD}Incorrect arguments passed#{RESET}\n Please specify either Github or Bitbucket to setup remote\n Or pass without argument to see current remotes\n See help (-h/--help) for more details\n SUMMERY\n\n return false\n end\n end", "def github\n conf['dashboard']['github']\n end", "def github_url\n \"https://github.com/#{self.nickname}\"\n end", "def github_url\n @github_url ||= \"https://github.com/#{options[:github_owner]}/#{name}\"\n end", "def config\n Timetrap::Config['github'] ||\n fail('Github settings missing in config file')\n end", "def github_api_setup\n @github_api ||= Github.new(oauth_token: self.token)\n end", "def github_client\n p = Project.find(params[:id])\n if p.github_token\n github = Github.new :oauth_token => p.github_token\n else\n github = Github.new :client_id => GITHUB_CLIENT_ID , :client_secret => GITHUB_CLIENT_SECRET\n end\n end", "def hubot_options\n {\n :adapter => 'irc',\n :name => 'henshall',\n :repo => 'https://github.com/matthutchinson/henshall.git',\n :campfire_account => '',\n :campfire_rooms => '',\n :campfire_token => '',\n :irc_server => 'irc.perl.org',\n :irc_rooms => '#henshall'\n }\nend", "def github_client\n Octokit::Client.new access_token: self.setting.user_with_token.client_token\n end", "def github_client\n Octokit::Client.new(:login => username, :oauth_token => token)\n end", "def initialize_api\n @github_api = ::Github::Repos.new do |github_config|\n github_config.endpoint = @endpoint if @endpoint\n github_config.site = @site if @site\n github_config.basic_auth = @auth\n github_config.repo = @repo\n github_config.org = @org\n github_config.adapter = :net_http\n github_config.ssl = {:verify => false}\n end\n end", "def add_git_facts\n # see if we're in a git repo. first, we need a directory that exists\n dir = @path.expand_path.ascend.find {|p| p.directory? }\n \n Dir.chdir(dir) do\n root_result = Cmds.new \"git rev-parse --show-toplevel\"\n \n unless root_result.ok?\n @result.in_git_repo = false\n @result.is_git_root = false\n return\n end\n \n @result.in_git_repo = true\n \n git = @result.git = Result.new\n git.root = Pathname.new root_result.out.chomp\n @result.is_git_root = @path == git.root\n \n user = git.user = Result.new\n \n ['name', 'email'].each {|key|\n user[key] = begin\n Cmds.chomp! \"git config user.#{ key }\"\n rescue\n end\n }\n \n git.origin = begin\n Cmds.chomp! \"git remote get-url origin\"\n rescue\n end\n \n match = GITHUB_SSH_URL_RE.match(git.origin) ||\n GITHUB_HTTPS_URL_RE.match(git.origin)\n \n git.is_github = !! match\n \n return unless match\n \n git.owner = match['owner']\n git.name = match['name']\n git.full_name = \"#{ git.owner }/#{ git.name }\"\n \n if true == @args['github_api']\n github = git.github = Result.new\n github.api_url = \"https://api.github.com/repos/#{ git.owner }/#{ git.name }\"\n \n response = Net::HTTP.get_response URI(github.api_url)\n \n if response.is_a? Net::HTTPSuccess\n # parse response body and add everything to github result\n parsed = JSON.parse response.body\n parsed.each {|k, v| github[k] = v}\n else\n # assume it's private if we failed to find it\n github.private = true\n end\n \n end\n end\n end", "def initial_push_command\n \"git remote add origin git@github.com:#{owner.login}/#{name}.git &&\\n\" +\n \"git push origin master &&\\n\" +\n \"git config --add branch.master.remote origin &&\\n\" +\n \"git config --add branch.master.merge refs/heads/master\" \n end", "def url\n \"http://github.com/#{login}\"\n end", "def set_remote\n return if @remote_type == :none\n\n url = \"git@github.com:pixelastic/#{@name}.git\" if @remote_type == :github\n if @remote_type == :bitbucket\n url = \"git@bitbucket.org:pixelastic/#{@name}.git\"\n end\n\n if create_remote('origin', url)\n puts '✔ Configuring remote'\n else\n puts '✘ Failed to configure remote'\n exit 1\n end\n end", "def github(name, ref = 'master')\n gitrepo \"github.com\", name, ref\nend", "def github_url\n case protocol\n when :ssh\n \"git@github.com:#{repo_identifier}.git\"\n when :https\n \"https://github.com/#{repo_identifier}.git\"\n when :git\n \"git://github.com/#{repo_identifier}.git\"\n else\n raise UnknownGitHubProtocol.new(protocol)\n end\n end", "def github=(value)\n conf['dashboard']['github'] = value.to_hash\n end", "def initialize(dependency, options = {})\n @repo_identifier = options.delete(:github)\n if repo_identifier.end_with?(\".git\")\n raise InvalidGitHubIdentifier.new(repo_identifier)\n end\n @protocol = (options.delete(:protocol) || DEFAULT_PROTOCOL).to_sym\n options[:git] = github_url\n super\n end", "def github_client\n Octokit::Client.new(\n access_token: ENV.try(:[], \"GITHUB_ACCESS_TOKEN\"),\n auto_paginate: true\n )\n end", "def git_init\n git.config('user.name', ENV['MACHINE_USER_NAME'])\n git.config('user.email', ENV['MACHINE_USER_EMAIL'])\n end", "def github_pull\n Extension.github_sync\n end", "def set_git_hub_repo\n @git_hub_repo = GitHubRepo.find(params[:id])\n end", "def configured_uri_for(uri)\n uri = uri.gsub(\"git@github.com:\", \"https://github.com/\")\n if /https?:/ =~ uri\n remote = URI(uri)\n config_auth =\n Bundler.settings[remote.to_s] || Bundler.settings[remote.host]\n remote.userinfo ||= config_auth\n remote.to_s\n else\n uri\n end\n end", "def githubize\n # method goes here\n end", "def generate_github_url\n prefix = Environment.config['github']['default_prefix']\n self.github = \"#{prefix}/#{slug}.md\"\n end", "def ghAuthenticate (username, password)\n\t\t# puts \"Enter GitHub Username:\"\n\t\t# username = \"\"\n\t\t# puts \"Enter GitHub Password:\"\n\t\t# password = \"\"\n\t\t# Octokit.auto_paginate = true\n\t\t@ghClient = Octokit::Client.new(:login => username.to_s, :password => password.to_s, :per_page =>100)\n\tend", "def set_from_config!(arg)\n @config_data = \n if arg.include?(\"://\")\n open(arg) {|io| io.read }\n elsif File.exist?(arg)\n @config_filename = arg\n IO.read(arg)\n else\n url = \"https://raw.github.com/#{arg}/#{DEFAULT_CONFIG_GITHUB_REPO}/master/#{DEFAULT_CONFIG_GITHUB_PATH}\"\n begin\n open(url) {|io| io.read }\n rescue\n raise RuntimeError, \"assuming this is a github account name, but config file does not exist!: #{url}\"\n end\n end\n raise \"config file doesn't look like config file\" unless is_config?(@config_data)\n (@data, @repos) = read_config_data(@config_data, @config_filename)\n self\n end", "def github_params\n if File.exist?(GITHUB_INFO_PATH)\n read_github_info\n else\n retrieve_options_from_user\n end\n end", "def initialize(user = nil, api_token = nil, repo_name = \"cookie_monster\") \n if user.nil?\n puts \"No user provided, getting from git config\"\n user = `git config --get github.user`.chomp\n end\n\n if api_token.nil?\n puts \"No API token provided, getting from git config\"\n api_token = `git config --get github.token`.chomp\n end\n\n\n @user = user.chomp # chomp in case user passes in bad data\n @api_token = api_token.chomp # chomp in case user passes in bad data\n @repo_name = repo_name\n\n # Authenticated client\n #@client = Octopussy::Client.new({:login => @user, :token => @api_token})\n\n # Location of local git repository. Necessary for pushing to Github.\n # Put it in .cloud_path so it doesn't conflict with anything\n @git_dir_path = File.expand_path(\"~/.cloud_path/\" + @repo_name)\n\n create_repo\n create_git_dir\n \n # For whatever reason, Repository.find raises Octopi::NotFound when\n # we've just created the repository in this run of the script.\n # Possibly a caching error.\n begin\n repo = Repository.find(:user => @user, :repo => @repo_name)\n rescue Octopi::NotFound\n puts \"Repository not found. Probably just created repository, please\"\n puts \"run this script again.\"\n exit 0\n end\n end", "def update_from_github(auth, cv)\n cv['email'] = auth.info.email if auth.info.email\n cv['password'] = Devise.friendly_token[0,20] if Devise.friendly_token[0,20]\n cv['name'] = auth.info.name if auth.info.name\n cv['image'] = auth.info.image if auth.info.image\n cv['biography'] = auth.extra.raw_info.bio if auth.extra.raw_info.bio\n token = auth.credentials.token if auth.credentials.token\n tmp = Array.new\n\n uri = URI(auth.extra.raw_info.repos_url)\n\n #repos = JSON.parse(open(uri.to_s, 'Authentication' => \"token #{token}\").read)\n\n HTTP.auth(\"token #{token}\")\n repos = JSON.parse(HTTP.get(uri.to_s).body)\n\n repos.each do |gitPr|\n if not gitPr['fork']\n uri = URI(gitPr['languages_url'])\n lang = JSON.parse(HTTP.get(uri.to_s).body)\n lang.each do |key,_|\n tmp << key\n end\n end\n end\n $uriTmp = auth.extra.raw_info.starred_url.to_s\n $realUri = $uriTmp.gsub(/{(.*?)}/,'')\n\n starred = JSON.parse(HTTP.get($realUri).body)\n starred.each do |gitPr|\n uri = URI(gitPr['languages_url'])\n lang = JSON.parse(HTTP.get(uri.to_s).body)\n lang.each do |key,_|\n tmp << key\n end\n end\n cv['it_languages'] = tmp.uniq\n cv['github_auth'] = true\n end", "def git\n\tend", "def githubAPIEndpoint()\n domain = 'api.github.com' unless ENV['HOMEBREW_PIPELINE_GITHUB_DOMAIN']\n return \"https://#{domain}/\"\n end", "def git_commit gitconfig\n #change dir to preview path\n #terminal_add gitconfig, terminal_info(I18n.t('git.message.push'))\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.push'), \"\")\n preview_dir = Rails.configuration.scribae['preview']['target']\n repo_path = Rails.root.join(preview_dir, gitconfig.repo)\n if Dir.exist? repo_path\n Dir.chdir repo_path\n cmds = [\n [\"git add .\", nil, false],\n [\"git commit -m \\\"gh-pages commit\\\"\", nil, false],\n [\"git push origin gh-pages\", nil, true]\n ]\n cmd_res = run_commands cmds, gitconfig\n if cmd_res\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.pushed'), \"\")\n end\n end\n end", "def github_test_parameters(repo)\n {\n \"name\" => \"pry\",\n # \"type\" => \"ruby\",\n \"summary\"=>\"An IRB alternative and runtime developer console\",\n \"license\" => \"MIT\",\n \"tag\"=>\"v0.10.4\",\n \"version\" => \"0.10.4\",\n }\nend", "def call\n if git_remote_command =~ /git@github.com:(.+).git/\n \"https://github.com/#{Regexp.last_match(1)}\"\n else\n git_remote_command.sub('.git', '').chomp\n end\n end", "def topic\n \"https://github.com/#{@repository.owner}/#{@repository.name}/events/pull_request\"\n end", "def topic\n \"https://github.com/#{@repository.owner}/#{@repository.name}/events/pull_request\"\n end", "def git_config\n unless options[:skip_git]\n puts \"Initializing git to project\"\n end\n end", "def giturl(project_name, repo_name) ; end", "def authenticate!\n redirect \"https://github.com/login/oauth/authorize?scope=user:email,read:org&client_id=#{CLIENT_ID}\"\nend", "def setup(api_host, options)\n token, username, password = options.values_at :token, :username, :password\n\n api_host = api_host.api_host if api_host.respond_to? :api_host\n @api_host = Addressable::URI.parse(api_host)\n @headers = {\n 'User-Agent' => options[:user_agent] || \"GH/#{GH::VERSION}\",\n 'Accept' => options[:accept] || 'application/vnd.github.v3+json',\n 'Accept-Charset' => 'utf-8'\n }\n\n @headers.merge! options[:headers] if options[:headers]\n @headers['Origin'] = options[:origin] if options[:origin]\n\n @prefix = ''\n @prefix << \"#{token}@\" if token\n @prefix << \"#{username}:#{password}@\" if username && password\n @prefix << @api_host.host\n\n faraday_options = { url: api_host }\n faraday_options[:ssl] = options[:ssl] if options[:ssl]\n faraday_options.merge! options[:faraday_options] if options[:faraday_options]\n\n @connection = Faraday.new(faraday_options) do |builder|\n builder.request(:authorization, :token, token) if token\n builder.request(:basic_auth, username, password) if username && password\n builder.request(:retry)\n builder.response(:raise_error)\n builder.use :instrumentation if defined? FaradayMiddleware::Instrumentation\n builder.response(:logger, nil, formatter: GH.const_get(options[:formatter].camelize)) if options[:formatter]\n builder.adapter(:net_http)\n end\n end", "def setup\n OmniAuth.config.test_mode = true\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({:provider => 'github',:uid => '123545',:info => {:name => 'Satine', :email => 'satine@catworld.com'}})\n end", "def github(repository, owner = 'siimple')\n \"https://github.com/#{owner}/#{repository}.git\"\n end", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def name\n 'GitHub'\n end", "def initialize_api_endpoint\n if PrMigrator.configuration.github_enterprise_endpoint\n Octokit.configure do |c|\n c.api_endpoint = PrMigrator.configuration.github_enterprise_endpoint\n end\n end\n end", "def client\n pry(Git::Hub.send(:client))\nend", "def github\n @github ||= begin\n if username.present? && github_access_token.present?\n Octokit::Client.new(login: username, oauth_token: github_access_token, auto_traversal: true)\n else\n nil\n end\n end\n end", "def gh_pull_request(data, config)\n action = data['action'] || nil\n pr = data['pull_request'] || nil\n\n Cyclid.logger.debug \"action=#{action}\"\n return true unless action == 'opened' \\\n or action == 'reopened' \\\n or action == 'synchronize'\n\n # Get the list of files in the root of the repository in the\n # Pull Request branch\n html_url = URI(pr['base']['repo']['html_url'])\n pr_sha = pr['head']['sha']\n ref = pr['head']['ref']\n\n Cyclid.logger.debug \"sha=#{pr_sha} ref=#{ref}\"\n\n # Get some useful endpoints & interpolate the SHA for this PR\n url = pr['head']['repo']['statuses_url']\n statuses = url.gsub('{sha}', pr_sha)\n\n url = pr['head']['repo']['trees_url']\n trees = url.gsub('{/sha}', \"/#{pr_sha}\")\n\n # Get an OAuth token, if one is set for this repo\n Cyclid.logger.debug \"attempting to find auth token for #{html_url}\"\n auth_token = nil\n config['repository_tokens'].each do |entry|\n entry_url = URI(entry['url'])\n auth_token = entry['token'] if entry_url.host == html_url.host && \\\n entry_url.path == html_url.path\n end\n\n # XXX We probably don't want to be logging auth tokens in plain text\n Cyclid.logger.debug \"auth token=#{auth_token}\"\n\n # Set the PR to 'pending'\n GithubStatus.set_status(statuses, auth_token, 'pending', 'Preparing build')\n\n # Get the Pull Request\n begin\n trees_url = URI(trees)\n Cyclid.logger.debug \"Getting root for #{trees_url}\"\n\n request = Net::HTTP::Get.new(trees_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(trees_url.hostname, trees_url.port)\n http.use_ssl = (trees_url.scheme == 'https')\n response = http.request(request)\n\n Cyclid.logger.debug response.inspect\n raise \"couldn't get repository root\" \\\n unless response.code == '200'\n\n root = Oj.load response.body\n rescue StandardError => ex\n Cyclid.logger.error \"failed to retrieve Pull Request root: #{ex}\"\n return_failure(500, 'could not retrieve Pull Request root')\n end\n\n # See if a .cyclid.yml or .cyclid.json file exists in the project\n # root\n job_url = nil\n job_type = nil\n root['tree'].each do |file|\n match = file['path'].match(/\\A\\.cyclid\\.(json|yml)\\z/)\n next unless match\n\n job_url = URI(file['url'])\n job_type = match[1]\n end\n\n Cyclid.logger.debug \"job_url=#{job_url}\"\n\n if job_url.nil?\n GithubStatus.set_status(statuses, auth_token, 'error', 'No Cyclid job file found')\n return_failure(400, 'not a Cyclid repository')\n end\n\n # Pull down the job file\n begin\n Cyclid.logger.info \"Retrieving PR job from #{job_url}\"\n\n request = Net::HTTP::Get.new(job_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(job_url.hostname, job_url.port)\n http.use_ssl = (job_url.scheme == 'https')\n response = http.request(request)\n raise \"couldn't get Cyclid job\" unless response.code == '200'\n\n job_blob = Oj.load response.body\n case job_type\n when 'json'\n job_definition = Oj.load(Base64.decode64(job_blob['content']))\n when 'yml'\n job_definition = YAML.load(Base64.decode64(job_blob['content']))\n end\n\n # Insert this repository & branch into the sources\n #\n # XXX Could this cause collisions between the existing sources in\n # the job definition? Not entirely sure what the workflow will\n # look like.\n job_sources = job_definition['sources'] || []\n job_sources << { 'type' => 'git',\n 'url' => html_url.to_s,\n 'branch' => ref,\n 'token' => auth_token }\n job_definition['sources'] = job_sources\n\n Cyclid.logger.debug \"sources=#{job_definition['sources']}\"\n rescue StandardError => ex\n GithubStatus.set_status(statuses,\n auth_token,\n 'error',\n \"Couldn't retrieve Cyclid job file\")\n Cyclid.logger.error \"failed to retrieve Github Pull Request job: #{ex}\"\n raise\n end\n\n Cyclid.logger.debug \"job_definition=#{job_definition}\"\n\n begin\n callback = GithubCallback.new(statuses, auth_token)\n job_from_definition(job_definition, callback)\n rescue StandardError => ex\n GithubStatus.set_status(statuses, auth_token, 'failure', ex)\n return_failure(500, 'job failed')\n end\n end", "def create_client\n token = File.open(GITHUB_TOKEN_FILE).read\n Octokit::Client.new(access_token: token)\nend", "def url\n \"http://github.com/#{repo.owner.login}/#{repo.name}/#{name}\"\n end", "def method_missing(method, *args)\n if @github.respond_to?(method)\n @github.send(method, *args)\n else\n super\n end\n end", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend\nend", "def client\n @client ||= Github::ApiProxy.new(@options[:access_token])\n end", "def github_client\n @github_client ||= begin\n if provider = self.omni_auth_providers.where(name: \"github\").first\n Octokit::Client.new(access_token: provider.access_token)\n end\n end\n end", "def github\n @github ||= (\n require 'detroit'\n require 'detroit-github'\n Detroit::GitHub.new(\n :folder => 'website'\n #:sitemap => {\n # 'index.html' => 'index.html',\n # 'doc.json' => 'doc.json',\n # 'assets' => 'assets'\n #}\n )\n ) \nend", "def set_git_hub_account\n @git_hub_account = GitHubAccount.find(params[:id])\n end", "def github_check\n begin\n unless github.blank?\n RestClient.get \"https://github.com/#{github}\"\n end\n rescue\n errors.add :base, \"Invalid Github account.\"\n end\n end", "def fetch_from_github\n repo, branch, path = Post.parse_github_url self.github\n Environment.github.contents repo, ref: branch, path: path\n end", "def push_to_repo\n return if @remote_type == :none\n\n if @remote_type == :bitbucket\n puts 'Cannot automatically create BitBucket repository.'\n puts 'Please, open it manually at https://bitbucket.org/repo/create'\n `#{ENV['BROWSER']} https://bitbucket.org/repo/create`\n return\n end\n\n return unless %i[github].include?(@remote_type)\n\n gh_options = [\n @name,\n ]\n gh_options << '--team algolia' if @is_algolia\n\n if @is_private\n gh_options << '--private'\n else\n gh_options << '--public'\n end\n\n command = \"gh repo create #{gh_options.join(' ')}\"\n\n if command_success?(command)\n puts '✔ Creating GitHub repository'\n else\n puts '✘ Failed to create GitHub repository'\n exit 1\n end\n\n if command_success?('git push origin main')\n puts '✔ Pushed to repository'\n else\n puts '✘ Failed to push to repository'\n exit 1\n end\n end", "def configure_repository\n UnixUser.match_ownership(@user.homedir, @path)\n\n # application developer cannot change git hooks\n hooks = File.join(@path, 'hooks')\n FileUtils.chown_R(0, 0, hooks)\n\n render_file = lambda { |f, m, t|\n File.open(f, 'w', m) { |f| f.write(ERB.new(t).result(binding)) }\n }\n\n render_file.call(File.join(@path, 'description'), 0644, GIT_DESCRIPTION)\n render_file.call(File.join(@user.homedir, '.gitconfig'), 0644, GIT_CONFIG)\n\n render_file.call(File.join(hooks, 'pre-receive'), 0755, PRE_RECEIVE)\n render_file.call(File.join(hooks, 'post-receive'), 0755, POST_RECEIVE)\n end", "def ask_token\n self.username = cli.prompt \"Your GitHub username: \"\n self.user_defined_token = cli.prompt_secret \"Your GitHub API token: \"\n end", "def create\n\t\t# we're sent here by the GET '/auth' => 'sessions#create' route\n\t\t# response = Faraday.post(\"https://github.com/login/oauth/access_token\") do |request|\n\t\t# \trequest.headers['Accept'] = 'application/json'\n\t\t# \trequest.body = JSON.generate({\n\t\t# \t\t\t'client_id': ENV[\"GITHUB_CLIENT_ID\"],\n\t\t# \t\t\t'client_secret': ENV[\"GITHUB_CLIENT_SECRET\"],\n\t\t# \t\t\t'code': params[:code]\n\t\t# \t\t})\n\t\t# end\n\t\t# could also be written \n\t\tresponse = Faraday.post \"https://github.com/login/oauth/access_token\", {client_id: ENV[\"GITHUB_CLIENT_ID\"], client_secret: ENV[\"GITHUB_CLIENT_SECRET\"],code: params[:code]}, {'Accept' => 'application/json'}\n\n\t\t# this is sent back by github under the following form by default\n\t\t# access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&scope=user%2Cgist&token_type=bearer\n\t\t# and since we asked for headers \"Accept: application/json\"\n\t\t# {\"access_token\":\"e72e16c7e42f292c6912e7710c838347ae178b4a\", \"scope\":\"repo,gist\", \"token_type\":\"bearer\"}\n\t\taccess_hash = JSON.parse(response.body)\n\t\tsession[:token] = access_hash[\"access_token\"]\n\n\t\t##### Now we have the token and we can use it to access the API\n\n\t\t# we make a call to get the username\n\t\tuser_response = Faraday.get \"https://api.github.com/user\", {}, {'Authorization' => \"token #{session[:token]}\", 'Accept' => 'application/json'}\n\t\t# parse the response body\n\t\tuser_json = JSON.parse(user_response.body)\n\t\t# set the username into the session\n\t\tsession[:username] = user_json[\"login\"]\n\t\tbinding.pry\n\t\t# next step happens in the root path (repositories#index)\n\t\tredirect_to root_path\n\tend", "def push\n ensure_git_and_cucumber_available\n ensure_repository\n\n puts \"Not implemented yet... pull request for push please!\"\n end", "def git_commit_and_push(cookbook_path, github_url)\n if File.exists?(File.join(cookbook_path, \".git\"))\n shell_out(\"git remote rm origin\", :cwd => cookbook_path)\n else\n shell_out!(\"git init\", :cwd => cookbook_path)\n end\n shell_out!(\"echo - $(date): Uploaded with knife github plugin. >> CHANGELOG.md \", :cwd => cookbook_path)\n shell_out!(\"git add .\", :cwd => cookbook_path)\n shell_out!(\"git commit -m 'creating initial cookbook structure from the knife-github plugin' \", :cwd => cookbook_path)\n shell_out!(\"git remote add origin #{github_url} \", :cwd => cookbook_path)\n shell_out!(\"git push -u origin master\", :cwd => cookbook_path)\n end", "def ask_credentials\n self.username = cli.prompt \"Your GitHub username: \"\n self.password = cli.prompt_secret \"Your GitHub password (never stored): \"\n end", "def repo; end", "def repo; end", "def repo; end", "def repo; end", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend" ]
[ "0.7129416", "0.70996153", "0.7029434", "0.7017209", "0.6754193", "0.6749698", "0.6732055", "0.65345645", "0.64636636", "0.6334358", "0.6310106", "0.6276585", "0.62754583", "0.6262421", "0.6260535", "0.6244621", "0.62389463", "0.6169483", "0.6135728", "0.612746", "0.6100987", "0.6084692", "0.6070202", "0.6052437", "0.602385", "0.5987857", "0.59850305", "0.59790075", "0.5969387", "0.5961674", "0.5960435", "0.59592825", "0.5943982", "0.5931905", "0.59158087", "0.5866947", "0.583393", "0.5806103", "0.5765971", "0.575055", "0.5748787", "0.57421273", "0.5728895", "0.57147086", "0.5704318", "0.57009864", "0.56890786", "0.5685364", "0.5667107", "0.5667107", "0.5657969", "0.5643328", "0.5642686", "0.5627233", "0.5619175", "0.56100404", "0.55971146", "0.55971146", "0.55971146", "0.55971146", "0.55971146", "0.55971146", "0.55971146", "0.55971146", "0.55971146", "0.55971146", "0.5596046", "0.55834603", "0.5576516", "0.557589", "0.55342215", "0.5525716", "0.5522984", "0.5520719", "0.5502314", "0.5502079", "0.549894", "0.5488747", "0.54861724", "0.5482446", "0.54732174", "0.5470184", "0.5466268", "0.54641354", "0.5462009", "0.5455714", "0.5431451", "0.5425921", "0.5415216", "0.5415216", "0.5415216", "0.5415216", "0.5413236", "0.5413236", "0.5413236", "0.5413236", "0.5413236", "0.5413236", "0.5413236", "0.5413236" ]
0.6886085
4
Configure how to communicate with Travis
def config_travis(api_key, private_repo) @travis = TravisCI.new(api_key: api_key, private_repo: private_repo) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def travis\n Log.fatal('You did not configure Travis yet.') unless @travis\n @travis\n end", "def create_travis(name, platforms)\n\n File.open('.travis.yml', 'w') { |file| \n file.puts(\"language: objective-c\")\n file.puts(\"osx_image: xcode8.2\")\n file.puts(\"env:\")\n file.puts(\" matrix:\")\n\n platforms.each do |platform|\n\n scheme = \"#{name} #{platform}\"\n\n case platform\n when 'iOS'\n \n file.puts(\n \" - DESTINATION=\\\"platform=iOS Simulator,OS=9.3,name=iPad 2\\\"\"\n )\n \n file.puts(\" SCHEME=\\\"#{scheme}\\\"\")\n \n file.puts(\n \" - DESTINATION=\\\"platform=iOS Simulator,OS=10.0,name=iPad Pro (12.9 inch)\\\"\"\n )\n\n file.puts(\" SCHEME=\\\"#{scheme}\\\"\")\n\n when 'macOS'\n file.puts(\" - DESTINATION=\\\"platform=OS X\\\"\")\n file.puts(\" SCHEME=\\\"#{scheme}\\\"\") \n end\n end\n\n file.puts()\n file.puts(\"before_script: if [ -f ./Cartfile ]; then carthage update; fi;\")\n file.puts()\n file.puts(\"script: travis_retry xcodebuild test\")\n file.puts(\" -project #{name}.xcodeproj\")\n file.puts(\" -scheme \\\"${SCHEME}\\\"\")\n file.puts(\" -destination \\\"${DESTINATION}\\\"\")\n file.puts(\" TOOLCHAINS=swift\")\n file.puts()\n file.puts(\"after_success:\")\n file.puts(\" - bash <(curl -s https://codecov.io/bash)\")\n } \nend", "def travis_sync\n res = $travis_conn.post 'user/453045/sync'\n res.travis_raise\n res.success?\nend", "def setup(build, launcher, listener)\n listener << 'Bash execute'\n launcher.execute('bash', '-c', 'echo hello', {out: listener})\n end", "def include_travis\n begin\n require 'travis'\n rescue\n error_message = \"Error: Problem including Travis. Retrying ...\"\n puts error_message\n sleep 2\n include_travis\n end\nend", "def include_travis\n begin\n require 'travis'\n rescue\n error_message = \"Error: Problem including Travis. Retrying ...\"\n puts error_message\n sleep 2\n include_travis\n end\nend", "def configure\n send_command \"--configure\"\n end", "def configure_git\n run_simple 'git config user.name Cucumber'\n run_simple 'git config user.email cucumber@`hostname --fqdn`'\nend", "def setup\n redmine_base_url=ENV['REDMINE_BASE_URL']\n redmine_api_key=ENV['REDMINE_API_KEY']\n slack_webhook_url=ENV['SLACK_WEBHOOK_URL']\n verbose = ENV['VERBOSE'] == '1'\n slack_off = ENV['SLACK_OFF'] == '1'\n\n kv = KeyValueStore.new(ENV[\"DATABASE_URL\"])\n rAPI = RedmineSlack::RedmineAPI.new(redmine_base_url, redmine_api_key, verbose:verbose)\n slack_api = RedmineSlack::SlackAPI.new(slack_webhook_url, verbose:verbose)\n slack_api.channel_override = ENV['SLACK_CHANNEL_OVERRIDE']\n slack_api.enabled = !slack_off\n\n RedmineSlack::RedmineSlackGlue.new(rAPI, slack_api, kv, verbose:verbose)\nend", "def config(name, platforms=['iOS', 'macOS'])\n create_gitignore\n create_travis(name, platforms)\n create_swift_lint\n create_hound\n create_cartfile\n create_readme(name, platforms)\nend", "def initialize(name)\n @name = \"travis-#{name}\"\n end", "def setup(*args)\n force = (args.empty? ? false : true)\n current_project.setup(force)\n\n # output\n show_jmeter_plans\n show_load_agents\n show_target_hosts\n end", "def start_testacular(config, misc_options)\n sh \"testacular start \" +\n \"#{config} \" +\n \"#{(misc_options || '').gsub('+', ',')}\"\nend", "def setup_config\n # To be Extended\n end", "def configure_saucelabs\n end", "def prebuild(build, listener)\n init(build, nil, listener)\n listener.info \"Prebuild\"\n\n travis_file = workspace + '.travis.yml'\n unless travis_file.exist?\n listener.error\"Travis config `#{travis_file}' not found\"\n raise \"Travis config file not found\"\n end\n listener.info \"Found travis file: #{travis_file}\"\n @config = YAML.load(travis_file.read)\n\n @gemfile = @config['gemfile'] || 'Gemfile'\n @gemfile = nil unless (workspace + @gemfile).exist?\n @config['script'] ||= @gemfile ? \"bundle exec rake\" : 'rake'\n\n listener.info \"Prebuild finished\"\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\n end", "def setup\n\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 setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\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 re_run_basic_smoke_test\n beaker = \"bundle exec beaker --debug --root-keys --repo-proxy\"\n beaker += \" --preserve-hosts always\"\n beaker += \" --type aio\"\n beaker += \" --helper acceptance/lib/helper.rb\"\n beaker += \" --options-file #{BEAKER_OPTIONS_FILE}\"\n beaker += \" --load-path acceptance/lib\"\n beaker += \" --config acceptance/scripts/hosts.cfg\"\n beaker += \" --keyfile ~/.ssh/id_rsa-acceptance\"\n beaker += \" --tests acceptance/suites/tests/00_smoke\"\n\n sh beaker\nend", "def tests\n CircleCi.request(conf, \"#{base_path}/#{build}/tests\").get\n end", "def cmd_notify_help\n\t\t\t\tputs \"Run notify_set_user, notify_set_webhook, and notify_set_source to setup Slack config. Then run notify_save to save them for later. Use notify_test to test your config and load it from the YAML file in the future. Finally, run notify_start when you have your listener setup.\"\n\t\t\tend", "def setup\n true\n end", "def setup(options); end", "def setup(options); end", "def configure_tasks\n end", "def setup\n @executor = NagiosHerald::Executor.new\n @options = {}\n @options[:env] = File.join(File.dirname(__FILE__), '..', 'env_files', 'check_disk.CRITICAL_ICINGA')\n end", "def configure; end", "def initialize\n configure_via_yaml\n configure_via_env\n end", "def set_up_test_env\n\t\t`ruby expect_test_v1.rb`\n\tend", "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 setup\n # override this if needed\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def setup(*args) ; end", "def setup\n @watchlist = YAML.load_file(WATCHLIST)\n @config = YAML.load_file(CONFIG)\n\n @transmission_api_client = TransmissionApi::Client.new(\n :url => @config['transmission_api_client']['url'],\n :username => @config['transmission_api_client']['username'],\n :password => @config['transmission_api_client']['password']\n )\n end", "def setup\r\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\n \n end", "def setup()\n end", "def setup\n make_config\n make_users_file\n end", "def testing_env\n {\n \"HAS_JOSH_K_SEAL_OF_APPROVAL\" => \"true\",\n \"TRAVIS_PULL_REQUEST\" => \"800\",\n \"TRAVIS_REPO_SLUG\" => \"artsy/eigen\",\n \"TRAVIS_COMMIT_RANGE\" => \"759adcbd0d8f...13c4dc8bb61d\",\n \"DANGER_GITHUB_API_TOKEN\" => \"123sbdq54erfsd3422gdfio\"\n }\nend", "def configure\n reconfigure_notifier\n end", "def configure\n reconfigure_notifier\n end", "def setup_environment; end", "def setup\n @configure = Hatemile::Util::Configure.new\n end", "def setup(ant)\n true\n end", "def setup\n\t\tend", "def setup\n\t\tend", "def testing_env\n {\n 'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',\n 'TRAVIS_PULL_REQUEST' => '800',\n 'TRAVIS_REPO_SLUG' => 'artsy/eigen',\n 'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',\n 'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'\n }\nend", "def setup\n puts \"\\nSetting up ladon-batch...\"\n _print_separator_line\n\n self.handle_flag(BATCH_NAME)\n self.handle_flag(CONFIG_FILE_PATH)\n\n puts 'Error processing config file; batch will not be executed.' unless result.success?\n end", "def run_actions\n # List vhosts\n if ( @options[:actions].include?(:web_server) || @options[:actions].include?(:list_vhosts))\n @nginx = Cheese::Nginx::Config.new(NGINX_CONF)\n end\n \n if @options[:actions].include? :list_vhosts\n Cheese::Verbose.log_task(\"listing vhosts in nginx.conf\") do\n begin\n @nginx.domains.each_with_index {|domain, i| puts \"#{i}. #{domain.vhost.domain} - #{domain.proxy.ports.size} threads\" }\n rescue Exception => e\n puts \"Error listing vhosts:\"\n puts e.message\n puts \"exiting\"\n exit\n end\n end\n end\n\n # Nginx\n if @options[:actions].include? :web_server\n begin\n Cheese::Verbose.log_task(\"back up nginx.conf\") do\n FileUtils.cp(NGINX_CONF, NGINX_CONF + \".old\") if File.exists?(NGINX_CONF)\n end\n rescue Errno::EPERM\n puts \"This script must be run with root privileges\"\n exit\n rescue Errno::EACCES\n puts \"This script must be run with root privileges\"\n exit\n end\n \n case @options[:remove]\n when false\n Cheese::Verbose.log_task(\"create nginx vhost (#{@options[:name]})\") do\n @added_domain = @nginx.add @options\n end\n when true\n Cheese::Verbose.log_task(\"remove nginx vhost (#{@options[:name]})\") do \n @removed_domain = @nginx.remove @options\n end\n end\n \n @nginx.save\n @nginx.restart\n end\n \n # Subversion\n if @options[:actions].include? :scm\n if @options[:remove]\n Cheese::Verbose.log_task(\"remove subversion repository (#{@options[:name]})\") do\n svn = Cheese::Subversion::Repository.remove @options[:name]\n end\n else\n Cheese::Verbose.log_task(\"add subversion repository (#{@options[:name]})\") do\n svn = Cheese::Subversion::Repository.create @options[:name]\n end\n Cheese::Verbose.log_task(\"set the default permissions on the repository\") do\n user, pass = @preferences[:scm_user].chomp, @preferences[:scm_pass].chomp\n Cheese::Subversion::Repository.set_permissions( :name => @options[:name],\n :access => {:anon => :none, :auth => :write},\n :users => {:user => user, :pass => pass})\n end\n end\n end\n\n # Mongrel cluster file\n if @options[:actions].include? :app_server\n if @options[:remove]\n Cheese::Verbose.log_task(\"remove the mongrel_cluster file\") do\n Cheese::Mongrel.remove(@removed_domain)\n end\n else\n Cheese::Verbose.log_task(\"create the mongrel_cluster file\") do\n Cheese::Mongrel.create(@options[:name], @added_domain.proxy.ports)\n end\n end\n end\n \n # Database\n if @options[:actions].include? :database\n if @options[:remove]\n Cheese::Verbose.log_task(\"drop a database\") do\n Cheese::Verbose.log_task(\" requiring lib/#{@options[:database_type]}\")\n require \"database/#{@options[:database_type]}\"\n Cheese::Verbose.log_task(\" creating class #{@options[:database_type].to_s.capitalize}\")\n db_klass = Cheese.const_get(@options[:database_type].to_s.capitalize.intern)\n Cheese::Verbose.log_task(\" executing remove command on #{@options[:name]}\")\n db_klass.remove(@options[:name])\n end\n else\n Cheese::Verbose.log_task(\"create a database\") do\n Cheese::Verbose.log_task(\" requiring lib/#{@options[:database_type]}\")\n require \"database/#{@options[:database_type]}\"\n Cheese::Verbose.log_task(\" creating class #{@options[:database_type].to_s.capitalize}\")\n db_klass = Cheese.const_get(@options[:database_type].to_s.capitalize.intern)\n Cheese::Verbose.log_task(\" executing create command\")\n db_klass.create(@options[:name])\n end\n end\n end\n end", "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 finish_linux_configuration\n\n configure do\n\n user = add_parameter 'username', {type: 'string'}\n pwd = add_parameter 'ssh_key', {type: 'string'}\n\n end\n\n end", "def run_simple_check(server)\n behavior(:test_mail_config, server)\n behavior(:test_syslog_config, server)\n end", "def run_simple_check(server)\n behavior(:test_mail_config, server)\n behavior(:test_syslog_config, server)\n end", "def configure_command(cmd)\n end", "def init( args )\n # Make sure we're in a folder with a Sitefile\n options = app.standard_rake_options\n [['--rakefile', 'StratusSite'],\n ['--no-search', nil],\n ['--silent', nil]].each {|opt, value| options.assoc(opt).last.call(value)}\n\n unless app.have_rakefile\n @mode = :app\n end\n\n import_default_tasks\n import_website_tasks\n require_lib_files\n capture_command_line_args(args)\n \n # if args.length == 0 && @mode == :app\n # puts \"Try using:\\n stratus -T\"\n # end\n \n args\n end", "def test_harness_dependencies(*)\n return unless platform[/n(5|6)k/]\n skip_if_nv_overlay_rejected(agent)\n\n # Vxlan has a hard requirement to disable feature fabricpath on n5/6k\n cmd = 'no feature-set fabricpath'\n command_config(agent, cmd, cmd)\nend", "def configure\n if @opts[:docker]\n Souschef::Print.info 'Creating Docker configuration .kitchen.local.yml'\n write(:docker, Souschef::Testkitchen::Docker.new(@cookbook).yaml)\n end\n if @opts[:solusvm]\n Souschef::Print.info 'Creating SolusVM configuraton .kitchen.local.yml'\n write(:solusvm, Souschef::Testkitchen::Solusvm.new(@cookbook).yaml)\n end\n\n Souschef::Print.info 'Creating Vagrant configuration in .kitchen.yml'\n write(:virtualbox, Souschef::Testkitchen::Virtualbox.new(@cookbook).yaml)\n end", "def beaker_tests\n ENV['TESTS'] || ENV['TEST'] || 'tests'\nend", "def setup\n# @api = DDOS_API.new(1000, 'localhost', @@port)\n @api = DDOS_API.new(:failover_timeout=>1000, :local_ip=>'localhost', :local_port=>@@port)\n @@port += 1\n # @api.config_api('testingConfig.txt')\n end", "def use_local_sources()\n return ENV.has_key?('USE_LOCAL_SOURCES') || ENV['TRAVIS_PULL_REQUEST'] == 'false'\nend", "def cmd_notify_test\n\t\t\t\tprint_status(\"Sending tests message\")\n\t\t\t\tif read_settings()\n\t\t\t\t\tself.framework.events.add_session_subscriber(self)\n\t\t\t\t\tdata = \"{'text': '#{@user_name} Metasploit is online on #{$source}! Hack the Planet!', 'channel': '#{@channel}', 'username': '#{@bot_name}', 'icon_emoji': 'http://emojipedia-us.s3.amazonaws.com/cache/46/2e/462e369e465fd7b52537f6370227b52b.png'}\"\n\t\t\t\t\turl = URI.parse(@webhook_url)\n\t\t\t\t\thttp = Net::HTTP.new(url.host, url.port)\n\t\t\t\t\thttp.use_ssl = true\n\t\t\t\t\tresp = http.post(url.path, data)\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Could not set Slack Web API settings.\")\n\t\t\t\tend\n\t\t\tend", "def options\n [\n ['--with-lcov', 'Enable Code Coverage support using lcov.'],\n ['--with-check', 'Run the test suite during install ~30sec']\n ]\n end", "def travis_running?(x)\n x = $travis_conn.get 'repo/%s/builds' % x.sub('/', '%2F')\n x.travis_raise\n state = MultiJson.load(x.body)[\"builds\"][0]['state']\n return [\"started\", \"running\", \"queued\"].include? state\nend", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end" ]
[ "0.74411035", "0.6312183", "0.6096012", "0.6034233", "0.5999066", "0.5999066", "0.58172834", "0.57950306", "0.57585853", "0.5740117", "0.5728505", "0.5686742", "0.5658344", "0.5652492", "0.5639438", "0.5622121", "0.561829", "0.561829", "0.561829", "0.561829", "0.561829", "0.56023663", "0.56023663", "0.5573129", "0.5573129", "0.5573129", "0.5573129", "0.5573129", "0.5573129", "0.5573129", "0.5573129", "0.5573129", "0.5573129", "0.5573129", "0.5573129", "0.557154", "0.5559329", "0.55396783", "0.55328536", "0.55313885", "0.55198425", "0.55198425", "0.5519116", "0.5497127", "0.5494005", "0.54838663", "0.54661614", "0.5463852", "0.5463852", "0.5463852", "0.5463852", "0.5463852", "0.5463852", "0.5460023", "0.54493773", "0.54493773", "0.54493773", "0.5444555", "0.54199094", "0.54189676", "0.54170835", "0.54170835", "0.54170835", "0.54170835", "0.54170835", "0.54170835", "0.54170835", "0.54090464", "0.5367949", "0.5366147", "0.53557277", "0.53557277", "0.5353208", "0.5350558", "0.5342895", "0.5342307", "0.5342307", "0.53360844", "0.53310925", "0.5327851", "0.5326176", "0.5320644", "0.5318629", "0.5318629", "0.53164315", "0.5289489", "0.5275546", "0.5272939", "0.5269275", "0.5262319", "0.525287", "0.5251531", "0.5245622", "0.5244207", "0.5241909", "0.5241909", "0.5241909", "0.5241909", "0.5241909", "0.5241909" ]
0.6768809
1
While working with bash commands, some commands are not added to the path. That's annoying. Convenient method to assign a command to a path for replacing. Example: ci.path("dockercompose", "/opt/bin/dockercompose") Now, when you use ci.sh("dockercompose f ... up d"), it will run "/opt/bin/dockercompose f ... up d" instead.
def path(command, path) @paths[command] = path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sh(cmd)\n `#{cmd}`\nend", "def cmd(str)\n return `cd #{APP_DIR}; #{str}`\nend", "def sh(command)\n provider.sh command\n end", "def absolute_command(cmd, path: nil)\n was_array = cmd.is_a?(Array)\n cmd = if was_array\n cmd.dup\n else\n Shellwords.split(cmd)\n end\n # Don't try to touch anything if the first value looks like a flag or a path.\n if cmd.first && !cmd.first.start_with?('-') && !cmd.first.include?(::File::SEPARATOR)\n # If which returns false, just leave it I guess.\n cmd[0] = which(cmd.first, path: path) || cmd.first\n end\n cmd = Shellwords.join(cmd) unless was_array\n cmd\n end", "def sh cmd\n puts cmd\n put `#{cmd}`\nend", "def exec_on!(command_str,current_path_str)\n exec!(\"cd #{current_path_str};\" + command_str)\n end", "def command_with(command, params)\n [\"cd #{path}\", send(\"handle_#{command}\", params)].join(' && ')\n end", "def shell_commands(cmd, args); end", "def exec_in_path(command)\n ENV['PATH'].split(':').collect {|d| Dir.entries d if Dir.exists? d}.flatten.include?(command)\n end", "def docker_cmd(cmd, container)\n \"docker run -it --rm --name #{cmd} -v #{Dir.pwd}/src:/root -w /root #{container} #{cmd}\"\nend", "def execute(command)\n sh('-c',command)\n end", "def cli_path; end", "def test_command(args='')\n File.join(File.expand_path(File.dirname(__FILE__)),'command_for_tests.sh') + ' ' + args\n end", "def cmd(c)\n @tpath = ''\n case File.basename(Dir.pwd)\n when 'bwkfanboy'\n # test probably is executed from the Rakefile\n @tpath = 'test/'\n 'bin/' + c\n when 'test'\n # we are probably in the test directory\n '../bin/' + c\n else\n # tests were invoked by 'gem check -t bwkfanboy'\n begin\n Dir.chdir(Bwkfanboy::Utils.gem_dir_system + '/../../test')\n '../bin/' + c\n rescue\n raise \"running tests from '#{Dir.pwd}' isn't supported: #{$!}\"\n end\n end\nend", "def get_fuseki_command_prefix(args)\n args[:path] ? \"cd #{args[:path]}; #{args[:path]}/\" : \"\"\n end", "def execute(command)\n system \"#{command}\" # rubocop:disable UnneededInterpolation\nend", "def sh(*parts)\n puts \"#{\"$\".magenta} #{parts.join(\" \").cyan}\"\n system(\"sh\", \"-c\", *parts)\n end", "def run_command(command)\n `#{command}`\nend", "def shell(cmd)\n `#{cmd}`\n end", "def shell(cmd)\n `#{cmd}`\n end", "def test_to_bash_equals_to_s_for_pathnames_without_user_home\n path = Pathname.new( '/usr/local/bin' )\n assert_equal( path.to_s, path.to_bash )\n end", "def cucumber_command(paths, options)\n cmd = []\n _add_cmd_prefix(cmd, options[:command_prefix])\n _add_rvm_options(cmd, options[:rvm])\n _add_bundler_options(cmd, options[:bundler])\n cmd << cucumber_exec(options)\n _add_cli_options(cmd, options[:cli])\n _add_notification(cmd, options)\n\n (cmd + paths).join(\" \")\n end", "def sh(service) = execute(method: :shell, service: service)", "def existing_docker_compose_path\n existing_docker_compose_path = Mixlib::ShellOut.new(\"which docker-compose\")\n\n existing_docker_compose_path.run_command\n\n existing_path = ''\n\n existing_path = existing_docker_compose_path.stdout.strip unless existing_docker_compose_path.stdout.empty?\n\n existing_path\nend", "def cli_path=(_arg0); end", "def shell_commands(cmd, *args); end", "def create_command(command, destination_path)\n if Utility.windows?\n command << destination_path\n else\n command << Shellwords.escape(destination_path)\n end\n command.join(' ')\n end", "def execdir(command)\n end", "def exec(cmd)\n puts cmd\n `#{cmd}`\nend", "def cmd_shell(*args)\n\t\t\tpath = \"/bin/bash -i\"\n\t\t\tcmd_execute(\"-f\", path, \"-c\", \"-i\")\n\tend", "def execute(command)\n system \"#{command}\"\nend", "def execute(command)\n system \"#{command}\"\nend", "def sh cmd, working_dir=@path\n opts = {}\n if working_dir\n opts[:chdir] = working_dir\n mkdir_p working_dir unless exists? working_dir\n end\n\n puts \" #{File.basename(working_dir)}$ #{cmd}\"\n\n process = POSIX::Spawn::Child.new cmd, opts\n\n unless process.success?\n raise \"Command #{cmd} failed. out: #{process.out}\\nerr: #{process.err}\"\n end\n\n out = process.out\n out ? out.strip : out\n end", "def execute(command)\r\n system \"#{command}\"\r\nend", "def base_commands(dir, env = {})\n artifact_cache_dir = File.join(@job.project.repository.repo_cache_dir, \"artifacts\")\n FileUtils.mkdir_p(artifact_cache_dir)\n env[:CACHE_DIR] = artifact_cache_dir\n\n commands = env.map do |key, value|\n \"export #{key}=#{value.to_s.shellescape}\"\n end\n\n [\"cd #{dir}\"].concat commands\n end", "def cucumber_command(paths, options)\n cmd = []\n _add_cli_options(cmd, options[:cmd] || \"cucumber\")\n _add_notification(cmd, options)\n _add_cli_options(cmd, options[:cmd_additional_args])\n (cmd + paths).join(\" \")\n end", "def sh?(*cmd)\n puts(\"+ #{cmd.join(' ')}\")\n system(*cmd)\nend", "def ruby_mixin_command(command)\n if new_resource.parent && new_resource.parent.app_state[:bundler_binary]\n if command.is_a?(Array)\n [new_resource.parent.app_state[:bundler_binary], 'exec'] + command\n else\n \"#{new_resource.parent.app_state[:bundler_binary]} exec #{command}\"\n end\n elsif new_resource.parent_ruby && new_resource.parent_ruby.gem_binary\n is_array = true\n if !command.is_a?(Array)\n is_array = false\n command = Shellwords.split(command)\n end\n binary = command.shift\n command = [::File.expand_path(binary, ruby_gem_bindir)] + command\n if !is_array\n command = Shellwords.join(command)\n end\n command\n else\n command\n end\n end", "def command\n [env, *rvm_context_prefix, 'ruby', path, '--use-color=true'] # for test unit\n # [env, *rvm_context_prefix, 'ruby', path] # for minitest\n end", "def mkdir(path)\n cmd 'mkdir', path\nend", "def which(cmd, extra_path: %w{/bin /usr/bin /sbin /usr/sbin}, path: nil)\n # If it was already absolute, just return that.\n return cmd if cmd =~ /^(\\/|([a-z]:)?\\\\)/i\n # Allow passing something other than the real env var.\n path ||= ENV['PATH']\n # Based on Chef::Mixin::Which#which\n # Copyright 2010-2015, Chef Softare, Inc.\n paths = path.split(File::PATH_SEPARATOR) + extra_path\n paths.each do |candidate_path|\n filename = ::File.join(candidate_path, cmd)\n return filename if ::File.executable?(filename)\n end\n false\n end", "def lib_sh(cmd)\n sh \"RUBYLIB=lib #{cmd}\"\nend", "def filter_command(envs, cmd)\n new_env = {}\n merged_path = ENV[\"PATH\"].split(/:/)\n new_cmd = cmd\n envs.each do |env|\n case env\n when /=/\n k,v = env.split(/\\s*=\\s*/, 2)\n expand_parm(k,v,cmd) {|c, ae, p| new_env.update(ae); new_cmd = c; merged_path << p; }\n else\n expand(env,cmd) {|c, ae, p| new_env.update(ae); new_cmd = c; merged_path << p; }\n end\n end\n ENV[\"PATH\"] = merged_path.uniq.compact.join(\":\")\n [new_cmd.flatten.compact, new_env]\nend", "def command(command, paths)\n # default is list\n return list([]) if command.nil?\n # choose other command\n case command\n when 'create' then create paths\n when 'list' then list paths\n when 'finish' then finish paths\n when 'unfinish' then unfinish paths\n when 'cleanup' then cleanup paths\n when 'help' then help\n else unknown_command(command)\n end\n end", "def sh(command)\n puts command\n system command unless dry_run\nend", "def prepare_command(path, ctrlcfg)\n home = check_not_empty PuppetX::Coi::Jboss::Configuration.config_value(:home)\n jboss_cli = \"#{home}/bin/jboss-cli.sh\"\n environment = ENV.to_hash\n environment['JBOSS_HOME'] = home\n\n cmd = \"#{jboss_cli} #{timeout_cli} --connect --file=#{path} --controller=#{ctrlcfg[:controller]}\"\n cmd += \" --user=#{ctrlcfg[:ctrluser]}\" unless ctrlcfg[:ctrluser].nil?\n unless ctrlcfg[:ctrlpasswd].nil?\n environment['__PASSWD'] = ctrlcfg[:ctrlpasswd]\n cmd += ' --password=$__PASSWD'\n end\n PuppetX::Coi::Jboss::Value::Command.new cmd, environment\n end", "def run(command, *args)\n sh \"#{command} #{args.join(' ')}\"\nend", "def system(command, *opts)\n if opts.empty?\n\tif command =~ /\\*|\\?|\\{|\\}|\\[|\\]|<|>|\\(|\\)|~|&|\\||\\\\|\\$|;|'|`|\"|\\n/\n\t return SystemCommand.new(@shell, find_system_command(\"sh\"), \"-c\", command)\n\telse\n\t command, *opts = command.split(/\\s+/)\n\tend\n end\n SystemCommand.new(@shell, find_system_command(command), *opts)\n end", "def run_sh(cmd)\n begin; sh cmd; rescue; end\nend", "def bash(command)\n require 'shellwords'\n escaped_command = Shellwords.escape(command)\n system \"bash -c #{escaped_command}\"\nend", "def build_cmd_paths_hash\n {}.tap do |hash|\n %w( which cat mkdir cp chown chmod rm tar chown ip ifconfig brctl ).each do |cmd|\n #hash[cmd] = `which #{cmd}`.strip\n hash[cmd] = \"/usr/bin/#{cmd}\"\n end\n #hash['lxc_bin'] = Pathname(`which lxc-create`.strip).parent.to_s\n hash['lxc_bin'] = \"/usr/bin\"\n end\n end", "def execute_system_command(val, target)\n SYSTEM_COMMAND_REGEX =~ val\n cmd = interpolate_string($1, target)\n\n if cmd =~ /^cd\\s+(.+)/i\n begin\n @@cd_history ||= []\n if $1 == \"-\"\n dest = @@cd_history.pop || Dir.pwd\n else\n dest = File.expand_path($1)\n end\n\n @@cd_history << Dir.pwd\n Dir.chdir(dest)\n rescue Errno::ENOENT\n output.puts \"No such directory: #{dest}\"\n end\n else\n if !system(cmd)\n output.puts \"Error: there was a problem executing system command: #{cmd}\"\n end\n end\n\n # Tick, tock, im getting rid of this shit soon.\n val.replace(\"\")\n end", "def invoke_path_command( path, *args )\n\t\traise \"#{path}: permission denied\" unless path.executable?\n\t\tif pid = Process.fork\n\t\t\tProcess.wait( pid )\n\t\telse\n\t\t\texec( path.to_s, *args )\n\t\tend\n\tend", "def typo3_cli_in_path(path, *cli_params)\n path_to_cli_dispatch = File.join(path, fetch(:path_to_typo3_cli))\n run_script(path, path_to_cli_dispatch, cli_params)\n end", "def command?(path)\n p = Pathname.new(path)\n p.relative? && p.basename == p\n end", "def sh_with_code(cmd)\n ShellTools.sh_with_code(cmd, @root)\n end", "def mkdir_p(path)\n cmd 'mkdir', '-p', path\nend", "def bundle_exec(command)\n sh \"bundle exec #{command}\"\nend", "def compose_cmd\n \"docker-compose -f #{specfile} --project-name #{compose_name} --project-directory #{approot}\"\n end", "def command?(command)\n ENV['PATH'].split(':').any? do |directory|\n File.exists?(File.join(directory, command))\n end\nend", "def command\n if new_resource.parent_bundle\n bundle_exec_command(new_resource.command, path: environment['PATH'])\n else\n if new_resource.command.is_a?(Array)\n [new_resource.ruby] + new_resource.command\n else\n \"#{new_resource.ruby} #{new_resource.command}\"\n end\n end\n end", "def configure_command(cmd)\n end", "def atualAtaques\n system( \"cd sh && ./atual_ataques.sh\" )\nend", "def test_command_checks_for_binaries_each_time\n provider = newprovider\n\n provider.commands :testing => \"/no/such/path\"\n\n provider.stubs(:which).returns \"/no/such/path\"\n\n provider.command(:testing)\n assert_equal(\"/no/such/path\", provider.command(:testing), \"Did not return correct binary path\")\n end", "def git(path, cmd, log=true)\n $stdout.puts(\"#{path.sub(ROOT_PATH, '')}: git #{cmd}\") if log\n git_path = path / '.git'\n git_index = git_path / 'index'\n\n # The env can become polluted; breaking git. This will avoid that.\n %x[GIT_DIR=#{git_path}; GIT_WORK_TREE=#{path}; GIT_INDEX_FILE=#{git_index}; git #{cmd}]\nend", "def build_command(cmd)\n cmd\n end", "def exec_cmd(command, timeout = nil, environment = {})\n path_at_start = ENV['PATH']\n begin\n ENV['PATH'] = path_without_gem_dir\n @logger.debug(\"Setting PATH: #{ENV['PATH']}\")\n exec_cmd_in_context(command, timeout, environment)\n ensure\n @logger.debug(\"Resetting PATH: #{path_at_start}\")\n ENV['PATH'] = path_at_start\n end\n end", "def command?(name)\n `which #{name}`\n $?.success?\nend", "def command?(name)\n `which #{name}`\n $?.success?\nend", "def rvm_wrap_cmd(cmd, user_dir = nil)\n profile = find_profile_to_source(user_dir)\n %{bash -c \"source #{profile} && #{cmd.gsub(/\"/, '\\\"')}\"}\n end", "def validate_command_path\n command = self.command\n # TODO/REFACTOR: We're finding the command using everything until the first space. Kind of lame...\n command_executable = command.match(/(^[^\\s]+)/).try(:[], 1) # Get the name of the actual command\n unless command_executable.present?\n errors.add(:command, \"must contain a valid, executable system command.\")\n return false\n end\n\n cmd_abs_path = `which #{command_executable}`.chomp # Check for existance in executable path, get full path\n unless $?.to_i == 0\n errors.add(:command, \"must contain a valid, executable system command.\")\n return false\n end\n\n if cmd_abs_path == command_executable\n return true\n else\n # TODO/REFACTOR: We're finding the command using everything until the first space. Kind of lame...\n self.command = command.sub(/(^[^\\s]+)/, cmd_abs_path); # Replace command with full-path command\n return true\n end\n end", "def command_shell_string__from call, *args\n \"#{call} #{args.join \" \"}\"\n end", "def cd_and_sh( dir, cmds )\n Dir.chdir( dir ) do\n cmds.each do |cmd|\n sh cmd\n end\n end\n end", "def sh(command, fail_non_success: true)\n command = Command.path_replace(command, @paths)\n puts command.colorize(@color)\n\n result = @sh.run(command)\n process_shell_result(result, fail_non_success)\n\n result\n end", "def sh(cmd)\n #TODO: optimize by removing the extra shell\n #the Process class should be useful.\n $stderr.puts cmd\n if (!system(cmd)) then\n error \"Command failed: '#{$?}'\"\n end\nend", "def original_run_command; end", "def p4sh cmd\n sh \"#{cmd};\"\n end", "def check_from_sh(sh_command_opt)\n juli_command = File.join(Pathname.new(File.dirname(__FILE__)).realpath,\n '../bin/juli')\n test_dir = '/tmp/dir_for_juli_%d' % rand(100000000)\n FileUtils.mkdir(test_dir)\n begin\n Dir.chdir(test_dir) do\n assert system(juli_command, sh_command_opt)\n end\n ensure\n FileUtils.rm_rf(test_dir)\n end\n end", "def jenkins_bash(opts)\n\tid = jenkins_id(opts)\n\tputs \"### Accessing bash ###\"\n\tif id and id.length > 0\n\t\trun_in_shell \"docker exec -it #{id} bash\"\n\telse\n\t\tputs \"container not found\"\n\tend\nend", "def run_sh(cmd)\n sh cmd\nrescue StandardError\n # ignored\nend", "def `(*args)\n cmd = args[0].split(/\\s+/)[0] || ''\n if Util.shell_command_exists?(cmd)\n Kernel.`(*args)\n else\n raise \"Command '#{cmd}' doesn't exist.\"\n end\n end", "def which(cmd)\n path = \"/usr/local/bin/#{cmd}\"\n if not File.exists?(path)\n path = \"/sw/bin/#{cmd}\"\n end\n return path;\nend", "def sh(cmd)\n\t# Print the command to stdout.\n\tif(cmd.is_a?(Array))\n\t\tp cmd\n\telse\n\t\tputs cmd\n\tend\n\t# Run it.\n\tsuccess = system(cmd)\n\traise \"Command failed\" unless(success)\nend", "def windows_workaround\n execute 'chef-move' do\n command 'move c:/opscode/chef c:/opscode/chef.upgrade'\n end\nend", "def run(cmd, opts={})\n cmd = \"sh -c '#{cmd.gsub(\"'\"){%q{'\"'\"'}}}'\"\n if opts[:env]\n sh \"touch .env.local .env.test.local\", verbose: false\n env = '.env'\n env += \".#{opts[:env]}\" unless opts[:env] == :local\n cmd = \"#{dotenv} -f #{env}.local,#{env} #{cmd}\"\n end\n puts cmd if verbose == true\n if opts[:silent]\n out = `#{cmd} 2>&1`\n abort out unless $?.success?\n elsif opts[:exec]\n exec cmd\n else\n system(cmd)\n end\nend", "def run(command)\n\traise \"non-zero exit status: `#{command}`\" if !system(\"cd #{$root} && #{command}\")\nend", "def relative_command?(path)\n p = Pathname.new(path)\n p.relative? && p.basename != p\n end", "def shell_path\n Configuration.disable_bc_shell? ? nil : Pathname.new('/bin/bash')\n end", "def test_cwd\n cmd=nil\n assert(cmd=ShellCommand.new(:cmd=>\"echo\", :working_directory=>\"missing/\"))\n assert(cmd.run)\n assert(cmd.success?)\n end", "def rm(path)\n cmd 'rm', path\nend", "def expand_command(command)\n if match = /^\"(.+?)\"(?:\\s+(.*))?/.match(command)\n exe, arguments = match.captures\n exe = which(exe) and [ \"\\\"#{exe}\\\"\", arguments ].compact.join(\" \")\n elsif match = /^'(.+?)'(?:\\s+(.*))?/.match(command) and not Facter::Util::Config.is_windows?\n exe, arguments = match.captures\n exe = which(exe) and [ \"'#{exe}'\", arguments ].compact.join(\" \")\n else\n exe, arguments = command.split(/ /,2)\n if exe = which(exe)\n # the binary was not quoted which means it contains no spaces. But the\n # full path to the binary may do so.\n exe = \"\\\"#{exe}\\\"\" if exe =~ /\\s/ and Facter::Util::Config.is_windows?\n exe = \"'#{exe}'\" if exe =~ /\\s/ and not Facter::Util::Config.is_windows?\n [ exe, arguments ].compact.join(\" \")\n end\n end\n end", "def shell(args)\n if(!args[0])\n target = 'web'\n to = 'bash'\n else\n target = args[0]\n to = args[1]\n end\n container=`docker-compose ps -q #{target}`.strip\n system(\"docker exec -it #{container} #{to}\")\n end", "def check_path_for(command)\n unless FileTest.executable?(command) || system_path.split(\":\").any?{ |path| FileTest.executable?(File.join(path, command))}\n raise ExecutableNotFoundError, command\n end\n command\n end", "def run\n if self.is_git?\n self.aqlog(\"Running command : git-shell -c #{@cmd_cmd} '#{@real_path}'\")\n if system(Settings.git.shell, \"-c\", \"#{@cmd_cmd} '#{@real_path}'\")\n self.aqlog(\"\\t\\tOK\")\n else\n self.aqlog(\"\\t\\tKO\")\n end\n elsif self.is_hg?\n hg_commands = self.fresh_cmd.split(\" \")\n added_path = Settings.aq_sh.user_home + \"/\" +\n Settings.aq_sh.user_name + \"/\" +\n Settings.hg.repo_path\n hg_command = \"#{hg_commands[0]} #{hg_commands[1]} #{added_path}/#{hg_commands[2]} #{hg_commands[3]} #{hg_commands[4]}\"\n cmd_to_run = hg_command\n self.aqlog(\"Running command : #{cmd_to_run}\")\n if system(cmd_to_run)\n self.aqlog(\"\\t\\tOK\")\n else\n self.aqlog(\"\\t\\tKO\")\n end\n end\n end", "def desc\n \"Command shell\"\n end", "def command_in_path?(command)\n found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|\n File.exist?(File.join(p, command))\n end\n found.include?(true)\n end", "def command_in_path?(command)\n found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|\n File.exist?(File.join(p, command))\n end\n found.include?(true)\n end", "def wrapin_bundle_command(command)\n \"cd #{fetch(:current_path)} && RAILS_ENV=\\\"#{fetch(:env)}\\\" bundle exec #{command}\"\nend", "def shell_command(command)\n command.map {|word| shell_single_word(word) }.join(' ')\n end", "def doCmd(cmd)\n puts cmd;\n puts `#{cmd}`;\nend" ]
[ "0.667388", "0.6390395", "0.6312157", "0.6225742", "0.6223535", "0.62004584", "0.6104248", "0.60336757", "0.6032072", "0.6018608", "0.6009152", "0.60063404", "0.6006277", "0.59779495", "0.59766763", "0.5976449", "0.59693587", "0.59463567", "0.59161353", "0.59161353", "0.5825862", "0.5808374", "0.5794604", "0.5793556", "0.57822114", "0.5753983", "0.5713945", "0.56992733", "0.56849706", "0.5682764", "0.56577766", "0.56577766", "0.56367534", "0.56187713", "0.56128025", "0.5607252", "0.55888927", "0.5565122", "0.5558551", "0.55457723", "0.551137", "0.5507955", "0.5497984", "0.5497965", "0.54918826", "0.54801923", "0.5478289", "0.5477313", "0.5476975", "0.54755604", "0.54636514", "0.54509676", "0.5448538", "0.5429489", "0.54244703", "0.5418993", "0.54049", "0.54032177", "0.5399298", "0.53937817", "0.53619283", "0.535121", "0.53474003", "0.5344915", "0.53438634", "0.53426707", "0.53241515", "0.5317069", "0.5317069", "0.5314894", "0.531334", "0.53127754", "0.53067726", "0.5305869", "0.52913535", "0.5286045", "0.52771366", "0.52726656", "0.52631676", "0.52608186", "0.5254057", "0.5253055", "0.52506465", "0.52479213", "0.52386904", "0.5238219", "0.5236555", "0.5232073", "0.52314776", "0.5228579", "0.52143896", "0.5207689", "0.52011764", "0.5198973", "0.5190479", "0.5173153", "0.5173153", "0.5170748", "0.5165817", "0.51526594" ]
0.5940168
18
Run local bash command
def sh(command, fail_non_success: true) command = Command.path_replace(command, @paths) puts command.colorize(@color) result = @sh.run(command) process_shell_result(result, fail_non_success) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_local(cmd)\n system(cmd)\n end", "def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n `#{cmd}`\n end", "def run(cmd, opts={})\n cmd = \"sh -c '#{cmd.gsub(\"'\"){%q{'\"'\"'}}}'\"\n if opts[:env]\n sh \"touch .env.local .env.test.local\", verbose: false\n env = '.env'\n env += \".#{opts[:env]}\" unless opts[:env] == :local\n cmd = \"#{dotenv} -f #{env}.local,#{env} #{cmd}\"\n end\n puts cmd if verbose == true\n if opts[:silent]\n out = `#{cmd} 2>&1`\n abort out unless $?.success?\n elsif opts[:exec]\n exec cmd\n else\n system(cmd)\n end\nend", "def bash(command)\n require 'shellwords'\n escaped_command = Shellwords.escape(command)\n system \"bash -c #{escaped_command}\"\nend", "def shell(cmd)\n `#{cmd}`\n end", "def shell(cmd)\n `#{cmd}`\n end", "def rvm_run(cmd)\n run %{#{rvm_env} rvm #{cmd}}, :shell => \"bash\"\nend", "def sh(cmd)\n `#{cmd}`\nend", "def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Benchmark.realtime do\n output_on_stdout = `#{cmd}`\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd} returned status code #{$?}\"\n end\n logger.trace \"command finished in #{(elapsed * 1000).round}ms\" if logger\n output_on_stdout\n end", "def run_local(cmd)\n require 'English'\n\n system cmd\n return unless $CHILD_STATUS.exitstatus != 0\n\n puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s\n abort('Shell command failed, assuming you want to abort'.foreground(:red))\nend", "def run_command(command)\n `#{command}`\nend", "def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Benchmark.realtime do\n output_on_stdout = `#{cmd}`\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd} returned status code #{$?}\"\n end\n logger.trace \"command finished in #{(elapsed * 1000).round}ms\" if logger\n output_on_stdout\n end", "def exec(cmd)\n puts cmd\n `#{cmd}`\nend", "def bash(command)\n escaped_command = Shellwords.escape(command)\n system \"bash -c #{escaped_command}\"\n if $?.exitstatus >= 1\n # Error out the command and cleanup the lxc, since the lxc is contaminated due to failed command\n puts \"Error: #{command} has exited with status '#{$?}'\"\n end\n end", "def cmd_shell(*args)\n\t\t\tpath = \"/bin/bash -i\"\n\t\t\tcmd_execute(\"-f\", path, \"-c\", \"-i\")\n\tend", "def run(cmd)\n result = `#{cmd}`\n raise Castanaut::Exceptions::ExternalActionError if $?.exitstatus > 0\n result\n end", "def run(cmd)\n #logger.trace \"executing locally: #{cmd.inspect}\" if logger\n run_locally cmd\n # puts `#{cmd}`\nend", "def run_local(cmd)\n require 'English'\n\n system cmd\n return unless $CHILD_STATUS.exitstatus != 0\n puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s\n exit\nend", "def run(cmd)\n puts \"\\033[1;37m#{cmd}\\033[0m\"\n result = `#{cmd}`\n abort unless $?.success?\n puts result unless result.empty?\n result\nend", "def run(cmd)\n runner.run(cmd, shell, nil)\n end", "def run_cmd(cmd, debug=false)\n puts \"In #{Dir.pwd} executing: #{cmd}\" if debug\n `#{cmd}`\n end", "def run_locally(cmd)\n if dry_run\n return logger.debug \"executing locally: #{cmd.inspect}\"\n end\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Benchmark.realtime do\n output_on_stdout = `#{cmd}`\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd} returned status code #{$?}\"\n end\n logger.trace \"command finished in #{(elapsed * 1000).round}ms\" if logger\n output_on_stdout\n end", "def jenkins_bash(opts)\n\tid = jenkins_id(opts)\n\tputs \"### Accessing bash ###\"\n\tif id and id.length > 0\n\t\trun_in_shell \"docker exec -it #{id} bash\"\n\telse\n\t\tputs \"container not found\"\n\tend\nend", "def execute_local_command(cmd)\n Bundler.clean_system(cmd)\n end", "def run(shell, cmd, &blk)\n run_on_servers(shell, 'sh -l -c', cmd, &blk)\n end", "def run(cmd)\n puts(cmd)\n system(cmd)\nend", "def run\n call(\"/tmp/sonic/bash_scripts/docker-run.sh\")\n end", "def run_local_command(command)\n stdout, stderr, status = Open3.capture3(command)\n error_message = \"Attempted to run\\ncommand:'#{command}'\\nstdout:#{stdout}\\nstderr:#{stderr}\"\n raise error_message unless status.to_i.zero?\n\n stdout\n end", "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def rvm_wrap_cmd(cmd, user_dir = nil)\n profile = find_profile_to_source(user_dir)\n %{bash -c \"source #{profile} && #{cmd.gsub(/\"/, '\\\"')}\"}\n end", "def run(command, log_action = true)\r\n log 'executing', \"#{command} from #{Dir.pwd}\" if log_action\r\n `#{command}`\r\n end", "def run_local_command(command)\n require 'open3'\n stdout, stderr, status = Open3.capture3(command)\n error_message = \"Attempted to run\\ncommand:'#{command}'\\nstdout:#{stdout}\\nstderr:#{stderr}\"\n\n raise error_message unless status.to_i.zero?\n\n stdout\n end", "def do_shell(cmd)\n puts \"[METASIM]:#{Dir.pwd}$ #{cmd}\"\n raise \"Shell command failure\" unless system(cmd)\nend", "def exec_local(opts = {})\n sh = Mixlib::ShellOut.new(\"#{@cmd}\")\n sh.timeout = 60 * 60 * 24 # 24hours\n sh.run_command\n\n @result = ShellCommandResult.new(@cmd, sh.stdout, sh.stderr, sh.exitstatus.to_i)\n\n raise_error! if opts[:abort_on_error]\n\n return @result\n end", "def run_installer_command(cmd)\n `#{cmd}`\n end", "def sh( cmd )\n logger.info( cmd )\n\n io = IO.popen( \"#{cmd} 2>&1\" )\n io.each_line do |l|\n logger.debug( l.strip )\n end\n end", "def run_on_current command\n f = current_file\n return unless f\n\n f = expand_path(f)\n return unless File.readable?(f)\n\n f = Shellwords.escape(f)\n clear_screen\n reset_terminal\n comm = \"#{command} #{f}\"\n system(comm.to_s)\n push_used_dirs\n setup_terminal\n redraw_required\nend", "def run_sh(cmd)\n begin; sh cmd; rescue; end\nend", "def execute(command)\n sh('-c',command)\n end", "def exe(cmd)\n puts \"executing: #{cmd}\"\n out = `#{cmd}`\n puts out\n out\n end", "def sh cmd\n puts cmd\n put `#{cmd}`\nend", "def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end", "def bash(*args, &blk)\n setenv('PS1', \"(rye) \\\\h:\\\\w \\\\u\\\\$\\ \")\n __shell 'bash', *args, &blk\n end", "def run_in_shell(cmd, ret = false)\n\treturn `#{cmd}` if ret\n\tsystem cmd\nend", "def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($CHILD_STATUS.exitstatus.zero?)\nend", "def run(cmd)\n Dir.chdir @target\n\n log \"Running: #{cmd}\"\n `#{cmd}`\n # if $?.exitstatus != 0\n # raise IOError, %{Error executing command: \"#{cmd}\"}\n # end\n\n Dir.chdir @starting_dir\n end", "def run(command)\n\traise \"non-zero exit status: `#{command}`\" if !system(\"cd #{$root} && #{command}\")\nend", "def sh(cmd)\n\t# Print the command to stdout.\n\tif(cmd.is_a?(Array))\n\t\tp cmd\n\telse\n\t\tputs cmd\n\tend\n\t# Run it.\n\tsuccess = system(cmd)\n\traise \"Command failed\" unless(success)\nend", "def exec(cmd, options = {})\n Git.invoke :before_read\n\n options = {\n '-f' => @file\n }.merge(options)\n\n params = ''\n options.each do |key, val|\n params << \" #{key} #{Escape.shell_single_word(val)}\"\n end\n\n command = \"#{bin} #{params} #{cmd}\"\n\n `#{command}`.rstrip\n end", "def ssh_shell_cmd(executable, dir, log)\n # NOTE: We cannot use && between cd and nohup because this doesn't work together with non-blocking commands\n \"vagrant ssh -- \\\"cd '#{dir}';\n nohup './#{executable}' >/dev/null 2>>'#{log}' </dev/null &\\\"\"\n end", "def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($?.exitstatus.zero?)\nend", "def run_command(cmd)\n IO.popen(cmd) do |stdout|\n stdout.reject(&:empty?)\n end.unshift($?.exitstatus.zero?)\nend", "def run_cmd(cmd)\n Dir.chdir(Rails.root) {\n #@output = `cd #{CTMWEB_PATH} && #{cmd} 2>&1`\n cmd = \"#{cmd}\"\n @output = `#{cmd}`\n }\n result = $?.success?\n if result\n print \"OK\\n\".green\n else\n print \"ERROR\\n\".red\n puts \"#{@output.to_s.red}\"\n send_to_flowdock(\"CTMWEB\", \"Deployment for #{Rails.env.upcase} failed. (CMD: #{cmd})\", @tags)\n abort \"Deployment Halted.\".red\n end\nend", "def run_cmd\n @run_cmd ||= local_suite_files.empty? ? nil : \"#{sudo}#{jr_bin} test\"\n end", "def run_command(user, host, cmd)\n ping(user, host) do\n my_text = IO.popen(\"ssh #{user}@#{host} 'bash'\", \"w+\")\n my_text.write(cmd)\n my_text.close_write\n my_rtn = my_text.readlines.join('\\n')\n Process.wait(my_text.pid)\n my_text.close\n return my_rtn\n end\n end", "def remote_bash(bash_cmds)\n @calls << [:remote_bash, bash_cmds]\n @remote_bash_code&.call(@stdout_io, @stderr_io, self)\n end", "def shell(*cmd, &block)\n options = (Hash === cmd.last) ? cmd.pop : {}\n options[:verbose] = false\n command = cmd.first\n puts \"Running #{command} via Rake sh\"\n sh command, options, &block\n end", "def shell_command(command, context='bash')\n fail \"shell_command api not supported on #{node.product_id}\" unless\n node.product_id[/N3K|N3K.*-F|N9K.*-F|N9K/]\n unless context == 'bash' || context == 'guestshell'\n fail \"Context must be either 'bash' or 'guestshell'\"\n end\n config(\"run #{context} #{command}\")\n end", "def run(cmd)\n puts \"#{cmd}\"\n success = system(cmd)\n exit $?.exitstatus unless success\nend", "def run!\n # rubocop:disable Metrics/LineLength\n fail LaunchError, %(Command \"#{command}\" not found in PATH-variable \"#{environment['PATH']}\".) unless which(command, environment['PATH'])\n # rubocop:enable Metrics/LineLength\n\n if RUBY_VERSION < '1.9'\n begin\n old_env = ENV.to_hash\n ENV.update environment\n\n Dir.chdir @working_directory do\n @exit_status = system(@cmd) ? 0 : 1\n end\n ensure\n ENV.clear\n ENV.update old_env\n end\n elsif RUBY_VERSION < '2'\n Dir.chdir @working_directory do\n @exit_status = system(environment, @cmd) ? 0 : 1\n end\n else\n @exit_status = system(environment, @cmd, :chdir => @working_directory) ? 0 : 1\n end\n end", "def run_cmd(cmd)\n Chef::Log.info \"executing: #{cmd}\"\n result = Mixlib::ShellOut.new(cmd).run_command.stdout.strip\n return result\nend", "def run(cmd)\n puts cmd\n system cmd\nend", "def run(cmd)\n print \"-> #{cmd}...\"\n system cmd\n print \"ok\\n\"\nend", "def bash(cmd)\n sh cmd do |successful, result|\n # exitstatus 7 means bundle install failed\n # exitstatus 1 means the test failed\n if !successful && result.exitstatus == 7\n Rake::Task['install'].execute\n run_sh cmd\n end\n end\nend", "def shell(cmd)\n puts \"Executing #{cmd}...\"\n Bundler.clean_system(cmd)\n abort \"Command '#{cmd}' failed\" unless $?.success?\n end", "def sh(cmd, opts = {})\n opts = DEFAULT_SH_OPTS.merge(opts)\n cmd = [cmd] if cmd.is_a?(String)\n puts cmd.join(' ') if opts[:echo]\n exit_status = nil\n if opts[:tty]\n exit_status = system(*cmd) ? 0 : -1\n else\n out, status = Open3.capture2(*cmd)\n puts out if opts[:output]\n exit_status = status.exitstatus\n end\n raise \"Failed to execute '#{cmd.join(' ')}' (#{exit_status})\" unless exit_status == 0\n end", "def run(cmd, host_ip)\n user = 'root'\n ip = host_ip\n port = 22\n\n @cmd = system \"ssh -p #{port} #{user}@#{ip} '#{cmd}'\" \n logger.info @cmd\n end", "def run\n logger.info(\"Running command : git-shell -c #{@cmd_cmd} '#{@real_path}'\")\n if system(Settings.git.shell, \"-c\", \"#{@cmd_cmd} '#{@real_path}'\")\n logger.info(\"\\t\\tOK\")\n else\n logger.info(\"\\t\\tKO\")\n end\n end", "def run_cmd cmd\n info cmd\n status = system(cmd)\n if status\n info(\"Woot! Woot! - command succeeded #{cmd}\")\n else\n error(\"Gahhhh! Bad status from #{cmd}\")\n end\n status\n end", "def run\n begin\n IO.popen(@cmd_line).read\n rescue\n @logger.error(\"Failed to execute command on #{@host}\")\n \"\"\n end\n end", "def chef_exec(cmd)\n @ssh.exec! \"#{CHEF_RUBY_INSTANCE_BASE}/bin/#{cmd}\", sudo: true\n end", "def shell(args)\n container=`docker-compose ps -q web`.strip\n system(\"docker exec -it #{container} bash\")\n end", "def sh(service) = execute(method: :shell, service: service)", "def run_command(cmd)\n IO.popen(cmd) do |f|\n while ! f.eof\n puts f.gets\n end\n end\n $?\n end", "def cmd(cmd)\n puts cmd; system(cmd)\nend", "def execute(command)\n system(command)\n end", "def run_shell_cmd(args)\n system(*args)\n raise \"command exited with a nonzero status code #{$?.exitstatus} (command: #{args.join(' ')})\" if !$?.success?\n end", "def sh cmd, working_dir=@path\n opts = {}\n if working_dir\n opts[:chdir] = working_dir\n mkdir_p working_dir unless exists? working_dir\n end\n\n puts \" #{File.basename(working_dir)}$ #{cmd}\"\n\n process = POSIX::Spawn::Child.new cmd, opts\n\n unless process.success?\n raise \"Command #{cmd} failed. out: #{process.out}\\nerr: #{process.err}\"\n end\n\n out = process.out\n out ? out.strip : out\n end", "def sh(cmd)\n #TODO: optimize by removing the extra shell\n #the Process class should be useful.\n $stderr.puts cmd\n if (!system(cmd)) then\n error \"Command failed: '#{$?}'\"\n end\nend", "def run(file, cmd, *args)\n env = Environment.load(source: file)\n exec env, cmd, *args\n end", "def shell_script(filename, env=[], args=[])\n shell_script_crafted = \"/bin/bash -c \\\"#{env.join ' '} #{filename} #{args.join ' '} 2>/dev/null\\\"\"\n shell_script_crafted\nend", "def exec(command)\n ensure_mode(:privileged)\n run(command)\n end", "def run_command_script(command)\n Open3.popen2e(\"ruby #{command}\") do |stdin, stdout_err|\n while line = stdout_err.gets\n puts line\n end\n end\n end", "def execute(command)\n system \"#{command}\" # rubocop:disable UnneededInterpolation\nend", "def sh(command)\n provider.sh command\n end", "def shell(args)\n if(!args[0])\n target = 'web'\n to = 'bash'\n else\n target = args[0]\n to = args[1]\n end\n container=`docker-compose ps -q #{target}`.strip\n system(\"docker exec -it #{container} #{to}\")\n end", "def run(command, *args)\n sh \"#{command} #{args.join(' ')}\"\nend", "def run\n system(command)\n $?\n end", "def run\n system(command)\n $?\n end", "def run(cmd, cwd)\n begin\n Bundler.with_clean_env do\n PTY.spawn( \"cd #{cwd} && #{cmd}\" ) do |stdout, stdin, pid|\n begin\n stdout.each do |line|\n puts line\n end\n rescue Errno::EIO\n end\n Process.wait(pid)\n end\n end\n rescue PTY::ChildExited => e\n end\n end", "def run\n if self.is_git?\n self.aqlog(\"Running command : git-shell -c #{@cmd_cmd} '#{@real_path}'\")\n if system(Settings.git.shell, \"-c\", \"#{@cmd_cmd} '#{@real_path}'\")\n self.aqlog(\"\\t\\tOK\")\n else\n self.aqlog(\"\\t\\tKO\")\n end\n elsif self.is_hg?\n hg_commands = self.fresh_cmd.split(\" \")\n added_path = Settings.aq_sh.user_home + \"/\" +\n Settings.aq_sh.user_name + \"/\" +\n Settings.hg.repo_path\n hg_command = \"#{hg_commands[0]} #{hg_commands[1]} #{added_path}/#{hg_commands[2]} #{hg_commands[3]} #{hg_commands[4]}\"\n cmd_to_run = hg_command\n self.aqlog(\"Running command : #{cmd_to_run}\")\n if system(cmd_to_run)\n self.aqlog(\"\\t\\tOK\")\n else\n self.aqlog(\"\\t\\tKO\")\n end\n end\n end", "def sh_gem(cmd, options={})\r\n gem_path = `which gem`.strip\r\n cmd = cmd.sub(/^gem/, \"ruby '#{gem_path}'\")\r\n sh(cmd, options)\r\n end", "def run(cmd)\n shell_out! \"#{jboss_cli} '#{cmd}'\", cli_options\n end", "def run!\n ssh commands(:default)\n end", "def run(command, key = :git)\n puts command\n `cd #{path_for(key)} && #{command}`.chomp\n end", "def run(command, *args)\n command_name = \"lxc-#{command}\"\n\n unless BIN_FILES.include?(command_name)\n raise ArgumentError, \"Invalid command: #{command_name}.\"\n end\n\n cmd = \"\"\n cmd << \"sudo \" if use_sudo == true\n cmd << \"#{command_name} #{args.join(\" \")}\".strip\n cmd << \" | #{yield}\" if block_given?\n\n # Debug if LXC_DEBUG env is set\n if ENV[\"LXC_DEBUG\"]\n puts \"Executing: #{cmd}\"\n end\n\n out = `#{cmd.strip}`\n end", "def make_bash_script name, cmds\n cmds = cmds.map{|cmd| \"(#{cmd})\" }\n\n cmds << \"echo true\"\n\n bash = <<-STR\n#!/bin/bash\nif [ \"$1\" == \"--no-env\" ]; then\n #{cmds.flatten.join(\" && \")}\nelse\n #{self.root_path}/env #{self.root_path}/#{name} --no-env\nfi\n STR\n end", "def run_command(cmd)\n if config[:simulate]\n puts_and_logs \" - Simulate running \\\"#{cmd}\\\"\"\n return\n end\n if config[:debug]\n if config[:verbose]\n puts_and_logs \" - Running \\\"#{cmd}\\\"\"\n else\n logger.debug \" - Running \\\"#{cmd}\\\"\"\n end\n system cmd\n return\n end\n puts_and_logs \" - Running \\\"#{cmd}\\\"\" if config[:verbose]\n system(cmd + ' > /dev/null 2>&1')\n\n end", "def execute(cmd)\n @log.info(\"Executing command '#{cmd}'...\")\n Kernel.system(cmd)\n end", "def local\n system(*@args)\n end", "def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end" ]
[ "0.7503483", "0.7030775", "0.6901969", "0.6830279", "0.68067735", "0.68067735", "0.67737836", "0.6672249", "0.6651613", "0.6622743", "0.65806544", "0.6553135", "0.6543106", "0.65413254", "0.6526818", "0.64763725", "0.64187855", "0.6403069", "0.6397678", "0.6377587", "0.6366552", "0.6365454", "0.63399154", "0.63001823", "0.6294935", "0.62928236", "0.62625945", "0.6219038", "0.6179228", "0.61753947", "0.6156201", "0.6147857", "0.6133198", "0.6132721", "0.6125269", "0.60807616", "0.60758436", "0.6056371", "0.6051258", "0.6023634", "0.6021704", "0.6019549", "0.6019194", "0.60157955", "0.6010636", "0.6008402", "0.5998866", "0.59960496", "0.5974791", "0.5971318", "0.5963521", "0.5963521", "0.5957835", "0.59566146", "0.59536135", "0.5944389", "0.5939994", "0.5938877", "0.5912157", "0.5910503", "0.58961916", "0.58709157", "0.5839051", "0.5834942", "0.5826308", "0.5817753", "0.5816062", "0.5807785", "0.5807588", "0.5788557", "0.5786128", "0.5780353", "0.5777344", "0.57690394", "0.5762913", "0.5758944", "0.57533073", "0.57505035", "0.57503945", "0.5744094", "0.57332695", "0.5732928", "0.5732889", "0.57278585", "0.5727666", "0.57252866", "0.5720879", "0.57175356", "0.57175356", "0.57175213", "0.5716841", "0.5713119", "0.570569", "0.57041967", "0.5697302", "0.56936514", "0.56866443", "0.56839526", "0.5681349", "0.5679731", "0.56747323" ]
0.0
-1
Get instance of GitHub class to run commands against GitHub
def travis Log.fatal('You did not configure Travis yet.') unless @travis @travis end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github\n\n @github = Github.new({ client_id: CONFIG[:GITHUB_CLIENT_ID], client_secret: CONFIG[:GITHUB_CLIENT_SECRET] })\n end", "def github\n Log.fatal('You did not configure GitHub yet.') unless @github\n @github\n end", "def github_client\n Octokit::Client.new(:login => username, :oauth_token => token)\n end", "def github\n @github ||= begin\n if username.present? && github_access_token.present?\n Octokit::Client.new(login: username, oauth_token: github_access_token, auto_traversal: true)\n else\n nil\n end\n end\n end", "def github_api_setup\n @github_api ||= Github.new(oauth_token: self.token)\n end", "def fetch_from_github\n repo, branch, path = Post.parse_github_url self.github\n Environment.github.contents repo, ref: branch, path: path\n end", "def github_client\n @github_client ||= begin\n if provider = self.omni_auth_providers.where(name: \"github\").first\n Octokit::Client.new(access_token: provider.access_token)\n end\n end\n end", "def client\n @client ||= Github::ApiProxy.new(@options[:access_token])\n end", "def call\n if git_remote_command =~ /git@github.com:(.+).git/\n \"https://github.com/#{Regexp.last_match(1)}\"\n else\n git_remote_command.sub('.git', '').chomp\n end\n end", "def github_client(opts={})\n return unless has_github?\n\n @github_client ||= Github.new oauth_token: github_identity.token\n end", "def execute(command)\n begin\n puts \"* Executing command '#{command}' for the Github API\"\n Timeout.timeout(35) do\n http = Net::HTTP.new(\"github.com\", 80)\n response, content = http.get(\"/api/v1/yaml/#{@user}/#{@repo}/#{command}\")\n content\n end\n rescue Exception => e\n puts \"[!] Error when connecting to Github API (Message: #{e.message})\"\n nil\n end\n end", "def github_client\n Octokit::Client.new access_token: self.setting.user_with_token.client_token\n end", "def github_client\n Octokit::Client.new(\n access_token: ENV.try(:[], \"GITHUB_ACCESS_TOKEN\"),\n auto_paginate: true\n )\n end", "def github_client\n p = Project.find(params[:id])\n if p.github_token\n github = Github.new :oauth_token => p.github_token\n else\n github = Github.new :client_id => GITHUB_CLIENT_ID , :client_secret => GITHUB_CLIENT_SECRET\n end\n end", "def github_fetcher\n return @github_fetcher if defined?(@github_fetcher)\n\n @github_fetcher = github_url && GemsBond::Fetchers::Github.new(github_url).tap(&:start)\n end", "def github_pull\n Extension.github_sync\n end", "def initialize_api\n @github_api = ::Github::Repos.new do |github_config|\n github_config.endpoint = @endpoint if @endpoint\n github_config.site = @site if @site\n github_config.basic_auth = @auth\n github_config.repo = @repo\n github_config.org = @org\n github_config.adapter = :net_http\n github_config.ssl = {:verify => false}\n end\n end", "def method_missing(method, *args)\n if @github.respond_to?(method)\n @github.send(method, *args)\n else\n super\n end\n end", "def githubize\n # method goes here\n end", "def execute\n get_repo(repo_name).repo.fetch\n end", "def github_api(user = current_user)\n @github_api ||= GithubApi.new(github_token, user)\n end", "def _github\n Lexhub.configuration.github\n end", "def new(options = {}, &block)\n #@api_client = Github::Client.new(options, &block)\n end", "def repository\n @repository ||= Github::Repository.find user: user, name: name\n end", "def command_runner\n SimpleCommander::Runner.instance\nend", "def config_github(api_key)\n @github = GitHub.new(api_key)\n end", "def github(name, ref = 'master')\n gitrepo \"github.com\", name, ref\nend", "def repo(user_name, repo_name)\n Github::Repo.new @access_token, user_name, repo_name\n end", "def github\n @github ||= (\n require 'detroit'\n require 'detroit-github'\n Detroit::GitHub.new(\n :folder => 'website'\n #:sitemap => {\n # 'index.html' => 'index.html',\n # 'doc.json' => 'doc.json',\n # 'assets' => 'assets'\n #}\n )\n ) \nend", "def client\n Octokit::Client.new(\n access_token: ENV['GITHUB_ACCESS_TOKEN']\n )\n end", "def client\n Octokit::Client.new(\n access_token: ENV['GITHUB_ACCESS_TOKEN']\n )\n end", "def client\n Octokit::Client.new(access_token: decrypt(@user.github_token))\n end", "def initialize(user = nil, api_token = nil, repo_name = \"cookie_monster\") \n if user.nil?\n puts \"No user provided, getting from git config\"\n user = `git config --get github.user`.chomp\n end\n\n if api_token.nil?\n puts \"No API token provided, getting from git config\"\n api_token = `git config --get github.token`.chomp\n end\n\n\n @user = user.chomp # chomp in case user passes in bad data\n @api_token = api_token.chomp # chomp in case user passes in bad data\n @repo_name = repo_name\n\n # Authenticated client\n #@client = Octopussy::Client.new({:login => @user, :token => @api_token})\n\n # Location of local git repository. Necessary for pushing to Github.\n # Put it in .cloud_path so it doesn't conflict with anything\n @git_dir_path = File.expand_path(\"~/.cloud_path/\" + @repo_name)\n\n create_repo\n create_git_dir\n \n # For whatever reason, Repository.find raises Octopi::NotFound when\n # we've just created the repository in this run of the script.\n # Possibly a caching error.\n begin\n repo = Repository.find(:user => @user, :repo => @repo_name)\n rescue Octopi::NotFound\n puts \"Repository not found. Probably just created repository, please\"\n puts \"run this script again.\"\n exit 0\n end\n end", "def command_runner cmd:, repo:nil, branch:nil\n status = run_cmd(cmd)\n status\n end", "def client\n pry(Git::Hub.send(:client))\nend", "def configure(options = {})\n api = Github.new\n config = GithubCLI.config\n\n ssl = config.fetch('core.ssl')\n adapter = config.fetch('core.adapter')\n token = config.fetch('user.token')\n site = config.fetch('core.site')\n endpoint = config.fetch('core.endpoint')\n\n api.basic_auth = set_basic_auth(config, options)\n api.ssl = ssl if ssl && ssl != ''\n api.adapter = adapter.to_sym if adapter && adapter != ''\n api.oauth_token = token if token && token != ''\n api.site = site if site && site != ''\n api.endpoint = endpoint if endpoint && endpoint != ''\n api.auto_pagination = options['auto_pagination'] || config.fetch('core.auto_pagination')\n\n if (test_env = ENV['TEST_HOST'])\n api.endpoint = 'http://' + test_env\n end\n api\n end", "def github\n process_oauth_callback\n end", "def create_client\n token = File.open(GITHUB_TOKEN_FILE).read\n Octokit::Client.new(access_token: token)\nend", "def exec(command)\n #logger.debug { \"Github: Executing command: '#{command}'\" }\n #p \"Github: Executing command: '#{command}'\"\n \n # Get a path to a temp file\n #logfile = Tempfile.new('github__exec')\n #logfile.close\n \n #success = system(\"#{command} > #{logfile.path} 2>&1\")\n #output_from_command = File.readlines(logfile.path)\n #output_from_command = %x[command]\n shell = Shell.new(command)\n shell.run\n success = (shell.exitstatus == 0)\n output_from_command = shell.output\n if success\n #logger.debug { \"Github: Command output: #{output_from_command.inspect}\"}\n #p \"Github: Command output: #{output_from_command.inspect}\"\n return output_from_command\n else\n #logger.error { \"Github: Command '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"}\n p \"Github: Command failed '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"\n end\n \n #ensure\n #logfile.unlink\n end", "def git command, *args\n run 'git', command.to_s, *args\nend", "def github_repo(access_token, repo)\n client = Octokit::Client.new :access_token => access_token\n client.repo repo\n end", "def fetch_github_data\n self.info = GithubInfoFetcher.new.call(github_path).to_h\n end", "def initialize(dependency, options = {})\n @repo_identifier = options.delete(:github)\n if repo_identifier.end_with?(\".git\")\n raise InvalidGitHubIdentifier.new(repo_identifier)\n end\n @protocol = (options.delete(:protocol) || DEFAULT_PROTOCOL).to_sym\n options[:git] = github_url\n super\n end", "def initialize( args = {} )\n\n ::Octokit.configure do |c|\n c.access_token = args[:github_auth] || ENV['GITHUB_AUTH']\n c.auto_paginate = true\n end\n\n @params = {}\n @params[:context] = args[:context] or raise \"Requires a context\"\n @params[:target_url] = args[:url]\n \n path = args[:repo] || '.'\n @repo = GithubInformer.determine_repo(path)\n @sha = GithubInformer.determine_sha(path)\n end", "def git\n @git ||= Grit::Repo.new(path)\n end", "def git\n @git ||= Grit::Repo.new(path)\n end", "def github_repo(access_token, api_endpoint, repo)\n client = Octokit::EnterpriseAdminClient.new :access_token => access_token :api_endpoint => api_endpoint\n client.repo repo \n end", "def provider\n :github\n end", "def git\n @git ||= Git::Repo.new \"git@#{hostname}:hoboku.git\"\n end", "def repo\n @repo ||= OctocatHerder::Repository.new(@raw['repo'], connection)\n end", "def github_url\n \"https://github.com/#{self.nickname}\"\n end", "def GitSimple(*args) # rubocop:disable Naming/MethodName\n GitSimple.new(*args)\nend", "def repo (slug, githubToken)\n\n puts \"Retrieving #{slug} from GitHub...\"\n\n urlString = 'https://api.github.com/repos/' + slug + '?access_token=' + githubToken\n\n uri = URI(urlString)\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = (uri.scheme == 'https')\n\n request = Net::HTTP::Get.new(uri)\n request['Accept'] = 'application/vnd.github.v3+json'\n\n result = client.request (request)\n\n case result\n when Net::HTTPSuccess, Net::HTTPRedirection\n repoData = JSON.parse(result.body)\n return repoData\n else\n\treturn nil\n end\nend", "def setup\n Github::Configuration.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Github::Default.options[key])\n end\n self\n end", "def git(args, &block)\n Sprout::GitTask.define_task(args, &block)\nend", "def execute\n current = GitHub::PullRequest.current\n\n if current\n cli.say \"Opening Pull Request #{current.number}\"\n cli.open current.pull_request.html_url\n end\n end", "def git_fetch\n Command.new(\"git\", \"fetch\", \"--tags\").run!.raise!\nend", "def fetch\n return nil if !repo || !user\n if fetched?\n pull\n else\n clone\n end\n end", "def command_object\n @command_object ||= GitPusshuTen::Command.new(cli, configuration, hooks, environment)\n end", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def call\n wiki.repo.git.pull({}, 'orgin', 'master')\n\n if settings.site\n if Dir.exist?(site_path)\n $stderr.puts \"Pulling `#{repo.branch}' from `origin' in `#{repo.path}'...\"\n repo.pull\n else\n $stderr.puts \"Cloning `#{repo.origin}' in `#{repo.path}'...\"\n repo.clone\n end\n end\n end", "def fetch_github_information\n self.associated_commit_shas = []\n self.branch_name = nil\n self.username = nil\n\n return if self.dev_build\n\n GithubService.run(self.project.github_root_url, self.project.github_repo) do |service|\n if self.is_branch_build\n self.associated_commit_shas = service.github_commits(10, self.commit_sha)\n self.branch_name = nil\n self.username = nil\n else\n self.associated_commit_shas = []\n info = service.user_and_branch_for_pull_request(self.pull_request_number)\n self.username = info[:user]\n self.branch_name = info[:branch]\n end\n end\n end", "def project_from_github(input)\n Github::ProjectMapper\n .new(App.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end", "def repo() \n\t\treturn @repo if @repo != nil\n\t\t@repo = Grit::Repo.new(self[:path])\n\tend", "def add_git_facts\n # see if we're in a git repo. first, we need a directory that exists\n dir = @path.expand_path.ascend.find {|p| p.directory? }\n \n Dir.chdir(dir) do\n root_result = Cmds.new \"git rev-parse --show-toplevel\"\n \n unless root_result.ok?\n @result.in_git_repo = false\n @result.is_git_root = false\n return\n end\n \n @result.in_git_repo = true\n \n git = @result.git = Result.new\n git.root = Pathname.new root_result.out.chomp\n @result.is_git_root = @path == git.root\n \n user = git.user = Result.new\n \n ['name', 'email'].each {|key|\n user[key] = begin\n Cmds.chomp! \"git config user.#{ key }\"\n rescue\n end\n }\n \n git.origin = begin\n Cmds.chomp! \"git remote get-url origin\"\n rescue\n end\n \n match = GITHUB_SSH_URL_RE.match(git.origin) ||\n GITHUB_HTTPS_URL_RE.match(git.origin)\n \n git.is_github = !! match\n \n return unless match\n \n git.owner = match['owner']\n git.name = match['name']\n git.full_name = \"#{ git.owner }/#{ git.name }\"\n \n if true == @args['github_api']\n github = git.github = Result.new\n github.api_url = \"https://api.github.com/repos/#{ git.owner }/#{ git.name }\"\n \n response = Net::HTTP.get_response URI(github.api_url)\n \n if response.is_a? Net::HTTPSuccess\n # parse response body and add everything to github result\n parsed = JSON.parse response.body\n parsed.each {|k, v| github[k] = v}\n else\n # assume it's private if we failed to find it\n github.private = true\n end\n \n end\n end\n end", "def github\n @obj['github']\n end", "def configure_github_access\n if Settings.instance.oauth_token\n @github = Octokit::Client.new(\n :login => Settings.instance.username,\n :oauth_token => Settings.instance.oauth_token\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def client\n client_object_exists = (defined?(@client) != nil)\n if client_object_exists\n return @client\n else\n # When coming through a commit hook endpoint, the github_id won't be saved\n # in the session, so we need to be able to grab it from a class instance variable.\n # @todo: actually there's a better way to do this. See it mentioned in my\n # other @todo in this file.\n if session[:github_id] != nil\n github_id = session[:github_id]\n elsif @github_id != nil\n github_id = @github_id\n else\n authenticate!\n end\n\n user = User.find_by(github_id: github_id)\n if Octokit.validate_credentials({ :access_token => user.token })\n # Auto paginate to prevent repo-list truncation on the books/new page. This may\n # hurt performance, so keep an eye on it.\n @client = Octokit::Client.new :access_token => user.token, :auto_paginate => true\n else\n authenticate!\n end\n end\nend", "def git_fetch\n Command.new(\"git\", \"fetch\", \"--tags\", \"-f\").run!.raise!\nend", "def fetch\n git :fetch\n end", "def project_from_github(input)\n Github::ProjectMapper\n .new(Api.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end", "def main()\n\n # check that 3 arguments have been given, otherwise exit\n if ARGV.length < 3\n puts \"You haven't given enough arguments.\"\n exit\n end\n\n # the first argument should be the path to the local repository\n repo_path = ARGV[0]\n\n # the second argument should be the relevant GitHub username\n username = ARGV[1]\n\n # the third argument should be the repository name on GitHub\n repo_name = ARGV[2]\n\n # invoke link_commits with the arguments\n link_commits(repo_path, username, repo_name).each { |link| puts link }\nend", "def repo; end", "def repo; end", "def repo; end", "def repo; end", "def repository\n Repository[self]\n end", "def launch(path)\n # force leading slash\n path.insert(0, '/') unless path[0] == '/'\n url = \"https://github.com/#{repo_github_path + path.chomp}\"\n # use open if on OSX\n if RUBY_PLATFORM.downcase.include? \"darwin\"\n %x{open #{url}}\n else\n puts url\n end\n end", "def name\n 'GitHub'\n end", "def url\n \"http://github.com/#{login}\"\n end", "def github_repo\n self.github_url&.gsub(\"https://github.com/\", \"\")\n end", "def repository(uri, client)\n repo = client.repo uri\n repo\n rescue Octokit::InvalidRepository\n raise gem.to_s + ' didnt have github repo'\n end", "def initialize(args = [])\n @args = args\n command = args.shift\n if command && self.respond_to?(command)\n unless command == 'help'\n @user, @repo = repo_info\n return unless @user && @repo && configure_github_access\n update unless command == 'clean'\n end\n self.send command\n else\n unless command.nil? || command.empty? || %w(-h --help).include?(command)\n puts \"git-review: '#{command}' is not a valid command.\\n\\n\"\n end\n help\n end\n rescue UnprocessableState\n puts 'Execution of git-review command stopped.'\n end", "def github\n self.account.blank? ? nil : GitHub::API.user(self.account)\n end", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend\nend", "def initialize shell\n @shell = shell\n @heroku_home = File.join ENV[\"HOME\"], \".heroku\"\n @credentials_file = File.join @heroku_home, CREDENTIALS\n end", "def manifest\n repo_name = url_path[0] == \"/\" ? url_path[1..-1] : url_path\n\n GithubRepositoryResource.new(repo_name, @client).to_h\n end", "def new_command_runner(*args, &block)\n SimpleCommander::Runner.instance_variable_set :\"@singleton\", SimpleCommander::Runner.new(args)\n program :name, 'test'\n program :version, '1.2.3'\n program :description, 'something'\n create_test_command\n yield if block\n SimpleCommander::Runner.instance\nend", "def configure_github_access\n settings = ::GitReview::Settings.instance\n if settings.oauth_token && settings.username\n @github = Octokit::Client.new(\n :login => settings.username,\n :access_token => settings.oauth_token,\n :auto_traversal => true\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def git_wrapper (dpath = Dir.pwd)\n\n\tbegin\n\t\tRugged::Repository.new(dpath)\n\n\trescue Rugged::RepositoryError => err\n\n\t\tputs \"could not find repository at #{dpath}\"\n\t\texit 1\n\n\trescue Exception => err\n\n\t\tputs \"an error occurred while opening .git repository for #{dpath}\"\n\t\tputs err.message\n\t\texit 1\n\n\tend\n\nend", "def cmd(*args) self.class.cmd(*args) end", "def repo(klass)\n @repository = klass\n end" ]
[ "0.68239033", "0.64671826", "0.64665717", "0.6461043", "0.6412371", "0.6291616", "0.6260287", "0.62471646", "0.62171435", "0.6216496", "0.61708087", "0.61430794", "0.61316955", "0.6023944", "0.6015977", "0.60138416", "0.5982394", "0.59594345", "0.59146583", "0.58963484", "0.589361", "0.5890446", "0.58463967", "0.5840042", "0.58132786", "0.58014214", "0.5753796", "0.5744969", "0.57205284", "0.5647322", "0.5647322", "0.5638128", "0.5619055", "0.559931", "0.5585402", "0.55754167", "0.5571706", "0.5567607", "0.55610865", "0.5544728", "0.55356914", "0.5508082", "0.54793924", "0.5479282", "0.54697305", "0.54697305", "0.5467142", "0.54555297", "0.5450737", "0.54454744", "0.54140824", "0.5410009", "0.5390901", "0.53896314", "0.53886473", "0.53454065", "0.53277594", "0.5315326", "0.53104055", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.53057784", "0.52870977", "0.52836996", "0.52771425", "0.5263793", "0.5256292", "0.5250099", "0.5246632", "0.5232968", "0.52313864", "0.52234197", "0.5222179", "0.52201253", "0.52201253", "0.52201253", "0.52201253", "0.52195716", "0.5219566", "0.5215875", "0.5212112", "0.5211227", "0.52080226", "0.52037805", "0.51988035", "0.5198726", "0.5196595", "0.51897347", "0.5185667", "0.5178941", "0.5176465", "0.5169192", "0.5156152" ]
0.0
-1
Get instance of GitHub class to run commands against GitHub
def github Log.fatal('You did not configure GitHub yet.') unless @github @github end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github\n\n @github = Github.new({ client_id: CONFIG[:GITHUB_CLIENT_ID], client_secret: CONFIG[:GITHUB_CLIENT_SECRET] })\n end", "def github_client\n Octokit::Client.new(:login => username, :oauth_token => token)\n end", "def github\n @github ||= begin\n if username.present? && github_access_token.present?\n Octokit::Client.new(login: username, oauth_token: github_access_token, auto_traversal: true)\n else\n nil\n end\n end\n end", "def github_api_setup\n @github_api ||= Github.new(oauth_token: self.token)\n end", "def fetch_from_github\n repo, branch, path = Post.parse_github_url self.github\n Environment.github.contents repo, ref: branch, path: path\n end", "def github_client\n @github_client ||= begin\n if provider = self.omni_auth_providers.where(name: \"github\").first\n Octokit::Client.new(access_token: provider.access_token)\n end\n end\n end", "def client\n @client ||= Github::ApiProxy.new(@options[:access_token])\n end", "def call\n if git_remote_command =~ /git@github.com:(.+).git/\n \"https://github.com/#{Regexp.last_match(1)}\"\n else\n git_remote_command.sub('.git', '').chomp\n end\n end", "def github_client(opts={})\n return unless has_github?\n\n @github_client ||= Github.new oauth_token: github_identity.token\n end", "def execute(command)\n begin\n puts \"* Executing command '#{command}' for the Github API\"\n Timeout.timeout(35) do\n http = Net::HTTP.new(\"github.com\", 80)\n response, content = http.get(\"/api/v1/yaml/#{@user}/#{@repo}/#{command}\")\n content\n end\n rescue Exception => e\n puts \"[!] Error when connecting to Github API (Message: #{e.message})\"\n nil\n end\n end", "def github_client\n Octokit::Client.new access_token: self.setting.user_with_token.client_token\n end", "def github_client\n Octokit::Client.new(\n access_token: ENV.try(:[], \"GITHUB_ACCESS_TOKEN\"),\n auto_paginate: true\n )\n end", "def github_client\n p = Project.find(params[:id])\n if p.github_token\n github = Github.new :oauth_token => p.github_token\n else\n github = Github.new :client_id => GITHUB_CLIENT_ID , :client_secret => GITHUB_CLIENT_SECRET\n end\n end", "def github_fetcher\n return @github_fetcher if defined?(@github_fetcher)\n\n @github_fetcher = github_url && GemsBond::Fetchers::Github.new(github_url).tap(&:start)\n end", "def github_pull\n Extension.github_sync\n end", "def initialize_api\n @github_api = ::Github::Repos.new do |github_config|\n github_config.endpoint = @endpoint if @endpoint\n github_config.site = @site if @site\n github_config.basic_auth = @auth\n github_config.repo = @repo\n github_config.org = @org\n github_config.adapter = :net_http\n github_config.ssl = {:verify => false}\n end\n end", "def method_missing(method, *args)\n if @github.respond_to?(method)\n @github.send(method, *args)\n else\n super\n end\n end", "def githubize\n # method goes here\n end", "def execute\n get_repo(repo_name).repo.fetch\n end", "def github_api(user = current_user)\n @github_api ||= GithubApi.new(github_token, user)\n end", "def _github\n Lexhub.configuration.github\n end", "def new(options = {}, &block)\n #@api_client = Github::Client.new(options, &block)\n end", "def repository\n @repository ||= Github::Repository.find user: user, name: name\n end", "def command_runner\n SimpleCommander::Runner.instance\nend", "def config_github(api_key)\n @github = GitHub.new(api_key)\n end", "def github(name, ref = 'master')\n gitrepo \"github.com\", name, ref\nend", "def repo(user_name, repo_name)\n Github::Repo.new @access_token, user_name, repo_name\n end", "def github\n @github ||= (\n require 'detroit'\n require 'detroit-github'\n Detroit::GitHub.new(\n :folder => 'website'\n #:sitemap => {\n # 'index.html' => 'index.html',\n # 'doc.json' => 'doc.json',\n # 'assets' => 'assets'\n #}\n )\n ) \nend", "def client\n Octokit::Client.new(\n access_token: ENV['GITHUB_ACCESS_TOKEN']\n )\n end", "def client\n Octokit::Client.new(\n access_token: ENV['GITHUB_ACCESS_TOKEN']\n )\n end", "def client\n Octokit::Client.new(access_token: decrypt(@user.github_token))\n end", "def initialize(user = nil, api_token = nil, repo_name = \"cookie_monster\") \n if user.nil?\n puts \"No user provided, getting from git config\"\n user = `git config --get github.user`.chomp\n end\n\n if api_token.nil?\n puts \"No API token provided, getting from git config\"\n api_token = `git config --get github.token`.chomp\n end\n\n\n @user = user.chomp # chomp in case user passes in bad data\n @api_token = api_token.chomp # chomp in case user passes in bad data\n @repo_name = repo_name\n\n # Authenticated client\n #@client = Octopussy::Client.new({:login => @user, :token => @api_token})\n\n # Location of local git repository. Necessary for pushing to Github.\n # Put it in .cloud_path so it doesn't conflict with anything\n @git_dir_path = File.expand_path(\"~/.cloud_path/\" + @repo_name)\n\n create_repo\n create_git_dir\n \n # For whatever reason, Repository.find raises Octopi::NotFound when\n # we've just created the repository in this run of the script.\n # Possibly a caching error.\n begin\n repo = Repository.find(:user => @user, :repo => @repo_name)\n rescue Octopi::NotFound\n puts \"Repository not found. Probably just created repository, please\"\n puts \"run this script again.\"\n exit 0\n end\n end", "def command_runner cmd:, repo:nil, branch:nil\n status = run_cmd(cmd)\n status\n end", "def client\n pry(Git::Hub.send(:client))\nend", "def configure(options = {})\n api = Github.new\n config = GithubCLI.config\n\n ssl = config.fetch('core.ssl')\n adapter = config.fetch('core.adapter')\n token = config.fetch('user.token')\n site = config.fetch('core.site')\n endpoint = config.fetch('core.endpoint')\n\n api.basic_auth = set_basic_auth(config, options)\n api.ssl = ssl if ssl && ssl != ''\n api.adapter = adapter.to_sym if adapter && adapter != ''\n api.oauth_token = token if token && token != ''\n api.site = site if site && site != ''\n api.endpoint = endpoint if endpoint && endpoint != ''\n api.auto_pagination = options['auto_pagination'] || config.fetch('core.auto_pagination')\n\n if (test_env = ENV['TEST_HOST'])\n api.endpoint = 'http://' + test_env\n end\n api\n end", "def github\n process_oauth_callback\n end", "def create_client\n token = File.open(GITHUB_TOKEN_FILE).read\n Octokit::Client.new(access_token: token)\nend", "def exec(command)\n #logger.debug { \"Github: Executing command: '#{command}'\" }\n #p \"Github: Executing command: '#{command}'\"\n \n # Get a path to a temp file\n #logfile = Tempfile.new('github__exec')\n #logfile.close\n \n #success = system(\"#{command} > #{logfile.path} 2>&1\")\n #output_from_command = File.readlines(logfile.path)\n #output_from_command = %x[command]\n shell = Shell.new(command)\n shell.run\n success = (shell.exitstatus == 0)\n output_from_command = shell.output\n if success\n #logger.debug { \"Github: Command output: #{output_from_command.inspect}\"}\n #p \"Github: Command output: #{output_from_command.inspect}\"\n return output_from_command\n else\n #logger.error { \"Github: Command '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"}\n p \"Github: Command failed '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"\n end\n \n #ensure\n #logfile.unlink\n end", "def git command, *args\n run 'git', command.to_s, *args\nend", "def github_repo(access_token, repo)\n client = Octokit::Client.new :access_token => access_token\n client.repo repo\n end", "def fetch_github_data\n self.info = GithubInfoFetcher.new.call(github_path).to_h\n end", "def initialize(dependency, options = {})\n @repo_identifier = options.delete(:github)\n if repo_identifier.end_with?(\".git\")\n raise InvalidGitHubIdentifier.new(repo_identifier)\n end\n @protocol = (options.delete(:protocol) || DEFAULT_PROTOCOL).to_sym\n options[:git] = github_url\n super\n end", "def initialize( args = {} )\n\n ::Octokit.configure do |c|\n c.access_token = args[:github_auth] || ENV['GITHUB_AUTH']\n c.auto_paginate = true\n end\n\n @params = {}\n @params[:context] = args[:context] or raise \"Requires a context\"\n @params[:target_url] = args[:url]\n \n path = args[:repo] || '.'\n @repo = GithubInformer.determine_repo(path)\n @sha = GithubInformer.determine_sha(path)\n end", "def git\n @git ||= Grit::Repo.new(path)\n end", "def git\n @git ||= Grit::Repo.new(path)\n end", "def github_repo(access_token, api_endpoint, repo)\n client = Octokit::EnterpriseAdminClient.new :access_token => access_token :api_endpoint => api_endpoint\n client.repo repo \n end", "def provider\n :github\n end", "def git\n @git ||= Git::Repo.new \"git@#{hostname}:hoboku.git\"\n end", "def repo\n @repo ||= OctocatHerder::Repository.new(@raw['repo'], connection)\n end", "def github_url\n \"https://github.com/#{self.nickname}\"\n end", "def GitSimple(*args) # rubocop:disable Naming/MethodName\n GitSimple.new(*args)\nend", "def repo (slug, githubToken)\n\n puts \"Retrieving #{slug} from GitHub...\"\n\n urlString = 'https://api.github.com/repos/' + slug + '?access_token=' + githubToken\n\n uri = URI(urlString)\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = (uri.scheme == 'https')\n\n request = Net::HTTP::Get.new(uri)\n request['Accept'] = 'application/vnd.github.v3+json'\n\n result = client.request (request)\n\n case result\n when Net::HTTPSuccess, Net::HTTPRedirection\n repoData = JSON.parse(result.body)\n return repoData\n else\n\treturn nil\n end\nend", "def setup\n Github::Configuration.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Github::Default.options[key])\n end\n self\n end", "def git(args, &block)\n Sprout::GitTask.define_task(args, &block)\nend", "def execute\n current = GitHub::PullRequest.current\n\n if current\n cli.say \"Opening Pull Request #{current.number}\"\n cli.open current.pull_request.html_url\n end\n end", "def git_fetch\n Command.new(\"git\", \"fetch\", \"--tags\").run!.raise!\nend", "def fetch\n return nil if !repo || !user\n if fetched?\n pull\n else\n clone\n end\n end", "def command_object\n @command_object ||= GitPusshuTen::Command.new(cli, configuration, hooks, environment)\n end", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "def call\n wiki.repo.git.pull({}, 'orgin', 'master')\n\n if settings.site\n if Dir.exist?(site_path)\n $stderr.puts \"Pulling `#{repo.branch}' from `origin' in `#{repo.path}'...\"\n repo.pull\n else\n $stderr.puts \"Cloning `#{repo.origin}' in `#{repo.path}'...\"\n repo.clone\n end\n end\n end", "def fetch_github_information\n self.associated_commit_shas = []\n self.branch_name = nil\n self.username = nil\n\n return if self.dev_build\n\n GithubService.run(self.project.github_root_url, self.project.github_repo) do |service|\n if self.is_branch_build\n self.associated_commit_shas = service.github_commits(10, self.commit_sha)\n self.branch_name = nil\n self.username = nil\n else\n self.associated_commit_shas = []\n info = service.user_and_branch_for_pull_request(self.pull_request_number)\n self.username = info[:user]\n self.branch_name = info[:branch]\n end\n end\n end", "def project_from_github(input)\n Github::ProjectMapper\n .new(App.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end", "def repo() \n\t\treturn @repo if @repo != nil\n\t\t@repo = Grit::Repo.new(self[:path])\n\tend", "def add_git_facts\n # see if we're in a git repo. first, we need a directory that exists\n dir = @path.expand_path.ascend.find {|p| p.directory? }\n \n Dir.chdir(dir) do\n root_result = Cmds.new \"git rev-parse --show-toplevel\"\n \n unless root_result.ok?\n @result.in_git_repo = false\n @result.is_git_root = false\n return\n end\n \n @result.in_git_repo = true\n \n git = @result.git = Result.new\n git.root = Pathname.new root_result.out.chomp\n @result.is_git_root = @path == git.root\n \n user = git.user = Result.new\n \n ['name', 'email'].each {|key|\n user[key] = begin\n Cmds.chomp! \"git config user.#{ key }\"\n rescue\n end\n }\n \n git.origin = begin\n Cmds.chomp! \"git remote get-url origin\"\n rescue\n end\n \n match = GITHUB_SSH_URL_RE.match(git.origin) ||\n GITHUB_HTTPS_URL_RE.match(git.origin)\n \n git.is_github = !! match\n \n return unless match\n \n git.owner = match['owner']\n git.name = match['name']\n git.full_name = \"#{ git.owner }/#{ git.name }\"\n \n if true == @args['github_api']\n github = git.github = Result.new\n github.api_url = \"https://api.github.com/repos/#{ git.owner }/#{ git.name }\"\n \n response = Net::HTTP.get_response URI(github.api_url)\n \n if response.is_a? Net::HTTPSuccess\n # parse response body and add everything to github result\n parsed = JSON.parse response.body\n parsed.each {|k, v| github[k] = v}\n else\n # assume it's private if we failed to find it\n github.private = true\n end\n \n end\n end\n end", "def github\n @obj['github']\n end", "def configure_github_access\n if Settings.instance.oauth_token\n @github = Octokit::Client.new(\n :login => Settings.instance.username,\n :oauth_token => Settings.instance.oauth_token\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def client\n client_object_exists = (defined?(@client) != nil)\n if client_object_exists\n return @client\n else\n # When coming through a commit hook endpoint, the github_id won't be saved\n # in the session, so we need to be able to grab it from a class instance variable.\n # @todo: actually there's a better way to do this. See it mentioned in my\n # other @todo in this file.\n if session[:github_id] != nil\n github_id = session[:github_id]\n elsif @github_id != nil\n github_id = @github_id\n else\n authenticate!\n end\n\n user = User.find_by(github_id: github_id)\n if Octokit.validate_credentials({ :access_token => user.token })\n # Auto paginate to prevent repo-list truncation on the books/new page. This may\n # hurt performance, so keep an eye on it.\n @client = Octokit::Client.new :access_token => user.token, :auto_paginate => true\n else\n authenticate!\n end\n end\nend", "def git_fetch\n Command.new(\"git\", \"fetch\", \"--tags\", \"-f\").run!.raise!\nend", "def fetch\n git :fetch\n end", "def project_from_github(input)\n Github::ProjectMapper\n .new(Api.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end", "def main()\n\n # check that 3 arguments have been given, otherwise exit\n if ARGV.length < 3\n puts \"You haven't given enough arguments.\"\n exit\n end\n\n # the first argument should be the path to the local repository\n repo_path = ARGV[0]\n\n # the second argument should be the relevant GitHub username\n username = ARGV[1]\n\n # the third argument should be the repository name on GitHub\n repo_name = ARGV[2]\n\n # invoke link_commits with the arguments\n link_commits(repo_path, username, repo_name).each { |link| puts link }\nend", "def repo; end", "def repo; end", "def repo; end", "def repo; end", "def repository\n Repository[self]\n end", "def launch(path)\n # force leading slash\n path.insert(0, '/') unless path[0] == '/'\n url = \"https://github.com/#{repo_github_path + path.chomp}\"\n # use open if on OSX\n if RUBY_PLATFORM.downcase.include? \"darwin\"\n %x{open #{url}}\n else\n puts url\n end\n end", "def name\n 'GitHub'\n end", "def url\n \"http://github.com/#{login}\"\n end", "def github_repo\n self.github_url&.gsub(\"https://github.com/\", \"\")\n end", "def repository(uri, client)\n repo = client.repo uri\n repo\n rescue Octokit::InvalidRepository\n raise gem.to_s + ' didnt have github repo'\n end", "def initialize(args = [])\n @args = args\n command = args.shift\n if command && self.respond_to?(command)\n unless command == 'help'\n @user, @repo = repo_info\n return unless @user && @repo && configure_github_access\n update unless command == 'clean'\n end\n self.send command\n else\n unless command.nil? || command.empty? || %w(-h --help).include?(command)\n puts \"git-review: '#{command}' is not a valid command.\\n\\n\"\n end\n help\n end\n rescue UnprocessableState\n puts 'Execution of git-review command stopped.'\n end", "def github\n self.account.blank? ? nil : GitHub::API.user(self.account)\n end", "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend\nend", "def initialize shell\n @shell = shell\n @heroku_home = File.join ENV[\"HOME\"], \".heroku\"\n @credentials_file = File.join @heroku_home, CREDENTIALS\n end", "def manifest\n repo_name = url_path[0] == \"/\" ? url_path[1..-1] : url_path\n\n GithubRepositoryResource.new(repo_name, @client).to_h\n end", "def new_command_runner(*args, &block)\n SimpleCommander::Runner.instance_variable_set :\"@singleton\", SimpleCommander::Runner.new(args)\n program :name, 'test'\n program :version, '1.2.3'\n program :description, 'something'\n create_test_command\n yield if block\n SimpleCommander::Runner.instance\nend", "def configure_github_access\n settings = ::GitReview::Settings.instance\n if settings.oauth_token && settings.username\n @github = Octokit::Client.new(\n :login => settings.username,\n :access_token => settings.oauth_token,\n :auto_traversal => true\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def git_wrapper (dpath = Dir.pwd)\n\n\tbegin\n\t\tRugged::Repository.new(dpath)\n\n\trescue Rugged::RepositoryError => err\n\n\t\tputs \"could not find repository at #{dpath}\"\n\t\texit 1\n\n\trescue Exception => err\n\n\t\tputs \"an error occurred while opening .git repository for #{dpath}\"\n\t\tputs err.message\n\t\texit 1\n\n\tend\n\nend", "def cmd(*args) self.class.cmd(*args) end", "def repo(klass)\n @repository = klass\n end" ]
[ "0.68239033", "0.64665717", "0.6461043", "0.6412371", "0.6291616", "0.6260287", "0.62471646", "0.62171435", "0.6216496", "0.61708087", "0.61430794", "0.61316955", "0.6023944", "0.6015977", "0.60138416", "0.5982394", "0.59594345", "0.59146583", "0.58963484", "0.589361", "0.5890446", "0.58463967", "0.5840042", "0.58132786", "0.58014214", "0.5753796", "0.5744969", "0.57205284", "0.5647322", "0.5647322", "0.5638128", "0.5619055", "0.559931", "0.5585402", "0.55754167", "0.5571706", "0.5567607", "0.55610865", "0.5544728", "0.55356914", "0.5508082", "0.54793924", "0.5479282", "0.54697305", "0.54697305", "0.5467142", "0.54555297", "0.5450737", "0.54454744", "0.54140824", "0.5410009", "0.5390901", "0.53896314", "0.53886473", "0.53454065", "0.53277594", "0.5315326", "0.53104055", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.5306903", "0.53057784", "0.52870977", "0.52836996", "0.52771425", "0.5263793", "0.5256292", "0.5250099", "0.5246632", "0.5232968", "0.52313864", "0.52234197", "0.5222179", "0.52201253", "0.52201253", "0.52201253", "0.52201253", "0.52195716", "0.5219566", "0.5215875", "0.5212112", "0.5211227", "0.52080226", "0.52037805", "0.51988035", "0.5198726", "0.5196595", "0.51897347", "0.5185667", "0.5178941", "0.5176465", "0.5169192", "0.5156152" ]
0.64671826
1
Since this controller is a nested resource under the cars resource, all invocations will include a `:car_id` parameter to tell us which car we are working with.
def fetch_car @car = current_user.cars.find(params[:car_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_car\n\t\t\t@car = Car.find(params[:car_id])\n\t\tend", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n \n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:id])\n end", "def set_car\n @car = Car.find(params[:car_id]) if params[:car_id]\n end", "def set_car\r\n @car = Car.find(params[:id])\r\n end", "def set_car_info\n @car_info = CarInfo.find(params[:id])\n end", "def set_car\n @car = Car.find_by_id(params[:id])\n end", "def set_car\n puts \"#{params[:id]}yeeeeeeee\" \n @car = Car.find(params[:id])\n \n end", "def find_car\n @car = current_user.cars.find(params[:car_id])\n end", "def find_car\n @car = current_user.cars.find(params[:car_id])\n end", "def set_car_show\n @car_show = CarShow.find(params[:id])\n end", "def show\n @car = Car.find(params[:id])\n end", "def show\n @car = Car.find(params[:id])\n end", "def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end", "def set_car\n @car = Car.friendly.find(params[:id])\n end", "def car \n\t \t@car ||= Car.where(id: params[:id]).first\n\t end", "def set_car_request\n @car_request = CarRequest.with_user(current_user).find(params[:id])\n end", "def show\n # @car = Car.find(params[:id])\n end", "def set_car_specific_spec\n @car_specific_spec = CarSpecificSpec.find(params[:id])\n end", "def set_car_item\n @car_item = CarItem.find(params[:id])\n end", "def set_car_make\n @car_make = CarMake.find(params[:id])\n end", "def set_car\n #@car = Car.find(params[:id])\n @car = current_user.cars.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to cars_url, alert: \"Car not found.\"\n end", "def car_params\n params[:car]\n end", "def set_order_car\n @order_car = OrderCar.find(params[:id])\n end", "def show\n @car = Car.find(params[:id])\n gon.car = @car\n end", "def set_car_model\r\n @car_model = CarModel.find(params[:id])\r\n end", "def set_car_order\n @car_order = CarOrder.find(params[:id])\n end", "def edit\n\t\t@car = Car.find( params[:id] )\n\tend", "def set_cars1\n @cars1 = Cars1.find(params[:id])\n end", "def show\n #@car = current_user.cars.find(params[:id])\n end", "def set_car_item\n @car_item = Car::Item.find(params[:id])\n end", "def edit\n @car = Car.find(params[:id])\n end", "def find_car\n @car = current_user.cars.find(params[:id])\n authorize(@car)\n end", "def show\r\n @car = policy_scope(Car).find(params[:id])\r\n end", "def set_showcar\n @showcar = Showcar.find(params[:id])\n end", "def set_rental_car\n @rental_car = RentalCar.find(params[:id])\n end", "def show\n @cars = Car.where(dealership_id: params[:id])\n render json: { dealership: @dealership, cars: @cars }\n \n end", "def set_car_type\n @car_type = CarType.find(params[:id])\n end", "def set_carpark\n @carpark = Carpark.find(params[:id])\n end", "def edit\n @car = Car.find params[:id]\n end", "def set_carproduct\n @carproduct = Carproduct.find(params[:id])\n end", "def set_car2\n @car2 = Car2.find(params[:id])\n end", "def show\n @car = Car.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @car }\n end\n end", "def show\n @car = Car.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @car }\n end\n end", "def show\n @car = Car.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @car }\n end\n end", "def set_car\r\n @car = Car.find(params[:id])\r\n authorize @car\r\n end", "def show\n @cars = Car.sort_by(dealership_id: params[:id])\n render json: { cars: @cars }\n \n end", "def set_car_park\n @car_park = CarPark.find(params[:id])\n end", "def set_car_park\n @car_park = CarPark.find(params[:id])\n end", "def set_cars_part\n @cars_part = CarsPart.find(params[:id])\n end", "def set_carrefour\n @carrefour = Carrefour.find(params[:id])\n end", "def index\n @car_specific_specs = CarSpecificSpec.all\n end", "def set_race_car\n @race_car = RaceCar.find(params[:id])\n end", "def set_car_sale\n @car_sale = CarSale.find(params[:id])\n end", "def show\n #@rental = @car.rentals.build[:id]\n #@car=Car.find(params[:id])\n\n end", "def show\n\t\t@carro = Carro.find(params[:id])\n\tend", "def set_carro\n @carro = Carro.find(params[:id])\n end", "def set_carro\n @carro = Carro.find(params[:id])\n end", "def index\n if params[:car_id]\n @car = Car.find(params[:car_id])\n if @car.owner_type == 'User'\n raise NotPrivileged unless @car.owner_id == @current_user.id\n @documents = @car.documents\n\n respond_with @documents\n elsif @car.owner_type == 'Group'\n @group = Group.find(@car.owner_id)\n raise NotPrivileged unless @group.is_member?(@current_user)\n @documents = @car.documents\n\n respond_with @documents\n end\n elsif params[:expense_id]\n @expense = Expense.find(params[:expense_id])\n @car = Car.find(@expense.car_id)\n if @car.owner_type == 'User'\n raise NotPrivileged unless @car.owner_id == @current_user.id\n @documents = @expense.documents\n\n respond_with @documents\n elsif @car.owner_type == 'Group'\n @group = Group.find(@car.owner_id)\n raise NotPrivileged unless @group.is_member?(@current_user)\n @documents = @expense.documents\n\n respond_with @documents\n end\n end\n end", "def car_params\n if(params.has_key?(:car))\n params.require(:car).permit(:make, :model, :year, :color, :vin, :licence, :picture_url, :picture_url_cache,\n :vehicle_type, :body_class, :doors, :gross_vehicle_weight_rating, :transmission_style, :engine_number_of_cylinders, :engine_power, :fuel_type)\n end\n\n end", "def set_electriccar\n @electriccar = Electriccar.find(params[:id])\n end", "def set_cari\n @cari = Cari.find(params[:id])\n end", "def set_cars_type\n @cars_type = CarsType.find(params[:id])\n end", "def index\n if params.has_key?(:space_id)\n provided_space_id = params[:space_id] # get the space_id\n car_ids_belonging_to_the_space_id = CarsSpaces.select('car_id').where(space_id: provided_space_id) # array with car_id from the join table that belong to the space_id\n @cars = Car.where(id: car_ids_belonging_to_the_space_id)\n else\n @cars = Car.all\n end\n end", "def car_params\n params.require(:car).permit(:make, :model, :image, :company_id)\n end", "def update\n authenticate_request!\n\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n head :no_content\n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end", "def set_car_road_order\n @car_road_order = CarRoadOrder.find(params[:id])\n end", "def update\n respond_to do |format|\n if @car.update(car_params)\n current_user.car_id = @car.id\n current_user.save\n format.html { redirect_to @car, notice: 'Car was successfully updated.' }\n format.json { render :show, status: :ok, location: @car }\n else\n format.html { render :edit }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_car_feature\n @car_feature = CarFeature.find(params[:id])\n end", "def update\n\t\t@car = Car.find( params[:id] )\n\t\tif @car.update_attributes( car_params )\n\t\t\tredirect_to car_path( params[:id] )\n\t\tend\n\tend", "def car_id\n super || rental.car_id\n end", "def show\n @car = Car.find(params[:car_id])\n @lien_procedure = @car.lien_procedures.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lien_procedure }\n end\n end", "def user_cars\n @cars = Car.where(user_id: params[:id])\n @bookings = Booking.select(:car_id).where(renter_id: params[:id])\n render json: @cars\n end", "def set_car_config\n @car_config = Car::Config.find(params[:id])\n end", "def car_params\n params.require(:car).permit(:car_make, :car_model, :car_version, :car_year, :car_city, :car_mileage, :car_price, :car_trans, :car_desc, :car_type, :car_approval, :user_id, photos_attributes: [:id, :image, :car_id])\n end", "def get_part_by_car\n @cars = PartsController::PartService.get_part_by_car(params[:param]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end" ]
[ "0.7178004", "0.7138821", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.71370673", "0.7136398", "0.70839494", "0.70784557", "0.70784557", "0.7061486", "0.7033147", "0.7023565", "0.6963582", "0.6915341", "0.6829149", "0.6829149", "0.6784021", "0.67839223", "0.67839223", "0.67465776", "0.673274", "0.66820216", "0.66684675", "0.6641024", "0.6638616", "0.6543057", "0.6511803", "0.6502011", "0.6472124", "0.64653444", "0.64560837", "0.64498293", "0.6389855", "0.6376057", "0.6374872", "0.6371996", "0.63563055", "0.63211906", "0.6309933", "0.63012034", "0.629635", "0.6265076", "0.6256027", "0.6250862", "0.62462705", "0.6241973", "0.6240954", "0.6239492", "0.6229929", "0.6229929", "0.6229929", "0.62239355", "0.6197271", "0.61738753", "0.61738753", "0.61604446", "0.6142824", "0.6130841", "0.61223483", "0.6099713", "0.6096148", "0.60778326", "0.60725725", "0.60725725", "0.60653955", "0.6062961", "0.6047852", "0.6038771", "0.6033147", "0.60083205", "0.6001949", "0.60012895", "0.5997098", "0.59954756", "0.5985694", "0.59738815", "0.59647715", "0.5958408", "0.5929111", "0.5925432", "0.5923217", "0.58999336" ]
0.65505254
43
on initialise la variable de classe
def initialize(email_to_save) @email = email_to_save @@user_count += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init; end", "def init; end", "def init; end", "def init; end", "def init\n end", "def init\n end", "def init\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize\n\t\t\n\tend", "def initialize() end", "def at_init\n\n\t\tend", "def initialize\n \n end", "def initialize\n\t\t@age = 10#age aqui es una variable de instancia\n\tend", "def initialize\n init\n end", "def init\n\n end", "def initialize()\n\t\tend", "def initialize\r\n\r\n end", "def initialize()\n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def init; end", "def initialize\n\n\n\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize()\r\n\r\n end", "def initialize\n super()\n init_data()\n end", "def initialize()\n\tend", "def initialize()\n\tend", "def initialize\n\n\nend", "def initialize\n end", "def initialize\n\t\nend", "def initialize\n \n end", "def initialize\n \n end", "def initialize(nombre,edad) #--> se crean los metodos, y se inicializan para darles un valor al crear el objeto \n @nombre = nombre #-->la variable local nombre es asignada a la var. de instancia @nombre, al realizar esto cada instancia tendra un valor propio.\n @edad = edad #--> lo mismo para edad\n\nend", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize\n \n end", "def pre_initialize; end", "def initialize(name) # aqui ionicializamos nuestro contructor ahora que instanciemos un objeto este ira primero aqui \n @nombre = name #esta es una variable de instancia \n end", "def initialize\n set_defaults\n end", "def initialize\n set_defaults\n end", "def initialize\n\t \t# loading or not loading should be the key here.\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 init\n\nend", "def initialize\n super(true)\n end", "def initialize\n\tinit\n\tsuper\nend", "def initialize\nend", "def initialize\n\n end", "def initialize\n\n end", "def constructor; end", "def init_data\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n # nothing here for now\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end" ]
[ "0.78016263", "0.78016263", "0.78016263", "0.78016263", "0.77336735", "0.77336735", "0.77336735", "0.7728234", "0.7728234", "0.77251285", "0.76989883", "0.7646746", "0.760654", "0.7588378", "0.7574087", "0.7568045", "0.7517965", "0.75092226", "0.74332494", "0.7433073", "0.7433073", "0.7433073", "0.7433073", "0.7433073", "0.7433073", "0.7433073", "0.7433073", "0.7433073", "0.7433073", "0.7433073", "0.73890024", "0.7377978", "0.7368691", "0.7368691", "0.7350816", "0.7350816", "0.7350816", "0.7350816", "0.7350816", "0.7335776", "0.7327927", "0.73099345", "0.7290331", "0.7290331", "0.7278093", "0.7264781", "0.72506493", "0.724837", "0.724837", "0.7241207", "0.72192216", "0.72192216", "0.72192216", "0.72192216", "0.72192216", "0.72192216", "0.72136617", "0.72136617", "0.72136617", "0.72136617", "0.72136617", "0.72136617", "0.72136617", "0.72136617", "0.72136617", "0.71966404", "0.71966404", "0.71966404", "0.71966404", "0.71966404", "0.71966404", "0.71966404", "0.71966404", "0.7185787", "0.71701825", "0.7153096", "0.7144335", "0.7144335", "0.714411", "0.7138857", "0.7138857", "0.7138857", "0.7138857", "0.7138857", "0.7138857", "0.7138857", "0.7108369", "0.7099184", "0.709808", "0.70966893", "0.70893955", "0.70893955", "0.70625603", "0.7045744", "0.7043063", "0.7043063", "0.7039048", "0.7027394", "0.7027394", "0.7027394", "0.7027394" ]
0.0
-1
Generate a sitemap.xml file We reimplement the default Jekyll sitemap generator, because we want to leverage the GTN::ModificationTimes class to obtain the last modification date of a page, in a more efficient way than the default Jekyll sitemap Params: +site+:: The +Jekyll::Site+ object
def generate(site) puts '[GTN/Sitemap] Generating' result = '<?xml version="1.0" encoding="UTF-8"?>' result += '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' \ 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 ' \ 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" ' \ 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' site.pages.reject { |t| t.path =~ /ipynb$/ }.each do |t| begin d = Gtn::ModificationTimes.obtain_time(t.path) d.format = '%FT%T%:z' formatted_date = d.to_s rescue StandardError d = Time.new formatted_date = d.strftime('%FT%T%:z') end result += "<url><loc>#{site.config['url'] + site.config['baseurl'] + t.url}</loc>" \ "<lastmod>#{formatted_date}</lastmod></url>" end result += '</urlset>' page2 = PageWithoutAFile.new(site, '', '.', 'sitemap.xml') page2.content = result site.pages << page2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(site)\n puts \"Generating sitemap...\"\n @site = site\n @site.config[\"time\"] = Time.new\n @site.config[\"html_files\"] = html_files.map(&:to_liquid)\n unless sitemap_exists?\n write\n @site.keep_files ||= []\n @site.keep_files << \"sitemap.xml\"\n end\n end", "def build_site(page_count, sitebuildtime, url, sitemap_url)\n # write all the HTML pages to files and build the site map\n sitemap = %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset\n xmlns=\"#{sitemap_url}\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"#{sitemap_url}\n #{sitemap_url}/sitemap.xsd\">\n <url>\n <loc>#{url}</loc>\n <lastmod>#{sitebuildtime}</lastmod>\n <priority>1.00</priority>\n </url>)\n (0..page_count).map do |i|\n file = File.open(\"index#{ii(i)}.html\", 'w')\n file.write(instance_variable_get(\"@page#{ii(i)}\"))\n file.close\n sitemap += %(\n <url>\n <loc>#{url}index#{ii(i)}.html</loc>\n <lastmod>#{sitebuildtime}</lastmod>\n <priority>0.80</priority>\n </url>)\n end\n sitemap += '\n</urlset>'\n file = File.open('sitemap.xml', 'w')\n file.write(sitemap)\n file.close\n file = File.open('robots.txt', 'w')\n file.write(\"Sitemap: #{url}sitemap.xml\")\n file.close\nend", "def generate(site)\n # Configuration\n sitemap_config = site.config['sitemap'] || {}\n\n # create destination directory if it doesn't exist yet\n Dir::mkdir(site.dest) if !File.directory? site.dest\n $fileHtml = File.new(File.join(site.dest, FILE_NAME), \"w+\")\n\n $base = site.dest\n\n traverse(File.join(site.dest, \"/setups\"))\n\n $fileHtml.close()\n\n # Keep the file from being cleaned by Jekyll\n site.static_files << Jekyll::SitemapFile.new(site, site.dest, \"/\", FILE_NAME)\n\n FileUtils.cd('./include')\n FileUtils.cp File.join(site.dest, FILE_NAME), File.join(FileUtils.pwd(), \"scen.html\")\n end", "def generate(site)\n @site = site\n @site.config[\"time\"] = Time.new\n unless feed_exists?\n write\n @site.keep_files ||= []\n @site.keep_files << path\n end\n end", "def generate(site)\n\n # we only change link for pages that are from the wiki\n # our flag is the wiki menu be can also be the page path\n wiki_pages = site.pages.select{ |a| a.data['menu'] == 'wiki' }\n\n @conf = $wikiDatas['conf']\n\n wiki_pages.each do |p|\n\n jekyll_url = @conf['baseurl'] + '/' + @conf['wikiToJekyll']['wiki_dest'] + '/' + p.basename + '.html'\n\n $wikiDatas['pages'][p.basename] = {\n 'possible_uris' => get_possible_uris(p),\n 'jekyll_url' => jekyll_url\n }\n\n end\n end", "def generate_sitemap\n menu, current_context = parse_and_create_menu_data_structure\n return '<ul class=\"site_map\">' + sitemap_output( menu ) + '</ul>'.html_safe\n end", "def generate(site)\n puts 'Indexing pages...'\n \n # gather pages and posts\n items = site.pages.dup.concat(site.posts)\n\n # only process files that will be converted to .html and only non excluded files \n items = items.find_all {|i| i.output_ext == '.html' && ! @excludes.any? {|s| (i.absolute_url =~ Regexp.new(s)) != nil } } \n items.reject! {|i| i.data['exclude_from_search'] } \n \n # only process items that are changed since last regeneration\n items = items.find_all {|i| @last_indexed.nil? || File.mtime(i.full_path_to_source) > @last_indexed }\n\n # dont process index pages\n items.reject! {|i| i.is_a?(Jekyll::Page) && i.index? }\n\t\t\t \n while not @index.running?\n # wait for the indextank index to get ready\n sleep 0.5\n end\n \n items.each do |item| \n page_text = extract_text(site,item)\n\n @index.document(item.absolute_url).add({ \n :text => page_text,\n :title => item.data['title'] || item.name \n })\n puts 'Indexed ' << item.absolute_url\n end\n \n @last_indexed = Time.now\n write_last_indexed()\n \n puts 'Indexing done'\n end", "def generate_sitemap\n end", "def sitemap\n expires_in 1.day, public: true\n\n # The sitemap itself is hosted on Google Cloud storage, we read it from them and send it back to the accessor of this endpoint.\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket ENV.fetch('GCLOUD_BUCKET')\n file = bucket.file \"sitemaps/sitemap.#{I18n.locale}.xml.gz\"\n\n send_data file.download.read, type: 'text/xml'\n end", "def sitemap\n expires_in 1.day, public: true\n\n # The sitemap itself is hosted on Google Cloud storage, we read it from them and send it back to the accessor of this endpoint.\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket ENV.fetch('GCLOUD_BUCKET')\n file = bucket.file \"sitemaps/sitemap.#{I18n.locale}.xml.gz\"\n\n send_data file.download.read, type: 'text/xml'\n end", "def sitemap\n self.root\n self.follow('dtime:sitemap')\n self.get\n self\n end", "def sitemap\n @pages = []\n website.available_locales.each do |l|\n @pages << { url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago }\n end\n render \"sitemap_index\"\n end", "def generate(site)\n end", "def generate(site)\n site.pages.select{|x| x.data.key? 'redirects' }.each do |p|\n p.data['redirects'].each do |r|\n redirect = RedirectPage.new(site, site.source, r, p.url)\n redirect.render(site.layouts, site.site_payload)\n redirect.write(site.dest)\n site.pages << redirect\n end\n end\n end", "def generate(site)\n config = site.config.fetch('jekyll_rdf')\n\n graph = RDF::Graph.load(config['path'])\n sparql = SPARQL::Client.new(graph)\n\n # restrict RDF graph with restriction\n resources = extract_resources(config['restriction'], config['include_blank'], graph, sparql)\n\n site.data['sparql'] = sparql\n site.data['resources'] = []\n\n mapper = Jekyll::RdfTemplateMapper.new(config['template_mappings'], config['default_template'])\n\n # create RDF pages for each URI\n resources.each do |uri|\n resource = Jekyll::Drops::RdfResource.new(uri, graph)\n site.pages << RdfPageData.new(site, site.source, resource, mapper)\n end\n end", "def generate_sitemap(&block)\n DynamicSitemaps::Generator.new.generate(&block)\n end", "def generate(site)\n\n # page_gen_dirs determines whether we want to generate index pages\n # (name/index.html) or standard files (name.html). This information\n # is passed to the DataPage constructor, which sets the @dir variable\n # as required by this directive\n\n index_files = site.config['page_gen-dirs'] == true\n\n # data contains the specification of the data for which we want to generate\n # the pages (look at the README file for its specification)\n data = site.config['page_gen']\n types = site.config['data_types']\n if data\n data.each do |data_spec|\n # template = data_spec['template'] || data_spec['data']\n name = data_spec['name']\n # dir = data_spec['dir'] || data_spec['data']\n # Added 2 lines: Set context and type for JSON-LD \n context = data_spec['context'] || \"http://schema.org/\"\n # type = data_spec['type'] || \"Thing\"\n extension = data_spec['extension'] || \"html\"\n\n # records is the list of records defined in _data.yml\n # for which we want to generate different pages\n records = nil\n data_spec['data'].split('.').each do |level|\n if records.nil?\n records = site.data[level]\n else\n records = records[level]\n end\n end\n records.each do |record|\n # Added 3 lines: Add context and type for JSON-LD to each record\n collection = record[\"collection\"]\n dir = types[collection][\"dir\"] || collection\n template = types[collection][\"template\"]\n type = types[collection][\"type\"]\n record[\"@context\"] = context\n record[\"data\"][\"@type\"] = type\n record[\"data\"][\"name\"] = record[\"name\"]\n site.pages << DataPage.new(site, site.source, index_files, dir, record, name, template, extension)\n end\n end\n end\n end", "def generate(site)\n @site = site\n collections.each do |name, meta|\n Jekyll.logger.info \"Jekyll Feed:\", \"Generating feed for #{name}\"\n (meta[\"categories\"] + [nil]).each do |category|\n path = feed_path(:collection => name, :category => category)\n next if file_exists?(path)\n\n @site.pages << make_page(path, :collection => name, :category => category)\n end\n end\n generate_feed_by_tag if config[\"tags\"] && !@site.tags.empty?\n end", "def create_sitemap\n end", "def generate(site)\n if site.layouts.key? 'tag_index'\n dir = site.config['tag_dir'] || 'tag'\n ## Create Top level tag list /tag/index.html\n write_all_tags_index(site, dir, site.tags.keys.sort_by { |x| x.downcase } )\n \n ## Create /tag/{{tag}}/index.html\n site.tags.keys.each do |tag|\n write_tag_index(site, File.join(dir, tag.to_url), tag)\n end\n end\n end", "def generate(site)\n puts \"Generating latest articles\" \n paginate(site)\n end", "def generate(site)\n Joiner.join_data(site)\n CrossReferencer.build_xrefs(site.data)\n Canonicalizer.canonicalize_data(site.data)\n PrivateAssets.copy_to_site(site)\n Auth.generate_artifacts(site)\n Api.generate_api(site)\n\n Team.generate_pages(site)\n Locations.generate_pages(site)\n Projects.generate_pages(site)\n Departments.generate_pages(site)\n WorkingGroups.generate_pages(site)\n Snippets.generate_pages(site)\n Skills.generate_pages(site)\n end", "def sitemap\n @pages = Page.sitemap\n respond_to do |format|\n format.xml { render layout: 'alchemy/sitemap' }\n end\n end", "def sitemap\n @pages = Page.sitemap\n respond_to do |format|\n format.xml { render layout: \"alchemy/sitemap\" }\n end\n end", "def sitemap\n @pages = Page.sitemap\n end", "def sitemap\n @pages = Page.find_all_by_sitemap_and_public(true, true)\n respond_to do |format|\n format.xml { render :layout => \"sitemap\" }\n end\n end", "def destination_path\n if @site.respond_to?(:in_dest_dir)\n @site.in_dest_dir(\"sitemap.xml\")\n else\n Jekyll.sanitized_path(@site.dest, \"sitemap.xml\")\n end\n end", "def sitemap\n @tlsitemap_entries = []\n #Get only published timelines\n Timeline.find_each(:batch_size => 500, :conditions => [\"visibility = ?\", VIS_PUBLIC]) do |each_tl|\n @tlsitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{timeline_path(each_tl)}\")\n end\n \n @homepage_entry = \"#{request.protocol}#{request.host_with_port}\"\n \n @other_sitemap_entries = []\n # About, FAQ, Browse, Showcase\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{about_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{browse_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{showcase_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{faq_path}\")\n \n render :template => \"timelines/sitemap\", :formats => [:xml], :handlers => :haml\n end", "def generate(site)\n site.pages.dup.each do |page|\n paginate(site, page) if Pager.pagination_enabled?(site.config, page.name)\n end\n end", "def sitemap pages = nil, indent = 0\n pages ||= self.subpages\n dated, regular = pages.partition(&:dated?)\n\n bonus = 0\n prev = nil\n regular = regular\n subpages =\n regular.sort_by { |p| p.url } +\n dated.sort_by { |p| [-p.date.to_i, p.url] }\n\n subpages.map { |page|\n x = []\n\n if page.dated? then\n bonus = 1\n fmt ||= page.config[\"date_fmt\"] || \"%Y-%m\" # REFACTOR: yuck\n curr = page.date.strftime fmt\n if prev != curr then\n x << \"#{\" \" * (indent)}* #{curr}:\"\n prev = curr\n end\n end\n\n x << \"#{\" \" * (indent+bonus)}* [#{page.title}](#{page.clean_url})\"\n x += [page.sitemap(nil, indent+bonus+1)] unless page.subpages.empty?\n x\n }.flatten.join \"\\n\"\n end", "def generate(site)\n Jekyll.logger.info(\"Geolexica:\", \"Generating concept pages\")\n\n # Jekyll does not say why it's a good idea, and whether such approach\n # is thread-safe or not, but most plugins in the wild do exactly that,\n # including these authored by Jekyll team.\n @site = site\n @generated_pages = []\n\n make_pages\n sort_pages\n group_pages_in_collections\n end", "def generate(site)\n site.data['pages'].each do |page|\n if !page['external']\n require 'cgi'\n\n page['name'] = CGI.escapeHTML(page['name']) if page['name']\n site.pages << SitePage.new(site, site.source, page)\n\n zones = {}\n keys = %w[content preferences]\n\n if page['block_instances'].length\n # create zone buckets\n page['block_instances'].each do |i|\n # go through all content\n if site.config.event?\n keys.each do |key|\n i[key].each do |k, v|\n if v.is_a?(String) && v.match(/\\{\\{/)\n # maintain the {{ t.foo }} variables\n v.gsub!(/(\\{\\{\\s*t\\.[a-z_.]+\\s*\\}\\})/, '{% raw %}\\1{% endraw %}')\n i[key][k] = Liquid::Template.parse(v).render('event' => site.data['event'], 'mappable' => site.data['mappable'])\n end\n end\n end\n end\n zones[i['zone']] = [] if zones[i['zone']].nil?\n zones[i['zone']] << i\n end\n\n # sort each bucket by widget weight\n zones.each do |k, zone|\n zone.sort! { |x, y| x['weight'] <=> y['weight'] }\n end\n\n page_source_path = File.join(site.source, page['slug'])\n FileUtils.mkdir_p(page_source_path) unless File.exists?(page_source_path)\n\n json_filename = site.config.attendease['private_site'] ? 'index-private.json' : 'index.json'\n\n File.open(File.join(page_source_path, json_filename), 'w') do |f|\n f.write zones.to_json\n f.close\n end\n\n site.static_files << StaticFile.new(site, site.source, File.join('', page['slug']), json_filename)\n end\n end\n end\n end", "def sitemap\n @sitemap ||= raw_sitemap\n end", "def generate(site)\n @site = site\n @config = @site.config[\"shortener\"] || {}\n @logger_prefix = \"[jekyll-shortener]\"\n\n #\n # Configure our URL shortening methods. The selected method will be\n # pulled later based on our configuration.\n #\n @methods = {\n \"internal\" => lambda { |cache, post| get_internal_url(cache, post) }\n }\n\n ShortURL.valid_services.each do |sym|\n @methods[sym.id2name] = lambda { |cache, post| get_shorturl_url(cache, post, sym) }\n end\n\n #\n # Set page exclusions. Note, we always exclude the root/index page.\n #\n @exclude = ((@config[\"exclude\"] || []) << \"^/$\").map { |p| Regexp.new(p) }\n\n #\n # Now pull the URL shortening method and related configuration.\n #\n method = @config[\"method\"]\n methodcb = @methods[method]\n\n if method.nil?\n return\n end\n\n if methodcb.nil?\n log(\"error\", \"Invalid URL shortening method '#{method}'\")\n\n return\n end\n\n if method == \"internal\" and ! @config.key? \"shorturl\"\n log(\"error\", \"Internal URL shortening method requires 'shortener.shorturl' to be set.\")\n\n return\n end\n\n #\n # Finally, pull the list of pages and generate our short URLs.\n #\n pages = get_page_list(@config[\"pages\"] || false, @config[\"collections\"] || [])\n\n if pages.length == 0\n log(\"error\", \"URL shortener is enabled but no pages are configured for shortening.\")\n\n return\n end\n\n with_url_cache do |cache|\n pages.each do |page|\n begin\n page.data[\"shorturl\"] = get_short_url(methodcb, cache, page)\n rescue StandardError => e\n log(\"error\", \"#{e} while getting short URL for '#{page.url}' using method '#{method}', skipping...\")\n end\n end\n end\n end", "def generate(site)\n # layout: tutorial_slides\n # layout: base_slides\n\n site.pages.select { |page| SLIDE_LAYOUTS.include? page.data['layout'] }.each do |page|\n dir = File.dirname(File.join('.', page.url))\n page2 = Jekyll::Page.new(site, site.source, dir, page.name)\n page2.data['layout'] = 'slides-plain'\n page2.basename = if page2.data.key?('lang')\n \"slides-plain_#{page2.data['lang'].upcase}\"\n else\n 'slides-plain'\n end\n page2.content = page2.content.gsub(/^name:\\s*([^ ]+)\\s*$/) do\n anchor = ::Regexp.last_match(1)\n\n \"<span id=\\\"#{anchor.strip}\\\"><i class=\\\"fas fa-link\\\" aria-hidden=\\\"true\\\"></i> #{anchor}</span>\"\n end\n if page2.data.key?('redirect_from')\n page2.data['redirect_from'].map { |x| x.gsub!(%r{/slides}, '/slides-plain') }\n end\n\n site.pages << page2\n end\n end", "def generate(site)\n\n if site.data.has_key?('site_config')\n hash_to_hash(site.data['site_config'], site.config)\n end\n\n production = false\n if Jekyll.env == 'production'\n production = true\n end\n if site.config.has_key?('environment') && site.config['environment'] == 'production'\n production = true\n end\n\n if production && site.data.has_key?('site_config_prod')\n hash_to_hash(site.data['site_config_prod'], site.config)\n end\n\n # Look for environment variables for some settings.\n env_settings = [\n 'REPOSITORY_URL_SITE',\n ]\n env_settings.each do |setting|\n if ENV.has_key?(setting)\n site.config[setting.downcase] = ENV[setting]\n end\n end\n\n # Abort early if some required settings are not there.\n unless site.config.has_key?('languages') && site.config['languages'].length > 0\n opensdg_error('The \"languages\" site configuration must have at least one language. See the documentation here: https://open-sdg.readthedocs.io/en/latest/configuration/#languages')\n end\n\n # Hardcode some variables.\n site.config['disaggregation_status'] = {}\n site.config['disaggregation_status']['status_types'] = [\n {\n 'value' => 'complete',\n 'label' => 'status.disaggregation_status_complete',\n },\n {\n 'value' => 'inprogress',\n 'label' => 'status.disaggregation_status_inprogress',\n },\n {\n 'value' => 'notstarted',\n 'label' => 'status.disaggregation_status_notstarted',\n },\n {\n 'value' => 'notapplicable',\n 'label' => 'status.disaggregation_status_notapplicable',\n },\n ]\n\n # Provide some defaults.\n if !site.config.has_key?('time_series_attributes') or site.config['time_series_attributes'].length == 0\n site.config['time_series_attributes'] = [\n {\n 'field' => 'COMMENT_TS',\n 'label' => 'indicator.footnote',\n },\n {\n 'field' => 'DATA_LAST_UPDATE',\n 'label' => 'metadata_fields.national_data_update_url'\n },\n ]\n end\n end", "def generate(site)\n # page_gen_dirs determines whether we want to generate index pages\n # (name/index.html) or standard files (name.html). This information\n # is passed to the DataPage constructor, which sets the @dir variable\n # as required by this directive\n index_files = site.config['page_gen-dirs'] == true\n\n # data contains the specification of the data for which we want to generate\n # the pages (look at the README file for its specification)\n data = site.config['page_gen']\n if data\n data.each do |data_spec|\n index_files_for_this_data = data_spec['index_files'] != nil ? data_spec['index_files'] : index_files\n template = data_spec['template'] || data_spec['data']\n name = data_spec['name']\n title = data_spec['title']\n dir = data_spec['dir'] || data_spec['data']\n extension = data_spec['extension'] || \"html\"\n\n if site.layouts.key? template\n # records is the list of records defined in _data.yml\n # for which we want to generate different pages\n records = nil\n data_spec['data'].split('.').each do |level|\n if records.nil?\n records = site.data[level]\n else\n records = records[level]\n end\n end\n\n # apply filtering conditions:\n # - filter requires the name of a boolean field\n # - filter_condition evals a ruby expression\n records = records.select { |r| r[data_spec['filter']] } if data_spec['filter']\n records = records.select { |record| eval(data_spec['filter_condition']) } if data_spec['filter_condition']\n\n records.each do |record|\n site.pages << DataPage.new(site, site.source, index_files_for_this_data, dir, record, name, title, template, extension, data_spec['defaults'])\n end\n else\n puts \"error (datapage_gen). could not find template #{template}\" if not site.layouts.key? template\n end\n end\n end\n end", "def index\n @pages = []\n website.available_locales.each do |l|\n @pages << {\n url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago}\n end\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def generate(site)\r\n if site.config['paginate_tag_basepath']\r\n posts_by_tag = get_posts_by_tag(site)\r\n \r\n site.pages << Index.new(site, site.source, posts_by_tag)\r\n \r\n posts_by_tag.each do |tag, posts|\r\n paginate_tag(site, tag, posts)\r\n end\r\n end\r\n end", "def generate(site)\n # page_gen_dirs determines whether we want to generate index pages\n # (name/index.html) or standard files (name.html). This information\n # is passed to the DataPage constructor, which sets the @dir variable\n # as required by this directive\n puts \"debug\"\n index_files = site.config['page_gen-dirs']\n index_files = true if index_files.nil?\n\n # config contains the specification of the data for which we want to generate\n # the pages (look at the README file for its specification)\n config = site.config['data_gen']\n\n # default configuration: get all data files, use the 'data_page.html' template,\n # output to /data\n path = nil\n template = 'data_page'\n dir = 'data'\n \n \n if config\n path = config['path'] || path\n template = config['template'] || template\n dir = config['dir'] || dir\n end\n\n if site.layouts.key? template\n data_files = path.nil? ? site.data : site.data[path]\n\n data_files.each do |name, record|\n site.pages << DataPage.new(site, site.source, index_files, dir, record, name, template, \"html\")\n end\n else\n puts \"DataPageGenerator error. could not find template #{template}\"\n end\n end", "def sitemap\n\tpages = []\n\tPage.each_with_level(Page.find(:all, :order => 'lft ASC')) do |page,level|\n\t pages << {\n\t :page => page,\n\t :level => level\n\t }\n\tend\n\tpages[0..-2].map! do |p|\n\t p.update(:have_children => p[:level] < pages[pages.index(p)+1][:level])\n\tend\n\tpages.last.update(:have_children => false) unless pages.empty?\n\n\tul_li_for pages do |page|\n %[<a href=\"#{root_url+page[:page].url}\">#{page[:page].menu}</a>]\n\tend\n end", "def google_sitemap\n\t\t@urls = []\n\t\t# 1. 305 - Redirected back to the reverse proxy to show old site page.\n\t\tREDIRECTIONS.select {|k,v| v[:action] == 305}.each {|r| @urls.push(r[0])}\n\t\t# 2. All Homepage's (including mainpage)\n\t\tSection.environments().each do |section|\n\t\t\thome = section_homepage_url(section)\n\t\t\t@urls << home if home\n\t\tend\n\t\t# 3. All Pages\n\t\tAsset.find_all_by_resource_type('Page').select {|p| p.published_page?}.each {|p| @urls << site_page_url(p)}\n\n respond_to do |format|\n format.xml\n end\n\tend", "def generate_pages\n Dir.foreach(@site_path) do |file|\n if file =~ /(\\w+)\\.page/\n path = File.join(@site_path, file)\n\n File.open(File.join(@site_path, \"#{$1}.html\"), 'w') do |f|\n f << generate_page(parse_page(path))\n end\n\n @log.debug(\" generated a page from #{path}\")\n end\n end\n end", "def generate(site)\n @site = site\n\n @mode = site.config['environment']\n @template = site.config['theme']\n\n @project_path = File.join(File.dirname(__FILE__)).sub('_plugins/seo', '')\n @module_data_path = File.join(File.join(@project_path, '_data'))\n @module_config_path = File.join(File.join(@module_data_path, 'plugins'))\n @module_template_path = File.join(File.join(@module_data_path, 'templates'))\n @module_config_default = YAML::load(File.open(File.join(@module_config_path, 'defaults', 'seo-tags.yml')))\n @module_config_user = YAML::load(File.open(File.join(@module_config_path, 'seo-tags.yml')))\n\n @module_config_default_settings = @module_config_default['defaults']\n @module_config_user_settings = @module_config_user['settings']\n @module_config = @module_config_default_settings.merge!(@module_config_user_settings)\n\n if plugin_disabled?\n Jekyll.logger.info \"J1 SEO Tags:\", \"disabled\"\n return\n else\n Jekyll.logger.info \"J1 SEO Tags:\", \"enabled\"\n Jekyll.logger.info \"J1 SEO Tags:\", \"generate seo tags\"\n end\n\n end", "def generate(site)\r\n # Configuration\r\n prefixbox_config = site.config['prefixbox'] || {}\r\n @config = {}\r\n @config['filename'] = prefixbox_config['filename'] || PREFIXBOX_FILE_NAME\r\n @config['exclude'] = prefixbox_config['exclude'] || EXCLUDE\r\n @config['include_posts'] = prefixbox_config['include_posts'] || INCLUDE_POSTS\r\n\r\n # Create destination directory if it doesn't exist yet. Otherwise, we cannot write our file there.\r\n Dir::mkdir(site.dest) if !File.directory? site.dest\r\n \r\n # Create the file name and paths\r\n filename = @config['filename']\r\n \r\n # Write all the data to the file and close it\r\n CSV.open(File.join(site.dest, filename), \"wb\") do |csv|\r\n fill_posts(site, csv)\r\n #fill_pages(site, csv)\r\n end\r\n \r\n # Keep the prefixbox.csv file from being cleaned by Jekyll\r\n site.static_files << Jekyll::PrefixboxFile.new(site, site.dest, \"/\", filename)\r\n end", "def sitemap\n store_location\n\n # note: icons could be included, but do not seem to add much\n # note: tried showing unavailable pages as 'sans link', results not particularly attractive\n\n # TBD: My Talks, My Messsages, Current Messages\n # TBD: Maps, Calendars, Tags & Topics, Friends & Groups, Attachments, Venues\n @routes = talk_routes + user_routes + message_routes + admin_routes + common_routes \n\n end", "def generate(site)\n paths = site.config['paginate_paths']\n if Pager.pagination_enabled?(site) && !paths.nil?\n paths.each do |path|\n site.config['paginate_path'] = path\n if template = template_page(site)\n paginate(site, template)\n else\n Jekyll.logger.warn \"Pagination:\", \"Pagination is enabled, but I couldn't find \" +\n \"an index.html page to use as the pagination template. Skipping pagination.\"\n end\n end\n end\n end", "def generate(site)\n site.site_payload['site']['posts'].reverse\n end", "def generate(site)\n @gcallendar_config = site.config['gcalendar']\n raise 'Missing Google Calendar configuration in _config.yml' unless @gcallendar_config\n service = setup_calendar()\n site.data[\"calendars\"] = Hash.new\n @gcallendar_config['calendars'].each do |calendar|\n process_calendar(site, service, calendar['id'], calendar['look_ahead'], calendar['directory'], calendar['date_format'], calendar['layout'])\n end\n\n unless @gcallendar_config[\"event_list_name\"].nil?\n events = []\n unless site.data[\"calendars\"].nil?\n site.data[\"calendars\"].each do |calendar|\n events = events.concat(calendar[1])\n end\n events = get_google_calendar_events_by_date_offset(events,0,-1,1000)\n\n page_size = @gcallendar_config['event_list_per_page']\n pages = (events.length / page_size).ceil\n for i in 0..(pages-1)\n create_event_list_page(site, events.slice(i*page_size, page_size), @gcallendar_config['event_list_page_layout'], i+1, pages, events.length)\n end\n end\n end\n end", "def make_rss_feed\n require 'rss/maker'\n fname = Wiki_path + \"/rss-temp\"\n rss_entries = Marshal::load(File.read(fname))\n\n version = \"2.0\" # [\"0.9\", \"1.0\", \"2.0\"]\n\n content = RSS::Maker.make(version) do |m|\n m.channel.title = Wiki_title\n m.channel.link = Internet_path\n m.channel.description = Wiki_desc\n m.items.do_sort = true # sort items by date\n \n rss_entries.each do |entry|\n i = m.items.new_item\n i.title = entry[:title]\n i.link = entry[:link]\n i.date = entry[:date]\n i.description = entry[:description]\n end\n end\n\n File.write(Wiki_path + \"/data/media/pages.xml\", content) \nend", "def generate(site)\n puts 'Running the search indexer...'\n\n # gather pages and posts\n items = pages_to_index(site)\n content_renderer = PageRenderer.new(site)\n index = []\n\n items.each do |item|\n entry = SearchEntry.create(item, content_renderer)\n\n entry.strip_index_suffix_from_url! if @strip_index_html\n entry.strip_stopwords!(stopwords, @min_length) if File.exists?(@stopwords_file) \n \n index << {\n :title => entry.title, \n :url => entry.url,\n :date => entry.date,\n :categories => entry.categories,\n :body => entry.body\n }\n \n puts 'Indexed ' << \"#{entry.title} (#{entry.url})\"\n end\n \n json = JSON.generate({:entries => index})\n \n # Create destination directory if it doesn't exist yet. Otherwise, we cannot write our file there.\n Dir::mkdir(site.dest) unless File.directory?(site.dest)\n \n # File I/O: create search.json file and write out pretty-printed JSON\n filename = 'search.json'\n \n File.open(File.join(site.dest, filename), \"w\") do |file|\n file.write(json)\n end\n\n File.open(File.join('.', filename), \"w\") do |file|\n file.write(json)\n end\n\n # Keep the search.json file from being cleaned by Jekyll\n site.static_files << Jekyll::SearchIndexFile.new(site, site.dest, \"/\", filename)\n end", "def generate(site)\n merge_config_file(site)\n\n merge_org_data(site)\n\n merge_guide_data(site)\n end", "def generate(site)\n @site = site\n @app_engine = source_config\n\n unless app_yaml_exists?\n unless @app_engine\n raise \"App engine base configration not found\"\n end\n\n @app_engine[\"handlers\"] ||= {}\n\n write\n @site.keep_files ||= []\n @site.keep_files << \"app.yaml\"\n end\n end", "def write\n Jekyll::Commands::Doctor.conflicting_urls(self)\n each_site_file do |item|\n item.write(dest) if regenerator.regenerate?(item)\n end\n regenerator.write_metadata\n Jekyll::Hooks.trigger :site, :post_write, self\n nil\n end", "def template_page(site); end", "def fill_posts(site, csv)\r\n last_modified_date = nil\r\n \r\n site.collections[\"posts\"].docs.each do |post|\r\n \r\n # Write the page data\r\n if !excluded?(site, post.name)\r\n url = fill_url(site, post)\r\n title = post.to_liquid['title']\r\n title = title.length > 80 ? title[0..79] : title\r\n csv << [title, 100, title, url, \"\", \"blog\"]\r\n end\r\n\r\n # Determine the last modified date\r\n date = File.mtime(post.path)\r\n last_modified_date = date if last_modified_date == nil or date > last_modified_date\r\n end\r\n\r\n last_modified_date\r\n end", "def generate(site)\n\n @site = site\n index_dest = @site.instance_variable_get(:@dest)\n rebuild = @module_config['rebuild']\n index_file = index_dest + @module_config['index_file']\n\n if plugin_disabled?\n Jekyll.logger.info 'J1 Lunr:', 'disabled'\n return\n else\n Jekyll.logger.info 'J1 Lunr:', 'enabled'\n Jekyll.logger.info 'J1 Lunr:', 'generate search index'\n end\n\n if @module_config['rebuild'] == false\n if File.exist?(index_file)\n Jekyll.logger.info 'J1 Lunr:', 'rebuild index disabled'\n # Keep the index file from being cleaned by Jekyll\n #\n site.static_files << SearchIndexFile.new(site, site.dest, '/', @module_config['index_file'])\n return\n end\n end\n\n # gather posts and pages\n #\n items = pages_to_index(site)\n content_renderer = PageRenderer.new(site)\n # index = []\n # rebuild = @module_config['rebuild']\n\n index_js = open(@lunr_path).read\n\n # NOTE: all settings must be added within the index function\n #\n index_js << 'var idx = lunr(function() {'\n\n @lunr_config['fields'].each_pair do |name, boost|\n index_js << \"this.field('#{name}', {'boost': #{boost}});\"\n end\n\n items.each_with_index do |item, i|\n entry = SearchEntry.create(item, content_renderer)\n\n entry.strip_index_suffix_from_url! if @strip_index_html\n entry.strip_stopwords!(stopwords, @min_length) if File.exists?(@stopwords_file)\n\n doc = {\n 'id' => i,\n 'title' => entry.title,\n 'tagline' => entry.tagline,\n 'url' => entry.url,\n 'date' => entry.date,\n 'tags' => entry.tags,\n 'categories' => entry.categories,\n 'description' => entry.description,\n 'is_post' => entry.is_post,\n 'body' => entry.body\n }\n\n # remove unwanted categories (if any)\n #\n doc['categories'] -= @strip_categories unless doc['categories'] == nil\n\n index_js << 'this.add(' << ::JSON.generate(doc, quirks_mode: true) << ');'\n\n # reduce the size of the doc array by deleting the body key\n #\n doc.delete('body')\n @docs[i] = doc\n\n end\n index_js << '});'\n\n filename = File.join(@index_dir, \"#{@index_name}\")\n ctx = ExecJS.compile(index_js)\n index = ctx.eval('JSON.stringify(idx)')\n\n total = {\n 'docs' => @docs,\n 'index' => ::JSON.parse(index, {:max_nesting => false})\n }\n filepath = File.join(site.dest, filename)\n\n # create data path if not already exists\n #\n FileUtils.mkdir_p(File.dirname(filepath))\n File.open(filepath, 'w') { |f| f.write(JSON.dump(total)) }\n# Jekyll.logger.info 'J1 Lunr:', \"finished, index ready.\"\n added_files = [filename]\n\n # Keep the written files from being cleaned by Jekyll\n #\n added_files.each do |fname|\n site.static_files << SearchIndexFile.new(site, site.dest, '/', fname)\n end\n end", "def generate\n verify_path\n \n self.layouts.each {|layout| layout.write_file}\n self.pages.each {|page| page.write_file}\n \n Webby.site.content_dir = self.content_dir\n Webby.site.layout_dir = self.layout_dir\n Webby.site.template_dir = self.template_dir\n Webby.site.output_dir = self.output_dir\n \n Merb.logger.debug \"content_dir: #{Webby.site.content_dir}\"\n Merb.logger.debug \"layout_dir: #{Webby.site.layout_dir}\"\n Merb.logger.debug \"template_dir: #{Webby.site.template_dir}\"\n Merb.logger.debug \"output_dir: #{Webby.site.output_dir}\"\n \n # Use directory => '.' option to generate the site in output_dir\n Webby.site.page_defaults = {'layout' => self.default_layout.relative_path,\n 'directory' => '.',\n 'collision' => :force}\n \n Merb.logger.debug \"page_defaults: #{Webby.site.page_defaults}\" \n # returns nil if success \n # Webby::Builder.run\n Webby::Builder.run :rebuild => true\n end", "def create_sitemap\n @items.each do |item|\n if %w{png gif jpg jpeg coffee scss sass conf less css xml js txt ico}.include?(item[:extension]) ||\n item.identifier =~ /404|500|htaccess|google59d36f32ac93e5ca|google402908db7c07eb10/\n item[:is_hidden] = true unless item.attributes.has_key?(:is_hidden)\n end\n end\n @items << Nanoc3::Item.new(\n \"<%= xml_sitemap %>\",\n { :extension => 'xml', :is_hidden => true },\n '/sitemap/'\n )\nend", "def execute site\n if site.cache.nil?\n site.send('cache=', Aweplug::Cache::YamlFileCache.new)\n end\n Parallel.each(Dir[\"#{@repo}/*/README.md\"], in_threads: 40) do |file|\n next if @excludes.include?(File.dirname(file))\n\n # Skip if the site already has this page\n output_path = File.join @output_dir, Pathname.new(file).relative_path_from(Pathname.new @repo).dirname, 'index.html' \n next if site.pages.find {|p| p.output_path == output_path}\n\n page = add_to_site site, file\n\n metadata = extract_metadata(file)\n converted_html = metadata.delete :converted\n\n if metadata[:author]\n metadata[:author].split(',').each_with_index do |author, i|\n metadata[:author] = author if i == 0\n metadata[:contributors] << author unless i == 0\n end\n end\n\n unless metadata[:images].empty?\n metadata[:images].each do |img|\n image_path = Pathname.new(@repo).join(img) \n add_image_to_site(site, image_path) if File.exist? image_path\n end\n end \n page.send 'metadata=', metadata\n\n # unless site.profile =~ /development/ || !@push_to_searchisko\n # puts \"::DEBUG:: #{@push_to_searchisko} ::DEBUG::\"\n # send_to_searchisko(metadata, page, site, converted_html)\n # end\n\n if site.dev_mat_techs.nil?\n site.send('dev_mat_techs=', []);\n end\n site.dev_mat_techs << metadata[:technologies].flatten\n end\n\n add_main_readme(site) \n add_contributing(site)\n end", "def sitemap_exists?\n if @site.respond_to?(:in_source_dir)\n File.exists? @site.in_source_dir(\"sitemap.xml\")\n else\n File.exists? Jekyll.sanitized_path(@site.source, \"sitemap.xml\")\n end\n end", "def generate_simple(site)\n lang = site.config['prime_lang'] || site.config['lang'] || 'en'\n Jekyll.logger.info \"Generating w/o multilang support for '#{lang}'\"\n\n prefix = [site.source, \"_langs\", lang, ''].join '/'\n allfiles = File.join prefix, '**', '*.*'\n\n Dir.glob(allfiles) do |source_file|\n file_name = File.basename source_file\n relative_dir = File.dirname source_file.sub(prefix, '')\n create_page(site, source_file, relative_dir, file_name, lang)\n end\n end", "def generate(site)\n Jekyll.logger.info \"Lunr:\", 'Creating search index...'\n\n @site = site\n # gather pages and posts\n items = pages_to_index(site)\n content_renderer = PageRenderer.new(site)\n template_docs = {}\n\n items.each_with_index do |item, i|\n entry = SearchEntry.create(item, content_renderer, @data_field_names)\n\n entry.strip_index_suffix_from_url! if @strip_index_html\n entry.strip_stopwords!(stopwords, @min_length) if File.exists?(@stopwords_file)\n\n index_doc = {\n 'id' => i,\n }\n @index_field_names.each do |fieldname|\n index_doc[fieldname] = entry.get_by_name(fieldname)\n end\n\n @js_lunr_builder.add(index_doc)\n\n template_doc = {\n 'id' => i,\n }\n @template_field_names.each do |fieldname|\n template_doc[fieldname] = entry.get_by_name(fieldname)\n end\n\n template_docs[i] = template_doc\n\n Jekyll.logger.debug \"Lunr:\", (entry.title ? \"#{entry.title} (#{entry.url})\" : entry.url)\n end\n\n FileUtils.mkdir_p(File.join(site.dest, @js_dir))\n filename = File.join(@js_dir, 'index.json')\n\n Jekyll.logger.debug 'Lunr:', \"created file #{filename}\"\n\n js_index = @js_lunr_builder.build().toJSON()\n\n total = {\n \"docs\" => template_docs,\n \"index\" => js_index.to_hash\n }\n\n filepath = File.join(site.dest, filename)\n File.open(filepath, \"w\") { |f| f.write(JSON.dump(total)) }\n Jekyll.logger.info \"Lunr:\", \"Index ready (lunr.js v#{@js_lunr.version})\"\n added_files = [filename]\n\n site_js = File.join(site.dest, @js_dir)\n # If we're using the gem, add the lunr and search JS files to the _site\n if File.expand_path(site_js) != File.dirname(@lunr_path)\n extras = Dir.glob(File.join(File.dirname(@lunr_path), \"*.min.js\"))\n FileUtils.cp(extras, site_js)\n extras.map! { |min| File.join(@js_dir, File.basename(min)) }\n Jekyll.logger.debug \"Lunr:\", \"Added JavaScript to #{@js_dir}\"\n added_files.push(*extras)\n end\n\n # Keep the written files from being cleaned by Jekyll\n added_files.each do |filename|\n site.static_files << SearchIndexFile.new(site, site.dest, \"/\", filename)\n end\n end", "def generate(site)\n Dir.chdir(site.source) do\n Dir.glob(File.join('_*', '**', '*.svg')) do |source_image|\n dest_image = source_image.sub(/^_(.*)\\.svg$/, '\\1.png')\n command = lambda{|dest| system('convert', source_image, File.join(dest, dest_image))}\n site.static_files << GeneratedFile.new(site, source_image, dest_image, command)\n end\n end\n end", "def generate_links rss_file, basedir='/'\n\tbasedir = \"/#{basedir}\" unless basedir.start_with? '/'\n\tbasedir = \"#{basedir}/\" unless basedir.end_with? '/'\n\n\tdir = File.dirname(File.expand_path(rss_file))\n\trss = File.read(rss_file)\n\n\tfeed = RSS::Parser.parse(rss, false)\n\n\titem_map = Hash[*feed.items.map{|item|\n\t\tlink = item.link.split('/').last\n\t\t[link, {:item => item, :filename => item.pubDate.strftime(\"source/#{link}/index.html\")}]\n\t}.flatten]\n\n\tfeed.items.each do |item|\n\t\tpost_uri = URI.parse(item.link)\n\n\t\tpermalink = item.link.split('/').last\n\t\tfilename = item_map[permalink][:filename]\n\t\tdirname = File.dirname(filename)\n\t\thref = item.pubDate.strftime(\"#{basedir}%Y/%m/%d/#{permalink}/\")\n\t\ttitle = item.title\n\n\t\tFileUtils.mkdir_p(dirname)\n\t\toutfile = File.new(filename, \"w\")\n\t\toutfile.write <<-HTML\n\t\t<!DOCTYPE html>\n\t\t<html>\n\t\t\t<head>\n\t\t\t\t<title>#{title}</title>\n\t\t\t\t<meta http-equiv=\"Refresh\" content=\"0; url=#{href}\">\n\t\t\t\t<link href=\"#{basedir}stylesheets/screen.css\" rel=\"stylesheet\" type=\"text/css\">\n\t\t\t</head>\n\t\t\t<body>\n\t\t\t\t<a style=\"color: inherit; text-decoration: none\" href=\"#{href}\">#{title}</a>\n\t\t\t</body>\n\t\t</html>\n\t\tHTML\n\t\toutfile.close\n\tend\n\n\tnil\nend", "def generate_sitemap_options(*args)\n SemiStatic::Engine.config.has?('sitemap')\n end", "def generate(site)\n site.static_files.clone.each do |sf|\n if sf.kind_of?(Jekyll::StaticFile) && sf.path =~ /\\.less$/\n site.static_files.delete(sf)\n name = File.basename(sf.path)\n destination = File.dirname(sf.path).sub(site.source, '')\n site.static_files << LessCssFile.new(site, site.source, destination, name)\n end\n end\n end", "def generate(site)\n\n # Abort if some configurations from 1.x are still being used.\n if (site.config.has_key?('metadata_tabs') && site.config['metadata_tabs'].is_a?(Hash))\n opensdg_error('The metadata_tabs setting is not in the correct format. Please consult the latest documentation: https://open-sdg.readthedocs.io/en/latest/configuration/#metadata_tabs')\n end\n\n # Handle legacy treatment of reporting status types.\n unless (site.config.has_key?('reporting_status') &&\n site.config['reporting_status'].has_key?('status_types') &&\n site.config['reporting_status']['status_types'].count > 0)\n reporting_status = site.data['schema'].detect {|f| f['name'] == 'reporting_status' }\n reporting_status_types = reporting_status['field']['options']\n unless site.config.has_key?('reporting_status')\n site.config['reporting_status'] = {}\n end\n site.config['reporting_status']['status_types'] = reporting_status_types.map do |status_type|\n {\n 'value' => status_type['value'],\n 'label' => status_type['translation_key'],\n }\n end\n end\n\n # Also fill in the \"reporting\" data with things needed by older templates.\n add_translation_keys(site.data['reporting']['statuses'], site)\n add_translation_keys(site.data['reporting']['overall']['statuses'], site)\n\n if site.data['reporting'].has_key?('extra_fields')\n site.data['reporting']['extra_fields'].each do |key, extra_field|\n extra_field.each do |extra_field_value|\n add_translation_keys(extra_field_value['statuses'], site)\n end\n end\n end\n\n if site.data['reporting'].has_key?('goals')\n site.data['reporting']['goals'].each do |goal|\n add_translation_keys(goal['statuses'], site)\n end\n end\n end", "def generate(site)\n unnest_site_api_data(site)\n site.data['guest_users'] = []\n\n Joiner.join_data(site)\n # Auth.generate_artifacts(site)\n Team.generate_pages(site)\n WorkingGroups.generate_pages(site)\n Stats.assign_stats(site)\n end", "def render\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')\n xml.urlset(XmlSitemap::INDEX_SCHEMA_OPTIONS) { |s|\n @maps.each do |item|\n s.sitemap do |m|\n m.loc item[:loc]\n m.lastmod item[:lastmod]\n end\n end\n }.to_s\n end", "def generate(site)\n json = {}\n blog = generate_blog(site)\n json.merge!(blog)\n json[:static_files] = generate_static_files(site)\n json[:projects] = generate_projects(site)\n json[:games] = generate_games(site)\n write_file(json)\n end", "def generate(site)\n return unless site.config['mini_magick'] && site.config['mini_magick_enabled']\n versions = site.config['mini_magick']['versions']\n\n site.config['mini_magick']['galleries'].each do |gallery|\n path = \"/Users/adam/code/blogs/adamfortuna.com-images/images/galleries/#{gallery}\"\n\n # Loop through all images in this gallery\n Dir.glob(File.join(path, \"*.{png,jpg,jpeg,gif,JPG}\")) do |source|\n versions.each_pair do |version, options|\n settings = options.clone\n settings['source'] = path\n settings['destination'] = File.join(path, version)\n\n if site.config['mini_magick_regererate'] || !File.exists?(File.join(path, version, File.basename(source)))\n site.static_files << GeneratedImageFile.new(site, path, settings['destination'], File.basename(source), settings)\n end\n end\n end\n end\n end", "def generate_posts rss_file, basedir='/'\n\tbasedir = \"/#{basedir}\" unless basedir.start_with? '/'\n\tbasedir = \"#{basedir}/\" unless basedir.end_with? '/'\n\n\tdir = File.dirname(File.expand_path(rss_file))\n\trss = File.read(rss_file)\n\n\tfeed = RSS::Parser.parse(rss, false)\n\n\titem_map = Hash[*feed.items.map{|item|\n\t\tlink = item.link.split('/').last\n\t\t[link, {:item => item, :filename => item.pubDate.strftime(\"source/_posts/%Y-%m-%d-#{link}.html\")}]\n\t}.flatten]\n\n\tfeed.items.each do |item|\n\t\tpost_uri = URI.parse(item.link)\n\n\t\tpermalink = item.link.split('/').last\n\t\tfilename = item_map[permalink][:filename]\n\t\tdate = item.pubDate\n\t\theader = {\n\t\t\t'layout' => \"post\",\n\t\t\t'title' => item.title,\n\t\t\t'date' => date,\n\t\t\t'comments' => true,\n\t\t\t'categories' => item.categories.select{|cat| cat.domain == \"tag\"}.map{|cat| cat.content},\n\t\t\t'published' => !post_uri.path.start_with?('/private/')\n\t\t}\n\n\t\tputs \"Generating #{filename}#{header['published'] ? '' : ' (unpublished)'}\"\n\n\t\timgdir = \"source/images/#{date.strftime('%Y/%m/%d')}/#{permalink}/\"\n\t\tserverdir = '/' + imgdir.split('/', 2).last\n\t\tFileUtils.mkdir_p(imgdir)\n\n\t\toutfile = File.new(filename, \"w\")\n\t\toutfile.puts header.to_yaml\n\t\toutfile.puts \"---\"\n\n\t\t# Fix up images and video\n\t\thtml = Nokogiri::HTML(\"<div id=\\\"import_#{permalink}\\\">#{EscapeUtils.unescape_html(item.content_encoded)}</div>\")\n\t\timages = html.css('img')\n\t\tfix_sources html, date.strftime(\"#{dir}/image/%Y/%m\"), imgdir, serverdir\n\t\tfix_sources html, nil, imgdir, serverdir, 'source'\n\t\tfix_sources html, nil, nil, nil, 'video', 'poster' do nil end\n\n\t\t# Fix up links to other posts\n\t\tfix_sources html, nil, nil, nil, 'a', 'href' do |tag, href|\n\t\t\tlink_uri = URI.parse(href)\n\t\t\tnext unless post_uri.host == link_uri.host\n\n\t\t\tlink_shortname = href.split('/').last.split('#').first\n\t\t\tif item_map.include? link_shortname\n\t\t\t\tlink = item_map[link_shortname][:item]\n\t\t\t\thref = link.pubDate.strftime(\"#{basedir}%Y/%m/%d/#{link_shortname}/\")\n\t\t\t\thref += \"##{link_uri.fragment}\" if link_uri.fragment\n\t\t\t\tputs \"\\t\\tUsing #{link.title} (#{href})\"\n\t\t\telse\n\t\t\t\tputs \"\\t######## No match found for #{href}\"\n\t\t\tend\n\n\t\t\thref\n\t\tend\n\n\t\toutfile.puts html.css(\"div#import_#{permalink}\").first.children.map{|node| node.to_html}.join\n\t\toutfile.close\n\tend\n\n\tnil\nend", "def generate(site)\n begin\n Dir.mkdir('scripts') unless Dir.exists?('scripts')\n Dir.mkdir('_data') unless Dir.exists?('_data')\n Dir.mkdir('_data/jailRoster') unless Dir.exists?('_data/jailRoster')\n rescue Exception => msg\n puts \"Error creating directories\"\n puts msg\n end\n\n begin\n # open('scripts/PrecinctInfo.js', 'w') do |file|\n # file << open('http://www.canyonco.org/CanyonCounty/Webparts/Elections/js/PrecinctInfo.js?v2').read\n # end\n\n open('_data/arrests.json', 'w') do |file|\n file << open('http://api.canyonco.org/Sheriff/CurrentArrest').read\n end\n\n open('_data/jailList.json', 'w') do |file|\n file << open('http://api.canyonco.org/Sheriff/JailList').read\n end \n rescue Exception => msg\n puts \"Error downloading content\"\n puts msg\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 add_to_site(site, file)\n page_path = Pathname.new file\n page = site.engine.load_site_page file\n page.layout = @layout\n page.output_path = File.join @output_dir, page_path.relative_path_from(Pathname.new @repo).dirname, 'index.html'\n site.pages << page\n page\n end", "def sitemap(tree)\n list_children(tree, nil, 'sitemap')\n end", "def initialize(site, path)\n super\n @metadata = [ :title, :layout, :author ]\n \n @name = source_path[0..(-1-source_ext.length)].gsub(/\\//, '-')\n \n @tags = []\n unless source_metadata[:tags].nil?\n for tag in source_metadata[:tags]\n @tags << site.tags[tag]\n @tags.last << self\n end\n end\n \n if name =~ /^(\\d+-\\d+-\\d+)-(.+)$/\n @created = Time.parse $1\n @updated ||= @created\n @slug = $2\n @output_dir = created.strftime('%Y/%m/%d')\n @output_path = File.join output_dir, \"#{slug}.html\"\n @uri = \"/#{output_path}\"\n else\n raise ArgumentError, \"Bad file name: #{name}\"\n end\n end", "def package_docs(package_site)\n site_map.sites.each do |site|\n next if not package_site == '' and not package_site == site.id\n site.distros.each do |distro_id,branches|\n branches.each do |branch|\n src_dir = File.join(preview_dir,distro_id,branch.dir)\n tgt_tdir = branch.dir.split('/')\n tgt_tdir.pop\n tgt_dir = ''\n if tgt_tdir.length > 0\n tgt_dir = File.join(package_dir,site.id,tgt_tdir.join('/'))\n else\n tgt_dir = File.join(package_dir,site.id)\n end\n next if not File.directory?(src_dir)\n FileUtils.mkdir_p(tgt_dir)\n FileUtils.cp_r(src_dir,tgt_dir)\n end\n site_dir = File.join(package_dir,site.id)\n if File.directory?(site_dir)\n log_unknown(\"Packaging #{distro_id} for #{site.id} site.\")\n\n # Any files in the root of the docs repo with names ending in:\n # *-#{site}.html\n # will get copied into the root dir of the packaged site with\n # the site name stripped out.\n #\n # Example: for site name 'commercial', the files:\n # * index-commercial.html would end up as #{site_root}/index.html\n # * search-commercial.html would end up as #{site_root}/search.html\n # * index-community.html would be ignored\n site_files = Dir.glob(File.join(docs_root_dir, '*-' + site.id + '.html'))\n unless site_files.empty?\n site_files.each do |fpath|\n target_basename = File.basename(fpath).gsub(/-#{site.id}\\.html$/, '.html')\n FileUtils.cp(fpath,File.join(package_dir,site.id,target_basename))\n end\n else\n FileUtils.cp(File.join(preview_dir,distro_id,'index.html'),File.join(package_dir,site.id,'index.html'))\n end\n ['_images','_stylesheets'].each do |support_dir|\n FileUtils.cp_r(File.join(docs_root_dir,support_dir),File.join(package_dir,site.id,support_dir))\n end\n\n # Now build a sitemap\n site_dir_path = Pathname.new(site_dir)\n SitemapGenerator::Sitemap.create(\n :default_host => site.url,\n :public_path => site_dir_path,\n :compress => false,\n :filename => File.join(site_dir,'sitemap')\n ) do\n file_list = Find.find(site_dir).select{ |path| not path.nil? and path =~ /.*\\.html$/ }.map{ |path| '/' + Pathname.new(path).relative_path_from(site_dir_path).to_s }\n file_list.each do |file|\n add(file, :changefreq => 'daily')\n end\n end\n end\n end\n end\n end", "def add_pages\n exhibit.feature_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_feature_page_path(exhibit, p), priority: 0.8, lastmod: p.updated_at\n end\n\n exhibit.about_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_about_page_path(exhibit, p), priority: 0.5, lastmod: p.updated_at\n end\n end", "def map_url(loc, opts={})\n self.locker.synchronize do\n loc = Sitemapper.urlfy(loc)\n lastmod, changefreq, priority = extract_options(opts)\n url = get_url(loc) || self.builder.root.add_element('url')\n (url.elements['loc'] || url.add_element('loc')).text = loc\n (url.elements['lastmod'] || url.add_element('lastmod')).text = lastmod.strftime('%Y-%m-%d') if lastmod\n (url.elements['changefreq'] || url.add_element('change_freq')).text = changefreq.to_s if changefreq\n (url.elements['priority'] || url.add_element('priority')).text = '%.2f' % priority if priority\n\n write_file\n end\n end", "def update_site\n # ensure the site already exists\n abort \"'#{site}' does not exist\" unless test ?d, site\n\n # copy over files from the data/tasks directory\n files = site_files\n\n mkdir 'tasks'\n files['tasks'].sort.each {|file| cp file}\n\n nil\n end", "def source_path\n File.expand_path \"sitemap.xml\", File.dirname(__FILE__)\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 generate_feed\n @log.debug(\" writing feed to #{File.join(@site_path, @config[:feed_path])}\")\n File.open(File.join(@site_path, @config[:feed_path]), 'w') do |f|\n f << ERB.new(@feed_template).result(binding)\n end\n end", "def process_site(site); end", "def output(path)\n if @first_pass\n @first_pass = false\n FileUtils.rm_rf path if clean_first\n end\n FileUtils.mkdir_p path\n \n if quick_mode\n posts.chop! 20\n end\n @stats.reset\n \n unless metadata.nil? || !metadata['static'].is_a?(Array)\n stats.record(:site, :static) do\n for dir in metadata['static']\n FileUtils.cp_r File.join(source_dir, dir), File.join(path, dir)\n end\n end\n end\n \n before = Time.now\n Dir.chdir(path) do\n stats.record(:site, :pages) do\n pages.each do |name, page|\n FileUtils.mkdir_p page.output_dir unless File.directory?(page.output_dir)\n if check_mtime\n if File.file?(page.output_path) && File.mtime(page.output_path) > page.source_mtime\n next\n end\n page.load\n end\n File.open(page.output_path, 'w') { |f| f.write page.render }\n end\n end\n \n stats.record(:site, :posts) do\n posts.each do |post|\n FileUtils.mkdir_p post.output_dir unless File.directory?(post.output_dir)\n if check_mtime\n if File.file?(post.output_path) && File.mtime(post.output_path) > post.source_mtime\n next\n end\n post.load\n end\n File.open(post.output_path, 'w') { |f| f.write post.render }\n end\n end\n \n stats.record(:site, :stylesheets) do\n unless stylesheets.nil?\n stylesheets.each do |name, stylesheet|\n FileUtils.mkdir_p stylesheet.output_dir unless File.directory?(stylesheet.output_dir)\n if check_mtime\n if File.file?(stylesheet.output_path) && File.mtime(stylesheet.output_path) > stylesheet.source_mtime\n next\n end\n stylesheet.load\n end\n File.open(stylesheet.output_path, 'w') { |f| f.write stylesheet.render }\n end\n end\n end\n \n stats.record(:site, :indices) do\n unless year_index.nil? && month_index.nil? && day_index.nil?\n posts.each_index do |dir|\n posts = self.posts.from(dir)\n Dir.chdir(dir) do\n context = dir.split('/').collect { |c| c.to_i }\n date_index = case context.length\n when 1\n year_index\n when 2\n month_index\n when 3\n day_index\n else\n nil\n end\n date_index.posts = posts\n date_index.context = Time.local *context\n File.open('index.html', 'w') { |f| f.write date_index.render }\n end\n end\n end\n \n unless tag_index.nil?\n tags.each do |tag|\n tag_index.context = tag.name\n tag_index.posts = tag\n FileUtils.mkdir_p tag.output_dir\n File.open(tag.output_path, 'w') { |f| f.write tag_index.render }\n end\n end\n end\n end\n \n self.stats.display if show_statistics\n end", "def generate(site)\n patterns = read_content(site, '', '_patterns', Pattern)\n\n site.pages << LibraryPage.new(site, 'pattern library', patterns)\n end", "def create_site\n # create it in the default locale\n Mounter.with_locale(self.default_locale) do\n self.output_locale\n\n self.output_resource_op self.site\n\n if (site = self.post(:sites, self.site.to_hash(false), Mounter.locale)).nil?\n raise Mounter::WriterException.new('Sorry, we are unable to create the site.')\n else\n self.site._id = site['id']\n self.output_resource_op_status self.site\n end\n end\n\n # update it in other locales\n self.update_site(true)\n end", "def initialize(site, base, dest_dir, dest_name, src_dir, src_name, data_mtime )\n @site = site\n @base = base\n @dir = dest_dir\n @dest_dir = dest_dir\n @dest_name = dest_name\n @dest_url = File.join( '/', dest_dir ) \n @dest_url = File.join( '/', dest_dir, dest_name ) if !dest_name.match( /index.html/i )\n @src_mtime = data_mtime\n\n src_file = File.join(base, src_dir, \"#{src_name}.markdown\" )\n src_name_with_ext = \"#{src_name}.markdown\" if File.exists?( src_file )\n src_name_with_ext ||= \"#{src_name}.html\"\n\n @name = src_name_with_ext\n self.process(src_name_with_ext)\n \n # Read the YAML from the specified page\n self.read_yaml(File.join(base, src_dir), src_name_with_ext )\n # byebug\n # Remember the mod time, used for site_map\n file_mtime = File.mtime( File.join(base, src_dir, src_name_with_ext) )\n @src_mtime = file_mtime if file_mtime > @src_mtime\n end", "def to_xml(builder=nil)\n builder = ::Builder::XmlMarkup.new if builder.nil?\n builder.sitemap do\n builder.loc self[:loc]\n builder.lastmod w3c_date(self[:lastmod]) if self[:lastmod]\n end\n builder << '' # force to string\n end", "def collect_sitemaps( &block )\n local_sitemap = sitemap\n\n if !master?\n block.call( local_sitemap )\n return\n end\n\n foreach = proc { |peer, iter| peer.spider.sitemap { |s| iter.return( s ) } }\n after = proc do |sitemap|\n block.call( (sitemap | local_sitemap).flatten.uniq.sort )\n end\n\n map_peers( foreach, after )\n end", "def generate(site)\n site.static_files.clone.each do |sf|\n if sf.kind_of?(Jekyll::StaticFile) && sf.path =~ /\\.coffee$/\n site.static_files.delete(sf)\n name = File.basename(sf.path)\n destination = File.dirname(sf.path).sub(site.source, '')\n site.static_files << CoffeeScriptFile.new(site, site.source, destination, name)\n end\n end\n end", "def sitemaps\n @sitemaps ||= extract_urls('sitemap')\n end", "def generate force_build = false\n blog_template = Template::Blog.new self\n\n skipped_files = []\n new_files = []\n updated_files = []\n old_files = Dir.glob('public/**/*.html')\n\n blog_template.modes.each {\n |mode|\n\n blog_template.mode = mode\n\n (1..blog_template.pages).each { |page|\n blog_template.page = page\n path = blog_template.local_path\n pretty_path = Pathname.new(path).relative_path_from(Pathname.new(@spec.blog_root)).to_s\n\n if old_files.include? pretty_path\n old_files.delete pretty_path\n end\n\n mtime = File.exists?(path) ? File.mtime(path) : nil\n needs_update = force_build || mtime.nil?\n\n if ! needs_update\n needs_update = blog_template.posts.any? {\n |post|\n mtime < File.mtime(post.post_data.source_path)\n }\n\n if ! needs_update\n skipped_files << path\n next\n end\n end\n\n dir = File.dirname(path)\n FileUtils.mkdir_p dir unless File.directory? dir\n\n if File.exists? path\n updated_files << pretty_path\n else\n new_files << pretty_path\n end\n\n r = nil\n File.open(path, 'w') {\n |io|\n io.write blog_template.render\n }\n }\n }\n\n updated_files.each { |path| puts \"* #{path}\" }\n\n new_files.each { |path| puts \"+ #{path}\"}\n\n old_files.each {\n |path|\n puts \"- #{path}\"\n File.unlink path\n dir = File.dirname path\n if Dir.entries(dir) == @@EMPTY_DIR_ENTRIES\n Dir.unlink dir\n end\n }\n end", "def update!(**args)\n @sitemap = args[:sitemap] if args.key?(:sitemap)\n end", "def sitemap(path = nil)\n raw_sitemap = path ? concept_tree.path(path) : concept_tree.tree\n if raw_sitemap.include?('tree_leaves')\n keys = raw_sitemap['tree_leaves']\n sitemap = model.where(model.primary_key => keys).map do |el|\n {\n 'url' => el.pathname,\n 'display_name' => el.to_s\n }\n end\n else\n sitemap = raw_sitemap.map do |k, v|\n next if k == 'display_name'\n {\n 'url' => pathname(path, k),\n 'display_name' => v['display_name'] || k\n }\n end.compact\n end\n sitemap.sort_by { |item| item['display_name'] }\n end", "def write_page_assets(site_dir)\n end", "def set_site_meta_tags\n config = ZanoboRails::Crawlable.configuration\n\n site_ids = {\n separator: config.page_title_sitename_separator,\n reverse: config.page_title_sitename_pos == 'right'\n }\n\n if config.gplus_id.present?\n site_ids[:publisher] = \"https://plus.google.com/#{config.gplus_id}\"\n end\n if config.twitter_id.present?\n site_ids[:twitter] = \"@#{config.twitter_id}\"\n end\n if config.fb_app_id.present?\n site_ids[:fb] = { app_id: \"@#{config.fb_app_id}\" }\n end\n if config.site_name.present?\n site_ids[:open_graph] = { site_name: config.site_name }\n site_ids[:site] = config.site_name\n end\n\n set_meta_tags(site_ids)\n end", "def build_page(path, silent: false)\n page = sitemap[path]\n out_fname = File.join(BUILD_DIR, path)\n puts \"Rendering #{out_fname}...\" unless silent\n\n # Check page data for info on how to build this path\n if page['template'].present?\n ctx = TemplateContext.new(@config)\n ctx.page = page\n # Check if we have a layout defined, use it\n layout = ctx.page.key?('layout') ? ctx.page['layout'] : config['layout']\n\n # Make sure to render the template inside the layout render so code in the\n # erb layout and template are executed in a sensible order.\n content =\n if layout.present?\n ctx.render(layout) { ctx.render(ctx.page['template']) }\n else\n ctx.render(ctx.page['template'])\n end\n elsif page['json'].present?\n content = page['json'].to_json\n elsif page['file'].present?\n content = File.read(page['file'])\n else\n raise(\n ArgumentError,\n \"Page '#{path}' missing one of required attributes: 'template', 'json', 'file'.\"\n )\n end\n\n # If page data includes a digest flag, add sha1 digest to output filename\n if page['digest'] == true\n ext = VizBuilder.fullextname(path)\n fname = File.basename(path, ext)\n dir = File.dirname(path)\n digest = Digest::SHA1.hexdigest(content)\n digest_fname = \"#{fname}-#{digest}#{ext}\"\n page['digest_path'] = \"#{dir}/#{digest_fname}\"\n out_fname = File.join(BUILD_DIR, dir, digest_fname)\n end\n\n FileUtils.mkdir_p(File.dirname(out_fname))\n File.write(out_fname, content)\n content\n end" ]
[ "0.8111135", "0.7054567", "0.698701", "0.688247", "0.6801285", "0.6734294", "0.66676944", "0.6653475", "0.6587433", "0.6587433", "0.6539907", "0.65021485", "0.6482737", "0.63853204", "0.6373777", "0.6358131", "0.6342161", "0.6325158", "0.6301099", "0.627928", "0.62694514", "0.62393576", "0.61696315", "0.61681944", "0.6166772", "0.61532086", "0.61378497", "0.61311126", "0.609981", "0.6074612", "0.60600054", "0.6024113", "0.60188454", "0.60005546", "0.5987948", "0.5942378", "0.5922809", "0.5914967", "0.5905469", "0.5896048", "0.58414173", "0.58179027", "0.58021635", "0.5797582", "0.5741747", "0.5739209", "0.5686769", "0.56787837", "0.56734806", "0.5631552", "0.56279355", "0.5620716", "0.5616725", "0.5614711", "0.56116337", "0.5598892", "0.55939263", "0.5580418", "0.5555541", "0.55485564", "0.5539968", "0.5531896", "0.5520764", "0.5492399", "0.54816073", "0.54746246", "0.5471475", "0.546079", "0.5444988", "0.5435931", "0.5429476", "0.5428997", "0.5426156", "0.5407965", "0.5403079", "0.54000103", "0.5324914", "0.53003156", "0.52913415", "0.5276043", "0.52717024", "0.5266751", "0.52548385", "0.5246805", "0.5228395", "0.5213437", "0.5196526", "0.51908344", "0.5187578", "0.51870745", "0.517207", "0.5166084", "0.515502", "0.5143983", "0.5124903", "0.5122382", "0.51083606", "0.51072997", "0.5094848", "0.50920296" ]
0.8603455
0
Translates na identifier, such as "sysDescr", into an OID
def oid(identifier) prefix, *suffix = case identifier when Array identifier.map(&:to_s) else identifier.split(".", 2).map(&:to_s) end return unless prefix # early exit if it's an OID already unless prefix.integer? load_defaults # load module if need be idx = prefix.index("::") if idx mod = prefix[0..(idx - 1)] type = prefix[(idx + 2)..-1] return if mod && !module_loaded?(mod) && !load(mod) else type = prefix end return if type.nil? || type.empty? prefix = @object_identifiers[type] || raise(Error, "can't convert #{type} to OID") end [prefix, *suffix].join(".") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_oid(name, id)\n OIDPrefix + '.' + OIDMap[name].to_s + \".#{id}\"\n end", "def name2oid(name)\n\t\toid = @manager.mib.oid(name)\n\t\tt = [['OID', 'Symbolic Name'], [\"#{oid}\", \"#{name}\"]]\n\t\ttable = t.to_table(:first_row_is_head => true)\n\t\tputs table.to_s\n\tend", "def oid2name(oid)\n\t\tname = @manager.mib.name(oid)\n\t\tt = [['OID', 'Symbolic Name'], [\"#{oid}\", \"#{name}\"]]\n\t\ttable = t.to_table(:first_row_is_head => true)\n\t\tputs table.to_s\n\tend", "def oid\n @oid ||= OID.from_pointer(@struct.name, @struct.name_length)\n end", "def identifier_code\n 'ICN'\n end", "def oid\n id(get_oid())\n end", "def obo_id(so_id)\n return \"obo:\" + so_id.sub(':', '_')\n end", "def oid(item)\n return if item.nil?\n org_id = ->(rec) { rec[:org_id] || rec.try(:org_id) }\n # noinspection RailsParamDefResolve\n org =\n case item\n when Org then item\n when User then item\n when Integer then item\n when Symbol then orgs(item)\n when Hash then item.values_at(:org_id, :org).first\n when Model then org_id.(item) || item.try(:org)\n end\n org ||= find_user(uid(item))\n # noinspection RubyMismatchedReturnType\n case org\n when Org then org.id\n when Model then org_id.(org)\n when Integer then positive(org)\n end\n end", "def bare_identifier\n resource.identifier_str.gsub(/^doi:/, '')\n end", "def convert_identifier(identifier)\n case identifier\n when SQL::Identifier\n identifier.value.to_s\n else\n identifier\n end\n end", "def oid\n self.elements[:object_i_d]\n end", "def populate_codesystem_oid(entry)\n if entry.nil? || entry.is_a?(String) || entry.is_a?(BSON::ObjectId) ||\n entry.is_a?(Time) || entry.is_a?(Date) || entry.is_a?(Boolean) || entry.is_a?(Integer) || entry.is_a?(Float)\n elsif entry.is_a?(Array)\n entry.each { |elem| populate_codesystem_oid(elem) }\n elsif entry.is_a?(Hash)\n if entry['codeSystem'] || entry[:codeSystem]\n name_oid_hash = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'name_oid_map.json')))\n if name_oid_hash[entry['codeSystem']].nil? && name_oid_hash[entry[:codeSystem]].nil?\n puts 'ERROR: Could Not Resolve OID For Code System ' + entry['codeSystem']\n else\n entry['system'] = name_oid_hash[entry['codeSystem']] || name_oid_hash[entry[:codeSystem]]\n # cqm codes mirror cql codes and do not include the human-readable codeSystem name\n entry.delete('codeSystem')\n end\n end\n if entry['descriptor'] || entry[:descriptor]\n entry['display'] = entry['descriptor'] || entry[:descriptor]\n entry.delete('descriptor')\n end\n entry.keys.each { |key| populate_codesystem_oid(entry[key]) }\n elsif entry.is_a?(QDM::DataElement) || entry.is_a?(QDM::Attribute)\n entry.attribute_names.each { |key| populate_codesystem_oid(entry[key]) }\n else\n puts 'WARNING: Unable To Search For Codes In ' + entry.to_s\n end\n end", "def symbolidentifier\n\n \t\n\t\tif @usersym.upcase == \"X\" then \n\t\t @compsym = \"O\" \n \t\t else \n \t\t @compsym = \"X\"\n \t\tend \n\n\n end", "def identifier_string\n name\n end", "def mintOAPID(metadata)\n if $testMode\n return \"ark:/13030/fk#{(0...8).map { (65 + rand(26)).chr }.join}\"\n else\n resp = $ezidSession.mint(metadata)\n resp.respond_to?(:errored?) and resp.errored? and raise(\"Error minting ark: #{resp.response}\")\n return resp.identifier\n end\nend", "def oid(name)\n module_parts = name.to_str.split(\"::\")\n if module_parts.length == 1\n parse_oid(@by_name, name.to_str)\n elsif module_parts.length == 2\n module_name = module_parts[0]\n oid = module_parts[1]\n module_hash = @by_module_by_name[module_name]\n if module_hash\n parse_oid(module_hash, oid)\n else\n raise ModuleNotLoadedError, \"module '#{module_name}' not loaded\"\n end\n else\n raise ArgumentError, \"invalid format: #{name.to_str}\"\n end\n end", "def identifier_for identifier\n \"#{name.gsub(/^.*::/,'').downcase}s.#{identifier}\"\n end", "def id2name() end", "def id2name() end", "def monograph_noid(args = {})\n case\n when args.include?(:identifier)\n identifier_list = [ args[:identifier] ]\n when args.include?(:identifier_list)\n identifier_list = args[:identifier_list]\n else\n return \"\"\n end\n\n # Attempt to retrieve the NOID for the specified identifier\n id2noid_list = {}\n identifier_list.each do |identifier|\n id2noid_list[identifier] = []\n\n # Try each type until success\n [\"isbn\", \"identifier\", \"doi\"].each do |t|\n case\n when t == \"doi\", identifier.start_with?(@@DOI_PREFIX)\n id = identifier.delete_prefix(@@DOI_PREFIX)\n else\n id = identifier\n end\n begin\n response = connection.get(\"noids?#{t}=#{id}\")\n rescue StandardError => e\n e.message\n end\n\n unless response.nil? or !response.success? or response.body.empty?\n id2noid_list[identifier] = response.body.collect { |b| b['id'] }\n break\n end\n end\n end\n return id2noid_list\n end", "def to_identifier(identifier)\n case identifier\n when String, Symbol then identifier.to_sym\n when Util::Identifier then identifier.send(identifier_method) # if module is included\n end\n end", "def external_identifier \n elements = []\n elements << ipaddress || 'UNKNOWNIP'\n elements << custid || 'anon'\n #OT.ld \"sess identifier input: #{elements.inspect}\"\n @external_identifier ||= elements.gibbler.base(36)\n @external_identifier\n end", "def convert_id(token_ct)\n case token_ct\n when \"break\"\n return Tokenable::TK_BREAK\n when \"char\"\n return Tokenable::TK_CHAR\n when \"double\"\n return Tokenable::TK_DOUBLE\n when \"else\"\n return Tokenable::TK_ELSE\n when \"for\"\n return Tokenable::TK_FOR\n when \"if\"\n return Tokenable::TK_IF\n when \"int\"\n return Tokenable::TK_INT\n when \"return\"\n return Tokenable::TK_RETURN\n when \"struct\"\n return Tokenable::TK_STRUCT\n when \"void\"\n return Tokenable::TK_VOID\n when \"while\"\n return Tokenable::TK_WHILE\n else\n return Tokenable::TK_ID\n end\n end", "def guess_identifier_type ident\n # Note identifier normalisation in HydraDurham::IdentifierNormalisation.\n # These rules are a little excessive assuming normalisation has been done\n # already since website form identifires shouldn't be present anymore.\n # However it won't hurt to be prepared for those as well.\n rules=[{regex: /^doi:(.*)/i, type: 'DOI', value: '\\1' },\n {regex: /^info:doi\\/(.*)/i, type: 'DOI', value: '\\1' },\n {regex: /^.*dx\\.doi\\.org\\/(.*)/i, type: 'DOI', value: '\\1' },\n {regex: /^ark:(.*)/i, type: 'ARK', value: 'ark:\\1' },\n {regex: /^arxiv:(.*)/i, type: 'arXiv', value: 'arXiv:\\1'},\n {regex: /^.*arxiv\\.org\\/[^\\/]+\\/(.*)/i, type: 'arXiv', value: 'arXiv:\\1'},\n 'issn', 'isbn', 'istc', 'lissn',\n {prefix: 'urn:lsid:', type: 'LSID', keep_prefix: true}, 'pmid',\n {regex: /^purl:(.*)/i, type: 'PURL', value: '\\1'},\n {regex: /(.*([\\W]|^)purl\\W.*)/i, type: 'PURL', value: '\\1'},\n 'upc',\n {prefix: 'urn', type: 'URN', keep_prefix: true}, # urn should be after LSID because LSID also starts with urn\n {regex: /(https?:)(.*)/i, type: 'URL', value: '\\1\\2'} ,\n {regex: /(.*)/, type: 'Handle', value: '\\1'} \n ]\n\n rules.each do |rule|\n if rule.class==String\n rule={ prefix: \"#{rule}:\", type: rule.upcase }\n end\n if rule.key? :regex\n if rule[:regex] =~ ident\n return { id_type: rule[:type], id: (ident.sub rule[:regex], rule[:value])}\n end\n else\n if ident.downcase.start_with?(rule[:prefix])\n if rule[:keep_prefix]\n return { id_type: rule[:type], id: ident }\n else\n return { id_type: rule[:type], id: ident[(rule[:prefix].length) .. -1]}\n end\n end\n end\n end\n end", "def output_identifier(v)\n v = 'untitled' if v == ''\n (i = identifier_output_method) ? v.to_s.send(i).to_sym : v.to_sym\n end", "def regclass_oid(expr, opts=OPTS)\n if expr.is_a?(String) && !expr.is_a?(LiteralString)\n expr = Sequel.identifier(expr)\n end\n\n sch, table = schema_and_table(expr)\n sch ||= opts[:schema]\n if sch\n expr = Sequel.qualify(sch, table)\n end\n \n expr = if ds = opts[:dataset]\n ds.literal(expr)\n else\n literal(expr)\n end\n\n Sequel.cast(expr.to_s,:regclass).cast(:oid)\n end", "def identifier_name\n return nil if (code = @codes[@pos]).nil?\n\n pos0 = @pos\n chars = []\n if code == 0x5c and ucode = unicode_escape? and identifier_start?(ucode)\n chars.push(ucode)\n @pos += 6\n elsif identifier_start?(code)\n chars.push(code)\n @pos += 1\n else\n return nil\n end\n\n while true\n code = @codes[@pos]\n if code == 0x5c and ucode = unicode_escape? and identifier_part?(ucode)\n chars.push(ucode)\n @pos += 6\n elsif identifier_part?(code)\n chars.push(code)\n @pos += 1\n else\n name = chars.pack(\"U*\").to_sym\n return ECMA262::IdentifierName.get(name)\n end\n end\n end", "def id_lookup(id)\n id = id.to_i\n if (id >= 128) && (id <= 255)\n id = \"oem_data_#{id}\"\n elsif DMI::ID_TO_DESCRIPTION.key?(id)\n id = DMI::ID_TO_DESCRIPTION[id]\n else\n Ohai::Log.debug(\"unrecognized header id; falling back to 'unknown'\")\n id = \"unknown_dmi_id_#{id}\"\n end\n rescue\n Ohai::Log.debug(\"failed to look up id #{id}, returning unchanged\")\n id\n end", "def pid_to_fedora_id pid\n 'info:fedora/' + pid\n end", "def identifier_string\n change_loggable.identifier_string rescue \"unknown\"\n end", "def get_oid(component_id, authpath)\n \n\n # The first two attempts represent current correct practice\n # DRS2 objects look like these, DRS1 SHOULD going forward\n oid_html = if res = try_request(component_id, authpath, role: \"DELIVERABLE\", quality: \"NA\")\n res.body\n elsif res = try_request(component_id, authpath, role: \"DELIVERABLE\", quality: \"5\")\n res.body\n # The next three attempts represent common legacy practice in DRS1\n elsif res = try_request(component_id, authpath)\n res.body\n # A number of PDS records have malformed component IDs with a '_mets' suffix. ಠ_ಠ\n elsif res = try_request(\"#{component_id}_mets\", authpath)\n res.body\n # A number of PDS records have malformed component IDs with a '-METS' suffix. ಠ_ಠ\n elsif res = try_request(\"#{component_id}-METS\", authpath)\n res.body\n elsif res = try_request(component_id, authpath, quality: \"5\")\n res.body\n else\n Log.info \"Failure: NO URN FOR C_ID: #{component_id} and ownerCode: #{authpath}\"\n \"\"\n end\n\n oid_html.match(/(?<=Oracle ID: ).+?(?=<br>)/)\n rescue Timeout::Error\n Log.info \"Timeout error in get_oid\"\n nil\n end", "def make_identifiable(symbol)\n if symbol.end_with?(\"%\")\n type = symbol.chomp(\"%\")\n quote(type + new_identifier_for(type).to_s)\n else\n symbol\n end\n end", "def identifier_type_friendly\n return nil if identifier_type.blank?\n\n IdentifierTypesStrToFull[identifier_type]\n end", "def to_obj_id\n if instance_variable_defined? :@to_obj_id\n @to_obj_id\n else\n @to_obj_id =\n if @chars =~ /^ruby-(\\d+)/\n $1.to_i\n end\n end\n end", "def ident_key\n :ident\n end", "def determine_name\n name = nil\n\n case @type\n when :computer\n name = `sudo dmidecode -s system-serial-number`.chomp\n when :hard_drive\n `sudo smartctl -i #{@options['device']}`.each_line do |line|\n line =~ /^Serial\\sNumber:\\s+([A-Za-z0-9_-]+)$/\n name = $1\n end\n end\n\n # Check if the id is valid (all word characters plus dash)\n if ( name =~ /^[A-Za-z0-9_-]+$/ )\n name\n else\n nil\n end\n end", "def to_param\n noid\n end", "def to_param\n noid\n end", "def os id\n return legal_values_for 'op_sys', id\n end", "def identifier_format\n scheme = identifier_scheme&.name\n return scheme if %w[orcid ror fundref].include?(scheme)\n\n return 'ark' if value.include?('ark:')\n\n doi_regex = %r{(doi:)?[0-9]{2}\\.[0-9]+/.}\n return 'doi' if value.match?(doi_regex)\n\n return 'url' if value.starts_with?('http')\n\n 'other'\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier_value\n user.icn\n end", "def croatian_id(international: T.unsafe(nil)); end", "def id\n \"AN_ID\"\n end", "def id\n \"AN_ID\"\n end", "def os_sym\n os_parser.sym\n end", "def resolve_canonical_id(xri)\n return xri if AtLinksafe::Iname.is_inumber?(xri)\n AtLinksafe::Resolver::Resolve.new(xri).canonical_id\n end", "def loser_code()\n \"L\"+self.id.to_s\n end", "def identifier\n best_identifier\n end", "def identifier\n id || name || default_identifier\n end", "def identifier\n @identifier ||= \"#{self.type_prefix}.#{Model::to_id @schema.title}.#{Model::to_id name}\"\n end", "def value_to_ident(value)\n return nil if value.nil?\n if value.nil?\n return nil\n elsif value.kind_of?(Fixnum)\n the_id = value\n elsif value.respond_to?(:id)\n the_id = value.id\n else\n Kernel.raise \"Cannot search for invalid value #{value.inspect}\"\n end\n return index(the_id)\n end", "def identification_name(identification_type)\n case identification_type\n when Donor.identification_types['pan_card']\n 'Permanent Account Number'\n when Donor.identification_types['aadhaar_card']\n 'Aadhaar Number'\n when Donor.identification_types['passport']\n 'Passport number'\n when Donor.identification_types['voter_id_card']\n 'Elector\\'s photo identity number'\n when Donor.identification_types['driving_license']\n 'Driving License number'\n when Donor.identification_types['ration_card']\n 'Ration card number'\n when Donor.identification_types['tax_payer_country_of_residence']\n 'Tax Identification Number'\n else\n ''\n end\n end", "def canonical_instance_identifiers(opennebula_instance)\n fail 'Instance object not provided!' unless opennebula_instance\n identifiers = []\n\n identifiers << opennebula_instance['USER_TEMPLATE/OCCI_ID']\n identifiers << opennebula_instance['NAME']\n identifiers << opennebula_instance['ID'].to_s\n identifiers.compact!\n\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Assigning instance IDs \" \\\n \"#{identifiers.inspect} to #{opennebula_instance['ID'].inspect}\"\n identifiers\n end", "def charset_name2id(charset_name)\n #This is a stub, used for indexing\n end", "def linux_identification\n \"#{fetch_linux_distributor}_#{fetch_linux_os_version}\"\nend", "def identifier(no_version: false)\n return emma_recordId if emma_recordId.present?\n parts = [emma_repository, emma_repositoryRecordId, dc_format]\n parts << emma_formatVersion unless no_version\n parts.compact_blank.join('-').presence\n end", "def gen_inst_id_str(inst_str)\n return inst_str.gsub(/[\\.:\\[\\]]/,'_').upcase\nend", "def identifier_type\n {\n coding: [{\n system: CODING_SYSTEM,\n code: IDENTIFIER_CODE,\n userSelected: false\n }]\n }\n end", "def jurisdiction_name oc_code\n oc_code = \"oc_#{oc_code}\" unless oc_code.to_s.match?(/^oc_/)\n Card.fetch_name oc_code.to_sym\nend", "def jurisdiction_name oc_code\n oc_code = \"oc_#{oc_code}\" unless oc_code.to_s.match?(/^oc_/)\n Card.fetch_name oc_code.to_sym\n end", "def to_oid(value, id = nil)\n if id\n id\n elsif value.is_a?(BSON::ObjectId)\n value\n elsif value['$oid']\n BSON::ObjectId.from_string(value['$oid'])\n else\n BSON::ObjectId.new\n end\n end", "def platform_id_remap(id)\n # this catches the centos guest shell in the nexus switch which identifies itself as centos\n return \"nexus_centos\" if id == \"centos\" && os_release_file_is_cisco?\n\n PLATFORM_ID_MAP[id.downcase] || id.downcase\n end", "def area_node_name(asn, area)\n \"as#{asn}-area#{area}\"\n end", "def get_ethernet_oids(host)\n ifTable_columns = [\"ifDescr\", \"ifOutOctets\",\"ifIndex\"]\n eth_name = nil\n eth_octets = nil\n eth_index = nil\n SNMP::Manager.open(:Host => host) do |manager|\n manager.walk(ifTable_columns) do |row|\n next if row[0].value.to_s.match('^lo')\n if eth_name.nil? then\n eth_name = row[0].value\n eth_octets = row[1].value\n eth_index = row[2].value\n end\n if row[1].value > eth_octets then\n eth_name = row[0].value\n eth_octets = row[1].value\n eth_index = row[2].value\n end\n end\n end\n if eth_index.nil?\n eth_index = 0\n end\n return {\n \"ifOutOctets\" => \".1.3.6.1.2.1.2.2.1.16.#{eth_index}\",\n \"ifInOctets\" => \".1.3.6.1.2.1.2.2.1.10.#{eth_index}\"\n }\nend", "def identifier\n @identifier ||= \"#{self.type_prefix}.#{Model::to_id(name)}\"\n end", "def issue_identifier(node)\n @issued[node] ||= begin\n res, @counter = @prefix + @counter.to_s, @counter + 1\n res\n end\n end", "def to_nvar(name)\n name[0] == at ? name[1..-1].to_sym : name.to_sym\n end", "def to_human\n 'DUID_EN<%#x,%s>' % [en, identifier]\n end", "def fedora_id_to_numeric_id fedora_id\n /.*:([0-9]+)/.match(fedora_id)[1].to_i\n end", "def identifier\n @info.identifier\n end", "def identifier\n @info.identifier\n end", "def identifier\n @identifier ||= \"#{ATTRIBUTE_PREFIX}.#{Model::to_id @schema_ref}.#{Model::to_id @reference}\"\n end", "def to_id\n\t\treturn self.\n\t\t\tgsub(\"::\", \"\").\n\t\t\tgsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t\t\tgsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t\t\tdowncase.\n\t\t\tgsub(\"_\", \"-\")\n\tend", "def identifier\n num\n end", "def input_identifier(v)\n (i = identifier_input_method) ? v.to_s.send(i) : v.to_s\n end", "def mkInternalTraceId(string)\r\n string.gsub(\"_\",\"-\")\r\n end", "def canonical_image_identifiers(opennebula_image)\n fail 'Image object not provided!' unless opennebula_image\n identifiers = []\n\n identifiers << opennebula_image['TEMPLATE/VMCATCHER_EVENT_AD_MPURI']\n identifiers << opennebula_image['TEMPLATE/VMCATCHER_EVENT_DC_IDENTIFIER']\n identifiers << opennebula_image['NAME']\n identifiers << opennebula_image['ID'].to_s\n identifiers.compact!\n\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Assigning IDs #{identifiers.inspect} \" \\\n \"to image #{opennebula_image['ID'].inspect}\"\n identifiers\n end", "def generate_identifier\n self.identifier ||= self.name.parameterize.underscore\n end", "def pos_to_sym(entity)\n entity.gsub('-', '_').to_sym\n end", "def build_id(disk_dev_name, nr)\n nr = deep_copy(nr)\n Builtins.sformat(\"%1:%2\", disk_dev_name, nr)\n end", "def mint_ark\n Ezid::Identifier.mint\nend", "def new_org_handle\n new_org_dxid.sub(/^org-/, \"\")\n end", "def notename\n self.class.notename_s(notename_i)\n end", "def identifier; end", "def identifier; end", "def set_identifier\n self.identifier = self.name.downcase.gsub(/[^a-zA-Z0-9]+/, '-').chomp('-')\n end", "def interface_name(class_def)\n \t_IDENTIFIER5 = nil\n\n\n\n\n # 55:7: IDENTIFIER\n _IDENTIFIER5 = @input.look_ahead(1)\n match(:IDENTIFIER)\n class_def.add_interface(_IDENTIFIER5.text) \n\n\n\n end", "def occurrence_id \n # An identifier for the Occurrence (as opposed to a particular digital record of the occurrence).\n # In the absence of a persistent global unique identifier, construct one from a combination of identifiers in the record that will most closely make the occurrenceID globally unique.\n # For a specimen in the absence of a bona fide global unique identifier, for example, use the form: \"urn:catalog:[institutionCode]:[collectionCode]:[catalogNumber].\n # Examples: \"urn:lsid:nhm.ku.edu:Herps:32\", \"urn:catalog:FMNH:Mammal:145732\" \n\n #if v = @obj.identifiers.that_are_global.andand.first\n # v.cached_display_name\n #else\n \"urn:catalog:#{institution_code}:#{collection_code}:#{catalog_number}\"\n #end\n end", "def identifier_type_mapping_obj\n return nil if identifier_type.blank?\n\n IdentifierTypesToMapping[identifier_type]\n end", "def identifier_normalize identifier\n if /[A-Z]/ =~ identifier\n use_identifier = identifier.downcase\n else\n use_identifier = identifier\n end\n use_identifier\n end", "def related_identifier_type(identifier:)\n case identifier.category\n when 'arxiv'\n 'arXiv'\n when %w[bibcode w3id]\n identifier.category.to_s\n when %w[handle]\n identifier.category.to_s.capitalize\n when %w[doi ean13 eissn igsn isbn issn istc lissn lsid pmid purl upc url urn]\n identifier.category.to_s.upcase\n else\n identifier.value.to_s.start_with?('http') ? 'URL' : 'Handle'\n end\n end", "def name2id(value)\n Puppet::Util::Windows::Security.name_to_sid(value)\n end", "def pid_to_s\n \"#{Setting.organization_icao}#{pid}\"\n end", "def get_nbe_id_from_obe_domain(obe_uri)\n uri = URI(obe_uri)\n new_ux_id\n\n response = http_get_response(uri)\n parsed = response.parsed_response\n\n @log.debug(\"New UX Id: #{parsed[\"nbeId\"]}\")\n\n if parsed[\"nbeId\"].nil? || parsed[\"nbeId\"].empty?\n else\n new_ux_id = get_page_id_for_given_nbe_id(uri, parsed[\"nbeId\"])\n end\n\n new_ux_id\n end", "def identifier\n # TODO: Don't parse ser_type every time\n r_class = Thales::Datamodel::CLASS_FOR[record.ser_type]\n data = r_class.new.deserialize(record.ser_data)\n\n data.identifier\n end", "def to_s\n iid\n end", "def make_ref_from_oid(object_type, object_id)\n return \"/#{object_type}/#{object_id}\"\n end", "def char_to_id(ch); end" ]
[ "0.7137624", "0.71049565", "0.64631265", "0.63861", "0.62184274", "0.596728", "0.58594346", "0.5699174", "0.5697396", "0.5671295", "0.56686276", "0.56226635", "0.56219476", "0.5611143", "0.5595667", "0.5567362", "0.55576074", "0.5551407", "0.5551407", "0.55500597", "0.5546227", "0.5529618", "0.55069405", "0.5476801", "0.5469744", "0.54549277", "0.5454641", "0.5414218", "0.5407798", "0.54039687", "0.5382533", "0.53569525", "0.53477323", "0.534195", "0.5301457", "0.52941483", "0.52844596", "0.52844596", "0.52750385", "0.527054", "0.52636796", "0.52636796", "0.5256256", "0.52407706", "0.5234461", "0.5234461", "0.52232474", "0.52071905", "0.5202402", "0.5202217", "0.520196", "0.519993", "0.51988405", "0.5187813", "0.5184353", "0.51810825", "0.5177865", "0.5173857", "0.5167261", "0.5159216", "0.5144377", "0.5141167", "0.5139585", "0.51347715", "0.5101064", "0.5100446", "0.5088341", "0.5086943", "0.50836766", "0.5075069", "0.50673264", "0.50654435", "0.50654435", "0.50641817", "0.5060614", "0.5056238", "0.5047552", "0.50413924", "0.5035665", "0.5033309", "0.5028135", "0.50221866", "0.50174487", "0.5000949", "0.49903473", "0.49892747", "0.49892747", "0.49890855", "0.49831083", "0.49825823", "0.49780324", "0.49757034", "0.49701288", "0.4968708", "0.49678004", "0.49607304", "0.49438775", "0.49404502", "0.4937348", "0.49327987" ]
0.6338959
4
Loads a MIB. Can be called multiple times, as it'll load it once. Accepts the MIB name in several ways: MIB.load("SNMPv2MIB") MIB.load("SNMPv2MIB.txt") MIB.load("/path/to/SNMPv2MIB.txt")
def load(mod) unless File.file?(mod) moddir = nil MIBDIRS.each do |mibdir| if File.exist?(File.join(mibdir, mod)) moddir = File.join(mibdir, mod) break elsif File.extname(mod).empty? && File.exist?(File.join(mibdir, "#{mod}.txt")) moddir = File.join(mibdir, "#{mod}.txt") break end end return false unless moddir mod = moddir end return true if @modules_loaded.include?(mod) do_load(mod) @modules_loaded << mod true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def importMib( mib, path )\n puts \"Copying MIB from MIBS/#{mib} to #{path} ...\"\n FileUtils.cp_r(\"MIBS/#{mib}\", path)\n puts \"Importing MIB: #{mib} ...\"\n SNMP::MIB.import_module(\"MIBS/#{mib}\")\nend", "def read_mib_dic(filename)\n mib = eval_mib_dic(filename)\n\n raise(SnmpMibError, \"invalid mib dic format for file #{filename}\") unless mib\n module_name = mib[\"moduleName\"]\n\n raise(SnmpMibError, \"invalid mib dic format for file #{filename}\") unless module_name\n nodes = mib[\"nodes\"] || []\n\n if nodes.empty?\n logger.warn(\"no nodes defined in mib dic file #{filename}\")\n end\n\n [module_name, nodes]\n end", "def load_module(module_name, mib_dir=DEFAULT_MIB_PATH)\n mib_module_hash = {}\n file_list = find_module_files(module_name, mib_dir)\n raise \"Unknown module\" if file_list.empty?\n file_list.each do |file_name|\n \t#TODO: NoMethodError = No file importer and comment on file_import include\n\t mib_module_hash = self.send(\"load_module_\" +\n\t \t\t\t\t\t\t\tFile.extname(file_name).delete(\".\"),\n\t \t\t\t\t\t\t\tfile_name)\n\t end\n \t@by_name.merge!(mib_module_hash)\n @by_module_by_name[module_name] = {}\n @by_module_by_name[module_name].merge!(mib_module_hash)\n end", "def load(name); end", "def load_from(m, *args, &blk)\n return if :nothing == m\n meth = \"load_from_#{m}\".to_sym\n if private_methods.include?(meth) or respond_to?(meth)\n send meth, *args, &blk \n else\n raise NoMethodError, \"#{m} is not a proper loader\"\n end\n end", "def load_file(path)\n load_string(File.binread(path))\n end", "def add_mib_path(path)\n dic_files = if ::File.directory?(path)\n Dir[::File.join(path, \"*.dic\")]\n elsif ::File.file?(path)\n [path]\n else\n raise(SnmpMibError, \"file or directory path expected: #{path.to_s}\")\n end\n\n dic_files.each do |f|\n module_name, nodes = read_mib_dic(f)\n nodes.each do |k, v|\n @tree.add_node(Node.new(v[\"nodetype\"], k, v[\"moduleName\"], v[\"oid\"]))\n end\n end\n end", "def load(pathname, options={}) #, &block)\n $LEDGER.load(pathname, options)\n end", "def load(id, *args, &blk); end", "def load( name )\n\t\t\traise NotImplementedError,\n\t\t\t\t\"required method 'load' not implemented in '#{self.class.name}'\"\n\t\tend", "def load_file(path)\n send_cmd(\"load #{path}\")\n end", "def load(*args, &block)\n orange.load(*args, &block)\n end", "def load(pathname, options={}) #, &block)\n $LOAD_MANAGER.load(pathname, options)\n end", "def update\n @mib = Mib.find(params[:id])\n\n respond_to do |format|\n if @mib.update_attributes(params[:mib])\n format.html { redirect_to @mib, notice: 'Mib was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mib.errors, status: :unprocessable_entity }\n end\n end\n end", "def load_rb(filename); end", "def load_file(file)\n kernel_load(file)\n end", "def load(path); end", "def _load(path)\n path = Pathname.new(path)\n @loader.load(path)\n end", "def load\n end", "def create\n @mib = Mib.new(params[:mib])\n\n respond_to do |format|\n if @mib.save\n format.html { redirect_to @mib, notice: 'Mib was successfully created.' }\n format.json { render json: @mib, status: :created, location: @mib }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mib.errors, status: :unprocessable_entity }\n end\n end\n end", "def load(name)\n Kernel.load name\nend", "def show\n @mib = Mib.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mib }\n end\n end", "def load\n end", "def load\n end", "def load\n end", "def load_from_server(bag_name, item_name = nil)\n begin\n if (item_name)\n item = Chef::DataBagItem.load(bag_name, item_name)\n item = Chef::EncryptedDataBagItem.new(item.raw_data, read_secret) if use_encryption\n else\n item = Chef::DataBag.load(bag_name)\n end\n rescue Net::HTTPServerException => e\n raise unless e.to_s =~ /^404/\n end\n item\n end", "def mload(key)\n if val = get(key)\n Marshal.load(val)\n end\n end", "def _load(string)\n with_name Marshal.load(string)\n end", "def initialize\n super\n require 'snmp'\n end", "def load(filename)\n end", "def load_from_file(bag_name, topo_name)\n \n topo_file = File.join(Dir.pwd, \"#{topologies_path}\", bag_name, topo_name + '.json')\n return unless (loader.file_exists_and_is_readable?(topo_file))\n \n item_data = loader.object_from_file(topo_file)\n item_data = if use_encryption\n secret = read_secret\n Chef::EncryptedDataBagItem.encrypt_data_bag_item(item_data, secret)\n else\n item_data\n end\n item = Chef::DataBagItem.new\n item.data_bag(bag_name)\n item.raw_data = item_data\n item\n end", "def load(name, env = default_environment)\n # This block autoloads appropriate file each time a missing macro is\n # requested from hash.\n path = name.split('::').join('/')\n load_from_file(name, path, env)\n end", "def load_interface(interface)\n # This require will only run once. If we repeat it, it is not\n # loaded again\n require \"virtualbox/com/interface/#{@__version}/#{interface}\"\n\n # Find the module based on the version and name and return it\n Object.module_eval(\"::VirtualBox::COM::Interface::#{version_const}::#{interface}\")\n end", "def load fname=Dir[\"dumps/atari_*.bin\"].sort.last\n hsh = File.open(fname, 'r') { |f| Marshal.load f }\n initialize hsh[:config]\n opt.instance_variable_set :@best, hsh[:best]\n opt.instance_variable_set :@mu, hsh[:mu]\n opt.instance_variable_set :@sigma, hsh[:sigma]\n compr.instance_variable_set :@centrs, hsh[:centrs]\n # Uhm haven't used that yet...\n # what else needs to be done in order to be able to run `#show_ind` again?\n puts \"Experiment data loaded from `#{fname}`\"\n true\n end", "def load(file); end", "def load(file_path); end", "def load(file_path); end", "def load; end", "def load; end", "def load; end", "def load(*args)\n @core.load(*args)\n end", "def loadFile(filename)\n\t\t\tdescname = filename.basename.sub_ext(\"\").to_s + \"Desc\"\n\t\t\tif(!@loaded.include?(descname))\n\t\t\t\t@loaded << descname\n\n\t\t\t\tfilename = filename.to_s\n\t\t\t\tlast = $mec_mgr\n\n\t\t\t\t$mec_mgr = self\n\t\t\t\trequire(filename)\n\t\t\t\t$mec_mgr = last\n\t\t\t\t\n\t\t\t\tdesc = begin\n\t\t\t\t\tMakeRbExt.const_get(descname)\n\t\t\t\trescue NameError\n\t\t\t\t\traise(\"File `#{filename}' should contain a ruby module `#{descname}', but doesn't\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tdesc.register(@settings)\n\t\t\tend\n\t\tend", "def load_rom(rom_filename)\n rom_file = File.new(rom_filename, \"r\")\n memcnt = @instruction_ptr\n while (opcode = rom_file.read(2))\n opcode_bytes = opcode.bytes.to_a\n @memory[memcnt] = opcode_bytes[0]\n @memory[memcnt+1] = opcode_bytes[1]\n memcnt += 2\n end\n end", "def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend", "def l(filename)\n load \"#{filename}.rb\"\nend", "def load\n instance_eval File.read(@path).tap(&Gem::UNTAINT), @path, 1\n\n self\n end", "def load(filename = '')\n catch_load_error(filename) do\n _load(filename)\n set_proc_line\n end\n end", "def load\n end", "def load\n end", "def load_file(path)\n load(path)\n end", "def load(filename)\n\t\tend", "def load(ptr, name = \"\")\n load2(nil, ptr, name)\n end", "def load_rabid(*args)\n list = self.available_rabids\n args.each do |arg|\n raise ArgumentError.new \"Unknown rabid requested: #{arg}\" unless list.include?(arg)\n require \"rabidprawns/#{arg}\"\n end\n end", "def load\n raise NotImplementedError, 'You must be implement \"load\" method.'\n end", "def load_virtualmachine\n @virtualmachine = Virtualmachine.find(params[:virtualmachine_id])\n end", "def load\r\n \r\n end", "def demand_load_module(fullname)\n\t\tdlog(\"Demand loading module #{fullname}.\", 'core', LEV_1)\n\n\t\treturn nil if (@modcache.group?(fullname) == false)\n\t\treturn nil if (@modcache[fullname]['FileNames'].nil?)\n\t\treturn nil if (@modcache[fullname]['FilePaths'].nil?)\n\n\t\ttype = fullname.split(/\\//)[0]\n\t\tfiles = @modcache[fullname]['FileNames'].split(',')\n\t\tpaths = @modcache[fullname]['FilePaths'].split(',')\n\n\t\tfiles.each_with_index { |file, idx|\n\t\t\tdlog(\"Loading from file #{file}\", 'core', LEV_2)\n\n\t\t\tload_module_from_file(paths[idx], file, nil, nil, nil, true)\n\t\t}\n\n\t\tif (module_sets[type].postpone_recalc != true)\n\t\t\tmodule_sets[type].recalculate\n\t\tend\n\tend", "def load(*args)\n args.each do |thing|\n key = File.basename(thing.to_s).sub('.rb', '')\n if(thing.is_a?(String))\n components[key] = self.class.load_component(thing)\n else\n components[key] = sparkle.get(:component, thing)[:block]\n end\n @load_order << key\n end\n self\n end", "def new\n @mib = Mib.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mib }\n end\n end", "def load(file)\n path = expand_path(file)\n runtime.run(path) if path\n end", "def load!; end", "def initialize(name)\n @name = name\n load \n end", "def load(path)\n @model = self.class.superclass.load(path)\n end", "def load\n @checksum ||= ::File.exists?(checksum_file) ? ::File.read(checksum_file) : ''\n Chef::Log.debug(\"Loaded checksum for SMF #{self.name}: #{@checksum}\")\nend", "def load_from_file(name, path, env = default_environment)\n if autoloader.load(path, env)\n # the autoloaded code should add its macro to macros\n unless m = self.macro(name,env,false)\n Puppet.debug(\"#{autoloader.expand(path).inspect} loaded but it \" +\n \"didn't define macro #{name.inspect}\")\n end\n m\n else\n Puppet.debug(\"could not autoload #{autoloader.expand(path).inspect}\")\n nil\n end\n end", "def load(serialized, &block)\n return unless serialized\n\n serialized[0].constantize.instantiate(serialized[1], &block)\n end", "def load\n\t\t\t\t0\n\t\t\tend", "def load(name)\n\t\t\tfiles = []\n\t\t\t@dirpaths.each { |dp|\n\t\t\t\tif(dp.directory?)\n\t\t\t\t\tdp.opendir { |dir|\n\t\t\t\t\t\tdir.each { |f|\n\t\t\t\t\t\t\tif (f != \".\" && f != \"..\" && File.extname(f).downcase == \".rb\" && f[0...name.length] == name)\n\t\t\t\t\t\t\t\tfiles << dp + f\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t}\n\t\t\tif(files.empty?)\n\t\t\t\traise \"No suitable MEC file for \\\"#{name}\\\" found!\"\n\t\t\tend\n\t\t\tfiles.each { |file|\n\t\t\t\tloadFile(file)\n\t\t\t}\n\t\tend", "def load_file(filename); end", "def load_file(filename); end", "def load\n require \"#{so_name}\" or raise LoadError, \"require on #{so_name} failed\"\n end", "def load file='GOL.sav'\n self.state=File.open(file,'r') do |f|\n Marshal.load(f)\n end\n end", "def load_method klass_name, method_name\n file = method_file klass_name, method_name\n\n File.open file, 'rb' do |io|\n obj = Marshal.load io.read\n obj.store = self\n obj.parent =\n find_class_or_module(klass_name) || load_class(klass_name) unless\n obj.parent\n obj\n end\n rescue Errno::ENOENT => e\n error = MissingFileError.new(self, file, klass_name + method_name)\n error.set_backtrace e.backtrace\n raise error\n end", "def load_file(file_path)\n\t\t\tcode = File.open(file_path) { |f| f.read }\n\t\t\t@interpreter.run(code)\n\t\tend", "def load_item(data_bag, item_name, metadata = {})\n item = ::SecureDataBag::Item.load(data_bag, item_name, metadata)\n item\n end", "def load_file(file); end", "def load_from_file_cache(file)\n puts \"loading stuff from #{file}\"\n File.open(file, 'r') do |input|\n Marshal.load(input.read)\n end\n end", "def load(name)\n config_file \"#{name}\"\n end", "def load_config( name )\n config = INI.load_file( name )\n config\nend", "def load(*args)\n args.each do |thing|\n if(thing.is_a?(Symbol))\n path = File.join(components_directory, \"#{thing}.rb\")\n else\n path = thing\n end\n key = File.basename(path).sub('.rb', '')\n components[key] = self.class.load_component(path)\n @load_order << key\n end\n self\n end", "def load_default\n load DEFAULT\n end", "def load_file(file_path)\n\t\t\tcode = File.open(file_path) { |f| f.read }\n\t\t\trun(code)\n\t\tend", "def load(path, options={}, &block)\n options.merge(block.call) if block\n options[:load] = true\n options[:suffix] = false\n require(path, options)\n end", "def load (scriptPath)\n @examRip.instance_eval( File.read( scriptPath ) , scriptPath, 1)\n end", "def load_n n\n load id_to_full_filename n\n end", "def load_item_from_local(name)\n local_data_bag_item = Dir[\"#{@context.repo_path}/data_bags/**/#{name}.json\"].first\n return nil if local_data_bag_item.nil?\n\n FFI_Yajl::Parser.parse(File.read(local_data_bag_item))\n rescue FFI_Yajl::ParseError\n nil\n end", "def load( filepath )\n unserialize( IO.read( filepath ) )\n end", "def load(namespaces = {})\n namespaces.each_pair { |name, uses| instance(name).use(uses) }\n end", "def load_module_from_file(path, file, loaded, recalc, counts, demand = false)\n\t\n\t\t# If the file on disk hasn't changed with what we have stored in the\n\t\t# cache, then there's no sense in loading it\n\t\tif (!has_module_file_changed?(file))\n\t\t\tdlog(\"Cached module from file #{file} has not changed.\", 'core', LEV_2)\n\t\t\treturn false\n\t\tend\n\n\t\t# Substitute the base path\n\t\tpath_base = file.sub(path + File::SEPARATOR, '')\n\n\t\t# Derive the name from the path with the exclusion of the .rb\n\t\tname = path_base.match(/^(.+?)#{File::SEPARATOR}(.*)(.rb?)$/)[2]\n\n\t\t# Chop off the file name\n\t\tpath_base.sub!(/(.+)(#{File::SEPARATOR}.+)(.rb?)$/, '\\1')\n\n\t\tif (m = path_base.match(/^(.+?)#{File::SEPARATOR}+?/)) \n\t\t\ttype = m[1]\n\t\telse\n\t\t\ttype = path_base\n\t\tend\n\t\t\n\t\ttype.sub!(/s$/, '')\n\n\t\t\n\t\tadded = nil\n\t\t\n\t\tbegin\n\t\t\twrap = ::Module.new\n\t\t\twrap.module_eval(File.read(file, File.size(file)))\n\t\t\tif(wrap.const_defined?(:RequiredVersions))\n\t\t\t\tmins = wrap.const_get(:RequiredVersions)\n\t\t\t\tif( mins[0] > ::Msf::Framework::VersionCore or \n\t\t\t\t mins[1] > ::Msf::Framework::VersionAPI\n\t\t\t\t )\n\t\t\t\t\terrmsg = \"Failed to load module from #{file} due to version check (requires Core:#{mins[0]} API:#{mins[1]})\"\n\t\t\t\t\telog(errmsg)\n\t\t\t\t\tself.module_failed[file] = errmsg\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\t\t\n\t\trescue ::Interrupt\n\t\t\traise $!\n\t\trescue ::Exception => e\n\t\t\t# Hide eval errors when the module version is not compatible\n\t\t\tif(wrap.const_defined?(:RequiredVersions))\n\t\t\t\tmins = wrap.const_get(:RequiredVersions)\n\t\t\t\tif( mins[0] > ::Msf::Framework::VersionCore or \n\t\t\t\t mins[1] > ::Msf::Framework::VersionAPI\n\t\t\t\t )\n\t\t\t\t\terrmsg = \"Failed to load module from #{file} due to error and failed version check (requires Core:#{mins[0]} API:#{mins[1]})\"\n\t\t\t\t\telog(errmsg)\n\t\t\t\t\tself.module_failed[file] = errmsg\n\t\t\t\t\treturn false\n\t\t\t\tend \n\t\t\tend\n\t\t\terrmsg = \"#{e.class} #{e}\"\n\t\t\tself.module_failed[file] = errmsg\n\t\t\telog(errmsg)\n\t\t\treturn false\n\t\tend\n\n\t\tif(not wrap.const_defined?('Metasploit3'))\n\t\t\terrmsg = \"Missing Metasploit3 constant\"\n\t\t\tself.module_failed[file] = errmsg\n\t\t\telog(errmsg)\n\t\t\treturn false\n\t\tend\n\t\tadded = wrap.const_get('Metasploit3')\n\n\t\t# If the module indicates that it is not usable on this system, then we \n\t\t# will not try to use it.\n\t\tusable = false\n\n\t\tbegin\n\t\t\tusable = respond_to?(:is_usable) ? added.is_usable : true\n\t\trescue\n\t\t\telog(\"Exception caught during is_usable check: #{$!}\")\n\t\tend\n\t\t\t\n\t\t# Synchronize the modification time for this file.\n\t\tupdate_module_cache_info(nil, added, {\n\t\t\t'paths' => [ path ],\n\t\t\t'files' => [ file ],\n\t\t\t'type' => type}) if (!using_cache)\t\n\n\t\tif (usable == false)\n\t\t\tilog(\"Skipping module in #{file} because is_usable returned false.\", 'core', LEV_1)\n\t\t\treturn false\n\t\tend\n\n\t\tilog(\"Loaded #{type} module #{added} from #{file}.\", 'core', LEV_2)\n\t\tself.module_failed.delete(file)\n\t\t\n\t\t# Do some processing on the loaded module to get it into the\n\t\t# right associations\n\t\ton_module_load(added, type, name, {\n\t\t\t'files' => [ file ],\n\t\t\t'paths' => [ path ],\n\t\t\t'type' => type })\n\n\t\t# Set this module type as needing recalculation\n\t\trecalc[type] = true if (recalc)\n\n\t\t# Append the added module to the hash of file->module\n\t\tloaded[file] = added if (loaded)\n\t\n\t\t# Track module load history for future reference\n\t\tmodule_history[file] = added\n\t\tmodule_history_mtime[file] = File::Stat.new(file).mtime.to_i\n\n\t\t# The number of loaded modules this round\n\t\tif (counts)\n\t\t\tcounts[type] = (counts[type]) ? (counts[type] + 1) : 1\n\t\tend\n\n\t\treturn true\n\tend", "def populate\n response = @connection.lbreq(\"GET\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n data = JSON.parse(response.body)['loadBalancer']\n @id = data[\"id\"]\n @name = data[\"name\"]\n @protocol = data[\"protocol\"]\n @port = data[\"port\"]\n @algorithm = data[\"algorithm\"]\n @connection_logging = data[\"connectionLogging\"][\"enabled\"]\n @status = data[\"status\"]\n @timeout = data[\"timeout\"]\n true\n end", "def load(path)\n fail MethodDenied, :load_cf if infobase.read_only?\n infobase.designer do\n loadCfg path\n end.run.wait.result.verify!\n path\n end", "def load\n file_name = ask_save_file\n save_file = File.open(file_name, 'r')\n save_file.pos = 0\n contents = unserialize(save_file.read)\n @name = contents['name']\n @guess = contents['guess']\n @word = contents['word']\n @bank = contents['bank']\n @lives = contents['lives']\n @letter = contents['letter']\n puts \"Game has been loaded from Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end", "def load_interface(flush_it = false)\n if flush_it\n dispose_bitmaps_from_cache_tab(@interface_cache)\n else\n @interface_cache = {}\n @interface_data = Yuki::VD.new(PSDK_PATH + '/master/interface', :read)\n end\n end", "def load_rb( file )\r\n begin\r\n str = IO.read(file)\r\n load_rb_rules_as_string(str)\r\n rescue Exception => e\r\n raise RuleLoadingError, \"loading ruby file\"\r\n end\r\n end", "def load_marshal_data object # :nodoc:\n object.load\n rescue NameError, ArgumentError => e\n DRb::DRbUnknown.new e, object.stream\n end", "def load(filename)\n run \"load #{OptArg.quote(filename)}\"\n nil\n end", "def load framework\n framework = framework.downcase\n dir = File.join(@path, framework)\n if Dir.exists? dir\n Dir.glob(File.join(dir, '**/*.rb')).each do |mapping|\n require mapping.chomp! '.rb'\n end\n end\n end", "def load( path )\n @content = File.read( path )\n load_listener.on_load( self, path ) if load_listener\n end", "def load\n return unless @file_path && File.exist?(@file_path)\n File.open(@file_path, 'rb') do |file|\n return Marshal.load(file)\n end\n end", "def load()\n\n checkFileExists()\n loadConfigs()\n checkConfigs() \n end" ]
[ "0.7022308", "0.6241425", "0.5965714", "0.5669535", "0.5637181", "0.54845876", "0.5429251", "0.5347654", "0.53442574", "0.5343759", "0.52839375", "0.5254179", "0.5247249", "0.5174308", "0.51561916", "0.5149515", "0.5110713", "0.509119", "0.5051834", "0.50386494", "0.50239736", "0.5004372", "0.50015825", "0.50015825", "0.50015825", "0.5000998", "0.49989778", "0.49939418", "0.4989978", "0.49841076", "0.4978996", "0.4978391", "0.49737996", "0.49694276", "0.49326926", "0.49297988", "0.49297988", "0.49246985", "0.49246985", "0.49246985", "0.48821354", "0.48800075", "0.48760286", "0.48666358", "0.4857501", "0.48560682", "0.48494133", "0.48448455", "0.48448455", "0.48385823", "0.48344925", "0.48245573", "0.4821767", "0.4818006", "0.48107454", "0.48026046", "0.47957325", "0.4782281", "0.47731456", "0.47671816", "0.4748192", "0.4746268", "0.4738395", "0.47040072", "0.4685027", "0.46757725", "0.4672291", "0.46676138", "0.46628693", "0.46628693", "0.46604776", "0.46591005", "0.46567118", "0.46473923", "0.46416694", "0.46362418", "0.46314648", "0.46215144", "0.4616583", "0.4614662", "0.4580414", "0.4563885", "0.455326", "0.45423797", "0.4535088", "0.45331183", "0.4532894", "0.45324484", "0.4527707", "0.45254323", "0.45252854", "0.45003128", "0.4498726", "0.44929278", "0.44890538", "0.44789794", "0.4468839", "0.44640765", "0.4462575", "0.445954" ]
0.5329932
10
Loads the MIB all the time, where +mod+ is the absolute path to the MIB.
def do_load(mod) data = @parser_mutex.synchronize { PARSER.parse(File.read(mod)) } imports = load_imports(data[:imports]) declarations = Hash[ data[:declarations].reject { |dec| !dec.key?(:name) || !TYPES.include?(dec[:type]) } .map { |dec| [String(dec[:name]), String(dec[:value]).split(/ +/)] } ] declarations.each do |nme, value| store_oid_in_identifiers(nme, value, imports: imports, declarations: declarations) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(mod)\n unless File.file?(mod)\n moddir = nil\n MIBDIRS.each do |mibdir|\n if File.exist?(File.join(mibdir, mod))\n moddir = File.join(mibdir, mod)\n break\n elsif File.extname(mod).empty? && File.exist?(File.join(mibdir, \"#{mod}.txt\"))\n moddir = File.join(mibdir, \"#{mod}.txt\")\n break\n end\n end\n return false unless moddir\n\n mod = moddir\n end\n return true if @modules_loaded.include?(mod)\n\n do_load(mod)\n @modules_loaded << mod\n true\n end", "def post_hard_load(mod); end", "def pre_hard_load(mod); end", "def demand_load_module(fullname)\n\t\tdlog(\"Demand loading module #{fullname}.\", 'core', LEV_1)\n\n\t\treturn nil if (@modcache.group?(fullname) == false)\n\t\treturn nil if (@modcache[fullname]['FileNames'].nil?)\n\t\treturn nil if (@modcache[fullname]['FilePaths'].nil?)\n\n\t\ttype = fullname.split(/\\//)[0]\n\t\tfiles = @modcache[fullname]['FileNames'].split(',')\n\t\tpaths = @modcache[fullname]['FilePaths'].split(',')\n\n\t\tfiles.each_with_index { |file, idx|\n\t\t\tdlog(\"Loading from file #{file}\", 'core', LEV_2)\n\n\t\t\tload_module_from_file(paths[idx], file, nil, nil, nil, true)\n\t\t}\n\n\t\tif (module_sets[type].postpone_recalc != true)\n\t\t\tmodule_sets[type].recalculate\n\t\tend\n\tend", "def load_module(module_name, mib_dir=DEFAULT_MIB_PATH)\n mib_module_hash = {}\n file_list = find_module_files(module_name, mib_dir)\n raise \"Unknown module\" if file_list.empty?\n file_list.each do |file_name|\n \t#TODO: NoMethodError = No file importer and comment on file_import include\n\t mib_module_hash = self.send(\"load_module_\" +\n\t \t\t\t\t\t\t\tFile.extname(file_name).delete(\".\"),\n\t \t\t\t\t\t\t\tfile_name)\n\t end\n \t@by_name.merge!(mib_module_hash)\n @by_module_by_name[module_name] = {}\n @by_module_by_name[module_name].merge!(mib_module_hash)\n end", "def reload_module(mod)\n\t\trefname = mod.refname\n\t\tds = mod.datastore\n\n\t\tdlog(\"Reloading module #{refname}...\", 'core')\n\n\t\t# Set the target file\n\t\tfile = mod.file_path\n\t\twrap = ::Module.new\n\n\t\t# Load the module into a new Module wrapper\n\t\tbegin\n\t\t\twrap.module_eval(File.read(file, File.size(file)))\n\t\t\tif(wrap.const_defined?(:RequiredVersions))\n\t\t\t\tmins = wrap.const_get(:RequiredVersions)\n\t\t\t\tif( mins[0] > ::Msf::Framework::VersionCore or \n\t\t\t\t mins[1] > ::Msf::Framework::VersionAPI\n\t\t\t\t )\n\t\t\t\t\terrmsg = \"Failed to load module from #{file} due to version check (requires Core:#{mins[0]} API:#{mins[1]})\"\n\t\t\t\t\telog(errmsg)\n\t\t\t\t\tself.module_failed[mod.file_path] = errmsg\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\t\t\t\t\n\t\trescue ::Exception => e\n\t\t\n\t\t\t# Hide eval errors when the module version is not compatible\n\t\t\tif(wrap.const_defined?(:RequiredVersions))\n\t\t\t\tmins = wrap.const_get(:RequiredVersions)\n\t\t\t\tif( mins[0] > ::Msf::Framework::VersionCore or \n\t\t\t\t mins[1] > ::Msf::Framework::VersionAPI\n\t\t\t\t )\n\t\t\t\t\terrmsg = \"Failed to reload module from #{file} due to version check (requires Core:#{mins[0]} API:#{mins[1]})\"\n\t\t\t\t\telog(errmsg)\n\t\t\t\t\tself.module_failed[mod.file_path] = errmsg\n\t\t\t\t\treturn\n\t\t\t\tend \n\t\t\tend\n\t\t\n\t\t\terrmsg = \"Failed to reload module from #{file}: #{e.class} #{e}\"\n\t\t\telog(errmsg)\n\t\t\tself.module_failed[mod.file_path] = errmsg\n\t\t\treturn\n\t\tend\n\n\t\tif(not wrap.const_defined?('Metasploit3'))\n\t\t\terrmsg = \"Reloaded file did not contain a valid module (#{file}).\"\n\t\t\telog(errmsg)\n\t\t\tself.module_failed[mod.file_path] = errmsg\n\t\t\treturn nil\n\t\tend\n\n\t\tadded = wrap.const_get('Metasploit3')\n\n\n\t\tself.module_failed.delete(mod.file_path)\n\n\n\t\t# Remove the original reference to this module\n\t\tself.delete(mod.refname)\n\n\t\t# Indicate that the module is being loaded again so that any necessary\n\t\t# steps can be taken to extend it properly.\n\t\ton_module_load(added, mod.type, refname, {\n\t\t\t'files' => [ mod.file_path ],\n\t\t\t'noup' => true})\n\n\t\t# Create a new instance of the module\n\t\tif (mod = create(refname))\n\t\t\tmod.datastore.update(ds)\n\t\telse\n\t\t\telog(\"Failed to create instance of #{refname} after reload.\", 'core')\n\t\tend\n\n\t\t# Let the specific module sets have an opportunity to handle the fact\n\t\t# that this module was reloaded. For instance, the payload module set\n\t\t# will need to flush the blob cache entry associated with this module\n\t\tmodule_sets[mod.type].on_module_reload(mod)\n\n\t\tmod\n\tend", "def post_soft_load(mod); end", "def importMib( mib, path )\n puts \"Copying MIB from MIBS/#{mib} to #{path} ...\"\n FileUtils.cp_r(\"MIBS/#{mib}\", path)\n puts \"Importing MIB: #{mib} ...\"\n SNMP::MIB.import_module(\"MIBS/#{mib}\")\nend", "def pre_soft_load(mod); end", "def load_module_from_file(path, file, loaded, recalc, counts, demand = false)\n\t\n\t\t# If the file on disk hasn't changed with what we have stored in the\n\t\t# cache, then there's no sense in loading it\n\t\tif (!has_module_file_changed?(file))\n\t\t\tdlog(\"Cached module from file #{file} has not changed.\", 'core', LEV_2)\n\t\t\treturn false\n\t\tend\n\n\t\t# Substitute the base path\n\t\tpath_base = file.sub(path + File::SEPARATOR, '')\n\n\t\t# Derive the name from the path with the exclusion of the .rb\n\t\tname = path_base.match(/^(.+?)#{File::SEPARATOR}(.*)(.rb?)$/)[2]\n\n\t\t# Chop off the file name\n\t\tpath_base.sub!(/(.+)(#{File::SEPARATOR}.+)(.rb?)$/, '\\1')\n\n\t\tif (m = path_base.match(/^(.+?)#{File::SEPARATOR}+?/)) \n\t\t\ttype = m[1]\n\t\telse\n\t\t\ttype = path_base\n\t\tend\n\t\t\n\t\ttype.sub!(/s$/, '')\n\n\t\t\n\t\tadded = nil\n\t\t\n\t\tbegin\n\t\t\twrap = ::Module.new\n\t\t\twrap.module_eval(File.read(file, File.size(file)))\n\t\t\tif(wrap.const_defined?(:RequiredVersions))\n\t\t\t\tmins = wrap.const_get(:RequiredVersions)\n\t\t\t\tif( mins[0] > ::Msf::Framework::VersionCore or \n\t\t\t\t mins[1] > ::Msf::Framework::VersionAPI\n\t\t\t\t )\n\t\t\t\t\terrmsg = \"Failed to load module from #{file} due to version check (requires Core:#{mins[0]} API:#{mins[1]})\"\n\t\t\t\t\telog(errmsg)\n\t\t\t\t\tself.module_failed[file] = errmsg\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\t\t\n\t\trescue ::Interrupt\n\t\t\traise $!\n\t\trescue ::Exception => e\n\t\t\t# Hide eval errors when the module version is not compatible\n\t\t\tif(wrap.const_defined?(:RequiredVersions))\n\t\t\t\tmins = wrap.const_get(:RequiredVersions)\n\t\t\t\tif( mins[0] > ::Msf::Framework::VersionCore or \n\t\t\t\t mins[1] > ::Msf::Framework::VersionAPI\n\t\t\t\t )\n\t\t\t\t\terrmsg = \"Failed to load module from #{file} due to error and failed version check (requires Core:#{mins[0]} API:#{mins[1]})\"\n\t\t\t\t\telog(errmsg)\n\t\t\t\t\tself.module_failed[file] = errmsg\n\t\t\t\t\treturn false\n\t\t\t\tend \n\t\t\tend\n\t\t\terrmsg = \"#{e.class} #{e}\"\n\t\t\tself.module_failed[file] = errmsg\n\t\t\telog(errmsg)\n\t\t\treturn false\n\t\tend\n\n\t\tif(not wrap.const_defined?('Metasploit3'))\n\t\t\terrmsg = \"Missing Metasploit3 constant\"\n\t\t\tself.module_failed[file] = errmsg\n\t\t\telog(errmsg)\n\t\t\treturn false\n\t\tend\n\t\tadded = wrap.const_get('Metasploit3')\n\n\t\t# If the module indicates that it is not usable on this system, then we \n\t\t# will not try to use it.\n\t\tusable = false\n\n\t\tbegin\n\t\t\tusable = respond_to?(:is_usable) ? added.is_usable : true\n\t\trescue\n\t\t\telog(\"Exception caught during is_usable check: #{$!}\")\n\t\tend\n\t\t\t\n\t\t# Synchronize the modification time for this file.\n\t\tupdate_module_cache_info(nil, added, {\n\t\t\t'paths' => [ path ],\n\t\t\t'files' => [ file ],\n\t\t\t'type' => type}) if (!using_cache)\t\n\n\t\tif (usable == false)\n\t\t\tilog(\"Skipping module in #{file} because is_usable returned false.\", 'core', LEV_1)\n\t\t\treturn false\n\t\tend\n\n\t\tilog(\"Loaded #{type} module #{added} from #{file}.\", 'core', LEV_2)\n\t\tself.module_failed.delete(file)\n\t\t\n\t\t# Do some processing on the loaded module to get it into the\n\t\t# right associations\n\t\ton_module_load(added, type, name, {\n\t\t\t'files' => [ file ],\n\t\t\t'paths' => [ path ],\n\t\t\t'type' => type })\n\n\t\t# Set this module type as needing recalculation\n\t\trecalc[type] = true if (recalc)\n\n\t\t# Append the added module to the hash of file->module\n\t\tloaded[file] = added if (loaded)\n\t\n\t\t# Track module load history for future reference\n\t\tmodule_history[file] = added\n\t\tmodule_history_mtime[file] = File::Stat.new(file).mtime.to_i\n\n\t\t# The number of loaded modules this round\n\t\tif (counts)\n\t\t\tcounts[type] = (counts[type]) ? (counts[type] + 1) : 1\n\t\tend\n\n\t\treturn true\n\tend", "def on_module_load(mod, type, name, modinfo)\n\t\t# Payload modules require custom loading as the individual files\n\t\t# may not directly contain a logical payload that a user would \n\t\t# reference, such as would be the case with a payload stager or \n\t\t# stage. As such, when payload modules are loaded they are handed\n\t\t# off to a special payload set. The payload set, in turn, will\n\t\t# automatically create all the permutations after all the payload\n\t\t# modules have been loaded.\n\t\tif (type != MODULE_PAYLOAD)\n\t\t\t# Add the module class to the list of modules and add it to the\n\t\t\t# type separated set of module classes\n\t\t\tadd_module(mod, name, modinfo)\n\t\tend\n\n\t\tmodule_sets[type].add_module(mod, name, modinfo)\n\tend", "def on_module_reload(mod)\n end", "def load_from_path path, options = {}\n path.sub! /.(gene|gmod)$/, ''\n module_id = @path_to_module_mappings[path]\n if module_id\n return @module_mappings[module_id]\n end\n\n mod_file = \"#{path}.gmod\"\n if File.exist? mod_file\n mod = Gene::Lang::Jit::CompiledModule.from_json File.read(mod_file)\n else\n gene_file = \"#{path}.gene\"\n parsed = Gene::Parser.parse File.read(gene_file)\n compiler = Gene::Lang::Jit::Compiler.new\n mod = compiler.compile parsed, options\n end\n\n @module_mappings[mod.id] = mod\n @path_to_module_mappings[path] = mod.id\n add_blocks_from_module mod\n\n mod\n end", "def add_mib_path(path)\n dic_files = if ::File.directory?(path)\n Dir[::File.join(path, \"*.dic\")]\n elsif ::File.file?(path)\n [path]\n else\n raise(SnmpMibError, \"file or directory path expected: #{path.to_s}\")\n end\n\n dic_files.each do |f|\n module_name, nodes = read_mib_dic(f)\n nodes.each do |k, v|\n @tree.add_node(Node.new(v[\"nodetype\"], k, v[\"moduleName\"], v[\"oid\"]))\n end\n end\n end", "def on_module_reload(mod)\n\tend", "def load_modules\n @log.info \"Loading modules...\"\n\n modules.each do |mod|\n require mod[:file]\n klass = eval(mod[:class_name])\n\n self.on_command klass.main_command do |command, from|\n self.send_message from, klass.exec_command(command)\n end\n end\n end", "def add(modName,privMsg=false)\n begin\n if @dir.find{|file| file.sub!(/\\.rb$/,\"\"); file == modName} \t\n load \"./lib/modules/#{modName}.rb\"\n klass = \"linael/modules/#{modName}\".camelize.constantize\n if (has_key?(klass::Name))\n answer(privMsg,\"Module already loaded, please unload first\")\n else\n if (klass.require_auth && @authModule.empty?)\n answer(privMsg,\"You need at least one authMethod to load this module\") \n else\n if matchRequirement?(klass.required_mod)\n mod = Modules::ModuleType.new(@runner,klass: klass,privMsg: privMsg)\n addMod(mod)\n @authModule << klass::Name if klass::auth?\n answer(privMsg,\"Module #{modName} loaded!\")\n else\n answer(privMsg,\"You do not have loaded all the modules required for this module.\") \n answer(privMsg,\"Here is the list of requirement: #{klass.required_mod.join(\" - \")}.\") \n end\n end\n end\n end\n rescue Exception\n puts $!\n answer(privMsg,\"Problem when loading the module\") \n talk(privMsg.who,$!) \n end\n end", "def force_load_set\n\t\teach_module { |name, mod|\n\t\t}\n\tend", "def load(module_)\n module_extensions(module_).each do |path|\n load_extension_file(module_, path)\n end\n end", "def load_from(m, *args, &blk)\n return if :nothing == m\n meth = \"load_from_#{m}\".to_sym\n if private_methods.include?(meth) or respond_to?(meth)\n send meth, *args, &blk \n else\n raise NoMethodError, \"#{m} is not a proper loader\"\n end\n end", "def load( reload = false, recursive = false )\n\t\t\t\tputs ( \"[Module] #{fullName()}\" ) if ( ( defined? $LoaderModule ) && $LoaderModule.getVar( \"Verbose\" ) >= Kesh::Loader::VERBOSE_MODULE )\n\t\t\t\tloadFiles( reload )\n\t\t\t\tloadClasses( reload )\n\t\t\t\tloadChildModules( reload, recursive ) if recursive\n\t\t\tend", "def add_module(mod, name, file_paths)\n\t\t# Call the module set implementation of add_module\n\t\tdup = super\n\n\t\t# If the module cache is not being used, update the cache with\n\t\t# information about the files that are associated with this module.\n\t\tif (!using_cache)\n\t\t\tupdate_module_cache_info(dup.fullname, mod, file_paths)\n\t\tend\n\n\t\t# Automatically subscribe a wrapper around this module to the necessary\n\t\t# event providers based on whatever events it wishes to receive. We\n\t\t# only do this if we are the module manager instance, as individual\n\t\t# module sets need not subscribe.\n\t\tauto_subscribe_module(dup)\n\n\t\t# Notify the framework that a module was loaded\n\t\tframework.events.on_module_load(name, dup)\n\tend", "def cache_module(mod)\n\t\t@modcache[mod.type][mod.refname] = 1\n\tend", "def set_mod\n @mod = Mod.find(params[:id])\n end", "def reload\n Dir.glob(\"lib/**/*.rb\").each { |file|\n load file\n }\nend", "def set_mod\n @mod = Mod.find(params[:id])\n end", "def AddModuleToLoad(name)\n Builtins.y2milestone(\"Adding module to be loaded at boot: %1\", name)\n @kernel_modules_to_load = Builtins.add(\n @kernel_modules_to_load,\n { \"operation\" => \"add\", \"name\" => name }\n )\n\n nil\n end", "def load_recipes\n BRIX11.log(3, '[%s] loading recipes', self)\n begin\n instance_eval(File.read(full_path), full_path)\n rescue\n BRIX11.log_error($!.message)\n $!.backtrace.find do |bt|\n file, line, _ = bt.split(':')\n if file == full_path\n BRIX11.show_msg(\"\\t#{file}:#{line}\")\n true\n else\n false\n end\n end\n BRIX11.log_fatal(\"[#{self}] failed to load recipes\")\n end\n end", "def load_modules(bpath, demand = false)\n\t\tloaded = {}\n\t\trecalc = {}\n\t\tcounts = {}\n\t\tdelay = {}\n\t\tks = true\n\t\t\n\t\tdbase = Dir.new(bpath)\n\t\tdbase.entries.each do |ent|\n\t\t\tnext if ent.downcase == '.svn'\n\t\t\t\n\t\t\tpath = File.join(bpath, ent)\n\t\t\tmtype = ent.gsub(/s$/, '')\n\n\t\t\tnext if not File.directory?(path)\n\t\t\tnext if not MODULE_TYPES.include?(mtype)\n\t\t\tnext if not enabled_types[mtype]\n\n\t\t\t# Try to load modules from all the files in the supplied path\n\t\t\tRex::Find.find(path) do |file|\n\n\t\t\t\t# Skip non-ruby files\n\t\t\t\tnext if file[-3,3] != \".rb\"\n\n\t\t\t\t# Skip unit test files\n\t\t\t\tnext if (file =~ /rb\\.(ut|ts)\\.rb$/)\n\n\t\t\t\t# Skip files with a leading period\n\t\t\t\tnext if file[0,1] ==\".\"\n\n\t\t\t\tload_module_from_file(bpath, file, loaded, recalc, counts, demand)\n\t\t\tend\n\t\tend\n\n\t\t# Perform any required recalculations for the individual module types\n\t\t# that actually had load changes\n\t\trecalc.each_key { |key|\n\t\t\tmodule_sets[key].recalculate\n\t\t}\n\n\t\t# Return per-module loaded counts\n\t\treturn counts\n\tend", "def force_load_set\n each_module { |name, mod| }\n end", "def reload_builder path\n load __FILE__\n end", "def reload!\n # Change 'my_gem' here too:\n files = $LOADED_FEATURES.select { |feat| feat =~ /\\/nails\\// }\n files.each { |file| \n puts file\n load file }\n end", "def set_module_cache_file(file_path)\n\t\t@modcache_file = file_path\n\t\t@modcache = Rex::Parser::Ini.new\n\n\t\tbegin\n\t\t\t@modcache.from_file(@modcache_file)\n\t\trescue Errno::ENOENT\n\t\t\t@modcache_invalidated = true\n\t\tend\n\n\t\t# Initialize the standard groups\n\t\t@modcache.add_group('FileModificationTimes', false)\n\t\t@modcache.add_group('ModuleTypeCounts', false)\n\n\t\tMODULE_TYPES.each { |type|\n\t\t\t@modcache.add_group(type, false)\n\n\t\t\t@modcache[type].each_key { |name|\n\t\t\t\tnext if not @modcache[type]\n\t\t\t\tnext if not module_sets[type]\n\t\t\t\t\n\t\t\t\tfullname = type + '/' + name\n\n\t\t\t\t# Make sure the files associated with this module exist. If it\n\t\t\t\t# doesn't, then we don't create a symbolic module for it. This is\n\t\t\t\t# to ensure that module counts are accurately reflected after a\n\t\t\t\t# module is removed or moved.\n\t\t\t\tnext if (@modcache.group?(fullname) == false)\n\t\t\t\tnext if (@modcache[fullname]['FileNames'].nil?)\n\n\t\t\t\tbegin\n\t\t\t\t\t@modcache[fullname]['FileNames'].split(',').each { |f|\n\t\t\t\t\t\tFile::Stat.new(f)\n\t\t\t\t\t}\n\t\t\t\trescue Errno::ENOENT\n\t\t\t\t\tdlog(\"File requirement does not exist for #{fullname}\", 'core', \n\t\t\t\t\t\tLEV_1);\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tmodule_sets[type][name] = SymbolicModule\n\t\t\t}\n\t\t}\n\t\t\n\t\tif !(@modcache['ModuleTypeCounts'] and @modcache['ModuleTypeCounts'].keys.length > 0)\n\t\t\t@modcache_invalidated = true\n\t\tend\n\t\t\t\t\t\t\n\tend", "def load_minimal_gems\r\n end", "def loadFile(filename)\n\t\t\tdescname = filename.basename.sub_ext(\"\").to_s + \"Desc\"\n\t\t\tif(!@loaded.include?(descname))\n\t\t\t\t@loaded << descname\n\n\t\t\t\tfilename = filename.to_s\n\t\t\t\tlast = $mec_mgr\n\n\t\t\t\t$mec_mgr = self\n\t\t\t\trequire(filename)\n\t\t\t\t$mec_mgr = last\n\t\t\t\t\n\t\t\t\tdesc = begin\n\t\t\t\t\tMakeRbExt.const_get(descname)\n\t\t\t\trescue NameError\n\t\t\t\t\traise(\"File `#{filename}' should contain a ruby module `#{descname}', but doesn't\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tdesc.register(@settings)\n\t\t\tend\n\t\tend", "def SaveModulesToLoad\n # if nothing changed, just return success\n return true if Builtins.size(@kernel_modules_to_load) == 0\n\n # first read current status\n modules_to_load_str = Convert.to_string(\n SCR.Read(path(\".sysconfig.kernel.MODULES_LOADED_ON_BOOT\"))\n )\n modules_to_load_str = \"\" if modules_to_load_str == nil\n modules_to_load = Builtins.splitstring(modules_to_load_str, \" \")\n modules_to_load = Builtins.filter(modules_to_load) { |s| s != \"\" }\n Builtins.y2milestone(\n \"Read modules to be loaded at boot: %1\",\n modules_to_load\n )\n\n # apply operations on the list\n Builtins.foreach(@kernel_modules_to_load) do |op_desc|\n op = Ops.get(op_desc, \"operation\", \"\")\n name = Ops.get(op_desc, \"name\", \"\")\n if op == \"remove\"\n modules_to_load = Builtins.filter(modules_to_load) { |m| m != name }\n elsif op == \"add\"\n if !Builtins.contains(modules_to_load, name)\n modules_to_load = Builtins.add(modules_to_load, name)\n end\n end\n end\n\n # and sabe the list\n Builtins.y2milestone(\n \"Saving modules to be loaded at boot: %1\",\n modules_to_load\n )\n modules_to_load_str = Builtins.mergestring(modules_to_load, \" \")\n SCR.Write(\n path(\".sysconfig.kernel.MODULES_LOADED_ON_BOOT\"),\n modules_to_load_str\n )\n SCR.Write(path(\".sysconfig.kernel\"), nil)\n end", "def read_mib_dic(filename)\n mib = eval_mib_dic(filename)\n\n raise(SnmpMibError, \"invalid mib dic format for file #{filename}\") unless mib\n module_name = mib[\"moduleName\"]\n\n raise(SnmpMibError, \"invalid mib dic format for file #{filename}\") unless module_name\n nodes = mib[\"nodes\"] || []\n\n if nodes.empty?\n logger.warn(\"no nodes defined in mib dic file #{filename}\")\n end\n\n [module_name, nodes]\n end", "def update_module_cache_info(fullname, mod, modinfo)\n\t\treturn if (modinfo and modinfo['noup'] == true)\n\t\t\n\t\tif (@modcache)\n\t\t\tif (fullname)\n\t\t\t\t@modcache.add_group(fullname)\n\t\t\t\t@modcache[fullname].clear\n\t\t\t\t@modcache[fullname]['FileNames'] = modinfo['files'].join(',') \n\t\t\t\t@modcache[fullname]['FilePaths'] = modinfo['paths'].join(',') \n\t\t\t\t@modcache[fullname]['Type'] = modinfo['type']\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t# Deep cache classes (ignore payloads)\n\t\t\t\t# if(mod.class == ::Class and mod.cached?)\n\t\t\t\t# \t@modcache[fullname]['CacheData'] = [Marshal.dump(mod.infos)].pack(\"m\").gsub(/\\s+/, '')\n\t\t\t\t# end\n\t\t\t\t\n\t\t\tend\n\n\t\t\tmodinfo['files'].each do |f|\n\t\t\t\tbegin\n\t\t\t\t\t@modcache['FileModificationTimes'][f] = File::Stat.new(f).mtime.to_i.to_s\n\t\t\t\trescue Errno::ENOENT\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def initialize\n @@availableModules = Array.new\n @@cleanAvailableModules = Array.new \n @@availableModules = `ls | grep Module`\n @@availableModules.each do |m|\n #removes \"Module.rb\" from availableModules array and put new values in clean array\n @@cleanAvailableModules.push(m.chomp.gsub(/Module.rb/,\"\").downcase)\n #removes empty values\n @@cleanAvailableModules.reject! {|e| e.empty?}\n end\n #import all mods\n end", "def load!\n # TODO Don't load a module that's already loaded\n\n # Load the main file\n fname = path(\"#{name}.rb\")\n require fname unless fname.nil?\n\n # Load the basic things usually autoloaded.\n Dir[\"#{@path}/{init,models,routes,helpers}/*.rb\"].each { |f| require f }\n\n # Ensure public/ works\n public_path = path(:public)\n Main.add_public(public_path) unless public_path.nil?\n\n # Add the view path, if it has\n if path(:views)\n paths = [path(:views)]\n paths += Main.multi_views if Main.respond_to?(:multi_views)\n Main.set :multi_views, paths\n end\n end", "def load(path)\n gem = options['gem']\n name = options['name']\n real_path = File.realpath(path)\n\n if (gem.nil? && !name.nil?) || (!gem.nil? && name.nil?)\n raise ArgumentError,\n \"--gem and --name MUST be set together\"\n end\n\n include_load_paths(options.fetch('include'))\n require_libraries(options.fetch('require'))\n\n tagged_logger = self.class.tagged_logger(options.fetch('logger_severity'))\n configure_i18n\n ActiveRecord::Base.logger = tagged_logger\n\n establish_connection(\n database_yaml_path: options.fetch('database_yaml'),\n environment: options.fetch('environment')\n )\n\n load_seeds\n\n module_path = Metasploit::Cache::Module::Path.resolve_collisions(\n gem: gem,\n name: name,\n real_path: real_path\n )\n\n type_directories = filtered_type_directories\n metasploit_framework = metasploit_framework_double\n\n status = 0\n\n if options.fetch('concurrent')\n threads = type_directories.map { |type_directory|\n # self must be passed first so load_type_directory is bound to it\n Thread.new self,\n module_path,\n type_directory,\n assume_changed: options.fetch('assume_changed'),\n metasploit_framework: metasploit_framework,\n logger: tagged_logger,\n &:load_type_directory\n }\n\n threads.each do |thread|\n begin\n thread.join\n rescue Exception => exception\n tagged_logger.error(exception)\n status = 1\n end\n end\n else\n type_directories.each do |type_directory|\n begin\n load_type_directory(\n module_path,\n type_directory,\n assume_changed: options.fetch('assume_changed'),\n metasploit_framework: metasploit_framework,\n logger: tagged_logger,\n )\n rescue Exception => exception\n tagged_logger.error(exception)\n status = 1\n end\n end\n end\n\n if options.fetch('staged_payloads')\n load_staged_payloads(\n logger: tagged_logger,\n metasploit_framework: metasploit_framework\n )\n end\n\n exit(status)\n end", "def load\n end", "def cold_load!\n components_pattern = File.join(@directory, '**', '*' + @suffix)\n info \"Cold loading: #{components_pattern}\"\n Dir.glob(components_pattern).each { |file| reload! file }\n end", "def load(name)\n\t\t\tfiles = []\n\t\t\t@dirpaths.each { |dp|\n\t\t\t\tif(dp.directory?)\n\t\t\t\t\tdp.opendir { |dir|\n\t\t\t\t\t\tdir.each { |f|\n\t\t\t\t\t\t\tif (f != \".\" && f != \"..\" && File.extname(f).downcase == \".rb\" && f[0...name.length] == name)\n\t\t\t\t\t\t\t\tfiles << dp + f\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t}\n\t\t\tif(files.empty?)\n\t\t\t\traise \"No suitable MEC file for \\\"#{name}\\\" found!\"\n\t\t\tend\n\t\t\tfiles.each { |file|\n\t\t\t\tloadFile(file)\n\t\t\t}\n\t\tend", "def load; end", "def load; end", "def load; end", "def load_control\n loaded = false\n Dir.entries(\".\").each do |entry|\n begin\n next if entry =~ /rocket|constants/ || entry !~ /\\.rb/\n if last_modified(entry) > $load_time.to_i\n Kernel::load(entry)\n log_string \"Loaded #{entry}\"\n loaded = true\n end\n rescue\n log_string \"Unable to load #{entry}\"\n log_string $!.to_s\n end\n end\n if loaded\n $load_time = Time.now\n end\nend", "def loadExt(*names)\n\t\tnames.each { |name|\n\t\t\t@buildMgr.mec.load(name)\n\t\t}\n\tend", "def load(*args)\n args.each do |thing|\n key = File.basename(thing.to_s).sub('.rb', '')\n if(thing.is_a?(String))\n components[key] = self.class.load_component(thing)\n else\n components[key] = sparkle.get(:component, thing)[:block]\n end\n @load_order << key\n end\n self\n end", "def load(path); end", "def get_mod\n @mod = Mod.find(params[:id])\n end", "def load!; end", "def load_game(i)\n sys('load')\n File.open(filename(i), \"rb\") do |file|\n Marshal.load(file)\n extract_save_contents(Marshal.load(file))\n $game.reload\n @index = i\n end\n return true\n end", "def demand_load_modules\n # Pre-scan the module list for any symbolic modules\n self.each_pair { |name, mod|\n if (mod == Msf::SymbolicModule)\n self.postpone_recalculate = true\n\n mod = create(name)\n\n next if (mod.nil?)\n end\n }\n\n # If we found any symbolic modules, then recalculate.\n if (self.postpone_recalculate)\n self.postpone_recalculate = false\n\n recalculate\n end\n end", "def load_source_and_set_module; end", "def load(name); end", "def load_module(m)\n load_template(\"http://github.com/meskyanichi/rails-templates/raw/master/modules/#{m}.rb\")\nend", "def reload_source_and_set_module\n raise LoaderError, \"Reload not implemented\"\n end", "def reload\n load __FILE__\nend", "def load_block(path, options = {})\n options[:path] = path\n Origen::Loader.load_block(self, options)\n end", "def depends_on(mod)\n @log.info \"Loading module '#{mod}' as a dependency\"\n loaded = require \"#{File.dirname(__FILE__)}/modules/#{mod.to_s}.rb\"\n @log.info \"Module '#{mod}' already loaded, not re-loading\" if !loaded\nend", "def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend", "def reload!\n load_all './lib'\nend", "def cmd_load(*args)\n if args.length.zero?\n args.unshift(\"-h\")\n end\n\n @@load_opts.parse(args) { |opt, idx, val|\n case opt\n when '-h'\n cmd_load_help\n return true\n end\n }\n\n # Load each of the modules\n args.each { |m|\n md = m.downcase\n\n if extensions.include?(md)\n print_error(\"The '#{md}' extension has already been loaded.\")\n next\n end\n\n print(\"Loading extension #{md}...\")\n\n begin\n # Use the remote side, then load the client-side\n #if (client.core.use(md) == true)\n client.add_extension(md) # NOTE: Doesn't work, going to use core instead\n add_extension_client(md)\n #end\n rescue\n print_line\n log_error(\"Failed to load extension: #{$!}\")\n next\n end\n\n print_line(\"success.\")\n }\n\n return true\n end", "def load_current\n Dir.glob(current(\"*.rb\")) do |rb_file|\n require rb_file\n puts \"required #{File.basename(rb_file)}\"\n end\nend", "def load_module(module_file_name)\n begin\n # If dynamic loading fails for module name created with facility name, it moves to the rescue block\n p \"Trying to load module name created based on facility name\"\n load module_file_name rescue nil\n facility.name\n rescue Exception => e\n # If dynamic loading fails for module name created with facility name, the module name is created with client name\n if @client == \"ORBOGRAPH\" or @client == \"ORB TEST FACILITY\"\n translation_module_file_name = File.dirname(__FILE__) + \"/templates/\" + facility.client.name.downcase.gsub(' ','_') + \"_#{@module_name}_template_variable_translations.rb\"\n else\n translation_module_file_name = File.dirname(__FILE__) + \"/templates/\" + facility.client.name.downcase.gsub(' ','_') + \"_template_variable_translations.rb\"\n end\n \n p \"Trying to load module name created based on client name\"\n load translation_module_file_name\n facility.client.name\n end\n end", "def reload\n begin_reset_model\n @id_to_module = []\n @filtered_out_modules = Set.new\n \n info = discover_module(Object)\n info.id = id_to_module.size\n info.name = title\n update_module_type_info(info)\n info.row = 0\n id_to_module << info\n\n @object_paths = Hash.new\n generate_paths(object_paths, info, \"\")\n ensure\n end_reset_model\n end", "def load_file(path)\n send_cmd(\"load #{path}\")\n end", "def load\n end", "def load\n end", "def _load(path)\n path = Pathname.new(path)\n @loader.load(path)\n end", "def lsmod( modules )\n print_line\n print_line\n print_info 'Available modules:'\n print_line\n\n modules.each do |info|\n print_status \"#{info[:mod_name]}:\"\n print_line '--------------------'\n\n print_line \"Name:\\t\\t#{info[:name]}\"\n print_line \"Description:\\t#{info[:description]}\"\n\n if info[:issue] && (severity = info[:issue][:severity])\n print_line \"Severity:\\t#{severity}\"\n end\n\n if info[:elements] && info[:elements].size > 0\n print_line \"Elements:\\t#{info[:elements].join( ', ' ).downcase}\"\n end\n\n print_line \"Author:\\t\\t#{info[:author].join( \", \" )}\"\n print_line \"Version:\\t#{info[:version]}\"\n\n if info[:references]\n print_line 'References:'\n info[:references].keys.each do |key|\n print_info \"#{key}\\t\\t#{info[:references][key]}\"\n end\n end\n\n if info[:targets]\n print_line 'Targets:'\n\n if info[:targets].is_a?( Hash )\n info[:targets].keys.each do |key|\n print_info \"#{key}\\t\\t#{info[:targets][key]}\"\n end\n else\n info[:targets].each { |target| print_info( target ) }\n end\n end\n\n if info[:issue] && sploit = info[:issue][:metasploitable]\n print_line \"Metasploitable:\\t#{sploit}\"\n end\n\n print_line \"Path:\\t#{info[:path]}\"\n\n print_line\n end\n\n end", "def mod\n @mod \n end", "def _load_trivial(&block)\n dirs = @all_archs.map { |arch| URI.join(@uri, @suite.gsub(/\\$\\(ARCH\\)/, arch)) }.uniq\n c = Collector.new\n c.run_each(dirs) do |dir|\n file = signed_download(URI.join(dir, 'Release'), URI.join(dir, 'Release.gpg'))\n\n release = DebParseRelease.new(@app, dir, file)\n\n pinfo = release.download('Packages')\n\n parser = DebPackagesParser.new(@app, dir, pinfo)\n block.call(parser)\n end\n c.wait_throw\n end", "def in_submodule &block\n unless File.exists?(module_path) then\n raise IOError.new(\"Submodule '#{self}' with path '#{module_path}' does not exist\")\n end\n begin\n Dir.chdir module_path\n block.call\n ensure\n Dir.chdir cfg.root\n end\n end", "def reload(filename = nil)\n warn = $VERBOSE\n $VERBOSE = nil\n files = Dir.glob('lib/seamless_cloning/**/*.rb')\n if filename\n file = files.find do |f|\n filename == File.basename(f)\n end\n load(file)\n else\n files.each { |f| load(f) }\n end\n nil\nensure\n $VERBOSE = warn\n true\nend", "def load\n sleeper = 0.0\n while File.exist? lock_file\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n # :symbolize_names does not play nicely with :create_additions\n tmp = JSON.parse(File.read(path),\n {:symbolize_names=>false, :create_additions=>true})\n @data = {}\n tmp.each_pair{ |k,v| self[k] = v }\n end", "def load(*args)\n args.each do |thing|\n if(thing.is_a?(Symbol))\n path = File.join(components_directory, \"#{thing}.rb\")\n else\n path = thing\n end\n key = File.basename(path).sub('.rb', '')\n components[key] = self.class.load_component(path)\n @load_order << key\n end\n self\n end", "def reload(slice_module)\n if slice = self[slice_module]\n deactivate slice.name\n activate_by_file slice.file\n end\n end", "def method_missing(meth, *args, &block)\n if !loaded?\n self.loaded = true\n reload\n self.send(meth, *args, &block)\n else\n super\n end\n end", "def load\r\n \r\n end", "def load\n end", "def load\n end", "def load\n end", "def load!(path)\n comp_name = ComponentWrap.guess_component_name(path, @suffix)\n info \"Loading: #{comp_name} from #{path}\"\n\n begin\n load path\n rescue SyntaxError => e\n error \"Syntax error in #{comp_name}: #{e}\"\n return\n end\n component_wrap = ComponentWrap.from_path(self, path)\n\n if component_wrap\n @loaded_components.push component_wrap\n @bot.include! component_wrap.raw_component\n elsif path.end_with? @suffix\n error \"Can't load: #{path}: it does not define `module #{comp_name}`\"\n else\n error \"Can't load: #{path}: it is not a component file (*#{@suffix})\"\n end\n end", "def mod(name)\n master.module_instance name\n end", "def demand_load_modules\n\t\t# Pre-scan the module list for any symbolic modules\n\t\tself.each_pair { |name, mod|\n\t\t\tif (mod == SymbolicModule)\n\t\t\t\tself.postpone_recalc = true\n\n\t\t\t\tmod = create(name)\n\n\t\t\t\tnext if (mod.nil?)\n\t\t\tend\n\t\t}\n\n\t\t# If we found any symbolic modules, then recalculate.\n\t\tif (self.postpone_recalc)\n\t\t\tself.postpone_recalc = false\n\n\t\t\trecalculate\n\t\tend\n\tend", "def reload \n load 'core/decision_tree.rb'\n load 'core/knn.rb'\n load 'core/perceptron.rb'\n load 'tools.rb'\n load 'examples/gender.rb'\n load 'examples/knn_test.rb'\nend", "def load_interface(interface)\n # This require will only run once. If we repeat it, it is not\n # loaded again\n require \"virtualbox/com/interface/#{@__version}/#{interface}\"\n\n # Find the module based on the version and name and return it\n Object.module_eval(\"::VirtualBox::COM::Interface::#{version_const}::#{interface}\")\n end", "def mod=(m)\n\t\tself.driver.active_module = m\n\tend", "def test_load_lua_module_base_path\n lua_modules = File.join(BUILDDIR, \"lua_modules\")\n FileUtils.mkdir_p(lua_modules)\n File.open(File.join(lua_modules, \"module.lua\"), 'w') do |io|\n io.write <<-EOS\n m = ...\n return 0\n EOS\n end\n\n clipp(\n modules: ['lua'],\n config: \"\"\"\n LuaModuleBasePath #{lua_modules}\n LuaLoadModule module.lua\n \"\"\",\n ) do\n transaction do |t|\n t.request(\n method: \"GET\",\n uri: \"/\",\n protocol: \"HTTP/1.1\",\n headers: {\"Host\" => \"foo.bar\"}\n )\n end\n end\n assert_no_issues\n end", "def test_it_loads_user_modules\n sm = StateMachine.new\n sm.include_module('TestModule')\n assert_equal(sm.test_method, 'Test String')\n end", "def load_all; end", "def load_all; end", "def load_all; end", "def load\n instance_eval File.read(@path).tap(&Gem::UNTAINT), @path, 1\n\n self\n end", "def add_module_by_normal_module(mod)\n add_class_or_module mod, @modules, @store.modules_hash\n end", "def loaded_from= path\n @loaded_from = path && path.to_s\n\n @full_gem_path = nil\n @gems_dir = nil\n @base_dir = nil\n end", "def with_reloading &block\n Cove::Ext.use_reload\n block.call\n ensure\n Cove::Ext.use_require\n end" ]
[ "0.7247165", "0.6535154", "0.6500938", "0.63160044", "0.63154864", "0.6253659", "0.6235684", "0.60242665", "0.59732884", "0.5677587", "0.5643955", "0.5626259", "0.5529572", "0.55291384", "0.5526095", "0.54911745", "0.5489903", "0.5435723", "0.52894247", "0.5279787", "0.5267904", "0.52620435", "0.5249606", "0.52267706", "0.5209753", "0.5196427", "0.51837665", "0.517932", "0.5178048", "0.51753515", "0.5173439", "0.51691264", "0.51588756", "0.5141869", "0.513518", "0.5130937", "0.51276696", "0.5115518", "0.5111872", "0.5094432", "0.50911367", "0.5087239", "0.50761104", "0.50756395", "0.5075298", "0.5075298", "0.5075298", "0.5061823", "0.50510997", "0.5039938", "0.50354606", "0.5032057", "0.5012", "0.5001887", "0.49956936", "0.4994351", "0.4993953", "0.49932882", "0.49912634", "0.49888977", "0.49788237", "0.49780774", "0.49694535", "0.49691877", "0.4961836", "0.49587414", "0.4954574", "0.49545553", "0.49483818", "0.49467865", "0.49467865", "0.493727", "0.49242142", "0.49083483", "0.49069116", "0.48889068", "0.4888542", "0.48853037", "0.48835438", "0.48826796", "0.48815984", "0.48767763", "0.48699522", "0.48699522", "0.48699522", "0.48472303", "0.48366436", "0.483541", "0.48326", "0.4827238", "0.48179492", "0.4817061", "0.48125342", "0.48037526", "0.48037526", "0.48037526", "0.48029354", "0.47977504", "0.47903973", "0.47884694" ]
0.5642057
11
Reformats the import lists into an hash indexed by module name, to a list of imported names
def load_imports(imports) return unless imports imports = [imports] unless imports.respond_to?(:to_ary) imports.each_with_object({}) do |import, imp| imp[String(import[:name])] = case import[:ids] when Hash [String(import[:ids][:name])] else import[:ids].map { |id| String(id[:name]) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def importer_names\n importers.map{|e| e.const_name }\n end", "def module_names\n @cache[:modules]\n end", "def list_imported(regex=//, mib_dir=DEFAULT_MIB_PATH)\n list = []\n Dir[\"#{mib_dir}/*.#{MODULE_EXT}\"].each do |name|\n module_name = File.basename(name, \".*\")\n list << module_name if module_name =~ regex\n end\n list\n end", "def module_names(set)\n\t\tmodule_sets[set] ? module_sets[set].keys.dup : []\n\tend", "def get_sorted_module_list( classes )\n\t\tnscounts = classes.keys.inject({}) do |counthash, name|\n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\tcounthash[toplevel] ||= 0\n\t\t\tcounthash[toplevel] += 1\n\t\t\t\n\t\t\tcounthash\n\t\tend\n\n\t\t# Sort based on how often the toplevel namespace occurs, and then on the name \n\t\t# of the module -- this works for projects that put their stuff into a \n\t\t# namespace, of course, but doesn't hurt if they don't.\n\t\treturn classes.keys.sort_by do |name| \n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\t[\n\t\t\t\tnscounts[ toplevel ] * -1,\n\t\t\t\tname\n\t\t\t]\n\t\tend\n\tend", "def get_sorted_module_list( classes )\n\t\tnscounts = classes.keys.inject({}) do |counthash, name|\n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\tcounthash[toplevel] ||= 0\n\t\t\tcounthash[toplevel] += 1\n\t\t\t\n\t\t\tcounthash\n\t\tend\n\n\t\t# Sort based on how often the toplevel namespace occurs, and then on the name \n\t\t# of the module -- this works for projects that put their stuff into a \n\t\t# namespace, of course, but doesn't hurt if they don't.\n\t\treturn classes.keys.sort_by do |name| \n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\t[\n\t\t\t\tnscounts[ toplevel ] * -1,\n\t\t\t\tname\n\t\t\t]\n\t\tend\n\tend", "def importsText\n @imps.to_a.map{|k| \"import #{k};\"}.sort.join(\"\\n\")\n end", "def extract_modules(name) #:nodoc:\n modules = name.include?('/') ? name.split('/') : name.split('::')\n name = modules.pop\n path = modules.map { |m| m.underscore }\n\n file_path = (path + [name.underscore]).join('/')\n nesting = modules.map { |m| m.camelize }.join('::')\n\n [name, path, file_path, nesting, modules.size]\n end", "def extract_modules(name)\n modules = name.include?('/') ? name.split('/') : name.split('::')\n name = modules.pop\n path = modules.map { |m| m.underscore }\n file_path = (path + [name.underscore]).join('/')\n nesting = modules.map { |m| m.camelize }.join('::')\n [name, path, file_path, nesting, modules.size]\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def referenced_modules\n # TODO: check content type before scanning\n content.scan(/\\s*(include|extend)\\s+([A-Za-z0-9_\\.]*)/).map { |_, m| m }.uniq\n end", "def imported\n @imported ||= []\n end", "def imported\n @imported ||= []\n end", "def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n ext = File.extname(fn)\n loader = @loaders[ext] || @default_loader\n loader.load(fn)\n @imported << fn\n end\n end", "def get_imports (path)\n imports = []\n puts \"path: #{path}\"\n for line in `otool -L '#{path}'`.split(\"\\n\")\n if line =~ /^\\t(.*)\\s*\\(.*\\)$/\n import = Pathname.new($1.rstrip)\n if import.basename != path.basename\n imports << import\n end\n end\n end\n return imports\nend", "def all_unique_imports\n files.map(&:all_imports).flatten.uniq\n end", "def included_in_modules\n modules = []\n ObjectSpace.each_object(Module) { |k| modules << k if k.included_modules.include?(self) }\n\n modules.reverse.inject([]) do |unique_modules, klass|\n unique_modules << klass unless unique_modules.collect { |k| k.to_s }.include?(klass.to_s)\n unique_modules\n end\n end", "def all_modules\n modules_hash.values\n end", "def module_types\n\t\tmodule_sets.keys.dup\n\tend", "def moduleList()\n res = \"\"\n leader = \" \"\n begin\n Dir.foreach($opdir) do |name|\n next unless name =~ /(.*)\\.rb$/\n require File.join(\"ri/op\", $1)\n klass = eval $1\n modDesc = klass::desc\n res << leader << $1 << \": \" << modDesc << \"\\n\"\n end\n rescue\n puts $!\n res = leader + \"no modules found...\"\n end\n res\nend", "def faker_modules\n FFaker\n .constants\n .reject { |const| UTILS_MODULES.include?(const) }\n .select { |const| FFaker.const_get(const).instance_of?(Module) }\n .sort\n .map { |const| FFaker.const_get(const) }\nend", "def defined_modules\n # TODO: check content type before scanning\n content.scan(/\\s*module\\s+([A-Za-z0-9_\\.]*)/).flatten\n end", "def inspect_modules\n modules = []\n\n if constant.respond_to?(:ancestors)\n parent = inspect_superclass\n\n # Take all the modules included *directly* into the constant.\n modules = constant.ancestors.take_while do |ancestor|\n parent && ancestor != parent\n end\n\n # Get rid of non Module instances and modules that don't have a name.\n modules = modules.select do |mod|\n mod.instance_of?(Module) && mod.name\n end\n end\n\n return modules\n end", "def get_sorted_module_list classes\n classes.select do |klass|\n klass.display?\n end.sort\n end", "def list_known_classes names = []\n classes = []\n stores.each do |store|\n classes << store.modules\n end\n classes = classes.flatten.uniq.sort\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n classes = classes.grep filter\n end\n puts classes.join(\"\\n\")\n end", "def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n if fn_task = lookup(fn)\n fn_task.invoke\n end\n load!(fn)\n @imported << fn\n end\n end", "def requested_modules(module_names)\n if module_names.empty?\n module_names = Dir[\"*.fun\"].each{ |mod| mod.chomp! \".fun\" }\n end\n module_names\n end", "def modules_hash\n @modules\n end", "def modules_hash\n @modules\n end", "def all_classes_and_modules\n result = []\n ObjectSpace.each_object(Module) { |m| result << m }\n result.sort_by {|m| m.name}\nend", "def list_modules\n pal.list_modules\n end", "def ignored_names(ignored)\n modules = Config.read(\"modules\") || []\n ignored.map { |i| modules[i] || \"\" }\n end", "def set_required_imports file_content\n imports = file_content.scan(every_defined_class_reg_exp)\n\n required_imports = {:packages => [],\n :classes => [],\n :unknowns => []\n }\n\n imports.each do |import|\n if import.match(package_seperator_reg_exp)\n required_imports[:packages] << \"import #{import};\"\n elsif import.match(new_class_reg_exp)\n required_imports[:classes] << import.split(\" \")[1]\n else\n required_imports[:unknowns] << {:import => import,\n :class => @class_name,\n :method => @method_name\n }\n end\n end\n\n if required_imports[:unknowns].size > 0\n puts \"Unknown Classes found\\r\\n\"\n puts required_imports[:unknowns].inspect\n exit\n end\n\n required_imports.each { |key,value| value.uniq! }\n\n required_imports\n end", "def update_includes\n includes.reject! do |include|\n mod = include.module\n !(String === mod) && @store.modules_hash[mod.full_name].nil?\n end\n\n includes.uniq!\n end", "def get_unref_symbols\n unref = []\n @modules.each do |mod|\n mod.symbols.values.each do |s|\n unless s.referenced?\n unref << s.name\n end\n end\n end\n unref\n end", "def dependent_modules\n out = [ ]\n @dependencies.each { |dependency| out << @module_set[dependency] }\n out\n end", "def to_import_hash\n {\n :import_from_file => @import_from_file,\n :db_configuration => @db_configuration,\n :db_connection => @db_connection,\n :append_to_table => @append_to_table,\n :force_name => @force_name,\n :suggested_name => @suggested_name,\n :ext => @ext,\n :path => @path,\n :python_bin_path => @python_bin_path,\n :psql_bin_path => @psql_bin_path,\n :entries => @entries,\n :runlog => @runlog,\n :import_type => @import_type\n }\n end", "def list_names\n names = $LOAD_MANAGER.keys.sort\n if names.empty?\n puts \"No libraries found.\"\n else\n max = names.map{ |name| name.size }.max + 4\n rows = ((names.size + 4) / 4).to_i\n cols = []\n names.each_with_index do |name, i|\n c = i % rows\n cols[c] ||= []\n cols[c] << name\n end\n out = \"\"\n cols.each do |row|\n row.each do |name|\n out << (\"%-#{max}s\" % [name])\n end\n out << \"\\n\"\n end\n puts out\n end\n end", "def names\n $LOAD_MANAGER.keys\n end", "def exporter_names\n exporters.map{|e| e.const_name }\n end", "def imports\n return @imports if @imports\n if import&.attached? &&\n (self.import_contents = import.download rescue nil)\n line_hash = { }\n import_contents.split(\"\\n\").each { |line|\n fields = line.split \"\\t\"\n next if (title = fields.first.strip.gsub /\\s+/, ' ').blank?\n line_hash[title] = fields[1..-1]\n }\n titles = line_hash.keys\n titles -=\n ListItem.where(list_type_id: import_type_id,\n user_id: id,\n title: titles).pluck :title\n @imports = titles.collect { |title|\n ListItem.new(\n list_type_id: import_type_id,\n user_id: id,\n title: title\n ).import line_hash[title]\n }\n end\n end", "def unique_modules\n @unique_modules\n end", "def list_known_classes names = []\n classes = []\n\n stores.each do |store|\n classes << store.module_names\n end\n\n classes = classes.flatten.uniq.sort\n\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n\n classes = classes.grep filter\n end\n\n page do |io|\n if paging? or io.tty? then\n if names.empty? then\n io.puts \"Classes and Modules known to ri:\"\n else\n io.puts \"Classes and Modules starting with #{names.join ', '}:\"\n end\n io.puts\n end\n\n io.puts classes.join(\"\\n\")\n end\n end", "def sort_entries(file_data)\n submodules = []\n file_data.scan(/(^\\[submodule[^\\n]+\\n)((?:\\t[^\\n]+\\n)+)/).each do |head, body|\n path = body.match(/^\\tpath\\s*=\\s*\\K(.+)$/)[0]\n submodules << [path, head + body]\n end\n submodules.sort! { |a,b| a[0] <=> b[0] }\n submodules.collect { |i| i[1] }\nend", "def prepended_modules; end", "def duplicate_imports_info\n import_frequency_mapping = {}\n all_imports.uniq.each do |item|\n item_occurrence = all_imports.count(item)\n if item_occurrence > 1\n import_frequency_mapping[item.chomp] = item_occurrence\n end\n end\n import_frequency_mapping\n end", "def modules_hash\n @modules_hash\n end", "def flatten\n return [] if errored? || circular? || !matches?\n configs = sort([self].compact + imports.map(&:flatten).flatten)\n configs.uniq(&:to_s).reject(&:skip?)\n end", "def modules\n @modules.values\n end", "def modules\n @modules.values\n end", "def list(namespace)\n list = Dir.entries(make_path(namespace)) - %w{. ..}\n list.map! {|item| File.split(item)[1].to_sym}\n list.to_set\n end", "def classes_and_includes_and_extends_for name\n klasses = []\n extends = []\n includes = []\n\n found = @stores.map do |store|\n begin\n klass = store.load_class name\n klasses << klass\n extends << [klass.extends, store] if klass.extends\n includes << [klass.includes, store] if klass.includes\n [store, klass]\n rescue RDoc::Store::MissingFileError\n end\n end.compact\n\n extends.reject! do |modules,| modules.empty? end\n includes.reject! do |modules,| modules.empty? end\n\n [found, klasses, includes, extends]\n end", "def force_load_set\n\t\teach_module { |name, mod|\n\t\t}\n\tend", "def initialize\n @@availableModules = Array.new\n @@cleanAvailableModules = Array.new \n @@availableModules = `ls | grep Module`\n @@availableModules.each do |m|\n #removes \"Module.rb\" from availableModules array and put new values in clean array\n @@cleanAvailableModules.push(m.chomp.gsub(/Module.rb/,\"\").downcase)\n #removes empty values\n @@cleanAvailableModules.reject! {|e| e.empty?}\n end\n #import all mods\n end", "def included_modules() end", "def all_package_names\n each_autobuild_package.map(&:name)\n end", "def force_load_set\n each_module { |name, mod| }\n end", "def get_installed_modules_for_host(host)\n on host, puppet(\"module list --render-as pson\")\n str = stdout.lines.to_a.last\n pat = /\\(([^()]+)\\)/\n mods = str.scan(pat).flatten\n return mods\n end", "def bin_libs(names, hash=Hash.new)\n raise \"not a hash\" unless hash.is_a?(Hash)\n check_hash(hash, [:includes, :lib_path])\n\n mapped = names.map{|n|n.to_s}\n return mapped.map{|name|bin_lib(name, hash)}\n end", "def module_extensions(module_)\n current_module_dir = module_dir(module_)\n\n current_module_dir_length = current_module_dir.length + 1\n extensions = Dir[\"#{current_module_dir}/**/*.rb\"].map do |e|\n e[current_module_dir_length..]\n end\n\n extensions.sort!\n extensions\n end", "def constant_names\n return if @constant_names.empty?\n @constant_names.uniq.sort\n end", "def composite_keys \n Hash.new.tap do |hash|\n SPREE_MODULES.each do |mod|\n hash.merge! get_translation_keys(\"spree_#{mod}\")\n end\n end\n end", "def import(imports)\n ns_methods = instance_methods.map(&:to_sym)\n @_import_hash = array_to_key_value_tuples(imports).reduce({}) do |h, (obj, methods)|\n if !obj.frozen?\n raise ImportError, \"#{obj} cannot be imported into Namespace because it is not frozen\"\n elsif !obj.class.frozen?\n raise ImportError, \"#{obj} cannot be imported into Namespace because its class is not frozen\"\n end\n\n (methods || obj.public_methods(false)).each do |method|\n if ns_methods.include? method\n raise ImportError, \"cannot override #{method} with an import\"\n end\n h[method.to_sym] = obj.method(method)\n end\n\n h\n end\n\n file, line = import_call_site(caller)\n @_import_hash.each do |method, _|\n # eval is needed because:\n # * Module#define_method can't delegate to methods that accept blocks\n # * method_missing can, but then imported methods are available publicly\n module_eval(delegate_to_hash_source(method, :@_import_hash), file, line - 1)\n private method\n end\n end", "def remove_duplicate_imports\n files.each(&:remove_duplicate_imports)\n end", "def modules\n modules = {}\n\n begin\n mods = Pathname.new(@conf['mod_dir']).children.select(&:directory?)\n\n mods.each do |m|\n modules[m.basename.to_s] = mod_versions(m)\n end\n rescue StandardError => err\n Pem.log_error(err, @logger)\n raise(err)\n end\n\n modules\n end", "def require_libraries\n original = class_list\n Util.load_dir Config::ComponentDir + \"/#{@name.downcase}\"\n new = class_list\n\n new_modules = new - original\n new_models = new_modules.select do |m|\n subclass?(m, Derailed::Component::Model) ||\n (defined?(Authlogic) && subclass?(m, Authlogic::Session::Base))\n end\n\n controller_array = new_modules.select do |m|\n subclass?(m, Derailed::Component::Controller)\n end\n\n new_models.each do |m|\n if subclass?(m, Derailed::Component::Model)\n m.full_model_name = \"#{name}::#{m.name}\"\n end\n end\n\n [new_models,controller_array[0]] # we should only have one controller\n end", "def list_forge_modules(module_list)\n unless @options[:silent]\n puts \"\\nListing discovered modules from CLI and/or Puppetfile:\\n\\n\"\n module_list.each do |name|\n puts \" #{name}\"\n end\n puts ''\n end\n end", "def dependency_forward_names\n names = []\n each_forward_dependency do |task|\n names << task.to_s\n end\n names.sort\n end", "def included_modules; end", "def schema_version_list\n result = []\n Dir.glob(\"#{File.dirname(__FILE__)}/expands/v*.rb\") do |f|\n result << File.basename(f, '.rb')\n end\n result.sort\n end", "def names\n plugins.reduce({}) do |hash, plugin|\n hash[plugin.name] = plugin\n hash\n end\n end", "def import(prefix)\n @parent.gemset_export prefix.to_s.gsub(/\\.gems$/, '')\n end", "def service_modules\n modules = []\n ObjectSpace.each_object(Module) do |clazz|\n if clazz < Thrift::Client\n modules << qualified_const(clazz.name.split('::')[0..-2].join('::')) # i miss activesupport...\n end\n end\n modules.delete(Thrift)\n modules\n end", "def unmodulize_modules(*mod_consts)\n mod_consts.each { |mod_const| unmodulize *(mod_const.instance_methods) }\n end", "def linter_modules_included_in_package_json\n package_json_text = File.read(File.join(destination_root, \"client/package.json\"))\n linter_modules_names.reject { |module_name| !package_json_text.include?(module_name) }\nend", "def preloaded_module_paths(resolver:, cache_key: T.unsafe(nil)); end", "def sorted_alchemy_modules\n sorted = []\n not_sorted = []\n alchemy_modules.map do |m|\n if m[\"position\"].blank?\n not_sorted << m\n else\n sorted << m\n end\n end\n sorted.sort_by { |m| m[\"position\"] } + not_sorted\n end", "def modules\n @registry.values\n .sort_by { |x| x.respond_to?(:priority) ? x.priority : 0 }\n .reverse\n end", "def item_names\n @registry.keys\n end", "def extensions\r\n e = []\r\n @extensions.each_key do |k|\r\n e.push k\r\n end\r\n return e\r\n end", "def parse_loaded_modules(lines)\n # remove the 1st line\n lines.pop\n\n process_matching_lines(lines, MODULE_LINE_REGEX) do |match|\n name = match[1]\n version = match[2]\n\n @modules[name] = version\n end\n end", "def index\n @clean_import_names = LessActiveMemberNames.new\n end", "def imported_scripts\r\n @imported_scripts ||= []\r\n end", "def import mold\n\t\tret = ''\n\n\t\tmold.properties.each do |p|\n\t\t\tunless p.nested == nil\n\t\t\t\tret << \"#import \\\"#{p.nested}.h\\\"\\n\"\n\t\t\tend\n\t\tend\n\n\t\tret << \"\\n\"\n\tend", "def differentiate(packages)\n named_groups = Hash.new{|h,k| h[k] = []}\n packages.each{|p| named_groups[p.name] << p }\n named_groups.each do |name, packages| \n if packages.length > 1\n packages.each{|p| p.name = \"#{p.name} (#{p.paths.first})\"} \n end\n end\n end", "def names\n map(&:names).flatten\n end", "def included_methods\n included_modules.map(&:instance_methods).flatten\n end", "def list_names\n @lib.list_names\n end", "def files_with_duplicate_imports\n files.select(&:has_duplicate_import?)\n end", "def get_library_functions_list\n library_functions = []\n @indexes.each do |index|\n library_functions += JSON.parse(IO.read(@feature_dir + \"/library_calls/#{index.to_s}.json\")).keys\n end\n library_functions.uniq\n end", "def module_sources(mod)\n graph.each_with_object([]) do |(m,next_modules),ret|\n ret << m if next_modules.include?(mod)\n end\n end", "def included_modules\n end", "def names\n all.map { |item| item.name_sym }\n end", "def list_known_names\n end", "def names\n fs = []\n %w( HOST CONTENT_UNDEFINED ).each { |f|\n fs.push(f) if self.include?( self.class.const_get(f) )\n }\n return fs\n end", "def hash\n [hint,name,ordinal,module_name].hash\n end", "def files\n modules = (changed?) ? tag_configuration_plugins.collect {|p| p.plugin.modules} : \n plugins.collect {|p| p.modules}\n modules << Plugin::JshubCore.instance.modules\n modules.flatten!\n modules.sort!\n modules.uniq.collect { |m| m.name }\n end", "def find_module(name, version)\n e = []\n\n @envs.each do |k, v|\n next unless v.keys.include?(name) && v[name] == version\n e << k\n end\n\n e\n end", "def find_module(name, version)\n e = []\n\n @envs.each do |k, v|\n next unless v.keys.include?(name) && v[name] == version\n e << k\n end\n\n e\n end", "def package_list(packages, version)\n packages[:base].to_a.join(' ') + ' ' + packages[version].to_a.join(' ')\n end" ]
[ "0.6870428", "0.6631317", "0.63896877", "0.63423765", "0.6150625", "0.6150625", "0.6108314", "0.59824467", "0.59716856", "0.5908272", "0.58734876", "0.5854943", "0.5854943", "0.5841487", "0.5826468", "0.57332796", "0.5672499", "0.5651493", "0.5612056", "0.55503696", "0.5538599", "0.55192965", "0.5504737", "0.545594", "0.5445479", "0.5441033", "0.5421986", "0.5404918", "0.5404918", "0.5376081", "0.53706837", "0.5358679", "0.5319182", "0.5293367", "0.5274071", "0.5269788", "0.52533305", "0.5242246", "0.5242091", "0.520956", "0.5201866", "0.5199583", "0.5184341", "0.51795834", "0.5178954", "0.51668894", "0.5154924", "0.5148398", "0.5130894", "0.5130894", "0.51212883", "0.51136607", "0.51107967", "0.5107053", "0.5082333", "0.50757897", "0.5072008", "0.50571513", "0.5043537", "0.5033957", "0.5025803", "0.4976007", "0.49657568", "0.49655733", "0.49639904", "0.49613133", "0.4959539", "0.4958178", "0.4957813", "0.4948759", "0.4940066", "0.49353448", "0.49336502", "0.49282756", "0.49221653", "0.49102318", "0.489076", "0.48806167", "0.48719242", "0.4871697", "0.48629966", "0.4859401", "0.48593214", "0.48589152", "0.48491156", "0.4849053", "0.4848161", "0.48438457", "0.4840615", "0.48370808", "0.482405", "0.4814185", "0.4813956", "0.48124924", "0.47981253", "0.47935975", "0.47920015", "0.47822273", "0.4781225", "0.4778682" ]
0.6493703
2
POST /friends or /friends.json
def create current_user.friends.create( friend_id: @user.id ) redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friends(options={})\n get('/friends', options)\n end", "def add_friend\n # byebug\n #we get user_id from jwt!\n user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n #we get friend_id from frontend\n if !Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty?\n return render json: {error: \"There was a problem! (Ya been blocked!)\"}\n end\n\n followee = User.find(follow_params[:user2])\n #insert the one way relation in db!\n friend_request = Follow.new(follower_id: user.id, followee_id: followee.id)\n if friend_request.save\n render json: {friend_request: followee} \n else\n render json: {error: \"There was a problem!\"}\n end\n end", "def add_friend\n # If there is no pending connection between persons,\n # add pendind/requested connections between them.\n # If there is already a pending connection requested from the other direction,\n # change friendship status to accepted.\n\n if (params['user_id'] == params['friend_id'])\n render_json :messages => \"Cannot add yourself to your friend.\", :status => :bad_request and return\n end\n\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n @friend = Person.find_by_guid(params['friend_id'])\n if ! @friend\n render_json :status => :not_found and return\n end\n\n if @person.association? or @friend.association?\n render_json :messages => \"Association users cannot have friends.\", :status => :bad_request and return\n end\n\n if @person.pending_contacts.include?(@friend) #accept if pending\n Connection.accept(@person, @friend)\n else\n unless @person.requested_contacts.include?(@friend) || @person.contacts.include?(@friend)\n Connection.request(@person, @friend) #request if didn't exist\n end\n end\n\n render_json :status => :ok\n end", "def create\n # @friend = Friend.new(friend_params)\n @friend = current_user.friends.build(friend_params)\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: I18n.t('friend.create') }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def friend\n @user.friendships.build(friend_id: @friend.id)\n if @user.save\n render json: { success: true }\n else\n render json: {message: @user.errors&.messages || 'Unable add as friend, please try again'}, status: 202\n end\n end", "def create\n # prevent user from adding friends who are already on friends list.\n if @friendship\n render json: { Message: \"You're already friends!\" }, status: :unprocessable_entity\n else\n @friend = current_user.friendships.create(:friend_id => @friend_id)\n render json: @friend, status: 201\n end\n end", "def friend(action, value)\n raise ArgumentError, \"Invalid friend action provided: #{action}\" unless @@FRIENDSHIP_URIS.keys.member?(action)\n value = value.to_i unless value.is_a?(String)\n uri = \"#{@@FRIENDSHIP_URIS[action]}/#{value}.json\"\n response = http_connect {|conn| create_http_post_request(uri) }\n bless_model(Twitter::User.unmarshal(response.body))\n end", "def create\n Friendship.request(@user, @friend)\n @friend = Friendship.find_by_user_id_and_friend_id(@user, @friend)\n render :json => { :success => true, :new_friend => @friend }\n end", "def make_friend_with(username)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_post_call('/friends/%s/request' % [username]).status == \"OK\"\n end", "def create\n respond_to do |format|\n if safe_create_friend\n format.html { redirect_to member_friends_path(@member), notice: 'Friend was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_friend\n # check if this friend isnt't to our list friend\n if params[:user_id].to_i == params[:friend_id].to_i \n render json: {\n message: \"Not yourself\"\n }, status: 400\n else\n @current_user = User.find(params[:user_id])\n if @current_user.friend.find_by(friend: params[:friend_id])\n render json: {\n message: \"#{User.find(params[:user_id]).name} can't be added, You are friend with this user\",\n errors: {\n error_code: \"\",\n error_description: \"\"\n }\n }, status: 401\n else\n # add friend\n puts \"Starting adding friend ...\"\n @new = @current_user.friend.new(friend: params[:friend_id], status: :pending)\n if @new.save\n render json: {\n message: \"#{User.find(params[:user_id]).name} added as friend\"\n }, status: 201\n else\n render json: {\n message: @new.errors.messages\n }, status: 401\n end\n end\n end\n\n end", "def new\n #Find the current user and the requested friend\n @user=current_user\n friend=User.find_by_email(params[:email])\n #make sure the friend exists\n if(friend)\n #Check to see if the friendship already exists\n friendCheck=Friendship.find_by_user_id_and_friend_id(@user.id, friend.id)\n if(!friendCheck)\n #If there is no friendship between the two users, continue as normal\n @friendship = @user.friendships.build(:friend_id => friend.id)\n\n respond_to do |format|\n #Do it again for the reverse relationship (a friends with b and b friends with a are two separate relationships)\n if @friendship.save\n @friendship=friend.friendships.build(:friend_id => @user.id)\n if @friendship.save\n #Send an email to the friend so they can confirm that they want to be friends\n UserMailer.confirmation_email(@user,friend).deliver\n format.html { redirect_to @friendship, notice: 'Friendship was successfully created.' }\n format.json { render json: {:created => 'true', :exists => 'true', :friends => 'false'}}\n else\n format.html { render action: \"new\" }\n format.json { render json: {:created => 'false', :friends => 'false', :exists => 'true'}}\n end\n else\n render json: {:created => 'false', :friends => 'false', :exists => 'true'}\n end\n end\n else\n #If the friendship exist, return this fact to the app. It will notify the user.\n render json: {:friends => 'true', :exists => 'true', :created => 'false'}\n end\n else\n #If the user does not exist, let the app know.\n render json: {:friends => 'false', :exists => 'false', :created => 'false'}\n end\n end", "def add_friend\n\n current_user.friends_list.push(define_friend)\n # binding.pry\n if current_user.save\n render json: current_user \n else\n render json: @user.errors, status: 422\n end\n\n end", "def create\n @friend = Friend.new(params[:friend])\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: 'Friend was successfully created.' }\n format.json { render json: @friend, status: :created, location: @friend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n @users = User.friends_by_name(user_params[:name])\n render json: {me: @user, users: @users, rooms: []}, status: :ok\n else\n render json: {error: @user.errors.full_messages.first}, status: :unprocessable_entity\n end\n end", "def friendships_create(options = {})\n @req.post(\"/1.1/friendships/create.json\", options)\n end", "def friend(note = nil)\n name = get_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n @client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end", "def friend(note = nil)\n name = get_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n @client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end", "def create\n @friend = Friend.new(friend_params)\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to request.referrer }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@friend = Friend.new(friend_params)\n @friend = current_user.friends.build(friend_params)\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: \"Friend was successfully created.\" }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friend = Friend.new(params[:friend])\n @friend.save\n respond_with(@friend)\n end", "def create\n @friend = Friend.new(user_id: params[:user_id], friend_id: params[:friend_id])\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: \"Friend was successfully created.\" }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def friend(note = nil)\n name = read_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end", "def create\n @friend = Friend.new(friend_params)\n\n if @friend.save\n render :show, status: :created, location: @friend\n else\n render json: @friend.errors, status: :unprocessable_entity\n end\n end", "def new\n @friend = current_user_or_guest.friends.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @friend }\n format.json { render json: @friend }\n end\n end", "def get\n\t\tif request.post?\n\t\t\tuser = User.find_by_id(params[:user_id])\n\t\t\tunless user\n\t\t\t\trender json: {error: \"user not fonud\"} and return\n\t\t\tend\n\t\t\t\n\t\t\trender json: {friends: user.friends.each {|f| f.password = nil}}\n\t\tend\n\tend", "def create\n @friend = Friend.new(params[:friend])\n case @friend.profile_url\n when %r!facebook\\.com/profile\\.php\\?id=(\\d+)!\n friend_info = rest_graph.get($1)\n @friend.user_id = friend_info[\"id\"]\n @friend.user_name = friend_info[\"name\"]\n when %r!facebook\\.com/([^?]+)!\n friend_info = rest_graph.get($1)\n @friend.user_id = friend_info[\"id\"]\n @friend.user_name = friend_info[\"name\"]\n end\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to(@friend, :notice => 'Friend was successfully created.') }\n format.xml { render :xml => @friend, :status => :created, :location => @friend }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @friend.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @friend = Friend.new(friend_params)\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: 'Friend was successfully created.' }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friend = Friend.new(friend_params)\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: 'Friend was successfully created.' }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end", "def friend_request\n\nend", "def add_buddies_to_friends_list\n if user_id.blank?\n render :status=>401,\n :json=>{:Message=>\"The user id cannot be blank for this api.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n friend = User.find_by_id(user_id)\n friend.follow(requested_user)\n render :status=>200,\n :json=>{:Message=>\"Added #{friend.name} to buddy list!\",\n :Response => \"Success\",\n :Data => nil} \n end", "def friend\n if params.include?(:id)\n @user.friends += [User.find(params[:id])]\n elsif params.include?(:username)\n @user.friends += [User.find_by(username: params[:username])]\n end\n redirect_to root_path\n end", "def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').friends\n end", "def create\n #@friendrequest = Friendrequest.new(params[:friendrequest])\n \n @user = User.find(params[:user_id])\n #@friend = Friend.new(params[:friend])\n @friendreq = @user.friendrequests.create(params[:friendrequest].permit(:futurefriend))\n\n respond_to do |format|\n if @friendrequest.save\n format.html { redirect_to @friendrequest, notice: 'Friendrequest was successfully created.' }\n format.json { render json: @friendrequest, status: :created, location: @friendrequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friendrequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def follow!(new_friend)\n\t\tresponse = access_token.post(\"/friendships/create/#{new_friend}.json\")\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tfriend=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless friend.is_a? Hash\n\t\t\tfriend\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in follow!: #{err}\"\n\t\traise err\n\tend", "def my_friends\n @current_user = User.find(params[:user_id])\n render json: {\n friends: @current_user.friend.where(status: 'accept').map do |friend|\n {\n id: friend.id,\n name: User.find(friend.friend).name.upcase,\n avatar: \"#{request.base_url}#{Rails.application.routes.url_helpers.rails_blob_path(User.find(friend.friend).avatar, only_path: true)}\",\n date: friend.created_at\n }\n end\n }\n end", "def create\n @friends1 = Friends1.new(friends1_params)\n\n respond_to do |format|\n if @friends1.save\n format.html { redirect_to @friends1, notice: \"Friend was successfully created.\" }\n format.json { render :show, status: :created, location: @friends1 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friends1.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\n params[:friends].each do |email|\n friend = User.find_by_email(email)\n next unless friend.present?\n\n # Check the inverse friendship and add if necessary\n friendship = Friendship.find_by_user_id_and_friend_id(friend.id, current_user.id)\n unless friendship.present?\n inverse_friendship = friend.friendships.build(friend_id: current_user.id)\n if inverse_friendship.save\n puts \"Added friendship for #{friend.name} (#{friend.id}) and #{current_user.name} (#{current_user.id})\"\n end\n end\n end\n\n render json: { success: true }\n end", "def create\n @user.make_friend_with! params[:id]\n render_created\n end", "def friend_wrapper opts = {}\n logged_in?\n params = {uh: @modhash, api_type: 'json'}\n params.merge! opts\n post('/api/friend', body: params)\n end", "def friend_request(type, options)\n options = options.clone\n\n if options[:subreddit]\n options[:r] = options[:subreddit]\n options.delete :subreddit\n end\n\n post(\"api/#{type}\", options)\n end", "def index\n @user = current_user\n render json: @user.friends\n end", "def create\n @friendslist = Friendslist.new(params[:friendslist])\n\n respond_to do |format|\n if @friendslist.save\n format.html { redirect_to @friendslist, notice: 'Friendslist was successfully created.' }\n format.json { render json: @friendslist, status: :created, location: @friendslist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friendslist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #friends_list = FriendsList.new(friends_list_params)\n @friends_list = current_user.friends_list.build(friends_list_params)\n\n respond_to do |format|\n if @friends_list.save\n format.html { redirect_to @friends_list, notice: \"Friend was successfully added.\" }\n format.json { render :show, status: :created, location: @friends_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friends_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\n id = params.require(:friend_id)\n current_user.friendships.create friend_id: id\n\n respond_to do |format|\n format.html { redirect_to friends_path, alert: \"#{User.find(id).name} is now your friend\" }\n format.json { render :json => {success: 'OK'} }\n end\n end", "def friends\n #get friends page\n #get json from friends page\n #parse\n []\n end", "def create\n if current_user.friends.exists?(params[:friend_request][:receiver_id])\n redirect_to users_show_path(current_user), flash: {notice: \"You are already friend\"}\n else\n @friend_request = FriendRequest.new(friend_request_params.merge(sender_id: current_user.id))\n respond_to do |format|\n if @friend_request.save\n format.html { redirect_to @friend_request, notice: 'Friend request was successfully created.' }\n format.json { render :show, status: :created, location: @friend_request }\n else\n format.html { render :new }\n format.json { render json: @friend_request.errors, status: :unprocessable_entity }\n end\n end\n\n end\n\n\n end", "def create\n user = User.find(params[:user_id])\n friendship = current_user.friendships.build(friend: user)\n if friendship.save\n reciprocal_friendship = user.friendships.build(friend: current_user)\n if reciprocal_friendship.save\n request_1 = FriendshipRequest.find_by(sender: current_user, recipient: user)\n request_2 = FriendshipRequest.find_by(sender: user, recipient: current_user)\n request_1.destroy if request_1\n request_2.destroy if request_2\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: \"You and #{user.name} are now friends!\") }\n format.json do\n render json: {\n friendship: {\n name: current_user.name,\n id: current_user.id\n },\n message: \"You and #{user.name} are now friends!\"\n }\n end\n end\n else\n friendship.destroy\n redirect_back(fallback_location: root_path, notice: \"There was an error creating the friendship\")\n end\n else\n redirect_back(fallback_location: root_path, notice: \"There was an error creating the friendship\")\n end\n end", "def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end", "def create_friend\n\n \t\tif params[:friends].blank? || params[:friends].size != 2\n \t\t\tlogger.info(\"[FriendUserController]create_friend == params is error ,params ==#{params[:friends]}\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n \t\temail = params[:friends][0]\n \t\tfriend_email = params[:friends][1]\n\n \t\t# block updates from an email address,if they are not connected as friends, then no new friends connection can be added\n \t\tif BlockUser.exists?(:email=>email,:block_email=>friend_email) || BlockUser.exists?(:email=>friend_email,:block_email=>email)\n \t\t return render :json => {:success => false}\n \t\tend\n \t\t#if they are connected as friends,retrun success is true\n \t\tif FriendUser.exists?(:email=>email,:friend_email=>friend_email) || FriendUser.exists?(:email=>friend_email,:friend_email=>email)\n \t\t\treturn render :json => {:success => true}\n \t\tend\n\n \t\t#create a friend connection between two email addresses.\n \t\tfriend_user = FriendUser.create(:email=>email,:friend_email=>friend_email)\n\n \t\tif friend_user.save\n \t\t\tlogger.info(\"[FriendUserController]create_friend == create a friend connection between two email addresses ,params ==#{params[:friends]}\")\n \t\t\treturn render :json => {:success => true}\n \t\telse\n \t\t\tlogger.info(\"[FriendUserController]create_friend == can not create a friend connection between two email addresses,error=#{friend_user.errors.full_messages} ,params ==#{params[:friends]}\")\n \t\t\treturn render :json => {:success => false}\n \t\tend\n \t\t\n \tend", "def create\n user = User.find(params[:user_id])\n friend_request = user.incoming_requests.build(sender_id: current_user.id)\n if friend_request.save\n if friend_request.sender == current_user\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: \"Friend request sent to #{user.name}.\") }\n format.json do\n render json: {\n request: {\n id: friend_request.id,\n name: friend_request.sender.name\n },\n message: \"Friend request sent to #{user.name}.\"\n }\n end\n end\n else\n redirect_back(fallback_location: root_path, notice: \"Friend request sent to #{user.name}.\")\n end\n else\n redirect_back(fallback_location: root_path, alert: 'Friend request could not be sent.')\n end\n end", "def add_future_friend(friend_id)\n add_future_params(:add_friends, [friend_id])\n end", "def create\n @friends_list = FriendsList.new(friends_list_params)\n\n respond_to do |format|\n if @friends_list.save\n format.html { redirect_to @friends_list, notice: 'Friends list was successfully created.' }\n format.json { render :show, status: :created, location: @friends_list }\n else\n format.html { render :new }\n format.json { render json: @friends_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def befriend\n \t#friend = User.find(params[:friend_id])\n respond_to do |format|\n \t\tif Friendship.befriend(@user, @friend)\n \t\t\tmessage = \"Friend request succeed\"\n format.json{render :json => {:message => message, :status => \"200\"}}\n \t\telse\n \t\t\terror = \"No friendship request from #{@friend.nick_name}.\"\n format.json{render :json => {:error => error, :status => \"400\"}}\n \t\tend\n end\n end", "def friends(options={})\n perform_get(\"statuses/friends.#{Twitter.format}\", options)\n end", "def create\n user = User.find(params[:friend_id])\n if current_user == user\n redirect_to root_path, notice: \"You can't send request to yourself\"\n return\n elsif Friendship.where(friend_id: user.id, user_id: current_user, confirm: false).exists?\n redirect_to root_path, notice: \"Friend request already sent\"\n return\n elsif Friendship.where(friend_id: current_user, user_id: user.id, confirm: false).exists?\n redirect_to root_path, notice: \"This user already sent friend request to you. Respond to it!\"\n return\n end\n @friendship = current_user.friendships.build(friend_id: user.id)\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to root_path, notice: \"Friends request sent\" }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def friend_params\n params.require(:friend).permit(:user_id, :name)\n end", "def create\n @friendsofuser = Friendsofuser.new(params[:friendsofuser])\n\n respond_to do |format|\n if @friendsofuser.save\n flash[:notice] = 'Friendsofuser was successfully created.'\n format.html { redirect_to(@friendsofuser) }\n format.xml { render :xml => @friendsofuser, :status => :created, :location => @friendsofuser }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @friendsofuser.errors, :status => :unprocessable_entity }\n end\n end\n end", "def accept_friend\n \tif @user.pending_friends.include?(@friend)\n Friendship.accept(@user, @friend)\n message = \"Friendship with #{@friend.nick_name} accepted!\"\n format.json{render :json => {:message => message, :status => \"200\"}}\n else\n error = \"No friendship request from #{@friend.nick_name}.\"\n format.json{render :json => {:error => error, :status => \"400\"}}\n\t\tend\n #redirect_to :back\n end", "def friend_params\r\n params.require(:friend).permit(:user_id, :friend_id)\r\n end", "def friend_params\n params.require(:friend).permit(:user_id, :friend_id)\n end", "def create\n @user = User.find_by(:email => friendship_params[:email])\n if @user.nil?\n render json: { error: \"Cannot find user with specified email\"}, status: 400\n else\n id = @user.firstName\n if Friendship.exists?(:user_id => @current_user.id, :friend_id => @user.id)\n render json: { error: 'Already Friends'}, status: 400\n else\n @friendship = @current_user.friendships.build(:friend_id => @user.id)\n if @friendship.save\n @friend_user = @friendship.friend\n @inverse_friendship = @friend_user.friendships.build(:friend_id => @current_user.id)\n if @inverse_friendship.save\n render json: @friendship, status: :created\n else\n render json: @inverse_friendship.errors, status: :unprocessable_entity\n end\n else\n render json: @friendship.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def create\n\t\t@profile_friend = Friendship.new(profile_friend_params)\n\t\t@profile_friend.friend_a = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @profile_friend.save\n\t\t\t\tback_page = profile_friends_path\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Friend was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: back_page }\n\t\t\telse\n\t\t\t\tformat.html { broadcast_errors @profile_friend, profile_friend_params }\n\t\t\t\tformat.json { render json: @profile_friend.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new\n @friendslist = Friendslist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendslist }\n end\n end", "def friend_params\n params.require(:friend).permit(:name, :email, :phone, :instagram, :user_id)\n end", "def friend_params\n params.require(:friend).permit(:name, :address, :user_id)\n end", "def friends(user = nil, params = {})\n args = [user, params]\n get path_from_args('statuses/friends', args), params_from_args(args)\n end", "def friend_params\n params.permit(:user_id, :friend_id)\n end", "def friend_params\n params.permit(:user_id, :friend_id)\n end", "def create\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id])\n @friendship.status = \"SENT\"\n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_url\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to root_url\n end\n end", "def friend_params\n params.require(:friend).permit(:user_id, :friend_id, :status)\n end", "def create\n friend = Friend.create user_id: current_user.id, other_id: params[:id]\n o = friend.other\n datum = {id: friend.id, email: o.email, own: true}\n reciprocal = friend.mutual\n if reciprocal\n datum[:subscribed_to_me] = reciprocal.subscribed\n datum[:mutual] = true\n datum[:other_id] = reciprocal.id\n end\n notify friend, 1\n render json: datum\n end", "def friend_params\n params.require(:friend).permit(:requester_id, :destiny_id, :status)\n end", "def friend_params\n params.require(:friend).permit(:friend_name)\n end", "def requests_sent\n friends = Friend.where(user_id: params[:user_id], accepted: false)\n\t render json:friends\n end", "def friend_params\n params.require(:friend).permit(:user_id, :friend_id, :facebook_id, :friend_confirm)\n end", "def add_friend\n\t\t# unless @current_user.friends.include? params[:id] \n\t\t@current_user.push(friends: params[:id])\n\t\t# push to friends array id number of friend\n\n\t\tredirect_to \"/profile/#{@current_user.id}\"\n\t\t# show the new friend\n\tend", "def create\n @user=User.find(params[:uid])\n friend=User.find(params[:fid])\n #make sure the friend and user exist\n if(friend && @user)\n #Check to see if the friendship already exists\n friendShip=Friendship.find_by_user_id_and_friend_id(@user.id, friend.id)\n if(friendShip)\n #If there is a friendship between the two users, continue as normal\n #Change the type of friendship to Confirmed.\n #The users will then show up on each others maps.\n #The logic for this is in the users model\n friendShip.type='ConfirmedFriendship'\n respond_to do |format|\n if friendShip.save\n #Then do it again for the inverse relationship (see the new method for an explanation of why this is necessary)\n friendShip=Friendship.find_by_user_id_and_friend_id(friend.id, @user.id)\n #Change the type of friendship to Confirmed.\n #The users will then show up on each others maps.\n #The logic for this is in the users model\n friendShip.type='ConfirmedFriendship'\n session[:user_id]=@user.id\n if friendShip.save\n format.html { redirect_to \"http://54.235.20.117:3000/users/#{@user.id}.html\", notice: 'Friendship was successfully created.' }\n format.json { render json: {:created => 'true', :exists => 'true', :friends => 'false'}}\n else\n format.html { redirect_to @user, notice: 'Something went wrong!'}\n format.json { render json: {:created => 'false', :friends => 'false', :exists => 'true'}}\n end\n else\n format.html { redirect_to @user, notice: 'Something went wrong!'}\n format.json {render json: {:friends => 'false', :exists => 'false', :created => 'false'}}\n end\n end\n else\n #If the friendship doesn't exist, don't create the friendship. This will never be sent to the app\n #So the important part is the html response.\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Something went wrong! According to our records, this friendship was never requested!'}\n format.json {render json: {:friends => 'false', :exists => 'false', :created => 'false'}}\n end\n end\n else\n #If the user does not exist, inform the user that their link was incorrect.\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Something went wrong! According to our records, you do not exist!'}\n format.json {render json: {:friends => 'false', :exists => 'false', :created => 'false'}}\n end\n end\n end", "def friendships_update(options = {})\n @req.post(\"/1.1/friendships/update.json\", options)\n end", "def friend_requests\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/waiting-requests').friends\n end", "def accept\n\t\tuser.friends << friend\n\t\tdestroy\n\tend", "def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end", "def invite_facebook_friends\n end", "def create\n @friendlist = Friendlist.new(friendlist_params)\n\n respond_to do |format|\n if @friendlist.save\n format.html { redirect_to @friendlist, notice: 'Friendlist was successfully created.' }\n format.json { render :show, status: :created, location: @friendlist }\n else\n format.html { render :new }\n format.json { render json: @friendlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_friends\n results = []\n user = User.find_by_username(params[:username])\n friends = Friend.where(user_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.friend_id)\n results << {id:friend.id, username: friend.username}\n end\n friends = Friend.where(friend_id: user.id, accepted: true)\n friends.each do |friend_rel|\n friend = User.find(friend_rel.user_id)\n results << {id:friend.id, username: friend.username}\n end\n render json:results\n end", "def send_friend_request\n request_response = post(\"/users/#{id}/request\")[\"response\"]\n @user = Foursquared::Response::User.new(client, request_response[\"userrequest_\"])\n end", "def fb_add_friend(name = 'Add as a friend', options = {})\n options = {\n :method => 'friends',\n :callback => 'function(response) {}'\n }.merge(options)\n\n fb_ui name, options\n end", "def create\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n unless relationship\n current_user.add_friend(User.find(params[:user_two_id]))\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n relationship.status = 1\n relationship.save\n end\n friend = User.find_friend(current_user, relationship)\n redirect_to friendlist_path\n end", "def friend_params\n params.require(:friend).permit(:id, :name)\n end", "def create\n\t\tFriendship::request(@user, @friend)\n\t\tUserMailer::friend_request(\n\t\t\t:user => @user,\n\t\t\t:friend => @friend,\n\t\t\t:user_url => profile_for(@user),\n\t\t\t:accept_url => url_for(:action => \"accept\", :id => @user.screen_name),\n\t\t\t:decline_url => url_for(:action => \"decline\", :id => @user.screen_name)\n\t\t).deliver_now\n\t\tflash[:notice] = \"Friend request sent.\"\n\t\tredirect_to profile_for(@friend)\n\tend", "def create\n if request.format.json?\n @friendship = Friendship.new(friend_id: params[:friend_id])\n @friendship.user_id = session[:login]\n @friendship.save\n render :text => \"#{@friendship.id}\"\n else\n @friendship = Friendship.new\n friendship = params[:friendship]\n @friendship.friend_id = friendship[:friend_id]\n @friendship.user_id = session[:login]\n if @friendship.save\n redirect_to friendships_url \n else\n render action: 'new' \n end\n end\n end", "def friend_params\n params.require(:friend).permit(:first_name, :last_name, :email, :phone, :twitter,:user_id)\n end", "def send_friend_request user_id\n response = post(\"/users/#{user_id}/request\")[\"response\"]\n @user = Foursquared::Response::User.new(self,response[\"user\"])\n end", "def add_friend_request(user_id)\n friend_suggestions.where(user_id: user_id).delete_all\n req = pending_friends.where(id: user_id).first\n if req.present?\n req.accept!\n else\n req = UserFriendRelationship.between(user_id, id).first || user_friend_relationships.create(user_to_id: user_id)\n PubSub::Publisher.new.publish_for([req.user_to], 'friend_request', {source: self.as_basic_json}, {title: full_name(false), body: 'wants to be your friend'})\n end\n # reset_cache('suggested_friends')\n end", "def request_friend(friend)\n self.friendships.create!(friend_id: friend.id, status: 'requested')\n friend.friendships.create!(friend_id: self.id, status: 'pending')\n end", "def friends(id, options = {})\n get(\"users/#{id}/friends\").friends\n end", "def friends\n @friends = response[\"friends\"]\n @friends[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::User.new(client, item)}\n end\n @friends\n end", "def match_friends\n me = User.find params[:id]\n respond_to do |format|\n format.json { \n friends = me.match_friends(params[:q], params[:channel]).collect { |friend|\n name = friend.handle\n name << \" (#{friend.email})\" unless params[:channel]\n { id: friend.id.to_s, name: name }\n }\n if friends.empty? \n if params[:q].match(Devise::email_regexp)\n # A \"valid\" address goes back paired with itself\n friends = [ { id: params[:q], name: params[:q] } ]\n end\n end\n render :json => friends\n }\n end\n end", "def create\n\n if current_user.friends.include?(params[:friend_id])\n flash[:notice] = \"It's polite to ask once.\"\n else\n\n\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id], approved: \"false\")\n\n if @friendship.save\n\n\n\n log_activity\n\n flash[:notice] = \"Friend requested.\"\n\n\n\n redirect_to :back\n else\n flash[:error] = \"Unable to request friendship.\"\n redirect_to :back\n end\n end\n end", "def friendlist_params\n params.require(:friendlist).permit(:first_name, :last_name, :email, :phone, :twitter)\n end" ]
[ "0.69640195", "0.6908395", "0.6708779", "0.6706744", "0.66924226", "0.66683054", "0.6653443", "0.66467404", "0.66056013", "0.6602584", "0.6577616", "0.65341544", "0.65245163", "0.6522975", "0.6521179", "0.65166366", "0.6514117", "0.6514117", "0.6511053", "0.65071595", "0.64773375", "0.6462456", "0.64583844", "0.64505404", "0.6442527", "0.6420912", "0.6410113", "0.63973004", "0.63973004", "0.6395488", "0.63765556", "0.6364617", "0.63359874", "0.63334966", "0.6327773", "0.63016444", "0.6287424", "0.62797666", "0.62707055", "0.6257672", "0.6252516", "0.62464625", "0.6213085", "0.6203224", "0.619807", "0.6192046", "0.61589223", "0.61567014", "0.6150095", "0.6146288", "0.6144953", "0.6140912", "0.6139498", "0.6133751", "0.61168915", "0.6114", "0.6113478", "0.61042434", "0.60951495", "0.6093733", "0.60929424", "0.6085142", "0.60719156", "0.6066231", "0.6060459", "0.6052751", "0.6048459", "0.6044061", "0.6044061", "0.6043206", "0.6041179", "0.60388476", "0.60343707", "0.60337263", "0.60332584", "0.603069", "0.602366", "0.6017518", "0.6005919", "0.600428", "0.60038096", "0.5998966", "0.59954375", "0.5994307", "0.59860134", "0.5980113", "0.59720886", "0.5967582", "0.5951162", "0.5937355", "0.5932827", "0.5925862", "0.59113777", "0.5909794", "0.5905829", "0.5903164", "0.58969283", "0.5894031", "0.5890687", "0.58903295" ]
0.63800323
30
def date_cannot_be_in_the_past if date.present? && date.past? errors.add(:date, "can't be in the past") end end
def start_date_cannot_be_in_the_past if self.start_date && self.start_date < DateTime.now errors.add(:date, "invalid. Start date can't be in the past") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_date_in_past\n if date.nil?\n errors.add(:date, \"cannot be null\")\n else\n if date.past?\n errors.add(:date, \"cannot be in the past\")\n end\n end\n\n end", "def dateordered_cannot_be_in_the_past\n errors.add(:dateOrdered, \"can't be in the past\") if\n !dateOrdered.blank? and dateOrdered < Date.today\n end", "def validate_date\n if self.date.present? && self.date < Date.today\n errors.add(:date, \"can't be in the past\")\n end\n end", "def start_date_cannot_be_in_the_past\n errors.add(:start_date, 'can not be in past') if start_date.present? && start_date < Date.today\n end", "def exam_in_the_future\n if self.date < Date.today\n errors.add(:date, 'is in the past')\n end\n end", "def cannot_change_the_past\n\tif start_date.present? && start_date < Date.today\n\t\terrors.add(:start_date, \"You can't change the past\")\n\tend\nend", "def in_the_past?\n if self.date < Date.today\n errors.add(:date, \"of reservation cannot be in the past.\")\n end\n end", "def date_cannot_be_in_the_past\n if end_time.present? && end_time < Time.zone.today\n errors.add(:end_time, \"end_date can't be in the past\")\n elsif start_time.present? && start_time < Time.zone.today\n errors.add(:start_time, \"start_date can't be in the past\")\n end\n end", "def release_date_is_in_the_past\n if release_date.present?\n errors.add(:release_date, \"should be in the past\") if release_date > Date.today\n end\n end", "def start_date_cannot_be_in_the_past\n errors.add(:start_date, 'cannot be in the past') if\n start_date < Time.zone.today\n end", "def reservation_date_not_in_past\n if date < Date.yesterday\n errors.add(:date, \" cannot be in the past!\")\n end\n end", "def cant_be_past\n unless start_date.nil?\n errors.add(:start_date, \"can't be past\") if start_date < Time.now\n end\n end", "def birth_date_cannot_be_in_the_future\n if birthdate.present? && birthdate >= Date.today\n errors.add(:birthdate, \"Can't be in the future\")\n end\n end", "def expiration_date_cannot_be_in_the_past\n if !expiration_date.blank? and expiration_date < Date.today\n #add messages to the errors collection\n errors[:expiration_date] << \"can't be in the past\"\n end\n end", "def date_cannot_be_in_the_future\n if date > Date.today\n errors.add(:date, \"You can't have meal in the future now...\")\n end\n end", "def valid_date?\n errors.add(:date, \"can't be in the past\") if !date.blank? and date < Date.today\n end", "def date_of_birth_cannot_be_in_the_future\n # stretch\n if self.date_of_birth.present? && self.date_of_birth > DateTime.now\n errors.add(:date_of_birth, \"can't be in the future\")\n end\n end", "def date_of_birth_cannot_be_in_the_future\n if date_of_birth > Date.today\n errors.add(:date_of_birth, \"can't be in the future\")\n end\n end", "def expiration_date_cannot_be_in_the_past\n if expiration_date.present? && expiration_date < Date.today\n errors.add(:expiration_date, \"can't be in the past\")\n end\n end", "def check_in_cannot_be_in_the_past\n if check_in.present? && check_in < Date.today\n errors.add(:check_in, \"can't be in the past\")\n end\n end", "def validate_dates_cannot_be_in_the_past\n if self.promised_pickup_date.present? && self.promised_pickup_date_changed? && (self.promised_pickup_date.in_time_zone < Date.today.in_time_zone) && self.in_or_before_state?(:wtg_for_trip_confirmation)\n self.errors.add(:promised_pickup_date, I18n.t(\"models.vehicle.errors.date_cannot_be_past\"))\n end\n if self.hold_for_pickup_date.present? && self.hold_for_pickup_date_changed? && self.hold_for_pickup_date < Date.today\n self.errors.add(:hold_for_pickup_date, I18n.t(\"models.vehicle.errors.date_cannot_be_past\"))\n end\n if self.sale_hold_action_date.present? && self.sale_hold_action_date_changed? && self.sale_hold_action_date < Date.today\n self.errors.add(:sale_hold_action_date, I18n.t(\"models.vehicle.errors.date_cannot_be_past\"))\n end \n end", "def due_to_cannot_be_in_the_past\n if dueTo.present? && dueTo < Date.today\n errors.add(:dueTo, \"can't be in the past\")\n end\n end", "def date_is_in_past\n\t if date_and_time.present? && date_and_time < Time.now.in_time_zone(\"Pacific Time (US & Canada)\")\n\t \terrors.add(:date_and_time, \"can't be in the past\")\n\t end\n\tend", "def not_in_past\n if due_date < Date.current || start_date < Date.current\n errors.add(:base, \"Cannot create reservation in the past\\n\")\n end\n end", "def check_appointment_date\n if date < Date.today\n errors.add(:appointment_date, \"can't be in the past\")\n end\n end", "def not_in_past\n return unless due_date < Time.zone.today || start_date < Time.zone.today\n errors.add(:base, \"Cannot create reservation in the past.\\n\")\n end", "def deadline_cannot_be_in_the_past\n errors.add(:deadline, \"can't be in the past\") if\n deadline < Date.today\n end", "def date_of_birth_cannot_be_in_the_future\n if date_of_birth > Date.today\n errors.add(:date_of_birth, \"You cannot be born in the future...\")\n end\n end", "def datetimeperformed_cannot_be_in_the_future\n if datetimeperformed.present? && datetimeperformed > Time.now \n errors.add(:datetimeperformed, \"cannot be in the future\")\n end\n end", "def is_start_date_past?\n\t\tif start_date != nil && start_date < Time.now\n\t\t\terrors.add(:start_date, \"can't be in the past\")\n\t\tend\n\tend", "def expiry_date_is_in_the_future\n errors.add(:expiry_date, \"can't be in the past or be today\") if\n !expiry_date.blank? and expiry_date <= Date.today\n end", "def no_past\n if check_in < Date.now\n errors.add(:check_in, \"You can not book in the past\")\n end\n end", "def end_date_can_not_be_before_current_date\n if !end_date.nil? && end_date.past?\n errors.add(:expire_date, \"is before the current date\")\n end\n end", "def future_event?\n if event_date < Date.today\n errors.add(:event_date, \"Must be in the future\")\n end\n end", "def time_cannot_be_in_the_past\n errors.add(:time, \"can't be in the past\") if date == Date.today and !time.blank? and Time.parse(time.strftime(\"%I:%M%p\"))<Time.parse(Time.now.strftime(\"%I:%M%p\"))\n end", "def not_in_past?\n if start_date < DateTime.now || end_date < DateTime.now\n errors.add(:You, \"can't book things in the past, ya goof!\")\n return false\n end\n end", "def date_is_valid\n if !date.is_a? Date\n errors.add :date, I18n.t('activerecord.errors.invalid_date_format')\n elsif date.to_date > Date.today\n errors.add :date, I18n.t('activerecord.errors.future_date')\n end\n end", "def must_be_in_the_past\n return true if observed_on.blank?\n if observed_on > Time.now.in_time_zone(time_zone || user.time_zone).to_date\n errors.add(:observed_on, \"can't be in the future\")\n end\n true\n end", "def check_end_date\n if end_date < Date.today\n \n errors.add(:end_date, \"End Date can only be later than today\")\n end\n end", "def is_a_valid_date\n errors.add(:birthdate, \"is not a valid date.\") if birthdate.present? and birthdate > Date.current\n end", "def validate_birthdate\n errors.add(:birthdate, \"Birthdate can't be in the future\") if birthdate && birthdate > Date.today\n end", "def date_check\n if due_date.present? && due_date < Date.today\n errors.add(:due_date, \"can't be before today\")\n end\n end", "def before_period?\n if Time.now >= self.orderDate \n errors.add(:orderDate, \"Can't be in the past\")\n end\n end", "def validate_date_after_configured_date(record, date_attr, date)\n return if date.blank?\n\n return if date_start_before_end?(Rails.configuration.x.earliest_start_date, date)\n\n record.errors.add(date_attr, :past_date_error, start_date: Rails.configuration.x.earliest_start_date_long_format)\n end", "def not_in_past?\n #return true if self.class == Reservation && self.status != 'reserved'\n if (start_date < Date.today) || (due_date < Date.today)\n errors.add(:base, \"Reservation cannot be made in the past.\\n\")\n return false\n end\n return true\n end", "def is_date_valid?\n\t\tunless self.date_of_booking >= Time.zone.now.beginning_of_day \n\t\t\tself.errors[:date_validation] << \"=> You can't book resource for previous day\"\n\t\tend\n\tend", "def time_must_be_in_the_future\n if !time.present? || DateTime.current > time\n errors.add(:time, \"cant be in the past\")\n end\n end", "def warn_invalid_date; end", "def burn_after_in_future\n if burn_after_date and burn_after_date < Time.now\n errors.add(:burn_after_date, \n \"#{burn_after_date} cannot be in the past, but you can destroy it now.\")\n end\n end", "def validate_date(input_date) \n too_early = Date.parse(\"31 December 2019\")\n too_late = (Date.today)+1\n raise DateError unless ((input_date > too_early) && (input_date < too_late))\n end", "def time_cannot_be_in_the_past\n time1 = DateTime.now - 300.minutes\n time2 = self.time \n if time1 > time2 \n errors.add(:time, \"can't be in the past \")\n end\n end", "def valid_event_date\n if event_date && reporting_year\n last_date = end_of_fiscal_year(reporting_year)\n if event_date > last_date\n errors.add(:event_date, \"The Date of Report cannot be later than the last day of your NTD reporting period. You have selected #{reporting_year} as your Reporting Year, the Date of Report cannot occur after #{last_date.strftime(\"%m/%d/%Y\")}.\")\n end\n end\n end", "def past?\n start_date < Time.now\n end", "def effective_end_date_has_passed\n if effective_end_date.present? && (effective_end_date > Time.zone.now)\n errors.add(:effective_end_date, 'must be in the past')\n end\n end", "def validate_dated_around_now\n self.errors.add(:exam_date, \"ist kein korrektes Datum, bitte versuche es erneut.\") unless ((Date.today)..(5.years.from_now)).include?(self.exam_date)\n end", "def validate_dated_around_now\n self.errors.add(:exam_date, \"ist kein korrektes Datum, bitte versuche es erneut.\") unless ((Date.today)..(5.years.from_now)).include?(self.exam_date)\n end", "def end_date_cannot_be_before_start_date\n\t\tif start_date.present? && end_date.present? && end_date < start_date\n\t\t\terrors.add(:end_date, \"cannot be before start date\")\n\t\tend\n\tend", "def check_out_past\n errors.add(:check_out_at, \"cannot be in the past\") if\n check_out_at < Time.now\n end", "def test_validate_date_in_the_past\n g = GradeEntryForm.new(short_identifier: 'T1',\n date: 1.day.ago,\n is_hidden: false)\n assert g.valid?\n end", "def date_verify\n if end_date && start_date.nil?\n errors.add(:end_date, \"cannot only specify end date\")\n elsif all_day && start_date.nil?\n errors.add(:all_day, \"cannot specify without date\")\n elsif (start_date && end_date) && (start_date > end_date)\n errors.add(:start_date, \"cannot larger than end date\")\n end\n end", "def past?\n (end_date < Date.today)\n end", "def in_past?\n\t\tstart_date < Time.now\n\tend", "def appt_date_after_bus_start\r\n if appt_date.present? && appt_date.strftime(\"%Y\") < \"2017\"\r\n errors.add(:appt_date, \"can't occur before the business started\")\r\n end\r\n end", "def completed_date_cannot_be_less_than_start\n self.errors.add(:completed_at,\"can\\'t be lesser than start date\") if self.start_date && self.completed_at && self.completed && self.completed_at.to_date < self.start_date.to_date\n end", "def date_validation\n\t\tif start_date >= end_date\n \t\terrors.add(:end_date, \"must be greater than start date\")\n \tend\n end", "def check_in_past\n errors.add(:check_in_at, \"cannot be more than one hour in the past\") if\n check_in_at < (Time.now - 1.hour)\n end", "def valid_future_date?(env, date, attribute_name: :embargo_release_date)\n return true if date.present? && date.future?\n\n env.curation_concern.errors.add(attribute_name, \"Must be a future date.\")\n false\n end", "def past?\n date_and_time < Time.now\n end", "def begin_date_cannot_be_greater_than_end_date\n if effective_end_date.present? && effective_end_date > Date.civil(1900, 1, 1) && effective_begin_date.present? && effective_begin_date > Date.civil(1900, 1, 1)\n if (effective_begin_date > effective_end_date)\n local_message = \"Begin date can't be before end date.\"\n errors[:base] << local_message\n return false\n else\n return true\n end\n else\n return true\n end\n end", "def checkin_at_after_or_on_today\n return if dates_blank \n if checkin_at < Date.today\n self.errors.add(:checkin_at, \": Should be greater than or equal to today's date\")\n end\n end", "def past?\n\n false # by default\n end", "def valid_dates\n device_request = DeviceRequest.find(device_request_id)\n current_date = Date.today\n if self.on_date.present?\n self.errors.add :on_date, \"Quotation date can't be future\" if self.on_date > current_date\n self.errors.add :on_date, \"Quotation date should be onwards #{device_request.on_date}\" if self.on_date < device_request.on_date\n end\n end", "def end_date_can_not_be_before_the_live_date\n if !end_date.nil? && end_date<live_date\n errors.add(:expire_date, \"is before the live start date\")\n end\n end", "def latest_date_must_be_higher_than_earliest\n return if earliest_date.blank? or latest_date.blank?\n if earliest_date > latest_date\n errors.add(:earliest_date, I18n.t('error.require_earlier_than_latest_date'))\n end\n end", "def applydate(candidate)\n unless candidate[:date_applied] >= 15.days.ago.to_date\n raise StandardError, 'candidate applied too long ago'\n end\nend", "def has_valid_date?\n self.time_event < Time.now.advance(days: 1)\n end", "def expiration_date_after_today\n errors.add(:expiration_date, 'must be after today') if expiration_date <= Time.now\n end", "def start_must_be_in_the_future\n errors.add(:start, \"must be in the future\") if !start.blank? and start < DateTime.now\n end", "def validate_date_of_birth\n unless self.profile.date_of_birth.blank?\n if self.profile.date_of_birth > 13.years.ago.to_date \n errors.add_to_base(\"You must be over 13.\")\n return false\n end\n end\n end", "def date_consistency\n\t\treturn if [start_date.blank?, end_date.blank?].any?\n\t\terrors.add(:end_date, 'must be after start_date') if start_date > end_date\n\tend", "def diagnosis_date_is_after_dob\n\t\tif !diagnosis_date.blank? && \n\t\t\t!study_subject.blank? && \n\t\t\t!study_subject.dob.blank? && \n\t\t\tdiagnosis_date < study_subject.dob\n\t\t\terrors.add(:diagnosis_date, \"is before study_subject's dob.\") \n\t\tend\n\tend", "def deadline_valid?\n return if self.deadline.nil?\n\n \tif self.deadline < Date.today then\n \t\terrors.add(:deadline, \"Deadline cannot be before today\");\n \tend\n end", "def check_completed_at\n self.errors.add('Completion Date', 'can\\'t be blank') if (self.completed && self.completed_at.blank?)\n end", "def past_event?\n\t\tif self.date != 0\n\t\t\tself.date < Date.today\n\t\telse\n\t\t\ttrue\n\t\tend\n\tend", "def patient_admit_date_is_after_dob\n#\t\tif !patient.nil? && !patient.admit_date.blank? && \n#\t\t\t!pii.nil? && !pii.dob.blank? && patient.admit_date < pii.dob &&\n#\t\t\tpii.dob.to_date != Date.parse('1/1/1900') &&\n\t\tif !patient.nil? && !patient.admit_date.blank? && \n\t\t\t!dob.blank? && patient.admit_date < dob &&\n\t\t\tdob.to_date != Date.parse('1/1/1900') &&\n\t\t\tpatient.admit_date.to_date != Date.parse('1/1/1900')\n\t\t\terrors.add('patient:admit_date', \"is before study_subject's dob.\") \n\t\tend\n\tend", "def admit_date_is_after_dob\n\t\tif !admit_date.blank? && \n\t\t\t!study_subject.blank? && \n\t\t\t!study_subject.dob.blank? && \n\t\t\tstudy_subject.dob.to_date != Date.parse('1/1/1900') &&\n\t\t\tadmit_date < study_subject.dob &&\n\t\t\tadmit_date.to_date != Date.parse('1/1/1900')\n\t\t\terrors.add(:admit_date, \"is before study_subject's dob.\") \n\t\tend\n\tend", "def past?\r\n @at < DateTime.now\r\n end", "def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end", "def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end", "def validate_field_without_promotion\n return unless @designation_history.prev_designation_id.nil?\n begin\n if (@designation_history.new_designation_id != params[:designation_id].to_i) and (@designation_history.applicable_from == params[:designation_history][:applicable_from].to_date)\n flash.now[:error]= l(:designation_not_update_error)\n elsif (@designation_history.applicable_from != params[:designation_history][:applicable_from].to_date) and (@designation_history.new_designation_id == params[:designation_id].to_i)\n flash.now[:error] = l(:desgination_applicable_from_error)\n end\n rescue\n flash.now[:error] = l(:proper_date_error_message)\n end \n render 'systango_hrm_employees/edit' unless flash.now[:error].blank?\n end", "def future_pickup_date\n # Model does not have access to session (and thus the products in the shopping cart);\n # need to pass in the earliest allowable pickup date\n earliest_date = earliest_pickup_date\n earliest_date = Date.today if earliest_date.nil?\n if pickup_date < earliest_date\n errors.add(pickup_date_error, \"#{I18n.t('orders.date_must_be')} #{earliest_date} #{I18n.t('orders.or_later')}\") # \" - The pickup date must be #{earliest_date} or later.\"\n end\n end", "def past?\n due_on < Date.today\n end", "def date_restrictable_must_be_chronological\n\n # bounce unless we have both dates\n return if valid_from.blank? or valid_until.blank?\n\n # otherwise…\n unless valid_until.to_date >= valid_from.to_date\n\n field_name = self.class.human_attribute_name( :valid_from )\n errors.add( :valid_until, :must_be_on_or_after, { field: field_name })\n\n end\n\n end", "def checkout_at_after_checkin_at \n return if dates_blank \n if checkout_at <= checkin_at\n self.errors.add(:checkout_at, ': Should be greater than checkin date ')\n end\n end", "def check_date\n\t\tif self.hasError\n\t\t\terrors.add(\"\", \"You entered Invalid date: \\n - \"+self.interviewer.name)\n\t\t\t# puts \"===================CHECKDATE===================\"\n\t\telsif Time.at(self.sched_end.to_i) <= Time.at(self.sched_start.to_i)\n\t\t\terrors.add(\"\", \"Start time cannot be greater than end time \\n - \"+self.interviewer.name)\n\t\tend\n\tend", "def validate_date\n if params[:date_posted].blank?\n update_error('date_posted', 'Please enter a date.')\n elsif date_posted.nil?\n update_error('date_posted',\n 'We could not parse the date you entered. Please use the format \"yyyy-mm-dd\".')\n else\n year = date_posted.year\n # FIXME: This is not very DRY, as Txaction does this validation. We should\n # probably move date validation to the Txaction model\n if year < 1920 || year > 9999\n update_error('date_posted', \"The date is not valid. Please enter a year between 1920 and 9999.\")\n end\n end\n end", "def ticket_cannot_be_created_after_start_date\n event_start_date = self.event.start_date\n if Date.today > event_start_date\n errors.add(:created_at, \"ticket cannot be created after start date of event\" )\n end\n end", "def invalid_checkin_checkout\n if !self.checkin.nil? && !self.checkout.nil?\n if self.checkin >= self.checkout \n errors.add(:invalid_dates, \"Dates are invalid\")\n end\n end\n end", "def ini_must_be_before_fin_date\n errors.add(:ini_term_date, \"deve ser anterior a data de termo\") unless\n self.ini_term_date < self.fin_term_date\n end", "def is_in_the_past? \n departureOnThe > returnOnThe \n end" ]
[ "0.8995073", "0.8790652", "0.8623019", "0.85883373", "0.85616505", "0.8532153", "0.8494483", "0.846856", "0.8407514", "0.8376288", "0.83178365", "0.8291237", "0.82882917", "0.8220547", "0.8211279", "0.81945646", "0.81247854", "0.81158876", "0.8115762", "0.80910254", "0.804546", "0.79289037", "0.79225683", "0.7894951", "0.783862", "0.7824716", "0.78193235", "0.77915263", "0.7732572", "0.77195275", "0.7667513", "0.765025", "0.7608681", "0.7580953", "0.7567656", "0.7556845", "0.7538388", "0.7522712", "0.7446495", "0.74227303", "0.741673", "0.739454", "0.7363702", "0.7360764", "0.731421", "0.72543895", "0.72250634", "0.71656394", "0.7101519", "0.70996284", "0.7054566", "0.7039773", "0.7030062", "0.7016388", "0.7004186", "0.7004186", "0.70014703", "0.6991839", "0.6989788", "0.69667315", "0.6935833", "0.69290155", "0.69240093", "0.69198847", "0.6918103", "0.6911134", "0.69030297", "0.6898222", "0.68562025", "0.6843415", "0.68332815", "0.68279165", "0.6819922", "0.680147", "0.67862165", "0.6758183", "0.6739769", "0.67355573", "0.67349446", "0.6724726", "0.6722952", "0.6721406", "0.67136717", "0.6668478", "0.6661669", "0.6656863", "0.66536283", "0.6649529", "0.6649529", "0.6647444", "0.6631348", "0.6626153", "0.66248167", "0.66151625", "0.6596388", "0.6586416", "0.65858376", "0.65829223", "0.65773815", "0.6574872" ]
0.8589923
3
SQL to BEGIN a transaction.
def begin_transaction_sql SQL_BEGIN end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def TransactionBegin()\n\t@dbh.do(\"BEGIN\")\nend", "def begin_db_transaction\n log('BEGIN', 'TRANSACTION') { @connection.begin }\n end", "def start_transaction!\n fail DbMod::Exceptions::AlreadyInTransaction if @in_transaction\n @in_transaction = true\n\n query 'BEGIN'\n end", "def begin_db_transaction\n # PG driver doesn't really do anything on setAutoCommit(false)\n # except for commit-ing a previous pending transaction if any\n log('/* BEGIN */') { @connection.begin }\n end", "def begin_db_transaction\n log('begin transaction', nil) do\n begin_isolated_db_transaction(default_transaction_isolation)\n end\n end", "def begin_transaction(conn)\n log_info(TRANSACTION_BEGIN)\n conn.setAutoCommit(false)\n conn\n end", "def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end", "def begin_transaction(conn, opts={})\n log_yield(TRANSACTION_BEGIN){conn.setAutoCommit(false)}\n conn\n end", "def begin_transaction\n return System.begin_transaction\n end", "def commit_transaction_sql\n SQL_COMMIT\n end", "def commit_transaction_sql\n SQL_COMMIT\n end", "def begin_transaction(conn, opts=OPTS)\n log_connection_yield('Transaction.begin', conn){conn.autocommit = false}\n set_transaction_isolation(conn, opts)\n end", "def begin_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n _trans(conn)[:savepoints][-1][:obj] = log_connection_yield('Transaction.savepoint', conn){conn.set_savepoint}\n else\n log_connection_yield('Transaction.begin', conn){conn.setAutoCommit(false)}\n set_transaction_isolation(conn, opts)\n end\n end", "def begin_transaction(conn, opts={})\n set_transaction_isolation(conn, opts)\n super\n end", "def begin_db_transaction\n @connection.autocommit = false\n end", "def begin_db_transaction() end", "def begin_db_transaction() end", "def begin_isolated_db_transaction(isolation)\n name = isolation.to_s.upcase; name.sub!('_', ' ')\n log(\"/* BEGIN */; SET TRANSACTION ISOLATION LEVEL #{name}\") do\n @connection.begin(isolation)\n end\n end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def begin_isolated_db_transaction(isolation)\n log(\"BEGIN ISOLATED - #{isolation}\", 'TRANSACTION') { @connection.begin(isolation) }\n end", "def begin_new_transaction(conn, opts)\n super\n if opts.has_key?(:synchronous)\n case sync = opts[:synchronous]\n when true\n sync = :on\n when false\n sync = :off\n when nil\n return\n end\n\n log_connection_execute(conn, \"SET LOCAL synchronous_commit = #{sync}\")\n end\n end", "def commit_transaction(tx)\n tx.execute\n end", "def restart_transaction\n ActiveRecord::Base.connection.execute(\"COMMIT\")\n ActiveRecord::Base.connection.execute(\"BEGIN\")\n end", "def begin_db_transaction() \n log('Opening boxcar', 'begin_db_transaction()')\n @command_boxcar = []\n end", "def transaction\n start_transaction!\n\n result = yield\n\n query 'COMMIT'\n\n result\n rescue\n query 'ROLLBACK'\n raise\n\n ensure\n end_transaction!\n end", "def begin_transaction(graph_name)\n RDF::Transaction.new(graph: graph_name)\n end", "def transaction\n start_transaction\n\n yield\n ensure\n end_transaction if transaction_started?\n end", "def begin_transaction(mutable: false, graph_name: nil)\n raise NotImplementedError\n end", "def transaction(&block); end", "def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end", "def transaction\n start\n yield self\n rescue Object => ex\n rollback\n debug \"#{ex.class}: #{ex.message}\"\n ex.backtrace.each { |line| debug line }\n else\n commit\n end", "def commit_db_transaction\n log('COMMIT', 'TRANSACTION') { @connection.commit }\n end", "def commit()\n check_return_code(PureHailDB.ib_trx_commit(@trx_ptr))\n end", "def transaction(options={}, &block)\n connection.transaction(options.update(:requires_new => true), &block)\n end", "def transaction(start_db_transaction=true)\n yield\n end", "def transaction\n raise Mysql::Error, 'Not Connected' if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end", "def commit\n IBM_DB.commit(@conn)\n end", "def exec_rollback_db_transaction\n @connection.rollback\n @connection.autocommit = true\n end", "def transaction(mode = :deferred, &block)\n @db.transaction(mode, &block)\n end", "def add_start_transaction!(command)\n command.tap do |c|\n if starting_transaction?\n c[:startTransaction] = true\n end\n end\n end", "def begin\n raise \"Illegal state for begin: #{@state}\" unless @state == :none\n each_adapter(:connect_adapter, [:log_fatal_transaction_breakage])\n each_adapter(:begin_adapter, [:rollback_and_close_adapter_if_begin, :close_adapter_if_none])\n @state = :begin\n end", "def start_transaction\n NewRelic::Agent.instance.events.notify(:start_transaction)\n end", "def begin\n new_transaction = Transaction.new(@data)\n\n # Record nested transactions in teh parent transactions buffer\n if current_transaction\n current_transaction.add_nested_transaction(new_transaction)\n end\n\n @all_transactions << new_transaction\n end", "def transaction\n raise Mysql2::Error, 2002 if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql2::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end", "def transaction\n raise ArgumentError, 'No block was given' unless block_given?\n\n with_client do |client|\n begin\n client.query('BEGIN')\n yield client\n client.query('COMMIT')\n rescue StandardError => e\n client.query('ROLLBACK')\n raise e\n end\n end\n end", "def commit_transaction(tx)\n tx.execute(self)\n end", "def begin\n self.transaction_count += 1\n end", "def begin\n @timestamp = Time.now\n # NOTE: yield self is a bit of a smell to me, but I am okay with this\n # as the block is evaluated in the context of the caller and not of\n # the Transaction object.\n yield self if block_given?\n ensure\n finished\n end", "def initial_commit?; end", "def initial_commit?; end", "def transaction\n @pool.hold do |conn|\n @transactions ||= []\n if @transactions.include? Thread.current\n return yield(conn)\n end\n log_info(SQL_BEGIN)\n conn.execute(SQL_BEGIN)\n begin\n @transactions << Thread.current\n yield(conn)\n rescue Exception => e\n log_info(SQL_ROLLBACK)\n conn.execute(SQL_ROLLBACK)\n raise e unless Error::Rollback === e\n ensure\n unless e\n log_info(SQL_COMMIT)\n conn.execute(SQL_COMMIT)\n end\n @transactions.delete(Thread.current)\n end\n end\n end", "def autocommit\n IBM_DB.autocommit(@conn) == 1\n end", "def begin_isolated_db_transaction(isolation)\n @connection.transaction transaction_isolation_levels.fetch(isolation, isolation)\n end", "def transaction(&block)\n yield\n commit\n end", "def rollback_transaction_sql\n SQL_ROLLBACK\n end", "def rollback_transaction_sql\n SQL_ROLLBACK\n end", "def transaction; end", "def transaction; end", "def transaction; end", "def transaction(opts={}, &blk)\n Toshi.db.transaction(opts, &blk)\n end", "def begin_transaction read_only: nil, previous_transaction: nil, read_time: nil\n if read_only\n transaction_options = Google::Cloud::Datastore::V1::TransactionOptions.new\n transaction_options.read_only = \\\n Google::Cloud::Datastore::V1::TransactionOptions::ReadOnly.new \\\n read_time: read_time_to_timestamp(read_time)\n\n end\n if previous_transaction\n transaction_options ||= \\\n Google::Cloud::Datastore::V1::TransactionOptions.new\n rw = Google::Cloud::Datastore::V1::TransactionOptions::ReadWrite.new(\n previous_transaction: previous_transaction.encode(\"ASCII-8BIT\")\n )\n transaction_options.read_write = rw\n end\n service.begin_transaction project_id: project, database_id: database, transaction_options: transaction_options\n end", "def transaction(&block)\n block.call\n end", "def start\n raise TransactionError, \"Transaction already opened.\" unless @id.nil?\n\n ensure_service!\n tx_res = service.begin_transaction \\\n previous_transaction: @previous_transaction\n @id = tx_res.transaction\n end", "def commit_transaction(conn, opts={})\n log_yield(TRANSACTION_COMMIT){conn.commit}\n end", "def commit_db_transaction\n @transaction = @connection.commit\n end", "def transaction(graph_name = nil, &block)\n tx = begin_transaction(graph_name)\n begin\n case block.arity\n when 1 then block.call(tx)\n else tx.instance_eval(&block)\n end\n rescue => error\n rollback_transaction(tx)\n raise error\n end\n commit_transaction(tx)\n self\n end", "def commit_db_transaction\n log('commit transaction', nil) { @connection.commit }\n end", "def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end", "def begin_transaction\n if @transaction_stack.empty?\n if @transaction_thread\n PEROBS.log.fatal 'transaction_thread must be nil'\n end\n @transaction_thread = Thread.current\n # The new transaction is the top-level transaction. Flush the write\n # buffer to save the current state of all objects.\n flush\n else\n # Nested transactions are currently only supported within the same\n # thread. If we are in another thread, raise TransactionInOtherThread\n # to pause the calling thread for a bit.\n if @transaction_thread != Thread.current\n raise TransactionInOtherThread\n end\n # Save a copy of all objects that were modified during the enclosing\n # transaction.\n @transaction_stack.last.each do |id|\n @transaction_objects[id]._stash(@transaction_stack.length - 1)\n end\n end\n # Push a transaction buffer onto the transaction stack. This buffer will\n # hold a reference to all objects modified during this transaction.\n @transaction_stack.push(::Array.new)\n end", "def commit_transaction(conn)\n log_info(TRANSACTION_COMMIT)\n conn.commit\n end", "def transaction( &block )\n connect do | conn |\n conn.transaction do | conn |\n yield SqlRunner.new(SingleConnectionPool.new( conn ))\n end\n end\n end", "def scaffold_transaction(&block)\n transaction(&block)\n end", "def exec_rollback_db_transaction\n log('ROLLBACK', 'TRANSACTION') { @connection.rollback }\n end", "def commit\n query 'commit'\n self\n end", "def within_transaction; end", "def within_transaction; end", "def start(&block)\n transaction.start do\n run_callbacks(:transaction, &block)\n end\n end", "def transaction\n begin\n if block_given?\n begin_db_transaction\n result = yield\n commit_db_transaction\n result\n end\n rescue Exception => database_transaction_rollback\n rollback_db_transaction\n raise\n end\n end", "def commit_transaction(conn, opts=OPTS)\n log_connection_yield('Transaction.commit', conn){conn.commit}\n end", "def begin\n db.transaction do\n yield\n end\n end", "def on_prepare_transaction_commit(unit, transaction); end", "def transaction(&block)\n ActiveRecord::Base.transaction(&block)\n end", "def startRun\n db_cached_connect\n\n @dbh.do(\"BEGIN TRANSACTION;\")\n @dbh.do(\"SELECT startRun();\")\n end", "def begin\n raise \"Nested transactions are not allowed\" if @state != :INITIALIZED\n begin\n case @isolation\n when Hash\n if @isolation[:timestamp]\n @grpc_transaction = @connection.session.create_snapshot timestamp: @isolation[:timestamp]\n elsif @isolation[:staleness]\n @grpc_transaction = @connection.session.create_snapshot staleness: @isolation[:staleness]\n elsif @isolation[:strong]\n @grpc_transaction = @connection.session.create_snapshot strong: true\n else\n raise \"Invalid snapshot argument: #{@isolation}\"\n end\n when :read_only\n @grpc_transaction = @connection.session.create_snapshot strong: true\n when :pdml\n @grpc_transaction = @connection.session.create_pdml\n else\n @begin_transaction_selector = Google::Cloud::Spanner::V1::TransactionSelector.new \\\n begin: Google::Cloud::Spanner::V1::TransactionOptions.new(\n read_write: Google::Cloud::Spanner::V1::TransactionOptions::ReadWrite.new\n )\n\n end\n @state = :STARTED\n rescue Google::Cloud::NotFoundError => e\n if @connection.session_not_found? e\n @connection.reset!\n retry\n end\n @state = :FAILED\n raise\n rescue StandardError\n @state = :FAILED\n raise\n end\n end", "def transaction\n @pool.hold do |conn|\n @transactions ||= []\n if @transactions.include? Thread.current\n return yield(conn)\n end\n conn.execute(SQL_BEGIN)\n begin\n @transactions << Thread.current\n result = yield(conn)\n conn.execute(SQL_COMMIT)\n result\n rescue => e\n conn.execute(SQL_ROLLBACK)\n raise e unless Error::Rollback === e\n ensure\n @transactions.delete(Thread.current)\n end\n end\n end", "def start_transaction(**options)\n get_current_hub&.start_transaction(**options)\n end", "def test_commit_empty()\n t = Scalaroid::Transaction.new()\n t.commit()\n t.close_connection()\n end", "def to_script\n s = TRANSACTION_START[db_type].dup\n s << \"\\n\"\n rows.each {|r| s << r.insert_sql(db_type) }\n s << \"#{TRANSACTION_END[db_type]}\\n\"\n s\n end", "def transaction(*sqls)\n begin\n db = SQLite3::Database.new(@@db_file)\n @@_set_db_handler.call(db)\n db.transaction do\n sqls.each do |sql|\n db.execute(sql)\n end\n end\n ensure\n db.close\n end\n end", "def commit_db_transaction() end", "def commit_db_transaction() end", "def start(&block)\n res = database.execute_request(\n :post,\n '/transaction/begin',\n headers: { content_type: 'text/plain' }\n ).body\n self.id = res\n @state = :started\n instance_eval(&block) if block_given?\n self\n end", "def transaction(&block)\n @in_transaction += 1\n begin\n yield self\n self.commit if @in_transaction > 0\n rescue => e\n self.rollback\n raise e\n ensure\n @in_transaction -= 1 unless @in_transaction == 0\n end\n end", "def commit_transaction(conn, opts=OPTS)\n if (s = opts[:prepare]) && savepoint_level(conn) <= 1\n log_connection_execute(conn, \"PREPARE TRANSACTION #{literal(s)}\")\n else\n super\n end\n end", "def with_transaction(&block)\n base_model.transaction(&block)\n end", "def transaction(&block)\n begin\n @store.transaction\n block.call(@store)\n @store.commit\n rescue SQLite3::Exception => exception\n raise \"SQLite exception: #{exception}\"\n end\n end" ]
[ "0.86671495", "0.86671495", "0.8375693", "0.82687974", "0.8057486", "0.79135376", "0.7744375", "0.7534514", "0.72651887", "0.72571343", "0.71396583", "0.7085154", "0.7085154", "0.70602703", "0.6879832", "0.67659235", "0.66905415", "0.66577226", "0.66577226", "0.6538267", "0.6528857", "0.6528857", "0.651218", "0.64968663", "0.64423835", "0.6406591", "0.63544023", "0.61515754", "0.6151066", "0.6117512", "0.6101595", "0.60704416", "0.6069693", "0.60369945", "0.60310686", "0.6026505", "0.6012921", "0.59893167", "0.59830797", "0.59681576", "0.5967293", "0.5953433", "0.5938607", "0.5927815", "0.5925335", "0.5888877", "0.588853", "0.5882741", "0.58766353", "0.5846157", "0.58396494", "0.5834522", "0.5834522", "0.582224", "0.58220804", "0.58150643", "0.5810514", "0.5809238", "0.5809238", "0.5797992", "0.5797992", "0.5797992", "0.57964796", "0.5782439", "0.5773314", "0.57709575", "0.574689", "0.574254", "0.5741618", "0.5740944", "0.57398915", "0.57377493", "0.57235634", "0.57065785", "0.57008487", "0.56970346", "0.5691206", "0.5691045", "0.5691045", "0.5688833", "0.5684931", "0.56689847", "0.56588566", "0.5656972", "0.5654693", "0.56323355", "0.56155246", "0.56113344", "0.5604524", "0.55890155", "0.5570751", "0.555798", "0.555691", "0.555691", "0.5555814", "0.55401325", "0.5528528", "0.5520276", "0.5499084" ]
0.8599903
2
SQL to COMMIT a transaction.
def commit_transaction_sql SQL_COMMIT end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def commit_transaction(tx)\n tx.execute\n end", "def commit()\n check_return_code(PureHailDB.ib_trx_commit(@trx_ptr))\n end", "def commit_db_transaction\n log('COMMIT', 'TRANSACTION') { @connection.commit }\n end", "def commit_db_transaction\n @transaction = @connection.commit\n end", "def commit_transaction(conn)\n log_info(TRANSACTION_COMMIT)\n conn.commit\n end", "def commit_transaction(conn, opts=OPTS)\n log_connection_yield('Transaction.commit', conn){conn.commit}\n end", "def commit_transaction(conn, opts={})\n log_yield(TRANSACTION_COMMIT){conn.commit}\n end", "def commit_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n if supports_releasing_savepoints?\n log_connection_yield('Transaction.release_savepoint', conn){conn.release_savepoint(savepoint_obj(conn))}\n end\n else\n log_connection_yield('Transaction.commit', conn){conn.commit}\n end\n end", "def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end", "def exec_rollback_db_transaction\n log('ROLLBACK', 'TRANSACTION') { @connection.rollback }\n end", "def exec_rollback_db_transaction\n @connection.rollback\n @connection.autocommit = true\n end", "def rollback_db_transaction\n execute(\"ROLLBACK\")\n end", "def rollback_db_transaction\n execute(\"ROLLBACK\")\n end", "def commit_db_transaction\n log('commit transaction', nil) { @connection.commit }\n end", "def commit\n @MySQLConnection.query('commit')\n end", "def commit_transaction(conn)\n log_connection_execute(conn, commit_transaction_sql) unless Thread.current[:sequel_transaction_depth] > 1\n end", "def commit\n IBM_DB.commit(@conn)\n end", "def rollback_transaction_sql\n SQL_ROLLBACK\n end", "def rollback_transaction_sql\n SQL_ROLLBACK\n end", "def commit\n query 'commit'\n self\n end", "def commit_transaction(tx)\n tx.execute(self)\n end", "def commit_db_transaction() end", "def commit_db_transaction() end", "def commit( transaction )\n fail NotImplementedError\n end", "def commit!\n _commit( false )\n end", "def commit\n db_interface.commit\n end", "def transaction\n start_transaction!\n\n result = yield\n\n query 'COMMIT'\n\n result\n rescue\n query 'ROLLBACK'\n raise\n\n ensure\n end_transaction!\n end", "def rollback_db_transaction() end", "def rollback_db_transaction() end", "def commit\n @db.commit\n end", "def commit\n # no op\n end", "def commit(transaction)\n raise NotImplementedError\n end", "def commit; end", "def commit; end", "def commit; end", "def rollback_transaction(conn)\n log_info(TRANSACTION_ROLLBACK)\n conn.rollback\n end", "def commiter() end", "def commit_transaction(conn, opts=OPTS)\n if (s = opts[:prepare]) && savepoint_level(conn) <= 1\n log_connection_execute(conn, \"PREPARE TRANSACTION #{literal(s)}\")\n else\n super\n end\n end", "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def transaction(&block)\n yield\n commit\n end", "def rollback_db_transaction\n @transaction = @connection.rollback\n end", "def commit( defer=false )\n save_logic( defer, false )\n end", "def commit mutations, transaction: nil\n mode = transaction.nil? ? :NON_TRANSACTIONAL : :TRANSACTIONAL\n service.commit project_id: project, database_id: database, mode: mode,\n mutations: mutations, transaction: transaction\n end", "def rollback_transaction(conn, opts={})\n log_yield(TRANSACTION_ROLLBACK){conn.rollback}\n end", "def commit(soft_commit = false)\n session.commit soft_commit\n end", "def rollback_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n log_connection_yield('Transaction.rollback_savepoint', conn){conn.rollback(savepoint_obj(conn))}\n else\n log_connection_yield('Transaction.rollback', conn){conn.rollback}\n end\n end", "def TransactionBegin()\n\t@dbh.do(\"BEGIN\")\nend", "def commit\n writer.commit\n end", "def restart_transaction\n ActiveRecord::Base.connection.execute(\"COMMIT\")\n ActiveRecord::Base.connection.execute(\"BEGIN\")\n end", "def remove_transaction(conn)\n conn.setAutoCommit(true) if conn\n super\n end", "def rollback_db_transaction\n log('rollback transaction', nil) { @connection.rollback }\n end", "def rollback_transaction(tx)\n tx.rollback\n end", "def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end", "def commit_transaction\n # TODO: wrap #rtErrPrimOutsideTrans in OutsideOfTransactionException\n unless System.commit_transaction\n raise CommitFailedException\n end\n return true\n end", "def commit!() raise NotImplementedError end", "def commit(txn)\n @current_transaction = txn.outer\n if @current_transaction\n @mode = @current_transaction.mode\n @current_transaction.read_cache = @read_cache\n @current_transaction.write_cache = @write_cache\n @current_transaction.delete_cache = @delete_cache\n else\n close\n end\n end", "def flush_transaction\n puts \"Flushing Transaction.\"\n end", "def commit()\n @conn.commit if @conn\n Log.i(\"#{@count} new bookings added\")\n end", "def begin_db_transaction\n @connection.autocommit = false\n end", "def commit()\n #This is a stub, used for indexing\n end", "def commit\r\n self.class.commit_orders [self]\r\n end", "def test_transactions(table=\"test_monetdb_transactions\", columndefs=['col1 INT', 'col2 VARCHAR(255)'])\n test_create_table(table, columndefs)\n \n data = [1, 'aa'] \n values = \"\"\n \n data.each do |d| values += '\\'' + d.to_s + '\\'' + ',' end\n values = values.chop # remove last ',' character \n \n insert = \"INSERT INTO \" + table + \" VALUES \" + \" ( \" + values + \" )\"\n \n @db.query('START TRANSACTION')\n @db.auto_commit(flag=false) # if @db.auto_commit?\n @db.query(insert)\n\n @db.query(\"COMMIT\") \n \n res = @db.query('SELECT * FROM ' + table)\n rows_committed = res.fetch_all\n res.free\n \n # create a save point\n @db.save\n @db.query(\"SAVEPOINT #{@db.transactions} ;\")\n \n @db.query(insert)\n \n # rollback to savepoint\n @db.query(\"ROLLBACK TO SAVEPOINT #{@db.transactions};\")\n @db.release\n \n res = @db.query('SELECT * FROM ' + table)\n rows_rolled_back = res.fetch_all\n res.free\n \n assert_equal(rows_committed, rows_rolled_back)\n \n # restore autocommit for remaining tests\n @db.auto_commit(flag=true) \n end", "def commit=(_arg0); end", "def commit=(_arg0); end", "def tx_commit\n write_bytes FrameBytes.tx_commit(@id)\n expect :tx_commit_ok\n nil\n end", "def rollback_transaction(tx)\n # nothing to do\n end", "def commit\n {}\n end", "def commit\n {}\n end", "def commit!(rollback: true, rollback_interval: 60)\n @@api.post(endpoint: self.endpoint + ['commit'], params: {'rollback' => rollback, 'rollback_interval' => rollback_interval})\n end", "def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end", "def rollback_transaction(conn, opts=OPTS)\n log_connection_yield('Transaction.rollback', conn){conn.rollback}\n end", "def end_transaction!\n @in_transaction = false\n end", "def commit_transaction\n\t super\n\n\t arguments.dup.each do |key, value|\n if value.respond_to?(:transaction_proxy?) && value.transaction_proxy?\n\t\t arguments.update!(key, value.__getobj__)\n\t\tend\n\t end\n\tend", "def transaction; end", "def transaction; end", "def transaction; end", "def tx_commit(&block)\n @connection.send_frame(Protocol::Tx::Commit.encode(@id))\n\n self.redefine_callback :tx_commit, &block\n self\n end", "def on_prepare_transaction_commit(unit, transaction); end", "def close\n commit\n end", "def commit\n # Nothing to do for an in memory database\n end", "def transaction(&block); end", "def remove_transaction(conn, committed)\n conn.autocommit = true\n ensure\n super\n end", "def exec_rollback_to_savepoint(name = current_savepoint_name)\n log(\"ROLLBACK TO SAVEPOINT #{name}\", 'TRANSACTION') { @connection.rollback_savepoint(name) }\n end", "def commit_transaction(session)\n session.commit_transaction\n Threaded.clear_modified_documents(session).each do |doc|\n doc.run_after_callbacks(:commit)\n end\n end", "def after_commit(&blk)\n ActiveRecord::Base.connection.add_transaction_record(\n AfterCommitWrapper.new(&blk)\n )\n end", "def commit!\n rsp = post(\"<commit/>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "def commit\n if defined? _commit\n if dirty?\n _commit\n end\n end\n nil\n end", "def transaction\n @pool.hold do |conn|\n @transactions ||= []\n if @transactions.include? Thread.current\n return yield(conn)\n end\n log_info(SQL_BEGIN)\n conn.execute(SQL_BEGIN)\n begin\n @transactions << Thread.current\n yield(conn)\n rescue Exception => e\n log_info(SQL_ROLLBACK)\n conn.execute(SQL_ROLLBACK)\n raise e unless Error::Rollback === e\n ensure\n unless e\n log_info(SQL_COMMIT)\n conn.execute(SQL_COMMIT)\n end\n @transactions.delete(Thread.current)\n end\n end\n end", "def transaction\n start\n yield self\n rescue Object => ex\n rollback\n debug \"#{ex.class}: #{ex.message}\"\n ex.backtrace.each { |line| debug line }\n else\n commit\n end", "def begin_transaction_sql\n SQL_BEGIN\n end", "def begin_transaction_sql\n SQL_BEGIN\n end", "def begin_db_transaction() end", "def begin_db_transaction() end", "def commit\n sanity_check\n @handle.commit\n end", "def rollback\n @MySQLConnection.query('rollback')\n end", "def commit\n head.commit\n end" ]
[ "0.8168222", "0.8168222", "0.76139814", "0.7527497", "0.74450666", "0.7280488", "0.7276991", "0.7221815", "0.721497", "0.7214349", "0.71709657", "0.7129977", "0.71051455", "0.7083729", "0.7083729", "0.7081063", "0.7064411", "0.70503277", "0.7020082", "0.69886315", "0.69886315", "0.6984518", "0.69498336", "0.6917417", "0.6917417", "0.68512625", "0.6787064", "0.6738732", "0.6711736", "0.6710169", "0.6710169", "0.6673207", "0.66642904", "0.66285664", "0.6561259", "0.6561259", "0.6561259", "0.6550878", "0.6507882", "0.6441874", "0.6423802", "0.6423802", "0.64042497", "0.6389218", "0.6360411", "0.6358634", "0.63333327", "0.63279414", "0.6295039", "0.62848353", "0.62619054", "0.6247805", "0.62181747", "0.6211694", "0.6209313", "0.61937535", "0.6192577", "0.61870545", "0.61802405", "0.6170183", "0.6170028", "0.61691105", "0.6153272", "0.6152439", "0.6142514", "0.61422044", "0.61422044", "0.6138751", "0.6130673", "0.6126968", "0.6126968", "0.6114677", "0.6113691", "0.611367", "0.6103737", "0.6102762", "0.6098732", "0.6098732", "0.6098732", "0.60870534", "0.60821366", "0.6061684", "0.6061476", "0.6024348", "0.6006222", "0.5951594", "0.59387845", "0.5938358", "0.59334123", "0.5924083", "0.59162605", "0.5914301", "0.5905653", "0.5905653", "0.5886998", "0.5886998", "0.5886937", "0.58760464", "0.5873438" ]
0.838998
1
SQL to ROLLBACK a transaction.
def rollback_transaction_sql SQL_ROLLBACK end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback_db_transaction\n execute(\"ROLLBACK\")\n end", "def rollback_db_transaction\n execute(\"ROLLBACK\")\n end", "def exec_rollback_db_transaction\n log('ROLLBACK', 'TRANSACTION') { @connection.rollback }\n end", "def rollback\n @MySQLConnection.query('rollback')\n end", "def rollback\n current_transaction.rollback\n last_transaction = @all_transactions.pop\n end", "def rollback\n query 'rollback'\n self\n end", "def rollback()\n check_return_code(PureHailDB.ib_trx_rollback(@trx_ptr))\n end", "def rollback_savepoint_sql(depth)\n SQL_ROLLBACK_TO_SAVEPOINT % depth\n end", "def rollback_transaction(conn)\n log_info(TRANSACTION_ROLLBACK)\n conn.rollback\n end", "def rollback_db_transaction\n @transaction = @connection.rollback\n end", "def exec_rollback_db_transaction\n @connection.rollback\n @connection.autocommit = true\n end", "def rollback_db_transaction() end", "def rollback_db_transaction() end", "def rollback_transaction(tx)\n tx.rollback\n end", "def exec_rollback_to_savepoint(name = current_savepoint_name)\n log(\"ROLLBACK TO SAVEPOINT #{name}\", 'TRANSACTION') { @connection.rollback_savepoint(name) }\n end", "def rollback\n IBM_DB.rollback(@conn)\n end", "def rollback_db_transaction\n log('rollback transaction', nil) { @connection.rollback }\n end", "def rollback_transaction(tx)\n # nothing to do\n end", "def rollback\n raise TransactionRollback.new\n end", "def rollback_transaction(conn, opts={})\n log_yield(TRANSACTION_ROLLBACK){conn.rollback}\n end", "def rollback\n @db.rollback\n end", "def rollback_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n log_connection_yield('Transaction.rollback_savepoint', conn){conn.rollback(savepoint_obj(conn))}\n else\n log_connection_yield('Transaction.rollback', conn){conn.rollback}\n end\n end", "def rollback_db_transaction() \n log('Rolling back boxcar', 'rollback_db_transaction()')\n @command_boxcar = []\n end", "def rollback; end", "def rollback; end", "def rollback; end", "def rollback; end", "def rollback; end", "def rollback transaction\n service.rollback project_id: project, database_id: database, transaction: transaction\n end", "def rollback_transaction(conn, opts=OPTS)\n log_connection_yield('Transaction.rollback', conn){conn.rollback}\n end", "def rollback\n # implement in subclasses\n end", "def rollback(&block)\n block_given? ? transaction {yield; rollback} : (raise Rollback)\n end", "def rollback\n puts colorBlue('rolling back to commit blah')\n end", "def rollback\n end", "def commit_transaction_sql\n SQL_COMMIT\n end", "def commit_transaction_sql\n SQL_COMMIT\n end", "def rolledback!\n @on_rollback.each do |callback|\n callback.call\n end\n clear\n end", "def rollback()\n #This is a stub, used for indexing\n end", "def rollback\n sanity_check\n @handle.rollback\n end", "def abort_transaction\n return System.abort_transaction\n end", "def rollback\n raise \"Illegal state for rollback: #{@state}\" unless @state == :begin\n each_adapter(:rollback_adapter_if_begin, [:rollback_and_close_adapter_if_begin, :close_adapter_if_none])\n each_adapter(:rollback_prepared_adapter_if_prepare, [:rollback_prepared_and_close_adapter_if_begin, :close_adapter_if_none])\n each_adapter(:close_adapter_if_open, [:log_fatal_transaction_breakage])\n @state = :rollback\n end", "def tx_rollback\n write_bytes FrameBytes.tx_rollback(@id)\n expect :tx_rollback_ok\n nil\n end", "def end_transaction!\n @in_transaction = false\n end", "def rollback opts = {}\n update opts.merge(:data => xml.rollback)\n end", "def rollback\n objects.clear\n load\n finish_transaction\n end", "def tx_rollback(&block)\n @connection.send_frame(Protocol::Tx::Rollback.encode(@id))\n\n self.redefine_callback :tx_rollback, &block\n self\n end", "def rollback\n FileUtils.rm_r(path) if File.exist?(path)\n transaction.rollback\n end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def void_last_transaction\n @total-=self.total\n end", "def rollback\n @repo.rollback\n end", "def abort_transaction\n if @transaction_stack.empty?\n PEROBS.log.fatal 'No ongoing transaction to abort'\n end\n @transaction_stack.pop.each do |id|\n @transaction_objects[id]._restore(@transaction_stack.length)\n end\n @transaction_thread = nil\n end", "def rollback\n without_transactions do\n repository.transactions_log.delete_if do |(method, options)|\n\n begin\n case method\n when :ingest\n repository.purge_object :pid => options[:pid]\n\n when :modify_object\n repository.modify_object options\n\n when :add_datastream\n repository.purge_datastream :pid => options[:pid], :dsid => options[:dsid]\n\n when :add_relationship\n repository.purge_relationship options[:options].merge(:pid => options[:pid])\n\n when :purge_relationship\n repository.add_relationship options[:options].merge(:pid => options[:pid])\n\n when :purge_object\n repository.ingest :pid => options[:pid], :file => options[:foxml]\n\n when :set_datastream_options\n repository.set_datastream_options options\n\n when :modify_datastream\n repository.purge_object :pid => options[:pid] rescue nil\n repository.ingest :pid => options[:pid], :file => options[:foxml]\n\n when :purge_datastream\n repository.purge_object :pid => options[:pid] rescue nil\n repository.ingest :pid => options[:pid], :file => options[:foxml]\n end\n rescue\n # no-op\n end\n\n run_hook :after_rollback, :pid => options[:pid], :method => method, :options => options\n\n end\n end\n true\n end", "def rollback transaction_id\n service.rollback path, transaction_id\n @last_updated_at = Time.now\n true\n end", "def restart_transaction\n ActiveRecord::Base.connection.execute(\"COMMIT\")\n ActiveRecord::Base.connection.execute(\"BEGIN\")\n end", "def rollback\n if @id.nil?\n raise TransactionError, \"Cannot rollback when not in a transaction.\"\n end\n\n ensure_service!\n service.rollback @id\n true\n end", "def void_last_transaction\n self.total -= @last_transaction.pop\n end", "def abort_transaction(session)\n session.abort_transaction\n Threaded.clear_modified_documents(session).each do |doc|\n doc.run_after_callbacks(:rollback)\n end\n end", "def post_transaction_process\n fail(ActiveRecord::Rollback) unless @status\n end", "def rollback\n _called.reverse_each do |command|\n begin\n command.rollback\n rescue => error\n raise Errors::InvokerRollbackError.new(error: error, command: command, invoker: self, backtrace: error.backtrace)\n end\n end\n end", "def pay_back\n return false unless valid?\n\n commit_or_rollback do\n res = save_expense\n res = create_ledger\n\n set_errors(expense, ledger) unless res\n\n res\n end\n end", "def rollback()\n conn = connection(@rollback_uri)\n resp = conn.post \n return DeziResponse.new(resp)\n end", "def remove_transaction(conn, committed)\n if jdbc_level = _trans(conn)[:original_jdbc_isolation_level]\n log_connection_yield(\"Transaction.restore_isolation_level\", conn){conn.setTransactionIsolation(jdbc_level)}\n end\n unless in_savepoint?(conn)\n conn.setAutoCommit(true)\n end\n ensure\n super\n end", "def abort_transaction!\n @ignore_trace = true\n end", "def rollback\n Rails.logger.debug \"Rollback not implemented: #{self.class.to_s}\"\n end", "def disconnect_connection(conn)\n conn.RollbackTrans rescue nil\n super\n end", "def rollback!\n self.revert_to! self.previous_version\n end", "def rollback!\n restore_attributes\n end", "def rollback()\n oldpos = @checkpoints.pop\n unless oldpos\n oldpos = 0\n end\n self.pos = oldpos\n return self \n end", "def rollback\n each {|transition| transition.rollback}\n end", "def flush_transaction\n puts \"Flushing Transaction.\"\n end", "def rollback_balance(transaction)\n if transaction.succeeded?\n sign = transaction.payment? ? -1 : 1\n self.balance.update_attributes!(amount: (self.balance.amount + (BigDecimal.new(transaction.amount_was) * sign)))\n end\n end", "def rollback\n each { |transition| transition.rollback }\n end", "def void_last_transaction\n self.total = self.total - self.last_transaction\n end", "def void_last_transaction\n self.total = self.total - self.last_transaction\n end", "def void_last_transaction\n self.total = self.total - self.last_transaction\n end", "def rollback\n self.revert_to self.previous_version\n end", "def transaction\n start_transaction!\n\n result = yield\n\n query 'COMMIT'\n\n result\n rescue\n query 'ROLLBACK'\n raise\n\n ensure\n end_transaction!\n end", "def rollback_transaction?\n false\n end", "def commit()\n check_return_code(PureHailDB.ib_trx_commit(@trx_ptr))\n end", "def rollback\n true\n end", "def commit_transaction(tx)\n tx.execute\n end", "def void_last_transaction\n @items.pop\n @total -= @transactions.pop\n end", "def finish_transaction!\n threadlocal_graph_info[:tx_depth] -= 1 rescue nil\n end", "def end_transaction(result = nil)\n agent&.end_transaction(result)\n end", "def endRun\n db_cached_connect\n\n @dbh.do(\"SELECT endRun();\")\n @dbh.do(\"COMMIT TRANSACTION;\")\n end", "def rollback\n { rollback: {} }.to_json\n end", "def rollback!\n if (@status == 'DELETED')\n self.errors.add(:base, 'Campaign is already deleted.')\n return false\n end\n\n self.errors.clear\n\n self.update(\n :name => \"#{@name}_DELETED_#{(Time.now.to_f * 1000).to_i}\",\n :status => 'DELETED'\n )\n end", "def run_after_rollback_hooks(opts=OPTS)\n _run_transaction_hooks(:after_rollback, opts)\n end", "def rollback\n release = args.shift.downcase.strip rescue nil\n rolled_back = heroku.rollback(app, release)\n display \"Rolled back to #{rolled_back}\"\n end", "def run(*args, &block)\n Sequel::Model.db.transaction(rollback: :always, auto_savepoint: true) { super }\n end", "def void_last_transaction\n @items = self.last_item\n self.total = @total - @transactions[-1]\n end", "def rollback(rollback_date, keep = false)\n TradeTariffBackend.with_redis_lock do\n date = Date.parse(rollback_date.to_s)\n\n (date..Date.current).to_a.reverse.each do |date_for_rollback|\n Sequel::Model.db.transaction do\n # Delete actual data\n oplog_based_models.each do |model|\n model.operation_klass.where { operation_date > date_for_rollback }.delete\n end\n\n if keep\n # Rollback TARIC\n TariffSynchronizer::TaricUpdate.applied_or_failed.where { issue_date > date_for_rollback }.each do |taric_update|\n instrument(\"rollback_update.tariff_synchronizer\",\n update_type: :taric,\n filename: taric_update.filename\n )\n\n taric_update.mark_as_pending\n taric_update.clear_applied_at\n\n # delete presence errors\n taric_update.presence_errors_dataset.destroy\n end\n # Rollback CHIEF\n TariffSynchronizer::ChiefUpdate.applied_or_failed.where { issue_date > date_for_rollback }.each do |chief_update|\n instrument(\"rollback_update.tariff_synchronizer\",\n update_type: :chief,\n filename: chief_update.filename\n )\n\n [Chief::Comm, Chief::Mfcm, Chief::Tame, Chief::Tamf, Chief::Tbl9].each do |chief_model|\n chief_model.where(origin: chief_update.filename).delete\n end\n\n chief_update.mark_as_pending\n chief_update.clear_applied_at\n\n # need to delete measure logs\n ChiefTransformer::MeasuresLogger.delete_logs(chief_update.filename)\n end\n else\n # Rollback TARIC\n TariffSynchronizer::TaricUpdate.where { issue_date > date_for_rollback }.each do |taric_update|\n instrument(\"rollback_update.tariff_synchronizer\",\n update_type: :taric,\n filename: taric_update.filename\n )\n\n # delete presence errors\n taric_update.presence_errors_dataset.destroy\n taric_update.delete\n end\n # Rollback CHIEF\n TariffSynchronizer::ChiefUpdate.where { issue_date > date_for_rollback }.each do |chief_update|\n instrument(\"rollback_update.tariff_synchronizer\",\n update_type: :chief,\n filename: chief_update.filename\n )\n\n [Chief::Comm, Chief::Mfcm, Chief::Tame, Chief::Tamf, Chief::Tbl9].each do |chief_model|\n chief_model.where(origin: chief_update.filename).delete\n end\n\n # need to delete measure logs\n ChiefTransformer::MeasuresLogger.delete_logs(chief_update.filename)\n\n chief_update.delete\n end\n end\n end\n end\n\n instrument(\"rollback.tariff_synchronizer\", date: date, keep: keep)\n end\n rescue Redlock::LockError\n instrument(\"rollback_lock_error.tariff_synchronizer\", date: rollback_date, keep: keep)\n end", "def rollback(rollback_date, keep: false)\n TradeTariffBackend.with_redis_lock do\n date = Date.parse(rollback_date.to_s)\n\n (date..Time.zone.today).to_a.reverse.each do |date_for_rollback|\n Sequel::Model.db.transaction do\n # Delete actual data\n oplog_based_models.each do |model|\n model.operation_klass.where { operation_date > date_for_rollback }.delete\n end\n\n if keep\n # Rollback TARIC\n TariffSynchronizer::TaricUpdate.applied_or_failed.where { issue_date > date_for_rollback }.each do |taric_update|\n instrument('rollback_update.tariff_synchronizer',\n update_type: :taric,\n filename: taric_update.filename)\n\n taric_update.mark_as_pending\n taric_update.clear_applied_at\n\n # delete presence errors\n taric_update.presence_errors_dataset.destroy\n end\n else\n # Rollback TARIC\n TariffSynchronizer::TaricUpdate.where { issue_date > date_for_rollback }.each do |taric_update|\n instrument('rollback_update.tariff_synchronizer',\n update_type: :taric,\n filename: taric_update.filename)\n\n # delete presence errors\n taric_update.presence_errors_dataset.destroy\n taric_update.delete\n end\n end\n\n # Requeue data migrations\n # Rollback leaves 'date_for_rollback's data intact, it removes only\n # removes data for subsequent days - so look for migrations after\n # the end of the date_for_rollback day\n DataMigration.since(date_for_rollback.end_of_day).delete\n end\n end\n\n instrument('rollback.tariff_synchronizer', date:, keep:)\n end\n rescue Redlock::LockError\n instrument('rollback_lock_error.tariff_synchronizer', date: rollback_date, keep:)\n end", "def end(opts = nil)\n current.send :rollback, opts && opts[:rollback]\n Thread.current[:scheherazade_stories].pop\n current\n end", "def void_last_transaction\n#save add item to last transaction\n#take total and items list, and remove last transaction\n self.total -= self.last_transaction\n @title.pop\n end", "def remove_transaction(conn, committed)\n conn.autocommit = true\n ensure\n super\n end", "def rollback(group, user, acls, rc)\n group.delete\n user.delete if user\n\n if acls\n acls.each{|acl_id|\n OpenNebula::Acl.new_with_id(acl_id, @client).delete\n }\n end\n\n return rc\n end", "def void_last_transaction\n transaction = @transactions.pop\n self.total -= (transaction.price * transaction.quantity)\n transaction.quantity.times{self.items.delete(transaction.item_name)}\n end" ]
[ "0.8181803", "0.8181803", "0.77769566", "0.74661136", "0.7351645", "0.7266504", "0.72538483", "0.7232466", "0.7177316", "0.71110255", "0.70692456", "0.701413", "0.701413", "0.7002328", "0.69809246", "0.6975738", "0.6967255", "0.6929481", "0.6900461", "0.6873134", "0.68212163", "0.67682946", "0.6727802", "0.6697316", "0.6697316", "0.6697316", "0.6697316", "0.6697316", "0.6649581", "0.66020465", "0.652563", "0.6492686", "0.6438451", "0.6392547", "0.63775706", "0.63775706", "0.63493097", "0.62911636", "0.6265636", "0.62567645", "0.62299377", "0.613581", "0.61285216", "0.60893583", "0.60852885", "0.60549635", "0.6038162", "0.6036935", "0.6036935", "0.5939529", "0.59245574", "0.5916404", "0.58629334", "0.58446515", "0.58435833", "0.5843203", "0.5838692", "0.58342934", "0.5788904", "0.5779792", "0.57683724", "0.5761217", "0.5734244", "0.57308066", "0.57237476", "0.57132804", "0.5691739", "0.5677079", "0.5653508", "0.5596818", "0.55900073", "0.55810976", "0.55691385", "0.5561071", "0.5561071", "0.5561071", "0.5532248", "0.5526118", "0.5524944", "0.5523808", "0.55205977", "0.55163985", "0.5501564", "0.5496085", "0.54679954", "0.54438114", "0.53838176", "0.5378321", "0.5376842", "0.5361502", "0.53461874", "0.5342821", "0.5327697", "0.53198874", "0.5298827", "0.52788365", "0.5266695", "0.52501434", "0.5249624" ]
0.8284415
1
Allows you to do .nolock on a query
def nolock clone(:with => "(NOLOCK)") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nolock\n clone(:table_options => \"(NOLOCK)\")\n end", "def without_locking(&block)\n current = ActiveRecord::Base.lock_optimistically\n ActiveRecord::Base.lock_optimistically = false if current\n begin\n block.call\n ensure\n ActiveRecord::Base.lock_optimistically = true if current\n end\n end", "def without_locking(&block)\n self.class.without_locking(&block)\n end", "def lock\n shaz_nolock_lock if !@nolock\n end", "def select_lock_sql(sql)\n lock = @opts[:lock]\n if lock == :share\n sql << ' FOR SHARE'\n else\n super\n end\n\n if lock\n if @opts[:skip_locked]\n sql << \" SKIP LOCKED\"\n elsif @opts[:nowait]\n sql << \" NOWAIT\"\n end\n end\n end", "def select_lock_sql(sql)\n @opts[:lock] == :update ? sql : super\n end", "def locks\n sql = %q(\n select\n pg_stat_activity.procpid,\n pg_class.relname,\n pg_locks.transactionid,\n pg_locks.granted,\n substr(pg_stat_activity.current_query,1,30) as query_snippet,\n age(now(),pg_stat_activity.query_start) as \"age\"\n from pg_stat_activity,pg_locks left\n outer join pg_class on (pg_locks.relation = pg_class.oid)\n where pg_stat_activity.current_query <> '<insufficient privilege>' and\n pg_locks.pid=pg_stat_activity.procpid and pg_locks.mode = 'ExclusiveLock' order by query_start)\n\n exec_sql(sql, find_uri)\n end", "def blocking\n sql = %q(\n select bl.pid as blocked_pid,\n ka.current_query as blocking_statement,\n now() - ka.query_start as blocking_duration,\n kl.pid as blocking_pid,\n a.current_query as blocked_statement,\n now() - a.query_start as blocked_duration\n from pg_catalog.pg_locks bl\n join pg_catalog.pg_stat_activity a\n on bl.pid = a.procpid\n join pg_catalog.pg_locks kl\n join pg_catalog.pg_stat_activity ka\n on kl.pid = ka.procpid\n on bl.transactionid = kl.transactionid and bl.pid != kl.pid\n where not bl.granted)\n\n exec_sql(sql, find_uri)\n end", "def locked; end", "def locked\n end", "def lock!; end", "def non_blocking_lock!( *args, &block )\n unless non_blocking_lock( *args, &block )\n raise ::LockFailed.new( \"Failed to obtain a lock.\" )\n end\n end", "def without_transaction\n n = Thread.current['open_transactions']\n Thread.current['open_transactions'] = 1\n yield\n Thread.current['open_transactions'] = n\n end", "def add_lock!(sql, options)\n case lock = options[:lock]\n when true; sql << ' FOR UPDATE'\n when String; sql << \" #{lock}\"\n end\n end", "def query(sql)\n if Fiber.respond_to? :current and Fiber.current[:neverblock]\t\t \n send_query sql\n @fiber = Fiber.current\t\t \n Fiber.yield \n else\t\t \n super(sql)\n end\t\t\n end", "def select_statement_lock\n Thread.current[:'Arel::Visitors::SQLServerNG.select_statement_lock']\n end", "def add_lock!( sql, options )\n sql\n end", "def lock(mode, &block)\n sql = LOCK % [@opts[:from], mode]\n @db.synchronize do\n if block # perform locking inside a transaction and yield to block\n @db.transaction {@db.execute(sql); yield}\n else\n @db.execute(sql) # lock without a transaction\n self\n end\n end\n end", "def lock(opts={})\n super\n end", "def lock(opts={})\n super\n end", "def lock(opts={})\n super\n end", "def add_lock!(sql, options)\n sql\n end", "def lock\n post :lock\n end", "def without_locking\n old_value = Parts::WithLocking.locking?\n begin\n Parts::WithLocking.locking = false\n ret_value = yield\n ensure\n Parts::WithLocking.locking = old_value\n end\n ret_value\nend", "def locked_transaction(&block)\n unless connection.open_transactions.zero?\n raise \"locked_transaction cannot be called from within another transaction!\"\n end\n unsafe_locked_transaction do\n yield if block_given?\n end\n end", "def lock\n end", "def try_lock\n end", "def lock; end", "def lock; end", "def lock; end", "def lock(mode, &block)\n sql = LOCK % [source_list(@opts[:from]), mode]\n @db.synchronize do\n if block # perform locking inside a transaction and yield to block\n @db.transaction {@db.execute(sql); yield}\n else\n @db.execute(sql) # lock without a transaction\n self\n end\n end\n end", "def visit_Arel_Nodes_Lock(o, a = nil)\n # SQL Layer does not support row locks\n end", "def do_LOCK(req, res)\n end", "def with_database_exclusive_table_lock_sqlite(&block)\n block.call\n end", "def skip_locked\n cached_dataset(:_skip_locked_ds) do\n raise(Error, 'This dataset does not support skipping locked rows') unless supports_skip_locked?\n clone(:skip_locked=>true)\n end\n end", "def lock\n self.is_locked = true\n self\n end", "def call(*, &block)\n lock_instance.execute(&block)\n end", "def unblocked\n where blocked: false\n end", "def lock!\n self.for_update!\n end", "def lock!\n @locked = true\n end", "def exclusive_schema_lock()\n check_return_code(PureHailDB.ib_schema_lock_exclusive(@trx_ptr))\n end", "def perform(options = {}, &block)\n @record.transaction do\n @record.class.lock('FOR UPDATE NOWAIT').find(@record.id)\n yield\n end\n rescue\n nil\n end", "def unlocked\n where(\n '$or': [\n {\n '$or': [\n { locking_name_field => { '$exists': false } },\n { locked_at_field => { '$exists': false } }\n ]\n },\n {\n '$or': [\n { locking_name_field => { '$eq': nil } },\n { locked_at_field => { '$eq': nil } }\n ]\n },\n { locked_at_field => { '$lt': Time.now.utc - (lock_timeout * 1000) } }\n ]\n )\n end", "def with_database_exclusive_table_lock_postgresql(&block)\n # If we just use the regular :sanitize_sql support, we get:\n # LOCK TABLE 'foo'\n # ...which, for whatever reason, PostgreSQL doesn't like. Escaping it this way works fine.\n escaped = @low_card_model.connection.quote_table_name(@low_card_model.table_name)\n run_sql(\"LOCK TABLE #{escaped}\", { })\n block.call\n end", "def with_database_exclusive_table_lock_mysql(&block)\n begin\n escaped = @low_card_model.connection.quote_table_name(@low_card_model.table_name)\n run_sql(\"LOCK TABLES #{escaped} WRITE\", { })\n block.call\n ensure\n begin\n run_sql(\"UNLOCK TABLES\", { })\n rescue ::ActiveRecord::StatementInvalid => si\n # we tried our best!\n end\n end\n end", "def acquire_lock\n\t\t@@logger.info { \"Acquiring a lock in the database.\" } if have_logger?\n\t\tTournament.dataset.filter(:id => self.id, :locked => false).update(:locked => true) != 0\n\tend", "def lock!\n @locked = true\n end", "def enable_lock\n add option: \"-lock=true\"\n end", "def sync\n @lock.synchronize do\n if @cache.in_transaction?\n @cache.abort_transaction\n @cache.flush\n PEROBS.log.fatal \"You cannot call sync() during a transaction: \\n\" +\n Kernel.caller.join(\"\\n\")\n end\n @cache.flush\n end\n end", "def result_unlock\n\n end", "def unlock\n @locking = false\n end", "def lock handler, query\n\t\t\tQueueEntry.transaction do\n\t\t\t\treq = {\n\t\t\t\t\t:queue => @name,\n\t\t\t\t\t:handler => handler,\n\t\t\t\t\t:cquery => JSON.generate([query])\n\t\t\t\t}\n\t\t\t\tresp = QueueEntry.first req\n\t\t\t\tif resp then\n\t\t\t\t\tresp.locked = true\n\t\t\t\t\tresp.save\n\t\t\t\tend\n\t\t\t\tself\n\t\t\tend\n\t\tend", "def work\n stat :attempting_lock_on, item_id: object_id\n if @mutex.try_lock\n stat :has_lock_on, item_id: object_id\n chore\n stat :releasing_lock_on, item_id: object_id\n @mutex.unlock\n else\n stat :bailed_on, item_id: object_id\n end\n end", "def lock\n doc['lock']\n end", "def try_await_lock(table, i); end", "def lock _obj, _args\n \"_obj lock _args;\" \n end", "def lock_table(db, table)\n begin\n db.query(\"LOCK #{table}\")\n rescue Mysql::Error => e\n $stderr.puts \"Error code: #{e.errno}\"\n $stderr.puts \"Error message: #{e.error}\"\n $stderr.puts \"Error SQLSTATE: #{e.sqlstate}\" if e.respond_to?(\"sqlstate\")\n exit\n end\n end", "def select_and_lock(relation, limit:)\n relation = upcoming(relation)\n\n # FOR UPDATE SKIP LOCKED selects and locks entries, but skips those that\n # are already locked - preventing this transaction from being locked.\n sql = relation.to_sql + \" FOR UPDATE SKIP LOCKED\"\n sql += \" LIMIT #{limit}\" if limit\n\n item_class.find_by_sql(sql)\n end", "def do_not_thread\n\n true\n end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def no_cursor!\n cursor(false)\n end", "def no_cursor!\n cursor(false)\n end", "def with_lock\n lock!(true)\n yield\n ensure\n unlock!\n end", "def lock_type\n @lock_type ||= :mysql\n end", "def lock!\n freeze!\n @locked = true\n self\n end", "def lock\n @@lock ||= Monitor.new\n end", "def return_lock\n\t\t@@logger.info { \"Returning the lock to the database.\" } if have_logger?\n\t\tTournament.dataset.filter(:id => self.id, :locked => true).update(:locked => false) != 0\n\tend", "def suspend()\n #This is a stub, used for indexing\n end", "def lock(mode, opts=OPTS)\n if defined?(yield) # perform locking inside a transaction and yield to block\n @db.transaction(opts){lock(mode, opts); yield}\n else\n sql = 'LOCK TABLE '.dup\n source_list_append(sql, @opts[:from])\n mode = mode.to_s.upcase.strip\n unless LOCK_MODES.include?(mode)\n raise Error, \"Unsupported lock mode: #{mode}\"\n end\n sql << \" IN #{mode} MODE\"\n @db.execute(sql, opts)\n end\n nil\n end", "def lock\n @locked = true\n self\n end", "def msg_MLOCK(source, args)\n return nil\n end", "def do_not_thread\n true\n end", "def do_not_thread\n true\n end", "def do_not_thread\n true\n end", "def blind_request(query)\n time = Time.now\n @query_proc.call(query)\n diff = Time.now - time\n diff >= datastore['SqliDelay']\n end", "def synchronize_resultset(&proc)\n # make it reentrant\n return yield if defined?(@resultset_locked) && @resultset_locked == true\n\n return yield unless File.exist?(resultset_writelock)\n\n with_lock(&proc)\n end", "def transaction_disabled=(_arg0); end", "def disable_sql_logging(&block)\n sql_logging(enabled: false, &block)\n end", "def test_should_not_crash_selects_in_the_double_read_only_window\n ActiveRecord::Base.connection\n $mysql_master.set_rw(false)\n $mysql_slave.set_rw(false)\n assert_equal $mysql_master, master_connection\n 100.times do\n User.first\n end\n end", "def lock_database\n lock_command = <<-EOS.gsub(/^ +/, ' ')\n echo 'use admin\n db.runCommand({\"fsync\" : 1, \"lock\" : 1})' | #{ \"#{ mongo_utility } #{ mongo_uri }\" }\n EOS\n\n run(lock_command)\n end", "def lock(&block)\n # TODO: only use replace strategy when server is executing the lock\n return call_strategy unless (locked_token = locksmith.lock(&block))\n\n locked_token\n end", "def locked _args\n \"locked _args;\" \n end", "def disable_paranoid\n if block_given?\n @paranoid = false\n yield\n else\n raise 'Only block form is supported'\n end\n ensure\n @paranoid = true\n end", "def recover_from_timeout(pid, name)\n with_dedicated_connection do |con|\n lock = select_one(<<~SQL, pid, name, connection: con)\n SELECT locktype, objid, pid, granted FROM pg_locks \\\n WHERE pid = ? AND locktype = 'advisory' AND objid = hashtext(?)\n SQL\n return false unless lock\n\n if lock['granted']\n logger&.info 'DBLock: Lock was acquired after all'\n true\n else\n res = select_value 'SELECT pg_cancel_backend(?)', pid, connection: con\n logger&.warn 'DBLock: Failed to cancel ungranted lock query' unless res == true\n false\n end\n end\n end", "def lock\n @lock ||= Monitor.new\n end", "def lock_database\n lock_command = <<-EOS\n echo 'use admin\n db.runCommand({\"fsync\" : 1, \"lock\" : 1})' | #{mongo_shell}\n EOS\n\n run(lock_command)\n end", "def lock_timeout; end", "def unlock; end", "def n_plus_one_query_enable=(_arg0); end", "def supports_locking?\n false #true\n end", "def lock_list\n super\n end", "def abandon_results!()\n #This is a stub, used for indexing\n end", "def outside_transaction\n # ActiveRecord manages connections per-thread, so the only way to\n # convince it to open another connection is to start another thread.\n thread = Thread.new do\n begin\n yield\n end\n end\n thread.value\n end", "def uncached(&block)\n if ActiveRecord::Base.connected?\n connection.uncached(&block)\n else\n yield\n end\n end", "def uncached(&block)\n if ActiveRecord::Base.connected?\n connection.uncached(&block)\n else\n yield\n end\n end", "def lock!(style=:update)\n _refresh(this.lock_style(style)) unless new?\n self\n end", "def lock!(style=:update)\n _refresh(this.lock_style(style)) unless new?\n self\n end", "def lock_timeout=(_arg0); end" ]
[ "0.7786487", "0.72194034", "0.70768726", "0.70123297", "0.65658885", "0.6484154", "0.62651074", "0.622901", "0.60817206", "0.6000754", "0.59971285", "0.5988265", "0.59627455", "0.5884127", "0.5852311", "0.5837362", "0.5772591", "0.5771919", "0.5766119", "0.5766119", "0.5766119", "0.5751453", "0.5732263", "0.57133216", "0.57048357", "0.5698105", "0.56971663", "0.5657618", "0.5657618", "0.5657618", "0.5638062", "0.56323034", "0.55822825", "0.55660677", "0.55459696", "0.5525994", "0.55189335", "0.55009407", "0.5500351", "0.54994935", "0.5492269", "0.5487025", "0.5483118", "0.5469442", "0.54694116", "0.5407623", "0.5405945", "0.5366521", "0.5339714", "0.53251183", "0.5314673", "0.53101325", "0.5309116", "0.5302503", "0.5302188", "0.5297213", "0.5293148", "0.52739", "0.52432865", "0.5241254", "0.5241254", "0.5241254", "0.5230315", "0.5230315", "0.5230292", "0.52230513", "0.5216018", "0.5208345", "0.5203119", "0.5202141", "0.5198017", "0.51910657", "0.51852727", "0.5159176", "0.5159176", "0.51469284", "0.5146634", "0.5141233", "0.511933", "0.51184756", "0.51184005", "0.5117693", "0.5086998", "0.50828975", "0.5081057", "0.5070894", "0.5065917", "0.5057112", "0.5050707", "0.50414467", "0.5038547", "0.5031674", "0.5023227", "0.501717", "0.5015251", "0.50140214", "0.50140214", "0.5013351", "0.5013351", "0.50114465" ]
0.7499212
1
Formats a SELECT statement using the given options and the dataset options.
def select_sql(opts = nil) opts = opts ? @opts.merge(opts) : @opts if sql = opts[:sql] return sql end # ADD TOP to SELECT string for LIMITS if limit = opts[:limit] top = "TOP #{limit} " raise Error, "Offset not supported" if opts[:offset] end columns = opts[:select] # We had to reference const WILDCARD with its full path, because # the Ruby constant scope rules played against us (it was resolving it # as Sequel::Dataset::DatasetMethods::WILDCARD). select_columns = columns ? column_list(columns) : Sequel::Dataset::WILDCARD if distinct = opts[:distinct] distinct_clause = distinct.empty? ? "DISTINCT" : "DISTINCT ON (#{expression_list(distinct)})" sql = "SELECT #{top}#{distinct_clause} #{select_columns}" else sql = "SELECT #{top}#{select_columns}" end if opts[:from] sql << " FROM #{source_list(opts[:from])}" end # ADD WITH to SELECT string for NOLOCK if with = opts[:with] sql << " WITH #{with}" end if join = opts[:join] join.each{|j| sql << literal(j)} end if where = opts[:where] sql << " WHERE #{literal(where)}" end if group = opts[:group] sql << " GROUP BY #{expression_list(group)}" end if order = opts[:order] sql << " ORDER BY #{expression_list(order)}" end if having = opts[:having] sql << " HAVING #{literal(having)}" end if union = opts[:union] sql << (opts[:union_all] ? \ " UNION ALL #{union.sql}" : " UNION #{union.sql}") end raise Error, "Intersect not supported" if opts[:intersect] raise Error, "Except not supported" if opts[:except] sql end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_sql(opts = nil)\n opts = opts ? @opts.merge(opts) : @opts\n\n if sql = opts[:sql]\n return sql\n end\n\n columns = opts[:select]\n select_columns = columns ? column_list(columns) : '*'\n sql = opts[:distinct] ? \\\n \"SELECT DISTINCT #{select_columns}\" : \\\n \"SELECT #{select_columns}\"\n \n if opts[:from]\n sql << \" FROM #{source_list(opts[:from])}\"\n end\n \n if join = opts[:join]\n join.each{|j| sql << literal(j)}\n end\n\n if where = opts[:where]\n sql << \" WHERE #{literal(where)}\"\n end\n\n if group = opts[:group]\n sql << \" GROUP BY #{expression_list(group)}\"\n end\n\n if having = opts[:having]\n sql << \" HAVING #{literal(having)}\"\n end\n\n if union = opts[:union]\n sql << (opts[:union_all] ? \\\n \" UNION ALL #{union.sql}\" : \" UNION #{union.sql}\")\n elsif intersect = opts[:intersect]\n sql << (opts[:intersect_all] ? \\\n \" INTERSECT ALL #{intersect.sql}\" : \" INTERSECT #{intersect.sql}\")\n elsif except = opts[:except]\n sql << (opts[:except_all] ? \\\n \" EXCEPT ALL #{except.sql}\" : \" EXCEPT #{except.sql}\")\n end\n\n if order = opts[:order]\n sql << \" ORDER BY #{expression_list(order)}\"\n end\n\n if limit = opts[:limit]\n if (offset = opts[:offset]) && (offset > 0)\n sql = \"SELECT * FROM (SELECT raw_sql_.*, ROWNUM raw_rnum_ FROM(#{sql}) raw_sql_ WHERE ROWNUM <= #{limit + offset}) WHERE raw_rnum_ > #{offset}\"\n else\n sql = \"SELECT * FROM (#{sql}) WHERE ROWNUM <= #{limit}\"\n end\n end\n\n sql\n end", "def select_sql(opts = nil)\n opts = opts ? @opts.merge(opts) : @opts\n \n if sql = opts[:sql]\n return sql\n end\n\n columns = opts[:select]\n select_columns = columns ? column_list(columns) : WILDCARD\n\n if distinct = opts[:distinct]\n distinct_clause = distinct.empty? ? \"DISTINCT\" : \"DISTINCT ON (#{column_list(distinct)})\"\n sql = \"SELECT #{distinct_clause} #{select_columns}\"\n else\n sql = \"SELECT #{select_columns}\"\n end\n \n if opts[:from]\n sql << \" FROM #{source_list(opts[:from])}\"\n end\n \n if join = opts[:join]\n sql << join\n end\n\n if where = opts[:where]\n sql << \" WHERE #{literal(where)}\"\n end\n\n if group = opts[:group]\n sql << \" GROUP BY #{column_list(group)}\"\n end\n\n if having = opts[:having]\n sql << \" HAVING #{literal(having)}\"\n end\n\n if order = opts[:order]\n sql << \" ORDER BY #{column_list(order)}\"\n end\n\n if limit = opts[:limit]\n sql << \" LIMIT #{limit}\"\n if offset = opts[:offset]\n sql << \" OFFSET #{offset}\"\n end\n end\n\n if union = opts[:union]\n sql << (opts[:union_all] ? \\\n \" UNION ALL #{union.sql}\" : \" UNION #{union.sql}\")\n elsif intersect = opts[:intersect]\n sql << (opts[:intersect_all] ? \\\n \" INTERSECT ALL #{intersect.sql}\" : \" INTERSECT #{intersect.sql}\")\n elsif except = opts[:except]\n sql << (opts[:except_all] ? \\\n \" EXCEPT ALL #{except.sql}\" : \" EXCEPT #{except.sql}\")\n end\n\n sql\n end", "def select_statement\n \"select \" + selected_field_names.map { |field_name| zuora_field_name(field_name) }.join(', ')\n end", "def select_table_options_sql(sql)\n sql << \" WITH #{@opts[:table_options]}\" if @opts[:table_options]\n end", "def table_options_sql(options)\n\t sql = []\n\t sql << flag_option_sql(options, :parallel)\n\t sql << flag_option_sql(options, :logging)\n\t sql << flag_option_sql(options, :monitoring)\n\t sql << \"TABLESPACE #{quote_identifier(options[:tablespace])}\" if options[:tablespace]\n\t sql << compress_option_sql(options)\n\t sql << options[:options] if String === options[:options]\n\t sql.compact.join ' '\n\t end", "def raw_select(sql, name = 'SQL', binds = [], options = {})\n log(sql, name, binds) { _raw_select(sql, options) }\n end", "def execute(sql, opts={}, &block)\n super(sql, {:type=>:select}.merge(opts), &block)\n end", "def string\n @sql_string = \"SELECT #{@select} FROM #{@from}#{@join} WHERE #{@where};\"\n end", "def sql(options = {})\n options = normalize_options(options)\n ret = \"\"\n\n if exact_date?(options)\n\tret += \"#{column} = '#{self.from_date(options)}' \"\n else\n\tret += \"#{column} >= '#{self.from_date(options)}' AND \"\t\n\tret += \"#{column} <= '#{self.to_date(options)}' \"\t\n end\n\n raise \"not time selection supported yet '#{range(options)}' please use beginning and end.\" if from_time or to_time\n\n return nil if ret == \"\"\n return ret\n end", "def sql\n s = \"\"\n options = @options.dup\n\n if update = options.delete(:update)\n s = \"UPDATE \"\n s << Mao.quote_ident(@table)\n s << \" SET \"\n\n if update.length == 0\n raise ArgumentError, \"invalid update: nothing to set\"\n end\n\n s << update.map do |column, value|\n check_column(column, @table, @col_types)\n\n \"#{Mao.quote_ident(column)} = #{Mao.escape_literal(value)}\"\n end.join(\", \")\n\n if where = options.delete(:where)\n s << \" WHERE \"\n s << Mao::Filter.sql(where)\n end\n elsif insert = options.delete(:insert)\n s = \"INSERT INTO \"\n s << Mao.quote_ident(@table)\n s << \" (\"\n\n keys = insert.map(&:keys).flatten.uniq.sort\n s << keys.map do |column|\n check_column(column, @table, @col_types)\n Mao.quote_ident(column)\n end.join(\", \")\n s << \") VALUES \"\n\n first = true\n insert.each do |row|\n if first\n first = false\n else\n s << \", \"\n end\n\n s << \"(\"\n s << keys.map {|k|\n if row.include?(k)\n Mao.escape_literal(row[k])\n else\n \"DEFAULT\"\n end\n }.join(\", \")\n s << \")\"\n end\n\n if returning = options.delete(:returning)\n s << \" RETURNING \"\n s << returning.map {|c| Mao.quote_ident(c)}.join(\", \")\n end\n else\n s = \"SELECT \"\n\n join = options.delete(:join)\n only = options.delete(:only)\n\n if join\n n = 0\n s << (@col_types.keys.sort.map {|c|\n n += 1\n if !only or (only[@table] and only[@table].include?(c))\n \"#{Mao.quote_ident(@table)}.#{Mao.quote_ident(c)} \" +\n \"#{Mao.quote_ident(\"c#{n}\")}\"\n end\n } + Mao.query(join[0]).col_types.keys.sort.map {|c|\n n += 1\n if !only or (only[join[0]] and only[join[0]].include?(c))\n \"#{Mao.quote_ident(join[0])}.#{Mao.quote_ident(c)} \" +\n \"#{Mao.quote_ident(\"c#{n}\")}\"\n end\n }).reject(&:nil?).join(\", \")\n elsif only\n s << only.map {|c| Mao.quote_ident(c)}.join(\", \")\n else\n s << \"*\"\n end\n\n s << \" FROM #{Mao.quote_ident(@table)}\"\n\n if join\n s << \" INNER JOIN #{Mao.quote_ident(join[0])} ON \"\n s << Mao::Filter.sql(join[1])\n end\n\n if where = options.delete(:where)\n s << \" WHERE \"\n s << Mao::Filter.sql(where)\n end\n\n if order = options.delete(:order)\n s << \" ORDER BY \"\n s << Mao.quote_ident(order[0])\n s << \" \"\n s << order[1]\n end\n\n if limit = options.delete(:limit)\n s << \" LIMIT #{limit}\"\n end\n end\n\n if options.length > 0\n raise ArgumentError,\n \"invalid options in #sql: #{options.inspect}. \" \\\n \"SQL constructed: #{s}\"\n end\n\n s\n end", "def select_from_sql(sql)\n sql << \" FROM #{source_list(@opts[:from] || ['DUAL'])}\"\n end", "def to_sql\n sql = [\"select\"]\n select_values << \"*\" if select_values.empty?\n\n sql << select_values.uniq.join(\", \")\n\n sql << \"from #{build_series_name}\"\n\n sql << \"where #{where_values.join(\" and \")}\" unless where_values.empty?\n\n unless group_values.empty? && time_value.nil?\n group_fields = (time_value.nil? ? [] : [\"time(\" + @values[:time] + \")\"]) + group_values\n group_fields.uniq!\n sql << \"group by #{group_fields.join(\", \")}\"\n end\n\n sql << \"fill(#{fill_value})\" unless fill_value.nil?\n\n sql << \"order by #{order_values.uniq.join(\",\")}\" unless order_values.empty?\n\n sql << \"limit #{limit_value}\" unless limit_value.nil?\n sql << \"offset #{offset_value}\" unless offset_value.nil?\n sql << \"slimit #{slimit_value}\" unless slimit_value.nil?\n sql << \"soffset #{soffset_value}\" unless soffset_value.nil?\n sql << \"TZ('#{timezone_value}')\" unless timezone_value.blank?\n sql.join \" \"\n end", "def sql! sql=nil\n require 'niceql'\n puts Niceql::Prettifier.prettify_sql sql || $last_sql_command\n end", "def sql\n selected_field_path = \"#{@selection.target_alias}.#{@selection.selected_field}\"\n operation = self.sql_operation.sub('?field', selected_field_path)\n \"#{operation} AS #{@field_name}\"\n end", "def sql\n @sql ||= begin\n bind_params = []\n 1.upto(selector_keys.length + setter_keys.length) { |i| bind_params << \"$#{i}\" }\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end", "def table_select_query(table, options = {})\n query = \"select #{quote_column_list(table)}\"\n query << \" from #{quote_table_name(table)}\"\n query << \" where\" if [:from, :to, :row_keys].any? {|key| options.include? key}\n first_condition = true\n if options[:from]\n first_condition = false\n matching_condition = options[:exclude_starting_row] ? '>' : '>='\n query << row_condition(table, options[:from], matching_condition)\n end\n if options[:to]\n query << ' and' unless first_condition\n first_condition = false\n query << row_condition(table, options[:to], '<=')\n end\n if options[:row_keys]\n query << ' and' unless first_condition\n if options[:row_keys].empty?\n query << ' false'\n else\n query << ' (' << quote_key_list(table) << ') in ('\n first_key = true\n options[:row_keys].each do |row|\n query << ', ' unless first_key\n first_key = false\n query << '(' << primary_key_names(table).map do |key|\n quote_value(table, key, row[key])\n end.join(', ') << ')'\n end\n query << ')'\n end\n end\n query << \" order by #{quote_key_list(table)}\"\n\n query\n end", "def select_from(table, options = {})\n\t\twhere = if options[:where]\n\t\t\tconditions = options[:where].map{ |column, value| \n\t\t\t\t\"#{column} = #{value}\" \n\t\t\t}.join(', ')\n\t\t\t\"WHERE #{conditions}\"\n\t\tend\n\t\torder = if options[:order]\n\t\t\t\"ORDER BY #{options[:order]}\"\n\t\tend\n\t\tlimit = if options[:limit]\n\t\t\t\"LIMIT #{options[:limit]}\"\n\t\tend\n\t\texecute_with_retry \"SELECT * FROM #{table} #{where} #{order} #{limit};\"\n\tend", "def compose\n case type\n when :integrated\n formated_query\n when :separated\n \"select #{target_column_names} from #{config[:object]} #{where_clause}\"\n end\n end", "def build_compound_select_string(data, table, *columns)\n qry = []\n placeholder_args = []\n qry_string = build_qrystring(table, columns) \n (1...MAX_SQLITE_STATEMENTS).each do |index|\n qry_string << \" UNION SELECT ?\" << \",?\" * (columns.size-1)\n end #index\n (0..data.size).step(MAX_SQLITE_STATEMENTS) do |index|\n if ((data.size - index) < MAX_SQLITE_STATEMENTS)\n qry_string = build_qrystring(table, columns)\n (1...data.size - index).each do |newstr|\n qry_string << \" UNION SELECT ?\" << \",?\" * (columns.size-1)\n end #end newstr\n qry.insert(-1, qry_string)\n holder_args = data.slice(index, data.size-index)\n placeholder_args.insert(-1, holder_args) if holder_args[0].class == String\n placeholder_args.insert(-1, holder_args.flatten) if holder_args[0].class == Array\n else \n qry.insert(-1, qry_string)\n holder_args = data.slice(index, MAX_SQLITE_STATEMENTS)\n placeholder_args.insert(-1, holder_args) if holder_args[0].class == String\n placeholder_args.insert(-1, holder_args.flatten) if holder_args[0].class == Array\n #placeholder_args.insert(-1, data.slice(index, MAX_SQLITE_STATEMENTS))\n end # endif\n end #end index\n \n return qry, placeholder_args\n end", "def to_select_sql\n return nil unless include_as_association?\n \n separator = all_ints? || all_datetimes? || @crc ? ',' : ' '\n \n clause = @columns.collect { |column|\n part = column_with_prefix(column)\n case type\n when :string\n adapter.convert_nulls(part)\n when :datetime\n adapter.cast_to_datetime(part)\n when :multi\n part = adapter.cast_to_datetime(part) if is_many_datetimes?\n part = adapter.convert_nulls(part, '0') if is_many_ints?\n part\n else\n part\n end\n }.join(', ')\n \n clause = adapter.crc(clause) if @crc\n clause = adapter.concatenate(clause, separator) if concat_ws?\n clause = adapter.group_concatenate(clause, separator) if is_many?\n \n \"#{clause} AS #{quote_column(unique_name)}\"\n end", "def sql(options={})\n get_location\n # TODO: validate options\n @params[:sql] = FEATURE_DEFAULTS[:sql].merge(options)\n @params[:sql][:generate] = true\n end", "def sanitize_select_options(options)#:nodoc:\n o = options.dup\n select = o.delete :select\n o[:override_select] = select ? select_column_sql(select) : ' * '\n o\n end", "def select(select)\n @query = select.statement\n end", "def schema_ds_select(table_name, opts)\n cols = [:column_name___column, :data_type___db_type, :character_maximum_length___max_chars, \\\n :numeric_precision, :column_default___default, :is_nullable___allow_null]\n cols << :c__table_name unless table_name\n cols\n end", "def select_sql\n columns = wanted_active_record_columns.map do |column|\n clause = override_field_select_sql(column)\n quoted_column_name = Q.quote_column_name(column.name)\n if clause.nil?\n quoted_column_name\n else\n \"#{clause} AS #{quoted_column_name}\"\n end\n end\n\n \"SELECT #{columns.join(', ')} FROM #{Q.quote_table_name(pg_table_name)} #{where_clause}\"\n end", "def select_statement(with_identifier: true)\n return [degenerate_select_fragment] if type == Dimension::TYPES[:degenerate]\n\n ss = [\"#{label_fragment} AS #{name}\"]\n ss << \"#{identifier_fragment} AS #{name}_identifier\" if with_identifier\n ss\n end", "def to_select_sql\n clause = @columns.collect { |column|\n column_with_prefix(column)\n }.join(', ')\n \n separator = all_ints? ? ',' : ' '\n \n clause = adapter.concatenate(clause, separator) if concat_ws?\n clause = adapter.group_concatenate(clause, separator) if is_many?\n clause = adapter.cast_to_datetime(clause) if type == :datetime\n clause = adapter.convert_nulls(clause) if type == :string\n \n \"#{clause} AS #{quote_column(unique_name)}\"\n end", "def sql\n @sql ||= begin\n bind_params = []\n i = 1\n (selector_keys.length + setter_keys.length).times do\n bind_params << \"$#{i}\"\n i += 1\n end\n hstore_delete_handlers.length.times do\n bind_params << \"$#{i}::text[]\"\n i += 1\n end\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end", "def sql\n @sql ||= begin\n bind_params = []\n i = 1\n (selector_keys.length + setter_keys.length).times do\n bind_params << \"$#{i}\"\n i += 1\n end\n hstore_delete_handlers.length.times do\n bind_params << \"$#{i}::text[]\"\n i += 1\n end\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end", "def debug_select(hash)\n $stderr.puts '--- DEBUG ---'\n $stderr.puts \"SELECT(#{hash[:select].join(', ')})\"\n $stderr.puts \" FROM(#{hash[:from]})\"\n $stderr.puts \" WHERE('#{hash[:where]}')\" if hash[:where]\n into_list = hash[:into].dup\n into_list.push \"'#{into_list.pop}'\" if into_list.length > 1\n $stderr.puts \" INTO(#{into_list.join(' ')})\"\n $stderr.puts \"\"\n end", "def display_query_sql(users)\n tag.p('SQL:') + tag.code(users.to_sql)\n end", "def construct_sql\n if @reflection.options[:finder_sql]\n @finder_sql = interpolate_sql(@reflection.options[:finder_sql])\n else\n @finder_sql = conditions\n end\n \n if @reflection.options[:counter_sql]\n @counter_sql = interpolate_sql(@reflection.options[:counter_sql])\n elsif @reflection.options[:finder_sql]\n # replace the SELECT clause with COUNT(*), preserving any hints within /* ... */\n @reflection.options[:counter_sql] = @reflection.options[:finder_sql].sub(/SELECT (\\/\\*.*?\\*\\/ )?(.*)\\bFROM\\b/im) { \"SELECT #{$1}COUNT(*) FROM\" }\n @counter_sql = interpolate_sql(@reflection.options[:counter_sql])\n else\n @counter_sql = @finder_sql\n end\n end", "def sql(options = {})\n options = normalize_options(options)\n if value\t\n\t\"#{column(options)} #{operator} #{quoted_value(options)}\"\n else\n\t\"#{column(options)} #{operator}\"\n end\n end", "def to_select_sql\n clause = @columns.collect { |column|\n column_with_prefix(column)\n }.join(', ')\n \n clause = adapter.concatenate(clause) if concat_ws?\n clause = adapter.group_concatenate(clause) if is_many?\n \n \"#{adapter.cast_to_string clause } AS #{quote_column(unique_name)}\"\n end", "def subselect_sql_append(sql, ds)\n ds.clone(:append_sql=>sql, :prepared_args=>prepared_args, :bind_vars=>@opts[:bind_vars]).\n send(:to_prepared_statement, :select, nil, :extend=>prepared_statement_modules).\n prepared_sql\n end", "def select(sql, name = nil, binds = [])\n translate(sql) do |sql, args|\n unless binds.empty?\n args = binds.map { |col, val| type_cast(val, col) } + args\n end\n #\n # => theSql = sql.gsub(/\"/, '')\n # Added by Karl Kloppenborg, see commit log for details\n # \n theSql = sql.gsub(/\"/, '')\n log(expand(theSql, args), name) do\n @connection.query(:hash, theSql, *args)\n end\n end\n end", "def select!(*fields)\n @options[:select] ||= fields.join ','\n self\n end", "def subquery_sql(options)\n gross_exports_query(options)\n end", "def select(sql, klass, options = {})\n sql = \"SELECT * FROM #{klass.table} \" + sql unless sql =~ /SELECT/i\n read_all(query(sql), klass, options)\n end", "def copy_table_sql(table, opts)\n if table.is_a?(String)\n table\n else\n if opts[:options] || opts[:format]\n options = String.new\n options << \" (\"\n options << \"FORMAT #{opts[:format]}\" if opts[:format]\n options << \"#{', ' if opts[:format]}#{opts[:options]}\" if opts[:options]\n options << ')'\n end\n table = if table.is_a?(::Sequel::Dataset)\n \"(#{table.sql})\"\n else\n literal(table)\n end\n \"COPY #{table} TO STDOUT#{options}\"\n end\n end", "def select(*args)\n args.each do |arg|\n if arg.is_a?(String)\n self.fields = self.fields.concat(SkyDB::Query::Selection.parse_fields(arg))\n elsif arg.is_a?(Symbol)\n self.fields << SelectionField.new(:expression => arg.to_s)\n else\n raise \"Invalid selection argument: #{arg} (#{arg.class})\"\n end\n end\n \n return self\n end", "def custom_sql(q)\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n query.each { |x| print_line(\"#{x.join(',')}\") } unless query.empty?\n end", "def explain(opts=OPTS)\n with_sql((opts[:analyze] ? 'EXPLAIN ANALYZE ' : 'EXPLAIN ') + select_sql).map(:'QUERY PLAN').join(\"\\r\\n\")\n end", "def format_options(options)\n data = []\n options.each do |name, option_spec|\n data << format_option(option_spec)\n end\n \"Options:\\n\" + render_table(data, \": \")\n end", "def prepare_explicit_statement(ds, type, vals=OPTS)\n f = ds.opts[:from]\n meth = type == :insert_select ? :returning : :select\n s = ds.opts[meth]\n if f && f.length == 1 && !ds.opts[:join] && (!s || s.empty?)\n ds = ds.send(meth, *columns.map{|c| Sequel.identifier(c)})\n end \n \n prepare_statement(ds, type, vals)\n end", "def _insert_select_raw(ds)\n ds.insert_select(_insert_values)\n end", "def _insert_select_raw(ds)\n ds.insert_select(_insert_values)\n end", "def select_all(sql, name = nil) end", "def create_view_sql(name, source, options)\n source = source.sql if source.is_a?(Dataset)\n sql = String.new\n sql << \"#{create_view_prefix_sql(name, options)} AS #{source}\"\n if check = options[:check]\n sql << \" WITH#{' LOCAL' if check == :local} CHECK OPTION\"\n end\n sql\n end", "def get_sql(structure, options)\n # get_partial_sql structure, key: 'sql'\n wrap_result send(\"build_#{options[:key] || 'sql'}\", structure)\n end", "def generate_sql(columns)\n [\"SELECT #{columns} FROM #{@from}\", @where, @group, @having, @order, @limit, @offset].join\n end", "def parse_select(cmd)\n # First let's break the statement into its various sub-lists. Start\n # with FROM\n from_list = cmd.index('FROM')\n raise \"Statement missing FROM clause.\" unless from_list\n select_list = cmd[1...from_list].reject { |x| x == ',' }\n select_list = select_list.collect { |x| x.downcase }\n \n # Now do INTO (skipping WHERE for now)\n into_list = cmd.index('INTO')\n raise \"Statement missing INTO clause.\" unless into_list\n from_list = cmd[from_list+1...into_list]\n into_list = cmd[into_list+1..-1]\n unless into_list.length.between?(1,2)\n raise \"Bad number of terms in INTO clause\"\n end\n\n # Now do WHERE (which is conditional and will be part of FROM)\n where_list = nil\n if from_list.include? 'WHERE'\n where_pos = from_list.index 'WHERE'\n where_list = from_list[where_pos+1..-1]\n unless where_list.length == 1\n raise \"Bad number of terms in WHERE clause (#{where_list.length})\"\n end\n from_list = from_list[0...where_pos]\n where_list = where_list.first\n end\n if from_list.length != 1\n raise \"Bad number of terms in FROM clause (#{from_list.length})\"\n end\n from_list = from_list.first.downcase\n\n # Return the hash with the attributes we've just parsed out\n { :select => select_list, :from => from_list, :where => where_list,\n :into => into_list }\n end", "def format_ds_opt(opt)\n modified = ''\n\n opt = opt.to_s\n opt.split('').each { |elem| modified << \"\\'#{elem}\\', \" }\n modified = \"#{modified}0\"\n end", "def subquery_sql(options)\n net_imports_query(options)\n end", "def ascii_query(sql,*values)\n sth = self.query(sql,*values)\n rows = sth.fetch_all\n col_names = sth.column_names\n sth.finish\n DBI::Utils::TableFormatter.ascii(col_names, rows)\n end", "def command_builder(format_options, query)\n verified_query = verify_query(query)\n sql_prefix, sql_postfix = \"\", \"\"\n if inspec.os.windows?\n sql_prefix = %{@'\\n#{format_options}\\n#{verified_query}\\nEXIT\\n'@ | }\n else\n sql_postfix = %{ <<'EOC'\\n#{format_options}\\n#{verified_query}\\nEXIT\\nEOC}\n end\n\n if @db_role.nil?\n %{#{sql_prefix}#{bin} \"#{user}\"/\"#{password}\"@#{host}:#{port}/#{@service}#{sql_postfix}}\n elsif @su_user.nil?\n %{#{sql_prefix}#{bin} \"#{user}\"/\"#{password}\"@#{host}:#{port}/#{@service} as #{@db_role}#{sql_postfix}}\n else\n %{su - #{@su_user} -c \"env ORACLE_SID=#{@service} #{bin} / as #{@db_role}#{sql_postfix}}\n end\n end", "def find_options\n opt = {:conditions => conditions, :limit => @limit, :order => \"#{@id_clause} #{@order}\"}\n if columns = @options[:select]\n opt[:select] = columns\n end\n opt[:joins] = @joins if @joins\n opt\n end", "def select_with_sql_base\n opts[:with].any?{|w| w[:recursive]} ? \"WITH RECURSIVE \" : super\n end", "def dbselect2(find, table)\n if find.kind_of?(Array) == false\n variables = find\n else\n variables = \"\"\n i = 0\n while i < find.length\n variables += find[i].to_s\n i += 1\n if i < find.length\n variables += \", \"\n end\n end\n end\n return db.execute(\"SELECT #{variables} FROM #{table}\")\nend", "def select_statement(query)\n model = query.model\n fields = query.fields\n conditions = query.conditions\n limit = query.limit\n offset = query.offset\n order = query.order\n group_by = nil\n\n # FIXME: using a boolean for qualify does not work in some cases,\n # such as when you have a self-referrential many to many association.\n # if you don't qualfiy the columns with a unique alias, then the\n # SQL query will fail. This may mean though, that it might not\n # be enough to pass in a Property, but we may need to know the\n # table and the alias we should use for the column.\n\n qualify = query.links.any?\n\n if qualify || query.unique?\n group_by = fields.select { |property| property.kind_of?(Property) }\n end\n\n unless (limit && limit > 1) || offset > 0 || qualify\n # TODO: move this method to Query, so that it walks the conditions\n # and finds an OR operator\n\n # TODO: handle cases where two or more properties need to be\n # used together to be unique\n\n # if a unique property is used, and there is no OR operator, then an ORDER\n # and LIMIT are unecessary because it should only return a single row\n if conditions.kind_of?(Query::Conditions::AndOperation) &&\n conditions.any? { |operand| operand.kind_of?(Query::Conditions::EqualToComparison) && operand.subject.respond_to?(:unique?) && operand.subject.unique? } &&\n !conditions.any? { |operand| operand.kind_of?(Query::Conditions::OrOperation) }\n order = nil\n limit = nil\n end\n end\n\n conditions_statement, bind_values = conditions_statement(conditions, qualify)\n\n statement = \"SELECT #{columns_statement(fields, qualify)}\"\n statement << \" FROM #{quote_name(model.storage_name(name))}\"\n statement << join_statement(query, qualify) if qualify\n statement << \" WHERE #{conditions_statement}\" unless conditions_statement.blank?\n statement << \" GROUP BY #{columns_statement(group_by, qualify)}\" unless group_by.blank?\n statement << \" ORDER BY #{order_statement(order, qualify)}\" unless order.blank?\n\n if limit\n statement << ' LIMIT ?'\n bind_values << limit\n end\n\n if limit && offset > 0\n statement << ' OFFSET ?'\n bind_values << offset\n end\n\n return statement, bind_values\n end", "def compound_dataset_sql_append(sql, ds)\n sql << '('\n super\n sql << ')'\n end", "def as_query(opts={})\n Tripod.logger.debug(\"TRIPOD: building select query for criteria...\")\n\n return_graph = opts.has_key?(:return_graph) ? opts[:return_graph] : true\n\n Tripod.logger.debug(\"TRIPOD: with return_graph: #{return_graph.inspect}\")\n\n select_query = \"SELECT DISTINCT ?uri \"\n\n if graph_lambdas.empty?\n\n if return_graph\n # if we are returning the graph, select it as a variable, and include either the <graph> or ?graph in the where clause\n if graph_uri\n select_query += \"(<#{graph_uri}> as ?graph) WHERE { GRAPH <#{graph_uri}> { \"\n else\n select_query += \"?graph WHERE { GRAPH ?graph { \"\n end\n else\n select_query += \"WHERE { \"\n # if we're not returning the graph, only restrict by the <graph> if there's one set at class level\n select_query += \"GRAPH <#{graph_uri}> { \" if graph_uri\n end\n\n select_query += self.query_where_clauses.join(\" . \")\n select_query += \" } \"\n select_query += \"} \" if return_graph || graph_uri # close the graph clause\n\n else\n # whip through the graph lambdas and add into the query\n # we have multiple graphs so the above does not apply\n select_query += \"WHERE { \"\n\n graph_lambdas.each do |lambda_item|\n select_query += \"GRAPH ?g { \"\n select_query += lambda_item.call\n select_query += \" } \"\n end\n\n select_query += self.query_where_clauses.join(\" . \")\n select_query += \" } \"\n end\n\n select_query += self.extra_clauses.join(\" \")\n\n select_query += [order_clause, limit_clause, offset_clause].join(\" \")\n\n select_query.strip\n end", "def build_distance_sql(options)\n origin = extract_origin_from_options(options)\n units = extract_units_from_options(options)\n formula = extract_formula_from_options(options)\n\n distance_sql(origin, units, formula)\n end", "def dbselect(find, table, condition, condition_name)\n if find.kind_of?(Array) == false\n variables = find\n else\n variables = \"\"\n i = 0\n while i < find.length\n variables += find[i].to_s\n i += 1\n if i < find.length\n variables += \", \"\n end\n end\n end\n\n if condition.kind_of?(Array) == false\n cond = condition.to_s + \"=?\"\n else\n cond = \"\"\n i = 0\n while i < condition.length\n cond += condition[i].to_s + \"=?\"\n i += 1\n if i < condition.length\n cond += \" AND \"\n end\n end\n end\n return db.execute(\"SELECT #{variables} FROM #{table} WHERE #{cond}\", condition_name)\nend", "def to_sql(options = {})\n \"#{field.to_sql(options)} = #{expression.to_sql(options)}\"\n end", "def insert_select_sql(*values)\n ds = opts[:returning] ? self : returning\n ds.insert_sql(*values)\n end", "def insert_select_sql(*values)\n ds = opts[:returning] ? self : returning\n ds.insert_sql(*values)\n end", "def insert_select_sql(*values)\n ds = opts[:returning] ? self : returning\n ds.insert_sql(*values)\n end", "def resolve_options(klass, options)\n # Factor in scope.\n if scope = klass.get_scope\n scope = scope.dup\n scond = scope.delete(:condition)\n scope.update(options)\n options = scope\n end\n\n if sql = options[:sql]\n sql = \"SELECT * FROM #{klass.table} \" + sql unless sql =~ /SELECT/i\n return sql\n end\n\n tables = [klass::table]\n\n if included = options[:include]\n join_conditions = []\n\n for name in [included].flatten\n if rel = klass.relation(name.to_s)\n target_table = rel[:target_class]::table\n tables << target_table\n\n if rel.is_a?(JoinsMany)\n tables << rel[:join_table]\n owner_key, target_key = nil\n klass.ogmanager.with_store do |s|\n owner_key, target_key = s.join_table_keys(klass, rel[:target_class])\n end\n join_conditions << \"#{rel.join_table}.#{owner_key}=#{klass.table}.#{rel.owner_class.primary_key} AND #{rel.join_table}.#{target_key}=#{rel.target_class.table}.#{rel.target_class.primary_key}\"\n else\n join_conditions << \"#{klass::table}.#{rel.foreign_key}=#{target_table}.#{rel.target_class.primary_key}\"\n end\n else\n raise \"Unknown relation name\"\n end\n end\n\n fields = options[:select] || tables.collect { |t| \"#{t}.*\" }.join(',')\n\n update_condition options, join_conditions.join(\" AND \")\n elsif fields = options[:select]\n fields = fields.map {|f| f.to_s}.join(\", \")\n else\n fields = \"*\"\n end\n\n if join_table = options[:join_table]\n tables << join_table\n update_condition options, options[:join_condition]\n end\n\n # Factor in scope in the conditions.\n update_condition(options, scond) if scond\n\n # where is just an alias, put to :condition\n update_condition(options, options.delete(:where))\n\n # add extra conditions\n update_condition(options, options.delete(:extra_condition))\n\n # rp: type is not set in all instances such as Class.first\n # so this fix goes here for now.\n if ogtype = options[:type] || (klass.schema_inheritance_child? ? \"#{klass}\" : nil)\n update_condition options, \"ogtype='#{ogtype}'\"\n end\n\n sql = \"SELECT #{fields} FROM #{tables.join(',')}\"\n\n if condition = options[:condition]\n # If an array is passed as a condition, use prepared\n # statement style escaping.\n if condition.is_a?(Array)\n condition = prepare_statement(condition)\n end\n\n sql << \" WHERE #{condition}\"\n end\n\n if group = options[:group] || options[:group_by]\n sql << \" GROUP BY #{group}\"\n end\n\n if order = options[:order] || options[:order_by]\n sql << \" ORDER BY #{order}\"\n end\n\n resolve_limit_options(options, sql)\n\n if extra = options[:extra] || options[:extra_sql]\n sql << \" #{extra}\"\n end\n\n return sql\n end", "def select(*props)\n @query[:select] = props.join(',')\n self\n end", "def to_sql(options = {})\n sql = \"UPDATE #{table.to_sql(options)} SET \"\n sql << updates.map { |u| u.to_sql(options) }.join(', ')\n sql << \" WHERE \" << where.to_sql(options) if self.where\n sql\n end", "def _insert_select_raw(ds)\n if use_prepared_statements_for?(:insert_select)\n if ps = model.send(:prepared_insert_select, @values.keys)\n _set_prepared_statement_server(ps).call(@values)\n end\n else\n super\n end\n end", "def add_select_options(opt)\n opt.on('--select x,y,z', Array,\n \"Select x, y, z columns only\") do |value|\n self.select = value.collect{|c| c.to_sym}\n end\n opt.on('--allbut x,y,z', Array,\n \"Select all but x, y, z columns\") do |value|\n self.allbut = value.collect{|c| c.to_sym}\n end\n end", "def copy_into_sql(table, opts)\n sql = String.new\n sql << \"COPY #{literal(table)}\"\n if cols = opts[:columns]\n sql << literal(Array(cols))\n end\n sql << \" FROM STDIN\"\n if opts[:options] || opts[:format]\n sql << \" (\"\n sql << \"FORMAT #{opts[:format]}\" if opts[:format]\n sql << \"#{', ' if opts[:format]}#{opts[:options]}\" if opts[:options]\n sql << ')'\n end\n sql\n end", "def fat_record_select\n select = 'semantic_relations.id AS id, semantic_relations.created_at AS created_at, '\n select << 'semantic_relations.updated_at AS updated_at, '\n select << 'object_id, object_type, subject_id, predicate_uri, '\n select << 'obj_props.created_at AS property_created_at, '\n select << 'obj_props.updated_at AS property_updated_at, '\n select << 'obj_props.value AS property_value, '\n select << 'obj_sources.created_at AS object_created_at, '\n select << 'obj_sources.updated_at AS object_updated_at, obj_sources.type AS object_realtype, '\n select << 'obj_sources.uri AS object_uri, '\n select << 'subject_sources.uri AS subject_uri'\n select\n end", "def sql(options = {}) \n table = options[:table_class]\t\n if table.respond_to?(:do_not_use_view_for_query) and table.do_not_use_view_for_query\n\tconditions.map {|c| c.sql(options) }\n else\n\tconditions.map {|c| c.sql(options[:table_class]) }\n end\n end", "def select(*args); dataset.select(*args); end", "def select(sql, name = nil)\n raise NotImplementedError, \"select is an abstract method\"\n end", "def scrooge_select_sql(set)\n set.collect do |name|\n \"#{@quoted_table_name}.#{connection.quote_column_name(name)}\"\n end.join(ScroogeComma)\n end", "def select(sql, name = nil, binds = [])\n exec_query(sql, name, binds)\n end", "def _format_sql(sql)\n sql = sql.delete '\"'\n sql.downcase\n end", "def select(*args, **options)\n call_query_method(:select, *args, **options)\n end", "def codegen_select\n header, body, footer = \"function select(cursor, data)\\n\", [], \"end\\n\"\n \n # Setup target object.\n body << \"target = data\"\n body << \"\" if groups.length > 0\n\n # Initialize groups.\n groups.each do |group|\n body << \"group_value = #{group.accessor}\"\n body << \"if cursor:eos() or cursor:eof() then group_value = -1 end\" if group.expression == 'action_id'\n body << \"if target[group_value] == nil then\"\n body << \" target[group_value] = {}\"\n body << \"end\"\n body << \"target = target[group_value]\"\n body << \"\"\n end\n\n # Generate the assignment for each field.\n fields.each do |field|\n alias_name = field.target_name\n \n case field.aggregation_type\n when nil\n body << \"target.#{alias_name} = #{field.accessor}\"\n when :count\n body << \"target.#{alias_name} = (target.#{alias_name} or 0) + 1\"\n when :sum\n body << \"target.#{alias_name} = (target.#{alias_name} or 0) + #{field.accessor}\"\n when :min\n body << \"if(target.#{alias_name} == nil or target.#{alias_name} > #{field.accessor}) then\"\n body << \" target.#{alias_name} = #{field.accessor}\"\n body << \"end\"\n when :max\n body << \"if(target.#{alias_name} == nil or target.#{alias_name} < #{field.accessor}) then\"\n body << \" target.#{alias_name} = #{field.accessor}\"\n body << \"end\"\n else\n raise StandardError.new(\"Invalid aggregation type: #{field.aggregation_type}\")\n end\n end\n \n # Indent body and return.\n body.map! {|line| \" \" + line}\n return header + body.join(\"\\n\") + \"\\n\" + footer\n end", "def prepared_sql\n case prepared_type\n when :select, :all, :each\n # Most common scenario, so listed first.\n select_sql\n when :first\n clone(:limit=>1).select_sql\n when :insert_select\n insert_select_sql(*prepared_modify_values)\n when :insert, :insert_pk\n insert_sql(*prepared_modify_values)\n when :update\n update_sql(*prepared_modify_values)\n when :delete\n delete_sql\n else\n select_sql\n end\n end", "def multi_query_builder\n\n query = \"\n SELECT\n #{select_arr.join(\",\\n\\t\")}\n FROM \\t#{groups.first.parent_table}\n #{pk_join_arr.join(\"\\n\")}\n #{fk_join_arr.join(\"\\n\")};\"\n\n return query\n end", "def iso_query_builder\n group_alias = \"#{groups.first.parent_table}\"\n attrs = questions.map{|question|\"\\\"#{question.attribute_name}\\\"\"}.uniq\n return \"SELECT\n #{attrs.join(',')}, year\n FROM (#{group_query_builder groups.first}) AS #{group_alias}\"\n end", "def prepared_insert_select(cols)\n if dataset.supports_insert_select?\n cached_prepared_statement(:insert_select, prepared_columns(cols)){prepare_explicit_statement(naked.clone(:server=>dataset.opts.fetch(:server, :default)), :insert_select, prepared_statement_key_hash(cols))}\n end\n end", "def to_s\n regex = REPLACEMENT\n\n if Gitlab::Database.mysql?\n regex = Regexp.union(regex, MYSQL_REPLACEMENTS)\n end\n\n sql = @sql.gsub(regex, '?').gsub(CONSECUTIVE) do |match|\n \"#{match.count(',') + 1} values\"\n end\n\n # InfluxDB escapes double quotes upon output, so lets get rid of them\n # whenever we can.\n if Gitlab::Database.postgresql?\n sql = sql.delete('\"')\n end\n\n sql.tr(\"\\n\", ' ')\n end", "def union_str(columns)\n foo=[]\n 1.upto(columns.to_i) { |num| foo << num.to_i }\n u = \"UNION ALL SELECT \" + \"#{foo.join(',')}\"\n return u\nend", "def format_select\n @attr[:multiple] = :multiple if @opts[:multiple]\n copy_options_to_attributes([:size])\n\n os = process_select_optgroups(:_format_select_optgroup) do |label, value, sel, attrs|\n if !value.nil? || sel\n attrs = attrs.dup\n attrs[:value] = value unless value.nil?\n attrs[:selected] = :selected if sel\n end\n tag(:option, attrs, [label])\n end\n tag(:select, @attr, os)\n end", "def build_sql(structure)\n structure = structure.is_a?(Constructor) ? structure.structure : structure\n sql = ''\n [:with, :union, :select, :insert, :update, :delete, :set, :from,\n :join, :where, :returning, :group, :order, :limit, :offset].each do |i|\n next unless structure[i]\n sql += send(\"build_#{i}\", structure[i], structure)\n end\n sql\n end", "def select(sql, name = nil, binds = [])\n hash_query(sql, name, binds)\n end", "def union_expand_str(expander, columns)\n foo=[]\n 1.upto(columns.to_i) { |num| foo << expander }\n u = \"UNION ALL SELECT \" + \"#{foo.join(',')}\"\n return u\nend", "def select!\n # Ensure we can never be destructive by nilifying :update.\n Mao.sql(with_options(:update => nil).sql) do |pg_result|\n if @options[:join]\n other = Mao.query(@options[:join][0])\n pg_result.map {|result|\n Mao.normalize_join_result(result, self, other)\n }\n else\n pg_result.map {|result| Mao.normalize_result(result, @col_types)}\n end\n end\n end", "def execute_dui(sql, opts=OPTS, &block)\n super(prepared_statement_name, opts, &block)\n end", "def get_raw_sql(options)\n # base.rb, find()\n validate_find_options(options)\n set_readonly_option!(options)\n # base.rb, find_every()\n include_associations = merge_includes(scope(:find, :include), options[:include])\n if include_associations.any? && references_eager_loaded_tables?(options)\n # associations.rb, find_with_associations()\n join_dependency = JoinDependency.new(self, merge_includes(scope(:find, :include), options[:include]), options[:joins])\n construct_finder_sql_with_included_associations(options, join_dependency)\n else\n # base.rb, find_every()\n construct_finder_sql(options)\n end\n end", "def query(args = {})\n initialize_query unless initialized?\n\n our_select = args[:select] || \"DISTINCT #{model.table_name}.id\"\n our_join = join.dup\n our_join += args[:join] if args[:join].is_a?(Array)\n our_join << args[:join] if args[:join].is_a?(Hash)\n our_join << args[:join] if args[:join].is_a?(Symbol)\n our_tables = tables.dup\n our_tables += args[:tables] if args[:tables].is_a?(Array)\n our_tables << args[:tables] if args[:tables].is_a?(Symbol)\n our_from = calc_from_clause(our_join, our_tables)\n our_where = where.dup\n our_where += args[:where] if args[:where].is_a?(Array)\n our_where << args[:where] if args[:where].is_a?(String)\n our_where = calc_where_clause(our_where)\n our_group = args[:group] || group\n our_order = args[:order] || order\n our_order = reverse_order(order) if our_order == :reverse\n our_limit = args[:limit]\n\n # Tack id at end of order to disambiguate the order.\n # (I despise programs that render random results!)\n if our_order.present? &&\n !our_order.match(/.id( |$)/)\n our_order += \", #{model.table_name}.id DESC\"\n end\n\n sql = %(\n SELECT #{our_select}\n FROM #{our_from}\n )\n sql += \" WHERE #{our_where}\\n\" if our_where.present?\n sql += \" GROUP BY #{our_group}\\n\" if our_group.present?\n sql += \" ORDER BY #{our_order}\\n\" if our_order.present?\n sql += \" LIMIT #{our_limit}\\n\" if our_limit.present?\n\n @last_query = sql\n sql\n end", "def quote_table_or_view(name, options)\n schema = options[:schema]\n if schema\n \"\\\"#{schema}\\\".\\\"#{name}\\\"\"\n else\n \"\\\"#{name}\\\"\"\n end\n end", "def sql_literal(*)\n @dataset.sql\n end", "def execute_dui(sql, opts={}, &block)\n super(sql, {:type=>:dui}.merge(opts), &block)\n end" ]
[ "0.6971295", "0.6947242", "0.6841219", "0.67124456", "0.61597085", "0.6125864", "0.6049496", "0.6039606", "0.60335106", "0.6030042", "0.59272957", "0.58418024", "0.5811762", "0.58023846", "0.579844", "0.57814145", "0.574884", "0.5740213", "0.56984234", "0.56884044", "0.5661593", "0.564222", "0.5624505", "0.5606713", "0.55933917", "0.55922353", "0.5563325", "0.5550695", "0.5550695", "0.5516527", "0.54784006", "0.54693216", "0.54639363", "0.5460226", "0.5442787", "0.5442766", "0.5423505", "0.5418956", "0.54114395", "0.540282", "0.5389123", "0.538192", "0.53504604", "0.53491527", "0.53489906", "0.53471637", "0.53471637", "0.53463507", "0.53278404", "0.5290013", "0.5287459", "0.5279542", "0.5269978", "0.5240411", "0.52250296", "0.5222015", "0.52104014", "0.5199373", "0.5198267", "0.5160546", "0.5158529", "0.51467174", "0.5121112", "0.5113809", "0.51107985", "0.50927424", "0.50927424", "0.50927424", "0.50893134", "0.5081431", "0.5081054", "0.5072061", "0.506736", "0.5064723", "0.5062515", "0.5061429", "0.50594205", "0.50579953", "0.5032284", "0.5029582", "0.5021454", "0.5016592", "0.5016057", "0.5013074", "0.50115377", "0.5007483", "0.5003969", "0.50032306", "0.50028634", "0.49996978", "0.4997243", "0.49931365", "0.49897835", "0.49895555", "0.49827883", "0.49817666", "0.4977766", "0.4970492", "0.49695602", "0.4960293" ]
0.68679446
2
depends_on "cmake" => :build
def install bin.install "#{PACKAGE_NAME}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_depends_on\n depends_on\n end", "def install\n# Dependency tracking only, uncomment this section only if you know what you\n# are doing!\n#\n# mkdir 'build'\n# cd 'build' do\n# system \"cmake .. #{std_cmake_parameters}\"\n# system \"make package\"\n# end\nend", "def cmake_package(options, &block)\n package_common(:cmake, options) do |pkg|\n pkg.depends_on 'cmake'\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend", "def depends_on(pkg)\n autobuild.depends_on(pkg.autobuild)\n end", "def build_gem; end", "def build_dependency\n npm_install\nend", "def common_build\n copy_gems # in make/gems.rb\n end", "def common_build\n copy_gems\n end", "def common_build\n copy_gems\n end", "def depends_on(mod)\n @log.info \"Loading module '#{mod}' as a dependency\"\n loaded = require \"#{File.dirname(__FILE__)}/modules/#{mod.to_s}.rb\"\n @log.info \"Module '#{mod}' already loaded, not re-loading\" if !loaded\nend", "def dependencies; end", "def dependencies; end", "def dependencies; end", "def depends_on( other_dependency )\n namespace name do\n task :build => \"#{other_dependency}:done\"\n end\n end", "def build_gems; end", "def depends_on\n return @depends_on\n end", "def build_release\n build_dependency\n puts '### release build ###'\n `gulp release`\n puts '### release build done ###'\n post_build\nend", "def direct_dependencies; end", "def fetch_development_dependencies # :nodoc:\n end", "def dependency_target\n self.name == \"hoe\" ? extra_deps : extra_dev_deps\n end", "def build\n cd_and_sh( pkg_dir, build_commands )\n end", "def dependencies\n self.config.depends || []\n end", "def rebuild\n build addl_cmake_bld_args: '--clean-first'\n end", "def run_in_build(*args)\n in_build do |source_dir|\n run_command(\"cmake\", \"-G\", select_generator, source_dir) unless File.exist?(\"CMakeCache.txt\")\n args.push(\"cmake\", \"--build\", \".\") if args.empty?\n args.push(\"--target\", $target) if $target\n args.push(\"--config\", $config) if $config\n run_command(*args)\n end\nend", "def prebuild(build, listener)\n end", "def prebuild(build, listener)\n end", "def prebuild(build, listener)\n end", "def depends_on(package, *version)\n dependencies << [ package, *version ]\n end", "def install_ruby_dependencies(rubie)\n pkgs = []\n case rubie\n when /^ruby-/, /^ree-/, /^rbx-/, /^kiji/\n case node['platform']\n when \"debian\",\"ubuntu\"\n pkgs = %w{ build-essential openssl libreadline6 libreadline6-dev\n zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev\n sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev\n ncurses-dev automake libtool bison ssl-cert }\n pkgs += %w{ subversion } if rubie =~ /^ruby-head$/\n when \"suse\"\n pkgs = %w{ gcc-c++ patch zlib zlib-devel libffi-devel\n sqlite3-devel libxml2-devel libxslt-devel }\n if node['platform_version'].to_f >= 11.0\n pkgs += %w{ libreadline5 readline-devel libopenssl-devel }\n else\n pkgs += %w{ readline readline-devel openssl-devel }\n end\n pkgs += %w{ git subversion autoconf } if rubie =~ /^ruby-head$/\n when \"centos\",\"redhat\",\"fedora\",\"scientific\",\"amazon\"\n pkgs = %w{ gcc-c++ patch readline readline-devel zlib zlib-devel\n libyaml-devel libffi-devel openssl-devel }\n pkgs += %w{ git subversion autoconf } if rubie =~ /^ruby-head$/\n end\n when /^jruby-/\n # TODO: need to figure out how to pull in java recipe only when needed. For\n # now, users of jruby will have to add the \"java\" recipe to their run_list.\n #include_recipe \"java\"\n case node['platform']\n when \"debian\",\"ubuntu\"\n pkgs += %w{ g++ ant }\n end\n end\n\n pkgs.each do |pkg|\n package pkg do\n action :nothing\n end.run_action(:install)\n end\nend", "def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end", "def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end", "def build_snapshot\n build_dependency\n puts '### dev build ###'\n puts `gulp 2>&1`\n puts '### dev build done ###'\n post_build\nend", "def depends_on=(value)\n @depends_on = value\n end", "def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end", "def build_files_command\n \"middleman build\"\n end", "def setup_maven_build_targets(cmp, build_vars)\n cmp_src_path = component_src_path cmp\n cmp_build_bin = component_build_bin cmp\n\n if cmp_build_bin != 'mvn'\n STDERR.puts \"[#{cmp}]: the builder is configured (in the YAML file) as '#{cmp_build_bin}', however it seems to be 'mvn'. Look in the source directory ('#{cmp_src_path}') for more details\"\n end\n\n mvn_versions = lookup_maven_pom(cmp_src_path)\n mvn_versions.each do |mvn_version|\n mvn_filename = 'pom.xml'\n if mvn_version != ''\n mvn_filename = 'pom.hadoop' + mvn_version + '.xml'\n end\n mvn_file = File.join cmp_src_path, mvn_filename\n\n # Store the Maven POM file\n build_vars['BUILDER_FILES'] << mvn_file\n\n # Extract the elements of version from the Maven POM XML file\n (mvn_version, has_hadoop, has_spark) = lookup_version_from_mvn_pom(mvn_filename)\n\n # Store the elements of version\n build_vars['PACKAGE_VERSIONS'][mvn_version] = true\n build_vars['HAS_HADOOP'] = has_hadoop\n build_vars['HAS_SPARK'] = has_spark\n\n # Set up the Maven build command line\n cmp_builder_cmds = \"#{cmp_build_bin} -f #{mvn_file} #{CONF_MVN_ARGS}\"\n build_vars['BUILDER_CMDS'] << \"#{cmp_builder_cmds}\"\n \n # Maven tasks/targets for building, packaing and installing (in the local\n # Maven repository, eg, ~/.m2/repository)\n cmp_builder_tasks = \"compile package install\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n\n # Set up the Maven test command line\n cmp_test_tasks = \"test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n end\nend", "def setup\n default_repository.update_submodules(:recursive => true)\n true\n end", "def build\n safesystem \"autoreconf -vfi\"\n configure :prefix => prefix\n make\n end", "def test_no_build_deps\n c = Control.new(__method__)\n c.parse!\n assert_equal(nil, c.source.fetch('build-depends', nil),\n \"Found a build dep #{c.source.fetch('build-depends', nil)}\")\n end", "def cmake_has_parallel_flag?\n (CMAKE_VERSION <=> [3, 12]) >= 0\nend", "def common_build\n puts \"common_build dir=#{pwd} #{SHOES_TGT_ARCH}\"\n #mkdir_p \"#{TGT_DIR}/ruby\"\n #cp_r \"#{EXT_RUBY}/lib/ruby/#{RUBY_V}\", \"#{TGT_DIR}/ruby/lib\"\n %w[req/ftsearch/lib/* req/rake/lib/*].each do |rdir|\n FileList[rdir].each { |rlib| cp_r rlib, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}\" }\n end\n %w[req/ftsearch/ext/ftsearchrt req/chipmunk/ext/chipmunk].\n #%w[req/binject/ext/binject_c req/ftsearch/ext/ftsearchrt req/bloopsaphone/ext/bloops req/chipmunk/ext/chipmunk].\n each { |xdir| copy_ext xdir, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}/#{SHOES_TGT_ARCH}\" }\n\n gdir = \"#{TGT_DIR}/lib/ruby/gems/#{RUBY_V}\"\n {'hpricot' => 'lib', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n #{'hpricot' => 'lib', 'json' => 'lib/json/ext', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n spec = eval(File.read(\"req/#{gemn}/gemspec\"))\n mkdir_p \"#{gdir}/specifications\"\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/lib\"\n FileList[\"req/#{gemn}/lib/*\"].each { |rlib| cp_r rlib, \"#{gdir}/gems/#{spec.full_name}/lib\" }\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/#{xdir}\"\n FileList[\"req/#{gemn}/ext/*\"].each { |elib| copy_ext elib, \"#{gdir}/gems/#{spec.full_name}/#{xdir}\" }\n cp \"req/#{gemn}/gemspec\", \"#{gdir}/specifications/#{spec.full_name}.gemspec\"\n end\n end", "def autotools_package(options, &block)\n package_common(:autotools, options) do |pkg|\n pkg.depends_on 'autotools'\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend", "def prebuild(build, listener)\n # do any setup that needs to be done before this build runs.\n end", "def make_deps t\n sh \"gcc -MM -MF #{t.name} #{$C_FLAGS.join ' '} -c #{t.source}\"\nend", "def dependencies=(_arg0); end", "def enable_dependency_loading; end", "def enable_dependency_loading; end", "def install_dependencies\n raise 'Not implemented'\n end", "def pre_install; 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 pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def install_dependencies\n recipe_eval do\n run_context.include_recipe 'chef-sugar::default'\n run_context.include_recipe 'build-essential::default'\n\n case node.platform_family\n when 'debian'\n package 'curl'\n package 'git-core'\n package 'libxml2-dev'\n package 'libxslt-dev'\n package 'zlib1g-dev'\n package 'ncurses-dev'\n package 'libssl-dev'\n when 'freebsd'\n package 'textproc/libxml2'\n package 'textproc/libxslt'\n package 'devel/ncurses'\n when 'mac_os_x'\n run_context.include_recipe 'homebrew::default'\n package 'libxml2'\n package 'libxslt'\n package 'openssl'\n when 'rhel'\n package 'curl'\n package 'bzip2'\n package 'file'\n package 'git'\n package 'libxml2-devel'\n package 'libxslt-devel'\n package 'ncurses-devel'\n package 'zlib-devel'\n package 'openssl-devel'\n end\n end\n end", "def define_packaging_tasks\n\n\t\t### Task: prerelease\n\t\tunless Rake::Task.task_defined?( :pre )\n\t\t\tdesc \"Append the package build number to package versions\"\n\t\t\ttask :pre do\n\t\t\t\trev = get_numeric_rev()\n\t\t\t\ttrace \"Current rev is: %p\" % [ rev ]\n\t\t\t\t$hoespec.spec.version.version << \"pre#{rev}\"\n\t\t\t\tRake::Task[:gem].clear\n\n\t\t\t\tGem::PackageTask.new( $hoespec.spec ) do |pkg|\n\t\t\t\t\tpkg.need_zip = true\n\t\t\t\t\tpkg.need_tar = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnamespace :deps do\n\n\t\t\tif RVM_GEMSET.exist?\n\t\t\t\tdesc \"Update the project's RVM gemset\"\n\t\t\t\ttask :gemset do\n\t\t\t\t\tdeps = make_gemset_recommendations( $hoespec.spec )\n\t\t\t\t\tupdates = deps.values.compact\n\n\t\t\t\t\tif !updates.empty?\n\t\t\t\t\t\t$stderr.puts \"%d gems in the current gemset have newer matching versions:\" %\n\t\t\t\t\t\t\t [ updates.length ]\n\t\t\t\t\t\tdeps.each do |old, newer|\n\t\t\t\t\t\t\tnext unless newer\n\t\t\t\t\t\t\t$stderr.puts \" #{old} -> #{newer}\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif ask( \"Update? \" )\n\t\t\t\t\t\t\tupdate_rvm_gemset( deps )\n\t\t\t\t\t\t\trun 'rvm', 'gemset', 'import', RVM_GEMSET.to_s\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\n\t\t### Make the ChangeLog update if the repo has changed since it was last built\n\t\tfile '.hg/branch'\n\t\tfile 'ChangeLog' => '.hg/branch' do |task|\n\t\t\t$stderr.puts \"Updating the changelog...\"\n\t\t\tcontent = make_changelog()\n\t\t\tFile.open( task.name, 'w', 0644 ) do |fh|\n\t\t\t\tfh.print( content )\n\t\t\tend\n\t\tend\n\n\tend", "def build\n\t@built_gem_path ||= @helper.build_gem\nend", "def test_harness_dependencies(*)\n return unless platform[/n(5|6)k/]\n skip_if_nv_overlay_rejected(agent)\n\n # Vxlan has a hard requirement to disable feature fabricpath on n5/6k\n cmd = 'no feature-set fabricpath'\n command_config(agent, cmd, cmd)\nend", "def install_build_dependencies(build_dependencies) # rubocop:disable Metrics/AbcSize\n http = []\n pkgutil = []\n noasks = [\"instance=overwrite\", \"partial=nocheck\", \"runlevel=nocheck\", \"idepend=nocheck\", \"rdepend=nocheck\", \"space=nocheck\", \"setuid=nocheck\", \"conflict=nocheck\", \"action=nocheck\", \"basedir=default\"]\n noask_command = noasks.map { |noask| \"echo '#{noask}' >> /var/tmp/noask\" }.join('; ')\n\n build_dependencies.each do |build_dependency|\n if build_dependency =~ /^http.*\\.gz/\n # Fetch, unpack, install...this assumes curl is present.\n package = build_dependency.sub(/^http.*\\//, '')\n http << \"tmpdir=$(#{mktemp}); (cd ${tmpdir} && curl --silent --show-error --fail -O #{build_dependency} && gunzip -c #{package} | pkgadd -d /dev/stdin -a /var/tmp/noask all)\"\n else\n # Opencsw dependencies. At this point we assume that pkgutil is installed.\n pkgutil << build_dependency\n end\n end\n\n command = ''\n unless pkgutil.empty?\n command << \"/opt/csw/bin/pkgutil -y -i #{pkgutil.join(\"\\s\")}; \"\n end\n\n unless http.empty?\n command << \"echo -n > /var/tmp/noask; #{noask_command}; \"\n command << http.join('; ')\n end\n\n command\n end", "def cask(name); dep name, :template => \"icelab:cask\"; end", "def activate_compiler_deps\n dependency \"rake-compiler\", \"~> 1.0\", :development\n\n gem \"rake-compiler\", \"~> 1.0\"\n rescue LoadError\n warn \"Couldn't load rake-compiler. Skipping. Run `rake newb` to fix.\"\n end", "def build; end", "def build_me\n # Download all softwares in parallel\n download\n build\n end", "def my_post_build_step\n puts 'post-build step!'\nend", "def setup_build_deps!\n ENV['PATH'] = \"#{File.expand_path('../../../vendor/depot_tools', __FILE__)}:#{ENV['PATH']}\"\n Dir.chdir(File.expand_path('../../../vendor', __FILE__)) do\n system \"fetch v8\" or fail \"unable to fetch v8 source\"\n Dir.chdir('v8') do\n unless system \"git checkout #{source_version}\"\n fail \"unable to checkout source for v8 #{source_version}\"\n end\n system \"gclient sync\" or fail \"could not sync v8 build dependencies\"\n end\n end\n 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 test_dependencies\n []\n end", "def test_dependencies\n []\n end", "def dependent; end", "def dependent; end", "def install\n # ENV.deparallelize # if your formula fails when building in parallel\n args = std_cmake_args\n if build.with? \"static\"\n args << \"-DBUILD_SHARED_LIBS:BOOL=OFF\"\n end\n inreplace \"cmake/External_zlib.cmake\", \"1.2.8\", \"1.2.11\"\n inreplace \"cmake/External_zlib.cmake\", \"44d667c142d7cda120332623eab69f40\", \"1c9f62f0778697a09d36121ead88e08e\"\n\n system \"cmake\", \".\", *args\n system \"make\"\n system \"make\", \"install\"\n end", "def build\n sh './configure -u couchdb -c'\n make :release\n end", "def build_depfile(name, perform_installation=false)\n repo_hash = {}\n # set environment variable to determine what version of modules to install\n # this assumes that the environment variable repos_to_use has been coded in\n # your Depfile to allow installation of different versions of modules\n ENV['repos_to_use'] = name\n # parse Depfile and install modules in our tmp directory.\n eval(File.read(File.expand_path(options[:depfile])))\n # install modules if desired\n install! if perform_installation\n\n # iterate through all git modules\n each_module_of_type(:git) do |git_repo|\n abort(\"Module git_repo[:name] was defined multiple times in same Depfile\") if repo_hash[git_repo[:name]]\n repo_hash[git_repo[:name]] = git_repo\n end\n # clear out the modules once finished\n clear_modules\n repo_hash\n end", "def build_gem\n Juwelier::Commands::BuildGem.build_for(self).run\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 require_gems; end", "def activate_publish_deps\n dependency \"rdoc\", [\">= 4.0\", \"< 7\"], :developer if need_rdoc\n end", "def build_environment_resources(environment, system_exec)\n puts \"Building all required resources for environment '#{environment.environment_name}'\"\n\n if environment.is_drupal_environment?\n build_css_and_js_for_drupal\n environment.create_template_resources\n end\n\n copy_project_dependencies_for_awestruct_image\n build_base_docker_images(environment, system_exec)\n build_environment_docker_images(environment, system_exec)\n\nend", "def activate_inline_deps\n dependency \"RubyInline\", \"~> 3.9\"\n end", "def setup_sbt_build_targets(cmp, build_vars)\n cmp_src_path = component_src_path cmp\n cmp_build_bin = component_build_bin cmp\n cmp_hadoop_versions = component_hadoop_versions cmp\n cmp_spark_versions = component_spark_versions cmp\n\n # SBT build (for Scala code)\n sbt_file = lookup_sbt_file(cmp_src_path)\n if sbt_file != ''\n if cmp_build_bin != 'sbt'\n STDERR.puts \"[#{cmp}]: the builder is configured (in the YAML file) as '#{cmp_build_bin}', however it seems to be 'sbt'. Look in the source directory ('#{cmp_src_path}') for more details\"\n end\n\n # Store the SBT build file\n build_vars['BUILDER_FILES'] << sbt_file\n\n # Extract the elements of version from the SBT build file\n (sbt_version, has_hadoop, has_spark) = lookup_version_from_sbt_build(sbt_file)\n\n # Store the elements of version\n build_vars['PACKAGE_VERSIONS'][sbt_version] = true\n build_vars['HAS_HADOOP'] = has_hadoop\n build_vars['HAS_SPARK'] = has_spark\n\n # Set up the SBT build command line\n sbt_args_hadoop_list = Array.new\n sbt_args_list = Array.new\n sbt_args_base = \"\\'; #{CONF_SBT_ARGS} ; set version := \\\"#{sbt_version}\"\n if has_hadoop\n # There should be a target for every version of Hadoop\n cmp_hadoop_versions.each do |hadoop_version|\n sbt_args = \"#{sbt_args_base}-hadoop#{hadoop_version}\"\n sbt_args_hadoop_list << sbt_args\n end\n end\n\n if has_spark\n # When building for Spark, Hadoop is necessarily part of the target\n cmp_spark_versions.each do |spark_version|\n sbt_args_hadoop_list.each do |sbt_args|\n sbt_args += \"-spark#{spark_version}\"\n sbt_args_list << sbt_args\n end\n end\n\n else\n # Target for Hadoop, but not Spark\n sbt_args_hadoop_list.each do |sbt_args|\n sbt_args_list << sbt_args\n end\n end\n\n if sbt_args_list.empty?\n # Target with Hadoop, and potentially Spark\n sbt_args = sbt_args_base + \"\\\"\\'\"\n\n cmp_builder_cmds = \"#{cmp_build_bin} #{sbt_args}\"\n build_vars['BUILDER_CMDS'] = \"#{cmp_builder_cmds}\"\n\n cmp_builder_tasks = \"+compile +package +publishM2 +publishLocal\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n # Set up the SBT test command line\n cmp_test_tasks = \"+test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n\n else\n # Target with neither Hadoop nor Spark\n sbt_args_list.each do |sbt_args|\n sbt_args += \"\\\"\\'\"\n\n cmp_builder_cmds = \"#{cmp_build_bin} #{sbt_args}\"\n build_vars['BUILDER_CMDS'] = \"#{cmp_builder_cmds}\"\n \n cmp_builder_tasks = \"+compile +package +publishM2 +publishLocal\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n \n # Set up the SBT test command line\n cmp_test_tasks = \"+test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n end\n end\n\n else\n STDERR.puts \"[#{cmp}]: cannot determine the builder in '#{cmp_src_path}'\"\n end\nend", "def build_remote_dependencies\n modules_json_path = \"#{@mod.cache_dir}/.terraform/modules/modules.json\"\n return unless File.exist?(modules_json_path)\n\n initialized_modules = JSON.load(IO.read(modules_json_path))\n # For example of structure see spec/fixtures/initialized/modules.json\n initialized_modules[\"Modules\"].each do |meta|\n build_remote_mod(meta)\n end\n end", "def build_package\n # Force timestamp to be initialized before anything else. This gives us a\n # stable timestamp for the process.\n timestamp\n # Prepare the work area: copy files from root_path to work_path based on\n # the resolved Manifest.txt.\n prepare_work_area\n # Anything that has been modified locally needs to be reset.\n restore_modified_files\n # Save both the final release metadata and the in-package release metadata.\n save_release_metadata\n # Vendor the dependencies for the package.\n vendor_dependencies\n # Request that supporting plug-ins build the package.\n request_build_package\n end", "def install\n system \"cmake\", \".\", *std_cmake_args\n system \"make\", \"install\"\n end", "def dependency_met?\n true\n end", "def update_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-d' : '-q')}\"\n end", "def gemspec_building_block; end", "def build_pkg(dist, arch, deps)\n start_dir = Dir.pwd\n build_dir = \"/tmp/rhobuild\"\n version = Rhoconnect::VERSION\n description = '\"Rhoconnect production environment\"'\n prefix = \"/opt/rhoconnect/installer\"\n gem_name = \"rhoconnect-#{version}.gem\"\n\n before_install_script = \"#{build_dir}/unix-like/pre_install.sh\"\n after_install_script = \"#{build_dir}/unix-like/post_install.sh\"\n before_remove_script = \"#{build_dir}/unix-like/pre_uninstall.sh\"\n after_remove_script = \"#{build_dir}/unix-like/post_uninstall.sh\"\n\n `rm -rf #{build_dir}` if File.exist?(\"#{build_dir}\")\n Dir.mkdir(\"#{build_dir}\")\n Dir.mkdir(\"#{build_dir}/unix-like\")\n\n # Copy all necessary Files into the build_dir\n system(\"cp install.sh Gemfile Gemfile.lock #{build_dir}\")\n system(\"cp -r installer/unix-like/*.sh #{build_dir}/unix-like\")\n system(\"cp -r installer/unix-like/*.rb #{build_dir}/unix-like\")\n system(\"cp pkg/#{gem_name} #{build_dir}\")\n\n # cd into the pkg dir so that fpm will create the package into the pkg dir.\n Dir.chdir(\"./pkg\") # it created by build task and should already exist\n\n # Construct fpm command\n fpm_cmd = \"fpm -s dir -t #{dist} -n rhoconnect -v #{version} -a #{arch} -C #{build_dir} --epoch 1 \" +\n \"--before-install #{before_install_script} --after-install #{after_install_script} \" +\n \"--before-remove #{before_remove_script} --after-remove #{after_remove_script} \" +\n \"--prefix #{prefix} --description #{description}\"\n # Add the list of dependencies to the fpm call\n deps.each { |dep| fpm_cmd << \" -d '#{dep}'\" }\n fpm_cmd << \" './'\"\n # Create the package\n system(fpm_cmd)\n # Leave no trace...\n system(\"rm -rf #{build_dir}\")\n Dir.chdir(start_dir)\nend", "def enable_dependency_loading=(_arg0); end", "def enable_dependency_loading=(_arg0); end", "def build_cardio()\n CommandProcessor.command(\"VERSION=#{@current_release.version} ./releasinator.sh\", live_output=true)\nend", "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 install_modules_dependencies(spec, new_arch_enabled: ENV['RCT_NEW_ARCH_ENABLED'] == \"1\")\n NewArchitectureHelper.install_modules_dependencies(spec, new_arch_enabled, $FOLLY_VERSION)\nend", "def development?\n @dependency.type == :development\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n # cp \"#{EXT_RUBY}/lib/libruby.so.#{RUBY_V}\", \"#{TGT_DIR}\"\n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n # can't figure out ln -s? push pwd, cd, ln, pop\n #cdir = pwd\n #cd TGT_DIR\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n #ln_s \"libruby.so.#{RUBY_V}\", \"libruby.so.#{::RUBY_V[/^\\d+\\.\\d+/]}\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end", "def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end", "def setup_project_python_environment\n if not has_valid_virtualenv?\n return false\n end\n if should_do_requirements_install\n action \"Installing user defined python dependencies\" do\n unless install_user_python_dependencies()\n return false\n end\n note_install(\"pythonenv\")\n end\n end\n if should_install_python_dependencies?\n unless install_python_dependencies()\n return false\n end\n end\n return true\n end", "def dependencies\n\t\t0\n\tend", "def gemspec( * )\n\t\traise \"Circular dependency: can't depend on the gemspec to build itself\"\n\tend", "def testBuild2LevelsDependency\n setRepository('DeliverablesProcessDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID3/0.1/TestDeliverable'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID3/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID2/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n end\n end", "def install\n system \"cmake\", \"-S\", \".\", \"-B\", \"build\", *std_cmake_args\n system \"cmake\", \"--build\", \"build\"\n system \"cmake\", \"--install\", \"build\"\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end", "def 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 build(chroot,dirs,task,add_to_autoreq=true,snapshot_release=false)\n validate_in_mock_group?\n _verbose = ENV.fetch('SIMP_PKG_verbose','no') == 'yes'\n\n # Default package metadata for reference\n default_metadata = YAML.load(File.read(\"#{@src_dir}/build/package_metadata_defaults.yaml\"))\n\n metadata = Parallel.map(\n # Allow for shell globs\n Array(dirs),\n :in_processes => get_cpu_limit,\n :progress => task.name\n ) do |dir|\n result = []\n\n fail(\"Could not find directory #{dir}\") unless Dir.exist?(dir)\n\n Dir.chdir(dir) do\n built_rpm = false\n unique_build = (get_cpu_limit != 1).to_s\n\n if _verbose\n $stderr.puts(\"Running 'rake pkg:rpm' on #{File.basename(dir)}\")\n end\n\n # We're building a module, override anything down there\n if File.exist?('metadata.json')\n unique_namespace = (0...24).map{ (65 + rand(26)).chr }.join.downcase\n\n Simp::Rake::Pkg.new(Dir.pwd, nil, unique_namespace, @simp_version)\n\n Rake::Task[\"#{unique_namespace}:pkg:rpm\"].invoke(chroot, unique_build, snapshot_release)\n\n built_rpm = true\n\n # We're building one of the extra assets and should honor its Rakefile\n elsif File.exist?('Rakefile')\n\n rake_flags = Rake.application.options.trace ? '--trace' : ''\n\n cmd = %{SIMP_BUILD_version=#{@simp_version} rake pkg:rpm[#{chroot},#{unique_build},#{snapshot_release}] #{rake_flags} 2>&1}\n\n build_success = true\n begin\n ::Bundler.with_clean_env do\n %x{#{cmd}}\n build_success = $?.success?\n end\n\n built_rpm = true\n rescue\n build_success = false\n end\n\n unless build_success\n if _verbose\n $stderr.puts(\"First 'rake pkg:rpm' attempt failed, running bundle and trying again.\")\n end\n\n ::Bundler.with_clean_env do\n %x{bundle install --with development}\n %x{#{cmd}}\n end\n end\n else\n puts \"Warning: '#{dir}' could not be built via Rake\"\n end\n\n if built_rpm\n tarballs = Dir.glob('dist/*.tar.gz')\n srpms = Dir.glob('dist/*.src.rpm')\n rpms = (Dir.glob('dist/*.rpm') - srpms)\n\n # Not all items generate tarballs\n tarballs.each do |pkg|\n if (File.stat(pkg).size == 0)\n raise(\"Empty Tarball '#{pkg}' generated for #{dir}\")\n end\n end\n raise(\"No SRPMs generated for #{dir}\") if srpms.empty?\n raise(\"No RPMs generated for #{dir}\") if rpms.empty?\n\n last_build = {\n 'git_hash' => %x{git show-ref --head HEAD}.chomp,\n 'rpms' => {}\n }\n\n # Glob all generated rpms, and add their metadata to a result array.\n rpms.each do |rpm|\n # get_info from each generated rpm, not the spec file, so macros in the\n # metadata have already been resolved in the mock chroot.\n metadata = Simp::RPM.get_info(rpm)\n\n if File.exist?('build/package_metadata.yaml')\n metadata.merge!(YAML.load_file('build/package_metadata.yaml'))\n end\n\n rpm_stat = File.stat(rpm)\n\n last_build['rpms'][rpm] = {\n 'metadata' => metadata,\n 'size' => rpm_stat.size\n }\n\n result << metadata\n end\n\n File.open('dist/.last_build_metadata', 'w') do |fh|\n fh.puts(last_build.to_yaml)\n end\n end\n\n if _verbose\n $stderr.puts(\"Finshed 'rake pkg:rpm' on #{File.basename(dir)}\")\n end\n end\n\n result\n end\n\n metadata.each do |mod|\n # Each module could generate multiple rpms, each with its own metadata.\n # Iterate over them to add all built rpms to autorequires.\n mod.each do |module_pkginfo|\n next unless (module_pkginfo && module_pkginfo.is_a?(Hash))\n\n # Set up the autorequires\n if add_to_autoreq\n # Register the package with the autorequires\n mode = 'r+'\n mode = 'w+' unless File.exist?(\"#{@src_dir}/build/autorequires\")\n autoreq_fh = File.open(\"#{@src_dir}/build/autorequires\",mode)\n\n begin\n # Reads the autorequires file, then empties it\n autorequires = []\n autorequires += autoreq_fh.read.split(\"\\n\")\n autoreq_fh.rewind\n autoreq_fh.truncate(0)\n\n # The SIMP Rakefile expects the autorequires to be in this format.\n autorequires << \"#{module_pkginfo[:name]} #{module_pkginfo[:version]} #{module_pkginfo[:release]}\"\n autoreq_fh.puts(autorequires.sort.uniq.join(\"\\n\"))\n ensure\n autoreq_fh.flush\n autoreq_fh.close\n end\n end\n end\n end\n end", "def cabal(arg)\n arg.with_defaults(:dev => 'dev')\n if arg[:dev] == 'prod'\n 'cabal'\n else\n 'cabal-dev'\n end\n end" ]
[ "0.6862918", "0.67779785", "0.6605081", "0.6427604", "0.6401638", "0.6370821", "0.62428576", "0.6164104", "0.6164104", "0.6134335", "0.6026515", "0.6026515", "0.6026515", "0.594891", "0.59437174", "0.5839825", "0.5780695", "0.5748207", "0.57473993", "0.57118607", "0.56998265", "0.5680032", "0.5666816", "0.55673045", "0.5553601", "0.5553601", "0.5553601", "0.55466515", "0.5538157", "0.55217826", "0.55217826", "0.5519493", "0.5484798", "0.54724073", "0.54464006", "0.5435829", "0.54142326", "0.5411415", "0.5400483", "0.5386782", "0.53857106", "0.5370171", "0.5365297", "0.5351393", "0.53431296", "0.533195", "0.533195", "0.53318095", "0.53314954", "0.5329625", "0.53204703", "0.5318234", "0.53120536", "0.5303001", "0.52892995", "0.52800345", "0.52775717", "0.527258", "0.5269118", "0.5267966", "0.52616966", "0.52555907", "0.52525264", "0.52387947", "0.52387947", "0.52341557", "0.52341557", "0.522743", "0.5222687", "0.5220484", "0.521786", "0.5217262", "0.521222", "0.5204341", "0.5199813", "0.5187717", "0.51750255", "0.51721495", "0.51601803", "0.5147383", "0.51221305", "0.51193964", "0.5115175", "0.51141286", "0.51048714", "0.51048714", "0.50978106", "0.5097517", "0.50964344", "0.5092484", "0.50806177", "0.50751054", "0.50584775", "0.50555366", "0.50493675", "0.50458884", "0.5045265", "0.50407934", "0.5036601", "0.5034939", "0.5031975" ]
0.0
-1
Delete file. ==== Options +path+:: Path to delete
def rm(path) run_via "rm #{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, opts = {})\r\n delete_file_with_http_info(path, opts)\r\n nil\r\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 delete(path, options = {})\n connection.delete path, options\n end", "def delete(path = nil, options = {})\n connection.delete(path, options)\n end", "def delete\n ::File.unlink(@path)\n end", "def delete(path, options={})\n send_request 'delete', path, options\n end", "def destroy(path)\n output { delete(path) }\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 delete(path = '/files/', params = {})\n request :delete, path, params\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 _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)\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 delete(path)\n request(:delete, path)\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def deleteFile(path)\n File.delete(path) if File.exist?(path)\nend", "def delete(path, options = {})\n request(:delete, parse_query_and_convenience_headers(path, options))\n end", "def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end", "def 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, options={}, format=format)\n request(:delete, path, options, format)\n end", "def rm\n FileUtils.rm path if File.exist?(path)\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\n File.delete(file_name)\n rescue\n # ignore\n end", "def delete!\n return true unless File.exist?(path)\n FileUtils.rm(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 rm(path)\n remove(path, nil, true, false)\n end", "def destroy_file\n File.delete full_file_path\n rescue\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_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def rm(path)\n FileUtils.rm_rf(path)\n end", "def rm(path)\n FileUtils.rm_rf(expand path)\n end", "def delete!\n exist!\n File.unlink @path\n @path = nil\n end", "def perform_delete(path, options = {})\n perform_request(:delete, path, options)\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete(path, headers = {})\n process :delete, path, headers\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(path)\n request(:delete, path)\n end", "def delete(path, options={}, &b)\n event(:delete, path, options, &b)\n end", "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "def rm path\n end", "def rm(path = '.', opts = {})\n self.lib.rm(path, opts)\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_file(file)\n delete_attachment(file)\n end", "def delete(path, options = {}, &block)\n map(path, options, :delete, &block)\n end", "def remove_file(path, config = {})\n return unless behavior == :invoke\n path = File.expand_path(path, destination_root)\n\n say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true)\n ::FileUtils.rm_rf(path) if !options[:pretend] && File.exist?(path)\n end", "def delete!\n safe_close\n File.delete(@file_path)\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(name)\n File.delete(path(name))\n end", "def delete(path, options = {}, raw = false)\n request(:delete, path, options, raw)\n end", "def destroy\n remove_files(@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(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end", "def rm(path)\n file = scope.get(path)\n return if !file\n file.remove!\n end", "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(path, options={})\n response = request(path, :delete, options)\n validate response\n parsed_response = parse response\n data = { headers: response.headers, body: parsed_response }\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(path, options={}, raw=false)\n request(:delete, path, options, raw)\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_file(filename, options={})\n end", "def delete(path, request_options = {}, resource_options = {})\n response(:delete, resource(resource_options)[path], request_options)\n end", "def delete_repository_file(project_id, options = {})\n delete \"/projects/#{project_id}/repository/files\", options\n end", "def delete_file\n begin\n File.delete(stored_file_path)\n rescue => e\n logger.error(\"Could not delete #{stored_file_path}. Ignored.\")\n logger.error(e)\n end\n end", "def delete_file \n #pp \"deleting file_asset: path is\" + full_filepath\n File.delete(full_filepath) if File.exists?(full_filepath)\n end", "def delete(path)\n bucket.objects.delete(path)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete(path, headers = {})\n request(:delete, path, nil, merge_default_headers(headers))\n end", "def delete(path)\n exec { index.delete(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 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 FileUtils.rm(self.path) if exists?\n end", "def remove_file_if_present(path)\n if File.exist?(path)\n info \"unlinking #{path}\"\n File::unlink(path)\n end\n end", "def delete(path)\n root.delete(path)\n end", "def clear_file(path)\n File.open(path, 'w') {}\n end", "def delete_file(file_path)\n if Rails.env.production? && file_exists?(file_path)\n bucket.object(file_path).delete\n end\n end", "def delete(filename); end", "def rm_file(file)\n @files.delete(file.path)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete\n begin\n uy_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end", "def delete(path_info)\n @file_store.delete path_info\n\n @bucket.objects[gem_object_name(path_info)].delete\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 deleteFile(filePath, dryRun)\n #N Without this, the deletion command won't be run at all\n sshAndScp.deleteFile(filePath, dryRun)\n end", "def delete_file(basepath = MP3_STORAGE_PATH)\n FileUtils.rm_rf(\"#{basepath}/#{id}\")\n end", "def destroy(remote_path)\n get_adapter.delete_file(remote_path)\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" ]
[ "0.8407309", "0.81522477", "0.81036603", "0.79300404", "0.778736", "0.778736", "0.7774574", "0.7636546", "0.7590984", "0.75753653", "0.75179183", "0.74867314", "0.7411207", "0.73821634", "0.7351604", "0.73277605", "0.7283918", "0.7283918", "0.7267925", "0.71940285", "0.7148059", "0.7123664", "0.71185166", "0.7090606", "0.7089804", "0.7078873", "0.70728797", "0.70693356", "0.70633745", "0.7059293", "0.70350343", "0.70306385", "0.7026923", "0.7008124", "0.6975866", "0.6973344", "0.6952566", "0.6952566", "0.6949147", "0.6926051", "0.69189894", "0.69181085", "0.6901364", "0.6896256", "0.6890708", "0.6882194", "0.68623614", "0.68580854", "0.68471825", "0.6805135", "0.68042266", "0.6764671", "0.67488354", "0.67344123", "0.67312515", "0.67282575", "0.6717186", "0.6711622", "0.6709192", "0.6705411", "0.6651015", "0.6643695", "0.66435164", "0.6639357", "0.6635515", "0.66222024", "0.6614119", "0.66110545", "0.6608229", "0.6604278", "0.66023314", "0.65865064", "0.6565915", "0.65653855", "0.6564229", "0.6562036", "0.6561899", "0.65590286", "0.65447783", "0.65325123", "0.653138", "0.6509384", "0.65020895", "0.6486702", "0.6476157", "0.64754", "0.6470744", "0.644962", "0.6448004", "0.6448004", "0.6442858", "0.64392644", "0.6438884", "0.6415324", "0.6415324", "0.6415324", "0.6415324", "0.6415324", "0.6415324", "0.6415324" ]
0.7109298
23