diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/services/iiif_manifest.rb b/app/services/iiif_manifest.rb index abc1234..def5678 100644 --- a/app/services/iiif_manifest.rb +++ b/app/services/iiif_manifest.rb @@ -5,7 +5,6 @@ end def add_noid - return unless ark_url solr_hash["access_identifier_ssim"] = [noid] end @@ -24,6 +23,10 @@ end def noid - /.*\/(.*)/.match(ark_url)[1] + if ark_url + /.*\/(.*)/.match(ark_url)[1] + else + /.*\/(.*)\/manifest/.match(url)[1] + end end end
Support fallback when no rendering
diff --git a/lib/batch_api.rb b/lib/batch_api.rb index abc1234..def5678 100644 --- a/lib/batch_api.rb +++ b/lib/batch_api.rb @@ -5,7 +5,19 @@ require 'batch_api/middleware' module BatchApi + + # Public: access the main Batch API configuration object. + # + # Returns a BatchApi::Configuration instance def self.config @config ||= Configuration.new end + + # Public: are we in Rails? This partly exists just so that you + # can stub it in the tests. + # + # Returns true if Rails is a defined constant, false otherwise. + def rails? + defined?(Rails) + end end
Add rails? method in BatchApi
diff --git a/lib/consoleIO.rb b/lib/consoleIO.rb index abc1234..def5678 100644 --- a/lib/consoleIO.rb +++ b/lib/consoleIO.rb @@ -4,9 +4,9 @@ attr_reader :input attr_reader :output - def initialize(params = {}) - @input = params.fetch(:input, STDIN) - @output = params.fetch(:output, STDOUT) + def initialize(input: STDIN, output: STDOUT) + @input = input + @output = output end def clear_screen
Make consoleio class have named params
diff --git a/lib/hg/prompt.rb b/lib/hg/prompt.rb index abc1234..def5678 100644 --- a/lib/hg/prompt.rb +++ b/lib/hg/prompt.rb @@ -23,7 +23,7 @@ # Invoke a question type of prompt. # # @example - # prompt = TTY::Prompt.new + # prompt = Hg::Prompt.new # prompt.invoke_question(Question, "Your name? ") # # @return [String] @@ -39,18 +39,18 @@ # Ask a question. # # @example - # propmt = TTY::Prompt.new + # propmt = Hg::Prompt.new # prompt.ask("What is your name?") # # @param [String] message # The question to be asked. # - # @yieldparam [TTY::Prompt::Question] question + # @yieldparam [Hg::Prompt::Question] question # Further configure the question. # # @yield [question] # - # @return [TTY::Prompt::Question] + # @return [Hg::Prompt::Question] # # @api public def ask(message, *args, &block)
Update comments to refer to correct classes
diff --git a/test/serializer/dsl_test.rb b/test/serializer/dsl_test.rb index abc1234..def5678 100644 --- a/test/serializer/dsl_test.rb +++ b/test/serializer/dsl_test.rb @@ -4,7 +4,8 @@ class Serializer class TestDSL < Minitest::Test def setup - @user = User.new(name: "Carles Jove", email: "hola@carlus.cat") + @user = User.new(name: "Carles Jove", email: "hola@carlus.cat", + date_created: "2015-02-01") @serializer = Serializer.new(@user) end
Set a date_created in dls_test?
diff --git a/sidekiq-unique-jobs.gemspec b/sidekiq-unique-jobs.gemspec index abc1234..def5678 100644 --- a/sidekiq-unique-jobs.gemspec +++ b/sidekiq-unique-jobs.gemspec @@ -15,7 +15,7 @@ gem.require_paths = ["lib"] gem.version = SidekiqUniqueJobs::VERSION gem.add_dependency 'sidekiq', '>= 2.6' - gem.add_dependency 'mock_redis' + gem.add_development_dependency 'mock_redis' gem.add_development_dependency 'rspec', '~> 3.0.0.beta' gem.add_development_dependency 'rake' gem.add_development_dependency 'rspec-sidekiq'
Declare mock_redis as development dependency instead of runtime one
diff --git a/ext/rocksdb/extconf.rb b/ext/rocksdb/extconf.rb index abc1234..def5678 100644 --- a/ext/rocksdb/extconf.rb +++ b/ext/rocksdb/extconf.rb @@ -1,7 +1,9 @@ require "mkmf" dir_config('rocksdb') -RbConfig::CONFIG["CPP"] = "g++ -E -std=gnu++17" +cxx = RbConfig::CONFIG["CXX"] +RbConfig::CONFIG["CPP"] = "#{cxx} -E -std=gnu++17" +RbConfig::CONFIG["CC"] = "#{cxx} -std=gnu++17" DEBUG_BUILD = have_library('rocksdb_debug') || ENV["DEBUG_LEVEL"]
Fix build for MacOS on Ruby 3.1 Between Ruby 3.0 and 3.1 the behaviour of `have_library` has changed. Now it does not use `RbConfig::CONFIG['CPP']`, but `RbConfig::CONFIG['CC']`. To allow the extension to compile on MacOS, the latter needs to be adjusted as well. This also uses `RbConfig::CONFIG['CXX']` instead of hard-coded `g++`, as using `g++` caused me some troubles with unknown flags on MacOS as well (I have `gcc` installed along clang for _reasons_).
diff --git a/tools/fetch_ago_mappings.rb b/tools/fetch_ago_mappings.rb index abc1234..def5678 100644 --- a/tools/fetch_ago_mappings.rb +++ b/tools/fetch_ago_mappings.rb @@ -0,0 +1,74 @@+#!/usr/bin/env ruby -w +require 'csv' +require 'uri' +require 'net/http' +require 'pathname' + +class FetchAgoMappings + + def fetch + CSV.open(output_file, "w:utf-8") do |output_csv| + puts "Writing AGO mappings to #{output_file}" + output_csv << ['Old Url','New Url','Status'] + i = 0 + input_csv.sort_by {|row| row['Old Url']}.each do |row| + old_url = sanitize_url(row['Old Url']) + new_url = sanitize_url(row['New URL']) + new_row = if on_national_archives?(new_url) + [old_url, "", "410"] + else + [old_url, new_url, "301"] + end + validate_row!(new_row) + output_csv << new_row + i += 1 + end + puts "Wrote #{i} mappings" + end + end + + def on_national_archives?(url) + url.start_with? "http://webarchive.nationalarchives.gov.uk/" + end + + def validate_row!(row) + row[0..1].each do |url| + next if url.empty? + valid_url?(url) || raise("Invalid URL: '#{url}'") + end + end + + def valid_url?(url) + URI.parse(url) rescue false + end + + def sanitize_url(url) + url.gsub(" ", "%20") + end + + def csv_url + "https://docs.google.com/spreadsheet/pub?key=0AiP6zL-gKn64dFZ4UWJoeXR4eV9TTFk3SVl6VTQzQ2c&single=true&gid=0&output=csv" + end + + def output_file + Pathname.new(File.dirname(__FILE__)) + ".." + "data/mappings/ago.csv" + end + + private + + def input_csv + @input_csv ||= CSV.parse(do_request(csv_url).body.force_encoding("UTF-8"), headers: true) + end + + def do_request(url) + uri = URI.parse(url) + raise "url must be HTTP(S)" unless uri.is_a?(URI::HTTP) + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = (uri.is_a?(URI::HTTPS)) + response = http.request_get(uri.path + "?" + uri.query) + raise "Error - got response #{response.code}" unless response.is_a?(Net::HTTPOK) + response + end +end + +FetchAgoMappings.new.fetch
Add script for fetching AGO mappings from google doc
diff --git a/app/controllers/contentr/application_controller.rb b/app/controllers/contentr/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/contentr/application_controller.rb +++ b/app/controllers/contentr/application_controller.rb @@ -1,7 +1,7 @@ # coding: utf-8 module Contentr - class ApplicationController < ::ApplicationController + class ApplicationController < ActionController::Base before_filter do I18n.locale = params[:locale] || I18n.default_locale
Extend ActionController::Base instead of the ::ApplicationController
diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index abc1234..def5678 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -0,0 +1,32 @@+require 'rails_helper' + +feature "User management" do + scenario "has a user signup, login, logout cycle" do + visit new_user_path + expect{ + fill_in 'Email', with: "clifton@netscape.net" + fill_in 'Password', with: "bacon" + fill_in 'Password confirmation', with: "bacon" + click_button 'Create User' + }.to change(User, :count).by 1 + test_guy = User.all.last + expect(current_path).to eq user_path(test_guy) + expect(page).to have_content @user + + click_button "Log Out" + expect(page).to have_content 'Log In' + + fill_in 'Email', with: "bogus@bad.net" + click_button "Log In" + expect(page).to have_button'Log In' + end + + scenario "logs an existing user in" do + test_lady = User.create(email:"jane@example.com", password:"racecars") + visit login_path + fill_in 'Email', with: test_lady.email + fill_in 'Password', with: "racecars" + click_button "Log In" + expect(page).to have_button "Log Out" + end +end
Complete full user auth feature test. Conflicts: spec/features/users_spec.rb
diff --git a/common/constants.rb b/common/constants.rb index abc1234..def5678 100644 --- a/common/constants.rb +++ b/common/constants.rb @@ -3,6 +3,7 @@ module Constants # The API version # This follows Semantic Versioning (http://semver.org). + # When changing this, update API_CHANGE_LOG. MAJOR_VERSION = 0 MINOR_VERSION = 3 PATCH_VERSION = 0
Add request to update changelog.
diff --git a/spec/system/haproxy_spec.rb b/spec/system/haproxy_spec.rb index abc1234..def5678 100644 --- a/spec/system/haproxy_spec.rb +++ b/spec/system/haproxy_spec.rb @@ -9,17 +9,10 @@ RSpec.describe "haproxy" do - let(:service_name) { environment.bosh_manifest.property('rabbitmq-broker.service.name') } - - let(:service) do - Prof::MarketplaceService.new( - name: service_name, - plan: 'standard' - ) - end + let(:management_uri) { 'https://' + environment.bosh_manifest.property('rabbitmq-broker.rabbitmq.management_domain') } [0, 1].each do |job_index| - context "when the job rmq/#{job_index} is down", :pushes_cf_app do + context "when the job rmq/#{job_index} is down" do before(:all) do `bosh -n stop rmq #{job_index} --force` end @@ -28,18 +21,16 @@ `bosh -n start rmq #{job_index} --force` end - it "is still possible to read and write to a queue" do - cf.push_app_and_bind_with_service(test_app, service) do |app, _| - uri = URI("#{app.url}/services/rabbitmq/protocols/amqp091") + it 'I can still access the managment UI' do + uri = URI(management_uri) - http = Net::HTTP.new(uri.host, uri.port) - http.use_ssl = true - http.verify_mode = OpenSSL::SSL::VERIFY_NONE - res = http.request_get(uri.request_uri) + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_NONE + res = http.request_get(uri.request_uri) - expect(res.code).to eql("200") - expect(res.body).to include("amq.gen") - end + expect(res.code).to eql('200') + expect(res.body).to include('RabbitMQ Management') end end end
Fix haproxy tests so we don't have to push a CF app Signed-off-by: Carlo Colombo <38c9d5db9f6d6f5bb8266b73fcdee56a5a2fe4dc@pivotal.io>
diff --git a/backend/app/helpers/spree/admin/products_helper.rb b/backend/app/helpers/spree/admin/products_helper.rb index abc1234..def5678 100644 --- a/backend/app/helpers/spree/admin/products_helper.rb +++ b/backend/app/helpers/spree/admin/products_helper.rb @@ -1,30 +1,6 @@ module Spree module Admin module ProductsHelper - def taxon_options_for(product) - options = @taxons.map do |taxon| - selected = product.taxons.include?(taxon) - content_tag(:option, - value: taxon.id, - selected: ('selected' if selected)) do - (taxon.ancestors.pluck(:name) + [taxon.name]).join(" -> ") - end - end - safe_join(options) - end - - def option_types_options_for(product) - @option_types.map do |option_type| - selected = product.option_types.include?(option_type) - content_tag(:option, - value: option_type.id, - selected: ('selected' if selected)) do - option_type.name - end - end - safe_join(options) - end - def show_rebuild_vat_checkbox? Spree::TaxRate.included_in_price.exists? end
Remove unused admin products helpers This removes taxon_options_for and option_types_options_for, which haven't been used since 2012 (when their usage replaced with querying the API)
diff --git a/bullet.gemspec b/bullet.gemspec index abc1234..def5678 100644 --- a/bullet.gemspec +++ b/bullet.gemspec @@ -14,6 +14,10 @@ s.homepage = 'https://github.com/flyerhzm/bullet' s.summary = 'help to kill N+1 queries and unused eager loading.' s.description = 'help to kill N+1 queries and unused eager loading.' + s.metadata = { + 'changelog_uri' => 'https://github.com/flyerhzm/bullet/blob/master/CHANGELOG.md', + 'source_code_uri' => 'https://github.com/flyerhzm/bullet' + } s.license = 'MIT'
Add source and changelog urls to rubygems page
diff --git a/test/user_auth_test.rb b/test/user_auth_test.rb index abc1234..def5678 100644 --- a/test/user_auth_test.rb +++ b/test/user_auth_test.rb @@ -5,7 +5,7 @@ def test_autoload_paths autoload_paths = ActiveSupport::Dependencies.autoload_paths - DIRECTORIES_TO_LOAD_FROM.each do |dir| + USER_AUTH_DIRECTORIES_TO_LOAD_FROM.each do |dir| dir_fullpath = File.expand_path("#{File.dirname(__FILE__)}/../lib/app/#{dir}") assert(autoload_paths.include?(dir_fullpath), "'{dir_fullpath}' should be in autoload_paths") end
Fix UserAuthTest for the constant name test/user_auth_test.rb - Fix to use USER_AUTH_DIRECTORIES_TO_LOAD_FROM instead of DIRECTORIES_TO_LOAD_FROM.
diff --git a/cookbooks/wt_monitoring/recipes/email_heartbeat.rb b/cookbooks/wt_monitoring/recipes/email_heartbeat.rb index abc1234..def5678 100644 --- a/cookbooks/wt_monitoring/recipes/email_heartbeat.rb +++ b/cookbooks/wt_monitoring/recipes/email_heartbeat.rb @@ -0,0 +1,15 @@+# +# Cookbook Name:: wt_monitoring +# Recipe:: email_heartbeat +# +# Copyright 2012, Webtrends +# +# All rights reserved - Do Not Redistribute +# +# This recipe is used to send a heartbeat e-mail to the admin e-mail address every 4 hours +# + +cron "email_heartbeat" do + hour "*/6" + command "echo \"At the tone the time will be $(date \\+\\%k:\\%M` on $(date \\+\\%Y-\\%m-\\%d)\" | /bin/mail -s \"Nagios 4hr Heartbeat - $(date \\+\\%k:\\%M)\" #{node['wt_common']['admin_email']}" +end
Create a 4 hour heartbeat e-mail recipe in wt_monitoring that goes to the admin_email in wt_common Former-commit-id: b0d2ac99aaf1b147d689b37205ec0b4467340c2e [formerly acd53badb692d131427c04eda2f0e3ad4ff503dc] [formerly ac69e488174a0f954bd1789ac6562e4055555fde [formerly bba87f7ee63505ca3ab8013414652838acf02b5c [formerly 710b309e049f64a32c38e14e24b5f6d6becca644]]] Former-commit-id: f6962f7a3a0e19d81ffc04ad86deca7077e79f2c [formerly 4e0cf1137bb4ec23069fc21e13f930bdb2cb9eaf] Former-commit-id: be0f0cbf69e3263674b9fc5a745ac9c3a56e2122 Former-commit-id: 53cc7476b0a58016ff203dcd4f15240961f5f59b
diff --git a/guard-cucumber.gemspec b/guard-cucumber.gemspec index abc1234..def5678 100644 --- a/guard-cucumber.gemspec +++ b/guard-cucumber.gemspec @@ -18,9 +18,9 @@ s.add_dependency 'guard', '>= 0.8.3' s.add_dependency 'cucumber', '>= 1.2.0' - s.add_development_dependency 'bundler', '~> 1.0' - s.add_development_dependency 'rspec', '~> 2.8' - s.add_development_dependency 'guard-rspec', '~> 0.6' + s.add_development_dependency 'bundler' + s.add_development_dependency 'rspec' + s.add_development_dependency 'guard-rspec' s.add_development_dependency 'yard' s.add_development_dependency 'redcarpet'
Remove explicit dev version dependency.
diff --git a/examples/async_helper.rb b/examples/async_helper.rb index abc1234..def5678 100644 --- a/examples/async_helper.rb +++ b/examples/async_helper.rb @@ -0,0 +1,24 @@+# If you want to just call a method on an object in the background, +# we can easily add that functionality to Resque. + +# Here's our ActiveRecord class +class Repository < ActiveRecord::Base + # This will be called by a worker when a job needs to be processed + def self.perform(id, method, *args) + find(id).send(method, *args) + end + + # We can pass this any Repository instance method that we want to + # run later. + def async(method, *args) + Resque.enqueue(Repository, method, *args) + end +end + +# Now we can call any method and have it execute later: + +@repo.async(:update_disk_usage) + +# or + +@repo.async(:update_network_source_id, 34)
Add an example which shows how to implement something like DJ's `send_later`
diff --git a/db/migrate/050_add_user_index_to_diary_comments.rb b/db/migrate/050_add_user_index_to_diary_comments.rb index abc1234..def5678 100644 --- a/db/migrate/050_add_user_index_to_diary_comments.rb +++ b/db/migrate/050_add_user_index_to_diary_comments.rb @@ -0,0 +1,9 @@+class AddUserIndexToDiaryComments < ActiveRecord::Migration + def self.up + add_index :diary_comments, [:user_id, :created_at], :name => "diary_comment_user_id_created_at_index" + end + + def self.down + remove_index :diary_comments, :name => "diary_comment_user_id_created_at_index" + end +end
Add a user index to diary comments
diff --git a/Casks/hopper-disassembler.rb b/Casks/hopper-disassembler.rb index abc1234..def5678 100644 --- a/Casks/hopper-disassembler.rb +++ b/Casks/hopper-disassembler.rb @@ -1,10 +1,10 @@ cask :v1 => 'hopper-disassembler' do - version '3.10.8.1' - sha256 '20cfb6d8da01af0cbcd645ccde02e30c88515342873da19d2d25c533f85661d8' + version '3.10.9' + sha256 'ed4aaad468b0bd8823c5ec6e68798aad69da4eac02c55222eca50441e7b615f3' url "http://www.hopperapp.com/HopperWeb/downloads/Hopper-#{version}.zip" appcast 'http://www.hopperapp.com/HopperWeb/appcast_v3.php', - :sha256 => '5a8ac973e81200e800af90a66892451a480538f6a37c4153cdecb0e00ddfad42' + :sha256 => '7fef169456987610e7e3c533d8629cfb29cfa38f442cbdd2401c8ac7acd0edd5' name 'Hopper' name 'Hopper Disassembler' homepage 'http://www.hopperapp.com/'
Update Hopper, Hopper Disassembler to 3.10.9
diff --git a/em-hiredis.gemspec b/em-hiredis.gemspec index abc1234..def5678 100644 --- a/em-hiredis.gemspec +++ b/em-hiredis.gemspec @@ -12,7 +12,7 @@ s.summary = %q{Eventmachine redis client} s.description = %q{Eventmachine redis client using hiredis native parser} - s.add_dependency 'hiredis', '~> 0.3.0' + s.add_dependency 'hiredis', '~> 0.4.0' s.add_development_dependency 'em-spec', '~> 0.2.5' s.add_development_dependency 'rspec', '~> 2.6.0'
Update hiredis dependency to 0.4.x
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -3,11 +3,11 @@ describe BlacklightCornellRequests::RequestController, :type => :controller do - describe "GET /" do + describe "GET request" do - it "renders the :index view" do - get :request, :id => 123 - response.should render_template :index + it "renders the default view if no target is specified" do + get :magic_request, { :id => 123, :use_route => :blacklight_cornell_requests } + response.should render_template :default end end
Add first working controller rspec test.
diff --git a/spec/lib/organicat/organization_dsl_spec.rb b/spec/lib/organicat/organization_dsl_spec.rb index abc1234..def5678 100644 --- a/spec/lib/organicat/organization_dsl_spec.rb +++ b/spec/lib/organicat/organization_dsl_spec.rb @@ -18,6 +18,7 @@ dsl.organizations.first end + its(:name) { is_expected.to eq "Developer" } its(:members) { is_expected.to eql %w(hoge fuga piyo) } end end
Add spec for organization name
diff --git a/config/boot.rb b/config/boot.rb index abc1234..def5678 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
Replace deprecated File.exists? method with File.exist?
diff --git a/_plugins/md_to_html.rb b/_plugins/md_to_html.rb index abc1234..def5678 100644 --- a/_plugins/md_to_html.rb +++ b/_plugins/md_to_html.rb @@ -1,4 +1,5 @@ require_relative '../_config' +require 'redcloth' module Jekyll module MarkdownFilter
Add RedCloth req to plugin
diff --git a/app/controllers/quotes_controller.rb b/app/controllers/quotes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/quotes_controller.rb +++ b/app/controllers/quotes_controller.rb @@ -45,6 +45,6 @@ end def language - @quotes = Quote.where(language: params[:language]) + @quotes = Quote.where(language: params[:language]).order('created_at DESC') end end
Make language page lists by recent created order
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index abc1234..def5678 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,12 +1,10 @@ class SearchController < ApplicationController - - skip_before_filter :load_project - before_filter :load_project_search, :only => :results + before_filter :permission_to_search, :only => :results - + def results @search = params[:search] - + unless @search.blank? @comments = Comment.search @search, :retry_stale => true, :order => 'created_at DESC', @@ -16,11 +14,7 @@ end protected - - def load_project_search - @current_project = Project.find_by_permalink(params[:project_id]) if params[:project_id] - end - + def permission_to_search unless user_can_search? or (@current_project and project_owner.can_search?) flash[:notice] = "Search is disabled"
Revert before_filter tampering in SearchController These "fixes" are no longer necessary and they broke some permissions features of searching across all projects. This reverts commits: - 04a7f9b8358a5c053c4b76a91993e920f820d5e6 - 04a5479a4291a39801d6bfd05d8cd09ece361e74
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index abc1234..def5678 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -16,7 +16,7 @@ s.size 25 s.query do |query| - query.string @query + query.string @query, default_operator: 'AND' end s.sort { by :_score }
Change default search operator from OR to AND.
diff --git a/app/models/refresh_feed_job_state.rb b/app/models/refresh_feed_job_state.rb index abc1234..def5678 100644 --- a/app/models/refresh_feed_job_state.rb +++ b/app/models/refresh_feed_job_state.rb @@ -33,7 +33,7 @@ # Update the refresh_feed_jobs_updated_at attribute of the associated user with the current datetime. def touch_refresh_feed_job_states - user.update refresh_feed_jobs_updated_at: Time.zone.now + user.update refresh_feed_jobs_updated_at: Time.zone.now if user.present? end ##
Fix bug: update User instance from RefreshFeedJobState AR callback only if user exists. When RefreshFeedWorker detects that the passed user does not exist, it deletes the RefreshFeedJobState from the database before exiting. This invokes the after_destroy callback of the RefreshFeedJobState model, which tries to update the refresh_feed_jobs_updated_at attribute of the associated User. The bug was that, in this particular case, the User instance does not exist (the user_id attribute is set to null), which raised an error (because the update method was invoked on a nil object). The fix is, in the callback, to check that the User instance exists before attempting to update it.
diff --git a/lib/assorted/scopes.rb b/lib/assorted/scopes.rb index abc1234..def5678 100644 --- a/lib/assorted/scopes.rb +++ b/lib/assorted/scopes.rb @@ -20,7 +20,7 @@ def sanitized_order(column, direction) if attribute_names.include?(column.to_s) - order("#{column} #{direction}") + order("#{table_name}.#{column} #{direction}") else raise ActiveRecord::StatementInvalid, "Unknown column #{column}" end
Include table name to prevent ambiguous queries
diff --git a/lib/high_roller/cli.rb b/lib/high_roller/cli.rb index abc1234..def5678 100644 --- a/lib/high_roller/cli.rb +++ b/lib/high_roller/cli.rb @@ -1,6 +1,12 @@+require 'trollop' + module HighRoller::CLI autoload :REPL, 'high_roller/cli/repl' autoload :Single, 'high_roller/cli/single' + + def self.run! + + end def self.humanize_number num raise "Not a number: #{num}" if num.to_s =~ /[^\d]/
Move bin logic to CLI
diff --git a/lib/microspec/raise.rb b/lib/microspec/raise.rb index abc1234..def5678 100644 --- a/lib/microspec/raise.rb +++ b/lib/microspec/raise.rb @@ -2,6 +2,20 @@ module Microspec module Raise + module Helper + def self.exception(expected: nil, actual: nil, message: nil) + if actual.nil? + Flunked.new 'missing exception', expected: expected, actual: actual + elsif not actual.is_a? expected.class + Flunked.new 'unexpected exception', expected: expected, actual: actual + elsif message.is_a? String and not actual.message == message + Flunked.new 'unexpected exception message', expected: expected, actual: actual + elsif message.is_a? Regexp and not actual.message =~ message + Flunked.new 'unexpected exception message', expected: expected, actual: actual + end + end + end + module Method def raises(expected = Exception, message = nil) expected = expected.new message if expected.is_a? Class @@ -10,15 +24,7 @@ rescue Exception => actual ensure - exception = if actual.nil? - Flunked.new 'missing exception', expected: expected, actual: actual - elsif not actual.is_a? expected.class - Flunked.new 'unexpected exception', expected: expected, actual: actual - elsif message.is_a? String and not actual.message == message - Flunked.new 'unexpected exception message', expected: expected, actual: actual - elsif message.is_a? Regexp and not actual.message =~ message - Flunked.new 'unexpected exception message', expected: expected, actual: actual - end + exception = Helper.exception expected: expected, actual: actual, message: message raise exception if exception end
Move exception generation to helper module
diff --git a/lib/nexmo/signature.rb b/lib/nexmo/signature.rb index abc1234..def5678 100644 --- a/lib/nexmo/signature.rb +++ b/lib/nexmo/signature.rb @@ -6,7 +6,7 @@ def self.check(params, secret) params = params.dup - signature = params.delete(:sig) + signature = params.delete('sig') ::JWT.secure_compare(signature, digest(params, secret)) end
Fix Nexmo::Signature.check using symbol key instead of string key
diff --git a/app/models/category.rb b/app/models/category.rb index abc1234..def5678 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -17,7 +17,12 @@ items.sum("current_quantity * value") else items.includes(:versions).inject(0) do |sum, item| - sum + (item.total_value(at: at) || 0) + total = item.total_value(at: at) + if total.present? + sum + total + else + sum + end end end end
Use clearer conditionals for skipping item total_values that are nil
diff --git a/enum_test.rb b/enum_test.rb index abc1234..def5678 100644 --- a/enum_test.rb +++ b/enum_test.rb @@ -0,0 +1,14 @@+clock = Enumerator.new { |y| loop { y << Time.now.to_f } } +const = Enumerator.new { |y| loop { y << 1 } } +limited = (0..10).to_enum + +enums = [clock, const, limited] +loop do + begin + nexts = enums.map { |e| e.next } + puts nexts.inspect + sleep 1 + rescue StopIteration + break + end +end
Test out enumerations. Looks like no laziness in 1.9.3
diff --git a/app/models/voteable.rb b/app/models/voteable.rb index abc1234..def5678 100644 --- a/app/models/voteable.rb +++ b/app/models/voteable.rb @@ -7,6 +7,29 @@ def upvote(user) @_vote = find_vote(user) @_vote.value = true + end + + def parent_question_id + case Module.get_const(self.get_type) + when Question + return self.id + when Answer + return self.question_id + when Comment + return comment_parent_question_id + end + end + + def comment_parent_question_id + comment_parent_class = Module.const_get(self.commentable_type) + comment_parent_id = self.commentable_id + comment_parent = comment_parent_class.find(comment_parent_id) + case comment_parent_class + when Question + return comment_parent_id + when Answer + return comment_parent.parent_question_id + end end def get_type @@ -19,4 +42,6 @@ voteable_id: self.id) end + + end
Define method to return Voteable object's id
diff --git a/coroutine.rb b/coroutine.rb index abc1234..def5678 100644 --- a/coroutine.rb +++ b/coroutine.rb @@ -1,4 +1,12 @@ require "continuation" + +# For some reason calling Fiber.current prevents a "coroutine.rb:25:in +# `call': continuation called across fiber (RuntimeError)" which +# started happening after switching Evaluator from StringIO to +# String#each_char. + +require "fiber" +Fiber.current class Coroutine def initialize(&block)
Add bogus call to Fiber.current as a hack.
diff --git a/activerecord/test/cases/log_subscriber_test.rb b/activerecord/test/cases/log_subscriber_test.rb index abc1234..def5678 100644 --- a/activerecord/test/cases/log_subscriber_test.rb +++ b/activerecord/test/cases/log_subscriber_test.rb @@ -41,4 +41,21 @@ assert_match(/CACHE/, @logger.logged(:debug).last) assert_match(/SELECT .*?FROM .?developers.?/i, @logger.logged(:debug).last) end + + def test_basic_query_doesnt_log_when_level_is_not_debug + @logger.debugging = false + Developer.all + wait + assert_equal 0, @logger.logged(:debug).size + end + + def test_cached_queries_doesnt_log_when_level_is_not_debug + @logger.debugging = false + ActiveRecord::Base.cache do + Developer.all + Developer.all + end + wait + assert_equal 0, @logger.logged(:debug).size + end end
Test added, we shouldn't log sql calls when logger is not on debug? mode
diff --git a/souschef.gemspec b/souschef.gemspec index abc1234..def5678 100644 --- a/souschef.gemspec +++ b/souschef.gemspec @@ -22,4 +22,11 @@ spec.add_development_dependency "rake" spec.add_dependency 'ruth' spec.add_dependency 'colorize' + spec.add_dependency 'chef' + spec.add_dependency 'berkshelf' + spec.add_dependency 'test-kitchen' + spec.add_dependency 'rubocop' + spec.add_dependency 'foodcritic' + spec.add_dependency 'chefspec', '~> 4' + spec.add_dependency 'serverspec', '~> 3' end
Add more Chef related dependencies
diff --git a/souschef.gemspec b/souschef.gemspec index abc1234..def5678 100644 --- a/souschef.gemspec +++ b/souschef.gemspec @@ -20,5 +20,6 @@ spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" + spec.add_dependency 'ruth' spec.add_dependency 'colorize' end
Add Ruth gem for Gemfile generation
diff --git a/test/server_test.rb b/test/server_test.rb index abc1234..def5678 100644 --- a/test/server_test.rb +++ b/test/server_test.rb @@ -1,17 +1,21 @@ require File.dirname(__FILE__) + '/helper' -class Rack::Handler::Mock - extend Test::Unit::Assertions +module Rack::Handler + class Mock + extend Test::Unit::Assertions - def self.run(app, options={}) - assert(app < Sinatra::Base) - assert_equal 9001, options[:Port] - assert_equal 'foo.local', options[:Host] - yield new + def self.run(app, options={}) + assert(app < Sinatra::Base) + assert_equal 9001, options[:Port] + assert_equal 'foo.local', options[:Host] + yield new + end + + def stop + end end - def stop - end + register 'mock', 'Rack::Handler::Mock' end class ServerTest < Test::Unit::TestCase
Use rack's new handler registration stuff to fix some failing specs
diff --git a/MDCSwipeToChoose.podspec b/MDCSwipeToChoose.podspec index abc1234..def5678 100644 --- a/MDCSwipeToChoose.podspec +++ b/MDCSwipeToChoose.podspec @@ -5,7 +5,7 @@ s.homepage = 'https://github.com/modocache/MDCSwipeToChoose' s.license = 'MIT' s.author = { 'modocache' => 'modocache@gmail.com' } - s.source = { git: 'https://github.com/modocache/MDCSwipeToChoose.git', tag: "v#{s.version}" } + s.source = { :git => 'https://github.com/modocache/MDCSwipeToChoose.git', :tag => "v#{s.version}" } s.source_files = 'MDCSwipeToChoose/**/*.{h,m}' s.public_header_files = 'MDCSwipeToChoose/Public/**/*.{h,m}' s.requires_arc = true
Use old Ruby syntax in podspec.
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,8 +1,8 @@ require 'minitest/autorun' -begin require 'ruby-debug'; rescue; end -begin require 'redgreen' ; rescue; end -begin require 'phocus' ; rescue; end +begin require 'ruby-debug'; rescue LoadError; end +begin require 'redgreen' ; rescue LoadError; end +begin require 'phocus' ; rescue LoadError; end require 'lib/harmony'
Fix requiring of optional test deps
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,4 @@+$: << 'lib' gem 'minitest' require 'minitest/spec'
Add lib to the path in the test helper
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,8 +1,14 @@ require 'simplecov' -SimpleCov.start +require 'coveralls' -require 'coveralls' -Coveralls.wear! +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + Coveralls::SimpleCov::Formatter, + SimpleCov::Formatter::HTMLFormatter +] + +SimpleCov.start do + add_filter 'test' +end $:.unshift(File.expand_path(File.dirname(__FILE__) + '../../lib/'))
Update configuration for SimpleCov and Coveralls
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.session_store :cookie_store, key: '_echo_for_trello_session' +Rails.application.config.session_store :cookie_store, key: '_echo_for_trello_session', expire_after: 2.weeks
Expire session cookie after two weeks
diff --git a/lib/generators/georgia/install/templates/db/migrate/create_georgia_messages.rb b/lib/generators/georgia/install/templates/db/migrate/create_georgia_messages.rb index abc1234..def5678 100644 --- a/lib/generators/georgia/install/templates/db/migrate/create_georgia_messages.rb +++ b/lib/generators/georgia/install/templates/db/migrate/create_georgia_messages.rb @@ -8,6 +8,7 @@ t.string :subject t.string :attachment t.text :message + t.boolean :spam, default: false t.timestamps end end
Add spam column to messages
diff --git a/environment.rb b/environment.rb index abc1234..def5678 100644 --- a/environment.rb +++ b/environment.rb @@ -14,7 +14,7 @@ configure do # load models - Dir.glob("#{File.dirname(__FILE__)}/lib/models/*.rb") { |lib| require lib } + Dir.glob("#{File.dirname(__FILE__)}/lib/models/*.rb").sort.each { |lib| require lib } end configure(:production, :development) do
Fix dir.glob sorting across platforms. On some OSes, the results of ````Dir.glob```` will not be sorted alphabetically, this makes it consistent across different platforms.
diff --git a/Quick.podspec b/Quick.podspec index abc1234..def5678 100644 --- a/Quick.podspec +++ b/Quick.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Quick" - s.version = "0.4.0" + s.version = "0.5.0" s.summary = "The Swift (and Objective-C) testing framework." s.description = <<-DESC
Bump version to 0.5.0 in podspec
diff --git a/app/models/ansible/runner.rb b/app/models/ansible/runner.rb index abc1234..def5678 100644 --- a/app/models/ansible/runner.rb +++ b/app/models/ansible/runner.rb @@ -0,0 +1,27 @@+module Ansible + class Runner + def self.run(env_vars, extra_vars, playbook_path) + run_via_cli(env_vars, extra_vars, playbook_path) + end + + private + + def self.run_via_cli(env_vars, extra_vars, playbook_path) + result = %x(#{format_env_vars(env_vars)} #{ansible_command} #{format_extra_vars(extra_vars)} #{playbook_path}) + JSON.parse(result) + end + + def self.ansible_command + # TODO add possibility to use custom path, e.g. from virtualenv + "ansible-playbook" + end + + def self.format_env_vars(env_vars) + env_vars.map { |key, value| "#{key}='#{value}'" }.join(" ") + end + + def self.format_extra_vars(extra_vars) + "--extra-vars '#{JSON.dump(extra_vars)}'" + end + end +end
Add simple wrapping code for running ansible-playbook Add simple wrapping code for running ansible-playbook
diff --git a/app/models/symbolize_json.rb b/app/models/symbolize_json.rb index abc1234..def5678 100644 --- a/app/models/symbolize_json.rb +++ b/app/models/symbolize_json.rb @@ -1,7 +1,7 @@ module SymbolizeJSON def self.included(model) model.columns.each do |column| - next unless column.sql_type == "json" + next unless column.sql_type.match(/^jsonb?$/i) model.class_eval do define_method(column.name) do
Change check to match json and jsonb
diff --git a/test/ruby/support/api_umbrella_tests/admin_auth.rb b/test/ruby/support/api_umbrella_tests/admin_auth.rb index abc1234..def5678 100644 --- a/test/ruby/support/api_umbrella_tests/admin_auth.rb +++ b/test/ruby/support/api_umbrella_tests/admin_auth.rb @@ -8,6 +8,12 @@ visit "/admins/auth/developer" fill_in "Email:", :with => admin.username click_button "Sign In" + + # Wait for the page to fully load, including the /admin/auth ajax request + # which will fill out the "My Account" link. If we don't wait, then + # navigating to another page immediately may cancel the previous + # /admin/auth ajax request if it hadn't finished throwing some errors. + assert_link("My Account", :href => /#{admin.id}/, :visible => :all) end end end
Fix intermittent ajax test failures due to canceled ajax requests.
diff --git a/lib/goog/sheet_record.rb b/lib/goog/sheet_record.rb index abc1234..def5678 100644 --- a/lib/goog/sheet_record.rb +++ b/lib/goog/sheet_record.rb @@ -1,11 +1,15 @@ class Goog::SheetRecord attr :schema attr :row_values + attr :row_num + attr :sheet include Goog::SpreadsheetUtils - def initialize(schema:, row_values:) + def initialize(schema:, row_values:, row_num:, sheet:) @schema = schema @row_values = row_values + @row_num = row_num + @sheet = sheet end def get_row_value(key) @@ -26,9 +30,13 @@ def method_missing(mid, *args) if mid[-1] == '=' - self.set_row_value(mid[0..-2].to_sym, args[0]) + mid = mid[0..-2].to_sym + raise NoMethodError.new("Unknown method #{mid}=") unless @schema.member?(mid) + self.set_row_value(mid, args[0]) else - self.get_row_value(mid.to_sym) + mid = mid.to_sym + raise NoMethodError.new("Unknown method #{mid}") unless @schema.member?(mid) + self.get_row_value(mid) end end @@ -39,4 +47,13 @@ end result end + + def self.from_range_values(values:, sheet:) + schema = self.create_schema(values[0]) + values[1..-1].map.with_index do |row, index| + new(schema: schema, row_values: row, row_num: index+2, sheet: sheet) + end + end + + end
Add row_num and sheet to SheetRecord. Raise NoMethodError if method is not in schema. Create class method to handle record creation.
diff --git a/ext/extconf.rb b/ext/extconf.rb index abc1234..def5678 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -10,7 +10,7 @@ f.print mf f.print <<END all:: - $(MAKE) all -C tidy-html5/build/gmake + $(MAKE) all -C #{File.expand_path(File.join(File.dirname(__FILE__), 'tidy-html5', 'build', 'gmake'))} install:: cp tidy-html5/bin/tidy ../bin/
Use full path to makefile
diff --git a/spec/features/top_spec.rb b/spec/features/top_spec.rb index abc1234..def5678 100644 --- a/spec/features/top_spec.rb +++ b/spec/features/top_spec.rb @@ -4,7 +4,7 @@ describe "GET /" do scenario "Sponser links should be exist" do visit "/" - expect(page).to have_css 'section.sponsors_logo a[href]', count:4 + expect(page).to have_css 'section.sponsors_logo a[href]', count: 5 end end end
Fix broken test for Sponsors
diff --git a/tools/snippet-testing/language_handler/python_6.rb b/tools/snippet-testing/language_handler/python_6.rb index abc1234..def5678 100644 --- a/tools/snippet-testing/language_handler/python_6.rb +++ b/tools/snippet-testing/language_handler/python_6.rb @@ -23,9 +23,12 @@ def replace_twilio_client_initialization(file_content) cert_path = ENV['FAKE_CERT_PATH'] - updated_file_content = file_content.gsub! 'Client(account_sid, auth_token)', - 'Client(account_sid, auth_token, http_client=FakerHttpClient())' - updated_file_content == nil ? file_content : updated_file_content + result = '' + file_content.each_line do |line| + result += line.include?('client = Client(') ? + line.gsub!(')', ', http_client=FakerHttpClient())') : line + end + result end end end
Make replace TwilioHttpClient in Python snippets more resilient
diff --git a/transfluent.gemspec b/transfluent.gemspec index abc1234..def5678 100644 --- a/transfluent.gemspec +++ b/transfluent.gemspec @@ -6,7 +6,12 @@ s.description = "Order human powered translations directly from your Ruby code!" s.authors = ["Transfluent Ltd"] s.email = 'coders@transfluent.com' - s.files = ["lib/transfluent.rb"] + s.files = [ + "lib/transfluent.rb", + "lib/transfluent/api.rb", + "lib/transfluent/api_helper.rb", + "lib/transfluent/language.rb" + ] s.homepage = 'http://www.transfluent.com' s.license = 'MIT' end
Add missing files to gemfile
diff --git a/vendor/cookbooks/devbox/attributes/mysql_server.rb b/vendor/cookbooks/devbox/attributes/mysql_server.rb index abc1234..def5678 100644 --- a/vendor/cookbooks/devbox/attributes/mysql_server.rb +++ b/vendor/cookbooks/devbox/attributes/mysql_server.rb @@ -1 +1,6 @@ include_attribute "mysql::server" + +override["mysql"]["server_debian_password"] = 'mysql' +override["mysql"]["server_root_password"] = 'mysql' +override["mysql"]["server_repl_password"] = 'mysql' +override["mysql"]["bind_address"] = '0.0.0.0'
Fix mysql cookbook settings to include default passwords
diff --git a/lib/liquid/interrupts.rb b/lib/liquid/interrupts.rb index abc1234..def5678 100644 --- a/lib/liquid/interrupts.rb +++ b/lib/liquid/interrupts.rb @@ -1,6 +1,6 @@ module Liquid - # An interrupt is any command that breaks processing of a block (ex: a for loop). - class Interrupt + # A block interrupt is any command that breaks processing of a block (ex: a for loop). + class BlockInterrupt attr_reader :message def initialize(message = nil) @@ -9,8 +9,8 @@ end # Interrupt that is thrown whenever a {% break %} is called. - class BreakInterrupt < RuntimeError; end + class BreakInterrupt < BlockInterrupt; end # Interrupt that is thrown whenever a {% continue %} is called. - class ContinueInterrupt < RuntimeError; end + class ContinueInterrupt < BlockInterrupt; end end
Remove reserved word Interrupt to avoid confusion Also resolves rubocop conflicts
diff --git a/roles/cassandra_datanode.rb b/roles/cassandra_datanode.rb index abc1234..def5678 100644 --- a/roles/cassandra_datanode.rb +++ b/roles/cassandra_datanode.rb @@ -6,6 +6,7 @@ runit boost thrift + ntp cassandra cassandra::install_from_release cassandra::autoconf
Add ntp to cassandra datanode role.
diff --git a/lib/pixiv/illust_list.rb b/lib/pixiv/illust_list.rb index abc1234..def5678 100644 --- a/lib/pixiv/illust_list.rb +++ b/lib/pixiv/illust_list.rb @@ -0,0 +1,28 @@+module Pixiv + # @abstract + class IllustList < Page + include PageCollection + + attr_reader :page + attr_reader :count + + def page_class + Page + end + + alias illust_hashes page_hash # TODO: pluralize PageCollection#page_hash + alias illust_urls page_urls + end + + module IllustList::WithClient + include Page::WithClient + include Enumerable + + def each + illust_hashes.each do |attrs| + url = attrs.delete(:url) + yield Illust.lazy_new(attrs) { client.agent.get(url) } + end + end + end +end
Add new IllustList, the base class for illust list
diff --git a/lib/productivity/good.rb b/lib/productivity/good.rb index abc1234..def5678 100644 --- a/lib/productivity/good.rb +++ b/lib/productivity/good.rb @@ -0,0 +1,16 @@+require 'securerandom' + +module Productivity + +class Good + @attr_accessor :name, :version, :id, :ancestors + + def initialize args + @name = args[:name] || "" + @version = args[:version] || 0 + @id = args[:id] || SecureRandom.uuid + @ancestors = args[:ancestors] || [] + end +end + +end
Add the Good class, which defines anything that can be used by man to satisfy an end. Add a very brief description of the project to README.rdoc
diff --git a/app/admin/article_post.rb b/app/admin/article_post.rb index abc1234..def5678 100644 --- a/app/admin/article_post.rb +++ b/app/admin/article_post.rb @@ -26,8 +26,8 @@ row :author row :column row :featured - row :featured_image do |post| - img src: post.featured_image.thumb.url + row :featured_image do |p| + img src: p.featured_image.thumb.url end row :published_at row :created_at
Fix shadowed outer local variable
diff --git a/lib/send_with_us/file.rb b/lib/send_with_us/file.rb index abc1234..def5678 100644 --- a/lib/send_with_us/file.rb +++ b/lib/send_with_us/file.rb @@ -1,16 +1,21 @@ module SendWithUs - class File < SimpleDelegator + class File + attr_accessor :attachment + def initialize(file_data, opts = {}) - attachment = if file_data.is_a?(String) - SendWithUs::Attachment.new(file_data) - else - if file_data[:data] and file_data[:id] - file_data - else - SendWithUs::Attachment.new(file_data[:attachment], file_data[:filename]) - end - end - super(attachment) + @attachment = if file_data.is_a?(String) + SendWithUs::Attachment.new(file_data) + else + if file_data[:data] and file_data[:id] + file_data + else + SendWithUs::Attachment.new(file_data[:attachment], file_data[:filename]) + end + end + end + + def to_h + attachment.to_h end end end
Drop SimpleDelegator dependency to avoid bad performance ruby@1.8
diff --git a/lib/subtime/timer_cli.rb b/lib/subtime/timer_cli.rb index abc1234..def5678 100644 --- a/lib/subtime/timer_cli.rb +++ b/lib/subtime/timer_cli.rb @@ -23,7 +23,7 @@ " Example: -s 9,'Get up and stretch'", " This will say 'Get up and stretch' at minute 9", " NOTE: The integer must be within the range 1-MINUTES") do |minute_messages| - options.messages = Hash[minute_messages.flatten(1)] + options.messages = Hash[*minute_messages] end opts.separator ""
Fix -s to accept multiple key,values
diff --git a/app/helpers/xml_helper.rb b/app/helpers/xml_helper.rb index abc1234..def5678 100644 --- a/app/helpers/xml_helper.rb +++ b/app/helpers/xml_helper.rb @@ -1,7 +1,7 @@ module XmlHelper def collection_lastmod(collection) - article_updated = collection.articles.find(:first, order: 'updated_at DESC') - article_published = collection.articles.find(:first, order: 'published_at DESC') + article_updated = collection.articles.all.order(updated_at: :desc).first + article_published = collection.articles.all.order(published_at: :desc).first times = [] times.push article_updated.updated_at if article_updated
Fix the retrieval of published and updated articles
diff --git a/app/models/charge_rate.rb b/app/models/charge_rate.rb index abc1234..def5678 100644 --- a/app/models/charge_rate.rb +++ b/app/models/charge_rate.rb @@ -9,7 +9,7 @@ to = duration_to.nil? ? "" : I18n::localize(duration_to) "%s: %s (%s - %s)" % [title, rate_to_s, from, to] else - "%s: %s" % [title, rate_to_s] + "%s (%s)" % [title, rate_to_s] end end
Use "%title (%rate) as ChargeRate.to_s.
diff --git a/bot/job_status_generation.rb b/bot/job_status_generation.rb index abc1234..def5678 100644 --- a/bot/job_status_generation.rb +++ b/bot/job_status_generation.rb @@ -2,7 +2,7 @@ def to_status rep = [] - rep << "Job #{ident} (#{url}):" + rep << "Job #{ident} ( #{url} ):" if started_by if note
Add a space between the URL and the surrounding parens to make various auto-linkers happy
diff --git a/interactor.gemspec b/interactor.gemspec index abc1234..def5678 100644 --- a/interactor.gemspec +++ b/interactor.gemspec @@ -14,6 +14,6 @@ spec.files = `git ls-files`.split($/) spec.test_files = spec.files.grep(/^spec/) - spec.add_development_dependency "bundler", "~> 1.7" - spec.add_development_dependency "rake", "~> 10.3" + spec.add_development_dependency "bundler" + spec.add_development_dependency "rake" end
Drop version requirements for bundler and rake
diff --git a/app/controllers/stash_engine/sessions_controller.rb b/app/controllers/stash_engine/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/stash_engine/sessions_controller.rb +++ b/app/controllers/stash_engine/sessions_controller.rb @@ -24,7 +24,9 @@ # destroy the session (ie, log out) def destroy + test_domain = session[:test_domain] reset_session + session[:test_domain] = test_domain redirect_to root_path end
Fix for developer login not setting tenant correctly for testing.
diff --git a/app/observers/open_conference_ware/cache_watcher.rb b/app/observers/open_conference_ware/cache_watcher.rb index abc1234..def5678 100644 --- a/app/observers/open_conference_ware/cache_watcher.rb +++ b/app/observers/open_conference_ware/cache_watcher.rb @@ -15,7 +15,8 @@ Snippet, Track, User, - UserFavorite + UserFavorite, + SelectorVote # Expire the cache def self.expire(*args)
Expire cache when modifying SelectorVotes Closes #105
diff --git a/app/services/ci/create_pipeline_schedule_service.rb b/app/services/ci/create_pipeline_schedule_service.rb index abc1234..def5678 100644 --- a/app/services/ci/create_pipeline_schedule_service.rb +++ b/app/services/ci/create_pipeline_schedule_service.rb @@ -1,39 +1,13 @@ module Ci class CreatePipelineScheduleService < BaseService def execute - pipeline_schedule = project.pipeline_schedules.build(pipeline_schedule_params) - - if variable_keys_duplicated? - pipeline_schedule.errors.add('variables.key', "keys are duplicated") - - return pipeline_schedule - end - - pipeline_schedule.save - pipeline_schedule - end - - def update(pipeline_schedule) - if variable_keys_duplicated? - pipeline_schedule.errors.add('variables.key', "keys are duplicated") - - return false - end - - pipeline_schedule.update(pipeline_schedule_params) + project.pipeline_schedules.create(pipeline_schedule_params) end private def pipeline_schedule_params - @pipeline_schedule_params ||= params.merge(owner: current_user) - end - - def variable_keys_duplicated? - attributes = pipeline_schedule_params['variables_attributes'] - return false unless attributes.is_a?(Array) - - attributes.map { |v| v['key'] }.uniq.length != attributes.length + params.merge(owner: current_user) end end end
Revert extra validation for duplication between same keys on a submit
diff --git a/postmark-rails.gemspec b/postmark-rails.gemspec index abc1234..def5678 100644 --- a/postmark-rails.gemspec +++ b/postmark-rails.gemspec @@ -21,7 +21,7 @@ s.rdoc_options = ["--charset=UTF-8"] s.add_dependency('actionmailer', ">= 3.0.0") - s.add_dependency('postmark', "~> 1.15") + s.add_dependency('postmark', '~> 1.15', '>= 1.21.3') s.add_development_dependency("rake")
Update minimum postmark gem dependency to avoid use of TLS v1
diff --git a/hkdf.gemspec b/hkdf.gemspec index abc1234..def5678 100644 --- a/hkdf.gemspec +++ b/hkdf.gemspec @@ -13,6 +13,7 @@ s.require_paths = ['lib'] s.add_dependency 'jruby-openssl' if RUBY_PLATFORM == 'java' + s.add_development_dependency 'bundler', '~> 1.0' s.add_development_dependency 'rake', '10.1.0' s.add_development_dependency 'rspec', '3.0.0' end
Add bundler as a development dependency
diff --git a/.config/mdl/style.rb b/.config/mdl/style.rb index abc1234..def5678 100644 --- a/.config/mdl/style.rb +++ b/.config/mdl/style.rb @@ -1,7 +1,4 @@ all - -# Ignore front matter -ignore_front_matter true # Use MD041 instead exclude_rule 'MD002'
Move front matter config into correct place
diff --git a/jastor.podspec b/jastor.podspec index abc1234..def5678 100644 --- a/jastor.podspec +++ b/jastor.podspec @@ -3,8 +3,8 @@ s.version = "0.1.0" s.summary = "Auto translates NSDictionary to instances of Objective-C classes, supporting nested types and arrays." s.homepage = "https://github.com/elado/jastor" - s.license = 'MIT' + s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Elad Ossadon" => "elad@ossadon.com" } - s.source = { :git => "https://github.com/elado/jastor.git", :tag => "0.0.1" } + s.source = { :git => "https://github.com/elado/jastor.git", :tag => "0.1.0" } s.source_files = 'jastor/jastor/*.{h,m}' end
Fix version and pass spec lint Fix the version (sorry about that) Pass pod spec lint (add license)
diff --git a/spec/build/job/test/perl.rb b/spec/build/job/test/perl.rb index abc1234..def5678 100644 --- a/spec/build/job/test/perl.rb +++ b/spec/build/job/test/perl.rb @@ -22,5 +22,13 @@ end end end + context "when project uses neither Build.PL nor Makefile.PL" do + it 'does nothing' do + job.expects(:uses_module_build?).returns(false) + job.expects(:uses_eumm?).returns(false) + job.install.should be_nil + end + end + end end
Add another spec for when projects don't use EUMM or Module::Build
diff --git a/spec/classes/params_spec.rb b/spec/classes/params_spec.rb index abc1234..def5678 100644 --- a/spec/classes/params_spec.rb +++ b/spec/classes/params_spec.rb @@ -15,10 +15,8 @@ :is_pe => false, } end - it { is_expected.to contain_apache__params } - it "Should not contain any resources" do - should have_resource_count(0) - end + it { is_expected.to compile.with_all_deps } + it { is_expected.to have_resource_count(0) } end end
Update tests to pass with puppet 4.5 and test properly
diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index abc1234..def5678 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -8,20 +8,24 @@ click_link("Sign Up") end + subject(:fill_in_require_fields) do + user_new_password = "Pass3word:" + + fill_in "Email", with: Faker::Internet.free_email + fill_in "First Name", with: Faker::Name.first_name + fill_in "Last Name", with: Faker::Name.last_name + fill_in "Password", with: user_new_password + fill_in "Password Confirmation", with: user_new_password + end + context "with all fields fill post" do it "responds with 200" do vist_sign_up - within "#new_user" do - user_new_password = "Pass3word:" - - fill_in "Email", with: Faker::Internet.free_email - fill_in "First Name", with: Faker::Name.first_name - fill_in "Last Name", with: Faker::Name.last_name + within "#new_user" do + fill_in_require_fields fill_in "Street Name", with: "King Street W." fill_in "Street Number", with: 220 - fill_in "Password", with: user_new_password - fill_in "Password Confirmation", with: user_new_password end click_on "Sign Up"
Add Fill Require Fields Suject, User Feature Test
diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb index abc1234..def5678 100644 --- a/spec/models/contact_spec.rb +++ b/spec/models/contact_spec.rb @@ -0,0 +1,63 @@+require 'spec_helper' + +describe Contact do + it "is valid with a firstname, lastname, and email" do + contact = Contact.new( + firstname: "Christine", + lastname: "Feaster", + email: "c.feaster@test.com" + ) + + expect(contact).to be_valid + end + + it "is invalid without a firstname" do + contact = Contact.new( + firstname: nil + ) + + expect(contact).to have(1).errors_on(:firstname) + end + + it "is invalid without a lastname" do + contact = Contact.new( + lastname: nil + ) + + expect(contact).to have(1).errors_on(:lastname) + end + + it "is invalid without an email address" do + contact = Contact.new( + email: nil + ) + + expect(contact).to have(1).errors_on(:email) + end + + it "is invalid with a duplicate email address" do + john = Contact.create( + firstname: "John", + lastname: "Doe", + email: "jdoe@test.com" + ) + jane = Contact.new( + firstname: "Jane", + lastname: "Doe", + email: "jdoe@test.com" + ) + + expect(jane).to have(1).errors_on(:email) + end + + it "returns a contact's full name as string" do + contact = Contact.new( + firstname: "Jane", + lastname: "Doe", + email: "jdoe@test.com" + ) + + expect(contact.name).to eq "Jane Doe" + end + +end
Add model tests for Contacts - ERT_Rspec 03_models
diff --git a/spec/models/request_spec.rb b/spec/models/request_spec.rb index abc1234..def5678 100644 --- a/spec/models/request_spec.rb +++ b/spec/models/request_spec.rb @@ -0,0 +1,20 @@+require 'rails_helper' + +describe Request do + context "validations" do + it { should validate_presence_of :content } + it { should validate_presence_of :requester } + it { should validate_presence_of :group } + it { should allow_value(true).for :is_fulfilled } + it { should allow_value(false).for :is_fulfilled } + end + + context "associations" do + it { should have_many :messages } + it { should have_many :transactions } + it { should have_many :votes } + it { should belong_to :requester } + it { should belong_to :responder } + it { should belong_to :group } + end +end
Add basic testing for the Request model. Tests include all validations and associations, but model methods have not yet been tested. This will be included in future releases.
diff --git a/bin/lib/transform_node.rb b/bin/lib/transform_node.rb index abc1234..def5678 100644 --- a/bin/lib/transform_node.rb +++ b/bin/lib/transform_node.rb @@ -10,16 +10,19 @@ # end # ``` class TransformNode < Node - def initialize(source:) + def initialize(source:, mask: nil) super(lights: source.lights) @source = source + @mask = mask end def update(t) @source.update(t) if block_given? (0..(@lights - 1)).each do |x| - @state[x] = yield(x) + # Apply to all lights if no mask, and apply to specific lights if mask. + apply_transform = !@mask || @mask[x] + @state[x] = apply_transform ? yield(x) : @source[x] end end super(t)
Add ability to mask out lights...
diff --git a/config/initializers/money.rb b/config/initializers/money.rb index abc1234..def5678 100644 --- a/config/initializers/money.rb +++ b/config/initializers/money.rb @@ -1,2 +1,2 @@ Money.rounding_mode = BigDecimal::ROUND_HALF_EVEN -Money.default_currency = Money::Currency.new('USD') +Money.default_currency = Money::Currency.new(Spree::Config[:currency])
Use the instance currency as Money's default
diff --git a/lib/growl-transfer/gt_scp.rb b/lib/growl-transfer/gt_scp.rb index abc1234..def5678 100644 --- a/lib/growl-transfer/gt_scp.rb +++ b/lib/growl-transfer/gt_scp.rb @@ -8,7 +8,7 @@ @output.puts "Downloading #{remote}" params = remote.split(":") file = params.last.split("/").last - Net::SCP.start(params[0], "clint") do |scp| + Net::SCP.start(params[0], ENV['USER']) do |scp| scp.download!(params[1], local_path, {:recursive => true, :verbose => true}) do |ch, name, sent, total| # => progress? end
Use current UNIX user, incase your name isn't Clint
diff --git a/lib/insensitive_load/list.rb b/lib/insensitive_load/list.rb index abc1234..def5678 100644 --- a/lib/insensitive_load/list.rb +++ b/lib/insensitive_load/list.rb @@ -20,10 +20,10 @@ # list def items( - *args, + path_src, absolute_path: nil, - **options) - collector = Collector.new(*args, **options) + **init_options) + collector = Collector.new(path_src, **init_options) collector.items(absolute_path) end
Modify argument names a little InsensitiveLoad::List ---- - Change argument names in .items. - From '*args' to 'path_src'. - From '**options' to '**init_options'.
diff --git a/lib/lita/handlers/netping.rb b/lib/lita/handlers/netping.rb index abc1234..def5678 100644 --- a/lib/lita/handlers/netping.rb +++ b/lib/lita/handlers/netping.rb @@ -27,7 +27,8 @@ end def ping_target(host) - Net::Ping::External.new(host).ping + p = Net::Ping::External.new(host) + p.ping(host, 1, 1, 1) end end
Add a shorter timeout, this should be user-accessible at some point.
diff --git a/kittenizer.gemspec b/kittenizer.gemspec index abc1234..def5678 100644 --- a/kittenizer.gemspec +++ b/kittenizer.gemspec @@ -19,6 +19,6 @@ spec.require_paths = ["lib"] spec.add_development_dependency "bundler", ">= 1.8" - spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rake", "~> 12.3" spec.add_development_dependency "rspec" end
Update rake requirement from ~> 10.0 to ~> 12.3 Updates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/rake-10.0.0...v12.3.3) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/lib/amee/v3.rb b/lib/amee/v3.rb index abc1234..def5678 100644 --- a/lib/amee/v3.rb +++ b/lib/amee/v3.rb @@ -1,7 +1,7 @@ # Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com # Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details. -AMEE_API_VERSION = '3.3' +AMEE_API_VERSION = '3' require 'amee/v3/meta_helper' require 'amee/v3/collection'
Update to use plain version 3 api, no minor version. SDK-194
diff --git a/lib/helpers.rb b/lib/helpers.rb index abc1234..def5678 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -1,6 +1,6 @@ require 'erb' require 'yaml' -require 'helpers/logger' -require 'helpers/config_file' -require 'helpers/repository' -require 'helpers/pull_requests_data' +require './lib/helpers/logger' +require './lib/helpers/config_file' +require './lib/helpers/repository' +require './lib/helpers/pull_requests_data'
Fix require paths for individual helper files.
diff --git a/lib/verilog.rb b/lib/verilog.rb index abc1234..def5678 100644 --- a/lib/verilog.rb +++ b/lib/verilog.rb @@ -3,7 +3,7 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) module Verilog - VERSION = '0.0.3' + VERSION = '0.0.4' end require 'verilog/file'
Increment version number for next release
diff --git a/lib/graph/graph.rb b/lib/graph/graph.rb index abc1234..def5678 100644 --- a/lib/graph/graph.rb +++ b/lib/graph/graph.rb @@ -31,6 +31,13 @@ def remove_node(node) @nodes.delete(node) # the edges/vertices are going to have to be handled too + # that might look like iterating over all the nodes in the @incoming + # and @outgoing lists of the given node and for each of those nodes, + # the the references to this node will need to be removed. + # node.outgoing.each { |out| + # out.outgoing.delete(node) + # out.incoming.delete(node) + # } end end
Include some comments that detail a possible extension to the solution of remove_node that would also clean up the edges.
diff --git a/lib/line_parser.rb b/lib/line_parser.rb index abc1234..def5678 100644 --- a/lib/line_parser.rb +++ b/lib/line_parser.rb @@ -20,7 +20,7 @@ end { - :metric => Rufus.dsub(@metric, variables), + :name => Rufus.dsub(@metric, variables), :time => time, :source => source, :aggregation => @aggregation,
Fix name of metric key
diff --git a/lib/simplecheck.rb b/lib/simplecheck.rb index abc1234..def5678 100644 --- a/lib/simplecheck.rb +++ b/lib/simplecheck.rb @@ -9,9 +9,7 @@ simplecheck_check_arguments( arguments ) end - if error_message - simplecheck_handle_failure( error_message ) - end + error_message ? simplecheck_handle_failure( error_message ) : true end private
Return true if check passed
diff --git a/lib/ditty/models/user_login_trait.rb b/lib/ditty/models/user_login_trait.rb index abc1234..def5678 100644 --- a/lib/ditty/models/user_login_trait.rb +++ b/lib/ditty/models/user_login_trait.rb @@ -11,6 +11,7 @@ def validate super + validates_presence :user_id end end end
chore: Add validation to user login trait
diff --git a/integration-tests/apps/alacarte/services/simple_service.rb b/integration-tests/apps/alacarte/services/simple_service.rb index abc1234..def5678 100644 --- a/integration-tests/apps/alacarte/services/simple_service.rb +++ b/integration-tests/apps/alacarte/services/simple_service.rb @@ -21,7 +21,7 @@ end def loop_once - $stderr.puts "Service executing loop!" + $stderr.puts "Service executing loop with #{@webserver}!" basedir = ENV['BASEDIR' ] basedir.gsub!( %r(\\:), ':' ) basedir.gsub!( %r(\\\\), '\\' )
Print the injected webserver for manual verification of workingness.
diff --git a/lib/filepicker/rails/form_builder.rb b/lib/filepicker/rails/form_builder.rb index abc1234..def5678 100644 --- a/lib/filepicker/rails/form_builder.rb +++ b/lib/filepicker/rails/form_builder.rb @@ -15,7 +15,7 @@ 'data-fp-option-container' => options[:container], - 'data-fp-option-multiple' => false, + 'data-fp-option-multiple' => options.fetch(:multiple, false), 'data-fp-option-services' => Array(options[:services]).join(","),
Allow data-fp-option-multiple to be specified in the options hash
diff --git a/lib/puppet/provider/vs_bridge/ovs.rb b/lib/puppet/provider/vs_bridge/ovs.rb index abc1234..def5678 100644 --- a/lib/puppet/provider/vs_bridge/ovs.rb +++ b/lib/puppet/provider/vs_bridge/ovs.rb @@ -1,7 +1,8 @@ require "puppet" Puppet::Type.type(:vs_bridge).provide(:ovs) do - optional_commands :vsctl => "/usr/bin/ovs-vsctl" + optional_commands :vsctl => "/usr/bin/ovs-vsctl", + :ip => "/sbin/ip" def exists? vsctl("br-exists", @resource[:name]) @@ -11,6 +12,7 @@ def create vsctl("add-br", @resource[:name]) + ip("link", "set", @resource[:name], "up") external_ids = @resource[:external_ids] if@resource[:external_ids] end
Make sure that created bridges are brought up
diff --git a/lib/ruby_git_hooks/jira_ref_check.rb b/lib/ruby_git_hooks/jira_ref_check.rb index abc1234..def5678 100644 --- a/lib/ruby_git_hooks/jira_ref_check.rb +++ b/lib/ruby_git_hooks/jira_ref_check.rb @@ -2,8 +2,8 @@ require "ruby_git_hooks" -# This hook checks that the commit message has one or more valid Jira -# ticket references. +# This hook checks that the commit message has one or more correctly-formatted +# Jira ticket references. class JiraReferenceCheckHook < RubyGitHooks::Hook Hook = RubyGitHooks::Hook
Remove reference to 'valid' ticket since we don't check validity SYSINT-5460
diff --git a/app/models/secret.rb b/app/models/secret.rb index abc1234..def5678 100644 --- a/app/models/secret.rb +++ b/app/models/secret.rb @@ -2,7 +2,8 @@ validates :address, presence: true validates :message, presence: true validates :song, format: { with: /.*soundcloud.*/, - message: "must use a valid soundcloud url" } + message: "must use a valid soundcloud url" }, + :allow_blank => true geocoded_by :address after_validation :geocode, :if => :address_changed? belongs_to :user
Allow song to be blank
diff --git a/lib/expando.rb b/lib/expando.rb index abc1234..def5678 100644 --- a/lib/expando.rb +++ b/lib/expando.rb @@ -1,6 +1,6 @@ require 'dry-initializer' require 'dry-types' -require 'api-ai-ruby' +require 'voxable-api-ai-ruby' require 'colorize' require 'awesome_print'
Use forked version of ApiAiRuby client gem