diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -25,7 +25,7 @@ end case node['platform_family'] -when 'windows', 'debian', 'rhel', 'suse' +when 'windows', 'debian', 'rhel', 'suse', 'amazon' include_recipe 'push-jobs::install' else raise 'This cookbook currently supports only Windows, Debian-family Linux, RHEL-family Linux, and Suse.'
Add back amazon Linux support Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/spec/requests/virus_scanning_spec.rb b/spec/requests/virus_scanning_spec.rb index abc1234..def5678 100644 --- a/spec/requests/virus_scanning_spec.rb +++ b/spec/requests/virus_scanning_spec.rb @@ -17,6 +17,7 @@ get download_media_path(id: asset, filename: "lorem.txt") expect(response).to have_http_status(:not_found) + allow(Services.virus_scanner).to receive(:scan) VirusScanWorker.drain get download_media_path(id: asset, filename: "lorem.txt")
Fix virus scanning test on local docker instance We had one consistent failing test: ``` Virus scanning of uploaded images a clean asset is available after virus scanning & uploading to cloud storage Failure/Error: raise Error, out_str VirusScanner::Error: LibClamAV Error: cli_loaddbdir(): No supported database files found in /var/lib/clamav ERROR: Can't open file or directory ```
diff --git a/config/environments/production.rb b/config/environments/production.rb index abc1234..def5678 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -18,4 +18,5 @@ # config.action_mailer.raise_delivery_errors = false config.action_mailer.delivery_method = :sendmail # so is queued, rather than giving immediate errors -config.middleware.insert_after ActionController::Failsafe, "Rack::SSL" if ::Configuration::force_ssl +require 'rack/ssl' +config.middleware.insert_after ActionController::Failsafe, ::Rack::SSL if ::Configuration::force_ssl
Fix for incoming mailer failing with undefined method `new' for "Rack::SSL":String
diff --git a/roles/draco.rb b/roles/draco.rb index abc1234..def5678 100644 --- a/roles/draco.rb +++ b/roles/draco.rb @@ -22,7 +22,7 @@ :tune_cpu_scheduler => { :comment => "Tune CPU scheduler for server scheduling", :parameters => { - "kernel.sched_migration_cost" => 50000000, + "kernel.sched_migration_cost_ns" => 50000000, "kernel.sched_autogroup_enabled" => 0 } }
Correct name of sysctl variable
diff --git a/app/models/ability.rb b/app/models/ability.rb index abc1234..def5678 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -16,6 +16,9 @@ can :read, Comment, :status => ['neutral', 'approved', 'flagged'] can :opinions, Comment, :status => ['neutral', 'approved', 'flagged'] can :read, User + can :contributions, User + can :likes, User + can :dislikes, User if user.persisted? can :read, Comment, :user_id => user.id
Fix abilities to allow reading users contributions, likes and dislikes
diff --git a/spec/scanny/checks/ssl/verify_check_spec.rb b/spec/scanny/checks/ssl/verify_check_spec.rb index abc1234..def5678 100644 --- a/spec/scanny/checks/ssl/verify_check_spec.rb +++ b/spec/scanny/checks/ssl/verify_check_spec.rb @@ -4,7 +4,7 @@ describe VerifyCheck do before do @runner = Scanny::Runner.new(VerifyCheck.new) - @message = "Disable certificate verification can" + + @message = "Disable certificate verification can " + "lead to connect to an unauthorized server" @issue = issue(:high, @message, [296, 297, 298, 299, 300, 599]) end
Update check message. Add space.
diff --git a/db/data_migration/20210302154339_reslug_list_of_countries_accepted_towards_issuing_a_uk_cec.rb b/db/data_migration/20210302154339_reslug_list_of_countries_accepted_towards_issuing_a_uk_cec.rb index abc1234..def5678 100644 --- a/db/data_migration/20210302154339_reslug_list_of_countries_accepted_towards_issuing_a_uk_cec.rb +++ b/db/data_migration/20210302154339_reslug_list_of_countries_accepted_towards_issuing_a_uk_cec.rb @@ -0,0 +1,10 @@+document = Document.find_by_content_id("28a17ff2-bc8e-4237-a8f1-6ac290d9b6eb") + +edition = document.editions.published.last +Whitehall::SearchIndex.delete(edition) + +document.update!(slug: "list-of-countries-accepted-towards-issuing-a-uk-FSE") + +PublishingApiDocumentRepublishingWorker.new.perform(document.id) + +Whitehall::SearchIndex.add(edition)
Create manual reslugging db migration
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ long_description 'Upgrades chef-client to specified releases' version '1.0.2' -%w(amazon centos debian mac_os_x opensuse opensuseleap oracle redhat scientific solaris suse ubuntu windows aix).each do |os| +%w(amazon centos debian mac_os_x opensuse opensuseleap oracle redhat scientific solaris2 suse ubuntu windows aix).each do |os| supports os end
Fix the solaris platform name Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/0_code_wars/remove_first_and_last_char.rb b/0_code_wars/remove_first_and_last_char.rb index abc1234..def5678 100644 --- a/0_code_wars/remove_first_and_last_char.rb +++ b/0_code_wars/remove_first_and_last_char.rb @@ -0,0 +1,8 @@+# http://www.codewars.com/kata/570597e258b58f6edc00230d +# --- iteration 1 --- +def array(str) + nums = str.split(",") + return if nums.count < 3 + nums[1..-2].join(" ") +end +
Add code wars (8) - remove first and last char
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,10 +5,15 @@ description 'Installs/Configures ambari' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.3.3' + supports 'redhat', '>= 5.0' supports 'centos', '>= 5.0' supports 'amazon', '>= 5.0' supports 'scientific', '>= 5.0' supports 'suse', '>= 11.0' supports 'ubuntu', '>= 12.0' + depends 'apt' + +source_url 'https://github.com/jp/ambari' if respond_to?(:source_url) +issues_url 'https://github.com/jp/ambari/issues' if respond_to?(:issues_url)
Add issues_url and source_url for foodcritic
diff --git a/sirius.gemspec b/sirius.gemspec index abc1234..def5678 100644 --- a/sirius.gemspec +++ b/sirius.gemspec @@ -24,5 +24,6 @@ spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" + spec.add_development_dependency "pry" end
Add pry as development dependency
diff --git a/spec/helper.rb b/spec/helper.rb index abc1234..def5678 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -2,6 +2,8 @@ require "pry" RSpec.configure do |config| + + config.filter_run_excluding slow: true config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true
Support tagging specs as slow
diff --git a/moviebot.rb b/moviebot.rb index abc1234..def5678 100644 --- a/moviebot.rb +++ b/moviebot.rb @@ -11,6 +11,7 @@ require 'net/http' require 'json' require 'openssl' +require 'fileutils' require 'websocket/driver' require 'concurrent' @@ -33,6 +34,8 @@ SLACK = Slack.new +FileUtils.mkdir([ RIPPING_ROOT, ENCODING_ROOT, DONE_ROOT ]) + %w( INT TERM ).each do |sig| trap sig do SLACK.closeup
Create base directories on start.
diff --git a/spec/libraries/windows_spec.rb b/spec/libraries/windows_spec.rb index abc1234..def5678 100644 --- a/spec/libraries/windows_spec.rb +++ b/spec/libraries/windows_spec.rb @@ -0,0 +1,26 @@+require_relative '../../libraries/windows.rb' + +describe ::PCI::Windows do + describe 'the method #pnp_info' do + it 'parses ids correctly' do + hardware_ids = %w[PCI\VEN_8086&DEV_9C10&SUBSYS_060A1028&REV_E4 + PCI\VEN_8086&DEV_9C10&SUBSYS_060A1028 + PCI\VEN_8086&DEV_9C10&CC_060400 + PCI\VEN_8086&DEV_9C10&CC_0604] + expect(::PCI::Windows.pnp_info(hardware_ids)).to eq('vendor_id' => '8086', 'device_id' => '9c10', + 'sdevice_id' => '060a', 'svendor_id' => '1028', + 'class_id' => '0604', 'rev' => 'e4',) + end + end + + describe 'the method #slot' do + it 'converts location string into pci slot' do + location_string = '@System32\drivers\pci.sys,#65536;PCI bus %1, device %2, function %3;(0,28,0)' + expect(::PCI::Windows.slot(location_string)).to eq '0000:00:1c.0' + end + + it 'raises an error when location string is invalid' do + expect { ::PCI::Windows.slot('toto') }.to raise_error '[PCI] Invalid location string: \'toto\'' + end + end +end
Add minor test for windows helpers method
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,6 +1,24 @@+# +# Cookbook Name:: memcached +# Attributes:: default +# +# Copyright 2009, Opscode, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + default['memcached']['memory'] = 64 default['memcached']['port'] = 11211 default['memcached']['user'] = "nobody" default['memcached']['listen'] = "0.0.0.0" -default['memcached']['maxconn'] = 1024 - +default['memcached']['maxconn'] = 1024
Add header to the attributes file
diff --git a/spec/models/riews/view_spec.rb b/spec/models/riews/view_spec.rb index abc1234..def5678 100644 --- a/spec/models/riews/view_spec.rb +++ b/spec/models/riews/view_spec.rb @@ -7,5 +7,13 @@ it { should validate_presence_of(:code) } it { should validate_uniqueness_of(:code) } end + describe 'paginator_size' do + it { should validate_numericality_of(:paginator_size).is_greater_than_or_equal_to(0) } + end + describe 'accepts nested attributes for' do + it { should accept_nested_attributes_for(:columns).allow_destroy(true) } + it { should accept_nested_attributes_for(:filter_criterias).allow_destroy(true) } + it { should accept_nested_attributes_for(:relationships).allow_destroy(true) } + end end end
Add tests for ActiveRecord features on View model
diff --git a/core/spec/acceptance/feedback_spec.rb b/core/spec/acceptance/feedback_spec.rb index abc1234..def5678 100644 --- a/core/spec/acceptance/feedback_spec.rb +++ b/core/spec/acceptance/feedback_spec.rb @@ -10,12 +10,9 @@ end it "the form shows after clicking Feedback" do - find('#feedback_frame').visible?.should be_false + find('#feedback_frame', visible:false).visible?.should be_false click_link 'Feedback' - - # Wait for feedback slide in modal animation - sleep(1) find('#feedback_frame').visible?.should be_true end @@ -44,11 +41,9 @@ end it "the form shows after clicking Feedback" do - find('#feedback_frame').visible?.should be_false + find('#feedback_frame', visible:false).visible?.should be_false click_link 'Feedback' - - sleep(1) find('#feedback_frame').visible?.should be_true end
Fix selectors for invisible things (these now need to be explicit for capybara)
diff --git a/3-etl/emr-etl-runner/snowplow-emr-etl-runner.gemspec b/3-etl/emr-etl-runner/snowplow-emr-etl-runner.gemspec index abc1234..def5678 100644 --- a/3-etl/emr-etl-runner/snowplow-emr-etl-runner.gemspec +++ b/3-etl/emr-etl-runner/snowplow-emr-etl-runner.gemspec @@ -19,5 +19,6 @@ gem.add_dependency 'elasticity', '~> 2.4' gem.add_dependency 'fog', '~> 1.6.0' gem.add_dependency 's3', '0.3.11' + gem.add_dependency 'aws-s3', '0.6.3' # TODO: remove s3 when no longer used end
Add aws-s3 dependency to gemsepec
diff --git a/cookbooks/php7/recipes/default.rb b/cookbooks/php7/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/php7/recipes/default.rb +++ b/cookbooks/php7/recipes/default.rb @@ -15,7 +15,7 @@ action :add end -apt_package "php7.1" do +apt_package ["php7.1", "php7.1-xml", "php7.1-curl", "php7.1-zip", "php7.1-mbstring"] do action :install end
Add Extension for PHP7.1 so basic stuff works.
diff --git a/ar-ondemand.gemspec b/ar-ondemand.gemspec index abc1234..def5678 100644 --- a/ar-ondemand.gemspec +++ b/ar-ondemand.gemspec @@ -5,7 +5,6 @@ Gem::Specification.new do |s| s.name = 'ar-ondemand' s.version = ::ArOnDemand::VERSION - s.date = Date.today.to_s s.summary = 'ActiveRecord On-demand' s.description = 'Fast access to database results without the memory overhead of ActiveRecord objects' s.authors = ['Steve Frank']
Remove explicit date from gemspec This seems unnecessary. Having one causes wrong dates to be set on Rubygems, and setting `Date.today` fails on Solano.
diff --git a/artifactory.gemspec b/artifactory.gemspec index abc1234..def5678 100644 --- a/artifactory.gemspec +++ b/artifactory.gemspec @@ -21,5 +21,6 @@ spec.add_dependency 'httpclient', '~> 2.3' spec.add_dependency 'i18n', '~> 0.5' + spec.add_development_dependency 'pry' spec.add_development_dependency 'rake' end
Add pry as a development dependency
diff --git a/tools/check_interreplay_violations.rb b/tools/check_interreplay_violations.rb index abc1234..def5678 100644 --- a/tools/check_interreplay_violations.rb +++ b/tools/check_interreplay_violations.rb @@ -6,6 +6,8 @@ # It only exists because old STS versions didn't store this information in an # easily accessible way. It should be replaced with a simple tool that parses # the appropriate information in runtime_stats.json. + +require 'json' replay_number = 0 replay_to_violation = {} @@ -22,6 +24,5 @@ end end -replay_to_violation.keys.sort.each do |key| - puts "Replay #{key} violation #{replay_to_violation[key]}" -end +puts JSON.pretty_generate(replay_to_violation) +
Print JSON rather than plain text
diff --git a/racket.gemspec b/racket.gemspec index abc1234..def5678 100644 --- a/racket.gemspec +++ b/racket.gemspec @@ -3,7 +3,7 @@ require 'rubygems' SPEC = Gem::Specification.new do |s| s.name = "racket" - s.version = "1.0.9" + s.version = "1.0.10" s.author = "Jon Hart" s.email = "jhart@spoofed.org" s.homepage = "http://spoofed.org/files/racket/" @@ -15,6 +15,8 @@ item.include?("CVS") || item.include?("rdoc") || item.include?(".svn") end s.require_path = "lib" + s.add_dependency("pcaprub") + s.add_dependency("bit-struct") s.test_files = Dir.glob("test/ts_*.rb") s.has_rdoc = true s.rdoc_options << "-A rest,octets,hex_octets,unsigned,signed,text,rest"
Add pcaprub and bit-struct as dependencies git-svn-id: b3d365f95d627ddffb8722c756fee9dc0a59d335@182 64fbf49a-8b99-41c6-b593-eb2128c2192d
diff --git a/app/controllers/api/v1/api_application_controller.rb b/app/controllers/api/v1/api_application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/api_application_controller.rb +++ b/app/controllers/api/v1/api_application_controller.rb @@ -5,16 +5,17 @@ before_filter :authenticate_token! def authenticate_token! - token = request.headers['Token'] - api_consumer_token = ENV['API_TOKEN'] - if token != api_consumer_token + unless check_customer_access_token! render_unauthorized end end - def render_unauthorized - self.headers['WWW-Authenticate'] = 'Token realm="Application"' - render json: 'Bad credentials', status: 401 + def check_customer_access_token! + customer = Customer.find_by_access_token(request.headers['Token']) + if customer != nil + return true + end + return false end end end
Verify if access_token is correct
diff --git a/lib/languages/norsk/present_tense.rb b/lib/languages/norsk/present_tense.rb index abc1234..def5678 100644 --- a/lib/languages/norsk/present_tense.rb +++ b/lib/languages/norsk/present_tense.rb @@ -6,6 +6,9 @@ def self.regular_conjugation verb if verb.infinitive.end_with? "s" "#{verb.infinitive}" + elsif verb.infinitive.end_with? "transitive)" + inf = verb.infinitive.split(" ") + "#{inf.first}r #{inf.last}" else "#{verb.infinitive}r" end
Work around the "(transitive)" and "(intransitive)" labeling when conjugating in the present tense.
diff --git a/test/integration/api_authentication_test.rb b/test/integration/api_authentication_test.rb index abc1234..def5678 100644 --- a/test/integration/api_authentication_test.rb +++ b/test/integration/api_authentication_test.rb @@ -0,0 +1,25 @@+require 'test_helper' + +class ApiAuthenticationTest < ActionDispatch::IntegrationTest + fixtures :all + + test "authentication should fail with and old token" do + flunk + end + + test "authentication should fail with an invalid hash" do + flunk + end + + test "get account history in XML using API" do + flunk + end + + test "post a trade order using XML API" do + flunk + end + + test "post a trade order using JSON API" do + flunk + end +end
Test stubs for API authentication
diff --git a/app/controllers/admin/posts_controller.rb b/app/controllers/admin/posts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/posts_controller.rb +++ b/app/controllers/admin/posts_controller.rb @@ -53,6 +53,6 @@ # Only allow a trusted parameter "white list" through. def post_params - params.require(:post).permit(:title, :body, :site_id) + params.require(:post).permit(:title, :body, :site_id, :published, :published_at) end end
Add published and published_at to white list
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 @@ -22,6 +22,8 @@ def finders_excluded_from_robots [ 'aaib-reports', + 'drug-safety-update', + 'drug-device-alerts', 'maib-reports', 'raib-reports', ]
Revert "Allow robots to crawl MHRA"
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 @@ -15,4 +15,14 @@ erb :index end + helpers do + def is_logged_in? + !!session[:user_id] + end + + def current_user + User.find(session[:user_id]) + end + end + end
Add view helper methods in ApplicationController
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,6 +3,7 @@ # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + before_action :set_variant rescue_from CanCan::AccessDenied do |exception| # if signed_in? @@ -12,4 +13,10 @@ redirect_to root_url # end end + + private + def set_variant + request.variant = :mobile if browser.mobile? + request.variant = :mobile if params[:mobile].present? + end end
Allow mobile variant to be set
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,7 +1,4 @@ class ApplicationController < ActionController::Base - # Prevent CSRF attacks by raising an exception. - # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception def check_user_session(token = nil) token = params[:token] unless token.present?
Remove CSRF protection from ApplicationController
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 @@ -11,9 +11,8 @@ end end - def check_ownership(user_id) - login_needed - if @current_user.id != user_id + def check_ownership(user_id = params[:id]) + if !user_signed_in? || @current_user.id != user_id page_not_found("Wrong Owner") end end
Fix error in check_ownership when user isn't signed in
diff --git a/app/presenters/calculator_content_item.rb b/app/presenters/calculator_content_item.rb index abc1234..def5678 100644 --- a/app/presenters/calculator_content_item.rb +++ b/app/presenters/calculator_content_item.rb @@ -23,6 +23,7 @@ title: calculator.title, base_path: base_path, format: 'placeholder_calculator', + details: {}, publishing_app: 'calculators', rendering_app: 'calculators', locale: 'en',
Add empty `details` to content item payload sent to publishing api The govuk-content-schemas have changed since the last time this application was updated. The govuk-content-schemas now expects all content payloads pushed to it to contain a `details` item. This problem also occurred in the smart-answers repo. See PR: https://github.com/alphagov/smart-answers/pull/2539
diff --git a/app/views/categories/rss_feed.rss.builder b/app/views/categories/rss_feed.rss.builder index abc1234..def5678 100644 --- a/app/views/categories/rss_feed.rss.builder +++ b/app/views/categories/rss_feed.rss.builder @@ -6,7 +6,7 @@ xml.name "#{SiteSetting['SiteName']} - Codidact" end xml.link nil, rel: 'self', href: category_url(@category) - xml.updated @posts.maximum(:created_at).iso8601 + xml.updated @posts.maximum(:created_at)&.iso8601 || RequestContext.community.created_at&.iso8601 @posts.each do |post| xml.entry do @@ -16,8 +16,8 @@ xml.name post.user.username xml.uri user_url(post.user) end - xml.published post.created_at.iso8601 - xml.updated post.updated_at.iso8601 + xml.published post.created_at&.iso8601 + xml.updated post.updated_at&.iso8601 xml.link href: question_path(post) xml.summary post.body.truncate(200), type: 'html' end
Fix no-posts case for RSS feeds
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -25,14 +25,9 @@ case node['platform_family'] when 'rhel' - package_list = ['heartbeat', 'heartbeat-devel'] + package %w(heartbeat heartbeat-devel) when 'debian' - package_list = ['heartbeat', 'heartbeat-dev'] -end -package_list.each do |pkg| - package pkg do - action :install - end + package %w(heartbeat heartbeat-dev) end service 'heartbeat' do
Speed up intstalls with multipackage Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/lib/hdo/stats/vote_exporter.rb b/lib/hdo/stats/vote_exporter.rb index abc1234..def5678 100644 --- a/lib/hdo/stats/vote_exporter.rb +++ b/lib/hdo/stats/vote_exporter.rb @@ -0,0 +1,28 @@+require 'csv' + +module Hdo + module Stats + class VoteExporter + def initialize(votes = Vote.all) + @votes = votes + end + + def csv + parties = Party.order(:external_id).to_a + + CSV.generate(col_sep: "\t") do |csv| + csv << %w[id time session] + parties.map(&:external_id) + + @votes.each do |vote| + stats = vote.stats + csv << [vote.slug, vote.time.localtime.iso8601, vote.parliament_session.name] + parties.map { |p| stats.key_for(p) } + end + end + end + + def print + puts csv + end + end + end +end
Add script to CSV export votes + handle an exact party split in VoteCounts
diff --git a/lib/moonshine/msttcorefonts.rb b/lib/moonshine/msttcorefonts.rb index abc1234..def5678 100644 --- a/lib/moonshine/msttcorefonts.rb +++ b/lib/moonshine/msttcorefonts.rb @@ -26,7 +26,7 @@ file '/var/cache/preseeding/msttcorefonts.seed', :ensure => :present, - :content => template('msttcorefonts.seed') + :content => template(File.join(File.dirname(__FILE__), '..', '..', 'templates','msttcorefonts.seed')) package 'msttcorefonts', :ensure => :installed,
Update path to template file
diff --git a/db/data_migration/20130926091146_fix_broken_first_published_at_timestamps.rb b/db/data_migration/20130926091146_fix_broken_first_published_at_timestamps.rb index abc1234..def5678 100644 --- a/db/data_migration/20130926091146_fix_broken_first_published_at_timestamps.rb +++ b/db/data_migration/20130926091146_fix_broken_first_published_at_timestamps.rb @@ -0,0 +1,19 @@+nineteen_hundreds = Date.new(1900) + +documents = Edition.where('first_published_at < ? and state != ?', nineteen_hundreds, 'imported').collect(&:document).uniq +documents.each do |document| + fallback_timestamp = document.latest_edition.first_published_at + + document.editions.where('first_published_at < ?', nineteen_hundreds).each do |edition| + if edition.first_published_at < nineteen_hundreds + if edition.public_timestamp < nineteen_hundreds + fix = fallback_timestamp + else + fix = edition.public_timestamp + end + + puts "Fixing timestamp on #{edition.id}|#{edition.title} - setting it to #{fix}" + edition.update_attribute(:first_published_at, fix) + end + end +end
Fix editions with broken first_published_at There are a dozen or so editions with a first_published_at timestamp that is broken (e.g. 0001-01-01). This fixes them, using the edition's public_timestamp if that is a sensible value, otherwise falling back to the latest edition's first_published_at
diff --git a/lib/smoke_monster/array_to_object.rb b/lib/smoke_monster/array_to_object.rb index abc1234..def5678 100644 --- a/lib/smoke_monster/array_to_object.rb +++ b/lib/smoke_monster/array_to_object.rb @@ -4,13 +4,12 @@ return [] if data.empty? result = Object.new - def result.name - @name - end - def result.name=(value) - @name = value - end - result.name = data[0] + property_name = self[0] + result.instance_variable_set("@#{property_name}", data[0]) + result.instance_eval(" + class << self + attr_accessor :#{property_name} + end") [result] end end
Make the failing test pass.
diff --git a/lib/tweets/media_status_persister.rb b/lib/tweets/media_status_persister.rb index abc1234..def5678 100644 --- a/lib/tweets/media_status_persister.rb +++ b/lib/tweets/media_status_persister.rb @@ -17,7 +17,7 @@ LAYOUT def initialize(image_path) - @image_path = image_path + @image_paths = [image_path] @file_helper = FileHelper.new(Dir.pwd) end @@ -29,7 +29,7 @@ 'id' => tweet.id, 'url' => tweet.uri.to_s, 'timestamp' => DateTime.parse(tweet.created_at.to_s), - 'image' => copy_image(tweet.id) + 'image' => copy_images_to_blog(tweet.id).first } })) end @@ -39,18 +39,19 @@ end private - def image - @image ||= File.new(@image_path) + def copy_images_to_blog(tweet_id) + FileUtils.mkdir_p("#{Dir.pwd}/img/tweets") + @image_paths. + each { |p| copy_image(tweet_id, p) }. + map { |p| conventional_filename(tweet_id, p) } end - def copy_image(tweet_id) - FileUtils.mkdir_p("#{Dir.pwd}/img/tweets") - FileUtils.cp(@image_path, "#{Dir.pwd}#{conventional_filename(tweet_id)}") - - conventional_filename(tweet_id) + def copy_image(tweet_id, image_path) + FileUtils. + cp(image_path, "#{Dir.pwd}#{conventional_filename(tweet_id, image_path)}") end - def conventional_filename(tweet_id) - "/img/tweets/#{tweet_id}-#{File.basename(image)}" + def conventional_filename(tweet_id, image_path) + "/img/tweets/#{tweet_id}-#{File.basename(File.new(image_path))}" end end
Make MediaStatusPersister handle no images
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,7 +13,7 @@ # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - config.time_zone = "Europe/Amsterdam" + config.time_zone = "Etc/UTC" config.encoding = "utf-8" config.assumptions_path = Rails.root.join("config", "assumptions.yml")
Use UTC as the default time zone
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -19,7 +19,6 @@ config.active_record.whitelist_attributes = false config.assets.enabled = true - config.assets.initialize_on_precompile = false config.assets.precompile += %w(media-queries.css ie.css) config.assets.version = '1.3' config.autoload_paths += %W(#{config.root}/lib)
Load rails environment when precompiling assets * Setting config.assets.initialize_on_precompile to false does not load Rails environment when precompiling assets * Use of named routes in js.erb files requires Rails environment * Heroku suggests setting to false in Rails 3, but this config option is not available in Rails 4 so seems most efficient to just remove * source: https://devcenter.heroku.com/articles/rails-asset-pipeline https://trello.com/c/0pwMUlS8
diff --git a/spec/unit/pty_spec.rb b/spec/unit/pty_spec.rb index abc1234..def5678 100644 --- a/spec/unit/pty_spec.rb +++ b/spec/unit/pty_spec.rb @@ -2,7 +2,7 @@ it "executes command in pseudo terminal mode as global option", unless: RSpec::Support::OS.windows? do color_cli = fixtures_path('color') output = StringIO.new - cmd = TTY::Command.new(pty: true)#(output: output, pty: true) + cmd = TTY::Command.new(output: output, pty: true) out, err = cmd.run(color_cli) @@ -13,7 +13,7 @@ it "executes command in pseudo terminal mode as command option", unless: RSpec::Support::OS.windows? do color_cli = fixtures_path('color') output = StringIO.new - cmd = TTY::Command.new #(output: output) + cmd = TTY::Command.new(output: output) out, err = cmd.run(color_cli, pty: true)
Change to silence test output
diff --git a/library/zlib/gzipwriter/write_spec.rb b/library/zlib/gzipwriter/write_spec.rb index abc1234..def5678 100644 --- a/library/zlib/gzipwriter/write_spec.rb +++ b/library/zlib/gzipwriter/write_spec.rb @@ -1,3 +1,4 @@+#coding:ASCII-8BIT require File.dirname(__FILE__) + '/../../../spec_helper' require 'stringio' require 'zlib' @@ -7,7 +8,7 @@ before :each do @data = '12345abcde' @zip = "\037\213\b\000,\334\321G\000\00334261MLJNI\005\000\235\005\000$\n\000\000\000" - @io = StringIO.new + @io = StringIO.new('') end it "writes some compressed data" do
Add magic comment and give initial string to set its encoding.
diff --git a/test/models/campus_test.rb b/test/models/campus_test.rb index abc1234..def5678 100644 --- a/test/models/campus_test.rb +++ b/test/models/campus_test.rb @@ -1,14 +1,12 @@ require "test_helper" class CampusTest < ActiveSupport::TestCase - def test_create_campus - data = { - name: 'Sydney', - mode: 'automatic', - abbreviation: 'Syd' - } - campus = Campus.create!(data) + # FactoryGirl.create will create campus from the values defined in the Campus factory + # We can override the values as well, for specific test cases it is recommended that we do + # FactoryGirl.create(:campus, name: 'Burwood') + def test_default_create + campus = FactoryGirl.create(:campus) assert campus.valid? end end
TEST: Use factory girl default create in test create campus
diff --git a/test/unit/resource_test.rb b/test/unit/resource_test.rb index abc1234..def5678 100644 --- a/test/unit/resource_test.rb +++ b/test/unit/resource_test.rb @@ -0,0 +1,9 @@+require "test_helper" + +class Colppy::ResourceTest < Minitest::Test + + def test_valid_invoices_types + assert_equal %w(A B C E Z I M X), Colppy::Resource::VALID_INVOICE_TYPES + end + +end
Add a test to push to travis
diff --git a/test/dummy_test.rb b/test/dummy_test.rb index abc1234..def5678 100644 --- a/test/dummy_test.rb +++ b/test/dummy_test.rb @@ -21,20 +21,20 @@ end end -# describe "Dummy Spec" do -# before do -# @dummy = Dummy.new -# end +describe "Dummy Spec" do + before do + @dummy = Dummy.new + end -# describe "test dummy" do -# it "must nil before initial value" do -# @dummy.dummy.nil?.must_equal true -# end + describe "test dummy" do + it "must nil before initial value" do + @dummy.dummy.nil?.must_equal true + end -# it "must equals value passed in" do -# @dummy.value = :abc -# @dummy.dummy.must_equal :abc -# end -# end -# end + it "must equals value passed in" do + @dummy.value = :abc + @dummy.dummy.must_equal :abc + end + end +end
Enable spec style, let later to remove one of them
diff --git a/text_message_rails.gemspec b/text_message_rails.gemspec index abc1234..def5678 100644 --- a/text_message_rails.gemspec +++ b/text_message_rails.gemspec @@ -25,5 +25,5 @@ spec.add_development_dependency "bundler", "~> 1.11" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.0" - spec.add_dependency "rails", "> 3.0" + spec.add_runtime_dependency "rails", "> 3.0" end
Make Rails a runtime dependency
diff --git a/Expecta.podspec b/Expecta.podspec index abc1234..def5678 100644 --- a/Expecta.podspec +++ b/Expecta.podspec @@ -23,4 +23,5 @@ s.osx.deployment_target = '10.7' s.frameworks = 'Foundation', 'XCTest' + s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' } end
Fix deployment to hardware device.
diff --git a/Formula/glpk.rb b/Formula/glpk.rb index abc1234..def5678 100644 --- a/Formula/glpk.rb +++ b/Formula/glpk.rb @@ -0,0 +1,12 @@+require 'brewkit' + +class Glpk <Formula + url 'http://ftp.gnu.org/gnu/glpk/glpk-4.39.tar.gz' + homepage 'http://www.gnu.org/software/glpk/' + md5 '95f276ef6c94c6de1eb689f161f525f3' + + def install + system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking" + system "make install" + end +end
Add formula for GNU Linear Programming Kit Provides a library and stand-alone tool for solving linear programs (LPs) and integer linear programs (ILPs). Doesn't depend on anything else.
diff --git a/db/migrate/20141105111536_create_users.rb b/db/migrate/20141105111536_create_users.rb index abc1234..def5678 100644 --- a/db/migrate/20141105111536_create_users.rb +++ b/db/migrate/20141105111536_create_users.rb @@ -4,8 +4,8 @@ t.string :username t.string :email t.string :password_digest - t.references :driver_score - t.references :navigator_score + t.integer :driver_score + t.integer :navigator_score t.references :organization t.timestamps
Add User References to Session Migration
diff --git a/GeoFire.podspec b/GeoFire.podspec index abc1234..def5678 100644 --- a/GeoFire.podspec +++ b/GeoFire.podspec @@ -11,7 +11,7 @@ s.default_subspec = 'Database' s.subspec 'Database' do |db| - db.ios.dependency 'Firebase/Database', '~> 7.0.0' + db.ios.dependency 'Firebase/Database', '> 7.0.0', '< 9.0.0' db.ios.dependency 'GeoFire/Utils' db.public_header_files = "GeoFire/API/*" db.source_files = ["GeoFire/Implementation/*", "GeoFire/API/*"]
Add compatibility with all Firebase 7 and 8 versions
diff --git a/app/controller/ember_cli/ember_controller.rb b/app/controller/ember_cli/ember_controller.rb index abc1234..def5678 100644 --- a/app/controller/ember_cli/ember_controller.rb +++ b/app/controller/ember_cli/ember_controller.rb @@ -1,5 +1,16 @@ module EmberCli class EmberController < ::ApplicationController + unless ancestors.include? ActionController::Base + ( + ActionController::Base::MODULES - + ActionController::API::MODULES + ).each do |controller_module| + include controller_module + end + + helper EmberRailsHelper + end + def index render layout: false end
Add modules to `ember_cli/ember` controller Closes [#480]. When the `ApplicationController` extends `ActionController::API`, HTML rendering modules and logic are omitted. To make the `EmberCli::EmberController` capable of rendering the Ember application's HTML, this commit ensures those modules are included when necessary. [#480]: https://github.com/thoughtbot/ember-cli-rails/issues/480
diff --git a/week-6/attr/my_solution.rb b/week-6/attr/my_solution.rb index abc1234..def5678 100644 --- a/week-6/attr/my_solution.rb +++ b/week-6/attr/my_solution.rb @@ -0,0 +1,82 @@+#Attr Methods + +# I worked on this challenge by myself + +# I spent 2.5 hours on this challenge. + +# Pseudocode + +# Input:a name +# Output: a greeting specific for a name +# Steps: +#1)create an accessor attribute for a name +#2)Create two classes, one for names and one for greetings +#3) link the two classes to get the name - composition + +class NameData + attr_accessor :name + def initialize + @name = "Stephanie" + end +end + +class Greetings + def initialize + @namedata = NameData.new + end + + def hello_message + puts "Hello #{@namedata.name}! How wonderful to see you today!" + end +end +greeting_message = Greetings.new +greeting_message.hello_message + + +# Reflection +# Release 1: +# • What are these methods doing? +# Make us access what is in the class and allows the instance variables to be changed. The variables are @age, @name, @occupation +# • How are they modifying or returning the value of instance variables? +# They each have a method to change them. For example: +# def change_my_name=(new_name) +# @name = new_name +# end + +# Release 2: +# • What changed between the last release and this release? +# o On line 5, an att_reader was added for the age. +# o The method 23 – 27, the method that permitted us to see the age, is gone. +# o The method on line 58 is simpler +# • What was replaced? +# An attribute reader method. +# • Is this code simpler than the last? +# Much simpler indeed. + +# Release 3: +# • What changed between the last release and this release? +# o An attribute writer for the age instance variable was added on line 6. +# o The method 23 – 27, the method that permitted us to change the age, is gone. +# o The method on line 68 is simpler + +# • What was replaced? +# An attribute writer method. + +# • Is this code simpler than the last? +# Much simpler + + +# Release 6: Reflect +# • What is a reader method? +# Permits you to see (aka returns) a value outside the class without changing it +# • What is a writer method? +# Permits you to change a variable outside the class but you cannot read it + +# • What do the attr methods do for you? +# Permits you to see (aka returns) and change a variable outside the class (combo or reader-writer) + +# • Should you always use an accessor to cover your bases? Why or why not? +# No because you don’t want someone to mess with your variable. It might touch something that needs the current value your variable has + +# • What is confusing to you about these methods? +# These methods are logical. The most difficult in all that is how to call the value from outside. It is much more like regular plain English but we have been drilled over the last few weeks to call it “the computer way”…
Add file for the attribute exercise
diff --git a/lib/swingset/framework_directory.rb b/lib/swingset/framework_directory.rb index abc1234..def5678 100644 --- a/lib/swingset/framework_directory.rb +++ b/lib/swingset/framework_directory.rb @@ -0,0 +1,34 @@+# +module SwingSet + # Will add frameworks to a given swingset + class FrameworkDirectory + def initialize(swingset, framework_path) + @swingset = swingset + add_frameworks_from_path(path) + end + + def self.carthage_frameworks(swingset, platform = :ios) + path = File.join('Carthage', 'Build') + if platform == :ios + path = File.join(path, 'iOS') + elsif platform == :osx + path = File.join(path, 'Mac') + else + return + end + FrameworkDirectory.new(swingset, path) + end + + def add_framework_path(path) + add_frameworks_from_path(path) if Dir.exist?(path) + end + + private + + def add_frameworks_from_path(path) + fw_glob = File.join(path, '*.framework') + Dir.glob(fw_glob).each do |framework| + @swingset.add_framework(framework) + end + end + end
Create a class which can prepare a swingset with frameworks in a directory
diff --git a/lib/tasks/notify_trending_maps.rake b/lib/tasks/notify_trending_maps.rake index abc1234..def5678 100644 --- a/lib/tasks/notify_trending_maps.rake +++ b/lib/tasks/notify_trending_maps.rake @@ -24,7 +24,7 @@ unless simulation trending_maps_lib.notify_trending_map(visualization_id, views, preview_image) - user_id = visualization.fetch.user.id + user_id = visualization.user.id Carto::Tracking::Events::ScoredTrendingMap.new(user_id, user_id: user_id, visualization_id: visualization.id,
Fix trending maps after refactor
diff --git a/app/controllers/landing_controller.rb b/app/controllers/landing_controller.rb index abc1234..def5678 100644 --- a/app/controllers/landing_controller.rb +++ b/app/controllers/landing_controller.rb @@ -33,5 +33,7 @@ index.sub!("/ember-cli-live-reload", "http://localhost:4200/ember-cli-live-reload") end + + index end end
Return index after patching it
diff --git a/app/controllers/axioms_controller.rb b/app/controllers/axioms_controller.rb index abc1234..def5678 100644 --- a/app/controllers/axioms_controller.rb +++ b/app/controllers/axioms_controller.rb @@ -27,9 +27,9 @@ else parent.translated_axioms end - Kaminari.paginate_array(axioms).page(params[:page]) + Kaminari.paginate_array(axioms).page(params[:page]).per(params[:per_page]) else - Kaminari.paginate_array(parent.axioms.original).page(params[:page]) + Kaminari.paginate_array(parent.axioms.original).page(params[:page]).per(params[:per_page]) end end
Add per_page support for axioms index.
diff --git a/app/controllers/manage_controller.rb b/app/controllers/manage_controller.rb index abc1234..def5678 100644 --- a/app/controllers/manage_controller.rb +++ b/app/controllers/manage_controller.rb @@ -24,7 +24,7 @@ register Sinatra::Twitter::Bootstrap::Assets get '/jobs' do - @jobs = SubmissionJob.dataset + @jobs = SubmissionJob.order(Sequel.desc(:id)) case params[:scope] when 'all' # no-op
[manage] Order jobs by ID desc.
diff --git a/app/helpers/blog/pagination_helper.rb b/app/helpers/blog/pagination_helper.rb index abc1234..def5678 100644 --- a/app/helpers/blog/pagination_helper.rb +++ b/app/helpers/blog/pagination_helper.rb @@ -13,7 +13,7 @@ protected def url(page) - path = @template.request.path + path = current_path if page == 1 path = path.sub(PAGE_PARAMETER, "") @@ -25,8 +25,17 @@ Wheelhouse::PathUtils.normalize_path(path) end - alias url_for url + + def current_path + request = @template.request + + if request.respond_to?(:original_fullpath) + request.original_fullpath.sub(/\?#{request.query_string}$/, "") + else + request.path + end + end end DEFAULTS = {
Fix pagination paths in Rails 4.2
diff --git a/app/models/concerns/account_scoped.rb b/app/models/concerns/account_scoped.rb index abc1234..def5678 100644 --- a/app/models/concerns/account_scoped.rb +++ b/app/models/concerns/account_scoped.rb @@ -29,7 +29,7 @@ end def with(options) - if (account = options).is_a?(Account) || + if ((account = options).is_a?(Account) && (options = {})) || (options.is_a?(Hash) && options.has_key?(:account) && ((account = options.delete(:account)) || true)) options = options.merge(collection: Account.tenant_collection_name(mongoid_root_class, account: account)) end
Fix account scoped persist options for account option
diff --git a/app/models/spree/payment_decorator.rb b/app/models/spree/payment_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/payment_decorator.rb +++ b/app/models/spree/payment_decorator.rb @@ -0,0 +1,29 @@+module Spree + module PaymentDecorator + def verify!(**options) + process_verification(options) + end + + private + + def process_verification(**options) + protect_from_connection_error do + response = payment_method.verify(source, options) + + record_response(response) + + if response.success? + unless response.authorization.nil? + self.response_code = response.authorization + + source.update(status: response.params['status']) + end + else + gateway_error(response) + end + end + end + end +end + +Spree::Payment.prepend Spree::PaymentDecorator
Allow ACH bank transfer spree payments to be verified from model level
diff --git a/app/models/spree/product_decorator.rb b/app/models/spree/product_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/product_decorator.rb +++ b/app/models/spree/product_decorator.rb @@ -1,6 +1,8 @@ # Add access to reviews/ratings to the product model Spree::Product.class_eval do has_many :reviews + + attr_accessible :avg_rating, :reviews_count def stars avg_rating.round
Fix for Rails security update. Need to make those attributes accessible
diff --git a/app/resources/application_resource.rb b/app/resources/application_resource.rb index abc1234..def5678 100644 --- a/app/resources/application_resource.rb +++ b/app/resources/application_resource.rb @@ -27,7 +27,7 @@ when JSONAPI::Relationship::ToOne record_or_records when JSONAPI::Relationship::ToMany - ::Pundit.policy_scope!(context[:user], record_or_records) + ::Pundit.policy_scope!(context[:current_user], record_or_records) else raise "Unknown relationship type #{relationship.inspect}" end
Fix Pundit not receiving context
diff --git a/app/models/webhook/event_register.rb b/app/models/webhook/event_register.rb index abc1234..def5678 100644 --- a/app/models/webhook/event_register.rb +++ b/app/models/webhook/event_register.rb @@ -4,10 +4,12 @@ end class EventRegister + attr_accessor :event + def initialize(record, created: false) @record, @created = record, created - event = Event.create(serialized_record: serialized_record, kind: type) - EventSenderWorker.perform_async(event.id) + @event = Event.create(serialized_record: serialized_record, kind: type) + EventSenderWorker.perform_async(@event.id) end def serialized_record
Add event attr on event register model
diff --git a/week-4/calulate-grade/my_solution.rb b/week-4/calulate-grade/my_solution.rb index abc1234..def5678 100644 --- a/week-4/calulate-grade/my_solution.rb +++ b/week-4/calulate-grade/my_solution.rb @@ -1,6 +1,20 @@ # Calculate a Grade -# I worked on this challenge [by myself, with: ]. +# I worked on this challenge with: Joe Plonsker. -# Your Solution Below+# Your Solution Below + +def get_grade(average) + if average >= 90 + return "A" + elsif average >= 80 + return "B" + elsif average >= 70 + return "C" + elsif average >= 60 + return "D" + else + return "F" + end +end
Add solution for calulate grade
diff --git a/hash_attribute_assignment.gemspec b/hash_attribute_assignment.gemspec index abc1234..def5678 100644 --- a/hash_attribute_assignment.gemspec +++ b/hash_attribute_assignment.gemspec @@ -19,4 +19,5 @@ s.add_development_dependency 'rake' s.add_development_dependency 'rspec' s.add_development_dependency 'rubocop' + s.add_development_dependency 'rubocop-junit-formatter' end
Add the rubocop junit formatter
diff --git a/lib/models/character/character_wcl.rb b/lib/models/character/character_wcl.rb index abc1234..def5678 100644 --- a/lib/models/character/character_wcl.rb +++ b/lib/models/character/character_wcl.rb @@ -24,7 +24,8 @@ percentiles.each do |difficulty, encounters| WCL_IDS.each do |encounter_id| - details['warcraftlogs'][difficulty.to_s][encounter_id] = encounters[encounter_id] || '-' + details['warcraftlogs'][difficulty.to_s][encounter_id] = encounters[encounter_id] || + details['warcraftlogs'][difficulty.to_s][encounter_id] rescue '-' end end end
Fix a bug where tracking multiple raids at the same time caused data to be overwritten.
diff --git a/lib/resume/cli/resume_data_fetcher.rb b/lib/resume/cli/resume_data_fetcher.rb index abc1234..def5678 100644 --- a/lib/resume/cli/resume_data_fetcher.rb +++ b/lib/resume/cli/resume_data_fetcher.rb @@ -1,29 +1,21 @@ require 'json' +require_relative '../output' require_relative '../file_fetcher' -require_relative '../output' module Resume module CLI - class ResumeDataFetcher - + class ResumeDataFetcher < FileFetcher def self.fetch - new.fetch + super("resources/resume.#{I18n.locale}.json") end - - private_class_method :new def fetch Output.plain(:gathering_resume_information) + resume = super JSON.parse( - FileFetcher.fetch(filename).read, + resume.read, symbolize_names: true ) - end - - private - - def filename - I18n.t(:resume_data_filename, selected_locale: I18n.locale) end end end
Refactor resume data fetcher to just inherit most of its functionality from file fetcher and only differentiate itself by parsing JSON
diff --git a/dynamodb-mutex.gemspec b/dynamodb-mutex.gemspec index abc1234..def5678 100644 --- a/dynamodb-mutex.gemspec +++ b/dynamodb-mutex.gemspec @@ -1,5 +1,6 @@ # -*- encoding: utf-8 -*- +require 'date' require File.expand_path("../lib/dynamodb_mutex/version", __FILE__) Gem::Specification.new do |gem| @@ -9,7 +10,7 @@ gem.license = "MIT" gem.summary = "Distributed mutex based on AWS DynamoDB" - gem.description = "dynamodb-mutex implements a simple mutex that can be used to coordinate" + gem.description = "dynamodb-mutex implements a simple mutex that can be used to coordinate" + "access to shared data from multiple concurrent hosts" gem.authors = ['Dinesh Yadav'] @@ -26,4 +27,4 @@ # ensure the gem is built out of versioned files gem.files = Dir['Rakefile', '{bin,lib,man,test,spec}/**/*', 'README*', 'LICENSE*'] & `git ls-files -z`.split("\0") -end+end
Add missing require date, fix string concat.
diff --git a/test/setup_test.rb b/test/setup_test.rb index abc1234..def5678 100644 --- a/test/setup_test.rb +++ b/test/setup_test.rb @@ -13,5 +13,4 @@ require File.join(File.dirname(__FILE__), 'models/entry') require File.join(File.dirname(__FILE__), 'models/comment') require File.join(File.dirname(__FILE__), 'models/message') -require File.join(File.dirname(__FILE__), 'models/review') -require File.join(File.dirname(__FILE__), 'models/group')+require File.join(File.dirname(__FILE__), 'models/group')
Remove a dumb xss_terminate warning during bundle install.
diff --git a/test/tunit_test.rb b/test/tunit_test.rb index abc1234..def5678 100644 --- a/test/tunit_test.rb +++ b/test/tunit_test.rb @@ -3,12 +3,21 @@ class TunitTest < Tunit::TestCase def setup - Tunit.io = io Tunit::Runnable.runnables = [PassingTest] + Tunit.io = io + end + + def test_run_processes_arguments + self.class.send :const_set, :ARGV, ["--verbose", "-n", "test_pass"] + Tunit.run ARGV + + assert Tunit.reporter.reporters.first.options[:verbose] + assert_equal "test_pass", Tunit.reporter.reporters.first.options[:filter] end def test_run_gathers_reporters_under_compound_reporter Tunit.run + assert_instance_of Tunit::CompoundReporter, Tunit.reporter end
Test how Tunit sets arguments
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/chef/attributes/default.rb +++ b/cookbooks/chef/attributes/default.rb @@ -5,4 +5,4 @@ default[:chef][:server][:version] = "12.0.8-1" # Set the default client version -default[:chef][:client][:version] = "12.9.41-1" +default[:chef][:client][:version] = "12.10.24-1"
Update chef client to 12.10.24
diff --git a/lib/services.rb b/lib/services.rb index abc1234..def5678 100644 --- a/lib/services.rb +++ b/lib/services.rb @@ -1,8 +1,8 @@ require "statsd" +require "gds_api" require "gds_api/publishing_api_v2" require "gds_api/content_store" require "gds_api/imminence" -require "gds_api/worldwide" module Services def self.publishing_api @@ -17,7 +17,7 @@ end def self.worldwide_api - @worldwide_api ||= GdsApi::Worldwide.new(Plek.new.find("whitehall-admin")) + @worldwide_api ||= GdsApi.worldwide end def self.content_store
Access Worldwide API via whitehall-frontend To simplify the migration of Whitehall to AWS, calls to the Worldwide API should be directed to whitehall-frontend, not whitehall-admin. Co-authored-by: Christopher Baines <c14e4e2094dd20d1d0dcfc7ec4547168bcc89be2@digital.cabinet-office.gov.uk>
diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -33,7 +33,7 @@ def find_collection collection = default_scope(self.class.resource_class.scoped) - collection = apply_scopes(collection) if respond_to? :apply_scopes + collection = apply_scopes(collection) collection end
Remove respond_to? :apply_scopes as it returns false on Ruby 2.0.0.
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -7,7 +7,11 @@ @comment.chef = current_chef if @comment.save - ActionCable.server.broadcast 'comments', render(partial: 'comments/comment', object: @comment) + if @recipe.comments.count == 1 # First one + redirect_to @recipe + else + ActionCable.server.broadcast 'comments', render(partial: 'comments/comment', object: @comment) + end else message = 'That comment could not be saved' if @comment.errors.any?
Fix insertion of first comment
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -9,6 +9,8 @@ end def destroy + reset_session + redirect_to root_path end private
Update destroy action in sessions controller
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -5,11 +5,15 @@ redirect_to '/auth/github' end + def create client = Octokit::Client.new access_token: auth_hash['credentials']['token'] - #if client.org_member?(ENV['ORG_NAME'], client.user.login) - @user = User.where(:provider => auth_hash['provider'], :uid => auth_hash['uid'].to_s).first + # COMMENTED OUT: Logic checking if user is part of Devbootcamp org on Github. + # Abbreviations for greping user/orgs: chi, sf, sea, nyc, aus, sd, dc + + # if client.org_member?(ENV['ORG_NAME'], client.user.login) + # @user = User.where(:provider => auth_hash['provider'], :uid => auth_hash['uid'].to_s).first if @user reset_session session[:user_id] = @user.id
Add comments/comment out logic for checking if member of DBC github org
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -5,10 +5,10 @@ end def create + p params[:password] @user = User.find_by_username(params[:username]) - if @user && @user.authenticate(params[:sessions][:password]) - p params + if @user && @user.authenticate(params[:password]) render json: @user render json: @user.kitchens # status: :ok
Check if passwords will go
diff --git a/lib/activerecord-postgres-json.rb b/lib/activerecord-postgres-json.rb index abc1234..def5678 100644 --- a/lib/activerecord-postgres-json.rb +++ b/lib/activerecord-postgres-json.rb @@ -1,2 +1,4 @@-require 'activerecord-postgres-json/activerecord' +ActiveSupport.on_load :active_record do + require 'activerecord-postgres-json/activerecord' +end require 'activerecord-postgres-json/coders'
Load the patch after the ActiveRecord is loaded
diff --git a/app/jobs/update_allele_registry_ids.rb b/app/jobs/update_allele_registry_ids.rb index abc1234..def5678 100644 --- a/app/jobs/update_allele_registry_ids.rb +++ b/app/jobs/update_allele_registry_ids.rb @@ -11,13 +11,11 @@ end def reschedule - self.class.set(wait_until: next_week).perform_later + self.class.set(wait_until: next_day).perform_later end - def next_week - Date.today - .beginning_of_week - .next_week + def next_day + Date.tomorrow .midnight end end
Change UpdateAlleleRegistry to run nightly
diff --git a/lib/electric_sheep/sheepfile/evaluator.rb b/lib/electric_sheep/sheepfile/evaluator.rb index abc1234..def5678 100644 --- a/lib/electric_sheep/sheepfile/evaluator.rb +++ b/lib/electric_sheep/sheepfile/evaluator.rb @@ -15,7 +15,7 @@ def evaluate_file(config) config.tap do |config| begin - Dsl.new(config).instance_eval File.open(@path, 'rb').read + Dsl.new(config).instance_eval File.open(@path, 'rb').read, @path rescue SyntaxError => e line = e.message[/.*:(.*):/,1] raise SheepException, "Syntax error in #{@path} line: #{line}"
Add path name to instance_eval
diff --git a/lib/facter/vmwaretools_version.rb b/lib/facter/vmwaretools_version.rb index abc1234..def5678 100644 --- a/lib/facter/vmwaretools_version.rb +++ b/lib/facter/vmwaretools_version.rb @@ -9,7 +9,12 @@ if File::executable?("/usr/bin/vmware-toolbox-cmd") result = Facter::Util::Resolution.exec("/usr/bin/vmware-toolbox-cmd -v") if result - result.sub(%r{(\d*\.\d*\.\d*)\.\d*\s+\(build(-\d*)\)},'\1\2') + version = result.sub(%r{(\d*\.\d*\.\d*)\.\d*\s+\(build(-\d*)\)},'\1\2') + if version.empty? or version.nil? + '0.unknown' + else + version + end else "not installed" end
Fix version detection for wrecked vmware-tools install I found a broken version of vmware-tools, basically the vmware-toolbox-cmd returned nothing. Not for -v or --help. The change allows the fact to say that a version is installed, but its unknown which. This should trigger a clean update (or reinstall).
diff --git a/app/models/ontology_version/parsing.rb b/app/models/ontology_version/parsing.rb index abc1234..def5678 100644 --- a/app/models/ontology_version/parsing.rb +++ b/app/models/ontology_version/parsing.rb @@ -11,14 +11,14 @@ @deactivate_parsing = true end - def async_parse + def async_parse(*args) if !@deactivate_parsing update_state! :pending - async :parse + async :parse, *args end end - def parse + def parse(refresh_cache: false) # do_or_set_failed do # condition = ['checksum = ? and id != ?', self.checksum, self.id] # if OntologyVersion.where(condition).any? @@ -31,10 +31,8 @@ do_or_set_failed do refresh_checksum! unless checksum? - @path = Hets.parse(self.raw_path!, self.ontology.repository.url_maps, File.dirname(self.xml_path)) - - # move generated file to destination - File.rename @path, self.xml_path + # run hets if necessary + generate_xml if refresh_cache || !xml_file? # Import version self.ontology.import_version self, self.user @@ -42,5 +40,13 @@ update_state! :done end end + + # generate XML by passing the raw ontology to Hets + def generate_xml + path = Hets.parse(raw_path!, ontology.repository.url_maps, File.dirname(xml_path)) + + # move generated file to destination + File.rename path, xml_path + end end
Use cached output from hets, if possible. solves #629
diff --git a/app/models/repository_tree_resolver.rb b/app/models/repository_tree_resolver.rb index abc1234..def5678 100644 --- a/app/models/repository_tree_resolver.rb +++ b/app/models/repository_tree_resolver.rb @@ -0,0 +1,95 @@+class RepositoryTreeResolver + attr_accessor :project_names + attr_accessor :license_names + attr_accessor :tree + + def initialize(repository, date = nil) + @repository = repository + @manifests = repository.manifests.kind('manifest') + @project_names = [] + @license_names = [] + @tree = nil + @date = date + end + + def platforms + @platforms ||= @manifests.pluck(:platform).map(&:downcase).uniq.select do |platform| + package_manager = PackageManager::Base.platforms.find{|pm| pm.formatted_name.downcase == platform } + package_manager && package_manager::HAS_VERSIONS # can only resolve trees for platforms with versions + end + end + + def tree + @tree ||= load_dependencies_tree + end + + def load_dependencies_tree + tree_data = Rails.cache.fetch cache_key, :expires_in => 1.day, race_condition_ttl: 2.minutes do + generate_dependency_tree + end + + @project_names = tree_data[:project_names] + @license_names = tree_data[:license_names] + @tree = tree_data[:tree] + end + + private + + def generate_dependency_tree + { + tree: load_dependencies_for_platforms, + project_names: project_names, + license_names: license_names + } + end + + def load_dependencies_for_platforms + tree = {} + platforms.map do |platform| + manifests = @manifests.select{|m| m.platform.downcase == platform } + + dependencies = [] + manifests.each do |manifest| + manifest.repository_dependencies.each do |repository_dependency| + dependencies << repository_dependency + end + end + # resolve tree for each platform + versions = dependencies.map(&:latest_resolvable_version) + + tree[platform] = versions.map{|version| load_dependencies_for(version, nil, 'normal', 0) } + end + tree + end + + + def load_dependencies_for(version, dependency, kind, index) + if version + @license_names << version.project.try(:normalize_licenses) + kind = index.zero? ? kind : 'normal' + dependencies = version.dependencies.kind(kind).includes(project: :versions).limit(100).order(:project_name) + { + version: version, + dependency: dependency, + requirements: dependency.try(:requirements), + dependencies: dependencies.map do |dep| + if dep.project && !@project_names.include?(dep.project_name) + @project_names << "#{dep.platform}/#{dep.project_name}" + index < 10 ? load_dependencies_for(dep.latest_resolvable_version(@date), dep, kind, index + 1) : ['MORE'] + else + { + version: dep.latest_resolvable_version(@date), + requirements: dep.try(:requirements), + dependency: dep, + dependencies: [] + } + end + end + } + end + end + + def cache_key + ['repository_tree', @repository, @kind, @date].compact + end +end
Add repository tree resolver class
diff --git a/lib/json_test_data/json_schema.rb b/lib/json_test_data/json_schema.rb index abc1234..def5678 100644 --- a/lib/json_test_data/json_schema.rb +++ b/lib/json_test_data/json_schema.rb @@ -51,14 +51,14 @@ end def generate_array(object) - return [] unless object.fetch(:items).has_key?(:type) + return [] unless (items = object.fetch(:items)).has_key?(:type) - val = if is_object?(object.fetch(:items)) - generate_object(object.fetch(:items)) - elsif is_array?(object.fetch(:items)) - generate_array(object.fetch(:items)) + val = if is_object?(items) + generate_object(items) + elsif is_array?(items) + generate_array(items) else - object_of_type(object.fetch(:items).fetch(:type)) + object_of_type(items.fetch(:type)) end [val].compact
Use local variable instead of method chain
diff --git a/lib/spree_store_credits/engine.rb b/lib/spree_store_credits/engine.rb index abc1234..def5678 100644 --- a/lib/spree_store_credits/engine.rb +++ b/lib/spree_store_credits/engine.rb @@ -16,5 +16,9 @@ end config.to_prepare &method(:activate).to_proc + + initializer "spree.gateway.payment_methods", :after => "spree.register.payment_methods" do |app| + app.config.spree.payment_methods << Spree::PaymentMethod::StoreCredit + end end end
Add store credit to list of payment_methods. This will currently cause issues if you attempt to save the store credit payment method in the Spree admin interface because the gateway is not in the list of available payment methods. It will default the store credit payment method to the first payment method in the list, save with that, and now allow you to change it back, thereby breaking everything!
diff --git a/lib/netzke/communitypack/action_column.rb b/lib/netzke/communitypack/action_column.rb index abc1234..def5678 100644 --- a/lib/netzke/communitypack/action_column.rb +++ b/lib/netzke/communitypack/action_column.rb @@ -13,22 +13,27 @@ def augment_column_config(c) if c[:type] == :action c.xtype = :netzkeactioncolumn + c[:getter] = lambda do |r| - c.actions.map do |a| - a = {name: a} if a.is_a?(Symbol) - a.tap do |a| - a[:tooltip] ||= a[:name].to_s.humanize - a[:icon] ||= a[:name].to_sym - a[:handler] ||= "on_#{a[:name]}" - - a[:icon] = "#{Netzke::Core.icons_uri}/#{a[:icon]}.png" if a[:icon].is_a?(Symbol) - end - end.to_nifty_json + c.actions.map {|a| build_action_config(a)}.netzke_jsonify.to_json end end super end + + private + + def build_action_config(a) + a = {name: a} if a.is_a?(Symbol) + a.tap do |a| + a[:tooltip] ||= a[:name].to_s.humanize + a[:icon] ||= a[:name].to_sym + a[:handler] ||= "on_#{a[:name]}" + + a[:icon] = "#{Netzke::Core.icons_uri}/#{a[:icon]}.png" if a[:icon].is_a?(Symbol) + end + end end end end
Update ActionColumn to work with latest Core
diff --git a/CoreData-Views-Collection-ios.podspec b/CoreData-Views-Collection-ios.podspec index abc1234..def5678 100644 --- a/CoreData-Views-Collection-ios.podspec +++ b/CoreData-Views-Collection-ios.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CoreData-Views-Collection-ios" - s.version = "0.0.25" + s.version = "0.0.26" s.summary = "Collection of Core Data based Cocoa Touch views base classes" s.description = <<-DESC Cocoa Touch view controller classes based/inspired by Stanford CS193p examples
Change podspec version to 0.0.26
diff --git a/samples/04-encode-job-with-status.rb b/samples/04-encode-job-with-status.rb index abc1234..def5678 100644 --- a/samples/04-encode-job-with-status.rb +++ b/samples/04-encode-job-with-status.rb @@ -0,0 +1,46 @@+#!/usr/bin/env ruby +require 'azure_media_service' + +# initialize +AzureMediaService.configure do |config| + # Media Service Account Name + config.id = 'wiprolimited' + # Media Service Access Key + config.secret = 'robpEX8IQjir0wZEcFGo+Xp+H2GhazBTa9te3yM8+RQ=' +end + +# Test files located at +# => http://download.wavetlan.com/SVV/Media/HTTP/http-mp4.htm + +# Download test file in sample directory +# wget http://download.wavetlan.com/SVV/Media/HTTP/H264/Talkinghead_Media/H264_test3_Talkingheadclipped_mp4_480x360.mp4 + +# If missing wget, brew install wget. +# To install brew: http://brew.sh/ + +media_file_name = 'H264_test3_Talkingheadclipped_mp4_480x360.mp4' + +# Upload file +asset = AzureMediaService::Asset.create('asset_name') +asset.upload(media_file_name) + +job = asset.encode_job('H264 Broadband 1080p') + +@request = AzureMediaService.request + +# The State of the job. This is an aggregate of the Tasks state. If one Task fails, this property would be set to Failed. Valid values are: + +# Queued = 0 +# Scheduled = 1 +# Processing = 2 +# Finished = 3 +# Error = 4 +# Canceled = 5 +# Canceling = 6 + +while true + res = @request.get('Jobs') + state = res['d']['results'].find{|entry| entry['Id'] == job['Id'] }['State'] + p [Time.now, state] + break if state == 3 +end
Create a sample that encodes a job and checks for status.
diff --git a/lib/discordrb/events/message.rb b/lib/discordrb/events/message.rb index abc1234..def5678 100644 --- a/lib/discordrb/events/message.rb +++ b/lib/discordrb/events/message.rb @@ -20,6 +20,33 @@ end def match(event) + # Check for the proper event type + return false unless event.is_a? MessageEvent + + return [ + matches_all(@attributes[:starting_with], event.content) { |a,e| e.start_with? a }, + matches_all(@attributes[:ending_with], event.content) { |a,e| e.end_with? a }, + matches_all(@attributes[:containing], event.content) { |a,e| e.include? a }, + matches_all(@attributes[:in], event.channel) do |a,e| + if a.is_a? String + a == e.name + elsif a.is_a? Fixnum + a == e.id + else + a == e + end + end, + matches_all(@attributes[:from], event.author) do |a,e| + if a.is_a? String + a == e.name + elsif a.is_a? Fixnum + a == e.id + else + a == e + end + end, + matches_all(@attributes[:with_text], event.content) { |a,e| e == a } + ].reduce(false, &:|) end end end
Add matching logic for MessageEventHandler
diff --git a/has_breadcrumb.gemspec b/has_breadcrumb.gemspec index abc1234..def5678 100644 --- a/has_breadcrumb.gemspec +++ b/has_breadcrumb.gemspec @@ -12,6 +12,8 @@ gem.summary = %q{Provide links for the current page in a breadcrumb format.} gem.homepage = "" + gem.add_development_dependency "rake" + gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
Add development dependency for 'rake'
diff --git a/spec/github_cli/api/configure_spec.rb b/spec/github_cli/api/configure_spec.rb index abc1234..def5678 100644 --- a/spec/github_cli/api/configure_spec.rb +++ b/spec/github_cli/api/configure_spec.rb @@ -13,7 +13,7 @@ it { expect(subject.adapter).to eql(:net_http) } - it { expect(subject.ssl).to eql({}) } + it { expect(subject.ssl).to include(:ca_file) } it { expect(subject.site).to eql('https://github.com') }
Change to fix config option
diff --git a/week-6/nested_data_solution.rb b/week-6/nested_data_solution.rb index abc1234..def5678 100644 --- a/week-6/nested_data_solution.rb +++ b/week-6/nested_data_solution.rb @@ -0,0 +1,99 @@+# RELEASE 2: NESTED STRUCTURE GOLF +# Hole 1 +# Target element: "FORE" + +array = [[1,2], ["inner", ["eagle", "par", ["FORE", "hook"]]]] + +# attempts: +# ============================================================ +#p array[1][2][0] + +#p array[1][2][0].to_s + +# p array[1][1][2][0] + +# ============================================================ + +# Hole 2 +# Target element: "congrats!" + +hash = {outer: {inner: {"almost" => {3 => "congrats!"}}}} + +# attempts: +# ============================================================ + +# p hash[outer:[inner:["almost"[3]]]] + +# p hash[outer:[inner:["almost"][3]]] + +# p hash[outer:{inner: {"almost" => {3 => "congrats!"}}}] + +#p hash[outer:] + +# p hash[:outer][:inner]["almost"][3] + +# ============================================================ + +# Hole 3 +# Target element: "finished" + +nested_data = {array: ["array", {hash: "finished"}]} + +# attempts: +# ============================================================ +# p nested_data[:array][1][:hash] + +# ============================================================ + +# RELEASE 3: ITERATE OVER NESTED STRUCTURES + +number_array = [5, [10, 15], [20,25,30], 35] + + +# for i in 0..number_array.length-1 +# number_array[i]+=5 +# end +# p number_array + +# number_array.each do |element| +# if element.kind_of?(Array) +# number_array[] element.each {|inner| inner +=5} +# else +# element +=5 +# end +# end + +number_array.each_with_index do |element, index| + if element.kind_of?(Array) + element.each_with_index do |inner, index| + element[index] +=5 + end + else + number_array[index] +=5 + end +end + +# p number_array + + + +# Bonus: + +startup_names = ["bit", ["find", "fast", ["optimize", "scope"]]] +startup_names.each_with_index do |element, index| + if element.kind_of?(Array) + element.each_with_index do |inner, index| + if inner.kind_of?(Array) + inner.each_with_index do |value, idx| + inner[idx] = value + "ly" + end + else + element[index] = inner + "ly" + end + end + else + startup_names[index] = element + "ly" + end +end + +# p startup_names
Complete 6.5 code, need to do reflection
diff --git a/Casks/anvil.rb b/Casks/anvil.rb index abc1234..def5678 100644 --- a/Casks/anvil.rb +++ b/Casks/anvil.rb @@ -2,7 +2,7 @@ version '2016-02-24_11-50-56' sha256 'a4ddaa21b8c5b52b2a21620253aba64546f565e944b76e43c052c7a022007749' - # amazonaws.com is the official download host as per the vendor homepage + # amazonaws.com/sparkler_versions was verified as official when first introduced to the cask url "https://s3.amazonaws.com/sparkler_versions/versions/uploads/000/000/129/original/Anvil_#{version}.zip" appcast 'https://sparkler.herokuapp.com/apps/3/updates.xml', checkpoint: '49b49d5f4279c590477d7393207d26a2ca2c908527e12b0fd150a68790590b90'
Fix `url` stanza comment for Anvil.
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -14,7 +14,9 @@ if ENV[ 'COVERAGE' ] require 'simplecov' - SimpleCov.start + SimpleCov.start do + add_filter 'bundler' + end end # Setup helpers.
Exclude bundled gems from coverage reports.
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -7,11 +7,6 @@ require 'active_support/test_case' require 'webmock' require 'rr' - -begin - require 'redgreen' -rescue LoadError -end WebMock.disable_net_connect!
Remove redgreen for Ruby 1.9 compatibility http://isitruby19.com/redgreen
diff --git a/ci_environment/riak/attributes/dpkg.rb b/ci_environment/riak/attributes/dpkg.rb index abc1234..def5678 100644 --- a/ci_environment/riak/attributes/dpkg.rb +++ b/ci_environment/riak/attributes/dpkg.rb @@ -1,4 +1,4 @@ default["riak"]["package"]["name"] = "riak" -default["riak"]["package"]["version"] = "2.0.0rc1" +default["riak"]["package"]["version"] = "2.0.0" -default["riak"]["package"]["url"] = "http://s3.amazonaws.com/downloads.basho.com/riak/2.0/2.0.0rc1/ubuntu/trusty/riak_2.0.0rc1-1_amd64.deb" +default["riak"]["package"]["url"] = "http://s3.amazonaws.com/downloads.basho.com/riak/2.0/2.0.0/ubuntu/trusty/riak_2.0.0-1_amd64.deb"
Update Riak to 2.0.0 release
diff --git a/test/asciidoc_test.rb b/test/asciidoc_test.rb index abc1234..def5678 100644 --- a/test/asciidoc_test.rb +++ b/test/asciidoc_test.rb @@ -12,5 +12,7 @@ def test_is_section_heading assert @doc.send(:is_section_heading?, "AsciiDoc Home Page", "==================") + assert @doc.send(:is_section_heading?, "=== AsciiDoc Home Page") end + end
Add test for other form of section heading
diff --git a/config/initializers/search_callback.rb b/config/initializers/search_callback.rb index abc1234..def5678 100644 --- a/config/initializers/search_callback.rb +++ b/config/initializers/search_callback.rb @@ -8,7 +8,11 @@ if update_search Rails.logger.info "Registering search observer for artefacts" - Panopticon::Application.config.mongoid.observers << :update_search_observer + # Use to_prepare so this gets reloaded with the app when in development + # In production, it will only be called once + ActionDispatch::Callbacks.to_prepare do + Panopticon::Application.config.mongoid.observers << :update_search_observer + end else Rails.logger.info "In development/test mode: not registering search observer" end
Fix the observer initialiser for development mode. As models get reloaded on every request in development mode, these callbacks were running unpredictably, depending on how many requests had been made.