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
activeadmin-plugins/active_admin_import
https://github.com/activeadmin-plugins/active_admin_import
tasks/test.rake
Ruby
mit
182
master
561
desc "Creates a test rails app for the specs to run against" task :setup do require 'rails/version' db = ENV['DB'] || 'sqlite' rails_db = case db when 'mysql' then 'mysql' when 'postgres', 'postgresql' then 'postgresql' else 'sqlite3' end rails_new_opts = %W...
github
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
Gemfile
Ruby
mit
182
master
614
source "http://rubygems.org" # Declare your gem's dependencies in browser-timezone-rails.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # jquery-rails is used by the dummy application gem "jquery-rai...
github
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
Rakefile
Ruby
mit
182
master
806
#!/usr/bin/env rake begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end begin require 'rdoc/task' rescue LoadError require 'rdoc/rdoc' require 'rake/rdoctask' RDoc::Task = Rake::RDocTask end RDoc::Task.new(:rdoc) do |rdoc| rdoc.r...
github
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
browser-timezone-rails.gemspec
Ruby
mit
182
master
949
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "browser-timezone-rails/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "browser-timezone-rails" s.version = '1.1.0' s.version = BrowserTimezoneRails::VERSION s....
github
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
lib/browser-timezone-rails.rb
Ruby
mit
182
master
1,034
# frozen_string_literal: true require 'browser-timezone-rails/engine' require 'js_cookie_rails' module BrowserTimezoneRails PREPEND_METHOD = if Rails::VERSION::MAJOR == 3 || (Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR < 2) :prepend_around_filter else ...
github
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
spec/spec_helper.rb
Ruby
mit
182
master
545
# Configure Rails Envinronment puts "loading dummy environment" ENV["RAILS_ENV"] = "test" require File.expand_path("../dummy/config/environment.rb", __FILE__) require 'rspec/rails' ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../') # Requires supporting ruby files with custom matchers and macros, etc, # in ...
github
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
spec/request/set_timezone_spec.rb
Ruby
mit
182
master
1,216
require 'spec_helper' describe 'sets the timezone', type: :request do before do #Rails server timezone is UTC... Time.zone = 'UTC' end context 'Australia' do before do #pretend we're in australia, always wanted to go there page.driver.browser.set_cookie "browser.timezone=Australia/Syd...
github
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
spec/dummy/config/application.rb
Ruby
mit
182
master
2,192
require File.expand_path('../boot', __FILE__) require 'rails/all' Bundler.require require "browser-timezone-rails" module Dummy class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/in...
github
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
spec/dummy/config/environments/development.rb
Ruby
mit
182
master
1,238
Dummy::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
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
spec/dummy/config/environments/test.rb
Ruby
mit
182
master
1,391
Dummy::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
kbaum/browser-timezone-rails
https://github.com/kbaum/browser-timezone-rails
spec/dummy/config/initializers/secret_token.rb
Ruby
mit
182
master
499
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
angular_rails_csrf.gemspec
Ruby
mit
182
master
1,188
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('lib', __dir__) require 'angular_rails_csrf/version' Gem::Specification.new do |s| s.name = 'angular_rails_csrf' s.version = AngularRailsCsrf::VERSION s.authors = ['James Sanders', 'Ilya Krukowski'] s.email = ['sanderjd@gm...
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
Gemfile
Ruby
mit
182
master
309
# frozen_string_literal: true source 'https://rubygems.org' gemspec group :test do gem 'rails', '~> 8.0' gem 'rake', '~> 13.0' gem 'rubocop', '~> 1.0' gem 'rubocop-performance', '~> 1.5' gem 'simplecov', '~> 0.16' gem 'test-unit', '~> 3.2' gem 'tzinfo-data', platforms: %i[windows jruby] end
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
Rakefile
Ruby
mit
182
master
596
# frozen_string_literal: true begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'AngularRailsCsrf' rdoc.options << '--line-numbers' rdoc...
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
lib/angular_rails_csrf/concern.rb
Ruby
mit
182
master
1,733
# frozen_string_literal: true module AngularRailsCsrf module Concern extend ActiveSupport::Concern included do after_action :set_xsrf_token_cookie end def set_xsrf_token_cookie return unless forgery_protection_enabled? config = Rails.application.config cookie_name = option...
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
lib/angular_rails_csrf/railtie.rb
Ruby
mit
182
master
296
# frozen_string_literal: true require 'angular_rails_csrf/concern' module AngularRailsCsrf class Railtie < ::Rails::Railtie initializer 'angular-rails-csrf' do |_app| ActiveSupport.on_load(:action_controller) do include AngularRailsCsrf::Concern end end end end
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
test/angular_rails_csrf_test.rb
Ruby
mit
182
master
4,428
# frozen_string_literal: true require 'test_helper' class AngularRailsCsrfTest < ActionController::TestCase tests ApplicationController test 'a get sets the XSRF-TOKEN cookie but does not require the X-XSRF-TOKEN header' do get :index assert_valid_cookie assert_response :success end test 'a post...
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
test/angular_rails_csrf_exception_test.rb
Ruby
mit
182
master
445
# frozen_string_literal: true require 'test_helper' class AngularRailsCsrfExceptionTest < ActionController::TestCase tests ExclusionsController setup do @controller.allow_forgery_protection = true @correct_token = @controller.send(:form_authenticity_token) end test 'a get does not set the XSRF-TOKEN...
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
test/test_helper.rb
Ruby
mit
182
master
238
# frozen_string_literal: true ENV['RAILS_ENV'] = 'test' require 'simplecov' SimpleCov.start do add_filter 'test/' add_filter '.github/' end require File.expand_path('dummy/config/environment.rb', __dir__) require 'rails/test_help'
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
test/angular_rails_csrf_skip_test.rb
Ruby
mit
182
master
381
# frozen_string_literal: true require 'test_helper' class AngularRailsCsrfSkipTest < ActionController::TestCase tests ApiController test 'csrf-cookie is not set and no error if protect_against_forgery? is not defined' do refute @controller.respond_to?(:protect_against_forgery?) get :index assert_nil ...
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
test/dummy/config/application.rb
Ruby
mit
182
master
584
# frozen_string_literal: true require File.expand_path('boot', __dir__) require 'action_controller/railtie' Bundler.require(:default, Rails.env) require 'angular_rails_csrf' module Dummy class Application < Rails::Application config.secret_key_base = '5e6b6d2bd7bf26d02679ac958b520adf41b211eb0b8f33742abc5' \ ...
github
bodrovis/angular_rails_csrf
https://github.com/bodrovis/angular_rails_csrf
test/dummy/config/routes.rb
Ruby
mit
182
master
216
# frozen_string_literal: true Dummy::Application.routes.draw do get 'test' => 'application#index' post 'test' => 'application#create' get 'exclusions' => 'exclusions#index' get 'index' => 'api#index' end
github
capistrano/composer
https://github.com/capistrano/composer
capistrano-composer.gemspec
Ruby
mit
182
master
968
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = 'capistrano-composer' spec.version = '0.0.6' spec.authors = ['Scott Walkinshaw', 'Peter Mitchell'] spec.email = ['scott.wa...
github
capistrano/composer
https://github.com/capistrano/composer
lib/capistrano/tasks/composer.rake
Ruby
mit
182
master
2,729
namespace :composer do desc <<-DESC Installs composer.phar to the shared directory In order to use the .phar file, the composer command needs to be mapped: SSHKit.config.command_map[:composer] = "\#{shared_path.join("composer.phar")}" This is best used after deploy:starting: namespace :deploy ...
github
joeyAghion/spidey
https://github.com/joeyAghion/spidey
spidey.gemspec
Ruby
mit
182
master
889
# -*- encoding: utf-8 -*- $LOAD_PATH.push File.expand_path('../lib', __FILE__) require 'spidey/version' Gem::Specification.new do |s| s.name = 'spidey' s.version = Spidey::VERSION s.authors = ['Joey Aghion'] s.email = ['joey@aghion.com'] s.homepage = 'https://github.com/joeyAghion/spi...
github
joeyAghion/spidey
https://github.com/joeyAghion/spidey
lib/spidey.rb
Ruby
mit
182
master
215
require 'logger' require 'spidey/version' require 'spidey/abstract_spider' module Spidey extend self attr_accessor :logger end Spidey.logger = Logger.new(STDOUT) require 'spidey/railtie' if defined?(::Rails)
github
joeyAghion/spidey
https://github.com/joeyAghion/spidey
lib/spidey/abstract_spider.rb
Ruby
mit
182
master
2,856
# encoding: utf-8 require 'mechanize' module Spidey class AbstractSpider attr_accessor :urls, :handlers, :results, :request_interval, :errors DEFAULT_REQUEST_INTERVAL = 3 # seconds def self.handle(url, handler, default_data = {}) start_urls << url handlers[url] = [handler, default_data] ...
github
joeyAghion/spidey
https://github.com/joeyAghion/spidey
examples/ebay_pet_supplies_spider.rb
Ruby
mit
182
master
845
class EbayPetSuppliesSpider < Spidey::AbstractSpider handle 'http://pet-supplies.shop.ebay.com', :process_home def process_home(page, _default_data = {}) page.search('#AllCats a[role=menuitem]').each do |a| handle resolve_url(a.attr('href'), page), :process_category, category: a.text.strip end end ...
github
joeyAghion/spidey
https://github.com/joeyAghion/spidey
spec/spec_helper.rb
Ruby
mit
182
master
221
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') require 'spidey' RSpec.configure do |config| config.run_all_when_everything_filtered = true config.raise_errors_for_deprecations! config.filter_run :focus end
github
joeyAghion/spidey
https://github.com/joeyAghion/spidey
spec/spidey/abstract_spider_spec.rb
Ruby
mit
182
master
2,564
require 'spec_helper' describe Spidey::AbstractSpider do describe '#crawl' do before(:each) do @agent = double('agent') @page = double('page') allow(@agent).to receive_messages(get: @page) allow(Mechanize).to receive_messages(new: @agent) end describe 'with handle declaration' do...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
Gemfile
Ruby
mit
182
master
203
source 'https://rubygems.org' group :development, :test do gem 'sprockets', github: 'rails/sprockets' end group :development do gem 'pry' gem 'pry-rescue' gem 'pry-stack_explorer' end gemspec
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
sprockets-commoner.gemspec
Ruby
mit
182
master
1,713
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'sprockets/commoner/version' Gem::Specification.new do |spec| spec.name = "sprockets-commoner" spec.version = Sprockets::Commoner::VERSION spec.authors = ["Bouke van der...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
lib/sprockets/commoner.rb
Ruby
mit
182
master
1,061
require 'sprockets' require 'sprockets/commoner/json_processor' require 'sprockets/commoner/processor' require 'sprockets/commoner/bundle' module Sprockets module Commoner def self.sprockets4? @@sprockets4 ||= Gem::Version.new(Sprockets::VERSION) >= Gem::Version.new('4.0.0.beta') end end register_...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
lib/sprockets/commoner/railtie.rb
Ruby
mit
182
master
466
module Sprockets module Commoner class Railtie < ::Rails::Railtie initializer 'sprockets-commoner' do # We need to disable debugging because otherwise Rails will include each file individually, while we need everything to be bundled up together into a single file. # ^ Not applicable to sproc...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
lib/sprockets/commoner/bundle.rb
Ruby
mit
182
master
3,615
require 'schmooze' module Sprockets module Commoner class Bundle < Schmooze::Base InaccessibleStubbedFileError = Class.new(::StandardError) JS_PACKAGE_PATH = File.expand_path('../../../js', __dir__) dependencies generator: 'babel-generator.default', babelHelpers: 'babel-helpers', ...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
lib/sprockets/commoner/processor.rb
Ruby
mit
182
master
7,816
require 'schmooze' require 'open3' module Sprockets module Commoner class Processor < Schmooze::Base ExcludedFileError = Class.new(::StandardError) VERSION = '3'.freeze BABELRC_FILE = '.babelrc'.freeze PACKAGE_JSON = 'package.json'.freeze JS_PACKAGE_PATH = File.expand_path('../../...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/source_maps_test.rb
Ruby
mit
182
master
1,410
require 'test_helper' class SourceMapsTest < MiniTest::Test def setup skip('Source maps require sprockets 4+') unless Sprockets::Commoner.sprockets4? @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) @env.append_path File.join(__dir__, 'fixtures') end def test_no_rewire_sources a...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/transform_options_test.rb
Ruby
mit
182
master
911
require 'test_helper' class ExtraOptionsTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) Sprockets::Commoner::Processor.configure(@env, transform_options: { 'extra-options' => { globals: { 'jquery' => '$' } } }) @e...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/root_node_modules_test.rb
Ruby
mit
182
master
959
require 'test_helper' class RootNodeModulesTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) @env.append_path File.join(@env.root, 'root-node-modules', 'assets') @env.append_path File.join(@env.root, 'root-node-modules', 'node_modules') end def test_ca...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/no_babel_test.rb
Ruby
mit
182
master
427
require 'test_helper' class NoBabelTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) Sprockets::Commoner::Processor.configure(@env, exclude: ['nobabelrc/index.js']) @env.append_path File.join(__dir__, 'fixtures') end def test_no_babel assert asset ...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/env_test.rb
Ruby
mit
182
master
577
require 'test_helper' class EnvTest < MiniTest::Test def setup ENV['SOME_RANDOM_ENVIRONMENT_VARIABLE'] = 'yes_indeed' @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) @env.append_path File.join(__dir__, 'fixtures') end def test_dependency assert asset = @env['process-env.js'] ...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/different_path_rewire_test.rb
Ruby
mit
182
master
933
require 'test_helper' class DifferentPathRewireTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) @env.append_path File.join(__dir__, 'fixtures', 'different-path') end def test_load_file assert asset = @env['absolute.js'] assert_equal <<-JS.chomp, a...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/error_test.rb
Ruby
mit
182
master
500
require 'test_helper' class ErrorTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) @env.append_path File.join(__dir__, 'fixtures') end def test_error error = assert_raises Schmooze::JavaScript::SyntaxError do @env['typo.js'].to_s end asse...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/stub_test.rb
Ruby
mit
182
master
1,395
require 'test_helper' class StubTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) Sprockets::Commoner::Processor.configure(@env, transform_options: { 'vendor-stub/admin' => { globals: { 'jquery' => '$' } } }) @env.a...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/configure_test.rb
Ruby
mit
182
master
946
require 'test_helper' class ConfigureTest < MiniTest::Test def test_configure_twice env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) env.append_path File.join(__dir__, 'fixtures') # This tests configuring twice, to make sure the second call overwrites the first Sprockets::Commoner::Pr...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/simple_test.rb
Ruby
mit
182
master
726
require 'test_helper' class SimpleTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) @env.append_path File.join(__dir__, 'fixtures') end def test_no_rewire assert asset = @env['no-rewire.js'] assert_equal <<-JS.chomp, asset.to_s.chomp !function(glob...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/circular_test.rb
Ruby
mit
182
master
1,341
require 'test_helper' class CircularTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) @env.append_path File.join(__dir__, 'fixtures') end def test_circular assert asset = @env['circular-dependency.js'] assert_equal <<-JS.chomp, asset.to_s.chomp !fu...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/reject_excluded_test.rb
Ruby
mit
182
master
590
require 'test_helper' class RejectExcludedTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) Sprockets::Commoner::Processor.configure(@env, exclude: ['dont-reject-unused/excluded.js', 'reject-excluded-files/excluded.js']) @env.append_path File.join(__dir__, ...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/rewire_test.rb
Ruby
mit
182
master
7,416
require 'test_helper' class RewireTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) @env.append_path File.join(__dir__, 'fixtures') end def test_just_js assert asset = @env['scripts.js'] assert_equal <<-JS.chomp, asset.to_s.chomp !function(global) ...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/json_test.rb
Ruby
mit
182
master
927
require 'test_helper' class JSONTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) @env.append_path File.join(__dir__, 'fixtures') end def test_import_json assert asset = @env['import-json.js'] assert_equal <<-JS.chomp, asset.to_s.chomp !function(gl...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/cache_key_test.rb
Ruby
mit
182
master
1,088
require 'test_helper' class CacheKeyTest < MiniTest::Test def setup @dir = File.join(__dir__, 'fixtures') end def test_default_cache_key processor = Sprockets::Commoner::Processor.new(@dir) assert_equal ['Sprockets::Commoner::Processor', '3', '6.9.1', [@dir], [File.join(@dir, 'vendor/bundle')], [/no...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/babelrc_exclude_test.rb
Ruby
mit
182
master
872
require 'test_helper' class BabelRcExcludeTest < MiniTest::Test def setup @env = Sprockets::Environment.new(File.join(__dir__, 'fixtures')) Sprockets::Commoner::Processor.configure(@env, babel_exclude: [/excludeme/]) @env.append_path File.join(__dir__, 'fixtures') end def test_stub assert asset ...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/demo/Gemfile
Ruby
mit
182
master
256
source 'https://rubygems.org' gem 'coffee-script' gem 'rails', '4.2.6' gem 'sprockets-commoner', path: '../../' gem 'sprockets', github: 'rails/sprockets' group :development, :test do gem 'teaspoon' gem 'teaspoon-bundle' gem 'teaspoon-jasmine' end
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/demo/config/application.rb
Ruby
mit
182
master
379
require File.expand_path('../boot', __FILE__) require "rails" require "active_model/railtie" require "active_job/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "action_view/railtie" require "sprockets/railtie" require "rails/test_unit/railtie" Bundler.require(*Rails.groups) modu...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/demo/config/environments/development.rb
Ruby
mit
182
master
525
Rails.application.configure do config.cache_classes = false config.eager_load = false config.consider_all_requests_local = true config.action_controller.perform_caching = false config.action_mailer.raise_delivery_errors = false config.active_support.deprecation = :log config.assets.debug = true co...
github
Shopify/sprockets-commoner
https://github.com/Shopify/sprockets-commoner
test/demo/config/environments/test.rb
Ruby
mit
182
master
664
Rails.application.configure do config.cache_classes = true config.eager_load = false config.serve_static_files = true config.static_cache_control = 'public, max-age=3600' config.consider_all_requests_local = true config.action_controller.perform_caching = false config.action_dispatch.show_exceptio...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
coletivo.gemspec
Ruby
mit
181
master
2,552
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{coletivo} s.version = "0.0.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubyg...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
Gemfile
Ruby
mit
181
master
214
source "http://rubygems.org" gem "rails", ">= 3.0.7" group :development do gem "shoulda", "~> 3.0.0.beta2" gem "bundler", "~> 1.15.4" gem "jeweler", "~> 1.6.2" gem "turn" gem "sqlite3" gem "rdoc" end
github
diogenes/coletivo
https://github.com/diogenes/coletivo
Rakefile
Ruby
mit
181
master
1,258
# encoding: utf-8 require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'jeweler' Jeweler::Tasks.new do |gem| # gem is...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/coletivo.rb
Ruby
mit
181
master
945
require 'rails' require 'active_model' require 'active_record' require 'active_support' module Coletivo module Models autoload :Recommendable, 'coletivo/models/recommendable' autoload :Person, 'coletivo/models/person' autoload :PersonRating, 'coletivo/models/person_rating' end module Similarity ...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/coletivo/similarity/pearson_correlation_strategy.rb
Ruby
mit
181
master
1,116
module Coletivo module Similarity class PearsonCorrelationStrategy < BaseStrategy def similarity_between(one, other) shared = shared_items_between(one, other) prefs_one = preferences[one] prefs_other = preferences[other] return 0 if shared.empty? sum_prefs_on...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/coletivo/similarity/euclidean_distance_strategy.rb
Ruby
mit
181
master
418
module Coletivo module Similarity class EuclideanDistanceStrategy < BaseStrategy def similarity_between(one, other) shared = shared_items_between(one, other) return 0 if shared.empty? sum_of_squares = shared.inject(0.0) { |sum, item| sum + (preferences[one][item] - prefer...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/coletivo/similarity/base_strategy.rb
Ruby
mit
181
master
597
module Coletivo module Similarity class BaseStrategy attr_accessor :preferences def similarity_between(one, other) raise "The #similarity_between was not implemented in #{self.class}" end def train_with(people_preferences) @preferences = people_preferences end ...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/coletivo/similarity/engine.rb
Ruby
mit
181
master
557
module Coletivo module Similarity class Engine def self.similarity_between(one, other, preferences, options = {}) strategy = load_strategy options[:strategy] strategy.train_with(preferences) strategy.similarity_between(one, other) end protected def self.load_stra...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/coletivo/models/recommendable.rb
Ruby
mit
181
master
2,478
module Coletivo module Models module Recommendable def self.included(base) base.extend ClassMethods base.send :include, InstanceMethods end module ClassMethods def find_recommendations_for(person, options = {}) preferences = options[:preferences] ||= ...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/coletivo/models/person.rb
Ruby
mit
181
master
625
module Coletivo module Models module Person def self.included(base) base.extend ClassMethods end module ClassMethods # TODO: has_own_preferences doc. def has_own_preferences(options = {}) self.send :include, InstanceMethods end end # ClassMethods ...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/coletivo/models/person_rating.rb
Ruby
mit
181
master
379
module Coletivo module Models class PersonRating < ActiveRecord::Base belongs_to :person, :polymorphic => true belongs_to :rateable, :polymorphic => true validates :person, :rateable, :weight, :presence => true def self.find_for_recommendation(person, rateable_type) where(:rateab...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/generators/coletivo/coletivo_generator.rb
Ruby
mit
181
master
666
require 'rails/generators' require 'rails/generators/migration' class ColetivoGenerator < Rails::Generators::Base include Rails::Generators::Migration def self.source_root File.join(File.dirname(__FILE__), 'templates') end # Implement the required interface for Rails::Generators::Migration. def self.ne...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
lib/generators/coletivo/templates/person_ratings_migration.rb
Ruby
mit
181
master
435
class CreatePersonRatings < ActiveRecord::Migration def self.up create_table :person_ratings do |t| t.integer :person_id t.string :person_type t.integer :rateable_id t.string :rateable_type t.decimal :weight, :precision => 5, :scale => 2 t.timestamps end add_index...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
test/coletivo_test.rb
Ruby
mit
181
master
253
require 'helper' class ColetivoTest < Test::Unit::TestCase should "be able to change the ratings container class" do config = Coletivo::Config.dup config.ratings_container = Object assert_equal Object, config.ratings_container end end
github
diogenes/coletivo
https://github.com/diogenes/coletivo
test/models_helper.rb
Ruby
mit
181
master
465
require 'coletivo' class User < ActiveRecord::Base has_own_preferences end class Movie < ActiveRecord::Base end class Actor < ActiveRecord::Base end def ratings_container Coletivo::Config.ratings_container end class Test::Unit::TestCase def setup truncate! :person_ratings, :users, :movies, :actors end ...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
test/helper.rb
Ruby
mit
181
master
603
require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
test/db/schema.rb
Ruby
mit
181
master
382
require 'generators/coletivo/templates/person_ratings_migration' ActiveRecord::Schema.define(:version => 1) do CreatePersonRatings.up create_table :users do |t| t.string :name t.string :email t.timestamps end create_table :movies do |t| t.string :name t.timestamps end create_table ...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
test/models/person_rating_test.rb
Ruby
mit
181
master
761
require 'helper' require 'models_helper' class PersonRatingTest < Test::Unit::TestCase subject { Coletivo::Models::PersonRating.new } should validate_presence_of(:person) should validate_presence_of(:rateable) should validate_presence_of(:weight) context "#find_for_recommendation" do subject { Coletivo...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
test/models/person_test.rb
Ruby
mit
181
master
336
require 'helper' require 'models_helper' class PersonTest < Test::Unit::TestCase def setup super @person = User.create(:name => 'Uber Geek') end should "be able to rate an object" do movie = Movie.create(:name => 'Lovely Movie') @person.rate!(movie, 1) assert_equal 1, ratings_container.all...
github
diogenes/coletivo
https://github.com/diogenes/coletivo
test/models/recommendable_test.rb
Ruby
mit
181
master
3,303
require 'helper' require 'models_helper' class RecommendableTest < Test::Unit::TestCase def setup super @person1 = User.create(:name => 'Person 1') @person2 = User.create(:name => 'Person 2') end [:euclidean, :pearson].each do |strategy| context "using #{strategy.to_s.upcase}" do should "...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
hydra_attribute.gemspec
Ruby
mit
181
master
1,202
# -*- encoding: utf-8 -*- require File.expand_path('../lib/hydra_attribute/version', __FILE__) Gem::Specification.new do |gem| gem.author = 'Kostyantyn Stepanyuk' gem.email = 'kostya.stepanyuk@gmail.com' gem.summary = 'hydra_attribute is an implementation of EAV patte...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/spec_helper.rb
Ruby
mit
181
master
702
if ENV['CI'] require 'coveralls' Coveralls.wear! do add_filter 'spec' end else require 'simplecov' SimpleCov.start do add_filter 'spec' end end require 'hydra_attribute' ActiveSupport.on_load(:active_record) do self.default_timezone = :utc self.mass_assignment_sanitizer = :strict end ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute_spec.rb
Ruby
mit
181
master
1,091
require 'spec_helper' describe HydraAttribute do describe '#identity_map' do it 'should return IdentityMap object' do HydraAttribute.identity_map.should be_a_kind_of(HydraAttribute::IdentityMap) end it 'should cache identity map object' do im1 = HydraAttribute.identity_map im2 = HydraA...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/migrator_spec.rb
Ruby
mit
181
master
19,074
require 'spec_helper' describe HydraAttribute::Migrator do let(:connection) { ActiveRecord::Base.connection } let(:migrator) { HydraAttribute::Migrator.new(connection) } let(:backend_tables) { ->(entity){ HydraAttribute::SUPPORTED_BACKEND_TYPES.map { |type| "hydra_#{type}_#{entity}" }} } describe '#...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/hydra_entity_attribute_association_spec.rb
Ruby
mit
181
master
9,242
require 'spec_helper' describe HydraAttribute::HydraEntityAttributeAssociation do describe '#has_proxy_method?' do let(:association) { HydraAttribute::HydraEntityAttributeAssociation.new(Product.new) } let!(:hydra_attribute) { HydraAttribute::HydraAttribute.create(entity_type: 'Product', name: 'code', b...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/identity_map_spec.rb
Ruby
mit
181
master
1,333
require 'spec_helper' describe HydraAttribute::IdentityMap do it 'acts like Hash' do HydraAttribute::IdentityMap.should < Hash end describe '#cache' do it 'should store value into cache' do identity_map = HydraAttribute::IdentityMap.new identity_map.cache(:abc, 1).should be(1) identity...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/hydra_entity_spec.rb
Ruby
mit
181
master
2,966
require 'spec_helper' describe HydraAttribute::HydraEntity do describe '.hydra_attributes' do it 'should return all hydra attributes for the model' do Product.should have(0).hydra_attributes Category.should have(0).hydra_attributes HydraAttribute::HydraAttribute.create(entity_type: 'Product', ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/hydra_attribute_spec.rb
Ruby
mit
181
master
11,362
require 'spec_helper' describe HydraAttribute::HydraAttribute do describe '.all_by_entity_type' do describe 'hydra_attributes table has several records' do let!(:attr_id1) { ::ActiveRecord::Base.connection.insert(%q[INSERT INTO hydra_attributes(entity_type, name, backend_type, created_at, updated_at) VALUE...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/hydra_set_spec.rb
Ruby
mit
181
master
2,628
require 'spec_helper' describe HydraAttribute::HydraSet do describe '#hydra_attributes' do it 'should return blank array if model has not ID' do HydraAttribute::HydraSet.new.hydra_attributes.should be_blank end it 'should return blank array if model has not any hydra_attributes' do hydra_set...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/hydra_attribute_set_spec.rb
Ruby
mit
181
master
44,397
require 'spec_helper' describe HydraAttribute::HydraAttributeSet do describe '.all_by_hydra_attribute_id' do describe 'hydra_attribute_sets table has several records' do let(:hydra_attribute_id1) { ::ActiveRecord::Base.connection.insert(%q[INSERT INTO hydra_attributes(entity_type, name, backend_type, creat...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/hydra_value_spec.rb
Ruby
mit
181
master
11,212
require 'spec_helper' describe HydraAttribute::HydraValue do describe '.arel_tables' do it 'should return hash which holds arel tables for entity table and backend type' do arel_tables = HydraAttribute::HydraValue.arel_tables table = arel_tables['products']['string'] table.name.should == 'hy...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/model_spec.rb
Ruby
mit
181
master
1,241
require 'spec_helper' describe HydraAttribute::Model do describe '.first' do before do Product.hydra_attributes.create(name: 'yyy', backend_type: 'string') Product.hydra_attributes.create(name: 'aaa', backend_type: 'string') Product.hydra_attributes.create(name: 'zzz', backend_type: 'string') ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/active_record_spec.rb
Ruby
mit
181
master
30,824
require 'spec_helper' describe HydraAttribute::ActiveRecord do describe '.inspect' do before do HydraAttribute::HydraAttribute.create(entity_type: 'Product', name: 'code', backend_type: 'string', white_list: true) HydraAttribute::HydraAttribute.create(entity_type: 'Product', name: 'price', backend_t...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/middleware/identity_map_spec.rb
Ruby
mit
181
master
642
require 'spec_helper' require 'hydra_attribute/middleware/identity_map' describe HydraAttribute::Middleware::IdentityMap do describe '#call' do let(:app) do lambda do |*| ::HydraAttribute.identity_map[:key2] = :value2 expect(::HydraAttribute.identity_map).to eq(key: :value, key2: :value2) ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/model/cacheable_spec.rb
Ruby
mit
181
master
3,921
require 'spec_helper' describe HydraAttribute::Model::Cacheable do before do ::ActiveRecord::Base.connection.create_table(:custom_products) do |t| t.string :name t.float :price t.integer :quantity t.timestamps end Object.const_set('CustomProduct', Class.new) CustomProduct.s...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/model/persistence_spec.rb
Ruby
mit
181
master
19,819
require 'spec_helper' describe HydraAttribute::Model::Persistence do before(:all) do ::ActiveRecord::Base.connection.create_table(:custom_products) do |t| t.string :name t.decimal :price, precision: 4, scale: 2 t.integer :quantity t.timestamps end Object.const_set('CustomProduct'...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/model/mediator_spec.rb
Ruby
mit
181
master
2,478
require 'spec_helper' describe HydraAttribute::Model::Mediator do before do Object.const_set('M1', Class.new) Object.const_set('M2', Class.new) Object.const_set('M3', Class.new) M1.send(:include, HydraAttribute::Model::Mediator) M2.send(:include, HydraAttribute::Model::Mediator) M3.send(:inc...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/model/has_many_through_spec.rb
Ruby
mit
181
master
4,627
require 'spec_helper' describe HydraAttribute::Model::HasManyThrough::Relation do def find_relation_object(attributes = {}) HydraAttribute::HydraAttributeSet.all.find do |relation| attributes.all? do |attribute, value| relation.send(attribute) == value end end end describe '#build' d...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/model/identity_map_spec.rb
Ruby
mit
181
master
1,099
require 'spec_helper' describe HydraAttribute::Model::IdentityMap do before do Object.const_set(:ExampleClass, Class.new) ExampleClass.send(:include, HydraAttribute::Model::IdentityMap) end after do Object.send(:remove_const, :ExampleClass) end describe '.identity_map_cache_key' do it 'shou...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/active_record/attribute_methods_spec.rb
Ruby
mit
181
master
1,787
require 'spec_helper' describe HydraAttribute::ActiveRecord::AttributeMethods do describe '#read_attribute' do before do Product.hydra_attributes.create(name: 'code', backend_type: 'string', default_value: 'abc') end let(:product) { Product.new } it 'should return value of static attribute'...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/hydra_attribute/active_record/mass_assignment_security_spec.rb
Ruby
mit
181
master
2,218
require 'spec_helper' module HydraAttribute::ActiveRecord::MassAssignmentSecurity describe 'WhiteList' do before do ProductWhiteList.hydra_attributes.create(name: 'color', backend_type: 'string', white_list: true) ProductWhiteList.hydra_attributes.create(name: 'code', backend_type: 'string', whi...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/environments/mysql.rb
Ruby
mit
181
master
792
config = { :adapter => 'mysql2', :host => ENV['DB_HOST'] || 'localhost', :database => ENV['DB_NAME'] || 'hydra_attribute_test', :username => ENV['DB_USERNAME'] || 'root', :password => ENV['DB_PASSWORD'], :encoding => 'utf8' } ActiveRecord::Base.establish_connection(config.merge(database: nil))...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/environments/sqlite.rb
Ruby
mit
181
master
410
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') RSpec.configure do |spec| spec.after do ActiveRecord::Base.connection_pool.connections.each do |connection| connection.tables.each do |table_name| connection.execute("DELETE FROM #{table_name}") connection.exe...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
spec/environments/postgresql.rb
Ruby
mit
181
master
790
config = { :adapter => 'postgresql', :host => ENV['DB_HOST'] || 'localhost', :database => ENV['DB_NAME'] || 'hydra_attribute_test', :username => ENV['DB_USERNAME'] || 'postgres', :password => ENV['DB_PASSWORD'], :encoding => 'utf8' } ActiveRecord::Base.establish_connection(config.merge(databas...