code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/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 Dir.chdir(File.dirname(__FILE__)) Dir.chdir('..') require '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 Dir.chdir(File.dirname(__FILE__)) Dir.chdir('..') require '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/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
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module SprintHelper def effort_per_day_form_column(record, input_name) end def effort_per_day_column(record) efforts = @record.effort_per_day.sort max_effort = current = @record.total_effort first = 0 last = efforts.length - 1 values = [max_effort] markers = [0] theme = Scruffy::Them...
Ruby
require 'digest/sha1' class Login < ActiveRecord::Base # Virtual attribute for the unencrypted password attr_accessor :password validates_presence_of :login validates_presence_of :password, :if => :password_required? validates_presence_of :password_confirmation, :if ...
Ruby
class Item < ActiveRecord::Base has_many :tasks belongs_to :sprint def total_effort total = 0 self.tasks.each do |task| if task.effort then total += task.effort end end return total end def total_effort=(effort) end end
Ruby
class Bug < ActiveRecord::Base belongs_to :developer end
Ruby
class Task < ActiveRecord::Base belongs_to :item belongs_to :developer end
Ruby
class Sprint < ActiveRecord::Base has_many :items has_many :tasks, :through => :items def total_effort total = 0 self.items.each do |i| total += i.total_effort end return total end def total_points total = 0 self.items.each do |i| if i.story_points then total += i.stor...
Ruby
class Developer < ActiveRecord::Base has_many :tasks has_many :bugs end
Ruby
class AccountController < ApplicationController def index redirect_to(:action => 'login') end def login return unless request.post? self.current_user = Login.authenticate(params[:login], params[:password]) if self.current_user respond_to do |wants| wants.html { ...
Ruby
class TaskController < ApplicationController active_scaffold :task do |config| config.columns[:item].form_ui = :select config.columns[:developer].form_ui = :select config.columns[:description].form_ui = :textarea config.columns[:description].options = { :rows => 25, :cols => 80 } config.columns[:i...
Ruby
class SprintController < ApplicationController active_scaffold :sprint do |config| config.list.sorting = { :title => :asc } config.nested.add_link("Items", [:items]) config.columns = [:title, :start, :end, :total_points, :total_effort, :effort_per_day] config.list.columns = [:title, ...
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 # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_BagLock_se...
Ruby
class ItemController < ApplicationController active_scaffold :item do |config| config.columns[:description].form_ui = :textarea config.columns[:description].options = { :rows => 25, :cols => 80 } config.columns[:notes].form_ui = :textarea config.columns[:notes].options = { :rows => 25, :cols => 80 } ...
Ruby
class DeveloperController < ApplicationController active_scaffold :developer do |config| config.columns[:tasks].form_ui = :select config.list.columns = [:name, :tasks, :bugs] config.show.columns = [:name, :tasks, :bugs] config.create.columns = [:name] config.update.columns = ...
Ruby
class BugController < ApplicationController active_scaffold :bug do |config| config.columns[:notes].form_ui = :textarea config.columns[:notes].options = { :rows => 25, :cols => 80 } config.columns[:id].label = "ID" config.columns[:created].form_ui = :calendar config.columns[:fixed].form_ui = :cale...
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. Configuration is done in config/environment.rb and config/environments/*.rb unless defined?(RAILS_ROOT) root_path = File.join(File.dirname(__FILE__), '..') unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end ...
Ruby
# Be sure to restart your web 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 ...
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
# ===Scruffy Renderers # # Author:: Brasten Sager # Date:: August 14th, 2006 # # Renderers piece the entire graph together from a collection # of components. Creating new renderers allows you to create # entirely new layouts for your graphs. # # Scruffy::Renderers::Base contains the basic functionality needed # by a l...
Ruby
# ==Scruffy Helpers # # Author:: Brasten Sager # Date:: August 16th, 2006 # # Modules which provide helper methods for various situations. module Scruffy::Helpers; end require 'scruffy/helpers/canvas' require 'scruffy/helpers/layer_container' require 'scruffy/helpers/point_container' #require 'scruffy/helpers/meta'
Ruby
module Scruffy::Layers # ==Scruffy::Layers::PieSlice # # Author:: A.J. Ostman # Date:: August 14th, 2006 # # Basic Pie Chart Slice.. class PieSlice < Base # Setup Constants RADIANS = Math::PI / 180 attr_accessor :diameter attr_accessor :percent_used attr_accessor :degree_...
Ruby
module Scruffy module Layers # Experimental, do not use. class SparklineBar < Base def draw(svg, coords, options = {}) zero_point = @height / 2.0 coords.each do |coord| x, y, bar_height = (coord.first-(@bar_width * 0.5)), coord.last, (height - coord.last) bar_c...
Ruby
module Scruffy::Layers # ==Scruffy::Layers::Base # # Author:: Brasten Sager # Extended By:: A.J. Ostman # Created:: August 5th, 2006 # Last Modified:: August 27, 2006 # # Scruffy::Layers::Base contains the basic functionality needed by the various types of graphs. The Base # class is responsible hold...
Ruby
module Scruffy::Layers # ==Scruffy::Layers::Line # # Author:: Mat Schaffer # Date:: March 20th, 2007 # # Simple scatter graph class Scatter < Base # Renders scatter graph. def draw(svg, coords, options={}) svg.g(:class => 'shadow', :transform => "translate(#{relative(0.5)}, #{relative(0...
Ruby
module Scruffy::Layers # ==Scruffy::Layers::Stacked # # Author:: Brasten Sager # Date:: August 12th, 2006 # # Provides a generic way for stacking graphs. This may or may not # do what you'd expect under every situation, but it at least kills # a couple birds with one stone (stacked bar graphs and stack...
Ruby
module Scruffy::Layers # ==Scruffy::Layers::Bar # # Author:: Brasten Sager # Date:: August 6th, 2006 # # Standard bar graph. class Bar < Base # Draw bar graph. def draw(svg, coords, options = {}) coords.each do |coord| x, y, bar_height = (coord.first-(@bar_width * 0.5)), coord.l...
Ruby
module Scruffy::Layers # ==Scruffy::Layers::Average # # Author:: Brasten Sager # Date:: August 7th, 2006 # # An 'average' graph. This graph iterates through all the layers and averages # all the data at each point, then draws a thick, translucent, shadowy line graph # indicating the average values. #...
Ruby
module Scruffy::Layers # ==Scruffy::Layers::AllSmiles # # Author:: Brasten Sager # Date:: August 8th, 2006 # # The AllSmiles graph consists of smiley faces for data points, with smiles or frowns depending upon # their relative location on the graph. The highest point is crowned with a wizard hat. The Wi...
Ruby
module Scruffy::Layers # ==Scruffy::Layers::Area # # Author:: Brasten Sager # Date:: August 6th, 2006 # # Standard area graph. class Area < Base # Render area graph. def draw(svg, coords, options={}) # svg.polygon wants a long string of coords. points_value = "0,#{height} #{strin...
Ruby
module Scruffy::Layers # ==Scruffy::Layers::Line # # Author:: Brasten Sager # Date:: August 7th, 2006 # # Line graph. class Line < Base # Renders line graph. def draw(svg, coords, options={}) svg.g(:class => 'shadow', :transform => "translate(#{relative(0.5)}, #{relative(0.5)})") { ...
Ruby
module Scruffy::Layers # ==Scruffy::Layers::Pie # # Author:: A.J. Ostman # Date:: August 15, 2006 # # Provides a container for pie slice class Pie < Base include Scruffy::Helpers::LayerContainer # Basic Example: # graph = Scruffy::Graph.new # graph.title = "Snack Preference" ...
Ruby
module Scruffy::Rasterizers # == Scruffy::Rasterizers::BatikRasterizer # # Author:: Brasten Sager # Date:: August 14th, 2006 # # Purely experimental. Can be used to rasterize SVG graphs with # Apache Batik. class BatikRasterizer # Returns new BatikRasterizer. # # Options: # command:: Co...
Ruby
module Scruffy::Rasterizers # == RMagickRasterizer # # Author:: Brasten Sager # Date:: August 14th, 2006 # # The RMagickRasterizer converts SVG graphs to images using ImageMagick. class RMagickRasterizer def rasterize(svg, options={}) # I know this seems weird, I'm open to suggestions. ...
Ruby
module Scruffy module Components class Title < Base def draw(svg, bounds, options={}) svg.text(options[:title], :class => 'title', :x => (bounds[:width] / 2), :y => bounds[:height], 'font-size' => relative(100), :fill => options[:theme].marker, :stroke => 'none', 'stroke-width' => '...
Ruby
module Scruffy module Components # Component used for adding CSS styling to SVG graphs. # # In hindsight, ImageMagick and Mozilla SVG's handling of CSS styling is # extremely inconsistant, so use this at your own risk. class StyleInfo < Base def initialize(*args) super ...
Ruby
module Scruffy::Components class Legend < Base def draw(svg, bounds, options={}) legend_info = relevant_legend_info(options[:layers]) #TODO how does this related to @points? active_width, points = layout(legend_info) offset = (bounds[:width] - active_width) / 2 # Nudge over a bit for ...
Ruby
module Scruffy module Components class Base attr_reader :id # In terms of percentages: [10, 10] == 10% by 10% attr_accessor :position attr_accessor :size attr_accessor :options attr_accessor :visible def initialize(id, options = {}) @id = id.to_sym ...
Ruby
module Scruffy module Components class Background < Base def draw(svg, bounds, options={}) fill = "#EEEEEE" case options[:theme].background when Symbol, String fill = options[:theme].background.to_s when Array fill = "url(#BackgroundGradient)" sv...
Ruby
module Scruffy module Components class Label < Base def draw(svg, bounds, options={}) svg.text(@options[:text], :class => 'text', :x => (bounds[:width] / 2), :y => bounds[:height], 'font-size' => relative(100), :fill => options[:theme].marker, :stroke => 'none', 'stroke-width' => '0...
Ruby
module Scruffy module Components class Grid < Base attr_accessor :markers def draw(svg, bounds, options={}) markers = (options[:markers] || self.markers) || 5 (0...markers).each do |idx| marker = ((1 / (markers - 1).to_f) * idx) * bounds[:height] svg...
Ruby
module Scruffy module Components class DataMarkers < Base def draw(svg, bounds, options={}) unless options[:point_markers].nil? point_distance = bounds[:width] / (options[:point_markers].size - 1).to_f (0...options[:point_markers].size).map do |idx| x_coord = ...
Ruby
module Scruffy module Components # Component for displaying Graphs layers. # # Is passed all graph layers from the Graph object. # # (This may change as the capability for Graph filtering and such fills out.) class Graphs < Base STACKED_OPACITY = 0.85; def draw(svg, bou...
Ruby
module Scruffy module Components class ValueMarkers < Base attr_accessor :markers def draw(svg, bounds, options={}) markers = (options[:markers] || self.markers) || 5 all_values = [] (0...markers).each do |idx| marker = ((1 / (markers - 1).to_f) * idx) * bound...
Ruby
module Scruffy::Components # Component used to limit other visual components to a certain area on the graph. class Viewport < Base include Scruffy::Helpers::Canvas def initialize(*args, &block) super(*args) self.components = [] if block block.call(self.components) ...
Ruby
# ===Scruffy Themes # # Author:: Brasten Sager & A.J. Ostman # Date:: August 27th, 2006 # # Scruffy Themes allow you to alter the colors and appearances of # your graph. module Scruffy::Themes # ==Scruffy::Themes::Base # # Author:: Brasten Sager & A.J. Ostman # Date:: August 27th, 2006 # # The base theme...
Ruby
module Scruffy # ==Scruffy Graphs # # Author:: Brasten Sager # Date:: August 5th, 2006 # # # ====Graphs vs. Layers (Graph Types) # # Scruffy::Graph is the primary class you will use to generate your graphs. A Graph does not # define a graph type nor does it directly hold any data. Instead, a Gr...
Ruby
module Scruffy::Helpers # ==Scruffy::Helpers::Canvas # # Author:: Brasten Sager # Date:: August 16th, 2006 # # Provides common methods for canvas objects. Primarily used for providing spacial-type calculations # where necessary. module Canvas attr_accessor :components def reset_settings! ...
Ruby
module Scruffy::Helpers # ==Scruffy::Helpers::PointContainer # # Author:: Mat Schaffer # Date:: March 22nd, 2007 # # Allows all standard point operations to be called on both Array and Hash module PointContainer def self.extended point_set point_set.extend(const_get(point_set.class.to_s)) ...
Ruby
# module Scruffy::Helpers::MetaAttributes # def singleton_class # (class << self; self; end) # end # end
Ruby
module Scruffy::Helpers # ==Scruffy::Helpers::LayerContainer # # Author:: Brasten Sager # Date:: August 16th, 2006 # # Adds some common functionality to any object which needs to act as a # container for graph layers. The best example of this is the Scruffy::Graph # object itself, but this module is...
Ruby
# ==Scruffy::Layers # # Author:: Brasten Sager # Date:: August 10th, 2006 # # See documentation in Scruffy::Layers::Base # module Scruffy::Layers # Should be raised whenever a predictable error during rendering occurs, # particularly if you do not want to terminate the graph rendering process. class RenderError ...
Ruby
# ===Scruffy Rasterizers # # Author:: Brasten Sager # Date:: August 10th, 2006 # # These handle the job of rasterizing SVG images to other image formats. # At the moment, only RMagickRasterizer exists, but others may soon follow. # # I'm somewhat interesting in finding a way to integrate Apache Batik, as it's # SVG ren...
Ruby
module Scruffy::Renderers # ===Scruffy::Renderers::Cubed3d # # Author:: Brasten Sager # Date:: August 17th, 2006 # # A 3-dimensional cube effect. class Cubed3d < Empty VIEWPORT_SIZE = [25, 45] VIEWPORTS = { :top_left => [10, 25], :top_right => [55, 25], ...
Ruby
require 'builder' module Scruffy::Renderers # ===Scruffy::Renderers::Base # # Author:: Brasten Sager # Date:: August 14th, 2006 # # Provides all the base functionality needed to render a graph, but # does not provide a default layout. # # For a basic layout, see Scruffy::Renderers::Standard. class B...
Ruby
module Scruffy module Renderers # Experimental, do not use. class Sparkline < Base def define_layout self.components << Scruffy::Components::Graphs.new(:sparkline, :position => [0, 0], :size => [100, 100]) end end end end
Ruby
module Scruffy::Renderers class Standard < Empty def define_layout super do |components| components << Scruffy::Components::Title.new(:title, :position => [5, 2], :size => [90, 7]) components << Scruffy::Components::Viewport.new(:view, :position => [2, 26], :size => [89, 66]) do |graph|...
Ruby
module Scruffy::Renderers # ===Scruffy::Renderers::Cubed # # Author:: Brasten Sager # Date:: August 14th, 2006 # # Graph layout consisting of four separate graphs arranged in a 2x2 grid. class Cubed < Empty VIEWPORT_SIZE = [35, 30] VIEWPORTS = { :top_left => [10, 25], :to...
Ruby
module Scruffy::Renderers # ===Scruffy::Renderers::Empty # # Author:: Brasten Sager # Date:: August 17th, 2006 # # An Empty graph isn't completely empty, it adds a background componenet # to itself before handing other all other layout responsibilities to it's # subclasses or caller. class Empty < Bas...
Ruby
module Scruffy module Renderers # Renderer that splits the graphs up into four other little graphs. class Split < Empty def define_layout super do |components| components << Scruffy::Components::Title.new(:title, :position => [5, 2], :size => [90, 7]) components << Scruffy::C...
Ruby
module Scruffy::Renderers # ===Scruffy::Renderers::Base # # Author:: A.J. Ostman # Date:: August 14th, 2006 # # Provides a more appropriate rendering for Pie Charts class Pie < Base def initialize self.components = [] self.components << Scruffy::Components::Background.new(:background, :po...
Ruby
module Scruffy module Renderers class Reversed < Base def define_layout self.components << Scruffy::Components::Background.new(:background, :position => [0,0], :size =>[100, 100]) self.components << Scruffy::Components::Title.new(:title, :position => [98, 95], :size => [1, 3], :text_anchor ...
Ruby
# ===Scruffy Formatters # # Author:: Brasten Sager # Date:: August 16th, 2006 # # Formatters are used to format the values displayed on the y-axis by # setting graph.value_formatter. # # Example: # # graph.value_formatter = Scruffy::Formatters::Currency.new(:precision => 0) # module Scruffy::Formatters # == Scru...
Ruby
# ===Scruffy Components # # Author:: Brasten Sager # Date:: August 16th, 2006 # # Components make up the visual elements of a Scruffy graph. # # For examples, see Scruffy::Components::Base. module Scruffy::Components; end require 'scruffy/components/base' require 'scruffy/components/title' require 'scruffy/components/...
Ruby
# ===GraphState # # Author:: Brasten Sager # Date:: September 27th, 2007 # # State object for holding all of the graph's # settings. Attempting to clean up the # graph interface a bit. module Scruffy class GraphState attr_accessor :title attr_accessor :theme attr_accessor :default_type attr_accesso...
Ruby
module Scruffy VERSION = '0.2.2' end
Ruby
# ===Scruffy Graphing Library for Ruby # # Author:: Brasten Sager # Date:: August 5th, 2006 # # For information on generating graphs using Scruffy, see the # documentation in Scruffy::Graph. # # For information on creating your own graph types, see the # documentation in Scruffy::Layers::Base. module Scruffy; end $:....
Ruby
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
Ruby
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :login t.string :name t.string :password t.timestamps end end end
Ruby
class CreateAssets < ActiveRecord::Migration def change create_table :assets do |t| t.integer :task_id, :null => false, :default => 0 t.string :attachment_file_name t.string :attachment_content_type t.integer :attachment_file_size t.timestamps end end end
Ruby
class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| t.integer :user_id, :null => false, :default => 0 t.references :commentable, :polymorphic => true t.text :content t.timestamps end end end
Ruby
class CreateNotes < ActiveRecord::Migration def change create_table :notes do |t| t.string :title t.text :content t.timestamps end end end
Ruby
class CreateTasks < ActiveRecord::Migration def change create_table :tasks do |t| t.integer :user_id t.integer :owner_id, :null => false, :default => 0 t.integer :worker_id, :null => false, :default => 0 t.string :content t.integer :done, :null => false, :default => 0 t.integer :point, :null ...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby