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
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/plotters/abstract_plotter.rb
Ruby
mit
199
main
7,560
module Charty module Plotters class AbstractPlotter def initialize(x, y, color, **options) self.x = x self.y = y self.color = color self.data = data self.palette = palette substitute_options(options) @var_levels = {} @var_ordered = {x: false, ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/plotters/estimation_support.rb
Ruby
mit
199
main
2,005
module Charty module Plotters module EstimationSupport attr_reader :estimator def estimator=(estimator) @estimator = check_estimator(estimator) end module_function def check_estimator(value) case value when :count, "count" :count when :mean, "mea...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/plotters/bar_plotter.rb
Ruby
mit
199
main
7,645
module Charty module Plotters class BarPlotter < CategoricalPlotter self.default_palette = :light self.require_numeric = true def initialize(data: nil, variables: {}, **options, &block) x, y, color = variables.values_at(:x, :y, :color) super(x, y, color, data: data, **options, &...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/plotters/histogram_plotter.rb
Ruby
mit
199
main
6,703
module Charty module Plotters class HistogramPlotter < DistributionPlotter def univariate? self.variables.key?(:x) != self.variables.key?(:y) end def univariate_variable unless univariate? raise TypeError, "This is not a univariate plot" end ([:x, :y] &...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/plotters/box_plotter.rb
Ruby
mit
199
main
2,535
module Charty module Plotters class BoxPlotter < CategoricalPlotter self.default_palette = :light self.require_numeric = true def initialize(data: nil, variables: {}, **options, &block) x, y, color = variables.values_at(:x, :y, :color) super(x, y, color, data: data, **options, &...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/plotters/distribution_plotter.rb
Ruby
mit
199
main
4,847
module Charty module Plotters class DistributionPlotter < AbstractPlotter def flat_structure { x: :@values } end def wide_structure { x: :@values, color: :@columns } end def initialize(data:, variables:, **options, &bloc...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/plotters/scatter_plotter.rb
Ruby
mit
199
main
2,532
module Charty module Plotters class ScatterPlotter < RelationalPlotter def initialize(data: nil, variables: {}, **options, &block) x, y, color, style, size = variables.values_at(:x, :y, :color, :style, :size) super(x, y, color, style, size, data: data, **options, &block) end att...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/plotters/relational_plotter.rb
Ruby
mit
199
main
17,198
module Charty module Plotters class BaseMapper def initialize(plotter, *params) @plotter = plotter initialize_mapping(*params) end attr_reader :plotter def [](key, *args) case key when Array, Charty::Vector key.map {|k| lookup_single_value(k, *ar...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/plotters/categorical_plotter.rb
Ruby
mit
199
main
11,135
module Charty module Plotters class CategoricalPlotter < AbstractPlotter class << self attr_reader :default_palette def default_palette=(val) case val when :light, :dark @default_palette = val when "light", "dark" @default_palette = val....
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/plotly.rb
Ruby
mit
199
main
27,254
require "json" require "securerandom" require "tmpdir" require_relative "plotly_helpers/html_renderer" require_relative "plotly_helpers/notebook_renderer" require_relative "plotly_helpers/plotly_renderer" module Charty module Backends class Plotly Backends.register(:plotly, self) attr_reader :conte...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/google_charts.rb
Ruby
mit
199
main
7,745
module Charty module Backends class GoogleCharts Backends.register(:google_charts, self) attr_reader :context class << self attr_writer :chart_id, :google_charts_src, :with_api_load_tag def chart_id @chart_id ||= 0 end def with_api_load_tag ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/rubyplot.rb
Ruby
mit
199
main
2,819
require 'fileutils' module Charty module Backends class Rubyplot Backends.register(:rubyplot, self) class << self def prepare require 'rubyplot' end end def initialize @plot = ::Rubyplot end def label(x, y) end def series=(seri...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/gruff.rb
Ruby
mit
199
main
3,611
require 'fileutils' module Charty module Backends class Gruff Backends.register(:gruff, self) class << self def prepare require 'gruff' end end def initialize @plot = ::Gruff end def label(x, y) end def series=(series) ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/unicode_plot.rb
Ruby
mit
199
main
1,875
require 'stringio' module Charty module Backends class UnicodePlot Backends.register(:unicode_plot, self) class << self def prepare require 'unicode_plot' end end def begin_figure @figure = nil @layout = {} end def bar(bar_pos, _gro...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/bokeh.rb
Ruby
mit
199
main
1,947
module Charty module Backends class Bokeh Backends.register(:bokeh, self) class << self def prepare require 'pycall' end end def initialize @plot = PyCall.import_module('bokeh.plotting') end def series=(series) @series = series ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/pyplot.rb
Ruby
mit
199
main
25,352
require 'fileutils' module Charty module Backends class Pyplot Backends.register(:pyplot, self) class << self def prepare require 'matplotlib/pyplot' require 'numpy' end end def initialize @pyplot = ::Matplotlib::Pyplot @default_edgeco...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/plotly_helpers/plotly_renderer.rb
Ruby
mit
199
main
2,673
require "date" require "json" require "time" module Charty module Backends module PlotlyHelpers class PlotlyRenderer def render(figure) json = JSON.generate(figure, allow_nan: true) case json when /\b(?:Infinity|NaN)\b/ visit(figure) else ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/plotly_helpers/notebook_renderer.rb
Ruby
mit
199
main
3,111
module Charty module Backends module PlotlyHelpers class NotebookRenderer < HtmlRenderer def initialize(use_cdn: false) super(use_cdn: use_cdn, full_html: false, requirejs: true) @initialized = false end def activate return if @initialized un...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/backends/plotly_helpers/html_renderer.rb
Ruby
mit
199
main
6,705
require "datasets/downloader" require "json" require "securerandom" module Charty module Backends module PlotlyHelpers class HtmlRenderer def initialize(use_cdn: true, full_html: false, requirejs: true) @use_cdn = use_cdn @full_html ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/table_adapters/hash_adapter.rb
Ruby
mit
199
main
7,662
require 'date' module Charty module TableAdapters class HashAdapter < BaseAdapter TableAdapters.register(:hash, self) def self.supported?(data) case data when [] true when Array case data[0] when Numeric, String, Time, Date true ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/table_adapters/daru_adapter.rb
Ruby
mit
199
main
2,631
require "delegate" module Charty module TableAdapters class DaruAdapter < BaseAdapter TableAdapters.register(:daru, self) extend Forwardable include Enumerable def self.supported?(data) defined?(Daru::DataFrame) && data.is_a?(Daru::DataFrame) end def initialize(data...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/table_adapters/arrow_adapter.rb
Ruby
mit
199
main
1,151
module Charty module TableAdapters class ArrowAdapter < BaseAdapter TableAdapters.register(:arrow, self) def self.supported?(data) defined?(Arrow::Table) && data.is_a?(Arrow::Table) end def initialize(data) @data = data @column_names = @data.columns.map(&:name) ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/table_adapters/datasets_adapter.rb
Ruby
mit
199
main
1,146
module Charty module TableAdapters class DatasetsAdapter < BaseAdapter TableAdapters.register(:datasets, self) include Enumerable def self.supported?(data) defined?(Datasets::Dataset) && data.is_a?(Datasets::Dataset) end def initialize(dataset) @table = d...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/table_adapters/pandas_adapter.rb
Ruby
mit
199
main
5,831
require "forwardable" module Charty module TableAdapters class PandasDataFrameAdapter < BaseAdapter TableAdapters.register(:pandas_data_frame, self) extend Forwardable include Enumerable def self.supported?(data) defined?(Pandas::DataFrame) && data.is_a?(Pandas::DataFrame) ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/table_adapters/narray_adapter.rb
Ruby
mit
199
main
1,973
module Charty module TableAdapters class NArrayAdapter < BaseAdapter TableAdapters.register(:narray, self) def self.supported?(data) defined?(Numo::NArray) && data.is_a?(Numo::NArray) && data.ndim <= 2 end def initialize(data, columns: nil, index: nil) case data.ndim ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/table_adapters/active_record_adapter.rb
Ruby
mit
199
main
1,709
module Charty module TableAdapters class ActiveRecordAdapter < BaseAdapter TableAdapters.register(:active_record, self) def self.supported?(data) defined?(ActiveRecord::Relation) && data.is_a?(ActiveRecord::Relation) end def initialize(data) @data = check_type(ActiveRecor...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
lib/charty/table_adapters/base_adapter.rb
Ruby
mit
199
main
6,456
require "forwardable" module Charty module TableAdapters class BaseAdapter extend Forwardable include Enumerable attr_reader :columns def columns=(values) @columns = check_and_convert_index(values, :columns, column_length) end def column_names columns.to_a ...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
examples/scatter_plot.rb
Ruby
mit
199
main
655
require "charty" require "datasets" require "matplotlib" Charty::Backends.use(:pyplot) Matplotlib.use(:agg) penguins = Datasets::Penguins.new Charty.scatter_plot(data: penguins, x: :body_mass_g, y: :flipper_length_mm) .save("penguins_body_mass_g_flipper_length_mm_scatter_plot.png") Charty.scatter_plot(data: p...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
examples/bar_plot.rb
Ruby
mit
199
main
583
# This example generates box_plot results in README.md require "charty" require "datasets" require "matplotlib" Charty::Backends.use(:pyplot) Matplotlib.use(:agg) penguins = Datasets::Penguins.new Charty.bar_plot(data: penguins, x: :species, y: :body_mass_g) .save("penguins_species_body_mass_g_bar_plot_v.png"...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
examples/Gemfile
Ruby
mit
199
main
454
# frozen_string_literal: true source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } gem 'mimemagic' install_if -> { RUBY_PLATFORM !~ /darwin|mswin|mingw/ } do gem 'rbczmq' end gem 'cztop' gem 'iruby' gem 'matplotlib' gem 'charty', path: ".." gem 'gruff' gem 'rubyplot...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
examples/box_plot.rb
Ruby
mit
199
main
527
require "charty" require "datasets" require "matplotlib" Charty::Backends.use(:pyplot) Matplotlib.use(:agg) penguins = Datasets::Penguins.new Charty.box_plot(data: penguins, x: :species, y: :body_mass_g) .save("penguins_species_body_mass_g_box_plot_v.png") Charty.box_plot(data: penguins, x: :body_mass_g, y: :...
github
red-data-tools/charty
https://github.com/red-data-tools/charty
examples/palette.rb
Ruby
mit
199
main
2,105
#! /usr/bin/env ruby require "charty" Palette.default = ARGV[0] if ARGV[0] charty = Charty::Plotter.new(:pyplot) figure = charty.bar do series [1, 2, 3, 4, 5], [10, 20, 25, 30, 40], label: "a" series [1, 2, 3, 4, 5], [20, 10, 15, 20, 50], label: "b" series [1, 2, 3, 4, 5], [30, 25, 20, 10, 5], label: "cd" end...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
Gemfile
Ruby
apache-2.0
199
master
1,179
source 'https://rubygems.org' ruby '2.3.0' gem 'rails', '4.2.4' gem 'slim-rails', '~> 3.0.0' gem 'sass-rails', '~> 5.0' # JavaScript gem 'i18n-js', '~> 2.1.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1', '>= 4.1.1' gem 'therubyracer', platforms: :ruby gem 'jquery-rails' gem 'jbuilder', '~> 2.4', '>= 2.4....
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
db/schema.rb
Ruby
apache-2.0
199
master
3,939
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sou...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
db/migrate/20151225141534_create_tests.rb
Ruby
apache-2.0
199
master
329
class CreateTests < ActiveRecord::Migration def change create_table :tests do |t| t.string :slug, null: false t.string :title t.text :description t.text :result_labels t.integer :user_id t.integer :project_id t.timestamps null: false end add_index :tests, :slug ...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
db/migrate/20151224030646_create_teams.rb
Ruby
apache-2.0
199
master
225
class CreateTeams < ActiveRecord::Migration def change create_table :teams do |t| t.string :name, null: false t.integer :user_id t.timestamps null: false end add_index :teams, :name end end
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
db/migrate/20160109162956_create_team_users.rb
Ruby
apache-2.0
199
master
331
class CreateTeamUsers < ActiveRecord::Migration def change create_table :team_users do |t| t.integer :team_id t.integer :user_id t.timestamps null: false end add_index :team_users, :team_id add_index :team_users, :user_id add_index :team_users, [:team_id, :user_id], unique: true...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
db/migrate/20151224022612_devise_create_users.rb
Ruby
apache-2.0
199
master
1,346
class DeviseCreateUsers < ActiveRecord::Migration def change create_table(:users) do |t| ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token t....
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
db/migrate/20151226051709_create_testcases.rb
Ruby
apache-2.0
199
master
309
class CreateTestcases < ActiveRecord::Migration def change create_table :testcases do |t| t.integer :heading_level t.text :body t.string :result t.text :note t.integer :test_id t.timestamps null: false end add_index :testcases, [:result, :test_id] end end
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
db/migrate/20151225045046_create_projects.rb
Ruby
apache-2.0
199
master
316
class CreateProjects < ActiveRecord::Migration def change create_table :projects do |t| t.string :name, null: false t.integer :user_id t.integer :team_id t.timestamps null: false end add_index :projects, :name add_index :projects, [:name, :team_id], unique: true end end
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
spec/rails_helper.rb
Ruby
apache-2.0
199
master
2,750
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? requ...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
spec/models/testcase_spec.rb
Ruby
apache-2.0
199
master
3,319
require 'rails_helper' RSpec.describe Testcase, type: :model do let(:testcase) { create(:testcase, test: create(:test)) } let(:testcases) { [testcase] } describe '#type' do context 'with type -1' do it 'returns :blnak' do testcase.heading_level = -1 expect(testcase.type).to be(:blank) ...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
spec/models/test_spec.rb
Ruby
apache-2.0
199
master
3,051
require 'rails_helper' RSpec.describe Test, type: :model do let(:test) { create(:test) } let(:labels) { result_labels = I18n.t("tests.result_labels") { result_labels[:unexecuted] => "white", result_labels[:pass] => "green", result_labels[:fail] => "red", result_labels[:b...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
config/routes.rb
Ruby
apache-2.0
199
master
1,012
Rails.application.routes.draw do root 'static_pages#top' get 'terms' => 'static_pages#terms' get 'dashboard' => 'dashboard#index' devise_for :users, controllers: { registrations: 'users/registrations' } get 'user_settings/edit' patch 'user_settings/update' resources :tests, path: 't', param: 'slug', exc...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
config/application.rb
Ruby
apache-2.0
199
master
1,544
require File.expand_path('../boot', __FILE__) require "rails" # Pick the frameworks you want: require "active_model/railtie" require "active_job/railtie" require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "action_view/railtie" require "sprockets/railtie" # requi...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
config/initializers/action_mailer.rb
Ruby
apache-2.0
199
master
231
unless Chibineko::Application.config.action_mailer.nil? if options = YAML.load_file(Rails.root.join("config", "mailer.yml"))[Rails.env] Chibineko::Application.config.action_mailer.merge! options.deep_symbolize_keys! end end
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
config/initializers/devise.rb
Ruby
apache-2.0
199
master
13,105
# 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
tabbyz/chibineko
https://github.com/tabbyz/chibineko
config/environments/development.rb
Ruby
apache-2.0
199
master
1,896
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
tabbyz/chibineko
https://github.com/tabbyz/chibineko
config/environments/production.rb
Ruby
apache-2.0
199
master
3,228
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
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/models/test.rb
Ruby
apache-2.0
199
master
2,406
class Test < ActiveRecord::Base belongs_to :user belongs_to :project has_many :testcases, dependent: :destroy after_initialize :set_slug serialize :result_labels validates :title, presence: true, length: { maximum: 255 } validates :description, length: { maximum: 4096 } default_scope { order("id ASC") }...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/models/user.rb
Ruby
apache-2.0
199
master
571
class User < ActiveRecord::Base has_many :tests has_many :team_users has_many :teams, :through => :team_users validates :email, length: { maximum: 255 } validates :username, length: { maximum: 30 } default_scope { order("id ASC") } # Include default devise modules. Others available are: # :confirmabl...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/models/testcase.rb
Ruby
apache-2.0
199
master
1,385
class Testcase < ActiveRecord::Base belongs_to :test validates :body, length: { maximum: 1024 } validates :result, length: { maximum: 255 } validates :note, length: { maximum: 1024 } default_scope { order("id ASC") } def type case self.heading_level when -1 :blank when 0 :testcase...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/models/team.rb
Ruby
apache-2.0
199
master
646
class Team < ActiveRecord::Base has_many :projects, :dependent => :destroy has_many :team_users, :dependent => :destroy has_many :users, :through => :team_users belongs_to :user before_save { self.name = name.downcase } validates :name, presence: true, uniqueness: { case_sensitive: false }, leng...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/models/project.rb
Ruby
apache-2.0
199
master
382
class Project < ActiveRecord::Base belongs_to :team has_many :tests, :dependent => :destroy before_save { self.name = name.downcase } validates :name, presence: true, uniqueness: { case_sensitive: false, :scope => :team_id }, length: { maximum: 30 }, format: { with: /\A[a-z0-9_]+\z/i } default...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/helpers/application_helper.rb
Ruby
apache-2.0
199
master
432
module ApplicationHelper def controller_action controller_name + "#" + action_name end def color_names %w(red pink purple deeppurple indigo blue cyan teal green lightgreen lime yellow amber orange deeporange brown gray bluegray lightgray white) end def page_title(title) if title.blank? "Ch...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/helpers/teams_helper.rb
Ruby
apache-2.0
199
master
217
module TeamsHelper def current_team if team_name = params[:name] || params[:team_name] Team.find_by(name: team_name) elsif current_test current_test.try(:project).try(:team) end end end
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/helpers/projects_helper.rb
Ruby
apache-2.0
199
master
388
module ProjectsHelper def project_collection current_team.projects if current_team end def current_project team_name = params[:team_name] project_name = params[:project_name] if team_name && project_name team = Team.find_by(name: team_name) team.projects.find_by(name: project_name) ...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/controllers/user_settings_controller.rb
Ruby
apache-2.0
199
master
462
class UserSettingsController < ApplicationController before_action :authenticate_user! before_action :set_user, only: [:edit, :update] def edit end def update unless @user.update(user_params) render json: format_error_message(@user), status: :unprocessable_entity end end private def s...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/controllers/application_controller.rb
Ruby
apache-2.0
199
master
1,434
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_filter :set_locale, :set_timezone class Forbidden < ActionController::ActionControllerError; end def rout...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/controllers/teams_controller.rb
Ruby
apache-2.0
199
master
1,176
class TeamsController < ApplicationController before_action :authenticate_user! before_action :authorize!, except: [:new, :create] def show if project = @team.projects.first redirect_to team_project_path(@team, project) end end def new @team = current_user.teams.build if user_signed_in? ...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/controllers/tests_controller.rb
Ruby
apache-2.0
199
master
3,922
class TestsController < ApplicationController before_action :authenticate_user!, except: [:show] before_action :authorize!, except: [:index, :new, :create, :bulk_move, :bulk_destroy] def index @tests = Test.all end def show respond_to do |format| format.html do gon.test = @test ...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/controllers/team_users_controller.rb
Ruby
apache-2.0
199
master
834
class TeamUsersController < ApplicationController before_action :authenticate_user! def index @team = Team.find_by(name: params[:team_name]) @team_users = @team.team_users.includes(:user) @team_user = TeamUser.new end def create @team = Team.find_by(name: params[:team_name]) user = User.fi...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/controllers/testcases_controller.rb
Ruby
apache-2.0
199
master
748
class TestcasesController < ApplicationController before_action :set_testcase, only: [:update] def update test = Test.find_by(slug: params[:test_slug]) if @testcase.update(testcase_params) render json: @testcase, status: 200 else render json: @testcase.errors, status: :unprocessable_entity...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/controllers/projects_controller.rb
Ruby
apache-2.0
199
master
1,290
class ProjectsController < ApplicationController before_action :authenticate_user! before_action :authorize!, except: [:new, :create] def show @tests = @project.tests.includes(:user) end def new @project = Project.new end def edit end def create @project = Project.new(project_params) ...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/controllers/users/registrations_controller.rb
Ruby
apache-2.0
199
master
1,025
class Users::RegistrationsController < Devise::RegistrationsController def edit routing_error # Invalidate a "/users/edit" end def update self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key) prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_t...
github
tabbyz/chibineko
https://github.com/tabbyz/chibineko
app/views/tests/show.csv.ruby
Ruby
apache-2.0
199
master
924
require 'csv' testcases = @test.testcases # Examine the maximum heading level max_level = 0 testcases.each do |c| if c.type == :heading max_level = c.heading_level if c.heading_level > max_level end end headings = Array.new(max_level) # Header header = Array.new(max_level, "-") header << I18n.t("tests.csv....
github
brynary/testjour
https://github.com/brynary/testjour
Rakefile
Ruby
mit
198
master
1,170
require 'rubygems' require "rake/gempackagetask" require "rake/clean" require "spec/rake/spectask" require "cucumber/rake/task" require './lib/testjour.rb' Spec::Rake::SpecTask.new do |t| t.spec_opts == ["--color"] end Cucumber::Rake::Task.new do |t| end desc "Run the specs and the features" task :default => ["spe...
github
brynary/testjour
https://github.com/brynary/testjour
features/step_definitions/testjour_steps.rb
Ruby
mit
198
master
3,097
require "systemu" require "fileutils" Given /^Testjour is configured to run on localhost in a (\w+) directory$/ do |dir_name| @args ||= [] full_path = File.expand_path("./tmp/#{dir_name}") @args << "--on=testjour://localhost#{full_path}" FileUtils.rm_rf full_path FileUtils.mkdir_p full_path end Given /^T...
github
brynary/testjour
https://github.com/brynary/testjour
features/support/env.rb
Ruby
mit
198
master
585
require File.expand_path(File.dirname(__FILE__) + "/../../lib/testjour") require 'spec/expectations' def be_like(expected) simple_matcher "should be like #{expected.inspect}" do |actual| actual.strip == expected.strip end end def testjour_cleanup @full_dir = File.expand_path(File.dirname(__FILE__) + "/../....
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour.rb
Ruby
mit
198
master
1,224
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__))) require "testjour/cli" require "logger" require "English" def silence_stream(stream) old_stream = stream.dup stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null') stream.syn...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/result_set.rb
Ruby
mit
198
master
1,241
module Testjour class ResultSet def initialize(step_counter) @step_counter = step_counter @counts = Hash.new { |h, result| h[result] = 0 } @results = Hash.new { |h, server_id| h[server_id] = [] } @backtrace_lines_seen = [] end def record(result) @results[result.s...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/mysql.rb
Ruby
mit
198
master
1,101
module Testjour # Stolen from deep-test class MysqlDatabaseSetup def initialize(runner_database_name = nil) @runner_database_name = runner_database_name end def create_database run "/usr/local/mysql/bin/mysqladmin -u root create #{runner_database_name}" end def drop_...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/result.rb
Ruby
mit
198
master
980
require "English" require "socket" module Testjour class Result attr_reader :time attr_reader :status attr_reader :message attr_reader :backtrace attr_reader :backtrace_line CHARS = { :undefined => 'U', :passed => '.', :failed => 'F', :pending => 'P', :...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/redis_queue.rb
Ruby
mit
198
master
1,082
require "testjour/core_extensions/wait_for_service" require "redis" module Testjour class RedisQueue def initialize(redis_host, queue_namespace, queue_timeout) @redis = Redis.new(:db => 11, :host => redis_host) @queue_namespace = queue_namespace @queue_timeout = queue_timeout end ...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/cli.rb
Ruby
mit
198
master
752
require "testjour/commands" module Testjour class CLI def self.execute(*args) new(*args).execute end def initialize(args, out_stream = STDOUT, err_stream = STDERR) @args = args @out_stream = out_stream @err_stream = err_stream end def command_class case @args.firs...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/results_formatter.rb
Ruby
mit
198
master
2,486
require "testjour/progressbar" require "testjour/colorer" require "testjour/result_set" module Testjour class ResultsFormatter def initialize(step_counter, options = {}) @options = options @progress_bar = ProgressBar.new("0 failures", step_counter.count, options[:simple_progress]) @result_set ...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/configuration.rb
Ruby
mit
198
master
6,939
module Testjour class Configuration attr_reader :unknown_args, :options, :path, :full_uri def initialize(args) @options = {} @args = args @unknown_args = [] end def setup require 'cucumber/cli/main' Cucumber.class_eval do def language_incomplete? fals...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/progressbar.rb
Ruby
mit
198
master
2,497
# # Ruby/ProgressBar - a text progress bar library # # Copyright (C) 2001 Satoru Takabayashi <satoru@namazu.org> # All rights reserved. # This is free software with ABSOLUTELY NO WARRANTY. # # You can redistribute it and/or modify it under the terms # of Ruby's licence. # class ProgressBar VERSION = "0.3" ...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/rsync.rb
Ruby
mit
198
master
1,561
require "uri" require "systemu" require "testjour/core_extensions/retryable" module Testjour class RsyncFailed < StandardError end class Rsync def self.copy_to_current_directory_from(source_uri) new(source_uri, File.expand_path(".")).copy_with_retry end def self.copy_from_curren...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/cucumber_extensions/feature_file_finder.rb
Ruby
mit
198
master
334
module Testjour class FeatureFileFinder attr_reader :feature_files def initialize @feature_files = [] end def before_feature(feature) @current_feature = feature end def before_step(step) @feature_files << @current_feature.file @feature_files.uniq! ...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/cucumber_extensions/http_formatter.rb
Ruby
mit
198
master
1,371
require 'socket' require 'English' require 'cucumber/formatter/console' require 'testjour/result' module Testjour class HttpFormatter def initialize(configuration) @configuration = configuration end def before_multiline_arg(multiline_arg) @multiline_arg = true end def after_mu...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/cucumber_extensions/step_counter.rb
Ruby
mit
198
master
837
module Testjour class StepCounter attr_reader :backtrace_lines def initialize @backtrace_lines = [] end def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) @backtrace_lines << step_match.backtrace_line end de...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/commands/run.rb
Ruby
mit
198
master
4,467
require "optparse" require "socket" require "etc" require "testjour/commands/command" require "testjour/redis_queue" require "testjour/configuration" require "testjour/cucumber_extensions/step_counter" require "testjour/cucumber_extensions/feature_file_finder" require "testjour/results_formatter" require "testjour/res...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/commands/run_remote.rb
Ruby
mit
198
master
1,358
require "testjour/commands/command" require "cucumber" require "uri" require "daemons/daemonize" require "testjour/cucumber_extensions/http_formatter" require "testjour/mysql" require "testjour/rsync" require "stringio" module Testjour module Commands class RunRemote < Command def dir ...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/commands/command.rb
Ruby
mit
198
master
1,033
module Testjour module Commands class Command def initialize(args = [], out_stream = STDOUT, err_stream = STDERR) @options = {} @args = args @out_stream = out_stream @err_stream = err_stream end protected def configuration return @configuration if @configuration @...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/commands/run_slave.rb
Ruby
mit
198
master
3,448
require "testjour/commands/command" require "cucumber" require "uri" require "daemons/daemonize" require "testjour/cucumber_extensions/http_formatter" require "testjour/mysql" require "stringio" module Testjour module Commands class RunSlave < Command # Boolean indicating whether this worker can or can not for...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/core_extensions/wait_for_service.rb
Ruby
mit
198
master
750
require 'timeout' require 'socket' TCPSocket.class_eval do def self.wait_for_no_service(options) socket = nil Timeout::timeout(options[:timeout] || 20) do loop do begin socket = TCPSocket.new(options[:host], options[:port]) socket.close unless socket.nil? rescue E...
github
brynary/testjour
https://github.com/brynary/testjour
lib/testjour/core_extensions/retryable.rb
Ruby
mit
198
master
286
class Object def retryable(options = {}, &block) opts = { :tries => 1, :on => Exception }.merge(options) retry_exception, retries = opts[:on], opts[:tries] begin return yield rescue retry_exception retry if (retries -= 1) > 0 end yield end end
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
passive_record.gemspec
Ruby
mit
198
master
1,972
# encoding: utf-8 require 'yaml' Gem::Specification.new do |gem| gemspec = YAML.load_file('gemspec.yml') gem.name = gemspec.fetch('name') gem.version = gemspec.fetch('version') do lib_dir = File.join(File.dirname(__FILE__),'lib') $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir) require...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
Rakefile
Ruby
mit
198
master
449
# encoding: utf-8 require 'rubygems' begin require 'bundler/setup' rescue LoadError => e abort e.message end require 'rake' require 'rubygems/tasks' Gem::Tasks.new require 'rspec/core/rake_task' RSpec::Core::RakeTask.new task :test => :spec task :default => :spec require 'yard' YARD::Rake::YardocTask.new...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
spec/passive_record_spec.rb
Ruby
mit
198
master
25,305
require 'spec_helper' describe PassiveRecord do describe ".drop_all" do it 'should remove all records' do SimpleModel.create Post.create 10.times { Doctor.create } PassiveRecord.drop_all expect(SimpleModel.count).to eq(0) expect(Post.count).to eq(0) expect(Doctor.count...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
spec/spec_helper.rb
Ruby
mit
198
master
3,955
require 'rspec' require 'pry' require 'passive_record' class Model include PassiveRecord attr_accessor :created_at after_create { @created_at = Time.now } end class SimpleModel < Struct.new(:foo) include PassiveRecord attr_reader :updated_at after_update { @updated_at = Time.now } end module Family cla...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
lib/passive_record.rb
Ruby
mit
198
master
1,006
require 'forwardable' require 'active_support' require 'active_support/core_ext/string/inflections' require 'active_support/core_ext/numeric/time' require 'passive_record/version' require 'passive_record/arithmetic_helpers' require 'passive_record/core/query' require 'passive_record/class_inheritable_attrs' requir...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
lib/passive_record/associations.rb
Ruby
mit
198
master
7,747
require 'passive_record/associations/belongs_to' require 'passive_record/associations/has_one' require 'passive_record/associations/has_many' require 'passive_record/associations/has_many_through' module PassiveRecord module Associations def associate!(assn) @associations ||= [] @associations += [ass...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
lib/passive_record/class_inheritable_attrs.rb
Ruby
mit
198
master
740
# taken directly from http://stackoverflow.com/a/10729812/90042 module ClassLevelInheritableAttributes def self.included(base) base.extend(ClassMethods) end module ClassMethods def inheritable_attrs(*args) @inheritable_attributes ||= [:inheritable_attributes] @inheritable_attributes += ar...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
lib/passive_record/class_methods.rb
Ruby
mit
198
master
1,862
module PassiveRecord module ClassMethods include PassiveRecord::Core include PassiveRecord::Associations include PassiveRecord::Hooks include Enumerable extend Forwardable # from http://stackoverflow.com/a/2393750/90042 def descendants ObjectSpace.each_object(Class).select { |klass...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
lib/passive_record/instance_methods.rb
Ruby
mit
198
master
1,310
module PassiveRecord module InstanceMethods def update(attrs={}) self.class.before_update_hooks.each do |hook| hook.run(self) end attrs.each do |k,v| send("#{k}=", v) end self.class.after_update_hooks.each do |hook| hook.run(self) end self e...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
lib/passive_record/hooks.rb
Ruby
mit
198
master
1,944
module PassiveRecord module Hooks class Hook attr_reader :kind def initialize(kind,*meth_syms,&blk) @kind = kind @methods_to_call = meth_syms @block_to_invoke = blk end def run(instance) @methods_to_call.each do |meth| instance.send(meth) ...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
lib/passive_record/arithmetic_helpers.rb
Ruby
mit
198
master
364
module PassiveRecord module ArithmeticHelpers def pluck(attr) all.map(&attr) end def sum(attr) pluck(attr).inject(&:+) end def average(attr) sum(attr) / count end def mode(attr) arr = pluck(attr) freq = arr.inject(Hash.new(0)) { |h,v| h[v] += 1; h } a...
github
deepcerulean/passive_record
https://github.com/deepcerulean/passive_record
lib/passive_record/pretty_printing.rb
Ruby
mit
198
master
232
module PassiveRecord module PrettyPrinting def inspect pretty_vars = to_h.map do |k,v| "#{k.to_s.gsub(/^\@/,'')}: #{v.inspect}" end.join(', ') "#{self.class.name} (#{pretty_vars})" end end end