diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/db/migrate/20140815125817_create_notifications.rb b/db/migrate/20140815125817_create_notifications.rb index abc1234..def5678 100644 --- a/db/migrate/20140815125817_create_notifications.rb +++ b/db/migrate/20140815125817_create_notifications.rb @@ -13,12 +13,12 @@ Reply.all.each do |reply| addresses = [] - addresses += reply.to.to_s.split(', ') - addresses += reply.cc.to_s.split(', ') - addresses += reply.bcc.to_s.split(', ') + addresses += reply.to.to_s.split(',') + addresses += reply.cc.to_s.split(',') + addresses += reply.bcc.to_s.split(',') addresses.each do |address| - u = User.where(email: address).first_or_initialize + u = User.where(email: address.trim).first_or_initialize if u.new_record? password_length = 12 @@ -26,8 +26,6 @@ u.password = password u.password_confirmation = password - - print "User created: #{u.email}\n" end if u.save
Fix migration of notified users
diff --git a/pakyow-realtime/lib/pakyow-realtime/hooks.rb b/pakyow-realtime/lib/pakyow-realtime/hooks.rb index abc1234..def5678 100644 --- a/pakyow-realtime/lib/pakyow-realtime/hooks.rb +++ b/pakyow-realtime/lib/pakyow-realtime/hooks.rb @@ -23,7 +23,7 @@ # mixin the socket connection id into the body tag # this id is used by pakyow.js to idenfity itself with the server # - if response.header['Content-Type'] == 'text/html' && Pakyow::Config.realtime.enabled + if response.header['Content-Type'].include?('text/html') && Pakyow::Config.realtime.enabled next if !response.body.is_a?(Array) body = response.body.first
Fix realtime content type check
diff --git a/app/controllers/concerns/social_helpers_handler.rb b/app/controllers/concerns/social_helpers_handler.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/social_helpers_handler.rb +++ b/app/controllers/concerns/social_helpers_handler.rb @@ -9,7 +9,7 @@ helper_method :fb_admins, :render_facebook_sdk, :render_facebook_like, :render_twitter, :display_uservoice_sso before_filter do - @fb_admins = [100000428222603, 547955110] + @fb_admins = [] end end
Remove facebook admins from SocialHelpersHandler Maybe we have better solution for this in the future. But, for sure, we don't want any person managing every page on Neighborly's project and forks.
diff --git a/app/controllers/contentr/application_controller.rb b/app/controllers/contentr/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/contentr/application_controller.rb +++ b/app/controllers/contentr/application_controller.rb @@ -1,7 +1,7 @@ # coding: utf-8 module Contentr - class ApplicationController < ActionController::Base + class ApplicationController < ::ApplicationController before_filter do I18n.locale = params[:locale] || I18n.default_locale
Revert "Extend ActionController::Base instead of the ::ApplicationController" This reverts commit 974d9bfabb9ae0d446d158a122ee70f336c6d222.
diff --git a/scripts/generate_toc.rb b/scripts/generate_toc.rb index abc1234..def5678 100644 --- a/scripts/generate_toc.rb +++ b/scripts/generate_toc.rb @@ -9,7 +9,7 @@ next if !line.start_with?("#") || forbidden_words.any? { |w| line =~ /#{w}/ } title = line.gsub("#", "").strip - href = title.gsub(" ", "-").downcase + href = title.gsub(" ", "-").gsub('"',"").downcase puts " " * (line.count("#")-1) + "* [#{title}](\##{href})" end end
Improve toc generator to remove " in the anchors [ci skip]
diff --git a/lib/active_merchant/billing/integrations/gp_webpay.rb b/lib/active_merchant/billing/integrations/gp_webpay.rb index abc1234..def5678 100644 --- a/lib/active_merchant/billing/integrations/gp_webpay.rb +++ b/lib/active_merchant/billing/integrations/gp_webpay.rb @@ -38,6 +38,14 @@ Return.new(query_string) end + def self.payment_service_url(order, account, options = {}) + params = [] + Helper.new(order, account, options).form_fields.each do |field, value| + params << "#{field}=#{CGI::escape(value)}" + end + return "#{self.service_url}?#{params.join("&")}" + end + end end end
Add GP Webpay direct link for payment.
diff --git a/lib/covalence/notifications/covalence_notification.rb b/lib/covalence/notifications/covalence_notification.rb index abc1234..def5678 100644 --- a/lib/covalence/notifications/covalence_notification.rb +++ b/lib/covalence/notifications/covalence_notification.rb @@ -17,7 +17,7 @@ type = args.delete(:type) flavor = self.to_s.underscore - unless AsyncObserver::Queue.queue.nil? + if defined? AsyncObserver && !AsyncObserver::Queue.queue.nil? self.async_send(:create, :producer => producer, :consumer => consumer, :message => args, :flavor => flavor) else self.create(:producer => producer, :consumer => consumer, :message => args, :flavor => flavor)
Check for async observer on compose
diff --git a/lib/generators/domp/templates/model_authentication.rb b/lib/generators/domp/templates/model_authentication.rb index abc1234..def5678 100644 --- a/lib/generators/domp/templates/model_authentication.rb +++ b/lib/generators/domp/templates/model_authentication.rb @@ -6,7 +6,7 @@ serialize :params <% if Rails::VERSION::MAJOR < 4 -%> - attr_accessible "#{class_name.downcase}_id", :authentication_provider_id, :uid, :token, :token_expires_at, :params + attr_accessible :<%= class_name.downcase %>_id, :authentication_provider_id, :uid, :token, :token_expires_at, :params <% end -%> def self.create_from_omniauth(params, <%= class_name.downcase %>, provider)
Fix model authentication for Rails < 4
diff --git a/lib/metacrunch/ubpb/transformations/mab2snr/status.rb b/lib/metacrunch/ubpb/transformations/mab2snr/status.rb index abc1234..def5678 100644 --- a/lib/metacrunch/ubpb/transformations/mab2snr/status.rb +++ b/lib/metacrunch/ubpb/transformations/mab2snr/status.rb @@ -30,7 +30,7 @@ status = DELETE_STATE if detmold_locations.present? && detmold_locations.all?{ |l| l == "50" } # Interimsaufnahmen unterdrücken - temp_records = source.datafields("537", ind1: "-", ind2: "1").subfields("a").values + temp_records = source.datafields("537", ind1: :blank, ind2: "1").subfields("a").values status = DELETE_STATE if temp_records.any?{ |v| v.downcase.include? "interimsaufnahme" } status
Check for all :blank cases.
diff --git a/lib/link_shrink/shrinkers/google.rb b/lib/link_shrink/shrinkers/google.rb index abc1234..def5678 100644 --- a/lib/link_shrink/shrinkers/google.rb +++ b/lib/link_shrink/shrinkers/google.rb @@ -5,14 +5,20 @@ # @author Jonah Ruiz <jonah@pixelhipsters.com> # Implements Google's URL Shortener API class Google < Base + # Returns URL base for API + # @return [String] api base url def base_url 'https://www.googleapis.com/urlshortener/v1/url' end + # Returns URL query parameters + # @return [String] query parameters to be used in request def api_query_parameter "?key=#{api_key}" end + # Returns body parameters used in request header + # @return [String] body parameters to be used in request header def body_parameters(new_url = nil) { 'longUrl' => url }.to_json end @@ -27,6 +33,8 @@ chart_url.concat(params) end + # Returns HTTP method to be used in request + # @return [Symbol] post http method def http_method :post end
Add documentation to Google class
diff --git a/lib/rspec/core/backtrace_cleaner.rb b/lib/rspec/core/backtrace_cleaner.rb index abc1234..def5678 100644 --- a/lib/rspec/core/backtrace_cleaner.rb +++ b/lib/rspec/core/backtrace_cleaner.rb @@ -11,7 +11,7 @@ end def include?(line) - matches_an_include_pattern? line or not matches_a_exclude_pattern? line + matches_an_include_pattern? line or not matches_an_exclude_pattern? line end private @@ -20,7 +20,7 @@ @include_patterns.any? {|p| line =~ p} end - def matches_a_exclude_pattern?(line) + def matches_an_exclude_pattern?(line) @exclude_patterns.any? {|p| line =~ p} end end
Use "an_exclude" instead of "a_exclude". Grammar is important. Signed-off-by: Sam Phippen <e5a09176608998a68778e11d5021c871e8fae93c@googlemail.com>
diff --git a/lib/xcode/builder/scheme_builder.rb b/lib/xcode/builder/scheme_builder.rb index abc1234..def5678 100644 --- a/lib/xcode/builder/scheme_builder.rb +++ b/lib/xcode/builder/scheme_builder.rb @@ -29,12 +29,11 @@ cmd end - # def prepare_test_command sdk=@sdk - # cmd = super sdk - # cmd << "-scheme \"#{@scheme.name}\"" - # cmd << "-configuration \"#{@scheme.test_config}\"" - # cmd - # end + def prepare_test_command sdk=@sdk + cmd = prepare_xcodebuild sdk + cmd << "test" + cmd + end def test unless @scheme.testable?
Use test build action for schemes
diff --git a/lib/google_spreadsheets/enhanced/collection.rb b/lib/google_spreadsheets/enhanced/collection.rb index abc1234..def5678 100644 --- a/lib/google_spreadsheets/enhanced/collection.rb +++ b/lib/google_spreadsheets/enhanced/collection.rb @@ -3,22 +3,30 @@ module GoogleSpreadsheets module Enhanced class Collection < ActiveResource::Collection - def find(*args) + def find(id) if block_given? to_a.find{|*block_args| yield(*block_args) } else - to_a.find{|element| element.id.to_s == args.first.to_s } + find_by!(id: id) end end def find_by(condition_hash) - condition_hash.inject(self.to_a) do |array, (attr, value)| - array.find{|element| element.send(attr) == value } + to_a.find do |element| + # TODO: compare with consideration of type cast + condition_hash.all?{|attr, value| element.send(attr) == value } end end def find_by!(condition_hash) - find_by(condition_hash) or raise ActiveResource::ResourceNotFound.new(OpenStruct.new(message: "Can't find #{condition_hash}")) + find_by(condition_hash) || + raise(ActiveResource::ResourceNotFound.new(OpenStruct.new(message: "Couldn't find #{self.class.name} with #{condition_hash}"))) + end + + def where(condition_hash) + condition_hash.inject(self.to_a) do |array, (attr, value)| + array.find_all{|element| element.send(attr) == value } + end end end end
Fix finder methods of Collection
diff --git a/lib/identity/importer/tasks/civicrm/members.rb b/lib/identity/importer/tasks/civicrm/members.rb index abc1234..def5678 100644 --- a/lib/identity/importer/tasks/civicrm/members.rb +++ b/lib/identity/importer/tasks/civicrm/members.rb @@ -8,7 +8,7 @@ def self.sql(sync_since=nil) if sync_since - where_when = "AND contact.created_date > " + Identity::Importer.connection.quote(sync_since) + where_when = "AND contact.created_date > \"#{sync_since.getlocal.strftime('%Y-%m-%d %H:%M:%S')}\"" else where_when = '' end
Fix no quote in connecion :<
diff --git a/sparkpost_rails.gemspec b/sparkpost_rails.gemspec index abc1234..def5678 100644 --- a/sparkpost_rails.gemspec +++ b/sparkpost_rails.gemspec @@ -6,11 +6,14 @@ s.description = "Delivery Method for sending emails via Sparkpost REST API in Rails" s.authors = ["Kevin Kimball"] s.email = 'kwkimball@gmail.com' + s.homepage = 'https://github.com/kevinkimball/sparkpost_rails' + s.license = 'MIT' + s.files = [ "lib/sparkpost_rails.rb", "lib/sparkpost_rails/delivery_method.rb", "lib/sparkpost_rails/railtie.rb" ] - s.homepage = 'https://github.com/kevinkimball/sparkpost-rails' - s.license = 'MIT' + + s.add_runtime_dependency = 'httparty', ['>= 0.13.3'] end
Add HTTParty dependency, fix homepage URL
diff --git a/lib/email_config_info.rb b/lib/email_config_info.rb index abc1234..def5678 100644 --- a/lib/email_config_info.rb +++ b/lib/email_config_info.rb @@ -15,7 +15,8 @@ def smtp_config return {} unless File.exist?(email_config_path) - YAML.load_file(email_config_path).fetch(Rails.env.to_s, {}).fetch('smtp', {}) + config = YAML.load_file(email_config_path)[Rails.env.to_s] || {} + config['smtp'] || {} end def email_config_path
Fix bug loading nil email config
diff --git a/lib/jukeberx/searcher.rb b/lib/jukeberx/searcher.rb index abc1234..def5678 100644 --- a/lib/jukeberx/searcher.rb +++ b/lib/jukeberx/searcher.rb @@ -16,11 +16,11 @@ end def match_albums(name) - @songs.select { |song| song.albums =~ /#{name}/i } + @songs.select { |song| song.album =~ /#{name}/i } end def match_titles(name) - @songs.select { |song| song.titles =~ /#{name}/i } + @songs.select { |song| song.title =~ /#{name}/i } end def list_artists
Fix a pluralization bug. Thanks Randy!
diff --git a/Casks/dbeaver-enterprise.rb b/Casks/dbeaver-enterprise.rb index abc1234..def5678 100644 --- a/Casks/dbeaver-enterprise.rb +++ b/Casks/dbeaver-enterprise.rb @@ -1,11 +1,11 @@ cask :v1 => 'dbeaver-enterprise' do - version '3.1.5' + version '3.2.0' if Hardware::CPU.is_32_bit? - sha256 '5e7ebc0b2f2a3ebb25eba0ff9032fa0bc2ca78354cc8bd2fe2b85262da73df54' + sha256 'c090a03f84589f94ebd90d6ea6981359325ace75a9e25aae569456642a2142dc' url "http://dbeaver.jkiss.org/files/dbeaver-#{version}-ee-macosx.cocoa.x86.zip" else - sha256 '0ddf0c6071f3f4c12a1332ecef9afddcbbcd1e8903f0994a71c9d3b061ab4397' + sha256 'ebf8fd5bb5eb1bc0e21cf5d2c93d956d3c171164f98767d1dda89c0ac8716093' url "http://dbeaver.jkiss.org/files/dbeaver-#{version}-ee-macosx.cocoa.x86_64.zip" end
Update DBeaver enterprise to v3.2.0
diff --git a/Casks/lastpass-universal.rb b/Casks/lastpass-universal.rb index abc1234..def5678 100644 --- a/Casks/lastpass-universal.rb +++ b/Casks/lastpass-universal.rb @@ -2,5 +2,6 @@ url 'https://lastpass.com/lpmacosx.dmg' homepage 'https://lastpass.com/' version 'latest' + sha1 'no_checksum' install 'lpmacosx.pkg' end
Set sha1 to 'no_checksum' for Lastpass Universal cask
diff --git a/lib/rake_compiler_dock/predefined_user_group.rb b/lib/rake_compiler_dock/predefined_user_group.rb index abc1234..def5678 100644 --- a/lib/rake_compiler_dock/predefined_user_group.rb +++ b/lib/rake_compiler_dock/predefined_user_group.rb @@ -1,5 +1,5 @@ # DO NOT EDIT - This file is generated per 'rake update_lists' module RakeCompilerDock - PredefinedUsers = ["root", "daemon", "bin", "sys", "sync", "games", "man", "lp", "mail", "news", "uucp", "proxy", "www-data", "backup", "list", "irc", "gnats", "nobody", "libuuid", "syslog", "rvm"] - PredefinedGroups = ["root", "daemon", "bin", "sys", "adm", "tty", "disk", "lp", "mail", "news", "uucp", "man", "proxy", "kmem", "dialout", "fax", "voice", "cdrom", "floppy", "tape", "sudo", "audio", "dip", "www-data", "backup", "operator", "list", "irc", "src", "gnats", "shadow", "utmp", "video", "sasl", "plugdev", "staff", "games", "users", "nogroup", "libuuid", "netdev", "crontab", "syslog", "ssh", "rvm"] + PredefinedUsers = ["root", "daemon", "bin", "sys", "sync", "games", "man", "lp", "mail", "news", "uucp", "proxy", "www-data", "backup", "list", "irc", "gnats", "nobody", "_apt", "rvm"] + PredefinedGroups = ["root", "daemon", "bin", "sys", "adm", "tty", "disk", "lp", "mail", "news", "uucp", "man", "proxy", "kmem", "dialout", "fax", "voice", "cdrom", "floppy", "tape", "sudo", "audio", "dip", "www-data", "backup", "operator", "list", "irc", "src", "gnats", "shadow", "utmp", "video", "sasl", "plugdev", "staff", "games", "users", "nogroup", "netdev", "ssh", "rvm"] end
Update user+group lists for new base image (ubuntu-16.10) per 'rake update_lists'
diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index abc1234..def5678 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,7 +1,10 @@ set :application, "lincomp" -set :repository, "http://code.zhdk.ch/svn-auth/lincomp/trunk" -set :scm, :subversion -# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` + +set :scm, :git +set :repository, "git://github.com/psy-q/stizun.git" +set :branch, "master" +set :deploy_via, :remote_cache + set :use_sudo, false set :deploy_to, "/home/lincomp/test"
Deploy recipe changed to git.
diff --git a/ruby/triangle/triangle.rb b/ruby/triangle/triangle.rb index abc1234..def5678 100644 --- a/ruby/triangle/triangle.rb +++ b/ruby/triangle/triangle.rb @@ -1,37 +1,39 @@ class Triangle - attr_reader :first_side, :second_side, :third_side, :sorted_lengths, :multiplied_lengths + attr_reader :sides def initialize(side_lengths) - @sorted_lengths = side_lengths.sort - @multiplied_lengths = sorted_lengths.map {|n| n * 10 } - @first_side = multiplied_lengths[0] - @second_side = multiplied_lengths[1] - @third_side = multiplied_lengths[2] + @sides = side_lengths.sort end def equilateral? return false if invalid_lengths? - true if sorted_lengths.uniq.size == 1 + + sides.uniq.size == 1 end def isosceles? return false if invalid_lengths? - true if sorted_lengths.uniq.size <= 2 + + sides.uniq.size <= 2 end def invalid_lengths? - return true if sorted_lengths.include?(0) - lengths = sorted_lengths.uniq + return true if sides.include?(0) + + lengths = sides.uniq if lengths.size >= 2 - true if lengths[0] * 2 < lengths[1] + lengths[0] * 2 < lengths[1] end end def scalene? - true if scalene_ratio + has_scalene_ratio? end - def scalene_ratio - first_side % 4 == 0 && second_side % 5 == 0 && third_side % 6 == 0 + private + + def has_scalene_ratio? + first_side, second_side, third_side = sides.sort + (first_side % 4).zero? && (second_side % 5).zero? && (third_side % 6).zero? end end
Remove if statements rename scalene_ratio and only initialize what is needed
diff --git a/lib/active_admin/resource_controller/streaming.rb b/lib/active_admin/resource_controller/streaming.rb index abc1234..def5678 100644 --- a/lib/active_admin/resource_controller/streaming.rb +++ b/lib/active_admin/resource_controller/streaming.rb @@ -31,6 +31,7 @@ options = default.merge active_admin_config.csv_builder.options columns = active_admin_config.csv_builder.render_columns(self) + headers['X-Accel-Buffering'] = 'no' headers['Cache-Control'] = 'no-cache' self.response_body = Enumerator.new do |csv|
Disable downstream response buffering of stream
diff --git a/lib/active_admin/view_helpers/auto_link_helper.rb b/lib/active_admin/view_helpers/auto_link_helper.rb index abc1234..def5678 100644 --- a/lib/active_admin/view_helpers/auto_link_helper.rb +++ b/lib/active_admin/view_helpers/auto_link_helper.rb @@ -15,7 +15,7 @@ content = link_content || display_name(resource) if (registration = active_admin_resource_for(resource.class)) begin - content = link_to(content, send(registration.route_instance_path, resource)) + content = link_to(content, registration.route_instance_path(resource)) rescue # ignored end
Fix auto_link helper after method signature change
diff --git a/lib/datapathy-ssbe-adapter/models/core/ui_link.rb b/lib/datapathy-ssbe-adapter/models/core/ui_link.rb index abc1234..def5678 100644 --- a/lib/datapathy-ssbe-adapter/models/core/ui_link.rb +++ b/lib/datapathy-ssbe-adapter/models/core/ui_link.rb @@ -13,7 +13,7 @@ def const_missing(name) if link = self.detect { |l| l.title == name.to_s } const_set(name, link) - elsif ! (links = self.select { |l| l.category == name.to_s }).empty? + elsif ! (links = self.select { |l| l.category == name.to_s.downcase }).empty? const_set(name, links.sort_by { |l| l.title }) else # No uilinks found with title "name" or in category "name"
Make uilink shortcut work for categories
diff --git a/actionview/lib/action_view/template/types.rb b/actionview/lib/action_view/template/types.rb index abc1234..def5678 100644 --- a/actionview/lib/action_view/template/types.rb +++ b/actionview/lib/action_view/template/types.rb @@ -4,7 +4,7 @@ module ActionView class Template #:nodoc: - class Types + module Types class Type SET = Struct.new(:symbols).new([ :html, :text, :js, :css, :xml, :json ]) @@ -37,21 +37,23 @@ end end - cattr_accessor :type_klass + class << self + attr_accessor :type_klass - def self.delegate_to(klass) - self.type_klass = klass + def delegate_to(klass) + self.type_klass = klass + end + + def [](type) + type_klass[type] + end + + def symbols + type_klass::SET.symbols + end end delegate_to Type - - def self.[](type) - type_klass[type] - end - - def self.symbols - type_klass::SET.symbols - end end end end
Convert Template::Types.type_klass to instance ivar
diff --git a/app/controllers/monologue/tags_controller.rb b/app/controllers/monologue/tags_controller.rb index abc1234..def5678 100644 --- a/app/controllers/monologue/tags_controller.rb +++ b/app/controllers/monologue/tags_controller.rb @@ -11,6 +11,6 @@ private def retrieve_tag - Monologue::Tag.where("lower(name) = ?", params[:tag].mb_chars.downcase.to_s).first + Monologue::Tag.where("lower(name) = ?", params[:tag].mb_chars.to_s.downcase).first end end
Add missed mb_chars.to_s to TagController (1.9.3 compatibility)
diff --git a/gossiperl_client.gemspec b/gossiperl_client.gemspec index abc1234..def5678 100644 --- a/gossiperl_client.gemspec +++ b/gossiperl_client.gemspec @@ -10,10 +10,9 @@ s.email = ["radek@gruchalski.com"] s.summary = "Gossiperl Ruby client" s.description = s.summary - s.extra_rdoc_files = [ "README.rdoc", "LICENSE" ] + s.extra_rdoc_files = [ "LICENSE" ] s.files = `git ls-files`.split("\n") - s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } - %w(rspec-core rspec-expectations rspec-mocks rspec_junit_formatter).each { |gem| s.add_development_dependency gem } + s.test_files = `git ls-files -- {tests}/*`.split("\n") + %w(shindo).each { |gem| s.add_development_dependency gem } s.require_paths = ["lib"] end
Add shindo dependencies, tidy up the gemspec file.
diff --git a/lib/raven/railtie.rb b/lib/raven/railtie.rb index abc1234..def5678 100644 --- a/lib/raven/railtie.rb +++ b/lib/raven/railtie.rb @@ -4,7 +4,7 @@ module Raven class Railtie < ::Rails::Railtie initializer "raven.use_rack_middleware" do |app| - app.config.middleware.use "Raven::Rack" unless defined?(::ActionDispatch::DebugExceptions) + app.config.middleware.insert 0, "Raven::Rack" end config.after_initialize do @@ -15,6 +15,9 @@ if defined?(::ActionDispatch::DebugExceptions) require 'raven/rails/middleware/debug_exceptions_catcher' ::ActionDispatch::DebugExceptions.send(:include, Raven::Rails::Middleware::DebugExceptionsCatcher) + elsif defined?(::ActionDispatch::ShowExceptions) + require 'raven/rails/middleware/debug_exceptions_catcher' + ::ActionDispatch::ShowExceptions.send(:include, Raven::Rails::Middleware::DebugExceptionsCatcher) end end end
Use Rack middleware in older versions of Rails 3 (3.1.3 for example)
diff --git a/deka_eiwakun.gemspec b/deka_eiwakun.gemspec index abc1234..def5678 100644 --- a/deka_eiwakun.gemspec +++ b/deka_eiwakun.gemspec @@ -18,7 +18,7 @@ spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_dependency 'rubocop', '~> 0.40.0' + spec.add_dependency 'rubocop', '~> 0.52.1' spec.add_development_dependency 'bundler', '~> 1.11' spec.add_development_dependency 'rake', '~> 10.0' end
Update rubocop version to 0.52.1
diff --git a/lib/alf/renderer/html.rb b/lib/alf/renderer/html.rb index abc1234..def5678 100644 --- a/lib/alf/renderer/html.rb +++ b/lib/alf/renderer/html.rb @@ -8,7 +8,7 @@ def each return to_enum unless block_given? - yield "<table class=\"table table-condensed table-bordered table-striped\">" + yield "<table>" header = nil each_tuple do |tuple| unless header
Remove bootstrap attributes generated by Html renderer. We don't want to mary bootstrap here...
diff --git a/spec/operations/iteration_operations_spec.rb b/spec/operations/iteration_operations_spec.rb index abc1234..def5678 100644 --- a/spec/operations/iteration_operations_spec.rb +++ b/spec/operations/iteration_operations_spec.rb @@ -15,7 +15,7 @@ describe '.call' do it 'returns done stories' do - expect(result[:stories]).to eq(stories) + expect(result[:stories]).to match_array(stories) end it 'return story accepted in the end of the day of the last day' do
Fix array matching to avoid flaky result
diff --git a/spec/request/admin/request_add_token_spec.rb b/spec/request/admin/request_add_token_spec.rb index abc1234..def5678 100644 --- a/spec/request/admin/request_add_token_spec.rb +++ b/spec/request/admin/request_add_token_spec.rb @@ -22,7 +22,7 @@ context 'when configured in janus' do let(:instance) { { 'instance' => RubyRabbitmqJanus::Models::JanusInstance.find('2').id.to_s } } - let(:parameter) { { 'token' => [*('a'..'z'), *('0'..'9')].sample[0, 24].join } } + let(:parameter) { { 'token' => [*('a'..'z'), *('0'..'9')].sample(24).join } } it { expect(@transaction.to_json).to match_json_schema('base::error') } end
Fix method sample for create token
diff --git a/lib/defly.rb b/lib/defly.rb index abc1234..def5678 100644 --- a/lib/defly.rb +++ b/lib/defly.rb @@ -1,7 +1,15 @@ require 'tracable' require 'whinable' +require 'inspectable' module Defly end -NoMethodError.send(:include, Defly::Whinable) +class Class + def debug! + self.send(:include, Defly::Inspectable) + self.send(:include, Defly::Tracable) + end +end + +NoMethodError.send(:include, Defly::Whinable)
Add debug! method to hook up
diff --git a/lib/ramom.rb b/lib/ramom.rb index abc1234..def5678 100644 --- a/lib/ramom.rb +++ b/lib/ramom.rb @@ -16,7 +16,7 @@ module Ramom # Represent an undefined argument - Undefined = Class.new.freeze + Undefined = Module.new.freeze # An empty hash useful for (default} parameters EMPTY_HASH = {}.freeze
Switch to Undefined = Module.new.freeze
diff --git a/support/support.gemspec b/support/support.gemspec index abc1234..def5678 100644 --- a/support/support.gemspec +++ b/support/support.gemspec @@ -21,7 +21,6 @@ s.add_dependency 'rack-test' s.add_dependency 'rake' s.add_dependency 'yard' - s.add_dependency 'redcarpet' s.add_dependency 'simplecov' s.add_dependency 'coveralls' end
Remove redcarpet dependency as it not being used
diff --git a/test/unit/services_and_information_finder_test.rb b/test/unit/services_and_information_finder_test.rb index abc1234..def5678 100644 --- a/test/unit/services_and_information_finder_test.rb +++ b/test/unit/services_and_information_finder_test.rb @@ -5,7 +5,7 @@ organisation = build_stubbed(:organisation) search_client = mock() expected_search_query = { - count: 0, + count: "0", filter_organisations: [organisation.slug], facet_specialist_sectors: "1000,examples:4,example_scope:global,order:value.title", }
Fix test to expect string "0"
diff --git a/lib/jekyll/converters/markdown/kramdown_parser.rb b/lib/jekyll/converters/markdown/kramdown_parser.rb index abc1234..def5678 100644 --- a/lib/jekyll/converters/markdown/kramdown_parser.rb +++ b/lib/jekyll/converters/markdown/kramdown_parser.rb @@ -14,7 +14,7 @@ def convert(content) # Check for use of coderay if @config['kramdown']['use_coderay'] - %w[wrap line_numbers line_numbers_start tab_width bold_every css].each do |opt| + %w[wrap line_numbers line_numbers_start tab_width bold_every css default_lang].each do |opt| key = "coderay_#{opt}" @config['kramdown'][key.to_sym] = @config['kramdown']['coderay'][key] unless @config['kramdown'].has_key? key end
Support missing kramdown coderay option
diff --git a/app/models/calculator.rb b/app/models/calculator.rb index abc1234..def5678 100644 --- a/app/models/calculator.rb +++ b/app/models/calculator.rb @@ -2,9 +2,13 @@ ALL = [{ title: "Child Benefit tax calculator", slug: "child-benefit-tax-calculator", + content_id: "0e1de8f1-9909-4e45-a6a3-bffe95470275", + + # Sending an empty array for `paths` and `prefixes` will make sure we don't + # register routes in Panopticon. + prefixes: [], paths: [], - content_id: "0e1de8f1-9909-4e45-a6a3-bffe95470275", - prefixes: ["/child-benefit-tax-calculator"], + need_id: "100266", state: "live", description: "Work out the Child Benefit you've received and your High Income Child Benefit tax charge.",
Make sure we don't register routes via panopticon Sending an empty array for `paths` and `prefixes` will make sure we don't register routes in Panopticon. We don't want to register routes anymore because we will be using the publishing-api for this.
diff --git a/app/models/github_api.rb b/app/models/github_api.rb index abc1234..def5678 100644 --- a/app/models/github_api.rb +++ b/app/models/github_api.rb @@ -7,6 +7,8 @@ class GithubAPI def initialize(token: nil, cache: true) @api = Octokit::Client.new access_token: token + @api.auto_paginate = true + @api.per_page = 100 configure_cache if cache end
Use large page sizes in API requests to use requests efficiently
diff --git a/app/models/lit/locale.rb b/app/models/lit/locale.rb index abc1234..def5678 100644 --- a/app/models/lit/locale.rb +++ b/app/models/lit/locale.rb @@ -41,9 +41,8 @@ private def reset_available_locales_cache - if I18n.backend.respond_to?(:reset_available_locales_cache) - I18n.backend.reset_available_locales_cache - end + return unless I18n.backend.respond_to?(:reset_available_locales_cache) + I18n.backend.reset_available_locales_cache end end end
Use guard statement in Lit::Locale
diff --git a/server/app/models/goal.rb b/server/app/models/goal.rb index abc1234..def5678 100644 --- a/server/app/models/goal.rb +++ b/server/app/models/goal.rb @@ -14,7 +14,7 @@ end def sources - Source.find_by_sql ["select sources.* from sources, notes, goals, notegoals + Source.find_by_sql ["select distinct sources.* from sources, notes, goals, notegoals where sources.id = notes.source_id and notegoals.note_id = notes.id and notegoals.goal_id = ?", id]
Add distinct to sources list.
diff --git a/app/helpers/administration/log_items_helper.rb b/app/helpers/administration/log_items_helper.rb index abc1234..def5678 100644 --- a/app/helpers/administration/log_items_helper.rb +++ b/app/helpers/administration/log_items_helper.rb @@ -1,7 +1,11 @@ module Administration::LogItemsHelper def log_item_path(log_item) - send(log_item.loggable_type.underscore + '_path', log_item.loggable_id) + if log_item.loggable_type == 'Picture' + picture_path(log_item.loggable) + else + send(log_item.loggable_type.underscore + '_path', log_item.loggable_id) + end end def log_item_change_value(log_item, attribute, value)
Fix bug in log when showing pictures.
diff --git a/spec/controllers/permissions_controller_spec.rb b/spec/controllers/permissions_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/permissions_controller_spec.rb +++ b/spec/controllers/permissions_controller_spec.rb @@ -65,7 +65,7 @@ context 'when remember_token is blank' do it 'denies acess to show' do user = create(:user) - user.update_attributes(remember_token: '') + user.update(remember_token: '') cookies[:remember_token] = '' get :show
Replace deprecated `update_attributes` with `update` method
diff --git a/spec/system/bus_stops/editing_bus_stops_spec.rb b/spec/system/bus_stops/editing_bus_stops_spec.rb index abc1234..def5678 100644 --- a/spec/system/bus_stops/editing_bus_stops_spec.rb +++ b/spec/system/bus_stops/editing_bus_stops_spec.rb @@ -22,4 +22,19 @@ expect(page.current_url).to end_with bus_stops_path end end + context 'with data changes' do + before :each do + within 'table.edit-form' do + select 'UMTS', from: 'Garage responsible' + click_button 'Save stop' + end + end + it 'updates the stop' do + expect(page).to have_selector 'p.notice', + text: 'Bus stop was updated.' + end + it 'redirects to the bus stops page' do + expect(page.current_url).to end_with bus_stops_path + end + end end
Test data changes within edit
diff --git a/app/views/api/v1/relics/clusters.json.jbuilder b/app/views/api/v1/relics/clusters.json.jbuilder index abc1234..def5678 100644 --- a/app/views/api/v1/relics/clusters.json.jbuilder +++ b/app/views/api/v1/relics/clusters.json.jbuilder @@ -1,4 +1,9 @@-leafs = leafs_of(@relics.polish_facets_tree) +json.meta do |json| + json.total_pages @relics.total_pages + json.current_page @relics.current_page + json.relics_count @relics.size + json.total_count @relics.total_count +end json.relics @relics.map{ |r| relic_to_widget_data(r, false) } -json.clusters leafs.map{ |f| facet_to_marker(f) } +json.clusters leafs_of(@relics.polish_facets_tree).map{ |f| facet_to_marker(f) }
Add meta data to relics/clusters API
diff --git a/X4ImageViewer.podspec b/X4ImageViewer.podspec index abc1234..def5678 100644 --- a/X4ImageViewer.podspec +++ b/X4ImageViewer.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "X4ImageViewer" - s.version = "1.0.2" + s.version = "1.0.3" s.summary = "A ios easy-to-use image viewer." s.description = <<-DESC * X4ImageViewer is a easy-to-use image viewer written in Object-C. It also provides some common tools when used with image.
Update pod spec to 1.0.3
diff --git a/TRVSEventSource.podspec b/TRVSEventSource.podspec index abc1234..def5678 100644 --- a/TRVSEventSource.podspec +++ b/TRVSEventSource.podspec @@ -5,7 +5,8 @@ s.homepage = "http://github.com/travisjeffery/TRVSEventSource" s.license = 'MIT' s.author = { "Travis Jeffery" => "tj@travisjeffery.com" } - s.platform = :ios, '7.0' + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' s.source = { :git => "http://github.com/travisjeffery/TRVSEventSource.git", :tag => "0.0.1" } s.source_files = 'TRVSEventSource', 'TRVSEventSource/**/*.{h,m}' s.requires_arc = true
Set iOS and mac deployment targets to 7 and 10.9, respectively
diff --git a/palletjack-tools.gemspec b/palletjack-tools.gemspec index abc1234..def5678 100644 --- a/palletjack-tools.gemspec +++ b/palletjack-tools.gemspec @@ -18,6 +18,8 @@ s.files = [ 'README.md', 'LICENSE' ] s.files += Dir['tools/*'] s.bindir = 'tools/' - s.executables = ['dump_pallet', 'palletjack2kea', 'palletjack2salt', 'palletjack2pxelinux'] + s.executables = ['dump_pallet', 'palletjack2kea', 'palletjack2salt', + 'palletjack2pxelinux', 'create_domain', 'create_system', + 'create_ipv4_interface'] s.has_rdoc = true end
Package warehouse creation tools in the tools gem
diff --git a/app/controllers/password_resets_controller.rb b/app/controllers/password_resets_controller.rb index abc1234..def5678 100644 --- a/app/controllers/password_resets_controller.rb +++ b/app/controllers/password_resets_controller.rb @@ -10,10 +10,10 @@ if @user @user.create_reset_digest @user.send_password_reset_email - flash[:info] = "Email sent with password reset instructions" + flash[:info] = 'Email sent with password reset instructions' redirect_to root_path else - flash.now[:danger] = "Email address not found" + flash.now[:danger] = 'Email address not found' render 'new' end end @@ -27,7 +27,7 @@ elsif @user.update_attributes(user_params) log_in @user @user.update_attribute(:reset_digest, nil) - flash[:success] = "Password has been reset." + flash[:success] = 'Password has been reset.' redirect_to @user else render 'edit' @@ -45,10 +45,8 @@ end def check_expiration - if @user.password_reset_expired? - flash[:danger] = "Password reset has expired." - redirect_to new_password_reset_url - end + return unless @user.password_reset_expired? + flash[:danger] = 'Password reset has expired.' + redirect_to new_password_reset_url end - end
Clean up password resets controller
diff --git a/app/lib/manual_section_indexable_formatter.rb b/app/lib/manual_section_indexable_formatter.rb index abc1234..def5678 100644 --- a/app/lib/manual_section_indexable_formatter.rb +++ b/app/lib/manual_section_indexable_formatter.rb @@ -19,6 +19,7 @@ link: link, indexable_content: section.body, organisations: [manual.organisation_slug], + manual: manual.slug, } end
Send manual slug to to rummager for manual sections So that search results can be scoped to sections within a manual.
diff --git a/app/serializers/progress_update_serializer.rb b/app/serializers/progress_update_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/progress_update_serializer.rb +++ b/app/serializers/progress_update_serializer.rb @@ -1,6 +1,24 @@ class ProgressUpdateSerializer < ActiveModel::Serializer - attributes :id, :content, :words, :hours - belongs_to :user, serializer: ProgressUpdateUserSerializer - belongs_to :project, serializer: ProgressUpdateProjectSerializer + include ActionView::Helpers::DateHelper + attributes :id, :content, :words, :hours, :prev_link, :next_link, :created_at_in_words + # belongs_to :user, serializer: ProgressUpdateUserSerializer + # belongs_to :project, serializer: ProgressUpdateProjectSerializer has_many :comments + + def created_at_in_words + time_ago_in_words(object.created_at) + " ago" + end + + def prev_link + if prev_object = object.prev + "/projects/#{prev_object[:project_id]}/updates/#{prev_object.id}" + end + end + + def next_link + if next_object = object.next + "/projects/#{next_object[:project_id]}/updates/#{next_object.id}" + end + end + end
Remove unused associations from serializer and add custom methods
diff --git a/tests/spec/features/highlighting_error_output_spec.rb b/tests/spec/features/highlighting_error_output_spec.rb index abc1234..def5678 100644 --- a/tests/spec/features/highlighting_error_output_spec.rb +++ b/tests/spec/features/highlighting_error_output_spec.rb @@ -24,7 +24,7 @@ scenario "github see-issues are links" do within('.output-stderr') do - expect(page).to have_link('see https://github.com/rust-lang/rust/issues/27812', href: 'https://github.com/rust-lang/rust/issues/27812') + expect(page).to have_link('see https://github.com/rust-lang/rust/issues/23416', href: 'https://github.com/rust-lang/rust/issues/23416') end end @@ -40,10 +40,10 @@ def code <<~EOF - extern crate syntax; - fn main() { drop::<u8, u8>(1); + + 42: u64; } EOF end
Bring error highlighting test up to date
diff --git a/lib/gemini/executions.rb b/lib/gemini/executions.rb index abc1234..def5678 100644 --- a/lib/gemini/executions.rb +++ b/lib/gemini/executions.rb @@ -2,7 +2,7 @@ module Executions def self.me(options = {}) Gemini.sanity_check! - executions = Gemini::Net.get("/v1/mytrades", options, true) + executions = Gemini::Net.post("/v1/mytrades", options) JSON.parse(executions).map do |execution| Gemini::Execution.new(execution) end
Use POST instead of GET
diff --git a/SSPPullToRefresh.podspec b/SSPPullToRefresh.podspec index abc1234..def5678 100644 --- a/SSPPullToRefresh.podspec +++ b/SSPPullToRefresh.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SSPPullToRefresh' - s.version = '0.1.1' + s.version = '0.1.2' s.summary = 'General classes for "Pull-To-Refresh" concept customisation' s.description = <<-DESC
Update pod spec to version 0.1.2
diff --git a/lib/build_log_parser.rb b/lib/build_log_parser.rb index abc1234..def5678 100644 --- a/lib/build_log_parser.rb +++ b/lib/build_log_parser.rb @@ -3,4 +3,15 @@ require "chronic_duration" module BuildLogParser + def tests(str) + self.new(str).tests + end + + def coverage(str) + self.new(str).coverage + end + + def duration(str) + self.new(str).duration + end end
Add shorthand methods for metrics
diff --git a/lib/lines/rack_logger.rb b/lib/lines/rack_logger.rb index abc1234..def5678 100644 --- a/lib/lines/rack_logger.rb +++ b/lib/lines/rack_logger.rb @@ -6,6 +6,7 @@ # In development mode the common logger is always inserted def self.silence_common_logger! Rack::CommonLogger.module_eval("def call(env); @app.call(env); end") + self end def initialize(app)
Return self when silencing the Rack::CommonLogger
diff --git a/lib/messenger/workers.rb b/lib/messenger/workers.rb index abc1234..def5678 100644 --- a/lib/messenger/workers.rb +++ b/lib/messenger/workers.rb @@ -1,7 +1,7 @@ class Messenger module Workers - def work + def work(message) raise NotImplementedError.new('Subclass must implement work') end
Fix work to take a message
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,6 @@ get '/questions/index' do - if @user.access == 'student' + return if @user.nil? + if @user.access == 'student' || @user.access == 'admin' #TODO => MAKE ADMIN PAGE json questions: @user.questions elsif @user.access == 'coach' json questions: Question.all
Check For Initial Ajax Call To Not Fail
diff --git a/Support/lib/spec/mate.rb b/Support/lib/spec/mate.rb index abc1234..def5678 100644 --- a/Support/lib/spec/mate.rb +++ b/Support/lib/spec/mate.rb @@ -21,6 +21,7 @@ require 'spec/autorun' rescue LoadError require 'rspec/core' + ENV['DISABLE_RSPEC_AUTORUN'] = "true" end def rspec2?
Disable rspec autorun for rspec 2
diff --git a/SwiftMeasurement.podspec b/SwiftMeasurement.podspec index abc1234..def5678 100644 --- a/SwiftMeasurement.podspec +++ b/SwiftMeasurement.podspec @@ -6,8 +6,6 @@ s.osx.deployment_target = '10.12' s.ios.deployment_target = '10.0' - s.tvos.deployment_target = '10.0' - s.watchos.deployment_target = '3.0' s.license = 'MIT' s.summary = 'The best way to deal with Measurements and Units in Swift'
Drop tvOS and watchOS config for now
diff --git a/Casks/iterm2-nightly.rb b/Casks/iterm2-nightly.rb index abc1234..def5678 100644 --- a/Casks/iterm2-nightly.rb +++ b/Casks/iterm2-nightly.rb @@ -1,10 +1,10 @@ cask 'iterm2-nightly' do - version '2.9.20160131' - sha256 'dd6692926e252edcccf00a7b96eb0fd3a56727e6a92207f472ad5d6903fe6c5d' + version '2.9.20160207' + sha256 '1b7d17a93f7b2b4c58ac7df6878496cfc34a34f08c4d3c1f5e301691873e74b4' url "https://iterm2.com/downloads/nightly/iTerm2-#{version.dots_to_underscores}-nightly.zip" appcast 'https://iterm2.com/appcasts/nightly.xml', - checkpoint: '8cf2341d40fcdbbd5ab46f351649a7f5a79d2eb287f06c19a78857ac9ef10050' + checkpoint: 'd4b1417f6b3fb7fed1fc7e086c1044f3d2589015e197154bd78656d515e002da' name 'iTerm2' homepage 'https://www.iterm2.com/' license :gpl
Upgrade iTerm2 nightly to 2.9.20160207
diff --git a/plugins/identity/config/initializers/constants.rb b/plugins/identity/config/initializers/constants.rb index abc1234..def5678 100644 --- a/plugins/identity/config/initializers/constants.rb +++ b/plugins/identity/config/initializers/constants.rb @@ -29,7 +29,6 @@ resource_viewer sharedfilesystem_admin sharedfilesystem_viewer - swiftoperator volume_admin volume_viewer securitygroup_viewer
Remove swiftoperator role from selectable roles
diff --git a/app/utils.rb b/app/utils.rb index abc1234..def5678 100644 --- a/app/utils.rb +++ b/app/utils.rb @@ -21,6 +21,18 @@ end + def self.command(name, num_args = Numeric) + pattern = /!#{name}\s*((?:[^,]+,?\s*)+)/ + lambda { |cmd| + match = cmd.match(pattern) + + return nil unless match + args = match[1].split(/,\s*/) + return :syntax_error unless num_args === args.size + args + } + end + def self.safe_read(file) File.read(file,
Add command parser (not used anywhere yet)
diff --git a/app/models/video_edition.rb b/app/models/video_edition.rb index abc1234..def5678 100644 --- a/app/models/video_edition.rb +++ b/app/models/video_edition.rb @@ -11,9 +11,10 @@ end def whole_body - return nil if video_summary.nil? and video_url.nil? - return "#{video_url}" if video_summary.nil? - return "#{video_summary}" if video_url.nil? - "#{video_url}\n\n#{video_summary}" + if video_summary and video_url + "#{video_url}\n\n#{video_summary}" + else + video_url || video_summary + end end end
Refactor the whole_body method to be simpler
diff --git a/lib/feed-utils/topix.rb b/lib/feed-utils/topix.rb index abc1234..def5678 100644 --- a/lib/feed-utils/topix.rb +++ b/lib/feed-utils/topix.rb @@ -0,0 +1,11 @@+require 'open-uri' + +class TopixGrabber < Object + + def query(keyphrase) + url = "http://www.topix.net/rss/search/article?x=0&y=0&q=" + keyphrase + + open( url ).read + end +end +
Make sure we add the files this time!
diff --git a/lib/gitnesse/tasks.rake b/lib/gitnesse/tasks.rake index abc1234..def5678 100644 --- a/lib/gitnesse/tasks.rake +++ b/lib/gitnesse/tasks.rake @@ -21,7 +21,7 @@ end desc "Push features to remote git wiki repository, run cucumber, and push results to wiki" - task :push => :environment do + task :push_results => :environment do Gitnesse::Configuration.load_using_search Gitnesse.push_results end
Fix multiple definition of gitnesse:push
diff --git a/lib/health_graph/api.rb b/lib/health_graph/api.rb index abc1234..def5678 100644 --- a/lib/health_graph/api.rb +++ b/lib/health_graph/api.rb @@ -44,7 +44,7 @@ Faraday.new(merged_options) do |builder| builder.use Faraday::Request::UrlEncoded - builder.use Faraday::Request::JSON if method == :post + builder.use FaradayMiddleware::EncodeJson if method == :post builder.use Faraday::Response::Mashify builder.use Faraday::Response::ParseJson builder.adapter(HealthGraph.adapter)
Fix removed Faraday JSON middleware. The JSON request middleware is no longer included with Faraday. This seems to have already been partially fixed, since FaradayMiddleware was already a dependency. The tests are now passing on Ruby 1.9.
diff --git a/lib/avatax/connection.rb b/lib/avatax/connection.rb index abc1234..def5678 100644 --- a/lib/avatax/connection.rb +++ b/lib/avatax/connection.rb @@ -18,16 +18,18 @@ :proxy => proxy, }.merge(connection_options) - c = Faraday::Connection.new(options) - if logger - c.response :logger do |logger| - logger.filter(/(Authorization\:\ \"Basic\ )(\w+)\=/, '\1[REMOVED]') + Faraday.new(options) do |faraday| + faraday.use Faraday::Response::ParseJson + faraday.basic_auth(username, password) + + if logger + faraday.response :logger do |logger| + logger.filter(/(Authorization\:\ \"Basic\ )(\w+)\=/, '\1[REMOVED]') + end end + + faraday.adapter Faraday.default_adapter end - c.use Faraday::Response::ParseJson - c.basic_auth(username, password) - - c end end end
Use Faraday 1.0 compatible configuration
diff --git a/lib/neural_nets/math.rb b/lib/neural_nets/math.rb index abc1234..def5678 100644 --- a/lib/neural_nets/math.rb +++ b/lib/neural_nets/math.rb @@ -9,7 +9,7 @@ ## # NMatrix version of the sigmoid function def self.sigmoid_vec(x) - one = NMatrix.ones([x.rows, x.cols]) + one = NMatrix.ones(x.shape) one/(one + (-x).exp) end @@ -23,7 +23,7 @@ ## # NMatrix version of the derivative of the sigmoid function def self.sigmoid_prime_vec(x) - one = NMatrix.ones([x.rows, x.cols]) + one = NMatrix.ones(x.shape) sigma = self.sigmoid_vec(x) sigma.dot(one - sigma) end
Use shape method to get matrix dimensions.
diff --git a/lib/chaindrive/api/v1.rb b/lib/chaindrive/api/v1.rb index abc1234..def5678 100644 --- a/lib/chaindrive/api/v1.rb +++ b/lib/chaindrive/api/v1.rb @@ -3,20 +3,34 @@ version 'v1' namespace :gears do + desc "Return all gears inside the registry." get do compare_etag(Time.now.day) Gear.all end - get ':id' do - compare_etag(Time.now.day) - Gear.where(:name => params[:id], :status => true).order(:created_at).limit(1) + params do + requires :id, type: String, desc: "Gear name." + end + + route_param :id do + desc "Return the Gear with specified `id`." + get do + compare_etag(Time.now.day) + Gear.where(:name => params[:id], :status => true).order(:created_at).limit(1) + end + end + + params do + requires :id, type: String, desc: "Gear name." + requires :version, type: String, desc: "Gear version." end get ':id/version/:version' do compare_etag(Time.now.day) Gear.where(:name => params[:id], :version => params[:version], :status => true) end + end end end
Refactor and actually require parameters strongly. This is a little more complex syntax wise but it strongly requires the parameters to be Strings (where proper).
diff --git a/lib/core_extend/array.rb b/lib/core_extend/array.rb index abc1234..def5678 100644 --- a/lib/core_extend/array.rb +++ b/lib/core_extend/array.rb @@ -32,6 +32,7 @@ end +# The opposite of Array.eat. If an array only contains one element, return the element. # This allows to call a method with an array without having to splat on caller side. # The method needs to splat their arguments on the parameter list. # @@ -51,7 +52,7 @@ # def self.spit args - args.length == 1 && args.first.kind_of?( Array ) and args = args.first + args.kind_of?(Array) && args.length == 1 and args = args.first args
Make Array.spit symmetrical to Array.eat
diff --git a/lib/reddit_api/posts.rb b/lib/reddit_api/posts.rb index abc1234..def5678 100644 --- a/lib/reddit_api/posts.rb +++ b/lib/reddit_api/posts.rb @@ -5,6 +5,7 @@ def initialize @client = RedditApi::Client.new @post_factory = RedditApi::Post + @query_factory = RedditApi::Query end def top(subreddit, count) @@ -14,11 +15,19 @@ end private - attr_reader :client, :post_factory + attr_reader :client, :post_factory, :query_factory def top_data(subreddit, count) + query = build_query(subreddit, count) + client.get(query) + query.captured_records + end + + def build_query(subreddit, count) endpoint = URI.encode("r/#{subreddit.name}/hot.json") - client.get(endpoint, count, :post) + query_factory.new(count: count, + endpoint: endpoint, + resource: :post) end def filter_out(posts_data, filter)
Refactor Posts to use Query object
diff --git a/lib/storext/override.rb b/lib/storext/override.rb index abc1234..def5678 100644 --- a/lib/storext/override.rb +++ b/lib/storext/override.rb @@ -44,6 +44,10 @@ attr_definition[:opts].reject { |k,v| k == :default }, ) + storext_overrider_define_reader(association_name, column_name, attr) + end + + def storext_overrider_define_reader(association_name, column_name, attr) define_method attr do |*args| if send(column_name).has_key?(attr) super(*args)
Move reader definition into its own method
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index abc1234..def5678 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -1,7 +1,3 @@-# TODO: Redefine the concerns here so we don't have to require a rabbit hole. There should be a better way. This may be affected by test order. We'll come back to this -module UploadsMedia; end -module UploadsThumbnails; end - require "active_record_spec_helper" require "./app/models/event"
Remove temporary todo since they are now included in the ar spec helper
diff --git a/spec/support/apartment.rb b/spec/support/apartment.rb index abc1234..def5678 100644 --- a/spec/support/apartment.rb +++ b/spec/support/apartment.rb @@ -0,0 +1,11 @@+RSpec.configure do |config| + # No need to create each tenant, just pick one for testing purposes + + config.before(:suite) do + Apartment::Tenant.create("earth") + end + + config.after(:suite) do + Apartment::Tenant.drop("earth") + end +end
Create at least one tenant to use during specs
diff --git a/lib/domtrix_lb_config.rb b/lib/domtrix_lb_config.rb index abc1234..def5678 100644 --- a/lib/domtrix_lb_config.rb +++ b/lib/domtrix_lb_config.rb @@ -6,6 +6,38 @@ def initialize(json_config, template) @config = JSON.parse(json_config) @template = template + end + + def healthcheck + @config["healthcheck"] + end + + def healthcheck_request + (healthcheck && healthcheck["request"]) || "/" + end + + def healthcheck_port + (healthcheck && healthcheck["port"]) + end + + def healthcheck_type + (healthcheck && healthcheck["type"]) + end + + def healthcheck_interval + (healthcheck && healthcheck["interval"]) || 5000 + end + + def healthcheck_timeout + (healthcheck && healthcheck["timeout"]) || 5000 + end + + def healthcheck_threshold_up + (healthcheck && healthcheck["threshold_up"]) || 3 + end + + def healthcheck_threshold_down + (healthcheck && healthcheck["threshold_down"]) || 3 end def lb_id
Add healthcheck stanzas to generator file
diff --git a/opml.gemspec b/opml.gemspec index abc1234..def5678 100644 --- a/opml.gemspec +++ b/opml.gemspec @@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "activesupport", "~> 3.2.12" + spec.add_dependency "activesupport", ">= 3.2.12", "< 4.1" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake"
Allow activesupport v3.2 and v4.0
diff --git a/lib/jschematic/schema.rb b/lib/jschematic/schema.rb index abc1234..def5678 100644 --- a/lib/jschematic/schema.rb +++ b/lib/jschematic/schema.rb @@ -47,8 +47,12 @@ return true unless schema schema.all? do |property, schema| - type_valid?(schema["type"], json[property]) && + if json[property] + type_valid?(schema["type"], json[property]) && + maximum_valid?(*schema.values_at("maximum", "exclusiveMaximum"), json[property]) + else maximum_valid?(*schema.values_at("maximum", "exclusiveMaximum"), json[property]) + end end end end
Validate type in properties if attribute exists
diff --git a/md-render/HHVM/UserDocumentation/IncludeExamplesFilter.rb b/md-render/HHVM/UserDocumentation/IncludeExamplesFilter.rb index abc1234..def5678 100644 --- a/md-render/HHVM/UserDocumentation/IncludeExamplesFilter.rb +++ b/md-render/HHVM/UserDocumentation/IncludeExamplesFilter.rb @@ -4,12 +4,24 @@ module UserDocumentation class IncludeExamplesFilter < HTML::Pipeline::Filter def call - base = File.dirname(context[:file]) + file = context[:file] + + # Actual directory is something like 01-foo-examples/ ... + examples_dir = File.basename(file, '.md') + '-examples' + # ... but to make reordering easier, the references to it in the + # markdown skip the '01-' prefix. + match = /^[0-9]+-(?<source_dir>.+)/.match(examples_dir) + return(doc) if match.nil? + source_examples_dir = match['source_dir'] + + base = File.expand_path(examples_dir, File.dirname(file)) + doc.search('p').each do |node| contents = node.inner_text.strip - if match_data = /^@@ (?<relative_path>[^ ]+\.php(?:.type-errors)?) @@$/.match(contents) - relative_path = match_data['relative_path'] - full_path = File.expand_path(relative_path, base) + if match = %r,^@@ (?<dir_name>[^/ ]+)/(?<file_name>[^/ ]+\.php(?:.type-errors)?) @@$,.match(contents) + next if match[:dir_name] != source_examples_dir + + full_path = File.expand_path(match[:file_name], base) if ! File.exists? full_path text = "Missing example: #{full_path}"
Update markdown renderer to support new layout
diff --git a/lib/oga/xml/namespace.rb b/lib/oga/xml/namespace.rb index abc1234..def5678 100644 --- a/lib/oga/xml/namespace.rb +++ b/lib/oga/xml/namespace.rb @@ -5,17 +5,15 @@ # name and URI. # class Namespace - attr_accessor :name, :uri + attr_accessor :name ## # @param [Hash] options # # @option options [String] :name - # @option options [String] :uri # def initialize(options = {}) @name = options[:name] - @uri = options[:uri] end ##
Remove the uri attribute from Namespace. Oga won't be handling URIs any time soon. The rationale is that they server zero purpose when it comes to just parsing XML. Another goal of Oga is to make it easy to modify and reserialize documents back to XML. If namespaces would also store the URIs this would make this process more difficult.
diff --git a/lib/scnnr/recognition.rb b/lib/scnnr/recognition.rb index abc1234..def5678 100644 --- a/lib/scnnr/recognition.rb +++ b/lib/scnnr/recognition.rb @@ -2,10 +2,11 @@ module Scnnr class Recognition - attr_reader :id, :objects, :state, :error + attr_reader :id, :image, :objects, :state, :error def initialize(attrs = {}) @id = attrs['id'] + @image = Image.new(attrs['image']) if attrs['image'] @objects = (attrs['objects'] || []).map { |obj| Object.new(obj) } @state = attrs['state']&.intern @error = attrs['error'] @@ -24,7 +25,9 @@ end def to_h - { 'id' => self.id, 'objects' => self.objects.map(&:to_h), 'state' => self.state.to_s } + hash = { 'id' => self.id, 'objects' => self.objects.map(&:to_h), 'state' => self.state.to_s } + hash['image'] = self.image.to_h if self.image + hash end end end
Use image attributes from parsed JSON response
diff --git a/lib/cloud_cost_tracker.rb b/lib/cloud_cost_tracker.rb index abc1234..def5678 100644 --- a/lib/cloud_cost_tracker.rb +++ b/lib/cloud_cost_tracker.rb @@ -3,3 +3,31 @@ # Load all ruby files from 'cloud_cost_tracker' directory Dir[File.join(File.dirname(__FILE__), "cloud_cost_tracker/**/*.rb")].each {|f| require f} + +module CloudCostTracker + + # Creates and returns an appropriate instance of ResourceBillingPolicy + # for billing the given +resource+, or nil the Class is not found + # @param [Fog::Model] resource the resource for which to generate a bill + # @param [Hash] options optional additional parameters: + # - :logger - a Ruby Logger-compatible object + # @return [ResourceBillingPolicy] a billing policy object for resource + def self.create_billing_agent(resource, options = {}) + agent = nil + billing_class_name = "CloudCostTracker::Billing::Resources" + if matches = resource.class.name.match(%r{^Fog::(\w+)::(\w+)::(\w+)}) + fog_svc, provider, policy_name = + matches[1], matches[2], "#{matches[3]}BillingPolicy" + billing_class_name += "::#{fog_svc}::#{provider}::#{policy_name}" + service_module = + CloudCostTracker::Billing::Resources::const_get fog_svc + provider_module = service_module.send(:const_get, provider) + if provider_module.send(:const_defined?, policy_name) + policy_class = provider_module.send(:const_get, policy_name) + agent = policy_class.send(:new, resource, {:logger => options[:logger]}) + end + end + agent + end + +end
Add static module function for mapping resources to their Billing Policy class
diff --git a/lib/deep_cover/node/if.rb b/lib/deep_cover/node/if.rb index abc1234..def5678 100644 --- a/lib/deep_cover/node/if.rb +++ b/lib/deep_cover/node/if.rb @@ -2,57 +2,24 @@ module DeepCover class Node - class Else < Node - include Wrapper - has_child body: [Node, nil], - is_statement: true - - def is_statement - false - end - - def loc_hash - {else: parent.loc_hash[:else], colon: parent.loc_hash[:colon], expression: body && body.loc_hash[:expression] } - end - - def executed_loc_keys - if loc_hash[:else] - if loc_hash[:else].source == 'else' - :else - else - # elsif will be handled by the child body - nil - end - else - :colon - end - end - end - class If < Node include Branch has_tracker :truthy has_child condition: Node, rewrite: '((%{node}) && %{truthy_tracker})' - has_child true_branch: [Node, nil], + has_child true_branch: Node, + can_be_empty: true, + executed_loc_keys: -> { :else if style == :unless }, flow_entry_count: :truthy_tracker_hits, - remap: :remap_branch, is_statement: true - has_child false_branch: [Node, nil], + has_child false_branch: Node, + can_be_empty: true, + executed_loc_keys: -> { [:else, :colon] if style != :unless }, flow_entry_count: -> { condition.flow_completion_count - truthy_tracker_hits }, - remap: :remap_branch, is_statement: true executed_loc_keys :keyword, :question - def remap_branch(child, child_name) - is_unless = style == :unless - Else if child_name == :true_branch && is_unless || child_name == :false_branch && !is_unless - end - def branches - [ - true_branch || TrivialBranch.new(condition, false_branch), - false_branch || TrivialBranch.new(condition, true_branch) - ] + [ true_branch, false_branch ] end def execution_count
Use can_be_empty & executed_loc_keys for If
diff --git a/lib/git_reflow/sandbox.rb b/lib/git_reflow/sandbox.rb index abc1234..def5678 100644 --- a/lib/git_reflow/sandbox.rb +++ b/lib/git_reflow/sandbox.rb @@ -39,7 +39,7 @@ # WARNING: this currently only supports OS X and UBUNTU def ask_to_open_in_browser(url) - if OS.linux? + if OS.unix? open_in_browser = ask "Would you like to open it in your browser? " if open_in_browser =~ /^y/i if OS.mac?
Fix the ask to open in browser dialog on Mac. Why: * GitReflow::Sandbox#ask_to_open_in_browser method currently only works for linux. This change addresses the need by: * Add OS.mac? to the initial if statement guarding other platforms.
diff --git a/lib/layer/conversation.rb b/lib/layer/conversation.rb index abc1234..def5678 100644 --- a/lib/layer/conversation.rb +++ b/lib/layer/conversation.rb @@ -15,6 +15,14 @@ RelationProxy.new(self, Message, [Operations::Create, Operations::Paginate]) end + def metadata + attributes['metadata'] ||= {} + end + + def participants + attributes['participants'] ||= [] + end + def distinct? attributes['distinct'] end
Make sure Conversations always have metadata and participants methods
diff --git a/Casks/sonos.rb b/Casks/sonos.rb index abc1234..def5678 100644 --- a/Casks/sonos.rb +++ b/Casks/sonos.rb @@ -1,8 +1,8 @@ class Sonos < Cask - version '5.1' - sha256 '8a54102eb13879bd361624fa013279aecd27888b9575e19d60985dd029635d8a' + version :latest + sha256 :no_check - url 'http://update.sonos.com/software/mac/mdcr/SonosDesktopController51.dmg' + url 'http://www.sonos.com/redir/controller_software_mac' homepage 'http://www.sonos.com/' license :unknown
Upgrade Sonos.app to latest version.
diff --git a/app/concerns/viewable.rb b/app/concerns/viewable.rb index abc1234..def5678 100644 --- a/app/concerns/viewable.rb +++ b/app/concerns/viewable.rb @@ -2,7 +2,7 @@ extend ActiveSupport::Concern included do - has_many :views, class_name: self.name + 'View', dependent: :destroy + has_many :views, class_name: self.name + 'View', dependent: :destroy # rubocop:disable Rails/ReflectionClassName def mark_read(user, at_time=nil, force=false) view = view_for(user)
Disable Rails/ReflectionClassName on the class name in Viewable
diff --git a/app/models/analytics.rb b/app/models/analytics.rb index abc1234..def5678 100644 --- a/app/models/analytics.rb +++ b/app/models/analytics.rb @@ -8,24 +8,24 @@ def track_user_creation identify - track(event: 'Create User') + track(event: 'Signed Up') end def track_user_deletion - track(event: 'Delete User') + track(event: 'Deleted Account') end def track_user_sign_in identify - track(event: 'Sign In User') + track(event: 'Logged In') end def track_user_sign_out - track(event: 'Sign Out User') + track(event: 'Logged Out') end def track_feedback_form_submission - track(event: 'Submit Feedback Form') + track(event: 'Submitted Feedback Form') end private
Change Segment events to use past tense
diff --git a/app/models/consultant.rb b/app/models/consultant.rb index abc1234..def5678 100644 --- a/app/models/consultant.rb +++ b/app/models/consultant.rb @@ -11,7 +11,8 @@ private def update_balance - self.balance = self.income - self.outcome + new_balance = self.income - self.outcome + update_column(:balance, new_balance) end def must_update_balance?
Use update_column to skip callbacks It avoids a redundant call
diff --git a/app/models/data_point.rb b/app/models/data_point.rb index abc1234..def5678 100644 --- a/app/models/data_point.rb +++ b/app/models/data_point.rb @@ -15,8 +15,9 @@ class DataPoint < ApplicationRecord belongs_to :series, class_name: 'DataPointSeries' + # TODO: Consider moving configuration values to configuration RECENT_LIMIT = 50 - KEEP_RECORDS_FOR = 3.weeks + KEEP_RECORDS_FOR = 1.month scope :ordered, -> { order(created_at: :desc) } scope :recent, -> { ordered.limit(RECENT_LIMIT) }
Increase history depth fro the analytics data
diff --git a/app/models/inspection.rb b/app/models/inspection.rb index abc1234..def5678 100644 --- a/app/models/inspection.rb +++ b/app/models/inspection.rb @@ -11,8 +11,10 @@ # If not found in SORT_ORDER, then sort by the ascii code of character # "A".ord is 65, so these will all appear in alphabetical order after # anything in SORT_ORDER - self.infractions.sort_by { |infraction| - SORT_ORDER.index(infraction.severity[0].upcase) || infraction.severity[0].upcase.ord - } + self.infractions + .reject{ |infraction| infraction.severity.empty? } + .sort_by { |infraction| + SORT_ORDER.index(infraction.severity[0].upcase) || infraction.severity[0].upcase.ord + } end end
Fix issue where infractions sometimes didn't have a severity And TODO for later: Figure out why there are a few like this. For now, just rejecting them.
diff --git a/app/models/itemizable.rb b/app/models/itemizable.rb index abc1234..def5678 100644 --- a/app/models/itemizable.rb +++ b/app/models/itemizable.rb @@ -7,7 +7,7 @@ has_one :user, through: :purchase - after_save :send_swap_message, if: Proc.new { |i| i.swap_id && i.swap_id_changed? } + # after_save :send_swap_message, if: Proc.new { |i| i.swap_id && i.swap_id_changed? } validates_presence_of :item, :purchase
Remove hook so migrations with run
diff --git a/app/models/article.rb b/app/models/article.rb index abc1234..def5678 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -10,8 +10,10 @@ # user:: user who created article # # == methods -# display_name:: name boldfaced for display -# author:: user.name and login for display +# author:: user.name + user.login +# display_name:: name boldfaced +# format_name name +# unique_format_name name + id # class Article < AbstractModel belongs_to :user @@ -25,16 +27,19 @@ "**#{name}**" end + # Article creator. Used by show and index templates + def author + "#{user.name} (#{user.login})" + end + + # used by MatrixBoxPresenter to show orphaned obects def format_name name end + # title + id + # used by MatrixBoxPresenter to show unorphaned obects def unique_format_name name + " (#{id || "?"})" end - - # Article creator. Used by show and index templates - def author - "#{user.name} (#{user.login})" - end end
Add documentation of Article methods in public interface
diff --git a/app/models/article.rb b/app/models/article.rb index abc1234..def5678 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -9,7 +9,8 @@ has_many :authors def comments - Comment.find_all_by_content_id(self.id) + conditions = {:enabled => true, :spam => false} + Comment.find_all_by_content_id(self.id, :conditions => conditions) end def to_liquid(options = {})
Make sure to only pull the comments we want
diff --git a/main.rb b/main.rb index abc1234..def5678 100644 --- a/main.rb +++ b/main.rb @@ -4,6 +4,22 @@ def initialize @up_requests = 0b0000000000 @down_requests = 0b0000000000 + end + + def add_up(level) + + end + + def add_down(level) + + end + + def serve_up(level) + + end + + def serve_down(level) + end end
Add initial method declarations for RequestList
diff --git a/spec/features/todos/target_state_todos_spec.rb b/spec/features/todos/target_state_todos_spec.rb index abc1234..def5678 100644 --- a/spec/features/todos/target_state_todos_spec.rb +++ b/spec/features/todos/target_state_todos_spec.rb @@ -0,0 +1,84 @@+require 'rails_helper' + +describe 'Todos > Target State Labels' do + let(:user) { create(:user) } + let(:author) { create(:user) } + let(:project) { create(:project) } + let(:issue_open) { create(:issue) } + let(:issue_closed) { create(:issue, state: 'closed') } + let(:mr_open) { create(:merge_request, :simple, author: user) } + let(:mr_merged) { create(:merge_request, :simple, author: user, state: 'merged') } + let(:mr_closed) { create(:merge_request, :simple, author: user, state: 'closed') } + + describe 'GET /dashboard/todos' do + context 'On a todo for a Closed Issue' do + before do + create(:todo, :mentioned, user: user, project: project, target: issue_closed, author: author) + login_as user + visit dashboard_todos_path + end + + it 'has closed label' do + page.within '.todos-list' do + expect(page).to have_content('Closed') + end + end + end + + context 'On a todo for a Open Issue' do + before do + create(:todo, :mentioned, user: user, project: project, target: issue_open, author: author) + login_as user + visit dashboard_todos_path + end + + it 'does not have a open label' do + page.within '.todos-list' do + expect(page).not_to have_content('Open') + end + end + end + + context 'On a todo for a merged Merge Request' do + before do + create(:todo, :mentioned, user: user, project: project, target: mr_merged, author: author) + login_as user + visit dashboard_todos_path + end + + it 'has merged label' do + page.within '.todos-list' do + expect(page).to have_content('Merged') + end + end + end + + context 'On a todo for a closed Merge Request' do + before do + create(:todo, :mentioned, user: user, project: project, target: mr_closed, author: author) + login_as user + visit dashboard_todos_path + end + + it 'has closed label' do + page.within '.todos-list' do + expect(page).to have_content('Closed') + end + end + end + + context 'On a todo for a open Merge Request' do + before do + create(:todo, :mentioned, user: user, project: project, target: mr_open, author: author) + login_as user + visit dashboard_todos_path + end + + it 'does not have a open label' do + page.within '.todos-list' do + expect(page).not_to have_content('Open') + end + end + end + end +end
Add tests for Todos target's state
diff --git a/db/migrate/20160128160543_add_lookup_values.rb b/db/migrate/20160128160543_add_lookup_values.rb index abc1234..def5678 100644 --- a/db/migrate/20160128160543_add_lookup_values.rb +++ b/db/migrate/20160128160543_add_lookup_values.rb @@ -1,44 +1,53 @@ class AddLookupValues < ActiveRecord::Migration VALUES = { - IncomeType => %w{ - Employment - SSI/SSDI - EDD - None - Permanently Disabled - Temporarily Disabled - }, - ResidenceType => %w{ - Room - Apartment - Single family home - Town home - }, - SubsidyType => %w{ - Housing 1000 - Section 8 voucher - HUD-VASH - }, - ReasonType => %w{ - Injury - Illness - Death in the family - Natural disaster - Currently homeless - Moving from unsuitable living conditions - Victim of crime - Temporary loss of employment - Rent increase unaffordable - No-fault notice to vacate - Unanticipated expenses - Moving from shelter - Delay/cancellation of assistance or benefits - Other - } + IncomeType => [ + "Employment", + "SSI/SSDI", + "EDD", + "None", + "Permanently Disabled", + "Temporarily Disabled" + ], + ResidenceType => [ + "Room", + "Apartment", + "Single family home", + "Town home" + ], + SubsidyType => [ + "Housing 1000", + "Section 8 voucher", + "HUD-VASH" + ], + ReasonType => [ + "Injury", + "Illness", + "Death in the family", + "Natural disaster", + "Currently homeless", + "Moving from unsuitable living conditions", + "Victim of crime", + "Temporary loss of employment", + "Rent increase unaffordable", + "No-fault notice to vacate", + "Unanticipated expenses", + "Moving from shelter", + "Delay/cancellation of assistance or benefits", + "Other" + ], + CoverageType => [ + "Current month's rent", + "Past due rent (not including current month)", + "Security Deposit (prior to move-in)", + "Security Deposit (past-due, after move-in)", + "Utilities" + ] } def up VALUES.each do |klass, descriptions| + klass.delete_all + descriptions.each do |desc| klass.create(description: desc) end
Fix the lists of lookup values...
diff --git a/spec/services/pending_payments_service_spec.rb b/spec/services/pending_payments_service_spec.rb index abc1234..def5678 100644 --- a/spec/services/pending_payments_service_spec.rb +++ b/spec/services/pending_payments_service_spec.rb @@ -0,0 +1,28 @@+require 'spec_helper' + +describe PendingPayments do + let(:order1) { + create(:order_with_totals_and_distribution, + completed_at: 1.day.ago, state: "complete", + payments: [create(:payment, state: 'checkout')]) + } + let(:order2) { + create(:order_with_totals_and_distribution, + completed_at: 1.day.ago, state: "complete", + payments: [create(:payment, state: 'completed')]) + } + + describe "#can_be_captured?" do + it "responds with a boolean; if an order has payments that can be captured or not" do + expect(PendingPayments.new(order1).can_be_captured?).to be_truthy + expect(PendingPayments.new(order2).can_be_captured?).to_not be_truthy + end + end + + describe "#payment_object" do + it "returns a capturable payment object if there is one present" do + expect(PendingPayments.new(order1).payment_object).to be_a Spree::Payment + expect(PendingPayments.new(order2).payment_object).to be_nil + end + end +end
Add spec for pending payments service
diff --git a/config/initializers/activities_counter_cache.rb b/config/initializers/activities_counter_cache.rb index abc1234..def5678 100644 --- a/config/initializers/activities_counter_cache.rb +++ b/config/initializers/activities_counter_cache.rb @@ -1,4 +1,6 @@-job = Delayed::Backend::ActiveRecord::Job.all :conditions => ['handler LIKE ?', "%ActivitiesCounterCacheJob%"] -if job.blank? - Delayed::Backend::ActiveRecord::Job.enqueue(ActivitiesCounterCacheJob.new, -3) +if Delayed::Backend::ActiveRecord::Job.table_exists? + job = Delayed::Backend::ActiveRecord::Job.all :conditions => ['handler LIKE ?', "%ActivitiesCounterCacheJob%"] + if job.blank? + Delayed::Backend::ActiveRecord::Job.enqueue(ActivitiesCounterCacheJob.new, -3) + end end
Check if table exists before try to use it in the Rails initializers Conflicts: config/initializers/person_notification.rb