diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -36,4 +36,4 @@ # config.action_view.raise_on_missing_translations = true end -ENV["ELASTICSEARCH_URL"] |= "http://localhost:9200/"+ENV["ELASTICSEARCH_URL"] = "http://localhost:9200/" if ENV["ELASTICSEARCH_URL"].blank?
Fix elasticsearch connection in dev
diff --git a/fluent-plugin-graphite.gemspec b/fluent-plugin-graphite.gemspec index abc1234..def5678 100644 --- a/fluent-plugin-graphite.gemspec +++ b/fluent-plugin-graphite.gemspec @@ -17,7 +17,7 @@ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } gem.require_paths = ['lib'] - gem.add_runtime_dependency 'fluentd', '~> 0.10.17' + gem.add_runtime_dependency 'fluentd', '>= 0.10.17' gem.add_runtime_dependency 'fluent-mixin-rewrite-tag-name' gem.add_runtime_dependency 'graphite-api' gem.add_development_dependency 'rake'
Make gem installable with fluentd 0.12.x versions as well
diff --git a/lib/extensions/require_nested.rb b/lib/extensions/require_nested.rb index abc1234..def5678 100644 --- a/lib/extensions/require_nested.rb +++ b/lib/extensions/require_nested.rb @@ -6,6 +6,7 @@ filename = "#{self}::#{name}".underscore filename = name.to_s.underscore if self == Object if Rails.application.config.cache_classes + raise LoadError, "No such file to load -- #{filename}" unless ActiveSupport::Dependencies.search_for_file(filename) autoload name, filename else require_dependency filename
Raise exception if nested file will never be found It is possible to give autoload an invalid path, and that issue will never be found until the associated constant is vivified. This causes issues where people forget to remove the require_nested calls when they remove the files. Now, it's not possible to forget, because an exception will be raised as soon as the parent file is loaded.
diff --git a/lib/heroku-request-id/railtie.rb b/lib/heroku-request-id/railtie.rb index abc1234..def5678 100644 --- a/lib/heroku-request-id/railtie.rb +++ b/lib/heroku-request-id/railtie.rb @@ -1,7 +1,7 @@ module HerokuRequestId class Railtie < Rails::Railtie initializer 'heroku_request_id.add_middleware' do |app| - app.config.middleware.insert_after 'Rack::Lock', "HerokuRequestId::Middleware" + app.config.middleware.insert 0, "HerokuRequestId::Middleware" end end end
Insert the middleware absolutely first in the stack, instead of after Rack::Lock. This addresses : https://github.com/Octo-Labs/heroku-request-id/issues/1
diff --git a/lib/openid_token_proxy/config.rb b/lib/openid_token_proxy/config.rb index abc1234..def5678 100644 --- a/lib/openid_token_proxy/config.rb +++ b/lib/openid_token_proxy/config.rb @@ -18,6 +18,7 @@ end def provider_config + # TODO: Add support for refreshing provider configuration @provider_config ||= begin OpenIDConnect::Discovery::Provider::Config.discover! issuer end
Add TODO before we forget
diff --git a/lib/rom/support/class_builder.rb b/lib/rom/support/class_builder.rb index abc1234..def5678 100644 --- a/lib/rom/support/class_builder.rb +++ b/lib/rom/support/class_builder.rb @@ -1,10 +1,24 @@ module ROM + # Internal support class for generating classes + # + # @private class ClassBuilder include Options option :name, type: String, reader: true option :parent, type: Class, reader: true, parent: Object + # Generate a class based on options + # + # @example + # builder = ROM::ClasBuilder.new(name: 'MyClass') + # + # klass = builder.call + # klass.name # => "MyClass" + # + # @return [Class] + # + # @api private def call klass = Class.new(parent)
Add YARD docs to ClassBuilder support class
diff --git a/bldr.gemspec b/bldr.gemspec index abc1234..def5678 100644 --- a/bldr.gemspec +++ b/bldr.gemspec @@ -25,4 +25,5 @@ s.add_development_dependency 'sinatra', '~>1.2.6' s.add_development_dependency 'tilt', '~>1.3.2' s.add_development_dependency 'yajl-ruby' + s.add_development_dependency 'actionpack', '~> 3.0.7' end
Add actionpack 3.0.7 to development dependencies
diff --git a/lasp.gemspec b/lasp.gemspec index abc1234..def5678 100644 --- a/lasp.gemspec +++ b/lasp.gemspec @@ -13,7 +13,9 @@ spec.homepage = "https://github.com/alcesleo/lasp" spec.license = "MIT" - spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + spec.files = Dir.glob("{bin,docs,lib,spec}/**/*") + spec.files += %w(LICENSE.txt README.md CHANGELOG.md Rakefile lasp.gemspec) + spec.bindir = "bin" spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ["lib"]
Use plain Ruby to select files in gemspec
diff --git a/jekyll-asciidoc.gemspec b/jekyll-asciidoc.gemspec index abc1234..def5678 100644 --- a/jekyll-asciidoc.gemspec +++ b/jekyll-asciidoc.gemspec @@ -17,5 +17,7 @@ s.require_paths = ['lib'] s.add_runtime_dependency 'asciidoctor', '>= 0.1.4' + + s.add_development_dependency 'rake', '~> 10.0' s.add_development_dependency 'jekyll', '> 1.0.0' end
Add rake dependency to gemspec Bundler complains when running `bundle exec rake` without rake in gemspec/Gemfile.
diff --git a/lib/boxen/preflight/os.rb b/lib/boxen/preflight/os.rb index abc1234..def5678 100644 --- a/lib/boxen/preflight/os.rb +++ b/lib/boxen/preflight/os.rb @@ -1,11 +1,29 @@ require "boxen/preflight" class Boxen::Preflight::OS < Boxen::Preflight + SUPPORTED_RELEASES = %w(10.8 10.9) + def ok? - `sw_vers -productVersion`.start_with? "10.8" + osx? && supported_release? end def run - abort "You must be running OS X 10.8 (Mountain Lion)." + abort "You must be running one of the following OS X versions: #{SUPPORTED_RELEASES.join(' ')}." + end + + private + + def osx? + `uname -s` == "Darwin" + end + + def supported_release? + SUPPORTED_RELEASES.any? do |r| + current_release.starts_with? r + end + end + + def current_release + @current_release ||= `sw_vers -productVersion` end end
Add 10.9 to list of supported OS X releases
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 @@ -21,13 +21,4 @@ logger end - # Returns a Class object, which is some subclass of BillingClass - # based on the +fog_provider+, +fog_service+, and +fog_collection+ - def self.get_billing_policy_class(fog_provider, fog_service, fog_collection) - policy_class_name = "#{fog_collection.capitalize}BillingPolicy" - provider_module = CloudCostTracker::Billing::const_get fog_provider - service_module = provider_module.send(:const_get, fog_service) - policy_exists = service_module.send(:const_defined?, policy_class_name) - policy_exists ? service_module.send(:const_get, policy_class_name) : nil - end end
Remove unneeded CloudCostTracker static class method
diff --git a/db/migrate/20110705003445_counter_cache_on_post_likes.rb b/db/migrate/20110705003445_counter_cache_on_post_likes.rb index abc1234..def5678 100644 --- a/db/migrate/20110705003445_counter_cache_on_post_likes.rb +++ b/db/migrate/20110705003445_counter_cache_on_post_likes.rb @@ -1,6 +1,11 @@ class CounterCacheOnPostLikes < ActiveRecord::Migration + class Post < ActiveRecord::Base; end def self.up add_column :posts, :likes_count, :integer, :default => 0 + execute <<SQL if Post.count > 0 + UPDATE posts + SET posts.likes_count = (SELECT COUNT(*) FROM likes WHERE likes.post_id = posts.id) +SQL end def self.down
Update the Post counter caches when adding the counter cache column
diff --git a/db/migrate/20191203103441_set_new_heat_losses_to_zero.rb b/db/migrate/20191203103441_set_new_heat_losses_to_zero.rb index abc1234..def5678 100644 --- a/db/migrate/20191203103441_set_new_heat_losses_to_zero.rb +++ b/db/migrate/20191203103441_set_new_heat_losses_to_zero.rb @@ -0,0 +1,88 @@+class SetNewHeatLossesToZero < ActiveRecord::Migration[5.0] + def up + + old_key = "energy_heat_network_loss_demand" + new_key = "energy_distribution_steam_hot_water_energy_heat_distribution_loss_parent_share" + + say "Checking and migrating #{Dataset.count} datasets" + changed = 0 + + Dataset.find_each.with_index do |dataset, index| + if index.positive? && (index % 500).zero? + say "Done #{index} (#{changed} updated)" + end + + loss_edit = find_edit(dataset, old_key) + + if loss_edit + # rename edit + loss_edit.key = new_key + # set to zero + loss_edit.value = 0.0 + + loss_edit.save(validate: false, touch: false) + + # Remove all outdated edits. + destroy_edits(dataset, old_key) + + changed += 1 + end + end + + say "Finished (#{changed} updated)" + end + + def down + raise ActiveRecord::IrreversibleMigration + end + + private + + # Create a new dataset edit + def create_edit(commit, key, value) + ActiveRecord::Base.transaction do + DatasetEdit.create!( + commit_id: commit.id, + key: key, + value: value + ) + end + end + + # Finds all commits belonging to a dataset with an edit to the given key. + def find_commits(dataset, edit_key) + dataset.commits + .joins(:dataset_edits) + .where(dataset_edits: { key: edit_key }) + .order(updated_at: :desc) + end + + # Finds the most recent edit of a key belonging to a dataset. + def find_edit(dataset, edit_key) + commits = find_commits(dataset, edit_key) + + return nil unless commits.any? + + DatasetEdit + .where(commit_id: commits.pluck(:id), key: edit_key) + .order(updated_at: :desc) + .first + end + + # Removes all dataset edits matching the `edit_key`. If the key is the only + # dataset belonging to the commit, the commit will also be removed. + def destroy_edits(dataset, edit_key) + commits = find_commits(dataset, edit_key) + + return if commits.none? + + commits.each do |commit| + if commit.dataset_edits.one? + commit.destroy + else + commit.dataset_edits.find_by_key(edit_key).destroy + end + end + end +end +
Add migration for new heat loss key Commit message from old key is taken Demand is set to zero for all datasets with old key
diff --git a/db/migrate/20201227122327_add_included_to_adjustments.rb b/db/migrate/20201227122327_add_included_to_adjustments.rb index abc1234..def5678 100644 --- a/db/migrate/20201227122327_add_included_to_adjustments.rb +++ b/db/migrate/20201227122327_add_included_to_adjustments.rb @@ -1,4 +1,6 @@ class AddIncludedToAdjustments < ActiveRecord::Migration + class Spree::TaxRate < ActiveRecord::Base; end + class Spree::Adjustment < ActiveRecord::Base belongs_to :originator, polymorphic: true end
Update migration to include TaxRate model
diff --git a/lib/deptree/dependency.rb b/lib/deptree/dependency.rb index abc1234..def5678 100644 --- a/lib/deptree/dependency.rb +++ b/lib/deptree/dependency.rb @@ -7,20 +7,20 @@ def initialize(name, prerequisites = []) @name = name + @actions = [] @prerequisites = prerequisites - @actions = Set.new end def add_action(name, *args, &behaviour) - action = Action.new(name, args, behaviour) + Action.new(name, args, behaviour).tap do |action| - if actions.member?(action) - fail DuplicateActionError.new(@name, action.name) - else - actions << action + if actions.member?(action) + fail DuplicateActionError.new(@name, action.name) + else + actions << action + end + end - - action end class Action @@ -33,13 +33,10 @@ @args = args end - def eql?(other) + def ==(other) name == other.name end - def hash - name.hash - end end end
Use an Array to store actions
diff --git a/lib/edition_duplicator.rb b/lib/edition_duplicator.rb index abc1234..def5678 100644 --- a/lib/edition_duplicator.rb +++ b/lib/edition_duplicator.rb @@ -8,7 +8,7 @@ self.actor = actor end - # new_format : A new format to create (eg. 'answer') + # new_format : The format of the new edition (eg. 'answer') # assign_to : The User who the new item should be assigned to for further # work. def duplicate(new_format = nil, assign_to = nil)
Update description of the new_format parameter
diff --git a/lib/eeny-meeny/railtie.rb b/lib/eeny-meeny/railtie.rb index abc1234..def5678 100644 --- a/lib/eeny-meeny/railtie.rb +++ b/lib/eeny-meeny/railtie.rb @@ -19,7 +19,7 @@ ActionController::Base.send :include, EenyMeeny::ExperimentHelper ActionView::Base.send :include, EenyMeeny::ExperimentHelper # Insert Middleware - app.middleware.insert_before 'ActionDispatch::Cookies', EenyMeeny::Middleware + app.middleware.insert_before ActionDispatch::Cookies, EenyMeeny::Middleware end rake_tasks do
Update syntax for middleware.insert_before to support rails 5
diff --git a/lib/yars/request_queue.rb b/lib/yars/request_queue.rb index abc1234..def5678 100644 --- a/lib/yars/request_queue.rb +++ b/lib/yars/request_queue.rb @@ -1,4 +1,5 @@ module Yars + # A thread safe queue built using monitors class AtomicQueue attr_reader :size @@ -32,8 +33,7 @@ @size == 0 end - private - + # Private node for the queue class Node attr_accessor :data, :succ, :pred
Add top level comments for queue
diff --git a/lib/rutty.rb b/lib/rutty.rb index abc1234..def5678 100644 --- a/lib/rutty.rb +++ b/lib/rutty.rb @@ -7,7 +7,19 @@ require 'rutty/node' require 'rutty/nodes' +## +# The RuTTY top-level module. Everything in the RuTTY gem is contained in this module. +# +# @author Josh Lindsey +# @since 2.0.0 module Rutty + + ## + # The Rutty::Runner class includes mixins from the other modules. All end-user interaction + # should be done through this class. + # + # @author Josh Lindsey + # @since 2.0.0 class Runner attr_writer :config_dir @@ -15,18 +27,37 @@ include Rutty::Helpers include Rutty::Actions + ## + # Initialize a new {Rutty::Runner} instance + # + # @param config_dir [String] Optional parameter specifying the directory RuTTY has been init'd into def initialize config_dir = nil self.config_dir = config_dir end + ## + # Lazy-load the {Rutty::Config} object for this instance, based on the config_dir param + # passed to {#initialize}. + # + # @return [Rutty::Config] def config @config ||= Rutty::Config.load_config self.config_dir end + ## + # Lazy-load the {Rutty::Nodes} object containing the user-defined nodes' connection info. + # Loads from the config_dir param passed to {#initialize} + # + # @return [Rutty::Nodes] def nodes @nodes ||= Rutty::Nodes.load_config self.config_dir end + ## + # If @config_dir is nil, returns {Rutty::Consts::CONF_DIR}. Otherwise return @config_dir. + # + # @see Rutty::Consts::CONF_DIR + # @return [String] The user-specified config directory, falling back to the default on nil def config_dir (@config_dir.nil? && Rutty::Consts::CONF_DIR) || @config_dir end
Add YARD docs to Rutty::Runner
diff --git a/lib/tasks.rb b/lib/tasks.rb index abc1234..def5678 100644 --- a/lib/tasks.rb +++ b/lib/tasks.rb @@ -34,7 +34,7 @@ namespace :package do @rapper.definitions.each do |type, definition| desc "Package all #{type} assets that need re-packaging" - task key do + task type do @rapper.package( type ) end end
Fix typo in rake task.
diff --git a/spec/perpetuity/attribute_spec.rb b/spec/perpetuity/attribute_spec.rb index abc1234..def5678 100644 --- a/spec/perpetuity/attribute_spec.rb +++ b/spec/perpetuity/attribute_spec.rb @@ -2,7 +2,7 @@ module Perpetuity describe Attribute do - subject { Perpetuity::Attribute.new :article, Object } + subject { Attribute.new :article, Object } it 'has a name' do subject.name.should == :article end @@ -12,7 +12,7 @@ end it 'can be embedded' do - attribute = Perpetuity::Attribute.new :article, Object, embedded: true + attribute = Attribute.new :article, Object, embedded: true attribute.should be_embedded end end
Remove explicit namespace from Attribute spec Unnecessary since the spec itself is wrapped in the namespace.
diff --git a/lib/memoizable.rb b/lib/memoizable.rb index abc1234..def5678 100644 --- a/lib/memoizable.rb +++ b/lib/memoizable.rb @@ -7,7 +7,7 @@ require 'memoizable/memory' require 'memoizable/version' -# Allow methods to be idempotent +# Allow methods to be memoized module Memoizable # Default freezer
Change comment to be more precise
diff --git a/lib/pygmentize.rb b/lib/pygmentize.rb index abc1234..def5678 100644 --- a/lib/pygmentize.rb +++ b/lib/pygmentize.rb @@ -1,20 +1,25 @@ require "shellwords" class Pygmentize - VERSION = "0.0.3" + VERSION = "0.0.3.1" def self.bin "/usr/bin/env python #{File.expand_path("../vendor/pygmentize.py", File.dirname(__FILE__))}" end - def self.process(source, lexer, args = []) - args += [ + def self.process(source, lexer, options) + options[:encoding] = source.encoding + opts_string = options.to_a.reduce([]) { |a,i| + a << "-O #{i.map { |i| Shellwords.escape(i.to_s) }.join('=')}" + }.join(' ') + + args = [ "-l", lexer.to_s, - "-f", "html", - "-O", "encoding=#{source.encoding}" + "-f", "html" ] - IO.popen("#{bin} #{Shellwords.shelljoin args}", "r+") do |io| + cmd = "#{bin} #{Shellwords.shelljoin args} #{opts_string}" + IO.popen(cmd, "r+") do |io| io.write(source) io.close_write io.read
Support for multiple options through hash syntax.
diff --git a/lib/qu/payload.rb b/lib/qu/payload.rb index abc1234..def5678 100644 --- a/lib/qu/payload.rb +++ b/lib/qu/payload.rb @@ -4,7 +4,7 @@ class Payload < OpenStruct include Logger - undef_method :id + undef_method(:id) if method_defined?(:id) def initialize(options = {}) super
Fix Payload on Ruby 1.9
diff --git a/lib/sql_origin.rb b/lib/sql_origin.rb index abc1234..def5678 100644 --- a/lib/sql_origin.rb +++ b/lib/sql_origin.rb @@ -21,7 +21,7 @@ # Enables SQL:Origin backtrace logging to the Rails log. def self.append_to_log - %w( PostgreSQLAdapter MysqlAdapter Mysql2Adapter OracleAdapter SQLiteAdapter ).each do |name| + %w( PostgreSQLAdapter MysqlAdapter Mysql2Adapter OracleAdapter SQLiteAdapter SQLite3Adapter ).each do |name| adapter = ActiveRecord::ConnectionAdapters.const_get(name.to_sym) rescue nil if adapter adapter.send :include, SQLOrigin::LogHook
Fix for new SQLite adapter name
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index abc1234..def5678 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -2,16 +2,9 @@ namespace :db do desc "Hard development sqlite3 reset && seed" task :hard_reset do - file_name = 'db/development.sqlite3' - print "[del] #{file_name}" - begin - File.delete("#{Rails.root}/#{file_name}") - print " OK\n" - rescue - print " FAIL\n" - end - puts "[rake] db:migrate && [rake] db:seed" - exec "cd #{Rails.root} && rake db:migrate && rake db:seed" + cmd = "rake db:drop && rake db:create && rake db:migrate && rake db:seed" + puts cmd.gsub('rake','[rake]') + exec "cd #{Rails.root} && #{cmd}" end desc "Soft database reset && seed"
Upgrade hard_reset for postgres && sqlite
diff --git a/Casks/google-play-music-desktop-player.rb b/Casks/google-play-music-desktop-player.rb index abc1234..def5678 100644 --- a/Casks/google-play-music-desktop-player.rb +++ b/Casks/google-play-music-desktop-player.rb @@ -0,0 +1,25 @@+cask 'google-play-music-desktop-player' do + version '3.0.0' + sha256 '7196a2a6e179ec085c33849e735a6f6725b009d0415cf7c19f4f2dfd199ec7a3' + + # github.com/MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL- was verified as official when first introduced to the cask + url "https://github.com/MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-/releases/download/#{version}/Google.Play.Music.Desktop.Player.OSX.zip" + appcast 'https://github.com/MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-/releases.atom', + checkpoint: '4764609a96b400945bcaa7e0ae48da9428159f18314050f2ba9692aaa6e5afc6' + name 'Google Play Music Desktop Player' + homepage 'http://www.googleplaymusicdesktopplayer.com/' + license :mit + + app 'Google Play Music Desktop Player.app' + + zap delete: [ + '~/Library/Application\ Support/Google\ Play\ Music\ Desktop\ Player', + '~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/google-play-music-desktop-player.sfl', + '~/Library/Application\ Support/google-play-music-desktop-player.ShipIt', + '~/Library/Caches/Google\ Play\ Music\ Desktop\ Player', + '~/Library/Caches/google-play-music-desktop-player', + '~/Library/Cookies/google-play-music-desktop-player.binarycookies', + '~/Library/Preferences/google-play-music-desktop-player.plist', + '~/Library/Saved\ Application\ State/google-play-music-desktop-player.savedState' + ] +end
Add Google Play Music Desktop Player.app v3.0.0
diff --git a/core-library/bm_so_count_words.rb b/core-library/bm_so_count_words.rb index abc1234..def5678 100644 --- a/core-library/bm_so_count_words.rb +++ b/core-library/bm_so_count_words.rb @@ -6,7 +6,7 @@ 500.times do - input = open(File.join(File.dirname($0), 'wc.input'), 'rb') + input = open(File.dirname(__FILE__) + '/wc.input', 'rb') nl = nw = nc = 0 while true @@ -18,7 +18,6 @@ end input.close +end +#STDERR.puts "#{nl} #{nw} #{nc}" -end -# STDERR.puts "#{nl} #{nw} #{nc}" -
Set absolute path for input file.
diff --git a/test/integration/multisite_test.rb b/test/integration/multisite_test.rb index abc1234..def5678 100644 --- a/test/integration/multisite_test.rb +++ b/test/integration/multisite_test.rb @@ -12,15 +12,14 @@ def test_login site! 'site1' - sign_in_as people(:jim) post_sign_in_form 'tom@example.com' assert_response :success - assert flash[:warning] =~ /email address cannot be found/ + assert_select 'body', /email address cannot be found/ site! 'site2' sign_in_as people(:tom) post_sign_in_form 'jim@example.com' assert_response :success - assert flash[:warning] =~ /email address cannot be found/ + assert_select 'body', /email address cannot be found/ end def test_browse
Fix multisite test breakage due to changes in use of flash.
diff --git a/lib/gimei.rb b/lib/gimei.rb index abc1234..def5678 100644 --- a/lib/gimei.rb +++ b/lib/gimei.rb @@ -1,8 +1,8 @@+require 'forwardable' +require 'yaml' require 'gimei/version' require 'gimei/name' require 'gimei/address' -require 'yaml' -require 'forwardable' class Gimei extend Forwardable
Fix raise error due to order of `require`
diff --git a/app/controllers/robots_controller.rb b/app/controllers/robots_controller.rb index abc1234..def5678 100644 --- a/app/controllers/robots_controller.rb +++ b/app/controllers/robots_controller.rb @@ -1,7 +1,7 @@ # # == RobotsController # -class RobotsController < ApplicationController +class RobotsController < ActionController::Base layout false def index
Make RobotsController inherit from ActionController::Base
diff --git a/test/unit/recipes/nsswitch_spec.rb b/test/unit/recipes/nsswitch_spec.rb index abc1234..def5678 100644 --- a/test/unit/recipes/nsswitch_spec.rb +++ b/test/unit/recipes/nsswitch_spec.rb @@ -0,0 +1,35 @@+describe 'sys::nsswitch' do + + context "node['sys']['nsswitch'] is empty" do + let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) } + + it 'does nothing' do + expect(chef_run.run_context.resource_collection).to be_empty + end + end + + context 'with some attributes' do + cached(:chef_run) do + ChefSpec::SoloRunner.new do |node| + node.default['sys']['nsswitch']['asdf'] = '1qay' + node.default['sys']['nsswitch']['protocols'] = 'nunc est bibendum' + end.converge(described_recipe) + end + + it 'adds defaults to nsswitch.conf' do + expect(chef_run).to render_file('/etc/nsswitch.conf') + .with_content(/^passwd: +compat/) + .with_content(/^hosts: +files dns/) + end + + it 'adds custom config to nsswitch.conf' do + expect(chef_run).to render_file('/etc/nsswitch.conf') + .with_content(/^asdf: +1qay/) + end + + it 'adds defaults to nsswitch.conf' do + expect(chef_run).to render_file('/etc/nsswitch.conf') + .with_content(/^protocols: +nunc est bibendum/) + end + end +end
Add unit tests for sys::nsswitch
diff --git a/lib/axiom/types/type.rb b/lib/axiom/types/type.rb index abc1234..def5678 100644 --- a/lib/axiom/types/type.rb +++ b/lib/axiom/types/type.rb @@ -14,9 +14,9 @@ raise NotImplementedError, "#{inspect} should not be instantiated" end - def self.constraint(constraint = nil, &block) - constraint ||= block - current = @constraint + def self.constraint(constraint = Undefined, &block) + constraint = block if constraint.equal?(Undefined) + current = @constraint return current if constraint.nil? @constraint = if current lambda { |object| current.call(object) && constraint.call(object) }
Change Type.constraint to not accept a nil value
diff --git a/lib/axiom/types/type.rb b/lib/axiom/types/type.rb index abc1234..def5678 100644 --- a/lib/axiom/types/type.rb +++ b/lib/axiom/types/type.rb @@ -36,7 +36,8 @@ def self.include?(object) included = constraint.call(object) if included != true && included != false - raise TypeError, "must return true or false, but was #{included.inspect}" + raise TypeError, + "constraint must return true or false, but was #{included.inspect}" end included end
Update error message to be more clear
diff --git a/app/services/analytics/index_page.rb b/app/services/analytics/index_page.rb index abc1234..def5678 100644 --- a/app/services/analytics/index_page.rb +++ b/app/services/analytics/index_page.rb @@ -24,7 +24,7 @@ result[:user_uid] = user.uid result[:user_name] = user.name result[:organisation] = user.organisation_slug.try do |slug| - slug.capitalize.gsub('-', ' ') + slug.capitalize.tr('-', ' ') end end end
Switch to using tr rather than gsub As gsub isn't necessary.
diff --git a/lib/files_for_backup.rb b/lib/files_for_backup.rb index abc1234..def5678 100644 --- a/lib/files_for_backup.rb +++ b/lib/files_for_backup.rb @@ -14,7 +14,16 @@ end end - all_files = remove_excludes(Find.find(@backup_folder).to_a, logger) + # exclude directories + find_files = Find.find(@backup_folder).to_a + files_only = [] + find_files.each do |file| + if Pathname(file).file? + files_only.push(file) + end + end + + remove_excludes(files_only, logger) end def remove_excludes(all_files, logger=nil)
Fix local file count (exclude directories).
diff --git a/lib/lager.rb b/lib/lager.rb index abc1234..def5678 100644 --- a/lib/lager.rb +++ b/lib/lager.rb @@ -37,8 +37,7 @@ halt(401, "Not authorized") unless services_params services_params["servers"].each do |server_name| server = Server.find_by(label: server_name) - service = Service.create(name: services_params["name"], service_type: 'db', log_path: services_params["log_path"]) - server.services << service + server.services.create(name: services_params["name"], service_type: 'db', log_path: services_params["log_path"]) end end
Remove append for creating a new service
diff --git a/app/uploaders/image_uploader_base.rb b/app/uploaders/image_uploader_base.rb index abc1234..def5678 100644 --- a/app/uploaders/image_uploader_base.rb +++ b/app/uploaders/image_uploader_base.rb @@ -32,6 +32,7 @@ io.download do |original| versions[:master] = ImageProcessing::MiniMagick. source(original). + loader(page: 0). # For gif animation image convert(:jpg). saver(quality: 90). strip.
Use page 0 image for master image
diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb index abc1234..def5678 100644 --- a/spec/models/article_spec.rb +++ b/spec/models/article_spec.rb @@ -10,9 +10,9 @@ end it "only return published articles" do - @published.should_not be_empty + expect(@published).not_to be_empty @published.each do |article| - article.should be_published + expect(article).to be_published end end end
Use 'expect' instead of 'should'
diff --git a/doc/ex/tspan03.rb b/doc/ex/tspan03.rb index abc1234..def5678 100644 --- a/doc/ex/tspan03.rb +++ b/doc/ex/tspan03.rb @@ -7,9 +7,9 @@ canvas.g.translate(100, 60) do |grp| grp.text.styles(:font_family=>'Verdana', :font_size=>45) do |txt| - txt.tspan("Rotation ") - txt.tspan("propogates ").rotate(20).styles(:fill=>'red') do |tsp| - tsp.tspan("to descendents").styles(:fill=>'green') + txt.tspan("Rotation") + txt.tspan(" propogates").rotate(20).styles(:fill=>'red') do |tsp| + tsp.tspan(" to descendents").styles(:fill=>'green') end end end
Fix text positioning to work better with IM 6.3.1
diff --git a/spec/mongo_doc/root_spec.rb b/spec/mongo_doc/root_spec.rb index abc1234..def5678 100644 --- a/spec/mongo_doc/root_spec.rb +++ b/spec/mongo_doc/root_spec.rb @@ -3,8 +3,12 @@ describe "MongoDoc::Root" do class RootTest include MongoDoc::Root - attr_accessor_with_default(:_associations) {[]} + attr_accessor :_associations attr_accessor :association + + def initialize + self._associations = [] + end end let(:doc) { RootTest.new }
Refactor spec to remove AS 3.1 deprecation warning
diff --git a/spec/ruby_tokenizer_spec.rb b/spec/ruby_tokenizer_spec.rb index abc1234..def5678 100644 --- a/spec/ruby_tokenizer_spec.rb +++ b/spec/ruby_tokenizer_spec.rb @@ -1,6 +1,10 @@ require 'spec_helper' +require 'ruby_tokenizer' + describe RubyTokenizer do + let(:token) {RubyTokenizer.new('Searching records is a common requirement in web applications.')} + it 'has a version number' do expect(RubyTokenizer::VERSION).not_to be nil end
Add helper method to spec
diff --git a/config/environments/test.rb b/config/environments/test.rb index abc1234..def5678 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -35,5 +35,3 @@ config.assets.paths << Rails.root.join("test/javascripts") end - -require "slimmer/test"
Remove redundant changes to slimmer use
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index abc1234..def5678 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -4,7 +4,7 @@ html = '' content_tag(:address) do html << - "#{location.address1} \n<br />\n #{location.city}, \ + "#{location.address1} \n<br />\n #{location.city}, #{location.state_abbrv} #{location.zipcode}" end html.html_safe @@ -13,8 +13,8 @@ def event_dates(event) content_tag(:span) do if event.begin_date && event.end_date - "#{event.begin_date.strftime('%m/%d/%y')} - - #{event.end_date.strftime('%m/%d/%y') }".html_safe + "#{event.begin_date.strftime('%m/%d/%y')} - \ + #{event.end_date.strftime('%m/%d/%y')}".html_safe else 'TBA' end @@ -24,8 +24,8 @@ def event_registration_dates(event) content_tag(:span) do if event.registration_open_date && event.registration_close_date - "#{ event.end_date.strftime('%m/%d/%y')} - - #{event.registration_open_date.strftime('%m/%d/%y') }".html_safe + "#{ event.end_date.strftime('%m/%d/%y') } - \ + #{ event.registration_open_date.strftime('%m/%d/%y') }".html_safe else 'TBA' end @@ -33,7 +33,7 @@ end def display_event(event) - if event_type == Event::EVENT_TYPE + if event_type = Event::EVENT_TYPE .detect { |a| a.include?(event.event_type) } event_type[0] else
Fix bug introduced in Rubocop refactoring
diff --git a/lib/stats.rb b/lib/stats.rb index abc1234..def5678 100644 --- a/lib/stats.rb +++ b/lib/stats.rb @@ -5,10 +5,6 @@ class Stats def initialize @statsd = Statsd.new('127.0.0.1', 8125) - end - - def dyno_id - @dyno_id ||= ENV['DYNO'] || 'unknown' end def increment(name)
Remove unused DYNO variable This variable was provided by heroku when the project first started.
diff --git a/app/models/taxon_ancestor.rb b/app/models/taxon_ancestor.rb index abc1234..def5678 100644 --- a/app/models/taxon_ancestor.rb +++ b/app/models/taxon_ancestor.rb @@ -1,5 +1,5 @@ class TaxonAncestor < ActiveRecord::Base - # attr_accessible :title, :body + attr_accessible :parent_id, :child_id belongs_to :parent, :class_name => "Taxon" belongs_to :child, :class_name => "Taxon"
Make parent_id and child_id assignable
diff --git a/nack.gemspec b/nack.gemspec index abc1234..def5678 100644 --- a/nack.gemspec +++ b/nack.gemspec @@ -8,9 +8,12 @@ EOS s.files = [ - 'lib/nack/client.rb', - 'lib/nack/server.rb', - 'lib/nack.rb' + 'lib/nack.rb', + 'lib/nack/builder', + 'lib/nack/client' + 'lib/nack/error', + 'lib/nack/netstring', + 'lib/nack/server' ] s.executables = ['nackup'] s.extra_rdoc_files = ['README.md', 'LICENSE']
Add missing ruby files to gemspec
diff --git a/activemodel/lib/active_model/validations/absence.rb b/activemodel/lib/active_model/validations/absence.rb index abc1234..def5678 100644 --- a/activemodel/lib/active_model/validations/absence.rb +++ b/activemodel/lib/active_model/validations/absence.rb @@ -11,7 +11,7 @@ module HelperMethods # Validates that the specified attributes are blank (as defined by - # Object#blank?). Happens by default on save. + # Object#present?). Happens by default on save. # # class Person < ActiveRecord::Base # validates_absence_of :first_name
Fix a typo in AbsenceValidator
diff --git a/lib/netsuite/records/inter_company_journal_entry_line.rb b/lib/netsuite/records/inter_company_journal_entry_line.rb index abc1234..def5678 100644 --- a/lib/netsuite/records/inter_company_journal_entry_line.rb +++ b/lib/netsuite/records/inter_company_journal_entry_line.rb @@ -8,7 +8,7 @@ fields :credit, :debit, :eliminate, :end_date, :gross_amt, :memo, :residual, :start_date, :tax1_amt, :tax_rate1 field :custom_field_list, CustomFieldList - record_refs :account, :department, :entity, :klass, :location, :schedule, :schedule_num, :tax1_acct, :tax_code + record_refs :account, :department, :entity, :klass, :line_subsidiary, :location, :schedule, :schedule_num, :tax1_acct, :tax_code def initialize(attributes = {}) initialize_from_attributes_hash(attributes)
Add line level subsidiary field
diff --git a/25_assembunny_clock.rb b/25_assembunny_clock.rb index abc1234..def5678 100644 --- a/25_assembunny_clock.rb +++ b/25_assembunny_clock.rb @@ -0,0 +1,23 @@+require_relative 'lib/assembunny' +assembler = Assembunny::Interpreter.new(ARGF.readlines) + +# We can't be sure that any number of bits is enough for *arbitrary* input, +# But for *my* input, the program outputs the binary of (a + 2532). +# We need a + 2532 to be a number in the recurrence: +# f(1) = 2, f(n) = 4 * f(n - 1) + 2. +# +# Enumerator.produce(2) { |v| 4 * v + 2 }.take(10) +# [2, 10, 42, 170, 682, 2730, 10922, 43690, 174762, 699050] +# +# If f(CYCLES) > 2532, we find the right answer before any false positive, +# The first false positive would be Integer("1" + "10" * CYCLES, 2) - 2532. +# CYCLES == 6 suffices for my input. +# Empirically, even CYCLES == 4 happens to get the right answer. +# We'll use 100 so that an input has to try hard to cause false positives. +CYCLES = 100 +EXPECTED = ([0, 1] * CYCLES).freeze + +0.step { |a| + _, good_outs = assembler.run({a: a, b: 0, c: 0, d: 0}, outs: EXPECTED) + (puts a; break) if good_outs == EXPECTED.size +}
Add day 25: Assembunny Clock
diff --git a/no-style-please.gemspec b/no-style-please.gemspec index abc1234..def5678 100644 --- a/no-style-please.gemspec +++ b/no-style-please.gemspec @@ -12,8 +12,8 @@ spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(assets|_layouts|_includes|_sass|LICENSE|README|_config\.yml)!i) } - spec.add_runtime_dependency "jekyll", "~> 3.8.7" - spec.add_runtime_dependency "jekyll-feed", "~> 0.13.0" - spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.6.1" + spec.add_runtime_dependency "jekyll", "~> 3.9.0" + spec.add_runtime_dependency "jekyll-feed", "~> 0.15.1" + spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.7.1" end
Update Jekyll to version 3.9.0
diff --git a/features/support/widget.rb b/features/support/widget.rb index abc1234..def5678 100644 --- a/features/support/widget.rb +++ b/features/support/widget.rb @@ -38,6 +38,8 @@ eval(code) end + alias_method :eval_in_page, :eval_find + def load_test_page visit "/test" end
[tests] Add more generic evaluation alias.
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index abc1234..def5678 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,6 +1,7 @@ require Rails.root.join('lib', 'yammer-strategy') require Rails.root.join('lib', 'yammer-staging-strategy') OmniAuth.config.on_failure = SessionsController.action(:oauth_failure) +OmniAuth.config.logger = Rails.logger Rails.application.config.middleware.use OmniAuth::Builder do provider :yammer, ENV['CONSUMER_KEY'], ENV['CONSUMER_SECRET']
Hide authentication error messages during tests
diff --git a/lib/omniauth/strategies/kerberos.rb b/lib/omniauth/strategies/kerberos.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/kerberos.rb +++ b/lib/omniauth/strategies/kerberos.rb @@ -15,7 +15,7 @@ info do { username: username, - email: username + "@" + @krb5.get_default_realm } + email: username + "@" + @krb5.get_default_realm.downcase } end def authenticate(username, password)
Convert realm to downcase when building email
diff --git a/core/spec/support/schema.rb b/core/spec/support/schema.rb index abc1234..def5678 100644 --- a/core/spec/support/schema.rb +++ b/core/spec/support/schema.rb @@ -17,6 +17,7 @@ ROM::Types.const_get(id).meta(**meta) end + # @todo Use this method consistently in all the test suite def define_attribute(id, opts, **meta) type = define_type(id, **meta) ROM::Attribute.new(type, opts)
Add todo note about pending refactor in tests
diff --git a/lib/puppet/functions/inline_yaml.rb b/lib/puppet/functions/inline_yaml.rb index abc1234..def5678 100644 --- a/lib/puppet/functions/inline_yaml.rb +++ b/lib/puppet/functions/inline_yaml.rb @@ -0,0 +1,31 @@+require 'yaml' + +Puppet::Functions.create_function(:inline_yaml) do + dispatch :from_variable do + param 'Hash', :variable + optional_param 'Hash', :parameters + return_type 'String' + end + + def from_variable(variable, parameters = {}) + params = { + 'header' => '# File managed by puppet - modifications will be lost', + 'indent_lines' => 0, + }.merge(parameters) + + header = params['header'] + indent_lines = params['indent_lines'] + + data = YAML.dump(variable).lines[1..-1].join.rstrip << "\n" + if indent_lines + data = data.each_line { |l| (' ' * indent_lines) + l } + end + + if header + "#{header}\n#{data}" + else + data + end + end +end +
Add a function to return a value as an inline yaml string
diff --git a/app/helpers/player_helper.rb b/app/helpers/player_helper.rb index abc1234..def5678 100644 --- a/app/helpers/player_helper.rb +++ b/app/helpers/player_helper.rb @@ -14,10 +14,10 @@ module PlayerHelper def is_mejs_2? - !is_mejs_4? + session['mejs_version'] == 2 || params['mejs4'] === 'false' end def is_mejs_4? - session['mejs_version'] == 4 || params['mejs4'] === 'true' + !is_mejs_2? end end
Use MEJS4 unless told to do otherwise
diff --git a/src/oc-id/spec/support/monkeypatch.rb b/src/oc-id/spec/support/monkeypatch.rb index abc1234..def5678 100644 --- a/src/oc-id/spec/support/monkeypatch.rb +++ b/src/oc-id/spec/support/monkeypatch.rb @@ -0,0 +1,18 @@+# This patch is only required when using rails 4.2 with ruby 2.6 +# +# https://github.com/rails/rails/issues/34790 + +if RUBY_VERSION>='2.6.0' + if Rails.version < '5' + class ActionController::TestResponse < ActionDispatch::TestResponse + def recycle! + # hack to avoid MonitorMixin double-initialize error: + @mon_mutex_owner_object_id = nil + @mon_mutex = nil + initialize + end + end + else + puts "Monkeypatch for ActionController::TestResponse no longer needed" + end +end
Fix verify pipeline oc-id tests oc-id is built on rails 4.2.11 which fails tests with: `ThreadError: already initialized` with Ruby 2.6.x This commit adds src/oc-id/spec/support/monkeypatch.rb to prevent rails from reusing `ActionController::TestResponse` object in tests. See: https://github.com/rails/rails/issues/34790 Signed-off-by: Christopher A. Snapp <dffaa860ed97a8fe2bd7fd9817f16f80af273fae@chef.io>
diff --git a/app/models/enterprise_fee.rb b/app/models/enterprise_fee.rb index abc1234..def5678 100644 --- a/app/models/enterprise_fee.rb +++ b/app/models/enterprise_fee.rb @@ -2,7 +2,6 @@ belongs_to :enterprise calculated_adjustments - has_one :calculator, :as => :calculable, :dependent => :destroy, :class_name => 'Spree::Calculator' attr_accessible :enterprise_id, :fee_type, :name, :calculator_type
Remove association that's already added by Spree's calculated_adjustments
diff --git a/lib/apple_dep_client/device.rb b/lib/apple_dep_client/device.rb index abc1234..def5678 100644 --- a/lib/apple_dep_client/device.rb +++ b/lib/apple_dep_client/device.rb @@ -29,5 +29,17 @@ end JSON.dump body end + + def self.sync + raise NotImplementedError + end + + def self.details(devices) + raise NotImplementedError + end + + def self.disown(devices) + raise NotImplementedError + end end end
Add unimplemented functions to Device
diff --git a/lib/boom/color.rb b/lib/boom/color.rb index abc1234..def5678 100644 --- a/lib/boom/color.rb +++ b/lib/boom/color.rb @@ -17,7 +17,9 @@ # # Returns nothing. def self.included(other) - require 'Win32/Console/ANSI' if RUBY_PLATFORM =~ /win32/ + if RUBY_PLATFORM =~ /win32/ || RUBY_PLATFORM =~ /mingw32/ + require 'Win32/Console/ANSI' + end rescue LoadError # Oh well, we tried. end
Check for mingw32 and it's all good on windows
diff --git a/lib/aggregate_builder/metadata/callbacks_collection.rb b/lib/aggregate_builder/metadata/callbacks_collection.rb index abc1234..def5678 100644 --- a/lib/aggregate_builder/metadata/callbacks_collection.rb +++ b/lib/aggregate_builder/metadata/callbacks_collection.rb @@ -9,8 +9,7 @@ clonned = self.class.new clonned_callbacks = {} @callbacks.each do |type, callback| - clonned_callbacks[type] ||= [] - clonned_callbacks[type] << callback.dup + clonned_callbacks[type] = callback.dup end clonned.instance_variable_set(:@callbacks, clonned_callbacks) clonned
Fix issue with callbacks clonning
diff --git a/lib/gem_search/commands/run.rb b/lib/gem_search/commands/run.rb index abc1234..def5678 100644 --- a/lib/gem_search/commands/run.rb +++ b/lib/gem_search/commands/run.rb @@ -29,9 +29,7 @@ def search_gems print "Searching " - gems = Request.new.search(options.arguments[0]) do - print "." - end + gems = Request.new.search(options.arguments[0]) { print "." } puts gems end
Refactor block using one liner
diff --git a/lib/engineyard.rb b/lib/engineyard.rb index abc1234..def5678 100644 --- a/lib/engineyard.rb +++ b/lib/engineyard.rb @@ -1,5 +1,5 @@ module EY - VERSION = "0.2.2" + VERSION = "0.2.3.pre" autoload :Account, 'engineyard/account' autoload :API, 'engineyard/api'
Bump version for next release Change-Id: Iea68442b3694e7a0daddbffb9d107d2179d20ff9 Reviewed-on: http://review.engineyard.com/145 Reviewed-by: Andy Delcambre <dceae9ae498de7d794de551710d5e4d9b952cadb@engineyard.com> Tested-by: Andy Delcambre <dceae9ae498de7d794de551710d5e4d9b952cadb@engineyard.com>
diff --git a/lib/mail_room/configuration.rb b/lib/mail_room/configuration.rb index abc1234..def5678 100644 --- a/lib/mail_room/configuration.rb +++ b/lib/mail_room/configuration.rb @@ -13,7 +13,9 @@ if options.has_key?(:config_path) begin - config_file = YAML.load(ERB.new(File.read(options[:config_path])).result) + erb = ERB.new(File.read(options[:config_path])) + erb.filename = options[:config_path] + config_file = YAML.load(erb.result) set_mailboxes(config_file[:mailboxes]) rescue => e @@ -23,7 +25,7 @@ end # Builds individual mailboxes from YAML configuration - # + # # @param mailboxes_config def set_mailboxes(mailboxes_config) mailboxes_config.each do |attributes|
Set config file path in ERB so __FILE__ can be used
diff --git a/lib/jb/railtie.rb b/lib/jb/railtie.rb index abc1234..def5678 100644 --- a/lib/jb/railtie.rb +++ b/lib/jb/railtie.rb @@ -9,6 +9,21 @@ end end + if Rails::VERSION::MAJOR >= 5 + module ::ActionController + module ApiRendering + include ActionView::Rendering + end + end + + ActiveSupport.on_load :action_controller do + if self == ActionController::API + include ActionController::Helpers + include ActionController::ImplicitRender + end + end + end + generators do |app| Rails::Generators.configure! app.config.generators Rails::Generators.hidden_namespaces.uniq!
Add support for Rails API-mode
diff --git a/lib/pjax_rails.rb b/lib/pjax_rails.rb index abc1234..def5678 100644 --- a/lib/pjax_rails.rb +++ b/lib/pjax_rails.rb @@ -3,7 +3,9 @@ module PjaxRails class Engine < ::Rails::Engine initializer "pjax_rails.add_controller" do - config.to_prepare { ApplicationController.send :include, Pjax } + ActiveSupport.on_load :action_controller do + ActionController::Base.send :include, Pjax + end end end -end+end
Include into AC::Base instead of ApplicationController
diff --git a/Casks/antconc.rb b/Casks/antconc.rb index abc1234..def5678 100644 --- a/Casks/antconc.rb +++ b/Casks/antconc.rb @@ -1,6 +1,12 @@ cask :v1 => 'antconc' do - version '3.4.3' - sha256 'c63b9a9fd60a97c8551c6fa2902663568be9cdabee5601a2fe99715f47921421' + + if MacOS.release <= :snow_leopard + version '3.4.1' + sha256 '03c353c059b8c0762b01d9be83f435321f5396cbf203bd8b36c6a56682b6a240' + else + version '3.4.3' + sha256 'c63b9a9fd60a97c8551c6fa2902663568be9cdabee5601a2fe99715f47921421' + end url "http://www.laurenceanthony.net/software/antconc/releases/AntConc#{version.delete('.')}/AntConc.zip" name 'AntConc'
Add alternative AntConc version for snow leopard or lower
diff --git a/Casks/ax88772.rb b/Casks/ax88772.rb index abc1234..def5678 100644 --- a/Casks/ax88772.rb +++ b/Casks/ax88772.rb @@ -0,0 +1,13 @@+class Ax88772 < Cask + homepage 'http://www.asix.com.tw/products.php?op=pItemdetail&PItemID=86;71;101&PLine=71' + + version '2.1.0_20140428' + basename = "AX88772C_772B_772A_760_772_Macintosh_10.5_to_10.9_Driver_Installer_v#{version}" + + url "http://www.asix.com.tw/FrootAttach/driver/#{basename}.zip" + sha256 'ea7b2c401855c991cfd9d147632d5bf0478c99a4be034575301eb8549404391f' + + nested_container "#{basename}/AX88772.dmg" + install "AX88772_v#{version[0..-10]}.pkg" + uninstall :script => { :executable => 'AX88772C_772B_772A_760_772_Uninstall_v130' } +end
Add ASIX AX88772 Driver v2.1.0_20140428 Running "strings" on the binary uninstaller reveals several strings which appear to be shell calls to "kextunload" and "pkgutil --forget" so, running the uninstaller should be sufficient to remove the driver, unload it and remove the package's receipt.
diff --git a/Casks/codekit.rb b/Casks/codekit.rb index abc1234..def5678 100644 --- a/Casks/codekit.rb +++ b/Casks/codekit.rb @@ -3,4 +3,5 @@ homepage 'http://incident57.com/codekit/' version '1.6.2 (8300)' sha1 '842ba4f5d6ecf596abee1f80e3672b9771e2be22' + link 'CodeKit.app' end
Add link field to CodeKit Class
diff --git a/spec/payload_spec.rb b/spec/payload_spec.rb index abc1234..def5678 100644 --- a/spec/payload_spec.rb +++ b/spec/payload_spec.rb @@ -12,10 +12,10 @@ payload.should be_a Magnum::Payload::Gitslice end - #it 'returns payload instance for gitlab' do - # payload = Magnum::Payload.parse('gitlab', fixture('gitlab.json')) - # payload.should be_a Magnum::Payload::Gitlab - #end + it 'returns payload instance for gitlab' do + payload = Magnum::Payload.parse('gitlab', fixture('gitlab/commits.json')) + payload.should be_a Magnum::Payload::Gitlab + end it 'returns payload instance for bitbucket' do payload = Magnum::Payload.parse('bitbucket', fixture('bitbucket/git.json'))
Test shortcut for gitlab integration
diff --git a/sqlserver_adapter.rb b/sqlserver_adapter.rb index abc1234..def5678 100644 --- a/sqlserver_adapter.rb +++ b/sqlserver_adapter.rb @@ -1,6 +1,8 @@ require DataMapper.root / 'lib' / 'dm-core' / 'adapters' / 'data_objects_adapter' require 'do_sqlserver' + +DataObjects::Sqlserver = DataObjects::SqlServer module DataMapper module Adapters
Add a workaround for exceptional DataObjects::SqlServer naming * See also DO commit ee3a6fe. * Most likely completely unnecessary, but the conversion of the snake_cased to CamelCased name, doesn't give us the chance to follow the DB Vendor's naming convention (so yes, actually it really should be SQLServerAdapter). Signed-off-by: Alex Coles <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexcolesportfolio.com>
diff --git a/Formula/climb.rb b/Formula/climb.rb index abc1234..def5678 100644 --- a/Formula/climb.rb +++ b/Formula/climb.rb @@ -4,14 +4,10 @@ init desc "Composer version manager tool" homepage "https://github.com/vinkla/climb" - url "https://github.com/vinkla/climb/releases/download/0.6.1/climb.phar" - sha256 "f5e3711149a321ec35ed71740baa128e7021dd56bde06b971a3ed3cdcfe6bc63" + url "https://github.com/vinkla/climb/releases/download/0.7.0/climb.phar" + sha256 "50c62a80f487abda75cc2eebb15b7ce7921eefc6014e5c3e4fc82eb5be2074c4" bottle do - cellar :any_skip_relocation - sha256 "b159c718965448d740a3740f61d3de5d083889ae7d3cf1484643b14b1f05589c" => :el_capitan - sha256 "6db44dc55fa2c80f614498f3dd377bd456fd63cf364b960303b1a668911d5294" => :yosemite - sha256 "1023382503968cbc7591c67cc9107134ae5d0a6e1b5599a7f601e9c3e48f11ca" => :mavericks end test do
Update Climb.phar to version 0.7.0 Closes #2553. Signed-off-by: Andy Blyler <e3579b1e47f273529f0f929453e939a68ede9fd1@blyler.cc>
diff --git a/plugins/yolol-plugin.rb b/plugins/yolol-plugin.rb index abc1234..def5678 100644 --- a/plugins/yolol-plugin.rb +++ b/plugins/yolol-plugin.rb @@ -6,6 +6,6 @@ match /^!yolol/i def execute(m) - m.reply("yolol") unless m.user.nick.downcase == "matezoide" + m.reply("yolol") end -end +end
Revert "remove matezoide from using command" This reverts commit 18044d44faaffd16aa7d45b67184387433eba616.
diff --git a/lib/taxonomy/topic_taxonomy.rb b/lib/taxonomy/topic_taxonomy.rb index abc1234..def5678 100644 --- a/lib/taxonomy/topic_taxonomy.rb +++ b/lib/taxonomy/topic_taxonomy.rb @@ -14,7 +14,9 @@ end def visible_taxons - @visible_taxons = all_taxons.select(&:visible_to_departmental_editors) + @visible_taxons = branches.select( + &:visible_to_departmental_editors + ).flat_map(&:taxon_list) end private
Fix visible_taxons to return all taxons Instead of just the level one taxons. This fixes it's use in TaxonomyTagForm, where it's used to remove taxons from the list of invisible taxons. Without this change, you can't untag content from level 2 or below taxons, because they are treated as "invisible", even though they appear on the form. This has come up because of a Zendesk ticket.
diff --git a/poker-dice/hand.rb b/poker-dice/hand.rb index abc1234..def5678 100644 --- a/poker-dice/hand.rb +++ b/poker-dice/hand.rb @@ -8,11 +8,14 @@ end def rank - faces = face_values.join + counts = Hash.new(0) + face_values.each do |face| + counts[face] += 1 + end - case faces - when /([9TJQKA])\1{4}/ ; 'Five of a kind' - else ; 'Bupkis' + case + when counts.values.include?(5) ; 'Five of a kind' + else ; 'Bupkis' end end end
Change from regex to hash with counts
diff --git a/haml-lint.gemspec b/haml-lint.gemspec index abc1234..def5678 100644 --- a/haml-lint.gemspec +++ b/haml-lint.gemspec @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -$:.push File.expand_path('../lib', __FILE__) +$LOAD_PATH << File.expand_path('../lib', __FILE__) require 'haml_lint/version' Gem::Specification.new do |s|
Fix Rubocop lints in gemspec Prefer $LOAD_PATH over $: as it is more descriptive. Change-Id: I5b6ce760fd5d0d8be5e9039007155fe1e04c9ed1 Reviewed-on: http://gerrit.causes.com/36170 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/spec/support/tmp_dir_setup.rb b/spec/support/tmp_dir_setup.rb index abc1234..def5678 100644 --- a/spec/support/tmp_dir_setup.rb +++ b/spec/support/tmp_dir_setup.rb @@ -15,7 +15,8 @@ config.after do |example| if example.exception - example.exception.message << "\nTest directory: #{Bosh::Dev::Sandbox::DebugLogs.logs_dir}" + example.exception.message << "\nTest directory: #{tmp_dir}" + example.exception.message << "\nSandbox directory: #{Bosh::Dev::Sandbox::DebugLogs.logs_dir}" else FileUtils.rm_rf(tmp_dir) end
Print test directory on failure Signed-off-by: Maria Shaldibina <dc03896a0185453e5852a5e0f0fab6cbd2e026ff@pivotal.io>
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -23,5 +23,8 @@ 'mysql' => 'DBD::mysql' } +# prevent pg module install failures on debian platforms +package 'libpq-dev' if node['platform_family'] == 'debian' && node['sqitch']['engine'] == 'pg' + # Install the engine the user wants cpan_module engine_modules[node['sqitch']['engine']]
Fix install failures on debian platforms Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/templates/api_defaults_concern.rb b/templates/api_defaults_concern.rb index abc1234..def5678 100644 --- a/templates/api_defaults_concern.rb +++ b/templates/api_defaults_concern.rb @@ -7,20 +7,20 @@ API_DEFAULT_FAIL_PATH = "defaults/fail" # Statuses - SUCCESS_STATUS = "success" - FAIL_STATUS = "fail" + SUCCESS = 200 + INTERNAL_SERVER_ERROR = 500 included do layout 'api/v1/application' def render_api_success(path=ApiDefaults::API_DEFAULT_SUCCESS_PATH) - @status = ApiDefaults::SUCCESS_STATUS - return render template: "#{API_VIEW_PATH}/#{path}" + @status = ApiDefaults::SUCCESS + return render template: "#{API_VIEW_PATH}/#{path}", status: ApiDefaults::SUCCESS end def render_api_fail(path=ApiDefaults::API_DEFAULT_FAIL_PATH) - @status = ApiDefaults::FAIL_STATUS - return render template: "#{API_VIEW_PATH}/#{path}" + @status = ApiDefaults::INTERNAL_SERVER_ERROR + return render template: "#{API_VIEW_PATH}/#{path}", status: ApiDefaults::INTERNAL_SERVER_ERROR end end
Make API return valid status codes
diff --git a/colocated-charters-script.rb b/colocated-charters-script.rb index abc1234..def5678 100644 --- a/colocated-charters-script.rb +++ b/colocated-charters-script.rb @@ -5,8 +5,16 @@ charter_school = v.find { |x| x[3] == "Charter"} if charter_school != nil colocated_addresses_w_charter << {k => v} - # v.each {|x| charters_colocation << x} end end colocated_addresses_w_charter +end + +def create_colocated_charters_csv(schools_hsh) + schools_hsh.each_pair do |k,v| + charter_school = v.find { |x| x[3] == "Charter"} + if charter_school != nil + v.each {|x| charters_colocation << x} + end + end end
Create separate method where a csv is created with colocated buildings with charter
diff --git a/config/initializers/email.rb b/config/initializers/email.rb index abc1234..def5678 100644 --- a/config/initializers/email.rb +++ b/config/initializers/email.rb @@ -1,4 +1,4 @@-DO_NOT_REPLY = "do-not-reply@awesomefoundation.com" +DO_NOT_REPLY = "do-not-reply@awesomefoundation.org" ActionMailer::Base.smtp_settings = { :address => "smtp.sendgrid.net",
Change .com to .org in the do-not-reply address
diff --git a/lib/cocoapods/downloader.rb b/lib/cocoapods/downloader.rb index abc1234..def5678 100644 --- a/lib/cocoapods/downloader.rb +++ b/lib/cocoapods/downloader.rb @@ -3,6 +3,7 @@ module Pod class Downloader autoload :Git, 'cocoapods/downloader/git' + autoload :GitHub, 'cocoapods/downloader/git' autoload :Mercurial, 'cocoapods/downloader/mercurial' autoload :Subversion, 'cocoapods/downloader/subversion'
Make sure this can be autoloaded.
diff --git a/lib/elastic_record/model.rb b/lib/elastic_record/model.rb index abc1234..def5678 100644 --- a/lib/elastic_record/model.rb +++ b/lib/elastic_record/model.rb @@ -1,15 +1,16 @@ module ElasticRecord module Model - def self.included(base) - base.class_eval do - extend Searching - extend ClassMethods - extend FromSearchHit - include Callbacks - include AsDocument + extend ActiveSupport::Concern - singleton_class.delegate :query, :filter, :aggregate, to: :elastic_search - end + included do + extend Searching + extend ClassMethods + extend FromSearchHit + include Callbacks + include AsDocument + + singleton_class.delegate :query, :filter, :aggregate, to: :elastic_search + mattr_accessor :elastic_connection_cache, instance_writer: false end module ClassMethods @@ -36,7 +37,7 @@ end def elastic_connection - @elastic_connection ||= ElasticRecord::Connection.new(ElasticRecord::Config.servers, ElasticRecord::Config.connection_options) + self.elastic_connection_cache ||= ElasticRecord::Connection.new(ElasticRecord::Config.servers, ElasticRecord::Config.connection_options) end end
Use a shared variable for all connections
diff --git a/lib/jasmine_rails/engine.rb b/lib/jasmine_rails/engine.rb index abc1234..def5678 100644 --- a/lib/jasmine_rails/engine.rb +++ b/lib/jasmine_rails/engine.rb @@ -5,7 +5,6 @@ isolate_namespace JasmineRails initializer :assets do |config| - Rails.application.config.assets.debug = false Rails.application.config.assets.paths << Jasmine::Core.path Rails.application.config.assets.paths << JasmineRails.spec_dir end
Use the application's assets.debug config
diff --git a/lib/maguro/app_generator.rb b/lib/maguro/app_generator.rb index abc1234..def5678 100644 --- a/lib/maguro/app_generator.rb +++ b/lib/maguro/app_generator.rb @@ -3,6 +3,9 @@ module Maguro class AppGenerator < Rails::Generators::AppGenerator + + class_option :organization, :type => :string, :aliases => '-o', + :desc => 'Pass in your organization name to be used by heroku and bitbucket' # Overriding Rails::Generators::AppGenerator#finish_template to also run our custom code. def finish_template
Add options to pass in the organization to the commandline
diff --git a/lib/makeprintable/client.rb b/lib/makeprintable/client.rb index abc1234..def5678 100644 --- a/lib/makeprintable/client.rb +++ b/lib/makeprintable/client.rb @@ -1,4 +1,5 @@ require File.expand_path('../client/endpoints.rb', __FILE__) +require File.expand_path('../client/jobs.rb', __FILE__) module MakePrintable class Client
Add jobs as Client extension
diff --git a/lib/tasks/applications.rake b/lib/tasks/applications.rake index abc1234..def5678 100644 --- a/lib/tasks/applications.rake +++ b/lib/tasks/applications.rake @@ -20,4 +20,19 @@ puts "config.oauth_id = '#{a.uid}'" puts "config.oauth_secret = '#{a.secret}'" end + + desc 'Updates domain name for applications' + task :migrate_domain => :environment do + raise "Requires OLD_DOMAIN + NEW_DOMAIN specified in environment" unless ENV['OLD_DOMAIN'] && ENV['NEW_DOMAIN'] + Doorkeeper::Application.find_each do |application| + [:redirect_uri, :home_uri].each do |field| + new_domain = application[field].gsub(ENV['OLD_DOMAIN'], ENV['NEW_DOMAIN']) + if application[field] != new_domain + puts "Migrating #{application.name} - #{field} to new domain: #{new_domain}" + application[field] = new_domain + end + end + application.save! + end + end end
Add rake task to migrate apps to new domain. As part of our migration to Carrenza we are taking the opportunity to sort out some of our domains, namely kill alphagov. We need to have a way to update all signon apps redirect_uri and home_ui.
diff --git a/lib/tasks/generate_erd.rake b/lib/tasks/generate_erd.rake index abc1234..def5678 100644 --- a/lib/tasks/generate_erd.rake +++ b/lib/tasks/generate_erd.rake @@ -1,6 +1,10 @@ desc 'Generate Entity Relationship Diagram' task :generate_erd do system 'bundle exec erd --inheritance --filetype=dot --notation=bachman --direct --attributes=foreign_keys,content' - system 'dot -Tpng erd.dot > erd.png' - File.delete('erd.dot') + dot_file = File.join(Rails.root, 'erd.dot') + + if File.exist? dot_file + system 'dot -Tpng erd.dot > erd.png' + File.delete('erd.dot') + end end
Check file exist in generate erd.
diff --git a/lib/tasks/i18n_hygiene.rake b/lib/tasks/i18n_hygiene.rake index abc1234..def5678 100644 --- a/lib/tasks/i18n_hygiene.rake +++ b/lib/tasks/i18n_hygiene.rake @@ -1,5 +1,20 @@ namespace :i18n do namespace :hygiene do + + desc "check for i18n phrases that contain entities" + task check_entities: :environment do + puts "Checking for phrases that contain entities but probably shouldn't..." + + keys_with_entities = I18n::Hygiene::KeysWithEntities.new + + keys_with_entities.each do |key| + puts "- #{key}" + end + + puts "Finished checking.\n\n" + + exit(1) if keys_with_entities.any? + end desc "Check there are no values containing return symbols" task check_return_symbols: :environment do
Copy check_entities rake task from TC
diff --git a/lib/vagrant-ohai/helpers.rb b/lib/vagrant-ohai/helpers.rb index abc1234..def5678 100644 --- a/lib/vagrant-ohai/helpers.rb +++ b/lib/vagrant-ohai/helpers.rb @@ -1,12 +1,12 @@ module VagrantPlugins module Ohai + # module Helpers - def chef_provisioners - @machine.config.vm.provisioners.find_all {|provisioner| - [:chef_client, :chef_solo].include? provisioner.name } + @machine.config.vm.provisioners.find_all do |provisioner| + [:chef_client, :chef_solo, :chef_zero, :chef_apply].include? provisioner.type + end end - end end end
Add support for new chef provisioners on Vagrant 1.7
diff --git a/config/mdl_style.rb b/config/mdl_style.rb index abc1234..def5678 100644 --- a/config/mdl_style.rb +++ b/config/mdl_style.rb @@ -1,9 +1,9 @@ all -exclude_rule "MD002" +exclude_rule "first-header-h1" -exclude_rule "MD013" +exclude_rule "line-length" -rule "MD026", punctuation: ".,;:!" +rule "no-trailing-punctuation", punctuation: ".,;:!" -exclude_rule "MD041" +exclude_rule "first-line-h1"
Use rule aliases instead of cryptic names
diff --git a/Casks/cura-beta.rb b/Casks/cura-beta.rb index abc1234..def5678 100644 --- a/Casks/cura-beta.rb +++ b/Casks/cura-beta.rb @@ -0,0 +1,13 @@+cask :v1 => 'cura-beta' do + version '15.06.03' + sha256 '60c2fe1c5d7b5e738b7906e67ee66b6ba80a9d0a91f98cd6704af039afa2f732' + + url "http://software.ultimaker.com/15.06/Cura-#{version}-Darwin.dmg" + name 'Cura' + homepage 'https://ultimaker.com/en/products/software' + license :oss + + app 'Cura.app' + + zap :delete => '~/.cura' +end
Add Cura.app v15.06.03 (latest beta) This Cask has been moved from homebrew-cask and renamed 'cura-beta'. It has been upgraded to the latest version. Please find the stable version in homebrew-cask.
diff --git a/test/prawn/emoji/substitution_test.rb b/test/prawn/emoji/substitution_test.rb index abc1234..def5678 100644 --- a/test/prawn/emoji/substitution_test.rb +++ b/test/prawn/emoji/substitution_test.rb @@ -2,25 +2,34 @@ describe Prawn::Emoji::Substitution do let(:document) { Prawn::Document.new } + let(:font_size) { 12 } let(:substitution) { Prawn::Emoji::Substitution.new(document) } + + before do + document.font(font) if font + document.font_size = 12 + end subject { substitution.to_s } - describe 'full-size-space is used' do - before do - document.font_size = 12 - stub(substitution).full_size_space_width { 12 } - end + describe 'When Japanese TTF font' do + let(:font) { Prawn::Emoji.root.join('test', 'fonts', 'ipag.ttf') } it { subject.must_equal ' ' } + it { document.width_of(subject).must_equal font_size } end - describe 'half-size-space is used' do - before do - document.font_size = 12 - stub(substitution).full_size_space_width { 11.99 } - end + describe 'When ASCII TTF font' do + let(:font) { Prawn::Emoji.root.join('test', 'fonts', 'DejaVuSans.ttf') } - it { subject.must_equal Prawn::Text::NBSP } + it { subject.must_match /^#{Prawn::Text::NBSP}+$/ } + it { document.width_of(subject).must_be :>=, font_size - 1 } + it { document.width_of(subject).must_be :<=, font_size + 1 } + end + + describe 'When built-in AFM font' do + let(:font) { nil } + + it { proc { subject }.must_raise Prawn::Errors::IncompatibleStringEncoding } end end
Test against expected width of substitution string Also test against behavior when using built-in AFM font.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,6 +2,7 @@ protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? before_action :authenticate_user! + before_action :response_headers helper_method :correct_user? @@ -14,4 +15,8 @@ def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up, keys: [:username]) end + + def response_headers + response.headers["Vary"]= "Accept" + end end
Stop browser caching json on browser back.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -26,10 +26,6 @@ end def load_current_site - if Rails.env.development? - User.find_by!(domain: 'hmans.io') - else - User.find_by(domain: request.domain) or raise "No user/site found for #{request.domain}" - end + User.find_by(domain: request.host) or raise "No user/site found for #{request.host}" end end
Remove development hack for loading site; also, use request.host for lookup, not .domain.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,7 +3,7 @@ def require_admin # TODO Update when authorization is in place - redirect_to root_path unless current_admin || params[:logged_in] + redirect_to root_path unless current_admin end def current_admin
Remove the :logged_in authentication hack
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,12 @@ # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + before_action :set_current_season + + private + + def set_current_season + @current_season = Season.for(:now) + end end
Add before action for all controllers to get current season.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,6 +7,8 @@ include DeviseTokenAuth::Concerns::SetUserByToken + before_action :configure_permitted_parameters, if: :devise_controller? + protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/json' } respond_to :html,:json @@ -15,4 +17,9 @@ ::Rails.logger.error("Redirected by #{caller(1).first rescue "unknown"}") super(options, response_status) end + + def configure_permitted_parameters + devise_parameter_sanitizer.permit(:sign_up, keys: [:name,:image]) + end + end
Add params to registration step.
diff --git a/test/stripe/invoice_line_item_test.rb b/test/stripe/invoice_line_item_test.rb index abc1234..def5678 100644 --- a/test/stripe/invoice_line_item_test.rb +++ b/test/stripe/invoice_line_item_test.rb @@ -0,0 +1,7 @@+require File.expand_path('../../test_helper', __FILE__) + +module Stripe + class InvoiceLineItemTest < Test::Unit::TestCase + FIXTURE = API_FIXTURES.fetch(:invoice_line_item) + end +end
Add test structure for `InvoiceLineItem` This doesn't come back directly from the API so the suite is empty, but just for completeness add a test file for the newly created `InvoiceLineItem` model.