diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,8 @@ require 'chefspec' require 'chefspec/berkshelf' +RSpec.configure do |config| + config.color = true +end + at_exit { ChefSpec::Coverage.report! }
Add the basic spec helper
diff --git a/tests/rackspace/requests/compute_v2/attachment_tests.rb b/tests/rackspace/requests/compute_v2/attachment_tests.rb index abc1234..def5678 100644 --- a/tests/rackspace/requests/compute_v2/attachment_tests.rb +++ b/tests/rackspace/requests/compute_v2/attachment_tests.rb @@ -0,0 +1,68 @@+Shindo.tests('Fog::Compute::RackspaceV2 | attachment_tests', ['rackspace']) do + + pending if Fog.mocking? + + ATTACHMENT_FORMAT = { + 'volumeAttachment' => { + 'id' => String, + 'serverId' => String, + 'volumeId' => String, + 'device' => Fog::Nullable::String + } + } + + LIST_ATTACHMENTS_FORMAT = { + 'volumeAttachments' => [ATTACHMENT_FORMAT] + } + + compute_service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') + block_storage_service = Fog::Rackspace::BlockStorage.new + + name = 'fog' + Time.now.to_i.to_s + image_id = '3afe97b2-26dc-49c5-a2cc-a2fc8d80c001' # Ubuntu 11.10 + flavor_id = '2' # 512 MB + server_id = compute_service.create_server(name, image_id, flavor_id, 1, 1).body['server']['id'] + volume_id = block_storage_service.create_volume(1).body['volume']['id'] + device_id = '/dev/xvde' + + + tests('success') do + until compute_service.get_server(server_id).body['server']['status'] == 'ACTIVE' + sleep 10 + end + + until block_storage_service.get_volume(volume_id).body['volume']['status'] == 'available' + sleep 10 + end + + tests("#attach_volume(#{server_id}, #{volume_id}, #{device_id})").formats(ATTACHMENT_FORMAT) do + compute_service.attach_volume(server_id, volume_id, device_id).body + end + + tests("#list_attachments(#{server_id})").formats(LIST_ATTACHMENTS_FORMAT) do + compute_service.list_attachments(server_id).body + end + + tests("#get_attachment(#{server_id}, #{volume_id})").formats(ATTACHMENT_FORMAT) do + compute_service.get_attachment(server_id, volume_id).body + end + + until block_storage_service.get_volume(volume_id).body['volume']['status'] == 'in-use' + sleep 10 + end + + tests("#delete_attachment(#{server_id}, #{volume_id})").succeeds do + compute_service.delete_attachment(server_id, volume_id) + end + end + + tests('failure') do + tests("#attach_volume('', #{volume_id}, #{device_id})").raises(Fog::Compute::RackspaceV2::NotFound) do + compute_service.attach_volume('', volume_id, device_id) + end + + tests("#delete_attachment('', #{volume_id})").raises(Fog::Compute::RackspaceV2::NotFound) do + compute_service.delete_attachment('', volume_id) + end + end +end
[rackspace|compute] Add tests for volume attachments.
diff --git a/app/controllers/api/items_controller.rb b/app/controllers/api/items_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/items_controller.rb +++ b/app/controllers/api/items_controller.rb @@ -3,12 +3,14 @@ item_type_id = params[:item_type_id] number = params[:number] agenda_id = params[:agenda_id] + title = params[:title] @items = Item.all @items = @items.where("lower(title) LIKE ? OR lower(origin_type) = ?", @@query, @@query.gsub("%", "")) unless @@query.empty? @items = @items.where("item_type_id = ?", item_type_id) if item_type_id.present? @items = @items.where("lower(number) = ?", number.downcase) if number.present? + @items = @items.where("lower(title) LIKE ?", "%#{title.downcase}%") if title.present? @items = @items.where("origin_id = ? AND origin_type = 'Agenda'", agenda_id) if agenda_id.present? paginate json: @items.order(change_query_order), per_page: change_per_page
Add Title Search For API Items
diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb index abc1234..def5678 100644 --- a/app/controllers/libraries_controller.rb +++ b/app/controllers/libraries_controller.rb @@ -5,7 +5,7 @@ def search items = Library::Item.search { fulltext params[:query] } - @items = Library::ItemDecorator.decorate_collection items + @items = Library::ItemDecorator.decorate_collection items.results respond_to do |format| format.json { render json: @items } end
Fix library json search results
diff --git a/app/demo_data/fake_service_generator.rb b/app/demo_data/fake_service_generator.rb index abc1234..def5678 100644 --- a/app/demo_data/fake_service_generator.rb +++ b/app/demo_data/fake_service_generator.rb @@ -16,7 +16,7 @@ return { student_id: @student.id, service_type_id: service_type_id, - provided_by_educator_id: [educator.id, nil].sample, + provided_by_educator_name: [educator.full_name, nil].sample, date_started: @date - rand(0..7), recorded_at: @date, recorded_by_educator_id: Educator.all.sample.id
Update demo data generator with provided_by_educator_name
diff --git a/spec/lib/bigdecimal_spec.rb b/spec/lib/bigdecimal_spec.rb index abc1234..def5678 100644 --- a/spec/lib/bigdecimal_spec.rb +++ b/spec/lib/bigdecimal_spec.rb @@ -2,6 +2,6 @@ describe BigDecimal do it 'should provide a human-readable inspect for BigDecimal' do - expect(BigDecimal.new('33.45').inspect).to eq '33.45' + expect(BigDecimal('33.45').inspect).to eq '33.45' end end
Remove deprecated BigDecimal.new on move to ruby 2.6.2.
diff --git a/spec/models/trigger_spec.rb b/spec/models/trigger_spec.rb index abc1234..def5678 100644 --- a/spec/models/trigger_spec.rb +++ b/spec/models/trigger_spec.rb @@ -9,12 +9,6 @@ @page.stub!(:class).and_return(Page) @page.stub!(:destroyed?).and_return(false) Content.stub!(:find).and_return(@page) - @current_utime = 1 - Time.stub!(:now).and_return { Time.at(@current_utime) } - end - - def sleep(time_delta) - @current_utime += time_delta end it '.post_action should not fire immediately for future triggers' do @@ -26,7 +20,10 @@ end.should_not raise_error @page.should_receive(:tickle) - sleep 2 + + # Stub Time.now to emulate sleep. + t = Time.now + Time.stub!(:now).and_return(t + 5.seconds) Trigger.fire Trigger.count.should == 0 end
Use same trick to avoid sleep in all specs.
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,10 +14,12 @@ get 'email' end end + resources :sessions resources :password_resets resources :books do resources :texts do + resources :comments collection do post 'sort' end
Update route file with Comment resource
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,7 @@ resources :teams get 'repositories' => "dashboard#repositories" - post 'index' => "dashboard#index" + match 'index', to: 'dashboard#index', via: [:get, :post] post 'score' => 'application#score' post 'take_snapshot' => "dashboard#take_snapshot" post 'change_round' => "dashboard#change_round"
Fix /index direct access issue
diff --git a/lib/cli.rb b/lib/cli.rb index abc1234..def5678 100644 --- a/lib/cli.rb +++ b/lib/cli.rb @@ -1,5 +1,5 @@-require 'colorize' -require File.expand_path('../document_generator.rb', __FILE__) +require "colorize" +require File.expand_path("../document_generator.rb", __FILE__) module Rambo class CLI @@ -47,7 +47,7 @@ end def logo - File.read(File.expand_path('../../assets/logo.txt', __FILE__)) + File.read(File.expand_path("../../assets/logo.txt", __FILE__)) end end end
Change single quotes to double
diff --git a/ivy-serializers.gemspec b/ivy-serializers.gemspec index abc1234..def5678 100644 --- a/ivy-serializers.gemspec +++ b/ivy-serializers.gemspec @@ -20,5 +20,5 @@ spec.add_development_dependency 'json-schema-rspec', '~> 0.0.4' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 3.5' - spec.add_development_dependency 'simplecov', '~> 0.20.0' + spec.add_development_dependency 'simplecov', '~> 0.21.0' end
Update simplecov requirement from ~> 0.20.0 to ~> 0.21.0 Updates the requirements on [simplecov](https://github.com/simplecov-ruby/simplecov) to permit the latest version. - [Release notes](https://github.com/simplecov-ruby/simplecov/releases) - [Changelog](https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md) - [Commits](https://github.com/simplecov-ruby/simplecov/compare/v0.20.0...v0.21.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/app/uploaders/hero_image_uploader.rb b/app/uploaders/hero_image_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/hero_image_uploader.rb +++ b/app/uploaders/hero_image_uploader.rb @@ -16,7 +16,7 @@ def apply_blur manipulate! do |img| - img.blur_image(0, 4) + img.blur_image(0, 5) end end
Change the hero image blur again
diff --git a/spec/models/concerns/image_file_manager_spec.rb b/spec/models/concerns/image_file_manager_spec.rb index abc1234..def5678 100644 --- a/spec/models/concerns/image_file_manager_spec.rb +++ b/spec/models/concerns/image_file_manager_spec.rb @@ -0,0 +1,77 @@+require 'rails_helper' + +RSpec.describe ImageFileManager, :type => :model do + + before do + setup_test_public_dir + + @test_file = File.join(TEST_FILE_PATH, '1f004.png') + end + after do + empty_test_public_dir + end + + context "#intake_file" do + it "copies the file we give it into the image uploads directory" do + image = Image.create + upload_path = image.generate_relative_upload_path(@test_file) + + image.intake_file @test_file + expect( File.file?(File.join(Rails.public_path, Image::UPLOAD_DIR, upload_path)) ).to eq(true) + end + + it "avoids name collisions on files" do + image = Image.create + + # copy file of same name to force a collision + first_upload_path = image.generate_relative_upload_path(@test_file) + upload_dir = File.join Rails.public_path, Image::UPLOAD_DIR, File.dirname(first_upload_path) + FileUtils.mkdir_p(upload_dir) + FileUtils.cp(@test_file, upload_dir) + + # intake the file of same name + # second_upload_path = image.generate_full_upload_path(@test_file) + image.intake_file(@test_file) + # test that file name has an appended '-001' + expect( File.basename(image.image_path) ).to match(/\-001\.png/) + end + + it "denies a non-image" do + pending + @test_file = File.join(TEST_FILE_PATH, 'test.pdf') + image = Image.create + + expect{image.intake_file(@test_file)}.to raise_error ImageException + + end + + it "handles an html file with a relative path" + end + + context "#file_path" do + it "generates the path to the original file" do + image = Image.create + image.intake_file(@test_file) + + expect( image.file_path ).to eq(File.join(Rails.public_path, Image::UPLOAD_DIR, image.image_path)) + end + + it "generates the path to a resized profile" do + image = Image.create + image.intake_file(@test_file) + + expect( image.file_path(:header) ).to include(Image::CACHE_DIR) + expect( image.file_path(:header) ).to match(/\-header\.png/) + end + end + + context "#save_profile" do + it "creates a file in the proper directory" do + image = Image.create + image.intake_file(@test_file) + image.save_profile(image.magick_image, :test_profile) + + expect( File.file?(image.file_path(:test_profile)) ).to eq(true) + end + end +end
Add spec for file manager, since it appears we are going to use it for now
diff --git a/tools/reconnect_vms.rb b/tools/reconnect_vms.rb index abc1234..def5678 100644 --- a/tools/reconnect_vms.rb +++ b/tools/reconnect_vms.rb @@ -0,0 +1,55 @@+#!/usr/bin/env ruby +require File.expand_path('../config/environment', __dir__) +require "optimist" + +opts = Optimist.options do + opt :ems_id, "The ID of the ExtManagementSystem to reconnect VMs for", :type => :integer + opt :ems_name, "The name of the ExtManagementSystem to reconnect VMs for", :type => :string + opt :by, "Property to treat as unique, defaults to :uid_ems", :type => :string, :default => "uid_ems" +end + +if opts[:ems_id].nil? && opts[:ems_name].nil? + Optimist.die :ems_id, "Must pass either --ems-id or --ems-name" +end + +ems = if opts[:ems_id].present? + ExtManagementSystem.find_by(:id => opts[:ems_id]) + else + ExtManagementSystem.find_by(:name => opts[:ems_id]) + end + +if ems.nil? + print "Failed to find EMS [#{opts.key?(:ems_id) ? opts[:ems_id] : opts[:ems_name]}]" + exit +end + +ems_id = ems.id + +# Find all VMs which match the unique key +vms_index = VmOrTemplate.where(opts[:by] => ems.vms_and_templates.pluck(opts[:by])).group_by { |vm| vm.send(opts[:by]) } + +# Select where there are exactly two with the same unique property, one archived and one active +duplicate_vms = vms_index.select { |_by, vms| vms.count == 2 && vms.select(&:active).count == 1 } +puts "Found #{duplicate_vms.count} duplicate VMs..." + +activated_vms = duplicate_vms.map do |_by, vms| + active_vms, inactive_vms = vms.partition(&:active) + + # There should only be one of each + active_vm = active_vms.first + inactive_vm = inactive_vms.first + + next if active_vm.nil? || inactive_vm.nil? + next if active_vm.created_on < inactive_vm.created_on # Always pick the older VM + + # Disconnect the new VM and activate the old VM + puts "Disconnecting Vm [#{active_vm.name}] id [#{active_vm.name}] uid_ems [#{active_vm.uid_ems}] ems_ref [#{active_vm.ems_ref}]" + active_vm.disconnect_inv + + puts "Activating Vm [#{inactive_vm.name}] id [#{inactive_vm.id}] uid_ems [#{inactive_vm.uid_ems}] ems_ref [#{inactive_vm.ems_ref}]" + inactive_vm.update_attributes!(:ems_id => ems_id, :uid_ems => active_vm.uid_ems, :ems_ref => active_vm.ems_ref) + + inactive_vm +end.compact + +puts "Activated #{activated_vms.count} VMs:\n#{activated_vms.map(&:name).join(", ")}"
Add a tool to assist in reconnecting vms
diff --git a/japanese_calendar.gemspec b/japanese_calendar.gemspec index abc1234..def5678 100644 --- a/japanese_calendar.gemspec +++ b/japanese_calendar.gemspec @@ -21,6 +21,8 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] + spec.required_ruby_version = ">= 2.0" + spec.add_development_dependency "bundler", "~> 1.13" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.0"
Add required Ruby version to gemspec
diff --git a/presenters/finder_signup_content_item_presenter.rb b/presenters/finder_signup_content_item_presenter.rb index abc1234..def5678 100644 --- a/presenters/finder_signup_content_item_presenter.rb +++ b/presenters/finder_signup_content_item_presenter.rb @@ -1,6 +1,6 @@ class FinderSignupContentItemPresenter < ContentItemPresenter def title - metadata["name"] + metadata.fetch("signup_title", metadata["name"]) end def content_id
Use a different title for signup pages If a different title for signup pages is present in the metadata hash use that instead.
diff --git a/lib/ort.rb b/lib/ort.rb index abc1234..def5678 100644 --- a/lib/ort.rb +++ b/lib/ort.rb @@ -23,11 +23,12 @@ @url = Mapotempo::Application.config.optimize_url def self.optimize(capacity, matrix, time_window) - key = {capacity: capacity, matrix: matrix, time_window: time_window}.to_json + key = {capacity: capacity, matrix: matrix.hash, time_window: time_window}.to_json result = @cache.read(key) if !result - result = RestClient.post @url, data: key, content_type: :json, accept: :json + data = {capacity: capacity, matrix: matrix, time_window: time_window}.to_json + result = RestClient.post @url, data: data, content_type: :json, accept: :json @cache.write(key, result) end
Use matrix hash as optimizer cache key
diff --git a/rails_event_store/spec/support/test_application.rb b/rails_event_store/spec/support/test_application.rb index abc1234..def5678 100644 --- a/rails_event_store/spec/support/test_application.rb +++ b/rails_event_store/spec/support/test_application.rb @@ -3,6 +3,7 @@ require 'securerandom' class TestApplication < Rails::Application + config.hosts = nil config.eager_load = false config.secret_key_base = SecureRandom.hex(16) config.event_store = RailsEventStore::Client.new
Disable HostAuthorization middleware in testing. https://stackoverflow.com/a/56238430
diff --git a/Library/Homebrew/test/unpack_strategy/subversion_spec.rb b/Library/Homebrew/test/unpack_strategy/subversion_spec.rb index abc1234..def5678 100644 --- a/Library/Homebrew/test/unpack_strategy/subversion_spec.rb +++ b/Library/Homebrew/test/unpack_strategy/subversion_spec.rb @@ -1,22 +1,26 @@ require_relative "shared_examples" describe UnpackStrategy::Subversion do - let(:repo) { - mktmpdir.tap do |repo| - system "svnadmin", "create", repo - end - } - let(:working_copy) { - mktmpdir.tap do |working_copy| - system "svn", "checkout", "file://#{repo}", working_copy + let(:repo) { mktmpdir } + let(:working_copy) { mktmpdir } + let(:path) { working_copy } - FileUtils.touch working_copy/"test" - system "svn", "add", working_copy/"test" - system "svn", "commit", working_copy, "-m", "Add `test` file." - end - } - let(:path) { working_copy } + before(:each) do + system "svnadmin", "create", repo + + system "svn", "checkout", "file://#{repo}", working_copy + + FileUtils.touch working_copy/"test" + system "svn", "add", working_copy/"test" + system "svn", "commit", working_copy, "-m", "Add `test` file." + end include_examples "UnpackStrategy::detect" include_examples "#extract", children: ["test"] + + context "when the directory name contains an '@' symbol" do + let(:working_copy) { mktmpdir(["", "@1.2.3"]) } + + include_examples "#extract", children: ["test"] + end end
Add spec for SVN directory name containing `@`.
diff --git a/Casks/rubymine-bundled-jdk.rb b/Casks/rubymine-bundled-jdk.rb index abc1234..def5678 100644 --- a/Casks/rubymine-bundled-jdk.rb +++ b/Casks/rubymine-bundled-jdk.rb @@ -0,0 +1,20 @@+cask :v1 => 'rubymine-bundled-jdk' do + version '7.1' + sha256 '2e9fced43c8e14ffbc82a72a8f6cde1cbab50861db079162ca5ff34c668ba57c' + + url "https://download.jetbrains.com/ruby/RubyMine-#{version}-custom-jdk-bundled.dmg" + name 'RubyMine' + homepage 'https://www.jetbrains.com/ruby/' + license :commercial + + app 'RubyMine.app' + + zap :delete => [ + '~/Library/Preferences/com.jetbrains.rubymine.plist', + '~/Library/Preferences/RubyMine70', + '~/Library/Application Support/RubyMine70', + '~/Library/Caches/RubyMine70', + '~/Library/Logs/RubyMine70', + '/usr/local/bin/mine', + ] +end
Add cask for RubyMine with bundled JDK
diff --git a/create-images.rb b/create-images.rb index abc1234..def5678 100644 --- a/create-images.rb +++ b/create-images.rb @@ -7,23 +7,16 @@ include ProgressBar::WithProgress end -short_revs = `git rev-list master`.lines.map { |line| line.strip[0...4] } -if short_revs.length != short_revs.uniq.length - raise "Short revisions collide, see 'git rev-list master'." -end - def create_card_map(pattern) branch = `git rev-parse --abbrev-ref HEAD`.strip return Dir[pattern].with_progress.map { |file| - rev = `git rev-list #{branch} -1 -- #{file}`.strip[0...4] - raise "Unversioned file: #{file}." if rev.empty? + versioned = `git ls-files #{file}`.strip + raise "Unversioned file: #{file}." if versioned.empty? - dbf_id = File.basename(file, '.png') - dir = File.dirname(file) - path = "#{rev}/#{dir}" + id = File.basename(file, '.png') hash = Digest::SHA1.base64digest(File.read(file))[0...5] - [dbf_id, hash] + [id, hash] }.to_h end
Remove and simplify checks now that we're using package.json versioning. Also, remove unused leftover values.
diff --git a/lib/action_args/abstract_controller.rb b/lib/action_args/abstract_controller.rb index abc1234..def5678 100644 --- a/lib/action_args/abstract_controller.rb +++ b/lib/action_args/abstract_controller.rb @@ -6,17 +6,16 @@ values = if defined? ActionController::StrongParameters target_model_name = self.class.name.sub(/Controller$/, '').singularize.underscore.to_sym permitted_attributes = self.class.instance_variable_get '@permitted_attributes' - method(method_name).parameters.map {|type, key| - next if type == :block + method(method_name).parameters.reject {|type, _| type == :block }.map {|type, key| params.require key if type == :req if (key == target_model_name) && permitted_attributes params[key].try :permit, *permitted_attributes else params[key] end - }.compact + end else - method(method_name).parameters.map {|type, key| params[key] unless type == :block }.compact + method(method_name).parameters.reject {|type, _| type == :block }.map(&:last).map {|key| params[key]} end send method_name, *values end
Revert "reduce number of objects" This reverts commit 59d71b6e525274c861bfcbd0142f7753473f4d4a. Conflicts: lib/action_args/abstract_controller.rb reason: compacting all parameters will eliminate nil parameters
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.session_store :cookie_store, key: '_findingaids_session' +Rails.application.config.session_store :cookie_store, key: '_findingaids_session', domain: ENV['LOGIN_COOKIE_COMAIN']
Add domain for session store:
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -PaperSearchApi::Application.config.session_store :cookie_store, key: '_science_commons_api_session' +PaperSearchApi::Application.config.session_store :cookie_store, key: '_science_commons_api_session', :domain => :all
Make our session cookie good across all subdomains
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -5,7 +5,7 @@ # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. ActionController::Base.session = { - :key => 'assda_adapt_session', + :key => "assda_adapt_session_#{Rails.env}", :secret => '425655458519e76165710c6a7669f344097be6441ba9ab198b8103bef8922507885c432dd7c9c3733c9abbf376e56e27a67bac2bc65e6f2bd87d63ee713a9891' }
Make the session cookie key dependent on the Rails environment.
diff --git a/plugin.rb b/plugin.rb index abc1234..def5678 100644 --- a/plugin.rb +++ b/plugin.rb @@ -5,7 +5,7 @@ after_initialize do SessionController.class_eval do - skip_before_filter :check_xhr, only: ['sso', 'sso_login', 'become', 'sso_provider', 'sso_redirect'] + skip_before_action :check_xhr, only: ['sso', 'sso_login', 'become', 'sso_provider', 'sso_redirect'] def sso_redirect Rails.logger.info "Entering sso_redirect with query string #{request.query_string}"
Switch away from deprecated skip_before_filter
diff --git a/recipes/unpack/50-install-msys-packages.rake b/recipes/unpack/50-install-msys-packages.rake index abc1234..def5678 100644 --- a/recipes/unpack/50-install-msys-packages.rake +++ b/recipes/unpack/50-install-msys-packages.rake @@ -12,8 +12,17 @@ msys_sh <<-EOT mount #{unpackdir_abs.inspect} #{pmrootdir.inspect} && pacman --root #{pmrootdir.inspect} -Sy && - pacman --root #{pmrootdir.inspect} --noconfirm -S #{install_packages.map(&:inspect).join(" ")} 2>NUL; + pacman --root #{pmrootdir.inspect} --noconfirm -S #{install_packages.map(&:inspect).join(" ")} umount #{pmrootdir.inspect} EOT + + begin + # For some reason pacman-5.2.1 generates package files, that prohibit changing files after installation. + # Resetting the permissions the hard way fixes this, so that we can touch ruby.exe . + sh "takeown /R /F \"#{unpackdir.gsub("/","\\")}\" >NUL" + sh "icacls \"#{unpackdir.gsub("/","\\")}\" /inheritance:r /grant BUILTIN\\Users:F /T /Q" + rescue => err + $stderr.puts "ignoring error while adjusting permissions: #{err} (#{err.class})" + end touch ruby_exe end
Fix "Permission denied" error when touching ruby.exe See https://ci.appveyor.com/project/larskanis/rubyinstaller2-hbuor/builds/30223212/job/sjxb12w5bg86hwqn
diff --git a/lib/db/migrate/2_create_submissions.rb b/lib/db/migrate/2_create_submissions.rb index abc1234..def5678 100644 --- a/lib/db/migrate/2_create_submissions.rb +++ b/lib/db/migrate/2_create_submissions.rb @@ -18,6 +18,10 @@ t.string :mongoid_id t.string :mongoid_user_id + + t.string :viewers # deprecated + t.string :liked_by # deprecated + t.string :muted_by # deprecated end add_index :submissions, :mongoid_id, unique: true add_index :submissions, :mongoid_user_id
Put deprecated fields back on Submission table. They can be deleted when the proper join tables have been implemented.
diff --git a/marcato.rb b/marcato.rb index abc1234..def5678 100644 --- a/marcato.rb +++ b/marcato.rb @@ -21,11 +21,12 @@ def play(query = '') searches = query.split(/\s+/) + searches = [''] if searches.empty? playlists.select { |k,v| searches.include?(k) }.each do |name, terms| searches += terms end files = searches.map do |search| - Dir.glob(File.join(MARCATO_MUSIC, "*#{search}*")) + Dir.glob(File.join(MARCATO_MUSIC, "**/*#{search}*")) end.flatten.uniq files = @random ? files.sort_by { rand } : files.sort puts files.join("\n") if !files.empty?
Work in non-flat directory structures. No args for all songs.
diff --git a/lib/scanny/issue.rb b/lib/scanny/issue.rb index abc1234..def5678 100644 --- a/lib/scanny/issue.rb +++ b/lib/scanny/issue.rb @@ -17,7 +17,7 @@ def to_s cwe_suffix = if @cwe - " (" + @cwe.to_a.map { |cwe| "CWE-#{cwe}" }.join(", ") + ")" + " (" + Array(@cwe).map { |cwe| "CWE-#{cwe}" }.join(", ") + ")" else "" end
Fix specs for ruby 1.9 Force to create Array from @cwe
diff --git a/Formula/fu.rb b/Formula/fu.rb index abc1234..def5678 100644 --- a/Formula/fu.rb +++ b/Formula/fu.rb @@ -0,0 +1,37 @@+class Fu < Formula + desc "intuitive alternative to the find utility" + homepage "https://github.com/kbrgl/fu" + url "https://github.com/kbrgl/fu/archive/v1.1.2.tar.gz" + sha256 "34dd0eade8842c4b9e82b56e4b2154e9bcb34843d87aef568ea8fe16a1c1884a" + head "https://github.com/kbrgl/fu.git" + + depends_on "go" => :build + + def self.dependencies + %w[ + github.com/alecthomas/kingpin + github.com/kbrgl/fu/matchers + github.com/kbrgl/fu/shallowradix + github.com/mattn/go-isatty + github.com/stretchr/powerwalk + ] + end + + def install + # Ensure packages are installed to the right location + ENV["GOPATH"] = buildpath + puts ENV["GOPATH"] + + # Install dependencies + self.class.dependencies.each do |dep| + system "go", "get", dep + end + + system "go", "build", "-o", "fu" + bin.install "fu" + end + + test do + system "#{bin}/fu", "--version" + end +end
Add Homebrew formula for 1.1.2
diff --git a/app/controllers/kuroko2/sessions_controller.rb b/app/controllers/kuroko2/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/kuroko2/sessions_controller.rb +++ b/app/controllers/kuroko2/sessions_controller.rb @@ -35,7 +35,7 @@ end def valid_google_hosted_domain? - hd = Kuroko2.config.app_authentication.google_oauth2.options.hd + hd = Kuroko2.config.app_authentication.google_oauth2.dig(:options, :hd) if hd.present? hd == auth_hash.extra.id_info.hd else
Fix google_oauth2 hd check: fix hd option fetching
diff --git a/app/jobs/chronicle_characters_broadcast_job.rb b/app/jobs/chronicle_characters_broadcast_job.rb index abc1234..def5678 100644 --- a/app/jobs/chronicle_characters_broadcast_job.rb +++ b/app/jobs/chronicle_characters_broadcast_job.rb @@ -6,8 +6,13 @@ def perform(ids, chronicle, type, thing) ids.each do |id| + broadcast_create id, thing, json(thing), 'chronicle', thing.chronicle_id if thing.chronicle_id.present? broadcast_update id, chronicle, "#{type}s" => chronicle.send("#{type}_ids") broadcast_update id, thing, chronicle_id: nil if thing.chronicle_id.blank? end end + + def json(entity) + Api::V1::BaseController.render(json: entity) + end end
Fix crash on adding character to chronicle
diff --git a/app/presenters/drug_safety_update_presenter.rb b/app/presenters/drug_safety_update_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/drug_safety_update_presenter.rb +++ b/app/presenters/drug_safety_update_presenter.rb @@ -19,14 +19,6 @@ } end - def beta? - true - end - - def beta_message - "Until January 2015, <a href='http://www.mhra.gov.uk/Safetyinformation/DrugSafetyUpdate/index.htm'>the MHRA website</a> is the official home of the Drug Safety Update." - end - def footer_date_metadata return {} if first_edition? super
Remove unused code in DSU This isn't used anymore now that we define this using the Finder in the Document Presenter.
diff --git a/lib/tasks/cache_missing_responses.rake b/lib/tasks/cache_missing_responses.rake index abc1234..def5678 100644 --- a/lib/tasks/cache_missing_responses.rake +++ b/lib/tasks/cache_missing_responses.rake @@ -0,0 +1,11 @@+namespace :cache do + desc "Caches uncached missing_responses" + task :missing_responses => :environment do + # We're only caching those response sets that have campaigns because caching them all would take an age + CertificationCampaign.all.each do |campaign| + campaign.certificate_generators.includes(:dataset, :certificate).each do |generator| + generator.response_set.save rescue nil + end + end + end +end
Add a rake task to cache any missing_responses that have not been cached Only those that have Campaigns associated, because that's the only place we use them
diff --git a/lib/yard/logging.rb b/lib/yard/logging.rb index abc1234..def5678 100644 --- a/lib/yard/logging.rb +++ b/lib/yard/logging.rb @@ -2,12 +2,17 @@ module YARD class Logger < ::Logger + def initialize(*args) + super + self.level = INFO + end + def debug(*args) - self.level = Logger::DEBUG if $DEBUG + self.level = DEBUG if $DEBUG super end - def enter_level(new_level = Logger::INFO, &block) + def enter_level(new_level = INFO, &block) old_level, self.level = level, new_level yield self.level = old_level
Update log to default to info log level
diff --git a/libObjCAttr.podspec b/libObjCAttr.podspec index abc1234..def5678 100644 --- a/libObjCAttr.podspec +++ b/libObjCAttr.podspec @@ -15,10 +15,10 @@ s.requires_arc = true - s.source_files = 'libObjCAttr/**/*.{h,m}' + s.source_files = 'libObjCAttr/**/*.{h,m}', 'libObjCAttr/Resources/*', 'tools/binaries/*' s.public_header_files = 'libObjCAttr/**/*.h' s.header_dir = 'ROAD' - s.resources = ['libObjCAttr/Resources/*', 'tools/binaries/ROADAttributesCodeGenerator'] + s.preserve_paths = 'libObjCAttr/Resources/*', 'tools/binaries/ROADAttributesCodeGenerator' s.social_media_url = 'https://twitter.com/libobjcattr'
Fix for podspec to prevent inclusion of scripts and binaries into a client package.
diff --git a/lib/nanite/exchanges.rb b/lib/nanite/exchanges.rb index abc1234..def5678 100644 --- a/lib/nanite/exchanges.rb +++ b/lib/nanite/exchanges.rb @@ -1,4 +1,11 @@ module Nanite + # Using these methods actors can participate in distributed processing + # with other nodes using topic exchange publishing (classic pub/sub with + # matching) + # + # This lets you handle a work to do to a single agent from a mapper in your + # Merb/Rails app, and let agents to self-organize who does what, as long as the + # properly collect the result to return to requesting peer. class Agent def push_to_exchange(type, domain, payload="") req = Request.new(type, payload, identity)
Document how Nanite agents can participate in distrubuted processing using topic queues and push_to_exchange/subscribe_to_exchange. Signed-off-by: ezmobius <4aca359fa1b78e51bc8226c4f161d16fdc1e21c8@engineyard.com>
diff --git a/tp.gemspec b/tp.gemspec index abc1234..def5678 100644 --- a/tp.gemspec +++ b/tp.gemspec @@ -10,8 +10,8 @@ gem.version = TP::VERSION gem.authors = ["Justin Campbell"] gem.email = ["justin@justincampbell.me"] - gem.description = "tp" - gem.summary = "tp" + gem.summary = "Terminal Presenter" + gem.description = "Presents Markdown slides in your terminal" gem.homepage = "http://github.com/justincampbell/tp" gem.files = `git ls-files`.split $/
Add gem summary and description
diff --git a/test/boot.rb b/test/boot.rb index abc1234..def5678 100644 --- a/test/boot.rb +++ b/test/boot.rb @@ -1,7 +1,8 @@ require 'pathname' -require 'test/unit' +require 'active_support/version' require 'active_support/test_case' +require 'active_support/testing/autorun' if ActiveSupport::VERSION::MAJOR >= 4 require 'active_record' require 'active_record/fixtures' @@ -28,4 +29,4 @@ ActiveRecord::Base.establish_connection(db_config[ADAPTER]) ActiveRecord::Migration.verbose = false -load schema_file+load schema_file
Fix tests autorun for Rails >= 4
diff --git a/lib/utils/integer_ex.rb b/lib/utils/integer_ex.rb index abc1234..def5678 100644 --- a/lib/utils/integer_ex.rb +++ b/lib/utils/integer_ex.rb @@ -0,0 +1,13 @@+module IntegerEx + refine Integer.singleton_class do + def max() + n_bytes = [42].pack('i').size + n_bits = n_bytes * 16 + 2 ** (n_bits - 2) - 1 + end + + def min() + -(self.max()) - 1 + end + end +end
Create IntegerEx module to expand Integer class
diff --git a/hiera-simulator.gemspec b/hiera-simulator.gemspec index abc1234..def5678 100644 --- a/hiera-simulator.gemspec +++ b/hiera-simulator.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'hiera-simulator' - s.version = '0.3.0' + s.version = '0.2.3' s.authors = 'Kevin Paulisse' s.date = Time.now.strftime('%Y-%m-%d') s.homepage = 'http://github.com/kpaulisse/hiera-simulator'
Revert version bump since this is a CI change only
diff --git a/app/models/bank.rb b/app/models/bank.rb index abc1234..def5678 100644 --- a/app/models/bank.rb +++ b/app/models/bank.rb @@ -4,6 +4,8 @@ has_vcards def to_s + return "" unless vcard + [vcard.full_name, vcard.locality].compact.join(', ') end end
Add guard to not bail in Bank.to_s without vcard.
diff --git a/app/models/dojo.rb b/app/models/dojo.rb index abc1234..def5678 100644 --- a/app/models/dojo.rb +++ b/app/models/dojo.rb @@ -1,6 +1,6 @@ class Dojo < ApplicationRecord - NUM_OF_COUNTRIES = "75" - NUM_OF_WHOLE_DOJOS = "1,500" + NUM_OF_COUNTRIES = "85" + NUM_OF_WHOLE_DOJOS = "1,600" NUM_OF_JAPAN_DOJOS = Dojo.count.to_s YAML_FILE = Rails.root.join('db', 'dojos.yaml')
Update to the global stats at the end of 2017: > ending the year with 1,600 Dojos running regularly in 85 countries cf. Happy New Year from the CoderDojo Foundation https://youtu.be/l68CNoby_bg
diff --git a/app/models/unit.rb b/app/models/unit.rb index abc1234..def5678 100644 --- a/app/models/unit.rb +++ b/app/models/unit.rb @@ -12,7 +12,7 @@ validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/ validates :key, :name, presence: true - validates :key, uniqueness: true, format: { with: /\A[-a-z1-9]+\z/, message: "only allows letters, numbers and hyphens" } + validates :key, uniqueness: true, format: { with: /\A[-A-Za-z1-9]+\z/, message: "only allows letters, numbers and hyphens" } accepts_nested_attributes_for :memberships, allow_destroy: true
Fix Unit key validation regex
diff --git a/lib/noaa_client/responses/reactive_xml_response.rb b/lib/noaa_client/responses/reactive_xml_response.rb index abc1234..def5678 100644 --- a/lib/noaa_client/responses/reactive_xml_response.rb +++ b/lib/noaa_client/responses/reactive_xml_response.rb @@ -18,7 +18,11 @@ end def source - @source + @source || NullResponse.new + end + + class NullResponse + def css(*args); end end end end
Add null object to reactive response.
diff --git a/app/bitmap.rb b/app/bitmap.rb index abc1234..def5678 100644 --- a/app/bitmap.rb +++ b/app/bitmap.rb @@ -30,7 +30,7 @@ ## Draw a horizontal segment with the given colour def draw_h(x1, x2, y, colour) - @bm[y - 1][x1 - 1..x2 - x1] = Array.new(x2 - x1 + 1, colour) + @bm[y - 1][x1 - 1..x2 - 1] = Array.new(x2 - x1 + 1, colour) end ## Print the bitmap
Fix bug concerning length of horizontally drawn segment Argument x2 in Bitmap#draw_h is exact column, no need to calculate the segment's legnth
diff --git a/migrations/7_remove_current_server_status_index.rb b/migrations/7_remove_current_server_status_index.rb index abc1234..def5678 100644 --- a/migrations/7_remove_current_server_status_index.rb +++ b/migrations/7_remove_current_server_status_index.rb @@ -1,7 +1,11 @@ class RemoveCurrentServerStatusIndex < ActiveRecord::Migration disable_ddl_transaction! - def change - remove_index(:nodes, name: :index_nodes_on_current_server_status, algorithm: :concurrently) + def up + remove_index :nodes, name: :index_nodes_on_current_server_status, algorithm: :concurrently + end + + def down + add_index :nodes, :current_server_status, algorithm: :concurrently end end
Fix down migration for removing node index
diff --git a/spec/classes/indexing__middle_manager_spec.rb b/spec/classes/indexing__middle_manager_spec.rb index abc1234..def5678 100644 --- a/spec/classes/indexing__middle_manager_spec.rb +++ b/spec/classes/indexing__middle_manager_spec.rb @@ -0,0 +1,64 @@+require 'spec_helper' + +describe 'druid::indexing::middle_manager', :type => 'class' do + context 'On system with 10 GB RAM and defaults for all parameters' do + let(:facts) do + { + :memorysize => '10 GB', + } + end + + it { + should compile.with_all_deps + should contain_class('druid::indexing::middle_manager') + should contain_druid__service('middle_manager') + should contain_file('/etc/druid/middle_manager') + should contain_file('/etc/druid/middle_manager/common.runtime.properties') + should contain_file('/etc/druid/middle_manager/runtime.properties') + should contain_file('/etc/systemd/system/druid-middle_manager.service') + should contain_exec('Reload systemd daemon for new middle_manager service file') + should contain_service('druid-middle_manager') + } + end + + context 'On base system with custom JVM parameters ' do + let(:params) do + { + :jvm_opts => [ + '-server', + '-Xmx4g', + '-Xms4g', + '-XX:NewSize=256m', + '-XX:MaxNewSize=256m', + '-XX:MaxDirectMemorySize=2g', + '-Duser.timezone=PDT', + '-Dfile.encoding=latin-1', + '-Djava.util.logging.manager=custom.LogManager', + '-Djava.io.tmpdir=/mnt/tmp', + ] + } + end + + it { + should contain_file('/etc/systemd/system/druid-middle_manager.service').with_content("[Unit]\nDescription=Druid Middle Manager Node\n\n[Service]\nType=simple\nWorkingDirectory=/etc/druid/middle_manager/\nExecStart=/usr/bin/java -server -Xmx4g -Xms4g -XX:NewSize=256m -XX:MaxNewSize=256m -XX:MaxDirectMemorySize=2g -Duser.timezone=PDT -Dfile.encoding=latin-1 -Djava.util.logging.manager=custom.LogManager -Djava.io.tmpdir=/mnt/tmp -classpath .:/usr/local/lib/druid/lib/* io.druid.cli.Main server middleManager\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target\n") + } + end + + context 'On system with 10 GB RAM and custom druid configs' do + let(:facts) do + { + :memorysize => '10 GB', + } + end + + let(:params) do + { + } + end + + it { + should contain_file('/etc/druid/middle_manager/runtime.properties').with_content("# Node Configs\ndruid.host=\ndruid.port=8090\ndruid.service=druid/middlemanager\n\n# Task Logging\ndruid.indexer.logs.type=file\ndruid.indexer.logs.directory=/var/log\n") + + } + end +end
Add unit tests for the druid::indexing::middle_manager class.
diff --git a/spec/integration/basic_with_arguments_spec.rb b/spec/integration/basic_with_arguments_spec.rb index abc1234..def5678 100644 --- a/spec/integration/basic_with_arguments_spec.rb +++ b/spec/integration/basic_with_arguments_spec.rb @@ -1,3 +1,5 @@+require 'readline' + describe "Escort basic app that requires arguments", :integration => true do subject { Escort::App.create(option_string, &app_configuration) }
Make sure readline is required for test
diff --git a/Casks/atom.rb b/Casks/atom.rb index abc1234..def5678 100644 --- a/Casks/atom.rb +++ b/Casks/atom.rb @@ -1,5 +1,5 @@ class Atom < Cask - url 'http://atom.io/download/mac' + url 'https://atom.io/download/mac' homepage 'http://atom.io' version 'latest' sha256 :no_check
Change Atom download to HTTPS
diff --git a/Casks/flow.rb b/Casks/flow.rb index abc1234..def5678 100644 --- a/Casks/flow.rb +++ b/Casks/flow.rb @@ -4,7 +4,7 @@ url 'http://www.getflow.com/mac/download' name 'Flow' - homepage 'http://www.getflow.com/' + homepage 'https://www.getflow.com/' license :commercial app 'Flow.app'
Fix homepage to use SSL in Flow Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/Casks/toad.rb b/Casks/toad.rb index abc1234..def5678 100644 --- a/Casks/toad.rb +++ b/Casks/toad.rb @@ -2,7 +2,7 @@ version '2.4.0' sha256 '74f7d6a26c0bd5eaec2c3d2e02994fe9e89131e3f1baa8742416f9dc6222e4af' - # http://community-downloads.quest.com/toadsoft/ was verified as official when first introduced to the cask + # community-downloads.quest.com/toadsoft/toadmacedition was verified as official when first introduced to the cask url "http://community-downloads.quest.com/toadsoft/toadmacedition/ToadMacEdition_#{version.no_dots}.zip" name 'Toad' homepage 'https://www.toadworld.com/products/toad-mac-edition'
Fix `url` stanza comment for Toad.
diff --git a/Casks/ynab.rb b/Casks/ynab.rb index abc1234..def5678 100644 --- a/Casks/ynab.rb +++ b/Casks/ynab.rb @@ -1,8 +1,8 @@ class Ynab < Cask - version '4.3.451' - sha256 '088f61e0e772193f6dac61e22067b1696246f214d7c9887f95d180cfabb57e25' + version '4.3.541' + sha256 '38ec8a050fde9be1375f3fe184988eb81358b3a26b74c308e67bb872ac5e2d50' - url 'https://www.youneedabudget.com/CDNOrigin/download/ynab4/liveCaptive/Mac/YNAB4_LiveCaptive_4.3.451.dmg' + url 'https://www.youneedabudget.com/CDNOrigin/download/ynab4/liveCaptive/Mac/YNAB4_LiveCaptive_4.3.541.dmg' homepage 'http://www.youneedabudget.com/' link 'YNAB 4.app'
Update YNAB 4 from 4.3.451 to 4.3.541 Redo of PR #5084 overwritten by commit d4605c8.
diff --git a/core/spec/models/spree/calculator/shipping/price_sack_spec.rb b/core/spec/models/spree/calculator/shipping/price_sack_spec.rb index abc1234..def5678 100644 --- a/core/spec/models/spree/calculator/shipping/price_sack_spec.rb +++ b/core/spec/models/spree/calculator/shipping/price_sack_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Calculator::PriceSack, type: :model do +describe Spree::Calculator::Shipping::PriceSack, type: :model do let(:calculator) do calculator = Spree::Calculator::PriceSack.new calculator.preferred_minimal_amount = 5
Change model tested to correct model Change model tested from Spree::Calculator::PriceSack to Spree::Calculator::Shipping::PriceSack.
diff --git a/app/api/v0.rb b/app/api/v0.rb index abc1234..def5678 100644 --- a/app/api/v0.rb +++ b/app/api/v0.rb @@ -3,9 +3,11 @@ class ApiV0 < Grape::API + swagger_path = 'swagger' + get do # Redirect base url to Swagger docs - redirect "http://petstore.swagger.io/?url=#{request.scheme}://#{request.host_with_port}/#{version}/docs" + redirect "http://petstore.swagger.io/?url=#{request.scheme}://#{request.host_with_port}/#{version}/#{swagger_path}" end content_type :json, 'application/json' @@ -33,7 +35,7 @@ mount App::API::Locations add_swagger_documentation \ - mount_path: 'docs', + mount_path: swagger_path, hide_documentation_path: true, hide_format: true, base_path: '/v0'
Change swagger doc mount path.
diff --git a/xo.gemspec b/xo.gemspec index abc1234..def5678 100644 --- a/xo.gemspec +++ b/xo.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] + spec.required_ruby_version = '>= 1.9.3' + spec.add_development_dependency 'rake' spec.add_development_dependency 'minitest' spec.add_development_dependency 'coveralls'
Put the Ruby version requirement within the gemspec
diff --git a/spec/json_test_data/data_structures/helpers/number_helper_spec.rb b/spec/json_test_data/data_structures/helpers/number_helper_spec.rb index abc1234..def5678 100644 --- a/spec/json_test_data/data_structures/helpers/number_helper_spec.rb +++ b/spec/json_test_data/data_structures/helpers/number_helper_spec.rb @@ -0,0 +1,19 @@+describe JsonTestData::NumberHelper do + include JsonTestData::NumberHelper + + describe "#adjust_for_maximum" do + context "no maximum" do + let(:number) { 3 } + + it "returns the given number" do + expect(adjust_for_maximum(number: number)).to eql number + end + end + + context "number less than maximum" do + end + + context "number greater than or equal to maximum" do + end + end +end
Add test coverage for number helper
diff --git a/disqus_rails.gemspec b/disqus_rails.gemspec index abc1234..def5678 100644 --- a/disqus_rails.gemspec +++ b/disqus_rails.gemspec @@ -21,6 +21,7 @@ spec.add_development_dependency "bundler" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" + spec.add_development_dependency 'sqlite3' spec.add_dependency "rails" end
Add sqlite3 development dependency for testing db
diff --git a/test/integration/multisite_test.rb b/test/integration/multisite_test.rb index abc1234..def5678 100644 --- a/test/integration/multisite_test.rb +++ b/test/integration/multisite_test.rb @@ -26,7 +26,7 @@ site! 'site1' sign_in_as people(:jim) get '/search', :browse => true - assert_select 'body', /1 person found/ + assert_select 'body', /1 Person found/ assert_select 'body', /Jim Williams/ assert_select 'body', :html => /Tom Jones/, :count => 0 get '/people/view/9'
Change test to pass with changes made to view.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,3 +3,9 @@ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "guideline" + +RSpec.configure do |config| + config.treat_symbols_as_metadata_keys_with_true_values = true + config.run_all_when_everything_filtered = true + config.filter_run :focus +end
Enable :focus option in rspec
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,21 +1,21 @@ # frozen_string_literal: true -if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS']) - require 'simplecov' - require 'coveralls' +if ENV["COVERAGE"] || ENV["TRAVIS"] + require "simplecov" + require "coveralls" - SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter - ] + ]) SimpleCov.start do - command_name 'spec' - add_filter 'spec' + command_name "spec" + add_filter "spec" end end -require 'tty-which' +require "tty-which" RSpec.configure do |config| config.expect_with :rspec do |expectations| @@ -34,7 +34,7 @@ config.warnings = true if config.files_to_run.one? - config.default_formatter = 'doc' + config.default_formatter = "doc" end config.profile_examples = 2
Change to remove ruby version check, update formatter to use new api and use double quoted strings
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,6 @@ require 'mimic' require 'rspec/expectations' -Rspec.configure do |config| +RSpec.configure do |config| config.mock_with :mocha end
Use "RSpec" instead of deprecated "Rspec".
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,11 +5,14 @@ require 'simplecov' require 'coveralls' -SimpleCov.formatter = Coveralls::SimpleCov::Formatter -SimpleCov.start do +Coveralls.wear! +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.start('rails') do add_filter '/spec/' end -#Coveralls.wear! # Dummy application require 'devise'
Update coveralls setting to detect all files in library
diff --git a/spec/exporters/formatters/section_indexable_formatter_spec.rb b/spec/exporters/formatters/section_indexable_formatter_spec.rb index abc1234..def5678 100644 --- a/spec/exporters/formatters/section_indexable_formatter_spec.rb +++ b/spec/exporters/formatters/section_indexable_formatter_spec.rb @@ -4,7 +4,7 @@ RSpec.describe SectionIndexableFormatter do let(:section) { double( - :manual_section, + :section, title: double, summary: double, slug: "",
Rename spec double `manual_section` -> `section` We renamed SpecialistDocument to Section in 9b0ef01e0. ManualSection is another synonym for Section so this commit renames for consistency.
diff --git a/app/serializers/api/v1/project_serializer.rb b/app/serializers/api/v1/project_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/api/v1/project_serializer.rb +++ b/app/serializers/api/v1/project_serializer.rb @@ -11,7 +11,15 @@ end link(:self) { api_project_path(object.id) } - link(:github) { "https://github.com/#{object.github_url}" } + link(:github) { + { + meta: { + rel: 'github', + title: "@#{object.github_url}" + }, + href: "https://github.com/#{object.github_url}" + } + } has_one :project_status, key: :status has_many :project_categories, key: :categories end
Make project links consistent with user links
diff --git a/app/workers/import_connection_data_worker.rb b/app/workers/import_connection_data_worker.rb index abc1234..def5678 100644 --- a/app/workers/import_connection_data_worker.rb +++ b/app/workers/import_connection_data_worker.rb @@ -5,16 +5,21 @@ # rubocop:disable Metrics/MethodLength # rubocop:disable Metrics/AbcSize def perform(connection_id) - Developer.connection_pool.with_connection do - connection = Connection.find(connection_id) - connection.imports.delete_all + connection = Connection.find(connection_id) + connection.imports.delete_all + + Import.connection_pool.with_connection do connection.fetch_data.each do |item| - connection.imports.create( - developer: connection.developer, - source_id: item.id, - source_name: connection.provider, - data: serializer.decode_hash(item.to_attrs) - ) + date_field = date_fields.detect { |field| item.key?(field) } + ActiveRecord::Base.transaction do + connection.imports.create( + developer: connection.developer, + source_id: item['id'], + created_at: item[date_field], + source_name: connection.provider, + data: item + ) + end end end @@ -26,7 +31,7 @@ ActiveRecord::Base.connection.close end - def serializer - Sawyer::Serializer.new('json') + def date_fields + %w(creation_date startDate publishedAt pushed_at) end end
Add created at from imported item
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -Rooms::Application.config.session_store :cookie_store, key: '_room_reservation_session'#, :domain => ENV['ROOMS_COOKIE_DOMAIN'] +Rooms::Application.config.session_store :cookie_store, key: '_room_reservation_session', domain: :all # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information
Make session cookie domain :all for single sign out
diff --git a/spec/initializers/trusted_proxies_spec.rb b/spec/initializers/trusted_proxies_spec.rb index abc1234..def5678 100644 --- a/spec/initializers/trusted_proxies_spec.rb +++ b/spec/initializers/trusted_proxies_spec.rb @@ -0,0 +1,51 @@+require 'spec_helper' + +describe 'trusted_proxies', lib: true do + context 'with default config' do + before do + set_trusted_proxies([]) + end + + it 'preserves private IPs as remote_ip' do + request = stub_request('HTTP_X_FORWARDED_FOR' => '10.1.5.89') + expect(request.remote_ip).to eq('10.1.5.89') + end + + it 'filters out localhost from remote_ip' do + request = stub_request('HTTP_X_FORWARDED_FOR' => '1.1.1.1, 10.1.5.89, 127.0.0.1') + expect(request.remote_ip).to eq('10.1.5.89') + end + end + + context 'with private IP ranges added' do + before do + set_trusted_proxies([ "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" ]) + end + + it 'filters out private and local IPs from remote_ip' do + request = stub_request('HTTP_X_FORWARDED_FOR' => '1.2.3.6, 1.1.1.1, 10.1.5.89, 127.0.0.1') + expect(request.remote_ip).to eq('1.1.1.1') + end + end + + context 'with proxy IP added' do + before do + set_trusted_proxies([ "60.98.25.47" ]) + end + + it 'filters out proxy IP from remote_ip' do + request = stub_request('HTTP_X_FORWARDED_FOR' => '1.2.3.6, 1.1.1.1, 60.98.25.47, 127.0.0.1') + expect(request.remote_ip).to eq('1.1.1.1') + end + end + + def stub_request(headers = {}) + ActionDispatch::RemoteIp.new(Proc.new { }, false, Rails.application.config.action_dispatch.trusted_proxies).call(headers) + ActionDispatch::Request.new(headers) + end + + def set_trusted_proxies(proxies = []) + stub_config_setting('trusted_proxies' => proxies) + load File.join(__dir__, '../../config/initializers/trusted_proxies.rb') + end +end
Add tests for setting trusted_proxies Each test reloads the trusted_proxies initializer, which in turn will set Rails.application.config.action_dispatch.trusted_proxies to something new. This will leak into the other tests, but the middleware that it is used in has already been loaded for the whole test suite, so it should have no impact.
diff --git a/spec/models/canonical_temperature_spec.rb b/spec/models/canonical_temperature_spec.rb index abc1234..def5678 100644 --- a/spec/models/canonical_temperature_spec.rb +++ b/spec/models/canonical_temperature_spec.rb @@ -2,10 +2,10 @@ describe CanonicalTemperature do describe "getting readings" do - it "saves a new record when a reading is not found" do + # TODO: get timecop so we can stub this properly + xit "saves a new record when a reading is not found" do zip_code = 10004 - datetime = DateTime.parse("2015-03-01 15:00:00") - outdoor_temp = CanonicalTemperature.get_reading(zip_code, datetime) + outdoor_temp = CanonicalTemperature.get_hourly_reading(zip_code) expect(outdoor_temp).to be_a Integer end end
Remove test relating to CanonicalTemperature class
diff --git a/app/services/spree_shopify_importer/importers/order_importer.rb b/app/services/spree_shopify_importer/importers/order_importer.rb index abc1234..def5678 100644 --- a/app/services/spree_shopify_importer/importers/order_importer.rb +++ b/app/services/spree_shopify_importer/importers/order_importer.rb @@ -27,7 +27,7 @@ end def shopify_class - ShopifyAPI::Product + ShopifyAPI::Order end end end
Fix typo after changing namespace
diff --git a/discover.gemspec b/discover.gemspec index abc1234..def5678 100644 --- a/discover.gemspec +++ b/discover.gemspec @@ -6,8 +6,8 @@ Gem::Specification.new do |spec| spec.name = "discover" spec.version = Discover::VERSION - spec.authors = ["Jonathan Rudenberg"] - spec.email = ["jonathan@titanous.com"] + spec.authors = ["Jonathan Rudenberg", "Lewis Marshall"] + spec.email = ["jonathan@titanous.com", "lewis@lmars.net"] spec.summary = %q{A discoverd client for Ruby} spec.description = %q{A discoverd client for Ruby} spec.homepage = ""
Add Lewis Marshall to gem authors Signed-off-by: Lewis Marshall <748e1641a368164906d4a0c0e3965345453dcc93@lmars.net>
diff --git a/exe/factorize-timeline.rb b/exe/factorize-timeline.rb index abc1234..def5678 100644 --- a/exe/factorize-timeline.rb +++ b/exe/factorize-timeline.rb @@ -15,7 +15,7 @@ puts "Following user stream and tweeting as @#{self_user}" Tw::Client::Stream.new(self_user).user_stream do |tweet| next if tweet.user == self_user - nums = tweet.text.scan(/(?:[^-\.\d]|\A)(\d+)(?:[^\.\d]|\z)/).map{|e| e[0].to_i}.reject{|e| e <= 1} + nums = tweet.text.scan(/[\d\.-]+/).reject{|e| e =~ /(-|\.)/}.map{|e| e.to_i}.reject{|e| e <= 1} next if nums.empty? factors = nums.map{|n|
Fix regexp to fetch intger 437=23x19 now yields 437, 23, and 19. 23 was missing before.
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/chef/attributes/default.rb +++ b/cookbooks/chef/attributes/default.rb @@ -5,4 +5,4 @@ default[:chef][:server][:version] = "12.17.33" # Set the default client version -default[:chef][:client][:version] = "13.10.4" +default[:chef][:client][:version] = "14.4.56"
Update chef client to 14.4.56
diff --git a/lib/config_file_loader.rb b/lib/config_file_loader.rb index abc1234..def5678 100644 --- a/lib/config_file_loader.rb +++ b/lib/config_file_loader.rb @@ -3,7 +3,8 @@ class ConfigFileLoader DEFAULT_PHUSION_GITHUB_USERS = [ 'FoobarWidget', - 'OnixGH' + 'OnixGH', + 'camjn' ] def load
Add Camden to list of Phusion Github users
diff --git a/lib/daimon/render/html.rb b/lib/daimon/render/html.rb index abc1234..def5678 100644 --- a/lib/daimon/render/html.rb +++ b/lib/daimon/render/html.rb @@ -3,9 +3,9 @@ class HTML < Redcarpet::Render::HTML def block_quote(quote) blockquotes = quote.each_line("").map do |paragraph| - "<blockquote>\n#{paragraph.strip}\n</blockquote>" + "\n<blockquote>\n#{paragraph.strip}\n</blockquote>" end - blockquotes.join("\n") + "#{blockquotes.join("\n")}\n" end end end
Add line breaks to close to the original behavior
diff --git a/lib/data_loader/people.rb b/lib/data_loader/people.rb index abc1234..def5678 100644 --- a/lib/data_loader/people.rb +++ b/lib/data_loader/people.rb @@ -11,12 +11,12 @@ def self.load_missing_images! Person.where(small_image_url: nil).find_each do |person| puts "Checking small photo for person #{person.id}..." - url = "http://www.openaustralia.org/images/mps/#{person.id}.jpg" + url = "https://www.openaustralia.org/images/mps/#{person.id}.jpg" person.update_attributes(small_image_url: url) if CheckResourceExists.call(url) end Person.where(large_image_url: nil).find_each do |person| puts "Checking large photo for person #{person.id}..." - url = "http://www.openaustralia.org/images/mpsL/#{person.id}.jpg" + url = "https://www.openaustralia.org/images/mpsL/#{person.id}.jpg" person.update_attributes(large_image_url: url) if CheckResourceExists.call(url) end end
Use ssl for member images now
diff --git a/lib/engineyard/version.rb b/lib/engineyard/version.rb index abc1234..def5678 100644 --- a/lib/engineyard/version.rb +++ b/lib/engineyard/version.rb @@ -1,4 +1,4 @@ module EY - VERSION = '3.0.1' + VERSION = '3.0.2.pre' ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.4.2' end
Add .pre for next release
diff --git a/app/helpers/page_fragments/fragments_helper.rb b/app/helpers/page_fragments/fragments_helper.rb index abc1234..def5678 100644 --- a/app/helpers/page_fragments/fragments_helper.rb +++ b/app/helpers/page_fragments/fragments_helper.rb @@ -13,7 +13,7 @@ def title(new_title=nil) # Prevent title from being set if rendering a fragment - @page && @page.fragment? ? super() : super + is_page_fragment?(@page) ? super() : super end private @@ -34,4 +34,8 @@ node end end + + def is_page_fragment?(page) + page && page.respond_to?(:fragment?) && page.fragment? + end end
Fix title method for error pages
diff --git a/black_list.rb b/black_list.rb index abc1234..def5678 100644 --- a/black_list.rb +++ b/black_list.rb @@ -9,6 +9,7 @@ ["coq-compcert.3.1.0", "Error: Corrupted compiled interface"], # flaky Makefile ["coq-compcert.3.2.0", "Error: Corrupted compiled interface"], # flaky Makefile ["coq-compcert.3.3.0", "Error: Corrupted compiled interface"], # flaky Makefile + ["coq-compcert.3.4", "Error: Corrupted compiled interface"], # flaky Makefile ["coq-compcert.3.5", "Error: Corrupted compiled interface"], # flaky Makefile ["coq-metacoq-erasure.1.0~alpha+8.8", "make inconsistent assumptions over interface Quoter"], ["coq-stalmarck.8.5.0", "Error: Could not find the .cmi file for interface stal.mli."], # flaky Makefile
Add compcert 3.4 to the black-list
diff --git a/Rakefile.rb b/Rakefile.rb index abc1234..def5678 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -3,12 +3,16 @@ $projectSolution = 'src/MongoMigrations.sln' $artifactsPath = "build" -$nugetFeedPath = ENV["NuGetDevFeed"] +$nugetFeedPath = ENV["NuGetDevFeed"] || '.' $srcPath = File.expand_path('src') task :build => [:build_release] -msbuild :build_release => [:clean] do |msb| +task :restore_packages do + sh "nuget restore #{$projectSolution}" +end + +msbuild :build_release => [:clean, :restore_packages] do |msb| msb.properties :configuration => :Release msb.targets :Build msb.solution = $projectSolution
Fix up rake builds after removing old school nuget package restore via msbuild. Now, run nuget restore before building. Also, store package locally if no NuGetDevFeed specified in an environment variable.
diff --git a/RubyTest.rb b/RubyTest.rb index abc1234..def5678 100644 --- a/RubyTest.rb +++ b/RubyTest.rb @@ -4,4 +4,9 @@ name.reverse! puts "Your name backwards is #{name}" name.upcase! -puts "Your name backwards and upcase is #{name}!"+puts "Your name backwards and upcase is #{name}!" +puts "Enter your last name:" +lastname = gets.chomp +name.reverse! +name.capitalize! +puts "Your name is #{name} #{lastname}"
Add last name functionality for double the fun...ctionality
diff --git a/db/migrate/004_add_visual_to_entries.rb b/db/migrate/004_add_visual_to_entries.rb index abc1234..def5678 100644 --- a/db/migrate/004_add_visual_to_entries.rb +++ b/db/migrate/004_add_visual_to_entries.rb @@ -0,0 +1,8 @@+class AddVisualToEntries < ActiveRecord::Migration + def change + add_column :entries, :title , :string + add_column :entries, :description, :string + add_column :entries, :visual_url , :string + add_column :entries, :locale , :string + end +end
Add migration file that add title, description, visual_url, locale to entries
diff --git a/adapter_extensions.gemspec b/adapter_extensions.gemspec index abc1234..def5678 100644 --- a/adapter_extensions.gemspec +++ b/adapter_extensions.gemspec @@ -21,7 +21,6 @@ s.add_runtime_dependency('activesupport', '>= 2.1.0') s.add_runtime_dependency('activerecord', '>= 2.1.0') s.add_development_dependency('flexmock') - s.add_development_dependency('mysql2', '< 0.3') s.add_development_dependency('rdoc') s.files = `git ls-files`.split("\n")
Remove mysql2 from development dependencies - not needed anymore now.
diff --git a/core/app/models/spree/option_type.rb b/core/app/models/spree/option_type.rb index abc1234..def5678 100644 --- a/core/app/models/spree/option_type.rb +++ b/core/app/models/spree/option_type.rb @@ -21,7 +21,7 @@ default_scope -> { order(:position) } - accepts_nested_attributes_for :option_values, reject_if: lambda { |ov| ov[:name].blank? || ov[:presentation].blank? }, allow_destroy: true + accepts_nested_attributes_for :option_values, reject_if: lambda { |ov| ov[:name].blank? && ov[:presentation].blank? }, allow_destroy: true after_touch :touch_all_products after_save :touch_all_products
Change requirements for rejecting an option value Before if either field was blank it would be rejected by the option type model. This led to a confusing behaviour where you could have one field filled in and the other blank and try to update and be told it updated successfully while it lost the option type you had started without telling you that. Now this will throw an error if you try that telling you that the option type did not save. However if both fields are blank it will just reject the option type.
diff --git a/lib/gds_api/json_utils.rb b/lib/gds_api/json_utils.rb index abc1234..def5678 100644 --- a/lib/gds_api/json_utils.rb +++ b/lib/gds_api/json_utils.rb @@ -4,14 +4,15 @@ require_relative 'core-ext/openstruct' module GdsApi::JsonUtils - + USER_AGENT = "GDS Api Client v. #{GdsApi::VERSION}" + def get_json(url) url = URI.parse(url) request = url.path request = request + "?" + url.query if url.query response = Net::HTTP.start(url.host, url.port) do |http| - http.get(request, {'Accept' => 'application/json'}) + http.get(request, {'Accept' => 'application/json', 'User-Agent' => USER_AGENT}) end if response.code.to_i != 200 return nil @@ -23,7 +24,7 @@ def post_json(url,params) url = URI.parse(url) Net::HTTP.start(url.host, url.port) do |http| - post_response = http.post(url.path, params.to_json, {'Content-Type' => 'application/json'}) + post_response = http.post(url.path, params.to_json, {'Content-Type' => 'application/json', 'User-Agent' => USER_AGENT}) if post_response.code == '200' return JSON.parse(post_response.body) end
Set a user agent for our http clients
diff --git a/lib/miq_expression/tag.rb b/lib/miq_expression/tag.rb index abc1234..def5678 100644 --- a/lib/miq_expression/tag.rb +++ b/lib/miq_expression/tag.rb @@ -6,19 +6,22 @@ -(?<column>[a-z]+[_[:alnum:]]+) /x + MANAGED_NAMESPACE = 'managed'.freeze + USER_NAMESPACE = 'user'.freeze + attr_reader :namespace def self.parse(field) match = TAG_REGEX.match(field) || return associations = match[:associations].split(".") - namespace = match[:namespace] == 'user_tag' ? 'user' : match[:namespace] - new(match[:model_name].classify.safe_constantize, associations, "/#{namespace}/#{match[:column]}") + model = match[:model_name].classify.safe_constantize + new(model, associations, match[:column], match[:namespace] == MANAGED_NAMESPACE) end - def initialize(model, associations, namespace) - super(model, associations, namespace.split("/").last) - @namespace = namespace + def initialize(model, associations, column, managed = true) + super(model, associations, column) + @namespace = "/#{managed ? MANAGED_NAMESPACE : USER_NAMESPACE}/#{column}" end def contains(value)
Set namespace by using constants there are only 2 possible namespaces.
diff --git a/spec/controllers/static_content_controller_spec.rb b/spec/controllers/static_content_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/static_content_controller_spec.rb +++ b/spec/controllers/static_content_controller_spec.rb @@ -8,21 +8,21 @@ context '#show' do it 'accepts path as root' do page = create(:page, slug: '/', stores: [store]) - allow(controller.request).to receive(:path).and_return(page.slug) + request.path = page.slug spree_get :show, path: page.slug expect(response).to be_success end it 'accepts path as string' do page = create(:page, slug: 'hello', stores: [store]) - allow(controller.request).to receive(:path).and_return(page.slug) + request.path = page.slug spree_get :show, path: page.slug expect(response).to be_success end it 'accepts path as nested' do page = create(:page, slug: 'aa/bb/cc', stores: [store]) - allow(controller.request).to receive(:path).and_return(page.slug) + request.path = page.slug spree_get :show, path: page.slug expect(response).to be_success end
Set request path instead of using stubbing
diff --git a/lib/sass/tree/for_node.rb b/lib/sass/tree/for_node.rb index abc1234..def5678 100644 --- a/lib/sass/tree/for_node.rb +++ b/lib/sass/tree/for_node.rb @@ -1,7 +1,17 @@ require 'sass/tree/node' module Sass::Tree + # A dynamic node representing a Sass `@for` loop. + # + # @see Sass::Tree class ForNode < Node + # @param var [String] The name of the loop variable + # @param from [Script::Node] The parse tree for the initial expression + # @param to [Script::Node] The parse tree for the final expression + # @param exclusive [Boolean] Whether to include `to` in the loop + # or stop just before + # @param options [Hash<Symbol, Object>] An options hash; + # see [the Sass options documentation](../../Sass.html#sass_options) def initialize(var, from, to, exclusive, options) @var = var @from = from @@ -12,6 +22,13 @@ protected + # Runs the child nodes once for each time through the loop, + # varying the variable each time. + # + # @param environment [Sass::Environment] The lexical environment containing + # variable and mixin values + # @return [Array<Tree::Node>] The resulting static nodes + # @see Sass::Tree def _perform(environment) from = @from.perform(environment).to_i to = @to.perform(environment).to_i
[Sass] Convert Sass::Tree::ForNode docs to YARD.
diff --git a/lib/skr/print/template.rb b/lib/skr/print/template.rb index abc1234..def5678 100644 --- a/lib/skr/print/template.rb +++ b/lib/skr/print/template.rb @@ -16,6 +16,7 @@ "skr/#{name}".classify.constantize end def path_for_record(record) + return nil unless record.form path = @path.join( record.form + '.tex' ) path.exist? ? path : @path.join( 'default.tex' ) end
Abort if form isn't set
diff --git a/lib/strategy/whitelist.rb b/lib/strategy/whitelist.rb index abc1234..def5678 100644 --- a/lib/strategy/whitelist.rb +++ b/lib/strategy/whitelist.rb @@ -16,6 +16,7 @@ end end dest_record = dest_table.new dest_record_map + dest_record.assign_attributes(dest_record_map, without_protection: true) @primary_keys.each do |key| dest_record[key] = record[key] end
Fix for rails mass-assignment protection In rails 3.2.8, mass assignment can mean that the ActiveModel class doesn't support mass assignment. This change ignores any such protection and assumes it's your own data and you know what you're doing with it.
diff --git a/lib/tasks/taskmaster.rake b/lib/tasks/taskmaster.rake index abc1234..def5678 100644 --- a/lib/tasks/taskmaster.rake +++ b/lib/tasks/taskmaster.rake @@ -7,7 +7,7 @@ puts output end - desc "Write the generated crontab to config/schedule.rb -- suitable for whenever to write it to the system" + desc "Write the generated crontab to config/schedule.rb -- suitable for whenever to write it to the system\n" task :write do output = Taskmaster.aggregate_whenever FileUtils.mkdir_p 'config'
Add a newline to prevent run-on comment + command lines
diff --git a/test/integration/woeid_urls_are_valid_test.rb b/test/integration/woeid_urls_are_valid_test.rb index abc1234..def5678 100644 --- a/test/integration/woeid_urls_are_valid_test.rb +++ b/test/integration/woeid_urls_are_valid_test.rb @@ -2,17 +2,17 @@ class WoeidUrlParamValid < ActionDispatch::IntegrationTest - it "should redirect if woeid is not type town" do + it "redirects if woeid is not type town" do get '/es/woeid/23424801/give' #woeid of Ecuador Country assert_redirected_to '/es/location/change' end - it "should redirect if woeid is not an integer" do + it "redirects if woeid is not an integer" do get '/es/woeid/234LOOOOOOOOOOOOL24801/give' assert_redirected_to '/es/location/change' end - it "should redirect if woeid is not a valid woeid" do + it "redirects if woeid is not a valid woeid" do get '/es/woeid/222222/give' #woeid does not exists assert_redirected_to '/es/location/change' end
Drop should style from woeid redirection tests
diff --git a/api/app/controllers/spree/api/v1/inventory_units_controller.rb b/api/app/controllers/spree/api/v1/inventory_units_controller.rb index abc1234..def5678 100644 --- a/api/app/controllers/spree/api/v1/inventory_units_controller.rb +++ b/api/app/controllers/spree/api/v1/inventory_units_controller.rb @@ -34,7 +34,7 @@ unless inventory_unit.respond_to?(can_event) && inventory_unit.send(can_event) - render :text => { exception: "cannot transition to #{@event}" }.to_json, + render :text => { :exception => "cannot transition to #{@event}" }.to_json, :status => 200 false end
[api] Convert 1.9 hash syntax to hashrocket syntax within inventory_units controller Fixes #2398 Fixes #2400
diff --git a/test/services/publisher_wallet_getter_test.rb b/test/services/publisher_wallet_getter_test.rb index abc1234..def5678 100644 --- a/test/services/publisher_wallet_getter_test.rb +++ b/test/services/publisher_wallet_getter_test.rb @@ -0,0 +1,61 @@+require "test_helper" +require "webmock/minitest" + +class PublisherWalletGetterTest < ActiveJob::TestCase + test "when offline returns a wallet with fake data" do + prev_offline = Rails.application.secrets[:api_eyeshade_offline] + begin + Rails.application.secrets[:api_eyeshade_offline] = true + + publisher = publishers(:verified) + result = PublisherWalletGetter.new(publisher: publisher).perform + + assert result.kind_of?(Eyeshade::Wallet) + + ensure + Rails.application.secrets[:api_eyeshade_offline] = prev_offline + end + end + + test "when online, for site publishers, returns a wallet" do + prev_offline = Rails.application.secrets[:api_eyeshade_offline] + begin + Rails.application.secrets[:api_eyeshade_offline] = false + + publisher = publishers(:verified) + wallet = "{\"wallet\":\"abc123\"}" + + stub_request(:get, /v2\/publishers\/verified\.org\/wallet/). + with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}). + to_return(status: 200, body: wallet, headers: {}) + + result = PublisherWalletGetter.new(publisher: publisher).perform + + assert result.kind_of?(Eyeshade::Wallet) + assert_equal JSON.parse(wallet), result.wallet_json + ensure + Rails.application.secrets[:api_eyeshade_offline] = prev_offline + end + end + + test "when online, for YT publishers, returns a wallet" do + prev_offline = Rails.application.secrets[:api_eyeshade_offline] + begin + Rails.application.secrets[:api_eyeshade_offline] = false + + publisher = publishers(:google_verified) + wallet = "{\"wallet\":\"abc123\"}" + + stub_request(:get, /v1\/owners\/oauth%23google:abc123\/wallet/). + with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}). + to_return(status: 200, body: wallet, headers: {}) + + result = PublisherWalletGetter.new(publisher: publisher).perform + + assert result.kind_of?(Eyeshade::Wallet) + assert_equal JSON.parse(wallet), result.wallet_json + ensure + Rails.application.secrets[:api_eyeshade_offline] = prev_offline + end + end +end
Add tests for PublisherWalletGetter service
diff --git a/db/migrate/20160513160206_initial_migration.rb b/db/migrate/20160513160206_initial_migration.rb index abc1234..def5678 100644 --- a/db/migrate/20160513160206_initial_migration.rb +++ b/db/migrate/20160513160206_initial_migration.rb @@ -0,0 +1,30 @@+class InitialMigration < ActiveRecord::Migration + def change + create_table :links do |t| + t.string :uri + t.integer :upvote_count + t.integer :downvote_count + + t.timestamps null: false + end + + create_table :tags do |t| + t.string :name + t.integer :sequence + + t.timestamps null: false + end + + create_table :links_tags do |t| + t.belongs_to :links, index: true + t.belongs_to :tags, index: true + end + + create_table :comments do |t| + t.belongs_to :link, index: true + t.string :body + + t.timestamps null: false + end + end +end
Create initial migration sans user table.
diff --git a/0_code_wars/find_missing_numbers.rb b/0_code_wars/find_missing_numbers.rb index abc1234..def5678 100644 --- a/0_code_wars/find_missing_numbers.rb +++ b/0_code_wars/find_missing_numbers.rb @@ -0,0 +1,5 @@+# http://www.codewars.com/kata/find-missing-numbers/ +# --- iteration 1 --- +def find_missing_numbers(arr) + Range.new(*arr.minmax).to_a - arr rescue [] +end
Add code wars (7) - find missing numbers
diff --git a/Casks/firefoxdeveloperedition-ja.rb b/Casks/firefoxdeveloperedition-ja.rb index abc1234..def5678 100644 --- a/Casks/firefoxdeveloperedition-ja.rb +++ b/Casks/firefoxdeveloperedition-ja.rb @@ -1,6 +1,6 @@ class FirefoxdevelopereditionJa < Cask - version '33.0a2' - sha256 'ea56c43a6e93789765af356ce812c64a51cb9d0da33d21bef6d4aed54428a1a7' + version '35.0a2' + sha256 '3f990fbf7fe911efd27aaa22fae6b7e42f5f132792b08efc90ffa453fb2b6d78' url "https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-aurora-l10n/firefox-#{version}.ja-JP-mac.mac.dmg" homepage 'https://www.mozilla.org/ja/firefox/developer/'
Upgrade Firefox Dev Edition to 35.0a2
diff --git a/app/models/events/event.rb b/app/models/events/event.rb index abc1234..def5678 100644 --- a/app/models/events/event.rb +++ b/app/models/events/event.rb @@ -1,4 +1,8 @@ class Event < ActiveRecord::Base + + # REDSHIFT_DATABASE_URL must exist on heroku + # heroku config:set DATABASE_URL="redshift://<redshit_user>:<redshift_password>@<amazon_redshift_host>:5439/snowplow?sslca=config/redshift-ssl-ca-cert.pem" -a <heroku_app_name> + establish_connection(ENV['REDSHIFT_DATABASE_URL'] ||= Rails.env) scope :group_by_date, -> { group('collector_tstamp::date') } scope :order_by_date, -> { order('collector_tstamp::date') }
Use REDSHIFT_DATABASE_URL env var if exits Must exists on Heroku. Just run: heroku config:set DATABASE_URL="redshift://<redshit_user>:<redshift_password>@<amazon_redshift_host>:5439/snowplow?sslca=config/redshift-ssl-ca-cert.pem" -a <heroku_app_name>
diff --git a/app/controllers/account/collaborators_controller.rb b/app/controllers/account/collaborators_controller.rb index abc1234..def5678 100644 --- a/app/controllers/account/collaborators_controller.rb +++ b/app/controllers/account/collaborators_controller.rb @@ -54,7 +54,11 @@ def create_params params.require(:collaborator).permit( - :email, + :title, + :first_name, + :last_name, + :phone_number, + :email, :role ) end
Save other fields for creating collaborators