diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,9 +4,14 @@ require 'shared_examples' require 'puppet-openstack_spec_helper/facts' +fixture_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures')) + RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_raises, 'raises' + + c.module_path = File.join(fixture_path, 'modules') + c.manifest_dir = File.join(fixture_path, 'manifests') end at_exit { RSpec::Puppet::Coverage.report! }
Set fixture paths for unit tests This change defines manifest_dir and module_path expicitly in unit tests so that modules installed under fixtures directory is properly loaded. Closes-Bug: #1930403 Change-Id: Ic6af657059b55368897b04e2f537bb0b60298b31
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) -require 'codeclimate-test-reporter' -CodeClimate::TestReporter.start +# require 'codeclimate-test-reporter' +# CodeClimate::TestReporter.start require 'pieces'
Disable code coverage to see if it fixes travis
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,7 @@ require 'perpetuity' -Perpetuity.data_source :mongodb, 'perpetuity_gem_test' +if ENV['PERPETUITY_ADAPTER'] == 'postgres' + Perpetuity.data_source :postgres, 'perpetuity_gem_test', user: ENV['USER'], password: nil +else + Perpetuity.data_source :mongodb, 'perpetuity_gem_test' +end
Allow specs to be run with Postgres adapter
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,5 +17,6 @@ super(*args, &block) raise Sequel::Error::Rollback end + true end end
Exit with 'success' status when running 'rake spec'.
diff --git a/app/models/medicine_usage.rb b/app/models/medicine_usage.rb index abc1234..def5678 100644 --- a/app/models/medicine_usage.rb +++ b/app/models/medicine_usage.rb @@ -7,9 +7,9 @@ child_properties(name: :medicine_usage_medicines) def display - result = Myp.display_datetime_short(usage_time, User.current_user) + result = Myp.display_datetime_short_year(usage_time, User.current_user) if !self.usage_end.nil? - result += " - " + Myp.display_datetime_short(self.usage_end, User.current_user) + result += " - " + Myp.display_datetime_short_year(self.usage_end, User.current_user) end result = Myp.appendstrwrap(result, self.description) return result
Add year to medicine usage display
diff --git a/lib/reddit_api/query.rb b/lib/reddit_api/query.rb index abc1234..def5678 100644 --- a/lib/reddit_api/query.rb +++ b/lib/reddit_api/query.rb @@ -35,23 +35,21 @@ def add_multiple_records(new_records) new_records.each do |record| - add_single_record(record) + record_id = record["data"]["id"] + records[record_id] = record + update_offset_id(record_id) break if records.length == count end end def add_single_record(record) - record_id = record_id(record) + record_id = record["id"] records[record_id] = record - update_offset_id(record) + update_offset_id(record_id) end - def update_offset_id(record) - self.offset_id = record_id(record) - end - - def record_id(record) - record["data"]["id"] + def update_offset_id(record_id) + self.offset_id = record_id end end
Refactor Query to account for records w/ data attr Not all records returned by api responses have a data attribute Specifically, those returned from a query for a singular record seem to lack a data attribute
diff --git a/app/services/channels/sms.rb b/app/services/channels/sms.rb index abc1234..def5678 100644 --- a/app/services/channels/sms.rb +++ b/app/services/channels/sms.rb @@ -3,6 +3,7 @@ module Channels class SMS < Base FROM_NUMBER = ENV.fetch('TWILIO_FROM_NUMBER') + UNSUBSCRIBED_ERROR_CODE = 21610 def self.client @client ||= Twilio::REST::Client.new( @@ -24,7 +25,12 @@ rescue Twilio::REST::RequestError => e # TODO: deactivate subscription? Citygram::App.logger.error(e) - raise NotificationFailure, e + + + # don't retry if receiver has unsubscribed + if e.code.to_i != UNSUBSCRIBED_ERROR_CODE + raise NotificationFailure, e + end end end
Revert "Back out logic to skip retries for unsubscribed numbers" This reverts commit e0c9e93b9128a129ff42b4890dfb44866d41eaab.
diff --git a/app/services/mybb_service.rb b/app/services/mybb_service.rb index abc1234..def5678 100644 --- a/app/services/mybb_service.rb +++ b/app/services/mybb_service.rb @@ -0,0 +1,67 @@+class MybbService + def self.convert_text(text) + text.gsub('[hr]', '<hr>').gsub(/\[quote="[^\]]+\]/, '<blockquote>').gsub('[/quote]', '</blockquote>') + end + + # note, I edited the posts.json and deleted the first couple of lines and the last couple too. + # so I could read the file line by line and just consider each line a post + # thats why I chop the trailing commas + def self.import(filename, group_id) + user_ids = {} + discussion_ids = {} + comment_ids = {} + + posts = URI.open(filename, 'r').map do |line| + line.chop! if line.ends_with?("\n") + line.chop! if line.ends_with?(',') + JSON.parse(line) + rescue + byebug + end + + ActiveRecord::Base.transaction do + # create discussions + posts.each do |post| + # create user if not exists + unless user_ids[post['uid']] + u = User.create!( + name: post['username'], + email: "#{post['username'].parameterize.gsub('-','')}@mybb.example.com" + ) + user_ids[post['uid']] = u.id + end + + # create discussion if not exists + if !discussion_ids[post['tid']] + d = Discussion.create!( + group_id: group_id, + author_id: user_ids[post['uid']], + title: post['subject'], + description: convert_text(post['message']), + created_at: Time.at(post['dateline'].to_i)) + d.create_missing_created_event! + discussion_ids[post['tid']] = d.id + else + if post['message'].present? + parent = Comment.find_by(id: post['replyto'].to_i) + comment = Comment.create!( + parent_id: comment_ids[parent&.id], + discussion_id: discussion_ids[post['tid']], + user_id: user_ids[post['uid']], + created_at: Time.at(post['dateline'].to_i), + body: convert_text(post['message']) + ) + comment_ids[post['pid']] = comment.id + Event.create!( + user_id: user_ids[post['uid']], + discussion_id: discussion_ids[post['tid']], + kind: "new_comment", + eventable: comment + ) + end + end + end + end + discussion_ids.each {|id| EventService.repair_thread(id)} + end +end
Add import script for mybb posts
diff --git a/app/services/query_sparql.rb b/app/services/query_sparql.rb index abc1234..def5678 100644 --- a/app/services/query_sparql.rb +++ b/app/services/query_sparql.rb @@ -15,8 +15,12 @@ ) end - params = "#{query_type}=#{query}" - response = RestClient.post(ENV.fetch('NEPTUNE_SPARQL_ENDPOINT'), params) + response = RestClient::Request.execute( + method: :post, + payload: "#{query_type}=#{query}", + timeout: nil, + url: ENV.fetch('NEPTUNE_SPARQL_ENDPOINT') + ) OpenStruct.new( result: JSON(response.body), @@ -24,8 +28,8 @@ ) rescue RestClient::Exception => e OpenStruct.new( - result: JSON(e.http_body), - status: e.http_code + result: e.http_body ? JSON(e.http_body) : { error: e.message }, + status: e.http_code || 500 ) end end
Disable RestClient timeout when querying SPARQL Also, improve error handling of SPARQL proxy Fixes CredentialEngine/CredentialRegistry#313
diff --git a/lib/pesapal/railtie.rb b/lib/pesapal/railtie.rb index abc1234..def5678 100644 --- a/lib/pesapal/railtie.rb +++ b/lib/pesapal/railtie.rb @@ -9,10 +9,15 @@ begin config.pesapal_credentials = YAML::load(IO.read(path_to_yaml))[Rails.env] rescue Errno::ENOENT - logger.info('YAML configuration file couldn\'t be found. Using defaults.'); return + logger.info('YAML configuration file couldn\'t be found.'); return rescue Psych::SyntaxError logger.info('YAML configuration file contains invalid syntax. Will use using defaults.'); return end + else + config.pesapal_credentials = { :callback_url => 'http://0.0.0.0:3000/pesapal/callback', + :consumer_key => '<YOUR_CONSUMER_KEY>', + :consumer_secret => '<YOUR_CONSUMER_SECRET>' + } end end end
Set default values if YAML file is missing
diff --git a/lib/google/apis/version.rb b/lib/google/apis/version.rb index abc1234..def5678 100644 --- a/lib/google/apis/version.rb +++ b/lib/google/apis/version.rb @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +require 'open3' + module Google module Apis # Client library version @@ -21,16 +23,19 @@ # @private OS_VERSION = begin if RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/ - `ver`.sub(/\s*\[Version\s*/, '/').sub(']', '') + output, _ = Open3.capture2('ver') + output.sub(/\s*\[Version\s*/, '/').sub(']', '') elsif RUBY_PLATFORM =~ /darwin/i - "Mac OS X/#{`sw_vers -productVersion`}" + output, _ = Open3.capture2('sw_vers', '-productVersion') + "Mac OS X/#{output}" elsif RUBY_PLATFORM == 'java' require 'java' name = java.lang.System.getProperty('os.name') version = java.lang.System.getProperty('os.version') "#{name}/#{version}" else - `uname -sr`.sub(' ', '/') + output, _ = Open3.capture2('uname', '-sr') + output.sub(' ', '/') end.strip rescue RUBY_PLATFORM
fix: Switch to safer Open3 to determine OS_VERSION
diff --git a/lib/tasks/importer.rake b/lib/tasks/importer.rake index abc1234..def5678 100644 --- a/lib/tasks/importer.rake +++ b/lib/tasks/importer.rake @@ -11,7 +11,7 @@ desc "Import new Noko entries" task entries: [:users, :projects, :environment] do start_date = Time.now.beginning_of_week.to_date - end_date = Time.now.next_week(:tuesday).to_date + end_date = Time.now.next_week(:saturday).to_date puts "start importing entries from #{start_date} to #{end_date}"
Extend rake task to saturday
diff --git a/lib/inherited_attribute.rb b/lib/inherited_attribute.rb index abc1234..def5678 100644 --- a/lib/inherited_attribute.rb +++ b/lib/inherited_attribute.rb @@ -20,7 +20,9 @@ " def share_#{attribute}_with(person) read_attribute(:visible) and - family and family.visible? and ( + (!respond_to?(:family_id) or + (family and family.visible?) + ) and ( share_#{attribute}? or self == person or (self.respond_to?(:family_id) and self.family_id == person.family_id) or
Fix bug rendering printed directory pdf in some cases. This was being called on Family, and this part of the code assumed it would be called on Person.
diff --git a/spec/features/remote/github/miscellaneous/emojis_spec.rb b/spec/features/remote/github/miscellaneous/emojis_spec.rb index abc1234..def5678 100644 --- a/spec/features/remote/github/miscellaneous/emojis_spec.rb +++ b/spec/features/remote/github/miscellaneous/emojis_spec.rb @@ -0,0 +1,11 @@+require 'github_helper' + +# http://developer.github.com/v3/emojis/ +resource :emoji do + extend Authorize + authorize_with token: ENV['RSPEC_API_GITHUB_TOKEN'] + + get '/emojis' do + respond_with :ok + end +end
Add spec for GitHub emojis
diff --git a/app/helpers/crops_helper.rb b/app/helpers/crops_helper.rb index abc1234..def5678 100644 --- a/app/helpers/crops_helper.rb +++ b/app/helpers/crops_helper.rb @@ -1,12 +1,7 @@ module CropsHelper def display_seed_availability(member, crop) - total_quantity = 0 - - seeds = member.seeds.select { |seed| seed.crop.name == crop.name } - - seeds.each do |seed| - total_quantity += seed.quantity if seed.quantity - end + seeds = member.seeds.where(crop: crop) + total_quantity = seeds.where.not(quantity: nil).sum(:quantity) return "You don't have any seeds of this crop." if seeds.none?
Reduce the number of queries to find if member has seed of this crop
diff --git a/lib/loady/memory_logger.rb b/lib/loady/memory_logger.rb index abc1234..def5678 100644 --- a/lib/loady/memory_logger.rb +++ b/lib/loady/memory_logger.rb @@ -2,7 +2,7 @@ class MemoryLogger attr_reader :messages - def initialize(options = {}) + def initialize @messages = [] end
Remove unused argument from MemoryLogger constructor
diff --git a/app/models/shipment_decorator.rb b/app/models/shipment_decorator.rb index abc1234..def5678 100644 --- a/app/models/shipment_decorator.rb +++ b/app/models/shipment_decorator.rb @@ -1,6 +1,8 @@ module SolidusShipwire - module Shipment - prepend SolidusShipwire::Proxy + module ShipmentDecorator + def self.prepended(base) + base.acts_as_shipwireable api_class: Shipwire::Orders + end def to_shipwire { @@ -29,10 +31,6 @@ items.map(&:to_shipwire) end - def to_shipwire_object(hash) - SolidusShipwire::ShipwireObjects::Shipment.new(hash['id'], self, hash) - end - def shipwire_can_split? 1 end @@ -59,14 +57,10 @@ @shipwire_inventory_units = inventory_units.eligible_for_shipwire end - def shipwire_instance - Shipwire::Orders.new - end - def warehouse_id Spree::ShipwireConfig.default_warehouse_id end + + Spree::Shipment.prepend self end end - -Spree::Shipment.prepend SolidusShipwire::Shipment
Use Shipwireable module on Spree::Shipment
diff --git a/lib/teaas/overlayer.rb b/lib/teaas/overlayer.rb index abc1234..def5678 100644 --- a/lib/teaas/overlayer.rb +++ b/lib/teaas/overlayer.rb @@ -39,7 +39,7 @@ end image << img - image.gravity = Magick::CenterGravity + image.gravity = Magick::SouthGravity image = image.composite_layers(overlay_img) image
Use SouthGravity instead of CenterGravity for centering overlayed images
diff --git a/flay-haml.gemspec b/flay-haml.gemspec index abc1234..def5678 100644 --- a/flay-haml.gemspec +++ b/flay-haml.gemspec @@ -3,7 +3,7 @@ # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = 'flay-haml' - s.version = '0.0.4' + s.version = '0.0.5' s.authors = ['Eugene Kalenkovich'] s.email = ['rubify@softover.com'] s.homepage = 'https://github.com/kalenkov/flay-haml' @@ -15,5 +15,5 @@ s.test_files = Dir['test/**/*'] s.add_dependency 'flay', '>= 1.2', '< 3' - s.add_dependency 'haml', '>= 3', '<=5' + s.add_dependency 'haml', '>= 3', '<6' end
Fix haml dependency to <6
diff --git a/core/db/migrate/20150309161154_ensure_payments_have_numbers.rb b/core/db/migrate/20150309161154_ensure_payments_have_numbers.rb index abc1234..def5678 100644 --- a/core/db/migrate/20150309161154_ensure_payments_have_numbers.rb +++ b/core/db/migrate/20150309161154_ensure_payments_have_numbers.rb @@ -2,7 +2,7 @@ def change Spree::Payment.where(number: nil).find_each do |payment| payment.generate_number - payment.save + payment.update_columns(number: payment.number) end end end
Update only the payment's number during migration. Fixes #6327 Fixes #6328
diff --git a/config/initializers/raven.rb b/config/initializers/raven.rb index abc1234..def5678 100644 --- a/config/initializers/raven.rb +++ b/config/initializers/raven.rb @@ -1,5 +1,5 @@ require 'raven' Raven.configure do |config| - config.dsn = 'https://166e257bdc0a4464b4aa03076d0a0cda:43cdd2f177b04fe3b7723422bbd9ea1b@app.getsentry.com/23443' + config.dsn = ENV['GETSENTRY'] end
Use ENV Variable for getsentry
diff --git a/app/services/dwp_monitor.rb b/app/services/dwp_monitor.rb index abc1234..def5678 100644 --- a/app/services/dwp_monitor.rb +++ b/app/services/dwp_monitor.rb @@ -25,7 +25,7 @@ # When DWP is offline it returns 400 Bad Request # maybe extend to search for x00 as first 3 chars to check for 500 errors too total = @checks.count.to_f - error_total / total * 100.0 + (error_total / total) * 100.0 end def error_total
Update sum for explicit precedence
diff --git a/lib/Server.rb b/lib/Server.rb index abc1234..def5678 100644 --- a/lib/Server.rb +++ b/lib/Server.rb @@ -10,7 +10,7 @@ attr_accessor :robots, :maze, :robotController - def initialize host = "localhost", port = RobotState::Server::PORT + def initialize host = "localhost", port = 0 @maze = Maze.new @robotController = RobotController.new self @remote = nil #xbee or serial
Set default server port to 0 to fix problem with tests failing because port already in use
diff --git a/app/classes/forest/markdown_renderer.rb b/app/classes/forest/markdown_renderer.rb index abc1234..def5678 100644 --- a/app/classes/forest/markdown_renderer.rb +++ b/app/classes/forest/markdown_renderer.rb @@ -1,6 +1,4 @@ class Forest::MarkdownRenderer < Redcarpet::Render::HTML - include Redcarpet::Render::SmartyPants - def self.options { hard_wrap: true, @@ -18,7 +16,9 @@ unless without_leading_trailing_paragraphs.include?('<p>') full_document = without_leading_trailing_paragraphs end + full_document = Redcarpet::Render::SmartyPants.render(full_document) rescue Exception => e + logger.error { "Error in Forest::MarkdownRenderer postprocess #{e.inspect}" } end full_document end
Fix SmartyPants in markdown renderer
diff --git a/app/controllers/merchants_controller.rb b/app/controllers/merchants_controller.rb index abc1234..def5678 100644 --- a/app/controllers/merchants_controller.rb +++ b/app/controllers/merchants_controller.rb @@ -1,6 +1,14 @@ class MerchantsController < ApplicationController def index @merchants = Merchant.all + respond_to do |format| + format.html { + redirect_to @merchants + } + format.json { + render json: @merchants + } + end end def create @@ -24,10 +32,6 @@ def show @merchant = Merchant.find(params[:id]) - # respond_to do |format| - # redirect_to @merchant - # format.json { render json: @merchant} - # end end
Add Json to merchants index path
diff --git a/app/controllers/platforms_controller.rb b/app/controllers/platforms_controller.rb index abc1234..def5678 100644 --- a/app/controllers/platforms_controller.rb +++ b/app/controllers/platforms_controller.rb @@ -5,8 +5,8 @@ def show find_platform - @updated = Project.search('*', filters: {platform: @platform_name}, sort: 'latest_release_published_at').records.includes(:github_repository).many_versions.first(5) - @created = Project.search('*', filters: {platform: @platform_name}, sort: 'created_at').records.includes(:github_repository).few_versions.first(5) + @updated = Project.search('*', filters: {platform: @platform_name}, sort: 'latest_release_published_at').records.includes(:github_repository).first(5) + @created = Project.search('*', filters: {platform: @platform_name}, sort: 'created_at').records.includes(:github_repository).first(5) @watched = Project.platform(@platform_name).most_watched.limit(4) @color = @platform.color
Revert "Make sure new and updated look different" This reverts commit f89c97bd019c07b178c5dd7a78d8b91c8e8603c8.
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -2,7 +2,6 @@ def index @questions = Question.all - respond_to do |format| format.html
Modify Questions controller to render json
diff --git a/bool2num.rb b/bool2num.rb index abc1234..def5678 100644 --- a/bool2num.rb +++ b/bool2num.rb @@ -20,25 +20,23 @@ end if value.is_a?(String) - # We consider all the yes, no, y, n and so on too ... - result = case value + value = case value # # This is how undef looks like in Puppet ... # We yield 0 (or false if you wish) in this case. # - when /^$/, '' then 0 # Empty string will be false ... - when /^(1|t|y|true|yes)$/ then 1 - when /^(0|f|n|false|no)$/ then 0 - when /^(undef|undefined)$/ then 0 # This is not likely to happen ... + when /^$/, '' then false # Empty string will be false ... + when /^(1|t|y|true|yes)$/ then true + when /^(0|f|n|false|no)$/ then false + when /^(undef|undefined)$/ then false # This is not likely to happen ... else raise(Puppet::ParseError, 'bool2num(): Unknown type of boolean given') end + end - else - # We have real boolean values as well ... - result = value ? 1 : 0 - end + # We have real boolean values as well ... + result = value ? 1 : 0 return result end
Change boolean detecion from string to make entire function more robust. Signed-off-by: Krzysztof Wilczynski <9bf091559fc98493329f7d619638c79e91ccf029@linux.com>
diff --git a/db/migrate/20170221093606_update_old_redirect_unpublishings.rb b/db/migrate/20170221093606_update_old_redirect_unpublishings.rb index abc1234..def5678 100644 --- a/db/migrate/20170221093606_update_old_redirect_unpublishings.rb +++ b/db/migrate/20170221093606_update_old_redirect_unpublishings.rb @@ -0,0 +1,13 @@+class UpdateOldRedirectUnpublishings < ActiveRecord::Migration[5.0] + def up + Unpublishing + .where(type: :redirect) + .where(redirects: nil) + .find_each do |unpublishing| + # this magical line works because the 'redirects' getter is overriden + # to generate a JSON blob automatically if it is nil within the + # database + unpublishing.update_attribute(:redirects, unpublishing.redirects) + end + end +end
Add a migration to update old-style redirect unpublishings
diff --git a/git_snip.gemspec b/git_snip.gemspec index abc1234..def5678 100644 --- a/git_snip.gemspec +++ b/git_snip.gemspec @@ -17,6 +17,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.required_ruby_version = '>= 2.0' + spec.add_runtime_dependency "git" spec.add_runtime_dependency "thor"
Set required_ruby_version to >= 2.0.
diff --git a/gitnesse.gemspec b/gitnesse.gemspec index abc1234..def5678 100644 --- a/gitnesse.gemspec +++ b/gitnesse.gemspec @@ -16,7 +16,7 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] gem.add_dependency("bundler","~> 1.2.1") - gem.add_dependency("gollum","~> 2.3.4") + gem.add_dependency("gollum","~> 2.3.12") gem.add_development_dependency("minitest-matchers") gem.add_development_dependency("mocha") gem.add_development_dependency("cucumber")
Update gollum dependency to the lastest version.
diff --git a/core/app/models/spree/option_type.rb b/core/app/models/spree/option_type.rb index abc1234..def5678 100644 --- a/core/app/models/spree/option_type.rb +++ b/core/app/models/spree/option_type.rb @@ -9,7 +9,7 @@ has_many :option_type_prototypes, class_name: 'Spree::OptionTypePrototype' has_many :prototypes, through: :option_type_prototypes, class_name: 'Spree::Prototype' - validates :name, presence: true, uniqueness: true + validates :name, presence: true, uniqueness: { allow_blank: true } validates :presentation, presence: true default_scope { order(:position) }
Add allow_blank to uniqueness validation of option type name
diff --git a/plugin_gems.rb b/plugin_gems.rb index abc1234..def5678 100644 --- a/plugin_gems.rb +++ b/plugin_gems.rb @@ -10,7 +10,7 @@ download "mongo", "1.10.2" download "fluent-plugin-mongo", "0.7.4" download "aws-sdk", "1.56.0" -download "fluent-plugin-s3", "0.4.1" +download "fluent-plugin-s3", "0.4.3" download "webhdfs", "0.6.0" download "fluent-plugin-webhdfs", "0.4.1" download "fluent-plugin-rewrite-tag-filter", "1.4.1"
Update s3 plugin to v0.4.3
diff --git a/pronto.gemspec b/pronto.gemspec index abc1234..def5678 100644 --- a/pronto.gemspec +++ b/pronto.gemspec @@ -22,7 +22,7 @@ s.add_dependency 'rugged', '~> 0.19.0' s.add_dependency 'thor', '~> 0.18.0' - s.add_dependency 'octokit', '~> 2.6.0' + s.add_dependency 'octokit', '~> 2.7.1' s.add_dependency 'grit', '~> 2.5.0' s.add_development_dependency 'rake', '~> 10.1.0' s.add_development_dependency 'rspec', '~> 2.14.0'
Update octokit dependency to latest version
diff --git a/Casks/justlooking.rb b/Casks/justlooking.rb index abc1234..def5678 100644 --- a/Casks/justlooking.rb +++ b/Casks/justlooking.rb @@ -3,4 +3,5 @@ homepage 'http://chipmunkninja.com/JustLooking' version '3.3.3' sha1 'ac082882d21e77c5c77e99f8fa7bae9f72bac75c' + link 'JustLooking.app' end
Add link field to JustLooking Cask
diff --git a/attribute_predicates.gemspec b/attribute_predicates.gemspec index abc1234..def5678 100644 --- a/attribute_predicates.gemspec +++ b/attribute_predicates.gemspec @@ -14,4 +14,7 @@ s.test_files = `git ls-files -- test/*`.split("\n") s.rdoc_options = %w(--line-numbers --inline-source --title attribute_predicates --main README.rdoc) s.extra_rdoc_files = %w(README.rdoc CHANGELOG.rdoc LICENSE) + + s.add_development_dependency("rake") + s.add_development_dependency("plugin_test_helper", ">= 0.3.2") end
Add missing dependencies to gemspec
diff --git a/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb b/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb index abc1234..def5678 100644 --- a/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb +++ b/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb @@ -13,20 +13,25 @@ # user can version if they can edit alias_action :versions, to: :update - if user_groups.include? 'admin' - can [:create, :discover, :show, :read, :edit, :update, :destroy], :all - end + admin_permissions if admin? can :collect, :all + end + + def admin_permissions + can [:create, :discover, :show, :read, :edit, :update, :destroy], :all + end + + def admin? + user_groups.include? 'admin' end # Add this to your ability_logic if you want all logged in users to be able # to submit content def everyone_can_create_curation_concerns return if current_user.new_record? - can :create, ::GenericFile + can :create, [::GenericFile, ::Collection] can :create, [CurationConcerns.config.curation_concerns] - can :create, ::Collection end end end
Refactor Ability so you can override admin functionality easier
diff --git a/subtle.gemspec b/subtle.gemspec index abc1234..def5678 100644 --- a/subtle.gemspec +++ b/subtle.gemspec @@ -8,9 +8,13 @@ gem.version = Subtle::VERSION gem.authors = ["Utkarsh Kukreti"] gem.email = ["utkarshkukreti@gmail.com"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} - gem.homepage = "" + gem.description = %q{Subtle is a Terse, Array based Programming Language, + heavily inspired by the K Programming Language, and + partly by APL and J.} + gem.summary = %q{Subtle is a Terse, Array based Programming Language, + heavily inspired by the K Programming Language, and + partly by APL and J.} + gem.homepage = "https://github.com/utkarshkukreti/subtle-lang" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add gem description, summary, and homepage.
diff --git a/config/software/chef-init.rb b/config/software/chef-init.rb index abc1234..def5678 100644 --- a/config/software/chef-init.rb +++ b/config/software/chef-init.rb @@ -25,12 +25,10 @@ dependency "runit" dependency "chef" -env = with_embedded_path() -env = with_standard_compiler_flags(env) +env = with_standard_compiler_flags(with_embedded_path) build do - bundle "install", :env => env - rake "build", :env => env - gem ["install pkg/chef-init*.gem -n #{install_dir}/bin", - "--no-rdoc --no-ri"].join(" "), :env => env + bundle "install", env: env + rake "build", env: env + gem "install pkg/chef-init*.gem -n #{install_dir}/bin --no-document", env: env end
Update chef-container to use new Omnibus APIs
diff --git a/test/controllers/custom_registrations_controller_test.rb b/test/controllers/custom_registrations_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/custom_registrations_controller_test.rb +++ b/test/controllers/custom_registrations_controller_test.rb @@ -12,24 +12,24 @@ end test "yield resource to block on create success" do - post :create, {user: {:email => "user@example.org", :password => "password", :password_confirmation => "password"}} + post :create, { user: { email: "user@example.org", password: "password", password_confirmation: "password" } } assert @controller.create_block_called?, "create failed to yield resource to provided block" end test "yield resource to block on create failure" do - post :create, {user: {}} + post :create, { user: { } } assert @controller.create_block_called?, "create failed to yield resource to provided block" end test "yield resource to block on update success" do sign_in @user - put :update, {user: {current_password: @password}} + put :update, { user: { current_password: @password } } assert @controller.update_block_called?, "update failed to yield resource to provided block" end test "yield resource to block on update failure" do sign_in @user - put :update, {user: {}} + put :update, { user: { } } assert @controller.update_block_called?, "update failed to yield resource to provided block" end end
Upgrade stray legacy hash syntax to 1.9 syntax.
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 @@ -14,7 +14,7 @@ stdout_path "log/unicorn.stdout.log" # workers -worker_processes 2 +worker_processes 8 # use correct Gemfile on restarts before_exec do |server|
Change worker_processes because excloud server has 8 cores
diff --git a/core/file/birthtime_spec.rb b/core/file/birthtime_spec.rb index abc1234..def5678 100644 --- a/core/file/birthtime_spec.rb +++ b/core/file/birthtime_spec.rb @@ -24,12 +24,13 @@ end end - # TODO: fix it. - #platform_is :linux, :openbsd do - # it "raises an NotImplementedError" do - # lambda { File.birthtime(@file) }.should raise_error(NotImplementedError) - # end - #end + platform_is :openbsd do + it "raises an NotImplementedError" do + lambda { File.birthtime(@file) }.should raise_error(NotImplementedError) + end + end + + # TODO: depends on Linux kernel version end describe "File#birthtime" do
Revise the example on OpenBSD git-svn-id: ab86ecd26fe50a6a239cacb71380e346f71cee7d@67101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
diff --git a/optional/capi/time_spec.rb b/optional/capi/time_spec.rb index abc1234..def5678 100644 --- a/optional/capi/time_spec.rb +++ b/optional/capi/time_spec.rb @@ -9,7 +9,8 @@ describe "rb_time_new" do it "creates a Time from the sec and usec" do - @s.rb_time_new(1232141421, 1413123123).should == Time.at(1232141421, 1413123123) + usec = CAPI_SIZEOF_LONG == 8 ? 4611686018427387903 : 1413123123 + @s.rb_time_new(1232141421, usec).should == Time.at(1232141421, usec) end end end
Support the environment whose long is 64bit.
diff --git a/app/views/workflows/index.json.jbuilder b/app/views/workflows/index.json.jbuilder index abc1234..def5678 100644 --- a/app/views/workflows/index.json.jbuilder +++ b/app/views/workflows/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@workflows) do |workflow| - json.extract! workflow, :id + json.extract! workflow, :id, :title, :description json.url workflow_url(workflow, format: :json) end
Update the workflows JSON output. Now outputs title and description.
diff --git a/spec/paypal_express/remote/build_plugin_helpers.rb b/spec/paypal_express/remote/build_plugin_helpers.rb index abc1234..def5678 100644 --- a/spec/paypal_express/remote/build_plugin_helpers.rb +++ b/spec/paypal_express/remote/build_plugin_helpers.rb @@ -9,8 +9,14 @@ file = File.new(File.join(dir, 'paypal_express.yml'), 'w+') open('paypal_express.yml', 'r') do |origin_file| line_num = 0 + indent_end = false origin_file.each_line do |line| + # insert account id line in the second line (paypal_express.yml starting from the first line) file.puts(account_line) if line_num == 1 + # indent the line between account_id and database setting + need_indent = line_num == 0 ? false : true + indent_end = true if line.strip == ':database:' + line = line.strip.indent(4) if need_indent && !indent_end file.puts(line) line_num += 1 end
Revise indent format for yml loading
diff --git a/lib/devise/jwt/token_coder.rb b/lib/devise/jwt/token_coder.rb index abc1234..def5678 100644 --- a/lib/devise/jwt/token_coder.rb +++ b/lib/devise/jwt/token_coder.rb @@ -36,7 +36,7 @@ end def check_in_blacklist(payload, blacklist) - raise JWT::DecodeError if blacklist.include?(payload['jti']) + raise JWT::DecodeError if blacklist.member?(payload['jti']) end # :reek:UtilityFunction
Fix name collision with expected method in blacklist Instead of expect `include?` method, which is defined in `Module` module, use `member?`. This still allow us to mock using a simple array
diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index abc1234..def5678 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -0,0 +1,10 @@+require "#{File.dirname(__FILE__)}/../test_helper" + +class RoutingTest < ActionController::IntegrationTest + # fixtures :your, :models + + # Replace this with your real tests. + def test_truth + assert true + end +end
Add stub for routing tests git-svn-id: 801577a2cbccabf54a3a609152c727abd26e524a@1226 a18515e9-6cfd-0310-9624-afb4ebaee84e
diff --git a/lib/migration_data/testing.rb b/lib/migration_data/testing.rb index abc1234..def5678 100644 --- a/lib/migration_data/testing.rb +++ b/lib/migration_data/testing.rb @@ -17,6 +17,8 @@ def all_migrations(path) if Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR >= 2 ActiveRecord::MigrationContext.new(path).migrations + elsif Rails::VERSION::MAJOR > 5 + ActiveRecord::MigrationContext.new(path, nil).migrations else ActiveRecord::Migrator.migrations(path) end
Fix for tests running against Rails 6
diff --git a/lib/griddler.rb b/lib/griddler.rb index abc1234..def5678 100644 --- a/lib/griddler.rb +++ b/lib/griddler.rb @@ -1,3 +1,5 @@+require 'rails/engine' +require 'action_view' require 'griddler/errors' require 'griddler/engine' require 'griddler/email'
Allow for some console hacking Make `bundle console` and `irb -Ilib -rgriddler` work as expected.
diff --git a/lib/inch/cli.rb b/lib/inch/cli.rb index abc1234..def5678 100644 --- a/lib/inch/cli.rb +++ b/lib/inch/cli.rb @@ -10,9 +10,13 @@ # @param default [Fixnum] default value for columns # @return [Fixnum] def get_term_columns(default = 80) - str = `stty size` - rows_cols = str.split(' ').map(&:to_i) - rows_cols[1] || default + str = `stty size 2>&1` + if str =~ /Invalid argument/ + default + else + rows_cols = str.split(' ').map(&:to_i) + rows_cols[1] || default + end rescue default end
Fix stty warning when reading terminal size
diff --git a/vmdb/spec/controllers/container_group_controller_spec.rb b/vmdb/spec/controllers/container_group_controller_spec.rb index abc1234..def5678 100644 --- a/vmdb/spec/controllers/container_group_controller_spec.rb +++ b/vmdb/spec/controllers/container_group_controller_spec.rb @@ -13,6 +13,7 @@ end it "renders show screen" do + Authentication.any_instance.stub(:after_authentication_changed) ems = FactoryGirl.create(:ems_kubernetes) container_group = ContainerGroup.create(:ext_management_system => ems, :name => "Test Group") get :show, :id => container_group.id
Add support for verifying the Kubernetes connection This will prevent worker cycling when the Kubernetes endpoint is not available. (transferred from ManageIQ/manageiq@51a2ddc09113bc25b046a7f2a18a24f6c872f34f)
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,6 +1,6 @@ if ENV['CODECLIMATE_REPO_TOKEN'] - require "codeclimate-test-reporter" - CodeClimate::TestReporter.start + require 'simplecov' + SimpleCov.start end require 'simplecov' if ENV['COVERAGE']
Fix coverage generation on Travis Failing build: https://travis-ci.org/neopoly/neo-rails/jobs/210938081 Fix from: https://github.com/codeclimate/ruby-test-reporter/blob/master/CHANGELOG.md#v100-2016-11-03
diff --git a/lib/rake/swift/module_task.rb b/lib/rake/swift/module_task.rb index abc1234..def5678 100644 --- a/lib/rake/swift/module_task.rb +++ b/lib/rake/swift/module_task.rb @@ -35,6 +35,7 @@ end def define_wrapper_task + desc "Build module '#{module_name}'" ModuleWrapperTask.define_task(module_name => [dylib_name, swiftmodule_name]) end
Add description for module tasks
diff --git a/lib/rake_job.rb b/lib/rake_job.rb index abc1234..def5678 100644 --- a/lib/rake_job.rb +++ b/lib/rake_job.rb @@ -8,13 +8,18 @@ rake.chomp end - def initialize(task) + def initialize(task, args = {}) @@rake ||= RakeJob.find_rake @task = task + @args = args end def run! - command = "cd #{RAILS_ROOT} && #{@@rake} #{@task}" + parameters = '' + @args.each do |name, value| + parameters += "#{name}=#{value} " + end + command = "cd #{RAILS_ROOT} && #{@@rake} RAILS_ENV=#{ENV['RAIL_ENV']} #{@task} #{parameters}" unless (system command) raise RakeTaskNotFoundError end
Use correct environment and add parameters
diff --git a/lib/wingtips/configuration.rb b/lib/wingtips/configuration.rb index abc1234..def5678 100644 --- a/lib/wingtips/configuration.rb +++ b/lib/wingtips/configuration.rb @@ -9,6 +9,8 @@ self.instance_eval(File.read(file)) unless file == path end + # the empty slide at the start is needed as otherwise the dimensions + # of the first slide are most likely messed up @slide_classes = [Wingtips::Slide] self.instance_eval(File.read(path)) @@ -28,8 +30,6 @@ end def slides(*slide_classes) - # the empty slide at the start is needed as otherwise the dimensions - # of the first slide are most likely messed up @slide_classes.concat(slide_classes) end end
Move comment where it belongs
diff --git a/app/helpers/application_helper/button/chargeback_rates.rb b/app/helpers/application_helper/button/chargeback_rates.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper/button/chargeback_rates.rb +++ b/app/helpers/application_helper/button/chargeback_rates.rb @@ -4,6 +4,6 @@ end def visible? - @view_context.x_active_tree == :cb_reports_tree + @view_context.x_active_tree == :cb_rates_tree end end
Bring chargeback rates buttons back Hidden since fd0e99728920fc2ee3491dba1e46349d0d0206a0. (transferred from ManageIQ/manageiq@20940f46183c9ecde3cedf01576146b36e02e936)
diff --git a/test/cookbooks/mumble_server_test/recipes/default.rb b/test/cookbooks/mumble_server_test/recipes/default.rb index abc1234..def5678 100644 --- a/test/cookbooks/mumble_server_test/recipes/default.rb +++ b/test/cookbooks/mumble_server_test/recipes/default.rb @@ -24,3 +24,5 @@ include_recipe 'mumble_server' mumble_server_supw 'p4ssw0rd' + +package 'lsof' # required for integration tests
Install lsof for integration tests
diff --git a/test/cookbooks/python-webapp-test/recipes/default.rb b/test/cookbooks/python-webapp-test/recipes/default.rb index abc1234..def5678 100644 --- a/test/cookbooks/python-webapp-test/recipes/default.rb +++ b/test/cookbooks/python-webapp-test/recipes/default.rb @@ -24,7 +24,7 @@ repository 'https://github.com/osu-cass/whats-fresh-api.git' config_template 'config.yml.erb' - config_destination '/opt/whats_fresh/config.yml' + config_destination '/opt/whats_fresh/whats_fresh/config.yml' config_vars( host: 'db.example.com', port: '5432',
Change destination of the config file
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -20,7 +20,10 @@ end def alternative_locales - I18n.available_locales - [I18n.locale] + # This disables the link to Welsh + disabled_locales = [:cy] + + I18n.available_locales - disabled_locales - [I18n.locale] end def add_line_breaks(str)
Disable the link to Welsh (until they’re approved)
diff --git a/app/models/world_location_type.rb b/app/models/world_location_type.rb index abc1234..def5678 100644 --- a/app/models/world_location_type.rb +++ b/app/models/world_location_type.rb @@ -19,6 +19,6 @@ [WorldLocation] end - WorldLocation = create(id: 1, key: "world_location", name: "World location news", sort_order: 0) + WorldLocation = create(id: 1, key: "world_location", name: "World location", sort_order: 0) InternationalDelegation = create(id: 3, key: "international_delegation", name: "International delegation", sort_order: 2) end
Fix name of world location model This was changed in https://github.com/alphagov/whitehall/pull/3384 but the type should still be “world location” whereas whitehall-admin can refer to the pages as “world location news”.
diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index abc1234..def5678 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -18,9 +18,12 @@ it { should compile.with_all_deps } it { should contain_class('users') } - it { should contain_file('/home/bob') } it { should contain_users__account('alice').with_ensure('absent') } it { should contain_users__account('bob').with_ensure('present') } + it { should contain_user('alice').with_ensure('absent') } + it { should contain_user('bob').with_ensure('present') } + it { should contain_file('/home/alice').with_ensure('absent') } + it { should contain_file('/home/bob') } end context 'with bad parameter for hash' do
Add unit test for users. Check the absent user is really absent.
diff --git a/spec/hash/fetcher_spec.rb b/spec/hash/fetcher_spec.rb index abc1234..def5678 100644 --- a/spec/hash/fetcher_spec.rb +++ b/spec/hash/fetcher_spec.rb @@ -0,0 +1,29 @@+require 'spec_helper' + +require 'observed/hash/fetcher' + +describe Observed::Hash::Fetcher do + + subject { + described_class.new(hash) + } + + context 'when the source hash is nil' do + + let(:hash) { nil } + + it 'fails' do + expect { subject }.to raise_error + end + end + + context 'when the source hash is nested' do + + let(:hash) { {foo:{bar:1},baz:2} } + + it 'decodes the key path to recursively find the value' do + expect(subject['foo.bar']).to eq(1) + expect(subject['baz']).to eq(2) + end + end +end
Add the spec for the hash fetcher
diff --git a/lib/comma/extractors.rb b/lib/comma/extractors.rb index abc1234..def5678 100644 --- a/lib/comma/extractors.rb +++ b/lib/comma/extractors.rb @@ -45,8 +45,10 @@ arg.each do |k, v| @results << @instance.send(sym).send(k).to_s end - when Symbol, String + when Symbol @results << @instance.send(sym).send(arg).to_s + when String + @results << @instance.send(sym).to_s else raise "Unknown data symbol #{arg.inspect}" end
Adjust meaning of a string parameter passed as an argument to be the specified header name rather than treated like a symbol, this makes it a bit cleaner to specify a header name when no sub-attribute/method needs to be called (eg. created_at 'Date').
diff --git a/lib/emotions/emotion.rb b/lib/emotions/emotion.rb index abc1234..def5678 100644 --- a/lib/emotions/emotion.rb +++ b/lib/emotions/emotion.rb @@ -6,23 +6,10 @@ validates :emotional, presence: true validates :emotive, presence: true - validates_each :emotion do |record, attr, value| - unless Emotions.emotions.include?(value.try(:to_sym)) - record.errors.add attr, I18n.t(:invalid, scope: [:errors, :messages]) - end - end - - validates_each :emotional do |record, attr, value| - if value.blank? || !value.class.try(:emotional?) - record.errors.add attr, I18n.t(:invalid, scope: [:errors, :messages]) - end - end - - validates_each :emotive do |record, attr, value| - if value.blank? || !value.class.try(:emotive?) - record.errors.add attr, I18n.t(:invalid, scope: [:errors, :messages]) - end - end + # Custom validations + validate :ensure_valid_emotion_name + validate { ensure_valid_associated_record :emotional } + validate { ensure_valid_associated_record :emotive } # Associations belongs_to :emotional, polymorphic: true @@ -34,8 +21,27 @@ protected + # Update the `<emotion>_emotions_counter` for the emotive record def update_emotion_counter self.emotive.update_emotion_counter(self.emotion) end + + # Make sure we're using an allowed emotion name + def ensure_valid_emotion_name + unless Emotions.emotions.include?(self.emotion.try(:to_sym)) + errors.add :emotion, I18n.t(:invalid, scope: [:errors, :messages]) + end + end + + # Make sure that both emotive and emotional records are actually able to + # express and/or receive emotions + def ensure_valid_associated_record(association) + value = send(association) + predicate = :"#{association}?" + + if !value.class.respond_to?(predicate) || !value.class.send(predicate) + errors.add association, I18n.t(:invalid, scope: [:errors, :messages]) + end + end end end
Refactor validations to create methods
diff --git a/lib/nesta/navigation.rb b/lib/nesta/navigation.rb index abc1234..def5678 100644 --- a/lib/nesta/navigation.rb +++ b/lib/nesta/navigation.rb @@ -7,20 +7,23 @@ if options[:levels] > 0 haml_tag :ul, :class => options[:class] do menu.each do |item| - haml_tag :li do - if item.respond_to?(:each) - display_menu(item, :levels => (options[:levels] - 1)) - else - haml_tag :a, :href => item.abspath do - haml_concat item.heading - end - end - end + display_menu_item(item, options) end end end end + def display_menu_item(item, options = {}) + haml_tag :li do + if item.respond_to?(:each) + display_menu(item, :levels => (options[:levels] - 1)) + else + haml_tag :a, :href => item.abspath do + haml_concat item.heading + end + end + end + end end end end
Split display_menu() into two methods.
diff --git a/lib/archivable/model.rb b/lib/archivable/model.rb index abc1234..def5678 100644 --- a/lib/archivable/model.rb +++ b/lib/archivable/model.rb @@ -18,9 +18,9 @@ archived end - def archive! + def archive!(save_args = {}) self.archived = true - save + save(save_args) end def unarchive!
Allow save options to be passed in to archive! method
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 @@ -7,6 +7,11 @@ # TLS-enabled TCP socket that implements convenience # 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) + # Reads given number of bytes with an optional timeout # @@ -27,7 +32,7 @@ rescue EOFError => e puts e.inspect @__bunny_socket_eof_flag__ = true - rescue Errno::EAGAIN, Errno::EWOULDBLOCK, OpenSSL::SSL::SSLError => e + rescue *READ_RETRY_EXCEPTION_CLASSES => e puts e.inspect if IO.select([self], nil, nil, timeout) retry
Use Ruby version-specific retry exception list for SSL socket
diff --git a/lib/cloudwatch_rails.rb b/lib/cloudwatch_rails.rb index abc1234..def5678 100644 --- a/lib/cloudwatch_rails.rb +++ b/lib/cloudwatch_rails.rb @@ -1,7 +1,7 @@ require 'cloudwatch_rails/version' require 'cloudwatch_rails/railtie' if defined?(Rails) require 'cloudwatch_rails/config' -require 'cloudwatch_rails/async_queue' if defined?(Rails) +require 'cloudwatch_rails/async_queue' module CloudwatchRails class CollectorConfig
Fix require for Async Queue
diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/testing/setup_and_teardown.rb +++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb @@ -4,20 +4,11 @@ module ActiveSupport module Testing module SetupAndTeardown - - PASSTHROUGH_EXCEPTIONS = [ - NoMemoryError, - SignalException, - Interrupt, - SystemExit - ] - extend ActiveSupport::Concern included do include ActiveSupport::Callbacks define_callbacks :setup, :teardown - end module ClassMethods
Kill not used constant since removal of runner method Runner method was removed in ada571bfcdbad669ae43a4dd18277ef227680a0b.
diff --git a/lib/gitlab_git/popen.rb b/lib/gitlab_git/popen.rb index abc1234..def5678 100644 --- a/lib/gitlab_git/popen.rb +++ b/lib/gitlab_git/popen.rb @@ -10,9 +10,9 @@ @cmd_output = "" @cmd_status = 0 Open3.popen3(vars, cmd, options) do |stdin, stdout, stderr, wait_thr| - @cmd_status = wait_thr.value.exitstatus @cmd_output << stdout.read @cmd_output << stderr.read + @cmd_status = wait_thr.value.exitstatus end return @cmd_output, @cmd_status
Read output before waiting for process to end Sometimes a subprocess will not exit until it was able to write its output to stdout/stderr. By waiting _after_ we read the subprocess output, we avoid this potential bug.
diff --git a/lib/install/template.rb b/lib/install/template.rb index abc1234..def5678 100644 --- a/lib/install/template.rb +++ b/lib/install/template.rb @@ -27,7 +27,7 @@ end puts "Installing all JavaScript dependencies" -run "yarn add webpacker" +run "yarn add @rails/webpacker" puts "Installing dev server for live reloading" run "yarn add --dev webpack-dev-server"
Update to scoped package name
diff --git a/lib/metrics/rails/group.rb b/lib/metrics/rails/group.rb index abc1234..def5678 100644 --- a/lib/metrics/rails/group.rb +++ b/lib/metrics/rails/group.rb @@ -7,17 +7,17 @@ end def group(prefix) - prefix = @prefix + prefix + prefix = "#{@prefix}#{prefix}" yield self.class.new(prefix) end def increment(counter, by=1) - counter = @prefix + counter + counter = "#{@prefix}#{counter}" Metrics::Rails.increment counter, by end def measure(event, duration) - event = @prefix + event + event = "#{@prefix}#{event}" Metrics::Rails.measure event, duration end alias :timing :measure
Improve handling of non-strings with Group methods.
diff --git a/lib/potemkin/builder.rb b/lib/potemkin/builder.rb index abc1234..def5678 100644 --- a/lib/potemkin/builder.rb +++ b/lib/potemkin/builder.rb @@ -26,11 +26,13 @@ ENV[key] = new_value end - yield + return_value = yield env_vars.each_key do |key| ENV[key] = old_values[key] end + + return_value end # Returns the config, mainly here to mock in tests
Return the value returned by the block
diff --git a/config/initializers/ticket_dispenser.rb b/config/initializers/ticket_dispenser.rb index abc1234..def5678 100644 --- a/config/initializers/ticket_dispenser.rb +++ b/config/initializers/ticket_dispenser.rb @@ -5,7 +5,7 @@ Rails.application.config.to_prepare do TicketDispenser::Ticket.class_eval do def sender - user = messages.first.sender + user = messages.first.sender if messages.first return {} if user.nil? { username: user.username,
Update TD initializer to cope with deleting tickets
diff --git a/lib/rdf/rdfa/version.rb b/lib/rdf/rdfa/version.rb index abc1234..def5678 100644 --- a/lib/rdf/rdfa/version.rb +++ b/lib/rdf/rdfa/version.rb @@ -1,11 +1,8 @@ module RDF::RDFa::VERSION - MAJOR = 0 - MINOR = 2 - TINY = 2 - EXTRA = nil + VERSION_FILE = File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "..", "VERSION") + MAJOR, MINOR, TINY, EXTRA = File.read(VERSION_FILE).chop.split(".") - STRING = [MAJOR, MINOR, TINY].join('.') - STRING << "-#{EXTRA}" if EXTRA + STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.') ## # @return [String] @@ -17,5 +14,5 @@ ## # @return [Array(Integer, Integer, Integer)] - def self.to_a() [MAJOR, MINOR, TINY] end + def self.to_a() STRING.split(".") end end
Implement RDF::RDFa::VERSION by parsing VERSION file.
diff --git a/lib/overcommit/hook/pre_commit/brakeman.rb b/lib/overcommit/hook/pre_commit/brakeman.rb index abc1234..def5678 100644 --- a/lib/overcommit/hook/pre_commit/brakeman.rb +++ b/lib/overcommit/hook/pre_commit/brakeman.rb @@ -6,13 +6,11 @@ return :warn, 'Run `gem install brakeman`' end - result = execute(%w[brakeman --exit-on-warn --quiet --summary --only-files] + applicable_files) + result = execute(%w[brakeman --exit-on-warn --quiet --summary --only-files] + + applicable_files) + return :good if result.success? - if result.success? - :good - else - [ :bad, result.stdout ] - end + [:bad, result.stdout] end end end
Clean up Brakeman pre-commit hook Change-Id: If8ca86338b4d85a0d761ade716c8697ad69178b8 Reviewed-on: http://gerrit.causes.com/37961 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/lib/planaria/generator/builder/executer.rb b/lib/planaria/generator/builder/executer.rb index abc1234..def5678 100644 --- a/lib/planaria/generator/builder/executer.rb +++ b/lib/planaria/generator/builder/executer.rb @@ -14,7 +14,8 @@ instance_variable_set("@#{k}", v) end - ::File.open "./#{@name}/#{file_name}.html", "w" do |file| + create_directory file_name + ::File.open "./#{@name}/#{file_name}/index.html", "w" do |file| file.write erb.result(binding) end end @@ -29,6 +30,10 @@ def erb ::ERB.new(File.read "./#{@name}/html/index.html.erb") end + + def create_directory(file_name) + FileUtils.mkdir_p "./#{@name}/#{file_name}" + end end end end
Change new file build rule
diff --git a/lib/salt/publishable.rb b/lib/salt/publishable.rb index abc1234..def5678 100644 --- a/lib/salt/publishable.rb +++ b/lib/salt/publishable.rb @@ -20,7 +20,7 @@ raise "Syntax error in #{path.gsub(site.source_paths[:root], '')}" end - if @layout && @site.templates[@layout] && use_layout + if use_layout && @layout && @site.templates[@layout] output = @site.templates[@layout].render(output, context) end
Check the use_layout variable before anything else.
diff --git a/lib/traitify/request.rb b/lib/traitify/request.rb index abc1234..def5678 100644 --- a/lib/traitify/request.rb +++ b/lib/traitify/request.rb @@ -9,16 +9,10 @@ end def request(method, path, options = {}) - begin - conn(url: host).send(method) do |request| - request.url [version, path].join - request.body = options.to_json if options - end.body - rescue => e - puts e.message - puts e.inspect - { error: e.message } - end + conn(url: host).send(method) do |request| + request.url [version, path].join + request.body = options.to_json if options + end.body end end end
Allow errors to be raised
diff --git a/db/data_migration/20161205141503_republish_html_attachments_via_attachables.rb b/db/data_migration/20161205141503_republish_html_attachments_via_attachables.rb index abc1234..def5678 100644 --- a/db/data_migration/20161205141503_republish_html_attachments_via_attachables.rb +++ b/db/data_migration/20161205141503_republish_html_attachments_via_attachables.rb @@ -0,0 +1,13 @@+document_ids = Edition + .where(id: HtmlAttachment.pluck(:attachable_id)) + .where(state: %w(published draft withdrawn submitted scheduled)) + .pluck(:document_id) + .uniq + +document_ids.each do |document_id| + print "." + PublishingApiDocumentRepublishingWorker.perform_async_in_queue( + "bulk_republishing", + document_id + ) +end
Add migration to republish `Attachable` This migration republishes all documents that are `Attachable` and have an `HtmlAttachment`. This will cause the `HtmlAttachment`s to be republished too allowing us to get an up to date view of any remaining issues with the migration to Publishing API before switching them over completely. Republishing via the `Attachable` `Edition`'s `Document` allows us to exercise the full republishing worker setup and avoids having to navigate the complicated state of `HtmlAttachment` within the migration.
diff --git a/app/controllers/francis_cms/syndications_controller.rb b/app/controllers/francis_cms/syndications_controller.rb index abc1234..def5678 100644 --- a/app/controllers/francis_cms/syndications_controller.rb +++ b/app/controllers/francis_cms/syndications_controller.rb @@ -0,0 +1,43 @@+require_dependency 'francis_cms/francis_cms_controller' + +module FrancisCms + class SyndicationsController < FrancisCmsController + before_action :require_login + + def create + @syndication = syndicatable.syndications.new(syndication_params) + + @syndication.save + + redirect_to send("edit_#{parent}_path", syndicatable) + end + + def destroy + syndication.destroy + + redirect_to send("edit_#{parent}_path", syndicatable) + end + + private + + def syndication_params + params.require(:syndication).permit(:name, :url) + end + + def parent + @parent ||= %w(posts links).find { |p| request.path.split('/').include? p }.singularize + end + + def parent_class + @parent_class ||= "FrancisCms::#{parent.classify}".constantize + end + + def syndicatable + @syndicatable ||= parent_class.find(params["#{parent}_id"]) + end + + def syndication + @syndication ||= Syndication.find(params[:id]) + end + end +end
Add syndications controller with create/destroy actions.
diff --git a/lib/zemanta/enhancer.rb b/lib/zemanta/enhancer.rb index abc1234..def5678 100644 --- a/lib/zemanta/enhancer.rb +++ b/lib/zemanta/enhancer.rb @@ -28,7 +28,7 @@ url = strip_query_string(url) if @opts[:strip_query_string] - link = "<a href='#{url}'>#{dictionary[:word]}</a>)" + link = "<a href='#{url}'>#{dictionary[:word]}</a>" if @opts[:no_duplicates] @text.sub!(dictionary[:word], link) else
Remove stray bracket from string
diff --git a/lib/web_console/testing/fake_middleware.rb b/lib/web_console/testing/fake_middleware.rb index abc1234..def5678 100644 --- a/lib/web_console/testing/fake_middleware.rb +++ b/lib/web_console/testing/fake_middleware.rb @@ -19,7 +19,10 @@ end def call(env) - [ 200, @headers, [ render(req_path(env)) ] ] + body = render(req_path(env)) + @headers["content-length"] = body.bytesize.to_s + + [ 200, @headers, [ body ] ] end def view
Set content-length header in the FakeMiddleware Similar change as rails/web-console#290
diff --git a/elasticsearch-simple.gemspec b/elasticsearch-simple.gemspec index abc1234..def5678 100644 --- a/elasticsearch-simple.gemspec +++ b/elasticsearch-simple.gemspec @@ -8,8 +8,8 @@ spec.version = Elasticsearch::Simple::VERSION spec.authors = ["Jiří Zajpt"] spec.email = ["jzajpt@blueberry.cz"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} + spec.description = %q{Simple extension of elasticsearch gem to allow easy indexing and searching} + spec.summary = %q{Simple extension of elasticsearch gem to allow easy indexing and searching} spec.homepage = "" spec.license = "MIT"
Add description and summary to gemspec file
diff --git a/qa/qa/specs/features/project/add_secret_variable_spec.rb b/qa/qa/specs/features/project/add_secret_variable_spec.rb index abc1234..def5678 100644 --- a/qa/qa/specs/features/project/add_secret_variable_spec.rb +++ b/qa/qa/specs/features/project/add_secret_variable_spec.rb @@ -4,7 +4,7 @@ Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } - variable = Factory::Resource::SecretVariable.fabricate! do |resource| + Factory::Resource::SecretVariable.fabricate! do |resource| resource.key = 'VARIABLE_KEY' resource.value = 'some secret variable' end
Remove useless assignment in secret variables specs
diff --git a/cookbooks/bcpc/recipes/rotate_chef_nginx_access_log.rb b/cookbooks/bcpc/recipes/rotate_chef_nginx_access_log.rb index abc1234..def5678 100644 --- a/cookbooks/bcpc/recipes/rotate_chef_nginx_access_log.rb +++ b/cookbooks/bcpc/recipes/rotate_chef_nginx_access_log.rb @@ -10,6 +10,6 @@ path '/var/log/chef-server/nginx/access.log' frequency 'daily' rotate 5 - options %w(missingok compress) - postrotate '/usr/bin/truncate --size=0 /var/log/chef-server/nginx/access.log' + options %w(missingok notifempty compress delaycompress copytruncate) + postrotate '/opt/chef-server/embedded/sbin/nginx -s reopen' end
Fix Chef server Nginx logrotate configuration - Add `copytruncate`, `notifempty` and `delaycompress` options to ensure we get the behavior we actually want. - With `copytruncate` chosen, we can then remove the existing `postrotate` command and replace it with a `SIGUSR1`, known as a `reopen` to the Nginx daemon, which will release any open log file handles.
diff --git a/paperclip_waveform.gemspec b/paperclip_waveform.gemspec index abc1234..def5678 100644 --- a/paperclip_waveform.gemspec +++ b/paperclip_waveform.gemspec @@ -19,5 +19,6 @@ s.add_dependency "paperclip" s.add_dependency "waveform" + s.add_development_dependency "rails" s.add_development_dependency "sqlite3" end
Add rails as development dependency
diff --git a/access2rails.gemspec b/access2rails.gemspec index abc1234..def5678 100644 --- a/access2rails.gemspec +++ b/access2rails.gemspec @@ -8,7 +8,7 @@ gem.summary = %q{Convert MS Access xsl files to rails models and migrations, and import xml data.} gem.homepage = "" - gem.files = `git ls-files`.split($\) + gem.files = `git ls-files`.split("\n") gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.name = "access2rails"
Fix handling spaces in filenames for gemspec
diff --git a/activeportal.gemspec b/activeportal.gemspec index abc1234..def5678 100644 --- a/activeportal.gemspec +++ b/activeportal.gemspec @@ -14,9 +14,13 @@ s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc'] s.add_dependency 'rails', '~> 4.1.0' - s.add_dependency 'devise', '~> 3.2.4' + s.add_dependency 'devise' + s.add_dependency 'devise-i18n' + s.add_dependency 'devise-i18n-views' + s.add_dependency 'http_accept_language' s.add_development_dependency 'pg' s.add_development_dependency 'rspec', '~> 3.0.0.beta' s.add_development_dependency 'rspec-rails', '~> 3.0.0.beta' + s.add_development_dependency 'capybara' end
Add I18n support and capybara
diff --git a/lib/libra2/app/controllers/concerns/authentication_behavior.rb b/lib/libra2/app/controllers/concerns/authentication_behavior.rb index abc1234..def5678 100644 --- a/lib/libra2/app/controllers/concerns/authentication_behavior.rb +++ b/lib/libra2/app/controllers/concerns/authentication_behavior.rb @@ -22,6 +22,7 @@ if request.env['HTTP_REMOTE_USER'].present? puts "=====> HTTP_REMOTE_USER: #{request.env['HTTP_REMOTE_USER']}" begin + # TODO-PER: This fails when called when requesting the favicon. I'm not sure why, but the errors are obscuring real system errors. return if sign_in_user_id( request.env['HTTP_REMOTE_USER'] ) rescue return false
Fix 500 error when requesting the favicon when not logged in.
diff --git a/spec/importers/data_transformers/csv_transformer_spec.rb b/spec/importers/data_transformers/csv_transformer_spec.rb index abc1234..def5678 100644 --- a/spec/importers/data_transformers/csv_transformer_spec.rb +++ b/spec/importers/data_transformers/csv_transformer_spec.rb @@ -19,6 +19,21 @@ ]) end end + context 'headers not in csv' do + # Return a File.read string just like the CsvDownloader class does: + let!(:file) { File.read("#{Rails.root}/spec/fixtures/fake_no_headers.csv") } + + let(:headers) {["section_number","student_local_id","school_local_id","course_number","term_local_id","grade"]} + let(:headers_symbols) {[:section_number,:student_local_id,:school_local_id,:course_number,:term_local_id,:grade]} + let(:transformer) { CsvTransformer.new(headers:headers) } + let(:output) { transformer.transform(file) } + it 'returns a CSV' do + expect(output).to be_a_kind_of CSV::Table + end + it 'has the correct headers' do + expect(output.headers).to match_array(headers_symbols) + end + end end end end
Revert "Remove spec for scenario that doesn't exist in the project (no headers in CSV export file)" This reverts commit d2c16d9d8bf849a459900e6bc6e4b6b1a3fd27a8.
diff --git a/cranium.gemspec b/cranium.gemspec index abc1234..def5678 100644 --- a/cranium.gemspec +++ b/cranium.gemspec @@ -13,7 +13,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] - spec.add_runtime_dependency 'pg', '~> 1' + spec.add_runtime_dependency 'pg', '>= 0' spec.add_runtime_dependency 'progressbar', '~> 0' spec.add_runtime_dependency 'sequel', '>= 4', '< 6' spec.add_runtime_dependency 'slop', '~> 3'
AA-8903: Allow to use older version of pg too
diff --git a/effective_datatables.gemspec b/effective_datatables.gemspec index abc1234..def5678 100644 --- a/effective_datatables.gemspec +++ b/effective_datatables.gemspec @@ -20,5 +20,5 @@ s.add_dependency 'coffee-rails' s.add_dependency 'effective_bootstrap' s.add_dependency 'effective_resources' - s.add_dependency 'sass-rails' + s.add_dependency 'sass' end
Drop sass-rails dependency, so sites can use sassc-rails or sass-rails.
diff --git a/config/initializers/slack_api.rb b/config/initializers/slack_api.rb index abc1234..def5678 100644 --- a/config/initializers/slack_api.rb +++ b/config/initializers/slack_api.rb @@ -12,4 +12,6 @@ Slack.chat_postMessage(options) end -client.start +Thread.new do + client.start +end
Send websocket work to background thread
diff --git a/db/migrate/20210319155627_update_return_adjustments.rb b/db/migrate/20210319155627_update_return_adjustments.rb index abc1234..def5678 100644 --- a/db/migrate/20210319155627_update_return_adjustments.rb +++ b/db/migrate/20210319155627_update_return_adjustments.rb @@ -0,0 +1,17 @@+class UpdateReturnAdjustments < ActiveRecord::Migration[5.0] + class Spree::Adjustment < ActiveRecord::Base + belongs_to :source, polymorphic: true + end + + def up + Spree::Adjustment.where(source_type: 'Spree::ReturnAuthorization').update_all( + "originator_id = source_id, originator_type = 'Spree::ReturnAuthorization', source_id = NULL, source_type = NULL" + ) + end + + def down + Spree::Adjustment.where(originator_type: 'Spree::ReturnAuthorization').update_all( + "source_id = originator_id, source_type = 'Spree::ReturnAuthorization', originator_id = NULL, originator_type = NULL" + ) + end +end
Migrate return adjustments source to originator
diff --git a/event_store-client.gemspec b/event_store-client.gemspec index abc1234..def5678 100644 --- a/event_store-client.gemspec +++ b/event_store-client.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'event_store-client' - s.version = '0.0.1.3' + s.version = '0.0.1.4' s.summary = 'Common code for the EventStore client' s.description = ' '
Increase version from 0.0.1.3 to 0.0.1.4
diff --git a/sms_ru.gemspec b/sms_ru.gemspec index abc1234..def5678 100644 --- a/sms_ru.gemspec +++ b/sms_ru.gemspec @@ -17,9 +17,8 @@ spec.require_paths = ['lib'] spec.required_ruby_version = '>= 2.0.0' - spec.add_dependency 'activesupport', '~> 4.2.0' spec.add_dependency 'launchy', '~> 2.4' - spec.add_dependency 'webmock', '~> 1.20' + spec.add_dependency 'webmock', '~> 2.3' spec.add_development_dependency 'bundler', '~> 1.7' spec.add_development_dependency 'rake', '~> 10.0'
Remove outdated activesupport dependency Update webmock dependency version
diff --git a/rails_presenter.gemspec b/rails_presenter.gemspec index abc1234..def5678 100644 --- a/rails_presenter.gemspec +++ b/rails_presenter.gemspec @@ -1,3 +1,5 @@+# encoding: utf-8 + $:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version:
Add encoding: utf-8 to gemspec
diff --git a/spec/models.rb b/spec/models.rb index abc1234..def5678 100644 --- a/spec/models.rb +++ b/spec/models.rb @@ -8,5 +8,5 @@ class Note include NoBrainer::Document field :body, default: 'made by orm' - belongs_to :user, foreign_key: :owner_id + belongs_to :owner, foreign_key: :owner_id, class_name: 'User' end
Tweak associations to better match reference implementation
diff --git a/app/controllers/renalware/system/errors_controller.rb b/app/controllers/renalware/system/errors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/renalware/system/errors_controller.rb +++ b/app/controllers/renalware/system/errors_controller.rb @@ -13,7 +13,9 @@ def generate_test_internal_server_error raise "This is an intentionally raised error - please ignore it. " \ - "It is used only to test system integration" + "It is used only to test system integration. " \ + "The rest of this messages is padding to test that the title is truncated to 256 " \ + "characters#{'.' * 100}" end end end
Add padding to test error to check party_foul title length This is to test our assertion that party_foul is posting titles longer than 256 chars.