diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/integration/business_stage_page_spec.rb b/spec/integration/business_stage_page_spec.rb index abc1234..def5678 100644 --- a/spec/integration/business_stage_page_spec.rb +++ b/spec/integration/business_stage_page_spec.rb @@ -17,6 +17,7 @@ 'Pre-start', 'Start-up', 'Grow and sustain', + 'Exiting a business' ]) page.should have_button("Next step") @@ -44,6 +45,7 @@ 'Pre-start', 'Start-up', 'Grow and sustain', + 'Exiting a business' ], :selected => 'Grow and sustain') end end
Add new facet value to test
diff --git a/spec/integration/template_attributes_spec.rb b/spec/integration/template_attributes_spec.rb index abc1234..def5678 100644 --- a/spec/integration/template_attributes_spec.rb +++ b/spec/integration/template_attributes_spec.rb @@ -0,0 +1,45 @@+require "spec_helper" +require "flex_commerce_api" +require "flex_commerce_api/api_base" + +RSpec.describe "url encoding on any model" do + # Global context for all specs - defines things you dont see defined in here + # such as flex_root_url, api_root, default_headers and page_size + # see api_globals.rb in spec/support for the source code + include_context "global context" + + let(:subject_class) do + MetaAttributableClass = Class.new(FlexCommerceApi::ApiBase) do + end + end + + before(:each) do + stub_request(:get, /\/template_attributable_classes\/slug:my_slug\.json_api$/).to_return do |req| + { body: example_data.to_json, headers: default_headers, status: 200 } + end + end + + context 'with template data' do + let!(:example_data) do + { + data: { + id: "1", + type: "template_attributable_class", + attributes: { + template_attributes: { foo: { value: "bar", data_type: "text" } } + } + } + } + end + + let(:result) { subject_class.find("slug:my_slug") } + + it 'allows get by template attribute method' do + expect(result.template_attribute(:foo)).to eq "bar" + end + + it 'does not allow get by direct reference to attribute' do + expect(result.foo).to eq nil + end + end +end
Add tests for `template_attribute` retrieval
diff --git a/tasks/metrics/mutant.rake b/tasks/metrics/mutant.rake index abc1234..def5678 100644 --- a/tasks/metrics/mutant.rake +++ b/tasks/metrics/mutant.rake @@ -8,8 +8,8 @@ task :mutant => :coverage do project = Devtools.project config = project.mutant - cmd = %[mutant -r ./spec/spec_helper.rb "::#{config.namespace}" --rspec-dm2] - Kernel.system(cmd) or raise 'Mutant task is not successful' + cmd = %W[mutant -r ./spec/spec_helper.rb "::#{config.namespace}" --rspec-dm2] + system(*cmd) or raise 'Mutant task is not successful' end else desc 'Run Mutant'
Change system command to use an Array as input * This causes the arguments to be escaped automatically, preventing shell injection (not a huge risk in this case, but may prevent some kinds of errors; I wish this was the default interface).
diff --git a/spec/consul_daemon_dev_spec.rb b/spec/consul_daemon_dev_spec.rb index abc1234..def5678 100644 --- a/spec/consul_daemon_dev_spec.rb +++ b/spec/consul_daemon_dev_spec.rb @@ -15,12 +15,18 @@ describe file('/var/log/consul/stdout.log') do its(:content) { should match /Consul agent running/ } + it { should be_owned_by ENV['CONSUL_OWNER'] } + it { should be_grouped_into ENV['CONSUL_GROUP'] } end describe file('/var/log/consul/stderr.log') do its(:size) { should eq 0 } + it { should be_owned_by ENV['CONSUL_OWNER'] } + it { should be_grouped_into ENV['CONSUL_GROUP'] } end describe file('/var/run/consul/consul.pid') do it { should be_file } + it { should be_owned_by ENV['CONSUL_OWNER'] } + it { should be_grouped_into ENV['CONSUL_GROUP'] } end
Add specs to check that consul owner runs daemon.
diff --git a/spec/features/redshift_spec.rb b/spec/features/redshift_spec.rb index abc1234..def5678 100644 --- a/spec/features/redshift_spec.rb +++ b/spec/features/redshift_spec.rb @@ -9,6 +9,7 @@ end it "inserts new record" do + DB.drop_table? :items DB.create_table :items do primary_key :id column :name, 'varchar(255)'
Drop test table if exists
diff --git a/spec/tok/configuration_spec.rb b/spec/tok/configuration_spec.rb index abc1234..def5678 100644 --- a/spec/tok/configuration_spec.rb +++ b/spec/tok/configuration_spec.rb @@ -1,6 +1,5 @@ describe Tok::Configuration do before :all do - User = Class.new Account = Class.new end
Remove User object (not necessary as User is defined elsewhere now)
diff --git a/cookbooks/ruby/recipes/linux.rb b/cookbooks/ruby/recipes/linux.rb index abc1234..def5678 100644 --- a/cookbooks/ruby/recipes/linux.rb +++ b/cookbooks/ruby/recipes/linux.rb @@ -16,7 +16,7 @@ # On all linux installations, add in this rpath so that our # libraries can be accessed when called from the `ruby` # binary. - env_vars["LDFLAGS"] = "-Wl,-rpath,$ORIGIN/../lib" + env_vars["LD_RUN_PATH"] = "\$ORIGIN/../lib" end util_autotools "ruby" do
Linux: Use the proper Ruby rpath This fixes a major issue where Ruby would get a bogus Rpath value (see https://github.com/mitchellh/vagrant/issues/850#issuecomment-6263739). This bogus value would cause compiled extensions to have a bogus rpath value (see https://github.com/mitchellh/vagrant/issues/850#issuecomment-5541549). This bogus rpath value would cause the extensions to not load properly. This patch uses LD_RUN_PATH, which is an environmental variable that absolutely sets the rpath of the binary it is compiling. LD_RUN_PATH is set absolutely to only the ${ORIGIN}/../lib, which is the correct value and gets rid of the bogus values.
diff --git a/test/filmbuff/test_filmbuff_imdb.rb b/test/filmbuff/test_filmbuff_imdb.rb index abc1234..def5678 100644 --- a/test/filmbuff/test_filmbuff_imdb.rb +++ b/test/filmbuff/test_filmbuff_imdb.rb @@ -38,8 +38,8 @@ describe 'when only returning popular titles' do before do - @title = @imdb.find_by_title 'The Wizard of Oz', - types: %w(title_popular) + @title = @imdb.find_by_title('The Wizard of Oz', + types: %w(title_popular)) end it 'returns the 1939 version' do
Add parentheses to method call
diff --git a/test/spec_session_abstract_session_hash.rb b/test/spec_session_abstract_session_hash.rb index abc1234..def5678 100644 --- a/test/spec_session_abstract_session_hash.rb +++ b/test/spec_session_abstract_session_hash.rb @@ -37,5 +37,9 @@ it "works with a block" do assert_equal :default, hash.fetch(:unkown) { :default } end + + it "it raises when fetching unknown keys without defaults" do + lambda { hash.fetch(:unknown) }.must_raise KeyError + end end end
Add test for fetching unknown keys without defaults
diff --git a/app/controllers/renalware/pathology/observations_controller.rb b/app/controllers/renalware/pathology/observations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/renalware/pathology/observations_controller.rb +++ b/app/controllers/renalware/pathology/observations_controller.rb @@ -18,7 +18,7 @@ def description_codes [ - "HGB", "MCV", "MCH", "RETA", "HYPO", "WBC", "LYM", "NEUT", "PLT", + "HGB", "MCV", "MCH", "HYPO", "WBC", "LYM", "NEUT", "PLT", "RETA", "ESR", "CRP", "FER", "FOL", "B12", "URE", "CRE", "EGFR", "NA", "POT", "BIC", "CCA", "PHOS", "PTHI", "TP", "GLO", "ALB", "URAT", "BIL", "ALT", "AST", "ALP", "GGT", "BGLU", "HBA", "HBAI", "CHOL", "HDL",
Move 'RETA' display after 'PLT' to remove gap
diff --git a/db/seeds/routes_from_varnish.rb b/db/seeds/routes_from_varnish.rb index abc1234..def5678 100644 --- a/db/seeds/routes_from_varnish.rb +++ b/db/seeds/routes_from_varnish.rb @@ -12,7 +12,6 @@ backends = [ 'canary-frontend', 'licensify', - 'spotlight', 'tariff', 'transactions-explorer', ] @@ -32,8 +31,6 @@ %w(/performance/transactions-explorer prefix transactions-explorer), - %w(/performance prefix spotlight), - %w(/__canary__ exact canary-frontend), ]
Remove seeding of /performance route. This is now handled by the application itself at deploy time.
diff --git a/app/controllers/flag_log_controller.rb b/app/controllers/flag_log_controller.rb index abc1234..def5678 100644 --- a/app/controllers/flag_log_controller.rb +++ b/app/controllers/flag_log_controller.rb @@ -1,5 +1,6 @@ class FlagLogController < ApplicationController def index - @flag_logs = FlagLog.all.order('created_at DESC').includes(:post, :user).paginate(:page => params[:page], :per_page => 100) + @flag_logs = FlagLog.all.order('created_at DESC').includes(:post => [:feedbacks => [:user, :api_key]]).includes(:user).paginate(:page => params[:page], :per_page => 100) + @sites = Site.where(:id => @flag_logs.map(&:post).map(&:site_id)).to_a end end
Speed up prettier flag log view
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index abc1234..def5678 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -27,6 +27,7 @@ def user_params params.require(:user).permit(:bio, :gender, :ethnicity, :country, :name, :email, :password, :password_confirmation, + :github_account, :twitter_account, teammates_attributes: [:id, :notification_preference]) end
Allow updating your GitHub and Twitter account
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index abc1234..def5678 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -1,5 +1,6 @@ class ProfilesController < ApplicationController - authorize_resource :class => false + skip_authorization_check + before_filter :authenticate_user! layout 'profile'
Fix 2647: normal user is able to see profile
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index abc1234..def5678 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -2,4 +2,8 @@ def show @project = Project.find params[:id] end + + def index + @projects = Project.all + end end
Add index action on projects controller
diff --git a/app/controllers/zipcodes_controller.rb b/app/controllers/zipcodes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/zipcodes_controller.rb +++ b/app/controllers/zipcodes_controller.rb @@ -4,11 +4,12 @@ class ZipcodesController < ApplicationController def show @zipcode = session[:zip] - @polling_place = get_polling_place(@zipcode) + @polling_place = get_polling_place(address) end def self.get_polling_place(address) uri = URI.parse("https://www.googleapis.com/civicinfo/v2/voterinfo?key=#{ENV['API_KEY']}&address=#{address.gsub(' ', '%20')}&electionId=2000") - @response = JSON.parse(Net::HTTP.get(uri)) - @response['pollingLocations'] + response = JSON.parse(Net::HTTP.get(uri)) + return response['pollingLocations'][0] if response.length > 1 + {'locationName' => 'Sorry, we can\'t find a polling place for your location at this time. Please try a different address or check back closer to election day.'} end end
Add not found message to polling place method
diff --git a/lib/epub/constants.rb b/lib/epub/constants.rb index abc1234..def5678 100644 --- a/lib/epub/constants.rb +++ b/lib/epub/constants.rb @@ -7,7 +7,8 @@ 'xhtml' => 'http://www.w3.org/1999/xhtml', 'epub' => 'http://www.idpf.org/2007/ops', 'm' => 'http://www.w3.org/1998/Math/MathML', - 'svg' => 'http://www.w3.org/2000/svg' + 'svg' => 'http://www.w3.org/2000/svg', + 'smil' => 'http://www.w3.org/ns/SMIL' } module MediaType
Add XML namespace for SMIL
diff --git a/lib/tasks/deploy.rake b/lib/tasks/deploy.rake index abc1234..def5678 100644 --- a/lib/tasks/deploy.rake +++ b/lib/tasks/deploy.rake @@ -3,7 +3,7 @@ set :owned_by_user, 'app' set :owned_by_group, 'deploy' set :release_paths_to_be_owned_by_app, '.' - set :shared_paths_to_be_owned_by_app, 'log pids tmp' + set :shared_paths_to_be_owned_by_app, '.' end end
Revert back to default of whole directory
diff --git a/lib/tasks/lucene.rake b/lib/tasks/lucene.rake index abc1234..def5678 100644 --- a/lib/tasks/lucene.rake +++ b/lib/tasks/lucene.rake @@ -2,8 +2,8 @@ namespace :couch do desc "Load views in db/couch/* into the configured couchdb instance" - task :migrate do - Dir['db/couch/**/*.js'].each do |file| + task :migrate => :environment do + Dir["db/couch/**/*.js"].each do |file| source = File.read(file). gsub(/\n\s*/, ''). # Our JS multiline string implementation :-p gsub(/\/\*.*?\*\//, '') # And strip multiline comments as well.
Load the environment from the migrate rake task
diff --git a/lib/yandex_captcha.rb b/lib/yandex_captcha.rb index abc1234..def5678 100644 --- a/lib/yandex_captcha.rb +++ b/lib/yandex_captcha.rb @@ -18,8 +18,6 @@ yield(config) end - private - # Gives access to the current Configuration. def self.configuration @configuration ||= Configuration.new
Fix private bug in main module
diff --git a/test/integration/test_database_result_set.rb b/test/integration/test_database_result_set.rb index abc1234..def5678 100644 --- a/test/integration/test_database_result_set.rb +++ b/test/integration/test_database_result_set.rb @@ -0,0 +1,55 @@+require 'helper' + +class IntegrationTests::TestDatabaseResultSet < Test::Unit::TestCase + def setup + @dir = Dir.mktmpdir('linkage') + @data_uri = "sqlite://" + File.join(@dir, "foo") + @results_uri = "sqlite://" + File.join(@dir, "bar") + end + + def teardown + FileUtils.remove_entry_secure(@dir) + end + + def data_database(options = {}, &block) + Sequel.connect(@data_uri, options, &block) + end + + def results_database(options = {}, &block) + Sequel.connect(@results_uri, options, &block) + end + + test "using a database for storing results" do + data_database do |db| + db.create_table(:foo) { primary_key(:id); Integer(:foo); Integer(:bar) } + db[:foo].import([:id, :foo, :bar], Array.new(10) { |i| [i, i, i] }) + end + + ds = Linkage::Dataset.new(@data_uri, 'foo') + result_set = Linkage::ResultSet['database'].new(@results_uri) + conf = ds.link_with(ds, result_set) do |conf| + conf.compare([:foo], [:bar], :equal_to) + conf.algorithm = :mean + conf.threshold = 1 + end + runner = Linkage::SingleThreadedRunner.new(conf) + runner.execute + + results_database do |db| + assert db.table_exists?(:scores) + assert_equal 10, db[:scores].count + db[:scores].order(:id_1, :id_2).each do |row| + assert_equal row[:id_1], row[:id_2] + assert_equal 1, row[:comparator_id] + assert_same 1.0, row[:score] + end + + assert db.table_exists?(:matches) + assert_equal 10, db[:matches].count + db[:matches].order(:id_1, :id_2).each do |row| + assert_equal row[:id_1], row[:id_2] + assert_same 1.0, row[:score] + end + end + end +end
Add integration test for database result sets
diff --git a/git_evolution.gemspec b/git_evolution.gemspec index abc1234..def5678 100644 --- a/git_evolution.gemspec +++ b/git_evolution.gemspec @@ -18,7 +18,7 @@ spec.executables = Dir['bin/*'].map { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_development_dependency 'bundler', '~> 1.7' - spec.add_development_dependency 'rake', '~> 10.0' - spec.add_development_dependency 'rugged', '~> 0.21.4' + spec.add_dependency 'bundler', '~> 1.7' + spec.add_dependency 'rake', '~> 10.0' + spec.add_dependency 'rugged', '~> 0.21.4' end
Fix development dependencies to include bundle, rake and rugged
diff --git a/app/jobs/tabular_import_operation_job.rb b/app/jobs/tabular_import_operation_job.rb index abc1234..def5678 100644 --- a/app/jobs/tabular_import_operation_job.rb +++ b/app/jobs/tabular_import_operation_job.rb @@ -10,15 +10,15 @@ file: open_file(saved_upload.file) ) import.run - operation_failed(format_error_report(import.errors)) unless import.succeeded? + operation_failed(format_error_report(import.run_errors)) unless import.succeeded? end private - # turn the ActiveModel::Errors into a report in markdown format + # turn the import errors into a report in markdown format def format_error_report(errors) return if errors.empty? - errors.values.flatten.map { |error| "* #{error}" }.join("\n") + errors.map { |error| "* #{error}" }.join("\n") end def open_file(file)
9991: Use new run_errors instead of old errors
diff --git a/app/models/state_machines/candidature.rb b/app/models/state_machines/candidature.rb index abc1234..def5678 100644 --- a/app/models/state_machines/candidature.rb +++ b/app/models/state_machines/candidature.rb @@ -18,7 +18,7 @@ end event :deny do - transition :new => :denied + transition [:new, :accepted] => :denied end event :quit do
Allow deny from accepted state.
diff --git a/webdriver-firefox.gemspec b/webdriver-firefox.gemspec index abc1234..def5678 100644 --- a/webdriver-firefox.gemspec +++ b/webdriver-firefox.gemspec @@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__) require 'webdriver-firefox/version' -class RbConfig +module RbConfig class << self def files fnames = `git ls-files -- bin/* lib/*`.split("\n")
Change RbConfig from a class to a module
diff --git a/tools/scripts/jeprof/aggregate_profile.rb b/tools/scripts/jeprof/aggregate_profile.rb index abc1234..def5678 100644 --- a/tools/scripts/jeprof/aggregate_profile.rb +++ b/tools/scripts/jeprof/aggregate_profile.rb @@ -0,0 +1,49 @@+#! /usr/bin/ruby +require 'csv' + +PROFILE = ARGF.argv.shift +HEAP_INTERVAL = 250 + +aggregate = Hash.new {} + +CSV.foreach(PROFILE, {:headers => true}) do |row| + key =[[row["query"], row["sf"], row["prof_type"]]] + + unless aggregate.member? key + aggregate[key] = {} + end + + job = row["job"] + unless aggregate[key].member? job + aggregate[key][job] = {} + end + + peer_id = row["peer_id"] + + unless aggregate[key][job].member? peer_id + aggregate[key][job][peer_id] = [] + end + + row["value"] ||= "0.0" + + aggregate[key][job][peer_id] << [row["start_time"].to_i + row["seq_num"].to_i * HEAP_INTERVAL , row["value"].to_f] +end + +aggregate.each do |key, jobs| + jobs.each do |job_id, peers| + greatest_lower_bound = peers.values.collect(&:min).max.first + least_upper_bound = peers.values.collect(&:max).min.first + peers.each do |peer_id, seq| + seq.reject! do |s| + s.first < greatest_lower_bound || s.first > least_upper_bound + end + seq.collect! do |i| + i[1] + end + end + + head, *tail = peers.values + sum = head.zip(*tail).map { |z| z.compact.inject(&:+)} + p (key + [sum.max]) + end +end
Add script to aggregate-process heap file output.
diff --git a/jobs/regular/check_akismet_post.rb b/jobs/regular/check_akismet_post.rb index abc1234..def5678 100644 --- a/jobs/regular/check_akismet_post.rb +++ b/jobs/regular/check_akismet_post.rb @@ -14,7 +14,7 @@ return if ReviewableQueuedPost.exists?(target: post) client = Akismet::Client.build_client - DiscourseAkismet::PostsBouncer.new.check_for_spam(client, post) + DiscourseAkismet::PostsBouncer.new.perform_check(client, post) end end end
FIX: Call the correct post bouncer method
diff --git a/app/controllers/api/messages_controller.rb b/app/controllers/api/messages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/messages_controller.rb +++ b/app/controllers/api/messages_controller.rb @@ -20,7 +20,7 @@ methods = Doorkeeper.configuration.access_token_methods @token ||= Doorkeeper::OAuth::Token.authenticate request, *methods - account = Account.where(slug: params.fetch(:account)).first + account = Account.find_by(slug: params.fetch(:account)) email = Mail::Address.new params.fetch(:email) author = MessageAuthor.new(account, email)
Use shortcut method to find a single record
diff --git a/Casks/intellij-idea-eap.rb b/Casks/intellij-idea-eap.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea-eap.rb +++ b/Casks/intellij-idea-eap.rb @@ -1,8 +1,8 @@ cask :v1 => 'intellij-idea-eap' do - version '139.463.4' - sha256 '9c121f506136f9c658fe3246c6f69947d67184d523c8a3fdaf94e5065b80a918' + version '139.791.2' + sha256 'bb9859ab068360cefe2351c84b3c96653c7395351102e4ab03f2b7834753c0cb' - url "http://download.jetbrains.com/idea/ideaIU-#{version}.dmg" + url "http://download-cf.jetbrains.com/idea/ideaIU-#{version}.dmg" homepage 'https://confluence.jetbrains.com/display/IDEADEV/IDEA+14+EAP' license :commercial
Upgrade IntelliJ Idea EAP to v139.791.2
diff --git a/Casks/omnipresence-beta.rb b/Casks/omnipresence-beta.rb index abc1234..def5678 100644 --- a/Casks/omnipresence-beta.rb +++ b/Casks/omnipresence-beta.rb @@ -0,0 +1,13 @@+cask :v1 => 'omnipresence-beta' do + version '1.4.x-r232733' + sha256 'c21289a7a90b4efc8f0eb9cf3775bb4bb19145688229cd886718881b2c34377a' + + url "http://omnistaging.omnigroup.com/omnipresence/releases/OmniPresence-#{version}-Test.dmg" + name 'OmniPresence Beta' + homepage 'http://www.omnigroup.com/omnipresence' + license :commercial + + app 'OmniPresence.app' + + depends_on :macos => '>= :yosemite' +end
Add Omnipresence beta track (currently 1.4) This creates a new cask for the Omnipresence beta (at v1.4 at the time of creation).
diff --git a/Casks/intellij-idea-community-eap.rb b/Casks/intellij-idea-community-eap.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea-community-eap.rb +++ b/Casks/intellij-idea-community-eap.rb @@ -1,9 +1,9 @@ class IntellijIdeaCommunityEap < Cask - version '14' - sha256 'bcea58e2f59356e9b10e33d40adbcd7ec711bbd15c410d53f3a3695c517f2b67' + version '139.144.2' + sha256 '4f06f206d4e3435d0d2b2c803637db7645ab8c762fbdbd6038384971074e16b8' - url "http://download.jetbrains.com/idea/ideaIC-#{version}-PublicPreview.dmg" - homepage 'https://www.jetbrains.com/idea/index.html' + url "http://download.jetbrains.com/idea/ideaIC-#{version}.dmg" + homepage 'https://confluence.jetbrains.com/display/IDEADEV/IDEA+14+EAP' - app "IntelliJ IDEA #{version} CE EAP.app" + app 'IntelliJ IDEA 14 CE EAP.app' end
Upgrade IntelliJ CE EAP to 14 RC1 (139.144.2)
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index abc1234..def5678 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -12,3 +12,5 @@ ActiveSupport.on_load(:active_record) do self.include_root_in_json = false end + +ActiveResource::Base.include_root_in_json = true
Include root in ActiveResource JSON payloads, because Illyan expects it
diff --git a/cookbooks/wordpress/recipes/default.rb b/cookbooks/wordpress/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/wordpress/recipes/default.rb +++ b/cookbooks/wordpress/recipes/default.rb @@ -22,12 +22,10 @@ package "subversion" -package "php5" -package "php5-mysql" +package "php" +package "php-mysql" -package "php-apc" - -apache_module "php5" +apache_module "php7.0" apache_module "rewrite" fail2ban_filter "wordpress" do
Update wordpress cookbook for Ubuntu 16.04
diff --git a/MDCustomNotificationsManager.podspec b/MDCustomNotificationsManager.podspec index abc1234..def5678 100644 --- a/MDCustomNotificationsManager.podspec +++ b/MDCustomNotificationsManager.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MDCustomNotificationsManager" - s.version = "0.9.0" + s.version = "0.9.5" s.summary = "Display messages in a notification-like way" s.homepage = "https://github.com/MagicDealers/MDCustomNotificationsManager" s.screenshots = "http://s14.postimg.org/ydle62d0f/MDCNM.gif"
Increase pod version to 0.9.5.
diff --git a/lib/fubot/commands/fubot_who_is.rb b/lib/fubot/commands/fubot_who_is.rb index abc1234..def5678 100644 --- a/lib/fubot/commands/fubot_who_is.rb +++ b/lib/fubot/commands/fubot_who_is.rb @@ -7,7 +7,8 @@ user = args[1] values = KeyValue.get("Fubot:Whois:#{user}[]") if values.size > 0 - bot.reply "#{user} is: #{values.join(", ")}" + t = values.map { |v| m = v.split(":", 2); "#{m[1]} -- #{User.find(m[0].to_i).login}" }.join(", ") + bot.reply "#{user} is: #{t}" else bot.reply "I don't know anything about #{user}." end
Fix fubot who is command
diff --git a/lib/rubocop/ast/node/array_node.rb b/lib/rubocop/ast/node/array_node.rb index abc1234..def5678 100644 --- a/lib/rubocop/ast/node/array_node.rb +++ b/lib/rubocop/ast/node/array_node.rb @@ -29,9 +29,12 @@ # # @overload percent_literal? # Check for any percent literal. + # # @overload percent_literal?(type) # Check for percent literaly of type `type`. - # @param type [Symbol] an optional percent literal type + # + # @param type [Symbol] an optional percent literal type + # # @return [Boolean] whether the array is enclosed in percent brackets def percent_literal?(type = nil) if type
Fix overload documentation for ArrayNode
diff --git a/lib/tasks/email/notifications.rake b/lib/tasks/email/notifications.rake index abc1234..def5678 100644 --- a/lib/tasks/email/notifications.rake +++ b/lib/tasks/email/notifications.rake @@ -6,7 +6,7 @@ user_accounts.each do |account| days_before = account.reminder_days_before - date_to_compare = Date.today - days_before + date_to_compare = Date.today + days_before user_entries = account.entries.where(paid: false, date: date_to_compare, entries_type: :expense)
Fix date to search on entries notification
diff --git a/app/controllers/review_controller.rb b/app/controllers/review_controller.rb index abc1234..def5678 100644 --- a/app/controllers/review_controller.rb +++ b/app/controllers/review_controller.rb @@ -9,7 +9,7 @@ @posts = Post.all end - @posts = @posts.includes(:reasons).includes(:feedbacks).where( :feedbacks => { :post_id => nil }).order('created_at DESC').paginate(:page => params[:page], :per_page => 100) + @posts = @posts.includes(:reasons).includes(:feedbacks).where( :feedbacks => { :post_id => nil }).order('`posts`.`created_at` DESC').paginate(:page => params[:page], :per_page => 100) @sites = Site.where(:id => @posts.map(&:site_id)).to_a end
Fix ambiguous query cause by adding feedback timestamps
diff --git a/db/migrate/20150210115300_detoxify_yaml.rb b/db/migrate/20150210115300_detoxify_yaml.rb index abc1234..def5678 100644 --- a/db/migrate/20150210115300_detoxify_yaml.rb +++ b/db/migrate/20150210115300_detoxify_yaml.rb @@ -4,17 +4,44 @@ class Version < ActiveRecord::Base end + def clean_yaml(yaml) + yaml.gsub(/ !ruby\/object:Peoplefinder::ImageUploader::Uploader\d+/, '') + end + + def extract_url(image) + if image.respond_to?(:url) + image.url && File.basename(image.url) + else + image + end + end + + def clean_object_changes(version) + serialized = version.object_changes + return if serialized.blank? + + hash = YAML.load(clean_yaml(serialized)) + if hash.key?('image') + hash['image'].map! { |img| extract_url(img) } + version.update! object_changes: YAML.dump(hash) + end + end + + def clean_object(version) + serialized = version.object + return if serialized.blank? + + hash = YAML.load(clean_yaml(serialized)) + if hash.key?('image') + hash['image'] = extract_url(hash['image']) + version.update! object: YAML.dump(hash) + end + end + def up Version.all.each do |version| - serialized = version.object_changes - serialized.gsub!(/ !ruby\/object:Peoplefinder::ImageUploader::Uploader\d+/, '') - changes = YAML.load(serialized) - if changes.key?('image') - changes['image'].map! do |value| - value.url && File.basename(value.url) - end - end - version.update! object_changes: YAML.dump(changes) + clean_object_changes version + clean_object version end end end
Make the version YAML fix more robust * Don't try to correct new versions created after the code changed, i.e. where the image is already a string * Fix the 'object' field as well, which also contained broken YAML. * Don't try to fix blank YAML: if the event is destroy, then object_changes is nil.
diff --git a/app/controllers/user_actions_controller.rb b/app/controllers/user_actions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/user_actions_controller.rb +++ b/app/controllers/user_actions_controller.rb @@ -12,7 +12,7 @@ def assigned_to_group if current_user.group.nil? - redirect_to groups_assign + redirect_to groups_assign_path end end end
Fix bug in the redirect of the assigned_to_group method.
diff --git a/lib/ferrety_ferret.rb b/lib/ferrety_ferret.rb index abc1234..def5678 100644 --- a/lib/ferrety_ferret.rb +++ b/lib/ferrety_ferret.rb @@ -7,9 +7,18 @@ def initialize(params) clear_alerts + params = parse(params) end private + + def parse(params) + if params.is_a?(Hash) + params + else + JSON.parse(params) + end + end def add_alert(alert_text) @alerts << alert_text
Add acceptance of JSON and Hash params
diff --git a/lib/git_store/user.rb b/lib/git_store/user.rb index abc1234..def5678 100644 --- a/lib/git_store/user.rb +++ b/lib/git_store/user.rb @@ -1,12 +1,5 @@ class GitStore - - class User - attr_accessor :name, :email, :time - - def initialize(name, email, time) - @name, @email, @time = name, email, time - end - + class User < Struct.new(:name, :email, :time) def dump "#{ name } <#{email}> #{ time.to_i } #{ time.strftime('%z') }" end
Make User a Struct so it's faster and Comparable
diff --git a/lib/bummr/bisecter.rb b/lib/bummr/bisecter.rb index abc1234..def5678 100644 --- a/lib/bummr/bisecter.rb +++ b/lib/bummr/bisecter.rb @@ -6,7 +6,9 @@ puts "Bad commits found! Bisecting...".red system("bundle") - system("git bisect start head master") + system("git bisect start") + system("git bisect bad") + system("git bisect good master") Open3.popen2e("git bisect run #{TEST_COMMAND}") do |_std_in, std_out_err| while line = std_out_err.gets
Make bisect work with old git 1.9.1 I found that git version 1.9.1 under Debian wheezy does not like combining the bad & good commands into the bisect start command like so; git bisect start head master. It starts bisect correctly but it doesn't set the bad & good points.
diff --git a/lib/grape/kaminari.rb b/lib/grape/kaminari.rb index abc1234..def5678 100644 --- a/lib/grape/kaminari.rb +++ b/lib/grape/kaminari.rb @@ -1,4 +1,5 @@ require "grape/kaminari/version" +require "grape/kaminari/max_value_validator" require "kaminari/grape" module Grape @@ -17,12 +18,16 @@ end def self.paginate(options = {}) - options.reverse_merge!(per_page: 10) + options.reverse_merge!( + per_page: 10, + max_per_page: false + ) params do optional :page, type: Integer, default: 1, desc: 'Page offset to fetch.' optional :per_page, type: Integer, default: options[:per_page], - desc: 'Number of results to return per page.' + desc: 'Number of results to return per page.', + max_value: options[:max_per_page] end end end
Add max value validator to parameter
diff --git a/lib/layer/identity.rb b/lib/layer/identity.rb index abc1234..def5678 100644 --- a/lib/layer/identity.rb +++ b/lib/layer/identity.rb @@ -17,5 +17,10 @@ def self.url '/identity' end + + def attributes=(attributes) + attributes['metadata'] ||= {} + super + end end end
Make sure the metadata object is always present on Identity resources
diff --git a/lib/hn_history/app.rb b/lib/hn_history/app.rb index abc1234..def5678 100644 --- a/lib/hn_history/app.rb +++ b/lib/hn_history/app.rb @@ -2,8 +2,21 @@ require 'hn_history/api' require 'hn_history/web' +if ENV['RACK_ENV'] == "production" + require 'oboe' + require 'oboe/inst/rack' + + Oboe::Config[:tracing_mode] = 'through' + + Oboe::Ruby.initialize +end + def app Rack::Builder.app do + if ENV['RACK_ENV'] == "production" + use Oboe::Rack + end + use Rack::Session::Cookie run Rack::Cascade.new [HnHistory::BaseAPI, HnHistory::Web] end
Add Oboe in production environment
diff --git a/app/controllers/renalware/users_controller.rb b/app/controllers/renalware/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/renalware/users_controller.rb +++ b/app/controllers/renalware/users_controller.rb @@ -2,10 +2,6 @@ require_dependency "renalware" -# Note we rely on template inheritance with this MDM Base class i.e. subclasses (e.g. -# HD::MDMPatientsController) can override templates and partials (e.g. add a _filters partial -# or override the _patient partial to replace what is displayed in the table). -# Otherwise the default template location is of course app/views/renalware/mdm_patients. module Renalware class UsersController < BaseController include Pagy::Backend @@ -16,6 +12,7 @@ search = User .includes(:roles) .where.not(username: [:rwdev, :systemuser]) + .where(hidden: false) .ransack(query) pagy, users = pagy(search.result(distinct: true)) authorize users
Hide users marked as 'hidden' on the Renal -> Users list
diff --git a/lib/manbook/parser.rb b/lib/manbook/parser.rb index abc1234..def5678 100644 --- a/lib/manbook/parser.rb +++ b/lib/manbook/parser.rb @@ -10,7 +10,14 @@ # <h2>NAME</h2> # <p style="margin-left:11%; margin-top: 1em">git &minus; the stupid content tracker</p> # - title = Nokogiri::HTML(File.read(html_file)).xpath("//b[text() = 'NAME']/../following-sibling::p[1]/descendant-or-self::text()").to_s + doc = Nokogiri::HTML(File.read(html_file)) + + title = doc.xpath("//b[text() = 'NAME']/../following-sibling::p[1]/descendant-or-self::text()").to_s + + if title.empty? + title = doc.xpath("//h2[text() = 'NAME']/following-sibling::p[1]/descendant-or-self::text()").to_s + end + {:file_name => File.basename(html_file), :title => title} end end
Add title extraction for non-trivial HTML pages
diff --git a/lib/query_comments.rb b/lib/query_comments.rb index abc1234..def5678 100644 --- a/lib/query_comments.rb +++ b/lib/query_comments.rb @@ -5,6 +5,9 @@ module ActiveRecordInstrumentation def self.included(instrumented_class) + if defined? Rails.application + QueryComments.application_name = Rails.application.class.name.split("::").first + end instrumented_class.class_eval do alias_method :execute_without_query_comments, :execute alias_method :execute, :execute_with_query_comments
Set the application_name to the rails app name by default (in Rails 3)
diff --git a/lib/mrkt/concerns/connection.rb b/lib/mrkt/concerns/connection.rb index abc1234..def5678 100644 --- a/lib/mrkt/concerns/connection.rb +++ b/lib/mrkt/concerns/connection.rb @@ -11,9 +11,7 @@ conn.request :multipart conn.request :url_encoded - if @debug - conn.response :logger, @logger, (@log_options || {}) - end + conn.response :logger, @logger, (@log_options || {}) if @debug conn.response :mkto, content_type: /\bjson$/
Use modifier instead of a block
diff --git a/spec/controllers/api/api_controller_spec.rb b/spec/controllers/api/api_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/api/api_controller_spec.rb +++ b/spec/controllers/api/api_controller_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.describe API::APIController, type: :controller do - controller do + controller(API::APIController) do def good check_access!('permit') render nothing: true @@ -29,11 +29,11 @@ context 'after_action hook' do before do @routes.draw do - get '/anonymous/good' => 'anonymous#good' - get '/anonymous/bad' => 'anonymous#bad' - get '/anonymous/public' => 'anonymous#public' - get '/anonymous/failed' => 'anonymous#failed' - get '/anonymous/force_authn' => 'anonymous#force_authn' + get '/anonymous/good' => 'api/api#good' + get '/anonymous/bad' => 'api/api#bad' + get '/anonymous/public' => 'api/api#public' + get '/anonymous/failed' => 'api/api#failed' + get '/anonymous/force_authn' => 'api/api#force_authn' end end
Work around strange anonymous controller behaviour
diff --git a/lib/shoulda/matchers/routing.rb b/lib/shoulda/matchers/routing.rb index abc1234..def5678 100644 --- a/lib/shoulda/matchers/routing.rb +++ b/lib/shoulda/matchers/routing.rb @@ -1,7 +1,7 @@ module Shoulda module Matchers + # @private module Routing - # @private def route(method, path) ActionController::RouteMatcher.new(method, path, self) end
Hide Routing module in docs [ci skip]
diff --git a/lib/spontaneous/rack/helpers.rb b/lib/spontaneous/rack/helpers.rb index abc1234..def5678 100644 --- a/lib/spontaneous/rack/helpers.rb +++ b/lib/spontaneous/rack/helpers.rb @@ -13,7 +13,7 @@ end def script_list(scripts) - if Spontaneous.development? + # if Spontaneous.development? scripts.map do |script| src = "/js/#{script}.js" path = Spontaneous.application_dir(src) @@ -21,9 +21,9 @@ ["#{NAMESPACE}#{src}", size] # %(<script src="#{NAMESPACE}/js/#{script}.js" type="text/javascript"></script>) end.to_json - else + # else # script bundling + compression - end + # end end end end
Remove env test for scripts -- bundling etc should be done by gem creation process
diff --git a/lib/rohbau/runtime.rb b/lib/rohbau/runtime.rb index abc1234..def5678 100644 --- a/lib/rohbau/runtime.rb +++ b/lib/rohbau/runtime.rb @@ -44,7 +44,7 @@ end def terminate - # noop + terminate_plugins end def root @@ -63,5 +63,12 @@ end end + def terminate_plugins + self.class.plugins.each do |name, _| + plugin = public_send(name) + plugin.terminate if plugin.respond_to? :terminate + end + end + end end
Terminate plugins on Runtime termination
diff --git a/lib/video_transcoding/ffmpeg.rb b/lib/video_transcoding/ffmpeg.rb index abc1234..def5678 100644 --- a/lib/video_transcoding/ffmpeg.rb +++ b/lib/video_transcoding/ffmpeg.rb @@ -23,8 +23,6 @@ if output =~ /--enable-libfdk-aac/ properties[:aac_encoder] = 'libfdk_aac' - elsif output =~ /--enable-libfaac/ - properties[:aac_encoder] = 'libfaac' else properties[:aac_encoder] = 'aac' end
Remove support for FAAC from "FFmpeg" module.
diff --git a/app/models/metrics.rb b/app/models/metrics.rb index abc1234..def5678 100644 --- a/app/models/metrics.rb +++ b/app/models/metrics.rb @@ -18,7 +18,7 @@ return values end - scores = [] + scores = values repositories = Repository.all repositories.each do |repository| score = repository.send(metric)
Change source of scores for value normalization Instead of starting with an empty array for the normalization of metric scores, the array is initialized with the values passed to the method. This way exceptions can be prevented, if there are no scores available. Signed-off-by: Konrad Reiche <4ff0213f56e2082fcd8c882d04c546881c579ce4@gmail.com>
diff --git a/lib/chicago/etl/sequel/load_data_infile.rb b/lib/chicago/etl/sequel/load_data_infile.rb index abc1234..def5678 100644 --- a/lib/chicago/etl/sequel/load_data_infile.rb +++ b/lib/chicago/etl/sequel/load_data_infile.rb @@ -8,7 +8,7 @@ end def load_csv_infile_sql(filepath, columns) - "LOAD DATA INFILE '#{filepath}' REPLACE INTO TABLE `#{opts[:from]}` CHARACTER SET 'utf8' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\"' (`#{columns.join('`,`')}`);" + "LOAD DATA INFILE '#{filepath}' REPLACE INTO TABLE `#{opts[:from].first}` CHARACTER SET 'utf8' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\"' (`#{columns.join('`,`')}`);" end end end
Fix 1.9 bug with load_csv_infile. [:foo].to_s returns "foo" in ruby 1.8.7, but returns "[:foo]" in ruby 1.9.3. Take the first element of the opts[:from] array to fix this.
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.17.33" # Set the default client version -default[:chef][:client][:version] = "16.4.38" +default[:chef][:client][:version] = "16.5.64"
Update chef client to 16.5.64
diff --git a/cookbooks/otrs/attributes/default.rb b/cookbooks/otrs/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/otrs/attributes/default.rb +++ b/cookbooks/otrs/attributes/default.rb @@ -1,13 +1,13 @@ default[:otrs][:version] = "6.0.30" default[:otrs][:user] = "otrs" default[:otrs][:group] = nil -default[:otrs][:database_cluster] = "10/main" +default[:otrs][:database_cluster] = "13/main" default[:otrs][:database_name] = "otrs" default[:otrs][:database_user] = "otrs" default[:otrs][:database_password] = "otrs" default[:otrs][:site] = "otrs" -default[:postgresql][:versions] |= ["10"] +default[:postgresql][:versions] |= ["13"] default[:accounts][:users][:otrs][:status] = :role default[:accounts][:groups][:"www-data"][:members] = [:otrs]
Upgrade OTRS to postgres 13
diff --git a/lib/fabrication/generator/active_record.rb b/lib/fabrication/generator/active_record.rb index abc1234..def5678 100644 --- a/lib/fabrication/generator/active_record.rb +++ b/lib/fabrication/generator/active_record.rb @@ -8,8 +8,9 @@ method_name = method_name.to_s if block_given? options = args.first || {} - count = options[:count] || 0 unless options[:force] || instance.class.columns.map(&:name).include?(method_name) + count = options[:count] || 0 + # copy the original getter instance.instance_variable_set("@__#{method_name}_original", instance.method(method_name).clone)
Move count determination into block that uses it
diff --git a/lib/spiderfw/controller/page_controller.rb b/lib/spiderfw/controller/page_controller.rb index abc1234..def5678 100644 --- a/lib/spiderfw/controller/page_controller.rb +++ b/lib/spiderfw/controller/page_controller.rb @@ -21,9 +21,8 @@ end def init_template(path) - template = load_template(path) + template = super template.widgets = @widgets - template.init(@request, @scene) return template end
Fix for new template sintax
diff --git a/lib/dry/result_matcher/either_matcher.rb b/lib/dry/result_matcher/either_matcher.rb index abc1234..def5678 100644 --- a/lib/dry/result_matcher/either_matcher.rb +++ b/lib/dry/result_matcher/either_matcher.rb @@ -5,21 +5,21 @@ EitherMatcher = Dry::ResultMatcher::Matcher.new( success: Case.new( match: -> result, *pattern { - result = result.to_either if result.respond_to?(:to_either) + result = result.to_either result.right? }, resolve: -> result { - result = result.to_either if result.respond_to?(:to_either) + result = result.to_either result.value }, ), failure: Case.new( match: -> result, *pattern { - result = result.to_either if result.respond_to?(:to_either) + result = result.to_either result.left? }, resolve: -> result { - result = result.to_either if result.respond_to?(:to_either) + result = result.to_either result.value }, )
Remove EitherMatcher’s to_either respond_to checks We can just assume that this is a standard part of the interface for any object that this matcher works with.
diff --git a/lib/gitomator/github/tagging_provider.rb b/lib/gitomator/github/tagging_provider.rb index abc1234..def5678 100644 --- a/lib/gitomator/github/tagging_provider.rb +++ b/lib/gitomator/github/tagging_provider.rb @@ -0,0 +1,74 @@+require 'gitomator/github/base_hosting_provider' +require 'gitomator/model/hosting/repo' +require 'gitomator/model/hosting/team' + +module Gitomator + module GitHub + class TaggingProvider < BaseHostingProvider + + + def initialize(octokit_client) + @gh = octokit_client + end + + + def add_tags(repo_full_name, issue_or_pr_id, *tags) + @gh.add_labels_to_an_issue(repo_full_name, issue_or_pr_id, tags) + .map { |r| r.to_h } # Make the result a regular Ruby Hash + end + + def remove_tag(repo_full_name, id_or_name, tag) + @gh.remove_label(repo_full_name, id_or_name, tag) + .map { |r| r.to_h } # Make the result a regular Ruby Hash + end + + + # + # @return Enumerable of object identifiers. + # + def search(repo_full_name, label) + if query.is_a? String + q = "repo:#{repo_full_name} type:issue|pr label:\"#{label}\"" + @gh.search_issues(q) + .items.map {|item| item.number} # Make the result an array of issue/or id's + else + raise "Unimplemented! Search only supports a single tag at the moment." + end + + end + + + def metadata(repo_full_name, tag=nil) + if tag + begin + # Return metadata (Hash<Symbol,String>) + @gh.label(repo_full_name, tag).to_h + rescue Octokit::NotFound + return nil + end + + else + # Return Hash<String,Hash<Symbol,String>>, mapping tags to their metadata + @gh.labels(repo_full_name).map {|r| [r.name, r]}.to_h + end + end + + + + def set_metadata(repo_full_name, tag, metadata) + color = metadata[:color] || metadata['color'] + raise "The only supported metadata property is 'color'" if color.nil? + # TODO: Validate the color string (6-char-long Hex string. Any other formats supproted by GitHub?) + + if metadata(repo_full_name, tag).nil? + @gh.add_label(repo, tag, color).to_h + else + @gh.update_label(repo_full_name, tag, {:color => color}).to_h + end + + end + + + end + end +end
Add a GitHub tagging provider (can tag issues/pull-requests, and maintain tag metadata)
diff --git a/lib/peepshot/rails/helpers/image_tags.rb b/lib/peepshot/rails/helpers/image_tags.rb index abc1234..def5678 100644 --- a/lib/peepshot/rails/helpers/image_tags.rb +++ b/lib/peepshot/rails/helpers/image_tags.rb @@ -5,7 +5,7 @@ def peepshot_image_tag(url, options) width = find_width(options).to_s.downcase == 'original' ? 1024 : find_width(options) height = find_height(options) - image_tag(peepshot_url(url, options), :width => width, :height => height) + image_tag(peepshot_url(url, options), {:width => width, :height => height}.merge(options.except(:width, :height))) end end end
Allow for other image_tag options than width and heigt - for instance class, id, etc.
diff --git a/test/processors/instagram_processor_test.rb b/test/processors/instagram_processor_test.rb index abc1234..def5678 100644 --- a/test/processors/instagram_processor_test.rb +++ b/test/processors/instagram_processor_test.rb @@ -32,7 +32,7 @@ def test_ids result.value!.each do |entity| - expected_id = entity[1]['id'] + expected_id = entity[1]['shortcode'] assert(expected_id) assert(entity[0]) assert_equal(expected_id, entity[0])
Fix id expectation for IG processor test
diff --git a/minitest-tagz.gemspec b/minitest-tagz.gemspec index abc1234..def5678 100644 --- a/minitest-tagz.gemspec +++ b/minitest-tagz.gemspec @@ -23,7 +23,6 @@ spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "minitest" spec.add_development_dependency "guard" spec.add_development_dependency "guard-minitest" end
Fix gemspec minitest dependency discrepency
diff --git a/invariant.gemspec b/invariant.gemspec index abc1234..def5678 100644 --- a/invariant.gemspec +++ b/invariant.gemspec @@ -17,4 +17,5 @@ gem.require_paths = ["lib"] gem.add_development_dependency('rspec', "~> 2.12.0") + gem.add_development_dependency('rake') end
Add rake to development gemspec
diff --git a/kangaruby.gemspec b/kangaruby.gemspec index abc1234..def5678 100644 --- a/kangaruby.gemspec +++ b/kangaruby.gemspec @@ -20,4 +20,7 @@ spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" + spec.add_development_dependency "rspec" + spec.add_development_dependency "rubocop" + spec.add_development_dependency "yard" end
Add more required gems to the gemspec
diff --git a/lib/hpcloud/commands/containers/add.rb b/lib/hpcloud/commands/containers/add.rb index abc1234..def5678 100644 --- a/lib/hpcloud/commands/containers/add.rb +++ b/lib/hpcloud/commands/containers/add.rb @@ -8,7 +8,7 @@ or without the preceding colon: 'my_container' or ':my_container'. Examples: - hpcloud container:add :my_container # Creates a new container called 'my_container' + hpcloud containers:add :my_container # Creates a new container called 'my_container' Aliases: none DESC
Fix a typo in the example.
diff --git a/lib/infoblox/resource/host_ipv4addr.rb b/lib/infoblox/resource/host_ipv4addr.rb index abc1234..def5678 100644 --- a/lib/infoblox/resource/host_ipv4addr.rb +++ b/lib/infoblox/resource/host_ipv4addr.rb @@ -5,7 +5,9 @@ :mac, :network, :nextserver, - :use_nextserver + :use_nextserver, + :bootfile, + :use_bootfile remote_post_accessor :host
Add bootfile and use_bootfile to HostIpv4addr
diff --git a/lib/rails-footnotes/notes/view_note.rb b/lib/rails-footnotes/notes/view_note.rb index abc1234..def5678 100644 --- a/lib/rails-footnotes/notes/view_note.rb +++ b/lib/rails-footnotes/notes/view_note.rb @@ -12,7 +12,6 @@ def initialize(controller) @controller = controller - @template = controller.instance_variable_get(:@template) end def row
Remove variable for not having @template in controller
diff --git a/lib/solidus_paypal_braintree/engine.rb b/lib/solidus_paypal_braintree/engine.rb index abc1234..def5678 100644 --- a/lib/solidus_paypal_braintree/engine.rb +++ b/lib/solidus_paypal_braintree/engine.rb @@ -17,6 +17,8 @@ Rails.configuration.cache_classes ? require(c) : load(c) end end + + config.assets.precompile += ["spree/backend/solidus_paypal_braintree"] config.to_prepare(&method(:activate).to_proc)
Add backend JS to precompile list
diff --git a/lib/tasks/check_route_consistency.rake b/lib/tasks/check_route_consistency.rake index abc1234..def5678 100644 --- a/lib/tasks/check_route_consistency.rake +++ b/lib/tasks/check_route_consistency.rake @@ -1,7 +1,7 @@ require "route_consistency_checker" def report_errors(errors) - Airbrake.notify_sync( + GovukError.notify( "Inconsistent routes", parameters: { errors: errors,
Use GovukError instead of Airbrake
diff --git a/recipes/msys2/50-install-components.rake b/recipes/msys2/50-install-components.rake index abc1234..def5678 100644 --- a/recipes/msys2/50-install-components.rake +++ b/recipes/msys2/50-install-components.rake @@ -1,11 +1,15 @@-# Use one file out of many to indicate installation of devtools -self.devtools = File.join(self.sandboxdir, "/var/lib/pacman/local/mingw-w64-x86_64-gcc-6.3.0-3/desc") +self.devtools = File.join(thisdir, "devtools_installed") +# Use the cache of our main MSYS2 environment for package install +cachedir = File.join(Build.msys2_installation.msys_path, "/var/cache/pacman/pkg") file self.devtools => [self.sandboxdir] do |t| msys = RubyInstaller::Build::Msys2Installation.new(self.sandboxdir) msys.with_msys_apps_enabled do - sh "sh -lc 'pacman -Syu --noconfirm' # Update the package database and core system packages" - sh "sh -lc 'pacman -Su --noconfirm' # Update the rest" + # Update the package database and core system packages + sh "sh", "-lc", "pacman --cachedir=`cygpath -u #{cachedir.inspect}` -Syu --noconfirm" + # Update the rest + sh "sh", "-lc", "pacman --cachedir=`cygpath -u #{cachedir.inspect}` -Su --noconfirm" + # Install the development tools RubyInstaller::Build::ComponentsInstaller.new.install(%w[dev_tools]) end touch self.devtools
Use pacman cache of the main MSYS2 environment
diff --git a/lib/connection.rb b/lib/connection.rb index abc1234..def5678 100644 --- a/lib/connection.rb +++ b/lib/connection.rb @@ -11,13 +11,21 @@ def read(sensor) @socket.write("GET #{sensor}\n") result = @socket.readline.split(" ") - result[1].to_i + float_or_nil(result[1]) end def average(sensor, from, to) @socket.write("AVERAGE #{sensor} #{from} #{to}\n") result = @socket.readline.split(" ") - result[1].to_i + float_or_nil(result[1]) + end + + def float_or_nil(string) + begin + Float(string) + rescue ArgumentError, TypeError + nil + end end [:read, :average].each do |m|
Return nil when the resulting value is missing.
diff --git a/lib/decorators.rb b/lib/decorators.rb index abc1234..def5678 100644 --- a/lib/decorators.rb +++ b/lib/decorators.rb @@ -1,6 +1,5 @@ module Decorators require 'decorators/paths' - require 'decorators/railtie' class << self def load!(cache_classes) @@ -32,3 +31,5 @@ end end + +require 'decorators/railtie'
Fix require order (thank @spaceghost for finding this)
diff --git a/spec/rackstash/encoders/logstash_spec.rb b/spec/rackstash/encoders/logstash_spec.rb index abc1234..def5678 100644 --- a/spec/rackstash/encoders/logstash_spec.rb +++ b/spec/rackstash/encoders/logstash_spec.rb @@ -15,7 +15,7 @@ it 'formats the passed event hash as a JSON string and includes @version' do event = { 'hello' => 'world', 'message' => ["hello\n", "world"] } expect(encoder.encode(event)) - .to match /\A\{"hello":"world","message":"hello\\nworld","@version":"1","@timestamp":"\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{6}Z"\}\z/ + .to match(/\A\{"hello":"world","message":"hello\\nworld","@version":"1","@timestamp":"\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{6}Z"\}\z/) end end end
Resolve Ruby warning in spec for Rackstash::Encoders::Logstash This resolves the following warning: > spec/rackstash/encoders/logstash_spec.rb:18: warning: ambiguous first > argument; put parentheses or a space even after `/' operator
diff --git a/spec/search_object/plugin/paging_spec.rb b/spec/search_object/plugin/paging_spec.rb index abc1234..def5678 100644 --- a/spec/search_object/plugin/paging_spec.rb +++ b/spec/search_object/plugin/paging_spec.rb @@ -30,6 +30,14 @@ search = search_class.new({}, -1) expect(search.page).to eq 1 end + + it "requires overwrite of per_page" do + klass = Class.new do + include SearchObject.module(:paging) + scope { Product } + end + expect { klass.new.results }.to raise_error NoMethodError + end end end end
Document with spec requirement of per_page method
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -21,7 +21,7 @@ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' + config.time_zone = 'Central Time (US & Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
Set the timezone to CST
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,5 +11,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.autoload_paths += %W(#{config.root}/lib) + config.autoload_paths += Dir["#{config.root}/lib/**/"] end end
Add libs to the load path
diff --git a/config/config_ruby.rb b/config/config_ruby.rb index abc1234..def5678 100644 --- a/config/config_ruby.rb +++ b/config/config_ruby.rb @@ -1,18 +1,18 @@ require 'rbconfig' -CONFIG = Config::MAKEFILE_CONFIG +CONFIG = RbConfig::MAKEFILE_CONFIG case ARGV[0] when "archdir" - puts Config::expand(CONFIG["archdir"]) + puts RbConfig::expand(CONFIG["archdir"]) when "lib" - puts Config::expand(CONFIG["libdir"]) + puts RbConfig::expand(CONFIG["libdir"]) when "vendorarchdir" - puts Config::expand(CONFIG["vendorarchdir"]) + puts RbConfig::expand(CONFIG["vendorarchdir"]) when "sitearchdir" - puts Config::expand(CONFIG["sitearchdir"]) + puts RbConfig::expand(CONFIG["sitearchdir"]) when "sitelib" - puts Config::expand(CONFIG["sitedir"]) + puts RbConfig::expand(CONFIG["sitedir"]) end
Use RbConfig instead of obsolete and deprecated Config (7, 17 May 2013)
diff --git a/config/initializers/rws.rb b/config/initializers/rws.rb index abc1234..def5678 100644 --- a/config/initializers/rws.rb +++ b/config/initializers/rws.rb @@ -0,0 +1,4 @@+RakutenWebService.configuration do |c| + c.application_id = ENV['RWS_APPLICATION_ID'] + c.affiliate_id = ENV['RWS_AFFILIATE_ID'] +end
Define intializer to set RakutenWebService configuration.
diff --git a/lib/transforms.rb b/lib/transforms.rb index abc1234..def5678 100644 --- a/lib/transforms.rb +++ b/lib/transforms.rb @@ -4,7 +4,7 @@ def to_url return if self.nil? - self.downcase.tr("\"'", '').strip.gsub(/\W/, '-').tr(' ', '-').squeeze('-') + self.downcase.tr("\"'", '').gsub(/\W/, ' ').strip.tr_s(' ', '-').tr(' ', '-').sub(/^$/, "-") end # A quick and dirty fix to add 'nofollow' to any urls in a string.
Tweak permalink transformation again so existing tests don't break git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@1014 820eb932-12ee-0310-9ca8-eeb645f39767
diff --git a/lib/zenvia/sms.rb b/lib/zenvia/sms.rb index abc1234..def5678 100644 --- a/lib/zenvia/sms.rb +++ b/lib/zenvia/sms.rb @@ -1,5 +1,3 @@-require './zenvia/base' - module Zenvia class Sms include Base
Remove require zenvia base from Sms class
diff --git a/spec/features/event_stream_spec.rb b/spec/features/event_stream_spec.rb index abc1234..def5678 100644 --- a/spec/features/event_stream_spec.rb +++ b/spec/features/event_stream_spec.rb @@ -3,6 +3,7 @@ feature "Event streaming", js: true do let!(:author) { FactoryGirl.create :user } let!(:paper) { author.papers.create! short_title: 'foo bar', journal: Journal.create! } + let(:upload_task) { author.papers.first.tasks_for_type(UploadManuscriptTask).first } before do sign_in_page = SignInPage.visit @@ -10,10 +11,19 @@ end scenario "On the dashboard page" do + # Weird race condition if this test doesn't run first. + sleep 0.3 expect(page).to have_no_selector(".completed") - t = author.papers.first.tasks_for_type(UploadManuscriptTask).first - t.completed = true - t.save + upload_task.completed = true + upload_task.save + expect(page).to have_css(".card-completed", count: 1) + end + + scenario "On the edit paper page" do + EditPaperPage.visit paper + expect(page).to have_no_selector(".completed") + upload_task.completed = true + upload_task.save expect(page).to have_css(".card-completed", count: 1) end
Add edit page spec and sleep for race condition.
diff --git a/spec/performance/benchmark_spec.rb b/spec/performance/benchmark_spec.rb index abc1234..def5678 100644 --- a/spec/performance/benchmark_spec.rb +++ b/spec/performance/benchmark_spec.rb @@ -23,7 +23,7 @@ it "correctly loops through events" do measurement = Measurement.new - fsm = FiniteMachine.define(target: measurement) do + fsm = FiniteMachine.define(measurement) do initial :green events {
Change to fix perf spec
diff --git a/sensu-plugins.gemspec b/sensu-plugins.gemspec index abc1234..def5678 100644 --- a/sensu-plugins.gemspec +++ b/sensu-plugins.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'sensu-plugins' - s.version = Sensu::Plugins::VERSION + s.version = Sensu::Plugin::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Decklin Foster'] s.email = ['decklin@red-bean.com']
Move VERSION to Sensu::Plugin, not Sensu::Plugins
diff --git a/week-4/basic-math.rb b/week-4/basic-math.rb index abc1234..def5678 100644 --- a/week-4/basic-math.rb +++ b/week-4/basic-math.rb @@ -0,0 +1,84 @@+# Solution Below + +# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil. + +num1 = 5 +num2 = 2 + +sum = num1 + num2 +difference = num1 - num2 +quotient = num1.to_f / num2.to_f +product = num1 * num2 +modulus = num1 % num2 + + + +describe 'num1' do + it "is defined as a local variable" do + expect(defined?(num1)).to eq 'local-variable' + end + + it "is an integer" do + expect(num1).to be_a Fixnum + end +end + +describe 'num2' do + it "is defined as a local variable" do + expect(defined?(num2)).to eq 'local-variable' + end + + it "is an integer" do + expect(num2).to be_a Fixnum + end +end + +describe 'sum' do + it "is defined as a local variable" do + expect(defined?(sum)).to eq 'local-variable' + end + + it "is assigned the value of num1 + num2" do + expect(sum).to eq num1 + num2 + end +end + +describe 'difference' do + it "is defined as a local variable" do + expect(defined?(difference)).to eq 'local-variable' + end + + it "is assigned the value of num1 - num2" do + expect(difference).to eq num1 - num2 + end +end + +describe 'product' do + it "is defined as a local variable" do + expect(defined?(product)).to eq 'local-variable' + end + + it "is assigned the value of num1 * num2" do + expect(product).to eq num1 * num2 + end +end + +describe 'quotient' do + it "is defined as a local variable" do + expect(defined?(quotient)).to eq 'local-variable' + end + + it "is assigned the value of num1 / num2" do + expect(quotient).to eq num1.to_f / num2.to_f + end +end + +describe 'modulus' do + it "is defined as a local variable" do + expect(defined?(modulus)).to eq 'local-variable' + end + + it "is assigned the value of num1 % num2" do + expect(modulus).to eq num1.to_f % num2.to_f + end +end
Add arithmetic operations - 0 failures
diff --git a/server/app/controllers/wants_controller.rb b/server/app/controllers/wants_controller.rb index abc1234..def5678 100644 --- a/server/app/controllers/wants_controller.rb +++ b/server/app/controllers/wants_controller.rb @@ -1,23 +1,79 @@ class WantsController < ApplicationController + before_action :wants_find, only: [:index, :show, :edit, :destroy, :update] + def index + render json: @wants end def show + render json: @want end def new + @want = Want.new end def create + @want = Want.new(user_id: params[:user_id], product_id: params[:id], max_price: params[:max_price], time_duration: params[:time_duration], fulfilled: false) + if @want.save + render json: @want, status: :created + else + render json: @want.errors.full_messages, status: :unprocessable_entity + end end def edit + render json: @want end def update + @want = Want.update(user_id: params[:user_id], product_id: params[:id], max_price: params[:max_price], time_duration: params[:time_duration], fulfilled: false) end def destroy + @want.destroy + end + + private + + def wants_find + @user = User.find(params[:user_id]) + @wants = Want.where(user_id: @user) + @want = @wants.find(params[:id]) end end + + + +# before_action :user_find, only: [:show, :edit, :destroy, :update] + +# def new +# @user = User.new +# end + +# def show +# render json: {user: @user} +# end + +# def create +# @user = User.new(id: params[:id], name: params[:name], password: params[:password], email: params[:email]) +# if @user.save +# render json: { user: @user }, status: :created +# else +# render json: @user.errors.full_messages, status: :unprocessable_entity +# end +# end + +# def edit +# render json: {user: @user} +# end + + + +# def update +# @user.update(name: params[:name], password: params[:password], email: params[:email]) +# end + + +
Add json crud routes to wants controller
diff --git a/matrioska.gemspec b/matrioska.gemspec index abc1234..def5678 100644 --- a/matrioska.gemspec +++ b/matrioska.gemspec @@ -7,7 +7,7 @@ s.version = Matrioska::VERSION s.authors = ["Luca Pradovera"] s.email = ["lpradovera@mojolingo.com"] - s.homepage = "https://github.com/polysics/matrioska" + s.homepage = "https://github.com/adhearsion/matrioska" s.summary = %q{Adhearsion plugin for in-call apps} s.description = %q{Adhearsion plugin for in-call apps. Provides a features-style interface to run applications in calls.} s.license = 'MIT'
Switch to new official project repo
diff --git a/net-http2.gemspec b/net-http2.gemspec index abc1234..def5678 100644 --- a/net-http2.gemspec +++ b/net-http2.gemspec @@ -22,6 +22,6 @@ spec.add_dependency "http-2", "~> 0.10.1" spec.add_development_dependency "bundler" - spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rake", ">= 12.3.3" spec.add_development_dependency "rspec", "~> 3.0" end
Upgrade ruby rake dependency (security).
diff --git a/lib/devise_cas_authenticatable/strategy.rb b/lib/devise_cas_authenticatable/strategy.rb index abc1234..def5678 100644 --- a/lib/devise_cas_authenticatable/strategy.rb +++ b/lib/devise_cas_authenticatable/strategy.rb @@ -34,7 +34,11 @@ def service_url u = URI.parse(request.url) u.query = nil - u.path = mapping.fullpath + u.path = if mapping.respond_to?(:fullpath) + mapping.fullpath + else + mapping.raw_path + end u.to_s end
Support both new and old mapping API
diff --git a/db/migrate/20141110212340_create_districts.rb b/db/migrate/20141110212340_create_districts.rb index abc1234..def5678 100644 --- a/db/migrate/20141110212340_create_districts.rb +++ b/db/migrate/20141110212340_create_districts.rb @@ -0,0 +1,11 @@+class CreateDistricts < ActiveRecord::Migration + def change + create_table :districts do |t| + t.string :name + t.string :borough + t.string :superintendent + + t.timestamps + end + end +end
Add create districts migration file
diff --git a/Casks/omnioutliner.rb b/Casks/omnioutliner.rb index abc1234..def5678 100644 --- a/Casks/omnioutliner.rb +++ b/Casks/omnioutliner.rb @@ -4,7 +4,7 @@ url "http://downloads2.omnigroup.com/software/MacOSX/10.10/OmniOutliner-#{version}.dmg" name 'OmniOutliner' - homepage 'http://www.omnigroup.com/omnioutliner/' + homepage 'https://www.omnigroup.com/omnioutliner/' license :commercial app 'OmniOutliner.app'
Fix homepage to use SSL in OmniOutliner Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/spec/interval_spec.rb b/spec/interval_spec.rb index abc1234..def5678 100644 --- a/spec/interval_spec.rb +++ b/spec/interval_spec.rb @@ -32,5 +32,15 @@ i.cromatic_interval.should == 16 end + it "class of interval do-mi should be 3M" do + i = Interval.new('do', 'mi', 0) + i.interval_class.should == '3M' + end + + it "class of interval do-mi should be 8J" do + i = Interval.new('do', 'do', 0) + i.interval_class == '8J' + end + end
Add 2 examples for new method interval_class
diff --git a/spec/resource_spec.rb b/spec/resource_spec.rb index abc1234..def5678 100644 --- a/spec/resource_spec.rb +++ b/spec/resource_spec.rb @@ -6,12 +6,12 @@ @stack = Yutani.stack(:s1) { scope(:rnameA) { - resource(:rtype) { + resource(:rtype, :x, y: 'a') { propZ hiera(:foo) } } } - @resource_id = Set.new(%i[rnameA]) + @resource_id = Set.new(%i[rnameA x a]) end it "has a populated resources collection" do
Add test for new resource sig
diff --git a/app/serializers/sector_preview_serializer.rb b/app/serializers/sector_preview_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/sector_preview_serializer.rb +++ b/app/serializers/sector_preview_serializer.rb @@ -1,7 +1,7 @@ class SectorPreviewSerializer < ActiveModel::Serializer cache key: "main_api_sector_preview", expires_in: 3.hours - attributes :type, :id, :name - def type - 'sectors' + attributes :name + link :self do + api_sector_path(object) end end
Revise the sector_preview serializer output
diff --git a/test/spec/resources/monit_config_spec.rb b/test/spec/resources/monit_config_spec.rb index abc1234..def5678 100644 --- a/test/spec/resources/monit_config_spec.rb +++ b/test/spec/resources/monit_config_spec.rb @@ -18,17 +18,10 @@ describe PoiseMonit::Resources::MonitConfig do step_into(:monit_config) - before do - default_attributes['poise-monit'] ||= {} - # TODO update this when I write a dummy provider. - default_attributes['poise-monit']['provider'] = 'system' - end context 'action :create' do recipe do - monit 'monit' do - provider :system # REMOVE THIS - end + monit 'monit' monit_config 'httpd' do content 'check process httpd' end
Use the new dummy provider (which happens by default on chefspec).
diff --git a/test/lib/rubycritic/source_locator_test.rb b/test/lib/rubycritic/source_locator_test.rb index abc1234..def5678 100644 --- a/test/lib/rubycritic/source_locator_test.rb +++ b/test/lib/rubycritic/source_locator_test.rb @@ -22,6 +22,11 @@ Rubycritic::SourceLocator.new(["."]).source_files.must_equal files end + it "deals with non-existent files" do + files = ["non_existent_dir1/non_existent_file1.rb", "non_existent_file0.rb"] + Rubycritic::SourceLocator.new(files).source_files.must_equal [] + end + after do Dir.chdir(@original_dir) end
Test how Source Locator deals with non-existent files
diff --git a/chef/cookbooks/python-dev/recipes/default.rb b/chef/cookbooks/python-dev/recipes/default.rb index abc1234..def5678 100644 --- a/chef/cookbooks/python-dev/recipes/default.rb +++ b/chef/cookbooks/python-dev/recipes/default.rb @@ -7,3 +7,10 @@ ].each do |p| package p end + +bash "install_pipmodules" do + user "root" + code <<-EOH + pip install nose + EOH +end
Install pip module "nose" to simplify Tests