Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Fix some "GCC cannot create executables"
require 'brewkit' class GitManuals <Formula @url='http://kernel.org/pub/software/scm/git/git-manpages-1.6.4.2.tar.bz2' @md5='e2bc0cfadb3ba76daee69bfb6dd299ad' end class Git <Formula @url='http://kernel.org/pub/software/scm/git/git-1.6.4.2.tar.bz2' @md5='05c41dc84eae47e3d4fe5b3dee9cc73c' @homepage='http://gi...
require 'brewkit' class GitManuals <Formula @url='http://kernel.org/pub/software/scm/git/git-manpages-1.6.4.2.tar.bz2' @md5='e2bc0cfadb3ba76daee69bfb6dd299ad' end class Git <Formula @url='http://kernel.org/pub/software/scm/git/git-1.6.4.2.tar.bz2' @md5='05c41dc84eae47e3d4fe5b3dee9cc73c' @homepage='http://gi...
Fix import feature spec (broken due to text search)
require 'spec_helper' describe 'With an Externally Ranked Competition' do # let!(:user) { FactoryGirl.create(:payment_admin) } let(:user) { FactoryGirl.create(:super_admin_user) } include_context 'user is logged in' include_context 'basic event configuration' before :each do @competition = FactoryGirl.c...
require 'spec_helper' describe 'With an Externally Ranked Competition' do # let!(:user) { FactoryGirl.create(:payment_admin) } let(:user) { FactoryGirl.create(:super_admin_user) } include_context 'user is logged in' include_context 'basic event configuration' before :each do @competition = FactoryGirl.c...
Fix final highline errors printed in test output.
require_relative '../test_helper' class TestListingScenarios < Minitest::Test def test_listing_no_scenarios shell_output = "" expected_output = "" IO.popen('./would_you_rather manage', 'r+') do |pipe| expected_output << main_menu pipe.puts "2" expected_output << "No scenarios found. Ad...
require_relative '../test_helper' class TestListingScenarios < Minitest::Test def test_listing_no_scenarios shell_output = "" expected_output = "" IO.popen('./would_you_rather manage', 'r+') do |pipe| expected_output << main_menu pipe.puts "2" expected_output << "No scenarios found. Ad...
Remove superfluous variable in Bluster.create_cluster
# encoding: utf-8 require 'ordasity' require 'bluster/cluster_config' require 'bluster/listener' module Bluster def self.create_cluster(name, listener, options = {}) config = Bluster::ClusterConfig.create(options) Ordasity::Cluster.new(name, listener, config) end end
# encoding: utf-8 require 'ordasity' require 'bluster/cluster_config' require 'bluster/listener' module Bluster def self.create_cluster(name, listener, options = {}) Ordasity::Cluster.new(name, listener, ClusterConfig.create(options)) end end
Return method name from singleton method definition.
# frozen_string_literal: true require 'opal/nodes/def' module Opal module Nodes class DefsNode < DefNode handle :defs children :recvr, :mid, :args, :stmts def extract_block_arg *regular_args, last_arg = args.children if last_arg && last_arg.type == :blockarg @block_ar...
# frozen_string_literal: true require 'opal/nodes/def' module Opal module Nodes class DefsNode < DefNode handle :defs children :recvr, :mid, :args, :stmts def extract_block_arg *regular_args, last_arg = args.children if last_arg && last_arg.type == :blockarg @block_ar...
Add feature spec for volume price models
require 'spec_helper' RSpec.feature 'Managing volume price models' do stub_authorization! scenario 'a admin can create and remove volume price models', :js do visit spree.admin_volume_price_models_path expect(page).to have_content('Volume Price Models') click_on 'New Volume Price Model' fill_in '...
Include git recipe to install git
action :install do if new_resource.create_user group new_resource.group do action :create end user new_resource.owner do action :create gid new_resource.group end end directory new_resource.path do action :create owner new_resource.owner group new_resource.group e...
include_recipe 'git' action :install do if new_resource.create_user group new_resource.group do action :create end user new_resource.owner do action :create gid new_resource.group end end directory new_resource.path do action :create owner new_resource.owner group ...
Add rake task to publish orgs to publishing-api
namespace :publishing_api do desc "populate publishing api with lead organisations" task publish_lead_organisations: :environment do Policy.find_each do |policy| links_payload = { links: { organisations: policy.organisation_content_ids } } lead_organisation = policy...
Remove removed doc file from gemspec
$:.push File.expand_path("../lib", __FILE__) require "jquery-lazy-images/version" Gem::Specification.new do |s| s.name = "jquery-lazy-images" s.version = JqueryLazyImages::VERSION s.authors = ["Singlebrook Technology"] s.email = ["leon@singlebrook.com"] s.homepage = "https://github.c...
$:.push File.expand_path("../lib", __FILE__) require "jquery-lazy-images/version" Gem::Specification.new do |s| s.name = "jquery-lazy-images" s.version = JqueryLazyImages::VERSION s.authors = ["Singlebrook Technology"] s.email = ["leon@singlebrook.com"] s.homepage = "https://github.c...
Remove deprecation warnings in new RSpecs
# encoding: utf-8 $: << File.join(File.dirname(__FILE__), "/../../lib" ) require 'cucumber_priority'
# encoding: utf-8 $: << File.join(File.dirname(__FILE__), "/../../lib" ) require 'cucumber_priority' if defined?(RSpec) RSpec.configure do |config| if config.respond_to?(:expect_with) config.expect_with(:rspec) do |c| c.syntax = [:expect, :should] end end end end
Add Municipality::to_form_array method name_only option
require 'csv' module Arbetsformedlingen class MunicipalityCode CODE_MAP = CSV.read( File.expand_path('../../../../data/municipality-codes.csv', __FILE__) ).to_h.freeze CODES_MAP_INVERTED = CODE_MAP.invert.freeze def self.to_code(name) normalized = normalize(name) CODE_MAP.fetch(nor...
require 'csv' module Arbetsformedlingen class MunicipalityCode CODE_MAP = CSV.read( File.expand_path('../../../../data/municipality-codes.csv', __FILE__) ).to_h.freeze CODES_MAP_INVERTED = CODE_MAP.invert.freeze def self.to_code(name) normalized = normalize(name) CODE_MAP.fetch(nor...
Support specs running with config.eager_load=true
# frozen_string_literal: true module ActiveAdmin class Engine < ::Rails::Engine initializer "active_admin.load_app_path" do |app| ActiveAdmin::Application.setting :app_path, app.root ActiveAdmin::Application.setting :load_paths, [File.expand_path("app/admin", app.root)] end initializer "activ...
# frozen_string_literal: true module ActiveAdmin class Engine < ::Rails::Engine # Set default values for app_path and load_paths before running initializers initializer "active_admin.load_app_path", before: :load_config_initializers do |app| ActiveAdmin::Application.setting :app_path, app.root Act...
Split Podfile spec into several sub-specs.
Pod::Spec.new do |s| s.name = "SwiftySwift" s.version = "1.0.1" s.summary = "SwiftySwift is a collection of useful extensions for Swift types and Cocoa objects." s.homepage = "https://github.com/adeca/SwiftySwift" s.license = { :type => 'MIT' } s.authors = { "Agustin de Cabre...
Pod::Spec.new do |s| s.name = "SwiftySwift" s.version = "1.0.1" s.summary = "SwiftySwift is a collection of useful extensions for Swift types and Cocoa objects." s.homepage = "https://github.com/adeca/SwiftySwift" s.license = { :type => 'MIT' } s.authors = { "Agustin de Cabre...
Add a script to list the routes in a region
#!/usr/bin/env ruby require 'json' require 'set' routes_by_domain_url = {} page = JSON.parse `cf curl '/v2/routes?results-per-page=100'` next_url = page["next_url"] while next_url page = JSON.parse `cf curl '#{next_url}'` page['resources'].map do |resource| host = resource.dig('entity', 'host') unless h...
Connect to mongo on heroku too
require "sinatra/json" configure do session = Moped::Session.new([ '127.0.0.1:27017' ]) session.use "cloud_counter_#{ENV['RACK_ENV']}" end post '/counters' do json ({id: 'x', name: 'x', value: 0}) end get '/counters/:id' do |id| json ({id: 'x', name: 'x', value: 0}) end put '/counters/:id' do |id| json ({...
require "sinatra/json" configure do session ||= Moped::Session.connect(ENV.fetch('MONGOSOUP_URL', '127.0.0.1:27017')) end post '/counters' do json ({id: 'x', name: 'x', value: 0}) end get '/counters/:id' do |id| json ({id: 'x', name: 'x', value: 0}) end put '/counters/:id' do |id| json ({id: 'x', name: 'x',...
Work on new versions also
# encoding: utf-8 def self.add_to_path path path = File.expand_path "../#{path}/", __FILE__ $:.unshift path unless $:.include? path end add_to_path 'lib' require 'test_runner/version' Gem::Specification.new do |s| # 1.8.x is not supported s.required_ruby_version = '>= 1.9.3' s.name = 'test_runner' s.vers...
# encoding: utf-8 def self.add_to_path path path = File.expand_path "../#{path}/", __FILE__ $:.unshift path unless $:.include? path end add_to_path 'lib' require 'test_runner/version' Gem::Specification.new do |s| # 1.8.x is not supported s.required_ruby_version = '>= 1.9.3' s.name = 'test_runner' s.vers...
Use self.table_name as set_table_name is deprecated
class Mixin < ActiveRecord::Base end class ListMixin < ActiveRecord::Base set_table_name "mixins" default_scope order(:pos) acts_as_list :column => "pos", :scope => :parent end class ListMixinSub1 < ListMixin end class ListMixinSub2 < ListMixin end class ListWithStringScopeMixin < ActiveRecord::Base set_tab...
class Mixin < ActiveRecord::Base end class ListMixin < ActiveRecord::Base self.table_name = "mixins" default_scope order(:pos) acts_as_list :column => "pos", :scope => :parent end class ListMixinSub1 < ListMixin end class ListMixinSub2 < ListMixin end class ListWithStringScopeMixin < ActiveRecord::Base self...
Use current for approved progr reviews since complete is meant to be hidden for staff
# Leap - Electronic Individual Learning Plan Software # Copyright (C) 2011 South Devon College # Leap 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, either version 3 of the License, or # (at your opti...
# Leap - Electronic Individual Learning Plan Software # Copyright (C) 2011 South Devon College # Leap 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, either version 3 of the License, or # (at your opti...
Fix Rails 5's breaking of sign in
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_action :configure_permitted_parameters, if: :devise_controller? before_action do Rack::MiniProfiler.auth...
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_action :configure_permitted_parameters, if: :devise_controller? before_action do Rack::MiniProfiler.auth...
Format slugging percentage calc for readability
module BaseballStats module Calculators class SluggingPercentage include Calculators attr_accessor :team_id def initialize(raw_data, year, team_id) super(raw_data, year) @team_id = team_id end def calculate raise NoEligibleStatsFoundError if eligible_players...
module BaseballStats module Calculators class SluggingPercentage include Calculators attr_accessor :team_id def initialize(raw_data, year, team_id) super(raw_data, year) @team_id = team_id end def calculate raise NoEligibleStatsFoundError if eligible_players...
Make surer to YAMLify text if they were not String before
module Tolk class Translation < ActiveRecord::Base set_table_name "tolk_translations" serialize :text validates_uniqueness_of :phrase_id, :scope => :locale_id belongs_to :phrase, :class_name => 'Tolk::Phrase' belongs_to :locale, :class_name => 'Tolk::Locale' attr_accessor :force_set_primar...
module Tolk class Translation < ActiveRecord::Base set_table_name "tolk_translations" serialize :text validates_uniqueness_of :phrase_id, :scope => :locale_id belongs_to :phrase, :class_name => 'Tolk::Phrase' belongs_to :locale, :class_name => 'Tolk::Locale' attr_accessor :force_set_primar...
Remove resource bundles form podspec
Pod::Spec.new do |s| s.name = "BoxesView" s.version = "0.1.1" s.summary = "A UIView layed out in boxes" s.description = <<-DESC BoxesView is a UIView that lays out subviews as boxes, much like a simplified version of a UICollectionView DESC s.homep...
Pod::Spec.new do |s| s.name = "BoxesView" s.version = "0.1.1" s.summary = "A UIView layed out in boxes" s.description = <<-DESC BoxesView is a UIView that lays out subviews as boxes, much like a simplified version of a UICollectionView DESC s.homep...
Create redis set for discussions
require 'singleton' class GlobalFeed include Singleton def initialize @key = Nest.new(:global_feed) end def self.[](ignored_id) # to support listeners created in create_listeners this class must behave as if it were a # non-singleton because Listener.process always looks up the instance by "id" ...
require 'singleton' class GlobalFeed include Singleton def initialize @key = Nest.new(:global_feed) end def self.[](ignored_id) # to support listeners created in create_listeners this class must behave as if it were a # non-singleton because Listener.process always looks up the instance by "id" ...
Rename the session identifier to match the database name
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_validates_...
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_validatesc...
Update rubocop-rspec dependency version to >= 1.9.1
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "onkcop/version" Gem::Specification.new do |spec| spec.name = "onkcop" spec.version = Onkcop::VERSION spec.authors = ["Takafumi ONAKA"] spec.email = ["takafumi...
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "onkcop/version" Gem::Specification.new do |spec| spec.name = "onkcop" spec.version = Onkcop::VERSION spec.authors = ["Takafumi ONAKA"] spec.email = ["takafumi...
Revert "Require version 0.9.1 of oauth2 gem."
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'pdf_cloud/version' Gem::Specification.new do |gem| gem.name = "pdf_cloud" gem.version = PdfCloud::VERSION gem.authors = ["Joe Heth"] gem.email = ["j...
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'pdf_cloud/version' Gem::Specification.new do |gem| gem.name = "pdf_cloud" gem.version = PdfCloud::VERSION gem.authors = ["Joe Heth"] gem.email = ["j...
Fix missing span causing misalignment in org logos
module LogoHelper def logo_classes(options = {}) logo_class = ['organisation-logo'] logo_class << 'stacked' if options[:stacked] if options[:use_identity] == false logo_class << 'no-identity' else class_name = options[:class_name] || options.fetch(:organisation).organisation_logo_type.clas...
module LogoHelper def logo_classes(options = {}) logo_class = ['organisation-logo'] logo_class << 'stacked' if options[:stacked] if options[:use_identity] == false logo_class << 'no-identity' else class_name = options[:class_name] || options.fetch(:organisation).organisation_logo_type.clas...
Use symbols, not strings, for component object keys
class SelectFacet < FilterableFacet delegate :allowed_values, to: :facet def options allowed_values.map do | allowed_value | { "value" => allowed_value.value, "label" => allowed_value.label, "id" => allowed_value.value, "checked" => selected_values.include?(allowed_value),...
class SelectFacet < FilterableFacet delegate :allowed_values, to: :facet def options allowed_values.map do | allowed_value | { value: allowed_value.value, label: allowed_value.label, id: allowed_value.value, checked: selected_values.include?(allowed_value), } end...
Remove unused configuration about executables
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "amakanize/version" Gem::Specification.new do |spec| spec.name = "amakanize" spec.version = Amakanize::VERSION spec.authors = ["Ryo Nakamura"] spec.email = ["r7kamura@gmail.com"] spec.summary = "Utiliti...
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "amakanize/version" Gem::Specification.new do |spec| spec.name = "amakanize" spec.version = Amakanize::VERSION spec.authors = ["Ryo Nakamura"] spec.email = ["r7kamura@gmail.com"] spec.summary = "Utiliti...
Upgrade Remote Desktop Manager to version 2.0.4.0
cask :v1 => 'remote-desktop-manager' do version '1.1.11.0' sha256 'f5e9ec3d2a3bea912e1686ee167f4dcca5643d504fd1cac49381eaf446e5f82d' # devolutions.net is the official download host per the vendor homepage url "http://download.devolutions.net/Mac/Devolutions.RemoteDesktopManager.Mac.#{version}.dmg" name 'Remo...
cask :v1 => 'remote-desktop-manager' do version '2.0.4.0' sha256 'd5ba2c9c7242fcc55245ba39558d30de24ed27c2bff9e11a78753e2ff5e90fce' # devolutions.net is the official download host per the vendor homepage url "http://cdn.devolutions.net/download/Mac/Devolutions.RemoteDesktopManager.Mac.#{version}.dmg" name 'R...
Add documentation comment to donations controller
class Api::DonationsController < ApplicationController respond_to :json def total params.permit(:start, :end) start_date = params.fetch(:start, Date.today.beginning_of_month).to_date end_date = params.fetch(:end, Date.today.end_of_month).to_date response = { meta: { start: start_date.to_s, en...
class Api::DonationsController < ApplicationController respond_to :json # Fetches the sum of all donations (one off and recurring) for a given date range # If a date range is not provided, it will default to donations in the current # calendar month def total params.permit(:start, :end) start_date = ...
Support Ruby naming convention for boolean getter procedures
require 'active_support/concern' module Flavors module Preferences extend ::ActiveSupport::Concern module ClassMethods def preference(name, options = {}, &callback) has_many :preferences, :as => :prefered, :class_name => "::Flavors::Preference" define_method(name) do read_pr...
require 'active_support/concern' module Flavors module Preferences extend ::ActiveSupport::Concern module ClassMethods def preference(name, options = {}, &callback) has_many :preferences, :as => :prefered, :class_name => "::Flavors::Preference" define_method(name) do read_pr...
Use keyword args in IndexFileFinder
module Adsf::Rack class IndexFileFinder def initialize(app, options) @app = app (@root = options[:root]) || raise(ArgumentError, ':root option is required but was not given') @index_filenames = options[:index_filenames] || ['index.html'] end def call(env) # Get path path_inf...
module Adsf::Rack class IndexFileFinder def initialize(app, root:, index_filenames: ['index.html']) @app = app @root = root @index_filenames = index_filenames end def call(env) # Get path path_info = ::Rack::Utils.unescape(env['PATH_INFO']) path = ::File.join(@root, pa...
Throw 404 if attachment can not be found.
require 'spec_helper' module Alchemy describe AttachmentsController do let(:attachment) { build_stubbed(:attachment) } before { attachment.stub(:restricted?).and_return(true) Attachment.stub(:find).and_return(attachment) } it "should not be possible to download attachments from restrict...
require 'spec_helper' module Alchemy describe AttachmentsController do let(:attachment) { build_stubbed(:attachment) } before { attachment.stub(:restricted?).and_return(true) Attachment.stub(:find).and_return(attachment) } it "should not be possible to download attachments from restrict...
Add some tests for english strings
require 'Language' Dir[File.dirname(__FILE__) + "/../lib/errors/*.rb"].each {|file| require file } RSpec.describe Language do context "default" do before do @language = Language.new end it "should default to english" do expect(@language.lang).to eq "en" end ...
Add spec for actions on base spec.
require 'spec_helper' describe TableCloth::Base do subject { Class.new(TableCloth::Base) } let(:view_context) { ActionView::Base.new } context 'columns' do it 'has a column method' do subject.should respond_to :column end it 'column accepts a name' do expect { subject.column :column_nam...
require 'spec_helper' describe TableCloth::Base do subject { Class.new(TableCloth::Base) } let(:view_context) { ActionView::Base.new } context 'columns' do it 'has a column method' do subject.should respond_to :column end it 'column accepts a name' do expect { subject.column :column_nam...
Test for vector library inclusion.
require 'pong' describe Pong do it "is not a bartender" do expect { Pong.mix(:mojito) }.to raise_error end end
require 'pong' require 'vector' describe Pong do it "is not a bartender" do expect { Pong.mix(:mojito) }.to raise_error end it "loads the vector library" do v = Vector.new(3, 4) v.length.should eq 5 end end
Update my solution with output
# Math Methods # I worked on this challenge by myself. # Your Solution Below def add(num_1, num_2) num_1 + num_2 end def subtract(num_1, num_2) num_1 - num_2 end def multiply(num_1, num_2) num_1 * num_2 end def divide(num_1, num_2) num_1.to_f / num_2.to_f end
# Math Methods # I worked on this challenge by myself. # Your Solution Below def add(num_1, num_2) num_1 + num_2 end def subtract(num_1, num_2) num_1 - num_2 end def multiply(num_1, num_2) num_1 * num_2 end def divide(num_1, num_2) num_1.to_f / num_2.to_f end puts add(10, 2) puts subtract(10, 2) puts multipl...
Add spacing and y-min/max to bar chart sparkline example.
#!/usr/bin/env ruby # # Print a tiny bar chart and hide the axes using a div which is slightly # smaller than the chart image. # $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'smart_chart' width = 40 height = 20 chart = SmartChart::Bar.new( :width => width, :height => height, :data => ...
#!/usr/bin/env ruby # # Print a tiny bar chart and hide the axes using a div which is slightly # smaller than the chart image. # $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'smart_chart' width = 240 height = 20 chart = SmartChart::Bar.new( :width => width, :height => height, :y...
Change env variable name for mongo
require 'mongo' class MongoClient attr_reader = :client def initialize(params) @client = Mongo::Client.new(ENV['MONGOLAB_URI']) @params = params end def remove_previous_standups previous = @client[:standup] previous.find(name: @params[:user_name]).delete_many end def insert_recent_standu...
require 'mongo' class MongoClient attr_reader = :client def initialize(params) @client = Mongo::Client.new(ENV['MONGODB_URI']) @params = params end def remove_previous_standups previous = @client[:standup] previous.find(name: @params[:user_name]).delete_many end def insert_recent_standup...
Add suggested build environment packages for debian/ubuntu
# encoding: utf-8 node[:rtn_rbenv] ||= {} packages = [] packages << 'gcc' packages << 'git' case os[:family] when %r(debian|ubuntu) packages << 'zlib1g-dev' packages << 'libssl-dev' packages << 'libreadline6-dev' when %r(redhat|fedora) packages << 'zlib-devel' packages << 'openssl-devel' packages << 'rea...
# encoding: utf-8 node[:rtn_rbenv] ||= {} packages = [] packages << 'gcc' packages << 'git' case os[:family] when %r(debian|ubuntu) packages << 'autoconf' packages << 'bison' packages << 'build-essential' packages << 'libssl-dev' packages << 'libyaml-dev' packages << 'libreadline6-dev' packages << 'zli...
Add get_published for a single published post
module Cortex class Posts < Cortex::Resource def query(params = {}) client.get('/posts', params) end def feed(params = {}) client.get('/posts/feed', params) end def get(id) client.get("/posts/#{id}") end def save(post) client.save('/posts', post) end de...
module Cortex class Posts < Cortex::Resource def query(params = {}) client.get('/posts', params) end def feed(params = {}) client.get('/posts/feed', params) end def get(id) client.get("/posts/#{id}") end def get_published(id) client.get("/posts/feed/#{id}") ...
Load rb-inotify when jQuery is working, rather than when it's not.
require 'rbconfig' module FSSM::Support class << self def backend @@backend ||= case when mac? && !jruby? && carbon_core? 'FSEvents' when linux? && rb_inotify? 'Inotify' else 'Polling' end end def jruby? defined?(JRUBY_VERSION) ...
require 'rbconfig' module FSSM::Support class << self def backend @@backend ||= case when mac? && !jruby? && carbon_core? 'FSEvents' when linux? && rb_inotify? 'Inotify' else 'Polling' end end def jruby? defined?(JRUBY_VERSION) ...
Use mkdir_p instead of mkdir
module GrapeDoc class DOCGenerator attr_accessor :resources, :formatter, :single_file def initialize(resource_path) begin require resource_path self.load rescue LoadError => ex puts "#{ex}" end end def init_formatter ...
module GrapeDoc class DOCGenerator attr_accessor :resources, :formatter, :single_file def initialize(resource_path) begin require resource_path self.load rescue LoadError => ex puts "#{ex}" end end def init_formatter ...
Add rake task to export the entire trade db in csv files and then zipped
require 'zip' require 'fileutils' namespace :export do task :trade_db => :environment do RECORDS_PER_FILE = 500000 ntuples = RECORDS_PER_FILE offset = 0 i = 0 dir = 'tmp/trade_db_files/' FileUtils.mkdir_p dir begin while(ntuples == RECORDS_PER_FILE) do i = i + 1 query...
Add GET endpoint for builds
require 'sinatra' require 'json' require 'mail' class PGQuilter::Builder < Sinatra::Base # validate and store a build request; to be picked up by a worker post '/build' do payload = JSON.parse request.body.read base_sha = payload.delete "base_sha" patches = payload.delete "patches" if base_sha.ni...
require 'sinatra' require 'json' require 'mail' class PGQuilter::Builder < Sinatra::Base # validate and store a build request; to be picked up by a worker post '/builds' do payload = JSON.parse request.body.read base_sha = payload.delete "base_sha" patches = payload.delete "patches" if base_sha.n...
MAke sure categories have all the translations
RSpec.feature 'Category', type: :feature do describe 'when a category is assigned to tags' do let!(:ada) {FactoryBot.create(:published, topic_list: ['fruehling'])} let!(:pierre){FactoryBot.create(:published, topic_list: ['fruehling', 'sommer'])} let(:tag_fruehling) {ActsAsTaggableOn::Tag.find_by_name('fr...
RSpec.feature 'Category', type: :feature do describe 'when a category is assigned to tags' do let!(:ada) {FactoryBot.create(:published, topic_list: ['fruehling'])} let!(:pierre){FactoryBot.create(:published, topic_list: ['fruehling', 'sommer'])} let(:tag_fruehling) {ActsAsTaggableOn::Tag.find_by_name('fr...
Add flight info and add save_yesterday_info method
#!/usr/bin/env ruby class FlightInfo end
#!/usr/bin/env ruby class FlightInfo def self.save_yesterday_info haha = Alohaha.new haha.flights.each do |flight| if flight.datetime > Date.yesterday && flight.datetime < Date.today destination = Destination.find_or_create(flight.destination) other_route = Destination.find_or_create(fl...
Add rake as a development dependency
# -*- encoding: utf-8 -*- require File.expand_path('../lib/tinytable/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Leo Cassarani"] gem.email = ["leo.cassarani@me.com"] gem.description = %q{TODO: Write a gem description} gem.summary = %q{TODO: Write a gem summary} g...
# -*- encoding: utf-8 -*- require File.expand_path('../lib/tinytable/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Leo Cassarani"] gem.email = ["leo.cassarani@me.com"] gem.description = %q{TODO: Write a gem description} gem.summary = %q{TODO: Write a gem summary} g...
Add rspec file for smallest integer
require_relative "my_solution" describe 'smallest_integer' do it "returns nil when the array is empty ([])" do expect(smallest_integer([])).to be_nil end it "returns 0 when that is the only element in the array" do expect(smallest_integer([0])).to eq 0 end it "returns -10 when that is the only elem...
Change search back to start of word
require './lib/environment' require 'json' require 'tilt/erb' class Ordbook < Sinatra::Base use ElasticAPM::Middleware set :environment, ENVIRONMENT configure do enable :logging use Rack::CommonLogger, LOG end before do Database.logger = request.logger expires 500, :public, :must_revalidat...
require './lib/environment' require 'json' require 'tilt/erb' class Ordbook < Sinatra::Base use ElasticAPM::Middleware set :environment, ENVIRONMENT configure do enable :logging use Rack::CommonLogger, LOG end before do Database.logger = request.logger expires 500, :public, :must_revalidat...
Add some IPv4 nameservers for norbert
name "grifon" description "Role applied to all servers at Grifon" default_attributes( :accounts => { :users => { :alarig => { :status => :administrator }, :gizmo => { :status => :administrator }, :nemo => { :status => :administrator } } }, :hosted_by => "Grifon", :location => "Paris, ...
name "grifon" description "Role applied to all servers at Grifon" default_attributes( :accounts => { :users => { :alarig => { :status => :administrator }, :gizmo => { :status => :administrator }, :nemo => { :status => :administrator } } }, :hosted_by => "Grifon", :location => "Paris, ...
Test script to insert a row into a mock PHIN MS
require 'sequel' require 'csv' input = File.read ARGV[0] messages = CSV.parse(input, headers: true) row_hash = messages[0].to_h lower_row = {} row_hash.each_pair do |k, v| lower_row[k.downcase] = v end lower_row.delete('payloadbinarycontent') lower_row['action'] ||= 'test' lower_row['encryption'] ||= 'none' lowe...
Use the new test-utils name from Rails.
module WorkerMacros def use_workers after(:each) do old = Backend.mock Backend.mock = false Backend.wait_for_all_workers Backend.mock = old end end def disable_mocking before :each do Backend.mock = false end after :each do Backend.mock = true end en...
module WorkerMacros def use_workers after(:each) do old = Backend.mock Backend.mock = false Backend.wait_for_all_workers Backend.mock = old end end def disable_mocking before :each do Backend.mock = false end after :each do Backend.mock = true end en...
Set VCR to ignore localhost requests (breaks Poltergeist stuff)
require 'vcr' require 'webmock/cucumber' VCR.configure do |c| # Automatically filter all secure details that are stored in the environment ignore_env = %w{SHLVL RUNLEVEL GUARD_NOTIFY DRB COLUMNS USER LOGNAME LINES} (ENV.keys-ignore_env).select{|x| x =~ /\A[A-Z_]*\Z/}.each do |key| c.filter_sensitive_data("<#...
require 'vcr' require 'webmock/cucumber' VCR.configure do |c| # Automatically filter all secure details that are stored in the environment ignore_env = %w{SHLVL RUNLEVEL GUARD_NOTIFY DRB COLUMNS USER LOGNAME LINES} (ENV.keys-ignore_env).select{|x| x =~ /\A[A-Z_]*\Z/}.each do |key| c.filter_sensitive_data("<#...
Remove old helper that's now unused.
require 'htmlentities' module ApplicationHelper def page_title(artefact, publication=nil) if publication title = [publication.title, publication.alternative_title].find(&:present?) title = "Video - #{title}" if request.format.video? end [title, 'GOV.UK'].select(&:present?).join(" - ") end ...
module ApplicationHelper def page_title(artefact, publication=nil) if publication title = [publication.title, publication.alternative_title].find(&:present?) title = "Video - #{title}" if request.format.video? end [title, 'GOV.UK'].select(&:present?).join(" - ") end def wrapper_class(publ...
Use Rails 3's prefered interface while maintaining backwards compatibility.
ActionController::Routing::Routes.draw do |map| if Authorization::activate_authorization_rules_browser? map.resources :authorization_rules, :only => [:index], :collection => {:graph => :get, :change => :get, :suggest_change => :get} map.resources :authorization_usages, :only => :index end end
# Rails 3 depreciates ActionController::Routing::Routes routes = (Rails.respond_to?(:application) ? Rails.application.routes : ActionController::Routing::Routes) routes.draw do |map| if Authorization::activate_authorization_rules_browser? map.resources :authorization_rules, :only => [:index], :collectio...
Fix tests to match styles
class AddAuthorsOverlay < CardOverlay def add_author(author) find(".button-secondary", text: "ADD A NEW AUTHOR").click group = find('.add-author-form') within(group) do fill_in_author_form author find('.button-secondary', text: "DONE").click end expect(page).to have_no_css('.add-author...
class AddAuthorsOverlay < CardOverlay def add_author(author) find(".button-primary", text: "ADD A NEW AUTHOR").click group = find('.add-author-form') within(group) do fill_in_author_form author find('.button-secondary', text: "DONE").click end expect(page).to have_no_css('.add-author-f...
Add spec that change how to use library.
# -*- coding: utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe Userstream do before do @consumer = OAuth::Consumer.new('consumer key', 'consumer secret', site: 'https://userstream.twitter.com/') @access_token = OAuth::AccessToken.new(@consumer, 'oauth token', 'oauth token...
# -*- coding: utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe Userstream do before do Userstream.configure do |config| config.consumer_key = 'consumer key' config.consumer_secret = 'consumer secret' config.oauth_token = 'oauth token' config.oauth_toke...
Fix relying on activesupport in? method
module PublicActivity module ORM module ActiveRecord # The ActiveRecord model containing # details about recorded activity. class Activity < ::ActiveRecord::Base include Renderable self.table_name = PublicActivity.config.table_name self.abstract_class = true # De...
module PublicActivity module ORM module ActiveRecord # The ActiveRecord model containing # details about recorded activity. class Activity < ::ActiveRecord::Base include Renderable self.table_name = PublicActivity.config.table_name self.abstract_class = true # De...
Make sure $LOADED_FEATURES gets restored after create block
require "rubinius/toolset/version" module Rubinius module ToolSets # Create a new ToolSet, with an optional name. The ToolSet is yielded to # the optional block. def self.create(name=nil) @current = Module.new @current.const_set :ToolSet, @current if name name = name.to_s.split...
require "rubinius/toolset/version" module Rubinius module ToolSets # Create a new ToolSet, with an optional name. The ToolSet is yielded to # the optional block. def self.create(name=nil) @current = Module.new @current.const_set :ToolSet, @current if name name = name.to_s.split...
Copy only contents of folder.
set :css_dir, './stylesheets' set :js_dir, './javascripts' set :images_dir, './images' set :relative_links, true activate :automatic_image_sizes activate :relative_assets configure :development do activate :livereload end configure :build do activate :minify_css activate :minify_javascript # activate :asset_...
set :css_dir, './stylesheets' set :js_dir, './javascripts' set :images_dir, './images' set :relative_links, true activate :automatic_image_sizes activate :relative_assets configure :development do activate :livereload end configure :build do activate :minify_css activate :minify_javascript # activate :asset_...
Use higher timeout on Travis
require 'coveralls' Coveralls.wear! require 'maxitest/autorun' require 'shoulda-context' $LOAD_PATH.push File.expand_path("../../lib", __FILE__) require File.dirname(__FILE__) + '/../lib/simctl.rb'
require 'coveralls' Coveralls.wear! require 'maxitest/autorun' require 'shoulda-context' $LOAD_PATH.push File.expand_path("../../lib", __FILE__) require File.dirname(__FILE__) + '/../lib/simctl.rb' if ENV['TRAVIS'] SimCtl.default_timeout = 120 end
Change up the tests a bit
require 'test_helper' class MarkovTest < ActiveSupport::TestCase test "valid twitter user generates a dictionary" do user = User.create(twitter_username: "colinfike") Markov.create_twitter_markov_chain(user) assert user.markov_chain end test "bearer token as still valid" do response = RestClient...
require 'test_helper' class MarkovTest < ActiveSupport::TestCase test "valid twitter user generates a dictionary" do user = User.create(twitter_username: "colinfike") Markov.create_twitter_markov_chain(user) assert user.markov_chain end test "bearer token as still valid" do response = RestClient...
Check the page save the atempt
describe "GET /" do it "display welcome page" do visit root_path expect(page).to have_css("section h1", text: "Track your Bowling Scores") end context "start game" do it "show actual Round and Ball" do visit root_path click_link("btn-start") expect(page).to have_content("Round 1...
describe "GET /" do it "display welcome page" do visit root_path expect(page).to have_css("section h1", text: "Track your Bowling Scores") end context "start game" do it "show actual Round and Ball" do visit root_path click_link("btn-start") expect(page).to have_content("Round 1...
Add activesupport to gem dependency
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'konjak/version' Gem::Specification.new do |spec| spec.name = "konjak" spec.version = Konjak::VERSION spec.authors = ["Seiei Higa"] spec.email = ["hanachin@gma...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'konjak/version' Gem::Specification.new do |spec| spec.name = "konjak" spec.version = Konjak::VERSION spec.authors = ["Seiei Higa"] spec.email = ["hanachin@gma...
Make appraisal a development dependency rather than runtime
# -*- encoding: utf-8 -*- $:.push File.expand_path('../lib', __FILE__) require 'country_select/version' Gem::Specification.new do |s| s.name = 'country_select' s.version = CountrySelect::VERSION s.authors = ['Stefan Penner'] s.email = ['stefan.penner@gmail.com'] s.homepage = '' s.su...
# -*- encoding: utf-8 -*- $:.push File.expand_path('../lib', __FILE__) require 'country_select/version' Gem::Specification.new do |s| s.name = 'country_select' s.version = CountrySelect::VERSION s.authors = ['Stefan Penner'] s.email = ['stefan.penner@gmail.com'] s.homepage = '' s.su...
Change to use different formatting and remove auto spin
# encoding: utf-8 require 'tty-spinner' spinners = TTY::Spinner::Multi.new "[:spinner] main" spinners.auto_spin sp1 = spinners.register "[:spinner] one" sp2 = spinners.register "[:spinner] two" sp3 = spinners.register "[:spinner] three" th1 = Thread.new { 20.times { sleep(0.2); sp1.spin }} th2 = Thread.new { 30.ti...
# encoding: utf-8 require 'tty-spinner' spinners = TTY::Spinner::Multi.new "[:spinner] main", format: :pulse sp1 = spinners.register "[:spinner] one", format: :classic sp2 = spinners.register "[:spinner] two", format: :classic sp3 = spinners.register "[:spinner] three", format: :classic th1 = Thread.new { 20.times ...
Print current weather condition gets weather codtion from weather_obj form the map weather condition to the relevent terminal icon
module WeatherReporter class ConsolePrinter def initialize(weather_obj) @weather_obj = weather_obj end def print_to_console @weather_reporter end end end
module WeatherReporter include OutputFormatter class ConsolePrinter def initialize(weather_obj) @weather_obj = weather_obj end def print_to_console puts(condition_map[:"#{weather_condition}"]) end def weather_condition @weather_obj.current.condition.text end def co...
Add migration for foreign key constraint
class EducatorLabelsForeignKey < ActiveRecord::Migration[5.1] def change add_foreign_key "educator_labels", "educators", name: "educator_labels_educator_id_fk" end end
Update status check to use new Ionic header
module IonicNotification class StatusService include HTTParty base_uri IonicNotification.ionic_api_url attr_accessor :body def initialize(message_uuid) @message_uuid = message_uuid end def check_status! self.class.get("/push/notifications/#{@message_uuid}", payload) end ...
module IonicNotification class StatusService include HTTParty base_uri IonicNotification.ionic_api_url attr_accessor :body def initialize(message_uuid) @message_uuid = message_uuid end def check_status! self.class.get("/push/notifications/#{@message_uuid}", payload) end ...
Use fully qualified name when rescuing Sequel::Error
require "sequel/model" module Delayed module Serialization module Sequel def self.configure(klass) klass.class_eval do if YAML.parser.class.name =~ /syck/i yaml_as "tag:ruby.yaml.org,2002:Sequel" end end end if YAML.parser.class.name =~ /syck/i ...
require "sequel/model" module Delayed module Serialization module Sequel def self.configure(klass) klass.class_eval do if YAML.parser.class.name =~ /syck/i yaml_as "tag:ruby.yaml.org,2002:Sequel" end end end if YAML.parser.class.name =~ /syck/i ...
Add Georgia.roles with default roles
require "georgia/version" require "georgia/paths" require "georgia/engine" require "georgia/uploader/adapter" require "georgia/permissions" module Georgia mattr_accessor :templates @@templates = %w(default one-column sidebar-left sidebar-right) mattr_accessor :title @@title = "Georgia" mattr_accessor :url...
require "georgia/version" require "georgia/paths" require "georgia/engine" require "georgia/uploader/adapter" require "georgia/permissions" module Georgia mattr_accessor :templates @@templates = %w(default one-column sidebar-left sidebar-right) mattr_accessor :title @@title = "Georgia" mattr_accessor :url...
Fix stupid bug setting json as default params encoding method
module ApiRecipes module Settings GLOBAL_TIMEOUT = 1 FAIL_OPTIONS = [:return, :raise, :return_false] DEFAULT = { protocol: 'http', host: 'localhost', port: nil, base_path: '', api_version: '', timeout: 3, on_nok_code: :raise, routes: {} ...
module ApiRecipes module Settings GLOBAL_TIMEOUT = 1 FAIL_OPTIONS = [:return, :raise, :return_false] DEFAULT = { protocol: 'http', host: 'localhost', port: nil, base_path: '', api_version: '', timeout: 3, on_nok_code: :raise, routes: {} ...
Use Ruby keyword args in OrganisationalManualServiceRegistry
class OrganisationalManualServiceRegistry < AbstractManualServiceRegistry def initialize(dependencies) @organisation_slug = dependencies.fetch(:organisation_slug) end private attr_reader :organisation_slug def repository manual_repository_factory.call(organisation_slug) end def associationless_re...
class OrganisationalManualServiceRegistry < AbstractManualServiceRegistry def initialize(organisation_slug:) @organisation_slug = organisation_slug end private attr_reader :organisation_slug def repository manual_repository_factory.call(organisation_slug) end def associationless_repository as...
Set each key value as property and value
require 'intrinsic/version' require 'intrinsic/intrinsicism' require 'intrinsic/extrinsicism' module Intrinsic def self.included(subject) super subject.extend Intrinsicism subject.send :include, Intrinsicism end def initialize(values = {}) @properties = {}.merge self.class.defaults check_pro...
require 'intrinsic/version' require 'intrinsic/intrinsicism' require 'intrinsic/extrinsicism' module Intrinsic def self.included(subject) super subject.extend Intrinsicism subject.send :include, Intrinsicism end def initialize(values = {}) @properties = {}.merge self.class.defaults check_pro...
Improve stages index migration code readability
# frozen_string_literal: true # rubocop:disable Style/Documentation module Gitlab module BackgroundMigration class MigrateStageIndex module Migratable class Stage < ActiveRecord::Base self.table_name = 'ci_stages' end end def perform(start_id, stop_id) if Gitl...
# frozen_string_literal: true # rubocop:disable Style/Documentation module Gitlab module BackgroundMigration class MigrateStageIndex def perform(start_id, stop_id) migrate_stage_index_sql(start_id.to_i, stop_id.to_i).tap do |sql| ActiveRecord::Base.connection.execute(sql) end ...
Add GitHub as homepage in gemspec
Gem::Specification.new do |spec| spec.name = 'prefnerd' spec.version = '0.2' spec.authors = ['Greg Hurrell'] spec.email = ['greg@hurrell.net'] spec.summary = %q{Monitors the OS X defaults database for changes} spec.description = %q{ Are you an OS X prefnerd? Do you k...
Gem::Specification.new do |spec| spec.name = 'prefnerd' spec.version = '0.2' spec.authors = ['Greg Hurrell'] spec.email = ['greg@hurrell.net'] spec.homepage = 'https://github.com/wincent/prefnerd' spec.summary = %q{Monitors the OS X defaults database for changes} sp...
Add option for Travis CI test
require 'test_helper' class MysqlImportTest < Test::Unit::TestCase test 'It has a version number' do refute_nil ::MysqlImport::VERSION end sub_test_case '#import' do teardown do DbHelper.truncate('users') end test 'success' do client = MysqlImport.new(DbConfig.to_hash) client....
require 'test_helper' class MysqlImportTest < Test::Unit::TestCase test 'It has a version number' do refute_nil ::MysqlImport::VERSION end sub_test_case '#import' do teardown do DbHelper.truncate('users') end test 'success' do client = MysqlImport.new(DbConfig.to_hash, sql_opts: { l...
Add missing spec of resourceful module
require 'spec_helper' describe ElectricSheep::Shell::Resourceful do ResourcefulKlazz = Class.new do include ElectricSheep::Shell::Resourceful def initialize @host=ElectricSheep::Metadata::Host.new end end describe ResourcefulKlazz do def assert_resource_created(type, klazz, local_e...
Update rails dependency in order to work with Rails 3.2 RC1
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "searchify/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "searchify" s.version = Searchify::VERSION s.authors = ["Christian Blais"] s.email = ["christ.bl...
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "searchify/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "searchify" s.version = Searchify::VERSION s.authors = ["Christian Blais"] s.email = ["christ.bl...
Make sure cron is installed on Debian / Ubuntu
default['cron']['package_name'] = case node['platform_family'] when 'rhel', 'fedora' node['platform_version'].to_f >= 6.0 ? ['cronie'] : ['vixie-cron'] when 'solaris2' ['core-os'] ...
default['cron']['package_name'] = case node['platform_family'] when 'debian' ['cron'] when 'rhel', 'fedora' node['platform_version'].to_f >= 6.0 ? ['cronie'] : ['vixie-cron'] ...
Add a dependency on guard version 1, to prepare the migration to version 2
# -*- encoding: utf-8 -*- require File.expand_path('../lib/guard/zeus/version', __FILE__) Gem::Specification.new do |gem| gem.name = "guard-zeus" gem.version = Guard::ZeusVersion::VERSION gem.version = "#{gem.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS'] gem.platform ...
# -*- encoding: utf-8 -*- require File.expand_path('../lib/guard/zeus/version', __FILE__) Gem::Specification.new do |gem| gem.name = "guard-zeus" gem.version = Guard::ZeusVersion::VERSION gem.version = "#{gem.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS'] gem.platform ...
Use modern syntax for booking template factory.
Factory.define :booking_template do |b| end Factory.define :cash, :parent => :booking_template do |b| b.title 'Bareinnahmen' b.association :credit_account, :factory => :cash_account b.association :debit_account, :factory => :service_account b.code 'day:cash' b.matcher '[B|b]arein[z|Z]ahlung' end Factory.def...
FactoryGirl.define do factory :booking_template do factory :cash do title 'Bareinnahmen' association :credit_account, :factory => :cash_account association :debit_account, :factory => :service_account code 'day:cash' matcher '[B|b]arein[z|Z]ahlung' end factory :card_turnover...
Use form to get size.
module Ethon class Easy module Http # This module contains logic for setting up a [multipart] POST body. module Postable # Set things up when form is provided. # Deals with multipart forms. # # @example Setup. # post.set_form(easy) # # @param ...
module Ethon class Easy module Http # This module contains logic for setting up a [multipart] POST body. module Postable # Set things up when form is provided. # Deals with multipart forms. # # @example Setup. # post.set_form(easy) # # @param...
Add details to search by subscription code
require_relative '../../boot' # Find a Subscription by code # # You need to give AccountCredentials (EMAIL, TOKEN) and the subscription code # # P.S: See the boot file example for more details. credentials = PagSeguro::AccountCredentials.new('user@example.com', 'TOKEN') subscription = PagSeguro::Subscription.find_by_...
require_relative '../../boot' # Find a Subscription by code # # You need to give AccountCredentials (EMAIL, TOKEN) and the subscription code # # P.S: See the boot file example for more details. email = 'user@example.com' token = 'TOKEN' code = 'CODE' credentials = PagSeguro::AccountCredentials.new(email, token) subs...
Use MEDIUMTEXT(16MB) type when Mysql is used
class CreateCiJobTraceChunks < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = false def change create_table :ci_job_trace_chunks, id: :bigserial do |t| t.integer :job_id, null: false t.integer :chunk_index, null: false t.integer :data_store, null: false ...
class CreateCiJobTraceChunks < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = false def change create_table :ci_job_trace_chunks, id: :bigserial do |t| t.integer :job_id, null: false t.integer :chunk_index, null: false t.integer :data_store, null: false ...
Use cancancan baked-in aliases to simplify further
# typed: strict # frozen_string_literal: true class ScraperAbility extend T::Sig include CanCan::Ability sig { params(owner: T.nilable(Owner)).void } def initialize(owner) # Everyone can list all (non private) scrapers can %i[index show], Scraper, private: false return unless owner can :dat...
# typed: strict # frozen_string_literal: true class ScraperAbility extend T::Sig include CanCan::Ability sig { params(owner: T.nilable(Owner)).void } def initialize(owner) # Everyone can list all (non private) scrapers can :read, Scraper, private: false return unless owner can :data, Scrape...
Correct database field in invoice
class CreateInvoices < ActiveRecord::Migration def change create_table :invoices do |t| t.integer :amount t.type :string t.date :due_date t.date :paid_date t.date :received_date t.integer :payer_id t.integer :receiver_id t.timestamps end end end
class CreateInvoices < ActiveRecord::Migration def change create_table :invoices do |t| t.integer :amount t.string :type t.date :due_date t.date :paid_date t.date :received_date t.integer :payer_id t.integer :receiver_id t.timestamps end end end
Move the config.rb to this repo
require 'capistrano_colors' # Main set :application, "" set :use_sudo, true set :admin_runner, "" set :keep_releases, 5 default_run_options[:pty] = true # Stages set :stage_dir, "app/config/deploy" set :stages, %w{production staging} set :default_stage, "production" require 'capistrano/ext/multistage' set :deploy_to...
Add ssl_verify_mode to Chef config
CURRENT_PATH = File.expand_path(File.dirname(__FILE__)) file_cache_path "#{CURRENT_PATH}/cache" cookbook_path CURRENT_PATH verbose_logging false
CURRENT_PATH = File.expand_path(File.dirname(__FILE__)) file_cache_path "#{CURRENT_PATH}/cache" cookbook_path CURRENT_PATH verbose_logging false ssl_verify_mode :verify_peer
Fix `url` stanza comment for Lektor.
cask 'lektor' do version '1.2.1' sha256 'd6d984eddcefcae9397e1fb10d96f2fd61324a9f2a7008cea4edad2ee8743feb' # github.com/lektor/lektor verified as official when first introduced to the cask url "https://github.com/lektor/lektor/releases/download/#{version}/Lektor-#{version}.dmg" appcast 'https://github.com/le...
cask 'lektor' do version '1.2.1' sha256 'd6d984eddcefcae9397e1fb10d96f2fd61324a9f2a7008cea4edad2ee8743feb' # github.com/lektor/lektor was verified as official when first introduced to the cask url "https://github.com/lektor/lektor/releases/download/#{version}/Lektor-#{version}.dmg" appcast 'https://github.co...
Enable generated image to handle missing source files
# Generated Image # Represents a generated source file. class GeneratedImage require 'mini_magick' require 'fastimage' def initialize(source_file:, width:, format:) @source = source_file @width = width @format = format generate_image unless File.exist? absolute_filename end def name na...
# Generated Image # Represents a generated source file. class GeneratedImage require 'mini_magick' require 'fastimage' attr_reader :width def initialize(source_file:, width:, format:) @source = source_file @width = width @format = format generate_image unless skip_generation? end def na...
Add spec for default delivery status
require 'rails_helper' RSpec.describe Order, type: :model do it 'creates successfully' do customer = Customer.create(first_name: 'Jon', last_name: 'Chen') order = customer.orders.create expect(order).to be_truthy end end
require 'rails_helper' RSpec.describe Order, type: :model do customer = Customer.create(first_name: 'Jon', last_name: 'Chen') order = customer.orders.create it 'creates successfully' do expect(order).to be_truthy end it 'defaults status to waiting for delivery' do expect(order.status).to eq(0) en...
Add checks to ensure the service is running.
require 'spec_helper_system' describe 'apache class' do it 'should install apache' do if system_node.facts['osfamily'] == 'Debian' system_run('dpkg --get-selections | grep apache2') do |r| r.stdout.should =~ /^apache2\s+install$/ r.exit_code.should == 0 end elsif system_node.facts...
require 'spec_helper_system' describe 'apache class' do it 'should install apache' do if system_node.facts['osfamily'] == 'Debian' system_run('dpkg --get-selections | grep apache2') do |r| r.stdout.should =~ /^apache2\s+install$/ r.exit_code.should == 0 end elsif system_node.fact...
Stop confusing exception when AndSon can't bind to a server
require 'socket' require 'sanford-protocol' module AndSon class Connection < Struct.new(:host, :port) module NoRequest def self.to_s; "[?]"; end end def open protocol_connection = Sanford::Protocol::Connection.new(tcp_socket) yield protocol_connection if block_given? ensure ...
require 'socket' require 'sanford-protocol' module AndSon class Connection < Struct.new(:host, :port) module NoRequest def self.to_s; "[?]"; end end def open protocol_connection = Sanford::Protocol::Connection.new(tcp_socket) yield protocol_connection if block_given? ensure ...
Update require statement to match new location of railtie.rb. Update to use ruby 2.5 include
# frozen_string_literal: true require 'active_support' require 'active_record' require 'delayed_job' require 'delayed_job_active_record' require 'delayed/job_groups/compatibility' require 'delayed/job_groups/job_extensions' require 'delayed/job_groups/job_group' require 'delayed/job_groups/plugin' require 'delayed/job...
# frozen_string_literal: true require 'active_support' require 'active_record' require 'delayed_job' require 'delayed_job_active_record' require 'delayed/job_groups/compatibility' require 'delayed/job_groups/job_extensions' require 'delayed/job_groups/job_group' require 'delayed/job_groups/plugin' require 'delayed/job...
Fix reference issues in accepting multiple messages
require 'optparse' require 'ostruct' class TimerCLI def self.parse(args) options = OpenStruct.new options.messages = {} opt_parser = OptionParser.new do |opts| opts.banner = "Usage: subtime [options]" opts.separator "" opts.separator "Specific options:" opts.on("-m", "--minute...
require 'optparse' require 'ostruct' class TimerCLI def self.parse(args) options = OpenStruct.new options.messages = {} opt_parser = OptionParser.new do |opts| opts.banner = "Usage: subtime [options]" opts.separator "" opts.separator "Specific options:" opts.on("-m", "--minute...
Include gem_downloads to remove n+1 for versions.downloads_count
class Api::V1::ActivitiesController < Api::BaseController def latest versions = Version.new_pushed_versions(50) render_rubygems(versions) end def just_updated versions = Version.just_updated(50) render_rubygems(versions) end private def render_rubygems(versions) rubygems = versions.in...
class Api::V1::ActivitiesController < Api::BaseController def latest versions = Version.new_pushed_versions(50) render_rubygems(versions) end def just_updated versions = Version.just_updated(50) render_rubygems(versions) end private def render_rubygems(versions) rubygems = versions.in...
Rollback should happen in the same registry that received commit
require "gluer/registration_hook" module Gluer class Registration attr_accessor :name def initialize(definition, context, args, block) @definition = definition @context = context @args = args @block = block @committed = false end def commit commit_hook.call(regis...
require "gluer/registration_hook" module Gluer class Registration attr_accessor :name def initialize(definition, context, args, block) @definition = definition @context = context @args = args @block = block @committed = false end def commit registry.tap do |regis...