diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/lib/jekyll/responsive_image/resize_handler.rb b/lib/jekyll/responsive_image/resize_handler.rb
index abc1234..def5678 100644
--- a/lib/jekyll/responsive_image/resize_handler.rb
+++ b/lib/jekyll/responsive_image/resize_handler.rb
@@ -35,6 +35,8 @@
i.destroy!
end
+
+ img.destroy!
resized
end
| Destroy the original image when done with resizing
When re-sizing a bunch of 24 megapixels image (direct from a digital camera) into responsive images, not destroying the `img` member made my server OOM (it does not have a lot of RAM, it's a cheap VPS).
Additionally, when re-generating the site, although there was no need to re-generate the images, it looked like it was still loading them up, and the GC was not kicking in so it was OOM-ing (or close to OOM-ing) as well.
This fixes both issues. |
diff --git a/Casks/dwarf-fortress-macnewbie.rb b/Casks/dwarf-fortress-macnewbie.rb
index abc1234..def5678 100644
--- a/Casks/dwarf-fortress-macnewbie.rb
+++ b/Casks/dwarf-fortress-macnewbie.rb
@@ -2,7 +2,7 @@ version '0.9.16a'
sha256 'eb678d5bfef47a1da05ee131c2fbced6ada06359bd12e00a4c979567fecb740f'
- url "http://dffd.wimbli.com/download.php?id=7922&f=Macnewbie_#{version}.dmg"
+ url "http://dffd.bay12games.com/download.php?id=7922&f=Macnewbie_#{version}.dmg"
homepage 'http://www.bay12forums.com/smf/index.php?topic=128960'
license :unknown
| Update download URL for MacNewbie Pack
DFFD has changed its hosting. |
diff --git a/lib/agharta/multi_logger.rb b/lib/agharta/multi_logger.rb
index abc1234..def5678 100644
--- a/lib/agharta/multi_logger.rb
+++ b/lib/agharta/multi_logger.rb
@@ -16,5 +16,7 @@ def respond_to?(method_name, include_private = false)
@loggers.all? { |l| l.respond_to?(method_name, include_private) } || super
end
+
+ undef :warn
end
end
| Remove kernel warn method at multi logger.
|
diff --git a/app/controllers/stash_datacite/creators_controller.rb b/app/controllers/stash_datacite/creators_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/stash_datacite/creators_controller.rb
+++ b/app/controllers/stash_datacite/creators_controller.rb
@@ -49,7 +49,7 @@
# Only allow a trusted parameter "white list" through.
def creator_params
- params.require(:creator).permit(:id, :creator_name, :name_identifier_id, :affliation_id, :resource_id)
+ params.require(:creator).permit(:id, :creator_first_name, :creator_last_name, :creator_middle_name, :name_identifier_id, :affliation_id, :resource_id)
end
end
end
| Add last_anme and first_name parameters to controller
|
diff --git a/app/lib/ehjob_authentication/url_extractor_service.rb b/app/lib/ehjob_authentication/url_extractor_service.rb
index abc1234..def5678 100644
--- a/app/lib/ehjob_authentication/url_extractor_service.rb
+++ b/app/lib/ehjob_authentication/url_extractor_service.rb
@@ -15,15 +15,16 @@ module EhjobAuthentication
class UrlExtractorService
class << self
+ delegate :hr?, :job?, :eh_url, :job_url, to: 'EhjobAuthentication.config'
+
def call(params, local_user)
associate_user = ApiClient.instance.associate_user(params)
- roles = [local_user, associate_user].map {|u| u.try(:highest_role)}
- roles = roles.compact
+ roles = [local_user, associate_user].compact.map(&:highest_role)
is_terminated = [local_user, associate_user].compact.any?(&:terminated)
- if roles == []
- raise 'not found'
- elsif roles.include?('employee') || roles.include?('owner/employer')
+ raise 'not found' if roles.empty?
+
+ if roles.include?('employee') || roles.include?('owner/employer')
if is_terminated
#TODO create job seeker on job
job_url if hr?
@@ -38,33 +39,6 @@ "#{job_url}/jobs" if hr?
end
end
-
- def call_for_omniauth(params, local_user)
- params.merge(type: 'omniauth')
- call(params, local_user)
- end
-
- private
-
- def config
- EhjobAuthentication.config
- end
-
- def hr?
- config.hr?
- end
-
- def job?
- config.job?
- end
-
- def eh_url
- config.eh_url
- end
-
- def job_url
- config.job_url
- end
end
end
end
| Tidy up the url extractor service |
diff --git a/lib/get_to_work/command/last_story.rb b/lib/get_to_work/command/last_story.rb
index abc1234..def5678 100644
--- a/lib/get_to_work/command/last_story.rb
+++ b/lib/get_to_work/command/last_story.rb
@@ -2,8 +2,9 @@ class Command
class LastStory < GetToWork::Command
def run
- pt_data = config_file.data["pivotal_tracker"]
- last_story_id = pt_data && pt_data["project_id"]
+ last_story_hash = config_file.data["last_story"]
+ last_story_id = last_story_hash && last_story_hash["id"]
+
shell.say(last_story_id)
end
end
| Fix last story to actually return the last story
|
diff --git a/lib/makeprintable/client/endpoints.rb b/lib/makeprintable/client/endpoints.rb
index abc1234..def5678 100644
--- a/lib/makeprintable/client/endpoints.rb
+++ b/lib/makeprintable/client/endpoints.rb
@@ -9,7 +9,7 @@ end
def get_request(uri)
- JSON.parse RestClient.get(uri, {})
+ Crack::XML.parse RestClient::Request.execute(method: :get, url: uri, headers: {key: self.api_key})
end
def post_request(path, opts)
@@ -17,7 +17,7 @@ end
def delete_request(uri)
- JSON.parse RestClient.delete(uri, {}, key: self.api_key)
+ Crack::XML.parse RestClient::Request.execute(method: :delete, url: uri, headers: {key: self.api_key})
end
end
end
| Set RestClient::Request module for get/delete |
diff --git a/lib/config/custom-routes.rb b/lib/config/custom-routes.rb
index abc1234..def5678 100644
--- a/lib/config/custom-routes.rb
+++ b/lib/config/custom-routes.rb
@@ -2,10 +2,10 @@
Alaveteli::Application.routes.draw do
# brand new controller example
- match '/mycontroller' => 'general#mycontroller', :as => :mycontroller
+ # match '/mycontroller' => 'general#mycontroller', :as => :mycontroller
# Additional help page example
- match '/help/help_out' => 'help#help_out', :as => :help_out
+ # match '/help/help_out' => 'help#help_out', :as => :help_out
match '/people' => 'general#people', :as => :people
end
| Comment out custom routes that aren't being used
|
diff --git a/app/controllers/spree/admin/properties_controller.rb b/app/controllers/spree/admin/properties_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/admin/properties_controller.rb
+++ b/app/controllers/spree/admin/properties_controller.rb
@@ -1,6 +1,9 @@ module Spree
module Admin
class PropertiesController < ResourceController
+ def permitted_resource_params
+ params.require(:property).permit(:name, :presentation)
+ end
end
end
end
| Add strong params implementation to properties controller
|
diff --git a/app/controllers/swagger_ui_engine/docs_controller.rb b/app/controllers/swagger_ui_engine/docs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/swagger_ui_engine/docs_controller.rb
+++ b/app/controllers/swagger_ui_engine/docs_controller.rb
@@ -6,11 +6,12 @@ before_action :set_configs
def index
- redirect_to doc_path(@swagger_url.keys.first) if single_doc_version?
+ redirect_to doc_path('v1') if single_doc_url?
+ redirect_to doc_path(@swagger_url.keys.first) if single_doc_url_hash?
end
def show
- @swagger_url = @swagger_url[params[:id].to_sym]
+ @swagger_url = @swagger_url[params[:id].to_sym] unless single_doc_url?
end
private
@@ -24,8 +25,12 @@ @validator_url = set_validator_url
end
- def single_doc_version?
- @swagger_url.size == 1
+ def single_doc_url?
+ @swagger_url.is_a?(String)
+ end
+
+ def single_doc_url_hash?
+ @swagger_url.is_a?(Hash) && @swagger_url.size == 1
end
end
end
| Add backward compatibility for doc urls defined in string
|
diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec
index abc1234..def5678 100644
--- a/actionmailer/actionmailer.gemspec
+++ b/actionmailer/actionmailer.gemspec
@@ -21,5 +21,5 @@
s.add_dependency 'actionpack', version
- s.add_dependency 'mail', '~> 2.5.0'
+ s.add_dependency 'mail', '~> 2.5.2'
end
| Upgrade mail dependency to 2.5.2
|
diff --git a/Casks/omnioutliner-beta.rb b/Casks/omnioutliner-beta.rb
index abc1234..def5678 100644
--- a/Casks/omnioutliner-beta.rb
+++ b/Casks/omnioutliner-beta.rb
@@ -1,8 +1,8 @@ cask :v1 => 'omnioutliner-beta' do
- version '4.3.x-r235551'
- sha256 '8584a222621871aa178d27ab5ebba3da042f1ef8b269390148c5e26fe0b8bc50'
+ version '4.3.x-r238997'
+ sha256 '7abf46e9183ba617edc9d80e7587a32e3e555d5ca5868668f5bb7759f7b472c5'
- url "http://omnistaging.omnigroup.com/omnioutliner-4/releases/OmniOutliner-#{version.sub(%r{.*-},'')}-Test.dmg"
+ url "http://omnistaging.omnigroup.com/omnioutliner-4/releases/OmniOutliner-#{version}-Test.dmg"
name 'OmniOutliner'
homepage 'http://omnistaging.omnigroup.com/omnioutliner-4/'
license :commercial
| Update URL for Omnioutliner Betas
The URL pattern used for Omnioutliner was updated. This commit
updates the url stanza format, and takes the opportunity to
update the version and sha256 stanzas at the same time.
|
diff --git a/inherited_resources.gemspec b/inherited_resources.gemspec
index abc1234..def5678 100644
--- a/inherited_resources.gemspec
+++ b/inherited_resources.gemspec
@@ -20,7 +20,7 @@ s.required_ruby_version = '>= 2.2'
s.add_dependency("responders")
- s.add_dependency("actionpack", ">= 4.2", "<= 5.2")
- s.add_dependency("railties", ">= 4.2", "<= 5.2")
+ s.add_dependency("actionpack", ">= 4.2", "< 5.3")
+ s.add_dependency("railties", ">= 4.2", "< 5.3")
s.add_dependency("has_scope", "~> 0.6")
end
| Fix dependencies so gem works with rails 5.2.1 and all other 5.2.x versions
|
diff --git a/app/helpers/ember_rails_helper.rb b/app/helpers/ember_rails_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/ember_rails_helper.rb
+++ b/app/helpers/ember_rails_helper.rb
@@ -8,6 +8,6 @@
head, body = markup_capturer.capture
- render inline: EmberCli[name].index_html(head: head, body: body)
+ render html: EmberCli[name].index_html(head: head, body: body).html_safe
end
end
| Use render html:, not render inline:
Render inline compiles a template and uses more memory.
It also takes slightly more time.
|
diff --git a/app/models/concerns/image_file.rb b/app/models/concerns/image_file.rb
index abc1234..def5678 100644
--- a/app/models/concerns/image_file.rb
+++ b/app/models/concerns/image_file.rb
@@ -4,16 +4,64 @@ extend ActiveSupport::Concern
included do
+ has_one :task, as: :owner
+
before_validation :detect_image_attributes
- validates :url, presence: true
+ before_validation :guid
+
+ validates :original_url, presence: true
validates :format, inclusion: { in: ['jpeg', 'png', 'gif', nil] }
+
+ after_commit :copy_original_image
+
+ attr_accessor :copy_original
end
- def url=(url)
- reset_image_attributes
+ # need to implement these for your image classes
+ def destination_path
+ end
+
+ def published_url
+ end
+
+ def guid
+ self[:guid] ||= SecureRandom.uuid
+ self[:guid]
+ end
+
+ def copy_original_image
+ return if task && !copy_original
+ self.copy_original = false
+ Tasks::CopyAudioTask.create! do |task|
+ task.options = copy_options
+ task.owner = self
+ end.start!
+ end
+
+ def copy_options
+ {
+ source: original_url,
+ destination: destination_path
+ }
+ end
+
+ def task_complete
+ update_attributes!(url: published_url)
+ end
+
+ def url
+ self[:url] || self[:original_url]
+ end
+
+ def original_url=(url)
super
+ if original_url_changed?
+ reset_image_attributes
+ self.copy_original = true
+ end
+ self[:original_url]
end
def reset_image_attributes
@@ -24,8 +72,8 @@ end
def detect_image_attributes
- return if !url || (width && height && format)
- info = FastImage.new(url)
+ return if !original_url || (width && height && format)
+ info = FastImage.new(original_url)
self.dimensions = info.size
self.format = info.type
self.size = info.content_length
| Move more of the common image code to the concern
|
diff --git a/app/models/project_auto_devops.rb b/app/models/project_auto_devops.rb
index abc1234..def5678 100644
--- a/app/models/project_auto_devops.rb
+++ b/app/models/project_auto_devops.rb
@@ -16,7 +16,7 @@
def variables
variables = []
- variables << { key: 'AUTO_DEVOPS_DOMAIN', value: domain || instance_domain, public: true } if has_domain?
+ variables << { key: 'AUTO_DEVOPS_DOMAIN', value: domain.presence || instance_domain, public: true } if has_domain?
variables
end
end
| Use domain.presence instead of domain to avoid empty strings
|
diff --git a/lib/crate_ruby.rb b/lib/crate_ruby.rb
index abc1234..def5678 100644
--- a/lib/crate_ruby.rb
+++ b/lib/crate_ruby.rb
@@ -20,14 +20,12 @@ # with Crate these terms will supersede the license and you may use the
# software solely pursuant to the terms of the relevant commercial agreement.
-require 'crate_ruby/version'
-require 'crate_ruby/error'
-require 'crate_ruby/result_set'
-require 'crate_ruby/client'
+module CrateRuby
+ require 'crate_ruby/version'
+ require 'crate_ruby/error'
+ require 'crate_ruby/result_set'
+ require 'crate_ruby/client'
-include CrateRuby
-
-module CrateRuby
def self.logger
@logger ||= begin
require 'logger'
| Improve the module definition to get rid of the extra include
|
diff --git a/lib/generators/reputation_system/templates/change_reputation_messages_index_to_unique.rb b/lib/generators/reputation_system/templates/change_reputation_messages_index_to_unique.rb
index abc1234..def5678 100644
--- a/lib/generators/reputation_system/templates/change_reputation_messages_index_to_unique.rb
+++ b/lib/generators/reputation_system/templates/change_reputation_messages_index_to_unique.rb
@@ -14,7 +14,7 @@ # limitations under the License.
##
-class ChangeReputationMessagesIndex < ActiveRecord::Migration
+class ChangeReputationMessagesIndexUnique < ActiveRecord::Migration
def self.up
remove_index :rs_reputation_messages, :name => "index_rs_reputation_messages_on_receiver_id_and_sender"
add_index :rs_reputation_messages, [:receiver_id, :sender_id, :sender_type], :name => "index_rs_reputation_messages_on_receiver_id_and_sender", :unique => true
| Fix name of migration class
|
diff --git a/lib/perceptron.rb b/lib/perceptron.rb
index abc1234..def5678 100644
--- a/lib/perceptron.rb
+++ b/lib/perceptron.rb
@@ -13,8 +13,8 @@ guess = feed_forward inputs
error = desired - guess
- weights.each_with_index do |item, index|
- weights[index] = item + @@LEARNING_CONSTANT * error * inputs[index]
+ @weights.each_with_index do |item, index|
+ @weights[index] = item + @@LEARNING_CONSTANT * error * inputs[index]
end
end
@@ -31,6 +31,10 @@ @inputs.collect {|input| input * random_weight }.sum
end
+ def to_s
+ @weights.to_s
+ end
+
private
def random_weight
| Fix typo and create to_s method
|
diff --git a/db/migrate/20131031195537_add_default_true_popup_to_external_acitivities.rb b/db/migrate/20131031195537_add_default_true_popup_to_external_acitivities.rb
index abc1234..def5678 100644
--- a/db/migrate/20131031195537_add_default_true_popup_to_external_acitivities.rb
+++ b/db/migrate/20131031195537_add_default_true_popup_to_external_acitivities.rb
@@ -0,0 +1,13 @@+class AddDefaultTruePopupToExternalAcitivities < ActiveRecord::Migration
+ class ExternalActivity < ActiveRecord::Base
+ attr_accessible :popup
+ end
+ def up
+ change_column :external_activities, :popup, :boolean, :default => true
+ ExternalActivity.where(:popup => nil).map { |e| e.update_attribute(:popup,true) }
+ end
+ def down
+ change_column :external_activities, :popup, :boolean
+ end
+
+end
| Make default for external activities to be to open in new tab.
|
diff --git a/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/default_test.rb b/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/default_test.rb
index abc1234..def5678 100644
--- a/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/default_test.rb
+++ b/test/kitchen/cookbooks/omnibus_updater_test/files/default/tests/minitest/default_test.rb
@@ -8,7 +8,7 @@ assert(node[:omnibus_updater][:full_url], "Failed to set URI for omnibus package")
end
- it "does not download the package to the node" do
- file("/opt/#{File.basename(node[:omnibus_updater][:full_url])}").wont_exist
+ it "does downloads the package to the node" do
+ file("/opt/#{File.basename(node[:omnibus_updater][:full_url])}").must_exist
end
end
| Update test check on attribute value
|
diff --git a/config/initializers/active_record_comparison_attributes.rb b/config/initializers/active_record_comparison_attributes.rb
index abc1234..def5678 100644
--- a/config/initializers/active_record_comparison_attributes.rb
+++ b/config/initializers/active_record_comparison_attributes.rb
@@ -26,7 +26,10 @@ arel_nodes <<
if self.class.text_attributes.include? attr_name
Arel::Nodes::NamedFunction.new('SQUISH_NULL', [a.table[attr_name]]).
- eq(attr_val.presence)
+ eq(attr_val.presence)
+ elsif attr_val == []
+ Arel::Nodes::NamedFunction.new('ARRAY_LENGTH', [a.table[attr_name], 1]).
+ eq(0)
else
a.table[attr_name].eq(attr_val)
end
| Fix empty arrays comparison due to new version of AR
|
diff --git a/lib/octokit/enterprise_admin_client/management_console.rb b/lib/octokit/enterprise_admin_client/management_console.rb
index abc1234..def5678 100644
--- a/lib/octokit/enterprise_admin_client/management_console.rb
+++ b/lib/octokit/enterprise_admin_client/management_console.rb
@@ -22,6 +22,8 @@ end
alias :get_settings :settings
+private
+
def license_hash
{ :query => { :license_md5 => @license_md5 } }
end
| Set this method to private
|
diff --git a/db/migrate/20170105032555_add_recipient_to_task_comment.rb b/db/migrate/20170105032555_add_recipient_to_task_comment.rb
index abc1234..def5678 100644
--- a/db/migrate/20170105032555_add_recipient_to_task_comment.rb
+++ b/db/migrate/20170105032555_add_recipient_to_task_comment.rb
@@ -5,8 +5,6 @@ add_reference :task_comment, :recipient, references: :user
add_foreign_key :task_comment, :user, column: :recipient_id
- TaskComment.all.each do |task_comment|
- task_comment.is_new = false
- end
+ TaskComment.update_all(is_new: false)
end
end
| QUALITY: Remove loop and replce with update_all
|
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index abc1234..def5678 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -1,19 +1,20 @@ namespace :db do
- if ENV['PERSISTENCE_DATABASE_URL']
- require "sequel"
- Sequel.extension :migration
- DB = Sequel.connect(ENV['PERSISTENCE_DATABASE_URL'])
- end
+ require "sequel"
+ Sequel.extension :migration
def migrations_path
File.join(File.expand_path('../../..', __FILE__), 'migrations')
end
+ def db
+ @db ||= Sequel.connect(ENV['PERSISTENCE_DATABASE_URL'])
+ end
+
desc "Prints current schema version"
task :version do
- version = if DB.tables.include?(:schema_migrations)
- DB[:schema_migrations].to_a.last[:filename]
+ version = if db.tables.include?(:schema_migrations)
+ db[:schema_migrations].to_a.last[:filename] if db[:schema_migrations].to_a.any?
end || 0
puts "Last Migration: #{version}"
@@ -21,7 +22,7 @@
desc "Perform migration up to latest migration available"
task :migrate do
- Sequel::Migrator.run(DB, migrations_path)
+ Sequel::Migrator.run(db, migrations_path)
Rake::Task['db:version'].execute
end
@@ -29,14 +30,14 @@ task :rollback, :target do |t, args|
args.with_defaults(:target => 0)
- Sequel::Migrator.run(DB, migrations_path, :target => args[:target].to_i)
+ Sequel::Migrator.run(db, migrations_path, :target => args[:target].to_i)
Rake::Task['db:version'].execute
end
desc "Perform migration reset (full rollback and migration)"
task :reset do
- Sequel::Migrator.run(DB, migrations_path, :target => 0)
- Sequel::Migrator.run(DB, migrations_path)
+ Sequel::Migrator.run(db, migrations_path, :target => 0)
+ Sequel::Migrator.run(db, migrations_path)
Rake::Task['db:version'].execute
end
end
| Move Sequel connect inside a method |
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index abc1234..def5678 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -9,6 +9,7 @@ 'ndc_sdg_targets:import',
'historical_emissions:import',
'cait_indc:import',
+ 'wb_indc:import',
'adaptation:import'
]
| Add wb import to full import task
|
diff --git a/spec/requests/admin/users_controller_request_spec.rb b/spec/requests/admin/users_controller_request_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/admin/users_controller_request_spec.rb
+++ b/spec/requests/admin/users_controller_request_spec.rb
@@ -16,7 +16,7 @@ context 'on create' do
it 'does not raise DoubleRender error' do
expect {
- post admin_users_path, user: attributes_for(:alchemy_user).merge(send_credentials: '1')
+ post admin_users_path, params: {user: attributes_for(:alchemy_user).merge(send_credentials: '1')}
}.to_not raise_error
end
end
@@ -25,7 +25,7 @@ it 'does not raise DoubleRender error' do
user = create(:alchemy_member_user)
expect {
- patch admin_user_path(user), user: {send_credentials: '1'}
+ patch admin_user_path(user), params: {user: {send_credentials: '1'}}
}.to_not raise_error
end
end
| Fix syntax of Rails request helpers
|
diff --git a/cookbooks/monit/recipes/default.rb b/cookbooks/monit/recipes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/monit/recipes/default.rb
+++ b/cookbooks/monit/recipes/default.rb
@@ -1,15 +1,11 @@ certificate_manage "monit" do
cert_path "/etc/ssl/"
cert_file "#{node[:monit][:address]}.pem"
- owner "root"
- group "root"
end
-# cookbook_file '/etc/ssl/certs/monit.meinekleinefarm.org.pem' do
-# owner 'root'
-# group 'root'
-# mode 0600
-# end
+file "#{node[:monit][:cert]}" do
+ mode 0600
+end
package "monit"
| Set file permissions to self signed certificate. |
diff --git a/cookbooks/sysfs/recipes/default.rb b/cookbooks/sysfs/recipes/default.rb
index abc1234..def5678 100644
--- a/cookbooks/sysfs/recipes/default.rb
+++ b/cookbooks/sysfs/recipes/default.rb
@@ -30,10 +30,6 @@ supports :status => false, :restart => true, :reload => false
end
- file "/etc/sysfs.conf" do
- action :delete
- end
-
template "/etc/sysfs.d/99-chef.conf" do
source "sysfs.conf.erb"
owner "root"
| Remove temporary sysfs cleanup code
|
diff --git a/lib/active_merchant/billing/gateways/paypal_express_common.rb b/lib/active_merchant/billing/gateways/paypal_express_common.rb
index abc1234..def5678 100644
--- a/lib/active_merchant/billing/gateways/paypal_express_common.rb
+++ b/lib/active_merchant/billing/gateways/paypal_express_common.rb
@@ -2,8 +2,13 @@ module Billing
module PaypalExpressCommon
def self.included(base)
- base.class_inheritable_accessor :test_redirect_url
- base.class_inheritable_accessor :live_redirect_url
+ if base.respond_to?(:class_attribute)
+ base.class_attribute :test_redirect_url
+ base.class_attribute :live_redirect_url
+ else
+ base.class_inheritable_accessor :test_redirect_url
+ base.class_inheritable_accessor :live_redirect_url
+ end
base.live_redirect_url = 'https://www.paypal.com/cgibin/webscr'
end
| Use class_attribute instead of class_inheritable_accessor if available
(the latter is deprecated since ActiveSupport 2.3.11)
|
diff --git a/lib/all_aboard/source/perspectives.rb b/lib/all_aboard/source/perspectives.rb
index abc1234..def5678 100644
--- a/lib/all_aboard/source/perspectives.rb
+++ b/lib/all_aboard/source/perspectives.rb
@@ -23,19 +23,32 @@ def load_templates
return if @templates_loaded
- template_path = filesystem_path.join("templates").to_s
- Dir[template_path + "/*"].each do |template_full_path|
- template_relative_path = template_full_path.split("/").last
- file_elements = template_relative_path.split(".")
- basename = file_elements.first
- width, height = file_elements.second.split("x")
- perspective = @perspectives.detect { |p| p.filename.to_s == basename }
-
- markup = File.read(template_full_path)
- perspective.add_template(width.to_i, height.to_i, markup)
+ templates_path = filesystem_path.join("templates").to_s
+ each_template_for_path(templates_path) do |template_full_path|
+ load_template(template_full_path)
end
@templates_loaded = true
end
+
+ def each_template_for_path(templates_path)
+ Dir[templates_path + "/*"].sort.each do |template_full_path|
+ yield template_full_path
+ end
+ end
+
+ def load_template(template_full_path)
+ # TODO - this variable extraction could go in a class. The only problem
+ # is that adding filesystem awareness to a bunch of classes will make
+ # testing that more painful.
+ template_relative_path = template_full_path.split("/").last
+ file_elements = template_relative_path.split(".")
+ basename = file_elements.first
+ width, height = file_elements.second.split("x")
+ perspective = @perspectives.detect { |p| p.filename.to_s == basename }
+ markup = File.read(template_full_path)
+
+ perspective.add_template(width.to_i, height.to_i, markup)
+ end
end
end
| Fix filesystem ordering bug and refactor.
The main idea was to fix an intermittent issue on CI where templates
were coming back in a different order. I'm guessing filesystems on
different test instances were returning files in different orders
sometimes. It'd be a good idea to explicitly sort them anyway, since
their ordering will be displayed to the end user, too.
Refactored a tiny bit while I was in there.
|
diff --git a/lib/buildr/ipojo/project_extension.rb b/lib/buildr/ipojo/project_extension.rb
index abc1234..def5678 100644
--- a/lib/buildr/ipojo/project_extension.rb
+++ b/lib/buildr/ipojo/project_extension.rb
@@ -20,21 +20,24 @@ project.packages.each do |pkg|
if pkg.respond_to?(:to_hash) && pkg.to_hash[:type] == :jar
pkg.enhance do
- begin
- tmp_filename = pkg.to_s + ".out"
- metadata_file = project.ipojo.metadata_file
- if metadata_file.nil?
- metadata_file = project._(:target, :generated, :config, "ipojo.xml")
- mkdir_p File.dirname(metadata_file)
- File.open(metadata_file, "w") do |f|
- f << "<ipojo></ipojo>"
+ pkg.enhance do
+ begin
+ tmp_filename = pkg.to_s + ".out"
+ metadata_file = project.ipojo.metadata_file
+ if metadata_file.nil?
+ metadata_file = project._(:target, :generated, :config, "ipojo.xml")
+ mkdir_p File.dirname(metadata_file)
+ File.open(metadata_file, "w") do |f|
+ f << "<ipojo></ipojo>"
+ end
end
+ info("Processing #{File.basename(pkg.to_s)} through iPojo pre-processor")
+ Buildr::Ipojo.pojoize(project, pkg.to_s, tmp_filename, metadata_file)
+ FileUtils.mv tmp_filename, pkg.to_s
+ rescue => e
+ FileUtils.rm_rf pkg.to_s
+ raise e
end
- Buildr::Ipojo.pojoize(project, pkg.to_s, tmp_filename, metadata_file)
- FileUtils.mv tmp_filename, pkg.to_s
- rescue => e
- FileUtils.rm_rf pkg.to_s
- raise e
end
end
end
| Make sure that the jar processing occurs after the jar has been created by using the enhance in an enhance trick
|
diff --git a/lib/bullet/presenter/bullet_logger.rb b/lib/bullet/presenter/bullet_logger.rb
index abc1234..def5678 100644
--- a/lib/bullet/presenter/bullet_logger.rb
+++ b/lib/bullet/presenter/bullet_logger.rb
@@ -8,7 +8,11 @@
def self.setup
@logger_file = File.open( LOG_FILE, 'a+' )
- @logger = Bullet::BulletLogger.new( @logger_file )
+ @logger = Logger.new( @logger_file )
+
+ def @logger.format_message( severity, timestamp, progname, msg )
+ "#{timestamp.to_formatted_s(:db)}[#{severity}] #{msg}\n"
+ end
end
def self.active?
| Move rest of BulletLogger code to presenter
|
diff --git a/lib/chef/knife/elb_listener_delete.rb b/lib/chef/knife/elb_listener_delete.rb
index abc1234..def5678 100644
--- a/lib/chef/knife/elb_listener_delete.rb
+++ b/lib/chef/knife/elb_listener_delete.rb
@@ -39,7 +39,7 @@ def validate!
super
- unless @name_args.size < 2
+ if @name_args.size < 2
ui.error('Please specify the ELB ID and the listener PORT to remove')
exit 1
end
| Fix validation for elb listener delete.
|
diff --git a/lib/group_smarts/attach/sources/io.rb b/lib/group_smarts/attach/sources/io.rb
index abc1234..def5678 100644
--- a/lib/group_smarts/attach/sources/io.rb
+++ b/lib/group_smarts/attach/sources/io.rb
@@ -11,7 +11,7 @@
# Returns the MIME::Type of source.
def mime_type
- @mime_type ||= @data.respond_to?(:content_type) ? ::Mime::Type.lookup(@tempfile.content_type) : super
+ @mime_type ||= @data.respond_to?(:content_type) ? ::Mime::Type.lookup(@data.content_type) : super
end
# =Data=
| Correct bug in extracting CGI-supplied content_type
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1 @@-# Be sure to restart your server when you modify this file.
-
-Rails.application.config.session_store :cookie_store, key: '_patient-4_session'
+Rails.application.config.session_store :cookie_store, key: '_openlis_session'
| Change session store app name
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -2,8 +2,19 @@
# Be sure to restart your server when you modify this file.
+def self.cookie_prefix
+ if (Rails.env.production? || Rails.env.staging?) \
+ && Rails.application.config.relative_url_root == '/'
+ '__Host-'
+ elsif Rails.env.production? || Rails.env.staging?
+ '__Secure-'
+ else
+ ''
+ end
+end
+
Rails.application.config.session_store :cookie_store,
- key: '_code_ocean_session',
+ key: "#{cookie_prefix}CodeOcean-Session",
expire_after: 1.month,
secure: Rails.env.production? || Rails.env.staging?,
path: Rails.application.config.relative_url_root,
| Use Cookie Prefix in Production and Staging
|
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file.
-FinderFrontend::Application.config.session_store :cookie_store
+FinderFrontend::Application.config.session_store :cookie_store, expire_after: 15.minutes
| Expire sessions in 15 minutes
This is the NCSC guidance.
|
diff --git a/lib/rails_admin/custom_show_in_app.rb b/lib/rails_admin/custom_show_in_app.rb
index abc1234..def5678 100644
--- a/lib/rails_admin/custom_show_in_app.rb
+++ b/lib/rails_admin/custom_show_in_app.rb
@@ -15,7 +15,11 @@ register_instance_option :controller do
Proc.new do
if @object.class.name == 'Page'
- redirect_to main_app.page_url(@object)
+ if @object.fullpath.blank?
+ redirect_to main_app.page_url(@object)
+ else
+ redirect_to @object.fullpath
+ end
elsif @object.class.name == 'News'
redirect_to main_app.news_url(@object)
elsif @object.class.name == 'Obj'
| Fix show in app for pages |
diff --git a/lib/rubygems/commands/bump_command.rb b/lib/rubygems/commands/bump_command.rb
index abc1234..def5678 100644
--- a/lib/rubygems/commands/bump_command.rb
+++ b/lib/rubygems/commands/bump_command.rb
@@ -7,7 +7,7 @@
attr_reader :arguments, :usage
- OPTIONS = { :version => 'patch', :push => false, :tag => false, :release => false }
+ OPTIONS = { :version => 'patch', :push => false, :tag => false, :release => false, :commit => true }
def initialize
super 'bump', 'Bump the gem version', OPTIONS
@@ -16,11 +16,12 @@ option :push, '-p', 'Push to origin'
option :tag, '-t', 'Create a git tag and push --tags to origin'
option :release, '-r', 'Build gem from a gemspec and push to rubygems.org'
+ option :commit, '-c', 'Perform a commit after incrementing gem version'
end
def execute
bump
- commit
+ commit if options[:commit]
push if options[:push] || options[:tag]
release if options[:release]
tag if options[:tag]
| Make the 'commit' with gem bump optional
|
diff --git a/lib/minitest/ruby_golf_metrics/reporter.rb b/lib/minitest/ruby_golf_metrics/reporter.rb
index abc1234..def5678 100644
--- a/lib/minitest/ruby_golf_metrics/reporter.rb
+++ b/lib/minitest/ruby_golf_metrics/reporter.rb
@@ -6,30 +6,32 @@
class Reporter < ::Minitest::Reporter
- Erg = Struct.new(:method_name, :passed)
-
def start
- @ergs = []
+ @ergs = {}
end
def record(erg)
- @ergs << Erg.new(erg.location.gsub("RubyGolfTest#test_", "").gsub(/ .*/, ""), erg.passed?)
+ method_name = erg.location.
+ gsub("RubyGolfTest#test_", "").
+ gsub(/_[0-9]+.*$/, "")
+ @ergs[method_name] ||= []
+ @ergs[method_name] << erg.passed?
end
def report
io.puts "\nRuby Golf Metrics"
- @ergs.sort_by(&:method_name).each do |erg|
- if erg.passed
+ @ergs.each do |method_name, ergs|
+ if ergs.all?
begin
- counter = CharacterCounter.new(erg.method_name)
- msg = " #{colorize(erg.method_name, 32)}: #{counter.cumulative_size} characters"
+ counter = CharacterCounter.new(method_name)
+ msg = " #{colorize(method_name, 32)}: #{counter.cumulative_size} characters"
msg << " (#{counter.called_method_sizes.join(", ")})" if !counter.self_contained?
io.puts msg
rescue NoMethodError
- io.puts " #{colorize(erg.method_name, 31)}: UNDEFINED"
+ io.puts " #{colorize(method_name, 31)}: UNDEFINED"
end
else
- io.puts " #{colorize(erg.method_name, 31)}: FAILED"
+ io.puts " #{colorize(method_name, 31)}: FAILED"
end
end
end
| Allow multiple (numbered) test methods
|
diff --git a/hummingbird-rails-api/app/controllers/users_controller.rb b/hummingbird-rails-api/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/hummingbird-rails-api/app/controllers/users_controller.rb
+++ b/hummingbird-rails-api/app/controllers/users_controller.rb
@@ -1,16 +1,32 @@ # require 'twilio-ruby'
class UsersController < ActionController::API
+ include UsersHelper
+
def send_verification_code
- account_sid = ENV['TWILIO_ACCOUNT_SID']
- auth_token = ENV['TWILIO_AUTH_TOKEN']
- @client = Twilio::REST::Client.new(account_sid, auth_token)
- @client.messages.create(
- from: ENV['TWILIO_NUMBER'],
- to: params[:number],
- body: 'Random number!'
- )
- puts "it should have worked."
+ setup_sms
+ send_sms(params[:number],
+ "Your verification code is: " + generate_verification_code)
end
+ private
+
+ def generate_verification_code
+ totp = ROTP::TOTP.new("base32secret3232")
+ totp.now.to_s
+ end
+
+ def setup_sms
+ account_sid = ENV['TWILIO_ACCOUNT_SID']
+ auth_token = ENV['TWILIO_AUTH_TOKEN']
+ @client = Twilio::REST::Client.new(account_sid, auth_token)
+ end
+
+ def send_sms(deliver_to, body)
+ @client.messages.create(
+ from: ENV['TWILIO_NUMBER'],
+ to: deliver_to,
+ body: body)
+ end
+
end
| Add private method for generating verification codes; refactor send_verification_code by also creating private methods for setup_sms and send_sms behavior to be reused in other routes
|
diff --git a/lib/shipitron/server/upload_build_cache.rb b/lib/shipitron/server/upload_build_cache.rb
index abc1234..def5678 100644
--- a/lib/shipitron/server/upload_build_cache.rb
+++ b/lib/shipitron/server/upload_build_cache.rb
@@ -25,6 +25,8 @@ )
if result.failure?
Logger.warn 'Failed to upload build cache!'
+ else
+ Logger.info 'Upload complete.'
end
end
| Add logging on upload success
|
diff --git a/app/controllers/peoplefinder/information_requests_controller.rb b/app/controllers/peoplefinder/information_requests_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/peoplefinder/information_requests_controller.rb
+++ b/app/controllers/peoplefinder/information_requests_controller.rb
@@ -5,7 +5,7 @@ def new
@information_request = InformationRequest.new(
recipient: @person,
- message: I18n.t('controllers.information_requests.default_message',
+ message: I18n.t('peoplefinder.controllers.information_requests.default_message',
recipient: @person,
sender: current_user)
)
| Use scoped id for default_message
Needs peoplefinder.* qualifier
|
diff --git a/spec/contact_phone_number_spec.rb b/spec/contact_phone_number_spec.rb
index abc1234..def5678 100644
--- a/spec/contact_phone_number_spec.rb
+++ b/spec/contact_phone_number_spec.rb
@@ -12,7 +12,7 @@ it('saves the phone number and returns it') do
test_number = ContactPhoneNumber.new({:phone_number => '5125676637'})
test_number.save()
- expect(ContactPhoneNumber.all()).to(eq('5125675537'))
+ expect(ContactPhoneNumber.all()).to(eq([test_number]))
end
end
end
| Add contact phone number save spec and method
|
diff --git a/spec/views/currents_views_spec.rb b/spec/views/currents_views_spec.rb
index abc1234..def5678 100644
--- a/spec/views/currents_views_spec.rb
+++ b/spec/views/currents_views_spec.rb
@@ -2,9 +2,17 @@
describe "CurrentsViews" do
+ before(:each) do
+ @request.env["devise.mapping"] = Devise.mappings[:user]
+
+ @user = create(:user)
+ @user.confirm!
+ sign_in @user
+ end
+
describe "currents/edit" do
before(:each) do
- @current = create(:current)
+ @current = create(:current, :owner_id => @user.id)
end
it "renders the edit current form" do
@@ -18,8 +26,8 @@ describe "currents/index" do
before(:each) do
assign(:currents, [
- create(:current),
- create(:current)
+ create(:current, :owner_id => @user.id),
+ create(:current, :owner_id => @user.id)
])
end
@@ -43,7 +51,7 @@
describe "currents/show" do
before(:each) do
- @current = assign(:current, create(:current))
+ @current = assign(:current, create(:current, :owner_id => @user.id))
end
it "renders attributes in <p>" do
| Create Currents with owners in view specs
Current models need to have owner's assigned when testing Current
views.
|
diff --git a/warmercooler.rb b/warmercooler.rb
index abc1234..def5678 100644
--- a/warmercooler.rb
+++ b/warmercooler.rb
@@ -3,10 +3,19 @@ puts solution # This statement is temporary while I test the game.
puts "Guess what number I'm thinking of. It's between 1 and 1000"
guess = gets.to_i
+guesses.push(guess)
puts "Wrong! Guess again!" if guess != solution
while guess != solution
+ guess = gets.to_i
guesses.push(guess)
+ if guesses[-1] - solution < guesses[-2] - solution
+ puts "Warmer."
+ elsif guesses[-1] - solution > guesses[-2] - solution
+ puts "Cooler."
+ else
+ puts "Luke warm."
+ end
puts "You've guessed #{guesses}" # Temporary, to be replaced by prompt comparing guesses.
- guess = gets.to_i
+
end
puts "You got it!" | Add if loop for warmer and cooler
|
diff --git a/book-generator/test/test_utils.rb b/book-generator/test/test_utils.rb
index abc1234..def5678 100644
--- a/book-generator/test/test_utils.rb
+++ b/book-generator/test/test_utils.rb
@@ -3,24 +3,24 @@ require_relative "../generator/utils"
class UtilsTest < MiniTest::Test
- def test_AppendPrologueLink
+ def test_append_prologue_link
path = Array.new
path.push("First Part")
link = Utils.append_prologue_link(path)
assert_equal("first_part/prologue.md", link)
end
- def test_EmitArticleMarkdownFilename
+ def test_emit_article_markdown_filename
filename = Utils.emit_article_markdown_filename("Whether God is one?")
assert_equal("whether_god_is_one.md", filename)
end
- def test_EmitArticleMarkdownFilenameStripsCommas
+ def test_emit_article_markdown_filename_strips_commas
filename = Utils.emit_article_markdown_filename("Whether, God is, one?")
assert_equal("whether_god_is_one.md", filename)
end
- def test_PathFromStack
+ def test_path_from_stack
stack = Array.new
stack.push("First Part")
stack.push("Treatise on the one God")
| Use snake case for these tests.
|
diff --git a/db/fixtures/development/14_builds.rb b/db/fixtures/development/14_builds.rb
index abc1234..def5678 100644
--- a/db/fixtures/development/14_builds.rb
+++ b/db/fixtures/development/14_builds.rb
@@ -1,24 +1,35 @@ Gitlab::Seeder.quiet do
+ build_artifacts_path = Rails.root + 'spec/fixtures/ci_build_artifacts.tar.gz'
+ build_artifacts_cache_file = build_artifacts_path.to_s.gsub('ci_', '')
+
Project.all.sample(5).each do |project|
- commits = project.repository.commits('master', nil, 10)
+ commits = project.repository.commits('master', nil, 5)
commits_sha = commits.map { |commit| commit.raw.id }
ci_commits = commits_sha.map do |sha|
project.ensure_ci_commit(sha)
end
ci_commits.each do |ci_commit|
- attributes = { type: 'Ci::Build', name: 'test build',
- commands: "$ build command", stage: 'test',
- stage_idx: 1, ref: 'master', user_id: User.first,
- gl_project_id: project.id, options: '---- opts',
+ attributes = { type: 'Ci::Build', name: 'test build', commands: "$ build command",
+ stage: 'test', stage_idx: 1, ref: 'master',
+ user_id: project.team.users.sample, gl_project_id: project.id,
status: %w(running pending success failed canceled).sample,
- commit_id: ci_commit.id }
+ commit_id: ci_commit.id, created_at: Time.now, updated_at: Time.now }
+
+ build = Ci::Build.new(attributes)
+ build.artifacts_metadata = `tar tzf #{build_artifacts_path}`.split(/\n/)
+
+ FileUtils.copy(build_artifacts_path, build_artifacts_cache_file)
+ build.artifacts_file = artifacts_file = File.open(build_artifacts_cache_file, 'r')
begin
- Ci::Build.create!(attributes)
+ build.save!
print '.'
rescue ActiveRecord::RecordInvalid
+ puts build.error.messages.inspect
print 'F'
+ ensure
+ artifacts_file.close
end
end
end
| Add database seed for build artifacts
|
diff --git a/test/integration/compute/test_operations.rb b/test/integration/compute/test_operations.rb
index abc1234..def5678 100644
--- a/test/integration/compute/test_operations.rb
+++ b/test/integration/compute/test_operations.rb
@@ -0,0 +1,27 @@+require "helpers/integration_test_helper"
+
+class TestRoutes < FogIntegrationTest
+ def setup
+ @subject = Fog::Compute[:google].operations
+ end
+
+ def test_all
+ # TODO: what if this test runs first on a brand new project?
+ assert_operator(@subject.all.size, :>=, 2,
+ "There should be at least 2 operations in the project")
+ end
+
+ def test_get
+ @subject.all do |operation|
+ refute_nil @subject.get(operation.name)
+ end
+ end
+
+ def test_bad_get
+ assert_nil @subject.get("bad-name")
+ end
+
+ def test_enumerable
+ assert_respond_to @subject, :each
+ end
+end
| Add basic operations collection tests
|
diff --git a/sastrawi.gemspec b/sastrawi.gemspec
index abc1234..def5678 100644
--- a/sastrawi.gemspec
+++ b/sastrawi.gemspec
@@ -16,8 +16,8 @@ spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
- spec.bindir = "exe"
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
+ spec.bindir = "bin"
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.16.1"
| Change executable directory path to `bin`
|
diff --git a/lib/cwb/config.rb b/lib/cwb/config.rb
index abc1234..def5678 100644
--- a/lib/cwb/config.rb
+++ b/lib/cwb/config.rb
@@ -20,6 +20,8 @@ @node = node
end
+ # TODO: Consider returning nil as default value.
+ # The current deep_fetch implementation doesn't support { default: nil }
def deep_fetch(*keys)
@node.deep_fetch(*keys, default: "")
end
@@ -37,11 +39,11 @@ end
def provider_name
- deep_fetch("cwb", "provider_name")
+ deep_fetch("benchmark", "provider_name")
end
def provider_instance_id
- deep_fetch("cwb", "provider_instance_id")
+ deep_fetch("benchmark", "provider_instance_id")
end
| Fix wrong namespace for provider attributes in deep_fetch
|
diff --git a/lib/cucumber/broadcaster.rb b/lib/cucumber/broadcaster.rb
index abc1234..def5678 100644
--- a/lib/cucumber/broadcaster.rb
+++ b/lib/cucumber/broadcaster.rb
@@ -11,7 +11,8 @@
def method_missing(method_name, *args)
@receivers.each do |receiver|
- receiver.__send__(method_name, *args) if receiver.respond_to?(method_name)
+ r = (receiver == STDOUT) ? Kernel: receiver # Needed to make colors work on Windows
+ r.__send__(method_name, *args) if receiver.respond_to?(method_name)
end
end
| Fix broken colors on Windows
|
diff --git a/lib/rack/stats.rb b/lib/rack/stats.rb
index abc1234..def5678 100644
--- a/lib/rack/stats.rb
+++ b/lib/rack/stats.rb
@@ -36,6 +36,7 @@ @app = app
@namespace = args.fetch(:namespace, ENV['RACK_STATS_NAMESPACE'])
@statsd = Statsd.new(*args.fetch(:statsd, '127.0.0.1:8125').split(':'))
+ @statsd.tap { |sd| sd.namespace = @namespace } if @namespace
@stats = args.fetch(:stats, DEFAULT_STATS)
end
| Add namespace into the Statsd client
|
diff --git a/tools/distrib/rake_compiler_docker_image.rb b/tools/distrib/rake_compiler_docker_image.rb
index abc1234..def5678 100644
--- a/tools/distrib/rake_compiler_docker_image.rb
+++ b/tools/distrib/rake_compiler_docker_image.rb
@@ -23,7 +23,7 @@ dockerfile = File.join(grpc_root, 'third_party', 'rake-compiler-dock', 'rake_' + platform, 'Dockerfile')
dockerpath = File.dirname(dockerfile)
version = Digest::SHA1.file(dockerfile).hexdigest
- image_name = 'rake_' + platform + '_' + version
+ image_name = 'rake_' + platform + ':' + version
ENV.fetch('DOCKERHUB_ORGANIZATION', 'grpctesting') + '/' + image_name
end
| Update rake_compiler_dock image fetch to use a tag rather than name suffix
|
diff --git a/show_for.gemspec b/show_for.gemspec
index abc1234..def5678 100644
--- a/show_for.gemspec
+++ b/show_for.gemspec
@@ -12,7 +12,7 @@ s.description = "Wrap your objects with a helper to easily show them"
s.authors = ['José Valim']
- s.files = Dir["CHANGELOG.rdoc", "MIT-LICENSE", "README.rdoc", "lib/**/*"]
+ s.files = Dir["CHANGELOG.md", "MIT-LICENSE", "README.md", "lib/**/*"]
s.test_files = Dir["test/**/*"]
s.require_paths = ["lib"]
| Fix files in gemspec [ci skip]
|
diff --git a/zbroker.gemspec b/zbroker.gemspec
index abc1234..def5678 100644
--- a/zbroker.gemspec
+++ b/zbroker.gemspec
@@ -17,6 +17,7 @@ spec.add_dependency("rack")
spec.add_dependency("sinatra")
spec.add_dependency("json")
+ spec.add_dependency("zeus-api")
spec.files = files
spec.bindir = "bin"
| Add zeus-api dependency to gemspec
|
diff --git a/app/models/category.rb b/app/models/category.rb
index abc1234..def5678 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -3,7 +3,7 @@ has_many :runs
before_create :autodetect_shortname
- after_touch :destroy, if: Proc.new { |category| category.runs.count.zero? }
+ after_touch :destroy, if: Proc.new { |category| category.runs.unscoped.count.zero? }
def best_known_run
runs.where("time != 0").order(:time).first
| Fix a 500 when uploading runs
|
diff --git a/app/models/feedback.rb b/app/models/feedback.rb
index abc1234..def5678 100644
--- a/app/models/feedback.rb
+++ b/app/models/feedback.rb
@@ -6,4 +6,6 @@ neutral: 'neutral',
unhappy: 'unhappy'
}
+
+ validates :rating, presence: true
end
| Add AR validation for Feedback rating |
diff --git a/plugins/guests/darwin/cap/change_host_name.rb b/plugins/guests/darwin/cap/change_host_name.rb
index abc1234..def5678 100644
--- a/plugins/guests/darwin/cap/change_host_name.rb
+++ b/plugins/guests/darwin/cap/change_host_name.rb
@@ -4,7 +4,9 @@ class ChangeHostName
def self.change_host_name(machine, name)
if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'")
+ machine.communicate.sudo("scutil --set ComputerName #{name}")
machine.communicate.sudo("scutil --set HostName #{name}")
+ machine.communicate.sudo("scutil --set LocalHostName #{name}")
machine.communicate.sudo("hostname #{name}")
end
end
| Set ComputerName and LocalHostName on darwin guests
This sets the bonjour host name for darwin guests to the same value
as config.vm.hostname. It also sets the user-friendly name for the
system.
|
diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb
index abc1234..def5678 100644
--- a/plugins/guests/redhat/cap/change_host_name.rb
+++ b/plugins/guests/redhat/cap/change_host_name.rb
@@ -2,6 +2,9 @@ module GuestRedHat
module Cap
class ChangeHostName
+
+ extend Vagrant::Util::GuestInspection
+
def self.change_host_name(machine, name)
comm = machine.communicate
@@ -10,34 +13,32 @@ comm.sudo <<-EOH.gsub(/^ {14}/, '')
# Update sysconfig
sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network
-
# Update DNS
sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{basename}\"/' /etc/sysconfig/network-scripts/ifcfg-*
-
# Set the hostname - use hostnamectl if available
echo '#{name}' > /etc/hostname
- if command -v hostnamectl; then
- hostnamectl set-hostname --static '#{name}'
- hostnamectl set-hostname --transient '#{name}'
- else
- hostname -F /etc/hostname
- fi
-
- # Prepend ourselves to /etc/hosts
grep -w '#{name}' /etc/hosts || {
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
}
+ EOH
- # Restart network
- if (test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service); then
- systemctl restart NetworkManager.service
- elif test -f /etc/init.d/network; then
- service network restart
- else
- printf "Could not restart the network to set the new hostname!\n"
- exit 1
- fi
- EOH
+ if hostnamectl?(comm)
+ comm.sudo("hostnamectl set-hostname --static '#{name}' ; " \
+ "hostnamectl set-hostname --transient '#{name}'")
+ else
+ comm.sudo("hostname -F /etc/hostname")
+ end
+
+ restart_command = "service network restart"
+
+ if systemd?
+ if systemd_networkd?(comm)
+ restart_command = "systemctl restart systemd-networkd.service"
+ elsif systemd_controlled?(comm, "NetworkManager.service")
+ restart_command = "systemctl restart NetworkManager.service"
+ end
+ end
+ comm.sudo(restart_command)
end
end
end
| Update redhat change host name capability to support systemd
Update capability to use guest inspection module for determining
correct actions to execute. When systemd is in use restart the
correct active service, either NetworkManager or networkd. Default
to using the original service restart when systemd service is not
found.
|
diff --git a/app/models/paycheck.rb b/app/models/paycheck.rb
index abc1234..def5678 100644
--- a/app/models/paycheck.rb
+++ b/app/models/paycheck.rb
@@ -39,7 +39,7 @@
protected
def validate
- unless item_id.nil? || job_id.nil?
+ if item && job
errors.add(:item, "doesn't belong to you") unless item.user_id == job.user_id
end
end
| Simplify boolean logic on validation.
|
diff --git a/lib/nehm/command_manager.rb b/lib/nehm/command_manager.rb
index abc1234..def5678 100644
--- a/lib/nehm/command_manager.rb
+++ b/lib/nehm/command_manager.rb
@@ -3,8 +3,8 @@ module Nehm
##
- # The command manager contains information about all nehm commands, find
- # and run them
+ # The command manager contains information about all nehm commands
+ # It also find and run them
module CommandManager
@@ -13,6 +13,7 @@ :dl,
:get,
:help,
+ :search,
:select,
:version
]
| Add 'search' command to CommandManager
|
diff --git a/ruby_event_store-rom/lib/ruby_event_store/rom/repositories/stream_entries.rb b/ruby_event_store-rom/lib/ruby_event_store/rom/repositories/stream_entries.rb
index abc1234..def5678 100644
--- a/ruby_event_store-rom/lib/ruby_event_store/rom/repositories/stream_entries.rb
+++ b/ruby_event_store-rom/lib/ruby_event_store/rom/repositories/stream_entries.rb
@@ -33,11 +33,7 @@ end
def delete(stream)
- delete_changeset(stream).commit
- end
-
- def delete_changeset(stream)
- stream_entries.by_stream(stream).changeset(:delete)
+ stream_entries.by_stream(stream).command(:delete).call
end
def resolve_version(stream, expected_version)
| Use delete command instead of a changeset
|
diff --git a/db/migrate/20200608094511_change_klarna_client_token_to_text.rb b/db/migrate/20200608094511_change_klarna_client_token_to_text.rb
index abc1234..def5678 100644
--- a/db/migrate/20200608094511_change_klarna_client_token_to_text.rb
+++ b/db/migrate/20200608094511_change_klarna_client_token_to_text.rb
@@ -0,0 +1,10 @@+# frozen_string_literal: true
+
+class ChangeKlarnaClientTokenToText < ActiveRecord::Migration[5.2]
+ def change
+ reversible do |dir|
+ dir.up { change_column :spree_orders, :klarna_client_token, :text }
+ dir.down { change_column :spree_orders, :klarna_client_token, :string }
+ end
+ end
+end
| Fix MySQL complaining about column length
|
diff --git a/Casks/rstudio.rb b/Casks/rstudio.rb
index abc1234..def5678 100644
--- a/Casks/rstudio.rb
+++ b/Casks/rstudio.rb
@@ -3,7 +3,7 @@ sha256 'e211c0645540b8c668824b6fecdfd19820fe937c4db4432abc7aba06e7efd9e6'
# rstudio.org is the official download host per the vendor homepage
- url "http://download1.rstudio.org/RStudio-#{version}.dmg"
+ url "https://download1.rstudio.org/RStudio-#{version}.dmg"
name 'RStudio'
homepage 'http://www.rstudio.com/'
license :affero
| Update RStudio download to use HTTPS.
|
diff --git a/Library/Homebrew/test/utils/livecheck_formula_spec.rb b/Library/Homebrew/test/utils/livecheck_formula_spec.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/test/utils/livecheck_formula_spec.rb
+++ b/Library/Homebrew/test/utils/livecheck_formula_spec.rb
@@ -11,7 +11,7 @@
it "runs livecheck command for Formula" do
formatted_response = described_class.init(action)
-
+
expect(formatted_response).not_to be_nil
expect(formatted_response).to be_a(Hash)
expect(formatted_response.size).not_to eq(0)
| Refactor how test formulas are installed in tests
|
diff --git a/lib/apilint/reporter.rb b/lib/apilint/reporter.rb
index abc1234..def5678 100644
--- a/lib/apilint/reporter.rb
+++ b/lib/apilint/reporter.rb
@@ -6,7 +6,6 @@ end
def report(offenses)
- # TODO: puts 210 requests inspected, 12285 offenses detected
if offenses.empty?
puts "No offenses"
else
| Remove todo in Reporter class
|
diff --git a/rash.gemspec b/rash.gemspec
index abc1234..def5678 100644
--- a/rash.gemspec
+++ b/rash.gemspec
@@ -5,16 +5,13 @@ Gem::Specification.new do |s|
s.name = %q{rash}
s.authors = ["tcocca"]
- s.date = %q{2010-08-31}
s.description = %q{simple extension to Hashie::Mash for rubyified keys, all keys are converted to underscore to eliminate horrible camelCasing}
s.email = %q{tom.cocca@gmail.com}
s.homepage = %q{http://github.com/tcocca/rash}
s.rdoc_options = ["--charset=UTF-8"]
- s.rubygems_version = %q{1.3.5}
s.summary = %q{simple extension to Hashie::Mash for rubyified keys}
s.version = Rash::VERSION
- s.platform = Gem::Platform::RUBY
s.add_dependency "hashie", '~> 1.0.0'
s.add_development_dependency "rspec", "~> 2.5.0"
| Remove unnecessary declarations from gemspec
|
diff --git a/test/functional/routes_test.rb b/test/functional/routes_test.rb
index abc1234..def5678 100644
--- a/test/functional/routes_test.rb
+++ b/test/functional/routes_test.rb
@@ -5,13 +5,9 @@
require File.dirname(__FILE__) + '/../test_helper'
-class RoutesTest < Test::Unit::TestCase
- def setup
- @controller = TestRoutingController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
+class RoutesTest < ActionController::TestCase
+ tests TestRoutingController
+
def test_WITH_a_route_defined_in_a_plugin_IT_should_route_it
path = '/routes/an_action'
opts = {:controller => 'test_routing', :action => 'an_action'}
| Use the new ActionController::TestCase, because assert_routing is only available under it.
|
diff --git a/script/migrate_news_article_images.rb b/script/migrate_news_article_images.rb
index abc1234..def5678 100644
--- a/script/migrate_news_article_images.rb
+++ b/script/migrate_news_article_images.rb
@@ -1,7 +1,13 @@ NewsArticle.where("carrierwave_image IS NOT NULL").each do |article|
- puts "Retrieving image for NewsArticle##{article.id}"
- article.image.cache_stored_file!
- path_to_image = article.image.send(:cache_path)
- image = article.images.build(alt_text: article.image_alt_text, caption: article.image_caption, image_data_attributes: {file: File.open(path_to_image)})
- image.save(validate: false)
-end
+ next if article.images.any?
+ begin
+ puts "Retrieving image for NewsArticle##{article.id}"
+ article.image.cache_stored_file!
+ path_to_image = article.image.send(:cache_path)
+ image = article.images.build(alt_text: article.image_alt_text, caption: article.image_caption, image_data_attributes: {file: File.open(path_to_image)})
+ image.save(validate: false)
+ rescue => e
+ puts "issue with NewsArticle ##{article.id}"
+ puts e
+ end
+end | Make the script a bit more robust.
|
diff --git a/lib/couchdb/document.rb b/lib/couchdb/document.rb
index abc1234..def5678 100644
--- a/lib/couchdb/document.rb
+++ b/lib/couchdb/document.rb
@@ -6,6 +6,9 @@ alias dynamic_schema! dynamic_structure!
alias dynamic_schema? dynamic_structure?
end
+
+ property :_id, :string
+ property :_rev, :string
attr_reader :db
| Add default properties for Document (_id and _rev).
|
diff --git a/lib/bill_forward/entities/amendments/issue_invoice_amendment.rb b/lib/bill_forward/entities/amendments/issue_invoice_amendment.rb
index abc1234..def5678 100644
--- a/lib/bill_forward/entities/amendments/issue_invoice_amendment.rb
+++ b/lib/bill_forward/entities/amendments/issue_invoice_amendment.rb
@@ -0,0 +1,10 @@+module BillForward
+ class IssueInvoiceAmendment < Amendment
+ @resource_path = BillForward::ResourcePath.new("amendments", "amendment")
+
+ def initialize(*args)
+ super
+ set_state_param('@type', 'IssueInvoiceAmendment')
+ end
+ end
+end | Add issue invoice amendment probably
|
diff --git a/messaging.gemspec b/messaging.gemspec
index abc1234..def5678 100644
--- a/messaging.gemspec
+++ b/messaging.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-messaging'
- s.version = '0.12.0.1'
+ s.version = '0.12.1.0'
s.summary = 'Messaging primitives for Eventide'
s.description = ' '
| Package version increased from 0.12.0.1 to 0.12.1.0
|
diff --git a/lib/tasks/rummager.rake b/lib/tasks/rummager.rake
index abc1234..def5678 100644
--- a/lib/tasks/rummager.rake
+++ b/lib/tasks/rummager.rake
@@ -2,7 +2,7 @@
namespace :rummager do
desc "Indexes all editions in Rummager"
- task index_all: :environment do
+ task index: :environment do
task_logger.info "Sending published editions to rummager..."
slugs = Edition.published.map(&:slug)
PublishedSlugRegisterer.new(task_logger, slugs).do_rummager
| Rename index_all task to index
All other repos that perform document indexing directly via Rummager have rake
tasks called `rummager:index`. The intent of this change is to keep things
consistent.
|
diff --git a/roda/subject.rb b/roda/subject.rb
index abc1234..def5678 100644
--- a/roda/subject.rb
+++ b/roda/subject.rb
@@ -1,10 +1,20 @@+require "oj"
+
module Main
- class Subject < Jsonable
- attr_reader :id, :name
+ class Subject
def initialize(id:, name:)
- @id = id
- @name = name
+ @hash = {}
+ @hash[:Id] = id if id
+ @hash[:Name] = name if name
+ end
+
+ def to_hash
+ @hash
+ end
+
+ def to_json
+ Oj.dump(@hash)
end
end
end | [roda][Subject] Speed up encoding to json
|
diff --git a/rom-sql.gemspec b/rom-sql.gemspec
index abc1234..def5678 100644
--- a/rom-sql.gemspec
+++ b/rom-sql.gemspec
@@ -19,6 +19,7 @@ spec.require_paths = ["lib"]
spec.add_runtime_dependency "sequel", "~> 4.16"
+ spec.add_runtime_dependency "rom", "~> 0.3", "~> 0.3.0"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake", "~> 10.0"
| Add rom as a runtime dep
|
diff --git a/spec/controllers/dashboard_controller_spec.rb b/spec/controllers/dashboard_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/dashboard_controller_spec.rb
+++ b/spec/controllers/dashboard_controller_spec.rb
@@ -23,7 +23,7 @@ expect(assigns[:provided_attributes]).to include(attribute)
end
- context 'with api ony roles' do
+ context 'with api only roles' do
let(:api_role) do
create(:role, provider: role.provider).tap do |role|
create(:permission, value: 'api:attributes:read', role: role)
| Fix typo in rspec context
|
diff --git a/config/deploy.rb b/config/deploy.rb
index abc1234..def5678 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -1,50 +1,18 @@-# config valid only for current version of Capistrano
lock '3.4.0'
set :application, 'hacken-in'
set :repo_url, 'https://github.com/hacken-in/website.git'
-# Default branch is :master
-# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
+set :user, 'hacken'
+set :log_level, :info
+set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
-# Default deploy_to directory is /var/www/my_app_name
-# set :deploy_to, '/home/hacken/hacken-in'
-
-set :user, 'hacken'
-
-# Default value for :scm is :git
-# set :scm, :git
-
-# Default value for :format is :pretty
-# set :format, :pretty
-
-# Default value for :log_level is :debug
-set :log_level, :info
-
-# Default value for :pty is false
-# set :pty, true
-
-# Default value for :linked_files is []
-# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
-
-# Default value for linked_dirs is []
-# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
-
-# Default value for default_env is {}
-# set :default_env, { path: "/opt/ruby/bin:$PATH" }
-
-# Default value for keep_releases is 5
-# set :keep_releases, 5
+set :keep_releases, 5
namespace :deploy do
-
after :restart, :clear_cache do
- on roles(:web), in: :groups, limit: 3, wait: 10 do
- # Here we can do anything such as:
- # within release_path do
- # execute :rake, 'cache:clear'
- # end
+ on roles(:web) do
+ run "svc -h svc -h ~/service/hacken-in-#{fetch(:stage)"
end
end
-
end
| Clean up Capistrano config + restart unicorn
|
diff --git a/lib/cassy/authenticators/devise.rb b/lib/cassy/authenticators/devise.rb
index abc1234..def5678 100644
--- a/lib/cassy/authenticators/devise.rb
+++ b/lib/cassy/authenticators/devise.rb
@@ -18,7 +18,7 @@ def self.validate(credentials)
user = find_user(credentials)
# Did we find a user, are they active? and is their password valid?
- user && user.active_for_authentication? && user.valid_password?(credentials[:password])
+ user && user.active_for_authentication? && user.valid_for_authentication? { user.valid_password?(credentials[:password]) }
end
end
end
| Verify a user is valid for authentication during validation
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,6 @@ #DeviseHeroku::Engine.routes.draw do
Rails.application.routes.draw do
- scope :module => "DeviseHeroku" do
+ scope :module => "devise_heroku" do
post "/heroku/sso/login" => "sso#login"
end
end | Use underscore module name in route scope
Rails 4 breaks with camel case module name.
Still works under Rails 3. |
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,12 @@ Rails.application.routes.draw do
+ authenticated :developer do
+ root 'developers#show', as: :developer_root
+ end
+
+ authenticated :recruiter do
+ root 'recruiters#show', as: :recruiter_root
+ end
+
root to: 'pages#index'
devise_for :developers,
| Set authenticated root page for developers and recruiters
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -9,7 +9,6 @@ post "/conversations" => "conversations#create"
get "/conversations/:id" => "conversations#show"
post "/conversations/:id/personal_messages" => "personal_messages#create"
- get "/cable"
resources :users, only: [:create, :update, :show]
resources :sessions, only: [:destroy]
| Add client-side ActionCable in Conversation.js
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -14,6 +14,7 @@ get 'feedbacks/:id' => 'feedbacks#show', as: 'feedback'
post '/feedbacks' => 'feedbacks#create', as: 'create_feedback'
post '/invitations' => 'invitations#create', as: 'create_invitation'
+ put '/invitations' => 'invitations#update', as: 'update_invitation'
delete '/invitations' => 'invitations#destroy', as: 'delete_invitation'
post '/pusher/auth' => 'pusher#auth'
end
| Add update action for invitations
|
diff --git a/lib/json/streamer/json_streamer.rb b/lib/json/streamer/json_streamer.rb
index abc1234..def5678 100644
--- a/lib/json/streamer/json_streamer.rb
+++ b/lib/json/streamer/json_streamer.rb
@@ -22,7 +22,6 @@ conditions = Conditions.new(yield_level: nesting_level, yield_key: key)
conditions.yield_value = ->(aggregator:, value:) { false } unless yield_values
- # TODO: deprecate symbolize_keys and move to initialize
@parser = Parser.new(@event_generator, symbolize_keys: symbolize_keys)
parser.get(conditions) do |obj|
| Remove todo comment, wont do
|
diff --git a/manageiq-appliance-dependencies.rb b/manageiq-appliance-dependencies.rb
index abc1234..def5678 100644
--- a/manageiq-appliance-dependencies.rb
+++ b/manageiq-appliance-dependencies.rb
@@ -1,3 +1,3 @@ # Add gems here, in Gemfile syntax, which are dependencies of the appliance itself rather than a part of the ManageIQ application
-gem "manageiq-appliance_console", "~>2.0", ">=2.0.1", :require => false
+gem "manageiq-appliance_console", "~>2.0", ">=2.0.2", :require => false
gem "manageiq-postgres_ha_admin", "~>1.0.0", :require => false
| Update the included console version to 2.0.2
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1561075
|
diff --git a/cane-hashcheck.gemspec b/cane-hashcheck.gemspec
index abc1234..def5678 100644
--- a/cane-hashcheck.gemspec
+++ b/cane-hashcheck.gemspec
@@ -8,9 +8,9 @@ spec.version = Cane::Hashcheck::VERSION
spec.authors = ['Chris Hunt']
spec.email = ['c@chrishunt.co']
- spec.description = %q{TODO: Write a gem description}
- spec.summary = %q{TODO: Write a gem summary}
- spec.homepage = ''
+ spec.description = %q{Create Cane violations for pre-Ruby 1.9 hash syntax}
+ spec.summary = %q{Create Cane violations for pre-Ruby 1.9 hash syntax}
+ spec.homepage = 'https://github.com/chrishunt/cane-hashcheck'
spec.license = 'MIT'
spec.files = `git ls-files`.split($/)
| Add description and homepage to gemspec
|
diff --git a/test/test_timeout.rb b/test/test_timeout.rb
index abc1234..def5678 100644
--- a/test/test_timeout.rb
+++ b/test/test_timeout.rb
@@ -35,4 +35,30 @@ assert_equal 1, ntimeouts
end
+ def test_no_busy_spin
+ # ample time to busy-check many times - in case we have a bug
+ t = TimeoutCheckSource.new(0.5)
+ t.trigger { @loop.quit; next false }
+ @loop.add_source(t)
+ @loop.run
+
+ assert 1 < t.nchecks and t.nchecks < 6
+ end
+
+ class TimeoutCheckSource < EventCore::TimeoutSource
+
+ attr_reader :nchecks
+
+ def initialize(secs)
+ super(secs)
+ @nchecks = 0
+ end
+
+ def timeout
+ t = super
+ @nchecks += 1
+ t
+ end
+ end
+
end | Add regression test for the busy-spinning timeout issue
|
diff --git a/db/migrate/20141018200347_add_encrypted_message_to_note.rb b/db/migrate/20141018200347_add_encrypted_message_to_note.rb
index abc1234..def5678 100644
--- a/db/migrate/20141018200347_add_encrypted_message_to_note.rb
+++ b/db/migrate/20141018200347_add_encrypted_message_to_note.rb
@@ -1,6 +1,6 @@ class AddEncryptedMessageToNote < ActiveRecord::Migration
def up
- add_column :notes, :message_encrypted, :string
+ add_column :notes, :message_encrypted, :text
encrypt_notes
remove_column :notes, :message, :string
end
| Change notes message_encrypted from :string to :text |
diff --git a/db/migrate/20161202152031_remove_duplicates_from_routes.rb b/db/migrate/20161202152031_remove_duplicates_from_routes.rb
index abc1234..def5678 100644
--- a/db/migrate/20161202152031_remove_duplicates_from_routes.rb
+++ b/db/migrate/20161202152031_remove_duplicates_from_routes.rb
@@ -12,20 +12,16 @@ # to fill these values that avoid duplicate entries in the routes table.
return unless Gitlab::Database.mysql?
- select_all("SELECT path FROM #{quote_table_name(:routes)} GROUP BY path HAVING COUNT(*) > 1").each do |row|
- path = connection.quote(row['path'])
- execute(%Q{
- DELETE FROM #{quote_table_name(:routes)}
- WHERE path = #{path}
- AND id != (
- SELECT id FROM (
- SELECT max(id) AS id
- FROM #{quote_table_name(:routes)}
- WHERE path = #{path}
- ) max_ids
- )
- })
- end
+ execute <<-EOF
+ DELETE duplicated_rows.*
+ FROM routes AS duplicated_rows
+ INNER JOIN (
+ SELECT path, MAX(id) as max_id
+ FROM routes
+ GROUP BY path
+ HAVING COUNT(*) > 1
+ ) AS good_rows ON good_rows.path = duplicated_rows.path AND good_rows.max_id <> duplicated_rows.id;
+ EOF
end
def down
| Improve performance on RemoveDuplicatesFromRoutes migration
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -20,5 +20,6 @@ 'X-Frame-Options' => 'ALLOWALL'
}
config.action_mailer.asset_host = 'http://stoperica.herokuapp.com'
+ config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
end
end
| Add fonts folder to sprockets path
|
diff --git a/db/migrate/20170206002115_change_playlist_id_in_sound_treks.rb b/db/migrate/20170206002115_change_playlist_id_in_sound_treks.rb
index abc1234..def5678 100644
--- a/db/migrate/20170206002115_change_playlist_id_in_sound_treks.rb
+++ b/db/migrate/20170206002115_change_playlist_id_in_sound_treks.rb
@@ -0,0 +1,6 @@+class ChangePlaylistIdInSoundTreks < ActiveRecord::Migration[5.0]
+ def change
+ rename_column :sound_treks, :playlist_id, :playlist
+ change_column :sound_treks, :playlist, :string
+ end
+end
| Add migration to change playlist_id column in sound_treks table
|
diff --git a/lib/data_mapper/support/graph/edge.rb b/lib/data_mapper/support/graph/edge.rb
index abc1234..def5678 100644
--- a/lib/data_mapper/support/graph/edge.rb
+++ b/lib/data_mapper/support/graph/edge.rb
@@ -8,7 +8,7 @@ @name = name.to_sym
@left = left
@right = right
- @nodes = Set.new([ @left, @right ])
+ @nodes = Set[ left, right ]
end
def connects?(node)
| Simplify set creation in Graph::Edge
|
diff --git a/lib/geocoder/results/ipgeolocation.rb b/lib/geocoder/results/ipgeolocation.rb
index abc1234..def5678 100644
--- a/lib/geocoder/results/ipgeolocation.rb
+++ b/lib/geocoder/results/ipgeolocation.rb
@@ -4,16 +4,15 @@ class Ipgeolocation < Base
def address(format = :full)
- s = region_code.empty? ? "" : ", #{region_code}"
- "#{city}#{s} #{zip}, #{country_name}".sub(/^[ ,]*/, "")
+ "#{city}, #{state} #{postal_code}, #{country_name}".sub(/^[ ,]*/, "")
end
def state
- @data['region_name']
+ @data['state_prov']
end
def state_code
- @data['region_code']
+ @data['state_prov']
end
def country
@@ -21,7 +20,7 @@ end
def postal_code
- @data['zip'] || @data['zipcode'] || @data['zip_code']
+ @data['zipcode']
end
def self.response_attributes
@@ -51,4 +50,4 @@ end
end
end
-end+end
| Fix references to invalid hash keys.
|
diff --git a/lib/quick_count/active_record/base.rb b/lib/quick_count/active_record/base.rb
index abc1234..def5678 100644
--- a/lib/quick_count/active_record/base.rb
+++ b/lib/quick_count/active_record/base.rb
@@ -12,12 +12,6 @@ result[0]["quick_count"].to_i
end
- def count_estimate
- my_statement = ::ActiveRecord::Base.connection.quote(to_sql)
- result = ::ActiveRecord::Base.connection.execute("SELECT count_estimate(#{my_statement})")
- result[0]["count_estimate"]
- end
-
end
end
| Remove unused code from wrong place
|
diff --git a/lib/rom/schema/definition/relation.rb b/lib/rom/schema/definition/relation.rb
index abc1234..def5678 100644
--- a/lib/rom/schema/definition/relation.rb
+++ b/lib/rom/schema/definition/relation.rb
@@ -21,7 +21,7 @@ end
def key(*attribute_names)
- @keys << attribute_names
+ @keys.concat(attribute_names)
self
end
| Build flat array with keys
|
diff --git a/lib/wulin_master/grid/grid_columns.rb b/lib/wulin_master/grid/grid_columns.rb
index abc1234..def5678 100644
--- a/lib/wulin_master/grid/grid_columns.rb
+++ b/lib/wulin_master/grid/grid_columns.rb
@@ -4,21 +4,33 @@
included do
class_eval do
- class_attribute :columns
+ class << self
+ attr_accessor :columns
+ end
end
end
module ClassMethods
# Private - executed when class is subclassed
def initialize_columns
- if self.columns.nil?
- self.columns = [Column.new(:id, self, {:visible => false, :editable => false, :sortable => true})]
- end
+ self.columns ||= [Column.new(:id, self, {:visible => false, :editable => false, :sortable => true})]
end
# Add a column
def column(name, options={})
self.columns += [Column.new(name, self, options)]
+ end
+
+ # Remove columns for exactly screens
+ def remove_columns(r_columns, scope={})
+ return unless scope[:screen].present?
+
+ r_columns = r_columns.map(&:to_s)
+ self.columns.each do |column|
+ if r_columns.include? column.name.to_s
+ column.options[:except] = scope[:screen]
+ end
+ end
end
end
@@ -26,7 +38,23 @@
# Returns columns
def columns
- self.class.columns
+ screen_name = params[:screen]
+ columns_pool = self.class.columns.dup
+
+ columns_pool.select do |column|
+ valid_column?(column, screen_name)
+ end
end
+
+
+ private
+
+ def valid_column?(column, screen_name)
+ screen_name = screen_name.to_s
+ (column.options[:only].blank? and column.options[:except].blank?) ||
+ (column.options[:only].present? and column.options[:only].map(&:to_s).include?(screen_name)) ||
+ (column.options[:except].present? and column.options[:except].map(&:to_s).exclude?(screen_name))
+ end
+
end
end | REFACTOR - GridColumn module refactors, add +remove_column+ method, add only and except option
|
diff --git a/lib/zabbixapi/classes/applications.rb b/lib/zabbixapi/classes/applications.rb
index abc1234..def5678 100644
--- a/lib/zabbixapi/classes/applications.rb
+++ b/lib/zabbixapi/classes/applications.rb
@@ -34,8 +34,10 @@
def get_full_data(data)
filter_params = {}
- data.each { |key| filter_params[key] = data.delete(key) unless API_PARAMETERS.include?(key) }
- @client.api_request(:method => "application.get", :params => data.merge({:filter => filter_params, :output => "extend"}))
+ request_data = data.dup # Duplicate data, as we modify it. Otherwise methods that use data after calling get_full_data (such as get_id) will fail.
+
+ request_data.each { |key, value| filter_params[key] = request_data.delete(key) unless API_PARAMETERS.include?(key) }
+ @client.api_request(:method => "application.get", :params => request_data.merge({:filter => filter_params, :output => "extend"}))
end
def get_id(data)
| Duplicate data so that we don't affect the operation of calling methods. Fixed filter params
|
diff --git a/db/data_migration/20171221134303_rename_large_housing_providers.rb b/db/data_migration/20171221134303_rename_large_housing_providers.rb
index abc1234..def5678 100644
--- a/db/data_migration/20171221134303_rename_large_housing_providers.rb
+++ b/db/data_migration/20171221134303_rename_large_housing_providers.rb
@@ -0,0 +1,12 @@+old_slug = "letter-from-julian-ashby-to-chairs-and-chief-executives-of-large-housing-providers"
+new_slug = "letter-from-julian-ashby-to-chairs-and-chief-executives-of-social-housing-providers"
+
+document = Document.find_by!(slug: old_slug)
+edition = document.editions.published.last
+
+Whitehall::SearchIndex.delete(edition)
+
+document.update_attributes!(slug: new_slug)
+PublishingApiDocumentRepublishingWorker.new.perform(document.id)
+
+puts "#{old_slug} -> #{new_slug}"
| Rename URL of letter to large housing providers
Change to https://www.gov.uk/government/publications/letter-from-julian-ashby-to-chairs-and-chief-executives-of-large-housing-providers to https://www.gov.uk/government/publications/letter-from-julian-ashby-to-chairs-and-chief-executives-of-social-housing-providers.
|
diff --git a/rb/lib/selenium/webdriver/common/zipper.rb b/rb/lib/selenium/webdriver/common/zipper.rb
index abc1234..def5678 100644
--- a/rb/lib/selenium/webdriver/common/zipper.rb
+++ b/rb/lib/selenium/webdriver/common/zipper.rb
@@ -36,7 +36,7 @@ entry = file.sub("#{path}/", '')
zos.put_next_entry(entry)
- zos << File.read(file)
+ zos << File.read(file, "rb")
end
zos.close
| JariBakken: Make sure we properly zip binary files on Windows.
git-svn-id: aa1aa1384423cb28c2b1e29129bb3a91de1d9196@11358 07704840-8298-11de-bf8c-fd130f914ac9
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.