diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/config/environments/staging.rb b/config/environments/staging.rb index abc1234..def5678 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -11,7 +11,16 @@ config.assets.digest = true config.assets.js_compressor = :uglifier config.assets.precompile += %w( - racing_association.js ie.css racing_association.css racing_association_ie.css admin.js raygun.js + admin.js + glyphicons-regular.eot + glyphicons-regular.svg + glyphicons-regular.ttf + glyphicons-regular.woff + ie.css + racing_association.css + racing_association.js + racing_association_ie.css + raygun.js ) config.cache_classes = true config.consider_all_requests_local = true
Add fonts explicitly for precompile
diff --git a/config/initializers/rollbar.rb b/config/initializers/rollbar.rb index abc1234..def5678 100644 --- a/config/initializers/rollbar.rb +++ b/config/initializers/rollbar.rb @@ -1,5 +1,5 @@ Rollbar.configure do |config| - config.access_token = ENV["ROLLBAR_API_KEY"] + config.access_token = ENV["ROLLBAR_ACCESS_TOKEN"] config.use_sucker_punch end
Correct ROLLBAR_ACCESS_TOKEN env var name
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index abc1234..def5678 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -0,0 +1,14 @@+redis_config = YAML.load_file(File.join(Rails.root, "config", "redis.yml")) + +redis_config_for_sidekiq = { + :url => "redis://#{redis_config['host']}:#{redis_config['port']}/0", + :namespace => "transition" +} + +Sidekiq.configure_server do |config| + config.redis = redis_config_for_sidekiq +end + +Sidekiq.configure_client do |config| + config.redis = redis_config_for_sidekiq +end
Fix Sidekiq's redis connection in production We were relying on Sidekiq's default (localhost) redis connection, which works in development but not in our production-like environments. config/redis.yml is already overwritten on deploy to configure it correctly for distributed locking, so let's reuse that.
diff --git a/spec/controllers/ideas_controller_spec.rb b/spec/controllers/ideas_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/ideas_controller_spec.rb +++ b/spec/controllers/ideas_controller_spec.rb @@ -8,28 +8,28 @@ describe "GET 'index'" do it "returns http success" do get 'index' - response.should be_success + expect(response).to be_success end end describe "GET 'new'" do it "returns http success" do get 'new' - response.should be_success + expect(response).to be_success end end describe "GET 'edit'" do it "returns http success" do get 'edit', { id: 1 } - response.should be_success + expect(response).to be_success end end describe "GET 'show'" do it "returns http success" do get 'show', { id: @idea.id } - response.should be_success + expect(response).to be_success end end
Change response expectation syntax in Idea Controller Follow expectation syntax convention as in other tests.
diff --git a/spec/shared/idempotent_method_behavior.rb b/spec/shared/idempotent_method_behavior.rb index abc1234..def5678 100644 --- a/spec/shared/idempotent_method_behavior.rb +++ b/spec/shared/idempotent_method_behavior.rb @@ -2,6 +2,8 @@ shared_examples_for 'an idempotent method' do it 'is idempotent' do - should equal(instance_eval(&self.class.subject)) + first = subject + __memoized.delete(:subject) + should equal(first) end end
Fix "idempotent method" shared example helper rspec-2.13.0 changed the way the subject is exposed. We do not have access to the block anymore. Need to delete memoized value from the __memoized hash to reset subject.
diff --git a/lib/globot/bot.rb b/lib/globot/bot.rb index abc1234..def5678 100644 --- a/lib/globot/bot.rb +++ b/lib/globot/bot.rb @@ -23,18 +23,24 @@ def start - room = @rooms.first # just one room for now - room.listen do |msg| - begin - if !msg.nil? && msg['user']['id'] != id # ignore messages from myself - Globot::Plugins.handle Globot::Message.new(msg, room) + # join each room + threads = [] + @rooms.each do |room| + # `Room#listen` blocks, so run each one in a separate thread + threads << Thread.new do + begin + room.listen do |msg| + if !msg.nil? && msg['user']['id'] != id # ignore messages from myself + Globot::Plugins.handle Globot::Message.new(msg, room) + end + end + rescue Exception => e + trace = e.backtrace.join("\n") + puts "ERROR: #{e.message}\n#{trace}" end - rescue Exception => e - trace = e.backtrace.join("\n") - puts "ERROR: #{e.message}\n#{trace}" end end - + threads.each { |t| t.join } end end
Join multiple rooms by running each room in a separate thread.
diff --git a/spec/factories/plant_parts.rb b/spec/factories/plant_parts.rb index abc1234..def5678 100644 --- a/spec/factories/plant_parts.rb +++ b/spec/factories/plant_parts.rb @@ -4,6 +4,6 @@ FactoryBot.define do factory :plant_part do - name { Faker::Games::Pokemon.unique.name } + name { Faker::Games::Pokemon.unique.name + Faker::Number.number(10) } end end
Add number on the end
diff --git a/spec/tic_tac_toe/rack_spec.rb b/spec/tic_tac_toe/rack_spec.rb index abc1234..def5678 100644 --- a/spec/tic_tac_toe/rack_spec.rb +++ b/spec/tic_tac_toe/rack_spec.rb @@ -8,7 +8,7 @@ app = TicTacToe::RackShell.new_shell req = Rack::MockRequest.new(app) response = req.get("/") - expect(response.accepted?).to be_truthy + expect(response.successful?).to be_truthy end end
Fix assertion in index test
diff --git a/spec/unit/control/for_spec.rb b/spec/unit/control/for_spec.rb index abc1234..def5678 100644 --- a/spec/unit/control/for_spec.rb +++ b/spec/unit/control/for_spec.rb @@ -4,18 +4,22 @@ module Control describe For do let(:ast) { FakeAst.new(:for, children: [:iterator, :iterable, :body]) } - subject { For.new(ast, nil) } + subject { For.new(ast) } it "should have control flow start at the iterable object" do expect(subject.start_node).to eq(:iterable) end it "should have control flow end at the iterable object" do - expect(subject.end_nodes).to eq([:iterable]) + expect(subject.end_nodes).to eq(%i(iterable)) end it "should have control flow edges between iterable and body, and vice-versa" do - expect(subject.internal_flow_edges).to eq([[:iterable, :body], [:body, :iterable]]) + expect(subject.internal_flow_edges).to eq([%i(iterable body), %i(body iterable)]) + end + + it "should have control flow nodes only for iterable and body, and not for iterator" do + expect(subject.nodes).to eq(%i(iterable body)) end end end
Add missing test case to for unit specs.
diff --git a/lib/punchblock/connection/freeswitch.rb b/lib/punchblock/connection/freeswitch.rb index abc1234..def5678 100644 --- a/lib/punchblock/connection/freeswitch.rb +++ b/lib/punchblock/connection/freeswitch.rb @@ -10,13 +10,14 @@ def initialize(options = {}) @translator = Translator::Freeswitch.new self, options[:media_engine] - @stream = new_fs_stream(*options.values_at(:host, :port, :password)) + @stream_options = options.values_at(:host, :port, :password) + @stream = new_fs_stream super() end def run pb_logger.debug "Starting the RubyFS stream" - @stream.run + start_stream raise DisconnectedError end @@ -35,8 +36,13 @@ private - def new_fs_stream(*args) - RubyFS::Stream.new(*args, lambda { |e| translator.handle_es_event! e }) + def new_fs_stream + RubyFS::Stream.new(*@stream_options, lambda { |e| translator.handle_es_event! e }) + end + + def start_stream + @stream = new_fs_stream unless @stream.alive? + @stream.run end end end
[BUGFIX] Reconnect dead FreeSWITCH streams correctly
diff --git a/lib/sastrawi/stemmer/stemmer_factory.rb b/lib/sastrawi/stemmer/stemmer_factory.rb index abc1234..def5678 100644 --- a/lib/sastrawi/stemmer/stemmer_factory.rb +++ b/lib/sastrawi/stemmer/stemmer_factory.rb @@ -4,6 +4,9 @@ require 'sastrawi/stemmer/stemmer' require 'sastrawi/stemmer/cache/array_cache' + +## +# Stemmer factory helps creating a pre-configured stemmer module Sastrawi module Stemmer
Add a comment to `StemmerFactory` class
diff --git a/app/controllers/api/docs_controller.rb b/app/controllers/api/docs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/docs_controller.rb +++ b/app/controllers/api/docs_controller.rb @@ -1,4 +1,6 @@ class Api::DocsController < ApplicationController + helper_method :get_url_query_parameters_for + COUNCILLOR_JSON_PATH = Rails.root.join('db/data/api/councillors.json') ITEM_JSON_PATH = Rails.root.join('db/data/api/item.json') @@ -8,4 +10,15 @@ @councillors = "<code lang=\"JSON\">#{councillors_json}</code>" @item = "<code lang=\"JSON\"> #{item_json}</code>" end + + def get_url_query_parameters_for(section) + case section + when :Agendas + when :Councillors + when :Committees + when :Items + when :Motions + when :Wards + end + end end
Add Helper Method To Display URL Query Help Text
diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -14,7 +14,8 @@ if expense.save redirect_to user_path(session[:user_id]) else - render :partial => 'errors', flash: { error: "Your expense must be greater than $0."} + flash[:error] = "Your expense must be greater than $0." + redirect_to user_path(session[:user_id]) end end @@ -27,7 +28,8 @@ if @expense.update_attributes expenses_params redirect_to user_path(session[:user_id]) else - render :partial => 'errors', flash: { error: "Your expense must be greater than $0."} + flash[:error] = "Your expense must be greater than $0." + redirect_to user_path(session[:user_id]) end end
Update flash errors for expenses
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index abc1234..def5678 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -3,10 +3,6 @@ before_filter :login_required, :only => [:create, :update_description, :destroy, :sort] def index - unless User.count - redirect_to :controller => 'account', :action => 'signup' - return - end @user = User.find_first @projects = Project.find :all, :order => 'position, created_at' end
Remove first-load check (new user must go to account/signup) git-svn-id: a5eb1f21004134ff1eade3189f8bc1741698c888@17 7ac60f11-bc0d-0410-ab0a-ac709fd26b10
diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -25,7 +25,7 @@ flash.now[:alert] = I18n.t('request.error') # TODO hard error message + log end else - flash.now[:alert] = I18n.t('request.errors_in_form') + flash.now[:alert] = I18n.t('requests.errors_in_form') end render 'new' end
Fix i18n key in redirect msg.
diff --git a/app/models/payment_method_decorator.rb b/app/models/payment_method_decorator.rb index abc1234..def5678 100644 --- a/app/models/payment_method_decorator.rb +++ b/app/models/payment_method_decorator.rb @@ -0,0 +1,11 @@+Spree::PaymentMethod.class_eval do + attr_accessible :icon + + has_attached_file :icon, + styles: { mini: '32x32>', normal: '128x128>' }, + default_style: :mini, + convert_options: { all: '-strip -auto-orient -colorspace sRGB' } + + include Spree::Core::S3Support + supports_s3 :icon +end
Add attached file info to Paymentmethod model
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -1,6 +1,8 @@+# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. require_relative 'config/environment' run Rails.application -Rails.application.load_server +Rails.application.load_server if Rails::VERSION::MAJOR == 6
Use load_server only on Rails 6 onwards 5.x doesn't know this.
diff --git a/rb/lib/selenium/webdriver/firefox/bridge.rb b/rb/lib/selenium/webdriver/firefox/bridge.rb index abc1234..def5678 100644 --- a/rb/lib/selenium/webdriver/firefox/bridge.rb +++ b/rb/lib/selenium/webdriver/firefox/bridge.rb @@ -20,7 +20,7 @@ remote_opts = { :url => @launcher.url, - :desired_capabilities => :firefox + :desired_capabilities => Remote::Capabilities.firefox(:native_events => DEFAULT_ENABLE_NATIVE_EVENTS) } remote_opts.merge!(:http_client => http_client) if http_client
JariBakken: Make sure we pass the correct native events capability in the Firefox driver. r11985
diff --git a/app/controllers/authorize_controller.rb b/app/controllers/authorize_controller.rb index abc1234..def5678 100644 --- a/app/controllers/authorize_controller.rb +++ b/app/controllers/authorize_controller.rb @@ -24,7 +24,7 @@ unless session[:redirect_url].blank? redirect_to session.delete(:redirect_url) else - redirect_to :index + redirect_to :feed end end
Change to redirect to feed from the index after authentication.
diff --git a/app/controllers/databases_controller.rb b/app/controllers/databases_controller.rb index abc1234..def5678 100644 --- a/app/controllers/databases_controller.rb +++ b/app/controllers/databases_controller.rb @@ -21,8 +21,12 @@ update! { databases_url } end + protected + def collection + @databases ||= decorate_resource_or_collection(end_of_association_chain.order_by(:name.asc)) + end + private - def select_view_mode current_user.update_setting(:databases_view_mode, params[:view_mode]) if params[:view_mode] end
Sort databases by name in databases/index
diff --git a/app/helpers/organization_list_helper.rb b/app/helpers/organization_list_helper.rb index abc1234..def5678 100644 --- a/app/helpers/organization_list_helper.rb +++ b/app/helpers/organization_list_helper.rb @@ -1,6 +1,5 @@ module OrganizationListHelper def organizations_for(user) - # TODO use immersive contexts here - (user.student_granted_organizations + [Organization.central]).uniq.compact + user.immersive_organizations_at(nil) end end
Use immersive organization in organization chooser
diff --git a/app/models/spree/calculator/per_item.rb b/app/models/spree/calculator/per_item.rb index abc1234..def5678 100644 --- a/app/models/spree/calculator/per_item.rb +++ b/app/models/spree/calculator/per_item.rb @@ -21,32 +21,11 @@ return 0 if object.nil? number_of_line_items = line_items_for(object).reduce(0) do |sum, line_item| - value_to_add = if matching_products.blank? || matching_products.include?(line_item.product) - line_item.quantity - else - 0 - end + value_to_add = line_item.quantity sum + value_to_add end preferred_amount * number_of_line_items end - - # Returns all products that match this calculator, but only if the calculator - # is attached to a promotion. If attached to a ShippingMethod, nil is returned. - def matching_products - # Regression check for #1596 - # Calculator::PerItem can be used in two cases. - # The first is in a typical promotion, providing a discount per item of a particular item - # The second is a ShippingMethod, where it applies to an entire order - # - # Shipping methods do not have promotions attached, but promotions do - # Therefore we must check for promotions - if self.calculable.respond_to?(:promotion) - self.calculable.promotion.rules.map do |rule| - rule.respond_to?(:products) ? rule.products : [] - end.flatten - end - end end end end
Remove dead code related to promotions, we dont have promotions in OFN
diff --git a/lib/onkcop/cli.rb b/lib/onkcop/cli.rb index abc1234..def5678 100644 --- a/lib/onkcop/cli.rb +++ b/lib/onkcop/cli.rb @@ -4,8 +4,7 @@ def self.start(args) action_name = retrieve_command_name(args) unless action_name - puts "onkcop commands:" - puts " init - Setup .rubocop.yml" + print_help exit end @@ -16,6 +15,7 @@ end puts "Could not find command #{action_name}." + print_help exit(1) rescue => e puts e.message @@ -27,6 +27,11 @@ args.shift if meth && (meth !~ /^\-/) end + def self.print_help + puts "onkcop commands:" + puts " init - Setup .rubocop.yml" + end + CONFIG_FILE_NAME = ".rubocop.yml" def init(args) raise "usage: onkcop init" unless args.empty?
Print help if undefined command
diff --git a/app/workers/search_index_add_worker.rb b/app/workers/search_index_add_worker.rb index abc1234..def5678 100644 --- a/app/workers/search_index_add_worker.rb +++ b/app/workers/search_index_add_worker.rb @@ -8,9 +8,9 @@ @id = id if searchable_instance.nil? - Rails.logger.warn("SearchIndexAddWorker: Could not find #{class_name} with id #{id}.") + Rails.logger.warn("SearchIndexAddWorker: Could not find #{class_name} with id #{id} (#{Time.zone.now.utc.to_s}).") elsif !searchable_instance.can_index_in_search? - Rails.logger.warn("SearchIndexAddWorker: Was asked to index #{class_name} with id #{id}, but it was unindexable.") + Rails.logger.warn("SearchIndexAddWorker: Was asked to index #{class_name} with id #{id}, but it was unindexable (#{Time.zone.now.utc.to_s}).") else index = Whitehall::SearchIndex.for(searchable_instance.rummager_index) index.add searchable_instance.search_index
Add timestamp to index add worker log messages
diff --git a/rails/app/controllers/feeds_controller.rb b/rails/app/controllers/feeds_controller.rb index abc1234..def5678 100644 --- a/rails/app/controllers/feeds_controller.rb +++ b/rails/app/controllers/feeds_controller.rb @@ -2,7 +2,7 @@ def mp_info # FIXME: We should change the accepted value to senate instead of lords house = params[:house] == 'lords' ? 'senate' : 'representatives' - @members = Member.in_australian_house(house).order(:entered_house, :last_name, :first_name, :constituency) + @members = Member.in_australian_house(house).joins(:member_info).order(:entered_house, :last_name, :first_name, :constituency) @most_recent_division = Division.most_recent_date end
Make rails mp-info xml feed match php one
diff --git a/test/test_rails_relations_fix.rb b/test/test_rails_relations_fix.rb index abc1234..def5678 100644 --- a/test/test_rails_relations_fix.rb +++ b/test/test_rails_relations_fix.rb @@ -25,12 +25,19 @@ end context "Counter_cache for polymorhpic association bug test" do - should "Update movies_count column after adding movie by <<" do + should "Update movies_count column after adding movie by << or destroing" do @user.movies << Movie.create(:name => "Matrix") assert_equal(2, @user.reload.movies_count) @titanic.destroy assert_equal(1, @user.reload.movies_count) end + + should "Refresh size after adding movie by << or destroing" do + @user.movies << Movie.create(:name => "Matrix") + assert_equal(2, @user.movies.size) + @titanic.destroy + assert_equal(1, @user.movies.size) + end end end end
Add test about refreshing size
diff --git a/lib/skyed/git.rb b/lib/skyed/git.rb index abc1234..def5678 100644 --- a/lib/skyed/git.rb +++ b/lib/skyed/git.rb @@ -9,6 +9,7 @@ unless Skyed::Settings.current_stack?(stack[:stack_id]) Skyed::Init.opsworks_git_key options end + puts "PKEY is: #{ENV['PKEY']}" ENV['PKEY'] ||= Skyed::Settings.opsworks_git_key Skyed::Utils.create_template('/tmp', 'ssh-git', 'ssh-git.erb', 0755) ENV['GIT_SSH'] = '/tmp/ssh-git'
INF-941: Add check to see PKEY value
diff --git a/lib/stoplight.rb b/lib/stoplight.rb index abc1234..def5678 100644 --- a/lib/stoplight.rb +++ b/lib/stoplight.rb @@ -1,4 +1,7 @@ # coding: utf-8 + +module Stoplight +end require 'stoplight/color' require 'stoplight/error' @@ -19,6 +22,3 @@ require 'stoplight/light/runnable' require 'stoplight/light' - -module Stoplight -end
Define the module before anything else I think it makes more sense this way. The entry point defines the module, then it loads all the files that populate the module.
diff --git a/lib/watirspec.rb b/lib/watirspec.rb index abc1234..def5678 100644 --- a/lib/watirspec.rb +++ b/lib/watirspec.rb @@ -1,6 +1,6 @@ module WatirSpec class << self - attr_accessor :browser_args, :persistent_browser, :unguarded + attr_accessor :browser_args, :persistent_browser, :unguarded, :implementation def html File.expand_path("#{File.dirname(__FILE__)}/../html")
Add ability to set impl name manually using WatirSpec.implementation=
diff --git a/lib/admix/admix.rb b/lib/admix/admix.rb index abc1234..def5678 100644 --- a/lib/admix/admix.rb +++ b/lib/admix/admix.rb @@ -23,11 +23,11 @@ @manager = @auth_manager_class.new(client_id, client_secret, PATH_TO_FILE, user_email) client_access_token = @manager.access_token - if(!client_access_token) - print("\nSorry, the application could not complete Athu2 process!\n" ) + if not client_access_token + print("\nSorry, the application could not complete Athu2 process!\n") return end - print("\nYou've authorized access to the application successfully!\n" ) + print("\nYou've authorized access to the application successfully!\n") end
Use ‘not’ instead of ‘!’ to negate and remove parentheses from if statement
diff --git a/merge_dbs.rb b/merge_dbs.rb index abc1234..def5678 100644 --- a/merge_dbs.rb +++ b/merge_dbs.rb @@ -0,0 +1,22 @@+IO.write( + "leak_summary.txt", + Dir.glob("#{ARGV[0]}/*").map do |f| + IO.read(f).split("\n").map do |e| + s = e.strip.split + puts "Null password in #{f}! Count: #{s[0]}" if s[1].nil? + + e.strip + end + end.flatten.map do |e| + s = e.split + + [s[0].to_i, s[1]] + end.group_by{|e| e[1] }.map do |k, g| + [ + k, + g.map{|e| e[0] }.reduce(&:+) + ] + end.sort_by{|e| e[1] }.reverse.reduce("") do |str, e| + str += "#{e[1]}\t#{e[0]}\n" + end +)
Add script file to merge all db files
diff --git a/lib/how_is/text.rb b/lib/how_is/text.rb index abc1234..def5678 100644 --- a/lib/how_is/text.rb +++ b/lib/how_is/text.rb @@ -3,17 +3,23 @@ module HowIs # Helper class for printing test, but hiding it when e.g. running in CI. class Text - class << self - attr_accessor :show_default_output - @show_default_output = true + def self.show_default_output + @show_default_output = true unless + instance_variable_defined?(:"@show_default_output") + + @show_default_output + end + + def self.show_default_output=(val) + @show_default_output = val end def self.print(*args) - print(*args) if HowIs::Text.show_default_output + Kernel.print(*args) if HowIs::Text.show_default_output end def self.puts(*args) - puts(*args) if HowIs::Text.show_default_output + Kernel.puts(*args) if HowIs::Text.show_default_output end end end
Make HowIs::Text actually work properly.
diff --git a/test/functional/events_controller_test.rb b/test/functional/events_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/events_controller_test.rb +++ b/test/functional/events_controller_test.rb @@ -30,14 +30,16 @@ end def test_index_as_xml - FactoryGirl.create(:event) - get :index, :format => "xml" - assert_response :success - assert_equal "application/xml", @response.content_type - [ - "single-day-event > id", - "single-day-event > name", - "single-day-event > date" - ].each { |key| assert_select key } + Timecop.freeze(Time.zone.local(2012, 5)) do + FactoryGirl.create(:event) + get :index, :format => "xml" + assert_response :success + assert_equal "application/xml", @response.content_type + [ + "single-day-event > id", + "single-day-event > name", + "single-day-event > date" + ].each { |key| assert_select key } + end end end
Fix year boundary test failure
diff --git a/lib/switch_user.rb b/lib/switch_user.rb index abc1234..def5678 100644 --- a/lib/switch_user.rb +++ b/lib/switch_user.rb @@ -2,7 +2,7 @@ if defined? Rails::Engine class Engine < Rails::Engine config.to_prepare do - ApplicationController.helper(SwitchUserHelper) + ActionView::Base.send :include, SwitchUserHelper end end else
Update Helper Initializer to prevent app start failure due to Helper naming errors from app helpers being initialized too early
diff --git a/lib/usps/client.rb b/lib/usps/client.rb index abc1234..def5678 100644 --- a/lib/usps/client.rb +++ b/lib/usps/client.rb @@ -5,11 +5,9 @@ def request(request, &block) server = server(request) - # The USPS documentation shows all requests as being GET requests, but - # the servers also appear to support POST. We're using POST here so we - # don't need to escape the request and to keep from running into any - # concerns with data length. - response = Typhoeus::Request.post(server, { + # Make the API request to the USPS servers. Used to support POST, now it's + # just GET request *grumble*. + response = Typhoeus::Request.get(server, { :timeout => USPS.config.timeout, :params => { "API" => request.api,
Switch from making POST requests to GET request as the USPS broke them. Thanks guys.
diff --git a/lib/jschema/validator/pattern.rb b/lib/jschema/validator/pattern.rb index abc1234..def5678 100644 --- a/lib/jschema/validator/pattern.rb +++ b/lib/jschema/validator/pattern.rb @@ -2,13 +2,19 @@ module Validator class Pattern < SimpleValidator private + + # Fix because of Rubinius + unless defined? PrimitiveFailure + class PrimitiveFailure < Exception + end + end self.keywords = ['pattern'] def validate_args(pattern) Regexp.new(pattern) true - rescue TypeError + rescue TypeError, PrimitiveFailure invalid_schema 'pattern', pattern end
Fix Pattern validator for rubinius
diff --git a/ffi-geos.gemspec b/ffi-geos.gemspec index abc1234..def5678 100644 --- a/ffi-geos.gemspec +++ b/ffi-geos.gemspec @@ -11,6 +11,7 @@ s.description = "An ffi wrapper for GEOS, a C++ port of the Java Topology Suite (JTS)." s.summary = s.description s.email = "dark.panda@gmail.com" + s.license = "MIT" s.extra_rdoc_files = [ "README.rdoc" ]
Add license details to gemspec.
diff --git a/lib/opsicle/commands/move_eip.rb b/lib/opsicle/commands/move_eip.rb index abc1234..def5678 100644 --- a/lib/opsicle/commands/move_eip.rb +++ b/lib/opsicle/commands/move_eip.rb @@ -9,11 +9,10 @@ def initialize(environment) @client = Client.new(environment) - @opsworks = @client.opsworks - @ec2 = @client.ec2 + @opsworks_adpater = OpsworksAdapter.new(@client) stack_id = @client.config.opsworks_config[:stack_id] @cli = HighLine.new - @stack = ManageableStack.new(@client.config.opsworks_config[:stack_id], @opsworks, @cli) + @stack = ManageableStack.new(stack_id, @opsworks_adpater.client, @cli) end def execute(options={})
Use opsworks-adatper in move eip
diff --git a/config/initializers/carrier_wave.rb b/config/initializers/carrier_wave.rb index abc1234..def5678 100644 --- a/config/initializers/carrier_wave.rb +++ b/config/initializers/carrier_wave.rb @@ -5,7 +5,7 @@ :provider => 'AWS', :aws_access_key_id => ENV['S3_ACCESS_KEY'], :aws_secret_access_key => ENV['S3_SECRET_KEY'], - :region => ENV[’S3_REGION’] + :region => ENV['S3_REGION'] } config.fog_directory = ENV['S3_BUCKET'] end
Fix error on Carrier Wave config
diff --git a/test/functional/campaigns_controller_test.rb b/test/functional/campaigns_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/campaigns_controller_test.rb +++ b/test/functional/campaigns_controller_test.rb @@ -19,8 +19,8 @@ end test "should show details for a single campaign" do - FactoryGirl.create :certification_campaign, name: 'data.gov.uk', user: @user - get :show, id: 'data.gov.uk' + campaign = FactoryGirl.create :certification_campaign, name: 'data.gov.uk', user: @user + get :show, id: campaign.id assert_response :success end
Fix tests for campaign lookup
diff --git a/junoser.gemspec b/junoser.gemspec index abc1234..def5678 100644 --- a/junoser.gemspec +++ b/junoser.gemspec @@ -22,7 +22,7 @@ spec.add_development_dependency "bundler", "~> 1.9" spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "activesupport" + spec.add_development_dependency "activesupport", "~> 4" spec.add_development_dependency "nokogiri" spec.add_development_dependency "test-unit" end
Use activesupport 4 as newer version 5 requires ruby 2.2.2
diff --git a/pager_duty-connection.gemspec b/pager_duty-connection.gemspec index abc1234..def5678 100644 --- a/pager_duty-connection.gemspec +++ b/pager_duty-connection.gemspec @@ -17,8 +17,8 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_dependency "faraday", "~> 0.8", "< 0.10" - gem.add_dependency "faraday_middleware", "~> 0.9.0" - gem.add_dependency "activesupport", ">= 3.2", "< 5.0" + gem.add_dependency "faraday", "~> 0.8", "< 1.0" + gem.add_dependency "faraday_middleware", "~> 0.8", "< 1.0" + gem.add_dependency "activesupport", ">= 3.2", "< 6.0" gem.add_dependency "hashie", ">= 1.2" end
Update deps for newer faraday and rails This will allow pager_duty-connection to be installed with newer versions of faraday and rails 5. I tested this locally against the latest faraday and rails with no issues.
diff --git a/db/migrate/078_add_textfilter_to_users.rb b/db/migrate/078_add_textfilter_to_users.rb index abc1234..def5678 100644 --- a/db/migrate/078_add_textfilter_to_users.rb +++ b/db/migrate/078_add_textfilter_to_users.rb @@ -1,6 +1,6 @@ class AddTextfilterToUsers < ActiveRecord::Migration def self.up - f = TextFilter.find(:first, :conditions => 'name = "none"') + f = TextFilter.find(:first, :conditions => ["name = ?", "none"]) add_column :users, :text_filter_id, :string, :default => f.id unless Blog.default.nil? @@ -16,4 +16,4 @@ def self.down remove_column :text_filter_id, :integer end -end+end
Make migration succeed on PostgreSQL Signed-off-by: Frédéric de Villamil <58692fd42329d32571d999fbcdd2ddd08a5186db@de-villamil.com>
diff --git a/app/views/polls/index.atom.builder b/app/views/polls/index.atom.builder index abc1234..def5678 100644 --- a/app/views/polls/index.atom.builder +++ b/app/views/polls/index.atom.builder @@ -4,7 +4,7 @@ feed.icon("/favicon.png") @polls.each do |poll| - feed.entry(poll) do |entry| + feed.entry(poll, :published => poll.node.created_at) do |entry| entry.title(poll.title) entry.content(poll_body(poll), :type => 'html') entry.author do |author|
Fix the Atom feed for polls
diff --git a/chef-repo/cookbooks/ganglia/metadata.rb b/chef-repo/cookbooks/ganglia/metadata.rb index abc1234..def5678 100644 --- a/chef-repo/cookbooks/ganglia/metadata.rb +++ b/chef-repo/cookbooks/ganglia/metadata.rb @@ -3,7 +3,7 @@ license "Apache 2.0" description "Installs/Configures ganglia - modified to work in the CHOReOS context by <lago@ime.usp.br>" long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.1.2" +version "0.1.3" %w{ debian ubuntu redhat centos fedora }.each do |os| supports os
Fix version number for ganglia recipe
diff --git a/test/hostedgraphite.rb b/test/hostedgraphite.rb index abc1234..def5678 100644 --- a/test/hostedgraphite.rb +++ b/test/hostedgraphite.rb @@ -0,0 +1,22 @@+require File.expand_path('../helper', __FILE__) + +class HostedGraphiteTest < Service::TestCase + def setup + @stubs = Faraday::Adapter::Test::Stubs.new + end + + def test_push + url = "/integrations/github/" + @stubs.post url do |env| + assert_equal "payload=%22payload%22&api_key=test", env[:body] + [200, {}, ''] + end + + svc = service :push, {'api_key' => 'test'}, 'payload' + svc.receive + end + + def service(*args) + super Service::Hostedgraphite, *args + end +end
Test script for Hosted Graphite integration
diff --git a/railitics.gemspec b/railitics.gemspec index abc1234..def5678 100644 --- a/railitics.gemspec +++ b/railitics.gemspec @@ -7,8 +7,8 @@ Gem::Specification.new do |s| s.name = "railitics" s.version = Railitics::VERSION - s.authors = ["TODO: Your name"] - s.email = ["TODO: Your email"] + s.authors = ["Steve Faulkner"] + s.email = ["southpolesteve@gmail.com"] s.homepage = "TODO" s.summary = "TODO: Summary of Railitics." s.description = "TODO: Description of Railitics."
Add some specifics about the author in the gemspec
diff --git a/Homebrew/mas.rb b/Homebrew/mas.rb index abc1234..def5678 100644 --- a/Homebrew/mas.rb +++ b/Homebrew/mas.rb @@ -0,0 +1,29 @@+class Mas < Formula + desc "Mac App Store command-line interface" + homepage "https://github.com/mas-cli/mas" + url "https://github.com/mas-cli/mas/archive/v1.3.1.tar.gz" + sha256 "9326058c9e572dd38df644313307805757d7ea6dfea8626e0f41c373ecbd46b5" + revision 1 + head "https://github.com/mas-cli/mas.git" + + bottle do + cellar :any_skip_relocation + sha256 "2d03fa8338e5a75ab8c93e6318607654306d17df3e747586a903d014bb102032" => :high_sierra + sha256 "9d50b4a359bbb100c341fff41a3690aa0c855b6651a1ac93ef4f6e974b9a7cd4" => :sierra + sha256 "05f5b0166c716896da57f0db781ae3f818dd2fbe561099f288b847c777687970" => :el_capitan + end + + depends_on :xcode => ["8.0", :build] + + def install + xcodebuild "-project", "mas-cli.xcodeproj", + "-scheme", "mas-cli", + "-configuration", "Release", + "SYMROOT=build" + bin.install "build/mas" + end + + test do + assert_equal version.to_s, shell_output("#{bin}/mas version").chomp + end +end
Add Homebrew formula from 1.3.1
diff --git a/roles/web.rb b/roles/web.rb index abc1234..def5678 100644 --- a/roles/web.rb +++ b/roles/web.rb @@ -19,7 +19,7 @@ :web => { :status => "online", :database_host => "db", - :readonly_database_host => "db" + :readonly_database_host => "db-slave" } )
Move thorn-03 back to ramoth
diff --git a/testing/file_helper.rb b/testing/file_helper.rb index abc1234..def5678 100644 --- a/testing/file_helper.rb +++ b/testing/file_helper.rb @@ -16,7 +16,7 @@ def clear_created_directories created_directories.each do |directory_path| - FileUtils.remove_entry(directory_path) + FileUtils.remove_entry(directory_path) if File.exist?(directory_path) end end
Make file cleanup more robust Now only deleting test directories if they still exist.
diff --git a/app/models/renalware/pathology/observation_descriptions_by_code_query.rb b/app/models/renalware/pathology/observation_descriptions_by_code_query.rb index abc1234..def5678 100644 --- a/app/models/renalware/pathology/observation_descriptions_by_code_query.rb +++ b/app/models/renalware/pathology/observation_descriptions_by_code_query.rb @@ -21,7 +21,7 @@ def verify_all_records_found(records) found_codes = records.map(&:code) - missing_records = found_codes - @codes | @codes - found_codes + missing_records = found_codes - @codes if missing_records.present? raise ActiveRecord::RecordNotFound.new("Missing records for #{missing_records}") end
Simplify logic of diff codes
diff --git a/rack-pretty_json.gemspec b/rack-pretty_json.gemspec index abc1234..def5678 100644 --- a/rack-pretty_json.gemspec +++ b/rack-pretty_json.gemspec @@ -14,4 +14,6 @@ gem.name = "rack-pretty_json" gem.require_paths = ["lib"] gem.version = Rack::PrettyJson::VERSION + + gem.add_dependency "yajl-ruby", "~> 1.1.0" end
Add yajl-ruby as a gem dependency.
diff --git a/spec/local_ski_report/formattable_spec.rb b/spec/local_ski_report/formattable_spec.rb index abc1234..def5678 100644 --- a/spec/local_ski_report/formattable_spec.rb +++ b/spec/local_ski_report/formattable_spec.rb @@ -15,7 +15,7 @@ describe '#numbered_collection' do it 'formats a collection into a numbered collection' do dc = DummyClass.new - region_collection = LocalSkiReport::Regions.all_states_in_region(2) + region_collection = LocalSkiReport::Region.all_states_in_region(2) expect(dc.numbered_collection(region_collection)).to eq(['1. Alaska', '2. Idaho', '3. Oregon', '4. Washington']) end end
Update to reference name change of LocalSkiReport::Region from previous class of ::Regions
diff --git a/spec/support/stub_current_user_helpers.rb b/spec/support/stub_current_user_helpers.rb index abc1234..def5678 100644 --- a/spec/support/stub_current_user_helpers.rb +++ b/spec/support/stub_current_user_helpers.rb @@ -0,0 +1,6 @@+module StubCurrentUserHelpers + def stub_current_user_with(user) + allow(controller).to(receive(:authenticate_user!)) + allow(controller).to(receive(:current_user).and_return(user)) + end +end
Add spec helper to stub current user
diff --git a/Casks/fontexplorer-x-pro.rb b/Casks/fontexplorer-x-pro.rb index abc1234..def5678 100644 --- a/Casks/fontexplorer-x-pro.rb +++ b/Casks/fontexplorer-x-pro.rb @@ -0,0 +1,7 @@+class FontexplorerXPro < Cask + url 'http://fex.linotype.com/download/mac/FontExplorerXPro402.dmg' + homepage 'http://www.fontexplorerx.com/' + version '4.0.2' + sha1 'de0e20d478ab4321212953cb851e784dbdd20904' + link 'FontExplorer X Pro.app' +end
Add new cask for FontExplorer X Pro
diff --git a/db/migrate/20141114110930_populate_host_paths_canonical_path.rb b/db/migrate/20141114110930_populate_host_paths_canonical_path.rb index abc1234..def5678 100644 --- a/db/migrate/20141114110930_populate_host_paths_canonical_path.rb +++ b/db/migrate/20141114110930_populate_host_paths_canonical_path.rb @@ -2,6 +2,8 @@ include ActionView::Helpers::DateHelper def up + Site.reset_column_information + record_offset = 0 batch_size = 5000 total_records = HostPath.where(canonical_path: nil).count
Make migration slightly more robust For some reason, when I dropped and migrated my database from scratch, this migration would fail because it was using a column definitions for the Site table which changed some time ago. Defining local copies of the models didn't fix the problem.
diff --git a/mongoid-encrypted-fields.gemspec b/mongoid-encrypted-fields.gemspec index abc1234..def5678 100644 --- a/mongoid-encrypted-fields.gemspec +++ b/mongoid-encrypted-fields.gemspec @@ -11,11 +11,14 @@ gem.description = 'A library for storing encrypted data in Mongo' gem.summary = 'Custom types for storing encrypted data' gem.homepage = 'https://github.com/KoanHealth/mongoid-encrypted-fields' + gem.license = "MIT" - gem.files = `git ls-files`.split($/) - gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } - gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) - gem.require_paths = ['lib'] + gem.required_ruby_version = ">= 1.9" + gem.required_rubygems_version = ">= 1.3.6" + + gem.files = Dir.glob("lib/**/*") + %w(CHANGELOG.md LICENSE.txt README.md Rakefile) + gem.test_files = Dir.glob("spec/**/*") + gem.require_path = 'lib' gem.add_dependency 'mongoid', '~> 3'
Update gemspec so we only publish what we really need to
diff --git a/test/load_generator.rb b/test/load_generator.rb index abc1234..def5678 100644 --- a/test/load_generator.rb +++ b/test/load_generator.rb @@ -0,0 +1,39 @@+#!/usr/bin/env ruby + +require 'mongo' +require "net/http" +require "uri" +require 'yaml' +require 'bson' +require 'json' + +config = YAML::load_file 'config.yaml' + +unless config['mongo']['username'].nil? + db = Mongo::Client.new(["#{config['mongo']['host']}:#{config['mongo']['port']}"], + :database => config['mongo']['db']) +else + db = Mongo::Client.new(["#{config['mongo']['host']}:#{config['mongo']['port']}"], + :database => config['mongo']['db'], + :user => config['mongo']['username'], + :password => config['mongo']['password']) +end + +db.database.collection_names +STDERR.puts "Connection to MongoDB: #{config['amqp']['host']} succeded" + +db['events'].find.each do |event| + + STDERR.write "Sending event id = #{event['id']} " + + resp = Net::HTTP.new('localhost', '4567').start do |client| + event.delete('_id') + request = Net::HTTP::Post.new('/') + request.body = event.to_h.to_json + request['Content-Type'] = 'application/json' + + client.request(request) + end + + STDERR.puts "done (#{resp.code})" +end
Load generator to test the webhook
diff --git a/features/step_definitions/admin_user_management_steps.rb b/features/step_definitions/admin_user_management_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/admin_user_management_steps.rb +++ b/features/step_definitions/admin_user_management_steps.rb @@ -0,0 +1,3 @@+Given /^a user with email "([^"]*)" exists$/ do |email| + @registered_user = Factory(:user, :email => email, :created_at => 2.days.ago, :last_sign_in_at => 1.day.ago, :updated_at => 5.hours.ago) +end
Add step for creating a user.
diff --git a/core/kernel/local_variables_spec.rb b/core/kernel/local_variables_spec.rb index abc1234..def5678 100644 --- a/core/kernel/local_variables_spec.rb +++ b/core/kernel/local_variables_spec.rb @@ -34,4 +34,15 @@ ScratchPad.recorded.should include(:a, :b) ScratchPad.recorded.length.should == 2 end + + it "includes only unique variable names" do + def local_var_method + a = 1 + 1.times do |;a| + return local_variables + end + end + + local_var_method.should == [:a] + end end
Add spec for dedup of shadowed local variables.
diff --git a/test/icinga/server_spec.rb b/test/icinga/server_spec.rb index abc1234..def5678 100644 --- a/test/icinga/server_spec.rb +++ b/test/icinga/server_spec.rb @@ -11,6 +11,9 @@ end it "should set the default host" do @icinga.options[:host].should match("localhost") + end + it "should set the default remote path" do + @icinga.options[:remote_path].should match("/icinga/cgi-bin/status.cgi") end end
Add test for remote path patch
diff --git a/reversal/lib/reversal.rb b/reversal/lib/reversal.rb index abc1234..def5678 100644 --- a/reversal/lib/reversal.rb +++ b/reversal/lib/reversal.rb @@ -19,10 +19,26 @@ module Reversal VERSION = "0.9.0" + @@klassmap = Hash.new do |h, k| + h[k] = { + :methods => [], + :includes => [], + :extends => [], + :super => nil, + } + end + def decompile(iseq) Reverser.new(iseq).to_ir.to_s end module_function :decompile + + def decompile_into(iseq, klass) + decompiled = self.decompile(iseq) + @@klassmap[klass][:methods] << decompiled + maybe_dump_iseq(iseq) + end + module_function :decompile_into end module Reversal
Add plumbing for decompiling into the internal state table
diff --git a/spec/helpers/admin/ideas_helper_spec.rb b/spec/helpers/admin/ideas_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/admin/ideas_helper_spec.rb +++ b/spec/helpers/admin/ideas_helper_spec.rb @@ -11,5 +11,5 @@ # end # end describe Admin::IdeasHelper do - pending "add some examples to (or delete) #{__FILE__}" + pending "implementation of Admin Idea Helper specs #{__FILE__}" end
Make Admin Ideas helper pending message more specific
diff --git a/spec/integration/custom_matcher_spec.rb b/spec/integration/custom_matcher_spec.rb index abc1234..def5678 100644 --- a/spec/integration/custom_matcher_spec.rb +++ b/spec/integration/custom_matcher_spec.rb @@ -0,0 +1,53 @@+require "dry-matcher" +require "dry-monads" + +RSpec.describe "Custom matcher" do + let(:transaction) { + Dry.Transaction(container: container, matcher: Test::CustomMatcher) do + step :process + step :validate + step :persist + end + } + + let(:container) { + { + process: -> input { Dry::Monads.Right(name: input["name"], email: input["email"]) }, + validate: -> input { input[:email].nil? ? Dry::Monads.Left(:email_required) : Dry::Monads.Right(input) }, + persist: -> input { Test::DB << input and Dry::Monads.Right(input) } + } + } + + before do + Test::DB = [] + Test::QUEUE = [] + + module Test + CustomMatcher = Dry::Matcher.new( + yep: Dry::Matcher::Case.new( + match: -> result { result.right? }, + resolve: -> result { result.value } + ), + nup: Dry::Matcher::Case.new( + match: -> result { result.left? }, + resolve: -> result { result.value.value } + ) + ) + end + end + + it "supports a custom matcher" do + matches = -> m { + m.yep { |v| "Yep! #{v[:email]}" } + m.nup { |v| "Nup. #{v.to_s}" } + } + + input = {"name" => "Jane", "email" => "jane@doe.com"} + result = transaction.(input, &matches) + expect(result).to eq "Yep! jane@doe.com" + + input = {"name" => "Jane"} + result = transaction.(input, &matches) + expect(result).to eq "Nup. email_required" + end +end
Add spec for custom matcher usage
diff --git a/lib/trees.rb b/lib/trees.rb index abc1234..def5678 100644 --- a/lib/trees.rb +++ b/lib/trees.rb @@ -22,7 +22,7 @@ end def self.sum_values(node) - as_string(node, "", ->(x){x.inject { |x,y| x+y}}) + as_string(node, "", ->(x){x.inject { |a,b| a + b }}) end end end
Fix bug in shadowing local variable x
diff --git a/lib/findrepos.rb b/lib/findrepos.rb index abc1234..def5678 100644 --- a/lib/findrepos.rb +++ b/lib/findrepos.rb @@ -7,4 +7,6 @@ def list puts Dir.glob('*/.git').map { |dir| Pathname.new(dir).dirname } end + + default_command :list end
Make list the default command
diff --git a/lib/dry/component/loader.rb b/lib/dry/component/loader.rb index abc1234..def5678 100644 --- a/lib/dry/component/loader.rb +++ b/lib/dry/component/loader.rb @@ -13,7 +13,7 @@ @identifier = input.to_s.gsub(loader.path_separator, loader.namespace_separator) if loader.default_namespace re = /^#{Regexp.escape(loader.default_namespace)}#{Regexp.escape(loader.namespace_separator)}/ - @identifier = @identifier.gsub(re, '') + @identifier = @identifier.sub(re, '') end @path = input.to_s.gsub(loader.namespace_separator, loader.path_separator)
Use sub instead of gsub We’re only ever going to make one substitution here
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index abc1234..def5678 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -9,5 +9,6 @@ :region => CFG.aws_region } config.fog_directory = CFG.aws_bucket + config.fog_public = false end end
Make all assets on S3 private by default
diff --git a/lib/onfido/configuration.rb b/lib/onfido/configuration.rb index abc1234..def5678 100644 --- a/lib/onfido/configuration.rb +++ b/lib/onfido/configuration.rb @@ -31,17 +31,13 @@ end def region + return unless api_key + first_bit = api_key.split("_")[0] - case first_bit - when "live", "test" # it's an old, regionless api-token - nil - else # it's a new token the first bit being the region - first_bit - end + return if %w(live test).include?(first_bit) - rescue - nil + first_bit end def endpoint
Swap a rescue for a nil check and remove case/when
diff --git a/lib/pliny/helpers/params.rb b/lib/pliny/helpers/params.rb index abc1234..def5678 100644 --- a/lib/pliny/helpers/params.rb +++ b/lib/pliny/helpers/params.rb @@ -28,10 +28,11 @@ end def indifferent_params_v2(data) - if data.respond_to?(:to_hash) - Sinatra::IndifferentHash[data.to_hash] - elsif data.respond_to?(:to_ary) - data.to_ary.map { |item| Sinatra::IndifferentHash[item] } + case data + when Hash + Sinatra::IndifferentHash[data] + when Array + data.map { |item| Sinatra::IndifferentHash[item] } else data end
Use hash conversion from Sinatra The original Sinatra v1 implementation was more restrictive, relying on explicit type-checking to determine how to convert params. To be safe, we'll do the same. And in effect, b/c we're always dealing with JSON-decoded data here, we'd not expect to see something other than Hash or Array.
diff --git a/rubygems-compile.gemspec b/rubygems-compile.gemspec index abc1234..def5678 100644 --- a/rubygems-compile.gemspec +++ b/rubygems-compile.gemspec @@ -7,9 +7,9 @@ s.required_rubygems_version = '>= 1.4.2' s.rubygems_version = '1.4.2' - s.summary = 'A rubygems post-install hook compile the gem' + s.summary = 'A rubygems post-install hook using the MacRuby compiler to compile gems' s.description = <<-EOS -A rubygems post-install hook compile the gem using the MacRuby compiler. +A rubygems post-install hook to compile gems using the MacRuby compiler. EOS s.authors = ['Mark Rada'] s.email = 'mrada@marketcircle.com'
Fix typos in the gemspec
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 @@ -2,23 +2,25 @@ require 'util/mount/miq_generic_mount_session' describe MiqGenericMountSession do + let(:prefix) { File.join(Dir.tmpdir, "miq_") } + it "#connect returns a string pointing to the mount point" do described_class.stub(:raw_disconnect) s = described_class.new(:uri => '/tmp/abc') s.logger = Logger.new("/dev/null") - expect(s.connect).to match(/\A\/tmp\/miq_\d{8}-\d{5}-\w+\z/) + expect(s.connect).to match(%r(\A#{prefix}\d{8}-\d{5}-\w+\z)) s.disconnect end context "#mount_share" do it "without :mount_point uses default temp directory as a base" do - expect(described_class.new(:uri => '/tmp/abc').mount_share).to match(/\A\/tmp\/miq_\d{8}-\d{5}-\w+\z/) + expect(described_class.new(:uri => '/tmp/abc').mount_share).to match(%r(\A#{prefix}\d{8}-\d{5}-\w+\z)) end it "with :mount_point uses specified directory as a base" do - expect(described_class.new(:uri => '/tmp/abc', :mount_point => "abc").mount_share).to match(/\Aabc\/miq_\d{8}-\d{5}-\w+\z/) + expect(described_class.new(:uri => '/tmp/abc', :mount_point => "xyz").mount_share).to match(%r(\Axyz/miq_\d{8}-\d{5}-\w+\z)) end it "is unique" do
Use %r() for the regex, use prefix to be platform independent
diff --git a/bdb.gemspec b/bdb.gemspec index abc1234..def5678 100644 --- a/bdb.gemspec +++ b/bdb.gemspec @@ -25,7 +25,5 @@ s.require_paths = ["lib", "ext"] s.test_files = Dir.glob('test/*.rb') - s.has_rdoc = true - s.rdoc_options = ["--main", "README.textile"] - s.extra_rdoc_files = ["README.textile"] + s.has_rdoc = false end
Remove the rdoc from the gemspec
diff --git a/test/console_runner_test.rb b/test/console_runner_test.rb index abc1234..def5678 100644 --- a/test/console_runner_test.rb +++ b/test/console_runner_test.rb @@ -27,14 +27,16 @@ output_buffer = StringIO.new app = Yarrow::ConsoleRunner.new ['yarrow', '-h'], output_buffer assert_equal SUCCESS, app.run_application - assert_equal "Yarrow 0.1.0\n", output_buffer.string + assert_includes output_buffer.string, "Yarrow 0.1.0\n" + assert_includes output_buffer.string, "Path to the generated documentation" end def test_help_message_long output_buffer = StringIO.new app = Yarrow::ConsoleRunner.new ['yarrow', '--help'], output_buffer assert_equal SUCCESS, app.run_application - assert_equal "Yarrow 0.1.0\n", output_buffer.string + assert_includes output_buffer.string, "Yarrow 0.1.0\n" + assert_includes output_buffer.string, "Path to the generated documentation" end end
Add expectations for help text output
diff --git a/core/app/models/comable/address.rb b/core/app/models/comable/address.rb index abc1234..def5678 100644 --- a/core/app/models/comable/address.rb +++ b/core/app/models/comable/address.rb @@ -12,7 +12,7 @@ class << self def find_or_clone(address) - find { |obj| obj.same_as? address } || address.clone + all.to_a.find { |obj| obj.same_as? address } || address.clone end end
Fix the test to work ActiveRecord::Relation#find => Array#find
diff --git a/app/models/ability.rb b/app/models/ability.rb index abc1234..def5678 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -16,6 +16,7 @@ can :manage, Mentor, id: mentor_id can :manage, Event, mentor_id: mentor_id can :manage, Team, team_mentors: { mentor_id: mentor_id } + can :manage, Rating, mentor_id: mentor_id end if user.member?
feat(rating): Add mentor abilities for ratings
diff --git a/skink.gemspec b/skink.gemspec index abc1234..def5678 100644 --- a/skink.gemspec +++ b/skink.gemspec @@ -10,7 +10,7 @@ gem.email = ["todd.thomas@openlogic.com"] gem.description = %q{A Ruby DSL for testing REST APIs.} gem.summary = %q{Skink is Capybara's smaller, more primitive companion.} - gem.homepage = "https://github.com/toddthomas/skink.git" + gem.homepage = "https://github.com/openlogic/skink" gem.add_dependency "rack-test" gem.add_dependency "openlogic-resourceful"
Switch homepage for gem to openlogic repo.
diff --git a/app/models/address.rb b/app/models/address.rb index abc1234..def5678 100644 --- a/app/models/address.rb +++ b/app/models/address.rb @@ -1,6 +1,7 @@ class Address < ActiveRecord::Base has_many :emails_sent, :class_name => "Email", :foreign_key => "from_address_id" has_many :deliveries + has_many :postfix_log_lines, :through => :deliveries has_many :emails_received, :through => :deliveries, :source => :email # All addresses that have been sent mail @@ -29,7 +30,7 @@ end def status - most_recent_log_line = PostfixLogLine.joins(:delivery => :address).where("address_id = ?", id).order("time DESC").first + most_recent_log_line = postfix_log_lines.order("time DESC").first most_recent_log_line ? most_recent_log_line.status : "unknown" end end
Use association instead of explicit join
diff --git a/modules/mongodb/spec/classes/mongodb_configure_replica_set_spec.rb b/modules/mongodb/spec/classes/mongodb_configure_replica_set_spec.rb index abc1234..def5678 100644 --- a/modules/mongodb/spec/classes/mongodb_configure_replica_set_spec.rb +++ b/modules/mongodb/spec/classes/mongodb_configure_replica_set_spec.rb @@ -1,13 +1,27 @@ require_relative '../../../../spec_helper' describe 'mongodb::configure_replica_set', :type => :class do - let(:params) {{ - 'members' => ['123.456.789.123', '987.654.321.012', '432.434.454.454:457'], - 'replicaset' => 'production', - }} + describe 'production' do + let(:params) {{ + 'members' => ['123.456.789.123', '987.654.321.012', '432.434.454.454:457'], + 'replicaset' => 'production', + }} - it { - should contain_file('/etc/mongodb/configure-replica-set.js').with_content( - /_id: "production"/) - } + it { + should contain_file('/etc/mongodb/configure-replica-set.js').with_content( + /_id: "production"/) + } + end + + describe 'development' do + let(:params) {{ + 'members' => ['123.456.789.123', '987.654.321.012', '432.434.454.454:457'], + 'replicaset' => 'development', + }} + + it { + should contain_file('/etc/mongodb/configure-replica-set.js').with_content( + /_id: "development"/) + } + end end
Add test for replicaset named development Not in previous commit as that also reformatted this class, so this makes the change here clearer.
diff --git a/test/sinatra_helper_test.rb b/test/sinatra_helper_test.rb index abc1234..def5678 100644 --- a/test/sinatra_helper_test.rb +++ b/test/sinatra_helper_test.rb @@ -23,7 +23,7 @@ get '/' assert last_response.ok? - assert last_response.body.include?('myapplication.cz'), "Response body should contain: myapplication.cz" + assert last_response.body.include?('application.com'), "Response body should contain: application.com" assert last_response.body.include?('thin_1'), "Response body should contain: thin_1" end
Fix errors in tests for Sinatra helpers
diff --git a/core/spec/screenshots/feed_spec.rb b/core/spec/screenshots/feed_spec.rb index abc1234..def5678 100644 --- a/core/spec/screenshots/feed_spec.rb +++ b/core/spec/screenshots/feed_spec.rb @@ -38,6 +38,7 @@ visit feed_path find('label[for=FeedChoice_Personal]').click + find('.feed-activity:first-child') assume_unchanged_screenshot 'feed' end end
Use personal feed in screenshot test as originally intended.
diff --git a/app/models/website.rb b/app/models/website.rb index abc1234..def5678 100644 --- a/app/models/website.rb +++ b/app/models/website.rb @@ -1,6 +1,6 @@ class Website < ActiveRecord::Base validates_uniqueness_of :google_analytics_code, :allow_blank => true - validates_format_of :google_analytics_code, :with => /\AUA-\d\d\d\d\d\d(\d)?-\d\Z/, :allow_blank => true + validates_format_of :google_analytics_code, :with => /\AUA-\d\d\d\d\d\d(\d)?(\d)?-\d\Z/, :allow_blank => true validates_presence_of :name # RBS WorldPay validations
Allow 6-8 digits in Google Analytics code (previously 6-7)
diff --git a/activejob_retriable.gemspec b/activejob_retriable.gemspec index abc1234..def5678 100644 --- a/activejob_retriable.gemspec +++ b/activejob_retriable.gemspec @@ -9,9 +9,9 @@ s.version = ActiveJob::Retriable::VERSION s.authors = ["Michael Coyne"] s.email = ["mikeycgto@gmail.com"] - s.homepage = "TODO" - s.summary = "TODO: Summary of ActivejobRetriable." - s.description = "TODO: Description of ActivejobRetriable." + s.homepage = "activejob-retriable.onsimplybuilt.com" + s.summary = "Automatically retries jobs" + s.description = "This gem aims to mimic most of the functionality of Sidekiq's RetryJobs middleware." s.license = "MIT" s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
Update gemspec to pass validation
diff --git a/spec/punit/on_spec.rb b/spec/punit/on_spec.rb index abc1234..def5678 100644 --- a/spec/punit/on_spec.rb +++ b/spec/punit/on_spec.rb @@ -32,7 +32,7 @@ %q{ set l [] on 'approve' - push l 'approved' + push l "$(msg.name)d($(sig))" push l 'requested' signal 'approve' push l 'done.' @@ -40,7 +40,7 @@ wait: true) expect(r['point']).to eq('terminated') - expect(r['vars']['l']).to eq(%w[ requested done. approved ]) + expect(r['vars']['l']).to eq(%w[ requested done. approved(approve) ]) end it 'traps signals and their payload' do
Include `on` $(sig) in spec
diff --git a/spec/unit/app_spec.rb b/spec/unit/app_spec.rb index abc1234..def5678 100644 --- a/spec/unit/app_spec.rb +++ b/spec/unit/app_spec.rb @@ -11,7 +11,8 @@ :password=>"password", :server=>"127.0.0.1", :__server=>true} - described_class.instance + # described_class.instance + Class.new(described_class).instance # bypass singleton } it "should be initialized with out raise" do evm_double = class_double("EventMachine").as_stubbed_const(:transfer_nested_constants => true).as_null_object
Fix app spec: find right way to test Singleton class
diff --git a/http-protocol.gemspec b/http-protocol.gemspec index abc1234..def5678 100644 --- a/http-protocol.gemspec +++ b/http-protocol.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "http-protocol" - s.version = '0.1.0.0' + s.version = '0.1.1.0' s.summary = "HTTP protocol library designed to facilitate custom HTTP clients" s.description = ' '
Package version is increased from 0.1.0.0 to 0.1.1.0
diff --git a/apns-s3.gemspec b/apns-s3.gemspec index abc1234..def5678 100644 --- a/apns-s3.gemspec +++ b/apns-s3.gemspec @@ -24,5 +24,5 @@ spec.add_development_dependency "bundler", "~> 1.13" spec.add_development_dependency "rake", "~> 12.0" spec.add_development_dependency "test-unit", "~> 3.2.1" - spec.add_development_dependency "coveralls", "~> 0.8.1" + spec.add_development_dependency "coveralls", "~> 0.8" end
Fix the coveralls version specification
diff --git a/test/fixtures/cookbooks/aws_test/recipes/instance_monitoring.rb b/test/fixtures/cookbooks/aws_test/recipes/instance_monitoring.rb index abc1234..def5678 100644 --- a/test/fixtures/cookbooks/aws_test/recipes/instance_monitoring.rb +++ b/test/fixtures/cookbooks/aws_test/recipes/instance_monitoring.rb @@ -5,3 +5,9 @@ aws_secret_access_key node['aws_test']['access_key'] action :enable end + +aws_instance_monitoring 'disable detailed monitoring' do + aws_access_key node['aws_test']['key_id'] + aws_secret_access_key node['aws_test']['access_key'] + action :disable +end
Disable instance monitoring in the suite as well
diff --git a/vmdb/app/models/file_depot.rb b/vmdb/app/models/file_depot.rb index abc1234..def5678 100644 --- a/vmdb/app/models/file_depot.rb +++ b/vmdb/app/models/file_depot.rb @@ -43,3 +43,6 @@ @file = file end end + +# load all plugins +Dir.glob(File.join(File.dirname(__FILE__), "file_depot_*.rb")).sort.each { |f| require_dependency f rescue true }
Make FileDepot eager-load all it's subclasses on load, in deterministic order, ignoring failures. Fixes problems in development mode where a (unrelated) class gets reloaded and suddenly FileDepot.supported_protocols is empty For more details, see https://github.com/ManageIQ/manageiq/pull/1276 The rescue true is to prevent failures with sub-subclasses, it should go away.
diff --git a/db/fixtures/lessons/git_lessons.rb b/db/fixtures/lessons/git_lessons.rb index abc1234..def5678 100644 --- a/db/fixtures/lessons/git_lessons.rb +++ b/db/fixtures/lessons/git_lessons.rb @@ -0,0 +1,18 @@+def git_lessons + { + 'A Deeper Look at Git' => { + title: 'A Deeper Look at Git', + description: 'Beyond just `$ git add` and `$ git commit`...', + is_project: false, + url: '/git/lesson_a_deeper_look_at_git.md', + identifier_uuid: '52b17564-0e1d-4c4f-adfa-acba53bf9126', + }, + 'Using Git in the Real World' => { + title: 'Using Git in the Real World', + description: "We've just scratched the surface, so here's what to be aware of as you start developing more and more using Git.", + is_project: false, + url: '/git/lesson_using_git_in_the_real_world.md', + identifier_uuid: 'c8b7ccc1-8a16-4545-9d46-b9091d45c6b4', + }, + } +end
Add git lessons fixture file
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -4,7 +4,7 @@ when 'rhel', 'fedora' node['platform_version'].to_f >= 6.0 ? ['cronie'] : ['vixie-cron'] when 'solaris2' - ['core-os'] + 'core-os' else [] end
Fix the installation of the core-os package on Solaris Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/shared/rakefiles/xk.rake b/shared/rakefiles/xk.rake index abc1234..def5678 100644 --- a/shared/rakefiles/xk.rake +++ b/shared/rakefiles/xk.rake @@ -19,14 +19,6 @@ Secrets.set_secrets(@secrets) - # GPII-3568 - This is a temporary "hack", to be removed once all our - # clusters are migrated to the regional ones. - sh_filter "sh -c ' - terragrunt_dir=\"live/#{@env}/k8s/cluster\" - if [ -d \"$terragrunt_dir\" ]; then - cd \"$terragrunt_dir\"; terragrunt state list | grep \"\.cluster$\" \ - && terragrunt state mv module.gke_cluster.google_container_cluster.cluster module.gke_cluster.google_container_cluster.cluster-regional; true - fi'" sh_filter "#{@exekube_cmd} #{args[:cmd]}", !args[:preserve_stderr].nil? if args[:cmd] end
GPII-3671: Clean up cluster migration code after GPII-3568
diff --git a/app/controllers/api/comments_controller.rb b/app/controllers/api/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/comments_controller.rb +++ b/app/controllers/api/comments_controller.rb @@ -18,7 +18,8 @@ end decorated_comment = CommentDecorator.new(comment) - respond_with decorated_comment, :location => api_comment_url(comment) + location = comment.persisted? ? api_comment_url(comment) : nil + respond_with decorated_comment, :location => location end def destroy
Fix :location for unsaved records
diff --git a/railyard.gemspec b/railyard.gemspec index abc1234..def5678 100644 --- a/railyard.gemspec +++ b/railyard.gemspec @@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "rake", "~> 10.3.2" + spec.add_development_dependency "rake", "~> 12.3.1" spec.add_dependency "bundler", "~> 1.16.4" spec.add_dependency "thor", "~> 0.19.4"
Update rake requirement from ~> 10.3.2 to ~> 12.3.1 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/commits/v12.3.1) Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/lib/unparser/emitter/literal/primitive.rb b/lib/unparser/emitter/literal/primitive.rb index abc1234..def5678 100644 --- a/lib/unparser/emitter/literal/primitive.rb +++ b/lib/unparser/emitter/literal/primitive.rb @@ -49,65 +49,6 @@ end end # Numeric - - # Literal emitter with macro regeneration base class - class MacroSafe < self - - private - - # Perform dispatch - # - # @return [undefined] - # - # @api private - # - def dispatch - if source == macro - write(macro) - return - end - write(value.inspect) - end - - # Return source, if present - # - # @return [String] - # if present - # - # @return [nil] - # otherwise - # - # @api private - # - def source - location = node.location || return - expression = location.expression || return - expression.source - end - - # Return marco - # - # @return [String] - # - # @api private - # - def macro - self.class::MACRO - end - - ## String macro safe emitter - #class String < self - # MACRO = '__FILE__'.freeze - # handle :str - #end # String - - ## Integer macro safe emitter - #class Integer < self - # MACRO = '__LINE__'.freeze - # handle :int - #end # Integer - - end # MacroSave end # Primitive end # Literal end # Emitter
Remove unused code for __FILE__ and __LINE__ macros
diff --git a/_plugins/block_tag.rb b/_plugins/block_tag.rb index abc1234..def5678 100644 --- a/_plugins/block_tag.rb +++ b/_plugins/block_tag.rb @@ -1,5 +1,5 @@ module Jekyll - class RenderTimeTagBlock < Liquid::Block + class BlockTag < Liquid::Block def initialize(tag_name, text, tokens) @type, @title = text.match(/\s*(\w+)\s+(?:\"(.*)\".*)?/im).captures super @@ -7,7 +7,6 @@ def render(context) text = super - # content = '<div class="block-content" markdown="1">' + text + '</div>' if @title id = @type.downcase() + ':' + Jekyll::Utils.slugify(@title) "<div class=\"block #{@type}\" id=\"#{id}\" markdown=\"block\">" + @@ -22,4 +21,4 @@ end end -Liquid::Template.register_tag('block', Jekyll::RenderTimeTagBlock) +Liquid::Template.register_tag('block', Jekyll::BlockTag)
Clean up block tag plugin implementation
diff --git a/ignition.gemspec b/ignition.gemspec index abc1234..def5678 100644 --- a/ignition.gemspec +++ b/ignition.gemspec @@ -15,6 +15,5 @@ s.test_files = Dir['test/**/*.rb', 'test/dummy/config.ru'] s.required_ruby_version = '>= 1.9.2' - s.add_dependency 'rails', '>= 3.0.0' + s.add_runtime_dependency 'rails', '~> 4.0' end -
Change minimum Rails version to 4.0.0.
diff --git a/lasp.gemspec b/lasp.gemspec index abc1234..def5678 100644 --- a/lasp.gemspec +++ b/lasp.gemspec @@ -18,6 +18,8 @@ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ["lib"] + spec.required_ruby_version = '~> 2.0' + spec.add_development_dependency "bundler", "~> 1.10" spec.add_development_dependency "rake", "~> 10.0" end
Add explicit dependency on Ruby 2 and above
diff --git a/app/controllers/audited_activerecord_reporting/audits_controller.rb b/app/controllers/audited_activerecord_reporting/audits_controller.rb index abc1234..def5678 100644 --- a/app/controllers/audited_activerecord_reporting/audits_controller.rb +++ b/app/controllers/audited_activerecord_reporting/audits_controller.rb @@ -7,10 +7,14 @@ @audits = AuditDecorator.decorate_collection(Audit.with_associated_for(@resource)).select do |audit_presenter| audit_presenter.visible? end + view_lookup_path = "#{@resource.class.to_s.underscore.plural}/audits/index" + render view_lookup_path if lookup_context.template_exists?(view_lookup_path) else @audits = AuditDecorator.decorate_collection(Audit.all).select do |audit_presenter| audit_presenter.visible? end + + render "/audits/index" if lookup_context.template_exists?("/audits/index") end end
Fix view paths to allow easy overrides
diff --git a/letter_opener.gemspec b/letter_opener.gemspec index abc1234..def5678 100644 --- a/letter_opener.gemspec +++ b/letter_opener.gemspec @@ -15,6 +15,11 @@ s.add_development_dependency 'rspec', '~> 3.5.0' s.add_development_dependency 'mail', '~> 2.6.0' - s.rubyforge_project = s.name s.required_rubygems_version = ">= 1.3.4" + + if s.respond_to?(:metadata) + s.metadata['changelog_uri'] = 'https://github.com/ryanb/letter_opener/blob/master/CHANGELOG.md' + s.metadata['source_code_uri'] = 'https://github.com/ryanb/letter_opener/' + s.metadata['bug_tracker_uri'] = 'https://github.com/ryanb/letter_opener/issues' + end end
Add CHANGELOG, bug tracker, code metadata Also: remove very defunct rubyforge reference