diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/config/initializers/gds-sso.rb b/config/initializers/gds-sso.rb index abc1234..def5678 100644 --- a/config/initializers/gds-sso.rb +++ b/config/initializers/gds-sso.rb @@ -1,8 +1,8 @@ GDS::SSO.config do |config| config.user_model = "User" - config.oauth_id = ENV['PANOPTICON_OAUTH_ID'] - config.oauth_secret = ENV['PANOPTICON_OAUTH_SECRET'] + config.oauth_id = ENV['PANOPTICON_OAUTH_ID'] || "abcdefgh12345678pan" + config.oauth_secret = ENV['PANOPTICON_OAUTH_SECRET'] || "secret" config.oauth_root_url = Plek.current.find("signon") - config.basic_auth_user = ENV['PANOPTICON_USER'] - config.basic_auth_password = ENV['PANOPTICON_PASSWORD'] + config.basic_auth_user = ENV['PANOPTICON_USER'] || "api" + config.basic_auth_password = ENV['PANOPTICON_PASSWORD'] || "defined_on_rollout_not" end
Add a sensible default in ENV not present
diff --git a/config/initializers/stathat.rb b/config/initializers/stathat.rb index abc1234..def5678 100644 --- a/config/initializers/stathat.rb +++ b/config/initializers/stathat.rb @@ -11,7 +11,7 @@ StatHat::API.ez_post_count("Slow Requests", ENV["STAT_ACCOUNT"], 1) end if duration > 100 - instLog.info("[action] #{payload[:method]} #{payload[:path]}.#{payload[:format].to_s} #{duration}ms") + instLog.debug("[action] #{payload[:method]} #{payload[:path]} #{duration}ms") end end @@ -20,7 +20,7 @@ duration = (finish - start) * 1000 StatHat::API.ez_post_value("DB Query", ENV["STAT_ACCOUNT"], duration) if duration > 50 - instLog.info("[sql] #{payload[:name]} '#{payload[:sql]}' #{duration}ms") + instLog.debug("[sql] #{payload[:name]} '#{payload[:sql]}' #{duration}ms") end end end
Use log.debug and do not log request format
diff --git a/json_diff.gemspec b/json_diff.gemspec index abc1234..def5678 100644 --- a/json_diff.gemspec +++ b/json_diff.gemspec @@ -8,6 +8,7 @@ s.platform = Gem::Platform::RUBY s.require_paths = ['lib'] s.summary = 'A gem to compare JSON object trees' + s.description = 'A gem to compare JSON object trees' s.version = JSONDiff::Version::STRING s.email = ['chrisvroberts@gmail.com'] s.homepage = 'https://github.com/chrisvroberts/json_diff'
Add missing gem description to gemspec
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -11,6 +11,11 @@ if current_role.class == Student @labs = current_role.labs.where(given_course_id: @course.id) end + + if current_role.class == Assistant + @labs = @course.labs + end + respond_with(@course) end
Add code to courses controller
diff --git a/spec/features/pwb/user_login_with_facebook_spec.rb b/spec/features/pwb/user_login_with_facebook_spec.rb index abc1234..def5678 100644 --- a/spec/features/pwb/user_login_with_facebook_spec.rb +++ b/spec/features/pwb/user_login_with_facebook_spec.rb @@ -0,0 +1,41 @@+require 'rails_helper' + +module Pwb + + RSpec.feature "user logs in" do + # http://www.jessespevack.com/blog/2016/10/16/how-to-test-drive-omniauth-google-oauth2-for-your-rails-app + scenario "using facebook oauth2" do + stub_omniauth + # visit root_path + visit('/admin') + # puts current_url + + expect(page).to have_link("Sign in with Facebook") + click_link "Sign in with Facebook" + expect(page).to have_content("You need to be an admin to access this") + # expect(page).to have_link("Logout") + end + + def stub_omniauth + # first, set OmniAuth to run in test mode + OmniAuth.config.test_mode = true + # then, provide a set of fake oauth data that + # omniauth will use when a user tries to authenticate: + OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new({ + provider: "facebook", + uid: "12345678910", + info: { + email: "dummy@dummy.com", + first_name: "Ed", + last_name: "Tee" + }, + credentials: { + token: "abcdefg12345", + refresh_token: "12345abcdefg", + expires_at: DateTime.now + } + }) + end + end + +end
Add user login with facebook spec
diff --git a/lib/git-client.rb b/lib/git-client.rb index abc1234..def5678 100644 --- a/lib/git-client.rb +++ b/lib/git-client.rb @@ -1,5 +1,5 @@ class GitClient - def last_commit_message(dir) + def self.last_commit_message(dir) Dir.chdir(dir) { `git log --format=%B -n 1 HEAD` } end end
Make last_commit_message a class method of GitClient [#119926939] Signed-off-by: Dave Goddard <bfcdf3e6ca6cef45543bfbb57509c92aec9a39fb@goddard.id.au>
diff --git a/lib/gregex/map.rb b/lib/gregex/map.rb index abc1234..def5678 100644 --- a/lib/gregex/map.rb +++ b/lib/gregex/map.rb @@ -25,7 +25,10 @@ def map if @opts.check_options("c") MAP['[α-ω]'] = Gregex::Constants::VOWELS + Gregex::Constants::VOWELS_WITH_SPIRITUS + MAP['α'] = Gregex::Map.gs.select_by_letter("Alpha").to_s MAP['ε'] = Gregex::Map.gs.select_by_letter("Epsilon").to_s + MAP['η'] = Gregex::Map.gs.select_by_letter("Eta").to_s + MAP['ι'] = Gregex::Map.gs.select_by_letter("Iota").to_s MAP['υ'] = Gregex::Map.gs.select_by_letter("Ypsilon").to_s end MAP
Add further vowels for options
diff --git a/lib/neo4j-core.rb b/lib/neo4j-core.rb index abc1234..def5678 100644 --- a/lib/neo4j-core.rb +++ b/lib/neo4j-core.rb @@ -28,5 +28,4 @@ require 'oj' require 'oj_mimic_json' - Oj.default_options = {:mode => :strict } end
Remove strict mode for now because it breaks other things
diff --git a/actionmailer/lib/action_mailer/rescuable.rb b/actionmailer/lib/action_mailer/rescuable.rb index abc1234..def5678 100644 --- a/actionmailer/lib/action_mailer/rescuable.rb +++ b/actionmailer/lib/action_mailer/rescuable.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module ActionMailer #:nodoc: - # Provides `rescue_from` for mailers. Wraps mailer action processing, + # Provides +rescue_from+ for mailers. Wraps mailer action processing, # mail job processing, and mail delivery. module Rescuable extend ActiveSupport::Concern
Use tt in doc for action_mailer [ci skip]
diff --git a/app/controllers/api/v1/events_controller.rb b/app/controllers/api/v1/events_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/events_controller.rb +++ b/app/controllers/api/v1/events_controller.rb @@ -24,7 +24,7 @@ private def event_params - params.require(:event).permit(:title, :organization, :start, :end, :description, :address, :skills, :age, :url) + params.require(:event).permit(:title, :organization, :start, :end, :description, :address, :skills, :age, :url, :cause_id) end end
Add cause id to event params
diff --git a/lib/stub_shell.rb b/lib/stub_shell.rb index abc1234..def5678 100644 --- a/lib/stub_shell.rb +++ b/lib/stub_shell.rb @@ -1,26 +1,26 @@+require 'stub_shell/result' +require 'stub_shell/command' +require 'stub_shell/shell' +require 'stub_shell/test_helpers' + module StubShell class << self attr_accessor :current_context + + def run_command cmd + command, StubShell.current_context = StubShell.current_context.execute(cmd) + Kernel.send(:`, "#{File.join(File.dirname(__FILE__), '..', 'bin', 'fake_process.sh')} '#{command.result.exitstatus}'") + command + end end self.current_context = nil end -require 'stub_shell/result' -require 'stub_shell/command' -require 'stub_shell/shell' -require 'stub_shell/test_helpers' - -def run_command cmd - command, StubShell.current_context = StubShell.current_context.execute(cmd) - Kernel.send(:`, "#{File.join(File.dirname(__FILE__), '..', 'bin', 'fake_process.sh')} '#{command.result.exitstatus}'") - command -end - def `(cmd) - run_command(cmd).result.stdout + StubShell.run_command(cmd).result.stdout end def system(cmd) - run_command(cmd).result.exitstatus == 0 + StubShell.run_command(cmd).result.exitstatus == 0 end
Move method to StubShell scope
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 @@ -4,7 +4,7 @@ load(File.join(Rails.root, 'db', 'import.rb')) end - desc "Import Chief" + desc "Import Chief standing data" task chief: 'environment' do load(File.join(Rails.root, 'db', 'chief_standing_data.rb')) end
Clarify the task for chief standing data
diff --git a/lib/turbograft.rb b/lib/turbograft.rb index abc1234..def5678 100644 --- a/lib/turbograft.rb +++ b/lib/turbograft.rb @@ -35,10 +35,8 @@ end ActiveSupport.on_load(:action_view) do - (ActionView::RoutingUrlFor rescue ActionView::Helpers::UrlHelper).module_eval do - prepend XHRUrlFor - end - end unless RUBY_VERSION =~ /^1\.8/ + (ActionView::RoutingUrlFor rescue ActionView::Helpers::UrlHelper).prepend(XHRUrlFor) + end end end end
Remove module_eval since is public since 2.1
diff --git a/app/helpers/contacts_helper.rb b/app/helpers/contacts_helper.rb index abc1234..def5678 100644 --- a/app/helpers/contacts_helper.rb +++ b/app/helpers/contacts_helper.rb @@ -1,6 +1,6 @@ module ContactsHelper def vcard_for_post_address(address) - title = content_tag :h3, class: "fn" do + title = content_tag :strong, class: "fn" do address.title end street_address = content_tag :span, class: "street-address" do @@ -19,7 +19,7 @@ address.world_location.try(:name) end content_tag :div, class: "vcard" do - [title, street_address, locality, region, postal_code, world_location].join.html_safe + [title, street_address, locality, region, postal_code, world_location].join('<br>').html_safe end end
Improve display of addresses in table Break address onto separate lines, reduce size of leading line
diff --git a/app/helpers/encoding_helper.rb b/app/helpers/encoding_helper.rb index abc1234..def5678 100644 --- a/app/helpers/encoding_helper.rb +++ b/app/helpers/encoding_helper.rb @@ -5,7 +5,7 @@ # Updating the production databases to use utf8mb4 for all tables # would remove the need for it. def sanitize_4_byte_string(string) - if string.chars.any? { |c| c.bytes.count >= 4 } + if string&.chars&.any? { |c| c.bytes.count >= 4 } CGI.escape(string) else string
Handle nil input for sanitizing 4-byte characters in strings
diff --git a/app/mailers/follower_mailer.rb b/app/mailers/follower_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/follower_mailer.rb +++ b/app/mailers/follower_mailer.rb @@ -2,15 +2,12 @@ helper :application - def live_effort_email(follower, split_times) + def self.live_effort_email(follower, split_times) @follower = follower @split_times = split_times @effort = split_times.first.effort + puts "Sending email to #{follower.full_name}." mail(to: @follower.email, subject: "Update for #{@effort.full_name} at #{@effort.event_name}") end - def interest_new_event - - end - end
Change live_effort_email to class method.
diff --git a/app/models/analog_input_log.rb b/app/models/analog_input_log.rb index abc1234..def5678 100644 --- a/app/models/analog_input_log.rb +++ b/app/models/analog_input_log.rb @@ -1,3 +1,4 @@ class AnalogInputLog < ActiveRecord::Base belongs_to :analog_input + attr_accessible :analog_input_id, :value end
Make analog input log attributes accessible.
diff --git a/test/browser/maintenance_login_message_test.rb b/test/browser/maintenance_login_message_test.rb index abc1234..def5678 100644 --- a/test/browser/maintenance_login_message_test.rb +++ b/test/browser/maintenance_login_message_test.rb @@ -63,6 +63,7 @@ watch_for_disappear( browser: browser2, css: '.js-maintenanceLogin', + timeout: 30, ) end
Test stabilization: Timout for maintainance message to dissappear is too low and causes test to be flanky.
diff --git a/app/policies/channel_policy.rb b/app/policies/channel_policy.rb index abc1234..def5678 100644 --- a/app/policies/channel_policy.rb +++ b/app/policies/channel_policy.rb @@ -33,7 +33,8 @@ end def permitted_attributes - permitted = [:name, :description, :service_identifier, :url, :avatar_url, :primary, + permitted = [:name, :description, :service_identifier, :url, :avatar_url, + :primary, :token_id, :keyword_ids => [], contact_attributes: [:id, :name, :organization, :url, :phone, :email]] transfer? ? (permitted << :entity_id) : permitted
Allow token_id to be passed in
diff --git a/reagan.gemspec b/reagan.gemspec index abc1234..def5678 100644 --- a/reagan.gemspec +++ b/reagan.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'reagan' - s.version = '0.8.0' + s.version = '0.8.1' s.date = Date.today.to_s s.platform = Gem::Platform::RUBY s.extra_rdoc_files = ['README.md', 'LICENSE'] @@ -13,7 +13,7 @@ s.required_ruby_version = '>= 1.9.3' s.add_dependency 'octokit', '~> 3.0' - s.add_dependency 'chef', '~> 11.0' + s.add_dependency 'chef', '>= 11.0' s.add_dependency 'ridley', '~> 4.0' s.add_development_dependency 'rake', '~> 10.0'
Fix dep on Chef to allow for Chef 12. Release 0.8.1
diff --git a/nested_sortable-rails.gemspec b/nested_sortable-rails.gemspec index abc1234..def5678 100644 --- a/nested_sortable-rails.gemspec +++ b/nested_sortable-rails.gemspec @@ -13,7 +13,7 @@ s.summary = "Packages the nestedSortable-jquery-ui extension" s.description = "Packages the nestedSortable extension from Manuele J Sarfatti (https://github.com/mjsarfatti/nestedSortable). Check out his page on github to learn more." - s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] + s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "Readme.md"] s.add_dependency "rails", "~> 3.2.6" s.add_dependency "jquery-ui-rails"
Fix gemspec. No README.rdoc anymore.
diff --git a/test/export/test_ae_export.rb b/test/export/test_ae_export.rb index abc1234..def5678 100644 --- a/test/export/test_ae_export.rb +++ b/test/export/test_ae_export.rb @@ -7,8 +7,11 @@ P_LOCATORS = File.dirname(__FILE__) + "/samples/ref_AfterEffects.jsx" def test_export_output_written - create_reference_output Tracksperanto::Export::AE, P_LOCATORS ensure_same_output Tracksperanto::Export::AE, P_LOCATORS end + def test_exporter_meta + assert_equal "createNulls.jsx", Tracksperanto::Export::AE.desc_and_extension + assert_equal "AfterEffects .jsx script generating null layers", Tracksperanto::Export::AE.human_name + end end
Add a test for naming and remove generation of ref. output
diff --git a/test/tc_ruby_time_timezone.rb b/test/tc_ruby_time_timezone.rb index abc1234..def5678 100644 --- a/test/tc_ruby_time_timezone.rb +++ b/test/tc_ruby_time_timezone.rb @@ -0,0 +1,61 @@+# encoding: UTF-8 +# frozen_string_literal: true + +require_relative 'test_utils' + +include TZInfo + +class TCRubyTimeTimezone < Minitest::Test + def test_new_time_with_time_zone + return unless can_create_time_with_time_zone? + + tz = Timezone.get('Europe/Paris') + + std_time = Time.new(2018, 12, 1, 0, 0, 0, tz) + assert_same(tz, std_time.zone) + assert_equal(3600, std_time.utc_offset) + assert_equal(Time.utc(2018, 11, 30, 23, 0, 0), std_time.getutc) + + dst_time = Time.new(2018, 6, 1, 0, 0, 0, tz) + assert_same(tz, dst_time.zone) + assert_equal(7200, dst_time.utc_offset) + assert_equal(Time.utc(2018, 5, 31, 22, 0, 0), dst_time.getutc) + end + + def test_at_time_with_time_zone + return unless can_create_time_with_time_zone? + + tz = Timezone.get('America/New_York') + + std_time = Time.at(1543640400, in: tz) + assert_same(tz, std_time.zone) + assert_equal(-18000, std_time.utc_offset) + assert_equal(2018, std_time.year) + assert_equal(12, std_time.month) + assert_equal(1, std_time.day) + assert_equal(0, std_time.hour) + assert_equal(0, std_time.min) + assert_equal(0, std_time.sec) + + dst_time = Time.at(1527825600, in: tz) + assert_same(tz, dst_time.zone) + assert_equal(-14400, dst_time.utc_offset) + assert_equal(2018, dst_time.year) + assert_equal(6, dst_time.month) + assert_equal(1, dst_time.day) + assert_equal(0, dst_time.hour) + assert_equal(0, dst_time.min) + assert_equal(0, dst_time.sec) + end + + private + + def can_create_time_with_time_zone? + unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6.0') + skip("Cannot create Time with a time zone with Ruby #{RUBY_VERSION}") + false + end + + true + end +end
Test that Time.new and Time.at in Ruby 2.6 work with Timezone instances.
diff --git a/lib/flipper/dsl.rb b/lib/flipper/dsl.rb index abc1234..def5678 100644 --- a/lib/flipper/dsl.rb +++ b/lib/flipper/dsl.rb @@ -6,6 +6,7 @@ def initialize(adapter) @adapter = Adapter.wrap(adapter) + @memoized_features = {} end def enabled?(name, *args) @@ -25,7 +26,9 @@ end def feature(name) - memoized_features[name.to_sym] ||= Feature.new(name, @adapter) + @memoized_features[name.to_sym] ||= Feature.new(name, @adapter, { + :instrumentor => instrumentor, + }) end alias_method :[], :feature @@ -51,11 +54,5 @@ def features adapter.features.map { |name| feature(name) }.to_set end - - private - - def memoized_features - @memoized_features ||= {} - end end end
Move memoized features to initialize and save method call
diff --git a/lib/legacy_uuid.rb b/lib/legacy_uuid.rb index abc1234..def5678 100644 --- a/lib/legacy_uuid.rb +++ b/lib/legacy_uuid.rb @@ -44,4 +44,12 @@ def self.from_team(uid) from(uid, :prefix => "edd1e64c") end + + def self.from_donation(uid) + from(uid, :prefix => "eaa1e64c") + end + + def self.from_donor(uid) + from(uid, :prefix => "eab1e64c") + end end
Add legacy donation and donor UUIDs
diff --git a/lib/mercure/git.rb b/lib/mercure/git.rb index abc1234..def5678 100644 --- a/lib/mercure/git.rb +++ b/lib/mercure/git.rb @@ -24,7 +24,6 @@ end puts "On checkout le tag #{tag_name}" - co_tag = `git checkout #{tag_name}` end def tagGit (settings)
Stop checking out the tag when we deploy
diff --git a/lib/rusty_blank.rb b/lib/rusty_blank.rb index abc1234..def5678 100644 --- a/lib/rusty_blank.rb +++ b/lib/rusty_blank.rb @@ -1,7 +1,8 @@ require 'fiddle' require 'rbconfig' -basename = "librusty_blank.#{RbConfig::CONFIG['DLEXT']}" +ext = RbConfig::CONFIG['DLEXT'] == 'bundle' ? 'dylib' : RbConfig::CONFIG['DLEXT'] +basename = "librusty_blank.#{ext}" library = Fiddle.dlopen(File.join(File.dirname(__FILE__), basename)) func = Fiddle::Function.new(library['init_rusty_blank'], [], Fiddle::TYPE_VOIDP)
Fix dlext on OSX when using the gem
diff --git a/lib/tasks/assets_without_digest.rake b/lib/tasks/assets_without_digest.rake index abc1234..def5678 100644 --- a/lib/tasks/assets_without_digest.rake +++ b/lib/tasks/assets_without_digest.rake @@ -0,0 +1,8 @@+require 'fileutils' + +desc 'Compile all the assets named in config.assets.precompile with and without appended digests' +task 'assets:precompile' do + digest = /\-[0-9a-f]{32}\./ + assets = Dir['public/assets/**/*'].select { |asset| asset =~ digest } + assets.each { |asset| FileUtils.cp(asset, asset.sub(digest, '.'), verbose: true) } +end
Add task to copy non-digested versions of assets
diff --git a/lib/travis/nightly_builder/runner.rb b/lib/travis/nightly_builder/runner.rb index abc1234..def5678 100644 --- a/lib/travis/nightly_builder/runner.rb +++ b/lib/travis/nightly_builder/runner.rb @@ -3,12 +3,14 @@ module Travis module NightlyBuilder class Runner - attr_reader :api_endpoint, :token + attr_reader :api_endpoint, :token, :owner def initialize(api_endpoint: ENV['TRAVIS_API_ENDPOINT'], - token: ENV['TRAVIS_TOKEN']) + token: ENV['TRAVIS_TOKEN'], + owner: ENV.fetch('REPO_OWNER', 'travis-ci')) @api_endpoint = api_endpoint @token = token + @owner = owner end def run(repo: '', branch: 'default', env: []) @@ -19,7 +21,7 @@ end message = "Build repo=#{repo}; branch=#{branch}%s " \ - "#{Time.now.utc.strftime('%Y-%m-%d-%H-%M-%S')}" + "#{Time.now.utc.strftime('%Y%m%dT%H%M%SZ')}" config = {} if env.empty? @@ -35,7 +37,7 @@ end conn.post do |req| - req.url "/repo/travis-ci%2F#{repo}/requests" + req.url "/repo/#{owner}%2F#{repo}/requests" req.headers['Content-Type'] = 'application/json' req.headers['Travis-API-Version'] = '3' req.headers['Authorization'] = "token #{token}"
Allow for injection of repo owner
diff --git a/lib/udongo/active_model_simulator.rb b/lib/udongo/active_model_simulator.rb index abc1234..def5678 100644 --- a/lib/udongo/active_model_simulator.rb +++ b/lib/udongo/active_model_simulator.rb @@ -0,0 +1,21 @@+class Udongo::ActiveModelSimulator + extend ActiveModel::Naming + include ActiveModel::Conversion + include ActiveModel::Validations + + def initialize(attributes = {}) + attributes ||= {} + attributes.each do |name, value| + send("#{name}=", value) + end + end + + def persisted? + false + end + + # This method exists so the related factory tests pass + def save! + valid? + end +end
Add the active model simulator.
diff --git a/app/models/franchise.rb b/app/models/franchise.rb index abc1234..def5678 100644 --- a/app/models/franchise.rb +++ b/app/models/franchise.rb @@ -8,7 +8,7 @@ # characters:: characters that belong to this franchise. class Franchise < ActiveRecord::Base validates :name, length: {minimum: 2, maximum: 100} - validates :description, length: {minimum: 10, maximum: 1000} + validates :description, length: {minimum: 4, maximum: 1000} extend FriendlyId friendly_id :name, use: :slugged has_many :story_franchises
Set minimum characters for Franchise description to 4
diff --git a/app/onboarder/config.rb b/app/onboarder/config.rb index abc1234..def5678 100644 --- a/app/onboarder/config.rb +++ b/app/onboarder/config.rb @@ -2,6 +2,7 @@ require 'erb' require 'json' require 'pstore' +require 'fileutils' $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "..", "lib") require 'redminerest' @@ -24,6 +25,10 @@ dbfile = File.join(settings.dbdir, "onboarder-#{settings.environment}.pstore") + if not File.directory?(settings.uploaddir) + FileUtils.mkdir_p(settings.uploaddir) + end + if !File.file?(dbfile) $stderr.puts("Cannot find the database. Please bootstrap it.") $stderr.puts("Aborting.")
Make sure the uploaddir always exists.
diff --git a/test/htwax/test_request.rb b/test/htwax/test_request.rb index abc1234..def5678 100644 --- a/test/htwax/test_request.rb +++ b/test/htwax/test_request.rb @@ -0,0 +1,14 @@+require 'test_helper' + +module HtWax + describe Request do + describe 'initialize' do + it 'can be initialized with an http method and a URI' do + r = Request.new(:get, 'http://localhost/') + + r.request_method.must_equal :get + r.uri.must_equal 'http://localhost/' + end + end + end +end
Add basic test for Request.
diff --git a/core/string/rpartition_spec.rb b/core/string/rpartition_spec.rb index abc1234..def5678 100644 --- a/core/string/rpartition_spec.rb +++ b/core/string/rpartition_spec.rb @@ -16,6 +16,11 @@ "hello!".rpartition(/l./).should == ["hel", "lo", "!"] end + it "affects $~" do + matched_string = "hello!".rpartition(/l./)[1] + matched_string.should == $~[0] + end + ruby_bug "redmine #1510", '1.9.1' do it "converts its argument using :to_str" do find = mock('l')
Add spec for checking that rpartition affects $~
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,5 @@ class User < ActiveRecord::Base + has_secure_password has_many :comments has_many :votes has_many :responses
Add Authentication to User Model
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,6 @@ class User < ActiveRecord::Base rolify - before_save :ensure_authentication_token after_create :add_default_role # Include default devise modules. Others available are: # :token_authenticatable, :confirmable,
Remove bevor_save filter that creates the token. It is now created on login/logout.
diff --git a/lib/puppet_x/bodeco/util.rb b/lib/puppet_x/bodeco/util.rb index abc1234..def5678 100644 --- a/lib/puppet_x/bodeco/util.rb +++ b/lib/puppet_x/bodeco/util.rb @@ -28,6 +28,8 @@ f.write(@connection.get(url_path).body) f.close rescue Faraday::Error::ClientError + f.close + File.unlink(file_path) raise $!, "Unable to download file #{url_path}. #{$!}", $!.backtrace end end
Delete bad file if download failed.
diff --git a/lib/tasks/table_export.rake b/lib/tasks/table_export.rake index abc1234..def5678 100644 --- a/lib/tasks/table_export.rake +++ b/lib/tasks/table_export.rake @@ -1,6 +1,6 @@ namespace :table_export do task run: :environment do exporter = TableExporter.new - exporter.run(delimiter: delimiter, should_upload_to_s3: true) + exporter.run(delimiter: '|', should_upload_to_s3: true) end end
Replace incorrect variable with pipe character.
diff --git a/lib/translink/model/trip.rb b/lib/translink/model/trip.rb index abc1234..def5678 100644 --- a/lib/translink/model/trip.rb +++ b/lib/translink/model/trip.rb @@ -6,7 +6,7 @@ storage_names[:default] = 'trips' property :id, Serial - property :direction, Integer + property :direction, String property :service_id, Integer property :trip_id, Integer
Change field type to string.
diff --git a/respec.gemspec b/respec.gemspec index abc1234..def5678 100644 --- a/respec.gemspec +++ b/respec.gemspec @@ -1,4 +1,3 @@-# -*- encoding: utf-8 -*- $:.unshift File.expand_path('lib', File.dirname(__FILE__)) require 'respec/version' @@ -7,7 +6,7 @@ gem.version = Respec::VERSION gem.authors = ['George Ogata'] gem.email = ['george.ogata@gmail.com'] - gem.summary = "Rerun failing rspec examples easily." + gem.summary = "Rerun failing RSpec examples easily." gem.homepage = 'http://github.com/oggy/respec' gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
Make gem summary match Github project.
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,7 +5,7 @@ description 'Installs Passenger for Apache2' version '3.1.0' -depends 'apache2', '~> 7.1' +depends 'apache2', '>= 7.1' depends 'build-essential', '>= 5.0' %w( fedora redhat centos scientific amazon oracle ubuntu debian arch suse ).each do |os|
Use less strict apache2 cookbook version pin
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,10 +4,8 @@ license "Apache 2.0" description "Deploys and configures Python-based applications" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "3.0.1" +version "3.0.2" %w{ python gunicorn supervisor }.each do |cb| depends cb end - -depends "application", "~> 3.0"
Remove dependency on application 3.0
diff --git a/test/square_test.rb b/test/square_test.rb index abc1234..def5678 100644 --- a/test/square_test.rb +++ b/test/square_test.rb @@ -0,0 +1,18 @@+require 'minitest/autorun' +require 'r2d' + +describe Square do + before do + R2D::Window.create width: 640, height: 480 + @square = Square.new(10, 20, 200) + end + + it 'can have a size' do + @square.size.must_equal 200 + end + + it 'can edit the height' do + @square.size = 400 + @square.size.must_equal 400 + end +end
Add tests for the Square class
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,7 @@ ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' +require 'cache' require 'simplecov' require 'simplecov-rcov' @@ -16,8 +17,11 @@ # disable transactions self.use_transactional_fixtures = false + # clear cache + Cache.clear + # load seeds - load "#{Rails.root}/db/seeds.rb" + load "#{Rails.root}/db/seeds.rb" setup do
Clear cache at beginning of unit tests.
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -8,4 +8,13 @@ require 'protopuffs' class Test::Unit::TestCase + + def print_bytes(string) + puts + string.each_byte do |byte| + printf("%1$08b (%1$02X)\n", byte) + end + end + end +
Add a handy test helper method for printing strings of bytes in binary and hex
diff --git a/test/test_server.rb b/test/test_server.rb index abc1234..def5678 100644 --- a/test/test_server.rb +++ b/test/test_server.rb @@ -37,5 +37,9 @@ assert last_response.ok? data = JSON.parse(last_response.body) + + assert data["game_id"] + + assert_equal Game.last.id, data["game_id"] end end
Test for the /new_game method
diff --git a/config/environments/staging.rb b/config/environments/staging.rb index abc1234..def5678 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -1,5 +1,6 @@ require_relative 'production' -# Uncomment me for debugging -# Tahi::Application.configure do -# config.force_ssl = false -# end +if ENV["DISABLE_SSL"] + Tahi::Application.configure do + config.force_ssl = false + end +end
Disable SSL with environment flag
diff --git a/app/helpers/evaluation_helper.rb b/app/helpers/evaluation_helper.rb index abc1234..def5678 100644 --- a/app/helpers/evaluation_helper.rb +++ b/app/helpers/evaluation_helper.rb @@ -1,6 +1,6 @@ module EvaluationHelper def create_or_update_evaluation_path(evaluation) - return evaluation_path(uuid: evaluation.uuid) if evaluation.uuid.present? + return evaluation_path(uuid: evaluation.uuid) if evaluation.persisted? evaluations_path end end
PATCH only when the evaluation is persisted
diff --git a/lib/tasks/deployment/20181128155650_destroy_orphaned_dossier_operation_logs.rake b/lib/tasks/deployment/20181128155650_destroy_orphaned_dossier_operation_logs.rake index abc1234..def5678 100644 --- a/lib/tasks/deployment/20181128155650_destroy_orphaned_dossier_operation_logs.rake +++ b/lib/tasks/deployment/20181128155650_destroy_orphaned_dossier_operation_logs.rake @@ -0,0 +1,17 @@+namespace :after_party do + desc 'Deployment task: destroy_orphaned_dossier_operation_logs' + task destroy_orphaned_dossier_operation_logs: :environment do + bar = RakeProgressbar.new(DossierOperationLog.count) + + DossierOperationLog.find_each do |log| + if log.dossier.blank? + log.destroy + end + bar.inc + end + + bar.finished + + AfterParty::TaskRecord.create version: '20181128155650' + end +end
Add task to cleanup orphaned dossier_operation_logs
diff --git a/app/controllers/admin/budget_headings_controller.rb b/app/controllers/admin/budget_headings_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/budget_headings_controller.rb +++ b/app/controllers/admin/budget_headings_controller.rb @@ -12,7 +12,7 @@ private def budget_heading_params - params.require(:budget_heading).permit(:name, :price, :geozone_id) + params.require(:budget_heading).permit(:name, :price, :population) end -end+end
Add population to allowed params on admin budget heading controller
diff --git a/db/migrate/20160216100000_clear_old_views_before_migrating_with_scenic.rb b/db/migrate/20160216100000_clear_old_views_before_migrating_with_scenic.rb index abc1234..def5678 100644 --- a/db/migrate/20160216100000_clear_old_views_before_migrating_with_scenic.rb +++ b/db/migrate/20160216100000_clear_old_views_before_migrating_with_scenic.rb @@ -0,0 +1,18 @@+class ClearOldViewsBeforeMigratingWithScenic < ActiveRecord::Migration + def change + execute 'DROP VIEW IF EXISTS count_visits;' + execute 'DROP VIEW IF EXISTS count_visits_by_state;' + execute 'DROP VIEW IF EXISTS count_visits_by_prison_and_state;' + execute 'DROP VIEW IF EXISTS count_visits_by_prison_and_calendar_week;' + execute 'DROP VIEW IF EXISTS count_visits_by_prison_and_calendar_date;' + execute 'DROP VIEW IF EXISTS distributions;' + execute 'DROP VIEW IF EXISTS distributions_for_individual_prisons;' + execute 'DROP VIEW IF EXISTS distributions_for_prisons_by_calendar_weeks;' + execute 'DROP VIEW IF EXISTS distributions_for_prisons_by_calendar_dates;' + execute 'DROP VIEW IF EXISTS count_overdue_visits;' + execute 'DROP VIEW IF EXISTS count_overdue_visits_by_prisons;' + execute 'DROP VIEW IF EXISTS count_overdue_visits_by_prison_and_calendear_weeks;' + execute 'DROP VIEW IF EXISTS count_overdue_visits_by_prison_and_calendear_dates;' + execute 'DROP VIEW IF EXISTS booked_rejected_splits;' + end +end
Remove the views created by the manual migration These were causing the new scenic migrations to fail. This ensures they are cleared before the new ones are made.
diff --git a/spec/debian/rootlogin_spec.rb b/spec/debian/rootlogin_spec.rb index abc1234..def5678 100644 --- a/spec/debian/rootlogin_spec.rb +++ b/spec/debian/rootlogin_spec.rb @@ -15,3 +15,10 @@ describe command("cat /etc/shadow | grep root | awk -F':' '{print $2;}'") do it { should return_stdout "" } end + +# Make sure ssh login is via ssh key only. This is required since we are enabling +# a password for root per IMAGE-459 +describe file('/etc/ssh/sshd_config') do + it { should be_file } + it { should contain "PasswordAuthentication no" } +end
Test to ensure PasswordAuthentication is set to no. IMAGE-459
diff --git a/spec/integration/form_spec.rb b/spec/integration/form_spec.rb index abc1234..def5678 100644 --- a/spec/integration/form_spec.rb +++ b/spec/integration/form_spec.rb @@ -11,11 +11,11 @@ it "outputs an AST" do expect(form.(title: "Aurora", rating: 10).to_ary).to eq [ [:component, [ + [], [ - [:field, [:title, "string", "default", "Aurora", [], []]], - [:field, [:rating, "int", "default", 10, [], []]] + [:field, [:title, "string", "default", "Aurora", [], [], []]], + [:field, [:rating, "int", "default", 10, [], [], []]] ], - [] ]], ] end
Update basic form spec to match AST output
diff --git a/spec/knapsack/tracker_spec.rb b/spec/knapsack/tracker_spec.rb index abc1234..def5678 100644 --- a/spec/knapsack/tracker_spec.rb +++ b/spec/knapsack/tracker_spec.rb @@ -0,0 +1,53 @@+require 'spec_helper' + +describe Knapsack::Tracker do + let(:tracker) { described_class.send(:new) } + + describe 'attributes' do + it { expect(tracker.global_time).to eql 0 } + it { expect(tracker.files).to eql({}) } + end + + describe '#generate_report?' do + subject { tracker.generate_report? } + + context 'when ENV variable is defined' do + before do + stub_const("ENV", { 'KNAPSACK_GENERATE_REPORT' => true }) + end + it { should be true } + end + + context 'when ENV variable is not defined' do + it { should be false } + end + end + + describe '#config' do + context 'when passed options' do + let(:opts) do + { + enable_time_offset_warning: false, + fake: true + } + end + + it do + expect(tracker.config(opts)).to eql({ + enable_time_offset_warning: false, + time_offset_warning: 30, + fake: true + }) + end + end + + context "when didn't pass options" do + it do + expect(tracker.config).to eql({ + enable_time_offset_warning: true, + time_offset_warning: 30, + }) + end + end + end +end
Add basic specs for tracker
diff --git a/tzinfo-data.gemspec b/tzinfo-data.gemspec index abc1234..def5678 100644 --- a/tzinfo-data.gemspec +++ b/tzinfo-data.gemspec @@ -7,7 +7,7 @@ s.email = 'phil.ross@gmail.com' s.homepage = 'http://tzinfo.rubyforge.org' s.license = 'MIT' - s.files = ['LICENSE', 'README'] + + s.files = ['LICENSE', 'README', '.yardopts'] + Dir['lib/**/*.rb'].delete_if {|f| f.include?('.svn')} s.platform = Gem::Platform::RUBY s.require_path = 'lib'
Include .yardopts in packaged releases.
diff --git a/shhhhh.gemspec b/shhhhh.gemspec index abc1234..def5678 100644 --- a/shhhhh.gemspec +++ b/shhhhh.gemspec @@ -11,8 +11,8 @@ s.homepage = 'http://rubygems.org/gems/shhhhh' s.license = 'MIT' - s.add_dependency 'railties', '>= 3.2.19' - s.add_development_dependency 'rake' - s.add_development_dependency 'tzinfo' - s.add_development_dependency 'rspec' + s.add_dependency 'railties', '>= 3.2.19', '< 5.0' + s.add_development_dependency 'rake', '10.3.2' + s.add_development_dependency 'tzinfo', '1.2.1' + s.add_development_dependency 'rspec', '3.0.0' end
Tweak dependencies to satisfy warnings
diff --git a/signer.gemspec b/signer.gemspec index abc1234..def5678 100644 --- a/signer.gemspec +++ b/signer.gemspec @@ -14,7 +14,7 @@ gem.name = "signer" gem.require_paths = ["lib"] - gem.version = "1.4.3.1" + gem.version = Signer::VERSION gem.required_ruby_version = '>= 2.1.0'
Revert gem version code in gemspec
diff --git a/valid_email.gemspec b/valid_email.gemspec index abc1234..def5678 100644 --- a/valid_email.gemspec +++ b/valid_email.gemspec @@ -10,6 +10,7 @@ s.homepage = "http://my.rails-royce.org/2010/07/21/email-validation-in-ruby-on-rails-without-regexp" s.summary = %q{ActiveModel Validation for email} s.description = %q{ActiveModel Validation for email} + s.license = 'MIT' s.rubyforge_project = "valid_email"
Add license flag to the gemspec
diff --git a/overcommit.gemspec b/overcommit.gemspec index abc1234..def5678 100644 --- a/overcommit.gemspec +++ b/overcommit.gemspec @@ -1,4 +1,5 @@ $LOAD_PATH << File.expand_path('../lib', __FILE__) +require 'overcommit/constants' require 'overcommit/version' Gem::Specification.new do |s| @@ -9,7 +10,7 @@ s.description = 'Utility to install, configure, and extend Git hooks' s.authors = ['Causes Engineering', 'Shane da Silva'] s.email = ['eng@causes.com', 'shane@causes.com'] - s.homepage = 'http://github.com/causes/overcommit' + s.homepage = Overcommit::REPO_URL s.post_install_message = 'Install hooks by running `overcommit --install` in your Git repository'
Use REPO_URL constant for gemspec homepage This reduces code duplication. Change-Id: Id32cbee7b265939ff3477c07d65192fc860aa0f3 Reviewed-on: http://gerrit.causes.com/35622 Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com> Tested-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/guard-test.gemspec b/guard-test.gemspec index abc1234..def5678 100644 --- a/guard-test.gemspec +++ b/guard-test.gemspec @@ -20,6 +20,6 @@ s.add_development_dependency 'bundler', '~> 1.0' s.add_development_dependency 'rspec', '~> 2.5' - s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.md] + s.files = Dir.glob('{lib}/**/*') + %w[CHANGELOG.md LICENSE README.md] s.require_path = 'lib' end
Include CHANGELOG in the gem. Thanks to @mislav for this.
diff --git a/lib/concerns/yearly_model.rb b/lib/concerns/yearly_model.rb index abc1234..def5678 100644 --- a/lib/concerns/yearly_model.rb +++ b/lib/concerns/yearly_model.rb @@ -1,8 +1,6 @@ module YearlyModel extend ActiveSupport::Concern - # The contents of included() will be run when YearlyModel is - # include()d in the model, thanks to ActiveSupport::Concern included do # TODO: replace all `year` columns that reference `years.year` with # `year_id` columns that reference `years.id`. This is the Rails convention, @@ -18,10 +16,7 @@ :presence => true end - # Methods in this "sub-module" will become class methods in whatever - # class YearlyModel is mixed into. module ClassMethods - # `yr` is a common shortcut to limit query to current year. # The argument is an instance or subclass of Integer, or # an instance of the Year model. @@ -36,8 +31,4 @@ where(:year => y) end end - - # instance methods can be added here, eg. - # def forty_two() 42 end - # there is no need for a "sub-module" as with ClassMethods end
Remove comments about how ActiveSupport::Concern works
diff --git a/lib/end_view/rails/layout.rb b/lib/end_view/rails/layout.rb index abc1234..def5678 100644 --- a/lib/end_view/rails/layout.rb +++ b/lib/end_view/rails/layout.rb @@ -1,5 +1,4 @@ require 'end_view' -require 'forwardable' require 'attire' module EndView @@ -10,14 +9,11 @@ module Rails class Layout include EndView.new(__FILE__) - extend Forwardable - attr_init :view_context, :title + attr_init :view_context, :title, head: nil private - def_delegators :view_context, :stylesheet_link_tag, - :javascript_include_tag, - :csrf_meta_tags + alias_method :vc, :view_context def stylesheet_args ['application', { media: 'all', 'data-turbolinks-track' => true }] @@ -36,7 +32,8 @@ %html %head %title= title - = stylesheet_link_tag(*stylesheet_args) - = javascript_include_tag(*javascript_args) - = csrf_meta_tags + = vc.stylesheet_link_tag(*stylesheet_args) + = vc.javascript_include_tag(*javascript_args) + = vc.csrf_meta_tags + = head %body= yield
Add head opts to Rails::Layout. Alias vc over def_delegator.
diff --git a/Casks/macvim.rb b/Casks/macvim.rb index abc1234..def5678 100644 --- a/Casks/macvim.rb +++ b/Casks/macvim.rb @@ -1,15 +1,15 @@ class Macvim < Cask if MacOS.version == :mavericks - url 'https://github.com/b4winckler/macvim/releases/download/snapshot-72/MacVim-snapshot-72-Mavericks.tbz' - sha256 'f2543860b27b7c0db9407d9d38d4c2fb5cda5b23845a6c121936116ccf8b0d39' + url 'https://github.com/b4winckler/macvim/releases/download/snapshot-73/MacVim-snapshot-73-Mavericks.tbz' + sha256 '557c60f3487ab68426cf982c86270f2adfd15e8a4d535f762e6d55602754d224' else - url 'https://github.com/eee19/macvim/releases/download/snapshot-72/MacVim-snapshot-72-Mountain-Lion.tbz' - sha256 'f01eb54f73d7d8b750886b706468f234af3d34f9a08f5625cbef20113514f4e5' + url 'https://github.com/eee19/macvim/releases/download/snapshot-73/MacVim-snapshot-73-Mountain-Lion.tbz' + sha256 '7f573fb9693052a86845c0a9cbb0b3c3c33ee23294f9d8111187377e4d89f72c' end homepage 'http://code.google.com/p/macvim/' - version '7.4-72' - link 'MacVim-snapshot-72/MacVim.app' - binary 'MacVim-snapshot-72/mvim' + version '7.4-73' + link 'MacVim-snapshot-73/MacVim.app' + binary 'MacVim-snapshot-73/mvim' caveats do puts <<-EOS.undent Note that homebrew also provides a compiled macvim Formula that links its
Update MacVim to snapshot 73.
diff --git a/Casks/ocrkit.rb b/Casks/ocrkit.rb index abc1234..def5678 100644 --- a/Casks/ocrkit.rb +++ b/Casks/ocrkit.rb @@ -2,6 +2,7 @@ version '15.11.24,62c3a0fc70ed4e5c64527ba781d634bc' sha256 '39502f49af57eea167232cdb7cc71b9f2c102aea611dd11777ba95166368bb7a' + # exactcode.de was verified as official when first introduced to the cask url "http://dl.exactcode.de/tmp/#{version.after_comma}/OCRKit-#{version.before_comma}.dmg" name 'OCRKit' homepage 'http://ocrkit.com/'
Fix `url` stanza comment for OCRKit.
diff --git a/lib/magnum/client/request.rb b/lib/magnum/client/request.rb index abc1234..def5678 100644 --- a/lib/magnum/client/request.rb +++ b/lib/magnum/client/request.rb @@ -2,9 +2,10 @@ module Request API_BASE = "https://magnum-ci.com" - def get(path, params={}) - request(:get, path, params) - end + def get(path, params={}) ; request(:get, path, params) ; end + def post(path, params={}) ; request(:post, path, params) ; end + def put(path, params={}) ; request(:put, path, params) ; end + def delete(path, params={}) ; request(:delete, path, params) ; end private
Add shorthand methods for POST, PUT and DELETE
diff --git a/lib/oanda_api_v20/pricing.rb b/lib/oanda_api_v20/pricing.rb index abc1234..def5678 100644 --- a/lib/oanda_api_v20/pricing.rb +++ b/lib/oanda_api_v20/pricing.rb @@ -31,6 +31,5 @@ ensure buffer.clear end - end end
Remove empty line after method.
diff --git a/lib/sales_tax/accountable.rb b/lib/sales_tax/accountable.rb index abc1234..def5678 100644 --- a/lib/sales_tax/accountable.rb +++ b/lib/sales_tax/accountable.rb @@ -2,21 +2,27 @@ module SalesTax module Accountable + def to_hash + accountable_hash + end + + protected + + def accountable_hash + { + unit_sales_tax: unit_sales_tax.to_s('F'), + total_unit_price: (unit_price + unit_sales_tax).to_s('F') + } + end + + private + def unit_sales_tax round_tax(unit_price * sales_tax_rate) end - private - def unit_price BigDecimal(unit_price_str) - end - - def accountable_to_hash - { - unit_sales_tax: unit_sales_tax.to_s('F'), - total_unit_price: (unit_price + unit_sales_tax).to_s('F') - } end def round_tax(tax)
Update Accountable module to new specs
diff --git a/lib/tasks/subscriptions.rake b/lib/tasks/subscriptions.rake index abc1234..def5678 100644 --- a/lib/tasks/subscriptions.rake +++ b/lib/tasks/subscriptions.rake @@ -6,29 +6,4 @@ Spree::Subscription.delay.create_order(id) end end - - desc 'Generate subscription products' - task generate_products: :environment do - product = Rails.env.production? ? Spree::BpProduct : Spree::SubscriptionProduct - data = { - gender: ['men', 'women'], - recurring: [true, false], - limit: [3,6,9,12], - wrap: ['every month', 'first month', 'none'] - } - - data[:gender].each do |gender| - data[:wrap].each do |wrap| - data[:recurring].each do |recurring| - if recurring - product.delay.generate(gender, recurring, wrap) - else - data[:limit].each do |limit| - product.delay.generate(gender, recurring, wrap, limit) - end - end - end - end - end - end end
Move generate_products rake to main project
diff --git a/cca-spec-babel.rb b/cca-spec-babel.rb index abc1234..def5678 100644 --- a/cca-spec-babel.rb +++ b/cca-spec-babel.rb @@ -12,7 +12,7 @@ def install system "./configure", "--disable-contrib", "--with-babel-config=#{HOMEBREW_PREFIX}/bin/babel-config", - "--with-libxml2=/usr/local/opt/libxml2", + "--with-libxml2=#{HOMEBREW_PREFIX}/opt/libxml2", "--prefix=#{prefix}" system "make", "all"
Use HOMEBREW_PREFIX for path to libxml2.
diff --git a/test/test-netrc.rb b/test/test-netrc.rb index abc1234..def5678 100644 --- a/test/test-netrc.rb +++ b/test/test-netrc.rb @@ -30,13 +30,14 @@ end def test_get_credentials - assert_equal ['rocky@example.com', 'shhhh'], get_credentials + assert_equal ['rocky@example.com', 'shhhh'], get_credentials.to_a end def test_save_credentials new_values = get_credentials.map{|x| x+"abc"} save_credentials(*new_values) - assert_equal new_values, get_credentials, 'Should append "abc" to creds' + assert_equal(new_values, get_credentials.to_a, + 'Should append "abc" to creds') end def test_delete_credentials
Allow netrc 0.80 (was up to 0.77)
diff --git a/cf-deploy.gemspec b/cf-deploy.gemspec index abc1234..def5678 100644 --- a/cf-deploy.gemspec +++ b/cf-deploy.gemspec @@ -6,7 +6,7 @@ spec.name = 'cf-deploy' spec.version = CF::Deploy::VERSION spec.authors = ['Luke Morton'] - spec.email = ['luke@madebymade.co.uk'] + spec.email = ['luke@madetech.co.uk'] spec.summary = %q{Rake tasks for deploying to CloudFoundry v6+} spec.homepage = 'https://github.com/madebymade/cf-deploy' spec.license = 'MIT'
Update email address to @madetech.co.uk
diff --git a/db/migrations/012_nanolitre.rb b/db/migrations/012_nanolitre.rb index abc1234..def5678 100644 --- a/db/migrations/012_nanolitre.rb +++ b/db/migrations/012_nanolitre.rb @@ -1,9 +1,9 @@ ::Sequel.migration do up do - fetch('UPDATE aliquots SET quantity = quantity*1000 WHERE quantity is not null AND `type` = "solvent"').all + self[:aliquots].exclude(:quantity => nil).where(:type => "solvent").update(:quantity => Sequel.expr(:quantity) * 1000) end down do - fetch('UPDATE aliquots SET quantity = quantity/1000 WHERE quantity is not null AND `type` = "solvent"').all + self[:aliquots].exclude(:quantity => nil).where(:type => "solvent").update(:quantity => Sequel.expr(:quantity) / 1000) end end
Fix migration. Use Sequel instead of plain SQL
diff --git a/lib/signal.rb b/lib/signal.rb index abc1234..def5678 100644 --- a/lib/signal.rb +++ b/lib/signal.rb @@ -38,10 +38,7 @@ def emit_signal(type, event, *args) listeners.each do |listener| method_name = "#{type}_#{event}" - - if listener.respond_to?(method_name) - listener.public_send(method_name, *args) - end + listener.send(method_name, *args) if listener.respond_to?(method_name) end end end
Send messages without considering method visibility. This way we can send messages to private methods from controller.
diff --git a/example/minimal.rb b/example/minimal.rb index abc1234..def5678 100644 --- a/example/minimal.rb +++ b/example/minimal.rb @@ -8,4 +8,5 @@ Resque.redis = Redis.new(:host => host, :port => port) end -worker 'resqued-example-queue' +worker_pool 1 +queue 'resqued-example-queue'
Use a worker pool in the example, so that it's really easy to scale up.
diff --git a/common_spree_dependencies.rb b/common_spree_dependencies.rb index abc1234..def5678 100644 --- a/common_spree_dependencies.rb +++ b/common_spree_dependencies.rb @@ -3,8 +3,6 @@ # the one component of Spree. source 'https://rubygems.org' -gem 'json' -gem 'multi_json' gem 'mysql2' gem 'pg' gem 'sqlite3' @@ -20,7 +18,7 @@ gem 'launchy' gem 'pry' gem 'rspec-rails', '~> 2.14.0' - gem 'selenium-webdriver', '~> 2.33' + gem 'selenium-webdriver', '~> 2.35' gem 'simplecov' gem 'webmock', '1.8.11' end
Update selenium and remove uneeded gemfile additions.
diff --git a/smoke_test/steps/base_step.rb b/smoke_test/steps/base_step.rb index abc1234..def5678 100644 --- a/smoke_test/steps/base_step.rb +++ b/smoke_test/steps/base_step.rb @@ -24,7 +24,7 @@ self.class.name.split('::').last.gsub(/(?=[A-Z])/, ' ') end - def with_retries(attempts: 5, initial_delay: 2, max_delay: 30) + def with_retries(attempts: 10, initial_delay: 2, max_delay: 120) delay = initial_delay result = nil attempts.times do
Change timeouts to account for sidekiq queue This has changed the amount of time it takes for an email to get through the system, resulting in smoke test timeouts. This change should fix that.
diff --git a/spec/middleware_stack_spec.rb b/spec/middleware_stack_spec.rb index abc1234..def5678 100644 --- a/spec/middleware_stack_spec.rb +++ b/spec/middleware_stack_spec.rb @@ -0,0 +1,40 @@+require 'spec_helper' + +describe Fluffle::MiddlewareStack do + describe '#call' do + it 'calls the middleware in the correct order' do + order = [] + + middleware1 = ->(parent) { + order.push :pre1 + result = parent.call + order.push :post1 + result + } + + middleware2 = ->(parent) { + order.push :pre2 + result = parent.call + order.push :post2 + result + } + + result = double 'result' + block = -> { + order.push :block + result + } + + subject.push middleware1 + subject.push middleware2 + expect(subject.call(&block)).to eq result + expect(order).to eq [ + :pre1, + :pre2, + :block, + :post2, + :post1, + ] + end + end +end
Add spec for middleware stack
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,4 +4,5 @@ validates :password, presence: true, length: { minimum: 6 } has_secure_password + acts_as_authentic end
Make the User model acts_as_authentic
diff --git a/spec/unit/veritas/optimizer/algebra/rename/projection_operand/optimizable_spec.rb b/spec/unit/veritas/optimizer/algebra/rename/projection_operand/optimizable_spec.rb index abc1234..def5678 100644 --- a/spec/unit/veritas/optimizer/algebra/rename/projection_operand/optimizable_spec.rb +++ b/spec/unit/veritas/optimizer/algebra/rename/projection_operand/optimizable_spec.rb @@ -5,12 +5,19 @@ describe Optimizer::Algebra::Rename::ProjectionOperand, '#optimizable?' do subject { object.optimizable? } - let(:header) { Relation::Header.coerce([ [ :one, Integer ], [ :two, Integer ] ]) } - let(:base) { Relation.new(header, [ [ 1, 2 ] ].each) } - let(:object) { described_class.new(relation) } + let(:header) { Relation::Header.coerce([ [ :one, Integer ], [ :two, Integer ], [ :three, Integer ] ]) } + let(:base) { Relation.new(header, [ [ 1, 2 ] ].each) } + let(:object) { described_class.new(relation) } before do object.operation.should be_kind_of(Algebra::Rename) + end + + context 'when the operand is a projection and the aliases do not conflict with a removed column' do + let(:operand) { base.project([ :one, :two ]) } + let(:relation) { operand.rename(:one => :other, :two => :one) } + + it { should be(true) } end context 'when the operand is a projection and the alias does not conflict with a removed column' do
Add spec to cover new mutation
diff --git a/Casks/dbeaver-enterprise.rb b/Casks/dbeaver-enterprise.rb index abc1234..def5678 100644 --- a/Casks/dbeaver-enterprise.rb +++ b/Casks/dbeaver-enterprise.rb @@ -1,11 +1,11 @@ cask :v1 => 'dbeaver-enterprise' do - version '3.2.0' + version '3.3.0' if Hardware::CPU.is_32_bit? - sha256 'c090a03f84589f94ebd90d6ea6981359325ace75a9e25aae569456642a2142dc' + sha256 '355171432176ff7c34ea087bca1884ad93415a61c7506618cac9831cce6a81c4' url "http://dbeaver.jkiss.org/files/dbeaver-#{version}-ee-macosx.cocoa.x86.zip" else - sha256 'ebf8fd5bb5eb1bc0e21cf5d2c93d956d3c171164f98767d1dda89c0ac8716093' + sha256 'd332ff41a2fb8ed492fcfd24b1cba773719746794cd314513a93209f8e9e0966' url "http://dbeaver.jkiss.org/files/dbeaver-#{version}-ee-macosx.cocoa.x86_64.zip" end
Update DBeaver enterprise to v3.3.0
diff --git a/test/travis.rb b/test/travis.rb index abc1234..def5678 100644 --- a/test/travis.rb +++ b/test/travis.rb @@ -6,5 +6,6 @@ result = `sass test/silent.scss build.silent.css --style compressed` raise result unless $?.to_i == 0 -raise "When $use-silent-classes is set to true the module should not output any CSS" unless File.size('build.silent.css') == 0 +raise File.size('build.silent.css') +raise "When $_silent is set to true the module should not output any CSS" unless File.size('build.silent.css') == 0 puts "Silent sass compiled successfully"
Print file size for debugging
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -55,6 +55,13 @@ erb :details end +post '/details/:post_id' do + post_id = params['post_id'] + content = params[:content] + + erb "You typed comment: #{content} for post #{post_id}" + +end @@ -68,4 +75,3 @@ -
Add simple /details/.. post handler
diff --git a/Casks/android-studio-canary.rb b/Casks/android-studio-canary.rb index abc1234..def5678 100644 --- a/Casks/android-studio-canary.rb +++ b/Casks/android-studio-canary.rb @@ -1,6 +1,6 @@ cask 'android-studio-canary' do - version '2.0.0.4-143.2489090' - sha256 '274f80c964ad21d17dfd75105f35249e64dd9a4e178a75e7bb6974ed430fa468' + version '2.0.0.5-143.2532994' + sha256 '9d86b86a902fc756ecdc600f39a5b847fc119d7af80303f6f30d65974ae6bd07' url "https://dl.google.com/dl/android/studio/ide-zips/#{version.sub(%r{-.*},'')}/android-studio-ide-#{version.sub(%r{.*?-},'')}-mac.zip" name 'Android Studio Canary'
Update Android Studio (Canary) to 2.0 preview 5
diff --git a/api/app/controllers/v1/analytics_controller.rb b/api/app/controllers/v1/analytics_controller.rb index abc1234..def5678 100644 --- a/api/app/controllers/v1/analytics_controller.rb +++ b/api/app/controllers/v1/analytics_controller.rb @@ -23,6 +23,7 @@ def segment(method, allowed_arguments) analytics = Segment::Analytics.new(write_key: SEGMENT_WRITE_KEY) arguments = params.permit(allowed_arguments).to_h + logger.debug("Sending #{method} request to Segment, with params: #{arguments}") analytics.public_send(method, arguments)
Add debugger logging to analytics
diff --git a/cookbooks/apache/recipes/ssl.rb b/cookbooks/apache/recipes/ssl.rb index abc1234..def5678 100644 --- a/cookbooks/apache/recipes/ssl.rb +++ b/cookbooks/apache/recipes/ssl.rb @@ -24,6 +24,10 @@ include_recipe "apache" include_recipe "ssl" +apache_module "socache_shmcb" do + only_if { node[:lsb][:release].to_f >= 14.04 } +end + apache_module "ssl" template "/etc/apache2/conf.d/ssl" do
Enable socache_shmcb for apache SSL support on 14.04
diff --git a/default_options.gemspec b/default_options.gemspec index abc1234..def5678 100644 --- a/default_options.gemspec +++ b/default_options.gemspec @@ -19,6 +19,5 @@ spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.6" - spec.add_development_dependency "rake" - spec.add_development_dependency 'rspec' + spec.add_development_dependency "rspec", "~> 3.0.0" end
Remove rake requirement; add version to rspec dependency
diff --git a/app/importers/file_importers/csv_downloader.rb b/app/importers/file_importers/csv_downloader.rb index abc1234..def5678 100644 --- a/app/importers/file_importers/csv_downloader.rb +++ b/app/importers/file_importers/csv_downloader.rb @@ -1,3 +1,5 @@+# This is a service object that works with importer classes. It factors out +# shared logic that downloads CSVs and cleans them up before import. class CsvDownloader def initialize(log:, client:, remote_file_name:, transformer:)
Add code comment to CsvDownloader class
diff --git a/lib/mdi_cloud_decoder/core.rb b/lib/mdi_cloud_decoder/core.rb index abc1234..def5678 100644 --- a/lib/mdi_cloud_decoder/core.rb +++ b/lib/mdi_cloud_decoder/core.rb @@ -2,8 +2,7 @@ def self.decode(input) raw_data = JSON.parse(input) MData.new(raw_data) - rescue Exception => ex - puts ex.to_s + rescue nil end end
Return null on decode failure
diff --git a/lib/meter/rails/middleware.rb b/lib/meter/rails/middleware.rb index abc1234..def5678 100644 --- a/lib/meter/rails/middleware.rb +++ b/lib/meter/rails/middleware.rb @@ -9,15 +9,30 @@ def call(env) request = Rack::Request.new(env) Meter::MDC.data['request_id'] = env['action_dispatch.request_id'] + Meter::MDC.data['pid'] = Process.pid + Meter::MDC.data['ip'] = request.ip.presence || '?' + store_user_agent_data(request) + store_geoip_data(request) + + @app.call(env) + ensure + Meter::MDC.clear! + end + + def store_user_agent_data(request) user_agent = UserAgent.parse(request.user_agent) Meter::MDC.tags['user_agent_name'] = user_agent.browser Meter::MDC.tags['user_agent_version'] = "#{user_agent.browser}_#{user_agent.version}" Meter::MDC.tags['user_agent_platform'] = user_agent.platform Meter::MDC.data['user_agent'] = user_agent.to_s - @app.call(env) - ensure - Meter::MDC.clear! + end + + def store_geoip_data(request) + return unless defined?(Locality) + lookup = Locality::IP.new request.ip + Meter::MDC.tags['geoip_city'] = lookup.city_name + Meter::MDC.tags['geoip_country'] = lookup.country_name end end end
Add geoip info and more
diff --git a/lib/multi_json/adapters/oj.rb b/lib/multi_json/adapters/oj.rb index abc1234..def5678 100644 --- a/lib/multi_json/adapters/oj.rb +++ b/lib/multi_json/adapters/oj.rb @@ -13,6 +13,7 @@ end def self.dump(object, options={}) #:nodoc: + options.merge!(:indent => 2) if options[:pretty] || options['pretty'] ::Oj.dump(object, options) end end
Add pretty support to Oj adapter Fixes #51.
diff --git a/lib/skeleton/config/deploy.rb b/lib/skeleton/config/deploy.rb index abc1234..def5678 100644 --- a/lib/skeleton/config/deploy.rb +++ b/lib/skeleton/config/deploy.rb @@ -5,6 +5,14 @@ set :s3, YAML::load( File.open( File.expand_path( '../s3.yml', __FILE__ ) ) ) +# +# Set optionnal S3 headers for cachec controls, +# might you to set this only for production +# +# set :bucket_write_options, { +# cache_control: "max-age=94608000, public" +# } + before 'deploy' do run_locally "rm -rf ./public" run_locally "mkdir public"
Add nice cache_control write options note
diff --git a/lib/tty/prompt/reader/mode.rb b/lib/tty/prompt/reader/mode.rb index abc1234..def5678 100644 --- a/lib/tty/prompt/reader/mode.rb +++ b/lib/tty/prompt/reader/mode.rb @@ -7,8 +7,8 @@ # Initialize a Terminal # # @api public - def initialize(options = {}) - @input = $stdin + def initialize(input = $stdin) + @input = input end # Echo given block
Change to direclty pass in dependency.
diff --git a/lib/zensana/services/asana.rb b/lib/zensana/services/asana.rb index abc1234..def5678 100644 --- a/lib/zensana/services/asana.rb +++ b/lib/zensana/services/asana.rb @@ -5,7 +5,9 @@ class Asana include HTTParty base_uri 'https://app.asana.com/api/1.0' - default_timeout 5 + default_timeout 10 + debug_output + headers 'Content-Type' => 'application/json' def initialize(user, pword) @auth = {username: user, password: pword} @@ -15,14 +17,11 @@ request :get, path, options, &block end - def request(method, path, params={}, &block) - params.merge!({ - :basic_auth => @auth, - :headers => { 'Content-Type' => 'application/json' } - }) - result = HTTParty.send(method, path, params) + def request(method, path, options={}, &block) + options.merge!({:basic_auth => @auth}) + result = HTTParty.send(method, path, options) - Zensana::Error.handle_http_errors result + Error.handle_http_errors result Response.new(result).tap do |response| block.call(response) if block_given?
Add debug and other options to HTTParty
diff --git a/db/data_migration/20130123135129_convert_supporting_page_admin_urls_to_numeric_ids.rb b/db/data_migration/20130123135129_convert_supporting_page_admin_urls_to_numeric_ids.rb index abc1234..def5678 100644 --- a/db/data_migration/20130123135129_convert_supporting_page_admin_urls_to_numeric_ids.rb +++ b/db/data_migration/20130123135129_convert_supporting_page_admin_urls_to_numeric_ids.rb @@ -0,0 +1,16 @@+OLD_ADMIN_LINK_REGEX = %r{/government/admin/editions/([^/]+)/supporting-pages/([\w-]+)} +Edition.where("state <> 'archived'").find_each do |edition| + next unless edition.body.match(OLD_ADMIN_LINK_REGEX) + edition.body.dup.scan(OLD_ADMIN_LINK_REGEX) do |match| + edition_id, slug = match + next if slug =~ /^[0-9]+$/ + page = SupportingPage.find_by_slug_and_edition_id(slug, edition_id) + if page.nil? + puts "Edition #{edition.id}: Cannot find supporting page '#{slug}'" + next + end + edition.body.gsub!(%r{/government/admin/editions/#{edition_id}/supporting-pages/#{slug}}, + "/government/admin/editions/#{edition_id}/supporting-pages/#{page.id.to_s}") + end + edition.update_column(:body, edition.body) +end
Migrate supporting page admin links to ids This data migration will destructively modify old editions converting all the supporting page urls that are in body copy as admin links to use numerical IDs, not slugs. This will then be converted by the previous commit to the correct govspeak links on public display.
diff --git a/EKAlgorithms.podspec b/EKAlgorithms.podspec index abc1234..def5678 100644 --- a/EKAlgorithms.podspec +++ b/EKAlgorithms.podspec @@ -4,7 +4,7 @@ s.summary = "EKAlgorithms contains some well known CS algorithms and other stuff." s.homepage = "https://github.com/EvgenyKarkan/EKAlgorithms" s.license = "MIT" - s.authors = { "Evgeny Karkan" => "https://github.com/EvgenyKarkan" } + s.authors = { "Evgeny Karkan" => "https://github.com/EvgenyKarkan", 'Stanislaw Pankevich' => 's.pankevich@gmail.com' } s.source = { :git => "https://github.com/EvgenyKarkan/EKAlgorithms.git", :tag => s.version.to_s } s.frameworks = 'Foundation', 'CoreGraphics', 'UIKit' s.platform = :ios, '5.0'
Add Stanislaw Pankevich to list of authors
diff --git a/ltsv_logger_formatter.gemspec b/ltsv_logger_formatter.gemspec index abc1234..def5678 100644 --- a/ltsv_logger_formatter.gemspec +++ b/ltsv_logger_formatter.gemspec @@ -26,4 +26,5 @@ spec.add_development_dependency 'bundler', '~> 1.13' spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec', '~> 3.0' + spec.add_development_dependency 'actionpack' end
Add actionpack to development dependency
diff --git a/lib/log_service.rb b/lib/log_service.rb index abc1234..def5678 100644 --- a/lib/log_service.rb +++ b/lib/log_service.rb @@ -7,11 +7,14 @@ # not_legacy = !headers.keys.join(" ").include?("mqtt") # if (not_legacy) # Extract current user (if version is appropriate) - device_id = delivery_info.routing_key.split(".")[1].gsub("device_", "").to_i - device = Device.find(device_id) - # Parse payload - payload = JSON.parse(payload) - puts "===== INCOMING LOG =====" - puts payload + # device_id = delivery_info.routing_key.split(".")[1].gsub("device_", "").to_i + # device = Device.find(device_id) + # # Parse payload + # payload = JSON.parse(payload) + + # # {"meta"=>{"z"=>0, "y"=>0, "x"=>0, "type"=>"info"}, "message"=>"HQ FarmBot TEST 123 Pin 13 is 0", "created_at"=>1512585641, "channels"=>[]} + + # puts "===== INCOMING LOG =====" + # puts payload # end end
Comment logs service out for now
diff --git a/lib/tasks/hdo.rake b/lib/tasks/hdo.rake index abc1234..def5678 100644 --- a/lib/tasks/hdo.rake +++ b/lib/tasks/hdo.rake @@ -17,7 +17,7 @@ CSV(out) do |csv| promises.each do |promise| - csv << [promise.external_id, promise.body, promise.categories.map(&:name).join(',')] + csv << [promise.external_id, promise.categories.map(&:name).join(','), promise.body] end end end
Change column order in promise csv.
diff --git a/lib/tentd/model.rb b/lib/tentd/model.rb index abc1234..def5678 100644 --- a/lib/tentd/model.rb +++ b/lib/tentd/model.rb @@ -6,7 +6,7 @@ NoDatabaseError = Class.new(StandardError) unless TentD.database - raise NoDatabaseError.new("You need to set ENV['DATABASE_URL'] or TentD.database_url") + raise NoDatabaseError.new("You need to set ENV['DATABASE_URL'] or pass database_url option to TentD.setup!") end require 'tentd/models/type'
Update exception message when database url missing
diff --git a/screenshot_spec.rb b/screenshot_spec.rb index abc1234..def5678 100644 --- a/screenshot_spec.rb +++ b/screenshot_spec.rb @@ -2,16 +2,23 @@ require File.expand_path("../spec_helper", __FILE__) describe "Watir::Screenshot" do + let(:png_header) do + str = "\211PNG" + str.force_encoding('BINARY') if str.respond_to?(:force_encoding) + + str + end + describe '#png' do it 'gets png representation of screenshot' do - browser.screenshot.png[0..3].should == "\211PNG" + browser.screenshot.png[0..3].should == png_header end end describe '#base64' do it 'gets base64 representation of screenshot' do image = browser.screenshot.base64 - Base64.decode64(image)[0..3].should == "\211PNG" + Base64.decode64(image)[0..3].should == png_header end end @@ -21,7 +28,7 @@ File.should_not exist(path) browser.screenshot.save(path) File.should exist(path) - File.open(path, "rb") {|io| io.read}[0..3].should == "\211PNG" + File.open(path, "rb") {|io| io.read}[0..3].should == png_header end end end
Fix for Ruby 2.0 (default UTF-8 encoding)