diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/single_signon.rb b/lib/single_signon.rb index abc1234..def5678 100644 --- a/lib/single_signon.rb +++ b/lib/single_signon.rb @@ -9,6 +9,7 @@ option :client_options, { :site => ENV['AUTH_SITE_URL'] } + option :provider_ignores_state, true uid { raw_info['id'] }
Allow to disable CSRF protection in individual strategies Some OAuth2 providers ignore 'state' parameter, and don't return it back to the client. CSRF protection with this parameter is impossible for such services.
diff --git a/app/controllers/user_votes_controller.rb b/app/controllers/user_votes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/user_votes_controller.rb +++ b/app/controllers/user_votes_controller.rb @@ -1,34 +1,31 @@ class UserVotesController < ApplicationController + def index + @user = current_user + @votes = @user.user_votes.includes(:item).page params[:page] + end -def index - @user = current_user - @votes = @user.user_votes.page params[:page] -end + def new + @user_vote = UserVote.new + end -def new - @user_vote = UserVote.new -end + def create + @item = Item.find(params[:item_id]) + @user_vote = @item.user_votes.build(vote_params) + @user_vote.user = current_user -def create - @item = Item.find(params[:item_id]) - @user_vote = @item.user_votes.build(vote_params) - @user_vote.user = current_user - - if @user_vote.save + if @user_vote.save redirect_to item_path(@item.next) else - render + render :new end + end + + private + def vote_params + params.require(:user_vote).permit( + :vote, + :item_id, + :user_id + ) + end end - -private - - def vote_params - params.require(:user_vote).permit( - :vote, - :item_id, - :user_id - ) - end - -end
Fix Spacing & Add Items When In Index Fix the spacing and add in the items to user votes when the index page loads.
diff --git a/app/models/school/parameter_sanitizer.rb b/app/models/school/parameter_sanitizer.rb index abc1234..def5678 100644 --- a/app/models/school/parameter_sanitizer.rb +++ b/app/models/school/parameter_sanitizer.rb @@ -4,6 +4,8 @@ :name, :town_id, :address, + :contact_name, + :phone, :email, :password, :password_confirmation
Add two missing form params during school signup
diff --git a/FieryCrucible.podspec b/FieryCrucible.podspec index abc1234..def5678 100644 --- a/FieryCrucible.podspec +++ b/FieryCrucible.podspec @@ -11,5 +11,6 @@ s.source = { :git => 'https://github.com/jkolb/FieryCrucible.git', :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/nabobnick' s.ios.deployment_target = '8.0' - s.source_files = 'Sources/*' + s.osx.deployment_target = '10.10' + s.source_files = 'Sources/*.swift' end
Add deployment target for OSX.
diff --git a/activejob_retriable.gemspec b/activejob_retriable.gemspec index abc1234..def5678 100644 --- a/activejob_retriable.gemspec +++ b/activejob_retriable.gemspec @@ -5,7 +5,7 @@ # Describe your gem and declare its dependencies: Gem::Specification.new do |s| - s.name = "activejob_retriable" + s.name = "activejob-retriable" s.version = ActiveJob::Retriable::VERSION s.authors = ["Michael Coyne"] s.email = ["mikeycgto@gmail.com"]
Fix gem name in the gemspec
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -2,7 +2,24 @@ # Cookbook Name:: motd # Recipe:: default # -# Copyright 2013, YOUR_COMPANY_NAME +# Copyright 2013, Rackspace, Us Inc. # -# All rights reserved - Do Not Redistribute +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +case node["platform"] +when "debian" + include_recipe "motd" +when "rhel" + #TODO: add motd template +end
Add motd-tail for debian systems
diff --git a/lib/xss_terminate.rb b/lib/xss_terminate.rb index abc1234..def5678 100644 --- a/lib/xss_terminate.rb +++ b/lib/xss_terminate.rb @@ -9,7 +9,7 @@ module ClassMethods def xss_terminate(options = {}) - before_validation :sanitize_fields + before_save :sanitize_fields class_attribute :xss_terminate_options self.xss_terminate_options = {
Use before_save instead of before_validation Ensures that update_attribute xss terminates fields.
diff --git a/lib/zebra/zpl/raw.rb b/lib/zebra/zpl/raw.rb index abc1234..def5678 100644 --- a/lib/zebra/zpl/raw.rb +++ b/lib/zebra/zpl/raw.rb @@ -4,6 +4,16 @@ module Zpl class Raw include Printable + + attr_reader :width + + def width=(width) + unless (margin.nil? || margin < 1) + @width = (width - (margin*2)) + else + @width = width || 0 + end + end def to_zpl check_attributes
Define width on Raw module
diff --git a/libraries/helpers.rb b/libraries/helpers.rb index abc1234..def5678 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -22,7 +22,7 @@ when 'ubuntu', 'debian' 'www-data' else - fail "Unexpected platform '#{node['platform']}'." + raise "Unexpected platform '#{node['platform']}'." end end end
Replace fail by raise (RuboCop)
diff --git a/ruby-rets.gemspec b/ruby-rets.gemspec index abc1234..def5678 100644 --- a/ruby-rets.gemspec +++ b/ruby-rets.gemspec @@ -19,6 +19,6 @@ s.add_development_dependency "rspec", "~>2.8.0" s.add_development_dependency "guard-rspec", "~>0.6.0" - s.files = Dir.glob("lib/**/*") + %w[GPL-LICENSE MIT-LICENSE README.md CHANGELOG.md] + s.files = Dir.glob("lib/**/*") + %w[GPL-LICENSE MIT-LICENSE README.md CHANGELOG.md Rakefile] s.require_path = "lib" end
Add the Rakefile to the list of gem files as wel
diff --git a/dice.rb b/dice.rb index abc1234..def5678 100644 --- a/dice.rb +++ b/dice.rb @@ -25,6 +25,11 @@ puts "\n" end + # Orders dice in ascending order + def sort() + @five_dice = @five_dice.sort + end + end # testing @@ -33,6 +38,8 @@ (0..5).each do d.roll_all d.display() + d.sort() + d.display() end
Add sort method to Dice class
diff --git a/init.rb b/init.rb index abc1234..def5678 100644 --- a/init.rb +++ b/init.rb @@ -1,3 +1,8 @@ # Include hook code here -ActiveRecord::Base.send(:include, ActsAsHasselhoff)+ActiveRecord::Base.send(:include, ActsAsHasselhoff) + +require 'fileutils' +puts 'dir: ' +puts directory +#FileUtils.chmod(0755, File.join(directory, 'play'))
Set play to be a binary executable git-svn-id: 9867ed3c45c5a294c22e66a9d3216297713dba95@200 ca9fbce6-ab17-0410-af20-b66f06baff09
diff --git a/spec/steps/dead_link_steps.rb b/spec/steps/dead_link_steps.rb index abc1234..def5678 100644 --- a/spec/steps/dead_link_steps.rb +++ b/spec/steps/dead_link_steps.rb @@ -1,5 +1,5 @@ step '表示されている内部リンクは、すべて有効である' do - _, internal_links = all('a').partition {|link| link[:href].start_with? 'http' } + _, internal_links = all('a').partition {|link| link[:href].start_with?('http') || link[:href].start_with?('irc') } fragment_links = internal_links.select {|link| link[:href] =~ /#/ } # ["#active-record-enums"], ["/asset_pipeline.html#css%E3%81%A8erb"]
Add `irc` to exception list
diff --git a/spec/unit/system/page_spec.rb b/spec/unit/system/page_spec.rb index abc1234..def5678 100644 --- a/spec/unit/system/page_spec.rb +++ b/spec/unit/system/page_spec.rb @@ -11,7 +11,7 @@ allow(pager).to receive(:open).and_return(write_io) allow(write_io).to receive(:pid).and_return(pid) status = double(:status, :success? => true) - allow(Process).to receive(:waitpid2).with(pid, 1).and_return([1, status]) + allow(Process).to receive(:waitpid2).with(pid, any_args).and_return([1, status]) expect(pager.page(text)).to eq(true) expect(write_io).to have_received(:write).with(text)
Change to ignore flag for process wait
diff --git a/lib/json-schema.rb b/lib/json-schema.rb index abc1234..def5678 100644 --- a/lib/json-schema.rb +++ b/lib/json-schema.rb @@ -3,6 +3,6 @@ require 'rubygems' require 'schema' require 'validator' -Dir[File.join(File.dirname(__FILE__), "json-schema/attributes/*")].each {|file| require file } -Dir[File.join(File.dirname(__FILE__), "json-schema/validators/*")].each {|file| require file } -require 'uri/file'+Dir[File.join(File.dirname(__FILE__), "json-schema/attributes/*.rb")].each {|file| require file } +Dir[File.join(File.dirname(__FILE__), "json-schema/validators/*.rb")].each {|file| require file } +require 'uri/file'
Fix require of attributes and validators to work in Rubinius When loading attributes and validators json-schema loads all files under attributes and validators dirs, including the byte code cache files generated by Rubinius, with this change we only require .rb files.
diff --git a/services/talker.rb b/services/talker.rb index abc1234..def5678 100644 --- a/services/talker.rb +++ b/services/talker.rb @@ -13,12 +13,10 @@ http.url_prefix = data['url'] if data['digest'].to_i == 1 and commits.size > 1 - commit = commits.last - message = "#{commit['author']['name']} pushed #{commits.size} commits to [#{repository}/#{branch}] #{payload['compare']}" - http_post 'messages.json', :message => message + http_post 'messages.json', :message => "#{summary_message} – #{summary_url}" else - commits.each do |commit| - message = "#{commit['author']['name']} pushed \"#{commit['message'].split("\n").first}\" - #{commit['url']} to [#{repository}/#{branch}]" + http_post 'messages.json', :message => "#{pusher_name} pushed the following commits:" + commit_messages.each do |message| http_post 'messages.json', :message => message end end
Use push helpers to format Talker messages This correctly shows the actual pusher when a push happens instead of whomever committed the last commit. It will also make the message a tad more interesting: Joe Pusher created some-branch from master (+2 new commits) instead of Mary Committer pushed 2 commits
diff --git a/lib/fat_core.rb b/lib/fat_core.rb index abc1234..def5678 100644 --- a/lib/fat_core.rb +++ b/lib/fat_core.rb @@ -1,4 +1,5 @@ require 'fat_core/version' require 'fat_core/patches' +require 'active_support' require 'active_support/core_ext/object/blank' require 'active_support/core_ext/object/deep_dup'
Fix the issue that caused active support to blow up. Issue discussed here: https://github.com/rails/rails/issues/43889
diff --git a/lib/tasks/app.rake b/lib/tasks/app.rake index abc1234..def5678 100644 --- a/lib/tasks/app.rake +++ b/lib/tasks/app.rake @@ -0,0 +1,24 @@+DUMP_PATH = "/tmp/deployer_prod_db.dump" + +namespace :app do + desc "Reset development database from a production dump" + task :reset => [:dump_db, :download_db, :import_db, :"db:migrate", :"db:test:prepare"] do + puts "Done!" + end + + desc "Dump the production DB" + task :dump_db do + system("heroku pgbackups:capture --expire") || exit(1) + end + + # https://devcenter.heroku.com/articles/heroku-postgres-import-export + desc "Download the production dump" + task :download_db do + system("curl", "--output", DUMP_PATH, `heroku pgbackups:url`) || exit(1) + end + + desc "Import the downloaded dump" + task :import_db => [:"db:drop", :"db:create"] do + system(%{pg_restore --no-acl --no-owner -d deployer_development "#{DUMP_PATH}"}) || exit(1) + end +end
Add some simple prod data download scripts.
diff --git a/has_accounts.gemspec b/has_accounts.gemspec index abc1234..def5678 100644 --- a/has_accounts.gemspec +++ b/has_accounts.gemspec @@ -21,7 +21,7 @@ "README.md" ] - s.files = `git ls-files app lib config`.split("\n") + s.files = `git ls-files app lib config db`.split("\n") s.platform = Gem::Platform::RUBY
Include db directory in filespec.
diff --git a/db/migrate/20090621233142_set_correct_type_for_old_events.rb b/db/migrate/20090621233142_set_correct_type_for_old_events.rb index abc1234..def5678 100644 --- a/db/migrate/20090621233142_set_correct_type_for_old_events.rb +++ b/db/migrate/20090621233142_set_correct_type_for_old_events.rb @@ -1,6 +1,3 @@-# TODO CascadeCrossOverall -# TODO RiderRankings -# TODO WSBA BARR class SetCorrectTypeForOldEvents < ActiveRecord::Migration def self.up Bar.find(:all, :conditions => ["date < ?", Date.new(2009)]).each do |discipline_bar_parent| @@ -27,5 +24,9 @@ tabor_overall_2008.type = "TaborOverall" tabor_overall_2008.save! end + + if ASSOCIATION.short_name == "WSBA" + execute "update events set type = 'CascadeCrossOverall' where id = 655" + end end end
Update type for old Cascade Cross Overall
diff --git a/test/unit/lexical_variable_test.rb b/test/unit/lexical_variable_test.rb index abc1234..def5678 100644 --- a/test/unit/lexical_variable_test.rb +++ b/test/unit/lexical_variable_test.rb @@ -0,0 +1,24 @@+require "ikra" +require_relative "unit_test_template" + +class LexicalVariableTest < UnitTestCase + def test_simple_lexical_variable_int + var1 = 10 + + base_array = Array.pnew(100) do |j| + var1 + end + + assert_equal(1000, base_array.reduce(:+)) + end + + def test_simple_lexical_variable_float + var1 = 10.0 + + base_array = Array.pnew(100) do |j| + var1 + end + + assert_in_delta(1000.0, base_array.reduce(:+), 0.001) + end +end
Add test for lexical variables.
diff --git a/lib/crosstest/skeptic/scenario_definition.rb b/lib/crosstest/skeptic/scenario_definition.rb index abc1234..def5678 100644 --- a/lib/crosstest/skeptic/scenario_definition.rb +++ b/lib/crosstest/skeptic/scenario_definition.rb @@ -10,6 +10,7 @@ def initialize(data) super + self.vars ||= Skeptic::TestManifest::Environment.new @full_name = [suite, name].join(' :: ').freeze end
Make sure env isn't nil even if YAML has an empty section
diff --git a/Formula/valec.rb b/Formula/valec.rb index abc1234..def5678 100644 --- a/Formula/valec.rb +++ b/Formula/valec.rb @@ -2,7 +2,7 @@ desc "Handle application secrets securely" homepage "https://github.com/dtan4/valec" url "https://github.com/dtan4/valec/releases/download/v0.3.1/valec-v0.3.1-darwin-amd64.tar.gz" - sha256 "d9d060d81a62643b5acc727216373afa7e3d5d83faf9a9e770421c651c7307a7" + sha256 "c81a5f49f23fe5be19e8078feba9a6e8cb1e5220ad8100585e61b6acc94b1c80" def install bin.install "valec"
Modify checksum of Valec v0.3.1
diff --git a/ZKPulseView.podspec b/ZKPulseView.podspec index abc1234..def5678 100644 --- a/ZKPulseView.podspec +++ b/ZKPulseView.podspec @@ -0,0 +1,23 @@+Pod::Spec.new do |s| + + s.name = "ZKPulseView" + s.version = "0.0.2" + s.summary = "Simple iOS UIView Category to create a Pulse (Breathing light) Effect on your needs" + + s.description = <<-DESC + Display a pulse within a UIView + + * Think: Why did you write this? What is the focus? What does it do? + * CocoaPods will be using this to generate tags, and improve search results. + * Try to keep it short, snappy and to the point. + * Finally, don't worry about the indent, CocoaPods strips it! + DESC + + s.homepage = "https://github.com/Oggerschummer/ZKPulseView" + s.platform = :ios + s.source = { :git => "https://github.com/Oggerschummer/ZKPulseView/Class", :tag => "0.0.2" } + s.source_files = "SuperLogger" + s.frameworks = "Foundation", "UIKit", "MessageUI" + s.requires_arc = yes + +end
Add pod spec, version 0.0.3
diff --git a/htmlentities.gemspec b/htmlentities.gemspec index abc1234..def5678 100644 --- a/htmlentities.gemspec +++ b/htmlentities.gemspec @@ -8,8 +8,10 @@ s.version = HTMLEntities::VERSION::STRING s.author = "Paul Battley" s.email = "pbattley@gmail.com" - s.summary = "A module for encoding and decoding (X)HTML entities." + s.description = "A module for encoding and decoding (X)HTML entities." + s.summary = "Encode/decode HTML entities" s.files = Dir["{lib,test,perf}/**/*.rb"] + s.license = "MIT" s.require_path = "lib" s.test_files = Dir["test/*_test.rb"] s.has_rdoc = true
Add licence (and description) to gemspec
diff --git a/config/initializers/non_digest_assets.rb b/config/initializers/non_digest_assets.rb index abc1234..def5678 100644 --- a/config/initializers/non_digest_assets.rb +++ b/config/initializers/non_digest_assets.rb @@ -1 +1 @@-NonStupidDigestAssets.whitelist = [/tinymce\/.*/, /webfont/, /ajax-running.gif/]+NonStupidDigestAssets.whitelist = [/tinymce\/.*/, /(ttf|woff|eot|svg)$/, /ajax-running.gif/]
Make all font files non-stupid
diff --git a/mark_version.gemspec b/mark_version.gemspec index abc1234..def5678 100644 --- a/mark_version.gemspec +++ b/mark_version.gemspec @@ -1,5 +1,5 @@ Gem::Specification.new do |s| - s.name = 'Mark Version' + s.name = 'mark_version' s.version = '0.0.0' s.date = '2015-05-30' s.summary = 'A tool for recording the version of a ruby application.'
Change gem name to snake case format
diff --git a/db/migrate/20220221155604_hhp_buildings.rb b/db/migrate/20220221155604_hhp_buildings.rb index abc1234..def5678 100644 --- a/db/migrate/20220221155604_hhp_buildings.rb +++ b/db/migrate/20220221155604_hhp_buildings.rb @@ -20,7 +20,7 @@ DatasetEdit.create!( commit_id: commit.id, - key: 'buildings_final_demand_for_space_heating_electricity_buildings_space_heater_hybrid_heatpump_air_water_gas_parent_share', + key: 'buildings_final_demand_for_space_heating_network_gas_buildings_space_heater_hybrid_heatpump_air_water_gas_parent_share', value: 0.0 )
Fix typo in migratie for HHP buildings
diff --git a/lib/language_loader.rb b/lib/language_loader.rb index abc1234..def5678 100644 --- a/lib/language_loader.rb +++ b/lib/language_loader.rb @@ -1,12 +1,16 @@ require_relative 'language' +require_relative 'langs/en' +require_relative 'langs/es' +require_relative 'langs/fr' class LanguageLoader + LANGUAGES = { + en: Language_en.new, + es: Language_es.new, + fr: Language_fr.new, + } + def self.load(lang="en") - begin - require_relative 'langs/' + lang - Object.const_get('Language_' + lang).new - rescue NameError, LoadError - raise NoSuchLanguageError - end + LANGUAGES.fetch(lang.to_sym) { raise NoSuchLanguageError } end end
Change languageloader to preload all known languages
diff --git a/Casks/join-together.rb b/Casks/join-together.rb index abc1234..def5678 100644 --- a/Casks/join-together.rb +++ b/Casks/join-together.rb @@ -0,0 +1,10 @@+cask :v1 => 'join-together' do + version :latest + sha256 :no_check + + url 'http://dougscripts.com/itunes/scrx/jointogetherml.zip' + homepage 'http://dougscripts.com/itunes/itinfo/jointogether.php' + license :commercial + + app 'Join Together.app' +end
Add Join Together.app version 7.2.0 Join Together will create and export a single AAC or ALAC audio file from the audio data of tracks dragged from iTunes or files dragged from the Finder.
diff --git a/pakyow-presenter/lib/presenter/template.rb b/pakyow-presenter/lib/presenter/template.rb index abc1234..def5678 100644 --- a/pakyow-presenter/lib/presenter/template.rb +++ b/pakyow-presenter/lib/presenter/template.rb @@ -37,11 +37,10 @@ container[1][:doc].replace(page.content(name)) rescue MissingContainer # This hasn't proven to be useful in dev (or prd for that matter) - # so decided to move it from debug to info. It'll save us from - # filling console / log with information that will most likely - # just be ignored. + # so decided to remove it. It'll save us from filling console / log + # with information that will most likely just be ignored. # - Pakyow.logger.info "No content for '#{name}' in page '#{page.path}'" + # Pakyow.logger.info "No content for '#{name}' in page '#{page.path}'" end end
Remove no content logger completely
diff --git a/app/helpers/image_helper.rb b/app/helpers/image_helper.rb index abc1234..def5678 100644 --- a/app/helpers/image_helper.rb +++ b/app/helpers/image_helper.rb @@ -2,8 +2,7 @@ def safe_image_tag(image_url, opts={}) return if image_url.blank? - lazyload = opts.delete(:lazyload) - if lazyload + if lazyload = opts.delete(:lazyload) lazyloaded_image_tag(image_tag(image_url, opts)) else image_tag(image_url, opts)
Remove unnecessary line in image helper
diff --git a/app/models/forem/ability.rb b/app/models/forem/ability.rb index abc1234..def5678 100644 --- a/app/models/forem/ability.rb +++ b/app/models/forem/ability.rb @@ -16,9 +16,9 @@ user ||= User.new # anonymous user - if user.can_read_forums? + if user.can_read_forem_forums? can :read, Forem::Forum do |forum| - user.can_read_forum?(forum) + user.can_read_forem_forum?(forum) end end end
Use new 'namespaced' methods in Forem::Ability
diff --git a/tasks/testng_patch.rake b/tasks/testng_patch.rake index abc1234..def5678 100644 --- a/tasks/testng_patch.rake +++ b/tasks/testng_patch.rake @@ -0,0 +1,47 @@+raise "Patch applied upstream " if Buildr::VERSION.to_s > '1.5.8' + +class Buildr::TestNG < TestFramework::Java + + def run(tests, dependencies) #:nodoc: + cmd_args = [] + cmd_args << '-suitename' << task.project.id + cmd_args << '-sourcedir' << task.compile.sources.join(';') if TestNG.version < '6.0' + cmd_args << '-log' << '2' + cmd_args << '-d' << task.report_to.to_s + exclude_args = options[:excludegroups] || [] + unless exclude_args.empty? + cmd_args << '-excludegroups' << exclude_args.join(',') + end + groups_args = options[:groups] || [] + unless groups_args.empty? + cmd_args << '-groups' << groups_args.join(',') + end + # run all tests in the same suite + cmd_args << '-testclass' << (TestNG.version < '6.0' ? test : tests.join(',')) + + cmd_args += options[:args] if options[:args] + cmd_options = { :properties => options[:properties], :java_args => options[:java_args], + :classpath => dependencies, :name => "TestNG in #{task.send(:project).name}" } + + tmp = nil + begin + tmp = Tempfile.open('testNG') + tmp.write cmd_args.join("\n") + tmp.close + Java::Commands.java ['org.testng.TestNG', "@#{tmp.path}"], cmd_options + ensure + tmp.close unless tmp.nil? + end + # testng-failed.xml contains the list of failed tests *only* + failed_tests = File.join(task.report_to.to_s, 'testng-failed.xml') + if File.exist?(failed_tests) + report = File.read(failed_tests) + failed = report.scan(/<class name="(.*?)">/im).flatten + # return the list of passed tests + return tests - failed + else + return tests + end + end +end +
Patch the TestNG addon to ensure that test failures result in a failed build.
diff --git a/lib/conoha_api/client/identity.rb b/lib/conoha_api/client/identity.rb index abc1234..def5678 100644 --- a/lib/conoha_api/client/identity.rb +++ b/lib/conoha_api/client/identity.rb @@ -18,7 +18,7 @@ } } - post "tokens", request_json, no_auth: true + post "/v2.0/tokens", request_json, no_auth: true end end end
Add Identity API version 2.0
diff --git a/lib/ice_nine/freezer/no_freeze.rb b/lib/ice_nine/freezer/no_freeze.rb index abc1234..def5678 100644 --- a/lib/ice_nine/freezer/no_freeze.rb +++ b/lib/ice_nine/freezer/no_freeze.rb @@ -23,16 +23,16 @@ end # class NoFreeze - # A freezer class for handling nil objects + # Skip freezing nil objects class NilClass < NoFreeze; end - # A freezer class for handling TrueClass objects + # Skip freezing true objects class TrueClass < NoFreeze; end - # A freezer class for handling FalseClass objects + # Skip freezing false objects class FalseClass < NoFreeze; end - # A freezer class for handling Symbol objects + # Skip freezing Symbol objects class Symbol < NoFreeze; end end # class Freezer
Change NoFreeze subclass summaries to be more clear
diff --git a/lib/pacer/pipe/expandable_pipe.rb b/lib/pacer/pipe/expandable_pipe.rb index abc1234..def5678 100644 --- a/lib/pacer/pipe/expandable_pipe.rb +++ b/lib/pacer/pipe/expandable_pipe.rb @@ -32,12 +32,10 @@ if @queue.isEmpty @next_metadata = nil r = @starts.next - if @path_enabled - if @starts.respond_to? :path - @next_path = @starts.path - else - @next_path = java.util.ArrayList.new - end + if @starts.respond_to? :path + @next_path = @starts.path + else + @next_path = java.util.ArrayList.new end r else
Remove reference to @path_enabled. Let's make things less efficient!
diff --git a/app/lib/services.rb b/app/lib/services.rb index abc1234..def5678 100644 --- a/app/lib/services.rb +++ b/app/lib/services.rb @@ -36,7 +36,7 @@ end def self.oidc - @oidc ||= OidcClient.new( + OidcClient.new( accounts_api, ENV.fetch("GOVUK_ACCOUNT_OAUTH_CLIENT_ID"), ENV.fetch("GOVUK_ACCOUNT_OAUTH_CLIENT_SECRET"),
Remove instance variable assignment for Services.oidc This has no effect. Module "instance variables" are assigned in any class which includes the module, but this module isn't included anywhere. This just caused me some confusion, as I was trying to work out if the `OidcClient` instance would persist between requests. It won't. So remove the confusing `@`.
diff --git a/app/models/round.rb b/app/models/round.rb index abc1234..def5678 100644 --- a/app/models/round.rb +++ b/app/models/round.rb @@ -33,7 +33,7 @@ end def winner - donations.max_by { |d| d.amount } unless !closed or failed + donations.max_by { |d| d.amount } if success? end def failed @@ -41,11 +41,7 @@ end def total_raised - if closed and not failed - donations.inject(0) { |sum, donation| sum + donation.amount} - else - 0 - end + success? ? donations.inject(0) { |sum, donation| sum + donation.amount} : 0 end def success?
Simplify logic using Round.success? method
diff --git a/lib/readline-ng/chunked_string.rb b/lib/readline-ng/chunked_string.rb index abc1234..def5678 100644 --- a/lib/readline-ng/chunked_string.rb +++ b/lib/readline-ng/chunked_string.rb @@ -11,7 +11,12 @@ def each_chunk until @buf.empty? - yield @buf.slice!(0) + t = @buf.slice!(0) + if t == "\e" + t += @buf.slice!(0..1) + end + + yield t end end
Make the optimistic assumption that all escapes are 2 bytes
diff --git a/lib/spree/api/controller_setup.rb b/lib/spree/api/controller_setup.rb index abc1234..def5678 100644 --- a/lib/spree/api/controller_setup.rb +++ b/lib/spree/api/controller_setup.rb @@ -1,3 +1,5 @@+require 'spree/core/controller_helpers/auth' + module Spree module Api module ControllerSetup
Fix class-loading issue in test suite Fixes: ``` Failure/Error: include Spree::Core::ControllerHelpers::Auth NameError: uninitialized constant Spree::Core::ControllerHelpers::Auth # ./lib/spree/api/controller_setup.rb:19:in `block in included' # ./lib/spree/api/controller_setup.rb:5:in `class_eval' # ./lib/spree/api/controller_setup.rb:5:in `included' # ./app/controllers/api/base_controller.rb:9:in `include' # ./app/controllers/api/base_controller.rb:9:in `<class:BaseController>' # ./app/controllers/api/base_controller.rb:6:in `<module:Api>' # ./app/controllers/api/base_controller.rb:5:in `<top (required)>' # ./app/controllers/api/products_controller.rb:5:in `<module:Api>' # ./app/controllers/api/products_controller.rb:4:in `<top (required)>' # ./spec/controllers/api/products_controller_spec.rb:6:in `<top (required)>' ```
diff --git a/lib/user_agent/browsers/itunes.rb b/lib/user_agent/browsers/itunes.rb index abc1234..def5678 100644 --- a/lib/user_agent/browsers/itunes.rb +++ b/lib/user_agent/browsers/itunes.rb @@ -0,0 +1,68 @@+class UserAgent + module Browsers + # The user agent for iTunes + # + # Some user agents: + # iTunes/10.6.1 (Macintosh; Intel Mac OS X 10.7.3) AppleWebKit/534.53.11 + # iTunes/12.0.1 (Macintosh; OS X 10.10) AppleWebKit/0600.1.25 + # iTunes/11.1.5 (Windows; Microsoft Windows 7 x64 Business Edition Service Pack 1 (Build 7601)) AppleWebKit/537.60.15 + # iTunes/12.0.1 (Windows; Microsoft Windows 8 x64 Home Premium Edition (Build 9200)) AppleWebKit/7600.1017.0.24 + # iTunes/12.0.1 (Macintosh; OS X 10.10.1) AppleWebKit/0600.1.25 + class ITunes < Webkit + def self.extend?(agent) + agent.detect { |useragent| useragent.product == "iTunes" } + end + + # @return ["iTunes"] Always return iTunes as the browser + def browser + "iTunes" + end + + # @return [Version] The version of iTunes in use + def version + self.iTunes.version + end + + # @return [nil] nil - not included in the user agent + def security + nil + end + + # Parses the operating system in use. + # + # @return [String] The operating system + def os + full_os = self.full_os + + if application && application.comment[0] =~ /Windows/ + if full_os =~ /Windows 8\.1/ + "Windows 8.1" + elsif full_os =~ /Windows 8/ + "Windows 8" + elsif full_os =~ /Windows 7/ + "Windows 7" + elsif full_os =~ /Windows Vista/ + "Windows Vista" + elsif full_os =~ /Windows XP/ + "Windows XP" + else + "Windows" + end + else + super + end + end + + # Parses the operating system in use. + # + # @return [String] The operating system + def full_os + full_os = application.comment[1] + + full_os = "#{full_os})" if full_os =~ /\(Build [0-9][0-9][0-9][0-9]\z/ # The regex chops the ) off :( + + return full_os + end + end + end +end
Add a user agent parser for iTunes
diff --git a/app/models/concerns/course_user/achievements_concern.rb b/app/models/concerns/course_user/achievements_concern.rb index abc1234..def5678 100644 --- a/app/models/concerns/course_user/achievements_concern.rb +++ b/app/models/concerns/course_user/achievements_concern.rb @@ -2,6 +2,7 @@ module CourseUser::AchievementsConcern # Order achievements based on when each course_user obtained the achievement. def ordered_by_date_obtained + unscope(:order). order('course_user_achievements.obtained_at DESC') end
Order achievement by date obtained only
diff --git a/test/generators/app_generator_test.rb b/test/generators/app_generator_test.rb index abc1234..def5678 100644 --- a/test/generators/app_generator_test.rb +++ b/test/generators/app_generator_test.rb @@ -28,28 +28,37 @@ private def default_files - %W(.gitignore - Gemfile - Rakefile - config.ru - app/controllers - app/mailers - app/models - bin/bundle - bin/rails - bin/rake - config/environments - config/initializers - config/locales - db - lib - lib/tasks - lib/assets - log - test/fixtures - test/#{generated_test_funcional_dir} - test/integration - test/#{generated_test_unit_dir}) + files = %W( + .gitignore + Gemfile + Rakefile + config.ru + app/controllers + app/mailers + app/models + config/environments + config/initializers + config/locales + db + lib + lib/tasks + lib/assets + log + test/fixtures + test/#{generated_test_funcional_dir} + test/integration + test/#{generated_test_unit_dir} + ) + files.concat rails4? ? default_files_rails4 : default_files_rails3 + files + end + + def default_files_rails3 + %w(script/rails) + end + + def default_files_rails4 + %w(bin/bundle bin/rails bin/rake) end def skipped_files
Test against a different list of generated files for Rails 3 and 4 Bring tests back to green in 3.2.
diff --git a/spec/tube_spec.rb b/spec/tube_spec.rb index abc1234..def5678 100644 --- a/spec/tube_spec.rb +++ b/spec/tube_spec.rb @@ -31,5 +31,14 @@ it 'composes' do expect(subject.run(4)).to eq 22 end + + describe 'associative law' do + let(:a) { (tube_a >> tube_b) >> tube_c } + let(:b) { tube_a >> (tube_b >> tube_c) } + + it 'keeps' do + expect(a.run(5)).to eq b.run(5) + end + end end end
Add associative law for tube
diff --git a/spec/angular_spec.rb b/spec/angular_spec.rb index abc1234..def5678 100644 --- a/spec/angular_spec.rb +++ b/spec/angular_spec.rb @@ -7,6 +7,7 @@ end it 'successfully loads angularjs.org twice' do + raise 'test failed by env FAIL_TEST' if ENV['FAIL_TEST'] angular_page.goto expect_true angular_page.download_button.include?('Download') end
Allow optionally failing test to demo error reporting
diff --git a/spec/version_spec.rb b/spec/version_spec.rb index abc1234..def5678 100644 --- a/spec/version_spec.rb +++ b/spec/version_spec.rb @@ -1,7 +1,27 @@ require 'spec_helper' -describe "#{Github::Status} VERSION" do +describe "#{Github::Status} version information" do it "should be version 0.0.1" do Github::VERSION.should == "0.0.1" end + + it "should have authors" do + Github::AUTHORS.should_not be_empty + end + + it "should have email addresses" do + Github::EMAIL.should_not be_empty + end + + it "should have a summary" do + Github::SUMMARY.should == "Github Status API" + end + + it "should have a homepage" do + Github::HOMEPAGE.should == "https://github.com/murraysum/github_status" + end + + it "should have a description" do + Github::DESCRIPTION.should_not be_empty + end end
Add specs to check the gem specification information.
diff --git a/cookbooks/windows_setup/attributes/default.rb b/cookbooks/windows_setup/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/windows_setup/attributes/default.rb +++ b/cookbooks/windows_setup/attributes/default.rb @@ -19,6 +19,8 @@ default['windows_setup']['packages'] = %w( 7zip + ConEmu + EthanBrown.ConEmuConfig Firefox autohotkey git
Add ConEmu and Ethan Brown's config for it.
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,6 +26,7 @@ get :value_by_county get :value_by_donor get :total_inventory_value + get :orders_by_create_date_graph end end
Add new route for orders_by_create_date_graph
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,7 @@ get '/auth/:provider/callback' => 'sessions#create' get '/signin' => 'sessions#new', :as => :signin - # get '/signout' => 'sessions#destroy', :as => :signout + get '/signout' => 'sessions#destroy', :as => :signout # get '/auth/failure' => 'sessions#failure' root 'welcome#index'
Comment /signout route back in
diff --git a/railties/lib/rails/application_controller.rb b/railties/lib/rails/application_controller.rb index abc1234..def5678 100644 --- a/railties/lib/rails/application_controller.rb +++ b/railties/lib/rails/application_controller.rb @@ -3,6 +3,15 @@ class Rails::ApplicationController < ActionController::Base # :nodoc: self.view_paths = File.expand_path("templates", __dir__) layout "application" + + before_action :disable_content_security_policy_nonce! + + content_security_policy do |policy| + if policy + policy.script_src :unsafe_inline + policy.style_src :unsafe_inline + end + end private @@ -15,4 +24,8 @@ def local_request? Rails.application.config.consider_all_requests_local || request.local? end + + def disable_content_security_policy_nonce! + request.content_security_policy_nonce_generator = nil + end end
Allow using inline style and script in the internal controllers We use inline style and script for the view held inside Rails like welcome page and mailer preview. Therefore, if inline is prohibited by CSP, they will not work properly. I think that this is not as expected.   For that reason, I have made it possible to use inline style and script regardless of application settings.
diff --git a/core_gems.rb b/core_gems.rb index abc1234..def5678 100644 --- a/core_gems.rb +++ b/core_gems.rb @@ -7,5 +7,6 @@ download "yajl-ruby", "1.2.1" download "sigdump", "0.2.3" download "thread_safe", "0.3.5" +download "oj", "2.14.2" download "tzinfo", "1.2.2" download "tzinfo-data", "1.2015.7"
Add 'oj' gem to core
diff --git a/core_examples.rb b/core_examples.rb index abc1234..def5678 100644 --- a/core_examples.rb +++ b/core_examples.rb @@ -1,9 +1,9 @@ require_relative 'core.rb' require_relative 'testing.rb' Title["Tuples (2)"] -tuple = Cons[1][2] -puts (Car[tuple] == 1 ? "T" : "F") -puts (Cdr[tuple] == 2 ? "T" : "F") +tuple = Cons[$one][$two] +Assert[NumbersEqual[$one][Car[tuple]]] +Assert[NumbersEqual[$two][Cdr[tuple]]] Title["Logic"]
Swap literals and Ruby puts with numerals and assertions
diff --git a/app/controllers/concerns/pageable.rb b/app/controllers/concerns/pageable.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/pageable.rb +++ b/app/controllers/concerns/pageable.rb @@ -8,6 +8,9 @@ if params[:q].present? @page = params[:q][:page] @per_page = params[:q][:per_page] + else + @page = params[:page] + @per_page = params[:per_page] end end end
Allow paging params outside of search params
diff --git a/app/controllers/heroes_controller.rb b/app/controllers/heroes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/heroes_controller.rb +++ b/app/controllers/heroes_controller.rb @@ -28,6 +28,11 @@ redirect_to campaign_hero_path(campaign, hero) end + def destroy + hero.destroy + redirect_to campaign_heroes_path(campaign) + end + def hero_params params.require(:hero).permit( :name, :archetype, :race, :alignment, :deity, :titles, :appearance, :background, :mechanics
Add destroy method in hero controller. [#89850086]
diff --git a/app/controllers/listen_controller.rb b/app/controllers/listen_controller.rb index abc1234..def5678 100644 --- a/app/controllers/listen_controller.rb +++ b/app/controllers/listen_controller.rb @@ -8,8 +8,8 @@ stream_server = $ICECAST_SERVER elsif request.host != default_url_options.to_h[:host] stream_server = 'cdnstream.phate.io' - elsif @icy_metadata.to_s == '1' || @useragent.to_s.downcase.include?('mobile') - stream_server = 'stream.dallas.phate.io' + # elsif @icy_metadata.to_s == '1' || @useragent.to_s.downcase.include?('mobile') + # stream_server = 'stream.dallas.phate.io' else stream_server = 'stream.phate.io' end
Remove mobile stream server URL
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index abc1234..def5678 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,4 +1,10 @@ class SearchController < ApplicationController def index end + + def google + keywords = params[:q] || '' + keyword.gsub('#', '%23') + redirect_to "https://www.google.com/#hl=zh-CN&q=site:cc98.org+#{keywords}" + end end
Add the google search method.
diff --git a/app/controllers/twitch_controller.rb b/app/controllers/twitch_controller.rb index abc1234..def5678 100644 --- a/app/controllers/twitch_controller.rb +++ b/app/controllers/twitch_controller.rb @@ -37,7 +37,7 @@ end def redirect_uri - 'http://splits.io/login/twitch/auth' + "http://#{request.host_with_port}/login/twitch/auth" end end
Update Twitch login to work locally (or anywhere)
diff --git a/app/helpers/flash_messages_helper.rb b/app/helpers/flash_messages_helper.rb index abc1234..def5678 100644 --- a/app/helpers/flash_messages_helper.rb +++ b/app/helpers/flash_messages_helper.rb @@ -31,7 +31,7 @@ def filtered_flash_messages flash.select do |message| - %i(alert notice).include? message.first + %w(alert notice).include? message.first end.to_h end end
Fix flash messages specs for rails 4.1.1
diff --git a/cxml.gemspec b/cxml.gemspec index abc1234..def5678 100644 --- a/cxml.gemspec +++ b/cxml.gemspec @@ -16,9 +16,9 @@ s.add_dependency "xml-simple", "~> 1.1.5" s.add_dependency "hashr", "~> 2.0" - s.files = `git ls-files`.split("\n") - s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)} + s.files = Dir['lib/*.rb'] + Dir['lib/cxml/*.rb'] + Dir['bin/*'] + s.files += Dir['[A-Z]*'] + Dir['spec/**/*'] + s.require_paths = ["lib"] s.required_ruby_version = ">= 2.3.1" end
Simplify including files in gemspec
diff --git a/lib/azure/armrest.rb b/lib/azure/armrest.rb index abc1234..def5678 100644 --- a/lib/azure/armrest.rb +++ b/lib/azure/armrest.rb @@ -1,5 +1,6 @@ require 'rest-client' require 'json' +require 'thread' # The Azure module serves as a namespace. module Azure
Add the thread library as a requirement.
diff --git a/yard.gemspec b/yard.gemspec index abc1234..def5678 100644 --- a/yard.gemspec +++ b/yard.gemspec @@ -8,10 +8,10 @@ s.homepage = "http://yard.soen.ca" s.platform = Gem::Platform::RUBY s.summary = "A documentation tool for consistent and usable documentation in Ruby." - s.files = Dir.glob("{bin,lib,test,templates}/**/*") + ['LICENSE.txt', 'README.pdf'] + s.files = Dir.glob("{bin,lib,test,templates}/**/*") + ['LICENSE.txt', 'README.txt', 'help.pdf'] s.executables = [ 'yardoc', 'yri' ] s.add_dependency 'erubis' -# s.has_rdoc = false + s.has_rdoc = false end
Update gemspec to deal with new README files git-svn-id: d05f03cd96514e1016f6c27423275d989868e1f9@809 a99b2113-df67-db11-8bcc-000c76553aea
diff --git a/zend.gemspec b/zend.gemspec index abc1234..def5678 100644 --- a/zend.gemspec +++ b/zend.gemspec @@ -27,4 +27,5 @@ spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 2.14' + spec.add_development_dependency 'pry' end
Add Pry as a development dependency for easy debugging
diff --git a/lib/faraday/parse.rb b/lib/faraday/parse.rb index abc1234..def5678 100644 --- a/lib/faraday/parse.rb +++ b/lib/faraday/parse.rb @@ -10,7 +10,7 @@ def self.register_on_complete(env) env[:response].on_complete do |response| response[:body] = begin - case response[:response_headers]['content-type'] + case response[:response_headers].values_at('content-type', 'Content-Type').first when /application\/json/ parse_json(response[:body]) when /application\/xml/
Allow capitalized content-type response header
diff --git a/lib/coderay/encoders/token_class_filter.rb b/lib/coderay/encoders/token_class_filter.rb index abc1234..def5678 100644 --- a/lib/coderay/encoders/token_class_filter.rb +++ b/lib/coderay/encoders/token_class_filter.rb @@ -21,8 +21,9 @@ end def text_token text, kind - [text, kind] if !@exclude.include?(kind) && - (@include == :all || @include.include?(kind)) + [text, kind] if \ + (@include == :all || @include.include?(kind)) && + !(@exclude == :all || @exclude.include?(kind)) end end
TokenClassFilter: Support for :exclud => :all.
diff --git a/lib/grunt/handler.rb b/lib/grunt/handler.rb index abc1234..def5678 100644 --- a/lib/grunt/handler.rb +++ b/lib/grunt/handler.rb @@ -26,7 +26,7 @@ rescue StackDepthError => e notice(%{"#{e.command}" called too many methods!}, response.sender.nick) rescue Timeout::Error - notice(%{"#{e.command}" timed out after #{timeout} seconds!}, response.sender.nick) + notice(%{"#{command[:name]}" timed out after #{timeout} seconds!}, response.sender.nick) rescue => e notice(%{Error in "#{command[:name]}": #{e.message}}, response.sender.nick) log(:debug, e.message)
Correct small mistake in c25b9e3
diff --git a/lib/rescue_from_duplicate/active_record.rb b/lib/rescue_from_duplicate/active_record.rb index abc1234..def5678 100644 --- a/lib/rescue_from_duplicate/active_record.rb +++ b/lib/rescue_from_duplicate/active_record.rb @@ -15,6 +15,7 @@ klasses.each do |klass| klass._rescue_from_duplicate_handlers.each do |handler| + next unless klass.connection.table_exists?(klass.table_name) unique_indexes = klass.connection.indexes(klass.table_name).select(&:unique) unless unique_indexes.any? { |index| index.columns.map(&:to_s).sort == handler.columns }
Handle cases where a model table is missing
diff --git a/BulletinBoard.podspec b/BulletinBoard.podspec index abc1234..def5678 100644 --- a/BulletinBoard.podspec +++ b/BulletinBoard.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "BulletinBoard" - s.version = "2.0.0-beta.1" + s.version = "2.0.0" s.summary = "Generate and Display Bottom Card Interfaces for iOS" s.description = <<-DESC BulletinBoard is an iOS library that generates and manages contextual cards displayed at the bottom of the screen. It is especially well suited for quick user interactions such as onboarding screens or configuration.
Update Podspec with version number
diff --git a/abyss.rb b/abyss.rb index abc1234..def5678 100644 --- a/abyss.rb +++ b/abyss.rb @@ -11,7 +11,7 @@ depends_on 'google-sparsehash' => :build # Snow Leopard comes with mpi but Lion does not - depends_on 'open-mpi' if MacOS.lion? + depends_on 'open-mpi' if MacOS.version >= :lion # strip breaks the ability to read compressed files. skip_clean 'bin'
Clean up MacOS version method usage The MacOS.version? family of methods (other than "leopard?") are poorly defined and lead to confusing code. Replace them in formulae with more explicit comparisons. "MacOS.version" is a special version object that can be compared to numerics, symbols, and strings using the standard Ruby comparison methods. The old methods were moved to compat when the version comparison code was merged, and they must remain there "forever", but they should not be used in new code. Signed-off-by: Jack Nagel <43386ce32af96f5c56f2a88e458cb94cebee3751@gmail.com>
diff --git a/omnibus_overrides.rb b/omnibus_overrides.rb index abc1234..def5678 100644 --- a/omnibus_overrides.rb +++ b/omnibus_overrides.rb @@ -19,4 +19,4 @@ override "util-macros", version: "1.19.0" override "xproto", version: "7.0.28" override "zlib", version: "1.2.11" -override "openssl", version: "1.1.0g" +override "openssl", version: "1.0.2n"
Revert "Upgrade to openssl 1.1" This reverts commit a67304414d83b06ea16cb92ca28ec0d5d0572028.
diff --git a/dropbox-archive.gemspec b/dropbox-archive.gemspec index abc1234..def5678 100644 --- a/dropbox-archive.gemspec +++ b/dropbox-archive.gemspec @@ -8,9 +8,9 @@ spec.version = Dropbox::Archive::VERSION spec.authors = ["Josh McArthur"] spec.email = ["joshua.mcarthur@gmail.com"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} - spec.homepage = "" + spec.description = %q{Automatically upload files to dropbox and remove them from the local filesystem when they are added to a folder} + spec.summary = %q{Upload files to Dropbox and delete from local filesystem.} + spec.homepage = "https://github.com/joshmcarthur/dropbox-archive" spec.license = "MIT" spec.files = `git ls-files`.split($/) @@ -20,4 +20,6 @@ spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" + spec.add_dependency "dropbox-sdk" + spec.add_dependency "guard" end
Add description, summary and dependencies for notes
diff --git a/uk_account_validator.gemspec b/uk_account_validator.gemspec index abc1234..def5678 100644 --- a/uk_account_validator.gemspec +++ b/uk_account_validator.gemspec @@ -10,7 +10,7 @@ spec.email = ['hayden@haydenball.me.uk'] spec.summary = 'Validate UK Account Numbers and Sort Codes' spec.description = spec.summary - spec.homepage = '' + spec.homepage = 'https://github.com/ball-hayden/uk_account_validator' spec.license = '2 Clause BSD' spec.files = `git ls-files -z`.split("\x0")
Add GitHub as homepage for Gemspec
diff --git a/app/controllers/dataset_file_schemas_controller.rb b/app/controllers/dataset_file_schemas_controller.rb index abc1234..def5678 100644 --- a/app/controllers/dataset_file_schemas_controller.rb +++ b/app/controllers/dataset_file_schemas_controller.rb @@ -1,7 +1,7 @@ class DatasetFileSchemasController < ApplicationController def index - @dataset_file_schemas = DatasetFileSchema.where(user: current_user).paginate(page: params[:page], per_page: 7).order(name: :asc) + @dataset_file_schemas = DatasetFileSchema.where(user: current_user).paginate(page: params[:page], per_page: 20).order(name: :asc) end def show
Add extra default rows for tables
diff --git a/lib/chef/platform.rb b/lib/chef/platform.rb index abc1234..def5678 100644 --- a/lib/chef/platform.rb +++ b/lib/chef/platform.rb @@ -16,6 +16,7 @@ # limitations under the License. # +# Order of these headers is important: query helpers is needed by many things require 'chef/platform/query_helpers' require 'chef/platform/provider_mapping'
Add comment about header ordering
diff --git a/lib/dap/input/csv.rb b/lib/dap/input/csv.rb index abc1234..def5678 100644 --- a/lib/dap/input/csv.rb +++ b/lib/dap/input/csv.rb @@ -26,7 +26,10 @@ end if self.has_header - self.headers = read_record.values.map{|x| x.to_s.strip } + data = read_record + unless data == :eof + self.headers = data.values.map{|x| x.to_s.strip } + end end end @@ -54,4 +57,4 @@ end end -end+end
Fix exception on first line returning EOF
diff --git a/yard_extensions.rb b/yard_extensions.rb index abc1234..def5678 100644 --- a/yard_extensions.rb +++ b/yard_extensions.rb @@ -4,9 +4,8 @@ def process statement.tokens[1..-1].each do |token| - name = token.text.strip - next if name.empty? || name == ',' - name = name[1..-1] if name[0,1] == ':' + next unless token.text =~ /^:?(\w+)/ + name = $1 object = YARD::CodeObjects::MethodObject.new(namespace, name) register(object) object.dynamic = true
Use a regexp to make matching the response attr names a bit easier to read.
diff --git a/lib/fed/http/curb.rb b/lib/fed/http/curb.rb index abc1234..def5678 100644 --- a/lib/fed/http/curb.rb +++ b/lib/fed/http/curb.rb @@ -5,6 +5,7 @@ def self.get(url) Curl.get(url) do|http| http.headers['User-Agent'] = Fed::Http.options[:user_agent] + http.follow_location = true end.body_str end end
Make sure we follow redirects
diff --git a/lib/giraph/schema.rb b/lib/giraph/schema.rb index abc1234..def5678 100644 --- a/lib/giraph/schema.rb +++ b/lib/giraph/schema.rb @@ -1,13 +1,13 @@ module Giraph # GraphQL::Schema wrapper allowing decleration of # resolver objects per op type (query or mutation) - class Schema < GraphQL::Schema + class Schema < DelegateClass(GraphQL::Schema) # Extract special arguments for resolver objects, # let the rest pass-through def initialize(**args) @query_resolver = args.delete(:query_resolver) @mutation_resolver = args.delete(:mutation_resolver) - super + super(GraphQL::Schema.new(**args)) end # Defer the execution only after setting up @@ -19,6 +19,8 @@ super(query, **args) end + + private def with_giraph_root(args) # Extract & remove the special __giraph_root__ key
Convert Giraph::Schema from subclass to a delegator
diff --git a/spec/controllers/checkins_controller_spec.rb b/spec/controllers/checkins_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/checkins_controller_spec.rb +++ b/spec/controllers/checkins_controller_spec.rb @@ -10,12 +10,17 @@ end it "assigns @checkins to the appropriate places' checkins" do + checkins = FactoryGirl.create_list(:checkin, 3, place_id: place.id) get :index, place_id: place.id - expect(assigns(:checkins).length).to eq(1) + expect(assigns(:checkins).length).to eq(3) end end context "when a place does not exist" do + it "assigns 'The place that you requested does not exist.' as a flash[:notice]" do + get :index, place_id: Faker::Number.number(5) + expect(flash[:notice]).to eq("The place that you requested does not exist.") + end end end end
Write tests for the index route of the checkins controller
diff --git a/spec/features/configure_project_name_spec.rb b/spec/features/configure_project_name_spec.rb index abc1234..def5678 100644 --- a/spec/features/configure_project_name_spec.rb +++ b/spec/features/configure_project_name_spec.rb @@ -0,0 +1,29 @@+require 'spec_helper' +require './features/step_definitions/testing_dsl' + +describe "Project name" do + # As a developer + # I want to assign a name for my project + # So that the reports show it + + let(:user) { LicenseFinder::TestingDSL::User.new } + + before { user.create_empty_project } + + specify "appears in the HTML report" do + user.execute_command 'license_finder project_name add my_proj' + + expect(user.html_title).to have_content 'my_proj' + end + + specify "appears in the CLI" do + user.execute_command 'license_finder project_name add my_proj' + expect(user).to be_seeing 'my_proj' + user.execute_command 'license_finder project_name show' + expect(user).to be_seeing 'my_proj' + + user.execute_command 'license_finder project_name remove' + user.execute_command 'license_finder project_name show' + expect(user).to_not be_seeing 'my_proj' + end +end
Convert project name integration test to RSpec
diff --git a/diplomat.gemspec b/diplomat.gemspec index abc1234..def5678 100644 --- a/diplomat.gemspec +++ b/diplomat.gemspec @@ -19,6 +19,6 @@ spec.add_development_dependency "gem-release", "~> 0.7" spec.add_development_dependency "cucumber", "~> 2.0" - spec.add_runtime_dependency "json", "~> 1.8" + spec.add_runtime_dependency "json" spec.add_runtime_dependency "faraday", "~> 0.9" end
Remove restriction on json version
diff --git a/veil.gemspec b/veil.gemspec index abc1234..def5678 100644 --- a/veil.gemspec +++ b/veil.gemspec @@ -12,7 +12,7 @@ spec.summary = %q{Veil is a Ruby Gem for generating secure secrets from a shared secret} spec.description = spec.summary spec.license = "Apache-2.0" - spec.homepage = "https://github.com/chef/chef-server/" + spec.homepage = "https://github.com/chef/chef_secrets/" spec.files = Dir.glob("{bin,lib,spec}/**/*").reject { |f| File.directory?(f) } + ["LICENSE"] spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
Change homepage from chef server to chef secrets ...where the code actually lives. =^)
diff --git a/spec/features/admin/authentication_spec.rb b/spec/features/admin/authentication_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin/authentication_spec.rb +++ b/spec/features/admin/authentication_spec.rb @@ -9,17 +9,14 @@ let!(:enterprise) { create(:enterprise, owner: user) } # Required for access to admin scenario "logging into admin redirects home, then back to admin" do - # This is the first admin spec, so give a little extra load time for slow systems - Capybara.using_wait_time(120) do - visit spree.admin_dashboard_path + visit spree.admin_dashboard_path - fill_in "Email", with: user.email - fill_in "Password", with: user.password - click_login_button - expect(page).to have_content "DASHBOARD" - expect(page).to have_current_path spree.admin_dashboard_path - expect(page).to have_no_content "CONFIGURATION" - end + fill_in "Email", with: user.email + fill_in "Password", with: user.password + click_login_button + expect(page).to have_content "DASHBOARD" + expect(page).to have_current_path spree.admin_dashboard_path + expect(page).to have_no_content "CONFIGURATION" end scenario "viewing my account" do
Simplify spec, the 2 minutes wait is not necessary anylonger
diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index abc1234..def5678 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -8,6 +8,11 @@ def show @item = Item.find params[:id] @user_vote = UserVote.new + + unless current_user == nil + @past_vote = @item.user_votes.where(user_id: current_user.id, item_id: @item.id) + @past_vote = @past_vote.first.vote unless @past_vote.count == 0 + end end private
Add past_vote variable to items controller
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -1,5 +1,5 @@ class PostsController < ApplicationController def index - @posts = Post.order("points DESC, created_at DESC") + @posts = Post.where(created_at: (24.hours.ago..Time.now)).order("points DESC, created_at DESC") end end
Add where constraint to posts retrieval
diff --git a/lib/tasks/broken_link_reporting.rake b/lib/tasks/broken_link_reporting.rake index abc1234..def5678 100644 --- a/lib/tasks/broken_link_reporting.rake +++ b/lib/tasks/broken_link_reporting.rake @@ -1,23 +1,29 @@ desc "Generates and emails CSV reports of all public documents containing broken links." task :generate_broken_link_reports, [:reports_dir, :email_address] => [:environment] do |_, args| - reports_dir = args[:reports_dir] - email_address = args[:email_address] - report_zip_name = 'broken_link_reports.zip' - report_zip_path = Pathname.new(reports_dir).join(report_zip_name) - logger = Logger.new(Rails.root.join('log/broken_link_reporting.log')) + begin + reports_dir = args[:reports_dir] + email_address = args[:email_address] + report_zip_name = 'broken_link_reports.zip' + report_zip_path = Pathname.new(reports_dir).join(report_zip_name) + logger = Logger.new(Rails.root.join('log/broken_link_reporting.log')) - logger.info("Cleaning up any existing reports.") - FileUtils.mkpath reports_dir - FileUtils.rm Dir.glob(reports_dir + '/*_broken_links.csv') - FileUtils.rm(report_zip_path) if File.exists?(report_zip_path) + logger.info("Cleaning up any existing reports.") + FileUtils.mkpath reports_dir + FileUtils.rm Dir.glob(reports_dir + '/*_broken_links.csv') + FileUtils.rm(report_zip_path) if File.exists?(report_zip_path) - logger.info("Generating broken link reports...") - Whitehall::BrokenLinkReporter.new(reports_dir, logger).generate_reports + logger.info("Generating broken link reports...") + Whitehall::BrokenLinkReporter.new(reports_dir, logger).generate_reports - logger.info("Reports generated. Zipping...") - system "zip #{report_zip_path} #{reports_dir}/*_broken_links.csv --junk-paths" + logger.info("Reports generated. Zipping...") + system "zip #{report_zip_path} #{reports_dir}/*_broken_links.csv --junk-paths" - logger.info("Reports zipped. Emailing to #{email_address}") - Notifications.broken_link_reports(report_zip_path, email_address).deliver - logger.info("Email sent.") + logger.info("Reports zipped. Emailing to #{email_address}") + Notifications.broken_link_reports(report_zip_path, email_address).deliver + logger.info("Email sent.") + rescue => e + Airbrake.notify_or_ignore(e, + error_message: "Exception raised during broken link report generation: '#{e.message}'") + raise + end end
Add exception reporting to broken link reporter So that we are alerted when the rake task falls over.
diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb index abc1234..def5678 100644 --- a/app/controllers/teams_controller.rb +++ b/app/controllers/teams_controller.rb @@ -1,7 +1,5 @@ # Public page of all Teams class TeamsController < ApplicationController - caches_page :index - def index if RacingAssociation.current.show_all_teams_on_public_page? @teams = Team.all @@ -9,5 +7,7 @@ @teams = Team.where(member: true).where(show_on_public_page: true) end @discipline_names = Discipline.names + + fresh_when @teams, public: true end end
Add ETag, last modified and cache headers for teams page
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -15,7 +15,7 @@ end def show - @items = @user.items + @items = @user.items.group(:item_id) end private
Resolve the duplication of items to be displayed
diff --git a/releaf-core/spec/features/dragonfly_integration_spec.rb b/releaf-core/spec/features/dragonfly_integration_spec.rb index abc1234..def5678 100644 --- a/releaf-core/spec/features/dragonfly_integration_spec.rb +++ b/releaf-core/spec/features/dragonfly_integration_spec.rb @@ -0,0 +1,22 @@+require 'spec_helper' +feature "Dragonfly integration", js: true do + background do + auth_as_admin + end + + scenario "Upload, view and remove image" do + visit new_admin_book_path + fill_in "Title", with: "xx" + attach_file "resource_cover_image", File.expand_path('../fixtures/cs.png', __dir__) + click_button "Save" + + find(".field[data-name='cover_image_uid'] a.ajaxbox" ).click + expect(page).to have_css(".fancybox-inner img.fancybox-image") + find(".fancybox-inner button.close" ).click + expect(page).to have_no_css(".fancybox-inner img.fancybox-image") + + check "Remove image" + click_button "Save" + expect(page).to have_no_css(".field[data-name='cover_image_uid'] a.ajaxbox") + end +end
Add dragonfly image upload/view/removal feature test
diff --git a/app/models/spree/taxon_decorator.rb b/app/models/spree/taxon_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/taxon_decorator.rb +++ b/app/models/spree/taxon_decorator.rb @@ -1,4 +1,7 @@ Spree::Taxon.class_eval do + self.attachment_definitions[:icon][:path] = 'app/public/spree/taxons/:id/:style/:basename.:extension' + + # Indicate which filters should be used for this taxon def applicable_filters fs = []
Store taxon icons in a path consistent with products
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,7 +2,7 @@ class ApplicationController < ActionController::Base include Shreds::Auth - protect_from_forgery + protect_from_forgery with: :exception rescue_from ActiveRecord::RecordNotFound, with: :feed_not_found
Raise exception when CSRF detected
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,6 @@ protect_from_forgery rescue_from CanCan::AccessDenied do |exception| - redirect_to root_url, :alert => exception.message + redirect_to main_app.root_path, :alert => exception.message end end
Fix the cancan access denied
diff --git a/app/controllers/guest_users_controller.rb b/app/controllers/guest_users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/guest_users_controller.rb +++ b/app/controllers/guest_users_controller.rb @@ -1,5 +1,6 @@ class GuestUsersController < ApplicationController def index + @guest_users = GuestUser.all end def new
Update guest users index action
diff --git a/app/decorators/post_decorator.rb b/app/decorators/post_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/post_decorator.rb +++ b/app/decorators/post_decorator.rb @@ -19,7 +19,7 @@ def to_article_params { section: category.name, - published_time: published_at.to_datetime.to_s + published_time: published_at&.to_datetime&.to_s } end
Allow to preview unpublished post
diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -13,37 +13,7 @@ def new @repository = Repository.find_by_group_and_lab(params[:group_id], params[:lab_id]) - # mock! - # prepare_tree flash[:notice] = "Incredibly useless message." - end - - def mock! - params[:branch_and_path] = "master" - end - - protected - def prepare_tree - @git = @repository.git - @ref, @path = branch_and_path(params[:branch_and_path], @git) - unless @commit = @git.commit(@ref) - handle_missing_tree_sha and return - end - if stale_conditional?(Digest::SHA1.hexdigest(@commit.id + - (params[:branch_and_path].kind_of?(Array) ? params[:branch_and_path].join : params[:branch_and_path])), - @commit.committed_date.utc) - head = @git.get_head(@ref) || Grit::Head.new(@commit.id_abbrev, @commit) - @root = Breadcrumb::Folder.new({:paths => @path, :head => head, - :repository => @repository}) - path = @path.blank? ? [] : ["#{@path.join("/")}/"] # FIXME: meh, this sux - @tree = @git.tree(@commit.tree.id, path) - expires_in 30.seconds - end - end - def handle_missing_tree_sha - flash[:error] = "No such tree SHA1 was found" - redirect_to project_repository_tree_path(@project, @repository, - branch_with_tree("HEAD", @path || [])) end protected
Remove tree code from submissions
diff --git a/app/decorators/content_video_decorator.rb b/app/decorators/content_video_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/content_video_decorator.rb +++ b/app/decorators/content_video_decorator.rb @@ -6,6 +6,6 @@ end def aspect_ratio_class - '16by9' + aspect_ratio.to_s.split('x').join('by') end end
Use the actual provided aspect ratio.
diff --git a/app/models/content_membership.rb b/app/models/content_membership.rb index abc1234..def5678 100644 --- a/app/models/content_membership.rb +++ b/app/models/content_membership.rb @@ -22,6 +22,6 @@ validates_presence_of :member_id, :content_id - validates_uniqueness_of :member_id, :scope => [:content_id], + validates_uniqueness_of :member_id, :scope => [:content_id, :content_type], :message => "is already a member" end
Fix content membership validation failing when content id is in use on another content type with the same ID.
diff --git a/lib/tasks/redirect_tech_code_of_practise.rake b/lib/tasks/redirect_tech_code_of_practise.rake index abc1234..def5678 100644 --- a/lib/tasks/redirect_tech_code_of_practise.rake +++ b/lib/tasks/redirect_tech_code_of_practise.rake @@ -7,22 +7,20 @@ new_path = "/government/publications/technology-code-of-practice/technology-code-of-practice" old_paths.each do |old_path| - payload = { - format: "redirect", - base_path: old_path, - publishing_app: "service-manual-publisher", - redirects: [ - { - path: old_path, - type: "exact", - destination: new_path, - } - ] - } + # Mark the SlugMigration as migrated - content_id = SecureRandom.uuid + slug_migration = SlugMigration.find_by!(slug: old_path) + slug_migration.update!( + completed: true, + redirect_to: new_path, + ) - PUBLISHING_API.put_content(content_id, payload) - PUBLISHING_API.publish(content_id, "major") + # Publish a redirect to the publishing platform + + RedirectPublisher.new.process( + content_id: slug_migration.content_id, + old_path: slug_migration.slug, + new_path: slug_migration.redirect_to, + ) end end
Update the SlugMigration for the tech code of practise Marking the tech code of practise as migrated will save us worrying that it needs to be migrated in the future.
diff --git a/app/models/sms/adapters/twilio_adapter.rb b/app/models/sms/adapters/twilio_adapter.rb index abc1234..def5678 100644 --- a/app/models/sms/adapters/twilio_adapter.rb +++ b/app/models/sms/adapters/twilio_adapter.rb @@ -11,7 +11,25 @@ end def deliver(message) - raise NotImplementedError + prepare_message_for_delivery(message) + + client = Twilio::REST::Client.new configatron.twilio_account_sid, configatron.twilio_auth_token + + params = { from: message.from, to: message.to, body: message.body } + Rails.logger.info("Sending Twilio message: #{params}") + + return true if Rails.env.test? + + begin + client.messages.create( + from: configatron.incoming_sms_number, + to: message.recipient_numbers.join(','), + body: message.body) + rescue Twilio::REST::RequestError => e + raise Sms::Error.new(e) + end + + return true end def receive(request)
2168: Implement broadcast SMS via Twilio
diff --git a/lib/yogo/collection/asset/model_properties.rb b/lib/yogo/collection/asset/model_properties.rb index abc1234..def5678 100644 --- a/lib/yogo/collection/asset/model_properties.rb +++ b/lib/yogo/collection/asset/model_properties.rb @@ -13,32 +13,19 @@ def store_dir File.join('#{Configuration.collection.asset.storage_dir}', '#{model.collection.collection_storage_name}') end - - def filename - # Digest::MD5.hexdigest(self.read) - UUIDTools::UUID.timestamp_create - end }, __FILE__, __LINE__+1 model.class_eval do without_auto_validations do - property :content_type, String - property :description, String - property :asset_file, String - property :original_filename, String + property :content_type, String + property :description, String + property :asset_file, String end - # validates_uniqueness_of :asset_file + validates_uniqueness_of :asset_file mount_uploader :file, uploader, :mount_on => :asset_file after :file=, :write_file_identifier - after :file=, :set_original_filename - - private - - def set_original_filename - attribute_set(:original_filename, file.send(:original_filename)) - end end end end # ModelProperties
Revert "Adding filename mangaling for file assets" This reverts commit fddf5a67c445983f6bd9828d8f0ce2498536b49c. The download routes fail to work with this strategy for mangling