code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/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 |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
module CustomersHelper
end
| Ruby |
module OrdersHelper
end
| Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
module LinesHelper
end
| Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
class Customer < ActiveRecord::Base
end
| Ruby |
class Line < ActiveRecord::Base
belongs_to :order, :foreign_key => 'order_num', :class_name => 'Order'
validates_presence_of :product, :qty, :price, :unitcost
validates_numericality_of :qty, :price, :unitcost
def before_save
self.sum_sales = self.qty * self.price
self.sum_cost = self.qty * self.un... | Ruby |
require 'will_paginate'
#START:validate
#START:select
#START:has_many
class Order < ActiveRecord::Base
#END:select
#END:validate
has_many :lines, :foreign_key => 'order_num', :class_name => 'Line'
#END:has_many
cattr_reader :per_page
@@per_page = 10
#START:select
STATUS_TYPES = [
# Displayed... | Ruby |
class StoreController < ApplicationController
before_filter :authorize
#START:before_filter
# before_filter :find_cart, :except => :empty_cart
#END:before_filter
def index
redirect_to :controller=>'orders',:action => :index
end
# GET /orders/1/lines
def order_lines
if prepare_order and pa... | Ruby |
#START:authorize
#START:layout
class LoginController < ApplicationController
#END:layout
#START:filter
before_filter :authorize, :except => :login
# before_filter :authorize_admin, :on => [:add_user, :delete_user]
#END:filter
# . .
#END:authorize
#START:layout
#layout "admin"
#END:layout
#START:index
... | Ruby |
class LinesController < ApplicationController
# GET /lines
# GET /lines.xml
def index
@lines = Line.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @lines }
end
end
# GET /lines/1
# GET /lines/1.xml
def show
@line = Line.find(params... | Ruby |
class ApplicationController < ActionController::Base
def cur_user
User.find_by_name session[:user_name]
end
def cur_user_name
session[:user_name]
end
protected
def need_login
end
def need_admin
if not admin?
flash[:notice]... | Ruby |
class OrdersController < ApplicationController
before_filter :authorize
# GET /orders
# GET /orders.xml
def index
if admin?
@orders = Order.paginate :order => 'created_at DESC', :page => params[:page]
else
@orders = Order.paginate_by_user cur_user.name,:order => 'created_at DESC', :page => ... | Ruby |
#START:authorize
class AdminController < ApplicationController
before_filter :authorize
# ....
#END:authorize
layout "application"
def index
list
render :action => 'list'
end
def list
# @product_pages, @products = paginate :products, :per_page => 10
@products = Product.search(:all, ... | Ruby |
class CustomersController < ApplicationController
before_filter :authorize
# GET /customers
# GET /customers.xml
def index
if admin?
@customers = Customer.find :all
else
@customers = Customer.find :all, :conditions => ["user = ?", cur_user.name]
end
respond_to do |format|
fo... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | 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 |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/switchtower.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 |
namespace :db do
desc "Prints the migration version"
task :schema_version => :environment do
puts ActiveRecord::Base.connection.select_value('select version from schema_info')
end
end | Ruby |
class CreateNodes < ActiveRecord::Migration
def self.up
create_table :nodes do |t|
t.timestamps
end
end
def self.down
drop_table :nodes
end
end
| Ruby |
class CreateProcessDefinitions < ActiveRecord::Migration
def self.up
create_table :process_definitions do |t|
t.timestamps
end
end
def self.down
drop_table :process_definitions
end
end
| Ruby |
class CreateTasks < ActiveRecord::Migration
def self.up
create_table :tasks do |t|
t.timestamps
end
end
def self.down
drop_table :tasks
end
end
| Ruby |
class CreateTransitions < ActiveRecord::Migration
def self.up
create_table :transitions do |t|
t.timestamps
end
end
def self.down
drop_table :transitions
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 |
#!D:/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 |
#!D:/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 |
#!D:/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 |
#!D:/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 |
#!D:/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 |
#!D:/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 |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module ProcessDefHelper
end
| Ruby |
class Transition < ActiveRecord::Base
end
| Ruby |
class Node < ActiveRecord::Base
belongs_to :process_definitions, :foreign_key => "PROCESSDEFINITION_"
end
| Ruby |
class Task < ActiveRecord::Base
end
| Ruby |
class ProcessDefinition < ActiveRecord::Base
set_table_name 'jbpm_processdefinitions'
has_many :nodes, :foreign_key => "PROCESSDEFINITION_"
has_many :transitions
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
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details... | Ruby |
class ProcessDefController < ApplicationController
def self.init
pd = ProcessDefinition.create
nd = Node.create
end
def list
@process_defs = ProcessDefinition.find :all
end
def nodes
@process_def = ProcessDefinition.find_by_ID_(params[:id]);
@nodes = @process_def.nodes;
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):
# 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|
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# ... | 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 |
# 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 |
# 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 |
# To change this template, choose Tools | Templates
# and open the template in the editor.
#ActiveProcess: A Workflow/BPM engine on Rails that is inspired by JBPM
#activeprocess.rb
module ActiveProcess
class ProcessDef
has_many :nodes
has_one :start_node
end
class Node
has_many :enter_directions
h... | Ruby |
#
# To change this template, choose Tools | Templates
# and open the template in the editor.
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/testtask'
require 'spec/rake/spectask'
spec = Gem::Specification.new do |s|
s.name = 'ActiveProce... | Ruby |
#ActiveProcess: A Workflow/BPM engine on Rails that is inspired by JBPM
#activeprocess.rb
#Author: liuxu
module ActiveProcess
class GraphItem
attr_accessor :id
attr_accessor :name
attr_accessor :description
attr_accessor :events
def initialize name
@name = name
@events = []
... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
class CreateOrders < ActiveRecord::Migration
def self.up
create_table :orders do |t|
t.string :order_num
t.string :custmer
t.datetime :created_at
t.decimal :sumusd_sh
t.decimal :sumusd_re
t.string :payment
t.decimal :sum_rmb
t.string :aim_arem
t.string :req_la... | Ruby |
class CreateLines < ActiveRecord::Migration
def self.up
create_table :lines do |t|
t.string :order_num
t.string :line_id
t.string :product
t.decimal :qty
t.decimal :price
t.decimal :unitcost
t.decimal :sum_sales
t.decimal :sum_cost
t.string :req
t.times... | Ruby |
class CreateCustomers < ActiveRecord::Migration
def self.up
create_table :customers do |t|
t.string :customer
t.string :contact
t.string :email
t.string :country
t.string :tel
t.string :msn
t.string :address
t.string :user
t.timestamps
end
end
def se... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
# Copyright (c) 2006 The Pragmatic Programmers, LLC.
# Reproduced from the book "Agile Web Development with Rails, 2nd Ed.",
# published by The Pragmatic Bookshelf.
# Available from www.pragmaticprogrammer.com/titles/rails2
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sour... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.