diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/rails-settings/base.rb b/lib/rails-settings/base.rb index abc1234..def5678 100644 --- a/lib/rails-settings/base.rb +++ b/lib/rails-settings/base.rb @@ -2,7 +2,7 @@ module Base def self.included(base) base.class_eval do - has_one :setting_object, :as => :target, :dependent => :delete, :class_name => 'RailsSettings::SettingObject' + has_one :setting_object, :as => :target, :dependent => :delete, :class_name => 'RailsSettings::SettingObject', :autosave => true def settings @_settings_struct ||= OpenStruct.new self.class.default_settings.merge(setting_object ? setting_object.value : {}) @@ -19,8 +19,8 @@ if hash.present? && hash != self.class.default_settings build_setting_object unless setting_object setting_object.value = hash - else - self.setting_object = nil + elsif self.setting_object + self.setting_object.mark_for_destruction end end end
has_one: Use "autosave" option and "mark_for_destruction"
diff --git a/lib/restforce/file_part.rb b/lib/restforce/file_part.rb index abc1234..def5678 100644 --- a/lib/restforce/file_part.rb +++ b/lib/restforce/file_part.rb @@ -3,15 +3,15 @@ case Faraday::VERSION when /\A0\./ require 'faraday/upload_io' -when /\A1\.9/ - # Faraday v1.9 automatically includes the `faraday-multipart` - # gem, which includes `Faraday::FilePart` - require 'faraday/multipart' -when /\A1\./ +when /\A1\.[0-8]\./ # Faraday 1.x versions before 1.9 - not matched by # the previous clause - use `FilePart` (which must be explicitly # required) require 'faraday/file_part' +when /\A1\./ + # Later 1.x versions from 1.9 onwards automatically include the + # `faraday-multipart` gem, which includes `Faraday::FilePart` + require 'faraday/multipart' else raise "Unexpected Faraday version #{Faraday::VERSION} - not sure how to set up " \ "multipart support"
Load the right code for multipart support with Faraday v1.10.x
diff --git a/lib/riddle/auto_version.rb b/lib/riddle/auto_version.rb index abc1234..def5678 100644 --- a/lib/riddle/auto_version.rb +++ b/lib/riddle/auto_version.rb @@ -6,13 +6,12 @@ case version when '0.9.8', '0.9.9' require "riddle/#{version}" - when '1.10-beta', '1.10-id64-beta', '1.10-dev' + when /1.10/ require 'riddle/1.10' when /2.0.1/ require 'riddle/2.0.1' else - puts "found version: #{version}" - exit + puts "Unknown Sphinx Version: #{version}" end end end
Remove forced exit, and replacing repetition with regex.
diff --git a/lib/tasks/testing.rake b/lib/tasks/testing.rake index abc1234..def5678 100644 --- a/lib/tasks/testing.rake +++ b/lib/tasks/testing.rake @@ -0,0 +1,5 @@+ +Rake::TestTask.new("test:integration:flows") do |t| + t.libs << "test" + t.test_files = Dir["test/integration/flows/**/*_test.rb"] +end
Add rake task for running all flow integration tests.
diff --git a/lib/tictactoe_rules.rb b/lib/tictactoe_rules.rb index abc1234..def5678 100644 --- a/lib/tictactoe_rules.rb +++ b/lib/tictactoe_rules.rb @@ -29,4 +29,14 @@ board.valid_slots == [] || winning_indices(board, "X") || winning_indices(board, "O") ? true : false end + def winner(ttt_board, turn) + if winning_indices(ttt_board, "X") + "X won!" + elsif winning_indices(ttt_board, "O") + "O won!" + elsif draw?(ttt_board, ttt_board.turn) + "It's a draw!" + end + end + end
Add logic to tell who won
diff --git a/lib/sov/utils/constants.rb b/lib/sov/utils/constants.rb index abc1234..def5678 100644 --- a/lib/sov/utils/constants.rb +++ b/lib/sov/utils/constants.rb @@ -3,7 +3,7 @@ module Utils VERSION = '0.2.1' PACKAGE_NAME = 'sov-utils' - PSQL_VERSION = '9.4.12' + PSQL_VERSION = '9.6.6' BUNDLER_VERSION = '1.15.1' PROJECT_NAME = 'sov-utils' DUMP_DIR = '.dump_files'
Upgrade psql to version 9.6.6
diff --git a/lib/specjour/quiet_fork.rb b/lib/specjour/quiet_fork.rb index abc1234..def5678 100644 --- a/lib/specjour/quiet_fork.rb +++ b/lib/specjour/quiet_fork.rb @@ -4,9 +4,9 @@ def self.fork(&block) @pid = Kernel.fork do + at_exit { exit! } $stdout = StringIO.new block.call - exit! end end end
Fix another inheriting exit handler
diff --git a/lib/spree_komoju/engine.rb b/lib/spree_komoju/engine.rb index abc1234..def5678 100644 --- a/lib/spree_komoju/engine.rb +++ b/lib/spree_komoju/engine.rb @@ -11,6 +11,7 @@ app.config.spree.payment_methods << Spree::Gateway::KomojuCreditCard app.config.spree.payment_methods << Spree::Gateway::KomojuKonbini app.config.spree.payment_methods << Spree::Gateway::KomojuBankTransfer + app.config.spree.payment_methods << Spree::Gateway::KomojuPayEasy end # use rspec for tests
Add Spree::Gateway::KomojuPayEasy to spree payment methods
diff --git a/config/initializers/delayed_job_config.rb b/config/initializers/delayed_job_config.rb index abc1234..def5678 100644 --- a/config/initializers/delayed_job_config.rb +++ b/config/initializers/delayed_job_config.rb @@ -1,5 +1,5 @@-Delayed::Worker.max_attempts = 100 -Delayed::Worker.max_run_time = 1.week +Delayed::Worker.max_attempts = 15 +Delayed::Worker.max_run_time = 6.hours require 'active_job/queue_adapters/delayed_job_adapter'
Adjust delayed_job config to something more sane The configured max runtime and max attempts were left as set in the initial code dump fron the first version of the website. The rationale for the chosen figures is lost in the mists of time but seem somewhat large. The 1 week max runtime may have been to send out the bulk emails which is understandable but will be not tolerable for users. The 100 max attempts coupled with the backoff inherent in delayed_job means that the job would be in the queue for over 61 years! Perhaps earlier versions of delayed_job didn't have such a backoff? The figure of 15 for max attempts will mean a job is re-tried for over 35 hours which is a reasonable period of time.
diff --git a/lib/tasks/sample_data.rake b/lib/tasks/sample_data.rake index abc1234..def5678 100644 --- a/lib/tasks/sample_data.rake +++ b/lib/tasks/sample_data.rake @@ -2,6 +2,7 @@ desc "Fill database with sample data" task :populate => :environment do make_users + make_jobs end end @@ -22,4 +23,24 @@ ) user.save end +end + +def make_jobs + positions = [ + "Senior Developer", + "Junior Developer", + "Code Ninja", + "Code Surfer", + "Pro Hacker", + "Programmer" + ] + 20.times do |n| + job = Job.new( + title: positions.sample, + description: Faker::Company.bs, + company_name: Faker::Company.name, + company_website: Faker::Internet.domain_name, + how_to_apply: "Send an email to #{Faker::Internet.email}" + ).save + end end
Create jobs with other sample data
diff --git a/lib/zopim_rails/chatbox.rb b/lib/zopim_rails/chatbox.rb index abc1234..def5678 100644 --- a/lib/zopim_rails/chatbox.rb +++ b/lib/zopim_rails/chatbox.rb @@ -4,7 +4,7 @@ class Chatbox def render_script <<-JAVASCRIPT - <script type="text/javascript">function zopim_chat(){$('[__jx__id]').remove();window.$zopim = null;(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set._.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');$.src='//v2.zopim.com/?#{ZopimRails.configuration.api_key}';z.t=+new Date;$.type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script')};$(window).off('page:change.zopim').on('page:change.zopim', zopim_chat);</script> + <script type="text/javascript">function zopim_chat(){$('[__jx__id]').remove();window.$zopim = null;(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set._.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');$.src='//v2.zopim.com/?#{ZopimRails.configuration.api_key}';z.t=+new Date;$.type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script')};$(window).off('page:change.zopim turbolinks:load.zopim').on('page:change.zopim turbolinks:load.zopim', zopim_chat);</script> JAVASCRIPT end end
Fix script for Chatbox to work with Turbolinks 5
diff --git a/lib/rubrics/smoking_status.rb b/lib/rubrics/smoking_status.rb index abc1234..def5678 100644 --- a/lib/rubrics/smoking_status.rb +++ b/lib/rubrics/smoking_status.rb @@ -0,0 +1,48 @@+module FHIR + class SmokingStatus < FHIR::Rubrics + + SMOKING_CODES = [ + '449868002', #Current every day smoker + '428041000124106', #Current some day smoker + '8517006', #Former smoker + '266919005', #Never smoker + '77176002', #Smoker, current status unknown + '266927001', #Unknown if ever smoked + '428071000124103', #Current Heavy tobacco smoker + '428061000124105' #Current Light tobacco smoker + ] + + # The Patient Record should include Smoking Status + rubric :smoking_status do |record| + + resources = record.entry.map{|e|e.resource} + has_smoking_status = resources.any? do |resource| + resource.is_a?(FHIR::Observation) && smoking_observation?(resource) + end + + if has_smoking_status + points = 10 + else + points = 0 + end + + message = "The Patient Record should include Smoking Status (DAF-core-smokingstatus profile on Observation)." + response(points.to_i,message) + end + + def self.smoking_observation?(resource) + smoking_code?(resource.code) && smoking_value?(resource.valueCodeableConcept) + end + + def self.smoking_code?(codeableconcept) + return false if codeableconcept.nil? || codeableconcept.coding.nil? + codeableconcept.coding.any?{|x| x.system=='http://loinc.org' && x.code=='72166-2'} + end + + def self.smoking_value?(codeableconcept) + return false if codeableconcept.nil? || codeableconcept.coding.nil? + codeableconcept.coding.any?{|x| x.system=='http://snomed.info/sct' && SMOKING_CODES.include?(x.code)} + end + + end +end
Add rubric for smoking status.
diff --git a/lib/sprockets/webp/railtie.rb b/lib/sprockets/webp/railtie.rb index abc1234..def5678 100644 --- a/lib/sprockets/webp/railtie.rb +++ b/lib/sprockets/webp/railtie.rb @@ -2,7 +2,7 @@ module Sprockets module WebP - class Railtie < (::Rails::VERSION::MAJOR < 4 ? ::Rails::Engine : ::Rails::Railtie) + class Railtie < ::Rails::Railtie initializer :webp do |app| app.assets.register_mime_type 'image/jpeg', '.jpg' app.assets.register_postprocessor 'image/jpeg', :jpeg_webp do |context, data|
Drop support of Rails 3
diff --git a/db_backup.rb b/db_backup.rb index abc1234..def5678 100644 --- a/db_backup.rb +++ b/db_backup.rb @@ -3,28 +3,30 @@ require 'yaml' config = YAML.load_file(File.expand_path("../config.yml", __FILE__)) -project_config, amazon_config = config["project"], config["amazon"] +project, amazon = config["project"], config["amazon"] AWS::S3::Base.establish_connection!( - :access_key_id => amazon_config['access_key_id'], - :secret_access_key => amazon_config['secret_access_key'] + :access_key_id => amazon['access_key_id'], + :secret_access_key => amazon['secret_access_key'] ) -database = YAML.load_file("#{project_config['base_path']}/config/database.yml")[project_config['env']] -dumpfile = File.expand_path("/tmp/#{database['database']}_backup", __FILE__) +database = YAML.load_file("#{project['base_path']}/config/database.yml")[project['env']] -print "Creating dumpfile (#{dumpfile})..." +filename = "#{database['database']}_#{Time.now.strftime('%F-%H.%M')}.backup" +dumpfile = File.expand_path("/tmp/#{filename}", __FILE__) + +print "Creating dumpfile (#{filename})..." command = "mysqldump --user #{database['username']} --password=#{database['password']} #{database['database']} > #{dumpfile}" r = system(command) puts "done." print "Sending backup to AWS..." -send = AWS::S3::S3Object.store("#{database['database']}_#{Time.now.strftime('%F-%H.%M')}.backup", open(dumpfile), amazon_config['bucket']) +s3_object = AWS::S3::S3Object.store("#{filename}", open(dumpfile), amazon['bucket']) puts "done." -if send.response.code == "200" +if s3_object.response.code == "200" puts "Dumpfile deleted." if File.delete("#{dumpfile}") == 1 else puts "WARNING: Dumpfile not deleted."
Clean up variable names and file paths
diff --git a/mithril_rails.gemspec b/mithril_rails.gemspec index abc1234..def5678 100644 --- a/mithril_rails.gemspec +++ b/mithril_rails.gemspec @@ -17,8 +17,8 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] - s.add_dependency 'execjs' - s.add_dependency "rails", "~> 4.1.0" + s.add_dependency "execjs", "~> 2.2.2" + s.add_dependency "rails", "~> 3.2.0" s.add_development_dependency "sqlite3" end
Set execjs version dependency, lower Rails dependency to 3.2.
diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -6,15 +6,18 @@ # super # end - # POST /resource/sign_in - # def create - # super - # end + # POST /resource/sign_in + def create + user = User.find_by_email(params[:user][:email]) + user.update(status: true) + super + end - # DELETE /resource/sign_out - # def destroy - # super - # end + # DELETE /resource/sign_out + def destroy + current_user.update(status: false) + super + end # protected
Add new actions to toggle user status (offline or online) This occurs when the user is logged or logged out
diff --git a/lib/openlogi/base_object.rb b/lib/openlogi/base_object.rb index abc1234..def5678 100644 --- a/lib/openlogi/base_object.rb +++ b/lib/openlogi/base_object.rb @@ -14,7 +14,9 @@ super end + property :error property :errors + property :error_description def valid? errors.empty?
Add error/error_description back to BaseObject Otherwise these will raise warnings when creating an object from the response.
diff --git a/lib/serverspec/type/base.rb b/lib/serverspec/type/base.rb index abc1234..def5678 100644 --- a/lib/serverspec/type/base.rb +++ b/lib/serverspec/type/base.rb @@ -6,7 +6,9 @@ end def to_s - type = self.class.name.split(':')[-1] + type = self.class.name.split(':')[-1] + type.gsub!(/([a-z\d])([A-Z])/, '\1 \2') + type.capitalize! %Q!#{type} "#{@name}"! end end
Fix to display "KenrlModule" as "Kernel module"
diff --git a/lib/story_branch/version.rb b/lib/story_branch/version.rb index abc1234..def5678 100644 --- a/lib/story_branch/version.rb +++ b/lib/story_branch/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module StoryBranch - VERSION = '0.3.1' + VERSION = '0.3.2' end
Bump to 0.3.2 to test CI/CD
diff --git a/down.gemspec b/down.gemspec index abc1234..def5678 100644 --- a/down.gemspec +++ b/down.gemspec @@ -16,5 +16,6 @@ spec.add_development_dependency "rake" spec.add_development_dependency "minitest", "~> 5.8" spec.add_development_dependency "webmock" + spec.add_development_dependency "addressable", "< 2.5" spec.add_development_dependency "mocha" end
Fix tests for Ruby 1.9.3 Addressable >= 2.5.0 comes with public_suffix dependency, which requires Ruby >= 2.0.
diff --git a/deploy/before_symlink.rb b/deploy/before_symlink.rb index abc1234..def5678 100644 --- a/deploy/before_symlink.rb +++ b/deploy/before_symlink.rb @@ -1 +1 @@-run "cd #{release_path} && RAILS_ENV=production bundle exec rake assets:precompile" +run "cd #{release_path} && RAILS_ENV=production bundle exec rake assets:precompile --trace"
Add trace output for assets:precompile
diff --git a/Formula/haskell-platform.rb b/Formula/haskell-platform.rb index abc1234..def5678 100644 --- a/Formula/haskell-platform.rb +++ b/Formula/haskell-platform.rb @@ -1,16 +1,16 @@ require 'formula' class HaskellPlatform < Formula - url 'http://hackage.haskell.org/platform/2010.2.0.0/haskell-platform-2010.2.0.0.tar.gz' + url 'http://lambda.galois.com/hp-tmp/2011.2.0.0/haskell-platform-2011.2.0.0.tar.gz' homepage 'http://hackage.haskell.org/platform/' - md5 '9d1dd22a86bf2505591e6375f7dbe18e' - version '2010.2.0.0' + md5 'b259698a93986b8679a0b0a415780e3a' + version '2011.2.0.0' depends_on 'ghc' def install # libdir doesn't work if passed to configure, needs to be passed to make install - system "./configure", "--prefix=#{prefix}" + system "./configure", "--prefix=#{prefix}", "--enable-unsupported-ghc-version" system %Q(EXTRA_CONFIGURE_OPTS="--libdir=#{lib}/ghc" make install) end
Update Haskell Platform to 2011.2.0.0. Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
diff --git a/config/deploy.rb b/config/deploy.rb index abc1234..def5678 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -15,6 +15,8 @@ config/redis.yml config/secrets.yml } + +set :log_level, :info namespace :deploy do
Reduce the level of detail in the output
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ get "fixtures/*filename", :action => :fixtures end match "fixtures/*filename", :to => "spec#fixtures" - match "/(:suite)", :to => "spec#index", defaults: { suite: false } + match "/(:suite)", :to => "spec#index", defaults: { suite: nil } end if Jasminerice.mount
Replace default suite param value with nil False will throw NoMethodError.
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - devise_for :users, :controllers => { registrations: 'registrations' } + devise_for :users, :controllers => { registrations: 'registrations', sessions: 'sessions' } resources :skills root 'skills#index'
Add route for child sessions controller
diff --git a/config/deploy.rb b/config/deploy.rb index abc1234..def5678 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -13,3 +13,5 @@ set :keep_releases, 5 set :bundle_without, %w{development test deployment}.join(' ') + +set :puma_workers, 1
Set the number of puma workers to 1 The machine only have 1 CPU so it is better to only have 1 worker otherwise the two workers would be fighting against each other and may cause timeout on boot.
diff --git a/test/pass_manager_builder_test.rb b/test/pass_manager_builder_test.rb index abc1234..def5678 100644 --- a/test/pass_manager_builder_test.rb +++ b/test/pass_manager_builder_test.rb @@ -0,0 +1,33 @@+require 'test_helper' +require 'llvm/transforms/builder' + +class PassManagerBuilderTest < Test::Unit::TestCase + def setup + LLVM.init_jit + @builder = LLVM::PassManagerBuilder.new + end + + def teardown + @builder.dispose + end + + def test_init + assert_equal 0, @builder.size_level + assert_equal 0, @builder.opt_level + assert_equal false, @builder.unit_at_a_time + assert_equal false, @builder.unroll_loops + assert_equal false, @builder.simplify_lib_calls + assert_equal 0, @builder.inliner_threshold + end + + def test_opt_level + @builder.opt_level = 3 + assert_equal 3, @builder.opt_level + end + + def test_build + machine = LLVM::Target.by_name('x86-64').create_machine('x86-linux-gnu') + pass_manager = LLVM::PassManager.new(machine) + @builder.build(pass_manager) + end +end
Add some pass manager builder tests
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -40,4 +40,6 @@ resources :challenges, only: [:new, :create, :index] root :to => 'home#index' + match '/about' => 'high_voltage/pages#show', :id => 'about' + end
Add route for legacy about URL
diff --git a/app/decorators/goal_decorator.rb b/app/decorators/goal_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/goal_decorator.rb +++ b/app/decorators/goal_decorator.rb @@ -1,17 +1,28 @@ class GoalDecorator < Draper::Decorator delegate_all + def strftime_for_depth + case model.depth + when 0 + "%b %y" + when 1 + "%b %y" + when 2 + "%b %y" + when 3 + "%a, %-d %B %y" + when 4 + "%d %b %y" + else + "%d %b %y" + end + end + def date_range return "" if model.start.blank? or model.end.blank? - - start = model.start.strftime("%b '%y") - e = model.end.strftime("%b '%y") - - if start == e - start - else - "#{start} - #{e}" - end + start = model.start.strftime(strftime_for_depth) + e = model.end.strftime(strftime_for_depth) + "#{start} - #{e}" end def expanded_date_range
Customize date range display based on depth.
diff --git a/app/device/connection_handler.rb b/app/device/connection_handler.rb index abc1234..def5678 100644 --- a/app/device/connection_handler.rb +++ b/app/device/connection_handler.rb @@ -24,7 +24,7 @@ Rails.logger.info [:close, socket_id(socket), event.code, event.reason] connection = DeviceConnection.find_by_socket socket - connection.delete + connection.delete if connection end private
Check if the connection is valid before deleting it.
diff --git a/app/helpers/supporters_helper.rb b/app/helpers/supporters_helper.rb index abc1234..def5678 100644 --- a/app/helpers/supporters_helper.rb +++ b/app/helpers/supporters_helper.rb @@ -35,10 +35,11 @@ def joy_or_disappointment(from_plan, to_plan) change_direction = plan_change_word(from_plan, to_plan).downcase - case change_direction - when "upgrade" + def joy_or_disappointment(from_plan, to_plan) + case plan_change_word(from_plan, to_plan) + when "Upgrade" "What a hero!" - when "downgrade" + when "Downgrade" "Thanks for continuing to be a supporter!" else raise
Refactor to remove local variable assignment
diff --git a/config/deploy.rb b/config/deploy.rb index abc1234..def5678 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -17,8 +17,8 @@ task :restart do on roles(:app) do within release_path do - # execute "kill -USR2 $(cat #{release_path}/tmp/pids/unicorn.pid)" - # execute "kill -WINCH $(cat #{release_path}/tmp/pids/unicorn.pid.oldbin)" + execute "kill -USR2 $(cat #{release_path}/tmp/pids/unicorn.pid)" + execute "kill -WINCH $(cat #{release_path}/tmp/pids/unicorn.pid.oldbin)" end end end
Revert "Deactivate server restarts once more (for production)" This reverts commit 18c77f794e043cd3db9f196ae41032e15252a6e4.
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,5 @@ Notifiable::Engine.routes.draw do - resources :device_tokens, :only => [:create, :destroy] - + put 'notification_statuses/:uuid/opened', :to => "notification_statuses#opened" end
Add route to mark notification as opened
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,6 @@ resources :comments end - get '/languages/:language_id/queries/bing/new' => "queries#bing_new" post '/languages/:language_id/queries/bing' => "queries#bing_create" # namespace :queries do # resources :comments, path: '/:query_id'
Remove route for new bing form page because added modal
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index abc1234..def5678 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -9,6 +9,7 @@ end def inbox - @conversations = current_user.conversations.sort{ |c| c.messages.last.created_at }.reverse + # conversations for this user latest first + @conversations = current_user.conversations.sort_by { |c| c.messages.last.created_at }.reverse end end
Sort conversations according to the latest one first
diff --git a/app/controllers/edit_tree_controller.rb b/app/controllers/edit_tree_controller.rb index abc1234..def5678 100644 --- a/app/controllers/edit_tree_controller.rb +++ b/app/controllers/edit_tree_controller.rb @@ -25,7 +25,7 @@ redirect_to project_blob_path(@project, @id), notice: "Your changes have been successfully commited" else flash[:notice] = "Your changes could not be commited, because the file has been changed" - render :edit + render :show end end
Fix 500 error on edit with ui
diff --git a/app/controllers/responses_controller.rb b/app/controllers/responses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/responses_controller.rb +++ b/app/controllers/responses_controller.rb @@ -37,6 +37,7 @@ end def up_vote + response = Response.find(params[:id]) end
Set response to the current response.
diff --git a/app/helpers/hackathon_manager_helper.rb b/app/helpers/hackathon_manager_helper.rb index abc1234..def5678 100644 --- a/app/helpers/hackathon_manager_helper.rb +++ b/app/helpers/hackathon_manager_helper.rb @@ -1,5 +1,6 @@ module HackathonManagerHelper def title(page_title) + content_for(:page_title) { page_title } content_for(:title) { page_title + " - #{Rails.configuration.hackathon['name']}" } page_title end
Save raw page title to content_for variable
diff --git a/spec/lib/guard/rspec/formatter_spec.rb b/spec/lib/guard/rspec/formatter_spec.rb index abc1234..def5678 100644 --- a/spec/lib/guard/rspec/formatter_spec.rb +++ b/spec/lib/guard/rspec/formatter_spec.rb @@ -9,13 +9,13 @@ after { File.delete('./tmp/rspec_guard_result') } context 'with failures' do - let(:example) { double( + let(:failed_example) { double( execution_result: { status: 'failed' }, metadata: { location: 'failed_location' } ) } it 'writes summary line and failed location in tmp dir' do - formatter.stub(:examples) { [example] } + formatter.stub(:examples) { [failed_example] } formatter.dump_summary(123, 3, 1, 0) result = File.open('./tmp/rspec_guard_result').read expect(result).to match /^3 examples, 1 failures in 123\.0 seconds\nfailed_location\n$/
Rename example to failed_example to avoid confusion with implicit example object.
diff --git a/spec/unit/rom/support/registry_spec.rb b/spec/unit/rom/support/registry_spec.rb index abc1234..def5678 100644 --- a/spec/unit/rom/support/registry_spec.rb +++ b/spec/unit/rom/support/registry_spec.rb @@ -0,0 +1,39 @@+require 'spec_helper' +require 'rom/support/registry' + +describe ROM::Registry do + subject(:registry) { registry_class.new(mars: mars) } + + let(:mars) { double('mars') } + + let(:registry_class) do + Class.new(ROM::Registry) do + def self.name + 'Candy' + end + end + end + + describe '#fetch' do + it 'returns registered elemented identified by name' do + expect(registry[:mars]).to be(mars) + end + + it 'raises error when element is not found' do + expect { registry[:twix] }.to raise_error( + ROM::Registry::ElementNotFoundError, + ":twix doesn't exist in Candy registry" + ) + end + end + + describe '.element_name' do + it 'returns registered elemented identified by element_name' do + expect(registry[:mars]).to be(mars) + end + + it 'raises no-method error when element is not there' do + expect { registry.twix }.to raise_error(NoMethodError) + end + end +end
Move ROM::Registry tests from main "rom" repo These tests were previously in the "rom" repository, although the code is in this repository.
diff --git a/test/functional/taverna_player/workflows_controller_test.rb b/test/functional/taverna_player/workflows_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/taverna_player/workflows_controller_test.rb +++ b/test/functional/taverna_player/workflows_controller_test.rb @@ -18,6 +18,12 @@ @routes = TavernaPlayer::Engine.routes end + test "should route to workflows" do + assert_routing "/workflows", + { :controller => "taverna_player/workflows", :action => "index" }, {}, + {}, "Did not route correctly" + end + test "should get index html" do get :index assert_response :success
Add a routing test for the workflows controller.
diff --git a/lib/fakefs/io.rb b/lib/fakefs/io.rb index abc1234..def5678 100644 --- a/lib/fakefs/io.rb +++ b/lib/fakefs/io.rb @@ -2,19 +2,19 @@ # FakeFS IO class inherit root IO # Only minimal mocks are provided as IO may be used by ruby's internals class IO < ::IO - # Redirects ::IO.binread to ::FakeFS::File.read - def self.binread(*args, **keywords) - ::FakeFS::File.binread(*args, **keywords) + # Redirects ::IO.binread to ::FakeFS::File.binread + def self.binread(*args) + ::FakeFS::File.binread(*args) end # Redirects ::IO.read to ::FakeFS::File.read - def self.read(*args, **keywords) - ::FakeFS::File.read(*args, **keywords) + def self.read(*args) + ::FakeFS::File.read(*args) end # Redirects ::IO.write to ::FakeFS::File.write - def self.write(*args, **keywords) - ::FakeFS::File.write(*args, **keywords) + def self.write(*args) + ::FakeFS::File.write(*args) end end end
Simplify params forwarding for IO mocks There is no keyword parameters on read, binread & write methods. Let's just pass the *args, especially since the double splat operator changed a bit between ruby 2.6 and 2.7.
diff --git a/db/migrate/20170703102400_add_stage_id_foreign_key_to_builds.rb b/db/migrate/20170703102400_add_stage_id_foreign_key_to_builds.rb index abc1234..def5678 100644 --- a/db/migrate/20170703102400_add_stage_id_foreign_key_to_builds.rb +++ b/db/migrate/20170703102400_add_stage_id_foreign_key_to_builds.rb @@ -8,14 +8,28 @@ def up unless index_exists?(:ci_builds, :stage_id) add_concurrent_index(:ci_builds, :stage_id) + end + + unless foreign_key_exists?(:ci_builds, :stage_id) add_concurrent_foreign_key(:ci_builds, :ci_stages, column: :stage_id, on_delete: :cascade) end end def down + if foreign_key_exists?(:ci_builds, :stage_id) + remove_foreign_key(:ci_builds, column: :stage_id) + end + if index_exists?(:ci_builds, :stage_id) - remove_foreign_key(:ci_builds, column: :stage_id) remove_concurrent_index(:ci_builds, :stage_id) end end + + private + + def foreign_key_exists?(table, column) + foreign_keys(:ci_builds).any? do |key| + key.options[:column] == column.to_s + end + end end
Check foreign keys in migration in separate conditional
diff --git a/features/step_definitions/gt_scp_steps.rb b/features/step_definitions/gt_scp_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/gt_scp_steps.rb +++ b/features/step_definitions/gt_scp_steps.rb @@ -25,13 +25,17 @@ @output ||= Output.new end -Given /^I have an available server "([^"]*)"$/ do |remote_host| +Given /^I have ssh keyless auth setup on "([^"]*)"$/ do |remote_host| @remote = [] @remote << remote_host end -When /^"([^"]*)" as the file name$/ do |remote_path| +Given /^specify "([^"]*)" as the file name$/ do |remote_path| @remote << remote_path +end + +Given /^I specify "([^"]*)" as the username before the url$/ do |arg1| + @remote[0] = 'clint' + '@' + @remote[0] end When /^I run "([^"]*)"$/ do |arg1|
Update step definitions to support new 'user@sever' feature Refs #2
diff --git a/SIGS/app/controllers/administrative_assistants_controller.rb b/SIGS/app/controllers/administrative_assistants_controller.rb index abc1234..def5678 100644 --- a/SIGS/app/controllers/administrative_assistants_controller.rb +++ b/SIGS/app/controllers/administrative_assistants_controller.rb @@ -24,6 +24,13 @@ redirect_to registration_request_path end + def destroy_users + @user = User.find(params[:id]) + if @user.destroy + redirect_to user_index_path, :flash => {:sucess => 'Usuário excluído com sucesso'} + end + end + private def users_update_params params.require(:user).permit(:name, :email, :cpf, :registration)
Add method destroy_users in Administrative Assistant controller
diff --git a/actionpack/lib/action_controller/dispatch/dispatcher.rb b/actionpack/lib/action_controller/dispatch/dispatcher.rb index abc1234..def5678 100644 --- a/actionpack/lib/action_controller/dispatch/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatch/dispatcher.rb @@ -50,7 +50,7 @@ def new # DEPRECATE Rails application fallback - Rails.application + Rails.application.new end end end
Fix Dispatch.new so passenger works
diff --git a/spec/views/home/_crops.html.haml_spec.rb b/spec/views/home/_crops.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/home/_crops.html.haml_spec.rb +++ b/spec/views/home/_crops.html.haml_spec.rb @@ -1,27 +1,18 @@ require 'rails_helper' describe 'home/_crops.html.haml', type: "view" do - before(:each) do - # we need to set up an "interesting" crop - @crop = FactoryBot.create(:crop) - (1..3).each do - @planting = FactoryBot.create(:planting, crop: @crop) - end - @photo = FactoryBot.create(:photo) - (1..3).each do - @crop.plantings.first.photos << @photo - end - render - end - + let!(:crop) { FactoryBot.create(:crop, plantings: FactoryBot.create_list(:planting, 3)) } + let!(:photo) { FactoryBot.create(:photo, plantings: [crop.plantings.first]) } + let(:planting) { crop.plantings.first } + before(:each) { render } it 'shows crops section' do assert_select 'h2', text: 'Some of our crops' - assert_select "a[href='#{crop_path(@crop)}']" + assert_select "a[href='#{crop_path(crop)}']" end it 'shows plantings section' do assert_select 'h2', text: 'Recently planted' - rendered.should have_content @planting.location + rendered.should have_content planting.location end it 'shows recently added crops' do
Tidy up home/crops partial view
diff --git a/lib/data_mapper/relation_registry/relation_connector/builder.rb b/lib/data_mapper/relation_registry/relation_connector/builder.rb index abc1234..def5678 100644 --- a/lib/data_mapper/relation_registry/relation_connector/builder.rb +++ b/lib/data_mapper/relation_registry/relation_connector/builder.rb @@ -39,11 +39,14 @@ relations.add_node(left_node) unless relations[left_node.name] relations.add_node(right_node) unless relations[right_node.name] - connector = relations.build_edge( - relationship, left_node, right_node, relationship.operation - ) + connector = relations.edges.detect { |e| e.name == relationship.name } - relations.add_edge(connector) + unless connector + connector = relations.build_edge( + relationship, left_node, right_node, relationship.operation + ) + relations.add_edge(connector) + end connector end
Use existing edges instead of creating duplicates
diff --git a/app/models/coronavirus_timeline_nations_content_item.rb b/app/models/coronavirus_timeline_nations_content_item.rb index abc1234..def5678 100644 --- a/app/models/coronavirus_timeline_nations_content_item.rb +++ b/app/models/coronavirus_timeline_nations_content_item.rb @@ -0,0 +1,10 @@+class CoronavirusTimelineNationsContentItem < ContentItem + def self.load + json = File.read( + Rails.root.join("config/data/temporary_test_coronavirus_landing_page_with_timeline_nations.json"), + ) + response = JSON.parse(json) + + new(response.to_hash) + end +end
Add a new class that extends ContentItem This class loads the content item from a json file rather than content-store. Uses inheritance so that we can add a new load method, but keep all of the other properties of the ContentItem model, and so that the code is easy to remove. The landing page controller will decide which content item class to call.
diff --git a/app/controllers/admin/repository_organisations_controller.rb b/app/controllers/admin/repository_organisations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/repository_organisations_controller.rb +++ b/app/controllers/admin/repository_organisations_controller.rb @@ -1,6 +1,6 @@ class Admin::RepositoryOrganisationsController < Admin::ApplicationController def show - @org = RepositoryOrganisation.find_by_login(params[:login]) + @org = RepositoryOrganisation.host(current_host).find_by_login(params[:login]) @top_repos = @org.repositories.open_source.source.order('status ASC NULLS FIRST, rank DESC NULLS LAST').limit(10) @total_commits = @org.repositories.map{|r| r.contributions.sum(:count) }.sum end
Load admin orgs from correct host
diff --git a/Ruby-programming/Basic-ruby/substrings.rb b/Ruby-programming/Basic-ruby/substrings.rb index abc1234..def5678 100644 --- a/Ruby-programming/Basic-ruby/substrings.rb +++ b/Ruby-programming/Basic-ruby/substrings.rb @@ -4,7 +4,8 @@ dictionary.each do |substr| hystogram[substr] = str.scan(substr.downcase).length if str.include? substr.downcase end - puts hystogram + hystogram = Hash[hystogram.sort_by { |k,v| v }.reverse] + puts hystogram.inspect hystogram end
Order substring hash by occurences
diff --git a/app/views/revision_analytics/dyk_eligible.json.jbuilder b/app/views/revision_analytics/dyk_eligible.json.jbuilder index abc1234..def5678 100644 --- a/app/views/revision_analytics/dyk_eligible.json.jbuilder +++ b/app/views/revision_analytics/dyk_eligible.json.jbuilder @@ -2,7 +2,7 @@ json.array! @articles do |article| revision = article.revisions.order(wp10: :desc).first json.key article.id - json.title article.title.gsub('_', ' ') + json.title full_title(article) json.revision_score revision.wp10 json.user_wiki_id User.find(revision.user_id).wiki_id json.revision_datetime revision.date
Use full_title for page titles in DYK list
diff --git a/db/migrate/20111007102708_change_leg_checkins_to_integers.rb b/db/migrate/20111007102708_change_leg_checkins_to_integers.rb index abc1234..def5678 100644 --- a/db/migrate/20111007102708_change_leg_checkins_to_integers.rb +++ b/db/migrate/20111007102708_change_leg_checkins_to_integers.rb @@ -1,14 +1,16 @@ class ChangeLegCheckinsToIntegers < ActiveRecord::Migration def self.up remove_column :legs, :start_checkin + remove_column :legs, :end_checkin add_column :legs, :start_checkin, :int - + add_column :legs, :end_checkin, :int end def self.down remove_column :legs, :start_checkin + remove_column :legs, :end_checkin add_column :legs, :start_checkin, :string - + add_column :legs, :end_checkin, :string end end
Make sure foreign keys are ints, not strings
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,6 @@ class ApplicationController < ActionController::API include ActionController::StrongParameters + include ActionController::MimeResponds def authenticate_user_from_token! user_email = params[:user_email].presence
Add MimeResponds module for Devise
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,12 @@ # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + before_action :configure_permitted_parameters, if: :devise_controller? + + protected + + def configure_permitted_parameters + devise_parameter_sanitizer.for(:sign_up) << :real_name + end end
Allow real_name to be set on sign up
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,7 +4,7 @@ before_filter :fuck_off_lisa def fuck_off_lisa if user_signed_in? and current_user.id == 951 - response.headers["X-Accel-Limit-Rate"] = "300" + response.headers["X-Accel-Limit-Rate"] = "150" end end
Make the site even slower for Lisa.
diff --git a/app/controllers/councillors_controller.rb b/app/controllers/councillors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/councillors_controller.rb +++ b/app/controllers/councillors_controller.rb @@ -7,6 +7,13 @@ @councillor = Councillor.find params[:id] @votes = @councillor.councillor_votes.includes(:motion) @rvr_votes = @councillor.raw_vote_records - @absences = @councillor.councillor_votes.where(vote: "Skip").count + @absences = calculated_absence_percent(@councillor) + end + + private + def calulatated_absence_percent(councillor) + total_number_motion = Motion.count + + (councillor.councillor_votes.where(vote: "Skip").count.to_f / total_number_motion) * 100 end end
Add Method To Calculated Absences In Percentage
diff --git a/lib/checkout/pricing_strategy.rb b/lib/checkout/pricing_strategy.rb index abc1234..def5678 100644 --- a/lib/checkout/pricing_strategy.rb +++ b/lib/checkout/pricing_strategy.rb @@ -1,4 +1,30 @@ module Checkout + + class PricingRuleResolver + ProductOffer = Struct.new(:price, :quantity) + + def self.for(product_id, pricing_rules) + pricing_rule = pricing_rules.fetch(product_id) do + raise NoRulesForProductError.new(product_id) + end + new(pricing_rule) + end + + def initialize(pricing_rule) + @pricing_rule = pricing_rule + end + + def prices + pricing_rule.map do |p| + ProductOffer.new(p.fetch(:price), p.fetch(:quantity)) + end + end + + private + attr_reader :pricing_rule + + end + class PricingStrategy def initialize(rules = RULES) @@ -6,15 +32,12 @@ end def calculate_price(product_id, quantity) - product_rules = rules.fetch(product_id) do - raise NoRulesForProductError.new(product_id) - end - - best_offer = best_offer_from(product_rules, quantity) + product_rule = PricingRuleResolver.for(product_id, rules) + best_offer = best_offer_from(product_rule, quantity) if best_offer - remaining_quantity = quantity - best_offer[:quantity] - best_offer.fetch(:price) + calculate_price(product_id, remaining_quantity) + remaining_quantity = quantity - best_offer.quantity + best_offer.price + calculate_price(product_id, remaining_quantity) else 0 end @@ -23,11 +46,11 @@ private attr_reader :rules - def best_offer_from(product_rules, quantity) - Array(product_rules).select do |o| - o[:quantity] <= quantity + def best_offer_from(product_rule, basket_quantity) + product_rule.prices.select do |o| + o.quantity <= basket_quantity end.max do |a, b| - a[:quantity] <=> b[:quantity] + a.quantity <=> b.quantity end end
Add object that is responsible for extracting the pricing rule for a product
diff --git a/lib/private_address_check/tcpsocket_ext.rb b/lib/private_address_check/tcpsocket_ext.rb index abc1234..def5678 100644 --- a/lib/private_address_check/tcpsocket_ext.rb +++ b/lib/private_address_check/tcpsocket_ext.rb @@ -12,15 +12,11 @@ module TCPSocketExt def initialize(remote_host, remote_port, local_host = nil, local_port = nil) - if Thread.current[:private_address_check] - if PrivateAddressCheck.resolves_to_private_address?(remote_host) - raise PrivateAddressCheck::PrivateConnectionAttemptedError - end + if Thread.current[:private_address_check] && PrivateAddressCheck.resolves_to_private_address?(remote_host) + raise PrivateAddressCheck::PrivateConnectionAttemptedError + end - super(remote_host, remote_port, local_host, local_port) - else - super - end + super end end end
Simplify TCP socket extension initializer
diff --git a/lib/atlas/runner/zero_disabled_sectors.rb b/lib/atlas/runner/zero_disabled_sectors.rb index abc1234..def5678 100644 --- a/lib/atlas/runner/zero_disabled_sectors.rb +++ b/lib/atlas/runner/zero_disabled_sectors.rb @@ -19,15 +19,34 @@ end.map(&:last) lambda do |refinery| - refinery.nodes.each do |node| - if disabled_ns.any? { |namespace| node.get(:model).ns?(namespace) } - node.set(:demand, 0) - end + disabled_nodes = refinery.nodes.select do |node| + disabled_ns.any? { |namespace| node.get(:model).ns?(namespace) } end + + disabled_nodes.each(&method(:zero!)) refinery end end + + # Internal: Given a node, zeros out its demand, and sets the associated + # edges and slots to be zero. + # + # Returns nothing. + def self.zero!(node) + (node.out_edges.to_a + node.in_edges.to_a).each do |edge| + edge.set(:child_share, 0) + edge.set(:parent_share, 0) + edge.set(:demand, 0) + end + + (node.slots.out.to_a + node.slots.in.to_a).each do |slot| + slot.set(:share, 0) + end + + node.set(:demand, 0) + end end # ZeroDisabledSectors end # Runner + end # Atlas
Disable edges and slots belonging to disabled nodes
diff --git a/lib/generators/classy_enum/templates/enum.rb b/lib/generators/classy_enum/templates/enum.rb index abc1234..def5678 100644 --- a/lib/generators/classy_enum/templates/enum.rb +++ b/lib/generators/classy_enum/templates/enum.rb @@ -1,6 +1,6 @@ class <%= class_name %> < ClassyEnum::Base end <% values.each do |arg| %> -class <%= class_name + arg.camelize %> < <%= class_name %> +class <%= "#{class_name}::#{arg.camelize}" %> < <%= class_name %> end -<% end %> +<%- end -%>
Update generator to produce classes with new namespacing
diff --git a/lib/crystal_gaze/email_spirit.rb b/lib/crystal_gaze/email_spirit.rb index abc1234..def5678 100644 --- a/lib/crystal_gaze/email_spirit.rb +++ b/lib/crystal_gaze/email_spirit.rb @@ -10,7 +10,7 @@ end def manifest - manifest_as(name, domain = domain) + manifest_as(name, domain) end def manifest_as(name, domain = domain)
Fix anomaly in the spirit world
diff --git a/lib/dm-sqlite-adapter/adapter.rb b/lib/dm-sqlite-adapter/adapter.rb index abc1234..def5678 100644 --- a/lib/dm-sqlite-adapter/adapter.rb +++ b/lib/dm-sqlite-adapter/adapter.rb @@ -25,12 +25,13 @@ path = nil [:path, 'path', :database, 'database'].each do |key| db = options.delete(key) - unless db.nil? or db.empty? - path ||= db + unless db.nil? + normalized_db = db.to_s # no Symbol#empty? on 1.8.7(ish) rubies + path ||= normalized_db unless normalized_db.empty? end end - options.update(:adapter => 'sqlite3', :path => path.to_s) + options.update(:adapter => 'sqlite3', :path => path) end end
Fix spec failures on 1.8.7(ish) rubies There is no Symbol#empty? method in 1.8.7 and thus current jruby and rbx.
diff --git a/lib/command-t/scanner/find.rb b/lib/command-t/scanner/find.rb index abc1234..def5678 100644 --- a/lib/command-t/scanner/find.rb +++ b/lib/command-t/scanner/find.rb @@ -2,8 +2,10 @@ module Scanner # Simplistic scanner that wraps 'find . -type f'. class Find - def initialize path = Dir.pwd + def initialize path = Dir.pwd, options = {} @path = path + @max_depth = 15 + @max_depth = options[:max_depth].to_i unless options[:max_depth].nil? end def flush @@ -15,7 +17,7 @@ begin pwd = Dir.pwd Dir.chdir @path - @paths = `find . -type f 2> /dev/null`.split("\n") + @paths = `find . -type f -maxdepth #{@max_depth} 2> /dev/null`.split("\n") ensure Dir.chdir pwd end
Add max_depth option to Find class This matches some but not all functionality in the Ruby scanner. Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>
diff --git a/lib/fog/openstack/compute/models/image.rb b/lib/fog/openstack/compute/models/image.rb index abc1234..def5678 100644 --- a/lib/fog/openstack/compute/models/image.rb +++ b/lib/fog/openstack/compute/models/image.rb @@ -28,7 +28,7 @@ def metadata=(new_metadata = {}) metas = [] - new_metadata.to_hash.each_pair { |k, v| metas << {"key" => k, "value" => v} } + new_metadata.each_pair { |k, v| metas << {"key" => k, "value" => v} } metadata.load(metas) end
Revert "Fix hash bug in Image model" This reverts commit aa7c56d0734f79f99d1d5f35500255e7fa943e17.
diff --git a/lib/cucumber/rspec/doubles.rb b/lib/cucumber/rspec/doubles.rb index abc1234..def5678 100644 --- a/lib/cucumber/rspec/doubles.rb +++ b/lib/cucumber/rspec/doubles.rb @@ -4,16 +4,16 @@ Before do if RSpec::Mocks::Version::STRING.split('.').first.to_i > 2 - RSpec::Mocks::setup + RSpec::Mocks.setup else - RSpec::Mocks::setup(self) + RSpec::Mocks.setup(self) end end After do begin - RSpec::Mocks::verify + RSpec::Mocks.verify ensure - RSpec::Mocks::teardown + RSpec::Mocks.teardown end end
Change :: to . for method calls. I did this because it is clearer in terms of identifying them as method calls and not classes.
diff --git a/postmark-rails.gemspec b/postmark-rails.gemspec index abc1234..def5678 100644 --- a/postmark-rails.gemspec +++ b/postmark-rails.gemspec @@ -23,7 +23,7 @@ ] s.rdoc_options = ["--charset=UTF-8"] - s.add_dependency('actionmailer') + s.add_dependency('actionmailer', ">= 3.0.0") s.add_dependency('postmark', "~> 1.0") s.add_development_dependency('rake')
Add actionmailer version number to gemspec
diff --git a/spec/features/employee_search_spec.rb b/spec/features/employee_search_spec.rb index abc1234..def5678 100644 --- a/spec/features/employee_search_spec.rb +++ b/spec/features/employee_search_spec.rb @@ -0,0 +1,27 @@+# -*- coding: utf-8 -*- +require 'spec_helper' + +describe "EmployeeSearch" do + it "should require login" do + visit users_search_path + current_path.should eq login_path + end + + describe "for authenticated users" do + let(:user) { create :user } + before(:each) do + login user.username, "" # Stubbed auth + visit users_search_path + end + + it "should have a search form" do + page.should have_selector 'form #query-employee' + end + + it "should not have search results (since Elasticsearch is not indexed for test yet...)" do + fill_in 'query-employee', with: "#{user.first_name} #{user.last_name}" + click_button "Sök" + page.should_not have_selector "ul.results li.vcard" + end + end +end
Test case for employee search
diff --git a/spec/lib/task_helpers/imports_spec.rb b/spec/lib/task_helpers/imports_spec.rb index abc1234..def5678 100644 --- a/spec/lib/task_helpers/imports_spec.rb +++ b/spec/lib/task_helpers/imports_spec.rb @@ -0,0 +1,39 @@+describe TaskHelpers::Exports do + describe '.validate_source' do + before(:each) do + @import_dir = Dir.mktmpdir('miq_imp_dir') + @import_dir2 = Dir.mktmpdir('miq_imp_dir') + FileUtils.remove_entry @import_dir2 + @import_file = Tempfile.new('miq_imp_file') + end + + after(:each) do + FileUtils.remove_entry @import_dir + @import_file.close! + end + + it 'is a directory and readable' do + expect(TaskHelpers::Imports.validate_source(@import_dir)).to be_nil + end + + it 'is a file and readable' do + expect(TaskHelpers::Imports.validate_source(@import_file)).to be_nil + end + + it 'does not exist' do + expect(TaskHelpers::Imports.validate_source(@import_dir2)).to eq('Import source must be a filename or directory') + end + + it 'is a directory not readable' do + File.chmod(0300, @import_dir) + expect(TaskHelpers::Imports.validate_source(@import_dir)).to eq('Import source is not readable') + File.chmod(0700, @import_dir) + end + + it 'is a file not readable' do + File.chmod(0200, @import_file) + expect(TaskHelpers::Imports.validate_source(@import_file)).to eq('Import source is not readable') + File.chmod(0600, @import_file) + end + end +end
Add tests for import source validation
diff --git a/spec/lib/timestamp_api/errors_spec.rb b/spec/lib/timestamp_api/errors_spec.rb index abc1234..def5678 100644 --- a/spec/lib/timestamp_api/errors_spec.rb +++ b/spec/lib/timestamp_api/errors_spec.rb @@ -0,0 +1,13 @@+require "spec_helper" + +describe TimestampAPI::MissingAPIKey do + it "defines a custom message" do + expect(TimestampAPI::MissingAPIKey.instance_methods(false)).to include :message + end +end + +describe TimestampAPI::InvalidServerResponse do + it "defines a custom message" do + expect(TimestampAPI::InvalidServerResponse.instance_methods(false)).to include :message + end +end
Add tests for error classes
diff --git a/archloot.gemspec b/archloot.gemspec index abc1234..def5678 100644 --- a/archloot.gemspec +++ b/archloot.gemspec @@ -3,17 +3,16 @@ require "archloot/version" Gem::Specification.new do |s| - s.name = 'archloot' + s.name = "archloot" s.version = Archloot::VERSION - s.date = '2014-12-08' + s.date = "2014-12-08" s.summary = "Simple loot tables creation" s.description = "Provides a simple way to define rules governing random item generation." s.authors = ["Przemysław Krowiński"] s.email = ["hello@krowinski.com"] s.files = ["lib/archloot.rb"] - s.homepage = - '' - s.license = 'MIT' + s.homepage = "https://github.com/archdragon/archloot" + s.license = "MIT" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {spec}/*`.split("\n")
Clean up the .gemspec file
diff --git a/argumentative.rb b/argumentative.rb index abc1234..def5678 100644 --- a/argumentative.rb +++ b/argumentative.rb @@ -58,8 +58,20 @@ end private + def contain_matchers?(types) + types.any? { |type| type.is_a?(ParameterMatchers::Base) } + end + + def fuzzy_match?(types) + true + end + def match?(types) - types.count == @args.count && @args.zip(types).all? { |arg, type| arg.is_a?(type) } + if contain_matchers?(types) + fuzzy_match?(types) + elsif types.count == @args.count + @args.zip(types).all? { |arg, type| arg.is_a?(type) } + end end end end
Make fuzzy matcher test pass with stub
diff --git a/lib/tasks/larp_library/elasticsearch.rake b/lib/tasks/larp_library/elasticsearch.rake index abc1234..def5678 100644 --- a/lib/tasks/larp_library/elasticsearch.rake +++ b/lib/tasks/larp_library/elasticsearch.rake @@ -6,7 +6,11 @@ [Project, Tag].each do |klass| puts "Importing #{klass.count} #{klass.name.pluralize}" - klass.__elasticsearch__.create_index! + klass.__elasticsearch__.client.indices.put_mapping( + type: klass.__elasticsearch__.document_type, + index: klass.__elasticsearch__.index_name, + body: klass.__elasticsearch__.mappings.to_hash + ) klass.import end end
Put mapping rather than create index
diff --git a/core/db/migrate/20120509055454_create_tokenized_permissions_table.rb b/core/db/migrate/20120509055454_create_tokenized_permissions_table.rb index abc1234..def5678 100644 --- a/core/db/migrate/20120509055454_create_tokenized_permissions_table.rb +++ b/core/db/migrate/20120509055454_create_tokenized_permissions_table.rb @@ -1,7 +1,7 @@ class CreateTokenizedPermissionsTable < ActiveRecord::Migration def change unless Spree::TokenizedPermission.table_exists? - create_table :tokenized_permissions do |t| + create_table :spree_tokenized_permissions do |t| t.integer :permissable_id t.string :permissable_type t.string :token @@ -9,7 +9,7 @@ t.timestamps end - add_index :tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' + add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' end end end
Correct prefix tokenized_permissions table with spree_
diff --git a/test/controllers/maps_controller_test.rb b/test/controllers/maps_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/maps_controller_test.rb +++ b/test/controllers/maps_controller_test.rb @@ -1,8 +1,16 @@ require 'test_helper' class MapsControllerTest < ActionDispatch::IntegrationTest + setup do + @map = create(:map) + @map_segment = create(:map_segment, map: @map) + end + test "loads index JSON" do get "/api/maps" assert_response :success + assert_includes response.body, @map.name + assert_includes response.body, @map.map_type + assert_includes response.body, @map_segment.name end end
Add checks to test about map data in response
diff --git a/lib/mathjax/rails/controllers.rb b/lib/mathjax/rails/controllers.rb index abc1234..def5678 100644 --- a/lib/mathjax/rails/controllers.rb +++ b/lib/mathjax/rails/controllers.rb @@ -10,6 +10,11 @@ options = Hash.new options[:type] = mime_type.to_s unless mime_type.nil? options[:disposition] = 'inline' - send_file File.expand_path(filepath,__FILE__), options + file = File.expand_path(filepath, __FILE__) + if File.exists?(file) + send_file file, options + else + render status: 404 + end end end
Check if static file exist before sending it
diff --git a/test/integration/feature_disable_test.rb b/test/integration/feature_disable_test.rb index abc1234..def5678 100644 --- a/test/integration/feature_disable_test.rb +++ b/test/integration/feature_disable_test.rb @@ -2,7 +2,7 @@ include Warden::Test::Helpers -class BrowsingUserTicketFlowsTest < ActionDispatch::IntegrationTest +class FeatureDisableTest < ActionDispatch::IntegrationTest def setup Warden.test_mode! set_default_settings
Rename the class to match file name
diff --git a/lib/html_mockup/mockupfile.rb b/lib/html_mockup/mockupfile.rb index abc1234..def5678 100644 --- a/lib/html_mockup/mockupfile.rb +++ b/lib/html_mockup/mockupfile.rb @@ -1,6 +1,24 @@ module HtmlMockup # Loader for mockupfile class Mockupfile + + # This is the context for the mockupfile evaluation. It should be empty except for the + # #mockup method. + class Context + + def initialize(mockupfile) + @_mockupfile = mockupfile + end + + def mockup + @_mockupfile + end + + def binding + ::Kernel.binding + end + + end # @attr :path [Pathname] The path of the Mockupfile for this project attr_accessor :path, :project @@ -14,7 +32,8 @@ def load if File.exist?(@path) && !self.loaded? @source = File.read(@path) - eval @source, get_binding + context = Context.new(self) + eval @source, context.binding @loaded = true end end @@ -40,12 +59,5 @@ alias :server :serve - protected - - def get_binding - mockup = self - binding - end - end end
Use a cleaner context for Mockupfile evaluation
diff --git a/lib/html_mockup/rack/sleep.rb b/lib/html_mockup/rack/sleep.rb index abc1234..def5678 100644 --- a/lib/html_mockup/rack/sleep.rb +++ b/lib/html_mockup/rack/sleep.rb @@ -0,0 +1,21 @@+module HtmlMockup + module Rack + # Listens to the "sleep" parameter and sleeps the amount of seconds specified by the parameter. There is however a maximum of 5 seconds. + class Sleep + + def initialize(app) + @app = app + end + + def call(env) + r = Rack::Request.new(env) + if r.params["sleep"] + sleeptime = [r.params["sleep"].to_i, 5].min + sleep sleeptime + end + @app.call(env) + end + + end + end +end
Add Rack::Sleep to simulate "slow" requests
diff --git a/lib/indexable_support_page.rb b/lib/indexable_support_page.rb index abc1234..def5678 100644 --- a/lib/indexable_support_page.rb +++ b/lib/indexable_support_page.rb @@ -5,7 +5,7 @@ def initialize(filename) @filename = filename - @io = File.read(filename) + @file_contents = File.read(filename) end def title @@ -55,6 +55,6 @@ private def html - @_html ||= Nokogiri::HTML.parse(@io) + @_html ||= Nokogiri::HTML.parse(@file_contents) end end
Change variable name to reflect reality
diff --git a/lib/trysail_blog_notification.rb b/lib/trysail_blog_notification.rb index abc1234..def5678 100644 --- a/lib/trysail_blog_notification.rb +++ b/lib/trysail_blog_notification.rb @@ -1,6 +1,10 @@ module TrySailBlogNotification end +require File.join(File.dirname(__FILE__), '/trysail_blog_notification/application.rb') +require File.join(File.dirname(__FILE__), '/trysail_blog_notification/util.rb') + Dir[File.join(File.dirname(__FILE__), '/**/*.rb')].sort.each do |file| + pp file require file end
Load application and util in base file
diff --git a/lib/yt/collections/references.rb b/lib/yt/collections/references.rb index abc1234..def5678 100644 --- a/lib/yt/collections/references.rb +++ b/lib/yt/collections/references.rb @@ -9,7 +9,7 @@ class References < Base def insert(attributes = {}) underscore_keys! attributes - body = {content_type: attributes[:content_type] } + body = attributes.slice(*body_params) params = {claim_id: attributes[:claim_id], on_behalf_of_content_owner: @auth.owner_name} do_insert(params: params, body: body) end @@ -37,6 +37,10 @@ def references_params apply_where_params! on_behalf_of_content_owner: @parent.owner_name end + + def body_params + [:content_type, :audioswap_enabled, :ignore_fps_match, :excluded_intervals] + end end end -end+end
Add optional reference insert params
diff --git a/api/ruby/building-a-ci-server/server.rb b/api/ruby/building-a-ci-server/server.rb index abc1234..def5678 100644 --- a/api/ruby/building-a-ci-server/server.rb +++ b/api/ruby/building-a-ci-server/server.rb @@ -26,9 +26,9 @@ helpers do def process_pull_request(pull_request) puts "Processing pull request..." - @client.create_status(pull_request['head']['repo']['full_name'], pull_request['head']['sha'], 'pending') + @client.create_status(pull_request['base']['repo']['full_name'], pull_request['head']['sha'], 'pending') sleep 2 # do busy work... - @client.create_status(pull_request['head']['repo']['full_name'], pull_request['head']['sha'], 'success') + @client.create_status(pull_request['base']['repo']['full_name'], pull_request['head']['sha'], 'success') puts "Pull request processed!" end end
Set this to use `base`, not `head`
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -5,6 +5,7 @@ def new if logged_in? @question = Question.new + @tag = Tag.new else redirect_to root_path end @@ -16,6 +17,9 @@ @question.asker_id = current_user.id if @question.save redirect_to question_path(@question) + if tag_params != nil + Tag.make_tags(tag_params[:name], question) + end else flash[:notice] = @question.errors.full_messages.join(", ") render :new @@ -31,4 +35,11 @@ @answer = Answer.new @vote = Vote.new end + + private + + def tag_params + params.require(:question).require(:tag).permit(:name) + end + end
Add initial logic to questions controller for implementing tags; need to create show template
diff --git a/app/controllers/wishlists_controller.rb b/app/controllers/wishlists_controller.rb index abc1234..def5678 100644 --- a/app/controllers/wishlists_controller.rb +++ b/app/controllers/wishlists_controller.rb @@ -1,5 +1,6 @@ class WishlistsController < ApplicationController before_action :set_wishlist, only: [:show, :edit, :update, :destroy] + respond_to :html, :json # GET /wishlists # GET /wishlists.json def index
Allow wishlist controller to respond in json
diff --git a/app/jobs/scheduled/leader_promotions.rb b/app/jobs/scheduled/leader_promotions.rb index abc1234..def5678 100644 --- a/app/jobs/scheduled/leader_promotions.rb +++ b/app/jobs/scheduled/leader_promotions.rb @@ -4,8 +4,6 @@ daily at: 4.hours def execute(args) - return unless Rails.env.test? # do nothing for now - # Demotions demoted_user_ids = [] User.real.where(trust_level: TrustLevel.levels[:leader]).find_each do |u|
Enable trust level 3 promotion/demotion job
diff --git a/plugins/ctf/fetcher.rb b/plugins/ctf/fetcher.rb index abc1234..def5678 100644 --- a/plugins/ctf/fetcher.rb +++ b/plugins/ctf/fetcher.rb @@ -15,7 +15,8 @@ end def update - start = Time.now.strftime('%s') + # TODO find a proper fix for fetching already running events + start = (Time.now - 60*60*24*31).strftime('%s') limit = 100 uri = URI("https://ctftime.org/api/v1/events/?limit=#{limit}&start=#{start}") response = Net::HTTP.get(uri) @@ -33,14 +34,14 @@ def upcoming_ctfs max_time = Time.now + @offset @ctfs.select do |ctf| - ctf['start'].to_time < max_time + ctf['start'].to_time > Time.now && ctf['start'].to_time < max_time end end def current_ctfs now = Time.now @ctfs.select do |ctf| - ctf['start'].to_time < now && ctf['finish'] > now + ctf['start'].to_time < now && ctf['finish'].to_time > now end end end
Fix reports of current events
diff --git a/TLRadioButton.podspec b/TLRadioButton.podspec index abc1234..def5678 100644 --- a/TLRadioButton.podspec +++ b/TLRadioButton.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.name = 'TLRadioButton' - s.version = '0.1.0' + s.version = '0.1.1' s.summary = 'Animated RadioButton for iOS.' s.description = <<-DESC @@ -18,8 +18,7 @@ * _Animation duratoin_ - button animation speed in ms. Default - 500 ms DESC - s.homepage = 'http://ftp27.ru/' - # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' + s.screenshots = 'https://github.com/ftp27/TLRadioButton/raw/master/TLRadioButton.gif' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Aleksey Cherepanov' => 'ftp27host@gmail.com' } s.source = { :git => 'https://github.com/ftp27/TLRadioButton.git', :tag => s.version.to_s }
Add screenshots to pod configure
diff --git a/app/controllers/question.rb b/app/controllers/question.rb index abc1234..def5678 100644 --- a/app/controllers/question.rb +++ b/app/controllers/question.rb @@ -1,5 +1,9 @@ get '/questions/index' do - json questions: @user.questions + if @user.access == 'student' + json questions: @user.questions + elsif @user.access == 'coach' + json questions: Question.all + end end post '/questions' do
Set Paths to Return All Questions to Coach View
diff --git a/spec/factories/policies.rb b/spec/factories/policies.rb index abc1234..def5678 100644 --- a/spec/factories/policies.rb +++ b/spec/factories/policies.rb @@ -37,7 +37,11 @@ AssetType.all.each do |type| create(:policy_asset_type_rule, policy: policy, asset_type: type) end - create(:policy_asset_subtype_rule, (:fuel_type if evaluator.has_fuel_type), policy: policy, asset_subtype_id: evaluator.subtype) + if evaluator.has_fuel_type + create(:policy_asset_subtype_rule, :fuel_type, policy: policy, asset_subtype_id: evaluator.subtype) + else + create(:policy_asset_subtype_rule, policy: policy, asset_subtype_id: evaluator.subtype) + end end end end
Change policy instantiation in tests to get travis passing.
diff --git a/spec/nc_first_fail_spec.rb b/spec/nc_first_fail_spec.rb index abc1234..def5678 100644 --- a/spec/nc_first_fail_spec.rb +++ b/spec/nc_first_fail_spec.rb @@ -10,12 +10,10 @@ let(:exception) { 'exception' } let(:description) { 'description' } - before do - example.should_receive(:metadata).any_number_of_times.and_return({:full_description => description}) - example.should_receive(:exception).any_number_of_times.and_return(exception) - end + it 'notifies the first failure only' do + example.stub(:metadata).and_return({:full_description => description}) + example.stub(:exception).and_return(exception) - it 'notifies the first failure only' do TerminalNotifier.should_receive(:notify).with("#{description}\n#{exception}", :title => "#{failure} #{current_dir}: Failure" )
Replace `any_number_of_times` usages with `stub`s
diff --git a/acceptance/provider/synced_folder_spec.rb b/acceptance/provider/synced_folder_spec.rb index abc1234..def5678 100644 --- a/acceptance/provider/synced_folder_spec.rb +++ b/acceptance/provider/synced_folder_spec.rb @@ -29,5 +29,12 @@ status("Test: doesn't mount a disabled folder") result = execute("vagrant", "ssh", "-c", "test -d /foo") expect(result.exit_code).to eql(1) + + status("Test: persists a sync folder after a manual reboot") + result = execute("vagrant", "ssh", "-c", "sudo reboot") + expect(result).to exit_with(255) + result = execute("vagrant", "ssh", "-c", "cat /vagrant/foo") + expect(result.exit_code).to eql(0) + expect(result.stdout).to match(/hello$/) end end
Test synced folder persists after guest reboot This test checks to see that a VirtualBox synced folder persists outside of a `vagrant reload`, such as when a machine is manually rebooted or restarted by the provider directly.
diff --git a/redis_timeline.gemspec b/redis_timeline.gemspec index abc1234..def5678 100644 --- a/redis_timeline.gemspec +++ b/redis_timeline.gemspec @@ -5,7 +5,7 @@ # Describe your gem and declare its dependencies: Gem::Specification.new do |s| - s.name = "redis-timeline" + s.name = "redis_timeline" s.version = Timeline::VERSION s.authors = ["Felix Clack"] s.email = ["felixclack@gmail.com"]
Use the original gem name
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,9 +5,9 @@ # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - require 'application_controller/authentication_dependency' - require 'application_controller/errors_dependency' - require 'application_controller/feature_flags_dependency' + require_dependency 'application_controller/authentication_dependency' + require_dependency 'application_controller/errors_dependency' + require_dependency 'application_controller/feature_flags_dependency' before_action :authenticate_user! # authentication_dependency
Use require_dependency instead of require
diff --git a/app/models/renalware/letters/recipient.rb b/app/models/renalware/letters/recipient.rb index abc1234..def5678 100644 --- a/app/models/renalware/letters/recipient.rb +++ b/app/models/renalware/letters/recipient.rb @@ -32,11 +32,10 @@ end def current_address - case - when patient? + if patient? letter.patient.current_address - when primary_care_physician? - letter.patient&.practice&.address + elsif primary_care_physician? + address_for_primary_care_physician else addressee.address end @@ -49,6 +48,14 @@ private + def address_for_primary_care_physician + address = letter.patient&.practice&.address + if address.present? && letter.primary_care_physician.present? + address.name = letter.primary_care_physician.salutation + end + address + end + def patient_or_primary_care_physician? patient? || primary_care_physician? end
Tidy up letter address fn
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -2,6 +2,14 @@ def create @user = User.new(params[:user]) + + client=Client.new() + client.user=@user + address=Address.new() + address.user= @user + client.address = address + @user.client = client + if @user.save NewUserMailer.new_user_email(@user).deliver
Create client in front registration?
diff --git a/app/models/validators/cma_case_validator.rb b/app/models/validators/cma_case_validator.rb index abc1234..def5678 100644 --- a/app/models/validators/cma_case_validator.rb +++ b/app/models/validators/cma_case_validator.rb @@ -9,7 +9,7 @@ validates :summary, presence: true validates :body, presence: true, safe_html: true - validates :opened_date, presence: true, date: true + validates :opened_date, allow_blank: true, date: true validates :market_sector, presence: true validates :case_type, presence: true validates :case_state, presence: true
Allow blank opened dates for CMA cases The CMA have some old cases that they don't know the dates for. Allow blank opened dates to let them edit and publish these documents, and make the checking of opened dates a content responsibility.
diff --git a/deployment/puppet/osnailyfacter/lib/facter/libvirt_package_version.rb b/deployment/puppet/osnailyfacter/lib/facter/libvirt_package_version.rb index abc1234..def5678 100644 --- a/deployment/puppet/osnailyfacter/lib/facter/libvirt_package_version.rb +++ b/deployment/puppet/osnailyfacter/lib/facter/libvirt_package_version.rb @@ -12,11 +12,17 @@ when /(?i)(debian)/ pkg_grep_cmd = "apt-cache policy" out = Facter::Util::Resolution.exec("#{pkg_grep_cmd} libvirt-bin") - version = out.split(/\n/).grep(/Candidate/i)[0].split(/\s+/)[2] if out + out.each_line do |line| + version = line.scan(%r{\s+Candidate:\s+(.*)}).join() if line =~ %r{Candidate:} + break unless version.nil? + end when /(?i)(redhat)/ pkg_grep_cmd = "yum info" - out = Facter::Util::Resolution.exec("#{pkg_grep_cmd} libvirt") - version = out.split(/\n/).grep(/Version/i)[0].split(/\s+/)[2] if out + out = Facter::Util::Resolution.exec("#{pkg_grep_cmd} libvirt 2>&1") + out.each_line do |line| + version = line.scan(%r{Version\s+:\s+(.*)\s+}).join() if line =~ %r{Version\s+:} + break unless version.nil? + end end version end
Handle libvirt version correctly when missing Since 7.0 did not include a centos version of the libvirt package, the libvirt_package_version fact caused puppet to spit errors. This change updates the logic under RedHat based operating systems to ensure that the output from the yum command is properly parsed. Change-Id: I87adb8e0262cf9be83ac6766bf974266378e1b30 Closes-Bug: 1485990 Co-Authored-By: Stanislav Makar <ee7f23babcc48cdccfe636defb0ccf5f2327eff2@mirantis.com>
diff --git a/backend/spec/support/shared_examples/rake.rb b/backend/spec/support/shared_examples/rake.rb index abc1234..def5678 100644 --- a/backend/spec/support/shared_examples/rake.rb +++ b/backend/spec/support/shared_examples/rake.rb @@ -1,7 +1,7 @@ require 'rake' shared_context 'rake' do - let(:rake) { Rake::Application.new } + let(:rake) { Rake::Application.new } let(:test_and_analyze_task) { Rake::Task.tasks.detect { |task| task.name == 'build:test_and_analyze' } } # it will use the text we pass to describe to calculate the task we are going to run. let(:task_name) { self.class.top_level_description }
Remove the Unnecessary spacing detected
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '2.2.4.4' + s.version = '2.2.5.0' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 2.2.4.4 to 2.2.5.0