code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#***********************************************************************
# Adanna library: libadanna.rb
# This library is designed to be used by Adanna, as well as its pieces,
# and contains a module for Agents written external to it. The new
# design of this version of Adanna is meant to make Adanna more stable
... | Ruby |
#***********************************************************************
# Adanna Bot: testspider.rb
#
# This is an attempt to creat a spider script for Adanna that integrates
# into itself, so that Adanna has complete control over the script.
#
# Created by: Nathan Lane
# Last Updated: 05/03/2007
#***********... | Ruby |
#***********************************************************************
# Adanna Bot: spider_ie_1.rb
#
# This spider browses the site by clicking on links in Internet
# Explorer. This is a major attempt to simplify and integrate the spider
# script into Adanna more fully.
#
# Created by: Nathan Lane
# Last Upd... | Ruby |
require "win32ole"
class ScreenshotShooter
def initialize()
@wsh = WIN32OLE.new("Wscript.Shell")
end # End: def initialize()
def run_screenshot_shooter()
@wsh.SendKeys("%{PRTSC}")
@wsh.SendKeys("%{PRTSC}")
@wsh.SendKeys("%{PRTSC}")
@wsh.SendKeys("%{PRTSC}")
end # End: def run_screenshot_... | Ruby |
#***********************************************************************
# Adanna Bot: testbot.rb
#
# This is an attempt to creat a bot script for Adanna that integrates
# into itself, so that Adanna has complete control over the script.
#
# Created by: Nathan Lane
# Last Updated: 05/10/2007
#******************... | Ruby |
#***********************************************************************
# Adanna Bot: bot_launcher.rb
#
#
#
# Created by: Nathan Lane
# Last Updated: 05/10/2007
#***********************************************************************
class BotLauncher
require "libadanna"
include Adanna
include Ada... | Ruby |
#***********************************************************************
# Adanna Spider: spider_launcher.rb
#
#
#
# Created by: Nathan Lane
# Last Updated: 05/14/2007
#***********************************************************************
class SpiderLauncher
require "libadanna"
include Adanna
in... | Ruby |
#***********************************************************************
# Adanna Bot: testbot.rb
#
# This is an attempt to creat a bot script for Adanna that integrates
# into itself, so that Adanna has complete control over the script.
#
# Created by: Nathan Lane
# Last Updated: 05/03/2007
#******************... | Ruby |
#***********************************************************************
# Adanna Bot: advanced_search_bot.rb
#
# This is advanced search bot version 4.0.0, developed for the first
# time using Adanna version 2.0.0. This version will use a parameter
# string to get its data, and utilize Adanna 2.0 logging feature... | Ruby |
#***********************************************************************
# Adanna 2.0: adanna.rb
#
# This is the second attempt at creating Adanna, the Agent - Database -
# Agent controller. It is version 2.0 and uses a brand new library. The
# intent of this version is to get away from multiple libraries and
# ... | Ruby |
#***********************************************************************
# This test collects all of the links on a particular page, browses to
# them and then back, and does this going four levels of links deep.
# This excludes any links that are associated with menus, images (such
# as submit buttons ... | Ruby |
#***********************************************************************
# Script Name: VehixBot_AdvancedSearch.rb Version: 2.0.0
#
# This Bot script is designed to be more robust, and more modular, as
# well as easier to maintain. It is an effort to utilize the new more
# Object Oriented Programming features ... | Ruby |
#***********************************************************************
# Script Name: Adanna.rb Version: 1.0.0
#
# This script becomes an agent between agents that are run on a given
# host. It uses an XML config file to connect to a database server which
# retains information regarding the running of these ... | Ruby |
=begin
Main
This is the main entry point for the program.
author Nathan Lane
@date 02/04/2008
=end
# Main entry point.
if(__FILE__ == $0)
require 'adanna_logger'
require 'adanna_scheduler'
# Create a new logger using the streams given in an array, then pass that
# logger to the scheduler. When the schedu... | Ruby |
=begin
Adanna::AdannaScheduler
This is the main program loop. In previous versions this became relatively
large in size, but in this version I hope to extract any and all things not
directly relevant to the program loop specifically.
author Nathan Lane
@date 02/13/2008
=end
module Adanna
class AdannaScheduler
... | Ruby |
=begin
Adanna::AdannaLogger
This class extends the default Logger class that comes as part of the Ruby
Core. In this way more control is given to Adanna to perpetuate logs of a
particular format, such as XML, CSV, or plain text.
author Nathan Lane
@date 02/13/2008
=end
module Adanna
class AdannaLogger
... | Ruby |
class CreateHabtmReportsNoteTypes < ActiveRecord::Migration
def self.up
create_table :note_types_reports, :id => false do |t|
t.column :note_type_id, :integer, :null => false, :default => 0
t.column :report_id, :integer, :null => false, :default => 0
end
end
def self.down
drop_table :note... | Ruby |
class AddConditionsFieldsAndConditionsSignsToReportTemplates < ActiveRecord::Migration
def self.up
add_column :report_templates, :conditions_fields, :text
add_column :report_templates, :conditions_signs, :text
add_column :report_templates, :tickets_status, :string
end
def self.down
remove_column ... | Ruby |
class ChangeMaxLengthNoteTypeName < ActiveRecord::Migration
def self.up
change_column :note_types, :name, :string
end
def self.down
change_column :note_types, :name, :string, :limit => 100
end
end
| Ruby |
class CreateHabtmWcategoryAndNotetypes < ActiveRecord::Migration
def self.up
create_table :note_types_work_categories, :id => false do |t|
t.column :note_type_id, :integer, :null => false, :default => 0
t.column :work_category_id, :integer, :null => false, :default => 0
end
end
def self.down
... | Ruby |
class ChangingReportsToReportTemplatesEverywere < ActiveRecord::Migration
def self.up
rename_column :note_types_reports, :report_id, :report_template_id
rename_table :reports, :report_templates
rename_table :note_types_reports, :note_types_report_templates
end
def self.down
rename_table :note_... | Ruby |
class ChangeDeadlineFromDatetimeToTime < ActiveRecord::Migration
def self.up
change_column :requests, :deadline, :date
end
def self.down
change_column :requests, :deadline, :datetime
end
end
| Ruby |
class AddNumberToRequests < ActiveRecord::Migration
def self.up
add_column :requests, :number, :integer, :null => false, :default => 0
add_column :requests, :created_at, :timestamp
end
def self.down
remove_column :requests, :number
remove_column :requests, :created_at
end
end
| Ruby |
class AddNotes < ActiveRecord::Migration
def self.up
create_table :notes do |t|
t.column :svalue, :string, :default => ''
t.column :dvalue, :datetime
t.column :bvalue, :bool, :default => false
t.column :request_id, :integer, :null => false, :default => 0
t.column :note... | Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table "users", :force => true do |t|
t.column :login, :string
t.column :email, :string
t.column :crypted_password, :string, :limit => 40
t.column :salt, :str... | Ruby |
class ChangeEmailToAdminFlag < ActiveRecord::Migration
def self.up
remove_column :users, :email
add_column :users, :admin, :boolean, :default => false
add_column :users, :name, :string, :default => ""
end
def self.down
remove_column :users, :admin
remove_column :users, :name
add_column :u... | Ruby |
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.text :value
t.integer :user_id
t.datetime :created_at
t.integer :request_id
t.timestamps
end
end
def self.down
drop_table :comments
end
end
| Ruby |
class AddTextFieldToNoteTypes < ActiveRecord::Migration
def self.up
add_column :note_types, :choises, :text
end
def self.down
remove_column :note_types, :choises
end
end
| Ruby |
class DeleteHabtmNtWcAndAddWcidToNt < ActiveRecord::Migration
#Warning! This will empty work_categories and note_types
def self.up
NoteType.delete_all
WorkCategory.delete_all
Request.delete_all
drop_table :note_types_work_categories
add_column :note_types, :work_category_id, :integer, :defaul... | Ruby |
class AddColNumberAndChangePriorityToIntInNoteTypes < ActiveRecord::Migration
def self.up
add_column :note_types, :col_number, :integer, :default => '0'
change_column :note_types, :priority, :integer
end
def self.down
remove_column :note_types, :col_number
change_column :note_types, :priority, :f... | Ruby |
class DeleteCategoryIdFromWorkCategories < ActiveRecord::Migration
def self.up
remove_column :work_categories, :category_id
end
def self.down
add_column :work_categories, :category_id, :integer, :default => 0
end
end
| Ruby |
class ChangeEmailFromStringToText < ActiveRecord::Migration
def self.up
change_column :groups, :email, :text
rename_column :groups, :email, :emails
end
def self.down
rename_column :groups, :emails, :email
change_column :groups, :email, :string
end
end
| Ruby |
class AddOrderFieldToReportTemplates < ActiveRecord::Migration
def self.up
add_column :report_templates, :order, :string
end
def self.down
remove_column :report_templates, :order
end
end
| Ruby |
class AddDefaultValueFieldToNoteTypes < ActiveRecord::Migration
def self.up
add_column :note_types, :default_value, :text, :default => ''
end
def self.down
remove_column :note_types, :default_value
end
end
| Ruby |
class AddPriorityToNoteTypes < ActiveRecord::Migration
def self.up
add_column :note_types, :priority, :float, :default => '1'
end
def self.down
remove_column :note_types, :priority
end
end
| Ruby |
class ChangeWorkCategoryToTicketTemplateEverywere < ActiveRecord::Migration
def self.up
rename_column :note_types, :work_category_id, :ticket_template_id
rename_column :requests, :work_category_id, :ticket_template_id
rename_column :report_templates, :work_category_id, :ticket_template_id
rename_table... | Ruby |
class AddGroupIdToRequests < ActiveRecord::Migration
def self.up
add_column :requests, :group_id, :integer, :default => 0
end
def self.down
remove_column :requests, :group_id
end
end
| Ruby |
class CreateReports < ActiveRecord::Migration
def self.up
create_table :reports do |t|
t.column :name, :string
t.column :work_category_id, :integer, :null => false, :default => 0
t.column :selected_main_fields, :text
t.timestamps
end
end
def self.down
drop_table :reports
en... | Ruby |
class AddUpdatedAtUpdatedByAndCreatedByToRequests < ActiveRecord::Migration
def self.up
add_column :requests, :updated_by, :integer
add_column :requests, :created_by, :integer
add_column :requests, :updated_at, :datetime
end
def self.down
remove_column :requests, :updated_by
remove_column :re... | Ruby |
class ChangeRequestsToTicketsEverywere < ActiveRecord::Migration
def self.up
rename_column :notes, :request_id, :ticket_id
rename_column :comments, :request_id, :ticket_id
rename_table :requests, :tickets
end
def self.down
rename_column :notes, :ticket_id, :request_id
rename_column :comments,... | Ruby |
class CreateGroups < ActiveRecord::Migration
def self.up
create_table :groups do |t|
t.column :name, :string
t.column :email, :string
end
end
def self.down
drop_table :groups
end
end
| Ruby |
class CreateWorkCategories < ActiveRecord::Migration
def self.up
create_table :work_categories do |t|
t.column :name, :string, :limit => 100, :null => false
t.column :category_id, :integer, :null => false, :default => 0
end
end
def self.down
drop_table :work_categories
end
end
| Ruby |
class CreateNoteTypes < ActiveRecord::Migration
def self.up
create_table :note_types do |t|
t.column :name, :string, :limit => 100, :null => false
t.column :vtype, :string, :limit => 30, :null => false, :default => 'vstring'
end
end
def self.down
drop_table :note_types
end
end
| Ruby |
class AddRequests < ActiveRecord::Migration
def self.up
create_table :requests do |t|
t.column :name, :string, :limit => 100, :null => false
t.column :deadline, :datetime, :null => false
t.column :status, :bool, :default => false, :null => false
t.column :work_category_id,... | Ruby |
class CreateHabtmGroupsUsers < ActiveRecord::Migration
def self.up
create_table :groups_users, :id => false do |t|
t.column :group_id, :integer, :null => false, :default => 0
t.column :user_id, :integer, :null => false, :default => 0
end
end
def self.down
drop_table :groups_users
end
e... | Ruby |
class AddTvalueToNotes < ActiveRecord::Migration
def self.up
add_column :notes, :tvalue, :text, :default => ''
end
def self.down
remove_column :notes, :tvalue
end
end
| 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/local/bin/ruby18
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 imp... | Ruby |
#!/usr/local/bin/ruby18
#
# 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.... | 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/dbconsole'
| 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/dbconsole'
| 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 |
#!/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/request'
| 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/performance/request'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate' | Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module TicketTemplatesHelper
def add_note_type_link(name)
link_to_function name do |page|
page.insert_html :bottom, :note_types, :partial => 'note_type', :object => NoteType.new
page.insert_html :bottom, :note_types, :partial => 'jssort'
end
end
end
| Ruby |
module TicketsHelper
def notefield (note)
result = ""
case note.note_type.vtype
when "vstring"
result += "<br /><input id='ticket_notes_attr__value' type='text' value=\'#{note.value}\' size='40' name='ticket[notes_attr][][value]' maxlength='255'>"
when "vselect"
result += "<select id='t... | Ruby |
module SessionsHelper
end | Ruby |
module UsersHelper
end | Ruby |
module ReportTemplatesHelper
def add_search_field_link(name)
link_to_function name do |page|
condition = {:sign => "<", :field => "created_at"}
page.insert_html :bottom, :search_fields, :partial => 'search_field', :locals => {:condition => {:sign => "<", :field => "created_at"}}
end
end
end
| Ruby |
module GroupsHelper
end
| Ruby |
module ReportsHelper
end
| Ruby |
module CommentsHelper
end
| Ruby |
class TicketMailer < ActionMailer::Base
def report(ticket, message, user)
@subject = (ticket.ticket_template.name + " №"+ticket.number.to_s + " " + ticket.name)
@body["ticket"] = ticket
@body["message"] = message
@bcc = ticket.group.emails
@from = user.name + ' via ATS <ats@email.email... | Ruby |
class Note < ActiveRecord::Base
belongs_to :note_type
belongs_to :ticket
validates_length_of :svalue, :maximum => 255
validates_date :dvalue, :allow_nil => true, :if => Proc.new{ |u| (u.note_type.vtype == "vdate")}
attr_protected :svalue, :bvalue, :tvalue, :dvalue
def value
case self.note_type.vtype... | Ruby |
class Comment < ActiveRecord::Base
belongs_to :ticket
belongs_to :user
validates_length_of :value, :minimum => 1
end
| Ruby |
class NoteType < ActiveRecord::Base
belongs_to :ticket_template
has_many :notes, :dependent => :destroy
has_and_belongs_to_many :report_templates
validates_presence_of :name
validates_presence_of :vtype
validates_length_of :name, :within => 1..255
validates_presence_of :priority
validates_numericality_o... | Ruby |
require 'digest/sha1'
class User < ActiveRecord::Base
# Virtual attribute for the unencrypted password
attr_accessor :password
has_and_belongs_to_many :groups
has_many :comments
validates_presence_of :login, :name
validates_presence_of :password, :if => :password_required?
va... | Ruby |
class Ticket < ActiveRecord::Base
has_many :notes, :dependent => :destroy, :finder_sql => 'SELECT n.*, t.priority FROM note_types t, notes n ' +
' WHERE (t.id = n.note_type_id) AND n.ticket_id = #{id}' +
' ORDER BY t.priority'
belongs_to :group
belongs_to :ticket_template
validates_presence_of :name
validates... | Ruby |
class TicketTemplate < ActiveRecord::Base
has_many :note_types, :dependent => :destroy, :order => "priority"
has_many :tickets, :dependent => :destroy
has_many :report_templates, :dependent => :destroy
validates_presence_of :name
validates_uniqueness_of :name
validates_length_of :name, :within => 1..100
a... | Ruby |
class ReportTemplate < ActiveRecord::Base
belongs_to :ticket_template
has_and_belongs_to_many :note_types, :order => "priority"
validates_presence_of :name
validates_length_of :name, :within => 1..255
validates_uniqueness_of :name
serialize :selected_main_fields
serialize :conditions_fields
seria... | Ruby |
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
has_many :tickets, :dependent => :destroy
validates_length_of :name, :within => 2..100
validates_uniqueness_of :name
serialize :emails
attr_protected :emails
def emails_field
(self.emails && self.emails != [] && self.emails != [""]) ? ... | Ruby |
class ReportsController < ApplicationController
before_filter :login_required
def new
if params[:report_template_id]
@report_template = ReportTemplate.find(params[:report_template_id])
else
@report_template = ReportTemplate.find(:first)
end
@report_templates = ReportTemplate.find(:all)
... | Ruby |
class CommentsController < ApplicationController
before_filter :login_required
def create
comment = Comment.new(params[:comment])
comment.ticket = Ticket.find(params[:ticket_id])
comment.user = current_user
if (current_user.groups.include? comment.ticket.group)
if comment.save!
flash[:n... | Ruby |
class TicketTemplatesController < ApplicationController
before_filter :login_required
def index
@ticket_templates = TicketTemplate.find(:all, :order => :name)
end
def show
@ticket_template = TicketTemplate.find(params[:id])
end
def new
@heading = "New ticket template"
@ticket_template = T... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.