diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,4 @@ class User < ActiveRecord::Base - # Include default devise modules. Others available are: - # :token_authenticatable, :confirmable, :lockable and :timeoutable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticateable, :confirmable, :lockable
Trim out devise options comment
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,9 +12,7 @@ validates_length_of :bio, :maximum => 120 def full_name - if first_name and last_name - [first_name, last_name].join(' ') - end + [first_name, last_name].join(' ') if first_name && last_name end def full_name=(name='') @@ -24,14 +22,9 @@ end def self.roles - user_roles = [] - roles = ['developer', 'designer', 'hacker', 'entrepreneur', 'artist', 'business'] - - roles.each do |role| - user_roles.push([role.titlecase, role]) + %w(developer designer hacker entrepreneur artist business).map do |role| + [role.titlecase, role] end - - return user_roles end def self.find_first_by_auth_conditions(warden_conditions)
Refactor roles method to avoid creating temp array every time is called
diff --git a/rom-repository.gemspec b/rom-repository.gemspec index abc1234..def5678 100644 --- a/rom-repository.gemspec +++ b/rom-repository.gemspec @@ -16,7 +16,7 @@ gem.license = 'MIT' gem.add_runtime_dependency 'anima', '~> 0.2', '>= 0.2' - gem.add_runtime_dependency 'rom', '~> 0.9.0.beta1' + gem.add_runtime_dependency 'rom', '~> 0.9', '>= 0.9.0' gem.add_runtime_dependency 'rom-support', '~> 0.1', '>= 0.1.0' gem.add_runtime_dependency 'rom-mapper', '~> 0.2', '>= 0.2.0'
Update rom dep in gemspec
diff --git a/spec/lib/sendgrid_toolkit/common_spec.rb b/spec/lib/sendgrid_toolkit/common_spec.rb index abc1234..def5678 100644 --- a/spec/lib/sendgrid_toolkit/common_spec.rb +++ b/spec/lib/sendgrid_toolkit/common_spec.rb @@ -23,7 +23,7 @@ # this will only really test it on a computer that's on on utc. describe 'retrieve_with_timestamps' do it 'should parse the created date in utc' do - FakeWeb.register_uri(:post, %r|https://sendgrid\.com/api/fakeclass\.get\.json\?.*date=1|, :body => '[{"created":"2013-11-25 13:00:00"}]') + FakeWeb.register_uri(:post, %r|https://#{REGEX_ESCAPED_BASE_URI}/fakeclass\.get\.json\?.*date=1|, :body => '[{"created":"2013-11-25 13:00:00"}]') fake_class = @fake_class.retrieve_with_timestamps fake_class[0]['created'].utc.iso8601.should == "2013-11-25T13:00:00Z" end
Update specs from prior pull request to work with generic sendgrid URI as implemented before merge.
diff --git a/lib/rails/generators/shadmin/resource/templates/controllers/shadmin_controller.rb b/lib/rails/generators/shadmin/resource/templates/controllers/shadmin_controller.rb index abc1234..def5678 100644 --- a/lib/rails/generators/shadmin/resource/templates/controllers/shadmin_controller.rb +++ b/lib/rails/generators/shadmin/resource/templates/controllers/shadmin_controller.rb @@ -1,6 +1,24 @@ module Admin class <%= resource_name.classify %>Controller < Shadmin::ApplicationController - # def index - # end + def index + end + + def show + end + + def new + end + + def create + end + + def edit + end + + def update + end + + def destroy + end end end
Include all restful actions in controller template
diff --git a/spec/libraries/form_for_resource_spec.rb b/spec/libraries/form_for_resource_spec.rb index abc1234..def5678 100644 --- a/spec/libraries/form_for_resource_spec.rb +++ b/spec/libraries/form_for_resource_spec.rb @@ -9,8 +9,18 @@ end.to raise_error(ArgumentError) end + it 'requires :resource to be a symbol' do + expect do + form_for(build(:course), resource: 'course') {} + end.to raise_error(ArgumentError) + end + + it 'automatically adds the `path` suffix for route helpers' do + expect(form_for(build(:course), resource: :course) {}).to have_form(courses_path, :post) + end + context 'when the resource is new' do - subject { form_for(build(:course), resource: :course) {} } + subject { form_for(build(:course), resource: :course_path) {} } it 'generates the plural route' do expect(subject).to have_form(courses_path, :post) end @@ -18,7 +28,7 @@ context 'when the resource is persisted' do let(:course) { create(:course) } - subject { form_for(course, resource: :course) {} } + subject { form_for(course, resource: :course_path) {} } it 'generates the singular route' do expect(subject).to have_form(course_path(course), :post) end
Add extra specifications for automatic `path` suffix and requiring that the stem be a symbol.
diff --git a/test/components/builders_test.rb b/test/components/builders_test.rb index abc1234..def5678 100644 --- a/test/components/builders_test.rb +++ b/test/components/builders_test.rb @@ -12,7 +12,7 @@ result = copyartifact( project: 'upstream-project', which_build: 'last-successful', - target: 'dest_dir' + target: 'dest_dir', do_not_fingerprint: true ) expected = {
Fix a typo in the test for copyartifact
diff --git a/spec/support/devise.rb b/spec/support/devise.rb index abc1234..def5678 100644 --- a/spec/support/devise.rb +++ b/spec/support/devise.rb @@ -1,4 +1,5 @@ RSpec.configure do |config| - # Add Devise's helpers for controller tests + # Add Devise's helpers for controller and view tests config.include Devise::Test::ControllerHelpers, type: :controller + config.include Devise::Test::ControllerHelpers, type: :view end
Add Devise's helpers to View specs as suggested
diff --git a/test/liquid/tags/raw_tag_test.rb b/test/liquid/tags/raw_tag_test.rb index abc1234..def5678 100644 --- a/test/liquid/tags/raw_tag_test.rb +++ b/test/liquid/tags/raw_tag_test.rb @@ -20,5 +20,6 @@ assert_template_result ' Foobar {% invalid {% {% endraw ', '{% raw %} Foobar {% invalid {% {% endraw {% endraw %}' assert_template_result ' Foobar {% {% {% ', '{% raw %} Foobar {% {% {% {% endraw %}' assert_template_result ' test {% raw %} {% endraw %}', '{% raw %} test {% raw %} {% {% endraw %}endraw %}' + assert_template_result ' Foobar {{ invalid 1', '{% raw %} Foobar {{ invalid {% endraw %}{{ 1 }}' end end
Add regression test for raw tags with open variable tags.
diff --git a/db/migrate/20200713114812_remove_fk_constraints_for_cross_shard_root_account_ids.rb b/db/migrate/20200713114812_remove_fk_constraints_for_cross_shard_root_account_ids.rb index abc1234..def5678 100644 --- a/db/migrate/20200713114812_remove_fk_constraints_for_cross_shard_root_account_ids.rb +++ b/db/migrate/20200713114812_remove_fk_constraints_for_cross_shard_root_account_ids.rb @@ -0,0 +1,27 @@+# +# Copyright (C) 2020 - present Instructure, Inc. +# +# This file is part of Canvas. +# +# Canvas is free software: you can redistribute it and/or modify +# the terms of the GNU Affero General Public License as publishe +# Software Foundation, version 3 of the License. +# +# Canvas is distributed in the hope that it will be useful, but +# WARRANTY; without even the implied warranty of MERCHANTABILITY +# A PARTICULAR PURPOSE. See the GNU Affero General Public Licens +# details. +# +# You should have received a copy of the GNU Affero General Publ +# with this program. If not, see <http://www.gnu.org/licenses/>. + +class RemoveFkConstraintsForCrossShardRootAccountIds < ActiveRecord::Migration[5.2] + tag :predeploy + + def change + remove_foreign_key :attachment_associations, :accounts, column: :root_account_id, if_exists: true + remove_foreign_key :attachments, :accounts, column: :root_account_id, if_exists: true + remove_foreign_key :communication_channels, :accounts, column: :root_account_id, if_exists: true + remove_foreign_key :folders, :accounts, column: :root_account_id, if_exists: true + end +end
Remove FK constraints for possibly global RA ids root_account_id on these tables can be cross-shard, so cannot have an FK constraint. Test plan: - run migration and make sure you can set root_account_id to a global ID e.g. 10000000000001 on an Attachment, AttachmentAssociation, Folder, CommunicationChannel (this one you need to use update_all() with SQL to avoid validations apparently) - run `rake db:migrate:down VERSION=20200713114812` and make sure that you can not set root_Account to a global ID anymove Change-Id: Ibcb8b54d1ba3af96bf4fad64a8ea3b7e4a613c2e Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242500 Reviewed-by: Weston Dransfield <e9203059795dc94e28a8831c65eb7869e818825e@instructure.com> Reviewed-by: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com> QA-Review: Weston Dransfield <e9203059795dc94e28a8831c65eb7869e818825e@instructure.com> QA-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com> Product-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com> Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com>
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,6 @@ module ApplicationHelper def set_title(title) - content_for :title, strip_tags(title) + content_for :title, strip_tags(title).html_safe end def page_heading(tag, heading)
Fix html escaping in some titles.
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,7 +5,7 @@ end def languages - I18n.fallbacks.keys.concat(I18n.available_locales).uniq + [:fi, :en, :se].concat(I18n.available_locales).uniq end end
Fix languages list to work even if fallbacks is disabled
diff --git a/app/helpers/safe_params_helper.rb b/app/helpers/safe_params_helper.rb index abc1234..def5678 100644 --- a/app/helpers/safe_params_helper.rb +++ b/app/helpers/safe_params_helper.rb @@ -1,6 +1,6 @@ module SafeParamsHelper - # Rails 5.0 requires to permit parameters if used in url helpers. - # User this helper when generating links with `params.merge(...)` + # Rails 5.0 requires to permit `params` if they're used in url helpers. + # Use this helper when generating links with `params.merge(...)` def safe_params if params.respond_to?(:permit!) params.except(:host, :port, :protocol).permit!
Fix typos in comments [ci skip]
diff --git a/app/models/article_endorsement.rb b/app/models/article_endorsement.rb index abc1234..def5678 100644 --- a/app/models/article_endorsement.rb +++ b/app/models/article_endorsement.rb @@ -6,8 +6,8 @@ after_create :send_endorsement - validates :article_id, uniqueness: { - scope: :user_id, message: "already exists for user" + validates :user_id, uniqueness: { + scope: :article_id, message: "has already endorsed this article" } def send_endorsement
Validate the user association instead
diff --git a/app/models/project/invitations.rb b/app/models/project/invitations.rb index abc1234..def5678 100644 --- a/app/models/project/invitations.rb +++ b/app/models/project/invitations.rb @@ -1,4 +1,4 @@-require_dependency 'extract_emails' +require 'extract_emails' class Project
Use 'require', not 'require_dependency' in extract_emails
diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb index abc1234..def5678 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb @@ -3,31 +3,32 @@ module QA context 'Plan' do describe 'collapse comments in issue discussions' do - let(:issue_title) { 'issue title' } + let(:my_first_reply) { 'My first reply' } - it 'user collapses reply for comments in an issue' do + before do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) issue = Resource::Issue.fabricate_via_api! do |issue| - issue.title = issue_title + issue.title = 'issue title' end issue.visit! - expect(page).to have_content(issue_title) - Page::Project::Issue::Show.perform do |show_page| - my_first_discussion = "My first discussion" - my_first_reply = "My First Reply" - one_reply = "1 reply" + my_first_discussion = 'My first discussion' show_page.select_all_activities_filter show_page.start_discussion(my_first_discussion) - expect(show_page).to have_content(my_first_discussion) + page.assert_text(my_first_discussion) + show_page.reply_to_discussion(my_first_reply) + page.assert_text(my_first_reply) + end + end - show_page.reply_to_discussion(my_first_reply) - expect(show_page).to have_content(my_first_reply) + it 'user collapses and expands reply for comments in an issue' do + Page::Project::Issue::Show.perform do |show_page| + one_reply = "1 reply" show_page.collapse_replies expect(show_page).to have_content(one_reply)
Refactor collapse comments end-to-end test To: - Better separate scopes (pre-conditions on before, tests on it) - Remove unnecessary expectation - Replace other unnecessary expectations by page.assert_text - Move variables closer to where they're used
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,4 +1,5 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception include SessionsHelper + include ItemsHelper end
Include ItemsHelper within ApplicationController so that the entire application has access to finding items
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,8 +4,8 @@ before_filter :set_our_current_user def index - @repositories = AqRepository.find(:all) - @commits = AqCommit.find(:all, :order => "committed_time DESC") + @repositories = AqRepository.public + @commits = AqCommit.of_public_repositories.order("committed_time DESC") end def repositories
Select only public repositories and commits of
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,15 +3,22 @@ # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception helper_method :resource_name, :resource, :devise_mapping + skip_before_action :verify_authenticity_token, if: :json_request? def resource_name - :user - end + :user + end - def resource - @resource ||= User.new - end + def resource + @resource ||= User.new + end - def devise_mapping - @devise_mapping ||= Devise.mappings[:user] - end + def devise_mapping + @devise_mapping ||= Devise.mappings[:user] + end + + protected + def json_request? + request.format.json? + end + end
Disable CSRF for JSON API
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,9 +1,14 @@ class ApplicationController < ActionController::Base + protect_from_forgery with: :exception respond_to :json, :html + + devise_group :user, contains: [:developer, :recruiter] + + before_action :set_raven_context, if: :tracking? + before_action :store_current_location, unless: :devise_controller? + before_action :configure_permitted_parameters, if: :devise_controller? + include Tokenizeable - protect_from_forgery with: :exception - devise_group :user, contains: [:developer, :recruiter] - before_action :configure_permitted_parameters, if: :devise_controller? protected @@ -17,4 +22,38 @@ def render_unauthorised render json: { errors: [ message: 'Unauthorised'] }, status: 401 end + + private + + def tracking? + Rails.env.production? + end + + def set_raven_context + current_user_context = if user_signed_in? + { + id: current_user.id, + email: current_user.email, + type: current_user.class.name.downcase + } + else + {} + end + + Raven.user_context(current_user_context) + Raven.extra_context(params: params.to_h, url: request.url) + end + + # after login and logout path + def store_current_location + store_location_for(:user, request.referrer) + end + + def after_sign_out_path_for(_resource) + request.referrer || root_path + end + + def after_sign_in_path_for(resource) + request.env['omniauth.origin'] || stored_location_for(resource) || root_path + end end
Add current user to sentry
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -18,7 +18,7 @@ end def user_not_authorized - flash[:alert] = "Access denied." + flash[:alert] = "Sorry, you don't have the permissions to do that." redirect_to (request.referrer || root_path) end
Write nicer unauthorized flash message
diff --git a/app/controllers/newsletters_controller.rb b/app/controllers/newsletters_controller.rb index abc1234..def5678 100644 --- a/app/controllers/newsletters_controller.rb +++ b/app/controllers/newsletters_controller.rb @@ -14,7 +14,7 @@ end def raw - token = EmailNewsletter.token(full_token) + token = EmailNewsletter.token(params[:token]) if AuthenticationToken.newsletters.active.where(token: token).exists? NewsletterReceiver.perform_async(params[:token], decoded(request.body.read)) end
Switch to shared token parser.
diff --git a/app/helpers/admin/consultations_helper.rb b/app/helpers/admin/consultations_helper.rb index abc1234..def5678 100644 --- a/app/helpers/admin/consultations_helper.rb +++ b/app/helpers/admin/consultations_helper.rb @@ -1,13 +1,9 @@ module Admin::ConsultationsHelper def consulation_response_help_text(response) if response.is_a?(ConsultationOutcome) - "Here you can publish the final outcome of the consultation. - Either provide the full details of the outcome below, or provide - a summary here and upload the full outcome as an attachment once you have saved a summary." + "You can add attachments after saving this page." else - "Here you can publish the feedback received from the public on this consultation. - Once you have saved a summary, you will be able to upload attachments containing their feedback. - Note that publishing public feedback is optional" + "Optional - publish the feedback received from the public. You can add attachments after saving this page." end end end
Change wording of hints on consultation forms After discussion with Alice, we think this wording is more succinct. The key concern is to alert people to the fact that they can upload attachments on the next page, so a shorter message gives more chance that they'll read this info.
diff --git a/app/controllers/alliances_controller.rb b/app/controllers/alliances_controller.rb index abc1234..def5678 100644 --- a/app/controllers/alliances_controller.rb +++ b/app/controllers/alliances_controller.rb @@ -25,7 +25,7 @@ def create if student_union_employee? @alliance = @user.alliances.create! params[:alliance] - @alliance.alliance_memberships.each{|membership| AllianceMailer.confirmation_email(membership, @university, university_path(university: @university.key))} + @alliance.alliance_memberships.each{|membership| AllianceMailer.confirmation_email(membership, @university, university_path(university: @university.key)).deliver } end end
Fix delivery of alliance confirmations
diff --git a/app/controllers/gameplays_controller.rb b/app/controllers/gameplays_controller.rb index abc1234..def5678 100644 --- a/app/controllers/gameplays_controller.rb +++ b/app/controllers/gameplays_controller.rb @@ -15,8 +15,11 @@ def destroy night = Night.find(params[:night_id]) + gp_name = Gameplay.find(params[:id]).game.name night.gameplays.destroy(Gameplay.find(params[:id])) - redirect_to night_url(night) + respond_to do |format| + format.html { redirect_to(night, notice: "Gameplay for #{gp_name} successfully removed.") } + end end end
Clean up delete a little
diff --git a/ui_speech_cerevoice.rb b/ui_speech_cerevoice.rb index abc1234..def5678 100644 --- a/ui_speech_cerevoice.rb +++ b/ui_speech_cerevoice.rb @@ -14,7 +14,7 @@ def say(text) text = munge(text) speech_file = @cerevoice.render_speech(text) - system "mpg321 #{speech_file} &" + system "killall -q mpg321; mpg321 #{speech_file} &" end def prepare(text) @@ -26,7 +26,7 @@ def say_wait(text) text = munge(text) speech_file = @cerevoice.render_speech(text) - system "mpg321 #{speech_file}" + system "killall -q mpg321; mpg321 #{speech_file}" end end -end+end
Kill any previous speech process before starting a new one.
diff --git a/tasks/_default_task.rb b/tasks/_default_task.rb index abc1234..def5678 100644 --- a/tasks/_default_task.rb +++ b/tasks/_default_task.rb @@ -5,4 +5,4 @@ require 'rake' -task default: :gem +task :default => :gem
Make syntax Ruby 1.8 compatible.
diff --git a/util/build_entities.rb b/util/build_entities.rb index abc1234..def5678 100644 --- a/util/build_entities.rb +++ b/util/build_entities.rb @@ -0,0 +1,28 @@+#!/usr/bin/env ruby +require 'open-uri' +require 'uri' + +DTD_URI = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd' +entities = {} + +dtd = open(DTD_URI){ |io| io.read } +dtd.scan(/<!ENTITY \s+ % \s+ (\w+) \s+ PUBLIC \s+ "(.*?)" \s+ "(.*?)" \s* >/x) do |m| + entity = open(URI.parse(DTD_URI).merge(m[2]).to_s){ |io| io.read } + entity.scan(/<!ENTITY \s+ (\w+) \s+ "\&\#(.*?);" \s*>/x) do |m| + name, codepoint = m + case codepoint + when /^\d/ + entities[name] = codepoint.to_i + when /^x\d/ + entities[name] = codepoint[1,-1].to_i(16) + end + end +end + +puts "module HTMLEntities" +puts " module Data" +puts " MAP = {" +puts(entities.keys.sort_by{ |s| [s.downcase, s] }.map{ |name| " '#{name}' => #{entities[name]}" }.join(",\n")) +puts " }" +puts " end" +puts "end"
Build entities map from W3C DTD.
diff --git a/cookbooks/zookeeper_cluster/metadata.rb b/cookbooks/zookeeper_cluster/metadata.rb index abc1234..def5678 100644 --- a/cookbooks/zookeeper_cluster/metadata.rb +++ b/cookbooks/zookeeper_cluster/metadata.rb @@ -8,8 +8,6 @@ depends "java" depends "apt" -depends "mountable_volumes" -depends "provides_service" recipe "zookeeper::client", "Installs Zookeeper client libraries" recipe "zookeeper::default", "Base configuration for zookeeper"
Remove 2 dependencies on provides_service and mountable_volumes from zookeeper. These just don't exist anywhere and they break bulk cookbook uploads Former-commit-id: f768344564a6ce0797f36da723c754f01cc60805
diff --git a/juniper-staging.rb b/juniper-staging.rb index abc1234..def5678 100644 --- a/juniper-staging.rb +++ b/juniper-staging.rb @@ -6,5 +6,6 @@ template_file = config['template_file'] unless File.file?(template_file) puts "ERROR: Check the template_file configuration variable is correct (points to a valid template's filename) in #{ARGV[0]}" + abort end
Abort the script with an error signal if the template file doesn't seem to exist
diff --git a/spec/front_matter_parser/loader/yaml_spec.rb b/spec/front_matter_parser/loader/yaml_spec.rb index abc1234..def5678 100644 --- a/spec/front_matter_parser/loader/yaml_spec.rb +++ b/spec/front_matter_parser/loader/yaml_spec.rb @@ -5,7 +5,7 @@ describe FrontMatterParser::Loader::Yaml do describe '::call' do it 'loads using yaml parser' do - string = "{title: 'hello'}" + string = "title: 'hello'" expect(described_class.call(string)).to eq( 'title' => 'hello'
Fix test not reflecting a real scenario
diff --git a/lib/acfs/errors.rb b/lib/acfs/errors.rb index abc1234..def5678 100644 --- a/lib/acfs/errors.rb +++ b/lib/acfs/errors.rb @@ -2,6 +2,22 @@ # Acfs base error. # - class Error < StandardError; end + class Error < StandardError + end + + # Response error containing the responsible response object. + # + class ErroneousResponse < Error + attr_accessor :response + + def initialize(response) + self.response = response + end + end + + # Resource not found error raised on a 404 response + # + class ResourceNotFound < ErroneousResponse + end end
Add error classes for not found resources and failed responses.
diff --git a/test/server/metrics.rb b/test/server/metrics.rb index abc1234..def5678 100644 --- a/test/server/metrics.rb +++ b/test/server/metrics.rb @@ -2,7 +2,7 @@ MIN = { test_count:1, app_coverage:100, - test_coverage:100, + test_coverage:99, line_ratio:2.4, hits_ratio:1.0 }
Drop test-coverage limit (of test) to 99%; on CI output varies
diff --git a/test/spec_rack_lock.rb b/test/spec_rack_lock.rb index abc1234..def5678 100644 --- a/test/spec_rack_lock.rb +++ b/test/spec_rack_lock.rb @@ -20,21 +20,19 @@ specify "should call synchronize on lock" do lock = Lock.new env = Rack::MockRequest.env_for("/") - app = Rack::Lock.new(lambda { }, lock) + app = Rack::Lock.new(lambda { |env| }, lock) lock.synchronized.should.equal false app.call(env) lock.synchronized.should.equal true end specify "should set multithread flag to false" do - env = Rack::MockRequest.env_for("/") app = Rack::Lock.new(lambda { |env| env['rack.multithread'] }) - app.call(env).should.equal false + app.call(Rack::MockRequest.env_for("/")).should.equal false end specify "should reset original multithread flag when exiting lock" do - env = Rack::MockRequest.env_for("/") app = Rack::Lock.new(lambda { |env| env }) - app.call(env)['rack.multithread'].should.equal true + app.call(Rack::MockRequest.env_for("/"))['rack.multithread'].should.equal true end end
Fix spec failures and warnings in Rack::Lock under 1.9
diff --git a/lib/steamroller.rb b/lib/steamroller.rb index abc1234..def5678 100644 --- a/lib/steamroller.rb +++ b/lib/steamroller.rb @@ -12,8 +12,16 @@ end.flatten else return nil if block_given? && !yield(data) - require 'ruby-debug' - debugger + begin + require 'ruby-debug' + rescue LoadError + if RUBY_VERSION.to_f == 1.9 + rdebug_version = "ruby-debug19" + else + rdebug_version = "ruby-debug" + end + puts "Missing ruby-debug. Install with: gem install #{rdebug_version}" + end [prefix.flatten.join(joiner) => data] end end
Add logic for ruby-debug gem version
diff --git a/lib/capistrano/tasks/bundler_package.rake b/lib/capistrano/tasks/bundler_package.rake index abc1234..def5678 100644 --- a/lib/capistrano/tasks/bundler_package.rake +++ b/lib/capistrano/tasks/bundler_package.rake @@ -5,7 +5,7 @@ within release_path do with fetch(:bundle_env_variables, {}) do options = [] - options << "--gemfile #{fetch(:bundle_gemfile)}" if fetch(:bundle_gemfile) + options << "--gemfile #{fetch(:bundle_gemfile)}" if fetch(:bundle_gemfile) options << "--no-prune" if fetch(:bundle_cache_noprune) options << "--all" if fetch(:bundle_cache_all) options << "--path #{fetch(:bundle_path)}" if fetch(:bundle_path) @@ -26,6 +26,5 @@ task :defaults do set :bundle_cache_all, true set :bundle_cache_noprune, false - set :bundle_package_flags, '--quiet' end end
Remove quiet flag in Capistrano bundler task To enable a more verbose output that helps to follow on the deployment process and debug eventual problems. civio/onodo#373
diff --git a/lib/docs/filters/marionette/clean_html.rb b/lib/docs/filters/marionette/clean_html.rb index abc1234..def5678 100644 --- a/lib/docs/filters/marionette/clean_html.rb +++ b/lib/docs/filters/marionette/clean_html.rb @@ -12,17 +12,21 @@ end def other - css('#source + h2', '#improve', '#source', '.glyphicon').remove + css('#source + h2', '#improve', '#source', '.glyphicon', 'p > br').remove css('pre > code').each do |node| node.before(node.children).remove end css('h2', 'h3').each do |node| - id = node.content.strip - id.downcase! - id.remove! %r{['"\/\.:]} - id.gsub! %r{[\ _]}, '-' + if anchor = node.at_css('a.anchor[name]') + id = anchor['name'] + else + id = node.content.strip + id.downcase! + id.remove! %r{['"\/\.:]} + id.gsub! %r{[\ _]}, '-' + end node['id'] = id end end
Fix Marionette anchor links and improve readability Fixes #235.
diff --git a/lib/nacre/abstract_resource_collection.rb b/lib/nacre/abstract_resource_collection.rb index abc1234..def5678 100644 --- a/lib/nacre/abstract_resource_collection.rb +++ b/lib/nacre/abstract_resource_collection.rb @@ -41,10 +41,6 @@ resource_params end - def self.resource_class - Order - end - def self.extract_resources(json) JSON.parse(json)['response'] end
Remove redundant method from AbstractResourceCollection
diff --git a/lib/tasks/business_support_content.rake b/lib/tasks/business_support_content.rake index abc1234..def5678 100644 --- a/lib/tasks/business_support_content.rake +++ b/lib/tasks/business_support_content.rake @@ -3,4 +3,9 @@ task :import_facet_data => :environment do BusinessSupportFacetDataImporter.run end + + desc "Migrates locations slugs into Mapit area ids" + task :migrate_locations_to_areas => :environment do + BusinessSupportLocationMigrator.run + end end
Add rake task for bsf locations migrator
diff --git a/vagrant-darwin.gemspec b/vagrant-darwin.gemspec index abc1234..def5678 100644 --- a/vagrant-darwin.gemspec +++ b/vagrant-darwin.gemspec @@ -10,7 +10,7 @@ s.homepage = "https://github.counsyl.com/dev/vagrant-darwin.git" s.summary = "Enables Vagrant to work with Darwin (OS X) guests" s.description = "Enables Vagrant to work with Darwin (OS X) guests" - s.files = Dir.glob('lib/**/*') + s.files = Dir.glob('lib/**/*') + Dir['README.md'] + Dir['LICENSE'] s.require_paths = ["lib"] s.rubygems_version = "1.3.6" s.rubyforge_project = "vagrant-darwin"
Include LICENSE and README files in release.
diff --git a/pakyow-realtime/pakyow-realtime.gemspec b/pakyow-realtime/pakyow-realtime.gemspec index abc1234..def5678 100644 --- a/pakyow-realtime/pakyow-realtime.gemspec +++ b/pakyow-realtime/pakyow-realtime.gemspec @@ -32,5 +32,5 @@ s.add_dependency('websocket_parser', '~> 1.0') s.add_dependency('redis', '~> 3.2') - s.add_dependency('concurrent-ruby', '~> 0.9') + s.add_dependency('concurrent-ruby') end
Remove concurrent-ruby version from gemspec For testing prerelease version
diff --git a/Library/Formula/llvm.rb b/Library/Formula/llvm.rb index abc1234..def5678 100644 --- a/Library/Formula/llvm.rb +++ b/Library/Formula/llvm.rb @@ -1,17 +1,48 @@ require 'formula' +class Clang <Formula + url 'http://llvm.org/releases/2.6/clang-2.6.tar.gz' + homepage 'http://llvm.org/' + md5 '09d696bf23bb4a3cf6af3c7341cdd946' +end + class Llvm <Formula - @url='http://llvm.org/releases/2.6/llvm-2.6.tar.gz' - @homepage='http://llvm.org/' - @md5='34a11e807add0f4555f691944e1a404a' + url 'http://llvm.org/releases/2.6/llvm-2.6.tar.gz' + homepage 'http://llvm.org/' + md5 '34a11e807add0f4555f691944e1a404a' + + def options + [ + ['--with-clang', 'Also build & install clang'] + ] + end + + def clang? + ARGV.include? '--with-clang' + end def install ENV.gcc_4_2 # llvm can't compile itself + + if clang? + clang_dir = File.join(Dir.pwd, 'tools', 'clang') + + Clang.new.brew { + FileUtils.mkdir_p clang_dir + FileUtils.mv Dir['*'], clang_dir + } + end system "./configure", "--prefix=#{prefix}", "--enable-targets=host-only", "--enable-optimized" system "make" system "make install" # seperate steps required, otherwise the build fails + + if clang? + Dir.chdir clang_dir do + system "make install" + end + end end end
Add Clang as an option to LLVM formula
diff --git a/lib/autoprefixer-rails/railtie.rb b/lib/autoprefixer-rails/railtie.rb index abc1234..def5678 100644 --- a/lib/autoprefixer-rails/railtie.rb +++ b/lib/autoprefixer-rails/railtie.rb @@ -26,7 +26,7 @@ Rake::AutoprefixerTasks.new(browsers(app)) end - initializer :setup_autoprefixer, group: :assets do |app| + initializer :setup_autoprefixer, group: :all do |app| AutoprefixerRails.install(app.assets, browsers(app)) end
Fix group to work on Rails 4
diff --git a/lib/rss/atom/feed_history/atom.rb b/lib/rss/atom/feed_history/atom.rb index abc1234..def5678 100644 --- a/lib/rss/atom/feed_history/atom.rb +++ b/lib/rss/atom/feed_history/atom.rb @@ -1,3 +1,5 @@+require 'rss/atom/feed_history' + module RSS module Atom class Feed
Add `require` for backward compat
diff --git a/lib/sequenceserver/blast/query.rb b/lib/sequenceserver/blast/query.rb index abc1234..def5678 100644 --- a/lib/sequenceserver/blast/query.rb +++ b/lib/sequenceserver/blast/query.rb @@ -17,7 +17,8 @@ end def sort_hits_by_evalue! - @hits = hits.sort_by(&:evalue) + # change made here + @hits = hits.sort_by{|h| [h.evalue, h.score]} end attr_reader :id, :title
Sort hits by score when evalue is same. Signed-off-by: Alekhya Munagala <b2aa6119f2bf3cb55fa4719dcdf853cc5042ebcc@gmail.com>
diff --git a/lib/spooky_core/payment_method.rb b/lib/spooky_core/payment_method.rb index abc1234..def5678 100644 --- a/lib/spooky_core/payment_method.rb +++ b/lib/spooky_core/payment_method.rb @@ -27,6 +27,10 @@ def last_name at('last_name') + end + + def full_name + at('full_name') end def number
Add full_name to payment method
diff --git a/site/profile/lib/facter/network_zone.rb b/site/profile/lib/facter/network_zone.rb index abc1234..def5678 100644 --- a/site/profile/lib/facter/network_zone.rb +++ b/site/profile/lib/facter/network_zone.rb @@ -1,17 +1,17 @@ require 'ipaddr' Facter.add(:network_zone) do setcode do - # Exit with 'none' if there is no networking fact - return 'none' unless !Facter.value(:networking)['interfaces'].nil? - result = 'dmz' - Facter.value(:networking)['interfaces'].each do |iface, values| - if IPAddr.new("172.16.0.0/16").include?(values['ip']) - result = 'internal' - break # I found the internal ip, don't bother continuing - else - next + net = Facter.value(:networking)['interfaces'].nil? ? 'none' : 'dmz' + unless net.match('none') + Facter.value(:networking)['interfaces'].each do |iface, values| + if IPAddr.new("172.16.0.0/16").include?(values['ip']) + net = 'internal' + break # I found the internal ip, don't bother continuing + else + next + end end end - result + net end end
Add condition for empty networking
diff --git a/spec/support/matchers/error_matchers.rb b/spec/support/matchers/error_matchers.rb index abc1234..def5678 100644 --- a/spec/support/matchers/error_matchers.rb +++ b/spec/support/matchers/error_matchers.rb @@ -2,7 +2,10 @@ RSpec::Matchers.define :have_error do |erro| def error_message(record, atributo, erro) - I18n.translate("errors.messages.#{erro}") + translation_missing_message = "translation missing:" + message = I18n.translate("errors.messages.#{erro}") + + return message.include?(translation_missing_message) ? I18n.translate("activerecord.errors.models.#{record.class.to_s.underscore}.#{erro}") : message end chain :on do |atributo|
Add new path for translations
diff --git a/spec/libraries/high_voltage_pages_spec.rb b/spec/libraries/high_voltage_pages_spec.rb index abc1234..def5678 100644 --- a/spec/libraries/high_voltage_pages_spec.rb +++ b/spec/libraries/high_voltage_pages_spec.rb @@ -0,0 +1,14 @@+require 'rails_helper' + +describe 'High Voltage Pages Action Class', type: :controller do + controller(HighVoltage::PagesController) do + def action_has_layout? + false + end + end + + it 'gets the correct action class' do + get :show, id: 'home' + expect(controller.view_context.page_action_class).to eq('home') + end +end
Test for the High Voltage page action class, with our class extension.
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -20,6 +20,7 @@ chef_gem 'chef-vault' do version node['chef-vault']['version'] + compile_time true if respond_to?(:compile_time) end require 'chef-vault'
Fix chef_gem compat for Chef 12.1.0
diff --git a/DateRangePicker.podspec b/DateRangePicker.podspec index abc1234..def5678 100644 --- a/DateRangePicker.podspec +++ b/DateRangePicker.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'DateRangePicker' - s.version = '1.0' + s.version = '1.0.1' s.homepage = 'https://github.com/MrMage/DateRangePicker' s.summary = 'The best (?) date range picker control for OS X.' @@ -13,7 +13,7 @@ s.source_files = 'DateRangePicker/*.{h,swift}' s.module_name = 'DateRangePicker' - s.source = { :git => 'https://github.com/MrMage/DateRangePicker.git', :tag => 'v1.0' } + s.source = { :git => 'https://github.com/MrMage/DateRangePicker.git', :tag => "v#{spec.version}" } s.requires_arc = true s.frameworks = 'AppKit', 'Foundation'
Update the Podspec's version to 1.0.1
diff --git a/app/controllers/api/v1/api_keys_controller.rb b/app/controllers/api/v1/api_keys_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/api_keys_controller.rb +++ b/app/controllers/api/v1/api_keys_controller.rb @@ -20,7 +20,7 @@ def reset current_user.reset_api_key! - flash[:notice] = "Your API key has been reset. Don't forget to update your .gemrc file!" + flash[:notice] = "Your API key has been reset. Don't forget to update your ~/.gem/credentials file!" redirect_to edit_profile_path end end
Update location of rubygems.org credentials No longer using .gemrc, so tell them to update their .gem/credentials file instead! Ref: #694
diff --git a/app/models/task_list.rb b/app/models/task_list.rb index abc1234..def5678 100644 --- a/app/models/task_list.rb +++ b/app/models/task_list.rb @@ -1,6 +1,6 @@ class TaskList < ActiveRecord::Base belongs_to :owner, class_name: User - has_many :tasks, -> { order :priority }, foreign_key: :list_id + has_many :tasks, -> { order :priority }, foreign_key: :list_id, dependent: :destroy validates :owner, presence: true validates :name, presence: true
Destroy associated tasks when deleting a list
diff --git a/scripts/add_img.rb b/scripts/add_img.rb index abc1234..def5678 100644 --- a/scripts/add_img.rb +++ b/scripts/add_img.rb @@ -0,0 +1,48 @@+#!/usr/bin/env ruby + +require 'fileutils' +require 'pathname' +require 'pp' + +unless ARGV.length == 2 then + print "add_img <img_file> <post_file>\n" + exit +end + +img_fn = ARGV[0] +img_basename = Pathname.new(img_fn).basename.to_s +img_no_ext = img_basename.split('.')[0] +ext = img_basename.split('.')[1] +#print "IMG_FN #{img_fn}\n" +#print "IMG_BASENAME #{img_basename}\n" +#print "IMG_NO_EXT #{img_no_ext}\n" + +post_fn = ARGV[1] +unless File.exist?(post_fn) then + print "Post file #{post_fn} doesn't exist\n" + exit +end + +md_file_name = post_fn.split("/")[-1] +md_file_name.gsub!(/\.html.md$/, "") +img_path = "source/img/#{md_file_name}/" + +unless File.exists?(img_path) then + Dir.mkdir(img_path) +end + +print "# #{md_file_name} #{img_path}\n" + +img_scales = [5, 10, 15 ] # in percent of original +img_scales.each do |s| + print "# scaling #{s}\n" + `convert -resize #{s}% #{img_fn} #{img_path}/#{img_no_ext}_#{s}p.#{ext}\n` +end + +File.open(post_fn, 'a') { |f| + Dir["#{img_path}/*"].each_with_index do |dir_entry, dei| + dir_entry.gsub!(/^source/, "") + dir_entry.gsub!("//", "/") + f.write("![alt_text_#{dei}](#{dir_entry} \"Image_text_#{dei}\")\n") + end +}
Bring the script for images.
diff --git a/arm-eabi-binutils220.rb b/arm-eabi-binutils220.rb index abc1234..def5678 100644 --- a/arm-eabi-binutils220.rb +++ b/arm-eabi-binutils220.rb @@ -0,0 +1,25 @@+require 'formula' + +class ArmEabiBinutils220 <Formula + url 'http://ftp.gnu.org/gnu/binutils/binutils-2.20.1a.tar.bz2' + homepage 'http://www.gnu.org/software/binutils/' + sha1 '3f0e3746a15f806a95dd079be2a7f43c17b18818' + + keg_only 'Enable installation of several binutils versions' + + depends_on 'gmp' + depends_on 'mpfr' + depends_on 'ppl011' + + def install + system "./configure", "--prefix=#{prefix}", "--target=arm-eabi", + "--disable-shared", "--disable-nls", + "--with-gmp=#{Formula.factory('gmp').prefix}", + "--with-mpfr=#{Formula.factory('mpfr').prefix}", + "--with-ppl=#{Formula.factory('ppl011').prefix}", + "--enable-multilibs", "--enable-interwork", "--enable-lto", + "--disable-werror", "--disable-debug" + system "make" + system "make install" + end +end
Add ARM EABI binutils 2.20
diff --git a/spec/rules_spec.rb b/spec/rules_spec.rb index abc1234..def5678 100644 --- a/spec/rules_spec.rb +++ b/spec/rules_spec.rb @@ -27,14 +27,14 @@ rules.accept?(3).should == true end - it "should reject data that does not match any acceptance rules" do + it "should reject data that does not match any acceptance patterns" do rules = Rules.new(:accept => [1, 2, 3]) rules.accept?(2).should == true rules.accept?(4).should == false end - it "should accept data that does not match any rejection rules" do + it "should accept data that does not match any rejection patterns" do rules = Rules.new(:reject => [1, 2, 3]) rules.accept?(2).should == false
Use the terminology "patterns" wrt to specing Spidr::Rules.
diff --git a/app/models/cart_item.rb b/app/models/cart_item.rb index abc1234..def5678 100644 --- a/app/models/cart_item.rb +++ b/app/models/cart_item.rb @@ -5,4 +5,8 @@ def weight product.weight * quantity end + + def cost + product.price * quantity + end end
Add cost method for CartItem model
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index abc1234..def5678 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -9,7 +9,7 @@ filter = PublicActivity::Activity.arel_table[:key].matches("#{params[:filter]}.%") end - @activities = PublicActivity::Activity.order(created_at: :desc).where(filter).page(params[:page]).per_page(40) + @activities = PublicActivity::Activity.order(created_at: :desc).where(filter).page(params[:page]).per_page(100) @decorated_activities = PublicActivity::ActivitiesDecorator.decorate(@activities) @unread_activities = PublicActivity::Activity.unread_by(current_user).pluck(:id) PublicActivity::Activity.mark_as_read! @activities.to_a, :for => current_user unless @unread_activities.empty?
Revert amount of loaded activities to 100
diff --git a/Casks/opera-beta.rb b/Casks/opera-beta.rb index abc1234..def5678 100644 --- a/Casks/opera-beta.rb +++ b/Casks/opera-beta.rb @@ -1,6 +1,6 @@ cask :v1 => 'opera-beta' do - version '30.0.1835.47' - sha256 '97817b3a4bbf6eb7e92493f241665012f42592b3b404e888ad3cb05f61c8b39c' + version '30.0.1835.49' + sha256 '561fa244e03e91056655248f627b28294ae4e3bb5102c5db41737c3bd0db13d3' url "http://get.geo.opera.com/pub/opera-beta/#{version}/mac/Opera_beta_#{version}_Setup.dmg" homepage 'http://www.opera.com/computer/beta'
Upgrade Opera Beta.app to v30.0.1835.49
diff --git a/Casks/sourcetree.rb b/Casks/sourcetree.rb index abc1234..def5678 100644 --- a/Casks/sourcetree.rb +++ b/Casks/sourcetree.rb @@ -1,8 +1,8 @@ class Sourcetree < Cask - url 'http://downloads.atlassian.com/software/sourcetree/SourceTree_1.9.1.dmg' + url 'http://downloads.atlassian.com/software/sourcetree/SourceTree_1.9.2.dmg' homepage 'http://www.sourcetreeapp.com/' - version '1.9.1' - sha256 '0034097468b005ff06e2656ee286ee1017dcfa15c890fa5418d6f0739b634196' + version '1.9.2' + sha256 'ec6fe203d8ecb985587259066fe489f42c85e18d77929116a8989ab5d1fef376' link 'SourceTree.app' binary 'SourceTree.app/Contents/Resources/stree' caveats do
Update SourceTree to version 1.9.2
diff --git a/Casks/steermouse.rb b/Casks/steermouse.rb index abc1234..def5678 100644 --- a/Casks/steermouse.rb +++ b/Casks/steermouse.rb @@ -4,4 +4,6 @@ version '4.1.9' sha256 '4704aa8b01842c2e619db546fa045e515ee7e3a94d9d339f4650f2f8684b1280' install 'SteerMouse Installer.app/Contents/Resources/SteerMouse.pkg' + uninstall :pkgutil => 'jp.plentycom.SteerMouse.pkg.*', + :kext => 'com.cyberic.SmoothMouse' end
Add uninstall stanza for SteerMouse
diff --git a/Casks/switchresx.rb b/Casks/switchresx.rb index abc1234..def5678 100644 --- a/Casks/switchresx.rb +++ b/Casks/switchresx.rb @@ -1,8 +1,8 @@ class Switchresx < Cask url 'http://www.madrau.com/data/switchresx/SwitchResX4.zip' homepage 'http://www.madrau.com' - version '4.x' - sha256 :no_check + version '4.4' + sha256 "39c36694a1955f3f97bdb3bcb7591be06b601b9557d539abd05b039bcfb8b19f" prefpane 'SwitchResX.prefPane' caskroom_only true # hack to activate uninstall stanza uninstall :quit => [
Fix SwitchResX with a version and sha256 to pass test
diff --git a/features/support/app_life_cycle_hooks.rb b/features/support/app_life_cycle_hooks.rb index abc1234..def5678 100644 --- a/features/support/app_life_cycle_hooks.rb +++ b/features/support/app_life_cycle_hooks.rb @@ -7,7 +7,7 @@ After do |scenario| if scenario.failed? - screenshot_embed + # screenshot_embed end shutdown_test_server end
Disable automatic screenshotting of failed tests as it slows down test runs during development
diff --git a/delayed_job_web.gemspec b/delayed_job_web.gemspec index abc1234..def5678 100644 --- a/delayed_job_web.gemspec +++ b/delayed_job_web.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |gem| gem.name = "delayed_job_web" - gem.version = "1.2.10" + gem.version = "1.3" gem.author = "Erick Schmitt" gem.email = "ejschmitt@gmail.com" gem.homepage = "https://github.com/ejschmitt/delayed_job_web"
Prepare to release version 1.3
diff --git a/lib/gitlab/ci/pipeline/chain/sequence.rb b/lib/gitlab/ci/pipeline/chain/sequence.rb index abc1234..def5678 100644 --- a/lib/gitlab/ci/pipeline/chain/sequence.rb +++ b/lib/gitlab/ci/pipeline/chain/sequence.rb @@ -5,20 +5,19 @@ class Sequence def initialize(pipeline, command, sequence) @pipeline = pipeline + @command = command + @sequence = sequence @completed = [] - - @sequence = sequence.map do |chain| - chain.new(pipeline, command) - end end def build! - @sequence.each do |step| + @sequence.each do |chain| + step = chain.new(@pipeline, @command) + step.perform! - break if step.break? - @completed << step + @completed.push(step) end @pipeline.tap do
Reduce pipeline chain life span to minimize side effects
diff --git a/lib/shared/adapters/test_unit_adapter.rb b/lib/shared/adapters/test_unit_adapter.rb index abc1234..def5678 100644 --- a/lib/shared/adapters/test_unit_adapter.rb +++ b/lib/shared/adapters/test_unit_adapter.rb @@ -4,7 +4,7 @@ def self.command(project_path, ruby_interpreter, files) ruby_command = RubyEnv.ruby_command(project_path, :ruby_interpreter => ruby_interpreter) - "#{ruby_command} -Itest -e '%w(#{files}).each { |file| require(file) }'" + %{#{ruby_command} -Itest -e '%w(#{files}).each { |file| require("#{Dir.pwd}/#{file}") }'} end def self.test_files(dir)
Use full path with test unit files to support ruby 1.9.
diff --git a/dpl-cloud_files.gemspec b/dpl-cloud_files.gemspec index abc1234..def5678 100644 --- a/dpl-cloud_files.gemspec +++ b/dpl-cloud_files.gemspec @@ -1,3 +1,7 @@ require './gemspec_helper' -gemspec_for 'cloud_files', [['net-ssh'], ['mime-types'], ['nokogiri'], ['fog-rackspace']] +if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.3.0") + gemspec_for 'cloud_files', [['net-ssh'], ['mime-types'], ['nokogiri', '< 1.10'], ['fog-rackspace']] +else + gemspec_for 'cloud_files', [['net-ssh'], ['mime-types'], ['nokogiri'], ['fog-rackspace']] +end
Fix cloud_files gemspec: nokogiri <1.10 for ruby <2.3
diff --git a/lib/brightbox-cli/commands/users/update.rb b/lib/brightbox-cli/commands/users/update.rb index abc1234..def5678 100644 --- a/lib/brightbox-cli/commands/users/update.rb +++ b/lib/brightbox-cli/commands/users/update.rb @@ -17,7 +17,7 @@ user = User.find args.first if options[:f] == "-" - user.ssh_key = STDIN.read + user.ssh_key = $stdin.read elsif options[:f] File.open(File.expand_path(options[:f])) { |f| user.ssh_key = f.read } end
Switch to use global `$stdin` Rather than the constant, this uses the global standard input variable instead.
diff --git a/lib/endpoint_base/concerns/response_dsl.rb b/lib/endpoint_base/concerns/response_dsl.rb index abc1234..def5678 100644 --- a/lib/endpoint_base/concerns/response_dsl.rb +++ b/lib/endpoint_base/concerns/response_dsl.rb @@ -25,6 +25,14 @@ payload: payload } end + def add_messages(message, collection = []) + @messages ||= [] + + collection.each do |payload| + @messages << { message: message, payload: payload } + end + end + def add_parameter(name, value) @parameters ||= []
Create a `add_messages` to ResponseDSL
diff --git a/lib/overcommit/hook/pre_commit/rubo_cop.rb b/lib/overcommit/hook/pre_commit/rubo_cop.rb index abc1234..def5678 100644 --- a/lib/overcommit/hook/pre_commit/rubo_cop.rb +++ b/lib/overcommit/hook/pre_commit/rubo_cop.rb @@ -8,7 +8,7 @@ end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? extract_messages(
Split file args for RuboCop hook
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -2,11 +2,9 @@ ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') require 'cucumber/rails/world' -require 'cucumber/formatters/unicode' # Comment out this line if you don't want Cucumber Unicode support +require 'webrat/rails' +require 'cucumber/rails/rspec' Cucumber::Rails.use_transactional_fixtures -require 'cucumber/rails/rspec' -require 'webrat/rspec-rails' -require 'webrat' module HumanMethods def dehumanize(string) @@ -29,10 +27,6 @@ world.extend(HelperMethods) end -Webrat.configure do |config| - config.mode = :rails -end - module HelperMethods def set_instance_variable(name, value) instance_variable_name = "@#{name}" @@ -42,4 +36,4 @@ instance_variable_name = "@#{name}" instance_variable_get(instance_variable_name) end -end+end
Fix cucumber configuration for integrity
diff --git a/features/support/vcr.rb b/features/support/vcr.rb index abc1234..def5678 100644 --- a/features/support/vcr.rb +++ b/features/support/vcr.rb @@ -4,7 +4,8 @@ conf.hook_into :webmock conf.cassette_library_dir = 'features/cassettes' conf.default_cassette_options = { :record => :new_episodes } - conf.filter_sensitive_data('<***>') { ''} + conf.filter_sensitive_data('<TOKEN>') { SETTINGS['oauth_token'] } + conf.filter_sensitive_data('<BASIC_AUTH>') { SETTINGS['basic_auth'] } end VCR.cucumber_tags do |t|
Remove sensitive data from feature recordings.
diff --git a/spec/unit/battlenet_authentication_spec.rb b/spec/unit/battlenet_authentication_spec.rb index abc1234..def5678 100644 --- a/spec/unit/battlenet_authentication_spec.rb +++ b/spec/unit/battlenet_authentication_spec.rb @@ -5,7 +5,7 @@ let(:auth) { Battlenet::Authentication.new 'private' } before(:each) do - time = Time.local 2011, 11, 4, 20, 36, 24 + time = Time.utc 2011, 11, 5, 3, 36, 24 Timecop.freeze(time) end
Use UTC time in Authentication spec
diff --git a/app/models/story.rb b/app/models/story.rb index abc1234..def5678 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -15,9 +15,8 @@ def collaborators collaborators = users - collaborators.merge(owner) unless collaborators.include?(owner) - - collaborators + return collaborators if collaborators.include?(owner) + collaborators.merge(User.where(id: owner_id)) end def users_select_array
Fix issue with AR merge
diff --git a/app/models/thing.rb b/app/models/thing.rb index abc1234..def5678 100644 --- a/app/models/thing.rb +++ b/app/models/thing.rb @@ -2,7 +2,7 @@ has_many :check_outs, dependent: :destroy validates :quantity, numericality: { greater_than_or_equal_to: 0 } - validates :name, presence: true + validates :name, presence: true, uniqueness: true def available? available_quantity > 0
Add unique validation to Thing Fixes #3
diff --git a/lib/dimples/renderer.rb b/lib/dimples/renderer.rb index abc1234..def5678 100644 --- a/lib/dimples/renderer.rb +++ b/lib/dimples/renderer.rb @@ -12,6 +12,7 @@ context[:pagination] ||= nil output = engine.render(scope, context) { body } + @source.metadata[:rendered_contents] = output template = @site.templates[@source.metadata[:layout]] return output if template.nil?
Set the rendered_contents in the source's metadata
diff --git a/lib/rubotium/devices.rb b/lib/rubotium/devices.rb index abc1234..def5678 100644 --- a/lib/rubotium/devices.rb +++ b/lib/rubotium/devices.rb @@ -8,7 +8,7 @@ def all raise NoDevicesError if attached_devices.empty? - raise NoMatchedDevicesError if matched_devices.empty? + raise NoMatchedDevicesError if matched_devices.nil? or matched_devices.empty? matched_devices end
Handle cases were no match categories have been specified. Since [].reduce( :& ) will return nil
diff --git a/lib/tasks/test_sweet.rb b/lib/tasks/test_sweet.rb index abc1234..def5678 100644 --- a/lib/tasks/test_sweet.rb +++ b/lib/tasks/test_sweet.rb @@ -12,14 +12,19 @@ if TestSweet.verify_initialized ENV['test_sweet-target'] = Motion::Project::App.config.deployment_target || ENV['target'] ENV['test_sweet-app'] = Motion::Project::App.config.app_bundle('iPhoneSimulator') - ENV['test_sweet-device-name'] = Motion::Project::App.config.device_family_string( - ENV['device'], - Motion::Project::App.config.device_family_ints[0], - ENV['test_sweet-target'], - ENV['retina']) - Cucumber::Rake::Task.new(:features, "") do |t| - t.cucumber_opts = "--format pretty #{ENV["FEATURES"] || "features"}" - end.runner.run + + if !File.exists? ENV['test_sweet-app'] + puts "No application at #{ENV['test_sweet-app']} - please build your app!" + else + ENV['test_sweet-device-name'] = Motion::Project::App.config.device_family_string( + ENV['device'], + Motion::Project::App.config.device_family_ints[0], + ENV['test_sweet-target'], + ENV['retina']) + Cucumber::Rake::Task.new(:features, "") do |t| + t.cucumber_opts = "--format pretty #{ENV["FEATURES"] || "features"}" + end.runner.run + end else puts "TestSweet is not initialized; please run: `rake test_sweet:initialize`" end
Verify application has been built before running tests
diff --git a/merb_datamapper.gemspec b/merb_datamapper.gemspec index abc1234..def5678 100644 --- a/merb_datamapper.gemspec +++ b/merb_datamapper.gemspec @@ -16,7 +16,6 @@ gem.description = "Merb plugin that provides support for datamapper" gem.summary = "Merb plugin that allows you to use datamapper with your merb app" - gem.has_yardoc = true gem.require_paths = ['lib'] gem.files = Dir[ 'Generators',
Remove invalid directive from gemspec
diff --git a/config/initializers/sidekiq-superworkers.rb b/config/initializers/sidekiq-superworkers.rb index abc1234..def5678 100644 --- a/config/initializers/sidekiq-superworkers.rb +++ b/config/initializers/sidekiq-superworkers.rb @@ -1,4 +1,7 @@ # frozen_string_literal: true + +require 'import_subscription_worker' +require 'notify_import_finished_worker' # Define superworkers for the sidekiq-superworker gem.
Remove a zeitwerk initialization warning
diff --git a/lib/atlas/gquery.rb b/lib/atlas/gquery.rb index abc1234..def5678 100644 --- a/lib/atlas/gquery.rb +++ b/lib/atlas/gquery.rb @@ -5,7 +5,6 @@ FILE_SUFFIX = 'gql' DIRECTORY = 'gqueries' - attribute :comments, String attribute :query, String attribute :unit, String attribute :deprecated_key, String
Remove unnecessary comments attribute on Gquery
diff --git a/lib/dir_friend/f.rb b/lib/dir_friend/f.rb index abc1234..def5678 100644 --- a/lib/dir_friend/f.rb +++ b/lib/dir_friend/f.rb @@ -5,7 +5,7 @@ def initialize(name, level:0) @path = File.expand_path(name) @name = File.basename(@path) - @stat = File.stat(@path) + @stat = File.lstat(@path) @level = level end
Fix a issue when symbolic link included
diff --git a/lib/gir_ffi/core.rb b/lib/gir_ffi/core.rb index abc1234..def5678 100644 --- a/lib/gir_ffi/core.rb +++ b/lib/gir_ffi/core.rb @@ -40,11 +40,6 @@ raise ArgumentError, "#{klass} is not a user-defined class" end - if block_given? - warn "Using define_type with a block is deprecated." \ - " Call the relevant functions inside the class definition instead." - yield info - end Builders::UserDefinedBuilder.new(info).build_class klass.gtype
Remove deprecated option of passing a block to GirFFI.define_type
diff --git a/lib/github-pages.rb b/lib/github-pages.rb index abc1234..def5678 100644 --- a/lib/github-pages.rb +++ b/lib/github-pages.rb @@ -1,5 +1,5 @@ class GitHubPages - VERSION = 19 + VERSION = 20 # Jekyll and related dependency versions as used by GitHub Pages. # For more information see:
Bump :gem: version to 20.
diff --git a/lib/iamfindbykey.rb b/lib/iamfindbykey.rb index abc1234..def5678 100644 --- a/lib/iamfindbykey.rb +++ b/lib/iamfindbykey.rb @@ -22,25 +22,23 @@ puts "#{key}: #{value}" end - def keymap - @keymap ||= begin - connection.users.reduce({}) do |m, user| - connection.list_access_keys('UserName' => user) - .body['AccessKeys'] - .map { |ak| ak['AccessKeyId'] } - .each { |ak| m[ak] = user } - end - end - end - def user @user ||= begin - unless keymap[@key] + r = connection.users.find do |user| + # puts "Checking user #{user.id}" + connection.list_access_keys('UserName' => user.id) + .body['AccessKeys'] + .map { |ak| ak['AccessKeyId'] }.include?(@key) + end + if r.nil? puts "Key #{@key} not found" exit 1 end - connection.users.get(keymap[@key]) + r end + rescue Fog::AWS::IAM::ValidationError => e + puts "Error processing user: #{user}" + raise e end def connection
Speed up the loop a lot
diff --git a/lib/tasks/brew.rake b/lib/tasks/brew.rake index abc1234..def5678 100644 --- a/lib/tasks/brew.rake +++ b/lib/tasks/brew.rake @@ -4,7 +4,7 @@ task :refresh do puts "#{time}: Checking if any brew upgrades are required ..." if brew_outdated? - `brew upgrade && brew cleanup` + puts `brew upgrade && brew cleanup` puts "#{time}: Finished upgrading and cleaning up." else puts "#{time}: Nothing for brew to upgrade."
Print output from upgrade and cleanup.
diff --git a/lib/tasks/temp.rake b/lib/tasks/temp.rake index abc1234..def5678 100644 --- a/lib/tasks/temp.rake +++ b/lib/tasks/temp.rake @@ -21,10 +21,10 @@ :updated_at => update.updated_at, :mark_fixed => update.mark_fixed, :mark_open => update.mark_open, - :token => update.token, - :status_code => update.status_code, + :token => update.token, :user_name => update.reporter_name) campaign_comment.save! + campaign.status = update.status campaign_comment.token = update.token campaign_comment.save! end
Set status on new campaign comment
diff --git a/lib/version_info.rb b/lib/version_info.rb index abc1234..def5678 100644 --- a/lib/version_info.rb +++ b/lib/version_info.rb @@ -11,7 +11,7 @@ # end # module VersionInfo - GITHUB_REPO_OWNER = 'churchio' + GITHUB_REPO_OWNER = 'seven1m' GITHUB_REPO_NAME = 'onebody' def current_version
Update github repo owner name
diff --git a/lib/fulmar/service/common_helper_service.rb b/lib/fulmar/service/common_helper_service.rb index abc1234..def5678 100644 --- a/lib/fulmar/service/common_helper_service.rb +++ b/lib/fulmar/service/common_helper_service.rb @@ -13,11 +13,11 @@ end def full_configuration - @config_service ||= Fulmar::Domain::Service::ConfigurationService.new + (@config_service ||= Fulmar::Domain::Service::ConfigurationService.new).configuration end def configuration - full_configuration.environment(@environment) + (@config_service ||= Fulmar::Domain::Service::ConfigurationService.new).environment(@environment) end def composer(command, arguments = [])
[FEATURE] Allow direct access to raw configuration
diff --git a/IRC/plugins/I18N/I18N.rb b/IRC/plugins/I18N/I18N.rb index abc1234..def5678 100644 --- a/IRC/plugins/I18N/I18N.rb +++ b/IRC/plugins/I18N/I18N.rb @@ -20,6 +20,7 @@ def on_privmsg(msg) case msg.bot_command when :i18n_reload + I18n.load_path = Dir[File.join(File.dirname(__FILE__), 'locales', '*.yml')] I18n.backend.load_translations msg.reply("Reloaded translations. Available locales: #{format_available_locales}") when :i18n_set
Refresh translation files too during .i18n_reload
diff --git a/resources/common.rb b/resources/common.rb index abc1234..def5678 100644 --- a/resources/common.rb +++ b/resources/common.rb @@ -7,6 +7,7 @@ attribute :path, 'kind_of' => String, :default => '/opt/app/' attribute :owner, 'kind_of' => String, :default => 'chef' attribute :group, 'kind_of' => String, :default => 'chef' +attribute :mode, 'kind_of' => String, :default => '0755' # The information necessary to check out the code attribute :git_repo, 'kind_of' => String
Add a mode for the directory git will create
diff --git a/scraperwiki.gemspec b/scraperwiki.gemspec index abc1234..def5678 100644 --- a/scraperwiki.gemspec +++ b/scraperwiki.gemspec @@ -1,14 +1,19 @@-Gem::Specification.new do |s| - s.name = 'scraperwiki' - s.version = '2.0.6' - s.date = '2013-04-04' - s.summary = "ScraperWiki" - s.description = "A library for scraping web pages and saving data easily" - s.authors = ["Francis irving"] - s.email = 'francis@scraperwiki.com' - s.files = ["lib/scraperwiki.rb", "lib/scraperwiki/sqlite_save_info.rb"] - s.homepage = 'http://rubygems.org/gems/scraperwiki' +# -*- encoding: utf-8 -*- - s.add_dependency "httpclient" - s.add_dependency "sqlite3" +Gem::Specification.new do |gem| + gem.authors = ['Francis irving'] + gem.email = 'francis@scraperwiki.com' + gem.description = 'A library for scraping web pages and saving data easily' + gem.summary = 'ScraperWiki' + gem.homepage = 'http://rubygems.org/gems/scraperwiki' + + gem.files = `git ls-files`.split($\) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.name = 'scraperwiki' + gem.require_paths = ['lib'] + gem.version = '2.0.6' + + gem.add_dependency "httpclient" + gem.add_dependency "sqlite3" end
Switch gemspec to Bundler's default format
diff --git a/app/inputs/inet_input.rb b/app/inputs/inet_input.rb index abc1234..def5678 100644 --- a/app/inputs/inet_input.rb +++ b/app/inputs/inet_input.rb @@ -0,0 +1,16 @@+class InetInput < Formtastic::Inputs::StringInput + def input_html_options + super.tap do |options| + options[:class] = [options[:class], "inet"].compact.join(' ') + options[:data] ||= {} + options[:data].merge! inet_options + end + end + + private + def inet_options + options = self.options.fetch(:inet_options, {}) + options = Hash[options.map{ |k, v| [k.to_s.camelcase(:lower), v] }] + { inet_options: options } + end +end
Add input for INET type
diff --git a/burlesque-client.gemspec b/burlesque-client.gemspec index abc1234..def5678 100644 --- a/burlesque-client.gemspec +++ b/burlesque-client.gemspec @@ -8,9 +8,9 @@ spec.version = Burlesque::VERSION spec.authors = ['Gregory Eremin'] spec.email = ['g@erem.in'] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = '' + spec.summary = %q{Burlesque API wrapper} + spec.description = %q{Ruby wrapper over Burlesque message queue API} + spec.homepage = 'http://github.com/KosyanMedia/burlesque' spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0")
Add gem summary and description
diff --git a/spec/client_spec.rb b/spec/client_spec.rb index abc1234..def5678 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -2,7 +2,7 @@ describe EventGirl::Client do - subject { described_class.new('http://example.com', 'foobar') } + subject { described_class.new('http://example.com/incoming_events', 'foobar') } it 'creates instances with two arguments' do expect(described_class.instance_method(:initialize).arity).to eql 2 @@ -22,5 +22,11 @@ it 'requires the event title as argument' do expect(subject.method(:send_event).arity).to eql 1 end + + it 'sends json data' do + stub_request(:post, subject.url). + with(headers: { 'Content-Type' => 'application/json' }) + subject.send_event 'event girl test' + end end end
Test with mocked http request
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -48,12 +48,6 @@ } end -class ROM::Mapper - def self.build(header, model) - new(Mapper::Loader::ObjectBuilder.new(header, model), Mapper::Dumper.new(header, model)) - end -end - SCHEMA = Schema.build do base_relation :users do repository :test
Update to work with latest API changes in relation/mapper
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ require 'config/boot' RSpec.configure do |config| - include Rack::Test::Methods + config.include Rack::Test::Methods def app Acme::Application
Fix include syntax in RSpec configuration
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,4 +15,7 @@ end config.shared_context_metadata_behavior = :apply_to_host_groups + + config.filter_run_including :focus => true + config.run_all_when_everything_filtered = true end
Allow focusing on examples in RSpec
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,11 +22,12 @@ end def mock_mapper(model_class) - Class.new(DataMapper::Mapper) do - model model_class + Class.new(DataMapper::Mapper::Relation) do + model model_class + repository DataMapper::Inflector.tableize(model_class.name) - def inspect - "#<#{self.class.model}Mapper:#{object_id} model=#{self.class.model}>" + def self.name + "#{model_class.name}Mapper" end end end
Improve model and mapper mocking in specs
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,15 +8,11 @@ require 'capybara' require 'capybara/dsl' -$LOAD_PATH << './test_site' $LOAD_PATH << './lib' +$LOAD_PATH << './features/support' require 'site_prism' -require 'test_site' -require 'sections/people' -require 'sections/blank' -require 'sections/container' -require 'pages/iframe' +require 'sections/all' require 'pages/home' Capybara.default_max_wait_time = 0
Fix Unit tests on CI