source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | lib/tasks/utils.rake | Ruby | mit | 87 | master | 4,290 | namespace :utils do
desc "Update user points"
task update_user_total_points: :environment do
User.contestants.each do |user|
points = user.transactions.inject(0){|r, t| r += t.points; r}
user.set(points: points)
end
end
desc 'remove dublicate repos'
task remove_dublicate_repos: :environme... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | lib/vcs/git_repository.rb | Ruby | mit | 87 | master | 218 | module Vcs
class GitRepository
attr_reader :git_username
def initialize(git_username: )
@git_username = git_username
end
def list
GITHUB.repos(user: git_username).list
end
end
end |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | lib/vcs/git_commit.rb | Ruby | mit | 87 | master | 563 | module Vcs
class GitCommit
attr_reader :repo_owner, :repo_name,
:branch_name, :from_date, :to_date
def initialize(**options)
@repo_owner = options[:repo_owner]
@repo_name = options[:repo_name]
@branch_name = options[:branch_name]
@from_date = options[:from_date]
... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | lib/vcs/git_commit_stats.rb | Ruby | mit | 87 | master | 288 | module Vcs
class GitCommitStats
attr_reader :sha, :repo
def initialize(sha, repo)
@sha = sha
@repo = repo
end
def list
GitApp.info.repos.commits.get(
user: repo.owner,
repo: repo.name,
sha: sha
).stats
end
end
end |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | lib/vcs/git_pull_request.rb | Ruby | mit | 87 | master | 278 | module Vcs
class GitPullRequest
attr_reader :sha
def initialize(sha)
@sha = sha
end
def get
pull_requests = GitApp.info.search.issues("sha:#{sha}")
return nil if pull_requests.items.size != 1
pull_requests.items[0]
end
end
end |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | lib/vcs/git_branch.rb | Ruby | mit | 87 | master | 294 | module Vcs
class GitBranch
attr_reader :git_username, :repo_name
def initialize(git_username: , repo_name: )
@git_username = git_username
@repo_name = repo_name
end
def list
GITHUB.repos.branches(user: git_username, repo: repo_name).list
end
end
end |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/application.rb | Ruby | mit | 87 | master | 1,553 | require File.expand_path('../boot', __FILE__)
require 'csv'
require 'rails'
# Pick the frameworks you want:
require 'active_model/railtie'
require 'active_job/railtie'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'action_view/railtie'
require 'rails/test_unit/railtie'
# Require the gems... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/schedule.rb | Ruby | mit | 87 | master | 1,055 | # Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_m... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/routes.rb | Ruby | mit | 87 | master | 3,047 | require 'sidekiq/web'
require 'sidekiq-status/web'
Rails.application.routes.draw do
Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]
api_version('module': 'V1', header: {name: 'Accept', value: 'application/vnd.codecuriosity.org; version=1'}) do
resources :transactions, only: [:in... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/deploy.rb | Ruby | mit | 87 | master | 4,257 | require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
#require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
require 'mina/rvm' # for rvm support. (http://rvm.io)
require 'mina_sidekiq/tasks'
require 'mina/whenever'
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Pat... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/environments/development.rb | Ruby | mit | 87 | master | 1,980 | Rails.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 serv... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/environments/test.rb | Ruby | mit | 87 | master | 2,047 | Rails.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 suit... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/environments/production.rb | Ruby | mit | 87 | master | 4,037 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/initializers/devise.rb | Ruby | mit | 87 | master | 12,652 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/initializers/assets.rb | Ruby | mit | 87 | master | 592 | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional ... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/initializers/deserialize_job.rb | Ruby | mit | 87 | master | 562 | # Overrides the deserialize method to pass retry count during subsequent retries of failed job
unless ActiveJob::Base.method_defined?(:deserialize)
module ActiveJob
class Base
def self.deserialize(job_data)
job = job_data['job_class'].constantize.new
job.deserialize(job_data)
job
... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/initializers/inflections.rb | Ruby | mit | 87 | master | 638 | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
ActiveSupport::Inflector.inflections(:en) do |inflect|... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/initializers/globals.rb | Ruby | mit | 87 | master | 948 | require 'github_client'
require 'git_lib_ext'
GITHUB = Github.new(oauth_token: ENV['GIT_OAUTH_TOKEN'], client_id: ENV['GIT_APP_ID'], client_secret: ENV['GIT_APP_SECRET'])
GithubClient.init(oauth_token: ENV['GIT_OAUTH_TOKEN'], client_id: ENV['GIT_APP_ID'], client_secret: ENV['GIT_APP_SECRET'])
YAML.load_file('config/c... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/initializers/sidekiq.rb | Ruby | mit | 87 | master | 616 | require 'sidekiq'
require 'sidekiq-status'
Sidekiq.configure_client do |config|
config.client_middleware do |chain|
# accepts :expiration (optional)
chain.add Sidekiq::Status::ClientMiddleware, expiration: 30.minutes # default
end
end
Sidekiq.configure_server do |config|
config.server_middleware do |cha... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/initializers/kaminari_config.rb | Ruby | mit | 87 | master | 246 | Kaminari.configure do |config|
config.default_per_page = 10
config.max_per_page = 10
config.window = 4
config.outer_window = 1
config.left = 2
config.right = 4
config.page_method_name = :page
config.param_name = :page
end |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/initializers/rollbar.rb | Ruby | mit | 87 | master | 2,132 | Rollbar.configure do |config|
# Without configuration, Rollbar is enabled in all environments.
# To disable in specific environments, set config.enabled=false.
config.access_token = ENV['ROLLBAR_TOKEN']
# Here we'll disable in 'test':
if Rails.env.test? or Rails.env.development?
config.enabled = false
... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | config/initializers/simple_form_bootstrap.rb | Ruby | mit | 87 | master | 6,146 | # Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.error_notification_class = 'alert alert-danger'
config.button_class = 'btn btn-default'
config.boolean_label_class = nil
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'ha... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | DbBackup/config.rb | Ruby | mit | 87 | master | 1,985 | # encoding: utf-8
##
# Backup
# Generated Main Config Template
#
# For more information:
#
# View the Git repository at https://github.com/meskyanichi/backup
# View the Wiki/Documentation at https://github.com/meskyanichi/backup/wiki
# View the issue log at https://github.com/meskyanichi/backup/issues
##
# Utilities
... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | DbBackup/models/code_curiosity_backup.rb | Ruby | mit | 87 | master | 2,947 | # encoding: utf-8
##
# Backup Generated: code_curiosity_backup
# Once configured, you can run the backup with the following command:
#
# $ backup perform -t code_curiosity_backup [-c <path_to_configuration_file>]
#
BACKUP = YAML.load_file('backup.yml')
Backup::Model.new(:code_curiosity_backup, 'Description for code_c... |
github | joshsoftware/code-curiosity | https://github.com/joshsoftware/code-curiosity | db/seeds.rb | Ruby | mit | 87 | master | 578 | # 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... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | cruise_config.rb | Ruby | apache-2.0 | 87 | master | 261 | # this is the file that cruise control uses to configure its own cruise build at
# http://cruisecontrolrb.thoughtworks.com/
# simple, ain't it
Project.configure do |project|
project.email_notifier.emails = ["cruisecontrolrb-developers@rubyforge.org"]
end |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | Rakefile | Ruby | apache-2.0 | 87 | master | 727 | # 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 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/pa... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/helpers/application_helper.rb | Ruby | apache-2.0 | 87 | master | 2,269 | # Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def format_time(time, format = :iso)
TimeFormatter.send(format, time)
end
def format_seconds(total_seconds, format = :general)
DurationFormatter.new(total_seconds).send(format)
end
def... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/helpers/documentation_helper.rb | Ruby | apache-2.0 | 87 | master | 989 | module DocumentationHelper
def render_plugin_doc(file)
if File.directory?(file)
if File.exists?(file + '/README')
render :inline => markup(File.read(file + '/README')), :layout => true
else
render :text => "this plugin has no README", :layout => true
end
elsif File.exists?(fi... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/helpers/builds_helper.rb | Ruby | apache-2.0 | 87 | master | 2,393 | module BuildsHelper
def builds_except_last(project, n)
project.builds.reverse[n..-1]
end
def select_builds(builds)
return "" if !builds || builds.empty?
options = builds.map do |build|
"<option value='#{build.label}'>#{text_to_build(build, false)}</option>"
end
options.unshift "<opt... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/helpers/projects_helper.rb | Ruby | apache-2.0 | 87 | master | 2,059 | module ProjectsHelper
def rss_title(project, build)
project.name + (build ? " build #{build.label} #{build.status}" :
" has never been built")
end
def rss_description(project, build)
build ? build.changeset : ''
end
def rss_pub_date(build)
format_time(build ? build.t... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/controllers/builds_controller.rb | Ruby | apache-2.0 | 87 | master | 2,415 | class BuildsController < ApplicationController
layout 'default'
caches_page :drop_down
def show
render :text => 'Project not specified', :status => 404 and return unless params[:project]
@project = Projects.find(params[:project])
render :text => "Project #{params[:project].inspect} not found", :sta... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/controllers/projects_controller.rb | Ruby | apache-2.0 | 87 | master | 2,018 | class ProjectsController < ApplicationController
layout 'default'
def index
@projects = Projects.load_all
respond_to do |format|
format.html
format.js { render :action => 'index_js' }
format.rss { render :action => 'index_rss', :layout => false }
format.cctray { render :actio... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/controllers/application.rb | Ruby | apache-2.0 | 87 | master | 338 | # 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
session :off
def render_not_found
render :file => File.join(RAILS_ROOT, 'public/404.html'), :status => 4... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/controllers/documentation_controller.rb | Ruby | apache-2.0 | 87 | master | 890 | class DocumentationController < ApplicationController
caches_page :get
def get
path = File.join('documentation', params[:path])
if path == "documentation/plugin_repositories"
render :template => path, :layout => false
elsif template_exists?(path)
render :template => path
elsif template... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/successful_build_trigger.rb | Ruby | apache-2.0 | 87 | master | 1,245 | class SuccessfulBuildTrigger
attr_accessor :triggered_project
attr_reader :last_successful_build
def initialize(triggered_project, triggering_project_name)
self.triggered_project = triggered_project
self.triggering_project_name = triggering_project_name
@last_successful_build = last_successful(@trigg... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/project.rb | Ruby | apache-2.0 | 87 | master | 14,546 | require 'fileutils'
class Project
@@plugin_names = []
def self.plugin(plugin_name)
@@plugin_names << plugin_name unless RAILS_ENV == 'test' or @@plugin_names.include? plugin_name
end
def self.read(dir, load_config = true)
@project_in_the_works = Project.new(File.basename(dir), File.exists?("#{dir}/wo... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/project_config_tracker.rb | Ruby | apache-2.0 | 87 | master | 771 | require 'fileutils'
class ProjectConfigTracker
attr_accessor :central_config_file, :central_contents, :local_config_file, :local_contents
def initialize(project_path)
@central_config_file = File.expand_path(File.join(project_path, 'work', 'cruise_config.rb'))
@local_config_file = File.expand_path(File.jo... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/test_error_entry.rb | Ruby | apache-2.0 | 87 | master | 409 | TestErrorEntry = Struct.new :type, :test_name, :message, :stacktrace
class TestErrorEntry
ERROR_TYPE = "Error"
FAILURE_TYPE = "Failure"
def self.create_failure(test_name, message, stacktrace)
TestErrorEntry.new(FAILURE_TYPE, test_name, message, stacktrace)
end
def self.create_error(test_name, message, ... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/revision.rb | Ruby | apache-2.0 | 87 | master | 708 | class Revision
include Comparable
attr_reader :number, :committed_by, :time, :message, :changeset
def initialize(number, committed_by = nil, time = nil, message = nil, changeset = nil)
@number = number
@committed_by, @time, @message, @changeset = committed_by, time, message, changeset
end
def to_s... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/log_parser.rb | Ruby | apache-2.0 | 87 | master | 1,010 | class LogParser
TEST_ERROR_REGEX = /^\s+\d+\) Error:\n(.*):\n(.*)\n([\s\S]*?)\n\n/
TEST_FAILURE_REGEX = /^\s+\d+\) Failure:\n([\S\s]*?)\n\n/
TEST_NAME_REGEX = /\S+/
MESSAGE_REGEX = /\]\:\n([\s\S]+)/
STACK_TRACE_REGEX = /\[([\s\S]*?)\]\:/
def initialize(log)
@log = log
end
def errors
test_e... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/build_mailer.rb | Ruby | apache-2.0 | 87 | master | 912 | class BuildMailer < ActionMailer::Base
def build_report(build, recipients, from, subject, message, sent_at = Time.now)
@subject = "[CruiseControl] #{subject}"
@body = {
:build => build,
:message => message,
:failures_and_errors => LogParser.new(build.output).failures_and_erro... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/builder_starter.rb | Ruby | apache-2.0 | 87 | master | 979 | require 'singleton'
require 'fileutils'
class BuilderStarter
include FileUtils
@@run_builders_at_startup = true;
def self.run_builders_at_startup=(value)
@@run_builders_at_startup = value
end
def self.start_builders
if @@run_builders_at_startup
Projects.load_all.each do |project|
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/change_in_source_control_trigger.rb | Ruby | apache-2.0 | 87 | master | 466 | class ChangeInSourceControlTrigger
def initialize(triggered_project)
@triggered_project = triggered_project
end
def build_necessary?(reasons)
p = @triggered_project
p.notify :polling_source_control
if !p.source_control.up_to_date?(reasons)
p.notify :new_revisions_detected, reasons.flatten.f... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/polling_scheduler.rb | Ruby | apache-2.0 | 87 | master | 2,120 | class PollingScheduler
def initialize(project)
@project = project
@custom_polling_interval = nil
@last_build_loop_error_source = nil
@last_build_loop_error_time = nil
end
def run
while (true) do
begin
@project.build_if_necessary or check_build_request_until_next_polling
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/projects.rb | Ruby | apache-2.0 | 87 | master | 1,938 | require 'fileutils'
class Projects
class << self
def load_all
Projects.new.load_all
end
def find(project_name)
# TODO: sanitize project_name to prevent a query injection attack here
path = File.join(CRUISE_DATA_ROOT, 'projects', project_name)
return nil unless File.directory?(pa... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/build_status.rb | Ruby | apache-2.0 | 87 | master | 2,022 | class BuildStatus
SUCCESS = 'success'
FAILED = 'failed'
INCOMPLETE = 'incomplete'
NEVER_BUILT = 'never_built'
def initialize(artifacts_directory)
@artifacts_directory = artifacts_directory
end
def never_built?
read_latest_status == NEVER_BUILT
end
def succeeded?
read_latest_statu... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | app/models/build.rb | Ruby | apache-2.0 | 87 | master | 5,934 | class Build
include CommandLine
attr_reader :project, :label
IGNORE_ARTIFACTS = /^(\..*|build_status\..+|build.log|changeset.log|cruise_config.rb|plugin_errors.log)$/
def initialize(project, label)
@project, @label = project, label.to_s
@start = Time.now
end
def build_status
BuildStatus.new(a... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | db/migrate/001_move_status_from_file_to_directory_name.rb | Ruby | apache-2.0 | 87 | master | 321 | require 'fileutils'
include FileUtils
Dir["projects/*/build-*"].reject{|path| path =~ /build-.*-.*in.*s/}.each do |dir|
status_file = Dir["#{dir}/build_status.*"].first
next unless status_file
status_info = File.basename(status_file).sub('build_status.', '')
rm status_file
mv dir, "#{dir}-#{status_info}"
end |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | db/migrate/002_move_custom_files_to_directory_in_user_home.rb | Ruby | apache-2.0 | 87 | master | 1,076 | require 'fileutils'
include FileUtils
DATA_ROOT = ARGV[0]
RAILS_ROOT = File.expand_path(".")
if File.directory? 'projects'
mv 'projects', DATA_ROOT + '/projects'
else
mkdir_p DATA_ROOT + '/projects'
end
if File.exists? 'config/site_config.rb'
mv 'config/site_config.rb', DATA_ROOT + '/site_config.rb'
elsif !Fil... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/test_helper.rb | Ruby | apache-2.0 | 87 | master | 3,670 | ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require_dependency 'application'
# Make double-sure the RAILS_ENV is set to test,
# so fixtures are loaded to the right database
silence_warnings { RAILS_ENV = "test" }
require 'test/unit'
require 'action_controlle... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/build_factory.rb | Ruby | apache-2.0 | 87 | master | 577 | # this module will create builds for testing
module BuildFactory
def create_project(name)
@sandbox.new :directory => "#{name}/work"
project = Project.new(name)
project.path = name
project
end
def create_build(label, status = :success)
@sandbox.new :file => "build-#{label}/build_status.#{statu... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/file_sandbox.rb | Ruby | apache-2.0 | 87 | master | 3,236 | require 'ftools'
require 'fileutils'
require 'test/unit/assertions'
module FileSandbox
VERSION = "0.4"
attr_reader :sandbox
def in_sandbox(&block)
raise "I expected to create a sandbox as you passed in a block to me" if !block_given?
setup_sandbox
original_error = nil
begin
yield @s... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/integration/builder_integration_test.rb | Ruby | apache-2.0 | 87 | master | 8,331 | require File.dirname(__FILE__) + '/../test_helper'
class BuilderIntegrationTest < Test::Unit::TestCase
include FileSandbox
def test_checkout
# with_project calls svn.checkout
with_project 'passing_project' do |project, sandbox|
assert File.exists?("passing_project/work/passing_test.rb")
end
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/integration/subversion_integration_test.rb | Ruby | apache-2.0 | 87 | master | 2,511 | require File.dirname(__FILE__) + '/../test_helper'
class SubversionIntegrationTest < Test::Unit::TestCase
include FileSandbox
def setup
setup_sandbox
end
def teardown
teardown_sandbox
end
def test_checkout
checkout 'passing_project'
assert File.exists?("passing_project/passing_test... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/project_config_tracker_test.rb | Ruby | apache-2.0 | 87 | master | 1,985 | require 'date'
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class ProjectConfigTrackerTest < Test::Unit::TestCase
include FileSandbox
def setup
@sandbox = Sandbox.new
@tracker = ProjectConfigTracker.new(@sandbox.root)
end
def teardown
@sandbox.clean_up
end
def test_co... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/change_in_source_control_trigger_test.rb | Ruby | apache-2.0 | 87 | master | 1,038 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class ChangeInSourceControlTriggerTest < Test::Unit::TestCase
include FileSandbox
def test_build_necessary
with_sandbox_project do |sandbox, project|
project.source_control.expects(:up_to_date?).with{|reasons| reasons << [Revision.new(... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/subversion_test.rb | Ruby | apache-2.0 | 87 | master | 8,459 | require File.dirname(__FILE__) + '/../test_helper'
require 'stringio'
class SubversionTest < Test::Unit::TestCase
include FileSandbox
def teardown
FileUtils.rm_f "./svn.err"
end
LOG_ENTRY = <<-EOF
<log>
<logentry revision="18">
<author>alexey</author>
<date>2006-01-11T13:58:58.000007Z</date>
<msg>G... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/build_status_test.rb | Ruby | apache-2.0 | 87 | master | 5,366 | require File.dirname(__FILE__) + '/../test_helper'
require 'build_status'
class BuildStatusTest < Test::Unit::TestCase
include FileSandbox
def setup
@status = BuildStatus.new('')
end
def test_should_parse_elapsed_time
assert_equal 10, @status.match_elapsed_time('build-1-success.in10s')
a... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/project_test.rb | Ruby | apache-2.0 | 87 | master | 20,720 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
require 'date'
require 'ostruct'
require 'email_notifier'
require 'fileutils'
class ProjectTest < Test::Unit::TestCase
include FileSandbox
def setup
@svn = FakeSourceControl.new
@project = Project.new("lemmings")
@project.source_cont... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/revision_test.rb | Ruby | apache-2.0 | 87 | master | 515 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class ProjectTest < Test::Unit::TestCase
def test_revision_should_know_how_to_compare_itself
small = Revision.new(3)
large = Revision.new(5)
assert small < large
assert_false small > large
assert_equal [small, large], [large, s... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/file_lock_test.rb | Ruby | apache-2.0 | 87 | master | 1,862 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class FileLockTest < Test::Unit::TestCase
include FileSandbox
def test_lock_and_release
in_total_sandbox do
file_name = "./my.lock"
lock = FileLock.new(file_name, "project 'rude'")
begin
lock.lock
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/smtp_tls_test.rb | Ruby | apache-2.0 | 87 | master | 595 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class SmtpTlsTest < Test::Unit::TestCase
def test_starttls_should_return_false_when_server_responds_with_500_to_STARTTLS_directive
smtp = Net::SMTP.new('localhost')
smtp.expects(:getok).with('STARTTLS').raises(Net::SMTPSyntaxError)
ass... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/polling_scheduler_test.rb | Ruby | apache-2.0 | 87 | master | 2,124 | require 'date'
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class PollingSchedulerTest < Test::Unit::TestCase
def setup
@mock_project = Object.new
@scheduler = PollingScheduler.new(@mock_project)
end
def test_polling_interval_default_value_and_overriding
assert_equal Configu... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/build_serializer_test.rb | Ruby | apache-2.0 | 87 | master | 2,355 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class BuildSerializerTest < Test::Unit::TestCase
def setup
@project = Object.new
@serializer = BuildSerializer.new(@project)
end
def test_serialize_when_lock_is_available
lock = AvailableLock.new
FileLock.expects(:new).
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/projects_helper_test.rb | Ruby | apache-2.0 | 87 | master | 2,655 | require File.dirname(__FILE__) + '/../test_helper'
require 'revision'
class ProjectsHelperTest < Test::Unit::TestCase
include ProjectsHelper
include ApplicationHelper
include FileSandbox
def test_show_revisions_in_build_for_single_revision
revisions = [create_revision(42, 'arthur', 'Checking in code')]... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/projects_test.rb | Ruby | apache-2.0 | 87 | master | 3,543 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class ProjectsTest < Test::Unit::TestCase
include FileSandbox
def setup
@svn = FakeSourceControl.new("bob")
@one = Project.new("one", @svn)
@two = Project.new("two", @svn)
end
def test_load_all
in_sandbox do |sandbox|
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/builds_helper_test.rb | Ruby | apache-2.0 | 87 | master | 5,664 | require File.dirname(__FILE__) + '/../test_helper'
class ProjectsController
attr_accessor :url
end
class BuildsHelperTest < Test::Unit::TestCase
include FileSandbox
include BuildsHelper
include ApplicationHelper
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
include Action... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/routing_test.rb | Ruby | apache-2.0 | 87 | master | 816 | require File.dirname(__FILE__) + '/../test_helper'
class RoutingTest < Test::Unit::TestCase
def test_build
assert_routing 'builds/CruiseControl', {:controller => 'builds', :action => 'show', :project => 'CruiseControl'}
assert_routing 'builds/CruiseControl/1',
{:controller => 'builds', :... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/application_helper_test.rb | Ruby | apache-2.0 | 87 | master | 2,705 | require File.dirname(__FILE__) + '/../test_helper'
require 'builds_controller'
class ApplicationHelperTest < Test::Unit::TestCase
include ApplicationHelper
def test_format_time_humane
Time.stubs(:now).returns(Time.parse('2007-01-03 03:00:00'))
# before this year
assert_equal '31 Dec 06', format_tim... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/successful_build_trigger_test.rb | Ruby | apache-2.0 | 87 | master | 1,670 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class SuccessfulBuildTriggerTest < Test::Unit::TestCase
include FileSandbox
include BuildFactory
def setup
setup_sandbox
@triggered_project = create_project('triggered_project')
@triggering_project = create_project('triggering... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/build_mailer_test.rb | Ruby | apache-2.0 | 87 | master | 1,111 | require File.dirname(__FILE__) + '/../test_helper'
class BuildMailerTest < Test::Unit::TestCase
FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
CHARSET = "utf-8"
include ActionMailer::Quoting
def setup
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/builder_starter_test.rb | Ruby | apache-2.0 | 87 | master | 3,071 | require File.dirname(__FILE__) + '/../test_helper'
require 'builder_starter'
require 'project'
class BuilderStarterTest < Test::Unit::TestCase
include FileSandbox
def setup
@svn = FakeSourceControl.new("bob")
@one = Project.new("one", @svn)
@two = Project.new("two", @svn)
end
def test_start_b... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/project_blocker_test.rb | Ruby | apache-2.0 | 87 | master | 610 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class ProjectBlockerTest < Test::Unit::TestCase
def setup
@project = Object.new
@project.stubs(:name).returns("foo")
@project.stubs(:path).returns(".")
@lock = Object.new
FileLock.expects(:new).returns(@lock)
end
def... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/log_parser_test.rb | Ruby | apache-2.0 | 87 | master | 8,370 | require File.dirname(__FILE__) + '/../test_helper'
class LogParserTest < Test::Unit::TestCase
LOG_OUTPUT_WITH_NO_TEST_FAILURE = <<EOF
Started
..................................................................................
Finished in 0.687 seconds.
82 tests, 183 assertions, 0 failures, 0 errors
Loaded suite c:/r... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/build_test.rb | Ruby | apache-2.0 | 87 | master | 11,063 | require File.dirname(__FILE__) + '/../test_helper'
class BuildTest < Test::Unit::TestCase
include FileSandbox
def test_build_should_know_if_it_is_the_latest
with_sandbox_project do |sandbox, project|
sandbox.new :directory => "build-2"
build_old = Build.new(project, 2)
sandbox.new :director... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/projects_migration_test.rb | Ruby | apache-2.0 | 87 | master | 3,607 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class ProjectsMigrationTest < Test::Unit::TestCase
include FileSandbox
def setup
setup_sandbox
@migration = ProjectsMigration.new(sandbox.root)
end
def teardown
teardown_sandbox
end
de... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/command_line_test.rb | Ruby | apache-2.0 | 87 | master | 4,461 | require File.dirname(__FILE__) + '/../test_helper'
require 'fileutils'
class CommandLineTest < Test::Unit::TestCase
include FileSandbox
def test_should_write_to_both_files_when_both_files_specified_and_no_block
in_total_sandbox do
CommandLine.execute("echo hello", {:dir => @dir, :stdout => @stdout, :std... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/subversion/log_parser_test.rb | Ruby | apache-2.0 | 87 | master | 3,889 | require File.dirname(__FILE__) + '/../../test_helper'
require 'revision'
require 'changeset_entry'
class Subversion::LogParserTest < Test::Unit::TestCase
SIMPLE_LOG_ENTRY = <<EOF
<?xml version="1.0"?>
<log>
<logentry revision="359">
<author>aslak</author>
<date>2006-05-22T13:23:29.000005Z</date>
<paths>
<pat... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/subversion/propget_parser_test.rb | Ruby | apache-2.0 | 87 | master | 5,577 | require File.dirname(__FILE__) + '/../../test_helper'
require 'revision'
require 'changeset_entry'
class Subversion::LogParserTest < Test::Unit::TestCase
PROPGET_ENTRY = <<-EOF
public/javascripts - js-common https://svn.pivotallabs.com/subversion/pivotal-common/trunk/js-common/
vendor - ant https://svn.pivotallab... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/subversion/update_parser_test.rb | Ruby | apache-2.0 | 87 | master | 1,075 | require File.dirname(__FILE__) + '/../../test_helper'
require 'revision'
require 'changeset_entry'
class Subversion::UpdateParserTest < Test::Unit::TestCase
UPDATE_OUTPUT = <<EOF
A failing_project
D failing_project\\Rakefile
U* failing_project\\failing_test.rb
G failing_project\\revision_label.txt
C B pas... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/subversion/info_parser_test.rb | Ruby | apache-2.0 | 87 | master | 4,384 | require File.dirname(__FILE__) + '/../../test_helper'
require 'revision'
require 'changeset_entry'
class Subversion::InfoParserTest < Test::Unit::TestCase
INFO_XML_OUTPUT = <<-EOF
<?xml version="1.0" encoding="utf-8"?>
<info>
<entry
kind="dir"
path="cruisecontrolrb"
revision="328">
<url>svn://rubyforge.org/v... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/subversion/changeset_log_parser_test.rb | Ruby | apache-2.0 | 87 | master | 3,745 | require File.dirname(__FILE__) + '/../../test_helper'
require 'revision'
require 'changeset_entry'
class Subversion::ChangesetLogParserTest < Test::Unit::TestCase
LOG_WITH_SINGLE_REVISION = <<EOF
Revision 204.1 committed by leonard0 on 2007-02-12 15:32:55
Detect when X occurs and trigger Y to happen.
M /trunk/app/m... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/plugins/project_logger_test.rb | Ruby | apache-2.0 | 87 | master | 1,963 | require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
class ProjectLoggerTest < Test::Unit::TestCase
def setup
@logger = ProjectLogger.new(nil)
@mock_build = Object.new
end
def test_build_started
@mock_build.expects(:label).returns(123)
CruiseControl::Log.expects(:event).with... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/plugins/builder_status_test.rb | Ruby | apache-2.0 | 87 | master | 4,138 | require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
class BuilderStatusTest < Test::Unit::TestCase
def setup
@project = Project.new('project')
@project.stubs(:path).returns('project_root')
@builder_status = BuilderStatus.new(@project)
@mock_build = Object.new
ProjectBlocker.st... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/plugins/build_reaper_test.rb | Ruby | apache-2.0 | 87 | master | 914 | require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'build_reaper'
class BuildReaperTest < Test::Unit::TestCase
include FileSandbox
include BuildFactory
def setup
setup_sandbox
@reaper = BuildReaper.new(the_project)
end
def teardown
BuildReaper.number_of_builds_to... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/plugins/log_publisher_test.rb | Ruby | apache-2.0 | 87 | master | 1,284 | require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
class LogPublisherTest < Test::Unit::TestCase
include FileSandbox
def test_move_files_from_multiple_globs_into_build_dir
with_sandbox_project do |sandbox, project|
build = project.create_build(2)
sandbox.new :file => ... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/unit/plugins/email_notifier_test.rb | Ruby | apache-2.0 | 87 | master | 4,166 | require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
class EmailNotifierTest < Test::Unit::TestCase
include FileSandbox
BUILD_LOG = <<-EOL
blah blah blah
something built
tests passed / failed / etc
EOL
def setup
setup_sandbox
ActionMailer::Base.deliveries = []
@... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/performance/mass_builds_load_speed_test.rb | Ruby | apache-2.0 | 87 | master | 1,434 | require File.dirname(__FILE__) + '/../test_helper'
require 'fileutils'
class MassBuildsLoadSpeedTest < ActionController::IntegrationTest
include FileUtils
def self.fixture_table_names() return []; end
def test_load_project_with_many_builds
projects_root = "#{RAILS_ROOT}/projects"
mkdir projects_root un... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/performance/build-sample/cruise_config.rb | Ruby | apache-2.0 | 87 | master | 227 | Project.configure do |project|
# project.email_notifier.emails = ["not@exist.com"]
if project.name.include? "quick"
project.build_command = 'dir'
else
project.rake_task = 'cruise'
end
end
p "I'm now building" |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/functional/documentation_controller_test.rb | Ruby | apache-2.0 | 87 | master | 816 | require File.dirname(__FILE__) + '/../test_helper'
require 'documentation_controller'
# Re-raise errors caught by the controller.
class DocumentationController; def rescue_action(e) raise e end; end
class DocumentationControllerTest < Test::Unit::TestCase
def setup
@controller = DocumentationController.new
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/functional/projects_controller_test.rb | Ruby | apache-2.0 | 87 | master | 8,629 | require File.dirname(__FILE__) + '/../test_helper'
require 'projects_controller'
require 'rexml/document'
require 'rexml/xpath'
# Re-raise errors caught by the controller.
class ProjectsController
def rescue_action(e) raise end
end
class ProjectsControllerTest < Test::Unit::TestCase
include FileSandbox
def setu... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | test/functional/builds_controller_test.rb | Ruby | apache-2.0 | 87 | master | 7,738 | require File.dirname(__FILE__) + '/../test_helper'
require 'builds_controller'
# Re-raise errors caught by the controller.
class BuildsController
def rescue_action(e) raise end
end
class BuildsControllerTest < Test::Unit::TestCase
include FileSandbox
include BuildFactory
def setup
@controller = BuildsCon... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/time_formatter.rb | Ruby | apache-2.0 | 87 | master | 1,159 | # TODO: move unit tests for this functionality from ApplicationHelperTest to a unit test for the class
class TimeFormatter
end
class << TimeFormatter
def human(time)
now = Time.now
this_year = now.beginning_of_year
today = now.beginning_of_day
tomorrow = 1.day.since(today)
format =
case(... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/file_lock.rb | Ruby | apache-2.0 | 87 | master | 1,423 | class FileLock
class LockUnavailableError < RuntimeError; end
class AlreadyLockedError < RuntimeError; end
@@lock_files = {}
def initialize(lock_file_name, locked_object_description = lock_file_name)
@lock_file_name, @locked_object_description = lock_file_name, locked_object_description
end
def l... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/build_serializer.rb | Ruby | apache-2.0 | 87 | master | 875 | class BuildSerializer
include ActionView::Helpers::DateHelper
def self.serialize(project, &block)
BuildSerializer.new(project).serialize(&block)
end
def initialize(project)
@project = project
end
def serialize
@start_time = Time.now
lock = FileLock.new(CRUISE_DATA_ROOT + "/projects/... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/duration_formatter.rb | Ruby | apache-2.0 | 87 | master | 1,164 | # TODO: move unit tests for this functionality from ApplicationHelperTest to a unit test for the class
class DurationFormatter
def initialize(duration)
@duration = duration
@minutes, @seconds = duration.divmod(60)
@hours, @minutes = @minutes.divmod(60)
end
def general
if @hours >= 1 and @minut... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/command_line.rb | Ruby | apache-2.0 | 87 | master | 7,153 | require 'English'
# borrowed (with modifications) from the RSCM project
module CommandLine
QUOTE_REPLACEMENT = (Platform.family == "mswin32") ? '"' : '\\"'
LESS_THAN_REPLACEMENT = (Platform.family == "mswin32") ? '<' : '\\<'
class OptionError < StandardError; end
class ExecutionError < StandardError
attr... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/projects_migration.rb | Ruby | apache-2.0 | 87 | master | 1,847 | class ProjectsMigration
include CommandLine
include FileUtils
def initialize(data_dir = CRUISE_DATA_ROOT)
@data_dir = data_dir
if File.exists? data_dir and not File.directory? data_dir
raise "#{data_dir} is not a directory"
else
mkdir_p data_dir
end
end
def migrate_data_if_needed... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/smtp_tls.rb | Ruby | apache-2.0 | 87 | master | 1,893 | require "net/smtp"
Net::SMTP.class_eval do
private
def do_start(helodomain, user, secret, authtype)
raise IOError, 'SMTP session already started' if @started
check_auth_args user, secret, authtype if user or secret
open_conversation(helodomain)
if starttls
create_ssl_socket(helodomain)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.