diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/views/spree/api/orders/show.rabl b/app/views/spree/api/orders/show.rabl index abc1234..def5678 100644 --- a/app/views/spree/api/orders/show.rabl +++ b/app/views/spree/api/orders/show.rabl @@ -0,0 +1,44 @@+object @order +extends "spree/api/orders/order" + +node(:use_billing) { @order.bill_address == @order.ship_address } + +if lookup_context.find_all("spree/api/orders/#{@order.state}").present? + extends "spree/api/orders/#{@order.state}" +end + +child :billing_address => :bill_address do + extends "spree/api/addresses/show" +end + +child :shipping_address => :ship_address do + extends "spree/api/addresses/show" +end + +child :line_items => :line_items do + extends "spree/api/line_items/show" +end + +child :payments => :payments do + attributes *payment_attributes + + child :payment_method => :payment_method do + attributes :id, :name, :environment + end + + child :source => :source do + attributes *payment_source_attributes + end +end + +child :shipments => :shipments do + extends "spree/api/shipments/small" +end + +child :adjustments => :adjustments do + extends "spree/api/adjustments/show" +end + +child :products => :products do + extends "spree/api/products/show" +end
Revert "Removed order rabl template" This reverts commit de382875f495868256bdc7406fd6289c5ff6d9f0.
diff --git a/tty-tree.gemspec b/tty-tree.gemspec index abc1234..def5678 100644 --- a/tty-tree.gemspec +++ b/tty-tree.gemspec @@ -1,4 +1,3 @@-# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'tty/tree/version' @@ -14,9 +13,8 @@ spec.homepage = "https://piotrmurach.github.io/tty" spec.license = "MIT" - spec.files = `git ls-files -z`.split("\x0").reject do |f| - f.match(%r{^(test|spec|features)/}) - end + spec.files = Dir['{lib,spec}/**/*.rb', '{bin,tasks}/*', 'tty-tree.gemspec'] + spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile'] spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"]
Change to load files directly
diff --git a/app/models/schedule_item.rb b/app/models/schedule_item.rb index abc1234..def5678 100644 --- a/app/models/schedule_item.rb +++ b/app/models/schedule_item.rb @@ -22,7 +22,7 @@ :start_time, :duration, :room_id, - ad: :admin + as: :admin # Associations belongs_to :event
Fix typo in ScheduleItem's attr_accessible
diff --git a/lib/model/active_record/database/index.rb b/lib/model/active_record/database/index.rb index abc1234..def5678 100644 --- a/lib/model/active_record/database/index.rb +++ b/lib/model/active_record/database/index.rb @@ -3,7 +3,7 @@ module Database module Index def indices - ::ActiveRecord::Base.connection.indexes(@model.tableize.gsub("/", "_")).map do |indexes| + ::ActiveRecord::Base.connection.indexes(@model.constantize.table_name).map do |indexes| "it { is_expected.to have_db_index #{indexes.columns} }" end.flatten.join("\n ") end
Use Model.table_name to take into account the table_name_prefix
diff --git a/core/db/migrate/20170323151450_add_missing_unique_indexes_for_unique_attributes.rb b/core/db/migrate/20170323151450_add_missing_unique_indexes_for_unique_attributes.rb index abc1234..def5678 100644 --- a/core/db/migrate/20170323151450_add_missing_unique_indexes_for_unique_attributes.rb +++ b/core/db/migrate/20170323151450_add_missing_unique_indexes_for_unique_attributes.rb @@ -32,7 +32,11 @@ end remove_index table_name, column if index_exists?(table_name, column) - add_index table_name, "lower(#{column})", unique: true + if supports_expression_index? + add_index table_name, "lower(#{column})", unique: true + else + add_index table_name, column, unique: true + end end end end
Fix migrations on mysql database
diff --git a/spec/concerns/file_parameters_spec.rb b/spec/concerns/file_parameters_spec.rb index abc1234..def5678 100644 --- a/spec/concerns/file_parameters_spec.rb +++ b/spec/concerns/file_parameters_spec.rb @@ -0,0 +1,55 @@+# frozen_string_literal: true + +require 'rails_helper' + +class Controller < AnonymousController + include FileParameters +end + +describe FileParameters do + let(:controller) { Controller.new } + let(:hello_world) { FactoryBot.create(:hello_world) } + + describe '#reject_illegal_file_attributes!' do + def file_accepted?(file) + files = [[0, FactoryBot.attributes_for(:file, context: hello_world, file_id: file.id)]] + filtered_files = controller.send(:reject_illegal_file_attributes, hello_world.id, files) + files.eql?(filtered_files) + end + + describe 'accepts' do + it 'main file of the exercise' do + main_file = hello_world.files.find { |e| e.role = 'main_file' } + expect(file_accepted?(main_file)).to be true + end + + it 'new file' do + new_file = FactoryBot.create(:file, context: hello_world) + expect(file_accepted?(new_file)).to be true + end + end + + describe 'rejects' do + it 'file of different exercise' do + fibonacci = FactoryBot.create(:fibonacci, allow_file_creation: true) + other_exercises_file = FactoryBot.create(:file, context: fibonacci) + expect(file_accepted?(other_exercises_file)).to be false + end + + it 'hidden file' do + hidden_file = FactoryBot.create(:file, context: hello_world, hidden: true) + expect(file_accepted?(hidden_file)).to be false + end + + it 'read only file' do + read_only_file = FactoryBot.create(:file, context: hello_world, read_only: true) + expect(file_accepted?(read_only_file)).to be false + end + + it 'non existent file' do + non_existent_file = FactoryBot.build(:file, context: hello_world, id: 42) + expect(file_accepted?(non_existent_file)).to be false + end + end + end +end
Add tests for rejecting illegal file attributes
diff --git a/lib/fastlane/plugin/changelog_generator/helper/changelog_generator_fetcher.rb b/lib/fastlane/plugin/changelog_generator/helper/changelog_generator_fetcher.rb index abc1234..def5678 100644 --- a/lib/fastlane/plugin/changelog_generator/helper/changelog_generator_fetcher.rb +++ b/lib/fastlane/plugin/changelog_generator/helper/changelog_generator_fetcher.rb @@ -4,6 +4,8 @@ module Helper class ChangelogGeneratorFetcher def self.fetch_labels(project, base_branch, access_token) + Actions.verify_gem!('octokit') + Octokit.auto_paginate = true issues_map = {}
Verify octokit gem in changelog fetcher
diff --git a/spec/models/spree/product_set_spec.rb b/spec/models/spree/product_set_spec.rb index abc1234..def5678 100644 --- a/spec/models/spree/product_set_spec.rb +++ b/spec/models/spree/product_set_spec.rb @@ -0,0 +1,65 @@+require 'spec_helper' + +describe Spree::ProductSet do + describe '#save' do + context 'when passing :collection_attributes' do + let(:product_set) do + described_class.new(collection_attributes: collection_hash) + end + + context 'when the product does not exist yet' do + let(:collection_hash) do + { + 0 => { + product_id: 11, + name: 'a product', + price: 2.0, + supplier_id: create(:enterprise).id, + primary_taxon_id: create(:taxon).id, + unit_description: 'description', + variant_unit: 'items', + variant_unit_name: 'bunches' + } + } + end + + it 'creates it with the specified attributes' do + product_set.save + + expect(Spree::Product.last.attributes) + .to include('name' => 'a product') + end + end + + context 'when the product does exist' do + let!(:product) do + create( + :simple_product, + variant_unit: 'items', + variant_unit_scale: nil, + variant_unit_name: 'bunches' + ) + end + + let(:collection_hash) do + { + 0 => { + id: product.id, + variant_unit: 'weight', + variant_unit_scale: 1 + } + } + end + + it 'updates all the specified product attributes' do + product_set.save + + expect(product.reload.attributes).to include( + 'variant_unit' => 'weight', + 'variant_unit_scale' => 1 + ) + end + end + end + end +end
Add first test case for ProductSet This covers creation and update of a product.
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,5 +1,3 @@-require Rails.root.join("config/smtp") - Rails.application.configure do config.cache_classes = false config.eager_load = false
Remove obsolete reference to config for MailGun
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,8 +1,6 @@ # Be sure to restart your server when you modify this file. -ContactOTron::Application.config.session_store :cookie_store, key: '_contact-o-tron_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# ContactOTron::Application.config.session_store :active_record_store +ContactOTron::Application.config.session_store :cookie_store, + key: '_contact-o-tron_session' + secure: Rails.env.production?, + http_only: true
Set cookies to only be served over https and to be http only
diff --git a/config/initializers/will_paginate.rb b/config/initializers/will_paginate.rb index abc1234..def5678 100644 --- a/config/initializers/will_paginate.rb +++ b/config/initializers/will_paginate.rb @@ -33,7 +33,7 @@ end def last_page - num = @collection.current_page < total_pages && @collection.current_page + num = @collection.current_page < total_pages && @collection.total_pages previous_or_next_page(num, @options[:last_label], "last_page") end
Use actual last page, not current page
diff --git a/db/migrate/20090504040328_use_competition_event_memberships.rb b/db/migrate/20090504040328_use_competition_event_memberships.rb index abc1234..def5678 100644 --- a/db/migrate/20090504040328_use_competition_event_memberships.rb +++ b/db/migrate/20090504040328_use_competition_event_memberships.rb @@ -0,0 +1,25 @@+class UseCompetitionEventMemberships < ActiveRecord::Migration + def self.up + Event.find(:all, :conditions => "cat4_womens_race_series_id is not null").each do |event| + cat4_womens_race_series_id = event.cat4_womens_race_series_id + unless CompetitionEventMembership.find(:first, :conditions => { :event_id => event.id, :competition_id => cat4_womens_race_series_id }) + CompetitionEventMembership.create!(:event_id => event.id, :competition_id => cat4_womens_race_series_id) + end + end + + Event.find(:all, :conditions => "oregon_cup_id is not null").each do |event| + oregon_cup_id = event.oregon_cup_id + unless CompetitionEventMembership.find(:first, :conditions => { :event_id => event.id, :competition_id => oregon_cup_id }) + CompetitionEventMembership.create!(:event_id => event.id, :competition_id => oregon_cup_id) + end + end + + execute "alter table events drop foreign key events_oregon_cup_id_fk" + remove_column :events, :cat4_womens_race_series_id + remove_column :events, :oregon_cup_id + end + + def self.down + raise "Can't rollback" + end +end
Remove competition-specific FKs and use CompetitionEventMemberships instead
diff --git a/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb b/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb index abc1234..def5678 100644 --- a/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb +++ b/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb @@ -1,5 +1,7 @@ class AddSessionExpireDelayForApplicationSettings < ActiveRecord::Migration def change - add_column :application_settings, :session_expire_delay, :integer, default: 10080, null: false + unless column_exists?(:application_settings, :session_expire_delay) + add_column :application_settings, :session_expire_delay, :integer, default: 10080, null: false + end end -end+end
Check if session_expire_delay column exists before adding the column.
diff --git a/test/fixtures/cookbooks/test/recipes/gem.rb b/test/fixtures/cookbooks/test/recipes/gem.rb index abc1234..def5678 100644 --- a/test/fixtures/cookbooks/test/recipes/gem.rb +++ b/test/fixtures/cookbooks/test/recipes/gem.rb @@ -3,7 +3,7 @@ # System Install rbenv_system_install 'system' -# Install several rubies to /opt/rubies +# Install several Rubies to a system wide location rbenv_ruby '2.4.1' rbenv_ruby '2.3.1' # Set System global version @@ -30,7 +30,7 @@ # User Install rbenv_user_install 'vagrant' -# Install a Ruby to a user directory (~/.rubies) +# Install a Ruby to a user directory rbenv_ruby '2.3.1' do user 'vagrant' end
Remove wrong directories from comments
diff --git a/filter/sasuoni_bot.rb b/filter/sasuoni_bot.rb index abc1234..def5678 100644 --- a/filter/sasuoni_bot.rb +++ b/filter/sasuoni_bot.rb @@ -10,7 +10,7 @@ if t =~ /^\:sasuoni list/ { username: 'sasuoni', text: fetch_data.map { |z| z["word"] }.uniq.sort.join(", ") } else - { username: 'sasuoni', text: find_sasuoni_by_keyword(t.split(/\ /).last)["image"] } + { username: 'sasuoni', text: find_sasuoni_by_keyword(t.split(/\ /).last)["image"] + "?#{Time.now.to_i}" } end end
Add a timestamp to several uris of images
diff --git a/db/migrate/20151113111400_starred_repositories_add_index_user_id_and_repo_id.rb b/db/migrate/20151113111400_starred_repositories_add_index_user_id_and_repo_id.rb index abc1234..def5678 100644 --- a/db/migrate/20151113111400_starred_repositories_add_index_user_id_and_repo_id.rb +++ b/db/migrate/20151113111400_starred_repositories_add_index_user_id_and_repo_id.rb @@ -2,7 +2,7 @@ self.disable_ddl_transaction! def up - execute "CREATE UNIQUE INDEX index_starred_repositories_on_user_id_and_repo_id ON starred_repositories (user_id, repo_id)" + execute "CREATE UNIQUE INDEX index_starred_repositories_on_user_id_and_repo_id ON starred_repositories (user_id, repository_id)" end def down
Correct `repo_id` => `repository_id` in migration
diff --git a/core/lib/generators/refinery/form/templates/refinerycms-plural_name.gemspec b/core/lib/generators/refinery/form/templates/refinerycms-plural_name.gemspec index abc1234..def5678 100644 --- a/core/lib/generators/refinery/form/templates/refinerycms-plural_name.gemspec +++ b/core/lib/generators/refinery/form/templates/refinerycms-plural_name.gemspec @@ -11,7 +11,7 @@ s.files = Dir["{app,config,db,lib}/**/*"] + ["readme.md"] # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> <%= Refinery::Version %>' - s.add_dependency 'refinerycms-settings', '~> <%= Refinery::Version %>' - s.add_dependency 'acts_as_indexed', '~> 0.7' + s.add_dependency 'refinerycms-core', '~> <%= Refinery::Version %>' + s.add_dependency 'refinerycms-settings', '~> <%= Refinery::Version %>' + s.add_dependency 'acts_as_indexed', '~> 0.7' end
Remove extra space in form generated gemspec.
diff --git a/actionpack/test/controller/logging_test.rb b/actionpack/test/controller/logging_test.rb index abc1234..def5678 100644 --- a/actionpack/test/controller/logging_test.rb +++ b/actionpack/test/controller/logging_test.rb @@ -0,0 +1,46 @@+require 'abstract_unit' + +class LoggingController < ActionController::Base + def show + render :nothing => true + end +end + +class LoggingTest < ActionController::TestCase + tests LoggingController + + class MockLogger + attr_reader :logged + + def method_missing(method, *args) + @logged ||= [] + @logged << args.first + end + end + + setup :set_logger + + def test_logging_without_parameters + get :show + assert_equal 2, logs.size + assert_nil logs.detect {|l| l =~ /Parameters/ } + end + + def test_logging_with_parameters + get :show, :id => 10 + assert_equal 3, logs.size + + params = logs.detect {|l| l =~ /Parameters/ } + assert_equal 'Parameters: {"id"=>"10"}', params + end + + private + + def set_logger + @controller.logger = MockLogger.new + end + + def logs + @logs ||= @controller.logger.logged.compact.map {|l| l.strip} + end +end
Add some basic controller logging tests
diff --git a/app/controllers/api/version1_controller.rb b/app/controllers/api/version1_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/version1_controller.rb +++ b/app/controllers/api/version1_controller.rb @@ -16,7 +16,7 @@ render json: Responses::success(result) end else - render json: 'Unrecognized API Key' + render json: Responses::failure('Unrecognized API Key') end end @@ -35,7 +35,7 @@ end render json: Responses::success else - render json: 'Unrecognized API Key' + render json: Responses::failure('Unrecognized API Key') end end
Use the failure response for bad API keys
diff --git a/app/controllers/content_only_controller.rb b/app/controllers/content_only_controller.rb index abc1234..def5678 100644 --- a/app/controllers/content_only_controller.rb +++ b/app/controllers/content_only_controller.rb @@ -1,5 +1,12 @@ class ContentOnlyController < ApplicationController before_action :authenticate_user!, :check_account_completion, except: [:home, :awards_for_organisations, :enterprise_promotion_awards, :how_to_apply, :timeline, :additional_information_and_contact, :terms, :apply_for_queens_award_for_enterprise] + + before_action :get_current_form, only: [ + :award_info_innovation, + :award_info_trade, + :award_info_development, + :award_info_promotion + ] expose(:form_answer) { current_user.form_answers.find(params[:id]) @@ -10,31 +17,11 @@ @user_award_forms = current_user.account.form_answers.order("award_type") end - def award_info_development + def get_current_form @form_answer = current_account.form_answers.find(params[:form_id]) @form = @form_answer.award_form.decorate( answers: HashWithIndifferentAccess.new(@form_answer.document) ) end - def award_info_innovation - @form_answer = current_account.form_answers.find(params[:form_id]) - @form = @form_answer.award_form.decorate( - answers: HashWithIndifferentAccess.new(@form_answer.document) - ) - end - - def award_info_trade - @form_answer = current_account.form_answers.find(params[:form_id]) - @form = @form_answer.award_form.decorate( - answers: HashWithIndifferentAccess.new(@form_answer.document) - ) - end - - def award_info_promotion - @form_answer = current_account.form_answers.find(params[:form_id]) - @form = @form_answer.award_form.decorate( - answers: HashWithIndifferentAccess.new(@form_answer.document) - ) - end end
Use before_action for the award info pages
diff --git a/lib/generators/rapidfire/templates/migrations/add_after_survey_content_to_survey.rb b/lib/generators/rapidfire/templates/migrations/add_after_survey_content_to_survey.rb index abc1234..def5678 100644 --- a/lib/generators/rapidfire/templates/migrations/add_after_survey_content_to_survey.rb +++ b/lib/generators/rapidfire/templates/migrations/add_after_survey_content_to_survey.rb @@ -1,4 +1,11 @@-class AddAfterSurveyContentToSurvey < ActiveRecord::Migration +if Rails::VERSION::MAJOR >= 5 + version = [Rails::VERSION::MAJOR, Rails::VERSION::MINOR].join('.').to_f + base = ActiveRecord::Migration[version] +else + base = ActiveRecord::Migration +end + +class AddAfterSurveyContentToSurvey < base def change add_column :rapidfire_surveys, :after_survey_content, :text end
Fix migration not being versioned
diff --git a/server/app/models/client.rb b/server/app/models/client.rb index abc1234..def5678 100644 --- a/server/app/models/client.rb +++ b/server/app/models/client.rb @@ -1,7 +1,8 @@ class Client < ActiveRecord::Base has_many :facts, :dependent => :destroy - has_many :configs, :dependent => :destroy + has_many :originals, :dependent => :destroy + has_many :etch_configs, :dependent => :destroy has_many :results, :dependent => :destroy validates_presence_of :name
Update the relationships with other models git-svn-id: 907a5e332d9df9b9d6ff346e9993373f8c03b4a0@66 59d7d9da-0ff4-4beb-9ab8-e480f87378b2
diff --git a/server/model/static_html.rb b/server/model/static_html.rb index abc1234..def5678 100644 --- a/server/model/static_html.rb +++ b/server/model/static_html.rb @@ -8,12 +8,12 @@ def self.get_and_update_for_path path url = HikeApp.base_url + path - static_html = StaticHtml.find(:url => url) + static_html = StaticHtml.find(:url => path) Thread.new do html = StaticHtml.get_static_html_for_path(url) if not static_html static_html = StaticHtml.new( - :url => url, + :url => path, :html => html, :fetch_time => Time.now )
Use relative path intead of absolute to key into StaticHtml table.
diff --git a/kitchen-tests/cookbooks/base/recipes/packages.rb b/kitchen-tests/cookbooks/base/recipes/packages.rb index abc1234..def5678 100644 --- a/kitchen-tests/cookbooks/base/recipes/packages.rb +++ b/kitchen-tests/cookbooks/base/recipes/packages.rb @@ -15,7 +15,7 @@ multipackage pkgs end -gems = %w{fpm aws-sdk} +gems = %w{fpm community_cookbook_releaser} gems.each do |gem| chef_gem gem do
Switch to a smaller gem to install in kitchen runs aws-sdk is 132 gems now. It takes *forever* to install on some platforms like CentOS 6. Use a simple gem. Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/lib/messaging/message_handlers/request_handler.rb b/lib/messaging/message_handlers/request_handler.rb index abc1234..def5678 100644 --- a/lib/messaging/message_handlers/request_handler.rb +++ b/lib/messaging/message_handlers/request_handler.rb @@ -6,8 +6,8 @@ attr_reader :response def handle_message(payload, msg_handler) + initialize_properties msg_handler logger.debug "Got request on #{destination} with correlation_id #{@correlation_id}" - initialize_properties msg_handler if !@correlation_id logger.error "Received request without correlation_id" Freddy.notify_exception(e)
Fix request correlation id not being logged out
diff --git a/lib/amazon_athena/commands/show_tables.rb b/lib/amazon_athena/commands/show_tables.rb index abc1234..def5678 100644 --- a/lib/amazon_athena/commands/show_tables.rb +++ b/lib/amazon_athena/commands/show_tables.rb @@ -14,8 +14,9 @@ def run(connection) connection.query(statement).map {|row| row.tab_name } + rescue Exception => e + e.getCause() end - end end end
Handle error when listing tables
diff --git a/tasks/gwt_javadoc_fix.rake b/tasks/gwt_javadoc_fix.rake index abc1234..def5678 100644 --- a/tasks/gwt_javadoc_fix.rake +++ b/tasks/gwt_javadoc_fix.rake @@ -0,0 +1,12 @@+# Ugly hack required as the gwt jars cause the javadoc tool heart ache +module Buildr + module DocFix #:nodoc: + include Extension + after_define(:doc) do |project| + project.doc.classpath.delete_if {|f| f.to_s =~ /.*\/com\/google\/gwt\/gwt-(dev|user)\/.*/} + end + end + class Project #:nodoc: + include DocFix + end +end
Add an ugly hack to get javadoc to work witht eh GWT libraries
diff --git a/chrome_debugger.gemspec b/chrome_debugger.gemspec index abc1234..def5678 100644 --- a/chrome_debugger.gemspec +++ b/chrome_debugger.gemspec @@ -1,10 +1,10 @@ Gem::Specification.new do |s| s.name = "chrome_debugger" - s.version = "0.0.3" + s.version = "0.0.4" s.summary = "Remotely control Google Chrome and extract stats" s.description = "Starts a Google Chrome session. Load pages and examine the results." s.authors = ["Justin Morris","James Healy"] - s.email = ["justin.morris@theconversation.edu.au","james.healy@theconversation.edu.au"] + s.email = ["justin.morris@theconversation.edu.au","james@yob.id.au"] s.homepage = "http://github.com/conversation/chrome_debugger" s.has_rdoc = true s.rdoc_options << "--title" << "Chrome Debugger" << "--line-numbers"
Fix James email addy in the gemspec
diff --git a/lib/pione/rule-engine/engine-exception.rb b/lib/pione/rule-engine/engine-exception.rb index abc1234..def5678 100644 --- a/lib/pione/rule-engine/engine-exception.rb +++ b/lib/pione/rule-engine/engine-exception.rb @@ -8,7 +8,7 @@ def message "Execution error when handling the rule '%s': inputs=%s, output=%s, params=%s" % [ - @handler.rule.path, + @handler.rule_name, @handler.inputs, @handler.outputs, @handler.params.inspect
Fix a message problem of `RuleExecutionError`.
diff --git a/raygun_client.gemspec b/raygun_client.gemspec index abc1234..def5678 100644 --- a/raygun_client.gemspec +++ b/raygun_client.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'raygun_client' - s.version = '0.0.2.3' + s.version = '0.0.2.4' s.summary = 'Client for the Raygun API using the Obsidian HTTP client' s.description = ' '
Package version is increased from 0.0.2.3 to 0.0.2.4
diff --git a/razorpay-ruby.gemspec b/razorpay-ruby.gemspec index abc1234..def5678 100644 --- a/razorpay-ruby.gemspec +++ b/razorpay-ruby.gemspec @@ -17,10 +17,10 @@ spec.test_files = spec.files.grep(/^(test|spec|features)/) spec.require_paths = ['lib'] + spec.add_development_dependency 'coveralls', '~> 0.8' + spec.add_development_dependency 'minitest', '~> 5.10' spec.add_development_dependency 'rake', '~> 12.0' - spec.add_development_dependency 'minitest', '~> 5.10' + spec.add_development_dependency 'rubocop', '~> 0.49' spec.add_development_dependency 'webmock', '~> 2.3' - spec.add_development_dependency 'coveralls', '~> 0.8' - spec.add_development_dependency 'rubocop', '~> 0.49' spec.add_dependency 'httparty', '~> 0.14' end
[rubocop] Arrange dependencies in alpbhetical order
diff --git a/cookbooks/nagios/recipes/server_package.rb b/cookbooks/nagios/recipes/server_package.rb index abc1234..def5678 100644 --- a/cookbooks/nagios/recipes/server_package.rb +++ b/cookbooks/nagios/recipes/server_package.rb @@ -18,6 +18,21 @@ # limitations under the License. # +if platform_family?(debian) + + # Nagios package requires to enter the admin password + # We generate it randomly as it's overwritten later in the config templates + random_initial_password = rand(36**16).to_s(36) + + %w{adminpassword adminpassword-repeat}.each do |setting| + execute "preseed nagiosadmin password" do + command "echo nagios3-cgi nagios3/#{setting} password #{random_initial_password} | debconf-set-selections" + not_if 'dpkg -l nagios3' + end + end + +end + %w{ nagios3 nagios-nrpe-plugin
Fix Nagios server installs via package using a closed out pull request Former-commit-id: 9d7bb90849b633cb2606f0bd5d4212319a059c6c [formerly bc361734ad782814e369a6a5c317cfc0b08efd0a] [formerly f3bd6eef3d2758750a4016907ef6c5d4c61dc50b [formerly 7bb92f416cd2722bc15879565c0789fe8fd90296]] Former-commit-id: 59129f1e5be8109f2ba6322f52a32bf4ff85b2a7 [formerly a04ae576ca1aa1bec7ab7d4a60e64c1500039891] Former-commit-id: 86e6d74734a5828f3f580aa800b0c18848479794
diff --git a/spec/edmunds_spec_helper.rb b/spec/edmunds_spec_helper.rb index abc1234..def5678 100644 --- a/spec/edmunds_spec_helper.rb +++ b/spec/edmunds_spec_helper.rb @@ -19,7 +19,8 @@ c.cassette_library_dir = 'fixtures/vcr_cassettes' c.hook_into :webmock c.filter_sensitive_data('EDMUNDS_API_KEY') { ENV['EDMUNDS_API_KEY'] } - + c.ignore_hosts 'codeclimate.com' + # filter sensitive response headers from API c.before_record do |i| i.response.headers.delete('Set-Cookie')
Set VCR to ignore codeclimate.com
diff --git a/spec/json_validator_spec.rb b/spec/json_validator_spec.rb index abc1234..def5678 100644 --- a/spec/json_validator_spec.rb +++ b/spec/json_validator_spec.rb @@ -11,11 +11,11 @@ spawn_model :User do schema = { - "type" => "object", - "$schema" => "http://json-schema.org/draft-03/schema", - "properties" => { - "city" => { "type" => "string", "required" => false }, - "country" => { "type" => "string", "required" => true } + type: 'object', + :'$schema' => 'http://json-schema.org/draft-03/schema', + properties: { + city: { type: 'string', required: false }, + country: { type: 'string', required: true } } }
Use symbols instead of string for schema in specs
diff --git a/spec/configuration_manager_spec.rb b/spec/configuration_manager_spec.rb index abc1234..def5678 100644 --- a/spec/configuration_manager_spec.rb +++ b/spec/configuration_manager_spec.rb @@ -2,22 +2,22 @@ require 'nerve/configuration_manager' describe Nerve::ConfigurationManager do - describe 'normal run' do + describe 'parsing config' do let(:config_manager) { Nerve::ConfigurationManager.new() } let(:nerve_config) { "#{File.dirname(__FILE__)}/../example/nerve.conf.json" } - let(:nerve_instance_id) { "testid" } + let(:nerve_instance_id) { 'testid' } - it 'parses options' do + it 'parses valid options' do allow(config_manager).to receive(:parse_options_from_argv!) { { :config => nerve_config, - :instance_id => "testid", + :instance_id => nerve_instance_id, :check_config => false } } expect{config_manager.reload!}.to raise_error(RuntimeError) expect(config_manager.parse_options!).to eql({ :config => nerve_config, - :instance_id => "testid", + :instance_id => nerve_instance_id, :check_config => false }) expect{config_manager.reload!}.not_to raise_error
Make configuration manager specs clearer
diff --git a/spec/perpetuity/mongodb_spec.rb b/spec/perpetuity/mongodb_spec.rb index abc1234..def5678 100644 --- a/spec/perpetuity/mongodb_spec.rb +++ b/spec/perpetuity/mongodb_spec.rb @@ -0,0 +1,85 @@+$:.unshift('lib').uniq! +require 'perpetuity/mongodb' + +module Perpetuity + describe MongoDB do + let(:mongo) { MongoDB.new db: 'perpetuity_gem_test' } + let(:klass) { String } + subject { mongo } + + it 'is not connected when instantiated' do + mongo.should_not be_connected + end + + it 'connects to its host' do + connection = double('connection') + Mongo::Connection.stub(new: connection) + mongo.connect + mongo.should be_connected + mongo.connection.should == connection + end + + it 'connects automatically when accessing the database' do + mongo.database + mongo.should be_connected + end + + describe 'initialization params' do + let(:host) { double('host') } + let(:port) { double('port') } + let(:db) { double('db') } + let(:pool_size) { double('pool size') } + let(:username) { double('username') } + let(:password) { double('password') } + let(:mongo) do + MongoDB.new( + host: host, + port: port, + db: db, + pool_size: pool_size, + username: username, + password: password + ) + end + subject { mongo } + + its(:host) { should == host } + its(:port) { should == port } + its(:db) { should == db } + its(:pool_size) { should == pool_size } + its(:username) { should == username } + its(:password) { should == password } + end + + it 'uses the selected database' do + mongo.database.name.should == 'perpetuity_gem_test' + end + + it 'removes all documents from a collection' do + mongo.insert klass, {} + mongo.delete_all klass + mongo.count(klass).should == 0 + end + + it 'counts the documents in a collection' do + mongo.delete_all klass + 3.times do + mongo.insert klass, {} + end + mongo.count(klass).should == 3 + end + + it 'gets the first document in a collection' do + value = {value: 1} + mongo.insert klass, value + mongo.first(klass)[:hypothetical_value].should == value['value'] + end + + it 'gets all of the documents in a collection' do + values = [{value: 1}, {value: 2}] + mongo.should_receive(:retrieve).with(Object, {}, {}) + .and_return(values) + mongo.all(Object).should == values + end + end +end
Add spec for MongoDB wrapper
diff --git a/spec/support/shared_examples.rb b/spec/support/shared_examples.rb index abc1234..def5678 100644 --- a/spec/support/shared_examples.rb +++ b/spec/support/shared_examples.rb @@ -43,5 +43,13 @@ # We do not require failure_message_when_negated and does_not_match? # Because some matchers purposefully do not support negation. end + + it 'can be used in a composed matcher expression' do + expect([valid_value, invalid_value]).to include(matcher) + + expect { + expect([invalid_value]).to include(matcher) + }.to fail_matching("include (#{matcher.description})") + end end
Add shared example enforcing usage in a composed matcher expression.
diff --git a/ArrayDiff.podspec b/ArrayDiff.podspec index abc1234..def5678 100644 --- a/ArrayDiff.podspec +++ b/ArrayDiff.podspec @@ -1,15 +1,14 @@ Pod::Spec.new do |s| s.name = "ArrayDiff" - s.version = "1.0.4" + s.version = "1.1.0" s.summary = "ArrayDiff quickly computes the difference between two arrays, works great with UITableView/UICollectionView" s.homepage = "https://github.com/Adlai-Holler/ArrayDiff" s.license = { :type => "MIT" } s.authors = { "Adlai-Holler" => "adlai@icloud.com" } s.requires_arc = true - s.osx.deployment_target = "10.9" s.ios.deployment_target = "8.0" - s.source = { :git => "https://github.com/Adlai-Holler/ArrayDiff.git", :tag => "v1.0.4" } + s.source = { :git => "https://github.com/Adlai-Holler/ArrayDiff.git", :tag => "v1.1.0" } s.source_files = "ArrayDiff/*.swift" end
Remove OS X declaration for now, bump to 1.1.0
diff --git a/lib/credit_card_validator.rb b/lib/credit_card_validator.rb index abc1234..def5678 100644 --- a/lib/credit_card_validator.rb +++ b/lib/credit_card_validator.rb @@ -1,5 +1,8 @@ require "credit_card_validator/version" module CreditCardValidator - # Your code goes here... + + def self.validate(number) + end + end
Define Credit Card validator module
diff --git a/genlock.gemspec b/genlock.gemspec index abc1234..def5678 100644 --- a/genlock.gemspec +++ b/genlock.gemspec @@ -17,4 +17,6 @@ "lib/genlock.rb", "lib/genlock/version.rb", ] + + s.executables << "genlock" end
Include the binary in the gem, duh
diff --git a/lib/minitest/color_plugin.rb b/lib/minitest/color_plugin.rb index abc1234..def5678 100644 --- a/lib/minitest/color_plugin.rb +++ b/lib/minitest/color_plugin.rb @@ -9,7 +9,7 @@ def self.plugin_color_init options if Color.color? - io = options.delete(:io) || $stdout + io = options.fetch(:io, $stdout) self.reporter.reporters.reject! {|o| o.is_a? ProgressReporter } self.reporter.reporters << Color.new(io, options) end
Make minitest color play nice with others References teoljungberg/minitest-documentation#2
diff --git a/lib/rails-settings-cached.rb b/lib/rails-settings-cached.rb index abc1234..def5678 100644 --- a/lib/rails-settings-cached.rb +++ b/lib/rails-settings-cached.rb @@ -5,7 +5,7 @@ class RailsSettings::Railtie < Rails::Railtie initializer "rails_settings.active_record.initialization" do - RailsSettings::Settings.after_commit :rewrite_cache, on: %i(create update) - RailsSettings::Settings.after_commit :expire_cache, on: %i(destroy) + RailsSettings::CachedSettings.after_commit :rewrite_cache, on: %i(create update) + RailsSettings::CachedSettings.after_commit :expire_cache, on: %i(destroy) end end
Add callbacks to CachedSettings instead of Settings model
diff --git a/Casks/gas-mask.rb b/Casks/gas-mask.rb index abc1234..def5678 100644 --- a/Casks/gas-mask.rb +++ b/Casks/gas-mask.rb @@ -1,6 +1,6 @@ cask :v1 => 'gas-mask' do - version '0.8.1' - sha256 'f384e973603088ed5afbe841ef7d5698262988c65a0437a9d8011dcb667fcc2e' + version '0.8.3' + sha256 '907aa5979d1a902fa2582f5b6a4f2b1087e5f4e60cc9eb87594407d60fcd2d53' url "http://gmask.clockwise.ee/files/gas_mask_#{version}.zip" appcast 'http://gmask.clockwise.ee/check_update/',
Update Gas Mask to 0.8.3
diff --git a/spec/requests/notes_spec.rb b/spec/requests/notes_spec.rb index abc1234..def5678 100644 --- a/spec/requests/notes_spec.rb +++ b/spec/requests/notes_spec.rb @@ -45,7 +45,7 @@ click_on 'Add note' end - find('#in_progress .story .notelist p.note').should have_content('Adding a new note') + find('#in_progress .story .notelist .note').should have_content('Adding a new note') end
Fix selector in note request spec.
diff --git a/lib/sunspot_with_kaminari.rb b/lib/sunspot_with_kaminari.rb index abc1234..def5678 100644 --- a/lib/sunspot_with_kaminari.rb +++ b/lib/sunspot_with_kaminari.rb @@ -1,10 +1,6 @@-# module SunspotWithKaminari -# end - -module Sunspot +module SunspotWithKaminari module Search - class AbstractSearch - + module AbstractSearchInstanceMethods # ==== Returns # # Integer:: Current page number @@ -12,7 +8,7 @@ def current_page @query.page end - + # ==== Returns # # Integer:: Total number of pages for matching documents @@ -20,7 +16,7 @@ def num_pages (total.to_f / @query.per_page).ceil end - + # ==== Returns # # Integer:: Number of records displayed per page @@ -28,14 +24,16 @@ def limit_value @query.per_page end - + def empty? total == 0 end - + def any? total > 0 end end end end + +Sunspot::Search::AbstractSearch.send(:include, SunspotWithKaminari::Search::AbstractSearchInstanceMethods)
Refactor to be a good citizen
diff --git a/lib/tasks/elasticsearch.rake b/lib/tasks/elasticsearch.rake index abc1234..def5678 100644 --- a/lib/tasks/elasticsearch.rake +++ b/lib/tasks/elasticsearch.rake @@ -1,22 +1,28 @@ require 'elasticsearch/rails/tasks/import' +Rake::TaskManager.record_task_metadata = true namespace :elasticsearch do - desc "Zero downtime reindexing - $ rake environment elasticsearch:reindex CLASS='User' INDEX='employees_201402240920' ALIAS='employees FORCE=y'" - task reindex: :environment do - # TODO: check for arguments CLASS INDEX ALIAS FORCE - aliaz = ENV["ALIAS"] - index = ENV["INDEX"] + desc "Zero downtime re-indexing + $ rake environment elasticsearch:reindex CLASS='Model_name' ALIAS='alias_name'" + task reindex: :environment do |task| + if ENV['CLASS'].blank? || ENV['ALIAS'].blank? + puts "USAGE:" + puts task.full_comment + exit(1) + end + + ENV["FORCE"] = 'y' # must be set to force mapping + ENV['INDEX'] = "#{ENV['ALIAS']}_#{Time.new.strftime('%Y%m%d%H%M%S')}" client = Elasticsearch::Client.new - has_alias = client.indices.exists_alias name: aliaz - old_indices = has_alias ? client.indices.get_alias(name: aliaz).map {|k,v| k } : [] + has_alias = client.indices.exists_alias name: ENV["ALIAS"] + old_indices = has_alias ? client.indices.get_alias(name: ENV["ALIAS"]).map {|k,v| k } : [] - # Creat new index + # Creat new index, command line arguments are used Rake::Task["elasticsearch:import:model"].invoke - client.indices.delete_alias(index: "*", name: aliaz) if has_alias - client.indices.put_alias(index: index, name: aliaz) + client.indices.delete_alias(index: "*", name: ENV["ALIAS"]) if has_alias + client.indices.put_alias(index: ENV['INDEX'], name: ENV["ALIAS"]) client.indices.delete(index: old_indices) if old_indices.present? end end
Check for arguments in Rake task and assign index name dynamically
diff --git a/ruby/matrix/matrix.rb b/ruby/matrix/matrix.rb index abc1234..def5678 100644 --- a/ruby/matrix/matrix.rb +++ b/ruby/matrix/matrix.rb @@ -1,8 +1,13 @@ class Matrix - attr_reader :rows, :columns + attr_reader :columns, :numbers def initialize(numbers) - @rows = numbers.split("\n").map { |row| row.split(' ').map(&:to_i) } + @numbers = numbers @columns = rows.transpose end + + def rows + numbers.lines.map { |row| row.split.map(&:to_i) } + end end +
Remove rows from attr_reader and user better methods in rows
diff --git a/lib/vivaldi/configuration.rb b/lib/vivaldi/configuration.rb index abc1234..def5678 100644 --- a/lib/vivaldi/configuration.rb +++ b/lib/vivaldi/configuration.rb @@ -7,18 +7,35 @@ @listeners = [] end - def instrument(name, *args, &block) - instrument = Instrument.play(name, *args, &block) - if instrument.nil? - raise ArgumentError, "unknown instrument: #{name.inspect}" + def instrument(instrument_or_name, *args, &block) + instrument = if instrument_or_name.respond_to?(:play) + if args.empty? + instrument_or_name + else + raise ArgumentError, "invalid call signature" + end + elsif + Instrument.play(instrument_or_name, *args, &block) + else + raise ArgumentError, "unknown instrument: #{instrument_or_name.inspect}" end @instruments << instrument instrument end - def listen(klass, *args) - listener = klass.new(*args) + def listen(listener_or_klass, *args) + listener = if listener_or_klass.is_a?(Class) + listener_or_klass.new(*args) + elsif listener_or_klass.respond_to?(:observe) + if args.empty? + listener_or_klass + else + raise ArgumentError, "invalid call signature" + end + else + raise ArgumentError, "invalid listener" + end @listeners << listener listener
Change instrument and listen method signatures
diff --git a/lib/asterisk/event.rb b/lib/asterisk/event.rb index abc1234..def5678 100644 --- a/lib/asterisk/event.rb +++ b/lib/asterisk/event.rb @@ -1,9 +1,10 @@+require File.expand_path(File.dirname(__FILE__)) + "/message_helper" + module Asterisk - class Event include Asterisk::MessageHelper def self.parse(str) parse_lines(str) end end -end+end
Load dependency required by Asterisk::Event If MessageHelper wasn't require'd before event, it would break. Which it does, depending on the order Dir[pattern] returns the files.
diff --git a/lib/boxen/keychain.rb b/lib/boxen/keychain.rb index abc1234..def5678 100644 --- a/lib/boxen/keychain.rb +++ b/lib/boxen/keychain.rb @@ -18,6 +18,8 @@ def initialize(login) @login = login + # Clear the password. We're storing tokens now. + set PASSWORD_SERVICE, "" end def token
Revert "Keychain helper doesn't like clearing the password" This reverts commit 105b8d00b5136b8c36bc7b6ad934b261799aecce.
diff --git a/listable_collections.gemspec b/listable_collections.gemspec index abc1234..def5678 100644 --- a/listable_collections.gemspec +++ b/listable_collections.gemspec @@ -19,7 +19,7 @@ s.required_ruby_version = '>= 2.1.0' - s.add_dependency 'rails', (ENV['RAILS_VERSION'] ? "~> #{ENV['RAILS_VERSION']}" : ['>= 4.2.0', '< 4.3.0']) + s.add_dependency 'rails', (ENV['RAILS_VERSION'] ? "~> #{ENV['RAILS_VERSION']}" : ['>= 4.0.0', '< 4.3.0']) s.add_development_dependency 'mocha', '~> 1.1' s.add_development_dependency 'sqlite3', '~> 1.3'
Update gemspec rails versions range
diff --git a/files/chef-marketplace-cookbooks/chef-marketplace/recipes/_automate_enable.rb b/files/chef-marketplace-cookbooks/chef-marketplace/recipes/_automate_enable.rb index abc1234..def5678 100644 --- a/files/chef-marketplace-cookbooks/chef-marketplace/recipes/_automate_enable.rb +++ b/files/chef-marketplace-cookbooks/chef-marketplace/recipes/_automate_enable.rb @@ -1,7 +1,10 @@ include_recipe 'chef-marketplace::_server_enable' directory '/etc/delivery' -directory '/var/opt/delivery/license' + +directory '/var/opt/delivery/license' do + recursive true +end private_key '/etc/delivery/delivery.pem' do cipher 'DES-EDE3-CBC'
Create license directory when configuring Azure
diff --git a/lib/que/rake_tasks.rb b/lib/que/rake_tasks.rb index abc1234..def5678 100644 --- a/lib/que/rake_tasks.rb +++ b/lib/que/rake_tasks.rb @@ -7,6 +7,7 @@ Que.logger.level = Logger.const_get((ENV['QUE_LOG_LEVEL'] || 'INFO').upcase) Que.worker_count = (ENV['QUE_WORKER_COUNT'] || 4).to_i Que.wake_interval = (ENV['QUE_WAKE_INTERVAL'] || 0.1).to_f + Que.mode = :async # When changing how signals are caught, be sure to test the behavior with # the rake task in tasks/safe_shutdown.rb.
Make sure the worker pool is actually started up in the que:work rake task.
diff --git a/sinatra-param.gemspec b/sinatra-param.gemspec index abc1234..def5678 100644 --- a/sinatra-param.gemspec +++ b/sinatra-param.gemspec @@ -12,7 +12,7 @@ s.summary = "Parameter Validation & Type Coercion for Sinatra." s.description = "sinatra-param allows you to declare, validate, and transform endpoint parameters as you would in frameworks like ActiveModel or DataMapper." - s.add_dependency "sinatra", "~> 1.3" + s.add_dependency "sinatra", ">= 1.3" s.add_development_dependency "rake" s.add_development_dependency "rspec"
Remove sinatra version dependency to allow for 2.0
diff --git a/spec/organism_spec.rb b/spec/organism_spec.rb index abc1234..def5678 100644 --- a/spec/organism_spec.rb +++ b/spec/organism_spec.rb @@ -0,0 +1,34 @@+require 'spec_helper' + +describe Organism do + let(:options) { { :iconic_taxon => {:name => "Mammalia", :rank => "class"}, + :taxon => {:name => "Arctocephalus pusillus", + :rank => "species", + :common_name => { :name => "Brown Fur Seal" }}} } + let(:organism) { Organism.new( options )} + + it 'accepts a options hash as its parameters' do + expect(options).to be_a Hash + end + + it 'has a name that is colloquially known' do + expect(organism.english_name).to eq "Brown Fur Seal" + end + + it 'has a taxon name' do + expect(organism.taxon_name).to eq "Arctocephalus pusillus" + end + + it 'has a taxon rank' do + expect(organism.taxon_rank).to eq "species" + end + + it 'has an iconic taxon name' do + expect(organism.iconic_taxon_name).to eq "Mammalia" + end + + it 'has an iconic taxon rank' do + expect(organism.iconic_taxon_rank).to eq "class" + end + +end
Test all methods for organism model
diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index abc1234..def5678 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,5 +1,6 @@ module ApplicationCable class Connection < ActionCable::Connection::Base + # include SessionsHelper identified_by :current_user def connect
Use Sophie B's current user methods
diff --git a/Casks/skitch1.rb b/Casks/skitch1.rb index abc1234..def5678 100644 --- a/Casks/skitch1.rb +++ b/Casks/skitch1.rb @@ -3,8 +3,9 @@ sha256 :no_check url 'http://evernote.com/download/get.php?file=SkitchMac_v1' + name 'Skitch' homepage 'http://blog.evernote.com/blog/2012/11/21/skitch-and-evernote-a-letter-from-keith-lang/' - license :unknown + license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder app 'Skitch.app' end
Skitch1: Add name, update license stanza
diff --git a/026-reciprocal-cycles/ruby-solution.rb b/026-reciprocal-cycles/ruby-solution.rb index abc1234..def5678 100644 --- a/026-reciprocal-cycles/ruby-solution.rb +++ b/026-reciprocal-cycles/ruby-solution.rb @@ -1,32 +1,27 @@-def repeating_decimal_sequence(one_over_this) - quotient = "" - dividends = [1] +def repeating_decimal_sequence_length(divisor) + dividends = {} + decimal_sequence = '' + current_dividend = 10 + start_index = nil - dividend = 1 - divisor = one_over_this - - until dividends.uniq != dividends - quotient << (dividend / divisor).to_s - dividend = ((dividend - divisor * quotient[-1].to_i).to_s + "0").to_i - dividends << [dividend] + until dividends[current_dividend] + decimal_sequence += (current_dividend / divisor).to_s + dividends[current_dividend] = true + current_dividend = (current_dividend % divisor) * 10 end - start_index = dividends.find_index(dividends[-1]) + start_index = dividends.keys.index(current_dividend) - return "" if quotient[start_index..-1] == "0" - quotient[start_index..-1] + decimal_sequence[start_index..-1].length end -sequences = {} +max_sequence_length = {0 => 0} -(1..999).each do |denominator| - sequences[denominator] = repeating_decimal_sequence(denominator).length +(1...1000).each do |divisor| + next_sequence_length = repeating_decimal_sequence_length(divisor) + if next_sequence_length > max_sequence_length.values.first + max_sequence_length = {divisor => next_sequence_length} + end end -max_pair = [0, 0] - -sequences.each do |key, value| - max_pair = [key, value] if value > max_pair[-1] -end - -p max_pair[0] +p max_sequence_length.keys.first
Refactor ruby solution for speed
diff --git a/msfl_visitors.gemspec b/msfl_visitors.gemspec index abc1234..def5678 100644 --- a/msfl_visitors.gemspec +++ b/msfl_visitors.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'msfl_visitors' - s.version = '0.0.4' - s.date = '2015-05-01' + s.version = '0.1.0' + s.date = '2015-05-06' s.summary = "Convert MSFL to other forms" s.description = "Visitor pattern approach to converting MSFL to other forms." s.authors = ["Courtland Caldwell"]
Update gemspec for v 0.1.0 in preparation for merge to master
diff --git a/spec/bundler/unit/bundler_version_spec.rb b/spec/bundler/unit/bundler_version_spec.rb index abc1234..def5678 100644 --- a/spec/bundler/unit/bundler_version_spec.rb +++ b/spec/bundler/unit/bundler_version_spec.rb @@ -2,7 +2,7 @@ describe 'Bundler version installed' do it 'should be correct on Travis CI' do - if ENV['TRAVIS'] + if ENV['TRAVIS'] && ENV['BUNDLER_TEST_VERSION'] != 'latest' Bundler::VERSION.should == ENV['BUNDLER_TEST_VERSION'] end end
Disable test for bundler test version when 'latest'
diff --git a/spec/features/viewing_all_courses_spec.rb b/spec/features/viewing_all_courses_spec.rb index abc1234..def5678 100644 --- a/spec/features/viewing_all_courses_spec.rb +++ b/spec/features/viewing_all_courses_spec.rb @@ -4,14 +4,15 @@ let(:course_index_page) { CourseIndexPage.new } describe "in the appropriate sections" do - let!(:in_person_course) { FactoryGirl.create(:in_person_course, title: "In Person") } + let!(:in_person_parent_course) { FactoryGirl.create(:in_person_course, title: "In Person") } + let!(:in_person_course) { FactoryGirl.create(:in_person_course, parent_course: in_person_parent_course, title: "In Person in a City") } let!(:online_course) { FactoryGirl.create(:online_course, title: "Online") } scenario do course_index_page.visit_page expect(course_index_page.online_course_titles).to include("Online") expect(course_index_page.online_course_titles).to_not include("In Person") - expect(course_index_page.in_person_course_titles).to include("In Person") + expect(course_index_page.in_person_course_titles).to include("In Person in a City") expect(course_index_page.in_person_course_titles).to_not include("Online") end end
Fix viewing all courses spec
diff --git a/spec/support/create_functional_indexes.rb b/spec/support/create_functional_indexes.rb index abc1234..def5678 100644 --- a/spec/support/create_functional_indexes.rb +++ b/spec/support/create_functional_indexes.rb @@ -1,5 +1,6 @@ class CreateFunctionalIndexes < ActiveRecord::Migration def up + down execute 'create unique index index_users_on_lowercase_login on users using btree (lower(login));' execute 'create unique index index_users_on_lowercase_display_name on users using btree (lower(display_name));' execute 'create unique index index_users_on_lowercase_email on users using btree (lower(email));' @@ -7,9 +8,9 @@ end def down - execute "drop index index_users_on_lowercase_login;" - execute "drop index index_users_on_lowercase_display_name;" - execute 'drop index index_users_on_lowercase_email;' - execute 'drop index index_user_groups_on_lowercase_name;' + execute "drop index if exists index_users_on_lowercase_login;" + execute "drop index if exists index_users_on_lowercase_display_name;" + execute 'drop index if exists index_users_on_lowercase_email;' + execute 'drop index if exists index_user_groups_on_lowercase_name;' end end
Create functional indexes for specs more reliably
diff --git a/PeerTalk.podspec b/PeerTalk.podspec index abc1234..def5678 100644 --- a/PeerTalk.podspec +++ b/PeerTalk.podspec @@ -3,7 +3,10 @@ spec.version = '0.1.0' spec.license = { :type => 'MIT', :file => 'LICENSE.txt' } spec.homepage = 'http://rsms.me/peertalk/' - spec.authors = { 'Rasmus Andersson' => 'rasmus@notion.se' } + spec.authors = { + 'Rasmus Andersson' => 'rasmus@notion.se', + 'Jonathan Dann' => 'jonathan@jonathandann.com' + } spec.summary = 'iOS and OS X Cocoa library for communicating over USB and TCP.' spec.source = { :git => "https://github.com/rsms/PeerTalk.git", :tag => '0.1.0' } @@ -14,5 +17,4 @@ spec.description = "PeerTalk is a iOS and OS X Cocoa library for communicating over USB and TCP.\n\n Highlights:\n\n * Provides you with USB device attach/detach events and attached device's info\n * Can connect to TCP services on supported attached devices (e.g. an iPhone), bridging the communication over USB transport\n * Offers a higher-level API (PTChannel and PTProtocol) for convenient implementations.\n* Tested and designed for libdispatch (aka Grand Central Dispatch).\n" spec.swift_version = ['5.0'] - end
[CocoaPods] Add myself to authors in podspec
diff --git a/core/db/migrate/20160330204846_add_missing_timestamp_columns.rb b/core/db/migrate/20160330204846_add_missing_timestamp_columns.rb index abc1234..def5678 100644 --- a/core/db/migrate/20160330204846_add_missing_timestamp_columns.rb +++ b/core/db/migrate/20160330204846_add_missing_timestamp_columns.rb @@ -0,0 +1,20 @@+class AddMissingTimestampColumns < ActiveRecord::Migration + def change + # Missing updated_at + add_column :friendly_id_slugs, :updated_at, :datetime, null: true + + # Missing created_at + add_column :spree_countries, :created_at, :datetime, null: true + add_column :spree_states, :created_at, :datetime, null: true + add_column :spree_variants, :created_at, :datetime, null: true + + # Missing timestamps + add_timestamps(:spree_option_values_variants, null: true) + add_timestamps(:spree_products_taxons, null: true) + add_timestamps(:spree_promotion_action_line_items, null: true) + add_timestamps(:spree_promotion_actions, null: true) + add_timestamps(:spree_reimbursement_credits, null: true) + add_timestamps(:spree_roles, null: true) + add_timestamps(:spree_variant_property_rule_values, null: true) + end +end
Add missing timestamps for spree_* tables Many models do not have basic timestamps enabled. This commit adds timestamps everywhere they might be useful.
diff --git a/JSONModel.podspec b/JSONModel.podspec index abc1234..def5678 100644 --- a/JSONModel.podspec +++ b/JSONModel.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "JSONModel" - s.version = "1.2.4" + s.version = "1.2.3" s.summary = "Magical Data Modelling Framework for JSON. Create rapidly powerful, atomic and smart data model classes." s.homepage = "http://www.jsonmodel.com" @@ -17,7 +17,7 @@ s.source_files = 'JSONModel/**/*.{m,h}' s.public_header_files = 'JSONModel/**/*.h' - s.dependency 'CocoaLumberjack/Default', '~> 3.0' + s.dependency 'CocoaLumberjack', '~> 2.2' s.requires_arc = true
Revert "Update to 1.2.4, change Cocoalumberjack dependency to 3.0" This reverts commit 26c321c473c6f7236d393ad8113e444602299e25.
diff --git a/RQVisual.podspec b/RQVisual.podspec index abc1234..def5678 100644 --- a/RQVisual.podspec +++ b/RQVisual.podspec @@ -1,18 +1,19 @@ Pod::Spec.new do |s| - s.platform = :ios, "8.0" - s.name = "RQVisual" - s.version = "1.0.0" - s.summary = "A tool for laying out views in code." + s.platform = :ios, "8.0" + s.name = "RQVisual" + s.version = "1.0.0" + s.summary = "A tool for laying out views in code." - s.description = <<-DESC - Visual is a tool for laying out views in code using a visual - style formats similar to those used by NSLayoutConstraint. - DESC + s.description = <<-DESC + Visual is a tool for laying out views in code using a visual + style formats similar to those used by NSLayoutConstraint. + DESC - s.homepage = "https://github.com/rqueue/RQVisual" - s.license = "MIT" - s.author = { "Ryan Quan" => "ryanhquan@gmail.com" } - s.source = { :git => "https://github.com/rqueue/RQVisual.git", :tag => "1.0.0" } - s.source_files = "RQVisual", "RQVisual/**/*.{h,m}" - s.requires_arc = true + s.homepage = "https://github.com/rqueue/RQVisual" + s.license = "MIT" + s.author = { "Ryan Quan" => "ryanhquan@gmail.com" } + s.source = { :git => "https://github.com/rqueue/RQVisual.git", :tag => "1.0.0" } + s.source_files = "RQVisual", "RQVisual/**/*.{h,m}" + s.requires_arc = true + s.documentation_url = "https://github.com/rqueue/RQVisual" end
Update Podspec to contain documentation URL
diff --git a/spec/integration/donor_upload_spec.rb b/spec/integration/donor_upload_spec.rb index abc1234..def5678 100644 --- a/spec/integration/donor_upload_spec.rb +++ b/spec/integration/donor_upload_spec.rb @@ -2,8 +2,6 @@ describe "uploading donors" do before(:each) do - Title.delete_all - Donor.delete_all Title.create(number: 54, description: "Ms") Title.create(number: 4, description: "Mr") Title.create(number: 30, description: "Dr")
Remove unnecessary truncating of DB
diff --git a/spec/routing/comments_routing_spec.rb b/spec/routing/comments_routing_spec.rb index abc1234..def5678 100644 --- a/spec/routing/comments_routing_spec.rb +++ b/spec/routing/comments_routing_spec.rb @@ -8,8 +8,7 @@ end it "routes to #destroy" do - pending - expect(:delete => "/r/ruby/ruby/comments/1").to route_to("comments#destroy", id: 1, repo_id: "ruby/ruby") + expect(:delete => "/r/ruby/ruby/comments/1").to route_to("comments#destroy", repo_id: "ruby/ruby", id: "1") end end
Fix comments routing spec bug
diff --git a/test/spec_rack_callbacks.rb b/test/spec_rack_callbacks.rb index abc1234..def5678 100644 --- a/test/spec_rack_callbacks.rb +++ b/test/spec_rack_callbacks.rb @@ -1,5 +1,6 @@ require 'minitest/autorun' require 'rack/mock' +require 'rack/contrib/callbacks' class Flame def call(env)
Fix error when running Rack::Callbacks tests individually
diff --git a/test/lib/test_simple_api.rb b/test/lib/test_simple_api.rb index abc1234..def5678 100644 --- a/test/lib/test_simple_api.rb +++ b/test/lib/test_simple_api.rb @@ -17,7 +17,7 @@ end test "upsert" do - data = [{:Id__c => '123123'}, {:Id__c => '234234'}] + data = [{:Id__c => '123123', :Title__c => 'Test Title'}, {:Id__c => '234234', :Title__c => 'A Second Title'}] @client.expects(:add_job).once.with(:upsert, :VideoEvent__c, :concurrency_mode => nil, :external_id_field_name => :Id__c).returns(@job) @client.expects(:add_batch).once.with(@job.id, data).returns(@batch)
Update upsert test with a field with data to modify to match API docs requirement. You have to at least specify one piece of data to modify other than the external id provided.
diff --git a/lib/axe/page.rb b/lib/axe/page.rb index abc1234..def5678 100644 --- a/lib/axe/page.rb +++ b/lib/axe/page.rb @@ -5,7 +5,7 @@ module Axe class Page extend Forwardable - def_delegators :@browser, :evaluate_script, :execute_script, :execute_async_script + def_delegators :@browser, :evaluate_script, :execute_script def initialize(browser) @browser = browser @@ -20,7 +20,7 @@ end def adapt_async_script_executor - extend ExecuteAsyncScriptAdapter unless @browser.respond_to? :execute_async_script + extend ExecuteAsyncScriptAdapter end end end
Revert "Only adapt if driver doesn't already support async script" This reverts commit 3c5f0d8544133e74304f9697a53a995ba120046f.
diff --git a/app/controllers/teachers_controller.rb b/app/controllers/teachers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/teachers_controller.rb +++ b/app/controllers/teachers_controller.rb @@ -20,7 +20,7 @@ @teacher = Teacher.new(teacher_params) p "ABOUT TO SAVE" p @teacher - @teacher.password = "temp" + # @teacher.password = "temp" if @teacher.save p "=============" p @teacher
Remove temp password in teachers controller
diff --git a/lib/scm/util.rb b/lib/scm/util.rb index abc1234..def5678 100644 --- a/lib/scm/util.rb +++ b/lib/scm/util.rb @@ -41,6 +41,8 @@ # The stdout of the command being ran. # def popen(command,*arguments) + Dir.chdir @path + unless arguments.empty? command = command.dup
Change into the working of repository in Util.popen.
diff --git a/spanner/spec/quickstart_spec.rb b/spanner/spec/quickstart_spec.rb index abc1234..def5678 100644 --- a/spanner/spec/quickstart_spec.rb +++ b/spanner/spec/quickstart_spec.rb @@ -33,7 +33,7 @@ expect { load File.expand_path("../quickstart.rb", __dir__) - }.to output("1").to_stdout + }.to output(/1/).to_stdout end end
Fix spec test for spanner quickstart
diff --git a/lib/titleist.rb b/lib/titleist.rb index abc1234..def5678 100644 --- a/lib/titleist.rb +++ b/lib/titleist.rb @@ -1,5 +1,6 @@ # typed: strict require 'active_support/all' +require 'sorbet-runtime' require 'titleist/version' require 'titleist/engine'
Add sorbet-runtime to requires so T is available to applications
diff --git a/lib/zend/cli.rb b/lib/zend/cli.rb index abc1234..def5678 100644 --- a/lib/zend/cli.rb +++ b/lib/zend/cli.rb @@ -1,4 +1,27 @@ module Zend + class Tickets < Thor + desc 'tickets list [string]', 'Print list of tickets' + option :new, aliases: '-n', type: :boolean, desc: 'include new tickets' + option :open, aliases: '-o', type: :boolean, desc: 'include open tickets' + option :pending, aliases: '-p', type: :boolean, desc: 'include pending tickets' + option :solved, aliases: '-s', type: :boolean, desc: 'include solved tickets' + option :closed, aliases: '-c', type: :boolean, desc: 'include closed tickets' + option :tags, aliases: '-t', type: :array, desc: 'only list tickets containing these tags' + def list(query='') + Zend::Command::Ticket::List.new(query, options) + end + + desc 'show ID', 'Get details of a Zendesk ticket' + def show(id) + Zend::Command::Ticket::Show.new(id) + end + + desc 'description ID [DESCRIPTION]', 'Get single line ticket description' + def description(id, description=nil) + Zend::Command::Ticket::Description.new(id, description) + end + end + class CLI < Thor desc 'login', 'Starts prompt to login to your Zendesk account' @@ -11,29 +34,7 @@ Zend::Auth.logout end - class Tickets < Thor - desc 'tickets list [string]', 'Print list of tickets' - option :new, aliases: '-n', type: :boolean, desc: 'include new tickets' - option :open, aliases: '-o', type: :boolean, desc: 'include open tickets' - option :pending, aliases: '-p', type: :boolean, desc: 'include pending tickets' - option :solved, aliases: '-s', type: :boolean, desc: 'include solved tickets' - option :closed, aliases: '-c', type: :boolean, desc: 'include closed tickets' - option :tags, aliases: '-t', type: :array, desc: 'only list tickets containing these tags' - def list(query='') - Zend::Command::Ticket::List.new(query, options) - end - - desc 'show ID', 'Get details of a Zendesk ticket' - def show(id) - Zend::Command::Ticket::Show.new(id) - end - - desc 'description ID [DESCRIPTION]', 'Get single line ticket description' - def description(id, description=nil) - Zend::Command::Ticket::Description.new(id, description) - end - end desc 'tickets SUBCOMMAND ...ARGS', 'manage tickets' - subcommand 'tickets', CLI::Tickets + subcommand 'tickets', Tickets end end
Fix `zend help` output issues
diff --git a/jekyll-compass.gemspec b/jekyll-compass.gemspec index abc1234..def5678 100644 --- a/jekyll-compass.gemspec +++ b/jekyll-compass.gemspec @@ -13,7 +13,7 @@ s.files = [*Dir["lib/**/*.rb"], "README.md", "LICENSE"] s.homepage = 'https://github.com/mscharley/jekyll-compass' - s.add_runtime_dependency 'compass', '>= 0.12', '< 2' - s.add_runtime_dependency 'jekyll', '>= 1.3', '< 3' + s.add_runtime_dependency 'compass', '~> 1.0' + s.add_runtime_dependency 'jekyll', '~> 2.0' end
Update dependencies to require compass 1 and jekyll 2
diff --git a/spec/unit/postmark/json_spec.rb b/spec/unit/postmark/json_spec.rb index abc1234..def5678 100644 --- a/spec/unit/postmark/json_spec.rb +++ b/spec/unit/postmark/json_spec.rb @@ -1,21 +1,22 @@ require 'spec_helper' describe Postmark::Json do - let(:json_dump) { "{\"bar\":\"foo\",\"foo\":\"bar\"}" } let(:data) { {"bar" => "foo", "foo" => "bar"} } + + shared_examples "json parser" do + it 'encodes and decodes data correctly' do + hash = Postmark::Json.decode(Postmark::Json.encode(data)) + hash.should have_key("bar") + hash.should have_key("foo") + end + end context "given response parser is JSON" do before do Postmark.response_parser_class = :Json end - it 'encodes data correctly' do - Postmark::Json.encode(data).should == json_dump - end - - it 'decodes data correctly' do - Postmark::Json.decode(json_dump).should == data - end + it_behaves_like "json parser" end context "given response parser is ActiveSupport::JSON" do @@ -23,13 +24,7 @@ Postmark.response_parser_class = :ActiveSupport end - it 'encodes data correctly' do - Postmark::Json.encode(data).should == json_dump - end - - it 'decodes data correctly' do - Postmark::Json.decode(json_dump).should == data - end + it_behaves_like "json parser" end context "given response parser is Yajl", :skip_for_platform => 'java' do @@ -37,12 +32,6 @@ Postmark.response_parser_class = :Yajl end - it 'encodes data correctly' do - Postmark::Json.encode(data).should == json_dump - end - - it 'decodes data correctly' do - Postmark::Json.decode(json_dump).should == data - end + it_behaves_like "json parser" end end
Use different approach to test JSON parsers.
diff --git a/Casks/firefox-nightly-ja.rb b/Casks/firefox-nightly-ja.rb index abc1234..def5678 100644 --- a/Casks/firefox-nightly-ja.rb +++ b/Casks/firefox-nightly-ja.rb @@ -1,6 +1,6 @@ class FirefoxNightlyJa < Cask - version '35.0a1' - sha256 'e024fd2ddc17cec0cdf8969b9128423209b54a8833245044ca8548a9fce7e878' + version '36.0a1' + sha256 '7a80d602e7a59e90577a94a9dbe3290fa2a56e660f73c937d34555c418fed847' url "https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-central-l10n/firefox-#{version}.ja-JP-mac.mac.dmg" homepage 'https://nightly.mozilla.org/'
Upgrade Firefox Nightly ja to v36.0a1
diff --git a/lib/asset_processor.rb b/lib/asset_processor.rb index abc1234..def5678 100644 --- a/lib/asset_processor.rb +++ b/lib/asset_processor.rb @@ -11,7 +11,7 @@ total = asset_ids.count asset_ids.each_with_index do |asset_id, index| count = index + 1 - percent = "%0.0f" % (count / total.to_f * 100) + percent = (count / total.to_f * 100).round if (count % @report_progress_every).zero? @output.puts "#{count} of #{total} (#{percent}%) assets" end
Use .round to convert to integer Rather than "%0.0f", as using .round is shorter and avoids a Rubocop warning.
diff --git a/lib/error_reporting.rb b/lib/error_reporting.rb index abc1234..def5678 100644 --- a/lib/error_reporting.rb +++ b/lib/error_reporting.rb @@ -1,4 +1,8 @@ Rollbar.configure do |config| config.access_token = ENV['ROLLBAR_TOKEN'] + + if ENV['DEVELOPMENT'] + config.enabled = false + end end
Add environment variable to disable Rollbar reporting for development
diff --git a/pact_broker/config.ru b/pact_broker/config.ru index abc1234..def5678 100644 --- a/pact_broker/config.ru +++ b/pact_broker/config.ru @@ -24,6 +24,7 @@ # config.auto_migrate_db = true # config.use_hal_browser = true config.logger = ::Logger.new($stdout) + config.logger.level = Logger::WARN config.database_connection = Sequel.connect(DATABASE_CREDENTIALS.merge(logger: DatabaseLogger.new(config.logger), encoding: 'utf8')) end
Set the default logging verbosity to WARN
diff --git a/lib/services/travis.rb b/lib/services/travis.rb index abc1234..def5678 100644 --- a/lib/services/travis.rb +++ b/lib/services/travis.rb @@ -1,4 +1,5 @@ class Service::Travis < Service + self.title = "Travis CI" default_events :push, :pull_request, :issue_comment, :public, :member string :user password :token
Use Travis CI as title for the service.
diff --git a/lib/shop/shopconfig.rb b/lib/shop/shopconfig.rb index abc1234..def5678 100644 --- a/lib/shop/shopconfig.rb +++ b/lib/shop/shopconfig.rb @@ -16,7 +16,8 @@ # Returns the whole config or a specific value def get(namespace=false, key=false) if namespace && key - return @config[namespace][key] + value = @config[namespace][key] + return value if !value.nil? else '' end return @config if !@config.empty?
Fix shop config class to return empty string on non-existing value
diff --git a/spec/geo_location_spec.rb b/spec/geo_location_spec.rb index abc1234..def5678 100644 --- a/spec/geo_location_spec.rb +++ b/spec/geo_location_spec.rb @@ -9,6 +9,10 @@ context 'when instantiated from a string' do it 'should be an instance of GeoLocation' do expect(verve.class).to eq(GeoLocation) + end + + it 'has methods' do + expect((GeoDistance::Haversine.methods.sort-3.methods).sort).to eq([]) end it 'GeoLocation() should return itself' do
Add spec to show methods of Haversine to see why not working on travis-ci.
diff --git a/spec/models/shift_spec.rb b/spec/models/shift_spec.rb index abc1234..def5678 100644 --- a/spec/models/shift_spec.rb +++ b/spec/models/shift_spec.rb @@ -1,5 +1,9 @@ require 'rails_helper' RSpec.describe Shift, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + it { is_expected.to validate_presence_of(:volunteers_needed)} + it { is_expected.to validate_presence_of(:starts_at)} + it { is_expected.to validate_presence_of(:ends_at)} + + it { is_expected.to belong_to(:event)} end
Add validation and belonging specs to shifts
diff --git a/0_code_wars/operations_with_sets.rb b/0_code_wars/operations_with_sets.rb index abc1234..def5678 100644 --- a/0_code_wars/operations_with_sets.rb +++ b/0_code_wars/operations_with_sets.rb @@ -0,0 +1,7 @@+# http://www.codewars.com/kata/5609fd5b44e602b2ff00003a + +# --- iteration 1 --- +def process_2arrays(arr1, arr2) + [(arr1 & arr2), ((arr1 - arr2) + (arr2 - arr1)), (arr1 - arr2), (arr2 - arr1)] + .map(&:size) +end
Add code wars (7) process 2 arrays
diff --git a/app/controllers/user_votes_controller.rb b/app/controllers/user_votes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/user_votes_controller.rb +++ b/app/controllers/user_votes_controller.rb @@ -2,6 +2,11 @@ def index @user = current_user @votes = @user.user_votes.includes(:item).page params[:page] + + unless @user.ward == nil + @ward = @user.ward + @councillor = Councillor.find_by(ward: @ward) + end end def new
Add user's ward and councillor to the myvotes page
diff --git a/app/presenters/finder_links_presenter.rb b/app/presenters/finder_links_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/finder_links_presenter.rb +++ b/app/presenters/finder_links_presenter.rb @@ -6,6 +6,7 @@ organisations: organisations, related: related, email_alert_signup: email_alert_signup, + parent: parent, }, } end @@ -23,4 +24,8 @@ def email_alert_signup [file.fetch("signup_content_id", nil)].compact end + + def parent + [file.fetch("parent", nil)].compact + end end
Allow specialist finders to have parents
diff --git a/spec/integration/display_adapters_spec.rb b/spec/integration/display_adapters_spec.rb index abc1234..def5678 100644 --- a/spec/integration/display_adapters_spec.rb +++ b/spec/integration/display_adapters_spec.rb @@ -19,4 +19,30 @@ ]] ] end + + it "supports custom disply adapters in a provided container" do + adapter_class = Class.new do + def call(field) + field.to_display_variant("custom") + end + end + + container = Class.new(Formalist::DisplayAdapters) do + register "custom", adapter_class.new + end + + form = Class.new(Formalist::Form) do + configure do |config| + config.display_adapters = container + end + + field :name, type: "string", display: "custom" + field :email, type: "string" + end.new + + expect(form.({}).to_ary).to eq [ + [:field, [:name, "string", "custom", nil, [], []]], + [:field, [:email, "string", "default", nil, [], []]], + ] + end end
Add a spec demonstrating a custom display adapters container
diff --git a/each_in_batches.gemspec b/each_in_batches.gemspec index abc1234..def5678 100644 --- a/each_in_batches.gemspec +++ b/each_in_batches.gemspec @@ -18,7 +18,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "activerecord", ">= 3.2", "<= 5.2.2.1" + spec.add_dependency "activerecord", ">= 3.2", "<= 5.2.3" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 12.0" spec.add_development_dependency "rspec", "~> 3.2"
Update all of rails to version 5.2.3
diff --git a/app/workers/discourse_sign_out_worker.rb b/app/workers/discourse_sign_out_worker.rb index abc1234..def5678 100644 --- a/app/workers/discourse_sign_out_worker.rb +++ b/app/workers/discourse_sign_out_worker.rb @@ -4,7 +4,7 @@ def perform(user_id) for_each_tenant(user_id) do |u,t| client(t) do |c| - c.logout(user_id) + c.log_out(user_id) end end rescue DiscourseApi::Error
Rename method of log out action
diff --git a/db/fixtures/development/10_merge_requests.rb b/db/fixtures/development/10_merge_requests.rb index abc1234..def5678 100644 --- a/db/fixtures/development/10_merge_requests.rb +++ b/db/fixtures/development/10_merge_requests.rb @@ -20,4 +20,22 @@ print '.' end end + + project = Project.find_with_namespace('gitlab-org/testme') + + params = { + source_branch: 'feature', + target_branch: 'master', + title: 'Can be automatically merged' + } + MergeRequests::CreateService.new(project, User.admins.first, params).execute + print '.' + + params = { + source_branch: 'feature_conflict', + target_branch: 'feature', + title: 'Cannot be automatically merged' + } + MergeRequests::CreateService.new(project, User.admins.first, params).execute + print '.' end
Add predictable merge requests on dev seed.
diff --git a/lib/capistrano-scrip/ruby/rails.rb b/lib/capistrano-scrip/ruby/rails.rb index abc1234..def5678 100644 --- a/lib/capistrano-scrip/ruby/rails.rb +++ b/lib/capistrano-scrip/ruby/rails.rb @@ -6,11 +6,20 @@ db_seed start end + task :db_setup, :roles => :app do run "cd #{current_path}; bundle exec rake environment RAILS_ENV=#{rails_env} db:setup" end + task :db_seed, :roles => :app do run "cd #{current_path}; bundle exec rake environment RAILS_ENV=#{rails_env} db:seed" end end + + before "deploy:finalize_update" do + if exists? :database_config_path + run "rm -f #{release_path}/config/database.yml && " \ + "ln -s #{database_config_path} #{release_path}/config/database.yml" + end + end end
Create database/config.yml symlink before deploy:finelize_update in ruby/rails recipe
diff --git a/lib/cassandrb/model/persistence.rb b/lib/cassandrb/model/persistence.rb index abc1234..def5678 100644 --- a/lib/cassandrb/model/persistence.rb +++ b/lib/cassandrb/model/persistence.rb @@ -7,7 +7,7 @@ module InstanceMethods def save(*args) - self.key= SimpleUUID::UUID.new.to_s unless self.key.nil? + self.key= SimpleUUID::UUID.new.to_s if self.key.nil? self.client.insert(self.column_family, self.key, self.attributes) true end
Define key if not defined
diff --git a/attributes/intellij_community_edition.rb b/attributes/intellij_community_edition.rb index abc1234..def5678 100644 --- a/attributes/intellij_community_edition.rb +++ b/attributes/intellij_community_edition.rb @@ -1,10 +1,10 @@ case node[:platform] when "centos", "redhat", "debian", "ubuntu" - default['intellij_community_edition']['download_url']="http://download.jetbrains.com/idea/ideaIC-14.0.1.tar.gz" + default['intellij_community_edition']['download_url']="http://download.jetbrains.com/idea/ideaIC-14.1.3.tar.gz" default['intellij_community_edition']['name']="IntelliJ IDEA 14 CE" when "mac_os_x" - default['intellij_community_edition']['download_url']="http://download.jetbrains.com/idea/ideaIC-14.0.1.dmg" + default['intellij_community_edition']['download_url']="http://download.jetbrains.com/idea/ideaIC-14.1.3.dmg" default['intellij_community_edition']['name']="IntelliJ IDEA 14 CE" end
Update default community version to 14.1.3
diff --git a/lib/fluent/plugin/out_sumologic.rb b/lib/fluent/plugin/out_sumologic.rb index abc1234..def5678 100644 --- a/lib/fluent/plugin/out_sumologic.rb +++ b/lib/fluent/plugin/out_sumologic.rb @@ -5,9 +5,9 @@ class Fluent::SumologicOutput< Fluent::BufferedOutput Fluent::Plugin.register_output('sumologic', self) - config_param :host, :string, :default => 'localhost' - config_param :port, :integer, :default => 9200 - config_param :path, :string, :default => '/' + config_param :host, :string, :default => 'collectors.sumologic.com' + config_param :port, :integer, :default => 443 + config_param :path, :string, :default => '/receiver/v1/http/XXX' config_param :format, :string, :default => 'json' def initialize
Change defaults from ancestral elasticsearch settings
diff --git a/lib/puppet/provider/aws_vpc/api.rb b/lib/puppet/provider/aws_vpc/api.rb index abc1234..def5678 100644 --- a/lib/puppet/provider/aws_vpc/api.rb +++ b/lib/puppet/provider/aws_vpc/api.rb @@ -20,7 +20,11 @@ end end.flatten end - + [:cidr, :region, :dhcp_options_id, :instance_tenancy].each do |ro_method| + define_method("#{ro_method}=") do |v| + fail "Cannot manage #{ro_method} is read-only once a vpc is created" + end + end def exists? @property_hash[:ensure] == :present end
Fix trying to set things
diff --git a/lib/rack/access-control-headers.rb b/lib/rack/access-control-headers.rb index abc1234..def5678 100644 --- a/lib/rack/access-control-headers.rb +++ b/lib/rack/access-control-headers.rb @@ -11,7 +11,7 @@ if env["PATH_INFO"].match @path response[1]["Access-Control-Allow-Origin"] = @origin response[1]["Cache-Control"] = "public" - response[1]["Expires"] = 10.years.from_now.httpdate + response[1]["Expires"] = (Time.now + (60*60*24*365*10)).httpdate end response end
Remove ActiveSupport::TimeWithZone depedancy for compatability with more Rack apps
diff --git a/lib/requirejs_optimizer/railtie.rb b/lib/requirejs_optimizer/railtie.rb index abc1234..def5678 100644 --- a/lib/requirejs_optimizer/railtie.rb +++ b/lib/requirejs_optimizer/railtie.rb @@ -11,9 +11,7 @@ config.before_initialize do Rails.application.config.assets.compress = false - end - config.after_initialize do javascripts_root_path = Rails.root.join(*%w(app/assets/javascripts/)) modules_path = javascripts_root_path.join(RequirejsOptimizer.base_folder, '**', '*.{coffee,js}')
Add assets to the precompile list in `before_initialize`