diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/dato/dump/runner.rb b/lib/dato/dump/runner.rb index abc1234..def5678 100644 --- a/lib/dato/dump/runner.rb +++ b/lib/dato/dump/runner.rb @@ -24,6 +24,7 @@ operation ) + I18n.available_locales = loader.items_repo.available_locales operation.perform end
Set DatoCMS locales as I18n available locales
diff --git a/lib/sms_tools/encoding_detection.rb b/lib/sms_tools/encoding_detection.rb index abc1234..def5678 100644 --- a/lib/sms_tools/encoding_detection.rb +++ b/lib/sms_tools/encoding_detection.rb @@ -49,9 +49,9 @@ concatenated_parts * MAX_LENGTH_FOR_ENCODING[encoding][message_type] end - # Returns the number of symbols, which the given text will take up in an SMS - # message, taking into account any double-space symbols in the GSM 03.38 - # encoding. + # Returns the number of symbols which the given text will eat up in an SMS + # message, taking into account any double-space symbols in the GSM 03.38 + # encoding. def length length = text.length length += text.chars.count { |char| GsmEncoding.double_byte?(char) } if gsm?
Fix the indentation and improve wording in a comment
diff --git a/lib/specinfra/backend/dockerfile.rb b/lib/specinfra/backend/dockerfile.rb index abc1234..def5678 100644 --- a/lib/specinfra/backend/dockerfile.rb +++ b/lib/specinfra/backend/dockerfile.rb @@ -13,6 +13,11 @@ CommandResult.new end + def send_file(from, to) + @lines << "ADD #{from} #{to}" + CommandResult.new + end + def from(base) @lines << "FROM #{base}" end
Add send_file to Dockerfile backend
diff --git a/spec/stringextension_spec.rb b/spec/stringextension_spec.rb index abc1234..def5678 100644 --- a/spec/stringextension_spec.rb +++ b/spec/stringextension_spec.rb @@ -3,6 +3,37 @@ module Vim module Flavor describe StringExtension do + describe '#to_flavorfile_path' do + it 'extends a given path to a flavorfile' do + expect('cwd'.to_flavorfile_path).to be == 'cwd/VimFlavor' + end + end + + describe '#to_flavors_path' do + it 'extends a given path to a flavors path' do + expect('home/.vim'.to_flavors_path).to be == 'home/.vim/pack/flavors/start' + end + end + + describe '#to_lockfile_path' do + it 'extends a given path to a lockfile' do + expect('cwd'.to_lockfile_path).to be == 'cwd/VimFlavor.lock' + end + end + + describe '#to_stash_path' do + it 'extends a given path to a stash path' do + expect('home'.to_stash_path).to be == 'home/.vim-flavor' + expect('cwd'.to_stash_path).to be == 'cwd/.vim-flavor' + end + end + + describe '#to_vimfiles_path' do + it 'extends a given path to a vimfiles path' do + expect('home'.to_vimfiles_path).to be == 'home/.vim' + end + end + describe '#zap' do it 'replace unsafe characters with "_"' do expect('fakeclip'.zap).to be == 'fakeclip'
Add missing tests about StringExtension
diff --git a/db/migrate/20150812150214_add_dropdown_to_assignment_questionnaires_table.rb b/db/migrate/20150812150214_add_dropdown_to_assignment_questionnaires_table.rb index abc1234..def5678 100644 --- a/db/migrate/20150812150214_add_dropdown_to_assignment_questionnaires_table.rb +++ b/db/migrate/20150812150214_add_dropdown_to_assignment_questionnaires_table.rb @@ -0,0 +1,9 @@+class AddDropdownToAssignmentQuestionnairesTable < ActiveRecord::Migration + def self.up + add_column :assignment_questionnaires, :dropdown, :boolean, default: true + end + + def self.down + remove_colmun :assignment_questionnaires, :dropdown + end +end
Add dropdown to assignment questionnaires table
diff --git a/functions/rakefile.rb b/functions/rakefile.rb index abc1234..def5678 100644 --- a/functions/rakefile.rb +++ b/functions/rakefile.rb @@ -15,5 +15,5 @@ end task :clean do - sh 'git clean -dfx' + sh 'git clean -dfx --exclude .runtimeconfig.json' end
Exclude config file from clean up
diff --git a/http-commands.gemspec b/http-commands.gemspec index abc1234..def5678 100644 --- a/http-commands.gemspec +++ b/http-commands.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'http-commands' - s.version = '0.0.2.4' + s.version = '0.0.2.5' s.summary = 'Convenience abstractions for common HTTP operations, such as post and get' s.description = ' '
Package version is increased from 0.0.2.4 to 0.0.2.5
diff --git a/lib/Storm/Account/auth.rb b/lib/Storm/Account/auth.rb index abc1234..def5678 100644 --- a/lib/Storm/Account/auth.rb +++ b/lib/Storm/Account/auth.rb @@ -0,0 +1,27 @@+require "Storm/Base/sodserver" + +module Storm + module Account + module Auth + # Expire an existing token immediately + # + # @return [Bool] whether the token is expired + def self.expire + data = Storm::Base::SODServer.remote_call '/Account/Auth/expireToken' + data[:expired] == 0 ? false : true + end + + # Tokens can be kept alive by calling this method again before the token + # expires, up to a maximum of 12 hours. After 12 hours, the token will + # be expired permanently and a new token will need to be retrieved using + # the original password for your user. + # + # @param timeout [Int] + # @return [Hash] a hash with keys: :expires and :token + def self.token(timeout) + Storm::Base::SODServer.remote_call '/Account/Auth/token', + :timeout => timeout + end + end + end +end
Add Auth module and APIs
diff --git a/spec/mailto_awesome_spec.rb b/spec/mailto_awesome_spec.rb index abc1234..def5678 100644 --- a/spec/mailto_awesome_spec.rb +++ b/spec/mailto_awesome_spec.rb @@ -2,13 +2,13 @@ RSpec.describe ::MailtoAwesome do - it 'Good mailto link' do + it 'accepts an awesome mailto link' do file = "#{FIXTURES_DIR}/mailto_awesome.html" proofer = run_proofer(file, :file, {:check_mailto_awesome => true}) expect(proofer.failed_tests.last).to eq nil end - it 'Bad mailto link' do + it 'rejects a not-awesome mailto link' do file = "#{FIXTURES_DIR}/mailto_not_awesome.html" proofer = run_proofer(file, :file, {:check_mailto_awesome => true}) expect(proofer.failed_tests.last).to match(%r{This is a not-awesome mailto link!})
Use canonical sentence structure for spec tests
diff --git a/spec/support/carrierwave.rb b/spec/support/carrierwave.rb index abc1234..def5678 100644 --- a/spec/support/carrierwave.rb +++ b/spec/support/carrierwave.rb @@ -11,10 +11,12 @@ storage :file def cache_dir + super # Just to run the superclass method, but we ignore the return value. "#{Rails.root}/spec/support/uploads/tmp" end def store_dir + super # Just to run the superclass method, but we ignore the return value. "#{Rails.root}/spec/support/uploads/#{model.class.to_s.underscore}/#{model.id}" end end
Call the superclass implementation to simulate production Carrierwave.
diff --git a/lib/fog/google/storage.rb b/lib/fog/google/storage.rb index abc1234..def5678 100644 --- a/lib/fog/google/storage.rb +++ b/lib/fog/google/storage.rb @@ -5,8 +5,14 @@ module Storage class Google < Fog::Service def self.new(options = {}) + begin + fog_creds = Fog.credentials + rescue + fog_creds = nil + end + if options.keys.include? :google_storage_access_key_id or - (Fog.credentials and Fog.credentials.keys.include? :google_storage_access_key_id) + (not fog_creds.nil? and fog_creds.keys.include? :google_storage_access_key_id) Fog::Storage::GoogleXML.new(options) else Fog::Storage::GoogleJSON.new(options)
Handle case where Fog.credentials is empty
diff --git a/lib/html-proofer/utils.rb b/lib/html-proofer/utils.rb index abc1234..def5678 100644 --- a/lib/html-proofer/utils.rb +++ b/lib/html-proofer/utils.rb @@ -31,13 +31,9 @@ # problem from http://git.io/vBYU1 # solution from http://git.io/vBYUi def clean_content(string) - matches = string.scan(%r{https?://([^>]+)}i) - - matches.flatten.each do |url| - escaped_url = url.gsub(/&(?!amp;)/, '&amp;') - string.gsub!(url, escaped_url) + string.gsub(%r{https?://([^>]+)}i) do |url| + url.gsub(/&(?!amp;)/, '&amp;') end - string end module_function :clean_content end
Simplify some string cleaning logic
diff --git a/lib/markdo/rss_command.rb b/lib/markdo/rss_command.rb index abc1234..def5678 100644 --- a/lib/markdo/rss_command.rb +++ b/lib/markdo/rss_command.rb @@ -4,12 +4,14 @@ module Markdo class RssCommand < Command def run + uri_parser = URI::Parser.new + items = Dir. glob(markdown_glob). map { |path| File.readlines(path, encoding: 'UTF-8') }. flatten. grep(%r(https?://)). - map { |line| Item.new(title: clean(line), links: URI.extract(line)) } + map { |line| Item.new(title: clean(line), links: uri_parser.extract(line)) } xml = template(items)
Fix `warning: URI.extract is obsolete`
diff --git a/lib/rapnd/notification.rb b/lib/rapnd/notification.rb index abc1234..def5678 100644 --- a/lib/rapnd/notification.rb +++ b/lib/rapnd/notification.rb @@ -22,7 +22,7 @@ def json_payload j = ActiveSupport::JSON.encode(payload) - raise "The payload #{j} is larger than allowed: #{j.length}" if j.size > 256 + raise "The payload #{j} is larger than allowed: #{j.length}" if j.size > 2048 j end
Support the larger payload sizes in iOS 8
diff --git a/lib/tty/prompt/version.rb b/lib/tty/prompt/version.rb index abc1234..def5678 100644 --- a/lib/tty/prompt/version.rb +++ b/lib/tty/prompt/version.rb @@ -2,6 +2,6 @@ module TTY class Prompt - VERSION = '0.16.0'.freeze + VERSION = '0.16.1'.freeze end # Prompt end # TTY
Change to bump patch level up
diff --git a/lib/xcode/install/list.rb b/lib/xcode/install/list.rb index abc1234..def5678 100644 --- a/lib/xcode/install/list.rb +++ b/lib/xcode/install/list.rb @@ -4,23 +4,9 @@ self.command = 'list' self.summary = 'List Xcodes available for download.' - def self.options - [['--all', 'Show all available versions.']].concat(super) - end - - def initialize(argv) - @all = argv.flag?('all', false) - super - end - def run installer = XcodeInstall::Installer.new - - if @all - puts installer.list - else - puts installer.list_current - end + puts installer.list end end end
Remove --all, and make it the default behaviour
diff --git a/lib/dry/container.rb b/lib/dry/container.rb index abc1234..def5678 100644 --- a/lib/dry/container.rb +++ b/lib/dry/container.rb @@ -7,6 +7,8 @@ require 'dry/container/mixin' require 'dry/container/version' +# A collection of micro-libraries, each intended to encapsulate +# a common task in Ruby module Dry # Inversion of Control (IoC) container #
Add a comment describing the Dry (namespace) module
diff --git a/lib/ldap/model/ad.rb b/lib/ldap/model/ad.rb index abc1234..def5678 100644 --- a/lib/ldap/model/ad.rb +++ b/lib/ldap/model/ad.rb @@ -1,17 +1,23 @@+require 'active_support/core_ext/time/zones' + module LDAP::Model module AD # Difference in seconds between the UNIX Epoch (1970-01-01) # and the Active Directory Epoch (1601-01-01) - EPOCH_OFFSET = 11644477200 + EPOCH_OFFSET = Time.utc(1601).to_i def self.now - (Time.now.to_i + EPOCH_OFFSET) * 10_000_000 + ((utc.now.to_f - EPOCH_OFFSET) * 10_000_000).to_i end # number of nanosec / 100, i.e. 10 times the number of microsec, # divide by 10_000_000 so it becomes number of seconds def self.at(timestamp) - Time.at(timestamp / 10_000_000 - EPOCH_OFFSET) + utc.at(timestamp / 10_000_000.0 + EPOCH_OFFSET).localtime + end + + def self.utc + @utc ||= Time.find_zone('UTC') end end
Fix AD time interval parsing
diff --git a/lib/matross/mysql.rb b/lib/matross/mysql.rb index abc1234..def5678 100644 --- a/lib/matross/mysql.rb +++ b/lib/matross/mysql.rb @@ -25,4 +25,14 @@ run "mysql --user=#{mysql_user} --password=#{mysql_passwd} --host=#{mysql_host} --execute=\"#{sql}\"" end after "db:setup", "db:create" + + desc "Loads the application schema into the database" + task :schema_load, :roles => [:db] do + sql = <<-EOF.gsub(/^\s+/, '') + SELECT count(*) FROM information_schema.TABLES WHERE (TABLE_SCHEMA = '#{mysql_database}'); + EOF + table_count = "mysql --user=#{mysql_user} --password=#{mysql_passwd} --host=#{mysql_host} --batch --skip-column-names --execute=\"#{sql}\"" + run "cd #{current_path} && rake db:schema:load" unless table_count == 0 + end + after "db:symlink", "db:schema_load" end
Implement schema load if database empty We count the number of tables in the configured database
diff --git a/lib/opbeat/filter.rb b/lib/opbeat/filter.rb index abc1234..def5678 100644 --- a/lib/opbeat/filter.rb +++ b/lib/opbeat/filter.rb @@ -62,7 +62,7 @@ end def rails_filters - if defined?(::Rails) && Rails.application + if defined?(::Rails) && Rails.respond_to?(:application) && Rails.application if filters = ::Rails.application.config.filter_parameters filters.any? ? filters : nil end
Check if Rails responds to application before calling it
diff --git a/lib/croudia/status.rb b/lib/croudia/status.rb index abc1234..def5678 100644 --- a/lib/croudia/status.rb +++ b/lib/croudia/status.rb @@ -10,17 +10,14 @@ :in_reply_to_screen_name, :in_reply_to_status_id_str, :in_reply_to_status_id, :in_reply_to_user_id_str, :in_reply_to_user_id, :spread, :spread_count, :spread_status, - :play_spread, :play_spread_status, :reply_status, :source, - :text, :user + :reply_status, :source, :text, :user def initialize(attrs={}) user = attrs.delete('user') - pss = attrs.delete('play_spread_status') reply_status = attrs.delete('reply_status') spread_status = attrs.delete('spread_status') super(attrs) @attrs['user'] = Croudia::User.new(user) if user - @attrs['play_spread_status'] = Croudia::Status.new(pss) if pss @attrs['reply_status'] = Croudia::Status.new(reply_status) if reply_status @attrs['spread_status'] = Croudia::Status.new(spread_status) if spread_status end
Delete play_* attrs of Status object It was a bug in the document. See: https://croudia.com/voices/show/1268070
diff --git a/lib/easemob/groups.rb b/lib/easemob/groups.rb index abc1234..def5678 100644 --- a/lib/easemob/groups.rb +++ b/lib/easemob/groups.rb @@ -1,15 +1,19 @@ module Easemob module Groups + def create_group(groupname, description, owner, members: nil, is_public: true, maxusers: 200, is_approval: false) + jd = { groupname: groupname, desc: description, public: is_public, owner: owner, users: maxusers, approval: is_approval } + jd[:members] = members unless members.nil? + request :post, 'chatgroups', json: jd + end + def query_groups(limit = 50, cursor = nil) params = { limit: limit } params[:cursor] = cursor unless cursor.nil? request :get, 'chatgroups', params: params end - def create_group(groupname, description, owner, members: nil, is_public: true, maxusers: 200, is_approval: false) - jd = { groupname: groupname, desc: description, public: is_public, owner: owner, users: maxusers, approval: is_approval } - jd[:members] = members unless members.nil? - request :post, 'chatgroups', json: jd + def delete_group(group_id) + request :delete, "chatgroups/#{group_id}" end def modify_group(group_id, groupname: nil, description: nil, maxusers: nil) @@ -19,9 +23,5 @@ jd[:maxusers] = maxusers unless maxusers.nil? request :put, "chatgroups/#{group_id}", json: jd end - - def delete_group(group_id) - request :delete, "chatgroups/#{group_id}" - end end end
Arrange the method sequence in create, query, delete and modify, same as users.
diff --git a/lib/email_assessor.rb b/lib/email_assessor.rb index abc1234..def5678 100644 --- a/lib/email_assessor.rb +++ b/lib/email_assessor.rb @@ -15,7 +15,7 @@ protected def self.domain_in_file?(domain, filename) - return false unless File.exists?(filename) + return false unless filename.present? && File.exists?(filename) domain = domain.downcase domain_matched = false
Check that a file name was provided before checking if the file exists
diff --git a/lib/endpoint/tasks.rb b/lib/endpoint/tasks.rb index abc1234..def5678 100644 --- a/lib/endpoint/tasks.rb +++ b/lib/endpoint/tasks.rb @@ -1,12 +1,22 @@+require 'endpoint/socks' + namespace :endpoint do namespace :proxy do + def ensure_default_config + Endpoint::Socks.default_config.tap do |c| + raise "Enpoint::Socks.default_config must be set to use this task." if c.nil? || c.empty? + end + end + desc 'Start SOCKS proxy over SSH for connecting to firewalled servers.' task :start do + ensure_default_config Endpoint::Socks.start end desc 'Stop SOCKS proxy.' task :stop do + ensure_default_config Endpoint::Socks.stop end end
Add needed lib and better message on missing config.
diff --git a/lib/virtualbox-ws.rb b/lib/virtualbox-ws.rb index abc1234..def5678 100644 --- a/lib/virtualbox-ws.rb +++ b/lib/virtualbox-ws.rb @@ -1,7 +1,7 @@ require 'require_all' require_rel 'core_ext' +require_rel 'virtualbox/base' require_rel 'virtualbox/configuration' require_rel 'virtualbox/exceptions' require_rel 'virtualbox/webservice' -require_rel 'virtualbox/base' require_rel 'virtualbox/classes/websession_manager'
Reorder files requiring in main script The main module VBox is defined in the virtualbox/base script. However it is used in others which define submodules. Requiring it first fix a 'NameError: uninitialized constant VBox' when trying to define those submodules.
diff --git a/omniauth-oauth2.gemspec b/omniauth-oauth2.gemspec index abc1234..def5678 100644 --- a/omniauth-oauth2.gemspec +++ b/omniauth-oauth2.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |gem| gem.add_dependency "oauth2", "~> 1.1" - gem.add_dependency "omniauth", "~> 1.2" + gem.add_dependency "omniauth", "~> 1.9" gem.add_development_dependency "bundler", "~> 1.0"
Use omniauth 1.9 to ensure latest security updates
diff --git a/lib/metacrunch/cli.rb b/lib/metacrunch/cli.rb index abc1234..def5678 100644 --- a/lib/metacrunch/cli.rb +++ b/lib/metacrunch/cli.rb @@ -24,11 +24,11 @@ if args.empty? say "You need to provide a job description file." exit(1) - elsif args.size > 1 - say "You can't run more than one job description at once." - exit(1) else - say "TODO" + args.each do |filename| + contents = File.read(filename) + Metacrunch::Job.define(contents, filename: filename).run + end end end end
Improve CLI to actually run metacrunch job files.
diff --git a/app/helpers/helpers.rb b/app/helpers/helpers.rb index abc1234..def5678 100644 --- a/app/helpers/helpers.rb +++ b/app/helpers/helpers.rb @@ -1,7 +1,7 @@ helpers do def current_user - User.find_by(id: session[:user_id]) + User.find_by(id: session[:user_id]) if session[:user_id] end def logout_user
Secure by checking for cookie
diff --git a/lib/parallel_batch.rb b/lib/parallel_batch.rb index abc1234..def5678 100644 --- a/lib/parallel_batch.rb +++ b/lib/parallel_batch.rb @@ -61,7 +61,7 @@ end def batch_size - 1000 + 100 end end
Decrease default batch size to 100.
diff --git a/app/models/database.rb b/app/models/database.rb index abc1234..def5678 100644 --- a/app/models/database.rb +++ b/app/models/database.rb @@ -6,6 +6,8 @@ def postgres_report machines.inject([]) do |memo,machine| memo.concat(machine.postgres_report) + end.sort_by do |report| + [report["port"].to_i, report["pg_cluster"]] end end end
Sort postgres reports by port and instance name
diff --git a/app/models/document.rb b/app/models/document.rb index abc1234..def5678 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -2,13 +2,13 @@ include FindOrCreateLocked has_many :editions - has_one :draft, -> { where(content_store: "draft") }, class_name: Edition - has_one :live, -> { where(content_store: "live") }, class_name: Edition + has_one :draft, -> { where(content_store: "draft") }, class_name: 'Edition' + has_one :live, -> { where(content_store: "live") }, class_name: 'Edition' # Due to the scenario of unpublished type substitute we need a scope that # can access published / unpublished which isn't tied to live content store # FIXME - we should make this go away - has_one :published_or_unpublished, -> { where(state: %w(published unpublished)) }, class_name: Edition + has_one :published_or_unpublished, -> { where(state: %w(published unpublished)) }, class_name: 'Edition' validates :content_id, presence: true, uuid: true
Use string for class_name in has_one. Passing a class is deprecated.
diff --git a/app/models/position.rb b/app/models/position.rb index abc1234..def5678 100644 --- a/app/models/position.rb +++ b/app/models/position.rb @@ -1,12 +1,19 @@ class Position < ActiveRecord::Base + # Constants + PARADIGM_AVAILABILITY = 'availability' + PARADIGM_FIXED_SHIFT = 'fixed_shift' + PARADIGM_NO_SHIFT = 'no_shift' + SUPPORTED_PARADIGMS = [PARADIGM_AVAILABILITY, PARADIGM_FIXED_SHIFT, PARADIGM_NO_SHIFT] + + # Relations belongs_to :group - has_many :shifts - has_many :user_positions has_many :users, through: :user_positions + # Validators validates :name, presence: true, length: { maximum: 75 } validates :description, length: { maximum: 1000 } - validates :group_id, presence: true + validates :group, presence: true + validates :paradigm, presence: true, inclusion: { in: SUPPORTED_PARADIGMS } end
Add paradigm validator to Position Signed-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.com>
diff --git a/app/models/resident.rb b/app/models/resident.rb index abc1234..def5678 100644 --- a/app/models/resident.rb +++ b/app/models/resident.rb @@ -3,17 +3,4 @@ belongs_to :user - def instance_variable_string_hash *variable_names - h = Hash.new - variable_names.each do |attr| - puts attr - h["#{attr}"] = instance_variable_get("@#{attr}").to_s - end - h - end - - def attributes_hash - instance_variable_string_hash self.class.accessible_attributes - end - end
Remove unused methods from Resident model
diff --git a/lib/resource_index.rb b/lib/resource_index.rb index abc1234..def5678 100644 --- a/lib/resource_index.rb +++ b/lib/resource_index.rb @@ -1,9 +1,9 @@+module ResourceIndex; end +RI = ResourceIndex + require 'sequel' require_relative 'resource_index/version' require_relative 'resource_index/resource' - -module ResourceIndex; end -RI = ResourceIndex module ResourceIndex class Base
Make sure RI is available first thing
diff --git a/rails-patch-json-encode.gemspec b/rails-patch-json-encode.gemspec index abc1234..def5678 100644 --- a/rails-patch-json-encode.gemspec +++ b/rails-patch-json-encode.gemspec @@ -6,11 +6,11 @@ Gem::Specification.new do |spec| spec.name = "rails-patch-json-encode" spec.version = Rails::Patch::Json::Encode::VERSION - spec.authors = ["lulalala"] + spec.authors = ["Jason Hutchens", "lulalala"] spec.email = ["mark@goodlife.tw"] spec.description = %q{A monkey patch to speed up Rails's json generation time.} spec.summary = %q{A monkey patch to speed up Rails's json generation time.} - spec.homepage = "" + spec.homepage = "https://github.com/GoodLife/rails-patch-json-encode" spec.license = "MIT" spec.files = `git ls-files`.split($/)
Add homepage and author to gemspec
diff --git a/lib/shoulda/context.rb b/lib/shoulda/context.rb index abc1234..def5678 100644 --- a/lib/shoulda/context.rb +++ b/lib/shoulda/context.rb @@ -1,11 +1,11 @@ begin - # if present, then also loads MiniTest::Spec + # if present, then also loads MiniTest::Unit::TestCase ActiveSupport::TestCase rescue end -if defined?([ActiveSupport::TestCase, MiniTest::Spec]) && (ActiveSupport::TestCase.ancestors.include?(MiniTest::Spec)) - base_test_case = MiniTest::Spec +if defined?([ActiveSupport::TestCase, MiniTest::Unit::TestCase]) && (ActiveSupport::TestCase.ancestors.include?(MiniTest::Unit::TestCase)) + base_test_case = MiniTest::Unit::TestCase else if !defined?(Test::Unit::TestCase) require 'test/unit/testcase'
Fix Rails 4 support for rc1: ActiveSupport::TestCase now inherits from MiniTest::Unit::TestCase instead of MiniTest::Spec. Please see: https://github.com/rails/rails/commit/eb4930e3c724cf71d6ce5bb2aec4af82b2025b03
diff --git a/lib/axiom/types/version.rb b/lib/axiom/types/version.rb index abc1234..def5678 100644 --- a/lib/axiom/types/version.rb +++ b/lib/axiom/types/version.rb @@ -3,7 +3,7 @@ module Axiom module Types - # Unreleased gem version + # Gem version VERSION = '0.0.1'.freeze end # module Types
Update comment to be applicable to released and unreleased gems
diff --git a/spec/client_spec.rb b/spec/client_spec.rb index abc1234..def5678 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -28,10 +28,10 @@ describe 'getLogs' do it 'returns array from id' do - test_client = Ephemeral::Client.new - response = test_client.build("ruby:2.1", "https://github.com/skierkowski/hello-middleman", "middleman") - logs = test_client.getLogs(response['id']) - expect(logs).to be_an_instance_of(Array) + # test_client = Ephemeral::Client.new + # response = test_client.build("ruby:2.1", "https://github.com/skierkowski/hello-middleman", "middleman") + # logs = test_client.getLogs(response['id']) + # expect(logs).to be_an_instance_of(Array) end end end
Comment out test until API is ready
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,7 +8,11 @@ require File.expand_path("../../spec/dummy/config/environment.rb", __FILE__) ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../spec/dummy/db/migrate", __FILE__)] + # require "rails/test_help" +if defined?(ActiveRecord::Base) + ActiveRecord::Migration.maintain_test_schema! +end require 'rspec/its'
Fix setting up test DB
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@+# vim:ai:fdm=marker require 'rubygems' require 'bundler' @@ -9,16 +10,18 @@ ENV["RACK_ENV"] ||= 'test' module RSpecMixin + # {{{ include Rack::Test::Methods def app() Sinatra::Application end def session last_request.env['rack.session'] end + # }}} end module NetHttpStubs - def stub_github_access_token_endpoint! + def stub_github_access_token_endpoint! # {{{ stub_request(:post, 'https://github.com/login/oauth/access_token'). with( client_id: app.settings.client_id, @@ -26,9 +29,9 @@ code: code ). to_return(status: 200, body: { access_token: access_token }.to_json) - end + end # }}} - def stub_github_fetch!(url, client:, &return_value) + def stub_github_fetch!(url, client:, &return_value) # {{{ return_value ||= ->() { '' } stub_request(:get, url). with( @@ -42,7 +45,7 @@ } ). to_return(status: 200, body: return_value) - end + end # }}} end RSpec.configure do |config|
Add Vim modeline and fold markers
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,3 +2,27 @@ require_relative 'spec_helper_common' require_relative 'spec_helper_pundit' + +def klass_name + described_class.name.underscore +end + +def subject_class + klass_name.to_sym +end + +def subject_class_factory + klass_name.split('/').last.to_sym +end + +def factory + Factory.build(subject_class_factory) +end + +def factory_stubbed + Factory.build_stubbed(subject_class_factory) +end + +def factory_create + Factory.create(subject_class_factory) +end
Add support for new specs
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -11,6 +11,10 @@ end end +# Temporary fix for missing require. See +# https://github.com/rails/rails/pull/28835 +require 'active_support/rescuable' + require 'premailer/rails' require 'support/stubs/action_mailer'
Add temporary fix for rails bug Action Mailer no longer works in isolation due to a missing require. See https://github.com/rails/rails/pull/28835 for more information.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,12 @@ require 'pry' -require File.join(File.dirname(__FILE__), '/../lib/file_convert') +require File.expand_path('../../lib/file_convert', __FILE__) + +RSpec.configure do |config| + config.mock_with :rspec do |mock_config| + mock_config.verify_doubled_constant_names = true + mock_config.syntax = [:expect] + end +end def configure_with_mock FileConvert.configure do |config|
Add some strictness for conventions' sake
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,9 @@ require "rspec" require "rack" -require_relative "../lib/geo_redirect.rb" +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) +$LOAD_PATH.unshift(File.dirname(__FILE__)) +require "geo_redirect" require "support" # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
Modify load path instead of using require_relative
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,8 +9,6 @@ require 'rom-sql' require 'rom/sql/spec/support' - -require 'rom/adapter/mongo' include ROM
Remove mongo adapter (it was moved to rom-mongo project)
diff --git a/lib/metacon/loaders/rvm.rb b/lib/metacon/loaders/rvm.rb index abc1234..def5678 100644 --- a/lib/metacon/loaders/rvm.rb +++ b/lib/metacon/loaders/rvm.rb @@ -1,6 +1,7 @@ module MetaCon module Loaders class RVM + require 'metacon/loaders/helpers' include MetaCon::Loaders::Helpers include MetaCon::CLIHelpers def self.ensure(dep, state, proj, v=true)
Make sure and require the needed helpers
diff --git a/lib/spreedly/connection.rb b/lib/spreedly/connection.rb index abc1234..def5678 100644 --- a/lib/spreedly/connection.rb +++ b/lib/spreedly/connection.rb @@ -28,8 +28,8 @@ private def http http = Net::HTTP.new(endpoint.host, endpoint.port) - http.open_timeout = 70 - http.read_timeout = 70 + http.open_timeout = 64 + http.read_timeout = 64 http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER http.ca_file = File.dirname(__FILE__) + '/../certs/cacert.pem'
Make the inner timeout shorter than the outer
diff --git a/lib/tasks/marty_tasks.rake b/lib/tasks/marty_tasks.rake index abc1234..def5678 100644 --- a/lib/tasks/marty_tasks.rake +++ b/lib/tasks/marty_tasks.rake @@ -8,4 +8,19 @@ puts "Error: ", error end end + + desc 'remove all loaded scripts from the database' + task delete_scripts: :environment do + Marty::Script.delete_scripts + end + + desc 'load scripts from the LOAD_DIR directory' + task load_scripts: :environment do + Mcfly.whodunnit = + Marty::User.find_by_login(Rails.configuration.marty.system_account) + raise 'must have system user account seeded' unless Mcfly.whodunnit + load_dir = ENV['LOAD_DIR'] + raise 'must provide LOAD_DIR= option' unless load_dir + Marty::Script.load_scripts(load_dir) + end end
Bring over script load/delete rake tasks from Gemini
diff --git a/tar.gemspec b/tar.gemspec index abc1234..def5678 100644 --- a/tar.gemspec +++ b/tar.gemspec @@ -26,6 +26,6 @@ spec.add_development_dependency "minitest", "~> 5.13" spec.add_development_dependency "pry", "~> 0.12" spec.add_development_dependency "rake", "~> 13.0" - spec.add_development_dependency "rubocop", "~> 0.76.0" + spec.add_development_dependency "rubocop", "~> 0.77.0" spec.add_development_dependency "simplecov", "~> 0.17" end
Update rubocop requirement from ~> 0.76.0 to ~> 0.77.0 Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.76.0...v0.77.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/spec/lib/tumblfetch/cli_spec.rb b/spec/lib/tumblfetch/cli_spec.rb index abc1234..def5678 100644 --- a/spec/lib/tumblfetch/cli_spec.rb +++ b/spec/lib/tumblfetch/cli_spec.rb @@ -32,7 +32,7 @@ context 'when .tumblfetch already exist' do it 'should print warning message' do - File.open('.tumblfetch', 'w').close + File.stub(:exist?).and_return(true) expect(output).to include Tumblfetch::CLI::SETTINGS_EXIST_MSG end end
Use stub instead of File.open. Don't create needless file.
diff --git a/view_data.rb b/view_data.rb index abc1234..def5678 100644 --- a/view_data.rb +++ b/view_data.rb @@ -25,5 +25,5 @@ puts "average sentence length #{l.inject(:+) / 100.0}" -lexicon_density = hash.map {|key,internal| internal.keys.count * 1.0 / hash.keys.count}.inject(:+) / hash.keys.count +lexicon_density = hash.map {|key,internal| internal.keys.count * 1.0 / hash.keys.count}.inject(:+) puts "lexicon density #{lexicon_density}"
Make view data use a normalized to lexicon count density. Signed-off-by: Sam Phippen <e5a09176608998a68778e11d5021c871e8fae93c@googlemail.com>
diff --git a/test/models/message_test.rb b/test/models/message_test.rb index abc1234..def5678 100644 --- a/test/models/message_test.rb +++ b/test/models/message_test.rb @@ -2,7 +2,7 @@ require 'test_helper' class MessageTest < ActiveSupport::TestCase - test 'should mailboxer messages model work' do + test 'mailboxer messages are sent' do sender = FactoryGirl.create(:user) receiver = FactoryGirl.create(:user) receipt = sender.send_message(receiver, 'body', 'subject')
Reword test to drop should style
diff --git a/PJLinkCocoa.podspec b/PJLinkCocoa.podspec index abc1234..def5678 100644 --- a/PJLinkCocoa.podspec +++ b/PJLinkCocoa.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = 'PJLinkCocoa' - s.version = '0.9.4' + s.version = '0.9.5' s.license = 'MIT' s.summary = 'A Cocoa Library for communicating with projectors and other devices that implement the PJLink protocol.' s.homepage = 'https://github.com/ehyche/pjlink-cocoa' s.author = { "Eric Hyche" => "ehyche@gmail.com" } - s.source = { :git => "https://github.com/ehyche/pjlink-cocoa.git", :tag => '0.9.4' } + s.source = { :git => "https://github.com/ehyche/pjlink-cocoa.git", :tag => '0.9.5' } s.source_files = 'PJLinkCocoa' s.requires_arc = true s.platform = :ios, '5.0'
Update podspec file to 0.9.5
diff --git a/server/test/test_case.rb b/server/test/test_case.rb index abc1234..def5678 100644 --- a/server/test/test_case.rb +++ b/server/test/test_case.rb @@ -25,6 +25,7 @@ "name" => "New Name", "locality" => "New Locality", "distance" => 123, + "elevation_gain" => 1234, "elevation_max" => 1234, "location" => { "latitude" => 12,
Fix test errors which didn't include elevation_gain.
diff --git a/test/test_side_bar.rb b/test/test_side_bar.rb index abc1234..def5678 100644 --- a/test/test_side_bar.rb +++ b/test/test_side_bar.rb @@ -8,5 +8,22 @@ write_test_file g, 'side_bar.png' end + def test_bar_spacing + g = setup_basic_graph(Gruff::SideBar, 800) + g.bar_spacing = 0 + g.title = "100% spacing between bars" + g.write("test/output/side_bar_spacing_full.png") + + g = setup_basic_graph(Gruff::SideBar, 800) + g.bar_spacing = 0.5 + g.title = "50% spacing between bars" + g.write("test/output/side_bar_spacing_half.png") + + g = setup_basic_graph(Gruff::SideBar, 800) + g.bar_spacing = 1 + g.title = "0% spacing between bars" + g.write("test/output/side_bar_spacing_none.png") + end + end
Test cases for bar_spacing on SideBars.
diff --git a/TastyTomato.podspec b/TastyTomato.podspec index abc1234..def5678 100644 --- a/TastyTomato.podspec +++ b/TastyTomato.podspec @@ -26,4 +26,5 @@ s.resources = ['TastyTomato/Images/*.{xcassets, png}'] s.public_header_files = [] s.dependency 'SignificantSpices', '~> 0.4.0' + s.dependency 'SwiftDate', '~> 4.5.0' end
Add SwiftDate dependency to podspec
diff --git a/Casks/butt.rb b/Casks/butt.rb index abc1234..def5678 100644 --- a/Casks/butt.rb +++ b/Casks/butt.rb @@ -2,7 +2,7 @@ version '0.1.14' sha256 'f12eac6ad2af8bc38717cccde3f7f139d426b6d098ef94f7dcd6ae7d1225f6ad' - url "http://downloads.sourceforge.net/sourceforge/butt/butt-#{version}/butt-#{version}.dmg" + url "http://downloads.sourceforge.net/sourceforge/butt/butt-#{version}.dmg" name 'Broadcast Using This Tool' homepage 'http://butt.sourceforge.net/' license :gpl
Fix download url in Butt.app Cask.
diff --git a/lib/active_mocker/mock/exceptions.rb b/lib/active_mocker/mock/exceptions.rb index abc1234..def5678 100644 --- a/lib/active_mocker/mock/exceptions.rb +++ b/lib/active_mocker/mock/exceptions.rb @@ -12,7 +12,17 @@ class FileTypeMismatchError < StandardError end - class RejectedParams < Exception + # Raised when unknown attributes are supplied via mass assignment. + class UnknownAttributeError < NoMethodError + + attr_reader :record, :attribute + + def initialize(record, attribute) + @record = record + @attribute = attribute.to_s + super("unknown attribute: #{attribute}") + end + end class Unimplemented < Exception @@ -21,5 +31,8 @@ class IdNotNumber < Exception end + class Error < Exception + end + end end
Replace RejectedParams and use UnknownAttributesError to follow active record
diff --git a/spec/defines/collectd_plugin_spec.rb b/spec/defines/collectd_plugin_spec.rb index abc1234..def5678 100644 --- a/spec/defines/collectd_plugin_spec.rb +++ b/spec/defines/collectd_plugin_spec.rb @@ -0,0 +1,34 @@+require 'spec_helper' + +describe 'collectd::plugin', :type => :define do + + context 'loading a plugin on collectd <= 4.9.4' do + let(:title) { 'test' } + let :facts do + { + :collectd_version => '5.3', + :osfamily => 'Debian', + } + end + + it 'Will create /etc/collectd/conf.d/10-test.conf with the LoadPlugin syntax with brackets' do + should contain_file('test.load').with_content(/<LoadPlugin/) + end + end + + + context 'loading a plugin on collectd => 4.9.3' do + let(:title) { 'test' } + let :facts do + { + :collectd_version => '4.9.3', + :osfamily => 'Debian', + } + end + + it 'Will create /etc/collectd/conf.d/10-test.conf with the LoadPlugin syntax without brackets' do + should contain_file('test.load').without_content(/<LoadPlugin/) + end + end + +end
Add rspec test to ensure the bracket syntax is using when available
diff --git a/UIAlertController+Show.podspec b/UIAlertController+Show.podspec index abc1234..def5678 100644 --- a/UIAlertController+Show.podspec +++ b/UIAlertController+Show.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "UIAlertController+Show" - s.version = "1.0.0" + s.version = "0.1.0" s.summary = "Show UIAlertControllers from anywhere." s.description = <<-DESC
Set initial version number to 0.1.0.
diff --git a/seam-mongodb.gemspec b/seam-mongodb.gemspec index abc1234..def5678 100644 --- a/seam-mongodb.gemspec +++ b/seam-mongodb.gemspec @@ -18,8 +18,6 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency "json" - spec.add_runtime_dependency "i18n" spec.add_runtime_dependency "seam" spec.add_development_dependency 'subtle' spec.add_development_dependency "bundler", "~> 1.3"
Drop the dependencies down a bit.
diff --git a/lib/fog/aws/models/rds/subnet_group.rb b/lib/fog/aws/models/rds/subnet_group.rb index abc1234..def5678 100644 --- a/lib/fog/aws/models/rds/subnet_group.rb +++ b/lib/fog/aws/models/rds/subnet_group.rb @@ -12,8 +12,11 @@ attribute :vpc_id, :aliases => 'VpcId' attribute :subnet_ids, :aliases => 'Subnets' - # TODO: ready? - # + def ready? + requires :status + status == 'Complete' + end + def save requires :description, :id, :subnet_ids service.create_db_subnet_group(id, subnet_ids, description)
[aws|rds] Implement `ready?` for subnet group.
diff --git a/lib/infoblox/resource/host_ipv4addr.rb b/lib/infoblox/resource/host_ipv4addr.rb index abc1234..def5678 100644 --- a/lib/infoblox/resource/host_ipv4addr.rb +++ b/lib/infoblox/resource/host_ipv4addr.rb @@ -1,6 +1,6 @@ module Infoblox class HostIpv4addr < Resource - remote_attr_accessor :network, :host, :ipv4addr, :configure_for_dhcp + remote_attr_accessor :network, :host, :ipv4addr, :configure_for_dhcp, :mac wapi_object "record:host_ipv4addr" @@ -8,4 +8,4 @@ raise "Not supported" end end -end+end
Add mac address attr to ipv4addr resource
diff --git a/lib/rubocop/cop/style/case_equality.rb b/lib/rubocop/cop/style/case_equality.rb index abc1234..def5678 100644 --- a/lib/rubocop/cop/style/case_equality.rb +++ b/lib/rubocop/cop/style/case_equality.rb @@ -5,7 +5,7 @@ module Style # This cop checks for uses of the case equality operator(===). class CaseEquality < Cop - MSG = 'Avoid the use of the case equality operator(===).' + MSG = 'Avoid the use of the case equality operator `===`.' def on_send(node) _receiver, method_name, *_args = *node
Improve CaseEquality's message a bit
diff --git a/lib/transition/google/tsv_generator.rb b/lib/transition/google/tsv_generator.rb index abc1234..def5678 100644 --- a/lib/transition/google/tsv_generator.rb +++ b/lib/transition/google/tsv_generator.rb @@ -1,3 +1,7 @@+# From the rake task, for some reason, app/models/hit.rb is not loaded, +# despite the => :environment dependency. This is a workaround. +# If you can remove it and make rake ingest:ga work, I owe you gelato. +# (substitute delicacy of your choice for the lactose-intolerant) require_relative '../../../app/models/hit' module Transition
Document why weird require_relative exists
diff --git a/Tunits.podspec b/Tunits.podspec index abc1234..def5678 100644 --- a/Tunits.podspec +++ b/Tunits.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Tunits" - s.version = "0.1.1" + s.version = "0.1.2" s.summary = "A date modification library" s.description = <<-DESC Tunits is a simple library of convenience functions for creating groups of NSDates
Update to version 0.1.2 for tagging
diff --git a/Casks/iterm2-beta.rb b/Casks/iterm2-beta.rb index abc1234..def5678 100644 --- a/Casks/iterm2-beta.rb +++ b/Casks/iterm2-beta.rb @@ -1,5 +1,5 @@ class Iterm2Beta < Cask - url 'http://www.iterm2.com/downloads/beta/iTerm2-1_0_0_20130811.zip' + url 'http://www.iterm2.com/downloads/beta/iTerm2-1_0_0_20131108.zip' homepage 'http://www.iterm2.com/' version 'latest' no_checksum
Update iTerm2 version to 20131108
diff --git a/Casks/handbrakecli-nightly.rb b/Casks/handbrakecli-nightly.rb index abc1234..def5678 100644 --- a/Casks/handbrakecli-nightly.rb +++ b/Casks/handbrakecli-nightly.rb @@ -1,6 +1,6 @@ cask :v1 => 'handbrakecli-nightly' do - version '6714svn' - sha256 '57eb6aa19d84e281e8d696bf1f3ecb2b84b3d6d13144c133f94b00530161968a' + version '6752svn' + sha256 'a9b2d95e47a72b5cd918bd3b2d8f2064cec1b5f8b96b441dabc60af63aefa4d2' url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg" homepage 'http://handbrake.fr'
Update HandbrakeCLI Nightly to v6752svn HandBrakeCLI Nightly v6752svn built 2015-01-15.
diff --git a/lib/tasks/remove_duplicate_virtual_users.rake b/lib/tasks/remove_duplicate_virtual_users.rake index abc1234..def5678 100644 --- a/lib/tasks/remove_duplicate_virtual_users.rake +++ b/lib/tasks/remove_duplicate_virtual_users.rake @@ -3,7 +3,7 @@ task :remove => :environment do puts 'Removing duplicate users' - Post.all.each do |post| + Post.all.find_each do |post| next if post.receivers.empty? post.receivers.each do |receiver| @@ -18,9 +18,9 @@ new_user = user unless user.virtual_user end - new_user = similar_users.first if new_user.nil? + new_user = similar_users.first unless new_user.present? - similar_user_ids = similar_users.map { |user| user.id } + similar_user_ids = similar_users.map(&:id) post_receivers = PostReceiver.where('user_id IN (?)', similar_user_ids)
Use batches to loop over every post, small refactoring
diff --git a/ruby-puppetdb.gemspec b/ruby-puppetdb.gemspec index abc1234..def5678 100644 --- a/ruby-puppetdb.gemspec +++ b/ruby-puppetdb.gemspec @@ -21,4 +21,6 @@ s.add_development_dependency 'rake' s.add_development_dependency 'puppetlabs_spec_helper' s.add_development_dependency 'puppet' + s.add_development_dependency 'racc' + s.add_development_dependency 'rex' end
Add racc and rex as devel dependencies
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -26,9 +26,22 @@ @game = WebGameEngine.new({ttt_board: session[:board], rules: rules, comp_player: comp_player}) @player_input = params[:grid_position] - session[:board] = @game.ttt_board.move(@player_input) + if session[:board].valid_slots.include?(@player_input.to_i) + session[:board] = @game.ttt_board.move(@player_input) + end - erb :game + # if @game.rules.game_over?(session[:board]) + # session[:result] = @game.rules.winner(session[:board], session[:board].turn) + # redirect '/game/result' + # else + erb :game + # end + end + + get '/game/result' do + p session + # binding.pry + erb :result end
Add logic to check to see if input is valid
diff --git a/lib/ami_spec/server_spec.rb b/lib/ami_spec/server_spec.rb index abc1234..def5678 100644 --- a/lib/ami_spec/server_spec.rb +++ b/lib/ami_spec/server_spec.rb @@ -30,6 +30,10 @@ RSpec::Core::Runner.disable_autorun! result = RSpec::Core::Runner.run(Dir.glob("#{@spec}/#{@role}/*_spec.rb")) + # We can't use Rspec.clear_examples here because it also clears the shared_examples. + # As shared examples are loaded in via the spec_helper, we cannot reload them. + RSpec.world.example_groups.clear + result.zero? end end
Clear rspec examples between runs So examples from previous runs are not executed in future runs
diff --git a/LunchOverflow/app/controllers/posts_controller.rb b/LunchOverflow/app/controllers/posts_controller.rb index abc1234..def5678 100644 --- a/LunchOverflow/app/controllers/posts_controller.rb +++ b/LunchOverflow/app/controllers/posts_controller.rb @@ -35,6 +35,12 @@ end end + def destroy + post = Post.find(params[:id]) + post.destroy + redirect_to root_path + end + private def post_params
Add destroy method for posts controller
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -9,7 +9,7 @@ # set :output, './log/cron.log' -%w[6:05 9:05 13:05 18:05 23:05 3:05].each do |time| +%w[6:05 9:05 13:05 18:05 23:05].each do |time| every :day, at: time do rake 'archive' end
Remove unwanted diary entry in the afternoon
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -1,9 +1,9 @@ set :output, { error: 'log/cron.error.log', standard: 'log/cron.log'} every 1.hour do - rake "tariff:download" + rake "tariff:sync:download" end every 1.day, at: '5am' do - rake "tariff:sync" + rake "tariff:sync:apply" end
Fix task names, add sync namespace.
diff --git a/lib/github_cli/formatter.rb b/lib/github_cli/formatter.rb index abc1234..def5678 100644 --- a/lib/github_cli/formatter.rb +++ b/lib/github_cli/formatter.rb @@ -5,10 +5,11 @@ # It delegates to other objects like Formatter::Table # to perform actual rendering. class Formatter - attr_reader :response, :format + attr_reader :response, :format, :message def initialize(response, options={}) @response = response + @message = options[:message] @format = options[:format] end @@ -16,14 +17,17 @@ render_status Terminal.paged_output determine_output_formatter + render_message end def determine_output_formatter case format.to_s when 'table', /table:v.*/, /table:h.*/ - formatter = Formatters::Table.new(response.body, - :transform => format.to_s.split(':').last) - formatter.format + if response.body && !response.body.empty? + formatter = Formatters::Table.new(response.body, + :transform => format.to_s.split(':').last) + formatter.format + end when 'csv' formatter = Formatters::CSV.new(response) formatter.format @@ -42,5 +46,11 @@ end end + def render_message + if message + Terminal.line message + end + end + end # Formatter end # GithubCLi
Fix error on empty response bodies, add custom message.
diff --git a/lib/looks/command/images.rb b/lib/looks/command/images.rb index abc1234..def5678 100644 --- a/lib/looks/command/images.rb +++ b/lib/looks/command/images.rb @@ -14,7 +14,7 @@ def configure(opts) super - opts.on('-v', '--verbose', "Be verbose") do |address| + opts.on('-v', '--verbose', "Be verbose") do @verbose = true end end
Remove misnamed block parameter in 'Images'
diff --git a/abstractize.gemspec b/abstractize.gemspec index abc1234..def5678 100644 --- a/abstractize.gemspec +++ b/abstractize.gemspec @@ -7,9 +7,9 @@ spec.name = 'abstractize' spec.version = Abstractize::VERSION spec.authors = ['Joakim Reinert'] - spec.email = ['reinert@meso.net'] + spec.email = ['mail@jreinert.com'] - spec.metadata['allowed_push_host'] = 'NONE' if spec.respond_to?(:metadata) + spec.metadata['allowed_push_host'] = 'https://rubygems.org' if spec.respond_to?(:metadata) spec.summary = 'Simple mixin to provide abstract class functionality' spec.homepage = 'https://github.com/jreinert/abstractize'
Set correct mail address and push_host in gemspec
diff --git a/lib/responders.rb b/lib/responders.rb index abc1234..def5678 100644 --- a/lib/responders.rb +++ b/lib/responders.rb @@ -8,17 +8,16 @@ ActionController::Base.extend Responders::ControllerMethod class Railtie < ::Rails::Railtie - railtie_name :responders - + config.responders = ActiveSupport::OrderedOptions.new config.generators.scaffold_controller = :responders_controller # Add load paths straight to I18n, so engines and application can overwrite it. require 'active_support/i18n' I18n.load_path << File.expand_path('../responders/locales/en.yml', __FILE__) - initializer "responders.flash_responder" do - if config.responders.flash_keys - Responders::FlashResponder.flash_keys = config.responders.flash_keys + initializer "responders.flash_responder" do |app| + if app.config.responders.flash_keys + Responders::FlashResponder.flash_keys = app.config.responders.flash_keys end end end
Make it compatible with master.
diff --git a/lib/sonia/widgets/icinga.rb b/lib/sonia/widgets/icinga.rb index abc1234..def5678 100644 --- a/lib/sonia/widgets/icinga.rb +++ b/lib/sonia/widgets/icinga.rb @@ -7,7 +7,7 @@ def initial_push fetch_data - EventMachine::add_periodic_timer(61) { fetch_data } + EventMachine::add_periodic_timer(60) { fetch_data } end def format_status(stat) @@ -18,11 +18,11 @@ end private - + def headers { :head => { 'Authorization' => [config[:username], config[:password]] } } end - + def fetch_data http = EventMachine::HttpRequest.new(config[:url]).get(headers) http.callback { @@ -32,7 +32,7 @@ push statuses } end - + end # class end # module -end # module+end # module
Set timer to 60 seconds
diff --git a/lib/soprano/smart_assets.rb b/lib/soprano/smart_assets.rb index abc1234..def5678 100644 --- a/lib/soprano/smart_assets.rb +++ b/lib/soprano/smart_assets.rb @@ -0,0 +1,15 @@+Capistrano::Configuration.instance(:must_exist).load do + # This skips assets precompilation if nothing changed + namespace :deploy do + namespace :assets do + task :precompile, :roles => :web, :except => { :no_release => true } do + from = source.next_revision(current_revision) + if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ lib/assets | wc -l").to_i > 0 + run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile} + else + logger.info "Skipping asset pre-compilation because there were no asset changes" + end + end + end + end +end
Add recipe for smart assets. Assets won't be recompiled if they were not changed.
diff --git a/Casks/omnioutliner.rb b/Casks/omnioutliner.rb index abc1234..def5678 100644 --- a/Casks/omnioutliner.rb +++ b/Casks/omnioutliner.rb @@ -1,11 +1,11 @@ cask :v1 => 'omnioutliner' do - version :latest - sha256 :no_check + version '4.2.2' + sha256 '22b30eb4964caaa7be8e6a279ded2eae78f6f2e8db40b812f0b17e27597c9e85' - url 'https://www.omnigroup.com/download/latest/omnioutliner' + url "http://downloads2.omnigroup.com/software/MacOSX/10.10/OmniOutliner-#{version}.dmg" name 'OmniOutliner' homepage 'http://www.omnigroup.com/omnioutliner/' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :commercial app 'OmniOutliner.app' end
Update OmniOutliner to user version instead of latest This commit updates the version to be 4.2.2 instead of the :latest identifier, specifies a SHA and updates the license to commercial
diff --git a/lib/tinami/api.rb b/lib/tinami/api.rb index abc1234..def5678 100644 --- a/lib/tinami/api.rb +++ b/lib/tinami/api.rb @@ -9,12 +9,12 @@ end end - def get(path, params) + def get(path, params = {}) response = RestClient.get(endpoint + path, header.merge(params: params)) parse_response(response) end - def post(path, params) + def post(path, params = {}) response = RestClient.post(endpoint + path, params, header) parse_response(response) end
Change request method params arguments to optional.
diff --git a/lib/tasks/peoplefinder.rake b/lib/tasks/peoplefinder.rake index abc1234..def5678 100644 --- a/lib/tasks/peoplefinder.rake +++ b/lib/tasks/peoplefinder.rake @@ -29,16 +29,9 @@ if STDIN.gets.chomp == 'Y' recipients.each do |recipient| - - if EmailAddress.new(recipient.email).valid_address? - ReminderMailer.inadequate_profile(recipient).deliver - puts "Email sent to: #{ recipient.email }" - - else - puts "Email *not* sent to: #{ recipient.email }" - end + ReminderMailer.inadequate_profile(recipient).deliver_now + puts "Email sent to: #{ recipient.email }" end - end end end
Remove check of person's email validity in reminder email task Email validity is checked when person is created or updated. All invalid email addresses in legacy production data have been fixed. So email is always valid and does not need to be checked here.
diff --git a/lib/uniqueness/generator.rb b/lib/uniqueness/generator.rb index abc1234..def5678 100644 --- a/lib/uniqueness/generator.rb +++ b/lib/uniqueness/generator.rb @@ -1,3 +1,5 @@+require 'securerandom' + module Uniqueness class << self def generate(opts = {}) @@ -7,7 +9,7 @@ dict -= [*(:A..:Z)].map(&:to_s) unless options[:case_sensitive] dict -= uniqueness_ambigious_dictionary if options[:type].to_sym == :human dict = uniqueness_numbers_dictionary if options[:type].to_sym == :numbers - code = Array.new(options[:length]).map { dict[rand(dict.length)] }.join + code = Array.new(options[:length]).map { dict[SecureRandom.random_number(dict.length)] }.join "#{options[:prefix]}#{code}#{options[:suffix]}" end
Use SecureRandom instead of rand
diff --git a/lib/veritas/algebra/join.rb b/lib/veritas/algebra/join.rb index abc1234..def5678 100644 --- a/lib/veritas/algebra/join.rb +++ b/lib/veritas/algebra/join.rb @@ -33,7 +33,7 @@ index = {} right.each do |tuple| - (index[join_tuple(tuple)] ||= []) << remainder_tuple(tuple) + (index[join_tuple(tuple)] ||= Set[]) << remainder_tuple(tuple) end index
Use a Set for the Join index, to prevent duplicate tuples
diff --git a/libraries/util.rb b/libraries/util.rb index abc1234..def5678 100644 --- a/libraries/util.rb +++ b/libraries/util.rb @@ -13,13 +13,13 @@ def render_properties_file(config = {}) config.sort_by { |k, _v| k }.collect do |k, v| - "#{k.gsub('_', '-')}=#{v}" + "#{k.tr('_', '-')}=#{v}" end.join("\n") end def render_s3_credentials(config) config.sort_by { |k, _v| k }.collect do |name, val| - "com.netflix.exhibitor.s3.#{name.gsub('_', '-')}=#{val}" + "com.netflix.exhibitor.s3.#{name.tr('_', '-')}=#{val}" end.join("\n") end
Rubocop: Use tr instead of gsub for a single char A total micro-optimization, but may as well while Rubocop is complaining
diff --git a/lib/knapsack_pro/crypto/branch_encryptor.rb b/lib/knapsack_pro/crypto/branch_encryptor.rb index abc1234..def5678 100644 --- a/lib/knapsack_pro/crypto/branch_encryptor.rb +++ b/lib/knapsack_pro/crypto/branch_encryptor.rb @@ -1,7 +1,21 @@ module KnapsackPro module Crypto class BranchEncryptor - NON_ENCRYPTABLE_BRANCHES = %w(develop development dev master staging) + NON_ENCRYPTABLE_BRANCHES = [ + 'master', + 'main', + 'develop', + 'development', + 'dev', + 'staging', + # GitHub Actions has branch names starting with refs/heads/ + 'refs/heads/master', + 'refs/heads/main', + 'refs/heads/develop', + 'refs/heads/development', + 'refs/heads/dev', + 'refs/heads/staging', + ] def self.call(branch) if KnapsackPro::Config::Env.branch_encrypted?
Update list of non encryptable branches
diff --git a/lib/omniauth/strategies/wordpress_hosted.rb b/lib/omniauth/strategies/wordpress_hosted.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/wordpress_hosted.rb +++ b/lib/omniauth/strategies/wordpress_hosted.rb @@ -32,8 +32,8 @@ end def raw_info - puts access_token - @raw_info ||= access_token.get("/me").parsed + puts access_token.token + @raw_info ||= access_token.get("/me", :params => { 'access_token' => access_token.token }).parsed end end end
Update endpoints used by WP OAuth Server 3.1.3
diff --git a/lib/omniauth/strategies/wordpress_hosted.rb b/lib/omniauth/strategies/wordpress_hosted.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/wordpress_hosted.rb +++ b/lib/omniauth/strategies/wordpress_hosted.rb @@ -32,7 +32,8 @@ end def raw_info - @raw_info ||= access_token.get("/oauth/me").parsed + puts access_token + @raw_info ||= access_token.get("/me").parsed end end end
Update endpoints used by WP OAuth Server 3.1.3
diff --git a/app/controllers/asciicasts_controller.rb b/app/controllers/asciicasts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/asciicasts_controller.rb +++ b/app/controllers/asciicasts_controller.rb @@ -17,7 +17,7 @@ def show @asciicast = AsciicastDecorator.find(params[:id]) @title = @asciicast.smart_title - respond_with @asciicast + respond_with @asciicast.model end def edit
Fix fetching cast data via ajax
diff --git a/lib/tasks/taxonomy/find_tagged_content.rake b/lib/tasks/taxonomy/find_tagged_content.rake index abc1234..def5678 100644 --- a/lib/tasks/taxonomy/find_tagged_content.rake +++ b/lib/tasks/taxonomy/find_tagged_content.rake @@ -0,0 +1,22 @@+namespace :taxonomy do + desc "Find content tagged with the given document type" + task :find_tagged_content_with_document_type, [:document_type] => :environment do |_t, args| + output = Set.new + + taxons = RemoteTaxons.new.search(per_page: 10_000).taxons + + taxons.each do |taxon| + linked_items = Services.publishing_api.get_linked_items( + taxon.content_id, + link_type: "taxons", + fields: %w(base_path document_type) + ).to_a.select { |item| item.fetch("document_type") == args[:document_type] } + + taxon_content = linked_items.map { |item| item.fetch("base_path") } + + output.merge(taxon_content) + end + + puts output.to_a + end +end
Add rake task for finding taxon-tagged content by document type This will be used to check our assumptions about whether content with a given document type is really 'guidance' and should appear on taxon pages.
diff --git a/ColorPickerRow.podspec b/ColorPickerRow.podspec index abc1234..def5678 100644 --- a/ColorPickerRow.podspec +++ b/ColorPickerRow.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'ColorPickerRow' - s.version = '1.2.1' + s.version = '1.3.1' s.license = 'MIT' s.summary = 'A color picker row for use with the Eureka form library' s.homepage = 'https://github.com/EurekaCommunity/ColorPickerRow' @@ -8,10 +8,11 @@ s.ios.deployment_target = '8.0' s.ios.frameworks = 'UIKit', 'Foundation' s.source_files = 'ColorPicker/**/*.swift' + s.swift_version = '4.2' s.requires_arc = true s.author = "Mark Alldritt" s.dependencies = { 'Eureka' => '>= 3.0.0', - 'UIColor_Hex_Swift' => '>= 3.0.0' + 'UIColor_Hex_Swift' => '>= 3.0.0' } -end+end
Make sure the right version number is reporting to CocoaPods
diff --git a/spec/helpers/regions_helper_spec.rb b/spec/helpers/regions_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/regions_helper_spec.rb +++ b/spec/helpers/regions_helper_spec.rb @@ -0,0 +1,16 @@+require 'rails_helper' + +describe Admin::RegionsHelper do + + describe "#render_region" do + + before :each do + allow(controller).to receive(:controller_name).and_return("page") + allow(controller).to receive(:template_name).and_return("index") + end + + it "outputs html_safe string" do + expect(helper.render_region :foo).to be_html_safe + end + end +end
Test that render_region returns html_safe string
diff --git a/tasks/release_to_patch.rake b/tasks/release_to_patch.rake index abc1234..def5678 100644 --- a/tasks/release_to_patch.rake +++ b/tasks/release_to_patch.rake @@ -0,0 +1,16 @@+require 'buildr/packaging/artifact' + +module Buildr + class Repositories + def release_to + unless @release_to + value = Buildr.settings.user['repositories'] && Buildr.settings.user['repositories']['release_to'] + unless value + value = Buildr.settings.build['repositories'] && Buildr.settings.build['repositories']['release_to'] + end + @release_to = Hash === value ? value.inject({}) { |hash, (key, value)| hash.update(key.to_sym=>value) } : { :url=>Array(value).first } + end + @release_to + end + end +end
Customize buildr so that release_to information is loaded from build settings if not present in user settings
diff --git a/lib/fog/scaleway/models/compute/servers.rb b/lib/fog/scaleway/models/compute/servers.rb index abc1234..def5678 100644 --- a/lib/fog/scaleway/models/compute/servers.rb +++ b/lib/fog/scaleway/models/compute/servers.rb @@ -28,7 +28,6 @@ defaults = { name: name, image: '75c28f52-6c64-40fc-bb31-f53ca9d02de9', - commercial_type: 'C2S', dynamic_ip_required: false, public_ip: public_ip }
Stop passing commercial_type when bootstrapping
diff --git a/app/models/assignment_file.rb b/app/models/assignment_file.rb index abc1234..def5678 100644 --- a/app/models/assignment_file.rb +++ b/app/models/assignment_file.rb @@ -5,7 +5,7 @@ validates_presence_of :filename validates_uniqueness_of :filename, scope: :assignment_id validates_format_of :filename, - with: /^[0-9a-zA-Z\.\-_]+$/, + with: /\A[0-9a-zA-Z\.\-_]+\z/, message: I18n.t('validation_messages.format_of_assignment_file') end
Fix security warning from Rails 4 related to regepx anchors
diff --git a/app/models/where_you_heard.rb b/app/models/where_you_heard.rb index abc1234..def5678 100644 --- a/app/models/where_you_heard.rb +++ b/app/models/where_you_heard.rb @@ -1,9 +1,5 @@ class WhereYouHeard OPTIONS = { - '19' => 'Media - Pensions Awareness Day', - '20' => 'Media - Leaving planning retirement finances to two years before retirement', - '21' => 'Money and Pensions Service Webinar on Pensions Awareness Day website', - '22' => 'Virtual 121 sessions on Pensions Awareness Day website', '1' => 'An employer', '2' => 'A Pension Provider', '3' => 'Internet search', @@ -23,6 +19,11 @@ '15' => 'Citizens Advice', '16' => 'Relative/Friend/Colleague', '18' => 'Jobcentre Plus', + '19' => 'Media - Pensions Awareness Day', + '20' => 'Media - Leaving planning retirement finances to two years before retirement', + '21' => 'Money and Pensions Service Webinar on Pensions Awareness Day website', + '22' => 'Virtual 121 sessions on Pensions Awareness Day website', + '25' => 'External (Stronger Nudge)', '17' => 'Other' }.freeze end
Update WDYH options inline with other planners
diff --git a/webapp/lib/trisano.rb b/webapp/lib/trisano.rb index abc1234..def5678 100644 --- a/webapp/lib/trisano.rb +++ b/webapp/lib/trisano.rb @@ -1,5 +1,5 @@ module Trisano - VERSION = %w(3 5 7).freeze + VERSION = %w(EDGE).freeze end require 'trisano/application'
Remove version number from edge deployment
diff --git a/terraform_inventory.gemspec b/terraform_inventory.gemspec index abc1234..def5678 100644 --- a/terraform_inventory.gemspec +++ b/terraform_inventory.gemspec @@ -24,7 +24,8 @@ spec.test_files = Dir.glob("spec/**/*") spec.require_paths = %w[lib] + + spec.add_dependency "thor" spec.add_development_dependency "bundler", "~> 1.6" - spec.add_development_dependency "thor" end
Make thor a dependency, rather than development_depdency