diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/Casks/sidekick.rb b/Casks/sidekick.rb index abc1234..def5678 100644 --- a/Casks/sidekick.rb +++ b/Casks/sidekick.rb @@ -0,0 +1,6 @@+class Sidekick < Cask + url 'http://oomphalot.com/sidekick/release/Sidekick.zip' + homepage 'http://oomphalot.com/sidekick/' + version 'latest' + no_checksum +end
Add Sidekick cask for managing laptop settings based on locale
diff --git a/Casks/webstorm.rb b/Casks/webstorm.rb index abc1234..def5678 100644 --- a/Casks/webstorm.rb +++ b/Casks/webstorm.rb @@ -1,10 +1,10 @@ cask :v1 => 'webstorm' do - version '9.0.1' - sha256 '81d07b1263cfab47f0cd6b66f0884475fcfaf3c705e6aa3f83a01bdc15c139ad' + version '9.0.2' + sha256 '9638d9a9a68e96db11f8acdc2a0a3e71a316fc14ac74193bc4bcb4745d975203' url "http://download-cf.jetbrains.com/webstorm/WebStorm-#{version}.dmg" homepage 'http://www.jetbrains.com/webstorm/' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :commercial app 'WebStorm.app'
Update WebStorm.app to 9.0.2 and fix license
diff --git a/test/features/agreement_notifications_test.rb b/test/features/agreement_notifications_test.rb index abc1234..def5678 100644 --- a/test/features/agreement_notifications_test.rb +++ b/test/features/agreement_notifications_test.rb @@ -0,0 +1,59 @@+require "test_helper" +require_relative 'support/ui_test_helper' +require_relative 'support/agreement_creation_helper' + +class AgreementsNotificationsTest < Capybara::Rails::TestCase + include UITestHelper + include AgreementCreationHelper + include Warden::Test::Helpers + after { Warden.test_reset! } + + setup do + login_as users(:pedro), scope: :user + visit root_path + end + + test "Creator is notified when agreement draft is validated" do + assert_not find(".notifications-box")[:class].include?('with-notifications') + agreement = create_valid_agreement!(organizations(:segpres), organizations(:sii)) + assert agreement.state == "draft" + within ".notifications-box" do + assert_content 0 + end + agreement.validate_draft(users(:pedro)) + agreement.last_revision.send_notifications + + visit root_path + assert_content "Directorio de Servicios" + assert find(".notifications-box")[:class].include?('with-notifications') + + within ".notifications-box" do + assert_content 1 + end + end + + test "All Responsables are notified just onece when agreement is modified" do + assert_not find(".notifications-box")[:class].include?('with-notifications') + agreement = create_valid_agreement!(organizations(:segpres), organizations(:sii)) + assert agreement.state == "draft" + within ".notifications-box" do + assert_content 0 + end + agreement.validate_draft(users(:pedro)) + agreement.last_revision.send_notifications + + #Is not posible to sign a document on tests + new_revision = agreement.new_revision(users(:pedro),"signed_draft","Manually Sign Draft","", agreement.last_revision.file) + new_revision.send_notifications + assert agreement.state.include?("signed_draft") + + visit root_path + assert_content "Directorio de Servicios" + assert find(".notifications-box")[:class].include?('with-notifications') + byebug + within ".notifications-box" do + assert_content 2 + end + end + +end
Add test for Agreement Notifications
diff --git a/lib/bbcloud.rb b/lib/bbcloud.rb index abc1234..def5678 100644 --- a/lib/bbcloud.rb +++ b/lib/bbcloud.rb @@ -6,12 +6,6 @@ require os_config if File.exist? os_config vendor_dir = File.expand_path(File.join(lib_dir, 'bbcloud','vendor')) - -unless defined?(DISABLE_RUBYGEMS) - require "rubygems" - gem "json", "~> 1.5.3" - gem "fog", "~> 0.8.0" -end # Add any vendored libraries into search path Dir.glob(vendor_dir + '/*').each do |f|
Remove the gem loading when there is no DISABLE_RUBYGEMS as this is done by the gemspec. It seems that it's not necessary to include the DISABLE_RUBYGEMS as the gemspec and bundler should take care of loading the fog and json gems.
diff --git a/lib/confoog.rb b/lib/confoog.rb index abc1234..def5678 100644 --- a/lib/confoog.rb +++ b/lib/confoog.rb @@ -17,15 +17,20 @@ @config_location = options[:location] || '~/' @config_filename = options[:filename] || DEFAULT_CONFIG - # make sure the file exists ... + # make sure the file exists or can be created... + check_exists(options) + end + + private + + def check_exists(options) if File.exist?(File.expand_path(File.join @config_location, @config_filename)) - status['config_exists'] = true else - if options[:create_file] == true then + if options[:create_file] == true full_path = File.expand_path(File.join @config_location, @config_filename) File.new(full_path, 'w').close - if File.exist? full_path then + if File.exist? full_path status['config_exists'] = true end else
Refactor code from initialize into private method Signed-off-by: Seapagan <4ab1b2fdb7784a8f9b55e81e3261617f44fd0585@gmail.com>
diff --git a/money.rb b/money.rb index abc1234..def5678 100644 --- a/money.rb +++ b/money.rb @@ -32,7 +32,7 @@ end class << self - attr_accessor :exchange + attr_reader :exchange %w(usd eur gbp).each do |currency| define_method("from_#{currency}") do |value|
Make the exchange object only accessible
diff --git a/db/migrate/20130707121400_create_booking_templates.rb b/db/migrate/20130707121400_create_booking_templates.rb index abc1234..def5678 100644 --- a/db/migrate/20130707121400_create_booking_templates.rb +++ b/db/migrate/20130707121400_create_booking_templates.rb @@ -0,0 +1,22 @@+class CreateBookingTemplates < ActiveRecord::Migration + def change + create_table :booking_templates do |t| + t.string "title" + t.string "amount" + t.integer "credit_account_id" + t.integer "debit_account_id" + t.text "comments" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "code" + t.string "matcher" + t.string "amount_relates_to" + t.string "type" + t.string "charge_rate_code" + t.string "salary_declaration_code" + t.integer "position" + + t.timestamps + end + end +end
Add migration to create BookingTemplate table.
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -5,6 +5,7 @@ controller do def index + render nothing: true, status: 200 end end @@ -25,4 +26,36 @@ expect(response.status).to eq(401) end end + + describe 'forced onboarding' do + let(:user) { create(:user, onboarded: onboarded) } + + describe 'when authenticated and onboarded' do + let(:onboarded) { true } + + it 'should not redirect' do + allow(controller).to receive(:current_user).and_return(user) + get 'index' + expect(response.status).to eq(200) + end + end + + describe 'when authenticated and NOT onboarded' do + let(:onboarded) { false } + + it 'should redirect to onboarding' do + allow(controller).to receive(:current_user).and_return(user) + get 'index' + expect(response).to redirect_to(:onboarding) + end + end + + describe 'when not authenticated' do + it 'should not redirect' do + allow(controller).to receive(:current_user).and_return(nil) + get 'index' + expect(response.status).to eq(200) + end + end + end end
Add application tests for onboarding
diff --git a/spec/integration/portal/portal_offering_spec.rb b/spec/integration/portal/portal_offering_spec.rb index abc1234..def5678 100644 --- a/spec/integration/portal/portal_offering_spec.rb +++ b/spec/integration/portal/portal_offering_spec.rb @@ -20,6 +20,6 @@ visit portal_offering_path(:id => learner.offering.id, :format => :jnlp) xml = Nokogiri::XML(page.driver.response.body) main_class = xml.xpath("/jnlp/application-desc/@main-class") - main_class.text.should == 'net.sf.sail.emf.launch.EMFLauncher2' + main_class.text.should == 'org.concord.LaunchJnlp' end end
Update test for the installer now being the default jnlp
diff --git a/spec/class_file_finder_spec.rb b/spec/class_file_finder_spec.rb index abc1234..def5678 100644 --- a/spec/class_file_finder_spec.rb +++ b/spec/class_file_finder_spec.rb @@ -4,13 +4,6 @@ describe ABCing::ClassFileFinder do before(:each) do Dir.mkdir 'dummy' - end - - after(:each) do - FileUtils.rm_rf 'dummy' - end - - it 'Finds files with class defined in them' do out_file = File.new("dummy/foo.rb", "w") out_file.puts("class Foo; end;") out_file.close @@ -18,13 +11,37 @@ out_file = File.new("dummy/bar.rb", "w") out_file.puts("class Foo; end;") out_file.close + end - expected_results = [ - 'dummy/bar.rb', - 'dummy/foo.rb', - ] + after(:each) do + FileUtils.rm_rf 'dummy' + end - finder = ABCing::ClassFileFinder.new(['dummy']) - expect(finder.find).to eq(expected_results) + context 'Included files' do + it 'Finds files with class defined in them' do + expected_results = [ + 'dummy/bar.rb', + 'dummy/foo.rb', + ] + + finder = ABCing::ClassFileFinder.new(['dummy']) + expect(finder.find).to eq(expected_results) + end + end + + context 'Excluded files' do + it 'that do not have a .rb extension' do + out_file = File.new("dummy/foo_config.txt", "w") + out_file.puts("class FooConfig; end;") + out_file.close + + expected_results = [ + 'dummy/bar.rb', + 'dummy/foo.rb', + ] + + finder = ABCing::ClassFileFinder.new(['dummy']) + expect(finder.find).to eq(expected_results) + end end end
Test for only scanning rb files
diff --git a/spec/features/sign_out_spec.rb b/spec/features/sign_out_spec.rb index abc1234..def5678 100644 --- a/spec/features/sign_out_spec.rb +++ b/spec/features/sign_out_spec.rb @@ -6,7 +6,7 @@ let!(:role_realtor) { FactoryGirl.create(:realtor) } let!(:user_valid) { FactoryGirl.create(:user, role: role_simple_user, confirmed_at: Time.now) } - it 'log_in and sign out simple user' , js: true do + it 'sign out simple user' , js: true do visit '/user/sign_in' within 'form' do fill_in 'user_email', with: user_valid.email @@ -16,15 +16,4 @@ click_on 'Выйти' expect(page).to have_content 'You need to sign in or sign up before continuing.' end - - it 'log in simple user with wrong email' , js: true do - visit '/user/sign_in' - p user_valid - within 'form' do - fill_in 'user_email', with: user_valid.email - fill_in 'user_password', with: 'shshshrsdh' - end - click_on 'Login' - expect(page).to have_content 'Invalid Email or password.' - end end
Fix log_in + sign_out tests
diff --git a/spec/twterm/friendship_spec.rb b/spec/twterm/friendship_spec.rb index abc1234..def5678 100644 --- a/spec/twterm/friendship_spec.rb +++ b/spec/twterm/friendship_spec.rb @@ -0,0 +1,104 @@+describe Twterm::Friendship do + describe '.already_looked_up?' do + before do + described_class.looked_up!(1) + end + + it 'returns true when the user is already looked up' do + expect(described_class.already_looked_up?(1)).to be true + end + + it 'returns false when the user is not looked up yet' do + expect(described_class.already_looked_up?(2)).to be false + end + end + + describe '.blocking?' do + before do + described_class.block(1, 2) + end + + it 'returns true when user 1 blocks user 2' do + expect(described_class.blocking?(1, 2)).to be true + end + + it 'returns false when user 1 does not block user 2' do + expect(described_class.blocking?(2, 1)).to be false + end + end + + describe '.following?' do + before do + described_class.follow(1, 2) + end + + it 'returns true when user 1 follows user 2' do + expect(described_class.following?(1, 2)).to be true + end + + it 'returns false when user 1 does not follow user 2' do + expect(described_class.following?(2, 1)).to be false + end + end + + describe '.following_requested?' do + before do + described_class.following_requested(1, 2) + end + + it 'returns true when user 1 have sent following request to user 2' do + expect(described_class.following_requested?(1, 2)).to be true + end + + it 'returns false when user 1 have not sent following request to user 2' do + expect(described_class.following_requested?(2, 1)).to be false + end + end + + describe '.muting?' do + before do + described_class.mute(1, 2) + end + + it 'returns true when user 1 mutes user 2' do + expect(described_class.muting?(1, 2)).to be true + end + + it 'returns false when user 1 does not mute user 2' do + expect(described_class.muting?(2, 1)).to be false + end + end + + describe '.unblock' do + before do + described_class.block(1, 2) + end + + it 'works' do + described_class.unblock(1, 2) + expect(described_class.blocking?(1, 2)).to be false + end + end + + describe '.unfollow' do + before do + described_class.follow(1, 2) + end + + it 'works' do + described_class.unfollow(1, 2) + expect(described_class.following?(1, 2)).to be false + end + end + + describe '.unmute' do + before do + described_class.mute(1, 2) + end + + it 'works' do + described_class.unmute(1, 2) + expect(described_class.muting?(1, 2)).to be false + end + end +end
Add test code for Friendship class
diff --git a/test/test_repository.rb b/test/test_repository.rb index abc1234..def5678 100644 --- a/test/test_repository.rb +++ b/test/test_repository.rb @@ -0,0 +1,34 @@+require File.expand_path('../helper', __FILE__) + +class TestRepository < Dbt::TestCase + def test_database_interactions + repository = Dbt::Repository.new + + database = repository.add_database(:default) + + assert_equal repository.database_for_key(:default), database + + assert repository.database_keys.include?(:default) + + assert_raises(RuntimeError) do + repository.add_database(:default) + end + + assert_equal repository.database_for_key(:default), database + + assert repository.database_keys.include?(:default) + + assert_equal repository.remove_database(:default), database + + assert !repository.database_keys.include?(:default) + + assert_raises(RuntimeError) do + repository.database_for_key(:default) + end + + assert_raises(RuntimeError) do + repository.remove_database(:default) + end + end + +end
Add some tests for new repository class
diff --git a/app/models/renalware/bag_volume.rb b/app/models/renalware/bag_volume.rb index abc1234..def5678 100644 --- a/app/models/renalware/bag_volume.rb +++ b/app/models/renalware/bag_volume.rb @@ -2,7 +2,7 @@ class BagVolume def self.values - 1000.step(4000, 250).to_a + 1000.step(5000, 250).to_a end end
Change BagVolume maximum value to 5000
diff --git a/config/database.rb b/config/database.rb index abc1234..def5678 100644 --- a/config/database.rb +++ b/config/database.rb @@ -9,6 +9,8 @@ Sequel::Model :validation_helpers Sequel.extension :migration -unless Sequel::Migrator.is_current?(DB, 'db/migrations') - Sequel::Migrator.run(DB, 'db/migrations') +Pathname(__dir__).join('../db/migrations').tap do |migrations_path| + unless Sequel::Migrator.is_current?(DB, migrations_path) + Sequel::Migrator.run(DB, migrations_path) + end end
Fix migrations dir on gem Migrations dir was wrong when installed system wide as a gem: it was relative.
diff --git a/jekyll-itafroma-archive.gemspec b/jekyll-itafroma-archive.gemspec index abc1234..def5678 100644 --- a/jekyll-itafroma-archive.gemspec +++ b/jekyll-itafroma-archive.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'jekyll-itafroma-archive' - s.version = '0.4.0' + s.version = '0.4.1' s.date = '2015-01-15' s.summary = 'Jekyll plugin to create a set of archive pages.' s.description = <<-EOF @@ -22,6 +22,7 @@ 'lib/jekyll/itafroma/archive_generator.rb', 'lib/jekyll/itafroma/archive_page.rb', 'lib/jekyll/itafroma/archive_pager.rb', + 'lib/jekyll/itafroma/archive_substitution.rb', ] s.homepage = 'http://marktrapp.com/projects/jekyll-archive' s.license = 'MIT'
Add missing file from gemspec.
diff --git a/test/resque_failure_redis_test.rb b/test/resque_failure_redis_test.rb index abc1234..def5678 100644 --- a/test/resque_failure_redis_test.rb +++ b/test/resque_failure_redis_test.rb @@ -1,5 +1,7 @@ require 'test_helper' require 'resque/failure/redis' + +require 'json' describe "Resque::Failure::Redis" do before do
Fix the build on MRI. My fix for JRuby broke MRI :(
diff --git a/app/controllers/console_controller.rb b/app/controllers/console_controller.rb index abc1234..def5678 100644 --- a/app/controllers/console_controller.rb +++ b/app/controllers/console_controller.rb @@ -39,7 +39,7 @@ response = @sql.join("\n") + '<br/>' + response unless @sql.empty? response = '<pre>' + response + '</pre>' - render text: response + render plain: response end protected
Move render text to render plain for Rails 5.1
diff --git a/app/controllers/reviews_controller.rb b/app/controllers/reviews_controller.rb index abc1234..def5678 100644 --- a/app/controllers/reviews_controller.rb +++ b/app/controllers/reviews_controller.rb @@ -2,22 +2,24 @@ layout "water" respond_to :html - def grade - if current_role.is_a?(Assistant) or current_role.is_a?(Examiner) - @submission = Submission.find(params[:id]) + + def review + result = params[:result] + submission = Submission.find(result[:id]) + + if result[:grade] if can?(:grade, @submission) - @submission.lab_has_group.update_attribute(:grade,params[:grade]) + @submission.lab_has_group.update_attribute(:grade,result[:grade]) end - end - redirect_to labs_path, notice: "Grade was change on submission" - end + redirect_to labs_path, notice: "Grade was changed on submission" + end - def state - if current_role.is_a?(Assistant) or current_role.is_a?(Examiner) + if result[:state] if can?(:state, @submission) - Submission.find(params[:id]).lab_has_group.send("#{params[:state]}!") + Submission.find(submission).lab_has_group.send("#{result[:state]}!") end end + respond_with(@submission) end end
Replace grade and state methods with review method in review_controller
diff --git a/app/models/organ.rb b/app/models/organ.rb index abc1234..def5678 100644 --- a/app/models/organ.rb +++ b/app/models/organ.rb @@ -33,7 +33,13 @@ [:position_member, :position_deputy].include? position.to_sym }.each do | position, ids| ids.each do |id| - self.members << Member.create(user: PositionApplication.find(id).user, position: position) + application = PositionApplication.find(id) + self.members << Member.create( + user: application.user, + position: position, + term_start: application.call.term_start, + term_end: application.call.term_end + ) end end end
Set the membership term_start and term_end according to the call.
diff --git a/capistrano-twingly.gemspec b/capistrano-twingly.gemspec index abc1234..def5678 100644 --- a/capistrano-twingly.gemspec +++ b/capistrano-twingly.gemspec @@ -18,6 +18,7 @@ spec.require_paths = ["lib"] spec.add_dependency "capistrano", "~> 3.2" + spec.add_dependency "foreman", "~> 0.82" spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" end
Add foreman as a dependency Required for deployment on servers Close #29
diff --git a/8_count_factors/8-count_factors.rb b/8_count_factors/8-count_factors.rb index abc1234..def5678 100644 --- a/8_count_factors/8-count_factors.rb +++ b/8_count_factors/8-count_factors.rb @@ -0,0 +1,9 @@+def solution(n) + count = 0 + 1.upto(Math.sqrt(n)) do |i| + count += 2 if n%i == 0 + end + sqrt_int = Math.sqrt(n).to_int + count -= 1 if (sqrt_int ** 2) == n + count +end
Add count_factors solution in ruby
diff --git a/lib/chanko/unit/scope_finder.rb b/lib/chanko/unit/scope_finder.rb index abc1234..def5678 100644 --- a/lib/chanko/unit/scope_finder.rb +++ b/lib/chanko/unit/scope_finder.rb @@ -1,12 +1,6 @@ module Chanko module Unit class ScopeFinder - LABEL_SCOPE_MAP = { - :controller => ActionController::Base, - :model => ActiveRecord::Base, - :view => ActionView::Base, - } - def self.find(*args) new(*args).find end @@ -34,7 +28,13 @@ end def label - LABEL_SCOPE_MAP[@identifier] + label_scope_map = { + :controller => ActionController::Base, + :model => ActiveRecord::Base, + :view => ActionView::Base + } + + label_scope_map[@identifier] end end end
Stop referencing {AC,AR,AV}::Base in a top-level constant
diff --git a/app/controllers/api/v1/registrations_controller.rb b/app/controllers/api/v1/registrations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/registrations_controller.rb +++ b/app/controllers/api/v1/registrations_controller.rb @@ -16,8 +16,7 @@ } else @user.errors.add(:password_confirmation, "can't be blank") unless params[:password_confirmation] - render status: 422, - json: json_response(:fail, data: {user: @user.errors}) + render status: 422, json: @user.errors.messages end end
Update API V1 Sign Up call to match legacy error response
diff --git a/lib/gutentag/tag_validations.rb b/lib/gutentag/tag_validations.rb index abc1234..def5678 100644 --- a/lib/gutentag/tag_validations.rb +++ b/lib/gutentag/tag_validations.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "active_model/errors" require "active_record/errors" class Gutentag::TagValidations @@ -8,7 +9,10 @@ :uniqueness => {:case_sensitive => false} }.freeze DATABASE_ERROR_CLASSES = lambda { - classes = [ActiveRecord::NoDatabaseError] + classes = [] + if ActiveRecord::VERSION::STRING.to_f > 4.0 + classes << ActiveRecord::NoDatabaseError + end classes << Mysql2::Error if defined?(::Mysql2) classes << PG::ConnectionBad if defined?(::PG) classes
Fix database handling with old Rails versions. ActiveRecord::NoDatabaseError doesn't exist in Rails 4.0 or 3.2, and ActiveRecord errors in 5.0+ refer to ActiveModel.
diff --git a/lib/refinery/podcasts/engine.rb b/lib/refinery/podcasts/engine.rb index abc1234..def5678 100644 --- a/lib/refinery/podcasts/engine.rb +++ b/lib/refinery/podcasts/engine.rb @@ -1,5 +1,4 @@ require 'refinerycms-core' -require 'acts_as_indexed' module Refinery module Podcasts
Allow the model to require acts_as_indexed.
diff --git a/examples/cloud/local_adapter.rb b/examples/cloud/local_adapter.rb index abc1234..def5678 100644 --- a/examples/cloud/local_adapter.rb +++ b/examples/cloud/local_adapter.rb @@ -0,0 +1,36 @@+# This is an example of using cloud with a local adapter. All cloud feature +# changes are synced to the local adapter on an interval. All feature reads are +# directed to the local adapter, which means reads are fast and not dependent on +# cloud being available. You can turn internet on/off and more and this should +# never raise. You could get a slow request every now and then if cloud is +# unavailable, but we are hoping to fix that soon by doing the cloud update in a +# background thread. +require File.expand_path('../../example_setup', __FILE__) + +require 'logger' +require 'flipper/cloud' +require 'flipper/adapters/redis' + +token = ENV.fetch("TOKEN") { abort "TOKEN environment variable not set." } +feature_name = ENV.fetch("FEATURE") { "testing" }.to_sym + +redis = Redis.new(logger: Logger.new(STDOUT)) +redis.flushdb + +Flipper.configure do |config| + config.default do + Flipper::Cloud.new(token) do |cloud| + cloud.debug_output = STDOUT + cloud.local_adapter = Flipper::Adapters::Redis.new(redis) + cloud.sync_interval = 10_000 + end + end +end + +loop do + # Should only print out http call every 10 seconds + p Flipper.enabled?(feature_name) + puts "\n\n" + + sleep 1 +end
Add local adapter example for cloud
diff --git a/config/boot.rb b/config/boot.rb index abc1234..def5678 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -4,11 +4,12 @@ # Load our dependencies require 'rubygems' unless defined?(Gem) -require 'bundler/setup' -Bundler.require(:default, RACK_ENV) require 'dotenv' Dotenv.load + +require 'bundler/setup' +Bundler.require(:default, RACK_ENV) ## # ## Enable devel logging
Load dotenv before the rest of the gems I think New Relic is not working because of this.
diff --git a/app/views/maps/index.json.jbuilder b/app/views/maps/index.json.jbuilder index abc1234..def5678 100644 --- a/app/views/maps/index.json.jbuilder +++ b/app/views/maps/index.json.jbuilder @@ -1,5 +1,6 @@ json.maps @maps do |map| json.id map.id + json.slug map.slug json.name map.name json.type map.map_type json.segments map.segments do |map_segment|
Include map slug in JSON response
diff --git a/tool/wrap_with_guard.rb b/tool/wrap_with_guard.rb index abc1234..def5678 100644 --- a/tool/wrap_with_guard.rb +++ b/tool/wrap_with_guard.rb @@ -0,0 +1,28 @@+#!/usr/bin/env ruby +# Wrap the passed the files with a guard (e.g., `ruby_version_is ""..."3.0"`). +# Notably if some methods are removed, this is a convenient way to skip such file from a given version. +# Example usage: +# $ spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.0"' spec/ruby/library/set/sortedset/**/*_spec.rb + +guard, *files = ARGV +abort "Usage: #{$0} GUARD FILES..." if files.empty? + +files.each do |file| + contents = File.binread(file) + lines = contents.lines.to_a + + lines = lines.map { |line| line.chomp.empty? ? line : " #{line}" } + + version_line = "#{guard} do\n" + if lines[0] =~ /^\s*require.+spec_helper/ + lines[0] = lines[0].sub(/^ /, '') + lines.insert 1, "\n", version_line + else + warn "Could not find 'require spec_helper' line in #{file}" + lines.insert 0, version_line + end + + lines << "end\n" + + File.binwrite file, lines.join +end
Add MSpec tool to automatically wrap spec files with a guard
diff --git a/lib/vcloud/user/organization.rb b/lib/vcloud/user/organization.rb index abc1234..def5678 100644 --- a/lib/vcloud/user/organization.rb +++ b/lib/vcloud/user/organization.rb @@ -1,12 +1,16 @@ module VCloud class Organization - attr_reader :type, :name, :href + attr_reader :type, :name, :href, :vdcs, :catalogs, :networks def initialize(args) @type = args[:type] @name = args[:name] @href = args[:href] + + @vdcs = [] + @catalogs = [] + @networks = [] end
Add fields for VDCs, Catalogs and Networks
diff --git a/lib/wp_api_client/connection.rb b/lib/wp_api_client/connection.rb index abc1234..def5678 100644 --- a/lib/wp_api_client/connection.rb +++ b/lib/wp_api_client/connection.rb @@ -12,6 +12,7 @@ if configuration.oauth_credentials faraday.use FaradayMiddleware::OAuth, configuration.oauth_credentials end + faraday.use Faraday::Response::RaiseError faraday.response :json, :content_type => /\bjson$/ faraday.adapter Faraday.default_adapter # make requests with Net::HTTP end
Raise Exceptions on non-200 response
diff --git a/spec/exchanges/coins_markets/integration/market_spec.rb b/spec/exchanges/coins_markets/integration/market_spec.rb index abc1234..def5678 100644 --- a/spec/exchanges/coins_markets/integration/market_spec.rb +++ b/spec/exchanges/coins_markets/integration/market_spec.rb @@ -14,8 +14,8 @@ end it 'fetch ticker' do - dog_xgtc_pair = Cryptoexchange::Models::MarketPair.new(base: 'DOG', target: 'XGTC', market: 'coins_markets') - ticker = client.ticker(dog_xgtc_pair) + pair = Cryptoexchange::Models::MarketPair.new(base: 'DOG', target: 'XGTC', market: 'coins_markets') + ticker = client.ticker(pair) expect(ticker.base).to eq 'DOG' expect(ticker.target).to eq 'XGTC'
Refactor longer varname to pair
diff --git a/entity_mapper.gemspec b/entity_mapper.gemspec index abc1234..def5678 100644 --- a/entity_mapper.gemspec +++ b/entity_mapper.gemspec @@ -22,6 +22,6 @@ spec.add_development_dependency "rake" spec.add_dependency "virtus", ">= 1.0.0.beta0", "<= 2.0" - spec.add_dependency "activemodel", ">= 4.0.0.rc1", "< 5" + spec.add_dependency "activemodel", "~> 4.0.0" spec.add_dependency "hooks" end
Make sure we don't get pre-release rails 4.1
diff --git a/app/models/git.rb b/app/models/git.rb index abc1234..def5678 100644 --- a/app/models/git.rb +++ b/app/models/git.rb @@ -8,10 +8,8 @@ FileUtils.mkdir_p dir @dir = base_dir - cloned = call("git clone --depth 1 #{repository} #{project_dir_name}") + @ready = call("git clone --branch #{branch} --depth 1 #{repository} #{project_dir_name}") @dir = dir - reseted = call("git reset --hard origin/#{branch}") if cloned - @ready = cloned && reseted yield(self) FileUtils.rm_rf(dir) if cloned
Make sure the right branch is checked out.
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,10 @@ module ApplicationHelper + + def sortable(column, title = nil) + title ||= column.titleize + css_class = (column == sort_column) ? "current #{sort_direction}" : nil + direction = (column == sort_column && sort_direction == "asc") ? "desc" : "asc" + link_to title, { :sort => column, :direction => direction }, { :class => css_class } + end + end
Add helper for table sorting by column.
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,9 +4,9 @@ when 'success' 'alert-success' when 'error' - 'alert-error' + 'alert-danger' when 'alert' - 'alert-block' + 'alert-warning' when 'notice' 'alert-info' else
Use correct bootstrap alert names
diff --git a/app/models/concerns/historical.rb b/app/models/concerns/historical.rb index abc1234..def5678 100644 --- a/app/models/concerns/historical.rb +++ b/app/models/concerns/historical.rb @@ -24,10 +24,10 @@ def history self.versions.reverse.map do |version| history = HistoryItem.new(version) - history.changeset.merge!("object" => self.class.name) - history.changeset.merge!("event" => version.event) - history.changeset.merge!("actor_id" => version.whodunnit) - history.changeset.merge!("recorded_at" => version.created_at) + history.changeset.merge!("object" => self.class.name, + "event" => version.event, + "actor_id" => version.whodunnit, + "recorded_at" => version.created_at) history end end
Consolidate changeset merges into one call
diff --git a/jsonnet.gemspec b/jsonnet.gemspec index abc1234..def5678 100644 --- a/jsonnet.gemspec +++ b/jsonnet.gemspec @@ -21,8 +21,8 @@ spec.add_runtime_dependency "mini_portile2", ">= 2.2.0" - spec.add_development_dependency "bundler", "~> 1.7" - spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "test-unit", "~> 3.1.3" - spec.add_development_dependency "rake-compiler", "~> 0.9.5" + spec.add_development_dependency "bundler", ">= 1.7" + spec.add_development_dependency "rake", ">= 10.0" + spec.add_development_dependency "test-unit", ">= 3.1.3" + spec.add_development_dependency "rake-compiler", ">= 0.9.5" end
Update development gems to fix Ruby 2.7 warnings
diff --git a/week-4/calculate-grade/my_solution.rb b/week-4/calculate-grade/my_solution.rb index abc1234..def5678 100644 --- a/week-4/calculate-grade/my_solution.rb +++ b/week-4/calculate-grade/my_solution.rb @@ -1,6 +1,20 @@ # Calculate a Grade -# I worked on this challenge [by myself, with: ]. +# I worked on this challenge with Coline. -# Your Solution Below+# Your Solution Below + +def get_grade(x) + if x > 90 + return "A" + elsif x < 90 && x >= 80 + return "B" + elsif x < 80 && x >= 70 + return "C" + elsif x < 70 && x >= 60 + return "D" + else + return "F" + end +end
Add content to flow challenges
diff --git a/lib/adb/peco.rb b/lib/adb/peco.rb index abc1234..def5678 100644 --- a/lib/adb/peco.rb +++ b/lib/adb/peco.rb @@ -4,6 +4,8 @@ module Adb module Peco + AdbUnavailableError = Class.new(StandardError) + def self.serial_option return nil unless adb_action return nil unless need_serial_option? @@ -21,6 +23,16 @@ exit 1 end + def self.adb_available? + system('which', 'adb', out: File::NULL) + end + + def self.ensure_adb_available + unless adb_available? + raise AdbUnavailableError, 'adb command is not available.' + end + end + def self.adb_action ARGV.reject{|a| a[0] == '-'}.first end @@ -34,6 +46,13 @@ ].include?(adb_action) end + begin + ensure_adb_available + rescue AdbUnavailableError => e + puts e.message + exit 1 + end + command = ['adb', serial_option, ARGV].flatten.join(' ') begin system(command)
Print error when adb command is not available
diff --git a/db/migrate/20120702112651_update_cached_amounts.rb b/db/migrate/20120702112651_update_cached_amounts.rb index abc1234..def5678 100644 --- a/db/migrate/20120702112651_update_cached_amounts.rb +++ b/db/migrate/20120702112651_update_cached_amounts.rb @@ -0,0 +1,10 @@+class UpdateCachedAmounts < ActiveRecord::Migration + def up + Invoice.transaction do + Invoice.find_each do |invoice| + invoice.update_amount + invoice.update_due_amount + end + end + end +end
Add migration to update cached_amount for invoices.
diff --git a/db/migrate/20170528105033_add_default_to_events.rb b/db/migrate/20170528105033_add_default_to_events.rb index abc1234..def5678 100644 --- a/db/migrate/20170528105033_add_default_to_events.rb +++ b/db/migrate/20170528105033_add_default_to_events.rb @@ -0,0 +1,8 @@+class AddDefaultToEvents < ActiveRecord::Migration[5.0] + def up + change_column :events, :time_slots, :integer, default: 3 + end + def down + change_column :events, :time_slots, :integer + end +end
Add time slot default to events
diff --git a/spec/fabricators_spec.rb b/spec/fabricators_spec.rb index abc1234..def5678 100644 --- a/spec/fabricators_spec.rb +++ b/spec/fabricators_spec.rb @@ -7,7 +7,8 @@ end describe "Fabrication" do - Fabrication::Fabricator.schematics.keys.sort.each do |fabricator_name| + #TODO : when 1.8.7 drop support se directly Symbol#sort + Fabrication::Fabricator.schematics.keys.sort_by(&:to_s).each do |fabricator_name| context "Fabricate(:#{fabricator_name})" do subject { Fabricate.build(fabricator_name) }
Fix issue with spec fabrication on ruby 1.8.7 In 1.8.7 the Symbol#<=> is not define. We can't sort directly array of Symbol, we need define how we sort it
diff --git a/app/controllers/spree/distributors_controller.rb b/app/controllers/spree/distributors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/distributors_controller.rb +++ b/app/controllers/spree/distributors_controller.rb @@ -19,7 +19,7 @@ order.save! end - redirect_back_or_default(root_path) + redirect_to root_path end def deselect @@ -30,7 +30,7 @@ order.save! end - redirect_back_or_default(root_path) + redirect_to root_path end end end
Remove redirect_back_or_default, which was causing unexpected behaviour
diff --git a/config/puma.rb b/config/puma.rb index abc1234..def5678 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,4 +1,4 @@-workers ENV.fetch('PUMA_WORKERS', `nproc`).to_i +workers ENV.fetch('PUMA_WORKERS', Etc.nprocessors).to_i max_threads = ENV.fetch('PUMA_MAX_THREADS', 16).to_i min_threads = ENV.fetch('PUMA_MIN_THREADS', max_threads).to_i
:wrench: Use platform independent way to get CPU count
diff --git a/spec/samples/literals.rb b/spec/samples/literals.rb index abc1234..def5678 100644 --- a/spec/samples/literals.rb +++ b/spec/samples/literals.rb @@ -13,7 +13,6 @@ ### Numbers 1_234 1.23e4 - 42i ### Symbols :hello :"he#{'l'*2}o"
Remove Complex literal for Travis / Ruby 2.0
diff --git a/spec/unit/spec_helper.rb b/spec/unit/spec_helper.rb index abc1234..def5678 100644 --- a/spec/unit/spec_helper.rb +++ b/spec/unit/spec_helper.rb @@ -4,8 +4,7 @@ RSpec.configure do |config| config.platform = 'mac_os_x' - config.version = '10.9.2' # FIXME: change to 10.9.3.json when available ... - # see https://github.com/customink/fauxhai/tree/master/lib/fauxhai/platforms/mac_os_x + config.version = '10.11.1' # via https://github.com/customink/fauxhai/tree/master/lib/fauxhai/platforms/mac_os_x config.before { stub_const('ENV', 'SUDO_USER' => 'fauxhai') } config.after(:suite) { FileUtils.rm_r('.librarian') } end
Update fauxhai mocking to use osx v10.11
diff --git a/lib/enom-api.rb b/lib/enom-api.rb index abc1234..def5678 100644 --- a/lib/enom-api.rb +++ b/lib/enom-api.rb @@ -1,4 +1,6 @@ module EnomAPI + autoload :Client, File.dirname(__FILE__) + '/enom-api/client.rb' autoload :Interface, File.dirname(__FILE__) + '/enom-api/interface.rb' + autoload :Registrant, File.dirname(__FILE__) + '/enom-api/registrant.rb' autoload :SearchQuery, File.dirname(__FILE__) + '/enom-api/search_query.rb' end
Add Client and Registrant to autoloader
diff --git a/lib/graph_search_helper.rb b/lib/graph_search_helper.rb index abc1234..def5678 100644 --- a/lib/graph_search_helper.rb +++ b/lib/graph_search_helper.rb @@ -4,21 +4,18 @@ Dry::Inflector.new.underscore(name) end - def random_variable - "cond_#{SecureRandom.hex(5)}" + def random_variable(prefix = 'cond') + "#{prefix}_#{SecureRandom.hex(5)}" end def match_clause(object, key) - clause = {} - clause[key] = object - clause + { "#{key}": object } end - def where_clause(element, value, key) - clause = {} - clause[key] = {} - clause[key][element] = value - clause + def where_clause(query, element, value, key) + value_container = random_variable('value') + params = { "#{value_container}": value } + query.where("#{key}.#{element} = {#{value_container}}").params(params) end def convert_roles(roles)
Improve helper methods for graph search
diff --git a/lib/petitest/test_group.rb b/lib/petitest/test_group.rb index abc1234..def5678 100644 --- a/lib/petitest/test_group.rb +++ b/lib/petitest/test_group.rb @@ -16,22 +16,18 @@ descendants << sub_class end - # @note Override - def method_added(method_name) - super - if method_name.to_s.start_with?(TEST_METHOD_NAME_PREFIX) - caller_location = caller_locations(1, 1)[0] - test_methods << ::Petitest::TestMethod.new( - line_number: caller_location.lineno, + # @return [Array<Petitest::TestMethod>] + def test_methods + public_instance_methods.map(&:to_s).select do |method_name| + method_name.start_with?(TEST_METHOD_NAME_PREFIX) + end.map do |method_name| + unbound_method = public_instance_method(method_name) + ::Petitest::TestMethod.new( + line_number: unbound_method.source_location[1], method_name: method_name.to_s, - path: ::File.expand_path(caller_location.absolute_path || caller_location.path) + path: unbound_method.source_location[0], ) end - end - - # @return [Array<Petitest::TestMethod>] - def test_methods - @test_methods ||= [] end end end
Use public_instance_methods instead of method_added
diff --git a/lib/plugins/popsinseoul.rb b/lib/plugins/popsinseoul.rb index abc1234..def5678 100644 --- a/lib/plugins/popsinseoul.rb +++ b/lib/plugins/popsinseoul.rb @@ -11,7 +11,9 @@ def execute(m) page = Nokogiri::HTML(open('http://www.arirang.com/Tv/Tv_Pagego.asp?sys_lang=Eng&PROG_CODE=TVCR0102')) - date = page.css('h4.h4date').text + sched_time = page.css('p.ment').first.text.strip + day = page.css('li.current').children.first.text + date = page.css('li.current').children[2].text response_string = "" num_of_feats = page.css('div.ahtml_h1').size i = 0 @@ -21,7 +23,7 @@ i += 1 end response_string.slice!(-2..-1) - m.reply "[#{date} 10:30KST] #{response_string}" + m.reply "[#{day} #{date}] #{response_string}| #{sched_time}" end def help(m)
Add schedule, day, and date to response
diff --git a/lib/location.rb b/lib/location.rb index abc1234..def5678 100644 --- a/lib/location.rb +++ b/lib/location.rb @@ -8,10 +8,10 @@ class Location < Sequel::Model set_schema do - String :api_key - String :data - String :iv - String :salt + String :api_key, null: false + String :data, null: false + String :iv, null: false + String :salt, null: false DateTime :created_at index :api_key
Add not null constraints to columns.
diff --git a/lib/processor/messenger.rb b/lib/processor/messenger.rb index abc1234..def5678 100644 --- a/lib/processor/messenger.rb +++ b/lib/processor/messenger.rb @@ -19,10 +19,10 @@ super logger end - %w[debug info warn error fatal unknown].each do |method_name| - define_method method_name do |message, *args| + %w[debug info warn error fatal unknown].each do |level| + define_method level do |message, &block| return if message.nil? || message.empty? - super message, *args + add(Logger.const_get(level.upcase), nil, message, &block) end end
Use Logger directly by add method
diff --git a/rack-pretty_json.gemspec b/rack-pretty_json.gemspec index abc1234..def5678 100644 --- a/rack-pretty_json.gemspec +++ b/rack-pretty_json.gemspec @@ -5,13 +5,13 @@ Gem::Specification.new do |s| s.name = "rack-pretty_json" s.version = Rack::PrettyJSON::VERSION - s.authors = ["Thibaut Barrère", "Jérémy Lecour"] - s.email = ["thibaut.barrere@gmail.com"] - s.homepage = "" - s.summary = %q{TODO: Write a gem summary} - s.description = %q{TODO: Write a gem description} + s.authors = ["Thibaut Barrère", "Jérémy Lecour", "Vincent Spehner"] + s.email = ["thibaut.barrere@gmail.com", "jeremy.lecour@gmail.com", "vzmind@gmail.com"] + s.homepage = "https://github.com/thbar/rack-pretty_json" + s.summary = %q{Pretty print the JSON if the user-agent is a bowser} + s.description = %q{If the requested resource is a JSON and the user agent is a browser, the response body is reformated for a better human readable format of the JSON (line breaks, indents, …).} - s.rubyforge_project = "rack-pretty_json" + s.rubyforge_project = "" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Add authors, description, homepage, … in the gemspec
diff --git a/lib/sox/request_options.rb b/lib/sox/request_options.rb index abc1234..def5678 100644 --- a/lib/sox/request_options.rb +++ b/lib/sox/request_options.rb @@ -1,12 +1,22 @@ module Sox class RequestOptions def request - "<request method=\"#{@method}\"></request>" + generate_xml end def initialize(method, options={}) @method = method @options = options end + + private + + def generate_xml + root = NSXMLElement.alloc.initWithName 'request' + root.addAttribute NSXMLNode.attributeWithName('method', stringValue: @method) + document = NSXMLDocument.alloc.initWithRootElement root + data = document.XMLDataWithOptions NSXMLDocumentTidyXML + NSString.alloc.initWithData(data, encoding: NSUTF8StringEncoding) + end end end
Use an NSXMLDocument to generate the xml
diff --git a/lib/sql/index_case_stmt.rb b/lib/sql/index_case_stmt.rb index abc1234..def5678 100644 --- a/lib/sql/index_case_stmt.rb +++ b/lib/sql/index_case_stmt.rb @@ -26,7 +26,7 @@ clauses << "WHEN '#{item}' THEN #{index}" end - "CASE #{@column} #{clauses.join} END" + "CASE #{@column} #{clauses.join(" ")} END" end end end
Format generated case stmt correctly
diff --git a/lib/aql/node/operator/binary.rb b/lib/aql/node/operator/binary.rb index abc1234..def5678 100644 --- a/lib/aql/node/operator/binary.rb +++ b/lib/aql/node/operator/binary.rb @@ -68,7 +68,7 @@ end # Binary substraction operator - class Substraction < self + class Subtraction < self SYMBOL = :- end
Fix german class name for subtraction
diff --git a/lib/country_select/countries.rb b/lib/country_select/countries.rb index abc1234..def5678 100644 --- a/lib/country_select/countries.rb +++ b/lib/country_select/countries.rb @@ -2,14 +2,12 @@ require 'countries' module CountrySelect - Thread.current[:country_select] ||= {} - def self.use_iso_codes - Thread.current[:country_select][:use_iso_codes] ||= false + Thread.current[:country_select_use_iso_codes] ||= false end def self.use_iso_codes=(val) - Thread.current[:country_select][:use_iso_codes] = val + Thread.current[:country_select_use_iso_codes] = val end def self.locale
Store config directly in `Thread.current` key
diff --git a/lib/interstate/state_machine.rb b/lib/interstate/state_machine.rb index abc1234..def5678 100644 --- a/lib/interstate/state_machine.rb +++ b/lib/interstate/state_machine.rb @@ -29,7 +29,7 @@ # TODO quite ugly, can be improved if object.state.nil? object.state = object.class.initialized_state.to_sym - object.save if object.persisted? + object.save if object.respond_to?(:persisted?) && object.persisted? object.state else object.state.to_sym
Save state if object is an activerecord
diff --git a/lib/juglight/deferrable_body.rb b/lib/juglight/deferrable_body.rb index abc1234..def5678 100644 --- a/lib/juglight/deferrable_body.rb +++ b/lib/juglight/deferrable_body.rb @@ -3,27 +3,20 @@ include EventMachine::Deferrable def initialize - @queue = [] + @queue = EM::Queue.new end - def schedule_dequeue - return unless @body_callback - EventMachine::next_tick do - next unless body = @queue.shift - @body_callback.call(body) - schedule_dequeue unless @queue.empty? - end - end - - def <<(body) - @queue << body - schedule_dequeue + def write(body) + @queue.push(body) end def each &blk @body_callback = blk - schedule_dequeue + processor = proc { |item| + @body_callback.call(item) + @queue.pop(&processor) + } + @queue.pop(&processor) end - end end
Use EM::Queue for DeferrableBody so writing doesn't block
diff --git a/lib/otp/base.rb b/lib/otp/base.rb index abc1234..def5678 100644 --- a/lib/otp/base.rb +++ b/lib/otp/base.rb @@ -56,7 +56,7 @@ raise NotImplementedError end - def extract_type_specific_uri_param + def extract_type_specific_uri_params(query) raise NotImplementedError end end
Correct the spec of default template method.
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/lib/stompede.rb b/lib/stompede.rb index abc1234..def5678 100644 --- a/lib/stompede.rb +++ b/lib/stompede.rb @@ -20,14 +20,14 @@ class TCPServer def initialize(app_klass) - @app_klass = app_klass + @connector = Connector.new(app_klass) end def listen(*args) server = ::TCPServer.new(*args) loop do socket = server.accept - @app_klass.new(Celluloid::IO::TCPSocket.new(socket)) + @connector.async.connect(Celluloid::IO::TCPSocket.new(socket)) end end end
Fix TCP server to work with Connector
diff --git a/lib/usesthis.rb b/lib/usesthis.rb index abc1234..def5678 100644 --- a/lib/usesthis.rb +++ b/lib/usesthis.rb @@ -3,5 +3,6 @@ require 'salt' require 'usesthis/interview' -#require 'usesthis/link' -#require 'usesthis/ware'+require 'usesthis/link' +require 'usesthis/ware' +require 'usesthis/site'
Load the link, ware and site classes.
diff --git a/tests/unix_test.rb b/tests/unix_test.rb index abc1234..def5678 100644 --- a/tests/unix_test.rb +++ b/tests/unix_test.rb @@ -2,7 +2,7 @@ require_relative "../lib/redic" setup do - Redic.new("unix:///tmp/redis.sock") + Redic.new("unix:///tmp/redis.6379.sock") end test "normal commands" do |c|
Change name of unix socket in tests
diff --git a/react-rails.gemspec b/react-rails.gemspec index abc1234..def5678 100644 --- a/react-rails.gemspec +++ b/react-rails.gemspec @@ -23,7 +23,7 @@ s.add_dependency 'execjs' s.add_dependency 'rails', '>= 3.1' - s.add_dependency 'react-source', '0.8.0' + s.add_dependency 'react-source', '0.9.0' s.files = Dir[ 'lib/**/*',
Update react-source 0.8.0 -> 0.9.0
diff --git a/lib/rubygems/tasks/build/gem.rb b/lib/rubygems/tasks/build/gem.rb index abc1234..def5678 100644 --- a/lib/rubygems/tasks/build/gem.rb +++ b/lib/rubygems/tasks/build/gem.rb @@ -1,7 +1,10 @@ require 'rubygems/tasks/build/task' -require 'rubygems/builder' require 'fileutils' + +if Gem::VERSION > '2.' then require 'rubygems/package' +else require 'rubygems/builder' +end module Gem class Tasks @@ -49,7 +52,9 @@ # @api semipublic # def build(path,gemspec) - builder = ::Gem::Builder.new(gemspec) + builder = if Gem::VERSION > '2.' then ::Gem::Package.new(gemspec) + else ::Gem::Builder.new(gemspec) + end mv builder.build, Project::PKG_DIR end
Use Gem::Package with RubyGems 2.0.0.
diff --git a/lib/seed_express/model_class.rb b/lib/seed_express/model_class.rb index abc1234..def5678 100644 --- a/lib/seed_express/model_class.rb +++ b/lib/seed_express/model_class.rb @@ -28,7 +28,7 @@ not_abstract_classes = get_real_classes.call(ActiveRecord::Base.subclasses) not_abstract_classes. - select { |klass| !klass.abstract_class && klass.respond_to?(:table_name) }. + select { |klass| !klass.abstract_class? && klass.respond_to?(:table_name) }. map { |klass| [klass.table_name.to_sym, klass] }.to_h end memoize :table_to_classes
Use ? method instead of implicit conversion in condition.
diff --git a/lib/specinfra/host_inventory.rb b/lib/specinfra/host_inventory.rb index abc1234..def5678 100644 --- a/lib/specinfra/host_inventory.rb +++ b/lib/specinfra/host_inventory.rb @@ -1,16 +1,7 @@-require 'specinfra/host_inventory/memory' -require 'specinfra/host_inventory/ec2' -require 'specinfra/host_inventory/hostname' -require 'specinfra/host_inventory/domain' -require 'specinfra/host_inventory/fqdn' -require 'specinfra/host_inventory/platform' -require 'specinfra/host_inventory/platform_version' -require 'specinfra/host_inventory/filesystem' -require 'specinfra/host_inventory/cpu' - module Specinfra class HostInventory include Singleton + include Enumerable def initialize property[:host_inventory] ||= {} @@ -29,5 +20,29 @@ end @inventory[key.to_sym] end + + def each + keys.each do |k| + yield self[k] + end + end + + def keys + %w{ + memory + ec2 + hostname + domain + fqdn + platform + platform_version + filesystem + cpu + } + end end end + +Specinfra::HostInventory.instance.keys.each do |k| + require "specinfra/host_inventory/#{k}" +end
Change Host Inventory to enumerable
diff --git a/lib/tasks/taxonomy_metrics.rake b/lib/tasks/taxonomy_metrics.rake index abc1234..def5678 100644 --- a/lib/tasks/taxonomy_metrics.rake +++ b/lib/tasks/taxonomy_metrics.rake @@ -22,5 +22,12 @@ Metrics::TaxonsPerLevelMetrics.new.record_all end + + desc "Record all metrics about the Topic Taxonomy" + task record_all: %i[ + count_content_per_level + record_taxons_per_level_metrics + record_content_coverage_metrics + ] end end
Add a rake task to record all metrics This can then be used by the Jenkins job setup by govuk-puppet.
diff --git a/Casks/adobe-photoshop-lightroom.rb b/Casks/adobe-photoshop-lightroom.rb index abc1234..def5678 100644 --- a/Casks/adobe-photoshop-lightroom.rb +++ b/Casks/adobe-photoshop-lightroom.rb @@ -1,10 +1,10 @@ cask :v1 => 'adobe-photoshop-lightroom' do - version '5.6' - sha256 '794fa6b364985a6e3c830f78c9ad9c52c46208676bf01576976cbcfc818aa61a' + version '5.7' + sha256 'cb997a526ebf6e338896d21f48b1037e44009cc67d1cef789109d93b112679ac' url "http://download.adobe.com/pub/adobe/lightroom/mac/#{version.to_i}.x/Lightroom_#{version.to_i}_LS11_mac_#{version.gsub('.','_')}.dmg" homepage 'http://www.adobe.com/products/photoshop-lightroom.html' - license :unknown + license :commercial pkg "Adobe Photoshop Lightroom #{version.to_i}.pkg"
Upgrade Adobe Lightroom to 5.7
diff --git a/app/presenters/editorial_progress_presenter.rb b/app/presenters/editorial_progress_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/editorial_progress_presenter.rb +++ b/app/presenters/editorial_progress_presenter.rb @@ -5,7 +5,9 @@ def initialize(scope = Edition.all) self.scope = scope - self.column_headings = [:title, :slug, :preview_url, :state, :format, :version_number, :assigned_to] + self.column_headings = [:title, :slug, :preview_url, :state, + :format, :version_number, :assigned_to, :sibling_in_progress, + :panopticon_id] end def filename
Include panopticon_id and whether a sibling is in progress in report
diff --git a/cognizant.gemspec b/cognizant.gemspec index abc1234..def5678 100644 --- a/cognizant.gemspec +++ b/cognizant.gemspec @@ -4,9 +4,9 @@ Gem::Specification.new do |gem| gem.authors = ["Gurpartap Singh"] gem.email = ["contact@gurpartap.com"] - gem.description = "Process monitoring and management framework" - gem.summary = "Cognizant is an advanced and efficient process monitoring and management framework." - gem.homepage = "http://gurpartap.github.com/cognizant/" + gem.description = "Cognizant is a process management system utility that supervises your processes, ensuring their state based on a flexible criteria." + gem.summary = "Cognizant is a process management system utility that supervises your processes, ensuring their state based on a flexible criteria." + gem.homepage = "http://github.com/Gurpartap/cognizant" gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } gem.files = `git ls-files`.split("\n")
Add a better description to gemspec.
diff --git a/bootstrap-cookbooks/bootstrap/recipes/default.rb b/bootstrap-cookbooks/bootstrap/recipes/default.rb index abc1234..def5678 100644 --- a/bootstrap-cookbooks/bootstrap/recipes/default.rb +++ b/bootstrap-cookbooks/bootstrap/recipes/default.rb @@ -6,6 +6,15 @@ # Install docker. group "docker" do members ["vagrant"] +end + +# Change group for gem dir. +bash "gems dir attributes change" do + user "root" + code <<-EOC + chgrp -R docker /opt/chef/embedded/lib/ruby/gems + chmod -R 775 /opt/chef/embedded/lib/ruby/gems + EOC end if node["platform"] == "centos" then
Configure gem dirs to run kitchen init.
diff --git a/rspec-pride.gemspec b/rspec-pride.gemspec index abc1234..def5678 100644 --- a/rspec-pride.gemspec +++ b/rspec-pride.gemspec @@ -1,9 +1,9 @@ Gem::Specification.new do |s| s.name = 'rspec-pride' - s.version = '2.3.0' + s.version = '3.1.0' s.summary = 'Take pride in your testing' - s.description = 'Mimics the functionality of minitest/pride for RSpec2' + s.description = 'Mimics the functionality of minitest/pride for RSpec3' s.author = 'Mark Rada' s.email = 'mrada@marketcircle.com' s.homepage = 'http://github.com/ferrous26/rspec-pride'
Bump version and update gem spec
diff --git a/Casks/opera-developer.rb b/Casks/opera-developer.rb index abc1234..def5678 100644 --- a/Casks/opera-developer.rb +++ b/Casks/opera-developer.rb @@ -1,6 +1,6 @@ cask :v1 => 'opera-developer' do - version '30.0.1833.0' - sha256 '0c79b262ec4d04324af52b6ed4550c2035fc8d8b8f978f27064f12d248cfd406' + version '30.0.1835.5' + sha256 'f4a8cd8860ac2836b420b9f0456b50629759465eba91bf472a30d529815ba0fa' url "http://get.geo.opera.com/pub/opera-developer/#{version}/mac/Opera_Developer_#{version}_Setup.dmg" homepage 'http://www.opera.com/developer'
Upgrade Opera Developer.app to v30.0.1835.5
diff --git a/lib/rspec-search-and-destroy/bisector.rb b/lib/rspec-search-and-destroy/bisector.rb index abc1234..def5678 100644 --- a/lib/rspec-search-and-destroy/bisector.rb +++ b/lib/rspec-search-and-destroy/bisector.rb @@ -25,11 +25,8 @@ results = executor.load_run_results - if results.failed? - bisect(enabled, failed_example) - else - bisect(disabled, failed_example) - end + next_set = results.failed? ? enabled : disabled + bisect(next_set, failed_example) end end end
Reduce duplication of the recursive bisect call
diff --git a/lib/narabi/parser.rb b/lib/narabi/parser.rb index abc1234..def5678 100644 --- a/lib/narabi/parser.rb +++ b/lib/narabi/parser.rb @@ -3,7 +3,7 @@ RESPONSE_REGEXP = /^(.+)-->(.+):\s?(.*)/ NOTE_REGEXP = /^note\s(.+):\s?(.*)/ - class Sequence + class Message attr_reader :sender, :receiver, :message, :is_return def initialize(match, is_return = false) @@ -14,10 +14,10 @@ def self.parse_line(src) if match = RESPONSE_REGEXP.match(src) - return Sequence.new(match, true) + return Message.new(match, true) end if match = NORMAL_REGEXP.match(src) - return Sequence.new(match) + return Message.new(match) end # if match = NOTE_REGEXP.match(src) # nil
Improve classname to Message from Sequence
diff --git a/lib/scrapers/human_phenotype_ontology.rb b/lib/scrapers/human_phenotype_ontology.rb index abc1234..def5678 100644 --- a/lib/scrapers/human_phenotype_ontology.rb +++ b/lib/scrapers/human_phenotype_ontology.rb @@ -5,6 +5,23 @@ extract_class_name_from_response_for_hpo_id(resp, hpo_id) rescue '' + end + + def self.scrape_all() + resp = Util.make_get_request(url()) + xml = Nokogiri::XML(resp) + i = 0 + xml.xpath("//owl:Class[@rdf:about]").each do |row| + about = row.attributes['about'].value + if about.starts_with?('http://purl.obolibrary.org/obo/HP_') + hpo_id = about[/http:\/\/purl\.obolibrary\.org\/obo\/(HP_[0-9]*)/, 1] + hpo_id = hpo_id.sub('_', ':') + name = row.at_xpath('rdfs:label').text + Phenotype.create(hpo_id: hpo_id, hpo_class: name) + i = i+ 1 + end + end + puts(i) end private
Add method to scrape the full HPO
diff --git a/lib/sepa/banks/danske/danske_response.rb b/lib/sepa/banks/danske/danske_response.rb index abc1234..def5678 100644 --- a/lib/sepa/banks/danske/danske_response.rb +++ b/lib/sepa/banks/danske/danske_response.rb @@ -25,6 +25,14 @@ @ca_certificate ||= extract_cert(doc, 'CACert', DANSKE_PKI) end + def certificate + if @command == :create_certificate + @certificate ||= begin + extract_cert(doc, 'X509Certificate', DSIG) + end + end + end + private def find_node_by_uri(uri)
Correct certificate extraction for Danske create_certificate command
diff --git a/lib/redch/gateway.rb b/lib/redch/gateway.rb index abc1234..def5678 100644 --- a/lib/redch/gateway.rb +++ b/lib/redch/gateway.rb @@ -11,7 +11,7 @@ def send_samples(&generate_value) begin - AMQP.start("amqp://guest:guest@dev.rabbitmq.com") do |connection, open_ok| + AMQP.start(settings) do |connection, open_ok| # Connect to a channel with a direct exchange producer = Producer.new(AMQP::Channel.new(connection), AMQP::Exchange.default) @@ -33,5 +33,14 @@ raise Interrupt end end + + def default_settings + raise ArgumentError, "Environmental variable AMQP_URL must exist" if ENV["AMQP_URL"].nil? + URI.encode(ENV["AMQP_URL"]) + end + + def settings + @settings ||= default_settings + end end end
Handle AMQP url with an ENV
diff --git a/core/app/controllers/spree/products_controller.rb b/core/app/controllers/spree/products_controller.rb index abc1234..def5678 100644 --- a/core/app/controllers/spree/products_controller.rb +++ b/core/app/controllers/spree/products_controller.rb @@ -18,9 +18,12 @@ @variants = Variant.active.includes([:option_values, :images]).where(:product_id => @product.id) @product_properties = ProductProperty.includes(:property).where(:product_id => @product.id) - referer_path = URI.parse(request.env['HTTP_REFERER']).path - if referer_path && referer_path.match(/\/t\/(.*)/) - @taxon = Taxon.find_by_permalink($1) + referer = request.env['HTTP_REFERER'] + if referer + referer_path = URI.parse(request.env['HTTP_REFERER']).path + if referer_path && referer_path.match(/\/t\/(.*)/) + @taxon = Taxon.find_by_permalink($1) + end end respond_with(@product)
Check for referer before attempting to parse as URI
diff --git a/spec/factories/places.rb b/spec/factories/places.rb index abc1234..def5678 100644 --- a/spec/factories/places.rb +++ b/spec/factories/places.rb @@ -27,6 +27,7 @@ FactoryGirl.define do factory :place do + data_set name "Testplace" wheelchair "yes" end
Add association during factory create.
diff --git a/spec/git_tracker_spec.rb b/spec/git_tracker_spec.rb index abc1234..def5678 100644 --- a/spec/git_tracker_spec.rb +++ b/spec/git_tracker_spec.rb @@ -1,3 +1,4 @@+require 'spec_helper' require 'git_tracker' describe GitTracker do @@ -16,8 +17,7 @@ # TODO: stop the abort from writing to stderr during tests? it "doesn't run hooks we don't know about" do - lambda { subject.execute('non-existent-hook', *args) }. - should raise_error SystemExit, "[git_tracker] command: 'non-existent-hook' does not exist." + lambda { subject.execute('non-existent-hook', *args) }.should_not succeed end end
Use RSpec exit code matcher here too.
diff --git a/spec/ruby/string_spec.rb b/spec/ruby/string_spec.rb index abc1234..def5678 100644 --- a/spec/ruby/string_spec.rb +++ b/spec/ruby/string_spec.rb @@ -0,0 +1,24 @@+describe "String" do + let(:string) do + "ABCDEFGHIJK" + end + + context "#scan(pattern_or_string)" do + context "if no block is given" do + context "if pattern_or_string does not contain group" do + it "returns an array with each string matching the pattern" do + expect(string.scan(/[aeiouy]/i)).to eq ['A', 'E', 'I'] + end + end + context "if pattern_or_string contains group(s)" do + it "returns an array of groups (array of strings)" do + expect("Hello Ruby World!".scan(/(\w+)/)).to eq([["Hello"],["Ruby"],["World"]]) + end + end + end + context "when given a block" do + pending + end + end +end +
Add an example for String
diff --git a/lib/generators/rspec/install/install_generator.rb b/lib/generators/rspec/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/rspec/install/install_generator.rb +++ b/lib/generators/rspec/install/install_generator.rb @@ -19,14 +19,6 @@ directory 'spec' end - def copy_autotest_files - directory 'autotest' - end - - def app_name - Rails.application.class.name - end - end end end
Fix bug in which rspec:install generator tries to copy autotest files that don't exist. - Closes #283
diff --git a/lib/mysh/shell_variables/shell_variable_keeper.rb b/lib/mysh/shell_variables/shell_variable_keeper.rb index abc1234..def5678 100644 --- a/lib/mysh/shell_variables/shell_variable_keeper.rb +++ b/lib/mysh/shell_variables/shell_variable_keeper.rb @@ -18,7 +18,7 @@ loop_check[my_id] = self @value.preprocess ensure - loop_check[my_id] = nil + loop_check.delete(my_id) end #Get the source code of this variable.
Delete object id instead of setting to nil.
diff --git a/lib/generators/cancan/ability/templates/ability.rb b/lib/generators/cancan/ability/templates/ability.rb index abc1234..def5678 100644 --- a/lib/generators/cancan/ability/templates/ability.rb +++ b/lib/generators/cancan/ability/templates/ability.rb @@ -27,6 +27,6 @@ # can :update, Article, :published => true # # See the wiki for details: - # https://github.com/bryanrite/cancancan/wiki/Defining-Abilities + # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities end end
Update to reflect the correct URL
diff --git a/script/read_mbox.rb b/script/read_mbox.rb index abc1234..def5678 100644 --- a/script/read_mbox.rb +++ b/script/read_mbox.rb @@ -0,0 +1,24 @@+message = nil +count = 0 +posts_count = Post.count + +MailingList.transaction do + File.readlines(ARGV[0]).each do |line| + begin + if (line.match(/\AFrom /)) + puts line + MailingListMailer.receive(message) if message.present? + message = '' + count = count + 1 + else + message << line.sub(/^\>From/, 'From') + end + rescue StandardError => e + puts "#{e}: #{line}" + end + end + + puts "Read #{count} messages. Created #{Post.count - posts_count} posts." + + raise(ActiveRecord::Rollback) unless ENV["DOIT"].present? +end
Add quick script to read messages from mbox file
diff --git a/lib/resque/plugins/statsd_metrics/configuration.rb b/lib/resque/plugins/statsd_metrics/configuration.rb index abc1234..def5678 100644 --- a/lib/resque/plugins/statsd_metrics/configuration.rb +++ b/lib/resque/plugins/statsd_metrics/configuration.rb @@ -22,11 +22,10 @@ def configuration @configuration ||= Configuration.new end - end - def self.configure - self.configuration ||= Configuration.new - yield configuration + def configure + yield configuration + end end end end
Simplify .configure method creation in Configuration
diff --git a/features/support/assertions.rb b/features/support/assertions.rb index abc1234..def5678 100644 --- a/features/support/assertions.rb +++ b/features/support/assertions.rb @@ -3,10 +3,25 @@ uri = Addressable::URI.parse(url) current_uri = Addressable::URI.parse(current_url) - assert_equal uri.port, current_uri.port, message assert_equal uri.path, current_uri.path, message - assert_equal uri.query, current_uri.query, message - assert_equal uri.fragment, current_uri.fragment, message + + if uri.port.nil? + assert_nil uri.port, message + else + assert_equal uri.port, current_uri.port, message + end + + if uri.query.nil? + assert_nil uri.query, message + else + assert_equal uri.query, current_uri.query, message + end + + if uri.fragment.nil? + assert_nil uri.fragment, message + else + assert_equal uri.fragment, current_uri.fragment, message + end end def assert_path(path)
Use assert_nil instead of assert_equal if comparing with nil This commit changes the assertions module to use `assert_nil` rather than `assert_equal` if comparing to a nil value, since `assert_equal` no longer works correctly with nil values.
diff --git a/elasticonf.gemspec b/elasticonf.gemspec index abc1234..def5678 100644 --- a/elasticonf.gemspec +++ b/elasticonf.gemspec @@ -19,9 +19,9 @@ s.required_ruby_version = '>= 1.9' - s.add_dependency 'hashie', '~> 2.1.0' + s.add_dependency 'hashie', '>= 2.1.0' s.add_development_dependency 'rake', '~> 10.3.0' s.add_development_dependency 'rspec', '~> 2.14.0' s.add_development_dependency 'yard', '~> 0.8.0' -end+end
Fix version of hashie gem
diff --git a/app/controllers/cart_controller.rb b/app/controllers/cart_controller.rb index abc1234..def5678 100644 --- a/app/controllers/cart_controller.rb +++ b/app/controllers/cart_controller.rb @@ -27,6 +27,8 @@ @current_user.shopping_cart.each do |item| @order.items << item + item.quantity = item.quantity - 1 + item.save! end @order.save!
Decrease item quantity by one per checkout
diff --git a/gem_config.rb b/gem_config.rb index abc1234..def5678 100644 --- a/gem_config.rb +++ b/gem_config.rb @@ -16,6 +16,7 @@ --cache-file= --config-cache --no-create --srcdir= --prefix= --exec-prefix= + --disable-htmldoc -h -V -q -C -n }.join('|') args = []
Allow --disable-htmldoc to pass thru to ./configure
diff --git a/app/controllers/districts_controller.rb b/app/controllers/districts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/districts_controller.rb +++ b/app/controllers/districts_controller.rb @@ -10,57 +10,9 @@ # GET /districts/1 # GET /districts/1.json def show + @schools = @district.schools end - - # GET /districts/new - def new - @district = District.new - end - - # GET /districts/1/edit - def edit - end - - # POST /districts - # POST /districts.json - def create - @district = District.new(district_params) - - respond_to do |format| - if @district.save - format.html { redirect_to @district, notice: 'District was successfully created.' } - format.json { render :show, status: :created, location: @district } - else - format.html { render :new } - format.json { render json: @district.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /districts/1 - # PATCH/PUT /districts/1.json - def update - respond_to do |format| - if @district.update(district_params) - format.html { redirect_to @district, notice: 'District was successfully updated.' } - format.json { render :show, status: :ok, location: @district } - else - format.html { render :edit } - format.json { render json: @district.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /districts/1 - # DELETE /districts/1.json - def destroy - @district.destroy - respond_to do |format| - format.html { redirect_to districts_url, notice: 'District was successfully destroyed.' } - format.json { head :no_content } - end - end - + private # Use callbacks to share common setup or constraints between actions. def set_district
Add schools instance variable to show method, remove new, edit, update, create destroy methods
diff --git a/app/decorators/reservation_decorator.rb b/app/decorators/reservation_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/reservation_decorator.rb +++ b/app/decorators/reservation_decorator.rb @@ -5,7 +5,7 @@ delegate_all def server_name - flag + server.name + (server && (flag + server.name)) || 'Unknown server' end def flag
Deal with servers that have been deleted
diff --git a/app/mailers/subscription_mailer.rb b/app/mailers/subscription_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/subscription_mailer.rb +++ b/app/mailers/subscription_mailer.rb @@ -7,6 +7,6 @@ @offers = Offer.where created_at: subscription.period @wanteds = Wanted.where created_at: subscription.period @subscription = subscription - mail(to: @user.email, subject: "New offers and wanteds on Skillshare.im") + mail(to: @user.email, subject: "New offers and requests on Skillshare.im") end end
Change "wanteds" to "requests" in e-mail.
diff --git a/app/controllers/rails_jwt_auth/invitations_controller.rb b/app/controllers/rails_jwt_auth/invitations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/rails_jwt_auth/invitations_controller.rb +++ b/app/controllers/rails_jwt_auth/invitations_controller.rb @@ -3,6 +3,7 @@ include ParamsHelper include RenderHelper + before_action :authenticate!, only: [:create] before_action :set_user_from_token, only: [:show, :update] # used to verify token @@ -14,7 +15,6 @@ # used to invite a user, if user is invited send new invitation def create - authenticate! user = RailsJwtAuth.model.invite(invitation_create_params) user.errors.empty? ? render_204 : render_422(user.errors.details) end
Move authenticate! from invitation controller to before_action.
diff --git a/app/presenters/manual_presenter.rb b/app/presenters/manual_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/manual_presenter.rb +++ b/app/presenters/manual_presenter.rb @@ -8,11 +8,11 @@ end def title - call.attributes.fetch(:title) + manual.title end def summary - call.attributes.fetch(:summary) + manual.summary end def body
Remove indirection of `title` and `summary` methods The `GovspeakToHTMLRenderer` class delegates `title` and `summary` to the `manual` that is passed in, so we can remove this indirection and call those methods directly.