Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Remove "closed" from Bug Factory | FactoryGirl.define do
factory(:bug, class: 'Bug') do
title { "#{Faker::Commerce.product_name} can’t #{Faker::Company.bs}" }
reporter
description { "#{Faker::Lorem.paragraph}\n#{Faker::Hacker.say_something_smart}" }
closed { [true, false].sample }
end
end
| FactoryGirl.define do
factory(:bug, class: 'Bug') do
title { "#{Faker::Commerce.product_name} can’t #{Faker::Company.bs}" }
reporter
description { "#{Faker::Lorem.paragraph}\n#{Faker::Hacker.say_something_smart}" }
end
end
|
Fix podspec and update version | Pod::Spec.new do |s|
s.name = "HATransparentView"
s.version = "0.3"
s.summary = "UIView transparent subclass based on Rdio stations menu."
s.homepage = "https://github.com/hebertialmeida/HATransparentView"
s.screenshots = "https://raw.github.com/hebertialmeida/HATransparentView/master/H... | Pod::Spec.new do |s|
s.name = "HATransparentView"
s.version = "0.4"
s.summary = "UIView transparent subclass based on Rdio stations menu."
s.homepage = "https://github.com/hebertialmeida/HATransparentView"
s.screenshots = "https://raw.githubusercontent.com/hebertialmeida/HATransparentVi... |
Update ProductStatuses printing for new features. | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
#
# License:: Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
#
# License:: Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... |
Upgrade Lyrics Master.app to v2.4.2 | class LyricsMaster < Cask
version '2.4.1'
sha256 '773cb3996b5f946b506214a0087afebdb7f7350ac17f477cc3f31bedf2a9be0c'
url 'http://www.kenichimaehashi.com/lyricsmaster/download/LyricsMaster2410.dmg'
homepage 'http://www.kenichimaehashi.com/lyricsmaster/'
link 'Lyrics Master'
end
| class LyricsMaster < Cask
version '2.4.2'
sha256 '1cd0f639ea1e557e0abef320ee8ea61877c24bab444cb573bfd41d0887605d7f'
url 'http://www.kenichimaehashi.com/lyricsmaster/download/LyricsMaster2420.dmg'
homepage 'http://www.kenichimaehashi.com/lyricsmaster/'
link 'Lyrics Master'
end
|
Use end_with? instead of regular expression | require "multi_logger/version"
module MultiLogger
class << self
def add_logger(name, path=nil)
name = name.to_s
if path.nil?
path = name.underscore
end
if !path.include?('/')
path = Rails.root.join('log',path).to_s
end
if !path[ /\.log$/ ]
path += '.log... | require "multi_logger/version"
module MultiLogger
class << self
def add_logger(name, path=nil)
name = name.to_s
if path.nil?
path = name.underscore
end
if !path.include?('/')
path = Rails.root.join('log',path).to_s
end
if !path.end_with?('.log')
path +=... |
Set domain to www for now | # This file is used by Rack-based servers to start the application.
require 'rack-rewrite'
DOMAIN = 'aqueousband.net'
# Redirect to the www version of the domain in production
use Rack::Rewrite do
r301 %r{.*}, "http://#{DOMAIN}$&", :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != DOMAIN && ENV['RACK_EN... | # This file is used by Rack-based servers to start the application.
require 'rack-rewrite'
DOMAIN = 'www.aqueousband.net'
# Redirect to the www version of the domain in production
use Rack::Rewrite do
r301 %r{.*}, "http://#{DOMAIN}$&", :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != DOMAIN && ENV['RAC... |
Drop Prometheus metrics_prefix; using label app=runner in PromQL is simpler | $stdout.sync = true
$stderr.sync = true
require 'rack'
use Rack::Deflater, if: ->(_, _, _, body) { body.any? && body[0].length > 512 }
unless ENV['NO_PROMETHEUS']
require 'prometheus/middleware/collector'
require 'prometheus/middleware/exporter'
use(Prometheus::Middleware::Collector, { metrics_prefix:'runner'})... | $stdout.sync = true
$stderr.sync = true
require 'rack'
use Rack::Deflater, if: ->(_, _, _, body) { body.any? && body[0].length > 512 }
unless ENV['NO_PROMETHEUS']
require 'prometheus/middleware/collector'
require 'prometheus/middleware/exporter'
use Prometheus::Middleware::Collector
use Prometheus::Middleware... |
Allow building objects with no attributes | module OBIX
class Builder
attr_reader :objects
# Initialize a new builder.
#
# parent - An Objects::Object instance or derivative thereof describing the parent
# of the object that will be built.
def initialize parent = nil, &block
@parent = parent
@objects = []
... | module OBIX
class Builder
attr_reader :objects
# Initialize a new builder.
#
# parent - An Objects::Object instance or derivative thereof describing the parent
# of the object that will be built.
def initialize parent = nil, &block
@parent = parent
@objects = []
... |
Change mongoid step_definition to match thoughtbot version | Given /^an (.+) exists with an? "([^"]*)" of "([^"]*)"$/ do |model, field, value|
Factory model, field => value
end | Given /^an (.+) exists with an? (.+) of "([^"]*)"$/ do |model, field, value|
Factory model, field => value
end |
Fix test: open .gem file in binary mode | require 'test_helper'
require 'digest'
class GetGemspecTest < TrivialGemServer::TestCase
include Rack::Test::Methods
def test_it_returns_gem
get '/gems/rack-1.5.0.gem'
assert last_response.ok?
assert_equal 'application/octet-stream', content_type
source_file = File.expand_path(
'../../fixtu... | require 'test_helper'
require 'digest'
class GetGemspecTest < TrivialGemServer::TestCase
include Rack::Test::Methods
def test_it_returns_gem
get '/gems/rack-1.5.0.gem'
assert last_response.ok?
assert_equal 'application/octet-stream', content_type
gem_path = File.expand_path(
'../../fixtures... |
Set to display in browser | require 'sinatra'
require 'erb'
require 'twilio-ruby'
get '/' do
erb :root
end
get '/client' do
# build up a response
response = Twilio::TwiML::Response.new do |r|
r.Dial do |d|
d.Client params[:PhoneNumber]
end
end
# print the result
puts response.text
end
def generate_auth(client = ... | require 'sinatra'
require 'erb'
require 'twilio-ruby'
get '/' do
erb :root
end
get '/client' do
# build up a response
response = Twilio::TwiML::Response.new do |r|
r.Dial do |d|
d.Client params[:PhoneNumber]
end
end
# print the result
puts response.text
response.text
end
def generate... |
Change Users api to be more consistent with the new addition of convenors and tutors endpoints. | require 'grape'
module Api
class Users < Grape::API
helpers AuthHelpers
before do
authenticated?
end
desc "Get users"
get '/users' do
#TODO: authorise!
@users = User.all
end
desc "Get user"
get '/user/:id' do
#TODO: authorise!
@user = User.find(params[... | require 'grape'
module Api
class Users < Grape::API
helpers AuthHelpers
before do
authenticated?
end
desc "Get users"
get '/users' do
#TODO: authorise!
@users = User.all
end
desc "Get user"
get '/users/:id' do
#TODO: authorise!
@user = User.find(params... |
Fix test for new data structure | require 'spec_helper'
describe FlowManagersController do
let(:user) { FactoryGirl.create :user, :admin, first_name: "Admin" }
before do
sign_in user
end
describe "GET 'show'" do
subject(:do_request) { get :show }
subject(:do_request_json) { get :show, format: :json }
specify { expect(do_requ... | require 'spec_helper'
describe FlowManagersController do
let(:user) { FactoryGirl.create :user, :admin, first_name: "Admin" }
before do
sign_in user
end
describe "GET 'show'" do
subject(:do_request) { get :show }
subject(:do_request_json) { get :show, format: :json }
specify { expect(do_requ... |
Fix the template of update migration | class UpdateFriendships < ActiveRecord::Migration
def self.up
HasFriendship::Friendship.where(status: 'pending').update_all(status: 0)
HasFriendship::Friendship.where(status: 'requested').update_all(status: 1)
HasFriendship::Friendship.where(status: 'accepted').update_all(status: 2)
HasFriendship::Fri... | class UpdateFriendships < ActiveRecord::Migration
def self.up
add_column :friendships, :status_temp, :integer, index: true
HasFriendship::Friendship.where(status: 'pending').update_all(status_temp: 0)
HasFriendship::Friendship.where(status: 'requested').update_all(status_temp: 1)
HasFriendship::Friend... |
Improve token logic for ENV var | require "rails/engine"
module AhoyEmail
class Engine < ::Rails::Engine
initializer "ahoy_email" do |app|
AhoyEmail.secret_token ||= begin
creds =
if app.respond_to?(:credentials) && app.credentials.secret_key_base
app.credentials
elsif app.respond_to?(:secrets)
... | require "rails/engine"
module AhoyEmail
class Engine < ::Rails::Engine
initializer "ahoy_email" do |app|
AhoyEmail.secret_token ||= begin
creds =
if app.respond_to?(:credentials) && app.credentials.secret_key_base
app.credentials
elsif app.respond_to?(:secrets)
... |
Add coveralls.io stats to gem | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'optioneer'
| $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'coveralls'
Coveralls.wear!
require 'optioneer'
|
Update route file with Comment resource | Livrodaclasse::Application.routes.draw do
get 'entrar', :to => 'sessions#new', :as => :signin
get 'auth/:provider/callback', :to => 'sessions#create'
delete 'sair', :to => 'sessions#destroy', :as => :signout
get 'cadastro', :to => 'users#new', :as => :new_user
get 'apphome', :to => 'books#index', :as => :app... | Livrodaclasse::Application.routes.draw do
get 'entrar', :to => 'sessions#new', :as => :signin
get 'auth/:provider/callback', :to => 'sessions#create'
delete 'sair', :to => 'sessions#destroy', :as => :signout
get 'cadastro', :to => 'users#new', :as => :new_user
get 'apphome', :to => 'books#index', :as => :app... |
Work in non-flat directory structures. No args for all songs. | require 'rubygems'
require 'yaml'
class Marcato
VERSION = '0.0.2'
MARCATO_FILE = ENV['MARCATO_FILE'] || "#{ENV['HOME']}/.marcato"
MARCATO_MUSIC = File.expand_path(ENV['MARCATO_MUSIC'] || '.')
EDITOR = ENV['EDITOR'] || 'vi'
def randomize!
@random = true
end
def edit
`#{EDITOR} #{MARCATO_FILE} < ... | require 'rubygems'
require 'yaml'
class Marcato
VERSION = '0.0.2'
MARCATO_FILE = ENV['MARCATO_FILE'] || "#{ENV['HOME']}/.marcato"
MARCATO_MUSIC = File.expand_path(ENV['MARCATO_MUSIC'] || '.')
EDITOR = ENV['EDITOR'] || 'vi'
def randomize!
@random = true
end
def edit
`#{EDITOR} #{MARCATO_FILE} < ... |
Revert version bump since this is a CI change only | Gem::Specification.new do |s|
s.name = 'hiera-simulator'
s.version = '0.3.0'
s.authors = 'Kevin Paulisse'
s.date = Time.now.strftime('%Y-%m-%d')
s.homepage = 'http://github.com/kpaulisse/hiera-simulator'
s.summary = 'Determine what hiera would output for a set of facts'
s.desc... | Gem::Specification.new do |s|
s.name = 'hiera-simulator'
s.version = '0.2.3'
s.authors = 'Kevin Paulisse'
s.date = Time.now.strftime('%Y-%m-%d')
s.homepage = 'http://github.com/kpaulisse/hiera-simulator'
s.summary = 'Determine what hiera would output for a set of facts'
s.desc... |
Change to remove ruby version check, update formatter to use new api and use double quoted strings | # frozen_string_literal: true
if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
command_name... | # frozen_string_literal: true
if ENV["COVERAGE"] || ENV["TRAVIS"]
require "simplecov"
require "coveralls"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
])
SimpleCov.start do
command_name "spec"
add_filte... |
Remove mysql2 from development dependencies - not needed anymore now. | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
require 'adapter_extensions/version'
Gem::Specification.new do |s|
s.name = %q{adapter_extensions}
s.version = AdapterExtensions::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Anthony Eden", "... | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
require 'adapter_extensions/version'
Gem::Specification.new do |s|
s.name = %q{adapter_extensions}
s.version = AdapterExtensions::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Anthony Eden", "... |
Add .to_h to suppress deprecation warning | class UserSessionsController < ApplicationController
protect_from_forgery :except => [:create]
layout 'main', only: [:new, :create]
def index
redirect_to root_url
end
def new
redirect_to root_url and return if current_user.present?
session[:return_to] = request.referrer
@user_session = Use... | class UserSessionsController < ApplicationController
protect_from_forgery :except => [:create]
layout 'main', only: [:new, :create]
def index
redirect_to root_url
end
def new
redirect_to root_url and return if current_user.present?
session[:return_to] = request.referrer
@user_session = Use... |
Clean this up now that it will only be run once | module VagrantPlugins
module HostsUpdater
module Action
class RemoveHosts < BaseAction
def run(env)
machine_action = env[:machine_action]
if machine_action != :destroy || !@machine.id
if machine_action != :suspend || false != @machine.config.hostsupdater.remove_on_su... | module VagrantPlugins
module HostsUpdater
module Action
class RemoveHosts < BaseAction
def run(env)
machine_action = env[:machine_action]
if [:suspend, :halt].include? machine_action
if @machine.config.hostsupdater.remove_on_suspend == false
@ui.info "[... |
Fix wording on connection error | # Internal: Asynchronsoly downloads urls and returns Array of responses.
require 'eventmachine'
require 'em-http-request'
module HLSpider
module Downloader
class ConnectionError < StandardError; end;
# Internal: Asynchronosly download given URLs.
#
# urls - An Array of strings or a single strin... | # Internal: Asynchronsoly downloads urls and returns Array of responses.
require 'eventmachine'
require 'em-http-request'
module HLSpider
module Downloader
class ConnectionError < StandardError; end;
# Internal: Asynchronosly download given URLs.
#
# urls - An Array of strings or a single strin... |
Change podspec version -> 2.2.1 | Pod::Spec.new do |spec|
spec.name = "Framezilla"
spec.version = "2.2.0"
spec.summary = "Comfortable syntax for working with frames."
spec.homepage = "https://github.com/Otbivnoe/Framezilla"
spec.license = { type: 'MIT', file: 'LICENSE' }
spec.authors ... | Pod::Spec.new do |spec|
spec.name = "Framezilla"
spec.version = "2.2.1"
spec.summary = "Comfortable syntax for working with frames."
spec.homepage = "https://github.com/Otbivnoe/Framezilla"
spec.license = { type: 'MIT', file: 'LICENSE' }
spec.authors ... |
Remove pry-byebug from gemspec since it's not compatible with all rubies | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "rails-footnotes/version"
Gem::Specification.new do |s|
s.name = "rails-footnotes"
s.version = Footnotes::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Roman V. Babenko", "José Valim", "Keenan Brock", "Dua... | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "rails-footnotes/version"
Gem::Specification.new do |s|
s.name = "rails-footnotes"
s.version = Footnotes::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Roman V. Babenko", "José Valim", "Keenan Brock", "Dua... |
Add `secret` column to Settings | # frozen_string_literal: true
#
# Copyright (C) 2022 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
... | |
Add a test for options argument | describe Utusemi::Configuration do
before do
Utusemi.configure do
map :sample do
name :title
end
end
class Product < ActiveRecord::Base; end
end
subject { Product }
it { should respond_to(:utusemi) }
context 'ActiveRecord::Base#utusemi' do
let(:product) { FactoryGirl.bui... | describe Utusemi::Configuration do
let(:product) { FactoryGirl.build(:product) }
before do
Utusemi.configure do
map :sample do |options|
name :title
caption options[:caption] || :none
end
end
class Product < ActiveRecord::Base; end
end
subject { Product }
it { should ... |
Save the default translated values for publicbody entities. | class CreateTranslationTables < ActiveRecord::Migration
def self.up
fields = {:name => :text,
:short_name => :text,
:request_email => :text,
:url_name => :text,
:notes => :text,
:first_letter => :string,
:publication_scheme => :text}
PublicBody.create_translation_table!(f... | class CreateTranslationTables < ActiveRecord::Migration
def self.up
fields = {:name => :text,
:short_name => :text,
:request_email => :text,
:url_name => :text,
:notes => :text,
:first_letter => :string,
:publication_scheme => :text}
PublicBody.create_translation_table!(f... |
Add default for BSD and Solaris to gmake | require 'mkmf'
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
hiredis_dir = File.join(File.dirname(__FILE__), %w{.. .. vendor hiredis})
unless File.directory?(hiredis_dir)
STDERR.puts "vendor/hiredis missing, please checkout its submodule..."
exit 1
end
RbConfig::CONFIG['configure_args'] =~ /with-make-... | require 'mkmf'
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
hiredis_dir = File.join(File.dirname(__FILE__), %w{.. .. vendor hiredis})
unless File.directory?(hiredis_dir)
STDERR.puts "vendor/hiredis missing, please checkout its submodule..."
exit 1
end
RbConfig::CONFIG['configure_args'] =~ /with-make-... |
Modify podspec file to pass lint. |
Pod::Spec.new do |s|
s.name = "GrowthPush"
s.version = "1.1.1"
s.summary = "GrowthPush SDK for iPhone/iPad"
s.description = <<-DESC
GrowthPush is push notification and analysis platform for smart devices.
https://growthpush.com/
... |
Pod::Spec.new do |s|
s.name = "GrowthPush"
s.version = "1.1.1"
s.summary = "GrowthPush SDK for iPhone/iPad"
s.description = <<-DESC
GrowthPush is push notification and analysis platform for smart devices.
https://growthpush.com/
... |
Fix a CarrierWave 0.5.8 problem. | require 'active_support/concern'
require 'carrierwave/mongoid'
require 'media_magick/attachment_uploader'
require 'mongoid'
module MediaMagick
module Model
extend ActiveSupport::Concern
module ClassMethods
def attachs_many(name, options = {}, &block)
klass = Class.new do
include ... | require 'active_support/concern'
require 'carrierwave/mongoid'
require 'media_magick/attachment_uploader'
require 'mongoid'
module CarrierWave
module Uploader
module Url
extend ActiveSupport::Concern
include CarrierWave::Uploader::Configuration
##
# === Returns
#
# [String] t... |
Add module FiveColors for 五色百人一首 | module FiveColors
YELLOW = [2, 7, 10, 18, 32, 33, 37, 39, 46, 47, 55, 60, 78, 79, 81, 85, 87, 89, 94, 96]
PINK = [1, 4, 13, 16, 22, 28, 34, 40, 48, 51, 58, 65, 66, 72, 73, 80, 83, 84, 86, 97]
ORANGE = [19, 21, 25, 27, 43, 44, 45, 49, 52, 53, 56, 63, 64, 67, 77, 88, 90, 95, 98, 99]
BLUE = [3, 5, 6, 12, 14, 2... | |
Support second argument of install command | require 'dcenv'
require 'thor'
module Dcenv
class Cli < Thor
def self.exit_on_failure?
true
end
class_option :help, :type => :boolean, :aliases => '-h', :desc => 'Help message'
desc "install", "Install container"
def install(*args)
name = args[0]
cname = to_cname(name)
... | require 'dcenv'
require 'thor'
module Dcenv
class Cli < Thor
def self.exit_on_failure?
true
end
class_option :help, :type => :boolean, :aliases => '-h', :desc => 'Help message'
desc "install", "Install container"
def install(*args)
if args.length >= 2
cname = to_cname(args[0... |
Fix bug causing Rake task failure when no DB config | module WCC
module RakeHelpers
def self.db_config
@config ||= YAML.load_file("config/database.yml")[ENV['RAILS_ENV'] || 'development'] || {}
end
def self.db_cmd_with_password(cmd, pw)
`#{db_cmd_with_password_string(cmd, pw)}`
end
def self.db_cmd_with_password_string(cmd, pw)
%{... | module WCC
module RakeHelpers
def self.db_config
@config ||= db_config_file_data[ENV['RAILS_ENV'] || 'development'] || {}
end
def self.db_cmd_with_password(cmd, pw)
`#{db_cmd_with_password_string(cmd, pw)}`
end
def self.db_cmd_with_password_string(cmd, pw)
%{PGPASSWORD="#{pw}"... |
Remove debug puts for post-receive. | module CaptainHook
module DSL
class HandlePostReceive
def initialize(post_receive_event)
@post_receive_event = post_receive_event
end
def message
puts "post-receive: #{@post_receive_event.message}"
@post_receive_event.message
end
def ref_name
@... | module CaptainHook
module DSL
class HandlePostReceive
def initialize(post_receive_event)
@post_receive_event = post_receive_event
end
def message
@post_receive_event.message
end
def ref_name
@post_receive_event.ref_name
end
def autho... |
Add license and platform to the gemspec | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'has_breadcrumb/version'
Gem::Specification.new do |gem|
gem.name = "has_breadcrumb"
gem.version = HasBreadcrumb::VERSION
gem.authors = ["Tim Harvey", "Matt Ou... | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'has_breadcrumb/version'
Gem::Specification.new do |gem|
gem.name = "has_breadcrumb"
gem.version = HasBreadcrumb::VERSION
gem.platform = Gem::Platform::RUBY
g... |
Remove unnecessary function of push | require 'json'
module Umakadata
module Logging
class CriteriaLog < Log
attr_writer :result
def initialize
@list = Array.new
@result = nil
end
def push(log)
@list.push log
end
def to_h
logs = Array.new
@list.each { |log|
l... | require 'json'
module Umakadata
module Logging
class CriteriaLog < Log
attr_writer :result
def initialize
@list = Array.new
@result = nil
end
def to_h
logs = Array.new
@list.each { |log|
logs.push log.to_h
}
{:result => @resu... |
Update gem order to be alphabetical | # encoding: utf-8
require File.expand_path('../lib/axiom/version', __FILE__)
Gem::Specification.new do |gem|
gem.name = 'axiom'
gem.version = Axiom::VERSION.dup
gem.authors = ['Dan Kubb']
gem.email = 'dan.kubb@gmail.com'
gem.description = 'Simplifies querying of structured data using re... | # encoding: utf-8
require File.expand_path('../lib/axiom/version', __FILE__)
Gem::Specification.new do |gem|
gem.name = 'axiom'
gem.version = Axiom::VERSION.dup
gem.authors = ['Dan Kubb']
gem.email = 'dan.kubb@gmail.com'
gem.description = 'Simplifies querying of structured data using re... |
Include AV railtie when we're not loading full rails stack | require File.expand_path('../boot', __FILE__)
<% if include_all_railties? -%>
require 'rails/all'
<% else -%>
# Pick the frameworks you want:
<%= comment_if :skip_active_record %>require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
<%= comment_if :skip_sprockets %>require... | require File.expand_path('../boot', __FILE__)
<% if include_all_railties? -%>
require 'rails/all'
<% else -%>
# Pick the frameworks you want:
<%= comment_if :skip_active_record %>require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
<%= commen... |
Upgrade Vagrant Bar.app to v1.14 | cask :v1 => 'vagrant-bar' do
version '1.13'
sha256 '161ad4f4b7acbeaa76352e7a19849dd5275e4b1811caba8b853fa7964812169a'
url "https://github.com/BipSync/VagrantBar/releases/download/#{version}/Vagrant.Bar.zip"
homepage 'https://github.com/BipSync/VagrantBar'
license :oss
app 'Vagrant Bar.app'
end
| cask :v1 => 'vagrant-bar' do
version '1.14'
sha256 '6cf9a2bf9fbe41237a7afa2621d9c1e94ad225e59aa3969b8408b9adbd956334'
url "https://github.com/BipSync/VagrantBar/releases/download/#{version}/Vagrant.Bar.zip"
homepage 'https://github.com/BipSync/VagrantBar'
license :oss
app 'Vagrant Bar.app'
end
|
Fix a double period in an error message | class ApplicationsController < ApplicationController
before_action :set_application, only: [:destroy]
def new
end
def create
@application = Doorkeeper::Application.new(application_params[:doorkeeper_application])
@application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?
... | class ApplicationsController < ApplicationController
before_action :set_application, only: [:destroy]
def new
end
def create
@application = Doorkeeper::Application.new(application_params[:doorkeeper_application])
@application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?
... |
Add test file for CreateComment. | require_relative "../../test_helper"
module Trlo
describe CreateComment do
describe ".for" do
subject { CreateComment.for(card_id) }
it "creates a comment on the card" do
skip("Please write spec.")
end
end
end
end
| |
Remove rake as a dep | # -*- encoding: utf-8 -*-
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
require 'pronto/shellcheck_version'
require 'rake'
Gem::Specification.new do |s|
s.name = 'pronto-shellcheck'
s.version = Pronto::ShellCheckVersion::VERSION
s.platform = Gem::Platform::RUBY
s.authors = 'Paul Alvarez'
s.summary = ... | # -*- encoding: utf-8 -*-
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
require 'pronto/shellcheck_version'
Gem::Specification.new do |s|
s.name = 'pronto-shellcheck'
s.version = Pronto::ShellCheckVersion::VERSION
s.platform = Gem::Platform::RUBY
s.authors = 'Paul Alvarez'
s.summary = <<-EOF
Pron... |
Make sure the Presenters module/namespace is defined. | module SpanishInquisition
def self.load
return if @loaded
Dir[Rails.root.join('app', 'surveys', '*.rb')].each do |file|
ActiveSupport::Dependencies.require_or_load file
end
@loaded = true
end
def self.surveys
load
@surveys ||= {}
end
end
require 'spanish_inquisition/page'
requi... | module SpanishInquisition
def self.load
return if @loaded
Dir[Rails.root.join('app', 'surveys', '*.rb')].each do |file|
ActiveSupport::Dependencies.require_or_load file
end
@loaded = true
end
def self.surveys
load
@surveys ||= {}
end
module Presenters; end
end
require 'spani... |
Convert generator_type to a Symbol. | module SSLyze
class KeyExchange
def initialize(node)
@node = node
end
def a
@a ||= @node['A']
end
def b
@b ||= @node['B']
end
def cofactor
@cofactor ||= @node['Cofactor'].to_i
end
def field_type
@field_type ||= @node['Field_Type']
end
def... | module SSLyze
class KeyExchange
def initialize(node)
@node = node
end
def a
@a ||= @node['A']
end
def b
@b ||= @node['B']
end
def cofactor
@cofactor ||= @node['Cofactor'].to_i
end
def field_type
@field_type ||= @node['Field_Type']
end
def... |
Add basic spec for next_player | require "rails_helper"
RSpec.describe NextPlayer, type: :service do
fixtures :all
let(:find_next_player) { NextPlayer.new(round) }
describe "#call" do
before { find_next_player.call }
context "when bidding has finished" do
let(:round) { rounds(:playing_round) }
it "returns the player who w... | |
Use memory adapter for rom isolation specs | require 'rom-rails'
describe ROM, '.finalize' do
subject(:env) { ROM.finalize.env }
before { ROM.setup(:sql, 'sqlite::memory') }
it 'sets up lazy-env first' do
expect(env).to be_instance_of(ROM::LazyEnv)
end
it 'triggers finalization on relation access' do
relation = Class.new(ROM::Relation[:sql])... | require 'rom-rails'
describe ROM, '.finalize' do
subject(:env) { ROM.finalize.env }
before { ROM.setup(:memory) }
it 'sets up lazy-env first' do
expect(env).to be_instance_of(ROM::LazyEnv)
end
it 'triggers finalization on relation access' do
relation = Class.new(ROM::Relation[:memory]) do
da... |
Add author and change homepage to reflect maintainer change | Gem::Specification.new do |s|
s.name = 'rack-reverse-proxy'
s.version = "0.8.1"
s.authors = ["Jon Swope", "Ian Ehlert", "Roman Ernst"]
s.description = 'A Rack based reverse proxy for basic needs. Useful for testing or in cases where webserver configuration is unavailable.'
s.email ... | Gem::Specification.new do |s|
s.name = 'rack-reverse-proxy'
s.version = "0.8.1"
s.authors = ["Jon Swope", "Ian Ehlert", "Roman Ernst", "Oleksii Fedorov"]
s.description = 'A Rack based reverse proxy for basic needs. Useful for testing or in cases where webserver configuration is unavailab... |
Fix for generation of namespaced model specs | require File.join( File.dirname(__FILE__), <%= go_up(modules.size + 1) %>, "spec_helper" )
describe <%= class_name %> do
it "should have specs"
end | require File.join( File.dirname(__FILE__), <%= go_up(modules.size + 1) %>, "spec_helper" )
describe <%= full_class_name %> do
it "should have specs"
end |
Add rake to development dependencies | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/validate_as_email/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['James Conroy-Finn']
gem.email = ['james@logi.cl']
gem.description = %q{The ultimate Rails 3 email validator}
gem.summary = %q{The ultimate Rails... | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/validate_as_email/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['James Conroy-Finn']
gem.email = ['james@logi.cl']
gem.description = %q{The ultimate Rails 3 email validator}
gem.summary = %q{The ultimate Rails... |
Adjust spec to not modify global state | require "helper"
describe SimpleCov::Configuration do
describe "#tracked_files" do
context "when configured" do
let(:glob) { "{app,lib}/**/*.rb" }
before { SimpleCov.track_files(glob) }
it "returns the configured glob" do
expect(SimpleCov.tracked_files).to eq glob
end
con... | require "helper"
describe SimpleCov::Configuration do
let(:config_class) do
Class.new do
include SimpleCov::Configuration
end
end
let(:config) { config_class.new }
describe "#tracked_files" do
context "when configured" do
let(:glob) { "{app,lib}/**/*.rb" }
before { config.track_f... |
Stop requiring UUIDs in messages to support commands as well as events | module Realm
module Messaging
class MessageType
GENERIC_PROPERTIES = [ :message_type, :version, :timestamp, :uuid ].freeze
def initialize(name, properties = [ ])
@name = name
@properties = GENERIC_PROPERTIES + properties
end
def new_message(attributes)
augmented_a... | module Realm
module Messaging
class MessageType
GENERIC_PROPERTIES = [ :message_type, :version, :timestamp ].freeze
def initialize(name, properties = [ ])
@name = name
@properties = GENERIC_PROPERTIES + properties
end
def new_message(attributes)
augmented_attribut... |
Refactor and removed instance variables | $: << File.dirname(__FILE__)
require 'game_engine'
class ConsoleGameEngine < GameEngine
attr_reader :ui
def initialize(args)
@ttt_board = args.fetch(:ttt_board, nil)
@rules = args.fetch(:rules, nil)
@player_1 = args.fetch(:player_1, nil)
@player_2 = args.fetch(:player_2, nil)
@ui = args.fetch... | $: << File.dirname(__FILE__)
require 'game_engine'
class ConsoleGameEngine < GameEngine
attr_reader :ui
def initialize(args)
super
@ui = args.fetch(:ui, nil)
end
def alternate_move
ui.prompt_user_for_input(ttt_board)
index_position = ui.get_user_input
if @ttt_board.valid_move?(index_posi... |
Use eager_autoload for S3 resource | # frozen_string_literal: true
require 'aws-sdk-resources'
module CarrierWave
module Storage
class AWS < Abstract
def self.connection_cache
@connection_cache ||= {}
end
def self.clear_connection_cache!
@connection_cache = {}
end
def store!(file)
AWSFile.new... | # frozen_string_literal: true
require 'aws-sdk-resources'
Aws.eager_autoload!(services: ['S3'])
module CarrierWave
module Storage
class AWS < Abstract
def self.connection_cache
@connection_cache ||= {}
end
def self.clear_connection_cache!
@connection_cache = {}
end
... |
Fix flakey test that depended on threads | require "rails_helper"
require Rails.root.join("app/models/route")
RSpec.describe RoutesController, type: :controller do
before do
authenticate_as_stub_user
FactoryBot.create(:backend, backend_id: "a-backend")
end
let(:data) do
{
route: {
incoming_path: "/foo/bar", route_type: "prefix"... | require "rails_helper"
require Rails.root.join("app/models/route")
RSpec.describe RoutesController, type: :controller do
before do
authenticate_as_stub_user
FactoryBot.create(:backend, backend_id: "a-backend")
end
let(:data) do
{
route: {
incoming_path: "/foo/bar", route_type: "prefix"... |
Add link to API documentation in gemspec | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'code42/version'
Gem::Specification.new do |gem|
gem.name = "code42"
gem.version = Code42::VERSION
gem.authors = ["Code 42"]
gem.email = ["dev-ruby@c... | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'code42/version'
Gem::Specification.new do |gem|
gem.name = "code42"
gem.version = Code42::VERSION
gem.authors = ["Code 42"]
gem.email = ["dev-ruby@c... |
Add born at postgresql constraint | class AddNotNullContraintIfCompanyEntity < ActiveRecord::Migration
def change
execute "ALTER TABLE entities ADD CONSTRAINT company_born_at_not_null CHECK (( of_company = TRUE AND born_at IS NOT NULL) OR (of_company = FALSE))"
end
end
| |
Remove a funky case statement | include_recipe 'bluepill'
# Boring
package 'nc' do
package_name case node['platform_family']
when 'debian'
'netcat'
else
'nc'
end
end
# This fake services uses Netcat to continuously send the secret
# (attribute) to the tcp_server_listen... | include_recipe 'bluepill::default'
# Boring
package 'nc' do
package_name node['platform_family'] == 'debian' ? 'netcat' : 'nc'
end
# This fake services uses Netcat to continuously send the secret
# (attribute) to the tcp_server_listen_port, which we bind in the test
template ::File.join(node['bluepill']['conf_dir'... |
Add basic disk config unit tests | require File.expand_path("../../../../base", __FILE__)
require Vagrant.source_root.join("plugins/kernel_v2/config/disk")
describe VagrantPlugins::Kernel_V2::VagrantConfigDisk do
include_context "unit"
let(:type) { :disk }
subject { described_class.new(type) }
let(:machine) { double("machine") }
def asse... | |
Update aruba timeout to use config block | require 'aruba/cucumber'
Before do
# Force ids to be printed unquoted for consistency
set_environment_variable('SHELL', '/usr/bin/bash')
if RUBY_PLATFORM =~ /java/ || defined?(Rubinius)
@aruba_timeout_seconds = 120
else
@aruba_timeout_seconds = 10
end
end
Aruba.configure do |config|
config.before... | require 'aruba/cucumber'
Before do
# Force ids to be printed unquoted for consistency
set_environment_variable('SHELL', '/usr/bin/bash')
end
Aruba.configure do |config|
config.exit_timeout = if RUBY_PLATFORM =~ /java/ || defined?(Rubinius) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'truffleruby')
120
els... |
Move shims up in file hierarchy. | require File.dirname(__FILE__) + '/../../../../helpers/test_case'
# Declare the ROOT_DIR constant before adding galena/lib to the Ruby path.
module Galena
# The Galena example root directory.
ROOT_DIR = File.expand_path('galena', File.dirname(__FILE__) + '/../../../../../../examples')
module TestCase
inclu... | require File.dirname(__FILE__) + '/../../../../helpers/test_case'
# Declare the ROOT_DIR constant before adding galena/lib to the Ruby path.
module Galena
# The Galena example root directory.
ROOT_DIR = File.expand_path('galena', File.dirname(__FILE__) + '/../../../../../../examples')
module TestCase
inclu... |
Fix for missing file on first converge | name "rackspacecloud"
maintainer "Ryan Walker"
maintainer_email "ryan.walker@rackspace.com"
license "Apache 2.0"
description "Provides LWRP's for managing Rackspace Cloud resources."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.3"
depends "xml"
| name "rackspacecloud"
maintainer "Ryan Walker"
maintainer_email "ryan.walker@rackspace.com"
license "Apache 2.0"
description "Provides LWRP's for managing Rackspace Cloud resources."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.4"
depends "xml"
|
Change sql statement to use rails helpers. | #
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | #
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
Revert "Removed `EasyNotificationBadge` from podspec dependency." | Pod::Spec.new do |s|
s.name = "AZTabBar"
s.version = "1.4.2"
s.summary = "A custom tab bar controller for iOS written in Swift 3.0"
s.homepage = "https://github.com/Minitour/AZTabBarController"
s.license = "MIT"
s.author = { "Antonio Zaitoun" => "tony.z.1711@gmail.com" }
s... | Pod::Spec.new do |s|
s.name = "AZTabBar"
s.version = "1.4.2"
s.summary = "A custom tab bar controller for iOS written in Swift 3.0"
s.homepage = "https://github.com/Minitour/AZTabBarController"
s.license = "MIT"
s.author = { "Antonio Zaitoun" => "tony.z.1711@gmail.com" }
s... |
Fix a critical bug on Array ex class. | #
# Array クラス拡張メソッド
#
class Array
def to_v
if size == 0
Vec::new 0.0, 0.0, 0.0
else
x = 0.0, y = 0.0, z = 0.0
if size > 0 then x = self[0].to_f end
if size > 1 then y = self[1].to_f end
if size > 2 then z = self[2].to_f end
Vec::new x, y, z
end
end
def trans(t)
... | #
# Array クラス拡張メソッド
#
class Array
def to_v
if size == 0
Vec::zero
else
Vec::new self.x, self.y, self.z
end
end
def trans(t)
t.move_point self
end
def trans!(t)
r = t.move_point self
x = r.x, y = r.y, z = r.z
end
def x
val = (self[0] ||= 0.0)
val.is_a?(Float)... |
Use aruba helpers instead of nested steps. | Then /^the output should say the file "([^"]*)" was created$/ do |file|
step %{Then "the output should match /create(.+)#{file}/"}
end
Then /^the file "([^"]*)" should contain a copyright notice for "([^"]*)"$/ do |file, name|
year = Time.now.year
step %{Then "the file \"#{file}\" should contain \"Copyright (c) ... | Then /^the output should say the file "([^"]*)" was created$/ do |file|
steps %{Then "the output should match /create(.+)#{file}/"}
end
Then /^the file "([^"]*)" should contain a copyright notice for "([^"]*)"$/ do |file, name|
content = "Copyright (c) #{Time.now.year}, #{name}"
check_file_content(file, content,... |
Add a recipe for CGI feature | #
# Author:: Richard Downer (<richard.downer@cloudsoftcorp.com>)
# Cookbook Name:: iis
# Recipe:: mod_cgi
#
# Copyright 2013, Cloudsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Licens... | |
Revert "[QAE1019] Fixed disabled submission conditions" | module FormHelper
def possible_read_only_ops(submission=nil)
ops = {}
if admin_in_read_only_mode? || (submission && !current_user.account_admin?) || submission_ended?
ops[:disabled] = "disabled"
ops[:class] = "read-only"
end
ops
end
def next_step(form, step)
return unless step
... | module FormHelper
def possible_read_only_ops
ops = {}
if admin_in_read_only_mode? || submission_ended?
ops[:disabled] = "disabled"
ops[:class] = "read-only"
end
ops
end
def next_step(form, step)
return unless step
steps = form.steps
steps.map! { |s| s.title.parameterize... |
Comment about connector provider export by name | module Carto
module ConnectorConfigurationImporter
private
def build_connector_configurations_from_hash(exported_ccs)
return [] unless ccs
ccs.map.map { |cc| build_connector_configuration_from_hash(cc) }.compact
end
def build_connector_configuration_from_hash(exported_cc)
provider... | module Carto
# Note: Connector provider IDs are not kept between clouds, so we look them up by name
module ConnectorConfigurationImporter
private
def build_connector_configurations_from_hash(exported_ccs)
return [] unless ccs
ccs.map.map { |cc| build_connector_configuration_from_hash(cc) }.com... |
Add path helper for extracting relative path | # encoding: utf-8
# frozen_string_literal: true
module TTY
module PathHelpers
# The root path of the app running this command
#
# @return [Pathname]
#
# @api public
def root_path
@root_path ||= Pathname.pwd
end
# Execute command within root path
#
# @api public
def ... | # encoding: utf-8
# frozen_string_literal: true
module TTY
module PathHelpers
# The root path of the app running this command
#
# @return [Pathname]
#
# @api public
def root_path
@root_path ||= Pathname.pwd
end
# Execute command within root path
#
# @api public
def ... |
Set AS::TestCase::Assertion to the underlying test exception for either miniunit or test/unit | require 'active_support/testing/setup_and_teardown'
require 'active_support/testing/assertions'
require 'active_support/testing/declarative'
module ActiveSupport
# Prefer MiniTest with Test::Unit compatibility.
begin
require 'minitest/unit'
# Hack around the test/unit autorun.
autorun_enabled = MiniTe... | require 'active_support/testing/setup_and_teardown'
require 'active_support/testing/assertions'
require 'active_support/testing/declarative'
module ActiveSupport
# Prefer MiniTest with Test::Unit compatibility.
begin
require 'minitest/unit'
# Hack around the test/unit autorun.
autorun_enabled = MiniTe... |
Use a different table for deleted tweets, but the same model. | class DeletedTweet < ActiveRecord::Base
belongs_to :politician
default_scope :order => 'modified DESC'
cattr_reader :per_page
@@per_page = 10
def details
JSON.parse(tweet)
end
def format
{
:created_at => created,
:updated_at => modified,
:id => id.to_s,
:politicia... | class DeletedTweet < Tweet
set_table_name "deleted_tweets"
end
|
Add default message for UI.term | module Nehm
module UI
def self.error(message)
puts "#{message}\n".red
end
def self.newline
puts "\n"
end
def self.say(message)
puts message
end
def self.success(message)
puts message.green
end
def self.term(message)
if message
abort message... | module Nehm
module UI
def self.error(message)
puts "#{message}\n".red
end
def self.newline
puts "\n"
end
def self.say(message)
puts message
end
def self.success(message)
puts message.green
end
def self.term(message = nil)
if message
abort m... |
Add homepage url to gemspec | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "bitvector"
Gem::Specification.new do |spec|
spec.name = "bitvector"
spec.version = BitVector::VERSION
spec.authors = ["Juan Azambuja"]
spec.email = ["juan@wye... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "bitvector"
Gem::Specification.new do |spec|
spec.name = "bitvector"
spec.version = BitVector::VERSION
spec.authors = ["Juan Azambuja"]
spec.email = ["juan@wye... |
Remove one level of indentation | require "middleman-core"
class Disqus < ::Middleman::Extension
option :shortname, false, "Your short name for Disqus"
def initialize(app, options_hash={}, &block)
super
app.set :disqus_shortname, options.shortname
end
helpers do
def disqus
if disqus_shortname
%Q{
... | require "middleman-core"
class Disqus < ::Middleman::Extension
option :shortname, false, "Your short name for Disqus"
def initialize(app, options_hash={}, &block)
super
app.set :disqus_shortname, options.shortname
end
helpers do
def disqus
return '' unless disqus_shortname
%Q... |
Make sure there's a redis url before leveraging iodine workers | require 'plezi/websockets/message_dispatch' unless defined?(::Plezi::Base::MessageDispatch)
module Plezi
protected
@plezi_finalize = nil
def plezi_finalize
if @plezi_finalize.nil?
@plezi_finalize = true
@plezi_finalize = 1
end
end
@plezi_initialize = nil
def self.plezi_initializ... | require 'plezi/websockets/message_dispatch' unless defined?(::Plezi::Base::MessageDispatch)
module Plezi
protected
@plezi_finalize = nil
def plezi_finalize
if @plezi_finalize.nil?
@plezi_finalize = true
@plezi_finalize = 1
end
end
@plezi_initialize = nil
def self.plezi_initializ... |
Add Repository model to proxy request to Gitlab::Git::Repositoty and decorate commits with Commit model | class Repository
attr_accessor :raw_repository
def initialize(path_with_namespace, default_branch)
@raw_repository = Gitlab::Git::Repository.new(path_with_namespace, default_branch)
end
def commit(id = nil)
commit = raw_repository.commit(id)
commit = Commit.new(commit) if commit
commit
end
... | |
Revert "force mailer lang ja" | # frozen_string_literal: true
class UserMailer < Devise::Mailer
default from: ENV.fetch('SMTP_FROM_ADDRESS') { 'notifications@localhost' }
layout 'mailer'
def confirmation_instructions(user, token, _opts = {})
@resource = user
@token = token
@instance = Rails.configuration.x.local_domain
# I... | # frozen_string_literal: true
class UserMailer < Devise::Mailer
default from: ENV.fetch('SMTP_FROM_ADDRESS') { 'notifications@localhost' }
layout 'mailer'
def confirmation_instructions(user, token, _opts = {})
@resource = user
@token = token
@instance = Rails.configuration.x.local_domain
I18... |
Revert "Add sopa blackout redirection." | Foosball::Application.routes.draw do
match '/' => redirect("http://protestsopa.org")
match '*players' => redirect("http://protestsopa.org")
match '*bagels' => redirect("http://protestsopa.org")
get 'players/all' => 'players#all'
resources :bagels
resources :players do
collection do
get 'names'
... | Foosball::Application.routes.draw do
get 'players/all' => 'players#all'
resources :bagels
resources :players do
collection do
get 'names'
post 'names'
end
end
root :to => 'bagels#home'
get 'sign_in' => 'sign_in#index'
post 'sign_in' => 'sign_in#create'
end |
Update gem description and summary | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'phare/version'
Gem::Specification.new do |spec|
spec.name = 'phare'
spec.version = Phare::VERSION
spec.authors = ['Rémi Prévost']
spec.email = ['remi@exomel.c... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'phare/version'
Gem::Specification.new do |spec|
spec.name = 'phare'
spec.version = Phare::VERSION
spec.authors = ['Rémi Prévost']
spec.email = ['remi@exomel.c... |
Add TODO to solve participant authorization | # -*- encoding : utf-8 -*-
class Jmd::ParticipantsController < Jmd::BaseController
load_and_authorize_resource :competition
load_and_authorize_resource :participant, through: :competition
def index
# @competition and @participants are fetched by CanCan
@participants = @participants.includes(:country).or... | # -*- encoding : utf-8 -*-
class Jmd::ParticipantsController < Jmd::BaseController
load_and_authorize_resource :competition
load_and_authorize_resource :participant, through: :competition
def index
# @competition and @participants are fetched by CanCan
# TODO: Why doesn't authorization work although com... |
Fix to avoid calling db:test:prepare | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use!
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
include Applicati... | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use!
ActiveRecord::Migration.maintain_test_schema! if defined?(ActiveRecord::Migration)
class ActiveSupport::TestCase
# Setup all fixtures in test/fixt... |
Refactor server processing a little bit | require 'socket'
require 'debugger'
class Hyperloop
def initialize port
@server = TCPServer.new port
end
def start
loop do
socket = @server.accept
data = socket.readpartial 1024
puts data
socket.write "HTTP/1.1 200 OK\r\n"
socket.write "\r\n"
socket.write "w00t\n"
... | require 'socket'
require 'debugger'
class Hyperloop
def initialize port
@server = TCPServer.new port
end
def start
loop do
@socket = @server.accept
read_data_from_socket
send_response
close_socket
end
end
def read_data_from_socket
data = @socket.readpartial 1024
... |
Fix logic to not empty $api_sections hash | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :set_locale, :set_section
def set_locale
I18n.locale = params["locale"] || APP_OPTS["language_default"] || "en"
end
def default_url_options
params["locale"] ? { locale: I18n.locale } : {}
end
... | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :set_locale, :set_section
def set_locale
I18n.locale = params["locale"] || APP_OPTS["language_default"] || "en"
end
def default_url_options
params["locale"] ? { locale: I18n.locale } : {}
end
... |
Use logger to output debugging info | 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 :authenticate_admin!
# Don't use SSL for the TrackingController and only in production
force_ssl :... | 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 :authenticate_admin!
# Don't use SSL for the TrackingController and only in production
force_ssl :... |
Use hybrid cookie serializer until everyone's cookies are JSON | # Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json
| # Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :hybrid
|
Move the hutch connection out of message bus initializer | require "hutch"
module Streamy
module MessageBuses
class RabbitMessageBus
def initialize(uri:, topic_prefix: Streamy::DEFAULT_TOPIC_PREFIX)
@topic_prefix = topic_prefix
Hutch::Config.set(:uri, uri)
Hutch::Config.set(:enable_http_api_use, false)
Hutch.connect
end
... | require "hutch"
module Streamy
module MessageBuses
class RabbitMessageBus
def initialize(uri:, topic_prefix: Streamy::DEFAULT_TOPIC_PREFIX)
@topic_prefix = topic_prefix
Hutch::Config.set(:uri, uri)
Hutch::Config.set(:enable_http_api_use, false)
end
def deliver(*args)
... |
Use GET for asking for the new artefact form | module NeedsHelper
def start_work_link need
start_work = "http://#{Plek.current.panopticon}/artefacts/new"
form_tag start_work, :html => { :method => 'get' } do
[
hidden_field_tag("artefact[need_id]", need.id).html_safe,
hidden_field_tag("artefact[kind]", need.kind.to_s.downcase).html_s... | module NeedsHelper
def start_work_link need
start_work = "http://#{Plek.current.panopticon}/artefacts/new"
form_tag start_work, :method => 'get' do
[
hidden_field_tag("artefact[need_id]", need.id).html_safe,
hidden_field_tag("artefact[kind]", need.kind.to_s.downcase).html_safe,
... |
Upgrade IntelliJ Idea CE with bundled JDK to 14.1 | cask :v1 => 'intellij-idea-ce-bundled-jdk' do
version '14'
sha256 '09bb078252e2f6af6b58605ad3a380a71c8cc53f8e697e31fe03fcadb2152b07'
url "http://download.jetbrains.com/idea/ideaIC-#{version}-jdk-bundled.dmg"
homepage 'https://www.jetbrains.com/idea/'
license :oss
app "IntelliJ IDEA #{version} CE.app"
... | cask :v1 => 'intellij-idea-ce-bundled-jdk' do
version '14.1'
sha256 '62c8b150ff82c31f2b6355a6f43b8ef69913b8f387cef6ddb4659622abb59a52'
url "https://download.jetbrains.com/idea/ideaIC-#{version}-custom-jdk-bundled.dmg"
name 'IntelliJ IDEA'
homepage 'https://www.jetbrains.com/idea/'
license :apache
app 'I... |
Move allowed_push_host in gemspec to all other metadata. | $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
require 'semian/version'
require 'semian/platform'
Gem::Specification.new do |s|
s.name = 'semian'
s.version = Semian::VERSION
s.summary = 'Bulkheading for Ruby with SysV semaphores'
s.description = <<-DOC
A Ruby C extention that is used to control a... | $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
require 'semian/version'
require 'semian/platform'
Gem::Specification.new do |s|
s.name = 'semian'
s.version = Semian::VERSION
s.summary = 'Bulkheading for Ruby with SysV semaphores'
s.description = <<-DOC
A Ruby C extention that is used to control a... |
Fix specs for forever alone | require 'spec_helper'
describe Achievement::ForeverAlone do
it_should_behave_like "achievement"
let(:user) { Fabricate :user}
describe "check" do
it "should call github and check there if positive" do
Github.should_receive(:forever_alone?).and_return false
described_class.check(user).should be_f... | require 'spec_helper'
describe Achievement::ForeverAlone do
it_should_behave_like "achievement"
end
|
Fix the tests for eip_asker | describe Opsicle::QuestionAsker::EipAsker do
let(:cli) do
double(:cli,
ask: 1
)
end
let(:instance) do
double(:instance,
elastic_ip: "example-hostname",
auto_scaling_type: ["type1", "type2"],
status: "online",
hostname: "example"
)
end
let(:opsworks_adapter) do
... | describe Opsicle::QuestionAsker::EipAsker do
let(:cli) do
double(:cli,
ask: 1
)
end
let(:instance) do
double(:instance,
elastic_ip: nil,
auto_scaling_type: nil,
status: "online",
hostname: "example",
instance_id: "instance-id"
)
end
let(:client) do
dou... |
Fix bug with TestResponse override outside Rails | module ActionController
module TestResponseStringOverride
def to_s
status, headers, body = to_a
body = ''.tap { |out| body.each { |s| out << s } }
"#<#{self.class.name} #{request.method} #{request.fullpath} => " \
"[#{status}, #{body.inspect}, #{headers.inspect}]>"
end
def inspe... | module ActionController
module TestResponseStringOverride
def to_s
status, headers, body = to_a
body = ''.tap { |out| body.each { |s| out << s } }
"#<#{self.class.name} #{request.method} #{request.fullpath} => " \
"[#{status}, #{body.inspect}, #{headers.inspect}]>"
end
def inspe... |
Add missing requirements in Response. | module Regaliator
class Response
attr_reader :success
attr_reader :data
def initialize(http_response)
@success = http_response.kind_of?(Net::HTTPSuccess)
@data = begin
JSON::parse(http_response.body)
rescue
{message: 'Server returned a non-json er... | require 'json'
require 'net/http'
module Regaliator
class Response
attr_reader :success
attr_reader :data
def initialize(http_response)
@success = http_response.kind_of?(Net::HTTPSuccess)
@data = begin
JSON::parse(http_response.body)
rescue
{mess... |
Put smtp connection login in separate function | require 'net/smtp'
module Smitty
def self.smtp_connect(server, port, ssl, username, password)
begin
smtp_server = server.nil? ? 'localhost' : server
smtp_port = port.nil? ? 25 : port.to_i
smtp_conn = Net::SMTP.new(smtp_server, smtp_port)
smtp_conn.enable_tls() if ssl
if username
... | |
Drop sass-rails dependency, so sites can use sassc-rails or sass-rails. | $:.push File.expand_path('../lib', __FILE__)
require 'effective_orders/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'effective_orders'
s.version = EffectiveOrders::VERSION
s.authors = ['Code and Effect']
s.email = ['info@codeandeffect.c... | $:.push File.expand_path('../lib', __FILE__)
require 'effective_orders/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'effective_orders'
s.version = EffectiveOrders::VERSION
s.authors = ['Code and Effect']
s.email = ['info@codeandeffect.c... |
Reset scope before calling deleted finder | module Immortal
module SingularAssociation
def with_deleted_reader(force_reload = false)
deleted_reader('with', force_reload)
end
def only_deleted_reader(force_reload = false)
deleted_reader('only', force_reload)
end
private
def deleted_reader(how, force_reload = false)
... | module Immortal
module SingularAssociation
def with_deleted_reader(force_reload = false)
deleted_reader('with', force_reload)
end
def only_deleted_reader(force_reload = false)
deleted_reader('only', force_reload)
end
private
def deleted_reader(how, force_reload = false)
... |
Load the new table importers | module Intercode::Import::Intercode1::Tables
extend ActiveSupport::Autoload
autoload :Away
autoload :BidInfo
autoload :Bids
autoload :BidTimes
autoload :Bios
autoload :Con
autoload :Events
autoload :GMs, 'intercode/import/intercode1/tables/gms'
autoload :PriceSchedule
autoload :Runs
autoload :R... | module Intercode::Import::Intercode1::Tables
extend ActiveSupport::Autoload
autoload :Away
autoload :BidInfo
autoload :Bids
autoload :BidTimes
autoload :Bios
autoload :Con
autoload :Events
autoload :GMs, 'intercode/import/intercode1/tables/gms'
autoload :PreConEvents
autoload :PreConRuns
autolo... |
Revert a faulty bug fix | module ShippingMaterials
module Sortable
attr_accessor :sorters
# DSL method
def sort(context=:objects, &block)
@sorters ||= {}
@sorters[context] = Sorter.new
@sorters[context].rule(&block)
end
# Perform the sort
def sort!
@sorters.each do |context, sorter|
if... | module ShippingMaterials
module Sortable
attr_accessor :sorters
# DSL method
def sort(context=:objects, &block)
@sorters ||= {}
@sorters[context] = Sorter.new
@sorters[context].instance_eval(&block)
end
# Perform the sort
def sort!
@sorters.each do |context, sorter|
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.