diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/models/renalware/pathology/observation_request.rb b/app/models/renalware/pathology/observation_request.rb index abc1234..def5678 100644 --- a/app/models/renalware/pathology/observation_request.rb +++ b/app/models/renalware/pathology/observation_request.rb @@ -17,7 +17,6 @@ validates :patient, presence: true validates :requestor_name, presence: true validates :requested_at, presence: true - validates :requestor_order_number, presence: true, uniqueness: true scope :ordered, -> { order(requested_at: :desc) }
Remove requirement for order number uniqueness
diff --git a/wkhtmltopdf-old.rb b/wkhtmltopdf-old.rb index abc1234..def5678 100644 --- a/wkhtmltopdf-old.rb +++ b/wkhtmltopdf-old.rb @@ -0,0 +1,32 @@+require 'formula' + +class WkhtmltopdfOld < Formula + url 'http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9.tar.bz2' + homepage 'http://code.google.com/p/wkhtmltopdf/' + sha256 'e6311c0d398d50c757d43d34f1f63c4b33010441e97d07e92647542419ab1a8b' + + depends_on 'qt' + + conflicts_with 'wkhtmltopdf', :because => 'Same binary' + + def install + # fix that missing TEMP= include + inreplace 'wkhtmltopdf.pro' do |s| + s.gsub! 'TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl', '' + s.gsub! 'include($$join(TEMP, "/"))', '' + end + + # Always creates a useless .app doh, + # AFAIK this is fixed in 0.10.0beta + wkhtml_bin = 'wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf' + wkhtml_man = "#{name}.1" + + system "qmake" + system "make" + system "#{wkhtml_bin} --manpage > #{wkhtml_man}" + + # install binary and man file + bin.install wkhtml_bin + man1.install wkhtml_man + end +end
Add wkhtmltopdf for PDFKit. Useful when you cannot install wkhtmltopdf-binary gem
diff --git a/tasks/console.rake b/tasks/console.rake index abc1234..def5678 100644 --- a/tasks/console.rake +++ b/tasks/console.rake @@ -4,7 +4,8 @@ task :console do require 'irb' require 'irb/completion' - require File.join(__FILE__, '../../lib/tty-command') + require_relative '../lib/tty-command' ARGV.clear IRB.start end +task :c => :console
Change to fix on jruby
diff --git a/Casks/pycharm-ce-bundled-jdk.rb b/Casks/pycharm-ce-bundled-jdk.rb index abc1234..def5678 100644 --- a/Casks/pycharm-ce-bundled-jdk.rb +++ b/Casks/pycharm-ce-bundled-jdk.rb @@ -0,0 +1,22 @@+cask :v1 => 'pycharm-ce-bundled-jdk' do + version '4.5.1' + sha256 '8929fa6e995a895244731a1ac2ab888593decb7d0592ba560280e845ee4ebe31' + + url "https://download.jetbrains.com/python/pycharm-community-#{version}-jdk-bundled.dmg" + name 'PyCharm Community Edition' + homepage 'https://www.jetbrains.com/pycharm/' + license :apache + + app 'PyCharm CE.app' + + zap :delete => [ + '~/Library/Preferences/com.jetbrains.pycharm.plist', + '~/Library/Preferences/PyCharm40', + '~/Library/Application Support/PyCharm40', + '~/Library/Caches/PyCharm40', + '~/Library/Logs/PyCharm40', + '/usr/local/bin/charm', + ] + + conflicts_with :cask => 'pycharm-ce' +end
Add PyCharm Community Edition 4.5.1 with bundled JDK 1.8
diff --git a/app/models/oauth_account.rb b/app/models/oauth_account.rb index abc1234..def5678 100644 --- a/app/models/oauth_account.rb +++ b/app/models/oauth_account.rb @@ -36,9 +36,8 @@ end end - private - - def self.crypt - ActiveSupport::MessageEncryptor.new(Rails.application.secrets.secret_key_base) - end + def self.crypt + ActiveSupport::MessageEncryptor.new(Rails.application.secrets.secret_key_base) + end + private_class_method :crypt end
Correct privatisation of class method.
diff --git a/app/services/start_round.rb b/app/services/start_round.rb index abc1234..def5678 100644 --- a/app/services/start_round.rb +++ b/app/services/start_round.rb @@ -11,8 +11,6 @@ @game.with_lock do start_round if round_can_be_started end - - success? end private @@ -23,20 +21,10 @@ end def start_round - @round = @game.rounds.new + @round = @game.rounds.create! - first_trick = @round.tricks.new - - unless @round.save && first_trick.save - add_error("failed to start the round") + Round::NUMBER_OF_TRICKS.times do |n| + @round.tricks.create!(number_in_round: n) end end - - def success? - @errors.empty? - end - - def add_error(message) - @errors << message - end end
Create all 10 tricks at start of round
diff --git a/spec/features/notifications_spec.rb b/spec/features/notifications_spec.rb index abc1234..def5678 100644 --- a/spec/features/notifications_spec.rb +++ b/spec/features/notifications_spec.rb @@ -22,6 +22,7 @@ it "Replying to the notification" do click_link "Reply" expect(page).to have_content "Notification body" + Percy.snapshot(page, name: 'Replying to notification') fill_in 'notification_body', with: "Response body" Percy.snapshot(page, name: "notifications#new") @@ -44,12 +45,12 @@ end it 'paginates at 30 notifications per page' do - expect(page).to have_selector 'tr', count: 31 + expect(page).to have_selector '.message', count: 30 end it 'navigates pages' do first('a[rel="next"]').click - expect(page).to have_selector 'tr', count: 5 + expect(page).to have_selector '.message', count: 4 end end end
Update notification spec to count messages, not rows
diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb index abc1234..def5678 100644 --- a/spec/install/gems/resolving_spec.rb +++ b/spec/install/gems/resolving_spec.rb @@ -20,6 +20,7 @@ end it "works with crazy rubygem plugin stuff" do + return pending install_gemfile <<-G source "file://#{gem_repo1}" gem "net_c"
Mark non-functional rubygems plugin spec 'pending'
diff --git a/test/test-query.rb b/test/test-query.rb index abc1234..def5678 100644 --- a/test/test-query.rb +++ b/test/test-query.rb @@ -0,0 +1,78 @@+$VERBOSE = true +require 'test/unit' +require_relative '../lib/resource' + +class TestQuery < Test::Unit::TestCase + + TEST_DATASET_NAME = 'ClinVar/2.0.0-1/Variants' + + if SolveBio::api_key + # When paging is off, results.length should return the number of + # results retrieved. + def test_limit + dataset = SolveBio::Dataset.retrieve(TEST_DATASET_NAME) + limit = 10 + results = dataset.query({:paging=>false, :limit => limit}) + assert_equal(limit, results.length, + 'limit == results.size, paging = false') + + + results.each_with_index do |val, i| + assert results[i], "retrieving value at #{i}" + end + + assert_raise IndexError do + puts results[limit] + end + end + + # test Query when limit is specified and is GREATER THAN total available + # results + def test_limit_empty + limit = 100 + dataset = SolveBio::Dataset.retrieve(TEST_DATASET_NAME) + results = dataset.query({:paging=>false, :limit => limit}). + filter({:hg19_start => 1234}) + assert_equal(0, results.size) + + assert_raise IndexError do + puts results[0] + end + + results = dataset.query({:paging=>false, :limit => limit}). + filter({:hg19_start => 148459988}) + assert_equal(1, results.size) + end + + # test Filtered Query in which limit is specified but is GREATER THAN + # the number of total available results + def test_limit_filter + limit = 10 + num_filters = 3 + + filters3 = + SolveBio::Filter.new(:hg19_start => 148459988) | + SolveBio::Filter.new(:hg19_start => 148562304) | + SolveBio::Filter.new(:hg19_start => 148891521) + + dataset = SolveBio::Dataset.retrieve(TEST_DATASET_NAME) + results = dataset.query({:paging=>false, :limit => limit, :filters => filters3}) + + num_filters.times do |i| + assert results[i] + end + + assert_equal(num_filters, results.size) + + assert_raise IndexError do + puts results[num_filters] + end + end + + else + def test_skip + skip 'Please set SolveBio::api_key' + end + end + +end
Convert last query test from Python code. It doesn't work yet, though.
diff --git a/spec/obtuse/functions/equal_spec.rb b/spec/obtuse/functions/equal_spec.rb index abc1234..def5678 100644 --- a/spec/obtuse/functions/equal_spec.rb +++ b/spec/obtuse/functions/equal_spec.rb @@ -2,9 +2,16 @@ describe Obtuse do describe "=" do - describe "Object Object" do + describe "Integer Integer" do e %q{12 12 =}, 1 + end + + describe "String String" do e %q{"foo" "foo " =}, 0 + end + + describe "Array Array" do + e %q{5# [0 1 2 3 4] =}, 1 end end end
Fix spec description for `=`.
diff --git a/lib/capistrano/ghostinspector/api.rb b/lib/capistrano/ghostinspector/api.rb index abc1234..def5678 100644 --- a/lib/capistrano/ghostinspector/api.rb +++ b/lib/capistrano/ghostinspector/api.rb @@ -26,8 +26,8 @@ results = JSON.parse(data) if (type == "suite") - results['data'].each do |test| - passing = test['passing'] + results['data'].each do |testItem| + passing = testItem['passing'] end else passing = results['data']['passing']
Rename variable to avoid conflict with outer variable
diff --git a/app/models/address.rb b/app/models/address.rb index abc1234..def5678 100644 --- a/app/models/address.rb +++ b/app/models/address.rb @@ -4,4 +4,8 @@ validates :user_id, :city, :state, :zip_code, presence: true geocoded_by :zip_code after_validation :geocode + + def city_state + "#{city}, #{state}" + end end
Add method to print both city and state
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index abc1234..def5678 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -1,3 +1,8 @@ class Snippet include Mongoid::Document + field :name, :type => String + field :type, :type => String + field :description, :type => String + field :tags, :type => String + field :text, :type => String end
[002] Add attributes to Snippet model; used rails generate model cmd $ rails generate model snippet name:string type:string description:string tags:string text:text invoke mongoid create app/models/snippet.rb invoke rspec identical spec/models/snippet_spec.rb
diff --git a/lib/tb_heavy_control/configurable.rb b/lib/tb_heavy_control/configurable.rb index abc1234..def5678 100644 --- a/lib/tb_heavy_control/configurable.rb +++ b/lib/tb_heavy_control/configurable.rb @@ -11,9 +11,14 @@ private def load_file(original_path) - relative_path = Pathname.new('').join(*Array(original_path)) + array_form = Array(original_path) + last_element = array_form.last + + array_form[-1] = last_element + '.rb' unless last_element[-3..-1] == '.rb' + + relative_path = Pathname.new('').join(*array_form) path = Rails.root.join 'app', 'concepts', relative_path - raise "Connot find file: #{path}" unless path.file? + raise "Cannot find file: #{path}" unless path.file? @load_order << path end end
Make '.rb' part for load_file optional
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -18,18 +18,14 @@ # limitations under the License. # # Attributes for the Go cookbook - +platforms = { + 'x86_64' => 'amd64', + 'i686' => '386 +} default[:go][:install_strategy] = 'source' default[:go][:version] = '1.1.1' default[:go][:checksum] = '71ff6e7bfd8f59a12f2fc7b7abf5d006fad24664e11e39bec61c2ac84d2e573f' -default[:go][:platform] = case node[:kernel][:machine] - when 'x86_64' - 'amd64' - when 'i686' - '386' - else - 'Not a supported Go platform' - end +default[:go][:platform] = platforms.fetch(node[:kernel][:machine], '386') default[:go][:install_dir] = '/usr/local/bin' default[:go][:cleanup] = false
Use a Hash to map platform names.
diff --git a/Stripe.podspec b/Stripe.podspec index abc1234..def5678 100644 --- a/Stripe.podspec +++ b/Stripe.podspec @@ -0,0 +1,12 @@+Pod::Spec.new do |s| + s.name = "Stripe" + s.version = "1.0.0" + s.summary = "Stripe is a RESTful API for accepting payments online." + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.homepage = "https://stripe.com" + s.author = { "Saikat Chakrabarti" => "saikat@stripe.com" } + s.source = { :git => "https://github.com/stripe/stripe-ios.git", :commit => "master"} + s.source_files = 'src/*.{h,m}' + s.public_header_files = 'src/*.h' + s.framework = 'Foundation' +end
Add podspec file for CocoaPods support
diff --git a/TEST2/test2.rb b/TEST2/test2.rb index abc1234..def5678 100644 --- a/TEST2/test2.rb +++ b/TEST2/test2.rb @@ -1,9 +1,9 @@ # http://ruby-doc.org/stdlib-2.0.0/libdoc/open-uri/rdoc/OpenURI.html require 'open-uri' +require 'nokogiri' # Go fetch the contents of a URL & store them as a String -response = open('http://www2.stat.duke.edu/courses/Spring01/sta114/data/andrews.html').read +response = open('http://www2.stat.duke.edu/courses/Spring01/sta114/data/andrews.html') +doc = Nokogiri::HTML(response) -# "Pretty prints" the result to look like a web page instead of one long string of HTML -# URI.parse(response).class -print response+puts doc.xpath('//table')
Use nokogiri gem to focus on table elements
diff --git a/spec/appsignal/auth_check_spec.rb b/spec/appsignal/auth_check_spec.rb index abc1234..def5678 100644 --- a/spec/appsignal/auth_check_spec.rb +++ b/spec/appsignal/auth_check_spec.rb @@ -5,7 +5,7 @@ before do @transmitter = mock Appsignal::Transmitter.should_receive(:new). - with('http://localhost:3000/api/1', 'auth', 'abc'). + with('http://localhost:3000/1', 'auth', 'abc'). and_return(@transmitter) end
Update API path in spec
diff --git a/spec/helpers/plots_helper_spec.rb b/spec/helpers/plots_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/plots_helper_spec.rb +++ b/spec/helpers/plots_helper_spec.rb @@ -5,11 +5,21 @@ describe "#link_to_featured_plant" do let(:plot) { build(:plot, id: 1) } + let(:current_user) { build(:user, :admin) } - context "plot has no featured plant" do + context "plot has no featured plant and admin is logged in" do before { plot.featured_plant = nil } + before { allow(helper).to receive(:logged_in?).and_return(true) } + before { allow(helper).to receive(:admin?).and_return(true) } it "returns 'Unassigned' with a link to edit the plot" do expect(helper.link_to_featured_plant(plot)).to match "Unassigned. <a href=\"/plots/1/edit\">Add one?</a>" + end + end + + context "plot has no featured plant and admin is not logged in" do + before { plot.featured_plant = nil } + it "returns 'n/a'" do + expect(helper.link_to_featured_plant(plot)).to match "n/a" end end
Update plots helper spec to accomodate users that are not logged in
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index abc1234..def5678 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -24,8 +24,8 @@ # Configure all nodes in nodeset c.before :suite do # Install module and dependencies - puppet_module_install(:source => proj_root, :module_name => 'apt') hosts.each do |host| + copy_module_to(host, :source => proj_root, :module_name => 'apt') shell("/bin/touch #{default['puppetpath']}/hiera.yaml") shell('puppet module install puppetlabs-stdlib --version 2.2.1', { :acceptable_exit_codes => [0,1] }) end
Fix issue with puppet_module_install, removed and using updated method from beaker core copy_module_to
diff --git a/spec/support/feature_helper.rb b/spec/support/feature_helper.rb index abc1234..def5678 100644 --- a/spec/support/feature_helper.rb +++ b/spec/support/feature_helper.rb @@ -2,6 +2,24 @@ def login_as(username) visit "/login/#{username}" expect(page).to have_content(username) + end + + def login_with_ui_as(username, password) + + visit "/users/sign_in" + + within(find(:xpath, "//form[@id='new_user']")) do + fill_in("user_login", :with => username) + fill_in("user_password", :with => password) + click_button("Sign in") + end + + user = User.find_by_login(username) + user_first_name = user.first_name + user_last_name = user.last_name + expect(page).to have_content("Welcome") + expect(page).to have_content(user_first_name) + expect(page).to have_content(user_last_name) end def in_newly_opened_window @@ -14,4 +32,4 @@ def close_window page.execute_script "window.close();" end -end+end
Add login with ui method for spec tests.
diff --git a/spec/classes/apt_preferences_spec.rb b/spec/classes/apt_preferences_spec.rb index abc1234..def5678 100644 --- a/spec/classes/apt_preferences_spec.rb +++ b/spec/classes/apt_preferences_spec.rb @@ -17,7 +17,7 @@ describe 'pixelated packages' do it { should contain_apt__preferences_snippet("pixelated").with_pin('origin "packages.pixelated-project.org"')} - it { should contain_apt__preferences_snippet("pixelated").with_priority('1000')} + it { should contain_apt__preferences_snippet("pixelated").with_priority('1001')} end %w( soledad-server soledad-client soledad-common leap-keymanager leap-auth).each do | file |
Fix spec test for previous commit
diff --git a/lib/app_stats/stats.rb b/lib/app_stats/stats.rb index abc1234..def5678 100644 --- a/lib/app_stats/stats.rb +++ b/lib/app_stats/stats.rb @@ -8,6 +8,8 @@ CURRENT_FILE = File.basename(__FILE__) PIPE_MINUS_CURRENT_FILE = "| grep -v \"#{CURRENT_FILE}\"" HAS_MANY_SEARCH = "ack \" has_many \" -c | awk -F \":\" '{print $2,$1}' | grep -v \"0\" #{PIPE_MINUS_COVERAGE} #{PIPE_MINUS_CURRENT_FILE} | sort -rn" + LINES_OF_CODE_SEARCH = "find . -iname "*.rb" -type f -exec cat {} \; | wc -l | grep -v \"0\" #{PIPE_MINUS_COVERAGE} #{PIPE_MINUS_CURRENT_FILE} | sort -rn" + def self.get_raw(command) `#{command}` @@ -16,6 +18,9 @@ def self.get_has_many_relationships get_raw(HAS_MANY_SEARCH).split("\n") end - + + def self.get_lines_of_code + get_raw(LINES_OF_CODE_SEARCH).split("\n") + end end end
Add lines of code search
diff --git a/app/controllers/deploys_controller.rb b/app/controllers/deploys_controller.rb index abc1234..def5678 100644 --- a/app/controllers/deploys_controller.rb +++ b/app/controllers/deploys_controller.rb @@ -5,12 +5,24 @@ def create @app = App.find_by_api_key!(params[:api_key]) - @deploy = @app.deploys.create!({ - :username => params[:deploy][:local_username], - :environment => params[:deploy][:rails_env], - :repository => params[:deploy][:scm_repository], - :revision => params[:deploy][:scm_revision] - }) + if params[:deploy] + deploy = { + :username => params[:deploy][:local_username], + :environment => params[:deploy][:rails_env], + :repository => params[:deploy][:scm_repository], + :revision => params[:deploy][:scm_revision], + } + end + + # handle Heroku's HTTP post deployhook format + deploy ||= { + :username => params[:user], + :environment => params[:rack_env].try(:downcase) || params[:app], + :repository => "git@heroku.com:#{params[:app]}.git", + :revision => params[:head], + } + + @deploy = @app.deploys.create!(deploy) render :xml => @deploy end
Support Heroku's HTTP Post deployhook.
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index abc1234..def5678 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -9,7 +9,7 @@ def amr_data_show @meter = Meter.includes(:meter_readings).find(params[:meter_id]) @first_reading = @meter.first_reading - @reading_summary = @meter.meter_readings.order('read_at::date').group('read_at::date').count + @reading_summary = @meter.meter_readings.order(Arel.sql('read_at::date')).group('read_at::date').count @missing_array = (@first_reading.read_at.to_date..Date.today).collect do |day| if ! @reading_summary.key?(day) [ day, 'No readings' ]
Fix deprecation warning by wrapping cast
diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index abc1234..def5678 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -9,8 +9,21 @@ @results = School.search_schools(params["search"]) end - def show - #AJAX to get info on single + def random40 + @json = Array.new + 20.times do + offset = rand(School.count) + rand_record = School.offset(offset).first + @json << { + dbn: rand_record.dbn, + school: rand_record.school, + total_enrollment: rand_record.total_enrollment, + amount_owed: rand_record.amount_owed + } + end + respond_to do |format| + format.html + format.json { render json: @json } + end end - end
Add method for getting 50 random schools from db with ajax
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index abc1234..def5678 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -1,6 +1,6 @@ class WelcomeController < ApplicationController def index - @most_popular_buildings = Building.left_joins(:toilet).group(:id).order('COUNT(toilets.id) DESC').limit(5) - @random_buildings = Building.all.order("random()").limit(5) + @most_popular_buildings = Building.left_joins(:toilet).group(:id).order(Arel.sql("COUNT(toilets.id) DESC")).limit(5) + @random_buildings = Building.all.order(Arel.sql("random()")).limit(5) end end
Use Arel.sql on hardcoded SQL.
diff --git a/spec/features/forms/form/form_status_spec.rb b/spec/features/forms/form/form_status_spec.rb index abc1234..def5678 100644 --- a/spec/features/forms/form/form_status_spec.rb +++ b/spec/features/forms/form/form_status_spec.rb @@ -0,0 +1,60 @@+# frozen_string_literal: true + +require "rails_helper" + +feature "form status display and changes", js: true do + let!(:form) { create(:form, :draft, name: "Myform") } + let(:user) { create(:user, role_name: "coordinator") } + + before do + login(user) + end + + scenario "changing status via index page" do + visit(forms_path(mode: "m", mission_name: get_mission.compact_name, locale: "en")) + expect(page).to have_css("tr", text: /Myform Draft/) + + click_link("Go Live") + expect(page).to have_css("tr", text: /Myform Live/) + + click_link("Pause") + expect(page).to have_css("tr", text: /Myform Paused/) + end + + scenario "changing status via edit page" do + visit(forms_path(mode: "m", mission_name: get_mission.compact_name, locale: "en")) + click_link("Myform") + expect(page).to have_css("div#status", text: /Status Draft/) + + click_link("Go Live") + click_link("Myform") + expect(page).to have_css("div#status", text: /Status Live/) + + click_link("Pause") + click_link("Myform") + expect(page).to have_css("div#status", text: /Status Paused/) + end + + scenario "changing status via save and go live button" do + visit(new_form_path(mode: "m", mission_name: get_mission.compact_name, locale: "en")) + expect(page).to have_css("div#status", text: /Status Draft/) + fill_in("Name", with: "Yourform") + + click_button("Save") + expect(page).to have_content("Form created successfully") + expect(page).to have_css("div#status", text: /Status Draft/) + + click_button("Save and Go Live") + click_link("Yourform") + expect(page).to have_css("div#status", text: /Status Live/) + expect(page).not_to have_content("Save and Go Live") + + click_link("Pause") + click_link("Yourform") + expect(page).to have_css("div#status", text: /Status Paused/) + + click_button("Save and Go Live") + click_link("Yourform") + expect(page).to have_css("div#status", text: /Status Live/) + end +end
10156: Add feature spec for form status changes
diff --git a/lib/active_record/tasks/chronomodel_database_tasks.rb b/lib/active_record/tasks/chronomodel_database_tasks.rb index abc1234..def5678 100644 --- a/lib/active_record/tasks/chronomodel_database_tasks.rb +++ b/lib/active_record/tasks/chronomodel_database_tasks.rb @@ -24,21 +24,24 @@ private - def remove_sql_header_comments(filename) - sql_comment_begin = '--' - removing_comments = true - tempfile = Tempfile.open("uncommented_structure.sql") - begin - File.foreach(filename) do |line| - unless removing_comments && (line.start_with?(sql_comment_begin) || line.blank?) - tempfile << line - removing_comments = false + + unless method_defined? :remove_sql_header_comments + def remove_sql_header_comments(filename) + sql_comment_begin = '--' + removing_comments = true + tempfile = Tempfile.open("uncommented_structure.sql") + begin + File.foreach(filename) do |line| + unless removing_comments && (line.start_with?(sql_comment_begin) || line.blank?) + tempfile << line + removing_comments = false + end end + ensure + tempfile.close end - ensure - tempfile.close + FileUtils.mv(tempfile.path, filename) end - FileUtils.mv(tempfile.path, filename) end end
Define :remove_sql_heder_comments only if not defined from upstream
diff --git a/lib/devise/omniauth.rb b/lib/devise/omniauth.rb index abc1234..def5678 100644 --- a/lib/devise/omniauth.rb +++ b/lib/devise/omniauth.rb @@ -8,8 +8,8 @@ raise end -unless OmniAuth::VERSION =~ /^1\./ - raise "You are using an old OmniAuth version, please ensure you have 1.0.0.pr2 version or later installed." +if Gem::Version.new(OmniAuth::VERSION) < Gem::Version.new('1.0.0') + raise "You are using an old OmniAuth version, please ensure you have 1.0.0 version or later installed." end # Clean up the default path_prefix. It will be automatically set by Devise.
Improve OmniAuth version check to allow anything from 1.0 forward This should enable people to try OmniAuth 2 currently in pre-release.
diff --git a/lib/generators/fiona/templates/create_fiona_tables.rb b/lib/generators/fiona/templates/create_fiona_tables.rb index abc1234..def5678 100644 --- a/lib/generators/fiona/templates/create_fiona_tables.rb +++ b/lib/generators/fiona/templates/create_fiona_tables.rb @@ -10,8 +10,8 @@ create_table :template_attributes do |t| t.integer :template_id - t.string :key - t.string :value + t.string :key + t.text :value t.timestamps end
Change template attribute data type to handle large json strings.
diff --git a/lib/email_processor.rb b/lib/email_processor.rb index abc1234..def5678 100644 --- a/lib/email_processor.rb +++ b/lib/email_processor.rb @@ -23,7 +23,9 @@ # Add a new answer to question print "\nSubject: #{email.subject}\n" if email.subject.include? '|Answer Needed|' - ques_content = email.subject.gsub(/\|Answer Needed\|\s/, '') + search = '|Answer Needed| ' + startpos = email.subject.index(search) + search.length + ques_content = email.subject[startpos..-1] print "\nQues: #{ques_content}\n" question = user.company.questions.where(content: ques_content) if question.exists?
Update logic for gettin question from email subject
diff --git a/spec/controllers/items_controller_spec.rb b/spec/controllers/items_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/items_controller_spec.rb +++ b/spec/controllers/items_controller_spec.rb @@ -13,7 +13,7 @@ expect(assigns[:items]).to be_empty end - + context "When given keyword" do let(:keyword) { "ruby" } let(:items) { create_list(:rws_ichiba_item, 10) } @@ -32,4 +32,4 @@ end end end -end+end
Remove trailing space and Insert newline at the end of file
diff --git a/lib/rom/sql/commands/error_wrapper.rb b/lib/rom/sql/commands/error_wrapper.rb index abc1234..def5678 100644 --- a/lib/rom/sql/commands/error_wrapper.rb +++ b/lib/rom/sql/commands/error_wrapper.rb @@ -1,7 +1,13 @@ module ROM module SQL module Commands + # Shared error handler for all SQL commands + # + # @api private module ErrorWrapper + # Handle Sequel errors and re-raise ROM-specific errors + # + # @api public def call(*args) super rescue *ERROR_MAP.keys => e
Add some docs to error wrapper [ci skip]
diff --git a/lib/travis/logs/services/fetch_log.rb b/lib/travis/logs/services/fetch_log.rb index abc1234..def5678 100644 --- a/lib/travis/logs/services/fetch_log.rb +++ b/lib/travis/logs/services/fetch_log.rb @@ -28,9 +28,11 @@ ].join('') end + removed_by_id = result.delete(:removed_by) result.merge( content: content, - aggregated_at: result[:updated_at] || Time.now.utc - 60 + aggregated_at: result[:updated_at] || Time.now.utc - 60, + removed_by_id: removed_by_id ) end end
Rename attribute removed_by => removed_by_id to ease overriding method in travis-api
diff --git a/lib/versionator/detector/mediawiki.rb b/lib/versionator/detector/mediawiki.rb index abc1234..def5678 100644 --- a/lib/versionator/detector/mediawiki.rb +++ b/lib/versionator/detector/mediawiki.rb @@ -6,18 +6,30 @@ set :app_name, "MediaWiki" set :project_url, "http://www.mediawiki.org" - set :detect_dirs, %w{bin config extensions images includes maintenance skins} - set :detect_files, %w{api.php index.php redirect.php RELEASE-NOTES thumb.php} + set :detect_dirs, %w{bin extensions images includes maintenance skins} + set :detect_files, %w{api.php index.php redirect.php thumb.php} - set :installed_version_file, "RELEASE-NOTES" + set :installed_version_file, "RELEASE-NOTES" # see contents_detected? set :installed_version_regexp, /^== MediaWiki (.+) ==$/ set :newest_version_url, 'http://www.mediawiki.org/wiki/Download' set :newest_version_selector, '#bodyContent .plainlinks a' set :newest_version_regexp, /^Download MediaWiki (.+)$/ + # Overriden to detect RELEASE-NOTES-x.yy files form 1.18 onwards + def contents_detected? + release_notes = Dir.glob(File.expand_path("RELEASE-NOTES*", base_dir)) + @@installed_version_file = release_notes.first[File.expand_path(base_dir).size..-1] + + !release_notes.empty? + end + def project_url_for_version(version) - "http://svn.wikimedia.org/svnroot/mediawiki/tags/REL#{version.to_s.gsub('.', '_')}/phase3/RELEASE-NOTES" + if version < Versionomy.parse('1.18') + "http://svn.wikimedia.org/svnroot/mediawiki/tags/REL#{version.change({}, :optional_fields => []).to_s.gsub('.', '_')}/phase3/RELEASE-NOTES" + else + "http://svn.wikimedia.org/svnroot/mediawiki/tags/REL#{version.change({}, :optional_fields => []).to_s.gsub('.', '_')}/phase3/RELEASE-NOTES-#{version.to_s}" + end end end end
Update MediaWiki detector for changes in MediaWiki 1.18
diff --git a/lib/tasks/twitter.rake b/lib/tasks/twitter.rake index abc1234..def5678 100644 --- a/lib/tasks/twitter.rake +++ b/lib/tasks/twitter.rake @@ -0,0 +1,50 @@+namespace :twitter do + desc "This task is called by the Heroku scheduler add-on" + puts "Start making tweet of hot entry" + task :tweet_hot_entry => :environment do + client = get_twitter_client + tweet = get_hot_entry_tweet + update(client, tweet) + end +end + +DURATION = 3.days + +def get_twitter_client + client = Twitter::REST::Client.new do |config| + config.consumer_key = Rails.application.secrets.twitter_consumer_key + config.consumer_secret = Rails.application.secrets.twitter_consumer_secret + config.access_token = Rails.application.secrets.twitter_access_token + config.access_token_secret = Rails.application.secrets.twitter_access_secret + end +end + +def get_hot_entry_tweet + from = @newer_than.present? ? @newer_than : DURATION.ago + to = @older_than.present? ? @older_than : from + DURATION + @entries = Entry.hot_entries_within_period(from: from, to: to) + + if @entries.nil? + puts "Not found hot entries." + end + + entry = @entries[0] + origin = JSON.load(entry.origin) + + if origin.present? && origin['title'].present? + body = "✏[話題の記事] #{entry.title} by #{origin['title']}" + body = (body.length > 116) ? body[0..115].to_s : body + tweet = "#{body} #{entry.originId}" + else + puts "Not found origin of entry." + end +end + +def update(client, tweet) + begin + client.update(tweet.chomp) + puts tweet + rescue => e + Rails.logger.error "<<twitter.rake::tweet.update ERROR : #{e.message}>>" + end +end
Implement rake task to tweet about most hottest entry.
diff --git a/lib/brightbox-cli/commands/firewall-rules-list.rb b/lib/brightbox-cli/commands/firewall-rules-list.rb index abc1234..def5678 100644 --- a/lib/brightbox-cli/commands/firewall-rules-list.rb +++ b/lib/brightbox-cli/commands/firewall-rules-list.rb @@ -3,14 +3,15 @@ arg_name '[firewall-policy-id...]' command [:list] do |c| c.action do |global_options,options,args| + if args.empty? + raise "You must specify the firewall policy id as the first argument" + end - if args.empty? - raise "You must specify the firewall_policy_id as the first argument" - else - firewall_policy_id = args.shift - firewall_policy = FirewallPolicy.find_or_call(firewall_policy_id) do |id| - raise "Couldn't find firewall policy #{id}" - end + firewall_policy_id = args.shift + raise "Invalid firewall policy id" unless firewall_policy_id =~ /^fwp-/ + + firewall_policy = FirewallPolicy.find_or_call([firewall_policy_id]) do |id| + raise "Couldn't find firewall policy #{id}" end render_table(FirewallRules.from_policy(firewall_policy.first), global_options) end
Fix problem with firewall list not working on 1.9
diff --git a/lib/eaco/adapters/active_record/postgres_jsonb.rb b/lib/eaco/adapters/active_record/postgres_jsonb.rb index abc1234..def5678 100644 --- a/lib/eaco/adapters/active_record/postgres_jsonb.rb +++ b/lib/eaco/adapters/active_record/postgres_jsonb.rb @@ -25,7 +25,7 @@ def accessible_by(actor) return scoped if actor.is_admin? - designators = actor.designators.map {|d| quote_value(d, nil) } + designators = actor.designators.map {|d| sanitize(d) } column = "#{connection.quote_table_name(table_name)}.acl"
Use sanitize instead of quote_value Under the hood it works the same as passing nil to quote_value in Rails 4+, and is deprecated in Rails 5.
diff --git a/lib/generators/wheelie/render/render_generator.rb b/lib/generators/wheelie/render/render_generator.rb index abc1234..def5678 100644 --- a/lib/generators/wheelie/render/render_generator.rb +++ b/lib/generators/wheelie/render/render_generator.rb @@ -9,10 +9,8 @@ end def migrate - <<-`MIGRATE` - bin/rake db:drop db:create db:migrate RAILS_ENV=development - bin/rake db:drop db:create db:migrate RAILS_ENV=test - MIGRATE + run 'bin/rake db:drop db:create db:migrate RAILS_ENV=development' + run 'bin/rake db:drop db:create db:migrate RAILS_ENV=test' end end
Change migrations in RenderGenerator to output their output :)
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,7 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' +require 'action_mailer/log_subscriber' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -12,7 +13,7 @@ # Custom Logging config.log_level = :info config.logstasher.enabled = true - config.logstasher.suppress_app_log = false + config.logstasher.suppress_app_log = true config.logstasher.log_level = Logger::INFO config.logstasher.logger_path = "#{Rails.root}/log/logstash_#{Rails.env}.json" config.logstasher.source = 'logstasher'
Disable default request logging - use logstasher instead
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -27,5 +27,9 @@ I18n.enforce_available_locales = true config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif) + + config.autoload_paths += %W( + #{config.root}/app/presenters + ) end end
Add app/presenters to load path
diff --git a/spec/cases/not_overly_helpful_spec.rb b/spec/cases/not_overly_helpful_spec.rb index abc1234..def5678 100644 --- a/spec/cases/not_overly_helpful_spec.rb +++ b/spec/cases/not_overly_helpful_spec.rb @@ -0,0 +1,13 @@+# frozen_string_literal: true +require "spec_helper" + +describe "Case: Not overly helpful" do + %w( + john.doe@domain.ca + ).each do |kase| + it "does not propose a hint for #{kase}" do + response = EmailInquire.validate(kase) + expect(response.status).to eq(:valid) + end + end +end
Spec: Add a not overly helpful case
diff --git a/spec/shared_examples/serialization.rb b/spec/shared_examples/serialization.rb index abc1234..def5678 100644 --- a/spec/shared_examples/serialization.rb +++ b/spec/shared_examples/serialization.rb @@ -5,7 +5,5 @@ subject.attributes.each do |attr, value| expect(deserialized.send(attr)).to eq(value) end - - expect(deserialized.new_record?).to eq(subject.new_record?) end end
Remove new_record? expectation since since its not implemented by us
diff --git a/spec/tasks/remove_old_stories_spec.rb b/spec/tasks/remove_old_stories_spec.rb index abc1234..def5678 100644 --- a/spec/tasks/remove_old_stories_spec.rb +++ b/spec/tasks/remove_old_stories_spec.rb @@ -2,18 +2,21 @@ app_require 'tasks/remove_old_stories' describe RemoveOldStories do - before do - @arel_mock = double('arel') - @arel_mock.stub(:delete_all) { 0 } - StoryRepository.stub(:unstarred_read_stories_older_than) { @arel_mock } - end + describe '.remove!' do + let(:stories_mock) { double('stories') } - describe '.remove!' do it 'should pass along the number of days to the story repository query' do - StoryRepository.should_receive(:unstarred_read_stories_older_than).with(7) - @arel_mock.should_receive(:delete_all) + StoryRepository.should_receive(:unstarred_read_stories_older_than).with(7).and_return(stories_mock) + stories_mock.stub(:delete_all) RemoveOldStories.remove!(7) end + + it 'should request deletion of all old stories' do + StoryRepository.should_receive(:unstarred_read_stories_older_than).and_return(stories_mock) + stories_mock.should_receive(:delete_all) + + RemoveOldStories.remove!(11) + end end -end+end
Split RemoveOldStories spec in two One assertion per test.
diff --git a/spec/uploaders/image_uploader_spec.rb b/spec/uploaders/image_uploader_spec.rb index abc1234..def5678 100644 --- a/spec/uploaders/image_uploader_spec.rb +++ b/spec/uploaders/image_uploader_spec.rb @@ -11,7 +11,7 @@ ImageUploader.enable_processing = true @uploader = ImageUploader.new(course, :logo) - File.open(File.join(Rails.root, '/spec/fixtures/files/picture.jpg')) do |f| + File.open(File.join(Rails.root, '/spec/fixtures/files/picture.jpg'), 'rb') do |f| @uploader.store!(f) end end
Make sure that we open the jpeg in binary mode.
diff --git a/spec/integration/spec_helper.rb b/spec/integration/spec_helper.rb index abc1234..def5678 100644 --- a/spec/integration/spec_helper.rb +++ b/spec/integration/spec_helper.rb @@ -2,7 +2,7 @@ require 'net/ssh' require 'tempfile' -include Specinfra::Helper::Ssh +set :backend, :ssh def vagrant(cmd) Bundler.with_clean_env do
Use set method to set backend type
diff --git a/spec/pdftotext_document_spec.rb b/spec/pdftotext_document_spec.rb index abc1234..def5678 100644 --- a/spec/pdftotext_document_spec.rb +++ b/spec/pdftotext_document_spec.rb @@ -23,4 +23,9 @@ expect(pages.last.text).to eql("This is another test.\n") expect(pages.last.number).to eql(2) end + + it "respects non-default command line arguments" do + pages = subject.pages({l: 1}) + expect(pages.count).to eql(1) + end end
Add failing test for non-boolean command-line args
diff --git a/minitest-sugar.gemspec b/minitest-sugar.gemspec index abc1234..def5678 100644 --- a/minitest-sugar.gemspec +++ b/minitest-sugar.gemspec @@ -14,4 +14,5 @@ s.test_files = Dir["test/**/*.rb"] s.add_dependency "minitest", "~> 5.0" + s.add_development_dependency "rake", "~> 10.0" end
Add rake as a development dependency.
diff --git a/plugins/providers/hyperv/cap/validate_disk_ext.rb b/plugins/providers/hyperv/cap/validate_disk_ext.rb index abc1234..def5678 100644 --- a/plugins/providers/hyperv/cap/validate_disk_ext.rb +++ b/plugins/providers/hyperv/cap/validate_disk_ext.rb @@ -6,8 +6,8 @@ module ValidateDiskExt LOGGER = Log4r::Logger.new("vagrant::plugins::hyperv::validate_disk_ext") - # The default set of disk formats that VirtualBox supports - DEFAULT_DISK_EXT = ["vdi", "vmdk", "vhd"].map(&:freeze).freeze + # The default set of disk formats that Hyper-V supports + DEFAULT_DISK_EXT = ["vhd", "vhdx"].map(&:freeze).freeze # @param [Vagrant::Machine] machine # @param [String] disk_ext
Use correct disk extension formats for Hyper-V
diff --git a/MJExtension.podspec b/MJExtension.podspec index abc1234..def5678 100644 --- a/MJExtension.podspec +++ b/MJExtension.podspec @@ -1,8 +1,10 @@ Pod::Spec.new do |s| s.name = "MJExtension" - s.version = "3.2.5" + s.version = "3.3.0" s.ios.deployment_target = '9.0' s.osx.deployment_target = '10.8' + s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '2.0' s.summary = "A fast and convenient conversion between JSON and model" s.homepage = "https://github.com/CoderMJLee/MJExtension" s.license = "MIT"
Add watchOS and tvOS support.
diff --git a/yard_extensions.rb b/yard_extensions.rb index abc1234..def5678 100644 --- a/yard_extensions.rb +++ b/yard_extensions.rb @@ -1,11 +1,26 @@ # A YARD handler to deal with the "property" DSL method. class PropertyDslHandler < YARD::Handlers::Ruby::Base handles method_call(:property) + namespace_only # Do not process nested method calls. def process name = statement.parameters.first.jump(:tstring_content, :ident).source object = YARD::CodeObjects::MethodObject.new(namespace, name) + object.parameters = [['value', nil]] register(object) + + cf_property = statement.parameters[1].source + docstring = <<-DOC +@overload #{name} + + Returns the value of the #{cf_property} CloudFormation property. +@overload #{name}(value) + + Sets the #{cf_property} CloudFormation property. + + @param value the value to set the #{cf_property} CloudFormation property to. +DOC + object.docstring = docstring if object.docstring.blank?(false) # modify the object object.dynamic = true
Update PropertyDslHandler to better generate documentation
diff --git a/test/xample/text/analyzer_spec.rb b/test/xample/text/analyzer_spec.rb index abc1234..def5678 100644 --- a/test/xample/text/analyzer_spec.rb +++ b/test/xample/text/analyzer_spec.rb @@ -0,0 +1,73 @@+require File.expand_path(File.dirname(__FILE__) + "/../../test_helper") + +include Xample::Text + +describe Analyzer do + before :each do + @obj = Object.new + @obj.extend Analyzer + end + + describe "ignore_tokens" do + it "should be based on options" do + @obj.should_receive(:options).any_number_of_times. + and_return(:ignore => ['a', 'b', '.'], + :dont_ignore => ['b'], + :separate_tokens => ['+']) + @obj.ignore_tokens.should == "a.+" + end + end + + describe "separate_tokens" do + it "should create regexp based on separate tokens" do + @obj.should_receive(:options). + and_return(:separate_tokens => ['+', "foo", 'x']) + @obj.separate_tokens.should == /\+|foo|x/ + end + end + + describe "token_pattern" do + it "should include numbers, separate tokens and ignore tokens" do + @obj.should_receive(:options).any_number_of_times. + and_return(:ignore => ['a', 'b', '.'], + :dont_ignore => ['b'], + :separate_tokens => ['+', 'f', 'x']) + @obj.token_pattern.should == /((?-mix:[0-9](?:(?:[0-9,]*[0-9])|)))|((?-mix:\+|f|x))|([^a.+fx]+)/ + end + end + + describe "tokens_for" do + it "should handle simple tokens" do + @obj.should_receive(:options).any_number_of_times. + and_return(:ignore => [" "], + :dont_ignore => [], + :separate_tokens => []) + @obj.tokens_for("a b c").should == ["a", "b", "c"] + end + end + + describe "typeof" do + it "should be able to recognize ints" do + @obj.typeof("1").should == :int + @obj.typeof("01").should == :int + @obj.typeof("1000000000000032352345345345").should == :int + end + + it "should be able to recognize floats" do + @obj.typeof("0.0").should == :float + @obj.typeof("1.0").should == :float + @obj.typeof("3244234232352354363463456.0").should == :float + @obj.typeof("1.0e4").should == :float + end + + it "should be able to recognize symbols" do + @obj.should_receive(:options).and_return(:separate_tokens => %w(foo)) + @obj.typeof("foo").should == :sym + end + + it "should return strings for the rest" do + @obj.should_receive(:options).and_return(:separate_tokens => []) + @obj.typeof("gah").should == :str + end + end +end
Add some tests for the analyzer
diff --git a/Regex.swift.podspec b/Regex.swift.podspec index abc1234..def5678 100644 --- a/Regex.swift.podspec +++ b/Regex.swift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Regex.swift' - s.version = '1.0' + s.version = '1.0.1' s.summary = 'A Simple Swift NSRegularExpression wrapper' s.description = <<-DESC @@ -13,7 +13,10 @@ s.source = { :git => 'https://github.com/fpg1503/Regex.swift.git', :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/fpg1503' - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '8.0' + s.osx.deployment_target = '10.9' + s.watchos.deployment_target = '2.0' + s.tvos.deployment_target = '9.0' s.source_files = 'Source/Regex.swift'
Add mac, TV and Watch support
diff --git a/tools/scripts/mosaic/msgcounts.rb b/tools/scripts/mosaic/msgcounts.rb index abc1234..def5678 100644 --- a/tools/scripts/mosaic/msgcounts.rb +++ b/tools/scripts/mosaic/msgcounts.rb @@ -0,0 +1,36 @@+def main() + if ARGF.argv.empty? + puts "Usage: #{$PROGRAM_NAME} [list_of_msgcount_logs]" + exit 1 + end + + global_sum = 0.0 + global_count = 0 + ARGF.argv.each do |path| + stats = get_stats(path) + puts "#{path}: #{stats[:sum] / stats[:count]}" + global_sum += stats[:sum] + global_count += stats[:count] + end + puts "Global Average: #{global_sum / global_count}" +end + +def get_stats(path) + sum = 0.0 + count = 0 + File.readlines(path).each do |line| + l = line.split(",")[2..4].map {|x| x.strip.to_i } + node_count = l[0] + l[1] + if node_count > 1 + empty_count = l[0] + ratio = 1.0 * empty_count / node_count + sum += ratio + count += 1 + end + end + return {:sum => sum, :count => count} +end + +if __FILE__ == $0 + main +end
Add script to process mosaic msgcount logs
diff --git a/lib/hpcloud/commands/servers/remove.rb b/lib/hpcloud/commands/servers/remove.rb index abc1234..def5678 100644 --- a/lib/hpcloud/commands/servers/remove.rb +++ b/lib/hpcloud/commands/servers/remove.rb @@ -24,9 +24,16 @@ if (server && server.id == id) begin # disassociate server from address, and release address + begin server.addresses.each do |addr| addr.server = nil addr.destroy + end + rescue Fog::AWS::Compute::Error => error + # Hack to fix the lack of correct exception being raised, to enable better user experience + unless error_message_includes?(error, "FloatingIpNotFoundForProject") + display_error_message(error) + end end # now delete the server server.destroy
Fix command to ignore exception rasied when no IPs are found. Behavior changed in Diablo4 release.
diff --git a/test/fabricators/post_fabricator.rb b/test/fabricators/post_fabricator.rb index abc1234..def5678 100644 --- a/test/fabricators/post_fabricator.rb +++ b/test/fabricators/post_fabricator.rb @@ -1,5 +1,5 @@ Fabricator(:post) do content { Faker::Lorem.paragraphs.join("\n\n") } - markup_language { Post::MARKUP_LANGUAGES.sample } + markup_language { Post::DEFAULT_MARKUP_LANGUAGE } author{ User.all.sample } end
Fix markup language in post fabricator
diff --git a/test/functional/index_group_test.rb b/test/functional/index_group_test.rb index abc1234..def5678 100644 --- a/test/functional/index_group_test.rb +++ b/test/functional/index_group_test.rb @@ -15,6 +15,9 @@ "mappings" => { "default" => { "edition" => { "_all" => { "enabled" => true } } + }, + "custom" => { + "edition" => { "_all" => { "enabled" => false } } } } } @@ -38,4 +41,22 @@ assert_requested(stub) end + + def test_create_index_with_custom_mappings + expected_body = MultiJson.encode({ + "settings" => "awesomeness", + "mappings" => { + "edition" => { "_all" => { "enabled" => false } } + } + }) + stub = stub_request(:put, %r(http://localhost:9200/custom-.*/)) + .with(body: expected_body) + .to_return( + status: 200, + body: '{"ok": true, "acknowledged": true}' + ) + @server.index_group("custom").create_index + + assert_requested(stub) + end end
Test custom mappings for particular indices.
diff --git a/cyclid-client.gemspec b/cyclid-client.gemspec index abc1234..def5678 100644 --- a/cyclid-client.gemspec +++ b/cyclid-client.gemspec @@ -8,6 +8,8 @@ s.authors = ['Kristian Van Der Vliet'] s.email = 'vanders@liqwyd.com' s.files = Dir.glob('lib/**/*') + %w(LICENSE README.md) + s.bindir = 'bin' + s.executables << 'cyclid' s.add_runtime_dependency('thor', '~> 0.19') s.add_runtime_dependency('require_all', '~> 1.3')
Add cyclid to the bindir
diff --git a/dredd_hooks.gemspec b/dredd_hooks.gemspec index abc1234..def5678 100644 --- a/dredd_hooks.gemspec +++ b/dredd_hooks.gemspec @@ -9,17 +9,16 @@ spec.authors = ["Adam Kliment", "Gonzalo Bulnes Guilpain"] spec.email = ["adam@apiary.io", "gon.bulnes@gmail.com"] spec.summary = %q{Ruby Hooks Handler for Dredd API Testing Framework} - spec.description = %q{Write Dredd hooks in Ruby to glue together API Blueprint with your Ruby project} + spec.description = %q{Write Dredd hooks in Ruby to glue together API Blueprint with your Ruby project.} spec.homepage = "https://github.com/apiaryio/dredd-hooks-ruby" spec.license = "MIT" - spec.files = `git ls-files -z`.split("\x0") - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] + spec.executables = "dredd-hooks-ruby" + spec.files = Dir["{bin,lib}/**/*", "CHANGELOG.md", "Gemfile", "LICENSE.txt", "Rakefile", "README.md" ] + spec.test_files = Dir["features/**/*"] + spec.add_development_dependency "aruba", "~> 0.6.2" spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "aruba", "~> 0.6.2" spec.add_development_dependency "sinatra", "~> 1.4.5" end
Refactor simplify file lists in gemspec These lists of files are not modified often, and the Git versions are cryptic enough to allow useless files to be added to the gem.
diff --git a/worker_host/travis_worker/recipes/default.rb b/worker_host/travis_worker/recipes/default.rb index abc1234..def5678 100644 --- a/worker_host/travis_worker/recipes/default.rb +++ b/worker_host/travis_worker/recipes/default.rb @@ -1,3 +1,11 @@+directory "#{node[:travis][:worker][:home]}" do + action :create + recursive true + owner "travis" + group "travis" + mode "0755" +end + git "#{node[:travis][:worker][:home]}" do repository node[:travis][:worker][:repository] reference node[:travis][:worker][:ref] @@ -17,7 +25,7 @@ end execute "bundle gems" do - command "rvm 1.9.2 do bundle install" + command "rvm 1.9.2 do bundle install --path vendor/bundle" user "travis" cwd node[:travis][:worker][:home] end
Create worker directory. Bundle into sub-dir.
diff --git a/test/unit/persistence_riak_dt_set_test.rb b/test/unit/persistence_riak_dt_set_test.rb index abc1234..def5678 100644 --- a/test/unit/persistence_riak_dt_set_test.rb +++ b/test/unit/persistence_riak_dt_set_test.rb @@ -0,0 +1,39 @@+## ------------------------------------------------------------------- +## +## Copyright (c) "2014" Dmitri Zagidulin +## +## This file is provided to you 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. +## +## ------------------------------------------------------------------- + +require 'test_helper' + +describe "a Riagent::ActiveDocument that persists via RiakDTSetStrategy" do + it "#model persistence instance methods" do + category = Category.new + + category.must_respond_to :save + category.must_respond_to :save! + category.must_respond_to :update + category.must_respond_to :update_attributes # alias for update() + category.must_respond_to :update! + category.must_respond_to :destroy + end + + it "#model persistence class methods" do + Category.persistence.must_respond_to :all + Category.persistence.must_respond_to :find + end +end
Add RiakDTSetStrategy persistence api test
diff --git a/test/lib/thermite/util_test.rb b/test/lib/thermite/util_test.rb index abc1234..def5678 100644 --- a/test/lib/thermite/util_test.rb +++ b/test/lib/thermite/util_test.rb @@ -1,4 +1,6 @@+require 'tempfile' require 'test_helper' +require 'thermite/config' require 'thermite/util' module Thermite
Fix require statements for util test
diff --git a/examples/blink_led.rb b/examples/blink_led.rb index abc1234..def5678 100644 --- a/examples/blink_led.rb +++ b/examples/blink_led.rb @@ -6,13 +6,14 @@ board.connect pin_number = 3 +rate = 0.5 10.times do board.digital_write pin_number, Firmata::Board::HIGH puts '+' - board.delay 0.5 + board.delay rate board.digital_write pin_number, Firmata::Board::LOW puts '-' - board.delay 0.5 + board.delay rate end
Add rate var for blink example.
diff --git a/test/integration/default/minitest/test_default.rb b/test/integration/default/minitest/test_default.rb index abc1234..def5678 100644 --- a/test/integration/default/minitest/test_default.rb +++ b/test/integration/default/minitest/test_default.rb @@ -7,6 +7,6 @@ it "check R version" do system('echo "q()" > /tmp/showversion.R') system('/usr/local/R-devel/bin/R CMD BATCH /tmp/showversion.R') - assert system('grep "R version 3.4.2 RC" showversion.Rout'), 'R version is not expected version. patched version is updated' + assert system('grep "R version 3.4.2 Patched" showversion.Rout'), 'R version is not expected version. patched version is updated' end end
Update R version for default
diff --git a/ext/lingua/extconf.rb b/ext/lingua/extconf.rb index abc1234..def5678 100644 --- a/ext/lingua/extconf.rb +++ b/ext/lingua/extconf.rb @@ -17,12 +17,15 @@ exit end end -# make this stuff -system "cd #{LIBSTEMMER}; #{make} libstemmer.o; cd #{ROOT};" -exit unless $? == 0 -$CFLAGS += " -I#{File.join(LIBSTEMMER, 'include')} " -$libs += " -L#{LIBSTEMMER} #{File.join(LIBSTEMMER, 'libstemmer.o')} " +# make libstemmer_c. unless we're cross-compiling. +unless RUBY_PLATFORM =~ /i386-mingw32/ + system "cd #{LIBSTEMMER}; #{make} libstemmer.o; cd #{ROOT};" + exit unless $? == 0 +end + +$CFLAGS += " -I#{File.expand_path(File.join(LIBSTEMMER, 'include'))} " +$libs += " -L#{LIBSTEMMER} #{File.expand_path(File.join(LIBSTEMMER, 'libstemmer.o'))} " if have_header("libstemmer.h") create_makefile("lingua/stemmer_native")
Expand paths for compiler flags Don't build libstemmer.o on windows - should be build manually
diff --git a/0_code_wars/is_valid_identifier.rb b/0_code_wars/is_valid_identifier.rb index abc1234..def5678 100644 --- a/0_code_wars/is_valid_identifier.rb +++ b/0_code_wars/is_valid_identifier.rb @@ -0,0 +1,18 @@+# http://www.codewars.com/kata/563a8656d52a79f06c00001f/train/ +# --- iteration 1 --- +def is_valid(idn) + return false if idn.size < 1 + return false unless /[a-z_$]/i === idn[0] + return false unless idn[1..-1].chars.all? { |n| /[a-z0-9_$]/i === n } + true +end + +# --- iteration 2 --- +def is_valid(idn) + /\A[a-z_$][a-z0-9_$]*\z/i === idn +end + +# --- iteration 3 --- +def is_valid(idn) + /\A[a-z_$][\w_$]*\z/i === idn +end
Add code wars (7) - is valid identifier
diff --git a/spec/ethon/easies/http/action_spec.rb b/spec/ethon/easies/http/action_spec.rb index abc1234..def5678 100644 --- a/spec/ethon/easies/http/action_spec.rb +++ b/spec/ethon/easies/http/action_spec.rb @@ -4,8 +4,22 @@ let(:easy) { Ethon::Easy.new } describe ".reset" do - let(:action) { Ethon::Easies::Http::Action } - before { action.reset(easy) } + before do + easy.url = "abc" + easy.httpget = 1 + easy.httppost = 1 + easy.upload = 1 + easy.nobody = 1 + easy.customrequest = 1 + easy.postfieldsize = 1 + easy.copypostfields = 1 + easy.infilesize = 1 + described_class.reset(easy) + end + + it "unsets url" do + easy.url.should be_nil + end it "unsets httpget" do easy.httpget.should be_nil @@ -26,5 +40,17 @@ it "unsets custom_request" do easy.customrequest.should be_nil end + + it "unsets postfieldsize" do + easy.postfieldsize.should be_nil + end + + it "unsets copypostfields" do + easy.copypostfields.should be_nil + end + + it "unsets infilesize" do + easy.infilesize.should be_nil + end end end
Add more specs for Action.reset.
diff --git a/spec/features/articles_edited_spec.rb b/spec/features/articles_edited_spec.rb index abc1234..def5678 100644 --- a/spec/features/articles_edited_spec.rb +++ b/spec/features/articles_edited_spec.rb @@ -0,0 +1,23 @@+# frozen_string_literal: true + +require 'rails_helper' + +describe 'Articles Edited view', type: :feature, js: true do + let(:course) { create(:course, start: '2017-01-01', end: '2020-01-01') } + let(:user) { create(:user, username: 'Ragesoss') } + let(:article) { create(:article, title: 'Nancy_Tuana') } + + before do + course.campaigns << Campaign.first + create(:courses_user, course: course, user: user) + create(:revision, article: article, user: user, date: '2019-01-01') + create(:articles_course, course: course, article: article, user_ids: [user.id]) + end + + it 'article development graphs fetch and render edit data' do + visit "/courses/#{course.slug}/articles" + expect(page).to have_content('Nancy Tuana') + find('a', text: '(article development)').click + expect(page).to have_content('Edit Size') + end +end
Add spec for opening the ArticleGraphs component This exercises a request that is being converted from jquery.ajax to `request`.
diff --git a/PullToMakeSoup.podspec b/PullToMakeSoup.podspec index abc1234..def5678 100644 --- a/PullToMakeSoup.podspec +++ b/PullToMakeSoup.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "PullToMakeSoup" - s.version = "1.0" + s.version = "1.1" s.summary = "Custom animated pull-to-refresh that can be easily added to UIScrollView" s.homepage = "http://yalantis.com/blog/how-we-built-customizable-pull-to-refresh-pull-to-cook-soup-animation/" @@ -16,7 +16,7 @@ s.ios.deployment_target = "8.0" - s.source = { :git => "https://github.com/Yalantis/PullToMakeSoup.git", :tag => "1.0" } + s.source = { :git => "https://github.com/Yalantis/PullToMakeSoup.git", :tag => "1.1" } s.source_files = "PullToMakeSoup/**/*.{h,m,swift}" s.resources = 'PullToMakeSoup/**/*.{svg,png,xib}' s.module_name = "PullToMakeSoup"
Update podspec to version 1.1
diff --git a/Casks/adobe-photoshop-lightroom571.rb b/Casks/adobe-photoshop-lightroom571.rb index abc1234..def5678 100644 --- a/Casks/adobe-photoshop-lightroom571.rb +++ b/Casks/adobe-photoshop-lightroom571.rb @@ -0,0 +1,19 @@+cask :v1 => 'adobe-photoshop-lightroom' do + version '5.7.1' + sha256 '155a91e2c90927a05ccaa244a99fed4784fa7cf26d08c634f5f111629f6b0418' + + url "http://download.adobe.com/pub/adobe/lightroom/mac/#{version.to_i}.x/Lightroom_#{version.to_i}_LS11_mac_#{version.gsub('.','_')}.dmg" + name 'Adobe Photoshop Lightroom' + homepage 'https://www.adobe.com/products/photoshop-lightroom.html' + license :commercial + + pkg "Adobe Photoshop Lightroom #{version.to_i}.pkg" + + uninstall :pkgutil => "com.adobe.Lightroom#{version.to_i}", + :quit => "com.adobe.Lightroom#{version.to_i}", + :delete => "/Applications/Adobe Photoshop Lightroom #{version.to_i}.app" + zap :delete => [ + '~/Library/Application Support/Adobe/Lightroom', + "~/Library/Preferences/com.adobe.Lightroom#{version.to_i}.plist", + ] +end
Migrate Lightroom 5.7.1 from homebrew-cask
diff --git a/spec/vidibus/recording/worker_spec.rb b/spec/vidibus/recording/worker_spec.rb index abc1234..def5678 100644 --- a/spec/vidibus/recording/worker_spec.rb +++ b/spec/vidibus/recording/worker_spec.rb @@ -19,15 +19,6 @@ pid end stub(Process).detach(pid) - end - - def process_alive?(pid) - begin - Process.kill(0, pid) - return true - rescue Errno::ESRCH - return false - end end describe '#start' do @@ -54,10 +45,19 @@ subject.start end - it 'should kill the process' do + it 'should terminate the process' do pid = subject.pid + mock(Process).kill('SIGTERM', pid) subject.stop - process_alive?(pid).should be_false + end + + it 'should kill the process after timeout' do + pid = subject.pid + stub(Timeout)::timeout(Vidibus::Recording::Worker::STOP_TIMEOUT) do + raise Timeout::Error + end + mock(Process).kill('KILL', pid) + subject.stop end end end
Enhance specs for worker killing
diff --git a/app/models/entry.rb b/app/models/entry.rb index abc1234..def5678 100644 --- a/app/models/entry.rb +++ b/app/models/entry.rb @@ -18,7 +18,8 @@ feed.entries.map do |hentry| find_or_create_from_hentry(hentry) end - rescue OpenURI::HTTPError, "304 Not Modified" + rescue OpenURI::HTTPError => e + raise e unless /304 Not Modified/ =~ e.message [] end
Fix feed reeding by properly rescuing error
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index abc1234..def5678 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1,5 +1,6 @@ class CoursesController < ApplicationController before_filter :authenticate_user! + before_filter :get_club, :only => [ :show_all ] before_filter :get_course, :only => [ :edit, :update ] def create @@ -28,7 +29,15 @@ respond_with_bip @course end + def show_all + @courses = @club.courses + end + private + + def get_club + @club = Club.find params[:club_id] + end def get_course @course = Course.find params[:id]
Add show_all Action to Courses Controller Update the Courses controller to include the show_all action.
diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index abc1234..def5678 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -7,7 +7,7 @@ handle = current_user.name if handle.blank? invite.accept(handle) - redirect_to game_path(invite.game) + redirect_to invite.game end def decline @@ -26,6 +26,6 @@ rescue UsageError => ex flash[:error] = ex.to_s end - redirect_to game_path(invite.game) + redirect_to invite.game end end
Simplify redirects in the InvitesController
diff --git a/app/models/spree/home_page_feature.rb b/app/models/spree/home_page_feature.rb index abc1234..def5678 100644 --- a/app/models/spree/home_page_feature.rb +++ b/app/models/spree/home_page_feature.rb @@ -16,7 +16,7 @@ validates_attachment_presence :image, unless: :body - scope :published, where(publish: true) + scope :published, -> { where publish: true } belongs_to :product belongs_to :taxon
Add Rails 4.1 new scope syntax
diff --git a/app/presenters/statistic_presenter.rb b/app/presenters/statistic_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/statistic_presenter.rb +++ b/app/presenters/statistic_presenter.rb @@ -29,7 +29,7 @@ ["land", "marine"].each do |type| stat = "percentage_pa_#{type}_cover".to_sym define_method(stat) do - (@statistic.send(stat) && @statistic.send(stat) > 100.0) ? 100.0 : @statistic.send(stat) + (@statistic.send(stat) && @statistic.send(stat) > 100.0) ? 100.0 : (@statistic.send(stat) || 0) rescue 0 end end
Handle other exceptions when statistic empty
diff --git a/app/view/webview.rb b/app/view/webview.rb index abc1234..def5678 100644 --- a/app/view/webview.rb +++ b/app/view/webview.rb @@ -6,6 +6,11 @@ end def dealloc + if self.loading? + self.stopLoading + end + self.delegate = nil + NSLog("dealloc: " + self.class.name) super end
Fix memory problem on UIWebView
diff --git a/Casks/intel-haxm.rb b/Casks/intel-haxm.rb index abc1234..def5678 100644 --- a/Casks/intel-haxm.rb +++ b/Casks/intel-haxm.rb @@ -1,12 +1,17 @@ cask :v1 => 'intel-haxm' do - version '1.0.8' - sha256 'cee233cf1a0293d9e19b15c375f2c4cb7cf0c6948b7fd579bec28719e0b51d35' + version '1.1.1' + sha256 'dd6dabfc34ebf73a19bc34eecfb5d8c4269773e3108ee6ef71ae2a5eacfd37d2' - url 'https://software.intel.com/sites/default/files/managed/68/45/haxm-macosx_r04.zip' + url 'https://software.intel.com/sites/default/files/managed/21/5f/haxm-macosx_r05.zip' homepage 'https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager' license :unknown - container :nested => "haxm-macosx_r04/IntelHAXM_#{version}.dmg" + if MacOS.version < :mavericks then + container :nested => "haxm-macosx_r05/IntelHAXM_#{version}_for_below_10_9.dmg" + else + container :nested => "haxm-macosx_r05/IntelHAXM_#{version}_for_10_9_and_above.dmg" + end + pkg "IntelHAXM_#{version}.mpkg" uninstall :script => {
Update Intel HAXM to version 1.1.1
diff --git a/Casks/virtualbox.rb b/Casks/virtualbox.rb index abc1234..def5678 100644 --- a/Casks/virtualbox.rb +++ b/Casks/virtualbox.rb @@ -1,8 +1,8 @@ class Virtualbox < Cask - url 'http://download.virtualbox.org/virtualbox/4.3.6/VirtualBox-4.3.6-91406-OSX.dmg' + url 'http://download.virtualbox.org/virtualbox/4.3.8/VirtualBox-4.3.8-92456-OSX.dmg' homepage 'http://www.virtualbox.org' - version '4.3.6-91406' - sha256 '60678b7cc7dc741b800cfc99c7ff73a185c548af877071eb82422f354e76bca2' + version '4.3.8-92456' + sha256 '2c9d9e9e96b91365cc7d8cd4d0211d0db5fc39d71c297359c6143956b1673f15' install 'VirtualBox.pkg' uninstall :script => { :executable => 'VirtualBox_Uninstall.tool', :args => %w[--unattended] } end
Update VirtualBox to version 4.3.8
diff --git a/EECircularMusicPlayerControl.podspec b/EECircularMusicPlayerControl.podspec index abc1234..def5678 100644 --- a/EECircularMusicPlayerControl.podspec +++ b/EECircularMusicPlayerControl.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "EECircularMusicPlayerControl" - s.version = "0.0.1" + s.version = "0.0.2" s.summary = "A control to play a music with a progress indicator." s.description = <<-DESC EECircularMusicPlayerControl is a UI control to play a music and to indicate its progress. It's easy to use in your project, and supports customization of the colors applied to the component parts.
Set the version of the podspec to 0.0.2.
diff --git a/guard-compass.gemspec b/guard-compass.gemspec index abc1234..def5678 100644 --- a/guard-compass.gemspec +++ b/guard-compass.gemspec @@ -6,14 +6,15 @@ s.name = 'guard-compass' s.version = Guard::CompassVersion::VERSION s.platform = Gem::Platform::RUBY - s.summary = 'Guard gem for Compass' - s.description = 'Guard::Compass automatically rebuilds scss|sass files when a modification occurs taking in account your compass configuration.' + s.license = 'MIT' s.authors = ['Olivier Amblet', 'Rémy Coutable'] s.email = ['remy@rymai.me'] - s.homepage = 'https://github.com/guard/guard-compass' + s.homepage = 'http://rubygems.org/gems/guard-compass' + s.summary = 'Guard plugin for Compass' + s.description = 'Guard::Compass automatically rebuilds scss|sass files when a modification occurs taking in account your compass configuration.' - s.add_dependency 'guard', '>= 1.8' - s.add_dependency 'compass', '>= 0.10.5' + s.add_runtime_dependency 'guard', '~> 2.0' + s.add_runtime_dependency 'compass', '>= 0.10.5' s.add_development_dependency 'bundler'
Update gemspec to depend on Guard ~> 2.0
diff --git a/Library/Homebrew/build_environment.rb b/Library/Homebrew/build_environment.rb index abc1234..def5678 100644 --- a/Library/Homebrew/build_environment.rb +++ b/Library/Homebrew/build_environment.rb @@ -29,11 +29,11 @@ end def _dump(*) - @settings.to_a.join(":") + Marshal.dump(@settings) end def self._load(s) - new(*s.split(":").map(&:to_sym)) + new(Marshal.load(s)) end end
Remove knowledge of serialization details by marshaling twice
diff --git a/app/controllers/boa_vista_stubs/requests_controller.rb b/app/controllers/boa_vista_stubs/requests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/boa_vista_stubs/requests_controller.rb +++ b/app/controllers/boa_vista_stubs/requests_controller.rb @@ -5,15 +5,15 @@ document = Document.identify(params[:consulta]) if document.valid? - decorate(document).valid + document_response(document).valid else - decorate(document).invalid + document_response(document).invalid end end - def decorate(document) + def document_response(document) # Returns a instance of DocumentDecorator::CPF or DocumentDecorator::CNPJ - DocumentDecorator.decorate(document) + Document::Response.new(document) end end end
Update to return a document response
diff --git a/app/app_delegate.rb b/app/app_delegate.rb index abc1234..def5678 100644 --- a/app/app_delegate.rb +++ b/app/app_delegate.rb @@ -40,6 +40,6 @@ def applicationDidBecomeActive(application) @stories_controller.loadData - @stories_controller.tableView.setContentOffset(CGPoint.new) + @stories_controller.tableView.setContentOffset(CGPoint.new(0,44)) end end
Hide the search on load
diff --git a/app/models/round.rb b/app/models/round.rb index abc1234..def5678 100644 --- a/app/models/round.rb +++ b/app/models/round.rb @@ -2,7 +2,7 @@ include YearlyModel belongs_to :tournament - has_many :game_appointments, dependent: :destroy + has_many :game_appointments, -> { order(:table) }, dependent: :destroy validates :number, presence: true validates :number, uniqueness: { scope: :tournament_id, message: "A round with that number already exists for the tournament."} validates :start_time, presence: true
Add default scope for game appointments to order by table
diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb index abc1234..def5678 100644 --- a/config/initializers/active_storage.rb +++ b/config/initializers/active_storage.rb @@ -7,4 +7,4 @@ Rails.application.config.active_storage.variable_content_types << 'image/svg+xml' -# Rails.application.config.active_storage.variant_processor = :vips +Rails.application.config.active_storage.variant_processor = :vips if ENV['ACTIVESTORAGE_ENABLE_VIPS'] == 'true'
Allow use of libvips through env variable [SCI-3881]
diff --git a/app/controllers/officing/voters_controller.rb b/app/controllers/officing/voters_controller.rb index abc1234..def5678 100644 --- a/app/controllers/officing/voters_controller.rb +++ b/app/controllers/officing/voters_controller.rb @@ -20,6 +20,7 @@ poll: @poll, origin: "booth", officer: current_user.poll_officer, + booth_assignment: Poll::BoothAssignment.where(poll: @poll, booth: current_booth).first, officer_assignment: officer_assignment(@poll)) @voter.save! end @@ -35,6 +36,7 @@ .by_poll(poll) .by_booth(current_booth) .by_date(Date.current) + .where(final: false) .first end
Set booth and officer assignments to Poll Voter on officing panel
diff --git a/app/controllers/source_download_controller.rb b/app/controllers/source_download_controller.rb index abc1234..def5678 100644 --- a/app/controllers/source_download_controller.rb +++ b/app/controllers/source_download_controller.rb @@ -6,7 +6,7 @@ if @source.source? send_data @source.source, disposition: 'attachment', filename: @source.filename else - render layout: false + raise ActiveRecord::RecordNotFound end end end
Raise ActiveRecord::RecordNotFound if source is not imported
diff --git a/app/helpers/obs_factory/application_helper.rb b/app/helpers/obs_factory/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/obs_factory/application_helper.rb +++ b/app/helpers/obs_factory/application_helper.rb @@ -4,7 +4,8 @@ # Catch some url helpers used in the OBS layout and forward them to # the main application %w(root_path project_show_path search_path user_show_url user_show_path user_logout_path - news_feed_path project_list_public_path monitor_path).each do |m| + user_login_path user_register_user_path user_do_login_path news_feed_path + project_list_public_path monitor_path).each do |m| define_method(m) do |*args| main_app.send(m, *args) end
Add missing url_helpers used in the OBS layout
diff --git a/config/initializers/airbrake.rb b/config/initializers/airbrake.rb index abc1234..def5678 100644 --- a/config/initializers/airbrake.rb +++ b/config/initializers/airbrake.rb @@ -1,6 +1,6 @@ Airbrake.configure do |config| config.project_key = ENV['ECHO_TRELLO_AIRBRAKE_API'] || "airbrake-api-key" - config.project_id = true + config.project_id = ENV['ECHO_TRELLO_AIRBRAKE_PROJECT_ID'] || "airbrake-project-id" config.host = ENV['ECHO_TRELLO_AIRBRAKE_HOST'] || "https://test.airbrake.io/" config.environment = Rails.env config.ignore_environments = %w(development test)
Fix the project_id setting for Airbrake This changed recently in Airbrake 1.4.1, so a project ID needs to be set properly.
diff --git a/db/migrate/016_create_album_tracks.rb b/db/migrate/016_create_album_tracks.rb index abc1234..def5678 100644 --- a/db/migrate/016_create_album_tracks.rb +++ b/db/migrate/016_create_album_tracks.rb @@ -0,0 +1,14 @@+class CreateAlbumTracks < ActiveRecord::Migration[4.2] + def self.up + create_table :album_tracks do |a| + a.uuid :track_id, :null => false + a.uuid :album_id, :null => false + a.timestamps + end + add_index :album_tracks, [:track_id, :album_id], :unique => true + end + + def self.down + drop_table :album_tracks + end +end
Add migration that creates album_tracks table
diff --git a/lib/active_record/acts_as/querying.rb b/lib/active_record/acts_as/querying.rb index abc1234..def5678 100644 --- a/lib/active_record/acts_as/querying.rb +++ b/lib/active_record/acts_as/querying.rb @@ -28,10 +28,8 @@ module ScopeForCreate def scope_for_create(attributes = nil) - scope = ActiveRecord.version.to_s.to_f >= 5.2 ? super(attributes) : where_values_hash - if acting_as? - scope.merge!(where_values_hash(acting_as_model.table_name)) - end + scope = respond_to?(:values_for_create) ? values_for_create(attributes) : where_values_hash + scope.merge!(where_values_hash(acting_as_model.table_name)) if acting_as? scope.merge(create_with_value) end end
Use activerecord `values_for_create` to replace `scope_for_create` In relation to the changes in `activerecord` version `5.2.2` in using `scope_for_create` (https://github.com/rails/rails/pull/33639/files), we must use the new method `values_for_create` provided.
diff --git a/lib/collective/collectors/postgres.rb b/lib/collective/collectors/postgres.rb index abc1234..def5678 100644 --- a/lib/collective/collectors/postgres.rb +++ b/lib/collective/collectors/postgres.rb @@ -7,7 +7,7 @@ resolution '600s' collect do - group 'postgres' do |group| + group "postgres.#{connection_options[:dbname]}" do |group| instrument_relation_size_data group end end @@ -15,12 +15,15 @@ private def instrument_relation_size_data(group) - conn = PG.connect(connection_options) - size_tuples = conn.exec(size_query) - size_tuples.each do |tuple| - group.instrument tuple['relation'], (tuple['total_size'].to_f / MEGABYTE).round(2), units: 'MB' + begin + conn = PG.connect(connection_options) + size_tuples = conn.exec(size_query) + size_tuples.each do |tuple| + group.instrument "#{tuple['relation']}.size", (tuple['total_size'].to_f / MEGABYTE).round(2), units: 'MB' + end + ensure + conn.close end - conn.close end def size_query
Change metric names, add begin/ensure around conn
diff --git a/lib/data_mapper/support/graph/edge.rb b/lib/data_mapper/support/graph/edge.rb index abc1234..def5678 100644 --- a/lib/data_mapper/support/graph/edge.rb +++ b/lib/data_mapper/support/graph/edge.rb @@ -8,7 +8,7 @@ @name = name.to_sym @left = left @right = right - @nodes = Set.new([ @left, @right ]) + @nodes = Set[ left, right ] end def connects?(node)
Simplify set creation in Graph::Edge
diff --git a/scripts/migrate_to_single_object_db.rb b/scripts/migrate_to_single_object_db.rb index abc1234..def5678 100644 --- a/scripts/migrate_to_single_object_db.rb +++ b/scripts/migrate_to_single_object_db.rb @@ -0,0 +1,20 @@+#!/usr/bin/env ruby +# Migrates .yardocs to --single-db +$:.unshift(File.dirname(__FILE__) + '/../') +$:.unshift(File.dirname(__FILE__) + '/../lib') +$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../yard/lib')) + +require 'yard' +require 'init' + +include YARD + +[File.join(REPOS_PATH, '*', '*', '*'), File.join(REMOTE_GEMS_PATH, '*', '*', '*')].each do |dir| + Dir[dir].each do |d| + puts ">> Migrating .yardoc to single db for #{d}" + Dir.chdir(d) + Registry.load! + Registry.save + `touch .yardoc/complete` + end +end
Add script to migrate object dbs
diff --git a/Formula/mlton.rb b/Formula/mlton.rb index abc1234..def5678 100644 --- a/Formula/mlton.rb +++ b/Formula/mlton.rb @@ -5,11 +5,13 @@ # would require an existing ML compiler/interpreter for bootstrapping. class Mlton < Formula - # the dynamic macports version works fine with Homebrew's gmp - url 'http://mlton.org/pages/Download/attachments/mlton-20100608-1.amd64-darwin.gmp-macports.tgz' + url 'http://mlton.org/pages/Download/attachments/mlton-20100608-1.amd64-darwin.gmp-static.tgz' + version '20100608-1' homepage 'http://mlton.org' - md5 'e9007318bb77c246258a53690b1d3449' + md5 'd32430f2b66f05ac0ef6ff087ea109ca' + # We download and install the version of MLton which is statically linked to libgmp, but all + # generated executables will require gmp anyway, hence the dependency depends_on 'gmp' skip_clean :all
Make MLton formula install statically-linked-gmp Closes Homebrew/homebrew#9529 Signed-off-by: Misty De Meo <85d6b3741948526aebc363d97f74b6575b2cc027@gmail.com>
diff --git a/lib/puppet/parser/functions/upcase.rb b/lib/puppet/parser/functions/upcase.rb index abc1234..def5678 100644 --- a/lib/puppet/parser/functions/upcase.rb +++ b/lib/puppet/parser/functions/upcase.rb @@ -31,8 +31,8 @@ result = value.collect { |i| i.is_a?(String) ? i.upcase : i } elsif value.is_a?(Hash) result = {} - result << value.each_pair do |k, v| - return {k.upcase => v.collect! { |p| p.upcase }} + value.each_pair do |k, v| + result.merge!({k.upcase => v.collect! { |p| p.upcase }}) end else result = value.upcase
Fix issue with Ruby 1.8.7 which did not allow for the return in an each_pair of the hash
diff --git a/lib/shield/contrib/sinatra/default.rb b/lib/shield/contrib/sinatra/default.rb index abc1234..def5678 100644 --- a/lib/shield/contrib/sinatra/default.rb +++ b/lib/shield/contrib/sinatra/default.rb @@ -33,10 +33,10 @@ m.post "/login" do if login(User, params[:username], params[:password]) - redirect settings.shield_redirect_after_login + redirect_to_stored(settings.shield_redirect_after_login) else session[:error] = settings.shield_auth_failure - redirect "/login" + redirect_to_login end end
Fix the redirection login in the /login route.
diff --git a/lib/table_cloth/presenters/default.rb b/lib/table_cloth/presenters/default.rb index abc1234..def5678 100644 --- a/lib/table_cloth/presenters/default.rb +++ b/lib/table_cloth/presenters/default.rb @@ -20,7 +20,7 @@ end def render_td(column, object) - td_options = column.options.delete(:td_options) || {} + td_options = column.options[:td_options] || {} value = column.value(object, view_context, table) if value.is_a?(Array)
Fix so that options are passed to each row