code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run CmsRails::Application
| Ruby |
CmsRails::Application.routes.draw do
resources :programs, :as => 'flow_programs', :only => [:index, :show, :new, :edit, :create, :update, :destroy] do
member do
get 'tooltip'
get 'delete'
get 'sections'
get 'controls'
end
end
resources :directives, :as => 'flow_directives', :only... | Ruby |
require File.expand_path('../boot', __FILE__)
require 'yaml'
CMS_CONFIG = {
"SECRET_TOKEN" => "0123456789abcdefChangethistosomethingsecret",
"COMPANY" => "Company, Inc.",
"COMPANY_LOGO" => nil,
"COMPANY_LOGO_TEXT" => nil,
"ABOUT_LINK" => "https://code.google.com/p/compliance-management/",
"SECTION_IMPORT_... | Ruby |
CmsRails::Application.configure do
# Settings specified here will take precedence over those in config/application.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 web ... | Ruby |
CmsRails::Application.configure do
# Settings specified here will take precedence over those in config/application.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... | Ruby |
CmsRails::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned o... | Ruby |
CmsRails::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.cache_classes = true
config.action_controller.perform_caching = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error rep... | Ruby |
# Disable Rake-environment-task framework detection by uncommenting/setting to false
# Warbler.framework_detection = false
# Warbler web application assembly configuration file
Warbler::Config.new do |config|
# Features: additional options controlling how the jar is built.
# Currently the following features are su... | Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
Rails.backtrace_cleaner.remove_silencers!
| Ruby |
# Be sure to restart your server when you modify this file.
CmsRails::Application.config.session_store :encrypted_cookie_store, :key => '_cms_session_id'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table ... | Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | Ruby |
require 'gdoc'
require 'gdoc/document'
| Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
module CmsRails
class Application < Rails::Application
def self.sso_callback_url
@@sso_callback rescue nil
end
def self.sso_callback_url=(url)
@@sso_callback = url
end
end
end
| Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... | Ruby |
# Monkey patch to avoid riddle trying to exec stuff
ENV['SPHINX_VERSION'] = '2.0.4'
require 'riddle'
module Riddle
class Controller
def sphinx_version
ENV['SPHINX_VERSION']
end
end
end
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails applicatio... | Ruby |
# Monkey patch Prawn to fix 'incompatible character encodings' error in JRuby:
# https://github.com/prawnpdf/prawn/issues/283
require 'prawn'
module Prawn
module Core
def self.utf8_to_utf16(str)
str
end
end
end
| Ruby |
namespace :import do
desc "Import various documents into CMS"
task :consolidated, [:filename] => [:environment] do |t, args|
puts "Import consolidated format from #{args[:filename]}"
require 'importer/consolidated'
ActiveRecord::Base.transaction do
importer = Importer::Consolidated.new
imp... | Ruby |
namespace :demo do
desc "Load demo seed data"
task :seed => :environment do |t, args|
demo_seed_file = File.join(Rails.root, 'db', 'demo_seeds', 'demo_seeds.rb')
load(demo_seed_file)
end
task :setup => [:environment, :"db:seed", :"demo:seed"]
task :reset, [ :subdir ] => [:environment, :"db:reset", :s... | Ruby |
namespace :export do
desc "Export help data to YAML file"
task :help, [:filename] => [:environment] do |t, args|
puts "Exporting help data to #{args[:filename]}"
File.open(args[:filename], 'w') do |file|
YAML::dump(Help.all, file)
end
end
end | Ruby |
require 'open-uri'
require 'csv'
module Importer
# Importer for specialized CSV document format
#
# Expected columns are:
# 0-4: Company control index, unused, title, description-part-1, description-part-2
# 5-6: Directive 1: description, slug(s)
# 7-8: Directive 2: description, slug(s)
# 9-10... | Ruby |
require 'open-uri'
require 'csv'
module Importer
class Regulation
def initialize
end
def run_file(filename)
open(filename, 'r:utf-8') do |file|
run_csv(file.read)
end
end
def run_csv(csv_string)
directive = nil
headers_seen = false
CSV.parse(csv_string) ... | Ruby |
require 'gdata'
module Gdoc
DOCLIST_SCOPE = 'https://docs.google.com/feeds/'
DOCLIST_DOWNLOD_SCOPE = 'https://docs.googleusercontent.com/'
CONTACTS_SCOPE = 'https://www.google.com/m8/feeds/'
SPREADSHEETS_SCOPE = 'https://spreadsheets.google.com/feeds/'
DEFAULT_FEED = DOCLIST_SCOPE + 'default/private/full'
... | Ruby |
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
# Importer contains classes and methods to import data from various formats
# into the system.
module Importer
class ImportError < StandardError
end
end
| Ruby |
#!/usr/bin/env ruby
require 'rubygems'
require 'jabber/bot'
require 'fileutils'
home = File.join(ENV['HOME'], ".jbot")
FileUtils.mkdir_p(home)
# Save my PID
pid = File.new(File.join(home, 'pid'), "w")
pid.write($$)
pid.close
# Create a public Jabber::Bot
bot = Jabber::Bot.new(
:jabber_id => 'bina@pm.sc.gov.br',
... | Ruby |
#!/usr/bin/env ruby
require 'rubygems'
require 'jabber/bot'
require 'fileutils'
home = File.join(ENV['HOME'], ".jbot")
FileUtils.mkdir_p(home)
# Save my PID
pid = File.new(File.join(home, 'pid'), "w")
pid.write($$)
pid.close
# Create a public Jabber::Bot
bot = Jabber::Bot.new(
:jabber_id => 'bina@pm.sc.gov.br',
... | Ruby |
#!/usr/bin/ruby
#===============================================================================
#
# FILE: siab.rb
#
# USAGE: ruby siab.rb [start|stop|restar|help]
#
# DESCRIPTION: a ShellInAbox control script and configuration system reader.
# To auto-configure a shellinabox service creat... | Ruby |
Reported by bXXX.rXXX@oXXX.com, Mar 11, 2011
I found the need to have a nice start / stop / restart wrapper for
shellinabox, and a quick way to add new configurations and URLS.
Attached is a file that does just that.
It is ruby based, and expects a conf directory in the shellinthebox
home directory. All file(s) plac... | Ruby |
class CreateAccounts < ActiveRecord::Migration
def self.up
create_table :accounts do |t|
t.primary_key :id
t.string :user_name,:null=>false
t.datetime :last_login_dt,:null=>false
t.datetime :create_dt,:null=>false
t.integer :level,:null=>false
t.timestamp
end
en... | Ruby |
class CreateMenus < ActiveRecord::Migration
def self.up
create_table :menus do |t|
t.primary_key :id
t.integer :parent_id
t.string :shortname,:null=>false
t.string :longname,:null=>true
t.string :controller
t.string :action
t.string :parameters
t.text :description,:... | Ruby |
class CreatePosts < ActiveRecord::Migration
def self.up
create_table :posts do |t|
t.string :title
t.text :content
t.string :author
t.timestamps
end
end
def self.down
drop_table :posts
end
end
| Ruby |
class AddWikiIsNewsFlag < ActiveRecord::Migration
def self.up
add_column :wikis,:is_news,:boolean,:default=>false,:null=>true
end
def self.down
remove_column :wikis,:is_news
end
end
| Ruby |
class AddDescriptionToAccounts < ActiveRecord::Migration
def self.up
add_column :accounts ,:description,:text
end
def self.down
remove_column :accounts,:description
end
end | Ruby |
class AddWikiIsRdoc < ActiveRecord::Migration
def self.up
add_column :wikis,:is_rdoc,:boolean,:default=>false,:null=>true
end
def self.down
remove_column :wikis,:is_rdoc
end
end
| Ruby |
class CreateWikis < ActiveRecord::Migration
def self.up
create_table :wikis do |t|
t.string :title
t.text :content
t.timestamps
end
end
def self.down
drop_table :wikis
end
end
| Ruby |
class CreateTags < ActiveRecord::Migration
def self.up
create_table :tags do |t|
t.string :tag_name
t.integer :post_id
end
end
def self.down
drop_table :tags
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 |
#!c:/ruby/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... | Ruby |
#!c:/ruby/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
#... | Ruby |
#!c:/ruby/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... | Ruby |
#!c:/ruby/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... | Ruby |
#!c:/ruby/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
#... | Ruby |
#!c:/ruby/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... | 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/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 |
#!/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 |
module ContactHelper
end
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def check_is_admin
if session[:username]
return UserProxy.is_admin(session[:username])
else
return false
end
end
def plain_text(text,replacement=" ")
text.gsub(/<[^>]*>/)... | Ruby |
module UserHelper
end
| Ruby |
module MenusHelper
end
| Ruby |
module TrainingHelper
end
| Ruby |
module PostsHelper
end
| Ruby |
module DownloadsHelper
end
| Ruby |
module WikisHelper
end
| Ruby |
module MainHelper
def rend_dash_board(title,posts)
ret="<h1>#{title}</h1><ul>"
posts.each do |post|
ret<<"<li>"<<link_to(post.title,:action=>:show,:id=>post.id)<<"</li>"
end
ret<<"</ul>"
end
end
| Ruby |
class Account < ActiveRecord::Base
def self.create(username)
return self.new(:user_name=>username,:last_login_dt=>Time.new,:create_dt=>Time.new,:level=>0)
end
end
| Ruby |
class Wiki < ActiveRecord::Base
end
| Ruby |
class UserProxy
@@userInfo={"admin"=>"Stephan_vance_elp7654123","guest"=>"guest"}
@@admin=["admin","David_H","li_yang-stephan"]
def self.check(username,password)
passexpected=@@userInfo[username]
if passexpected
return password==passexpected
else
return LdapUser.authenticate(userna... | Ruby |
class Post < ActiveRecord::Base
has_many :tags
attr_accessor :tag_text
after_save :save_tags
def tag_text
if id
tags=Tag.find(:all,:conditions=>["post_id=?",id])
ret=""
tags.each do |tag|
if ret==""
ret=tag.tag_name
else
ret<<" "<<tag.tag_name
e... | Ruby |
#
# To change this template, choose Tools | Templates
# and open the template in the editor.
class Tag < ActiveRecord::Base
belongs_to :post
end
| Ruby |
class Trace
#this is a session class
attr_accessor :trace
@@MAX_LEN=10
def initialize()
@trace=[]
end
def add(url)
@trace<<url
if @trace.length()>@@MAX_LEN
@trace.slice!(0,@trace.length()-@@MAX_LEN)
end
end
end
| Ruby |
class Menu < ActiveRecord::Base
def self.get_main_menu
[
["Dashboard",{:controller=>:main,:action=>:dashboard}],
["Training",{:controller=>:training,:action=>:introduction}],
["Downloads",{:controller=>:downloads,:action=>:introduction}],
["Contact",{:controller=>:contact,:action=>:contact... | Ruby |
class WikisController < ApplicationController
# GET /wikis
# GET /wikis.xml
def index
@wikis = Wiki.find(:all,:order=>'id desc')
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @wikis }
end
end
# GET /content/xxxx
def show_by_title
@wiki=Wiki.fin... | Ruby |
class PostsController < ApplicationController
# GET /posts
# GET /posts.xml
before_filter :check_is_admin
def index
@posts = Post.find(:all,:order=>'updated_at desc')
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @posts }
end
end
# GET /posts/1
... | Ruby |
class MenusController < ApplicationController
active_scaffold :menu do |config|
config.label="Menus"
config.list.columns=[:id,:parent_id,:shortname,:longname,:controller,:action,:parameters,:description,:create_dt,:level]
config.columns=[:parent_id,:shortname,:longname,:controller,:action,:parameters,:des... | Ruby |
class DownloadsController < ApplicationController
before_filter :load_main_menu,:except=>[:index,:login]
before_filter :load_side_bar,:except=>[:index,:login]
before_filter :auth,:except=>[:login,:do_login]
before_filter :record_action_name,:except=>[:show]
layout 'main'
@@ftp_path="D:/company/ftp/"
def i... | Ruby |
require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/inline'
require 'rdoc/markup/simple_markup/to_html'
class MainController < ApplicationController
before_filter :load_main_menu,:except=>[:index,:login]
before_filter :load_side_bar,:except=>[:index,:login]
before_filter :auth,:except=>[:... | Ruby |
class TrainingController < ApplicationController
layout "main"
before_filter :load_main_menu,:except=>[:index,:login]
before_filter :load_side_bar,:except=>[:index,:login]
before_filter :auth
before_filter :record_action_name,:except=>[:show]
helper :main
def introduction
@trainings=Post.find_by_sql("... | Ruby |
class ContactController < ApplicationController
layout "main"
before_filter :load_main_menu,:except=>[:index,:login]
before_filter :load_side_bar,:except=>[:index,:login]
before_filter :auth
before_filter :record_action_name,:except=>[:show]
helper :main
generate_posts_list "Contact","contact"
def show
... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details
... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# i... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
ActionController::Routing::Routes.draw do |map|
map.resources :posts
map.resources :wikis
map.resources :menus,:active_scaffold => true
map.connect 'content/:title',:controller=> "wikis",:action=>"show_by_title"
# The priority is based upon order of creation: first created -> highest priority.
# Sampl... | Ruby |
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | Ruby |
# Be sure to restart your server when you modify this file
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.0... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.