diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -3,8 +3,7 @@ # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -#SESSION_KEY_NAME = YAML.load_file(File.join(File.dirname(__FILE__), '../sugar_conf.yml'))['session_key'] -SESSION_KEY_NAME = '_sugar_session' +SESSION_KEY_NAME = Sugar.config(:session_key) SESSION_KEY = File.read(File.join(File.dirname(__FILE__), '../session_key')) ActionController::Base.session = {
Use session key from config
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/chef/attributes/default.rb +++ b/cookbooks/chef/attributes/default.rb @@ -5,4 +5,4 @@ default[:chef][:server][:version] = "12.13.0-1" # Set the default client version -default[:chef][:client][:version] = "12.19.33" +default[:chef][:client][:version] = "12.19.36"
Update chef client to 12.19.36
diff --git a/cookbooks/nelhage/recipes/default.rb b/cookbooks/nelhage/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/nelhage/recipes/default.rb +++ b/cookbooks/nelhage/recipes/default.rb @@ -8,9 +8,10 @@ # include_recipe "nelhage::nginx" -include_recipe "nelhage::users" include_recipe "nelhage::packages" include_recipe "nelhage::gitolite" include_recipe "golang" golang_package 'github.com/nelhage/daemonlogger' + +include_recipe "nelhage::users"
Fix ordering issue with groups.
diff --git a/socketry.gemspec b/socketry.gemspec index abc1234..def5678 100644 --- a/socketry.gemspec +++ b/socketry.gemspec @@ -26,5 +26,5 @@ spec.add_runtime_dependency "hitimes", "~> 1.2" - spec.add_development_dependency "bundler", [">= 1.0", "< 3"] + spec.add_development_dependency "bundler" end
Drop version specificity in bundler dep in gemspec
diff --git a/lib/pusher-fake/support/base.rb b/lib/pusher-fake/support/base.rb index abc1234..def5678 100644 --- a/lib/pusher-fake/support/base.rb +++ b/lib/pusher-fake/support/base.rb @@ -1,7 +1,7 @@ %w(app_id key secret).each do |setting| next unless Pusher.public_send(setting).nil? - warn("Warning: Pusher.#{setting} is not set." \ + warn("Warning: Pusher.#{setting} is not set. " \ "Should be set before including PusherFake") end
Add a missing space to setting warng message.
diff --git a/Formula/gpsbabel.rb b/Formula/gpsbabel.rb index abc1234..def5678 100644 --- a/Formula/gpsbabel.rb +++ b/Formula/gpsbabel.rb @@ -4,6 +4,7 @@ url 'http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/distfiles/gpsbabel-1.4.2.tar.gz' homepage 'http://www.gpsbabel.org' md5 '76ea9f7852be2e98aa18976c4697ca93' + head "cvs://:pserver:anonymous@gpsbabel.cvs.sourceforge.net:/cvsroot/gpsbabel:gpsbabel", :using => :cvs depends_on 'libusb' depends_on 'expat'
Add development version of GPSBabel Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
diff --git a/lib/mina-circle/helpers.rb b/lib/mina-circle/helpers.rb index abc1234..def5678 100644 --- a/lib/mina-circle/helpers.rb +++ b/lib/mina-circle/helpers.rb @@ -16,7 +16,8 @@ build_artifacts = successful_for_job.last.artifacts - build_artifacts.find { |artifact| artifact.filename == settings[:circleci_artifact] } + deploy_artifact = build_artifacts.find { |artifact| artifact.filename == settings[:circleci_artifact] } + deploy_artifact.url rescue RuntimeError => e puts "Unable to determine url for deployment artifact" puts e.message
fix: Return artifact url instead of instance
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 @@ -2,6 +2,8 @@ namespace :taxonomy do desc "Count all content tagged to each level in the taxonomy" task count_content_per_level: :environment do + Statsd.logger = Logger.new(STDOUT) + m = Metrics::ContentDistributionMetrics.new m.count_content_per_level m.average_tagging_depth @@ -9,6 +11,8 @@ desc "Record metrics on content coverage for the Topic Taxonomy" task record_content_coverage_metrics: :environment do + Statsd.logger = Logger.new(STDOUT) + Metrics::ContentCoverageMetrics.new.record_all end end
Set Statsd.logger to STDOUT for taxonomy metric rake tasks
diff --git a/lib/tracksperanto/block_init.rb b/lib/tracksperanto/block_init.rb index abc1234..def5678 100644 --- a/lib/tracksperanto/block_init.rb +++ b/lib/tracksperanto/block_init.rb @@ -1,7 +1,7 @@ # Implements the conventional constructor with "hash of attributes" and block support module Tracksperanto::BlockInit - def initialize(**object_attribute_hash) - object_attribute_hash.map { |(k, v)| public_send("#{k}=", v) } + def initialize(attributes = {}) + attributes.map { |(k, v)| public_send("#{k}=", v) } yield(self) if block_given? end end
Switch back to attributes for BlockInit as the kwargs version would cause issues with Ruby 3
diff --git a/lib/websync/passenger/client.rb b/lib/websync/passenger/client.rb index abc1234..def5678 100644 --- a/lib/websync/passenger/client.rb +++ b/lib/websync/passenger/client.rb @@ -1,5 +1,3 @@-require 'json' -require 'http' module WebSync module Passenger # @@ -14,7 +12,9 @@ yield(self) if block_given? end - def call + def call(agent, event, *args) + require 'json' + require 'http' Http.accept(:json).post(url) end
Fix the expected call API
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,9 +4,9 @@ license 'Apache License, Version 2.0' description 'Set of utility resources which can be used to setup Kerberos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.1' +version '0.1.2' -depends 'krb5', '~> 1.0' +depends 'krb5', '>= 1.0.4' depends 'yum-epel' %w(amazon centos debian redhat scientific ubuntu).each do |os|
Update version constraint and version bump to 0.1.2
diff --git a/lib/restclient/response.rb b/lib/restclient/response.rb index abc1234..def5678 100644 --- a/lib/restclient/response.rb +++ b/lib/restclient/response.rb @@ -6,7 +6,9 @@ include AbstractResponse - attr_accessor :args, :body, :net_http_res + attr_accessor :args, :net_http_res + + attr_writer :body def body self
Fix to redefine reader method This commit removes below interpreter warning. * warning: method redefined
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,5 +4,6 @@ license 'All rights reserved' description 'Installs/Configures GitLab using omnibus-gitlab' long_description 'Installs/Configures GitLab using omnibus-gitlab' -version '0.2.1' +version '0.3.0' +depends 'gitlab-attributes-with-secrets'
Add gitlab-attributes-with-secrets dependency, bump the version of this cookbook.
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -7,7 +7,7 @@ version "1.2.0" depends "apt", "~> 2.9" -depends "docker", "~> 2.0" +depends "docker", "2.6.6" depends "packagecloud", "~> 0.1" depends "openssl", "~> 4.4"
Fix the Docker cookbook dependency. The Docker cookbook loads a specific version of the docker-api gem, which is incompatible with ChefSpec. This is a continuation of 4f08c93. See: https://github.com/sethvargo/chefspec/issues/676
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,8 +5,8 @@ description 'Provides docker_service, docker_image, and docker_container resources' version '2.4.9' -source_url 'https://github.com/someara/chef-docker' -issues_url 'https://github.com/someara/chef-docker/issues' +source_url 'https://github.com/chef-cookbooks/docker' +issues_url 'https://github.com/chef-cookbooks/docker/issues' depends 'compat_resource', '~> 12.5.26'
Fix issues_url and source_url urls
diff --git a/config/initializers/restrict_parsers.rb b/config/initializers/restrict_parsers.rb index abc1234..def5678 100644 --- a/config/initializers/restrict_parsers.rb +++ b/config/initializers/restrict_parsers.rb @@ -0,0 +1,4 @@+# Turn off XML parsing: +# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion +# ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML) +# ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::JSON)
Disable XML and JSON parameter parsers They're really not necessary for static
diff --git a/lib/asciidoctor/doctest/version.rb b/lib/asciidoctor/doctest/version.rb index abc1234..def5678 100644 --- a/lib/asciidoctor/doctest/version.rb +++ b/lib/asciidoctor/doctest/version.rb @@ -1,5 +1,5 @@ module Asciidoctor module DocTest - VERSION = '1.5.1' + VERSION = '1.5.2.dev' end end
Prepare for next development iteration
diff --git a/lib/celluloid/io/common_methods.rb b/lib/celluloid/io/common_methods.rb index abc1234..def5678 100644 --- a/lib/celluloid/io/common_methods.rb +++ b/lib/celluloid/io/common_methods.rb @@ -2,10 +2,29 @@ module IO # Common implementations of methods originall from the IO class module CommonMethods - def __get_actor + # Are we inside of a Celluloid::IO actor? + def evented? + Celluloid.current_actor.is_a? Celluloid::IO + end + + # Wait until the current object is readable + def wait_readable actor = Celluloid.current_actor - raise NotActorError, "Celluloid::IO objects can only be used inside actors" unless actor - actor + if actor.class < Celluloid::IO + actor.wait_readable self.to_io + else + Kernel.select [self.to_io] + end + end + + # Wait until the current object is writable + def wait_writable + actor = Celluloid.current_actor + if actor.class < Celluloid::IO + actor.wait_writable self.to_io + else + Kernel.select [], [self.to_io] + end end def read(length, buffer = nil) @@ -33,8 +52,7 @@ begin read_nonblock(length, buffer) rescue ::IO::WaitReadable - # Le sigh, exceptions for control flow ;( - __get_actor.wait_readable self.to_io + wait_readable retry end @@ -49,7 +67,7 @@ begin written = write_nonblock(string) rescue ::IO::WaitWritable - __get_actor.wait_writable self.to_io + wait_writable retry rescue EOFError return total_written
Support blocking I/O outside Celluloid::IO actors
diff --git a/lib/comptroller/claim_error.rb b/lib/comptroller/claim_error.rb index abc1234..def5678 100644 --- a/lib/comptroller/claim_error.rb +++ b/lib/comptroller/claim_error.rb @@ -5,6 +5,8 @@ collection_path '/duxware_errors' include_root_in_json true + attributes :error_message, :created_at, :external_id + def eql?(other) id.eql? other.id end
Add error_message, created_at, and external_id attrs to ClaimError
diff --git a/lib/kosmos/packages/cacteye.rb b/lib/kosmos/packages/cacteye.rb index abc1234..def5678 100644 --- a/lib/kosmos/packages/cacteye.rb +++ b/lib/kosmos/packages/cacteye.rb @@ -8,3 +8,14 @@ merge_directory 'Ships' end end + +class CacteyeRecompiledLatestHullcam < Kosmos::Package + title 'CactEye Recompiled with Latest Hullcam VDS' + url 'http://www.mediafire.com/download/iuiq2cwx0sh3124/CactEyeTelescope.dll' + + do_not_unzip! + + def install + merge_directory 'CactEyeTelescope.dll', into: 'GameData/CactEye/Plugins' + end +end
Add a bugfix for the CactEye package.
diff --git a/lib/imap/backup/serializer/mbox.rb b/lib/imap/backup/serializer/mbox.rb index abc1234..def5678 100644 --- a/lib/imap/backup/serializer/mbox.rb +++ b/lib/imap/backup/serializer/mbox.rb @@ -13,6 +13,13 @@ def append(message) File.open(pathname, "ab") do |file| file.write message + end + end + + def read(offset, length) + File.open(pathname, "rb") do |f| + f.seek offset + f.read length end end
Read messages from MBox by offset
diff --git a/tasks/boxes.rake b/tasks/boxes.rake index abc1234..def5678 100644 --- a/tasks/boxes.rake +++ b/tasks/boxes.rake @@ -11,7 +11,7 @@ sh 'cd boxes/quantal64 && sudo ./download-ubuntu' sh 'rm -f boxes/quantal64/rootfs.tar.gz' sh 'cd boxes/quantal64 && sudo tar --numeric-owner -czf rootfs.tar.gz ./rootfs/*' - sh "cd boxes/quantal64 && sudo chown #{ENV['USER']}:#{ENV['USER']} rootfs.tar.gz && tar -czf ../output/lxc-quantal64.box ./* --exclude=rootfs-amd64 --exclude=download-ubuntu" + sh "cd boxes/quantal64 && sudo chown #{ENV['USER']}:#{ENV['USER']} rootfs.tar.gz && tar -czf ../output/lxc-quantal64.box ./* --exclude=rootfs/* --exclude=download-ubuntu" sh 'cd boxes/quantal64 && sudo rm -rf rootfs-amd64' end end
Update quantal64 package task to exclude files from new rootfs path
diff --git a/lib/omniauth/strategies/ufc.rb b/lib/omniauth/strategies/ufc.rb index abc1234..def5678 100644 --- a/lib/omniauth/strategies/ufc.rb +++ b/lib/omniauth/strategies/ufc.rb @@ -16,7 +16,7 @@ param_name: 'access_token' } - uid { raw_info['id'].to_s } + uid { raw_info['uid'].to_s } info do {
Use user uid instead of id.
diff --git a/lib/perpetuity/identity_map.rb b/lib/perpetuity/identity_map.rb index abc1234..def5678 100644 --- a/lib/perpetuity/identity_map.rb +++ b/lib/perpetuity/identity_map.rb @@ -6,12 +6,13 @@ .flatten .group_by(&:klass) .map { |klass, ref| - [klass, - Hash[ - mapper_registry[klass].select { |object| - object.id.in ref.map(&:id).uniq - }.map { |obj| [obj.id, obj] } - ] + [ + klass, + Hash[ + mapper_registry[klass].select { |object| + object.id.in ref.map(&:id).uniq + }.map { |obj| [obj.id, obj] } + ] ] } ]
Clean up indentation in IdentityMap
diff --git a/lib/rails_multisite/railtie.rb b/lib/rails_multisite/railtie.rb index abc1234..def5678 100644 --- a/lib/rails_multisite/railtie.rb +++ b/lib/rails_multisite/railtie.rb @@ -20,8 +20,6 @@ if ENV['RAILS_DB'].present? ConnectionManagement.establish_connection(db: ENV['RAILS_DB'], raise_on_missing: true) end - else - ConnectionManagement.set_current_db end end end
Fix gem breaking when multisite config is not present.
diff --git a/lib/sequel-reporter/helpers.rb b/lib/sequel-reporter/helpers.rb index abc1234..def5678 100644 --- a/lib/sequel-reporter/helpers.rb +++ b/lib/sequel-reporter/helpers.rb @@ -14,6 +14,7 @@ def table(report, options = {}) Table.new(report) do |t| t.decorate :all => NumberDecorator.new + t.attributes[:class] = 'table table-striped table-hover table-bordered table-condensed' yield t if block_given? end.render end
Add some default classes to the table
diff --git a/lib/stuff-classifier/tf-idf.rb b/lib/stuff-classifier/tf-idf.rb index abc1234..def5678 100644 --- a/lib/stuff-classifier/tf-idf.rb +++ b/lib/stuff-classifier/tf-idf.rb @@ -7,7 +7,7 @@ total_categories = categories.length categories_with_word = (@wcount[word] || []).length - idf = Math.log((total_categories + 2) / (categories_with_word + 1.0), 10) + idf = Math.log10((total_categories + 2) / (categories_with_word + 1.0)) return tf * idf end
Use Math.log10 instead of Math.log for sake of Ruby 1.8 users.
diff --git a/lib/yard/server/webrick_adapter.rb b/lib/yard/server/webrick_adapter.rb index abc1234..def5678 100644 --- a/lib/yard/server/webrick_adapter.rb +++ b/lib/yard/server/webrick_adapter.rb @@ -3,14 +3,6 @@ module YARD module Server class WebrickAdapter < Adapter - def mount_command(path, command, options) - mount_servlet(path, WebrickServlet, command, options) - end - - def mount_servlet(path, servlet, *args) - server.mount(path, servlet, self, *args) - end - def start server_options[:ServerType] = WEBrick::Daemon if server_options[:daemonize] server = WEBrick::HTTPServer.new(server_options)
Remove unnecessary code from WebrickAdapter
diff --git a/spec/models/charge_rate_spec.rb b/spec/models/charge_rate_spec.rb index abc1234..def5678 100644 --- a/spec/models/charge_rate_spec.rb +++ b/spec/models/charge_rate_spec.rb @@ -16,7 +16,7 @@ it "should return as string the title" do @charge_rate = Factory.build(:charge_rate) - @charge_rate.to_s.should == "Title: 9.99" + @charge_rate.to_s.should == "Title (9.99)" @charge_rate.to_s(:long).should == "Title: 9.99 (14.04.2011 - 14.04.2011)" end end
Update spec for new charge rate title.
diff --git a/lib/data_mapper/property_set.rb b/lib/data_mapper/property_set.rb index abc1234..def5678 100644 --- a/lib/data_mapper/property_set.rb +++ b/lib/data_mapper/property_set.rb @@ -40,27 +40,11 @@ end def defaults - @defaults = reject { |property| property.lazy? } - - class << self - def defaults - @defaults - end - end - - defaults + @defaults || @defaults = reject { |property| property.lazy? } end def key - @key = select { |property| property.key? } - - class << self - def key - @key - end - end - - key + @key || @key = select { |property| property.key? } end def dup
Use safer || initializer vs singleton-class overwrites.
diff --git a/lib/discordrb/events/generic.rb b/lib/discordrb/events/generic.rb index abc1234..def5678 100644 --- a/lib/discordrb/events/generic.rb +++ b/lib/discordrb/events/generic.rb @@ -1,7 +1,3 @@-def not!(object) - Negated.new(object) -end - module Discordrb::Events class Negated attr_reader :object @@ -51,3 +47,7 @@ end end end + +def not!(object) + Discordrb::Events::Negated.new(object) +end
Move not! to the end of the file
diff --git a/lib/instana/frameworks/rails.rb b/lib/instana/frameworks/rails.rb index abc1234..def5678 100644 --- a/lib/instana/frameworks/rails.rb +++ b/lib/instana/frameworks/rails.rb @@ -16,6 +16,10 @@ ::Instana.logger.warn "Instrumenting Rack" app.config.middleware.insert 0, ::Instana::Rack end + + config.after_initialize do + require "instana/frameworks/instrumentation/active_record" + end end end end
Load ActiveRecord instrumentation _after_ Rails initializes
diff --git a/textrazor.gemspec b/textrazor.gemspec index abc1234..def5678 100644 --- a/textrazor.gemspec +++ b/textrazor.gemspec @@ -22,7 +22,7 @@ spec.add_dependency "fast_open_struct" spec.add_development_dependency "bundler", "~> 2.1.4" - spec.add_development_dependency "rake", "~> 12.3.3" + spec.add_development_dependency "rake", "~> 13.0.1" spec.add_development_dependency "rspec", "~> 3.9.0" spec.add_development_dependency "dotenv", "~> 2.0" end
Update rake requirement from ~> 12.3.3 to ~> 13.0.1 Updates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v12.3.3...v13.0.1) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/test/test_app.rb b/test/test_app.rb index abc1234..def5678 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -6,8 +6,6 @@ setup do @path = cloned_testpath("examples/sample-blog.git") - config = Jekyll.configuration({'source' => @path}) - @site = Jekyll::Site.new(config) Shwedagon::App.set :blog, @path end @@ -26,15 +24,33 @@ post 'save-post', :method => 'put', :post => { :title => 'Create new post test', :content => 'Body content for new post'} + assert_equal last_response.status, 302 + get '/' - assert_match /Create new post test/, last_response.body - get '/edit/create-new-post.md' + post_date = (Time.now).strftime("%Y-%m-%d") + get "/edit/#{post_date}-create-new-post-test.md" + + assert_equal last_response.status, 200 assert_match /Body content for new post/, last_response.body end + test "Delete a post" do + post 'save-post', :method => 'put', :post => + { :title => 'Deletable post', + :content => 'Body content for new post'} + + get '/' + assert_match /Deletable post/, last_response.body + + get '/delete/deletable-post.md' + assert_match 302, last_response.status + + get '/edit/create-new-post.md' + assert_match 404, last_response.status + end def app Shwedagon::App
Add more tests for deleting
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index abc1234..def5678 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -2,7 +2,7 @@ ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../../config/environment', __FILE__) +require File.expand_path('../dummy/config/environment.rb', __FILE__) abort('The Rails environment is running in production mode!') if Rails.env.production?
Fix rspec dummy app config path
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index abc1234..def5678 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -2,7 +2,6 @@ require 'simplecov' SimpleCov.minimum_coverage 100 - SimpleCov.start 'rails' end @@ -10,7 +9,6 @@ require 'spec_helper' require File.expand_path('../../config/environment', __FILE__) require 'rspec/rails' -require 'paper_trail/frameworks/rspec' Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
Remove Paper Trail test helpers Remove Paper Trail test helpers as they are broken, and manually tested in spec/support/models/default.rb
diff --git a/lib/travis/api/v3/models/log.rb b/lib/travis/api/v3/models/log.rb index abc1234..def5678 100644 --- a/lib/travis/api/v3/models/log.rb +++ b/lib/travis/api/v3/models/log.rb @@ -24,7 +24,7 @@ end def repository_private? - job.repository.private? + job.repository.private? unless job.nil? end private
Check if there's an existing job
diff --git a/spec/factories/profiles.rb b/spec/factories/profiles.rb index abc1234..def5678 100644 --- a/spec/factories/profiles.rb +++ b/spec/factories/profiles.rb @@ -0,0 +1,28 @@+# == Schema Information +# +# Table name: profiles +# +# id :integer not null, primary key +# name :string +# bio :text +# work_company :string +# work_title :string +# location :string +# twitter_username :string +# rate_email :decimal(, ) default(0.0), not null +# rate_sms :decimal(, ) default(0.0), not null +# created_at :datetime not null +# updated_at :datetime not null +# + + +FactoryGirl.define do + factory :profile do + # profile settings + name { Faker::Name.name } + bio { Faker::Lorem.sentence 3, true, 12 } + work_company { Faker::Company.name } + work_title { Faker::Name.title } + location { Faker::Address.city } + end +end
Create profile factory and annotate
diff --git a/spec/frame_options_spec.rb b/spec/frame_options_spec.rb index abc1234..def5678 100644 --- a/spec/frame_options_spec.rb +++ b/spec/frame_options_spec.rb @@ -3,7 +3,7 @@ describe Rack::Protection::FrameOptions do it_behaves_like "any rack application" - it 'should set the X-XSS-Protection' do + it 'should set the X-Frame-Options' do get('/').headers["X-Frame-Options"].should == "sameorigin" end
Fix typo in FrameOptions example description
diff --git a/spec/models/player_spec.rb b/spec/models/player_spec.rb index abc1234..def5678 100644 --- a/spec/models/player_spec.rb +++ b/spec/models/player_spec.rb @@ -41,8 +41,4 @@ it "should have default plus minus of zero" do @new_player.plus_minus.should == 0 end - - it "test failure" do - fail "make sure ci fails when it should" - end end
Revert "Make sure CI fails when it's supposed to" CI does fail when it should (i.e. when a test fails). This reverts commit 3c0712fb2465e14f91d16eaeae0ba6b4e76dfa93.
diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -8,6 +8,6 @@ protected def configure_permitted_parameters - devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:name, :username, :email, :remember_me) } + devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:password, :password_confirmation, :name, :username, :email, :remember_me) } end end
Allow password and password confirmation parameters
diff --git a/test/models/category_test.rb b/test/models/category_test.rb index abc1234..def5678 100644 --- a/test/models/category_test.rb +++ b/test/models/category_test.rb @@ -17,4 +17,21 @@ test "Category's children should not be empty" do assert_not @category.children.empty? end + + test "Category tree nodes should match category relationships" do + categories = Category.all.includes(children: :child).to_a.index_by(&:id) + tree_to_array(Category.get_tree).each do |node| + should_be = categories[node[0]].children.map {|i| i.child_id}.sort + assert(node[1].sort == should_be, + "Children array of #{node[0]}:#{categories[node[0]].name}, " \ + "should be #{should_be} but was #{node[1]}") + end + end + + def tree_to_array(tree) + ary_of_arys = tree.map do |node| + [[ node[0].id, node[1].map{ |i| i[0].id }.sort ]] + tree_to_array(node[1]) + end + ary_of_arys.inject([]) { |flat_ary, ary| flat_ary + ary } + end end
Add test for Category get_tree method
diff --git a/lib/cortex/snippets/client/helper.rb b/lib/cortex/snippets/client/helper.rb index abc1234..def5678 100644 --- a/lib/cortex/snippets/client/helper.rb +++ b/lib/cortex/snippets/client/helper.rb @@ -23,6 +23,10 @@ def seo_keywords webpage[:seo_keyword_list] + end + + def seo_robots + webpage[:seo_robots] end def noindex
Add Seo Robots to deliver indexing info
diff --git a/test/test_active_model_lint.rb b/test/test_active_model_lint.rb index abc1234..def5678 100644 --- a/test/test_active_model_lint.rb +++ b/test/test_active_model_lint.rb @@ -10,4 +10,9 @@ def setup @model = Post.new end + + def test_naming + Post.model_name.plural.should == 'posts' + Post.new.respond_to?(:model_name).should be_false + end end
Test case for proper use of ActiveModel::Naming
diff --git a/spec/lib/stateoscope/adapter_registry_spec.rb b/spec/lib/stateoscope/adapter_registry_spec.rb index abc1234..def5678 100644 --- a/spec/lib/stateoscope/adapter_registry_spec.rb +++ b/spec/lib/stateoscope/adapter_registry_spec.rb @@ -0,0 +1,100 @@+require 'spec_helper' +require 'pry' + +RSpec.describe Stateoscope::AdapterRegistry do + describe '#register' do + let(:adapter) { class_double(Stateoscope::Adapter::Base) } + + it 'registers an adapter' do + subject.register(adapter) + expect(subject.adapters).to eq([adapter]) + end + end + + describe '#find' do + DummyClass = Class.new + + before do + adapters.each do |adapter| + subject.register(adapter) + end + end + + context 'when a matching adapter exists' do + let(:matching_adapter) do + class_double(Stateoscope::Adapter::Base) + end + + let(:adapters) do + [ + class_double(Stateoscope::Adapter::Base, handle?: false), + class_double(Stateoscope::Adapter::Base, handle?: false), + matching_adapter + ] + end + + it 'finds the adapter' do + expect(matching_adapter).to receive(:handle?).with(DummyClass, :foo).and_return(true) + expect(subject.find(DummyClass, :foo)).to eq(matching_adapter) + end + end + + context 'when no matching adapter exists' do + let(:adapters) do + [ + class_double(Stateoscope::Adapter::Base, handle?: false), + class_double(Stateoscope::Adapter::Base, handle?: false) + ] + end + + it 'returns nil' do + expect(subject.find(DummyClass, :foo)).to eq(nil) + end + end + end + + describe '#find!' do + DummyClass = Class.new + + before do + adapters.each do |adapter| + subject.register(adapter) + end + end + + context 'when a matching adapter exists' do + let(:matching_adapter) do + class_double(Stateoscope::Adapter::Base) + end + + let(:adapters) do + [ + class_double(Stateoscope::Adapter::Base, handle?: false), + class_double(Stateoscope::Adapter::Base, handle?: false), + matching_adapter + ] + end + + it 'finds the adapter' do + expect(matching_adapter).to receive(:handle?).with(DummyClass, :foo).and_return(true) + expect(subject.find!(DummyClass, :foo)).to eq(matching_adapter) + end + end + + context 'when no matching adapter exists' do + let(:adapters) do + [ + class_double(Stateoscope::Adapter::Base, handle?: false), + class_double(Stateoscope::Adapter::Base, handle?: false) + ] + end + + it 'raises an error' do + expect { subject.find!(DummyClass, :foo) }.to( + raise_error(Stateoscope::MissingAdapterError) + .with_message('unsupported state machine implementation') + ) + end + end + end +end
Add spec for adapter registry
diff --git a/config/initializers/requires.rb b/config/initializers/requires.rb index abc1234..def5678 100644 --- a/config/initializers/requires.rb +++ b/config/initializers/requires.rb @@ -1,6 +1,6 @@ require 'rubygems/format' require 'rubygems/indexer' -require 'rdoc/markup/simple_markup' -require 'rdoc/markup/simple_markup/to_html' +require 'rdoc/markup' +require 'rdoc/markup/to_html' require 'simple_ssl_requirement' require 'active_support/builder'
Bring initializers up-to-date with the latest version of rdoc
diff --git a/lib/authorize/authorize.rb b/lib/authorize/authorize.rb index abc1234..def5678 100644 --- a/lib/authorize/authorize.rb +++ b/lib/authorize/authorize.rb @@ -15,7 +15,7 @@ def permit(authorization_expression, options = {}) auth_options = options.slice!(:only, :except) append_before_filter(options) do |controller| - controller.permit(authorization_expression, options) + controller.permit(authorization_expression, auth_options) end end end
Fix bug in passing authorization options from class-level permission check
diff --git a/lib/bombshell/completor.rb b/lib/bombshell/completor.rb index abc1234..def5678 100644 --- a/lib/bombshell/completor.rb +++ b/lib/bombshell/completor.rb @@ -11,7 +11,9 @@ end def self.filter(m) - m - Bombshell::Environment.instance_methods - Bombshell::Shell::Commands::HIDE + (m - Bombshell::Environment.instance_methods - Bombshell::Shell::Commands::HIDE).reject do |m| + m =~ /^_/ + end end end end
Hide _initial_underscore methods from tab completion
diff --git a/db/migrate/20170116103602_add_tokens_to_course_lesson_plan_items.rb b/db/migrate/20170116103602_add_tokens_to_course_lesson_plan_items.rb index abc1234..def5678 100644 --- a/db/migrate/20170116103602_add_tokens_to_course_lesson_plan_items.rb +++ b/db/migrate/20170116103602_add_tokens_to_course_lesson_plan_items.rb @@ -2,5 +2,29 @@ def change add_column :course_lesson_plan_items, :opening_reminder_token, :float add_column :course_lesson_plan_items, :closing_reminder_token, :float + + Course::Assessment.joins(:lesson_plan_item). + where('course_lesson_plan_items.start_at > ?', Time.zone.now).find_each do |assessment| + # Remove milliseconds part of the assessment + assessment.lesson_plan_item.update_column(:start_at, assessment.start_at.change(usec: 0)) + + # Create the new reminder job + token = Time.zone.now.to_f.round(5) + assessment.lesson_plan_item.update_column(:opening_reminder_token, token) + Course::Assessment::OpeningReminderJob.set(wait_until: assessment.start_at). + perform_later(assessment.updater, assessment, token) + end + + Course::Assessment.joins(:lesson_plan_item). + where('course_lesson_plan_items.end_at > ?', 1.day.from_now).find_each do |assessment| + # Remove milliseconds part of the assessment + assessment.lesson_plan_item.update_column(:end_at, assessment.end_at.change(usec: 0)) + + # Create the new reminder job + token = Time.zone.now.to_f.round(5) + assessment.lesson_plan_item.update_column(:closing_reminder_token, token) + Course::Assessment::ClosingReminderJob.set(wait_until: assessment.end_at - 1.day). + perform_later(assessment.updater, assessment, token) + end end end
Remove milliseconds part of the time and create new jobs for assessments
diff --git a/lib/cradlepointr/router.rb b/lib/cradlepointr/router.rb index abc1234..def5678 100644 --- a/lib/cradlepointr/router.rb +++ b/lib/cradlepointr/router.rb @@ -1,7 +1,7 @@ module Cradlepointr class Router < CradlepointObject - attr_accessor :id, :data, :ecm_firmware_id + attr_accessor :id, :data, :ecm_firmware_uri, :ecm_configuration_uri def initialize(id = nil) self.id = id @@ -32,20 +32,25 @@ self.data = Cradlepointr.handle_response RestClient.get(build_url(rel_url_with_id)) end - def firmware_id - self.ecm_firmware_id ? self.firmware_id : lazy_load_router_data + def firmware_uri + self.ecm_firmware_uri ? self.ecm_firmware_uri : lazy_load_router_data + end + + def confirmation_uri + self.ecm_confirmation_uri ? self.ecm_confirmation_id : lazy_load_router_data end def lazy_load_router_data get # Grab the data from the api. - self.ecm_firmware_id = self.data['data']['actual_firmware'].split('/').last + self.ecm_firmware_uri = self.data['data']['actual_firmware'] + self.ecm_configuration_uri = self.data['data']['actual'] end def get_configuration_editor_data { account: account.rel_url_with_id, - baseline: '', - firmware: '', + baseline: confirmation_uri, + firmware: firmware_uri, router: rel_url_with_id } end
Store uri rather than id for config blobs.
diff --git a/lib/debot/recipes/nginx.rb b/lib/debot/recipes/nginx.rb index abc1234..def5678 100644 --- a/lib/debot/recipes/nginx.rb +++ b/lib/debot/recipes/nginx.rb @@ -11,6 +11,7 @@ desc "Setup nginx configuration for this application" task :setup, roles: :web do + domains = Setup.parse_domain(domain) run "mkdir -p #{shared_path}/nginx" template "nginx_unicorn.erb", "#{shared_path}/nginx/nginx_conf" run "#{sudo} mv #{shared_path}/nginx/nginx_conf /etc/nginx/sites-enabled/#{domain}"
Use parse_domain methods to obtain domains variable
diff --git a/lib/relish/options_file.rb b/lib/relish/options_file.rb index abc1234..def5678 100644 --- a/lib/relish/options_file.rb +++ b/lib/relish/options_file.rb @@ -14,6 +14,7 @@ # will be overwritten. def store(options) new_options = self.options.merge(options) + FileUtils.touch(@path) File.open(@path, 'w') do |file| YAML.dump(new_options, file) end
Add touch after failing cuke
diff --git a/lib/resque-retry/server.rb b/lib/resque-retry/server.rb index abc1234..def5678 100644 --- a/lib/resque-retry/server.rb +++ b/lib/resque-retry/server.rb @@ -7,10 +7,14 @@ helpers do # builds a retry key for the specified job. def retry_key_for_job(job) - klass = Resque.constantize(job['class']) - if klass.respond_to?(:redis_retry_key) - klass.redis_retry_key(job['args']) - else + begin + klass = Resque.constantize(job['class']) + if klass.respond_to?(:redis_retry_key) + klass.redis_retry_key(job['args']) + else + nil + end + rescue NameError nil end end
Return nil in retry_key_for_job if the application code is not loaded.
diff --git a/lib/ry_safe/shell/shell.rb b/lib/ry_safe/shell/shell.rb index abc1234..def5678 100644 --- a/lib/ry_safe/shell/shell.rb +++ b/lib/ry_safe/shell/shell.rb @@ -1,7 +1,12 @@ module RySafe class Shell def initialize - init_readline + Readline.completion_append_character = Autocompletion::APPEND_CHAR + + Readline.completion_proc = lambda do |string| + line = Readline.line_buffer + Autocompletion.new(line, string).suggestions + end end def prompt @@ -26,16 +31,5 @@ def eval_command line Commands::Dispatcher.new(line).call end - - protected - - def init_readline - Readline.completion_append_character = Autocompletion::APPEND_CHAR - - Readline.completion_proc = lambda do |string| - line = Readline.line_buffer - Autocompletion.new(line, string).suggestions - end - end end end
Move readline initialization to initialize
diff --git a/lib/liftoff/project_configuration.rb b/lib/liftoff/project_configuration.rb index abc1234..def5678 100644 --- a/lib/liftoff/project_configuration.rb +++ b/lib/liftoff/project_configuration.rb @@ -2,8 +2,22 @@ class ProjectConfiguration LATEST_IOS = 7.0 - attr_accessor :project_name, :company, :prefix, :configure_git, :warnings_as_errors, :enable_static_analyzer, :indentation_level, :warnings, :application_target_groups, :unit_test_target_groups, :use_cocoapods, :run_script_phases - attr_writer :author, :company_identifier, :use_tabs + attr_accessor :project_name, + :company, + :prefix, + :configure_git, + :warnings_as_errors, + :enable_static_analyzer, + :indentation_level, + :warnings, + :application_target_groups, + :unit_test_target_groups, + :use_cocoapods, + :run_script_phases + + attr_writer :author, + :company_identifier, + :use_tabs def initialize(liftoffrc) deprecations = DeprecationManager.new
Break configuration attributes into multiple lines
diff --git a/lib/spikor_forge/module.rb b/lib/spikor_forge/module.rb index abc1234..def5678 100644 --- a/lib/spikor_forge/module.rb +++ b/lib/spikor_forge/module.rb @@ -1,8 +1,4 @@ require 'spikor_forge' -require 'puppet' -require 'puppet/module_tool/metadata' -require 'puppet/module_tool/modulefile' -require 'tempfile' require 'json' class SpikorForge::Module @@ -12,37 +8,21 @@ @path = path @uripath = path[uri_root_path.chomp('/').length..-1].chomp('/') - # Modulefiles are actually ruby code that should be evaluated. - # So exctract it to a temporary file and evaluate. - modulefile = Tempfile.new('foo') - `tar -z -x -O --wildcards -f #{path} '*/Modulefile' > #{modulefile.path}` - @metadata = Puppet::ModuleTool::Metadata.new() - Puppet::ModuleTool::ModulefileReader.evaluate(@metadata, modulefile.path) - modulefile.close - modulefile.unlink + @metadata = JSON.parse `tar -z -x -O --wildcards -f #{path} '*/metadata.json'` end def dependencies - @metadata.dependencies.collect do |dep| - # Due to Puppet issue #21749 we have to do some awkward accessing here - [dep.instance_variable_get(:@full_module_name), dep.instance_variable_get(:@full_module_name) || '' ] + @metadata['dependencies'].collect do |dep| + [dep['name'], dep['version_requirement'] || '' ] end end def version - @metadata.version - end - - def username - @metadata.username + @metadata['version'] end def name - @metadata.name - end - - def full_module_name - @metadata.full_module_name + @metadata['name'] end def to_hash
Switch to using metadata.json instead of Modulefile This should be faster and more compatible with custom code in the Modulefile.
diff --git a/lib/neighborparrot/index_template.rb b/lib/neighborparrot/index_template.rb index abc1234..def5678 100644 --- a/lib/neighborparrot/index_template.rb +++ b/lib/neighborparrot/index_template.rb @@ -37,7 +37,7 @@ :-) <script> broker = new Broker("<%= server_url %>"); - broker.open(); + setTimeout(function() { broker.open(); }, 0); </script> </body> </html>
Add timeout avoiding long time loading in webkit
diff --git a/db/migrate/20100826150615_remove_ext_memberships.rb b/db/migrate/20100826150615_remove_ext_memberships.rb index abc1234..def5678 100644 --- a/db/migrate/20100826150615_remove_ext_memberships.rb +++ b/db/migrate/20100826150615_remove_ext_memberships.rb @@ -1,6 +1,6 @@ class RemoveExtMemberships < ActiveRecord::Migration def self.up - Membership.find_all_by_role(10).each{|d|d.destroy} + Membership.delete_all(:role => 10) end def self.down
Refactor migration for destroying useless roles. Same behaviour, better performance.
diff --git a/core/numeric/ceil_spec.rb b/core/numeric/ceil_spec.rb index abc1234..def5678 100644 --- a/core/numeric/ceil_spec.rb +++ b/core/numeric/ceil_spec.rb @@ -2,13 +2,14 @@ require File.dirname(__FILE__) + '/fixtures/classes' describe "Numeric#ceil" do - before(:each) do - @obj = NumericSub.new - end - it "converts self to a Float (using #to_f) and returns the #ceil'ed result" do - @obj.should_receive(:to_f).and_return(1 + TOLERANCE, - 1 - TOLERANCE) - @obj.ceil.should == 2 - @obj.ceil.should == -1 + o = mock_numeric("ceil") + o.should_receive(:to_f).and_return(1 + TOLERANCE) + o.ceil.should == 2 + + o2 = mock_numeric("ceil") + v = -1 - TOLERANCE + o2.should_receive(:to_f).and_return(v) + o2.ceil.should == -1 end end
Use mock_numeric rather than NumericSub
diff --git a/engines/synergy/app/helpers/synergy/pages_helper.rb b/engines/synergy/app/helpers/synergy/pages_helper.rb index abc1234..def5678 100644 --- a/engines/synergy/app/helpers/synergy/pages_helper.rb +++ b/engines/synergy/app/helpers/synergy/pages_helper.rb @@ -9,27 +9,11 @@ if node.content if node.content['body'] node.content['body']['value'] + elsif node.content['extra'] + node.content['extra']['value'] end end end - def tree_view(label_method = :to_s, node = nil, level = -1) - if node.nil? - puts "root" - nodes = roots - else - label = "|_ #{node.send(label_method)}" - if level == 0 - puts " #{label}" - else - puts " |#{" "*level}#{label}" - end - nodes = node.children - end - nodes.each do |child| - tree_view(label_method, child, level+1) - end - end - end end
Add content extra to node display
diff --git a/db/migrate/20191218011609_update_audits_slowly.rb b/db/migrate/20191218011609_update_audits_slowly.rb index abc1234..def5678 100644 --- a/db/migrate/20191218011609_update_audits_slowly.rb +++ b/db/migrate/20191218011609_update_audits_slowly.rb @@ -1,16 +1,8 @@ class UpdateAuditsSlowly < ActiveRecord::Migration[5.2] - def up - change_column_type(:jsonb) { |audit| YAML.load(audit.old_changes) } - end - - def down - change_column_type(:text) { |audit| audit.old_changes } - end - - def change_column_type(column_type) + def change Audited::Audit.find_each do |audit| puts "At #{audit.id}" if audit.id % 1000 == 0 - audit.update!(audited_changes: yield(audit)) + audit.update!(audited_changes: audit.old_changes) end remove_column :audits, :old_changes end
Fix YAML load which doesn't seem to be working
diff --git a/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb b/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb index abc1234..def5678 100644 --- a/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb +++ b/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb @@ -2,19 +2,14 @@ module BackgroundMigration class MigrateBuildStageIdReference def perform(start_id, stop_id) - scope = if stop_id.to_i.nonzero? - "ci_builds.id BETWEEN #{start_id.to_i} AND #{stop_id.to_i}" - else - "ci_builds.id >= #{start_id.to_i}" - end - sql = <<-SQL.strip_heredoc - UPDATE "ci_builds" - SET "stage_id" = + UPDATE ci_builds + SET stage_id = (SELECT id FROM ci_stages WHERE ci_stages.pipeline_id = ci_builds.commit_id AND ci_stages.name = ci_builds.stage) - WHERE #{scope} AND "ci_builds"."stage_id" IS NULL + WHERE ci_builds.id BETWEEN #{start_id.to_i} AND #{stop_id.to_i} + AND ci_builds.stage_id IS NULL SQL ActiveRecord::Base.connection.execute(sql)
Simplify stage_id migration as we now use relations
diff --git a/tribune-svgo_wrapper.gemspec b/tribune-svgo_wrapper.gemspec index abc1234..def5678 100644 --- a/tribune-svgo_wrapper.gemspec +++ b/tribune-svgo_wrapper.gemspec @@ -8,8 +8,8 @@ spec.version = SvgoWrapper::VERSION spec.authors = ["gdeoliveira"] spec.email = ["gdeoliveira@tribune.com"] - spec.summary = %q{Write a short summary. Required.} - spec.description = %q{Write a longer description. Optional.} + spec.summary = "Simple `svgo` wrapper." + spec.description = "This is a simple wrapper for the `svgo` command line tool." spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add small description to gemspec.
diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb index abc1234..def5678 100644 --- a/test/dummy/config/environments/development.rb +++ b/test/dummy/config/environments/development.rb @@ -23,5 +23,5 @@ config.action_dispatch.best_standards_support = :builtin # Do not compress assets - config.assets.compress = false + # config.assets.compress = false end
Remove Rails 3.1 config setting
diff --git a/league_api.gemspec b/league_api.gemspec index abc1234..def5678 100644 --- a/league_api.gemspec +++ b/league_api.gemspec @@ -18,4 +18,5 @@ spec.require_paths = ["lib"] spec.add_development_dependency "rspec" + spec.add_development_dependency "rake" end
Add back rake development_dependency for Travis
diff --git a/lib/puppet-lint/plugins/yumrepo_gpgcheck_enabled.rb b/lib/puppet-lint/plugins/yumrepo_gpgcheck_enabled.rb index abc1234..def5678 100644 --- a/lib/puppet-lint/plugins/yumrepo_gpgcheck_enabled.rb +++ b/lib/puppet-lint/plugins/yumrepo_gpgcheck_enabled.rb @@ -20,7 +20,7 @@ setting = content_token.next_code_token.next_code_token # skip if valid. we only care about broken settings. - next if ['True', 1, '1', 'Yes'].include? setting.value + next if ['true', 1, '1', 'yes'].include? setting.value notify :warning, { message: 'yumrepo should enable the gpgcheck attribute',
Allow true and yes to match the correct settings https://puppet.com/docs/puppet/5.5/types/yumrepo.html#yumrepo-attribute-gpgcheck states: gpgcheck (Property: This attribute represents concrete state on the target system.) Whether to check the GPG signature on packages installed from this repository. Valid values are: false/0/no or true/1/yes. Set this to absent to remove it from the file completely. Valid values are absent. Values can match /^(true|false|0|1|no|yes)$/.
diff --git a/features/support/rebuild_conf.rb b/features/support/rebuild_conf.rb index abc1234..def5678 100644 --- a/features/support/rebuild_conf.rb +++ b/features/support/rebuild_conf.rb @@ -3,12 +3,14 @@ require 'ptools' require 'pathname' - @path_name = File.join( Dir.home, '.rbld', 'rebuild.conf' ) + @conf_dir = File.join( Dir.home, '.rbld') + @path_name = File.join( @conf_dir, 'rebuild.conf' ) end attr_reader :path_name def fill(content) + FileUtils.mkdir_p( @conf_dir ) open(@path_name, 'w') { |f| f.write(content) } end
tests: Create ~/.rbld dir if it does not exist Signed-off-by: Dmitry Fleytman <a8cf97adadec4e1b734a39bc5aea71b5741cfca1@daynix.com>
diff --git a/lib/css_inliner.rb b/lib/css_inliner.rb index abc1234..def5678 100644 --- a/lib/css_inliner.rb +++ b/lib/css_inliner.rb @@ -2,7 +2,6 @@ require 'rubygems' require 'nokogiri' require 'css_inliner/version' -require 'css_inliner/integrator' require 'css_inliner/inliner' module CSSInliner
Fix a bug, loaded non-existing file: integrator.rb
diff --git a/lib/name_finder.rb b/lib/name_finder.rb index abc1234..def5678 100644 --- a/lib/name_finder.rb +++ b/lib/name_finder.rb @@ -14,25 +14,16 @@ end def find_in(haystack) - each_set_of_words(haystack) do |words| - found = root.find(words + delimiter) - return found if found + find(haystack) do |found| + return found end nil end def find_all_in(haystack) - remaining = haystack + delimiter [].tap { |all| - while remaining.length > 0 - found = root.find(remaining) - if found - all << found - remaining = remaining[found.length .. -1] - else - remaining = remaining.sub(/^\S+/, "") - end - remaining.lstrip! + find(haystack) do |found| + all << found end } end @@ -42,10 +33,17 @@ end private - def each_set_of_words(haystack) - words = normalize(haystack).split(/ /) - words.each_with_index do |_, i| - yield words[i .. -1].join(delimiter) + def find(haystack) + remaining = normalize(haystack) + delimiter + while remaining.length > 0 + found = root.find(remaining) + if found + yield found + remaining = remaining[found.length .. -1] + else + remaining = remaining.sub(/^\S+/, "") + end + remaining.lstrip! end end
Use same code for find_in and find_all_in
diff --git a/lib/nod/helpers.rb b/lib/nod/helpers.rb index abc1234..def5678 100644 --- a/lib/nod/helpers.rb +++ b/lib/nod/helpers.rb @@ -1,6 +1,11 @@ module Nod # lib/nod/helpers.rb module Helpers + + # make helper methods, class methods + def Helpers.included(mod) + mod.extend Helpers + end def asset_exists?(name) Dir.new(Dir.pwd).each do |asset|
Make helper methods both class and instance methods
diff --git a/lib/owners/path.rb b/lib/owners/path.rb index abc1234..def5678 100644 --- a/lib/owners/path.rb +++ b/lib/owners/path.rb @@ -17,7 +17,7 @@ configs = [] file = @file - until file.dirname == file + until file == file.dirname file = file.dirname config = file.join(CONFIG)
Swap conditional args for consistency
diff --git a/lib/display_for/builder/collection_base.rb b/lib/display_for/builder/collection_base.rb index abc1234..def5678 100644 --- a/lib/display_for/builder/collection_base.rb +++ b/lib/display_for/builder/collection_base.rb @@ -18,8 +18,8 @@ end def default_actions - action :show, :link_to => :resource_path - action :edit, :link_to => :edit_resource_path + action :show + action :edit, :link_to => lambda { |r| [:edit] + @namespace + [r] } action :delete, :method => :delete, :confirm => "Are you sure?" end end
Use polymorphic urls for default actions so they work properly when nested
diff --git a/lib/spec_helper.rb b/lib/spec_helper.rb index abc1234..def5678 100644 --- a/lib/spec_helper.rb +++ b/lib/spec_helper.rb @@ -1,3 +1,4 @@ RSpec.configure do |config| - config.backtrace_exclusion_patterns = [/lib/, /spec/] + config.backtrace_exclusion_patterns = [/lib/, /spec/, /rorr/] + config.color = true end
Add rspec color & remove backtrace with /rorr/
diff --git a/lib/taxjar/rate.rb b/lib/taxjar/rate.rb index abc1234..def5678 100644 --- a/lib/taxjar/rate.rb +++ b/lib/taxjar/rate.rb @@ -16,12 +16,7 @@ # International attribute :country, :string - - # Canada - attribute :hst, :float - attribute :pst, :float - attribute :gst, :float - attribute :qst, :float + attribute :name, :string # European Union attribute :standard_rate, :float
Add `name` param for countries and remove unused Canadian params
diff --git a/lib/analytics-js-rails.rb b/lib/analytics-js-rails.rb index abc1234..def5678 100644 --- a/lib/analytics-js-rails.rb +++ b/lib/analytics-js-rails.rb @@ -2,12 +2,12 @@ require "analytics-js/engine" module AnalyticsJs - # Unfortunately Rails doesn't provide a helper for this. So this is it. - # http://stackoverflow.com/q/7597127 + # Unfortunately Rails doesn't provide a helper for this. So this is it. Can + # be overridden in host app. + # See http://stackoverflow.com/q/7597127 def asset_url(asset) root_url[0...-1] + ActionController::Base.helpers.asset_path(asset) end end -# ActionController::Base.send :include, AnalyticsJs ActionView::Base.send :include, AnalyticsJs
Clarify notes for helper method.
diff --git a/lib/conceptql/database.rb b/lib/conceptql/database.rb index abc1234..def5678 100644 --- a/lib/conceptql/database.rb +++ b/lib/conceptql/database.rb @@ -27,7 +27,10 @@ def db_opts db_opts = {} if opts[:database_type] == :impala - db_opts.merge!(runtime_filter_mode: "OFF") + p ENV + if runtime_filter_mode = (opts[:impala_runtime_filter_mode] || ENV['IMPALA_RUNTIME_FILTER_MODE']) + db_opts.merge!(runtime_filter_mode: runtime_filter_mode) + end if mem_limit = (opts[:impala_mem_limit] || ENV['IMPALA_MEM_LIMIT']) db_opts.merge!(mem_limit: mem_limit) end
Set RUNTIME_FILTER_MODE only if asked
diff --git a/lib/harvest/time_entry.rb b/lib/harvest/time_entry.rb index abc1234..def5678 100644 --- a/lib/harvest/time_entry.rb +++ b/lib/harvest/time_entry.rb @@ -19,6 +19,7 @@ element :user_id, Integer element :closed, Boolean, :tag => 'is-closed' element :billed, Boolean, :tag => 'is-billed' + element :of_user, Integer def spent_at=(date) @spent_at = (String === date ? Time.parse(date) : date) @@ -32,6 +33,7 @@ r.tag!('project_id', project_id) if project_id r.tag!('task_id', task_id) if task_id r.tag!('spent_at', spent_at) if spent_at + r.tag!('of_user', of_user) if of_user end end
Add of_user support to Time Entry
diff --git a/lib/lita/handlers/talk.rb b/lib/lita/handlers/talk.rb index abc1234..def5678 100644 --- a/lib/lita/handlers/talk.rb +++ b/lib/lita/handlers/talk.rb @@ -10,6 +10,8 @@ def talk(payload) response = payload[:message] + return unless response.command? + message = payload[:message].body dialogue = client.create_dialogue(message, context: @context)
Fix to react only when the message was a command
diff --git a/lib/media_magick/model.rb b/lib/media_magick/model.rb index abc1234..def5678 100644 --- a/lib/media_magick/model.rb +++ b/lib/media_magick/model.rb @@ -2,28 +2,6 @@ require 'carrierwave/mongoid' require 'media_magick/attachment_uploader' require 'mongoid' - -module CarrierWave - module Uploader - module Url - extend ActiveSupport::Concern - include CarrierWave::Uploader::Configuration - - ## - # === Returns - # - # [String] the location where this file is accessible via a url - # - def url - if file.respond_to?(:url) and not file.url.blank? - file.url - elsif current_path - (base_path || "") + File.expand_path(current_path).gsub(File.expand_path(CarrierWave.root), '') - end - end - end - end -end module MediaMagick module Model
Rollback to CarrierWave 0.5.8 problem.
diff --git a/lib/mountain_berry_fields/test/rspec_formatter.rb b/lib/mountain_berry_fields/test/rspec_formatter.rb index abc1234..def5678 100644 --- a/lib/mountain_berry_fields/test/rspec_formatter.rb +++ b/lib/mountain_berry_fields/test/rspec_formatter.rb @@ -1,11 +1,11 @@ require 'rspec/core/formatters/base_formatter' +require 'json' class MountainBerryFields class Test class RSpec class Formatter < ::RSpec::Core::Formatters::BaseFormatter def example_failed(example) - require 'json' print JSON.dump 'full_description' => example.full_description, 'message' => example.exception.message, 'backtrace' => format_backtrace(example.exception.backtrace, example)
Move require statement to top of file
diff --git a/spec/common/shellshock_spec.rb b/spec/common/shellshock_spec.rb index abc1234..def5678 100644 --- a/spec/common/shellshock_spec.rb +++ b/spec/common/shellshock_spec.rb @@ -3,12 +3,12 @@ # Test to ensure bash isn't susceptible to Shellshock (CVE-2014-6271) # CVE-2014-6271 -describe command('env x='() { :;}; echo vulnerable' bash -c "echo this is a test"') do +describe command("env x='() { :;}; echo vulnerable' bash -c \"echo this is a test\"") do its(:stderr) { should_not match /vulnerable/ } end # CVE-2014-7169 -describe command('env X='() { (a)=>\' bash -c "echo date"') do +describe command("env X='() { (a)=>\' bash -c \"echo date\"") do its(:stderr) { should match /date/ } end
Use double quotes and add missing escapes
diff --git a/spec/graphql/enum_type_spec.rb b/spec/graphql/enum_type_spec.rb index abc1234..def5678 100644 --- a/spec/graphql/enum_type_spec.rb +++ b/spec/graphql/enum_type_spec.rb @@ -8,8 +8,7 @@ assert_equal(1, enum.coerce_input("COW")) end - # TODO: should probably read: ... to value's value, e.g. COW's name is 'COW', but value is 1 - it 'coerces result values to value name' do + it "coerces result values to value's value" do assert_equal("YAK", enum.coerce_result("YAK")) assert_equal("COW", enum.coerce_result(1)) end
Make test description more accurate
diff --git a/spec/lib/looples_array_spec.rb b/spec/lib/looples_array_spec.rb index abc1234..def5678 100644 --- a/spec/lib/looples_array_spec.rb +++ b/spec/lib/looples_array_spec.rb @@ -29,7 +29,7 @@ la.recurse_each_with_index do |_, i| list2 << i end - expect(list2).to eql(0...la.size).to_a + expect(list2).to eql((0...la.size).to_a) end end
Fix broken spec on loopless array
diff --git a/spec/support/shared_context.rb b/spec/support/shared_context.rb index abc1234..def5678 100644 --- a/spec/support/shared_context.rb +++ b/spec/support/shared_context.rb @@ -14,7 +14,8 @@ end def dnsimple_client - Fog::DNS.new(provider: "DNSimple", dnsimple_email: "user@email.com", dnsimple_password: "my123password") + Fog::DNS.new(provider: "DNSimple", dnsimple_email: "user@email.com", + dnsimple_password: "my123password", dnsimple_token: "abc1234") end def dnsimple_zone
Add in dnsimple_token to the shared Fog call This simulates passing in the token as a credential, but mind you all of this is Mocked so it's not quite a real-world test, just a unit. :)
diff --git a/test/integration/default/minitest/test_default.rb b/test/integration/default/minitest/test_default.rb index abc1234..def5678 100644 --- a/test/integration/default/minitest/test_default.rb +++ b/test/integration/default/minitest/test_default.rb @@ -7,6 +7,6 @@ it "check R version" do system('echo "q()" > /tmp/showversion.R') system('/usr/local/R-devel/bin/R CMD BATCH /tmp/showversion.R') - assert system('grep "R version 3.3.1 RC" showversion.Rout'), 'R version is not expected version. patched version is updated' + assert system('grep "R version 3.3.1 Patched" showversion.Rout'), 'R version is not expected version. patched version is updated' end end
Update R version for default
diff --git a/misc/test_clients/send1.rb b/misc/test_clients/send1.rb index abc1234..def5678 100644 --- a/misc/test_clients/send1.rb +++ b/misc/test_clients/send1.rb @@ -2,19 +2,20 @@ require 'json' require 'bunny' -conn = Bunny.new 'amqp://guest:guest@172.23.25.65:5672' +conn = Bunny.new 'amqp://orc-agent:ownme@mq.your.com:5672' conn.start ch = conn.create_channel -tqone = ch.queue(ARGV.first) +q = ch.queue(ARGV.first) x = ch.default_exchange msg = { handler: 'chef', - run_list: 'recipe[chef-metal::nextranet]', - override_attributes: {} + run_list: 'recipe[your_webapp:redeploy]', + override_attributes: { branch: 'ticket-3902', + treeish: '93a7de' } } puts "Sending #{msg.to_json} -> #{ARGV.first}" -x.publish(msg.to_json, routing_key: tqone.name) +x.publish(msg.to_json, routing_key: q.name) conn.close
Make send testscript more relevant.
diff --git a/youtube-dl-gui.rb b/youtube-dl-gui.rb index abc1234..def5678 100644 --- a/youtube-dl-gui.rb +++ b/youtube-dl-gui.rb @@ -10,6 +10,7 @@ depends_on :python if MacOS.version <= :snow_leopard depends_on "wxpython" + depends_on "wxmac" depends_on "ffmpeg" depends_on "py2app"
Add dependency for py2app to work.
diff --git a/lib/tasks/activities.rake b/lib/tasks/activities.rake index abc1234..def5678 100644 --- a/lib/tasks/activities.rake +++ b/lib/tasks/activities.rake @@ -0,0 +1,18 @@+namespace :activities do + desc 'Strip name prefixes like Sentence Writing: and Passage Proofreading: ' + task :strip_name_prefixes => :environment do + prefixes = [ + 'Sentence Writing: ', + 'Passage Proofreading: ' + ] + Activity.find_each do |activity| + prefixes.each do |prefix| + if activity.name.present? + activity.name = activity.name.gsub(prefix, '') + end + end + activity.save! + end + + end +end
Add rake task to strip prefixes from activity names
diff --git a/lib/tasks/joegattnet.rake b/lib/tasks/joegattnet.rake index abc1234..def5678 100644 --- a/lib/tasks/joegattnet.rake +++ b/lib/tasks/joegattnet.rake @@ -5,17 +5,17 @@ task one_minute: :environment do |t, args| EvernoteNote.sync_all sync_associated - Pantograph.update_saved_timeline end task ten_minutes: :environment do |t, args| Pantograph.publish_next + Pantograph.update_saved_timeline + end + + task one_hour: :environment do |t, args| + # Pantograph.publish_next Pantographer.follow_followers end - - # task one_hour: :environment do |t, args| - # Pantograph.publish_next - # end def sync_associated Resource.sync_all_binaries
Make Pantography calls to Twitter API less frequent Avoid exceeding rate limit.
diff --git a/stack_master.gemspec b/stack_master.gemspec index abc1234..def5678 100644 --- a/stack_master.gemspec +++ b/stack_master.gemspec @@ -20,4 +20,6 @@ spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" + spec.add_development_dependency "rspec" + spec.add_dependency "gli" end
Add rspec and GLI gems
diff --git a/lib/travis/build/script/perl6.rb b/lib/travis/build/script/perl6.rb index abc1234..def5678 100644 --- a/lib/travis/build/script/perl6.rb +++ b/lib/travis/build/script/perl6.rb @@ -29,9 +29,9 @@ def setup super if version == "latest" - sh.cmd 'rakudobrew build moar', assert: false + sh.cmd 'rakudobrew build moar', assert: false, fold: 'setup' else - sh.cmd "rakudobrew triple #{version} #{version} #{version}", assert: false + sh.cmd "rakudobrew triple #{version} #{version} #{version}", assert: false, fold: 'setup' end end
Put the rakudobrew steps into a fold
diff --git a/util/migrate-interface-type-ethernet-to-bridge.rb b/util/migrate-interface-type-ethernet-to-bridge.rb index abc1234..def5678 100644 --- a/util/migrate-interface-type-ethernet-to-bridge.rb +++ b/util/migrate-interface-type-ethernet-to-bridge.rb @@ -27,9 +27,7 @@ vlan = tap.sub(/^tap\d+-(\d+)(-\d+)?$/, '\1') source = Nokogiri::XML::Node.new "source", xml source['bridge'] = "br#{vlan}" - # interface << source - # target.add_next_sibling(source) - target.add_next_sibling("<source bridge='br#{vlan}'/>") + interface << source # Remove script; taken care of by hooks now if script = interface.at_css('script')
Add source bridge to interface
diff --git a/pummel.rb b/pummel.rb index abc1234..def5678 100644 --- a/pummel.rb +++ b/pummel.rb @@ -0,0 +1,14 @@+require 'iconv' +require 'sinatra' +require 'rss/1.0' +require 'rss/2.0' +require 'open-uri' + +@@rss_url = "http://feeds.pinboard.in/rss/u:evaryont/" +ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') +valid_string = ic.iconv(open(@@rss_url).read << ' ')[0..-2] +@@rss = RSS::Parser.parse valid_string, false + +get '/' do + "#{@@rss.channel.title} <a href='#{@@rss.channel.link}'>Go</a>" +end
Correct start: Use the built-in RSS library & Iconv
diff --git a/app/models/sms/adapters/intelli_sms_adapter.rb b/app/models/sms/adapters/intelli_sms_adapter.rb index abc1234..def5678 100644 --- a/app/models/sms/adapters/intelli_sms_adapter.rb +++ b/app/models/sms/adapters/intelli_sms_adapter.rb @@ -34,7 +34,7 @@ # builds uri based on given action and query string params def build_uri(action, params = "") "http://www.intellisoftware.co.uk/smsgateway/#{action}.aspx?" + - "username=#{configatron.outgoing_sms_username}&password=#{configatron.outgoing_sms_password}&#{params}" + "username=#{configatron.intellisms_username}&password=#{configatron.intellisms_password}&#{params}" end # sends request to given uri and returns response
Revert "fixed intellisms bug again" This reverts commit 6a7829dcab147602c3f2b439f8962e623afccffe.
diff --git a/tandem.gemspec b/tandem.gemspec index abc1234..def5678 100644 --- a/tandem.gemspec +++ b/tandem.gemspec @@ -15,7 +15,7 @@ s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] - s.add_dependency "rails", "~> 3.1.3" + s.add_dependency "rails", ">= 3.1.0" s.add_dependency "cancan" s.add_dependency "slim-rails" s.add_dependency "paperclip"
Update rails dependency to include rails > 3.1
diff --git a/Casks/waterfox.rb b/Casks/waterfox.rb index abc1234..def5678 100644 --- a/Casks/waterfox.rb +++ b/Casks/waterfox.rb @@ -1,6 +1,6 @@ cask :v1 => 'waterfox' do - version '36.0.1' - sha256 '5fa1c8c402aab32e0cfc98b1c46e81265055cda51956f29ddd03c8fb7f1e33ae' + version '38.1.0' + sha256 '612c324154107c23063a78b2040a41e6b8909baca058d98c3bfaec944e0b4cca' # cloudfront.net is the official download host per the vendor homepage url "https://d1th2p59px32bw.cloudfront.net/releases/osx64/installer/Waterfox%20#{version}%20Setup.dmg"
Upgrade Waterfox App to version 38.1.0
diff --git a/app/overrides/spree/shared/_order_details/add_digital_downloads_to_invoice.rb b/app/overrides/spree/shared/_order_details/add_digital_downloads_to_invoice.rb index abc1234..def5678 100644 --- a/app/overrides/spree/shared/_order_details/add_digital_downloads_to_invoice.rb +++ b/app/overrides/spree/shared/_order_details/add_digital_downloads_to_invoice.rb @@ -1,9 +1,9 @@ Deface::Override.new( virtual_path: 'spree/shared/_order_details', name: 'add_digital_downloads_to_invoice', - insert_bottom: 'td[data-hook="order_item_description"]', + insert_bottom: '[data-hook="order_item_description"]', text: <<-HTML - <% if @order.state == 'complete' and item.variant.digital? %> + <% if @order.state == 'complete' && @order.paid? && item.variant.digital? %> <div data-hook='download_links'> <ul> <% item.digital_links.each do |digital_link| %>
Fix for Spree 4.1+ plus this should be only available for paid orders
diff --git a/experiments/yajl-vs-oj.rb b/experiments/yajl-vs-oj.rb index abc1234..def5678 100644 --- a/experiments/yajl-vs-oj.rb +++ b/experiments/yajl-vs-oj.rb @@ -0,0 +1,34 @@+#!/usr/bin/env ruby +# frozen_string_literals: true + +require 'benchmark' +require 'yajl' +require 'oj' + +DEFAULT_ITERATIONS = 10_000 + +json = if (( filename = ARGV.shift )) + File.read( filename ) + else + "[]" + end + +iterations = if (( iter = ARGV.shift )) + iter.to_i + else + DEFAULT_ITERATIONS + end + + +data = Yajl::Parser.parse( json ) +data.freeze + +puts "#{iterations} iterations:" +Benchmark.bmbm( 100 ) do |bench| + bench.report( "Yajl (encode)" ) { iterations.times { Yajl::Encoder.encode(data) } } + bench.report( "Oj (encode)" ) { iterations.times { Oj.generate(data) } } + bench.report( "Yajl (decode)" ) { iterations.times { Yajl::Parser.parse(json) } } + bench.report( "Oj (decode)" ) { iterations.times { Oj.load(json) } } +end + +
Add experimental json library benchmarks
diff --git a/spec/controllers/authenticated_controller_spec.rb b/spec/controllers/authenticated_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/authenticated_controller_spec.rb +++ b/spec/controllers/authenticated_controller_spec.rb @@ -0,0 +1,49 @@+require 'spec_helper' + +RSpec.describe AuthenticatedController, type: :controller do + describe "GET index" do + context "when engine is embedded" do + before { BookingSync::Engine.embedded! } + + it "redirects to auth using js" do + get :index + expect(response.status).to eq(200) + expect(response.body).to eq( + "<script type='text/javascript'>top.location.href = '/auth/bookingsync/?account_id=';</script>") + end + end + + context "when engine is standalone" do + before { BookingSync::Engine.standalone! } + + it "redirects to auth using 302 redirect" do + get :index + expect(response.status).to eq(302) + expect(response.body).to eq( + "<html><body>You are being <a href=\"http://test.host/auth/bookingsync/?account_id=\">redirected</a>.</body></html>") + end + end + end + + describe "XHR index" do + context "when engine is embedded" do + before { BookingSync::Engine.embedded! } + + it "renders the target url in response" do + xhr :get, :index + expect(response.status).to eq(401) + expect(response.body).to eq("/auth/bookingsync/?account_id=") + end + end + + context "when engine is standalone" do + before { BookingSync::Engine.standalone! } + + it "renders the target url in response" do + xhr :get, :index + expect(response.status).to eq(401) + expect(response.body).to eq("/auth/bookingsync/?account_id=") + end + end + end +end
Add specs for unauthenticated responses
diff --git a/recipes/install.rb b/recipes/install.rb index abc1234..def5678 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -6,6 +6,8 @@ case node['platform_version'].to_i when 6 dep_pkgs = %w[python-cairo python-django python-django-tagging python-flup python-memcache python-pysqlite2 python-rrdtool python-simplejson python-twisted] + when 7 + deb_pkgs = %w[python-cairo python-django python-django-tagging python-flup python-memcache python-pysqlite2 python-rrdtool python-simplejson python-twisted] end end
Add packages for Debian Wheezy