diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/features/consumer/account/settings_spec.rb b/spec/features/consumer/account/settings_spec.rb index abc1234..def5678 100644 --- a/spec/features/consumer/account/settings_spec.rb +++ b/spec/features/consumer/account/settings_spec.rb @@ -18,7 +18,12 @@ expect(page).to have_content I18n.t('spree.users.form.account_settings') fill_in 'user_email', with: 'new@email.com' - click_button I18n.t(:update) + expect do + click_button I18n.t(:update) + end.to send_confirmation_instructions + + sent_mail = ActionMailer::Base.deliveries.last + expect(sent_mail.to).to eq ['new@email.com'] expect(find(".alert-box.success").text.strip).to eq "#{I18n.t(:account_updated)} ×" user.reload
Update account setting spec for updating email address
diff --git a/spec/features/save_parameters_in_localstorage_spec.rb b/spec/features/save_parameters_in_localstorage_spec.rb index abc1234..def5678 100644 --- a/spec/features/save_parameters_in_localstorage_spec.rb +++ b/spec/features/save_parameters_in_localstorage_spec.rb @@ -1,14 +1,20 @@-feature 'Save server URL in localStorage', :js => true do - scenario 'Put server URL in form and process form' do +feature 'Save form parameters in localStorage', :js => true do + scenario 'Input form parameters and process form' do visit '/' - fill_in 'uri', :with => 'http://localhost:7474/' + fill_in 'uri', :with => 'http://localhost:7474/' + fill_in 'query', :with => 'START n=node({id}) RETURN n' + fill_in 'node_id', :with => '1' click_on 'Run query' Capybara.reset! end - scenario 'Check that server URL is back from localStorage' do + scenario 'Check that form parameters are back from localStorage' do visit '/' find_field('uri').value == 'http://localhost:7474/' page.evaluate_script("localStorage.removeItem('uri')"); + find_field('query').value == 'START n=node({id}) RETURN n' + page.evaluate_script("localStorage.removeItem('query')"); + find_field('node_id').value == '1' + page.evaluate_script("localStorage.removeItem('node_id')"); end end
Add test for all form parameters save in localStorage
diff --git a/spec/lib/core/entity/search_result_collection_spec.rb b/spec/lib/core/entity/search_result_collection_spec.rb index abc1234..def5678 100644 --- a/spec/lib/core/entity/search_result_collection_spec.rb +++ b/spec/lib/core/entity/search_result_collection_spec.rb @@ -13,6 +13,8 @@ it { is_expected.to respond_to :per_page } it { is_expected.to respond_to :per_page= } + it { is_expected.to respond_to :items } + it { is_expected.to respond_to :query } it 'is a collection' do
Add test for `items` attribute
diff --git a/app/models/edition.rb b/app/models/edition.rb index abc1234..def5678 100644 --- a/app/models/edition.rb +++ b/app/models/edition.rb @@ -26,7 +26,7 @@ end def new_action(user,type,comment) - self.actions << Action.new(:requester=>self._id,:request_type=>type,:comment=>comment) + self.actions << Action.new(:requester_id=>self._id,:request_type=>type,:comment=>comment) self.guide.calculate_statuses end
Use requester_id for actions rather than requester
diff --git a/spec/controllers/dashboard_controller_spec.rb b/spec/controllers/dashboard_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/dashboard_controller_spec.rb +++ b/spec/controllers/dashboard_controller_spec.rb @@ -2,6 +2,14 @@ describe DashboardController do describe 'GET #show' do + context 'when user is not signed in' do + it 'redirects to sign in url' do + get :show + + expect(response).to redirect_to signin_path + end + end + it 'renders the :show template' do login_user build_stubbed(:user)
Add sign in redirection in dashboard controller spec
diff --git a/app/models/asset.rb b/app/models/asset.rb index abc1234..def5678 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -18,7 +18,7 @@ def set_metadata if url =~ /\ |\[/ - self.url = URI.encode(url) + self.url = URI.encode(url,/\[\]/) end real_url = Link.resolve_uri(url) response = Link.response(real_url)
Deal with brackets in urls
diff --git a/app/models/email.rb b/app/models/email.rb index abc1234..def5678 100644 --- a/app/models/email.rb +++ b/app/models/email.rb @@ -4,7 +4,8 @@ def check_account account = Account.where(slug: self.to.split('@')[0]).first if account && !account.empty? - + self.account_id = account.id + self.save end end end
Save the PLANT THE FLAG
diff --git a/htmlentities.gemspec b/htmlentities.gemspec index abc1234..def5678 100644 --- a/htmlentities.gemspec +++ b/htmlentities.gemspec @@ -14,5 +14,7 @@ s.test_files = Dir["test/*_test.rb"] s.has_rdoc = true s.extra_rdoc_files = %w[History.txt COPYING.txt] - s.homepage = "http://htmlentities.rubyforge.org/" + s.homepage = "https://github.com/threedaymonk/htmlentities" + s.add_development_dependency "mocha" + s.add_development_dependency "active_support", "3.1.0" end
Add development dependencies to gemspec.
diff --git a/spec/support/matchers/method_type_matchers.rb b/spec/support/matchers/method_type_matchers.rb index abc1234..def5678 100644 --- a/spec/support/matchers/method_type_matchers.rb +++ b/spec/support/matchers/method_type_matchers.rb @@ -1,9 +1,11 @@-RSpec::Matchers.define :have_return_type do |type| +# @example +# expect(YARD::Registry.at("User#friends")).to have_return_type("Array<User>") +RSpec::Matchers.define :have_return_type do |yard_type_string| match do |method_object| return_tags = method_object.tags(:return) expect(return_tags.size).to be > 0 - expect(return_tags.any? { |tag| tag.types.include?(type) }).to be_true + expect(return_tags.any? { |tag| tag.types.include?(yard_type_string) }).to be_true end end
Improve documentation for `have_return_type` rspec matcher
diff --git a/spec/unit/alf-support/test_to_ruby_literal.rb b/spec/unit/alf-support/test_to_ruby_literal.rb index abc1234..def5678 100644 --- a/spec/unit/alf-support/test_to_ruby_literal.rb +++ b/spec/unit/alf-support/test_to_ruby_literal.rb @@ -7,16 +7,14 @@ end it 'works on DateTime' do - dt = DateTime.parse('2012-05-11T12:00:00+02:00') + dt = DateTime.parse('2012-05-11T12:00:00+00:00') rl = Support.to_ruby_literal(dt) - rl.should eql("DateTime.parse('2012-05-11T12:00:00+02:00')") ::Kernel.eval(rl).should eq(dt) end it 'works on Time' do - t = Time.parse('2012-05-11T12:00:00+02:00') + t = Time.parse('2012-05-11T12:00:00+00:00') rl = Support.to_ruby_literal(t) - rl.should eql("Time.parse('2012-05-11T12:00:00+02:00')") ::Kernel.eval(rl).should eq(t) end
Fix to_ruby_literal test on DateTime/Time
diff --git a/Cartography.podspec b/Cartography.podspec index abc1234..def5678 100644 --- a/Cartography.podspec +++ b/Cartography.podspec @@ -11,7 +11,9 @@ s.homepage = "https://github.com/robb/Cartography" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Robert Böhnke" => "robb@robb.is" } + s.ios.deployment_target = "8.0" + s.osx.deployment_target = "10.9" s.source = { :git => "https://github.com/robb/Cartography.git", :tag => "#{s.version}" } s.source_files = "Cartography/*.swift"
Set OS X deployment target
diff --git a/Casks/opera-beta.rb b/Casks/opera-beta.rb index abc1234..def5678 100644 --- a/Casks/opera-beta.rb +++ b/Casks/opera-beta.rb @@ -1,6 +1,6 @@ cask :v1 => 'opera-beta' do - version '29.0.1795.41' - sha256 'e7f013637993189ee96409fd647bbc00fa94bde544e2604c36cde230ad717063' + version '30.0.1835.18' + sha256 '7c27bfd506a5d3a9a41eabd27908344269d1d4f5a85d451d2d2ce0a9ee602993' url "http://get.geo.opera.com/pub/opera-beta/#{version}/mac/Opera_beta_#{version}_Setup.dmg" homepage 'http://www.opera.com/computer/beta'
Upgrade Opera Beta.app to v30.0.1835.18
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -12,7 +12,7 @@ end 100.times do - Student.create!(first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, grade: 1, gpa: 1.5, detentions: 1, gender: 'M', teacher_id: rand(1..30)) + Student.create!(first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, grade: 1, gpa: 1.5, detentions: 1, gender: 'M', teacher_id: rand(1..30), snack_food: Faker::Lorem.word, shirt_size: [XS,S,M,L,XL,XXL,XXXL,XXXXL,XXXXXL].sample) end User.create!(first_name: "Tom", last_name: "McHenry", username: "tommchenry", password:"test")
Change seed.rb to add snack food, shirt size
diff --git a/tests/spec/features/compilation_targets_spec.rb b/tests/spec/features/compilation_targets_spec.rb index abc1234..def5678 100644 --- a/tests/spec/features/compilation_targets_spec.rb +++ b/tests/spec/features/compilation_targets_spec.rb @@ -1,7 +1,10 @@ require 'spec_helper' require 'support/editor' +require 'support/playground_actions' RSpec.feature "Compiling to different formats", type: :feature, js: true do + include PlaygroundActions + before do visit '/' editor.set(code) @@ -28,6 +31,18 @@ end end + scenario "compiling to MIR" do + within('.header') do + choose_styled("Nightly") + click_on("MIR") + end + + within('.output-code') do + expect(page).to have_content 'StorageLive' + expect(page).to have_content 'StorageDead' + end + end + def editor Editor.new(page) end
Add feature spec for MIR output
diff --git a/config/sitemap.rb b/config/sitemap.rb index abc1234..def5678 100644 --- a/config/sitemap.rb +++ b/config/sitemap.rb @@ -13,12 +13,17 @@ # Defaults: :priority => 0.5, :changefreq => 'weekly', # :lastmod => Time.now, :host => default_host - add events_path, priority: 0.8 - add '/kata', priority: 0.8 - add partnership_path, priority: 0.7 - add stats_path, priority: 0.7 - add charter_path, priority: 0.6 + add events_path, priority: 0.9 + add '/kata', priority: 0.9 + add partnership_path, priority: 0.8 + add stats_path, priority: 0.8 + add charter_path, priority: 0.7 + add podcasts_path, priority: 0.6 + Podcast.find_each do |episode| + add podcast_path(episode), lastmod: episode.updated_at, priority: 0.6 + end + add docs_path, priority: 0.5 add teikan_path, priority: 0.5 add privacy_path, priority: 0.5
Add each podcast episode to Sitemap
diff --git a/config.rb b/config.rb index abc1234..def5678 100644 --- a/config.rb +++ b/config.rb @@ -51,3 +51,4 @@ deploy.user = 'nblock0330' deploy.password = "#{ENV['PASSWORD']}" end +
Fix my mistake and the corresponding merge conflict
diff --git a/howdoi.rb b/howdoi.rb index abc1234..def5678 100644 --- a/howdoi.rb +++ b/howdoi.rb @@ -3,7 +3,7 @@ class Howdoi < Formula homepage 'https://github.com/gleitz/howdoi/' url 'https://pypi.python.org/packages/23/2d/9790707eed08c802daee32183e7c98ec2e9797564dad229738b7f178e18e/howdoi-1.1.9.tar.gz' - sha1 '58d56ca5e652e20035b4869e589539feea5032aa' + sha256 '2b4a0ebc39c9e0489a17ef73e3eec7dd4a2975e07b995406887c639481da2bb5' def install setup_args = ['setup.py', 'install']
Add sha256 hash for Homebrew Fixes #151
diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -9,13 +9,6 @@ @user.confirm! sign_in @user - end - - describe "GET 'index'" do - it "returns http success" do - get 'index', { :idea_id => @idea.id } - response.should be_success - end end describe "GET 'new'" do
Remove Comments controller 'index' spec The 'index' action no longer exists, so the spec in the Comments controller should be removed.
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -23,12 +23,26 @@ end def edit + @user = User.find(params[:id]) end def update + @user = User.find(params[:id]) + if @user.update_attributes(user_params) + flash[:success] = "Profile Updated" + redirect_to @user + else + flash[:failure] = "Something went wrong" + redirect_to @user + end end def destroy + user = User.find(params[:id]) + flash[:notice] = "Are you sure you want to delete your account?" + user.destroy + flash[:success] = "User record deleted" + redirect_to root_path end private
Add destroy route to users controller
diff --git a/app/jobs/start_service_job.rb b/app/jobs/start_service_job.rb index abc1234..def5678 100644 --- a/app/jobs/start_service_job.rb +++ b/app/jobs/start_service_job.rb @@ -3,13 +3,16 @@ return if service.container_id fail 'Cannot be performed on an external service' unless service.hosted? - Rails.logger.info("Pulling Image #{service.image} for Service ##{service.id}") - image = Docker::Image.create( - 'fromImage' => service.image, - ) + # @note disabled as it's just hanging + #Rails.logger.info("Pulling Image #{service.image} for Service ##{service.id}") + #image = Docker:: + # .create( + # 'fromImage' => service.image, + #) - Rails.logger.info("Pulled Image #{service.image} for Service ##{service.id}") - Rails.logger.debug(image) + #Rails.logger.info("Pulled Image #{service.image} for Service ##{service.id}") + #Rails.logger.debug(image) + Rails.logger.info("Creating Container for Service ##{service.id}") container = Docker::Container.create(
Disable this for now as it's just hanging
diff --git a/app/models/in_app_purchase.rb b/app/models/in_app_purchase.rb index abc1234..def5678 100644 --- a/app/models/in_app_purchase.rb +++ b/app/models/in_app_purchase.rb @@ -27,6 +27,7 @@ new_expires_at = base_date + product[:time] user.plan = Plan.find_by_stripe_id("timed") user.expires_at = new_expires_at + user.suspended = false user.save end
Make sure user gets unsuspended.
diff --git a/app/models/page_attachment.rb b/app/models/page_attachment.rb index abc1234..def5678 100644 --- a/app/models/page_attachment.rb +++ b/app/models/page_attachment.rb @@ -12,6 +12,8 @@ :class_name => 'User', :foreign_key => 'updated_by' belongs_to :page + + attr_accessible :title, :description def short_filename(wanted_length = 15, suffix = ' ...') (self.filename.length > wanted_length) ? (self.filename[0,(wanted_length - suffix.length)] + suffix) : self.filename
Fix title/description update (previously unable to update those information on available attachments). Make :title and :description attributes accessible
diff --git a/app/models/physical_server.rb b/app/models/physical_server.rb index abc1234..def5678 100644 --- a/app/models/physical_server.rb +++ b/app/models/physical_server.rb @@ -30,6 +30,6 @@ end def label_for_vendor - VENDOR_TYPES[vendor] + VENDOR_TYPES[vendor.downcase] end end
Fix vendor key in physical server Vendor key should be always downcase.
diff --git a/app/models/single_use_link.rb b/app/models/single_use_link.rb index abc1234..def5678 100644 --- a/app/models/single_use_link.rb +++ b/app/models/single_use_link.rb @@ -6,6 +6,28 @@ alias_attribute :itemId, :item_id after_initialize :set_defaults + + # rubocop:disable Naming/MethodName + def downloadKey + Deprecation.warn(self, 'The #downloadKey attribute is deprecated. Use #download_key instead.') + download_key + end + + def downloadKey=(val) + Deprecation.warn(self, 'The #downloadKey attribute is deprecated. Use #download_key instead.') + self.download_key = val + end + + def itemId + Deprecation.warn(self, 'The #itemId attribute is deprecated. Use #item_id instead.') + item_id + end + + def itemId=(val) + Deprecation.warn(self, 'The #itemId attribute is deprecated. Use #item_id instead.') + self.item_id = val + end + # rubocop:enable Naming/MethodName def create_for_path(path) self.class.create(item_id: item_id, path: path)
Add deprecations for downloadKey and itemId
diff --git a/strong_routes.gemspec b/strong_routes.gemspec index abc1234..def5678 100644 --- a/strong_routes.gemspec +++ b/strong_routes.gemspec @@ -19,11 +19,11 @@ spec.require_paths = ["lib"] spec.add_dependency "rack" - spec.add_dependency "actionpack", ">= 3.2.0" + spec.add_development_dependency "actionpack", ">= 3.2.0" spec.add_development_dependency "bundler" spec.add_development_dependency "pry-nav" + spec.add_development_dependency "rack-test" spec.add_development_dependency "rake" - spec.add_development_dependency "rack-test" spec.add_development_dependency "simplecov" end
Make actionpack a dev dependency only
diff --git a/knife-vrealize.gemspec b/knife-vrealize.gemspec index abc1234..def5678 100644 --- a/knife-vrealize.gemspec +++ b/knife-vrealize.gemspec @@ -21,7 +21,7 @@ spec.required_ruby_version = ">= 2.5" - spec.add_dependency "knife-cloud", ">= 1.2.0", "< 4.0" + spec.add_dependency "knife-cloud", ">= 1.2.0", "< 5.0" spec.add_dependency "vmware-vra", "~> 2" spec.add_dependency "vcoworkflows", "~> 0.2" spec.add_dependency "rb-readline", "~> 0.5"
Update knife-cloud requirement from >= 1.2.0, < 4.0 to >= 1.2.0, < 5.0 Updates the requirements on [knife-cloud](https://github.com/chef/knife-cloud) to permit the latest version. - [Release notes](https://github.com/chef/knife-cloud/releases) - [Changelog](https://github.com/chef/knife-cloud/blob/master/CHANGELOG.md) - [Commits](https://github.com/chef/knife-cloud/compare/v1.2.0...v3.0.4) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/lib/future-resource.rb b/lib/future-resource.rb index abc1234..def5678 100644 --- a/lib/future-resource.rb +++ b/lib/future-resource.rb @@ -11,9 +11,9 @@ !!@resource_lock.synchronize { defined? @resource } end - def resource + def resource(timeout = nil) @resource_lock.synchronize do - @resource_value_blocker.wait unless defined? @resource + @resource_value_blocker.wait timeout unless defined? @resource @resource end end
Allow setting a timeout on waiting for a resource
diff --git a/lib/kamerling/value.rb b/lib/kamerling/value.rb index abc1234..def5678 100644 --- a/lib/kamerling/value.rb +++ b/lib/kamerling/value.rb @@ -2,17 +2,19 @@ module Kamerling class Value - include Virtus.value_object + class << self + def defaults(hash = {}) + hash.each do |name, default| + attribute name, attribute_set[name].type, default: default + end + end - def self.defaults(hash = {}) - hash.each do |name, default| - attribute name, attribute_set[name].type, default: default + def vals(hash = {}) + values { hash.each { |name, klass| attribute name, klass } } end end - def self.vals(hash = {}) - values { hash.each { |name, klass| attribute name, klass } } - end + include Virtus.value_object # :reek:FeatureEnvy def to_h
Switch Value to class << self
diff --git a/lib/lunar/stopwords.rb b/lib/lunar/stopwords.rb index abc1234..def5678 100644 --- a/lib/lunar/stopwords.rb +++ b/lib/lunar/stopwords.rb @@ -5,13 +5,13 @@ def include?(word) stopwords.include?(word.downcase) end + module_function :include? private def stopwords %w(an and are as at be but by for if in into is it no not of on or s such t that the their then there these they this to was will with) end - - module_function :stopwords, :include? + module_function :stopwords end end
Make module_function declaration in stop words more explicit.
diff --git a/lib/simplemvc/utils.rb b/lib/simplemvc/utils.rb index abc1234..def5678 100644 --- a/lib/simplemvc/utils.rb +++ b/lib/simplemvc/utils.rb @@ -0,0 +1,14 @@+class String + def to_snake_case + gsub("::", "/"). + gsub(/([A-Z]+)([A-Z][a-z])/, "\1_\2"). + gsub(/([a-z]\d)([A-Z])/). + tr("-", "_"). + downcase + end + + def to_camel_case + return self if self !~ /_/ && self =~ /[A-Z]+.*/ + split(_).map(&:capitalize).join + end +end
Allow for conversion to camel case and snake case for strings
diff --git a/lib/sub_diff/differ.rb b/lib/sub_diff/differ.rb index abc1234..def5678 100644 --- a/lib/sub_diff/differ.rb +++ b/lib/sub_diff/differ.rb @@ -3,6 +3,8 @@ module SubDiff class Differ + attr_reader :diffable, :collection + def initialize(diffable) @diffable = diffable @collection = DiffCollection.new @@ -20,8 +22,6 @@ private - attr_reader :diffable, :collection - def diff!(*args, &block) end end
Make readers public to avoid weird ruby warnings See https://github.com/thoughtbot/guides/pull/190 See https://twitter.com/tomstuart/status/486143792140271616
diff --git a/config/initializers/reset_db.rb b/config/initializers/reset_db.rb index abc1234..def5678 100644 --- a/config/initializers/reset_db.rb +++ b/config/initializers/reset_db.rb @@ -1,3 +1,5 @@+require 'fileutils' + BASESPEC = {adapter: "sqlite3", database: "db/production.sqlite3", pool: 5, @@ -8,4 +10,13 @@ dbfile = File.expand_path(BASESPEC[:database], Camerasink::BASEDIR) ActiveRecord::Base.establish_connection BASESPEC.merge(database: dbfile) ActiveRecord::Migrator.migrate("db/migrate/") + + logdir = File.expand_path("log/", Camerasink::BASEDIR) + FileUtils.mkdir_p logdir + logfile = File.expand_path("camerasink.log", logdir) + logger = Logger.new(logfile) + Rails.logger = logger + ActiveRecord::Base.logger = logger + ActionController::Base.logger = logger + ActionMailer::Base.logger = logger end
Change the logging to the app dir as well
diff --git a/brew/cask/awsaml.rb b/brew/cask/awsaml.rb index abc1234..def5678 100644 --- a/brew/cask/awsaml.rb +++ b/brew/cask/awsaml.rb @@ -1,6 +1,6 @@ cask 'awsaml' do - sha256 '8840a68b2e1c2ce1fa46a3bb830dd1d2d997e1e7cd49fdc7bcfec40351df97e4' version '2.0.0' + sha256 'cea42994cb52a71b8f811c38b25281604360b8216889e0f3217d4583cd7ead1a' url "https://github.com/rapid7/awsaml/releases/download/v#{version}/awsaml-v#{version}-darwin-x64.zip" appcast 'https://github.com/rapid7/awsaml/releases.atom',
Update the SHA256 checksum for the v2.0.0 binary.
diff --git a/core/enumerator/produce_spec.rb b/core/enumerator/produce_spec.rb index abc1234..def5678 100644 --- a/core/enumerator/produce_spec.rb +++ b/core/enumerator/produce_spec.rb @@ -0,0 +1,36 @@+require_relative '../../spec_helper' + +ruby_version_is "2.7" do + describe "Enumerator.produce" do + it "creates an infinite enumerator" do + enum = Enumerator.produce(0) { |prev| prev + 1 } + enum.take(5).should == [0, 1, 2, 3, 4] + end + + it "terminates iteration when block raises StopIteration exception" do + enum = Enumerator.produce(0) do | prev| + raise StopIteration if prev >= 2 + prev + 1 + end + + enum.to_a.should == [0, 1, 2] + end + + context "when initial value skipped" do + it "uses nil instead" do + ScratchPad.record [] + enum = Enumerator.produce { |prev| ScratchPad << prev; (prev || 0) + 1 } + + enum.take(3).should == [1, 2, 3] + ScratchPad.recorded.should == [nil, 1, 2] + end + + it "starts enumerable from result of first block call" do + io = StringIO.new("a\nb\nc\nd") + lines = Enumerator.produce { io.gets }.take_while { |s| s } + + lines.should == ["a\n", "b\n", "c\n", "d"] + end + end + end +end
Add new specs. Added Enumerator.produce to generate an Enumerator from any custom data transformation
diff --git a/cg_service_client.gemspec b/cg_service_client.gemspec index abc1234..def5678 100644 --- a/cg_service_client.gemspec +++ b/cg_service_client.gemspec @@ -1,6 +1,4 @@-# -*- encoding: utf-8 -*-i -lib = File.expand_path('../lib/', __FILE__) -$:.unshift lib unless $:.include?(lib) +require 'gem/dependency_management' Gem::Specification.new do |s| s.name = "cg_service_client" @@ -11,10 +9,12 @@ s.description = "Client library for CG web service clients." s.summary = "" - s.add_dependency "rake", "0.8.7" - s.add_dependency "rspec", "~> 2.5.0" - s.add_dependency "activemodel", ">= 3.0.0" - s.add_dependency "activesupport", ">= 3.0.0" + s.set_parent 'scholar' + + s.add_dependency "rake" + s.add_dependency "rspec" + s.add_dependency "activemodel" + s.add_dependency "activesupport" s.add_dependency "cg_lookup_client", "~> 0.5.16" s.files = Dir.glob("{lib,spec}/**/*")
Use gem-dependency_management in gemspec. See CP-2346. git-svn-id: c3135c47f3c29d4ec17dc77fe0dea76971532c8f@9567 bc291798-7d79-44a5-a816-fbf4f7d05ffa
diff --git a/app/models/manageiq/providers/openstack/infra_manager/host/operations.rb b/app/models/manageiq/providers/openstack/infra_manager/host/operations.rb index abc1234..def5678 100644 --- a/app/models/manageiq/providers/openstack/infra_manager/host/operations.rb +++ b/app/models/manageiq/providers/openstack/infra_manager/host/operations.rb @@ -8,8 +8,40 @@ end end + def set_node_maintenance_queue(userid) + task_opts = { + :action => "setting node maintenance on Host for user #{userid}", + :userid => userid + } + queue_opts = { + :class_name => self.class.name, + :method_name => 'set_node_maintenance', + :instance_id => id, + :role => 'ems_operations', + :zone => ext_management_system.my_zone, + :args => [] + } + MiqTask.generic_action_with_callback(task_opts, queue_opts) + end + def set_node_maintenance ironic_fog_node.set_node_maintenance(:reason=>"CFscaledown") + end + + def unset_node_maintenance_queue(userid) + task_opts = { + :action => "unsetting node maintenance on Host for user #{userid}", + :userid => userid + } + queue_opts = { + :class_name => self.class.name, + :method_name => 'unset_node_maintenance', + :instance_id => id, + :role => 'ems_operations', + :zone => ext_management_system.my_zone, + :args => [] + } + MiqTask.generic_action_with_callback(task_opts, queue_opts) end def unset_node_maintenance
Use task queue for set/unset node maintenance Uses task queue instead of making direct provider API calls from the UI. This PR contains the necessary model changes.
diff --git a/test/test_retryable_typhoeus.rb b/test/test_retryable_typhoeus.rb index abc1234..def5678 100644 --- a/test/test_retryable_typhoeus.rb +++ b/test/test_retryable_typhoeus.rb @@ -0,0 +1,33 @@+require_relative '../lib/retryable_typhoeus' + +module Unipept + class BatchIteratorTestCase < Unipept::TestCase + def test_request_retry_default_parameter + request = new_request + assert_equal(10, request.retries) + request.retries = 3 + assert_equal(3, request.retries) + end + + def test_request_retry_parameter + request = new_request(retries: 5) + assert_equal(5, request.retries) + end + + def new_request(extra_opts = {}) + ::RetryableTyphoeus::Request.new( + 'url', + options.merge(extra_opts) + ) + end + + def options + { + method: :post, + body: 'body', + accept_encoding: 'gzip', + headers: { 'User-Agent' => 'user-agent' } + } + end + end +end
Add tests for the retryable_typhoeus request patches
diff --git a/spec/uploaders/attachment_uploader_spec.rb b/spec/uploaders/attachment_uploader_spec.rb index abc1234..def5678 100644 --- a/spec/uploaders/attachment_uploader_spec.rb +++ b/spec/uploaders/attachment_uploader_spec.rb @@ -8,16 +8,16 @@ let(:uploader) { AttachmentUploader.new(comment, :attachment) } before do - AttachmentUploader.enable_processing = true - uploader.store!(file) + # AttachmentUploader.enable_processing = true + # uploader.store!(file) end after do - AttachmentUploader.enable_processing = false - uploader.remove! + # AttachmentUploader.enable_processing = false + # uploader.remove! end - it "uploads the file" do + xit "uploads the file" do uploader.should_not be_nil end end
Comment uploader spec until we can revisit
diff --git a/tty-which.gemspec b/tty-which.gemspec index abc1234..def5678 100644 --- a/tty-which.gemspec +++ b/tty-which.gemspec @@ -19,5 +19,6 @@ spec.require_paths = ["lib"] spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0' + spec.add_development_dependency 'rspec', '~> 3.1' spec.add_development_dependency 'rake' end
Add rspec as dev dependency
diff --git a/tools/fetch_ago_mappings.rb b/tools/fetch_ago_mappings.rb index abc1234..def5678 100644 --- a/tools/fetch_ago_mappings.rb +++ b/tools/fetch_ago_mappings.rb @@ -1,74 +1,8 @@ #!/usr/bin/env ruby -w -require 'csv' -require 'uri' -require 'net/http' -require 'pathname' -class FetchAgoMappings - - def fetch - CSV.open(output_file, "w:utf-8") do |output_csv| - puts "Writing AGO mappings to #{output_file}" - output_csv << ['Old Url','New Url','Status'] - i = 0 - input_csv.sort_by {|row| row['Old Url']}.each do |row| - old_url = sanitize_url(row['Old Url']) - new_url = sanitize_url(row['New URL']) - new_row = if on_national_archives?(new_url) - [old_url, "", "410"] - else - [old_url, new_url, "301"] - end - validate_row!(new_row) - output_csv << new_row - i += 1 - end - puts "Wrote #{i} mappings" - end - end - - def on_national_archives?(url) - url.start_with? "http://webarchive.nationalarchives.gov.uk/" - end - - def validate_row!(row) - row[0..1].each do |url| - next if url.empty? - valid_url?(url) || raise("Invalid URL: '#{url}'") - end - end - - def valid_url?(url) - URI.parse(url) rescue false - end - - def sanitize_url(url) - url.gsub(" ", "%20") - end - - def csv_url - "https://docs.google.com/spreadsheet/pub?key=0AiP6zL-gKn64dFZ4UWJoeXR4eV9TTFk3SVl6VTQzQ2c&single=true&gid=0&output=csv" - end - - def output_file - Pathname.new(File.dirname(__FILE__)) + ".." + "data/mappings/ago.csv" - end - - private - - def input_csv - @input_csv ||= CSV.parse(do_request(csv_url).body.force_encoding("UTF-8"), headers: true) - end - - def do_request(url) - uri = URI.parse(url) - raise "url must be HTTP(S)" unless uri.is_a?(URI::HTTP) - http = Net::HTTP.new(uri.host, uri.port) - http.use_ssl = (uri.is_a?(URI::HTTPS)) - response = http.request_get(uri.path + "?" + uri.query) - raise "Error - got response #{response.code}" unless response.is_a?(Net::HTTPOK) - response - end -end - -FetchAgoMappings.new.fetch+require_relative "mapping_fetcher" +fetcher = MappingFetcher.new( + "https://docs.google.com/spreadsheet/pub?key=0AiP6zL-gKn64dFZ4UWJoeXR4eV9TTFk3SVl6VTQzQ2c&single=true&gid=0&output=csv", + "ago" +) +fetcher.fetch
Use generic mapping fetcher for AGO mappings
diff --git a/db/migrate/20181020103501_revoke_variant_overrideswithout_permissions.rb b/db/migrate/20181020103501_revoke_variant_overrideswithout_permissions.rb index abc1234..def5678 100644 --- a/db/migrate/20181020103501_revoke_variant_overrideswithout_permissions.rb +++ b/db/migrate/20181020103501_revoke_variant_overrideswithout_permissions.rb @@ -2,11 +2,11 @@ def up # This process was executed when the permission_revoked_at colum was created (see AddPermissionRevokedAtToVariantOverrides) # It needs to be repeated due to #2739 - variant_override_hubs = Enterprise.where(id: VariantOverride.all.map(&:hub_id).uniq) + variant_override_hubs = Enterprise.where(id: VariantOverride.select(:hub_id).uniq) - variant_override_hubs.each do |hub| + variant_override_hubs.find_each do |hub| permitting_producer_ids = hub.relationships_as_child - .with_permission(:create_variant_overrides).map(&:parent_id) + .with_permission(:create_variant_overrides).pluck(:parent_id) variant_overrides_with_revoked_permissions = VariantOverride.for_hubs(hub) .joins(variant: :product).where("spree_products.supplier_id NOT IN (?)", permitting_producer_ids)
Speed up database queries and make them scale This commit makes use of three ActiveRecord features: 1. Using `select` instead of `all.map` enables ActiveRecord to nest one select into the other, resulting in one more efficient query instead of two. 2. Using `find_each` saves memory by loading records in batches. https://api.rubyonrails.org/classes/ActiveRecord/Batches.html#method-i-find_each 3. Using `pluck` creates only an array, avoiding loading all the other columns of the records into objects. Running this on the current Canadian database, fixes the following variant overrides: ``` [] [] [] [] [] [] [925, 924, 966, 965] [] [] [] [] [462, 863, 464, 822, 949, 947, 944, 939, 942, 946, 945, 943, 438, 937, 938, 941, 940, 467, 952, 875, 453, 953, 454, 951, 487, 460, 457, 528, 527, 486, 459, 458, 461, 529, 530, 950, 642, 384, 380, 643, 385, 381, 644, 386, 382, 960, 959, 379, 640, 377, 375, 532, 639, 376, 374, 646, 390, 389, 637, 406, 408, 647, 391, 393, 633, 396, 400, 398, 645, 388, 387, 648, 394, 392, 536, 632, 399, 397, 395, 634, 403, 401, 635, 404, 402, 636, 407, 405, 535, 534, 638, 410, 409, 948, 533, 537, 531, 877, 880, 894, 893, 672, 671, 673, 674, 703, 714, 715, 716, 717, 862, 864, 879, 876, 865, 881, 878, 463, 954, 866, 823, 957, 958, 955, 956, 899, 897] [] [969] ```
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -6,10 +6,9 @@ before { expect(error).to receive(:message).and_return("An error message.") } - it "redirects to the root path" - #it "redirects to the root path" do - # expect(controller).to receive(:redirect_to).with(root_url, alert: "An error message.").once - # controller.access_denied(error) - #end + it "redirects to the root path" do + expect(controller).to receive(:redirect_to).with(root_url, alert: "An error message.").once + controller.access_denied(error) + end end end
Add test for application controller.
diff --git a/recipes/delete_validation.rb b/recipes/delete_validation.rb index abc1234..def5678 100644 --- a/recipes/delete_validation.rb +++ b/recipes/delete_validation.rb @@ -17,7 +17,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -unless node[:recipes].include?("chef-server") +unless node['recipes'].include?("chef-server") file Chef::Config[:validation_key] do action :delete backup false
FC001: Use strings in preference to symbols.
diff --git a/backend/spree_backend.gemspec b/backend/spree_backend.gemspec index abc1234..def5678 100644 --- a/backend/spree_backend.gemspec +++ b/backend/spree_backend.gemspec @@ -22,7 +22,7 @@ s.add_dependency 'spree_api', s.version s.add_dependency 'spree_core', s.version - s.add_dependency 'bootstrap', '~> 4.3.1' + s.add_dependency 'bootstrap', '>= 4.3.1', '< 4.6.0' s.add_dependency 'glyphicons', '~> 1.0.2' s.add_dependency 'jquery-rails', '~> 4.3' s.add_dependency 'jquery-ui-rails', '~> 6.0.1'
Update bootstrap requirement from ~> 4.3.1 to >= 4.3.1, < 4.6.0 Updates the requirements on [bootstrap](https://github.com/twbs/bootstrap-rubygem) to permit the latest version. - [Release notes](https://github.com/twbs/bootstrap-rubygem/releases) - [Changelog](https://github.com/twbs/bootstrap-rubygem/blob/master/CHANGELOG.md) - [Commits](https://github.com/twbs/bootstrap-rubygem/compare/v4.3.1...v4.5.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/delayed_job/spec/spec_helper.rb b/delayed_job/spec/spec_helper.rb index abc1234..def5678 100644 --- a/delayed_job/spec/spec_helper.rb +++ b/delayed_job/spec/spec_helper.rb @@ -7,7 +7,7 @@ RAILS_ROOT = File.dirname(__FILE__) + '/rails' FileUtils.rm_rf RAILS_ROOT + '/db/test.sqlite3' -ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => RAILS_ROOT + '/db/test.sqlite3' +ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => 'db/test.sqlite3' class CreateDelayedJobs < ActiveRecord::Migration def self.up
Use the same database path as the tests
diff --git a/lib/bummr/updater.rb b/lib/bummr/updater.rb index abc1234..def5678 100644 --- a/lib/bummr/updater.rb +++ b/lib/bummr/updater.rb @@ -36,7 +36,11 @@ end def updated_version_for(gem) - `bundle list | grep " #{gem[:name]} "`.split('(')[1].split(')')[0] + if (gem[:name].include?("(") && gem[:name].include?(")")) + `bundle list | grep " #{gem[:name]} "`.split('(')[1].split(')')[0] + else + "?" + end end end end
Handle absence of updated version
diff --git a/closed_struct.gemspec b/closed_struct.gemspec index abc1234..def5678 100644 --- a/closed_struct.gemspec +++ b/closed_struct.gemspec @@ -10,7 +10,7 @@ spec.email = ["pawel.obrok@gmail.com"] spec.summary = %q{An immutable, strict version of OpenStruct} spec.description = %q{ClosedStructs work like OpenStruct, with the exception of being immutable and not responding to methods which haven't been listed in the input hash} - spec.homepage = "" + spec.homepage = "https://github.com/obrok/closed_struct" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add homepage link to rubygems page Simplifies finding the source code repo when visiting the rubygems page.
diff --git a/lib/junit_adapter.rb b/lib/junit_adapter.rb index abc1234..def5678 100644 --- a/lib/junit_adapter.rb +++ b/lib/junit_adapter.rb @@ -4,7 +4,7 @@ COUNT_REGEXP = /Tests run: (\d+)/.freeze FAILURES_REGEXP = /Failures: (\d+)/.freeze SUCCESS_REGEXP = /OK \((\d+) tests?\)\s*(?:\x1B\]0;|exit)?\s*\z/.freeze - ASSERTION_ERROR_REGEXP = /java\.lang\.AssertionError:?\s(.*?)\tat org.junit|org\.junit\.ComparisonFailure:\s(.*?)\tat org.junit/m.freeze + ASSERTION_ERROR_REGEXP = /java\.lang\.AssertionError:?\s(.*?)\tat org\.junit|org\.junit\.ComparisonFailure:\s(.*?)\tat org\.junit|\)\r\n(.*?)\tat org\.junit\.internal\.ComparisonCriteria\.arrayEquals\(ComparisonCriteria\.java:50\)/m.freeze def self.framework_name 'JUnit 4'
Fix JUnit 4 for ArrayComparisonFailure
diff --git a/lib/kmc/refresher.rb b/lib/kmc/refresher.rb index abc1234..def5678 100644 --- a/lib/kmc/refresher.rb +++ b/lib/kmc/refresher.rb @@ -8,6 +8,7 @@ kmc_packages_path = Kmc::Configuration.packages_path output_path = File.join(kmc_packages_path, '..') + FileUtils::mkdir_p output_path remove_old_packages(kmc_packages_path) FileUtils.cp_r(new_packages_dir, output_path)
Create package folder if don't exists
diff --git a/lib/app/nitpick.rb b/lib/app/nitpick.rb index abc1234..def5678 100644 --- a/lib/app/nitpick.rb +++ b/lib/app/nitpick.rb @@ -2,6 +2,14 @@ post '/preview' do md(params[:comment]) + end + + get '/dashboard/:language/?' do |language| + redirect "/nitpick/#{language}/no-nits" + end + + get '/dashboard/:language/:slug/?' do |language, slug| + redirect "/nitpick/#{language}/#{slug}" end get '/nitpick/:language/?' do |language|
Add redirects from the old dashboard
diff --git a/app/controllers/api/subscriptions_controller.rb b/app/controllers/api/subscriptions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/subscriptions_controller.rb +++ b/app/controllers/api/subscriptions_controller.rb @@ -4,6 +4,7 @@ def show if @account.subscription(api_subscription_url(@account.id)).valid?(params['hub.topic']) + Rails.logger.debug "PuSH confirmation with lease_seconds: #{params['hub.lease_seconds']}" @account.update(subscription_expires_at: Time.now + (params['hub.lease_seconds'].to_i).seconds) render plain: HTMLEntities.new.encode(params['hub.challenge']), status: 200 else
Add more logging to PuSH callback
diff --git a/lib/yard/server/rack_adapter.rb b/lib/yard/server/rack_adapter.rb index abc1234..def5678 100644 --- a/lib/yard/server/rack_adapter.rb +++ b/lib/yard/server/rack_adapter.rb @@ -38,10 +38,9 @@ end def call(env) - @command ||= @command_class.new(@options) request = Rack::Request.new(env) cache = check_static_cache(request, @adapter.document_root) - cache ? cache : @command.call(request) + cache ? cache : @command_class.new(@options).call(request) end end end
Reset command on each request in Rack adapter
diff --git a/config/unicorn/staging.rb b/config/unicorn/staging.rb index abc1234..def5678 100644 --- a/config/unicorn/staging.rb +++ b/config/unicorn/staging.rb @@ -24,5 +24,4 @@ ActiveRecord::Base.establish_connection end -listen Integer(ENV['PORT'] || 3000) - +listen "/tmp/unicorn.manageiq.sock"
Use socket for nginx front-end
diff --git a/lib/ionic_notification/concerns/ionic_notificable.rb b/lib/ionic_notification/concerns/ionic_notificable.rb index abc1234..def5678 100644 --- a/lib/ionic_notification/concerns/ionic_notificable.rb +++ b/lib/ionic_notification/concerns/ionic_notificable.rb @@ -6,8 +6,9 @@ included do serialize :device_tokens, Array - def notify - puts "Fire notification" + def notify(options = {}) + notification = IonicNotification::Notification.new options + notification.send end end end
Send notifications from within the model
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index abc1234..def5678 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -9,3 +9,17 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # Rails.application.config.assets.precompile += %w( search.js ) + +# For themes. See https://github.com/yoolk/themes_on_rails +Rails.application.configure do + themes_path = "#{Rails.root}/app/themes/" + assets_paths = [ + proc do |path, filename| + filename =~ /app\/themes/ && !['.js', '.css'].include?(File.extname(path)) + end + ] + + assets_paths += Dir["#{themes_path}*"].map { |path| "#{path.split('/').last}/all.js" } + assets_paths += Dir["#{themes_path}*"].map { |path| "#{path.split('/').last}/all.css" } + config.assets.precompile += assets_paths +end
Add the themes to the search path.
diff --git a/lib/kaminari/mongo_mapper/plucky_criteria_methods.rb b/lib/kaminari/mongo_mapper/plucky_criteria_methods.rb index abc1234..def5678 100644 --- a/lib/kaminari/mongo_mapper/plucky_criteria_methods.rb +++ b/lib/kaminari/mongo_mapper/plucky_criteria_methods.rb @@ -6,8 +6,8 @@ delegate :default_per_page, :max_per_page, :max_pages, :to => :model - def entry_name - model.model_name.human.downcase + def entry_name(options = {}) #:nodoc: + model_name.human(options.reverse_merge(default: model_name.human.pluralize(options[:count]))) end def limit_value #:nodoc:
Use I18n to pluralize entries see: https://github.com/amatsuda/kaminari/commit/7f6e9a877d646263dc0504a5ad96ef4d5f2dd684
diff --git a/core/db/migrate/20140205120320_create_spree_payment_capture_events.rb b/core/db/migrate/20140205120320_create_spree_payment_capture_events.rb index abc1234..def5678 100644 --- a/core/db/migrate/20140205120320_create_spree_payment_capture_events.rb +++ b/core/db/migrate/20140205120320_create_spree_payment_capture_events.rb @@ -1,7 +1,7 @@ class CreateSpreePaymentCaptureEvents < ActiveRecord::Migration def change create_table :spree_payment_capture_events do |t| - t.integer :amount + t.decimal :amount, precision: 10, scale: 2, default: 0.0 t.integer :payment_id t.timestamps
Use decimal field for capture_events, just like payment table
diff --git a/features/support/screenshots.rb b/features/support/screenshots.rb index abc1234..def5678 100644 --- a/features/support/screenshots.rb +++ b/features/support/screenshots.rb @@ -8,7 +8,7 @@ AfterStep do |scenario| cdir = ENV['CAPTURE_DIR'] now = Time.now.to_f - fn = Shellwords.escape("#{cdir}/#{scenario.title}-#{now}.png") + fn = Shellwords.escape("#{cdir}/#{now}-#{scenario.title}.png") `import -window root #{fn}` end end
Move timestamp for easier sorting.
diff --git a/app/controllers/puddy/transactions_controller.rb b/app/controllers/puddy/transactions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/puddy/transactions_controller.rb +++ b/app/controllers/puddy/transactions_controller.rb @@ -3,6 +3,12 @@ @transaction_state = 'All' @transactions = Transaction.order(:created_at). paginate(page: params[:page], per_page: 25) + end + + def show + @transaction = Transaction.find params[:id] + @credit_card = @transaction.payment.credit_card + render '/transactions/show' end def successful
Add show method for transactions
diff --git a/app/presenters/medical_safety_alert_presenter.rb b/app/presenters/medical_safety_alert_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/medical_safety_alert_presenter.rb +++ b/app/presenters/medical_safety_alert_presenter.rb @@ -2,6 +2,7 @@ delegate( :alert_type, :medical_specialism, + :issued_date, to: :"document.details" ) @@ -20,4 +21,10 @@ medical_specialism: medical_specialism, } end + + def extra_date_metadata + { + "Issued date" => issued_date, + } + end end
Add issued date to medical safety alerts Add the issued date attribute to the medical safety alaert date metadata in the presenter so that it can be shown in the frontend. This corresponds to this commit in specialist publisher: https://github.com/alphagov/specialist-publisher/pull/281 The trello ticket can be found here: https://trello.com/c/QFE3nYlc/361-add-issued-date-to-medical-safety-alerts-2
diff --git a/WDAlertView.podspec b/WDAlertView.podspec index abc1234..def5678 100644 --- a/WDAlertView.podspec +++ b/WDAlertView.podspec @@ -1,12 +1,13 @@ Pod::Spec.new do |spec| spec.name = 'WDAlertView' + spec.platform = :ios spec.version = '1.0.0' spec.license = { :type => 'MIT' } spec.homepage = 'https://github.com/alienbat/WDAlertView' spec.authors = { 'Jian Shen' => 'alienbat@gmail.com' } spec.summary = 'Alert view that supports block handling' spec.source = { :git => 'git@github.com:alienbat/WDAlertView.git' } - spec.source_files = 'WDAlertView.h,m' + spec.source_files = '*.{h,m}' spec.requires_arc = true end
Change pod spec source reference
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,23 @@ require File.expand_path('../boot', __FILE__) -require 'rails/all' +#require 'rails/all' + +# Include each railties manually, excluding `active_storage/engine` +%w( + active_record/railtie + action_controller/railtie + action_view/railtie + action_mailer/railtie + active_job/railtie + action_cable/engine + rails/test_unit/railtie + sprockets/railtie +).each do |railtie| + begin + require railtie + rescue LoadError + end +end # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production.
Disable ActiveStorage to avoid heroku warn when deploy
diff --git a/spec/build/job/test/php_spec.rb b/spec/build/job/test/php_spec.rb index abc1234..def5678 100644 --- a/spec/build/job/test/php_spec.rb +++ b/spec/build/job/test/php_spec.rb @@ -3,8 +3,8 @@ describe Travis::Build::Job::Test::Php do let(:shell) { stub('shell') } - let(:config) { Travis::Build::Job::Test::Php::Config.new } - let(:job) { Travis::Build::Job::Test::Php.new(shell, nil , config) } + let(:config) { Build::Job::Test::Php::Config.new } + let(:job) { Build::Job::Test::Php.new(shell, nil , config) } describe 'config' do it 'defaults :php to "5.3.8"' do
Revert "Fix php builder spec." This reverts commit ecb8adbc7f9db773978c8a8c8606c76e9667158b. I am reverting all attempts to fix php builder. There are people who supposed to maintain it.
diff --git a/spec/factories/interventions.rb b/spec/factories/interventions.rb index abc1234..def5678 100644 --- a/spec/factories/interventions.rb +++ b/spec/factories/interventions.rb @@ -23,7 +23,7 @@ end trait :non_atp_intervention do - intervention_type { InterventionType.find_by_name('Extra Dance') } + intervention_type { InterventionType.find_by_name('Attendance Contract') } end end
Change factory intervention name to match InterventionTypes
diff --git a/lib/dizby/utility/timed_state.rb b/lib/dizby/utility/timed_state.rb index abc1234..def5678 100644 --- a/lib/dizby/utility/timed_state.rb +++ b/lib/dizby/utility/timed_state.rb @@ -33,7 +33,7 @@ private def progress - @time = 0 + @time -= @timeout @state = case @state when :active
Reduce the time of a TimedState object rather than setting it to zero This allows for long periods of time between updates to not result in even longer living times for objects.
diff --git a/lib/epub/searcher/publication.rb b/lib/epub/searcher/publication.rb index abc1234..def5678 100644 --- a/lib/epub/searcher/publication.rb +++ b/lib/epub/searcher/publication.rb @@ -4,7 +4,6 @@ module Searcher class Publication class << self - # @todo Use named argument in the future def search(package, word, **options) new(word).search(package, options) end @@ -14,7 +13,6 @@ @word = word end - # @todo Use named argument in the future def search(package, algorithm: :seamless) results = []
Remove todo comment that was done
diff --git a/db/migrate/20140721152149_add_created_at_to_supporters_action_jobs.rb b/db/migrate/20140721152149_add_created_at_to_supporters_action_jobs.rb index abc1234..def5678 100644 --- a/db/migrate/20140721152149_add_created_at_to_supporters_action_jobs.rb +++ b/db/migrate/20140721152149_add_created_at_to_supporters_action_jobs.rb @@ -1,5 +1,5 @@-class AddCreatedAtToSupportersActionJob < ActiveRecord::Migration +class AddCreatedAtToSupportersActionJobs < ActiveRecord::Migration def change - add_column :supporters_action_job, :created_at, :datetime + add_column :supporters_action_jobs, :created_at, :datetime end end
Fix typo in table name
diff --git a/lib/liberic/sdk/configuration.rb b/lib/liberic/sdk/configuration.rb index abc1234..def5678 100644 --- a/lib/liberic/sdk/configuration.rb +++ b/lib/liberic/sdk/configuration.rb @@ -1,7 +1,7 @@ module Liberic module SDK module Configuration - LIBERICAPI_VERSION = %w(23.2.12.0 23.3.8.0) + LIBERICAPI_VERSION = %w(23.2.12.0 23.3.6.0 23.3.8.0) ENCODING = 'iso-8859-15' end end
Include 23.2.6.0 as supported libcapi versions Apparently the package filename is 23.3.8.0 while the contained libs return 23.3.6.0 as versions.
diff --git a/lib/partitioned.rb b/lib/partitioned.rb index abc1234..def5678 100644 --- a/lib/partitioned.rb +++ b/lib/partitioned.rb @@ -16,6 +16,7 @@ require 'partitioned/by_yearly_time_field' require 'partitioned/by_monthly_time_field' require 'partitioned/by_weekly_time_field' +require 'partitioned/by_daily_time_field' require 'partitioned/by_created_at' require 'partitioned/by_integer_field' require 'partitioned/by_id'
Add a require of by_daily_time_field
diff --git a/lib/manage_engine/app_manager.rb b/lib/manage_engine/app_manager.rb index abc1234..def5678 100644 --- a/lib/manage_engine/app_manager.rb +++ b/lib/manage_engine/app_manager.rb @@ -1,5 +1,6 @@-require File.expand_path(File.dirname(__FILE__) + '/app_manager/version') -require File.expand_path(File.dirname(__FILE__) + '/app_manager/server') +require_relative 'app_manager/version' +require_relative 'app_manager/server' +require_relative 'app_manager/api' module ManageEngine module AppManager @@ -8,6 +9,7 @@ # # host - Host on which the ApplicationsManager server is running. # port - Optional port on which the ApplicationsManager is listening (default = 9090). + # api_key - REST key used to communicate with the AppManager service. # options - Optional hash used to configure this ManageEngine::AppManager::Instance (default = nil). # :api_version - Version of the AppManager API to use (drives the schema) # @@ -16,6 +18,7 @@ # ManageEngine::AppManager.new :host => 'http://myHost.internal.com', :port => 9090 # # Returns a ManageEngine::AppManager::Instance. + # def new(args = nil) ManageEngine::AppManager::Server.new args end
Update AppManager new Method Documentation Update the comments within the AppManager module to more specifically denote what parameters are required for the new method.
diff --git a/lib/propr/maybe.rb b/lib/propr/maybe.rb index abc1234..def5678 100644 --- a/lib/propr/maybe.rb +++ b/lib/propr/maybe.rb @@ -1,6 +1,24 @@ module Propr class Maybe + end + + class << Maybe + def run(computation) + computation + end + + def unit(value) + Some.new(value) + end + + def bind(f, &g) + f.fold(f, &g) + end + + def fail(reason) + None + end end class Some < Maybe
Implement monad instance for Maybe
diff --git a/lib/rusty_blank.rb b/lib/rusty_blank.rb index abc1234..def5678 100644 --- a/lib/rusty_blank.rb +++ b/lib/rusty_blank.rb @@ -1,9 +1,10 @@ require 'fiddle' require 'rbconfig' +require 'thermite/config' -ext = RbConfig::CONFIG['DLEXT'] == 'bundle' ? 'dylib' : RbConfig::CONFIG['DLEXT'] -basename = "librusty_blank.#{ext}" -library = Fiddle.dlopen(File.join(File.dirname(__FILE__), basename)) +libdir = File.dirname(__FILE__) +library_name = Thermite::Config.new(cargo_project_path: File.dirname(libdir)).shared_library +library = Fiddle.dlopen(File.join(libdir, library_name)) func = Fiddle::Function.new(library['init_rusty_blank'], [], Fiddle::TYPE_VOIDP) func.call
Use Thermite::Config to load the library via Fiddle in a cross-platform way
diff --git a/figaro.gemspec b/figaro.gemspec index abc1234..def5678 100644 --- a/figaro.gemspec +++ b/figaro.gemspec @@ -6,8 +6,8 @@ gem.authors = ["Steve Richert"] gem.email = ["steve.richert@gmail.com"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} + gem.summary = "Simple Rails app configuration" + gem.description = "Simple, Heroku-friendly Rails app configuration using ENV and a single YAML file" gem.homepage = "https://github.com/laserlemon/figaro" gem.add_dependency "rails", "~> 3.0"
Write the gem summary and description
diff --git a/lib/sequel/extensions/db_opts.rb b/lib/sequel/extensions/db_opts.rb index abc1234..def5678 100644 --- a/lib/sequel/extensions/db_opts.rb +++ b/lib/sequel/extensions/db_opts.rb @@ -18,10 +18,21 @@ end def apply(c) - execute_meth = c.respond_to?(:log_connection_execute) ? :log_connection_execute : :execute - sql_statements.each do |stmt| - c.send(execute_meth, stmt) + if db.respond_to?(:log_connection_execute) + db.send(:log_connection_execute, c, stmt) + elsif c.respond_to?(:log_connection_execute) + c.send(:log_connection_execute, stmt) + elsif c.respond_to?(:execute) + cursor = c.send(:execute, stmt) + if cursor && cursor.respond_to?(:close) + cursor.close + end + elsif db.respond_to?(:execute) + db.send(:execute, stmt) + else + raise "Failed to run SET queries" + end end end
Fix bug where SET commands never finish Turns out that we're calling Impala::Connection#execute and that opens up a cursor, but never closes it. As a hacky, quick fix, Sequelizer will check for a cursor and close it if it can.
diff --git a/lib/super_resources/resources.rb b/lib/super_resources/resources.rb index abc1234..def5678 100644 --- a/lib/super_resources/resources.rb +++ b/lib/super_resources/resources.rb @@ -30,7 +30,7 @@ end def memoize_collection(&block) - @collection ||= block.call + @_collection ||= block.call end def collection? @@ -42,7 +42,7 @@ end def memoize_resource(&block) - @resource ||= block.call + @_resource ||= block.call end def resource?
Make resource and collection ivars "private"
diff --git a/lib/tty/prompt/reader/win_api.rb b/lib/tty/prompt/reader/win_api.rb index abc1234..def5678 100644 --- a/lib/tty/prompt/reader/win_api.rb +++ b/lib/tty/prompt/reader/win_api.rb @@ -12,12 +12,24 @@ CRT_HANDLE = Handle.new("msvcrt") rescue Handle.new("crtdll") + # Get a character from the console without echo. + # + # @return [String] + # return the character read + # + # @api public def getch @@getch ||= Fiddle::Function.new(CRT_HANDLE["_getch"], [], TYPE_INT) @@getch.call end module_function :getch + # Gets a character from the console with echo. + # + # @return [String] + # return the character read + # + # @api public def getche @@getche ||= Fiddle::Function.new(CRT_HANDLE["_getche"], [], TYPE_INT) @@getche.call
Change to document windows api calls
diff --git a/lib/metric_fu/metrics/rails_best_practices/rails_best_practices_bluff_grapher.rb b/lib/metric_fu/metrics/rails_best_practices/rails_best_practices_bluff_grapher.rb index abc1234..def5678 100644 --- a/lib/metric_fu/metrics/rails_best_practices/rails_best_practices_bluff_grapher.rb +++ b/lib/metric_fu/metrics/rails_best_practices/rails_best_practices_bluff_grapher.rb @@ -6,7 +6,7 @@ end def data [ - ['rails_best_practices', @rails_best_practices.join(',')] + ['rails_best_practices', @rails_best_practices_count.join(',')] ] end def output_filename
Fix problem with missing rails best practice count.
diff --git a/future_wrapper.rb b/future_wrapper.rb index abc1234..def5678 100644 --- a/future_wrapper.rb +++ b/future_wrapper.rb @@ -11,23 +11,23 @@ class FutureWrapper # Take a key and hash where the matcher can eventually be fetched, and # optionally take a rename value and a Proc to extend the result. - def initialize key, hash, defs: nil, new_name: nil + def initialize key, hash, defs: nil, name: nil @key = key @hash = hash @defs = defs - @new_name = new_name + @name = name end # Create a new Future wrapper with all the same values but change the name. def rename new_name - self.class.new(@key, @hash, defs: @defs, new_name: new_name) + self.class.new(@key, @hash, defs: @defs, name: new_name) end # Fetch the matcher, call it, then extend the result. def call string, index = 0, counts: {} unless @matcher @matcher = @hash.fetch(@key) - @matcher = @matcher.rename(@new_name) if @new_name + @matcher = @matcher.rename(@name) if @name end @matcher.call(string, index, counts: counts)
Change name of instance variable so it makes more sense for a subclass
diff --git a/Casks/little-snitch.rb b/Casks/little-snitch.rb index abc1234..def5678 100644 --- a/Casks/little-snitch.rb +++ b/Casks/little-snitch.rb @@ -1,6 +1,6 @@ cask :v1 => 'little-snitch' do - version '3.5.3' - sha256 'cfe44ba45c669e1bf9a04910b2dd8675a26d7e6c00954b74adeffd12f90b8197' + version '3.6' + sha256 'f33bf45f975ebdd5034ad5e53a65469377ace557492ea752098ba7ad0c09a07a' url "https://www.obdev.at/downloads/littlesnitch/LittleSnitch-#{version}.dmg" name 'Little Snitch'
Upgrade Little Snitch to v3.6
diff --git a/sidekiq-redis-logger.gemspec b/sidekiq-redis-logger.gemspec index abc1234..def5678 100644 --- a/sidekiq-redis-logger.gemspec +++ b/sidekiq-redis-logger.gemspec @@ -1,11 +1,11 @@ # -*- encoding: utf-8 -*- -lib = File.expand_path('../lib', __FILE__) +lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'sidekiq-redis-logger/version' +require "sidekiq/redis-logger/version" Gem::Specification.new do |gem| gem.name = "sidekiq-redis-logger" - gem.version = Sidekiq::Redis::Logger::VERSION + gem.version = Sidekiq::RedisLogger::VERSION gem.authors = ["Alex Coomans"] gem.email = ["alex@alexcoomans.com"] gem.description = %q{TODO: Write a gem description}
Fix the gemspec for the version
diff --git a/lib/bitex_bot/models/open_buy.rb b/lib/bitex_bot/models/open_buy.rb index abc1234..def5678 100644 --- a/lib/bitex_bot/models/open_buy.rb +++ b/lib/bitex_bot/models/open_buy.rb @@ -2,9 +2,11 @@ # OpenBuys are open buy positions that are closed by one or several CloseBuys. # TODO: document attributes. # -class BitexBot::OpenBuy < ActiveRecord::Base - belongs_to :opening_flow, class_name: 'BuyOpeningFlow', foreign_key: :opening_flow_id - belongs_to :closing_flow, class_name: 'BuyClosingFlow', foreign_key: :closing_flow_id +module BitexBot + class OpenBuy < ActiveRecord::Base + belongs_to :opening_flow, class_name: 'BuyOpeningFlow', foreign_key: :opening_flow_id + belongs_to :closing_flow, class_name: 'BuyClosingFlow', foreign_key: :closing_flow_id - scope :open, -> { where('closing_flow_id IS NULL') } + scope :open, -> { where('closing_flow_id IS NULL') } + end end
Use nested module/class definitions instead of compact style.
diff --git a/lib/debot/recipes/fast_assets.rb b/lib/debot/recipes/fast_assets.rb index abc1234..def5678 100644 --- a/lib/debot/recipes/fast_assets.rb +++ b/lib/debot/recipes/fast_assets.rb @@ -0,0 +1,27 @@+set :assets_dependencies, %w(public app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb) + +namespace :debot do + namespace :assets do + desc <<-DESC + Run the asset precompilation rake task. You can specify the full path \ + to the rake executable by setting the rake variable. You can also \ + specify additional environment variables to pass to rake via the \ + asset_env variable. The defaults are: + + set :rake, "rake" + set :rails_env, "production" + set :asset_env, "RAILS_GROUPS=assets" + set :assets_dependencies, fetch(:assets_dependencies) + %w(config/locales/js) + DESC + task :precompile, :roles => :web, :except => { :no_release => true } do + from = source.next_revision(current_revision) + if capture("cd #{latest_release} && #{source.local.log(from)} #{assets_dependencies.join ' '} | wc -l").to_i > 0 + run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile} + else + logger.info "Skipping asset pre-compilation because there were no asset changes" + end + end + after "deploy", "debot:assets:precompile" + after "debot:assets:precompile", "deploy:restart" + end +end
Add debot assets precompile for public assets mainly
diff --git a/workers/worker_base.rb b/workers/worker_base.rb index abc1234..def5678 100644 --- a/workers/worker_base.rb +++ b/workers/worker_base.rb @@ -4,7 +4,12 @@ Thread.new do loop do sleep(self.timeout) - self.work + begin + self.work + rescue => ex + puts "[#{self.class} Exception]: #{ex}: " + puts caller.join("\n") + end end end end
Add basic exception handling for workers
diff --git a/fixed_array.rb b/fixed_array.rb index abc1234..def5678 100644 --- a/fixed_array.rb +++ b/fixed_array.rb @@ -19,7 +19,7 @@ private def name(index) raise IndexError unless (0...size).include?(index) - "@index#{index}" + :"@index#{index}" end end
Change string to symbol for stylistic reasons
diff --git a/lib/ar_doc_store/attribute_types/datetime_attribute.rb b/lib/ar_doc_store/attribute_types/datetime_attribute.rb index abc1234..def5678 100644 --- a/lib/ar_doc_store/attribute_types/datetime_attribute.rb +++ b/lib/ar_doc_store/attribute_types/datetime_attribute.rb @@ -1,42 +1,15 @@ module ArDocStore module AttributeTypes class DatetimeAttribute < BaseAttribute - def build - attribute = @attribute - load_method = load - dump_method = dump - default_value = default - json_column = :data - model.class_eval do - add_ransacker(attribute, 'timestamp') - define_method attribute.to_sym, -> { - value = read_store_attribute(json_column, attribute) - if value - value.public_send(dump_method) - elsif default_value - write_default_store_attribute(attribute, default_value) - default_value - end - } - define_method "#{attribute}=".to_sym, -> (value) { - if value.blank? - write_store_attribute(json_column, attribute, nil) - else - write_store_attribute(json_column, attribute, value.public_send(load_method)) - end - } - end - end - def type :datetime end - def dump + def load :to_time end - def load + def dump :to_s end end
Remove now-unnecessary implementation details in DateTimeAttribute
diff --git a/lib/generators/spree_address_book/install_generator.rb b/lib/generators/spree_address_book/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/spree_address_book/install_generator.rb +++ b/lib/generators/spree_address_book/install_generator.rb @@ -1,21 +1,23 @@ module SpreeAddressBook module Generators class InstallGenerator < Rails::Generators::Base + class_option :auto_run_migrations, :type => :boolean, :default => false + def add_javascripts append_file "app/assets/javascripts/store/all.js", "//= require store/spree_address_book\n" end - + def add_stylesheets inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_address_book\n", :before => /\*\//, :verbose => true end - + def add_migrations run 'bundle exec rake railties:install:migrations FROM=spree_address_book' end def run_migrations - res = ask "Would you like to run the migrations now? [Y/n]" - if res == "" || res.downcase == "y" + res = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask "Would you like to run the migrations now? [Y/n]") + if res run 'bundle exec rake db:migrate' else puts "Skiping rake db:migrate, don't forget to run it!"
Add possibility to run migration automatically
diff --git a/spec/generators/heat_spec.rb b/spec/generators/heat_spec.rb index abc1234..def5678 100644 --- a/spec/generators/heat_spec.rb +++ b/spec/generators/heat_spec.rb @@ -10,6 +10,7 @@ :description => 'sample template', :parameters => [], :resources => [], + :files => [], } template = CBF.generate(:heat, source) @@ -21,4 +22,27 @@ parsed.must_include 'Resources' parsed.must_include 'Outputs' end + + it "must specify required properties for instance resources" do + source = { + :description => 'sample template', + :parameters => [], + :resources => [{ + :name => 'my instance', + :type => :instance, + :image => 'test-image-id', + :hardware_profile => 'test-hwp' + }], + :files => [], + } + + t = JSON.parse(CBF.generate(:heat, source)) + t['Resources'].must_include 'my instance' + t['Resources']['my instance'].must_include 'Properties' + properties = t['Resources']['my instance']['Properties'] + properties.must_include 'ImageId' + properties['ImageId'].must_equal 'test-image-id' + properties.must_include 'InstanceType' + properties['InstanceType'].must_equal 'test-hwp' + end end
Test Heat generates the required properties Signed-off-by: Tomas Sedovic <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@sedovic.cz>
diff --git a/spec/java-properties_spec.rb b/spec/java-properties_spec.rb index abc1234..def5678 100644 --- a/spec/java-properties_spec.rb +++ b/spec/java-properties_spec.rb @@ -1,3 +1,4 @@+# coding: utf-8 require 'helper' describe JavaProperties do @@ -21,7 +22,7 @@ end it "writes to file" do - with_temp_file do |file| + with_temp_file do |file| subject.write({:item1 => "item1"}, file.path) file.rewind @@ -48,4 +49,4 @@ file.unlink end -end+end
Add source encoding hint for ruby 1.9.3 Otherwise the tests fail on 1.9.3
diff --git a/spec/models/question_spec.rb b/spec/models/question_spec.rb index abc1234..def5678 100644 --- a/spec/models/question_spec.rb +++ b/spec/models/question_spec.rb @@ -20,6 +20,7 @@ expect(@vote.voteable).to be_instance_of(Question) end end + end describe Question do
Add missing end of input
diff --git a/filterrific.gemspec b/filterrific.gemspec index abc1234..def5678 100644 --- a/filterrific.gemspec +++ b/filterrific.gemspec @@ -11,6 +11,7 @@ gem.authors = ['Jo Hund'] gem.email = 'jhund@clearcove.ca' gem.homepage = 'http://filterrific.clearcove.ca' + gem.license = 'MIT' gem.licenses = ['MIT'] gem.summary = 'A Rails engine plugin for filtering ActiveRecord lists.' gem.description = %(Filterrific is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists.)
Add the single license attribute Some verifiers don't appear to correctly parse the licenses attribute, so adding the single license version.
diff --git a/measurable.gemspec b/measurable.gemspec index abc1234..def5678 100644 --- a/measurable.gemspec +++ b/measurable.gemspec @@ -24,7 +24,7 @@ gem.required_ruby_version = '>= 1.9.3' gem.add_development_dependency 'bundler' - gem.add_development_dependency 'rake', '~> 10.1' - gem.add_development_dependency 'rdoc', '~> 4.1' + gem.add_development_dependency 'rake', '>= 12.3.3' + gem.add_development_dependency 'rdoc', '>= 6.0.0' gem.add_development_dependency 'rspec', '~> 3.2' end
Update rake & rdoc versions Older rake versions had a security hole that was patched in 12.3.3.
diff --git a/lib/motion-sqlite3/result_set.rb b/lib/motion-sqlite3/result_set.rb index abc1234..def5678 100644 --- a/lib/motion-sqlite3/result_set.rb +++ b/lib/motion-sqlite3/result_set.rb @@ -15,41 +15,29 @@ private - def columns - columns = {} + def current_row + row = {} - count = sqlite3_column_count(@handle.value) - 0.upto(count-1) do |i| + column_count = sqlite3_column_count(@handle.value) + 0.upto(column_count - 1) do |i| name = sqlite3_column_name(@handle.value, i).to_sym type = sqlite3_column_type(@handle.value, i) - columns[name] = ColumnMetadata.new(i, type) - end - - columns - end - - def current_row - row = {} - - columns.each do |name, metadata| - case metadata.type + case type when SQLITE_NULL row[name] = nil when SQLITE_TEXT - row[name] = sqlite3_column_text(@handle.value, metadata.index) + row[name] = sqlite3_column_text(@handle.value, i) when SQLITE_BLOB - row[name] = NSData.dataWithBytes(sqlite3_column_blob(@handle.value, metadata.index), length: sqlite3_column_bytes(@handle.value, metadata.index)) + row[name] = NSData.dataWithBytes(sqlite3_column_blob(@handle.value, i), length: sqlite3_column_bytes(@handle.value, i)) when SQLITE_INTEGER - row[name] = sqlite3_column_int(@handle.value, metadata.index) + row[name] = sqlite3_column_int(@handle.value, i) when SQLITE_FLOAT - row[name] = sqlite3_column_double(@handle.value, metadata.index) + row[name] = sqlite3_column_double(@handle.value, i) end end row end end - - class ColumnMetadata < Struct.new(:index, :type); end end
Remove unnecessary object churn in ResultSet
diff --git a/app/models/kennedy/post.rb b/app/models/kennedy/post.rb index abc1234..def5678 100644 --- a/app/models/kennedy/post.rb +++ b/app/models/kennedy/post.rb @@ -4,5 +4,16 @@ attr_accessible :category_ids has_and_belongs_to_many :categories + searchable do + string :month, stored: true + string :categories, multiple: true, stored: true do + categories.map(&:name) + end + end + + def month + @month ||= published_at.strftime('%B %Y') + end + end end
Add month & categories to index
diff --git a/app/models/single_value.rb b/app/models/single_value.rb index abc1234..def5678 100644 --- a/app/models/single_value.rb +++ b/app/models/single_value.rb @@ -2,10 +2,10 @@ @@mutex = Mutex.new def self.update(value) - sublcass_name = self.name + subclass_name = self.name single_value = nil @@mutex.synchronize do - single_value = SingleValue.find_or_create_by(type: sublcass_name) + single_value = SingleValue.find_or_create_by(type: subclass_name) end single_value.update_attribute :value, Marshal.dump(value) @@ -13,7 +13,8 @@ end def self.get(options = {}) - scope = self + subclass_name = self.name + scope = where(type: subclass_name) scope = scope.where("updated_at >= ?", options[:newer_than]) if options[:newer_than].present? result = scope.first return if result.nil?
Fix SingleValue.get: only get values for the SingleValue Subclass
diff --git a/memoizable.gemspec b/memoizable.gemspec index abc1234..def5678 100644 --- a/memoizable.gemspec +++ b/memoizable.gemspec @@ -1,22 +1,23 @@-lib = File.expand_path('../lib', __FILE__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'memoizable/version' +require File.expand_path('../lib/memoizable/version', __FILE__) -Gem::Specification.new do |spec| - spec.add_development_dependency('bundler', '~> 1.3', '>= 1.3.5') - spec.add_dependency('thread_safe', '~> 0.1.3') +Gem::Specification.new do |gem| + gem.name = 'memoizable' + gem.version = Memoizable::VERSION.dup + gem.authors = ['Dan Kubb'] + gem.email = 'dan.kubb@gmail.com' + gem.description = 'Memoize method return values' + gem.summary = gem.description + gem.homepage = 'https://github.com/dkubb/memoizable' + gem.license = 'MIT' - spec.authors = ["Dan Kubb"] - spec.description = %q{Memoize method return values} - spec.email = ["dan.kubb@gmail.com"] - spec.files = %w[CONTRIBUTING.md LICENSE.md README.md Rakefile memoizable.gemspec] - spec.files += Dir.glob("lib/**/*.rb") - spec.files += Dir.glob("spec/**/*") - spec.homepage = 'https://github.com/dkubb/memoizable' - spec.licenses = %w[MIT] - spec.name = 'memoizable' - spec.require_paths = %w[lib] - spec.summary = spec.description - spec.test_files = Dir.glob("spec/**/*") - spec.version = Memoizable::VERSION.dup + gem.require_paths = %w[lib] + gem.files = %w[CONTRIBUTING.md LICENSE.md README.md Rakefile memoizable.gemspec] + gem.files += Dir.glob('lib/**/*.rb') + gem.files += Dir.glob('spec/**/*') + gem.test_files = Dir.glob('spec/**/*') + gem.extra_rdoc_files = %w[LICENSE.md README.md CONTRIBUTING.md] + + gem.add_runtime_dependency('thread_safe', '~> 0.1.3') + + gem.add_development_dependency('bundler', '~> 1.3', '>= 1.3.5') end
Change gemspec to match other gems
diff --git a/db/migrate/20160505130158_fix_gss_codes_for_some_councils_in_existing_support_schemes.rb b/db/migrate/20160505130158_fix_gss_codes_for_some_councils_in_existing_support_schemes.rb index abc1234..def5678 100644 --- a/db/migrate/20160505130158_fix_gss_codes_for_some_councils_in_existing_support_schemes.rb +++ b/db/migrate/20160505130158_fix_gss_codes_for_some_councils_in_existing_support_schemes.rb @@ -0,0 +1,37 @@+class FixGssCodesForSomeCouncilsInExistingSupportSchemes < Mongoid::Migration + def self.up + # "Editing of an edition with an Archived artefact is not allowed". + Edition.skip_callback(:save, :before, :check_for_archived_artefact) + + northumberland_schemes = BusinessSupportEdition.where(area_gss_codes: "E06000048") + northumberland_schemes.each do |ns| + ns.area_gss_codes.delete("E06000048") + ns.area_gss_codes.push("E06000057") + ns.save!(validate: false) + end + + gateshead_schemes = BusinessSupportEdition.where(area_gss_codes: "E08000020") + gateshead_schemes.each do |gs| + gs.area_gss_codes.delete("E08000020") + gs.area_gss_codes.push("E08000037") + gs.save!(validate: false) + end + + east_hertfordshire_schemes = BusinessSupportEdition.where(area_gss_codes: "E07000097") + east_hertfordshire_schemes.each do |ehs| + ehs.area_gss_codes.delete("E07000097") + ehs.area_gss_codes.push("E07000242") + ehs.save!(validate: false) + end + + stevenage_schemes = BusinessSupportEdition.where(area_gss_codes: "E07000101") + stevenage_schemes.each do |ss| + ss.area_gss_codes.delete("E07000101") + ss.area_gss_codes.push("E07000243") + ss.save!(validate: false) + end + end + + def self.down + end +end
Fix GSS codes for some councils in existing Business Support editions - Following on from frontend PR 948, we had to edit existing Business Support Editions so that they would refer to the correct GSS codes from the new data in MapIt, not the old ones that no longer worked. This migration does just that, replacing the old GSS codes in the edition's `area_gss_codes` array with the new ones. The councils edited are: Northumberland, Gateshead, East Hertfordshire and Stevenage. - We had to skip callbacks that checked for archived Artefacts in Panopticon, and skip validations that said that already published editions couldn't be edited.
diff --git a/puppet-lint-duplicate_class_parameters-check.gemspec b/puppet-lint-duplicate_class_parameters-check.gemspec index abc1234..def5678 100644 --- a/puppet-lint-duplicate_class_parameters-check.gemspec +++ b/puppet-lint-duplicate_class_parameters-check.gemspec @@ -22,7 +22,7 @@ spec.add_development_dependency 'rspec', '~> 3.9.0' spec.add_development_dependency 'rspec-its', '~> 1.0' spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0' - spec.add_development_dependency 'rubocop', '~> 0.81.0' + spec.add_development_dependency 'rubocop', '~> 0.82.0' spec.add_development_dependency 'rake', '~> 13.0.0' spec.add_development_dependency 'rspec-json_expectations', '~> 2.2' spec.add_development_dependency 'simplecov', '~> 0.18.0'
Update rubocop requirement from ~> 0.81.0 to ~> 0.82.0 Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.81.0...v0.82.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/test/integration/idle_loop_test.rb b/test/integration/idle_loop_test.rb index abc1234..def5678 100644 --- a/test/integration/idle_loop_test.rb +++ b/test/integration/idle_loop_test.rb @@ -1,8 +1,29 @@ require 'gir_ffi_test_helper' + +class Foo + def initialize + @handler = proc { self.idle_handler; false } + end + + def idle_handler + let_other_threads_run + set_idle_proc + end + + def let_other_threads_run + Thread.pass + end + + def set_idle_proc + GLib.idle_add(GLib::PRIORITY_DEFAULT_IDLE, @handler, nil, nil) + end +end describe "threading" do it "works while a MainLoop is running" do main_loop = GLib::MainLoop.new nil, false + foo = Foo.new + foo.idle_handler a = [] GLib.timeout_add(GLib::PRIORITY_DEFAULT, 100,
Add simple idle loop implementation
diff --git a/mock_redis.gemspec b/mock_redis.gemspec index abc1234..def5678 100644 --- a/mock_redis.gemspec +++ b/mock_redis.gemspec @@ -20,5 +20,4 @@ s.add_development_dependency "redis", "~> 2.2.1" s.add_development_dependency "rspec", "~> 2.6.0" - s.add_development_dependency "ZenTest" end
Drop ZenTest as a development dependency ZenTest wants to force the evil that is RubyGems 1.8 on us, but accepting that would mean journeying into a world of spammy deprecation notices. Change-Id: I0badd3f46edb73d25b56c9723630215c15455d9e Reviewed-on: https://gerrit.causes.com/1524 Tested-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/model_base.gemspec b/model_base.gemspec index abc1234..def5678 100644 --- a/model_base.gemspec +++ b/model_base.gemspec @@ -27,5 +27,6 @@ spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "rspec-its" + spec.add_development_dependency 'rspec-rails' spec.add_development_dependency 'generator_spec' end
Add dependency to rspec-rails to load generators in it