Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Use with_deleted instead of unscoped | require "active_support/concern"
module RailsSoftDeletable
module Associations
extend ActiveSupport::Concern
included do
def target_scope
return if options[:polymorphic] && klass.nil?
if options[:with_deleted] && klass.soft_deletable?
klass.unscoped
else
kl... | require "active_support/concern"
module RailsSoftDeletable
module Associations
extend ActiveSupport::Concern
included do
def target_scope
return if options[:polymorphic] && klass.nil?
if options[:with_deleted] && klass.soft_deletable?
klass.with_deleted
else
... |
Package version is increased from 2.3.1.2 to 2.3.1.1 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-schema'
s.summary = "Primitives for schema and data structure"
s.version = '2.3.1.2'
s.description = ' '
s.authors = ['The Eventide Project']
s.email = 'opensource@eventide-project.org'
s.homepage = 'https://github.com/eventide-project... | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-schema'
s.summary = "Primitives for schema and data structure"
s.version = '2.3.1.1'
s.description = ' '
s.authors = ['The Eventide Project']
s.email = 'opensource@eventide-project.org'
s.homepage = 'https://github.com/eventide-project... |
Allow Interface.define to accept fields | module GraphQL
# An Interface contains a collection of types which implement some of the same fields.
#
# Interfaces can have fields, defined with `field`, just like an object type.
#
# Objects which implement this field _inherit_ field definitions from the interface.
# An object type can override the inher... | module GraphQL
# An Interface contains a collection of types which implement some of the same fields.
#
# Interfaces can have fields, defined with `field`, just like an object type.
#
# Objects which implement this field _inherit_ field definitions from the interface.
# An object type can override the inher... |
Change minitest require into minitest/spec | require 'minitest'
module Rohbau
module ItBehavesLike
def get_shared_example(spec)
shared_specs_namespace::SharedSpec.get(spec)
end
def it_behaves_like(spec)
shared_example = get_shared_example(spec)
raise "No shared spec for #{spec.inspect} found" unless shared_example
instanc... | require 'minitest/spec'
module Rohbau
module ItBehavesLike
def get_shared_example(spec)
shared_specs_namespace::SharedSpec.get(spec)
end
def it_behaves_like(spec)
shared_example = get_shared_example(spec)
raise "No shared spec for #{spec.inspect} found" unless shared_example
in... |
Add simple get integration spec | describe "snmpjr" do
describe 'GET' do
it "can perform a simple synchronous get request on an snmp agent" do
snmp = Snmpjr.new(:host => 'demo.snmplabs.com', :port => 161, :community => 'public')
expect(snmp.get '1.3.6.1.2.1.1.1.0').to eq 'SunOS zeus.snmplabs.com 4.1.3_U1 1 sun4m'
end
end
end
| |
Change success message. Add 'elapsed time' stdout | require 'time'
module SrtShifter
class Subtitle
def initialize(options)
@opts = options
end
def shift
output_file = File.open(@opts[:output], 'w')
lines = IO.readlines(@opts[:input])
lines.each do |line|
time_match = line.scan(/(\d{2}:\d{2}:\d{2},\d{3}) --\> (\d{2}:\d{2}:\d{2},\d{3})/)
... | require 'time'
module SrtShifter
class Subtitle
def initialize(options)
@opts = options
end
def shift
start_time = Time.now
output_file = File.open(@opts[:output], 'w')
lines = IO.readlines(@opts[:input])
lines.each do |line|
time_match = line.scan(/(\d{2}:\d{2}:\d{2},\d{3}) --\> (\d... |
Change redirect port to avoid Vault's cluster default. | require 'webrick'
require 'uri'
module RSpec
class RedirectServer < WEBrick::HTTPServlet::AbstractServlet
def service(req, res)
res['Location'] = URI.join(VaultServer.address, req.path)
raise WEBrick::HTTPStatus[307]
end
def self.address
'http://127.0.0.1:8201/'
end
def self.s... | require 'webrick'
require 'uri'
module RSpec
class RedirectServer < WEBrick::HTTPServlet::AbstractServlet
def service(req, res)
res['Location'] = URI.join(VaultServer.address, req.path)
raise WEBrick::HTTPStatus[307]
end
def self.address
'http://127.0.0.1:8202/'
end
def self.s... |
Add trivial benchmarks to gauge cost of logging | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'benchmark'
require 'analytics'
require 'thwait'
raise "No Analytics Key Provided" unless ENV['GA_TRACKING_ID']
# configure analytics
Analytics.configure ENV['GA_TRACKING_ID'], "BenchmarkTest"
reps = [1, 10, 100, 1000]
Benchmark.bm do |bm|
... | |
Allow passing controllers to ignore | require "rails/railtie"
require "lograge"
require "json_log_format"
module BetterLogging
class Railtie < Rails::Railtie
config.better_logging = ActiveSupport::OrderedOptions.new
config.better_logging.enabled = ENV["BETTER_LOGGING"].present?
if config.better_logging.enabled
require "rails_12factor"
... | require "rails/railtie"
require "lograge"
require "json_log_format"
module BetterLogging
class Railtie < Rails::Railtie
config.better_logging = ActiveSupport::OrderedOptions.new
config.better_logging.enabled = ENV["BETTER_LOGGING"].present?
config.better_logging.ignore_controllers = []
if config.bett... |
Use send to call define_method | require 'active_support/core_ext/hash/slice'
module Figurine
class Collaborator < ActiveSupport::BasicObject
extend ActiveModel::Naming
include ActiveModel::Conversion
def initialize(given, whitelist)
attributes = if given.respond_to?(:to_hash)
given.to_hash
elsif given.respond_to?(:... | require 'active_support/core_ext/hash/slice'
module Figurine
class Collaborator < ActiveSupport::BasicObject
extend ActiveModel::Naming
include ActiveModel::Conversion
def initialize(given, whitelist)
attributes = if given.respond_to?(:to_hash)
given.to_hash
elsif given.respond_to?(:... |
Add bosh_cli gem to gemspec | # coding: utf-8
Gem::Specification.new do |spec|
spec.name = "bosh_deployment_resource"
spec.version = "0.0.1"
spec.summary = "a gem for things"
spec.authors = ["Chris Brown", "Alex Suraci"]
spec.files = Dir.glob("{lib,bin}/**/*")
spec.executables = spec.files.grep(%r{... | # coding: utf-8
Gem::Specification.new do |spec|
spec.name = "bosh_deployment_resource"
spec.version = "0.0.1"
spec.summary = "a gem for things"
spec.authors = ["Chris Brown", "Alex Suraci"]
spec.files = Dir.glob("{lib,bin}/**/*")
spec.executables = spec.files.grep(%r{... |
Add the test suite for the Welcome Controller. | require 'rails_helper'
describe WelcomeController do
let(:user) { FactoryGirl.create(:user) }
context "user is not signed in" do
describe "GET index" do
it "should redirect the user to login_path" do
get (:index)
expect(response).to redirect_to(login_path)
end
end
end
cont... | |
Add rspec as a dev dependency | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'tinyforth/version'
Gem::Specification.new do |spec|
spec.name = "tinyforth"
spec.version = Tinyforth::VERSION
spec.authors = ["Jonathan Jackson"]
spec.email =... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'tinyforth/version'
Gem::Specification.new do |spec|
spec.name = "tinyforth"
spec.version = Tinyforth::VERSION
spec.authors = ["Jonathan Jackson"]
spec.email =... |
Use unique index in upgrade migration, too | class UnreadPolymorphicReaderMigration < ActiveRecord::Migration
def self.up
remove_index :read_marks, [:user_id, :readable_type, :readable_id]
rename_column :read_marks, :user_id, :reader_id
add_column :read_marks, :reader_type, :string
execute "update read_marks set reader_type = 'User'"
add_ind... | class UnreadPolymorphicReaderMigration < ActiveRecord::Migration
def self.up
remove_index :read_marks, [:user_id, :readable_type, :readable_id]
rename_column :read_marks, :user_id, :reader_id
add_column :read_marks, :reader_type, :string
execute "update read_marks set reader_type = 'User'"
add_ind... |
Add First Tests for Rejector Class | require 'spec_helper'
describe Rack::Rejector do
it 'has a version number' do
expect(Rack::Rejector::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
end
end
| require 'spec_helper'
require 'rack'
describe Rack::Rejector do
let(:app) { ->(_env) { [200, {}, ['OK']] } }
it 'does not reject if the block is false' do
rejector = described_class.new(app) do |_request, _opts|
false
end
request = Rack::MockRequest.new(rejector)
response = request.post('som... |
Rename gem to not conflict with an existing gem | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'mail/logger/version'
Gem::Specification.new do |spec|
spec.name = "email_logger"
spec.version = Mail::Logger::VERSION
spec.authors = ["Josh McArthur"]
spec.email ... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'mail/logger/version'
Gem::Specification.new do |spec|
spec.name = "mail-logger"
spec.version = Mail::Logger::VERSION
spec.authors = ["Josh McArthur"]
spec.email ... |
Add return true to make clear the callback chain will never halt when using this in before_save instead of before_validation. | module ActiveRecord
module DatabaseValidations
module StringTruncator
extend ActiveSupport::Concern
module ClassMethods
def truncate_string(field)
column = self.columns_hash[field.to_s]
case column.type
when :string
lambda do
return unle... | module ActiveRecord
module DatabaseValidations
module StringTruncator
extend ActiveSupport::Concern
module ClassMethods
def truncate_string(field)
column = self.columns_hash[field.to_s]
case column.type
when :string
lambda do
return unle... |
Correct menu hook for Spree v3.0.0.beta | Deface::Override.new(virtual_path: 'spree/admin/shared/_configuration_menu',
name: 'print_invoice_admin_configurations_menu',
insert_bottom: '[data-hook="admin_configurations_sidebar_menu"], #admin_configurations_sidebar_menu[data-hook]',
text: ... | Deface::Override.new(virtual_path: 'spree/admin/shared/sub_menu/_configuration',
name: 'print_invoice_admin_configurations_menu',
insert_bottom: '[data-hook="admin_configurations_sidebar_menu"]',
text: '<%= configurations_sidebar_menu_ite... |
Make checking completed box work. | class CardOverlay < Page
path :paper_task
def dismiss
all('a').detect { |a| a.text == 'CLOSE' }.click
end
def assignee
all('.chosen-assignee.chosen-container').first.text
end
def assignee=(name)
select_from_chosen name, class: 'chosen-assignee'
end
def title
find('main > h1').text
... | class CardOverlay < Page
path :paper_task
def dismiss
all('a').detect { |a| a.text == 'CLOSE' }.click
end
def assignee
all('.chosen-assignee.chosen-container').first.text
end
def assignee=(name)
select_from_chosen name, class: 'chosen-assignee'
end
def title
find('main > h1').text
... |
Update gemspec due to some aesthetic changes in implementation | Gem::Specification.new do |s|
s.name = 'msfl_visitors'
s.version = '1.2.1'
s.date = '2015-07-06'
s.summary = "Convert MSFL to other forms"
s.description = "Visitor pattern approach to converting MSFL to other forms."
s.authors = ["Courtland Caldwell"]
s.email = 'courtland@m... | Gem::Specification.new do |s|
s.name = 'msfl_visitors'
s.version = '1.2.2'
s.date = '2015-07-06'
s.summary = "Convert MSFL to other forms"
s.description = "Visitor pattern approach to converting MSFL to other forms."
s.authors = ["Courtland Caldwell"]
s.email = 'courtland@m... |
Add a bench for 64bit integer parameters | require File.expand_path(File.join(File.dirname(__FILE__), "bench_helper"))
module LibTest
extend FFI::Library
ffi_lib LIBTEST_PATH
attach_function :bench_s64s64s64_v, [ :long_long, :long_long, :long_long ], :void
end
puts "Benchmark [ :long_long, :long_long, :long_long ], :void performance, #{ITER}x calls"
1... | |
Add preliminary validations and dependent destroy to User model | class User < ApplicationRecord
has_secure_password
has_many :plans
validates :name, presence: true, length: { minimum: 5 }
end | class User < ApplicationRecord
has_secure_password
has_many :plans, dependent: :destroy
validates :name, presence: true, length: { minimum: 5 }
validates :email, presence: true, length: { minimum: 4 }
end |
Mark BSON as broken in JRuby 9.3 | describe 'transformer_bson', proxy: :Transformer do
moneta_build do
Moneta.build do
use :Transformer, key: :bson, value: :bson
adapter :Memory
end
end
moneta_loader do |value|
if ::BSON::VERSION >= '4.0.0'
::BSON::Document.from_bson(::BSON::ByteBuffer.new(value))['v']
else
... | # Currently broken in JRuby 9.3 - see https://github.com/jruby/jruby/issues/6941
describe 'transformer_bson', proxy: :Transformer, broken: defined?(JRUBY_VERSION) && ::Gem::Version.new(JRUBY_VERSION) >= ::Gem::Version.new('9.3.0.0') do
moneta_build do
Moneta.build do
use :Transformer, key: :bson, value: :b... |
Add some dumy specs for Solid::Tag | require 'spec_helper'
describe Solid::Tag do
end | require 'spec_helper'
class DummyTag < Solid::Tag
def display(*args)
args.map(&:to_s).join
end
end
describe Solid::Tag do
subject{ DummyTag.new('dummy', '1, "foo", myvar, myopts: false', 'token') }
it 'should works' do
subject.render('myvar' => 'bar').should be == '1foobar{:myopts=>false}'
end
... |
Add third order factor to positions table | class CupGroup < Sequel::Model
one_to_many :matches, key: :group_id
one_to_many :group_positions, key: :group_id
subset(:groups_phase, :phase => "groups")
def teams
matches.map { |match| [match.host_team, match.rival_team] }.flatten.uniq
end
def positions_table
GroupPosition.select.select_append{... | class CupGroup < Sequel::Model
one_to_many :matches, key: :group_id
one_to_many :group_positions, key: :group_id
subset(:groups_phase, :phase => "groups")
def teams
matches.map { |match| [match.host_team, match.rival_team] }.flatten.uniq
end
def positions_table
GroupPosition.select.select_append{... |
Use the new standard API port | # encoding: utf-8
#
# Copyright 2016 Liqwyd Ltd
#
# Authors: Kristian Van Der Vliet <vanders@liqwyd.com>
require 'sinatra'
require 'sidekiq/web'
require 'cyclid/app'
configure :production do
map '/' do
app = Cyclid::API::App
app.set :bind, '0.0.0.0'
app.set :port, 80
app.run!
end
end
configure :d... | # encoding: utf-8
#
# Copyright 2016 Liqwyd Ltd
#
# Authors: Kristian Van Der Vliet <vanders@liqwyd.com>
require 'sinatra'
require 'sidekiq/web'
require 'cyclid/app'
configure :production do
map '/' do
app = Cyclid::API::App
app.set :bind, '0.0.0.0'
app.set :port, 8361
app.run!
end
end
configure ... |
Add instructions to CSV email | class AdminMailer < ApplicationMailer
default from: "\"Asics Hub\" <no-reply@asicshub.com.br>"
def invite_csv_file_email(respond_to, file)
mail_to = "no-reply@asicshub.com.br"
subject = "Invite File to Parse"
content = "File attached. Respond to: " + respond_to;
attachments[file.original_filename]... | class AdminMailer < ApplicationMailer
default from: "\"Asics Hub\" <no-reply@asicshub.com.br>"
def invite_csv_file_email(respond_to, file)
mail_to = "no-reply@asicshub.com.br"
subject = "Invite File to Parse"
content = "File attached. Respond to: " + respond_to + " and upload at: http://www.asicshub.co... |
Add code wars (6) - who likes it | # http://www.codewars.com/kata/5266876b8f4bf2da9b000362/
# --- iteration 1 ---
def likes(names)
case names.size
when 0 then "no one likes this"
when 1 then "#{names.first} likes this"
when 2 then "#{names.first} and #{names[1]} like this"
when 3 then "#{names.first}, #{names[1]} and #{names[2]} like this"
e... | |
Fix a bug in a task | namespace :'2018_06_05_send_new_attestation' do
task set: :environment do
ids = [
20982,
21262,
54914,
59769,
63747,
59520,
21496,
13386,
13371,
14585,
15307,
17212,
16037,
60403,
60400,
20534,
60123,
16361... | namespace :'2018_06_05_send_new_attestation' do
task set: :environment do
ids = [
20982,
21262,
54914,
59769,
63747,
59520,
21496,
13386,
13371,
14585,
15307,
17212,
16037,
60403,
60400,
20534,
60123,
16361... |
Remove cached location maps with the variant suffix too. | class LocationSweeper < ActionController::Caching::Sweeper
include ApplicationHelper
private
def expire_stop_fragments(stop)
# expire the stop page fragments
stop_cache = stop_cache_path(stop)
expire_fragment("#{stop_cache}.action_suffix=route_list")
expire_fragment("#{stop_cache}.acti... | class LocationSweeper < ActionController::Caching::Sweeper
include ApplicationHelper
private
def expire_stop_fragments(stop)
# expire the stop page fragments
stop_cache = stop_cache_path(stop)
expire_fragment("#{stop_cache}.action_suffix=route_list")
expire_fragment("#{stop_cache}.action_suffix... |
Add convenience method to login to dev JCR | $: << File.dirname(__FILE__)
require 'java'
require 'jcr/node'
require 'jcr/query'
class JCR
include_class('java.lang.String') {|package,name| "J#{name}" }
include_class 'javax.jcr.SimpleCredentials'
include_class 'org.apache.jackrabbit.commons.JcrUtils'
def self.login(opts = {})
repository = JcrUtils.ge... | $: << File.dirname(__FILE__)
require 'java'
require 'jcr/node'
require 'jcr/query'
class JCR
include_class('java.lang.String') {|package,name| "J#{name}" }
include_class 'javax.jcr.SimpleCredentials'
include_class 'org.apache.jackrabbit.commons.JcrUtils'
def self.login(opts = {})
repository = JcrUtils.ge... |
Fix migration typo to be able to rollback if needed | Sequel.migration do
up do
drop_column :users, :ghost_tables_enabled
end
down do
alter_table :users do
add_column :users, :ghost_tables_enabled, :boolean, default: false
end
end
end
| Sequel.migration do
up do
drop_column :users, :ghost_tables_enabled
end
down do
add_column :users, :ghost_tables_enabled, :boolean
end
end
|
Add crons to check env | # Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_m... | # Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_m... |
Customize Pick stream scopes: Join enclosures table on `container_id` | class Pick < ApplicationRecord
include EnclosureMark
belongs_to :enclosure , counter_cache: :pick_count, touch: true
belongs_to :container , class_name: "Enclosure", foreign_key: "container_id"
scope :pick_count, -> {
group(:enclosure_id).order('count_container_id DESC').count('container_id')
}
end
| class Pick < ApplicationRecord
include EnclosureMark
belongs_to :enclosure , counter_cache: :pick_count, touch: true
belongs_to :container , class_name: "Enclosure", foreign_key: "container_id"
scope :pick_count, -> {
group(:enclosure_id).order('count_container_id DESC').count('container_id')
}
scope ... |
Add module for deprecating model attributes | require 'active_support/deprecation'
module DeprecatedAttributes
extend ActiveSupport::Concern
class_methods do
def deprecate_attribute(*names)
names.each do |name|
define_method(:"#{name}") do
callstack = caller_locations(0).map(&:to_s).reject{ |path| path =~ /deprecated_attributes\.r... | |
Add factory methods to AsyncClient::Clients::Qless | require "async_client/client"
require "qless"
require "async_client/clients/qless/client"
require "async_client/clients/qless/client_factory"
| require "async_client/client"
require "qless"
require "async_client/clients/qless/client"
require "async_client/clients/qless/client_factory"
module AsyncClient
module Clients
module Qless
def self.build_async_client(host, port)
qless_async_client = build_qless_async_client(host, port)
Asy... |
Set memory storage for file upload tests | require 'dragonfly'
# Configure
Dragonfly.app.configure do
plugin :imagemagick
secret Rails.application.secrets.secret_key_base
url_format "/media/:job/:name"
if Rails.env.production?
datastore :s3,
bucket_name: ENV['S3_BUCKET'],
access_key_id: ENV['S3_ACCESS_KEY_ID'],
secret_access_ke... | require 'dragonfly'
# Configure
Dragonfly.app.configure do
plugin :imagemagick
secret Rails.application.secrets.secret_key_base
url_format "/media/:job/:name"
case Rails.env
when 'development'
datastore :file,
root_path: Rails.root.join('public/system'),
server_root: Rails.root.join('publi... |
Remove deprecated alias from ProcessorRegistry | module Peribot
# ProcessorRegistry provides an ability for components to "register"
# processors that may be used by the bot to process messages. Processor
# chains and groups can be created using lists obtained from the registries.
class ProcessorRegistry
# Create a new processor registry.
def initiali... | module Peribot
# ProcessorRegistry provides an ability for components to "register"
# processors that may be used by the bot to process messages. Processor
# chains and groups can be created using lists obtained from the registries.
class ProcessorRegistry
# Create a new processor registry.
def initiali... |
Add very basic setup for httparty | class HearthstoneJSON
end
| require 'httparty'
class HearthstoneJSON
include HTTParty
API_URL_BASE = 'https://api.hearthstonejson.com'.freeze
API_VER = 'v1'.freeze
base_uri "#{API_URL_BASE}/#{API_VER}"
def initialize(locale = 'enUS', data_ver = 'latest')
@full_uri = "#{base_uri}/#{data_ver}/#{locale}"
end
... |
Add /cas and /proxyValidate routes | module Cassy
extend ActiveSupport::Autoload
autoload :CAS
autoload :Utils
autoload :Engine
def self.draw_routes
Rails.application.routes.draw do
scope(:path => "cas") do
get 'login', :to => "cassy/sessions#new"
post 'login', :to => "cassy/sessions#create"
get 'lo... | module Cassy
extend ActiveSupport::Autoload
autoload :CAS
autoload :Utils
autoload :Engine
def self.draw_routes
Rails.application.routes.draw do
scope(:path => "cas") do
root :to => "cassy/sessions#new"
get 'login', :to => "cassy/sessions#new"
post 'login', :to => "cassy/... |
Add test for model creation | require 'test_helper'
class RailsOps::Operation::Model::CreateTest < ActiveSupport::TestCase
include TestHelper
BASIC_OP = Class.new(RailsOps::Operation::Model::Create) do
model Group
end
def test_basic
op = BASIC_OP.run!(group: { name: 'test', color: 'red' })
assert_equal 'test', op.model.name
... | |
Change back 'Post' to 'Multipost' in TomDoc | module Jekyll
class MultiPost < Post
# Initialize this Post instance.
#
# site - The Site.
# base - The String path to the dir containing the post file.
# name - The String filename of the post file.
# layout - The layout to use for the post.
#
# Returns the new ... | module Jekyll
class MultiPost < Post
# Initialize this Multipost instance.
#
# site - The Site.
# base - The String path to the dir containing the post file.
# name - The String filename of the post file.
# layout - The layout to use for the post.
#
# Returns the... |
Add "rdf" and "linkeddata" as dependencies | Gem::Specification.new do |s|
s.name = 'semantology'
s.version = '0.0.0'
s.platform = Gem::Platform::RUBY
s.date = '2014-07-20'
s.summary = 'Turn semantic markup into ontologies'
s.description = 'Turn semantic markup into ontologies'
s.authors = ['Julian Grosshauser']
s.emai... | Gem::Specification.new do |s|
s.name = 'semantology'
s.version = '0.0.0'
s.platform = Gem::Platform::RUBY
s.date = '2014-07-20'
s.summary = 'Turn semantic markup into ontologies'
s.description = 'Turn semantic markup into ontologies'
s.authors = ['Julian Grosshauser']
s.emai... |
Test to make sure the generated file is not empty | require 'spec_helper'
describe Species::DocumentsExport do
describe :path do
subject {
Species::DocumentsExport.new({})
}
specify { subject.path.should == "public/downloads/documents/" }
end
SPEC_DOCUMENTS_DOWNLOAD_PATH = "spec/public/downloads/documents"
describe :export do
before(:each) ... | require 'spec_helper'
describe Species::DocumentsExport do
describe :path do
subject {
Species::DocumentsExport.new({})
}
specify { subject.path.should == "public/downloads/documents/" }
end
SPEC_DOCUMENTS_DOWNLOAD_PATH = "spec/public/downloads/documents"
describe :export do
before(:each) ... |
Add documentation to the Show model. | # A class to hold the data for a Show, woah
class Show
attr_reader :title, :url, :rss, :aliases
def initialize(json_hash)
@title = json_hash["title"]
@url = json_hash["url"]
@rss = json_hash["rss"]
@aliases = (json_hash["aliases"] || []).map do |show_alias|
show_alias.downcase
end
end
... | # The Show class holds data for a specific show. In addition to being a data
# container, it also provides for matching a search term. The following
# (read-only) attributes are available:
#
# title: (string) The show's title
# url: (string) The URL slug of the show
# rss: (string) The RSS feed URL of t... |
Fix code coverage reporting: Re-enable Coveralls | # encoding: utf-8
# frozen_string_literal: true
%w{
simplecov
coveralls
}.each { |f| require f }
SimpleCov.formatters << SimpleCov::Formatter::HTMLFormatter
SimpleCov.start
%w{
rspec/its
ruby_speech
}.each { |f| require f }
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
schema_file_p... | # encoding: utf-8
# frozen_string_literal: true
%w{
simplecov
coveralls
}.each { |f| require f }
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start
%w{
rspec/its
ruby_speech
}.each { |f| require f }
Dir[File.... |
Use a default middleman application | require 'rspec'
RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.filter_run focus: true
config.run_all_when_everything_filtered = true
end
RSpec::Matchers.define :render_html do |html|
diffable
match do |markdown|
@expected = html.strip
parser = Red... | require 'rspec'
RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.filter_run focus: true
config.run_all_when_everything_filtered = true
end
RSpec::Matchers.define :render_html do |html|
diffable
match do |markdown|
@expected = html.strip
instance = M... |
Allow to update player's name. | class Players::RegistrationsController < Devise::RegistrationsController
def new
@page_id = :sign_up
super
end
def create
param = sign_up_params
team_id = param.delete(:team_id)
team_password = param.delete(:team_password)
# build_resource
self.resource = resource_class.new_with_sess... | class Players::RegistrationsController < Devise::RegistrationsController
def new
@page_id = :sign_up
super
end
def create
param = sign_up_params
team_id = param.delete(:team_id)
team_password = param.delete(:team_password)
# build_resource
self.resource = resource_class.new_with_sess... |
Remove accidental comment in redirect_back change. | class Like::Interaction
def initialize(controller)
@controller = controller
end
def create
Like::Like.like liker, likeable
end
def destroy
Like::Like.unlike liker, likeable
end
def post_action
if ActionPack::VERSION::STRING.to_i > 4
controller.redirect_back fallback_location: "/"#... | class Like::Interaction
def initialize(controller)
@controller = controller
end
def create
Like::Like.like liker, likeable
end
def destroy
Like::Like.unlike liker, likeable
end
def post_action
if ActionPack::VERSION::STRING.to_i > 4
controller.redirect_back fallback_location: "/",... |
Move ["POST"] to a constant | module Rack
class MethodOverride
HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS PATCH LINK UNLINK)
METHOD_OVERRIDE_PARAM_KEY = "_method".freeze
HTTP_METHOD_OVERRIDE_HEADER = "HTTP_X_HTTP_METHOD_OVERRIDE".freeze
def initialize(app)
@app = app
end
def call(env)
if allowed_meth... | module Rack
class MethodOverride
HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS PATCH LINK UNLINK)
METHOD_OVERRIDE_PARAM_KEY = "_method".freeze
HTTP_METHOD_OVERRIDE_HEADER = "HTTP_X_HTTP_METHOD_OVERRIDE".freeze
ALLOWED_METHODS = ["POST"]
def initialize(app)
@app = app
end
def ... |
Add a rake task to show the configured services paths | # desc "Explaining what the task does"
# task :webhookr do
# # Task goes here
# end
| namespace :webhookr do
desc "List the configured services and paths"
task :services => :environment do
puts "No webhookr services configured - add and configure webhookr plugins." and next if Webhookr.adapters.empty?
include Webhookr::Engine.routes.url_helpers
Webhookr.adapters.each do |key, adapter|... |
Load CLI a bit later | require 'json'
require 'salt/clt/version'
require 'salt/clt/config'
require 'salt/clt/cli'
require 'salt/clt/errors'
require 'salt/clt/api'
module Salt
module CLT
end
end
| require 'json'
require 'salt/clt/version'
require 'salt/clt/config'
require 'salt/clt/errors'
require 'salt/clt/api'
require 'salt/clt/cli'
module Salt
module CLT
end
end
|
Add code example how to instantiate the ClearColor filter | # frozen_string_literal: true
#
# Copyright 2017 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
module Rackstash
module Filters
# Remove all ANSI color codes from the `"message"` field of the given event
# `Hash`.
... | # frozen_string_literal: true
#
# Copyright 2017 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
module Rackstash
module Filters
# Remove all ANSI color codes from the `"message"` field of the given event
# `Hash`.
... |
Update example descriptions in spec | require 'spec_helper'
describe 'ROM / Yesql' do
include_context 'users'
subject(:users) { rom.relation(:users) }
let(:rom) { setup.finalize }
let(:setup) { ROM.setup(:yesql, [uri, path: path]) }
before do
setup.relation(:users, adapter: :yesql)
end
it 'works yay!' do
expect(users.by_name(name... | require 'spec_helper'
describe 'ROM / Yesql' do
include_context 'users'
subject(:users) { rom.relation(:users) }
let(:rom) { setup.finalize }
let(:setup) { ROM.setup(:yesql, [uri, path: path]) }
before do
setup.relation(:users, adapter: :yesql)
end
describe 'query method' do
it 'uses hash-bas... |
Add precautionary conversion in config handling | require 'rack'
module SecondMate
class ResponseNotFound < Exception
end
@config = {
:matcher_pattern => '_*_'
}
def self.method_missing(m, *attrs)
# Ease access to @config
if @config[m.to_sym]
@config[m.to_sym]
elsif @config[m.chomp('=').to_sym]
@config[m.chomp('=').to_sym] = at... | require 'rack'
module SecondMate
class ResponseNotFound < Exception
end
@config = {
:matcher_pattern => '_*_'
}
def self.method_missing(m, *attrs)
# Ease access to @config
if @config[m.to_sym]
@config[m.to_sym]
elsif @config[m.to_s.chomp('=').to_sym]
@config[m.to_s.chomp('=').to... |
Remove fixtures from testing environment | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
| ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
#fixtures :all
# Add more helper methods to be used by all tests here...
end
|
Add query-counting helper code from Rails | TEST_ROOT = File.dirname(__FILE__)
$: << 'lib'
require 'test/unit'
require 'yaml'
require 'rubygems'
require 'active_record'
require 'ruby-debug'
ActiveRecord::Base.configurations = YAML::load(File.open(File.join(TEST_ROOT, 'database.yml')))
ActiveRecord::Base.establish_connection(:alter_table_test)
require File.jo... | TEST_ROOT = File.dirname(__FILE__)
$: << 'lib'
require 'test/unit'
require 'yaml'
require 'rubygems'
require 'active_record'
require 'ruby-debug'
ActiveRecord::Base.configurations = YAML::load(File.open(File.join(TEST_ROOT, 'database.yml')))
ActiveRecord::Base.establish_connection(:alter_table_test)
# Cribbed from ... |
Add Array bounds values specific to Rubinius. | module ArraySpecs
def self.max_32bit_size
2**32/4
end
def self.max_64bit_size
2**64/8
end
def self.frozen_array
@frozen_array ||= [1,2,3]
@frozen_array.freeze
@frozen_array
end
def self.recursive_array
a = [1, 'two', 3.0]
5.times { a << a }
a
end
def self.head_recur... | module ArraySpecs
not_compliant_on :rubinius do
def self.max_32bit_size
2**32/4
end
def self.max_64bit_size
2**64/8
end
end
deviates_on :rubinius do
def self.max_32bit_size
2**30-1
end
def self.max_64bit_size
2**62-1
end
end
def self.frozen_array
... |
Use ::VERSION::STRING for gemspec version. | Gem::Specification.new do |s|
s.name = %q{ruby-s3cmd}
s.version = "0.1.3"
s.date = %q{2012-06-13}
s.authors = ["Joel Bryan Juliano"]
s.email = %q{joelbryan.juliano@gmail.com}
s.summary = %q{A gem providing a ruby interface to s3cmd Amazon S3 client.}
s.homepage = %q{http://github.com/jjuliano/ruby-s3cmd}
... | Gem::Specification.new do |s|
s.name = %q{ruby-s3cmd}
s.version = RubyS3Cmd::VERSION::STRING
s.date = %q{2012-06-13}
s.authors = ["Joel Bryan Juliano"]
s.email = %q{joelbryan.juliano@gmail.com}
s.summary = %q{A gem providing a ruby interface to s3cmd Amazon S3 client.}
s.homepage = %q{http://github.com/jj... |
Update Beaker acceptance test spec | require 'spec_helper_acceptance'
describe 'sks class' do
context 'default parameters' do
# Using puppet_apply as a helper
it 'should work with no errors' do
pp = <<-EOS
class { 'sks': }
EOS
# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(... | require 'spec_helper_acceptance'
describe 'sks class' do
context 'default parameters' do
# Using puppet_apply as a helper
it 'should work with no errors' do
pp = <<-EOS
class { 'sks': }
EOS
# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(... |
Set raise_in_transactional_callbacks on rails-4.2.x only | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
# require "sprockets/railtie"
require "rails/test_unit/railtie"
Bundler.require(*Rails.groups)
require "schema... | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
# require "sprockets/railtie"
require "rails/test_unit/railtie"
Bundler.require(*Rails.groups)
require "schema... |
Add more fields to Atom feed XML. | xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
site_url = site_root_uri
xml.title blog_title
xml.subtitle blog_subtitle
xml.id URI.join(site_url, blog.options.prefix.to_s)
xml.link "href" => URI.join(site_url, blog.options.prefix.to_s)
xml.link "href" => URI.join(site_url, current_page.p... | xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xml:lang" => "en-GB" do
site_url = site_root_uri
xml.title blog_title
xml.subtitle blog_subtitle
xml.id URI.join(site_url, blog.options.prefix.to_s)
xml.link "href" => URI.join(site_url, blog.options.prefix.to_s)
xml.link "href" => URI.join(s... |
Allow Flag property to be nullable. | module DataMapper
module Types
class Flag < DataMapper::Type(Integer)
def self.inherited(target)
target.instance_variable_set("@primitive", self.primitive)
end
def self.flag_map
@flag_map
end
def self.flag_map=(value)
@flag_map = value
end
def s... | module DataMapper
module Types
class Flag < DataMapper::Type(Integer)
def self.inherited(target)
target.instance_variable_set("@primitive", self.primitive)
end
def self.flag_map
@flag_map
end
def self.flag_map=(value)
@flag_map = value
end
def s... |
Make unix_file_mime_type compatible with file versions < 5 | # AttachmentFu sets the Attachment content type from the browser sent Content-type header
#
# This monkey patch uses UNIX file utility to fix broken or missing content types headers
module Technoweenie::AttachmentFu::InstanceMethods
def uploaded_data_with_unix_file_mime_type=(file_data)
tmp_file = self.uploaded_... | # AttachmentFu sets the Attachment content type from the browser sent Content-type header
#
# This monkey patch uses UNIX file utility to fix broken or missing content types headers
module Technoweenie::AttachmentFu::InstanceMethods
def uploaded_data_with_unix_file_mime_type=(file_data)
tmp_file = self.uploaded_... |
Make chruby part of the base recipe | #
# Cookbook Name:: omnibus
# Recipe:: default
#
# Copyright 2013-2014, Chef Software, 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
#... | #
# Cookbook Name:: omnibus
# Recipe:: default
#
# Copyright 2013-2014, Chef Software, 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
#... |
Add reference to React.js doc | require "spec_helper"
describe React::Event do
it "should bridge attributes of native SyntheticEvent" do
element = React.create_element('div').on(:click) do |event|
expect(event.bubbles).to eq(`#{event.to_n}.bubbles`)
expect(event.cancelable).to eq(`#{event.to_n}.cancelable`)
expect(event.curre... | require "spec_helper"
describe React::Event do
it "should bridge attributes of native SyntheticEvent (see http://facebook.github.io/react/docs/events.html#syntheticevent)" do
element = React.create_element('div').on(:click) do |event|
expect(event.bubbles).to eq(`#{event.to_n}.bubbles`)
expect(event.... |
Test suite should fail when there are missing translations | require 'rails/generators'
class TestAppGenerator < Rails::Generators::Base
source_root File.expand_path("../../../../spec/test_app_templates", __FILE__)
def install_engine
generate 'curation_concerns:install', '-f'
end
def run_migrations
rake 'db:migrate'
end
def generate_generic_work
gener... | require 'rails/generators'
class TestAppGenerator < Rails::Generators::Base
source_root File.expand_path("../../../../spec/test_app_templates", __FILE__)
def install_engine
generate 'curation_concerns:install', '-f'
end
def run_migrations
rake 'db:migrate'
end
def generate_generic_work
gener... |
Add missing requirement to tests | require './test/integration_helper'
require 'sinatra/base'
require 'rack/test'
require 'rack-flash'
require 'approvals'
require 'app'
Approvals.configure do |c|
c.approvals_path = './test/fixtures/approvals/'
end
| require './test/integration_helper'
require 'gravatarify'
require 'sinatra/base'
require 'rack/test'
require 'rack-flash'
require 'approvals'
require 'app'
Approvals.configure do |c|
c.approvals_path = './test/fixtures/approvals/'
end
|
Make tmp folder in gem root | module DataKitten
module Origins
# Git origin module. Automatically mixed into {Dataset} for datasets that are loaded from Git repositories.
#
# @see Dataset
#
module Git
private
def self.supported?(uri)
uri =~ /\A(git|https?):\/\/.*\.git\Z/
end
publi... | module DataKitten
module Origins
# Git origin module. Automatically mixed into {Dataset} for datasets that are loaded from Git repositories.
#
# @see Dataset
#
module Git
private
def self.supported?(uri)
uri =~ /\A(git|https?):\/\/.*\.git\Z/
end
publi... |
Make sure static content is loaded | module ActivoRails
class Engine < Rails::Engine
puts "Loaded engine"
config.asset_path = "/activo/%s"
end
end
| module ActivoRails
class Engine < Rails::Engine
initializer "static assets" do |app|
app.middleware.use ::ActionDispatch::Static, "#{root}/public"
end
end
end
|
Use File::ALT_SEPARATOR to test platform | class Hiera
module Util
module_function
def posix?
require 'etc'
Etc.getpwuid(0) != nil
end
def microsoft_windows?
return false if posix?
begin
require 'win32/dir'
true
rescue LoadError => err
warn "Cannot run on Microsoft Windows without ... | class Hiera
module Util
module_function
def posix?
require 'etc'
Etc.getpwuid(0) != nil
end
def microsoft_windows?
return false unless File::ALT_SEPARATOR
begin
require 'win32/dir'
true
rescue LoadError => err
warn "Cannot run on Microsoft... |
Add bundler initialization to test helper | require 'pathname'
require 'rubygems'
require 'minitest/autorun'
require 'mocha/setup'
lib_path = (Pathname.new(__FILE__) + "../../../lib").cleanpath
$LOAD_PATH.unshift(lib_path)
require 'debugger'
Dir.glob(File.expand_path("../support/*.rb", __FILE__)).each { |f| require f }
Debugger::Command.settings[:debuggertest... | require 'pathname'
require 'rubygems'
require 'bundler/setup'
require 'minitest/autorun'
require 'mocha/setup'
lib_path = (Pathname.new(__FILE__) + "../../../lib").cleanpath
$LOAD_PATH.unshift(lib_path)
require 'debugger'
Dir.glob(File.expand_path("../support/*.rb", __FILE__)).each { |f| require f }
Debugger::Comman... |
Use the proper Merb root and environment constants. Thanks to Dan Gilkerson. | unless defined?(Sass::MERB_LOADED)
Sass::MERB_LOADED = true
Sass::Plugin.options.merge!(:template_location => MERB_ROOT + '/public/stylesheets/sass',
:css_location => MERB_ROOT + '/public/stylesheets',
:always_check => MERB_ENV != "production... | unless defined?(Sass::MERB_LOADED)
Sass::MERB_LOADED = true
version = Merb::VERSION.split('.').map { |n| n.to_i }
if version[0] <= 0 && version[1] < 5
root = MERB_ROOT
env = MERB_ENV
else
root = Merb.root
env = Merb.environment
end
Sass::Plugin.options.merge!(:template_location => root ... |
Use same folder for log file if ORBIT_HOME is not set | # Apache 2.0 License
#
# Copyright (c) 2016 Sebastian Katzer, appPlant GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to... | # Apache 2.0 License
#
# Copyright (c) 2016 Sebastian Katzer, appPlant GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to... |
Add integration tests between table and basic renderer. | # -*- encoding: utf-8 -*-
require 'spec_helper'
describe TTY::Table, 'options' do
let(:rows) { [['a1', 'a2'], ['b1', 'b2']] }
let(:widths) { [] }
let(:aligns) { [] }
let(:object) {
described_class.new rows, :column_widths => widths, :column_aligns => aligns
}
subject { object.to_s; object.renderer... | |
Change current_visitor to current_user for policy check. | require File.expand_path('../../../../spec_helper', __FILE__)
describe "/dataservice/blobs/index.html.haml" do
include Dataservice::BlobsHelper
before(:each) do
# cut off the show_menu_for helper which traverses lots of other code
allow(view).to receive(:show_menu_for).and_return("show menu")
power_u... | require File.expand_path('../../../../spec_helper', __FILE__)
describe "/dataservice/blobs/index.html.haml" do
include Dataservice::BlobsHelper
before(:each) do
# cut off the show_menu_for helper which traverses lots of other code
allow(view).to receive(:show_menu_for).and_return("show menu")
power_u... |
Add iconv as a development dependency. | Gem::Specification.new do |s|
s.name = "ohm-contrib"
s.version = "1.2"
s.summary = %{A collection of decoupled drop-in modules for Ohm.}
s.description = %{Includes a couple of core functions such as callbacks, timestamping, typecasting and lots of generic validation routines.}
s.author = "Cyril David"
s.ema... | Gem::Specification.new do |s|
s.name = "ohm-contrib"
s.version = "1.2"
s.summary = %{A collection of decoupled drop-in modules for Ohm.}
s.description = %{Includes a couple of core functions such as callbacks, timestamping, typecasting and lots of generic validation routines.}
s.author = "Cyril David"
s.ema... |
Fix `url` stanza comment for Zest. | cask 'zest' do
version '0.1.1'
sha256 '9405fecb40731b47bb357e87714711afe6d1f6a9c3a4fa9d01b0109da9c3f947'
url "https://github.com/zestdocs/zest/releases/download/v#{version}/zest-v#{version}.dmg"
appcast 'https://github.com/zestdocs/zest/releases.atom',
checkpoint: '070f49a40e5db4448424a7ab4305fd05ecf... | cask 'zest' do
version '0.1.1'
sha256 '9405fecb40731b47bb357e87714711afe6d1f6a9c3a4fa9d01b0109da9c3f947'
# github.com/zestdocs/zest was verified as official when first introduced to the cask
url "https://github.com/zestdocs/zest/releases/download/v#{version}/zest-v#{version}.dmg"
appcast 'https://github.com/... |
Fix Depricated features used! Warning | provides :slack_notify
property :message, String, name_property: true
property :channels, Array, default: []
property :username, String
property :webhook_url, String
property :icon_emoji, String
action :notify do
# install the gem if missing
begin
require 'slack-notifier'
rescue LoadError
chef_gem 'slac... | provides :slack_notify
property :message, String, name_property: true
property :channels, Array, default: []
property :username, String
property :webhook_url, String
property :icon_emoji, String
action :notify do
# install the gem if missing
begin
require 'slack-notifier'
rescue LoadError
chef_gem 'slac... |
Complete the answer for 4.3.2 Defining Math Methods. | # Math Methods
# I worked on this challenge [by myself, with: ].
# Your Solution Below
def add(num_1, num_2)
#your code here
end
def subtract(num_1, num_2)
#your code here
end
def multiply(num_1, num_2)
#your code here
end
def divide(num_1, num_2)
#your code here
end | # Math Methods
# I worked on this challenge [by myself, with: ].
# Your Solution Below
def add(num_1, num_2)
#your code here
num_1 + num_2
end
def subtract(num_1, num_2)
#your code here
num_1 - num_2
end
def multiply(num_1, num_2)
#your code here
num_1 * num_2
end
def divide(num_1, num_2)
#your code here
... |
Enhance source_files selector to only work with swift files | Pod::Spec.new do |s|
s.name = "SwiftDDP"
s.version = "0.1.9"
s.summary = "A DDP Client for communicating with Meteor servers, written in Swift"
s.description = <<-DESC "A DDP Client for communicating with DDP Servers (Meteor JS), written in Swift"
DESC
... | Pod::Spec.new do |s|
s.name = "SwiftDDP"
s.version = "0.1.9"
s.summary = "A DDP Client for communicating with Meteor servers, written in Swift"
s.description = <<-DESC "A DDP Client for communicating with DDP Servers (Meteor JS), written in Swift"
DESC
... |
Add action to check GitHub access via user request | module Fastlane
module Actions
module SharedValues
end
class TestGithubAccessAction < Action
def self.run(params)
UI.important("Testing access to GitHub")
# Call endpoint
response = test_api(
'https://api.github.com',
params[:api_token]
)
... | |
Fix description, expand platforms, depend on all deps | name 'ark'
maintainer 'Franklin Webber'
maintainer_email 'frank@chef.io'
license 'Apache 2.0'
description 'Installs/Configures ark'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.9.1'
source_url 'https://github.com/burtlo/ark' if respond_to(... | name 'ark'
maintainer 'Franklin Webber'
maintainer_email 'frank@chef.io'
license 'Apache 2.0'
description 'Provides a custom resource for installing runtime artifacts in a predictable fashion'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.9.... |
Update podspec for Swift 4.2 and Xcode 10 | Pod::Spec.new do |s|
s.name = 'ActiveLabel'
s.version = '1.0.0'
s.author = { 'Optonaut' => 'hello@optonaut.co' }
s.homepage = 'https://github.com/optonaut/ActiveLabel.swift'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.platform = :ios, '8.0'
s.source = { :git => 'https://github.co... | Pod::Spec.new do |s|
s.name = 'ActiveLabel'
s.version = '1.0.1'
s.author = { 'Optonaut' => 'hello@optonaut.co' }
s.homepage = 'https://github.com/optonaut/ActiveLabel.swift'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.platform = :ios, '8.0'
s.source = { :git => 'https://github.co... |
Update rails-sass dependency to be compatible with rails 4.2 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "blogo/version"
require 'blogo/constants'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "blogo"
s.version = Blogo::VERSION
s.authors = ["Sergey Potapov"]
s.email ... | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "blogo/version"
require 'blogo/constants'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "blogo"
s.version = Blogo::VERSION
s.authors = ["Sergey Potapov"]
s.email ... |
Make nexus3_tasks integration tests compatible with 3.8.0 | require 'serverspec_helper'
describe 'nexus::tasks' do
describe command('curl -uadmin:admin123 http://localhost:8081/service/siesta/rest/v1/script/get_task/run -X POST ' \
'-H "Content-Type: text/plain" -d foo') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(/result.*name... | require 'serverspec_helper'
describe 'nexus::tasks' do
describe command('curl -uadmin:admin123 http://localhost:8081/service/rest/v1/script/get_task/run -X POST ' \
'-H "Content-Type: text/plain" -d foo') do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(/result.*name.*foo/)... |
Add plugin_root method to plugin superclass | # encoding: utf-8
# This file is part of the K5 bot project.
# See files README.md and COPYING for copyright and licensing information.
# IRCPlugin is the superclass of all plugins
class IRCPlugin < IRCListener
# Returns the name of the plugin
def name
self.class.to_s
end
# Returns a short description of the p... | # encoding: utf-8
# This file is part of the K5 bot project.
# See files README.md and COPYING for copyright and licensing information.
# IRCPlugin is the superclass of all plugins
class IRCPlugin < IRCListener
# Returns the root dir of the plugin
def plugin_root
"IRC/plugins/#{name}"
end
# Returns the name of... |
Fix copy and paste blunder on ChefSpec. | require 'spec_helper'
describe_recipe 'consul::default' do
it { expect(chef_run).to include_recipe('consul::_service') }
context 'with default attributes' do
it { expect(chef_run).to include_recipe('consul::install_binary') }
it { expect(chef_run).not_to include_recipe('consul::install_source') }
end
... | require 'spec_helper'
describe_recipe 'consul::default' do
it { expect(chef_run).to include_recipe('consul::_service') }
context 'with default attributes' do
it { expect(chef_run).to include_recipe('consul::install_binary') }
it { expect(chef_run).not_to include_recipe('consul::install_source') }
end
... |
Change to remove unnecessary options | if ENV['COVERAGE'] || ENV['TRAVIS']
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
command_name 'spec'
add_filter 'spec'
end
end
require 'bundler/... | # frozen_string_literal: true
if ENV['COVERAGE'] || ENV['TRAVIS']
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
command_name 'spec'
add_filter 'spe... |
Update Swift version in Podfile | # Run `pod lib lint KeyboardKit.podspec' to ensure this is a valid spec.
Pod::Spec.new do |s|
s.name = 'KeyboardKit'
s.version = '3.1.1'
s.swift_versions = ['5.2']
s.summary = 'KeyboardKit helps you create iOS keyboard extensions.'
s.description = <<-DESC
KeyboardKit is ... | # Run `pod lib lint KeyboardKit.podspec' to ensure this is a valid spec.
Pod::Spec.new do |s|
s.name = 'KeyboardKit'
s.version = '3.1.1'
s.swift_versions = ['5.3']
s.summary = 'KeyboardKit helps you create iOS keyboard extensions.'
s.description = <<-DESC
KeyboardKit is ... |
Put Hash options in Datamapper config instead an adress uri |
period_dir = File.expand_path('.')
$LOAD_PATH.unshift(period_dir) unless $LOAD_PATH.include?(period_dir)
begin
require File.expand_path(".bundle/environment", __FILE__)
rescue LoadError
require "rubygems"
require "bundler"
Bundler.setup(:default)
end
Bundler.require
require 'yaml'
database = YAML.load_file... |
period_dir = File.expand_path('.')
$LOAD_PATH.unshift(period_dir) unless $LOAD_PATH.include?(period_dir)
begin
require File.expand_path(".bundle/environment", __FILE__)
rescue LoadError
require "rubygems"
require "bundler"
Bundler.setup(:default)
end
Bundler.require
require 'yaml'
database = YAML.load_file... |
Work out most popular from 50 projects | class PlatformsController < ApplicationController
def index
@platforms = Download.platforms
end
def show
find_platform
@licenses = Project.platform(@platform_name).popular_licenses.limit(8).to_a
@updated = Project.platform(@platform_name).limit(5).order('updated_at DESC')
@created = Project.p... | class PlatformsController < ApplicationController
def index
@platforms = Download.platforms
end
def show
find_platform
@licenses = Project.platform(@platform_name).popular_licenses.limit(8).to_a
@updated = Project.platform(@platform_name).limit(5).order('updated_at DESC')
@created = Project.p... |
Update Breezy gemspec with meta | require File.expand_path('../lib/breezy_template/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'breezy_template'
s.version = BreezyTemplate::VERSION
s.author = 'Johny Ho'
s.email = 'jho406@gmail.com'
s.license = 'MIT'
s.homepage = 'https://github.com/jho406/breezy/'
s.summary = '... | require File.expand_path('../lib/breezy_template/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'breezy_template'
s.version = BreezyTemplate::VERSION
s.author = 'Johny Ho'
s.email = 'jho406@gmail.com'
s.license = 'MIT'
s.homepage = 'https://github.com/jho406/breezy/'
s.summary = '... |
Use the new method for running a command. | module StartingBlocks
class Contract
attr_reader :options
def initialize options
@options = options
end
def self.inherited klass
@contract_types ||= []
@contract_types << klass
end
def file_clues
["test", "spec"]
end
def extensions
[]
end
de... | module StartingBlocks
class Contract
attr_reader :options
def initialize options
@options = options
end
def self.inherited klass
@contract_types ||= []
@contract_types << klass
end
def file_clues
["test", "spec"]
end
def extensions
[]
end
de... |
Fix dispute end point handlers sequence | module StripeMock
module RequestHandlers
module Disputes
def Disputes.included(klass)
klass.add_handler 'get /v1/disputes/(.*)', :get_dispute
klass.add_handler 'post /v1/disputes/(.*)', :update_dispute
klass.add_handler 'post /v1/disputes/(.*)/close', :close_dispute
... | module StripeMock
module RequestHandlers
module Disputes
def Disputes.included(klass)
klass.add_handler 'get /v1/disputes/(.*)', :get_dispute
klass.add_handler 'post /v1/disputes/(.*)/close', :close_dispute
klass.add_handler 'post /v1/disputes/(.*)', :update_dispute
... |
Change way of checking rails env. | require 'spree_core'
require 'spree_robokassa_hooks'
module SpreeRobokassa
class Engine < Rails::Engine
config.autoload_paths += %W(#{config.root}/lib)
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.env.production? ? require(c) : load(c... | require 'spree_core'
require 'spree_robokassa_hooks'
module SpreeRobokassa
class Engine < Rails::Engine
config.autoload_paths += %W(#{config.root}/lib)
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.application.config.cache_classes ? re... |
Add fallback to Unix epoch if Date.today method does not exist | lib = File.expand_path('../lib', __FILE__)
$:.unshift(lib) unless $:.include?(lib)
require 'rgpg/gem_info'
Gem::Specification.new do |s|
s.name = 'rgpg'
s.version = Rgpg::GemInfo.version_string
s.date = Date.today
s.executables << 'rgpg'
s.summary = 'rgpg'
s.description = 'Simple Ruby wrapper around "gpg"... | lib = File.expand_path('../lib', __FILE__)
$:.unshift(lib) unless $:.include?(lib)
require 'rgpg/gem_info'
Gem::Specification.new do |s|
s.name = 'rgpg'
s.version = Rgpg::GemInfo.version_string
s.date = Date.today rescue '1970-01-01'
s.executables << 'rgpg'
s.summary = 'rgpg'
s.description = 'Simple Ruby ... |
Add set output to help test | require File.expand_path("#{File.dirname(__FILE__)}/../../../spec_helper.rb")
require 'ghost/cli'
describe Ghost::Cli, :type => :cli do
describe "help" do
let(:overview) do
<<-EOF.unindent
USAGE: ghost <task> [<args>]
The ghost tasks are:
add Add a host
delete ... | require File.expand_path("#{File.dirname(__FILE__)}/../../../spec_helper.rb")
require 'ghost/cli'
describe Ghost::Cli, :type => :cli do
describe "help" do
let(:overview) do
<<-EOF.unindent
USAGE: ghost <task> [<args>]
The ghost tasks are:
add Add a host
delete ... |
Set required Ruby version in gemspec | # encoding: utf-8
$: << File.expand_path('../lib', __FILE__)
require 'tara/version'
Gem::Specification.new do |s|
s.name = 'tara'
s.version = Tara::VERSION.dup
s.platform = 'ruby'
s.authors = ['Mathias Söderberg']
s.email = ['mths@sdrbrg.se']
s.homepage = 'http://github.com/mt... | # encoding: utf-8
$: << File.expand_path('../lib', __FILE__)
require 'tara/version'
Gem::Specification.new do |s|
s.name = 'tara'
s.version = Tara::VERSION.dup
s.platform = 'ruby'
s.authors = ['Mathias Söderberg']
s.email = ['mths@sdrbrg.se']
s.homepage = 'http://github.com/mt... |
Upgrade inch and bump version | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'inch_ci/worker/version'
Gem::Specification.new do |spec|
spec.name = "inch_ci-worker"
spec.version = InchCI::Worker::VERSION
spec.authors = ["René Föhring"]
spec.emai... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'inch_ci/worker/version'
Gem::Specification.new do |spec|
spec.name = "inch_ci-worker"
spec.version = InchCI::Worker::VERSION
spec.authors = ["René Föhring"]
spec.emai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.