diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/api/webhooks_controller.rb b/app/controllers/api/webhooks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/webhooks_controller.rb +++ b/app/controllers/api/webhooks_controller.rb @@ -21,10 +21,10 @@ private def authenticate - head :unauthorized unless verify_signature + head :unauthorized unless valid_signature? end - def verify_signature + def valid_signature? github_signature = request.headers.fetch('X-Hub-Signature') return false unless github_signature
Change method name veryfy_signature to valid_signature?
diff --git a/lib/tasks/2017_08_01_clean_assign_to.rake b/lib/tasks/2017_08_01_clean_assign_to.rake index abc1234..def5678 100644 --- a/lib/tasks/2017_08_01_clean_assign_to.rake +++ b/lib/tasks/2017_08_01_clean_assign_to.rake @@ -0,0 +1,12 @@+namespace :'2017_08_01_clean_assign_to' do + task clean: :environment do + duplicates = AssignTo.group(:gestionnaire_id, :procedure_id).count.select{ |_gestionnaire_id_procedure_id, count| count > 1 }.keys + + duplicate_ids = duplicates.map { |gestionnaire_id, procedure_id| AssignTo.where(gestionnaire_id: gestionnaire_id, procedure_id: procedure_id).pluck(:id) } + + duplicate_ids.each do |ids| + ids.pop + AssignTo.where(id: ids).destroy_all + end + end +end
Clean assign_to duplicates with a rake task
diff --git a/gusteau.gemspec b/gusteau.gemspec index abc1234..def5678 100644 --- a/gusteau.gemspec +++ b/gusteau.gemspec @@ -19,6 +19,7 @@ gem.add_dependency 'optitron' gem.add_dependency 'inform' + gem.add_dependency 'json' gem.add_dependency 'net-ssh', '~> 2.2.2' gem.add_dependency 'archive-tar-minitar', '~> 0.5.2'
Add missing json gem into gemspec
diff --git a/examples/show_experience_items.rb b/examples/show_experience_items.rb index abc1234..def5678 100644 --- a/examples/show_experience_items.rb +++ b/examples/show_experience_items.rb @@ -8,8 +8,11 @@ puts "Fetching items localized to %s" % destination - client.experiences.get_items(org, :destination => destination).each do |i| - puts i.inspect + client.experiences.get_items(org, :destination => destination, :limit => 10, :offset => 0).each_with_index do |item, i| + puts "%s. %s:" % [i+i, item.number] + item.local.prices.each do |price| + puts " - %s: %s" % [price.key, price.label] + end end end
Update display of localized item
diff --git a/lib/map.rb b/lib/map.rb index abc1234..def5678 100644 --- a/lib/map.rb +++ b/lib/map.rb @@ -2,6 +2,8 @@ def initialize(window, mapfile) @window = window + @tileset = Gosu::Image.load_tiles(window, 'media/32x32diagonal_lines.png', + 32, 32, false) end end
Load diagonal lines as an instance variable
diff --git a/bootstrap-sass.gemspec b/bootstrap-sass.gemspec index abc1234..def5678 100644 --- a/bootstrap-sass.gemspec +++ b/bootstrap-sass.gemspec @@ -7,7 +7,7 @@ s.homepage = "http://github.com/thomas-mcdonald/bootstrap-sass" s.add_development_dependency 'compass' - s.add_development_dependency 'sass-rails', '~> 3.1' + s.add_development_dependency 'sass-rails', '~> 3.2' s.files = Dir["vendor/**/*.{scss,js,png}"] + Dir["lib/**/*"] + Dir["templates/**/*"] + ["README.md", "LICENSE"] end
Update sass-rails dependency version to require > 3.2
diff --git a/lib/rip.rb b/lib/rip.rb index abc1234..def5678 100644 --- a/lib/rip.rb +++ b/lib/rip.rb @@ -11,6 +11,22 @@ require 'pathname' module Rip + def self.logo + <<-'RIP' + _ _ _ + /\ \ /\ \ /\ \ + / \ \ \ \ \ / \ \ + / /\ \ \ /\ \_\ / /\ \ \ + / / /\ \_\ / /\/_/ / / /\ \_\ + / / /_/ / / / / / / / /_/ / / + / / /__\/ / / / / / / /__\/ / + / / /_____/ / / / / / /_____/ + / / /\ \ \ ___/ / /__ / / / +/ / / \ \ \/\__\/_/___\/ / / +\/_/ \_\/\/_________/\/_/ + RIP + end + def self.project_path Pathname(@path || '.').expand_path end
Implement Rip.logo as ASCII art http://www.patorjk.com/software/taag/#p=display&f=Impossible&t=Rip
diff --git a/lib/altria.rb b/lib/altria.rb index abc1234..def5678 100644 --- a/lib/altria.rb +++ b/lib/altria.rb @@ -1,3 +1,5 @@+$LOAD_PATH.unshift File.expand_path("..", __FILE__) + require "altria/command" require "altria/configuration" require "altria/responder"
Fix load path problem caused from rake
diff --git a/Casks/bassjump.rb b/Casks/bassjump.rb index abc1234..def5678 100644 --- a/Casks/bassjump.rb +++ b/Casks/bassjump.rb @@ -0,0 +1,24 @@+class Bassjump < Cask + if MacOS.version == :mavericks + url 'http://ffe82a399885f9f28605-66638985576304cbe11c530b9b932f18.r24.cf2.rackcdn.com/BassJumpInstaller_2.5.1.dmg.zip' + version '2.5.1' + sha256 '14408480cded51f6334753639e973ebbf2fc40f34ff64e1c35d2f32507d88afd' + nested_container 'BassJumpInstaller_2.5.1.dmg' + install 'BassJumpInstaller.pkg' + else + url 'http://ffe82a399885f9f28605-66638985576304cbe11c530b9b932f18.r24.cf2.rackcdn.com/BassJumpSoundSystem-2.0.3-249-ML.mpkg.zip' + version '2.0.3' + sha256 '8e4dffa6bb3b532b994f379d19d70903f59fc019916f10cba9d01b8075d69a7f' + install 'BassJump Sound System-2.0.3-249-ML.mpkg' + end + homepage 'http://www.twelvesouth.com/product/bassjump-2-for-macbook' + caveats do + reboot + end + uninstall :pkgutil => [ + 'com.twelvesouth.bassjump.installer.halplugin', + 'com.twelvesouth.bassjump.installer.overridekext', + 'com.twelvesouth.bassjump.installer.prefpane', + ], + :kext => 'com.twelvesouth.driver.BassJumpOverrideDriver' +end
Create cask for BassJump.prefpane v2.5.1 Included is both versions for Mavericks and Mtn Lion/Lion. One thing that I can't figure out is the uninstall part as its a separate download from the app makers website.
diff --git a/resources/habitat_build.rb b/resources/habitat_build.rb index abc1234..def5678 100644 --- a/resources/habitat_build.rb +++ b/resources/habitat_build.rb @@ -13,7 +13,7 @@ property :artifact, String property :home_dir, String property :auth_token, String -property :live_stream, Boolean, default: true +property :live_stream, [TrueClass, FalseClass], default: true action :build do execute 'build-plan' do
Update Boolean to TrueClass FalseClass NilClass Signed-off-by: Elliott Davis <ddda907ff26ca0abaafd09579d559b51098ffe8e@chef.io>
diff --git a/BinaryGap.rb b/BinaryGap.rb index abc1234..def5678 100644 --- a/BinaryGap.rb +++ b/BinaryGap.rb @@ -0,0 +1,22 @@+# you can write to stdout for debugging purposes, e.g. +# puts "this is a debug message" + +def solution(n) + # write your code in Ruby 2.2 + bin = n.to_s(2) + binary_gap = 0 + one = bin.index('1') + + for i in 1..(bin.size-1) + current_string = bin[one..i].to_s + #puts "string #{current_string}, count #{current_string.count('0')} " + if bin[i] == '1' + one = i + count_zeros = current_string.count('0') + if binary_gap < count_zeros + binary_gap = count_zeros + end + end + end + return binary_gap +end
Create solution for binary gap
diff --git a/lib/engine.rb b/lib/engine.rb index abc1234..def5678 100644 --- a/lib/engine.rb +++ b/lib/engine.rb @@ -12,6 +12,7 @@ end configure do + disable :protection set :root, File.join(File.dirname(__FILE__), "..") end
Disable rack protection for now. This is bad but might mean the demo works for now...
diff --git a/lib/delocalize/parameter_delocalizing.rb b/lib/delocalize/parameter_delocalizing.rb index abc1234..def5678 100644 --- a/lib/delocalize/parameter_delocalizing.rb +++ b/lib/delocalize/parameter_delocalizing.rb @@ -22,7 +22,7 @@ end def delocalize_parser_for(options, key_stack) - parser_type = key_stack.reduce(options) { |h, key| h.stringify_keys[key.to_s] } + parser_type = key_stack.reduce(options) { |h, key| h.is_a?(Hash) ? h.stringify_keys[key.to_s] : break } return unless parser_type parser_name = "delocalize_#{parser_type}_parser"
Break if key not in options hash. Fixes clemens/delocalize#71
diff --git a/Casks/google-japanese-ime-dev.rb b/Casks/google-japanese-ime-dev.rb index abc1234..def5678 100644 --- a/Casks/google-japanese-ime-dev.rb +++ b/Casks/google-japanese-ime-dev.rb @@ -0,0 +1,14 @@+class GoogleJapaneseImeDev < Cask + version 'dev' + sha256 'd3f786d3462e0294f29bc1f8998163489f812a1ae650661e9a26a92b731c2ef8' + + url 'https://dl.google.com/japanese-ime/dev/GoogleJapaneseInput.dmg' + homepage 'https://www.google.co.jp/ime/' + + install 'GoogleJapaneseInput.pkg' + uninstall :pkgutil => 'com.google.pkg.GoogleJapaneseInput', + :launchctl => [ + 'com.google.inputmethod.Japanese.Converter', + 'com.google.inputmethod.Japanese.Renderer' + ] +end
Add Google Japanese IME Developer Build
diff --git a/capi/recipes/cf_cli.rb b/capi/recipes/cf_cli.rb index abc1234..def5678 100644 --- a/capi/recipes/cf_cli.rb +++ b/capi/recipes/cf_cli.rb @@ -16,6 +16,11 @@ mode "0644" end +execute 'install cf cli Diego-Enabler plugin' do + command "cf uninstall-plugin Diego-Enabler; cf install-plugin Diego-Enabler -r CF-Community -f" + user node['sprout']['user'] +end + execute 'install cf cli CLI-Recorder plugin' do command "cf uninstall-plugin CLI-Recorder; cf install-plugin CLI-Recorder -r CF-Community -f" user node['sprout']['user']
Install diego enabler cf plugin Signed-off-by: Dan Wendorf <aacfaec681ee5d2ca2a22f1deac31c830d964d35@pivotal.io>
diff --git a/sorcery.gemspec b/sorcery.gemspec index abc1234..def5678 100644 --- a/sorcery.gemspec +++ b/sorcery.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = "sorcery" s.version = "0.8.5" - s.authors = ["Noam Ben Ari", "Kir Shatrov"] + s.authors = ["Noam Ben Ari", "Kir Shatrov", "Grzegorz Witek"] s.email = "nbenari@gmail.com" s.description = "Provides common authentication needs such as signing in/out, activating by email and resetting password." s.summary = "Magical authentication for Rails 3 applications"
Add @arnvald as gem author
diff --git a/cogy.gemspec b/cogy.gemspec index abc1234..def5678 100644 --- a/cogy.gemspec +++ b/cogy.gemspec @@ -1,9 +1,7 @@ $:.push File.expand_path("../lib", __FILE__) -# Maintain your gem's version: require "cogy/version" -# Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "cogy" s.version = Cogy::VERSION @@ -15,7 +13,7 @@ "a breeze" s.license = "MIT" - s.files = Dir["{app,config,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] + s.files = Dir["{app,config,lib}/**/*", "LICENSE", "Rakefile", "README.md"] s.test_files = Dir["test/**/*"] s.add_dependency "rails", "~> 4.2", ">= 4.2.7.1"
Update outdated file references in gemspec
diff --git a/lib/foreman_tasks/dynflow_persistence.rb b/lib/foreman_tasks/dynflow_persistence.rb index abc1234..def5678 100644 --- a/lib/foreman_tasks/dynflow_persistence.rb +++ b/lib/foreman_tasks/dynflow_persistence.rb @@ -11,9 +11,9 @@ begin on_execution_plan_save(execution_plan_id, value) rescue => e - Logging.logger['dynflow'].error('Error on on_execution_plan_save event') - Logging.logger['dynflow'].error(e.message) - Logging.logger['dynflow'].error(e.backtrace.join("\n")) + ForemanTasks.world.logger.error('Error on on_execution_plan_save event') + ForemanTasks.world.logger.error(e.message) + ForemanTasks.world.logger.error(e.backtrace.join("\n")) end end end
Use the Dynflow logger for the custom persistnce issues
diff --git a/BVLinearGradient.podspec b/BVLinearGradient.podspec index abc1234..def5678 100644 --- a/BVLinearGradient.podspec +++ b/BVLinearGradient.podspec @@ -11,7 +11,7 @@ s.author = { "Brent Vatne" => "brentvatne@gmail.com" } s.ios.deployment_target = '7.0' s.tvos.deployment_target = '9.0' - s.source = { :git => "https://github.com/brentvatne/react-native-linear-gradient.git", :tag => "#{s.version}" } + s.source = { :git => "https://github.com/brentvatne/react-native-linear-gradient.git", :tag => "v#{s.version}" } s.source_files = 'BVLinearGradient/*.{h,m}' s.preserve_paths = "**/*.js" s.frameworks = 'UIKit', 'QuartzCore', 'Foundation'
Update tag in podspec file due to new tag (v2.x.x) namings
diff --git a/config/initializers/prepend_draft_to_logs_in_development.rb b/config/initializers/prepend_draft_to_logs_in_development.rb index abc1234..def5678 100644 --- a/config/initializers/prepend_draft_to_logs_in_development.rb +++ b/config/initializers/prepend_draft_to_logs_in_development.rb @@ -1,3 +1,3 @@-if Rails.env.development? && ENV['DRAFT'] == 'true' +if Rails.env.development? && ENV['DRAFT'].present? ContentStore::Application.config.log_tags = ["DRAFT"] end
Check for presence of ENV var DRAFT To simplify puppet code, we're checking for presence of this ENV var instead of a specific value.
diff --git a/core/spec/lib/refinery/generators/cms/cms_generator_spec.rb b/core/spec/lib/refinery/generators/cms/cms_generator_spec.rb index abc1234..def5678 100644 --- a/core/spec/lib/refinery/generators/cms/cms_generator_spec.rb +++ b/core/spec/lib/refinery/generators/cms/cms_generator_spec.rb @@ -4,7 +4,7 @@ module Refinery describe CmsGenerator do include GeneratorSpec::TestCase - destination File.expand_path("../../../../tmp", __FILE__) + destination File.expand_path("../../../../../../tmp", __FILE__) before(:each) do prepare_destination
Fix tmp output path for CmsGenerator
diff --git a/lib/noir/command/format/pdf_url.rb b/lib/noir/command/format/pdf_url.rb index abc1234..def5678 100644 --- a/lib/noir/command/format/pdf_url.rb +++ b/lib/noir/command/format/pdf_url.rb @@ -7,11 +7,13 @@ raise 'URL Missing. Please input a link in argument.'if args.empty? args.each do |url| - pdf_url = URI.decode_www_form(url).find{|a| a.first == 'url'} || ['PDF URL missing'] - puts pdf_url.last + if URI.regexp.match(url) + puts URI.decode_www_form(url).find{|a| a.first == 'url'} + else + puts 'PDF URL missing' + end end end - end
Support under 2.0.0 in Fomat::PDFURL
diff --git a/lib/tomcat-manager/api/version7.rb b/lib/tomcat-manager/api/version7.rb index abc1234..def5678 100644 --- a/lib/tomcat-manager/api/version7.rb +++ b/lib/tomcat-manager/api/version7.rb @@ -9,6 +9,14 @@ def connect_path "/manager/text/list" end + + ########################### + # Processing Methods + ########################### + + def connect_response_valid?(response_code) + response_code == "200" + end end end end
Add connect_response_valid? Method to Version7 Update Version7 to include the connect_response_valid? method which returns true only if the response corresponds to an HTTP 200 code.
diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index abc1234..def5678 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -35,6 +35,6 @@ end def upload_params - params.require(:upload).permit(:file, :file_file_name, :user_id, :user_type) + params.require(:upload).permit(:category, :file, :file_file_name, :user_id, :user_type,) end end
Allow upload category to be included in form.
diff --git a/vimrunner.gemspec b/vimrunner.gemspec index abc1234..def5678 100644 --- a/vimrunner.gemspec +++ b/vimrunner.gemspec @@ -17,7 +17,7 @@ s.add_development_dependency 'rake' s.add_development_dependency 'rdoc' s.add_development_dependency 'simplecov' - s.add_development_dependency 'rspec', '>= 2.13.0' + s.add_development_dependency 'rspec', '~> 2.13.0' s.required_rubygems_version = '>= 1.3.6' s.rubyforge_project = 'vimrunner'
Fix RSpec dev dependency in gemspec Tests use syntax that is removed or deprecated in RSpec 3.
diff --git a/app/models/tasks/publish_feed_task.rb b/app/models/tasks/publish_feed_task.rb index abc1234..def5678 100644 --- a/app/models/tasks/publish_feed_task.rb +++ b/app/models/tasks/publish_feed_task.rb @@ -32,7 +32,7 @@ ).to_s end - def task_status_changed(fixer_task) + def task_status_changed(fixer_task, new_status) # purge the cdn cache HighwindsAPI::Content.purge_url(podcast.published_url, false)
Add additional arg for new_status to callback method signature
diff --git a/app/serializers/service_serializer.rb b/app/serializers/service_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/service_serializer.rb +++ b/app/serializers/service_serializer.rb @@ -1,5 +1,5 @@ class ServiceSerializer < ActiveModel::Serializer - attributes :name, :command, :cpu, :memory, :load_balancer, :status + attributes :name, :command, :cpu, :memory, :load_balancer, :status, :slack_url belongs_to :heritage
Add slack_url to heritage serializer
diff --git a/lib/vertebrae/generators/install/install_generator.rb b/lib/vertebrae/generators/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/vertebrae/generators/install/install_generator.rb +++ b/lib/vertebrae/generators/install/install_generator.rb @@ -26,7 +26,7 @@ end def create_app_folder_structure - directories = %w(models templates config) + directories = %w(models templates) directories << 'views' if options.views? directories << 'collections' if options.collections? directories.each do |directory|
Remove /config creation, will happen when adding routes anyways.
diff --git a/cxml.gemspec b/cxml.gemspec index abc1234..def5678 100644 --- a/cxml.gemspec +++ b/cxml.gemspec @@ -11,6 +11,7 @@ s.add_development_dependency "rake" s.add_development_dependency "rspec", "~> 3.4" + s.add_development_dependency "pry" s.add_dependency "nokogiri", "~> 1.6" s.add_dependency "xml-simple", "~> 1.1.5"
Include pry as dev dependency
diff --git a/spec/addacardvalue_spec.rb b/spec/addacardvalue_spec.rb index abc1234..def5678 100644 --- a/spec/addacardvalue_spec.rb +++ b/spec/addacardvalue_spec.rb @@ -0,0 +1,17 @@+require_relative "../lib/master/card" +require_relative "../lib/add_a_card/add_a_card_value" + +describe AddACardValue do + let(:eval_class) { AddACardValue.new } + let(:hand) { [] } + + it "evaluates [Ace + 8] = 18" do + hand << Card.new("Spades", "Ace") + hand << Card.new("Hearts", "Eight") + + eval_class.cards(hand) + + eval_class.value.should == 18 + end + +end
Add spec file for add_a_card_value
diff --git a/spec/api/v1/search_spec.rb b/spec/api/v1/search_spec.rb index abc1234..def5678 100644 --- a/spec/api/v1/search_spec.rb +++ b/spec/api/v1/search_spec.rb @@ -18,29 +18,29 @@ it { expect_status(:ok) } end - context 'fts' do - before(:example) do - create(:envelope) - create(:envelope, :from_credential_registry) - sleep 1 - - get '/api/search?fts=constitutio' - end - - it { puts response.body } # expect_status(:ok) } - it { expect(json_resp.size).to be > 0 } - end + # context 'fts' do + # before(:example) do + # create(:envelope) + # create(:envelope, :from_credential_registry) + # sleep 1 + # + # get '/api/search?fts=constitutio' + # end + # + # it { expect_status(:ok) } + # it { expect(json_resp.size).to be > 0 } + # end end - context 'GET /api/{community}/search' do - before(:example) { get '/api/learning-registry/search' } - - it { puts response.body } # expect_status(:ok) } - end - - context 'GET /api/{community}/{type}/search' do - before(:example) { get '/api/credential-registry/organizations/search' } - - it { puts response.body } # expect_status(:ok) } - end + # context 'GET /api/{community}/search' do + # before(:example) { get '/api/learning-registry/search' } + # + # it { expect_status(:ok) } + # end + # + # context 'GET /api/{community}/{type}/search' do + # before(:example) { get '/api/credential-registry/organizations/search' } + # + # it { expect_status(:ok) } + # end end
Comment search filter tests because of an issue with ES version on codeship
diff --git a/spec/hangman_start_spec.rb b/spec/hangman_start_spec.rb index abc1234..def5678 100644 --- a/spec/hangman_start_spec.rb +++ b/spec/hangman_start_spec.rb @@ -2,10 +2,15 @@ RSpec.describe Hangman, "#score" do context "with a new game" do - it "has a score of 7" do -# FIXME: Remove the magic number somehow + it "has a default score of 7" do + default_score = 7 game = Hangman.new - expect(game.score).to eq 7 + expect(game.score).to eq default_score + end + it "can have a score of 6" do + score = 6 + game = Hangman.new(score) + expect(game.score).to eq score end end end
Add tests to test default and non default starting scores
diff --git a/specs/model_object_spec.rb b/specs/model_object_spec.rb index abc1234..def5678 100644 --- a/specs/model_object_spec.rb +++ b/specs/model_object_spec.rb @@ -0,0 +1,22 @@+require_relative '../models/model_object' + +describe Bra::Models::ModelObject do + let(:object) { Bra::Models::ModelObject.new } + + describe '#notify_channel' do + context 'there is no update channel' do + it 'fails' do + expect { object.notify_channel(:repr) }.to raise_error + end + end + context 'there is an update channel' do + it 'calls channel#push with a tuple of itself and the given item' do + channel = double('channel') + object.register_update_channel(channel) + channel.should_receive(:push).with([object, :repr]) + + object.notify_channel(:repr) + end + end + end +end
Add spec for update channel notifications.
diff --git a/web/lib/models.rb b/web/lib/models.rb index abc1234..def5678 100644 --- a/web/lib/models.rb +++ b/web/lib/models.rb @@ -1,9 +1,8 @@-DB = Sequel.connect(ENV['DATABASE_URL'] || 'sqlite://db/database.sqlite3', pool_timeout: 25) +DB = Sequel.connect(ENV['DATABASE_URL'], pool_timeout: 25) class Package < Sequel::Model one_to_many :builds end class Build < Sequel::Model - many_to_one :package end
Use DATABASE_URL; don't map builds to packages
diff --git a/db/migrate/20120228194653_approve_all_topics_and_posts.rb b/db/migrate/20120228194653_approve_all_topics_and_posts.rb index abc1234..def5678 100644 --- a/db/migrate/20120228194653_approve_all_topics_and_posts.rb +++ b/db/migrate/20120228194653_approve_all_topics_and_posts.rb @@ -0,0 +1,9 @@+class ApproveAllTopicsAndPosts < ActiveRecord::Migration + def up + Forem::Topic.find_each { |t| t.approve! } + Forem::Post.find_each { |t| t.approve! } + end + + def down + end +end
Add migration to approve all topics + posts
diff --git a/db/migrate/20190212145946_change_agreement_event_id_to_bigint.rb b/db/migrate/20190212145946_change_agreement_event_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20190212145946_change_agreement_event_id_to_bigint.rb +++ b/db/migrate/20190212145946_change_agreement_event_id_to_bigint.rb @@ -0,0 +1,15 @@+class ChangeAgreementEventIdToBigint < ActiveRecord::Migration[6.0] + def up + change_column :agreement_events, :id, :bigint + + change_column :agreement_event_datasets, :agreement_event_id, :bigint + change_column :agreement_event_tags, :agreement_event_id, :bigint + end + + def down + change_column :agreement_events, :id, :integer + + change_column :agreement_event_datasets, :agreement_event_id, :integer + change_column :agreement_event_tags, :agreement_event_id, :integer + end +end
Update agreement_event_id primary and foreign keys to bigint
diff --git a/databasedotcom.gemspec b/databasedotcom.gemspec index abc1234..def5678 100644 --- a/databasedotcom.gemspec +++ b/databasedotcom.gemspec @@ -24,10 +24,4 @@ s.add_development_dependency 'rspec', '~> 2.6' s.add_development_dependency 'webmock' s.add_development_dependency 'rake', '>= 0.8.6' - - if RUBY_VERSION >= "1.9" - s.add_development_dependency 'debugger' - else - s.add_development_dependency 'ruby-debug' - end end
Remove debugger gems again - probably not necessary permanently.
diff --git a/lib/active_admin/views/tabbed_navigation.rb b/lib/active_admin/views/tabbed_navigation.rb index abc1234..def5678 100644 --- a/lib/active_admin/views/tabbed_navigation.rb +++ b/lib/active_admin/views/tabbed_navigation.rb @@ -18,8 +18,11 @@ # def build(menu, options = {}) @menu = menu - super(default_options.merge(options)) - build_menu + super(options.reverse_merge(id: 'tabs')) + + menu_items.each do |item| + menu_item(item) + end end # The top-level menu items that should be displayed. @@ -30,36 +33,35 @@ def tag_name 'ul' end + end - private + class MenuItem < Component + builder_method :menu_item - def build_menu - menu_items.each do |item| - build_menu_item(item) + def build(item, options = {}) + super(options.merge(id: item.id)) + + add_class "current" if item.current? assigns[:current_tab] + + if url = item.url(self) + a item.label(self), item.html_options.merge(href: url) + else + span item.label(self), item.html_options end - end - def build_menu_item(item) - li id: item.id do |li| - li.add_class "current" if item.current? assigns[:current_tab] + if children = item.items(self).presence + add_class "has_nested" - if url = item.url(self) - text_node link_to item.label(self), url, item.html_options - else - span item.label(self), item.html_options - end - - if children = item.items(self).presence - li.add_class "has_nested" - ul do - children.each{ |child| build_menu_item child } + ul do + children.each do |child| + menu_item(child) end end end end - def default_options - { id: "tabs" } + def tag_name + 'li' end end end
Split MenuItem Arbre component from TabbedNavigation.
diff --git a/lib/easymon/checks/active_record_mysql_writeable_check.rb b/lib/easymon/checks/active_record_mysql_writeable_check.rb index abc1234..def5678 100644 --- a/lib/easymon/checks/active_record_mysql_writeable_check.rb +++ b/lib/easymon/checks/active_record_mysql_writeable_check.rb @@ -21,7 +21,7 @@ private def database_writeable? - klass.connection.execute(@query).entries.flatten.first == 0 + klass.connection.execute(@query).to_enum.first.first.to_i == 0 rescue false end
Use a syntax that works with both mysql and mysql2 gems
diff --git a/lib/simple_token_authorization/authenticate_with_token.rb b/lib/simple_token_authorization/authenticate_with_token.rb index abc1234..def5678 100644 --- a/lib/simple_token_authorization/authenticate_with_token.rb +++ b/lib/simple_token_authorization/authenticate_with_token.rb @@ -21,7 +21,7 @@ private def authenticate_from_token!(scope_name) - scope_class = scope_name.capitalize.constantize + scope_class = scope_name.camelize.constantize authenticate_or_request_with_http_token do |token, options| return false if token.blank? scope, token = *find_scope(scope_class, token)
Fix constantize scope by use camelize
diff --git a/lib/building.rb b/lib/building.rb index abc1234..def5678 100644 --- a/lib/building.rb +++ b/lib/building.rb @@ -1,4 +1,4 @@ class Building < ActiveRecord::Base translates :name - has_one :address, :as => :addressable + has_one :address, :as => :addressable, dependent: :destroy end
Add destroy when change address
diff --git a/lib/commands.rb b/lib/commands.rb index abc1234..def5678 100644 --- a/lib/commands.rb +++ b/lib/commands.rb @@ -1,4 +1,6 @@ class Commands + + DEFAULT_ENVIRONMENT = {'SHIPIT' => '1'}.freeze def self.git_version @git_version ||= begin @@ -11,7 +13,7 @@ delegate :git_version, to: :class def env - @env ||= {'SHIPIT' => '1'}.merge(Settings['env'] || {}) + @env ||= DEFAULT_ENVIRONMENT.merge(Settings['env'] || {}) end def git(*args)
Use a constant for the default environment variables
diff --git a/lib/daun/cli.rb b/lib/daun/cli.rb index abc1234..def5678 100644 --- a/lib/daun/cli.rb +++ b/lib/daun/cli.rb @@ -1,6 +1,7 @@ require 'thor' require 'daun' require 'rugged' +require 'uri' require 'git_clone_url' module Daun @@ -19,19 +20,30 @@ def checkout rugged_daun = Daun::RuggedDaun.new(options[:directory]) + repository = rugged_daun.repository + origin = repository.remotes['origin'] - origin = repository.remotes['origin'] - origin_uri = GitCloneUrl.parse(origin.url) + begin + origin_uri = GitCloneUrl.parse(origin.url) + rescue URI::InvalidComponentError + origin_uri = URI.parse(origin.url) + end - credentials = nil - if [nil, 'ssh'].include? origin_uri.scheme - credentials = Rugged::Credentials::SshKey.new( - :username => origin_uri.user, - :privatekey => options[:ssh_private_key], - :publickey => options[:ssh_public_key], - ) - end + is_ssh_scheme = case origin_uri.scheme + when nil, 'ssh' then true + else false + end + + credentials = case (is_ssh_scheme and !origin_uri.user.nil?) + when true then + Rugged::Credentials::SshKey.new( + :username => origin_uri.user, + :privatekey => options[:ssh_private_key], + :publickey => options[:ssh_public_key], + ) + else nil + end rugged_daun.checkout credentials end
Fix uri parsing for local paths
diff --git a/core/spec/support/example_groups/partial_double_verification_example_group.rb b/core/spec/support/example_groups/partial_double_verification_example_group.rb index abc1234..def5678 100644 --- a/core/spec/support/example_groups/partial_double_verification_example_group.rb +++ b/core/spec/support/example_groups/partial_double_verification_example_group.rb @@ -0,0 +1,16 @@+# frozen_string_literal: true + +module PartialDoubleVerificationExampleGroup + extend ActiveSupport::Concern + + included do + around do |example| + without_partial_double_verification { example.run } + end + end +end + +RSpec.configure do |config| + config.include PartialDoubleVerificationExampleGroup, + partial_double_verification: false +end
Add RSpec tag to disble partial double verification Adds `partial_double_verification` RSpec meta-tag, that, when set to false, disables the partial double verification for the example. Useful when testing unimplemented mocks like user-defined hooks.
diff --git a/lib/proxy.rb b/lib/proxy.rb index abc1234..def5678 100644 --- a/lib/proxy.rb +++ b/lib/proxy.rb @@ -9,9 +9,9 @@ require "#{ROOT}/proxy/cache" require "#{ROOT}/proxy/nginx_config" + Config = Struct.new(:env) + class << self - Config = Struct.new(:env) - def config @config ||= Config.new end
Define Config outside of metaclass
diff --git a/lib/gems/pending/openstack/openstack_handle/nfv_delegate.rb b/lib/gems/pending/openstack/openstack_handle/nfv_delegate.rb index abc1234..def5678 100644 --- a/lib/gems/pending/openstack/openstack_handle/nfv_delegate.rb +++ b/lib/gems/pending/openstack/openstack_handle/nfv_delegate.rb @@ -3,7 +3,7 @@ include OpenstackHandle::HandledList include Vmdb::Logging - SERVICE_NAME = "NFV" + SERVICE_NAME = "NFV".freeze attr_reader :name
Fix rubocop issues for NFV support Fix rubocop issues for NFV support
diff --git a/lib/generators/govuk_component/govuk_component_generator.rb b/lib/generators/govuk_component/govuk_component_generator.rb index abc1234..def5678 100644 --- a/lib/generators/govuk_component/govuk_component_generator.rb +++ b/lib/generators/govuk_component/govuk_component_generator.rb @@ -22,7 +22,7 @@ "default" => {} } }) - file.write(JSON.pretty_generate(docs)) + file.write(docs.to_yaml) end end end
Make component generator output YAML After fixing this generator to read in YAML not JSON, I forgot to fix it to output YAML not JSON. This commit makes the generator write YAML. (whoops)
diff --git a/app/controllers/api/status_controller.rb b/app/controllers/api/status_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/status_controller.rb +++ b/app/controllers/api/status_controller.rb @@ -4,11 +4,17 @@ def check if params[:projects].any? @projects = params[:projects].group_by{|project| project[:platform] }.map do |platform, projects| - Project.lookup_multiple(platform, projects.map{|project| project[:name] }).records.includes(:github_repository, :versions) + Project.lookup_multiple(find_platform_by_name(platform), projects.map{|project| project[:name] }).records.includes(:github_repository, :versions) end.flatten.compact else @projects = [] end render json: project_json_response(@projects) end + + private + + def find_platform_by_name(name) + PackageManager::Base.platforms.find{|p| p.to_s.demodulize.downcase == name.downcase }.try(:to_s).try(:demodulize) + end end
Format platform names correctly before searching
diff --git a/app/controllers/concerns/current_cart.rb b/app/controllers/concerns/current_cart.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/current_cart.rb +++ b/app/controllers/concerns/current_cart.rb @@ -0,0 +1,12 @@+module CurrentCart + extend ActiveSupport::Concern + + private + + def set_cart + @cart = Cart.find(session[:cart_id]) + rescue ActiveRecord::RecordNotFound + @cart = Cart.create + session[:cart_id] = @cart.id + end +end
Create module CurrentCart with method set_cart
diff --git a/app/helpers/admin/organisation_helper.rb b/app/helpers/admin/organisation_helper.rb index abc1234..def5678 100644 --- a/app/helpers/admin/organisation_helper.rb +++ b/app/helpers/admin/organisation_helper.rb @@ -1,7 +1,7 @@ module Admin::OrganisationHelper def organisation_role_ordering_fields(outer_form, organisation_roles) outer_form.fields_for :organisation_roles, organisation_roles do |organisation_role_form| - label_text = "#{organisation_role_form.object.role.name}, #{organisation_role_form.object.role.current_person_name}" + label_text = "#{organisation_role_form.object.role.name}<br/><strong>#{organisation_role_form.object.role.current_person_name}</strong>".html_safe content_tag(:div, organisation_role_form.text_field(:ordering, label_text: label_text, class: "ordering"), class: "well"
Make the role/person clearer when sorting.
diff --git a/cookbooks/java/metadata.rb b/cookbooks/java/metadata.rb index abc1234..def5678 100644 --- a/cookbooks/java/metadata.rb +++ b/cookbooks/java/metadata.rb @@ -31,4 +31,4 @@ supports os end -depends "windows" +#depends "windows"
Add a ton of recipes
diff --git a/lib/omniauth/strategies/appnet.rb b/lib/omniauth/strategies/appnet.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/appnet.rb +++ b/lib/omniauth/strategies/appnet.rb @@ -19,7 +19,6 @@ :nickname => raw_info['username'], :name => raw_info['name'], :image => raw_info['avatar_image']['url'], - :description => raw_info['description']['text'], :type => raw_info['type'], :counts => raw_info['counts'] }
Remove description text as it was causing errors
diff --git a/rb/lib/selenium/webdriver/firefox/bridge.rb b/rb/lib/selenium/webdriver/firefox/bridge.rb index abc1234..def5678 100644 --- a/rb/lib/selenium/webdriver/firefox/bridge.rb +++ b/rb/lib/selenium/webdriver/firefox/bridge.rb @@ -6,11 +6,7 @@ class Bridge < Remote::Bridge def initialize(opts = {}) - @launcher = Launcher.new( - Binary.new, - opts.delete(:port) || DEFAULT_PORT, - opts.delete(:profile) - ) + @launcher = create_launcher(opts) http_client = opts.delete(:http_client) @@ -45,6 +41,16 @@ nil end + private + + def create_launcher(opts) + Launcher.new( + Binary.new, + opts.delete(:port) || DEFAULT_PORT, + opts.delete(:profile) + ) + end + end # Bridge end # Firefox end # WebDriver
JariBakken: Add ability to override Firefox::Bridge's @launcher git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@11117 07704840-8298-11de-bf8c-fd130f914ac9
diff --git a/db/seeds/refinery_settings.rb b/db/seeds/refinery_settings.rb index abc1234..def5678 100644 --- a/db/seeds/refinery_settings.rb +++ b/db/seeds/refinery_settings.rb @@ -20,7 +20,8 @@ :nl => 'Nederlands', :'pt-BR' => 'Português', :da => 'Dansk', - :nb => 'Norsk Bokmål' + :nb => 'Norsk Bokmål', + :sl => 'Slovenian' } } ].each do |setting|
Add Slovenian language to refinery_i18n_locale
diff --git a/test/acceptance/destroy_test.rb b/test/acceptance/destroy_test.rb index abc1234..def5678 100644 --- a/test/acceptance/destroy_test.rb +++ b/test/acceptance/destroy_test.rb @@ -30,4 +30,8 @@ result = assert_execute("vagrant", "status") result.stdout.should match_output(:status, "default", "not created") end + + # TODO: + # it is able to destroy a halted virtual machine + # it is able to destroy a suspended virtual machine end
Add TODOs to the destroy test
diff --git a/spec/controllers/tags_controller_spec.rb b/spec/controllers/tags_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/tags_controller_spec.rb +++ b/spec/controllers/tags_controller_spec.rb @@ -25,7 +25,7 @@ end it "renders show template" do - get :show, {id: 2} + get :show, tag.id expect(response).to render_template("show") end
Add tag creation in show tests
diff --git a/spec/factories/port_mapping_templates.rb b/spec/factories/port_mapping_templates.rb index abc1234..def5678 100644 --- a/spec/factories/port_mapping_templates.rb +++ b/spec/factories/port_mapping_templates.rb @@ -1,7 +1,7 @@ FactoryGirl.define do - factory :port_mapping_template, class: 'Atmosphere::PortMappingTemplate' do |f| + factory :port_mapping_template, class: 'Atmosphere::PortMappingTemplate' do service_name { SecureRandom.hex(4) } - target_port { Random.rand(9999) } + target_port { SecureRandom.random_number(9999) } appliance_type trait :devel do @@ -9,6 +9,6 @@ dev_mode_property_set end - factory :dev_port_mapping_template, traits: [:devel] + factory :dev_port_mapping_template, traits: [:devel] end -end+end
Secure random number for PMT factory
diff --git a/tasks/test.rake b/tasks/test.rake index abc1234..def5678 100644 --- a/tasks/test.rake +++ b/tasks/test.rake @@ -11,6 +11,17 @@ desc "Run the specs" task :spec do system("rspec") +end + +namespace :spec do + + %i(unit request).each do |type| + desc "Run #{type} specs" + task type do + system("rspec spec/#{type}") + end + end + end desc "Run the cucumber scenarios"
Add unit and request tasks to regular specs
diff --git a/test/integration/serial_test.rb b/test/integration/serial_test.rb index abc1234..def5678 100644 --- a/test/integration/serial_test.rb +++ b/test/integration/serial_test.rb @@ -4,6 +4,7 @@ setup do @site = create(:site) @serials = create_list(:serial, 3, :with_posts, :with_unpublished_posts, site: @site) + create(:serial, :with_unpublished_posts, title: "Unpublished serial", site: @site) switch_domain(@site.fqdn) end
test: Create serial which has unpublished posts only
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -8,7 +8,7 @@ text: params[:comment][:text], user_id: params[:comment][:user_id], hidden: params[:comment][:hidden], - visible: !(params[:comment][:hidden].to_bool) + visible: !!!(params[:comment][:hidden]) ) assignment = submission.assignment
Handle nil on hidden comment params
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -1,20 +1,39 @@ class MessagesController < ApplicationController - #before_action :require_login - #before_action :validate_request_status, only: [:create] + before_action :set_request, :require_login, :verify_association + before_action :validate_request_status, only: [:create] def index - #@messages = @request.messages + @messages = @request.messages end def create + @message = Message.new(message_params) + + if @message.save + trigger_message_event(@message) + else + flash[:now] = @message.errors.full_messages.join(', ') + render request_messages_path(@request) + end end private + def set_request + @request = Request.find_by(id: params[:request_id]).messages.include(:messages) + end + def require_login + unless current_user + flash[:error] = "You must be loged in to before this action". + redirect_to login_path + end + end + + def verify_association unless current_user == @request.requester || current_user == @request.responder - flash[:error] = "This action requires you to be logged in" - redirect_to login_path + flash[:error] = "You are not a party to this neighborly request." + redirect_to root_path end end @@ -24,7 +43,13 @@ end end - def find_request - @request = Request.find_by(id: params[:request_id]).messages.include(:messages) - end + def message_params + known_attrs = {author_id: current_user.id, request_id: @request.id} + + params.require(:message).permit(:content).merge(known_attrs) + end + + def trigger_message_event(message) + Pusher["private-#{@request.id}"].trigger('new_message', {content: message.content}) + end end
Add necessary_before actions to the Messages controller. All actions will have available to them the request to which they are associated with. Separated the validation that a user is logged in from a user being associated with the current request. Added a messages_params method to avoid mass-assignment vulnerability.
diff --git a/spec/rakuten_web_service/response_spec.rb b/spec/rakuten_web_service/response_spec.rb index abc1234..def5678 100644 --- a/spec/rakuten_web_service/response_spec.rb +++ b/spec/rakuten_web_service/response_spec.rb @@ -31,5 +31,17 @@ it { is_expected.to have_previous_page } it { is_expected.to_not be_first_page } end + context "When current page is in pages" do + let(:json) do + { + 'page' => 2, 'pageCount' => 3 + } + end + + it { is_expected.to have_next_page } + it { is_expected.to_not be_last_page } + it { is_expected.to have_previous_page } + it { is_expected.to_not be_last_page } + end end end
Add the case where the current page is in middle of pages
diff --git a/spec/test_helpers/shared_examples_spec.rb b/spec/test_helpers/shared_examples_spec.rb index abc1234..def5678 100644 --- a/spec/test_helpers/shared_examples_spec.rb +++ b/spec/test_helpers/shared_examples_spec.rb @@ -0,0 +1,13 @@+require_relative '../spec_helper' +require 'govuk_message_queue_consumer/test_helpers' + +describe "The usage of the shared example" do + class WellDevelopedMessageQueueConsumer + def process(_message) + end + end + + describe WellDevelopedMessageQueueConsumer do + it_behaves_like "a message queue processor" + end +end
Add a test for the shared example test helper Yo, we heard you liked tests, so we put a test in the tests for the test helpers, that test that the test helper shared example test what it should be testing!
diff --git a/app/models/gobierto_module_settings.rb b/app/models/gobierto_module_settings.rb index abc1234..def5678 100644 --- a/app/models/gobierto_module_settings.rb +++ b/app/models/gobierto_module_settings.rb @@ -14,4 +14,12 @@ end end + def public_api_settings + self.settings ||= {} + + self.settings.select do |_, value| + value.is_a?(Hash) && value.fetch("exposed_in_public_api", false) + end + end + end
Add method to get module settings which are hashes including a pair exposed_in_public_api: true
diff --git a/config/initializers/api_pagination.rb b/config/initializers/api_pagination.rb index abc1234..def5678 100644 --- a/config/initializers/api_pagination.rb +++ b/config/initializers/api_pagination.rb @@ -1,5 +1,5 @@ ApiPagination.configure do |config| - DEFAULT_PER_PAGE ||= 10 + DEFAULT_PER_PAGE ||= 25 MAX_PER_PAGE ||= 50 config.page_param do |params|
Change DEFAULT_PER_PAGE in ApiPagination config file from 10 to 25.
diff --git a/lib/capistrano-nc.rb b/lib/capistrano-nc.rb index abc1234..def5678 100644 --- a/lib/capistrano-nc.rb +++ b/lib/capistrano-nc.rb @@ -11,17 +11,23 @@ namespace :nc do task :finished do - announced_stage = fetch(:stage, 'production') + if available? + announced_stage = fetch(:stage, 'production') - announcement = "\u2705 Successfully deployed " - announcement += if fetch(:branch, nil) - "#{application}'s #{branch} to #{announced_stage}" - else - "#{application} to #{announced_stage}" + announcement = "\u2705 Successfully deployed " + announcement += if fetch(:branch, nil) + "#{application}'s #{branch} to #{announced_stage}" + else + "#{application} to #{announced_stage}" + end + + TerminalNotifier.notify announcement, :title => "Capistrano" end + end + end - TerminalNotifier.notify announcement, :title => "Capistrano" - end + def available? + `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8' end end end
Check if system supports Notification Center
diff --git a/lib/cosme/helpers.rb b/lib/cosme/helpers.rb index abc1234..def5678 100644 --- a/lib/cosme/helpers.rb +++ b/lib/cosme/helpers.rb @@ -3,7 +3,7 @@ def cosmeticize Cosme.all.map do |cosmetic| content = cosmetic[:render] ? render(cosmetic[:render]) : render - content_tag(:div, nil, class: 'cosmetic', data: cosmetic.except(:render).merge(content: content)) + content_tag(:div, nil, class: 'cosmetic', data: cosmetic.except(:render).merge(content: "#{content}")) end.join.html_safe end end
Convert data-content to html escape
diff --git a/lib/cxml/item_out.rb b/lib/cxml/item_out.rb index abc1234..def5678 100644 --- a/lib/cxml/item_out.rb +++ b/lib/cxml/item_out.rb @@ -11,6 +11,7 @@ @item_detail = data['ItemDetail'] @unit_price = @item_detail['UnitPrice'] + @description = CXML::Description.new(@item_detail['Description']) if @description @unit_of_measure = @item_detail['UnitOfMeasure'] @shipping = data['Shipping'] if data['Shipping'] @@ -24,6 +25,7 @@ end t.ItemDetail do |o| o.UnitPrice { |p| CXML::Money.new(@unit_price['Money']).render(p) } + @description.render(p) if @description o.UnitOfMeasure do |p| p.text @unit_of_measure['content'] end
Fix CXML::ItemOut doesn't contain description
diff --git a/sample_gem/sample_gem.gemspec b/sample_gem/sample_gem.gemspec index abc1234..def5678 100644 --- a/sample_gem/sample_gem.gemspec +++ b/sample_gem/sample_gem.gemspec @@ -8,8 +8,8 @@ spec.version = SampleGem::VERSION spec.authors = ["T.J. Schuck"] spec.email = ["tj@tjschuck.com"] - spec.description = %q{Sample gem with C and Java extensions for demoing rake-compiler-dev-box} spec.summary = %q{Sample gem with C and Java extensions for demoing rake-compiler-dev-box} + spec.description = %q{Sample gem with C and Java extensions for demoing rake-compiler-dev-box. See https://github.com/tjschuck/rake-compiler-dev-box for more information.} spec.homepage = "https://github.com/tjschuck/rake-compiler-dev-box" spec.license = "MIT"
Fix warning: “description and summary are identical”
diff --git a/lib/forest/shrine.rb b/lib/forest/shrine.rb index abc1234..def5678 100644 --- a/lib/forest/shrine.rb +++ b/lib/forest/shrine.rb @@ -15,7 +15,7 @@ Shrine.plugin :cached_attachment_data # For retaining cached file on form redisplays Shrine.plugin :determine_mime_type Shrine.plugin :infer_extension -Shrine.plugin :instrumentation +Shrine.plugin :instrumentation if (Rails.env.development? || Rails.application.config.log_level == :debug) Shrine.plugin :pretty_location Shrine.plugin :remote_url, max_size: 40*1024*1024 # ~40mb Shrine.plugin :refresh_metadata
Disable Shrine instrumentation unless log_level is set to debug
diff --git a/Casks/bartender.rb b/Casks/bartender.rb index abc1234..def5678 100644 --- a/Casks/bartender.rb +++ b/Casks/bartender.rb @@ -1,6 +1,6 @@ cask :v1 => 'bartender' do - version '1.2.40' - sha256 '530abbc8139a04a71af41e459a34fc9a352d18a0cbd7f39d6446c4d5ca7cb0ab' + version '1.2.39' + sha256 '8c9b8cdbefcc458598a41a1a8d77d9456e45b977836546c4fe41b6d086b00f33' url "http://macbartender.com/updates/#{version.gsub('.', '-')}/Bartender.zip", :referer => 'http://www.macbartender.com'
Downgrade Bartender to version 1.2.39 This commit changes the version and sha256 stanzas. I updated this cask to 1.2.40 after following a prompt in the app. I did not realise I was accepting testing versions of the app, and version 1.2.40 was not a normal stable release. Sorry to anyone who has been negatively affected by running the testing version in this period.
diff --git a/Casks/launchbar.rb b/Casks/launchbar.rb index abc1234..def5678 100644 --- a/Casks/launchbar.rb +++ b/Casks/launchbar.rb @@ -11,7 +11,7 @@ end name 'LaunchBar' - homepage 'http://www.obdev.at/products/launchbar/' + homepage 'https://www.obdev.at/products/launchbar/' license :commercial app 'LaunchBar.app'
Fix homepage to use SSL in LaunchBar Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/deployment/puppet/swift/spec/classes/swift_proxy_keystone_spec.rb b/deployment/puppet/swift/spec/classes/swift_proxy_keystone_spec.rb index abc1234..def5678 100644 --- a/deployment/puppet/swift/spec/classes/swift_proxy_keystone_spec.rb +++ b/deployment/puppet/swift/spec/classes/swift_proxy_keystone_spec.rb @@ -19,7 +19,7 @@ describe 'with defaults' do - it { should contain_file(fragment_file).with_content(/operator_roles = admin SwiftOperator/) } + it { should contain_file(fragment_file).with_content(/operator_roles = admin, SwiftOperator/) } it { should contain_file(fragment_file).with_content(/is_admin = true/) } it { should contain_file(fragment_file).with_content(/cache = swift.cache/) }
Fix operator_roles test after changes in 2304e863
diff --git a/lib/itunes/itunes.rb b/lib/itunes/itunes.rb index abc1234..def5678 100644 --- a/lib/itunes/itunes.rb +++ b/lib/itunes/itunes.rb @@ -14,14 +14,18 @@ attr_accessor :albums attr_reader :tags - def initialize - @tracks = get_tracks + def initialize( playlist = nil ) + @tracks = get_tracks( playlist ) @albums = get_albums(@tracks) end - def get_tracks + def get_tracks( playlist = nil) track_list = [] - tracks = app("iTunes").library_playlists[1].tracks[its.video_kind.eq(:none)].get + if playlist.nil? + tracks = app("iTunes").playlists[1].tracks[its.video_kind.eq(:none)].get + else + tracks = app("iTunes").playlists[playlist].tracks[its.video_kind.eq(:none)].get + end tracks.each do |track_obj| track_list << Track.new(track_obj) end
Add playlist as an initialisation parameter
diff --git a/spec/features/user_changes_settings_spec.rb b/spec/features/user_changes_settings_spec.rb index abc1234..def5678 100644 --- a/spec/features/user_changes_settings_spec.rb +++ b/spec/features/user_changes_settings_spec.rb @@ -1,10 +1,9 @@ feature "User changes settings" do scenario "time zone from Pacific Time to Melbourne" do user = create(:user, time_zone: "Pacific Time (US & Canada)") - create(:entry, user: user, created_at: "2014-01-01 00:00:00") + create(:entry, user: user, date: Time.utc(2014, 1, 1)) login_as(user) visit dashboard_path - expect(page).to have_content("Tuesday") click_link "Settings" select "Melbourne", from: :user_time_zone @@ -12,7 +11,6 @@ expect(page).to have_content("settings have been saved") expect(current_path).to eq dashboard_path - expect(page).to have_content("Wednesday") end scenario "email delivery time from 9PM to 6AM" do
Remove day checking in settings spec We don't need to check this anymore because we're no longer doing time zone conversions. An entry has a date and that's all folks.
diff --git a/spec/models/course/lesson_plan_item_spec.rb b/spec/models/course/lesson_plan_item_spec.rb index abc1234..def5678 100644 --- a/spec/models/course/lesson_plan_item_spec.rb +++ b/spec/models/course/lesson_plan_item_spec.rb @@ -0,0 +1,25 @@+require 'rails_helper' + +RSpec.describe Course::LessonPlanItem, type: :model do + it { is_expected.to validate_numericality_of(:base_exp).only_integer } + it { is_expected.to validate_numericality_of(:time_bonus_exp).only_integer } + it { is_expected.to validate_numericality_of(:extra_bonus_exp).only_integer } + + let!(:instance) { create(:instance) } + with_tenant(:instance) do + let(:lesson_plan_item) { FactoryGirl.create :course_lesson_plan_item } + describe '#total_exp' do + it 'equals base exp plus bonuses' do + sum = lesson_plan_item.base_exp + + lesson_plan_item.time_bonus_exp + + lesson_plan_item.extra_bonus_exp + expect(lesson_plan_item.total_exp).to eq sum + end + end + + describe '#set_default_values' do + subject { Course::LessonPlanItem.new.total_exp } + it { is_expected.to eq 0 } + end + end +end
Add lesson plan item model tests
diff --git a/lib/easel_helpers/rails_partial_caching.rb b/lib/easel_helpers/rails_partial_caching.rb index abc1234..def5678 100644 --- a/lib/easel_helpers/rails_partial_caching.rb +++ b/lib/easel_helpers/rails_partial_caching.rb @@ -4,7 +4,7 @@ def render_partial_with_easel(*args) path = args.first[:partial] - locals = args.last + locals = args.last || {} easel_cached_column_counts = session[:easel_cached_column_counts] ||= {}
Add failsafe in instances where last arg is nil
diff --git a/lib/finite_machine/undefined_transition.rb b/lib/finite_machine/undefined_transition.rb index abc1234..def5678 100644 --- a/lib/finite_machine/undefined_transition.rb +++ b/lib/finite_machine/undefined_transition.rb @@ -4,18 +4,24 @@ class UndefinedTransition include Threadable - attr_threadsafe :event_name + def initialize(name) + self.name = name + end - def initialize(event_name) - self.event_name = event_name + def cancelled? + false + end + + def silent? + false end def execute(*args) - raise UndefinedError, "No transition for: #{event_name}" + raise UndefinedError, "No transition for: #{name}" end def ==(other) - other.is_a?(UndefinedTransition) && event_name == other.event_name + other.is_a?(UndefinedTransition) && name == other.name end protected
Change to define mock methods.
diff --git a/spec/unit/column_set/extract_widths_spec.rb b/spec/unit/column_set/extract_widths_spec.rb index abc1234..def5678 100644 --- a/spec/unit/column_set/extract_widths_spec.rb +++ b/spec/unit/column_set/extract_widths_spec.rb @@ -11,11 +11,27 @@ expect(column_set.extract_widths).to eql([2,2,2]) end - it "extracts widhts from utf" do + it "extracts widths from utf" do header = ['h1', 'うなじ'] rows = [['こんにちは', 'a2'], ['b1','選択']] table = TTY::Table.new header, rows column_set = TTY::Table::ColumnSet.new(table) expect(column_set.extract_widths).to eql([10,6]) end + + it "extracts widths from multiline text" do + table = TTY::Table.new + table << ["Multi\nLine\nContent", "Text\nthat\nwraps"] + table << ["Some\nother\ntext", 'Simple'] + column_set = TTY::Table::ColumnSet.new(table) + expect(column_set.extract_widths).to eq([7,6]) + end + + it "extracts widths from multiline text" do + table = TTY::Table.new + table << ["Multi\\nLine\\nContent", "Text\\nthat\\nwraps"] + table << ["Some\\nother\\ntext", 'Simple'] + column_set = TTY::Table::ColumnSet.new(table) + expect(column_set.extract_widths).to eq([20, 17]) + end end
Add specs for multiline column widths.
diff --git a/lib/gitlab/client/repository_submodules.rb b/lib/gitlab/client/repository_submodules.rb index abc1234..def5678 100644 --- a/lib/gitlab/client/repository_submodules.rb +++ b/lib/gitlab/client/repository_submodules.rb @@ -18,7 +18,7 @@ def edit_submodule(project, submodule, branch, commit_sha, commit_message) put("/projects/#{url_encode project}/repository/submodules/#{url_encode submodule}", body: { branch: branch, - commit_sha: commit_sha + commit_sha: commit_sha, commit_message: commit_message }) end
Fix missing coma in RepositorySubmodules
diff --git a/site-cookbooks/dna/recipes/dotfiles.rb b/site-cookbooks/dna/recipes/dotfiles.rb index abc1234..def5678 100644 --- a/site-cookbooks/dna/recipes/dotfiles.rb +++ b/site-cookbooks/dna/recipes/dotfiles.rb @@ -3,11 +3,12 @@ # # Download dotfiles # -git "Download wilr/dotfiles" do - repository "http://github.com/wilr/dotfiles.git" +git "Download dnadesign/dotfiles" do + repository "http://github.com/dnadesign/dotfiles.git" destination "#{node['sprout']['home']}/Scripts/dotfiles" action :sync user node['current_user'] + not_if { ::File.exists?("#{node['sprout']['home']}/Scripts/dotfiles") } end #
Use DNA dot files rather than my personal one at this stage
diff --git a/site/profile/lib/facter/external_ip.rb b/site/profile/lib/facter/external_ip.rb index abc1234..def5678 100644 --- a/site/profile/lib/facter/external_ip.rb +++ b/site/profile/lib/facter/external_ip.rb @@ -1,5 +1,5 @@ Facter.add(:external_ip) do setcode do - Facter::Core::Execution.execute('curl http://169.254.169.254/latest/meta-data/public-ipv4', options = {:timeout => 2}).chomp + Facter::Core::Execution.execute('curl -s http://169.254.169.254/latest/meta-data/public-ipv4', options = {:timeout => 2}).chomp end end
Add silent flag to curl
diff --git a/Casks/trailer.rb b/Casks/trailer.rb index abc1234..def5678 100644 --- a/Casks/trailer.rb +++ b/Casks/trailer.rb @@ -1,6 +1,6 @@ cask :v1 => 'trailer' do - version '1.3.7' - sha256 '9f022093051d6512a888cb1a0760afebed51e7c9f33dd991a81218f492491e55' + version '1.3.9' + sha256 '4f81aee67ecb732aaeaed39190ba64ab06e67a07bef95963d207117fc6313334' url "https://ptsochantaris.github.io/trailer/trailer#{version.delete('.')}.zip" appcast 'https://ptsochantaris.github.io/trailer/appcast.xml',
Update Trailer to version 1.3.9 This commit updates the version and sha256 stanzas.
diff --git a/lib/cloud_conductor/updaters/updater.rb b/lib/cloud_conductor/updaters/updater.rb index abc1234..def5678 100644 --- a/lib/cloud_conductor/updaters/updater.rb +++ b/lib/cloud_conductor/updaters/updater.rb @@ -18,7 +18,7 @@ Log.info "Updated environment(#{@environment.name}) on #{@cloud.name}" rescue => e @environment.update_attribute(:status, :ERROR) - Log.warn "Following errors have been occurred while creating environment(#{@environment.name}) on #{@cloud.name}" + Log.warn "Following errors have been occurred while updating environment(#{@environment.name}) on #{@cloud.name}" Log.warn e.message Log.debug e.backtrace raise
Fix log message while updating environment
diff --git a/spec/dummy/config/initializers/rails_compatibility.rb b/spec/dummy/config/initializers/rails_compatibility.rb index abc1234..def5678 100644 --- a/spec/dummy/config/initializers/rails_compatibility.rb +++ b/spec/dummy/config/initializers/rails_compatibility.rb @@ -0,0 +1,10 @@+# frozen_string_literal: true + +# Support migration version syntax in rails 4 +ActiveSupport.on_load(:active_record) do + unless ActiveRecord::Migration.respond_to?(:[]) + ActiveRecord::Migration.define_singleton_method(:[]) do |version| + self if version.to_s.starts_with?('4') + end + end +end
Support migration versioning in rails 4
diff --git a/spec/ubuntu-certified/root_password_spec.rb b/spec/ubuntu-certified/root_password_spec.rb index abc1234..def5678 100644 --- a/spec/ubuntu-certified/root_password_spec.rb +++ b/spec/ubuntu-certified/root_password_spec.rb @@ -0,0 +1,12 @@+require 'spec_helper' + +# No root password should be set + +# Test for "*/n" or "/n" +describe command("cat /etc/shadow | grep root | awk -F':' '{print $2;}'") do + its(:stdout) { should match /\*?\n/ } +end + + + +
Test for empty root password
diff --git a/lib/pwnbox/crypto.rb b/lib/pwnbox/crypto.rb index abc1234..def5678 100644 --- a/lib/pwnbox/crypto.rb +++ b/lib/pwnbox/crypto.rb @@ -4,16 +4,15 @@ module Crypto # http://rosettacode.org/wiki/Modular_inverse#Ruby def self.extended_gcd(a, b) - last_remainder, remainder = a.abs, b.abs - x, last_x, y, last_y = 0, 1, 1, 0 + last_remainder, remainder = [a, b].map(&:abs) + numbers = [0, 1, 1, 0] while remainder != 0 last_remainder, (quotient, remainder) \ - = remainder, last_remainder.divmod(remainder) - x, last_x = last_x - quotient * x, x - y, last_y = last_y - quotient * y, y + = remainder, last_remainder.divmod(remainder) + numbers = next_numbers(numbers, quotient) end - [last_remainder, last_x * (a < 0 ? -1 : 1), last_y * (b < 0 ? -1 : 1)] + [last_remainder, invert_sign(numbers[1], a), invert_sign(numbers[3], b)] end def self.gcd(a, b) @@ -29,5 +28,15 @@ egcd = extended_gcd(a, m) egcd[1] % m if egcd[0] == 1 end + + private + + def self.invert_sign(x, a) + x * (a < 0 ? -1 : 1) + end + + def self.next_numbers(numbers, quotient) + numbers.each_slice(2).map { |v| [v[1] - quotient * v[0], v[0]] }.flatten + end end end
Clean up to resolve the travis-ci fail
diff --git a/core/kernel/at_exit_spec.rb b/core/kernel/at_exit_spec.rb index abc1234..def5678 100644 --- a/core/kernel/at_exit_spec.rb +++ b/core/kernel/at_exit_spec.rb @@ -20,6 +20,12 @@ ruby_exe(code).should == "643" end + it "gives access to the last raised exception" do + code = 'at_exit{ puts $! == $exception }; begin; raise "foo"; rescue => e; $exception = e; raise; end' + # The true is embedded in the stack trace of the uncaught exception + ruby_exe("STDERR=STDOUT; #{code}", :escape => true).should =~ /true/ + end + end describe "Kernel#at_exit" do
Add a spec for $! inside at_exit{ }
diff --git a/lib/github_api/client/activity/feeds.rb b/lib/github_api/client/activity/feeds.rb index abc1234..def5678 100644 --- a/lib/github_api/client/activity/feeds.rb +++ b/lib/github_api/client/activity/feeds.rb @@ -8,8 +8,8 @@ # @see https://developer.github.com/v3/activity/feeds/#list-feeds # # @example - # github = Github.new - # github.activity.feeds.list + # github = Github.new + # github.activity.feeds.list # # @api public def list(*args) @@ -20,5 +20,30 @@ response.each { |el| yield el } end alias_method :all, :list + + # Get all the items for a named timeline + # + # @see https://developer.github.com/v3/activity/feeds/#list-feeds + # + # @example + # github = Github.new + # github.activity.feeds.get "timeline" + # + # @param [String] name + # the name of the timeline resource + # + # @api public + def get(*args) + arguments(args, required: [:name]) + + name = arguments.name + response = list.body._links[name] + if response + params = arguments.params + params['accept'] = response.type + get_request(response.href, params) + end + end + alias_method :find, :get end end # Github
Add ability to retrieve inidividual feed.
diff --git a/lib/relative_time.rb b/lib/relative_time.rb index abc1234..def5678 100644 --- a/lib/relative_time.rb +++ b/lib/relative_time.rb @@ -2,7 +2,6 @@ require 'relative_time/version' module RelativeTime - # Your code goes here... def self.in_words(date_to, date_from = Time.now) InWords.new.(date_to, date_from) end
Delete unnecessary line of code
diff --git a/lib/omniauth/strategies/nyulibraries.rb b/lib/omniauth/strategies/nyulibraries.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/nyulibraries.rb +++ b/lib/omniauth/strategies/nyulibraries.rb @@ -17,7 +17,7 @@ end info do - { + { name: raw_info["username"], nickname: raw_info["username"], email: raw_info["email"] @@ -36,4 +36,4 @@ end end end -end+end
Add new line at the end
diff --git a/app/block.rb b/app/block.rb index abc1234..def5678 100644 --- a/app/block.rb +++ b/app/block.rb @@ -2,6 +2,7 @@ extend Forwardable attr_reader :x, :y + def_delegators :@block_image, :width, :height def initialize(window, args = {}) @@ -14,10 +15,7 @@ @x = args[:x] || (rand * 32).to_i * self.width @y = args[:y] || (rand * 24).to_i * self.height end - - def relocate - locate_at - end + alias_method :relocate, :locate_at def move(direction) case direction
Define relocate as an alias.
diff --git a/spec/models/manager_refresh/save_inventory/spec_helper.rb b/spec/models/manager_refresh/save_inventory/spec_helper.rb index abc1234..def5678 100644 --- a/spec/models/manager_refresh/save_inventory/spec_helper.rb +++ b/spec/models/manager_refresh/save_inventory/spec_helper.rb @@ -3,7 +3,11 @@ # Helper for matching attributes of the model's records to an Array of hashes model_classes = model_classes.kind_of?(Array) ? model_classes : [model_classes] attributes = expected_match.first.keys - model_classes.each { |m| expect(m.to_a.map { |x| x.slice(*attributes).symbolize_keys }).to(match_array(expected_match)) } + model_classes.each { |m| expect(sliced_records_of(m, attributes)).to(match_array(expected_match)) } + end + + def sliced_records_of(model_class, attributes) + model_class.to_a.map { |x| x.slice(*attributes).symbolize_keys } end def add_data_to_dto_collection(dto_collection, *args)
Refactor comparing method of collections Refactor comparing method of collections, so we can easily use it when debugging
diff --git a/spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb b/spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb index abc1234..def5678 100644 --- a/spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb +++ b/spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb @@ -8,6 +8,18 @@ let(:code) { " file { source => 'puppet:///modules/certificates/etc/ssl/private/wildcard.example.com.crt', + }" + } + + it 'should not detect any problems' do + expect(problems).to have(0).problems + end + end + + context 'file resource with a template line > 80c' do + let(:code) { " + file { + content => template('mymodule/this/is/a/truely/absurdly/long/path/that/should/make/you/feel/bad'), }" }
Add spec for 80chars template() exception
diff --git a/lib/zoho_invoice_resource/connection.rb b/lib/zoho_invoice_resource/connection.rb index abc1234..def5678 100644 --- a/lib/zoho_invoice_resource/connection.rb +++ b/lib/zoho_invoice_resource/connection.rb @@ -1,9 +1,15 @@ module ZohoInvoiceResource class Connection < ActiveResource::Connection - DEBUG = true + DEBUG = false def http configure_http(new_http).tap do |h| - h.set_debug_output($stderr) if DEBUG + if DEBUG + if h.respond_to?(:set_debug_output) + h.set_debug_output($stderr) + elsif h.respond_to?(:debug_output=) # for ActiveResource::Persistent::HTTP + h.debug_output = $stderr + end + end end end
Fix the default value of Connection::DEBUG
diff --git a/lib/yard-sketchup.rb b/lib/yard-sketchup.rb index abc1234..def5678 100644 --- a/lib/yard-sketchup.rb +++ b/lib/yard-sketchup.rb @@ -15,6 +15,9 @@ # YARD::Server.register_static_path File.dirname(__FILE__) + "/templates/default/fulldoc/html" YARD::Templates::Engine.register_template_path self.templates_path + + # https://www.rubydoc.info/gems/yard/file/docs/TagsArch.md#Adding_Custom_Tags + YARD::Tags::Library.define_tag('Known Bugs', :bug) end def self.templates_path
Add custom @bug tag to make it easier to document known issues.
diff --git a/materials/esch_session_with_settings.rb b/materials/esch_session_with_settings.rb index abc1234..def5678 100644 --- a/materials/esch_session_with_settings.rb +++ b/materials/esch_session_with_settings.rb @@ -20,7 +20,7 @@ settings.set(instance, *namespace) - Connection::Client.configure instance, instance.host, instance.port, :reconnect => :when_closed + Connection::Client.configure instance, instance.host, instance.port, :reconnect => :closed logger.debug "Built HTTP session" end
Update materials to use :closed reconnect policy
diff --git a/spec/features/product_spec.rb b/spec/features/product_spec.rb index abc1234..def5678 100644 --- a/spec/features/product_spec.rb +++ b/spec/features/product_spec.rb @@ -0,0 +1,29 @@+require 'spec_helper' + +describe 'product search' do + it 'shows one product' do + stub_one_company_page + + stub_one_company + + stub_one_product_page + + stub_one_product + + visit '/dashboard' + + fill_in('product_permalink', with: 'basecamp') + + click_button 'Search product' + + expect(page).to have_content('Name: Basecamp') + expect(page).to have_content('Description: Basecamp is a project management and group collaboration tool. It was launched in 2004 as 37signals first product. The tool includes') + expect(page).to have_content('Crunch Base URL: http://www.crunchbase.com/product/basecamp') + expect(page).to have_content("Title: Tom's Planner Acquires Gantt Chart Service Competitor Gantto") + expect(page).to have_content('Author: Stephanie Yang') + expect(page).to have_content('Posted on: 2013-07-09') + expect(page).to have_content('Article URL: http://techcrunch.com/2013/07/09/toms-planner-acquires-gantt-chart-service-competitor-gantto/') + expect(page).to have_content('Article URL', count: 5) + + end +end
Test for the show page of a product after a search of this product
diff --git a/spec/isolated/require_spec.rb b/spec/isolated/require_spec.rb index abc1234..def5678 100644 --- a/spec/isolated/require_spec.rb +++ b/spec/isolated/require_spec.rb @@ -2,12 +2,12 @@ %w[ Repository Model Collection Query ].each do |name| it "should include the aggregate api in DataMapper::#{name}" do - (DataMapper.const_get(name) < DataMapper::Aggregates.const_get(name)).should be_true + (DataMapper.const_get(name) < DataMapper::Aggregates.const_get(name)).should be(true) end end it "should include the aggregate api into the adapter" do - @adapter.respond_to?(:aggregate).should be_true + @adapter.respond_to?(:aggregate).should be(true) end end
Change be_true and be_false to be(true) and be(false) in specs
diff --git a/spec/mailmanager_simplecov.rb b/spec/mailmanager_simplecov.rb index abc1234..def5678 100644 --- a/spec/mailmanager_simplecov.rb +++ b/spec/mailmanager_simplecov.rb @@ -17,7 +17,5 @@ add_filter '/pkg/' add_filter '/tasks/' add_filter '/results/' - - add_group 'Gem', 'lib/' end SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
Revert "add a coverage report group" This reverts commit 4f24848259c09414e24069fbb54a2a38666b54b0.