diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/validates_with_block.rb b/lib/validates_with_block.rb index abc1234..def5678 100644 --- a/lib/validates_with_block.rb +++ b/lib/validates_with_block.rb @@ -17,8 +17,8 @@ def valid_attribute_name?(name) column_names.include?(name) || ( - instance_methods(false).include?("#{name}=") && - instance_methods(false).include?(name) + instance_methods.include?("#{name}=") && + instance_methods.include?(name) ) end
Include all instance methods when checking attribute name This change will allow more names to be used but given that the current code at least requires validates_ it is very unlikely to cause confusion.
diff --git a/lib/will_paginate_search.rb b/lib/will_paginate_search.rb index abc1234..def5678 100644 --- a/lib/will_paginate_search.rb +++ b/lib/will_paginate_search.rb @@ -2,7 +2,7 @@ # Copyright (c) 2007 - 2010 Douglas F Shearer. # http://douglasfshearer.com -module Foo::Acts::Indexed +module ActsAsIndexed module WillPaginate @@ -29,5 +29,5 @@ end class ActiveRecord::Base - extend Foo::Acts::Indexed::WillPaginate::Search + extend ActsAsIndexed::WillPaginate::Search end
Fix to WillPaginate module structure due to poor merge.
diff --git a/lib/hyperloop/application.rb b/lib/hyperloop/application.rb index abc1234..def5678 100644 --- a/lib/hyperloop/application.rb +++ b/lib/hyperloop/application.rb @@ -4,9 +4,9 @@ class Application include Rack::Utils - def initialize(root='') + def initialize(root=nil) @root = root - @views_path = File.join(@root, 'app/views') + @views_path = File.join([@root, 'app/views'].compact) end # Rack call interface.
Handle Application.new with no root
diff --git a/lib/metrica/rails/railtie.rb b/lib/metrica/rails/railtie.rb index abc1234..def5678 100644 --- a/lib/metrica/rails/railtie.rb +++ b/lib/metrica/rails/railtie.rb @@ -10,7 +10,7 @@ config.after_initialize do # Insert ActiveRecord instrumentation if defined?(::ActiveRecord::ConnectionAdapters::AbstractAdapter) - require_relative "instrumentation/active_record" + require_relative "../instrumentation/active_record" ::ActiveRecord::ConnectionAdapters::AbstractAdapter. send(:include, Metrica::Instrumentation::ActiveRecord) end @@ -43,4 +43,4 @@ end end -end+end
Fix ActiveRecord instrumentation require path.
diff --git a/lib/private_address_check.rb b/lib/private_address_check.rb index abc1234..def5678 100644 --- a/lib/private_address_check.rb +++ b/lib/private_address_check.rb @@ -1,5 +1,5 @@ require "ipaddr" -require "resolv" +require "socket" require "private_address_check/version" @@ -30,7 +30,7 @@ end def resolves_to_private_address?(hostname) - ips = Resolv.getaddresses(hostname) + ips = Socket.getaddrinfo(hostname, nil).map { |info| IPAddr.new(info[3]) } return true if ips.empty? ips.any? do |ip|
Use Socket instead of Resolv for DNS The Socket library is tied closer to the libc Ruby is using and is probably going to have less issues in the long run.
diff --git a/lib/caprese/routing/caprese_resources.rb b/lib/caprese/routing/caprese_resources.rb index abc1234..def5678 100644 --- a/lib/caprese/routing/caprese_resources.rb +++ b/lib/caprese/routing/caprese_resources.rb @@ -1,49 +1,26 @@ require 'action_dispatch/routing/mapper' -module Caprese - module Routing - module CapreseResources - extend ActionDispatch::Routing::Mapper::Resources +class ActionDispatch::Routing::Mapper + def caprese_resources(*resources, &block) + options = resources.extract_options! - def caprese_resources(*resources, &block) - options = resources.extract_options!.dup + resources.each do |r| + resources r, only: [:index, :show, :create, :update, :destroy] do + yield if block_given? - if apply_common_behavior_for(:resources, resources, options, &block) - return self + member do + get 'relationships/:relationship', + to: "#{parent_resource.name}#get_relationship_definition", + as: :relationship_definition + + match 'relationships/:relationship', + to: "#{parent_resource.name}#update_relationship_definition", + via: [:patch, :post, :delete] + + get ':relationship(/:relation_primary_key_value)', + to: "#{parent_resource.name}#get_relationship_data", + as: :relationship_data end - - resource_scope(:resources, Resource.new(resources.pop, options)) do - yield if block_given? - - concerns(options[:concerns]) if options[:concerns] - - collection do - get :index if parent_resource.actions.include?(:index) - post :create if parent_resource.actions.include?(:create) - end - - member do - get 'relationships/:relationship', - to: "#{parent_resource.name}#get_relationship_definition", - as: :relationship_definition - - match 'relationships/:relationship', - to: "#{parent_resource.name}#update_relationship_definition", - via: [:patch, :post, :delete] - - get ':relationship(/:relation_primary_key_value)', - to: "#{parent_resource.name}#get_relationship_data", - as: :relationship_data - end - - new do - get :new - end if parent_resource.actions.include?(:new) - - set_member_mappings_for_resource - end - - self end end end
Refactor routing helper to use built in Rails functionality
diff --git a/lib/psd/util.rb b/lib/psd/util.rb index abc1234..def5678 100644 --- a/lib/psd/util.rb +++ b/lib/psd/util.rb @@ -1,16 +1,18 @@ class PSD - class Util + module Util + extend self + # Ensures value is a multiple of 2 - def self.pad2(i) + def pad2(i) ((i + 1) / 2) * 2 end # Ensures value is a multiple of 4 - def self.pad4(i) + def pad4(i) i - (i.modulo(4)) + 3 end - def self.clamp(num, min, max) + def clamp(num, min, max) [min, num, max].sort[1] end end
Change Util to a module
diff --git a/lib/tasks/asset_manager.rake b/lib/tasks/asset_manager.rake index abc1234..def5678 100644 --- a/lib/tasks/asset_manager.rake +++ b/lib/tasks/asset_manager.rake @@ -1,6 +1,16 @@ namespace :asset_manager do desc "Migrates Assets to Asset Manager." - task migrate_assets: :environment do - MigrateAssetsToAssetManager.new.perform + task :migrate_assets, [:target_dir] => :environment do |_, args| + abort(usage_string) unless args[:target_dir] + MigrateAssetsToAssetManager.new(args[:target_dir]).perform + end + + private + + def usage_string + %{Usage: asset_manager:migrate_assets[<path>] + + Where <path> is a subdirectory under Whitehall.clean_uploads_root e.g. `system/uploads/organisation/logo` + } end end
Make target_dir parameter of migrate_assets rake task
diff --git a/test/integration/default/serverspec/mailcatcher_spec.rb b/test/integration/default/serverspec/mailcatcher_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/mailcatcher_spec.rb +++ b/test/integration/default/serverspec/mailcatcher_spec.rb @@ -0,0 +1,23 @@+require "spec_helper" + +describe "practicingruby::_mailcatcher" do + it "installs mailcatcher gem" do + expect(package "mailcatcher").to be_installed.by "gem" + end + + it "enables mailcatcher service" do + expect(service "mailcatcher").to be_enabled + end + + it "starts mailcatcher service" do + expect(command "status mailcatcher").to return_stdout /^mailcatcher start\/running/ + end + + it "starts mailcatcher SMTP server" do + expect(port 1025).to be_listening + end + + it "starts mailcatcher HTTP server" do + expect(port 1080).to be_listening + end +end
Add integration test for MailCatcher
diff --git a/lib/contentr/string_extensions.rb b/lib/contentr/string_extensions.rb index abc1234..def5678 100644 --- a/lib/contentr/string_extensions.rb +++ b/lib/contentr/string_extensions.rb @@ -9,6 +9,7 @@ s.gsub!('_', '-') # s.gsub!(/[^a-z0-9\s-]/, '') # Remove non-word characters s.gsub!(/\s+/, '-') # Convert whitespaces to dashes + s.gsub!(/\//, '-') s.gsub!(/-\z/, '') # Remove trailing dashes s.gsub!(/-+/, '-') # get rid of double-dashes s.gsub!(/[&\?]/, '')
Remove slashes in the to_slug method.
diff --git a/lib/finite_machine/subscribers.rb b/lib/finite_machine/subscribers.rb index abc1234..def5678 100644 --- a/lib/finite_machine/subscribers.rb +++ b/lib/finite_machine/subscribers.rb @@ -60,8 +60,10 @@ # @return [undefined] # # @api public - def visit(hook_event) - each { |subscriber| synchronize { hook_event.notify(subscriber) } } + def visit(hook_event, *data) + each { |subscriber| + synchronize { hook_event.notify(subscriber, *data) } + } end # Number of subscribed listeners
Change subscirbers to be notified with data.
diff --git a/lib/game.rb b/lib/game.rb index abc1234..def5678 100644 --- a/lib/game.rb +++ b/lib/game.rb @@ -22,7 +22,7 @@ if @gametype.valid_slots.include?(index_position) @gametype = gametype.move(index_position) comp_move - ui.show_board(gametype.board) + ui.show_board(gametype.board_arr) ui.display_winner_message(rules, gametype) else ui.display_invalid_input @@ -30,8 +30,8 @@ end def play - ui.display_intro_msg(gametype, rules) - ui.show_board(gametype.board) + ui.display_intro_msg(rules) + ui.show_board(gametype.board_arr) while !rules.game_over?(gametype) ui.prompt_user_for_input(gametype) alternate_move
Change variabe name to board_arr
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb index abc1234..def5678 100644 --- a/app/workers/post_receive.rb +++ b/app/workers/post_receive.rb @@ -4,8 +4,7 @@ sidekiq_options queue: :post_receive - def perform(repo_path, oldrev, newrev, ref, identifier) - + def perform(repo_path, identifier, changes) if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s) repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "") else @@ -22,17 +21,23 @@ return false end - user = identify(identifier, project, newrev) + changes = changes.lines if changes.kind_of?(String) - unless user - log("Triggered hook for non-existing user \"#{identifier} \"") - return false - end + changes.each do |change| + oldrev, newrev, ref = change.strip.split(' ') - if tag?(ref) - GitTagPushService.new.execute(project, user, oldrev, newrev, ref) - else - GitPushService.new.execute(project, user, oldrev, newrev, ref) + @user ||= identify(identifier, project, newrev) + + unless @user + log("Triggered hook for non-existing user \"#{identifier} \"") + return false + end + + if tag?(ref) + GitTagPushService.new.execute(project, @user, oldrev, newrev, ref) + else + GitPushService.new.execute(project, @user, oldrev, newrev, ref) + end end end
Update post-receive worker for new format Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
diff --git a/lib/viera_play/time_stamp.rb b/lib/viera_play/time_stamp.rb index abc1234..def5678 100644 --- a/lib/viera_play/time_stamp.rb +++ b/lib/viera_play/time_stamp.rb @@ -1,6 +1,6 @@ class TimeStamp def self.parse(string) - if /\A(-?)([0-9]{2}):([0-9]{2}):([0-9]{2})\Z/.match(string) + if /\A(-?)([0-9]{1,2}):([0-9]{2}):([0-9]{2})\Z/.match(string) negative, parts = $1, [$2, $3, $4] parts = parts.map(&:to_i) val = parts[0] * 60**2 + parts[1] * 60 + parts[2]
Work with timestamps that have only one hour digit.
diff --git a/lib/http/request_stream.rb b/lib/http/request_stream.rb index abc1234..def5678 100644 --- a/lib/http/request_stream.rb +++ b/lib/http/request_stream.rb @@ -15,12 +15,11 @@ end def add_body_type_headers - case @body - when String - @request_header << "Content-Length: #{@body.length}" unless @headers['Content-Length'] - when Enumerable - if encoding = @headers['Transfer-Encoding'] - raise ArgumentError, "invalid transfer encoding" unless encoding == "chunked" + if @body.class == String and not @headers['Content-Length'] + @request_header << "Content-Length: #{@body.length}" + elsif @body.class == Enumerable + if encoding = @headers['Transfer-Encoding'] and not encoding == "chunked" + raise ArgumentError, "invalid transfer encoding" else @request_header << "Transfer-Encoding: chunked" end @@ -40,10 +39,10 @@ header = self.join_headers @socket << header - case @body - when String + + if @body.class == String @socket << @body - when Enumerable + elsif @body.class == Enumerable @body.each do |chunk| @socket << chunk.bytesize.to_s(16) << CRLF @socket << chunk
Swap case with conditionals, also remove some predicates there were places where the predicates could be folded into the conditional statements hovering above them once this was turned into an if Signed-off-by: Sam Phippen <e5a09176608998a68778e11d5021c871e8fae93c@googlemail.com>
diff --git a/lib/rexml-expansion-fix.rb b/lib/rexml-expansion-fix.rb index abc1234..def5678 100644 --- a/lib/rexml-expansion-fix.rb +++ b/lib/rexml-expansion-fix.rb @@ -1,15 +1,29 @@+# Copyright (c) 2008 Michael Koziarski <michael@koziarski.com> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + require 'rexml/document' require 'rexml/entity' module REXML class Entity < Child - def unnormalized + def unnormalized document.record_entity_expansion! v = value() - return nil if v.nil? + return nil if v.nil? @unnormalized = Text::unnormalize(v, parent) - @unnormalized - end + @unnormalized + end end class Document < Element @@entity_expansion_limit = 10_000
Add the ISC license to the source file too
diff --git a/templates/run_specs.rb b/templates/run_specs.rb index abc1234..def5678 100644 --- a/templates/run_specs.rb +++ b/templates/run_specs.rb @@ -1,9 +1,9 @@-run('rspec spec -cfdoc') -run('rake --trace spec') -run('rake --trace spec:requests') -run('rake --trace spec:models') -run('rake --trace spec:views') -run('rake --trace spec:controllers') -run('rake --trace spec:helpers') -run('rake --trace spec:mailers') -run("rake --trace stats") +run('rspec spec -cfdoc') || abort +run('rake --trace spec') || abort +run('rake --trace spec:requests') || abort +run('rake --trace spec:models') || abort +run('rake --trace spec:views') || abort +run('rake --trace spec:controllers') || abort +run('rake --trace spec:helpers') || abort +run('rake --trace spec:mailers') || abort +run("rake --trace stats") || abort
Abort with non-zero exit status if any command fails
diff --git a/spec/ext/nobrainer_spec.rb b/spec/ext/nobrainer_spec.rb index abc1234..def5678 100644 --- a/spec/ext/nobrainer_spec.rb +++ b/spec/ext/nobrainer_spec.rb @@ -4,7 +4,10 @@ if ExtVerifier.has_nobrainer? before :all do - NoBrainer.configure { |c| c.app_name = "ap_test" } + NoBrainer.configure do |config| + config.app_name = "ap_test" + config.environment = :test + end end before :all do
Configure NoBrainer to use the test environment This is to prevent it from trying to connect to localhost during tests which causes errors shown here: https://github.com/michaeldv/awesome_print/pull/228#issuecomment-217092622
diff --git a/spec/how_is/builds_spec.rb b/spec/how_is/builds_spec.rb index abc1234..def5678 100644 --- a/spec/how_is/builds_spec.rb +++ b/spec/how_is/builds_spec.rb @@ -13,10 +13,23 @@ end describe "#builds" do + around(:example) do |example| + token = ENV["HOWIS_GITHUB_TOKEN"] + username = ENV["HOWIS_GITHUB_USERNAME"] + begin + ENV["HOWIS_GITHUB_TOKEN"] = "blah" + ENV["HOWIS_GITHUB_USERNAME"] = "who" + example.run + ensure + ENV["HOWIS_GITHUB_TOKEN"] = token + ENV["HOWIS_GITHUB_USERNAME"] = username + end + end + it "returns an Array" do - VCR.use_cassette("how-is-how-is-travis-api-repos-builds") do - expect(subject.builds).to be_a(Array) - end + VCR.use_cassette("how-is-how-is-travis-api-repos-builds") do + expect(subject.builds).to be_a(Array) + end end end end
Spec: Allow test to run on forked repos also
diff --git a/spec/tests/landing_spec.rb b/spec/tests/landing_spec.rb index abc1234..def5678 100644 --- a/spec/tests/landing_spec.rb +++ b/spec/tests/landing_spec.rb @@ -0,0 +1,39 @@+require 'spec_helper' + +describe 'Hi5 web site' do + + describe 'on Footer Navigation Bar ' do + context 'without page object' do + before(:each) do + visit('/') + end + + it 'clicks Mobile button successfully' do + click_link('Mobile') + expect(page).to have_content('Meet people on the go.') + end + + it 'clicks Company button successfully' do + find('.footer_nav').find_link('Company').click + expect(page).to have_content('A reverence for') + end + end + + context 'with page object' do + before(:each) do + visit('/') + @footer = FooterNavigationBar.new + end + + it 'clicks Mobile button successfully' do + @footer.click_mobile + expect(page).to have_content('Meet people on the go.') + end + + it 'clicks Company button successfully' do + @footer.click_company + expect(page).to have_content('A reverence for') + end + end + end +end
Add the tests for landing page This file is going to test some features in the landing page
diff --git a/tasks/gwt_javadoc_fix.rake b/tasks/gwt_javadoc_fix.rake index abc1234..def5678 100644 --- a/tasks/gwt_javadoc_fix.rake +++ b/tasks/gwt_javadoc_fix.rake @@ -0,0 +1,12 @@+# Ugly hack required as the gwt jars cause the javadoc tool heart ache +module Buildr + module DocFix #:nodoc: + include Extension + after_define(:doc) do |project| + project.doc.classpath.delete_if {|f| f.to_s =~ /.*\/com\/google\/gwt\/gwt-user\/.*/} + end + end + class Project #:nodoc: + include DocFix + end +end
Add work around for javadocs not playing friendly with gwt jar
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -7,7 +7,7 @@ depends 'build-essential' depends 'xml' -depends 'mysql', '>= 6.0.0' +depends 'mysql' depends 'yum-epel' depends 'windows' depends 'iis'
Remove mysql cookbook version constraint
diff --git a/Formula/clay.rb b/Formula/clay.rb index abc1234..def5678 100644 --- a/Formula/clay.rb +++ b/Formula/clay.rb @@ -1,8 +1,8 @@ require 'formula' class Clay < Formula - url 'http://tachyon.in/clay/binaries/clay-macosx-2011.04.18.zip' - homepage 'http://claylanguage.org' + url 'http://claylabs.com/clay/binaries/clay-macosx-2011.04.18.zip' + homepage 'http://claylabs.com/clay/' md5 '9f43d8147f95ce0d7c3cd12e368406a4' def install
Clay: Use current binary and homepage URLs The Clay homepage has moved to http://claylabs.com/clay/. The claylanguage.org hostname still redirects to the old site, so that should be changed as well. Closes Homebrew/homebrew#8935. Signed-off-by: Charlie Sharpsteen <828d338a9b04221c9cbe286f50cd389f68de4ecf@sharpsteen.net>
diff --git a/lib/services.rb b/lib/services.rb index abc1234..def5678 100644 --- a/lib/services.rb +++ b/lib/services.rb @@ -3,7 +3,10 @@ module Services def self.publishing_api - @publishing_api ||= GdsApi::PublishingApiV2.new(Plek.new.find('publishing-api')) + @publishing_api ||= GdsApi::PublishingApiV2.new( + Plek.new.find('publishing-api'), + bearer_token: ENV['PUBLISHING_API_BEARER_TOKEN'] || 'example' + ) end def self.rummager
Add bearer_token for publishing_api authentication
diff --git a/lib/tockspit.rb b/lib/tockspit.rb index abc1234..def5678 100644 --- a/lib/tockspit.rb +++ b/lib/tockspit.rb @@ -5,11 +5,13 @@ require "json" module Tockspit + USER_AGENT = "Tockspit v#{VERSION} (daniel+open-source@floppy.co)" + def self.roles(email, password) http = Net::HTTP.new('www.tickspot.com', 443) http.use_ssl = true - request = Net::HTTP::Get.new('/api/v2/roles.json') + request = Net::HTTP::Get.new('/api/v2/roles.json', { 'User-Agent' => USER_AGENT }) request.basic_auth(email, password) response = http.request(request)
Set user agent as required by Tick API
diff --git a/lib/miq_automation_engine/service_models/miq_ae_service_ext_management_system.rb b/lib/miq_automation_engine/service_models/miq_ae_service_ext_management_system.rb index abc1234..def5678 100644 --- a/lib/miq_automation_engine/service_models/miq_ae_service_ext_management_system.rb +++ b/lib/miq_automation_engine/service_models/miq_ae_service_ext_management_system.rb @@ -8,6 +8,7 @@ expose :ems_folders, :association => true expose :resource_pools, :association => true expose :tenant, :association => true + expose :miq_templates, :association => true expose :to_s expose :authentication_userid expose :authentication_password
Add method Available_Images to populate image dropdown box (transferred from ManageIQ/manageiq@c6c4f0b7439796deb5a83f1a59ea7edf9a855259)
diff --git a/app/views/spree/products/google_merchant.rss.builder b/app/views/spree/products/google_merchant.rss.builder index abc1234..def5678 100644 --- a/app/views/spree/products/google_merchant.rss.builder +++ b/app/views/spree/products/google_merchant.rss.builder @@ -7,7 +7,8 @@ production_domain = Spree::GoogleMerchant::Config[:production_domain] xml.link production_domain - + calculator = Spree::Country.find_by_iso('US').zone.shipping_methods.first.calculator + @products.each do |product| xml.item do xml.id product.id.to_s @@ -18,7 +19,9 @@ xml.tag! "g:id", product.id.to_s xml.tag! "g:price", product.price xml.tag! "g:condition", "new" - xml.tag! "g:image_link", production_domain.sub(/\/$/, '') + product.images.first.attachment.url(:product) unless product.images.empty? + xml.tag! "g:availability", "in stock" + xml.tag! "g:shipping", calculator.compute(product) + xml.tag! "g:image_link", product.images.first.attachment.url(:product) unless product.images.empty? end end end
Add shipping to RSS feed.
diff --git a/test/refinance_test.rb b/test/refinance_test.rb index abc1234..def5678 100644 --- a/test/refinance_test.rb +++ b/test/refinance_test.rb @@ -2,11 +2,11 @@ class RefinanceTest < Minitest::Test def test_refinance_is_a_module - assert_kind_of Module, ::Refinance + assert_kind_of ::Module, ::Refinance end def test_version_is_a_string - assert_kind_of String, ::Refinance::VERSION + assert_kind_of ::String, ::Refinance::VERSION end def test_interest_rate_stops_if_max_iterations_reached
Make constant references more precise
diff --git a/stdlib/opal-platform.rb b/stdlib/opal-platform.rb index abc1234..def5678 100644 --- a/stdlib/opal-platform.rb +++ b/stdlib/opal-platform.rb @@ -5,7 +5,7 @@ nashorn = `typeof(Java) !== "undefined" && Java.type` headless_chrome = `typeof(navigator) !== "undefined" && /\bHeadlessChrome\//.test(navigator.userAgent)` gjs = `typeof(window) !== "undefined" && typeof(GjsFileImporter) !== 'undefined'` -opalminiracer = `typeof(opalminiracer) !== 'undefined'` +opal_miniracer = `typeof(opalminiracer) !== 'undefined'` OPAL_PLATFORM = if nashorn 'nashorn' @@ -15,7 +15,7 @@ 'headless-chrome' elsif gjs 'gjs' - elsif opalminiracer + elsif opal_miniracer 'opal-miniracer' else # possibly browser, which is the primary target end
Fix opalminiracer variable name problem
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -13,3 +13,6 @@ supports 'windows' depends 'windows', '~> 1.0' + +source_url 'https://github.com/dhoer/chef-chromedriver' if respond_to?(:source_url) +issues_url 'https://github.com/dhoer/chef-chromedriver/issues' if respond_to?(:issues_url)
Add source and issues url
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,7 +1,7 @@ name 'chef-analytics' maintainer 'Chef Software, Inc.' maintainer_email 'cookbooks@chef.io' -license 'Apache 2.0' +license 'Apache-2.0' description 'Installs/Configures chef-analytics' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.2.3'
Use a SPDX standard license string Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,11 +1,11 @@-name 'kibana' +name 'opsworks_kibana' maintainer 'Andrew Jo' maintainer_email 'andrew@verdigris.co' license 'Simplified BSD' description 'Installs and configures Kibana' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.0' +version '0.1.1' -depends 'kibana_lwrp', '~> 2.0' +depends 'kibana', '~> 1.4' depends 'java' depends 'nodejs', '~> 2.2'
Switch down to kibana 1.4
diff --git a/server/src/main/webapp/WEB-INF/rails/config/environment.rb b/server/src/main/webapp/WEB-INF/rails/config/environment.rb index abc1234..def5678 100644 --- a/server/src/main/webapp/WEB-INF/rails/config/environment.rb +++ b/server/src/main/webapp/WEB-INF/rails/config/environment.rb @@ -14,9 +14,6 @@ # limitations under the License. # -ENV['ADMIN_OAUTH_URL_PREFIX'] = "admin" -ENV['LOAD_OAUTH_SILENTLY'] = "yes" - # Load the Rails application. require_relative 'application'
Remove old dead env vars
diff --git a/test/integration/ubuntu12_04_test.rb b/test/integration/ubuntu12_04_test.rb index abc1234..def5678 100644 --- a/test/integration/ubuntu12_04_test.rb +++ b/test/integration/ubuntu12_04_test.rb @@ -9,10 +9,6 @@ "ami-9a873ff3" end - def prepare_command - "prepare" - end - include EmptyCook include Apache2Cook include EncryptedDataBag
Remove unnecessary integration test override
diff --git a/test/peakium/submission_form_test.rb b/test/peakium/submission_form_test.rb index abc1234..def5678 100644 --- a/test/peakium/submission_form_test.rb +++ b/test/peakium/submission_form_test.rb @@ -5,7 +5,7 @@ class SubmissionFormTest < Test::Unit::TestCase should "create should return a new submission form" do @mock.expects(:post).once.returns(test_response(test_submission_form)) - sf = Peakium::SubmissionForm.build('create_subscription') + sf = Peakium::SubmissionForm.build('create_subscription', {:customer => "test_customer"}) assert_equal "<html></html>", sf.html end end
Update test for submission form
diff --git a/lib/generators/reso/templates/create_import_results.rb b/lib/generators/reso/templates/create_import_results.rb index abc1234..def5678 100644 --- a/lib/generators/reso/templates/create_import_results.rb +++ b/lib/generators/reso/templates/create_import_results.rb @@ -5,9 +5,9 @@ t.datetime :source_data_modified t.datetime :start_time t.datetime :end_time - t.text :found_listing_keys - t.text :removed_listing_keys - t.text :snapshots + t.text :found_listing_keys, :limit => 4294967295 + t.text :removed_listing_keys, :limit => 4294967295 + t.text :snapshots, :limit => 4294967295 t.timestamps null: false end
Update found_listing_keys, removed_listing_keys and snapshots to longtext.
diff --git a/app/controllers/admin/poll/questions/answers/images_controller.rb b/app/controllers/admin/poll/questions/answers/images_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/poll/questions/answers/images_controller.rb +++ b/app/controllers/admin/poll/questions/answers/images_controller.rb @@ -7,11 +7,9 @@ end def new - @answer = ::Poll::Question::Answer.find(params[:answer_id]) end def create - @answer = ::Poll::Question::Answer.find(params[:answer_id]) @answer.attributes = images_params if @answer.save
Remove unnecessary code in poll images controller We're already loading the answer with a `before_action`.
diff --git a/zipping.gemspec b/zipping.gemspec index abc1234..def5678 100644 --- a/zipping.gemspec +++ b/zipping.gemspec @@ -10,7 +10,7 @@ spec.email = ["info@nekojarashi.com.com"] spec.description = "This gem is for compressing files as a zip and outputting to a stream (or a stream-like interface object). The output to a stream proceeds little by little, as files are compressed." spec.summary = "Compress files as a zip and output it to a stream." - spec.homepage = "http://www.nekojarashi.com" + spec.homepage = "https://github.com/nekojarashi/zipping" spec.license = "MIT" spec.files = `git ls-files`.split($/)
Update Homepage address to github
diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb index abc1234..def5678 100644 --- a/spec/models/category_spec.rb +++ b/spec/models/category_spec.rb @@ -17,9 +17,9 @@ it 'subtracts its subtotal from budget when deleted' do FactoryGirl.create(:expense, category: @category) - expect(@budget.current_expense).to eq(10.50) + expect(@budget.total_expense).to eq(10.50) @category.destroy - expect(@budget.current_expense).to eq(0) + expect(@budget.total_expense).to eq(0) end end @@ -31,6 +31,9 @@ end it 'destroys its expenses upon deletion' do + expense = FactoryGirl.create(:expense, category: @category) + @category.destroy + expect(Expense.all).to_not include(expense) end end
Add test regarding dependent relationship Test that expense is deleted after category is destroyed
diff --git a/spec/readme_examples_spec.rb b/spec/readme_examples_spec.rb index abc1234..def5678 100644 --- a/spec/readme_examples_spec.rb +++ b/spec/readme_examples_spec.rb @@ -14,32 +14,22 @@ RSpec.describe "README examples" do include_context "sequel persistence setup" - include_context "seed data setup" readme_contents = File.read("README.md") - - convenience_id_mappings = { - "2f0f791c-47cf-4a00-8676-e582075bcd65" => "users/1", - "9b75fe2b-d694-4b90-9137-6201d426dda2" => "posts/1", - "bd564cc0-b8f1-45e6-9287-1ae75878c665" => "posts/2", - "4af129d0-5b9f-473e-b35d-ae0125a4f79e" => "posts/3", - } code_samples = readme_contents .split("```ruby") .drop(1) .map { |s| s.split("```").first } - .map { |s| s.gsub(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/, convenience_id_mappings) } - code_samples.take(1).each do |code_sample| - it "executes" do - File.open("./example1.rb", "w") { |f| f.puts(code_sample) } - - begin - Module.new.module_eval(code_sample) - rescue => e - binding.pry - end + code_samples.each_with_index do |code_sample, i| + it "executes without error" do + begin + Module.new.module_eval(code_sample) + rescue => e + File.open("./example#{i}.rb", "w") { |f| f.puts(code_sample) } + binding.pry if ENV["DEBUG"] + end end end end
Tidy up example spec runner
diff --git a/spec/recipes/default_spec.rb b/spec/recipes/default_spec.rb index abc1234..def5678 100644 --- a/spec/recipes/default_spec.rb +++ b/spec/recipes/default_spec.rb @@ -0,0 +1,24 @@+require 'spec_helper.rb' + +describe 'pci::default' do + let(:attributes) { ::Chef::Node::VividMash.new } + let(:chef_run) do + ::ChefSpec::SoloRunner.new(platform: platform, version: platform_version) do |node| + node.normal = attributes + end.converge(described_recipe) + end + + { CentOS: '7.4.1708', Windows: '2016' }.each do |platform, platform_version| + context "on #{platform} #{platform_version}" do + let(:platform) { platform.to_s.downcase } + let(:platform_version) { platform_version } + + context 'with default attributes' do + it 'converges successfully' do + skip('Not supported on non-Windows machine.') if platform == :Windows && RUBY_PLATFORM !~ /mswin|mingw32|windows/ + chef_run + end + end + end + end +end
Add basic specs for the default recipe
diff --git a/traco.gemspec b/traco.gemspec index abc1234..def5678 100644 --- a/traco.gemspec +++ b/traco.gemspec @@ -19,6 +19,7 @@ s.add_development_dependency "sqlite3" + s.add_development_dependency "rake" s.add_development_dependency "rspec" s.add_development_dependency "guard" s.add_development_dependency "guard-rspec"
Add rake to gemspec for Travis.
diff --git a/envirorobots.gemspec b/envirorobots.gemspec index abc1234..def5678 100644 --- a/envirorobots.gemspec +++ b/envirorobots.gemspec @@ -18,8 +18,8 @@ s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md'] - s.add_dependency 'rack', '~> 2.0.6' - s.add_dependency 'rails', '~> 5' + s.add_dependency 'rack', '>= 2.0.6' + s.add_dependency 'rails', '>= 5' s.add_development_dependency 'ammeter' s.add_development_dependency 'brakeman' s.add_development_dependency 'codecov'
Allow newer versions of rails and rack
diff --git a/spec/helper.rb b/spec/helper.rb index abc1234..def5678 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -17,7 +17,7 @@ LogBuddy.init :logger => Log -port = ENV.fetch "GH_MONGODB_PORT", 27017 +port = ENV.fetch "BOXEN_MONGODB_PORT", 27017 connection = Mongo::MongoClient.new('127.0.0.1', port.to_i, :logger => Log) DB = connection.db('test')
Use boxen port over gh port.
diff --git a/cookbooks/wt_devicedataupdater/attributes/default.rb b/cookbooks/wt_devicedataupdater/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/wt_devicedataupdater/attributes/default.rb +++ b/cookbooks/wt_devicedataupdater/attributes/default.rb @@ -6,7 +6,7 @@ # Copyright 2012, Webtrends Inc. # -default['wt_devicedataupdater']['zip_file'] = "RoadRunner.zip" -default['wt_devicedataupdater']['build_url'] = "" +default['wt_devicedataupdater']['artifact'] = "DeviceDataUpdater.zip" +default['wt_devicedataupdater']['download_url'] = "" default['wt_devicedataupdater']['install_dir'] = "\\DeviceDataUpdater" default['wt_devicedataupdater']['log_dir'] = "\\logs"
Update attributes for device data updater
diff --git a/tasks/metrics/reek.rake b/tasks/metrics/reek.rake index abc1234..def5678 100644 --- a/tasks/metrics/reek.rake +++ b/tasks/metrics/reek.rake @@ -4,6 +4,6 @@ Reek::Rake::Task.new rescue LoadError task :reek do - abort "Reek is not available. In order to run reek, you must: gem install reek" + abort 'Reek is not available. In order to run reek, you must: gem install reek' end end
Change single quotes to double quotes in string not using variable interpolation
diff --git a/app/controllers/letsencrypt_plugin/application_controller.rb b/app/controllers/letsencrypt_plugin/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/letsencrypt_plugin/application_controller.rb +++ b/app/controllers/letsencrypt_plugin/application_controller.rb @@ -17,7 +17,7 @@ def get_challenge_response if (CONFIG[:challenge_dir_name]) - full_challenge_dir = File.join(Rails.root, CONFIG[:challenge_dir_name]); + full_challenge_dir = File.join(File.join(Rails.root, CONFIG[:challenge_dir_name], 'challenge'); @response = { :response => IO.read(full_challenge_dir) } else @response = Challenge.first
Return the challenge file contents.
diff --git a/plugins/system/check-ntp.rb b/plugins/system/check-ntp.rb index abc1234..def5678 100644 --- a/plugins/system/check-ntp.rb +++ b/plugins/system/check-ntp.rb @@ -0,0 +1,56 @@+#! /usr/bin/env ruby +# +# Check NTP Offset +# === +# +# DESCRIPTION: +# This plugin provides a method for checking the NTP offset. +# +# OUTPUT: +# plain-text +# +# PLATFORMS: +# all +# +# DEPENDENCIES: +# gem: sensu-plugin +# +# USAGE: +# ../check-ntp.rb +# +# NOTES: +# +# LICENSE: +# Copyright 2014 Yieldbot, Inc <devops@yieldbot.com> +# Released under the same terms as Sensu (the MIT license); see LICENSE +# for details. +# + +require 'rubygems' if RUBY_VERSION < '1.9.0' +require 'sensu-plugin/check/cli' + +class CheckNTP < Sensu::Plugin::Check::CLI + + option :warn, + short: '-w WARN', + proc: proc(&:to_i), + default: 10 + + option :crit, + short: '-c CRIT', + proc: proc(&:to_i), + default: 100 + + def run + begin + offset = `ntpq -c "rv 0 offset"`.split('=')[1].strip.to_f + rescue + unknown 'NTP command Failed' + end + + critical if offset >= config[:crit] || offset <= -config[:crit] + warning if offset >= config[:warn] || offset <= -config[:warn] + ok + + end +end
Add check for ntp offset
diff --git a/Typhoon.podspec b/Typhoon.podspec index abc1234..def5678 100644 --- a/Typhoon.podspec +++ b/Typhoon.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |spec| spec.name = 'Typhoon' - spec.version = '1.6.6' + spec.version = '2.0.0-beta' spec.license = 'Apache2.0' spec.summary = 'A dependency injection container for Objective-C. Light-weight, yet flexible and full-featured.' spec.homepage = 'http://www.typhoonframework.org' - spec.author = { 'Jasper Blues, Robert Gilliam & Contributors' => 'jasper@appsquick.ly' } - spec.source = { :git => 'https://github.com/typhoon-framework/Typhoon.git', :tag => spec.version.to_s, :submodules => true } + spec.author = { 'Jasper Blues, Robert Gilliam, Daniel Rodriíguez, Erik Sundin & Contributors' => 'jasper@appsquick.ly' } + spec.source = { :git => 'https://github.com/typhoon-framework/Typhoon.git', :commit => 'HEAD', :submodules => true } spec.ios.deployment_target = '5.0' spec.osx.deployment_target = '10.7'
Make the local podspec point to 'HEAD'
diff --git a/ruby/sieve.rb b/ruby/sieve.rb index abc1234..def5678 100644 --- a/ruby/sieve.rb +++ b/ruby/sieve.rb @@ -4,78 +4,64 @@ end def next - return @x += 1 + @x += 1 end end class Filter + attr_reader :number, :filter + def initialize(number, filter) @number = number @filter = filter end - def number - @number - end - - def filter - @filter - end - def accept(n) filter = self - loop do - if (n % filter.number) == 0 + while filter + if n % filter.number == 0 return false end - filter = filter.filter; - break if filter == nil + filter = filter.filter end - return true; + true end end class Primes def initialize(natural) @natural = natural - @filter = nil; + @filter = nil end def next - loop do + while true n = @natural.next - if (@filter == nil || @filter.accept(n)) + if @filter == nil || @filter.accept(n) @filter = Filter.new(n, @filter) - return n; + return n end end end end def fewthousands - natural = Natural.new - primes = Primes.new(natural) + natural = Natural.new + primes = Primes.new(natural) - start = Time.now - cnt = 0 - res = -1 - loop do - res = primes.next - cnt += 1 - if cnt % 1000 == 0 - puts "Computed #{cnt} primes in #{Time.now - start} s. Last one is #{res}." - res = "" - end - if cnt >= 5000 - break - end + start = Time.now + cnt = 0 + begin + res = primes.next + cnt += 1 + if cnt % 1000 == 0 + puts "Computed #{cnt} primes in #{Time.now - start} s. Last one is #{res}." end - Time.now - start + end while cnt < 5000 + Time.now - start end puts "Ready!" loop do - puts "Five thousand prime numbers in #{fewthousands} ms" + puts "Five thousand prime numbers in #{fewthousands} s" end - -
Make the Ruby benchmark more idiomatic
diff --git a/db/migrate/20131008165405_add_synchronization_id_to_data_import.rb b/db/migrate/20131008165405_add_synchronization_id_to_data_import.rb index abc1234..def5678 100644 --- a/db/migrate/20131008165405_add_synchronization_id_to_data_import.rb +++ b/db/migrate/20131008165405_add_synchronization_id_to_data_import.rb @@ -2,7 +2,7 @@ class AddSynchronizationIdToDataImport < Sequel::Migration def up - add_column :data_imports, :synchronization_id, :bigint + add_column :data_imports, :synchronization_id, String end def down
Fix type of synchronization_id in data_imports table
diff --git a/test/google_map_test.rb b/test/google_map_test.rb index abc1234..def5678 100644 --- a/test/google_map_test.rb +++ b/test/google_map_test.rb @@ -1,4 +1,6 @@ require File.dirname(__FILE__) + '/test_helper' + +GOOGLE_APPLICATION_ID = "ABQIAAAA3HdfrnxFAPWyY-aiJUxmqRTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ0KYLwBEKSM7F9gCevcsIf6WPuIQ" class GoogleMapTest < Test::Unit::TestCase # Replace this with your real tests. @@ -16,6 +18,7 @@ :lng => -122.318, :html => 'My House') assert_equal @map.markers.length, 1 + assert @map.to_html.include? "google_map_marker_1 = new GMarker(new GLatLng(47.6597, -122.318));" end end
Test generated HTML includes marker references
diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index abc1234..def5678 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -1,7 +1,6 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'tomlrb' -require 'minitest/spec' require 'minitest/autorun' require "minitest/reporters" Minitest::Reporters.use!
Remove circular dependency requirement in tests
diff --git a/lib/officer.rb b/lib/officer.rb index abc1234..def5678 100644 --- a/lib/officer.rb +++ b/lib/officer.rb @@ -7,7 +7,6 @@ require 'active_support' require 'eventmachine' require 'json' -require 'ruby-debug' # Application. require 'officer/log'
Remove dependency on ruby debug
diff --git a/config/initializers/monkeypatch_more_specific_params_cleaning.rb b/config/initializers/monkeypatch_more_specific_params_cleaning.rb index abc1234..def5678 100644 --- a/config/initializers/monkeypatch_more_specific_params_cleaning.rb +++ b/config/initializers/monkeypatch_more_specific_params_cleaning.rb @@ -0,0 +1,36 @@+# An overly-broad security check introduced in Rails turns this: +# +# {"abc":[]} +# +# into (effectively) this: +# +# {"abc":null} +# +# As you can imagine, this will break a lot things that expect arrays. See +# https://github.com/rails/rails/issues/8832. +# +# The monkeypatch here is due to Nathan Broadbent: +# https://gist.github.com/ndbroadbent/4758944 +module ActionDispatch + Request.class_eval do + + # Remove nils from the params hash + def deep_munge(hash) + hash.each do |k, v| + case v + when Array + if v.size > 0 && v.all?(&:nil?) + hash[k] = nil + next + end + v.grep(Hash) { |x| deep_munge(x) } + v.compact! + when Hash + deep_munge(v) + end + end + + hash + end + end +end
Patch over an overly-broad security fix in Rails. See monkeypatch comments for more information.
diff --git a/cookbooks/cumulus/test/cookbooks/cumulus-test/recipes/default.rb b/cookbooks/cumulus/test/cookbooks/cumulus-test/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/cumulus/test/cookbooks/cumulus-test/recipes/default.rb +++ b/cookbooks/cumulus/test/cookbooks/cumulus-test/recipes/default.rb @@ -1,5 +1,5 @@ # -# Cookbook Name:: cumulus-cl-ports-chef-test +# Cookbook Name:: cumulus-test # Recipe:: default # # Copyright 2015, Cumulus Networks @@ -21,19 +21,5 @@ mode '0755' end -# Invoke the providers -cumulus_ports 'speeds' do - speed_10g ['swp1'] - speed_40g ['swp3','swp5-10', 'swp12'] - speed_40g_div_4 ['swp15','swp16'] - speed_4_by_10g ['swp20-32'] -end - -cumulus_license 'test' do - source 'http://localhost/test.lic' -end - -cumulus_license 'test-with-force' do - source 'http://localhost/test.lic' - force true -end +include_recipe "cumulus-test::ports" +include_recipe "cumulus-test::license"
Split the license & ports provider invocations to seperate recipes
diff --git a/ratatool.rb b/ratatool.rb index abc1234..def5678 100644 --- a/ratatool.rb +++ b/ratatool.rb @@ -1,8 +1,8 @@ class Ratatool < Formula desc "Tool for random data sampling and generation" homepage "https://github.com/spotify/ratatool" - url "https://github.com/spotify/ratatool/releases/download/v0.3.10/ratatool-cli-0.3.10.tar.gz" - sha256 "9f2b5936fef2dd88822d96339e11c2621f0d827eef9c42fbd9ba0b9c9ce324d8" + url "https://github.com/spotify/ratatool/releases/download/v0.3.11/ratatool-cli-0.3.11.tar.gz" + sha256 "1067b6ee6794000932ef1f0dab756c1460e4b20cbf7ca785cca384a851664bc0" def install lib.install Dir["lib/*.jar"]
Update to latest Ratatool 0.3.11
diff --git a/lib/gems/pending/spec/util/mount/miq_generic_mount_session_spec.rb b/lib/gems/pending/spec/util/mount/miq_generic_mount_session_spec.rb index abc1234..def5678 100644 --- a/lib/gems/pending/spec/util/mount/miq_generic_mount_session_spec.rb +++ b/lib/gems/pending/spec/util/mount/miq_generic_mount_session_spec.rb @@ -5,8 +5,8 @@ context "#connect" do before do MiqGenericMountSession.stub(:raw_disconnect) - @s1 = MiqGenericMountSession.new({:uri => '/tmp/abc'}) - @s2 = MiqGenericMountSession.new({:uri => '/tmp/abc'}) + @s1 = MiqGenericMountSession.new(:uri => '/tmp/abc', :mount_point => 'tmp') + @s2 = MiqGenericMountSession.new(:uri => '/tmp/abc', :mount_point => 'tmp') @s1.logger = Logger.new("/dev/null") @s2.logger = Logger.new("/dev/null") @@ -18,9 +18,10 @@ end it "is unique" do - MiqGenericMountSession.should_receive(:base_mount_point).twice.and_return('/tmp') @s1.connect @s2.connect + + expect(@s1.mnt_point).to_not eq(@s2.mnt_point) end end end
Update spec, passing in a temp dir rather than stubbing. Verify that the mount points are actually different, don't rely on an exception in the code
diff --git a/spec/active_record_spec.rb b/spec/active_record_spec.rb index abc1234..def5678 100644 --- a/spec/active_record_spec.rb +++ b/spec/active_record_spec.rb @@ -0,0 +1,16 @@+require 'spec_helper' + +describe ActiveRecord::Base do + + let(:notification_status) { FactoryGirl.build(:notification_status) } + let(:notification_status2) { FactoryGirl.build(:notification_status) } + + it "generates correct Oracle Enchanced Bulk SQL" do + date = DateTime.now + sql = Notifiable::NotificationStatus.send(:oracle_bulk_insert_sql, + [{notification_id: notification_status.notification.id, device_token_id: notification_status.device_token.id, status: 0, created_at: date}, + {notification_id: notification_status2.notification.id, device_token_id: notification_status2.device_token.id, status: 0, created_at: date}]) + + sql.should eql "INSERT ALL INTO notifiable_statuses (created_at, device_token_id, notification_id, status) VALUES (#{ActiveRecord::Base.connection.quote(date)}, 1, 1, 0) INTO notifiable_statuses (created_at, device_token_id, notification_id, status) VALUES (#{ActiveRecord::Base.connection.quote(date)}, 2, 2, 0)" + end +end
Add active record spec to test bulk insert sql
diff --git a/lib/banzai/pipeline/single_line_pipeline.rb b/lib/banzai/pipeline/single_line_pipeline.rb index abc1234..def5678 100644 --- a/lib/banzai/pipeline/single_line_pipeline.rb +++ b/lib/banzai/pipeline/single_line_pipeline.rb @@ -3,7 +3,23 @@ module Banzai module Pipeline class SingleLinePipeline < GfmPipeline + def self.filters + @filters ||= [ + Filter::SanitizationFilter, + Filter::EmojiFilter, + Filter::AutolinkFilter, + Filter::ExternalLinkFilter, + + Filter::UserReferenceFilter, + Filter::IssueReferenceFilter, + Filter::ExternalIssueReferenceFilter, + Filter::MergeRequestReferenceFilter, + Filter::SnippetReferenceFilter, + Filter::CommitRangeReferenceFilter, + Filter::CommitReferenceFilter, + ] + end end end end
Define a limited set of filters for SingleLinePipeline Removes the following filters from its parent GfmPipeline: - SyntaxHighlightFilter - UploadLinkFilter - TableOfContentsFilter - LabelReferenceFilter - TaskListFilter Closes #1697
diff --git a/lib/eventbrite/rest/response/raise_error.rb b/lib/eventbrite/rest/response/raise_error.rb index abc1234..def5678 100644 --- a/lib/eventbrite/rest/response/raise_error.rb +++ b/lib/eventbrite/rest/response/raise_error.rb @@ -6,8 +6,10 @@ module Response class RaiseError < Faraday::Response::Middleware def on_complete(response) - if response[:body] && response[:body][:error] - error = Eventbrite::Error.from_response(response) + status_code = response.status + klass = Eventbrite::Error.errors[status_code] + if klass + error = klass.from_response(response) fail(error) end end
Raise errors based on status code
diff --git a/spec/models/cohort_spec.rb b/spec/models/cohort_spec.rb index abc1234..def5678 100644 --- a/spec/models/cohort_spec.rb +++ b/spec/models/cohort_spec.rb @@ -14,7 +14,7 @@ describe Cohort do describe '.initialize_cohorts' do - it 'should create cohorts from application.yml' do + it 'create cohorts from application.yml' do Cohort.destroy_all cohorts = Cohort.all expect(cohorts).to be_empty @@ -29,4 +29,10 @@ Cohort.initialize_cohorts end end + + describe '.default_cohort' do + it 'returns a cohort' do + expect(Cohort.default_cohort).to be_a(Cohort) + end + end end
Add spec to exercise Cohort.default_cohort
diff --git a/spec/rb/models/map_spec.rb b/spec/rb/models/map_spec.rb index abc1234..def5678 100644 --- a/spec/rb/models/map_spec.rb +++ b/spec/rb/models/map_spec.rb @@ -1,6 +1,15 @@ require './spec/rb/spec_helper.rb' describe Map do + it 'has many lines' do + type = Map.association_reflections[:lines][:type] + expect(type).to eq :one_to_many + end + + it 'whitelists mass-assignable columns' do + expect(Map.allowed_columns).to eq [:name, :center, :zoom_level] + end + describe '.remix' do it 'creates a copy of the map and lines' do map = create(:map)
Test associations and allowed columns for map model
diff --git a/lib/queueing_rabbit/extensions/retryable.rb b/lib/queueing_rabbit/extensions/retryable.rb index abc1234..def5678 100644 --- a/lib/queueing_rabbit/extensions/retryable.rb +++ b/lib/queueing_rabbit/extensions/retryable.rb @@ -5,12 +5,12 @@ module Retryable def retries - headers[:qr_retries].to_i + headers['qr_retries'].to_i end def retry_upto(max_retries) if retries < max_retries - updated_headers = headers.update(:qr_retries => retries + 1) + updated_headers = headers.update('qr_retries' => retries + 1) self.class.enqueue(payload, :headers => updated_headers) end end
Use strings for header names.
diff --git a/spec/world_command_spec.rb b/spec/world_command_spec.rb index abc1234..def5678 100644 --- a/spec/world_command_spec.rb +++ b/spec/world_command_spec.rb @@ -0,0 +1,67 @@+require_relative '../lib/world_command.rb' +require_relative '../lib/util.rb' +require_relative '../lib/Map/Map/map.rb' +require_relative '../lib/Entity/player.rb' + + +RSpec.describe do + + before(:all) do + @square = Map.new(name: "Square", + tiles: [ [ Tile.new, Tile.new ], + [ Tile.new, Tile.new ] ], + regen_location: Couple.new(0,0)) + + @player = Player.new(map: @square, + location: Couple.new(0, 0)) + end + + context "interpret command" do + + context "lowercase" do + it "should correctly move the player down" do + interpret_command("s", @player) + expect(@player.location).to eq Couple.new(1, 0) + end + + it "should correctly move the player right" do + interpret_command("e", @player) + expect(@player.location).to eq Couple.new(1, 1) + end + + it "should correctly move the player up" do + interpret_command("n", @player) + expect(@player.location).to eq Couple.new(0, 1) + end + + it "should correctly move the player left" do + interpret_command("w", @player) + expect(@player.location).to eq Couple.new(0, 0) + end + end + + context "case-insensitive" do + it "should correctly move the player down" do + interpret_command("S", @player) + expect(@player.location).to eq Couple.new(1, 0) + end + + it "should correctly move the player right" do + interpret_command("E", @player) + expect(@player.location).to eq Couple.new(1, 1) + end + + it "should correctly move the player up" do + interpret_command("N", @player) + expect(@player.location).to eq Couple.new(0, 1) + end + + it "should correctly move the player left" do + interpret_command("W", @player) + expect(@player.location).to eq Couple.new(0, 0) + end + end + + end + +end
Add some tests for interpret_command
diff --git a/lionel.gemspec b/lionel.gemspec index abc1234..def5678 100644 --- a/lionel.gemspec +++ b/lionel.gemspec @@ -8,8 +8,10 @@ gem.version = Lionel::VERSION gem.authors = ["Gabe Kopley"] gem.email = ["gabe@coshx.com"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} + gem.description = <<-EOF + Engine gems are convenient for versioning and packaging static assets. Lionel lets you use assets packaged as Engines without depending on Rails. + EOF + gem.summary = %q{Use assets packaged as Engines without Rails} gem.homepage = "" gem.license = "MIT"
Add description and summary to gemspec
diff --git a/api/app/serializers/spree/v2/storefront/taxon_serializer.rb b/api/app/serializers/spree/v2/storefront/taxon_serializer.rb index abc1234..def5678 100644 --- a/api/app/serializers/spree/v2/storefront/taxon_serializer.rb +++ b/api/app/serializers/spree/v2/storefront/taxon_serializer.rb @@ -4,7 +4,7 @@ class TaxonSerializer < BaseSerializer set_type :taxon - attributes :name, :pretty_name, :permalink, :seo_title, :meta_title, :meta_description, + attributes :name, :pretty_name, :permalink, :seo_title, :description, :meta_title, :meta_description, :meta_keywords, :left, :right, :position, :depth, :updated_at attribute :is_root, &:root?
Add missing attribute for taxon
diff --git a/airplay.gemspec b/airplay.gemspec index abc1234..def5678 100644 --- a/airplay.gemspec +++ b/airplay.gemspec @@ -7,7 +7,7 @@ s.email = ["yo@brunoaguirre.com"] s.homepage = "http://github.com/elcuervo/airplay" s.files = `git ls-files`.split("\n") - s.test_files = `git ls-files spec`.split("\n") + s.test_files = `git ls-files test`.split("\n") s.add_dependency("dnssd") s.add_dependency("net-http-persistent")
Fix test folder in gemspec
diff --git a/webapp/db/migrate/20120322122642_remove_disease_specific_flag_from_race_codes.rb b/webapp/db/migrate/20120322122642_remove_disease_specific_flag_from_race_codes.rb index abc1234..def5678 100644 --- a/webapp/db/migrate/20120322122642_remove_disease_specific_flag_from_race_codes.rb +++ b/webapp/db/migrate/20120322122642_remove_disease_specific_flag_from_race_codes.rb @@ -1,9 +1,9 @@ class RemoveDiseaseSpecificFlagFromRaceCodes < ActiveRecord::Migration def self.up - ExteranlCode.connection.execute "UPDATE external_codes SET disease_specific = NULL WHERE external_codes.code_name = 'race';" + ExternalCode.connection.execute "UPDATE external_codes SET disease_specific = NULL WHERE external_codes.code_name = 'race';" end def self.down - ExteranlCode.connection.execute "UPDATE external_codes SET disease_specific = true WHERE external_codes.code_name = 'race' AND external_codes.the_code IN ('AI_AN', 'CHINESE', 'JAPANESE', 'ASIAN_INDIAN', 'KOREAN', 'VIETNAMESE', 'FILIPINO', 'ASIAN_UNSPECIFIED', 'HAWAIIAN', 'SAMOAN', 'TONGAN', 'GUATEMALAN', 'OTHER_PAC_ISLAN', 'OTHER');" + ExternalCode.connection.execute "UPDATE external_codes SET disease_specific = true WHERE external_codes.code_name = 'race' AND external_codes.the_code IN ('AI_AN', 'CHINESE', 'JAPANESE', 'ASIAN_INDIAN', 'KOREAN', 'VIETNAMESE', 'FILIPINO', 'ASIAN_UNSPECIFIED', 'HAWAIIAN', 'SAMOAN', 'TONGAN', 'GUATEMALAN', 'OTHER_PAC_ISLAN', 'OTHER');" end end
Fix typo in db migration
diff --git a/spec/lib/chamber/commands/secure_spec.rb b/spec/lib/chamber/commands/secure_spec.rb index abc1234..def5678 100644 --- a/spec/lib/chamber/commands/secure_spec.rb +++ b/spec/lib/chamber/commands/secure_spec.rb @@ -1,5 +1,6 @@ require 'rspectacular' require 'chamber/commands/secure' +require 'fileutils' module Chamber module Commands @@ -11,6 +12,7 @@ encryption_key: rootpath + '../spec_key'} } it 'can return values formatted as environment variables' do + ::FileUtils.mkdir_p rootpath + 'settings' unless ::File.exist? rootpath + 'settings' ::File.open(settings_filename, 'w') do |file| file.write <<-HEREDOC test:
Fix failing spec when directory didn't exist before spec was run
diff --git a/app/controllers/swagger_ui_engine/application_controller.rb b/app/controllers/swagger_ui_engine/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/swagger_ui_engine/application_controller.rb +++ b/app/controllers/swagger_ui_engine/application_controller.rb @@ -5,13 +5,13 @@ protect_from_forgery with: :exception layout false - before_filter :authenticate_admin + before_action :authenticate_admin protected def authenticate_admin return unless basic_authentication_enabled? - + authenticate_or_request_with_http_basic do |username, password| username == admin_username && password == admin_password end
Use before_action for authenticating admin
diff --git a/app/models/availability.rb b/app/models/availability.rb index abc1234..def5678 100644 --- a/app/models/availability.rb +++ b/app/models/availability.rb @@ -1,7 +1,16 @@ class Availability < ActiveRecord::Base + # Constants + LOW_PREFERENCE = 1 + MED_PREFERENCE = 2 + HIGH_PREFERENCE = 3 + + # Relations belongs_to :user - validates :user_id, presence: true + # Validators + validates :user, presence: true + validates :preference_level, presence: true, numericality: { only_integer: true }, + inclusion: { in: LOW_PREFERENCE..HIGH_PREFERENCE } validates :start_time, presence: true, date: { before: :end_time } validates :end_time, presence: true, date: { after: :start_time } # TODO: Recurrence validator
Add preference_level AR validator to Availability Signed-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.com>
diff --git a/app/models/plant_sample.rb b/app/models/plant_sample.rb index abc1234..def5678 100644 --- a/app/models/plant_sample.rb +++ b/app/models/plant_sample.rb @@ -11,19 +11,18 @@ validates_numericality_of :percent_cover, only_integer: true, greater_than: 0, less_than_or_equal_to: 100 # source - https://www.lockyy.com/posts/rails-4/exporting-csv-files-in-rails - def self.to_csv(attributes = column_names, - bd_attr = biodiversity_report.column_names, - plant_attr = plant.column_names) - + def self.to_csv(plant_sample_attributes = column_names, + report_attributes = biodiversity_report.column_names, + plant_attributes = plant.column_names) CSV.generate do |csv| - header = ['Plot'] + plant_attr + bd_attr + attributes + header = ['Plot'] + plant_attributes + report_attributes + plant_sample_attributes csv.add_row header all.each do |sample| values = [] values << sample.biodiversity_report.plot.name - values += sample.plant.slice(*plant_attr).values - values += sample.biodiversity_report.slice(*bd_attr).values - values += sample.slice(*attributes).values + values += sample.plant.slice(*plant_attributes).values + values += sample.biodiversity_report.slice(*report_attributes).values + values += sample.slice(*plant_sample_attributes).values csv.add_row values end end
PlantSample: Expand parameter names for clarity.
diff --git a/timecop-console.gemspec b/timecop-console.gemspec index abc1234..def5678 100644 --- a/timecop-console.gemspec +++ b/timecop-console.gemspec @@ -2,8 +2,8 @@ require File.expand_path('../lib/timecop_console/version', __FILE__) Gem::Specification.new do |spec| - spec.add_dependency 'rails', '~> 3.1' - spec.add_dependency 'timecop', '~> 0.5' + spec.add_dependency "railties", '>= 3.1', '< 5.0' + spec.add_dependency 'timecop', '>= 0.5' spec.authors = ["John Trupiano"] spec.description = %q{TimecopConsole manipulates Time.now using Timecop gem.} spec.email = ['jtrupiano@gmail.com']
Update dependencies to allow Rails4 apps to use it
diff --git a/lib/tent-validator/validators/post_endpoint_validator.rb b/lib/tent-validator/validators/post_endpoint_validator.rb index abc1234..def5678 100644 --- a/lib/tent-validator/validators/post_endpoint_validator.rb +++ b/lib/tent-validator/validators/post_endpoint_validator.rb @@ -0,0 +1,92 @@+module TentValidator + class PostEndpointValidator < TentValidator::Spec + + require 'tent-validator/validators/support/post_generators' + class << self + include Support::PostGenerators + end + include Support::PostGenerators + + require 'tent-validator/validators/support/app_post_generators' + include Support::AppPostGenerators + + require 'tent-validator/validators/support/oauth' + include Support::OAuth + + create_post = lambda do |opts| + data = generate_status_post(opts[:public]) + res = clients(:app).post.create(data) + + res_validation = ApiValidator::Json.new(data).validate(res) + raise SetupFailure.new("Failed to create post with attachments! #{res.status}\n\t#{Yajl::Encoder.encode(res_validation[:diff])}\n\t#{res.body}") unless res_validation[:valid] + + TentD::Utils::Hash.symbolize_keys(res.body) + end + + create_post_version = lambda do |post, client| + data = generate_status_post(post[:permissions][:public]) + data[:version] = { :parents => [{:version => post[:version][:id] }] } + + set(:post_version, data) + + client.post.update(post[:entity], post[:id], data) + end + + context "when public post" do + setup do + set(:post, create_post.call(:public => true)) + end + + describe "PUT new post version" do + context "without auth" do + expect_response(:status => 403) do + create_post_version.call(get(:post), clients(:no_auth)) + end + end + + context "with auth" do + context "when unauthorized" do + authenticate_with_permissions(:write_post_types => []) + + expect_response(:status => 403) do + create_post_version.call(get(:post), get(:client)) + end + end + + context "when limited authorization" do + setup do + authenticate_with_permissions(:write_post_types => [get(:post)[:type]]) + end + + context '' do # workaround to ensure `expect_response`s in `setup` are called first + expect_response(:status => 200, :schema => :post) do + res = create_post_version.call(get(:post), get(:client)) + + expect_properties(get(:post_version).merge(:id => get(:post)[:id])) + + res + end + end + end + + context "when full authorization" do + setup do + set(:client, clients(:app)) + end + + expect_response(:status => 200, :schema => :post) do + res = create_post_version.call(get(:post), get(:client)) + + expect_properties(get(:post_version).merge(:id => get(:post)[:id])) + + res + end + end + end + end + end + + end + + TentValidator.validators << PostEndpointValidator +end
Add validations for creating post versions
diff --git a/cookbooks/wt_streamingmanagementservice/recipes/undeploy.rb b/cookbooks/wt_streamingmanagementservice/recipes/undeploy.rb index abc1234..def5678 100644 --- a/cookbooks/wt_streamingmanagementservice/recipes/undeploy.rb +++ b/cookbooks/wt_streamingmanagementservice/recipes/undeploy.rb @@ -9,6 +9,8 @@ log_dir = "#{node['wt_common']['log_dir_linux']}/streamingmanagementservice" install_dir = "#{node['wt_common']['install_dir_linux']}/streamingmanagementservice" +sv_dir = "/etc/sv/streamingmanagementservice" +service_dir = "/etc/service/streamingmanagementservice" runit_service "streamingmanagementservice" do action :disable @@ -28,4 +30,15 @@ directory install_dir do recursive true action :delete -end+end + +directory sv_dir do + recursive true + action :delete +end + +directory service_dir do + recursive true + action: delete +end +
Stabilize sms deployment. Eliminates service start returning (1) error. Former-commit-id: b8bb2ad41e65f970d60480355998ba7080b87712 [formerly 2ba817cc6f8bc426fc75f3fed72d3e1c3d49ba5f] [formerly 5a9f228817c40c0c69c7d65f5f458bd34b624275 [formerly f44ae839af7b47e245dbaf79f369544b03778f4f]] Former-commit-id: bb02e7b9a5ac93924e1f8b5aa4d6f0fbe649ab72 [formerly 5d509d06ed582db44bf95065ecbcd51ef0f26fa2] Former-commit-id: b1b4925e8030e4da849218866fa44c5b1af66ba4
diff --git a/tools/chrome_tracing.rb b/tools/chrome_tracing.rb index abc1234..def5678 100644 --- a/tools/chrome_tracing.rb +++ b/tools/chrome_tracing.rb @@ -33,10 +33,8 @@ File.open('trace.json', 'w') do |of| a = [] record.each do |name, st, ed, pc| - ts = ((st - start) * 1000000).to_i - dur = ((ed - st) * 1000000).to_i - ts = (st - start) * 1000 - dur = (ed - st) * 1000 + ts = (st - start) * 1000000 + dur = (ed - st) * 1000000 a << %Q({"cat":"BF","name":"#{name}","ts":#{ts},"dur":#{dur},"tid":1,"pid":1,"args":{"pc":#{pc}},"ph":"X"}) end of.puts("[#{a * ",\n"}]")
Fix the scale of chrome://tracing time
diff --git a/transam_funding.gemspec b/transam_funding.gemspec index abc1234..def5678 100644 --- a/transam_funding.gemspec +++ b/transam_funding.gemspec @@ -18,7 +18,7 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] - s.add_dependency 'rails', '>=4.1.9' + s.add_dependency 'rails', '~> 4.1.9' s.add_development_dependency "rspec-rails" s.add_development_dependency "factory_girl_rails"
Make the rails version in the gemspec more restrictive
diff --git a/lib/puppet/parser/functions/validate_ip_address_array.rb b/lib/puppet/parser/functions/validate_ip_address_array.rb index abc1234..def5678 100644 --- a/lib/puppet/parser/functions/validate_ip_address_array.rb +++ b/lib/puppet/parser/functions/validate_ip_address_array.rb @@ -0,0 +1,91 @@+# == Function: validate_ip_address_array +# +# Validates an array of IP addresses, raising a ParseError should one or more +# addresses fail. Validates both v4 and v6 IP addresses. +# +# === Examples +# +# The following values will pass: +# +# validate_ip_address_array(['127.0.0.1', '::1']) +# +# The following values will raise an error: +# +# validate_ip_address_array('127.0.0.1') +# validate_ip_address_array(['not-an-address']) +# +# === Authors +# +# Mario Finelli <mario@finel.li> +# +# === Copyright +# +# Copyright 2015 Mario Finelli +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +module Puppet::Parser::Functions + newfunction(:validate_ip_address_array, :doc => <<-ENDHEREDOC + Validates an array of IP addresses, raising a ParseError should one or + more addresses fail. Validates both v4 and v6 IP addresses. + + The following values will pass: + + validate_ip_address_array(['127.0.0.1', '::1']) + + The following values will raise an error: + + validate_ip_address_array('127.0.0.1') + validate_ip_address_array(['not-an-address']) + + ENDHEREDOC + + ) do |args| + + require 'ipaddr' + + # Make sure that we've got something to validate! + unless args.length > 0 + error_msg = 'validate_ip_address_array: wrong number of arguments ' + + "(#{args.length}; must be > 0)" + raise Puppet::ParseError, (error_msg) + end + + args.each do |arg| + # Raise an error if we don't have an array. + unless arg.is_a?(Array) + error_msg = "#{arg.inspect} is not an Array. It looks to be a " + + "#{arg.class}" + raise Puppet::ParseError, (error_msg) + end + + arg.each do |addr| + # Make sure that we were given a string. + unless addr.is_a?(String) + raise Puppet::ParseError, "#{addr.inspect} is not a string." + end + + error_msg = "#{addr.inspect} is not a valid IP address." + + # Raise an error if we don't get a valid IP address (v4 or v6). + begin + ip = IPAddr.new(addr) + raise Puppet::ParseError, error_msg unless ip.ipv4? or ip.ipv6? + rescue ArgumentError + raise Puppet::ParseError, error_msg + end + end + + end + end +end
Add new function to validate array of IP addresses
diff --git a/solidus_sale_pricing.gemspec b/solidus_sale_pricing.gemspec index abc1234..def5678 100644 --- a/solidus_sale_pricing.gemspec +++ b/solidus_sale_pricing.gemspec @@ -15,7 +15,7 @@ s.require_path = 'lib' s.requirements << 'none' - s.add_dependency 'solidus', '~> 1.0' + s.add_dependency 'solidus', ['>= 1.0', '< 3'] s.add_development_dependency 'rspec-rails','~> 3.2' s.add_development_dependency 'sqlite3'
Add support for solidus 2
diff --git a/lib/github_api_v3/client/feeds.rb b/lib/github_api_v3/client/feeds.rb index abc1234..def5678 100644 --- a/lib/github_api_v3/client/feeds.rb +++ b/lib/github_api_v3/client/feeds.rb @@ -3,7 +3,7 @@ # Methods for the Feeds API, which looks pretty much useless. # - # http://developer.github.com/v3/activity/feeds/ + # @see http://developer.github.com/v3/activity/feeds/ module Feeds # List feeds.
Add missing @see tag for yardoc.
diff --git a/lib/json_test_data/json_schema.rb b/lib/json_test_data/json_schema.rb index abc1234..def5678 100644 --- a/lib/json_test_data/json_schema.rb +++ b/lib/json_test_data/json_schema.rb @@ -7,7 +7,7 @@ end def generate_example - @schema.fetch(:type) == "object" ? generate_object(schema).to_json : generate_array(schema).to_json + generate(schema).to_json end private
Delete conditional and replace with recursive method call
diff --git a/sparql/remove_organization_data_retrievable_from_ares.ru b/sparql/remove_organization_data_retrievable_from_ares.ru index abc1234..def5678 100644 --- a/sparql/remove_organization_data_retrievable_from_ares.ru +++ b/sparql/remove_organization_data_retrievable_from_ares.ru @@ -0,0 +1,29 @@+PREFIX rov: <http://www.w3.org/ns/regorg#> +PREFIX schema: <http://schema.org/> +PREFIX skos: <http://www.w3.org/2004/02/skos/core#> + +DELETE { + ?organization ?p ?o . + ?o ?addressP ?addressO . +} +WHERE { + { + SELECT DISTINCT ?organization + WHERE { + ?organization a schema:Organization ; + rov:registration [ + skos:inScheme <http://linked.opendata.cz/resource/concept-scheme/CZ-ICO> ; + skos:notation [] + ] . + } + } + VALUES ?p { + schema:address + schema:legalName + } + ?organization ?p ?o . + OPTIONAL { + ?o a schema:PostalAddress ; + ?addressP ?addressO . + } +}
Remove organization data retrievable from ARES
diff --git a/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb b/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb index abc1234..def5678 100644 --- a/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +++ b/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb @@ -35,5 +35,9 @@ end end end + + if defined?(Test::Unit::AutoRunner) + Test::Unit::AutoRunner.need_auto_run = false + end rescue LoadError => ignore end
Disable test/unit autorun on modern test/unit versions Closes #404.
diff --git a/spec/chrome_manifest_spec.rb b/spec/chrome_manifest_spec.rb index abc1234..def5678 100644 --- a/spec/chrome_manifest_spec.rb +++ b/spec/chrome_manifest_spec.rb @@ -7,7 +7,7 @@ end it "has a path that is relative to the user" do - expect(manifest[:path]).to end_with "newlinehw_stream_shim" + expect(manifest[:path]).to end_with "newline_hw_stream_shim" expect(manifest[:path]).to include ENV["USER"] end
Correct test to expect new name for shim file.
diff --git a/recipes/_god.rb b/recipes/_god.rb index abc1234..def5678 100644 --- a/recipes/_god.rb +++ b/recipes/_god.rb @@ -41,6 +41,5 @@ # Start god service "god" do provider Chef::Provider::Service::Upstart - supports :status => true, :restart => true action [:enable, :start] end
Remove supports() call from chef recipe, because it is identical to defaults
diff --git a/spec/jobs/job_logger_spec.rb b/spec/jobs/job_logger_spec.rb index abc1234..def5678 100644 --- a/spec/jobs/job_logger_spec.rb +++ b/spec/jobs/job_logger_spec.rb @@ -2,17 +2,12 @@ describe JobLogger do describe '.logger' do - it 'passes the message to the Logger instance' do - job_logger = instance_double(::Logger) - allow(job_logger).to receive(:formatter=) - allow(job_logger).to receive(:info) + it "returns a Ruby's logger instance" do + expect(JobLogger.logger).to respond_to(:info) + end - worker_logger = instance_double(::Logger, clone: job_logger) - allow(Delayed::Worker).to receive(:logger) { worker_logger } - - JobLogger.logger.info('log message') - - expect(job_logger).to have_received(:info).with('log message') + it 'returns custom formatted logger instance' do + expect(JobLogger.logger.formatter).to be_instance_of(JobLogger::Formatter) end end
Make JobLogger spec more reliable This will hopefully fix our bild. I believe that the underlying issue is that the logger's test double gets leaked into other examples, as RSpec tells when running `spec/jobs/` specs. ``` 5) SubscriptionPlacementJob performing the job when unplaced proxy_orders exist processes placeable proxy_orders Failure/Error: JobLogger.logger.info("Placing Order for Proxy Order #{proxy_order.id}") #<InstanceDouble(Logger) (anonymous)> was originally created in one example but has leaked into another example and can no longer be used. rspec-mocks' doubles are designed to only last for one example, and you need to create a new one in each example you wish to use it for. # ./app/jobs/subscription_placement_job.rb:31:in `place_order_for' ``` Read more: https://relishapp.com/rspec/rspec-mocks/v/3-4/docs/basics/scope#doubles-cannot-be-reused-in-another-example For whatever reason the JobLogger keeps its `.logger` being stubbed after this spec.
diff --git a/spec/jobs/sentry_job_spec.rb b/spec/jobs/sentry_job_spec.rb index abc1234..def5678 100644 --- a/spec/jobs/sentry_job_spec.rb +++ b/spec/jobs/sentry_job_spec.rb @@ -4,6 +4,12 @@ require "json" describe SentryJob do + before do + Raven.configure do |config| + config.dsn = "https://fake@fake.ingest.sentry.io/fake" + end + end + it "gets created automatically" do expect(Delayed::Job.count).to eq(0) Raven.capture_message("Test")
11106: Fix sentry spec now that it's disabled for specs
diff --git a/spec/resque_matchers_spec.rb b/spec/resque_matchers_spec.rb index abc1234..def5678 100644 --- a/spec/resque_matchers_spec.rb +++ b/spec/resque_matchers_spec.rb @@ -0,0 +1,35 @@+require 'spec_helper' +require 'rspec/version' + +describe "Resque RSpec custom matchers" do + include Resqutils::Spec::ResqueHelpers + + context "have_job_queued" do + class BackgroundJob + @queue = :low + + def self.perform + end + end + + class Service + def expensive + Resque.enqueue(BackgroundJob) + end + end + + before do + clear_queue(BackgroundJob) + end + + it "asserts Resque job has been queued" do + Service.new.expensive + + if RSpec::Version::STRING.start_with?("2") + "low".should have_job_queued(class: BackgroundJob, args: []) + else + expect("low").to have_job_queued(class: BackgroundJob, args: []) + end + end + end +end
Add Resque RSpec custom matchers specs - Add spec for have_job_queued custom matcher - Assert a job has been queued - Require and use RSpec version constant to test multiple versions of RSpec against have_job_queued
diff --git a/scientificprotocols.gemspec b/scientificprotocols.gemspec index abc1234..def5678 100644 --- a/scientificprotocols.gemspec +++ b/scientificprotocols.gemspec @@ -8,7 +8,7 @@ spec.version = ScientificProtocols::VERSION spec.authors = ['David Iorns'] spec.email = ['david.iorns@gmail.com'] - spec.summary = %q{A Ruby wrapper for the Scientific Protocols API.} + spec.summary = %q{A Ruby wrapper for the Scientific Protocols API. https://www.scientificprotocols.org/api_v1} spec.homepage = 'https://www.scientificprotocols.org' spec.license = 'MIT' @@ -16,6 +16,8 @@ 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.required_ruby_version = '>= 2.0.0' spec.add_dependency 'faraday' spec.add_dependency 'activesupport'
Add Ruby dependency to gemspec
diff --git a/app/controllers/optional_modules/searches_controller.rb b/app/controllers/optional_modules/searches_controller.rb index abc1234..def5678 100644 --- a/app/controllers/optional_modules/searches_controller.rb +++ b/app/controllers/optional_modules/searches_controller.rb @@ -12,13 +12,8 @@ else @searches = Post.search(params[:term], params[:locale]) - if @blog_module.enabled? - @searches += Blog.search(params[:term], params[:locale]) - end - - if @event_module.enabled? - @searches += Event.search(params[:term], params[:locale]) - end + @searches += Blog.search(params[:term], params[:locale]) if @blog_module.enabled? + @searches += Event.search(params[:term], params[:locale]) if @event_module.enabled? @not_paginated_searches = @searches @searches = Kaminari.paginate_array(@searches).page(params[:page]).per(5)
Use single line for condition
diff --git a/fauxhai.gemspec b/fauxhai.gemspec index abc1234..def5678 100644 --- a/fauxhai.gemspec +++ b/fauxhai.gemspec @@ -9,7 +9,7 @@ spec.description = %q{Easily mock out ohai data} spec.summary = %q{Fauxhai provides an easy way to mock out your ohai data for testing with chefspec!} spec.homepage = 'https://github.com/customink/fauxhai' - s.license = 'MIT' + spec.license = 'MIT' spec.required_ruby_version = '>= 1.9'
Use correct block variable for license in gemspec
diff --git a/app/models/ems_refresh/save_inventory_physical_infra.rb b/app/models/ems_refresh/save_inventory_physical_infra.rb index abc1234..def5678 100644 --- a/app/models/ems_refresh/save_inventory_physical_infra.rb +++ b/app/models/ems_refresh/save_inventory_physical_infra.rb @@ -46,7 +46,7 @@ [] end - child_keys = [:computer_system] + child_keys = [:computer_system, :asset_details] save_inventory_multi(ems.physical_servers, hashes, deletes, [:ems_ref], child_keys) store_ids_for_new_records(ems.physical_servers, hashes, :ems_ref) end
Add symbol in save physical server method add a :asset_details child key in save_physical_server_inventory
diff --git a/ripcord.gemspec b/ripcord.gemspec index abc1234..def5678 100644 --- a/ripcord.gemspec +++ b/ripcord.gemspec @@ -18,7 +18,7 @@ spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.12" - spec.add_development_dependency "rake", "~> 12.3" + spec.add_development_dependency "rake", "~> 13.0" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "webmock" end
Update rake to version 13.0.0
diff --git a/rmodbus.gemspec b/rmodbus.gemspec index abc1234..def5678 100644 --- a/rmodbus.gemspec +++ b/rmodbus.gemspec @@ -5,7 +5,7 @@ s.author = 'A.Timin, J. Sanders' s.platform = Gem::Platform::RUBY s.summary = "RModBus - free implementation of protocol ModBus" - s.files = Dir['lib/**/*.rb','examples/*.rb','spec/*.rb'] + s.files = Dir['lib/**/*.rb','examples/*.rb','spec/*.rb','doc/*/*'] s.autorequire = "rmodbus" s.has_rdoc = true s.rdoc_options = ["--title", "RModBus", "--inline-source", "--main", "README"]
Add doc dir in gem
diff --git a/lib/data_mapper/finalizer/base_relation_mappers_finalizer.rb b/lib/data_mapper/finalizer/base_relation_mappers_finalizer.rb index abc1234..def5678 100644 --- a/lib/data_mapper/finalizer/base_relation_mappers_finalizer.rb +++ b/lib/data_mapper/finalizer/base_relation_mappers_finalizer.rb @@ -15,17 +15,7 @@ # @api private def finalize_mappers mappers.each do |mapper| - model = mapper.model - - next if mapper_registry[model] - - name = mapper.relation_name - relation = mapper.gateway_relation - keys = DependentRelationshipSet.new(model, mappers).target_keys - aliases = mapper.aliases.exclude(*keys) - - mapper.relations.new_node(name, relation, aliases) - + register_base_relation(mapper) mapper.finalize end end @@ -33,13 +23,26 @@ # @api private def finalize_relationships mappers.each do |mapper| - mapper.relationships.each do |relationship| - edge_builder.call(mapper.relations, mapper_registry, relationship) - end + register_relationships(mapper) end end + # @api private + def register_base_relation(mapper) + name = mapper.relation_name + relation = mapper.gateway_relation + keys = DependentRelationshipSet.new(mapper.model, mappers).target_keys + aliases = mapper.aliases.exclude(*keys) + + mapper.relations.new_node(name, relation, aliases) + end + + # @api private + def register_relationships(mapper) + mapper.relationships.each do |relationship| + edge_builder.call(mapper.relations, mapper_registry, relationship) + end + end end # class BaseRelationMapperFinalizer - end # class Finalizer end # module DataMapper
Split BaseRelationMappersFinalizer into smaller methods
diff --git a/HNDAppUpdateManager.podspec b/HNDAppUpdateManager.podspec index abc1234..def5678 100644 --- a/HNDAppUpdateManager.podspec +++ b/HNDAppUpdateManager.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "HNDAppUpdateManager" - s.version = "0.0.1" + s.version = "0.0.2" s.summary = "HNDAppUpdateManager" s.homepage = "" s.license = 'MIT' @@ -11,6 +11,7 @@ s.source_files = "Classes/**/*.{h,m}" + s.dependency 'AFNetworking' s.dependency 'AgnosticLogger' s.dependency 'Avenue' end
Update to have explicit afnetworking dependency
diff --git a/roles/unizar.rb b/roles/unizar.rb index abc1234..def5678 100644 --- a/roles/unizar.rb +++ b/roles/unizar.rb @@ -12,9 +12,6 @@ ) override_attributes( - :networking => { - :nameservers => ["155.210.12.9", "155.210.3.12"] - }, :ntp => { :servers => ["0.es.pool.ntp.org", "1.es.pool.ntp.org", "europe.pool.ntp.org"] }
Switch culebre to use cloudflare DNS
diff --git a/recipes/haxm.rb b/recipes/haxm.rb index abc1234..def5678 100644 --- a/recipes/haxm.rb +++ b/recipes/haxm.rb @@ -9,14 +9,20 @@ user node['sprout']['user'] end -sdk_path_prefix_command = Mixlib::ShellOut.new('brew --prefix android-sdk') -sdk_path_prefix_command.run_command -sdk_path_prefix = sdk_path_prefix_command.stdout.strip - include_recipe 'sprout-base::var_chef_cache' -link "#{Chef::Config[:file_cache_path]}/#{haxm_pkg}.dmg" do - to "#{sdk_path_prefix}/#{haxm_dmg_path}" # Symlink to cache dir so dmg_package can load the file +ruby_block 'link dmg into brew-installed android-sdk dir' do + block do + sdk_path_prefix_command = Mixlib::ShellOut.new('brew --prefix android-sdk') + sdk_path_prefix_command.run_command + sdk_path_prefix = sdk_path_prefix_command.stdout.strip + + sdk_dmg_link = ::File.join(sdk_path_prefix, haxm_dmg_path) + cached_dmg_path = ::File.join(Chef::Config[:file_cache_path], "#{haxm_pkg}.dmg") + + require 'fileutils' + FileUtils.ln_s(cached_dmg_path, sdk_dmg_link) # Symlink to cache dir so dmg_package can load the file + end end dmg_package haxm_pkg do
Move DMG linking into ruby_block - resolves #5
diff --git a/rb/lib/selenium/webdriver/chrome/profile.rb b/rb/lib/selenium/webdriver/chrome/profile.rb index abc1234..def5678 100644 --- a/rb/lib/selenium/webdriver/chrome/profile.rb +++ b/rb/lib/selenium/webdriver/chrome/profile.rb @@ -13,14 +13,11 @@ @model = verify_model(model) end - def layout_on_disk - dir = @model ? create_tmp_copy(@model) : Dir.mktmpdir("webdriver-chrome-profile") - FileReaper << dir - - write_prefs_to dir - - dir - end + # + # Set a preference in the profile. + # + # See http://codesearch.google.com/codesearch#OAMlx_jo-ck/src/chrome/common/pref_names.cc&exact_package=chromium + # def []=(key, value) parts = key.split(".") @@ -32,6 +29,17 @@ parts.inject(prefs) { |pr, k| pr.fetch(k) } end + def layout_on_disk + dir = @model ? create_tmp_copy(@model) : Dir.mktmpdir("webdriver-chrome-profile") + FileReaper << dir + + write_prefs_to dir + + dir + end + + private + def write_prefs_to(dir) prefs_file = prefs_file_for(dir) @@ -42,8 +50,6 @@ def prefs @prefs ||= read_model_prefs end - - private def read_model_prefs return {} unless @model
JariBakken: Add some docs to Chrome::Profile git-svn-id: aa1aa1384423cb28c2b1e29129bb3a91de1d9196@13146 07704840-8298-11de-bf8c-fd130f914ac9