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
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/config/environments/test.rb
Ruby
mit
207
main
1,796
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
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb
Ruby
mit
207
main
356
# Be sure to restart your server when you modify this file. # Require `belongs_to` associations by default. This is a new Rails 5.0 # default, so it is introduced as a configuration option to ensure that apps # made on earlier versions of Rails are not affected when upgrading. Rails.application.config.active_record.be...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/app/channels/application_cable/channel.rb
Ruby
mit
207
main
205
# Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading. module ApplicationCable class Channel < ActionCable::Channel::Base end end
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/app/channels/application_cable/connection.rb
Ruby
mit
207
main
211
# Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading. module ApplicationCable class Connection < ActionCable::Connection::Base end end
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/app/models/my_record.rb
Ruby
mit
207
main
271
class MyRecord < ActiveRecord::Base before_save :before_s after_save :after_s before_create :before_c after_create :after_c after_commit :after_com def before_s end def after_s end def before_c end def after_c end def after_com end end
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/app/models/vehicle.rb
Ruby
mit
207
main
407
class Vehicle < ApplicationRecord upsert_keys [:make, :name] before_save :before_s after_save :after_s before_create :before_c after_create :after_c after_commit :after_com validates :name, presence: true attribute :license, :string, default: 'Unknown' belongs_to :account def before_s end d...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/db/schema.rb
Ruby
mit
207
main
1,397
# 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
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/db/migrate/20160419124138_create_my_records.rb
Ruby
mit
207
main
221
class CreateMyRecords < ActiveRecord::Migration[5.0] def change create_table :my_records do |t| t.string :name t.integer :wisdom t.timestamps t.index :wisdom, unique: true end end end
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/db/migrate/20160419124140_create_accounts.rb
Ruby
mit
207
main
293
class CreateAccounts < ActiveRecord::Migration[5.0] def change create_table :accounts do |t| t.string :name t.boolean :active t.timestamps end add_index :accounts, :name, unique: true, where: "active IS TRUE" add_reference :vehicles, :account end end
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/db/migrate/20160419103547_create_vehicles.rb
Ruby
mit
207
main
326
class CreateVehicles < ActiveRecord::Migration[5.0] def change create_table :vehicles do |t| t.integer :wheels_count t.string :name t.string :make t.string :long_field t.timestamps t.index [:make, :name], unique: true t.index 'md5(long_field)', unique: true end en...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/dummy/db/migrate/20190428142610_add_year_to_vehicles.rb
Ruby
mit
207
main
288
class AddYearToVehicles < ActiveRecord::Migration[5.0] def change add_column :vehicles, :year, :integer add_index :vehicles, :year, unique: true add_index :vehicles, [:make], unique: true, where: "year IS NULL", name: 'partial_index_vehicles_on_make_without_year' end end
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/active_record/key_spec.rb
Ruby
mit
207
main
4,272
module ActiveRecord RSpec.describe 'Alernate conflict keys' do describe '#upsert' do let(:record) { Vehicle.new(make: 'Ford', name: 'Focus') } it 'calls save/create/commit callbacks' do expect(record).to receive(:before_s) expect(record).to receive(:after_s) expect(record).to r...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/active_record/notifications_spec.rb
Ruby
mit
207
main
594
module ActiveRecord RSpec.describe 'Base' do describe '#upsert' do let(:events) { [] } before(:each) do @subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args| events << args end end after(:each) do ActiveSupport::Notificat...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/active_record/inheritance_spec.rb
Ruby
mit
207
main
352
module ActiveRecord RSpec.describe 'Base' do describe '.upsert_keys' do context 'when using inheritance' do context 'and not setting subclass upsert keys' do it 'returns the superclass upsert keys' do expect(Bicycle.upsert_keys).to eq(Vehicle.upsert_keys) end ...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
spec/active_record/base_spec.rb
Ruby
mit
207
main
9,812
module ActiveRecord RSpec.describe 'Base' do describe '#upsert' do let(:record) { MyRecord.new(id: 'some_id') } it 'calls save/create/commit callbacks' do expect(record).to receive(:before_s) expect(record).to receive(:after_s) expect(record).to receive(:after_c) expect...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert.rb
Ruby
mit
207
main
640
require 'active_record_upsert/version' unless defined?(Arel) raise 'ActiveRecordUpsert has to be required after ActiveRecord/Arel' end unless defined?(ActiveRecord) raise 'ActiveRecordUpsert has to be required after ActiveRecord' end require 'active_record_upsert/arel' require 'active_record_upsert/active_record...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/active_record.rb
Ruby
mit
207
main
964
unless defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) require 'active_record/connection_adapters/postgresql_adapter' end Dir.glob(File.join(__dir__, 'active_record/**/*.rb')) do |f| require f end module ActiveRecord RecordSavedError = Class.new(ActiveRecordError) end ::ActiveRecord::Base.prepen...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/arel/insert_manager.rb
Ruby
mit
207
main
447
module ActiveRecordUpsert module Arel module InsertManagerExtensions def on_conflict= node @ast.on_conflict = node end def do_nothing_on_conflict(target) @ast.on_conflict = Nodes::OnConflict.new.tap do |on_conflict| on_conflict.target = target on_conflict.act...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/arel/table_extensions.rb
Ruby
mit
207
main
962
module ActiveRecordUpsert module Arel module TableExtensions def compile_upsert(upsert_keys, upsert_options, upsert_values, insert_values, wheres) # Support non-attribute key (like `md5(my_attribute)``) target = self[upsert_options.key?(:literal) ? ::Arel::Nodes::SqlLiteral.new(upsert_option...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/arel/on_conflict_do_update_manager.rb
Ruby
mit
207
main
891
module Arel class OnConflictDoUpdateManager < Arel::TreeManager def initialize super @ast = Nodes::OnConflict.new @action = Nodes::DoUpdateSet.new @ast.action = @action @ctx = @ast end def target_condition= where @ast.where = where end def target= column ...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/arel/visitors/to_sql.rb
Ruby
mit
207
main
1,469
module ActiveRecordUpsert module Arel module Visitors module ToSqlExtensions def visit_Arel_Nodes_InsertStatement(o, collector) collector = super if o.on_conflict maybe_visit o.on_conflict, collector else collector end end ...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/arel/nodes/on_conflict.rb
Ruby
mit
207
main
455
module Arel module Nodes class OnConflict < Node attr_accessor :target, :where, :action def initialize super @target = nil @action = nil @where = nil end def hash [@target, @action].hash end def eql? other self.class == other.c...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/arel/nodes/do_update_set.rb
Ruby
mit
207
main
696
module Arel module Nodes class DoUpdateSet < OnConflictAction attr_accessor :wheres, :values attr_accessor :key def initialize @wheres = [] @values = [] @key = nil end def initialize_copy other super @wheres = @wheres.clone @...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/arel/nodes/insert_statement.rb
Ruby
mit
207
main
484
module Arel module Nodes class InsertStatement attr_accessor :on_conflict def hash [@relation, @columns, @values, @select, @on_conflict].hash end def eql? other self.class == other.class && self.relation == other.relation && self.columns == other.colum...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/compatibility/rails60.rb
Ruby
mit
207
main
440
module ActiveRecordUpsert module ActiveRecord module TransactionsExtensions def upsert(*args, **kwargs) with_transaction_returning_status { super } end end module ConnectAdapterExtension def upsert(*args, **kwargs) ::ActiveRecord::Base.clear_query_caches_for_current_thre...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/compatibility/rails70.rb
Ruby
mit
207
main
2,019
module ActiveRecordUpsert module ActiveRecord module PersistenceExtensions module ClassMethods def __substitute_values(values, table) values.map do |name, value| attr = table[name] unless ::Arel.arel_node?(value) || value.is_a?(::ActiveModel::Attribute) ...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/active_record/persistence.rb
Ruby
mit
207
main
4,160
module ActiveRecordUpsert module ActiveRecord module PersistenceExtensions def upsert!(attributes: nil, arel_condition: nil, validate: true, opts: {}) raise ::ActiveRecord::ReadOnlyRecord, "#{self.class} is marked as readonly" if readonly? raise ::ActiveRecord::RecordSavedError, "Can't upser...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/active_record/timestamp.rb
Ruby
mit
207
main
505
module ActiveRecordUpsert module ActiveRecord module TimestampExtensions def _upsert_record(*args) if self.record_timestamps current_time = current_time_from_proper_timezone all_timestamp_attributes_in_model.each do |column| column = column.to_s if has_at...
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/active_record/transactions.rb
Ruby
mit
207
main
241
module ActiveRecordUpsert module ActiveRecord module TransactionsExtensions def upsert(*args) rollback_active_record_state! do with_transaction_returning_status { super } end end end end end
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/active_record/connection_adapters/abstract/database_statements.rb
Ruby
mit
207
main
288
module ActiveRecordUpsert module ActiveRecord module ConnectionAdapters module Abstract module DatabaseStatementsExtensions def exec_upsert(_sql, _name, _binds, _pk) raise NotImplementedError end end end end end end
github
jesjos/active_record_upsert
https://github.com/jesjos/active_record_upsert
lib/active_record_upsert/active_record/connection_adapters/postgresql/database_statements.rb
Ruby
mit
207
main
503
module ActiveRecordUpsert module ActiveRecord module ConnectionAdapters module Postgresql module DatabaseStatementsExtensions def upsert(arel, name = nil, binds = []) sql, binds = to_sql_and_binds(arel, binds) exec_upsert(sql, name, binds) end d...
github
HazAT/fastlane-plugin-badge
https://github.com/HazAT/fastlane-plugin-badge
fastlane-plugin-badge.gemspec
Ruby
mit
207
master
1,132
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fastlane/plugin/badge/version' Gem::Specification.new do |spec| spec.name = 'fastlane-plugin-badge' spec.version = Fastlane::Badge::VERSION spec.author = %q{Daniel Gri...
github
HazAT/fastlane-plugin-badge
https://github.com/HazAT/fastlane-plugin-badge
spec/badge_action_spec.rb
Ruby
mit
207
master
249
describe Fastlane::Actions::AddBadgeAction do describe '#run' do it 'prints a message' do expect(Fastlane::UI).to receive(:message).with("The badge plugin is working!") Fastlane::Actions::AddBadgeAction.run(nil) end end end
github
HazAT/fastlane-plugin-badge
https://github.com/HazAT/fastlane-plugin-badge
spec/spec_helper.rb
Ruby
mit
207
master
378
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) # This module is only used to check the environment is currently a testing env module SpecHelper end require 'fastlane' # to import the Action super class require 'fastlane/plugin/badge' # import the actual plugin Fastlane.load_actions # load other actions (...
github
HazAT/fastlane-plugin-badge
https://github.com/HazAT/fastlane-plugin-badge
lib/fastlane/plugin/badge.rb
Ruby
mit
207
master
457
require 'fastlane/plugin/badge/version' module Fastlane module Badge # Return all .rb files inside the "actions" and "helper" directory def self.all_classes Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))] end end end # By default we want to import all available actions ...
github
HazAT/fastlane-plugin-badge
https://github.com/HazAT/fastlane-plugin-badge
lib/fastlane/plugin/badge/actions/add_badge_action.rb
Ruby
mit
207
master
1,337
module Fastlane module Actions class AddBadgeAction < Action def self.run(params) Actions.verify_gem!('badge') Helper::BadgeHelper.run(params) end def self.description "Automatically add a badge to your app icon" end def self.authors ["HazAT"] ...
github
HazAT/fastlane-plugin-badge
https://github.com/HazAT/fastlane-plugin-badge
lib/fastlane/plugin/badge/helper/badge_helper.rb
Ruby
mit
207
master
592
module BadgeBridge class Bridge def self.available_options require 'badge' Badge::Options.available_options end def self.run(options) Badge::Runner.new.run('.', options) end end end module Fastlane module Helper class BadgeHelper # class methods that you define here b...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
Rakefile
Ruby
mit
207
master
678
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 = 'RailsDbInfo' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.rdoc') ...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
rails_db_info.gemspec
Ruby
mit
207
master
895
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "rails_db_info/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "rails_db_info" s.version = RailsDbInfo::VERSION s.authors = ["Vlado Cingel"] s.email = ["vl...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
Gemfile
Ruby
mit
207
master
293
source "https://rubygems.org" # Declare your gem's dependencies in rails_db_info.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec :path => File.expand_path("../.", __FILE__)
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/dummy/config/application.rb
Ruby
mit
207
master
887
require File.expand_path('../boot', __FILE__) require 'rails/all' Bundler.require(*Rails.groups) require "rails_db_info" module Dummy class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in con...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/dummy/config/environments/test.rb
Ruby
mit
207
master
1,603
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 sui...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/dummy/config/initializers/wrap_parameters.rb
Ruby
mit
207
master
520
# Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters :...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/dummy/config/initializers/session_store.rb
Ruby
mit
207
master
229
# Be sure to restart your server when you modify this file. Dummy::Application.config.secret_token = "some secret phrase of at least 30 characters" Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/dummy/config/initializers/secret_token.rb
Ruby
mit
207
master
659
# Be sure to restart your server when you modify this file. # Your secret key is used 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 diction...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/dummy/db/schema.rb
Ruby
mit
207
master
1,005
# 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
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/dummy/db/migrate/20130819203338_create_users.rb
Ruby
mit
207
master
217
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :username t.string :email t.integer :age t.boolean :admin t.timestamps end end end
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/dummy/app/controllers/application_controller.rb
Ruby
mit
207
master
207
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 end
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/integration/catch_all_routes_test.rb
Ruby
mit
207
master
850
require 'test_helper' class CatchAllRoutesTest < ActionDispatch::IntegrationTest setup do ENV['CATCH_ALL_ROUTE'] = 'catch' Rails.application.reload_routes! end teardown do ENV.delete('CATCH_ALL_ROUTE') Rails.application.reload_routes! end test "I see list of tables when I visit rails_db_inf...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
test/integration/navigation_test.rb
Ruby
mit
207
master
2,544
require 'test_helper' class NavigationTest < ActionDispatch::IntegrationTest # fixtures :all test "I see list of tables when I visit rails_db_info dashboard" do get '/rails/info/db' assert assigns(:tables) assert_select 'h1', 'Tables' %w(schema_migrations users).each do |table| assert_selec...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
config/routes.rb
Ruby
mit
207
master
201
RailsDbInfo::Engine.routes.draw do root :to => 'tables#index' resources :tables, :only => [:index, :show] do get 'entries' end end Rails.application.routes.draw do mount_rails_db_info end
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
app/controllers/rails_db_info/tables_controller.rb
Ruby
mit
207
master
415
module RailsDbInfo class TablesController < RailsDbInfo::ApplicationController def index @tables = ActiveRecord::Base.connection.tables.sort end def show @table = RailsDbInfo::Table.new(params[:id]) end def entries @table = RailsDbInfo::Table.new(params[:table_id]) @entr...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
app/helpers/rails_db_info/application_helper.rb
Ruby
mit
207
master
1,389
module RailsDbInfo module ApplicationHelper def paginate_table_entries(entries) return if entries.total_pages == 1 prev_page_text = '< Previous' next_page_text = 'Next>' html = '<div class="pagination">' html << (entries.previous_page ? link_to(prev_page_text, :page => entries.prev...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
lib/rails_db_info.rb
Ruby
mit
207
master
295
module RailsDbInfo # Custom require relative that work with older rubies also def self.require_relative(path) full_path = File.expand_path(path, File.dirname(__FILE__)) Kernel.require(full_path) end end require "rails_db_info/engine" RailsDbInfo.require_relative("rails/routes")
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
lib/rails/routes.rb
Ruby
mit
207
master
333
module ActionDispatch::Routing class Mapper # Includes mount_rails_db_info method for routes. This method is responsible to # generate all needed routes for rails_db_info def mount_rails_db_info(options = {}) mount RailsDbInfo::Engine => "/rails/info/db", :as => options[:as] || 'rails_db_info' e...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
lib/rails_db_info/table.rb
Ruby
mit
207
master
401
module RailsDbInfo class Table attr_reader :name def initialize(table_name) @name = table_name end def columns connection.columns(name) end def column_properties %w(name sql_type null limit precision scale type default) end def to_param name end p...
github
vlado/rails_db_info
https://github.com/vlado/rails_db_info
lib/rails_db_info/table_entries.rb
Ruby
mit
207
master
1,035
module RailsDbInfo class TableEntries attr_reader :table attr_accessor :current_page, :offset, :per_page delegate :each, :to => :load def initialize(table) @table = table end def load connection.exec_query("SELECT * FROM #{table.name} LIMIT #{per_page} OFFSET #{offset}") en...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
git-issue.gemspec
Ruby
mit
207
master
829
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "git_issue/version" Gem::Specification.new do |s| s.name = "git-issue" s.version = GitIssue::VERSION s.authors = ["Tomohito Ozaki"] s.email = ["ozaki@yuroyoro.com"] s.homepage = "https://github.com/yuroyoro...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
spec/spec_helper.rb
Ruby
mit
207
master
203
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'git_issue' require 'rspec' require 'rspec/autorun' RSpec.configure do |config| end
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
spec/git_issue_spec.rb
Ruby
mit
207
master
1,359
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe GitIssue do describe '#main' do context 'config issue.type does not configured' do it{ GitIssue::Helper.should_receive(:configured_value).with("type").and_return("") GitIssue::Helper.should_receive(:configured_value)...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
spec/git_issue/redmine_spec.rb
Ruby
mit
207
master
2,488
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe GitIssue::Redmine do let(:apikey) { "ABCDEFG1234567890" } let(:url) { "http://example.com/redmine" } describe '#initialize' do context 'ginve no apikey ' do let(:args) { ["show", "1234"] } it { lambda{ GitIssue::Redmi...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
spec/git_issue/github_spec.rb
Ruby
mit
207
master
8,796
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe GitIssue::Github do let(:apikey) { "ABCDEFG1234567890" } let(:user) { "yuroyoro" } let(:repo) { "gitterb" } describe '#initialize' do context 'ginve no apikey ' do let(:args) { ["show", "1234"] } it { lambda{ Gi...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
spec/git_issue/base_spec.rb
Ruby
mit
207
master
1,975
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe GitIssue::Base do class SampleIts < GitIssue::Base def show(options = {});end def guess_ticket; 6789 end end describe '#initialize' do context 'specified unknown g ' do let(:args) { ["homuhomu", "1234"] } it ...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
lib/git_issue.rb
Ruby
mit
207
master
4,955
#!/usr/bin/env ruby # -*- coding: utf-8 -*- if RUBY_VERSION < '1.9.0' $KCODE = "UTF8" else Encoding.default_external = Encoding.find('UTF-8') end require 'pp' require 'rubygems' require 'uri' require 'open-uri' require "net/http" require "net/https" require "uri" require 'fileutils' require 'json' require 'optpar...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
lib/git_issue/redmine.rb
Ruby
mit
207
master
19,959
# -*- coding: utf-8 -*- module GitIssue class Redmine < GitIssue::Base def initialize(args, options = {}) super(args, options) @apikey = options[:apikey] || configured_value('issue.apikey') configure_error('apikey', "git config issue.apikey some_api_key") if @apikey.blank? @url = options[:url] || ...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
lib/git_issue/bitbucket.rb
Ruby
mit
207
master
13,861
# -*- coding: utf-8 -*- require 'base64' require 'pit' module GitIssue class GitIssue::Bitbucket < GitIssue::Base def initialize(args, options = {}) super(args, options) @repo = configured_value('issue.repo') if @repo.blank? url = `git config remote.origin.url`.strip @repo = url.match(/bitbu...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
lib/git_issue/github.rb
Ruby
mit
207
master
13,956
# -*- coding: utf-8 -*- require 'base64' require 'pit' module GitIssue class GitIssue::Github < GitIssue::Base def initialize(args, options = {}) super(args, options) @repo = configured_value('issue.repo') if @repo.blank? url = `git config remote.origin.url`.strip @repo = url.match(/github.c...
github
yuroyoro/git-issue
https://github.com/yuroyoro/git-issue
lib/git_issue/base.rb
Ruby
mit
207
master
9,812
# -*- coding: utf-8 -*- class GitIssue::Base include GitIssue::Helper include Term::ANSIColor attr_reader :apikey, :command, :tickets, :options attr_accessor :sysout, :syserr def initialize(args, options = {}) @opt_parse_obj = opt_parser args = parse_options(args) @sysout = options[:sysout] |...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
futuroscope.gemspec
Ruby
mit
207
master
1,171
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "futuroscope/version" Gem::Specification.new do |spec| spec.name = "futuroscope" spec.version = Futuroscope::VERSION spec.authors = ["Josep Jaume Rey Peroy"] spec.emai...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
Gemfile
Ruby
mit
207
master
205
source "https://rubygems.org" gem "guard" gem "guard-rspec" gem "guard-bundler" gem "coveralls" gem "json" gem "rubysl", platform: :rbx # Specify your gem's dependencies in futuroscope.gemspec gemspec
github
codegram/futuroscope
https://github.com/codegram/futuroscope
Guardfile
Ruby
mit
207
master
318
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard "rspec", bundler: false do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch("spec/spec_helper.rb") { "spec" } end guard "bundler" do watch("Gemfile") watch(/^.+\\.gemspec/) end
github
codegram/futuroscope
https://github.com/codegram/futuroscope
spec/futuroscope_spec.rb
Ruby
mit
207
master
402
describe Futuroscope do describe "default_pool" do it "returns a pool by default" do expect(Futuroscope.default_pool).to be_kind_of(Futuroscope::Pool) end end describe "default_pool=" do it "allows you to set a new default pool" do pool = Futuroscope::Pool.new Futuroscope.default_po...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
spec/futuroscope/convenience_spec.rb
Ruby
mit
207
master
625
require "futuroscope/convenience" require "timeout" describe "Kernel#future" do it "adds a convenience method to ruby's kernel" do x = future{ sleep(1); 1 } y = future{ sleep(1); 2 } z = future{ sleep(1); 3 } Timeout::timeout(2.5) do expect(x + y + z).to eq(6) end end end describe "Enum...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
spec/futuroscope/future_spec.rb
Ruby
mit
207
master
2,853
require "timeout" module Futuroscope describe Future do it "will return an instant value" do future = Future.new{ :edballs } sleep(0.1) expect(future).to eq(:edballs) end it "will execute the future in the background and wait for it" do future = Future.new{ sleep(1); :edballs } ...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
spec/futuroscope/map_spec.rb
Ruby
mit
207
master
385
module Futuroscope describe Map do it "behaves like a normal map" do items = [1, 2, 3] result = Map.new(items).map do |item| sleep(item) "Item #{item}" end Timeout::timeout(4) do expect(result.first).to eq("Item 1") expect(result[1]).to eq("Item 2") ...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
spec/futuroscope/pools/worker_pool_spec.rb
Ruby
mit
207
master
2,006
module Futuroscope module Pools describe WorkerPool do it "spins up a number of workers" do pool = WorkerPool.new(2..4) expect(pool.workers).to have(2).workers pool = WorkerPool.new(3..4) expect(pool.workers).to have(3).workers end describe "queue" do it...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
spec/futuroscope/pools/no_pool_spec.rb
Ruby
mit
207
master
268
module Futuroscope module Pools describe NoPool do it "should run queued futures on the same thread" do pool = NoPool.new future = Future.new(pool) { Thread.current } expect(future).to eq Thread.current end end end end
github
codegram/futuroscope
https://github.com/codegram/futuroscope
spec/futuroscope/pools/worker_spec.rb
Ruby
mit
207
master
532
module Futuroscope module Pools describe Worker do it "asks the pool for a new job and runs the future" do future = double(:future) pool = [future] expect(future).to receive :run_future Worker.new(pool).run sleep(1) end it "notifies the pool when the wor...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
lib/futuroscope.rb
Ruby
mit
207
master
635
require "futuroscope/version" require "futuroscope/future" require "futuroscope/pool" require "futuroscope/pools/worker" require "futuroscope/pools/worker_pool" require "futuroscope/pools/no_pool" require "futuroscope/map" module Futuroscope # Gets the default futuroscope's pool. # # Returns a Pool def self...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
lib/futuroscope/convenience.rb
Ruby
mit
207
master
240
require "futuroscope" module Kernel def future(pool = Futuroscope.default_pool, &block) Futuroscope::Future.new(pool, &block) end end module Enumerable def future_map(&block) Futuroscope::Map.new(self).map(&block) end end
github
codegram/futuroscope
https://github.com/codegram/futuroscope
lib/futuroscope/future.rb
Ruby
mit
207
master
2,217
require "thread" require "delegate" require "forwardable" module Futuroscope # A Future is an object that gets initialized with a block and will behave # exactly like the block's result, but being able to "borrow" its result from # the future. That is, will block when the result is not ready until it is, # and...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
lib/futuroscope/pool.rb
Ruby
mit
207
master
327
module Futuroscope # A pool runs futures in an implementation-specific way. # # The default implementation is the WorkerPool, that runs futures concurrently # in threads. class Pool # Public: Enqueues a new Future into the pool. # # future - The Future to enqueue. def queue(future) end e...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
lib/futuroscope/map.rb
Ruby
mit
207
master
695
require "futuroscope/future" module Futuroscope # A futuroscope map behaves like a regular map but performs all operations # using futures so they're effectively parallel. # class Map # Initializes a map with a set of items. # # items - Items in which to perform the mapping # def initialize...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
lib/futuroscope/pools/no_pool.rb
Ruby
mit
207
master
236
module Futuroscope module Pools # A pool, that does not actually do any thread pooling, but just runs # futures right away. class NoPool < Pool def queue(future) future.run_future end end end end
github
codegram/futuroscope
https://github.com/codegram/futuroscope
lib/futuroscope/pools/worker.rb
Ruby
mit
207
master
938
module Futuroscope module Pools # A worker asks it's pool for new jobs and runs them concurrently in a # thread. class Worker # Public: Initializes a new Worker. # # pool - The worker Pool it belongs to. def initialize(pool) @pool = pool end # Runs the worker. ...
github
codegram/futuroscope
https://github.com/codegram/futuroscope
lib/futuroscope/pools/worker_pool.rb
Ruby
mit
207
master
2,163
require "set" require "thread" module Futuroscope module Pools # Futuroscope's pool is design to control concurency and keep it between # some certain benefits. Moreover, we warm up the threads beforehand so we # don't have to spin them up each time a future is created. class WorkerPool < Pool ...
github
jferris/effigy
https://github.com/jferris/effigy
Rakefile
Ruby
mit
206
master
982
require 'rake' require 'bundler/gem_tasks' require 'rspec/core/rake_task' require 'cucumber/rake/task' require 'reek/rake/task' require 'yard' desc 'Default: run the specs, features, and metrics.' task :default => [:spec, :cucumber, :metrics] RSpec::Core::RakeTask.new do |t| end desc "Run all specs individually to e...
github
jferris/effigy
https://github.com/jferris/effigy
effigy.gemspec
Ruby
mit
206
master
1,225
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'effigy' s.version = '0.4.0' s.authors = ['Joe Ferris'] s.date = %q{2010-08-20} s.description = %q{Define views in Ruby and templates in HTML. Avoid code interpolation or ugly templating languages. Use ids, class names, and semantic structures...
github
jferris/effigy
https://github.com/jferris/effigy
lib/generators/effigy/base.rb
Ruby
mit
206
master
550
require 'rails/generators' require 'rails/generators/named_base' module Effigy module Generators # Base generator for Effigy generators. Setups up the source root. class Base < ::Rails::Generators::NamedBase # @return [String] source root for tempates within an effigy generator def self.source_ro...
github
jferris/effigy
https://github.com/jferris/effigy
lib/generators/effigy/view/view_generator.rb
Ruby
mit
206
master
1,728
require 'generators/effigy/base' module Effigy module Generators # Generates an Effigy view and template for a given controller and list of # actions. class ViewGenerator < Base argument :actions, :type => :array, :default => [], :banner => "action action" def effigy_directories empt...
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/rails.rb
Ruby
mit
206
master
1,806
require 'effigy/view' require 'effigy/rails/view' require 'effigy/rails/template_handler' ActiveSupport.on_load(:action_view) do ActionView::Template.register_template_handler :effigy, Effigy::Rails::TemplateHandler end module Effigy # Rails-specific functionality. # # Effigy includes Rails generators for gen...
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/selection.rb
Ruby
mit
206
master
1,396
module Effigy # Proxy class for performing transformations with a set selection. # # Selections are created and returned when calling {View#find} without a # block. Any methods called on the Selection will be forwarded to the given # view with the given selector inserted at the front of the argument list. #...
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/class_list.rb
Ruby
mit
206
master
1,094
require 'nokogiri' module Effigy # Internal use only. # # Used when parsing and manipulating lists of CSS class names. class ClassList # @param element [Nokogiri::XML::Element] the element whose class names # should be manipulated def initialize(element) @element = element read_class_...
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/view.rb
Ruby
mit
206
master
10,476
require 'nokogiri' require 'effigy/class_list' require 'effigy/selection' require 'effigy/core_ext/hash' require 'effigy/core_ext/object' require 'effigy/nokogiri_ext' require 'effigy/example_element_transformer' module Effigy # Accepts a template to be transformed. # # For most common cases, creating a subclass...
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/example_element_transformer.rb
Ruby
mit
206
master
2,261
module Effigy # Performs transformations based on an array of example elements. Used internally. # @see Effigy::View#replace_each class ExampleElementTransformer def initialize(view, example_elements) @view = view @example_elements = example_elements end # Replaces the example elements wi...
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/nokogiri_ext.rb
Ruby
mit
206
master
671
require 'nokogiri' module Nokogiri module XML # Adds or updates the given attribute or attributes. # @param [Hash] attributes keys as attribute names and values as attribute # values class Node def merge!(new_attributes) new_attributes.each do |name, value| self[name.to_s] =...
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/core_ext/object.rb
Ruby
mit
206
master
374
# Internal use only. # # Extends Object to easily convert a hash or key, value pair to a hash. class Object # @return [Hash] a hash composed of the object as the key and the given value # as the value. # @param [Object] value the value to use in the generated hash # @see Hash#to_effigy_attributes def to_eff...
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/core_ext/hash.rb
Ruby
mit
206
master
252
# Internal use only. # # Extends Hash to easily convert a hash or key, value pair to a hash. class Hash # @return [Hash] self # @param [Object] value ignored # @see Object#to_effigy_attributes def to_effigy_attributes(value) self end end
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/rails/template_handler.rb
Ruby
mit
206
master
4,430
module Effigy module Rails # Adds hooks to Rails to discover Effigy views and templates. # # View files should be added to the app/views/<controller> directory with # an .effigy suffix. Template files should be added to # app/templates/<controller> with no suffix. # # For example, the view...
github
jferris/effigy
https://github.com/jferris/effigy
lib/effigy/rails/view.rb
Ruby
mit
206
master
2,106
module Effigy module Rails # Provides Rails-specific methods to Effigy views. Rather than # instantiating this class directly, it is recommended that you create view # and template files and allow {Effigy::Rails::TemplateHandler} to discover # and compile views. # # Instance variables from con...