diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/healthcheck_controller.rb b/app/controllers/healthcheck_controller.rb index abc1234..def5678 100644 --- a/app/controllers/healthcheck_controller.rb +++ b/app/controllers/healthcheck_controller.rb @@ -1,4 +1,4 @@-class HealthcheckController < ActionController::Base +class HealthcheckController < ActionController::API def check Contact.first # check DB connectivity render json: { git_sha1: CURRENT_RELEASE_SHA }
Make the health check controller an API controller This means we won't get warnings about not protecting from a CSRF attack.
diff --git a/language/module_spec.rb b/language/module_spec.rb index abc1234..def5678 100644 --- a/language/module_spec.rb +++ b/language/module_spec.rb @@ -34,6 +34,17 @@ module LangModuleSpec::C2; end }.should raise_error(TypeError) end + + it "allows for reopening a module subclass" do + class ModuleSubClass < Module; end + LangModuleSpec::C3 = ModuleSubClass.new + + module LangModuleSpec::C3 + C4 = 4 + end + + LangModuleSpec::C3::C4.should == 4 + end end describe "An anonymous module" do
Add spec for reopening a sub class of Module
diff --git a/lib/tasks/rename_slugs.rake b/lib/tasks/rename_slugs.rake index abc1234..def5678 100644 --- a/lib/tasks/rename_slugs.rake +++ b/lib/tasks/rename_slugs.rake @@ -0,0 +1,30 @@+# This is a one time run script to change the slugs of two categories +# and update all artefacts that have been tagged with those sections +# TODO: Once this has been run, this script can be deleted + +namespace :migrate do + desc "Change slug for two categories" + task :rename_two_category_slug => :environment do + tag_mappings = [ + ["business/corporation-tax-capital-allowance", "business/business-tax"], + ["driving/blue-badges-parking", "driving/blue-badge-parking"] + ] + tag_mappings.each do |old_tag_id, new_tag_id| + t = Tag.where(tag_id: "#{old_tag_id}").first + if t.nil? + raise "Wa? No frakkin' tag with tag_id #{old_tag_id}" + end + t.tag_id = new_tag_id + t.save! + artefacts = Artefact.any_in(tag_ids: [old_tag_id]) + puts "#{artefacts.count} of artefacts tagged with #{old_tag_id}" + artefacts.each do |a| + puts "Artefact: #{a.slug} with tag_ids #{a.tag_ids}" + index = a.tag_ids.index(old_tag_id) + a.tag_ids[index] = new_tag_id + a.save! + puts "new tag_ids #{a.tag_ids}" + end + end + end +end
Rename two section slugs rake task Last minute request to change slug for two sections.
diff --git a/app/models/carto/helpers/billing_cycle.rb b/app/models/carto/helpers/billing_cycle.rb index abc1234..def5678 100644 --- a/app/models/carto/helpers/billing_cycle.rb +++ b/app/models/carto/helpers/billing_cycle.rb @@ -2,8 +2,7 @@ module BillingCycle def last_billing_cycle day = period_end_date.day rescue 29.days.ago.day - # << operator substract 1 month from the date object - date = (day > Date.today.day ? Date.today << 1 : Date.today) + date = (day > Date.today.day ? (Date.today - 1.month) : Date.today) begin Date.parse("#{date.year}-#{date.month}-#{day}") rescue ArgumentError
Make the code a bit more readable
diff --git a/app/models/miq_ems_refresh_core_worker.rb b/app/models/miq_ems_refresh_core_worker.rb index abc1234..def5678 100644 --- a/app/models/miq_ems_refresh_core_worker.rb +++ b/app/models/miq_ems_refresh_core_worker.rb @@ -6,7 +6,7 @@ self.required_roles = ["ems_inventory"] def self.has_required_role? - return false if Settings.prototype.ems_vmware.update_driven_refresh + return false if Settings.prototype.try(:ems_vmware).try(:update_driven_refresh) super end
Fix Core Refresher if there is no ems_vmware setting If there is no prototype.ems_refresh setting currently the Ems Refresh Core worker will raise an exception.
diff --git a/features/step_definitions/pagination_step_definitions.rb b/features/step_definitions/pagination_step_definitions.rb index abc1234..def5678 100644 --- a/features/step_definitions/pagination_step_definitions.rb +++ b/features/step_definitions/pagination_step_definitions.rb @@ -4,6 +4,7 @@ end Then(/^I can go to the next page$/) do + # TODO: needs verification if we actually navigated to the next page click_link('Next page') end
Include Price Paid information in data stored in the DB
diff --git a/lib/lifesaver/indexing/model_additions.rb b/lib/lifesaver/indexing/model_additions.rb index abc1234..def5678 100644 --- a/lib/lifesaver/indexing/model_additions.rb +++ b/lib/lifesaver/indexing/model_additions.rb @@ -42,8 +42,9 @@ private def enqueue_indexing(options) + operation = options[:operation] Lifesaver::Indexing::Enqueuer.new(model: self, - operation: options[:operation]).enqueue + operation: operation).enqueue end def suppress_indexing?
Use variable to remove 80 char violation
diff --git a/lib/vagrant/provisioners/puppet_server.rb b/lib/vagrant/provisioners/puppet_server.rb index abc1234..def5678 100644 --- a/lib/vagrant/provisioners/puppet_server.rb +++ b/lib/vagrant/provisioners/puppet_server.rb @@ -10,11 +10,8 @@ attr_accessor :puppet_node attr_accessor :options - def initialize - @puppet_server = "puppet" - @puppet_node = nil - @options = [] - end + def puppet_server; @puppet_server || "puppet"; end + def options; @options ||= []; end end def self.config_class
Fix some issues with puppet server config inheritance
diff --git a/src/db/migrate/20120507081132_update_state_for_existing_deployments.rb b/src/db/migrate/20120507081132_update_state_for_existing_deployments.rb index abc1234..def5678 100644 --- a/src/db/migrate/20120507081132_update_state_for_existing_deployments.rb +++ b/src/db/migrate/20120507081132_update_state_for_existing_deployments.rb @@ -21,7 +21,7 @@ Instance::STATE_STOPPED].include?(i.state) } Deployment::STATE_SHUTTING_DOWN else - Deployemnt::STATE_INCOMPLETE + Deployment::STATE_INCOMPLETE end end end
Fix typo in UpdateStateForExistingDeployments migration
diff --git a/lib/angular-ui-rails.rb b/lib/angular-ui-rails.rb index abc1234..def5678 100644 --- a/lib/angular-ui-rails.rb +++ b/lib/angular-ui-rails.rb @@ -4,9 +4,9 @@ module Rails class Engine < ::Rails::Engine # Enabling assets precompiling under rails 3.1 - if Rails.version >= '3.1' + if ::Rails.version >= '3.1' initializer :assets do |config| - Rails.application.config.assets.precompile += %w( angular-ui-ieshiv.js ) + ::Rails.application.config.assets.precompile += %w( angular-ui-ieshiv.js ) end end end
Use the correct Rails module to determine Rails version
diff --git a/lib/autotest/fsevent.rb b/lib/autotest/fsevent.rb index abc1234..def5678 100644 --- a/lib/autotest/fsevent.rb +++ b/lib/autotest/fsevent.rb @@ -28,4 +28,15 @@ end end + Autotest.add_hook :initialize do + class ::Autotest + def wait_for_changes + begin + hook :waiting + Kernel.sleep self.sleep + end until find_files_to_test + end + end + end + end
Include the waiting hook in the wait for changed files loop. This fixes the condition where changes to any ignored files caused fsevent to wake the thread but when autotest ignored the changed file it went back to using its polling loop. By invoking the waiting hook again fsevent is able to put the thread back to sleep as expected. Signed-off-by: Sven Schwyn <84e4dbed99e205d66ece1cbb53e8195d28a06b80@delirium.ch>
diff --git a/Casks/subler.rb b/Casks/subler.rb index abc1234..def5678 100644 --- a/Casks/subler.rb +++ b/Casks/subler.rb @@ -10,6 +10,8 @@ homepage 'https://subler.org/' license :gpl + auto_updates true + app 'Subler.app' zap delete: [
Add auto_updates flag to Subler
diff --git a/spec/lib/llt/diff/parser/postag_spec.rb b/spec/lib/llt/diff/parser/postag_spec.rb index abc1234..def5678 100644 --- a/spec/lib/llt/diff/parser/postag_spec.rb +++ b/spec/lib/llt/diff/parser/postag_spec.rb @@ -33,22 +33,4 @@ postag.clean_analysis.should == res end end - - describe "#report" do - xit "returns a report hash of the postag" do - res = { - datapoints: { - total: 9, - part_of_speech: { total: 1, 'v' => { total: 1 } }, - person: { total: 1, '3' => { total: 1 }, }, - number: { total: 1, 's' => { total: 1 }, }, - tense: { total: 1, 'i' => { total: 1 }, }, - mood: { total: 1, 'i' => { total: 1 }, }, - voice: { total: 1, 'a' => { total: 1 }, }, - } - } - - postag.report.should == res - end - end end
Kill report spec for Postag
diff --git a/spec/realworld/parallel_install_spec.rb b/spec/realworld/parallel_install_spec.rb index abc1234..def5678 100644 --- a/spec/realworld/parallel_install_spec.rb +++ b/spec/realworld/parallel_install_spec.rb @@ -9,7 +9,7 @@ G bundle :install, :jobs => 4, :env => {"DEBUG" => "1"} - (0..3).each {|i| expect(out).to include("#{i}: ") } + expect(out).to match(/[1-3]: /) bundle "show activesupport" expect(out).to match(/activesupport/)
Check that at least one parallel worker is running. The previous check that every worker is used was flaky on Travis.
diff --git a/worker/config/pre-daemonize/container.rb b/worker/config/pre-daemonize/container.rb index abc1234..def5678 100644 --- a/worker/config/pre-daemonize/container.rb +++ b/worker/config/pre-daemonize/container.rb @@ -5,6 +5,10 @@ @lets ||= {} @lets[method] ||= instance_eval(&block) end + end + + let(:media_store) do + S3MediaStore.new(s3_private_bucket, s3_bucket) end let(:sqs_queue_name) do
Add media store to AppContainer
diff --git a/lib/neo4j/rake_tasks.rb b/lib/neo4j/rake_tasks.rb index abc1234..def5678 100644 --- a/lib/neo4j/rake_tasks.rb +++ b/lib/neo4j/rake_tasks.rb @@ -1,5 +1,6 @@ require 'neo4j/rake_tasks/starnix_server_manager' require 'neo4j/rake_tasks/windows_server_manager' +load 'neo4j/rake_tasks/neo4j_server.rake' require 'neo4j/rake_tasks/railtie' if defined?(Rails)
Load rake tasks automatically when gem is required
diff --git a/lib/scss_lint/engine.rb b/lib/scss_lint/engine.rb index abc1234..def5678 100644 --- a/lib/scss_lint/engine.rb +++ b/lib/scss_lint/engine.rb @@ -4,11 +4,15 @@ class Engine ENGINE_OPTIONS = { cache: false, syntax: :scss } + attr_reader :contents + def initialize(scss_or_filename) if File.exists?(scss_or_filename) @engine = Sass::Engine.for_file(scss_or_filename, ENGINE_OPTIONS) + @contents = File.open(scss_or_filename, 'r').read else @engine = Sass::Engine.new(scss_or_filename, ENGINE_OPTIONS) + @contents = scss_or_filename end end
Store actual string contents of SCSS files This will enable us to write linters that can access the original file in cases where line number or other such information can be inferred separately. Change-Id: I02182d1fdd19f1ce1a4c4e072c7a0655f1732889 Reviewed-on: https://gerrit.causes.com/16557 Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com> Tested-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com> Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
diff --git a/cookbooks/resolver/recipes/default.rb b/cookbooks/resolver/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/resolver/recipes/default.rb +++ b/cookbooks/resolver/recipes/default.rb @@ -19,9 +19,14 @@ # = Requires # * node[:resolver][:nameservers] -template "/etc/resolv.conf" do - source "resolv.conf.erb" - owner "root" - group "root" - mode 0644 +if node[:resolver][:nameservers] == [ "" ] + Chef::Log.info("nameservers attribute not set for the resolver cookbook. Exiting so we don't break name resolution on the node") + exit(true) +else + template "/etc/resolv.conf" do + source "resolv.conf.erb" + owner "root" + group "root" + mode 0644 + end end
Make the resolver cookbook fail if the nameservers attribute is empty Former-commit-id: 2ee0b3c63e01aad599982341a14e8d29c130e223 [formerly 56e5c5b7d204c631e026c7e9df7a99352e75f85f] [formerly 1f49a6bdfe85caa9c7bdd096cebe9f942c52c406 [formerly 1af6b2dd61eb5e188db21bfbc652fdcb72211873]] Former-commit-id: 6d4f842ecd1f15a32aaccc1b31986da163c064bc [formerly dcefd6623d9017a9dad85cc4a40001238770fb50] Former-commit-id: ef5fee874b2ea782e1d76508bba0e614a2e79d72
diff --git a/postcode_software.gemspec b/postcode_software.gemspec index abc1234..def5678 100644 --- a/postcode_software.gemspec +++ b/postcode_software.gemspec @@ -15,5 +15,5 @@ s.add_development_dependency 'rspec', '~> 3.1' s.add_development_dependency 'sinatra', '~> 1.4' - s.add_development_dependency 'webmock', '~> 1.20' + s.add_development_dependency 'webmock', '~> 3.0' end
Use newer webmock to work with Ruby 2.4
diff --git a/lib/vagrant-docker-compose/cap/linux/docker_compose_set_project_name.rb b/lib/vagrant-docker-compose/cap/linux/docker_compose_set_project_name.rb index abc1234..def5678 100644 --- a/lib/vagrant-docker-compose/cap/linux/docker_compose_set_project_name.rb +++ b/lib/vagrant-docker-compose/cap/linux/docker_compose_set_project_name.rb @@ -3,12 +3,21 @@ module Cap module Linux module DockerComposeSetProjectName + ROOT_PROFILE_FILE_NAME = "~/.profile" + PROFILE_FILE_NAME = "~/.profile_vagrant-docker-compose_compose-project-name" + def self.docker_compose_set_project_name(machine, config) return if config.project_name.nil? machine.communicate.tap do |comm| - export_command = "echo \"export COMPOSE_PROJECT_NAME='#{config.project_name}'\" >> ~/.profile" - comm.execute(export_command) - comm.sudo(export_command) + export_command = "export COMPOSE_PROJECT_NAME='#{config.project_name}'" + export_injection_command = "echo \"#{export_command}\" > #{PROFILE_FILE_NAME}" + comm.execute(export_injection_command) + comm.sudo(export_injection_command) + + source_command = "source #{PROFILE_FILE_NAME}" + source_injection_command = "if ! grep -q \"#{source_command}\" #{ROOT_PROFILE_FILE_NAME} ; then echo \"#{source_command}\" >> #{ROOT_PROFILE_FILE_NAME} ; fi" + comm.execute(source_injection_command) + comm.sudo(source_injection_command) end end end
Set `COMPOSE_PROJECT_NAME` in an isolated file. What = Set `COMPOSE_PROJECT_NAME` in an isolated file, that gets overwritten each time in full and is loaded by `~/.profile`. Why = This makes the text being added to `~/.profile` consistent and unchanged regardless of what the `COMPOSE_PROJECT_NAME` is set to, which means we can reliably check to see if we've already made the changes we need to to `~/.profile` even if the project name has changed. Thanks = @kazgurs for the PR that led to this, #11.
diff --git a/tweet_processor.rb b/tweet_processor.rb index abc1234..def5678 100644 --- a/tweet_processor.rb +++ b/tweet_processor.rb @@ -1,43 +1,35 @@ module BBC - # TweetProcessor contains all twitter text filtering and word tracking class TweetProcessor - attr_accessor :total_word_count - attr_accessor :word_cont_hash + attr_reader :total_word_count def initialize @total_word_count = 0 - @word_count_hash = {} + @word_count = {} end def add_word_count(tweet) - word_ar = tweet.split(" ") - @total_word_count += word_ar.length + words = tweet.split(" ") + @total_word_count += words.length end def add_words_to_hash(tweet) - filtered_tweet_ar = filter_stop_words(tweet) - - filtered_tweet_ar.each do |word| - if word_count_hash[:"#{word}"].nil? - word_count_hash[:"#{word}"] = 1 + filter_stop_words(tweet).each do |word| + if word_count[word.to_sym].nil? + word_count[word.to_sym] = 1 else - word_count_hash[:"#{word}"] += 1 + word_count[word.to_sym] += 1 end end end def list_top_words(number) - # Simplify with Ruby 2.2.2 Enumerable .max(10) available - # @word_count_hash.max(10) { |a,b| a[1] <=> b[1] } - sorted_word_count_hash = word_count_hash.sort do |kv_pair1, kv_pair2| - kv_pair2[1] <=> kv_pair1[1] - end - - top_kv_pairs = sorted_word_count_hash.first(number) + top_words = word_count.sort do |a, b| + b[1] <=> a[1] + end.first(number) puts "Ten Most Frequent Words:" - top_kv_pairs.each do |key, value| + top_words.each do |key, value| puts "#{key}: #{value}" end end @@ -45,14 +37,13 @@ private def filter_stop_words(tweet) - word_ar = tweet.split(" ") - word_ar.delete_if do |word| + tweet.split(" ").delete_if do |word| STOP_WORDS.include?(word) end end - def word_count_hash - @word_count_hash + def word_count + @word_count end end end
Refactor for concise var naming
diff --git a/app/models/nwmls/member.rb b/app/models/nwmls/member.rb index abc1234..def5678 100644 --- a/app/models/nwmls/member.rb +++ b/app/models/nwmls/member.rb @@ -23,6 +23,10 @@ end end + def listings + @listings ||= Nwmls::Listing::TYPE_TO_CLASS_MAP.collect { |type, klass| public_send(klass.demodulize.underscore.pluralize) }.sum + end + def office @office ||= Nwmls::Office.find office_mlsid end
ADD listings method for Member
diff --git a/lib/action_dispatch/exception_wrapper.rb b/lib/action_dispatch/exception_wrapper.rb index abc1234..def5678 100644 --- a/lib/action_dispatch/exception_wrapper.rb +++ b/lib/action_dispatch/exception_wrapper.rb @@ -1,19 +1,15 @@ module ActionDispatch class ExceptionWrapper def extract_sources - res = []; - - exception.backtrace.each do |trace| + exception.backtrace.map do |trace| file, line, _ = trace.split(":") line_number = line.to_i - res << { + { code: source_fragment(file, line_number), file: file, line_number: line_number } end - - res end end end
Use map instead of each in extract_sources()
diff --git a/lib/action_mailroom/mailbox.rb b/lib/action_mailroom/mailbox.rb index abc1234..def5678 100644 --- a/lib/action_mailroom/mailbox.rb +++ b/lib/action_mailroom/mailbox.rb @@ -31,6 +31,8 @@ inbound_email.delivered! rescue => exception inbound_email.failed! + + # TODO: Include a reference to the inbound_email in the exception raised so error handling becomes easier rescue_with_handler(exception) || raise end
Make a note for tying inbound email to exception Then InboundEmail doesn't need to serialize or track the exception that went with it. The arrow will point the other way.
diff --git a/lib/punchblock/command_node.rb b/lib/punchblock/command_node.rb index abc1234..def5678 100644 --- a/lib/punchblock/command_node.rb +++ b/lib/punchblock/command_node.rb @@ -32,6 +32,8 @@ @response.resource = other execute! rescue FutureResource::ResourceAlreadySetException + pb_logger.warn "Rescuing a FutureResource::ResourceAlreadySetException!" + pb_logger.warn "Here is some information about me: #{self.inspect}" end end # CommandNode end # Punchblock
Add some logging when catching these errors Just for our own edification. The original is just a no-op, but we're concerned we might be missing important information.
diff --git a/lib/rails_multisite/railtie.rb b/lib/rails_multisite/railtie.rb index abc1234..def5678 100644 --- a/lib/rails_multisite/railtie.rb +++ b/lib/rails_multisite/railtie.rb @@ -13,7 +13,7 @@ app.middleware.insert_after(ActiveRecord::ConnectionAdapters::ConnectionManagement, RailsMultisite::ConnectionManagement) app.middleware.delete(ActiveRecord::ConnectionAdapters::ConnectionManagement) if ENV['RAILS_DB'] - ConnectionManagement.establish_connection(db: ENV['RAILS_DB'].to_sym) + ConnectionManagement.establish_connection(:db => ENV['RAILS_DB']) end end end
Revert "Passing string to `ActiveRecord::Base.establish_connection` is deprecated." This reverts commit f3d17937ddaa5f54d3c06b7cc1ff5dc4e7941123.
diff --git a/lib/upstream/tracker/helper.rb b/lib/upstream/tracker/helper.rb index abc1234..def5678 100644 --- a/lib/upstream/tracker/helper.rb +++ b/lib/upstream/tracker/helper.rb @@ -40,6 +40,14 @@ end end + def download_html(url, dest) + html = fetch_html(url) + FileUtils.mkdir_p(File.dirname(dest)) + File.open(dest, "w+") do |file| + file.puts(html[:data]) + end + end + def fetch_html(url) html = {:data => nil, :charset => nil} html[:data] = open(url) do |file|
Add method to download html
diff --git a/pronto-tslint_npm.gemspec b/pronto-tslint_npm.gemspec index abc1234..def5678 100644 --- a/pronto-tslint_npm.gemspec +++ b/pronto-tslint_npm.gemspec @@ -22,7 +22,7 @@ s.require_paths = ['lib'] s.requirements << 'tslint (in PATH)' - s.add_dependency('pronto', '~> 0.9.1') + s.add_dependency('pronto', '~> 0.10.0') s.add_development_dependency('rake', '>= 11.0', '< 13') s.add_development_dependency('rspec', '~> 3.4') s.add_development_dependency('byebug', '>= 9')
Update pronto to `0.10.0` version
diff --git a/cookbooks/cicd_infrastructure/metadata.rb b/cookbooks/cicd_infrastructure/metadata.rb index abc1234..def5678 100644 --- a/cookbooks/cicd_infrastructure/metadata.rb +++ b/cookbooks/cicd_infrastructure/metadata.rb @@ -7,7 +7,5 @@ # long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.0' -depends 'openldap' depends 'java' depends 'jira' -depends 'chef-sugar'
[DMG-319] Remove dependences for other modules
diff --git a/cookbooks/geoserver/attributes/default.rb b/cookbooks/geoserver/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/geoserver/attributes/default.rb +++ b/cookbooks/geoserver/attributes/default.rb @@ -15,9 +15,7 @@ default['geoserver']['user'] = nil default['geoserver']['group'] = nil -#Hmmm ... 2.2.4 does not seem to work in glassfish? -version = '2.1.4' -#version = '2.3.1' +version = '2.3.1' default['geoserver']['version'] = version default['geoserver']['package_url'] = "http://downloads.sourceforge.net/geoserver/geoserver-#{version}-war.zip"
Update the version of geoserver
diff --git a/libraries/consul_installation_package.rb b/libraries/consul_installation_package.rb index abc1234..def5678 100644 --- a/libraries/consul_installation_package.rb +++ b/libraries/consul_installation_package.rb @@ -48,7 +48,7 @@ package options[:package_name] do source options[:package_source] version options[:version] - action :uninstall + action :remove end end end
package: Use action ":remove" instead of ":uninstall" Action ":uninstall" is not available for "package" resource.
diff --git a/lib/cb/models/cb_application_external.rb b/lib/cb/models/cb_application_external.rb index abc1234..def5678 100644 --- a/lib/cb/models/cb_application_external.rb +++ b/lib/cb/models/cb_application_external.rb @@ -10,7 +10,7 @@ def initialize(args = {}) @job_did = args[:job_did] || '' @email = args[:email] || '' - @site_id = args[:site_id] || '' + @site_id = args[:site_id] || 'cbnsv' @ipath = args[:ipath] || '' @apply_url = '' end
Add default SiteID (cbnsv) to external applications if none present
diff --git a/lib/ember-dev/documentation_generator.rb b/lib/ember-dev/documentation_generator.rb index abc1234..def5678 100644 --- a/lib/ember-dev/documentation_generator.rb +++ b/lib/ember-dev/documentation_generator.rb @@ -37,7 +37,7 @@ end def yuidoc_path - Pathname.new("node_modules/yuidocjs/lib/cli.js") + Pathname.new("node_modules/.bin/yuidoc") end def yuidoc_available?
Make documentation generation possible on windows.
diff --git a/lib/epub/maker/ocf/physical_container.rb b/lib/epub/maker/ocf/physical_container.rb index abc1234..def5678 100644 --- a/lib/epub/maker/ocf/physical_container.rb +++ b/lib/epub/maker/ocf/physical_container.rb @@ -18,7 +18,11 @@ container.write(path_name, content) } end - alias save write + + def save(container_path, path_name, content) + warn "EPUB::OCF::PhysicalContainer.#{__method__} is deprecated. Use .write instead" + write(container_path, path_name, content) + end end end end
Add warning for deprecated method
diff --git a/lib/globalize/active_record/act_macro.rb b/lib/globalize/active_record/act_macro.rb index abc1234..def5678 100644 --- a/lib/globalize/active_record/act_macro.rb +++ b/lib/globalize/active_record/act_macro.rb @@ -16,7 +16,7 @@ has_many :translations, :class_name => translation_class.name, :foreign_key => class_name.foreign_key, - :dependent => :delete_all, + :dependent => :destroy, :extend => HasManyExtensions after_create :save_translations!
Use destroy when deleting associated objects.
diff --git a/SwiftGenKit.podspec b/SwiftGenKit.podspec index abc1234..def5678 100644 --- a/SwiftGenKit.podspec +++ b/SwiftGenKit.podspec @@ -22,6 +22,6 @@ s.source_files = "Sources/**/*.swift" - s.dependency 'PathKit', '~> 0.7.0' + s.dependency 'PathKit', '~> 0.8.0' s.framework = "Foundation" end
Update PathKit dependency to 0.8.0
diff --git a/lib/kosapi_client/oauth2_http_adapter.rb b/lib/kosapi_client/oauth2_http_adapter.rb index abc1234..def5678 100644 --- a/lib/kosapi_client/oauth2_http_adapter.rb +++ b/lib/kosapi_client/oauth2_http_adapter.rb @@ -9,6 +9,7 @@ def initialize(credentials, root_url, opts = {}) auth_url = opts[:auth_url] || DEFAULT_AUTH_URL token_url = opts[:token_url] || DEFAULT_TOKEN_URL + MultiXml.parser = :ox # make sure to use Ox because of different namespace handling in other MultiXML parsers @client = OAuth2::Client.new(credentials[:client_id], credentials[:client_secret], site: root_url, authorize_url: auth_url, token_url: token_url) end
Set Ox as default MultiXML parser.
diff --git a/lib/license_finder/packages/licensing.rb b/lib/license_finder/packages/licensing.rb index abc1234..def5678 100644 --- a/lib/license_finder/packages/licensing.rb +++ b/lib/license_finder/packages/licensing.rb @@ -7,30 +7,26 @@ # among the various sources of licenses we know about. In order of # priority, licenses come from decisions, package specs, or package files. def activations - afd = activations_from_decisions - return afd if afd.any? - - afs = activations_from_spec - return afs if afs.any? - - aff = activations_from_files - return aff if aff.any? - - [default_activation] + case + when activations_from_decisions.any? then activations_from_decisions + when activations_from_spec.any? then activations_from_spec + when activations_from_files.any? then activations_from_files + else [default_activation] + end end def activations_from_decisions - decided_licenses + @afd ||= decided_licenses .map { |license| Activation::FromDecision.new(package, license) } end def activations_from_spec - licenses_from_spec + @afs ||= licenses_from_spec .map { |license| Activation::FromSpec.new(package, license) } end def activations_from_files - license_files + @aff ||= license_files .group_by(&:license) .map { |license, files| Activation::FromFiles.new(package, license, files) } end
Make activation algorithm easier to read
diff --git a/lib/metrics/trello/idle_hours_average.rb b/lib/metrics/trello/idle_hours_average.rb index abc1234..def5678 100644 --- a/lib/metrics/trello/idle_hours_average.rb +++ b/lib/metrics/trello/idle_hours_average.rb @@ -1,6 +1,6 @@ ProviderRepo.find!(:trello).register_metric :idle_hours_average do |metric| metric.description = "Average time each card has been idle measured in hours" - metric.title = "Card Average Age" + metric.title = "Card average age" metric.block = proc do |adapter, options| now_utc = Time.current.utc @@ -8,7 +8,7 @@ cards = adapter.cards(list_ids) sum = cards.map do |card| - now_utc - card.last_activity_date / 1.hour + (now_utc - card.last_activity_date) / 1.hour end.sum value = sum.zero? ? sum : sum / cards.count
Fix idle hous average trello (oeprator precedence bug)w
diff --git a/lib/rusic/uploaders/custom_attributes.rb b/lib/rusic/uploaders/custom_attributes.rb index abc1234..def5678 100644 --- a/lib/rusic/uploaders/custom_attributes.rb +++ b/lib/rusic/uploaders/custom_attributes.rb @@ -22,7 +22,8 @@ params_hash['theme']['custom_attributes_attributes'][i] = { 'key' => key, 'value' => options.fetch('value'), - 'help_text' => options.fetch('help_text', '') + 'help_text' => options.fetch('help_text', ''), + 'input_type' => options.fetch('type', 'text') } if e_attr = existing_attributes[key]
Add input_type to attribute uploader
diff --git a/assignments/assignment1.rb b/assignments/assignment1.rb index abc1234..def5678 100644 --- a/assignments/assignment1.rb +++ b/assignments/assignment1.rb @@ -1,3 +1,5 @@+# Assumes SimpleSynth is installed and running with the desired MIDI instrument +# https://github.com/notahat/simplesynth $: << File.dirname(__FILE__)+'/../lib' require 'ceely' Ceely::Assignment.new("Assignment 1", 500, 200).run do
Add comment about the SimpleSynth assumption to assignment 1.
diff --git a/lib/cinch/plugins/pax-timer/paxes.rb b/lib/cinch/plugins/pax-timer/paxes.rb index abc1234..def5678 100644 --- a/lib/cinch/plugins/pax-timer/paxes.rb +++ b/lib/cinch/plugins/pax-timer/paxes.rb @@ -22,8 +22,8 @@ estimated: true }, { type: 'east', name: 'PAX East', - date: Time.parse('2016-04-22 08:00:00 -05:00'), - estimated: false } + date: Time.parse('2017-03-10 08:00:00 -05:00'), + estimated: true } ] end end
Add expected East 2017 date From https://web.archive.org/web/20150406071050/http://massconvention.com/events/2017/02
diff --git a/spec/controllers/picture_controller_spec.rb b/spec/controllers/picture_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/picture_controller_spec.rb +++ b/spec/controllers/picture_controller_spec.rb @@ -14,26 +14,26 @@ end it 'can serve a picture directly from the database' do - visit "/pictures/#{picture.compressed_id}.#{picture.extension}" - expect(page.status_code).to eq(200) + get :show, :basename => "#{picture.compressed_id}.#{picture.extension}" + expect(response.status).to eq(200) expect(response.body).to eq(picture_content) end it 'can serve a picture directly from the database using the uncompressed id' do - visit "/pictures/#{picture.id}.#{picture.extension}" - expect(page.status_code).to eq(200) + get :show, :basename => "#{picture.compressed_id}.#{picture.extension}" + expect(response.status).to eq(200) expect(response.body).to eq(picture_content) end it "responds with a Not Found with pictures of incorrect extension" do - visit "/pictures/#{picture.compressed_id}.png" - expect(page.status_code).to eq(404) + get :show, :basename => "#{picture.compressed_id}.png" + expect(response.status).to eq(404) expect(response.body).to be_blank end it "responds with a Not Found with unknown pictures" do - visit "/pictures/bogusimage.gif" - expect(page.status_code).to eq(404) + get :show, :basename => "bogusimage.gif" + expect(response.status).to eq(404) expect(response.body).to be_blank end end
Remove `visit` in controller specs Using the capybara method `visit` in controller specs is deprecated. (transferred from ManageIQ/manageiq@b66479e581846461c682db7faee61f91394d9111)
diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/common_steps.rb +++ b/features/step_definitions/common_steps.rb @@ -17,3 +17,7 @@ Then /^the response should have (\d+) items$/ do |size| @response.size.should eql size.to_i end + +Then /^the response should not be empty$/ do + @response.should_not be_empty +end
Add step to check if response is non empty.
diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/common_steps.rb +++ b/features/step_definitions/common_steps.rb @@ -23,7 +23,12 @@ end Then /^the response type should be (.*)$/ do |type| - @response.content_type.should =~ /application\/#{type.downcase}/ + case type.downcase + when 'json' + @response.content_type.should =~ /application\/json/ + when 'html' + @response.content_type.should =~ /text\/html/ + end end Then /^the response should have (\d+) items$/ do |size|
Add ability to test for different mime types.
diff --git a/test/models/episode_story_handler_test.rb b/test/models/episode_story_handler_test.rb index abc1234..def5678 100644 --- a/test/models/episode_story_handler_test.rb +++ b/test/models/episode_story_handler_test.rb @@ -20,5 +20,6 @@ episode = EpisodeStoryHandler.create_from_story!(story) episode.wont_be_nil episode.published_at.wont_be_nil + episode.published_at.must_equal Time.parse(story.attributes[:published_at]) end end
Make sure json attribute names from camel to underscore work
diff --git a/lib/montrose/rule/nth_day_matcher.rb b/lib/montrose/rule/nth_day_matcher.rb index abc1234..def5678 100644 --- a/lib/montrose/rule/nth_day_matcher.rb +++ b/lib/montrose/rule/nth_day_matcher.rb @@ -1,3 +1,5 @@+require "forwardable" + module Montrose module Rule class NthDayMatcher
Add missing require for forwardable
diff --git a/pools.gemspec b/pools.gemspec index abc1234..def5678 100644 --- a/pools.gemspec +++ b/pools.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "pools" - s.version = "0.1.0" + s.version = "0.1.1" s.date = Time.now.strftime('%Y-%m-%d') s.summary = "Generalized connection pooling" s.homepage = "http://github.com/rykov/pools" @@ -11,7 +11,7 @@ s.files = %w( README.md Rakefile LICENSE ) s.files += Dir.glob("lib/**/*") - s.add_dependency "activesupport", "~> 3.0.5" + s.add_dependency 'activesupport', '>= 3.0.0', '< 3.2' s.description = <<DESCRIPTION Generalized connection pooling
Add dependency support for Rails 3.1
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index abc1234..def5678 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -4,4 +4,4 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -TomatoesApp::Application.config.secret_token = ENV["SESSION_STORE_SECRET_TOKEN"] +TomatoesApp::Application.config.secret_token = ENV['SESSION_STORE_SECRET_TOKEN'] || 'df4a92e8e3f5306c421693fc5d7a8bea'
Add a default session store secret token A session store secret token is alwasy needed, but in development it's fine to use a random string.
diff --git a/config/projects/chef-marketplace.rb b/config/projects/chef-marketplace.rb index abc1234..def5678 100644 --- a/config/projects/chef-marketplace.rb +++ b/config/projects/chef-marketplace.rb @@ -17,10 +17,10 @@ dependency "server-plugin-cookbooks" dependency "reckoner" dependency "biscotti" +dependency "chef" dependency "chef-marketplace-ctl" dependency "chef-marketplace-gem" dependency "chef-marketplace-cookbooks" -dependency "chef" dependency "version-manifest" exclude '\.git*'
Move chef compile up further to take advantage of omnibus caching
diff --git a/app/controllers/article_categories_controller.rb b/app/controllers/article_categories_controller.rb index abc1234..def5678 100644 --- a/app/controllers/article_categories_controller.rb +++ b/app/controllers/article_categories_controller.rb @@ -6,7 +6,7 @@ top_level_article_category_id = @article_category.parent_id top_level_article_category_id = params[:id] if top_level_article_category_id == 0 - @article_categories = ArticleCategorywhere(:parent_id => top_level_article_category_id).order(:position) + @article_categories = ArticleCategory.where(:parent_id => top_level_article_category_id).order(:position) @article_categories.each { |article_category| article_category.articles.delete_if { |article| !article.display? }} end end
Fix typo in untested code
diff --git a/app/helpers/effective_resources_wizard_helper.rb b/app/helpers/effective_resources_wizard_helper.rb index abc1234..def5678 100644 --- a/app/helpers/effective_resources_wizard_helper.rb +++ b/app/helpers/effective_resources_wizard_helper.rb @@ -2,8 +2,10 @@ module EffectiveResourcesWizardHelper - def render_wizard_sidebar(resource, numbers: true, &block) - sidebar = content_tag(:div, class: 'nav list-group wizard-sidebar') do + def render_wizard_sidebar(resource, numbers: true, horizontal: false, &block) + klasses = ['wizard-sidebar', 'list-group', ('list-group-horizontal' if horizontal)].compact.join(' ') + + sidebar = content_tag(:div, class: klasses) do resource.required_steps.map.with_index do |nav_step, index| render_wizard_sidebar_item(resource, nav_step, (index + 1 if numbers)) end.join.html_safe
Add horizontal: true to render_wizard_sidebar
diff --git a/lib/workless/scalers/heroku_cedar.rb b/lib/workless/scalers/heroku_cedar.rb index abc1234..def5678 100644 --- a/lib/workless/scalers/heroku_cedar.rb +++ b/lib/workless/scalers/heroku_cedar.rb @@ -0,0 +1,33 @@+require 'heroku' + +module Delayed + module Workless + module Scaler + + class HerokuCedar < Base + + require "heroku" + + def up + client.ps_scale(ENV['APP_NAME'], type: 'worker', qty: 1) if workers == 0 + end + + def down + client.ps_scale(ENV['APP_NAME'], type: 'worker', qty: 0) unless workers == 0 or jobs.count > 0 + end + + def workers + client.ps(ENV['APP_NAME']).count { |p| p["process"] =~ /worker\.\d?/ } + end + + private + + def client + @client ||= ::Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASSWORD']) + end + + end + + end + end +end
Add a scaler for the new Cedar stack.
diff --git a/app/controllers/api/drawings_controller.rb b/app/controllers/api/drawings_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/drawings_controller.rb +++ b/app/controllers/api/drawings_controller.rb @@ -10,12 +10,11 @@ end def show - # annoying bug with obfuscate_id, need to deobfuscate if using find with scopes - deobs_id = Drawing.deobfuscate_id(params[:id]) - - drawing = Drawing.complete_with_consent.find(deobs_id).decorate - - respond_with drawing, represent_with: DrawingRepresenter + if (drawing = Drawing.find(params[:id])) && drawing.complete? && drawing.image_consent + respond_with drawing.decorate, represent_with: DrawingRepresenter + else + render json: { error: 'Not found' }, status: :not_found + end end private
[161] Use more performant find instead of scope and 404 if record invalid
diff --git a/lib/dimples/post.rb b/lib/dimples/post.rb index abc1234..def5678 100644 --- a/lib/dimples/post.rb +++ b/lib/dimples/post.rb @@ -1,18 +1,32 @@+# frozen_string_literal: true + module Dimples class Post < Page - FILENAME_DATE = /^(\d{4})-(\d{2})-(\d{2})/ + POST_FILENAME = /(\d{4})-(\d{2})-(\d{2})-(.+)/ def initialize(site, path) super - parts = File.basename(path, File.extname(path)).match(FILENAME_DATE) + parts = File.basename(path, File.extname(path)).match(POST_FILENAME) - @metadata[:layout] = 'post' + @metadata[:layout] ||= @site.config.layouts.post + @metadata[:date] = Date.new(parts[1].to_i, parts[2].to_i, parts[3].to_i) - @metadata[:year] = @metadata[:date].strftime('%Y') @metadata[:month] = @metadata[:date].strftime('%m') @metadata[:day] = @metadata[:date].strftime('%d') + + @metadata[:slug] = parts[4] + end + + private + + def output_directory + @output_directory ||= File.join( + @site.paths[:output], + date.strftime(@site.config.urls.posts), + slug + ) end end -end+end
Rename the name regex constant, switch to the right layout, add the output_directory method
diff --git a/lib/link_helpers.rb b/lib/link_helpers.rb index abc1234..def5678 100644 --- a/lib/link_helpers.rb +++ b/lib/link_helpers.rb @@ -16,6 +16,13 @@ cs.map { |c| "<a href='/categories/#{c}'>#{c}</a>" } end + # + # link an article + # + def link_article name + link_to name, "/articles/#{name.downcase.gsub(" ", "_")}" + end + end include LinkHelpers
Add link helper for linking articles
diff --git a/lib/powify/utils.rb b/lib/powify/utils.rb index abc1234..def5678 100644 --- a/lib/powify/utils.rb +++ b/lib/powify/utils.rb @@ -17,7 +17,7 @@ def install uninstall $stdout.puts "Cloning powify.dev from github and bundling powify.dev..." - %x{git clone -q git@github.com:sethvargo/powify.dev.git powify && cd powify && bundle install --deployment && cd .. && mv powify "#{config['hostRoot']}"} + %x{git clone -q https://github.com/sethvargo/powify.git powify && cd powify && bundle install --deployment && cd .. && mv powify "#{config['hostRoot']}"} $stdout.puts "Done!" end alias_method :reinstall, :install @@ -30,4 +30,4 @@ alias_method :remove, :uninstall end end -end+end
Use https url for powify repository Using the https url allows those of us who are not the owners of the powify project to use `powify utils install`
diff --git a/lib/secret_santa.rb b/lib/secret_santa.rb index abc1234..def5678 100644 --- a/lib/secret_santa.rb +++ b/lib/secret_santa.rb @@ -1,27 +1,30 @@ class SecretSanta + # Create the Secret Santa list def self.create_list(names) if names.length <= 2 "ERROR: List too short" elsif names.length != names.uniq.length "ERROR: Please enter unique names" else - # shuffle names and build lists + # Build the list list = [] digraph_list = [] names.shuffle! names.each_with_index do |name, i| list << "#{name} -> #{names[i - 1]}" end - # write the list to a graphviz dot file + # Write the list to a graphviz dot file digraph_list = list.join("; ") digraph = "digraph {#{digraph_list}}\n" File.open("#{Time.now.year}_secret_santa_list.dot", 'w') { |f| f.write("#{digraph}") } - # return the list + # Return the list puts "\n#{Time.now.year} Secret Santa List:" - list + puts list + "\nList saved to #{Time.now.year}_secret_santa_list.png" end end + # Get Secret Santa names and handle def self.solicit_input puts "Enter each name in the Secret Santa pool, separated by a space:" names = gets.downcase.chomp
Add better comments and messages
diff --git a/settings_on_rails.gemspec b/settings_on_rails.gemspec index abc1234..def5678 100644 --- a/settings_on_rails.gemspec +++ b/settings_on_rails.gemspec @@ -22,7 +22,8 @@ spec.required_ruby_version = '>= 1.9' spec.add_dependency 'activerecord', '>= 3.1' - spec.add_development_dependency 'bundler' - spec.add_development_dependency 'rake' + spec.add_development_dependency 'sqlite3', '~> 1.3' + spec.add_development_dependency 'bundler', '~> 1.6' spec.add_development_dependency 'rspec', '~> 3' + spec.add_development_dependency 'rake', '~> 10' end
Add sqlite3 as test db
diff --git a/comrad.gemspec b/comrad.gemspec index abc1234..def5678 100644 --- a/comrad.gemspec +++ b/comrad.gemspec @@ -14,7 +14,7 @@ s.required_ruby_version = '>= 1.9.3' s.add_dependency 'rest-client', '~> 1.7.0' s.add_dependency 'chef', '>= 11.0' - s.add_dependency 'slack-post', '~> 0.3' + s.add_dependency 'slack-post', '~> 0.3', '>= 0.3.1' s.add_development_dependency 'rake', '~> 10.0' s.add_development_dependency 'rubocop', '~> 0.30.0'
Make sure we're pulling in at least 0.3.1 of slack-post
diff --git a/views/instagram.rb b/views/instagram.rb index abc1234..def5678 100644 --- a/views/instagram.rb +++ b/views/instagram.rb @@ -4,13 +4,9 @@ def parse(message) message_array = message.split(' ') message_array.map! do |word| - if word.include?(Views::HASHMARK) - populate_tag_url(word) - elsif word.start_with?(Views::AT_SIGN) - "<a href='https://www.instagram.com/#{word.delete(Views::AT_SIGN)}'>#{word}</a>" - else - word - end + next populate_tag_url(word) if word.include?(Views::HASHMARK) + next account_url_for(word) if word.start_with?(Views::AT_SIGN) + word end message_array.join(' ') end @@ -18,17 +14,17 @@ private def populate_tag_url(word) - if word.end_with?(Views::POINT) - "#{url_for(word.delete(Views::POINT))}#{Views::POINT}" - elsif word.end_with?(Views::COMMA) - "#{url_for(word.delete(Views::COMMA))}#{Views::COMMA}" - else - url_for(word) - end + return "#{tag_url_for(word.delete(Views::POINT))}#{Views::POINT}" if word.end_with?(Views::POINT) + return "#{tag_url_for(word.delete(Views::COMMA))}#{Views::COMMA}" if word.end_with?(Views::COMMA) + tag_url_for(word) end - def url_for(tag) - "<a href='https://www.instagram.com/explore/tags/#{tag.delete(Views::HASHMARK)}/'>#{tag}</a>" + def tag_url_for(word) + "<a href='https://www.instagram.com/explore/tags/#{word.delete(Views::HASHMARK)}/'>#{word}</a>" + end + + def account_url_for(word) + "<a href='https://www.instagram.com/#{word.delete(Views::AT_SIGN)}'>#{word}</a>" end end end
Simplify methods of Instagram module * Use early returns
diff --git a/spec/codeclimate_ci/api_requester_spec.rb b/spec/codeclimate_ci/api_requester_spec.rb index abc1234..def5678 100644 --- a/spec/codeclimate_ci/api_requester_spec.rb +++ b/spec/codeclimate_ci/api_requester_spec.rb @@ -0,0 +1,19 @@+require 'spec_helper' + +module CodeclimateCi + describe ApiRequester do + let(:token) { 'abc123' } + let(:repo_id) { '12345' } + let(:api_requester) { CodeclimateCi::ApiRequester.new(token, repo_id) } + + before do + allow(ApiRequester).to receive(:get) + end + + it 'should receive Get method' do + expect(ApiRequester).to receive(:get) + + api_requester.branch_info('hello') + end + end +end
Add test spec for ApiRequester
diff --git a/spec/stress/connection_open_close_spec.rb b/spec/stress/connection_open_close_spec.rb index abc1234..def5678 100644 --- a/spec/stress/connection_open_close_spec.rb +++ b/spec/stress/connection_open_close_spec.rb @@ -0,0 +1,17 @@+require "spec_helper" + +unless RUBY_ENGINE == "jruby" + describe Bunny::Session do + 4000.times do |i| + it "can be closed (take #{i})" do + c = Bunny.new(:automatically_recover => false) + c.start + ch = c.create_channel + + c.should be_connected + c.stop + c.should be_closed + end + end + end +end
Move this to stress tests Excluded on JRuby because aggressive thread creation and shutdown in a loop is really slow.
diff --git a/Sources/Swaggen/templates/Podspec.podspec b/Sources/Swaggen/templates/Podspec.podspec index abc1234..def5678 100644 --- a/Sources/Swaggen/templates/Podspec.podspec +++ b/Sources/Swaggen/templates/Podspec.podspec @@ -2,8 +2,8 @@ s.source_files = '*.swift' s.name = '{{ options.name }}' s.authors = '{{ options.authors|default:"Yonas Kolb" }}' - s.summary = '{{ info.description|default:"A generated API" }}' - s.version = '{{ info.version }}' + s.summary = '{% if info.description == "" %}A generated API{% else %}{{ info.description|default:"A generated API" }}{% endif %}' + s.version = '{% if info.version == "" %}0.1{% else %}{{ info.version|default:"0.1"|replace:"v","" }}{% endif %}' s.homepage = '{{ options.homepage|default:"https://github.com/yonaskolb/SwagGen" }}' s.source = { :git => 'git@github.com:https://github.com/yonaskolb/SwagGen.git' } s.ios.deployment_target = '9.0'
Fix podspec generation if spec have empty version or description Also fixed case when version have 'v' letter
diff --git a/lib/active_interaction.rb b/lib/active_interaction.rb index abc1234..def5678 100644 --- a/lib/active_interaction.rb +++ b/lib/active_interaction.rb @@ -21,7 +21,8 @@ require 'active_interaction/base' I18n.backend.load_translations( - Dir.glob(File.join(%w(lib active_interaction locale *.yml)))) + Dir.glob(File.join(%w(lib active_interaction locale *.yml))) +) # @since 0.1.0 module ActiveInteraction end
Put parenthesis where it belongs
diff --git a/lib/akamai_api/cp_code.rb b/lib/akamai_api/cp_code.rb index abc1234..def5678 100644 --- a/lib/akamai_api/cp_code.rb +++ b/lib/akamai_api/cp_code.rb @@ -13,14 +13,16 @@ end def self.all + result = [] basic_auth *AkamaiApi.config[:auth] client.request('getCPCodes').body[:multi_ref].map do |hash| - new({ + result << new({ :code => hash[:cpcode], :description => hash[:description], :service => hash[:service], }) end + result end end end
Fix CpCode getter. Create a CpCode item for each XML item in the response and return it. (Also fixed tests)
diff --git a/lib/bishop/github_hook.rb b/lib/bishop/github_hook.rb index abc1234..def5678 100644 --- a/lib/bishop/github_hook.rb +++ b/lib/bishop/github_hook.rb @@ -5,18 +5,27 @@ module Bishop # see http://help.github.com/post-receive-hooks/ class GithubHook < Bishop::Base + post "/#{ENV["BISHOP_API_KEY"]}" do - payload = JSON.parse(URI.unescape(params["payload"])) - channels = ENV["BISHOP_GITHUB_HOOK_CHANNELS"].split(",") - - payload["commits"].each do |commit| - Bishop::Bot.instance.channels.each do |channel| - if (channels.index(channel.name)) - Bishop::Bot.instance.safe_notice "#test", "[#{payload["repository"]["name"]}] #{commit["url"]} committed by #{commit["author"]["email"]} with message: #{commit["message"]}" + + if ENV["BISHOP_GITHUB_HOOK_CHANNELS"] + payload = JSON.parse(URI.unescape(params["payload"])) + channels = ENV["BISHOP_GITHUB_HOOK_CHANNELS"].split(",") + + payload["commits"].each do |commit| + # FIXME: This hack is nessecary for a heroku hosted app to work + # as .channels.each will throw a DRb::DRbConnError / Connection refused + # The .join(",").split(",") give us a simple array to work with + Bishop::Bot.instance.channels.join(",").split(",").each do |channel| + if (channels.index(channel)) + Bishop::Bot.instance.safe_notice channel, "[#{payload["repository"]["name"]}] #{commit["url"]} committed by #{commit["author"]["email"]} with message: #{commit["message"]}" + end end end end + "OK" end + end -end+end
Fix weird issue only present on heroku
diff --git a/lib/cch/config/runners.rb b/lib/cch/config/runners.rb index abc1234..def5678 100644 --- a/lib/cch/config/runners.rb +++ b/lib/cch/config/runners.rb @@ -12,8 +12,11 @@ runner.watch(%r{^spec/spec_helper.rb$}, proc { %w(spec) }) runner.watch(%r{^spec/rails_helper.rb$}, proc { %w(spec) }) - runner.watch(%r{^config/routes.rb$}, proc { %w(spec/routing) }) - runner.watch(%r{^app/controllers/application_controller.rb$}, proc { %w(spec/controllers) }) + runner.watch(%r{^config/routes.rb$}, proc { %w(spec/routing spec/requests) }) + runner.watch( + %r{^app/controllers/application_controller.rb$}, + proc { %w(spec/controllers spec/requests) } + ) runner.watch(%r{^lib/(.+)\.rb$}, proc { |m| %W(spec/#{m[1]}_spec.rb spec/lib/#{m[1]}_spec.rb) }) runner.watch(%r{^app/(.+)\.rb$}, proc { |m| %W(spec/#{m[1]}_spec.rb) })
Improve rspec runner to configure request specs
diff --git a/app/controllers/ems_middleware_controller.rb b/app/controllers/ems_middleware_controller.rb index abc1234..def5678 100644 --- a/app/controllers/ems_middleware_controller.rb +++ b/app/controllers/ems_middleware_controller.rb @@ -1,5 +1,6 @@ class EmsMiddlewareController < ApplicationController include EmsCommon + include Mixins::EmsCommonAngular before_action :check_privileges before_action :get_session_data
Add EmsCommonAngular mixin to ems_middleware controller
diff --git a/app/parameters/lottery_entrant_parameters.rb b/app/parameters/lottery_entrant_parameters.rb index abc1234..def5678 100644 --- a/app/parameters/lottery_entrant_parameters.rb +++ b/app/parameters/lottery_entrant_parameters.rb @@ -12,6 +12,8 @@ state country number_of_tickets + pre_selected + external_id ] end @@ -31,6 +33,7 @@ :city, :country_code, :division, + :external_id, :first_name, :gender, :id,
Add external id to lottery entrant parameters
diff --git a/app/presenters/renalware/doctor_presenter.rb b/app/presenters/renalware/doctor_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/renalware/doctor_presenter.rb +++ b/app/presenters/renalware/doctor_presenter.rb @@ -1,9 +1,10 @@ require_dependency "renalware" +require_dependency "renalware/address_presenter" module Renalware class DoctorPresenter < SimpleDelegator def address - Renalware::AddressPresenter.new(super || practice_address) + AddressPresenter.new(super || practice_address) end end end
Remove namespacing by ensure it's required
diff --git a/lib/analytics/scripts/usernames_to_csv.rb b/lib/analytics/scripts/usernames_to_csv.rb index abc1234..def5678 100644 --- a/lib/analytics/scripts/usernames_to_csv.rb +++ b/lib/analytics/scripts/usernames_to_csv.rb @@ -30,3 +30,13 @@ end end end + +# courses, instructor usernames and ids +CSV.open("/root/course_instructors.csv", 'wb') do |csv| + csv << ['course', 'instructor_user_id', 'instructor username'] + Course.all.each do |course| + course.instructors.each do |instructor| + csv << [course.slug, instructor.id, instructor.wiki_id] + end + end +end
Add another query to the scripts archive
diff --git a/lib/easy_app_helper/logger/initializer.rb b/lib/easy_app_helper/logger/initializer.rb index abc1234..def5678 100644 --- a/lib/easy_app_helper/logger/initializer.rb +++ b/lib/easy_app_helper/logger/initializer.rb @@ -21,7 +21,13 @@ def self.build_logger log_device = if EasyAppHelper.config[:debug] if EasyAppHelper.config[:'log-file'] - EasyAppHelper.config[:'log-file'] + if File.writable? EasyAppHelper.config[:'log-file'] + EasyAppHelper.config[:'log-file'] + else + puts STDERR "WARNING: Log file '#{EasyAppHelper.config[:'log-file']}' is not writable. Switching to STDERR..." + EasyAppHelper.config[:'log-file'] = nil + STDERR + end elsif EasyAppHelper.config[:'debug-on-err'] STDERR else
Fix for blocking log-file when declared in the config file and pointing to a file the user cannot write to...
diff --git a/lib/express_templates/template/handler.rb b/lib/express_templates/template/handler.rb index abc1234..def5678 100644 --- a/lib/express_templates/template/handler.rb +++ b/lib/express_templates/template/handler.rb @@ -7,7 +7,7 @@ def call(template) # returns a string to be eval'd - ExpressTemplates.compile(template) + "(#{ExpressTemplates.compile(template)}).html_safe" end end
Mark everything as html_safe for now so we can use express templates within haml layouts
diff --git a/yard_extensions.rb b/yard_extensions.rb index abc1234..def5678 100644 --- a/yard_extensions.rb +++ b/yard_extensions.rb @@ -1,9 +1,6 @@-require 'pp' class MyModuleHandler < YARD::Handlers::Ruby::Base handles method_call(:property) - - def process name = statement.parameters.first.jump(:tstring_content, :ident).source
Remove white space remove require 'pp'
diff --git a/test/integration/round_creation_test.rb b/test/integration/round_creation_test.rb index abc1234..def5678 100644 --- a/test/integration/round_creation_test.rb +++ b/test/integration/round_creation_test.rb @@ -0,0 +1,11 @@+require 'test_helper' + +class RoundCreationTest < ActionDispatch::IntegrationTest + test "rounds are viewable after creation" do + get '/' + assert_response :success + + post '/round/' + assigns[:round].url, charity: 'test_charity' + assert_response :success + end +end
Test flow of submitting form from home page
diff --git a/lib/rubella/input/base.rb b/lib/rubella/input/base.rb index abc1234..def5678 100644 --- a/lib/rubella/input/base.rb +++ b/lib/rubella/input/base.rb @@ -37,6 +37,10 @@ "concrete implementation" end + # Passes each dataset trought the given block. + # + # @param pointer to block + # def each &block @data.each &block end
Add some docs for each
diff --git a/jekyll-theme-type.gemspec b/jekyll-theme-type.gemspec index abc1234..def5678 100644 --- a/jekyll-theme-type.gemspec +++ b/jekyll-theme-type.gemspec @@ -14,9 +14,9 @@ f.match(%r{^(assets|pages|_(includes|layouts|sass)/|(LICENSE|README|tags.html)((\.(txt|md|markdown)|$)))}i) end - spec.add_runtime_dependency "jekyll", "~> 3.4" - spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" + spec.add_runtime_dependency "jekyll", "~> 3.8.5" + spec.add_runtime_dependency "jekyll-paginate", "~> 1.1.0" - spec.add_development_dependency "bundler", "~> 1.12" - spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "bundler", "~> 2.0.2" + spec.add_development_dependency "rake", "~> 12.3.2" end
Update dependencies to match versions used by GitHub Pages
diff --git a/app/controllers/option_sets_controller.rb b/app/controllers/option_sets_controller.rb index abc1234..def5678 100644 --- a/app/controllers/option_sets_controller.rb +++ b/app/controllers/option_sets_controller.rb @@ -1,9 +1,6 @@ class OptionSetsController < ApplicationController before_action :decode_hashid - def decode_hashid - params[:id] = Hashid.decode(params[:hashid]) unless params[:hashid].blank? - end def new @option_set = OptionSet.new @@ -30,6 +27,10 @@ private + def decode_hashid + params[:id] = Hashid.decode(params[:hashid]) unless params[:hashid].blank? + end + def option_set_params params.fetch(:option_set, {}).permit(:compatible) end
Make decode_hashid before callback private
diff --git a/app/decorators/meals/formula_decorator.rb b/app/decorators/meals/formula_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/meals/formula_decorator.rb +++ b/app/decorators/meals/formula_decorator.rb @@ -30,16 +30,6 @@ roles.decorate.map(&:title_with_suffix).join(", ") end - Signup::SIGNUP_TYPES.each do |st| - define_method("#{st}_nice") do - if fixed_meal? - h.number_to_currency(object[st]) - else - decimal_to_percentage(object[st]) - end - end - end - def show_action_link_set ActionLinkSet.new( ActionLink.new(object, :edit, icon: "pencil", path: h.edit_meals_formula_path(object))
72: Remove old _nice methods on FormulaDecorator
diff --git a/rome.rb b/rome.rb index abc1234..def5678 100644 --- a/rome.rb +++ b/rome.rb @@ -1,10 +1,8 @@ class Rome < Formula desc "A shared cache tool for Carthage on S3" homepage "https://github.com/blender/Rome" - url "https://github.com/blender/Rome/releases/download/v0.13.0.33/rome.zip" - sha256 "ffc96682355c534d6dbbd8f2410c945145bc46af2fda69f3cdffc5cf0090add1" - - version "0.13.0.33" + url "https://github.com/blender/Rome/releases/download/v0.13.1.35/rome.zip" + sha256 "56216f143e0cdea294319a09868cc4523d7407a1fee733132f12ee5e6299e393" bottle :unneeded
Update Rome formula to 0.13.1.35. And remove the redundant version from formula since it can be detected from the URL.
diff --git a/lib/sshkit/coordinator.rb b/lib/sshkit/coordinator.rb index abc1234..def5678 100644 --- a/lib/sshkit/coordinator.rb +++ b/lib/sshkit/coordinator.rb @@ -6,7 +6,7 @@ def initialize(raw_hosts) @raw_hosts = Array(raw_hosts) - raise NoValidHosts unless Array(raw_hosts).any? + raise SSHKit::NoValidHosts unless Array(raw_hosts).any? resolve_hosts! end
Fix a constant namespacing error
diff --git a/lib/tasks/01_support.rake b/lib/tasks/01_support.rake index abc1234..def5678 100644 --- a/lib/tasks/01_support.rake +++ b/lib/tasks/01_support.rake @@ -0,0 +1,18 @@+# from http://metaskills.net/2010/05/26/the-alias_method_chain-of-rake-override-rake-task/ +Rake::TaskManager.class_eval do + def alias_task(fq_name) + new_name = "#{fq_name}:original" + @tasks[new_name] = @tasks.delete(fq_name) + end +end + +def alias_task(fq_name) + Rake.application.alias_task(fq_name) +end + +def override_task(*args, &block) + name, params, deps = Rake.application.resolve_args(args.dup) + fq_name = Rake.application.instance_variable_get(:@scope).dup.push(name).join(':') + alias_task(fq_name) + Rake::Task.define_task(*args, &block) +end
Add missing support file for override_task
diff --git a/lib/doorkeeper/oauth/token_request.rb b/lib/doorkeeper/oauth/token_request.rb index abc1234..def5678 100644 --- a/lib/doorkeeper/oauth/token_request.rb +++ b/lib/doorkeeper/oauth/token_request.rb @@ -1,11 +1,10 @@ module Doorkeeper module OAuth class TokenRequest - attr_accessor :pre_auth, :resource_owner, :client + attr_accessor :pre_auth, :resource_owner def initialize(pre_auth, resource_owner) @pre_auth = pre_auth - @client = pre_auth.client @resource_owner = resource_owner end
Remove unused `client` instance variable
diff --git a/lib/tasks/panopticon.rake b/lib/tasks/panopticon.rake index abc1234..def5678 100644 --- a/lib/tasks/panopticon.rake +++ b/lib/tasks/panopticon.rake @@ -0,0 +1,36 @@+# encoding: utf-8 + +namespace :panopticon do + + desc "Register application metadata with panopticon" + task :register => :environment do + require 'gds_api/panopticon' + logger = GdsApi::Base.logger = Logger.new(STDERR).tap { |l| l.level = Logger::INFO } + logger.info "Registering with panopticon..." + + registerer = GdsApi::Panopticon::Registerer.new(owning_app: "calculators") + + calculators = [ + OpenStruct.new({ + :title => "Child Benefit tax calculator", + :slug => "child-benefit-tax-calculator", + :need_id => "2482", + :state => "live", + :description => "Work out the Child Benefit you've received and your High Income Child Benefit tax charge", + :indexable_content => [ + "Work out the Child Benefit you've received and your High Income Child Benefit tax charge", + "Use this tool to work out", + "how much Child Benefit you receive in a tax year", + "the High Income Child Benefit tax charge you or your partner may have to pay", + "You're affected by the tax charge if your income is over £50,000.", + "Your partner is responsible for paying the tax charge if their income is more than £50,000 and higher than yours.", + "You'll need the dates Child Benefit started and, if applicable, stopped.", + ].join(" "), + }), + ] + calculators.each do |calculator| + registerer.register(calculator) + end + end +end +
Add task to register calculator with Panopticon For now this has a hard-coded copy of the text from the landing page. In future we should refactor this to store this copy somewhere that can be accessed by the view, and the registerer.
diff --git a/lib/flowdock_rails/models/flowdock.rb b/lib/flowdock_rails/models/flowdock.rb index abc1234..def5678 100644 --- a/lib/flowdock_rails/models/flowdock.rb +++ b/lib/flowdock_rails/models/flowdock.rb @@ -14,8 +14,8 @@ end def post_message(message) + return unless FlowdockRails.configuration.valid_env? raise 'Instance is not ready' unless ready? - return unless FlowdockRails.configuration.valid_env? params = format_params(message) response = post('/messages', params) message.thread_id = response.body['thread_id']
Return nil if env is invalid
diff --git a/lib/gettext_i18n_rails/haml_parser.rb b/lib/gettext_i18n_rails/haml_parser.rb index abc1234..def5678 100644 --- a/lib/gettext_i18n_rails/haml_parser.rb +++ b/lib/gettext_i18n_rails/haml_parser.rb @@ -19,10 +19,9 @@ text = IO.readlines(file).join - #first pass with real haml haml = Haml::Engine.new(text) - code = haml.precompiled.split(/$/) - GetText::RubyParser.parse_lines(file, code, msgids) + code = haml.precompiled + return RubyGettextExtractor.parse_string(code, file, msgids) end def load_haml
Use RubyGettextExtractor for Haml files Signed-off-by: Michael Grosser <0de5a769f358d30e797c5fa02faa5d5330048565@gmail.com>
diff --git a/lib/tasks/operations/update_status.rb b/lib/tasks/operations/update_status.rb index abc1234..def5678 100644 --- a/lib/tasks/operations/update_status.rb +++ b/lib/tasks/operations/update_status.rb @@ -0,0 +1,41 @@+require 'dry/monads/result' +require 'dry/monads/do' + +module Tasks + module Operations + class UpdateStatus + include Dry::Monads::Result::Mixin + include Dry::Monads::Do.for(:call) + + include Import[ + 'core.markdown_parser', + task_repo: 'repositories.task' + ] + + def call(current_user, payload) + task = task_repo.find(payload[:id]) + task_repo.update(task.id, task_params(payload)) if valid?(task, current_user, payload[:status]) + end + + private + + ALLOWED_STATUSES = [Task::VALID_STATUSES[:assigned], Task::VALID_STATUSES[:closed], Task::VALID_STATUSES[:done]].freeze + + def valid?(task, current_user, status) + task && task.opened? && current_user.author?(task) && ALLOWED_STATUSES.include?(status) + end + + def task_params(payload) + if payload[:status] == Task::VALID_STATUSES[:assigned] + { status: payload[:status], assignee_username: assignee_username(payload) } + else + { status: payload[:status] } + end + end + + def assignee_username(payload) + payload[:assignee_username].gsub(/[^\w\s]/, '') + end + end + end +end
Create operation for updating task status
diff --git a/lib/mindbody-api/services/site_service.rb b/lib/mindbody-api/services/site_service.rb index abc1234..def5678 100644 --- a/lib/mindbody-api/services/site_service.rb +++ b/lib/mindbody-api/services/site_service.rb @@ -4,7 +4,7 @@ service 'SiteService' operation :get_sites - operation :get_locations, :locals => false + operation :get_locations operation :get_activation_code operation :get_programs operation :get_session_types
Allow locals for get locations
diff --git a/lib/plugins/commit_msg/trailing_period.rb b/lib/plugins/commit_msg/trailing_period.rb index abc1234..def5678 100644 --- a/lib/plugins/commit_msg/trailing_period.rb +++ b/lib/plugins/commit_msg/trailing_period.rb @@ -0,0 +1,13 @@+module Causes::GitHook + class TrailingPeriod < HookSpecificCheck + include HookRegistry + + def run_check + if commit_message[0].rstrip.end_with?('.') + return :warn, 'Please omit trailing period from commit message subject.' + end + + :good + end + end +end
Add 'trailing period' commit message lint As suggested by jdunck, this is another common issue we have. Change-Id: Ibb329726b59fcf43afa22e68abef148de0fc2abe Reviewed-on: https://gerrit.causes.com/22221 Tested-by: Aiden Scandella <1faf1e8390cdac9204f160c35828cc423b7acd7b@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/Casks/lytro-desktop.rb b/Casks/lytro-desktop.rb index abc1234..def5678 100644 --- a/Casks/lytro-desktop.rb +++ b/Casks/lytro-desktop.rb @@ -0,0 +1,14 @@+cask :v1 => 'lytro-desktop' do + version '4.2.1' + sha256 '5ebe2cdd0b80749f3ad97fd319ab6c4cea4045f6705d10ce28b191935bbf561b' + + # amazonaws.com is the official download host per the appcast feed + url 'https://s3.amazonaws.com/lytro-distro/lytro-150408.69.dmg' + appcast 'https://pictures.lytro.com/support/software_update', + :sha256 => 'e54d512a31f7c221da16d2af9cf4eebef353bb47ca07a6811c4bfaeaae4dddf1' + name 'Lytro Desktop' + homepage 'https://www.lytro.com/' + license :gratis + + app 'Lytro Desktop.app' +end
Create new cask for Lytro Desktop, an app to sync and manipulate light field images from Lytro cameras.
diff --git a/lib/tracers/apimonitor.rb b/lib/tracers/apimonitor.rb index abc1234..def5678 100644 --- a/lib/tracers/apimonitor.rb +++ b/lib/tracers/apimonitor.rb @@ -0,0 +1,17 @@+# Copyright (c) 2011, Jon Maken +# License: 3-clause BSD (see project LICENSE file) + +module RCI + module Tracers + class APIMonitor + + def initialize(exe) + @exe = exe + end + + def call(env) + raise NotImplementedError, "[TODO] implement #{self.class.name}#call(env)" + end + end + end +end
Add stubbed APIMonitor trace provider.
diff --git a/lib/typeclass/function.rb b/lib/typeclass/function.rb index abc1234..def5678 100644 --- a/lib/typeclass/function.rb +++ b/lib/typeclass/function.rb @@ -17,13 +17,9 @@ fail NotImplementedError unless instance - if instance.implements? name - instance.transmit name, *args - elsif block # rubocop:disable Style/GuardClause - block.call(*args) - else - fail NoMethodError - end + return instance.transmit name, *args if instance.implements? name + return block.call(*args) if block + fail NoMethodError end def to_proc
Improve code style a bit
diff --git a/view.rb b/view.rb index abc1234..def5678 100644 --- a/view.rb +++ b/view.rb @@ -1,14 +1,38 @@ class View - + attr_reader :players, :player_name def initialize + @player_name = '' + @players =[] + initialize_game_render end def render_player_names end def initialize_game_render + puts 'Welcome to Flash-Racer. !!!.' + puts 'You will answer questions which will make you advance on the track.' + puts 'The first racer to reach the end of the track wins!.' + + enter_names_render + end + + def enter_names_render + @players = [] + for i in 1..2 + puts "Player #{i}, please enter your name" + @player_name = gets.chomp + @players.push @player_name + end + + puts "Current players" + puts "----------------------" + @players.each_index do |index| + puts "#{index+1}. #{@players[index]}" + end + puts "----------------------" end def render_scores @@ -30,3 +54,7 @@ end end + +#Driver Test Code +my_view = View.new +my_view
Complete user input in View class
diff --git a/cookbooks/nagios/recipes/client_package.rb b/cookbooks/nagios/recipes/client_package.rb index abc1234..def5678 100644 --- a/cookbooks/nagios/recipes/client_package.rb +++ b/cookbooks/nagios/recipes/client_package.rb @@ -18,11 +18,21 @@ # limitations under the License. # -%w{ - nagios-nrpe-server - nagios-plugins - nagios-plugins-basic - nagios-plugins-standard -}.each do |pkg| - package pkg +case platform +when "centos" "redhat" "fedora" "amazon" "scientific" + %w{ + nrpe + nagios-plugins + }.each do |pkg| + package pkg + end +else + %w{ + nagios-nrpe-server + nagios-plugins + nagios-plugins-basic + nagios-plugins-standard + }.each do |pkg| + package pkg + end end
Add support for install NRPE via package on CentOS and similar systems Former-commit-id: 2f1bb3bc6475fa16b61a921e0898e18ec515ac40 [formerly 46a219961f40fe59231d731019375814a9c4b867] [formerly 1cedf1c9e07e1703ebb42f7a53e59f990ace7533 [formerly 0ce0555029846c77b64dba610210ef9a7e992aa7]] Former-commit-id: 882ad1bc0424b71972c108b1a920cccbeb8d7c28 [formerly c66121ab6aa31fdcaf2676e4615e6a2bf919914e] Former-commit-id: bda90e4385763874ca852535287d0e83f64d7575
diff --git a/recipes/apt_repository.rb b/recipes/apt_repository.rb index abc1234..def5678 100644 --- a/recipes/apt_repository.rb +++ b/recipes/apt_repository.rb @@ -1,6 +1,8 @@ # # # + +package 'gnupg' apt_repository 'cvmfs' do uri 'http://cvmrepo.web.cern.ch/cvmrepo/apt'
Install gpg for key management
diff --git a/rails-footnotes.gemspec b/rails-footnotes.gemspec index abc1234..def5678 100644 --- a/rails-footnotes.gemspec +++ b/rails-footnotes.gemspec @@ -17,6 +17,7 @@ s.add_dependency "rails", ">= 3.2" s.add_development_dependency "rspec-rails", '~> 3.3.2' + s.add_development_dependency "sprockets-rails", '~> 2.3.3' s.add_development_dependency "capybara" s.files = `git ls-files`.split("\n")
Downgrade sprockets-rails for now, causing issues in test
diff --git a/redis-semaphore.gemspec b/redis-semaphore.gemspec index abc1234..def5678 100644 --- a/redis-semaphore.gemspec +++ b/redis-semaphore.gemspec @@ -14,7 +14,7 @@ s.add_dependency 'redis' s.add_development_dependency 'rake' - s.add_development_dependency 'rspec' + s.add_development_dependency 'rspec', '>= 2.14' s.add_development_dependency 'pry' s.add_development_dependency 'timecop'
Make sure correct version of Rspec is used in tests
diff --git a/ruby/spec/bson/element_spec.rb b/ruby/spec/bson/element_spec.rb index abc1234..def5678 100644 --- a/ruby/spec/bson/element_spec.rb +++ b/ruby/spec/bson/element_spec.rb @@ -19,18 +19,38 @@ describe "#to_bson" do - let(:element) do - described_class.new("name", "value") + context "when the field is a string" do + + let(:element) do + described_class.new("name", "value") + end + + let(:encoded) do + element.to_bson + end + + it "encodes the type + field + value" do + expect(encoded).to eq( + "#{String::BSON_TYPE}#{"name".to_bson_cstring}#{"value".to_bson}" + ) + end end - let(:encoded) do - element.to_bson - end + context "when the field is a symbol" do - it "encodes the type + field + value" do - expect(encoded).to eq( - "#{String::BSON_TYPE}#{"name".to_bson_cstring}#{"value".to_bson}" - ) + let(:element) do + described_class.new(:name, "value") + end + + let(:encoded) do + element.to_bson + end + + it "encodes the type + field + value" do + expect(encoded).to eq( + "#{String::BSON_TYPE}#{"name".to_bson_cstring}#{"value".to_bson}" + ) + end end end end
Add symbol test in element
diff --git a/db/migrate/20130729085457_create_financial_report.rb b/db/migrate/20130729085457_create_financial_report.rb index abc1234..def5678 100644 --- a/db/migrate/20130729085457_create_financial_report.rb +++ b/db/migrate/20130729085457_create_financial_report.rb @@ -2,8 +2,8 @@ def change create_table :financial_reports do |t| t.belongs_to :organisation - t.integer :funding, :limit => 8#Default is insufficient for large spends - t.integer :spending, :limit => 8 + t.integer :funding, limit: 8#Default is insufficient for large spends + t.integer :spending, limit: 8 t.integer :year end add_index :financial_reports, :organisation_id
Use correct hash syntax in migration