diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -13,15 +13,9 @@ .build(sign_up_params) if resource.save - if resource.active_for_authentication? - set_flash_message :notice, :signed_up if is_navigational_format? - sign_up(resource_name, resource) - respond_with resource, :location => after_sign_up_path_for(resource) - else - set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format? - expire_session_data_after_sign_in! - respond_with resource, :location => after_inactive_sign_up_path_for(resource) - end + set_flash_message :notice, :signed_up if is_navigational_format? + sign_up(resource_name, resource) + respond_with resource, :location => after_sign_up_path_for(resource) else clean_up_passwords resource respond_with resource
Remove extra code we won't be using
diff --git a/test/integration/default/serverspec/localhost/lumenvox_spec.rb b/test/integration/default/serverspec/localhost/lumenvox_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/localhost/lumenvox_spec.rb +++ b/test/integration/default/serverspec/localhost/lumenvox_spec.rb @@ -1,4 +1,19 @@ require 'spec_helper' describe 'Lumenvox' do + describe service('lvttsd') do + it { should be_running } + end + + describe service('lvsred') do + it { should be_running } + end + + describe service('lvmediaserverd') do + it { should be_running } + end + + describe service('lvlicensed') do + it { should be_running } + end end
Add some basic tests to ensure all services get started
diff --git a/base/db/migrate/20120403175913_create_activity_object_audiences.rb b/base/db/migrate/20120403175913_create_activity_object_audiences.rb index abc1234..def5678 100644 --- a/base/db/migrate/20120403175913_create_activity_object_audiences.rb +++ b/base/db/migrate/20120403175913_create_activity_object_audiences.rb @@ -24,5 +24,6 @@ end ActivityObjectAudience.record_timestamps = true + ActivityObject.reset_column_information end end
Fix ActivityObject obsolete column info
diff --git a/spec/acceptance/init_task_spec.rb b/spec/acceptance/init_task_spec.rb index abc1234..def5678 100644 --- a/spec/acceptance/init_task_spec.rb +++ b/spec/acceptance/init_task_spec.rb @@ -1,11 +1,29 @@ # run a test task require 'spec_helper_acceptance' -describe 'apt tasks' do - describe 'update and upgrade', if: pe_install? && puppet_version =~ %r{(5\.\d\.\d)} && fact_on(master, 'osfamily') == 'Debian' do - it 'execute arbitary sql' do +describe 'apt tasks', if: pe_install? && puppet_version =~ %r{(5\.\d\.\d)} && fact_on(master, 'osfamily') == 'Debian' do + describe 'update' do + it 'updates package lists' do result = run_task(task_name: 'apt', params: 'action=update') expect_multiple_regexes(result: result, regexes: [%r{Reading package lists}, %r{Job completed. 1/1 nodes succeeded}]) end end + describe 'upgrade' do + it 'upgrades packages' do + result = run_task(task_name: 'apt', params: 'action=upgrade') + expect_multiple_regexes(result: result, regexes: [%r{\d+ upgraded, \d+ newly installed, \d+ to remove and \d+ not upgraded}, %r{Job completed. 1/1 nodes succeeded}]) + end + end + describe 'dist-upgrade' do + it 'dist-upgrades packages' do + result = run_task(task_name: 'apt', params: 'action=dist-upgrade') + expect_multiple_regexes(result: result, regexes: [%r{\d+ upgraded, \d+ newly installed, \d+ to remove and \d+ not upgraded}, %r{Job completed. 1/1 nodes succeeded}]) + end + end + describe 'autoremove' do + it 'autoremoves obsolete packages' do + result = run_task(task_name: 'apt', params: 'action=autoremove') + expect_multiple_regexes(result: result, regexes: [%r{\d+ upgraded, \d+ newly installed, \d+ to remove and \d+ not upgraded}, %r{Job completed. 1/1 nodes succeeded}]) + end + end end
Add tests for new apt actions
diff --git a/spec/features/admin/order_spec.rb b/spec/features/admin/order_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin/order_spec.rb +++ b/spec/features/admin/order_spec.rb @@ -15,8 +15,6 @@ create :check_payment, order: @order, amount: @order.amount # ensure order shows up as completed - #@order.completed_at = Time.now #to show up in list as completed - #@order.save! @order.finalize! end @@ -26,10 +24,9 @@ login_to_admin_section click_link 'Orders' - #choose 'Only Show Complete Orders' - #click_button 'Filter Results' + current_path.should == spree.admin_orders_path - # click the link for the order + # click the 'capture' link for the order page.find("[data-action=capture][href*=#{@order.number}]").click # we should be notified @@ -40,8 +37,7 @@ @order.payment_state.should == "paid" # we should still be on the right page - page.should have_selector "h1", text: "Listing Orders" #t(:listing_orders) - #current_path.should == admin_orders_path + current_path.should == spree.admin_orders_path end # scenario end # context
Clean up comments and use admin_orders_path for checking current page
diff --git a/Library/Homebrew/test/test_sandbox.rb b/Library/Homebrew/test/test_sandbox.rb index abc1234..def5678 100644 --- a/Library/Homebrew/test/test_sandbox.rb +++ b/Library/Homebrew/test/test_sandbox.rb @@ -4,25 +4,25 @@ class SandboxTest < Homebrew::TestCase def setup skip "sandbox not implemented" unless Sandbox.available? + @sandbox = Sandbox.new + @dir = Pathname.new(Dir.mktmpdir) + @file = @dir/"foo" + end + + def teardown + @dir.rmtree end def test_allow_write - s = Sandbox.new - testpath = Pathname.new(TEST_TMPDIR) - foo = testpath/"foo" - s.allow_write foo - s.exec "touch", foo - assert_predicate foo, :exist? - foo.unlink + @sandbox.allow_write @file + @sandbox.exec "touch", @file + assert_predicate @file, :exist? end def test_deny_write - s = Sandbox.new - testpath = Pathname.new(TEST_TMPDIR) - bar = testpath/"bar" shutup do - assert_raises(ErrorDuringExecution) { s.exec "touch", bar } + assert_raises(ErrorDuringExecution) { @sandbox.exec "touch", @file } end - refute_predicate bar, :exist? + refute_predicate @file, :exist? end end
Manage sandbox test resources in setup/teardown
diff --git a/spec/features/tinymce_input_spec.rb b/spec/features/tinymce_input_spec.rb index abc1234..def5678 100644 --- a/spec/features/tinymce_input_spec.rb +++ b/spec/features/tinymce_input_spec.rb @@ -0,0 +1,24 @@+# frozen_string_literal: true + +require 'rails_helper' + +describe 'Text area input that uses TinyMCE', type: :feature, js: true do + let(:course) { create(:course, weekdays: '0101010') } + let(:user) { create(:admin) } + + before do + login_as user + stub_oauth_edit + end + + it 'lets a user input text and save it' do + visit "/courses/#{course.slug}/timeline" + click_button 'Add Week' + click_button 'Add Block' + find('.mce-content-body').click + find('.mce-content-body').send_keys('Hello, my name is Sage') + expect(page).to have_content('Hello, my name is Sage') + click_button 'Save' + expect(page).to have_content('Hello, my name is Sage') + end +end
Add spec for TinyMCE integration This spec would have caught the problem recently introduced by a TinyMCE version change and fixed in ec431bc761aadaaf3e45e13b5b9898b19e6b27da
diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/users_helper_spec.rb +++ b/spec/helpers/users_helper_spec.rb @@ -35,6 +35,7 @@ context "following them" do before { us.stub(:following?) { true } } + before { us.stub_chain(:follower_followings, :find_by) { them } } it "shows an unfollow button" do helper.follow_user_button(them).should match(/class="button unfollow/i)
Fix for broken user helper spec
diff --git a/spec/requests/compression_spec.rb b/spec/requests/compression_spec.rb index abc1234..def5678 100644 --- a/spec/requests/compression_spec.rb +++ b/spec/requests/compression_spec.rb @@ -2,15 +2,19 @@ describe 'response compression', type: :request do it 'compresses html' do - get('/', nil, 'Accept-Encoding' => 'gzip, deflate, sdch') + get( + '/', + params: {}, + headers: { 'Accept-Encoding' => 'gzip, deflate, sdch' } + ) expect(response.headers['Content-Encoding']).to eq('gzip') end it 'compresses css' do get( '/assets/application.self.css', - nil, - 'Accept-Encoding' => 'gzip, deflate, sdch' + params: {}, + headers: { 'Accept-Encoding' => 'gzip, deflate, sdch' } ) expect(response.headers['Content-Encoding']).to eq('gzip') end @@ -18,8 +22,8 @@ it 'compresses javascript' do get( '/assets/application.self.js', - nil, - 'Accept-Encoding' => 'gzip, deflate, sdch' + params: {}, + headers: { 'Accept-Encoding' => 'gzip, deflate, sdch' } ) expect(response.headers['Content-Encoding']).to eq('gzip') end @@ -28,8 +32,8 @@ image = FactoryGirl.create(:gend_image, work_in_progress: false) get( "/gend_images/#{image.id_hash}.#{image.format}", - nil, - 'Accept-Encoding' => 'gzip, deflate, sdch' + params: {}, + headers: { 'Accept-Encoding' => 'gzip, deflate, sdch' } ) expect(response.headers['Content-Encoding']).to be_nil end
Fix deprecation warnings in compression spec
diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb index abc1234..def5678 100644 --- a/spec/unit/recipes/default_spec.rb +++ b/spec/unit/recipes/default_spec.rb @@ -2,7 +2,13 @@ describe 'default recipe' do cached(:chef_run) do - runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') + runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node| + node.automatic['maven']['version'] = '1.2.3' + node.automatic['maven']['url'] = 'https://maven/maven.tar.gz' + node.automatic['maven']['checksum'] = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' + node.automatic['maven']['m2_home'] = '/home/maven-user' + node.automatic['maven']['setup_bin'] = false + end runner.converge('maven::default') end @@ -12,6 +18,12 @@ it 'downloads ark' do expect(chef_run).to install_ark('maven') + .with(version: '1.2.3') + .with(url: 'https://maven/maven.tar.gz') + .with(checksum: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef') + .with(home_dir: '/home/maven-user') + .with(win_install_dir: '/home/maven-user') + .with(append_env_path: false) end it 'writes the `/etc/mavenrc`' do
Verify install_ark resource is correctly called Add tests to ensure that the correct parameters are passed into the `install_ark` resource. Note that we've overridden the default value of attributes for our Rspec test, in order to ensure that we're correctly passing in the attributes. As part of #82. Signed-off-by: Jamie Tanna <b4dde37aa2aac745c0e6c43447507eaeace3e59f@jamietanna.co.uk>
diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb index abc1234..def5678 100644 --- a/spec/unit/recipes/default_spec.rb +++ b/spec/unit/recipes/default_spec.rb @@ -5,6 +5,14 @@ # Copyright (c) 2016 The Authors, All Rights Reserved. require 'spec_helper' + +module Kernel + alias :old_require :require + def require(path) + old_require(path) unless ['daun', 'rugged'].include?(path) + end +end + describe 'daun::default' do context 'When all attributes are default, on an unspecified platform' do
Fix chefspec by stubbing Kernel.require method.
diff --git a/spec/unit/templates/users_spec.rb b/spec/unit/templates/users_spec.rb index abc1234..def5678 100644 --- a/spec/unit/templates/users_spec.rb +++ b/spec/unit/templates/users_spec.rb @@ -0,0 +1,27 @@+require 'spec_helper' +require 'bosh/template/renderer' + +RSpec.describe 'Users credentials file', template: true do + let(:users_config) { + compiled_template('rabbitmq-server', 'users', { + 'rabbitmq-server' => { + 'administrators' => { + 'management' => { + 'username' => 'my${SHELL}username', + 'password' => 'my${SHELL}password' + }, + 'broker' => { + 'username' => 'my${SHELL}username', + 'password' => 'my${SHELL}password' + } + } + } + }) + } + + it 'does not allow Shell injection by escaping special characters' do + expect(users_config).to include('RMQ_OPERATOR_USERNAME="my\$\{SHELL\}username"') + expect(users_config).to include('RMQ_OPERATOR_PASSWORD="my\$\{SHELL\}password"') + expect(users_config).to include('RMQ_BROKER_PASSWORD="my\$\{SHELL\}password"') + end +end
Test against Shell injection in users template [#139274045]
diff --git a/spec/features/schedules/cannot_delete_a_job_when_the_schedule_is_static.rb b/spec/features/schedules/cannot_delete_a_job_when_the_schedule_is_static.rb index abc1234..def5678 100644 --- a/spec/features/schedules/cannot_delete_a_job_when_the_schedule_is_static.rb +++ b/spec/features/schedules/cannot_delete_a_job_when_the_schedule_is_static.rb @@ -0,0 +1,44 @@+require 'rails_helper' + +feature 'deleting a job from the dynamic schedule' do + + def visit_scheduler_page + visit resque_scheduler_engine_routes.schedules_path + end + + before do + Resque.schedule = { + 'some_ivar_job' => { + 'cron' => '* * * * *', + 'class' => 'SomeIvarJob', + 'args' => '/tmp', + 'rails_env' => 'test' + }, + 'some_other_job' => { + 'every' => ['1m', ['1h']], + 'queue' => 'high', + 'custom_job_class' => 'SomeOtherJob', + 'rails_env' => 'test', + 'args' => { + 'b' => 'blah' + } + } + } + allow(Resque::Scheduler).to receive(:dynamic).and_return(false) + Resque::Scheduler.load_schedule! + visit_scheduler_page + end + + after do + Resque.reset_delayed_queue + Resque.queues.each { |q| Resque.remove_queue q } + Resque.schedule = {} + Resque::Scheduler.env = 'test' + end + + scenario 'the delete button is not present when the schedule is static' do + visit resque_scheduler_engine_routes.schedules_path + expect(page).to_not have_css '#job_some_ivar_job .delete-button' + end + +end
Test that the delete button is not present when the schedule is not dynamic
diff --git a/spec/config/lint_data_files_spec.rb b/spec/config/lint_data_files_spec.rb index abc1234..def5678 100644 --- a/spec/config/lint_data_files_spec.rb +++ b/spec/config/lint_data_files_spec.rb @@ -0,0 +1,22 @@+# frozen_string_literal: true + +require "rails_helper" +require "yaml" +require "json" +require "pathname" + +describe "app.json" do + it "loads from JSON" do + assert JSON.load(File.open(Rails.root.join("app.json"))) + end +end + +describe "locales" do + yaml_paths = Pathname.glob(Rails.root.join("config", "locales", "*.yml")) + + yaml_paths.each do |path| + it "load from #{path}" do + assert YAML.load_file(path) + end + end +end
Add test to never break the app.json file again.
diff --git a/spec/dummy/spec/models/post_spec.rb b/spec/dummy/spec/models/post_spec.rb index abc1234..def5678 100644 --- a/spec/dummy/spec/models/post_spec.rb +++ b/spec/dummy/spec/models/post_spec.rb @@ -6,7 +6,6 @@ subject { Post.first } it "is true for other instances' decorators" do - pending if Rails.version.start_with?("3.0") other = Post.first subject.should_not be other (subject == other.decorate).should be_true
Remove pending spec on Rails 3.0
diff --git a/lib/ami_spec/server_spec.rb b/lib/ami_spec/server_spec.rb index abc1234..def5678 100644 --- a/lib/ami_spec/server_spec.rb +++ b/lib/ami_spec/server_spec.rb @@ -2,6 +2,13 @@ # Requiring rspec first fixes that *shrug* require 'rspec' require 'serverspec' + +# I hate Monkeys +class Specinfra::Backend::Base + def self.clear + @instance = nil + end +end module AmiSpec class ServerSpec @@ -21,9 +28,6 @@ $LOAD_PATH.unshift(@spec) unless $LOAD_PATH.include?(@spec) require File.join(@spec, 'spec_helper') - # ServerSpec is caching a SSH connection between runs. - set :ssh, nil - set :backend, :ssh set :host, @ip set :ssh_options, :user => @user, :keys => [@key_file], :paranoid => false @@ -33,6 +37,8 @@ RSpec::Core::Runner.disable_autorun! result = RSpec::Core::Runner.run(Dir.glob("#{@spec}/#{@role}/*_spec.rb")) + Specinfra::Backend::Ssh.clear + result.zero? end end
Reset the backend connection after each run To prevent ServerSpec from using the existing SSH connection for each test run. The Monkey Patch can be removed once https://github.com/mizzy/specinfra/pull/504 is merged
diff --git a/lib/custom_error_message.rb b/lib/custom_error_message.rb index abc1234..def5678 100644 --- a/lib/custom_error_message.rb +++ b/lib/custom_error_message.rb @@ -16,7 +16,7 @@ if attr == "base" full_messages << msg elsif msg =~ /^\^/ - full_messages << msg.sub(/^\^/, '') # Isn't there a simpler way to strip the first character? + full_messages << msg[1..-1] else full_messages << @base.class.human_attribute_name(attr) + " " + msg end
Mark Wiens kindly suggested a neater way to strip the '^' character
diff --git a/lib/danthes/view_helpers.rb b/lib/danthes/view_helpers.rb index abc1234..def5678 100644 --- a/lib/danthes/view_helpers.rb +++ b/lib/danthes/view_helpers.rb @@ -12,11 +12,11 @@ # Subscribe the client to the given channel. This generates # some JavaScript calling Danthes.sign with the subscription # options. - def subscribe_to(channel) + def subscribe_to(channel, opts = {}) + js_tag = opts.delete(:include_js_tag){ true } subscription = Danthes.subscription(channel: channel) - content_tag 'script', type: 'text/javascript' do - raw("if (typeof Danthes != 'undefined') { Danthes.sign(#{subscription.to_json}) }") - end + content = raw("if (typeof Danthes != 'undefined') { Danthes.sign(#{subscription.to_json}) }") + js_tag ? content_tag('script', content, type: 'text/javascript') : content end end end
Add an option to not include <script> tag (useful when rendering in JS views)
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,6 +13,9 @@ $rubygems_config = YAML.load_file("config/rubygems.yml")[Rails.env].symbolize_keys HOST = $rubygems_config[:host] + +# DO NOT EDIT THIS LINE DIRECTLY +# Instead, run: bundle exec rake gemcutter:rubygems:update VERSION=[version number] RAILS_ENV=[staging|production] S3_KEY=[key] S3_SECRET=[secret] RUBYGEMS_VERSION = "1.8.10" module Gemcutter
Add a warning not to manually edit RUBYGEMS_VERSION
diff --git a/config/environment.rb b/config/environment.rb index abc1234..def5678 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -4,3 +4,5 @@ # Initialize the Rails application. Rails.application.initialize! ENV['HOST_PORT'] ||= ":80" +mylog = Logger.new(STDERR) +mylog.info("environment.rb: The ExecJS runtime is #{ExecJS.runtime.name}")
Print a message saying what the ExecJS runtime is.
diff --git a/acronym/acronym_test.rb b/acronym/acronym_test.rb index abc1234..def5678 100644 --- a/acronym/acronym_test.rb +++ b/acronym/acronym_test.rb @@ -23,8 +23,14 @@ gem 'minitest', '>= 5.0.0' end - # This is some simple book-keeping to let people who are - # giving feedback know which version of the exercise you solved. + # Problems in exercism evolve over time, + # as we find better ways to ask questions. + # The version number refers to the version of the problem you solved, + # not your solution. + # + # Define a constant named VERSION inside of Acronym. + # If you are curious, read more about constants on RubyDoc: + # http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html def test_version assert_equal 1, Acronym::VERSION end
Update acronym version test comments to be more clear for user Found that users were getting confused by the version test and it's purpose (see ticket https://github.com/exercism/xruby/issues/188). Goal is to make it clear to users that there only need to return the number that is asked. They do not need to bump the versions themselves at any point. We have also included a link to the ruby docs on contstants so if a user is curious at what they are inserting, they can read more about them Update binary version test comments to be more clear for user Found that users were getting confused by the version test and it's purpose (see (https://github.com/exercism/xruby/issues/188). Goal is to make it clear to users that there only need to return the number that is asked. They do not need to bump the versions themselves at any point. We have also included a link to the ruby docs on contstants so if a user is curious at what they are inserting, they can read more about them Update acronym version test comments to be more clear for user Found that users were getting confused by the version test and it's purpose (see ticket https://github.com/exercism/xruby/issues/188). Goal is to make it clear to users that there only need to return the number that is asked. They do not need to bump the versions themselves at any point. We have also included a link to the ruby docs on contstants so if a user is curious at what they are inserting, they can read more about them
diff --git a/lib/docs/scrapers/react_native.rb b/lib/docs/scrapers/react_native.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/react_native.rb +++ b/lib/docs/scrapers/react_native.rb @@ -3,7 +3,7 @@ self.name = 'React Native' self.slug = 'react_native' self.type = 'react' - self.version = '0.10.0' + self.version = '0.12.0' self.base_url = 'https://facebook.github.io/react-native/docs/' self.root_path = 'getting-started.html' self.links = {
Update React Native documentation (0.12.0)
diff --git a/lib/emony/tag_matching/matcher.rb b/lib/emony/tag_matching/matcher.rb index abc1234..def5678 100644 --- a/lib/emony/tag_matching/matcher.rb +++ b/lib/emony/tag_matching/matcher.rb @@ -1,5 +1,6 @@ require 'emony/tag_matching/rules' require 'emony/tag_matching/cache' +require 'emony/tag_parser' module Emony module TagMatching @@ -14,8 +15,8 @@ end def find(tag_or_label) - @cache.fetch(tag_or_label) do - tag = tag_or_label.to_s.gsub(/(:.+)?(@\d+)?\z/, '') # XXX: TODO: use tag_parser + tag = TagParser.parse(tag_or_label)[:tag] + @cache.fetch(tag) do r = nil @rules.each do |rule| if rule.match?(tag)
Use TagParser to earn tag part from label (or tag)
diff --git a/sql/postgresql/reset_id_sequence.rb b/sql/postgresql/reset_id_sequence.rb index abc1234..def5678 100644 --- a/sql/postgresql/reset_id_sequence.rb +++ b/sql/postgresql/reset_id_sequence.rb @@ -0,0 +1,25 @@+# Script to reset id sequences +# Written specifically for elixir/phoenix, but should be applicable for anything + +# to get list of sequences +# SELECT c.relname FROM pg_class c WHERE c.relkind = 'S'; +# from: https://stackoverflow.com/questions/1493262/list-all-sequences-in-a-postgres-db-8-1-with-sql + +data = <<-eos +authors_id_seq +book_locations_id_seq +libraries_id_seq +genres_id_seq +ratings_id_seq +loans_id_seq +locations_id_seq +eos + +# sql to reset sequence based on: +# https://stackoverflow.com/questions/244243/how-to-reset-postgres-primary-key-sequence-when-it-falls-out-of-sync +data.split("\n").each do |line| + table_name = line.gsub(/_id_seq$/, '') + sequence_name = line + + puts "SELECT setval('#{sequence_name}', COALESCE((SELECT MAX(id)+1 FROM #{table_name}), 1), false);" +end
Add script to reset postgres id sequences
diff --git a/lib/lims-laboratory-app/laboratory/sample/swap_samples_resource.rb b/lib/lims-laboratory-app/laboratory/sample/swap_samples_resource.rb index abc1234..def5678 100644 --- a/lib/lims-laboratory-app/laboratory/sample/swap_samples_resource.rb +++ b/lib/lims-laboratory-app/laboratory/sample/swap_samples_resource.rb @@ -0,0 +1,25 @@+require 'lims-api/core_action_resource' +require 'lims-api/struct_stream' +require 'lims-laboratory-app/laboratory/sample/swap_samples' + +module Lims::LaboratoryApp + module Laboratory + class Sample + class SwapSamplesResource < Lims::Api::CoreActionResource + + def filtered_attributes + super.tap do |attributes| + attributes[:swap_samples] = attributes[:swap_samples].map.each do |element| + element.mash do |k,v| + case k + when "resource" then ["resource_uuid", @context.uuid_for(v)] + else [k,v] + end + end + end + end + end + end + end + end +end
Swap sample resource to display correctly the parameters in the json
diff --git a/middleman-core/lib/middleman-more/extensions/automatic-alt-tags.rb b/middleman-core/lib/middleman-more/extensions/automatic-alt-tags.rb index abc1234..def5678 100644 --- a/middleman-core/lib/middleman-more/extensions/automatic-alt-tags.rb +++ b/middleman-core/lib/middleman-more/extensions/automatic-alt-tags.rb @@ -0,0 +1,32 @@+# Automatic Image alt tags from image names extension +class Middleman::Extensions::AutomaticAltTags < ::Middleman::Extension + + def initialize(app, options_hash={}, &block) + super + end + + helpers do + # Override default image_tag helper to automatically insert alt tag + # containing image name. + + def image_tag(path) + if !path.include?("://") + params[:alt] ||= "" + + real_path = path + real_path = File.join(images_dir, real_path) unless real_path.start_with?('/') + full_path = File.join(source_dir, real_path) + + if File.exists?(full_path) + begin + alt_text = File.basename(full_path, ".*") + alt_text.capitalize! + params[:alt] = alt_text + end + end + end + + super(path) + end + end +end
Create automated alt tag addition, based on image name. Needs documentation.
diff --git a/db/migrate/20151216111502_add_artifacts_metadata_to_ci_build.rb b/db/migrate/20151216111502_add_artifacts_metadata_to_ci_build.rb index abc1234..def5678 100644 --- a/db/migrate/20151216111502_add_artifacts_metadata_to_ci_build.rb +++ b/db/migrate/20151216111502_add_artifacts_metadata_to_ci_build.rb @@ -0,0 +1,5 @@+class AddArtifactsMetadataToCiBuild < ActiveRecord::Migration + def change + add_column :ci_builds, :artifacts_metadata, :text, limit: 4294967295 + end +end
Add artifacts metadata field to `ci_builds`
diff --git a/Formula/kdebase-runtime.rb b/Formula/kdebase-runtime.rb index abc1234..def5678 100644 --- a/Formula/kdebase-runtime.rb +++ b/Formula/kdebase-runtime.rb @@ -1,9 +1,9 @@ require 'formula' class KdebaseRuntime <Formula - url 'ftp://ftp.kde.org/pub/kde/stable/4.4.2/src/kdebase-runtime-4.4.2.tar.bz2' - homepage '' - md5 'd46fca58103624c28fcdf3fbd63262eb' + url 'ftp://ftp.kde.org/pub/kde/stable/4.5.2/src/kdebase-runtime-4.5.2.tar.bz2' + homepage 'http://www.kde.org/' + md5 '6503a445c52fc1055152d46fca56eb0a' depends_on 'cmake' => :build depends_on 'kde-phonon'
Update KDEBase Runtime to 1.4.0 and fix homepage.
diff --git a/lib/heroku_backup_orchestrator/error_reporter.rb b/lib/heroku_backup_orchestrator/error_reporter.rb index abc1234..def5678 100644 --- a/lib/heroku_backup_orchestrator/error_reporter.rb +++ b/lib/heroku_backup_orchestrator/error_reporter.rb @@ -15,18 +15,20 @@ end end - class EmailErrorReporter - Pony.options = { - :from => CONFIG['sendgrid']['from_email'], :to => CONFIG['sendgrid']['to_email'], - :subject => 'BACKUP ERROR', :via => :smtp, :via_options => { - :address => 'smtp.sendgrid.net', - :port => '25', - :authentication => :plain, - :user_name => ENV['SENDGRID_USERNAME'], - :password => ENV['SENDGRID_PASSWORD'], - :domain => ENV['SENDGRID_DOMAIN'] - } - } + class EmailErrorReporter + def initialize + Pony.options = { + :from => CONFIG['sendgrid']['from_email'], :to => CONFIG['sendgrid']['to_email'], + :subject => 'BACKUP ERROR', :via => :smtp, :via_options => { + :address => 'smtp.sendgrid.net', + :port => '25', + :authentication => :plain, + :user_name => ENV['SENDGRID_USERNAME'], + :password => ENV['SENDGRID_PASSWORD'], + :domain => ENV['SENDGRID_DOMAIN'] + } + } + end def report(error) body = %{
Move Pony configuration to initializer in EmailErrorReporter class Pony configuration would have blown up on application startup if SendGrid not configured in config.yaml
diff --git a/lib/vagrant-libvirt/action/set_name_of_domain.rb b/lib/vagrant-libvirt/action/set_name_of_domain.rb index abc1234..def5678 100644 --- a/lib/vagrant-libvirt/action/set_name_of_domain.rb +++ b/lib/vagrant-libvirt/action/set_name_of_domain.rb @@ -9,9 +9,10 @@ end def call(env) + require 'securerandom' env[:domain_name] = env[:root_path].basename.to_s.dup env[:domain_name].gsub!(/[^-a-z0-9_]/i, "") - env[:domain_name] << "_#{Time.now.to_i}" + env[:domain_name] << "_#{SecureRandom.hex}" # Check if the domain name is not already taken domain = ProviderLibvirt::Util::Collection.find_matching(
Use random string in name of domain
diff --git a/lib/yard/mruby/handlers/c/source/init_handler.rb b/lib/yard/mruby/handlers/c/source/init_handler.rb index abc1234..def5678 100644 --- a/lib/yard/mruby/handlers/c/source/init_handler.rb +++ b/lib/yard/mruby/handlers/c/source/init_handler.rb @@ -1,7 +1,7 @@ module YARD::MRuby::Handlers::C::Source class InitHandler < Base MATCH1 = /mrb_\w+_gem_init\s*\(/mx - MATCH2 = /mrb_init_\w\s*\(/mx + MATCH2 = /mrb_init_/mx handles MATCH1 handles MATCH2
Fix init for mruby core
diff --git a/config/initializers/bookable_slots.rb b/config/initializers/bookable_slots.rb index abc1234..def5678 100644 --- a/config/initializers/bookable_slots.rb +++ b/config/initializers/bookable_slots.rb @@ -2,6 +2,8 @@ EXCLUSIONS = [ Date.parse('29/05/2017'), Date.parse('28/08/2017'), + Date.parse('03/10/2017'), + Date.parse('04/10/2017'), Date.parse('25/12/2017'), Date.parse('26/12/2017') ].freeze
Exclude guider days from bookable slots There is a two day guider event occurring on these newly added days so we must ensure we display no booking availability during this time.
diff --git a/config/initializers/swagger_blocks.rb b/config/initializers/swagger_blocks.rb index abc1234..def5678 100644 --- a/config/initializers/swagger_blocks.rb +++ b/config/initializers/swagger_blocks.rb @@ -2,6 +2,11 @@ module ApiFlashcards include Swagger::Blocks + host = if ENV['RAILS_ENV'] == "production" + "https://mkdev-flashcards.herokuapp.com" + else + "localhost:3000" + end swagger_root do key :swagger, "2.0" info do @@ -15,7 +20,7 @@ tag do key :name, "Review" end - key :host, "localhost:3000" + key :host, "#{host}" key :basePath, "/api/v1" key :produces, ["application/json"] end
Add base hostname configuration for swagger initializer
diff --git a/minitest-stub-const.gemspec b/minitest-stub-const.gemspec index abc1234..def5678 100644 --- a/minitest-stub-const.gemspec +++ b/minitest-stub-const.gemspec @@ -1,13 +1,14 @@ Gem::Specification.new do |s| s.name = "minitest-stub-const" - s.version = 0.1 + s.version = 0.2 s.authors = ["Adam Mckaig"] s.email = ["adam.mckaig@gmail.com"] s.homepage = "https://github.com/adammck/minitest-stub-const" s.summary = "Stub constants for the duration of a block in MiniTest" + s.licenses = ["MIT"] - s.files = Dir.glob("lib/**/*") + s.files = Dir.glob("lib/**/*") + ["LICENSE", "README.md"] s.test_files = Dir.glob("test/**/*") s.require_paths = ["lib"] end
Add LICENSE and README to gem
diff --git a/lib/email/mboxrd/message.rb b/lib/email/mboxrd/message.rb index abc1234..def5678 100644 --- a/lib/email/mboxrd/message.rb +++ b/lib/email/mboxrd/message.rb @@ -21,8 +21,26 @@ @parsed ||= Mail.new(supplied_body) end + def best_from + if parsed.from.is_a? Enumerable + parsed.from.each do |addr| + if addr + return addr + end + end + end + if parsed.envelope_from + return parsed.envelope_from + end + if parsed.return_path + return parsed.return_path + end + + return '' + end + def from - parsed.from[0] + " " + asctime + best_from + " " + asctime end def mboxrd_body
Choose 'from' field from available headers. Fixes #46. If as single invalid 'from' address is given, Mail::from[0] is nil.
diff --git a/db/migrate/20151028235216_create_notes.rb b/db/migrate/20151028235216_create_notes.rb index abc1234..def5678 100644 --- a/db/migrate/20151028235216_create_notes.rb +++ b/db/migrate/20151028235216_create_notes.rb @@ -4,7 +4,7 @@ t.string :title t.text :body_html t.text :body_text - t.string :timestamps + t.timestamps end end end
Fix timestamp columns in notes.
diff --git a/app/helpers/photos_helper.rb b/app/helpers/photos_helper.rb index abc1234..def5678 100644 --- a/app/helpers/photos_helper.rb +++ b/app/helpers/photos_helper.rb @@ -1,55 +1,38 @@ module PhotosHelper def crop_image_path(crop, full_size: false) - if crop.default_photo.present? - photo = crop.default_photo - full_size ? photo.fullsize_url : photo.thumbnail_url + photo_or_placeholder(crop, full_size: full_size) + end + + def garden_image_path(garden, full_size: false) + photo_or_placeholder(garden, full_size: full_size) + end + + def planting_image_path(planting, full_size: false) + photo_or_placeholder(planting, full_size: full_size) + end + + def harvest_image_path(harvest, full_size: false) + photo_or_placeholder(harvest, full_size: full_size) + end + + def seed_image_path(seed, full_size: false) + photo_or_placeholder(seed, full_size: full_size) + end + + private + + def photo_or_placeholder(item, full_size: false) + if item.default_photo.present? + item_photo(item, full_size: full_size) else placeholder_image end end - def garden_image_path(garden, full_size: false) - if garden.default_photo.present? - photo = garden.default_photo - full_size ? photo.fullsize_url : photo.thumbnail_url - else - placeholder_image - end + def item_photo(item, full_size:) + photo = item.default_photo + full_size ? photo.fullsize_url : photo.thumbnail_url end - - def planting_image_path(planting, full_size: false) - if planting.photos.present? - photo = planting.photos.order(date_taken: :desc).first - full_size ? photo.fullsize_url : photo.thumbnail_url - else - placeholder_image - end - end - - def harvest_image_path(harvest, full_size: false) - if harvest.photos.present? - photo = harvest.photos.order(date_taken: :desc).first - full_size ? photo.fullsize_url : photo.thumbnail_url - elsif harvest.planting.present? - planting_image_path(harvest.planting, full_size: full_size) - else - placeholder_image - end - end - - def seed_image_path(seed, full_size: false) - if seed.default_photo.present? - photo = seed.default_photo - full_size ? photo.fullsize_url : photo.thumbnail_url - elsif seed.crop.default_photo.present? - photo = seed.crop.default_photo - full_size ? photo.fullsize_url : photo.thumbnail_url - else - placeholder_image - end - end - - private def placeholder_image 'placeholder_150.png'
Revert "Revert "DRY the photos helper"" This reverts commit 7f7f2cae47f3956d797456b626418e6fff49da14.
diff --git a/lib/bootstrap_haml_helpers/spec_view_helpers.rb b/lib/bootstrap_haml_helpers/spec_view_helpers.rb index abc1234..def5678 100644 --- a/lib/bootstrap_haml_helpers/spec_view_helpers.rb +++ b/lib/bootstrap_haml_helpers/spec_view_helpers.rb @@ -0,0 +1,21 @@+module BootstrapHamlHelpers + module SpecViewHelpers + def self.included(base) + base.class_eval do + helper BootstrapHamlHelpers::ApplicationHelper if respond_to?(:helper) + + before do + if respond_to?(:view) + BootstrapHamlHelpers::Component::Base.init_context(view) + view.stub(:set_page_title) + view.stub(:add_metatag) + end + end + + after do + BootstrapHamlHelpers::Component::Base.teardown_context if respond_to?(:view) + end + end + end + end +end
Add a library that can automatically add view helpers to view specs.
diff --git a/app/models/applicant_link.rb b/app/models/applicant_link.rb index abc1234..def5678 100644 --- a/app/models/applicant_link.rb +++ b/app/models/applicant_link.rb @@ -3,10 +3,15 @@ embedded_in :tax_household embedded_in :hbx_enrollment - embedded_in :eligibility_determinations + embedded_in :hbx_enrollment_exemption + embedded_in :eligibility_determination field :person_id, type: Moped::BSON::ObjectId + field :is_primary_applicant, type: Boolean field :is_active, type: Boolean, default: true + + field :is_ia_eligible, type: Boolean, default: false + field :is_medicaid_chip_eligible, type: Boolean, default: false def person=(person_instance) return unless person_instance.is_a? Person
Add insurance assistance eligibility attributes. Add HbxEnrollmentExemption as embedded parent.
diff --git a/lib/rabl/digestor/rails5.rb b/lib/rabl/digestor/rails5.rb index abc1234..def5678 100644 --- a/lib/rabl/digestor/rails5.rb +++ b/lib/rabl/digestor/rails5.rb @@ -1,31 +1,4 @@ module Rabl class Digestor < ActionView::Digestor - @@digest_monitor = Mutex.new - - def self.digest(name:, finder:, **options) - - options.assert_valid_keys(:dependencies, :partial) - - cache_key = ([ name ].compact + Array.wrap(options[:dependencies])).join('.') - - # this is a correctly done double-checked locking idiom - # (Concurrent::Map's lookups have volatile semantics) - finder.digest_cache[cache_key] || @@digest_monitor.synchronize do - finder.digest_cache.fetch(cache_key) do # re-check under lock - begin - # Prevent re-entry or else recursive templates will blow the stack. - # There is no need to worry about other threads seeing the +false+ value, - # as they will then have to wait for this thread to let go of the @@digest_monitor lock. - - pre_stored = finder.digest_cache.put_if_absent(cache_key, false).nil? # put_if_absent returns nil on insertion - - finder.digest_cache[cache_key] = stored_digest = Digestor.new(name, finder, options).digest - ensure - # something went wrong or ActionView::Resolver.caching? is false, make sure not to corrupt the @@cache - finder.digest_cache.delete_pair(cache_key, false) if pre_stored && !stored_digest - end - end - end - end end end
Revert "Revert "Fix problem of usage rabl 0.13.0 with Rails 5 and active cache""
diff --git a/lib/rails-html-sanitizer.rb b/lib/rails-html-sanitizer.rb index abc1234..def5678 100644 --- a/lib/rails-html-sanitizer.rb +++ b/lib/rails-html-sanitizer.rb @@ -34,6 +34,34 @@ def sanitizer_vendor Rails::Html::Sanitizer end + + if method_defined?(:sanitized_allowed_tags=) || private_method_defined?(:sanitized_allowed_tags=) + undef_method(:sanitized_allowed_tags=) + end + + # Replaces the allowed tags for the +sanitize+ helper. + # + # class Application < Rails::Application + # config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td' + # end + # + def sanitized_allowed_tags=(tags) + sanitizer_vendor.white_list_sanitizer.allowed_tags = tags + end + + if method_defined?(:sanitized_allowed_attributes=) || private_method_defined?(:sanitized_allowed_attributes=) + undef_method(:sanitized_allowed_attributes=) + end + + # Replaces the allowed HTML attributes for the +sanitize+ helper. + # + # class Application < Rails::Application + # config.action_view.sanitized_allowed_attributes = ['onclick', 'longdesc'] + # end + # + def sanitized_allowed_attributes=(attributes) + sanitizer_vendor.white_list_sanitizer.allowed_attributes = attributes + end end end end
Move default implementation to this gem
diff --git a/lib/rakuten_web_service/travel/search_result.rb b/lib/rakuten_web_service/travel/search_result.rb index abc1234..def5678 100644 --- a/lib/rakuten_web_service/travel/search_result.rb +++ b/lib/rakuten_web_service/travel/search_result.rb @@ -3,11 +3,6 @@ module RakutenWebService module Travel class SearchResult < RakutenWebService::SearchResult - def has_next_page? - false unless paging_info - paging_info['page'] && paging_info['page'] < paging_info['pageCount'] - end - def params_to_get_next_page @params.merge('page' => (paging_info['page'] + 1)) end
Remove duplicated definition of has_next_page?
diff --git a/lib/sinatra/activerecord.rb b/lib/sinatra/activerecord.rb index abc1234..def5678 100644 --- a/lib/sinatra/activerecord.rb +++ b/lib/sinatra/activerecord.rb @@ -59,6 +59,10 @@ # re-connect if database connection dropped ActiveRecord::Base.verify_active_connections! end + + app.after do + ActiveRecord::Base.clear_active_connections! + end end end
Clear active connections after each request
diff --git a/lib/stockboy/readers/csv.rb b/lib/stockboy/readers/csv.rb index abc1234..def5678 100644 --- a/lib/stockboy/readers/csv.rb +++ b/lib/stockboy/readers/csv.rb @@ -5,7 +5,7 @@ module Stockboy::Readers class CSV < Stockboy::Reader - dsl_attrs :skip_header_rows + dsl_attrs :skip_header_rows, :skip_footer_rows ::CSV::DEFAULT_OPTIONS.keys.each do |attr, opt| define_method attr do |*arg| @@ -19,6 +19,7 @@ @csv_options = opts.reject {|k,v| !::CSV::DEFAULT_OPTIONS.keys.include?(k) } @csv_options[:headers] = @csv_options.fetch(:headers, true) @skip_header_rows = 0 + @skip_footer_rows = 0 instance_eval(&block) if block_given? end @@ -34,8 +35,19 @@ def sanitize(data) data.force_encoding(encoding) if encoding - data.sub(/(.*\n){#@skip_header_rows}/, '') + data.encode! universal_newline: true + data.chomp! + from = row_start_index(data, skip_header_rows) + to = row_end_index(data, skip_footer_rows) + data[from..to] end + def row_start_index(data, skip_rows) + Array.new(skip_rows).inject(0) { |i| data.index(/$/, i) + 1 } + end + + def row_end_index(data, skip_rows) + Array.new(skip_rows).inject(-1) { |i| data.rindex(/$/, i) - 1 } + end end end
Add option for CSV skip_footer_rows
diff --git a/lib/vmdb/console_methods.rb b/lib/vmdb/console_methods.rb index abc1234..def5678 100644 --- a/lib/vmdb/console_methods.rb +++ b/lib/vmdb/console_methods.rb @@ -12,16 +12,27 @@ ActiveRecord::Base.logger.level == 0 ? disable_console_sql_logging : enable_console_sql_logging end + def with_console_sql_logging_level(level) + old_level = ActiveRecord::Base.logger.level + ActiveRecord::Base.logger.level = level + yield + ensure + ActiveRecord::Base.logger.level = old_level + end + def backtrace(include_external = false) caller.select { |path| include_external || path.start_with?(Rails.root.to_s) } end # Development helper method for Rails console for simulating queue workers. - def simulate_queue_worker(break_on_complete = false) + def simulate_queue_worker(break_on_complete: false, quiet_polling: true) raise NotImplementedError, "not implemented in production mode" if Rails.env.production? loop do - q = MiqQueue.where(MiqQueue.arel_table[:queue_name].not_eq("miq_server")).order(:id).first + q = with_console_sql_logging_level(quiet_polling ? 1 : ActiveRecord::Base.logger.level) do + MiqQueue.where(MiqQueue.arel_table[:queue_name].not_eq("miq_server")).order(:id).first + end if q + puts "\e[33;1m\n** Delivering #{MiqQueue.format_full_log_msg(q)}\n\e[0;m" status, message, result = q.deliver q.delivered(status, message, result) unless status == MiqQueue::STATUS_RETRY else
Change simulate_queue_worker for quiet polling
diff --git a/test/integration/default/default_test.rb b/test/integration/default/default_test.rb index abc1234..def5678 100644 --- a/test/integration/default/default_test.rb +++ b/test/integration/default/default_test.rb @@ -5,6 +5,6 @@ # The Inspec reference, with examples and extensive documentation, can be # found at http://inspec.io/docs/reference/resources/ -describe file('C:\Program Files (x86)\Atlassian\SourceTree\SourceTree.exe') do +describe file('C:\Users\vagrant\AppData\Local\SourceTree\app-2.0.20.1\SourceTree.exe') do it { should be_file } end
Update InSpec test to new exe location
diff --git a/config/software/berkshelf-no-depselector.rb b/config/software/berkshelf-no-depselector.rb index abc1234..def5678 100644 --- a/config/software/berkshelf-no-depselector.rb +++ b/config/software/berkshelf-no-depselector.rb @@ -37,7 +37,7 @@ bundle "install" \ " --jobs #{workers}" \ - " --without guard changelog development test", env: env + " --without changelog docs development", env: env bundle "exec thor gem:build", env: env
Update berks gemfile groups to match reality Add docs Remove guardfile / test which aren't there Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/Casks/intellij-idea-community-eap.rb b/Casks/intellij-idea-community-eap.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea-community-eap.rb +++ b/Casks/intellij-idea-community-eap.rb @@ -1,7 +1,7 @@ class IntellijIdeaCommunityEap < Cask - url 'http://download.jetbrains.com/idea/ideaIC-135.863.dmg' + url 'http://download.jetbrains.com/idea/ideaIC-138.777.dmg' homepage 'https://www.jetbrains.com/idea/index.html' - version '135.863' - sha256 '623aac77c3fea84ca6677d5777f7c1c72e3cd5b0ba680d3a465452767e78db89' - link 'IntelliJ IDEA 13 CE EAP.app' + version '138.777' + sha256 '9614d8055051dc418bce905587c33b3d30e164d1eb873d3716b613627a2c52a2' + link 'IntelliJ IDEA 14 CE EAP.app' end
Upgrade IntelliJ CE EAP to version 14 (build 138.777). The version was `135.863`. http://confluence.jetbrains.com/display/IDEADEV/IDEA+14+EAP http://blog.jetbrains.com/idea/2014/06/intellij-idea-14-early-preview-is-available/
diff --git a/plugins/cats.rb b/plugins/cats.rb index abc1234..def5678 100644 --- a/plugins/cats.rb +++ b/plugins/cats.rb @@ -6,13 +6,9 @@ ) def self.on_message(message, matches) - reddit = "http://www.reddit.com/r/cats.json" catstreamer = "http://catstreamer.herokuapp.com/cats.json" doc = ActiveSupport::JSON.decode(open(catstreamer).read) url = doc["catpic"] - #url = doc["data"]["children"][rand(doc["data"]["children"].length)]["data"]["url"] - msg = "cats" - msg url end
Remove lines of test code
diff --git a/app/sweepers/person_sweeper.rb b/app/sweepers/person_sweeper.rb index abc1234..def5678 100644 --- a/app/sweepers/person_sweeper.rb +++ b/app/sweepers/person_sweeper.rb @@ -9,7 +9,9 @@ def expire_stream_items(record) record.stream_items.all.each do |stream_item| - stream_item.expire_caches + #stream_item.expire_caches # very inefficient; let's just expire them all instead + ActionController::Base.cache_store.delete_matched(%r{groups/\d+\?fragment=stream_items}) + ActionController::Base.cache_store.delete_matched(%r{stream\?for=\d+&fragment=stream_items}) end end
Expire stream item caches more quickly. This expires all stream item fragments rather than targeted ones, but gets the user on with their task more quickly. Expiring individual stream item caches was taking too long.
diff --git a/app/models/category.rb b/app/models/category.rb index abc1234..def5678 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -31,11 +31,11 @@ scope :by_position, -> { order(position: :asc) } def self.models_name - [:Home, :About, :Contact] + [:Home, :About, :Contact, :Search] end def self.models_name_str - %w( Home About Contact ) + %w( Home About Contact Search) end def self.title_by_category(category)
Add Search option for categories
diff --git a/app/models/api_query.rb b/app/models/api_query.rb index abc1234..def5678 100644 --- a/app/models/api_query.rb +++ b/app/models/api_query.rb @@ -16,16 +16,7 @@ # disable STI self.inheritance_column = :_type_disabled - def self.log!(options) - query = options.delete(:query) - scraper = options.delete(:scraper) - owner = options.delete(:owner) - benchmark = options.delete(:benchmark) - size = options.delete(:size) - type = options.delete(:type) - format = options.delete(:format) - raise "Invalid options" unless options.empty? - + def self.log!(query:, scraper:, owner:, benchmark:, size:, type:, format:) ApiQuery.create!( query: query, scraper_id: scraper.id, owner_id: owner.id, utime: (benchmark.cutime + benchmark.utime),
Use keyword arguments to simplify code
diff --git a/app/models/interface.rb b/app/models/interface.rb index abc1234..def5678 100644 --- a/app/models/interface.rb +++ b/app/models/interface.rb @@ -25,7 +25,8 @@ end def slides - current_sidebar_item.slides.includes(:description).ordered + current_sidebar_item.slides.includes(:area_dependency). + includes(:description).ordered.reject(&:area_dependent) end def current_slide
Hide slides which have an area-dependency Closes #1508
diff --git a/load_puzzle.rb b/load_puzzle.rb index abc1234..def5678 100644 --- a/load_puzzle.rb +++ b/load_puzzle.rb @@ -1,6 +1,17 @@ #! /usr/bin/env ruby -I. require 'puzloader' +require 'grid' + +def debug_loader(loader) + puts "Texts:\n #{loader.title}\n #{loader.author}\n #{loader.copyright}" + puts "\nDimensions: #{loader.width} x #{loader.height}" + print "\nRows:\n ", loader.rows.join("\n "), "\n" + print "\nClues:\n ", loader.clues.join("\n "), "\n" +end filename = ARGV[0] || 'Puzzles/2014-4-22-LosAngelesTimes.puz' -loader = PuzzleLoader.new(filename, :debug) +loader = PuzzleLoader.new(filename) +debug_loader(loader) + +grid = Grid.new(loader.rows, loader.clues)
Add debugging function to show loaded values.
diff --git a/event_store-client-http.gemspec b/event_store-client-http.gemspec index abc1234..def5678 100644 --- a/event_store-client-http.gemspec +++ b/event_store-client-http.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'event_store-client-http' - s.version = '0.1.0.0' + s.version = '0.1.1.0' s.summary = 'HTTP Client for EventStore' s.description = ' '
Package version is increased from 0.1.0.0 to 0.1.1.0
diff --git a/app/mailers/protected_record_manager/change_request_mailer.rb b/app/mailers/protected_record_manager/change_request_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/protected_record_manager/change_request_mailer.rb +++ b/app/mailers/protected_record_manager/change_request_mailer.rb @@ -2,11 +2,10 @@ class ChangeRequestMailer < ActionMailer::Base default from: ProtectedRecordManager::Configuration.default_from - def notify(user, change_request) - @user = user + def notify(users, change_request) @url = change_request_url(change_request) mail({ - to: user.email, + to: users.collect(&:email).join(","), subject: "New Change Request from #{change_request.user.email}" }) end
Send one email to all users (not indiv. email to each user)
diff --git a/lib/queri/realtime/calls.rb b/lib/queri/realtime/calls.rb index abc1234..def5678 100644 --- a/lib/queri/realtime/calls.rb +++ b/lib/queri/realtime/calls.rb @@ -14,12 +14,13 @@ :queue, "Queue &nbsp;", :clid, "Caller &nbsp;", :time_call_entered_queue, "Entered &nbsp;", + :time_in_ivr, "IVR", :time_call_on_wait, "Waiting &nbsp;", :call_duration, "Duration &nbsp;", :agent, "Agent &nbsp;", :music_on_hold, "MOH", :server, "Srv", - :magic_wand, "&nbsp;" + :magic_wand, "&nbsp;", ] end end
Add missing key to Realtime::Call class
diff --git a/lib/rack/adapter/camping.rb b/lib/rack/adapter/camping.rb index abc1234..def5678 100644 --- a/lib/rack/adapter/camping.rb +++ b/lib/rack/adapter/camping.rb @@ -9,6 +9,12 @@ env["PATH_INFO"] ||= "" env["SCRIPT_NAME"] ||= "" controller = @app.run(env['rack.input'], env) + h = controller.headers + h.each_pair do |k,v| + if v.kind_of? URI + h[k] = v.to_s + end + end [controller.status, controller.headers, controller.body] end end
Fix Camping redirects into Strings when they're URIs darcs-hash:20070304022942-92d64-8ba8f4966041c11d53bfdd2fd356d2435808e914.gz
diff --git a/lib/radbeacon/le_scanner.rb b/lib/radbeacon/le_scanner.rb index abc1234..def5678 100644 --- a/lib/radbeacon/le_scanner.rb +++ b/lib/radbeacon/le_scanner.rb @@ -7,9 +7,27 @@ @duration = duration end + def scan_command + rout, wout = IO.pipe + scan_command_str = "sudo hcitool lescan" + pid = Process.spawn(scan_command_str, :out => wout) + begin + Timeout.timeout(@duration) do + Process.wait(pid) + end + rescue Timeout::Error + puts 'Scan process not finished in time, killing it' + Process.kill('INT', pid) + end + wout.close + scan_output = rout.readlines.join("") + rout.close + scan_output + end + def passive_scan devices = Array.new - scan_output = `sudo hcitool lescan & sleep #{@duration}; sudo kill -2 $!` + scan_output = self.scan_command scan_output.each_line do |line| result = line.scan(/^([A-F0-9:]{15}[A-F0-9]{2}) (.*)$/) if !result.empty?
Monitor lescan process and kill it after timeout
diff --git a/lib/redisse/server/redis.rb b/lib/redisse/server/redis.rb index abc1234..def5678 100644 --- a/lib/redisse/server/redis.rb +++ b/lib/redisse/server/redis.rb @@ -12,7 +12,7 @@ end def ensure_pubsub - return if @pubsub + return if defined? @pubsub @pubsub = redis.pubsub @pubsub_errbacks = [] @pubsub.on(:disconnected, &method(:on_redis_close))
Remove warning "instance variable not initialized"
diff --git a/lib/relish/commands/push.rb b/lib/relish/commands/push.rb index abc1234..def5678 100644 --- a/lib/relish/commands/push.rb +++ b/lib/relish/commands/push.rb @@ -20,10 +20,7 @@ resource = RestClient::Resource.new(url) resource.post(tar_gz_data, :content_type => 'application/x-gzip') puts "sent:\n#{files.join("\n")}" - rescue RestClient::ResourceNotFound, - RestClient::Unauthorized, - RestClient::BadRequest => exception - + rescue RestClient::Exception => exception warn exception.response exit 1 end
Simplify error handling so we catch every bad response
diff --git a/lib/roar/rails/test_case.rb b/lib/roar/rails/test_case.rb index abc1234..def5678 100644 --- a/lib/roar/rails/test_case.rb +++ b/lib/roar/rails/test_case.rb @@ -1,8 +1,4 @@-if ::ActionPack::VERSION::MAJOR == 4 - require 'test_xml/mini_test' -else - require 'test_xml/test_unit' -end +require 'minitest' module Roar module Rails
Make Roar::Rails::TestCase always require minitest Signed-off-by: Alex Coles <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexbcoles.com>
diff --git a/lib/ropian/meter/raritan.rb b/lib/ropian/meter/raritan.rb index abc1234..def5678 100644 --- a/lib/ropian/meter/raritan.rb +++ b/lib/ropian/meter/raritan.rb @@ -0,0 +1,27 @@+module Ropian + module Meter + class Raritan + def inspect + "#<#{self.class} #{@manager.host}@#{@manager.community}>" + end + def initialize(ip_addr, community, version = :SNMPv2c) + @manager = SNMP::Manager.new(:Host => ip_addr, + :Community => community, :Version => version) + end + # MilliAmps in total on whole bar + def total_amps + oid = SNMP::ObjectId.new("1.3.6.1.4.1.13742.4.1.4.2.1.3.1") + amps_for_oid(oid) + end + # MilliAmps per port + def amps(port_index) + oid = SNMP::ObjectId.new("1.3.6.1.4.1.13742.4.1.2.2.1.4") + port_index + amps_for_oid(oid) + end + protected + def amps_for_oid(oid) + @manager.get(oid).varbind_list.first.value.to_f + end + end + end +end
Add Raritan power metering module
diff --git a/spec/scanny/checks/http_basic_auth_check_spec.rb b/spec/scanny/checks/http_basic_auth_check_spec.rb index abc1234..def5678 100644 --- a/spec/scanny/checks/http_basic_auth_check_spec.rb +++ b/spec/scanny/checks/http_basic_auth_check_spec.rb @@ -0,0 +1,20 @@+require "spec_helper" + +module Scanny::Checks + describe HTTPBasicAuthCheck do + before do + @runner = Scanny::Runner.new(HTTPBasicAuthCheck.new) + @message = "Basic HTTP authentication can lead to security problems" + @issue = issue(:info, @message, [301, 718]) + end + + it "reports \"Net::HTTPHeader#basic_auth'\" correctly" do + @runner.should check("basic_auth('user', 'password')").with_issue(@issue) + @runner.should check("basic_auth").without_issues + end + + it "reports \"HttpAuthentication\" correctly" do + @runner.should check("HttpAuthentication").with_issue(@issue) + end + end +end
Add specs for HTTP basic auth
diff --git a/db/migrate/20120913135745_add_updated_at_index_to_public_body_versions.rb b/db/migrate/20120913135745_add_updated_at_index_to_public_body_versions.rb index abc1234..def5678 100644 --- a/db/migrate/20120913135745_add_updated_at_index_to_public_body_versions.rb +++ b/db/migrate/20120913135745_add_updated_at_index_to_public_body_versions.rb @@ -0,0 +1,9 @@+class AddUpdatedAtIndexToPublicBodyVersions < ActiveRecord::Migration + def self.up + add_index :public_body_versions, :updated_at + end + + def self.down + remove_index :public_body_versions, :updated_at + end +end
Add index on updated_at to public body versions as this is how they are retrieved in the admin timeline view.
diff --git a/spec/peg_spec.rb b/spec/peg_spec.rb index abc1234..def5678 100644 --- a/spec/peg_spec.rb +++ b/spec/peg_spec.rb @@ -20,4 +20,12 @@ expect(peg1 == peg2).to be true end end + + describe 'arrays of pegs' do + let(:array1) {[Peg.new("red"), Peg.new("orange"), Peg.new("yellow")]} + let(:array2) {[Peg.new("green"), Peg.new("red"), Peg.new("yellow")]} + it 'returns two items when we take the intersection' do + expect((array1 & array2).length).to eq 2 + end + end end
Add test for intersection of arrays of Pegs
diff --git a/lib/encapsulate_as_money.rb b/lib/encapsulate_as_money.rb index abc1234..def5678 100644 --- a/lib/encapsulate_as_money.rb +++ b/lib/encapsulate_as_money.rb @@ -3,7 +3,12 @@ require 'active_support/core_ext/array/extract_options' def Money(cents) - cents.is_a?(String) ? cents.gsub(',', '').to_money : Money.new(cents) + if cents.is_a? String + warn "[DEPRECATION] Money(String) is deprecated. Please use Money.parse(String) instead. (#{Kernel.caller.first})" + Money.parse(cents.gsub(',', '')) + else + Money.new(cents) + end end class Money
Add a deprecation warning to Money(String)
diff --git a/lib/faraday/raise_errors.rb b/lib/faraday/raise_errors.rb index abc1234..def5678 100644 --- a/lib/faraday/raise_errors.rb +++ b/lib/faraday/raise_errors.rb @@ -4,17 +4,17 @@ env[:response].on_complete do |response| case response[:status].to_i when 400 - raise Twitter::RateLimitExceeded, "(#{response[:status]}): #{response[:body]}" + raise Twitter::RateLimitExceeded, "#{response[:body]['error'] if response[:body]}" when 401 - raise Twitter::Unauthorized, "(#{response[:status]}): #{response[:body]}" + raise Twitter::Unauthorized, "#{response[:body]['error'] if response[:body]}" when 403 - raise Twitter::General, "(#{response[:status]}): #{response[:body]}" + raise Twitter::General, "#{response[:body]['error'] if response[:body]}" when 404 - raise Twitter::NotFound, "(#{response[:status]}): #{response[:body]}" + raise Twitter::NotFound, "#{response[:body]['error'] if response[:body]}" when 500 - raise Twitter::InformTwitter, "Twitter had an internal error. Please let them know in the group. (#{response[:status]}): #{response[:body]}" + raise Twitter::InformTwitter, "#{response[:body]['error'] if response[:body]}" when 502..503 - raise Twitter::Unavailable, "(#{response[:status]}): #{response[:body]}" + raise Twitter::Unavailable, "#{response[:body]['error'] if response[:body]}" end end end
Standardize format of error messages
diff --git a/lib/fourchette/pgbackups.rb b/lib/fourchette/pgbackups.rb index abc1234..def5678 100644 --- a/lib/fourchette/pgbackups.rb +++ b/lib/fourchette/pgbackups.rb @@ -20,13 +20,13 @@ private def ensure_pgbackups_is_present(heroku_app_name) - unless existing_backups? + unless existing_backups?(heroku_app_name) logger.info "Adding pgbackups to #{heroku_app_name}" @heroku.client.addon.create(heroku_app_name, { plan: 'pgbackups' }) end end - def existing_backups? + def existing_backups?(heroku_app_name) @heroku.client.addon.list(heroku_app_name).select do |addon| addon['name'] == 'pgbackups' end.any?
Fix undefined method heroku_app_name issue
diff --git a/app/views/course/assessment/submission/submissions/_submission.json.jbuilder b/app/views/course/assessment/submission/submissions/_submission.json.jbuilder index abc1234..def5678 100644 --- a/app/views/course/assessment/submission/submissions/_submission.json.jbuilder +++ b/app/views/course/assessment/submission/submissions/_submission.json.jbuilder @@ -5,7 +5,8 @@ if assessment.autograded? question = assessment.questions.next_unanswered(submission) - json.maxStep assessment.questions.index(question) + # If question does not exist, means the student have answered all questions + json.maxStep question ? assessment.questions.index(question) : assessment.questions.length - 1 end # Show submission as submitted to students if grading is not published yet
Return questions length as the maxStep if student have answered all questions * Fixes a bug that navigation buttons greyed out in student view
diff --git a/lib/rove/vagrant_setting.rb b/lib/rove/vagrant_setting.rb index abc1234..def5678 100644 --- a/lib/rove/vagrant_setting.rb +++ b/lib/rove/vagrant_setting.rb @@ -32,7 +32,7 @@ def configure(values) @output = "" unless @config - @output = @config.call *values + @output = @config.call *values if @config end def ensure_option!(parent, id, package, &block)
Save calling method on nil if no config set
diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index abc1234..def5678 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -10,8 +10,13 @@ def create p params - # user = User.find(params[:user_id]) - # @asset = user.assets.create!(asset_params) + user = User.find(params[:user_id]) + @asset = user.assets.new(asset_params) + @asset.experience_id = user.experiences.first.id # Lol hack + @asset.save + respond_to do |format| + format.js { render nothing: true } + end # redirect_to "/users/#{user.id}/assets" end @@ -33,7 +38,7 @@ private def asset_params - params.require(:asset).permit(:direct_upload_url) + params.require(:asset).permit(:direct_upload_url, :caption) end def set_s3_direct_post
Add functionality to persist asset to the database
diff --git a/templates/root_controller_spec.rb b/templates/root_controller_spec.rb index abc1234..def5678 100644 --- a/templates/root_controller_spec.rb +++ b/templates/root_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe RootController do +describe RootController, :type => :controller do describe "GET 'index'" do it "returns http success" do
[FIX] Test for root controller in generated new app
diff --git a/test/functional/test_starscope.rb b/test/functional/test_starscope.rb index abc1234..def5678 100644 --- a/test/functional/test_starscope.rb +++ b/test/functional/test_starscope.rb @@ -12,22 +12,23 @@ end def test_version - assert `#{BASE} -v`.chomp == StarScope::VERSION + assert_equal StarScope::VERSION, `#{BASE} -v`.chomp end def test_summary - lines = `#{EXTRACT} -s`.lines + lines = `#{EXTRACT} -s`.lines.to_a + assert_equal lines.length, 6 end def test_dump lines = `#{EXTRACT} -d requires`.lines.to_a - assert lines[1].split.first == 'date' - assert lines[2].split.first == 'zlib' + assert_equal 'date', lines[1].split.first + assert_equal 'zlib', lines[2].split.first end def test_query `#{EXTRACT} -q calls,add_file`.each_line do |line| - assert line.split[0..2] == ["StarScope", "DB", "add_file"] + assert_equal ["StarScope", "DB", "add_file"], line.split[0..2] end end
Make test_summary actually test something Also use better assertions, generally
diff --git a/Casks/join-together.rb b/Casks/join-together.rb index abc1234..def5678 100644 --- a/Casks/join-together.rb +++ b/Casks/join-together.rb @@ -1,11 +1,11 @@ cask :v1 => 'join-together' do - version '7.5.0' - sha256 'a6661c05b73fff78e1fcfc4e474e95f732ccc996a5bbae56f390e51a414e6867' + version '7.5.1' + sha256 '116365cb1dae0b3c3a00a90f357e1d154767e6d866e5e18cd32ab3d3f7698d30' url "http://dougscripts.com/itunes/scrx/jointogether#{version.delete('.')}.zip" name 'Join Together' appcast 'http://dougscripts.com/itunes/itinfo/jointogether_appcast.xml', - :sha256 => '4265e5826859579304b51216b5b675e853b25fda0b1293565a79ff8352a7e363' + :sha256 => '1522384c632e3336f4f3ffe3245135f9f7a7718619e564064139c45ad285ee5b' homepage 'http://dougscripts.com/itunes/itinfo/jointogether.php' license :commercial
Update Join Together to 7.5.1
diff --git a/app/models/actions/merge_diseases.rb b/app/models/actions/merge_diseases.rb index abc1234..def5678 100644 --- a/app/models/actions/merge_diseases.rb +++ b/app/models/actions/merge_diseases.rb @@ -11,14 +11,30 @@ private def execute move_evidence_items + move_assertions + update_source_suggestions combine_aliases disease_to_remove.destroy end def move_evidence_items - disease_to_remove.evidence_items.each do |ei| + EvidenceItem.unscoped.where(disease_id: disease_to_remove.id).each do |ei| ei.disease = disease_to_keep ei.save! + end + end + + def move_assertions + disease_to_remove.assertions.each do |a| + a.disease = disease_to_keep + a.save! + end + end + + def update_source_suggestions + SourceSuggestion.where(disease_name: disease_to_remove.name).each do |s| + s.disease_name = disease_to_keep.name + s.save! end end
Fix merge diseases utility to also update assertions and source suggestions
diff --git a/lib/vagrant/hosts/fedora.rb b/lib/vagrant/hosts/fedora.rb index abc1234..def5678 100644 --- a/lib/vagrant/hosts/fedora.rb +++ b/lib/vagrant/hosts/fedora.rb @@ -23,7 +23,21 @@ def initialize(*args) super + release_file = Pathname.new("/etc/redhat-release") + @nfs_server_binary = "/etc/init.d/nfs" + + if release_file.exist? + release_file.open("r") do |f| + version_number = /Fedora release ([0-9]+)/.match(f.gets)[1].to_i + if version_number >= 17 + # For now, "service nfs-server" will redirect properly to systemctl + # when "service nfs-server restart" is called. + @nfs_server_binary = "/usr/sbin/service nfs-server" + end + end + end + end end end
Add Fedora 17+ NFS support.
diff --git a/test/test_browse_node_resource.rb b/test/test_browse_node_resource.rb index abc1234..def5678 100644 --- a/test/test_browse_node_resource.rb +++ b/test/test_browse_node_resource.rb @@ -4,7 +4,7 @@ require "petitest/spec" require "rapa" -class TestItemResource < Petitest::Test +class TestBrowseNodeResource < Petitest::Test extend ::Petitest::Spec prepend ::Petitest::PowerAssert
Fix wrong test class name
diff --git a/app/views/api/v1/statuses/_show.rabl b/app/views/api/v1/statuses/_show.rabl index abc1234..def5678 100644 --- a/app/views/api/v1/statuses/_show.rabl +++ b/app/views/api/v1/statuses/_show.rabl @@ -1,4 +1,3 @@-cache attributes :id, :created_at, :in_reply_to_id node(:uri) { |status| TagManager.instance.uri_for(status) }
Disable caching of statuses (maybe this will help with the weird bug)
diff --git a/lib/elastic_record/relation/delegation.rb b/lib/elastic_record/relation/delegation.rb index abc1234..def5678 100644 --- a/lib/elastic_record/relation/delegation.rb +++ b/lib/elastic_record/relation/delegation.rb @@ -15,10 +15,10 @@ end def method_missing(method, *args, &block) - if klass.respond_to?(method) + if Array.method_defined?(method) + to_a.send(method, *args, &block) + elsif klass.respond_to?(method) scoping { klass.send(method, *args, &block) } - elsif Array.method_defined?(method) - to_a.send(method, *args, &block) else super end
Choose array methods before class methods
diff --git a/lib/generators/pinkman/model_generator.rb b/lib/generators/pinkman/model_generator.rb index abc1234..def5678 100644 --- a/lib/generators/pinkman/model_generator.rb +++ b/lib/generators/pinkman/model_generator.rb @@ -38,15 +38,15 @@ end def app_name - Rails.application.class.parent_name + 'App' end def app_object_name - app_name.camelize + 'Object' + app_name + 'Object' end def app_collection_name - app_name.camelize + 'Collection' + app_name + 'Collection' end end
Change "If" method and change class name of generators
diff --git a/recipes/windows_service.rb b/recipes/windows_service.rb index abc1234..def5678 100644 --- a/recipes/windows_service.rb +++ b/recipes/windows_service.rb @@ -21,5 +21,6 @@ return unless platform? 'windows' service 'WinRM' do + run_as_user 'NT AUTHORITY\NetworkService' action [:enable, :start] end
Add run_as_user to service resource to work on Chef 14 On Chef 14 windows_service resource defaults to LocalSystem as a user account. So explicitly set user parameter as WinRM uses NetworkService account. Signed-off-by: d0be23622f2c81b0b5520bcd644f49a9b7446587@gmail.com
diff --git a/Formula/berkeley-db.rb b/Formula/berkeley-db.rb index abc1234..def5678 100644 --- a/Formula/berkeley-db.rb +++ b/Formula/berkeley-db.rb @@ -21,6 +21,10 @@ "--enable-java" system "make install" + + # use the standard docs location + doc.parent.mkpath + mv prefix+'docs', doc end end end
Install bdb docs to correct location
diff --git a/lib/jess/http_client/logging_decorator.rb b/lib/jess/http_client/logging_decorator.rb index abc1234..def5678 100644 --- a/lib/jess/http_client/logging_decorator.rb +++ b/lib/jess/http_client/logging_decorator.rb @@ -17,22 +17,13 @@ log_response(response, req.uri) response rescue Error => e - log_exception(e) if logger + logger.error(e.to_s) if logger raise end private attr_reader :logger - - def log_exception(err) - if err.cause - logger.error(err.to_s) - logger.error(err.cause) - else - logger.error(err) - end - end def log_request(req) logger.debug { "#{req.method} #{req.uri}" }
Revert "More detailed error logging" This reverts commit ea07e3b33312a17f6fd0f8e0ff54b358dd45278f.
diff --git a/indexer/lib/patches/patch_loyalty_symbol.rb b/indexer/lib/patches/patch_loyalty_symbol.rb index abc1234..def5678 100644 --- a/indexer/lib/patches/patch_loyalty_symbol.rb +++ b/indexer/lib/patches/patch_loyalty_symbol.rb @@ -3,8 +3,10 @@ def call each_printing do |card| next unless (card["types"] || []).include?("Planeswalker") - card["originalText"] = card["originalText"].gsub(%r[^([\+\-\−]?(?:\d+|X)):]) { "[#{$1}]:" } # hack to fix all planeswalkers showing up in is:errata card["text"] = card["text"].gsub(%r[^([\+\-\−]?(?:\d+|X)):]) { "[#{$1}]:" } + if card.key?("originalText") + card["originalText"] = card["originalText"].gsub(%r[^([\+\-\−]?(?:\d+|X)):]) { "[#{$1}]:" } # hack to fix all planeswalkers showing up in is:errata + end end end end
Fix PatchLoyaltySymbol for planeswalkers without originalText
diff --git a/GTHRectHelpers.podspec b/GTHRectHelpers.podspec index abc1234..def5678 100644 --- a/GTHRectHelpers.podspec +++ b/GTHRectHelpers.podspec @@ -12,7 +12,7 @@ s.summary = "Utility macros for working with CGRect, CGSize, CGPoint etc..." s.homepage = "http://github.com/goodtohear/GTHRectHelpers" - s.license = 'MIT (example)' + s.license = 'MIT' s.author = { "Michael Forrest" => "michael.forrest@gmail.com" } s.source = { :git => "https://github.com/goodtohear/GTHRectHelpers.git", :tag => "0.0.1" }
Update license to make it work again
diff --git a/lib/staff_plan/staff_plan_form_builder.rb b/lib/staff_plan/staff_plan_form_builder.rb index abc1234..def5678 100644 --- a/lib/staff_plan/staff_plan_form_builder.rb +++ b/lib/staff_plan/staff_plan_form_builder.rb @@ -1,6 +1,6 @@ class StaffPlanFormBuilder < ActionView::Helpers::FormBuilder - %w[text_field text_area password_field check_box].each do |method_name| + %w[text_field text_area password_field check_box select].each do |method_name| define_method(method_name) do |field_name, *args| @template.content_tag :div, :class => "input" do label(field_name) + super(field_name, *args)
update: Add select to form builder
diff --git a/puppy_play_date/app/models/dog.rb b/puppy_play_date/app/models/dog.rb index abc1234..def5678 100644 --- a/puppy_play_date/app/models/dog.rb +++ b/puppy_play_date/app/models/dog.rb @@ -5,4 +5,12 @@ has_one :photo validates :name, :breed, :age, presence: true + + def avatar + self.photo.url + end + + def as_json(options = {}) + super(options.merge(methods: :avatar)) + end end
Add avatar method to Dog model to return the Dog photo's url
diff --git a/lib/active_record/typed_store/typed_hash.rb b/lib/active_record/typed_store/typed_hash.rb index abc1234..def5678 100644 --- a/lib/active_record/typed_store/typed_hash.rb +++ b/lib/active_record/typed_store/typed_hash.rb @@ -47,7 +47,7 @@ def cast_value(key, value) key = convert_key(key) column = columns[key] - return value unless columns + return value unless column casted_value = column.cast(value)
Fix typo on return value
diff --git a/recipes/replication.rb b/recipes/replication.rb index abc1234..def5678 100644 --- a/recipes/replication.rb +++ b/recipes/replication.rb @@ -1,3 +1,5 @@+require 'shellwords' + passwords = EncryptedPasswords.new(node, node["percona"]["encrypted_data_bag"]) replication_sql = "/etc/mysql/replication.sql" server = node.percona.server @@ -16,17 +18,11 @@ end end -# execute access grants -if passwords.root_password && !passwords.root_password.empty? - execute "mysql-set-replication" do - command "/usr/bin/mysql -p'#{passwords.root_password}' -e '' &> /dev/null > /dev/null &> /dev/null ; if [ $? -eq 0 ] ; then /usr/bin/mysql -p'#{passwords.root_password}' < /etc/mysql/replication.sql ; else /usr/bin/mysql < /etc/mysql/replication.sql ; fi ;" # rubocop:disable LineLength - action :nothing - subscribes :run, resources("template[#{replication_sql}]"), :immediately - end -else - execute "mysql-set-replication" do - command "/usr/bin/mysql < /etc/mysql/replication.sql" - action :nothing - subscribes :run, resources("template[#{replication_sql}]"), :immediately - end +root_pass = passwords.root_password.to_s +root_pass = Shellwords.escape(root_pass).prepend('-p') unless root_pass.empty? + +execute "mysql-set-replication" do + command "/usr/bin/mysql #{root_pass} < /etc/mysql/replication.sql" + action :nothing + subscribes :run, resources("template[/etc/mysql/replication.sql]"), :immediately end
Simplify password usage for mysql client
diff --git a/rails_translation_manager.gemspec b/rails_translation_manager.gemspec index abc1234..def5678 100644 --- a/rails_translation_manager.gemspec +++ b/rails_translation_manager.gemspec @@ -18,9 +18,10 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_dependency "activesupport" + spec.add_dependency "csv", "~> 3.2" + spec.add_dependency "i18n-tasks" spec.add_dependency "rails-i18n" - spec.add_dependency "activesupport" - spec.add_dependency "i18n-tasks" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 10.0"
Define version of CSV gem Without this defined, Jenkins was using the CSV version stored on the CI machine (3.0.9), which is incompatible with the changes made to remove byte order marks in earlier commits. Defining the version (3.2 -> 4.0) means we can ensure the CSV version is compatible with the code across our environments.
diff --git a/cmd/brew-squash-bottle-pr.rb b/cmd/brew-squash-bottle-pr.rb index abc1234..def5678 100644 --- a/cmd/brew-squash-bottle-pr.rb +++ b/cmd/brew-squash-bottle-pr.rb @@ -22,7 +22,7 @@ safe_system "git", "commit", file ENV["GIT_EDITOR"] = git_editor - safe_system "git", "show" + safe_system "git", "show" if ARGV.verbose? end end
squash-bottle-pr: Call git show if verbose
diff --git a/db/migrate/20151113171020_replace_tags_with_signup_tags_on_email_alerts.rb b/db/migrate/20151113171020_replace_tags_with_signup_tags_on_email_alerts.rb index abc1234..def5678 100644 --- a/db/migrate/20151113171020_replace_tags_with_signup_tags_on_email_alerts.rb +++ b/db/migrate/20151113171020_replace_tags_with_signup_tags_on_email_alerts.rb @@ -0,0 +1,19 @@+class ReplaceTagsWithSignupTagsOnEmailAlerts < Mongoid::Migration + def self.up + ContentItem.any_of({base_path: /government\/policies.*email-signup.*/, rendering_app: 'email-alert-frontend'}).each do |item| + policy = item.details["tags"]["policy"] + item.details.delete("tags") + item.details["signup_tags"] = { "policies" => policy } + item.save! + end + end + + def self.down + ContentItem.any_of({base_path: /government\/policies.*email-signup.*/, rendering_app: 'email-alert-frontend'}).each do |item| + policy = item.details["signup_tags"]["policies"] + item.details.delete("signup_tags") + item.details["tags"] = { "policy" => policy } + item.save! + end + end +end
Change tagging of email alert signup content items Existing email_alert_signup items currently only relate to policy alerts. These items should be tagged with some kind of reference to the policy they handle signups for. Currently, this reference is stored as "details" => { "tags" => "some-policy" }. 'Tags' is not a good name in this context. It stomps over the existing semantics for the "tags" field, i.e. - "this piece of content is tagged to this policy". This commit introduces a data migration to change this field to "signup_tags". It also takes this opportunity to pluralize 'policy' for consistency with the links attribute. This change brings the content store in line with concurrent changes being made to policy-publisher, which handles the presentation of all existing email_alert_signup items.
diff --git a/lib/overcommit/hook/pre_commit/slim_lint.rb b/lib/overcommit/hook/pre_commit/slim_lint.rb index abc1234..def5678 100644 --- a/lib/overcommit/hook/pre_commit/slim_lint.rb +++ b/lib/overcommit/hook/pre_commit/slim_lint.rb @@ -1,5 +1,5 @@ module Overcommit::Hook::PreCommit - # Runs `slim-lint` against any modified HAML files. + # Runs `slim-lint` against any modified Slim templates. class SlimLint < Base MESSAGE_TYPE_CATEGORIZER = lambda do |type| type.include?('W') ? :warning : :error
Fix comment in SlimLint hook
diff --git a/db/migrate/20160901131628_add_pinfirmable_columns_to_resource.rb b/db/migrate/20160901131628_add_pinfirmable_columns_to_resource.rb index abc1234..def5678 100644 --- a/db/migrate/20160901131628_add_pinfirmable_columns_to_resource.rb +++ b/db/migrate/20160901131628_add_pinfirmable_columns_to_resource.rb @@ -1,8 +1,10 @@ class AddPinfirmableColumnsToResource < ActiveRecord::Migration[5.0] def change model = (ENV["MODEL"] || "user").downcase.pluralize.to_sym - add_column model, :pinfirmable_pin, :string - add_column model, :pinfirmable_tries, :integer, default: 0 - add_column model, :pinfirmable_lockout, :datetime, default: nil + unless column_exists?(model, :pinfirmable_pin) + add_column model, :pinfirmable_pin, :string + add_column model, :pinfirmable_tries, :integer, default: 0 + add_column model, :pinfirmable_lockout, :datetime, default: nil + end end end
Add columns if they don't already exist
diff --git a/lib/skroutz_api/paginated_collection.rb b/lib/skroutz_api/paginated_collection.rb index abc1234..def5678 100644 --- a/lib/skroutz_api/paginated_collection.rb +++ b/lib/skroutz_api/paginated_collection.rb @@ -5,10 +5,11 @@ attr_reader :response, :context - def initialize(context, response) + def initialize(context, response, collection) @context = context @response = response - super(parse_array(response, context.resource_prefix)) + + super(collection) end def is_at_first?
Initialize SkroutzApi::PaginatedCollection with parsed collection
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -27,8 +27,8 @@ return end - @users = User.where(github_handle: params[:q]) - @users = User.where(email: params[:q]) if @users.none? + @users = User.contestants.where(github_handle: /#{params[:q]}/) + @users = User.contestants.where(email: params[:q]) if @users.none? @users = @users.page(1) render :index
Update the Admin user listing. Also updated search using regex.
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 @@ -2,9 +2,4 @@ protect_from_forgery include GDS::SSO::ControllerMethods - - def default_url_options(options={}) - options.merge :protocol => "https" - end - end
Revert "make URLs https by default" This reverts commit 227a95932266038ca2e1c9cc4f580adf6f24a195.
diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -1,6 +1,7 @@ class InvitationsController < ApplicationController before_action :authenticate! before_action :set_invitation! + before_action :set_user! skip_before_action :validate_user_profile! skip_before_action :authorize_if_private! @@ -30,4 +31,8 @@ @invitation = Invitation.locate!(params[:code]).unexpired @organization = @invitation.organization end + + def set_user! + @user = current_user + end end
Set user variable in invitations controller too
diff --git a/config/initializers/raven.rb b/config/initializers/raven.rb index abc1234..def5678 100644 --- a/config/initializers/raven.rb +++ b/config/initializers/raven.rb @@ -1,6 +1,6 @@ Raven.configure do |config| config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s) config.environments = %w(staging production) - config.excluded_exceptions += ['OpenSSL::SSL::SSLError'] + config.excluded_exceptions += ['OpenSSL::SSL::SSLError', 'Mastodon::UnexpectedResponseError', 'HTTP::TimeoutError', 'HTTP::ConnectionError'] end
Add frequent exceptions to excluded exceptions Co-Authored-By: hieki <0be209aaf3c42870c0f050d1c2cc8d5026e3dbe2@gmail.com>