diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/projects/badges_controller.rb b/app/controllers/projects/badges_controller.rb index abc1234..def5678 100644 --- a/app/controllers/projects/badges_controller.rb +++ b/app/controllers/projects/badges_controller.rb @@ -4,7 +4,7 @@ before_action :no_cache_headers, except: [:index] def index - @ref = params[:ref] || 'master' + @ref = params[:ref] || @project.default_branch || 'master' @build_badge = Gitlab::Badge::Build.new(@project, @ref) end
Use default branch when displaying list of badges
diff --git a/lib/blogue/engine.rb b/lib/blogue/engine.rb index abc1234..def5678 100644 --- a/lib/blogue/engine.rb +++ b/lib/blogue/engine.rb @@ -6,6 +6,8 @@ app.config.assets.paths << ( File.expand_path(Blogue.assets_path || "#{Blogue.posts_path}/assets") ) + + app.config.assets.precompile += ['*.jpg', '*.png', '*.gif'] end config.after_initialize do
Add all image formats to precompile array
diff --git a/ci_environment/kerl/attributes/source.rb b/ci_environment/kerl/attributes/source.rb index abc1234..def5678 100644 --- a/ci_environment/kerl/attributes/source.rb +++ b/ci_environment/kerl/attributes/source.rb @@ -1,2 +1,2 @@-default[:kerl][:releases] = %w(R14B02 R14B03 R14B04 R15B R15B01 R15B02 R15B03 R16B R16B01 R16B02 R16B03 R16B03-1 17.0-rc1 17.0-rc2) +default[:kerl][:releases] = %w(R14B02 R14B03 R14B04 R15B R15B01 R15B02 R15B03 R16B R16B01 R16B02 R16B03 R16B03-1 17.0) default[:kerl][:path] = "/usr/local/bin/kerl"
Support Erlang 17.0 with kerl Also drop support for the previous Erlang 17.0 release candidates.
diff --git a/lib/rubocop/cop/variable_inspector/reference.rb b/lib/rubocop/cop/variable_inspector/reference.rb index abc1234..def5678 100644 --- a/lib/rubocop/cop/variable_inspector/reference.rb +++ b/lib/rubocop/cop/variable_inspector/reference.rb @@ -7,14 +7,20 @@ class Reference include Locatable + VARIABLE_REFERENCE_TYPES = ( + [VARIABLE_REFERENCE_TYPE] + + OPERATOR_ASSIGNMENT_TYPES + + [ZERO_ARITY_SUPER_TYPE] + ).freeze + attr_reader :node, :scope def initialize(node, scope) - # unless VARIABLE_ASSIGNMENT_TYPES.include?(node.type) - # fail ArgumentError, - # "Node type must be any of #{VARIABLE_ASSIGNMENT_TYPES}, " + - # "passed #{node.type}" - # end + unless VARIABLE_REFERENCE_TYPES.include?(node.type) + fail ArgumentError, + "Node type must be any of #{VARIABLE_REFERENCE_TYPES}, " + + "passed #{node.type}" + end @node = node @scope = scope
Fix an ad-hoc comment out
diff --git a/lib/fakefs/kernel.rb b/lib/fakefs/kernel.rb index abc1234..def5678 100644 --- a/lib/fakefs/kernel.rb +++ b/lib/fakefs/kernel.rb @@ -9,12 +9,14 @@ def self.hijack! captives[:hijacked].each do |name, prc| + ::Kernel.send(:remove_method, name.to_sym) ::Kernel.send(:define_method, name.to_sym, &prc) end end def self.unhijack! captives[:original].each do |name, _prc| + ::Kernel.send(:remove_method, name.to_sym) ::Kernel.send(:define_method, name.to_sym, proc do |*args, &block| ::FakeFS::Kernel.captives[:original][name].call(*args, &block) end)
Remove methods before re-defining them This prevents ruby from dumping a ton of "method redefined" warnings to the console.
diff --git a/lib/filmbuff/imdb.rb b/lib/filmbuff/imdb.rb index abc1234..def5678 100644 --- a/lib/filmbuff/imdb.rb +++ b/lib/filmbuff/imdb.rb @@ -18,7 +18,7 @@ result = self.class.get('/title/maindetails', :query => { :tconst => imdb_id, :locale => @locale }).parsed_response - + Title.new(result['data']) end
Add newline for increased readability
diff --git a/lib/haml/template.rb b/lib/haml/template.rb index abc1234..def5678 100644 --- a/lib/haml/template.rb +++ b/lib/haml/template.rb @@ -33,7 +33,7 @@ end -Haml::Template.options[:ugly] = defined?(Rails) ? !Rails.env.development? : true +Haml::Template.options[:ugly] = defined?(Rails.env) ? !Rails.env.development? : true Haml::Template.options[:escape_html] = true require 'haml/template/plugin'
Check for definition of Rails.env rather than Rails See #842
diff --git a/lib/hamlit/parser.rb b/lib/hamlit/parser.rb index abc1234..def5678 100644 --- a/lib/hamlit/parser.rb +++ b/lib/hamlit/parser.rb @@ -26,7 +26,7 @@ end def call(template) - template = Haml::Util.check_haml_encoding(template) do |msg, line| + template = Hamlit::HamlUtil.check_haml_encoding(template) do |msg, line| raise Hamlit::Error.new(msg, line) end HamlParser.new(template, HamlOptions.new(@options)).parse
Fix fatal issue that Hamlit depends on Haml Fix #125
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -23,7 +23,7 @@ url: endpoints[endpoint]["url"], headers: endpoints[endpoint]["headers"].symbolize_keys!, verify_ssl: OpenSSL::SSL::VERIFY_NONE, -# If you require basic auth +# If you require basic auth # user: ENV['AUTH_USER'], # password: ENV['AUTH_PASSWORD'], payload: endpoints[endpoint]["payload"] @@ -31,9 +31,13 @@ end def make_request endpoint - if JSON.parse(RestClient::Request.execute(request_params(endpoint)).try(:force_encoding, 'UTF-8')) - "The endpoint #{endpoints[endpoint]["url"]} seems to be responding" + begin + if JSON.parse(RestClient::Request.execute(request_params(endpoint)).try(:force_encoding, 'UTF-8')) + "The endpoint #{endpoints[endpoint]["url"]} seems to be responding" + end + rescue JSON::ParserError + "The endpoint #{endpoints[endpoint]["url"]} doesn't seem to be responding" + rescue RestClient::Exception + "The endpoint #{endpoints[endpoint]["url"]} doesn't seem to be responding" end -rescue RestClient::Exception - "The endpoint #{endpoints[endpoint]["url"]} doesn't seem to be responding" end
Return not working message if endpoint returns invalid JSON
diff --git a/week-4/shortest-string/my_solution.rb b/week-4/shortest-string/my_solution.rb index abc1234..def5678 100644 --- a/week-4/shortest-string/my_solution.rb +++ b/week-4/shortest-string/my_solution.rb @@ -0,0 +1,69 @@+# Shortest String + +# I worked on this challenge [by myself]. + +# shortest_string is a method that takes an array of strings as its input +# and returns the shortest string +# +# +list_of_words+ is an array of strings +# shortest_string(array) should return the shortest string in the +list_of_words+ +# +# If +list_of_words+ is empty the method should return nil + +#Your Solution Below + +=begin ======PSEUDOCODE 1====== + +INPUT: a seris of words (as an array of strings) +OUTPUT: the shortest word (a string in an array) + +CREATE an empty array called OUTPUT + +IF the INPUT is empty + RETURN a value of nothing +IF the INPUT is not empty + FOR each word in the INPUT + IF length of word 1 (target) is less than length of next word + set the OUTPUT array equal to word 1 (target) + IF the length of word 1 (target) is greater than length of next word + increase word 1 (target) to the next word (target+1) and run this conditional again. + END the if statement + return OUTPUT array + END the loop +END the if statement + + +=end #======PSEUDOCODE 1====== + + +#=begin ======Initial Solution====== + +def shortest_string(list_of_words) + if list_of_words == [] + return nil + elsif list_of_words.length == 1 + return list_of_words[0] + else + counter = 1 + target = 0 + next_word = 1 + while counter < list_of_words.length + if list_of_words[target].length < list_of_words[next_word].length + next_word += 1 + elsif + target += 1 + next_word += 1 + end + counter += 1 + end + return list_of_words[target] + end +end + + +#=end #======Initial Solution====== + + +#=begin ======Refactored Solution====== + +#=end #======Refactored Solution======
Complete initial solution passing all tests
diff --git a/tools/generate-many-segment-data.rb b/tools/generate-many-segment-data.rb index abc1234..def5678 100644 --- a/tools/generate-many-segment-data.rb +++ b/tools/generate-many-segment-data.rb @@ -0,0 +1,86 @@+#!/usr/bin/env ruby +# +# Copyright(C) 2019 Kouhei Sutou <kou@clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +require "json" +require "optparse" + +n_records = 50_000_000 +max_code_point = 0xFFFF +n_characters_per_record = 100 +use_section = false +parser = OptionParser.new +parser.on("--n-records=N", Integer, + "[#{n_records}]") do |n| + n_records = n +end +parser.on("--[no-]use-section", + "[#{use_section}]") do |boolean| + use_section = boolean +end +parser.parse! + +if use_section + columns = 5.times.collect {|i| "value#{i}"} +else + columns = ["value"] +end + +puts(<<-COMMANDS) +table_create Data TABLE_NO_KEY +COMMANDS +columns.each do |column| + puts(<<-COMMANDS) +column_create Data #{column} COLUMN_SCALAR Text + COMMANDS +end + +index_column_flags = "COLUMN_INDEX|WITH_POSITION" +if columns.size > 1 + index_column_flags += "|WITH_SECTION" +end +puts(<<-COMMANDS) +table_create Terms TABLE_PAT_KEY ShortText \ + --normalizer NormalizerNFKC100 \ + --default_tokenizer TokenRegexp +column_create Terms index #{index_column_flags} Data #{columns.join(",")} +COMMANDS + +puts(<<-LOAD) +load --table Data +[ +LOAD +n_records.times do + record = {} + columns.each do |column| + value = "" + n_characters_per_record.times do + while true + code_point = rand(max_code_point) + character = [code_point].pack("U")[0] + if character.valid_encoding? + value << character + break + end + end + end + record[column] = value + end + puts(record.to_json) +end +puts(<<-LOAD) +] +LOAD
Add a tool that generates data to use many segments
diff --git a/test/mqueue_test.rb b/test/mqueue_test.rb index abc1234..def5678 100644 --- a/test/mqueue_test.rb +++ b/test/mqueue_test.rb @@ -46,7 +46,7 @@ end def test_timedsendsend_raises_exception_instead_of_blocking - 10.times { @queue.send "walrus" } + 10.times { @queue.timedsend 0, 0, "walrus" } assert_raises POSIX::Mqueue::QueueFull do @queue.timedsend(0, 0, "hi")
Change nonblocking send test to use timedsend
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 @@ -15,6 +15,10 @@ File.join(ROOT, *args) end + def setup + FileUtils.rm(File.join(ROOT, "test", "tmp", ".monk")) + end + def monk(args = nil) sh("env MONK_HOME=#{File.join(ROOT, "test", "tmp")} ruby -rubygems #{root "bin/monk"} #{args}") end
Reset the .monk config after each test.
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 @@ -12,3 +12,5 @@ assert_equal message, error.message end + +Streamy.logger = Logger.new("test.log")
Write test log output to file
diff --git a/http-commands.gemspec b/http-commands.gemspec index abc1234..def5678 100644 --- a/http-commands.gemspec +++ b/http-commands.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'http-commands' - s.version = '0.2.0' + s.version = '0.2.1' s.summary = 'Convenience abstractions for common HTTP operations, such as post and get' s.description = ' '
Package version is incremented from 0.2.0 to 0.2.1
diff --git a/config/puma.rb b/config/puma.rb index abc1234..def5678 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -17,7 +17,7 @@ before_fork do require 'puma_worker_killer' - PumaWorkerKiller.enable_rolling_restart(12.hours) + PumaWorkerKiller.enable_rolling_restart(3.hours) end if %w(development test).include?(ENV['RACK_ENV'])
Revert rolling restarts to 3 hours
diff --git a/lib/emcee/document.rb b/lib/emcee/document.rb index abc1234..def5678 100644 --- a/lib/emcee/document.rb +++ b/lib/emcee/document.rb @@ -16,8 +16,7 @@ end def to_s - body = @doc.at("body").children - body.to_s.lstrip + body = @doc.at("body").inner_html.lstrip end def html_imports
Use `inner_html` instead of `children.to_s` Returns the intended html
diff --git a/tzinfo-data.gemspec b/tzinfo-data.gemspec index abc1234..def5678 100644 --- a/tzinfo-data.gemspec +++ b/tzinfo-data.gemspec @@ -1,7 +1,6 @@ Gem::Specification.new do |s| s.name = 'tzinfo-data' s.version = '1.2012.9' - s.date = '2012-10-01' s.summary = 'Data for the TZInfo library' s.description = 'The standard tz (Olson) database packaged as Ruby modules for use with TZInfo.' s.author = 'Philip Ross'
Remove date property from gemspec. This is set automatically.
diff --git a/lib/model_patches.rb b/lib/model_patches.rb index abc1234..def5678 100644 --- a/lib/model_patches.rb +++ b/lib/model_patches.rb @@ -5,11 +5,4 @@ # See http://stackoverflow.com/questions/7072758/plugin-not-reloading-in-development-mode # Rails.configuration.to_prepare do - OutgoingMessage.class_eval do - # Add intro paragraph to new request template - def default_letter - return nil if self.message_type == 'followup' - #"If you uncomment this line, this text will appear as default text in every message" - end - end end
Delete OutgoingMessage changes as we don't use these
diff --git a/lib/traject/queue.rb b/lib/traject/queue.rb index abc1234..def5678 100644 --- a/lib/traject/queue.rb +++ b/lib/traject/queue.rb @@ -4,11 +4,8 @@ # Extend the normal queue class with some useful methods derived from # its java counterpart - -if defined? JRUBY_VERSION - Traject::Queue = java.util.concurrent.LinkedBlockingQueue -else - class Traject::Queue < Queue +module Traject + class Queue < Queue alias_method :put, :enq alias_method :take, :deq @@ -35,3 +32,4 @@ end end end +
Remove use of java.util.concurrent.LinkedBlockingQueue because it doesn't buy us anything but complexity
diff --git a/lib/tumugi/logger.rb b/lib/tumugi/logger.rb index abc1234..def5678 100644 --- a/lib/tumugi/logger.rb +++ b/lib/tumugi/logger.rb @@ -7,6 +7,10 @@ include Singleton extend Forwardable def_delegators :@logger, :debug, :error, :fatal, :info, :warn, :level + + def initialize + init + end def init(output=STDOUT) @logger = ::Logger.new(output)
Call init first Tumugi::Logger instance access
diff --git a/league_of_legends.gemspec b/league_of_legends.gemspec index abc1234..def5678 100644 --- a/league_of_legends.gemspec +++ b/league_of_legends.gemspec @@ -10,6 +10,7 @@ spec.email = ["francisco.orvalho@gmail.com"] spec.summary = %q{Implementation of the LoL API} spec.description = %q{This gem implements the League Of Legends API (currently in open beta). It will continue to be updated as the API evolves. + Please see the README at https://github.com/forvalho/league_of_legends/blob/master/README.md This product is not endorsed, certified or otherwise approved in any way by Riot Games, Inc. or any of its affiliates.} spec.homepage = "http://github.com/forvalho/league_of_legends"
Add 'read the README' to the gemspec
diff --git a/lib/appointment_ticket.rb b/lib/appointment_ticket.rb index abc1234..def5678 100644 --- a/lib/appointment_ticket.rb +++ b/lib/appointment_ticket.rb @@ -31,8 +31,6 @@ def comment <<-TEXT.strip_heredoc - New appointment request - Name: #{@appointment.full_name}
Remove duplicate subject from appointment ticket
diff --git a/spec/models/benchmark_schedule_spec.rb b/spec/models/benchmark_schedule_spec.rb index abc1234..def5678 100644 --- a/spec/models/benchmark_schedule_spec.rb +++ b/spec/models/benchmark_schedule_spec.rb @@ -28,4 +28,16 @@ end end end + + describe 'filtering schedules' do + let(:active_schedule) { create(:benchmark_schedule, active: true) } + let(:inactive_schedule) { create(:benchmark_schedule, active: false) } + before do + active_schedule.save! + inactive_schedule.save! + end + it 'should show only active schedules' do + expect(BenchmarkSchedule.actives.size).to eq 1 + end + end end
Add spec for filtering schedules
diff --git a/lib/engineyard/version.rb b/lib/engineyard/version.rb index abc1234..def5678 100644 --- a/lib/engineyard/version.rb +++ b/lib/engineyard/version.rb @@ -1,4 +1,4 @@ module EY - VERSION = '2.0.11' + VERSION = '2.0.12.pre' ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.0.5' end
Add .pre for next release
diff --git a/lib/gotcha-bot/factory.rb b/lib/gotcha-bot/factory.rb index abc1234..def5678 100644 --- a/lib/gotcha-bot/factory.rb +++ b/lib/gotcha-bot/factory.rb @@ -14,6 +14,7 @@ end def shutdown! + # TODO: Stop all the teams in the database EM.add_shutdown_hook { @instance = nil } EM.stop begin; end until !running?
Add TODO for stopping teams
diff --git a/lib/qml/qt_object_base.rb b/lib/qml/qt_object_base.rb index abc1234..def5678 100644 --- a/lib/qml/qt_object_base.rb +++ b/lib/qml/qt_object_base.rb @@ -2,21 +2,16 @@ module QML class QtObjectBase - def initialize(ptr) - self.pointer = ptr - @_gc_protected = [] - end + attr_reader :pointer - def pointer - @_pointer - end - - def pointer=(ptr) - @_pointer = FFI::AutoPointer.new(ptr, CLib.method(:qobject_destroy)) + def initialize(ptr, destroy: true) + fail TypeError, 'ptr must be a FFI::Pointer' unless ptr.is_a? FFI::Pointer + @pointer = destroy ? FFI::AutoPointer.new(ptr, CLib.method(:qobject_destroy)) : ptr + @gc_protected = [] end def gc_protect(obj) - @_gc_protected << obj + @gc_protected << obj end end
Add destroy: option to QtObjectBase.new
diff --git a/lib/redmine_diff_email.rb b/lib/redmine_diff_email.rb index abc1234..def5678 100644 --- a/lib/redmine_diff_email.rb +++ b/lib/redmine_diff_email.rb @@ -1,9 +1,5 @@ # Set up autoload of patches -def apply_patch(&block) - ActionDispatch::Callbacks.to_prepare(&block) -end - -apply_patch do +Rails.configuration.to_prepare do require_dependency 'redmine_diff_email/patches/changeset_patch' require_dependency 'redmine_diff_email/patches/mailer_patch' require_dependency 'redmine_diff_email/patches/repository_patch'
Use Rails.configuration.to_prepare to load patches
diff --git a/lib/typedown2blog/spec.rb b/lib/typedown2blog/spec.rb index abc1234..def5678 100644 --- a/lib/typedown2blog/spec.rb +++ b/lib/typedown2blog/spec.rb @@ -3,6 +3,22 @@ require 'mail_processor' module Typedown2Blog + def symbolize_keys(hash) + hash.inject({}){|result, (key, value)| + new_key = case key + when String then key.to_sym + else key + end + new_value = case value + when Hash then symbolize_keys(value) + else value + end + result[new_key] = new_value + result + } + end + + class Spec def self.setup &block instance_eval &block if block_given? @@ -11,7 +27,7 @@ def self.retriever_method method, options={}, &block @retriever = MailProcessor::Processor.new do - retriever method, options, &block + retriever method, symbolize_keys(options), &block end @retriever end @@ -26,7 +42,7 @@ def self.delivery_method m, options= {} Mail.defaults do - delivery_method m, options + delivery_method m, symbolize_keys(options) end end
Support yaml format for retriever settings
diff --git a/lib/value_caster/event.rb b/lib/value_caster/event.rb index abc1234..def5678 100644 --- a/lib/value_caster/event.rb +++ b/lib/value_caster/event.rb @@ -9,7 +9,7 @@ attr_reader :name, :action, :method def action_class - "ValueCaster::Action::#{action.classify}".constantize + "ValueCaster::Action::#{action.to_s.classify}".constantize end end end
Add `to_s`. because if action is symbol instance, raises error
diff --git a/spec/lib/rspec/examples_spec.rb b/spec/lib/rspec/examples_spec.rb index abc1234..def5678 100644 --- a/spec/lib/rspec/examples_spec.rb +++ b/spec/lib/rspec/examples_spec.rb @@ -1,6 +1,7 @@ describe Rambo::RSpec::Examples do let(:raml_file) { File.expand_path("../../../support/foobar.raml", __FILE__) } - let(:raml) { Raml::Parser.parse(File.read(raml_file)) } + let(:raw_raml) { Raml::Parser.parse(File.read(raml_file)) } + let(:raml) { Rambo::RamlModels::Api.new(raw_raml) } subject { Rambo::RSpec::Examples.new(raml) }
Make examples specs all pass
diff --git a/thrift_client.gemspec b/thrift_client.gemspec index abc1234..def5678 100644 --- a/thrift_client.gemspec +++ b/thrift_client.gemspec @@ -20,4 +20,6 @@ s.add_development_dependency 'rake' s.add_development_dependency 'mongrel', '1.2.0.pre2' + s.add_development_dependency 'rack' + s.add_development_dependency 'thin' end
Add undeclared dependencies for thrift thrift requires rack and thin in its Thrift::ThinHTTPServer but does not declare them in the gemspec.
diff --git a/spec/fizzbuzz_spec.rb b/spec/fizzbuzz_spec.rb index abc1234..def5678 100644 --- a/spec/fizzbuzz_spec.rb +++ b/spec/fizzbuzz_spec.rb @@ -0,0 +1,27 @@+# TODO: For a given number, return the sequence from 1 to that number but with the following sustitutions: +# +# * If the number is **not divisible** by **2** or **3**, then the number will **not** be changed. +# * If the number is divisible by **2**, then sustitute the number by the word "**Fizz**". +# * If the number is divisible by **3**, then sustitute the number by the word "**Buzz**". +# * If the number is divisible by **2** and by **3**, then sustitute teh numbre by the word "**FizzBuzz**". +# +# Examples: +# +# Example 1: If the passed number is '2', the output should be: +# +# 1 +# Fizz +# +# Example 2: If the passed number is '7', the output should be: +# +# 1 +# Fizz +# Buzz +# Fizz +# 5 +# FizzBuzz +# 7 +# + +describe "FizzBuzz parser" do +end
Add the base for the tests and the TODO list
diff --git a/rubyfox-server.gemspec b/rubyfox-server.gemspec index abc1234..def5678 100644 --- a/rubyfox-server.gemspec +++ b/rubyfox-server.gemspec @@ -6,8 +6,8 @@ Gem::Specification.new do |gem| gem.name = "rubyfox-server" gem.version = Rubyfox::Server::VERSION - gem.authors = ["Peter Suschlik"] - gem.email = ["ps@neopoly.de"] + gem.authors = ["Peter Leitzen", "Volker Schäfer"] + gem.email = ["pl@neopoly.de", "vs@neopoly.de"] gem.description = %q{SmartFox Server bundled as a gem} gem.summary = %q{} gem.homepage = "https://github.com/neopoly/rubyfox-server"
Add @wakkowarner as author and rename @splattael's name
diff --git a/lib/automobile.rb b/lib/automobile.rb index abc1234..def5678 100644 --- a/lib/automobile.rb +++ b/lib/automobile.rb @@ -3,6 +3,6 @@ module BrighterPlanet module Automobile extend BrighterPlanet::Emitter - scope 'The automobile emission estimate is the total anthropogenic emissions from fuel and air conditioning used by the automobile during the timeframe. It includes CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions from combustion of all fuel, and fugitive HFC emissions from air conditioning.' + scope 'The automobile emission estimate is the total anthropogenic emissions from fuel and air conditioning used by the automobile during the timeframe. It includes CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions from combustion of all fuel, and fugitive HFC emissions from air conditioning. For vehicles powered by grid electricity it includes the emissions from generating that electricity.' end end
Update description of emission calculation scope
diff --git a/lib/capistrano.rb b/lib/capistrano.rb index abc1234..def5678 100644 --- a/lib/capistrano.rb +++ b/lib/capistrano.rb @@ -1,5 +1,7 @@ require 'rake' require 'sshkit' + +Rake.application.options.trace = true require 'capistrano/version' require 'capistrano/i18n'
Enable printing of a proper stack trace by Rake when we err out
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,5 +32,7 @@ end end - resources :discussion_boards, :only => [ :edit, :update ] + resources :discussion_boards, :only => [ :edit, :update ] do + resources :topics, :only => [ :new, :create ] + end end
Add new and create Routes for Topics Update the routing file to include new and create actions for Topics.
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -24,5 +24,11 @@ resources :lessons, :only => [ :create, :update ] end - resources :blogs, :only => [ :edit ] + resources :blogs, :only => [ :edit, :update ] do + member do + # handle image updates + match '/change_image' => 'blogs#change_image', :as => :change_image_for + match '/upload_image' => 'blogs#upload_image', :as => :upload_image_for + end + end end
Add Routes for Blog update and Image Update Add routing to accommodate updating a Blog, to include changing its corresponding image.
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 @@ match '/auth/register', to: 'auth#register', via: 'post' match '/auth/login', to: 'auth#login', via: 'post' match '/auth/token_status', to: 'auth#token_status', via: 'get' + match 'ratings/find', to: 'ratings#find', via: 'get', :format => 'json' end
Refactor ratings find route to emit json
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ Rails.application.routes.draw do root 'home#index' - resources 'workspaces', path: 's', format: false do + resources 'workspaces', path: 'w', format: false do resources 'sequences', param: :name, format: false, constraints: { name: %r{[^\/]+} }
Change the path prefix of workspace actions
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,6 @@ Rails.application.routes.draw do - root to: redirect('/register') + root to: redirect(ENV.fetch('ROOT_REDIRECT', '/register')) + get '/register', as: 'new_user_profile', to: 'user_profiles#new' post '/register', as: 'user_profile', to: 'user_profiles#create' end
Allow environment to configure root redirect
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,6 +5,7 @@ get "/drops/followees" => 'drops#followees' resources :users, only: [:show] do resources :follows, only: [:index] + resources :drops, only: [:index] end resources :follows, only: [:create, :destroy]
Add nested drops to get json for maps
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,10 +9,10 @@ scope '/i', format: true, constraints: { format: 'json' } do resources :feeds, only: [:index, :create, :show, :destroy] do - put 'mark_as_read', on: :member - put 'mark_all_as_read', on: :collection + patch 'mark_as_read', on: :member + patch 'mark_all_as_read', on: :collection resources :newsitems, only: [:show], path: '/' do - put 'mark_as_read', on: :member + patch 'mark_as_read', on: :member end end end
Use patch as per rails 4
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,6 @@ Rails.application.routes.draw do get '/.well-known/acme-challenge/:id' => 'pages#letsencrypt' + get '/discord' => redirect('https://discord.gg/FYr5g9a') get "/*action", controller: :pages, as: :page root to: "pages#home" end
Add convenience link to redirect to Community Discord server
diff --git a/lib/eigenclass.rb b/lib/eigenclass.rb index abc1234..def5678 100644 --- a/lib/eigenclass.rb +++ b/lib/eigenclass.rb @@ -1,6 +1,8 @@ require 'forwardable' require 'eigenclass/version' +# Provides access to an object's {eigenclass} and defines +# some convenient helper methods to interact with it. module Eigenclass extend Forwardable @@ -11,6 +13,8 @@ def_delegator :eigenclass, :instance_eval, :eigenclass_eval def_delegator :eigenclass, :instance_exec, :eigenclass_exec + # Alias of {Object#singleton_class} + # @see http://ruby-doc.org/core-1.9.2/Object.html#method-i-singleton_class def eigenclass class << self self
Add documentation to the `Eigenclass` module and method
diff --git a/lib/guard/less.rb b/lib/guard/less.rb index abc1234..def5678 100644 --- a/lib/guard/less.rb +++ b/lib/guard/less.rb @@ -43,7 +43,7 @@ def run(paths) last_passed = false paths.each do |file| - unless File.basename(file)[0] == "_" + unless File.basename(file)[0,1] == "_" UI.info "lessc - #{file}\n" last_passed = system("lessc #{file} --verbose") end
Fix partial exclusion for Ruby 1.8 str[Fixnum] in 1.9 returns the `chr` equivalent of the index position, but 1.8 returned the character code. Using the `[offset, length]` form should work portably here.
diff --git a/lib/hamburglar.rb b/lib/hamburglar.rb index abc1234..def5678 100644 --- a/lib/hamburglar.rb +++ b/lib/hamburglar.rb @@ -5,7 +5,7 @@ autoload :Report, 'hamburglar/report' autoload :Gateways, 'hamburglar/gateways' - GATEWAYS = [:max_mind, :fraud_guardian].freeze + GATEWAYS = [:max_mind].freeze class << self # The current gateway @@ -22,4 +22,6 @@ end @gateway = gateway end + + self.gateway = :max_mind end
Make Hamburglar default to MaxMind until FraudGuardian is added
diff --git a/lib/rocket_job.rb b/lib/rocket_job.rb index abc1234..def5678 100644 --- a/lib/rocket_job.rb +++ b/lib/rocket_job.rb @@ -25,8 +25,9 @@ module Jobs autoload :PerformanceJob, 'rocket_job/jobs/performance_job' end - module Collection - autoload :Base, 'rocket_job/collection/base' + module Sliced + autoload :Slice, 'rocket_job/collection/slice' + autoload :Slices, 'rocket_job/collection/slices' autoload :Input, 'rocket_job/collection/input' autoload :Output, 'rocket_job/collection/output' end
Change Collection namespace to Sliced
diff --git a/lib/transforms.rb b/lib/transforms.rb index abc1234..def5678 100644 --- a/lib/transforms.rb +++ b/lib/transforms.rb @@ -4,7 +4,7 @@ def to_url return if self.nil? - self.downcase.tr("\"'", '').strip.gsub(/\W/, '-').tr(' ', '-').squeeze('-') + self.downcase.tr("\"'", '').gsub(/\W/, ' ').strip.tr_s(' ', '-').tr(' ', '-').sub(/^$/, "-") end # A quick and dirty fix to add 'nofollow' to any urls in a string.
Tweak permalink transformation again so existing tests don't break git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@1014 820eb932-12ee-0310-9ca8-eeb645f39767
diff --git a/lib/turbolinks.rb b/lib/turbolinks.rb index abc1234..def5678 100644 --- a/lib/turbolinks.rb +++ b/lib/turbolinks.rb @@ -8,21 +8,27 @@ module Turbolinks class Engine < ::Rails::Engine initializer :turbolinks do |config| - ActionController::Base.class_eval do - include XHRHeaders, Cookies, XDomainBlocker, Redirection - before_filter :set_xhr_redirected_to, :set_request_method_cookie - after_filter :abort_xdomain_redirect + ActiveSupport.on_load(:action_controller) do + ActionController::Base.class_eval do + include XHRHeaders, Cookies, XDomainBlocker, Redirection + before_filter :set_xhr_redirected_to, :set_request_method_cookie + after_filter :abort_xdomain_redirect + end end - ActionDispatch::Request.class_eval do - def referer - self.headers['X-XHR-Referer'] || super + ActiveSupport.on_load(:action_dispatch) do + ActionDispatch::Request.class_eval do + def referer + self.headers['X-XHR-Referer'] || super + end + alias referrer referer end - alias referrer referer end - (ActionView::RoutingUrlFor rescue ActionView::Helpers::UrlHelper).module_eval do - include XHRUrlFor + ActiveSupport.on_load(:action_view) do + (ActionView::RoutingUrlFor rescue ActionView::Helpers::UrlHelper).module_eval do + include XHRUrlFor + end end end end
Use AS.on_load in the initializer without these hooks, `require 'turbolinks'` immediately triggers ActionController, ActionDispatch, and ActionView initializers
diff --git a/resources/rubygems/operating_system.rb b/resources/rubygems/operating_system.rb index abc1234..def5678 100644 --- a/resources/rubygems/operating_system.rb +++ b/resources/rubygems/operating_system.rb @@ -1,18 +1,22 @@ # :DK-BEG: missing DevKit/build tool convenience notice Gem.pre_install do |gem_installer| unless gem_installer.spec.extensions.empty? - have_tools = %w{gcc make sh}.all? do |t| - system("#{t} --version > NUL 2>&1") - end + begin + load 'devkit' + rescue LoadError + have_tools = %w{gcc make sh}.all? do |t| + system("#{t} --version > NUL 2>&1") + end - unless have_tools - raise Gem::InstallError,<<-EOT + unless have_tools + raise Gem::InstallError,<<-EOT The '#{gem_installer.spec.name}' native gem requires installed build tools. Please update your PATH to include build tools or download the DevKit from 'http://rubyinstaller.org/downloads' and follow the instructions at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit' EOT + end end end end
Check for installed devkit after upgrade Closes #151
diff --git a/messaging.gemspec b/messaging.gemspec index abc1234..def5678 100644 --- a/messaging.gemspec +++ b/messaging.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-messaging' - s.version = '0.17.0.0' + s.version = '0.17.1.0' s.summary = 'Common primitives for platform-specific messaging implementations for Eventide' s.description = ' '
Package version increased from 0.17.0.0 to 0.17.1.0
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -2,19 +2,19 @@ cache_sweeper :blog_sweeper def index - @users = User.order('login asc').page(params[:page]).per(this_blog.admin_display_elements) + @users = User.order(:id).page(params[:page]).per(this_blog.admin_display_elements) end def new @user = User.new @profiles = Profile.order('id') end - + def create @user = User.new(params[:user].permit!) @user.text_filter = TextFilter.find_by_name(this_blog.text_filter) @user.name = @user.login - + if @user.save flash[:success] = I18n.t('admin.users.create.success') redirect_to admin_users_path @@ -28,10 +28,10 @@ @user = User.find(params[:id]) @profiles = Profile.order('id') end - + def update @user = User.find(params[:id]) - + if @user.update_attributes(params[:user].permit!) flash[:success] = I18n.t('admin.users.update.success') redirect_to admin_users_path
Order users by id instead of login
diff --git a/app/controllers/alerts_list_controller.rb b/app/controllers/alerts_list_controller.rb index abc1234..def5678 100644 --- a/app/controllers/alerts_list_controller.rb +++ b/app/controllers/alerts_list_controller.rb @@ -19,6 +19,7 @@ def class_icons res = {} [ + 'ManageIQ::Providers::Kubernetes::ContainerManager', 'ManageIQ::Providers::Kubernetes::ContainerManager::ContainerNode', 'ManageIQ::Providers::Openshift::ContainerManager', ].each do |klass|
Add missing kubernetes icon to alert screens
diff --git a/app/controllers/api/motions_controller.rb b/app/controllers/api/motions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/motions_controller.rb +++ b/app/controllers/api/motions_controller.rb @@ -3,7 +3,7 @@ @motions = if @@query.empty? paginate Motion.all.order(change_query_order), per_page: change_per_page else - paginate Motion.where("lower(name) LIKE ?", @@query).order(change_query_order), per_page: change_per_page + paginate Motion.where("lower(amendment_text) LIKE ?", @@query).order(change_query_order), per_page: change_per_page end render json: @motions
Fix API Query For Motion To Use Amendment Text
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 @@ -1,3 +1,9 @@ class ApplicationController < ActionController::API include ActionController::Serialization + + #make root node false, globally + def default_serializer_options + {root: false} + end + end
Set global default to make root node false
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,10 @@ # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + rescue_from ActiveRecord::RecordNotFound do + respond_to do |type| + type.all {render :nothing => true, :status => 404} + end + end end
Add rescue from record not found clause This will make the app return 404 when user tries to act on non-existing id
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,7 +7,7 @@ def current_user return nil if session[:user_id].nil? - User.find(session[:user_id]) + User.find_by(id: session[:user_id]) end def ensure_that_signed_in
Change current_user to use find_by
diff --git a/app/controllers/v1/webhooks_controller.rb b/app/controllers/v1/webhooks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/v1/webhooks_controller.rb +++ b/app/controllers/v1/webhooks_controller.rb @@ -16,12 +16,23 @@ repo = Git.open repo_path repo.reset_hard 'HEAD' repo.pull + + # Execute post update script, e.g. + # "cd /etc/puppet/environments/production; librarian-puppet install" + return unless post_update_script.present? + Bundler.with_clean_env do + system "bash -c #{Shellwords.escape post_update_script}" + end end private def repo_path - @repo_path ||= ENV['puppet_repository_path'] + ENV['puppet_repository_path'] + end + + def post_update_script + ENV['puppet_repository_post_update'] end end end
Add support for a post update script
diff --git a/try/13_set_tryouts.rb b/try/13_set_tryouts.rb index abc1234..def5678 100644 --- a/try/13_set_tryouts.rb +++ b/try/13_set_tryouts.rb @@ -0,0 +1,13 @@+require "rye" + +## save any raised exceptions +set = Rye::Set.new("set test", :parallel => true) +set.add_boxes("localhost", "_") +set.hostname.last.first.class +#=> SocketError + +## save any raised exceptions alongside normal results +set = Rye::Set.new("set test", :parallel => true) +set.add_boxes("localhost", "_") +set.hostname.first.first.class +#=> String
Add tests for exception saving in parallel Rye::Set results
diff --git a/execjs.gemspec b/execjs.gemspec index abc1234..def5678 100644 --- a/execjs.gemspec +++ b/execjs.gemspec @@ -9,7 +9,7 @@ s.summary = "Run JavaScript code from Ruby" s.description = "ExecJS lets you run JavaScript code from Ruby." - s.files = Dir["README.md", "LICENSE", "lib/**/*"] + s.files = Dir["README.md", "MIT-LICENSE", "lib/**/*"] s.add_development_dependency "rake"
Fix to include license file to gem This is a fix for 3064d756.
diff --git a/control_center.gemspec b/control_center.gemspec index abc1234..def5678 100644 --- a/control_center.gemspec +++ b/control_center.gemspec @@ -13,7 +13,7 @@ s.description = "Control and monitor website." s.add_development_dependency("compass", "0.10.6") - s.add_dependency("haml", "~>3.0.24") + s.add_dependency("haml", ">=3.1.0.alpha.147") s.add_dependency("devise", "~>1.1.3") s.add_dependency("mongoid", "2.0.0.beta.20") s.add_dependency("bson_ext", "~>1.1.2")
Update haml version, so it doesn’t include Sass anymore.
diff --git a/lib/algoliasearch/utilities.rb b/lib/algoliasearch/utilities.rb index abc1234..def5678 100644 --- a/lib/algoliasearch/utilities.rb +++ b/lib/algoliasearch/utilities.rb @@ -2,7 +2,11 @@ module Utilities class << self def get_model_classes - Rails.application.eager_load! if Rails.application # Ensure all models are loaded (not necessary in production when cache_classes is true). + if defined?(Rails.autoloaders) && Rails.autoloaders.zeitwerk_enabled? + Zeitwerk::Loader.eager_load_all + elsif Rails.application + Rails.application.eager_load! + end AlgoliaSearch.instance_variable_get :@included_in end
Use Zeitwerk for loading models in Rails 6 In Rails 6, model loading is no longer working. This is because Zeitwerk has replaced the original code loading. We now use Zeitwerk if it's available.
diff --git a/lib/lita/handlers/keepalive.rb b/lib/lita/handlers/keepalive.rb index abc1234..def5678 100644 --- a/lib/lita/handlers/keepalive.rb +++ b/lib/lita/handlers/keepalive.rb @@ -2,6 +2,7 @@ module Handlers class Keepalive < Handler config :url, required: true, type: String + config :minutes, required: true, type: Integer http.get "/ping" do |request, response| response.body << "pong" @@ -9,7 +10,7 @@ on(:loaded) do log.info "Starting Keepalive to #{config.url}/ping" - every(60) do + every(config.minutes) do log.info "Keepalive ping..." http.get "#{config.url}/ping" end
Make ping time in minutes configurable
diff --git a/lib/rock_config/yaml_loader.rb b/lib/rock_config/yaml_loader.rb index abc1234..def5678 100644 --- a/lib/rock_config/yaml_loader.rb +++ b/lib/rock_config/yaml_loader.rb @@ -25,7 +25,7 @@ end def load_yaml_from(path) - YAML.load(File.read(path)) + YAML.load_file(path) end end end
Use YAML's load_file instead of doing File read and YAML load
diff --git a/lib/spontaneous/permissions.rb b/lib/spontaneous/permissions.rb index abc1234..def5678 100644 --- a/lib/spontaneous/permissions.rb +++ b/lib/spontaneous/permissions.rb @@ -45,9 +45,8 @@ protected(:active_user=) def random_string(length) - # can't be bothered to work out the real rules behind this - bytes = (length.to_f / 1.375).ceil + 2 - string = Base58.encode(OpenSSL::Random.random_bytes(bytes).unpack("h*").first.to_i(16)) #=> 44 chars + bytes = ((length * Math.log10(58))/(8 * Math.log10(2))).ceil + 2 + string = Base58.encode(OpenSSL::Random.random_bytes(bytes).unpack("h*").first.to_i(16)) string[0...(length)] end
Correct calculation of number of bytes to generate for a particular length of random string
diff --git a/lib/tasks/reset_groups_pg.rake b/lib/tasks/reset_groups_pg.rake index abc1234..def5678 100644 --- a/lib/tasks/reset_groups_pg.rake +++ b/lib/tasks/reset_groups_pg.rake @@ -0,0 +1,5 @@+desc "Reset Group Table, and sets all members' group_id to null" +task :reset_groups_pg do + Member.update_all(group_id: nil) + ActiveRecord::Base.connection.execute("TRUNCATE TABLE groups RESTART IDENTITY;") +end
Reset groups task take 1
diff --git a/app/models/company_project.rb b/app/models/company_project.rb index abc1234..def5678 100644 --- a/app/models/company_project.rb +++ b/app/models/company_project.rb @@ -1,4 +1,4 @@-class CompanyProjects < ActiveRecord::Base +class CompanyProject < ActiveRecord::Base has_paper_trail belongs_to :project
Fix pluralization of CompanyProject model
diff --git a/app/models/curve_component.rb b/app/models/curve_component.rb index abc1234..def5678 100644 --- a/app/models/curve_component.rb +++ b/app/models/curve_component.rb @@ -1,6 +1,6 @@ module CurveComponent VALID_CSV_TYPES = ["data:text/csv", "text/csv", "text/plain", - "application/octet-stream"] + "application/octet-stream", "application/vnd.ms-excel"] def as_json(*) super.merge('values' => network_curve.to_a)
Add app/vnd.ms-excel as a valid curve MIME type Ref #405
diff --git a/app/models/frontend_router.rb b/app/models/frontend_router.rb index abc1234..def5678 100644 --- a/app/models/frontend_router.rb +++ b/app/models/frontend_router.rb @@ -28,8 +28,10 @@ [ Variant, :id, ] when /evidence/, /evidence_items?/ [ EvidenceItem, :id, ] - when /entrez/ + when /entrez_id/ [ Gene, :entrez_id, ] + when /entrez_name/ + [ Gene, :name , ] when /variant_groups?/ [ VariantGroup, :id, ] when /revisions?/
Support gene names in the direct linking
diff --git a/app/models/nightlight/page.rb b/app/models/nightlight/page.rb index abc1234..def5678 100644 --- a/app/models/nightlight/page.rb +++ b/app/models/nightlight/page.rb @@ -10,7 +10,11 @@ scope :unassigned, ->{ where assignee_id: nil } def to_param - [id, name.gsub("'", "").parameterize].join("-") + if name.present? + [id, name.gsub("'", "").parameterize].join("-") + else + id + end end def brightness
Handle to_param case where name is blank
diff --git a/app/models/where_you_heard.rb b/app/models/where_you_heard.rb index abc1234..def5678 100644 --- a/app/models/where_you_heard.rb +++ b/app/models/where_you_heard.rb @@ -1,5 +1,9 @@ class WhereYouHeard OPTIONS = { + '19' => 'Media - Pensions Awareness Day', + '20' => 'Media - Leaving planning retirement finances to two years before retirement', + '21' => 'Money and Pensions Service Webinar on Pensions Awareness Day website', + '22' => 'Virtual 121 sessions on Pensions Awareness Day website', '1' => 'An employer', '2' => 'A Pension Provider', '3' => 'Internet search',
Add further options for Pension Awareness Week
diff --git a/spec/services/invoice_renderer_spec.rb b/spec/services/invoice_renderer_spec.rb index abc1234..def5678 100644 --- a/spec/services/invoice_renderer_spec.rb +++ b/spec/services/invoice_renderer_spec.rb @@ -3,13 +3,18 @@ describe InvoiceRenderer do let(:service) { described_class.new } - it "creates a PDF invoice" do + it "creates a PDF invoice with two different templates" do order = create(:completed_order_with_fees) order.bill_address = order.ship_address order.save! result = service.render_to_string(order) + expect(result).to match /^%PDF/ - expect(result).to match /^%PDF/ + allow(Spree::Config).to receive(:invoice_style2?).and_return true + + alternative = service.render_to_string(order) + expect(alternative).to match /^%PDF/ + expect(alternative).to_not eq result end end
Cover alternative invoice template with specs
diff --git a/figaro.gemspec b/figaro.gemspec index abc1234..def5678 100644 --- a/figaro.gemspec +++ b/figaro.gemspec @@ -12,6 +12,7 @@ gem.add_dependency "rails", "~> 3.0" + gem.add_development_dependency "cucumber", "~> 1.0" gem.add_development_dependency "rake", ">= 0.8.7" gem.add_development_dependency "rspec", "~> 2.0"
Add the cucumber gem dependency
diff --git a/fintop.gemspec b/fintop.gemspec index abc1234..def5678 100644 --- a/fintop.gemspec +++ b/fintop.gemspec @@ -8,8 +8,8 @@ s.version = Fintop::VERSION s.authors = ['Evan Meagher'] s.email = ['evan.meagher@gmail.com'] - s.summary = %q{A top-like utility for monitoring Finagle servers} - s.description = %q{Fintop is a top-like monitoring tool Finagle servers} + s.summary = %q{A top-like utility for monitoring Finagle services} + s.description = %q{Fintop is a top-like tool for monitoring Finagle services} s.license = 'MIT' s.files = `git ls-files -z`.split("\x0")
Fix summary/desc wording in gemspec.
diff --git a/app/services/search_orders.rb b/app/services/search_orders.rb index abc1234..def5678 100644 --- a/app/services/search_orders.rb +++ b/app/services/search_orders.rb @@ -32,7 +32,7 @@ def paginated_results @search.result .page(params[:page]) - .per(params[:per_page] || Spree::Config[:orders_per_page]) + .per(params[:per_page]) end def using_pagination?
Remove unnecessary Spree::Config fallback value
diff --git a/spec/factories/link_change_hash.rb b/spec/factories/link_change_hash.rb index abc1234..def5678 100644 --- a/spec/factories/link_change_hash.rb +++ b/spec/factories/link_change_hash.rb @@ -12,6 +12,7 @@ base_path: "target/base/path/#{n}", content_id: SecureRandom.uuid } end + link_type 'taxons' change 'add' user_uid SecureRandom.uuid created_at DateTime.now.to_s
Add link_type to the link_change factory
diff --git a/spec/importers/import_task_spec.rb b/spec/importers/import_task_spec.rb index abc1234..def5678 100644 --- a/spec/importers/import_task_spec.rb +++ b/spec/importers/import_task_spec.rb @@ -2,29 +2,8 @@ RSpec.describe ImportTask do - let(:minimum_valid_options) { - { - 'district' => 'somerville', - 'test_mode' => true - } - } - - describe '#initialize' do - context 'with valid options provided' do - it 'does not raise an error; supplies the correct defaults' do - expect { ImportTask.new(options: minimum_valid_options) }.not_to raise_error - end - end - - context 'with no options provided' do - it 'does not raise an error; supplies the correct defaults' do - expect { ImportTask.new(options: {}) }.to raise_error KeyError - end - end - end - describe '#connect_transform_import' do - let(:task) { ImportTask.new(options: minimum_valid_options) } + let(:task) { ImportTask.new(options: {'test_mode' => true}) } it 'doesn\'t blow up (smoke test)' do task.connect_transform_import
Remove spec coverage of district option that doesn't make sense anymore + We removed district as a configurable option a couple of commits ago (we're trusting ENV as our only source of truth on this), so the specs that were testing required district configuration don't make sense anymore
diff --git a/spec/integration/sprockets_spec.rb b/spec/integration/sprockets_spec.rb index abc1234..def5678 100644 --- a/spec/integration/sprockets_spec.rb +++ b/spec/integration/sprockets_spec.rb @@ -0,0 +1,23 @@+# Frozen-string-literal: true +# Copyright: 2012-2015 - MIT License +# Encoding: utf-8 + +require "rspec/helper" +describe "Sprockets integration" do + let( :env) { Jekyll::Assets::Env.new(site) } + let(:path) { site.in_dest_dir("/assets") } + let(:site) { stub_jekyll_site } + before :each, :process => true do + site.process + end + + before :all do + @site = stub_jekyll_site + @env = Jekyll::Assets::Env.new(@site) + end + + it "allows you to merge CSS with sprockets.", :process => true do + matcher = /^body {\n\s+background-image: "\/assets\/context.jpg";\s+\}/m + expect(@env.find_asset("merge").to_s).to(match(matcher)) + end +end
Add an integration test for sprockets.
diff --git a/spec/support/fake_twilio_client.rb b/spec/support/fake_twilio_client.rb index abc1234..def5678 100644 --- a/spec/support/fake_twilio_client.rb +++ b/spec/support/fake_twilio_client.rb @@ -0,0 +1,17 @@+class FakeTwilioClient + Message = Struct.new(:from, :to, :body) + + cattr_accessor :messages + self.messages = [] + + def initialize + end + + def messages + self + end + + def create(from:, to:, body:) + self.class.messages << Message.new(from: from, to: to, body: body) + end +end
Add stub FakeTwilioClient for testing Twilio
diff --git a/app/views/api/v1/users/show.json.jbuilder b/app/views/api/v1/users/show.json.jbuilder index abc1234..def5678 100644 --- a/app/views/api/v1/users/show.json.jbuilder +++ b/app/views/api/v1/users/show.json.jbuilder @@ -22,10 +22,5 @@ json.name pending.user_name json.url url_for(pending) end - json.pending_invited_friendships user.pending_invited do |pending| - json.id pending.id - json.name pending.user_name - json.url url_for(pending) - end end end
Revert "Add pending invited friendships to user api endpoint" This reverts commit 0d73bf621919e17be9f1b5f14083681cf6672268.
diff --git a/problem_structure.rb b/problem_structure.rb index abc1234..def5678 100644 --- a/problem_structure.rb +++ b/problem_structure.rb @@ -1,4 +1,4 @@-#!/home/jhonnymoreira/.rbenv/shims/ruby +#!/usr/bin/env ruby require 'fileutils' EXTENSIONS = {
Change the reference for ruby executable
diff --git a/app/controllers/bus_stops_controller.rb b/app/controllers/bus_stops_controller.rb index abc1234..def5678 100644 --- a/app/controllers/bus_stops_controller.rb +++ b/app/controllers/bus_stops_controller.rb @@ -10,7 +10,7 @@ end def show - bus_stop = BusStop.find_using_slug!(params[:id]) + bus_stop = BusStop.where(:stop_number => params[:id]).first! expose bus_stop end
Fix issues with finding bus stops
diff --git a/app/controllers/feedbacks_controller.rb b/app/controllers/feedbacks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/feedbacks_controller.rb +++ b/app/controllers/feedbacks_controller.rb @@ -1,7 +1,10 @@ class FeedbacksController < ApplicationController def new + @user = current_user @feedback = Feedback.new @chat_room = ChatRoom.find_by(id: params[:chat_room_id]) + @active_invitations = User.get_active_invitations(@user) + @missed_calls = User.get_missed_calls(@user) @chat = @chat_room.chats.find_by(native_speaker_id: current_user.try(:id) ) @ratings = [["One Star", 1], ["Two Stars", 2], ["Three Stars", 3]] end
Fix feedback form after adding React
diff --git a/puppet-lint-world_writable_files-check.gemspec b/puppet-lint-world_writable_files-check.gemspec index abc1234..def5678 100644 --- a/puppet-lint-world_writable_files-check.gemspec +++ b/puppet-lint-world_writable_files-check.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = 'puppet-lint-world_writable_files-check' - spec.version = '0.0.1' + spec.version = '0.0.2' spec.homepage = 'https://github.com/deanwilson/puppet-lint-world_writable_files-check' spec.license = 'MIT' spec.author = 'Dean Wilson' @@ -18,7 +18,7 @@ them world writable. EOF - spec.add_dependency 'puppet-lint', '~> 1.1' + spec.add_dependency 'puppet-lint', '>= 1.1', '< 3.0' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'rspec-its', '~> 1.0' spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0'
Allow puppet-lint 2.0 as a dependency and bump check version
diff --git a/week-8/ruby_review.rb b/week-8/ruby_review.rb index abc1234..def5678 100644 --- a/week-8/ruby_review.rb +++ b/week-8/ruby_review.rb @@ -0,0 +1,81 @@+# U2.W6: Testing Assert Statements + +# I worked on this challenge by myself. + + +# 1. Review the simple assert statement + +def assert + raise "Assertion failed!" unless yield +end + +name = "bettysue" +assert { name == "bettysue" } +assert { name == "billybob" } + +# 2. Pseudocode what happens when the code above runs + # define a method "assert" that raises an error unless the block of code is true + # define a variable equal to 'bettysue' + # call the assert method on the block (in this case what the variable is equal to) + # the assert method returns nil when the block contains 'bettysue', because the yield statement is true + # the assert method raises the error 'Assertion failed!' when the block contains 'billybob' being equal to the variable 'name' + # the error is raised because the method cannot yield the block of code, due to returning false + +# 3. Copy your selected challenge here + +class GuessingGame + attr_accessor :choice + + + def initialize(answer) + @answer = answer + end + + + def guess(input) + @choice = input + if input > @answer + :high + elsif input == @answer + :correct + else + :low + end + end + + def solved? + @choice == @answer + end +end + + +# 4. Convert your driver test code from that challenge into Assert Statements + def assert + raise "Assertion failed!" unless yield + end + +game = GuessingGame.new(100) +assert { game.guess(100) } +assert { game.solved? == true } +assert { game.guess(148) } +assert { game.solved? == false } + +# -- ORIGINAL DRIVER CODE -- +# game = GuessingGame.new(100) +# p game.guess(98) +# p game.solved? + + +# 5. Reflection + +# What concepts did you review or learn in this challenge? +## Blocks of code, yield statements, defining ruby methods, test driven development and using Driver Test Code. + +# What is still confusing to you about Ruby? +## How to re-write RSpec files into assertion statements. +## Changing the driver code makes sense, but converting and entire RSpec files had me at a loss. + +# What are you going to study to get more prepared for Phase 1? +## Assertion statements, RSpec files as well as attr_ methods. +## I want to work on attr_ methods a bit more because I know there is more I can do with it in my guessing game above. +## From the lecture video, Shadi says we will constantly testing and creating assertions in the real world.
Complete and upload 8.6 Ruby Review
diff --git a/rb/lib/selenium/webdriver/common/port_prober.rb b/rb/lib/selenium/webdriver/common/port_prober.rb index abc1234..def5678 100644 --- a/rb/lib/selenium/webdriver/common/port_prober.rb +++ b/rb/lib/selenium/webdriver/common/port_prober.rb @@ -5,21 +5,25 @@ port += 1 until free? port port end - + def self.random server = TCPServer.new(Platform.localhost, 0) port = server.addr[1] server.close - + port end - + def self.free?(port) - TCPServer.new(Platform.localhost, port).close + interfaces = Socket.getaddrinfo("localhost", port).map { |e| e[2] } + interfaces += ["0.0.0.0", Platform.ip] + interfaces.each { |address| TCPServer.new(address, port).close } + true rescue SocketError, Errno::EADDRINUSE false end + end # PortProber end # WebDriver end # Selenium
JariBakken: Make sure Ruby's PortProber.above checks all network interfaces. git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@16769 07704840-8298-11de-bf8c-fd130f914ac9
diff --git a/AssistantKit.podspec b/AssistantKit.podspec index abc1234..def5678 100644 --- a/AssistantKit.podspec +++ b/AssistantKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'AssistantKit' - s.version = '0.3' + s.version = '0.4' s.summary = 'Easy way to detect and work with  device environments written in Swift' s.description = <<-DESC
Update podspec to version 0.4
diff --git a/convert_waze_data.rb b/convert_waze_data.rb index abc1234..def5678 100644 --- a/convert_waze_data.rb +++ b/convert_waze_data.rb @@ -1,15 +1,27 @@+#!/usr/bin/env ruby +# encoding: utf-8 + require 'json' require 'hashie' -mercator = IO.read("waze/1396867493_mercator.txt") +mercator_file = ARGV[0] +wgs84_out_file = ARGV[1] +tmp_file = "proj_tmp" + +# Extract locations from input file and write them to a temporary file +mercator = IO.read(mercator_file) hash = JSON.parse mercator msg = Hashie::Mash.new hash -File.open("proj_input", "w") do |f| +File.open(tmp_file, "w") do |f| msg.irregularities.each do |irr| irr.line.each do |line| - f.puts line.y.to_s + ' ' + line.x.to_s + f.puts line.y.to_s + ' ' + line.x.to_s end end end -`proj +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs -I -f ’%.9f’ proj_input > proj_output` +# Invoke the proj.4 command to convert from the Waze Mercator projection to WGS84 used by Leaflet, Google maps and others +%x{proj +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs -I -f '%.9f' #{tmp_file} > #{wgs84_out_file}} + +# Remove the temporary file +File.delete tmp_file
Use input arguments for the conversion rather than hardcoded file names
diff --git a/recipes/sequelpro.rb b/recipes/sequelpro.rb index abc1234..def5678 100644 --- a/recipes/sequelpro.rb +++ b/recipes/sequelpro.rb @@ -1,5 +1,6 @@ dmg_package "Sequel Pro" do - volumes_dir "Sequel Pro 0.9.9.1" - source "http://sequel-pro.googlecode.com/files/Sequel_Pro_0.9.9.1.dmg" + volumes_dir "Sequel Pro 1.0" + owner WS_USER + source "http://sequel-pro.googlecode.com/files/sequel-pro-1.0-RC1.dmg" action :install end
Update Sequel Pro to 1.0 RC
diff --git a/Casks/diskmaker-x.rb b/Casks/diskmaker-x.rb index abc1234..def5678 100644 --- a/Casks/diskmaker-x.rb +++ b/Casks/diskmaker-x.rb @@ -1,11 +1,13 @@ cask 'diskmaker-x' do - version :latest - sha256 :no_check + version '5.0.3' + sha256 '040a21bdef0c2682c518a9e9572f7547b5f1fb02b8930a8a084ae85b12e70518' - url 'http://diskmakerx.com/downloads/DiskMaker_X.dmg' + url "http://diskmakerx.com/downloads/DiskMaker_X_#{version.no_dots}.dmg" + appcast 'http://diskmakerx.com/feed/', + checkpoint: '65c41b1c32cf72f4cccd0f467d903ed768dedc407936bf1a64ec90764deb7da1' name 'DiskMaker X' homepage 'http://diskmakerx.com/' license :gratis - app 'DiskMaker X 5.app' + app "DiskMaker X #{version.major}.app" end
Update Diskmaker X to v5.0.3 Turns Diskmaker X back into a versioned cask. The author of Diskmaker reached out to us and has re-uploaded the versioned downloads for us to use. Thanks @diskmakerx! For more information about this commit please check the discussion related to the versioning of Diskmaker in this pull request: https://github.com/caskroom/homebrew-cask/pull/17519
diff --git a/Casks/drop-to-gif.rb b/Casks/drop-to-gif.rb index abc1234..def5678 100644 --- a/Casks/drop-to-gif.rb +++ b/Casks/drop-to-gif.rb @@ -0,0 +1,12 @@+cask :v1 => 'drop-to-gif' do + version '1.25' + sha256 '2d137b0dccde1087d619af41edb48bf4f1b7f7badcc7cafa8ae3f2770d843824' + + url "https://github.com/mortenjust/droptogif/releases/download/#{version}/Drop.to.GIF.zip" + appcast 'https://github.com/mortenjust/droptogif/releases.atom' + name 'Drop to GIF' + homepage 'http://mortenjust.github.io/droptogif' + license :oss + + app 'Drop to GIF.app' +end
Add Drop to GIF.app version 1.25 Zero-click movie to GIF conversion. Select a folder to watch and every movie saved or moved into that folder will be converted to an animated GIF. https://github.com/mortenjust/droptogif
diff --git a/scripts/npm_bundles.rb b/scripts/npm_bundles.rb index abc1234..def5678 100644 --- a/scripts/npm_bundles.rb +++ b/scripts/npm_bundles.rb @@ -7,6 +7,8 @@ "coffee-script" => "coffee", "grunt-cli" => "grunt", "dalek-cli" => "dalek", + "phantomjs" => "", + "capserjs" => "", "gulp" => "", "gh" => "", "bower" => "",
Add phantomjs and casperjs as node modules
diff --git a/Casks/ios-console.rb b/Casks/ios-console.rb index abc1234..def5678 100644 --- a/Casks/ios-console.rb +++ b/Casks/ios-console.rb @@ -0,0 +1,11 @@+cask :v1 => 'ios-console' do + version :latest + sha256 :no_check + + url 'http://downloads.lemonjar.com/iosconsole_latest.zip' + name 'iOS Console' + homepage 'http://lemonjar.com/iosconsole/' + license :gratis + + app 'iOS Console.app' +end
Add iOS Console (0.9.8) to Cask I've added this as a :latest version as I can't find a versioned link. I've also selected the :gratis license as it's free to use, but closed source.
diff --git a/app/controllers/admin/legislation/questions_controller.rb b/app/controllers/admin/legislation/questions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/legislation/questions_controller.rb +++ b/app/controllers/admin/legislation/questions_controller.rb @@ -4,6 +4,10 @@ def index @questions = @process.questions + end + + def new + @question.question_options.build end def create
Build one option for the questions form when creating a new question
diff --git a/app/controllers/atmosphere/api/v1/user_keys_controller.rb b/app/controllers/atmosphere/api/v1/user_keys_controller.rb index abc1234..def5678 100644 --- a/app/controllers/atmosphere/api/v1/user_keys_controller.rb +++ b/app/controllers/atmosphere/api/v1/user_keys_controller.rb @@ -10,7 +10,7 @@ respond_to :json def index - respond_with @user_keys.where(filter) + respond_with @user_keys.order(:name).where(filter) end def show
Add user_keys api index order by name
diff --git a/files/lib/terrachef.rb b/files/lib/terrachef.rb index abc1234..def5678 100644 --- a/files/lib/terrachef.rb +++ b/files/lib/terrachef.rb @@ -1,5 +1,5 @@-require "terrachef/version" - # TODO: figure out how to do this right. $: << File.dirname(__FILE__) -require 'terraform' + +require "terrachef/version" +require "terraform"
Fix loading error due to modifying $: after the load.
diff --git a/docs/analytics_scripts/training_completion.rb b/docs/analytics_scripts/training_completion.rb index abc1234..def5678 100644 --- a/docs/analytics_scripts/training_completion.rb +++ b/docs/analytics_scripts/training_completion.rb @@ -0,0 +1,41 @@+require 'csv' + +cohort = Cohort.find_by(slug: 'spring_2016') + +# CSV of all assigned training modules for courses in the cohort: +# course slug, training module, due date + +courses = cohort.courses +csv_data = [] +courses.each do |course| + course.training_modules.each do |training_module| + due_date = TrainingModuleDueDateManager.new(course: course, training_module: training_module) + .computed_due_date + csv_data << [course.slug, training_module.slug, due_date] + end +end + +CSV.open('/home/sage/spring_2016_training_due_dates.csv', 'wb') do |csv| + csv_data.each do |line| + csv << line + end +end + +# CSV of all training module progress for students in the cohort: +# username, training module, last slide completed, module completion date + +user_csv_data = [] +cohort.students.each do |student| + student.training_modules_users.each do |tmu| + user_csv_data << [student.username, + tmu.training_module.slug, + tmu.last_slide_completed, + tmu.completed_at] + end +end + +CSV.open('/home/sage/spring_2016_student_training_completion.csv', 'wb') do |csv| + user_csv_data.each do |line| + csv << line + end +end
Add script for getting data about training due dates and completion
diff --git a/spec/licensing_spec.rb b/spec/licensing_spec.rb index abc1234..def5678 100644 --- a/spec/licensing_spec.rb +++ b/spec/licensing_spec.rb @@ -3,6 +3,7 @@ describe 'DocumentBuilder licensing' do it 'running docbuilder create temp license' do skip if ENV['BUILDER_PLATFORM'] == 'WEB' + pending('Builder from develop lost license') if builder.semver == Semantic::Version.new('0.0.0') expect(Dir["#{builder.license_path}/*.lickey"].length).to eq(1) end end
Add pending for checking license in builder from develop Since #205
diff --git a/spec/controllers/pd_regimes_controller_spec.rb b/spec/controllers/pd_regimes_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/pd_regimes_controller_spec.rb +++ b/spec/controllers/pd_regimes_controller_spec.rb @@ -2,4 +2,27 @@ RSpec.describe PdRegimesController, :type => :controller do + describe 'GET #new' do + it 'renders the new template' do + get :new + expect(response).to render_template('new') + end + end + + describe 'POST #create' do + context "with valid attributes" do + it 'creates a new PD Regime' do + expect { post :create, pd_regime: { start_date: '01/02/2015' } }.to change(PdRegime, :count).by(1) + expect(response).to redirect_to(pd_info_patient_path(@patient)) + end + end + + context "with invalid attributes" do + it 'creates a new PD Regime' do + expect { post :create, pd_regime: { start_date: nil } }.to change(PdRegime, :count).by(0) + expect(response).to render_template(:new) + end + end + end + end
Set up spec tests for pd_regimes controller.