diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/scripts_controller.rb b/app/controllers/scripts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/scripts_controller.rb +++ b/app/controllers/scripts_controller.rb @@ -1,6 +1,5 @@ class ScriptsController < ApplicationController check_authorization - load_and_authorize_resource before_filter :authenticate_user! @@ -8,7 +7,8 @@ def user_stats @user = User.find_by_id(params[:user_id]) - if !@user || (@user.id == current_user.id && !@user.teachers.include?(current_user) && !current_user.admin?) + authorize! :read, @user + if !@user || !(@user.id == current_user.id || @user.teachers.include?(current_user) || current_user.admin?) flash[:alert] = "You don't have access to this person's stats" redirect_to root_path return
Allow users to view their own stats page
diff --git a/app/models/spree/product_decorator.rb b/app/models/spree/product_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/product_decorator.rb +++ b/app/models/spree/product_decorator.rb @@ -4,7 +4,7 @@ end def grouped_option_values - values = option_values.reject { |ov| ov.name.include?("—") } + values = option_values.includes(:option_type).reject { |ov| ov.name.include?("—") } @_grouped_option_values ||= values.group_by(&:option_type) @_grouped_option_values.sort_by { |option_type, option_values| option_type.position } end @@ -17,7 +17,7 @@ def variant_options_hash return @_variant_options_hash if @_variant_options_hash hash = {} - variants.includes(:option_values).each do |variant| + variants.includes({option_values: [:option_type]}, :prices).each do |variant| variant.option_values.each do |ov| otid = ov.option_type_id.to_s ovid = ov.id.to_s
Improve performance with eager loading
diff --git a/lib/grok.rb b/lib/grok.rb index abc1234..def5678 100644 --- a/lib/grok.rb +++ b/lib/grok.rb @@ -8,7 +8,11 @@ # [title] title of a Wikipedia page (including namespace, if applicable) # [date] a specific date # [language] the language version of Wikipedia - def self.get_views_since_date_for_article(title, date, language = Figaro.env.wiki_language) + def self.get_views_since_date_for_article(title, date, language = nil) + if language == nil + language = Figaro.env.wiki_language + end + iDate = date views = Hash.new while Date.today >= iDate do
Tweak handling of default language
diff --git a/enki_importer.gemspec b/enki_importer.gemspec index abc1234..def5678 100644 --- a/enki_importer.gemspec +++ b/enki_importer.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |gem| gem.authors = ["Bruno Arueira"] gem.email = ["contato@brunoarueira.com"] - gem.description = "Enki Importer Data from Wordpress" + gem.description = "Enki Importer, import data from Wordpress" gem.summary = "Import data from Wordpress xml to enki" gem.homepage = "https://github.com/brunoarueira/enki_importer"
Change the description at gemspec
diff --git a/lib/ddr/auth/legacy/legacy_authorization.rb b/lib/ddr/auth/legacy/legacy_authorization.rb index abc1234..def5678 100644 --- a/lib/ddr/auth/legacy/legacy_authorization.rb +++ b/lib/ddr/auth/legacy/legacy_authorization.rb @@ -17,7 +17,7 @@ def migrate migrated = inspect - roles.grant *to_roles + roles.replace *to_roles clear ["LEGACY AUTHORIZATION DATA", migrated, "ROLES", roles.serialize.inspect].join("\n\n") end
Use `replace` rather than `grant` in migration to clear any cruft.
diff --git a/lib/gettext_i18n_rails/action_controller.rb b/lib/gettext_i18n_rails/action_controller.rb index abc1234..def5678 100644 --- a/lib/gettext_i18n_rails/action_controller.rb +++ b/lib/gettext_i18n_rails/action_controller.rb @@ -1,6 +1,6 @@ class ActionController::Base def set_gettext_locale - requested_locale = params[:locale] || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] + requested_locale = params[:locale] || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || I18n.default_locale locale = FastGettext.set_locale(requested_locale) session[:locale] = locale I18n.locale = locale # some weird overwriting in action-controller makes this necessary ... see I18nProxy
Use I18n.default_locale if no other locale found
diff --git a/appium_tests/quit_game_spec.rb b/appium_tests/quit_game_spec.rb index abc1234..def5678 100644 --- a/appium_tests/quit_game_spec.rb +++ b/appium_tests/quit_game_spec.rb @@ -1,3 +1,4 @@+# coding: utf-8 require_relative 'spec_helper' require 'uri' @@ -24,12 +25,7 @@ end it '試合開始' do -=begin - start_cell = find_elements(:class_name, 'UIATableCell').find{|c| c.name == '試合開始'} - start_cell.click -=end click_element_of('UIATableCell', name: '試合開始') - # expect(find_element(:name, '序歌')).not_to be nil can_see('序歌') end
Remove unused code (already comment out)
diff --git a/demo-site/autoforme_demo.rb b/demo-site/autoforme_demo.rb index abc1234..def5678 100644 --- a/demo-site/autoforme_demo.rb +++ b/demo-site/autoforme_demo.rb @@ -16,7 +16,11 @@ get '/' do @page_title = 'AutoForme Demo Site' - "Default Page" + erb <<END +<p>This is the demo site for autoforme, an admin interface for ruby web applications which uses forme to create the related forms.</p> + +<p>This demo uses Sinatra as the web framework and Sequel as the database library.</p> +END end AutoForme.for(:sinatra, self) do
Add some language to root page on demo site
diff --git a/ruby/lib/bson/encodable.rb b/ruby/lib/bson/encodable.rb index abc1234..def5678 100644 --- a/ruby/lib/bson/encodable.rb +++ b/ruby/lib/bson/encodable.rb @@ -25,8 +25,7 @@ # @return [ String ] The encoded string. # # @since 2.0.0 - def encode_bson_with_placeholder - encoded = "".force_encoding(BINARY) + def encode_bson_with_placeholder(encoded = "".force_encoding(BINARY)) encoded << PLACEHOLDER yield(encoded) encoded << NULL_BYTE
Move encoded to default param
diff --git a/lib/tasks/confidentiality.rake b/lib/tasks/confidentiality.rake index abc1234..def5678 100644 --- a/lib/tasks/confidentiality.rake +++ b/lib/tasks/confidentiality.rake @@ -0,0 +1,36 @@+namespace :confidentiality do + desc 'Redact customer details from an appointment reference REFERENCE' + task redact: :environment do + appointment = Appointment.find(ENV.fetch('REFERENCE')) + + ActiveRecord::Base.transaction do + appointment.update( + first_name: 'redacted', + last_name: 'redacted', + email: 'redacted@example.com', + phone: '00000000000', + mobile: '00000000000', + date_of_birth: '1950-01-01', + memorable_word: 'redacted', + address_line_one: 'redacted', + address_line_two: 'redacted', + address_line_three: 'redacted', + town: 'redacted', + postcode: 'redacted', + notes: 'redacted' + ) + + appointment.audits.delete_all + appointment.activities.where( + type: %w( + AuditActivity + ReminderActivity + SmsReminderActivity + SmsCancellationActivity + DropActivity + DroppedSummaryDocumentActivity + ) + ).delete_all + end + end +end
Redact customer details on request Redacts a customer's personal details and removes any associated audits or activities which would also expose any personal information.
diff --git a/lib/vSphere/util/vm_helpers.rb b/lib/vSphere/util/vm_helpers.rb index abc1234..def5678 100644 --- a/lib/vSphere/util/vm_helpers.rb +++ b/lib/vSphere/util/vm_helpers.rb @@ -33,6 +33,42 @@ def suspended?(vm) get_vm_state(vm).eql?(VmState::SUSPENDED) end + + # Enumerate VM snapshot tree + # + # This method returns an enumerator that performs a depth-first walk + # of the VM snapshot grap and yields each VirtualMachineSnapshotTree + # node. + # + # @param vm [RbVmomi::VIM::VirtualMachine] + # + # @return [Enumerator<RbVmomi::VIM::VirtualMachineSnapshotTree>] + def enumerate_snapshots(vm) + snapshot_info = vm.snapshot + + if snapshot_info.nil? + snapshot_root = [] + else + snapshot_root = snapshot_info.rootSnapshotList + end + + recursor = lambda do |snapshot_list| + Enumerator.new do |yielder| + snapshot_list.each do |s| + # Yield the current VirtualMachineSnapshotTree object + yielder.yield s + + # Recurse into child VirtualMachineSnapshotTree objects + children = recursor.call(s.childSnapshotList) + loop do + yielder.yield children.next + end + end + end + end + + recursor.call(snapshot_root) + end end end end
Add VM helper for enumerating snapshots This patch adds an enumerate_snapshots method to the VmHelpers. This method creates an Enumerator which performs a depth-first traversal of nested VirtualMachineSnapshotTree objects. This functionality allows Ruby methods to easily search and consume VM snapshots.
diff --git a/dta_rapid.gemspec b/dta_rapid.gemspec index abc1234..def5678 100644 --- a/dta_rapid.gemspec +++ b/dta_rapid.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "dta_rapid" - spec.version = "1.4.9" + spec.version = "1.4.10" spec.authors = ["Gareth Rogers", "Andrew Carr", "Matt Chamberlain"] spec.email = ["grogers@thoughtworks.com", "andrew@2metres.com", "mchamber@thoughtworks.com"]
Update gem version to 1.4.10
diff --git a/log.gemspec b/log.gemspec index abc1234..def5678 100644 --- a/log.gemspec +++ b/log.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'log' - s.version = '0.4.1.0' + s.version = '0.4.2.0' s.summary = 'Logging to STD IO with levels, tagging, and coloring' s.description = ' '
Package version is increased from 0.4.1.0 to 0.4.2.0
diff --git a/mc_query.gemspec b/mc_query.gemspec index abc1234..def5678 100644 --- a/mc_query.gemspec +++ b/mc_query.gemspec @@ -8,7 +8,7 @@ spec.version = MCQuery::VERSION spec.authors = ["Taylor Blau"] spec.email = ["me@ttaylorr.com"] - spec.summary = %q{TODO: Ruby bindings to query Minecraft servers based on the RCON protocol.} + spec.summary = %q{Ruby bindings to query Minecraft servers based on the RCON protocol.} spec.homepage = "http://mc.ttaylorr.com" spec.license = "MIT"
Fix TODO comment in Gemspec
diff --git a/lib/kale.rb b/lib/kale.rb index abc1234..def5678 100644 --- a/lib/kale.rb +++ b/lib/kale.rb @@ -27,8 +27,13 @@ (JSON.parse response.body).flatten end - def get_messages - response = self.class.get('https://www.bloc.io/api/v1/message_threads', headers: { 'authorization' => @auth_token }) + def get_messages(page_id = nil) + if page_id + response = self.class.get('https://www.bloc.io/api/v1/message_threads', query: { page: page_id }, headers: { 'authorization' => @auth_token }) + else + response = self.class.get('https://www.bloc.io/api/v1/message_threads', headers: { 'authorization' => @auth_token }) + end + JSON.parse response.body end end
Enhance the get_messages to pass a reference to the page_id when provided as a parameter.
diff --git a/commitate.gemspec b/commitate.gemspec index abc1234..def5678 100644 --- a/commitate.gemspec +++ b/commitate.gemspec @@ -4,20 +4,20 @@ require 'commitate/version' Gem::Specification.new do |spec| - spec.name = "commitate" + spec.name = 'commitate' spec.version = Commitate::VERSION - spec.authors = ["TJ Stankus"] - spec.email = ["tjstankus@gmail.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = "" - spec.license = "MIT" + spec.authors = ['TJ Stankus'] + spec.email = ['tjstankus@gmail.com'] + spec.summary = %q{Insert code from a git commit into your Markdown.} + spec.description = %q{Markdown preprocessor for inserting code snippets from a git repository.} + spec.homepage = 'https://github.com/tjstankus/commitate' + spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] + spec.require_paths = ['lib'] - spec.add_development_dependency "bundler", "~> 1.6" - spec.add_development_dependency "rake" + spec.add_development_dependency 'bundler', '~> 1.6' + spec.add_development_dependency 'rake', '~> 10.0' end
Complete gemspec to suppress warnings
diff --git a/lib/neat.rb b/lib/neat.rb index abc1234..def5678 100644 --- a/lib/neat.rb +++ b/lib/neat.rb @@ -14,5 +14,7 @@ end end end + else + Sass.load_paths << File.expand_path("../../app/assets/stylesheets", __FILE__) end end
Add stylesheets path to Sass.load_paths
diff --git a/spec/tok/configuration_spec.rb b/spec/tok/configuration_spec.rb index abc1234..def5678 100644 --- a/spec/tok/configuration_spec.rb +++ b/spec/tok/configuration_spec.rb @@ -19,4 +19,39 @@ it { expect(Tok.configuration.resource).to eq Account } end + + describe "#bcrypt_cost" do + subject { Tok::Configuration.new.bcrypt_cost } + + context "while in test environment" do + before do + Tok.configure {} + end + + it { expect(subject).to eq BCrypt::Engine::MIN_COST } + end + + context "while in other environments" do + before do + # Stub Rails.env + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development')) + + Tok.configure {} + end + + it { expect(subject).to eq BCrypt::Engine::DEFAULT_COST } + end + end + + describe "#bcrypt_cost=" do + before do + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development')) + + Tok.configure do |config| + config.bcrypt_cost = 20 + end + end + + it { expect(Tok.configuration.bcrypt_cost).to eq 20 } + end end
Write some specs for .bcrypt_cost configuration
diff --git a/qa/qa/page/component/note.rb b/qa/qa/page/component/note.rb index abc1234..def5678 100644 --- a/qa/qa/page/component/note.rb +++ b/qa/qa/page/component/note.rb @@ -8,6 +8,10 @@ base.view 'app/assets/javascripts/notes/components/comment_form.vue' do element :note_dropdown element :discussion_option + end + + base.view 'app/assets/javascripts/notes/components/note_actions.vue' do + element :note_edit_button end base.view 'app/assets/javascripts/notes/components/note_form.vue' do @@ -49,6 +53,12 @@ def expand_replies click_element :expand_replies end + + def edit_comment(text) + click_element :note_edit_button + fill_element :reply_input, text + click_element :reply_comment_button + end end end end
Update page object with new element and method
diff --git a/racktables-vlanparse.gemspec b/racktables-vlanparse.gemspec index abc1234..def5678 100644 --- a/racktables-vlanparse.gemspec +++ b/racktables-vlanparse.gemspec @@ -17,7 +17,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.6" + spec.add_development_dependency "bundler", "~> 2.0" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" end
Update bundler requirement from ~> 1.6 to ~> 2.0 Updates the requirements on [bundler](https://github.com/bundler/bundler) to permit the latest version. - [Release notes](https://github.com/bundler/bundler/releases) - [Changelog](https://github.com/bundler/bundler/blob/v2.0.1/CHANGELOG.md) - [Commits](https://github.com/bundler/bundler/commits/v2.0.1) Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/lib/psgc.rb b/lib/psgc.rb index abc1234..def5678 100644 --- a/lib/psgc.rb +++ b/lib/psgc.rb @@ -1,5 +1,5 @@-require 'psgc/import' -require 'psgc/region' - module PSGC + autoload :Region, 'psgc/region' + + autoload :Import, 'psgc/import' end
Use autoload rather than require
diff --git a/proxy/recipes/configure.rb b/proxy/recipes/configure.rb index abc1234..def5678 100644 --- a/proxy/recipes/configure.rb +++ b/proxy/recipes/configure.rb @@ -3,10 +3,13 @@ owner "root" group "root" mode 0644 + not_if do + ::File.exists?("#{node[:nginx][:dir]}/conf.d/proxy.conf") + end end include_recipe "nginx::service" service "nginx" do - action [ :enable, :start ] + action [ :reload ] end
Add Proxy Configuration to Nginx
diff --git a/lib/tidy.rb b/lib/tidy.rb index abc1234..def5678 100644 --- a/lib/tidy.rb +++ b/lib/tidy.rb @@ -1,8 +1,11 @@ module Tidy class << self - PATH = Rails.root.join('node_modules','htmltidy2','bin','darwin','tidy') - CONFIG = {quiet: true, + PATH = Rails.root.join('node_modules','htmltidy2','bin',Gem::Platform.local.os,'tidy') + CONFIG = {force_output: true, + quiet: true, + show_errors: 0, show_warnings: false, + show_info: false, enclose_text: true, drop_empty_elements: true, hide_comments: true, @@ -19,7 +22,9 @@ private def flags - CONFIG.map { |k, v| "--#{k.to_s.gsub('_', '-')} #{v ? 'yes' : 'no'}"}.join(' ') + CONFIG.map { |k, v| + "--#{k.to_s.gsub('_', '-')} #{v === true ? 'yes' : v === false ? 'no' : v}" + }.join(' ') end end end
Fix Tidy platform path and add force-output
diff --git a/lib/generators/caffeine/templates/page_migration.rb b/lib/generators/caffeine/templates/page_migration.rb index abc1234..def5678 100644 --- a/lib/generators/caffeine/templates/page_migration.rb +++ b/lib/generators/caffeine/templates/page_migration.rb @@ -5,7 +5,6 @@ t.text 'content' t.text 'summary' t.string 'slug' - t.boolean 'fix_slug', default: false t.integer 'status', default: 0 t.integer 'parent_id' t.integer 'position'
Remove useless `fix_clug` column from pages table
diff --git a/app/controllers/gobierto_visualizations/visualizations_controller.rb b/app/controllers/gobierto_visualizations/visualizations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/gobierto_visualizations/visualizations_controller.rb +++ b/app/controllers/gobierto_visualizations/visualizations_controller.rb @@ -11,7 +11,7 @@ private def visualization_enabled! - render_404 unless visualizations_config.fetch('enabled', false) + render_404 unless visualizations_config&.fetch("enabled", false) end def visualizations_config
Fix exceptions if visualization path is not configured in module settings
diff --git a/p4-chips.gemspec b/p4-chips.gemspec index abc1234..def5678 100644 --- a/p4-chips.gemspec +++ b/p4-chips.gemspec @@ -18,6 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_dependency "standalone_migrations" spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rspec", "~> 3.1.0"
Add standalone_mogrations gem as dependency
diff --git a/log.gemspec b/log.gemspec index abc1234..def5678 100644 --- a/log.gemspec +++ b/log.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'log' - s.version = '0.3.0.1' + s.version = '0.4.0.0' s.summary = 'Logging to STD IO with levels, tagging, and coloring' s.description = ' '
Package level is increased from 0.3.0.1 to 0.4.0.0
diff --git a/lib/aoede.rb b/lib/aoede.rb index abc1234..def5678 100644 --- a/lib/aoede.rb +++ b/lib/aoede.rb @@ -4,4 +4,9 @@ require 'aoede/track' module Aoede + + # @param filename [String] + def track(filename) + Track.new(filename) + end end
Add a convenience method to initialize a Track
diff --git a/lib/basil.rb b/lib/basil.rb index abc1234..def5678 100644 --- a/lib/basil.rb +++ b/lib/basil.rb @@ -31,8 +31,13 @@ include Logging def run!(args) - unless args.first == '--debug' - Logger.level = ::Logger::INFO + while arg = args.shift + case arg + when '--debug' + Logger.level = ::Logger::DEBUG + when '--cli' + Config.server = Cli.new + end end Plugin.load!
Add --cli and modify arg handling overall We're getting close to optparse time, but not quite yet...
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,9 +1,9 @@-name "dotnetframework" -maintainer "Daptiv Solutions, LLC" -maintainer_email "sneal@daptiv.com" -license "All rights reserved" -description "Installs/Configures .NET Framework" +name 'dotnetframework' +maintainer 'Daptiv Solutions, LLC' +maintainer_email 'sneal@daptiv.com' +license 'All rights reserved' +description 'Installs/Configures .NET Framework' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.1.0" -supports "windows" -depends "windows", ">= 1.2.6" +version '0.1.0' +supports 'windows' +depends 'windows', '>= 1.2.6'
Use single-quoted strings per extended foodcritic rules.
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -10,7 +10,7 @@ depends 'git' depends 'mariadb', '~> 5.2.1' -depends 'mysql', '~> 8.5.1' +depends 'mysql', '~> 11.0.0' depends 'osl-firewall' depends 'osl-nrpe' depends 'osl-postfix'
Update mysql to Chef 17-compliant version Signed-off-by: Robert Detjens <80088559520001a14c62b25ed86ca3d2c36785e9@osuosl.org>
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -19,6 +19,6 @@ supports 'windows' depends 'macosx_autologin', '>= 4.0' -depends 'nssm', '>= ' +depends 'nssm', '>= 3.0' depends 'windows' depends 'windows_autologin', '>= 3.0'
Rename display attribute to xdisplay to be Chef 13 compatible
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -12,7 +12,7 @@ depends 'firewall' depends 'git' # TODO: Remove after chef15 upgrade -depends 'mariadb', '~> 3.2.0' +depends 'mariadb', '< 4.0.0' depends 'mysql', '~> 8.5.1' depends 'mysql2_chef_gem' depends 'osl-nrpe'
Fix depend lock for mariadb
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,7 +1,7 @@ name 'git' maintainer 'Chef Software, Inc.' maintainer_email 'cookbooks@chef.io' -license 'Apache 2.0' +license 'Apache-2.0' description 'Installs git and/or sets up a Git server daemon' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '6.0.0'
Use a SPDX standard license string Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/ci_environment/apt/recipes/default.rb b/ci_environment/apt/recipes/default.rb index abc1234..def5678 100644 --- a/ci_environment/apt/recipes/default.rb +++ b/ci_environment/apt/recipes/default.rb @@ -20,10 +20,16 @@ execute "apt-get update" do action :run end +execute "apt-get -y autoclean autoremove" do + action :nothing +end template "/etc/apt/sources.list" do source "sources.list.erb" notifies :run, resources(:execute => "apt-get update"), :immediately + + # cleans up at the end of Chef run + notifies :run, resources(:execute => "apt-get -y autoclean autoremove") end %w{/var/cache/local /var/cache/local/preseeding}.each do |dirname|
Clean up apt packages at the end of Chef run
diff --git a/rl10/design/resources/tss.rb b/rl10/design/resources/tss.rb index abc1234..def5678 100644 --- a/rl10/design/resources/tss.rb +++ b/rl10/design/resources/tss.rb @@ -0,0 +1,27 @@+module Resources + class TSS + include Praxis::ResourceDefinition + + description 'Manipulate the TSS proxy' + media_type 'text/plain' + + routing do + prefix '/rll/tss' + end + + action :get_hostname do + description 'Set the TSS hostname to proxy' + routing { get '/hostname' } + response :ok + end + + action :put_hostname do + description 'Set the TSS hostname to proxy' + routing { put '/hostname' } + params do + attribute :hostname, String, required: true + end + response :ok + end + end +end
Add RightLink 10 TSS actions.
diff --git a/db/migrate/20190221200002_change_reply_user_id_to_bigint.rb b/db/migrate/20190221200002_change_reply_user_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20190221200002_change_reply_user_id_to_bigint.rb +++ b/db/migrate/20190221200002_change_reply_user_id_to_bigint.rb @@ -0,0 +1,9 @@+class ChangeReplyUserIdToBigint < ActiveRecord::Migration[6.0] + def up + change_column :reply_users, :id, :bigint + end + + def down + change_column :reply_users, :id, :integer + end +end
Update reply_user_id primary and foreign keys to bigint
diff --git a/core/spec/mailers/user_mailer_spec.rb b/core/spec/mailers/user_mailer_spec.rb index abc1234..def5678 100644 --- a/core/spec/mailers/user_mailer_spec.rb +++ b/core/spec/mailers/user_mailer_spec.rb @@ -3,7 +3,7 @@ describe UserMailer do describe 'welcome_instructions' do let(:user) { FactoryGirl.create :user, reset_password_token: 'r3S3tT0k3n' } - let(:mail) { UserMailer.welcome_instructions(user) } + let(:mail) { UserMailer.welcome_instructions(user.id) } it 'renders the subject' do mail.subject.should == 'Start using Factlink' @@ -22,4 +22,4 @@ end end -end+end
Test with user id for mailing Signed-off-by: tomdev <96835dd8bfa718bd6447ccc87af89ae1675daeca@codigy.nl>
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -22,13 +22,7 @@ private def authenticate_with_auth_token auth_token - unless auth_token.include?(':') - authentication_error - return - end - - user_id = auth_token.split(':').first - user = User.where(id: user_id).first + user = User.find_by(access_token: auth_token) if user && Devise.secure_compare(user.access_token, auth_token) sign_in user, store: false
Fix access_token authentication now we're using secure random
diff --git a/gir_ffi-pango.gemspec b/gir_ffi-pango.gemspec index abc1234..def5678 100644 --- a/gir_ffi-pango.gemspec +++ b/gir_ffi-pango.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = "gir_ffi-pango" - s.version = "0.0.1" + s.version = "0.0.2" s.summary = "GirFFI-based bindings for Pango" s.description = "Bindings for Pango generated by GirFFI, with an eclectic set of overrides." @@ -11,10 +11,10 @@ s.email = ["matijs@matijs.net"] s.homepage = "http://www.github.com/mvz/gir_ffi-pango" - s.files = Dir['{lib,test}/**/*.rb', "README.md", "Rakefile"] + s.files = Dir['{lib,test}/**/*.rb', "README.md", "Rakefile", "COPYING.LIB"] s.test_files = Dir['test/**/*.rb'] - s.add_runtime_dependency(%q<gir_ffi>, ["~> 0.3.0"]) + s.add_runtime_dependency(%q<gir_ffi>, ["~> 0.4.0"]) s.add_development_dependency('minitest', ["~> 2.11"]) s.add_development_dependency('rake', ["~> 0.9.2"])
Update dependency on GirFFI and bump version
diff --git a/nexmo.gemspec b/nexmo.gemspec index abc1234..def5678 100644 --- a/nexmo.gemspec +++ b/nexmo.gemspec @@ -13,7 +13,7 @@ s.files = Dir.glob('{lib,spec}/**/*') + %w(LICENSE.txt README.md nexmo.gemspec) s.required_ruby_version = '>= 1.9.3' s.add_dependency('jwt') - s.add_development_dependency('rake', '~> 11.0') + s.add_development_dependency('rake') s.add_development_dependency('minitest', '~> 5.0') if RUBY_VERSION == '1.9.3'
Remove version specifier for rake development dependency
diff --git a/app/views/api/v1/trucking/driver_commissions_history/index.json.jbuilder b/app/views/api/v1/trucking/driver_commissions_history/index.json.jbuilder index abc1234..def5678 100644 --- a/app/views/api/v1/trucking/driver_commissions_history/index.json.jbuilder +++ b/app/views/api/v1/trucking/driver_commissions_history/index.json.jbuilder @@ -1,7 +1,7 @@ json.array! commissions do |commission| json.back_hauls commission.Backhauls if commission.customer - json.customer_id commission.CustomerId + json.customer_id commission.customer.CustomerId json.customer_name commission.customer.Name.strip else json.customer_id nil
Fix driver commission CustomerId bug Closes #63
diff --git a/window_rails.gemspec b/window_rails.gemspec index abc1234..def5678 100644 --- a/window_rails.gemspec +++ b/window_rails.gemspec @@ -12,5 +12,5 @@ s.has_rdoc = true s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG.rdoc'] s.add_dependency 'rails', '>= 2.3' - s.files = %w(LICENSE README.rdoc CHANGELOG.rdoc init.rb install.rb uninstall.rb) + Dir.glob("{app,files,lib}/**/*") + s.files = %w(LICENSE README.rdoc CHANGELOG.rdoc init.rb install.rb uninstall.rb) + Dir.glob("{app,files,lib,rails}/**/*") end
Include rails init within gem package
diff --git a/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb b/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb index abc1234..def5678 100644 --- a/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb +++ b/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb @@ -0,0 +1,45 @@+module Fog + module Compute + class AWS + class Real + + require 'fog/aws/parsers/compute/assign_private_ip_addresses' + + # Assigns one or more secondary private IP addresses to the specified network interface. + # + # ==== Parameters + # * network_interface_id<~String> - The ID of the network interface + # * private_ip_address<~String> - One or more IP addresses to be assigned as a secondary private IP address (conditional) + # * secondary_private_ip_address_count<~String> - The number of secondary IP addresses to assign (conditional) + # * allow_reassignment<~Boolean> - Whether to reassign an IP address + # ==== Returns + # * response<~Excon::Response>: + # * body<~Hash>: + # * 'requestId'<~String> - The ID of the request. + # * 'return'<~Boolean> - success? + # + # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-AssignPrivateIpAddresses.html] + def assign_private_ip_addresses(network_interface_id, private_ip_address=nil, secondary_private_ip_address_count=nil, allow_reassignment=false) + domain = domain == 'vpc' ? 'vpc' : 'standard' + request( + 'Action' => 'AssignPrivateIpAddresses', + 'NetworkInterfaceId' => network_interface_id, + 'PrivateIpAddress.n' => private_ip_address, + 'SecondaryPrivateIpAddressCount' => secondary_private_ip_address_count, + 'AllowReassignment' => allow_reassignment, + :parser => Fog::Parsers::Compute::AWS::AssignPrivateIpAddresses.new + ) + end + + end + + class Mock + + def assign_private_ip_addresses(network_interface_id, private_ip_address=nil, secondary_private_ip_address_count=nil, allow_reassignment=false) + + end + + end + end + end +end
Create parser for AWS assign private ip addresses
diff --git a/examples/select_disabled.rb b/examples/select_disabled.rb index abc1234..def5678 100644 --- a/examples/select_disabled.rb +++ b/examples/select_disabled.rb @@ -0,0 +1,18 @@+# encoding: utf-8 + +require_relative "../lib/tty-prompt" + +prompt = TTY::Prompt.new + +warriors = [ + 'Scorpion', + 'Kano', + { name: 'Goro', disabled: '(injury)' }, + 'Jax', + 'Kitana', + 'Raiden' +] + +answer = prompt.select('Choose your destiny?', warriors, enum: ')') + +puts answer.inspect
Add select prompt example with disabled choice
diff --git a/lib/groupify.rb b/lib/groupify.rb index abc1234..def5678 100644 --- a/lib/groupify.rb +++ b/lib/groupify.rb @@ -3,11 +3,13 @@ module Groupify mattr_accessor :group_membership_class_name, :group_class_name, - :ignore_base_class_inference_errors + :ignore_base_class_inference_errors, + :ignore_association_class_inference_errors self.group_class_name = 'Group' self.group_membership_class_name = 'GroupMembership' self.ignore_base_class_inference_errors = true + self.ignore_association_class_inference_errors = true def self.configure yield self @@ -20,12 +22,16 @@ def self.infer_class_and_association_name(association_name) begin klass = association_name.to_s.classify.constantize - rescue StandardError => ex + rescue NameError => ex puts "Error: #{ex.inspect}" #puts ex.backtrace + + if Groupify.ignore_association_class_inference_errors + klass = association_name.to_s.classify + end end - if !association_name.is_a?(Symbol) && klass + if !association_name.is_a?(Symbol) && klass.is_a?(Class) association_name = klass.model_name.plural end
Add option to return a string version of inferred class name rather than trying to constantize
diff --git a/db/migrate/201512251310_rm_deprecated_solution_fields_from_submission.rb b/db/migrate/201512251310_rm_deprecated_solution_fields_from_submission.rb index abc1234..def5678 100644 --- a/db/migrate/201512251310_rm_deprecated_solution_fields_from_submission.rb +++ b/db/migrate/201512251310_rm_deprecated_solution_fields_from_submission.rb @@ -0,0 +1,11 @@+class RmDeprecatedSolutionFieldsFromSubmission < ActiveRecord::Migration + def up + remove_column :submissions, :code + remove_column :submissions, :filename + end + + def down + add_column :submissions, :code, :text + add_column :submissions, :filename, :string + end +end
Delete deprecated fields from submission
diff --git a/dynamodb_logger.gemspec b/dynamodb_logger.gemspec index abc1234..def5678 100644 --- a/dynamodb_logger.gemspec +++ b/dynamodb_logger.gemspec @@ -4,8 +4,8 @@ Gem::Specification.new do |gem| gem.authors = ["Mike Challis"] gem.email = ["mike.challis@matchbin.com"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} + gem.description = %q{Uses a standard ruby Logger object to log to Amazon's DynamoDB} + gem.summary = %q{Use a standard ruby Logger to log to Amazon's DynamoDB} gem.homepage = "" gem.files = `git ls-files`.split($\)
Add a summary and description to the gemspec
diff --git a/spec/controllers/staffs/reschedulings_controller_spec.rb b/spec/controllers/staffs/reschedulings_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/staffs/reschedulings_controller_spec.rb +++ b/spec/controllers/staffs/reschedulings_controller_spec.rb @@ -17,6 +17,7 @@ let(:before_date) { Date.new(2015, 1, 19) } let(:after_date) { Date.new(2015, 1, 22) } before { Timecop.freeze(Time.local(2015, 1, 19, 12, 0, 0)) } + after { Timecop.return } let(:params) do { category: 'change', lecture_id: lecture.id,
Add after clause to spec of Staffs::ReschedulingsController
diff --git a/app/finders/environments_finder.rb b/app/finders/environments_finder.rb index abc1234..def5678 100644 --- a/app/finders/environments_finder.rb +++ b/app/finders/environments_finder.rb @@ -24,6 +24,10 @@ environments = project.environments.available .where(id: environment_ids).order_by_last_deployed_at.to_a + environments.select! do |environment| + Ability.allowed?(current_user, :read_environment, environment) + end + if ref && commit environments.select! do |environment| environment.includes_commit?(commit) @@ -36,9 +40,7 @@ end end - environments.select do |environment| - Ability.allowed?(current_user, :read_environment, environment) - end + environments end private
Move permission check before more expensive checks
diff --git a/core/lib/spree/testing_support/preferences.rb b/core/lib/spree/testing_support/preferences.rb index abc1234..def5678 100644 --- a/core/lib/spree/testing_support/preferences.rb +++ b/core/lib/spree/testing_support/preferences.rb @@ -11,7 +11,10 @@ def reset_spree_preferences(&config_block) Spree::Config.instance_variables.each { |iv| Spree::Config.remove_instance_variable(iv) } Spree::Config.preference_store = Spree::Config.default_preferences - Rails.application.config.spree = Spree::Config.environment + + if defined?(Railties) + Rails.application.config.spree = Spree::Config.environment + end configure_spree_preferences(&config_block) if block_given? end
Allow spec_helper to work in isolation Previously, the spec_helper couldn't run unless rails_helper was also loaded due to testing_support/preferences using Rails.application.config
diff --git a/app/models/metrics/link_checker.rb b/app/models/metrics/link_checker.rb index abc1234..def5678 100644 --- a/app/models/metrics/link_checker.rb +++ b/app/models/metrics/link_checker.rb @@ -7,8 +7,11 @@ def initialize(metadata, worker=nil) @worker = worker + @processed = 0 + @requests = 0 @total = metadata.length - @resource_availability = Hash.new + + @resource_availability = Hash.new { |h, k| h[k] = Hash.new } metadata.each_with_index do |dataset, i| dataset[:resources].each do |resource| @resources += 1 @@ -19,6 +22,26 @@ end end + def enqueue_request(id, url) + + config = {:method => :head, + :timeout => 20, + :connecttimeout => 10, + :nosignal => true} + + @resource_availability[id][url] = false + request = Typhoeus::Request.new(url, config) + request.on_complete do |response| + if response.success? + @resource_availability[id] = true + end + @worker.at(@processed + 1, @requests) + @processed += 1 + end + @dispatcher.queue(request) + @requests += 1 + end + end end
Add Typhoeus request code for the Link Checker Just added the code to determine whether an URL is working or not. This can be done by relying on the response.success? method, as in every other case either another response code has been delivered or the request timed out. Signed-off-by: Konrad Reiche <4ff0213f56e2082fcd8c882d04c546881c579ce4@gmail.com>
diff --git a/spec/helpers/acceptance/tests/usergroup_shared_examples.rb b/spec/helpers/acceptance/tests/usergroup_shared_examples.rb index abc1234..def5678 100644 --- a/spec/helpers/acceptance/tests/usergroup_shared_examples.rb +++ b/spec/helpers/acceptance/tests/usergroup_shared_examples.rb @@ -39,7 +39,6 @@ /etc/elasticsearch/es-01/elasticsearch.yml /usr/share/elasticsearch /var/log/elasticsearch - /etc/elasticsearch ].each do |path| describe file(path) do it { should be_owned_by 'esuser' }
Update acceptance tests to reflect config directory permissions
diff --git a/lib/devise_deactivatable/model.rb b/lib/devise_deactivatable/model.rb index abc1234..def5678 100644 --- a/lib/devise_deactivatable/model.rb +++ b/lib/devise_deactivatable/model.rb @@ -4,7 +4,7 @@ extend ActiveSupport::Concern included do - scope :deactivated, -> { where("'deactivated_at' is not NULL") } + scope :deactivated, -> { where.not(deactivated: nil) } end def self.required_fields(klass) @@ -55,4 +55,4 @@ end end end -end+end
Use AREL 'not' method to construct proper query This change fixes the constructed query to include the model's table name which is required for PostgreSQL queries to return expected results. current behavior: ```ruby User.where("'deactivated_at' is not NULL").count #=> SELECT COUNT(*) FROM "users" WHERE ('deactivated_at' is not NULL) #=> 64 ``` versus the expected behavior: ```ruby User.where.not(deactivated_at: nil).count #=> SELECT COUNT(*) FROM "users" WHERE ("users"."deactivated_at" IS NOT NULL) #=> 0 ```
diff --git a/lib/discordrb/webhooks/builder.rb b/lib/discordrb/webhooks/builder.rb index abc1234..def5678 100644 --- a/lib/discordrb/webhooks/builder.rb +++ b/lib/discordrb/webhooks/builder.rb @@ -23,5 +23,9 @@ # settings will be used instead. # @return [String] the avatar URL. attr_accessor :avatar_url + + # Whether this message should use TTS or not. By default, it doesn't. + # @return [true, false] the TTS status. + attr_accessor :tts end end
:anchor: Add an accessor for TTS
diff --git a/lib/gitlab/kubernetes/helm/api.rb b/lib/gitlab/kubernetes/helm/api.rb index abc1234..def5678 100644 --- a/lib/gitlab/kubernetes/helm/api.rb +++ b/lib/gitlab/kubernetes/helm/api.rb @@ -34,7 +34,7 @@ private def pod_resource(command) - Pod.new(command, @namespace.name, @kubeclient).generate + Gitlab::Kubernetes::Helm::Pod.new(command, @namespace.name, @kubeclient).generate end end end
Fix namespace ambiguity with Kubernetes Pod definitions This was causing a spec failure between Gitlab::Kubernetes::Helm::Pod and Gitlab::Kubernetes::Helm::Api::Pod if one spec loaded the former definition first. Closes #41458
diff --git a/lib/poms/api/pagination_client.rb b/lib/poms/api/pagination_client.rb index abc1234..def5678 100644 --- a/lib/poms/api/pagination_client.rb +++ b/lib/poms/api/pagination_client.rb @@ -32,7 +32,6 @@ def initialize(uri, offset = 0) uri.query_values = { offset: offset } @uri = uri - @offset = offset end def next_page @@ -53,7 +52,7 @@ private - attr_reader :response, :offset, :uri + attr_reader :response, :uri def next_index response['offset'] + response['max']
Remove offset since it is no longer used in this place
diff --git a/WolframAlpha.podspec b/WolframAlpha.podspec index abc1234..def5678 100644 --- a/WolframAlpha.podspec +++ b/WolframAlpha.podspec @@ -6,7 +6,7 @@ s.homepage = 'https://github.com/romanroibu/WolframAlpha' s.authors = { 'Roman Roibu' => 'roman.roibu@gmail.com' } s.social_media_url = 'http://twitter.com/romanroibu' - s.source = { :git => 'https://github.com/SnapKit/SnapKit.git', :tag => '0.1.1' } + s.source = { :git => 'https://github.com/romanroibu/WolframAlpha.git', :tag => 'v0.1.1' } s.ios.deployment_target = '8.0'
Fix pod spec repository and tag
diff --git a/config/initializers/rails_admin.rb b/config/initializers/rails_admin.rb index abc1234..def5678 100644 --- a/config/initializers/rails_admin.rb +++ b/config/initializers/rails_admin.rb @@ -6,6 +6,10 @@ warden.authenticate! scope: :user end config.current_user_method(&:current_user) + + config.navigation_static_links = { + 'Control Panel' => 'control_panel' + } # Authorization with pundit policies config.authorize_with :pundit
Add Control Panel link to rails admin.
diff --git a/config/initializers/subscribers.rb b/config/initializers/subscribers.rb index abc1234..def5678 100644 --- a/config/initializers/subscribers.rb +++ b/config/initializers/subscribers.rb @@ -1,10 +1,10 @@ # Common subscribers (`Subscribers::Base` pattern) -Subscribers::SiteActivity.attach_to('activities/sites') -Subscribers::AdminActivity.attach_to('activities/admins') -Subscribers::CensusActivity.attach_to('activities/census') -Subscribers::UserActivity.attach_to('activities/users') -Subscribers::GobiertoPeopleActivity.attach_to('trackable') -Subscribers::GobiertoCmsPageActivity.attach_to('activities/gobierto_cms_pages') +::Subscribers::SiteActivity.attach_to('activities/sites') +::Subscribers::AdminActivity.attach_to('activities/admins') +::Subscribers::CensusActivity.attach_to('activities/census') +::Subscribers::UserActivity.attach_to('activities/users') +::Subscribers::GobiertoPeopleActivity.attach_to('trackable') +::Subscribers::GobiertoCmsPageActivity.attach_to('activities/gobierto_cms_pages') # Custom subscribers ActiveSupport::Notifications.subscribe(/trackable/) do |*args|
Fix const reloading in development
diff --git a/db/migrate/20101208082840_create_inquiries.rb b/db/migrate/20101208082840_create_inquiries.rb index abc1234..def5678 100644 --- a/db/migrate/20101208082840_create_inquiries.rb +++ b/db/migrate/20101208082840_create_inquiries.rb @@ -2,15 +2,14 @@ def up unless ::Refinery::Inquiry.table_exists? create_table ::Refinery::Inquiry.table_name, :force => true do |t| - t.string "name" - t.string "email" - t.string "phone" - t.text "message" - t.integer "position" - t.boolean "open", :default => true - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "spam", :default => false + t.string :name + t.string :email + t.string :phone + t.text :message + t.integer :position + t.boolean :spam, :default => false + t.boolean :open, :default => true + t.timestamps end add_index ::Refinery::Inquiry.table_name, :id
Use symbols instead of strings for column names and use timestamps method instead of creating created_at and updated_at columns ourselves.
diff --git a/config/initializers/performance_logging.rb b/config/initializers/performance_logging.rb index abc1234..def5678 100644 --- a/config/initializers/performance_logging.rb +++ b/config/initializers/performance_logging.rb @@ -1,8 +1,7 @@ # Subscribes to performance instruments throughout the app & logs their results [ - "SolrRequest.get_data_for_articles", "SolrRequest.get_data_for_viz", - "SolrRequest.validate_dois" + "SolrRequest.get_data_for_articles", "SolrRequest.validate_dois" ].each do |name| ActiveSupport::Notifications.subscribe(name) do |*args| event = ActiveSupport::Notifications::Event.new(*args)
Remove subscription to SolrRequest.get_data_for_viz, as it doesn't exist anymore
diff --git a/spec/multi_server/post_spec.rb b/spec/multi_server/post_spec.rb index abc1234..def5678 100644 --- a/spec/multi_server/post_spec.rb +++ b/spec/multi_server/post_spec.rb @@ -0,0 +1,65 @@+require 'spec_helper' + +unless Server.all.empty? + describe "commenting" do + before(:all) do + WebMock::Config.instance.allow_localhost = true + enable_typhoeus + #Server.all.each{|s| s.kill if s.running?} + #Server.all.each{|s| s.run} + end + + after(:all) do + disable_typhoeus + #Server.all.each{|s| s.kill if s.running?} + #sleep(1) + #Server.all.each{|s| puts "Server at port #{s.port} still running." if s.running?} + WebMock::Config.instance.allow_localhost = false + end + before do + Server.all.each{|s| s.truncate_database; } + @post = nil + Server[0].in_scope do + Factory.create(:user_with_aspect, :username => "poster") + end + + Server[1].in_scope do + recipient = Factory.create(:user_with_aspect, :username => "recipient") + person = Webfinger.new("poster@localhost:#{Server[0].port}").fetch + person.save! + recipient.share_with(person, recipient.aspects.first) + end + end + + it 'sends public posts to remote followers' do + Server[0].in_scope do + @post = User.find_by_username("poster"). + post(:status_message, + :public => true, + :text => "Awesome Sauce!", + :to => 'all') + end + + Server[1].in_scope do + Post.exists?(:guid => @post.guid).should be_true + end + end + + it 'sends public posts to remote friends' do + Server[0].in_scope do + poster = User.find_by_username("poster") + person = Person.find_by_diaspora_handle("recipient@localhost:#{Server[1].port}") + poster.share_with(person, poster.aspects.first) + @post = poster. + post(:status_message, + :public => true, + :text => "Awesome Sauce!", + :to => 'all') + end + + Server[1].in_scope do + Post.exists?(:guid => @post.guid).should be_true + end + end + end +end
Add a couple tests for post federation, because Max is suspicious
diff --git a/spec/stacks/nat_server_spec.rb b/spec/stacks/nat_server_spec.rb index abc1234..def5678 100644 --- a/spec/stacks/nat_server_spec.rb +++ b/spec/stacks/nat_server_spec.rb @@ -2,21 +2,17 @@ describe Stacks::NatServer do - subject do - + it 'has access to the front, prod and mgmt networks' do class Group attr_accessor :name - def initialize(name) @name = name end end - - Stacks::NatServer.new(Group.new("my-nat-server"), "001") - end - - it 'has access to the front, prod and mgmt networks' do - - subject.to_specs[0][:networks].should eql [:mgmt,:prod,:front] + machinedef = Stacks::NatServer.new(Group.new("my-nat-server"), "001") + #machinedef = Stacks::MachineDef.new("test") + env = Stacks::Environment.new("noenv", {:primary_site=>"local"}, {}) + machinedef.bind_to(env) + machinedef.to_spec[:networks].should eql [:mgmt,:prod,:front] end end
rpearce: Fix nat server spec, must be bound to env
diff --git a/test/unit/plugins/provisioners/chef/config/chef_zero_test.rb b/test/unit/plugins/provisioners/chef/config/chef_zero_test.rb index abc1234..def5678 100644 --- a/test/unit/plugins/provisioners/chef/config/chef_zero_test.rb +++ b/test/unit/plugins/provisioners/chef/config/chef_zero_test.rb @@ -0,0 +1,19 @@+require_relative "../../../../base" + +require Vagrant.source_root.join("plugins/provisioners/chef/config/chef_zero") + +describe VagrantPlugins::Chef::Config::ChefZero do + include_context "unit" + + subject { described_class.new } + + let(:machine) { double("machine") } + + describe "#nodes_path" do + it "defaults to an array" do + subject.finalize! + expect(subject.nodes_path).to be_a(Array) + expect(subject.nodes_path).to be_empty + end + end +end
Add tests for Chef Zero config
diff --git a/app/serializers/plan_serializer.rb b/app/serializers/plan_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/plan_serializer.rb +++ b/app/serializers/plan_serializer.rb @@ -1,4 +1,5 @@ class PlanSerializer < ActiveModel::Serializer attributes :id, :date, :income has_many :purchases + has_many :users end
Add has_many relationship to plan serializer
diff --git a/app/controllers/api/api_controller.rb b/app/controllers/api/api_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/api_controller.rb +++ b/app/controllers/api/api_controller.rb @@ -1,4 +1,5 @@ class Api::ApiController < ActionController::Base + include Rails::Pagination include Authentication protect_from_forgery with: :exception
Fix pagination in API controllers
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1,7 +1,7 @@ class CoursesController < ApplicationController before_filter :authenticate_user! before_filter :get_club, :only => [ :show_all ] - before_filter :get_course, :only => [ :edit, :update, :change_logo ] + before_filter :get_course, :only => [ :edit, :update, :change_logo, :upload_logo ] def create @club = Club.find params[:club_id] @@ -33,6 +33,16 @@ authorize! :update, @course end + def upload_logo + authorize! :update, @course + + if @course.update_attributes params[:course] + redirect_to edit_course_path(@course) + else + render :change_logo, :formats => [ :js ] + end + end + def show_all @courses = @club.courses end
Add upload_logo Action to Courses Controller Update the Courses controller to include the upload_logo action.
diff --git a/app/models/spree/ability_decorator.rb b/app/models/spree/ability_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/ability_decorator.rb +++ b/app/models/spree/ability_decorator.rb @@ -3,7 +3,7 @@ include CanCan::Ability def initialize(user) if user.enterprises.count > 0 - can [:admin, :read, :update, :bulk_edit], Spree::Product do |product| + can [:admin, :read, :update, :bulk_edit, :clone, :destroy], Spree::Product do |product| user.enterprises.include? product.supplier end
Add clone and destroy product access for enterprise users
diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/variant_decorator.rb +++ b/app/models/spree/variant_decorator.rb @@ -5,12 +5,11 @@ attr_accessible :option_values def to_hash - actual_price = self.price #actual_price += Calculator::Vat.calculate_tax_on(self) if Spree::Config[:show_price_inc_vat] { :id => self.id, :count => self.count_on_hand, - :price => actual_price.display_price.to_html + :price => display_price.to_html({html: true}.merge({no_cents: true})) } end
Use display price in variant hash
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,6 +16,7 @@ # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false + config.action_mailer.delivery_method = :test # Print deprecation notices to the Rails logger config.active_support.deprecation = :log
Configure dev servers not to send email.
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index abc1234..def5678 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -7,6 +7,7 @@ :region => ENV['AWS_S3_REGION'] } if ENV['AWS_S3_KEY'] + config.asset_host = ENV['AWS_S3_HOST'] if ENV['AWS_S3_HOST'] config.fog_directory = ENV['AWS_S3_BUCKET'] config.fog_public = true
Make fog asset host configurable
diff --git a/app/serializers/project_serializer.rb b/app/serializers/project_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/project_serializer.rb +++ b/app/serializers/project_serializer.rb @@ -12,6 +12,7 @@ mkdir -p config echo '#{database_yml}' > config/database.yml + RAILS_ENV=test rake db:create RAILS_ENV=test rake db:reset TEXT end @@ -22,8 +23,8 @@ "test: \n"\ " adapter: postgresql\n"\ " database: testributor_test\n"\ - " username: testributor\n"\ - " password: testributor_password\n"\ - " host: localhost" + " username: postgres\n"\ + " password: \n"\ + " host: db" end end
Update database.yml and build commands the postgresql credentials should much the defaults used here: https://hub.docker.com/_/postgres/
diff --git a/skeptick.gemspec b/skeptick.gemspec index abc1234..def5678 100644 --- a/skeptick.gemspec +++ b/skeptick.gemspec @@ -18,4 +18,5 @@ gem.require_paths = ["lib"] gem.add_dependency 'posix-spawn', '~> 0.3.6' + gem.add_development_dependency 'rake', '>= 0.9.2' end
Add rake as development dependency
diff --git a/app/jobs/update_sequence_ontology.rb b/app/jobs/update_sequence_ontology.rb index abc1234..def5678 100644 --- a/app/jobs/update_sequence_ontology.rb +++ b/app/jobs/update_sequence_ontology.rb @@ -34,6 +34,6 @@ end def latest_soid_path - "https://raw.githubusercontent.com/The-Sequence-Ontology/SO-Ontologies/master/releases/so-xp.owl/so.obo" + "https://raw.githubusercontent.com/The-Sequence-Ontology/SO-Ontologies/master/Ontology_Files/so.obo" end -end+end
Update Sequence Ontology obo file location
diff --git a/core/lib/spree/core/testing_support/factories/payment_factory.rb b/core/lib/spree/core/testing_support/factories/payment_factory.rb index abc1234..def5678 100644 --- a/core/lib/spree/core/testing_support/factories/payment_factory.rb +++ b/core/lib/spree/core/testing_support/factories/payment_factory.rb @@ -7,10 +7,6 @@ state 'pending' response_code '12345' - # limit the payment amount to order's remaining balance, to avoid over-pay exceptions - after_create do |pmt| - #pmt.update_attribute(:amount, [pmt.amount, pmt.order.outstanding_balance].min) - end end factory :check_payment, :class => Spree::Payment do
Remove commented out lines from payment factory
diff --git a/googlemaps-services.gemspec b/googlemaps-services.gemspec index abc1234..def5678 100644 --- a/googlemaps-services.gemspec +++ b/googlemaps-services.gemspec @@ -17,7 +17,8 @@ spec.files = Dir['lib/**/*.rb'] spec.require_paths = ['lib'] - spec.add_runtime_dependency 'nokogiri', '~> 1.6', '>= 1.6.8' + spec.add_runtime_dependency 'nokogiri', '~> 1.7', '>= 1.7.0.1' + spec.add_runtime_dependency 'http', '~> 2.1', '>= 2.1.0' spec.add_development_dependency 'bundler', '~> 1.12' spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec', '~> 3.0'
Use httprb/http as the underlaying client + Use latest nokogiri
diff --git a/MTStatusBarOverlay.podspec b/MTStatusBarOverlay.podspec index abc1234..def5678 100644 --- a/MTStatusBarOverlay.podspec +++ b/MTStatusBarOverlay.podspec @@ -0,0 +1,16 @@+Pod::Spec.new do |s| + s.name = 'MTStatusBarOverlay' + s.version = '0.9.1' + s.platform = :ios + s.summary = 'A custom iOS status bar overlay seen in Apps like Reeder, Evernote and Google Mobile App.' + s.homepage = 'https://github.com/myell0w/MTStatusBarOverlay' + s.author = { 'Matthias Tretter' => 'myell0w@me.com' } + s.source = { :git => 'https://github.com/myell0w/MTStatusBarOverlay.git', :tag => '0.9' } + + s.description = 'This class provides a custom iOS (iPhone + iPad) status bar overlay window known from ' \ + 'Apps like Reeder, Google Mobile App or Evernote. It currently supports touch-handling, ' \ + 'queuing of messages, delegation as well as three different animation modes.' + + s.requires_arc = true + s.source_files = '*.{h,m}' +end
Add CocoaPods podspec for a future version. The next version does not neccsarilly have to be 0.9.1, but its the smallest increment, so it will always be a sane version number.
diff --git a/opal/browser/dom/element/input.rb b/opal/browser/dom/element/input.rb index abc1234..def5678 100644 --- a/opal/browser/dom/element/input.rb +++ b/opal/browser/dom/element/input.rb @@ -20,6 +20,14 @@ `#@native.checked` end + def check! + `#@native.checked = 'checked';` + end + + def uncheck! + `#@native.checked = '';` + end + def clear `#@native.value = ''` end
Add methods to handle checkboxes
diff --git a/spec/mailers/spree/marketing/mailchimp_error_notifier_spec.rb b/spec/mailers/spree/marketing/mailchimp_error_notifier_spec.rb index abc1234..def5678 100644 --- a/spec/mailers/spree/marketing/mailchimp_error_notifier_spec.rb +++ b/spec/mailers/spree/marketing/mailchimp_error_notifier_spec.rb @@ -0,0 +1,23 @@+require 'spec_helper' + +RSpec.describe Spree::Marketing::MailchimpErrorNotifier do + + SpreeMarketing::CONFIG = { Rails.env => { campaign_defaults: { from_email: 'a@test.com' }} } + + describe 'notify_failure' do + + let(:mail) { described_class.notify_failure('TestJob', 'title', 'detail') } + + it 'renders the subject' do + expect(mail.subject).to eq I18n.t(:subject, scope: [:spree, :marketing, :mailchimp_error_notifier, :notify_failure]) + end + + it 'renders the receiver email' do + expect(mail.to).to eq [SpreeMarketing::CONFIG[Rails.env][:campaign_defaults][:from_email]] + end + + it 'renders the sender email' do + expect(mail.from).to eq ['marketing@vinsol.com'] + end + end +end
Add rspec for error notifier
diff --git a/app/models/projet.rb b/app/models/projet.rb index abc1234..def5678 100644 --- a/app/models/projet.rb +++ b/app/models/projet.rb @@ -6,7 +6,7 @@ validates_presence_of :titre, :objectif, :description, :contributeur def liked_by?(contributeur) - if likes.empty? + if !contributeur || likes.empty? return false else likes.collect { |like| like.contributeur_id }.include? contributeur.id
Fix - Renvoie false si contributeur est nil pour éviter le crash du projets#show quand likes >= 1 et qu'il n'y a pas d'utilisateur connecté
diff --git a/lib/bcsec.rb b/lib/bcsec.rb index abc1234..def5678 100644 --- a/lib/bcsec.rb +++ b/lib/bcsec.rb @@ -1,5 +1,9 @@ module Bcsec VERSION = File.read(File.expand_path('../../VERSION', __FILE__)).strip + + autoload :CentralParameters, 'bcsec/central_parameters' + autoload :Configuration, 'bcsec/configuration' + autoload :Deprecation, 'bcsec/deprecation' class << self attr_accessor :configuration
Use autoload for Bcsec module constants.
diff --git a/split-export.gemspec b/split-export.gemspec index abc1234..def5678 100644 --- a/split-export.gemspec +++ b/split-export.gemspec @@ -23,5 +23,5 @@ # Development Dependencies s.add_development_dependency "rspec", "~> 3.7" s.add_development_dependency "rake", "~> 12.3" - s.add_development_dependency 'fakeredis', '~> 0.7.0' + s.add_development_dependency 'fakeredis', '~> 0.8.0' end
Update fakeredis requirement from ~> 0.7.0 to ~> 0.8.0 Updates the requirements on [fakeredis](https://guilleiguaran.github.com/fakeredis) to permit the latest version. Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/lib/ebooks/twitter.rb b/lib/ebooks/twitter.rb index abc1234..def5678 100644 --- a/lib/ebooks/twitter.rb +++ b/lib/ebooks/twitter.rb @@ -8,14 +8,16 @@ @access_token_secret = credentials.fetch(:oauth_token_secret) end - def tweet(tweet_text) - twitter_client = ::Twitter::REST::Client.new do |config| + def twitter_client + ::Twitter::REST::Client.new do |config| config.consumer_key = @consumer_key config.consumer_secret = @consumer_secret config.access_token = @access_token config.access_token_secret = @access_token_secret end + end + def tweet(tweet_text) tweet_text = tweet_text.gsub('@', '')[0..139] p "#{Time.now}: #{tweet_text}" twitter_client.update(tweet_text)
Break out into separate method
diff --git a/lib/emcee/document.rb b/lib/emcee/document.rb index abc1234..def5678 100644 --- a/lib/emcee/document.rb +++ b/lib/emcee/document.rb @@ -27,10 +27,12 @@ private + # Get the html content of the document as a string. def to_html @doc.at("body").children.to_html.lstrip end + # Get a list of nodes with a 'selected' attribute. def selected @doc.css("*[selected]") end
Add comments to private methods of Document class
diff --git a/lib/exercism/trail.rb b/lib/exercism/trail.rb index abc1234..def5678 100644 --- a/lib/exercism/trail.rb +++ b/lib/exercism/trail.rb @@ -5,7 +5,7 @@ @slugs = slugs @name = language @language = language.downcase - @exercises = slugs.map {|slug| Exercise.new(language, slug)} + @exercises = slugs.map {|slug| Exercise.new(@language, slug)} @path = path end
Put nitpick nav back (exercise breakdown)
diff --git a/lib/fog/aws/errors.rb b/lib/fog/aws/errors.rb index abc1234..def5678 100644 --- a/lib/fog/aws/errors.rb +++ b/lib/fog/aws/errors.rb @@ -2,11 +2,32 @@ module AWS module Errors def self.match_error(error) - matcher = lambda {|s| s.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)} - [error.message, error.response.body].each(&Proc.new {|s| - match = matcher.call(s) - return {:code => match[1].split('.').last, :message => match[2]} if match - }) + if !Fog::AWS.json_response?(error.response) + matchers = [ + lambda {|s| s.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)}, + lambda {|s| s.match(/.*<(.+Exception)>(?:.*<Message>(.*)<\/Message>)/m)} + ] + [error.message, error.response.body].each(&Proc.new {|s| + matchers.each do |matcher| + match = matcher.call(s) + return {:code => match[1].split('.').last, :message => match[2]} if match + end + }) + else + begin + full_msg_error = Fog::JSON.decode(error.response.body) + if (full_msg_error.has_key?('Message') || full_msg_error.has_key?('message')) && + error.response.headers.has_key?('x-amzn-ErrorType') + matched_error = { + :code => error.response.headers['x-amzn-ErrorType'].split(':').first, + :message => full_msg_error['Message'] || full_msg_error['message'] + } + return matched_error + end + rescue Fog::JSON::DecodeError => e + Fog::Logger.warning("Error parsing response json - #{e}") + end + end {} # we did not match the message or response body end end
Add additional cases in Fog::AWS::Errors.match_error helper
diff --git a/spec/support/blueprints.rb b/spec/support/blueprints.rb index abc1234..def5678 100644 --- a/spec/support/blueprints.rb +++ b/spec/support/blueprints.rb @@ -9,8 +9,8 @@ Event.blueprint do name { 'Encontro GURU-RS Maio' } enroll_url { 'http://nos.vc/pt/projects/360-encontro-guru-rs-maio' } - proposals_url { 'http://call4paperz.com/events/30o-encontro-do-guru-sp' } - happens_at { 30.days.from_now } + proposals_url { '' } + happens_at { '' } end User.blueprint do
Remove non-required Event attributes from blueprint
diff --git a/lib/jello.rb b/lib/jello.rb index abc1234..def5678 100644 --- a/lib/jello.rb +++ b/lib/jello.rb @@ -19,7 +19,7 @@ paste = mould.on_paste[paste] end - if paste and paste != initial_paste + if paste.is_a?(String) and paste != initial_paste puts " --> [#{paste}]" if options[:verbose] pasteboard.puts paste end
Return value of (non-String) is now ignored and not pushed back onto the board (thus you can have inactive or non-modifying Moulds)
diff --git a/lib/puffery/client.rb b/lib/puffery/client.rb index abc1234..def5678 100644 --- a/lib/puffery/client.rb +++ b/lib/puffery/client.rb @@ -23,20 +23,24 @@ { 'Content-Type' => 'application/json' }) end - def up(resource) - payload = Puffery.build_payload(resource) - payload[:ad_group][:status] = 'enabled' - uid = resource.remote_uid - raise 'Missing UID' unless uid - response = conn.put(path: "/api/ad_groups/#{resource.remote_uid}", - body: JSON.dump(payload) - ) - handle_errors(response) - response + def up(uid, payload) + json = request(:put, "/api/ad_groups/#{uid}", payload.raw) + json['ad_group'] end - def handle_errors(response) - data = JSON.parse(response.body) + def down(uid) + json = request(:patch, "/api/ad_groups/#{uid}", { status: 'paused' }) + json['ad_group'] + end + + def request(method, path, body = {}) + res = conn.request(method: method, path: path, body: JSON.dump(body)) + json = JSON.parse(res.body) + handle_errors(json) + json + end + + def handle_errors(data) if data['errors'].any? raise RequestError, "Request Error occurred: %s" % data['errors'].first
Add request method to handle parsing and errors
diff --git a/lib/rails-settings.rb b/lib/rails-settings.rb index abc1234..def5678 100644 --- a/lib/rails-settings.rb +++ b/lib/rails-settings.rb @@ -3,8 +3,7 @@ # In Rails 4, attributes can be protected by using the gem `protected_attributes` # In Rails 5, protecting attributes is obsolete (there are `StrongParameters` only) def self.can_protect_attributes? - ActiveRecord::Base.respond_to?(:attr_accessible) && - ActiveRecord::Base.respond_to?(:attr_protected) + (ActiveRecord::VERSION::MAJOR == 3) || defined?(ProtectedAttributes) end end
Fix compatibility with Rails 4 Belongs to #73
diff --git a/lib/stack_commands.rb b/lib/stack_commands.rb index abc1234..def5678 100644 --- a/lib/stack_commands.rb +++ b/lib/stack_commands.rb @@ -31,7 +31,7 @@ def fetch create_directories if Dir.exists?(@stack.git_path) - git("fetch", "--git-dir=#{@stack.git_path}/.git", SSH_ENV) + Dir.chdir(@stack.git_path) { git("fetch", SSH_ENV) } else git("clone", @stack.repo_git_url, @stack.git_path, SSH_ENV) end
Use correct directory for git fetch.
diff --git a/Casks/find-any-file.rb b/Casks/find-any-file.rb index abc1234..def5678 100644 --- a/Casks/find-any-file.rb +++ b/Casks/find-any-file.rb @@ -1,6 +1,6 @@ cask :v1 => 'find-any-file' do - version '1.8.8' - sha256 '3ef7b2a0f5373ac904198fb574d61d39316a0c4f6cb6740742b719bd7c842255' + version '1.8.9' + sha256 'fde3cd23b38f5baa626f557ac40148795a5afee6cc84ecb28b74b439bdae0189' # amazonaws.com is the official download host per the vendor homepage url "http://files.tempel.org.s3.amazonaws.com/FindAnyFile_#{version}.zip"
Update Find Any File.app to v1.8.9
diff --git a/Casks/font-pt-serif.rb b/Casks/font-pt-serif.rb index abc1234..def5678 100644 --- a/Casks/font-pt-serif.rb +++ b/Casks/font-pt-serif.rb @@ -2,7 +2,7 @@ url 'http://www.fontstock.com/public/PTSerif.zip' homepage 'http://www.paratype.com/public/' version '1.001' - sha1 'b445d4cc49a18581852bab27a204d4b4a44a403f' + sha256 '74eec886edb58899018448e69cfab7032dd2ce8ff69a44c18f88a7d2a7bf3b26' font 'PTF55F.ttf' font 'PTF56F.ttf' font 'PTF75F.ttf'
Update PT serif to sha256 checksums
diff --git a/revuelog.rb b/revuelog.rb index abc1234..def5678 100644 --- a/revuelog.rb +++ b/revuelog.rb @@ -5,7 +5,6 @@ @time = time @nick = nick @message = message - #@revueobjt = Struct.new(:time, :nick, :message) end def to_hash @@ -14,19 +13,5 @@ revuehash.instance_variables.each {|var| hash[var.to_s.delete("@")] = revuehash.instance_variable_get(var) } p hash end - - # def self.dbadd(revueobj) - - # self - # end - - # private - - # def revuedb - # client = MongoClient.new - # db = client['revue-db'] - # coll = db['revue-collection'] - - # end end
Add hash creation feature, need feedback @yaf can you review it?
diff --git a/services/QuillLMS/lib/clever_library/api/client.rb b/services/QuillLMS/lib/clever_library/api/client.rb index abc1234..def5678 100644 --- a/services/QuillLMS/lib/clever_library/api/client.rb +++ b/services/QuillLMS/lib/clever_library/api/client.rb @@ -8,6 +8,10 @@ "Authorization": "Bearer " + bearer_token } } + end + + def get_user() + self.class.get('/me', @options).parsed_response["data"] end def get_teacher(teacher_id:)
Add Me function to Clever 2.0 API
diff --git a/lib/hooks/qiita_team/helper.rb b/lib/hooks/qiita_team/helper.rb index abc1234..def5678 100644 --- a/lib/hooks/qiita_team/helper.rb +++ b/lib/hooks/qiita_team/helper.rb @@ -16,7 +16,7 @@ end def user_url(base_url, url_name) - URI.join(URI.parse(base_url), "/" + url_name) + URI.join(base_url, "/#{url_name}") end end end
Change user_url, unnecessary to parse base_url :P
diff --git a/carmen-rails.gemspec b/carmen-rails.gemspec index abc1234..def5678 100644 --- a/carmen-rails.gemspec +++ b/carmen-rails.gemspec @@ -15,7 +15,7 @@ s.test_files = Dir["spec/**/*"] s.add_dependency "rails" - s.add_dependency "carmen", '1.0.0.beta1' + s.add_dependency "carmen", "~> 1.0.0.beta2" s.add_development_dependency "minitest" end
Use a pessimistic version for carmen
diff --git a/spec/features/create_match_spec.rb b/spec/features/create_match_spec.rb index abc1234..def5678 100644 --- a/spec/features/create_match_spec.rb +++ b/spec/features/create_match_spec.rb @@ -7,7 +7,7 @@ login end - scenario 'generate new' do + pending 'generate new' do visit project_path(@project) click_on 'Create a Match'
Set pending on create match spec
diff --git a/lib/tasks/offerings_count.rake b/lib/tasks/offerings_count.rake index abc1234..def5678 100644 --- a/lib/tasks/offerings_count.rake +++ b/lib/tasks/offerings_count.rake @@ -2,9 +2,12 @@ desc "recalculate the 'offerings_count' field for runnable objects" task :set_counts => :environment do - %w(Investigation ResourcePage Page Portal::Teacher).each do |c| - c.classify.constantize.all(:include => :offerings).each do |rec| - rec.update_attribute(:offerings_count, rec.offerings.size) + updating_models = %w(Investigation ResourcePage Page Portal::Teacher) + + updating_models.each_with_index do |c, i| + puts "Updating #{c.pluralize} (step #{i+1} of #{updating_models.size}) ..." + c.classify.constantize.all.each do |rec| + rec.update_attribute(:offerings_count, rec.offerings.count) end end end
Add friendly output to the offerings rake task The rake task to update the offerings count on some models was taking a long time when there was a lot of data. This commit adds some debug output.