code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# -*- coding: utf-8 -*-
require 'pathname'
namespace(:generar) do
desc "Genera el reporte de la evaluacion en formato csv"
task :reporte => :environment do
puts "** Generando Reporte ..."
def row(*args)
args.join('|')
end
def clear(text)
text.gsub("\r",'').gsub("\n",'')
end
#TO... | Ruby |
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
rspec_gem_dir = nil
Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
end
rspec_plugin_dir = File.expand_path(Fil... | Ruby |
namespace(:evaluacion) do
task :merge_comentarios => :environment do
corresponde_pregunta_id=758
no_corresponde_pregunta_id=775
puts "recolectando comentarios de las respuestas a la pregunta que si le corresponden.\n"
corresponde={}
Respuesta.find_all_by_evaluado_id_and_pregunta_id(274,correspond... | Ruby |
namespace :plan_accion do
desc "Asigna sus afectados a los planes de accion, teniendo en cuenta el campo
'usuario_id' de la tabla 'planes_acciones_usuarios'\n La tabla se usaba para representar relacion uno-a-uno"
task :set_afectado => :environment do
puts "Starting"
Usuario.all.each do |u|
id... | Ruby |
require 'pathname'
namespace(:generar) do
desc "Genera el reporte de la evaluacion en formato csv"
task :totalizado => :environment do
def row(*args)
args.join('|')
end
def tipo_evaluador(tipo, evaluado_id, evaluador_id)
case tipo
when "subordinado"
"superior"
when "sup... | Ruby |
namespace(:actualizar) do
task :build_all => :environment do
[:datos_usuarios,:asignar_preguntas,:resultado_preguntas,:competencia_a_preguntas ,:resultado_competencias].each{|t| build t}
end
task :iva_aguinaldo_visitadores => :environment do
Usuario.update_all("iva_aguinaldo=1", "cargo_id=45")
end
... | Ruby |
# -*- coding: utf-8 -*-
require 'rubygems'
require 'faster_csv'
namespace :competencias do
desc ""
task :set_descripciones => :environment do
Descripcion.find(:all,:include=>:competencia_cargo).each do |descripcion|
descripcion.competencia_id=descripcion.competencia_cargo.competencia_id
descripcion.... | Ruby |
PARAMETROS_ATTRIBUTES=[
{:codigo=>'PV00',
:nombre=>"Salario Minimo.",
:descripcion=>"Salario Minimo vigente.",
},
{:codigo=>'PV01',
:nombre=>"Tolerancia llegadas tardias.",
:descripcion=>"Cantidad maxima de minutos a tolerar en las marcaciones de entrada, utilizado para el descuento por llegadas t... | Ruby |
require 'rubygems'
require 'faster_csv'
namespace :load do
desc "Carga las jearaquias en el sistema"
task :jerarquias => :environment do
[Cargo, Subordinado, Par, Superior].map(&:delete_all)
filename = "#{RAILS_ROOT}/doc/csv/estructura_de_cargos.csv"
# posicion = 0
FasterCSV.foreach(filename, :quote_ch... | Ruby |
namespace(:evaluacion) do
desc "Asignar las preguntas correspondientes a los usuarios evaluados"
task :asignar_preguntas => :environment do
Evaluacion.all.each do |evaluacion|
puts "\n\n\nEvaluacion #{evaluacion.nombre}"
puts "------------------\n\n"
#evaluados=evaluacion.evaluados.all(:select... | Ruby |
#Seguridad.
#Se definen los módulos y la relación entre ellos en el método "load_modules",
#este utiliza "create_or_update_modulo(attributes,nom_padre='')" para crear o
#actualizar los módulos. Una vez cargados todos los módulos, se cargan
#los controllers y sus acciones con el metodo "load_controllers_actions".
#La pa... | Ruby |
dir = File.dirname(__FILE__)
Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file|
require file
end | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'spec/rails/story_adapter' | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# an... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# an... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/breakpointer' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy' | Ruby |
#!/usr/bin/env ruby
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../rspec/lib' # For svn
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
require 'rubygems'
require 'drb/drb'
require 'rbconfig'
require 'spec'
require 'optparse'
specmate = "#{ENV['HOME']}/Lib... | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/breakpointer' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console' | Ruby |
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
require 'spec'
exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server' | Ruby |
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
require 'spec'
exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin' | Ruby |
#!/usr/bin/env ruby
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../rspec/lib' # For svn
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
require 'rubygems'
require 'drb/drb'
require 'rbconfig'
require 'spec'
require 'optparse'
specmate = "#{ENV['HOME']}/Lib... | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate' | Ruby |
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'spec/rails'
Spec::Runner.configure do |config|
config.use_transactional_fixtures = true
config.... | Ruby |
module RecentHelper
end
| Ruby |
module ApplicationHelper
def relative_time(from_time)
from_time = from_time.to_time if from_time.respond_to?(:to_time)
distance_in_minutes = (((Time.now - from_time).abs)/60).round
case distance_in_minutes
when 0..1 then (distance_in_minutes == 0) ? '< 1 min ago' : '1 min ago'
when 2..45 then "#{d... | Ruby |
class Recent
def name
"Recent Changes"
end
def recent_items(options)
Page.recent_items(options)
end
def last_modified
Page.last_modified
end
end | Ruby |
module SearchHelper
end
| Ruby |
module PageHelper
def show_errors
if @page && !@page.errors.empty?
content_tag(
"div",
content_tag("ul", @page.errors.full_messages.collect { |msg| content_tag("li", msg) }),
:class => "errorExplanation"
)
end
end
def comparing?
controller.action_name == "compare"
end
def editing?
cont... | Ruby |
module FeedHelper
end
| Ruby |
module TagHelper
end
| Ruby |
class Comment < ActiveRecord::Base
belongs_to :revision
belongs_to :user
validates_presence_of :comment, :minimum => 2
def page
revision.page
end
# is this method really needed?
def content
comment
end
end
| Ruby |
class User < ActiveRecord::Base
validates_presence_of :name, :message => "is required"
validates_uniqueness_of :name
before_save :set_key
private
def set_key
self.key = Digest::MD5.hexdigest((object_id + rand(255)).to_s)
end
end
| Ruby |
class Revision < ActiveRecord::Base
belongs_to :page
belongs_to :user
has_many :comments
validates_presence_of :content
before_save :generate_wikified_content
# get the revision number as displayed on the page
def rid
return 1 if self.page.nil?
revs = self.page.index_revisions
n = 0
until n >= revs.l... | Ruby |
class Page < ActiveRecord::Base
has_many :index_revisions, :class_name => "Revision", :order => "created_at DESC",
:select => 'id, created_at', :include => :user
has_many :revisions, :dependent => :destroy, :order => "created_at DESC", :include => :user
has_many :comments, :through => :revisions, :order =>... | Ruby |
class TagController < ApplicationController
def index
if params[:tag]
@tag = Tag.find_or_new(params[:tag])
render :action => "pages"
else
render :action => "tags"
end
end
end
| Ruby |
class SearchController < ApplicationController
before_filter :show_search
def index
@terms = params[:search]
if request.post? && @terms.blank?
flash.now[:notice] = "No search terms given."
end
@tags = Tag.search(@terms) || [ ]
@page_items = Page.search(@terms) || [ ]
end
protected
def show_search
... | Ruby |
class FeedController < ApplicationController
session :off
before_filter :since
layout nil
def authenticate
unless WikiOptions[:allow_anonymous_read]
unless params[:key] && User.find_by_key(params[:key])
render :nothing => true, :status => 403 # forbidden
return false
end
end
end
def page
@f... | Ruby |
class ApplicationController < ActionController::Base
include ExceptionNotifiable rescue nil
before_filter :authenticate
def authenticate
unless session[:user_name]
begin
require 'external_auth'
session[:user_name] = ExternalAuth.get_user(cookies)
rescue LoadError
end
end
if session[:user_nam... | Ruby |
class RecentController < ApplicationController
def index
end
end
| Ruby |
class PageController < ApplicationController
include HTMLDiff
before_filter :load_page, :except => :edit_preview
def show
redirect_to(:action => "edit", :title => @title) and return if @revision.new_record?
@content = @revision.to_s if @revision.content
end
def popup
show
render :layout => "popup"
end
... | Ruby |
require "#{RAILS_ROOT}/lib/core_extensions/string"
| Ruby |
ActionController::Routing::Routes.draw do |map|
# ===== pages =====
map.page_feed 'page/:name/:key/feed.xml', :controller => 'feed', :name => 'Contents', :action => 'page'
map.page 'page/:title/:action/:rev/:rev2',
:controller => 'page',
:title => 'Contents',
:action => 'show',
:rev => nil,
:rev2 ... | Ruby |
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
unless defined?(Rails::Initializer)
if File.directory?("#{RAILS_ROOT}/vendor/rails")
require "#{RAILS_ROOT}/vendor/rails/railties/lib/init... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
config.log_level = :warn
# Full error reports are disabled and caching is turned on
config.action_con... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
class String
include Wikify
def url_unescape
CGI.unescape(self)
end
end
| Ruby |
#
# Copied from Instiki-0.11.0 by David Heinemeier Hansson.
# License available at: http://www.ruby-lang.org/en/LICENSE.txt
#
module HTMLDiff
Match = Struct.new(:start_in_old, :start_in_new, :size)
class Match
def end_in_old
self.start_in_old + self.size
end
def end_in_new
self.start_... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test datab... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# an... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# an... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/breakpointer' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/breakpointer' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.