diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/config/initializers/heroku_keep_alive.rb b/config/initializers/heroku_keep_alive.rb index abc1234..def5678 100644 --- a/config/initializers/heroku_keep_alive.rb +++ b/config/initializers/heroku_keep_alive.rb @@ -0,0 +1,10 @@+require 'rufus/scheduler' +scheduler = Rufus::Scheduler.start_new + +if Rails.env.production? + scheduler.every '10m' do + require "net/http" + require "uri" + Net::HTTP.get_response(URI.parse(ENV["HOSTNAME"])) + end +end
Add keep alive for free heroku hosting
diff --git a/config/initializers/search_controller.rb b/config/initializers/search_controller.rb index abc1234..def5678 100644 --- a/config/initializers/search_controller.rb +++ b/config/initializers/search_controller.rb @@ -1,5 +1,5 @@ # Re-open SearchController to support different institutional search methods. -# We override initialize and extend with the search module via a before +# We override initialize and extend with the search module via a before # filter since we may need params to determine current primary institution. # We can't extend at initialization since we don't have the request # params at that point. @@ -18,8 +18,8 @@ search_module = search_method_module # If we have defined a searcher for the institution # use that instead. - if current_primary_institution and - current_primary_institution.controllers and + if current_primary_institution and + current_primary_institution.controllers and current_primary_institution.controllers["searcher"] search_module = SearchMethods current_primary_institution.controllers["searcher"].split("::").each do |const| @@ -31,4 +31,4 @@ self.extend search_module end end -end+end
Clean up whitespace in the SearchController initializer
diff --git a/test/unit/release/finalizers/rsync_test.rb b/test/unit/release/finalizers/rsync_test.rb index abc1234..def5678 100644 --- a/test/unit/release/finalizers/rsync_test.rb +++ b/test/unit/release/finalizers/rsync_test.rb @@ -0,0 +1,52 @@+require "test_helper" +require "roger/testing/mock_release" + +module Roger + # Test for Roger Rsync finalizer + class RsyncTest < ::Test::Unit::TestCase + include TestConstruct::Helpers + + def setup + @release = Testing::MockRelease.new + + # Create a file to release in the build dir + @release.project.construct.file "build/index.html" + + # Set fixed version + @release.scm.version = "1.0.0" + + # A target dir + @target_path = setup_construct(chdir: false) + end + + # called after every single test + def teardown + teardown_construct(@target_path) + @release.destroy + @release = nil + end + + def test_basic_functionality + finalizer = Roger::Release::Finalizers::Rsync.new( + remote_path: @target_path.to_s, + ask: false + ) + + finalizer.call(@release) + + assert File.exist?(@target_path + "index.html"), @release.target_path.inspect + end + + def test_rsync_command_works + finalizer = Roger::Release::Finalizers::Rsync.new( + rsync: "rsync-0123456789", # Let's hope nobody actually has this command + remote_path: @target_path.to_s, + ask: false + ) + + assert_raise(RuntimeError) do + finalizer.call(@release) + end + end + end +end
Add tests for rsync finalizer
diff --git a/lib/platform/tasks/ci.rake b/lib/platform/tasks/ci.rake index abc1234..def5678 100644 --- a/lib/platform/tasks/ci.rake +++ b/lib/platform/tasks/ci.rake @@ -2,19 +2,19 @@ desc 'Setup and run rspec' task :rspec do - %x{ + system ''' mkdir -p spec/reports mkdir -p coverage/rcov COVERAGE=true bundle exec rspec -r `bundle show ci_reporter`/lib/ci/reporter/rake/rspec_loader.rb -f CI::Reporter::RSpec spec - } + ''' end desc 'Setup and run cucumber' task :cucumber do - %x{ + system ''' mkdir -p features/reports COVERAGE=true bundle exec cucumber --format html --out features/reports/features.html --format junit --out features/reports - } + ''' end end
Use system instead of %x{} so we see all the output. Helpful for Jenkins.
diff --git a/lib/tasks/sample_data.rake b/lib/tasks/sample_data.rake index abc1234..def5678 100644 --- a/lib/tasks/sample_data.rake +++ b/lib/tasks/sample_data.rake @@ -0,0 +1,9 @@+namespace :db do + desc "Fill the database with sample data" + task populate: :environment do + Bike.create!(name: "Mountain Bike") + Bike.create!(name: "Road Bike") + Bike.create!(name: "Hybrid") + Bike.create!(name: "Cross") + end +end
Add rake task for populating sample bikes
diff --git a/lib/tracker-git/project.rb b/lib/tracker-git/project.rb index abc1234..def5678 100644 --- a/lib/tracker-git/project.rb +++ b/lib/tracker-git/project.rb @@ -22,7 +22,7 @@ end def add_label(story, label) - labels = story.labels.split(",") || [] + labels = (story.labels || "").split(",") labels << label story.update(labels: labels.join(",")) end
Fix code when label is empty
diff --git a/lib/eye/patch/capistrano3.rb b/lib/eye/patch/capistrano3.rb index abc1234..def5678 100644 --- a/lib/eye/patch/capistrano3.rb +++ b/lib/eye/patch/capistrano3.rb @@ -38,8 +38,6 @@ end if fetch(:eye_default_hooks, true) - after "deploy:stop", "eye:stop" - after "deploy:start", "eye:load_config" after "deploy:publishing", "deploy:restart" namespace :deploy do
Remove obsolete hooks for Capistrano 3 integration
diff --git a/lib/salesforce_bulk/batch.rb b/lib/salesforce_bulk/batch.rb index abc1234..def5678 100644 --- a/lib/salesforce_bulk/batch.rb +++ b/lib/salesforce_bulk/batch.rb @@ -33,7 +33,7 @@ end def state?(value) - !self.state.nil? && self.state.casecmp(value) == 0 + self.state.present? && self.state.casecmp(value) == 0 end end end
Update state? method to use present? internally. All tests passing.
diff --git a/homebrew/dvm.rb b/homebrew/dvm.rb index abc1234..def5678 100644 --- a/homebrew/dvm.rb +++ b/homebrew/dvm.rb @@ -2,8 +2,8 @@ class Dvm < Formula homepage 'http://fnichol.github.io/dvm' - url 'https://github.com/fnichol/dvm/archive/v0.1.0.tar.gz' - sha1 '55562579262edfb1aca6a96568e561e362b4d96b' + url 'https://github.com/fnichol/dvm/archive/v0.2.0.tar.gz' + sha1 '509203b626f4b999418c15391f38c658a16d982c' head 'https://github.com/fnichol/dvm.git'
Update homebrew formula for 0.2.0.
diff --git a/app/models/guest_device.rb b/app/models/guest_device.rb index abc1234..def5678 100644 --- a/app/models/guest_device.rb +++ b/app/models/guest_device.rb @@ -15,6 +15,8 @@ has_many :firmwares, :dependent => :destroy has_many :child_devices, -> { where(:parent_device_id => ids) }, :foreign_key => "parent_device_id", :class_name => "GuestDevice", :dependent => :destroy + alias_attribute :name, :device_name + def self.with_ethernet_type where(:device_type => "ethernet") end
Create an alias attribute for device_name to resolve guest device page error
diff --git a/spec/broadcast_spec.rb b/spec/broadcast_spec.rb index abc1234..def5678 100644 --- a/spec/broadcast_spec.rb +++ b/spec/broadcast_spec.rb @@ -0,0 +1,37 @@+require File.expand_path("./helper", File.dirname(__FILE__)) + +describe 'Broadcast' do + context 'search' do + before(:all) do + @gs = Grooveshark::Client.new + end + + it 'should return array of broadcasts of size 10' do + @top_broadcasts = @gs.top_broadcasts(10) + @top_broadcasts.should be_a_kind_of Array + @top_broadcasts.size.should == 10 + end + it 'should be a Broadcast' do + @top_broadcasts = @gs.top_broadcasts(1) + @top_broadcast = @top_broadcasts[0] + @top_broadcast.should be_a_kind_of Grooveshark::Broadcast + end + end + + context 'attributes' do + before(:all) do + @gs = Grooveshark::Client.new + @top_broadcast = @gs.top_broadcasts(1)[0] + end + + it 'should have a valid id' do + @top_broadcast.id.should match /^[abcdef\d]{24}$/i + end + it 'active_song should be a Song' do + @top_broadcast.active_song.should be_a_kind_of Grooveshark::Song + end + it 'next_song should be a Song' do + @top_broadcast.next_song.should be_a_kind_of Grooveshark::Song + end + end +end
Add tests for Broadcast class.
diff --git a/spec/mas_guardfile_spec.rb b/spec/mas_guardfile_spec.rb index abc1234..def5678 100644 --- a/spec/mas_guardfile_spec.rb +++ b/spec/mas_guardfile_spec.rb @@ -14,7 +14,7 @@ end - describe 'When providing as options as sass plugin identifier' do + describe 'When providing an options as sass plugin identifier' do describe 'And MAS provides a defaut config' do it 'only configures that provided plugin' do expect_any_instance_of(Guard::Dsl).to receive(:guard).with('sass', input: 'app/assets/stylesheets', output: 'public/stylesheets')
Fix type in spec desc
diff --git a/spec/support/setup_dirs.rb b/spec/support/setup_dirs.rb index abc1234..def5678 100644 --- a/spec/support/setup_dirs.rb +++ b/spec/support/setup_dirs.rb @@ -1,5 +1,5 @@ dirs = [] dirs << Rails.root.join('public', 'uploads', 'failed_imports') -dirs.each{|dir| Fileutils.mkdir_p dir unless Dir.exist? dir} +dirs.each{|dir| FileUtils.mkdir_p dir unless Dir.exist? dir}
Fix stupid typo in specs support file
diff --git a/spec/todo/item_spec.rb b/spec/todo/item_spec.rb index abc1234..def5678 100644 --- a/spec/todo/item_spec.rb +++ b/spec/todo/item_spec.rb @@ -1,10 +1,14 @@ require 'spec_helper' Todo::Item = Struct.new(:text) do - attr_reader :assignee + attr_reader :assignee, :due_at def assign_to(assignee) @assignee = assignee + end + + def set_deadline(due_date) + @due_at = due_date end def mark_complete @@ -33,4 +37,11 @@ item.assign_to('Rick') expect(item.assignee).to eq('Rick') end + + it 'can be given a due date' do + item = described_class.new('Give deadlines to items') + due_date = Time.now + 1 # same time tomorrow + item.set_deadline(due_date) + expect(item.due_at).to eq(due_date) + end end
Add deadlines to todo items
diff --git a/examples/ask.rb b/examples/ask.rb index abc1234..def5678 100644 --- a/examples/ask.rb +++ b/examples/ask.rb @@ -1,7 +1,11 @@ # frozen_string_literal: true +require "pastel" require_relative "../lib/tty-prompt" prompt = TTY::Prompt.new +pastel = Pastel.new +notice = pastel.cyan.bold.detach -prompt.ask('What is your name?', default: ENV['USER']) +prompt.ask("What is your name?", default: ENV["USER"], + active_color: notice, help_color: notice)
Change example to show color configuration with a callable object
diff --git a/feature/feature_helper.rb b/feature/feature_helper.rb index abc1234..def5678 100644 --- a/feature/feature_helper.rb +++ b/feature/feature_helper.rb @@ -3,7 +3,7 @@ # Add the bin directory, to allow testing of gem executables as if the gem is # already installed. root_dir = RSpec::Core::RubyProject.root -exec_dir = root_dir.join('bin') +exec_dir = File.join(root_dir, 'bin') ENV['PATH'] = [exec_dir, ENV['PATH']].join(File::PATH_SEPARATOR) # Courtesy of:
Fix Rspec version compatibility issue
diff --git a/lib/jsonapi/authorization/resource_policy_authorization.rb b/lib/jsonapi/authorization/resource_policy_authorization.rb index abc1234..def5678 100644 --- a/lib/jsonapi/authorization/resource_policy_authorization.rb +++ b/lib/jsonapi/authorization/resource_policy_authorization.rb @@ -12,7 +12,7 @@ end included do - [:save, :remove].each do |action| + [:remove].each do |action| set_callback action, :before, :authorize end end
Remove authorization on :save callback from resource This should be covered by :create_resource_operation in the operations processor.
diff --git a/server.rb b/server.rb index abc1234..def5678 100644 --- a/server.rb +++ b/server.rb @@ -19,8 +19,13 @@ end def practices_matching(search_term) - SEARCH_INDEX.find(search_term).map { |index, _, _| - PRACTICES.fetch(index) + SEARCH_INDEX.find(search_term).map { |index, matches, weight| + PRACTICES.fetch(index).merge( + score: { + matches: matches, + weight: weight, + }, + ) } end @@ -34,5 +39,5 @@ end content_type :json - practices.to_json + JSON.pretty_generate(practices) end
Add search scores to JSON output Useful during development to see how it's actually coming up with the matches.
diff --git a/db/migrate/20100524151953_move_notes_to_comments_in_students.rb b/db/migrate/20100524151953_move_notes_to_comments_in_students.rb index abc1234..def5678 100644 --- a/db/migrate/20100524151953_move_notes_to_comments_in_students.rb +++ b/db/migrate/20100524151953_move_notes_to_comments_in_students.rb @@ -2,13 +2,13 @@ class Comment < ActiveRecord::Base end - class Student < ActiveRecord::Base + class Person < ActiveRecord::Base end def self.up user = User.first if user - Student.all.each do |student| + Person.all.each do |student| next if student.notes.blank? Comment.create!(:commentable_id => student.id, :commentable_type => "Student", :comment => student.notes, :user_id => user.id) end @@ -18,7 +18,7 @@ def self.down add_column :students, :notes, :text - Student.all.each do |student| + Person.all.each do |student| comments = Comment.find(:all, :conditions => {:commentable_type => "Student", :commentable_id => student.id}, :order => "created_at asc") student.update_attributes :notes => comments.map(&:comment).join("\n\n") comments.each(&:destroy)
Adjust migration to use person instead of student
diff --git a/deployment/puppet/swift/spec/defines/swift_storage_node_spec.rb b/deployment/puppet/swift/spec/defines/swift_storage_node_spec.rb index abc1234..def5678 100644 --- a/deployment/puppet/swift/spec/defines/swift_storage_node_spec.rb +++ b/deployment/puppet/swift/spec/defines/swift_storage_node_spec.rb @@ -1,4 +1,34 @@ describe 'swift::storage::node' do - # this is just for the SAOI - # add tests + + let :facts do + { + :operatingsystem => 'Ubuntu', + :osfamily => 'Debian', + :processorcount => 1, + :concat_basedir => '/var/lib/puppet/concat', + } + end + + let :params do + { + :zone => "1", + :mnt_base_dir => '/srv/node' + } + end + + let :title do + "1" + end + + let :pre_condition do + "class { 'ssh::server::install': } + class { 'swift': swift_hash_suffix => 'foo' } + class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }" + end + + it { + should contain_ring_object_device("127.0.0.1:6010/1") + should contain_ring_container_device("127.0.0.1:6011/1") + should contain_ring_account_device("127.0.0.1:6012/1") + } end
Implement basic spec test for swift::storage::node
diff --git a/test/unit/integrations/universal/universal_return_test.rb b/test/unit/integrations/universal/universal_return_test.rb index abc1234..def5678 100644 --- a/test/unit/integrations/universal/universal_return_test.rb +++ b/test/unit/integrations/universal/universal_return_test.rb @@ -18,6 +18,11 @@ assert !@return.success? end + def test_success_after_ackowledge + assert @return.notification.acknowledge + assert @return.success? + end + private def query_data
Test success? after acknowledge on return.
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -29,8 +29,10 @@ @active_freddie = @freddies.first['id'] if @active_freddie != old_freddie - # Send notification e.g. "New Freddie!" + send_notification # Send notification through Mailgun update_freddie(@active_freddie) + else + p "No new Freddie yet" end end
Send notification when there's a new Freddie
diff --git a/rpn.rb b/rpn.rb index abc1234..def5678 100644 --- a/rpn.rb +++ b/rpn.rb @@ -6,29 +6,29 @@ processor = Processor.new -puts "#{GREEN_TEXT}RPN Calculator, ©2014, Phil Runninger #{CYAN_TEXT}======================= Enter ? for help." -print "#{GREEN_TEXT} » #{RESET_COLORS}" +puts "#{TITLE_COLOR}RPN Calculator, ©2014, Phil Runninger #{HIGHLIGHT_COLOR}======================= Enter ? for help." +print "#{TITLE_COLOR} » #{RESET_COLORS}" input = gets.chomp while input > '' begin - processor.execute input + answer = processor.execute(input) rescue Exception => msg - puts "#{RED_TEXT}#{msg}" + answer = nil + puts "#{ERROR_COLOR}#{msg}" end - processor.stack.each{|val| - print "#{GRAY_TEXT} #{val % 1 == 0 ? val.round : val} " - } - - print "#{GREEN_TEXT}» #{RESET_COLORS}" + processor.memories.each{|name, value| print "#{RESET_COLORS} #{name}=#{value % 1 == 0 ? value.round : value} " } + print "#{TITLE_COLOR}|" if processor.memories != {} + processor.stack.each{|value| print "#{HELP_TEXT} #{value % 1 == 0 ? value.round : value} " } + print "#{TITLE_COLOR}» #{RESET_COLORS}" input = gets.chomp end -puts "#{CYAN_TEXT}========================================================= Thanks for using rpn.#{RESET_COLORS}" -answer = processor.stack.last +puts "#{HIGHLIGHT_COLOR}========================================================= Thanks for using rpn.#{RESET_COLORS}" if !answer.nil? answer = (answer % 1 == 0 ? answer.round : answer) Clipboard.copy answer.to_s - puts " #{GRAY_TEXT}#{answer} #{RESET_COLORS}was copied to the clipboard." + puts " #{HELP_TEXT}#{answer} #{RESET_COLORS}was copied to the clipboard." end puts " " +sleep 1
Use app-specific color constants. Use result of execute method instead of rereading the stack.
diff --git a/themes.gemspec b/themes.gemspec index abc1234..def5678 100644 --- a/themes.gemspec +++ b/themes.gemspec @@ -18,7 +18,7 @@ s.test_files = Dir["spec/**/*"] s.license = 'MIT' - s.add_dependency "rails" + s.add_dependency "rails", ">= 3.2" s.add_development_dependency "sqlite3" s.add_development_dependency "generator_spec"
Make tests work from Rails 3.2 to 5.2
diff --git a/db/migrate/20110705151648_add_council_contacts_index_on_area_id_and_deleted.rb b/db/migrate/20110705151648_add_council_contacts_index_on_area_id_and_deleted.rb index abc1234..def5678 100644 --- a/db/migrate/20110705151648_add_council_contacts_index_on_area_id_and_deleted.rb +++ b/db/migrate/20110705151648_add_council_contacts_index_on_area_id_and_deleted.rb @@ -0,0 +1,9 @@+class AddCouncilContactsIndexOnAreaIdAndDeleted < ActiveRecord::Migration + def self.up + add_index :council_contacts, [:area_id, :deleted], :name => 'index_council_contacts_on_area_id_and_deleted' + end + + def self.down + remove_index :council_contacts, "area_id_and_deleted" + end +end
Add index on council contact area and deleted.
diff --git a/recipes/_source_han_code_jp_fonts.rb b/recipes/_source_han_code_jp_fonts.rb index abc1234..def5678 100644 --- a/recipes/_source_han_code_jp_fonts.rb +++ b/recipes/_source_han_code_jp_fonts.rb @@ -22,5 +22,5 @@ fc-cache -fv COMMAND - not_if 'ls #{install_dir} | grep SourceHanCodeJP' + not_if "ls #{install_dir} | grep SourceHanCodeJP" end
:bug: Fix fonts install skipping issue not_if condition isn't correct.
diff --git a/app/helpers/application_helper/toolbar/miq_alert_center.rb b/app/helpers/application_helper/toolbar/miq_alert_center.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper/toolbar/miq_alert_center.rb +++ b/app/helpers/application_helper/toolbar/miq_alert_center.rb @@ -25,7 +25,8 @@ t = N_('Delete this Alert'), t, :url_parms => "main_div", - :confirm => N_("Are you sure you want to delete this Alert?")), + :confirm => N_("Are you sure you want to delete this Alert?"), + :klass => ApplicationHelper::Button::MiqActionDelete), ] ), ])
Add button class to toolbar
diff --git a/app/controllers/spree/adyen_notifications_controller.rb b/app/controllers/spree/adyen_notifications_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/adyen_notifications_controller.rb +++ b/app/controllers/spree/adyen_notifications_controller.rb @@ -19,7 +19,7 @@ # Enable HTTP basic authentication def authenticate authenticate_or_request_with_http_basic do |username, password| - username == ENV['ADYEN_NOTIFY_USER'] && password == ['ADYEN_NOTIFY_PASSWD'] + username == ENV['ADYEN_NOTIFY_USER'] && password == ENV['ADYEN_NOTIFY_PASSWD'] end end end
Fix ENV var check in http basic auth
diff --git a/app/substitution_helper.rb b/app/substitution_helper.rb index abc1234..def5678 100644 --- a/app/substitution_helper.rb +++ b/app/substitution_helper.rb @@ -1,4 +1,12 @@ module SubstitutionHelper + SUBSTITUTABLE_DOCUMENT_TYPES = %w( + coming_soon + gone + redirect + unpublishing + special_route + ).freeze + class << self def clear!( new_item_document_type:, @@ -39,7 +47,7 @@ private def substitute?(document_type) - %w(coming_soon gone redirect unpublishing special_route).include?(document_type) + SUBSTITUTABLE_DOCUMENT_TYPES.include?(document_type) end end
Make the substitutable document types accessible As the SubstitutionHelper is involved in publishing content, to work out if a draft can be published, you need to know what the substitutable document types are.
diff --git a/spec/tic_tac_toe/game_spec.rb b/spec/tic_tac_toe/game_spec.rb index abc1234..def5678 100644 --- a/spec/tic_tac_toe/game_spec.rb +++ b/spec/tic_tac_toe/game_spec.rb @@ -5,17 +5,15 @@ describe TicTacToe::Game do let(:display) { double(:display) } + let(:game) { TicTacToe::Game.new display } it 'can start a game' do allow(display).to receive(:printf) - game = TicTacToe::Game.new display game.start end describe 'when playing' do it 'changes the active player' do - game = TicTacToe::Game.new display - expect { game.do_turn }.to change { game.to_play } end end
Add a let for the game object
diff --git a/spec/aruba/runtime_spec.rb b/spec/aruba/runtime_spec.rb index abc1234..def5678 100644 --- a/spec/aruba/runtime_spec.rb +++ b/spec/aruba/runtime_spec.rb @@ -1,47 +1,33 @@ require 'spec_helper' RSpec.describe Aruba::Runtime do + include_context 'uses aruba API' + describe '#fixtures_directory' do - let(:api) do - klass = Class.new do - include Aruba::Api - - def root_directory - expand_path('.') - end - end - - klass.new + let(:runtime) do + @aruba.aruba end context 'when no fixtures directories exist' do + before do + runtime.config.fixtures_directories = ['not-there', 'not/here', 'does/not/exist'] + end + it 'raises exception' do - expect { api.fixtures_directory }.to raise_error + expect { runtime.fixtures_directory } + .to raise_error RuntimeError, /No existing fixtures directory found/ end end - context 'when "/features/fixtures"-directory exist' do - it { - pending('These tests need fixing and classifying') - api.create_directory('features/fixtures') - expect(api.fixtures_directory).to eq expand_path('features/fixtures') - } - end + context 'when one of the configures fixture directories exists' do + before do + runtime.config.fixtures_directories = ['not-there', 'fixtures', 'does/not/exist'] + end - context 'when "/spec/fixtures"-directory exist' do - it { - pending('These tests need fixing and classifying') - api.create_directory('spec/fixtures') - expect(api.fixtures_directory).to eq expand_path('spec/fixtures') - } - end - - context 'when "/test/fixtures"-directory exist' do - it { - pending('These tests need fixing and classifying') - api.create_directory('test/fixtures') - expect(api.fixtures_directory.to_s).to eq expand_path('test/fixtures') - } + it 'returns that directory' do + expect(runtime.fixtures_directory.to_s).to eq File.expand_path('fixtures', + runtime.root_directory) + end end end end
Make Aruba::Runtime specs test something
diff --git a/spec/route_loading_spec.rb b/spec/route_loading_spec.rb index abc1234..def5678 100644 --- a/spec/route_loading_spec.rb +++ b/spec/route_loading_spec.rb @@ -0,0 +1,37 @@+require "spec_helper" + +describe "loading routes from the db" do + start_backend_around_all :port => 3160, :identifier => "backend 1" + start_backend_around_all :port => 3161, :identifier => "backend 2" + + before :each do + add_backend("backend-1", "http://localhost:3160/") + add_backend("backend-2", "http://localhost:3161/") + end + + context "a route with a non-existent backend" do + before :each do + add_route("/foo", "backend-1") + add_route("/bar", "backend-bar") + add_route("/baz", "backend-2") + add_route("/qux", "backend-1") + reload_routes + end + + it "should skip the invalid route" do + response = router_request("/bar") + expect(response.code).to eq(404) + end + + it "should continue to load other routes" do + response = router_request("/foo") + expect(response).to have_response_body("backend 1") + + response = router_request("/baz") + expect(response).to have_response_body("backend 2") + + response = router_request("/qux") + expect(response).to have_response_body("backend 1") + end + end +end
Add tests around route loading functionality
diff --git a/spec/unit/downtime_spec.rb b/spec/unit/downtime_spec.rb index abc1234..def5678 100644 --- a/spec/unit/downtime_spec.rb +++ b/spec/unit/downtime_spec.rb @@ -1,7 +1,12 @@ require 'spec_helper' -class DowntimeTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end +describe Downtime do + + before :each do + load "#{Rails.root}/db/seeds.rb" + end + + it "should process downtimes" do + end + end
Add stub for downtime unit tests
diff --git a/tasks/common.rb b/tasks/common.rb index abc1234..def5678 100644 --- a/tasks/common.rb +++ b/tasks/common.rb @@ -14,7 +14,8 @@ PROVIDER_FOLDERS = { ansible: 'build/ansible', puppet: 'build/puppet/%s', - chef: 'build/chef/%s' + chef: 'build/chef/%s', + terraform: 'build/terraform' }.freeze # Give a list of all providers served by MM
Add terraform as Rake target. Enables build of Terraform by: rake compile:terraform Change-Id: Ib9dac46d4cf6a8e3446d9aab6da29019f0335f38
diff --git a/irc2hipchat.god b/irc2hipchat.god index abc1234..def5678 100644 --- a/irc2hipchat.god +++ b/irc2hipchat.god @@ -6,6 +6,8 @@ God.watch do |w| w.name = 'irc2hipchat' - w.start = 'bundle exec ruby irc2hipchat.rb' + w.start = "bundle exec ruby irc2hipchat.rb" + w.dir = `pwd`.chomp + w.keepalive end
Set working directory to pwd
diff --git a/section02/lesson03/blueberry_hill.rb b/section02/lesson03/blueberry_hill.rb index abc1234..def5678 100644 --- a/section02/lesson03/blueberry_hill.rb +++ b/section02/lesson03/blueberry_hill.rb @@ -0,0 +1,61 @@+# Section 2, Lesson 3 - Rhythm 3 - Blueberry Hill Rhythm +# FIXME: The timing is a bit off here... +# not sure how to accurately do 12/8 time +require "#{Dir.home}/ruby/pianoforall/utilities" +use_synth :piano + +def blueberry_hill_treble(note, quality = :major) + 4.times do + 3.times do + play chord(note, quality), amp: 1.5 + sleep CROTCHET + end + sleep QUAVER / 6 + end +end + +def blueberry_hill_bass(note, quality = :major) + bass_chord = chord(note, quality).to_a + pattern = bass_chord << bass_chord[1] << bass_chord[2] + play_pattern_timed( + pattern, + [ + SEMIBREVE + (QUAVER * 2), + CROTCHET, + MINIM + (QUAVER * 2), + MINIM, + CROTCHET + ], + amp: 1.5 + ) +end + +in_thread(name: :right_hand) do + 2.times do + blueberry_hill_treble(:C4) + end + 2.times do + blueberry_hill_treble(:F4) + end + 2.times do + blueberry_hill_treble(:C4) + end + blueberry_hill_treble(:G4) + blueberry_hill_treble(:F4) + blueberry_hill_treble(:C4) +end + +in_thread(name: :left_hand) do + 2.times do + blueberry_hill_bass(:C2) + end + 2.times do + blueberry_hill_bass(:F2) + end + 2.times do + blueberry_hill_bass(:C2) + end + blueberry_hill_bass(:G2) + blueberry_hill_bass(:F2) + blueberry_hill_bass(:C2) +end
Put in attempt at Blueberry Hill, but the timing seems a bit off at the moment
diff --git a/lib/generators/my_zipcode_gem/templates/county_model.rb b/lib/generators/my_zipcode_gem/templates/county_model.rb index abc1234..def5678 100644 --- a/lib/generators/my_zipcode_gem/templates/county_model.rb +++ b/lib/generators/my_zipcode_gem/templates/county_model.rb @@ -8,8 +8,16 @@ validates :name, uniqueness: { scope: :state_id, case_sensitive: false }, presence: true - scope :without_zipcodes, -> { joins("LEFT JOIN zipcodes ON zipcodes.county_id = counties.id").where("zipcodes.county_id IS NULL") } - scope :without_state, -> { where("state_id IS NULL") } + scope :without_zipcodes, -> { + county = County.arel_table + zipcodes = Zipcode.arel_table + zipjoin = county.join(zipcodes, Arel::Nodes::OuterJoin) + .on(zipcodes[:county_id].eq(county[:id])) + joins(zipjoin.join_sources).where(zipcodes[:county_id].eq(nil)) + } + scope :without_state, -> { + where(state_id: nil) + } def cities zipcodes.map(&:city).sort.uniq
Convert raw SQL to Arel
diff --git a/auto_js.gemspec b/auto_js.gemspec index abc1234..def5678 100644 --- a/auto_js.gemspec +++ b/auto_js.gemspec @@ -1,12 +1,12 @@ Gem::Specification.new do |s| s.name = 'auto_js' - s.version = '0.9.0' + s.version = '0.9.1' s.date = '2015-03-20' s.summary = "Auto-executes javascript based on current view" - s.description = "Easily organizes a project's custom javascript and executes appropriate snippits automatically. Turbolinks compatible." + s.description = "Easily organizes a project's custom javascript and executes appropriate snippits automatically. Turbolinks compatible. Fills the gap between rails default javascript management and a full front end framework." s.authors = ["Daniel Fuller"] s.email = 'lasaldan@gmail.com' s.files = ["app/assets/javascripts/auto_js.coffee"] - s.homepage = 'http://rubygems.org/gems/auto_js' + s.homepage = 'https://github.com/lasaldan/auto_js' s.license = 'MIT' end
Update gemspec with a few more details
diff --git a/jquery_mobile_rails.gemspec b/jquery_mobile_rails.gemspec index abc1234..def5678 100644 --- a/jquery_mobile_rails.gemspec +++ b/jquery_mobile_rails.gemspec @@ -14,7 +14,7 @@ s.description = "JQuery Mobile files for Rails' assets pipeline" s.license = 'MIT' - s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] + s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"] s.test_files = Dir["test/**/*"] s.add_dependency "railties", ">= 3.1.0"
Fix gemspec to point to new README format
diff --git a/spec/scss_lint/linter/disable_linter_reason_spec.rb b/spec/scss_lint/linter/disable_linter_reason_spec.rb index abc1234..def5678 100644 --- a/spec/scss_lint/linter/disable_linter_reason_spec.rb +++ b/spec/scss_lint/linter/disable_linter_reason_spec.rb @@ -47,4 +47,17 @@ it { should_not report_lint } end + + context 'when no reason precedes an enabling comment' do + let(:scss) { <<-SCSS } + // Disable for now + // scss-lint:disable BorderZero + p { + border: none; + } + // scss-lint:enable BorderZero + SCSS + + it { should_not report_lint } + end end
Add spec ensuring only disables are checked We only want to enforce reasons for disabling of a linter, since when disabling over a range you don't want to have to justify both control comments.
diff --git a/lib/blocktrain/train_crowding.rb b/lib/blocktrain/train_crowding.rb index abc1234..def5678 100644 --- a/lib/blocktrain/train_crowding.rb +++ b/lib/blocktrain/train_crowding.rb @@ -1,6 +1,7 @@ module Blocktrain class TrainCrowding CAR_LOADS = %w[2E64930W 2E64932W 2E64934W 2E64936W] + CAR_NAMES = %w[CAR_A CAR_B CAR_C CAR_D] def initialize(from, to) @atp_query = ATPQuery.new(from: from, to: to) @@ -14,5 +15,22 @@ [location['_source'], load_query] end end + + def output + results.each do |location, crowd_info| + crowd = crowd_info.results + info = crowd['results']['buckets'].map do |car_mem_addr, bucket| + name = CAR_NAMES[CAR_LOADS.index(car_mem_addr)] + full = bucket['results']['buckets'][0]['average_value']['value'] rescue nil + [name, "%.2f" % full.to_f] + end + puts [ + location['timeStamp'].ljust(25), + location['value'], + *info + ].join("\t") + end + nil + end end end
Print carriage crowding information like the 80’s
diff --git a/spec/controllers/application_controller/advanced_search_spec.rb b/spec/controllers/application_controller/advanced_search_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/application_controller/advanced_search_spec.rb +++ b/spec/controllers/application_controller/advanced_search_spec.rb @@ -1,11 +1,11 @@ describe ProviderForemanController, "::AdvancedSearch" do - before :each do + before do stub_user(:features => :all) controller.instance_variable_set(:@sb, {}) end describe "#adv_search_redraw_left_div" do - before :each do + before do controller.instance_variable_set(:@sb, :active_tree => :configuration_manager_cs_filter_tree) end @@ -17,3 +17,45 @@ end end end + +describe StorageController, "::AdvancedSearch" do + describe '#adv_search_build' do + let(:edit) { nil } + let(:model) { "Storage" } + let(:s) { {} } + let(:sandbox) { {} } + + before do + allow(controller).to receive(:exp_build_table).and_call_original + allow(controller).to receive(:session).and_return(s) + + controller.instance_variable_set(:@edit, edit) + controller.instance_variable_set(:@expkey, {}) + controller.instance_variable_set(:@sb, sandbox) + end + + subject { controller.instance_variable_get(:@edit)[controller.instance_variable_get(:@expkey)][:exp_table] } + + context 'when session[:adv_search] is set, after using Advanced Search' do + let(:expr) { ApplicationController::Filter::Expression.new.tap { |e| e.expression = {"???" => "???"} } } + let(:s) { {:adv_search => {model => {:expression => expr}}} } + + context 'tagging action' do + let(:edit) { {:new => {}} } + let(:sandbox) { {:action => "tag"} } + + it 'sets @edit[@expkey] properly' do + controller.send(:adv_search_build, model) + expect(subject).not_to be_nil + end + end + + context 'not tagging action' do + it 'sets @edit[@expkey] properly' do + controller.send(:adv_search_build, model) + expect(subject).not_to be_nil + end + end + end + end +end
Add spec test for fix of broken tagging in Datastores and My Services
diff --git a/user_api/com/mdi/storage/collection_definitions_mapping.rb b/user_api/com/mdi/storage/collection_definitions_mapping.rb index abc1234..def5678 100644 --- a/user_api/com/mdi/storage/collection_definitions_mapping.rb +++ b/user_api/com/mdi/storage/collection_definitions_mapping.rb @@ -21,9 +21,20 @@ # return a collection definition structs array def get_all() - RagentApi::CollectionDefinitionMapping.get_all(user_api.account) + @all_definitions ||= RagentApi::CollectionDefinitionMapping.get_all(user_api.account) end + def get_for_asset_with_type(imei, type) + asset_definitions = [] + definitions = self.get_all() + + definitions.each do |definition| + if (definition.assets == [] || definition.assets.include? imei) && definition.collects.include? type + asset_definitions << definition + end + end + asset_definitions + end end end #Storage
Add method to get definitions for an asset
diff --git a/test/io_test.rb b/test/io_test.rb index abc1234..def5678 100644 --- a/test/io_test.rb +++ b/test/io_test.rb @@ -0,0 +1,35 @@+require_relative 'test_helper' + +# Trivial IO test class +# Behavior is not really tested, as call is forwarded to File class +class IOTest < Minitest::Test + def test_method_IO_read_works + ::FakeFS.activate!(io_mocks: true) + ::File.write('foo', 'bar') + + assert_equal 'bar', ::IO.read('foo') + + ::FakeFS.deactivate! + refute ::File.exist?('foo') + end + + def test_method_IO_write_works + ::FakeFS.activate!(io_mocks: true) + ::IO.write('foo', 'bar') + + assert_equal 'bar', ::File.read('foo') + + ::FakeFS.deactivate! + refute ::File.exist?('foo') + end + + def test_method_IO_binread_works + ::FakeFS.activate!(io_mocks: true) + ::File.write('foo', 'bar') + + assert_equal 'bar', ::IO.binread('foo') + + ::FakeFS.deactivate! + refute ::File.exist?('foo') + end +end
Add non-regression test for IO mocks
diff --git a/hector.gemspec b/hector.gemspec index abc1234..def5678 100644 --- a/hector.gemspec +++ b/hector.gemspec @@ -2,8 +2,8 @@ s.name = "hector" s.version = "1.0.7" s.platform = Gem::Platform::RUBY - s.authors = ["Sam Stephenson"] - s.email = ["sstephenson@gmail.com"] + s.authors = ["Sam Stephenson", "Ross Paffett"] + s.email = ["sstephenson@gmail.com", "ross@rosspaffett.com"] s.homepage = "http://github.com/sstephenson/hector" s.summary = "Private group chat server" s.description = "A private group chat server for people you trust. Implements a limited subset of the IRC protocol."
Add Ross Paffett as a gem author Sam says that I am special now
diff --git a/lib/mc-schematic/array_helper.rb b/lib/mc-schematic/array_helper.rb index abc1234..def5678 100644 --- a/lib/mc-schematic/array_helper.rb +++ b/lib/mc-schematic/array_helper.rb @@ -16,5 +16,27 @@ end blocks end + # Gets the 'surface' of a multidimensional array + def get_surface(data) + blocks = [] + for y in 0..(data.length - 1) + for x in 0..(data[y].length - 1) do + for z in 0..(data[y][x].length - 1) do + block = data[y][x][z] + if y == 0 + blocks[x] = [] if blocks[x] == nil + blocks[x][z] = block + next + end + if block != 0 + blocks[x] = [] if blocks[x] == nil + blocks[x][z] = block + end + end + end + end + blocks + end + end end
Add array helper for getting surface
diff --git a/lib/rails5/spec_converter/cli.rb b/lib/rails5/spec_converter/cli.rb index abc1234..def5678 100644 --- a/lib/rails5/spec_converter/cli.rb +++ b/lib/rails5/spec_converter/cli.rb @@ -1,4 +1,5 @@ require 'rails5/spec_converter/text_transformer' +require 'rails5/spec_converter/version' require 'optparse' module Rails5 @@ -8,6 +9,11 @@ @options = {} OptionParser.new do |opts| opts.banner = "Usage: rails5-spec-converter [options] [files]" + + opts.on("--version", "Print version number") do |q| + puts Rails5::SpecConverter::VERSION + exit + end opts.on("-q", "--quiet", "Run quietly") do |q| @options[:quiet] = q
Add --version flag to print the version
diff --git a/lib/rspec/contracts/interface.rb b/lib/rspec/contracts/interface.rb index abc1234..def5678 100644 --- a/lib/rspec/contracts/interface.rb +++ b/lib/rspec/contracts/interface.rb @@ -11,27 +11,19 @@ end def add_requirement(method_name, options = {}) - Interface.add_requirement Interaction.new(name, method_name, options) + Interface.requirements.add Interaction.new(name, method_name, options) end def add_implementation(method_name, options = {}) - Interface.add_implementation Interaction.new(name, method_name, options) + Interface.implementations.add Interaction.new(name, method_name, options) end def self.implementations @implementations ||= InteractionGroup.new end - def self.add_implementation(interaction) - implementations.add interaction - end - def self.requirements @requrements ||= InteractionGroup.new - end - - def self.add_requirement(interaction) - requirements.add interaction end end end
Simplify collection management in Interface
diff --git a/lib/camayoc.rb b/lib/camayoc.rb index abc1234..def5678 100644 --- a/lib/camayoc.rb +++ b/lib/camayoc.rb @@ -5,6 +5,7 @@ require 'camayoc/handlers/filter' require 'camayoc/handlers/io' require 'camayoc/handlers/memory' +require 'camayoc/handlers/statsd' require 'camayoc/stats' module Camayoc
Load the statsd handler by default without another require
diff --git a/lib/travis/build/addons/hosts.rb b/lib/travis/build/addons/hosts.rb index abc1234..def5678 100644 --- a/lib/travis/build/addons/hosts.rb +++ b/lib/travis/build/addons/hosts.rb @@ -13,6 +13,7 @@ sh.fold 'hosts.before' do sh.echo "" sh.cmd "cat #{HOSTS_FILE}" + sh.echo "" end sh.fold 'hosts' do sh.cmd "sed -e 's/^\\(127\\.0\\.0\\.1.*\\)$/\\1 #{hosts}/' #{HOSTS_FILE} > #{TEMP_HOSTS_FILE}" @@ -21,6 +22,7 @@ sh.fold 'hosts.after' do sh.echo "" sh.cmd "cat #{HOSTS_FILE}" + sh.echo "" end end
Add newline after host file to fix fold
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,7 +14,7 @@ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' + config.time_zone = 'Eastern Time (US & Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
Use US East timezone as default - at least for the moment.
diff --git a/Casks/kindle.rb b/Casks/kindle.rb index abc1234..def5678 100644 --- a/Casks/kindle.rb +++ b/Casks/kindle.rb @@ -7,7 +7,7 @@ homepage 'https://www.amazon.com/gp/digital/fiona/kcp-landing-page' license :gratis - app 'Kindle.App' + app 'Kindle.app' zap :delete => [ '~/Library/Preferences/com.amazon.Kindle.plist',
Fix for case-sensitive systems in Kindle Cask
diff --git a/spec/factories/songs.rb b/spec/factories/songs.rb index abc1234..def5678 100644 --- a/spec/factories/songs.rb +++ b/spec/factories/songs.rb @@ -7,6 +7,14 @@ status :closed youtube_id 'https://www.youtube.com/watch?v=2TL90rxt9bo' comment 'アンプラグドのテーマソングです' + + transient do + user nil + end + + after(:create) do |song, evaluator| + create(:playing, song: song, user: evaluator.user) if evaluator.user + end end factory :playing do
Enable to create a song with a user by the factory
diff --git a/spec/ffi/string_spec.rb b/spec/ffi/string_spec.rb index abc1234..def5678 100644 --- a/spec/ffi/string_spec.rb +++ b/spec/ffi/string_spec.rb @@ -22,6 +22,10 @@ str.should == "test" str.tainted?.should == true end + it "Poison null byte raises error" do + s = "123\0abc" + lambda { LibTest.string_equals(s, s) }.should raise_error + end it "Tainted String parameter should throw a SecurityError" do $SAFE = 1 str = "test"
Add poison null byte spec
diff --git a/spec/lib/config_spec.rb b/spec/lib/config_spec.rb index abc1234..def5678 100644 --- a/spec/lib/config_spec.rb +++ b/spec/lib/config_spec.rb @@ -7,9 +7,7 @@ its('github.user') { should be_nil } its('github.token') { should be_nil } - context 'with a config file' do - include_context 'init anvil config' - + context 'with a config file', config: true do its('github.user') { should eq('dummy_user') } its('github.token') { should eq('dummy_token') } end
Use rspec metadata to load context
diff --git a/lib/facterdb.rb b/lib/facterdb.rb index abc1234..def5678 100644 --- a/lib/facterdb.rb +++ b/lib/facterdb.rb @@ -4,9 +4,10 @@ module FacterDB def self.get_os_facts(facter_version='*', filter=[]) + facts_dir = File.expand_path(File.join(File.dirname(__FILE__), '../facts')) filter_str = filter.map { |f| f.map { |k,v | "#{k}=#{v}" }.join(' and ') }.join(' or ') - jsons = Dir.glob("facts/#{facter_version}/*.facts").map { |f| File.read(f) } + jsons = Dir.glob("#{facts_dir}/#{facter_version}/*.facts").map { |f| File.read(f) } json = "[#{jsons.join(',')}]\n" JGrep.jgrep(json, filter_str) end
Use a relative factsdir for the lib
diff --git a/lib/paprika.rb b/lib/paprika.rb index abc1234..def5678 100644 --- a/lib/paprika.rb +++ b/lib/paprika.rb @@ -3,6 +3,8 @@ module Paprika class Tasks < Thor + include Thor::Actions + desc "compile", "Compile sass and haml" def compile Dir["**/*.haml"].each do |file| @@ -27,7 +29,14 @@ desc "pack_extension", "Package your extension - file extension 'crx'" method_option :extension_path, :aliases => "-f", :desc => "Location of the extension's folder" def pack_extension(extension_path) - run "google-chrome --pack-extension=#{extension_path}" + case RUBY_PLATFORM + when /linux/ + run "google-chrome --pack-extension=\"#{extension_path}\"" + when /darwin/ + run "open -a 'Google Chrome' --pack-extension=\"#{extension_path}\"" + else + run "chrome.exe --pack-extension=\"#{extension_path}\"" + end end end end
Improve run the command to package the extension Signed-off-by: Johanna Mantilla Duque <5cd76578dd906d3abcbebcbe5b23d6d7232b4085@gmail.com>
diff --git a/lib/promobox.rb b/lib/promobox.rb index abc1234..def5678 100644 --- a/lib/promobox.rb +++ b/lib/promobox.rb @@ -14,7 +14,7 @@ @api_key = api_key @login = login @password = password - @hash_password = Digest::MD5.hexdigest("#{@password}{#{@api_key}}").unpack('H*').first + @hash_password = Digest::MD5.digest("#{@password}{#{@api_key}}").unpack('H*').first end def coupons(params={}) @@ -25,7 +25,7 @@ def build_query(action, params) ts = Time.now.to_i - token = Base64.encode64(Digest::SHA1.hexdigest("#{@hash_password}#{ts}#{@api_key}")) + token = Base64.encode64(Digest::SHA1.digest("#{@hash_password}#{ts}#{@api_key}")) query = { ts: ts.to_s, login: @login,
Use digest instead of hexdigest API doc use $raw_output = true for md5 and sha1 functions
diff --git a/linked_list.rb b/linked_list.rb index abc1234..def5678 100644 --- a/linked_list.rb +++ b/linked_list.rb @@ -0,0 +1,50 @@+class SinlglyLinkedList + def initialize + @head = Node.new(value) + end + + def add(value) + node = Node.new(value) + node.next = @head + @head = node + end + + def remove_front + current = @head + @head = current.next + return current + end + + def remove_back + current = @head + until current.next.next == nil + current = current.next + end + node = current.next + current.next = nil + return node + end + + def find(value) + current = @head + until current.value == value + current = current.next + end + return current + end +end + +class Node + + attr_reader :value + attr_accessor :next + + def initialize(args={}) + @value = args.fetch(:value) + @next = args.fetch(:next, nil) + + @value2 = args.fetch(:value2) + @value3 = args.fetch(:value3) + @value4 = args.fetch(:value4) + end +end
Add singly linked list class
diff --git a/lib/asset_hash/railtie.rb b/lib/asset_hash/railtie.rb index abc1234..def5678 100644 --- a/lib/asset_hash/railtie.rb +++ b/lib/asset_hash/railtie.rb @@ -1,9 +1,12 @@ require 'asset_hash' -require 'rails' -module AssetHash - class Railtie < Rails::Railtie - rake_tasks do - load "tasks/asset_hash.rake" +begin + require 'rails' + module AssetHash + class Railtie < Rails::Railtie + rake_tasks do + load "tasks/asset_hash.rake" + end end end -end+rescue LoadError +end
Allow asset_hash to work with Rails 2.3.x.
diff --git a/lib/classes/purchasing.rb b/lib/classes/purchasing.rb index abc1234..def5678 100644 --- a/lib/classes/purchasing.rb +++ b/lib/classes/purchasing.rb @@ -10,21 +10,21 @@ end role :purchaser do - def has_already_purchased_book? + def owns_book? Purchase.where(purchaser: self, book: book).count > 0 end end trigger :complete_purchase do return false unless purchaser - return false if purchaser.has_already_purchased_book? return false if book.was_written_by_purchaser? + return false if purchaser.owns_book? purchase = Purchase.new(purchaser: purchaser, book: book) purchase.save end trigger :purchaser_owns_book? do - return purchaser.has_already_purchased_book? + return purchaser.owns_book? end end
Rename method to check if purchaser owns book
diff --git a/config/initializers/avalon_lti.rb b/config/initializers/avalon_lti.rb index abc1234..def5678 100644 --- a/config/initializers/avalon_lti.rb +++ b/config/initializers/avalon_lti.rb @@ -5,7 +5,7 @@ module Lti begin Configuration = - YAML.safe_load(ERB.new(File.read(File.expand_path('../../lti.yml', __FILE__))).result) + YAML.load(ERB.new(File.read(File.expand_path('../../lti.yml', __FILE__))).result) rescue Configuration = {} end
Use `YAML.load` instead of `YAML.safe_load` because although Rubocop wants `safe_load`, it doesn't parse symbols (which is what the example `lti.yml` uses).
diff --git a/bosh_cli_plugin_aws/migrations/20130412183544_create_rds_dbs.rb b/bosh_cli_plugin_aws/migrations/20130412183544_create_rds_dbs.rb index abc1234..def5678 100644 --- a/bosh_cli_plugin_aws/migrations/20130412183544_create_rds_dbs.rb +++ b/bosh_cli_plugin_aws/migrations/20130412183544_create_rds_dbs.rb @@ -8,7 +8,7 @@ end vpc_receipt = load_receipt("aws_vpc_receipt") - db_names = %w(ccdb uaadb) + db_names = %w(ccdb uaadb mysql-service-public) db_configs = config['rds'].select {|c| db_names.include?(c['instance']) } RdsDb.aws_rds = rds dbs = []
Revert "Boostrap no longer creates an RDS database for a public mysql offering." This reverts commit ea7a17091d4d5208ad11feb155427ae18022d443. Requires a cross team pair. Also retro-actively changing a migration that has already run is a no-no.
diff --git a/config/initializers/setup_mail.rb b/config/initializers/setup_mail.rb index abc1234..def5678 100644 --- a/config/initializers/setup_mail.rb +++ b/config/initializers/setup_mail.rb @@ -1,9 +1,8 @@ ActionMailer::Base.smtp_settings = { - address: "smtp.gmail.com", - port: 587, - domain: "gmail.com", - user_name: "bugtrackerapplication", - password: ENV["EMAIL_PASSWORD"], - authentication: "plain", - enable_starttls_auto: true + address: "smtp.gmail.com", + port: 587, + domain: "gmail.com", + user_name: ENV["EMAIL_USERNAME"], + password: ENV["EMAIL_PASSWORD"], + authentication: :login }
Fix mail not sending properly in production
diff --git a/joofaq.gemspec b/joofaq.gemspec index abc1234..def5678 100644 --- a/joofaq.gemspec +++ b/joofaq.gemspec @@ -12,6 +12,9 @@ gem.summary = %q{Easily implement dynamic FAQ pages into your rails app} gem.homepage = "https://github.com/joofsh/joofaq" + gem.add_dependency "rdiscount", "1.6.8" + gem.add_dependency "railties", "~> 3.1" + gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
Add rdiscount as gem dependency
diff --git a/db/migrate/20150115013419_organisation_default_string_values.rb b/db/migrate/20150115013419_organisation_default_string_values.rb index abc1234..def5678 100644 --- a/db/migrate/20150115013419_organisation_default_string_values.rb +++ b/db/migrate/20150115013419_organisation_default_string_values.rb @@ -28,8 +28,8 @@ change_column_null(:organisations, attr, true) change_column_default(:proposed_organisation_edits, attr, nil) change_column_null(:proposed_organisation_edits, attr, true) - Organisation.where(attr => "").update_all(attr => nil) - ProposedOrganisationEdit.where(attr => "").update_all(attr => nil) + Organisation.with_deleted.where(attr => "").update_all(attr => nil) + ProposedOrganisationEdit.with_deleted.where(attr => "").update_all(attr => nil) end end end
Change scoping for down migration too
diff --git a/lib/cucumber/rails/world.rb b/lib/cucumber/rails/world.rb index abc1234..def5678 100644 --- a/lib/cucumber/rails/world.rb +++ b/lib/cucumber/rails/world.rb @@ -20,7 +20,7 @@ module Cucumber module Rails - class World < ActionDispatch::IntegrationTest + class World < ::ActionDispatch::IntegrationTest include Rack::Test::Methods if Cucumber::Rails.include_rack_test_helpers? include ActiveSupport::Testing::SetupAndTeardown if ActiveSupport::Testing.const_defined?('SetupAndTeardown')
Resolve NameError occurring in TravisCI The build is failing with multiple occurrences of the following error: `uninitialized constant Cucumber::Rails::ActionDispatch::IntegrationTest (NameError)` Example: https://travis-ci.org/cucumber/cucumber-rails/jobs/650040930 I have also encountered this error when pointing a project at a local build of `cucumber-rails` at `master`. As `IntegrationTest` does not live in the `Cucumber::Rails::ActionDispatch` namespace, this commit makes the change to read `ActionDispatch::IntegrationTest` from the global namespace.
diff --git a/lib/exiv2/shared_methods.rb b/lib/exiv2/shared_methods.rb index abc1234..def5678 100644 --- a/lib/exiv2/shared_methods.rb +++ b/lib/exiv2/shared_methods.rb @@ -23,4 +23,26 @@ end "#<#{self.class.name}: {#{items.join(', ')}}>" end + + def [](key) + self.to_hash[key] + end + + def []=(key, value) + delete_all(key) + if value.is_a?(Array) + value.each do |v| + self.add(key, v) + end + else + self.add(key, value) + end + end + + def delete_all(key) + del = true + while(del) do + del = self.delete(key) + end + end end
Add array accessors and method to set (delete all and add new) tags.
diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -10,19 +10,3 @@ describe service('cloudsight') do it { should be_enabled } end - -describe service('cloudsight') do - it { should be_running } -end - -describe service('tsfim') do - it { should be_running } -end - -describe service('tsauditd') do - it { should be_running } -end - -describe file('/opt/threatstack/cloudsight/config/.secret') do - it { should be_file } -end
Remove serverspec tests that are unable to be tested w/o TS key
diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -0,0 +1,51 @@+require 'serverspec' +require 'pathname' + +include Serverspec::Helper::Exec + +# serverspec's FreeBSD support is craptastic. We'll just make it think +# it's executing on OS X. +if RUBY_PLATFORM =~ /freebsd/ + include Serverspec::Helper::Darwin +else + include Serverspec::Helper::DetectOS +end + +# Ensure omnibus user is created +describe user('omnibus') do + it { should exist } +end + +# Ensure required build dirs exist +describe file('/opt/omnibus') do + it { should be_directory } + it { should be_mode 755 } + it { should be_owned_by 'omnibus' } +end +describe file('/var/cache/omnibus') do + it { should be_directory } + it { should be_mode 755 } + it { should be_owned_by 'omnibus' } +end + +# Ensure rbenv Ruby is linked to /usr/local/bin +describe command('/usr/local/bin/ruby --version') do + it { should return_stdout(/^ruby 1.9.3/) } +end + +# Ensure all rbenv shims are linked to /usr/local/bin +%w{ bundle erb gem irb rake rdoc ri ruby testrb }.each do |shim| + describe file("/usr/local/bin/#{shim}") do + it { should be_linked_to "/opt/rbenv/shims/#{shim}" } + end +end + +# Ensure ccache is installed and linked in +describe file('/usr/local/bin/ccache') do + it { should be_executable } +end +%w{ gcc g++ cc c++ }.each do |compiler| + describe file("/usr/local/bin/#{compiler}") do + it { should be_linked_to '/usr/local/bin/ccache' } + end +end
Add serverspec coverage for the default recipe!
diff --git a/lib/graphql/validation.rb b/lib/graphql/validation.rb index abc1234..def5678 100644 --- a/lib/graphql/validation.rb +++ b/lib/graphql/validation.rb @@ -25,7 +25,7 @@ GraphQL::Argument.accepts_definitions \ validate_with: ->(type_defn, validator) { type_defn.define do - prepare ->(arg) do + prepare ->(arg, _ctx) do result = validator.call(arg.to_h) raise ArgumentValidationError, result if result.failure? result.output
Fix warning about arity of prepare
diff --git a/spec/data/local_authorities_csv_spec.rb b/spec/data/local_authorities_csv_spec.rb index abc1234..def5678 100644 --- a/spec/data/local_authorities_csv_spec.rb +++ b/spec/data/local_authorities_csv_spec.rb @@ -0,0 +1,88 @@+describe "local-authorities.csv" do + let(:path_to_csv) { File.expand_path("../../data/local-authorities.csv", File.dirname(__FILE__)) } + let(:expected_structure) do + { + id: { + matcher: /^\d+$/, + optional: false, + }, + gss: { + matcher: /^[A-Z]\d+$/, + optional: false, + }, + snac: { + matcher: /^[0-9]+{2}([A-Z+]{2})?|[EN][0-9]+{8}$/, # Seems to vary, e.g. `47`, `19UJ`, `E06000062` + optional: false, + }, + local_custodian_code: { + matcher: /^\d+{3,4}$/, + optional: true, # We're missing values for some local authorities + }, + tier_id: { + matcher: /^[1-3]$/, + optional: false, + }, + parent_local_authority_id: { + matcher: /^\d+$/, + optional: true, + }, + slug: { + matcher: /^[a-z-]+$/, + optional: false, + }, + country_name: { + matcher: /^England|Scotland|Wales|Northern Ireland+$/, + optional: false, + }, + homepage_url: { + matcher: /^https?:\/\/.+$/, + optional: true, # For row 423 (11-DUPLICATE) buckinghamshire-county-council + }, + name: { + matcher: /^[a-zA-Z ,&-]+$/, + optional: false, + }, + } + end + + it "contains a consistent number of 'columns' in each row" do + rows = CSV.read(path_to_csv) + column_counts = rows.map(&:count).uniq + + expect(column_counts.count).to eq(1), "Inconsistent CSV: every row should have same number of columns. Detected the following column counts: #{column_counts}. Is there an extra comma somewhere?" + end + + it "has headings in the right order" do + rows = CSV.read(path_to_csv) + expected_headings = expected_structure.keys.map(&:to_s) + + expect(rows.first).to eq(expected_headings) + end + + it "has rows that follow the right structure" do + rows = CSV.read(path_to_csv) + data_rows = rows.drop(1) + + expect(data_rows).to all(have_valid_structure) + end +end + +RSpec::Matchers.define :have_valid_structure do + match do |row| + options = expected_structure.values + row.each_with_index do |value, index| + if value.nil? + if options[index][:optional] + next + else + return false # datapoint was `nil` when it shouldn't be + end + end + return false unless value.match(options[index][:matcher]) + end + end + + failure_message do |row| + "row #{row} did not match expected structure" + end +end
Test that data CSV is valid This checks that the CSV has the right number of values in each row, and that each value is in the format we expect. It also checks that the headings are in the order we expect. The regexes used in these tests are for sense-checking only. For example, checking that the URL field begins with `http` is a sufficient sense-check, rather than finding a water-tight URL validator, which should be the responsibility of the model. In writing these tests, I noted a few quirks with the current production data, which I will correct in the next few commits.
diff --git a/spec/lib/nacre/order_collection_spec.rb b/spec/lib/nacre/order_collection_spec.rb index abc1234..def5678 100644 --- a/spec/lib/nacre/order_collection_spec.rb +++ b/spec/lib/nacre/order_collection_spec.rb @@ -2,40 +2,33 @@ describe Nacre::OrderCollection do - describe '#orders' do + let(:parametrized_order_list) do + [ + { + order_id: '123444', + parent_order_id: '555555' + } + ] + end - let(:parametrized_order_list) do - [ - { - order_id: '123444', - parent_order_id: '555555' - } - ] + let(:subject) { Nacre::OrderCollection.new(parametrized_order_list) } + + it_should_behave_like 'Enumerable' + + context 'initialization' do + + describe '.new' do + it 'should create a list of Orders' do + expect(subject.first).to be_a(Nacre::Order) + end end - let(:subject) { Nacre::OrderCollection.new(parametrized_order_list) } + describe '.from_json' do + let(:orders_json) { fixture_file_content('order.json') } + let(:subject) { Nacre::OrderCollection.from_json(orders_json) } - let(:order) { subject.members.first } - - it 'should have members' do - expect(order.id).to eql('123444') - expect(order.parent_order_id).to eql('555555') - end - - it_should_behave_like 'Enumerable' - end - - describe '.from_json' do - - let(:orders_json) { fixture_file_content('order.json') } - let(:orders) { Nacre::OrderCollection.from_json(orders_json) } - - describe '.members' do - let(:order) { orders.members.first } - - it 'should be a list of order-like objects' do - expect(order.id).to eql('123456') - expect(order.parent_order_id).to eql('123455') + it 'should be a list of Orders' do + expect(subject.first).to be_a(Nacre::Order) end end end
Make OrderCollection spec test the right things OrderCollection was testing things in Order, so now it just makes sure it has an Order, which seems like a reasonable thing to depend on until we add more resources.
diff --git a/chamber.gemspec b/chamber.gemspec index abc1234..def5678 100644 --- a/chamber.gemspec +++ b/chamber.gemspec @@ -26,7 +26,6 @@ spec.add_runtime_dependency "hashie", "~> 2.0" - spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 2.14" spec.add_development_dependency "simplecov", "~> 0.7"
Remove bundler from the development dependencies. It lives outside of gemspecs
diff --git a/lib/instagram/response.rb b/lib/instagram/response.rb index abc1234..def5678 100644 --- a/lib/instagram/response.rb +++ b/lib/instagram/response.rb @@ -4,9 +4,12 @@ data = response_hash.data.dup rescue response_hash data.extend( self ) data.instance_exec do - @pagination = response_hash.pagination - @meta = response_hash.meta - @ratelimit = ::Hashie::Mash.new(ratelimit_hash) + %w{pagination meta}.each do |k| + response_hash.public_send(k).tap do |v| + instance_variable_set("@#{k}", v) if v + end + end + ratelimit = ::Hashie::Mash.new(ratelimit_hash) end data end
Fix "can't modify frozen NilClass".
diff --git a/lib/jekyll_test_plugin.rb b/lib/jekyll_test_plugin.rb index abc1234..def5678 100644 --- a/lib/jekyll_test_plugin.rb +++ b/lib/jekyll_test_plugin.rb @@ -15,6 +15,8 @@ end class TestGenerator < Jekyll::Generator + safe true + def generate(site) site.pages << TestPage.new(site, site.source, '', 'test.txt') end
Set it to true so it'll run in a whitelist. /cc @benbalter
diff --git a/lib/parse-model-scaffold.rb b/lib/parse-model-scaffold.rb index abc1234..def5678 100644 --- a/lib/parse-model-scaffold.rb +++ b/lib/parse-model-scaffold.rb @@ -2,7 +2,7 @@ require 'parse-model-scaffold/parse_inspector' require 'parse-model-scaffold/parse_class_builder' -class ParseModelGenerator +class ParseModelScaffold def initialize(appId, apiKey) @api = ParseApi.new appId, apiKey
Change main class name to match Gem name
diff --git a/lib/persey/adapters/yaml.rb b/lib/persey/adapters/yaml.rb index abc1234..def5678 100644 --- a/lib/persey/adapters/yaml.rb +++ b/lib/persey/adapters/yaml.rb @@ -6,7 +6,7 @@ class << self def load(file, env) begin - raw_hash = YAML.load_file(file) + raw_hash = YAML.load(ERB.new(File.read(file)).result) symbolize_keys(raw_hash) rescue puts "FATAL: Error while process config from file '#{file}'"
Add ERB support in YAML files
diff --git a/lib/htmlentities/decoder.rb b/lib/htmlentities/decoder.rb index abc1234..def5678 100644 --- a/lib/htmlentities/decoder.rb +++ b/lib/htmlentities/decoder.rb @@ -9,11 +9,11 @@ def decode(source) prepare(source).gsub(@entity_regexp){ if $1 && codepoint = @map[$1] - [codepoint].pack('U') + codepoint.chr(Encoding::UTF_8) elsif $2 - [$2.to_i(10)].pack('U') + $2.to_i(10).chr(Encoding::UTF_8) elsif $3 - [$3.to_i(16)].pack('U') + $3.to_i(16).chr(Encoding::UTF_8) else $& end
Use chr instead of pack It expresses the intention more clearly, and it's about twice as fast.
diff --git a/lib/rack/quote_displayer.rb b/lib/rack/quote_displayer.rb index abc1234..def5678 100644 --- a/lib/rack/quote_displayer.rb +++ b/lib/rack/quote_displayer.rb @@ -1,20 +1,25 @@+require 'rack' + class QuoteDisplayer attr_reader :quotes - def initialize(app) - @app = app #rails application - @quotes= IO.readlines('lib/fixtures/rickygervais.txt').each { |line| line.chomp } + def initialize(application) + @app = application + @quotes= IO.readlines('./spec/fixtures/rickygervais.txt').each { |line| line.chomp } end def call(env) #environment hash - req = Request.new(env) + req = Rack::Request.new(env) if req.GET["quote"] == "random" [200, {"Content-Type" => "text/html"}, "\"#{@quotes.sample}\""] else - raise "Invalid params" [200, {"Content-Type" => "text/html"}, "\"#{@quotes.sample}\""] end - puts "<a href='?quote=random'>Load Another</a></p>" + + res = Rack::Response.new + res.write "<title>Random Ricky Quotes</title>" + res.write "<p><a href='?quote=random'>Load Another</a></p>" + res.finish end end @@ -22,4 +27,4 @@ if $0 == __FILE__ require 'rack' Rack::Handler::WEBrick.run QuoteDisplayer.new -end+end
Refactor code to allow any params.
diff --git a/lib/rb_wunderground/base.rb b/lib/rb_wunderground/base.rb index abc1234..def5678 100644 --- a/lib/rb_wunderground/base.rb +++ b/lib/rb_wunderground/base.rb @@ -20,14 +20,16 @@ FEATURES.each do |name| define_method(name) do |arg| - url = base_url + name + "/q/" + arg + format + url = "" + url << base_url << name << "/q/" << arg << format fetch_result(url) end end def method_missing(name, *args, &block) if name =~ /^history_(.+)$/ || name =~ /^planner_(.+)$/ - url = base_url + name.to_s + "/q/" + args[0] + format + url = "" + url << base_url << name.to_s << "/q/" << args[0] << format fetch_result(url) else super
Use << instead of +
diff --git a/lib/lagomorph/subscriber.rb b/lib/lagomorph/subscriber.rb index abc1234..def5678 100644 --- a/lib/lagomorph/subscriber.rb +++ b/lib/lagomorph/subscriber.rb @@ -7,8 +7,11 @@ @worker_class = worker_class end - def subscribe(queue, channel) - queue.subscribe(manual_ack: true, block: false) do |metadata, payload| + def subscribe(queue, channel, opts={}) + subscription_opts = opts.merge(durable: true, + manual_ack: true, + block: false) + queue.subscribe(subscription_opts) do |metadata, payload| response = process_request(payload) channel.ack(metadata.delivery_tag) publish_response(channel, metadata, response) @@ -45,4 +48,4 @@ end end -end+end
Allow subscribe to take opts, and default durable: true
diff --git a/lib/recurly/xml/nokogiri.rb b/lib/recurly/xml/nokogiri.rb index abc1234..def5678 100644 --- a/lib/recurly/xml/nokogiri.rb +++ b/lib/recurly/xml/nokogiri.rb @@ -36,7 +36,7 @@ if node.text? node.text else - node.children.each { |e| return e.text if e.text? } + node.children.map { |e| e.text if e.text? }.compact.join end end end
Fix Nokogiri interpretation of empty nodes Nokogiri::Element returns the number of nodes when you call children#each, leading to text returning 0 if there are none. Instead, let's join the texts together and return that ("" instead in that last case). Signed-off-by: Stephen Celis <06fa905d7f2aaced6dc72e9511c71a2a51e8aead@stephencelis.com>
diff --git a/UIColor_Hex_Swift.podspec b/UIColor_Hex_Swift.podspec index abc1234..def5678 100644 --- a/UIColor_Hex_Swift.podspec +++ b/UIColor_Hex_Swift.podspec @@ -12,4 +12,5 @@ s.source_files = 'HEXColor/*.{h,swift}' s.frameworks = ['UIKit'] s.requires_arc = true + s.swift_versions = ['5.0'] end
Fix -- [!] Usage of the `.swift_version` file has been deprecated! Please delete the file and use the `swift_versions` attribute within your podspec instead.
diff --git a/spec/requests/public/viewing_talks_for_an_event_spec.rb b/spec/requests/public/viewing_talks_for_an_event_spec.rb index abc1234..def5678 100644 --- a/spec/requests/public/viewing_talks_for_an_event_spec.rb +++ b/spec/requests/public/viewing_talks_for_an_event_spec.rb @@ -3,9 +3,9 @@ RSpec.describe "Creating a Talk", type: :request do let(:organizer) { User.create username: "corey" } let(:event_params) { {title: "Example Event"} } + let(:event) { organizer.create_event event_params } context "With no talks accepted for the event" do it "Shows a message about no talks registered yet" do - event = organizer.create_event event_params get event_path(event) @@ -16,7 +16,6 @@ context "With talks accepted for the event" do it "Shows the talks" do - event = organizer.create_event event_params talk1 = event.submit_talk topic: "Example Topic 1", email: "corey@example.com" talk2 = event.submit_talk topic: "Example Topic 2", email: "corey@example.com"
Clean up spec a little bit around creating an event through the organizer
diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb index abc1234..def5678 100644 --- a/app/helpers/pages_helper.rb +++ b/app/helpers/pages_helper.rb @@ -7,12 +7,11 @@ content = page.title if content.nil? begin link_to(content, - (page.advanced_path.blank? ? show_path(page.title.gsub(/ /, '_')) : @controller.send(page.advanced_path)), + (page.advanced_path.blank? ? show_path(page.title.gsub(/ /, '_')) : @controller.send(page.advanced_path, params[:args])), options.merge({:title => page.description}) ) rescue Exception => exception - coder = HTMLEntities.new - flash.now[:error] = "<h2>Advanced Path Error</h2><p>#{coder.encode(exception.message)}</p>" + content end end
Fix for advanced_path requiring arguments.
diff --git a/lib/tasks/spree_chimpy.rake b/lib/tasks/spree_chimpy.rake index abc1234..def5678 100644 --- a/lib/tasks/spree_chimpy.rake +++ b/lib/tasks/spree_chimpy.rake @@ -20,4 +20,19 @@ puts nil, 'done' end end + + namespace :users do + desc 'segment all subscribed users' + task segment: :environment do + if Spree::Chimpy.segment_exists? + emails = Spree.user_class.where(subscribed: true).pluck(:email) + puts "Segmenting all subscribed users" + response = Spree::Chimpy.list.segment(emails) + response["errors"].each do |error| + puts "Error #{error["code"]} with email: #{error["email"]} \n msg: #{error["msg"]}" + end + puts "done" + end + end + end end
Add rake task for segmenting users Rake task will segment all subscribed users and print out errors if it encounters any.
diff --git a/lib/pliny/helpers/params.rb b/lib/pliny/helpers/params.rb index abc1234..def5678 100644 --- a/lib/pliny/helpers/params.rb +++ b/lib/pliny/helpers/params.rb @@ -7,7 +7,7 @@ private def parse_body_params - if request.content_type == "application/json" + if request.media_type == "application/json" p = indifferent_params(MultiJson.decode(request.body.read)) request.body.rewind p
Check media_type instead of content_type. This will allow Content-Types header values such as "application/json;charset=utf-8".
diff --git a/postgresql_connector.gemspec b/postgresql_connector.gemspec index abc1234..def5678 100644 --- a/postgresql_connector.gemspec +++ b/postgresql_connector.gemspec @@ -1,6 +1,6 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| - s.name = 'postgresql_connector' + s.name = 'postgresql-connector' s.summary = 'PostgreSQL Connector for Sequel' s.version = '0.0.0' s.authors = [''] @@ -9,5 +9,5 @@ s.platform = Gem::Platform::RUBY s.required_ruby_version = '>= 1.9.2' - s.add_runtime_dependency 'sequel', '4.21.0' + s.add_runtime_dependency 'sequel', '4.14.0' end
Use sequel version 4.14.0 and update gem name to match file structure.
diff --git a/lib/mail/gpg/sign_part.rb b/lib/mail/gpg/sign_part.rb index abc1234..def5678 100644 --- a/lib/mail/gpg/sign_part.rb +++ b/lib/mail/gpg/sign_part.rb @@ -12,12 +12,25 @@ end end - def self.signature_valid?(plain, signature, options = {}) - if !(signature.has_content_type? && ('application/pgp-signature' == signature.mime_type)) + def self.signature_valid?(plain_part, signature_part, options = {}) + if !(signature_part.has_content_type? && + ('application/pgp-signature' == signature_part.mime_type)) return false end - GpgmeHelper.sign_verify(plain.encoded, signature.body.encoded, options) + # Work around the problem that plain_part.raw_source prefixes an + # erronous CRLF, <https://github.com/mikel/mail/issues/702>. + if ! plain_part.raw_source.empty? + plaintext = [ plain_part.header.raw_source, + "\r\n\r\n", + plain_part.body.raw_source + ].join + else + plaintext = plain_part.encoded + end + + signature = signature_part.body.encoded + GpgmeHelper.sign_verify(plaintext, signature, options) end end end
Fix signature verification for external messages. Mail::Body.encoded returns an altered string compared to the original if the original wasn't created with Mail.
diff --git a/lib/ridgepole/cli/config.rb b/lib/ridgepole/cli/config.rb index abc1234..def5678 100644 --- a/lib/ridgepole/cli/config.rb +++ b/lib/ridgepole/cli/config.rb @@ -42,6 +42,7 @@ 'username' => uri.user, 'password' => uri.password, 'host' => uri.host, + 'port' => uri.port, 'database' => uri.path.sub(%r|\A/|, ''), } end
Fix database url parse: parse port num
diff --git a/recipes/_ruby.rb b/recipes/_ruby.rb index abc1234..def5678 100644 --- a/recipes/_ruby.rb +++ b/recipes/_ruby.rb @@ -28,6 +28,10 @@ package 'ruby2.0' package 'ruby2.0-dev' +# Nokogiri requires XML +package 'libxslt-dev' +package 'libxml2-dev' + gem_package 'bundler' execute 'bundle[install]' do
Fix up a few minor issues on the DevVM with VirtualBox
diff --git a/lib/twentyfour_seven_office/services/authentication.rb b/lib/twentyfour_seven_office/services/authentication.rb index abc1234..def5678 100644 --- a/lib/twentyfour_seven_office/services/authentication.rb +++ b/lib/twentyfour_seven_office/services/authentication.rb @@ -10,6 +10,10 @@ operations :login, :has_session def self.login(credential) + if credential.is_a?(Hash) + credential = TwentyfourSevenOffice::DataTypes::Credential.new(credential) + end + r = super message: credential.to_message_hash session_id = r.body[:login_response][:login_result] TwentyfourSevenOffice::DataTypes::SessionId.new(session_id: session_id)
Convert hash argument to Credential data type
diff --git a/lib/search/query_helpers.rb b/lib/search/query_helpers.rb index abc1234..def5678 100644 --- a/lib/search/query_helpers.rb +++ b/lib/search/query_helpers.rb @@ -3,21 +3,14 @@ module QueryHelpers private - # Combine filters using an operator - # - # `filters` should be a sequence of filters. nil filters are ignored. - # `op` should be :and or :or - # - # If 0 non-nil filters are supplied, returns nil. Otherwise returns the - # elasticsearch query required to match the filters - def combine_filters(filters, op) + def combine_by_should(filters) filters = filters.compact if filters.empty? nil elsif filters.length == 1 filters.first else - { op => filters } + { bool: { should: filters } } end end
Simplify and update combining filters Combining filters is only necessary for the or/should case. The 'and' case is the default: https://www.elastic.co/guide/en/elasticsearch/guide/current/combining-filters.html#bool-filter :or and :and are deprecated and replaced by a 'bool' query - https://www.elastic.co/guide/en/elasticsearch/reference/5.5/query-dsl-and-query.html Comment is removed because it does not add anything anymore
diff --git a/activerecord/test/cases/adapters/mysql/quoting_test.rb b/activerecord/test/cases/adapters/mysql/quoting_test.rb index abc1234..def5678 100644 --- a/activerecord/test/cases/adapters/mysql/quoting_test.rb +++ b/activerecord/test/cases/adapters/mysql/quoting_test.rb @@ -15,14 +15,14 @@ def test_quoted_date_precision_for_gte_564 @conn.stubs(:full_version).returns('5.6.4') - @conn.remove_instance_variable(:@version) + @conn.remove_instance_variable(:@version) if @conn.instance_variable_defined?(:@version) t = Time.now.change(usec: 1) assert_match(/\.000001\z/, @conn.quoted_date(t)) end def test_quoted_date_precision_for_lt_564 @conn.stubs(:full_version).returns('5.6.3') - @conn.remove_instance_variable(:@version) + @conn.remove_instance_variable(:@version) if @conn.instance_variable_defined?(:@version) t = Time.now.change(usec: 1) refute_match(/\.000001\z/, @conn.quoted_date(t)) end
Remove ivar only when defined this fixes a failing test case
diff --git a/zircon.gemspec b/zircon.gemspec index abc1234..def5678 100644 --- a/zircon.gemspec +++ b/zircon.gemspec @@ -14,4 +14,6 @@ gem.name = "zircon" gem.require_paths = ["lib"] gem.version = Zircon::VERSION + + gem.add_development_dependency "rspec" end
Add RSpec dependency for development
diff --git a/app/jobs/prepare_benchmark_execution_job.rb b/app/jobs/prepare_benchmark_execution_job.rb index abc1234..def5678 100644 --- a/app/jobs/prepare_benchmark_execution_job.rb +++ b/app/jobs/prepare_benchmark_execution_job.rb @@ -4,14 +4,16 @@ benchmark_definition = BenchmarkDefinition.find(benchmark_definition_id) benchmark_execution = BenchmarkExecution.find(benchmark_execution_id) + benchmark_execution.status = 'PREPARING' benchmark_execution.start_time = Time.now - benchmark_definition.save + benchmark_execution.save %x( cd "#{benchmark_definition.vagrant_directory_path}"; vagrant up ) # TODO: Handle stdout, stderr redirection into a logging directory (not . due to vagrant sync, which may result in an endless loop) and exit_code benchmark_execution.end_time = Time.now + benchmark_execution.status = 'WAITING' benchmark_execution.save end end
Add BenchmarkExecution status update and fix mixing up execution and definition on save
diff --git a/app/models/spree/stock/package_decorator.rb b/app/models/spree/stock/package_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/stock/package_decorator.rb +++ b/app/models/spree/stock/package_decorator.rb @@ -1,6 +1,6 @@ module Spree::Stock::PackageDecorator def shipping_methods - if (vendor = stock_location.vendor) + if (vendor = stock_location.vendor && Spree::ShippingMethod.method_defined?(:vendor)) vendor.shipping_methods.to_a else shipping_categories.map(&:shipping_methods).reduce(:&).to_a
Return all shipping methods when Shipping Methods aren't vendorized
diff --git a/log.gemspec b/log.gemspec index abc1234..def5678 100644 --- a/log.gemspec +++ b/log.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-log' - s.version = '0.5.2.1' + s.version = '0.6.0.0' s.summary = 'Logging to STD IO with levels, tagging, and coloring' s.description = ' '
Package version is increased from 0.5.2.1 to 0.6.0.0
diff --git a/core/lib/tasks/refinery.rb b/core/lib/tasks/refinery.rb index abc1234..def5678 100644 --- a/core/lib/tasks/refinery.rb +++ b/core/lib/tasks/refinery.rb @@ -1,3 +1,4 @@+=begin # Because we use plugins that are shipped via gems, we lose their rake tasks. # So here, we find them (if there are any) and include them into rake. extra_rake_tasks = [] @@ -16,3 +17,4 @@ # Load in any extra tasks that we've found. extra_rake_tasks.flatten.reject{|t| t.nil? or t =~ /rspec/ }.uniq.each {|rake| load rake } +=end
Disable loading in of extra tasks.