diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/rails_i18n_updater.rb b/lib/rails_i18n_updater.rb index abc1234..def5678 100644 --- a/lib/rails_i18n_updater.rb +++ b/lib/rails_i18n_updater.rb @@ -14,10 +14,7 @@ # Prepare new load path in after_initialize as the I18n.load_path might # be modified in Rails initializers. -class Rails::Initializer - def after_initialize_with_rails_locales - after_initialize_without_rails_locales - RailsI18nUpdater.prepare_i18n_load_path - end - alias_method_chain :after_initialize, :rails_locales +Rails.configuration.after_initialize do + RailsI18nUpdater.prepare_i18n_load_path end +end
Use an after_initialize configuration block instead of redefining a Rails method
diff --git a/Formula/oxygen-icons.rb b/Formula/oxygen-icons.rb index abc1234..def5678 100644 --- a/Formula/oxygen-icons.rb +++ b/Formula/oxygen-icons.rb @@ -1,9 +1,9 @@ require 'formula' class OxygenIcons <Formula - url 'ftp://ftp.kde.org/pub/kde/stable/4.4.2/src/oxygen-icons-4.4.2.tar.bz2' + url 'ftp://ftp.kde.org/pub/kde/stable/4.5.2/src/oxygen-icons-4.5.2.tar.bz2' homepage 'http://www.oxygen-icons.org/' - md5 '86e655d909f743cea6a2fc6dd90f0e52' + md5 '64cd34251378251d56b9e56a9d4d7bf6' depends_on 'cmake' => :build
Update Oxygen icons to 4.5.2.
diff --git a/lib/tasks/log_parser.rake b/lib/tasks/log_parser.rake index abc1234..def5678 100644 --- a/lib/tasks/log_parser.rake +++ b/lib/tasks/log_parser.rake @@ -0,0 +1,27 @@+namespace :log do + + desc 'parses the logfile' + task :parse => :environment do + count = 0 + IP_REGEXP = /(?:[0-9]{1,3}\.){3}[0-9]{1,3}/ + buffer = [] + STDIN.each_line do |line| + if count > 0 + buffer << line + if !buffer.empty? && buffer.any? { |l| l.match /^Completed 401/ } + puts buffer.join(" ") + buffer = [] + end + count -= 1 + next + else + buffer = [] unless buffer.empty? + end + next unless line.match(/^Started/) + if !!line.match(/^Started POST \"\/nodes\" for #{IP_REGEXP} at Fri Jun 15/) + buffer << line + count = 5 + end + end + end +end
Add task for parsing log files.
diff --git a/laravel/recipes/storage_permissions.rb b/laravel/recipes/storage_permissions.rb index abc1234..def5678 100644 --- a/laravel/recipes/storage_permissions.rb +++ b/laravel/recipes/storage_permissions.rb @@ -4,7 +4,7 @@ user "root" cwd "#{deploy[:deploy_to]}/current" code <<-EOH - chdmod -R 777 storage + chmod -R 777 storage/app storage/framework storage/logs EOH end end
Change the permissions of the Laravel storage directories
diff --git a/lib/sms_sender.rb b/lib/sms_sender.rb index abc1234..def5678 100644 --- a/lib/sms_sender.rb +++ b/lib/sms_sender.rb @@ -14,6 +14,10 @@ message: message }).response + if response.code != "200" + logger.error "Unable to send SMS to #{mobile_no}" + end + return (response.code == "200") end
Add print to log when message cannot be sent
diff --git a/lib/text2voice.rb b/lib/text2voice.rb index abc1234..def5678 100644 --- a/lib/text2voice.rb +++ b/lib/text2voice.rb @@ -1,5 +1,39 @@ require "text2voice/version" module Text2voice - # Your code goes here... + def initialize(api_key) + @api_key = api_key + end + + def speaker(speaker_name) + + end + + def emotion(emotion: nil, level: nil) + + end + + def pitch(param) + + end + + def volulme(param) + + end + + def speak(text) + + end + + def save(wav) + + end + + def play(wav) + + end + + def create_request(text, speaker, emotion, emotion_level, pitch, speed, volume) + + end end
Add method to create request
diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -9,6 +9,10 @@ flash[:alert] = "#{@answer.errors.full_messages.join("--")}" end redirect_to question + end + + def show + @question = Question.find(params[:question_id]) end
Add show action for answers
diff --git a/app/controllers/budgets_controller.rb b/app/controllers/budgets_controller.rb index abc1234..def5678 100644 --- a/app/controllers/budgets_controller.rb +++ b/app/controllers/budgets_controller.rb @@ -1,5 +1,6 @@ class BudgetsController < ApplicationController include FeatureFlags + include BudgetsHelper feature_flag :budgets load_and_authorize_resource @@ -9,6 +10,7 @@ respond_to :html, :js def show + raise ActionController::RoutingError, 'Not Found' unless budget_published?(@budget) end def index
Return 404 status for non-published Budget access Why: Non-admin users shouldn't be able to access, or know of the existence of a non-published Budget. How: Raising an ActionController::RoutingError (404 error) to simulate the same behaviour as accesing a non-existing Budget. We could have used CanCanCan abilities for this but then an user could be aware of existing but not published Budgets by trying different urls
diff --git a/app/models/builders/manual_builder.rb b/app/models/builders/manual_builder.rb index abc1234..def5678 100644 --- a/app/models/builders/manual_builder.rb +++ b/app/models/builders/manual_builder.rb @@ -1,9 +1,9 @@ require "securerandom" class ManualBuilder - def initialize(dependencies) - @slug_generator = dependencies.fetch(:slug_generator) - @factory = dependencies.fetch(:factory) + def initialize(slug_generator:, factory:) + @slug_generator = slug_generator + @factory = factory end def call(attrs)
Use Ruby keyword args in ManualBuilder I think that using language features instead of custom code makes this easier to understand.
diff --git a/lib/engineyard-cloud-client/version.rb b/lib/engineyard-cloud-client/version.rb index abc1234..def5678 100644 --- a/lib/engineyard-cloud-client/version.rb +++ b/lib/engineyard-cloud-client/version.rb @@ -1,7 +1,7 @@ # This file is maintained by a herd of rabid monkeys with Rakes. module EY class CloudClient - VERSION = '1.0.9' + VERSION = '1.0.10.pre' end end # Please be aware that the monkeys like tho throw poo sometimes.
Add .pre for next release
diff --git a/spree_sort_payment_methods.gemspec b/spree_sort_payment_methods.gemspec index abc1234..def5678 100644 --- a/spree_sort_payment_methods.gemspec +++ b/spree_sort_payment_methods.gemspec @@ -2,16 +2,16 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'spree_sort_payment_methods' - s.version = '2.1.1' + s.version = '2.1.2' s.summary = 'Allow to sort payments methods from backend' s.description = 'Allow to sort payments method from backend' s.required_ruby_version = '>= 1.9.3' s.author = 'Steven Barragan' s.email = 'me@steven.mx' + s.homepage = 'https://github.com/stevenbarragan/spree_sort_payment_methods' - #s.files = `git ls-files`.split("\n") - #s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.files = `git ls-files`.split("\n") s.require_path = 'lib' s.requirements << 'none'
Add missing files in gemspec * Update version * Add home page
diff --git a/week-4/longest-string/my_solution.rb b/week-4/longest-string/my_solution.rb index abc1234..def5678 100644 --- a/week-4/longest-string/my_solution.rb +++ b/week-4/longest-string/my_solution.rb @@ -12,6 +12,7 @@ # Your Solution Below +=begin Initial Solution def longest_string(list_of_words) # Your code goes here! if (list_of_words.length == 0) @@ -25,4 +26,12 @@ end return long_string end +end +=end + +#Refactored Solution +def longest_string(list_of_words) + list_of_words = list_of_words.sort_by {|x| x.length} + long_string = list_of_words[-1] + return long_string end
Add refactored longest string solution
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,6 +1,8 @@ # Generated by cucumber-sinatra. (2013-12-03 12:11:29 +0000) ENV['RACK_ENV'] = 'test' +ENV['METRICS_API_USERNAME'] = 'foo' +ENV['METRICS_API_PASSWORD'] = 'bar' require File.join(File.dirname(__FILE__), '..', '..', 'lib/metrics-api.rb')
Load in fake auth details for test
diff --git a/lib/octokit/enterprise_admin_client.rb b/lib/octokit/enterprise_admin_client.rb index abc1234..def5678 100644 --- a/lib/octokit/enterprise_admin_client.rb +++ b/lib/octokit/enterprise_admin_client.rb @@ -32,6 +32,8 @@ Octokit::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", options[key] || Octokit.instance_variable_get(:"@#{key}")) end + + login_from_netrc unless user_authenticated? || application_authenticated? end end
Add .netrc login support to Octokit::EnterpriseAdminClient
diff --git a/carrierwave-aws.gemspec b/carrierwave-aws.gemspec index abc1234..def5678 100644 --- a/carrierwave-aws.gemspec +++ b/carrierwave-aws.gemspec @@ -19,5 +19,6 @@ gem.add_dependency 'carrierwave', '~> 0.7' gem.add_dependency 'aws-sdk', '~> 2.0' + gem.add_development_dependency 'rake', '~> 10.0' gem.add_development_dependency 'rspec', '~> 3' end
Add rake as dev dependencies
diff --git a/lib/picolena/templates/db/migrate/20090213234937_create_documents.rb b/lib/picolena/templates/db/migrate/20090213234937_create_documents.rb index abc1234..def5678 100644 --- a/lib/picolena/templates/db/migrate/20090213234937_create_documents.rb +++ b/lib/picolena/templates/db/migrate/20090213234937_create_documents.rb @@ -14,6 +14,9 @@ t.datetime :cache_mtime end + + add_index(:documents, :complete_path) + add_index(:documents, :probably_unique_id) end def self.down
Add index to documents table
diff --git a/spec/factories/working_group_roles.rb b/spec/factories/working_group_roles.rb index abc1234..def5678 100644 --- a/spec/factories/working_group_roles.rb +++ b/spec/factories/working_group_roles.rb @@ -3,6 +3,15 @@ factory :working_group_role, class: WorkingGroup::Role do user working_group + + # an active circle volunteer role is required for a lale user to work correctly. + # there's no case where a user is in a working group admin without being circle volunteer as well. + after(:create) do |role, evaluator| + circle = evaluator.working_group.circle + unless circle.roles.volunteer.exists?(user: evaluator.user) + create(:circle_role_volunteer, circle: circle, user: evaluator.user) + end + end factory :working_group_admin_role, aliases: [:working_group_organizer_role] do role_type { "admin" }
Create circle volunteer roles when creating working group role.
diff --git a/recipes/server.rb b/recipes/server.rb index abc1234..def5678 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -7,10 +7,10 @@ # Apache 2.0 # -if "#{node.zabbix.server.install}" +if node.zabbix.server.install include_recipe "zabbix::server_#{node.zabbix.server.install_method}" end -if "#{node.zabbix.web.install}" +if node.zabbix.web.install include_recipe "zabbix::web" end
Fix warning string literal in condition zabbix/recipes/server.rb:12: warning: string literal in condition zabbix/recipes/server.rb:16: warning: string literal in condition
diff --git a/streamio-ffmpeg.gemspec b/streamio-ffmpeg.gemspec index abc1234..def5678 100644 --- a/streamio-ffmpeg.gemspec +++ b/streamio-ffmpeg.gemspec @@ -13,7 +13,8 @@ s.summary = "Reads metadata and transcodes movies." s.description = "Simple yet powerful wrapper around ffmpeg to get metadata from movies and do transcoding." - s.add_development_dependency(%q<rspec>, ["~> 2.7"]) + s.add_development_dependency("rspec", "~> 2.7") + s.add_development_dependency("rake", "~> 0.9.2") s.files = Dir.glob("lib/**/*") + %w(README.md LICENSE CHANGELOG) end
Add rake to development dependencies so that we can bundle exec it.
diff --git a/lib/dizby/server/abstract.rb b/lib/dizby/server/abstract.rb index abc1234..def5678 100644 --- a/lib/dizby/server/abstract.rb +++ b/lib/dizby/server/abstract.rb @@ -21,7 +21,7 @@ @log = Dizby::Logger.new(config[:log] || {}, &log_transform) end - attr_reader :log + attr_reader :log, :config config_reader :load_limit def connect_to(client_args)
Allow all server configuration to be accessed besides config_reader
diff --git a/spec/classes/example_spec.rb b/spec/classes/example_spec.rb index abc1234..def5678 100644 --- a/spec/classes/example_spec.rb +++ b/spec/classes/example_spec.rb @@ -18,6 +18,9 @@ it { is_expected.to contain_service('uwsgi') } it { is_expected.to contain_package('uwsgi').with_ensure('present') } + + it { should contain_user('uwsgi') } + it { should contain_file('/etc/uwsgi.ini') } end end end
Test to add uwsgi user and contain ini file
diff --git a/spec/classes/makeall_spec.rb b/spec/classes/makeall_spec.rb index abc1234..def5678 100644 --- a/spec/classes/makeall_spec.rb +++ b/spec/classes/makeall_spec.rb @@ -4,16 +4,24 @@ it { should contain_class('sendmail::makeall') } - [ 'Debian', 'RedHat' ].each do |operatingsystem| - context "On #{operatingsystem}" do - let(:facts) do - { :operatingsystem => operatingsystem } + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) { facts } + + case facts[:osfamily] + when 'FreeBSD' + it { + should contain_exec('sendmail::makeall') \ + .with_command('make -C /etc/mail all install') \ + .that_requires('Class[sendmail::package]') + } + else + it { + should contain_exec('sendmail::makeall') \ + .with_command('make -C /etc/mail all') \ + .that_requires('Class[sendmail::package]') + } end - - it { - should contain_exec('sendmail::makeall') \ - .that_requires('Class[sendmail::package]') - } end end end
Use rspec-puppet-facts for makeall class
diff --git a/lib/gitlab/reply_by_email.rb b/lib/gitlab/reply_by_email.rb index abc1234..def5678 100644 --- a/lib/gitlab/reply_by_email.rb +++ b/lib/gitlab/reply_by_email.rb @@ -36,14 +36,12 @@ end def address_regex - @address_regex ||= begin - wildcard_address = config.address - return nil unless wildcard_address + wildcard_address = config.address + return nil unless wildcard_address - regex = Regexp.escape(wildcard_address) - regex = regex.gsub(Regexp.escape('%{reply_key}'), "(.+)") - Regexp.new(regex).freeze - end + regex = Regexp.escape(wildcard_address) + regex = regex.gsub(Regexp.escape('%{reply_key}'), "(.+)") + Regexp.new(regex).freeze end end end
Fix spec by removing global state.
diff --git a/lib/rack/handler/fishwife.rb b/lib/rack/handler/fishwife.rb index abc1234..def5678 100644 --- a/lib/rack/handler/fishwife.rb +++ b/lib/rack/handler/fishwife.rb @@ -15,8 +15,33 @@ #++ require 'fishwife' +require 'rack/server' +require 'rack/chunked' module Rack + + class Server + alias orig_middleware middleware + + # Override to remove Rack::Chunked middleware from defaults of any + # environment. Rack::Chunked doesn't play nice with Jetty which + # does its own chunking. Unfortunately rack doesn't have a better + # way to indicate this incompatibility. + def middleware + mw = Hash.new { |h,k| h[k] = [] } + orig_middleware.each do |env, wares| + mw[ env ] = cream( wares ) + end + mw + end + + def cream( wares ) + wares.reject do |w| + w == Rack::Chunked || ( w.is_a?( Array ) && w.first == Rack::Chunked ) + end + end + end + module Handler # Rack expects Rack::Handler::Fishwife via require 'rack/handler/fishwife' class Fishwife
Add Rack::Server.middleware override to drop default Rack::Chunked
diff --git a/lib/solidus_affirm/engine.rb b/lib/solidus_affirm/engine.rb index abc1234..def5678 100644 --- a/lib/solidus_affirm/engine.rb +++ b/lib/solidus_affirm/engine.rb @@ -8,8 +8,6 @@ config.generators do |g| g.test_framework :rspec end - - config.autoload_paths += %W(#{config.root}/lib) config.after_initialize do versions_without_api_custom_source_templates = Gem::Requirement.new('< 2.6')
Remove lib from the autoload_paths We already require what we need from lib manually. Furthermore, Zeitwerk complains about lib/factories* not defining the expected modules, so we need to stop autoloading it in order to support Rails 6.
diff --git a/lib/super_settings/config.rb b/lib/super_settings/config.rb index abc1234..def5678 100644 --- a/lib/super_settings/config.rb +++ b/lib/super_settings/config.rb @@ -7,7 +7,7 @@ # fetch! returns the value of they key if it exists. If it does not, # it then either yields to a block if given, or throws an exception. def fetch!(param, &_block) - return self[param] if method_exists param + return value(param) if method_exists param return yield if block_given? fail SuperSettings::Error, "#{param} does not exist" @@ -21,5 +21,10 @@ def method_exists(name) @table.keys.include? name.to_sym end + + # Ruby 1.9.3 does not support the [] call. + def value(param) + @table[param.to_sym] + end end end
Add openstruct [] support for ruby 1.9.3
diff --git a/lib/tracksperanto/tracker.rb b/lib/tracksperanto/tracker.rb index abc1234..def5678 100644 --- a/lib/tracksperanto/tracker.rb +++ b/lib/tracksperanto/tracker.rb @@ -1,6 +1,7 @@ # Internal representation of a tracker point with keyframes. A Tracker is an array of Keyframe objects and should act and work like one class Tracksperanto::Tracker < DelegateClass(Array) include Tracksperanto::Casts + include Tracksperanto::BlockInit include Comparable # Contains the name of the tracker @@ -10,17 +11,14 @@ def initialize(object_attribute_hash = {}) @name = "Tracker" __setobj__(Array.new) - object_attribute_hash.map { |(k, v)| send("#{k}=", v) } - yield(self) if block_given? + super end def keyframes=(new_kf_array) __setobj__(new_kf_array.dup) end - - def keyframes - __getobj__ - end + + alias_method :keyframes, :__getobj__ # Trackers sort by the position of the first keyframe def <=>(other_tracker)
Simplify the Tracker code some
diff --git a/lib/versions/configurable.rb b/lib/versions/configurable.rb index abc1234..def5678 100644 --- a/lib/versions/configurable.rb +++ b/lib/versions/configurable.rb @@ -3,12 +3,12 @@ # A simple configuration wrapper class Config - attr_accessor :base_dir, :filename_pattern, :class_prefix + attr_accessor :base_dir, :version_pattern, :class_prefix # The default base directory path BASE_DIR = File.join(Dir.pwd, 'lib') # The default filename pattern - FILENAME_PATTERN = /^v(?:ersion)?[-_]?(\d+(?:\.\d+)*)$/i + VERSION_PATTERN = /v(?:ersion)?[-_]?((\d+(?:\.\d+)*))/i # The default class prefix CLASS_PREFIX = 'V' @@ -17,7 +17,7 @@ # Returns a new instance def initialize self.base_dir = BASE_DIR - self.filename_pattern = FILENAME_PATTERN + self.version_pattern = VERSION_PATTERN self.class_prefix = CLASS_PREFIX end end @@ -26,7 +26,7 @@ # # Returns an instance of Config def config - @config ||= Config.new + @config ||= Config.new end end end
Update constant name to reflect use
diff --git a/app/controllers/vouchers_controller.rb b/app/controllers/vouchers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/vouchers_controller.rb +++ b/app/controllers/vouchers_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class VouchersController < ApplicationController + skip_before_action :redirect_if_country_banned + def new @voucher = Voucher.find_voucher(params[:code]) if params[:code] @voucher ||= Voucher.new
Allow players from banned countries to claim vouchers
diff --git a/mrblib/virtual.rb b/mrblib/virtual.rb index abc1234..def5678 100644 --- a/mrblib/virtual.rb +++ b/mrblib/virtual.rb @@ -27,7 +27,7 @@ path = config[:path] ? config[:path] : "jailing" bind_cmd = config[:bind].map {|dir| "--bind #{dir}" }.join(" ") if config[:bind] run_cmd = "#{path} --root=#{config[:root]} #{bind_cmd} -- #{config[:cmnd]}" - if system(run_cmd) + unless system(run_cmd) raise "setup chroot failed" end end
Fix bug; raise error if jailing was failed
diff --git a/lib/spotify/api/artist.rb b/lib/spotify/api/artist.rb index abc1234..def5678 100644 --- a/lib/spotify/api/artist.rb +++ b/lib/spotify/api/artist.rb @@ -1,9 +1,25 @@ module Spotify class API # @!group Artist + + # @see #artist_is_loaded + # @note the artist must be loaded, or this function always return an empty string. + # @param [Artist] artist + # @return [String] name of the artist attach_function :artist_name, [ Artist ], UTF8String + + # @param [Artist] artist + # @return [Boolean] true if the artist is populated with data attach_function :artist_is_loaded, [ Artist ], :bool + + # @see #image_create + # @see #artist_is_loaded + # @note the artist must be loaded, or this function always return nil. + # @param [Artist] artist + # @param [Symbol] image_size one of :normal, :small, :large + # @return [String, nil] image ID to pass to {#image_create}, or nil if the artist has no image attach_function :artist_portrait, [ Artist, :image_size ], ImageID + attach_function :artist_add_ref, [ Artist ], :error attach_function :artist_release, [ Artist ], :error end
Add documentation to Artist subsystem
diff --git a/lib/sycsvpro/allocator.rb b/lib/sycsvpro/allocator.rb index abc1234..def5678 100644 --- a/lib/sycsvpro/allocator.rb +++ b/lib/sycsvpro/allocator.rb @@ -29,8 +29,9 @@ allocation = {} File.open(infile).each_with_index do |line, index| row = row_filter.process(line, row: index) - next if row.nil? + next if row.nil? or row.empty? key = key_filter.process(row) + puts "#{row.inspect} - #{key.inspect}" allocation[key] = [] if allocation[key].nil? allocation[key] << col_filter.process(row).split(';') end
Fix Allocator when processing empty rows
diff --git a/opscommander.gemspec b/opscommander.gemspec index abc1234..def5678 100644 --- a/opscommander.gemspec +++ b/opscommander.gemspec @@ -13,7 +13,7 @@ s.description = %q{Scripting for AWS OpsWorks} s.add_runtime_dependency "commander", "~>4.2" - s.add_runtime_dependency "aws-sdk", "~>1.0" + s.add_runtime_dependency "aws-sdk", "~>1.59" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec}/*`.split("\n")
Update aws sdk version in gemspec too
diff --git a/config/puma.rb b/config/puma.rb index abc1234..def5678 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -11,4 +11,3 @@ stdout_redirect root + 'log/puma.log', root + 'log/puma.err.log', true threads 8, 32 workers 3 -prune_bundler
Remove prune bundler line (causes issues in Ruby 2.3)
diff --git a/config/initializers/task_scheduler.rb b/config/initializers/task_scheduler.rb index abc1234..def5678 100644 --- a/config/initializers/task_scheduler.rb +++ b/config/initializers/task_scheduler.rb @@ -5,4 +5,6 @@ scheduler.every "20m" do FeedFetcher.fetch_and_save_torrents_from_tpb Torrent.process_artists + Artist.fetch_similar_artists + SimilarArtist.link_with_known_artists end
Add similar artists processing to task scheduler.
diff --git a/app/controllers/bookings_controller.rb b/app/controllers/bookings_controller.rb index abc1234..def5678 100644 --- a/app/controllers/bookings_controller.rb +++ b/app/controllers/bookings_controller.rb @@ -1,4 +1,7 @@ class BookingsController < AuthorizedController + # Scopes + has_scope :by_value_period, :using => [:from, :to], :default => proc { |c| c.session[:has_scope] } + # Actions def new @booking = Booking.new(:value_date => Date.today) @@ -32,12 +35,6 @@ end end - def index - order_by = params[:order] || 'value_date' - @bookings = Booking.paginate :page => params[:page], :per_page => 100, :order => order_by - index! - end - def copy @booking = Booking.find(params[:id]) new_booking = @booking.clone
Drop special index handling for bookings, add by_value_period scoping.
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -48,6 +48,13 @@ redirect_to comments_path end + def downvote + @comment = Comment.find(params[:id]) + @comment.downvote_by current_user + redirect_to comments_path + end + + private def comment_params
Add downvote method on comments controller
diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -1,6 +1,5 @@ class ContactsController < ApplicationController before_filter :authenticate_user! - include SubjectsHelper, ActionView::Helpers::TextHelper def index @contacts = @@ -14,7 +13,7 @@ respond_to do |format| format.html { @contacts = Kaminari.paginate_array(@contacts).page(params[:page]).per(10) } format.js { @contacts = Kaminari.paginate_array(@contacts).page(params[:page]).per(10) } - format.json { render :text => @contacts.map{ |c| { 'key' => c.actor_id.to_s, 'value' => truncate_name(c.name) } }.to_json } + format.json { render :text => @contacts.map{ |c| { 'key' => c.actor_id.to_s, 'value' => self.class.helpers.truncate_name(c.name) } }.to_json } end end
Change helper including with helpers method
diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index abc1234..def5678 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -1,6 +1,14 @@ class ProductsController < ApplicationController def index - @products = Product.where("stock_code != ''").order("CAST(stock_code AS int)").all + #@products = Product.where("stock_code != ''").order("CAST(stock_code AS int)").all + @products = Product + .where("stock_code != ''") + .joins(line_items: :receipt) + .where(receipts: { account_id: current_user.account.id }) + .group('products.id') + .select('products.*, count(*) as count_all') + .order('count_all desc') + .all end def show
Order products by how often we buy them
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -5,6 +5,7 @@ end def create + reset_session # Counter session fixation if request.env['omniauth.auth'].present? omniauth_login elsif params[:session][:provider] == 'local'
Reset session on creation (counter session fixation) See issue #163 Signed-off-by: David A. Wheeler <9ae72d22d8b894b865a7a496af4fab6320e6abb2@dwheeler.com>
diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb index abc1234..def5678 100644 --- a/lib/alavetelitheme.rb +++ b/lib/alavetelitheme.rb @@ -22,8 +22,5 @@ # Plug theme-specific locale strings require 'gettext_setup.rb' -# Include classes handling connections to external platforms -require 'irekia_bridge.rb' - # Add theme routes $alaveteli_route_extensions << 'custom-routes.rb'
Remove reference to obsolete Irekia file
diff --git a/app/controllers/api/committees_controller.rb b/app/controllers/api/committees_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/committees_controller.rb +++ b/app/controllers/api/committees_controller.rb @@ -1,10 +1,10 @@ class Api::CommitteesController < ApiController def index - @committees = if @@query.empty? - Committee.all - else - Committee.where("lower(name) LIKE ?", @@query) - end + councillor_id = params[:councillor_id] + @committees = Committee.all + + @committees = @committees.where("lower(name) LIKE ?", @@query) unless @@query.empty? + @committees = @committees.joins(:committees_councillors).where("councillor_id = ?", councillor_id) if councillor_id.present? paginate json: @committees.order(change_query_order), per_page: change_per_page end
Change API Committees Query To Multiple Criteria
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -42,10 +42,16 @@ redirect_to root_path end + def upvote + @comment = Comment.find(params[:id]) + @comment.upvote_by current_user + redirect_to comments_path + end + private def comment_params params.require(:comment).permit(:content, :user_id) end -end+end
Add method upvote on comments controller
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,4 +1,5 @@ class SessionsController < ApplicationController + include SessionsHelper def new return redirect_to experiments_path if current_user end
Add SessionsHelper module to SessionsController
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -1,32 +1,32 @@-class MessagesController < ApplicationController - - def create - message = Message.new(message_params) - if current_guide - message.guide = current_guide - message.traveler = - elsif current_traveler - message.guide = - message.traveler = current_traveler - else - redirect_to conversations_path - alert("Your not signed in to chat with a traveler or guide.") - end - - if message.save - ActionCable.server.broadcast 'messages', - message: message.body, - guide: message.guide.first_name - traveler: message.traveler.first_name - head :ok - else - redirect_to conversations_path - end - end - - private - - def message_params - params.require(:message).permit(:content, :conversation_id) - end -end +# class MessagesController < ApplicationController +# +# def create +# message = Message.new(message_params) +# if current_guide +# message.guide = current_guide +# message.traveler = +# elsif current_traveler +# message.guide = +# message.traveler = current_traveler +# else +# redirect_to conversations_path +# alert("Your not signed in to chat with a traveler or guide.") +# end +# +# if message.save +# ActionCable.server.broadcast 'messages', +# message: message.body, +# guide: message.guide.first_name +# traveler: message.traveler.first_name +# head :ok +# else +# redirect_to conversations_path +# end +# end +# +# private +# +# def message_params +# params.require(:message).permit(:content, :conversation_id) +# end +# end
Comment out controller for message.
diff --git a/app/controllers/rubygems_controller.rb b/app/controllers/rubygems_controller.rb index abc1234..def5678 100644 --- a/app/controllers/rubygems_controller.rb +++ b/app/controllers/rubygems_controller.rb @@ -3,7 +3,7 @@ before_filter :unauthorize_if_ready, only: [:edit, :update] def index - paginate = Rubygem.page params[:page] + paginate = Rubygem.page(params[:page]).per 20 @gems = if params[:query].present? paginate.alphabetically.by_name params[:query]
Reduce number of gems displayed per page
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -18,7 +18,7 @@ def destroy user = User.find_by(id: session[:user_id]) session[:user_id] = nil - flash[:notice] = "Goodbye, #{user.name}!" + flash[:notice] = "Goodbye, #{user.name}!" if user redirect_to root_path end end
Add conditional to check if there is a user for signout flash message
diff --git a/db/migrate/20120510224704_add_timestamps_to_instance_accounts_and_memberships.rb b/db/migrate/20120510224704_add_timestamps_to_instance_accounts_and_memberships.rb index abc1234..def5678 100644 --- a/db/migrate/20120510224704_add_timestamps_to_instance_accounts_and_memberships.rb +++ b/db/migrate/20120510224704_add_timestamps_to_instance_accounts_and_memberships.rb @@ -0,0 +1,8 @@+class AddTimestampsToInstanceAccountsAndMemberships < ActiveRecord::Migration + def change + add_column(:instance_accounts, :created_at, :datetime) + add_column(:instance_accounts, :updated_at, :datetime) + add_column(:memberships, :created_at, :datetime) + add_column(:memberships, :updated_at, :datetime) + end +end
Add timestamps to membership and instance account tables
diff --git a/bosh-director/spec/unit/worker_spec.rb b/bosh-director/spec/unit/worker_spec.rb index abc1234..def5678 100644 --- a/bosh-director/spec/unit/worker_spec.rb +++ b/bosh-director/spec/unit/worker_spec.rb @@ -23,6 +23,7 @@ worker.prep expect(worker.queues).to eq(['normal']) Process.kill('USR1', Process.pid) + sleep 0.1 # Ruby 1.9 fails without the sleep due to a race condition between rspec assertion and actually killing the process expect(worker.queues).to eq(['non_existent_queue']) end end
Fix unit spec for ruby 1.9 Signed-off-by: Shatarupa Nandi <3efeaa499e3e1d586e0cf648346ba222fe46816b@pivotal.io>
diff --git a/bookingsync_application_engine.gemspec b/bookingsync_application_engine.gemspec index abc1234..def5678 100644 --- a/bookingsync_application_engine.gemspec +++ b/bookingsync_application_engine.gemspec @@ -7,11 +7,11 @@ Gem::Specification.new do |s| s.name = "bookingsync_application_engine" s.version = BookingsyncApplicationEngine::VERSION - s.authors = ["TODO: Your name"] - s.email = ["TODO: Your email"] - s.homepage = "TODO" - s.summary = "TODO: Summary of BookingsyncApplicationEngine." - s.description = "TODO: Description of BookingsyncApplicationEngine." + s.authors = ["Marcin Nowicki"] + s.email = ["dev@bookingsync.com"] + s.homepage = "https://github.com/BookingSync/bookingsync-application-engine" + s.summary = "A Rails engine to simplify building BookingSync Applications" + s.description = "A Rails engine to simplify building BookingSync Applications" s.license = "MIT" s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
Adjust gemspec to allow run `rake build`.
diff --git a/app/controllers/discounts_controller.rb b/app/controllers/discounts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/discounts_controller.rb +++ b/app/controllers/discounts_controller.rb @@ -1,5 +1,5 @@ class DiscountsController < ApplicationController - before_filter :admin_required + before_filter :admin_or_manager_required before_filter :find_discount, :only => [:edit, :update, :destroy] def index
Allow managers to manage discounts
diff --git a/app/controllers/team_name_controller.rb b/app/controllers/team_name_controller.rb index abc1234..def5678 100644 --- a/app/controllers/team_name_controller.rb +++ b/app/controllers/team_name_controller.rb @@ -1,5 +1,6 @@ class TeamNameController < ApplicationController skip_before_action :verify_authenticity_token, only: [:create] + after_action :allow_iframe, only: :sign def create @colour_palette = [ @@ -41,4 +42,10 @@ @team_name = params[:team_name].gsub('_', '.').gsub('__', '_') @page_title = "#{params[:team_name].gsub('_', '.').gsub('__', '_')} – " end + + private + + def allow_iframe + response.headers.except! 'X-Frame-Options' + end end
Allow the widget to be loaded in an iframe - This is so it can be embedded in a dashboard.
diff --git a/lib/instana/logger.rb b/lib/instana/logger.rb index abc1234..def5678 100644 --- a/lib/instana/logger.rb +++ b/lib/instana/logger.rb @@ -10,6 +10,8 @@ self.level = Logger::DEBUG elsif ENV.key?('INSTANA_GEM_DEV') self.level = Logger::DEBUG + elsif ENV.key?('INSTANA_QUIET') + self.level = Logger::FATAL else self.level = Logger::WARN end
Add support for an INSTANA_QUIET env var
diff --git a/app/services/asset_manager/attachment_updater/draft_status_updates.rb b/app/services/asset_manager/attachment_updater/draft_status_updates.rb index abc1234..def5678 100644 --- a/app/services/asset_manager/attachment_updater/draft_status_updates.rb +++ b/app/services/asset_manager/attachment_updater/draft_status_updates.rb @@ -1,6 +1,16 @@ class AssetManager::AttachmentUpdater::DraftStatusUpdates def self.call(attachment_data) - draft = (attachment_data.draft? && !attachment_data.unpublished? && !attachment_data.replaced?) || (attachment_data.unpublished? && !attachment_data.present_at_unpublish? && !attachment_data.replaced?) + draft = ( + ( + attachment_data.draft? && + !attachment_data.unpublished? && + !attachment_data.replaced? + ) || ( + attachment_data.unpublished? && + !attachment_data.present_at_unpublish? && + !attachment_data.replaced? + ) + ) Enumerator.new do |enum| enum.yield AssetManager::AttachmentUpdater::Update.new(
Format a line in DraftStatusUpdates so the logic can be seen Rather than having to read along the line, and try and work out the nesting.
diff --git a/dpl-puppet_forge.gemspec b/dpl-puppet_forge.gemspec index abc1234..def5678 100644 --- a/dpl-puppet_forge.gemspec +++ b/dpl-puppet_forge.gemspec @@ -1,3 +1,3 @@ require './gemspec_helper' -gemspec_for 'puppet_forge', [['puppet'], ['puppet-blacksmith']] +gemspec_for 'puppet_forge', [['puppet'], ['puppet-blacksmith'], ['json_pure']]
Add json_pure to puppet_forge runtime dependency
diff --git a/lib/quickstart/cli.rb b/lib/quickstart/cli.rb index abc1234..def5678 100644 --- a/lib/quickstart/cli.rb +++ b/lib/quickstart/cli.rb @@ -5,7 +5,8 @@ module QuickStart # CommandLine Interface for QuickStart class CLI < ::Escort::ActionCommand::Base - include Contracts + include ::Contracts::Core + include ::Contracts::Builtin Contract None => Any def execute
Update contracts syntax in QuickStart::CLI
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index abc1234..def5678 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -1,4 +1,9 @@ namespace :assets do + desc "Mark an asset as deleted" + task :delete, [:id] => :environment do |_t, args| + Asset.find(args.fetch(:id)).delete + end + desc "Mark an asset as deleted and remove from S3" task :delete_and_remove_from_s3, [:id] => :environment do |_t, args| asset = Asset.find(args.fetch(:id))
Add a Rake task to mark an asset as deleted This doesn't delete the file from S3.
diff --git a/app/controllers/parties_controller.rb b/app/controllers/parties_controller.rb index abc1234..def5678 100644 --- a/app/controllers/parties_controller.rb +++ b/app/controllers/parties_controller.rb @@ -1,6 +1,21 @@ class PartiesController < ApplicationController caches_page :index - # hmm, no caching of parties#show. need a sweeper? + + # caches_page :show + # + # FIXME: need to look into how to cache the parties page now + # that it also shows topics: + # + # * sweeper + # * ActiveRecord::Observer + # + # The party page must be expired on: + # + # * topic saved + # * topic's vote_connection updated + # * topic's vote_connection added + # * topic's vote_connection removed + # def index @parties = Party.order(:name).all @@ -13,12 +28,8 @@ end def show - @party = Party.includes(:representatives, :promises => :categories).find(params[:id]) - - # TODO: proper feature toggling - if Rails.application.config.topic_list_on_parties_show - @topics = Topic.vote_ordered.limit(10) - end + @party = Party.includes(:representatives, :promises => :categories).find(params[:id]) + @topics = Topic.vote_ordered.limit(10) respond_to do |format| format.html
Add comment about caching challenges.
diff --git a/app/controllers/sidebar_controller.rb b/app/controllers/sidebar_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sidebar_controller.rb +++ b/app/controllers/sidebar_controller.rb @@ -1,6 +1,4 @@ class SidebarController < ApplicationController - - def index if flash[:sidebars] @sidebars = flash[:sidebars].map {|sb_id| Sidebar.find(sb_id.to_i) }
Remove some whitespace that bugs me git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@1039 820eb932-12ee-0310-9ca8-eeb645f39767
diff --git a/app/graphql/types/team_member_type.rb b/app/graphql/types/team_member_type.rb index abc1234..def5678 100644 --- a/app/graphql/types/team_member_type.rb +++ b/app/graphql/types/team_member_type.rb @@ -3,7 +3,10 @@ authorize_record field :id, Int, null: false - field :display, Boolean, null: false, deprecation_reason: 'Use display_team_member instead' + field :display, Boolean, + null: false, + resolver_method: :display_team_member, + deprecation_reason: 'Use display_team_member instead' field :display_team_member, Boolean, null: false field :show_email, Boolean, null: false, camelize: false field :receive_con_email, Boolean, null: false, camelize: false @@ -16,10 +19,6 @@ def receive_signup_email object.receive_signup_email.upcase - end - - def display - display_team_member end def display_team_member
Fix deprecation warning from graphql-ruby
diff --git a/app/overrides/admin/products/_form.rb b/app/overrides/admin/products/_form.rb index abc1234..def5678 100644 --- a/app/overrides/admin/products/_form.rb +++ b/app/overrides/admin/products/_form.rb @@ -10,3 +10,14 @@ eos ) +Deface::Override.new(:virtual_path => "spree/admin/products/_form", + :name => "admin_products_form_add_short_description", + :insert_bottom => "[data-hook='admin_product_form_additional_fields']", + :text => <<eos + <%= f.field_container :short_description do %> + <%= f.label :short_description, 'Short description' %> + <%= f.text_area :short_description, {:rows => '13', :class => 'fullwidth'} %> + <%= f.error_message_on :short_description %> + <% end %> +eos +)
Add short description to product backend
diff --git a/app/serializers/service_serializer.rb b/app/serializers/service_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/service_serializer.rb +++ b/app/serializers/service_serializer.rb @@ -16,7 +16,7 @@ end def discontinued - service.discontinued_services.order(:discontinued_at).last + @last_discontinue ||= service.discontinued_services.order(:discontinued_at).last end def self.service_types_index
Make sure we don't query twice
diff --git a/test/decorators/optional_modules/newsletters/newsletter_setting_decorator_test.rb b/test/decorators/optional_modules/newsletters/newsletter_setting_decorator_test.rb index abc1234..def5678 100644 --- a/test/decorators/optional_modules/newsletters/newsletter_setting_decorator_test.rb +++ b/test/decorators/optional_modules/newsletters/newsletter_setting_decorator_test.rb @@ -20,7 +20,10 @@ end test 'should get list of newsletter user roles' do - assert_equal ['abonné', 'testeur'], @newsletter_setting_decorated.newsletter_user_roles_list + roles = @newsletter_setting_decorated.newsletter_user_roles_list + ['testeur', 'abonné'].each do |role| + assert roles.include?(role), "\"#{role}\" should be included in list" + end end #
Rewrite to test to make it pass with PostgreSQL
diff --git a/app/controllers/carto/builder/builder_users_module.rb b/app/controllers/carto/builder/builder_users_module.rb index abc1234..def5678 100644 --- a/app/controllers/carto/builder/builder_users_module.rb +++ b/app/controllers/carto/builder/builder_users_module.rb @@ -8,7 +8,12 @@ end def builder_user?(user) - user.has_feature_flag?('editor-3') + manager_user(user).has_feature_flag?('editor-3') + end + + def manager_user(user) + org = user.organization + org ? org.owner : user end end end
Check editor-3 feature flag in organization owner if applicable
diff --git a/app/controllers/concerns/users_controller_template.rb b/app/controllers/concerns/users_controller_template.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/users_controller_template.rb +++ b/app/controllers/concerns/users_controller_template.rb @@ -6,7 +6,7 @@ before_action :set_user!, only: [:show, :update] before_action :set_new_user!, only: :create before_action :protect_permissions_assignment!, only: [:create, :update] - after_action :verify_user_name!, only: [:create, :update] + after_action :verify_user_name!, only: :create end private
Verify names only on creation
diff --git a/files/default/tests/minitest/default_test.rb b/files/default/tests/minitest/default_test.rb index abc1234..def5678 100644 --- a/files/default/tests/minitest/default_test.rb +++ b/files/default/tests/minitest/default_test.rb @@ -1,9 +1,10 @@-require File.expand_path('../support/helpers.rb', __FILE__) - -describe "runit::default" do - include Helpers::Runit - +describe_recipe 'runit::default' do + include MiniTest::Chef::Assertions + include MiniTest::Chef::Context + include MiniTest::Chef::Resources + describe "packages" do it 'has been installed' do - assert_package_installed + package("runit").must_be_installed end + end end
Switch to use minitest-chef's package support
diff --git a/api/solidus_api.gemspec b/api/solidus_api.gemspec index abc1234..def5678 100644 --- a/api/solidus_api.gemspec +++ b/api/solidus_api.gemspec @@ -16,6 +16,6 @@ gem.version = version gem.add_dependency 'solidus_core', version - gem.add_dependency 'rabl', '~> 0.9.4.pre1' + gem.add_dependency 'rabl', ['>= 0.9.4.pre1', '< 0.12.0'] gem.add_dependency 'versioncake', '~> 2.3.1' end
Allow rabl versions up to 0.11
diff --git a/test/integration/examples_test.rb b/test/integration/examples_test.rb index abc1234..def5678 100644 --- a/test/integration/examples_test.rb +++ b/test/integration/examples_test.rb @@ -0,0 +1,17 @@+require 'test/unit' +require 'stamina' +require 'stamina/gui/examples' +module Stamina + class ExamplesTest < Test::Unit::TestCase + + def test_examples + pattern = File.join(Stamina::Gui::Examples::FOLDER, "**", "*.rb") + Dir[pattern].each do |file| + assert_nothing_raised do + Stamina::Engine.execute File.read(file) + end + end + end + + end +end
Add integration tests on examples
diff --git a/mongoid-arraylist.gemspec b/mongoid-arraylist.gemspec index abc1234..def5678 100644 --- a/mongoid-arraylist.gemspec +++ b/mongoid-arraylist.gemspec @@ -17,6 +17,6 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_dependency "mongoid", "~> 3.0" + gem.add_dependency "mongoid", "> 2.0" gem.add_development_dependency "rspec", "~> 2.12.0" end
Change gemspec to support mongoid2
diff --git a/lib/serverspec/matcher/be_installed.rb b/lib/serverspec/matcher/be_installed.rb index abc1234..def5678 100644 --- a/lib/serverspec/matcher/be_installed.rb +++ b/lib/serverspec/matcher/be_installed.rb @@ -1,9 +1,9 @@ RSpec::Matchers.define :be_installed do - match do |name| - if name.class.name == 'Serverspec::Type::SelinuxModule' - name.installed?(@version) + match do |subject| + if subject.class.name == 'Serverspec::Type::SelinuxModule' + subject.installed?(@version) else - name.installed?(@provider, @version) + subject.installed?(@provider, @version) end end
Rename parameter name -> subject As discussed in #598 we change the parameter name from match do |name| to match do |subject|
diff --git a/lib/wings/valkyrie/resource_factory.rb b/lib/wings/valkyrie/resource_factory.rb index abc1234..def5678 100644 --- a/lib/wings/valkyrie/resource_factory.rb +++ b/lib/wings/valkyrie/resource_factory.rb @@ -0,0 +1,64 @@+# frozen_string_literal: true + +module Wings + module Valkyrie + class ResourceFactory + attr_reader :adapter + delegate :id, to: :adapter, prefix: true + + # @param [MetadataAdapter] adapter + def initialize(adapter:) + @adapter = adapter + end + + # @param object [ActiveFedora::Base] AF + # record to be converted. + # @return [Valkyrie::Resource] Model representation of the AF record. + def to_resource(object:) + object.valkyrie_resource + end + + # @param resource [Valkyrie::Resource] Model to be converted to ActiveRecord. + # @return [ActiveFedora::Base] ActiveFedora + # resource for the Valkyrie resource. + def from_resource(resource:) + # af_object = resource.fedora_model.new(af_attributes(resource)) + + # hack + af_object = GenericWork.new(af_attributes(resource)) + # end of hack + + afid = af_id(resource) + af_object.id = afid unless afid.empty? + af_object + end + + private + + def af_attributes(resource) + hash = resource.to_h + hash.delete(:internal_resource) + hash.delete(:new_record) + hash.delete(:id) + hash.delete(:alternate_ids) + # Deal with these later + hash.delete(:created_at) + hash.delete(:updated_at) + hash.compact + end + + def af_id(resource) + resource.id.to_s + end + + def translate_resource(resource) + hash = resource.to_h + hash.delete(:internal_resource) + hash.delete(:new_record) + hash.delete(:id) + + resource.fedora_model.new(hash.compact) + end + end + end +end
Add an initial Valkyrie `ResourceFactory` to Wings Incorporates an initial `Valkyrie::RescourceFactory` to unblock further work on the Valkyrie adapter for `ActiveFedora` compatibility.
diff --git a/app/controllers/admin/impersonations_controller.rb b/app/controllers/admin/impersonations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/impersonations_controller.rb +++ b/app/controllers/admin/impersonations_controller.rb @@ -3,13 +3,13 @@ before_action :authenticate_impersonator! def destroy - redirect_path = admin_user_path(current_user) + original_user = current_user warden.set_user(impersonator, scope: :user) session[:impersonator_id] = nil - redirect_to redirect_path + redirect_to admin_user_path(original_user) end private
Store original user in variable
diff --git a/frontend/app/controllers/spree/store_controller.rb b/frontend/app/controllers/spree/store_controller.rb index abc1234..def5678 100644 --- a/frontend/app/controllers/spree/store_controller.rb +++ b/frontend/app/controllers/spree/store_controller.rb @@ -43,7 +43,7 @@ [ current_store, current_currency, - config_locale + I18n.locale ] end
Use currently used locale for Etag cache keys rather then static default value
diff --git a/test/hamlit/cli_test.rb b/test/hamlit/cli_test.rb index abc1234..def5678 100644 --- a/test/hamlit/cli_test.rb +++ b/test/hamlit/cli_test.rb @@ -0,0 +1,22 @@+require 'hamlit/cli' + +describe Hamlit::CLI do + describe '#temple' do + def redirect_output + out, $stdout = $stdout, StringIO.new + yield + ensure + $stdout = out + end + + it 'does not crash when compiling a tag' do + redirect_output do + Tempfile.create('hamlit') do |f| + f.write('%input{ hash }') + f.close + Hamlit::CLI.new.temple(f.path) + end + end + end + end +end
Add a test case for compiling a tag in CLI
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -0,0 +1,25 @@+class QuestionsController < ApplicationController + def index + end + + def new + @question = Question.new + end + + def create + @question = Question.new(params[:question].permit(:title, :content)) + if @question.save + redirect_to question_path(@question) + else + flash[:notice] = @question.errors.full_messages.join(", ") + render :new + end + end + + def show + @question = Question.find_by(id: params[:id]) + end + + + +end
Add controller methods for question creation
diff --git a/spec/datastax_rails/base_spec.rb b/spec/datastax_rails/base_spec.rb index abc1234..def5678 100644 --- a/spec/datastax_rails/base_spec.rb +++ b/spec/datastax_rails/base_spec.rb @@ -12,4 +12,10 @@ p.save! p.instance_variable_get(:@after_save_ran).should == "yup" end + + it "should raise RecordNotFound when finding a bogus ID" do + pending "Datastax Enterprise 2.2 should fix this" do + lambda { Person.find("xyzzy") }.should raise_exception(DatastaxRails::RecordNotFound) + end + end end
Add pending test to highlight once finding non-existant IDs is fixed.
diff --git a/spec/unit/softlayer_base_spec.rb b/spec/unit/softlayer_base_spec.rb index abc1234..def5678 100644 --- a/spec/unit/softlayer_base_spec.rb +++ b/spec/unit/softlayer_base_spec.rb @@ -0,0 +1,25 @@+# +# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>) +# © Copyright IBM Corporation 2014. +# +# LICENSE: Apache 2.0 (http://www.apache.org/licenses/) +# + +require File.expand_path('../../spec_helper', __FILE__) +require 'chef/knife/bootstrap' +require 'softlayer_api' + + +describe Chef::Knife::SoftlayerBase do + + describe "connection" do + it "should set the user agent string that the softlayer_api gem uses" do + Chef::Config[:knife][:softlayer_username] = 'username' + Chef::Config[:knife][:softlayer_api_key] = 'key' + sl = Chef::Knife::SoftlayerServerCreate.new + sl.connection.user_agent['User-Agent'].should match /Knife Softlayer Plugin/ + end + end + + +end
Add spec file for Chef::Knife::SoftlayerBase. Add user agent string test.
diff --git a/app/models/concerns/pg_search_common.rb b/app/models/concerns/pg_search_common.rb index abc1234..def5678 100644 --- a/app/models/concerns/pg_search_common.rb +++ b/app/models/concerns/pg_search_common.rb @@ -4,10 +4,10 @@ module ClassMethods def pg_search_common_scope(config = {}) - pg_search_scope :search, default_config.merge(config) + pg_search_scope :search, pg_search_common_config.merge(config) end - def default_config + def pg_search_common_config { using: { tsearch: {
Change pg_search config's name to sth less generic
diff --git a/spec/dummy/config/initializers/new_framework_defaults.rb b/spec/dummy/config/initializers/new_framework_defaults.rb index abc1234..def5678 100644 --- a/spec/dummy/config/initializers/new_framework_defaults.rb +++ b/spec/dummy/config/initializers/new_framework_defaults.rb @@ -22,3 +22,6 @@ # Configure SSL options to enable HSTS with subdomains. Previous versions had false. Rails.application.config.ssl_options = { hsts: { subdomains: true } } + +# The Event model of the dummy app has a time column. Time columns will become time zone aware in Rails 5.1 +ActiveRecord::Base.time_zone_aware_types = [:datetime, :time]
Add :time to timezone aware type for time columns The Event model of the dummy app has a time column. Time columns will become time zone aware in Rails 5.1 so we need to add :time to the time zone aware types.
diff --git a/frontend/app/controllers/spree/products_controller.rb b/frontend/app/controllers/spree/products_controller.rb index abc1234..def5678 100644 --- a/frontend/app/controllers/spree/products_controller.rb +++ b/frontend/app/controllers/spree/products_controller.rb @@ -31,6 +31,8 @@ end end end + + fresh_when @product end private
Add Cache-Control headers for product show action using fresh_when
diff --git a/test/unit/services/service_listeners/attachment_redirect_url_updater_test.rb b/test/unit/services/service_listeners/attachment_redirect_url_updater_test.rb index abc1234..def5678 100644 --- a/test/unit/services/service_listeners/attachment_redirect_url_updater_test.rb +++ b/test/unit/services/service_listeners/attachment_redirect_url_updater_test.rb @@ -12,6 +12,17 @@ AssetManagerAttachmentRedirectUrlUpdateWorker.stubs(:new).returns(worker) end + context 'when attachment has associated attachment data' do + let(:sample_rtf) { File.open(fixture_path.join('sample.rtf')) } + let(:attachment) { FactoryBot.create(:file_attachment, file: sample_rtf) } + + it 'updates the redirect URL of any assets' do + worker.expects(:perform).with(attachment_data.id) + + updater.update! + end + end + context 'when attachment has no associated attachment data' do let(:attachment) { FactoryBot.create(:html_attachment) }
Add test to ensure worker is called We were missing a test case to ensure that the worker is called with an attachment data instance is available.
diff --git a/config/initializers/search_callback.rb b/config/initializers/search_callback.rb index abc1234..def5678 100644 --- a/config/initializers/search_callback.rb +++ b/config/initializers/search_callback.rb @@ -1,6 +1,6 @@ # In development environments we don't want to depend on Rummager unless # explicitly told to do so -unless Rails.env.development? +unless Rails.env.development? || Rails.env.test? # update_search = true update_search = false else
Update search in test too
diff --git a/app/models/analytics.rb b/app/models/analytics.rb index abc1234..def5678 100644 --- a/app/models/analytics.rb +++ b/app/models/analytics.rb @@ -8,49 +8,24 @@ def track_user_creation identify - track( - { - user_id: user.id, - event: 'Create User' - } - ) + track(event: 'Create User') end def track_user_deletion - track( - { - user_id: user.id, - event: 'Delete User' - } - ) + track(event: 'Delete User') end def track_user_sign_in identify - track( - { - user_id: user.id, - event: 'Sign In User' - } - ) + track(event: 'Sign In User') end def track_user_sign_out - track( - { - user_id: user.id, - event: 'Sign Out User' - } - ) + track(event: 'Sign Out User') end def track_feedback_form_submission - track( - { - user_id: user.id, - event: 'Submit Feedback Form' - } - ) + track(event: 'Submit Feedback Form') end private @@ -79,6 +54,8 @@ end def track(options) - backend.track(options) + backend.track({ + user_id: user.id + }.merge(options)) end end
Refactor use of user id in Analytics model
diff --git a/transam_spatial.gemspec b/transam_spatial.gemspec index abc1234..def5678 100644 --- a/transam_spatial.gemspec +++ b/transam_spatial.gemspec @@ -18,7 +18,7 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] - s.add_dependency 'rails', '>=4.0.9' + s.add_dependency 'rails', '~> 4.1.9' s.add_dependency "geocoder" s.add_development_dependency "georuby", '~> 2.2.1'
Make the rails version in the gemspec more restrictive
diff --git a/config/initializers/events_observer.rb b/config/initializers/events_observer.rb index abc1234..def5678 100644 --- a/config/initializers/events_observer.rb +++ b/config/initializers/events_observer.rb @@ -0,0 +1,2 @@+events_observer_debit_canceled = Neighborly::Balanced::EventsObserver::DebitCanceled.new +Neighborly::Balanced::Event.add_observer(events_observer_debit_canceled, :perform)
Add initializer to add the observer to event
diff --git a/db/fixtures/development/13_comments.rb b/db/fixtures/development/13_comments.rb index abc1234..def5678 100644 --- a/db/fixtures/development/13_comments.rb +++ b/db/fixtures/development/13_comments.rb @@ -0,0 +1,13 @@+ActiveRecord::Base.observers.disable :all + +Issue.all.limit(10).each_with_index do |issue, i| + 5.times do + Note.seed(:id, [{ + project_id: issue.project.id, + author_id: issue.project.team.users.sample.id, + note: Faker::Lorem.sentence, + noteable_id: issue.id, + noteable_type: 'Issue' + }]) + end +end
Add comments fixtures for development Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
diff --git a/spec/support/setup_database.rb b/spec/support/setup_database.rb index abc1234..def5678 100644 --- a/spec/support/setup_database.rb +++ b/spec/support/setup_database.rb @@ -1,7 +1,6 @@-ActiveRecord::Base.configurations = {'test' => {adapter: 'sqlite3', database: ':memory:'}} -ActiveRecord::Base.establish_connection :test +ActiveRecord::Base.establish_connection(adapter: :sqlite3, database: ":memory:", pool: 5, timeout: 5000) -class CreateAllTables < ActiveRecord::Migration +class CreateAllTables < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration def self.up create_table(:users) do |t| t.string :name
Extend ActiveRecord::Migration[5.0] if ActiveRecord::VERSION::MAJOR >= 5
diff --git a/db/migrate/20200312161329_add_root_account_id_to_master_courses_migration_results.rb b/db/migrate/20200312161329_add_root_account_id_to_master_courses_migration_results.rb index abc1234..def5678 100644 --- a/db/migrate/20200312161329_add_root_account_id_to_master_courses_migration_results.rb +++ b/db/migrate/20200312161329_add_root_account_id_to_master_courses_migration_results.rb @@ -0,0 +1,32 @@+# +# Copyright (C) 2020 - present Instructure, Inc. +# +# This file is part of Canvas. +# +# Canvas is free software: you can redistribute it and/or modify +# the terms of the GNU Affero General Public License as publishe +# Software Foundation, version 3 of the License. +# +# Canvas is distributed in the hope that it will be useful, but +# WARRANTY; without even the implied warranty of MERCHANTABILITY +# A PARTICULAR PURPOSE. See the GNU Affero General Public Licens +# details. +# +# You should have received a copy of the GNU Affero General Publ +# with this program. If not, see <http://www.gnu.org/licenses/>. + +class AddRootAccountIdToMasterCoursesMigrationResults < ActiveRecord::Migration[5.2] + include MigrationHelpers::AddColumnAndFk + + tag :predeploy + disable_ddl_transaction! + + def up + add_column_and_fk :master_courses_migration_results, :root_account_id, :accounts + add_index :master_courses_migration_results, :root_account_id, algorithm: :concurrently + end + + def down + remove_column :master_courses_migration_results, :root_account_id + end +end
Add root account id to course migration results Closes PLAT-55573 Test Plan - Verify migrations run - Verify a root_account_id may bet set on a MasterCourses::MigrationResult - Verify MasterCourses::MigrationResult alwayslives on the same shard as its root account Change-Id: I0d73f4f8445773891b0acc00368aa6983a2f7cc7 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/229795 Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com> QA-Review: Weston Dransfield <e9203059795dc94e28a8831c65eb7869e818825e@instructure.com> Product-Review: Weston Dransfield <e9203059795dc94e28a8831c65eb7869e818825e@instructure.com> Reviewed-by: Clint Furse <b31c824c483447b2438702c2da6f729b3ebb9b50@instructure.com> Reviewed-by: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
diff --git a/lib/full_text_search/hooks/controller_search_index.rb b/lib/full_text_search/hooks/controller_search_index.rb index abc1234..def5678 100644 --- a/lib/full_text_search/hooks/controller_search_index.rb +++ b/lib/full_text_search/hooks/controller_search_index.rb @@ -0,0 +1,11 @@+module FullTextSearch + module Hooks + module ControllerSearchIndex + def index + @full_text_search_order_target = params[:order_target].presence || "score" + @full_text_search_order_type = params[:order_type].presence || "desc" + super + end + end + end +end
Set default values for sorting
diff --git a/cookbooks/wordpress/recipes/default.rb b/cookbooks/wordpress/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/wordpress/recipes/default.rb +++ b/cookbooks/wordpress/recipes/default.rb @@ -26,7 +26,7 @@ php-mysql ] -apache_module "php7.0" +apache_module "php7.2" apache_module "rewrite" fail2ban_filter "wordpress" do
Use PHP 7.2 for wordpress
diff --git a/cookbooks/wt_heatmap/recipes/import.rb b/cookbooks/wt_heatmap/recipes/import.rb index abc1234..def5678 100644 --- a/cookbooks/wt_heatmap/recipes/import.rb +++ b/cookbooks/wt_heatmap/recipes/import.rb @@ -3,7 +3,7 @@ directory "/home/hadoop/log-drop" do owner "hadoop" group "hadoop" - mode "0744" + mode "0755" end # script to import data into hive
Modify the permissions on the data-drop directory from 744 to 755 so Nagios can monitor this dir
diff --git a/spot_rate.gemspec b/spot_rate.gemspec index abc1234..def5678 100644 --- a/spot_rate.gemspec +++ b/spot_rate.gemspec @@ -6,7 +6,7 @@ gem.email = ["jeff.iacono@gmail.com"] gem.description = %q{get current currency spot rates with ruby} gem.summary = %q{current currency spot rates} - gem.homepage = "" + gem.homepage = "https://github.com/jeffreyiacono/spot-rate" gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add github as homepage to gemspec
diff --git a/lib/autodiscover_plus/pox_response.rb b/lib/autodiscover_plus/pox_response.rb index abc1234..def5678 100644 --- a/lib/autodiscover_plus/pox_response.rb +++ b/lib/autodiscover_plus/pox_response.rb @@ -20,6 +20,8 @@ } } + RESPONSE_SCHEMA = "http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a" + attr_reader :xml def initialize(response) @@ -27,8 +29,13 @@ end def exchange_version - hexver = xml.xpath("//s:ServerVersion", s: "http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a")[0].text + hexver = xml.xpath("//s:ServerVersion", s: RESPONSE_SCHEMA)[0].text ServerVersionParser.new(hexver).exchange_version + end + + def ews_url + v = xml.xpath("//s:EwsUrl[../s:Type='EXPR']", s: RESPONSE_SCHEMA).text + v.empty? ? nil : v end end
Add support for EWS Url
diff --git a/lib/elastictastic/patron_transport.rb b/lib/elastictastic/patron_transport.rb index abc1234..def5678 100644 --- a/lib/elastictastic/patron_transport.rb +++ b/lib/elastictastic/patron_transport.rb @@ -1,8 +1,8 @@ module Elastictastic class PatronTransport - def initialize(options = {}) + def initialize(config) @http = Patron::Session.new - @http.base_url = URI::HTTP.build(options.symbolize_keys.slice(:host, :port)).to_s + @http.base_url = URI::HTTP.build(:host => config.host, :port => config.port).to_s @http.timeout = 60 end
Make patron transport work with correct arguments
diff --git a/lib/vault/api/auth_token.rb b/lib/vault/api/auth_token.rb index abc1234..def5678 100644 --- a/lib/vault/api/auth_token.rb +++ b/lib/vault/api/auth_token.rb @@ -0,0 +1,88 @@+require "json" + +require_relative "secret" +require_relative "../client" +require_relative "../request" +require_relative "../response" + +module Vault + class Client + # A proxy to the {AuthToken} methods. + # @return [AuthToken] + def auth_token + @auth_token ||= AuthToken.new(self) + end + end + + class AuthToken < Request + # Create an authentication token. + # + # @example + # Vault.auth_token.create #=> #<Vault::Secret lease_id=""> + # + # @param [Hash] options + # + # @return [Secret] + def create(options = {}) + json = client.post("/v1/auth/token/create", JSON.fast_generate(options)) + return Secret.decode(json) + end + + # Renew the given authentication token. + # + # @example + # Vault.auth_token.renew("abcd-1234") #=> #<Vault::Secret lease_id=""> + # + # @param [String] id + # the auth id + # @param [Fixnum] increment + # + # @return [Secret] + def renew(id, increment = 0) + json = client.put("/v1/auth/token/renew/#{id}") + return Secret.decode(json) + end + + # Revoke exactly the orphans at the id. + # + # @example + # Vault.auth_token.revoke_orphan("abcd-1234") #=> true + # + # @param [String] id + # the auth id + # + # @return [true] + def revoke_orphan(id) + client.put("/v1/auth/token/revoke-orphan/#{id}") + return true + end + + # Revoke all auth at the given prefix. + # + # @example + # Vault.auth_token.revoke_prefix("abcd-1234") #=> true + # + # @param [String] id + # the auth id + # + # @return [true] + def revoke_prefix(prefix) + client.put("/v1/auth/token/revoke-prefix/#{prefix}") + return true + end + + # Revoke all auths in the tree. + # + # @example + # Vault.auth_token.revoke_tree("abcd-1234") #=> true + # + # @param [String] id + # the auth id + # + # @return [true] + def revoke_tree(id) + client.put("/v1/auth/token/revoke/#{id}") + return true + end + end +end
Add endpoint for auth tokens
diff --git a/lib/identificamex/mayusculas.rb b/lib/identificamex/mayusculas.rb index abc1234..def5678 100644 --- a/lib/identificamex/mayusculas.rb +++ b/lib/identificamex/mayusculas.rb @@ -7,6 +7,7 @@ .upcase .gsub(/ñ/, 'Ñ') .gsub(/,/, '') + .gsub(/\./, '') end def hash_vocales
Remove the dot (.) from string.
diff --git a/cookbooks/ms_dotnet4/recipes/default.rb b/cookbooks/ms_dotnet4/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/ms_dotnet4/recipes/default.rb +++ b/cookbooks/ms_dotnet4/recipes/default.rb @@ -9,7 +9,7 @@ # Code based off the PowerShell cookbook by Seth Chisamore if platform?("windows") - if (win_version.windows_server_2008? || win_version.windows_server_2008_r2? || win_version.windows_7?) + if (win_version.windows_server_2008? || win_version.windows_server_2008_r2? || win_version.windows_7? || win_version.windows_vista?) windows_package "Microsoft .NET Framework 4 Client Profile" do source node['ms_dotnet4']['http_url'] installer_type :custom @@ -17,8 +17,8 @@ action :install end elsif (win_version.windows_server_2003_r2? || win_version.windows_server_2003? || win_version.windows_xp?) - Chef::Log.warn('The .NET 4.0 Chef recipe currently only supports Windows 7, 2008, and 2008 R2.') + Chef::Log.warn('The .NET 4.0 Chef recipe currently only supports Windows Vista, 7, 2008, and 2008 R2.') end else - Chef::Log.warn('Microsoft .NET 4.0 can only be installed on the Windows platform.') + Chef::Log.warn('Microsoft .NET Framework 4.0 can only be installed on the Windows platform.') end
Add support for Windows Vista to the .NET 4.0 cookbook (best commit EVER)
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,8 +1,10 @@ # encoding: utf-8 +require 'simplecov' require 'codeclimate-test-reporter' -CodeClimate::TestReporter.start - -require 'simplecov' +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + CodeClimate::TestReporter::Formatter +] SimpleCov.start do add_filter '/features/' end
Use MultiFormatter for CodeClimate test reporter
diff --git a/frontend-helpers.gemspec b/frontend-helpers.gemspec index abc1234..def5678 100644 --- a/frontend-helpers.gemspec +++ b/frontend-helpers.gemspec @@ -17,7 +17,7 @@ spec.test_files = spec.files.grep(%r{^(spec)/}) spec.require_paths = ['lib'] - spec.add_development_dependency 'activemodel' + spec.add_development_dependency 'activemodel', '>= 3.2.1' spec.add_development_dependency 'bundler', '~> 1.6' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 2.0'
Add >= 3.2.1 version contraint on activemodel
diff --git a/domgen.gemspec b/domgen.gemspec index abc1234..def5678 100644 --- a/domgen.gemspec +++ b/domgen.gemspec @@ -25,7 +25,7 @@ s.has_rdoc = false s.rdoc_options = %w(--line-numbers --inline-source --title domgen) - s.add_dependency 'reality-core', '= 1.2.0' + s.add_dependency 'reality-core', '= 1.4.0' s.add_dependency 'reality-naming', '= 1.4.0' s.add_dependency 'reality-orderedhash', '= 1.0.0' end
Update to the latest reality-core