diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
---|---|
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
@@ -12,7 +12,6 @@
require 'active_record'
require 'test/unit'
-require 'rails'
require File.join(File.dirname(__FILE__), '..', 'lib', 'setler.rb')
@@ -37,4 +36,4 @@ t.string :name
end
end
-end+end
|
Remove unnecessary require that will be handled by Bundler
|
diff --git a/http-server.gemspec b/http-server.gemspec
index abc1234..def5678 100644
--- a/http-server.gemspec
+++ b/http-server.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
s.name = 'http-server'
- s.version = '0.2.0'
+ s.version = '0.2.1'
s.summary = 'Simple HTTP Server using http-protocol'
s.description = ' '
|
Package version is incremented from 0.2.0 to 0.2.1
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -10,6 +10,6 @@ Rails.application.secrets.freeagent_id,
Rails.application.secrets.freeagent_secret,
access_token: current_user.access_token
- )
+ ) unless current_user.nil?
end
end
|
Fix a bug in FreeAgent configuration when user is not logged in
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -4,6 +4,8 @@ protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
+ rescue_from ActiveRecord::RecordNotFound, with: :render_404
+ rescue_from ActiveSupport::MessageVerifier::InvalidSignature, with: :render_500
protected
@@ -19,4 +21,12 @@ head :forbidden
end
end
+
+ def render_404
+ render file: 'public/404.html', status: 404, layout: false
+ end
+
+ def render_500
+ render file: 'public/500.html', status: 500, layout: false
+ end
end
|
Switch to custom error pages, located in /public
* Design can be changed in related template
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -4,7 +4,7 @@ # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session
- $client = ThreeScale::Client.new(:provider_key => ENV["MYAPI_PROVIDER_KEY"])
+ $client = ThreeScale::Client.new(:provider_key => ENV['MYAPI_PROVIDER_KEY'])
def threescale_authenticate!
$response = $client.oauth_authorize(:app_id => params[:client_id])
|
Fix provider key environment var
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,7 +1,7 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
- protect_from_forgery with: :exception
+ protect_from_forgery with: :exception, prepend: true
before_action :authenticate_user!
before_action :set_profiler_access
|
Fix for Rails 5 + devise
|
diff --git a/app/decorators/caffeine/page_decorator.rb b/app/decorators/caffeine/page_decorator.rb
index abc1234..def5678 100644
--- a/app/decorators/caffeine/page_decorator.rb
+++ b/app/decorators/caffeine/page_decorator.rb
@@ -33,16 +33,5 @@ def parents_path
object.ancestry_path.tap(&:pop).join('/')
end
-
- def admin_list_classes
- offset = page.depth
- width = 12 - object.depth
-
- "col-md-#{width} col-md-offset-#{offset} col-xs-#{width} col-xs-offset-#{offset}"
- end
-
- def admin_row_classes
- page.root? ? 'widget' : 'widget no-margin--t no-border--t'
- end
end
end
|
Remove useless junk from PageDecorator
|
diff --git a/app/helpers/wellspring/markdown_helper.rb b/app/helpers/wellspring/markdown_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/wellspring/markdown_helper.rb
+++ b/app/helpers/wellspring/markdown_helper.rb
@@ -4,10 +4,7 @@ include ::Redcarpet::Render::SmartyPants
def block_code(code, language)
- sha = Digest::SHA1.hexdigest(code)
- Rails.cache.fetch ["code", language, sha].join('-') do
- Pygments.highlight(code, lexer: language)
- end
+ Pygments.highlight(code, lexer: language)
end
end
|
Remove cache from code blocks (for simplicity)
|
diff --git a/app/view_adapters/section_view_adapter.rb b/app/view_adapters/section_view_adapter.rb
index abc1234..def5678 100644
--- a/app/view_adapters/section_view_adapter.rb
+++ b/app/view_adapters/section_view_adapter.rb
@@ -4,26 +4,26 @@ extend ActiveModel::Naming
include ActiveModel::Conversion
- def initialize(manual, document)
+ def initialize(manual, section)
@manual = manual
- @document = document
- super(document)
+ @section = section
+ super(section)
end
def persisted?
- document.updated_at || document.published?
+ section.updated_at || section.published?
end
def minor_update
- document.draft? ? document.minor_update : false
+ section.draft? ? section.minor_update : false
end
def change_note
- document.draft? ? document.change_note : ""
+ section.draft? ? section.change_note : ""
end
def to_param
- document.id
+ section.id
end
def self.model_name
@@ -32,5 +32,5 @@
private
- attr_reader :manual, :document
+ attr_reader :manual, :section
end
|
Rename instance variable `document` -> `section`
|
diff --git a/lib/worms.rb b/lib/worms.rb
index abc1234..def5678 100644
--- a/lib/worms.rb
+++ b/lib/worms.rb
@@ -3,7 +3,7 @@ require 'rmagick'
require 'execjs'
-WIDTH, HEIGHT = 1024, 720
+WIDTH, HEIGHT = 1024, 640
NULL_PIXEL = Magick::Pixel.from_color('none')
|
Change the width of window
|
diff --git a/lib/agendor/entity.rb b/lib/agendor/entity.rb
index abc1234..def5678 100644
--- a/lib/agendor/entity.rb
+++ b/lib/agendor/entity.rb
@@ -2,23 +2,34 @@
class Entity < Agendor::Base
+ SUCCESS_RESPONSE_CODE = /2\d\d/
+
def create(params)
body = process_hash(params)
- HTTParty.post(resource_path, body: body.to_json, headers: headers)
+ response = HTTParty.post(resource_path, body: body.to_json, headers: headers)
+ raise EntityProcessingError, response unless response =~ SUCCESS_RESPONSE_CODE
end
def get(query)
HTTParty.get("#{resource_path}?q=#{query}", headers: headers)
+ raise EntityProcessingError, response unless response =~ SUCCESS_RESPONSE_CODE
end
def update(entity_id, params)
body = process_hash(params)
HTTParty.put("#{resource_path}/#{entity_id}", body: body.to_json, headers: headers)
+ raise EntityProcessingError, response unless response =~ SUCCESS_RESPONSE_CODE
end
def process_hash(params)
params.select {|k, v| hash_keys.include?(k) }
end
+ # This response should be raised when an error occurs
+ class EntityProcessingError < StandardError
+ def initialize(response)
+ @response = response
+ end
+ end
end
end
|
Raise a default response when an error occurs
|
diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb
index abc1234..def5678 100644
--- a/lib/alavetelitheme.rb
+++ b/lib/alavetelitheme.rb
@@ -29,4 +29,4 @@ require File.expand_path "../#{patch}", __FILE__
end
-$alaveteli_route_extensions << 'config/custom-routes.rb'
+$alaveteli_route_extensions << 'custom-routes.rb'
|
Correct path for custom routes
|
diff --git a/lib/api-pagination.rb b/lib/api-pagination.rb
index abc1234..def5678 100644
--- a/lib/api-pagination.rb
+++ b/lib/api-pagination.rb
@@ -11,6 +11,7 @@
case ApiPagination.paginator
when :kaminari
+ collection = Kaminari.paginate_array(collection) if collection.is_a?(Array)
collection.page(options[:page]).per(options[:per_page]).tap(&block)
when :will_paginate
collection.paginate(:page => options[:page], :per_page => options[:per_page]).tap(&block)
|
Use Kaminari.paginate_array when the collection is an Array
Signed-off-by: David Celis <[email protected]>
|
diff --git a/week-5/pad-array/my_solution.rb b/week-5/pad-array/my_solution.rb
index abc1234..def5678 100644
--- a/week-5/pad-array/my_solution.rb
+++ b/week-5/pad-array/my_solution.rb
@@ -1,15 +1,12 @@ # Pad an Array
-# I worked on this challenge [by myself, with: ]
+# I worked on this challenge with Bernice Chua.
# I spent [] hours on this challenge.
-
# Complete each step below according to the challenge directions and
# include it in this file. Also make sure everything that isn't code
# is commented in the file.
-
-
# 0. Pseudocode
|
Add pad array to GitHub
|
diff --git a/lib/gir_ffi/builders/null_convertor.rb b/lib/gir_ffi/builders/null_convertor.rb
index abc1234..def5678 100644
--- a/lib/gir_ffi/builders/null_convertor.rb
+++ b/lib/gir_ffi/builders/null_convertor.rb
@@ -1,3 +1,4 @@+# Argument convertor that does nothing
class GirFFI::Builders::NullConvertor
def initialize argument_name
@argument_name = argument_name
|
Add descriptive comment to NullConvertor
|
diff --git a/lib/shopify_app/webhooks_controller.rb b/lib/shopify_app/webhooks_controller.rb
index abc1234..def5678 100644
--- a/lib/shopify_app/webhooks_controller.rb
+++ b/lib/shopify_app/webhooks_controller.rb
@@ -19,7 +19,7 @@ def hmac_valid?(data)
secret = ShopifyApp.configuration.secret
digest = OpenSSL::Digest.new('sha256')
- ActiveSupport::SecurityUtils.secure_compare(
+ ActiveSupport::SecurityUtils.variable_size_secure_compare(
shopify_hmac,
Base64.encode64(OpenSSL::HMAC.digest(digest, secret, data)).strip
)
|
Use variable size secure compare
|
diff --git a/lib/tasks/copycopter_client_tasks.rake b/lib/tasks/copycopter_client_tasks.rake
index abc1234..def5678 100644
--- a/lib/tasks/copycopter_client_tasks.rake
+++ b/lib/tasks/copycopter_client_tasks.rake
@@ -4,4 +4,17 @@ CopycopterClient.deploy
puts "Successfully marked all blurbs as published."
end
+
+ desc "Export Copycopter blurbs to yaml."
+ task :export => :environment do
+ CopycopterClient.cache.sync
+
+ if yml = CopycopterClient.export
+ PATH = "config/locales/copycopter.yml"
+ File.new("#{Rails.root}/#{PATH}", 'w').write(yml)
+ puts "Successfully exported blurbs to #{PATH}."
+ else
+ puts "No blurbs have been cached."
+ end
+ end
end
|
Add rake task for exporting cache
|
diff --git a/sub_diff.gemspec b/sub_diff.gemspec
index abc1234..def5678 100644
--- a/sub_diff.gemspec
+++ b/sub_diff.gemspec
@@ -1,28 +1,22 @@-# -*- encoding: utf-8 -*-
-
-lib = File.expand_path('../lib/', __FILE__)
-$:.unshift lib unless $:.include?(lib)
-
-require 'sub_diff/version'
-require 'date'
+require File.expand_path('../lib/sub_diff/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'sub_diff'
s.version = SubDiff::Version
- s.date = Date.today
s.platform = Gem::Platform::RUBY
s.summary = 'Apply regular expression replacements to strings while presenting the result in a "diff" like format'
s.description = 'Allows you to apply regular expression replacements to strings while presenting the result in a "diff" like format'
s.author = 'Sean Huber'
- s.email = '[email protected]'
- s.homepage = 'http://github.com/shuber/sub_diff'
+ s.email = '[email protected]'
+ s.homepage = 'https://github.com/shuber/sub_diff'
+ s.license = 'MIT'
s.require_paths = ['lib']
s.files = Dir['{bin,lib}/**/*'] + %w(Gemfile MIT-LICENSE Rakefile README.rdoc)
s.test_files = Dir['test/**/*']
- s.add_dependency('respond_to_missing')
-end+ s.add_dependency 'respond_to_missing'
+end
|
Update gemspec based off abstract_class gem
|
diff --git a/lib/github_cli/api.rb b/lib/github_cli/api.rb
index abc1234..def5678 100644
--- a/lib/github_cli/api.rb
+++ b/lib/github_cli/api.rb
@@ -24,14 +24,28 @@ config = GithubCLI.config.data
api.oauth_token = config['user.token'] if config['user.token']
- if config['user.login'] && config['user.password']
- api.basic_auth = "#{config['user.login']}:#{config['user.password']}"
- end
- api.endpoint = config['core.endpoint'] if config['core.endpoint']
+
+ api.basic_auth = set_basic_auth(config, options)
+
+ api.endpoint = config['core.endpoint'] if config['core.endpoint']
+
if ENV['TEST_HOST']
api.endpoint = 'http://' + ENV['TEST_HOST']
end
api
+ end
+
+ # Set user basic authentication
+ #
+ # @api public
+ def set_basic_auth(config, options)
+ if options['login'] && options['password']
+ "#{options['login']}:#{options['password']}"
+ elsif config['user.login'] && config['user.password']
+ "#{config['user.login']}:#{config['user.password']}"
+ else
+ nil
+ end
end
# Procoess response and output to shell
|
Allow for basic auth setup.
|
diff --git a/lib/griddler/email.rb b/lib/griddler/email.rb
index abc1234..def5678 100644
--- a/lib/griddler/email.rb
+++ b/lib/griddler/email.rb
@@ -7,9 +7,11 @@ if params[:to]
@to = extract_address(params[:to], config.to)
end
+
if params[:from]
@from = extract_address(params[:from], :email)
end
+
@subject = params[:subject]
if params[:charsets]
|
Add some whitespace for readability
|
diff --git a/lib/heroku_san/api.rb b/lib/heroku_san/api.rb
index abc1234..def5678 100644
--- a/lib/heroku_san/api.rb
+++ b/lib/heroku_san/api.rb
@@ -9,7 +9,7 @@ def sh(app, *command)
preflight_check_for_cli
- cmd = (command + ['--app', app]).compact
+ cmd = (command + ['--app', app, "--exit-code"]).compact
show_command = cmd.join(' ')
$stderr.puts show_command if @debug
|
Add flag for exit code
|
diff --git a/lib/rohbau/runtime.rb b/lib/rohbau/runtime.rb
index abc1234..def5678 100644
--- a/lib/rohbau/runtime.rb
+++ b/lib/rohbau/runtime.rb
@@ -42,6 +42,15 @@ end
end
+ def notify_plugins(message, *args)
+ self.class.plugins.each do |name, _|
+ plugin = public_send(name)
+ if plugin.instance.respond_to? message
+ plugin.instance.public_send(message, *args)
+ end
+ end
+ end
+
def terminate_plugins
self.class.plugins.each do |name, _|
plugin = public_send(name)
|
Implement a notifier method on Runtime
|
diff --git a/lib/visdiff/config.rb b/lib/visdiff/config.rb
index abc1234..def5678 100644
--- a/lib/visdiff/config.rb
+++ b/lib/visdiff/config.rb
@@ -2,7 +2,7 @@
module Visdiff
class Config
- attr_accessor :base_url, :api_key
+ attr_accessor :base_url, :api_key, :debug
def initialize
end
@@ -12,6 +12,7 @@ @connection ||= Faraday.new(:url => base_url) do |faraday|
faraday.request :multipart
faraday.request :url_encoded
+ faraday.response :logger if debug
faraday.adapter Faraday.default_adapter
end
end
|
Add debug flag to turn on faraday logging
|
diff --git a/test/integration/test_multibyte_queries.rb b/test/integration/test_multibyte_queries.rb
index abc1234..def5678 100644
--- a/test/integration/test_multibyte_queries.rb
+++ b/test/integration/test_multibyte_queries.rb
@@ -10,6 +10,7 @@ def test_posts_multibyte_queries_properly
ret = clients.map do |client|
res = client.list_matching_products('félix guattari machinic eros')
+ res.body.force_encoding 'UTF-8' if defined? Ox # Ox workaround
res.parse
end
assert ret.map(&:to_s).join.include?('Félix')
|
Work around Ox not parsing multibyte characters
|
diff --git a/libraries/matchers.rb b/libraries/matchers.rb
index abc1234..def5678 100644
--- a/libraries/matchers.rb
+++ b/libraries/matchers.rb
@@ -32,4 +32,12 @@ def add_php_pear_channel(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:php_pear_channel, :add, resource_name)
end
+
+ ChefSpec.define_matcher :php_fpm_pool
+ def install_php_fpm_pool(resource_name)
+ ChefSpec::Matchers::ResourceMatcher.new(:php_fpm_pool, :install, resource_name)
+ end
+ def uninstall_php_fpm_pool(resource_name)
+ ChefSpec::Matchers::ResourceMatcher.new(:php_fpm_pool, :uninstall, resource_name)
+ end
end
|
Add matcher for php_fpm_pool LWRP
|
diff --git a/lib/cannon/route.rb b/lib/cannon/route.rb
index abc1234..def5678 100644
--- a/lib/cannon/route.rb
+++ b/lib/cannon/route.rb
@@ -44,17 +44,26 @@
def initialize(app, action:, callback:)
@app, @action, @callback = app, action, callback
+ end
- callback do
- @callback.run(@request, @response) unless @callback.nil?
+ def run(request, response)
+ puts "Running action #{@action}"
+ @app.actions_binding.send(@action, request, response)
+ if response.sent?
+ fail
+ else
+ setup_callback
+ succeed(request, response)
end
end
- def run(request, response)
- @request, @response = request, response
- puts "Running action #{@action}"
- @app.actions_binding.send(@action, request, response)
- @response.sent? ? self.fail : self.succeed
+ private
+
+ def setup_callback
+ set_deferred_status nil
+ callback do |request, response|
+ @callback.run(request, response) unless @callback.nil?
+ end
end
end
end
|
Fix bug with RouteAction so that RouteActions will run multiple times correctly
|
diff --git a/lib/forem/engine.rb b/lib/forem/engine.rb
index abc1234..def5678 100644
--- a/lib/forem/engine.rb
+++ b/lib/forem/engine.rb
@@ -23,7 +23,7 @@ end
require 'simple_form'
-require 'emoji/railtie'
+require 'emoji'
require 'select2-rails'
# We need one of the two pagination engines loaded by this point.
|
Remove deprecation warning for emoji
|
diff --git a/Casks/font-fira-mono.rb b/Casks/font-fira-mono.rb
index abc1234..def5678 100644
--- a/Casks/font-fira-mono.rb
+++ b/Casks/font-fira-mono.rb
@@ -1,8 +1,8 @@ class FontFiraMono < Cask
- url 'http://dev.carrois.com/wordpress/wp-content/uploads/downloads/fira_3105/FiraMono3105.zip'
+ url 'http://dev.carrois.com/wordpress/wp-content/uploads/downloads/fira_3_1/FiraMono3106.zip'
homepage 'http://dev.carrois.com/fira-3-1/'
- version '3.105'
- sha256 '13e70891bbf2e479b9d379539b780224c8214362d9cb18c5618ea313a19a498d'
- font 'FiraMono3105/OTF/FiraMono-Regular.otf'
- font 'FiraMono3105/OTF/FiraMono-Bold.otf'
+ version '3.106'
+ sha256 '1c0aca0b346f3353c8cbb52dcbe0e98986ab76e3b50c9021547d328c4320803a'
+ font 'FiraMono3106/OTF/FiraMono-Bold.otf'
+ font 'FiraMono3106/OTF/FiraMono-Regular.otf'
end
|
Update Fira Mono to 3.106
|
diff --git a/Casks/mysqlworkbench.rb b/Casks/mysqlworkbench.rb
index abc1234..def5678 100644
--- a/Casks/mysqlworkbench.rb
+++ b/Casks/mysqlworkbench.rb
@@ -1,6 +1,6 @@ cask :v1 => 'mysqlworkbench' do
- version '6.3.3'
- sha256 '2ba28b163f88bd6d3a43df8236f351bc43d8fe3d21936424fcb395bb9d56e1a6'
+ version '6.3.4'
+ sha256 'af214391dfc9c6bdb7640bf286732ce7d4500721906d9a0ad3b107db8f15e57a'
url "https://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-workbench-community-#{version}-osx-x86_64.dmg"
name 'MySQL Workbench'
|
Update MySQL Workbench to 6.3.4
|
diff --git a/recipes/_nginx.rb b/recipes/_nginx.rb
index abc1234..def5678 100644
--- a/recipes/_nginx.rb
+++ b/recipes/_nginx.rb
@@ -1,7 +1,7 @@ include_recipe 'nginx_server::default'
nginx_server_vhost 'yumserver' do
- listen [{'ipaddress': '0.0.0.0'}]
+ listen [{'ipaddress' => '0.0.0.0'}]
server_name [node['hostname'], node['fqdn']]
root node['yumserver']['basepath']
config ({
|
Fix hash syntax in nginx syntax
|
diff --git a/lib/pycall/tuple.rb b/lib/pycall/tuple.rb
index abc1234..def5678 100644
--- a/lib/pycall/tuple.rb
+++ b/lib/pycall/tuple.rb
@@ -38,5 +38,17 @@ value = Conversions.from_ruby(value)
LibPython.PyTuple_SetItem(__pyobj__, index, value)
end
+
+ def to_a
+ [].tap do |ary|
+ i, n = 0, length
+ while i < n
+ ary << self[i]
+ i += 1
+ end
+ end
+ end
+
+ alias to_ary to_a
end
end
|
Support to_a and to_ary in PyCall::Tuple
|
diff --git a/lib/netsuite/records/item_fulfillment_package_list.rb b/lib/netsuite/records/item_fulfillment_package_list.rb
index abc1234..def5678 100644
--- a/lib/netsuite/records/item_fulfillment_package_list.rb
+++ b/lib/netsuite/records/item_fulfillment_package_list.rb
@@ -5,23 +5,23 @@ include Support::Records
include Namespaces::TranSales
- fields :item
+ fields :package
def initialize(attributes = {})
initialize_from_attributes_hash(attributes)
end
- def item=(items)
- case items
+ def package=(packages)
+ case packages
when Hash
- self.items << ItemFulfillmentPackage.new(items)
+ self.packages << ItemFulfillmentPackage.new(packages)
when Array
- items.each { |item| self.items << ItemFulfillmentPackage.new(item) }
+ packages.each { |package| self.packages << ItemFulfillmentPackage.new(package) }
end
end
- def items
- @items ||= []
+ def packages
+ @packages ||= []
end
def to_record
|
Fix attributes :key name on ItemFulfillmentPackageList
|
diff --git a/lib/redimap/base.rb b/lib/redimap/base.rb
index abc1234..def5678 100644
--- a/lib/redimap/base.rb
+++ b/lib/redimap/base.rb
@@ -5,7 +5,7 @@ end
def self.configure
- yield @config
+ yield self.config
end
def self.queue_new_mailboxes_uids
|
Fix .configure use of @config instead of .config.
Otherwise, attempting to use `.configure` without having called
`.config` first will fail, as `@config` won't exist.
|
diff --git a/config/initializers/tire.rb b/config/initializers/tire.rb
index abc1234..def5678 100644
--- a/config/initializers/tire.rb
+++ b/config/initializers/tire.rb
@@ -1,11 +1,4 @@-if Rails.env.production?
- Tire.configure {
- url "http://support.cluster:9200"
- logger Rails.root.join("log/tire_#{Rails.env}.log")
- }
-else
- Tire.configure {
- url "http://localhost:9200"
- logger Rails.root.join("log/tire_#{Rails.env}.log")
- }
-end
+Tire.configure {
+ url "http://localhost:9200"
+ logger Rails.root.join("log/tire_#{Rails.env}.log")
+}
|
Remove reference to legacy support.cluster machine
This initializer is now specified in alphagov-deployment, so it is only
used here in development now. We are trying to encourage apps to move
away from support.cluster.
|
diff --git a/db/migrate/20160815160730_create_functions.rb b/db/migrate/20160815160730_create_functions.rb
index abc1234..def5678 100644
--- a/db/migrate/20160815160730_create_functions.rb
+++ b/db/migrate/20160815160730_create_functions.rb
@@ -3,8 +3,8 @@ create_table :functions do |t|
t.belongs_to :user, foreign_key: true
t.belongs_to :role, foreign_key: true
- t.datetime :assumed_at
- t.datetime :vacated_at
+ t.date :assumed_at
+ t.date :vacated_at
t.timestamps
end
|
Change duration time for functions to date
|
diff --git a/resources/cask.rb b/resources/cask.rb
index abc1234..def5678 100644
--- a/resources/cask.rb
+++ b/resources/cask.rb
@@ -24,7 +24,6 @@ alias_method :action_uncask, :action_uninstall
def casked?
- shell_out('/usr/local/bin/brew cask list 2>/dev/null').stdout.split.include?(name)
- shell_out('/usr/local/bin/brew cask list 2>/dev/null', user: Homebrew.owner).stdout.split.include?(name)
+ shell_out('/usr/local/bin/brew cask list 2>/dev/null', user: homebrew_owner).stdout.split.include?(name)
end
end
|
Remove double shellout from a bad merge
Signed-off-by: Tim Smith <[email protected]>
|
diff --git a/lib/ethos/entity.rb b/lib/ethos/entity.rb
index abc1234..def5678 100644
--- a/lib/ethos/entity.rb
+++ b/lib/ethos/entity.rb
@@ -1,7 +1,7 @@ module Ethos
module Entity
module ClassMethods
- def attribute(attr, options = {})
+ def attribute(attr, default: nil)
reader = :"#{attr}"
writer = :"#{attr}="
@@ -15,7 +15,7 @@
attributes << attr
- defaults[attr] = options[:default] if options[:default]
+ defaults[attr] = default if default
end
def attributes
|
Use a keyword argument instead of an options hash.
|
diff --git a/lib/myhub/github.rb b/lib/myhub/github.rb
index abc1234..def5678 100644
--- a/lib/myhub/github.rb
+++ b/lib/myhub/github.rb
@@ -4,5 +4,11 @@ base_uri "https://api.github.com"
# Your code here too!
+ def initialize
+ @headers = {
+ "Authorization" => "token #{ENV["AUTH_TOKEN"]}",
+ "User-Agent" => "HTTParty"
+ }
+ end
end
end
|
Add initializer to pull auth token from ENV.
|
diff --git a/spec/integration/fog/login_spec.rb b/spec/integration/fog/login_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/fog/login_spec.rb
+++ b/spec/integration/fog/login_spec.rb
@@ -1,16 +1,13 @@ require 'spec_helper'
describe Vcloud::Fog::Login do
- let!(:mock_env) { ENV.clone }
-
before(:each) do
- stub_const('ENV', mock_env)
+ stub_const('ENV', {})
end
describe "#token" do
context "unable to load credentials" do
it "should raise an exception succinctly listing the missing credentials" do
- mock_env.clear
::Fog.credential = 'null'
::Fog.credentials_path = '/dev/null'
|
Replace ENV.clone mock with empty hash
ENV.clone only performs a shallow-copy of the ENV object. Which means that
`mock_env.clear` wipes the real ENV object and affects other tests that run
after this.
We didn't notice it because this is currently the last test picked up by
`rake integration`, but when we attempted to move it in #108 it made all of
the other tests fail. This can also be tested by placing the following at
the end of this spec file:
describe 'after' do
it { expect(ENV.to_hash).to_not eq({}) }
end
Replace it with an empty hash. While this isn't truly the same as the ENV
object because it doesn't implement all of the same methods it should
suffice for the things that Fog needs.
I don't think the `login_manual.rb` test is affected because it uses
`ENV.to_hash` instead. However, since this test it only run manually, I
don't think it matters that much right now.
|
diff --git a/build-scripts/emscripten/config.rb b/build-scripts/emscripten/config.rb
index abc1234..def5678 100644
--- a/build-scripts/emscripten/config.rb
+++ b/build-scripts/emscripten/config.rb
@@ -1,23 +1,23 @@ #!/usr/bin/false
NAME = "emscripten"
-VERSION = "1.38.11"
+VERSION = "1.38.19"
RELEASE = "1"
FILES = [
[
"https://github.com/kripken/emscripten/archive/#{VERSION}.tar.gz",
- "5521e8eefbee284b6a72797c7f63ce606d37647930cd8f4d48d45d02c4e1da95",
+ "4bdb7932f084171e40b405b4ab5e60aa7adb36ae399ba88c967e66719fc2d1e2",
"emscripten-#{VERSION}.tgz"
],
[
"https://github.com/kripken/emscripten-fastcomp/archive/#{VERSION}.tar.gz",
- "55ddc1b1f045a36ac34ab60bb0e1a0370a40249eba8d41cd4e427be95beead18",
+ "19943b4299e4309fc7810e785ee0e38a15059c7a54d9451b2e0ed29f9573a29d",
"emscripten_fastcomp-#{VERSION}.tgz"
],
[
"https://github.com/kripken/emscripten-fastcomp-clang/archive/#{VERSION}.tar.gz",
- "1d2ac9f8dab54f0f17e4a77c3cd4653fe9f890831ef6e405320850fd7351f795",
+ "fbfb90f5d521fec143952a1b261a55ced293551f6753768f80499fb87bd876ca",
"emscripten_fastcomp_clang-#{VERSION}.tgz"
]
]
|
Update build scripts for Emscripten 1.38.19
|
diff --git a/lib/buffet/slave.rb b/lib/buffet/slave.rb
index abc1234..def5678 100644
--- a/lib/buffet/slave.rb
+++ b/lib/buffet/slave.rb
@@ -9,7 +9,8 @@ end
def rsync src, dest
- Buffet.run! 'rsync', '-aqz', '--delete', rsync_exclude_flags,
+ Buffet.run! 'rsync', '-aqz', '--delete',
+ '--delete-excluded', rsync_exclude_flags,
'-e', 'ssh', src, "#{user_at_host}:#{dest}"
end
|
Delete excluded project files on remote
While we weren't syncing files specified in the filter file, we were
also not deleting any old copies of these files if they already existed
on the remote. This could potentially have been bad if the log files
grew to exceptionally large sizes over time.
Adding the --delete-excluded flag to the rsync call takes care of this
problem for us.
Change-Id: I7e5026e8c485b65299b24726bcc390c70b1ed375
Reviewed-on: https://gerrit.causes.com/1854
Tested-by: Shane da Silva <[email protected]>
Reviewed-by: Greg Hurrell <[email protected]>
|
diff --git a/lib/quiet_opener.rb b/lib/quiet_opener.rb
index abc1234..def5678 100644
--- a/lib/quiet_opener.rb
+++ b/lib/quiet_opener.rb
@@ -5,7 +5,7 @@ begin
result = open(url).read.strip
rescue OpenURI::HTTPError, SocketError, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EHOSTUNREACH
- logger.warn("Unable to open third-party URL #{url}")
+ Rails.logger.warn("Unable to open third-party URL #{url}")
result = ""
end
return result
@@ -22,12 +22,12 @@ result_body = response.body
}
rescue OpenURI::HTTPError, SocketError, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EHOSTUNREACH
- logger.warn("Unable to reach host #{host}")
+ Rails.logger.warn("Unable to reach host #{host}")
end
if result == "200"
- logger.info("Purged URL #{url} at #{host}: #{result}")
+ Rails.logger.info("Purged URL #{url} at #{host}: #{result}")
else
- logger.warn("Unable to purge URL #{url} at #{host}: status #{result}")
+ Rails.logger.warn("Unable to purge URL #{url} at #{host}: status #{result}")
end
return result
end
|
Use explicit `Rails.logger` (as we're not inheriting from ActiveRecord)
|
diff --git a/lib/fog/openstack/requests/volume/list_snapshots.rb b/lib/fog/openstack/requests/volume/list_snapshots.rb
index abc1234..def5678 100644
--- a/lib/fog/openstack/requests/volume/list_snapshots.rb
+++ b/lib/fog/openstack/requests/volume/list_snapshots.rb
@@ -2,18 +2,19 @@ module Volume
class OpenStack
class Real
- def list_snapshots(detailed=true)
+ def list_snapshots(detailed=true, options={})
path = detailed ? 'snapshots/detail' : 'snapshots'
request(
:expects => 200,
:method => 'GET',
- :path => path
+ :path => path,
+ :query => options
)
end
end
class Mock
- def list_snapshots(detailed=true)
+ def list_snapshots(detailed=true, options={})
response = Excon::Response.new
response.status = 200
response.body = {
|
Allow passing query options to snapshots endpoint.
|
diff --git a/utils/wrapper.rb b/utils/wrapper.rb
index abc1234..def5678 100644
--- a/utils/wrapper.rb
+++ b/utils/wrapper.rb
@@ -27,6 +27,12 @@ errors.each {|error| STDERR.puts " * #{error}"}
STDERR.puts
end
+
+ def handle_invalid_json(line)
+ STDERR.puts
+ STDERR.puts "The following line is invalid JSON:"
+ STDERR.puts line
+ end
end
runner = TurbotRunner::Runner.new(
|
Handle invalid JSON produced by scraper
|
diff --git a/ComponentKit.podspec b/ComponentKit.podspec
index abc1234..def5678 100644
--- a/ComponentKit.podspec
+++ b/ComponentKit.podspec
@@ -1,16 +1,14 @@ Pod::Spec.new do |s|
- s.name = "ComponentKit"
- s.version = "0.15"
- s.summary = "A React-inspired view framework for iOS"
- s.homepage = "https://componentkit.org"
+ s.name = 'ComponentKit'
+ s.version = '0.15'
+ s.license = 'BSD'
+ s.summary = 'A React-inspired view framework for iOS'
+ s.homepage = 'https://componentkit.org'
+ s.social_media_url = 'https://twitter.com/componentkit'
s.authors = '[email protected]'
- s.license = 'BSD'
- s.source = {
- :git => "https://github.com/facebook/ComponentKit.git",
- :tag => s.version.to_s
- }
- s.social_media_url = 'https://twitter.com/componentkit'
- s.platform = :ios, '7.0'
+ s.source = { :git => 'https://github.com/facebook/ComponentKit.git', :tag => s.version.to_s }
+ s.ios.deployment_target = '8.1'
+ s.tvos.deployment_target = '9.1'
s.requires_arc = true
s.source_files = 'ComponentKit/**/*', 'ComponentTextKit/**/*'
s.frameworks = 'UIKit', 'CoreText'
|
Add tvOS as a deployment target to the Podspec
|
diff --git a/lib/dotties-core.rb b/lib/dotties-core.rb
index abc1234..def5678 100644
--- a/lib/dotties-core.rb
+++ b/lib/dotties-core.rb
@@ -8,6 +8,7 @@ require_relative './dotties-core/adapters/require'
require_relative './dotties-core/adapters/symlink_first'
+require_relative './dotties-core/formats/bin'
require_relative './dotties-core/formats/gitconfig'
require_relative './dotties-core/formats/tmux_conf'
require_relative './dotties-core/formats/vimrc'
|
Allow bin directory to be symlinked.
|
diff --git a/scientist.gemspec b/scientist.gemspec
index abc1234..def5678 100644
--- a/scientist.gemspec
+++ b/scientist.gemspec
@@ -5,7 +5,7 @@ gem.description = "A Ruby library for carefully refactoring critical paths"
gem.version = Scientist::VERSION
gem.authors = ["GitHub Open Source", "John Barnette", "Rick Bradley"]
- gem.email = ["[email protected]", "[email protected]", "[email protected]"]
+ gem.email = ["[email protected]", "[email protected]", "[email protected]"]
gem.summary = "Carefully test, measure, and track refactored code."
gem.homepage = "https://github.com/github/scientist"
gem.license = "MIT"
|
Use a working email address for me
Otherwise technoweenie will get my spam.
|
diff --git a/lib/what/monitor.rb b/lib/what/monitor.rb
index abc1234..def5678 100644
--- a/lib/what/monitor.rb
+++ b/lib/what/monitor.rb
@@ -39,6 +39,8 @@ if status["error"]
status["failures"] = mod[:failures]
+ puts "Error in module:\n#{YAML.dump(status)}"
+
if mod[:failures] < 6
mod[:failures] += 1
mod[:module].async.start_monitoring
|
Add logging on module error
|
diff --git a/lib/window_rails.rb b/lib/window_rails.rb
index abc1234..def5678 100644
--- a/lib/window_rails.rb
+++ b/lib/window_rails.rb
@@ -1,5 +1,5 @@ require 'window_rails/version'
if(defined?(Rails))
- require File.join(File.dirname(__FILE__), '..', 'init')
+ require 'window_rails/engine'
end
|
Load the engine if we are in Rails
|
diff --git a/nilify_blanks.gemspec b/nilify_blanks.gemspec
index abc1234..def5678 100644
--- a/nilify_blanks.gemspec
+++ b/nilify_blanks.gemspec
@@ -5,6 +5,7 @@ Gem::Specification.new do |s|
s.name = "nilify_blanks"
s.version = NilifyBlanks::VERSION
+ s.license = 'MIT'
s.author = "Ben Hughes"
s.email = "[email protected]"
s.homepage = "http://github.com/rubiety/nilify_blanks"
|
Add MIT license to the gemspec.
|
diff --git a/command_line/dash_encoding_spec.rb b/command_line/dash_encoding_spec.rb
index abc1234..def5678 100644
--- a/command_line/dash_encoding_spec.rb
+++ b/command_line/dash_encoding_spec.rb
@@ -1,29 +1,30 @@ require_relative '../spec_helper'
-describe 'The --encoding command line option' do
+describe "The --encoding command line option" do
before :each do
@test_string = "print [Encoding.default_external.name, Encoding.default_internal&.name].inspect"
+ @enc2 = Encoding::ISO_8859_1
end
- describe 'sets Encoding.default_external and optionally Encoding.default_internal' do
+ describe "sets Encoding.default_external and optionally Encoding.default_internal" do
it "if given a single encoding with an =" do
- ruby_exe(@test_string, options: '--disable-gems --encoding=big5').should == [Encoding::Big5.name, nil].inspect
+ ruby_exe(@test_string, options: "--disable-gems --encoding=big5").should == [Encoding::Big5.name, nil].inspect
end
it "if given a single encoding as a separate argument" do
- ruby_exe(@test_string, options: '--disable-gems --encoding big5').should == [Encoding::Big5.name, nil].inspect
+ ruby_exe(@test_string, options: "--disable-gems --encoding big5").should == [Encoding::Big5.name, nil].inspect
end
it "if given two encodings with an =" do
- ruby_exe(@test_string, options: '--disable-gems --encoding=big5:utf-32be').should == [Encoding::Big5.name, Encoding::UTF_32BE.name].inspect
+ ruby_exe(@test_string, options: "--disable-gems --encoding=big5:#{@enc2}").should == [Encoding::Big5.name, @enc2.name].inspect
end
it "if given two encodings as a separate argument" do
- ruby_exe(@test_string, options: '--disable-gems --encoding big5:utf-32be').should == [Encoding::Big5.name, Encoding::UTF_32BE.name].inspect
+ ruby_exe(@test_string, options: "--disable-gems --encoding big5:#{@enc2}").should == [Encoding::Big5.name, @enc2.name].inspect
end
end
it "does not accept a third encoding" do
- ruby_exe(@test_string, options: '--disable-gems --encoding big5:utf-32be:utf-32le', args: '2>&1').should =~ /extra argument for --encoding: utf-32le/
+ ruby_exe(@test_string, options: "--disable-gems --encoding big5:#{@enc2}:utf-32le", args: "2>&1").should =~ /extra argument for --encoding: utf-32le/
end
end
|
Fix the --encoding spec to use an ASCII-compatible encoding
* Patch based on @MSP-Greg fix in
https://github.com/MSP-Greg/ruby/commit/91e8e2abab0576b5e04066a2d19962d241a3f080
|
diff --git a/simplecov.gemspec b/simplecov.gemspec
index abc1234..def5678 100644
--- a/simplecov.gemspec
+++ b/simplecov.gemspec
@@ -1,4 +1,3 @@-# encoding: utf-8
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
require "simplecov/version"
@@ -14,9 +13,12 @@ gem.license = "MIT"
gem.required_ruby_version = ">= 1.8.7"
+
gem.add_dependency "json", "~> 1.8"
gem.add_dependency "simplecov-html", "~> 0.9.0"
gem.add_dependency "docile", "~> 1.1.0"
+
+ gem.add_development_dependency "bundler", "~> 1.9"
gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
Add bundler as a development dependency
|
diff --git a/UITableViewDataSource-RACExtensions.podspec b/UITableViewDataSource-RACExtensions.podspec
index abc1234..def5678 100644
--- a/UITableViewDataSource-RACExtensions.podspec
+++ b/UITableViewDataSource-RACExtensions.podspec
@@ -21,9 +21,7 @@ s.author = { "Michael Avila" => "[email protected]" }
s.source = { :git => "[email protected]:michaelavila/UITableViewDataSource-RACExtensions.git", :tag => s.version.to_s }
- # s.platform = :ios, '5.0'
- # s.ios.deployment_target = '5.0'
- # s.osx.deployment_target = '10.7'
+ s.platform = :ios, '5.0'
s.requires_arc = true
s.source_files = 'Classes'
|
Configure platform to be iOS 5.0
|
diff --git a/rspec-composable_json_matchers.gemspec b/rspec-composable_json_matchers.gemspec
index abc1234..def5678 100644
--- a/rspec-composable_json_matchers.gemspec
+++ b/rspec-composable_json_matchers.gemspec
@@ -18,6 +18,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
+ spec.add_runtime_dependency 'json', '~> 2.0'
spec.add_runtime_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'bundler', '~> 1.11'
|
Add json ~> 2.0 dependency for conformance with RFC 7159
|
diff --git a/spec/feed_spec.rb b/spec/feed_spec.rb
index abc1234..def5678 100644
--- a/spec/feed_spec.rb
+++ b/spec/feed_spec.rb
@@ -17,7 +17,7 @@ expect { Stream::Feed.new(nil, "feed-slug", "user_id", "") }.to raise_error Stream::StreamInputData
end
- it "should refuse feed_slug with underscores" do
- expect { Stream::Feed.new(nil, "feed_slug", "user_id", "") }.to raise_error Stream::StreamInputData
+ it "should not refuse feed_slug with underscores" do
+ expect { Stream::Feed.new(nil, "feed_slug", "user_id", "") }.to_not raise_error Stream::StreamInputData
end
end
|
Fix spec for underscore support for feed slugs
|
diff --git a/lib/contributors/servises/all_contributors.rb b/lib/contributors/servises/all_contributors.rb
index abc1234..def5678 100644
--- a/lib/contributors/servises/all_contributors.rb
+++ b/lib/contributors/servises/all_contributors.rb
@@ -0,0 +1,33 @@+require_relative '../../http_request'
+
+class AllContributors
+ API_URL = 'https://api.github.com/repos/hanami/%{project}/stats/contributors'.freeze
+
+ def call
+ contributors = []
+
+ ProjectRepository.new.all.each do |project|
+ get_response(project).each { |data| contributors << contributor_data(data) }
+ end
+
+ contributors.uniq { |contributor| contributor[:github] }
+ end
+
+ private
+
+ def contributor_data(data)
+ {
+ github: data['author']['login'],
+ avatar_url: data['author']['avatar_url']
+ }
+ end
+
+ def get_response(project)
+ params = { project: project.name }
+
+ response = HttpRequest.new(API_URL % params).get
+ return [] unless response.is_a?(Net::HTTPSuccess)
+
+ JSON.parse(response.body)
+ end
+end
|
Create simple service which get all hanami contributors
|
diff --git a/spec/controllers/course/assessment/controller_spec.rb b/spec/controllers/course/assessment/controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/course/assessment/controller_spec.rb
+++ b/spec/controllers/course/assessment/controller_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe Course::Assessment::Controller do
controller(Course::Assessment::Controller) do
def index
- render nothing: true
+ render body: nil
end
end
|
Replace deprecated render nothing: true
|
diff --git a/parsedecision.gemspec b/parsedecision.gemspec
index abc1234..def5678 100644
--- a/parsedecision.gemspec
+++ b/parsedecision.gemspec
@@ -21,6 +21,7 @@
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
- #spec.add_runtime_dependency "win32ole"
+ spec.add_development_dependency "rspec-given"
+ spec.add_development_dependency "pry"
spec.add_runtime_dependency "ktcommon"
end
|
Add rspec-given and pry gems to dev list
|
diff --git a/recipes/_user.rb b/recipes/_user.rb
index abc1234..def5678 100644
--- a/recipes/_user.rb
+++ b/recipes/_user.rb
@@ -26,7 +26,7 @@ end
authorized_keys_file = "#{home_dir}/.ssh/authorized_keys"
-if File.exist?(authorized_keys_file)
+if File.size?(authorized_keys_file)
ruby_block "Add Rolling Restart User's public key" do
block do
file = Chef::Util::FileEdit.new(authorized_keys_file)
|
Switch to overriding the authorized_keys file if the file is missing or empty
|
diff --git a/app/models/concerns/meta_tags_parser.rb b/app/models/concerns/meta_tags_parser.rb
index abc1234..def5678 100644
--- a/app/models/concerns/meta_tags_parser.rb
+++ b/app/models/concerns/meta_tags_parser.rb
@@ -6,6 +6,8 @@ self.description, self.title, self.image = read_content_from_page('description', 'title', 'image')
rescue ArgumentError => exception
Rollbar.error(exception)
+ rescue Mechanize::ResponseCodeError => exception
+ Rollbar.warning(exception)
end
private
|
Add another exception handling (even more frequent)
|
diff --git a/app/observers/merge_request_observer.rb b/app/observers/merge_request_observer.rb
index abc1234..def5678 100644
--- a/app/observers/merge_request_observer.rb
+++ b/app/observers/merge_request_observer.rb
@@ -21,11 +21,11 @@ protected
def send_reassigned_email(merge_request)
- recipients_ids = merge_request.assignee_id_was, merge_request.assignee_id
- recipients_ids.delete current_user.id
+ recipients_ids = merge_request.assignee_id_was, merge_request.assignee_id
+ recipients_ids.delete current_user.id
- recipients_ids.each do |recipient_id|
- Notify.reassigned_merge_request_email(recipient_id, merge_request.id, merge_request.assignee_id_was).deliver
- end
+ recipients_ids.each do |recipient_id|
+ Notify.reassigned_merge_request_email(recipient_id, merge_request.id, merge_request.assignee_id_was).deliver
+ end
end
end
|
Clean up indenting in new observer.
|
diff --git a/Casks/speedtao.rb b/Casks/speedtao.rb
index abc1234..def5678 100644
--- a/Casks/speedtao.rb
+++ b/Casks/speedtao.rb
@@ -2,6 +2,6 @@ url 'http://www.speedtao.net/download/SpeedTao_Beta26.dmg'
homepage 'http://www.speedtao.net/'
version 'Beta26'
- sha256 'c8864775c92f2a92914cdba6b70d67998c484fa3f798715456577cf1704748f3'
+ sha256 '2a1c6a742a4a1e52c2459c0958e3bc2f93f80f4f6977ee35c674b06399502058'
link 'SpeedTao.app'
end
|
Fix checksum in SpeedTao.app Cask
|
diff --git a/lib/msgr/binding.rb b/lib/msgr/binding.rb
index abc1234..def5678 100644
--- a/lib/msgr/binding.rb
+++ b/lib/msgr/binding.rb
@@ -14,6 +14,9 @@ @subscription = queue.subscribe ack: true, &method(:call)
end
+ # Called from Bunny Thread Pool. Will create message object from
+ # provided bunny data and dispatch message to connection.
+ #
def call(info, metadata, payload)
message = Message.new(connection, info, metadata, payload, route)
connection.dispatch message
@@ -21,6 +24,8 @@ Msgr.logger.warn(self) { "Error received within bunny subscribe handler: #{error.inspect}." }
end
+ # Cancel subscription to not receive any more messages.
+ #
def release
subscription.cancel if subscription
end
|
Add short descriptions to Binding.
|
diff --git a/lib/nidyx/reader.rb b/lib/nidyx/reader.rb
index abc1234..def5678 100644
--- a/lib/nidyx/reader.rb
+++ b/lib/nidyx/reader.rb
@@ -38,7 +38,8 @@ # @return [Boolean] true if the schema is empty
def empty_schema?(schema)
props = schema[PROPERTIES_KEY]
- !props || props.empty?
+ items = schema[ITEMS_KEY]
+ (!props || props.empty?) && (!items || items.empty?)
end
end
end
|
Make empty schema error less strict
The empty schema error was being thrown whenever there were no properties in the
top level object. This changes the error to happen if there are no properties or
items (in the case that the response is an array as the top level object).
|
diff --git a/lib/quality/flay.rb b/lib/quality/flay.rb
index abc1234..def5678 100644
--- a/lib/quality/flay.rb
+++ b/lib/quality/flay.rb
@@ -1,8 +1,9 @@ module Quality
module Flay
+
+ private
+
def quality_flay
- private
-
ratchet_quality_cmd('flay',
args: "-m 75 -t 99999 #{ruby_files}",
emacs_format: true) do |line|
|
Fix accidental line location swap of 'private'
|
diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/serverspec/default_spec.rb
+++ b/test/integration/default/serverspec/default_spec.rb
@@ -0,0 +1,22 @@+require 'serverspec'
+require 'pathname'
+
+include Serverspec::Helper::Exec
+
+# Ensure GCC exists
+describe command('gcc --version') do
+ it { should return_exit_status 0 }
+end
+
+# On FreeBSD `make` is actually BSD make
+gmake_bin = if RUBY_PLATFORM =~ /freebsd/
+ 'gmake'
+ else
+ 'make'
+ end
+
+# Ensure GNU Make exists
+describe command("#{gmake_bin} --version") do
+ it { should return_exit_status 0 }
+ it { should return_stdout /GNU/ }
+end
|
Add integration test coverage for default suite
Nothing fancy, this serverspec test verifies:
* GCC is installed and available.
* The GNU flavor of Make is installed and available.
|
diff --git a/app/controllers/presentations_controller.rb b/app/controllers/presentations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/presentations_controller.rb
+++ b/app/controllers/presentations_controller.rb
@@ -1,10 +1,6 @@ class PresentationsController < AssetsController
def show
- @presentation = @content
- render :layout => "slide"
- end
- def index
@presentation = @content
render :layout => "slide"
end
|
Remove the index action from the presentations controller
|
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -0,0 +1,13 @@+class RegistrationsController < Devise::RegistrationsController
+
+ private
+
+ def sign_up_params
+ params.require(:user).permit(:first_name, :email, :password, :password_confirmation)
+ end
+
+ def account_update_params
+ params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :current_password, :avatar, :age, :country)
+ end
+
+end
|
Create a registration controller for customize devise permit parameters
|
diff --git a/lib/vagrant-list.rb b/lib/vagrant-list.rb
index abc1234..def5678 100644
--- a/lib/vagrant-list.rb
+++ b/lib/vagrant-list.rb
@@ -7,9 +7,17 @@ module List
class All < ::Vagrant::Command::Base
def execute
- names = Driver::VirtualBox.new(nil).read_vms
+ all = Driver::VirtualBox.new(nil).read_vms(:vms)
+ @env.ui.info "ALL:"
+ all.each do |uuid|
+ @env.ui.info Vagrant::VMInfo.new(uuid).inspect
+ end
- pp names.map { |uuid| Vagrant::VMInfo.new(uuid).uuid }
+ running = Driver::VirtualBox.new(nil).read_vms(:runningvms)
+ @env.ui.info "RUNNING:"
+ running.each do |uuid|
+ @env.ui.info Vagrant::VMInfo.new(uuid).inspect
+ end
end
end
end
|
Extend vagrant list command to print both All vms, and running vms
|
diff --git a/qa/qa/scenario/gitlab/admin/hashed_storage.rb b/qa/qa/scenario/gitlab/admin/hashed_storage.rb
index abc1234..def5678 100644
--- a/qa/qa/scenario/gitlab/admin/hashed_storage.rb
+++ b/qa/qa/scenario/gitlab/admin/hashed_storage.rb
@@ -6,7 +6,6 @@ def perform(*traits)
raise ArgumentError unless traits.include?(:enabled)
- Page::Main::Entry.act { visit_login_page }
Page::Main::Login.act { sign_in_using_credentials }
Page::Main::Menu.act { go_to_admin_area }
Page::Admin::Menu.act { go_to_settings }
|
Remove unused page from hashed storage QA scenario
|
diff --git a/spec/defines/homebrew__formula_spec.rb b/spec/defines/homebrew__formula_spec.rb
index abc1234..def5678 100644
--- a/spec/defines/homebrew__formula_spec.rb
+++ b/spec/defines/homebrew__formula_spec.rb
@@ -4,7 +4,7 @@ let(:facts) { default_test_facts }
let(:title) { "clojure" }
- let(:tapdir) { "#{facts[:homebrew_root]}/Library/Taps/boxen/homebrew-brews" }
+ let(:tapdir) { "#{facts[:homebrew_root]}/Homebrew/Library/Taps/boxen/homebrew-brews" }
context "with source provided" do
let(:params) do
|
Fix spec path to include Homebrew path
|
diff --git a/spec/faraday/params_encoder_spec.rb b/spec/faraday/params_encoder_spec.rb
index abc1234..def5678 100644
--- a/spec/faraday/params_encoder_spec.rb
+++ b/spec/faraday/params_encoder_spec.rb
@@ -0,0 +1,24 @@+describe Mrkt::Faraday::ParamsEncoder do
+ describe '.encode' do
+ let(:params) do
+ {
+ string: 'foobar',
+ number: 1,
+ boolean: true,
+ array: [1, 2, 3]
+ }
+ end
+
+ subject { described_class.encode(params) }
+
+ it { is_expected.to eq(Faraday::Utils::ParamsHash.new.merge(params.merge(array: '1,2,3')).to_query) }
+ end
+
+ describe '.decode' do
+ let(:value) { 'foo=foo&bar=bar' }
+
+ subject { described_class.decode(value) }
+
+ it { is_expected.to eq({ 'foo' => 'foo' , 'bar' => 'bar' }) }
+ end
+end
|
Add tests for the ParamsEncoder
|
diff --git a/test/integration/default/serverspec/publisher_spec.rb b/test/integration/default/serverspec/publisher_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/serverspec/publisher_spec.rb
+++ b/test/integration/default/serverspec/publisher_spec.rb
@@ -5,7 +5,7 @@
# See recipes/test_publisher
fixtures = {
- :deleted => 'ms.omniti.com',
+ :deleted => 'omnios',
:created => 'perl.omniti.com',
}
|
Correct test fixtrue publisher name
|
diff --git a/log-courier.gemspec b/log-courier.gemspec
index abc1234..def5678 100644
--- a/log-courier.gemspec
+++ b/log-courier.gemspec
@@ -11,7 +11,7 @@ gem.require_paths = ['lib']
gem.files = %w(
lib/log-courier/server.rb
- lib/log-courier/server_tls.rb
+ lib/log-courier/server_tcp.rb
lib/log-courier/server_zmq.rb
lib/log-courier/client.rb
lib/log-courier/client_tls.rb
|
Use doctoc to produce tables of contents
|
diff --git a/akephalos.gemspec b/akephalos.gemspec
index abc1234..def5678 100644
--- a/akephalos.gemspec
+++ b/akephalos.gemspec
@@ -24,7 +24,7 @@ end
s.add_development_dependency "sinatra"
- s.add_development_dependency "rspec", "1.30"
+ s.add_development_dependency "rspec", "1.3.0"
s.files = Dir.glob("lib/**/*.rb") + Dir.glob("src/**/*.jar") + %w(README.md MIT_LICENSE)
s.require_path = %w(lib src)
|
Fix rspec dependency in gemspec
|
diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb
index abc1234..def5678 100644
--- a/spec/dummy/config/environments/development.rb
+++ b/spec/dummy/config/environments/development.rb
@@ -27,4 +27,6 @@
# Expands the lines which load the assets
config.assets.debug = true
+
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
end
|
Add test host to spec/dummy initializer
|
diff --git a/spec/support/pages/overlays/upload_figures.rb b/spec/support/pages/overlays/upload_figures.rb
index abc1234..def5678 100644
--- a/spec/support/pages/overlays/upload_figures.rb
+++ b/spec/support/pages/overlays/upload_figures.rb
@@ -1,6 +1,6 @@ class UploadFiguresOverlay < CardOverlay
def has_image? image_name
- has_selector? "img[src$='#{image_name}']"
+ have_xpath("//img[contains(@src, \"#{image_name}\"]")
end
def attach_figure
|
Make has_image? less brittle (dont check entire path)
|
diff --git a/em-websocket.gemspec b/em-websocket.gemspec
index abc1234..def5678 100644
--- a/em-websocket.gemspec
+++ b/em-websocket.gemspec
@@ -19,5 +19,5 @@ s.require_paths = ["lib"]
s.add_dependency("eventmachine", ">= 0.12.9")
- s.add_dependency("http_parser.rb", '>= 0.6.1')
+ s.add_dependency("http_parser.rb", '~> 0')
end
|
Allow newer versions of http_parser until v1.0.0
|
diff --git a/formatter/slow_hand_cuke.rb b/formatter/slow_hand_cuke.rb
index abc1234..def5678 100644
--- a/formatter/slow_hand_cuke.rb
+++ b/formatter/slow_hand_cuke.rb
@@ -2,21 +2,13 @@ module Formatter
class SlowHandCuke < Cucumber::Formatter::Pretty
def before_step( step )
- print_ansi_code 's' # save cursor position
@io.printf "... #{step.name}"
@io.flush
end
def before_step_result( *args )
- print_ansi_code '1K' # clear current line
- print_ansi_code 'u' # move cursor back to start of line
+ @io.printf "\r"
super
- end
-
- private
-
- def print_ansi_code(code)
- @io.printf "\033[#{code}"
end
end
end
|
Replace fancy-pants ansi codes with simple carriage-return (doh!)
|
diff --git a/gems.gemspec b/gems.gemspec
index abc1234..def5678 100644
--- a/gems.gemspec
+++ b/gems.gemspec
@@ -2,12 +2,12 @@ require File.expand_path('../lib/gems/version', __FILE__)
Gem::Specification.new do |gem|
- gem.add_development_dependency 'rake', '~> 0.9'
- gem.add_development_dependency 'rdiscount', '~> 1.6'
- gem.add_development_dependency 'rspec', '~> 2.6'
- gem.add_development_dependency 'simplecov', '~> 0.4'
- gem.add_development_dependency 'webmock', '~> 1.7'
- gem.add_development_dependency 'yard', '~> 0.7'
+ gem.add_development_dependency 'maruku'
+ gem.add_development_dependency 'rake'
+ gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'simplecov'
+ gem.add_development_dependency 'webmock'
+ gem.add_development_dependency 'yard'
gem.authors = ["Erik Michaels-Ober"]
gem.description = %q{Ruby wrapper for the RubyGems.org API}
gem.email = ['[email protected]']
|
Use maruku instead of rdiscount for compatibility with JRuby and Rubinius in 1.9 mode
|
diff --git a/redic-cluster.gemspec b/redic-cluster.gemspec
index abc1234..def5678 100644
--- a/redic-cluster.gemspec
+++ b/redic-cluster.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = "redic-cluster"
- s.version = "0.0.4"
+ s.version = "0.0.5"
s.summary = "Redis Cluster support for Redic"
s.description = "Redis Cluster support for Redic, the lightweight Redis client"
s.authors = ["Leandro López"]
@@ -11,4 +11,6 @@ s.license = "MIT"
s.files = `git ls-files`.split("\n")
+
+ s.add_dependency "redic"
end
|
Add dependency and bump version
|
diff --git a/request_store.gemspec b/request_store.gemspec
index abc1234..def5678 100644
--- a/request_store.gemspec
+++ b/request_store.gemspec
@@ -16,4 +16,7 @@ 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.add_development_dependency "rake"
+ gem.add_development_dependency 'minitest', '~> 3.0'
end
|
Add minitest so we work on all rubies.
|
diff --git a/mini_magick.gemspec b/mini_magick.gemspec
index abc1234..def5678 100644
--- a/mini_magick.gemspec
+++ b/mini_magick.gemspec
@@ -8,11 +8,12 @@ s.version = MiniMagick::VERSION
s.platform = Gem::Platform::RUBY
s.summary = "Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick"
- s.description = ""
+ s.summary = "Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick"
s.requirements << "You must have ImageMagick or GraphicsMagick installed"
+ s.licenses = ["MIT"]
- s.authors = ["Corey Johnson", "Hampton Catlin", "Peter Kieltyka"]
- s.email = ["[email protected]", "[email protected]", "[email protected]"]
+ s.authors = ["Corey Johnson", "Hampton Catlin", "Peter Kieltyka", "James Miller", "Thiago Fernandes Massa"]
+ s.email = ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"]
s.homepage = "https://github.com/minimagick/minimagick"
s.files = Dir['README.rdoc', 'VERSION', 'MIT-LICENSE', 'Rakefile', 'lib/**/*']
|
Add license to gemspec and update authors
|
diff --git a/lib/sinatra/dynamicmatic.rb b/lib/sinatra/dynamicmatic.rb
index abc1234..def5678 100644
--- a/lib/sinatra/dynamicmatic.rb
+++ b/lib/sinatra/dynamicmatic.rb
@@ -5,6 +5,8 @@ module DynamicMatic
def self.registered(app)
app.set :compile_on_start, true
+
+ app.set :lock, true
app.set :public, Proc.new {app.root && File.join(app.root, 'site')}
configuration = StaticMatic::Configuration.new
|
Set the :lock option to true.
|
diff --git a/lib/spree_temando/engine.rb b/lib/spree_temando/engine.rb
index abc1234..def5678 100644
--- a/lib/spree_temando/engine.rb
+++ b/lib/spree_temando/engine.rb
@@ -12,7 +12,7 @@ end
initializer "spree_temando.register.shipping_calculators" do |app|
- app.config.spree.calculators.add_class(Spree::Calculator::Temando)
+ app.config.spree.calculators.shipping_methods << Spree::Calculator::Temando
end
config.to_prepare &method(:activate).to_proc
|
Fix incorrect call to register shipping calculator
|
diff --git a/test/integration/default/squid_spec.rb b/test/integration/default/squid_spec.rb
index abc1234..def5678 100644
--- a/test/integration/default/squid_spec.rb
+++ b/test/integration/default/squid_spec.rb
@@ -1,5 +1,3 @@-describe 'Squid server' do
- it 'is listening on port 3128' do
- expect(port(3128)).to be_listening
- end
+describe port(3128) do
+ it { should be_listening }
end
|
Fix the spec to actually check the port
Signed-off-by: Tim Smith <[email protected]>
|
diff --git a/test/tests/test_mass_assign_disable.rb b/test/tests/test_mass_assign_disable.rb
index abc1234..def5678 100644
--- a/test/tests/test_mass_assign_disable.rb
+++ b/test/tests/test_mass_assign_disable.rb
@@ -36,4 +36,30 @@ end
RUBY
end
+
+ def test_strong_parameters_in_initializer
+ init = "config/initializers/mass_assign.rb"
+ gemfile = "Gemfile"
+ config = "config/application.rb"
+
+ before_rescan_of [init, gemfile, config], "rails3.2" do
+ write_file init, <<-RUBY
+ class ActiveRecord::Base
+ include ActiveModel::ForbiddenAttributesProtection
+ end
+ RUBY
+
+ append gemfile, "gem 'strong_parameters'"
+
+ replace config, "config.active_record.whitelist_attributes = true",
+ "config.active_record.whitelist_attributes = false"
+ end
+
+ #We disable whitelist, but add strong_parameters globally, so
+ #there should be no change.
+ assert_reindex :none
+ assert_changes
+ assert_fixed 0
+ assert_new 0
+ end
end
|
Add test for adding strong_parameters globally
|
diff --git a/spec/spec_helpers/fake_capture3.rb b/spec/spec_helpers/fake_capture3.rb
index abc1234..def5678 100644
--- a/spec/spec_helpers/fake_capture3.rb
+++ b/spec/spec_helpers/fake_capture3.rb
@@ -27,7 +27,7 @@ private
def return_values(command)
- filename = command.gsub(' ', '_')
+ filename = command.gsub(' ', '_').gsub('/', 'SLASH')
command_stdout = File.read("#{@basedir}/#{filename}.stdout")
command_stderr = File.read("#{@basedir}/#{filename}.stderr")
command_status = File.read("#{@basedir}/#{filename}.return").chomp == '0'
|
Support slashes in FakeCapture3 commands
|
diff --git a/lib/asset_manager/engine.rb b/lib/asset_manager/engine.rb
index abc1234..def5678 100644
--- a/lib/asset_manager/engine.rb
+++ b/lib/asset_manager/engine.rb
@@ -16,8 +16,8 @@ include AssetManager::AssetInstancesHelper
end
ActiveSupport.on_load :active_record do
- Formtastic::Inputs.autoload(:AssetManagerInput, 'formtastic/inputs/asset_manager_input')
- SimpleForm::Inputs.autoload(:AssetManagerInput, 'simple_form/inputs/asset_manager_input')
+ Formtastic::Inputs.autoload(:AssetManagerInput, 'formtastic/inputs/asset_manager_input') if defined?(Formtastic)
+ SimpleForm::Inputs.autoload(:AssetManagerInput, 'simple_form/inputs/asset_manager_input') if defined?(SimpleForm)
end
end
|
Check if simple_form and formtastic is defined
|
diff --git a/lib/checks/check_mail_to.rb b/lib/checks/check_mail_to.rb
index abc1234..def5678 100644
--- a/lib/checks/check_mail_to.rb
+++ b/lib/checks/check_mail_to.rb
@@ -0,0 +1,50 @@+require 'checks/base_check'
+require 'processors/lib/find_call'
+
+#Check for cross site scripting vulnerability in mail_to :encode => :javascript
+#with certain versions of Rails (< 2.3.11 or < 3.0.4).
+#
+#http://groups.google.com/group/rubyonrails-security/browse_thread/thread/f02a48ede8315f81
+class CheckMailTo < BaseCheck
+ Checks.add self
+
+ def run_check
+ if (version_between? "2.3.0", "2.3.10" or version_between? "3.0.0", "3.0.3") and result = mail_to_javascript?
+ message = "Vulnerability in mail_to using javascript encoding (CVE-2011-0446). Upgrade to Rails version "
+
+ if version_between? "2.3.0", "2.3.10"
+ message << "2.3.11"
+ else
+ message << "3.0.4"
+ end
+
+ warn :result => result,
+ :warning_type => "Mail Link",
+ :message => message,
+ :confidence => CONFIDENCE[:high]
+ end
+ end
+ end
+
+ #Check for javascript encoding of mail_to address
+ # mail_to email, name, :encode => :javascript
+ def mail_to_javascript?
+ tracker.find_call([], :mail_to).each do |result|
+ call = result[-1]
+ args = call[-1]
+
+ args.each do |arg|
+ if hash? arg
+ hash_iterate arg do |k, v|
+ if symbol? v and v[-1] == :javascript
+ return result
+ end
+ end
+ end
+ end
+
+ end
+
+ false
+ end
+end
|
Add check for mail_to vulnerability
|
diff --git a/lib/google/places/client.rb b/lib/google/places/client.rb
index abc1234..def5678 100644
--- a/lib/google/places/client.rb
+++ b/lib/google/places/client.rb
@@ -22,6 +22,14 @@ )
end
+ def query_autocomplete(input, options = {})
+ options = options.with_indifferent_access
+ self.class.get(
+ "/queryautocomplete/json",
+ { query: build_request_parameters(input, options) }
+ )
+ end
+
private
def build_request_parameters(input, options = {})
|
Add Query Autocomplete API support
|
diff --git a/lib/hets/prove/evaluator.rb b/lib/hets/prove/evaluator.rb
index abc1234..def5678 100644
--- a/lib/hets/prove/evaluator.rb
+++ b/lib/hets/prove/evaluator.rb
@@ -37,6 +37,8 @@ self.now = Time.now
end
+ # The caller needs those methods to exists, but we don't need the
+ # functionality here. This will be restructured in a later branch.
%i(concurrency
dgnode_stack
dgnode_stack_id
|
Add comment on bad class structure.
|
diff --git a/lib/jstree_rails/viewers.rb b/lib/jstree_rails/viewers.rb
index abc1234..def5678 100644
--- a/lib/jstree_rails/viewers.rb
+++ b/lib/jstree_rails/viewers.rb
@@ -21,7 +21,8 @@ :type => link_args.delete(:method) || 'post',
:data => {
:data => RawJS.new("jQuery(#{format_type_to_js(format_id(dom_id))}).jstree('get_json', -1)")
- }
+ },
+ :data_type => 'script'
}.merge(ajax_args)
link_to_function(name, link_args) do |page|
page << "
|
Set type for ajax request
|
diff --git a/lib/shortcode_googledocs.rb b/lib/shortcode_googledocs.rb
index abc1234..def5678 100644
--- a/lib/shortcode_googledocs.rb
+++ b/lib/shortcode_googledocs.rb
@@ -1,23 +1,23 @@ require 'shortcodes/handler'
module Shortcodes
- class DocumentCloud < Handler
+ class GoogleDocs < Handler
def url
url = shortcode.attributes.fetch('url')
end
- def height
- attributes.fetch('height', 700)
+ def width
+ attributes.fetch('width', 550)
end
- def width
- attributes.fetch('width', 500)
+ def height
+ attributes.fetch('height', 500)
end
def render
<<TEMPLATE
-<iframe width='500' height='300' frameborder='0' src='#{url}'></iframe>
+<iframe width='#{width}' height='#{height}' frameborder='0' src='#{url}'></iframe>
TEMPLATE
end
|
Fix class name of Google Docs shortcode, and fix dimension handling
|
diff --git a/lib/tasks/create_index.rake b/lib/tasks/create_index.rake
index abc1234..def5678 100644
--- a/lib/tasks/create_index.rake
+++ b/lib/tasks/create_index.rake
@@ -6,8 +6,6 @@ index: Spree::ElasticsearchSettings.index,
body: {
settings: {
- number_of_shards: 1,
- number_of_replicas: 0,
analysis: {
analyzer: {
nGram_analyzer: {
|
Use default settings for shards and replicas (5 shards)
|
diff --git a/lib/tasks/data_cleanup.rake b/lib/tasks/data_cleanup.rake
index abc1234..def5678 100644
--- a/lib/tasks/data_cleanup.rake
+++ b/lib/tasks/data_cleanup.rake
@@ -0,0 +1,48 @@+namespace :data_cleanup do
+ desc "Removes drafts for specialist publisher documents if they're duplicates"
+ task remove_substitutions: :environment do
+ attributes = Unpublishing
+ .where(type: "substitute")
+ .joins(:content_item)
+ .pluck(:content_item_id, :content_id)
+
+ content_item_ids, content_ids = attributes
+ .flatten
+ .partition
+ .with_index { |_, index| index.even? }
+
+ puts "Removing #{content_item_ids.count} content items"
+
+ supporting_classes = [
+ AccessLimit,
+ Linkable,
+ Location,
+ State,
+ Translation,
+ Unpublishing,
+ UserFacingVersion
+ ]
+
+ supporting_classes.each do |klass|
+ puts "-- Removing all associated #{klass} objects"
+ klass.where(content_item_id: content_item_ids).destroy_all
+ end
+
+ LockVersion.where(
+ target_id: content_item_ids,
+ target_type: "ContentItem"
+ ).destroy_all
+
+ ContentItem.where(id: content_item_ids).destroy_all
+
+ puts "Checking link sets"
+ content_ids.each do |content_id|
+ # Remove linkset if there's no content items left
+ # for that content ID.
+ unless ContentItem.exists?(content_id: content_id)
+ puts "-- Removing orphaned LinkSet for content ID '#{content_id}'"
+ LinkSet.where(content_id: content_id).destroy_all
+ end
+ end
+ end
+end
|
Add rake task for cleaning up substitution data.
In prep for https://github.com/alphagov/publishing-api/pull/405,
we need to remove all unpublishings of type
"substitution". This is due to some inconsistent
data where some draft content items where unpublished
and thus impossible to tell apart from previously
live content.
Since we can't easily tell them apart, we're
taking a scorched earth approach and deleting all
of them. Since no apps are yet phase 2 no data
will be permanently lost.
|
diff --git a/lib/tasks/link_checker.rake b/lib/tasks/link_checker.rake
index abc1234..def5678 100644
--- a/lib/tasks/link_checker.rake
+++ b/lib/tasks/link_checker.rake
@@ -0,0 +1,6 @@+namespace :link_checker do
+ task delete_old_report_links: :environment do
+ count = LinkCheckerApiReport::Link.deletable.delete_all
+ puts "Deleted #{count} old report links."
+ end
+end
|
Add a rake task for deleting old report links
This table has the potential to grow indefinitely, so we will configure
this task to run periodically so it remains a good size. It also always
us to delete the links using Jenkins so we have better visibility on the
job.
|
diff --git a/lib/travel_advice_alerts.rb b/lib/travel_advice_alerts.rb
index abc1234..def5678 100644
--- a/lib/travel_advice_alerts.rb
+++ b/lib/travel_advice_alerts.rb
@@ -33,7 +33,7 @@ end
def updated_recently?
- Time.now - 172800 <= updated_at && updated_at <= Time.now - 3600
+ Time.now - 172800 <= updated_at && updated_at <= Time.now - 900
end
def country
|
Reduce threshold for recent travel advice
The current behaviour is that the travel advice must be at least an
hour old before we start alerting on it.
15 minutes is probably a more reasonable threshold. Users should have
received emails within 15 minutes of the advice being published.
|
diff --git a/lib/webrat_headers_patch.rb b/lib/webrat_headers_patch.rb
index abc1234..def5678 100644
--- a/lib/webrat_headers_patch.rb
+++ b/lib/webrat_headers_patch.rb
@@ -12,6 +12,31 @@ @response = mechanize.get({url: url, headers: headers}, data)
end
+ # Replace Webrat version to allow headers (like #get). Only line
+ # changed from the Webrat implementation is the last line where
+ # it calls mechanize, now passing the headers argument.
+ def post_with_headers(url, data, headers = nil)
+ post_data = data.inject({}) do |memo, param|
+ case param
+ when Hash
+ param.each {|attribute, value| memo[attribute] = value }
+ memo
+ when Array
+ case param.last
+ when Hash
+ param.last.each {|attribute, value| memo["#{param.first}[#{attribute}]"] = value }
+ else
+ memo[param.first] = param.last
+ end
+ memo
+ end
+ end
+ @response = mechanize.post(url, post_data, headers)
+ end
+
alias_method :get_without_headers, :get
alias_method :get, :get_with_headers
+
+ alias_method :post_without_headers, :post
+ alias_method :post, :post_with_headers
end
|
Add header support for POST method as well
|
diff --git a/ext/binyo/extconf.rb b/ext/binyo/extconf.rb
index abc1234..def5678 100644
--- a/ext/binyo/extconf.rb
+++ b/ext/binyo/extconf.rb
@@ -50,7 +50,7 @@ message "=== Checking Ruby features ===\n"
have_header("ruby/io.h")
-
+have_func("rb_io_check_byte_readable")
create_header
create_makefile("binyo")
|
Check for presence of rb_check_io_byte_readable
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.