diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/nexmo.gemspec b/nexmo.gemspec
index abc1234..def5678 100644
--- a/nexmo.gemspec
+++ b/nexmo.gemspec
@@ -10,6 +10,6 @@ s.files = Dir.glob('{lib,spec}/**/*') + %w(README.md nexmo.gemspec)
s.add_development_dependency('rake', '>= 0.9.3')
s.add_development_dependency('mocha', '~> 0.13.2')
- s.add_development_dependency('webmock', '~> 1.17.0')
+ s.add_development_dependency('webmock', '~> 1.18.0')
s.require_path = 'lib'
end
| Tweak version of dependency on webmock gem to eliminate addressable warnings
Webmock 1.18.0 depends on addressable >= 2.3.6, which includes this fix:
https://github.com/sporkmonger/addressable/pull/146
|
diff --git a/hsluv.gemspec b/hsluv.gemspec
index abc1234..def5678 100644
--- a/hsluv.gemspec
+++ b/hsluv.gemspec
@@ -11,6 +11,7 @@ spec.homepage = 'https://github.com/hsluv/hsluv-ruby'
spec.license = 'MIT'
+ spec.files = Dir['lib/**/*']
spec.require_paths = ['lib']
spec.add_development_dependency 'bundler', '~> 1.8'
| Add source files to the gem.
Currently, installing this gem simply yields an empty directory:
$ gem install hsluv
Successfully installed hsluv-1.0.0
1 gem installed
$ gem contents hsluv
$
After:
$ gem build hsluv.gemspec
<snip>
$ gem install hsluv
Successfully installed hsluv-1.0.0
1 gem installed
$ gem contents hsluv
$HOME/.gem/ruby/2.3.3/gems/hsluv-1.0.0/lib/hsluv.rb
$
|
diff --git a/flow/net/android/response.rb b/flow/net/android/response.rb
index abc1234..def5678 100644
--- a/flow/net/android/response.rb
+++ b/flow/net/android/response.rb
@@ -10,7 +10,7 @@ end
def body
- @response.toString
+ @body ||= build_body
end
def status_message
@@ -18,5 +18,22 @@
def headers
end
+
+ def json?
+ mime_type.match /application\/json/
+ end
+
+ def mime_type
+ @connection.getContentType
+ end
+
+ private
+
+ def build_body
+ if json?
+ return JSON.load(@response.toString)
+ end
+ @response.toString
+ end
end
end
| Support for mime_type and json on android
|
diff --git a/spec/ruby-progressbar/calculators/running_average_spec.rb b/spec/ruby-progressbar/calculators/running_average_spec.rb
index abc1234..def5678 100644
--- a/spec/ruby-progressbar/calculators/running_average_spec.rb
+++ b/spec/ruby-progressbar/calculators/running_average_spec.rb
@@ -1,11 +1,19 @@-require 'spec_helper'
+require 'rspectacular'
+require 'ruby-progressbar/calculators/running_average'
-describe ProgressBar::Calculators::RunningAverage do
- describe '.calculate' do
- it 'calculates properly' do
- expect(ProgressBar::Calculators::RunningAverage.calculate(4.5, 12, 0.1)).to be_within(0.001).of 11.25
- expect(ProgressBar::Calculators::RunningAverage.calculate(8.2, 51, 0.7)).to be_within(0.001).of 21.04
- expect(ProgressBar::Calculators::RunningAverage.calculate(41.8, 100, 0.59)).to be_within(0.001).of 65.662
- end
+class ProgressBar
+module Calculators
+describe RunningAverage do
+ it 'can properly calculate a running average' do
+ first_average = RunningAverage.calculate(4.5, 12, 0.1)
+ expect(first_average).to be_within(0.001).of 11.25
+
+ second_average = RunningAverage.calculate(8.2, 51, 0.7)
+ expect(second_average).to be_within(0.001).of 21.04
+
+ third_average = RunningAverage.calculate(41.8, 100, 0.59)
+ expect(third_average).to be_within(0.001).of 65.662
end
end
+end
+end
| Refactor: Update running average calculator specs to new format
--------------------------------------------------------------------------------
Branch: refactor/massive-update
Signed-off-by: Jeff Felchner <8a84c204e2d4c387d61d20f7892a2bbbf0bc8ae8@thekompanee.com>
|
diff --git a/db/migrate/20170110105205_add_organization_to_group.rb b/db/migrate/20170110105205_add_organization_to_group.rb
index abc1234..def5678 100644
--- a/db/migrate/20170110105205_add_organization_to_group.rb
+++ b/db/migrate/20170110105205_add_organization_to_group.rb
@@ -3,7 +3,7 @@ add_reference :groups, :organization, foreign_key: true
Group.all.each do |group|
- if group.tasks.any?
+ if group.tasks.any? && group.tasks.first.organization
group.organization = group.tasks.first.organization
group.save!
else
| Fix migration for tasks without an organization
|
diff --git a/Casks/screenstagram.rb b/Casks/screenstagram.rb
index abc1234..def5678 100644
--- a/Casks/screenstagram.rb
+++ b/Casks/screenstagram.rb
@@ -2,11 +2,14 @@ version '2.01'
sha256 '5cb9f7be247fdec897248f5091818bf7b25153fa99782e96f9d9b2c2431cdbb1'
- # screenstagram.s3.amazonaws.com was verified as official when first introduced to the cask
url "https://screenstagram.s3.amazonaws.com/screenstagram_#{version}.dmg"
name 'Screenstagram'
homepage 'https://screenstagram.s3.amazonaws.com/download.html'
license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder
screen_saver 'Screenstagram 2.saver'
+
+ caveats do
+ discontinued
+ end
end
| Fix `url` stanza comment for Screenstagram 2.
|
diff --git a/spec/implementation/app/controllers/authors_controller.rb b/spec/implementation/app/controllers/authors_controller.rb
index abc1234..def5678 100644
--- a/spec/implementation/app/controllers/authors_controller.rb
+++ b/spec/implementation/app/controllers/authors_controller.rb
@@ -4,14 +4,14 @@ include Rails.application.routes.url_helpers
def index
- render :nothing => true
+ head :ok
end
def restricted
- render :nothing => true, :status => 401
+ head :unauthorized
end
def disallowed
- render :nothing => true, :status => 403
+ head :forbidden
end
end
| Use head :ok instead of render: nothing
|
diff --git a/Casks/adobe-air.rb b/Casks/adobe-air.rb
index abc1234..def5678 100644
--- a/Casks/adobe-air.rb
+++ b/Casks/adobe-air.rb
@@ -1,5 +1,5 @@ cask :v1 => 'adobe-air' do
- version '16.0'
+ version '17.0'
sha256 :no_check # required as upstream package is updated in-place
url "http://airdownload.adobe.com/air/mac/download/#{version}/AdobeAIR.dmg"
| Upgrade Adobe AIR to v17.0
|
diff --git a/Casks/near-lock.rb b/Casks/near-lock.rb
index abc1234..def5678 100644
--- a/Casks/near-lock.rb
+++ b/Casks/near-lock.rb
@@ -0,0 +1,11 @@+cask :v1 => 'near-lock' do
+ version :latest
+ sha256 :no_check
+
+ url 'http://nearlock.me/downloads/nearlock.dmg'
+ name 'Near Lock'
+ homepage 'http://nearlock.me/'
+ license :gratis
+
+ app 'Near Lock.app'
+end
| Add cask for Near Lock application
|
diff --git a/lib/application_responder.rb b/lib/application_responder.rb
index abc1234..def5678 100644
--- a/lib/application_responder.rb
+++ b/lib/application_responder.rb
@@ -3,8 +3,4 @@ class ApplicationResponder < ActionController::Responder
include Responders::FlashResponder
include Responders::HttpCacheResponder
-
- # Redirects resources to the collection path (index action) instead
- # of the resource path (show action) for POST/PUT/DELETE requests.
- # include Responders::CollectionResponder
end
| Remove default comments from ApplicationResponder
|
diff --git a/lib/archivable/controller.rb b/lib/archivable/controller.rb
index abc1234..def5678 100644
--- a/lib/archivable/controller.rb
+++ b/lib/archivable/controller.rb
@@ -7,13 +7,13 @@ extend ActiveSupport::Concern
def archive
- set_model_instance_variable
- get_model_instance_variable.toggle(:archived)
+ archivable_model = set_model_instance_variable
+ archivable_model.toggle(:archived)
- if get_model_instance_variable.save
- render :show, notice: get_archivable_flash(get_model_instance_variable, success: true)
+ if archivable_model.save
+ render :show, notice: get_archivable_flash(archivable_model, success: true)
else
- render :show, alert: get_archivable_flash(get_model_instance_variable, success: false)
+ render :show, alert: get_archivable_flash(archivable_model, success: false)
end
end
| Clean up some more logic.
|
diff --git a/lib/bnr/webhooks/receiver.rb b/lib/bnr/webhooks/receiver.rb
index abc1234..def5678 100644
--- a/lib/bnr/webhooks/receiver.rb
+++ b/lib/bnr/webhooks/receiver.rb
@@ -20,7 +20,7 @@ @source = source
@api_key = api_key
@worker = worker
- @event = headers.fetch('X-BNR-Webhook-Event-Name')
+ @event = headers.fetch('X-BNR-Webhook-Event-Name')
@signature = headers.fetch('X-BNR-Webhook-Signature')
@event_handler = event_directory.fetch(event)
end
@@ -42,7 +42,7 @@ private
def process_async
- worker.process(event_handler, event, parsed_source)
+ worker.call(event_handler, event, parsed_source)
end
def process_now
| Use `call` instead of `process` by convention.
|
diff --git a/EmitterKit.podspec b/EmitterKit.podspec
index abc1234..def5678 100644
--- a/EmitterKit.podspec
+++ b/EmitterKit.podspec
@@ -10,7 +10,8 @@ s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
s.tvos.deployment_target = '9.0'
-
+ s.watchos.deployment_target = '2.0'
+
s.source_files = 'src/*.{h,swift}'
s.requires_arc = true
| Add watchOS to the podspec
|
diff --git a/server/app/graphql/types/query_type.rb b/server/app/graphql/types/query_type.rb
index abc1234..def5678 100644
--- a/server/app/graphql/types/query_type.rb
+++ b/server/app/graphql/types/query_type.rb
@@ -18,8 +18,12 @@ description "Find Restaurants by Latitude and Longitude"
resolve ->(obj, args, ctx) {
results = Restaurant.find_by_geolocation(args[:lat], args[:lon])
- ids = results['hits']['hits'].pluck("_id")
- Restaurant.where(id: ids).order("field(id, " + ids.join(",") + ")")
+ if results['hits']['total'] > 0
+ ids = results['hits']['hits'].pluck("_id")
+ Restaurant.where(id: ids).order("field(id, " + ids.join(",") + ")")
+ else
+ []
+ end
}
end
end
| Return empty array when no resutls
Signed-off-by: Andres Garcia <a32ab6d0ea593a061705598410d773d0d3e9ce01@gmail.com>
|
diff --git a/sukremore.gemspec b/sukremore.gemspec
index abc1234..def5678 100644
--- a/sukremore.gemspec
+++ b/sukremore.gemspec
@@ -10,7 +10,7 @@ spec.email = ["oliver.hv@coditramuntana.com"]
spec.description = %q{Client for the Rest SugarCRM webservice.}
spec.summary = %q{In this very first version only limited access to Account and Contact models is implemented.}
- spec.homepage = "www.coditramuntana.com"
+ spec.homepage = "http://www.coditramuntana.com"
spec.license = "MIT"
spec.files = `git ls-files`.split($/)
| [FIX] Correct gemspec homepage, it must be a uri.
|
diff --git a/lib/data_paths/data_paths.rb b/lib/data_paths/data_paths.rb
index abc1234..def5678 100644
--- a/lib/data_paths/data_paths.rb
+++ b/lib/data_paths/data_paths.rb
@@ -14,7 +14,7 @@ # The directories which contain static content.
#
def DataPaths.paths
- @@data_paths ||= []
+ @data_paths ||= []
end
def DataPaths.register(path)
| Make that an instance variable.
|
diff --git a/db/migrate/20210211162218_add_lighthouse_sample_cog_uk_id_index.rb b/db/migrate/20210211162218_add_lighthouse_sample_cog_uk_id_index.rb
index abc1234..def5678 100644
--- a/db/migrate/20210211162218_add_lighthouse_sample_cog_uk_id_index.rb
+++ b/db/migrate/20210211162218_add_lighthouse_sample_cog_uk_id_index.rb
@@ -1,3 +1,7 @@+# frozen_string_literal: true
+
+#
+# Add index for cog uk id
class AddLighthouseSampleCogUkIdIndex < ActiveRecord::Migration[6.0]
def change
change_table :lighthouse_sample, bulk: true do |t|
| Add index for cog uk id
|
diff --git a/Formula/kdelibs.rb b/Formula/kdelibs.rb
index abc1234..def5678 100644
--- a/Formula/kdelibs.rb
+++ b/Formula/kdelibs.rb
@@ -1,9 +1,9 @@ require 'formula'
class Kdelibs <Formula
- url 'ftp://ftp.kde.org/pub/kde/stable/4.4.0/src/kdelibs-4.4.0.tar.bz2'
+ url 'ftp://ftp.kde.org/pub/kde/stable/4.4.1/src/kdelibs-4.4.1.tar.bz2'
homepage 'http://www.kde.org/'
- md5 '957bca85de744a9ddd316fd85e882b40'
+ md5 '5057908fb9dcf7997a87fe27a382bfc9'
depends_on 'cmake'
depends_on 'qt'
@@ -25,8 +25,4 @@ system "cmake .. #{std_cmake_parameters} -DCMAKE_PREFIX_PATH=#{gettext.prefix}"
system "make install"
end
-
- def patches
- { :p4 => "http://websvn.kde.org/branches/KDE/4.4/kdelibs/plasma/private/applethandle_p.h?r1=1095725&r2=1095724&pathrev=1095725&view=patch" }
- end
end
| Update KDELibs to 4.4.1 and remove patch due to automoc4 fixes.
|
diff --git a/db/data_migration/20220812212927_backfill_latest_edition_and_live_edition_on_document.rb b/db/data_migration/20220812212927_backfill_latest_edition_and_live_edition_on_document.rb
index abc1234..def5678 100644
--- a/db/data_migration/20220812212927_backfill_latest_edition_and_live_edition_on_document.rb
+++ b/db/data_migration/20220812212927_backfill_latest_edition_and_live_edition_on_document.rb
@@ -0,0 +1,12 @@+# Populate latest_edition_id and live_edition_id for documents that don't have them defined
+all_documents = Document.where(latest_edition_id: nil, live_edition_id: nil)
+total = all_documents.count
+
+@logger.info "There are #{total} documents to populate"
+
+done = 0
+all_documents.find_in_batches do |documents|
+ documents.each(&:update_edition_references)
+ done += documents.count
+ @logger.info "Done #{done}/#{total} (#{((done / total.to_f) * 100).to_i}%)"
+end
| Add data migration to backfill edition references
|
diff --git a/spec/integration/config_loader_spec.rb b/spec/integration/config_loader_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/config_loader_spec.rb
+++ b/spec/integration/config_loader_spec.rb
@@ -5,39 +5,36 @@
context 'config loaded with production deployment setting' do
- before do
- @config = described_class.load(path, 'production')
- end
+ let(:config) { described_class.load(path, 'production') }
it 'exposes production value' do
- expect(@config[:some_service]).to eq(host: 'some_service.production.com')
+ expect(config[:some_service]).to eq(host: 'some_service.production.com')
end
end
context 'config loaded with development deployment setting' do
- before do
- @config = described_class.load(path, 'development')
- end
+ let(:config) { described_class.load(path, 'development') }
it 'exposes development value' do
- expect(@config[:some_service]).to eq(host: 'localhost')
+ expect(config[:some_service]).to eq(host: 'localhost')
end
end
context 'with ENV variables declared' do
+ let(:config) { described_class.load(path, 'flexible') }
+
before do
ENV['FOO'] = 'foo-value'
- @config = described_class.load(path, 'flexible')
end
it 'exposes ENV defined value' do
- expect(@config[:foo]).to eq('foo-value')
+ expect(config[:foo]).to eq('foo-value')
end
it 'exposes undefined ENV values as nil' do
- expect(@config[:undefine_val]).to be_nil
+ expect(config[:undefine_val]).to be_nil
end
end
| Replace instance variables with `let` declarations
|
diff --git a/test/test_calc.rb b/test/test_calc.rb
index abc1234..def5678 100644
--- a/test/test_calc.rb
+++ b/test/test_calc.rb
@@ -21,4 +21,12 @@ def test_more_complex_expression
assert_equal 10, calc("10 DIV 2 PLUS 6 MINUS 1")
end
+
+ def test_precedence_ascending
+ assert_equal 23, calc("4 TIMES 5 PLUS 3")
+ end
+
+ def test_order_of_precedence_decending
+ assert_equal 23, calc("3 PLUS 4 TIMES 5")
+ end
end
| Add spec for order of presedence
|
diff --git a/kalki.gemspec b/kalki.gemspec
index abc1234..def5678 100644
--- a/kalki.gemspec
+++ b/kalki.gemspec
@@ -20,4 +20,5 @@
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
+ spec.add_dependency "grape"
end
| Add grape as a dependency
|
diff --git a/lib/minitest/timer_plugin.rb b/lib/minitest/timer_plugin.rb
index abc1234..def5678 100644
--- a/lib/minitest/timer_plugin.rb
+++ b/lib/minitest/timer_plugin.rb
@@ -0,0 +1,22 @@+module Minitest
+
+ def self.plugin_timer_init(options)
+ self.reporter << TimerReporter.new(options)
+ end
+
+ class TimerReporter < AbstractReporter
+ MAX_TIME_ALLOWED = 2
+ def initialize(*args); end
+ def start
+ @start_time = Time.now
+ end
+ def report
+ @total_time = Time.now - @start_time
+ raise "Tests took too long (#{@total_time}s)" unless passed?
+ end
+ def passed?
+ @total_time <= MAX_TIME_ALLOWED
+ end
+ end
+
+end
| Add timer plugin to ensure tests run in parallel.
|
diff --git a/lib/mongoff/pretty_errors.rb b/lib/mongoff/pretty_errors.rb
index abc1234..def5678 100644
--- a/lib/mongoff/pretty_errors.rb
+++ b/lib/mongoff/pretty_errors.rb
@@ -15,11 +15,9 @@ {}
end
if (associations[name.to_s] || associations[name.to_sym]).many?
- association_errors = record.send(name).map do |associated|
- model.pretty_errors(associated)
- end
- if association_errors.any?(&:present?)
- errors[name].merge!(association_errors)
+ record.send(name).each_with_index do |associated, index|
+ next unless (associated_errors = model.pretty_errors(associated)).present?
+ errors[name][index] = associated_errors
end
else
association_errors = model.pretty_errors(record.send(name))
| Fix | Pretty errors for many associations
|
diff --git a/lib/stack_master/prompter.rb b/lib/stack_master/prompter.rb
index abc1234..def5678 100644
--- a/lib/stack_master/prompter.rb
+++ b/lib/stack_master/prompter.rb
@@ -6,6 +6,7 @@ if StackMaster.stdin.tty? && StackMaster.stdout.tty?
StackMaster.stdin.getch.chomp
else
+ StackMaster.stdout.puts
StackMaster.stdout.puts "STDOUT or STDIN was not a TTY. Defaulting to no. To force yes use -f"
'n'
end
| Add additional puts to end the previous line |
diff --git a/cookbooks/php/attributes/default.rb b/cookbooks/php/attributes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/php/attributes/default.rb
+++ b/cookbooks/php/attributes/default.rb
@@ -1,2 +1,6 @@-default[:php][:version] = "7.4"
+default[:php][:version] = if node[:lsb][:release].to_f < 22.04
+ "7.4"
+ else
+ "8.1"
+ end
default[:php][:fpm][:options] = {}
| Use PHP 8.1 on Ubuntu 22.04
|
diff --git a/libraries/random_password.rb b/libraries/random_password.rb
index abc1234..def5678 100644
--- a/libraries/random_password.rb
+++ b/libraries/random_password.rb
@@ -0,0 +1,82 @@+#
+# Cookbook Name:: openssl
+# Library:: random_password
+# Author:: Seth Vargo <sethvargo@gmail.com>
+#
+# Copyright 2015, Seth Vargo
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+module OpenSSLCookbook
+ module RandomPassword
+ # Override the included method to require securerandom if it is not defined.
+ # This avoids the need to load the class on each Chef run unless the user is
+ # explicitly requiring it.
+ def self.included(base)
+ require 'securerandom' unless defined?(SecureRandom)
+ end
+
+ class InvalidPasswordMode < StandardError
+ def initialize(given, acceptable)
+ super <<-EOH
+The given password mode '#{given}' is not valid. Valid password modes are :hex,
+:base64, and :random_bytes!
+EOH
+ end
+ end
+
+ #
+ # Generates a random password using {SecureRandom}.
+ #
+ # @example Generating a random (hex) password (of 20 characters)
+ # random_password #=> "1930e99aa035083bdd93d1d8f11cb7ac8f625c9c"
+ #
+ # @example Generating a random base64 password that is 50 characters
+ # random_password(mode: :base64, length: 50) #=> "72o5oVbKHHEVYj1nOgFB2EijnzZfnrbfasVuF+oRH8wMgb0QWoYZF/OkrQricp1ENoI="
+ #
+ # @example Generate a password with a forced encoding
+ # random_password(encoding: "ASCII")
+ #
+ # @param [Hash] options
+ # @option options [Fixnum] :length
+ # the number of bits to use in the password
+ # @option options [Symbol] :mode
+ # the type of random password to generate - valid values are
+ # `:hex`, `:base64`, or `:random_bytes`
+ # @option options [String, Symbol, Constant] :encoding
+ # the encoding to force (default is "UTF-8")
+ #
+ # @return [String]
+ #
+ def random_password(options = {})
+ length = options[:length] || 20
+ mode = options[:mode] || :hex
+ encoding = options[:encoding] || "UTF-8"
+
+ # Convert to a "proper" length, since the size is actually in bytes
+ length = case mode
+ when :hex
+ length / 2
+ when :base64
+ length * 3 / 4
+ when :random_bytes
+ length
+ else
+ raise InvalidPasswordMode.new(mode)
+ end
+
+ SecureRandom.send(mode, length).force_encoding(encoding)
+ end
+ end
+end
| Add a new library for generating random passwords
|
diff --git a/core/module/method_added_spec.rb b/core/module/method_added_spec.rb
index abc1234..def5678 100644
--- a/core/module/method_added_spec.rb
+++ b/core/module/method_added_spec.rb
@@ -35,7 +35,7 @@ end
it "is not called when a method is undefined in self" do
- Module.new do
+ m = Module.new do
def method_to_undef
end
@@ -45,5 +45,6 @@
undef_method :method_to_undef
end
+ m.should_not have_method(:method_to_undef)
end
end
| Add missing behavior expectation in last spec.
|
diff --git a/plugins/provisioners/docker/cap/redhat/docker_install.rb b/plugins/provisioners/docker/cap/redhat/docker_install.rb
index abc1234..def5678 100644
--- a/plugins/provisioners/docker/cap/redhat/docker_install.rb
+++ b/plugins/provisioners/docker/cap/redhat/docker_install.rb
@@ -7,7 +7,12 @@ machine.communicate.tap do |comm|
comm.sudo("yum -q -y update")
comm.sudo("yum -q -y remove docker-io* || true")
- comm.sudo("curl -sSL https://get.docker.com/ | sh")
+ if machine.guest.capability("flavor") == :rhel_8
+ # containerd.io is not available on official yum repos
+ # install it directly from docker
+ comm.sudo("yum -y install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm")
+ end
+ comm.sudo("curl -fsSL https://get.docker.com/ | sh")
end
case machine.guest.capability("flavor")
| Install containerd.io from docker on rhel_8
containerd.io is required for docker howerver it is not avilable
in official yum repos. It needs to be installed directly from
docker.
ref:
https://docs.docker.com/install/linux/docker-ce/centos/
https://linuxconfig.org/how-to-install-docker-in-rhel-8
|
diff --git a/db/seeds/tracks/full_stack_rails.rb b/db/seeds/tracks/full_stack_rails.rb
index abc1234..def5678 100644
--- a/db/seeds/tracks/full_stack_rails.rb
+++ b/db/seeds/tracks/full_stack_rails.rb
@@ -3,7 +3,7 @@
track = create_or_update_track(
title: "Full Stack Ruby on Rails",
- description: "This track takes you through our entire curriculum. You'll learn everything you need to know to create beautiful responsive websites from scratch. This is our default track. If you do not know where to start, select this track.",
+ description: "This track takes you through our entire Ruby on Rails curriculum. You'll learn everything you need to know to create beautiful responsive websites from scratch. This is our default track. If you do not know where to start, select this track.",
position: 1,
default: true,
)
| Update Ruby on Rails track description
The original wording stated that the Ruby on Rails track takes a student
though the entire curriculum. With NodeJS as an option this is not
longer correct. This clarifies the track as specific to Ruby on Rails
|
diff --git a/lib/potassium/templates/application/recipes/testing.rb b/lib/potassium/templates/application/recipes/testing.rb
index abc1234..def5678 100644
--- a/lib/potassium/templates/application/recipes/testing.rb
+++ b/lib/potassium/templates/application/recipes/testing.rb
@@ -25,3 +25,7 @@
run "guard init"
end
+
+gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false\n/ do
+ "config.action_mailer.raise_delivery_errors = true"
+end
| feat(): Change raise mail exceptions to true
|
diff --git a/lib/buoys/loader.rb b/lib/buoys/loader.rb
index abc1234..def5678 100644
--- a/lib/buoys/loader.rb
+++ b/lib/buoys/loader.rb
@@ -13,6 +13,7 @@ def buoy(key, &block)
buoys[key] = block
end
+ alias_method :crumb, :buoy
def buoys
@buoys ||= {}
| Add `crumb` as alias of `buoy`
|
diff --git a/qsagi.gemspec b/qsagi.gemspec
index abc1234..def5678 100644
--- a/qsagi.gemspec
+++ b/qsagi.gemspec
@@ -8,9 +8,9 @@ gem.version = Qsagi::VERSION
gem.authors = ["Braintree"]
gem.email = ["code@getbraintree.com"]
- gem.description = %q{TODO: Write a gem description}
- gem.summary = %q{TODO: Write a gem summary}
- gem.homepage = ""
+ gem.description = "A friendly way to talk to RabbitMQ"
+ gem.summary = "A friendly way to talk to RabbitMQ"
+ gem.homepage = "https://github.com/braintree/qsagi"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
| Update description, summary, and homepage in the gemspec
|
diff --git a/lib/email_notify.rb b/lib/email_notify.rb
index abc1234..def5678 100644
--- a/lib/email_notify.rb
+++ b/lib/email_notify.rb
@@ -8,7 +8,7 @@
begin
email = NotificationMailer.comment(comment, user)
- email.deliver
+ email.deliver_now
rescue => err
logger.error "Unable to send comment email: #{err.inspect}"
end
@@ -19,7 +19,7 @@
begin
email = NotificationMailer.article(article, user)
- email.deliver
+ email.deliver_now
rescue => err
logger.error "Unable to send article email: #{err.inspect}"
end
@@ -29,7 +29,7 @@ def self.send_user_create_notification(user)
begin
email = NotificationMailer.notif_user(user)
- email.deliver
+ email.deliver_now
rescue => err
logger.error "Unable to send notification of create user email: #{err.inspect}"
end
| Replace deprecated deliver with deliver now
|
diff --git a/lib/marty/logger.rb b/lib/marty/logger.rb
index abc1234..def5678 100644
--- a/lib/marty/logger.rb
+++ b/lib/marty/logger.rb
@@ -1,27 +1,60 @@ class Marty::Logger
include Delorean::Model
- def self.method_missing(m, *args, &block)
- return super unless
- [:debug, :info, :warn, :error, :fatal, :unknown].include?(m)
-
- Marty::Util.logger.send(m, args[0]) if Marty::Util.logger.respond_to?(m)
- log(m, *args)
+ delorean_fn :dllog, sig: [2, 20] do |*args|
+ info args[0], args[1..-1]
end
- def self.log(type, message, details = nil)
- Marty::Log.write_log(type, message, details)
- end
+ class << self
+ def log_event(event_name, *args)
+ if Marty::Util.logger.respond_to?(event_name)
+ Marty::Util.logger.send(
+ event_name,
+ args[0]
+ )
+ end
- def self.with_logging(error_message, error_data)
+ log(event_name, *args)
+ end
+
+ def debug(*args)
+ log_event(:debug, *args)
+ end
+
+ def info(*args)
+ log_event(:info, *args)
+ end
+
+ def warn(*args)
+ log_event(:warn, *args)
+ end
+
+ def error(*args)
+ log_event(:error, *args)
+ end
+
+ def fatal(*args)
+ log_event(:fatal, *args)
+ end
+
+ def unknown(*args)
+ log_event(:unknown, *args)
+ end
+
+ def log(type, message, details = nil)
+ Marty::Log.write_log(type, message, details)
+ end
+
+ def with_logging(error_message, error_data)
yield
- rescue StandardError => e
- error(error_message, 'message' => e.message,
- 'data' => error_data)
+ rescue StandardError => e
+ error(
+ error_message,
+ 'message' => e.message,
+ 'data' => error_data
+ )
+
raise "#{error_message}: #{e.message}"
- end
-
- delorean_fn :dllog, sig: [2, 20] do |*args|
- info args[0], args[1..-1]
+ end
end
end
| Refactor Marty::Logger: define methods instead of using method_missing
|
diff --git a/lib/mgraph/graph.rb b/lib/mgraph/graph.rb
index abc1234..def5678 100644
--- a/lib/mgraph/graph.rb
+++ b/lib/mgraph/graph.rb
@@ -51,7 +51,7 @@ end
def vertices
- @edges.map(&:vertices).reduce(:+)
+ vertex_edges.keys.to_set
end
private
| Use vertex_edges to get vertices instead of recalculating
|
diff --git a/lib/rack/timeout.rb b/lib/rack/timeout.rb
index abc1234..def5678 100644
--- a/lib/rack/timeout.rb
+++ b/lib/rack/timeout.rb
@@ -1,5 +1,5 @@ require RUBY_VERSION < '1.9' && RUBY_PLATFORM != 'java' ? 'system_timer' : 'timeout'
-SystemTimer ||= Timeout
+Timeout ||= SystemTimer
module Rack
class Timeout
@@ -13,7 +13,7 @@ end
def call(env)
- SystemTimer.timeout(self.class.timeout, ::Timeout::Error) { @app.call(env) }
+ ::Timeout.timeout(self.class.timeout, ::Timeout::Error) { @app.call(env) }
end
end
| Swap around Timeout and SystemTimer for clarity since Timeout is what most people actually end up with nowadays. This doesn't really change anything functionality-wise.
|
diff --git a/lib/rmega/crypto.rb b/lib/rmega/crypto.rb
index abc1234..def5678 100644
--- a/lib/rmega/crypto.rb
+++ b/lib/rmega/crypto.rb
@@ -9,5 +9,12 @@ include AesEcb
include AesCtr
include Rsa
+
+ # Check if all the used ciphers are supported
+ ciphers = OpenSSL::Cipher.ciphers.map(&:upcase)
+ %w[AES-128-CBC AES-128-CTR AES-128-ECB].each do |name|
+ next if ciphers.include?(name)
+ warn "WARNING: Your Ruby is compiled with OpenSSL #{OpenSSL::VERSION} and does not support cipher #{name}."
+ end
end
end
| Check if all the used ciphers are supported
|
diff --git a/lib/tasks/cron.rake b/lib/tasks/cron.rake
index abc1234..def5678 100644
--- a/lib/tasks/cron.rake
+++ b/lib/tasks/cron.rake
@@ -6,7 +6,7 @@ end
task :start_workers, [:worker_count] => :environment do | t, args |
- args.with_defaults(:worker_count => 2)
+ args.with_defaults(:worker_count => 1)
exec %Q[script/delayed_job start -n "#{args[:worker_count]}"]
end
| Set default worker count to 1
|
diff --git a/Formula/midgard2-php.rb b/Formula/midgard2-php.rb
index abc1234..def5678 100644
--- a/Formula/midgard2-php.rb
+++ b/Formula/midgard2-php.rb
@@ -2,7 +2,7 @@
class Midgard2Php < Formula
url 'http://www.midgard-project.org/midcom-serveattachmentguid-025abaac43f811e0b064792d116f21f421f4/php5-midgard2-10.05.4.tar.gz'
- head 'git://github.com/midgardproject/midgard-php5.git', :branch => 'ratatoskr'
+ head 'https://github.com/midgardproject/midgard-php5.git', :branch => 'ratatoskr'
homepage 'http://www.midgard-project.org/'
md5 'a715d76abdb6ef1bb5eb8c9973fbba16'
| Use https for github repos.
|
diff --git a/Formula/go.rb b/Formula/go.rb
index abc1234..def5678 100644
--- a/Formula/go.rb
+++ b/Formula/go.rb
@@ -7,10 +7,6 @@ aka 'google-go'
skip_clean 'bin'
-
- def download_strategy
- MercurialDownloadStrategy
- end
def cruft
%w[src include test doc]
| Remove explicit download strategy from Go.
|
diff --git a/lib/flickr.rb b/lib/flickr.rb
index abc1234..def5678 100644
--- a/lib/flickr.rb
+++ b/lib/flickr.rb
@@ -13,21 +13,23 @@ Photoset.new_collection(response.body['photosets']['photoset'])
end
- def find_user_by_email(email)
- response = client.find_user_by_email(email)
- response = client.get_user_info(response.body['user']['nsid'])
+ def find_user_by_id(user_id)
+ response = client.get_user_info(user_id)
User.new(response.body['person'])
end
- def find_user_by_username(username)
- response = client.find_user_by_username(username)
- response = client.get_user_info(response.body['user']['nsid'])
- User.new(response.body['person'])
- end
+ def get_user_id(options)
+ if options[:email].nil? and options[:username].nil?
+ raise ArgumentError, "'email' or 'username' must be present"
+ end
- def find_user_by_id(user_id)
- response = client.get_user_info(user_id)
- User.new(response.body['person'])
+ response = if options[:email]
+ client.find_user_by_email(options[:email])
+ else
+ client.find_user_by_username(options[:username])
+ end
+
+ response.body['user']['id']
end
def find_photoset_by_id(photoset_id)
| Make finding user by email or username more intuitive
|
diff --git a/lib/how_is.rb b/lib/how_is.rb
index abc1234..def5678 100644
--- a/lib/how_is.rb
+++ b/lib/how_is.rb
@@ -10,8 +10,13 @@ require 'how_is/analyzer'
require 'how_is/reporter'
- Contract C::KeywordArgs[repository: String, report_file: String] => Report
- def self.generate_report(repository:, report_file:, from_file: nil,
+ Contract C::KeywordArgs[repository: String, report_file: String,
+ from_file: C::Optional[C::Or[String, nil]],
+ fetcher: C::Optional[Class],
+ analyzer: C::Optional[Class],
+ reporter: C::Optional[Class]] => Report
+ def self.generate_report(repository:, report_file:,
+ from_file: nil,
fetcher: Fetcher.new,
analyzer: Analyzer.new,
reporter: Reporter.new)
| Make generate_report() actually work if you pass optional arguments.
|
diff --git a/app/controllers/oauths_controller.rb b/app/controllers/oauths_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/oauths_controller.rb
+++ b/app/controllers/oauths_controller.rb
@@ -10,11 +10,15 @@
user_info = JSON.parse(response.body)
- @user = User.find_or_create_by(email: user_info["email"], password_digest: "wasistdas")
- @user.update(name: user_info["name"])
+ @user = User.find_by(email: user_info["email"])
+ if @user
+ @user.update(name: user_info["name"])
+ else
+ @user = User.create(name: user_info["name"], email: user_info["email"], password:'wasistdas', password_digest: 'wasistdas' )
+ end
session[:current_user] = @user.id
+ redirect_to user_path(@user)
- redirect_to user_path(@user)
end
private
| Fix User Authentication For oAuth
|
diff --git a/app/controllers/places_controller.rb b/app/controllers/places_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/places_controller.rb
+++ b/app/controllers/places_controller.rb
@@ -9,7 +9,6 @@ end
def show
- authorize! :read, @place
end
def edit
| Change permissions for read place
|
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -4,17 +4,29 @@ end
def create
- @preferences = UserPreferences.new( params )
+ begin
+ @preferences = UserPreferences.new( params )
- if @preferences.empty?
- redirect_to controller: :ppd, action: :index
- else
- start = Time.now
- @query_command = QueryCommand.new( @preferences )
- @query_command.load_query_results
- @time_taken = ((Time.now - start) * 1000).to_i
+ if @preferences.empty?
+ redirect_to controller: :ppd, action: :index
+ else
+ start = Time.now
+ @query_command = QueryCommand.new( @preferences )
+ @query_command.load_query_results
+ @time_taken = ((Time.now - start) * 1000).to_i
- render template: "ppd/error" unless @query_command.success?
+ render template: "ppd/error" unless @query_command.success?
+ end
+ rescue => e
+ uuid = SecureRandom.uuid
+
+ Rails.logger.error "Top-level error trap in search_controller #{uuid}"
+ Rails.logger.error "Query error #{uuid} ::: #{e.message}"
+ Rails.logger.error "Query error #{uuid} ::: #{e.backtrace.join("\n")}"
+
+ @error_message = "The log file reference for this error is: #{uuid}."
+ render template: "ppd/error"
+
end
end
end
| Add error trap to try to diagnose WSOD problem
|
diff --git a/app/interactions/pulitzer/create_post_type_content_elements.rb b/app/interactions/pulitzer/create_post_type_content_elements.rb
index abc1234..def5678 100644
--- a/app/interactions/pulitzer/create_post_type_content_elements.rb
+++ b/app/interactions/pulitzer/create_post_type_content_elements.rb
@@ -9,8 +9,11 @@ def call
post_type.posts.each do |post|
post.preview_version.content_elements.create do |ce|
- ce.label = ptcet.label
- ce.content_element_type = ptcet.content_element_type
+ ce.label = ptcet.label
+ ce.height = ptcet.height
+ ce.width = ptcet.width
+ ce.text_editor = ptcet.text_editor
+ ce.content_element_type = ptcet.content_element_type
ce.post_type_content_element_type = ptcet
end
end
| Add new content elements setup to post type content elements |
diff --git a/app/models/form_answer_attachment.rb b/app/models/form_answer_attachment.rb
index abc1234..def5678 100644
--- a/app/models/form_answer_attachment.rb
+++ b/app/models/form_answer_attachment.rb
@@ -31,7 +31,7 @@ def virus_scan
if ENV["DISABLE_VIRUS_SCANNER"] == "true"
Scan.create(
- filename: attachment.current_path,
+ filename: file.current_path,
uuid: SecureRandom.uuid,
audit_certificate_id: id,
status: "clean"
@@ -39,7 +39,7 @@ else
response = ::VirusScanner::File.scan_url(attachment.url)
Scan.create(
- filename: attachment.current_path,
+ filename: file.current_path,
uuid: response["id"],
status: response["status"],
audit_certificate_id: id
| Fix FormAnswerAttachment which uses file not attachment
|
diff --git a/app/models/repository_status_item.rb b/app/models/repository_status_item.rb
index abc1234..def5678 100644
--- a/app/models/repository_status_item.rb
+++ b/app/models/repository_status_item.rb
@@ -10,5 +10,5 @@ inverse_of: :created_repository_status_types
belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User', optional: true,
inverse_of: :modified_repository_status_types
- has_many :repository_status_values, inverse_of: :repository_status_item, dependent: :delete_all
+ has_many :repository_status_values, inverse_of: :repository_status_item, dependent: :destroy
end
| Fix repository status item deletion issue [SCI-4212]
|
diff --git a/app/presenters/document_presenter.rb b/app/presenters/document_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/document_presenter.rb
+++ b/app/presenters/document_presenter.rb
@@ -11,20 +11,24 @@ end
def date_metadata
- {
+ date_metadata = {
"Opened date" => opened_date,
"Closed date" => closed_date,
"Updated at" => updated_at,
}
+
+ date_metadata.reject { |_, value| value.blank? }
end
def metadata
- {
+ metadata = {
"Market sector" => market_sector,
"Case type" => case_type,
"Case state" => case_state.capitalize,
"Outcome type" => outcome_type,
}
+
+ metadata.reject { |_, value| value.blank? }
end
end
| Add a reject for blank metadata values
|
diff --git a/test/fixtures/cookbooks/jenkins_server_wrapper/recipes/default.rb b/test/fixtures/cookbooks/jenkins_server_wrapper/recipes/default.rb
index abc1234..def5678 100644
--- a/test/fixtures/cookbooks/jenkins_server_wrapper/recipes/default.rb
+++ b/test/fixtures/cookbooks/jenkins_server_wrapper/recipes/default.rb
@@ -7,11 +7,11 @@ # jdk-tool is required by Jenkins version 2.112
jenkins_plugins = %w(
mailer
- credentials
- ssh-credentials
ssh-slaves
jdk-tool
+ display-url-api
)
+
jenkins_plugins.each do |plugin|
jenkins_plugin plugin do
notifies :execute, 'jenkins_command[safe-restart]', :immediately
| Update minimum plugins to test Jenkins
Signed-off-by: Josh Barker <88d7d21fa8a250d4e915db098658a3f5a42acdfb@gmail.com>
|
diff --git a/spec/integration/aws_sqs_client_spec.rb b/spec/integration/aws_sqs_client_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/aws_sqs_client_spec.rb
+++ b/spec/integration/aws_sqs_client_spec.rb
@@ -0,0 +1,37 @@+require 'spec_helper'
+require 'digest'
+
+describe Aws::SQS::Client do
+ subject(:aws_client) {
+ Aws::SQS::Client.new(
+ access_key_id: ENV['AWS_ACCESS_KEY_ID'],
+ secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
+ region: ENV['AWS_REGION']
+ )
+ }
+
+ it "is configured with valid credentials and region" do
+ expect { aws_client.list_queues }.to_not raise_error
+ end
+
+ describe "message dispatching" do
+ let(:queue_name) { "RailsEbJob-integration-testing" }
+ let(:queue_url) do
+ response = aws_client.create_queue(queue_name: queue_name)
+ response.queue_url
+ end
+ let(:message_content) { "this is the content of the message" }
+ let(:md5_digest) { Digest::MD5.hexdigest(message_content) }
+
+ describe "#send_message" do
+ it "is successful" do
+ response = aws_client.send_message(
+ message_body: message_content,
+ queue_url: queue_url
+ )
+
+ expect(response.md5_of_message_body).to match(md5_digest)
+ end
+ end
+ end
+end
| Test message sending to an AWS SQS queue
|
diff --git a/lib/gimme/method_resolver.rb b/lib/gimme/method_resolver.rb
index abc1234..def5678 100644
--- a/lib/gimme/method_resolver.rb
+++ b/lib/gimme/method_resolver.rb
@@ -3,21 +3,31 @@ class MethodResolver
def self.resolve_sent_method(double,sym,args,raises_no_method_error=true)
cls = double.cls
- sym = args.shift if sym == :send
+ sym = args.shift if sym == :send
if cls && raises_no_method_error
- if cls.private_methods.include?(sym.to_s)
+ if cls.private_methods.include?(named(sym))
raise NoMethodError.new("#{sym} is a private method of your #{cls} test double, so stubbing/verifying it
might not be a great idea. If you want to try to stub or verify this method anyway, then you can
- invoke give! or verify! to suppress this error.")
- elsif !cls.instance_methods.include?(sym.to_s)
- raise NoMethodError.new("Your test double of #{cls} may not know how to respond to the '#{sym}' method.
+ invoke give! or verify! to suppress this error.")
+ elsif !cls.instance_methods.include?(named(sym))
+ raise NoMethodError.new("Your test double of #{cls} may not know how to respond to the '#{sym}' method.
If you're confident that a real #{cls} will know how to respond to '#{sym}', then you can
- invoke give! or verify! to suppress this error.")
+ invoke give! or verify! to suppress this error.")
end
end
sym
end
+
+ if RUBY_VERSION >= "1.9.2"
+ def self.named(sym)
+ sym
+ end
+ else
+ def self.named(sym)
+ sym.to_s
+ end
+ end
end
-end+end
| Check for existing method based on the Ruby version.
|
diff --git a/lib/import/import_samples.rb b/lib/import/import_samples.rb
index abc1234..def5678 100644
--- a/lib/import/import_samples.rb
+++ b/lib/import/import_samples.rb
@@ -4,7 +4,7 @@ def self.import_samples_from_file(file_path, collection_id)
ActiveRecord::Base.transaction do
xlsx = Roo::Spreadsheet.open(file_path)
- rows = xlsx.parse(name: "Name", description: "Beschreibung", smiles: "Smiles")
+ rows = xlsx.parse(name: "Name", description: "Description", smiles: "Smiles", value: "Value")
rows.shift
rows.map do |row|
molfile = Chemotion::PubchemService.molfile_from_smiles row[:smiles]
@@ -14,7 +14,7 @@ raise "Import of Sample #{row[:name]}: Molecule is nil."
end
- sample = Sample.create(name: row[:name], description: row[:description], molecule: molecule)
+ sample = Sample.create(name: row[:name], description: row[:description], molecule: molecule, imported_readout: row[:value])
CollectionsSample.create(collection_id: collection_id, sample_id: sample.id)
end
end
| Add imported_readout into import of samples
|
diff --git a/lib/invoker/power/powerup.rb b/lib/invoker/power/powerup.rb
index abc1234..def5678 100644
--- a/lib/invoker/power/powerup.rb
+++ b/lib/invoker/power/powerup.rb
@@ -12,8 +12,8 @@ EM.run {
trap("TERM") { stop }
trap("INT") { stop }
- DNS.run(listen: DNS.server_ports)
- Balancer.run()
+ DNS.new.run(listen: DNS.server_ports)
+ Balancer.run
}
end
| Use DNS.new for starting DNS Server
|
diff --git a/lib/liquid/mediafile_drop.rb b/lib/liquid/mediafile_drop.rb
index abc1234..def5678 100644
--- a/lib/liquid/mediafile_drop.rb
+++ b/lib/liquid/mediafile_drop.rb
@@ -5,7 +5,7 @@ class_inheritable_reader :liquid_attributes
write_inheritable_attribute :liquid_attributes, [:id]
- liquid_attributes << :title << :caption << :date << :authors_list
+ liquid_attributes << :title << :caption << :date << :authors_list << :mediafile_type
def initialize(source, options = {})
super source
| Add mediafile type to mediafile drop
|
diff --git a/lib/rrj/rabbit/base_event.rb b/lib/rrj/rabbit/base_event.rb
index abc1234..def5678 100644
--- a/lib/rrj/rabbit/base_event.rb
+++ b/lib/rrj/rabbit/base_event.rb
@@ -16,6 +16,8 @@ #
# @abstract Publish message in RabbitMQ
class BaseEvent
+ attr_reader :responses
+
# Define a base publisher
def initialize
@responses = []
@@ -27,7 +29,7 @@
private
- attr_accessor :semaphore, :lock, :responses
+ attr_accessor :semaphore, :lock
def return_response
@semaphore.wait
| Change accessibility to responses variables
|
diff --git a/lib/spork/server/cucumber.rb b/lib/spork/server/cucumber.rb
index abc1234..def5678 100644
--- a/lib/spork/server/cucumber.rb
+++ b/lib/spork/server/cucumber.rb
@@ -1,19 +1,34 @@ class Spork::Server::Cucumber < Spork::Server
CUCUMBER_PORT = 8990
CUCUMBER_HELPER_FILE = File.join(Dir.pwd, "features/support/env.rb")
-
+
class << self
def port
CUCUMBER_PORT
end
-
+
def helper_file
CUCUMBER_HELPER_FILE
end
+
+ # REMOVE WHEN SUPPORT FOR PRE-0.4 IS DROPPED
+ attr_accessor :step_mother
end
-
+
+ # REMOVE WHEN SUPPORT FOR PRE-0.4 IS DROPPED
+ def step_mother
+ self.class.step_mother
+ end
+
def run_tests(argv, stderr, stdout)
- require 'cucumber/cli/main'
- ::Cucumber::Cli::Main.new(argv, stdout, stderr).execute!(::Cucumber::StepMother.new)
+ begin
+ require 'cucumber/cli/main'
+ ::Cucumber::Cli::Main.new(argv, stdout, stderr).execute!(::Cucumber::StepMother.new)
+ rescue NoMethodError => pre_cucumber_0_4 # REMOVE WHEN SUPPORT FOR PRE-0.4 IS DROPPED
+ ::Cucumber::Cli::Main.step_mother = step_mother
+ ::Cucumber::Cli::Main.new(argv, stdout, stderr).execute!(step_mother)
+ end
end
end
+
+Spork::Server::Cucumber.step_mother = self # REMOVE WHEN SUPPORT FOR PRE-0.4 IS DROPPED | Add back support for pre Cucumber 0.4
|
diff --git a/db/migrate/20130403003950_add_last_activity_column_into_project.rb b/db/migrate/20130403003950_add_last_activity_column_into_project.rb
index abc1234..def5678 100644
--- a/db/migrate/20130403003950_add_last_activity_column_into_project.rb
+++ b/db/migrate/20130403003950_add_last_activity_column_into_project.rb
@@ -4,7 +4,13 @@ add_index :projects, :last_activity_at
Project.find_each do |project|
- project.update_attribute(:last_activity_at, project.last_activity_date)
+ last_activity_date = if project.last_activity
+ project.last_activity.created_at
+ else
+ project.updated_at
+ end
+
+ project.update_attribute(:last_activity_at, last_activity_date)
end
end
| Improve migration AddLastActivityColumnIntoProject to use real last activity date if present
|
diff --git a/ATV.podspec b/ATV.podspec
index abc1234..def5678 100644
--- a/ATV.podspec
+++ b/ATV.podspec
@@ -9,5 +9,8 @@ s.source = { :git => "https://github.com/pnc/ATV.git", :branch => "master" }
s.platform = :ios, '4.3'
+ s.framework = 'CoreData'
+ s.requires_arc = true
+
s.source_files = 'ATV/*.{h,m}'
end
| Declare ARC and CoreData dependencies
|
diff --git a/db/migrate/20151024050327_remove_confirmation_token_from_user.rb b/db/migrate/20151024050327_remove_confirmation_token_from_user.rb
index abc1234..def5678 100644
--- a/db/migrate/20151024050327_remove_confirmation_token_from_user.rb
+++ b/db/migrate/20151024050327_remove_confirmation_token_from_user.rb
@@ -0,0 +1,12 @@+class RemoveConfirmationTokenFromUser < ActiveRecord::Migration
+ def change
+ remove_column :users, :confirmation_token, :string
+ remove_column :users, :confirmed_at, :datetime
+ remove_column :users, :confirmation_sent_at, :datetime
+ remove_column :users, :unconfirmed_email, :string
+ end
+
+ def down
+ remove_index :users, :confirmation_token, :users
+ end
+end
| Add migration file to remove confimation
|
diff --git a/app.rb b/app.rb
index abc1234..def5678 100644
--- a/app.rb
+++ b/app.rb
@@ -29,6 +29,17 @@ redirect "/"
end
end
+
+ # FIXME: This is for development purposes only.
+ # Must be removed when going to production.
+ get "/test" do
+ data = { company: "komppania",
+ email: "meili@a.b"
+ }
+ html = erb(:pdf, locals: {crystal: data})
+ file = Printer.create_pdf(html, data[:company])
+ send_file(file)
+ end
end
| Add test path for quicly testing PDF.
|
diff --git a/app.rb b/app.rb
index abc1234..def5678 100644
--- a/app.rb
+++ b/app.rb
@@ -0,0 +1,63 @@+require 'rubygems'
+require 'sinatra'
+require 'json'
+
+post '/' do
+ content_type :json
+
+ text = params[:text]
+ user_name = params[:user_name]
+ channel_name = params[:channel_name]
+ timestamp = params[:timestamp]
+
+ response = Slacker::Bot.handle(text, user_name, channel_name, timestamp)
+ JSON.generate({text: response}) if response
+end
+
+get '/' do
+ content_type :json
+ JSON.generate({text: 'Hello from Slacker!'})
+end
+
+module Slacker
+ class Bot
+ @@plugins = Array.new
+
+ class <<self
+ def plugins
+ @@plugins
+ end
+
+ def register(plugin)
+ @@plugins << plugin.new
+ end
+
+ def handle(text, user_name, channel_name, timestamp)
+ response = Array.new
+
+ @@plugins.each do |plugin|
+ if plugin.pattern =~ text
+ response << plugin.respond(text, user_name, channel_name, timestamp)
+ end
+ end
+
+ return response
+ end
+ end
+ end
+
+ class Plugin
+ def pattern
+ //
+ end
+
+ def handle(text, user_name, channel_name, timestamp)
+ ''
+ end
+ end
+
+ Dir.glob('plugins/**/*.rb').each do |f|
+ load f
+ end
+end
+
| Add initial structure, responding with plugins
|
diff --git a/groovehq.gemspec b/groovehq.gemspec
index abc1234..def5678 100644
--- a/groovehq.gemspec
+++ b/groovehq.gemspec
@@ -13,7 +13,8 @@ spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0")
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
+ spec.bindir = "exe"
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.required_ruby_version = '>= 2.0'
| Set /exe as executable dir in gemspec
Consistent with more recent changes in bundler. See:
http://bundler.io/blog/2015/03/20/moving-bins-to-exe.html
|
diff --git a/db/migrate/20110513100648_add_existing_resource_network.rb b/db/migrate/20110513100648_add_existing_resource_network.rb
index abc1234..def5678 100644
--- a/db/migrate/20110513100648_add_existing_resource_network.rb
+++ b/db/migrate/20110513100648_add_existing_resource_network.rb
@@ -0,0 +1,13 @@+class AddExistingResourceNetwork < ActiveRecord::Migration
+ def self.up
+ people = Person.all
+ people.each do |person|
+ person.items.each do |item|
+ ResourceNetwork.create!(:entity_id => person.id, :entity_type_id => 1, :resource_id => item.id, :resource_type_id => 2)
+ end
+ end
+ end
+
+ def self.down
+ end
+end
| Add existing items to resource network
|
diff --git a/LeetCode/clone_graph.rb b/LeetCode/clone_graph.rb
index abc1234..def5678 100644
--- a/LeetCode/clone_graph.rb
+++ b/LeetCode/clone_graph.rb
@@ -2,8 +2,11 @@ #
class Node < Struct.new(:label, :neighbors)
+ attr_accessor :link
+
def inspect
- "#{label} #{neighbors.map{|x| x.label}}"
+ str_link = link.nil? ? "x" : link.label
+ "#{label} link:#{str_link} #{neighbors.map{|x| x.label}}"
end
end
@@ -38,5 +41,37 @@ return result
end
+def bfs(x, block)
+ queue = [x]
+ visited = Set.new
+ visited.add(x)
+ puts "--- Linking to new nodes ---"
+ while queue.any?
+ current = queue.shift
+ block.call(current, visited)
+ current.neighbors.each {|x|
+ if !visited.include?(x)
+ visited.add(x)
+ queue.push(x)
+ end
+ }
+ end
+end
+
+def clone(x)
+ result = x
+ bfs(x, -> (x, visited) { x.link = Node.new(x.label)})
+ bfs(x, -> (x, visited) { x.neighbors.each {|y|
+ if visited.include?(y)
+ y = y.link
+ end
+ }})
+ bfs(x, -> (x,visited) { x = x.link })
+
+ x
+end
+
puts nodes.inspect
puts bfs_string(nodes[0])
+puts bfs_string(clone(nodes[0]))
+puts nodes.inspect
| Clone a graph with 3 parameterized bfs. Leetcode solutions specifies using a hash like a peasant
|
diff --git a/lib/chef/azure/chefhandlers/exception_handler.rb b/lib/chef/azure/chefhandlers/exception_handler.rb
index abc1234..def5678 100644
--- a/lib/chef/azure/chefhandlers/exception_handler.rb
+++ b/lib/chef/azure/chefhandlers/exception_handler.rb
@@ -1,5 +1,6 @@ require 'chef/log'
require 'chef/azure/helpers/shared'
+require 'json'
module AzureExtension
class ExceptionHandler < Chef::Handler
@@ -13,11 +14,19 @@
def report
if run_status.failed?
+ load_run_list if not File.exists?("#{bootstrap_directory}/node-registered")
load_azure_env
message = "Check log file for details...\nBacktrace:\n"
message << Array(backtrace).join("\n")
- report_heart_beat_to_azure(AzureHeartBeat::READY, 0, "chef-service is running properly. Chef client run failed with error- #{message}")
+ report_heart_beat_to_azure(AzureHeartBeat::READY, 0, "chef-service is running properly. Chef client run failed with error- #{message}")
end
+ end
+
+ def load_run_list
+ first_boot = File.read("#{bootstrap_directory}/first-boot.json")
+ first_boot = JSON.parse(first_boot)
+ run_list = first_boot["run_list"]
+ node.run_list.reset!(run_list)
end
end
end
| Save runlist if first chef-client run fails
|
diff --git a/monkeylearn.gemspec b/monkeylearn.gemspec
index abc1234..def5678 100644
--- a/monkeylearn.gemspec
+++ b/monkeylearn.gemspec
@@ -12,7 +12,7 @@
spec.version = '3.3.1'
- spec.add_dependency 'faraday', '>= 0.9.2', '<= 0.15.0'
+ spec.add_dependency 'faraday', '>= 0.9.2', '< 1.0.0'
spec.licenses = ['MIT']
| Remove top version constraint on Faraday
|
diff --git a/test/integration/pretty_print_test.rb b/test/integration/pretty_print_test.rb
index abc1234..def5678 100644
--- a/test/integration/pretty_print_test.rb
+++ b/test/integration/pretty_print_test.rb
@@ -5,17 +5,27 @@ GirFFI.setup :Regress
describe "Pretty-printing" do
+ def assert_syntax_ok str
+ tmp = Tempfile.new "gir_ffi"
+ tmp.write str
+ tmp.flush
+ is_ok = `ruby -c #{tmp.path} 2>&1`
+ assert_equal "Syntax OK\n", is_ok
+ end
+
describe "for the Regress module" do
it "runs without throwing an exception" do
Regress._builder.pretty_print
end
it "results in valid Ruby" do
- tmp = Tempfile.new "gir_ffi"
- tmp.write Regress._builder.pretty_print
- tmp.flush
- is_ok = `ruby -c #{tmp.path}`
- assert_equal "Syntax OK\n", is_ok
+ assert_syntax_ok Regress._builder.pretty_print
+ end
+ end
+
+ describe "for the GLib module" do
+ it "results in valid Ruby" do
+ assert_syntax_ok GLib._builder.pretty_print
end
end
end
| Add failing test for syntax validity of pretty_printed GLib module.
|
diff --git a/app/helpers/gamification/application_helper.rb b/app/helpers/gamification/application_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/gamification/application_helper.rb
+++ b/app/helpers/gamification/application_helper.rb
@@ -1,11 +1,9 @@ module Gamification
module ApplicationHelper
- include Gamification::Engine.routes.url_helpers
-
def complete taskable, options
subjectable = options[:for]
- form_tag scorings_path, method: :post do
+ form_tag Gamification::Engine.routes.url_helpers.scorings_path, method: :post do
concat hidden_field_tag 'scoring[taskable_type]', taskable.class.name
concat hidden_field_tag 'scoring[taskable_id]', taskable.id
concat hidden_field_tag 'scoring[subjectable_type]', subjectable.class.name
| Fix a bug that caused the scorings path to be wrong if used inside another engine |
diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/config_spec.rb
+++ b/spec/classes/config_spec.rb
@@ -8,10 +8,9 @@ :mode => '0400',
:owner => 'root',
:group => 'root',
- })\
- .with_content(/^uri ldap:\/\/localhost$/)\
- .with_content(/^base dc=example,dc=com$/)\
- .with_content(/^ssl start_tls$/)\
+ })
+ }
+
}
end
@@ -28,16 +27,10 @@ }
end
- it {
- should contain_file('/etc/nslcd.conf').with({
- :mode => '0400',
- :owner => 'root',
- :group => 'root',
- })\
- .with_content(/^uri ldap:\/\/ldap1\.example\.com ldap:\/\/ldap2\.example\.com$/)\
- .with_content(/^base o=example org,c=us$/)\
- .with_content(/^ssl broken$/)\
- .with_content(/^tls_reqcert always$/)
+ it { should contain_file('/etc/nslcd.conf') \
+ .with_mode('0400') \
+ .with_owner('root') \
+ .with_group('root')
}
end
| Remove checks of nslcd.conf contents
... in preparation for converting to Augeas-based configuration.
|
diff --git a/spec/classes/mod/jk_spec.rb b/spec/classes/mod/jk_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/mod/jk_spec.rb
+++ b/spec/classes/mod/jk_spec.rb
@@ -27,7 +27,7 @@ end
let (:params) do
- :logroot => '/var/log/httpd'
+ { :logroot => '/var/log/httpd' }
end
it_behaves_like 'minimal resources'
| Correct params reference in mod/jk spec test
|
diff --git a/prius.gemspec b/prius.gemspec
index abc1234..def5678 100644
--- a/prius.gemspec
+++ b/prius.gemspec
@@ -21,6 +21,6 @@ spec.required_ruby_version = ">= 2.2"
spec.add_development_dependency "rspec", "~> 3.1"
- spec.add_development_dependency "rubocop", "~> 0.52.0"
+ spec.add_development_dependency "rubocop", "~> 0.53.0"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.3.0"
end
| Update rubocop requirement to ~> 0.53.0
Updates the requirements on [rubocop](https://github.com/bbatsov/rubocop) to permit the latest version.
- [Release notes](https://github.com/bbatsov/rubocop/releases)
- [Changelog](https://github.com/bbatsov/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bbatsov/rubocop/commits/v0.53.0)
Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com> |
diff --git a/overcommit.gemspec b/overcommit.gemspec
index abc1234..def5678 100644
--- a/overcommit.gemspec
+++ b/overcommit.gemspec
@@ -6,8 +6,8 @@ s.version = Overcommit::VERSION
s.license = 'MIT'
- s.summary = 'Opinionated git hook manager'
- s.description = 'Overcommit is a utility to install and extend git hooks'
+ s.summary = 'Opinionated Git hook manager'
+ s.description = 'Overcommit is a utility to install and extend Git hooks'
s.authors = ['Causes Engineering']
s.email = 'eng@causes.com'
| Fix Git capitalization in gemspec
Change-Id: Id4b55244e9d2d26dfabfcbe3a62de1a84d570b00
Reviewed-on: https://gerrit.causes.com/22784
Tested-by: Aiden Scandella <1faf1e8390cdac9204f160c35828cc423b7acd7b@causes.com>
Reviewed-by: Joe Lencioni <1dd72cf724deaab5db236f616560fc7067b734e1@causes.com>
|
diff --git a/app/models/arp.rb b/app/models/arp.rb
index abc1234..def5678 100644
--- a/app/models/arp.rb
+++ b/app/models/arp.rb
@@ -7,7 +7,11 @@ end
def self.present_users
- all.map(&:owner).uniq.compact
+ User.joins(:network_devices)
+ .where(network_devices: {
+ mac_address: all.map(&:mac_address),
+ use_for_presence: true})
+ .group('users.id')
end
def self.mac_by_ip_address(ip_address)
@@ -22,8 +26,4 @@ @ip_address = ip_address
@interface = interface
end
-
- def owner
- NetworkDevice.find_or_initialize_by(mac_address: @mac_address, use_for_presence: true).owner
- end
end
| Optimize the online user query
Get all present users with one query to the db instead of n
|
diff --git a/app/models/cve.rb b/app/models/cve.rb
index abc1234..def5678 100644
--- a/app/models/cve.rb
+++ b/app/models/cve.rb
@@ -12,4 +12,9 @@ has_many :references, :class_name => "CVEReference"
has_many :comments, :class_name => "CVEComment"
has_and_belongs_to_many :cpes, :class_name => "CPE"
+
+ def to_s
+ str = "#{self.cve_id} #{"(http://nvd.nist.gov/nvd.cfm?cvename=%s):" % self.cve_id}\n"
+ str += " " + Glsamaker::help.word_wrap(self.summary, 78).gsub(/\n/, "\n ")
+ end
end
| Add to_s to CVE model. Format is the usual format used in bugs |
diff --git a/app/models/pod.rb b/app/models/pod.rb
index abc1234..def5678 100644
--- a/app/models/pod.rb
+++ b/app/models/pod.rb
@@ -0,0 +1,11 @@+# Only for reading purposes.
+#
+class Pod < Sequel::Model(:pods)
+ one_to_one :metrics
+
+ # E.g. Pod.with_metrics.first[:github_stars]
+ #
+ def self.with_metrics
+ Pod.join(:metrics, :pod_id => :id)
+ end
+end
| [Model] Add Pod model with Pod.with_metrics extension method.
|
diff --git a/app/models/esr_file.rb b/app/models/esr_file.rb
index abc1234..def5678 100644
--- a/app/models/esr_file.rb
+++ b/app/models/esr_file.rb
@@ -1,9 +1,13 @@ class EsrFile < ActiveRecord::Base
+ # Default sorting
+ default_scope order('created_at DESC')
+
# File upload
mount_uploader :file, EsrFileUploader
has_many :esr_records, :dependent => :destroy
+ # String
def to_s(format = :default)
case format
when :long
| Add default sorting scope by descending created_at to EsrFile.
|
diff --git a/app/models/location.rb b/app/models/location.rb
index abc1234..def5678 100644
--- a/app/models/location.rb
+++ b/app/models/location.rb
@@ -10,7 +10,7 @@ include NilsBlankUniverse
has_attached_file :map, styles: { original: '1920x1080>', thumb: '200x200>' }
- validates_attachment_content_type :map, content_type: /\Aimage\/.*\Z/
+ validates_attachment_content_type :map, content_type: %r{\Aimage\/.*\Z}
validates :name, presence: true
| Change regex to use %r{}, as per RuboCop
|
diff --git a/app/models/voteable.rb b/app/models/voteable.rb
index abc1234..def5678 100644
--- a/app/models/voteable.rb
+++ b/app/models/voteable.rb
@@ -12,6 +12,15 @@ def time_since_creation
hours_number = ((Time.now - created_at) / 3600).round
"#{hours_number} hours ago"
+ end
+
+ def get_score
+ all_votes = self.votes
+ all_votes.reduce(0) do |sum, vote|
+ sum += 1 if vote.value
+ sum -= 1 if !vote.value
+ sum
+ end
end
def parent_question_id
| Define get_score method in Voteable module
|
diff --git a/lib/handler.rb b/lib/handler.rb
index abc1234..def5678 100644
--- a/lib/handler.rb
+++ b/lib/handler.rb
@@ -5,6 +5,7 @@ @bot_name = bot_name
@config = config
@run_id = run_id
+ @ended = false
end
def handle_valid_record(record, data_type)
@@ -20,6 +21,16 @@ Hutch.publish('bot.record', message)
end
+ def handle_run_ended
+ message = {
+ :type => 'run.ended',
+ :run_id => @run_id,
+ :bot_name => @bot_name
+ }
+ Hutch.publish('bot.record', message)
+ @ended = true
+ end
+
def identifying_fields_for(data_type)
if data_type == @config['data_type']
@config['identifying_fields']
| Handle "run_ended" by sending a message to angler and setting a flag
which is used by the resque job to communicate run state to turbot
|
diff --git a/lib/omc/cli.rb b/lib/omc/cli.rb
index abc1234..def5678 100644
--- a/lib/omc/cli.rb
+++ b/lib/omc/cli.rb
@@ -6,14 +6,14 @@ class Cli < Thor
desc 'ssh', 'Connect to an instance on a stack on an account'
def ssh(account, stack)
- iam_account = vault.account account
- user = iam_account.users.first
+ iam_account = vault.account(account) || abort("Account #{account.inspect} not configured")
+ user = iam_account.users.first || abort("No users configured under #{account.inspect}")
ops = ::AWS::OpsWorks::Client.new user.credentials
ops_stack = get_by_name ops.describe_stacks[:stacks], stack
instances = ops.describe_instances(stack_id: ops_stack[:stack_id])[:instances]
instances.reject!{|i| i[:status] != "online" }
- instance = instances.first
+ instance = instances.first || abort("No running instances")
system "ssh #{user.name}@#{instance[:public_ip]}"
end
| Add better error messages for missing creds
Change-Id: I3372dc3a19f96458b42677d559f1539502f4d23c
|
diff --git a/lib/scraper.rb b/lib/scraper.rb
index abc1234..def5678 100644
--- a/lib/scraper.rb
+++ b/lib/scraper.rb
@@ -14,11 +14,16 @@ headless = Headless.new
headless.start
browser = Watir::Browser.start url
- browser.div(:class => "flight-tab-group-info__price-bottom").wait_until_present(10)
+ browser.div(:class => "flight-tab-group-info__price-bottom").wait_until_present(12)
text = browser.div(:class => "flight-tab-group-info__price-bottom").text
headless.destroy
- text.delete("^0-9")
+ price = text.delete("^0-9")
+ flight_data = {}
+ flight_data[:price] = price
+ flight_data[:deep_link] = url
+
+ flight_data
end
end
| Remove dollar sign from price
|
diff --git a/lib/gollum-lib/macro/navigation.rb b/lib/gollum-lib/macro/navigation.rb
index abc1234..def5678 100644
--- a/lib/gollum-lib/macro/navigation.rb
+++ b/lib/gollum-lib/macro/navigation.rb
@@ -1,18 +1,20 @@ module Gollum
class Macro
class Navigation < Gollum::Macro
+
def render(title = "Navigate in the TOC", toc_root_path = ::File.dirname(@page.path), full_path = false)
if @wiki.pages.size > 0
list_items = @wiki.pages.map do |page|
if page.url_path.start_with?(toc_root_path)
- path_display = full_path ? page.url_path_display : page.url_path_display.sub(toc_root_path,"").sub(/^\//,'')
+ path_display = full_path ? page.url_path_display : page.url_path_display.sub(toc_root_path,"").sub(/^\//,'')
"<li><a href=\"/#{page.url_path}\">#{path_display}</a></li>"
end
- end
- result = "<ul>#{list_items.join}</ul>"
+ end
+ result = "<ul>#{list_items.join}</ul>"
end
"<div class=\"toc\"><div class=\"toc-title\">#{title}</div>#{result}</div>"
end
+
end
end
end
| Fix minor issues with indentation.
|
diff --git a/lib/pushwoosh/push_notification.rb b/lib/pushwoosh/push_notification.rb
index abc1234..def5678 100644
--- a/lib/pushwoosh/push_notification.rb
+++ b/lib/pushwoosh/push_notification.rb
@@ -8,29 +8,23 @@ module Pushwoosh
class PushNotification
- STRING_BYTE_LIMIT = 205 # recommended value, see https://community.pushwoosh.com/questions/286/why-am-i-receiving-a-payload-error for more details
-
def initialize(auth_hash = {})
@auth_hash = auth_hash
end
def notify_all(message, other_options = {})
- other_options.merge!(content: limited_content(message))
+ other_options.merge!(content: message)
create_message(other_options)
end
def notify_devices(message, devices, other_options = {})
- other_options.merge!(content: limited_content(message), devices: devices)
+ other_options.merge!(content: message, devices: devices)
create_message(other_options)
end
private
attr_reader :auth_hash
-
- def limited_content(message)
- Helpers.limit_string(message, STRING_BYTE_LIMIT)
- end
def create_message(notification_options = {})
fail Pushwoosh::Exceptions::Error, 'Message is missing' if notification_options[:content].nil? || notification_options[:content].empty?
| Stop automatically truncating notification body
|
diff --git a/lib/quickbooks/util/name_entity.rb b/lib/quickbooks/util/name_entity.rb
index abc1234..def5678 100644
--- a/lib/quickbooks/util/name_entity.rb
+++ b/lib/quickbooks/util/name_entity.rb
@@ -10,7 +10,8 @@ end
def names_cannot_contain_invalid_characters
- [:display_name, :given_name, :middle_name, :family_name, :print_on_check_name].each do |property|
+ [:name, :display_name, :given_name, :middle_name, :family_name, :print_on_check_name].each do |property|
+ next unless respond_to? property
value = send(property).to_s
if value.index(':')
errors.add(property, ":#{property} cannot contain a colon (:).")
| Fix bug in NameEntity string validation where it would crash when the method calling names_cannot_contain_invalid_characters didn't have every single property.
|
diff --git a/lib/sinatra_asset_packager/rake.rb b/lib/sinatra_asset_packager/rake.rb
index abc1234..def5678 100644
--- a/lib/sinatra_asset_packager/rake.rb
+++ b/lib/sinatra_asset_packager/rake.rb
@@ -24,5 +24,6 @@ end
FileUtils.cp_r(Dir['app/assets/images/*'], 'public/assets')
+ FileUtils.cp_r(Dir['app/assets/templates/*'], 'public/assets')
end
end | Copy html templates assets over
|
diff --git a/test/integration/ohaiplugins/serverspec/localhost/iptables_spec.rb b/test/integration/ohaiplugins/serverspec/localhost/iptables_spec.rb
index abc1234..def5678 100644
--- a/test/integration/ohaiplugins/serverspec/localhost/iptables_spec.rb
+++ b/test/integration/ohaiplugins/serverspec/localhost/iptables_spec.rb
@@ -13,3 +13,4 @@ end
end
+
| Add space to the end of the iptables testing file
|
diff --git a/lib/luhn/base.rb b/lib/luhn/base.rb
index abc1234..def5678 100644
--- a/lib/luhn/base.rb
+++ b/lib/luhn/base.rb
@@ -21,14 +21,14 @@ def double_odd_numbers
# Reverse number_to_validate to start
# the itteration from right to left
- digits_of_number = split_to_numbers(number_to_validate).reverse
total = []
- digits_of_number.each_with_index do |digit, i|
- if i.odd? && product_exceeds_nine(digit)
- split_product = split_to_numbers(product(digit))
- total << split_product.inject { |sum, n| sum + n }
- elsif i.odd? && !product_exceeds_nine(digit)
- total << product(digit)
+ digits_of_number_to_validate = split_to_number_array(number_to_validate).reverse
+ digits_of_number_to_validate.each_with_index do |digit, number_position|
+ if number_position.odd? && product_exceeds_nine(digit)
+ digits_of_product = split_to_number_array(multiply(digit))
+ total << digits_of_product.inject { |sum, n| sum + n }
+ elsif number_position.odd? && !product_exceeds_nine(digit)
+ total << multiply(digit)
else
total << digit
end
@@ -38,15 +38,15 @@
private
- def split_to_numbers(numbers)
+ def split_to_number_array(numbers)
numbers.to_s.split(//).map(&:to_i)
end
def product_exceeds_nine(digit)
- product(digit) > 9
+ multiply(digit) > 9
end
- def product(digit)
+ def multiply(digit)
digit * 2
end
end
| Make the internal methods and variables more sementic
|
diff --git a/Casks/a-better-finder-rename-beta.rb b/Casks/a-better-finder-rename-beta.rb
index abc1234..def5678 100644
--- a/Casks/a-better-finder-rename-beta.rb
+++ b/Casks/a-better-finder-rename-beta.rb
@@ -1,6 +1,6 @@ cask :v1 => 'a-better-finder-rename-beta' do
version '10'
- sha256 'df4208eb01c25434b5c93c65ae82c12b2bab893a63d5c286f8c89cf4ae7b7137'
+ sha256 '7a103b11efbd649f646fe93435cb07b6bc9b93024c177921109e327960566fda'
url "http://www.publicspace.net/download/ABFRX#{version}.dmg"
name 'A Better Finder Rename'
| Update SHA256 for A Better Finder Rename 10
|
diff --git a/lib/the_south.rb b/lib/the_south.rb
index abc1234..def5678 100644
--- a/lib/the_south.rb
+++ b/lib/the_south.rb
@@ -1,5 +1,53 @@ require "the_south/version"
-module TheSouth
- # Your code goes here...
+module South
+
+ [
+ :rise,
+ :rise!,
+ :rise?,
+ :rising,
+ :rising!,
+ :rising?,
+ :will_rise,
+ :will_rise!,
+ :will_rise?,
+ :is_rising,
+ :is_rising!,
+ :is_rising?,
+ :rise_again,
+ :rise_again!,
+ :rise_again?,
+ :shall_rise,
+ :shall_rise!,
+ :shall_rise?,
+ :shall_rise_again,
+ :shall_rise_again!,
+ :shall_rise_again?,
+ :is_rising_again,
+ :is_rising_again!,
+ :is_rising_again?,
+ :will_rise_again,
+ :will_rise_again!,
+ :will_rise_again?,
+ :yall_come_back_now,
+ ].each do |aint|
+ define_singleton_method aint do
+ false
+ end
+ end
+
+ [
+ :sweet_tea,
+ :sweet_tea!,
+ :sweet_tea?,
+ :tasty_biscuits,
+ :tasty_biscuits!,
+ :tasty_biscuits?,
+ ].each do |yall|
+ define_singleton_method yall do
+ true
+ end
+ end
+
end
| Define South and singleton methods
|
diff --git a/app/models/validators/employment_appeal_tribunal_decision_validator.rb b/app/models/validators/employment_appeal_tribunal_decision_validator.rb
index abc1234..def5678 100644
--- a/app/models/validators/employment_appeal_tribunal_decision_validator.rb
+++ b/app/models/validators/employment_appeal_tribunal_decision_validator.rb
@@ -12,6 +12,5 @@ validates :tribunal_decision_categories, presence: true
validates :tribunal_decision_decision_date, presence: true, date: true
validates :tribunal_decision_landmark, presence: true
- validates :tribunal_decision_sub_categories, presence: true
end
| Change employment appeal tribunal decision sub-categories validation
Domain experts want employment appeal tribunal decision sub-categories not to be
mandatory as some parent categories do not have any sub-categories.
Remove the validation requiring `tribunal_decision_sub_categories` be
present.
|
diff --git a/lib/asset_replication_checker.rb b/lib/asset_replication_checker.rb
index abc1234..def5678 100644
--- a/lib/asset_replication_checker.rb
+++ b/lib/asset_replication_checker.rb
@@ -1,3 +1,5 @@+require 'services'
+
class AssetReplicationChecker
def initialize(cloud_storage: Services.cloud_storage)
@cloud_storage = cloud_storage
| Add missing require statement to AssetReplicationChecker
We tried running the `rake
govuk_assets:check_all_assets_have_been_replicated` task in production
but it failed with `NameError: uninitialized constant
AssetReplicationChecker::Services`.
|
diff --git a/lib/omniauth/strategies/slack.rb b/lib/omniauth/strategies/slack.rb
index abc1234..def5678 100644
--- a/lib/omniauth/strategies/slack.rb
+++ b/lib/omniauth/strategies/slack.rb
@@ -28,7 +28,7 @@ end
extra do
- {:raw_info => raw_info, :scope_info => {:incoming_webhook => access_token.params["incoming_webhook"]}}
+ {:raw_info => raw_info, :scope_info => {:incoming_webhook => access_token.params["incoming_webhook"].to_hash}}
end
def raw_info
| Convert the incoming webhook params to a hash
|
diff --git a/libimagruby/test/test_entries.rb b/libimagruby/test/test_entries.rb
index abc1234..def5678 100644
--- a/libimagruby/test/test_entries.rb
+++ b/libimagruby/test/test_entries.rb
@@ -0,0 +1,27 @@+#!/usr/bin/env ruby
+
+require "../target/debug/liblibimagruby.so"
+
+color = true
+verbose = true
+debug = false
+
+RImag.init_logger debug, verbose, color
+
+store_handle = RStoreHandle::new(false, "/tmp/store")
+id = RStoreId::new_baseless("test")
+test_handle = store_handle.retrieve(id)
+puts "Header: #{test_handle.header.to_s}"
+puts "Content: '#{test_handle.content}'"
+
+test_handle.content = "Foo"
+test_handle.header = {
+ "imag" => {
+ "links" => [],
+ "version" => "0.2.0"
+ },
+ "example" => {
+ "test" => "foo"
+ }
+}
+
| Add test script to test entry capabilities
|
diff --git a/lib/calyx.rb b/lib/calyx.rb
index abc1234..def5678 100644
--- a/lib/calyx.rb
+++ b/lib/calyx.rb
@@ -1,11 +1,11 @@-require_relative 'calyx/version'
-require_relative 'calyx/grammar'
-require_relative 'calyx/file_converter'
-require_relative 'calyx/grammar/registry'
-require_relative 'calyx/grammar/production/memo'
-require_relative 'calyx/grammar/production/choices'
-require_relative 'calyx/grammar/production/concat'
-require_relative 'calyx/grammar/production/expression'
-require_relative 'calyx/grammar/production/non_terminal'
-require_relative 'calyx/grammar/production/terminal'
-require_relative 'calyx/grammar/production/weighted_choices'
+require 'calyx/version'
+require 'calyx/grammar'
+require 'calyx/file_converter'
+require 'calyx/grammar/registry'
+require 'calyx/grammar/production/memo'
+require 'calyx/grammar/production/choices'
+require 'calyx/grammar/production/concat'
+require 'calyx/grammar/production/expression'
+require 'calyx/grammar/production/non_terminal'
+require 'calyx/grammar/production/terminal'
+require 'calyx/grammar/production/weighted_choices'
| Replace `require_relative` with full path `require`s
|
diff --git a/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb b/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb
index abc1234..def5678 100644
--- a/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb
+++ b/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb
@@ -0,0 +1,16 @@+class AddTmpStagePriorityIndexToCiBuilds < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:ci_builds, [:stage_id, :stage_idx],
+ where: 'stage_idx IS NOT NULL', name: 'tmp_build_stage_priority_index')
+ end
+
+ def down
+ remove_concurrent_index_by_name(:ci_builds, 'tmp_build_stage_priority_index')
+ end
+end
| Add temporary build stage priority partial index
|
diff --git a/lib/friendly_id/configuration.rb b/lib/friendly_id/configuration.rb
index abc1234..def5678 100644
--- a/lib/friendly_id/configuration.rb
+++ b/lib/friendly_id/configuration.rb
@@ -16,7 +16,7 @@
def initialize(klass, values = nil)
@klass = klass
- @defaults = @@defaults.dup
+ @defaults = self.class.defaults.dup
set values
end
| Use class method rather than variable to facilitate overriding
|
diff --git a/lib/inspect-templates/inspect.rb b/lib/inspect-templates/inspect.rb
index abc1234..def5678 100644
--- a/lib/inspect-templates/inspect.rb
+++ b/lib/inspect-templates/inspect.rb
@@ -17,11 +17,6 @@ end
def evaluate(scope, locals, &block)
- filename=(scope.pathname.to_s.split /\//).last
- parts=(scope.logical_path.split /\//)
- parts.pop
- parts.push filename
- relative_path=parts.join "/"
"<inspect class='inspect' data-render='client' data-path='#{scope.logical_path}'>#{data}</inspect>"
end
end
| Remove dead code that is no longer necessary
|
diff --git a/attributes/packages.rb b/attributes/packages.rb
index abc1234..def5678 100644
--- a/attributes/packages.rb
+++ b/attributes/packages.rb
@@ -1,7 +1,7 @@ # packages that should live EVERY WHERE; no packages that launch services allowed in this list; that should happen elsewhere
default['particle_base']['packages']['debian']['every_node'] = %w(ca-certificates git htop tmux vim nano netcat jq)
default['particle_base']['packages']['mac_os_x']['every_node'] = %w(git vim tmux nano netcat jq)
-default['particle_base']['packages']['rhel']['every_node'] = node['particle_base']['packages']['debian']['every_node']
+default['particle_base']['packages']['rhel']['every_node'] = %w(ca-certificates git htop tmux vim nano nc jq)
# package node['particle_base']['packages']['rhel']['every_node']
# dfu packages for different OSes
| Change rhel package list: netcat -> nc
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.