diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/SimulatorStatusMagic.podspec b/SimulatorStatusMagic.podspec index abc1234..def5678 100644 --- a/SimulatorStatusMagic.podspec +++ b/SimulatorStatusMagic.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SimulatorStatusMagic" - s.version = "1.3" + s.version = "1.4" s.summary = "Enable perfect status bars in the iOS Simulator." s.description = <<-DESC Modify the iOS Simulator so that it has a perfect status bar, then run your app and take perfect screenshots every time. The modifications made are designed to match the images you see on the Apple site and are as follows:
Update podspec version to 1.4
diff --git a/app/models/jellyfish_odl/provider/odl.rb b/app/models/jellyfish_odl/provider/odl.rb index abc1234..def5678 100644 --- a/app/models/jellyfish_odl/provider/odl.rb +++ b/app/models/jellyfish_odl/provider/odl.rb @@ -14,7 +14,7 @@ begin response['nodes']['node'].reverse_each do |x| id = x['id'] - next unless /openflow:\d+/ =~ id + # next unless /openflow:\d+/ =~ id nodes << x end rescue
Add all nodes for now in parsing
diff --git a/app/models/manageiq/providers/azure/cloud_manager/vm/operations.rb b/app/models/manageiq/providers/azure/cloud_manager/vm/operations.rb index abc1234..def5678 100644 --- a/app/models/manageiq/providers/azure/cloud_manager/vm/operations.rb +++ b/app/models/manageiq/providers/azure/cloud_manager/vm/operations.rb @@ -6,7 +6,7 @@ unless ext_management_system raise _("VM has no %{table}, unable to destroy VM") % {:table => ui_lookup(:table => "ext_management_systems")} end - provider_service.delete(name, resource_group) + provider_service.delete_associated_resources(name, resource_group) update_attributes!(:raw_power_state => "Deleting") end end
Delete associated resources (NIC, IP, VHD, .status) when deleting a VM https://bugzilla.redhat.com/show_bug.cgi?id=1348718
diff --git a/kernel/common/mirror.rb b/kernel/common/mirror.rb index abc1234..def5678 100644 --- a/kernel/common/mirror.rb +++ b/kernel/common/mirror.rb @@ -22,5 +22,9 @@ class Object < Mirror subject = ::Object end + + def inspect + "#<#{self.class.name}:0x#{self.object_id.to_s(16)} object=#{@object.inspect}>" + end end end
Add better inspect for Rubinius::Mirror
diff --git a/qiita.gemspec b/qiita.gemspec index abc1234..def5678 100644 --- a/qiita.gemspec +++ b/qiita.gemspec @@ -11,7 +11,7 @@ gem.description = <<desc Gets some tag's or user's items at qiita.com. Creates, updates, deletes and stocks items at Qiita. - desc +desc gem.summary = "Ruby wrapper for Qiita API v1." gem.homepage = "http://github.com/yaotti/qiita-rb"
Fix the wrong heredoc format
diff --git a/lib/bunny/ssl_socket.rb b/lib/bunny/ssl_socket.rb index abc1234..def5678 100644 --- a/lib/bunny/ssl_socket.rb +++ b/lib/bunny/ssl_socket.rb @@ -8,9 +8,9 @@ # methods found in Bunny::Socket. class SSLSocket < OpenSSL::SSL::SSLSocket - # IO::WaitReadable is 1.9+ only - READ_RETRY_EXCEPTION_CLASSES = [Errno::EAGAIN, Errno::EWOULDBLOCK, OpenSSL::SSL::SSLError] - READ_RETRY_EXCEPTION_CLASSES << IO::WaitReadable if IO.const_defined?(:WaitReadable) + # IO::WaitReadable is 1.9+ only + READ_RETRY_EXCEPTION_CLASSES = [Errno::EAGAIN, Errno::EWOULDBLOCK] + READ_RETRY_EXCEPTION_CLASSES << IO::WaitReadable if IO.const_defined?(:WaitReadable) # Reads given number of bytes with an optional timeout @@ -30,10 +30,19 @@ break if value.bytesize >= count end rescue EOFError => e - puts e.inspect @__bunny_socket_eof_flag__ = true + rescue OpenSSL::SSL::SSLError => e + if e.message == "read would block" + if IO.select([self], nil, nil, timeout) + retry + else + raise Timeout::Error, "IO timeout when reading #{count} bytes" + end + else + raise e + end rescue *READ_RETRY_EXCEPTION_CLASSES => e - puts e.inspect + $stderr.puts e.inspect if IO.select([self], nil, nil, timeout) retry else
Handle SSLError that is effectively Errno::EWOULDBLOCK correctly
diff --git a/lib/fivemat/cucumber.rb b/lib/fivemat/cucumber.rb index abc1234..def5678 100644 --- a/lib/fivemat/cucumber.rb +++ b/lib/fivemat/cucumber.rb @@ -23,6 +23,7 @@ def after_features(features) @io.puts print_stats(features, @options) + print_snippets(@options) print_passing_wip(@options) end end
Print snippets for undefined Cucumber steps
diff --git a/lib/highrise/account.rb b/lib/highrise/account.rb index abc1234..def5678 100644 --- a/lib/highrise/account.rb +++ b/lib/highrise/account.rb @@ -1,7 +1,6 @@ module Highrise class Account < Base def self.me - user = Account.new() find(:one, :from => "/account.xml") end end
Remove useless initialization of user
diff --git a/lib/job_board/models.rb b/lib/job_board/models.rb index abc1234..def5678 100644 --- a/lib/job_board/models.rb +++ b/lib/job_board/models.rb @@ -16,7 +16,7 @@ def db_logger @db_logger ||= ( - JobBoard.config.database.sql_logging ? Logger.new($stderr) : nil + JobBoard.config.database.sql_logging ? Logger.new($stdout) : nil ) end
Send SQL logs to stdout
diff --git a/lib/jquery-rails-cdn.rb b/lib/jquery-rails-cdn.rb index abc1234..def5678 100644 --- a/lib/jquery-rails-cdn.rb +++ b/lib/jquery-rails-cdn.rb @@ -7,9 +7,9 @@ OFFLINE = (Rails.env.development? or Rails.env.test?) URL = { :google => "//ajax.googleapis.com/ajax/libs/jquery/#{JQUERY_VERSION}/jquery.min.js", - :microsoft => "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-#{JQUERY_VERSION}.min.js", + :microsoft => "//ajax.aspnetcdn.com/ajax/jQuery/jquery-#{JQUERY_VERSION}.min.js", :jquery => "http://code.jquery.com/jquery-#{JQUERY_VERSION}.min.js", - :yandex => "http://yandex.st/jquery/#{JQUERY_VERSION}/jquery.min.js" + :yandex => "//yandex.st/jquery/#{JQUERY_VERSION}/jquery.min.js" } def jquery_url(name, options = {})
Use protocol-independent urls for Yandex and Microsoft CDNs
diff --git a/lib/metamorpher/rule.rb b/lib/metamorpher/rule.rb index abc1234..def5678 100644 --- a/lib/metamorpher/rule.rb +++ b/lib/metamorpher/rule.rb @@ -23,7 +23,7 @@ current = waiting.pop unless discovered.include?(current) discovered << current - waiting.concat(current.children) + waiting.concat(current.children) if current.respond_to?(:children) end result = pattern.match(current) return result if result.matches?
Fix bug in depth-first search that would cause an exception when hitting the first leaf node.
diff --git a/lib/mws-rb/api/feeds.rb b/lib/mws-rb/api/feeds.rb index abc1234..def5678 100644 --- a/lib/mws-rb/api/feeds.rb +++ b/lib/mws-rb/api/feeds.rb @@ -29,18 +29,13 @@ xml = Builder::XmlMarkup.new(indent: 2) xml.instruct! - envelope_hash = { - "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", - "xsi:noNamespaceSchemaLocation" => "amzn-envelope.xsd" - } - - xml.AmazonEnvelope envelope_hash do + xml.AmazonEnvelope do xml.Header do - xml.DocumentVersion = "1.01" - xml.MerchantIdentifier = params[:merchant_id] + xml.DocumentVersion "1.01" + xml.MerchantIdentifier params[:merchant_id] end - xml.MessageType = params[:message_type].to_s.camelize + xml.MessageType params[:message_type].to_s.camelize xml.PurgeAndReplace = params[:purge_and_replace] || false xml << params[:message].to_xml(skip_instruct: true, root: "Message")
Remove typo and unecessary info
diff --git a/lib/bra.rb b/lib/bra.rb index abc1234..def5678 100644 --- a/lib/bra.rb +++ b/lib/bra.rb @@ -4,21 +4,21 @@ require 'bra/common/constants' module Bra - def self.launch_from_config_file(file = nil) + def self.from_config_file(file = nil) Bra::Launcher.launch(get_config(file)) end private - def get_config(file) + def self.get_config(file) load_config_from(file_or_default(file)) end - def file_or_default(file) + def self.file_or_default(file) file || Bra::Common::Constants::CONFIG_FILE end - def load_config_from(file) + def self.load_config_from(file) YAML.load_file(file).deep_symbolize_keys! end end
Make Bra methods module methods.
diff --git a/script/insert_concept_report_dummy_data.rb b/script/insert_concept_report_dummy_data.rb index abc1234..def5678 100644 --- a/script/insert_concept_report_dummy_data.rb +++ b/script/insert_concept_report_dummy_data.rb @@ -0,0 +1,18 @@+teacher = User.find(498) + +activity_sessions = ActivitySession.completed.by_teacher(teacher) + +random_session = activity_sessions.order("RANDOM()").first + +grammar_concepts = ConceptClass.find_by_name('Grammar Concepts') +random_category = ConceptCategory.where(concept_class: grammar_concepts).order("RANDOM()").first +ConceptTag.where(concept_class: grammar_concepts).find_each do |concept_tag| + ConceptTagResult.create!( + activity_session: random_session, + concept_tag: concept_tag, + concept_category: random_category, + metadata: { + "correct" => [1, 0].sample + } + ) +end
Add script to insert test data for concept_tag_results
diff --git a/lib/wavefront/mixins.rb b/lib/wavefront/mixins.rb index abc1234..def5678 100644 --- a/lib/wavefront/mixins.rb +++ b/lib/wavefront/mixins.rb @@ -0,0 +1,29 @@+=begin + Copyright 2015 Wavefront Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed 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. + +=end + +module Wavefront + module Mixins + def interpolate_schema(label, host, prefix_length) + label_parts = label.split('.') + interpolated = Array.new + interpolated << label_parts.shift(prefix_length) + interpolated << host + interpolated << label_parts + interpolated.flatten! + return interpolated.join('.') + end + end +end
Add Wavefront::Mixin, method to interpolate schema
diff --git a/lib/whiny_validation.rb b/lib/whiny_validation.rb index abc1234..def5678 100644 --- a/lib/whiny_validation.rb +++ b/lib/whiny_validation.rb @@ -8,9 +8,23 @@ end def whiny_validation - logger.debug { "Validation failed for #{inspect}:\n#{errors.full_messages.map{|m|" #{m}"}.join("\n")}" } + ActiveSupport::Notifications.instrument("validation_failed.whiny_validation", + :object => self, + :error_messages => errors.full_messages) + end + + class LogSubscriber < ActiveSupport::LogSubscriber + def validation_failed(event) + name = color("Validation failed", YELLOW, true) + object = event.payload[:object] + error_messages = color(event.payload[:error_messages].map{|m|" => #{m}"}.join("\n"), YELLOW) + + debug " #{name} #{object.inspect}\n#{error_messages}" + end end end + +WhinyValidation::LogSubscriber.attach_to :whiny_validation module ActiveRecord class Base
Use ActiveSupport::LogSubscriber for colorized messages. If the app has turned off colorization it won't be colorized.
diff --git a/db/migrate/20160601103703_create_tags.rb b/db/migrate/20160601103703_create_tags.rb index abc1234..def5678 100644 --- a/db/migrate/20160601103703_create_tags.rb +++ b/db/migrate/20160601103703_create_tags.rb @@ -1,9 +1,9 @@ class CreateTags < ActiveRecord::Migration def change - create_table :tags |t| + create_table :tags do |t| t.string :description t.timestamps null: false - end + end end end
Add do to tags migration
diff --git a/spec/acceptance/basic_trove_spec.rb b/spec/acceptance/basic_trove_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/basic_trove_spec.rb +++ b/spec/acceptance/basic_trove_spec.rb @@ -8,6 +8,7 @@ pp= <<-EOS include openstack_integration include openstack_integration::repos + include openstack_integration::apache include openstack_integration::rabbitmq include openstack_integration::mysql include openstack_integration::keystone
Use common class to manage apache service in beaker job Depends-on: https://review.opendev.org/#/c/745246/ Change-Id: I7fccb5c4fc29a3c5a2d864d9ac7df3d2d181faac
diff --git a/Library/Homebrew/formula_test.rb b/Library/Homebrew/formula_test.rb index abc1234..def5678 100644 --- a/Library/Homebrew/formula_test.rb +++ b/Library/Homebrew/formula_test.rb @@ -0,0 +1,43 @@+#!/usr/bin/ruby +# This software is in the public domain, furnished "as is", without technical +# support, and with no warranty, express or implied, as to its usefulness for +# any purpose. + +$:.unshift File.dirname(__FILE__) +require 'test/unit' +require 'global' +require 'pathname+yeast' +require 'formula' +require 'utils' + +require 'ARGV+yeast' # needs to be after test/unit to avoid conflict with OptionsParser + + +# NOTE duplicated in unittest.rb (we need to refactor the tests anyway) +def nostdout + if ARGV.include? '-V' + yield + end + begin + require 'stringio' + tmpo=$stdout + tmpe=$stderr + $stdout=StringIO.new + yield + ensure + $stdout=tmpo + end +end + + +class FormulaNames <Test::Unit::TestCase + def test_formula_names + nostdout do + Dir["#{HOMEBREW_PREFIX}/Library/Formula/*.rb"].each do |f| + assert_nothing_raised do + Formula.factory f + end + end + end + end +end
Add test for matching formula filename/class.
diff --git a/spec/starting_blocks/result_parser_spec.rb b/spec/starting_blocks/result_parser_spec.rb index abc1234..def5678 100644 --- a/spec/starting_blocks/result_parser_spec.rb +++ b/spec/starting_blocks/result_parser_spec.rb @@ -2,19 +2,20 @@ describe StartingBlocks::ResultParser do - it "should return the result from the text parser" do + let(:parsed_output) { {} } - text = Object.new - parsed_output = Hash.new - text_parser = Object.new + let(:output) do + text = Object.new + text_parser = Object.new StartingBlocks::ResultTextParser.stubs(:new).returns text_parser text_parser.stubs(:parse).with(text).returns parsed_output - output = StartingBlocks::ResultParser.new.parse text + StartingBlocks::ResultParser.new.parse text + end + it "should return the result from the text parser" do output.must_be_same_as parsed_output - end end
Refactor tests to make future tests easier.
diff --git a/test/vultr/resources/backups_test.rb b/test/vultr/resources/backups_test.rb index abc1234..def5678 100644 --- a/test/vultr/resources/backups_test.rb +++ b/test/vultr/resources/backups_test.rb @@ -0,0 +1,24 @@+# frozen_string_literal: true + +require "test_helper" + +class BackupsResourceTest < Minitest::Test + def test_list + stub = stub_request("backups", response: stub_response(fixture: "backups/list")) + client = Vultr::Client.new(api_key: "fake", adapter: :test, stubs: stub) + backups = client.backups.list + assert_equal Vultr::Collection, backups.class + assert_equal Vultr::Backup, backups.data.first.class + assert_equal 1, backups.total + end + + def test_retrieve + backup_id = "cb676a46-66fd-4dfb-b839-443f2e6c0b60" + stub = stub_request("backups/#{backup_id}", response: stub_response(fixture: "backups/retrieve")) + client = Vultr::Client.new(api_key: "fake", adapter: :test, stubs: stub) + backup = client.backups.retrieve(backup_id: backup_id) + + assert_equal Vultr::Backup, backup.class + assert_equal "complete", backup.status + end +end
Write tests for Backups Resource Simple tests for the list and retrieve endpoints inspired by the existing test created for the Users Resources list and retrieve endpoints.
diff --git a/config/initializers/redis-store-fix-expiry.rb b/config/initializers/redis-store-fix-expiry.rb index abc1234..def5678 100644 --- a/config/initializers/redis-store-fix-expiry.rb +++ b/config/initializers/redis-store-fix-expiry.rb @@ -4,7 +4,7 @@ class Redis class Store module Namespace - # Redis::Store#expire in redis-store 1.1.4 does not respect namespaces; + # Redis::Store#setex in redis-store 1.1.4 does not respect namespaces; # this new method does. def setex(key, expires_in, value, options=nil) namespace(key) { |key| super(key, expires_in, value) }
Fix copy-paste error in comment
diff --git a/vendor/gems/beacon_control-kontakt_io_extension/lib/beacon_control/kontakt_io_extension/engine.rb b/vendor/gems/beacon_control-kontakt_io_extension/lib/beacon_control/kontakt_io_extension/engine.rb index abc1234..def5678 100644 --- a/vendor/gems/beacon_control-kontakt_io_extension/lib/beacon_control/kontakt_io_extension/engine.rb +++ b/vendor/gems/beacon_control-kontakt_io_extension/lib/beacon_control/kontakt_io_extension/engine.rb @@ -26,11 +26,6 @@ ) @cache_key = [*@cache_key[0..2], @options] end - - app.config.assets.precompile += %w( - kontakt_io_extension.js - kontakt_io_extension.css - ) end end end
BOS-FF: Remove precompile kontakt io assets
diff --git a/respect.gemspec b/respect.gemspec index abc1234..def5678 100644 --- a/respect.gemspec +++ b/respect.gemspec @@ -11,7 +11,7 @@ s.summary = "JSON schema definition using a Ruby DSL." s.description = "Respect allow to specify JSON schema using a Ruby DSL. It also provides a validator a sanitizer and dumper to generate json-schema.org compliant spec." - s.files = Dir["lib/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc", "STATUS_MATRIX.html", "RELATED_WORK.md"] + s.files = Dir["lib/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md", "STATUS_MATRIX.html", "RELATED_WORK.md"] s.test_files = Dir["test/**/*"] s.add_dependency "json", "~> 1.7.7"
Fix REAMDE file name in gemspec.
diff --git a/spec/routing/backend/pages_spec.rb b/spec/routing/backend/pages_spec.rb index abc1234..def5678 100644 --- a/spec/routing/backend/pages_spec.rb +++ b/spec/routing/backend/pages_spec.rb @@ -0,0 +1,52 @@+require 'rails_helper' + +describe 'page routes' do + it 'GET /backend/pages' do + expect(get: '/backend/pages').to route_to('backend/pages#index') + end + + it 'GET /backend/pages/1' do + expect(get: '/backend/pages/1').to route_to('catch_all#resolve', path: 'backend/pages/1') + end + + it 'GET /backend/pages/new' do + expect(get: new_backend_page_path).to route_to('backend/pages#new') + end + + it 'POST /backend/pages/create' do + expect(post: backend_pages_path).to route_to('backend/pages#create') + end + + it 'GET /backend/pages/1/edit' do + expect(get: edit_backend_page_path(1)).to route_to('backend/pages#edit', id: '1') + end + + it 'PUT /backend/pages' do + expect(put: backend_page_path(1)).to route_to('backend/pages#update', id: '1') + end + + it 'DELETE /backend/pages/1' do + expect(delete: backend_page_path(1)).to route_to('backend/pages#destroy', id: '1') + end + + it 'GET /backend/pages/1/edit/nl' do + expect(get: edit_translation_backend_page_path(1, 'nl')).to( + route_to('backend/pages#edit_translation', id: '1', translation_locale: 'nl') + ) + end + + it 'PUT /backend/pages/1/edit/nl' do + expect(patch: '/backend/pages/1/edit/nl').to( + route_to('backend/pages#update_translation', id: '1', translation_locale: 'nl') + ) + end + + it 'POST /backend/pages/1/tree_drag_and_drop' do + expect(post: tree_drag_and_drop_backend_page_path(1)).to route_to('backend/pages#tree_drag_and_drop', id: '1') + end + + # resources :pages, except: [:show] do + # concerns :translatable + # member { post :tree_drag_and_drop } + # end +end
Add routes specs for pages.
diff --git a/db/migrate/20160512163147_create_questions.rb b/db/migrate/20160512163147_create_questions.rb index abc1234..def5678 100644 --- a/db/migrate/20160512163147_create_questions.rb +++ b/db/migrate/20160512163147_create_questions.rb @@ -1,4 +1,11 @@ class CreateQuestions < ActiveRecord::Migration def change + create_table :questions do |t| + t.string :title + t.string :content + t.belongs_to :user_id, index: true + + t.timestamps null: false + end end end
Define migration to create questions table
diff --git a/lib/chili/enterprises_distributor_info_rich_text_feature/lib/enterprises_distributor_info_rich_text_feature.rb b/lib/chili/enterprises_distributor_info_rich_text_feature/lib/enterprises_distributor_info_rich_text_feature.rb index abc1234..def5678 100644 --- a/lib/chili/enterprises_distributor_info_rich_text_feature/lib/enterprises_distributor_info_rich_text_feature.rb +++ b/lib/chili/enterprises_distributor_info_rich_text_feature/lib/enterprises_distributor_info_rich_text_feature.rb @@ -3,5 +3,5 @@ module EnterprisesDistributorInfoRichTextFeature extend Chili::Base - active_if { true } # edit this to activate/deactivate feature at runtime + active_if { ENV['OFW_DEPLOYMENT'] == 'local_organics' } end
Enable feature for local organics only
diff --git a/rollbar.gemspec b/rollbar.gemspec index abc1234..def5678 100644 --- a/rollbar.gemspec +++ b/rollbar.gemspec @@ -21,5 +21,6 @@ gem.add_development_dependency 'rspec-rails', '~> 2.12.0' gem.add_development_dependency 'database_cleaner', '~> 1.0.0' gem.add_development_dependency 'girl_friday', '>= 0.11.1' + gem.add_development_dependency 'sucker_punch', '>= 1.0.0' gem.add_development_dependency 'genspec', '>= 0.2.7' end
Add sucker_punch to gemspec dev dependency.
diff --git a/db/migrate/20180116133324_add_unique_index_to_spree_option_type_name.rb b/db/migrate/20180116133324_add_unique_index_to_spree_option_type_name.rb index abc1234..def5678 100644 --- a/db/migrate/20180116133324_add_unique_index_to_spree_option_type_name.rb +++ b/db/migrate/20180116133324_add_unique_index_to_spree_option_type_name.rb @@ -0,0 +1,32 @@+class AddUniqueIndexToSpreeOptionTypeName < SpreeExtension::Migration[4.2] + def change + return if check_lower_index_exists? + + attributes = Spree::OptionType.unscoped.group(:name).having('sum(1) > 1').pluck(:name) + instances = Spree::OptionType.where(name: [nil, attributes]) + + instances.find_each do |instance| + column_value = "#{instance.name} #{SecureRandom.urlsafe_base64(8).upcase.delete('/+=_-')[0, 8]}" + instance.update(name: column_value) + end + + remove_index :spree_option_types, :name if index_exists?(:spree_option_types, :name) + if supports_expression_index? + add_index :spree_option_types, 'lower(name)', unique: true + else + add_index :spree_option_types, :name, unique: true + end + end + + private + + def check_lower_index_exists? + if supports_expression_index? + ActiveRecord::Base.connection.indexes(:spree_option_types).any? do |struct| + struct.columns.eql?('lower((name)::text)') + end + else + index_exists?(:spree_option_types, :name, unique: true) + end + end +end
Add unique index for spree option type lower name
diff --git a/db/migrate/20180426145669_migrate_tax_categories_to_line_items.spree.rb b/db/migrate/20180426145669_migrate_tax_categories_to_line_items.spree.rb index abc1234..def5678 100644 --- a/db/migrate/20180426145669_migrate_tax_categories_to_line_items.spree.rb +++ b/db/migrate/20180426145669_migrate_tax_categories_to_line_items.spree.rb @@ -1,8 +1,12 @@ # This migration comes from spree (originally 20130802022321) class MigrateTaxCategoriesToLineItems < ActiveRecord::Migration def change - Spree::LineItem.includes(:variant => { :product => :tax_category }).find_in_batches do |line_items| - line_items.each do |line_item| + Spree::LineItem.includes(:variant => { :product => :tax_category }).find_in_batches do |line_items| + line_items.each do |line_item| + next if line_item.variant.nil? + next if line_item.variant.product.nil? + next if line_item.product.nil? + next unless line_item.product.tax_category.present? line_item.update_column(:tax_category_id, line_item.product.tax_category.id) end end
Fix migrate tax categories to line items migration This is bringing https://github.com/spree/spree/commit/67186f8ca7eed72b20e696d53f3ceb4fa875524f from spree v2.2
diff --git a/jmespath.gemspec b/jmespath.gemspec index abc1234..def5678 100644 --- a/jmespath.gemspec +++ b/jmespath.gemspec @@ -6,7 +6,7 @@ spec.author = 'Trevor Rowe' spec.email = 'trevorrowe@gmail.com' spec.homepage = 'http://github.com/trevorrowe/jmespath.rb' - spec.license = 'Apache 2.0' + spec.license = 'Apache-2.0' spec.require_paths = ['lib'] spec.files = Dir['lib/**/*.rb'] + ['LICENSE.txt'] end
Fix typo of a license name in gemspec `rake gem:build` warns license name. ```bash $ bundle exec rake gem:build gem build jmespath.gemspec WARNING: license value 'Apache 2.0' is invalid. Use a license identifier from http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. Did you mean 'Apache-2.0'? WARNING: See http://guides.rubygems.org/specification-reference/ for help Successfully built RubyGem Name: jmespath Version: 1.3.1 File: jmespath-1.3.1.gem ``` This change fixes the warning.
diff --git a/app/graphql/consul_schema.rb b/app/graphql/consul_schema.rb index abc1234..def5678 100644 --- a/app/graphql/consul_schema.rb +++ b/app/graphql/consul_schema.rb @@ -1,11 +1,4 @@ class ConsulSchema < GraphQL::Schema mutation(Types::MutationType) query(Types::QueryType) - - # Opt in to the new runtime (default in future graphql-ruby versions) - use GraphQL::Execution::Interpreter - use GraphQL::Analysis::AST - - # Add built-in connections for pagination - use GraphQL::Pagination::Connections end
Remove explicit inclusions of now-default modules These modules are used by default in version 1.12.14 and so we were getting deprecation warnings: ``` DEPRECATION WARNING: GraphQL::Execution::Interpreter is now the default; remove `use GraphQL::Execution::Interpreter` from the schema definition (app/graphql/consul_schema.rb:6) DEPRECATION WARNING: GraphQL::Analysis::AST is now the default; remove `use GraphQL::Analysis::AST` from the schema definition (app/graphql/consul_schema.rb:7) DEPRECATION WARNING: GraphQL::Pagination::Connections is now the default, remove `use GraphQL::Pagination::Connections` from app/graphql/consul_schema.rb:10 ```
diff --git a/spec/controllers/featured_works_controller_spec.rb b/spec/controllers/featured_works_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/featured_works_controller_spec.rb +++ b/spec/controllers/featured_works_controller_spec.rb @@ -3,7 +3,7 @@ describe FeaturedWorksController do describe "#create" do before do - sign_in FactoryGirl.create(:normal_user) + sign_in FactoryGirl.create(:user) expect(controller).to receive(:authorize!).with(:create, FeaturedWork).and_return(true) end @@ -36,7 +36,7 @@ let!(:featured_work) { FactoryGirl.create(:featured_work, generic_file_id: '1234abcd') } before do - sign_in FactoryGirl.create(:normal_user) + sign_in FactoryGirl.create(:user) expect(controller).to receive(:authorize!).with(:destroy, FeaturedWork).and_return(true) end
Fix tests that broke as a result of a merge
diff --git a/test/unit/services/service_listeners/attachment_redirect_url_updater_test.rb b/test/unit/services/service_listeners/attachment_redirect_url_updater_test.rb index abc1234..def5678 100644 --- a/test/unit/services/service_listeners/attachment_redirect_url_updater_test.rb +++ b/test/unit/services/service_listeners/attachment_redirect_url_updater_test.rb @@ -6,12 +6,17 @@ let(:updater) { AttachmentRedirectUrlUpdater.new(attachment_data) } let(:attachment_data) { attachment.attachment_data } + let(:worker) { mock('asset-manager-attachment-redirect-url-update-worker') } + + before do + AssetManagerAttachmentRedirectUrlUpdateWorker.stubs(:new).returns(worker) + end context 'when attachment has no associated attachment data' do let(:attachment) { FactoryBot.create(:html_attachment) } it 'does not update redirect URL of any assets' do - AssetManagerUpdateAssetWorker.expects(:perform_async).never + worker.expects(:perform).never updater.update! end
Change service listener test to stub new worker We have integration tests that ensure that the service listener calls the worker correctly so this test can be changed to stub at a higher level.
diff --git a/app/controllers/simple_user/auth_controller.rb b/app/controllers/simple_user/auth_controller.rb index abc1234..def5678 100644 --- a/app/controllers/simple_user/auth_controller.rb +++ b/app/controllers/simple_user/auth_controller.rb @@ -1,5 +1,16 @@ module SimpleUser class AuthController < ApplicationController + + before_filter :set_user_return_to + + def set_user_return_to + url = request.referer + namespace_name = url.split('/')[3] rescue "" + + if namespace_name != "simple_user" + session[:return_to] = request.referer + end + end def create auth = request.env["omniauth.auth"] @@ -23,15 +34,11 @@ end def redirect_after_create - logger.debug "AuthController.redirect_after_create" - logger.debug session[:return_to] if ENV['REDIRECT_USER_AFTER_SIGNIN'] == 'false' || !defined? session[:return_to] || session[:return_to] == "/" || session[:return_to].nil? session[:return_to] = "/" - logger.debug "CHANGE #{session[:return_to]}" redirect_to root_url else return_to = session[:return_to] - logger.debug "PRESERVES #{session[:return_to]}" session[:return_to] = "/" redirect_to return_to end
Change redirect after sign up for FB
diff --git a/app/services/build_markers_with_info_window.rb b/app/services/build_markers_with_info_window.rb index abc1234..def5678 100644 --- a/app/services/build_markers_with_info_window.rb +++ b/app/services/build_markers_with_info_window.rb @@ -30,7 +30,7 @@ locals: {attrs: [helper.asset_path("volunteer_icon_#{volop.source}.png"), 'data-id' => volop.id, class: 'vol_op', - title: "Click here to see volunteer opportunities at #{volop.title}"]} + title: "Click here to see volunteer opportunities at #{volop.organisation_name}"]} ), index: 1, type: 'vol_op'
Adjust tooltip to use organisation name
diff --git a/db/migrate/20140724134601_fix_yaml_encoding.rb b/db/migrate/20140724134601_fix_yaml_encoding.rb index abc1234..def5678 100644 --- a/db/migrate/20140724134601_fix_yaml_encoding.rb +++ b/db/migrate/20140724134601_fix_yaml_encoding.rb @@ -1,12 +1,14 @@ class FixYamlEncoding < ActiveRecord::Migration def self.up - fix_encoding(Block, 'settings') - fix_encoding(Product, 'data') - fix_encoding(Environment, 'settings') - fix_encoding(Profile, 'data') - fix_encoding(ActionTracker::Record, 'params') - fix_encoding(Article, 'setting') - fix_encoding(Task, 'data') + ActiveRecord::Base.transaction do + fix_encoding(Environment, 'settings') + fix_encoding(Profile, 'data') + fix_encoding(Product, 'data') + fix_encoding(ActionTracker::Record, 'params') + fix_encoding(Article, 'setting') + fix_encoding(Task, 'data') + fix_encoding(Block, 'settings') + end end def self.down @@ -16,15 +18,34 @@ private def self.fix_encoding(model, param) - result = model.find(:all, :conditions => "#{param} LIKE '%!binary%'") + result = model.all puts "Fixing #{result.count} rows of #{model} (#{param})" - result.each {|r| r.update_column(param, deep_fix(r.send(param)).to_yaml)} + result.each do |r| + begin + yaml = r.send(param) + # if deserialization failed then a string is returned + if yaml.is_a? String + yaml.gsub! ': `', ': ' + yaml = YAML.load yaml + end + r.update_column param, deep_fix(yaml).to_yaml + rescue => e + puts "FAILED #{r.inspect}" + puts e.message + end + end end def self.deep_fix(hash) hash.each do |value| - value.force_encoding('UTF-8') if value.is_a?(String) && !value.frozen? && value.encoding == Encoding::ASCII_8BIT deep_fix(value) if value.respond_to?(:each) + if value.is_a? String and not value.frozen? + if value.encoding == Encoding::ASCII_8BIT + value.force_encoding "utf-8" + else + value.encode!("iso-8859-1").force_encoding("utf-8") + end + end end end
Fix yaml migration for encodings
diff --git a/core/app/classes/fact_url.rb b/core/app/classes/fact_url.rb index abc1234..def5678 100644 --- a/core/app/classes/fact_url.rb +++ b/core/app/classes/fact_url.rb @@ -19,8 +19,8 @@ def proxy_scroll_url return unless @fact.site_url - proxy_url + "/?url=" + - CGI.escape(@fact.site_url) + "&scrollto=" + URI.escape(@fact.id) + proxy_url + "/?url=" + CGI.escape(@fact.site_url) + + "&scrollto=" + URI.escape(@fact.id) end private
Break line on another place
diff --git a/DPSlideMenuKit.podspec b/DPSlideMenuKit.podspec index abc1234..def5678 100644 --- a/DPSlideMenuKit.podspec +++ b/DPSlideMenuKit.podspec @@ -21,8 +21,11 @@ s.author = { "HongliYu" => "yhlssdone@gmail.com" } s.source = { :git => "https://github.com/HongliYu/DPSlideMenuKit-Swift.git", :tag => "#{s.version}" } - s.platform = :ios, "12.0" - s.source_files = "DPSlideMenuKitDemo/DPSlideMenuKit/*.swift" - + s.platform = :ios, "10.0" + s.requires_arc = true + s.source_files = "DPSlideMenuKitDemo/DPSlideMenuKit/", "DPSlideMenuKitDemo/DPSlideMenuKit/Base/", "DPSlideMenuKitDemo/DPSlideMenuKit/Left","DPSlideMenuKitDemo/DPSlideMenuKit/Right" + s.frameworks = 'UIKit', 'Foundation', 'QuartzCore' + s.module_name = 'DPSlideMenuKit' + s.swift_version = "4.2" end
Fix podspec source files path
diff --git a/test/models/auth_token_test.rb b/test/models/auth_token_test.rb index abc1234..def5678 100644 --- a/test/models/auth_token_test.rb +++ b/test/models/auth_token_test.rb @@ -0,0 +1,14 @@+require "test_helper" + +class AuthTokenTest < ActiveSupport::TestCase + def test_token_is_unique + # Create a token... + user = FactoryBot.create(:user) + token = user.generate_authentication_token! + + # Try to duplicate + t1 = AuthToken.new(user_id: user.id, authentication_token: token.authentication_token, auth_token_expiry: token.authentication_token) + + refute t1.valid? + end +end
TEST: Add tests for new auth tokens
diff --git a/test/plugin/keep_files_test.rb b/test/plugin/keep_files_test.rb index abc1234..def5678 100644 --- a/test/plugin/keep_files_test.rb +++ b/test/plugin/keep_files_test.rb @@ -4,6 +4,7 @@ describe Shrine::Plugins::KeepFiles do before do @attacher = attacher { plugin :keep_files } + @shrine = @attacher.shrine_class end describe "Attacher" do @@ -13,6 +14,17 @@ @attacher.destroy_attached assert @attacher.file.exists? + end + + it "doesn't spawn a background job" do + @shrine.plugin :backgrounding + @attacher.destroy_block { @called = true } + + @attacher.attach(fakeio) + @attacher.destroy_attached + + assert @attacher.file.exists? + refute @called end end @@ -24,6 +36,18 @@ assert previous_file.exists? end + + it "doesn't spawn a background job" do + @shrine.plugin :backgrounding + @attacher.destroy_block { @called = true } + + previous_file = @attacher.attach(fakeio) + @attacher.attach(fakeio) + @attacher.destroy_previous + + assert previous_file.exists? + refute @called + end end end end
Add tests that keep_files plays well with backgrounding One of the reasons why we've split Attacher#destroy_attached and Attacher#destroy is so that we can skip the background job when keep_files plugin is loaded. So we ought to add a test for that.
diff --git a/spec/integration/renalware/reporting/refreshing_audit_data_spec.rb b/spec/integration/renalware/reporting/refreshing_audit_data_spec.rb index abc1234..def5678 100644 --- a/spec/integration/renalware/reporting/refreshing_audit_data_spec.rb +++ b/spec/integration/renalware/reporting/refreshing_audit_data_spec.rb @@ -4,7 +4,7 @@ feature "Refreshing audit data", type: :feature, js: true do scenario "Manually requesting to refresh audit data" do - login_as_clinical + login_as_super_admin create(:audit, name: "xx", view_name: "yy") visit reporting_audits_path ActiveJob::Base.queue_adapter = :test
Fix specs now that aonly superadmin can refresh an audit
diff --git a/spec/tar_writer_spec.rb b/spec/tar_writer_spec.rb index abc1234..def5678 100644 --- a/spec/tar_writer_spec.rb +++ b/spec/tar_writer_spec.rb @@ -0,0 +1,33 @@+describe Metacrunch::TarWriter do + + let(:regular_tar_file) { "/tmp/metacrunch_spec_regular_file.tar" } + let(:compressed_tar_file) { "/tmp/metacrunch_spec_regular_file.tar.gz" } + + before do + File.unlink(regular_tar_file) if File.exist?(regular_tar_file) + File.unlink(compressed_tar_file) if File.exist?(compressed_tar_file) + end + + it "can write a file" do + writer = Metacrunch::TarWriter.new(regular_tar_file) + writer.write("FOO", filename: "foo.txt") + writer.write("BAR", filename: "bar.txt") + writer.close + + files = Metacrunch::FileReader.new(regular_tar_file).each + expect(files.count).to eq(2) + expect(files.first.contents).to eq("FOO") + end + + it "can write a compressed file" do + writer = Metacrunch::TarWriter.new(compressed_tar_file) + writer.write("FOO", filename: "foo.txt") + writer.write("BAR", filename: "bar.txt") + writer.close + + files = Metacrunch::FileReader.new(compressed_tar_file).each + expect(files.count).to eq(2) + expect(files.first.contents).to eq("FOO") + end + +end
Add spec for tar writer.
diff --git a/lib/designernews/stories.rb b/lib/designernews/stories.rb index abc1234..def5678 100644 --- a/lib/designernews/stories.rb +++ b/lib/designernews/stories.rb @@ -3,11 +3,11 @@ include HTTParty base_uri 'http://www.designernews.co/api/v2' - default_params :client_id => ENV['DESIGNER_NEWS_CLIENT_ID'] + default_params :client_id => ENV['DESIGNER_NEWS_CLIENT_ID'], :sort => '-created_at' format :json def self.recent - stories = get('/stories/recent', :stories) + stories = get('/stories', :stories) stories.map { |story| Story.new(story) } end
Update Stories endpoint to API v2 format
diff --git a/lib/autoreply/scanner/headers/by_existance.rb b/lib/autoreply/scanner/headers/by_existance.rb index abc1234..def5678 100644 --- a/lib/autoreply/scanner/headers/by_existance.rb +++ b/lib/autoreply/scanner/headers/by_existance.rb @@ -16,6 +16,7 @@ x-ebay-mailtracker x-autoresponder x-autorespond + auto-submitted ) def autoreply?
Add auto-submitted header to the blacklist
diff --git a/lib/bugsnag/middleware/discard_error_class.rb b/lib/bugsnag/middleware/discard_error_class.rb index abc1234..def5678 100644 --- a/lib/bugsnag/middleware/discard_error_class.rb +++ b/lib/bugsnag/middleware/discard_error_class.rb @@ -12,7 +12,7 @@ ## # @param report [Report] def call(report) - ignore_error_class = report.raw_exceptions.any? do |ex| + should_discard = report.raw_exceptions.any? do |ex| report.configuration.discard_classes.any? do |to_ignore| case to_ignore when String then to_ignore == ex.class.name @@ -22,7 +22,7 @@ end end - report.ignore! if ignore_error_class + report.ignore! if should_discard @middleware.call(report) end
Rename from ignore -> discard
diff --git a/test/test_scaler_middleware.rb b/test/test_scaler_middleware.rb index abc1234..def5678 100644 --- a/test/test_scaler_middleware.rb +++ b/test/test_scaler_middleware.rb @@ -0,0 +1,32 @@+require File.dirname(__FILE__) + '/helper' + +class ScalerMiddlewareTest < Test::Unit::TestCase + def test_default_factor_set_to_one + receiver = flexmock + m = Tracksperanto::Middleware::Scaler.new(receiver) + assert_equal 1.0, m.x_factor + assert_equal 1.0, m.y_factor + end + + def test_scaler_supports_hash_init + receiver = flexmock + m = Tracksperanto::Middleware::Scaler.new(receiver, :x_factor => 1.2) + assert_equal 1.2, m.x_factor + end + + def test_scaler_bypasses_methods + receiver = flexmock + receiver.should_receive(:start_export).once.with(100,180) + receiver.should_receive(:start_tracker_segment).once.with("Tracker") + receiver.should_receive(:export_point).once.with(1, 120, 90, 0) + receiver.should_receive(:end_tracker_segment).once + receiver.should_receive(:end_export).once + + m = Tracksperanto::Middleware::Scaler.new(receiver, :x_factor => 2, :y_factor => 3) + m.start_export(50, 60) + m.start_tracker_segment("Tracker") + m.export_point(1, 60, 30, 0) + m.end_tracker_segment + m.end_export + end +end
Add test for Scaler middleware
diff --git a/lib/tasks/temp/sync_effort_elapsed_times.rake b/lib/tasks/temp/sync_effort_elapsed_times.rake index abc1234..def5678 100644 --- a/lib/tasks/temp/sync_effort_elapsed_times.rake +++ b/lib/tasks/temp/sync_effort_elapsed_times.rake @@ -8,19 +8,18 @@ task :initialize_elapsed_seconds => :environment do puts "Initializing the elapsed_seconds column" - starting_split_times = ::SplitTime.joins(:split).where(lap: 1, bitkey: ::SubSplit::IN_BITKEY, splits: {kind: :start}) - starting_split_times_count = starting_split_times.count + efforts = Effort.all + efforts_count = efforts.count - puts "Found #{starting_split_times_count} starting split times" + puts "Found #{efforts_count} efforts" - progress_bar = ::ProgressBar.new(starting_split_times_count) + progress_bar = ::ProgressBar.new(efforts_count) - starting_split_times.find_each do |sst| + efforts.find_each do |effort| progress_bar.increment! - sst.send(:sync_effort_elapsed_seconds) - sst.save! + effort.split_times.first&.send(:sync_elapsed_seconds) rescue ActiveRecordError => e - puts "Could not initialize for effort #{sst.effort_id}:" + puts "Could not initialize for effort #{effort.id}:" puts e end end
Update rake task for new sync method
diff --git a/Library/Formula/automake.rb b/Library/Formula/automake.rb index abc1234..def5678 100644 --- a/Library/Formula/automake.rb +++ b/Library/Formula/automake.rb @@ -16,7 +16,7 @@ "--prefix=#{prefix}" system "make install" - (share/"aclocal-#{version}/dirlist").write <<-EOS.undent + (share/"aclocal/dirlist").write <<-EOS.undent /usr/share/aclocal #{HOMEBREW_PREFIX}/share/aclocal EOS
Put dirlist in the right place I fixed this last night, and then somehow committed the wrong version. Don't watch the Oscars while doing Homebrew.
diff --git a/AFCSVParserResponseSerializer.podspec b/AFCSVParserResponseSerializer.podspec index abc1234..def5678 100644 --- a/AFCSVParserResponseSerializer.podspec +++ b/AFCSVParserResponseSerializer.podspec @@ -17,6 +17,6 @@ s.ios.exclude_files = 'Classes/osx' s.osx.exclude_files = 'Classes/ios' - s.dependency 'AFNetworking', '~> 2.3' + s.dependency 'AFNetworking', '~> 3.0' s.dependency 'CHCSVParser', '~> 2.0' end
Upgrade dependency on AFNetworking 3.0
diff --git a/lib/stash_datacite/merritt_packager.rb b/lib/stash_datacite/merritt_packager.rb index abc1234..def5678 100644 --- a/lib/stash_datacite/merritt_packager.rb +++ b/lib/stash_datacite/merritt_packager.rb @@ -1,23 +1,11 @@ require 'stash_engine' +require 'stash_engine/sword/packager' require 'stash_datacite' require 'stash_datacite/resource_file_generation' module StashDatacite # Creates a {Package} for submission to Merritt - class MerrittPackager - attr_reader :resource - attr_reader :tenant - attr_reader :url_helpers - attr_reader :request_host - attr_reader :request_port - - def initialize(resource:, tenant:, url_helpers:, request_host:, request_port:) - @resource = resource - @tenant = tenant - @url_helpers = url_helpers - @request_host = request_host - @request_port = request_port - end + class MerrittPackager < StashEngine::Sword::Packager # Creates a new zipfile package # @@ -39,10 +27,6 @@ ) end - def to_s - "#{self.class}(resource: #{resource.id}, tenant: #{tenant.tenant_id})" - end - private def main_title(resource)
Make MerrittPackager extend abstract Sword::Packager
diff --git a/tests/test_unit_box_handler.rb b/tests/test_unit_box_handler.rb index abc1234..def5678 100644 --- a/tests/test_unit_box_handler.rb +++ b/tests/test_unit_box_handler.rb @@ -0,0 +1,17 @@+require 'test_helper' +require 'minitest/autorun' +require "matrix" + +describe "sudokuru_unit_box_handler" do + + it "should replace non erroneous box values with blanks" do + load "././app/box_handler.rb" + box_map = Matrix.identity(3) + puzzle = Matrix.zero(3) + box_handler = BoxHandler.new(puzzle, box_map) + value = 1 + output = box_handler.replace_non_erroneous_box_values_with_blanks(box_map, value) + output.must_equal (Matrix[[1, "-", "-"], ["-", 1, "-"], ["-", "-", 1]]) + end + +end
Complete box handler spec coverage Dial coverage up to 11.
diff --git a/test/integration/default/serverspec/spec_helper.rb b/test/integration/default/serverspec/spec_helper.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/spec_helper.rb +++ b/test/integration/default/serverspec/spec_helper.rb @@ -5,7 +5,6 @@ RSpec.configure do |c| c.before :all do - c.os = backend(Serverspec::Commands::Base).check_os c.path = "/sbin:/usr/sbin" end end
Remove superfluous line from serverspec spec helper
diff --git a/test/integration/elasticsearch_index_group_test.rb b/test/integration/elasticsearch_index_group_test.rb index abc1234..def5678 100644 --- a/test/integration/elasticsearch_index_group_test.rb +++ b/test/integration/elasticsearch_index_group_test.rb @@ -0,0 +1,57 @@+require "integration_test_helper" +require "rest-client" +require "cgi" + +class ElasticsearchIndexGroupTest < IntegrationTest + + def setup + @group_name = "rummager_test" + stub_elasticsearch_settings [@group_name] + enable_test_index_connections + try_remove_test_index + + @index_group = search_server.index_group(@group_name) + end + + def teardown + clean_index_group @group_name + end + + def test_should_create_index + assert @index_group.index_names.empty? + index = @index_group.create_index + + assert_equal 1, @index_group.index_names.count + assert_equal index.index_name, @index_group.index_names[0] + assert_equal( + app.settings.elasticsearch_schema["mappings"]["default"], + index.mappings + ) + end + + def test_should_alias_index + index = @index_group.create_index + @index_group.switch_to(index) + + assert_equal index.real_name, @index_group.current.real_name + end + + def test_should_switch_index + old_index = @index_group.create_index + @index_group.switch_to(old_index) + + new_index = @index_group.create_index + @index_group.switch_to(new_index) + + assert_equal new_index.real_name, @index_group.current.real_name + end + + def test_should_clean_indices + @index_group.create_index + @index_group.switch_to(@index_group.create_index) + + assert_equal 2, @index_group.index_names.count + @index_group.clean + assert_equal 1, @index_group.index_names.count + end +end
Add integration tests for index groups.
diff --git a/lib/tasks/static_pages.rake b/lib/tasks/static_pages.rake index abc1234..def5678 100644 --- a/lib/tasks/static_pages.rake +++ b/lib/tasks/static_pages.rake @@ -2,9 +2,9 @@ desc "Generates static pages" task generate: 'assets:precompile' do pages = { - 'static/404' => '404.html', - 'static/500' => '500.html', - 'static/503' => '503.html', + '/static/404' => '404.html', + '/static/500' => '500.html', + '/static/503' => '503.html', '/cookies' => 'cookies.html', '/cookies-disabled' => 'cookies-disabled.html', '/terms-and-conditions' => 'terms-and-conditions.html',
Allow Rails test sessions to generate valid URIs It appears that `ActionDispatch::Testing::Integration#build_full_uri` (in ActionPack 4.2.1 and possibly earlier) requires requested paths to include leading slashes (which they probably should have done anyway). Without valid paths, it builds invalid URIs like `www.example.com:80static`, which cause other parts of Rails to fail when we attempt to generate our static pages. Not having leading slashes caused generation of static pages to fail (as described [on the pull request](https://github.com/ministryofjustice/prison-visits/pull/216#issuecomment-107908617)).
diff --git a/lib/ruby-with.rb b/lib/ruby-with.rb index abc1234..def5678 100644 --- a/lib/ruby-with.rb +++ b/lib/ruby-with.rb @@ -18,8 +18,8 @@ context.instance_exec(self, &block) class << context - remove_method :set - remove_method :<= + remove_method :set if method_defined? :set + remove_method :<= if method_defined? :<= end end
Handle times when instance method is not defined.
diff --git a/lib/wolverine.rb b/lib/wolverine.rb index abc1234..def5678 100644 --- a/lib/wolverine.rb +++ b/lib/wolverine.rb @@ -27,7 +27,7 @@ # cached in-memory, so if a file changes on disk, it will be necessary to # manually reset the cache using +reset!+. # - # @return nil + # @return [void] def self.reset! @root_directory = nil end
Add void return to docs
diff --git a/headless_html_editor.gemspec b/headless_html_editor.gemspec index abc1234..def5678 100644 --- a/headless_html_editor.gemspec +++ b/headless_html_editor.gemspec @@ -4,19 +4,19 @@ require 'headless_html_editor/version' Gem::Specification.new do |spec| - spec.name = "headless_html_editor" + spec.name = 'headless_html_editor' spec.version = HeadlessHtmlEditor::VERSION - spec.authors = ["Bo Frederiksen"] - spec.email = ["bofrede@bofrede.dk"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} - spec.homepage = "" - spec.license = "MIT" - spec.files = `git ls-files`.split($/) + spec.authors = ['Bo Frederiksen'] + spec.email = ['bofrede@bofrede.dk'] + spec.description = 'Headless HTML Editor - edit HTML files, without a UI.' + spec.summary = '' + spec.homepage = '' + spec.license = 'MIT' + spec.files = ['lib/headless_html_editor.rb'] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] - spec.add_dependency "nokogiri", ">= 1.6.0" - spec.add_development_dependency "bundler", "~> 1.3" - spec.add_development_dependency "rake" + spec.require_paths = ['lib'] + spec.add_dependency 'nokogiri', '>= 1.6.0' + spec.add_development_dependency 'bundler', '~> 1.3' + spec.add_development_dependency 'rake' end
Fix for mingw32 and single quotes.
diff --git a/pakyow-presenter/spec/unit/presenter_config_spec.rb b/pakyow-presenter/spec/unit/presenter_config_spec.rb index abc1234..def5678 100644 --- a/pakyow-presenter/spec/unit/presenter_config_spec.rb +++ b/pakyow-presenter/spec/unit/presenter_config_spec.rb @@ -0,0 +1,37 @@+require_relative '../spec_helper' +require 'core/config' +require 'presenter/config/presenter' + +describe 'configuration' do + it 'registers presenter config' do + expect(Pakyow::Config.presenter).to be_a(Pakyow::Config) + end + + describe 'options' do + let :opts do + Pakyow::Config.presenter + .instance_variable_get(:@defaults) + .instance_variable_get(:@opts) + .keys + end + + describe 'require_route' do + it 'is defined' do + expect(opts).to include(:require_route) + end + + it 'sets a default require_route value for development' do + Pakyow::Config.env = :development + expect(Pakyow::Config.presenter.require_route).to eq(false) + Pakyow::Config.env = :test + end + + it 'sets a default require_route value for production' do + Pakyow::Config.env = :production + expect(Pakyow::Config.presenter.require_route).to eq(true) + Pakyow::Config.env = :test + end + end + end +end +
Add test for require_route presenter config
diff --git a/Casks/vimediamanager.rb b/Casks/vimediamanager.rb index abc1234..def5678 100644 --- a/Casks/vimediamanager.rb +++ b/Casks/vimediamanager.rb @@ -2,6 +2,7 @@ version '0.7a14c' sha256 '2fb3dc8b5d2c5ab40a34e18c0860da98d1b92bac673f8a134bfca82cf013714a' + # mariusth.channelwood.org was verified as official when first introduced to the cask url "http://mariusth.channelwood.org/vimediamanager/files/vimediamanager_v#{version}.dmg" appcast 'http://mariusth.heliohost.org/vimediamanager/appcast-cocoa.xml', checkpoint: '432abeca6ddfeae43f3e915996d9f691ec7b066620545abe05b237d385e4a468'
Fix `url` stanza comment for ViMediaManager.
diff --git a/config/initializers/clearance.rb b/config/initializers/clearance.rb index abc1234..def5678 100644 --- a/config/initializers/clearance.rb +++ b/config/initializers/clearance.rb @@ -5,4 +5,5 @@ config.password_strategy = Clearance::PasswordStrategies::BCryptMigrationFromSHA1 config.sign_in_guards = [ConfirmedUserGuard] config.rotate_csrf_on_sign_in = true + config.cookie_expiration = ->(_cookies) { 2.weeks.from_now.utc } end
Expire remember_token cookie after 2 weeks Default expiration time is one year, which is too long. https://github.com/thoughtbot/clearance/blob/5d29439ee4340738eacc8d5cd8bfbbb10a576f38/lib/clearance/configuration.rb#L25
diff --git a/config/initializers/mailboxer.rb b/config/initializers/mailboxer.rb index abc1234..def5678 100644 --- a/config/initializers/mailboxer.rb +++ b/config/initializers/mailboxer.rb @@ -14,5 +14,25 @@ @type = type @id = "#{messageable.class.name}-#{messageable.id}-#{type}" end + + def self.find(id) + id_parts = id.split('-') + messageable = Object.const_get(id_parts[0]).find(id_parts[1]) + Mailboxer::Mailbox.new(messageable, id_parts[2]) + end + + def drafts + Mailboxer::Conversation.draft(messageable) + end + end + + Mailboxer::Receipt.class_eval do + scope :draft, lambda { where(is_draft: true) } + end + + Mailboxer::Conversation.class_eval do + scope :draft, lambda { |participant| + participant(participant).merge(Mailboxer::Receipt.draft) + } end end
Add a find method to find mailbox by id
diff --git a/Casks/intellij-idea-ce-eap.rb b/Casks/intellij-idea-ce-eap.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea-ce-eap.rb +++ b/Casks/intellij-idea-ce-eap.rb @@ -1,19 +1,20 @@ cask 'intellij-idea-ce-eap' do - version '143.1183.10' - sha256 '8f9597e732ed7e169d21026c73e5da4ac841fcf44f1c98250bb44fd317169753' + version '144.2608.2' + sha256 '21d2fd409de9924d04a235bf5343033a52d84658fdf96e16d6aab377beab0fea' - url "https://download.jetbrains.com/idea/ideaIC-#{version}-custom-jdk-bundled.dmg" + url "https://download.jetbrains.com/idea/ideaIC-#{version}.dmg" name 'IntelliJ IDEA EAP :: CE' - homepage 'https://confluence.jetbrains.com/display/IDEADEV/IDEA+15+EAP' + homepage 'https://confluence.jetbrains.com/display/IDEADEV/IDEA+16+EAP' license :apache - app 'IntelliJ IDEA 15 CE EAP.app' + app 'IntelliJ IDEA 16 CE EAP.app' zap :delete => [ - '~/Library/Preferences/com.jetbrains.intellij.plist', - '~/Library/Application Support/IdeaIC15', - '~/Library/Preferences/IdeaIC15', - '~/Library/Caches/IdeaIC15', - '~/Library/Logs/IdeaIC15', + '~/Library/Application Support/IdeaIC16', + '~/Library/Caches/IdeaIC16', + '~/Library/Logs/IdeaIC16', + '~/Library/Preferences/com.jetbrains.intellij.ce.plist', + '~/Library/Preferences/IdeaIC16', + '~/Library/Saved Application State/com.jetbrains.intellij.ce.savedState', ] end
Upgrade IntelliJ IDEA CE EAP to 144.2608.2
diff --git a/rbpod.gemspec b/rbpod.gemspec index abc1234..def5678 100644 --- a/rbpod.gemspec +++ b/rbpod.gemspec @@ -24,4 +24,6 @@ spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' + + spec.add_dependency 'trollop', '~> 2.0' end
Bring in Trollop for CLI utility.
diff --git a/test/mailers/email_changed_test.rb b/test/mailers/email_changed_test.rb index abc1234..def5678 100644 --- a/test/mailers/email_changed_test.rb +++ b/test/mailers/email_changed_test.rb @@ -0,0 +1,90 @@+require 'test_helper' + +class EmailChangedTest < ActionMailer::TestCase + def setup + setup_mailer + Devise.mailer = 'Devise::Mailer' + Devise.mailer_sender = 'test@example.com' + Devise.send_email_changed_notification = true + end + + def teardown + Devise.mailer = 'Devise::Mailer' + Devise.mailer_sender = 'please-change-me@config-initializers-devise.com' + Devise.send_email_changed_notification = false + end + + def user + @user ||= create_user.tap { |u| + @original_user_email = u.email + u.update_attributes!(email: 'new-email@example.com') + } + end + + def mail + @mail ||= begin + user + ActionMailer::Base.deliveries.last + end + end + + test 'email sent after changing the user email' do + assert_not_nil mail + end + + test 'content type should be set to html' do + assert mail.content_type.include?('text/html') + end + + test 'send email changed to the original user email' do + mail + assert_equal [@original_user_email], mail.to + end + + test 'set up sender from configuration' do + assert_equal ['test@example.com'], mail.from + end + + test 'set up sender from custom mailer defaults' do + Devise.mailer = 'Users::Mailer' + assert_equal ['custom@example.com'], mail.from + end + + test 'set up sender from custom mailer defaults with proc' do + Devise.mailer = 'Users::FromProcMailer' + assert_equal ['custom@example.com'], mail.from + end + + test 'custom mailer renders parent mailer template' do + Devise.mailer = 'Users::Mailer' + assert_present mail.body.encoded + end + + test 'set up reply to as copy from sender' do + assert_equal ['test@example.com'], mail.reply_to + end + + test 'set up reply to as different if set in defaults' do + Devise.mailer = 'Users::ReplyToMailer' + assert_equal ['custom@example.com'], mail.from + assert_equal ['custom_reply_to@example.com'], mail.reply_to + end + + test 'set up subject from I18n' do + store_translations :en, devise: { mailer: { email_changed: { subject: 'Email Has Changed' } } } do + assert_equal 'Email Has Changed', mail.subject + end + end + + test 'subject namespaced by model' do + store_translations :en, devise: { mailer: { email_changed: { user_subject: 'User Email Has Changed' } } } do + assert_equal 'User Email Has Changed', mail.subject + end + end + + test 'body should have user info' do + body = mail.body.encoded + assert_match @original_user_email, body + assert_match user.email, body + end +end
Add some basic tests for the email changed notification
diff --git a/yardstick.gemspec b/yardstick.gemspec index abc1234..def5678 100644 --- a/yardstick.gemspec +++ b/yardstick.gemspec @@ -18,7 +18,7 @@ gem.require_paths = %w[lib] gem.files = `git ls-files`.split($/) gem.test_files = `git ls-files -- spec/{public,semipublic}`.split($/) - gem.extra_rdoc_files = %w[LICENSE README.rdoc] + gem.extra_rdoc_files = %w[LICENSE README.md] gem.executables = %w[yardstick] gem.add_dependency 'backports', ['~> 3.0', '>= 3.0.3']
Update gemspec to include README.md
diff --git a/plugins/currency/lib/ext/enterprise.rb b/plugins/currency/lib/ext/enterprise.rb index abc1234..def5678 100644 --- a/plugins/currency/lib/ext/enterprise.rb +++ b/plugins/currency/lib/ext/enterprise.rb @@ -10,10 +10,11 @@ :conditions => ['currency_plugin_enterprise_currencies.is_organizer = ?', true], :order => 'id ASC' has_many :currencies, :through => :enterprise_currencies, :source => :currency, :order => 'id ASC' - def currencies_list - [[Environment.default.currency_unit, 'env']] + self.currencies.map{ |c| [c.name_with_symbol, c.id] } + alias_method :orig_currencies, :currencies + def currencies + self.orig_currencies + [self.environment.default_currency] end - + def other_currencies self.environment.currencies - self.currencies end
Add environment default currency for profile currencies
diff --git a/spec/api_spec_helper.rb b/spec/api_spec_helper.rb index abc1234..def5678 100644 --- a/spec/api_spec_helper.rb +++ b/spec/api_spec_helper.rb @@ -3,6 +3,7 @@ require 'spec_helper' require 'url_helper' require 'api/base' +require 'warden' module RackHelper include Rack::Test::Methods @@ -12,6 +13,7 @@ end alias_method :response, :last_response + end @@ -19,4 +21,7 @@ config.include RackHelper config.include JsonSpec::Helpers config.include UrlHelper + config.include Warden::Test::Helpers + + config.after(:each) { Warden.test_reset! } end
Add warden test helpers to api spec helpers
diff --git a/spec/factories/event.rb b/spec/factories/event.rb index abc1234..def5678 100644 --- a/spec/factories/event.rb +++ b/spec/factories/event.rb @@ -11,7 +11,7 @@ event_group trait :with_short_name do - short_name { "#{rand(25..200)}#{['-mile', 'k' 'M']}" } + short_name { "#{rand(25..200)}#{['-mile', 'k' 'M'].sample}" } end transient { without_slug { false } }
Fix trait: :with_short_name in Event factory.
diff --git a/spec/support/shoulds.rb b/spec/support/shoulds.rb index abc1234..def5678 100644 --- a/spec/support/shoulds.rb +++ b/spec/support/shoulds.rb @@ -0,0 +1,10 @@+def should_be_unchanged(*records) + records.flatten.each do |record| + comparison = Mingo.collection.find_one(:_id => record['_id']) + + comparison.keys.sort.should == record.keys.sort + comparison.keys.each do |key| + comparison[key].should == record[key] + end + end +end
Support method to ensure that a record reflects what is in the database.
diff --git a/config/unicorn/production.rb b/config/unicorn/production.rb index abc1234..def5678 100644 --- a/config/unicorn/production.rb +++ b/config/unicorn/production.rb @@ -8,7 +8,7 @@ listen "127.0.0.1:8080" # Spawn unicorn master worker for user apps (group: apps) -user 'rails', 'rails' +user 'root', 'rails' # Fill path to your app working_directory app_path
Test with another user for unicorn deployment
diff --git a/Casks/ripit.rb b/Casks/ripit.rb index abc1234..def5678 100644 --- a/Casks/ripit.rb +++ b/Casks/ripit.rb @@ -9,5 +9,7 @@ homepage 'http://thelittleappfactory.com/ripit/' license :commercial + auto_updates true + app 'RipIt.app' end
Add auto_updates flag to Ripit
diff --git a/tasks/integration.rake b/tasks/integration.rake index abc1234..def5678 100644 --- a/tasks/integration.rake +++ b/tasks/integration.rake @@ -1,8 +1,8 @@ task :integration do Dir.chdir("test_rails_4_app") do if ENV["TRAVIS"] - sh "MUTE_PROGRESS_BAR=true ERROR_VERBOSITY=0 bundle exec rake active_mocker:build" - sh "bundle exec rspec" + sh "MUTE_PROGRESS_BAR=true ERROR_VERBOSITY=0 rake active_mocker:build" + sh "rspec" else Bundler.with_clean_env do rails_test_gemfile = File.expand_path(File.dirname(__FILE__)+ "/../test_rails_4_app/Gemfile")
Remove bundle exec for Travis
diff --git a/app/services/gravatar_service.rb b/app/services/gravatar_service.rb index abc1234..def5678 100644 --- a/app/services/gravatar_service.rb +++ b/app/services/gravatar_service.rb @@ -0,0 +1,28 @@+class GravatarService + def execute(email, size = nil) + if gravatar_config.enabled && email.present? + size = 40 if size.nil? || size <= 0 + + sprintf gravatar_url, + hash: Digest::MD5.hexdigest(email.strip.downcase), + size: size, + email: email.strip + end + end + + def gitlab_config + Gitlab.config.gitlab + end + + def gravatar_config + Gitlab.config.gravatar + end + + def gravatar_url + if gitlab_config.https + gravatar_config.ssl_url + else + gravatar_config.plain_url + end + end +end
Move gravatar url compose to separate service Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
diff --git a/watir/unittests/css_test.rb b/watir/unittests/css_test.rb index abc1234..def5678 100644 --- a/watir/unittests/css_test.rb +++ b/watir/unittests/css_test.rb @@ -8,11 +8,10 @@ def isMessageDisplayed(message) s = false - divs = browser.getIE.document.getElementsByTagName("DIV") + divs = browser.divs divs.each do |d| - - if d.innerText.to_s.downcase.match( /#{message}/i ) - if d.invoke("className").to_s.downcase.match(/show/i) + if d.text.downcase.match( /#{message}/i ) + if d.class_name.downcase.match(/show/i) s = true end end @@ -25,7 +24,6 @@ goto_page "cssTest.html" end - tag_method :test_SuccessMessage, :fails_on_firefox def test_SuccessMessage browser.button( :caption , "Success").click assert( isMessageDisplayed("Success") )
Rewrite test so it also works with firefox.
diff --git a/Parity.podspec b/Parity.podspec index abc1234..def5678 100644 --- a/Parity.podspec +++ b/Parity.podspec @@ -11,10 +11,10 @@ s.homepage = "https://github.com/dclelland/Parity" s.license = { :type => 'MIT' } s.author = { "Daniel Clelland" => "daniel.clelland@gmail.com" } - s.source = { :git => "https://github.com/dclelland/Parity.git", :tag => "2.2.0" } - s.platform = :ios, '8.0' + s.source = { :git => "https://github.com/dclelland/Parity.git", :tag => "2.3.0" } s.swift_version = '5.0' s.ios.deployment_target = '8.0' - s.ios.source_files = 'Parity.swift' + s.osx.deployment_target = '10.15' + s.source_files = 'Parity.swift' s.requires_arc = true end
Set a macOS deployment target
diff --git a/test/ruby/test_case.rb b/test/ruby/test_case.rb index abc1234..def5678 100644 --- a/test/ruby/test_case.rb +++ b/test/ruby/test_case.rb @@ -3,7 +3,7 @@ require "active_support/core_ext/object/blank" require "active_support/core_ext/object/try" require "active_support/concern" -require "mocha" +require "mocha/setup" module Ruby class TestCase < MiniTest::Unit::TestCase
Use mocha/setup in place of deprecated mocha
diff --git a/spec/unit/berkshelf/api/config_spec.rb b/spec/unit/berkshelf/api/config_spec.rb index abc1234..def5678 100644 --- a/spec/unit/berkshelf/api/config_spec.rb +++ b/spec/unit/berkshelf/api/config_spec.rb @@ -18,7 +18,6 @@ it "has the Supermarket community site as an endpoint" do expect(subject.endpoints.first.type).to eql("supermarket") - expect(subject.endpoints.first.options[:url]).to eql("https://supermarket.getchef.com/api/v1") end end end
Remove unneeded test for the Supermarket URL
diff --git a/AHKNavigationController.podspec b/AHKNavigationController.podspec index abc1234..def5678 100644 --- a/AHKNavigationController.podspec +++ b/AHKNavigationController.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AHKNavigationController" s.version = "0.1.1" - s.summary = "A UINavigationController replacement allowing interactive pop gesture when the navigation bar is hidden or a custom back button is used." + s.summary = "A UINavigationController subclass allowing the interactive pop gesture when the navigation bar is hidden or a custom back button is used." s.homepage = "https://github.com/fastred/AHKNavigationController" s.license = { :type => "MIT", :file => "LICENSE" }
Improve summary in the podspec
diff --git a/app/models/lab_has_group.rb b/app/models/lab_has_group.rb index abc1234..def5678 100644 --- a/app/models/lab_has_group.rb +++ b/app/models/lab_has_group.rb @@ -10,4 +10,11 @@ validates_presence_of :lab, :lab_group, :repository validates_uniqueness_of :lab_id, scope: :lab_group_id validates_uniqueness_of :repository_id + validate :given_courses_match + + def given_courses_match + if lab.given_course != lab_group.given_course + errors[:base] << "Given courses for lab and lab group do not match" + end + end end
Add validations for matching given courses to labhasgroup
diff --git a/app/models/orchid/facets.rb b/app/models/orchid/facets.rb index abc1234..def5678 100644 --- a/app/models/orchid/facets.rb +++ b/app/models/orchid/facets.rb @@ -10,9 +10,9 @@ # sets the list of facets with or without the entire API's collections def facet_info=(val) - # Remove project key if API URL uses a specific collection + # Remove collection key if API URL uses a specific collection if /\/collection\/\w+$/.match(API_PATH) - val.delete("project") + val.delete("collection") end @facet_info = val end
Fix facet key deletion if API path sets collection Wasn't updated when project renamed to collection
diff --git a/lib/envato_optimiser/item.rb b/lib/envato_optimiser/item.rb index abc1234..def5678 100644 --- a/lib/envato_optimiser/item.rb +++ b/lib/envato_optimiser/item.rb @@ -10,18 +10,51 @@ def initialize(url) - @uri = URI.parse(url) - @response = Net::HTTP.get_response(uri) - @document = Nokogiri::HTML(response.body) + @uri = URI.parse(url) + @response = Net::HTTP.get_response(uri) + @document = Nokogiri::HTML(response.body) + @image_404s = [] + @image_403s = [] + @image_redirects = [] end def user_image_count user_images.size end + def image_count + images.size + end + + def image_403_count + @image_403s.size + end + + def image_404_count + @image_404s.size + end + + def image_redirect_count + @image_redirects.size + end private - def user_images + def image_response_check + images.each do |image| + response = Net::HTTP.get_response(URI.parse(image)) + + case response.code.to_i + when 300..399 + @image_redirects << image + when 404 + @image_404s << image + when 403 + @image_403s << image + end + end + end + + def images images = [] @document.css('.user-html img').map do |image|
Fix the instance variable scoping and use
diff --git a/lib/hydrant-batch/package.rb b/lib/hydrant-batch/package.rb index abc1234..def5678 100644 --- a/lib/hydrant-batch/package.rb +++ b/lib/hydrant-batch/package.rb @@ -27,7 +27,7 @@ def each_entry @manifest.each do |entry| files = entry[:files].collect { |f| File.join(@dir,f) } - yield(entry[:fields], files) + yield(entry[:fields], files, entry[:opts]) end end @@ -46,8 +46,8 @@ @manifest.start! begin - each_entry do |fields, files| - yield(fields, files) + each_entry do |fields, files, opts| + yield(fields, files, opts) end @manifest.commit! rescue Exception
Make sure Package yields opts
diff --git a/lib/oauth2/provider/rails.rb b/lib/oauth2/provider/rails.rb index abc1234..def5678 100644 --- a/lib/oauth2/provider/rails.rb +++ b/lib/oauth2/provider/rails.rb @@ -6,10 +6,20 @@ class Railtie < Rails::Railtie config.oauth2_provider = ActiveSupport::OrderedOptions.new + config.oauth2_provider.active_record = ActiveSupport::OrderedOptions.new + config.oauth2_provider.mongoid = ActiveSupport::OrderedOptions.new initializer "oauth2_provider.config" do |app| - app.config.oauth2_provider.each do |k,v| + app.config.oauth2_provider.except(:active_record, :mongoid).each do |k,v| OAuth2::Provider.send "#{k}=", v + end + + app.config.oauth2_provider.active_record.each do |k, v| + OAuth2::Provider::Models::ActiveRecord.send "#{k}=", v + end + + app.config.oauth2_provider.mongoid.each do |k, v| + OAuth2::Provider::Models::Mongoid.send "#{k}=", v end case OAuth2::Provider.backend
Fix broken mongoid and active record configuration
diff --git a/lib/stack_master/identity.rb b/lib/stack_master/identity.rb index abc1234..def5678 100644 --- a/lib/stack_master/identity.rb +++ b/lib/stack_master/identity.rb @@ -8,9 +8,8 @@ @account ||= sts.get_caller_identity.account end + private - - attr_reader :sts def region @region ||= ENV['AWS_REGION'] || Aws.config[:region] || Aws.shared_config.region || 'us-east-1'
Remove unneeded attr_reader in Identity class There's a method with that name.
diff --git a/lib/tasks/remove_unused.rake b/lib/tasks/remove_unused.rake index abc1234..def5678 100644 --- a/lib/tasks/remove_unused.rake +++ b/lib/tasks/remove_unused.rake @@ -12,3 +12,6 @@ ).each do |task| Rake.application.remove_task task end + +# Do not run migrations if in production, non API app should handle those +Rake.application.remove_task('db:migrate') if Rails.env.production?
Remove db:migrate task from production.
diff --git a/lib/yard/rake/yardoc_task.rb b/lib/yard/rake/yardoc_task.rb index abc1234..def5678 100644 --- a/lib/yard/rake/yardoc_task.rb +++ b/lib/yard/rake/yardoc_task.rb @@ -15,8 +15,8 @@ @files = [] yield self if block_given? - self.options += ENV['OPTS'].split(' ') if ENV['OPTS'] - self.files += ENV['FILES'].split(',') if ENV['FILES'] + self.options += ENV['OPTS'].split(/[ ,]/) if ENV['OPTS'] + self.files += ENV['FILES'].split(/[ ,]/) if ENV['FILES'] define end
Allow comma delimitation in OPTS and space delimitation in FILES
diff --git a/Casks/geniego.rb b/Casks/geniego.rb index abc1234..def5678 100644 --- a/Casks/geniego.rb +++ b/Casks/geniego.rb @@ -2,6 +2,7 @@ version :latest sha256 :no_check + # directv.vo.llnwd.net was verified as official when first introduced to the cask url 'http://directv.vo.llnwd.net/e4/nomad/MACOS-client.dmg' name 'DIRECTV GenieGO' homepage 'http://www.directv.com/technology/geniego'
Fix `url` stanza comment for DIRECTV GenieGO.
diff --git a/examples/fibers/active_record.ru b/examples/fibers/active_record.ru index abc1234..def5678 100644 --- a/examples/fibers/active_record.ru +++ b/examples/fibers/active_record.ru @@ -12,7 +12,10 @@ end class FullFibersController < Cramp::Action - use_fiber_pool + use_fiber_pool do |pool| + # Called everytime after a fiber is done a callback + pool.generic_callbacks << proc { ActiveRecord::Base.clear_active_connections! } + end on_start :init_last_user periodic_timer :watch_out_for_new_user
Call clear_active_connections from fiber callback in AR example
diff --git a/lib/jekyll_social_icons/social_icons_tag.rb b/lib/jekyll_social_icons/social_icons_tag.rb index abc1234..def5678 100644 --- a/lib/jekyll_social_icons/social_icons_tag.rb +++ b/lib/jekyll_social_icons/social_icons_tag.rb @@ -0,0 +1,44 @@+module Jekyll + class SocialIcons < Liquid::Tag + def initialize(_, args, _) + super + @args = OptionParser.parse(args) + end + + def render(context) + site = context.registers[:site] + config_socials = site.config['socials'] + + if @args[:socials].nil? + socials = config_socials + else + socials = config_socials.select { |k, v| @args[:socials].include?(k) } + end + + icons_json = JSON.parse(IO.readlines(File.expand_path('icons.json', File.dirname(__FILE__))).join) + + data = "<div class='social-container #{attr_class}' id='#{attr_id}'>" + socials.each do |social, url| + data += "<div class='social #{social}'> + <a href='#{url}' target='_blank'> + <i class='fa fa-fw fa-#{icons_json[social]}'></i> + </a></div>" + end + data += '</div>' + + data + end + + private + + def attr_id + @args[:attributes][:id] + end + + def attr_class + @args[:attributes][:class] + end + end +end + +Liquid::Template.register_tag('social_icons', Jekyll::SocialIcons)
Add tag functionality to render socials
diff --git a/lib/msfl/validators/definitions/hash_key.rb b/lib/msfl/validators/definitions/hash_key.rb index abc1234..def5678 100644 --- a/lib/msfl/validators/definitions/hash_key.rb +++ b/lib/msfl/validators/definitions/hash_key.rb @@ -0,0 +1,31 @@+module MSFL + module Validators + module Definitions + module HashKey + def hash_key + { in: [operators, fields]} + end + + # Operators still needing parsing: ellipsis2, tilda + def operators + [ + :and, # logical AND + :or, # logical OR + :in, # IN + :between, # inclusive range for integers, dates, and date times + :start, # a range bound inclusively to the left + :end, # a range bound inclusively to the right + :ellipsis2, # alias to :between + :tilda, # alias to :between, :start, and :end depending on usage + :eq, # == + :lt, # < + :lte, # <= + :gt, # > + :gte, # >= + :neg, # logical negation + ] + end + end + end + end +end
Create the hash_eky validators definition
diff --git a/lib/tasks/acts_as_reference_data_tasks.rake b/lib/tasks/acts_as_reference_data_tasks.rake index abc1234..def5678 100644 --- a/lib/tasks/acts_as_reference_data_tasks.rake +++ b/lib/tasks/acts_as_reference_data_tasks.rake @@ -1,6 +1,6 @@ task :load_reference_data => :environment do ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test']) - Dir["#{RAILS_ROOT}/app/models/reference_data/**/*.rb"].each {|f| require f} + Dir["#{Rails.root}/app/models/reference_data/**/*.rb"].each {|f| require f} require 'active_record/fixtures' ActiveRecord::Base.connection.disable_referential_integrity do
Use Rails.root instead of RAILS_ROOT
diff --git a/resources/chef-repo/site-cookbooks/rails_part/spec/recipes/setup_sepc.rb b/resources/chef-repo/site-cookbooks/rails_part/spec/recipes/setup_sepc.rb index abc1234..def5678 100644 --- a/resources/chef-repo/site-cookbooks/rails_part/spec/recipes/setup_sepc.rb +++ b/resources/chef-repo/site-cookbooks/rails_part/spec/recipes/setup_sepc.rb @@ -18,7 +18,7 @@ end it 'install mysql-devel' do - expect(chef_run).to install_package('sql-devel') + expect(chef_run).to install_package('mysql-devel') end it 'install sqlite-devel' do @@ -32,8 +32,4 @@ it 'iptables disabled' do expect(chef_run).to include_recipe 'iptables::disabled' end - - it 'create application user' do - expect(chef_run).to include_recipe 'rails_part::create_user' - end end
Modify package name of mysql-devel was wrong
diff --git a/Formula/phpunit.rb b/Formula/phpunit.rb index abc1234..def5678 100644 --- a/Formula/phpunit.rb +++ b/Formula/phpunit.rb @@ -6,7 +6,6 @@ homepage 'http://phpunit.de/manual/current/en/' url 'https://phar.phpunit.de/phpunit-4.2.6.phar' sha1 '90f632d04a169957ad7b12a471724c70bb79f5e1' - version '4.2.6' def install libexec.install "phpunit-#{version}.phar"
Remove useless version in PHPUnit
diff --git a/Framezilla.podspec b/Framezilla.podspec index abc1234..def5678 100644 --- a/Framezilla.podspec +++ b/Framezilla.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Framezilla" - spec.version = "2.1.0" + spec.version = "2.1.1" spec.summary = "Comfortable syntax for working with frames." spec.homepage = "https://github.com/Otbivnoe/Framezilla"
Update pod version -> 2.1.1
diff --git a/features/support/login_helper.rb b/features/support/login_helper.rb index abc1234..def5678 100644 --- a/features/support/login_helper.rb +++ b/features/support/login_helper.rb @@ -4,4 +4,23 @@ click_link 'LOGOUT' end end + + def create_user_through_gui + visit '/users/new' + fill_in 'user_name', with: 'foobarbaz' + fill_in 'user_password', with: 'foobarbaz' + fill_in 'user_password_confirmation', with: 'foobarbaz' + fill_in 'user_email', with: 'foobar@baz.com' + click_button 'Create User' + + User.last + end + + def ensure_logged_in + @user = create_user_through_gui + visit '/login' + fill_in 'username', with: @user.name + fill_in 'password', with: 'foobarbaz' + click_button 'Login' + end end
Create user through GUI instead of using FactoryGirl because that way wasn't working
diff --git a/lib/berkshelf/api/cache_builder/opscode.rb b/lib/berkshelf/api/cache_builder/opscode.rb index abc1234..def5678 100644 --- a/lib/berkshelf/api/cache_builder/opscode.rb +++ b/lib/berkshelf/api/cache_builder/opscode.rb @@ -9,7 +9,7 @@ def initialize(options={}) super @connection = options[:connection] || - Berkshelf::API::SiteConnector::Opscode.pool + Berkshelf::API::SiteConnector::Opscode.pool_link end def archive_name
Use pool_link to link the SiteConnector pool to the PoolManager
diff --git a/lib/credit_card_sanitizer.rb b/lib/credit_card_sanitizer.rb index abc1234..def5678 100644 --- a/lib/credit_card_sanitizer.rb +++ b/lib/credit_card_sanitizer.rb @@ -2,11 +2,8 @@ class CreditCardSanitizer - NUMBERS_WITH_LINE_NOISE = /( - \d # starts with a number - [\d|\W]+ # number or non-word character - \d # ends with a number - )/x + # 13-19 digits explanation: https://en.wikipedia.org/wiki/Primary_Account_Number#Issuer_identification_number_.28IIN.29 + NUMBERS_WITH_LINE_NOISE = /(\d(\W*\d\W*){11,17}\d)/x def self.parameter_filter Proc.new { |_, value| new.sanitize!(value) if value.is_a?(String) } @@ -23,7 +20,7 @@ numbers = match.gsub(/\D/, '') size = numbers.size - if size.between?(13, 19) && LuhnChecksum.valid?(numbers) + if LuhnChecksum.valid?(numbers) replaced = true replace_numbers!(match, size - @replace_last) end
Use regex with implicit size validation
diff --git a/lib/faraday/request/oauth.rb b/lib/faraday/request/oauth.rb index abc1234..def5678 100644 --- a/lib/faraday/request/oauth.rb +++ b/lib/faraday/request/oauth.rb @@ -6,12 +6,8 @@ def call(env) params = env[:body] || {} - - con = false - env[:request_headers].each do |k,v| - con = true if v.to_s.downcase == "application/x-www-form-urlencoded" - end - signature_params = con ? params.reject{ |k,v| v.respond_to?(:content_type) } : {} + + signature_params = params.reject{ |k,v| v.respond_to?(:content_type) } header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options)
Revert "Fixed an issue where OAuth was not encoding the entire body on non application/x-www-form-urlencoded POST requests." This reverts commit e911e2d904641f8149443879ef0d71ef9825e9b5.
diff --git a/lib/rss/atom/feed_history.rb b/lib/rss/atom/feed_history.rb index abc1234..def5678 100644 --- a/lib/rss/atom/feed_history.rb +++ b/lib/rss/atom/feed_history.rb @@ -18,6 +18,14 @@ klass.install_have_child_element(name, URI, '?', full_name) end end + end + + def complete? + !!fh_complete + end + + def archived? + !!fh_archive end ELEMENTS.each do |name|
Add predicate methods for complete/archived feed