code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
################################################################################
### Builder
### ERB Wrapper
################################################################################
# Requires: jsmin (http://rubyforge.org/projects/riposte/)
# $ gem install jsmin
#
# More info at http://www.crockford.com/javas... | Ruby |
require 'rake'
################################################################################
# Prepare
####
ROOT = File.expand_path(File.dirname(__FILE__))
LIBS = File.join(ROOT, 'lib')
SRCS = File.join(ROOT, 'src')
GLOB = {
'HEADER' => File.join(SRCS, 'header.js')
}
INCS = {
'type' => File.join(SRCS, 'type'... | Ruby |
#!/usr/bin/ruby
# jsmin.rb 2007-07-20
# Author: Uladzislau Latynski
# This work is a translation from C to Ruby of jsmin.c published by
# Douglas Crockford. Permission is hereby granted to use the Ruby
# version under the same conditions as the jsmin.c on which it is
# based.
#
# /* jsmin.c
# 2003-04-21
#
# Copyrig... | Ruby |
require 'rake'
require 'erb'
################################################################################
# Prepare
####
ROOT = File.expand_path(File.dirname(__FILE__))
LIBS = File.join(ROOT, 'lib')
SRCS = File.join(ROOT, 'src')
INCS = {
'type' => [],
'crypto' => ['type'],
'cookie' => ['type'],
'query' ... | Ruby |
#!/usr/bin/ruby
# jsmin.rb 2007-07-20
# Author: Uladzislau Latynski
# This work is a translation from C to Ruby of jsmin.c published by
# Douglas Crockford. Permission is hereby granted to use the Ruby
# version under the same conditions as the jsmin.c on which it is
# based.
#
# /* jsmin.c
# 2003-04-21
#
# Copyrig... | Ruby |
ROOT = File.expand_path(File.dirname(__FILE__))
require 'rake'
require 'maruku'
Dir.chdir(ROOT) do
require 'build/builder'
require 'build/crypto'
require 'build/incs'
require 'build/pager'
end
################################################################################
# Prepare
####
DOCS = File.join(ROO... | Ruby |
require 'erb'
require 'jsmin' # rubygem
################################################################################
### Builder
### ERB Wrapper
################################################################################
# Requires:
#
# jsmin (http://rubyforge.org/projects/riposte/)
# $ gem in... | Ruby |
require 'rake'
################################################################################
# Prepare
####
ROOT = File.expand_path(File.dirname(__FILE__))
LIBS = File.join(ROOT, 'lib')
SRCS = File.join(ROOT, 'src')
FINAL = File.join(LIBS, 'cgu.js')
START = File.join(SRCS, 'cgu.js')
INCS = [
'type.js',
'crypt... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
# Configure the Rakefile's tasks.
###
# Company and SSL Details
# Used with the ssl_cert task.
###
# The company name - used for SSL certificates, and in srvious other places
COMPANY_NAME = "Example Com"
# The Country Name to use for SSL Certificates
SSL_COUNTRY_NAME = "US"
# The State Name to use for SSL Certifica... | Ruby |
case node["platform_family"]
when 'rhel'
default['graphite']['packages'] = %w{graphite-web MySQL-python expect python-carbon python-whisper}
end
default['graphite']['db_name'] = 'graphite'
default['graphite']['db_engine'] = 'django.db.backends.mysql'
default['graphite']['db_username'] = 'graphite'
default['gra... | Ruby |
# Recipe graphite::mysql
script "Configure mysql for graphite" do
interpreter "bash"
user "root"
code <<-EOF
mysql -e "CREATE USER 'graphite'@'localhost' IDENTIFIED BY 'complexpassw0rd';" -u root
mysql -e "GRANT ALL PRIVILEGES ON graphite.* TO 'graphite'@'localhost';" -u root
mysql -e "CREATE DATABA... | Ruby |
# Recipe graphite::install
# Install MySQL
include_recipe "mysql::install"
# Install Graphite
node['graphite']['packages'].each do |pkg|
package pkg do
action :install
end
end
template "/etc/graphite-web/local_settings.py" do
source "local_settings.py.erb"
mode 0755
owner "root"
group "root"
end
# C... | Ruby |
# Recipe graphite::default
| Ruby |
name 'graphite'
maintainer 'Cornell Greene'
maintainer_email 'akak548@yahoo.com'
license 'All rights reserved'
description 'Installs/Configures graphite'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.0'
recipe 'graphite::i... | Ruby |
case node["platform_family"]
when "rhel"
default['mysql']['server']['package'] = 'mysql-server'
default['mysql']['service'] = 'mysqld'
when "debian"
default['mysql']['server']['package'] = 'mysql-server'
default['mysql']['service'] = 'mysqld'
end
| Ruby |
# Recipe mysql::install
package node['mysql']['server']['package'] do
action :install
end
service node['mysql']['service'] do
supports :restart => true, :reload => true
action [:enable, :start]
end
| Ruby |
# Recipe mysql::default
| Ruby |
case node["platform_family"]
when "debian"
# do things on debian-ish platforms (debian, ubuntu, linuxmint)
default['mongo']['repository_url'] = 'http://downloads-distro.mongodb.org/repo/debian-sysvinit'
default['mongo']['packages'] = %w{mongodb-10gen}
default['mongo']['service'] = 'mongodb'
when "rh... | Ruby |
# Recipe mongo::repo
#
# Adds mongodb reposistory server
#
case node['platform_family']
when 'rhel'
template '/etc/yum.repos.d/mongodb.repo' do
source 'repository.erb'
owner 'root'
group 'root'
mode '0644'
action :create_if_missing
end
when 'debian'
template '/etc/apt/... | Ruby |
# Recipe mongo::default
#
# Default recipe for mongo
#
| Ruby |
# Recipe mongo::default
#
# Default recipe for mongo
#
include_recipe "mongo::repo"
node['mongo']['packages'].each do |pkg|
package pkg do
if node['platform_family'] == 'debian'
options("--allow-unauthenticated")
end
action :install
end
end
service node['mongo']['service'] do
supports :star... | Ruby |
# Recipe yum::epel
| Ruby |
default['postgresql']['packages'] = %w{postgresql postgresql-server}
default['postgresql']['service'] = 'postgresql'
| Ruby |
# Recipe postgresql::default
node['postgresql']['packages'].each do |pkg|
package pkg do
action :install
end
end
script "Initializing PostgreSQL Database" do
interpreter "bash"
user "root"
code <<-EOF
service postgresql initdb
EOF
not_if {::File.exists?("/var/lib/pgsql/data/postgresql.conf")}
e... | Ruby |
#
# Rakefile for Chef Server Repository
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | 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 |
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
if defined?(ActiveRecord)
# Include Active Record class name as root for JSON serialized output.
ActiveRecord::Base.include_root_in_json = true
# Store the full clas... | 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 |
# 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
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | 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 |
# 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.3... | 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 |
ActionController::Routing::Routes.draw do |map|
map.root :controller => "home"
map.resources :blog
map.resources :bloggers
map.resource :session
map.register '/register', :controller => 'bloggers', :action => 'new'
map.login '/login', :controller => 'sessions', :action => 'new'
map.logout '/logout', :... | Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module BackAboutHelper
end
| Ruby |
module EventsHelper
end
| Ruby |
module BackPartnersHelper
end
| Ruby |
module BlogHelper
end
| Ruby |
module ContactHelper
end
| Ruby |
module BackServicesHelper
end
| Ruby |
module BackSolutionsHelper
end
| Ruby |
module ClientsHelper
end
| Ruby |
module SessionsHelper
end | Ruby |
module PartnersHelper
end
| Ruby |
module SolutionsHelper
end
| Ruby |
module HomeHelper
end
| Ruby |
module PrivacyHelper
end
| Ruby |
module BloggersHelper
end | Ruby |
module BackClientsHelper
end
| Ruby |
module BackHomeHelper
end
| Ruby |
module BackEventsHelper
end
| Ruby |
module BackPrivacyHelper
end
| Ruby |
module ServicesHelper
end
| Ruby |
module BackMenuHelper
end
| Ruby |
module BackFooterHelper
end
| Ruby |
module AboutHelper
end
| Ruby |
class IdeaType < ActiveRecord::Base
has_many :idea
end
| Ruby |
class Event < ActiveRecord::Base
end
| Ruby |
require 'digest/sha1'
class Blogger < ActiveRecord::Base
# Virtual attribute for the unencrypted password
attr_accessor :password
validates_presence_of :login, :email
validates_presence_of :password, :if => :password_required?
validates_presence_of :password_confirmation, ... | Ruby |
class Partner < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:min_size => 0,
:max_size => 500.kilobytes,
:processor => :Rmagick
validates_as_attachment
end
| Ruby |
class SolutionType < ActiveRecord::Base
has_many :solution
end
| Ruby |
class ContactMailer < ActionMailer::Base
def contact(recipient)
subject recipient[:subject]
recipients recipient[:sendto]
from ["#{recipient[:name]}<#{recipient[:email]}>"]
body "#{recipient[:message]}"
reply_to recipient[:email]
end
end
| Ruby |
class Solution < ActiveRecord::Base
belongs_to :solution_type
acts_as_ferret :field => [:so_content,:so_title]
end
| Ruby |
class Client < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:min_size => 0,
:max_size => 500.kilobytes,
:processor => :Rmagick
validates_as_attachment
has_many :service
end
| Ruby |
class Service < ActiveRecord::Base
belongs_to :service_comment
belongs_to :service_type
belongs_to :client
acts_as_ferret :field => [:sl_content,:sl_title]
def self.full_text_search(q, options = {})
return nil if q.nil? or q.strip.blank?
default_options = {:limit => 10, :page => 1}
options = de... | Ruby |
class AboutComm < ActiveRecord::Base
end
| Ruby |
class Comment < ActiveRecord::Base
belongs_to :idea
end
| Ruby |
class ServiceType < ActiveRecord::Base
has_many :service
end
| Ruby |
class ServiceComment < ActiveRecord::Base
has_one :service
end
| Ruby |
class About < ActiveRecord::Base
end
| Ruby |
class Idea < ActiveRecord::Base
has_many :comment
belongs_to :idea_type
end
| Ruby |
class ServicesController < ApplicationController
def index
@services=Service.paginate :page=>params[:page],:per_page=>15
end
def find
@page=params[:page]
@keyWord=params[:keyWord]
@per_page = 10
if @page==nil||@page==""
@page=1
end
@services=Service.find_by_contents(@keyWo... | Ruby |
class HomeController < ApplicationController
def index
end
end
| Ruby |
class BloggersController < ApplicationController
# render new.rhtml
def new
end
def create
cookies.delete :auth_token
# protects against session fixation attacks, wreaks havoc with
# request forgery protection.
# uncomment at your own risk
# reset_session
@blogger = Blogger.new(param... | Ruby |
class BlogController < ApplicationController
def index
@titel = "CGT Blog"
end
end
| Ruby |
class BackSolutionsController < BaseController
layout "back"
def list#shwo
@solutions = Solution.paginate( :page => params[:page],
:per_page => 10,
:order => "updated_at DESC")
end
# GET /solutions/1
# GET /solutions/1.xml
def show
if params[:list]
@solution = Solution.find(:f... | Ruby |
class BackServicesController < BaseController
layout "back"
def list
#debugger
@services = Service.paginate( :page => params[:page],
:per_page => 10,
:order => "updated_at DESC")
end
# GET /services/1
# GET /services/1.xml
def show
if params[:id]
@service = Service.find(:f... | Ruby |
class BackPartnersController < ApplicationController
layout "back"
def list#shwo
@partners = Partner.paginate( :page => params[:page],
:per_page => 10,
:order => "updated_at DESC")
end
# GET /partners/1
# GET /partners/1.xml
def show
if params[:list]
@partner = Partner.find(:f... | Ruby |
class BackAboutController < ApplicationController
def com_col
@com_col =About.find_by_name('com_col')
end
def com_col_new
@com_col =About.find_by_name('com_col')
end
def create_com_col
@about= About.find(params[:id])
respond_to do |format|
if @about.update_attributes(params[:about... | Ruby |
class BackEventsController < BaseController
layout "back"
def index
@events = Event.paginate( :page => params[:page],
:per_page => 10,
:order => "updated_at DESC")
end
def show
if params[:list]
@event = Event.find(:first,:conditions => [ "id = ?" , params[:list]])
else
... | Ruby |
class BackMenuController <BaseController
layout "back"
def index
end
end
| Ruby |
class BackHomeController < ApplicationController
layout "back"
def event
@event =About.find_by_name('event')
end
def event_new
@event =About.find_by_name('event')
end
def create_event
@about= About.find(params[:id])
respond_to do |format|
if @about.update_attributes(params[:about]... | Ruby |
# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController
# render new.rhtml
def new
end
# Blog login submit process
def create
self.current_blogger = Blogger.authenticate(params[:login], params[:password])
if logged_in?
if params[:rem... | Ruby |
# To change this template, choose Tools | Templates
# and open the template in the editor.
class BaseController < ApplicationController
puts "===============================this is come from baseController======================================"
end
| Ruby |
class BackClientsController < ApplicationController
layout "back"
def list#shwo
@clients = Client.paginate( :page => params[:page],
:per_page => 10,
:order => "updated_at DESC")
end
# GET /clients/1
# GET /clients/1.xml
def show
if params[:list]
@client = Client.find(:first,:c... | Ruby |
class ClientsController < ApplicationController
def index
@clients = Client.find(:all)
end
end
| Ruby |
class SolutionsController < ApplicationController
def index
@solutions=Solution.paginate :page=>params[:page],:per_page=>5
end
def find
@page=params[:page]
@keyWord=params[:keyWord]
@per_page = 3
if @page==nil||@page==""
@page=1
end
@solutions=Solution.find_by_contents(@keyWor... | Ruby |
class BackPrivacyController < ApplicationController
def index
end
end
| Ruby |
class EventsController < ApplicationController
def index
@events = Event.paginate( :page => params[:page],
:per_page => 10,
:order => "updated_at DESC")
end
def report
@event = Event.find(params[:id])
end
end
| 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
# Be sure to include AuthenticationSystem in Application Controller instead
include AuthenticatedSystem
h... | Ruby |
class PartnersController < ApplicationController
def index
@partners = Partner.find(:all)
end
end
| Ruby |
class AboutController < ApplicationController
def index
end
#Display Company Information
def company
end
def team
end
end
| Ruby |
class ContactController < ApplicationController
def index
end
def email
ContactMail.deliver_contact(params[:contact])
redirect_to :action =>"index"
end
end
| Ruby |
class BackFooterController < ApplicationController
def footer
@footer =About.find_by_name('footer')
end
def footer_new
@footer =About.find_by_name('footer')
end
def create_footer
@about= About.find(params[:id])
respond_to do |format|
if @about.update_attributes(params[:about])
... | Ruby |
class PrivacyController < ApplicationController
def index
end
end
| 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 |
#!/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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.